@jasonshimmy/custom-elements-runtime 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements-runtime.cjs.js +15 -15
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +708 -700
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +15 -15
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/runtime/render.d.ts +1 -0
- package/package.json +1 -1
- package/dist/index.spec.d.ts +0 -1
- package/dist/router.spec.d.ts +0 -1
- package/dist/runtime/render.spec.d.ts +0 -1
- package/dist/runtime/vdom.edge.spec.d.ts +0 -1
- package/dist/runtime/vdom.spec.d.ts +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function st(e, t) {
|
|
2
|
+
return X(e ? t : [], "when-block");
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function at(e, t) {
|
|
5
5
|
return e.map((r, n) => {
|
|
6
6
|
const o = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${n}` : String(r);
|
|
7
|
-
return
|
|
7
|
+
return X(t(r, n), `each-${o}`);
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function ke() {
|
|
11
11
|
const e = [];
|
|
12
12
|
return {
|
|
13
13
|
when(t, r) {
|
|
@@ -17,18 +17,18 @@ function ve() {
|
|
|
17
17
|
return e.push([!0, t]), this;
|
|
18
18
|
},
|
|
19
19
|
done() {
|
|
20
|
-
return
|
|
20
|
+
return $e(...e);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function $e(...e) {
|
|
25
25
|
for (let t = 0; t < e.length; t++) {
|
|
26
26
|
const [r, n] = e[t];
|
|
27
|
-
if (r) return [
|
|
27
|
+
if (r) return [X(n, `whenChain-branch-${t}`)];
|
|
28
28
|
}
|
|
29
|
-
return [
|
|
29
|
+
return [X([], "whenChain-empty")];
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function X(e, t) {
|
|
32
32
|
const r = e ? Array.isArray(e) ? e.filter(Boolean) : [e].filter(Boolean) : [];
|
|
33
33
|
return {
|
|
34
34
|
tag: "#anchor",
|
|
@@ -36,7 +36,7 @@ function J(e, t) {
|
|
|
36
36
|
children: r
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
class
|
|
39
|
+
class W extends EventTarget {
|
|
40
40
|
handlers = {};
|
|
41
41
|
static instance;
|
|
42
42
|
eventCounters = /* @__PURE__ */ new Map();
|
|
@@ -44,7 +44,7 @@ class O extends EventTarget {
|
|
|
44
44
|
* Returns the singleton instance of GlobalEventBus
|
|
45
45
|
*/
|
|
46
46
|
static getInstance() {
|
|
47
|
-
return
|
|
47
|
+
return W.instance || (W.instance = new W()), W.instance;
|
|
48
48
|
}
|
|
49
49
|
// Enhanced emit method with better typing and event storm protection
|
|
50
50
|
/**
|
|
@@ -160,8 +160,8 @@ class O extends EventTarget {
|
|
|
160
160
|
this.eventCounters.clear();
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
function
|
|
163
|
+
const F = W.getInstance(), lt = (e, t) => F.emit(e, t), ct = (e, t) => F.on(e, t), ft = (e, t) => F.off(e, t), ut = (e, t) => F.once(e, t), dt = (e, t, r) => F.listen(e, t, r);
|
|
164
|
+
function le(e) {
|
|
165
165
|
let t = { ...e };
|
|
166
166
|
const r = [];
|
|
167
167
|
function n(a) {
|
|
@@ -171,18 +171,18 @@ function ie(e) {
|
|
|
171
171
|
return t;
|
|
172
172
|
}
|
|
173
173
|
function s(a) {
|
|
174
|
-
const
|
|
175
|
-
t = { ...t, ...
|
|
174
|
+
const f = typeof a == "function" ? a(t) : a;
|
|
175
|
+
t = { ...t, ...f }, i();
|
|
176
176
|
}
|
|
177
177
|
function i() {
|
|
178
178
|
r.forEach((a) => a(t));
|
|
179
179
|
}
|
|
180
180
|
return { subscribe: n, getState: o, setState: s };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function se(e) {
|
|
183
183
|
return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function ne(e) {
|
|
186
186
|
return typeof e == "string" ? e.replace(
|
|
187
187
|
/[&<>"']/g,
|
|
188
188
|
(t) => ({
|
|
@@ -194,34 +194,34 @@ function ee(e) {
|
|
|
194
194
|
})[t]
|
|
195
195
|
) : e;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function _e(e, t, r) {
|
|
198
198
|
if (r)
|
|
199
199
|
for (const [n, o] of Object.entries(r)) {
|
|
200
200
|
let s, i = {};
|
|
201
201
|
if (Array.isArray(o) ? (s = o[0], i = o[1] || {}) : s = o, t.set(n, {
|
|
202
202
|
callback: s,
|
|
203
203
|
options: i,
|
|
204
|
-
oldValue:
|
|
204
|
+
oldValue: oe(e, n)
|
|
205
205
|
}), i.immediate)
|
|
206
206
|
try {
|
|
207
|
-
const a =
|
|
207
|
+
const a = oe(e, n);
|
|
208
208
|
s(a, void 0, e);
|
|
209
209
|
} catch (a) {
|
|
210
210
|
console.error(`Error in immediate watcher for "${n}":`, a);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function oe(e, t) {
|
|
215
215
|
return t.split(".").reduce((r, n) => r?.[n], e);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function Se(e, t, r, n) {
|
|
218
218
|
const o = (i, a) => {
|
|
219
219
|
if (i === a) return !0;
|
|
220
220
|
if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
|
|
221
221
|
if (Array.isArray(i) && Array.isArray(a))
|
|
222
|
-
return i.length !== a.length ? !1 : i.every((
|
|
223
|
-
const
|
|
224
|
-
return
|
|
222
|
+
return i.length !== a.length ? !1 : i.every((p, g) => o(p, a[g]));
|
|
223
|
+
const f = Object.keys(i), u = Object.keys(a);
|
|
224
|
+
return f.length !== u.length ? !1 : f.every((p) => o(i[p], a[p]));
|
|
225
225
|
}, s = t.get(r);
|
|
226
226
|
if (s && !o(n, s.oldValue))
|
|
227
227
|
try {
|
|
@@ -232,13 +232,13 @@ function ke(e, t, r, n) {
|
|
|
232
232
|
for (const [i, a] of t.entries())
|
|
233
233
|
if (a.options.deep && r.startsWith(i + "."))
|
|
234
234
|
try {
|
|
235
|
-
const
|
|
236
|
-
o(
|
|
237
|
-
} catch (
|
|
238
|
-
console.error(`Error in deep watcher for "${i}":`,
|
|
235
|
+
const f = oe(e, i);
|
|
236
|
+
o(f, a.oldValue) || (a.callback(f, a.oldValue, e), a.oldValue = f);
|
|
237
|
+
} catch (f) {
|
|
238
|
+
console.error(`Error in deep watcher for "${i}":`, f);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Ce(e, t, r) {
|
|
242
242
|
if (!t.props) return;
|
|
243
243
|
function n(o, s) {
|
|
244
244
|
return s === Boolean ? o === "true" : s === Number ? Number(o) : o;
|
|
@@ -247,136 +247,136 @@ function $e(e, t, r) {
|
|
|
247
247
|
if (s.type === Function && typeof e[o] == "function")
|
|
248
248
|
r[o] = e[o];
|
|
249
249
|
else {
|
|
250
|
-
const i = e.getAttribute(
|
|
251
|
-
i !== null ? r[o] =
|
|
250
|
+
const i = e.getAttribute(se(o));
|
|
251
|
+
i !== null ? r[o] = ne(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = ne(s.default));
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function Ae(e, t, r, n) {
|
|
256
256
|
e.onConnected && !r && (e.onConnected(t), n(!0));
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
e.onDisconnected && e.onDisconnected(t), r.forEach((
|
|
258
|
+
function Ee(e, t, r, n, o, s, i, a) {
|
|
259
|
+
e.onDisconnected && e.onDisconnected(t), r.forEach((f) => f()), n(), o(), s(!1), i(null), a(!1);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function Te(e, t, r, n, o) {
|
|
262
262
|
e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function N(e, t) {
|
|
265
265
|
if (t && e instanceof HTMLElement) {
|
|
266
266
|
for (const r in t)
|
|
267
267
|
t[r] === e && delete t[r];
|
|
268
268
|
for (const r of Array.from(e.childNodes))
|
|
269
|
-
|
|
269
|
+
N(r, t);
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function M(e, t) {
|
|
273
273
|
return t.split(".").reduce((r, n) => r?.[n], e);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function ce(e, t, r) {
|
|
276
276
|
const n = t.split("."), o = n.pop();
|
|
277
277
|
if (!o) return;
|
|
278
278
|
const s = n.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
|
|
279
279
|
s[o] = r;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function je(e, t, r, n, o, s, i) {
|
|
282
282
|
if (!s) return;
|
|
283
|
-
const a = t.includes("lazy"),
|
|
284
|
-
const
|
|
285
|
-
return
|
|
286
|
-
},
|
|
287
|
-
let
|
|
288
|
-
const
|
|
289
|
-
if (i instanceof HTMLInputElement ?
|
|
290
|
-
if (Array.isArray(
|
|
291
|
-
const
|
|
292
|
-
i && i.checked !==
|
|
283
|
+
const a = t.includes("lazy"), f = t.includes("trim"), u = t.includes("number"), p = () => {
|
|
284
|
+
const h = s._state || s;
|
|
285
|
+
return M(h, e);
|
|
286
|
+
}, g = p();
|
|
287
|
+
let l = "text";
|
|
288
|
+
const v = n?.type;
|
|
289
|
+
if (i instanceof HTMLInputElement ? l = v || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
|
|
290
|
+
if (Array.isArray(g)) {
|
|
291
|
+
const h = i?.getAttribute("value") || n?.value || "", d = g.includes(h);
|
|
292
|
+
i && i.checked !== d && (r.checked = d);
|
|
293
293
|
} else {
|
|
294
|
-
const
|
|
295
|
-
i && i.checked !==
|
|
294
|
+
const h = i?.getAttribute("true-value") || !0, d = g === h;
|
|
295
|
+
i && i.checked !== d && (r.checked = d);
|
|
296
296
|
}
|
|
297
|
-
else if (
|
|
298
|
-
const
|
|
299
|
-
i && i.checked !==
|
|
300
|
-
} else if (
|
|
297
|
+
else if (l === "radio") {
|
|
298
|
+
const h = n?.value || "", d = g === h;
|
|
299
|
+
i && i.checked !== d && (r.checked = d);
|
|
300
|
+
} else if (l === "select")
|
|
301
301
|
if (i && i.hasAttribute("multiple")) {
|
|
302
|
-
const
|
|
302
|
+
const h = i, d = Array.isArray(g) ? g : [];
|
|
303
303
|
setTimeout(() => {
|
|
304
|
-
Array.from(
|
|
305
|
-
const
|
|
306
|
-
|
|
304
|
+
Array.from(h.options).forEach((b) => {
|
|
305
|
+
const c = d.includes(b.value);
|
|
306
|
+
b.selected !== c && (b.selected = c);
|
|
307
307
|
});
|
|
308
308
|
}, 0);
|
|
309
309
|
} else
|
|
310
310
|
setTimeout(() => {
|
|
311
|
-
i instanceof HTMLSelectElement && i.value !== String(
|
|
311
|
+
i instanceof HTMLSelectElement && i.value !== String(g) && (i.value = String(g));
|
|
312
312
|
}, 0);
|
|
313
313
|
else {
|
|
314
|
-
const
|
|
315
|
-
(!i || i.value !==
|
|
316
|
-
}
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
let
|
|
323
|
-
if (
|
|
324
|
-
if (Array.isArray(
|
|
325
|
-
const _ =
|
|
326
|
-
if (
|
|
314
|
+
const h = String(g ?? "");
|
|
315
|
+
(!i || i.value !== h) && (r.value = g);
|
|
316
|
+
}
|
|
317
|
+
const y = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", m = (h) => {
|
|
318
|
+
if (h.isComposing || o._isComposing || h.isTrusted === !1) return;
|
|
319
|
+
const d = h.target;
|
|
320
|
+
if (d._modelUpdating) return;
|
|
321
|
+
const b = p();
|
|
322
|
+
let c = d.value;
|
|
323
|
+
if (l === "checkbox")
|
|
324
|
+
if (Array.isArray(b)) {
|
|
325
|
+
const _ = d.getAttribute("value") || "", C = [...b];
|
|
326
|
+
if (d.checked)
|
|
327
327
|
C.includes(_) || C.push(_);
|
|
328
328
|
else {
|
|
329
|
-
const
|
|
330
|
-
|
|
329
|
+
const k = C.indexOf(_);
|
|
330
|
+
k > -1 && C.splice(k, 1);
|
|
331
331
|
}
|
|
332
|
-
|
|
332
|
+
c = C;
|
|
333
333
|
} else {
|
|
334
|
-
const _ =
|
|
335
|
-
|
|
334
|
+
const _ = d.getAttribute("true-value") || !0, C = d.getAttribute("false-value") || !1;
|
|
335
|
+
c = d.checked ? _ : C;
|
|
336
336
|
}
|
|
337
|
-
else if (
|
|
338
|
-
|
|
339
|
-
else if (
|
|
340
|
-
const _ =
|
|
341
|
-
|
|
337
|
+
else if (l === "radio")
|
|
338
|
+
c = d.getAttribute("value") || d.value;
|
|
339
|
+
else if (l === "select" && d.multiple) {
|
|
340
|
+
const _ = d;
|
|
341
|
+
c = Array.from(_.selectedOptions).map(
|
|
342
342
|
(C) => C.value
|
|
343
343
|
);
|
|
344
|
-
} else if (
|
|
345
|
-
const _ = Number(
|
|
346
|
-
isNaN(_) || (
|
|
344
|
+
} else if (f && (c = c.trim()), u) {
|
|
345
|
+
const _ = Number(c);
|
|
346
|
+
isNaN(_) || (c = _);
|
|
347
347
|
}
|
|
348
|
-
const x = s._state || s,
|
|
349
|
-
if (Array.isArray(
|
|
350
|
-
const _ =
|
|
351
|
-
_._modelUpdating = !0,
|
|
348
|
+
const x = s._state || s, $ = M(x, e);
|
|
349
|
+
if (Array.isArray(c) && Array.isArray($) ? JSON.stringify([...c].sort()) !== JSON.stringify([...$].sort()) : c !== $) {
|
|
350
|
+
const _ = h.target;
|
|
351
|
+
_._modelUpdating = !0, ce(x, e, c), setTimeout(() => {
|
|
352
352
|
_._modelUpdating = !1;
|
|
353
353
|
}, 0), s._requestRender && s._requestRender();
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
|
-
if (o[
|
|
357
|
-
const
|
|
356
|
+
if (o[y] = m, l === "text" || l === "textarea") {
|
|
357
|
+
const h = () => {
|
|
358
358
|
o._isComposing = !0;
|
|
359
|
-
},
|
|
359
|
+
}, d = (b) => {
|
|
360
360
|
o._isComposing = !1;
|
|
361
|
-
const
|
|
361
|
+
const c = b.target;
|
|
362
362
|
setTimeout(() => {
|
|
363
|
-
if (
|
|
364
|
-
let x =
|
|
365
|
-
if (
|
|
363
|
+
if (c) {
|
|
364
|
+
let x = c.value;
|
|
365
|
+
if (f && (x = x.trim()), u) {
|
|
366
366
|
const C = Number(x);
|
|
367
367
|
isNaN(C) || (x = C);
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
(Array.isArray(x) && Array.isArray(
|
|
371
|
-
|
|
372
|
-
}, 0)),
|
|
369
|
+
const $ = s._state || s, w = M($, e);
|
|
370
|
+
(Array.isArray(x) && Array.isArray(w) ? JSON.stringify([...x].sort()) !== JSON.stringify([...w].sort()) : x !== w) && (c && (c._modelUpdating = !0, setTimeout(() => {
|
|
371
|
+
c._modelUpdating = !1;
|
|
372
|
+
}, 0)), ce($, e, x), s._requestRender && s._requestRender());
|
|
373
373
|
}
|
|
374
374
|
}, 0);
|
|
375
375
|
};
|
|
376
|
-
o.compositionstart =
|
|
376
|
+
o.compositionstart = h, o.compositionend = d;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Le(e, t, r, n) {
|
|
380
380
|
if (n)
|
|
381
381
|
try {
|
|
382
382
|
const o = JSON.parse(e);
|
|
@@ -384,34 +384,34 @@ function Ee(e, t, r, n) {
|
|
|
384
384
|
for (const [s, i] of Object.entries(o))
|
|
385
385
|
t[s] = i;
|
|
386
386
|
} catch {
|
|
387
|
-
const o =
|
|
387
|
+
const o = M(n, e);
|
|
388
388
|
r[e] = o;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Be(e, t, r) {
|
|
392
392
|
if (!r) return;
|
|
393
|
-
const n =
|
|
393
|
+
const n = M(r, e), o = t.style || "", s = n ? "" : "none";
|
|
394
394
|
if (o) {
|
|
395
395
|
const i = o.split(";").filter(Boolean), a = i.findIndex(
|
|
396
|
-
(
|
|
396
|
+
(f) => f.trim().startsWith("display:")
|
|
397
397
|
);
|
|
398
398
|
a >= 0 ? i[a] = `display: ${s}` : i.push(`display: ${s}`), t.style = i.join("; ");
|
|
399
399
|
} else
|
|
400
400
|
t.style = `display: ${s}`;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function ze(e, t, r) {
|
|
403
403
|
if (!r) return;
|
|
404
|
-
const n =
|
|
404
|
+
const n = M(r, e);
|
|
405
405
|
let o = [];
|
|
406
406
|
typeof n == "string" ? o = [n] : Array.isArray(n) ? o = n.filter(Boolean) : typeof n == "object" && (o = Object.entries(n).filter(([, a]) => !!a).map(([a]) => a));
|
|
407
407
|
const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
|
|
408
408
|
i && (t.class = i);
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function Re(e, t, r) {
|
|
411
411
|
let n;
|
|
412
412
|
if (typeof e == "string") {
|
|
413
413
|
if (!r) return;
|
|
414
|
-
n =
|
|
414
|
+
n = M(r, e);
|
|
415
415
|
} else
|
|
416
416
|
n = e;
|
|
417
417
|
let o = "";
|
|
@@ -419,12 +419,12 @@ function Le(e, t, r) {
|
|
|
419
419
|
o = n;
|
|
420
420
|
else if (n && typeof n == "object") {
|
|
421
421
|
const i = [];
|
|
422
|
-
for (const [a,
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
422
|
+
for (const [a, f] of Object.entries(n))
|
|
423
|
+
if (f != null && f !== "") {
|
|
424
|
+
const u = a.replace(
|
|
425
425
|
/[A-Z]/g,
|
|
426
|
-
(
|
|
427
|
-
),
|
|
426
|
+
(l) => `-${l.toLowerCase()}`
|
|
427
|
+
), p = [
|
|
428
428
|
"width",
|
|
429
429
|
"height",
|
|
430
430
|
"top",
|
|
@@ -450,23 +450,23 @@ function Le(e, t, r) {
|
|
|
450
450
|
"min-height",
|
|
451
451
|
"max-height"
|
|
452
452
|
];
|
|
453
|
-
let
|
|
454
|
-
typeof
|
|
453
|
+
let g = String(f);
|
|
454
|
+
typeof f == "number" && p.includes(u) && (g = `${f}px`), i.push(`${u}: ${g}`);
|
|
455
455
|
}
|
|
456
456
|
o = i.join("; ") + (i.length > 0 ? ";" : "");
|
|
457
457
|
}
|
|
458
458
|
const s = t.style || "";
|
|
459
459
|
t.style = s + (s && !s.endsWith(";") ? "; " : "") + o;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function me(e, t, r, n) {
|
|
462
462
|
const o = {}, s = { ...n || {} }, i = {};
|
|
463
|
-
for (const [a,
|
|
464
|
-
const { value:
|
|
463
|
+
for (const [a, f] of Object.entries(e)) {
|
|
464
|
+
const { value: u, modifiers: p } = f;
|
|
465
465
|
switch (a) {
|
|
466
466
|
case "model":
|
|
467
|
-
|
|
468
|
-
typeof
|
|
469
|
-
|
|
467
|
+
je(
|
|
468
|
+
typeof u == "string" ? u : String(u),
|
|
469
|
+
p,
|
|
470
470
|
o,
|
|
471
471
|
s,
|
|
472
472
|
i,
|
|
@@ -475,45 +475,45 @@ function he(e, t, r, n) {
|
|
|
475
475
|
);
|
|
476
476
|
break;
|
|
477
477
|
case "bind":
|
|
478
|
-
|
|
478
|
+
Le(u, o, s, t);
|
|
479
479
|
break;
|
|
480
480
|
case "show":
|
|
481
|
-
|
|
481
|
+
Be(u, s, t);
|
|
482
482
|
break;
|
|
483
483
|
case "class":
|
|
484
|
-
|
|
484
|
+
ze(u, s, t);
|
|
485
485
|
break;
|
|
486
486
|
case "style":
|
|
487
|
-
|
|
487
|
+
Re(u, s, t);
|
|
488
488
|
break;
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
return { props: o, attrs: s, listeners: i };
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function ie(e, t) {
|
|
494
494
|
if (Array.isArray(e)) {
|
|
495
495
|
const s = /* @__PURE__ */ new Set();
|
|
496
496
|
return e.map((i) => {
|
|
497
497
|
if (!i || typeof i != "object") return i;
|
|
498
498
|
let a = i.props?.key ?? i.key;
|
|
499
499
|
if (!a) {
|
|
500
|
-
const
|
|
501
|
-
a =
|
|
500
|
+
const g = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
|
|
501
|
+
a = l ? `${t}:${g}:${l}` : `${t}:${g}`;
|
|
502
502
|
}
|
|
503
|
-
let
|
|
504
|
-
for (; s.has(
|
|
505
|
-
|
|
506
|
-
s.add(
|
|
507
|
-
let
|
|
508
|
-
return Array.isArray(
|
|
503
|
+
let f = a, u = 1;
|
|
504
|
+
for (; s.has(f); )
|
|
505
|
+
f = `${a}#${u++}`;
|
|
506
|
+
s.add(f);
|
|
507
|
+
let p = i.children;
|
|
508
|
+
return Array.isArray(p) && (p = ie(p, f)), { ...i, key: f, children: p };
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
511
|
const r = e;
|
|
512
512
|
let n = r.props?.key ?? r.key ?? t, o = r.children;
|
|
513
|
-
return Array.isArray(o) && (o =
|
|
513
|
+
return Array.isArray(o) && (o = ie(o, n)), { ...r, key: n, children: o };
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
const o = r.directives ?? {}, s =
|
|
515
|
+
function Ne(e, t, r, n) {
|
|
516
|
+
const o = r.directives ?? {}, s = me(
|
|
517
517
|
o,
|
|
518
518
|
n,
|
|
519
519
|
e,
|
|
@@ -526,186 +526,186 @@ function Be(e, t, r, n) {
|
|
|
526
526
|
...t.attrs,
|
|
527
527
|
...r.attrs,
|
|
528
528
|
...s.attrs
|
|
529
|
-
},
|
|
530
|
-
for (const
|
|
531
|
-
const
|
|
532
|
-
|
|
529
|
+
}, f = t.props ?? {}, u = i;
|
|
530
|
+
for (const l in { ...f, ...u }) {
|
|
531
|
+
const v = f[l], y = u[l];
|
|
532
|
+
v !== y && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== y && (e.value = y ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!y : l.startsWith("on") && typeof y == "function" ? (typeof v == "function" && e.removeEventListener(l.slice(2).toLowerCase(), v), e.addEventListener(l.slice(2).toLowerCase(), y)) : y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
|
|
533
533
|
}
|
|
534
|
-
for (const [
|
|
534
|
+
for (const [l, v] of Object.entries(
|
|
535
535
|
s.listeners || {}
|
|
536
536
|
))
|
|
537
|
-
e.addEventListener(
|
|
538
|
-
const
|
|
539
|
-
for (const
|
|
540
|
-
const
|
|
541
|
-
|
|
537
|
+
e.addEventListener(l, v);
|
|
538
|
+
const p = t.attrs ?? {}, g = a;
|
|
539
|
+
for (const l in { ...p, ...g }) {
|
|
540
|
+
const v = p[l], y = g[l];
|
|
541
|
+
v !== y && (y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function L(e, t, r) {
|
|
545
545
|
if (typeof e == "string")
|
|
546
546
|
return document.createTextNode(e);
|
|
547
547
|
if (e.tag === "#text") {
|
|
548
|
-
const
|
|
548
|
+
const g = document.createTextNode(
|
|
549
549
|
typeof e.children == "string" ? e.children : ""
|
|
550
550
|
);
|
|
551
|
-
return e.key != null && (
|
|
551
|
+
return e.key != null && (g.key = e.key), g;
|
|
552
552
|
}
|
|
553
553
|
if (e.tag === "#anchor") {
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
for (const
|
|
559
|
-
const
|
|
560
|
-
|
|
554
|
+
const g = e, l = Array.isArray(g.children) ? g.children : [], v = document.createTextNode(""), y = document.createTextNode("");
|
|
555
|
+
g.key != null && (v.key = `${g.key}:start`, y.key = `${g.key}:end`), g._startNode = v, g._endNode = y;
|
|
556
|
+
const m = document.createDocumentFragment();
|
|
557
|
+
m.appendChild(v);
|
|
558
|
+
for (const h of l) {
|
|
559
|
+
const d = L(h, t);
|
|
560
|
+
m.appendChild(d);
|
|
561
561
|
}
|
|
562
|
-
return
|
|
562
|
+
return m.appendChild(y), m;
|
|
563
563
|
}
|
|
564
564
|
const n = document.createElement(e.tag);
|
|
565
565
|
e.key != null && (n.key = e.key);
|
|
566
|
-
const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a =
|
|
566
|
+
const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = me(i, t, n, s), f = {
|
|
567
567
|
...o,
|
|
568
568
|
...a.props
|
|
569
|
-
},
|
|
569
|
+
}, u = {
|
|
570
570
|
...s,
|
|
571
571
|
...a.attrs
|
|
572
572
|
};
|
|
573
|
-
for (const
|
|
574
|
-
const
|
|
575
|
-
typeof
|
|
576
|
-
}
|
|
577
|
-
for (const
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
n.value =
|
|
581
|
-
else if (
|
|
582
|
-
n.checked = !!
|
|
583
|
-
else if (
|
|
584
|
-
n.addEventListener(
|
|
573
|
+
for (const g in u) {
|
|
574
|
+
const l = u[g];
|
|
575
|
+
typeof l == "boolean" ? l && n.setAttribute(g, "") : l != null && n.setAttribute(g, String(l));
|
|
576
|
+
}
|
|
577
|
+
for (const g in f) {
|
|
578
|
+
const l = f[g];
|
|
579
|
+
if (g === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
|
|
580
|
+
n.value = l ?? "";
|
|
581
|
+
else if (g === "checked" && n instanceof HTMLInputElement)
|
|
582
|
+
n.checked = !!l;
|
|
583
|
+
else if (g.startsWith("on") && typeof l == "function")
|
|
584
|
+
n.addEventListener(g.slice(2).toLowerCase(), l);
|
|
585
585
|
else {
|
|
586
|
-
if (
|
|
586
|
+
if (g.startsWith("on") && l === void 0)
|
|
587
587
|
continue;
|
|
588
|
-
|
|
588
|
+
l == null || l === !1 ? n.removeAttribute(g) : n.setAttribute(g, String(l));
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
for (const [
|
|
591
|
+
for (const [g, l] of Object.entries(
|
|
592
592
|
a.listeners || {}
|
|
593
593
|
))
|
|
594
|
-
n.addEventListener(
|
|
595
|
-
const
|
|
596
|
-
if (typeof e != "string" &&
|
|
597
|
-
for (const
|
|
598
|
-
n.appendChild(
|
|
594
|
+
n.addEventListener(g, l);
|
|
595
|
+
const p = e.props?.ref ?? (e.props?.props && e.props.props.ref);
|
|
596
|
+
if (typeof e != "string" && p && r && (r[p] = n), Array.isArray(e.children))
|
|
597
|
+
for (const g of e.children)
|
|
598
|
+
n.appendChild(L(g, t, r));
|
|
599
599
|
else typeof e.children == "string" && (n.textContent = e.children);
|
|
600
600
|
return n;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Me(e, t, r, n, o) {
|
|
603
603
|
if (typeof r == "string") {
|
|
604
604
|
e.textContent !== r && (e.textContent = r);
|
|
605
605
|
return;
|
|
606
606
|
}
|
|
607
607
|
if (!Array.isArray(r)) return;
|
|
608
608
|
const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
|
|
609
|
-
for (const
|
|
610
|
-
|
|
611
|
-
const
|
|
612
|
-
for (const
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
}
|
|
616
|
-
const
|
|
617
|
-
let
|
|
618
|
-
function
|
|
619
|
-
let
|
|
620
|
-
for (;
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
let
|
|
626
|
-
for (;
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
const
|
|
631
|
-
for (const
|
|
632
|
-
|
|
633
|
-
for (const
|
|
634
|
-
const S =
|
|
635
|
-
S != null &&
|
|
609
|
+
for (const v of i)
|
|
610
|
+
v && v.key != null && a.set(v.key, v);
|
|
611
|
+
const f = /* @__PURE__ */ new Map();
|
|
612
|
+
for (const v of s) {
|
|
613
|
+
const y = v.key;
|
|
614
|
+
y != null && f.set(y, v);
|
|
615
|
+
}
|
|
616
|
+
const u = /* @__PURE__ */ new Set();
|
|
617
|
+
let p = e.firstChild;
|
|
618
|
+
function g(v, y) {
|
|
619
|
+
let m = v;
|
|
620
|
+
for (; m && (u.add(m), m !== y); )
|
|
621
|
+
m = m.nextSibling;
|
|
622
|
+
}
|
|
623
|
+
function l(v, y, m, h) {
|
|
624
|
+
const d = [];
|
|
625
|
+
let b = v.nextSibling;
|
|
626
|
+
for (; b && b !== y; )
|
|
627
|
+
d.push(b), b = b.nextSibling;
|
|
628
|
+
const c = Array.isArray(m) ? m : [];
|
|
629
|
+
if (h.some(($) => $ && $.key != null) || c.some(($) => $ && $.key != null)) {
|
|
630
|
+
const $ = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
|
|
631
|
+
for (const k of c)
|
|
632
|
+
k && k.key != null && $.set(k.key, k);
|
|
633
|
+
for (const k of d) {
|
|
634
|
+
const S = k.key;
|
|
635
|
+
S != null && w.set(S, k);
|
|
636
636
|
}
|
|
637
637
|
const _ = /* @__PURE__ */ new Set();
|
|
638
|
-
let C =
|
|
639
|
-
for (const
|
|
638
|
+
let C = v.nextSibling;
|
|
639
|
+
for (const k of h) {
|
|
640
640
|
let S;
|
|
641
|
-
if (
|
|
642
|
-
const A =
|
|
643
|
-
S =
|
|
644
|
-
|
|
641
|
+
if (k.key != null && w.has(k.key)) {
|
|
642
|
+
const A = $.get(k.key);
|
|
643
|
+
S = J(
|
|
644
|
+
w.get(k.key),
|
|
645
645
|
A,
|
|
646
|
-
|
|
646
|
+
k,
|
|
647
647
|
n
|
|
648
648
|
), _.add(S), S !== C && e.contains(S) && e.insertBefore(S, C);
|
|
649
649
|
} else
|
|
650
|
-
S =
|
|
650
|
+
S = L(k, n), e.insertBefore(S, C), _.add(S);
|
|
651
651
|
C = S.nextSibling;
|
|
652
652
|
}
|
|
653
|
-
for (const
|
|
654
|
-
!_.has(
|
|
653
|
+
for (const k of d)
|
|
654
|
+
!_.has(k) && e.contains(k) && e.removeChild(k);
|
|
655
655
|
} else {
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
|
|
656
|
+
const $ = Math.min(
|
|
657
|
+
c.length,
|
|
658
|
+
h.length
|
|
659
659
|
);
|
|
660
|
-
for (let
|
|
661
|
-
const _ =
|
|
662
|
-
|
|
660
|
+
for (let w = 0; w < $; w++) {
|
|
661
|
+
const _ = c[w], C = h[w], k = J(d[w], _, C, n);
|
|
662
|
+
k !== d[w] && (e.insertBefore(k, d[w]), e.removeChild(d[w]));
|
|
663
663
|
}
|
|
664
|
-
for (let
|
|
665
|
-
e.insertBefore(
|
|
666
|
-
for (let
|
|
667
|
-
e.removeChild(
|
|
664
|
+
for (let w = $; w < h.length; w++)
|
|
665
|
+
e.insertBefore(L(h[w], n), y);
|
|
666
|
+
for (let w = $; w < d.length; w++)
|
|
667
|
+
e.removeChild(d[w]);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
for (const
|
|
671
|
-
let
|
|
672
|
-
if (
|
|
673
|
-
const
|
|
674
|
-
let
|
|
675
|
-
const x = Array.isArray(
|
|
676
|
-
if (
|
|
677
|
-
e.insertBefore(
|
|
678
|
-
for (const
|
|
679
|
-
e.insertBefore(
|
|
680
|
-
e.insertBefore(
|
|
670
|
+
for (const v of r) {
|
|
671
|
+
let y;
|
|
672
|
+
if (v.tag === "#anchor") {
|
|
673
|
+
const m = v.key, h = `${m}:start`, d = `${m}:end`;
|
|
674
|
+
let b = f.get(h), c = f.get(d);
|
|
675
|
+
const x = Array.isArray(v.children) ? v.children : [];
|
|
676
|
+
if (b || (b = document.createTextNode(""), b.key = h), c || (c = document.createTextNode(""), c.key = d), v._startNode = b, v._endNode = c, !e.contains(b) || !e.contains(c)) {
|
|
677
|
+
e.insertBefore(b, p);
|
|
678
|
+
for (const $ of x)
|
|
679
|
+
e.insertBefore(L($, n), p);
|
|
680
|
+
e.insertBefore(c, p);
|
|
681
681
|
} else
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
a.get(
|
|
682
|
+
l(
|
|
683
|
+
b,
|
|
684
|
+
c,
|
|
685
|
+
a.get(m)?.children,
|
|
686
686
|
x
|
|
687
687
|
);
|
|
688
|
-
|
|
688
|
+
g(b, c), p = c.nextSibling;
|
|
689
689
|
continue;
|
|
690
690
|
}
|
|
691
|
-
if (
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
|
|
691
|
+
if (v.key != null && f.has(v.key)) {
|
|
692
|
+
const m = a.get(v.key);
|
|
693
|
+
y = J(
|
|
694
|
+
f.get(v.key),
|
|
695
|
+
m,
|
|
695
696
|
v,
|
|
696
|
-
b,
|
|
697
697
|
n,
|
|
698
698
|
o
|
|
699
|
-
),
|
|
699
|
+
), u.add(y), y !== p && e.contains(y) && (p && !e.contains(p) && (p = null), e.insertBefore(y, p));
|
|
700
700
|
} else
|
|
701
|
-
|
|
702
|
-
|
|
701
|
+
y = L(v, n, o), p && !e.contains(p) && (p = null), e.insertBefore(y, p), u.add(y);
|
|
702
|
+
p = y.nextSibling;
|
|
703
703
|
}
|
|
704
|
-
for (const
|
|
705
|
-
!
|
|
704
|
+
for (const v of s)
|
|
705
|
+
!u.has(v) && e.contains(v) && (N(v, o), e.removeChild(v));
|
|
706
706
|
}
|
|
707
|
-
function
|
|
708
|
-
if (t && typeof t != "string" && t.props?.ref && o &&
|
|
707
|
+
function J(e, t, r, n, o) {
|
|
708
|
+
if (t && typeof t != "string" && t.props?.ref && o && N(e, o), t === r) return e;
|
|
709
709
|
if (typeof r == "string") {
|
|
710
710
|
if (e.nodeType === Node.TEXT_NODE)
|
|
711
711
|
return e.textContent !== r && (e.textContent = r), e;
|
|
@@ -715,78 +715,78 @@ function K(e, t, r, n, o) {
|
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
if (r && typeof r != "string" && r.tag === "#anchor") {
|
|
718
|
-
const i = r, a = Array.isArray(i.children) ? i.children : [],
|
|
719
|
-
i.key != null && (
|
|
720
|
-
const
|
|
721
|
-
|
|
722
|
-
for (const
|
|
723
|
-
const
|
|
724
|
-
|
|
718
|
+
const i = r, a = Array.isArray(i.children) ? i.children : [], f = i._startNode ?? document.createTextNode(""), u = i._endNode ?? document.createTextNode("");
|
|
719
|
+
i.key != null && (f.key = `${i.key}:start`, u.key = `${i.key}:end`), i._startNode = f, i._endNode = u;
|
|
720
|
+
const p = document.createDocumentFragment();
|
|
721
|
+
p.appendChild(f);
|
|
722
|
+
for (const g of a) {
|
|
723
|
+
const l = L(g, n);
|
|
724
|
+
p.appendChild(l);
|
|
725
725
|
}
|
|
726
|
-
return
|
|
726
|
+
return p.appendChild(u), e.parentNode?.replaceChild(p, e), f;
|
|
727
727
|
}
|
|
728
728
|
if (!r) {
|
|
729
|
-
|
|
729
|
+
N(e, o);
|
|
730
730
|
const i = document.createComment("removed");
|
|
731
731
|
return e.parentNode?.replaceChild(i, e), i;
|
|
732
732
|
}
|
|
733
733
|
if (!t || typeof t == "string") {
|
|
734
|
-
|
|
735
|
-
const i =
|
|
734
|
+
N(e, o);
|
|
735
|
+
const i = L(r, n, o);
|
|
736
736
|
return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
|
|
737
737
|
}
|
|
738
738
|
if (r.tag === "#anchor") {
|
|
739
|
-
const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""),
|
|
740
|
-
r.key != null && (a.key = `${r.key}:start`,
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
for (const
|
|
744
|
-
|
|
745
|
-
return
|
|
739
|
+
const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
|
|
740
|
+
r.key != null && (a.key = `${r.key}:start`, f.key = `${r.key}:end`), r._startNode = a, r._endNode = f;
|
|
741
|
+
const u = document.createDocumentFragment();
|
|
742
|
+
u.appendChild(a);
|
|
743
|
+
for (const p of i)
|
|
744
|
+
u.appendChild(L(p, n));
|
|
745
|
+
return u.appendChild(f), e.parentNode?.replaceChild(u, e), a;
|
|
746
746
|
}
|
|
747
747
|
if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
|
|
748
748
|
const i = e;
|
|
749
|
-
return
|
|
749
|
+
return Ne(i, t.props || {}, r.props || {}, n), Me(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
|
|
750
750
|
}
|
|
751
|
-
|
|
752
|
-
const s =
|
|
751
|
+
N(e, o);
|
|
752
|
+
const s = L(r, n, o);
|
|
753
753
|
return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
|
|
754
754
|
}
|
|
755
|
-
function
|
|
755
|
+
function Oe(e, t, r, n) {
|
|
756
756
|
let o;
|
|
757
757
|
Array.isArray(t) ? t.length === 1 ? (o = t[0], o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })) : o = { tag: "div", key: "__root__", children: t } : (o = t, o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })), o && typeof o == "object" && o.tag === "#anchor" && (o = {
|
|
758
758
|
tag: "div",
|
|
759
759
|
key: "__anchor_root__",
|
|
760
760
|
props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
|
|
761
761
|
children: [o]
|
|
762
|
-
}), o =
|
|
762
|
+
}), o = ie(o, String(o.key ?? "root"));
|
|
763
763
|
const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
|
|
764
764
|
let a;
|
|
765
|
-
s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a =
|
|
766
|
-
const
|
|
767
|
-
for (let
|
|
768
|
-
const
|
|
769
|
-
|
|
765
|
+
s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = J(i, s, o, r, n) : (a = L(o, r, n), e.replaceChild(a, i)) : (a = L(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
|
|
766
|
+
const f = [];
|
|
767
|
+
for (let u = 0; u < e.childNodes.length; u++) {
|
|
768
|
+
const p = e.childNodes[u];
|
|
769
|
+
p !== a && p.nodeName !== "STYLE" && (N(p, n), f.push(p));
|
|
770
770
|
}
|
|
771
|
-
|
|
771
|
+
f.forEach((u) => e.removeChild(u)), e._prevVNode = o, e._prevDom = a;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function be(e, ...t) {
|
|
774
774
|
let r = "";
|
|
775
775
|
for (let n = 0; n < e.length; n++)
|
|
776
776
|
r += e[n], n < t.length && (r += t[n]);
|
|
777
777
|
return r;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function ve(e) {
|
|
780
780
|
return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
|
|
781
781
|
}
|
|
782
|
-
let
|
|
783
|
-
function
|
|
784
|
-
return
|
|
782
|
+
let V = null;
|
|
783
|
+
function fe() {
|
|
784
|
+
return V || (V = new CSSStyleSheet(), V.replaceSync(ve(We))), V;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function Pe(e) {
|
|
787
787
|
return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const We = be`
|
|
790
790
|
:host, *, ::before, ::after {
|
|
791
791
|
all: isolate;
|
|
792
792
|
box-sizing: border-box;
|
|
@@ -844,7 +844,7 @@ const Me = ge`
|
|
|
844
844
|
sup { top: -.5em }
|
|
845
845
|
[disabled], [aria-disabled=true] { cursor: not-allowed }
|
|
846
846
|
[hidden] { display: none }
|
|
847
|
-
`,
|
|
847
|
+
`, De = {
|
|
848
848
|
gray: {
|
|
849
849
|
50: "var(--color-gray-50, #f9fafb)",
|
|
850
850
|
100: "var(--color-gray-100, #f3f4f6)",
|
|
@@ -979,7 +979,7 @@ const Me = ge`
|
|
|
979
979
|
},
|
|
980
980
|
white: { DEFAULT: "var(--color-white, #ffffff)" },
|
|
981
981
|
black: { DEFAULT: "var(--color-black, #000000)" }
|
|
982
|
-
},
|
|
982
|
+
}, Y = {
|
|
983
983
|
/* Display */
|
|
984
984
|
block: "display:block;",
|
|
985
985
|
inline: "display:inline;",
|
|
@@ -1153,7 +1153,7 @@ const Me = ge`
|
|
|
1153
1153
|
"transition-colors": "transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;",
|
|
1154
1154
|
"transition-opacity": "transition-property:opacity;",
|
|
1155
1155
|
"transition-transform": "transition-property:transform;"
|
|
1156
|
-
},
|
|
1156
|
+
}, He = "0.25rem", ue = {
|
|
1157
1157
|
m: ["margin"],
|
|
1158
1158
|
mx: ["margin-inline"],
|
|
1159
1159
|
my: ["margin-block"],
|
|
@@ -1184,7 +1184,7 @@ const Me = ge`
|
|
|
1184
1184
|
gap: ["gap"],
|
|
1185
1185
|
"gap-x": ["column-gap"],
|
|
1186
1186
|
"gap-y": ["row-gap"]
|
|
1187
|
-
},
|
|
1187
|
+
}, qe = {
|
|
1188
1188
|
// State variants
|
|
1189
1189
|
before: (e, t) => `${e}::before{${t}}`,
|
|
1190
1190
|
after: (e, t) => `${e}::after{${t}}`,
|
|
@@ -1210,7 +1210,7 @@ const Me = ge`
|
|
|
1210
1210
|
"peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
|
|
1211
1211
|
"peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
|
|
1212
1212
|
"peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
|
|
1213
|
-
},
|
|
1213
|
+
}, de = {
|
|
1214
1214
|
// Responsive
|
|
1215
1215
|
sm: "(min-width:640px)",
|
|
1216
1216
|
md: "(min-width:768px)",
|
|
@@ -1219,23 +1219,23 @@ const Me = ge`
|
|
|
1219
1219
|
"2xl": "(min-width:1536px)",
|
|
1220
1220
|
// Dark mode (now plain string)
|
|
1221
1221
|
dark: "(prefers-color-scheme: dark)"
|
|
1222
|
-
},
|
|
1223
|
-
function
|
|
1222
|
+
}, G = ["sm", "md", "lg", "xl", "2xl"];
|
|
1223
|
+
function ee(e) {
|
|
1224
1224
|
const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
|
|
1225
1225
|
if (n.length < 2) return null;
|
|
1226
1226
|
const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
|
|
1227
|
-
if (Number.isNaN(i) || !
|
|
1227
|
+
if (Number.isNaN(i) || !ue[o]) return null;
|
|
1228
1228
|
const a = t ? "-" : "";
|
|
1229
|
-
return
|
|
1229
|
+
return ue[o].map((f) => `${f}:calc(${a}${He} * ${i});`).join("");
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function pe(e) {
|
|
1232
1232
|
const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
|
|
1233
1233
|
return `${n} ${o} ${s}`;
|
|
1234
1234
|
}
|
|
1235
|
-
function
|
|
1235
|
+
function Ie(e) {
|
|
1236
1236
|
const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
|
|
1237
1237
|
if (!t) return null;
|
|
1238
|
-
const [, r, n, o = "DEFAULT"] = t, s =
|
|
1238
|
+
const [, r, n, o = "DEFAULT"] = t, s = De[n]?.[o];
|
|
1239
1239
|
return s ? `${{
|
|
1240
1240
|
bg: "background-color",
|
|
1241
1241
|
decoration: "text-decoration-color",
|
|
@@ -1250,35 +1250,35 @@ function De(e) {
|
|
|
1250
1250
|
stroke: "stroke-color"
|
|
1251
1251
|
}[r]}:${s};` : null;
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1253
|
+
function Fe(e) {
|
|
1254
1254
|
const [t, r] = e.split("/");
|
|
1255
1255
|
if (!r) return { base: t };
|
|
1256
1256
|
const n = parseInt(r, 10);
|
|
1257
1257
|
return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
|
|
1258
1258
|
}
|
|
1259
|
-
function
|
|
1260
|
-
const { base: t, opacity: r } =
|
|
1259
|
+
function te(e) {
|
|
1260
|
+
const { base: t, opacity: r } = Fe(e), n = Ie(t);
|
|
1261
1261
|
if (n) {
|
|
1262
1262
|
if (r !== void 0) {
|
|
1263
1263
|
const s = /#([0-9a-f]{6})/i.exec(n);
|
|
1264
1264
|
if (s) {
|
|
1265
|
-
const i =
|
|
1265
|
+
const i = pe(s[0]);
|
|
1266
1266
|
return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
1269
|
return n;
|
|
1270
1270
|
}
|
|
1271
|
-
const o =
|
|
1271
|
+
const o = Q(t);
|
|
1272
1272
|
if (o && r !== void 0) {
|
|
1273
1273
|
const s = /#([0-9a-f]{6})/i.exec(o);
|
|
1274
1274
|
if (s) {
|
|
1275
|
-
const i =
|
|
1275
|
+
const i = pe(s[0]);
|
|
1276
1276
|
return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
1279
|
return o;
|
|
1280
1280
|
}
|
|
1281
|
-
function
|
|
1281
|
+
function Q(e) {
|
|
1282
1282
|
const t = e.indexOf("-["), r = e.endsWith("]");
|
|
1283
1283
|
if (t > 0 && r) {
|
|
1284
1284
|
const n = e.slice(0, t);
|
|
@@ -1328,13 +1328,13 @@ function V(e) {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
return null;
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function Ke(e) {
|
|
1332
1332
|
return e.startsWith("[") && e.endsWith("]") ? e : e.indexOf("-[") > 0 && e.endsWith("]") ? e.replace(/_/g, "-") : null;
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1334
|
+
function Ve(e) {
|
|
1335
1335
|
return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Ue(e) {
|
|
1338
1338
|
const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
|
|
1339
1339
|
let n;
|
|
1340
1340
|
for (; n = t.exec(e); ) {
|
|
@@ -1343,93 +1343,100 @@ function Fe(e) {
|
|
|
1343
1343
|
}
|
|
1344
1344
|
return r.filter(Boolean);
|
|
1345
1345
|
}
|
|
1346
|
-
const
|
|
1347
|
-
function
|
|
1348
|
-
const t = Date.now(), r =
|
|
1349
|
-
if (r && t - r.timestamp <
|
|
1350
|
-
const n =
|
|
1351
|
-
function
|
|
1352
|
-
const
|
|
1353
|
-
if (
|
|
1354
|
-
const
|
|
1355
|
-
return
|
|
1356
|
-
}
|
|
1357
|
-
function y
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
1360
|
-
}
|
|
1361
|
-
function
|
|
1362
|
-
const
|
|
1363
|
-
(S) =>
|
|
1346
|
+
const he = /* @__PURE__ */ new Map(), Je = 16;
|
|
1347
|
+
function Qe(e) {
|
|
1348
|
+
const t = Date.now(), r = he.get(e);
|
|
1349
|
+
if (r && t - r.timestamp < Je) return r.css;
|
|
1350
|
+
const n = Ue(e), o = new Set(n), s = [], i = [], a = [], f = [], u = {};
|
|
1351
|
+
function p(y, m = !1) {
|
|
1352
|
+
const h = (m ? "dark|" : "") + y;
|
|
1353
|
+
if (h in u) return u[h];
|
|
1354
|
+
const d = l(y, m);
|
|
1355
|
+
return u[h] = d, d;
|
|
1356
|
+
}
|
|
1357
|
+
function g(y) {
|
|
1358
|
+
const m = y.some((d) => G.includes(d)), h = y.includes("dark");
|
|
1359
|
+
return y.length === 0 ? 1 : !m && !h ? 2 : m && !h ? 3 : 4;
|
|
1360
|
+
}
|
|
1361
|
+
function l(y, m = !1) {
|
|
1362
|
+
const h = y.split(":"), d = h.find(
|
|
1363
|
+
(S) => Y[S] || ee(S) || te(S) || Q(S)
|
|
1364
1364
|
);
|
|
1365
|
-
if (!
|
|
1366
|
-
const
|
|
1367
|
-
if (!
|
|
1368
|
-
let
|
|
1369
|
-
const
|
|
1370
|
-
let
|
|
1371
|
-
|
|
1372
|
-
const _ =
|
|
1373
|
-
for (const S of
|
|
1374
|
-
const A =
|
|
1365
|
+
if (!d) return null;
|
|
1366
|
+
const b = Y[d] ?? ee(d) ?? te(d) ?? Q(d);
|
|
1367
|
+
if (!b) return null;
|
|
1368
|
+
let c = `.${Ve(y)}`, x = b;
|
|
1369
|
+
const $ = h.indexOf(d);
|
|
1370
|
+
let w = $ >= 0 ? h.slice(0, $) : [];
|
|
1371
|
+
m && (w = w.filter((S) => S !== "dark"));
|
|
1372
|
+
const _ = w.filter((S) => G.includes(S)), C = _.length ? _[_.length - 1] : null;
|
|
1373
|
+
for (const S of w) {
|
|
1374
|
+
const A = Ke(S);
|
|
1375
1375
|
if (A) {
|
|
1376
|
-
|
|
1376
|
+
c = `${A}${c}`;
|
|
1377
1377
|
continue;
|
|
1378
1378
|
}
|
|
1379
|
-
if (
|
|
1380
|
-
const E =
|
|
1381
|
-
typeof E == "function" && (
|
|
1379
|
+
if (G.includes(S)) continue;
|
|
1380
|
+
const E = qe[S];
|
|
1381
|
+
typeof E == "function" && (c = E(c, x).replace(/\{.*$/, ""));
|
|
1382
1382
|
}
|
|
1383
|
-
let
|
|
1384
|
-
return
|
|
1383
|
+
let k = `${c}{${x}}`;
|
|
1384
|
+
return m && C ? k = `@media (prefers-color-scheme: dark) and ${de[C]}{${k}}` : m ? k = `@media (prefers-color-scheme: dark){${k}}` : C && (k = `@media ${de[C]}{${k}}`), k;
|
|
1385
1385
|
}
|
|
1386
|
-
for (const
|
|
1387
|
-
const
|
|
1388
|
-
(x) =>
|
|
1386
|
+
for (const y of o) {
|
|
1387
|
+
const m = y.split(":"), h = m.find(
|
|
1388
|
+
(x) => Y[x] || ee(x) || te(x) || Q(x)
|
|
1389
1389
|
);
|
|
1390
|
-
if (!
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1393
|
-
const x =
|
|
1394
|
-
x &&
|
|
1390
|
+
if (!h) continue;
|
|
1391
|
+
const d = m.indexOf(h), b = d >= 0 ? m.slice(0, d) : [], c = g(b);
|
|
1392
|
+
if (c === 4) {
|
|
1393
|
+
const x = p(y, !0);
|
|
1394
|
+
x && f.push(x);
|
|
1395
1395
|
} else {
|
|
1396
|
-
const x =
|
|
1397
|
-
x && (
|
|
1396
|
+
const x = p(y);
|
|
1397
|
+
x && (c === 1 ? s.push(x) : c === 2 ? i.push(x) : c === 3 && a.push(x));
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
const
|
|
1401
|
-
return
|
|
1400
|
+
const v = [...s, ...i, ...a, ...f].join("");
|
|
1401
|
+
return he.set(e, { css: v, timestamp: t }), v;
|
|
1402
1402
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
if (
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1403
|
+
const I = [];
|
|
1404
|
+
function Ze(e, t, r, n, o, s, i, a) {
|
|
1405
|
+
if (e) {
|
|
1406
|
+
I.push(r);
|
|
1407
|
+
try {
|
|
1408
|
+
if (t.loadingTemplate && r.isLoading) {
|
|
1409
|
+
O(e, t.loadingTemplate(r), r, n, o);
|
|
1410
|
+
return;
|
|
1411
|
+
}
|
|
1412
|
+
if (t.errorTemplate && r.hasError) {
|
|
1413
|
+
r.error instanceof Error && O(e, t.errorTemplate(r.error, r), r, n, o);
|
|
1414
|
+
return;
|
|
1415
|
+
}
|
|
1416
|
+
const f = t.render(r);
|
|
1417
|
+
if (f instanceof Promise) {
|
|
1418
|
+
s(!0), f.then((u) => {
|
|
1419
|
+
s(!1), i(null), O(e, u, r, n, o), a(e.innerHTML);
|
|
1420
|
+
}).catch((u) => {
|
|
1421
|
+
s(!1), i(u), t.errorTemplate && O(e, t.errorTemplate(u, r), r, n, o);
|
|
1422
|
+
}), t.loadingTemplate && O(e, t.loadingTemplate(r), r, n, o);
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
O(e, f, r, n, o), a(e.innerHTML);
|
|
1426
|
+
} finally {
|
|
1427
|
+
I.pop();
|
|
1428
|
+
}
|
|
1421
1429
|
}
|
|
1422
|
-
N(e, c, r, n, o), a(e.innerHTML);
|
|
1423
1430
|
}
|
|
1424
|
-
function
|
|
1425
|
-
e && (
|
|
1431
|
+
function O(e, t, r, n, o) {
|
|
1432
|
+
e && (Oe(
|
|
1426
1433
|
e,
|
|
1427
1434
|
Array.isArray(t) ? t : [t],
|
|
1428
1435
|
r,
|
|
1429
1436
|
n
|
|
1430
1437
|
), o(e.innerHTML));
|
|
1431
1438
|
}
|
|
1432
|
-
function
|
|
1439
|
+
function Xe(e, t, r, n, o, s, i) {
|
|
1433
1440
|
if (s !== null && clearTimeout(s), Date.now() - t < 16) {
|
|
1434
1441
|
if (o(r + 1), r > 10) {
|
|
1435
1442
|
console.warn("Potential infinite render loop detected. Skipping render."), i(null);
|
|
@@ -1437,37 +1444,37 @@ function Je(e, t, r, n, o, s, i) {
|
|
|
1437
1444
|
}
|
|
1438
1445
|
} else
|
|
1439
1446
|
o(0);
|
|
1440
|
-
const
|
|
1447
|
+
const f = setTimeout(() => {
|
|
1441
1448
|
n(Date.now()), e(), i(null);
|
|
1442
1449
|
}, 0);
|
|
1443
|
-
i(
|
|
1450
|
+
i(f);
|
|
1444
1451
|
}
|
|
1445
|
-
function
|
|
1452
|
+
function Ye(e, t, r, n, o, s) {
|
|
1446
1453
|
if (!e) return;
|
|
1447
|
-
const i =
|
|
1454
|
+
const i = Qe(n);
|
|
1448
1455
|
if (!t.style && (!i || i.trim() === "")) {
|
|
1449
|
-
s(null), e.adoptedStyleSheets = [
|
|
1456
|
+
s(null), e.adoptedStyleSheets = [fe()];
|
|
1450
1457
|
return;
|
|
1451
1458
|
}
|
|
1452
1459
|
let a = "";
|
|
1453
1460
|
t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
|
|
1454
|
-
let
|
|
1461
|
+
let f = Pe(`${a}
|
|
1455
1462
|
${i}
|
|
1456
1463
|
`);
|
|
1457
|
-
|
|
1458
|
-
let
|
|
1459
|
-
|
|
1464
|
+
f = ve(f);
|
|
1465
|
+
let u = o;
|
|
1466
|
+
u || (u = new CSSStyleSheet()), (u.cssRules.length === 0 || u.toString() !== f) && u.replaceSync(f), e.adoptedStyleSheets = [fe(), u], s(u);
|
|
1460
1467
|
}
|
|
1461
|
-
const
|
|
1462
|
-
function
|
|
1463
|
-
let n =
|
|
1468
|
+
const Ge = /* @__PURE__ */ new Map();
|
|
1469
|
+
function ge(e, t, r) {
|
|
1470
|
+
let n = se(e);
|
|
1464
1471
|
n.includes("-") || (n = `cer-${n}`);
|
|
1465
1472
|
let o;
|
|
1466
1473
|
typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
|
|
1467
1474
|
console.error(`[${n}] Error:`, s, i);
|
|
1468
|
-
}),
|
|
1475
|
+
}), Ge.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, et(o));
|
|
1469
1476
|
}
|
|
1470
|
-
function
|
|
1477
|
+
function et(e) {
|
|
1471
1478
|
if (!e.render)
|
|
1472
1479
|
throw new Error(
|
|
1473
1480
|
"Component must have a render function"
|
|
@@ -1533,8 +1540,8 @@ function Xe(e) {
|
|
|
1533
1540
|
...o || {}
|
|
1534
1541
|
})
|
|
1535
1542
|
);
|
|
1536
|
-
const s = `on${r.charAt(0).toUpperCase()}${r.slice(1)}`, i = typeof this[s] == "function" ? this[s] : void 0, a = typeof this.context[s] == "function" ? this.context[s] : void 0,
|
|
1537
|
-
i && i(n, this.context), a && a !== i && a(n, this.context),
|
|
1543
|
+
const s = `on${r.charAt(0).toUpperCase()}${r.slice(1)}`, i = typeof this[s] == "function" ? this[s] : void 0, a = typeof this.context[s] == "function" ? this.context[s] : void 0, f = typeof e[s] == "function" ? e[s] : void 0;
|
|
1544
|
+
i && i(n, this.context), a && a !== i && a(n, this.context), f && f !== i && f !== a && f(n, this.context);
|
|
1538
1545
|
},
|
|
1539
1546
|
writable: !1,
|
|
1540
1547
|
enumerable: !1,
|
|
@@ -1554,7 +1561,7 @@ function Xe(e) {
|
|
|
1554
1561
|
}
|
|
1555
1562
|
connectedCallback() {
|
|
1556
1563
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1557
|
-
|
|
1564
|
+
Ae(
|
|
1558
1565
|
e,
|
|
1559
1566
|
this.context,
|
|
1560
1567
|
this._mounted,
|
|
@@ -1566,7 +1573,7 @@ function Xe(e) {
|
|
|
1566
1573
|
}
|
|
1567
1574
|
disconnectedCallback() {
|
|
1568
1575
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1569
|
-
|
|
1576
|
+
Ee(
|
|
1570
1577
|
e,
|
|
1571
1578
|
this.context,
|
|
1572
1579
|
this._listeners,
|
|
@@ -1590,7 +1597,7 @@ function Xe(e) {
|
|
|
1590
1597
|
}
|
|
1591
1598
|
attributeChangedCallback(t, r, n) {
|
|
1592
1599
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1593
|
-
this._applyProps(e),
|
|
1600
|
+
this._applyProps(e), Te(
|
|
1594
1601
|
e,
|
|
1595
1602
|
t,
|
|
1596
1603
|
r,
|
|
@@ -1600,7 +1607,7 @@ function Xe(e) {
|
|
|
1600
1607
|
});
|
|
1601
1608
|
}
|
|
1602
1609
|
static get observedAttributes() {
|
|
1603
|
-
return e.props ? Object.keys(e.props).map(
|
|
1610
|
+
return e.props ? Object.keys(e.props).map(se) : [];
|
|
1604
1611
|
}
|
|
1605
1612
|
_applyComputed(t) {
|
|
1606
1613
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
@@ -1608,7 +1615,7 @@ function Xe(e) {
|
|
|
1608
1615
|
Object.defineProperty(this.context, r, {
|
|
1609
1616
|
get: () => {
|
|
1610
1617
|
const o = n(this.context);
|
|
1611
|
-
return
|
|
1618
|
+
return ne(o);
|
|
1612
1619
|
},
|
|
1613
1620
|
enumerable: !0
|
|
1614
1621
|
});
|
|
@@ -1618,7 +1625,7 @@ function Xe(e) {
|
|
|
1618
1625
|
// --- Render ---
|
|
1619
1626
|
_render(t) {
|
|
1620
1627
|
this._runLogicWithinErrorBoundary(t, () => {
|
|
1621
|
-
|
|
1628
|
+
Ze(
|
|
1622
1629
|
this.shadowRoot,
|
|
1623
1630
|
t,
|
|
1624
1631
|
this.context,
|
|
@@ -1641,7 +1648,7 @@ function Xe(e) {
|
|
|
1641
1648
|
}
|
|
1642
1649
|
_requestRender() {
|
|
1643
1650
|
this._runLogicWithinErrorBoundary(this._cfg, () => {
|
|
1644
|
-
|
|
1651
|
+
Xe(
|
|
1645
1652
|
() => this._render(this._cfg),
|
|
1646
1653
|
this._lastRenderTime,
|
|
1647
1654
|
this._renderCount,
|
|
@@ -1661,7 +1668,7 @@ function Xe(e) {
|
|
|
1661
1668
|
// --- Style ---
|
|
1662
1669
|
_applyStyle(t, r) {
|
|
1663
1670
|
this._runLogicWithinErrorBoundary(t, () => {
|
|
1664
|
-
|
|
1671
|
+
Ye(
|
|
1665
1672
|
this.shadowRoot,
|
|
1666
1673
|
t,
|
|
1667
1674
|
this.context,
|
|
@@ -1690,9 +1697,9 @@ function Xe(e) {
|
|
|
1690
1697
|
try {
|
|
1691
1698
|
let r = function(o, s = "") {
|
|
1692
1699
|
return Array.isArray(o) ? new Proxy(o, {
|
|
1693
|
-
get(i, a,
|
|
1694
|
-
const
|
|
1695
|
-
return typeof
|
|
1700
|
+
get(i, a, f) {
|
|
1701
|
+
const u = Reflect.get(i, a, f);
|
|
1702
|
+
return typeof u == "function" && typeof a == "string" && [
|
|
1696
1703
|
"push",
|
|
1697
1704
|
"pop",
|
|
1698
1705
|
"shift",
|
|
@@ -1700,26 +1707,26 @@ function Xe(e) {
|
|
|
1700
1707
|
"splice",
|
|
1701
1708
|
"sort",
|
|
1702
1709
|
"reverse"
|
|
1703
|
-
].includes(a) ? function(...
|
|
1704
|
-
const
|
|
1710
|
+
].includes(a) ? function(...g) {
|
|
1711
|
+
const l = u.apply(i, g);
|
|
1705
1712
|
if (!n._initializing) {
|
|
1706
|
-
const
|
|
1707
|
-
n._triggerWatchers(
|
|
1713
|
+
const v = s || "root";
|
|
1714
|
+
n._triggerWatchers(v, i), n._render(t);
|
|
1708
1715
|
}
|
|
1709
|
-
return
|
|
1710
|
-
} :
|
|
1716
|
+
return l;
|
|
1717
|
+
} : u;
|
|
1711
1718
|
},
|
|
1712
|
-
set(i, a,
|
|
1713
|
-
if (i[a] =
|
|
1714
|
-
const
|
|
1715
|
-
n._triggerWatchers(
|
|
1719
|
+
set(i, a, f) {
|
|
1720
|
+
if (i[a] = f, !n._initializing) {
|
|
1721
|
+
const u = s ? `${s}.${String(a)}` : String(a);
|
|
1722
|
+
n._triggerWatchers(u, f), n._render(t);
|
|
1716
1723
|
}
|
|
1717
1724
|
return !0;
|
|
1718
1725
|
},
|
|
1719
1726
|
deleteProperty(i, a) {
|
|
1720
1727
|
if (delete i[a], !n._initializing) {
|
|
1721
|
-
const
|
|
1722
|
-
n._triggerWatchers(
|
|
1728
|
+
const f = s ? `${s}.${String(a)}` : String(a);
|
|
1729
|
+
n._triggerWatchers(f, void 0), n._render(t);
|
|
1723
1730
|
}
|
|
1724
1731
|
return !0;
|
|
1725
1732
|
}
|
|
@@ -1727,15 +1734,15 @@ function Xe(e) {
|
|
|
1727
1734
|
const a = s ? `${s}.${i}` : i;
|
|
1728
1735
|
o[i] = r(o[i], a);
|
|
1729
1736
|
}), new Proxy(o, {
|
|
1730
|
-
set(i, a,
|
|
1731
|
-
const
|
|
1732
|
-
return i[a] = r(
|
|
1733
|
-
|
|
1737
|
+
set(i, a, f) {
|
|
1738
|
+
const u = s ? `${s}.${String(a)}` : String(a);
|
|
1739
|
+
return i[a] = r(f, u), n._initializing || (n._triggerWatchers(
|
|
1740
|
+
u,
|
|
1734
1741
|
i[a]
|
|
1735
1742
|
), n._render(t)), !0;
|
|
1736
1743
|
},
|
|
1737
|
-
get(i, a,
|
|
1738
|
-
return Reflect.get(i, a,
|
|
1744
|
+
get(i, a, f) {
|
|
1745
|
+
return Reflect.get(i, a, f);
|
|
1739
1746
|
}
|
|
1740
1747
|
})) : o;
|
|
1741
1748
|
};
|
|
@@ -1747,7 +1754,7 @@ function Xe(e) {
|
|
|
1747
1754
|
}
|
|
1748
1755
|
_initWatchers(t) {
|
|
1749
1756
|
this._runLogicWithinErrorBoundary(t, () => {
|
|
1750
|
-
|
|
1757
|
+
_e(
|
|
1751
1758
|
this.context,
|
|
1752
1759
|
this._watchers,
|
|
1753
1760
|
t.watch || {}
|
|
@@ -1755,12 +1762,12 @@ function Xe(e) {
|
|
|
1755
1762
|
});
|
|
1756
1763
|
}
|
|
1757
1764
|
_triggerWatchers(t, r) {
|
|
1758
|
-
|
|
1765
|
+
Se(this.context, this._watchers, t, r);
|
|
1759
1766
|
}
|
|
1760
1767
|
_applyProps(t) {
|
|
1761
1768
|
this._runLogicWithinErrorBoundary(t, () => {
|
|
1762
1769
|
try {
|
|
1763
|
-
|
|
1770
|
+
Ce(this, t, this.context);
|
|
1764
1771
|
} catch (r) {
|
|
1765
1772
|
this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
|
|
1766
1773
|
}
|
|
@@ -1768,158 +1775,159 @@ function Xe(e) {
|
|
|
1768
1775
|
}
|
|
1769
1776
|
};
|
|
1770
1777
|
}
|
|
1771
|
-
function
|
|
1778
|
+
function q(e, t = {}, r, n) {
|
|
1772
1779
|
const o = n ?? t.key;
|
|
1773
1780
|
return { tag: e, key: o, props: t, children: r };
|
|
1774
1781
|
}
|
|
1775
|
-
function
|
|
1782
|
+
function Z(e) {
|
|
1776
1783
|
return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
|
|
1777
1784
|
}
|
|
1778
|
-
function
|
|
1779
|
-
return typeof e == "object" && e !== null && "tag" in e && !
|
|
1785
|
+
function U(e) {
|
|
1786
|
+
return typeof e == "object" && e !== null && "tag" in e && !Z(e);
|
|
1780
1787
|
}
|
|
1781
|
-
function
|
|
1788
|
+
function tt(e, t) {
|
|
1782
1789
|
return e.key != null ? e : { ...e, key: t };
|
|
1783
1790
|
}
|
|
1784
|
-
function
|
|
1791
|
+
function rt(e, t = [], r = {}) {
|
|
1785
1792
|
const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
|
|
1786
1793
|
let a;
|
|
1787
1794
|
for (; a = i.exec(e); ) {
|
|
1788
|
-
const
|
|
1789
|
-
let
|
|
1790
|
-
if (
|
|
1791
|
-
typeof
|
|
1792
|
-
else if (
|
|
1793
|
-
const
|
|
1794
|
-
n[
|
|
1795
|
-
} else if (
|
|
1796
|
-
const [
|
|
1797
|
-
let
|
|
1798
|
-
if (
|
|
1799
|
-
const
|
|
1800
|
-
let x =
|
|
1801
|
-
const
|
|
1802
|
-
for (let
|
|
1803
|
-
|
|
1804
|
-
|
|
1795
|
+
const f = a[1], u = a[2], p = (a[4] || a[6]) ?? "", g = p.match(/^{{(\d+)}}$/);
|
|
1796
|
+
let l = g ? t[Number(g[1])] ?? null : p;
|
|
1797
|
+
if (g || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l))), f === ":")
|
|
1798
|
+
typeof l == "boolean" ? o[u] = l : l != null && (typeof r[l] < "u" ? n[u] = r[l] : n[u] = l);
|
|
1799
|
+
else if (f === "@") {
|
|
1800
|
+
const v = "on" + u.charAt(0).toUpperCase() + u.slice(1);
|
|
1801
|
+
n[v] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
|
|
1802
|
+
} else if (f === "#") {
|
|
1803
|
+
const [v, ...y] = u.split("."), m = [...y];
|
|
1804
|
+
let h = l, d = [...m];
|
|
1805
|
+
if (v === "model" && typeof h == "string" && h.includes(".")) {
|
|
1806
|
+
const b = ["trim", "number", "lazy"], c = h.split(".");
|
|
1807
|
+
let x = h;
|
|
1808
|
+
const $ = [];
|
|
1809
|
+
for (let w = c.length - 1; w > 0 && b.includes(c[w]); w--)
|
|
1810
|
+
$.unshift(c[w]), x = c.slice(0, w).join(".");
|
|
1811
|
+
h = x, d.push(...$);
|
|
1805
1812
|
}
|
|
1806
|
-
s[
|
|
1807
|
-
value:
|
|
1808
|
-
modifiers:
|
|
1813
|
+
s[v] = {
|
|
1814
|
+
value: h,
|
|
1815
|
+
modifiers: d
|
|
1809
1816
|
};
|
|
1810
|
-
} else
|
|
1817
|
+
} else u === "ref" ? n.ref = l : o[u] = l;
|
|
1811
1818
|
}
|
|
1812
1819
|
return { props: n, attrs: o, directives: s };
|
|
1813
1820
|
}
|
|
1814
|
-
function
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1821
|
+
function nt(e, t, r) {
|
|
1822
|
+
const n = I.length > 0 ? I[I.length - 1] : void 0, o = r ?? n;
|
|
1823
|
+
function s(c, x) {
|
|
1824
|
+
return q("#text", {}, c, x);
|
|
1825
|
+
}
|
|
1826
|
+
let i = "";
|
|
1827
|
+
for (let c = 0; c < e.length; c++)
|
|
1828
|
+
i += e[c], c < t.length && (i += `{{${c}}}`);
|
|
1829
|
+
const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, f = [];
|
|
1830
|
+
let u, p = [], g = null, l = {}, v, y = 0, m = [];
|
|
1831
|
+
function h(c) {
|
|
1832
|
+
!c || typeof c != "object" || Z(c) || (c.props || c.attrs ? (c.props && (l.props || (l.props = {}), Object.assign(l.props, c.props)), c.attrs && (l.attrs || (l.attrs = {}), Object.keys(c.attrs).forEach((x) => {
|
|
1833
|
+
if (x === "style" && l.attrs.style) {
|
|
1834
|
+
const $ = l.attrs.style.replace(
|
|
1827
1835
|
/;?\s*$/,
|
|
1828
1836
|
""
|
|
1829
|
-
),
|
|
1830
|
-
|
|
1831
|
-
} else if (
|
|
1832
|
-
const
|
|
1833
|
-
.../* @__PURE__ */ new Set([
|
|
1837
|
+
), w = c.attrs.style.replace(/^;?\s*/, "");
|
|
1838
|
+
l.attrs.style = $ + "; " + w;
|
|
1839
|
+
} else if (x === "class" && l.attrs.class) {
|
|
1840
|
+
const $ = l.attrs.class.trim().split(/\s+/).filter(Boolean), w = c.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
|
|
1841
|
+
.../* @__PURE__ */ new Set([...$, ...w])
|
|
1834
1842
|
];
|
|
1835
|
-
|
|
1843
|
+
l.attrs.class = _.join(" ");
|
|
1836
1844
|
} else
|
|
1837
|
-
|
|
1838
|
-
}))) : (
|
|
1839
|
-
}
|
|
1840
|
-
function
|
|
1841
|
-
const
|
|
1842
|
-
if (
|
|
1843
|
-
const
|
|
1844
|
-
let
|
|
1845
|
-
|
|
1846
|
-
...
|
|
1847
|
-
key:
|
|
1848
|
-
children:
|
|
1845
|
+
l.attrs[x] = c.attrs[x];
|
|
1846
|
+
}))) : (l.props || (l.props = {}), Object.assign(l.props, c)));
|
|
1847
|
+
}
|
|
1848
|
+
function d(c, x) {
|
|
1849
|
+
const $ = g ? p : m;
|
|
1850
|
+
if (Z(c)) {
|
|
1851
|
+
const w = c.key ?? x;
|
|
1852
|
+
let _ = c.children;
|
|
1853
|
+
$.push({
|
|
1854
|
+
...c,
|
|
1855
|
+
key: w,
|
|
1856
|
+
children: _
|
|
1849
1857
|
});
|
|
1850
1858
|
return;
|
|
1851
1859
|
}
|
|
1852
|
-
if (
|
|
1853
|
-
|
|
1860
|
+
if (U(c)) {
|
|
1861
|
+
$.push(tt(c, void 0));
|
|
1854
1862
|
return;
|
|
1855
1863
|
}
|
|
1856
|
-
if (Array.isArray(
|
|
1857
|
-
if (
|
|
1858
|
-
for (let
|
|
1859
|
-
const
|
|
1860
|
-
|
|
1864
|
+
if (Array.isArray(c)) {
|
|
1865
|
+
if (c.length === 0) return;
|
|
1866
|
+
for (let w = 0; w < c.length; w++) {
|
|
1867
|
+
const _ = c[w];
|
|
1868
|
+
Z(_) || U(_) || Array.isArray(_) ? d(_, `${x}-${w}`) : _ !== null && typeof _ == "object" ? h(_) : $.push(s(String(_), `${x}-${w}`));
|
|
1861
1869
|
}
|
|
1862
1870
|
return;
|
|
1863
1871
|
}
|
|
1864
|
-
if (
|
|
1865
|
-
|
|
1872
|
+
if (c !== null && typeof c == "object") {
|
|
1873
|
+
h(c);
|
|
1866
1874
|
return;
|
|
1867
1875
|
}
|
|
1868
|
-
|
|
1869
|
-
}
|
|
1870
|
-
for (;
|
|
1871
|
-
if (
|
|
1872
|
-
const
|
|
1873
|
-
props:
|
|
1874
|
-
attrs:
|
|
1875
|
-
directives:
|
|
1876
|
-
} =
|
|
1877
|
-
for (const
|
|
1878
|
-
for (const
|
|
1879
|
-
for (const [
|
|
1880
|
-
if (
|
|
1881
|
-
if (typeof
|
|
1882
|
-
for (const [
|
|
1883
|
-
typeof
|
|
1884
|
-
else
|
|
1885
|
-
if (["show", "class", "style"].includes(
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
} else if (
|
|
1889
|
-
const
|
|
1890
|
-
let
|
|
1891
|
-
if (typeof
|
|
1892
|
-
|
|
1893
|
-
else if (Array.isArray(
|
|
1894
|
-
for (const
|
|
1895
|
-
if (typeof
|
|
1896
|
-
|
|
1897
|
-
else if (
|
|
1898
|
-
for (const [
|
|
1899
|
-
|
|
1900
|
-
} else if (
|
|
1901
|
-
for (const [
|
|
1902
|
-
|
|
1903
|
-
const
|
|
1876
|
+
$.push(s(String(c), x));
|
|
1877
|
+
}
|
|
1878
|
+
for (; u = a.exec(i); )
|
|
1879
|
+
if (u[1]) {
|
|
1880
|
+
const c = u[1], x = u[0][1] === "/", $ = u[0][u[0].length - 2] === "/", {
|
|
1881
|
+
props: w,
|
|
1882
|
+
attrs: _,
|
|
1883
|
+
directives: C
|
|
1884
|
+
} = rt(u[2] || "", t, o), k = { props: {}, attrs: {} };
|
|
1885
|
+
for (const A in w) k.props[A] = w[A];
|
|
1886
|
+
for (const A in _) k.attrs[A] = _[A];
|
|
1887
|
+
for (const [A, E] of Object.entries(C)) {
|
|
1888
|
+
if (A === "bind")
|
|
1889
|
+
if (typeof E.value == "object" && E.value !== null)
|
|
1890
|
+
for (const [T, j] of Object.entries(E.value))
|
|
1891
|
+
typeof j == "boolean" ? k.attrs[T] = j : j != null && (k.attrs[T] = String(j));
|
|
1892
|
+
else E.value != null && (k.attrs[A] = String(E.value));
|
|
1893
|
+
if (["show", "class", "style"].includes(A) && (k.directives || (k.directives = {}), k.directives[A] = E), A === "show") {
|
|
1894
|
+
const T = !!E.value;
|
|
1895
|
+
k.attrs.style = (k.attrs.style || "") + (T ? "" : "; display: none !important");
|
|
1896
|
+
} else if (A === "class") {
|
|
1897
|
+
const T = E.value;
|
|
1898
|
+
let j = [];
|
|
1899
|
+
if (typeof T == "string")
|
|
1900
|
+
j = T.split(/\s+/).filter(Boolean);
|
|
1901
|
+
else if (Array.isArray(T)) {
|
|
1902
|
+
for (const B of T)
|
|
1903
|
+
if (typeof B == "string")
|
|
1904
|
+
j.push(...B.split(/\s+/).filter(Boolean));
|
|
1905
|
+
else if (B && typeof B == "object")
|
|
1906
|
+
for (const [z, K] of Object.entries(B))
|
|
1907
|
+
K && j.push(...z.split(/\s+/).filter(Boolean));
|
|
1908
|
+
} else if (T && typeof T == "object")
|
|
1909
|
+
for (const [B, z] of Object.entries(T))
|
|
1910
|
+
z && j.push(...B.split(/\s+/).filter(Boolean));
|
|
1911
|
+
const D = k.attrs.class || "", H = [
|
|
1904
1912
|
.../* @__PURE__ */ new Set([
|
|
1905
|
-
...
|
|
1906
|
-
...
|
|
1913
|
+
...D.split(/\s+/).filter(Boolean),
|
|
1914
|
+
...j
|
|
1907
1915
|
])
|
|
1908
1916
|
];
|
|
1909
|
-
|
|
1910
|
-
} else if (
|
|
1911
|
-
const
|
|
1912
|
-
let
|
|
1913
|
-
if (typeof
|
|
1914
|
-
|
|
1915
|
-
else if (
|
|
1916
|
-
const
|
|
1917
|
-
for (const [
|
|
1918
|
-
if (
|
|
1919
|
-
const
|
|
1917
|
+
k.attrs.class = H.join(" ");
|
|
1918
|
+
} else if (A === "style") {
|
|
1919
|
+
const T = E.value;
|
|
1920
|
+
let j = "";
|
|
1921
|
+
if (typeof T == "string")
|
|
1922
|
+
j = T;
|
|
1923
|
+
else if (T && typeof T == "object") {
|
|
1924
|
+
const H = [];
|
|
1925
|
+
for (const [B, z] of Object.entries(T))
|
|
1926
|
+
if (z != null && z !== "") {
|
|
1927
|
+
const K = B.replace(
|
|
1920
1928
|
/[A-Z]/g,
|
|
1921
|
-
(
|
|
1922
|
-
),
|
|
1929
|
+
(we) => `-${we.toLowerCase()}`
|
|
1930
|
+
), xe = [
|
|
1923
1931
|
"width",
|
|
1924
1932
|
"height",
|
|
1925
1933
|
"top",
|
|
@@ -1945,194 +1953,194 @@ function et(e, t, r) {
|
|
|
1945
1953
|
"min-height",
|
|
1946
1954
|
"max-height"
|
|
1947
1955
|
];
|
|
1948
|
-
let
|
|
1949
|
-
typeof
|
|
1956
|
+
let ae = String(z);
|
|
1957
|
+
typeof z == "number" && xe.includes(K) && (ae = `${z}px`), H.push(`${K}: ${ae}`);
|
|
1950
1958
|
}
|
|
1951
|
-
|
|
1959
|
+
j = H.join("; ") + (H.length > 0 ? ";" : "");
|
|
1952
1960
|
}
|
|
1953
|
-
const
|
|
1954
|
-
|
|
1961
|
+
const D = k.attrs.style || "";
|
|
1962
|
+
k.attrs.style = D + (D && !D.endsWith(";") ? "; " : "") + j;
|
|
1955
1963
|
}
|
|
1956
1964
|
}
|
|
1957
|
-
const
|
|
1958
|
-
for (const [
|
|
1959
|
-
["bind", "show", "class", "style"].includes(
|
|
1960
|
-
if (Object.keys(
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
),
|
|
1967
|
-
|
|
1968
|
-
} else
|
|
1969
|
-
tag:
|
|
1970
|
-
props:
|
|
1971
|
-
children:
|
|
1972
|
-
key:
|
|
1973
|
-
}),
|
|
1974
|
-
} else if (typeof
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
} else if (
|
|
1978
|
-
const
|
|
1979
|
-
for (const
|
|
1980
|
-
if (!
|
|
1981
|
-
const
|
|
1982
|
-
if (
|
|
1983
|
-
const
|
|
1984
|
-
|
|
1965
|
+
const S = {};
|
|
1966
|
+
for (const [A, E] of Object.entries(C))
|
|
1967
|
+
["bind", "show", "class", "style"].includes(A) || (S[A] = E);
|
|
1968
|
+
if (Object.keys(S).length > 0 && (k.directives = S), x) {
|
|
1969
|
+
const A = q(
|
|
1970
|
+
g,
|
|
1971
|
+
l,
|
|
1972
|
+
p.length === 1 && U(p[0]) && p[0].tag === "#text" ? typeof p[0].children == "string" ? p[0].children : "" : p.length ? p : void 0,
|
|
1973
|
+
v
|
|
1974
|
+
), E = f.pop();
|
|
1975
|
+
E ? (g = E.tag, l = E.props, v = E.key, p = E.children, p.push(A)) : (m.push(A), g = null, l = {}, v = void 0, p = []);
|
|
1976
|
+
} else $ ? g ? p.push(q(c, k, void 0, void 0)) : m.push(q(c, k, void 0, void 0)) : (g && f.push({
|
|
1977
|
+
tag: g,
|
|
1978
|
+
props: l,
|
|
1979
|
+
children: p,
|
|
1980
|
+
key: v
|
|
1981
|
+
}), g = c, l = k, p = []);
|
|
1982
|
+
} else if (typeof u[3] < "u") {
|
|
1983
|
+
const c = Number(u[3]), x = t[c], $ = `interp-${c}`;
|
|
1984
|
+
d(x, $);
|
|
1985
|
+
} else if (u[4]) {
|
|
1986
|
+
const c = u[4], x = g ? p : m, $ = c.split(/({{\d+}})/);
|
|
1987
|
+
for (const w of $) {
|
|
1988
|
+
if (!w) continue;
|
|
1989
|
+
const _ = w.match(/^{{(\d+)}}$/);
|
|
1990
|
+
if (_) {
|
|
1991
|
+
const C = Number(_[1]), k = t[C], S = `interp-${C}`;
|
|
1992
|
+
d(k, S);
|
|
1985
1993
|
} else {
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1994
|
+
const C = `text-${y++}`;
|
|
1995
|
+
x.push(s(w, C));
|
|
1988
1996
|
}
|
|
1989
1997
|
}
|
|
1990
1998
|
}
|
|
1991
|
-
const
|
|
1992
|
-
return
|
|
1999
|
+
const b = m.filter((c) => U(c) && c.tag === "#text" ? typeof c.children == "string" && c.children.trim() !== "" : !0);
|
|
2000
|
+
return b.length === 1 ? b[0] : b.length > 1 ? b : q("div", {}, "", "fallback-root");
|
|
1993
2001
|
}
|
|
1994
|
-
function
|
|
2002
|
+
function P(e, ...t) {
|
|
1995
2003
|
const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
|
|
1996
|
-
return
|
|
2004
|
+
return nt(e, t, n);
|
|
1997
2005
|
}
|
|
1998
|
-
const
|
|
2006
|
+
const ye = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, R = (e, t) => {
|
|
1999
2007
|
for (const r of e) {
|
|
2000
2008
|
const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
|
|
2001
2009
|
if (i) {
|
|
2002
2010
|
const a = {};
|
|
2003
|
-
return n.forEach((
|
|
2004
|
-
a[
|
|
2011
|
+
return n.forEach((f, u) => {
|
|
2012
|
+
a[f] = i[u + 1];
|
|
2005
2013
|
}), { route: r, params: a };
|
|
2006
2014
|
}
|
|
2007
2015
|
}
|
|
2008
2016
|
return { route: null, params: {} };
|
|
2009
|
-
},
|
|
2010
|
-
async function
|
|
2017
|
+
}, re = {};
|
|
2018
|
+
async function ot(e) {
|
|
2011
2019
|
if (e.component) return e.component;
|
|
2012
2020
|
if (e.load) {
|
|
2013
|
-
if (
|
|
2021
|
+
if (re[e.path]) return re[e.path];
|
|
2014
2022
|
try {
|
|
2015
2023
|
const t = await e.load();
|
|
2016
|
-
return
|
|
2024
|
+
return re[e.path] = t.default, t.default;
|
|
2017
2025
|
} catch {
|
|
2018
2026
|
throw new Error(`Failed to load component for route: ${e.path}`);
|
|
2019
2027
|
}
|
|
2020
2028
|
}
|
|
2021
2029
|
throw new Error(`No component or loader defined for route: ${e.path}`);
|
|
2022
2030
|
}
|
|
2023
|
-
function
|
|
2031
|
+
function it(e) {
|
|
2024
2032
|
const { routes: t, base: r = "", initialUrl: n } = e;
|
|
2025
|
-
let o, s, i, a,
|
|
2026
|
-
const
|
|
2027
|
-
const
|
|
2028
|
-
if (
|
|
2033
|
+
let o, s, i, a, f, u, p;
|
|
2034
|
+
const g = async (m, h) => {
|
|
2035
|
+
const d = t.find((b) => R([b], m.path).route !== null);
|
|
2036
|
+
if (d?.beforeEnter)
|
|
2029
2037
|
try {
|
|
2030
|
-
const
|
|
2031
|
-
return typeof
|
|
2032
|
-
} catch (
|
|
2033
|
-
return console.error("beforeEnter error",
|
|
2038
|
+
const b = await d.beforeEnter(m, h);
|
|
2039
|
+
return typeof b == "string" ? (await y(b, !0), !1) : b !== !1;
|
|
2040
|
+
} catch (b) {
|
|
2041
|
+
return console.error("beforeEnter error", b), !1;
|
|
2034
2042
|
}
|
|
2035
2043
|
return !0;
|
|
2036
|
-
},
|
|
2037
|
-
const
|
|
2038
|
-
if (
|
|
2044
|
+
}, l = async (m, h) => {
|
|
2045
|
+
const d = t.find((b) => R([b], m.path).route !== null);
|
|
2046
|
+
if (d?.onEnter)
|
|
2039
2047
|
try {
|
|
2040
|
-
const
|
|
2041
|
-
return typeof
|
|
2042
|
-
} catch (
|
|
2043
|
-
return console.error("onEnter error",
|
|
2048
|
+
const b = await d.onEnter(m, h);
|
|
2049
|
+
return typeof b == "string" ? (await y(b, !0), !1) : b !== !1;
|
|
2050
|
+
} catch (b) {
|
|
2051
|
+
return console.error("onEnter error", b), !1;
|
|
2044
2052
|
}
|
|
2045
2053
|
return !0;
|
|
2046
|
-
},
|
|
2047
|
-
const
|
|
2048
|
-
if (
|
|
2054
|
+
}, v = (m, h) => {
|
|
2055
|
+
const d = t.find((b) => R([b], m.path).route !== null);
|
|
2056
|
+
if (d?.afterEnter)
|
|
2049
2057
|
try {
|
|
2050
|
-
|
|
2051
|
-
} catch (
|
|
2052
|
-
console.error("afterEnter error",
|
|
2058
|
+
d.afterEnter(m, h);
|
|
2059
|
+
} catch (b) {
|
|
2060
|
+
console.error("afterEnter error", b);
|
|
2053
2061
|
}
|
|
2054
|
-
},
|
|
2062
|
+
}, y = async (m, h = !1) => {
|
|
2055
2063
|
try {
|
|
2056
|
-
const
|
|
2057
|
-
path:
|
|
2064
|
+
const d = {
|
|
2065
|
+
path: m.replace(r, "") || "/",
|
|
2058
2066
|
query: {}
|
|
2059
|
-
},
|
|
2060
|
-
if (!
|
|
2061
|
-
const
|
|
2062
|
-
path:
|
|
2063
|
-
params:
|
|
2064
|
-
query:
|
|
2067
|
+
}, b = R(t, d.path);
|
|
2068
|
+
if (!b) throw new Error(`No route found for ${d.path}`);
|
|
2069
|
+
const c = i.getState(), x = {
|
|
2070
|
+
path: d.path,
|
|
2071
|
+
params: b.params,
|
|
2072
|
+
query: d.query
|
|
2065
2073
|
};
|
|
2066
|
-
if (!await
|
|
2067
|
-
typeof window < "u" && typeof document < "u" && (
|
|
2068
|
-
} catch (
|
|
2069
|
-
console.error("Navigation error:",
|
|
2074
|
+
if (!await g(x, c) || !await l(x, c)) return;
|
|
2075
|
+
typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + m) : window.history.pushState({}, "", r + m)), i.setState(x), v(x, c);
|
|
2076
|
+
} catch (d) {
|
|
2077
|
+
console.error("Navigation error:", d);
|
|
2070
2078
|
}
|
|
2071
2079
|
};
|
|
2072
2080
|
if (typeof window < "u" && typeof document < "u") {
|
|
2073
2081
|
o = () => {
|
|
2074
|
-
const
|
|
2075
|
-
return { path:
|
|
2082
|
+
const h = new URL(window.location.href), d = h.pathname.replace(r, "") || "/", b = ye(h.search);
|
|
2083
|
+
return { path: d, query: b };
|
|
2076
2084
|
}, s = o();
|
|
2077
|
-
const
|
|
2078
|
-
i =
|
|
2085
|
+
const m = R(t, s.path);
|
|
2086
|
+
i = le({
|
|
2079
2087
|
path: s.path,
|
|
2080
|
-
params:
|
|
2088
|
+
params: m.params,
|
|
2081
2089
|
query: s.query
|
|
2082
|
-
}), a = async (
|
|
2083
|
-
const
|
|
2084
|
-
await
|
|
2085
|
-
}, window.addEventListener("popstate", () => a(!0)),
|
|
2090
|
+
}), a = async (h = !1) => {
|
|
2091
|
+
const d = o();
|
|
2092
|
+
await y(d.path, h);
|
|
2093
|
+
}, window.addEventListener("popstate", () => a(!0)), f = (h) => y(h, !1), u = (h) => y(h, !0), p = () => window.history.back();
|
|
2086
2094
|
} else {
|
|
2087
2095
|
o = () => {
|
|
2088
|
-
const
|
|
2089
|
-
return { path:
|
|
2096
|
+
const h = new URL(n || "/", "http://localhost"), d = h.pathname.replace(r, "") || "/", b = ye(h.search);
|
|
2097
|
+
return { path: d, query: b };
|
|
2090
2098
|
}, s = o();
|
|
2091
|
-
const
|
|
2092
|
-
i =
|
|
2099
|
+
const m = R(t, s.path);
|
|
2100
|
+
i = le({
|
|
2093
2101
|
path: s.path,
|
|
2094
|
-
params:
|
|
2102
|
+
params: m.params,
|
|
2095
2103
|
query: s.query
|
|
2096
2104
|
}), a = async () => {
|
|
2097
|
-
}, c = async () => {
|
|
2098
2105
|
}, f = async () => {
|
|
2099
|
-
},
|
|
2106
|
+
}, u = async () => {
|
|
2107
|
+
}, p = () => {
|
|
2100
2108
|
};
|
|
2101
2109
|
}
|
|
2102
2110
|
return {
|
|
2103
2111
|
store: i,
|
|
2104
|
-
push:
|
|
2105
|
-
replace:
|
|
2106
|
-
back:
|
|
2112
|
+
push: f,
|
|
2113
|
+
replace: u,
|
|
2114
|
+
back: p,
|
|
2107
2115
|
subscribe: i.subscribe,
|
|
2108
|
-
matchRoute: (
|
|
2116
|
+
matchRoute: (m) => R(t, m),
|
|
2109
2117
|
getCurrent: () => i.getState(),
|
|
2110
|
-
resolveRouteComponent:
|
|
2118
|
+
resolveRouteComponent: ot
|
|
2111
2119
|
};
|
|
2112
2120
|
}
|
|
2113
|
-
function
|
|
2114
|
-
return
|
|
2121
|
+
function pt(e, t) {
|
|
2122
|
+
return R(e, t);
|
|
2115
2123
|
}
|
|
2116
|
-
function
|
|
2117
|
-
const t =
|
|
2118
|
-
return
|
|
2124
|
+
function ht(e) {
|
|
2125
|
+
const t = it(e);
|
|
2126
|
+
return ge("router-view", {
|
|
2119
2127
|
async render() {
|
|
2120
|
-
if (!t) return
|
|
2128
|
+
if (!t) return P`<div>Router not initialized.</div>`;
|
|
2121
2129
|
const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
|
|
2122
|
-
if (!o.route) return
|
|
2130
|
+
if (!o.route) return P`<div>Not found</div>`;
|
|
2123
2131
|
let s = o.route.component;
|
|
2124
2132
|
if (o.route.load) {
|
|
2125
2133
|
const i = await o.route.load();
|
|
2126
2134
|
typeof i.default == "string" && (s = i.default);
|
|
2127
2135
|
}
|
|
2128
|
-
return typeof s == "string" ? { tag: s, props: {}, children: [] } :
|
|
2136
|
+
return typeof s == "string" ? { tag: s, props: {}, children: [] } : P`<div>Invalid route component</div>`;
|
|
2129
2137
|
},
|
|
2130
2138
|
onConnected(r) {
|
|
2131
2139
|
t && typeof t.subscribe == "function" && t.subscribe(() => {
|
|
2132
2140
|
typeof r.requestRender == "function" && r.requestRender();
|
|
2133
2141
|
});
|
|
2134
2142
|
}
|
|
2135
|
-
}),
|
|
2143
|
+
}), ge("router-link", {
|
|
2136
2144
|
state: {},
|
|
2137
2145
|
props: {
|
|
2138
2146
|
to: { type: String, default: "" },
|
|
@@ -2144,7 +2152,7 @@ function ut(e) {
|
|
|
2144
2152
|
ariaCurrentValue: { type: String, default: "page" },
|
|
2145
2153
|
disabled: { type: Boolean, default: !1 },
|
|
2146
2154
|
external: { type: Boolean, default: !1 },
|
|
2147
|
-
style: { type: String, default:
|
|
2155
|
+
style: { type: String, default: be`
|
|
2148
2156
|
[aria-disabled="true"] {
|
|
2149
2157
|
pointer-events: none;
|
|
2150
2158
|
opacity: 0.5;
|
|
@@ -2153,60 +2161,60 @@ function ut(e) {
|
|
|
2153
2161
|
},
|
|
2154
2162
|
style: (r) => r.style,
|
|
2155
2163
|
render: (r) => {
|
|
2156
|
-
const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass,
|
|
2157
|
-
return
|
|
2158
|
-
${
|
|
2164
|
+
const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, f = r.ariaCurrentValue, u = r.tag, p = r.disabled, g = r.external, l = n.path === o, v = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, y = l ? i : v ? a : "", m = l ? `aria-current="${f}"` : "", h = u === "button", d = p ? h ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", b = g && (u === "a" || !u) ? 'target="_blank" rel="noopener noreferrer"' : "";
|
|
2165
|
+
return P`
|
|
2166
|
+
${ke().when(h, P`
|
|
2159
2167
|
<button
|
|
2160
2168
|
part="button"
|
|
2161
|
-
class="${
|
|
2162
|
-
${
|
|
2163
|
-
${
|
|
2164
|
-
${
|
|
2169
|
+
class="${y}"
|
|
2170
|
+
${m}
|
|
2171
|
+
${d}
|
|
2172
|
+
${b}
|
|
2165
2173
|
data-on-click="navigate"
|
|
2166
2174
|
><slot></slot></button>
|
|
2167
|
-
`).otherwise(
|
|
2175
|
+
`).otherwise(P`
|
|
2168
2176
|
<a
|
|
2169
2177
|
part="link"
|
|
2170
2178
|
href="${o}"
|
|
2171
|
-
class="${
|
|
2172
|
-
${
|
|
2173
|
-
${
|
|
2174
|
-
${
|
|
2179
|
+
class="${y}"
|
|
2180
|
+
${m}
|
|
2181
|
+
${d}
|
|
2182
|
+
${b}
|
|
2175
2183
|
data-on-click="navigate"
|
|
2176
2184
|
><slot></slot></a>
|
|
2177
2185
|
`).done()}
|
|
2178
2186
|
`;
|
|
2179
2187
|
},
|
|
2180
2188
|
navigate: (r, n) => {
|
|
2181
|
-
const { disabled: o, external: s, tag: i, replace: a, to:
|
|
2189
|
+
const { disabled: o, external: s, tag: i, replace: a, to: f } = n.props;
|
|
2182
2190
|
if (o) {
|
|
2183
2191
|
r.preventDefault();
|
|
2184
2192
|
return;
|
|
2185
2193
|
}
|
|
2186
|
-
s && (i === "a" || !i) || (r.preventDefault(), a ? t.replace(
|
|
2194
|
+
s && (i === "a" || !i) || (r.preventDefault(), a ? t.replace(f) : t.push(f));
|
|
2187
2195
|
}
|
|
2188
2196
|
}), t;
|
|
2189
2197
|
}
|
|
2190
2198
|
export {
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2199
|
+
W as GlobalEventBus,
|
|
2200
|
+
ge as component,
|
|
2201
|
+
le as createStore,
|
|
2202
|
+
be as css,
|
|
2203
|
+
at as each,
|
|
2204
|
+
lt as emit,
|
|
2205
|
+
F as eventBus,
|
|
2206
|
+
P as html,
|
|
2207
|
+
ht as initRouter,
|
|
2208
|
+
dt as listen,
|
|
2209
|
+
ke as match,
|
|
2210
|
+
R as matchRoute,
|
|
2211
|
+
pt as matchRouteSSR,
|
|
2212
|
+
ft as off,
|
|
2213
|
+
ct as on,
|
|
2214
|
+
ut as once,
|
|
2215
|
+
ye as parseQuery,
|
|
2216
|
+
ot as resolveRouteComponent,
|
|
2217
|
+
it as useRouter,
|
|
2218
|
+
st as when
|
|
2211
2219
|
};
|
|
2212
2220
|
//# sourceMappingURL=custom-elements-runtime.es.js.map
|