aptechka 0.74.1 → 0.75.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.
@@ -1,410 +1,472 @@
1
- var se = Object.defineProperty, ae = Object.defineProperties;
2
- var ne = Object.getOwnPropertyDescriptors;
3
- var Wt = Object.getOwnPropertySymbols;
4
- var re = Object.prototype.hasOwnProperty, oe = Object.prototype.propertyIsEnumerable;
5
- var Xt = (o, e) => (e = Symbol[o]) ? e : Symbol.for("Symbol." + o), Kt = (o) => {
1
+ var ce = Object.defineProperty, de = Object.defineProperties;
2
+ var ue = Object.getOwnPropertyDescriptors;
3
+ var Gt = Object.getOwnPropertySymbols;
4
+ var me = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
5
+ var Jt = (o, e) => (e = Symbol[o]) ? e : Symbol.for("Symbol." + o), Zt = (o) => {
6
6
  throw TypeError(o);
7
7
  };
8
- var Yt = (o, e, i) => e in o ? se(o, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[e] = i, St = (o, e) => {
9
- for (var i in e || (e = {}))
10
- re.call(e, i) && Yt(o, i, e[i]);
11
- if (Wt)
12
- for (var i of Wt(e))
13
- oe.call(e, i) && Yt(o, i, e[i]);
8
+ var Qt = (o, e, s) => e in o ? ce(o, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[e] = s, Ct = (o, e) => {
9
+ for (var s in e || (e = {}))
10
+ me.call(e, s) && Qt(o, s, e[s]);
11
+ if (Gt)
12
+ for (var s of Gt(e))
13
+ fe.call(e, s) && Qt(o, s, e[s]);
14
14
  return o;
15
- }, kt = (o, e) => ae(o, ne(e));
16
- var Pt = (o, e, i) => e.has(o) || Kt("Cannot " + i);
17
- var t = (o, e, i) => (Pt(o, e, "read from private field"), i ? i.call(o) : e.get(o)), l = (o, e, i) => e.has(o) ? Kt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, i), r = (o, e, i, s) => (Pt(o, e, "write to private field"), s ? s.call(o, i) : e.set(o, i), i), p = (o, e, i) => (Pt(o, e, "access private method"), i);
18
- var W = (o, e, i) => new Promise((s, h) => {
19
- var S = (d) => {
15
+ }, Nt = (o, e) => de(o, ue(e));
16
+ var Dt = (o, e, s) => e.has(o) || Zt("Cannot " + s);
17
+ var t = (o, e, s) => (Dt(o, e, "read from private field"), s ? s.call(o) : e.get(o)), h = (o, e, s) => e.has(o) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, s), r = (o, e, s, i) => (Dt(o, e, "write to private field"), i ? i.call(o, s) : e.set(o, s), s), g = (o, e, s) => (Dt(o, e, "access private method"), s);
18
+ var G = (o, e, s) => new Promise((i, l) => {
19
+ var S = (c) => {
20
20
  try {
21
- b(i.next(d));
22
- } catch (E) {
23
- h(E);
21
+ E(s.next(c));
22
+ } catch (L) {
23
+ l(L);
24
24
  }
25
- }, g = (d) => {
25
+ }, p = (c) => {
26
26
  try {
27
- b(i.throw(d));
28
- } catch (E) {
29
- h(E);
27
+ E(s.throw(c));
28
+ } catch (L) {
29
+ l(L);
30
30
  }
31
- }, b = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(S, g);
32
- b((i = i.apply(o, e)).next());
31
+ }, E = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(S, p);
32
+ E((s = s.apply(o, e)).next());
33
33
  });
34
- var jt = (o, e, i) => (e = o[Xt("asyncIterator")]) ? e.call(o) : (o = o[Xt("iterator")](), e = {}, i = (s, h) => (h = o[s]) && (e[s] = (S) => new Promise((g, b, d) => (S = h.call(o, S), d = S.done, Promise.resolve(S.value).then((E) => g({ value: E, done: d }), b)))), i("next"), i("return"), e);
35
- import { i as Jt } from "../index-Bv9zgfdb.js";
36
- import { d as T } from "../events-CsVF98U6.js";
37
- import { w as le, s as he } from "../scroll-DPkCFTxg.js";
34
+ var _t = (o, e, s) => (e = o[Jt("asyncIterator")]) ? e.call(o) : (o = o[Jt("iterator")](), e = {}, s = (i, l) => (l = o[i]) && (e[i] = (S) => new Promise((p, E, c) => (S = l.call(o, S), c = S.done, Promise.resolve(S.value).then((L) => p({ value: L, done: c }), E)))), s("next"), s("return"), e);
35
+ import { i as se } from "../index-Bv9zgfdb.js";
36
+ import { d as I } from "../events-CsVF98U6.js";
37
+ import { w as pe, s as ge } from "../scroll-DPkCFTxg.js";
38
38
  import "construct-style-sheets-polyfill";
39
- import { n as ce, c as Ct, s as ue } from "../url-CFnGU6md.js";
40
- import { cssValueParser as de } from "../css-value-parser/index.js";
41
- class Qt extends HTMLElement {
39
+ import { n as Ee, c as It, s as Le } from "../url-CBKXmNOi.js";
40
+ import { cssValueParser as Se } from "../css-value-parser/index.js";
41
+ import { c as ve } from "../string-BlMQbe8b.js";
42
+ class ie extends HTMLElement {
42
43
  connectedCallback() {
43
44
  const e = {
44
45
  "aria-live": "assertive",
45
46
  "aria-atomic": "true",
46
47
  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"
47
48
  };
48
- for (const [i, s] of Object.entries(e))
49
- this.setAttribute(i, s);
49
+ for (const [s, i] of Object.entries(e))
50
+ this.setAttribute(s, i);
50
51
  }
51
52
  }
52
- Jt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Qt);
53
- var P, a, q, J, vt, rt, Q;
54
- class Ht {
55
- constructor(e, i) {
56
- l(this, J);
57
- l(this, P);
58
- l(this, a);
59
- l(this, q);
60
- l(this, rt, (e) => {
61
- var s;
53
+ se && !customElements.get("morph-announcer") && customElements.define("morph-announcer", ie);
54
+ var H, a, U, st, Rt, mt, it;
55
+ class qt {
56
+ constructor(e, s) {
57
+ h(this, st);
58
+ h(this, H);
59
+ h(this, a);
60
+ h(this, U);
61
+ h(this, mt, (e) => {
62
+ var i;
62
63
  if (e.preventDefault(), document.documentElement.classList.contains("click-disabled"))
63
64
  return;
64
- if (t(this, a).hasAttribute("data-back") && t(this, P).previousURL)
65
+ if (t(this, a).hasAttribute("data-back") && t(this, H).previousURL)
65
66
  history.back();
66
67
  else {
67
- r(this, q, t(this, a).getAttribute("href") || "/");
68
- const h = t(this, a).getAttribute(
68
+ r(this, U, t(this, a).getAttribute("href") || "/");
69
+ const l = t(this, a).getAttribute(
69
70
  "data-history-action"
70
- ) || "push", S = t(this, a).hasAttribute("data-center-scroll"), g = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), b = g ? de.parse(g) : void 0, d = t(this, a).hasAttribute("data-revalidate") || t(this, a).hasAttribute("data-pagination-more-link") || t(this, a).hasAttribute("data-pagination-set-link"), E = t(this, a).hasAttribute(
71
+ ) || "push", S = t(this, a).hasAttribute("data-center-scroll"), p = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), E = p ? Se.parse(p) : void 0, c = t(this, a).hasAttribute("data-revalidate") || t(this, a).hasAttribute("data-pagination-more-link") || t(this, a).hasAttribute("data-pagination-set-link"), L = t(this, a).hasAttribute(
71
72
  "data-keep-search-parameters"
72
- ), dt = t(this, a).hasAttribute("data-keep-scroll-position") || t(this, a).hasAttribute("data-pagination-more-link");
73
- console.log(dt);
74
- const at = t(this, a).getAttribute(
73
+ ), D = t(this, a).hasAttribute("data-keep-scroll-position") || t(this, a).hasAttribute("data-pagination-more-link"), dt = t(this, a).getAttribute(
75
74
  "data-scroll-behaviour"
76
- ), mt = p(this, J, vt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
77
- mt && (t(this, a).hasAttribute("data-pagination-set-link") ? t(this, P).links.forEach((U) => {
78
- U.updatePagination(
75
+ ), et = g(this, st, Rt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
76
+ et && (t(this, a).hasAttribute("data-pagination-set-link") ? t(this, H).links.forEach((M) => {
77
+ M.updatePagination(
79
78
  parseInt(t(this, a).getAttribute("data-value") || "1"),
80
- mt.selector
79
+ et.selector
81
80
  );
82
- }) : t(this, a).hasAttribute("data-pagination-more-link") && t(this, P).links.forEach((U) => {
83
- U.updatePagination(
84
- mt.currentPage + 1,
85
- mt.selector
81
+ }) : t(this, a).hasAttribute("data-pagination-more-link") && t(this, H).links.forEach((M) => {
82
+ M.updatePagination(
83
+ et.currentPage + 1,
84
+ et.selector
86
85
  );
87
86
  }));
88
- const ft = ((s = t(this, a).getAttribute("data-submorph")) == null ? void 0 : s.split(",").map((U) => U.trim())) || t(this, a).hasAttribute("data-pagination-more-link") && [
87
+ const ne = ((i = t(this, a).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((M) => M.trim())) || t(this, a).hasAttribute("data-pagination-more-link") && [
89
88
  t(this, a).getAttribute("data-pagination-more-link")
90
89
  ] || t(this, a).hasAttribute("data-pagination-set-link") && [
91
90
  t(this, a).getAttribute("data-pagination-set-link")
92
- ] || void 0, c = t(this, a).hasAttribute("data-clear-state");
93
- t(this, P).navigate(t(this, q), {
94
- historyAction: h,
91
+ ] || void 0, yt = t(this, a).hasAttribute("data-clear-state");
92
+ let d = t(this, U);
93
+ if (t(this, a).hasAttribute("data-toggle-params")) {
94
+ const [M, Pt] = t(this, U).split("?"), j = new URLSearchParams(Pt), W = new URLSearchParams(location.search), A = new URLSearchParams();
95
+ for (const [w] of j)
96
+ (!W.has(w) || W.has(w) && W.get(w) !== j.get(w)) && A.append(w, j.get(w));
97
+ if (t(this, a).hasAttribute("data-merge-params"))
98
+ for (const [w] of W)
99
+ j.has(w) || A.append(w, W.get(w));
100
+ d = `${M}?${A.toString()}`;
101
+ }
102
+ t(this, H).navigate(d, {
103
+ historyAction: l,
95
104
  centerScroll: S,
96
- offsetScroll: b,
97
- revalidate: d,
98
- keepSearchParameters: E,
99
- submorph: ft,
100
- clearState: c,
101
- keepScrollPosition: dt,
102
- scrollBehaviour: at,
103
- submorphAppend: t(this, a).hasAttribute("data-pagination-more-link")
105
+ offsetScroll: E,
106
+ revalidate: c,
107
+ keepSearchParameters: L,
108
+ submorph: ne,
109
+ clearState: yt,
110
+ keepScrollPosition: D,
111
+ scrollBehaviour: dt,
112
+ submorphAppend: t(this, a).hasAttribute("data-pagination-more-link"),
113
+ mergeParams: t(this, a).hasAttribute("data-merge-params") && !t(this, a).hasAttribute("data-toggle-params")
104
114
  });
105
115
  }
106
116
  });
107
- l(this, Q, () => {
117
+ h(this, it, () => {
108
118
  const e = t(this, a).hasAttribute("data-revalidate");
109
- t(this, P).prefetch(t(this, q), e), t(this, a).removeEventListener("pointerenter", t(this, Q));
119
+ t(this, H).prefetch(t(this, U), e), t(this, a).removeEventListener("pointerenter", t(this, it));
110
120
  });
111
- r(this, P, i), r(this, a, e), t(this, a).addEventListener("click", t(this, rt)), r(this, q, t(this, a).getAttribute("href") || "/"), this.checkCurrent(location.href.replace(location.origin, ""));
112
- const s = p(this, J, vt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
113
- s && this.updatePagination(
114
- s.currentPage,
115
- s.selector
116
- ), t(this, a).hasAttribute("data-prefetch") && t(this, a).addEventListener("pointerenter", t(this, Q));
121
+ r(this, H, s), r(this, a, e), t(this, a).addEventListener("click", t(this, mt)), r(this, U, t(this, a).getAttribute("href") || "/"), this.checkCurrent(location.href.replace(location.origin, ""));
122
+ const i = g(this, st, Rt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
123
+ i && this.updatePagination(
124
+ i.currentPage,
125
+ i.selector
126
+ ), t(this, a).hasAttribute("data-prefetch") && t(this, a).addEventListener("pointerenter", t(this, it));
117
127
  }
118
128
  get element() {
119
129
  return t(this, a);
120
130
  }
121
131
  checkCurrent(e) {
122
- var h;
123
- const i = t(this, P).normalizePath(e), s = t(this, P).normalizePath(t(this, q));
124
- t(this, a).hasAttribute("data-include") && i.pathname.includes(s.pathname) ? t(this, a).classList.add("current") : s.pathname === i.pathname ? t(this, a).classList.add("current") : (h = t(this, a).getAttribute("data-associated-paths")) != null && h.split(",").find((S) => i.pathname.includes(S)) ? t(this, a).classList.add("current") : t(this, a).classList.remove("current"), i.path === s.path ? t(this, a).classList.add("exact") : t(this, a).classList.remove("exact");
125
- }
126
- updatePagination(e, i) {
127
- const s = p(this, J, vt).call(this, i);
128
- if (s)
129
- if (s.element.setAttribute(
132
+ var L;
133
+ const s = t(this, H).normalizePath(e), i = t(this, H).normalizePath(t(this, U));
134
+ 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") : (L = t(this, a).getAttribute("data-associated-paths")) != null && L.split(",").find((D) => s.pathname.includes(D)) ? 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");
135
+ const [l, S] = t(this, U).split("?"), p = new URLSearchParams(S), E = new URLSearchParams(location.search);
136
+ let c = 0;
137
+ for (const [D] of E)
138
+ p.has(D) && E.get(D) === p.get(D) && c++;
139
+ c ? (t(this, a).classList.toggle(
140
+ "all-params-matched",
141
+ E.size === c
142
+ ), t(this, a).classList.toggle(
143
+ "some-params-matched",
144
+ E.size !== c
145
+ )) : (t(this, a).classList.remove("all-params-matched"), t(this, a).classList.remove("some-params-matched"));
146
+ }
147
+ updatePagination(e, s) {
148
+ const i = g(this, st, Rt).call(this, s);
149
+ if (i)
150
+ if (i.element.setAttribute(
130
151
  "data-current-page",
131
152
  e.toString()
132
153
  ), t(this, a).hasAttribute("data-pagination-more-link"))
133
- if (e < s.totalPages) {
154
+ if (e < i.totalPages) {
134
155
  t(this, a).style.display = "";
135
- const h = t(this, a).querySelector(
156
+ const l = t(this, a).querySelector(
136
157
  "[data-pagination-more-link-counter]"
137
158
  );
138
- h && (h.textContent = (s.totalPages - e).toString());
139
- const S = t(this, a).getAttribute("href"), g = new URL(S, window.location.origin);
140
- g.searchParams.set("page", (e + 1).toString());
141
- const b = g.href.replace(g.origin, "").toString();
142
- t(this, a).setAttribute("href", b), this.checkCurrent(b);
159
+ l && (l.textContent = (i.totalPages - e).toString());
160
+ const S = t(this, a).getAttribute("href"), p = new URL(S, window.location.origin);
161
+ p.searchParams.set("page", (e + 1).toString());
162
+ const E = p.href.replace(p.origin, "").toString();
163
+ t(this, a).setAttribute("href", E), this.checkCurrent(E);
143
164
  } else
144
165
  t(this, a).style.display = "none";
145
166
  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"));
146
167
  }
147
168
  destroy() {
148
- t(this, a).removeEventListener("click", t(this, rt)), t(this, a).removeEventListener("pointerenter", t(this, Q)), t(this, a).classList.remove("current", "exact", "pagination-current");
169
+ t(this, a).removeEventListener("click", t(this, mt)), t(this, a).removeEventListener("pointerenter", t(this, it)), t(this, a).classList.remove("current", "exact", "pagination-current");
149
170
  }
150
171
  }
151
- P = new WeakMap(), a = new WeakMap(), q = new WeakMap(), J = new WeakSet(), vt = function(e) {
172
+ H = new WeakMap(), a = new WeakMap(), U = new WeakMap(), st = new WeakSet(), Rt = function(e) {
152
173
  if (!e)
153
174
  return;
154
- const i = document.querySelector(e);
155
- if (i) {
156
- const s = parseInt(
157
- i.getAttribute("data-current-page") || "1"
158
- ), h = parseInt(
159
- i.getAttribute("data-total-pages") || "1"
175
+ const s = document.querySelector(e);
176
+ if (s) {
177
+ const i = parseInt(
178
+ s.getAttribute("data-current-page") || "1"
179
+ ), l = parseInt(
180
+ s.getAttribute("data-total-pages") || "1"
160
181
  );
161
182
  return {
162
- element: i,
163
- currentPage: s,
164
- totalPages: h,
183
+ element: s,
184
+ currentPage: i,
185
+ totalPages: l,
165
186
  selector: e
166
187
  };
167
188
  }
168
- }, rt = new WeakMap(), Q = new WeakMap();
169
- const me = new DOMParser();
170
- var M, X, A, x, Y, z, Z, K, V, ot;
171
- class $t {
172
- constructor(e, i) {
173
- l(this, M);
174
- l(this, X);
175
- l(this, A, { x: 0, y: 0 });
176
- l(this, x, null);
177
- l(this, Y, null);
178
- l(this, z, null);
179
- l(this, Z, null);
180
- l(this, K, null);
181
- l(this, V, null);
182
- l(this, ot);
183
- r(this, M, e), r(this, X, i);
189
+ }, mt = new WeakMap(), it = new WeakMap();
190
+ const be = new DOMParser();
191
+ var q, J, k, z, Q, B, at, Z, X, ft;
192
+ class te {
193
+ constructor(e, s) {
194
+ h(this, q);
195
+ h(this, J);
196
+ h(this, k, { x: 0, y: 0 });
197
+ h(this, z, null);
198
+ h(this, Q, null);
199
+ h(this, B, null);
200
+ h(this, at, null);
201
+ h(this, Z, null);
202
+ h(this, X, null);
203
+ h(this, ft);
204
+ r(this, q, e), r(this, J, s);
184
205
  }
185
206
  get pathname() {
186
- return t(this, X);
207
+ return t(this, J);
187
208
  }
188
209
  get scrollState() {
189
- return t(this, A);
210
+ return t(this, k);
190
211
  }
191
212
  get document() {
192
- return t(this, z);
213
+ return t(this, B);
193
214
  }
194
215
  setHeaders(e) {
195
- r(this, ot, e);
216
+ r(this, ft, e);
196
217
  }
197
218
  setInitialDocument(e) {
198
- r(this, x, e.cloneNode(!0));
219
+ r(this, z, e.cloneNode(!0));
199
220
  }
200
221
  abort() {
201
222
  var e;
202
- return (e = t(this, K)) == null ? void 0 : e.abort(
203
- `[${t(this, X)}] page loading cancelled`
223
+ return (e = t(this, Z)) == null ? void 0 : e.abort(
224
+ `[${t(this, J)}] page loading cancelled`
204
225
  );
205
226
  }
206
- fetch(e, i, s) {
207
- return W(this, null, function* () {
208
- var h;
209
- if (!s) {
210
- const b = ((h = t(this, x)) == null ? void 0 : h.documentElement.getAttribute("data-cache")) && i !== e, d = t(this, x) && t(this, M).isPopstateNavigation;
211
- if (t(this, V) || b || d)
212
- return t(this, V);
227
+ fetch(e, s, i) {
228
+ return G(this, null, function* () {
229
+ var l;
230
+ if (!i) {
231
+ const E = ((l = t(this, z)) == null ? void 0 : l.documentElement.getAttribute("data-cache")) && s !== e, c = t(this, z) && t(this, q).isPopstateNavigation;
232
+ if (t(this, X) || E || c)
233
+ return t(this, X);
213
234
  }
214
- return r(this, V, new Promise((S) => W(this, null, function* () {
235
+ return r(this, X, new Promise((S) => G(this, null, function* () {
215
236
  try {
216
- r(this, K, new AbortController());
217
- const b = yield (yield fetch(e, {
218
- signal: t(this, K).signal,
219
- headers: St({
237
+ r(this, Z, new AbortController());
238
+ const E = yield (yield fetch(e, {
239
+ signal: t(this, Z).signal,
240
+ headers: Ct({
220
241
  "X-MORPH": "true",
221
- "X-MORPH-CURRENT-PATH": encodeURIComponent(i),
242
+ "X-MORPH-CURRENT-PATH": encodeURIComponent(s),
222
243
  "X-MORPH-NEW-PATH": encodeURIComponent(e)
223
- }, t(this, ot))
224
- })).text(), d = me.parseFromString(b, "text/html");
225
- this.setInitialDocument(d);
226
- } catch (g) {
227
- console.warn(g);
244
+ }, t(this, ft))
245
+ })).text(), c = be.parseFromString(E, "text/html");
246
+ this.setInitialDocument(c);
247
+ } catch (p) {
248
+ console.warn(p);
228
249
  } finally {
229
- r(this, K, null), r(this, V, null), S();
250
+ r(this, Z, null), r(this, X, null), S();
230
251
  }
231
- }))), t(this, V);
252
+ }))), t(this, X);
232
253
  });
233
254
  }
234
255
  cloneDocument() {
235
- r(this, z, (t(this, Y) || t(this, x)).cloneNode(!0));
256
+ r(this, B, (t(this, Q) || t(this, z)).cloneNode(!0));
236
257
  }
237
258
  get title() {
238
259
  let e = "";
239
- if (t(this, z).title)
240
- e = t(this, z).title;
260
+ if (t(this, B).title)
261
+ e = t(this, B).title;
241
262
  else {
242
- const i = t(this, z).querySelector("h1");
243
- e = (i == null ? void 0 : i.innerText) || (i == null ? void 0 : i.textContent) || t(this, X);
263
+ const s = t(this, B).querySelector("h1");
264
+ e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this, J);
244
265
  }
245
266
  return e;
246
267
  }
247
268
  clearScrollState() {
248
- t(this, A).x = 0, t(this, A).y = 0;
269
+ t(this, k).x = 0, t(this, k).y = 0;
249
270
  }
250
271
  clearDocumentState() {
251
- r(this, Y, null);
272
+ r(this, Q, null);
252
273
  }
253
274
  saveScrollState() {
254
- t(this, x).documentElement.hasAttribute(
275
+ t(this, z).documentElement.hasAttribute(
255
276
  "data-no-scroll-restoration"
256
- ) ? (t(this, A).x = 0, t(this, A).y = 0) : (t(this, A).x = t(this, M).scrollValue.left, t(this, A).y = t(this, M).scrollValue.top);
277
+ ) ? (t(this, k).x = 0, t(this, k).y = 0) : (t(this, k).x = t(this, q).scrollValue.left, t(this, k).y = t(this, q).scrollValue.top);
257
278
  }
258
279
  restoreScrollPosition() {
259
- t(this, M).scrollElement.scroll({
260
- top: t(this, A).y,
261
- left: t(this, A).x,
280
+ t(this, q).scrollElement.scroll({
281
+ top: t(this, k).y,
282
+ left: t(this, k).x,
262
283
  behavior: "instant"
263
284
  });
264
285
  }
265
286
  saveDocumentState() {
266
- t(this, x).documentElement.hasAttribute(
287
+ t(this, z).documentElement.hasAttribute(
267
288
  "data-no-page-restoration"
268
- ) ? r(this, Y, null) : r(this, Y, document.cloneNode(!0));
289
+ ) ? r(this, Q, null) : r(this, Q, document.cloneNode(!0));
269
290
  }
270
291
  renewScrollPosition() {
271
- t(this, M).scrollElement.scroll({
292
+ t(this, q).scrollElement.scroll({
272
293
  top: 0,
273
294
  left: 0,
274
295
  behavior: "instant"
275
296
  });
276
297
  }
277
298
  saveState(e) {
278
- r(this, Z, e);
299
+ r(this, at, e);
279
300
  }
280
301
  clearState() {
281
- const e = t(this, Z);
282
- return r(this, Z, null), e;
302
+ const e = t(this, at);
303
+ return r(this, at, null), e;
283
304
  }
284
305
  }
285
- M = new WeakMap(), X = new WeakMap(), A = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), z = new WeakMap(), Z = new WeakMap(), K = new WeakMap(), V = new WeakMap(), ot = new WeakMap();
286
- var R, _, y, F, f, j, O, B, C, lt, N, $, tt, et, ht, it, ct, m, Rt, ut, Lt, Tt, Zt, Mt, xt, Nt, Ut, bt, st;
287
- const nt = class nt {
306
+ q = new WeakMap(), J = new WeakMap(), k = new WeakMap(), z = new WeakMap(), Q = new WeakMap(), B = new WeakMap(), at = new WeakMap(), Z = new WeakMap(), X = new WeakMap(), ft = new WeakMap();
307
+ var C, nt, pt, zt, gt;
308
+ class ye {
288
309
  constructor(e) {
289
- l(this, m);
290
- l(this, R, null);
291
- l(this, _, null);
292
- l(this, y, []);
293
- l(this, F);
294
- l(this, f, null);
295
- l(this, j);
296
- l(this, O, []);
297
- l(this, B, !1);
298
- l(this, C, null);
299
- l(this, lt, !1);
300
- l(this, N, /* @__PURE__ */ new Map());
301
- l(this, $, null);
302
- l(this, tt, 0);
303
- l(this, et, 0);
304
- l(this, ht);
305
- l(this, it);
306
- l(this, ct);
307
- l(this, ut, (e) => {
308
- var i;
309
- return ((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";
310
+ h(this, pt);
311
+ h(this, C);
312
+ h(this, nt, []);
313
+ h(this, gt, () => {
314
+ g(this, pt, zt).call(this);
315
+ });
316
+ r(this, C, e);
317
+ for (const s in t(this, C).dataset) {
318
+ const i = ve(s);
319
+ if (i.startsWith("param-")) {
320
+ const l = i.split("param-")[1], S = t(this, C).dataset[s];
321
+ t(this, nt).push({
322
+ name: l,
323
+ value: S
324
+ });
325
+ }
326
+ }
327
+ document.addEventListener(
328
+ "morphURLParametersChange",
329
+ t(this, gt)
330
+ ), g(this, pt, zt).call(this);
331
+ }
332
+ destroy() {
333
+ document.removeEventListener(
334
+ "morphURLParametersChange",
335
+ t(this, gt)
336
+ );
337
+ }
338
+ }
339
+ C = new WeakMap(), nt = new WeakMap(), pt = new WeakSet(), zt = function() {
340
+ const e = new URLSearchParams(location.search);
341
+ let s = !!t(this, nt).find((l) => e.has(l.name) && (e.get(l.name) === l.value || l.value === "*"));
342
+ !s && t(this, C).hasAttribute("data-match-no-params") && (s = !t(this, nt).filter((l) => e.has(l.name)).length);
343
+ const i = t(this, C).getAttribute("data-hide-class");
344
+ s ? i ? t(this, C).classList.remove(i) : t(this, C).style.display = "" : i ? t(this, C).classList.add(i) : t(this, C).style.display = "none";
345
+ }, gt = new WeakMap();
346
+ var N, rt, y, K, f, _, Y, $, T, Et, V, Lt, tt, ot, ht, St, lt, vt, m, Vt, bt, Ht, Wt, ae, Ft, Ot, Bt, Xt, Tt, ct;
347
+ const ut = class ut {
348
+ constructor(e) {
349
+ h(this, m);
350
+ h(this, N, null);
351
+ h(this, rt, null);
352
+ h(this, y, []);
353
+ h(this, K);
354
+ h(this, f, null);
355
+ h(this, _);
356
+ h(this, Y, []);
357
+ h(this, $, !1);
358
+ h(this, T, null);
359
+ h(this, Et, !1);
360
+ h(this, V, /* @__PURE__ */ new Map());
361
+ h(this, Lt, []);
362
+ h(this, tt, null);
363
+ h(this, ot, 0);
364
+ h(this, ht, 0);
365
+ h(this, St);
366
+ h(this, lt);
367
+ h(this, vt);
368
+ h(this, bt, (e) => {
369
+ var s;
370
+ 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";
310
371
  });
311
- l(this, bt, (e) => W(this, null, function* () {
312
- e.preventDefault(), r(this, B, !0), yield this.navigate(location.href.replace(location.origin, ""), {
372
+ h(this, Tt, (e) => G(this, null, function* () {
373
+ e.preventDefault(), r(this, $, !0), yield this.navigate(location.href.replace(location.origin, ""), {
313
374
  historyAction: "none",
314
- submorph: t(this, it) ? void 0 : t(this, ht),
315
- revalidate: t(this, it),
316
- keepScrollPosition: t(this, ct)
317
- }), r(this, B, !1);
375
+ submorph: t(this, lt) ? void 0 : t(this, St),
376
+ revalidate: t(this, lt),
377
+ keepScrollPosition: t(this, vt)
378
+ }), r(this, $, !1);
318
379
  }));
319
- l(this, st, () => {
320
- const { left: e, top: i } = this.scrollValue, s = i - t(this, et), h = e - t(this, tt);
321
- r(this, et, i), r(this, tt, e), document.documentElement.classList.toggle("scroll-y", i > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
380
+ h(this, ct, () => {
381
+ const { left: e, top: s } = this.scrollValue, i = s - t(this, ht), l = e - t(this, ot);
382
+ r(this, ht, s), r(this, ot, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
322
383
  "scroll-y-forward",
323
- s > 0
384
+ i > 0
324
385
  ), document.documentElement.classList.toggle(
325
386
  "scroll-y-backward",
326
- s < 0
387
+ i < 0
327
388
  ), document.documentElement.classList.toggle(
328
389
  "scroll-x-forward",
329
- h > 0
390
+ l > 0
330
391
  ), document.documentElement.classList.toggle(
331
392
  "scroll-x-backward",
332
- h < 0
333
- ), T(document, "morphScroll", {
393
+ l < 0
394
+ ), I(document, "morphScroll", {
334
395
  detail: {
335
396
  left: e,
336
- top: i
397
+ top: s
337
398
  }
338
399
  });
339
400
  });
340
- if (Jt && !nt.instance) {
341
- nt.instance = this, r(this, R, {
342
- base: ce(e == null ? void 0 : e.base),
401
+ if (se && !ut.instance) {
402
+ ut.instance = this, r(this, N, {
403
+ base: Ee(e == null ? void 0 : e.base),
343
404
  waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
344
405
  trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
345
406
  scrollSelector: e == null ? void 0 : e.scrollSelector,
346
407
  morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
347
- }), r(this, _, p(this, m, Tt).call(this, document.body));
348
- const i = this.normalizePath(
408
+ }), r(this, rt, g(this, m, Wt).call(this, document.body));
409
+ const s = this.normalizePath(
349
410
  location.pathname + location.search + location.hash
350
411
  );
351
- r(this, f, i);
352
- const s = new $t(this, t(this, f).pathname);
353
- s.setInitialDocument(document), t(this, N).set(t(this, f).pathname, s), document.documentElement.setAttribute(
412
+ r(this, f, s);
413
+ const i = new te(this, t(this, f).pathname);
414
+ i.setInitialDocument(document), t(this, V).set(t(this, f).pathname, i), document.documentElement.setAttribute(
354
415
  "data-current-pathname",
355
416
  t(this, f).pathname
356
417
  ), document.documentElement.setAttribute(
357
418
  "data-current-leaf",
358
- i.leaf
359
- ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", t(this, bt)), Ct({
419
+ s.leaf
420
+ ), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", t(this, Tt)), It({
360
421
  action: "replace",
361
- pathname: i.pathname,
362
- searchParameters: i.parameters,
363
- hash: i.hash
364
- }), r(this, $, new Qt()), p(this, m, Nt).call(this, document);
422
+ pathname: s.pathname,
423
+ searchParameters: s.parameters,
424
+ hash: s.hash
425
+ }), r(this, tt, new ie()), g(this, m, Bt).call(this, document);
365
426
  }
366
427
  }
367
428
  get currentURL() {
368
429
  return t(this, f);
369
430
  }
370
431
  get previousURL() {
371
- return t(this, j);
432
+ return t(this, _);
372
433
  }
373
434
  get links() {
374
435
  return t(this, y);
375
436
  }
376
437
  get scrollElement() {
377
- return t(this, C);
438
+ return t(this, T);
378
439
  }
379
440
  get isPopstateNavigation() {
380
- return t(this, B);
441
+ return t(this, $);
381
442
  }
382
443
  get scrollValue() {
383
- let e = 0, i = 0;
384
- return t(this, lt) ? (e = window.scrollY, i = window.scrollX) : (e = t(this, C).scrollTop, i = t(this, C).scrollLeft), { top: e, left: i };
444
+ let e = 0, s = 0;
445
+ return t(this, Et) ? (e = window.scrollY, s = window.scrollX) : (e = t(this, T).scrollTop, s = t(this, T).scrollLeft), { top: e, left: s };
385
446
  }
386
447
  saveState(e) {
387
- const i = t(this, N).get(t(this, f).path);
388
- i && i.saveState(e);
448
+ const s = t(this, V).get(t(this, f).path);
449
+ s && s.saveState(e);
389
450
  }
390
451
  getState() {
391
- const e = t(this, N).get(t(this, f).path);
452
+ const e = t(this, V).get(t(this, f).path);
392
453
  return e == null ? void 0 : e.clearState();
393
454
  }
394
- normalizePath(e) {
395
- return ue(e, {
396
- base: t(this, R).base,
397
- trailingSlash: t(this, R).trailingSlash
455
+ normalizePath(e, s) {
456
+ return Le(e, {
457
+ base: t(this, N).base,
458
+ trailingSlash: t(this, N).trailingSlash,
459
+ mergeParams: s != null && s.mergeParams ? location.search : ""
398
460
  });
399
461
  }
400
- prefetch(e, i) {
401
- return W(this, null, function* () {
402
- var h;
403
- if (t(this, O).length)
462
+ prefetch(e, s) {
463
+ return G(this, null, function* () {
464
+ var l;
465
+ if (t(this, Y).length)
404
466
  return;
405
- e = ((h = this.pathnameModifier) == null ? void 0 : h.call(this, e)) || e;
406
- const s = p(this, m, Lt).call(this, e);
407
- s == null || s.fetch(e, t(this, f).path, i);
467
+ e = ((l = this.pathnameModifier) == null ? void 0 : l.call(this, e)) || e;
468
+ const i = g(this, m, Ht).call(this, e);
469
+ i == null || i.fetch(e, t(this, f).path, s);
408
470
  });
409
471
  }
410
472
  excludeHeadChild(e) {
@@ -412,303 +474,319 @@ const nt = class nt {
412
474
  }
413
475
  setHeaders(e) {
414
476
  }
415
- navigate(mt) {
416
- return W(this, arguments, function* (e, {
417
- historyAction: i = "push",
418
- centerScroll: s,
419
- offsetScroll: h,
477
+ navigate(ne) {
478
+ return G(this, arguments, function* (e, {
479
+ historyAction: s = "push",
480
+ centerScroll: i,
481
+ offsetScroll: l,
420
482
  scrollBehaviour: S,
421
- revalidate: g,
422
- keepSearchParameters: b,
423
- submorph: d,
424
- submorphAppend: E,
425
- clearState: dt,
426
- keepScrollPosition: at
483
+ revalidate: p,
484
+ keepSearchParameters: E,
485
+ submorph: c,
486
+ submorphAppend: L,
487
+ clearState: D,
488
+ keepScrollPosition: dt,
489
+ mergeParams: et
427
490
  } = {}) {
428
- var U, Dt, It, qt;
429
- if (t(this, O).length)
491
+ var M, Pt, j, W;
492
+ if (t(this, Y).length)
430
493
  return;
431
- r(this, ht, d), r(this, it, g), r(this, ct, at);
432
- const ft = ((U = this.pathnameModifier) == null ? void 0 : U.call(this, e)) || e, c = this.normalizePath(ft);
433
- if (t(this, y).forEach((G) => {
434
- G.checkCurrent(c.path);
435
- }), !g && (((Dt = t(this, F)) == null ? void 0 : Dt.pathname) === c.pathname || t(this, f).pathname === c.pathname)) {
436
- at || p(this, m, Ut).call(this, c.hash || 0, {
437
- centerScroll: s,
438
- offsetScroll: h,
494
+ r(this, St, c), r(this, lt, p), r(this, vt, dt);
495
+ const yt = ((M = this.pathnameModifier) == null ? void 0 : M.call(this, e)) || e, d = this.normalizePath(yt, {
496
+ mergeParams: et
497
+ });
498
+ if (!p && (((Pt = t(this, K)) == null ? void 0 : Pt.pathname) === d.pathname || t(this, f).pathname === d.pathname)) {
499
+ dt || g(this, m, Xt).call(this, d.hash || 0, {
500
+ centerScroll: i,
501
+ offsetScroll: l,
439
502
  behavior: "smooth"
440
- }), T(document, "morphSamePath", {
503
+ }), I(document, "morphSamePath", {
441
504
  custom: !0
442
- }), ((It = t(this, f)) == null ? void 0 : It.parameters) !== c.parameters && (r(this, j, t(this, f)), r(this, f, c), Ct({
443
- action: ((qt = t(this, f)) == null ? void 0 : qt.hash) !== c.hash ? "replace" : i,
444
- pathname: c.pathname,
445
- searchParameters: c.parameters,
446
- hash: c.hash
447
- }), T(document, "morphURLParametersChange", {
505
+ }), ((j = t(this, f)) == null ? void 0 : j.parameters) !== d.parameters && (r(this, _, t(this, f)), r(this, f, d), It({
506
+ action: ((W = t(this, f)) == null ? void 0 : W.hash) !== d.hash ? "replace" : s,
507
+ pathname: d.pathname,
508
+ searchParameters: d.parameters,
509
+ hash: d.hash
510
+ }), I(document, "morphURLParametersChange", {
448
511
  detail: {
449
512
  newURL: t(this, f),
450
- previousURL: t(this, j)
513
+ previousURL: t(this, _)
451
514
  }
452
- }));
515
+ })), t(this, y).forEach((A) => {
516
+ A.checkCurrent(d.path);
517
+ });
453
518
  return;
454
- }
455
- r(this, F, c);
519
+ } else
520
+ t(this, y).forEach((A) => {
521
+ A.checkCurrent(d.path);
522
+ });
523
+ r(this, K, d);
456
524
  try {
457
- let G = !0;
525
+ let A = !0;
458
526
  if (this.preprocessor)
459
527
  try {
460
- yield new Promise((n, w) => {
461
- var k;
462
- (k = this.preprocessor) == null || k.call(this, {
463
- url: c,
528
+ yield new Promise((n, P) => {
529
+ var R;
530
+ (R = this.preprocessor) == null || R.call(this, {
531
+ url: d,
464
532
  resolve: n,
465
- reject: w,
466
- submorph: d
533
+ reject: P,
534
+ submorph: c
467
535
  });
468
536
  });
469
537
  } catch (n) {
470
- n ? console.error(n) : console.log("Route change canceled"), G = !1;
538
+ n ? console.error(n) : console.log("Route change canceled"), A = !1;
471
539
  }
472
- if (!G || t(this, F).pathname !== c.pathname) {
540
+ if (!A || t(this, K).pathname !== d.pathname) {
473
541
  t(this, y).forEach((n) => {
474
542
  n.checkCurrent(t(this, f).path);
475
543
  });
476
544
  return;
477
545
  }
478
- const zt = {
479
- url: c,
480
- submorph: d
546
+ const w = {
547
+ url: d,
548
+ submorph: c
481
549
  };
482
- d ? E || d.forEach((n) => {
483
- document.querySelectorAll(n).forEach((w) => {
484
- w.classList.add("out"), w.setAttribute("data-morph-out", "");
550
+ c ? L || c.forEach((n) => {
551
+ document.querySelectorAll(n).forEach((P) => {
552
+ P.classList.add("out"), P.setAttribute("data-morph-out", "");
485
553
  });
486
- }) : t(this, _).forEach((n) => {
487
- var w, k;
488
- (w = n.firstElementChild) == null || w.classList.add("out"), (k = n.firstElementChild) == null || k.setAttribute("data-morph-out", "");
489
- }), T(document, "morphNavigation", {
490
- detail: zt
554
+ }) : t(this, rt).forEach((n) => {
555
+ var P, R;
556
+ (P = n.firstElementChild) == null || P.classList.add("out"), (R = n.firstElementChild) == null || R.setAttribute("data-morph-out", "");
557
+ }), I(document, "morphNavigation", {
558
+ detail: w
491
559
  });
492
- const yt = p(this, m, Lt).call(this, t(this, f).pathname), v = p(this, m, Lt).call(this, c.pathname);
493
- if (t(this, N).forEach((n) => {
494
- n.pathname !== c.pathname && n.abort();
495
- }), yield v == null ? void 0 : v.fetch(ft, t(this, f).path, g), t(this, F).pathname !== c.pathname) {
560
+ const Mt = g(this, m, Ht).call(this, t(this, f).pathname), v = g(this, m, Ht).call(this, d.pathname);
561
+ if (t(this, V).forEach((n) => {
562
+ n.pathname !== d.pathname && n.abort();
563
+ }), yield v == null ? void 0 : v.fetch(yt, t(this, f).path, p), t(this, K).pathname !== d.pathname) {
496
564
  t(this, y).forEach((n) => {
497
565
  n.checkCurrent(t(this, f).path);
498
566
  });
499
567
  return;
500
568
  }
501
- yt.clearState(), yt.saveScrollState(), yt.saveDocumentState(), (!t(this, B) || g) && (v.clearScrollState(), v.clearDocumentState()), dt && v.clearState(), v.cloneDocument(), t(this, $).textContent = v.title, document.body.appendChild(t(this, $));
502
- const pt = kt(St({}, zt), {
569
+ Mt.clearState(), Mt.saveScrollState(), Mt.saveDocumentState(), (!t(this, $) || p) && (v.clearScrollState(), v.clearDocumentState()), D && v.clearState(), v.cloneDocument(), t(this, tt).textContent = v.title, document.body.appendChild(t(this, tt));
570
+ const wt = Nt(Ct({}, w), {
503
571
  document: v.document
504
572
  });
505
- E || pt.document.querySelectorAll("[data-morph-out]").forEach((n) => {
573
+ L || wt.document.querySelectorAll("[data-morph-out]").forEach((n) => {
506
574
  n.classList.remove("out");
507
- }), T(document, "morphStart", {
508
- detail: pt
575
+ }), I(document, "morphStart", {
576
+ detail: wt
509
577
  });
510
- const Vt = Array.from(document.head.children), Ft = Array.from(v.document.head.children), Ot = p(this, m, Zt).call(this, Vt, Ft), _t = p(this, m, Mt).call(this, Vt, Ot), gt = p(this, m, Mt).call(this, Ft, Ot).filter((n) => !this.excludeHeadChild(n));
511
- gt.forEach((n, w) => {
512
- n.tagName === "SCRIPT" && (gt[w] = p(this, m, Rt).call(this, n));
513
- }), gt.forEach((n) => {
578
+ const Kt = Array.from(document.head.children), Yt = Array.from(v.document.head.children), $t = g(this, m, ae).call(this, Kt, Yt), re = g(this, m, Ft).call(this, Kt, $t), At = g(this, m, Ft).call(this, Yt, $t).filter((n) => !this.excludeHeadChild(n));
579
+ At.forEach((n, P) => {
580
+ n.tagName === "SCRIPT" && (At[P] = g(this, m, Vt).call(this, n));
581
+ }), At.forEach((n) => {
514
582
  document.head.appendChild(n);
515
583
  });
516
- const wt = gt.filter((n) => {
584
+ const xt = At.filter((n) => {
517
585
  if (n.hasAttribute("data-no-waiting"))
518
586
  return !1;
519
- if (p(this, m, xt).call(this, n))
587
+ if (g(this, m, Ot).call(this, n))
520
588
  return !0;
521
589
  });
522
- t(this, R).waitForHeadToLoad && wt.length && (yield new Promise((n) => W(this, null, function* () {
523
- let w = 0;
590
+ t(this, N).waitForHeadToLoad && xt.length && (yield new Promise((n) => G(this, null, function* () {
591
+ let P = 0;
524
592
  try {
525
- for (var k = jt(wt), ee, D, H; ee = !(D = yield k.next()).done; ee = !1) {
526
- const Et = D.value;
527
- Et.onload = () => {
528
- w++, w === wt.length && n();
593
+ for (var R = _t(xt), he, F, x; he = !(F = yield R.next()).done; he = !1) {
594
+ const kt = F.value;
595
+ kt.onload = () => {
596
+ P++, P === xt.length && n();
529
597
  };
530
598
  }
531
- } catch (D) {
532
- H = [D];
599
+ } catch (F) {
600
+ x = [F];
533
601
  } finally {
534
602
  try {
535
- ee && (D = k.return) && (yield D.call(k));
603
+ he && (F = R.return) && (yield F.call(R));
536
604
  } finally {
537
- if (H)
538
- throw H[0];
605
+ if (x)
606
+ throw x[0];
539
607
  }
540
608
  }
541
- }))), yield le(10);
542
- const Bt = [];
543
- E || _t.forEach((n) => {
544
- n.hasAttribute("data-permanent") || (p(this, m, xt).call(this, n) ? Bt.push(n) : n.remove());
609
+ }))), yield pe(10);
610
+ const jt = [];
611
+ L || re.forEach((n) => {
612
+ n.hasAttribute("data-permanent") || (g(this, m, Ot).call(this, n) ? jt.push(n) : n.remove());
545
613
  });
546
- const te = p(this, m, Tt).call(this, v.document.body);
547
- !t(this, R).morphInsideScrollContainer && !d && p(this, m, Nt).call(this, v.document), document.documentElement.setAttribute(
614
+ const oe = g(this, m, Wt).call(this, v.document.body);
615
+ !t(this, N).morphInsideScrollContainer && !c && g(this, m, Bt).call(this, v.document), document.documentElement.setAttribute(
548
616
  "data-current-pathname",
549
- c.pathname
617
+ d.pathname
550
618
  ), document.documentElement.setAttribute(
551
619
  "data-current-leaf",
552
- c.leaf
553
- ), Ct({
554
- action: i,
555
- pathname: c.pathname,
556
- searchParameters: c.parameters || (b ? location.search : ""),
557
- hash: c.hash
558
- }), t(this, $).remove(), r(this, j, t(this, f)), r(this, f, c);
559
- const At = [];
560
- t(this, _).forEach((n, w) => {
561
- const k = te[w], ee = getComputedStyle(n).getPropertyValue("--morph-duration");
562
- let D = [], H = [];
563
- d ? (d.forEach((u) => {
564
- const L = n.querySelector(u), I = k.querySelector(u);
565
- L && I && (H.push(L), D.push(I));
566
- }), H.forEach((u) => {
567
- u.parentElement && At.push(u.parentElement);
568
- })) : (D.push(...k.childNodes), H.push(...n.childNodes), At.push(n)), E || H.forEach((u) => {
620
+ d.leaf
621
+ ), It({
622
+ action: s,
623
+ pathname: d.pathname,
624
+ searchParameters: d.parameters || (E ? location.search : ""),
625
+ hash: d.hash
626
+ }), t(this, tt).remove(), r(this, _, t(this, f)), r(this, f, d);
627
+ const Ut = [];
628
+ t(this, rt).forEach((n, P) => {
629
+ const R = oe[P], he = getComputedStyle(n).getPropertyValue("--morph-duration");
630
+ let F = [], x = [];
631
+ c ? (c.forEach((u) => {
632
+ const b = n.querySelector(u), O = R.querySelector(u);
633
+ b && O && (x.push(b), F.push(O));
634
+ }), x.forEach((u) => {
635
+ u.parentElement && Ut.push(u.parentElement);
636
+ })) : (F.push(...R.childNodes), x.push(...n.childNodes), Ut.push(n)), L || x.forEach((u) => {
569
637
  u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
570
- }), D.forEach((u) => {
638
+ }), F.forEach((u) => {
571
639
  u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
572
- }), d ? E ? D.forEach((u, L) => {
573
- H[L] instanceof HTMLElement && H[L].append(...u.childNodes);
574
- }) : D.forEach((u, L) => {
575
- var I;
576
- (I = H[L].parentElement) == null || I.insertBefore(
640
+ }), c ? L ? F.forEach((u, b) => {
641
+ x[b] instanceof HTMLElement && x[b].append(...u.childNodes);
642
+ }) : F.forEach((u, b) => {
643
+ var O;
644
+ (O = x[b].parentElement) == null || O.insertBefore(
577
645
  u,
578
- H[L]
646
+ x[b]
579
647
  );
580
- }) : n.prepend(...D), setTimeout(() => {
581
- E || H.forEach((u) => {
648
+ }) : n.prepend(...F), setTimeout(() => {
649
+ L || x.forEach((u) => {
582
650
  u instanceof HTMLElement && u.classList.add("old-idle");
583
- }), D.forEach((u) => {
584
- var L;
585
- u instanceof HTMLElement && ((L = u.parentElement) == null || L.style.setProperty(
651
+ }), F.forEach((u) => {
652
+ var b;
653
+ u instanceof HTMLElement && ((b = u.parentElement) == null || b.style.setProperty(
586
654
  "--new-content-height",
587
655
  u.offsetHeight + "px"
588
656
  ), u.classList.add("new-idle"));
589
657
  });
590
658
  }, 0);
591
- const Et = kt(St({}, pt), {
659
+ const kt = Nt(Ct({}, wt), {
592
660
  morphElement: n
593
661
  });
594
- T(document, "morphNewChildrenAdded", {
595
- detail: Et
662
+ I(document, "morphNewChildrenAdded", {
663
+ detail: kt
596
664
  });
597
- const ie = new Promise((u) => {
665
+ const le = new Promise((u) => {
598
666
  setTimeout(() => {
599
- E || H.forEach((L) => L.remove()), D.forEach((L) => {
600
- var I;
601
- L instanceof HTMLElement && ((I = L.parentElement) == null || I.style.removeProperty(
667
+ L || x.forEach((b) => b.remove()), F.forEach((b) => {
668
+ var O;
669
+ b instanceof HTMLElement && ((O = b.parentElement) == null || O.style.removeProperty(
602
670
  "--new-content-height"
603
- ), L.classList.remove("new-idle", "new"));
604
- }), E || T(document, "morphOldChildrenRemoved", {
605
- detail: Et
671
+ ), b.classList.remove("new-idle", "new"));
672
+ }), L || I(document, "morphOldChildrenRemoved", {
673
+ detail: kt
606
674
  }), u();
607
- }, (parseFloat(ee) || 0) * 1e3 + 10);
675
+ }, (parseFloat(he) || 0) * 1e3 + 10);
608
676
  });
609
- t(this, O).push(ie);
677
+ t(this, Y).push(le);
610
678
  }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
611
679
  "--new-document-scroll-position",
612
680
  (this.scrollValue.top - v.scrollState.y) * 1 + "px"
613
681
  ) : document.documentElement.style.setProperty(
614
682
  "--new-document-scroll-position",
615
683
  this.scrollValue.top + "px"
616
- ), T(document, "morphBeforeNavigationScroll", {
684
+ ), I(document, "morphBeforeNavigationScroll", {
617
685
  detail: v.scrollState
618
- }), c.hash ? (v.clearScrollState(), p(this, m, Ut).call(this, c.hash, {
619
- centerScroll: s,
620
- offsetScroll: h,
686
+ }), d.hash ? (v.clearScrollState(), g(this, m, Xt).call(this, d.hash, {
687
+ centerScroll: i,
688
+ offsetScroll: l,
621
689
  behavior: S
622
- })) : t(this, B) ? v.restoreScrollPosition() : at || v.renewScrollPosition(), yield Promise.all(t(this, O)), E || Bt.forEach((n) => n.remove()), r(this, O, []), At.forEach((n) => {
623
- n.querySelectorAll("script").forEach((k) => {
624
- k.replaceWith(p(this, m, Rt).call(this, k));
690
+ })) : t(this, $) ? v.restoreScrollPosition() : dt || v.renewScrollPosition(), yield Promise.all(t(this, Y)), L || jt.forEach((n) => n.remove()), r(this, Y, []), Ut.forEach((n) => {
691
+ n.querySelectorAll("script").forEach((R) => {
692
+ R.replaceWith(g(this, m, Vt).call(this, R));
625
693
  });
626
694
  }), t(this, y).forEach((n) => {
627
695
  n.checkCurrent(t(this, f).path);
628
- }), T(document, "morphComplete", {
629
- detail: pt
696
+ }), this.findParamsDependent(), I(document, "morphComplete", {
697
+ detail: wt
630
698
  }), document.documentElement.style.removeProperty(
631
699
  "--new-document-scroll-position"
632
700
  ), window.dispatchEvent(new Event("resize"));
633
- } catch (G) {
634
- console.error(G);
701
+ } catch (A) {
702
+ console.error(A);
635
703
  }
636
- r(this, F, void 0);
704
+ r(this, K, void 0);
637
705
  });
638
706
  }
639
707
  addLink(e) {
640
- t(this, y).push(new Ht(e, this));
708
+ t(this, y).push(new qt(e, this));
641
709
  }
642
710
  addLinks(e) {
643
- e.forEach((i) => {
644
- this.addLink(i);
711
+ e.forEach((s) => {
712
+ this.addLink(s);
645
713
  });
646
714
  }
647
715
  removeLink(e) {
648
- r(this, y, t(this, y).filter((i) => i.element === e ? (i.destroy(), !1) : !0));
716
+ r(this, y, t(this, y).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
649
717
  }
650
718
  destroyOldLinks(e) {
651
- r(this, y, t(this, y).filter((i) => e.contains(i.element) ? (i.destroy(), !1) : !0));
719
+ r(this, y, t(this, y).filter((s) => e.contains(s.element) ? (s.destroy(), !1) : !0));
652
720
  }
653
721
  findNewLinks(e) {
654
- const i = [...e.querySelectorAll("a")].filter(
655
- t(this, ut)
722
+ const s = [...e.querySelectorAll("a")].filter(
723
+ t(this, bt)
656
724
  );
657
725
  t(this, y).push(
658
- ...i.map((s) => new Ht(s, this))
726
+ ...s.map((i) => new qt(i, this))
659
727
  );
660
728
  }
661
729
  findLinks() {
662
730
  const e = [
663
731
  ...document.documentElement.querySelectorAll("a")
664
- ].filter(t(this, ut));
665
- t(this, y).forEach((i) => i.destroy()), r(this, y, e.map((i) => new Ht(i, this)));
732
+ ].filter(t(this, bt));
733
+ t(this, y).forEach((s) => s.destroy()), r(this, y, e.map((s) => new qt(s, this)));
734
+ }
735
+ findParamsDependent() {
736
+ const e = [
737
+ ...document.documentElement.querySelectorAll(
738
+ "[data-morph-params-dependent]"
739
+ )
740
+ ];
741
+ t(this, Lt).forEach((s) => s.destroy()), r(this, Lt, e.map(
742
+ (s) => new ye(s)
743
+ ));
666
744
  }
667
745
  };
668
- R = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), F = new WeakMap(), f = new WeakMap(), j = new WeakMap(), O = new WeakMap(), B = new WeakMap(), C = new WeakMap(), lt = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), ht = new WeakMap(), it = new WeakMap(), ct = new WeakMap(), m = new WeakSet(), Rt = function(e) {
669
- const i = document.createElement("script");
670
- for (let s = 0; s < e.attributes.length; s++) {
671
- const h = e.attributes[s];
672
- i.setAttribute(h.name, h.value);
673
- }
674
- return e.hasAttribute("src") || (i.innerHTML = e.innerHTML), i;
675
- }, ut = new WeakMap(), Lt = function(e) {
676
- const i = this.normalizePath(e);
677
- let s = t(this, N).get(i.pathname);
678
- return s || (s = new $t(this, i.pathname), t(this, N).set(i.pathname, s)), s;
679
- }, Tt = function(e) {
680
- const i = [...e.querySelectorAll("[data-morph]")];
681
- return i.length ? i : [e];
682
- }, Zt = function(e, i) {
746
+ N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f = new WeakMap(), _ = new WeakMap(), Y = new WeakMap(), $ = new WeakMap(), T = new WeakMap(), Et = new WeakMap(), V = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), ot = new WeakMap(), ht = new WeakMap(), St = new WeakMap(), lt = new WeakMap(), vt = new WeakMap(), m = new WeakSet(), Vt = function(e) {
747
+ const s = document.createElement("script");
748
+ for (let i = 0; i < e.attributes.length; i++) {
749
+ const l = e.attributes[i];
750
+ s.setAttribute(l.name, l.value);
751
+ }
752
+ return e.hasAttribute("src") || (s.innerHTML = e.innerHTML), s;
753
+ }, bt = new WeakMap(), Ht = function(e) {
754
+ const s = this.normalizePath(e);
755
+ let i = t(this, V).get(s.pathname);
756
+ return i || (i = new te(this, s.pathname), t(this, V).set(s.pathname, i)), i;
757
+ }, Wt = function(e) {
758
+ const s = [...e.querySelectorAll("[data-morph]")];
759
+ return s.length ? s : [e];
760
+ }, ae = function(e, s) {
683
761
  return e.filter(
684
- (s) => i.find(
685
- (h) => h.outerHTML === s.outerHTML
762
+ (i) => s.find(
763
+ (l) => l.outerHTML === i.outerHTML
686
764
  )
687
765
  );
688
- }, Mt = function(e, i) {
766
+ }, Ft = function(e, s) {
689
767
  return e.filter(
690
- (s) => !i.find(
691
- (h) => h.outerHTML === s.outerHTML
768
+ (i) => !s.find(
769
+ (l) => l.outerHTML === i.outerHTML
692
770
  )
693
771
  );
694
- }, xt = function(e) {
772
+ }, Ot = function(e) {
695
773
  return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
696
- }, Nt = function(e) {
697
- var i, s;
698
- (i = t(this, C)) == null || i.removeEventListener(
774
+ }, Bt = function(e) {
775
+ var s, i;
776
+ (s = t(this, T)) == null || s.removeEventListener(
699
777
  "scroll",
700
- t(this, st)
701
- ), r(this, et, 0), r(this, tt, 0), r(this, C, t(this, R).scrollSelector && e.querySelector(t(this, R).scrollSelector) || window), r(this, lt, t(this, C) === window), (s = t(this, C)) == null || s.addEventListener("scroll", t(this, st)), t(this, st).call(this);
702
- }, Ut = function(e, i) {
703
- const s = typeof e == "string" ? document.getElementById(e) : e;
704
- (typeof s == "number" || s) && he(s, {
705
- scrollElement: t(this, C),
706
- behavior: (i == null ? void 0 : i.behavior) || "instant",
707
- center: i == null ? void 0 : i.centerScroll,
708
- offset: i == null ? void 0 : i.offsetScroll
778
+ t(this, ct)
779
+ ), r(this, ht, 0), r(this, ot, 0), r(this, T, t(this, N).scrollSelector && e.querySelector(t(this, N).scrollSelector) || window), r(this, Et, t(this, T) === window), (i = t(this, T)) == null || i.addEventListener("scroll", t(this, ct)), t(this, ct).call(this);
780
+ }, Xt = function(e, s) {
781
+ const i = typeof e == "string" ? document.getElementById(e) : e;
782
+ (typeof i == "number" || i) && ge(i, {
783
+ scrollElement: t(this, T),
784
+ behavior: (s == null ? void 0 : s.behavior) || "instant",
785
+ center: s == null ? void 0 : s.centerScroll,
786
+ offset: s == null ? void 0 : s.offsetScroll
709
787
  });
710
- }, bt = new WeakMap(), st = new WeakMap(), nt.instance = null;
711
- let Gt = nt;
788
+ }, Tt = new WeakMap(), ct = new WeakMap(), ut.instance = null;
789
+ let ee = ut;
712
790
  export {
713
- Gt as Morph
791
+ ee as Morph
714
792
  };