aptechka 0.44.2 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/lib/{Animation-Je56LXXj.js → Animation-CKBO5DMV.js} +4 -3
  2. package/lib/Animation-CwizHYX9.cjs +1 -0
  3. package/lib/{Damped-BMmEn7PH.js → Damped-CucKOQsI.js} +5 -4
  4. package/lib/Damped-DbaLw6w1.cjs +1 -0
  5. package/lib/{Tweened-BNCj14Jz.js → Tweened-CcPeZ0UE.js} +7 -6
  6. package/lib/Tweened-Dm6Avip9.cjs +1 -0
  7. package/lib/animation/index.cjs +1 -1
  8. package/lib/animation/index.js +3 -3
  9. package/lib/controls/index.cjs +1 -1
  10. package/lib/controls/index.js +2 -2
  11. package/lib/morph/Morph.d.ts +14 -27
  12. package/lib/morph/MorphRoute.d.ts +23 -0
  13. package/lib/morph/index.cjs +1 -1
  14. package/lib/morph/index.d.ts +1 -1
  15. package/lib/morph/index.js +329 -306
  16. package/lib/need_redo_tweaker/index.cjs +3 -3
  17. package/lib/need_redo_tweaker/index.js +61 -60
  18. package/lib/number-0243DApo.cjs +1 -0
  19. package/lib/number-DwCxt_Ck.js +33 -0
  20. package/lib/pointer/index.cjs +1 -1
  21. package/lib/pointer/index.js +1 -1
  22. package/lib/polyfills-DJrTJQky.js +24 -0
  23. package/lib/polyfills-Df4r-ETT.cjs +1 -0
  24. package/lib/scroll/index.cjs +1 -1
  25. package/lib/scroll/index.js +33 -33
  26. package/lib/scroll-DNUlcfbO.js +22 -0
  27. package/lib/scroll-DPDSZypW.cjs +1 -0
  28. package/lib/scroll-segment/index.cjs +1 -1
  29. package/lib/scroll-segment/index.js +1 -1
  30. package/lib/utils/index.cjs +1 -1
  31. package/lib/utils/index.js +158 -172
  32. package/lib/utils/polyfills.d.ts +1 -0
  33. package/lib/utils/scroll.d.ts +2 -1
  34. package/package.json +1 -1
  35. package/lib/Animation-D1lL_XhF.cjs +0 -1
  36. package/lib/Damped-BbJjFOLH.cjs +0 -1
  37. package/lib/Tweened-Dk1UNPSH.cjs +0 -1
  38. package/lib/polyfills-BANSrI_m.cjs +0 -1
  39. package/lib/polyfills-CxfUK5OU.js +0 -37
@@ -1,368 +1,391 @@
1
- var vt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), Et = (r) => {
2
- throw TypeError(r);
1
+ var mt = (i, t) => (t = Symbol[i]) ? t : Symbol.for("Symbol." + i), ft = (i) => {
2
+ throw TypeError(i);
3
3
  };
4
- var rt = (r, e, s) => e.has(r) || Et("Cannot " + s);
5
- var t = (r, e, s) => (rt(r, e, "read from private field"), s ? s.call(r) : e.get(r)), o = (r, e, s) => e.has(r) ? Et("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), a = (r, e, s, n) => (rt(r, e, "write to private field"), n ? n.call(r, s) : e.set(r, s), s), A = (r, e, s) => (rt(r, e, "access private method"), s);
6
- var O = (r, e, s) => new Promise((n, c) => {
7
- var d = (f) => {
4
+ var _ = (i, t, s) => t.has(i) || ft("Cannot " + s);
5
+ var e = (i, t, s) => (_(i, t, "read from private field"), s ? s.call(i) : t.get(i)), r = (i, t, s) => t.has(i) ? ft("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), a = (i, t, s, o) => (_(i, t, "write to private field"), o ? o.call(i, s) : t.set(i, s), s), d = (i, t, s) => (_(i, t, "access private method"), s);
6
+ var M = (i, t, s) => new Promise((o, u) => {
7
+ var m = (l) => {
8
8
  try {
9
- p(s.next(f));
10
- } catch (C) {
11
- c(C);
9
+ A(s.next(l));
10
+ } catch (g) {
11
+ u(g);
12
12
  }
13
- }, b = (f) => {
13
+ }, V = (l) => {
14
14
  try {
15
- p(s.throw(f));
16
- } catch (C) {
17
- c(C);
15
+ A(s.throw(l));
16
+ } catch (g) {
17
+ u(g);
18
18
  }
19
- }, p = (f) => f.done ? n(f.value) : Promise.resolve(f.value).then(d, b);
20
- p((s = s.apply(r, e)).next());
19
+ }, A = (l) => l.done ? o(l.value) : Promise.resolve(l.value).then(m, V);
20
+ A((s = s.apply(i, t)).next());
21
21
  });
22
- var St = (r, e, s) => (e = r[vt("asyncIterator")]) ? e.call(r) : (r = r[vt("iterator")](), e = {}, s = (n, c) => (c = r[n]) && (e[n] = (d) => new Promise((b, p, f) => (d = c.call(r, d), f = d.done, Promise.resolve(d.value).then((C) => b({ value: C, done: f }), p)))), s("next"), s("return"), e);
23
- import { loading as wt } from "../loading/index.js";
24
- import { i as At } from "../index-euf5anj6.js";
25
- import { d as st } from "../events-CsVF98U6.js";
26
- import { n as Dt, c as bt, s as zt } from "../url-CfcHdBT6.js";
27
- import { f as Rt } from "../dom-CVWzyXPH.js";
28
- var M, h, L, _, v, B, W, Y, j, x, K, D;
29
- class yt {
30
- constructor(e, s) {
31
- o(this, M);
32
- o(this, h);
33
- o(this, L);
34
- o(this, _);
35
- o(this, v, null);
36
- o(this, B, !1);
37
- o(this, W, !1);
38
- o(this, Y, !1);
39
- o(this, j);
40
- o(this, x);
41
- o(this, K, (e) => {
42
- e.preventDefault(), t(this, M).links.forEach((n) => {
43
- var c;
44
- t(this, L) === t(n, L) || (c = t(n, x)) != null && c.includes(t(this, L)) ? t(n, h).classList.add("clicked") : t(n, h).classList.remove("clicked");
45
- });
46
- let s;
47
- t(this, v) && (s = {
48
- x: t(this, v).scrollLeft,
49
- y: t(this, v).scrollTop,
50
- selector: t(this, v).id ? "#" + t(this, v).id : ""
51
- }), t(this, M).navigate(t(this, L), {
52
- historyAction: t(this, _),
53
- state: t(this, j),
54
- saveScrollState: s,
55
- saveDocumentState: t(this, B),
56
- restoreDocumentState: t(this, Y),
57
- restoreScrollState: t(this, W)
22
+ var pt = (i, t, s) => (t = i[mt("asyncIterator")]) ? t.call(i) : (i = i[mt("iterator")](), t = {}, s = (o, u) => (u = i[o]) && (t[o] = (m) => new Promise((V, A, l) => (m = u.call(i, m), l = m.done, Promise.resolve(m.value).then((g) => V({ value: g, done: l }), A)))), s("next"), s("return"), t);
23
+ import { d as Q } from "../events-CsVF98U6.js";
24
+ import { r as Mt } from "../polyfills-DJrTJQky.js";
25
+ import { s as Tt } from "../scroll-DNUlcfbO.js";
26
+ import "../index-euf5anj6.js";
27
+ import { n as Ct, c as Et, s as Ht } from "../url-CfcHdBT6.js";
28
+ import { cssValueParser as kt } from "../css-value-parser/index.js";
29
+ class St extends HTMLElement {
30
+ connectedCallback() {
31
+ const t = {
32
+ "aria-live": "assertive",
33
+ "aria-atomic": "true",
34
+ 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"
35
+ };
36
+ for (const [s, o] of Object.entries(t))
37
+ this.setAttribute(s, o);
38
+ }
39
+ }
40
+ customElements.get("morph-announcer") || customElements.define("morph-announcer", St);
41
+ var R, c, T, W, z;
42
+ class gt {
43
+ constructor(t, s) {
44
+ r(this, R);
45
+ r(this, c);
46
+ r(this, T);
47
+ r(this, W, (t) => {
48
+ t.preventDefault();
49
+ const s = e(this, c).getAttribute(
50
+ "data-history-action"
51
+ ) || "push", o = e(this, c).hasAttribute("data-center-scroll"), u = getComputedStyle(e(this, c)).getPropertyValue("--offset-scroll").trim(), m = u ? kt.parse(u) : void 0, V = e(this, c).hasAttribute("data-revalidate");
52
+ e(this, R).navigate(e(this, T), {
53
+ historyAction: s,
54
+ centerScroll: o,
55
+ offsetScroll: m,
56
+ revalidate: V
58
57
  });
59
58
  });
60
- o(this, D, () => {
61
- t(this, M).prefetch(t(this, L)), t(this, h).removeEventListener("pointerenter", t(this, D));
59
+ r(this, z, () => {
60
+ e(this, R).prefetch(e(this, T)), e(this, c).removeEventListener("pointerenter", e(this, z));
62
61
  });
63
- var b, p;
64
- a(this, M, s), a(this, h, e), a(this, L, t(this, h).getAttribute("href") || "/"), a(this, _, t(this, h).getAttribute(
65
- "data-history-action"
66
- ) || "push");
67
- const n = t(this, h).getAttribute(
68
- "data-save-scroll-state"
69
- );
70
- typeof n == "string" && (n === "" ? a(this, v, Rt(t(this, h))) : a(this, v, document.getElementById(n))), a(this, B, t(this, h).hasAttribute(
71
- "data-save-document-state"
72
- )), a(this, Y, t(this, h).hasAttribute(
73
- "data-restore-document-state"
74
- )), a(this, W, t(this, h).hasAttribute(
75
- "data-restore-scroll-state"
76
- )), a(this, j, t(this, h).getAttribute("data-state") || void 0), t(this, h).addEventListener("click", t(this, K));
77
- const c = s.normalizePath(t(this, L)), d = s.normalizePath(location.pathname);
78
- a(this, x, (b = t(this, h).getAttribute("data-match-paths")) == null ? void 0 : b.split(",").map((f) => s.normalizePath(f.trim()).pathname)), t(this, h).hasAttribute("data-include") ? d.pathname.includes(c.pathname) && t(this, h).classList.add("current") : c.pathname === d.pathname || (p = t(this, x)) != null && p.includes(d.pathname) ? (t(this, h).classList.add("current"), t(this, h).classList.add("clicked")) : t(this, h).classList.remove("clicked"), t(this, h).hasAttribute("data-prefetch") && t(this, h).addEventListener("pointerenter", t(this, D));
62
+ a(this, R, s), a(this, c, t), a(this, T, e(this, c).getAttribute("href") || "/"), e(this, c).addEventListener("click", e(this, W));
63
+ const o = s.normalizePath(e(this, T)), u = s.normalizePath(location.pathname);
64
+ e(this, c).hasAttribute("data-include") && u.pathname.includes(o.pathname) ? e(this, c).classList.add("current") : o.pathname === u.pathname && e(this, c).classList.add("current"), e(this, c).hasAttribute("data-prefetch") && e(this, c).addEventListener("pointerenter", e(this, z));
79
65
  }
80
66
  get element() {
81
- return t(this, h);
67
+ return e(this, c);
82
68
  }
83
69
  destroy() {
84
- t(this, h).removeEventListener("click", t(this, K)), t(this, h).removeEventListener("pointerenter", t(this, D)), t(this, h).classList.remove("current");
70
+ e(this, c).removeEventListener("click", e(this, W)), e(this, c).removeEventListener("pointerenter", e(this, z)), e(this, c).classList.remove("current");
85
71
  }
86
72
  }
87
- M = new WeakMap(), h = new WeakMap(), L = new WeakMap(), _ = new WeakMap(), v = new WeakMap(), B = new WeakMap(), W = new WeakMap(), Y = new WeakMap(), j = new WeakMap(), x = new WeakMap(), K = new WeakMap(), D = new WeakMap();
88
- class Pt extends HTMLElement {
89
- connectedCallback() {
90
- const e = {
91
- "aria-live": "assertive",
92
- "aria-atomic": "true",
93
- 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"
94
- };
95
- for (const [s, n] of Object.entries(e))
96
- this.setAttribute(s, n);
73
+ R = new WeakMap(), c = new WeakMap(), T = new WeakMap(), W = new WeakMap(), z = new WeakMap();
74
+ var C, q, p, H, k, w;
75
+ class Lt {
76
+ constructor(t, s, o) {
77
+ r(this, C);
78
+ r(this, q);
79
+ r(this, p, { x: 0, y: 0 });
80
+ r(this, H);
81
+ r(this, k, null);
82
+ r(this, w, null);
83
+ a(this, C, t), a(this, q, s), a(this, H, o.cloneNode(!0));
84
+ }
85
+ get pathname() {
86
+ return e(this, q);
87
+ }
88
+ get scrollState() {
89
+ return e(this, p);
90
+ }
91
+ get document() {
92
+ return e(this, w);
93
+ }
94
+ cloneDocument() {
95
+ a(this, w, (e(this, k) || e(this, H)).cloneNode(!0));
96
+ }
97
+ get title() {
98
+ let t = "";
99
+ if (e(this, w).title)
100
+ t = e(this, w).title;
101
+ else {
102
+ const s = e(this, w).querySelector("h1");
103
+ t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, q);
104
+ }
105
+ return t;
106
+ }
107
+ clearScrollState() {
108
+ e(this, p).x = 0, e(this, p).y = 0;
109
+ }
110
+ clearDocumentState() {
111
+ a(this, k, null);
112
+ }
113
+ saveScrollState() {
114
+ e(this, H).documentElement.hasAttribute(
115
+ "data-no-scroll-restoration"
116
+ ) ? (e(this, p).x = 0, e(this, p).y = 0) : (e(this, p).x = e(this, C).scrollElement.scrollLeft, e(this, p).y = e(this, C).scrollElement.scrollTop);
117
+ }
118
+ saveDocumentState() {
119
+ e(this, H).documentElement.hasAttribute(
120
+ "data-no-page-restoration"
121
+ ) ? a(this, k, null) : a(this, k, document.cloneNode(!0));
122
+ }
123
+ restoreScrollPosition() {
124
+ e(this, C).scrollElement.scroll({
125
+ top: e(this, p).y,
126
+ left: e(this, p).x
127
+ });
97
128
  }
98
129
  }
99
- At && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Pt);
100
- var V, G, J, Q, z, S, it, k, P, E, U, X, H, w, R, I, T, m, ot, ht, Tt, ct, nt;
101
- class Yt {
102
- constructor(e) {
103
- o(this, m);
104
- o(this, V, null);
105
- o(this, G, null);
106
- o(this, J, null);
107
- o(this, Q, !1);
108
- o(this, z, null);
109
- o(this, S, []);
110
- o(this, it, new DOMParser());
111
- o(this, k, /* @__PURE__ */ new Map());
112
- o(this, P);
113
- o(this, E, null);
114
- o(this, U);
115
- o(this, X);
116
- o(this, H, []);
117
- o(this, w);
118
- o(this, R);
119
- o(this, I, !1);
120
- o(this, T, null);
121
- o(this, nt, (e) => {
130
+ C = new WeakMap(), q = new WeakMap(), p = new WeakMap(), H = new WeakMap(), k = new WeakMap(), w = new WeakMap();
131
+ var b, B, L, U, P, f, j, x, N, F, I, D, h, $, tt, et, vt, st, it, nt, X;
132
+ class It {
133
+ constructor(t) {
134
+ r(this, h);
135
+ r(this, b);
136
+ r(this, B, null);
137
+ r(this, L, []);
138
+ r(this, U, new DOMParser());
139
+ r(this, P);
140
+ r(this, f, null);
141
+ r(this, j);
142
+ r(this, x, []);
143
+ r(this, N, !1);
144
+ r(this, F, null);
145
+ r(this, I, /* @__PURE__ */ new Map());
146
+ r(this, D, null);
147
+ r(this, X, (t) => M(this, null, function* () {
122
148
  var s;
123
- (s = e.state) != null && s.path && (a(this, I, !0), this.navigate(e.state.path, { historyAction: "none" }), a(this, I, !1));
124
- });
125
- if (At) {
126
- a(this, V, Dt(e == null ? void 0 : e.base)), a(this, G, (e == null ? void 0 : e.waitForHeadToLoad) !== !1), a(this, J, (e == null ? void 0 : e.cachePages) !== !1), a(this, Q, (e == null ? void 0 : e.trailingSlash) || !1), a(this, z, A(this, m, ht).call(this, document.body));
127
- const s = this.normalizePath(
128
- location.pathname + location.hash
129
- );
130
- a(this, E, s.pathname), document.documentElement.setAttribute(
131
- "data-current-pathname",
132
- t(this, E)
133
- ), document.documentElement.setAttribute(
134
- "data-current-leaf",
135
- s.leaf
136
- ), this.findLinks(), addEventListener("popstate", t(this, nt)), bt({
137
- action: "replace",
138
- pathname: t(this, E),
139
- searchParameters: s.parameters,
140
- hash: s.hash
141
- }), t(this, z).map((n) => [...n.children]).flat().forEach((n) => {
142
- n instanceof HTMLElement && n.classList.add("current");
143
- }), a(this, T, new Pt());
144
- }
149
+ (s = t.state) != null && s.path && (a(this, N, !0), yield this.navigate(t.state.path, { historyAction: "none" }), a(this, N, !1));
150
+ }));
151
+ a(this, b, {
152
+ base: Ct(t == null ? void 0 : t.base),
153
+ waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
154
+ cachePages: (t == null ? void 0 : t.cachePages) !== !1,
155
+ trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
156
+ scrollSelector: (t == null ? void 0 : t.scrollSelector) || "body"
157
+ }), a(this, B, d(this, h, et).call(this, document.body));
158
+ const s = this.normalizePath(location.pathname + location.hash);
159
+ a(this, f, s.pathname), e(this, I).set(
160
+ e(this, f),
161
+ new Lt(this, e(this, f), document)
162
+ ), document.documentElement.setAttribute(
163
+ "data-current-pathname",
164
+ e(this, f)
165
+ ), document.documentElement.setAttribute(
166
+ "data-current-leaf",
167
+ s.leaf
168
+ ), this.findLinks(), addEventListener("popstate", e(this, X)), Et({
169
+ action: "replace",
170
+ pathname: e(this, f),
171
+ searchParameters: s.parameters,
172
+ hash: s.hash
173
+ }), a(this, D, new St()), d(this, h, nt).call(this);
145
174
  }
146
175
  get currentPathname() {
147
- return t(this, E);
176
+ return e(this, f);
148
177
  }
149
178
  get previousPathname() {
150
- return t(this, U);
151
- }
152
- get currentState() {
153
- return t(this, X);
179
+ return e(this, j);
154
180
  }
155
181
  get links() {
156
- return t(this, S);
182
+ return e(this, L);
183
+ }
184
+ get scrollElement() {
185
+ return e(this, F);
157
186
  }
158
- normalizePath(e) {
159
- return zt(e, {
160
- base: t(this, V),
161
- trailingSlash: t(this, Q)
187
+ normalizePath(t) {
188
+ return Ht(t, {
189
+ base: e(this, b).base,
190
+ trailingSlash: e(this, b).trailingSlash
162
191
  });
163
192
  }
164
- prefetch(e) {
165
- return O(this, null, function* () {
166
- const s = this.normalizePath(e);
167
- return A(this, m, ot).call(this, s.pathname);
193
+ prefetch(t) {
194
+ return M(this, null, function* () {
195
+ const s = this.normalizePath(t);
196
+ d(this, h, tt).call(this, s.pathname);
168
197
  });
169
198
  }
170
- navigate(f) {
171
- return O(this, arguments, function* (e, {
199
+ navigate(V) {
200
+ return M(this, arguments, function* (t, {
172
201
  historyAction: s = "push",
173
- state: n,
174
- saveScrollState: c,
175
- saveDocumentState: d,
176
- restoreDocumentState: b,
177
- restoreScrollState: p
202
+ centerScroll: o,
203
+ offsetScroll: u,
204
+ revalidate: m
178
205
  } = {}) {
179
- var lt;
180
- if (t(this, H).length)
181
- return;
182
- t(this, I) || (b || a(this, R, void 0), p || a(this, w, void 0));
183
- const C = this.normalizePath(e);
184
- let { pathname: l, hash: Ct, parameters: Mt, leaf: kt } = C;
185
- if (t(this, P) === l || t(this, E) === l)
206
+ if (e(this, x).length)
186
207
  return;
187
- a(this, X, n), a(this, P, l);
188
- const Z = t(this, k).has(l);
189
- try {
190
- wt.add("__morph");
191
- let $ = !0;
192
- if (this.preprocessor)
193
- try {
194
- yield new Promise((i, g) => {
195
- var y;
196
- (y = this.preprocessor) == null || y.call(this, { pathname: l, resolve: i, reject: g, isCached: Z, state: n });
197
- });
198
- } catch (i) {
199
- i ? console.error(i) : console.log("Route change canceled"), $ = !1;
200
- }
201
- if (!$ || t(this, P) !== l)
202
- return;
203
- const N = (t(this, R) || t(this, k).get(l) || (yield A(this, m, ot).call(this, l))).cloneNode(!0);
204
- if (t(this, P) !== l)
205
- return;
206
- if (a(this, R, d ? document.cloneNode(!0) : void 0), N.title)
207
- t(this, T).textContent = N.title;
208
- else {
209
- const i = N.querySelector("h1"), g = (i == null ? void 0 : i.innerText) || (i == null ? void 0 : i.textContent) || l;
210
- t(this, T).textContent = g;
211
- }
212
- document.body.appendChild(t(this, T));
213
- const dt = {
214
- pathname: l,
215
- isCached: Z,
216
- state: n,
217
- newDocument: N
218
- };
219
- st(document, "morphStart", {
220
- detail: dt
221
- });
222
- const ut = Array.from(document.head.children), mt = Array.from(
223
- N.head.children
224
- ), ft = A(this, m, Tt).call(this, ut, mt), Ht = A(this, m, ct).call(this, ut, ft), tt = A(this, m, ct).call(this, mt, ft);
225
- tt.forEach((i, g) => {
226
- if (i.tagName === "SCRIPT" && i.getAttribute("src")) {
227
- const y = document.createElement("script");
228
- y.type = "module", y.src = i.getAttribute("src"), tt[g] = y;
229
- }
230
- }), tt.forEach((i) => {
231
- document.head.appendChild(i);
232
- });
233
- const at = tt.filter(
234
- (i) => !i.hasAttribute("data-no-waiting") && (i.tagName === "STYLE" || i.tagName === "SCRIPT" || i.tagName === "LINK") && i.getAttribute("rel") !== "canonical"
235
- );
236
- t(this, G) && at.length && (yield new Promise((i) => O(this, null, function* () {
237
- let g = 0;
238
- try {
239
- for (var y = St(at), gt, q, Lt; gt = !(q = yield y.next()).done; gt = !1) {
240
- const et = q.value;
241
- et.onload = () => {
242
- g++, g === at.length && i();
243
- };
208
+ const A = this.normalizePath(t);
209
+ let { pathname: l, hash: g, parameters: yt, leaf: wt } = A;
210
+ if (!(e(this, P) === l || e(this, f) === l)) {
211
+ a(this, P, l);
212
+ try {
213
+ let K = !0;
214
+ if (this.preprocessor)
215
+ try {
216
+ yield new Promise((n, v) => {
217
+ var y;
218
+ (y = this.preprocessor) == null || y.call(this, {
219
+ pathname: l,
220
+ resolve: n,
221
+ reject: v
222
+ });
223
+ });
224
+ } catch (n) {
225
+ n ? console.error(n) : console.log("Route change canceled"), K = !1;
244
226
  }
245
- } catch (q) {
246
- Lt = [q];
247
- } finally {
227
+ if (!K || e(this, P) !== l)
228
+ return;
229
+ const ot = yield d(this, h, $).call(this, e(this, f)), S = yield d(this, h, $).call(this, l, m);
230
+ if (e(this, P) !== l)
231
+ return;
232
+ ot.saveScrollState(), ot.saveDocumentState(), e(this, N) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), e(this, D).textContent = S.title, document.body.appendChild(e(this, D));
233
+ const rt = {
234
+ pathname: l
235
+ };
236
+ Q(document, "morphStart", {
237
+ detail: rt
238
+ });
239
+ const at = Array.from(document.head.children), lt = Array.from(S.document.head.children), ht = d(this, h, vt).call(this, at, lt), bt = d(this, h, st).call(this, at, ht), Y = d(this, h, st).call(this, lt, ht);
240
+ Y.forEach((n, v) => {
241
+ if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
242
+ const y = document.createElement("script");
243
+ y.type = "module", y.src = n.getAttribute("src"), Y[v] = y;
244
+ }
245
+ }), Y.forEach((n) => {
246
+ document.head.appendChild(n);
247
+ });
248
+ const Z = Y.filter((n) => {
249
+ if (n.hasAttribute("data-no-waiting"))
250
+ return !1;
251
+ if (d(this, h, it).call(this, n))
252
+ return !0;
253
+ });
254
+ e(this, b).waitForHeadToLoad && Z.length && (yield new Promise((n) => M(this, null, function* () {
255
+ let v = 0;
248
256
  try {
249
- gt && (q = y.return) && (yield q.call(y));
257
+ for (var y = pt(Z), ut, O, dt; ut = !(O = yield y.next()).done; ut = !1) {
258
+ const G = O.value;
259
+ G.onload = () => {
260
+ v++, v === Z.length && n();
261
+ };
262
+ }
263
+ } catch (O) {
264
+ dt = [O];
250
265
  } finally {
251
- if (Lt)
252
- throw Lt[0];
266
+ try {
267
+ ut && (O = y.return) && (yield O.call(y));
268
+ } finally {
269
+ if (dt)
270
+ throw dt[0];
271
+ }
253
272
  }
254
- }
255
- })));
256
- const pt = [];
257
- Ht.forEach((i) => {
258
- i.hasAttribute("data-permanent") || (i.tagName === "SCRIPT" || i.tagName === "STYLE" || i.getAttribute("rel") === "stylesheet" ? pt.push(i) : i.remove());
259
- }), a(this, U, t(this, E)), a(this, E, l), bt({
260
- action: s,
261
- pathname: l,
262
- searchParameters: Mt,
263
- hash: Ct
264
- });
265
- const Nt = A(this, m, ht).call(this, N.body);
266
- t(this, z).forEach((i, g) => {
267
- const y = Nt[g++], gt = getComputedStyle(i).getPropertyValue("--morph-duration"), q = [...y.childNodes];
268
- if (gt) {
269
- const Lt = [...i.childNodes];
270
- if (Lt.forEach((u) => {
271
- u instanceof HTMLElement && u.classList.add("old");
272
- }), q.forEach((u) => {
273
- u instanceof HTMLElement && (u.classList.remove("current"), u.classList.add("new"));
274
- }), i.prepend(...q), t(this, w)) {
275
- const u = document.querySelector(
276
- t(this, w).selector
277
- );
278
- u && u.scroll({
279
- top: t(this, w).y,
280
- left: t(this, w).x,
281
- behavior: "auto"
273
+ })));
274
+ const ct = [];
275
+ bt.forEach((n) => {
276
+ n.hasAttribute("data-permanent") || (d(this, h, it).call(this, n) ? ct.push(n) : n.remove());
277
+ });
278
+ const Pt = d(this, h, et).call(this, S.document.body);
279
+ if (e(this, B).forEach((n, v) => {
280
+ const y = Pt[v], ut = getComputedStyle(n).getPropertyValue("--morph-duration"), O = [...y.childNodes];
281
+ if (ut) {
282
+ const dt = [...n.childNodes];
283
+ dt.forEach((E) => {
284
+ E instanceof HTMLElement && E.classList.add("old");
285
+ }), O.forEach((E) => {
286
+ E instanceof HTMLElement && E.classList.add("new");
287
+ }), n.prepend(...O), Mt(() => {
288
+ O.forEach((E) => {
289
+ E instanceof HTMLElement && E.classList.add("in");
290
+ });
282
291
  });
283
- }
284
- setTimeout(() => {
285
- q.forEach((u) => {
286
- u instanceof HTMLElement && u.classList.add("in");
292
+ const G = {
293
+ morphElement: n,
294
+ pathname: l
295
+ };
296
+ Q(document, "morphNewChildrenAdded", {
297
+ detail: G
287
298
  });
288
- }, 10);
289
- const et = {
290
- morphElement: i,
291
- pathname: l,
292
- isCached: Z,
293
- state: n
294
- };
295
- st(document, "morphNewChildrenAdded", {
296
- detail: et
297
- });
298
- const xt = new Promise((u) => {
299
- setTimeout(() => {
300
- Lt.forEach((F) => F.remove()), q.forEach((F) => {
301
- F instanceof HTMLElement && (F.classList.remove("new", "in"), F.classList.add("current"));
302
- }), st(document, "morphOldChildrenRemoved", {
303
- detail: et
304
- }), u();
305
- }, (parseFloat(gt) || 0) * 1e3 + 10);
299
+ const At = new Promise((E) => {
300
+ setTimeout(() => {
301
+ dt.forEach((J) => J.remove()), O.forEach((J) => {
302
+ J instanceof HTMLElement && J.classList.remove("in", "new");
303
+ }), Q(document, "morphOldChildrenRemoved", {
304
+ detail: G
305
+ }), E();
306
+ }, (parseFloat(ut) || 0) * 1e3 + 10);
307
+ });
308
+ e(this, x).push(At);
309
+ } else
310
+ n.innerHTML = "", n.append(...O);
311
+ }), d(this, h, nt).call(this), g) {
312
+ S.clearScrollState();
313
+ const n = document.getElementById(g);
314
+ n instanceof HTMLElement && Tt(n, {
315
+ scrollElement: e(this, F),
316
+ behaviour: "instant",
317
+ center: o,
318
+ offset: u
306
319
  });
307
- t(this, H).push(xt);
308
- } else
309
- i.innerHTML = "", i.append(...q);
310
- }), yield Promise.all(t(this, H)), pt.forEach((i) => i.remove()), a(this, H, []), a(this, w, c), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", l), document.documentElement.setAttribute("data-current-leaf", kt), t(this, T).remove(), (lt = this.postprocessor) == null || lt.call(this, { pathname: l, isCached: Z, state: n }), st(document, "morphComplete", {
311
- detail: dt
312
- }), wt.complete("__morph");
313
- } catch ($) {
314
- console.error($);
320
+ } else e(this, N) && S.restoreScrollPosition();
321
+ yield Promise.all(e(this, x)), ct.forEach((n) => n.remove()), a(this, j, e(this, f)), a(this, f, l), a(this, x, []), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", l), document.documentElement.setAttribute("data-current-leaf", wt), e(this, D).remove(), Et({
322
+ action: s,
323
+ pathname: l,
324
+ searchParameters: yt,
325
+ hash: g
326
+ }), Q(document, "morphComplete", {
327
+ detail: rt
328
+ });
329
+ } catch (K) {
330
+ console.error(K);
331
+ }
332
+ a(this, P, void 0);
315
333
  }
316
- a(this, P, void 0);
317
334
  });
318
335
  }
319
- addLink(e) {
320
- t(this, S).push(new yt(e, this));
336
+ addLink(t) {
337
+ e(this, L).push(new gt(t, this));
321
338
  }
322
- addLinks(e) {
323
- e.forEach((s) => {
339
+ addLinks(t) {
340
+ t.forEach((s) => {
324
341
  this.addLink(s);
325
342
  });
326
343
  }
327
- removeLink(e) {
328
- a(this, S, t(this, S).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
344
+ removeLink(t) {
345
+ a(this, L, e(this, L).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
329
346
  }
330
347
  findLinks() {
331
- const e = [
348
+ const t = [
332
349
  ...document.documentElement.querySelectorAll("a")
333
350
  ].filter(
334
351
  (s) => {
335
- var n;
336
- return ((n = s.getAttribute("href")) == null ? void 0 : n.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
352
+ var o;
353
+ return ((o = s.getAttribute("href")) == null ? void 0 : o.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
337
354
  }
338
355
  );
339
- t(this, S).forEach((s) => s.destroy()), a(this, S, e.map((s) => new yt(s, this)));
356
+ e(this, L).forEach((s) => s.destroy()), a(this, L, t.map((s) => new gt(s, this)));
340
357
  }
341
358
  }
342
- V = new WeakMap(), G = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), z = new WeakMap(), S = new WeakMap(), it = new WeakMap(), k = new WeakMap(), P = new WeakMap(), E = new WeakMap(), U = new WeakMap(), X = new WeakMap(), H = new WeakMap(), w = new WeakMap(), R = new WeakMap(), I = new WeakMap(), T = new WeakMap(), m = new WeakSet(), ot = function(e) {
343
- return O(this, null, function* () {
344
- const s = t(this, k).get(e);
345
- if (s)
346
- return s;
347
- const c = yield (yield fetch(e)).text(), d = t(this, it).parseFromString(c, "text/html");
348
- return t(this, J) && t(this, k).set(e, d), d;
359
+ b = new WeakMap(), B = new WeakMap(), L = new WeakMap(), U = new WeakMap(), P = new WeakMap(), f = new WeakMap(), j = new WeakMap(), x = new WeakMap(), N = new WeakMap(), F = new WeakMap(), I = new WeakMap(), D = new WeakMap(), h = new WeakSet(), $ = function(t, s = !1) {
360
+ return M(this, null, function* () {
361
+ let o = e(this, I).get(t);
362
+ return (!o || s) && (o = yield d(this, h, tt).call(this, t)), o;
363
+ });
364
+ }, tt = function(t) {
365
+ return M(this, null, function* () {
366
+ const o = yield (yield fetch(t)).text(), u = e(this, U).parseFromString(o, "text/html"), m = new Lt(this, t, u);
367
+ return e(this, I).set(t, m), m;
349
368
  });
350
- }, ht = function(e) {
351
- const s = [...e.querySelectorAll("[data-morph]")];
352
- return s.length ? s : [e];
353
- }, Tt = function(e, s) {
354
- return e.filter(
355
- (n) => s.find(
356
- (c) => c.outerHTML === n.outerHTML
369
+ }, et = function(t) {
370
+ const s = [...t.querySelectorAll("[data-morph]")];
371
+ return s.length ? s : [t];
372
+ }, vt = function(t, s) {
373
+ return t.filter(
374
+ (o) => s.find(
375
+ (u) => u.outerHTML === o.outerHTML
357
376
  )
358
377
  );
359
- }, ct = function(e, s) {
360
- return e.filter(
361
- (n) => !s.find(
362
- (c) => c.outerHTML === n.outerHTML
378
+ }, st = function(t, s) {
379
+ return t.filter(
380
+ (o) => !s.find(
381
+ (u) => u.outerHTML === o.outerHTML
363
382
  )
364
383
  );
365
- }, nt = new WeakMap();
384
+ }, it = function(t) {
385
+ return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
386
+ }, nt = function() {
387
+ a(this, F, document.querySelector(e(this, b).scrollSelector) || document.documentElement);
388
+ }, X = new WeakMap();
366
389
  export {
367
- Yt as Morph
390
+ It as Morph
368
391
  };