@ssgoi/core 6.3.0 → 6.4.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.
package/dist/internal.js CHANGED
@@ -1,52 +1,52 @@
1
- var ce = Object.defineProperty;
2
- var ae = (e, n, t) => n in e ? ce(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var W = (e, n, t) => ae(e, typeof n != "symbol" ? n + "" : n, t);
4
- import { A as ue } from "./multi-animation-CnxqLEka.js";
5
- import { M as Ke, W as Ne } from "./multi-animation-CnxqLEka.js";
6
- class fe extends ue {
1
+ var ft = Object.defineProperty;
2
+ var dt = (t, n, e) => n in t ? ft(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var F = (t, n, e) => dt(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { A as ht } from "./multi-animation-CnxqLEka.js";
5
+ import { M as $t, W as qt } from "./multi-animation-CnxqLEka.js";
6
+ class mt extends ht {
7
7
  constructor() {
8
8
  super(...arguments);
9
- W(this, "child", null);
10
- W(this, "_state", "idle");
11
- W(this, "_settled", !1);
12
- W(this, "listeners", /* @__PURE__ */ new Set());
9
+ F(this, "child", null);
10
+ F(this, "_state", "idle");
11
+ F(this, "_settled", !1);
12
+ F(this, "listeners", /* @__PURE__ */ new Set());
13
13
  }
14
- attach(t) {
14
+ attach(e) {
15
15
  const o = this.child;
16
- if (this.child = t, this._settled = !1, o) {
17
- const h = o.getPose();
18
- o.complete(), t.matchInto(h);
16
+ if (this.child = e, this._settled = !1, o) {
17
+ const l = o.getPose();
18
+ o.complete(), e.matchInto(l);
19
19
  }
20
- t.playbackRate = this.playbackRate;
21
- const c = t.onComplete;
22
- t.onComplete = () => {
23
- c == null || c(), this.child === t && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
20
+ e.playbackRate = this.playbackRate;
21
+ const i = e.onComplete;
22
+ e.onComplete = () => {
23
+ i == null || i(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
24
  };
25
- const d = t.onUpdate;
26
- t.onUpdate = (h) => {
27
- var S;
28
- d == null || d(h), (S = this.onUpdate) == null || S.call(this, h), this.notify();
29
- }, this._state === "paused" ? t.pause() : this._state === "reversing" ? t.reverse() : (this._state = "playing", t.play()), this.notify();
25
+ const f = e.onUpdate;
26
+ e.onUpdate = (l) => {
27
+ var d;
28
+ f == null || f(l), (d = this.onUpdate) == null || d.call(this, l), this.notify();
29
+ }, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
30
30
  }
31
31
  play() {
32
- var t;
33
- this._state = "playing", this._settled = !1, (t = this.child) == null || t.play(), this.notify();
32
+ var e;
33
+ this._state = "playing", this._settled = !1, (e = this.child) == null || e.play(), this.notify();
34
34
  }
35
35
  reverse() {
36
- var t;
37
- this._state = "reversing", this._settled = !1, (t = this.child) == null || t.reverse(), this.notify();
36
+ var e;
37
+ this._state = "reversing", this._settled = !1, (e = this.child) == null || e.reverse(), this.notify();
38
38
  }
39
39
  pause() {
40
- var t;
41
- this._state = "paused", (t = this.child) == null || t.pause(), this.notify();
40
+ var e;
41
+ this._state = "paused", (e = this.child) == null || e.pause(), this.notify();
42
42
  }
43
43
  complete() {
44
- var t;
45
- (t = this.child) == null || t.complete(), this.notify();
44
+ var e;
45
+ (e = this.child) == null || e.complete(), this.notify();
46
46
  }
47
47
  get isAnimating() {
48
- var t;
49
- return ((t = this.child) == null ? void 0 : t.isAnimating) ?? !1;
48
+ var e;
49
+ return ((e = this.child) == null ? void 0 : e.isAnimating) ?? !1;
50
50
  }
51
51
  get isPaused() {
52
52
  return this._state === "paused";
@@ -55,459 +55,504 @@ class fe extends ue {
55
55
  return this._settled && !this.child;
56
56
  }
57
57
  get isReversing() {
58
- var t;
59
- return ((t = this.child) == null ? void 0 : t.isReversing) ?? this._state === "reversing";
58
+ var e;
59
+ return ((e = this.child) == null ? void 0 : e.isReversing) ?? this._state === "reversing";
60
60
  }
61
61
  get progress() {
62
- var t;
63
- return ((t = this.child) == null ? void 0 : t.progress) ?? 0;
62
+ var e;
63
+ return ((e = this.child) == null ? void 0 : e.progress) ?? 0;
64
64
  }
65
- findTimeForProgress(t) {
65
+ findTimeForProgress(e) {
66
66
  var o;
67
- return ((o = this.child) == null ? void 0 : o.findTimeForProgress(t)) ?? null;
67
+ return ((o = this.child) == null ? void 0 : o.findTimeForProgress(e)) ?? null;
68
68
  }
69
69
  get playbackRate() {
70
70
  return super.playbackRate;
71
71
  }
72
- set playbackRate(t) {
73
- super.playbackRate = t, this.child && (this.child.playbackRate = t), this.notify();
72
+ set playbackRate(e) {
73
+ super.playbackRate = e, this.child && (this.child.playbackRate = e), this.notify();
74
74
  }
75
75
  getPose() {
76
- var t;
77
- return ((t = this.child) == null ? void 0 : t.getPose()) ?? [];
76
+ var e;
77
+ return ((e = this.child) == null ? void 0 : e.getPose()) ?? [];
78
78
  }
79
79
  getTimeline() {
80
- var t;
81
- return ((t = this.child) == null ? void 0 : t.getTimeline()) ?? [];
80
+ var e;
81
+ return ((e = this.child) == null ? void 0 : e.getTimeline()) ?? [];
82
82
  }
83
- matchInto(t) {
83
+ matchInto(e) {
84
84
  var o;
85
- (o = this.child) == null || o.matchInto(t);
85
+ (o = this.child) == null || o.matchInto(e);
86
86
  }
87
87
  /** Currently attached child, or null when nothing is playing. */
88
88
  get activeChild() {
89
89
  return this.child;
90
90
  }
91
91
  /** Subscribe to host state changes. Returns an unsubscribe fn. */
92
- subscribe(t) {
93
- return this.listeners.add(t), () => {
94
- this.listeners.delete(t);
92
+ subscribe(e) {
93
+ return this.listeners.add(e), () => {
94
+ this.listeners.delete(e);
95
95
  };
96
96
  }
97
97
  notify() {
98
- for (const t of this.listeners) t();
98
+ for (const e of this.listeners) e();
99
99
  }
100
100
  }
101
- const de = (e, n) => {
102
- var t;
103
- e.style.position = "absolute", e.style.width = "100%", e.style.top = `${-1 * (((t = n == null ? void 0 : n.scrollOffset) == null ? void 0 : t.y) ?? 0)}px`, e.style.left = "0";
104
- }, J = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), he = (e) => {
105
- let n = e.parentElement;
101
+ const gt = (t, n) => {
102
+ var e;
103
+ t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((e = n == null ? void 0 : n.scrollOffset) == null ? void 0 : e.y) ?? 0)}px`, t.style.left = "0";
104
+ }, Q = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), yt = (t) => {
105
+ let n = t.parentElement;
106
106
  for (; n && n !== document.body; ) {
107
- const t = window.getComputedStyle(n);
108
- if (J.has(t.overflowY) || J.has(t.overflowX))
107
+ const e = window.getComputedStyle(n);
108
+ if (Q.has(e.overflowY) || Q.has(e.overflowX))
109
109
  return n;
110
110
  n = n.parentElement;
111
111
  }
112
112
  return document.documentElement;
113
- }, me = (e) => {
114
- let n = e.parentElement;
113
+ }, pt = (t) => {
114
+ let n = t.parentElement;
115
115
  for (; n && n !== document.body; ) {
116
- const t = window.getComputedStyle(n).position;
117
- if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
116
+ const e = window.getComputedStyle(n).position;
117
+ if (e === "relative" || e === "absolute" || e === "fixed" || e === "sticky")
118
118
  return n;
119
119
  n = n.parentElement;
120
120
  }
121
121
  return document.body;
122
122
  };
123
- function ge(e) {
124
- const n = Object.keys(e);
125
- return Promise.all(n.map((t) => e[t])).then((t) => {
123
+ function Et(t) {
124
+ const n = Object.keys(t);
125
+ return Promise.all(n.map((e) => t[e])).then((e) => {
126
126
  const o = {};
127
- return n.forEach((c, d) => {
128
- o[c] = t[d];
127
+ return n.forEach((i, f) => {
128
+ o[i] = e[f];
129
129
  }), o;
130
130
  });
131
131
  }
132
- function ye(e) {
133
- const n = e.filter((t) => t.symmetric).map((t) => ({
134
- from: t.to,
135
- to: t.from,
136
- transition: t.transition
132
+ function vt(t) {
133
+ const n = t.filter((e) => e.symmetric).map((e) => ({
134
+ from: e.to,
135
+ to: e.from,
136
+ transition: e.transition
137
137
  }));
138
- return [...e, ...n];
138
+ return [...t, ...n];
139
139
  }
140
- function F(e, n) {
140
+ function W(t, n) {
141
141
  if (n === "*")
142
142
  return !0;
143
143
  if (n.endsWith("/*")) {
144
- const t = n.slice(0, -1);
145
- return e.startsWith(t) && e.length > t.length;
144
+ const e = n.slice(0, -1);
145
+ return t.startsWith(e) && t.length > e.length;
146
146
  }
147
- return e === n;
147
+ return t === n;
148
148
  }
149
- function pe(e, n, t) {
150
- for (const o of t)
151
- if (F(e, o.from) && F(n, o.to))
149
+ function Tt(t, n, e) {
150
+ for (const o of e)
151
+ if (W(t, o.from) && W(n, o.to))
152
152
  return o.transition;
153
- for (const o of t)
154
- if ((o.from === "*" || F(e, o.from)) && (o.to === "*" || F(n, o.to)))
153
+ for (const o of e)
154
+ if ((o.from === "*" || W(t, o.from)) && (o.to === "*" || W(n, o.to)))
155
155
  return o.transition;
156
156
  return null;
157
157
  }
158
- const ve = 768, Ee = 10, we = 10;
159
- function Se(e = {}) {
160
- const { preserveScroll: n = (i) => i } = e, t = typeof n == "function" ? n : () => n;
161
- let o = null, c = !1, d = !1;
162
- const h = () => {
163
- const i = (o == null ? void 0 : o.clientWidth) ?? 0, l = i > 0 ? i : typeof window < "u" ? window.innerWidth : 0;
164
- return l > 0 && l < ve;
165
- }, S = () => (d || (c = h(), d = !0), c), y = (i) => {
158
+ const bt = 768, wt = 10, St = 10;
159
+ function Rt(t = {}) {
160
+ const { preserveScroll: n = (c) => c } = t, e = typeof n == "function" ? n : () => n;
161
+ let o = null, i = !1, f = !1;
162
+ const l = () => {
163
+ const c = (o == null ? void 0 : o.clientWidth) ?? 0, a = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
164
+ return a > 0 && a < bt;
165
+ }, d = () => (f || (i = l(), f = !0), i), g = (c) => {
166
166
  var v;
167
- const l = t(S());
168
- if (l === !1)
169
- return { preserves: !1, shared: !1, storageKey: `path:${i}` };
170
- if (l === !0)
171
- return { preserves: !0, shared: !1, storageKey: `path:${i}` };
172
- const g = ((v = l.exclude) == null ? void 0 : v.some((r) => F(i, r))) ?? !1, p = !g && !!l.key;
167
+ const a = e(d());
168
+ if (a === !1)
169
+ return { preserves: !1, shared: !1, storageKey: `path:${c}` };
170
+ if (a === !0)
171
+ return { preserves: !0, shared: !1, storageKey: `path:${c}` };
172
+ const p = ((v = a.exclude) == null ? void 0 : v.some((r) => W(c, r))) ?? !1, E = !p && !!a.key;
173
173
  return {
174
- preserves: !g,
175
- shared: p,
176
- storageKey: p ? `shared:${l.key}` : `path:${i}`
174
+ preserves: !p,
175
+ shared: E,
176
+ storageKey: E ? `shared:${a.key}` : `path:${c}`
177
177
  };
178
- }, x = (i) => y(i).preserves;
179
- let R = null;
180
- const m = /* @__PURE__ */ new Map();
181
- let T = null, A = !1, O = 0;
178
+ }, L = (c) => g(c).preserves;
179
+ let A = null;
180
+ const y = /* @__PURE__ */ new Map();
181
+ let S = null, O = !1, k = 0;
182
182
  const I = () => {
183
- o && T && !A && m.set(y(T).storageKey, {
183
+ o && S && !O && y.set(g(S).storageKey, {
184
184
  x: o.scrollLeft,
185
185
  y: o.scrollTop
186
186
  });
187
- }, L = (i) => {
187
+ }, _ = (c) => {
188
188
  if (!o) return;
189
- const l = y(i);
190
- if (l.preserves && l.shared && !m.has(l.storageKey))
189
+ const a = g(c);
190
+ if (a.preserves && a.shared && !y.has(a.storageKey))
191
191
  return;
192
- const g = l.preserves && m.has(l.storageKey) ? m.get(l.storageKey) : { x: 0, y: 0 };
193
- let p = 0;
192
+ const p = a.preserves && y.has(a.storageKey) ? y.get(a.storageKey) : { x: 0, y: 0 };
193
+ let E = 0;
194
194
  const v = () => {
195
195
  if (!o) return;
196
196
  o.scrollTo({
197
- top: g.y,
198
- left: g.x
199
- }), !(Math.abs(o.scrollTop - g.y) < 1 && Math.abs(o.scrollLeft - g.x) < 1) && p < Ee && (p++, requestAnimationFrame(v));
197
+ top: p.y,
198
+ left: p.x
199
+ }), !(Math.abs(o.scrollTop - p.y) < 1 && Math.abs(o.scrollLeft - p.x) < 1) && E < wt && (E++, requestAnimationFrame(v));
200
200
  };
201
201
  requestAnimationFrame(v);
202
202
  };
203
203
  return {
204
- initializeContext: (i, l) => {
205
- A = !0;
206
- const g = ++O;
207
- R = i, o || (o = he(i), c = h(), d = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
- c = h();
204
+ initializeContext: (c, a) => {
205
+ O = !0;
206
+ const p = ++k;
207
+ A = c, o || (o = yt(c), i = l(), f = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
+ i = l();
209
209
  }).observe(o), (o === document.documentElement ? window : o).addEventListener("scroll", I, {
210
210
  passive: !0
211
- })), T = l, L(l);
212
- let p = 0;
211
+ })), S = a, _(a);
212
+ let E = 0;
213
213
  const v = () => {
214
- g === O && (p++, p >= we ? A = !1 : requestAnimationFrame(v));
214
+ p === k && (E++, E >= St ? O = !1 : requestAnimationFrame(v));
215
215
  };
216
216
  requestAnimationFrame(v);
217
217
  },
218
- calculateScrollOffset: (i, l) => {
219
- const g = i ? y(i).storageKey : null, p = g && m.has(g) ? m.get(g) : { x: 0, y: 0 }, v = l ? y(l) : null, r = v != null && v.preserves ? v.storageKey : null, s = r && m.has(r) ? m.get(r) : { x: 0, y: 0 };
218
+ calculateScrollOffset: (c, a) => {
219
+ const p = c ? g(c).storageKey : null, E = p && y.has(p) ? y.get(p) : { x: 0, y: 0 }, v = a ? g(a) : null, r = v != null && v.preserves ? v.storageKey : null, s = r && y.has(r) ? y.get(r) : { x: 0, y: 0 };
220
220
  return {
221
- x: -s.x + p.x,
222
- y: -s.y + p.y
221
+ x: -s.x + E.x,
222
+ y: -s.y + E.y
223
223
  };
224
224
  },
225
- evictScrollPosition: (i) => {
226
- m.delete(y(i).storageKey);
225
+ evictScrollPosition: (c) => {
226
+ y.delete(g(c).storageKey);
227
227
  },
228
- shouldPreserve: x,
228
+ shouldPreserve: L,
229
229
  getScrollContainer: () => o,
230
- getPositionedParentElement: () => R ? me(R) : document.body,
231
- getScrollPosition: (i) => {
232
- const l = i ? y(i).storageKey : null;
233
- return l && m.has(l) ? m.get(l) : { x: 0, y: 0 };
230
+ getPositionedParentElement: () => A ? pt(A) : document.body,
231
+ getScrollPosition: (c) => {
232
+ const a = c ? g(c).storageKey : null;
233
+ return a && y.has(a) ? y.get(a) : { x: 0, y: 0 };
234
234
  }
235
235
  };
236
236
  }
237
- const Q = 30, ee = 8, te = 1.2, ne = 30, be = 600;
238
- function Te() {
239
- let e = null, n = !1, t = !1, o = null, c = null, d = !1;
240
- const h = (a, u) => {
241
- for (let f = 0; f < a.length; f++) {
242
- const E = a.item(f);
243
- if (E && E.identifier === u) return E;
237
+ const tt = 30, et = 8, nt = 1.2, ot = 30, At = 600;
238
+ function Ot() {
239
+ let t = null, n = !1, e = !1, o = null, i = null, f = !1;
240
+ const l = (u, h) => {
241
+ for (let m = 0; m < u.length; m++) {
242
+ const T = u.item(m);
243
+ if (T && T.identifier === h) return T;
244
244
  }
245
245
  return null;
246
- }, S = () => {
246
+ }, d = () => {
247
247
  o !== null && (clearTimeout(o), o = null);
248
- }, y = () => {
249
- c !== null && (clearTimeout(c), c = null);
250
- }, x = () => {
251
- n = !0, t = !0, S(), y(), o = setTimeout(() => {
252
- n = !1, t = !1, o = null;
253
- }, be);
254
- }, R = (a) => {
255
- if (a.touches.length !== 1) {
256
- e = null;
248
+ }, g = () => {
249
+ i !== null && (clearTimeout(i), i = null);
250
+ }, L = () => {
251
+ n = !0, e = !0, d(), g(), o = setTimeout(() => {
252
+ n = !1, e = !1, o = null;
253
+ }, At);
254
+ }, A = (u) => {
255
+ if (u.touches.length !== 1) {
256
+ t = null;
257
257
  return;
258
258
  }
259
- const u = a.touches.item(0);
260
- if (!u) {
261
- e = null;
259
+ const h = u.touches.item(0);
260
+ if (!h) {
261
+ t = null;
262
262
  return;
263
263
  }
264
- const f = window.innerWidth, E = u.clientX <= Q, P = u.clientX >= f - Q;
265
- if (!E && !P) {
266
- e = null;
264
+ const m = window.innerWidth, T = h.clientX <= tt, R = h.clientX >= m - tt;
265
+ if (!T && !R) {
266
+ t = null;
267
267
  return;
268
268
  }
269
- e = {
270
- identifier: u.identifier,
271
- startX: u.clientX,
272
- startY: u.clientY,
273
- fromLeftEdge: E,
269
+ t = {
270
+ identifier: h.identifier,
271
+ startX: h.clientX,
272
+ startY: h.clientY,
273
+ fromLeftEdge: T,
274
274
  moved: !1
275
275
  };
276
- }, m = (a) => {
277
- if (!e) return;
278
- if (a.touches.length !== 1) {
279
- e = null;
276
+ }, y = (u) => {
277
+ if (!t) return;
278
+ if (u.touches.length !== 1) {
279
+ t = null;
280
280
  return;
281
281
  }
282
- const u = h(a.touches, e.identifier);
283
- if (!u) {
284
- e = null;
282
+ const h = l(u.touches, t.identifier);
283
+ if (!h) {
284
+ t = null;
285
285
  return;
286
286
  }
287
- const f = u.clientX - e.startX, E = u.clientY - e.startY, P = Math.abs(f), i = Math.abs(E);
288
- if (i > ee && i > P * te) {
289
- e = null;
287
+ const m = h.clientX - t.startX, T = h.clientY - t.startY, R = Math.abs(m), c = Math.abs(T);
288
+ if (c > et && c > R * nt) {
289
+ t = null;
290
290
  return;
291
291
  }
292
- const l = e.fromLeftEdge ? f > 0 : f < 0;
293
- P > ee && P > i * te && l && (e.moved = !0);
294
- }, T = (a) => {
295
- if (!e) return;
296
- const u = h(a.changedTouches, e.identifier);
297
- if (!u) {
298
- e = null;
292
+ const a = t.fromLeftEdge ? m > 0 : m < 0;
293
+ R > et && R > c * nt && a && (t.moved = !0);
294
+ }, S = (u) => {
295
+ if (!t) return;
296
+ const h = l(u.changedTouches, t.identifier);
297
+ if (!h) {
298
+ t = null;
299
299
  return;
300
300
  }
301
- const f = u.clientX - e.startX, E = e.fromLeftEdge ? f > 0 : f < 0;
302
- if (e.moved && E && Math.abs(f) >= ne) {
303
- x(), e = null;
301
+ const m = h.clientX - t.startX, T = t.fromLeftEdge ? m > 0 : m < 0;
302
+ if (t.moved && T && Math.abs(m) >= ot) {
303
+ L(), t = null;
304
304
  return;
305
305
  }
306
- e.moved && Math.abs(f) >= ne && x(), e = null;
307
- }, A = () => {
308
- e && (e.moved && x(), e = null);
306
+ t.moved && Math.abs(m) >= ot && L(), t = null;
307
+ }, O = () => {
308
+ t && (t.moved && L(), t = null);
309
309
  };
310
310
  return { initialize: () => {
311
- if (typeof window > "u" || d) return;
312
- d = !0;
313
- const a = { passive: !0, capture: !0 };
314
- window.addEventListener("touchstart", R, a), window.addEventListener("touchmove", m, a), window.addEventListener("touchend", T, a), window.addEventListener("touchcancel", A, a);
311
+ if (typeof window > "u" || f) return;
312
+ f = !0;
313
+ const u = { passive: !0, capture: !0 };
314
+ window.addEventListener("touchstart", A, u), window.addEventListener("touchmove", y, u), window.addEventListener("touchend", S, u), window.addEventListener("touchcancel", O, u);
315
315
  }, destroy: () => {
316
- if (typeof window > "u" || !d) return;
317
- d = !1;
318
- const a = { capture: !0 };
319
- window.removeEventListener("touchstart", R, a), window.removeEventListener("touchmove", m, a), window.removeEventListener("touchend", T, a), window.removeEventListener("touchcancel", A, a), S(), y(), e = null, n = !1, t = !1;
316
+ if (typeof window > "u" || !f) return;
317
+ f = !1;
318
+ const u = { capture: !0 };
319
+ window.removeEventListener("touchstart", A, u), window.removeEventListener("touchmove", y, u), window.removeEventListener("touchend", S, u), window.removeEventListener("touchcancel", O, u), d(), g(), t = null, n = !1, e = !1;
320
320
  }, isSwipeBack: () => {
321
- const a = n || t;
322
- return a && S(), a;
321
+ const u = n || e;
322
+ return u && d(), u;
323
323
  }, onPageEnter: () => {
324
- n = !1, S(), y(), c = setTimeout(() => {
325
- t = !1, c = null;
324
+ n = !1, d(), g(), i = setTimeout(() => {
325
+ e = !1, i = null;
326
326
  }, 0);
327
327
  } };
328
328
  }
329
- function Pe() {
330
- let e = null;
329
+ function Pt() {
330
+ let t = null;
331
331
  function n() {
332
- var o, c;
333
- e && ((o = e.outResolve) == null || o.call(e, null), (c = e.inResolve) == null || c.call(e, null), e = null);
332
+ var o, i;
333
+ t && ((o = t.outResolve) == null || o.call(t, null), (i = t.inResolve) == null || i.call(t, null), t = null);
334
334
  }
335
- function t() {
336
- if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
337
- if (e.from === e.to) {
335
+ function e() {
336
+ if (t != null && t.from && (t != null && t.to) && (t != null && t.outResolve) && (t != null && t.inResolve)) {
337
+ if (t.from === t.to) {
338
338
  n();
339
339
  return;
340
340
  }
341
- const o = { from: e.from, to: e.to };
342
- e.outResolve(o), e.inResolve(o), e = null;
341
+ const o = { from: t.from, to: t.to };
342
+ t.outResolve(o), t.inResolve(o), t = null;
343
343
  }
344
344
  }
345
345
  return {
346
- trigger(o, c) {
347
- var h;
348
- c === "out" && (e == null ? void 0 : e.to) === o && !e.from && ((h = e.inResolve) == null || h.call(e, null), e = {}), e && (c === "out" && e.from && e.from !== o || c === "in" && e.to && e.to !== o) && n(), e || (e = {}), c === "out" ? e.from = o : e.to = o;
346
+ trigger(o, i) {
347
+ var l;
348
+ i === "out" && (t == null ? void 0 : t.to) === o && !t.from && ((l = t.inResolve) == null || l.call(t, null), t = {}), t && (i === "out" && t.from && t.from !== o || i === "in" && t.to && t.to !== o) && n(), t || (t = {}), i === "out" ? t.from = o : t.to = o;
349
349
  },
350
350
  get(o) {
351
- return new Promise((c) => {
352
- e || (e = {}), o === "out" ? e.outResolve = c : e.inResolve = c, t();
351
+ return new Promise((i) => {
352
+ t || (t = {}), o === "out" ? t.outResolve = i : t.inResolve = i, e();
353
353
  });
354
354
  }
355
355
  };
356
356
  }
357
- const X = /* @__PURE__ */ new Map();
358
- let z = null, oe = !1;
359
- function re(e) {
360
- if (e instanceof HTMLElement && X.has(e)) {
361
- const n = X.get(e);
362
- X.delete(e), queueMicrotask(n);
357
+ const B = /* @__PURE__ */ new Map();
358
+ let H = null, rt = !1;
359
+ function it(t) {
360
+ if (t instanceof HTMLElement && B.has(t)) {
361
+ const n = B.get(t);
362
+ B.delete(t), queueMicrotask(n);
363
363
  }
364
- for (const n of Array.from(e.childNodes))
365
- re(n);
364
+ for (const n of Array.from(t.childNodes))
365
+ it(n);
366
366
  }
367
- function Re() {
368
- if (oe || typeof document > "u") return;
369
- oe = !0, z = new MutationObserver((n) => {
370
- for (const t of n)
371
- for (const o of Array.from(t.removedNodes))
372
- re(o);
367
+ function Lt() {
368
+ if (rt || typeof document > "u") return;
369
+ rt = !0, H = new MutationObserver((n) => {
370
+ for (const e of n)
371
+ for (const o of Array.from(e.removedNodes))
372
+ it(o);
373
373
  });
374
- const e = () => {
375
- z == null || z.observe(document.body, { childList: !0, subtree: !0 });
374
+ const t = () => {
375
+ H == null || H.observe(document.body, { childList: !0, subtree: !0 });
376
376
  };
377
- document.body ? e() : document.addEventListener("DOMContentLoaded", e, { once: !0 });
377
+ document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
378
378
  }
379
- function Ae(e, n) {
380
- return Re(), X.set(e, n), () => {
381
- X.delete(e);
379
+ function _t(t, n) {
380
+ return Lt(), B.set(t, n), () => {
381
+ B.delete(t);
382
382
  };
383
383
  }
384
- function xe(e) {
385
- return Array.isArray(e);
384
+ function Mt(t) {
385
+ return Array.isArray(t);
386
386
  }
387
- function se(e) {
387
+ function lt(t) {
388
388
  const n = [];
389
- for (const t of e)
390
- xe(t) ? n.push(...se(t)) : n.push(t);
389
+ for (const e of t)
390
+ Mt(e) ? n.push(...lt(e)) : n.push(e);
391
391
  return n;
392
392
  }
393
- function Ce(e, n = {}) {
393
+ function Dt(t, n = {}) {
394
394
  const {
395
- transitions: t = [],
395
+ transitions: e = [],
396
396
  middleware: o = (r, s) => ({ from: r, to: s }),
397
- preserveScroll: c = (r) => r
398
- } = e, d = n.host ?? new fe(), h = Pe(), S = ye(
399
- se(t)
400
- ), y = Te();
401
- y.initialize();
397
+ preserveScroll: i = (r) => r
398
+ } = t, f = n.host ?? new mt(), l = Pt(), d = vt(
399
+ lt(e)
400
+ ), g = Ot();
401
+ g.initialize();
402
402
  const {
403
- initializeContext: x,
404
- calculateScrollOffset: R,
405
- evictScrollPosition: m,
406
- shouldPreserve: T,
407
- getScrollContainer: A,
408
- getPositionedParentElement: O,
403
+ initializeContext: L,
404
+ calculateScrollOffset: A,
405
+ evictScrollPosition: y,
406
+ shouldPreserve: S,
407
+ getScrollContainer: O,
408
+ getPositionedParentElement: k,
409
409
  getScrollPosition: I
410
- } = Se({ preserveScroll: c });
411
- let L = null, k = null;
412
- const a = /* @__PURE__ */ new WeakMap(), u = (r) => {
413
- a.set(r, {
410
+ } = Rt({ preserveScroll: i });
411
+ let _ = null, x = null;
412
+ const u = /* @__PURE__ */ new WeakMap(), h = (r) => {
413
+ u.set(r, {
414
414
  parent: r.parentElement,
415
415
  nextSibling: r.nextElementSibling
416
416
  });
417
- }, f = (r) => {
418
- const s = a.get(r);
417
+ }, m = (r) => {
418
+ const s = u.get(r);
419
419
  return s || {
420
420
  parent: r.parentElement,
421
421
  nextSibling: r.nextElementSibling
422
422
  };
423
- }, E = (r, s, b, w, B) => {
424
- const K = w.element, D = B.element, { parent: _, nextSibling: C } = w.parent ? { parent: w.parent, nextSibling: w.nextSibling } : f(K), M = K.cloneNode(!0), H = {
425
- scrollOffset: R(s, b),
423
+ }, T = (r, s, w, b, D) => {
424
+ const N = b.element, X = D.element, { parent: M, nextSibling: C } = b.parent ? { parent: b.parent, nextSibling: b.nextSibling } : m(N), P = N.cloneNode(!0);
425
+ P.setAttribute("data-ssgoi-clone", "");
426
+ const z = {
427
+ scrollOffset: A(s, w),
426
428
  from: { scroll: I(s) },
427
- to: { scroll: I(b) },
429
+ to: { scroll: I(w) },
428
430
  get scrollingElement() {
429
- return A() || document.documentElement;
431
+ return O() || document.documentElement;
430
432
  },
431
433
  get positionedParent() {
432
- return O();
434
+ return k();
433
435
  }
434
436
  };
435
- de(M, H), T(s) || m(s);
436
- const V = Promise.resolve(M), Z = Promise.resolve(D), j = [], ie = {
437
- from: V,
438
- to: Z,
439
- context: H,
440
- createElement: ((q, Y = "div") => {
441
- const N = document.createElement(Y);
442
- return N.setAttribute("data-ssgoi-id", q), j.push(N), N;
437
+ gt(P, z), S(s) || y(s);
438
+ const Z = Promise.resolve(P), j = Promise.resolve(X), J = [], at = {
439
+ from: Z,
440
+ to: j,
441
+ context: z,
442
+ createElement: (($, q = "div") => {
443
+ const K = document.createElement(q);
444
+ return K.setAttribute("data-ssgoi-id", $), J.push(K), K;
443
445
  })
444
- }, le = Promise.resolve(
445
- r.prepare ? r.prepare(ie) : {}
446
+ }, ut = Promise.resolve(
447
+ r.prepare ? r.prepare(at) : {}
446
448
  );
447
- ge({
448
- from: V,
449
- to: Z,
450
- extras: le
451
- }).then(({ from: q, to: Y, extras: N }) => {
452
- _ && (C && _.contains(C) ? _.insertBefore(M, C) : _.appendChild(M));
453
- const $ = r.animation({
454
- from: q,
455
- to: Y,
456
- context: H,
457
- ...N
458
- }), G = $.onComplete;
459
- $.onComplete = () => {
460
- G == null || G(), M.parentElement && M.parentElement.removeChild(M);
461
- for (const U of j)
462
- U.parentElement && U.parentElement.removeChild(U);
463
- }, d.attach($);
449
+ Et({
450
+ from: Z,
451
+ to: j,
452
+ extras: ut
453
+ }).then(({ from: $, to: q, extras: K }) => {
454
+ M && (C && M.contains(C) ? M.insertBefore(P, C) : M.appendChild(P));
455
+ const U = r.animation({
456
+ from: $,
457
+ to: q,
458
+ context: z,
459
+ ...K
460
+ }), Y = U.onComplete;
461
+ U.onComplete = () => {
462
+ Y == null || Y(), P.parentElement && P.parentElement.removeChild(P);
463
+ for (const G of J)
464
+ G.parentElement && G.parentElement.removeChild(G);
465
+ }, f.attach(U);
464
466
  });
465
- }, P = (r, s) => {
466
- const b = y.isSwipeBack();
467
- h.trigger(r, s), h.get(s).then((w) => {
468
- if (s === "in" && y.onPageEnter(), !w) return;
469
- if (b) {
470
- s === "out" && w.from && !T(w.from) && m(w.from), L = null, k = null;
467
+ }, R = (r, s) => {
468
+ const w = g.isSwipeBack();
469
+ l.trigger(r, s), l.get(s).then((b) => {
470
+ if (s === "in" && g.onPageEnter(), !b) return;
471
+ if (w) {
472
+ s === "out" && b.from && !S(b.from) && y(b.from), _ = null, x = null;
471
473
  return;
472
474
  }
473
475
  if (s !== "in") return;
474
- const { from: B, to: K } = o(
475
- w.from,
476
- w.to
477
- ), D = pe(
478
- B,
479
- K,
480
- S
481
- ), _ = L, C = k;
482
- L = null, k = null, !(!D || !_ || !C) && E(D, B, K, _, C);
476
+ const { from: D, to: N } = o(
477
+ b.from,
478
+ b.to
479
+ ), X = Tt(
480
+ D,
481
+ N,
482
+ d
483
+ ), M = _, C = x;
484
+ _ = null, x = null, !(!X || !M || !C) && T(X, D, N, M, C);
483
485
  });
484
- }, i = (r, s) => {
485
- const b = f(r);
486
- L = {
486
+ }, c = (r, s) => {
487
+ const w = m(r);
488
+ _ = {
487
489
  element: r,
488
- parent: b.parent,
489
- nextSibling: b.nextSibling
490
+ parent: w.parent,
491
+ nextSibling: w.nextSibling
490
492
  };
491
- const w = r.getAttribute("data-ssgoi-transition") ?? s;
492
- P(w, "out");
493
- }, l = /* @__PURE__ */ new WeakSet(), g = (r, s) => {
494
- l.has(s) || (l.add(s), u(s), x(s, r), k = {
493
+ const b = r.getAttribute("data-ssgoi-transition") ?? s;
494
+ R(b, "out");
495
+ }, a = /* @__PURE__ */ new WeakSet(), p = (r, s) => {
496
+ a.has(s) || (a.add(s), h(s), L(s, r), x = {
495
497
  element: s,
496
498
  parent: s.parentElement,
497
499
  nextSibling: s.nextElementSibling
498
- }, P(r, "in"), Ae(s, () => i(s, r)));
499
- }, p = /* @__PURE__ */ new Map();
500
- return { register: g, refFor: (r) => {
501
- let s = p.get(r);
502
- return s || (s = (b) => {
503
- b && g(r, b);
504
- }, p.set(r, s)), s;
500
+ }, R(r, "in"), _t(s, () => c(s, r)));
501
+ }, E = /* @__PURE__ */ new Map();
502
+ return { register: p, refFor: (r) => {
503
+ let s = E.get(r);
504
+ return s || (s = (w) => {
505
+ w && p(r, w);
506
+ }, E.set(r, s)), s;
505
507
  } };
506
508
  }
509
+ const ct = "data-ssgoi-root", xt = `[${ct}]`, V = "data-ssgoi-transition", st = `[${V}]`, Ct = "[data-ssgoi-clone]";
510
+ function kt() {
511
+ return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
512
+ }
513
+ function It(t) {
514
+ return t.nodeType === Node.ELEMENT_NODE;
515
+ }
516
+ function Nt(t) {
517
+ return t instanceof HTMLElement;
518
+ }
519
+ function Xt(t, n) {
520
+ if (!kt()) return () => {
521
+ };
522
+ t.setAttribute(ct, "");
523
+ const e = (l) => l.closest(xt) === t, o = (l) => {
524
+ if (!Nt(l) || !e(l) || l.closest(Ct))
525
+ return;
526
+ const d = l.getAttribute(V);
527
+ d !== null && n.register(d, l);
528
+ }, i = (l) => {
529
+ if (It(l)) {
530
+ l.matches(st) && o(l);
531
+ for (const d of l.querySelectorAll(st))
532
+ o(d);
533
+ }
534
+ }, f = new MutationObserver((l) => {
535
+ for (const d of l) {
536
+ if (d.type === "attributes") {
537
+ o(d.target);
538
+ continue;
539
+ }
540
+ for (const g of d.addedNodes)
541
+ i(g);
542
+ }
543
+ });
544
+ return f.observe(t, {
545
+ childList: !0,
546
+ subtree: !0,
547
+ attributes: !0,
548
+ attributeFilter: [V]
549
+ }), i(t), () => f.disconnect();
550
+ }
507
551
  export {
508
- ue as Animation,
509
- fe as HostAnimation,
510
- Ke as MultiAnimation,
511
- Ne as WebAnimation,
512
- Ce as createSggoiTransitionContext
552
+ ht as Animation,
553
+ mt as HostAnimation,
554
+ $t as MultiAnimation,
555
+ qt as WebAnimation,
556
+ Dt as createSggoiTransitionContext,
557
+ Xt as observeSsgoiTransitions
513
558
  };