aptechka 0.67.3 → 0.68.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.
@@ -1,231 +1,221 @@
1
- var xt = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Mt = (a) => {
1
+ var At = (a, e) => (e = Symbol[a]) ? e : Symbol.for("Symbol." + a), kt = (a) => {
2
2
  throw TypeError(a);
3
3
  };
4
- var gt = (a, t, s) => t.has(a) || Mt("Cannot " + s);
5
- var e = (a, t, s) => (gt(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ? Mt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), r = (a, t, s, i) => (gt(a, t, "write to private field"), i ? i.call(a, s) : t.set(a, s), s), p = (a, t, s) => (gt(a, t, "access private method"), s);
6
- var F = (a, t, s) => new Promise((i, c) => {
4
+ var ft = (a, e, s) => e.has(a) || kt("Cannot " + s);
5
+ var t = (a, e, s) => (ft(a, e, "read from private field"), s ? s.call(a) : e.get(a)), o = (a, e, s) => e.has(a) ? kt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, s), r = (a, e, s, i) => (ft(a, e, "write to private field"), i ? i.call(a, s) : e.set(a, s), s), p = (a, e, s) => (ft(a, e, "access private method"), s);
6
+ var W = (a, e, s) => new Promise((i, u) => {
7
7
  var y = (E) => {
8
8
  try {
9
9
  w(s.next(E));
10
- } catch (z) {
11
- c(z);
10
+ } catch (F) {
11
+ u(F);
12
12
  }
13
13
  }, M = (E) => {
14
14
  try {
15
15
  w(s.throw(E));
16
- } catch (z) {
17
- c(z);
16
+ } catch (F) {
17
+ u(F);
18
18
  }
19
19
  }, w = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(y, M);
20
- w((s = s.apply(a, t)).next());
20
+ w((s = s.apply(a, e)).next());
21
21
  });
22
- var Nt = (a, t, s) => (t = a[xt("asyncIterator")]) ? t.call(a) : (a = a[xt("iterator")](), t = {}, s = (i, c) => (c = a[i]) && (t[i] = (y) => new Promise((M, w, E) => (y = c.call(a, y), E = y.done, Promise.resolve(y.value).then((z) => M({ value: z, done: E }), w)))), s("next"), s("return"), t);
23
- import { i as Rt } from "../index-Bv9zgfdb.js";
24
- import { d as O } from "../events-CsVF98U6.js";
25
- import { r as Wt } from "../polyfills-DJrTJQky.js";
26
- import { w as Yt, s as Xt } from "../scroll-DPkCFTxg.js";
22
+ var Ct = (a, e, s) => (e = a[At("asyncIterator")]) ? e.call(a) : (a = a[At("iterator")](), e = {}, s = (i, u) => (u = a[i]) && (e[i] = (y) => new Promise((M, w, E) => (y = u.call(a, y), E = y.done, Promise.resolve(y.value).then((F) => M({ value: F, done: E }), w)))), s("next"), s("return"), e);
23
+ import { i as Mt } from "../index-Bv9zgfdb.js";
24
+ import { d as Y } from "../events-CsVF98U6.js";
25
+ import { r as qt } from "../polyfills-DJrTJQky.js";
26
+ import { w as zt, s as Bt } from "../scroll-DPkCFTxg.js";
27
27
  import "construct-style-sheets-polyfill";
28
- import { n as $t, c as Ht, s as Ut } from "../url-Cc-RVfii.js";
29
- import { cssValueParser as jt } from "../css-value-parser/index.js";
30
- class Vt extends HTMLElement {
28
+ import { n as Ft, c as Tt, s as Ot } from "../url-Cb0SFRMc.js";
29
+ import { cssValueParser as Wt } from "../css-value-parser/index.js";
30
+ class Ht extends HTMLElement {
31
31
  connectedCallback() {
32
- const t = {
32
+ const e = {
33
33
  "aria-live": "assertive",
34
34
  "aria-atomic": "true",
35
35
  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"
36
36
  };
37
- for (const [s, i] of Object.entries(t))
37
+ for (const [s, i] of Object.entries(e))
38
38
  this.setAttribute(s, i);
39
39
  }
40
40
  }
41
- Rt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Vt);
42
- var k, l, H, it, K;
43
- class Et {
44
- constructor(t, s) {
45
- o(this, k);
41
+ Mt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Ht);
42
+ var C, l, I, st, $;
43
+ class pt {
44
+ constructor(e, s) {
45
+ o(this, C);
46
46
  o(this, l);
47
- o(this, H);
48
- o(this, it, (t) => {
47
+ o(this, I);
48
+ o(this, st, (e) => {
49
49
  var i;
50
- if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, k).previousPathname)
50
+ if (e.preventDefault(), t(this, l).hasAttribute("data-back") && t(this, C).previousPathname)
51
51
  history.back();
52
52
  else {
53
- r(this, H, e(this, l).getAttribute("href") || "/");
54
- const c = e(this, l).getAttribute(
53
+ r(this, I, t(this, l).getAttribute("href") || "/");
54
+ const u = t(this, l).getAttribute(
55
55
  "data-history-action"
56
- ) || "push", y = e(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ? jt.parse(M) : void 0, E = e(this, l).hasAttribute("data-revalidate"), z = e(this, l).hasAttribute(
56
+ ) || "push", y = t(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(t(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ? Wt.parse(M) : void 0, E = t(this, l).hasAttribute("data-revalidate"), F = t(this, l).hasAttribute(
57
57
  "data-keep-search-parameters"
58
- ), dt = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map(($) => $.trim()), m = e(this, l).hasAttribute("data-clear-state");
59
- e(this, k).navigate(e(this, H), {
60
- historyAction: c,
58
+ ), c = (i = t(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((H) => H.trim()), ot = t(this, l).hasAttribute("data-clear-state");
59
+ t(this, C).navigate(t(this, I), {
60
+ historyAction: u,
61
61
  centerScroll: y,
62
62
  offsetScroll: w,
63
63
  revalidate: E,
64
- keepSearchParameters: z,
65
- submorph: dt,
66
- clearState: m
64
+ keepSearchParameters: F,
65
+ submorph: c,
66
+ clearState: ot
67
67
  });
68
68
  }
69
69
  });
70
- o(this, K, () => {
71
- const t = e(this, l).hasAttribute("data-revalidate");
72
- e(this, k).prefetch(e(this, H), t), e(this, l).removeEventListener("pointerenter", e(this, K));
70
+ o(this, $, () => {
71
+ const e = t(this, l).hasAttribute("data-revalidate");
72
+ t(this, C).prefetch(t(this, I), e), t(this, l).removeEventListener("pointerenter", t(this, $));
73
73
  });
74
- r(this, k, s), r(this, l, t), r(this, H, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, it)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, K));
74
+ r(this, C, s), r(this, l, e), r(this, I, t(this, l).getAttribute("href") || "/"), t(this, l).addEventListener("click", t(this, st)), this.checkCurrent(location.pathname), t(this, l).hasAttribute("data-prefetch") && t(this, l).addEventListener("pointerenter", t(this, $));
75
75
  }
76
76
  get element() {
77
- return e(this, l);
77
+ return t(this, l);
78
78
  }
79
- checkCurrent(t) {
80
- const s = e(this, k).normalizePath(t), i = e(this, k).normalizePath(e(this, H));
81
- e(this, l).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, l).classList.add("current") : i.pathname === s.pathname ? e(this, l).classList.add("current") : e(this, l).classList.remove("current");
79
+ checkCurrent(e) {
80
+ const s = t(this, C).normalizePath(e), i = t(this, C).normalizePath(t(this, I));
81
+ t(this, l).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? t(this, l).classList.add("current") : i.pathname === s.pathname ? t(this, l).classList.add("current") : t(this, l).classList.remove("current");
82
82
  }
83
83
  destroy() {
84
- e(this, l).removeEventListener("click", e(this, it)), e(this, l).removeEventListener("pointerenter", e(this, K)), e(this, l).classList.remove("current");
84
+ t(this, l).removeEventListener("click", t(this, st)), t(this, l).removeEventListener("pointerenter", t(this, $)), t(this, l).classList.remove("current");
85
85
  }
86
86
  }
87
- k = new WeakMap(), l = new WeakMap(), H = new WeakMap(), it = new WeakMap(), K = new WeakMap();
88
- const Kt = new DOMParser();
89
- var D, G, rt, b, C, W, I, J, Y, R;
90
- class Dt {
91
- constructor(t, s, i) {
92
- o(this, D);
93
- o(this, G);
94
- o(this, rt);
87
+ C = new WeakMap(), l = new WeakMap(), I = new WeakMap(), st = new WeakMap(), $ = new WeakMap();
88
+ const Yt = new DOMParser();
89
+ var T, R, b, P, X, V, G, U, q;
90
+ class xt {
91
+ constructor(e, s) {
92
+ o(this, T);
93
+ o(this, R);
95
94
  o(this, b, { x: 0, y: 0 });
96
- o(this, C, null);
97
- o(this, W, null);
98
- o(this, I, null);
99
- o(this, J, null);
100
- o(this, Y, null);
101
- o(this, R, null);
102
- r(this, D, t), r(this, G, s), r(this, rt, i);
103
- }
104
- get pathname() {
105
- return e(this, G);
95
+ o(this, P, null);
96
+ o(this, X, null);
97
+ o(this, V, null);
98
+ o(this, G, null);
99
+ o(this, U, null);
100
+ o(this, q, null);
101
+ r(this, T, e), r(this, R, s);
106
102
  }
107
- get searchParameters() {
108
- return e(this, rt);
103
+ get path() {
104
+ return t(this, R);
109
105
  }
110
106
  get scrollState() {
111
- return e(this, b);
107
+ return t(this, b);
112
108
  }
113
109
  get document() {
114
- return e(this, I);
110
+ return t(this, V);
115
111
  }
116
- setInitialDocument(t) {
117
- r(this, C, t.cloneNode(!0));
112
+ setInitialDocument(e) {
113
+ r(this, P, e.cloneNode(!0));
118
114
  }
119
115
  abort() {
120
- var t;
121
- return (t = e(this, Y)) == null ? void 0 : t.abort(
122
- `[${this.pathname}] page loading cancelled`
116
+ var e;
117
+ return (e = t(this, U)) == null ? void 0 : e.abort(
118
+ `[${t(this, R)}] page loading cancelled`
123
119
  );
124
120
  }
125
- fetch(t) {
126
- return F(this, null, function* () {
127
- if (!(e(this, C) && !t && !e(this, C).documentElement.hasAttribute(
128
- "data-always-revalidate"
129
- )))
130
- return e(this, R) ? e(this, R) : (r(this, R, new Promise((s) => F(this, null, function* () {
131
- try {
132
- r(this, Y, new AbortController());
133
- const c = yield (yield fetch(
134
- `${this.pathname}${this.searchParameters ? "?" + this.searchParameters : ""}`,
135
- {
136
- signal: e(this, Y).signal
137
- }
138
- )).text(), y = Kt.parseFromString(c, "text/html");
139
- this.setInitialDocument(y);
140
- } catch (i) {
141
- console.warn(i);
142
- } finally {
143
- r(this, Y, null), r(this, R, null), s();
144
- }
145
- }))), e(this, R));
121
+ fetch(e) {
122
+ return W(this, null, function* () {
123
+ return t(this, q) || t(this, P) && t(this, P).documentElement.hasAttribute("data-cache") && !e || t(this, P) && t(this, T).isPopstateNavigation ? t(this, q) : (r(this, q, new Promise((s) => W(this, null, function* () {
124
+ try {
125
+ r(this, U, new AbortController());
126
+ const u = yield (yield fetch(t(this, R), {
127
+ signal: t(this, U).signal
128
+ })).text(), y = Yt.parseFromString(u, "text/html");
129
+ this.setInitialDocument(y);
130
+ } catch (i) {
131
+ console.warn(i);
132
+ } finally {
133
+ r(this, U, null), r(this, q, null), s();
134
+ }
135
+ }))), t(this, q));
146
136
  });
147
137
  }
148
138
  cloneDocument() {
149
- r(this, I, (e(this, W) || e(this, C)).cloneNode(!0));
139
+ r(this, V, (t(this, X) || t(this, P)).cloneNode(!0));
150
140
  }
151
141
  get title() {
152
- let t = "";
153
- if (e(this, I).title)
154
- t = e(this, I).title;
142
+ let e = "";
143
+ if (t(this, V).title)
144
+ e = t(this, V).title;
155
145
  else {
156
- const s = e(this, I).querySelector("h1");
157
- t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, G);
146
+ const s = t(this, V).querySelector("h1");
147
+ e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this, R);
158
148
  }
159
- return t;
149
+ return e;
160
150
  }
161
151
  clearScrollState() {
162
- e(this, b).x = 0, e(this, b).y = 0;
152
+ t(this, b).x = 0, t(this, b).y = 0;
163
153
  }
164
154
  clearDocumentState() {
165
- r(this, W, null);
155
+ r(this, X, null);
166
156
  }
167
157
  saveScrollState() {
168
- e(this, C).documentElement.hasAttribute(
158
+ t(this, P).documentElement.hasAttribute(
169
159
  "data-no-scroll-restoration"
170
- ) ? (e(this, b).x = 0, e(this, b).y = 0) : (e(this, b).x = e(this, D).scrollValue.left, e(this, b).y = e(this, D).scrollValue.top);
160
+ ) ? (t(this, b).x = 0, t(this, b).y = 0) : (t(this, b).x = t(this, T).scrollValue.left, t(this, b).y = t(this, T).scrollValue.top);
171
161
  }
172
162
  restoreScrollPosition() {
173
- e(this, D).scrollElement.scroll({
174
- top: e(this, b).y,
175
- left: e(this, b).x,
163
+ t(this, T).scrollElement.scroll({
164
+ top: t(this, b).y,
165
+ left: t(this, b).x,
176
166
  behavior: "instant"
177
167
  });
178
168
  }
179
169
  saveDocumentState() {
180
- e(this, C).documentElement.hasAttribute(
170
+ t(this, P).documentElement.hasAttribute(
181
171
  "data-no-page-restoration"
182
- ) ? r(this, W, null) : r(this, W, document.cloneNode(!0));
172
+ ) ? r(this, X, null) : r(this, X, document.cloneNode(!0));
183
173
  }
184
174
  renewScrollPosition() {
185
- e(this, D).scrollElement.scroll({
175
+ t(this, T).scrollElement.scroll({
186
176
  top: 0,
187
177
  left: 0,
188
178
  behavior: "instant"
189
179
  });
190
180
  }
191
- saveState(t) {
192
- r(this, J, t);
181
+ saveState(e) {
182
+ r(this, G, e);
193
183
  }
194
184
  clearState() {
195
- const t = e(this, J);
196
- return r(this, J, null), t;
185
+ const e = t(this, G);
186
+ return r(this, G, null), e;
197
187
  }
198
188
  }
199
- D = new WeakMap(), G = new WeakMap(), rt = new WeakMap(), b = new WeakMap(), C = new WeakMap(), W = new WeakMap(), I = new WeakMap(), J = new WeakMap(), Y = new WeakMap(), R = new WeakMap();
200
- var P, Q, g, V, d, nt, q, T, L, ot, x, X, Z, _, at, h, ht, St, qt, wt, yt, vt, bt, ut, tt;
201
- const st = class st {
202
- constructor(t) {
189
+ T = new WeakMap(), R = new WeakMap(), b = new WeakMap(), P = new WeakMap(), X = new WeakMap(), V = new WeakMap(), G = new WeakMap(), U = new WeakMap(), q = new WeakMap();
190
+ var A, J, g, z, f, it, B, x, L, rt, N, j, Q, Z, nt, h, ht, gt, Dt, Et, St, wt, yt, ct, _;
191
+ const et = class et {
192
+ constructor(e) {
203
193
  o(this, h);
204
- o(this, P, null);
205
- o(this, Q, null);
194
+ o(this, A, null);
195
+ o(this, J, null);
206
196
  o(this, g, []);
207
- o(this, V);
208
- o(this, d, null);
209
- o(this, nt);
210
- o(this, q, []);
211
- o(this, T, !1);
197
+ o(this, z);
198
+ o(this, f, null);
199
+ o(this, it);
200
+ o(this, B, []);
201
+ o(this, x, !1);
212
202
  o(this, L, null);
213
- o(this, ot, !1);
214
- o(this, x, /* @__PURE__ */ new Map());
215
- o(this, X, null);
203
+ o(this, rt, !1);
204
+ o(this, N, /* @__PURE__ */ new Map());
205
+ o(this, j, null);
206
+ o(this, Q, 0);
216
207
  o(this, Z, 0);
217
- o(this, _, 0);
218
- o(this, at, (t) => {
208
+ o(this, nt, (e) => {
219
209
  var s;
220
- return ((s = t.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !t.hasAttribute("download") && !t.hasAttribute("data-morph-skip") && !t.closest("[data-morph-skip]") && t.getAttribute("target") !== "_blank";
210
+ return ((s = e.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !e.hasAttribute("download") && !e.hasAttribute("data-morph-skip") && !e.closest("[data-morph-skip]") && e.getAttribute("target") !== "_blank";
221
211
  });
222
- o(this, ut, (t) => F(this, null, function* () {
212
+ o(this, ct, (e) => W(this, null, function* () {
223
213
  var s;
224
- (s = t.state) != null && s.path && (t.preventDefault(), r(this, T, !0), yield this.navigate(t.state.path, { historyAction: "none" }), r(this, T, !1));
214
+ (s = e.state) != null && s.path && (e.preventDefault(), r(this, x, !0), yield this.navigate(e.state.path, { historyAction: "none" }), r(this, x, !1));
225
215
  }));
226
- o(this, tt, () => {
227
- const { left: t, top: s } = this.scrollValue, i = s - e(this, _), c = t - e(this, Z);
228
- r(this, _, s), r(this, Z, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
216
+ o(this, _, () => {
217
+ const { left: e, top: s } = this.scrollValue, i = s - t(this, Z), u = e - t(this, Q);
218
+ r(this, Z, s), r(this, Q, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
229
219
  "scroll-y-forward",
230
220
  i > 0
231
221
  ), document.documentElement.classList.toggle(
@@ -233,332 +223,341 @@ const st = class st {
233
223
  i < 0
234
224
  ), document.documentElement.classList.toggle(
235
225
  "scroll-x-forward",
236
- c > 0
226
+ u > 0
237
227
  ), document.documentElement.classList.toggle(
238
228
  "scroll-x-backward",
239
- c < 0
240
- ), O(document, "morphScroll", {
229
+ u < 0
230
+ ), Y(document, "morphScroll", {
241
231
  detail: {
242
- left: t,
232
+ left: e,
243
233
  top: s
244
234
  }
245
235
  });
246
236
  });
247
- if (Rt && !st.instance) {
248
- st.instance = this, r(this, P, {
249
- base: $t(t == null ? void 0 : t.base),
250
- waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
251
- cachePages: (t == null ? void 0 : t.cachePages) !== !1,
252
- trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
253
- scrollSelector: t == null ? void 0 : t.scrollSelector,
254
- morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
255
- }), r(this, Q, p(this, h, St).call(this, document.body));
237
+ if (Mt && !et.instance) {
238
+ et.instance = this, r(this, A, {
239
+ base: Ft(e == null ? void 0 : e.base),
240
+ waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
241
+ trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
242
+ scrollSelector: e == null ? void 0 : e.scrollSelector,
243
+ morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
244
+ }), r(this, J, p(this, h, gt).call(this, document.body));
256
245
  const s = this.normalizePath(
257
- location.pathname + location.hash
246
+ location.pathname + location.hash + location.search
258
247
  );
259
- r(this, d, s.pathname);
260
- const i = new Dt(this, e(this, d));
261
- i.setInitialDocument(document), e(this, x).set(e(this, d), i), document.documentElement.setAttribute(
248
+ r(this, f, s.path);
249
+ const i = new xt(this, t(this, f));
250
+ i.setInitialDocument(document), t(this, N).set(t(this, f), i), document.documentElement.setAttribute(
262
251
  "data-current-pathname",
263
- e(this, d)
252
+ t(this, f)
264
253
  ), document.documentElement.setAttribute(
265
254
  "data-current-leaf",
266
255
  s.leaf
267
- ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ut)), Ht({
256
+ ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", t(this, ct)), Tt({
268
257
  action: "replace",
269
- pathname: e(this, d),
270
- searchParameters: s.parameters || location.search,
258
+ pathname: s.pathname,
259
+ searchParameters: s.parameters,
271
260
  hash: s.hash
272
- }), r(this, X, new Vt()), p(this, h, vt).call(this, document);
261
+ }), r(this, j, new Ht()), p(this, h, wt).call(this, document);
273
262
  }
274
263
  }
275
- get currentPathname() {
276
- return e(this, d);
264
+ get currentPath() {
265
+ return t(this, f);
277
266
  }
278
267
  get previousPathname() {
279
- return e(this, nt);
268
+ return t(this, it);
280
269
  }
281
270
  get links() {
282
- return e(this, g);
271
+ return t(this, g);
283
272
  }
284
273
  get scrollElement() {
285
- return e(this, L);
274
+ return t(this, L);
286
275
  }
287
276
  get isPopstateNavigation() {
288
- return e(this, T);
277
+ return t(this, x);
289
278
  }
290
279
  get scrollValue() {
291
- let t = 0, s = 0;
292
- return e(this, ot) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, L).scrollTop, s = e(this, L).scrollLeft), { top: t, left: s };
280
+ let e = 0, s = 0;
281
+ return t(this, rt) ? (e = window.scrollY, s = window.scrollX) : (e = t(this, L).scrollTop, s = t(this, L).scrollLeft), { top: e, left: s };
293
282
  }
294
- saveState(t) {
295
- const s = e(this, x).get(e(this, d));
296
- s && s.saveState(t);
283
+ saveState(e) {
284
+ const s = t(this, N).get(t(this, f));
285
+ s && s.saveState(e);
297
286
  }
298
287
  getState() {
299
- const t = e(this, x).get(e(this, d));
300
- return t == null ? void 0 : t.clearState();
288
+ const e = t(this, N).get(t(this, f));
289
+ return e == null ? void 0 : e.clearState();
301
290
  }
302
- normalizePath(t) {
303
- return Ut(t, {
304
- base: e(this, P).base,
305
- trailingSlash: e(this, P).trailingSlash
291
+ normalizePath(e) {
292
+ return Ot(e, {
293
+ base: t(this, A).base,
294
+ trailingSlash: t(this, A).trailingSlash
306
295
  });
307
296
  }
308
- prefetch(t, s) {
309
- return F(this, null, function* () {
310
- if (e(this, q).length)
297
+ prefetch(e, s) {
298
+ return W(this, null, function* () {
299
+ if (t(this, B).length)
311
300
  return;
312
- const i = this.normalizePath(t), c = p(this, h, ht).call(this, i.pathname, i.parameters);
313
- c == null || c.fetch(s);
301
+ const i = p(this, h, ht).call(this, e);
302
+ i == null || i.fetch(s);
314
303
  });
315
304
  }
316
- navigate(z) {
317
- return F(this, arguments, function* (t, {
305
+ navigate(F) {
306
+ return W(this, arguments, function* (e, {
318
307
  historyAction: s = "push",
319
308
  centerScroll: i,
320
- offsetScroll: c,
309
+ offsetScroll: u,
321
310
  revalidate: y,
322
311
  keepSearchParameters: M,
323
312
  submorph: w,
324
313
  clearState: E
325
314
  } = {}) {
326
- var Pt;
327
- if (e(this, q).length)
315
+ var ot;
316
+ if (t(this, B).length)
328
317
  return;
329
- const dt = this.normalizePath(((Pt = this.pathnameModifier) == null ? void 0 : Pt.call(this, t)) || t);
330
- let { pathname: m, hash: $, parameters: Lt, leaf: zt } = dt;
331
- if (e(this, V) === m || e(this, d) === m) {
332
- e(this, T) || p(this, h, bt).call(this, $ || 0, {
318
+ const c = this.normalizePath(
319
+ ((ot = this.pathnameModifier) == null ? void 0 : ot.call(this, e)) || e
320
+ );
321
+ if (t(this, z) === c.path || t(this, f) === c.path) {
322
+ t(this, x) || p(this, h, yt).call(this, c.hash || 0, {
333
323
  centerScroll: i,
334
- offsetScroll: c,
324
+ offsetScroll: u,
335
325
  behavior: "smooth"
336
326
  });
337
327
  return;
338
328
  }
339
- r(this, V, m), e(this, g).forEach((U) => {
340
- U.checkCurrent(m);
329
+ r(this, z, c.path), t(this, g).forEach((H) => {
330
+ H.checkCurrent(c.path);
341
331
  });
342
332
  try {
343
- let U = !0;
333
+ let H = !0;
344
334
  if (this.preprocessor)
345
335
  try {
346
- yield new Promise((n, A) => {
336
+ yield new Promise((n, k) => {
347
337
  var v;
348
338
  (v = this.preprocessor) == null || v.call(this, {
349
- pathname: m,
339
+ path: e,
350
340
  resolve: n,
351
- reject: A,
341
+ reject: k,
352
342
  submorph: w
353
343
  });
354
344
  });
355
345
  } catch (n) {
356
- n ? console.error(n) : console.log("Route change canceled"), U = !1;
346
+ n ? console.error(n) : console.log("Route change canceled"), H = !1;
357
347
  }
358
- if (!U || e(this, V) !== m) {
359
- e(this, g).forEach((n) => {
360
- n.checkCurrent(e(this, d));
348
+ if (!H || t(this, z) !== c.path) {
349
+ t(this, g).forEach((n) => {
350
+ n.checkCurrent(t(this, f));
361
351
  });
362
352
  return;
363
353
  }
364
- const mt = {
365
- pathname: m,
354
+ const ut = {
355
+ path: c.path,
366
356
  submorph: w
367
357
  };
368
- O(document, "morphNavigation", {
369
- detail: mt
358
+ Y(document, "morphNavigation", {
359
+ detail: ut
370
360
  });
371
- const ft = p(this, h, ht).call(this, e(this, d)), f = p(this, h, ht).call(this, m, Lt);
372
- if (e(this, x).forEach((n) => {
373
- n.pathname !== m && n.abort();
374
- }), yield f == null ? void 0 : f.fetch(y), e(this, V) !== m) {
375
- e(this, g).forEach((n) => {
376
- n.checkCurrent(e(this, d));
361
+ const dt = p(this, h, ht).call(this, t(this, f)), m = p(this, h, ht).call(this, e);
362
+ if (t(this, N).forEach((n) => {
363
+ n.path !== c.path && n.abort();
364
+ }), yield m == null ? void 0 : m.fetch(y), t(this, z) !== c.path) {
365
+ t(this, g).forEach((n) => {
366
+ n.checkCurrent(t(this, f));
377
367
  });
378
368
  return;
379
369
  }
380
- ft.clearState(), ft.saveScrollState(), ft.saveDocumentState(), e(this, T) || (f.clearScrollState(), f.clearDocumentState()), E && f.clearState(), f.cloneDocument(), e(this, X).textContent = f.title, document.body.appendChild(e(this, X)), O(document, "morphStart", {
381
- detail: mt
370
+ dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), t(this, x) || (m.clearScrollState(), m.clearDocumentState()), E && m.clearState(), m.cloneDocument(), t(this, j).textContent = m.title, document.body.appendChild(t(this, j)), Y(document, "morphStart", {
371
+ detail: ut
382
372
  });
383
- const At = Array.from(document.head.children), kt = Array.from(f.document.head.children), Ct = p(this, h, qt).call(this, At, kt), Bt = p(this, h, wt).call(this, At, Ct), lt = p(this, h, wt).call(this, kt, Ct);
384
- lt.forEach((n, A) => {
373
+ const vt = Array.from(document.head.children), bt = Array.from(m.document.head.children), Lt = p(this, h, Dt).call(this, vt, bt), It = p(this, h, Et).call(this, vt, Lt), at = p(this, h, Et).call(this, bt, Lt);
374
+ at.forEach((n, k) => {
385
375
  if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
386
376
  const v = document.createElement("script");
387
- v.type = "module", v.src = n.getAttribute("src"), lt[A] = v;
377
+ v.type = "module", v.src = n.getAttribute("src"), at[k] = v;
388
378
  }
389
- }), lt.forEach((n) => {
379
+ }), at.forEach((n) => {
390
380
  document.head.appendChild(n);
391
381
  });
392
- const pt = lt.filter((n) => {
382
+ const mt = at.filter((n) => {
393
383
  if (n.hasAttribute("data-no-waiting"))
394
384
  return !1;
395
- if (p(this, h, yt).call(this, n))
385
+ if (p(this, h, St).call(this, n))
396
386
  return !0;
397
387
  });
398
- e(this, P).waitForHeadToLoad && pt.length && (yield new Promise((n) => F(this, null, function* () {
399
- let A = 0;
388
+ t(this, A).waitForHeadToLoad && mt.length && (yield new Promise((n) => W(this, null, function* () {
389
+ let k = 0;
400
390
  try {
401
- for (var v = Nt(pt), et, B, j; et = !(B = yield v.next()).done; et = !1) {
402
- const ct = B.value;
403
- ct.onload = () => {
404
- A++, A === pt.length && n();
391
+ for (var v = Ct(mt), tt, O, K; tt = !(O = yield v.next()).done; tt = !1) {
392
+ const lt = O.value;
393
+ lt.onload = () => {
394
+ k++, k === mt.length && n();
405
395
  };
406
396
  }
407
- } catch (B) {
408
- j = [B];
397
+ } catch (O) {
398
+ K = [O];
409
399
  } finally {
410
400
  try {
411
- et && (B = v.return) && (yield B.call(v));
401
+ tt && (O = v.return) && (yield O.call(v));
412
402
  } finally {
413
- if (j)
414
- throw j[0];
403
+ if (K)
404
+ throw K[0];
415
405
  }
416
406
  }
417
- }))), yield Yt(10);
418
- const Tt = [];
419
- Bt.forEach((n) => {
420
- n.hasAttribute("data-permanent") || (p(this, h, yt).call(this, n) ? Tt.push(n) : n.remove());
407
+ }))), yield zt(10);
408
+ const Pt = [];
409
+ It.forEach((n) => {
410
+ n.hasAttribute("data-permanent") || (p(this, h, St).call(this, n) ? Pt.push(n) : n.remove());
421
411
  });
422
- const Ft = p(this, h, St).call(this, f.document.body);
423
- e(this, P).morphInsideScrollContainer || p(this, h, vt).call(this, f.document), document.documentElement.setAttribute("data-current-pathname", m), document.documentElement.setAttribute("data-current-leaf", zt), Ht({
412
+ const Rt = p(this, h, gt).call(this, m.document.body);
413
+ t(this, A).morphInsideScrollContainer || p(this, h, wt).call(this, m.document), document.documentElement.setAttribute(
414
+ "data-current-pathname",
415
+ c.pathname
416
+ ), document.documentElement.setAttribute(
417
+ "data-current-leaf",
418
+ c.leaf
419
+ ), Tt({
424
420
  action: s,
425
- pathname: m,
426
- searchParameters: Lt || (M ? location.search : ""),
427
- hash: $
428
- }), e(this, X).remove(), r(this, nt, e(this, d)), r(this, d, m), e(this, Q).forEach((n, A) => {
429
- const v = Ft[A], et = getComputedStyle(n).getPropertyValue("--morph-duration");
430
- let B = [], j = [];
431
- w ? w.forEach((u) => {
432
- const S = n.querySelector(u), N = v.querySelector(u);
433
- S && N && (j.push(S), B.push(N));
434
- }) : (B.push(...v.childNodes), j.push(...n.childNodes)), j.forEach((u) => {
435
- u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
436
- }), B.forEach((u) => {
437
- u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
438
- }), w ? B.forEach((u, S) => {
439
- var N;
440
- (N = j[S].parentElement) == null || N.insertBefore(
441
- u,
442
- j[S]
421
+ pathname: c.pathname,
422
+ searchParameters: c.parameters || (M ? location.search : ""),
423
+ hash: c.hash
424
+ }), t(this, j).remove(), r(this, it, t(this, f)), r(this, f, c.path), t(this, J).forEach((n, k) => {
425
+ const v = Rt[k], tt = getComputedStyle(n).getPropertyValue("--morph-duration");
426
+ let O = [], K = [];
427
+ w ? w.forEach((d) => {
428
+ const S = n.querySelector(d), D = v.querySelector(d);
429
+ S && D && (K.push(S), O.push(D));
430
+ }) : (O.push(...v.childNodes), K.push(...n.childNodes)), K.forEach((d) => {
431
+ d instanceof HTMLElement && (this.destroyOldLinks(d), d.classList.add("old"));
432
+ }), O.forEach((d) => {
433
+ d instanceof HTMLElement && (this.findNewLinks(d), d.classList.add("new"));
434
+ }), w ? O.forEach((d, S) => {
435
+ var D;
436
+ (D = K[S].parentElement) == null || D.insertBefore(
437
+ d,
438
+ K[S]
443
439
  );
444
- }) : n.prepend(...B), Wt(() => {
445
- B.forEach((u) => {
440
+ }) : n.prepend(...O), qt(() => {
441
+ O.forEach((d) => {
446
442
  var S;
447
- u instanceof HTMLElement && ((S = u.parentElement) == null || S.style.setProperty(
443
+ d instanceof HTMLElement && ((S = d.parentElement) == null || S.style.setProperty(
448
444
  "--new-content-height",
449
- u.offsetHeight + "px"
450
- ), u.classList.add("in"));
445
+ d.offsetHeight + "px"
446
+ ), d.classList.add("in"));
451
447
  });
452
448
  });
453
- const ct = {
449
+ const lt = {
454
450
  morphElement: n,
455
- pathname: m
451
+ path: c.path
456
452
  };
457
- O(document, "morphNewChildrenAdded", {
458
- detail: ct
453
+ Y(document, "morphNewChildrenAdded", {
454
+ detail: lt
459
455
  });
460
- const Ot = new Promise((u) => {
456
+ const Vt = new Promise((d) => {
461
457
  setTimeout(() => {
462
- j.forEach((S) => S.remove()), B.forEach((S) => {
463
- var N;
464
- S instanceof HTMLElement && ((N = S.parentElement) == null || N.style.removeProperty(
458
+ K.forEach((S) => S.remove()), O.forEach((S) => {
459
+ var D;
460
+ S instanceof HTMLElement && ((D = S.parentElement) == null || D.style.removeProperty(
465
461
  "--new-content-height"
466
462
  ), S.classList.remove("in", "new"));
467
- }), O(document, "morphOldChildrenRemoved", {
468
- detail: ct
469
- }), u();
470
- }, (parseFloat(et) || 0) * 1e3 + 10);
463
+ }), Y(document, "morphOldChildrenRemoved", {
464
+ detail: lt
465
+ }), d();
466
+ }, (parseFloat(tt) || 0) * 1e3 + 10);
471
467
  });
472
- e(this, q).push(Ot);
468
+ t(this, B).push(Vt);
473
469
  }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
474
470
  "--new-document-scroll-position",
475
- (this.scrollValue.top - f.scrollState.y) * 1 + "px"
471
+ (this.scrollValue.top - m.scrollState.y) * 1 + "px"
476
472
  ) : document.documentElement.style.setProperty(
477
473
  "--new-document-scroll-position",
478
474
  this.scrollValue.top + "px"
479
- ), O(document, "morphBeforeNavigationScroll", {
480
- detail: f.scrollState
481
- }), $ ? (f.clearScrollState(), p(this, h, bt).call(this, $, { centerScroll: i, offsetScroll: c })) : e(this, T) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, q)), Tt.forEach((n) => n.remove()), r(this, q, []), e(this, Q).forEach((n) => {
475
+ ), Y(document, "morphBeforeNavigationScroll", {
476
+ detail: m.scrollState
477
+ }), c.hash ? (m.clearScrollState(), p(this, h, yt).call(this, c.hash, {
478
+ centerScroll: i,
479
+ offsetScroll: u
480
+ })) : t(this, x) ? m.restoreScrollPosition() : m.renewScrollPosition(), yield Promise.all(t(this, B)), Pt.forEach((n) => n.remove()), r(this, B, []), t(this, J).forEach((n) => {
482
481
  n.querySelectorAll("script").forEach((v) => {
483
- const et = document.createElement("script");
484
- et.type = "module", et.src = v.getAttribute("src"), v.replaceWith(et);
482
+ const tt = document.createElement("script");
483
+ tt.type = "module", tt.src = v.getAttribute("src"), v.replaceWith(tt);
485
484
  });
486
- }), O(document, "morphComplete", {
487
- detail: mt
485
+ }), Y(document, "morphComplete", {
486
+ detail: ut
488
487
  }), document.documentElement.style.removeProperty(
489
488
  "--new-document-scroll-position"
490
489
  ), window.dispatchEvent(new Event("resize"));
491
- } catch (U) {
492
- console.error(U);
490
+ } catch (H) {
491
+ console.error(H);
493
492
  }
494
- r(this, V, void 0);
493
+ r(this, z, void 0);
495
494
  });
496
495
  }
497
- addLink(t) {
498
- e(this, g).push(new Et(t, this));
496
+ addLink(e) {
497
+ t(this, g).push(new pt(e, this));
499
498
  }
500
- addLinks(t) {
501
- t.forEach((s) => {
499
+ addLinks(e) {
500
+ e.forEach((s) => {
502
501
  this.addLink(s);
503
502
  });
504
503
  }
505
- removeLink(t) {
506
- r(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
504
+ removeLink(e) {
505
+ r(this, g, t(this, g).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
507
506
  }
508
- destroyOldLinks(t) {
509
- r(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
507
+ destroyOldLinks(e) {
508
+ r(this, g, t(this, g).filter((s) => e.contains(s.element) ? (s.destroy(), !1) : !0));
510
509
  }
511
- findNewLinks(t) {
512
- const s = [...t.querySelectorAll("a")].filter(
513
- e(this, at)
510
+ findNewLinks(e) {
511
+ const s = [...e.querySelectorAll("a")].filter(
512
+ t(this, nt)
514
513
  );
515
- e(this, g).push(
516
- ...s.map((i) => new Et(i, this))
514
+ t(this, g).push(
515
+ ...s.map((i) => new pt(i, this))
517
516
  );
518
517
  }
519
518
  findLinks() {
520
- const t = [
519
+ const e = [
521
520
  ...document.documentElement.querySelectorAll("a")
522
- ].filter(e(this, at));
523
- e(this, g).forEach((s) => s.destroy()), r(this, g, t.map((s) => new Et(s, this)));
521
+ ].filter(t(this, nt));
522
+ t(this, g).forEach((s) => s.destroy()), r(this, g, e.map((s) => new pt(s, this)));
524
523
  }
525
524
  };
526
- P = new WeakMap(), Q = new WeakMap(), g = new WeakMap(), V = new WeakMap(), d = new WeakMap(), nt = new WeakMap(), q = new WeakMap(), T = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), x = new WeakMap(), X = new WeakMap(), Z = new WeakMap(), _ = new WeakMap(), at = new WeakMap(), h = new WeakSet(), ht = function(t, s) {
527
- let i = e(this, x).get(t);
528
- return i || (i = new Dt(this, t, s), e(this, x).set(t, i)), i;
529
- }, St = function(t) {
530
- const s = [...t.querySelectorAll("[data-morph]")];
531
- return s.length ? s : [t];
532
- }, qt = function(t, s) {
533
- return t.filter(
525
+ A = new WeakMap(), J = new WeakMap(), g = new WeakMap(), z = new WeakMap(), f = new WeakMap(), it = new WeakMap(), B = new WeakMap(), x = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), N = new WeakMap(), j = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), nt = new WeakMap(), h = new WeakSet(), ht = function(e) {
526
+ let s = t(this, N).get(e);
527
+ return s || (s = new xt(this, e), t(this, N).set(e, s)), s;
528
+ }, gt = function(e) {
529
+ const s = [...e.querySelectorAll("[data-morph]")];
530
+ return s.length ? s : [e];
531
+ }, Dt = function(e, s) {
532
+ return e.filter(
534
533
  (i) => s.find(
535
- (c) => c.outerHTML === i.outerHTML
534
+ (u) => u.outerHTML === i.outerHTML
536
535
  )
537
536
  );
538
- }, wt = function(t, s) {
539
- return t.filter(
537
+ }, Et = function(e, s) {
538
+ return e.filter(
540
539
  (i) => !s.find(
541
- (c) => c.outerHTML === i.outerHTML
540
+ (u) => u.outerHTML === i.outerHTML
542
541
  )
543
542
  );
544
- }, yt = function(t) {
545
- return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
546
- }, vt = function(t) {
543
+ }, St = function(e) {
544
+ return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
545
+ }, wt = function(e) {
547
546
  var s, i;
548
- (s = e(this, L)) == null || s.removeEventListener(
547
+ (s = t(this, L)) == null || s.removeEventListener(
549
548
  "scroll",
550
- e(this, tt)
551
- ), r(this, _, 0), r(this, Z, 0), r(this, L, e(this, P).scrollSelector && t.querySelector(e(this, P).scrollSelector) || window), r(this, ot, e(this, L) === window), (i = e(this, L)) == null || i.addEventListener("scroll", e(this, tt)), e(this, tt).call(this);
552
- }, bt = function(t, s) {
553
- const i = typeof t == "string" ? document.getElementById(t) : t;
554
- (typeof i == "number" || i) && Xt(i, {
555
- scrollElement: e(this, L),
549
+ t(this, _)
550
+ ), r(this, Z, 0), r(this, Q, 0), r(this, L, t(this, A).scrollSelector && e.querySelector(t(this, A).scrollSelector) || window), r(this, rt, t(this, L) === window), (i = t(this, L)) == null || i.addEventListener("scroll", t(this, _)), t(this, _).call(this);
551
+ }, yt = function(e, s) {
552
+ const i = typeof e == "string" ? document.getElementById(e) : e;
553
+ (typeof i == "number" || i) && Bt(i, {
554
+ scrollElement: t(this, L),
556
555
  behavior: (s == null ? void 0 : s.behavior) || "instant",
557
556
  center: s == null ? void 0 : s.centerScroll,
558
557
  offset: s == null ? void 0 : s.offsetScroll
559
558
  });
560
- }, ut = new WeakMap(), tt = new WeakMap(), st.instance = null;
561
- let It = st;
559
+ }, ct = new WeakMap(), _ = new WeakMap(), et.instance = null;
560
+ let Nt = et;
562
561
  export {
563
- It as Morph
562
+ Nt as Morph
564
563
  };