aptechka 0.80.2 → 0.81.1
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/lib/{SourceElement-BiNNtaz9.js → SourceElement-BweVAYgJ.js} +50 -47
- package/lib/SourceElement-DMS25FM0.cjs +5 -0
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +1 -1
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/morph/Morph.d.ts +7 -3
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +449 -442
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +1 -1
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +1 -1
- package/lib/source/SourceElement.d.ts +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +1 -1
- package/lib/url-BRY7C6vT.cjs +1 -0
- package/lib/url-DQgGZl_e.js +66 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/url.d.ts +2 -1
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +1 -1
- package/package.json +1 -1
- package/lib/SourceElement-BBfaAgwe.cjs +0 -5
- package/lib/url-C2kASACG.cjs +0 -1
- package/lib/url-CGbjOTU4.js +0 -59
|
@@ -2,32 +2,32 @@ var X = (l) => {
|
|
|
2
2
|
throw TypeError(l);
|
|
3
3
|
};
|
|
4
4
|
var Z = (l, a, e) => a.has(l) || X("Cannot " + e);
|
|
5
|
-
var t = (l, a, e) => (Z(l, a, "read from private field"), e ? e.call(l) : a.get(l)), i = (l, a, e) => a.has(l) ? X("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(l) : a.set(l, e), s = (l, a, e, h) => (Z(l, a, "write to private field"), h ? h.call(l, e) : a.set(l, e), e),
|
|
5
|
+
var t = (l, a, e) => (Z(l, a, "read from private field"), e ? e.call(l) : a.get(l)), i = (l, a, e) => a.has(l) ? X("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(l) : a.set(l, e), s = (l, a, e, h) => (Z(l, a, "write to private field"), h ? h.call(l, e) : a.set(l, e), e), j = (l, a, e) => (Z(l, a, "access private method"), e);
|
|
6
6
|
import { ElementLinkedStore as st } from "./element-linked-store/index.js";
|
|
7
|
+
import { loading as J } from "./loading/index.js";
|
|
7
8
|
import { i as it } from "./index-JqYHGoo6.js";
|
|
8
9
|
import { d as w } from "./events-CsVF98U6.js";
|
|
9
10
|
import { k as Y } from "./string-BlMQbe8b.js";
|
|
10
11
|
import "construct-style-sheets-polyfill";
|
|
11
|
-
import { loading as J } from "./loading/index.js";
|
|
12
12
|
import { RESIZE_ORDER as rt } from "./order/index.js";
|
|
13
13
|
import { windowResizer as tt } from "./window-resizer/index.js";
|
|
14
14
|
import { S as at } from "./Store-BtVtCGLk.js";
|
|
15
|
-
var
|
|
15
|
+
var V, S, z, L, m, p, q;
|
|
16
16
|
class nt {
|
|
17
17
|
constructor(a) {
|
|
18
|
-
i(this,
|
|
18
|
+
i(this, V);
|
|
19
19
|
i(this, S);
|
|
20
20
|
i(this, z);
|
|
21
|
-
i(this,
|
|
21
|
+
i(this, L);
|
|
22
22
|
i(this, m);
|
|
23
23
|
i(this, p);
|
|
24
24
|
i(this, q);
|
|
25
|
-
s(this,
|
|
25
|
+
s(this, V, a);
|
|
26
26
|
let e = a.split(".");
|
|
27
27
|
const h = /\b\d{1,2}x\b/g, n = e.find((y) => y.match(h) && parseInt(y));
|
|
28
28
|
s(this, z, n ? parseInt(n) : 1), n && (e = e.slice(0, -1)), s(this, S, e.length > 1 ? e.slice(0, -1).join(".") : e.join("."));
|
|
29
|
-
const o = /\d+max/g, d = /\d+min/g,
|
|
30
|
-
|
|
29
|
+
const o = /\d+max/g, d = /\d+min/g, U = /\d+mar/g, F = /\d+mir/g, W = e.find((y) => y.match(o)), u = e.find((y) => y.match(d)), x = e.find((y) => y.match(U)), Q = e.find((y) => y.match(F));
|
|
30
|
+
x ? (s(this, m, parseInt(x)), s(this, p, "max"), s(this, L, `(max-aspect-ratio: ${t(this, m)})`)) : Q ? (s(this, m, parseInt(Q)), s(this, p, "max"), s(this, L, `(min-aspect-ratio: ${t(this, m)})`)) : W ? (s(this, m, parseInt(W)), s(this, p, "max"), s(this, L, `(max-width: ${t(this, m)}px)`)) : u ? (s(this, m, parseInt(u)), s(this, L, `(min-width: ${t(this, m)}px)`), s(this, p, "min")) : (s(this, m, 0), s(this, L, `(min-width: ${t(this, m)}px)`), s(this, p, "min")), s(this, S, t(this, S).replace(
|
|
31
31
|
`.${t(this, m)}${t(this, p)}`,
|
|
32
32
|
""
|
|
33
33
|
)), s(this, q, e[e.length - 1] === t(this, S) ? "" : "." + e[e.length - 1]), s(this, q, t(this, q).replace(
|
|
@@ -36,7 +36,7 @@ class nt {
|
|
|
36
36
|
));
|
|
37
37
|
}
|
|
38
38
|
get url() {
|
|
39
|
-
return t(this,
|
|
39
|
+
return t(this, V);
|
|
40
40
|
}
|
|
41
41
|
get name() {
|
|
42
42
|
return t(this, S);
|
|
@@ -45,7 +45,7 @@ class nt {
|
|
|
45
45
|
return t(this, z);
|
|
46
46
|
}
|
|
47
47
|
get query() {
|
|
48
|
-
return t(this,
|
|
48
|
+
return t(this, L);
|
|
49
49
|
}
|
|
50
50
|
get extension() {
|
|
51
51
|
return t(this, q);
|
|
@@ -57,7 +57,16 @@ class nt {
|
|
|
57
57
|
return t(this, m);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
V = new WeakMap(), S = new WeakMap(), z = new WeakMap(), L = new WeakMap(), m = new WeakMap(), p = new WeakMap(), q = new WeakMap();
|
|
61
|
+
function ht(l) {
|
|
62
|
+
if (isNaN(l)) return "0:00";
|
|
63
|
+
const a = Math.floor(Math.max(0, l)), e = Math.floor(a / 3600), h = Math.floor(a % 3600 / 60), o = (a % 60).toString().padStart(2, "0");
|
|
64
|
+
if (e > 0) {
|
|
65
|
+
const d = h.toString().padStart(2, "0");
|
|
66
|
+
return `${e}:${d}:${o}`;
|
|
67
|
+
} else
|
|
68
|
+
return `${h}:${o}`;
|
|
69
|
+
}
|
|
61
70
|
var v;
|
|
62
71
|
class et {
|
|
63
72
|
constructor(a, e) {
|
|
@@ -65,11 +74,11 @@ class et {
|
|
|
65
74
|
s(this, v, /* @__PURE__ */ new Map());
|
|
66
75
|
const h = (e == null ? void 0 : e.mediaBuckets) !== !1, n = typeof a == "string" ? h ? a.trim().split(",").map((u) => u.trim()).filter((u) => !!u) : [a] : a, o = [];
|
|
67
76
|
n.forEach((u) => {
|
|
68
|
-
const
|
|
69
|
-
o.push([
|
|
77
|
+
const x = new nt(u);
|
|
78
|
+
o.push([x.query, x]);
|
|
70
79
|
});
|
|
71
|
-
const d = o.filter((u) => u[1].queryType.includes("max")).sort((u,
|
|
72
|
-
(
|
|
80
|
+
const d = o.filter((u) => u[1].queryType.includes("max")).sort((u, x) => x[1].queryValue - u[1].queryValue), U = o.filter((u) => u[1].queryType.includes("min") && u[1].queryValue !== 0).sort((u, x) => u[1].queryValue - x[1].queryValue), F = o.filter((u) => u[0] === "(min-width: 0px)");
|
|
81
|
+
(F ? [...F, ...d, ...U] : [...d, ...U]).forEach((u) => {
|
|
73
82
|
t(this, v).has(u[0]) || t(this, v).set(u[0], []), t(this, v).get(u[0]).push(u[1]);
|
|
74
83
|
});
|
|
75
84
|
}
|
|
@@ -79,7 +88,7 @@ class et {
|
|
|
79
88
|
}
|
|
80
89
|
v = new WeakMap();
|
|
81
90
|
var k, $;
|
|
82
|
-
class
|
|
91
|
+
class ot extends at {
|
|
83
92
|
constructor(e) {
|
|
84
93
|
super(void 0);
|
|
85
94
|
i(this, k);
|
|
@@ -109,18 +118,9 @@ class ht extends at {
|
|
|
109
118
|
}
|
|
110
119
|
}
|
|
111
120
|
k = new WeakMap(), $ = new WeakMap();
|
|
112
|
-
function ot(l) {
|
|
113
|
-
if (isNaN(l)) return "0:00";
|
|
114
|
-
const a = Math.floor(Math.max(0, l)), e = Math.floor(a / 3600), h = Math.floor(a % 3600 / 60), o = (a % 60).toString().padStart(2, "0");
|
|
115
|
-
if (e > 0) {
|
|
116
|
-
const d = h.toString().padStart(2, "0");
|
|
117
|
-
return `${e}:${d}:${o}`;
|
|
118
|
-
} else
|
|
119
|
-
return `${h}:${o}`;
|
|
120
|
-
}
|
|
121
121
|
let ct = 0;
|
|
122
|
-
var f, r, I, E, b, g, B, A, c, O, R, M, P, T,
|
|
123
|
-
class
|
|
122
|
+
var f, r, I, E, b, g, B, A, c, O, R, M, P, T, _, G, D, K, H, N, C;
|
|
123
|
+
class Lt extends HTMLElement {
|
|
124
124
|
constructor(e) {
|
|
125
125
|
super();
|
|
126
126
|
i(this, T);
|
|
@@ -146,28 +146,31 @@ class xt extends HTMLElement {
|
|
|
146
146
|
i(this, P);
|
|
147
147
|
i(this, G, (e) => {
|
|
148
148
|
const h = e[0];
|
|
149
|
-
t(this, g) && (!t(this, b) || this.hasAttribute("reload-source")) && h.isIntersecting && this.triggerLazyLoad(), h.isIntersecting ? w(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (
|
|
149
|
+
t(this, g) && (!t(this, b) || this.hasAttribute("reload-source")) && h.isIntersecting && this.triggerLazyLoad(), h.isIntersecting ? w(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (j(this, T, _).call(this, void 0), s(this, b, !1)), w(this, "sourceRelease", { custom: !0 }));
|
|
150
150
|
});
|
|
151
151
|
i(this, D, () => {
|
|
152
152
|
t(this, c).set("loaded", !0), t(this, c).set("error", !1), t(this, c).set("loading", !1), !t(this, g) && !t(this, E) && J.complete(t(this, A)), w(this, "sourceLoaded", { custom: !0 });
|
|
153
153
|
const e = getComputedStyle(this).getPropertyValue("--clear-duration");
|
|
154
|
-
e ? s(this, R, setTimeout(
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
e ? s(this, R, setTimeout(
|
|
155
|
+
() => {
|
|
156
|
+
t(this, c).set("clear", !0);
|
|
157
|
+
},
|
|
158
|
+
parseFloat(e) * 1e3
|
|
159
|
+
)) : t(this, c).set("clear", !0), s(this, E, !0);
|
|
157
160
|
});
|
|
158
161
|
i(this, K, (e) => {
|
|
159
162
|
t(this, c).set("loaded", !1), t(this, c).set("error", !0), t(this, c).set("loading", !1), !t(this, g) && !t(this, E) && J.error(t(this, A)), w(this, "sourceError", { custom: !0 }), s(this, E, !0);
|
|
160
163
|
});
|
|
161
|
-
i(this,
|
|
164
|
+
i(this, H, () => {
|
|
162
165
|
t(this, c).set("playing", !0), w(this, "sourcePlay", { custom: !0 });
|
|
163
166
|
});
|
|
164
|
-
i(this,
|
|
167
|
+
i(this, N, () => {
|
|
165
168
|
t(this, c).set("playing", !1), w(this, "sourcePause", { custom: !0 });
|
|
166
169
|
});
|
|
167
|
-
i(this,
|
|
170
|
+
i(this, C, () => {
|
|
168
171
|
const e = t(this, r);
|
|
169
172
|
(e.tagName === "VIDEO" || e.tagName === "AUDIO") && e.readyState >= 1 && (t(this, c).set("metadata", !0), w(this, "sourceMetadataLoaded", { custom: !0 }), this.querySelectorAll("[data-source-duration]").forEach((h) => {
|
|
170
|
-
h.textContent =
|
|
173
|
+
h.textContent = ht(e.duration);
|
|
171
174
|
}));
|
|
172
175
|
});
|
|
173
176
|
s(this, P, e == null ? void 0 : e.sourceSetOptions), it && window.IntersectionObserver && s(this, O, new IntersectionObserver(
|
|
@@ -206,7 +209,7 @@ class xt extends HTMLElement {
|
|
|
206
209
|
return t(this, E);
|
|
207
210
|
}
|
|
208
211
|
triggerLazyLoad() {
|
|
209
|
-
!t(this, b) && t(this, f).current && t(this, f).current !== t(this, f).previous && (s(this, b, !0),
|
|
212
|
+
!t(this, b) && t(this, f).current && t(this, f).current !== t(this, f).previous && (s(this, b, !0), j(this, T, _).call(this, t(this, f).current));
|
|
210
213
|
}
|
|
211
214
|
connectedCallback() {
|
|
212
215
|
s(this, B, `source-consumer-${++ct}`);
|
|
@@ -215,10 +218,10 @@ class xt extends HTMLElement {
|
|
|
215
218
|
display: block;
|
|
216
219
|
width: 100%;
|
|
217
220
|
height: 100%;
|
|
218
|
-
`, t(this, r).classList.add("source-consumer"), t(this, r).addEventListener("play", t(this,
|
|
221
|
+
`, t(this, r).classList.add("source-consumer"), t(this, r).addEventListener("play", t(this, H)), t(this, r).addEventListener("pause", t(this, N)), t(this, r).addEventListener(
|
|
219
222
|
"loadedmetadata",
|
|
220
|
-
t(this,
|
|
221
|
-
), t(this,
|
|
223
|
+
t(this, C)
|
|
224
|
+
), t(this, C).call(this), Array.from(this.attributes).forEach((n) => {
|
|
222
225
|
if (n.name !== "srcset") {
|
|
223
226
|
const o = n.nodeValue || "", d = Y(n.name);
|
|
224
227
|
d in t(this, r) && (t(this, r)[d] = o || !0);
|
|
@@ -228,22 +231,22 @@ class xt extends HTMLElement {
|
|
|
228
231
|
const o = this.dataset[n], d = Y(n);
|
|
229
232
|
d in t(this, r) && (t(this, r)[d] = o ? o === "false" ? !1 : o : !0);
|
|
230
233
|
}
|
|
231
|
-
t(this, I).appendChild(t(this, r)), s(this, f, new
|
|
234
|
+
t(this, I).appendChild(t(this, r)), s(this, f, new ot({
|
|
232
235
|
srcset: e,
|
|
233
236
|
sourceSetOptions: t(this, P)
|
|
234
237
|
})), s(this, g, this.hasAttribute("lazy")), t(this, f).subscribe((n) => {
|
|
235
|
-
(!t(this, g) || t(this, g) && t(this, b)) &&
|
|
238
|
+
(!t(this, g) || t(this, g) && t(this, b)) && j(this, T, _).call(this, n.current);
|
|
236
239
|
}), t(this, f).connect(), t(this, O).observe(this);
|
|
237
240
|
}
|
|
238
241
|
disconnectedCallback() {
|
|
239
242
|
var e;
|
|
240
|
-
clearTimeout(t(this, R)), t(this, O).disconnect(), (e = t(this, f)) == null || e.close(), t(this, r) && (this.consumeSource(null), t(this, r).removeEventListener("play", t(this,
|
|
243
|
+
clearTimeout(t(this, R)), t(this, O).disconnect(), (e = t(this, f)) == null || e.close(), t(this, r) && (this.consumeSource(null), t(this, r).removeEventListener("play", t(this, H)), t(this, r).removeEventListener("pause", t(this, N)), t(this, r).removeEventListener(
|
|
241
244
|
"loadedmetadata",
|
|
242
|
-
t(this,
|
|
245
|
+
t(this, C)
|
|
243
246
|
), t(this, r).onloadeddata = null, t(this, r).onload = null, t(this, r).onerror = null, t(this, r).onerror = null, t(this, r).remove()), s(this, E, !1), s(this, b, !1), t(this, c).reset();
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
|
-
f = new WeakMap(), r = new WeakMap(), I = new WeakMap(), E = new WeakMap(), b = new WeakMap(), g = new WeakMap(), B = new WeakMap(), A = new WeakMap(), c = new WeakMap(), O = new WeakMap(), R = new WeakMap(), M = new WeakMap(), P = new WeakMap(), T = new WeakSet(),
|
|
249
|
+
f = new WeakMap(), r = new WeakMap(), I = new WeakMap(), E = new WeakMap(), b = new WeakMap(), g = new WeakMap(), B = new WeakMap(), A = new WeakMap(), c = new WeakMap(), O = new WeakMap(), R = new WeakMap(), M = new WeakMap(), P = new WeakMap(), T = new WeakSet(), _ = function(e) {
|
|
247
250
|
if (clearTimeout(t(this, R)), t(this, r).onloadeddata = null, t(this, r).onload = null, t(this, r).onerror = null, t(this, c).set("loaded", !1), t(this, c).set("error", !1), t(this, c).set("loading", !1), t(this, c).set("clear", !1), t(this, c).set("playing", !1), t(this, c).set("metadata", !1), e) {
|
|
248
251
|
s(this, A, `${t(this, B)}-${e.url}`);
|
|
249
252
|
const h = this.hasAttribute("keep-source-parameters");
|
|
@@ -256,10 +259,10 @@ f = new WeakMap(), r = new WeakMap(), I = new WeakMap(), E = new WeakMap(), b =
|
|
|
256
259
|
};
|
|
257
260
|
} else
|
|
258
261
|
s(this, M, null), this.consumeSource(null);
|
|
259
|
-
}, G = new WeakMap(), D = new WeakMap(), K = new WeakMap(),
|
|
262
|
+
}, G = new WeakMap(), D = new WeakMap(), K = new WeakMap(), H = new WeakMap(), N = new WeakMap(), C = new WeakMap();
|
|
260
263
|
export {
|
|
261
264
|
nt as S,
|
|
262
|
-
|
|
265
|
+
Lt as a,
|
|
263
266
|
et as b,
|
|
264
|
-
|
|
267
|
+
ot as c
|
|
265
268
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var Y=l=>{throw TypeError(l)};var Z=(l,n,e)=>n.has(l)||Y("Cannot "+e);var t=(l,n,e)=>(Z(l,n,"read from private field"),e?e.call(l):n.get(l)),i=(l,n,e)=>n.has(l)?Y("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(l):n.set(l,e),s=(l,n,e,h)=>(Z(l,n,"write to private field"),h?h.call(l,e):n.set(l,e),e),F=(l,n,e)=>(Z(l,n,"access private method"),e);const rt=require("./element-linked-store/index.cjs"),J=require("./loading/index.cjs"),nt=require("./index-CKTweR3M.cjs"),w=require("./events-KVanG9sR.cjs"),tt=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");const at=require("./order/index.cjs"),et=require("./window-resizer/index.cjs"),ht=require("./Store-1JrMCgdX.cjs");var z,b,V,S,m,p,M;class st{constructor(n){i(this,z);i(this,b);i(this,V);i(this,S);i(this,m);i(this,p);i(this,M);s(this,z,n);let e=n.split(".");const h=/\b\d{1,2}x\b/g,a=e.find(y=>y.match(h)&&parseInt(y));s(this,V,a?parseInt(a):1),a&&(e=e.slice(0,-1)),s(this,b,e.length>1?e.slice(0,-1).join("."):e.join("."));const o=/\d+max/g,d=/\d+min/g,N=/\d+mar/g,U=/\d+mir/g,W=e.find(y=>y.match(o)),u=e.find(y=>y.match(d)),x=e.find(y=>y.match(N)),X=e.find(y=>y.match(U));x?(s(this,m,parseInt(x)),s(this,p,"max"),s(this,S,`(max-aspect-ratio: ${t(this,m)})`)):X?(s(this,m,parseInt(X)),s(this,p,"max"),s(this,S,`(min-aspect-ratio: ${t(this,m)})`)):W?(s(this,m,parseInt(W)),s(this,p,"max"),s(this,S,`(max-width: ${t(this,m)}px)`)):u?(s(this,m,parseInt(u)),s(this,S,`(min-width: ${t(this,m)}px)`),s(this,p,"min")):(s(this,m,0),s(this,S,`(min-width: ${t(this,m)}px)`),s(this,p,"min")),s(this,b,t(this,b).replace(`.${t(this,m)}${t(this,p)}`,"")),s(this,M,e[e.length-1]===t(this,b)?"":"."+e[e.length-1]),s(this,M,t(this,M).replace(`.${t(this,m)}${t(this,p)}`,""))}get url(){return t(this,z)}get name(){return t(this,b)}get density(){return t(this,V)}get query(){return t(this,S)}get extension(){return t(this,M)}get queryType(){return t(this,p)}get queryValue(){return t(this,m)}}z=new WeakMap,b=new WeakMap,V=new WeakMap,S=new WeakMap,m=new WeakMap,p=new WeakMap,M=new WeakMap;function ot(l){if(isNaN(l))return"0:00";const n=Math.floor(Math.max(0,l)),e=Math.floor(n/3600),h=Math.floor(n%3600/60),o=(n%60).toString().padStart(2,"0");if(e>0){const d=h.toString().padStart(2,"0");return`${e}:${d}:${o}`}else return`${h}:${o}`}var q;class Q{constructor(n,e){i(this,q);s(this,q,new Map);const h=(e==null?void 0:e.mediaBuckets)!==!1,a=typeof n=="string"?h?n.trim().split(",").map(u=>u.trim()).filter(u=>!!u):[n]:n,o=[];a.forEach(u=>{const x=new st(u);o.push([x.query,x])});const d=o.filter(u=>u[1].queryType.includes("max")).sort((u,x)=>x[1].queryValue-u[1].queryValue),N=o.filter(u=>u[1].queryType.includes("min")&&u[1].queryValue!==0).sort((u,x)=>u[1].queryValue-x[1].queryValue),U=o.filter(u=>u[0]==="(min-width: 0px)");(U?[...U,...d,...N]:[...d,...N]).forEach(u=>{t(this,q).has(u[0])||t(this,q).set(u[0],[]),t(this,q).get(u[0]).push(u[1])})}get mediaBuckets(){return t(this,q)}}q=new WeakMap;var k,$;class it extends ht.Store{constructor(e){super(void 0);i(this,k);i(this,$,()=>{let e;t(this,k).mediaBuckets.forEach((o,d)=>{matchMedia(d).matches&&(e=o)});let h,a=0;e==null||e.forEach(o=>{o.density>a&&o.density<=Math.max(devicePixelRatio,1)&&(a=o.density,h=o)}),e!=null&&e.length&&!h&&(h=e[0]),this.current=h});s(this,k,new Q(e.srcset,e.sourceSetOptions))}updateSource(e){s(this,k,new Q(e.srcset,e.sourceSetOptions)),t(this,$).call(this)}close(){super.close(),this.disconnect()}connect(){et.windowResizer.subscribe(t(this,$),at.RESIZE_ORDER.SOURCE_MANAGER),t(this,$).call(this)}disconnect(){et.windowResizer.unsubscribe(t(this,$))}}k=new WeakMap,$=new WeakMap;let ct=0;var f,r,I,E,L,g,B,A,c,R,O,v,P,T,j,G,_,K,D,H,C;class lt extends HTMLElement{constructor(e){super();i(this,T);i(this,f,null);i(this,r,null);i(this,I,this);i(this,E,!1);i(this,L,!1);i(this,g,!1);i(this,B,"");i(this,A,"");i(this,c,new rt.ElementLinkedStore(this,{loading:!1,loaded:!1,error:!1,clear:!1,playing:!1,metadata:!1}));i(this,R,null);i(this,O);i(this,v,null);i(this,P);i(this,G,e=>{const h=e[0];t(this,g)&&(!t(this,L)||this.hasAttribute("reload-source"))&&h.isIntersecting&&this.triggerLazyLoad(),h.isIntersecting?w.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(F(this,T,j).call(this,void 0),s(this,L,!1)),w.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,_,()=>{t(this,c).set("loaded",!0),t(this,c).set("error",!1),t(this,c).set("loading",!1),!t(this,g)&&!t(this,E)&&J.loading.complete(t(this,A)),w.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,O,setTimeout(()=>{t(this,c).set("clear",!0)},parseFloat(e)*1e3)):t(this,c).set("clear",!0),s(this,E,!0)});i(this,K,e=>{t(this,c).set("loaded",!1),t(this,c).set("error",!0),t(this,c).set("loading",!1),!t(this,g)&&!t(this,E)&&J.loading.error(t(this,A)),w.dispatchEvent(this,"sourceError",{custom:!0}),s(this,E,!0)});i(this,D,()=>{t(this,c).set("playing",!0),w.dispatchEvent(this,"sourcePlay",{custom:!0})});i(this,H,()=>{t(this,c).set("playing",!1),w.dispatchEvent(this,"sourcePause",{custom:!0})});i(this,C,()=>{const e=t(this,r);(e.tagName==="VIDEO"||e.tagName==="AUDIO")&&e.readyState>=1&&(t(this,c).set("metadata",!0),w.dispatchEvent(this,"sourceMetadataLoaded",{custom:!0}),this.querySelectorAll("[data-source-duration]").forEach(h=>{h.textContent=ot(e.duration)}))});s(this,P,e==null?void 0:e.sourceSetOptions),nt.isBrowser&&window.IntersectionObserver&&s(this,R,new IntersectionObserver(t(this,G))),t(this,c).subscribe(h=>{var o;const a=(o=this.getAttribute("data-global-play-class"))==null?void 0:o.split(",");a!=null&&a.length&&(h.current.playing?a.forEach(d=>{document.documentElement.classList.add(d.trim())}):a.forEach(d=>{document.documentElement.classList.remove(d.trim())}))})}get consumerElement(){return t(this,r)}get consumerHolderElement(){return t(this,I)}get sourceManager(){return t(this,f)}get status(){return t(this,c)}get isLazy(){return t(this,g)}get currentURL(){return t(this,v)}get isFirstLoadHappened(){return t(this,E)}triggerLazyLoad(){!t(this,L)&&t(this,f).current&&t(this,f).current!==t(this,f).previous&&(s(this,L,!0),F(this,T,j).call(this,t(this,f).current))}connectedCallback(){s(this,B,`source-consumer-${++ct}`);const e=this.getAttribute("srcset")||"",h=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;h&&t(this,c).addElement(h),s(this,I,this.querySelector("[data-consumer-holder]")||this),this.querySelectorAll(".source-consumer").forEach(a=>a==null?void 0:a.remove()),s(this,r,this.createConsumer()),t(this,r).style.cssText=`
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
`,t(this,r).classList.add("source-consumer"),t(this,r).addEventListener("play",t(this,D)),t(this,r).addEventListener("pause",t(this,H)),t(this,r).addEventListener("loadedmetadata",t(this,C)),t(this,C).call(this),Array.from(this.attributes).forEach(a=>{if(a.name!=="srcset"){const o=a.nodeValue||"",d=tt.kebabToCamel(a.name);d in t(this,r)&&(t(this,r)[d]=o||!0)}});for(const a in this.dataset){const o=this.dataset[a],d=tt.kebabToCamel(a);d in t(this,r)&&(t(this,r)[d]=o?o==="false"?!1:o:!0)}t(this,I).appendChild(t(this,r)),s(this,f,new it({srcset:e,sourceSetOptions:t(this,P)})),s(this,g,this.hasAttribute("lazy")),t(this,f).subscribe(a=>{(!t(this,g)||t(this,g)&&t(this,L))&&F(this,T,j).call(this,a.current)}),t(this,f).connect(),t(this,R).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,O)),t(this,R).disconnect(),(e=t(this,f))==null||e.close(),t(this,r)&&(this.consumeSource(null),t(this,r).removeEventListener("play",t(this,D)),t(this,r).removeEventListener("pause",t(this,H)),t(this,r).removeEventListener("loadedmetadata",t(this,C)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,r).onerror=null,t(this,r).remove()),s(this,E,!1),s(this,L,!1),t(this,c).reset()}}f=new WeakMap,r=new WeakMap,I=new WeakMap,E=new WeakMap,L=new WeakMap,g=new WeakMap,B=new WeakMap,A=new WeakMap,c=new WeakMap,R=new WeakMap,O=new WeakMap,v=new WeakMap,P=new WeakMap,T=new WeakSet,j=function(e){if(clearTimeout(t(this,O)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,c).set("loaded",!1),t(this,c).set("error",!1),t(this,c).set("loading",!1),t(this,c).set("clear",!1),t(this,c).set("playing",!1),t(this,c).set("metadata",!1),e){s(this,A,`${t(this,B)}-${e.url}`);const h=this.hasAttribute("keep-source-parameters");t(this,c).set("loading",!0),s(this,v,h?e.url:e.name+e.extension),this.consumeSource(t(this,v)),!t(this,g)&&!t(this,E)&&J.loading.add(t(this,A)),t(this,r).onloadeddata=()=>{t(this,_).call(this)},t(this,r).onload=()=>{t(this,_).call(this)},t(this,r).onerror=()=>{t(this,K).call(this,t(this,v))}}else s(this,v,null),this.consumeSource(null)},G=new WeakMap,_=new WeakMap,K=new WeakMap,D=new WeakMap,H=new WeakMap,C=new WeakMap;exports.Source=st;exports.SourceElement=lt;exports.SourceManager=it;exports.SourceSet=Q;
|
package/lib/iframe/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var u=r=>{throw TypeError(r)};var a=(r,t,e)=>t.has(r)||u("Cannot "+e);var s=(r,t,e)=>(a(r,t,"read from private field"),e?e.call(r):t.get(r)),o=(r,t,e)=>t.has(r)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(a(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../SourceElement-
|
|
1
|
+
"use strict";var u=r=>{throw TypeError(r)};var a=(r,t,e)=>t.has(r)||u("Cannot "+e);var s=(r,t,e)=>(a(r,t,"read from private field"),e?e.call(r):t.get(r)),o=(r,t,e)=>t.has(r)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(a(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../SourceElement-DMS25FM0.cjs");require("../window-resizer/index.cjs");require("../Store-1JrMCgdX.cjs");const f=require("../index-CKTweR3M.cjs");require("construct-style-sheets-polyfill");var n,l,m;class E extends h.SourceElement{constructor(){super({sourceSetOptions:{mediaBuckets:!1}});o(this,n,null);o(this,l,()=>{var e,i;(i=(e=this.consumerElement).onload)==null||i.call(e,new Event("load"))});o(this,m,()=>{var e,i;(i=(e=this.consumerElement).onload)==null||i.call(e,new Event("error"))})}createConsumer(){return document.createElement("div")}consumeSource(e){s(this,n)&&(s(this,n).onload=null,s(this,n).onerror=null),this.consumerElement.innerHTML=(e==null?void 0:e.replace(/\\u003C/g,"<").replace(/\\u003E/g,">").replace(/\\"/g,'"'))||"",c(this,n,this.consumerElement.querySelector("iframe")),s(this,n)&&(s(this,n).onload=s(this,l),s(this,n).onerror=s(this,m))}}n=new WeakMap,l=new WeakMap,m=new WeakMap;f.isBrowser&&!customElements.get("e-iframe")&&customElements.define("e-iframe",E);exports.IFrameElement=E;
|
package/lib/iframe/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var a = (r) => {
|
|
|
3
3
|
};
|
|
4
4
|
var u = (r, t, e) => t.has(r) || a("Cannot " + e);
|
|
5
5
|
var s = (r, t, e) => (u(r, t, "read from private field"), e ? e.call(r) : t.get(r)), i = (r, t, e) => t.has(r) ? a("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), c = (r, t, e, o) => (u(r, t, "write to private field"), o ? o.call(r, e) : t.set(r, e), e);
|
|
6
|
-
import { a as E } from "../SourceElement-
|
|
6
|
+
import { a as E } from "../SourceElement-BweVAYgJ.js";
|
|
7
7
|
import "../window-resizer/index.js";
|
|
8
8
|
import "../Store-BtVtCGLk.js";
|
|
9
9
|
import { i as f } from "../index-JqYHGoo6.js";
|
package/lib/image/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Viewport-Cx50Hufs.cjs"),i=require("../SourceElement-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Viewport-Cx50Hufs.cjs"),i=require("../SourceElement-DMS25FM0.cjs");require("../window-resizer/index.cjs");require("../Store-1JrMCgdX.cjs");const n=require("../index-CKTweR3M.cjs");require("construct-style-sheets-polyfill");class t extends i.SourceElement{createConsumer(){return document.createElement("img")}consumeSource(e){if(e&&this.hasAttribute("webp")&&s.device.isWebp){const r=e.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=r}else this.consumerElement.src=e||""}}n.isBrowser&&!customElements.get("e-image")&&customElements.define("e-image",t);exports.ImageElement=t;
|
package/lib/image/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as m } from "../Viewport-DbN_JWBM.js";
|
|
2
|
-
import { a as s } from "../SourceElement-
|
|
2
|
+
import { a as s } from "../SourceElement-BweVAYgJ.js";
|
|
3
3
|
import "../window-resizer/index.js";
|
|
4
4
|
import "../Store-BtVtCGLk.js";
|
|
5
5
|
import { i } from "../index-JqYHGoo6.js";
|
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export interface MorphURLParametersChangeEntry {
|
|
|
24
24
|
previousURL: ReturnType<typeof splitPath>;
|
|
25
25
|
detail: any;
|
|
26
26
|
}
|
|
27
|
+
export interface MorphSamePathEntry {
|
|
28
|
+
detail: any;
|
|
29
|
+
}
|
|
27
30
|
export interface MorphPreprocessorEntry extends MorphNavigationEntry {
|
|
28
31
|
resolve: () => void;
|
|
29
32
|
reject: () => void;
|
|
@@ -42,6 +45,7 @@ export interface MorphNavigateOptions {
|
|
|
42
45
|
clearState?: boolean;
|
|
43
46
|
keepScrollPosition?: boolean;
|
|
44
47
|
mergeParams?: boolean;
|
|
48
|
+
removeParams?: string;
|
|
45
49
|
detail?: any;
|
|
46
50
|
}
|
|
47
51
|
export interface MorphScrollDetail {
|
|
@@ -57,7 +61,7 @@ export interface MorphEvents {
|
|
|
57
61
|
morphScroll: CustomEvent<MorphScrollDetail>;
|
|
58
62
|
morphBeforeNavigationScroll: CustomEvent<MorphRouteScrollState>;
|
|
59
63
|
morphURLParametersChange: CustomEvent<MorphURLParametersChangeEntry>;
|
|
60
|
-
morphSamePath: CustomEvent
|
|
64
|
+
morphSamePath: CustomEvent<MorphSamePathEntry>;
|
|
61
65
|
}
|
|
62
66
|
export interface MorphGetRouteOptions {
|
|
63
67
|
searchParameters?: string;
|
|
@@ -81,12 +85,12 @@ export declare class Morph {
|
|
|
81
85
|
get isNavigating(): boolean;
|
|
82
86
|
saveState(state: any): void;
|
|
83
87
|
getState(): any;
|
|
84
|
-
normalizePath(path: string, options?: Pick<MorphNavigateOptions, 'mergeParams'>): import('../utils').SplitPathResult;
|
|
88
|
+
normalizePath(path: string, options?: Pick<MorphNavigateOptions, 'mergeParams' | 'removeParams'>): import('../utils').SplitPathResult;
|
|
85
89
|
prefetch(path: string, revalidate?: boolean): Promise<void>;
|
|
86
90
|
excludeHeadChild(child: Node): boolean;
|
|
87
91
|
setHeaders(path: string): void;
|
|
88
92
|
needRavalidation(path: string): void;
|
|
89
|
-
navigate(path: string, { historyAction, centerScroll, offsetScroll, scrollBehaviour, revalidate, keepSearchParameters, submorph, submorphAppend, clearState, keepScrollPosition, mergeParams, detail, }?: MorphNavigateOptions): Promise<void>;
|
|
93
|
+
navigate(path: string, { historyAction, centerScroll, offsetScroll, scrollBehaviour, revalidate, keepSearchParameters, submorph, submorphAppend, clearState, keepScrollPosition, mergeParams, removeParams, detail, }?: MorphNavigateOptions): Promise<void>;
|
|
90
94
|
addLink(element: HTMLAnchorElement): void;
|
|
91
95
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
92
96
|
removeLink(element: HTMLAnchorElement): void;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ee=Object.defineProperty,ve=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var ee=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ie=h=>{throw TypeError(h)};var se=(h,e,s)=>e in h?Ee(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Tt=(h,e)=>{for(var s in e||(e={}))Le.call(e,s)&&se(h,s,e[s]);if(te)for(var s of te(e))Se.call(e,s)&&se(h,s,e[s]);return h},zt=(h,e)=>ve(h,be(e));var It=(h,e,s)=>e.has(h)||ie("Cannot "+s);var t=(h,e,s)=>(It(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(It(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),g=(h,e,s)=>(It(h,e,"access private method"),s);var Q=(h,e,s)=>new Promise((a,n)=>{var v=c=>{try{d(s.next(c))}catch(b){n(b)}},f=c=>{try{d(s.throw(c))}catch(b){n(b)}},d=c=>c.done?a(c.value):Promise.resolve(c.value).then(v,f);d((s=s.apply(h,e)).next())});var ae=(h,e,s)=>(e=h[ee("asyncIterator")])?e.call(h):(h=h[ee("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=v=>new Promise((f,d,c)=>(v=n.call(h,v),c=v.done,Promise.resolve(v.value).then(b=>f({value:b,done:c}),d)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("../index-CKTweR3M.cjs"),I=require("../events-KVanG9sR.cjs"),ne=require("../scroll-DxcPU0vk.cjs");require("construct-style-sheets-polyfill");const gt=require("../url-C2kASACG.cjs"),he=require("../string-DUXXtU8v.cjs"),ye=require("../math-GDWEqu7y.cjs"),Ae=require("../css-value-parser/index.cjs");class le extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}oe.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",le);var R,i,x,rt,Ut,ce,bt,ot;class Wt{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,bt,e=>{e.preventDefault(),g(this,x,ce).call(this)});l(this,ot,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,rt),e),t(this,i).removeEventListener("pointerenter",t(this,ot))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,bt)),this.checkCurrent(location.href.replace(location.origin,""));const a=g(this,x,Ut).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,ot))}get element(){return t(this,i)}checkCurrent(e){var b,it;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,rt));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(b=t(this,i).getAttribute("data-associated-paths"))!=null&&b.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,v]=(it=t(this,x,rt).split("#")[0])==null?void 0:it.split("?"),f=new URLSearchParams(v),d=new URLSearchParams(location.search);let c=0;for(const[w]of d)f.has(w)&&d.get(w)===f.get(w)&&c++;c?(t(this,i).classList.toggle("all-params-matched",d.size===c),t(this,i).classList.toggle("some-params-matched",d.size!==c)):!d.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const at=he.camelToKebab(w);if(at.startsWith("match-param-")){const M=at.split("match-param-")[1],P=t(this,i).dataset[w],y=`param-${M}-matched`;d.has(M)&&d.get(M)===P||!d.has(M)&&(P===""||P==="*"||P==="all"||P==="any"||P==="vse")?t(this,i).classList.add(y):t(this,i).classList.remove(y)}}}updatePagination(e,s){const a=g(this,x,Ut).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const v=t(this,i).getAttribute("href"),f=new URL(v,window.location.origin);f.searchParams.set("page",(e+1).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),this.checkCurrent(d)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),v=t(this,i).getAttribute("href"),f=new URL(v,window.location.origin),d=e+(n?-1:1);f.searchParams.set("page",ye.clamp(d,1,a.totalPages).toString());const c=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",c),n?d<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):d>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,bt)),t(this,i).removeEventListener("pointerenter",t(this,ot)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,rt=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},Ut=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},ce=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),v=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=v?Ae.cssValueParser.parse(v):void 0,d=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),c=t(this,i).hasAttribute("data-keep-search-parameters"),b=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),it=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(y=>y.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,at=t(this,i).hasAttribute("data-clear-state");let M=t(this,x,rt);if(t(this,i).hasAttribute("data-toggle-params")){const[y,m]=t(this,x,rt).split("?"),J=new URLSearchParams(m),B=new URLSearchParams(location.search),nt=new URLSearchParams;for(const[H]of J)(!B.has(H)||B.has(H)&&B.get(H)!==J.get(H))&&nt.append(H,J.get(H));if(t(this,i).hasAttribute("data-merge-params"))for(const[H]of B)J.has(H)||nt.append(H,B.get(H));M=`${y}?${nt.toString()}`}const P=g(this,x,Ut).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));P&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(y=>{y.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),P.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(y=>{y.updatePagination(P.currentPage-1,P.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(y=>{y.updatePagination(P.currentPage+1,P.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(y=>{y.updatePagination(P.currentPage+1,P.selector)})),t(this,R).navigate(M,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:d,keepSearchParameters:c,submorph:w,clearState:at,keepScrollPosition:b,scrollBehaviour:it,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:!!P||t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},bt=new WeakMap,ot=new WeakMap;var T,ht,Lt,Vt,St;class Pe{constructor(e){l(this,Lt);l(this,T);l(this,ht,[]);l(this,St,()=>{g(this,Lt,Vt).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=he.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],v=t(this,T).dataset[s];t(this,ht).push({name:n,value:v})}}document.addEventListener("morphURLParametersChange",t(this,St)),g(this,Lt,Vt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,St))}}T=new WeakMap,ht=new WeakMap,Lt=new WeakSet,Vt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ht).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ht).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},St=new WeakMap;const ke=new DOMParser;var W,Z,U,V,_,Y,lt,tt,$,yt,ct;class re{constructor(e,s){l(this,W);l(this,Z);l(this,U,{x:0,y:0});l(this,V,null);l(this,_,null);l(this,Y,null);l(this,lt,null);l(this,tt,null);l(this,$,null);l(this,yt);l(this,ct,!1);o(this,W,e),o(this,Z,s)}get pathname(){return t(this,Z)}get scrollState(){return t(this,U)}get document(){return t(this,Y)}needRavalidation(){o(this,ct,!0)}setHeaders(e){o(this,yt,e)}setInitialDocument(e){o(this,V,e.cloneNode(!0))}abort(){var e;return(e=t(this,tt))==null?void 0:e.abort(`[${t(this,Z)}] page loading cancelled`)}fetch(e,s,a){return Q(this,null,function*(){var n;if(!a&&!t(this,ct)){const d=((n=t(this,V))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,V)&&t(this,W).isPopstateNavigation;if(t(this,$)||d||c)return t(this,$)}return o(this,$,new Promise(v=>Q(this,null,function*(){try{o(this,tt,new AbortController);const d=yield(yield fetch(e,{signal:t(this,tt).signal,headers:Tt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,yt))})).text(),c=ke.parseFromString(d,"text/html");this.setInitialDocument(c),o(this,ct,!1)}catch(f){console.warn(f)}finally{o(this,tt,null),o(this,$,null),v()}}))),t(this,$)})}cloneDocument(){o(this,Y,(t(this,_)||t(this,V)).cloneNode(!0))}get title(){let e="";if(t(this,Y).title)e=t(this,Y).title;else{const s=t(this,Y).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,Z)}return e}clearScrollState(){t(this,U).x=0,t(this,U).y=0}clearDocumentState(){o(this,_,null)}saveScrollState(){t(this,V).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,U).x=0,t(this,U).y=0):(t(this,U).x=t(this,W).scrollValue.left,t(this,U).y=t(this,W).scrollValue.top)}restoreScrollPosition(){t(this,W).scrollElement.scroll({top:t(this,U).y,left:t(this,U).x,behavior:"instant"})}saveDocumentState(){t(this,V).documentElement.hasAttribute("data-no-page-restoration")?o(this,_,null):o(this,_,document.cloneNode(!0))}renewScrollPosition(){t(this,W).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,lt,e)}clearState(){const e=t(this,lt);return o(this,lt,null),e}}W=new WeakMap,Z=new WeakMap,U=new WeakMap,V=new WeakMap,_=new WeakMap,Y=new WeakMap,lt=new WeakMap,tt=new WeakMap,$=new WeakMap,yt=new WeakMap,ct=new WeakMap;var z,dt,A,j,E,et,O,G,q,At,F,Pt,st,ut,mt,kt,pt,wt,p,Ft,Ct,Et,Bt,de,Kt,Xt,Yt,$t,Mt,ft;const vt=class vt{constructor(e){l(this,p);l(this,z,null);l(this,dt,null);l(this,A,[]);l(this,j);l(this,E,null);l(this,et);l(this,O,[]);l(this,G,!1);l(this,q,null);l(this,At,!1);l(this,F,new Map);l(this,Pt,[]);l(this,st,null);l(this,ut,0);l(this,mt,0);l(this,kt);l(this,pt);l(this,wt);l(this,Ct,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Mt,e=>Q(this,null,function*(){e.preventDefault(),o(this,G,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,pt)?void 0:t(this,kt),revalidate:t(this,pt),keepScrollPosition:t(this,wt)}),o(this,G,!1)}));l(this,ft,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,mt),n=e-t(this,ut);o(this,mt,s),o(this,ut,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),I.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(oe.isBrowser&&!vt.instance){vt.instance=this,o(this,z,{base:gt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,dt,g(this,p,Bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,E,s);const a=new re(this,t(this,E).pathname);a.setInitialDocument(document),t(this,F).set(t(this,E).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,E).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Mt)),gt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,st,new le),g(this,p,Yt).call(this,document)}}get currentURL(){return t(this,E)}get previousURL(){return t(this,et)}get links(){return t(this,A)}get scrollElement(){return t(this,q)}get isPopstateNavigation(){return t(this,G)}get scrollValue(){let e=0,s=0;return t(this,At)?(e=window.scrollY,s=window.scrollX):(e=t(this,q).scrollTop,s=t(this,q).scrollLeft),{top:e,left:s}}get isNavigating(){return!!t(this,O).length}saveState(e){const s=t(this,F).get(t(this,E).path);s&&s.saveState(e)}getState(){const e=t(this,F).get(t(this,E).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return gt.splitPath(e,{base:t(this,z).base,trailingSlash:t(this,z).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return Q(this,null,function*(){var n;if(t(this,O).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=g(this,p,Et).call(this,e);a==null||a.fetch(e,t(this,E).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=g(this,p,Et).call(this,s.path);a==null||a.needRavalidation()}navigate(P){return Q(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:v,revalidate:f,keepSearchParameters:d,submorph:c,submorphAppend:b,clearState:it,keepScrollPosition:w,mergeParams:at,detail:M}={}){var J,B,nt,H;if(t(this,O).length)return;o(this,kt,c),o(this,pt,f),o(this,wt,w);const y=((J=this.pathnameModifier)==null?void 0:J.call(this,e))||e,m=this.normalizePath(y,{mergeParams:at});if(!f&&(((B=t(this,j))==null?void 0:B.pathname)===m.pathname||t(this,E).pathname===m.pathname)){w||g(this,p,$t).call(this,m.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),I.dispatchEvent(document,"morphSamePath",{custom:!0}),((nt=t(this,E))==null?void 0:nt.parameters)!==m.parameters&&(o(this,et,t(this,E)),o(this,E,m),gt.changeHistory({action:((H=t(this,E))==null?void 0:H.hash)!==m.hash?"replace":s,pathname:m.pathname,searchParameters:m.parameters,hash:m.hash}),I.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,E),previousURL:t(this,et),detail:M}})),t(this,A).forEach(K=>{K.checkCurrent(m.path)});return}else t(this,A).forEach(K=>{K.checkCurrent(m.path)});o(this,j,m);try{let K=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var N;(N=this.preprocessor)==null||N.call(this,{url:m,resolve:r,reject:k,submorph:c,detail:M})})}catch(r){r?console.error(r):console.log("Route change canceled"),K=!1}if(!K||t(this,j).pathname!==m.pathname){t(this,A).forEach(r=>{r.checkCurrent(t(this,E).path)});return}const jt={url:m,submorph:c,detail:M};c?b||c.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,dt).forEach(r=>{var k,N;(k=r.firstElementChild)==null||k.classList.add("out"),(N=r.firstElementChild)==null||N.setAttribute("data-morph-out","")}),I.dispatchEvent(document,"morphNavigation",{detail:jt});const Nt=g(this,p,Et).call(this,t(this,E).pathname),S=g(this,p,Et).call(this,m.pathname);if(t(this,F).forEach(r=>{r.pathname!==m.pathname&&r.abort()}),yield S==null?void 0:S.fetch(y,t(this,E).path,f),t(this,j).pathname!==m.pathname){t(this,A).forEach(r=>{r.checkCurrent(t(this,E).path)});return}Nt.clearState(),Nt.saveScrollState(),Nt.saveDocumentState(),(!t(this,G)||f)&&(S.clearScrollState(),S.clearDocumentState()),it&&S.clearState(),S.cloneDocument(),t(this,st).textContent=S.title,document.body.appendChild(t(this,st));const Rt=zt(Tt({},jt),{document:S.document});b||Rt.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),I.dispatchEvent(document,"morphStart",{detail:Rt});const Gt=Array.from(document.head.children),Jt=Array.from(S.document.head.children),Qt=g(this,p,de).call(this,Gt,Jt),ue=g(this,p,Kt).call(this,Gt,Qt),xt=g(this,p,Kt).call(this,Jt,Qt).filter(r=>!this.excludeHeadChild(r));xt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(xt[k]=g(this,p,Ft).call(this,r))}),xt.forEach(r=>{document.head.appendChild(r)});const qt=xt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(g(this,p,Xt).call(this,r))return!0});t(this,z).waitForHeadToLoad&&qt.length&&(yield new Promise(r=>Q(this,null,function*(){let k=0;try{for(var N=ae(qt),pe,X,D;pe=!(X=yield N.next()).done;pe=!1){const Ht=X.value;Ht.onload=()=>{k++,k===qt.length&&r()}}}catch(X){D=[X]}finally{try{pe&&(X=N.return)&&(yield X.call(N))}finally{if(D)throw D[0]}}}))),yield ne.wait(10);const Zt=[];b||ue.forEach(r=>{r.hasAttribute("data-permanent")||(g(this,p,Xt).call(this,r)?Zt.push(r):r.remove())});const me=g(this,p,Bt).call(this,S.document.body);!t(this,z).morphInsideScrollContainer&&!c&&g(this,p,Yt).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",m.pathname),document.documentElement.setAttribute("data-current-leaf",m.leaf),gt.changeHistory({action:s,pathname:m.pathname,searchParameters:m.parameters||(d?location.search:""),hash:m.hash}),t(this,st).remove(),o(this,et,t(this,E)),o(this,E,m);const Dt=[];t(this,dt).forEach((r,k)=>{const N=me[k],pe=getComputedStyle(r).getPropertyValue("--morph-duration");let X=[],D=[];c?(c.forEach(u=>{const L=r.querySelector(u),C=N.querySelector(u);L&&C&&(D.push(L),X.push(C))}),D.forEach(u=>{u.parentElement&&Dt.push(u.parentElement)})):(X.push(...N.childNodes),D.push(...r.childNodes),Dt.push(r));const Ht=[];b||D.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"),u.querySelectorAll("[data-morph-transfer]").forEach(C=>{const ge=C.getAttribute("data-morph-transfer");Ht.push({element:C,selector:ge})}))}),X.forEach(u=>{u instanceof HTMLElement&&(Ht.forEach(L=>{const C=u.querySelector(L.selector);C&&C.replaceWith(S.document.importNode(L.element,!0))}),this.findNewLinks(u),u.classList.add("new"))}),c?b?X.forEach((u,L)=>{D[L]instanceof HTMLElement&&D[L].append(...u.childNodes)}):X.forEach((u,L)=>{var C;(C=D[L].parentElement)==null||C.insertBefore(u,D[L])}):r.prepend(...X),setTimeout(()=>{b||D.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),X.forEach(u=>{var L;u instanceof HTMLElement&&((L=u.parentElement)==null||L.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})},0);const _t=zt(Tt({},Rt),{morphElement:r});I.dispatchEvent(document,"morphNewChildrenAdded",{detail:_t});const fe=new Promise(u=>{setTimeout(()=>{b||D.forEach(L=>{L.remove()}),X.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),b||I.dispatchEvent(document,"morphOldChildrenRemoved",{detail:_t}),u()},(parseFloat(pe)||0)*1e3+10)});t(this,O).push(fe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-S.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),I.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:S.scrollState}),m.hash?(S.clearScrollState(),g(this,p,$t).call(this,m.hash,{centerScroll:a,offsetScroll:n,behavior:v})):t(this,G)?S.restoreScrollPosition():w||S.renewScrollPosition(),yield Promise.all(t(this,O)),b||Zt.forEach(r=>r.remove()),o(this,O,[]),Dt.forEach(r=>{r.querySelectorAll("script").forEach(N=>{N.replaceWith(g(this,p,Ft).call(this,N))})}),t(this,A).forEach(r=>{r.checkCurrent(t(this,E).path)}),this.findParamsDependent(),I.dispatchEvent(document,"morphComplete",{detail:Rt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(K){console.error(K)}o(this,j,void 0)})}addLink(e){t(this,A).push(new Wt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,A,t(this,A).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,A,t(this,A).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,Ct));t(this,A).push(...s.map(a=>new Wt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,Ct));t(this,A).forEach(s=>s.destroy()),o(this,A,e.map(s=>new Wt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,Pt).forEach(s=>s.destroy()),o(this,Pt,e.map(s=>new Pe(s)))}};z=new WeakMap,dt=new WeakMap,A=new WeakMap,j=new WeakMap,E=new WeakMap,et=new WeakMap,O=new WeakMap,G=new WeakMap,q=new WeakMap,At=new WeakMap,F=new WeakMap,Pt=new WeakMap,st=new WeakMap,ut=new WeakMap,mt=new WeakMap,kt=new WeakMap,pt=new WeakMap,wt=new WeakMap,p=new WeakSet,Ft=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},Ct=new WeakMap,Et=function(e){const s=this.normalizePath(e);let a=t(this,F).get(s.pathname);return a||(a=new re(this,s.pathname),t(this,F).set(s.pathname,a)),a},Bt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},de=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Kt=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Yt=function(e){var s,a;(s=t(this,q))==null||s.removeEventListener("scroll",t(this,ft)),o(this,mt,0),o(this,ut,0),o(this,q,t(this,z).scrollSelector&&e.querySelector(t(this,z).scrollSelector)||window),o(this,At,t(this,q)===window),(a=t(this,q))==null||a.addEventListener("scroll",t(this,ft)),t(this,ft).call(this)},$t=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ne.scrollToElement(a,{scrollElement:t(this,q),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Mt=new WeakMap,ft=new WeakMap,vt.instance=null;let Ot=vt;exports.Morph=Ot;
|
|
1
|
+
"use strict";var Ee=Object.defineProperty,be=Object.defineProperties;var Le=Object.getOwnPropertyDescriptors;var ee=Object.getOwnPropertySymbols;var Se=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var se=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ie=h=>{throw TypeError(h)};var ae=(h,e,s)=>e in h?Ee(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Tt=(h,e)=>{for(var s in e||(e={}))Se.call(e,s)&&ae(h,s,e[s]);if(ee)for(var s of ee(e))ye.call(e,s)&&ae(h,s,e[s]);return h},zt=(h,e)=>be(h,Le(e));var It=(h,e,s)=>e.has(h)||ie("Cannot "+s);var t=(h,e,s)=>(It(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,i)=>(It(h,e,"write to private field"),i?i.call(h,s):e.set(h,s),s),g=(h,e,s)=>(It(h,e,"access private method"),s);var J=(h,e,s)=>new Promise((i,n)=>{var E=c=>{try{u(s.next(c))}catch(b){n(b)}},f=c=>{try{u(s.throw(c))}catch(b){n(b)}},u=c=>c.done?i(c.value):Promise.resolve(c.value).then(E,f);u((s=s.apply(h,e)).next())});var ne=(h,e,s)=>(e=h[se("asyncIterator")])?e.call(h):(h=h[se("iterator")](),e={},s=(i,n)=>(n=h[i])&&(e[i]=E=>new Promise((f,u,c)=>(E=n.call(h,E),c=E.done,Promise.resolve(E.value).then(b=>f({value:b,done:c}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../index-CKTweR3M.cjs"),I=require("../events-KVanG9sR.cjs"),re=require("../scroll-DxcPU0vk.cjs");require("construct-style-sheets-polyfill");const ft=require("../url-BRY7C6vT.cjs"),Pe=require("../css-value-parser/index.cjs"),le=require("../string-DUXXtU8v.cjs"),Ae=require("../math-GDWEqu7y.cjs");class ce extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(e))this.setAttribute(s,i)}}he.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",ce);var R,a,x,nt,Ut,de,Et,rt;class Wt{constructor(e,s){l(this,x);l(this,R);l(this,a);l(this,Et,e=>{e.preventDefault(),g(this,x,de).call(this)});l(this,rt,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,nt),e),t(this,a).removeEventListener("pointerenter",t(this,rt))});o(this,R,s),o(this,a,e),t(this,a).addEventListener("click",t(this,Et)),this.checkCurrent(location.href.replace(location.origin,""));const i=g(this,x,Ut).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link")||t(this,a).getAttribute("data-pagination-next-link")||t(this,a).getAttribute("data-pagination-prev-link"));i&&this.updatePagination(i.currentPage,i.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,rt))}get element(){return t(this,a)}checkCurrent(e){var b,st;const s=t(this,R).normalizePath(e),i=t(this,R).normalizePath(t(this,x,nt));t(this,a).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?t(this,a).classList.add("current"):i.pathname===s.pathname?t(this,a).classList.add("current"):(b=t(this,a).getAttribute("data-associated-paths"))!=null&&b.split(",").find(k=>s.pathname.includes(k))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),s.path===i.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact");const[n,E]=(st=t(this,x,nt).split("#")[0])==null?void 0:st.split("?"),f=new URLSearchParams(E),u=new URLSearchParams(location.search);let c=0;for(const[k]of u)f.has(k)&&u.get(k)===f.get(k)&&c++;c?(t(this,a).classList.toggle("all-params-matched",u.size===c),t(this,a).classList.toggle("some-params-matched",u.size!==c)):!u.size&&t(this,a).hasAttribute("data-match-no-params")?t(this,a).classList.add("all-params-matched"):(t(this,a).classList.remove("all-params-matched"),t(this,a).classList.remove("some-params-matched"));for(const k in t(this,a).dataset){const at=le.camelToKebab(k);if(at.startsWith("match-param-")){const z=at.split("match-param-")[1],L=t(this,a).dataset[k],w=`param-${z}-matched`;u.has(z)&&u.get(z)===L||!u.has(z)&&(L===""||L==="*"||L==="all"||L==="any"||L==="vse")?t(this,a).classList.add(w):t(this,a).classList.remove(w)}}}updatePagination(e,s){const i=g(this,x,Ut).call(this,s);if(i)if(i.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<i.totalPages){t(this,a).style.display="";const n=t(this,a).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(i.totalPages-e).toString());const E=t(this,a).getAttribute("href"),f=new URL(E,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,a).setAttribute("href",u),this.checkCurrent(u)}else t(this,a).style.display="none";else if(t(this,a).hasAttribute("data-pagination-prev-link")||t(this,a).hasAttribute("data-pagination-next-link")){const n=t(this,a).hasAttribute("data-pagination-prev-link"),E=t(this,a).getAttribute("href"),f=new URL(E,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Ae.clamp(u,1,i.totalPages).toString());const c=f.href.replace(f.origin,"").toString();t(this,a).setAttribute("href",c),n?u<1?(t(this,a).classList.add("pagination-disabled"),t(this,a).setAttribute("tabindex","-1")):(t(this,a).classList.remove("pagination-disabled"),t(this,a).removeAttribute("tabindex")):u>i.totalPages?(t(this,a).classList.add("pagination-disabled"),t(this,a).setAttribute("tabindex","-1")):(t(this,a).classList.remove("pagination-disabled"),t(this,a).removeAttribute("tabindex"))}else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,Et)),t(this,a).removeEventListener("pointerenter",t(this,rt)),t(this,a).classList.remove("current","exact","pagination-current")}}R=new WeakMap,a=new WeakMap,x=new WeakSet,nt=function(){const e=new URL(t(this,a).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},Ut=function(e){if(!e)return;const s=document.querySelector(e);if(s){const i=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:i,totalPages:n,selector:e}}},de=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const i=t(this,a).getAttribute("data-history-action")||"push",n=t(this,a).hasAttribute("data-center-scroll"),E=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),f=E?Pe.cssValueParser.parse(E):void 0,u=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link")||t(this,a).hasAttribute("data-pagination-next-link")||t(this,a).hasAttribute("data-pagination-prev-link"),c=t(this,a).hasAttribute("data-keep-search-parameters"),b=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),st=t(this,a).getAttribute("data-scroll-behaviour"),k=((s=t(this,a).getAttribute("data-submorph"))==null?void 0:s.split(",").map(w=>w.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||t(this,a).hasAttribute("data-pagination-next-link")&&[t(this,a).getAttribute("data-pagination-next-link")]||t(this,a).hasAttribute("data-pagination-prev-link")&&[t(this,a).getAttribute("data-pagination-prev-link")]||void 0,at=t(this,a).hasAttribute("data-clear-state");let z=t(this,x,nt);if(t(this,a).hasAttribute("data-toggle-params")){const[w,Ct]=t(this,x,nt).split("?"),d=new URLSearchParams(Ct),B=new URLSearchParams(location.search),it=new URLSearchParams;for(const[H]of d)(!B.has(H)||B.has(H)&&B.get(H)!==d.get(H))&&it.append(H,d.get(H));if(t(this,a).hasAttribute("data-merge-params"))for(const[H]of B)d.has(H)||it.append(H,B.get(H));z=`${w}?${it.toString()}`}const L=g(this,x,Ut).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link")||t(this,a).getAttribute("data-pagination-next-link")||t(this,a).getAttribute("data-pagination-prev-link"));L&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(w=>{w.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),L.selector)}):t(this,a).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(w=>{w.updatePagination(L.currentPage-1,L.selector)}):t(this,a).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(w=>{w.updatePagination(L.currentPage+1,L.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(w=>{w.updatePagination(L.currentPage+1,L.selector)})),t(this,R).navigate(z,{historyAction:i,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:c,submorph:k,clearState:at,keepScrollPosition:b,scrollBehaviour:st,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link"),mergeParams:!!L||t(this,a).hasAttribute("data-merge-params")&&!t(this,a).hasAttribute("data-toggle-params"),detail:t(this,a).getAttribute("data-detail"),removeParams:t(this,a).getAttribute("data-remove-params")||void 0})}},Et=new WeakMap,rt=new WeakMap;var T,ot,bt,Vt,Lt;class ke{constructor(e){l(this,bt);l(this,T);l(this,ot,[]);l(this,Lt,()=>{g(this,bt,Vt).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const i=le.camelToKebab(s);if(i.startsWith("param-")){const n=i.split("param-")[1],E=t(this,T).dataset[s];t(this,ot).push({name:n,value:E})}}document.addEventListener("morphURLParametersChange",t(this,Lt)),g(this,bt,Vt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Lt))}}T=new WeakMap,ot=new WeakMap,bt=new WeakSet,Vt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ot).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ot).filter(n=>e.has(n.name)).length);const i=t(this,T).getAttribute("data-hide-class");s?i?t(this,T).classList.remove(i):t(this,T).style.display="":i?t(this,T).classList.add(i):t(this,T).style.display="none"},Lt=new WeakMap;const we=new DOMParser;var W,Q,U,V,Z,Y,ht,_,$,St,lt;class oe{constructor(e,s){l(this,W);l(this,Q);l(this,U,{x:0,y:0});l(this,V,null);l(this,Z,null);l(this,Y,null);l(this,ht,null);l(this,_,null);l(this,$,null);l(this,St);l(this,lt,!1);o(this,W,e),o(this,Q,s)}get pathname(){return t(this,Q)}get scrollState(){return t(this,U)}get document(){return t(this,Y)}needRavalidation(){o(this,lt,!0)}setHeaders(e){o(this,St,e)}setInitialDocument(e){o(this,V,e.cloneNode(!0))}abort(){var e;return(e=t(this,_))==null?void 0:e.abort(`[${t(this,Q)}] page loading cancelled`)}fetch(e,s,i){return J(this,null,function*(){var n;if(!i&&!t(this,lt)){const u=((n=t(this,V))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,V)&&t(this,W).isPopstateNavigation;if(t(this,$)||u||c)return t(this,$)}return o(this,$,new Promise(E=>J(this,null,function*(){try{o(this,_,new AbortController);const u=yield(yield fetch(e,{signal:t(this,_).signal,headers:Tt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,St))})).text(),c=we.parseFromString(u,"text/html");this.setInitialDocument(c),o(this,lt,!1)}catch(f){console.warn(f)}finally{o(this,_,null),o(this,$,null),E()}}))),t(this,$)})}cloneDocument(){o(this,Y,(t(this,Z)||t(this,V)).cloneNode(!0))}get title(){let e="";if(t(this,Y).title)e=t(this,Y).title;else{const s=t(this,Y).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,Q)}return e}clearScrollState(){t(this,U).x=0,t(this,U).y=0}clearDocumentState(){o(this,Z,null)}saveScrollState(){t(this,V).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,U).x=0,t(this,U).y=0):(t(this,U).x=t(this,W).scrollValue.left,t(this,U).y=t(this,W).scrollValue.top)}restoreScrollPosition(){t(this,W).scrollElement.scroll({top:t(this,U).y,left:t(this,U).x,behavior:"instant"})}saveDocumentState(){t(this,V).documentElement.hasAttribute("data-no-page-restoration")?o(this,Z,null):o(this,Z,document.cloneNode(!0))}renewScrollPosition(){t(this,W).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,ht,e)}clearState(){const e=t(this,ht);return o(this,ht,null),e}}W=new WeakMap,Q=new WeakMap,U=new WeakMap,V=new WeakMap,Z=new WeakMap,Y=new WeakMap,ht=new WeakMap,_=new WeakMap,$=new WeakMap,St=new WeakMap,lt=new WeakMap;var D,ct,P,j,v,tt,O,G,N,yt,F,Pt,et,dt,ut,At,mt,kt,p,Ft,wt,gt,Bt,ue,Kt,Xt,Yt,$t,Mt,pt;const vt=class vt{constructor(e){l(this,p);l(this,D,null);l(this,ct,null);l(this,P,[]);l(this,j);l(this,v,null);l(this,tt);l(this,O,[]);l(this,G,!1);l(this,N,null);l(this,yt,!1);l(this,F,new Map);l(this,Pt,[]);l(this,et,null);l(this,dt,0);l(this,ut,0);l(this,At);l(this,mt);l(this,kt);l(this,wt,e=>{var s,i;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((i=e.getAttribute("href"))==null?void 0:i.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Mt,e=>J(this,null,function*(){e.preventDefault(),o(this,G,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,mt)?void 0:t(this,At),revalidate:t(this,mt),keepScrollPosition:t(this,kt)}),o(this,G,!1)}));l(this,pt,()=>{const{left:e,top:s}=this.scrollValue,i=s-t(this,ut),n=e-t(this,dt);o(this,ut,s),o(this,dt,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),I.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(he.isBrowser&&!vt.instance){vt.instance=this,o(this,D,{base:ft.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,ct,g(this,p,Bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,v,s);const i=new oe(this,t(this,v).pathname);i.setInitialDocument(document),t(this,F).set(t(this,v).pathname,i),document.documentElement.setAttribute("data-current-pathname",t(this,v).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Mt)),ft.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,et,new ce),g(this,p,Yt).call(this,document)}}get currentURL(){return t(this,v)}get previousURL(){return t(this,tt)}get links(){return t(this,P)}get scrollElement(){return t(this,N)}get isPopstateNavigation(){return t(this,G)}get scrollValue(){let e=0,s=0;return t(this,yt)?(e=window.scrollY,s=window.scrollX):(e=t(this,N).scrollTop,s=t(this,N).scrollLeft),{top:e,left:s}}get isNavigating(){return!!t(this,O).length}saveState(e){const s=t(this,F).get(t(this,v).path);s&&s.saveState(e)}getState(){const e=t(this,F).get(t(this,v).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return ft.splitPath(e,{base:t(this,D).base,trailingSlash:t(this,D).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:"",removeParams:s==null?void 0:s.removeParams})}prefetch(e,s){return J(this,null,function*(){var n;if(t(this,O).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const i=g(this,p,gt).call(this,e);i==null||i.fetch(e,t(this,v).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),i=g(this,p,gt).call(this,s.path);i==null||i.needRavalidation()}navigate(w){return J(this,arguments,function*(e,{historyAction:s="push",centerScroll:i,offsetScroll:n,scrollBehaviour:E,revalidate:f,keepSearchParameters:u,submorph:c,submorphAppend:b,clearState:st,keepScrollPosition:k,mergeParams:at,removeParams:z,detail:L}={}){var B,it,H,jt;if(t(this,O).length)return;o(this,At,c),o(this,mt,f),o(this,kt,k);const Ct=((B=this.pathnameModifier)==null?void 0:B.call(this,e))||e,d=this.normalizePath(Ct,{mergeParams:at,removeParams:z});if(!f&&(((it=t(this,j))==null?void 0:it.pathname)===d.pathname||t(this,v).pathname===d.pathname)){k||g(this,p,$t).call(this,d.hash||0,{centerScroll:i,offsetScroll:n,behavior:"smooth"}),I.dispatchEvent(document,"morphSamePath",{detail:{detail:L}}),((H=t(this,v))==null?void 0:H.parameters)!==d.parameters&&(o(this,tt,t(this,v)),o(this,v,d),ft.changeHistory({action:((jt=t(this,v))==null?void 0:jt.hash)!==d.hash?"replace":s,pathname:d.pathname,searchParameters:d.parameters,hash:d.hash}),I.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,v),previousURL:t(this,tt),detail:L}})),t(this,P).forEach(K=>{K.checkCurrent(d.path)});return}else t(this,P).forEach(K=>{K.checkCurrent(d.path)});o(this,j,d);try{let K=!0;if(this.preprocessor)try{yield new Promise((r,A)=>{var M;(M=this.preprocessor)==null||M.call(this,{url:d,resolve:r,reject:A,submorph:c,detail:L})})}catch(r){r?console.error(r):console.log("Route change canceled"),K=!1}if(!K||t(this,j).pathname!==d.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,v).path)});return}const Gt={url:d,submorph:c,detail:L};c?b||c.forEach(r=>{document.querySelectorAll(r).forEach(A=>{A.classList.add("out"),A.setAttribute("data-morph-out","")})}):t(this,ct).forEach(r=>{var A,M;(A=r.firstElementChild)==null||A.classList.add("out"),(M=r.firstElementChild)==null||M.setAttribute("data-morph-out","")}),I.dispatchEvent(document,"morphNavigation",{detail:Gt});const Nt=g(this,p,gt).call(this,t(this,v).pathname),y=g(this,p,gt).call(this,d.pathname);if(t(this,F).forEach(r=>{r.pathname!==d.pathname&&r.abort()}),yield y==null?void 0:y.fetch(Ct,t(this,v).path,f),t(this,j).pathname!==d.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,v).path)});return}Nt.clearState(),Nt.saveScrollState(),Nt.saveDocumentState(),(!t(this,G)||f)&&(y.clearScrollState(),y.clearDocumentState()),st&&y.clearState(),y.cloneDocument(),t(this,et).textContent=y.title,document.body.appendChild(t(this,et));const Rt=zt(Tt({},Gt),{document:y.document});b||Rt.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),I.dispatchEvent(document,"morphStart",{detail:Rt});const Jt=Array.from(document.head.children),Qt=Array.from(y.document.head.children),Zt=g(this,p,ue).call(this,Jt,Qt),me=g(this,p,Kt).call(this,Jt,Zt),xt=g(this,p,Kt).call(this,Qt,Zt).filter(r=>!this.excludeHeadChild(r));xt.forEach((r,A)=>{r.tagName==="SCRIPT"&&(xt[A]=g(this,p,Ft).call(this,r))}),xt.forEach(r=>{document.head.appendChild(r)});const qt=xt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(g(this,p,Xt).call(this,r))return!0});t(this,D).waitForHeadToLoad&&qt.length&&(yield new Promise(r=>J(this,null,function*(){let A=0;try{for(var M=ne(qt),fe,X,q;fe=!(X=yield M.next()).done;fe=!1){const Ht=X.value;Ht.onload=()=>{A++,A===qt.length&&r()}}}catch(X){q=[X]}finally{try{fe&&(X=M.return)&&(yield X.call(M))}finally{if(q)throw q[0]}}}))),yield re.wait(10);const _t=[];b||me.forEach(r=>{r.hasAttribute("data-permanent")||(g(this,p,Xt).call(this,r)?_t.push(r):r.remove())});const pe=g(this,p,Bt).call(this,y.document.body);!t(this,D).morphInsideScrollContainer&&!c&&g(this,p,Yt).call(this,y.document),document.documentElement.setAttribute("data-current-pathname",d.pathname),document.documentElement.setAttribute("data-current-leaf",d.leaf),ft.changeHistory({action:s,pathname:d.pathname,searchParameters:d.parameters||(u?location.search:""),hash:d.hash}),t(this,et).remove(),o(this,tt,t(this,v)),o(this,v,d);const Dt=[];t(this,ct).forEach((r,A)=>{const M=pe[A],fe=getComputedStyle(r).getPropertyValue("--morph-duration");let X=[],q=[];c?(c.forEach(m=>{const S=r.querySelector(m),C=M.querySelector(m);S&&C&&(q.push(S),X.push(C))}),q.forEach(m=>{m.parentElement&&Dt.push(m.parentElement)})):(X.push(...M.childNodes),q.push(...r.childNodes),Dt.push(r));const Ht=[];b||q.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const ve=C.getAttribute("data-morph-transfer");Ht.push({element:C,selector:ve})}))}),X.forEach(m=>{m instanceof HTMLElement&&(Ht.forEach(S=>{const C=m.querySelector(S.selector);C&&C.replaceWith(y.document.importNode(S.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),c?b?X.forEach((m,S)=>{q[S]instanceof HTMLElement&&q[S].append(...m.childNodes)}):X.forEach((m,S)=>{var C;(C=q[S].parentElement)==null||C.insertBefore(m,q[S])}):r.prepend(...X),setTimeout(()=>{b||q.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),X.forEach(m=>{var S;m instanceof HTMLElement&&((S=m.parentElement)==null||S.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const te=zt(Tt({},Rt),{morphElement:r});I.dispatchEvent(document,"morphNewChildrenAdded",{detail:te});const ge=new Promise(m=>{setTimeout(()=>{b||q.forEach(S=>{S.remove()}),X.forEach(S=>{var C;S instanceof HTMLElement&&((C=S.parentElement)==null||C.style.removeProperty("--new-content-height"),S.classList.remove("new-idle","new"))}),b||I.dispatchEvent(document,"morphOldChildrenRemoved",{detail:te}),m()},(parseFloat(fe)||0)*1e3+10)});t(this,O).push(ge)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-y.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),I.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:y.scrollState}),d.hash?(y.clearScrollState(),g(this,p,$t).call(this,d.hash,{centerScroll:i,offsetScroll:n,behavior:E})):t(this,G)?y.restoreScrollPosition():k||y.renewScrollPosition(),yield Promise.all(t(this,O)),b||_t.forEach(r=>r.remove()),o(this,O,[]),Dt.forEach(r=>{r.querySelectorAll("script").forEach(M=>{M.replaceWith(g(this,p,Ft).call(this,M))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,v).path)}),this.findParamsDependent(),I.dispatchEvent(document,"morphComplete",{detail:Rt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(K){console.error(K)}o(this,j,void 0)})}addLink(e){t(this,P).push(new Wt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,wt));t(this,P).push(...s.map(i=>new Wt(i,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,wt));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new Wt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,Pt).forEach(s=>s.destroy()),o(this,Pt,e.map(s=>new ke(s)))}};D=new WeakMap,ct=new WeakMap,P=new WeakMap,j=new WeakMap,v=new WeakMap,tt=new WeakMap,O=new WeakMap,G=new WeakMap,N=new WeakMap,yt=new WeakMap,F=new WeakMap,Pt=new WeakMap,et=new WeakMap,dt=new WeakMap,ut=new WeakMap,At=new WeakMap,mt=new WeakMap,kt=new WeakMap,p=new WeakSet,Ft=function(e){const s=document.createElement("script");for(let i=0;i<e.attributes.length;i++){const n=e.attributes[i];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},wt=new WeakMap,gt=function(e){const s=this.normalizePath(e);let i=t(this,F).get(s.pathname);return i||(i=new oe(this,s.pathname),t(this,F).set(s.pathname,i)),i},Bt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ue=function(e,s){return e.filter(i=>s.find(n=>n.outerHTML===i.outerHTML))},Kt=function(e,s){return e.filter(i=>!s.find(n=>n.outerHTML===i.outerHTML))},Xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Yt=function(e){var s,i;(s=t(this,N))==null||s.removeEventListener("scroll",t(this,pt)),o(this,ut,0),o(this,dt,0),o(this,N,t(this,D).scrollSelector&&e.querySelector(t(this,D).scrollSelector)||window),o(this,yt,t(this,N)===window),(i=t(this,N))==null||i.addEventListener("scroll",t(this,pt)),t(this,pt).call(this)},$t=function(e,s){const i=typeof e=="string"?document.getElementById(e):e;(typeof i=="number"||i)&&re.scrollToElement(i,{scrollElement:t(this,N),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Mt=new WeakMap,pt=new WeakMap,vt.instance=null;let Ot=vt;exports.Morph=Ot;
|