@ssgoi/core 5.0.2 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/animator/multi-animator.d.ts.map +1 -1
  2. package/dist/animator/runner/keyframes-runner.d.ts +14 -0
  3. package/dist/animator/runner/keyframes-runner.d.ts.map +1 -0
  4. package/dist/animator/runner/provider.d.ts +12 -3
  5. package/dist/animator/runner/provider.d.ts.map +1 -1
  6. package/dist/animator/single-animator.d.ts +7 -0
  7. package/dist/animator/single-animator.d.ts.map +1 -1
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.js +636 -506
  10. package/dist/{provider-Cu4NSF1Q.js → provider-B2B8CK6H.js} +37 -62
  11. package/dist/provider-BKaONTeg.cjs +1 -0
  12. package/dist/spring-integrator-95Mh7mdw.cjs +1 -0
  13. package/dist/spring-integrator-BM4a-82c.js +33 -0
  14. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +2 -2
  15. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  16. package/dist/ssgoi-transition/create-swipe-back-detector.d.ts +43 -0
  17. package/dist/ssgoi-transition/create-swipe-back-detector.d.ts.map +1 -0
  18. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +2 -2
  19. package/dist/transitions/index.cjs +1 -1
  20. package/dist/transitions/index.js +33 -32
  21. package/dist/types.cjs +1 -1
  22. package/dist/types.d.ts +77 -73
  23. package/dist/types.d.ts.map +1 -1
  24. package/dist/types.js +44 -36
  25. package/dist/utils/index.d.ts +0 -4
  26. package/dist/utils/index.d.ts.map +1 -1
  27. package/dist/view-transitions/film.d.ts.map +1 -1
  28. package/dist/view-transitions/index.cjs +15 -15
  29. package/dist/view-transitions/index.js +884 -775
  30. package/dist/view-transitions/instagram.d.ts.map +1 -1
  31. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/dist/provider-Cs5iBqRD.cjs +0 -1
  34. package/dist/ssgoi-transition/create-navigation-direction-detector.d.ts +0 -20
  35. package/dist/ssgoi-transition/create-navigation-direction-detector.d.ts.map +0 -1
  36. package/dist/utils/is-android.d.ts +0 -5
  37. package/dist/utils/is-android.d.ts.map +0 -1
  38. package/dist/utils/is-desktop.d.ts +0 -5
  39. package/dist/utils/is-desktop.d.ts.map +0 -1
  40. package/dist/utils/is-ios.d.ts +0 -6
  41. package/dist/utils/is-ios.d.ts.map +0 -1
  42. package/dist/utils/match-platform.d.ts +0 -8
  43. package/dist/utils/match-platform.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,65 +1,66 @@
1
- var it = Object.defineProperty;
2
- var nt = (e, n, t) => n in e ? it(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var f = (e, n, t) => nt(e, typeof n != "symbol" ? n + "" : n, t);
4
- import { normalizeToMultiAnimation as M, normalizeSchedule as j } from "./types.js";
5
- import { isCssAnimation as Yt, isMultiAnimation as Kt, isSingleAnimation as $t, isTickAnimation as Jt } from "./types.js";
6
- import { S as Y, I as rt, a as ot } from "./provider-Cu4NSF1Q.js";
7
- class st {
1
+ var et = Object.defineProperty;
2
+ var nt = (e, i, t) => i in e ? et(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
+ var d = (e, i, t) => nt(e, typeof i != "symbol" ? i + "" : i, t);
4
+ import { normalizeToMultiAnimation as F, normalizeSchedule as W } from "./types.js";
5
+ import { isCssAnimation as Gt, isKeyframesAnimation as $t, isMultiAnimation as Zt, isSingleAnimation as Jt, isTickAnimation as Qt } from "./types.js";
6
+ import { S as G, a as it } from "./spring-integrator-BM4a-82c.js";
7
+ import { I as rt } from "./provider-B2B8CK6H.js";
8
+ class ot {
8
9
  constructor() {
9
- f(this, "listeners", /* @__PURE__ */ new Set());
10
- f(this, "rafId", null);
11
- f(this, "isRunning", !1);
10
+ d(this, "listeners", /* @__PURE__ */ new Set());
11
+ d(this, "rafId", null);
12
+ d(this, "isRunning", !1);
12
13
  // Timing
13
- f(this, "startTime", Date.now());
14
- f(this, "lastUpdate", this.startTime);
15
- f(this, "elapsed", 0);
14
+ d(this, "startTime", Date.now());
15
+ d(this, "lastUpdate", this.startTime);
16
+ d(this, "elapsed", 0);
16
17
  // Lag smoothing (mobile optimization)
17
- f(this, "lagThreshold", 500);
18
+ d(this, "lagThreshold", 500);
18
19
  // ms - detect tab switches, backgrounding
19
- f(this, "adjustedLag", 33);
20
+ d(this, "adjustedLag", 33);
20
21
  // ms - max time jump to prevent animation skip
21
- f(this, "maxDeltaTime", 33);
22
+ d(this, "maxDeltaTime", 33);
22
23
  // ms - clamp for physics stability (30fps minimum)
23
24
  // FPS throttling
24
- f(this, "gap", 1e3 / 240);
25
+ d(this, "gap", 1e3 / 240);
25
26
  // max 240fps
26
- f(this, "nextTime", this.gap);
27
- f(this, "tick", () => {
28
- const n = Date.now();
29
- let i = n - this.lastUpdate;
30
- i > this.lagThreshold || i < 0 ? (this.startTime += i - this.adjustedLag, i = this.adjustedLag) : i > this.maxDeltaTime && (i = this.maxDeltaTime), this.lastUpdate = n;
31
- const r = n - this.startTime, o = r - this.nextTime;
27
+ d(this, "nextTime", this.gap);
28
+ d(this, "tick", () => {
29
+ const i = Date.now();
30
+ let n = i - this.lastUpdate;
31
+ n > this.lagThreshold || n < 0 ? (this.startTime += n - this.adjustedLag, n = this.adjustedLag) : n > this.maxDeltaTime && (n = this.maxDeltaTime), this.lastUpdate = i;
32
+ const r = i - this.startTime, o = r - this.nextTime;
32
33
  if (o > 0) {
33
- const l = i / 1e3;
34
- this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((u) => {
35
- u(l, this.elapsed);
34
+ const s = n / 1e3;
35
+ this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((f) => {
36
+ f(s, this.elapsed);
36
37
  });
37
38
  }
38
39
  this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
39
40
  });
40
41
  }
41
- subscribe(n) {
42
- return this.listeners.add(n), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
43
- this.unsubscribe(n);
42
+ subscribe(i) {
43
+ return this.listeners.add(i), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
44
+ this.unsubscribe(i);
44
45
  };
45
46
  }
46
- unsubscribe(n) {
47
- this.listeners.delete(n), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
47
+ unsubscribe(i) {
48
+ this.listeners.delete(i), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
48
49
  }
49
50
  /**
50
51
  * Configure lag smoothing behavior
51
52
  * @param threshold - Time threshold to detect lag (default: 500ms)
52
53
  * @param adjustedLag - Max time jump when lag detected (default: 33ms)
53
54
  */
54
- lagSmoothing(n, t) {
55
- this.lagThreshold = n, this.adjustedLag = Math.min(t, n);
55
+ lagSmoothing(i, t) {
56
+ this.lagThreshold = i, this.adjustedLag = Math.min(t, i);
56
57
  }
57
58
  /**
58
59
  * Set maximum FPS
59
60
  * @param fps - Target FPS (default: 240)
60
61
  */
61
- fps(n) {
62
- this.gap = 1e3 / n, this.nextTime = this.elapsed * 1e3 + this.gap;
62
+ fps(i) {
63
+ this.gap = 1e3 / i, this.nextTime = this.elapsed * 1e3 + this.gap;
63
64
  }
64
65
  getListenerCount() {
65
66
  return this.listeners.size;
@@ -68,182 +69,255 @@ class st {
68
69
  return this.elapsed;
69
70
  }
70
71
  }
71
- const q = new st();
72
- function at(e) {
72
+ const z = new ot();
73
+ function st(e) {
73
74
  const {
74
- integrator: n,
75
+ integrator: i,
75
76
  from: t,
76
- to: i,
77
+ to: n,
77
78
  velocity: r = 0,
78
79
  onUpdate: o,
79
- onComplete: l,
80
- onStart: u
80
+ onComplete: s,
81
+ onStart: f
81
82
  } = e;
82
- let s = { position: t, velocity: r }, c = !0, d = 0, w = !1;
83
- const b = (E) => {
84
- if (c) {
85
- if (w || (w = !0, u == null || u()), s = n.step(s, i, E), n.isSettled(s, i)) {
86
- if (d += Math.min(E, 0.033), d >= Y) {
87
- s = { position: i, velocity: 0 }, c = !1, o(s.position), q.unsubscribe(b), l();
83
+ let l = { position: t, velocity: r }, m = !0, h = 0, v = !1;
84
+ const A = (S) => {
85
+ if (m) {
86
+ if (v || (v = !0, f == null || f()), l = i.step(l, n, S), i.isSettled(l, n)) {
87
+ if (h += Math.min(S, 0.033), h >= G) {
88
+ l = { position: n, velocity: 0 }, m = !1, o(l.position), z.unsubscribe(A), s();
88
89
  return;
89
90
  }
90
91
  } else
91
- d = 0;
92
- o(s.position);
92
+ h = 0;
93
+ o(l.position);
93
94
  }
94
95
  };
95
- return q.subscribe(b), {
96
+ return z.subscribe(A), {
96
97
  stop: () => {
97
- c && (c = !1, q.unsubscribe(b));
98
+ m && (m = !1, z.unsubscribe(A));
98
99
  },
99
- getPosition: () => s.position,
100
- getVelocity: () => s.velocity,
101
- isRunning: () => c
100
+ getPosition: () => l.position,
101
+ getVelocity: () => l.velocity,
102
+ isRunning: () => m
102
103
  };
103
104
  }
104
- const O = 1e3 / 60;
105
- function ct(e, n, t, i = 0) {
106
- let o = { position: n, velocity: i }, l = 0;
107
- const u = [];
108
- for (let s = 0; s < 600; s++) {
109
- const c = s * O;
110
- if (u.push({
111
- time: c,
105
+ const L = 1e3 / 60;
106
+ function at(e, i, t, n = 0) {
107
+ let o = { position: i, velocity: n }, s = 0;
108
+ const f = [];
109
+ for (let l = 0; l < 600; l++) {
110
+ const m = l * L;
111
+ if (f.push({
112
+ time: m,
112
113
  position: o.position,
113
114
  velocity: o.velocity
114
- }), o = e.step(o, t, O / 1e3), e.isSettled(o, t)) {
115
- if (l += O / 1e3, l >= Y) {
116
- u.push({
117
- time: (s + 1) * O,
115
+ }), o = e.step(o, t, L / 1e3), e.isSettled(o, t)) {
116
+ if (s += L / 1e3, s >= G) {
117
+ f.push({
118
+ time: (l + 1) * L,
118
119
  position: t,
119
120
  velocity: 0
120
121
  });
121
122
  break;
122
123
  }
123
124
  } else
124
- l = 0;
125
+ s = 0;
125
126
  }
126
- return u;
127
+ return f;
127
128
  }
128
- function H(e, n) {
129
+ function H(e, i) {
129
130
  if (e.length === 0)
130
131
  return { position: 0, velocity: 0 };
131
- const t = e[0], i = e[e.length - 1];
132
- if (n <= 0)
132
+ const t = e[0], n = e[e.length - 1];
133
+ if (i <= 0)
133
134
  return { position: t.position, velocity: t.velocity };
134
- if (n >= i.time)
135
- return { position: i.position, velocity: i.velocity };
135
+ if (i >= n.time)
136
+ return { position: n.position, velocity: n.velocity };
136
137
  let r = 0, o = e.length - 1;
137
138
  for (; r < o - 1; ) {
138
- const c = Math.floor((r + o) / 2);
139
- e[c].time <= n ? r = c : o = c;
139
+ const m = Math.floor((r + o) / 2);
140
+ e[m].time <= i ? r = m : o = m;
140
141
  }
141
- const l = e[r], u = e[o], s = (n - l.time) / (u.time - l.time);
142
+ const s = e[r], f = e[o], l = (i - s.time) / (f.time - s.time);
142
143
  return {
143
- position: l.position + (u.position - l.position) * s,
144
- velocity: l.velocity + (u.velocity - l.velocity) * s
144
+ position: s.position + (f.position - s.position) * l,
145
+ velocity: s.velocity + (f.velocity - s.velocity) * l
145
146
  };
146
147
  }
147
- function lt(e, n) {
148
- return e.map((t) => n(t.position));
148
+ function ct(e, i) {
149
+ return e.map((t) => i(t.position));
149
150
  }
150
- function ut(e) {
151
+ function lt(e) {
151
152
  const {
152
- integrator: n,
153
+ integrator: i,
153
154
  element: t,
154
- from: i,
155
+ from: n,
155
156
  to: r,
156
157
  velocity: o = 0,
157
- style: l,
158
- onComplete: u,
159
- onStart: s
160
- } = e, c = ct(n, i, r, o);
161
- if (c.length === 0)
162
- return s == null || s(), u(), {
158
+ style: s,
159
+ onComplete: f,
160
+ onStart: l
161
+ } = e, m = at(i, n, r, o);
162
+ if (m.length === 0)
163
+ return l == null || l(), f(), {
163
164
  stop: () => {
164
165
  },
165
166
  getPosition: () => r,
166
167
  getVelocity: () => 0,
167
168
  isRunning: () => !1
168
169
  };
169
- const d = lt(c, l), w = c[c.length - 1], b = w.time, E = d[0];
170
- if (E)
171
- for (const A of Object.keys(E))
172
- t.style[A] = "";
173
- const y = t.animate(d, {
174
- duration: b,
170
+ const h = ct(m, s), v = m[m.length - 1], A = v.time, S = h[0];
171
+ if (S)
172
+ for (const T of Object.keys(S))
173
+ t.style[T] = "";
174
+ const y = t.animate(h, {
175
+ duration: A,
175
176
  fill: "forwards",
176
177
  easing: "linear",
177
178
  composite: "replace"
178
179
  });
179
180
  let p = !0;
180
- const T = performance.now();
181
- return s == null || s(), y.onfinish = () => {
182
- p && (p = !1, u());
181
+ const k = performance.now();
182
+ return l == null || l(), y.onfinish = () => {
183
+ p && (p = !1, f());
183
184
  }, {
184
185
  stop: () => {
185
186
  p && (p = !1, y.cancel());
186
187
  },
187
188
  getPosition: () => {
188
189
  if (!p)
189
- return w.position;
190
- const A = performance.now() - T;
191
- return H(c, A).position;
190
+ return v.position;
191
+ const T = performance.now() - k;
192
+ return H(m, T).position;
192
193
  },
193
194
  getVelocity: () => {
194
195
  if (!p)
195
196
  return 0;
196
- const A = performance.now() - T;
197
- return H(c, A).velocity;
197
+ const T = performance.now() - k;
198
+ return H(m, T).velocity;
198
199
  },
199
200
  isRunning: () => p
200
201
  };
201
202
  }
203
+ function ut(e) {
204
+ const {
205
+ element: i,
206
+ frames: t,
207
+ duration: n,
208
+ easing: r = "linear",
209
+ from: o,
210
+ to: s,
211
+ onComplete: f,
212
+ onStart: l
213
+ } = e, m = t[0];
214
+ if (m)
215
+ for (const S of Object.keys(m))
216
+ S === "offset" || S === "easing" || S === "composite" || (i.style[S] = "");
217
+ const h = i.animate(t, {
218
+ duration: n,
219
+ fill: "forwards",
220
+ easing: r,
221
+ composite: "replace"
222
+ });
223
+ let v = !0;
224
+ const A = performance.now();
225
+ return l == null || l(), h.onfinish = () => {
226
+ v && (v = !1, f());
227
+ }, {
228
+ stop: () => {
229
+ v && (v = !1, h.cancel());
230
+ },
231
+ // Linear progress mapped onto [from, to] — used by MultiAnimator for
232
+ // stagger thresholds. The actual visual motion is whatever the keyframes
233
+ // dictate; this mapping just gives the orchestration layer a monotonic
234
+ // progress signal.
235
+ getPosition: () => {
236
+ if (!v) return s;
237
+ const S = performance.now() - A, y = Math.min(Math.max(S / n, 0), 1);
238
+ return o + (s - o) * y;
239
+ },
240
+ // Baked animations don't expose velocity — interruption/resumption isn't
241
+ // supported here (you can stop, but can't resume mid-flight with momentum).
242
+ getVelocity: () => 0,
243
+ isRunning: () => v
244
+ };
245
+ }
202
246
  function ft(e) {
203
- const { to: n, onStart: t, onComplete: i } = e;
204
- return t == null || t(), i(), {
247
+ const { to: i, onStart: t, onComplete: n } = e;
248
+ return t == null || t(), n(), {
205
249
  stop: () => {
206
250
  },
207
- getPosition: () => n,
251
+ getPosition: () => i,
208
252
  getVelocity: () => 0,
209
253
  isRunning: () => !1
210
254
  };
211
255
  }
212
- class dt {
256
+ class mt {
213
257
  /**
214
258
  * Get bound runner based on animation mode
215
259
  *
216
- * @param options Animation mode options (tick or css)
260
+ * @param options Animation mode options — exactly one of tick / css / keyframes
217
261
  * @returns Bound runner function (empty runner if no animation mode specified)
218
- * @throws Error if both tick and css are provided
262
+ * @throws Error if more than one mode is provided
219
263
  */
220
- static from(n) {
221
- const { tick: t, css: i } = n;
222
- if (t && i)
223
- throw new Error("Cannot use both 'tick' and 'css' options together");
224
- return i ? (r) => ut({
225
- ...r,
226
- element: i.element,
227
- style: i.style
228
- }) : t ? (r) => at({
229
- ...r,
230
- onUpdate: t
231
- }) : ft;
264
+ static from(i) {
265
+ const { tick: t, css: n, keyframes: r } = i;
266
+ if ((t ? 1 : 0) + (n ? 1 : 0) + (r ? 1 : 0) > 1)
267
+ throw new Error(
268
+ "Cannot use more than one of 'tick', 'css', 'keyframes' together"
269
+ );
270
+ return r ? (s) => ut({
271
+ element: r.element,
272
+ frames: r.frames,
273
+ duration: r.duration,
274
+ easing: r.easing,
275
+ from: s.from,
276
+ to: s.to,
277
+ onComplete: s.onComplete,
278
+ onStart: s.onStart
279
+ }) : n ? (s) => {
280
+ if (!s.integrator)
281
+ throw new Error("css mode requires an integrator");
282
+ return lt({
283
+ integrator: s.integrator,
284
+ from: s.from,
285
+ to: s.to,
286
+ velocity: s.velocity,
287
+ onComplete: s.onComplete,
288
+ onStart: s.onStart,
289
+ element: n.element,
290
+ style: n.style
291
+ });
292
+ } : t ? (s) => {
293
+ if (!s.integrator)
294
+ throw new Error("tick mode requires an integrator");
295
+ return st({
296
+ integrator: s.integrator,
297
+ from: s.from,
298
+ to: s.to,
299
+ velocity: s.velocity,
300
+ onComplete: s.onComplete,
301
+ onStart: s.onStart,
302
+ onUpdate: t
303
+ });
304
+ } : ft;
232
305
  }
233
306
  }
234
- class K {
307
+ class $ {
235
308
  }
236
- const mt = { stiffness: 300, damping: 30 };
237
- class G extends K {
309
+ const dt = { stiffness: 300, damping: 30 };
310
+ class K extends $ {
238
311
  constructor(t) {
239
312
  super();
240
- f(this, "options");
241
- f(this, "runner");
242
- f(this, "controls", null);
243
- f(this, "isAnimating", !1);
244
- f(this, "currentValue");
245
- f(this, "currentVelocity", 0);
246
- f(this, "updateFn");
313
+ d(this, "options");
314
+ d(this, "runner");
315
+ d(this, "controls", null);
316
+ d(this, "isAnimating", !1);
317
+ d(this, "currentValue");
318
+ d(this, "currentVelocity", 0);
319
+ d(this, "updateFn");
320
+ d(this, "isKeyframesMode");
247
321
  if (this.options = {
248
322
  from: t.from ?? 0,
249
323
  to: t.to ?? 1,
@@ -251,24 +325,25 @@ class G extends K {
251
325
  onComplete: t.onComplete ?? (() => {
252
326
  }),
253
327
  onStart: t.onStart
254
- }, this.currentValue = this.options.from, t.tick)
255
- this.updateFn = (i) => {
328
+ }, this.currentValue = this.options.from, this.isKeyframesMode = !!t.keyframes, t.tick)
329
+ this.updateFn = (n) => {
256
330
  var r;
257
- return (r = t.tick) == null ? void 0 : r.call(t, i);
331
+ return (r = t.tick) == null ? void 0 : r.call(t, n);
258
332
  };
259
333
  else if (t.css) {
260
- const { element: i, style: r } = t.css;
334
+ const { element: n, style: r } = t.css;
261
335
  this.updateFn = (o) => {
262
- const l = r(o);
263
- for (const [u, s] of Object.entries(l))
264
- i.style[u] = typeof s == "number" ? String(s) : s;
336
+ const s = r(o);
337
+ for (const [f, l] of Object.entries(s))
338
+ n.style[f] = typeof l == "number" ? String(l) : l;
265
339
  };
266
340
  } else
267
341
  this.updateFn = () => {
268
342
  };
269
- this.runner = dt.from({
343
+ this.runner = mt.from({
270
344
  tick: t.tick,
271
- css: t.css
345
+ css: t.css,
346
+ keyframes: t.keyframes
272
347
  });
273
348
  }
274
349
  /**
@@ -288,11 +363,13 @@ class G extends K {
288
363
  return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? rt.from({
289
364
  spring: t.spring,
290
365
  inertia: t.inertia
291
- }) : new ot(mt);
366
+ }) : new it(dt);
292
367
  }
293
368
  runAnimation(t) {
294
369
  this.isAnimating = !0, this.controls = this.runner({
295
- integrator: this.createIntegrator(),
370
+ // Keyframes mode plays a pre-baked WAAPI animation — no integrator
371
+ // needed. tick/css modes still require one.
372
+ integrator: this.isKeyframesMode ? void 0 : this.createIntegrator(),
296
373
  from: this.currentValue,
297
374
  to: t,
298
375
  velocity: this.currentVelocity,
@@ -344,20 +421,20 @@ class G extends K {
344
421
  this.options = { ...this.options, ...t };
345
422
  }
346
423
  }
347
- class L extends K {
424
+ class D extends $ {
348
425
  constructor(t) {
349
426
  super();
350
- f(this, "config");
351
- f(this, "animators", /* @__PURE__ */ new Map());
352
- f(this, "itemOrder", []);
353
- f(this, "completedCount", 0);
354
- f(this, "completedAnimators", /* @__PURE__ */ new Set());
355
- f(this, "direction", "forward");
356
- f(this, "idCounter", 0);
357
- f(this, "rafId", null);
358
- f(this, "from");
359
- f(this, "to");
360
- f(this, "initialState");
427
+ d(this, "config");
428
+ d(this, "animators", /* @__PURE__ */ new Map());
429
+ d(this, "itemOrder", []);
430
+ d(this, "completedCount", 0);
431
+ d(this, "completedAnimators", /* @__PURE__ */ new Set());
432
+ d(this, "direction", "forward");
433
+ d(this, "idCounter", 0);
434
+ d(this, "rafId", null);
435
+ d(this, "from");
436
+ d(this, "to");
437
+ d(this, "initialState");
361
438
  this.config = t.config, this.from = t.from, this.to = t.to, this.initialState = t.state ?? {
362
439
  position: t.from,
363
440
  velocity: 0
@@ -367,17 +444,18 @@ class L extends K {
367
444
  return `spring_${this.idCounter++}`;
368
445
  }
369
446
  initializeAnimators() {
370
- this.config.items.forEach((t, i) => {
371
- const r = this.generateId(), o = new G({
447
+ this.config.items.forEach((t, n) => {
448
+ const r = this.generateId(), o = new K({
372
449
  from: this.from,
373
450
  to: this.to,
374
451
  physics: t.physics,
375
452
  tick: t.tick,
376
453
  css: t.css,
454
+ keyframes: t.keyframes,
377
455
  onComplete: () => this.onAnimatorComplete(r),
378
456
  onStart: t.onStart
379
457
  });
380
- (i === 0 || t.normalizedOffset === 0) && (o.setValue(this.initialState.position), o.setVelocity(this.initialState.velocity), o.syncState()), this.animators.set(r, {
458
+ (n === 0 || t.normalizedOffset === 0) && (o.setValue(this.initialState.position), o.setVelocity(this.initialState.velocity), o.syncState()), this.animators.set(r, {
381
459
  id: r,
382
460
  item: t,
383
461
  animator: o,
@@ -390,8 +468,8 @@ class L extends K {
390
468
  * Progress = |position - from| / |to - from|
391
469
  */
392
470
  getAnimatorProgress(t) {
393
- const i = t.animator.getCurrentState(), r = Math.abs(i.to - i.from);
394
- return r === 0 ? 1 : Math.abs(i.position - i.from) / r;
471
+ const n = t.animator.getCurrentState(), r = Math.abs(n.to - n.from);
472
+ return r === 0 ? 1 : Math.abs(n.position - n.from) / r;
395
473
  }
396
474
  /**
397
475
  * Get order of springs based on direction
@@ -402,9 +480,9 @@ class L extends K {
402
480
  return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
403
481
  }
404
482
  onAnimatorComplete(t) {
405
- var r, o, l, u, s, c;
406
- const i = this.animators.get(t);
407
- !i || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = i.item).onComplete) == null || o.call(r), (u = (l = this.config).onProgress) == null || u.call(l, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (c = (s = this.config).onEnd) == null || c.call(s)));
483
+ var r, o, s, f, l, m;
484
+ const n = this.animators.get(t);
485
+ !n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = n.item).onComplete) == null || o.call(r), (f = (s = this.config).onProgress) == null || f.call(s, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (m = (l = this.config).onEnd) == null || m.call(l)));
408
486
  }
409
487
  /**
410
488
  * Check and start springs based on previous spring's progress
@@ -412,22 +490,22 @@ class L extends K {
412
490
  */
413
491
  checkAndStartSprings() {
414
492
  const t = this.getOrderedIds();
415
- for (let i = 0; i < t.length; i++) {
416
- const r = t[i], o = this.animators.get(r);
493
+ for (let n = 0; n < t.length; n++) {
494
+ const r = t[n], o = this.animators.get(r);
417
495
  if (!o || o.started) continue;
418
- if (i === 0) {
496
+ if (n === 0) {
419
497
  this.startAnimator(r);
420
498
  continue;
421
499
  }
422
- const l = t[i - 1], u = this.animators.get(l);
423
- if (!u || !u.started) continue;
424
- const s = this.getAnimatorProgress(u), c = o.item.normalizedOffset;
425
- s >= c && this.startAnimator(r);
500
+ const s = t[n - 1], f = this.animators.get(s);
501
+ if (!f || !f.started) continue;
502
+ const l = this.getAnimatorProgress(f), m = o.item.normalizedOffset;
503
+ l >= m && this.startAnimator(r);
426
504
  }
427
505
  }
428
506
  startAnimator(t) {
429
- const i = this.animators.get(t);
430
- !i || i.started || (i.started = !0, this.direction === "forward" ? i.animator.forward() : i.animator.backward());
507
+ const n = this.animators.get(t);
508
+ !n || n.started || (n.started = !0, this.direction === "forward" ? n.animator.forward() : n.animator.backward());
431
509
  }
432
510
  /**
433
511
  * Start the scheduler loop that checks spring progress
@@ -442,17 +520,17 @@ class L extends K {
442
520
  this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
443
521
  }
444
522
  getFirstAnimator() {
445
- var i;
523
+ var n;
446
524
  const t = this.itemOrder[0];
447
- return t ? ((i = this.animators.get(t)) == null ? void 0 : i.animator) ?? null : null;
525
+ return t ? ((n = this.animators.get(t)) == null ? void 0 : n.animator) ?? null : null;
448
526
  }
449
527
  forward() {
450
- var t, i;
451
- this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (i = (t = this.config).onStart) == null || i.call(t), this.startScheduler();
528
+ var t, n;
529
+ this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (n = (t = this.config).onStart) == null || n.call(t), this.startScheduler();
452
530
  }
453
531
  backward() {
454
- var t, i;
455
- this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (i = (t = this.config).onStart) == null || i.call(t), this.startScheduler();
532
+ var t, n;
533
+ this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (n = (t = this.config).onStart) == null || n.call(t), this.startScheduler();
456
534
  }
457
535
  resetStartedFlags() {
458
536
  this.animators.forEach((t) => {
@@ -468,14 +546,15 @@ class L extends K {
468
546
  this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((t) => {
469
547
  if (!t.started)
470
548
  return;
471
- const i = t.animator.getCurrentState();
472
- if (i.position === i.to) {
473
- const o = new G({
549
+ const n = t.animator.getCurrentState();
550
+ if (n.position === n.to) {
551
+ const o = new K({
474
552
  from: this.to,
475
553
  to: this.from,
476
554
  physics: t.item.physics,
477
555
  tick: t.item.tick,
478
556
  css: t.item.css,
557
+ keyframes: t.item.keyframes,
479
558
  onComplete: () => this.onAnimatorComplete(t.id),
480
559
  onStart: t.item.onStart
481
560
  });
@@ -512,16 +591,16 @@ class L extends K {
512
591
  * TODO: Support per-spring control
513
592
  */
514
593
  setValue(t) {
515
- const i = this.getFirstAnimator();
516
- i == null || i.setValue(t);
594
+ const n = this.getFirstAnimator();
595
+ n == null || n.setValue(t);
517
596
  }
518
597
  /**
519
598
  * Set velocity on first animator
520
599
  * TODO: Support per-spring control
521
600
  */
522
601
  setVelocity(t) {
523
- const i = this.getFirstAnimator();
524
- i == null || i.setVelocity(t);
602
+ const n = this.getFirstAnimator();
603
+ n == null || n.setVelocity(t);
525
604
  }
526
605
  /**
527
606
  * Check if any animation is currently running
@@ -536,18 +615,18 @@ class L extends K {
536
615
  * Create MultiAnimator from existing state
537
616
  * Uses first animator's state for initialization
538
617
  */
539
- static fromState(t, i) {
540
- return new L({ ...i, state: t });
618
+ static fromState(t, n) {
619
+ return new D({ ...n, state: t });
541
620
  }
542
621
  }
543
- const $ = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
544
- runIn: async (n) => {
622
+ const Z = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
623
+ runIn: async (i) => {
545
624
  const { currentAnimation: t } = e;
546
625
  if (t && t.direction === "out") {
547
626
  const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
548
- if (t.controller.stop(), n.out)
627
+ if (t.controller.stop(), i.out)
549
628
  return {
550
- config: await n.out,
629
+ config: await i.out,
551
630
  state: { position: r, velocity: o },
552
631
  from: 1,
553
632
  to: 0,
@@ -555,8 +634,8 @@ const $ = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
555
634
  // Will actually go 0→1 (backward means toward 'from')
556
635
  };
557
636
  }
558
- return n.in ? {
559
- config: await n.in,
637
+ return i.in ? {
638
+ config: await i.in,
560
639
  state: {
561
640
  position: 0,
562
641
  velocity: 0
@@ -574,13 +653,13 @@ const $ = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
574
653
  direction: "forward"
575
654
  };
576
655
  },
577
- runOut: async (n) => {
656
+ runOut: async (i) => {
578
657
  const { currentAnimation: t } = e;
579
658
  if (t && t.direction === "in") {
580
659
  const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
581
- if (t.controller.stop(), n.in)
660
+ if (t.controller.stop(), i.in)
582
661
  return {
583
- config: await n.in,
662
+ config: await i.in,
584
663
  state: { position: r, velocity: o },
585
664
  from: 0,
586
665
  to: 1,
@@ -588,8 +667,8 @@ const $ = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
588
667
  // Will actually go 1→0 (backward means toward 'from')
589
668
  };
590
669
  }
591
- return n.out ? {
592
- config: await n.out,
670
+ return i.out ? {
671
+ config: await i.out,
593
672
  state: {
594
673
  position: 1,
595
674
  velocity: 0
@@ -645,7 +724,7 @@ const $ = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
645
724
  direction: "forward"
646
725
  }
647
726
  }), J = "data-ssgoi-scope", Q = "data-ssgoi-scope-ready";
648
- function qt() {
727
+ function Nt() {
649
728
  return (e) => {
650
729
  if (e)
651
730
  return e.setAttribute(J, ""), queueMicrotask(() => {
@@ -659,176 +738,163 @@ function qt() {
659
738
  function yt(e) {
660
739
  return e.hasAttribute(Q);
661
740
  }
662
- function pt(e) {
741
+ function wt(e) {
663
742
  return e.closest(`[${J}]`);
664
743
  }
665
- const wt = (e) => {
666
- let n = e.parentElement;
667
- for (; n && n !== document.body; ) {
668
- const t = window.getComputedStyle(n), i = t.overflow + t.overflowY + t.overflowX;
669
- if (i.includes("auto") || i.includes("scroll") || n.scrollHeight > n.clientHeight || n.scrollWidth > n.clientWidth)
670
- return n;
671
- n = n.parentElement;
744
+ const pt = (e) => {
745
+ let i = e.parentElement;
746
+ for (; i && i !== document.body; ) {
747
+ const t = window.getComputedStyle(i), n = t.overflow + t.overflowY + t.overflowX;
748
+ if (n.includes("auto") || n.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
749
+ return i;
750
+ i = i.parentElement;
672
751
  }
673
752
  return document.documentElement;
674
753
  }, vt = (e) => {
675
- let n = e.parentElement;
676
- for (; n && n !== document.body; ) {
677
- const t = window.getComputedStyle(n).position;
754
+ let i = e.parentElement;
755
+ for (; i && i !== document.body; ) {
756
+ const t = window.getComputedStyle(i).position;
678
757
  if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
679
- return n;
680
- n = n.parentElement;
758
+ return i;
759
+ i = i.parentElement;
681
760
  }
682
761
  return document.body;
683
762
  };
684
- function X(e) {
685
- return new Promise((n) => {
763
+ function U(e) {
764
+ return new Promise((i) => {
686
765
  requestAnimationFrame(() => {
687
766
  requestAnimationFrame(() => {
688
- n();
767
+ i();
689
768
  });
690
769
  });
691
770
  });
692
771
  }
693
- function Z() {
694
- return typeof window > "u" || typeof navigator > "u" ? !1 : /iPad|iPhone|iPod/.test(navigator.userAgent) || // iPad on iOS 13+ reports as MacIntel but has touch
695
- navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
696
- }
697
- function tt() {
698
- return typeof window > "u" || typeof navigator > "u" ? !1 : /Android/i.test(navigator.userAgent);
699
- }
700
- function St() {
701
- return typeof window > "u" || typeof navigator > "u" ? !1 : !Z() && !tt();
702
- }
703
- function At(e) {
704
- return e.length === 0 ? !1 : !!(e.includes("all") || e.includes("ios") && Z() || e.includes("android") && tt() || e.includes("desktop") && St());
705
- }
706
- function Ct(e, n) {
707
- var E;
708
- let t = null, i = null, r = null, o = null;
709
- const l = {
772
+ function St(e, i) {
773
+ var S;
774
+ let t = null, n = null, r = null, o = null;
775
+ const s = {
710
776
  get currentAnimation() {
711
777
  return t;
712
778
  }
713
- }, u = ((E = n == null ? void 0 : n.strategy) == null ? void 0 : E.call(n, l)) || ht(l), s = async (y) => {
714
- var m, g;
715
- i && (i.remove(), i = null);
716
- const p = e(), T = p.in && p.in(y), A = !(n != null && n.strategy) && p.out ? p.out(y) : void 0;
717
- if (!T)
779
+ }, f = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, s)) || ht(s), l = async (y) => {
780
+ var g, E;
781
+ n && (n.remove(), n = null);
782
+ const p = e(), k = p.in && p.in(y), T = !(i != null && i.strategy) && p.out ? p.out(y) : void 0;
783
+ if (!k)
718
784
  return;
719
- const P = {
720
- in: M(T),
721
- out: A ? M(A) : void 0
722
- }, v = await u.runIn(P);
723
- if (!v.config) {
785
+ const w = {
786
+ in: F(k),
787
+ out: T ? F(T) : void 0
788
+ }, u = await f.runIn(w);
789
+ if (!u.config) {
724
790
  t && (t.direction = "in");
725
791
  return;
726
792
  }
727
- const h = v.config;
728
- (m = h.prepare) == null || m.call(h);
729
- const C = j(
793
+ const a = u.config;
794
+ (g = a.prepare) == null || g.call(a);
795
+ const C = W(
730
796
  {
731
- ...h,
797
+ ...a,
732
798
  onEnd: () => {
733
- var S;
734
- t = null, (S = h.onEnd) == null || S.call(h);
799
+ var b;
800
+ t = null, (b = a.onEnd) == null || b.call(a);
735
801
  }
736
802
  },
737
803
  y
738
804
  );
739
- h.wait && await h.wait();
740
- const a = L.fromState(v.state, {
805
+ a.wait && await a.wait();
806
+ const c = D.fromState(u.state, {
741
807
  config: C,
742
- from: v.from,
743
- to: v.to
808
+ from: u.from,
809
+ to: u.to
744
810
  });
745
- t = { controller: a, direction: "in" }, (g = h.onReady) == null || g.call(h), await X(), v.direction === "forward" ? a.forward() : a.backward();
746
- }, c = async (y) => {
747
- var g, S;
748
- i = y;
749
- const p = e(), T = !(n != null && n.strategy) && p.in ? p.in(y) : void 0, A = p.out && p.out(y);
750
- if (!A)
811
+ t = { controller: c, direction: "in" }, (E = a.onReady) == null || E.call(a), await U(), u.direction === "forward" ? c.forward() : c.backward();
812
+ }, m = async (y) => {
813
+ var E, b;
814
+ n = y;
815
+ const p = e(), k = !(i != null && i.strategy) && p.in ? p.in(y) : void 0, T = p.out && p.out(y);
816
+ if (!T)
751
817
  return;
752
- const P = {
753
- in: T ? M(T) : void 0,
754
- out: M(A)
755
- }, v = await u.runOut(P);
756
- if (!v.config) {
757
- t && (t.direction = "out"), i && (i.remove(), i = null);
818
+ const w = {
819
+ in: k ? F(k) : void 0,
820
+ out: F(T)
821
+ }, u = await f.runOut(w);
822
+ if (!u.config) {
823
+ t && (t.direction = "out"), n && (n.remove(), n = null);
758
824
  return;
759
825
  }
760
- const h = v.config;
761
- m(), (g = h.prepare) == null || g.call(h);
762
- const C = j(
826
+ const a = u.config;
827
+ g(), (E = a.prepare) == null || E.call(a);
828
+ const C = W(
763
829
  {
764
- ...h,
830
+ ...a,
765
831
  onEnd: () => {
766
- var R, V;
767
- (R = h.onEnd) == null || R.call(h), i && (i.remove(), i = null), t = null, (V = n == null ? void 0 : n.onCleanupEnd) == null || V.call(n);
832
+ var R, M;
833
+ (R = a.onEnd) == null || R.call(a), n && (n.remove(), n = null), t = null, (M = i == null ? void 0 : i.onCleanupEnd) == null || M.call(i);
768
834
  }
769
835
  },
770
836
  y
771
837
  );
772
- h.wait && await h.wait();
773
- const a = L.fromState(v.state, {
838
+ a.wait && await a.wait();
839
+ const c = D.fromState(u.state, {
774
840
  config: C,
775
- from: v.from,
776
- to: v.to
841
+ from: u.from,
842
+ to: u.to
777
843
  });
778
- t = { controller: a, direction: "out" }, (S = h.onReady) == null || S.call(h), await X(), v.direction === "forward" ? a.forward() : a.backward();
779
- function m() {
780
- !r || !i || (o && r.contains(o) ? r.insertBefore(i, o) : r.appendChild(i));
844
+ t = { controller: c, direction: "out" }, (b = a.onReady) == null || b.call(a), await U(), u.direction === "forward" ? c.forward() : c.backward();
845
+ function g() {
846
+ !r || !n || (o && r.contains(o) ? r.insertBefore(n, o) : r.appendChild(n));
781
847
  }
782
848
  };
783
- let d = null, w = !1;
784
- const b = (y) => () => {
785
- if (w) return;
786
- w = !0;
849
+ let h = null, v = !1;
850
+ const A = (y) => () => {
851
+ if (v) return;
852
+ v = !0;
787
853
  const p = y.cloneNode(!0);
788
- d ? queueMicrotask(() => {
789
- document.contains(d) && c(p);
790
- }) : c(p);
854
+ h ? queueMicrotask(() => {
855
+ document.contains(h) && m(p);
856
+ }) : m(p);
791
857
  };
792
858
  return (y) => {
793
859
  if (y)
794
860
  return requestAnimationFrame(() => {
795
861
  r = y.parentElement, o = y.nextElementSibling;
796
- }), w = !1, (n == null ? void 0 : n.scope) === "local" ? queueMicrotask(() => {
797
- d = pt(y), !(d && !yt(d)) && s(y);
798
- }) : s(y), b(y);
862
+ }), v = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
863
+ h = wt(y), !(h && !yt(h)) && l(y);
864
+ }) : l(y), A(y);
799
865
  };
800
866
  }
801
- const I = /* @__PURE__ */ new Map();
802
- let k = null, N = !1;
803
- function et(e) {
804
- if (e instanceof HTMLElement && I.has(e)) {
805
- const t = I.get(e);
806
- I.delete(e), queueMicrotask(() => {
867
+ const P = /* @__PURE__ */ new Map();
868
+ let I = null, q = !1;
869
+ function tt(e) {
870
+ if (e instanceof HTMLElement && P.has(e)) {
871
+ const t = P.get(e);
872
+ P.delete(e), queueMicrotask(() => {
807
873
  t();
808
874
  });
809
875
  }
810
- const n = e.childNodes;
811
- for (let t = 0; t < n.length; t++) {
812
- const i = n[t];
813
- i && et(i);
876
+ const i = e.childNodes;
877
+ for (let t = 0; t < i.length; t++) {
878
+ const n = i[t];
879
+ n && tt(n);
814
880
  }
815
881
  }
816
- function bt() {
817
- N || typeof document > "u" || (N = !0, k = new MutationObserver((e) => {
818
- for (const n of e) {
819
- const t = n.removedNodes;
820
- for (let i = 0; i < t.length; i++) {
821
- const r = t[i];
822
- r && et(r);
882
+ function At() {
883
+ q || typeof document > "u" || (q = !0, I = new MutationObserver((e) => {
884
+ for (const i of e) {
885
+ const t = i.removedNodes;
886
+ for (let n = 0; n < t.length; n++) {
887
+ const r = t[n];
888
+ r && tt(r);
823
889
  }
824
890
  }
825
- }), document.body ? k.observe(document.body, {
891
+ }), document.body ? I.observe(document.body, {
826
892
  childList: !0,
827
893
  subtree: !0
828
894
  }) : document.addEventListener(
829
895
  "DOMContentLoaded",
830
896
  () => {
831
- k == null || k.observe(document.body, {
897
+ I == null || I.observe(document.body, {
832
898
  childList: !0,
833
899
  subtree: !0
834
900
  });
@@ -836,322 +902,386 @@ function bt() {
836
902
  { once: !0 }
837
903
  ));
838
904
  }
839
- function Et(e, n) {
840
- bt(), I.set(e, n);
905
+ function Ct(e, i) {
906
+ At(), P.set(e, i);
841
907
  }
842
- function Nt(e) {
843
- return I.has(e);
908
+ function Xt(e) {
909
+ return P.has(e);
844
910
  }
845
- function Bt() {
846
- return I.size;
911
+ function Wt() {
912
+ return P.size;
847
913
  }
848
- function Ut(e) {
849
- const n = I.get(e);
850
- return n ? (I.delete(e), n(), !0) : !1;
914
+ function Ht(e) {
915
+ const i = P.get(e);
916
+ return i ? (P.delete(e), i(), !0) : !1;
851
917
  }
852
- function Wt() {
853
- I.clear(), k == null || k.disconnect(), k = null, N = !1;
918
+ function Kt() {
919
+ P.clear(), I == null || I.disconnect(), I = null, q = !1;
854
920
  }
855
- const z = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
856
- function Tt(e, n, t) {
857
- z.set(e, n);
858
- let i = B.get(e);
859
- if (i)
860
- return i;
861
- const r = n;
862
- return i = Ct(
921
+ const O = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
922
+ function Et(e, i, t) {
923
+ O.set(e, i);
924
+ let n = N.get(e);
925
+ if (n)
926
+ return n;
927
+ const r = i;
928
+ return n = St(
863
929
  () => {
864
- const o = z.get(e);
930
+ const o = O.get(e);
865
931
  return o || (console.warn(`Transition "${String(e)}" not found`), {});
866
932
  },
867
933
  {
868
934
  strategy: t == null ? void 0 : t.strategy,
869
935
  scope: t == null ? void 0 : t.scope,
870
936
  onCleanupEnd: () => {
871
- z.get(e) === r && kt(e);
937
+ O.get(e) === r && Tt(e);
872
938
  }
873
939
  }
874
- ), B.set(e, i), i;
940
+ ), N.set(e, n), n;
875
941
  }
876
- function kt(e) {
877
- z.delete(e), B.delete(e), U.delete(e);
942
+ function Tt(e) {
943
+ O.delete(e), N.delete(e), X.delete(e);
878
944
  }
879
- function jt(e, n = "manual") {
880
- const t = Tt(
945
+ function Ut(e, i = "manual") {
946
+ const t = Et(
881
947
  e.key,
882
948
  {
883
949
  in: e.in,
884
950
  out: e.out
885
951
  },
886
952
  {
887
- strategy: e[$],
953
+ strategy: e[Z],
888
954
  scope: e.scope
889
955
  }
890
956
  );
891
- if (n === "manual")
957
+ if (i === "manual")
892
958
  return t;
893
- let i = U.get(e.key);
894
- return i || (i = (r) => {
959
+ let n = X.get(e.key);
960
+ return n || (n = (r) => {
895
961
  if (r) {
896
962
  const o = t(r);
897
- o && Et(r, o);
963
+ o && Ct(r, o);
898
964
  }
899
- }, U.set(e.key, i), i);
965
+ }, X.set(e.key, n), n);
900
966
  }
901
- function It(e) {
902
- const n = e.filter((t) => t.symmetric).map((t) => ({
967
+ function bt(e) {
968
+ const i = e.filter((t) => t.symmetric).map((t) => ({
903
969
  from: t.to,
904
970
  to: t.from,
905
971
  transition: t.transition
906
972
  }));
907
- return [...e, ...n];
973
+ return [...e, ...i];
908
974
  }
909
- function Pt() {
910
- var s;
911
- let e = typeof history < "u" ? ((s = history.state) == null ? void 0 : s.ssgoiIndex) ?? 0 : 0, n = "push", t = !1, i = !1;
912
- const r = (c) => {
913
- var w;
914
- t = !0;
915
- const d = ((w = c.state) == null ? void 0 : w.ssgoiIndex) ?? 0;
916
- d < e ? (n = "back", i = !0) : d > e && (n = "forward"), e = d;
917
- };
918
- return {
919
- initialize: () => {
920
- var c;
921
- typeof window > "u" || (window.addEventListener("popstate", r), ((c = history.state) == null ? void 0 : c.ssgoiIndex) == null ? history.replaceState({ ...history.state, ssgoiIndex: e }, "") : e = history.state.ssgoiIndex);
922
- },
923
- onPageEnter: () => {
924
- t || (e++, history.replaceState({ ...history.state, ssgoiIndex: e }, ""));
925
- const c = n;
926
- return n = "push", t = !1, setTimeout(() => {
927
- i = !1;
928
- }, 0), c;
929
- },
930
- isBack: () => i || n === "back"
931
- };
932
- }
933
- function x(e, n) {
934
- if (n === "*")
975
+ function V(e, i) {
976
+ if (i === "*")
935
977
  return !0;
936
- if (n.endsWith("/*")) {
937
- const t = n.slice(0, -1);
978
+ if (i.endsWith("/*")) {
979
+ const t = i.slice(0, -1);
938
980
  return e.startsWith(t) && e.length > t.length;
939
981
  }
940
- return e === n;
982
+ return e === i;
941
983
  }
942
- function Rt(e, n, t) {
943
- for (const i of t)
944
- if (x(e, i.from) && x(n, i.to))
945
- return i.transition;
946
- for (const i of t)
947
- if ((i.from === "*" || x(e, i.from)) && (i.to === "*" || x(n, i.to)))
948
- return i.transition;
984
+ function kt(e, i, t) {
985
+ for (const n of t)
986
+ if (V(e, n.from) && V(i, n.to))
987
+ return n.transition;
988
+ for (const n of t)
989
+ if ((n.from === "*" || V(e, n.from)) && (n.to === "*" || V(i, n.to)))
990
+ return n.transition;
949
991
  return null;
950
992
  }
951
- const xt = 768, Vt = 10, Ft = 10;
993
+ const Rt = 768, It = 10, Pt = 10;
952
994
  function Mt(e = {}) {
953
- const { preserveScroll: n = (a) => a } = e, t = typeof n == "function" ? n : () => n;
954
- let i = null, r = !1, o = !1;
955
- const l = () => {
956
- const a = (i == null ? void 0 : i.clientWidth) ?? 0, m = a > 0 ? a : typeof window < "u" ? window.innerWidth : 0;
957
- return m > 0 && m < xt;
958
- }, u = () => (o || (r = l(), o = !0), r), s = (a) => {
959
- const m = t(u());
960
- return m === !1 ? !1 : m === !0 ? !0 : !m.exclude.some((g) => x(a, g));
995
+ const { preserveScroll: i = (c) => c } = e, t = typeof i == "function" ? i : () => i;
996
+ let n = null, r = !1, o = !1;
997
+ const s = () => {
998
+ const c = (n == null ? void 0 : n.clientWidth) ?? 0, g = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
999
+ return g > 0 && g < Rt;
1000
+ }, f = () => (o || (r = s(), o = !0), r), l = (c) => {
1001
+ const g = t(f());
1002
+ return g === !1 ? !1 : g === !0 ? !0 : !g.exclude.some((E) => V(c, E));
961
1003
  };
962
- let c = null;
963
- const d = /* @__PURE__ */ new Map();
964
- let w = null, b = !1, E = 0;
1004
+ let m = null;
1005
+ const h = /* @__PURE__ */ new Map();
1006
+ let v = null, A = !1, S = 0;
965
1007
  const y = () => {
966
- i && w && !b && d.set(w, {
967
- x: i.scrollLeft,
968
- y: i.scrollTop
1008
+ n && v && !A && h.set(v, {
1009
+ x: n.scrollLeft,
1010
+ y: n.scrollTop
969
1011
  });
970
- }, p = (a) => {
971
- if (!i) return;
972
- const m = s(a) && d.has(a) ? d.get(a) : { x: 0, y: 0 };
973
- let g = 0;
974
- const S = () => {
975
- if (!i) return;
976
- i.scrollTo({
977
- top: m.y,
978
- left: m.x
979
- }), !(Math.abs(i.scrollTop - m.y) < 1 && Math.abs(i.scrollLeft - m.x) < 1) && g < Vt && (g++, requestAnimationFrame(S));
1012
+ }, p = (c) => {
1013
+ if (!n) return;
1014
+ const g = l(c) && h.has(c) ? h.get(c) : { x: 0, y: 0 };
1015
+ let E = 0;
1016
+ const b = () => {
1017
+ if (!n) return;
1018
+ n.scrollTo({
1019
+ top: g.y,
1020
+ left: g.x
1021
+ }), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && E < It && (E++, requestAnimationFrame(b));
980
1022
  };
981
- requestAnimationFrame(S);
1023
+ requestAnimationFrame(b);
982
1024
  };
983
1025
  return {
984
- initializeContext: (a, m) => {
985
- b = !0;
986
- const g = ++E;
987
- c = a, i || (i = wt(a), r = l(), o = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
988
- r = l();
989
- }).observe(i), (i === document.documentElement ? window : i).addEventListener("scroll", y, {
1026
+ initializeContext: (c, g) => {
1027
+ A = !0;
1028
+ const E = ++S;
1029
+ m = c, n || (n = pt(c), r = s(), o = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
1030
+ r = s();
1031
+ }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", y, {
990
1032
  passive: !0
991
- })), w = m, p(m);
992
- let S = 0;
1033
+ })), v = g, p(g);
1034
+ let b = 0;
993
1035
  const R = () => {
994
- g === E && (S++, S >= Ft ? b = !1 : requestAnimationFrame(R));
1036
+ E === S && (b++, b >= Pt ? A = !1 : requestAnimationFrame(R));
995
1037
  };
996
1038
  requestAnimationFrame(R);
997
1039
  },
998
- calculateScrollOffset: (a, m) => {
999
- const g = a && d.has(a) ? d.get(a) : { x: 0, y: 0 }, S = m && s(m) && d.has(m) ? d.get(m) : { x: 0, y: 0 };
1040
+ calculateScrollOffset: (c, g) => {
1041
+ const E = c && h.has(c) ? h.get(c) : { x: 0, y: 0 }, b = g && l(g) && h.has(g) ? h.get(g) : { x: 0, y: 0 };
1000
1042
  return {
1001
- x: -S.x + g.x,
1002
- y: -S.y + g.y
1043
+ x: -b.x + E.x,
1044
+ y: -b.y + E.y
1003
1045
  };
1004
1046
  },
1005
- evictScrollPosition: (a) => {
1006
- d.delete(a);
1047
+ evictScrollPosition: (c) => {
1048
+ h.delete(c);
1007
1049
  },
1008
- shouldPreserve: s,
1009
- getScrollContainer: () => i,
1010
- getPositionedParentElement: () => c ? vt(c) : document.body,
1011
- getScrollPosition: (a) => a && d.has(a) ? d.get(a) : { x: 0, y: 0 }
1050
+ shouldPreserve: l,
1051
+ getScrollContainer: () => n,
1052
+ getPositionedParentElement: () => m ? vt(m) : document.body,
1053
+ getScrollPosition: (c) => c && h.has(c) ? h.get(c) : { x: 0, y: 0 }
1012
1054
  };
1013
1055
  }
1014
- function Ot() {
1056
+ const j = 30, B = 8, Y = 1.2, Vt = 30, xt = 600;
1057
+ function Ft() {
1058
+ let e = null, i = !1, t = !1, n = null, r = null, o = !1;
1059
+ const s = (w, u) => {
1060
+ for (let a = 0; a < w.length; a++) {
1061
+ const C = w.item(a);
1062
+ if (C && C.identifier === u) return C;
1063
+ }
1064
+ return null;
1065
+ }, f = () => {
1066
+ n !== null && (clearTimeout(n), n = null);
1067
+ }, l = () => {
1068
+ r !== null && (clearTimeout(r), r = null);
1069
+ }, m = () => {
1070
+ i = !0, t = !0, f(), l(), n = setTimeout(() => {
1071
+ i = !1, t = !1, n = null;
1072
+ }, xt);
1073
+ }, h = (w) => {
1074
+ if (w.touches.length !== 1) {
1075
+ e = null;
1076
+ return;
1077
+ }
1078
+ const u = w.touches.item(0);
1079
+ if (!u) {
1080
+ e = null;
1081
+ return;
1082
+ }
1083
+ const a = window.innerWidth, C = u.clientX <= j, c = u.clientX >= a - j;
1084
+ if (!C && !c) {
1085
+ e = null;
1086
+ return;
1087
+ }
1088
+ e = {
1089
+ identifier: u.identifier,
1090
+ startX: u.clientX,
1091
+ startY: u.clientY,
1092
+ fromLeftEdge: C,
1093
+ moved: !1
1094
+ };
1095
+ }, v = (w) => {
1096
+ if (!e) return;
1097
+ if (w.touches.length !== 1) {
1098
+ e = null;
1099
+ return;
1100
+ }
1101
+ const u = s(w.touches, e.identifier);
1102
+ if (!u) {
1103
+ e = null;
1104
+ return;
1105
+ }
1106
+ const a = u.clientX - e.startX, C = u.clientY - e.startY, c = Math.abs(a), g = Math.abs(C);
1107
+ if (g > B && g > c * Y) {
1108
+ e = null;
1109
+ return;
1110
+ }
1111
+ const E = e.fromLeftEdge ? a > 0 : a < 0;
1112
+ c > B && c > g * Y && E && (e.moved = !0);
1113
+ }, A = (w) => {
1114
+ if (!e) return;
1115
+ const u = s(w.changedTouches, e.identifier);
1116
+ if (!u) {
1117
+ e = null;
1118
+ return;
1119
+ }
1120
+ const a = u.clientX - e.startX, C = e.fromLeftEdge ? a > 0 : a < 0;
1121
+ e.moved && C && Math.abs(a) >= Vt && m(), e = null;
1122
+ }, S = () => {
1123
+ e && (e.moved && m(), e = null);
1124
+ };
1125
+ return { initialize: () => {
1126
+ if (typeof window > "u" || o) return;
1127
+ o = !0;
1128
+ const w = { passive: !0, capture: !0 };
1129
+ window.addEventListener("touchstart", h, w), window.addEventListener("touchmove", v, w), window.addEventListener("touchend", A, w), window.addEventListener("touchcancel", S, w);
1130
+ }, destroy: () => {
1131
+ if (typeof window > "u" || !o) return;
1132
+ o = !1;
1133
+ const w = { capture: !0 };
1134
+ window.removeEventListener("touchstart", h, w), window.removeEventListener("touchmove", v, w), window.removeEventListener("touchend", A, w), window.removeEventListener("touchcancel", S, w), f(), l(), e = null, i = !1, t = !1;
1135
+ }, isSwipeBack: () => {
1136
+ const w = i || t;
1137
+ return w && f(), w;
1138
+ }, onPageEnter: () => {
1139
+ i = !1, f(), l(), r = setTimeout(() => {
1140
+ t = !1, r = null;
1141
+ }, 0);
1142
+ } };
1143
+ }
1144
+ function Lt() {
1015
1145
  let e = null;
1016
- function n() {
1146
+ function i() {
1017
1147
  if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
1018
1148
  const t = { from: e.from, to: e.to };
1019
1149
  e.outResolve(t), e.inResolve(t), e = null;
1020
1150
  }
1021
1151
  }
1022
1152
  return {
1023
- trigger(t, i) {
1024
- e || (e = {}), i === "out" ? e.from = t : e.to = t;
1153
+ trigger(t, n) {
1154
+ e || (e = {}), n === "out" ? e.from = t : e.to = t;
1025
1155
  },
1026
1156
  get(t) {
1027
- return t === "in" && (!e || !e.from) ? Promise.resolve(null) : new Promise((i) => {
1028
- e || (e = {}), t === "out" ? e.outResolve = i : e.inResolve = i, n();
1157
+ return t === "in" && (!e || !e.from) ? Promise.resolve(null) : new Promise((n) => {
1158
+ e || (e = {}), t === "out" ? e.outResolve = n : e.inResolve = n, i();
1029
1159
  });
1030
1160
  }
1031
1161
  };
1032
1162
  }
1033
- function zt() {
1163
+ function Ot() {
1034
1164
  let e = null;
1035
- function n() {
1036
- var i, r;
1037
- e && ((i = e.outResolve) == null || i.call(e, null), (r = e.inResolve) == null || r.call(e, null), e = null);
1165
+ function i() {
1166
+ var n, r;
1167
+ e && ((n = e.outResolve) == null || n.call(e, null), (r = e.inResolve) == null || r.call(e, null), e = null);
1038
1168
  }
1039
1169
  function t() {
1040
1170
  if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
1041
1171
  if (e.from === e.to) {
1042
- n();
1172
+ i();
1043
1173
  return;
1044
1174
  }
1045
- const i = { from: e.from, to: e.to };
1046
- e.outResolve(i), e.inResolve(i), e = null;
1175
+ const n = { from: e.from, to: e.to };
1176
+ e.outResolve(n), e.inResolve(n), e = null;
1047
1177
  }
1048
1178
  }
1049
1179
  return {
1050
- trigger(i, r) {
1051
- e && (r === "out" && e.from && e.from !== i || r === "in" && e.to && e.to !== i) && n(), e || (e = {}), r === "out" ? e.from = i : e.to = i;
1180
+ trigger(n, r) {
1181
+ e && (r === "out" && e.from && e.from !== n || r === "in" && e.to && e.to !== n) && i(), e || (e = {}), r === "out" ? e.from = n : e.to = n;
1052
1182
  },
1053
- get(i) {
1183
+ get(n) {
1054
1184
  return new Promise((r) => {
1055
- e || (e = {}), i === "out" ? e.outResolve = r : e.inResolve = r, t();
1185
+ e || (e = {}), n === "out" ? e.outResolve = r : e.inResolve = r, t();
1056
1186
  });
1057
1187
  }
1058
1188
  };
1059
1189
  }
1060
- function Ht(e, n) {
1190
+ function jt(e, i) {
1061
1191
  const {
1062
1192
  transitions: t = [],
1063
- defaultTransition: i,
1064
- middleware: r = (C, a) => ({ from: C, to: a }),
1193
+ defaultTransition: n,
1194
+ middleware: r = (u, a) => ({ from: u, to: a }),
1065
1195
  // Identity function as default
1066
- skipAnimationOnBack: o = ["ios"],
1067
- preserveScroll: l = (C) => C
1068
- } = e, u = At(o), { outFirst: s = !0 } = n || {}, c = s ? Ot() : zt(), d = It(t), {
1069
- initializeContext: w,
1070
- calculateScrollOffset: b,
1071
- evictScrollPosition: E,
1072
- shouldPreserve: y,
1073
- getScrollContainer: p,
1074
- getPositionedParentElement: T,
1075
- getScrollPosition: A
1196
+ preserveScroll: o = (u) => u
1197
+ } = e, { outFirst: s = !0 } = i || {}, f = s ? Lt() : Ot(), l = bt(t), m = Ft();
1198
+ m.initialize();
1199
+ const {
1200
+ initializeContext: h,
1201
+ calculateScrollOffset: v,
1202
+ evictScrollPosition: A,
1203
+ shouldPreserve: S,
1204
+ getScrollContainer: y,
1205
+ getPositionedParentElement: p,
1206
+ getScrollPosition: k
1076
1207
  } = Mt({
1077
- preserveScroll: l
1078
- }), P = Pt();
1079
- u && P.initialize();
1080
- const v = async (C, a) => {
1081
- const m = u && P.isBack();
1082
- c.trigger(C, a);
1083
- const g = await c.get(a);
1084
- if (!g) return () => ({});
1085
- if (a === "in" && u && P.onPageEnter(), m)
1086
- return () => ({});
1087
- const { from: S, to: R } = r(
1088
- g.from,
1089
- g.to
1090
- ), F = Rt(
1091
- S,
1092
- R,
1093
- d
1094
- ) || i;
1095
- if (!F) return () => ({});
1096
- const W = b(g.from, g.to);
1208
+ preserveScroll: o
1209
+ }), T = async (u, a) => {
1210
+ const C = m.isSwipeBack();
1211
+ f.trigger(u, a);
1212
+ const c = await f.get(a);
1213
+ if (a === "in" && m.onPageEnter(), !c) return () => ({});
1214
+ if (C)
1215
+ return a === "out" && c.from && !S(c.from) && A(c.from), () => ({});
1216
+ const { from: g, to: E } = r(
1217
+ c.from,
1218
+ c.to
1219
+ ), R = kt(
1220
+ g,
1221
+ E,
1222
+ l
1223
+ ) || n;
1224
+ if (!R) return () => ({});
1225
+ const M = v(c.from, c.to);
1097
1226
  if (a === "out") {
1098
- const D = {
1099
- scrollOffset: W,
1100
- scroll: A(g.from),
1227
+ const x = {
1228
+ scrollOffset: M,
1229
+ scroll: k(c.from),
1101
1230
  get scrollingElement() {
1102
- return p() || document.documentElement;
1231
+ return y() || document.documentElement;
1103
1232
  },
1104
1233
  get positionedParent() {
1105
- return T();
1234
+ return p();
1106
1235
  }
1107
1236
  };
1108
- return g.from && !y(g.from) && E(g.from), (_) => F.out(_, D);
1237
+ return c.from && !S(c.from) && A(c.from), (_) => R.out(_, x);
1109
1238
  } else {
1110
- const D = {
1111
- scrollOffset: W,
1239
+ const x = {
1240
+ scrollOffset: M,
1112
1241
  get scroll() {
1113
- return A(g.to);
1242
+ return k(c.to);
1114
1243
  },
1115
1244
  get scrollingElement() {
1116
- return p() || document.documentElement;
1245
+ return y() || document.documentElement;
1117
1246
  },
1118
1247
  get positionedParent() {
1119
- return T();
1248
+ return p();
1120
1249
  }
1121
1250
  };
1122
- return (_) => F.in(_, D);
1251
+ return (_) => R.in(_, x);
1123
1252
  }
1124
1253
  };
1125
- return (C) => ({
1126
- key: C,
1127
- in: async (a) => (w(a, C), (await v(C, "in"))(a)),
1128
- out: async (a) => (await v(C, "out"))(a),
1254
+ return (u) => ({
1255
+ key: u,
1256
+ in: async (a) => (h(a, u), (await T(u, "in"))(a)),
1257
+ out: async (a) => (await T(u, "out"))(a),
1129
1258
  // Add page transition strategy for page-level transitions
1130
- [$]: gt
1259
+ [Z]: gt
1131
1260
  });
1132
1261
  }
1133
1262
  export {
1134
1263
  J as SCOPE_ATTR,
1135
1264
  Q as SCOPE_READY_ATTR,
1136
- $ as TRANSITION_STRATEGY,
1137
- zt as createAnyOrderDetector,
1265
+ Z as TRANSITION_STRATEGY,
1266
+ Ot as createAnyOrderDetector,
1138
1267
  ht as createDefaultStrategy,
1139
- Ot as createOutFirstDetector,
1268
+ Lt as createOutFirstDetector,
1140
1269
  gt as createPageTransitionStrategy,
1141
- Ht as createSggoiTransitionContext,
1142
- qt as createTransitionScope,
1143
- pt as findScope,
1144
- Bt as getWatchedCount,
1145
- Yt as isCssAnimation,
1146
- Kt as isMultiAnimation,
1270
+ jt as createSggoiTransitionContext,
1271
+ Nt as createTransitionScope,
1272
+ wt as findScope,
1273
+ Wt as getWatchedCount,
1274
+ Gt as isCssAnimation,
1275
+ $t as isKeyframesAnimation,
1276
+ Zt as isMultiAnimation,
1147
1277
  yt as isScopeReady,
1148
- $t as isSingleAnimation,
1149
- Jt as isTickAnimation,
1150
- Nt as isWatched,
1151
- j as normalizeSchedule,
1152
- M as normalizeToMultiAnimation,
1153
- Wt as resetObserver,
1154
- jt as transition,
1155
- Ut as triggerUnmount,
1156
- Et as watchUnmount
1278
+ Jt as isSingleAnimation,
1279
+ Qt as isTickAnimation,
1280
+ Xt as isWatched,
1281
+ W as normalizeSchedule,
1282
+ F as normalizeToMultiAnimation,
1283
+ Kt as resetObserver,
1284
+ Ut as transition,
1285
+ Ht as triggerUnmount,
1286
+ Ct as watchUnmount
1157
1287
  };