@ssgoi/core 4.0.0 → 4.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 (49) hide show
  1. package/dist/animator/integrator/double-spring-integrator.d.ts +6 -0
  2. package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -1
  3. package/dist/animator/integrator/inertia-integrator.d.ts +15 -0
  4. package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -1
  5. package/dist/animator/integrator/provider.d.ts.map +1 -1
  6. package/dist/animator/integrator/spring-integrator.d.ts +6 -0
  7. package/dist/animator/integrator/spring-integrator.d.ts.map +1 -1
  8. package/dist/animator/multi-animator.d.ts +16 -11
  9. package/dist/animator/multi-animator.d.ts.map +1 -1
  10. package/dist/animator/runner/css-runner.d.ts.map +1 -1
  11. package/dist/animator/single-animator.d.ts +6 -4
  12. package/dist/animator/single-animator.d.ts.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +603 -518
  17. package/dist/provider-Cs5iBqRD.cjs +1 -0
  18. package/dist/provider-Cu4NSF1Q.js +167 -0
  19. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +4 -1
  20. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  21. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +42 -0
  22. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -0
  23. package/dist/transition/create-transition-callback.d.ts.map +1 -1
  24. package/dist/transition/transition-strategy.d.ts +6 -6
  25. package/dist/transition/transition-strategy.d.ts.map +1 -1
  26. package/dist/transitions/index.cjs +1 -1
  27. package/dist/transitions/index.js +1 -1
  28. package/dist/types.cjs +1 -1
  29. package/dist/types.d.ts +84 -35
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/types.js +39 -46
  32. package/dist/utils/index.d.ts +1 -0
  33. package/dist/utils/index.d.ts.map +1 -1
  34. package/dist/utils/wait-paint.d.ts +15 -0
  35. package/dist/utils/wait-paint.d.ts.map +1 -0
  36. package/dist/view-transitions/depth.d.ts.map +1 -1
  37. package/dist/view-transitions/drill.d.ts.map +1 -1
  38. package/dist/view-transitions/hero.d.ts.map +1 -1
  39. package/dist/view-transitions/index.cjs +15 -15
  40. package/dist/view-transitions/index.js +673 -688
  41. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  42. package/dist/view-transitions/scroll.d.ts.map +1 -1
  43. package/dist/view-transitions/sheet.d.ts.map +1 -1
  44. package/dist/view-transitions/swap.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/dist/provider-B6Xnh0BA.cjs +0 -1
  47. package/dist/provider-CMBovM_W.js +0 -134
  48. package/dist/ssgoi-transition/types.d.ts +0 -8
  49. package/dist/ssgoi-transition/types.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,65 +1,65 @@
1
- var K = Object.defineProperty;
2
- var J = (n, i, t) => i in n ? K(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
3
- var d = (n, i, t) => J(n, typeof i != "symbol" ? i + "" : i, t);
4
- import { normalizeToMultiSpring as P, normalizeMultiSpringSchedule as U } from "./types.js";
5
- import { isCssAnimation as Ot, isMultiSpring as Lt, isSingleSpring as Dt, isTickAnimation as zt, validateAnimationMode as Nt, validateSpringItem as qt } from "./types.js";
6
- import { S as X, I as Q, a as Z } from "./provider-CMBovM_W.js";
7
- class tt {
1
+ var tt = Object.defineProperty;
2
+ var et = (e, n, t) => n in e ? tt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var m = (e, n, t) => et(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import { normalizeToMultiAnimation as F, normalizeSchedule as X } from "./types.js";
5
+ import { isCssAnimation as _t, isMultiAnimation as Nt, isSingleAnimation as Ut, isTickAnimation as Ht } from "./types.js";
6
+ import { S as $, I as it, a as nt } from "./provider-Cu4NSF1Q.js";
7
+ class rt {
8
8
  constructor() {
9
- d(this, "listeners", /* @__PURE__ */ new Set());
10
- d(this, "rafId", null);
11
- d(this, "isRunning", !1);
9
+ m(this, "listeners", /* @__PURE__ */ new Set());
10
+ m(this, "rafId", null);
11
+ m(this, "isRunning", !1);
12
12
  // Timing
13
- d(this, "startTime", Date.now());
14
- d(this, "lastUpdate", this.startTime);
15
- d(this, "elapsed", 0);
13
+ m(this, "startTime", Date.now());
14
+ m(this, "lastUpdate", this.startTime);
15
+ m(this, "elapsed", 0);
16
16
  // Lag smoothing (mobile optimization)
17
- d(this, "lagThreshold", 500);
17
+ m(this, "lagThreshold", 500);
18
18
  // ms - detect tab switches, backgrounding
19
- d(this, "adjustedLag", 33);
19
+ m(this, "adjustedLag", 33);
20
20
  // ms - max time jump to prevent animation skip
21
- d(this, "maxDeltaTime", 33);
21
+ m(this, "maxDeltaTime", 33);
22
22
  // ms - clamp for physics stability (30fps minimum)
23
23
  // FPS throttling
24
- d(this, "gap", 1e3 / 240);
24
+ m(this, "gap", 1e3 / 240);
25
25
  // max 240fps
26
- d(this, "nextTime", this.gap);
27
- d(this, "tick", () => {
28
- const i = Date.now();
29
- let e = i - this.lastUpdate;
30
- e > this.lagThreshold || e < 0 ? (this.startTime += e - this.adjustedLag, e = this.adjustedLag) : e > this.maxDeltaTime && (e = this.maxDeltaTime), this.lastUpdate = i;
31
- const o = i - this.startTime, s = o - this.nextTime;
32
- if (s > 0) {
33
- const l = e / 1e3;
34
- this.elapsed = o / 1e3, this.nextTime += s + (s >= this.gap ? 4 : this.gap - s), this.listeners.forEach((r) => {
35
- r(l, this.elapsed);
26
+ m(this, "nextTime", this.gap);
27
+ m(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;
32
+ if (o > 0) {
33
+ const c = i / 1e3;
34
+ this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((a) => {
35
+ a(c, this.elapsed);
36
36
  });
37
37
  }
38
38
  this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
39
39
  });
40
40
  }
41
- subscribe(i) {
42
- return this.listeners.add(i), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
43
- this.unsubscribe(i);
41
+ subscribe(n) {
42
+ return this.listeners.add(n), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
43
+ this.unsubscribe(n);
44
44
  };
45
45
  }
46
- unsubscribe(i) {
47
- this.listeners.delete(i), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
46
+ unsubscribe(n) {
47
+ this.listeners.delete(n), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
48
48
  }
49
49
  /**
50
50
  * Configure lag smoothing behavior
51
51
  * @param threshold - Time threshold to detect lag (default: 500ms)
52
52
  * @param adjustedLag - Max time jump when lag detected (default: 33ms)
53
53
  */
54
- lagSmoothing(i, t) {
55
- this.lagThreshold = i, this.adjustedLag = Math.min(t, i);
54
+ lagSmoothing(n, t) {
55
+ this.lagThreshold = n, this.adjustedLag = Math.min(t, n);
56
56
  }
57
57
  /**
58
58
  * Set maximum FPS
59
59
  * @param fps - Target FPS (default: 240)
60
60
  */
61
- fps(i) {
62
- this.gap = 1e3 / i, this.nextTime = this.elapsed * 1e3 + this.gap;
61
+ fps(n) {
62
+ this.gap = 1e3 / n, this.nextTime = this.elapsed * 1e3 + this.gap;
63
63
  }
64
64
  getListenerCount() {
65
65
  return this.listeners.size;
@@ -68,133 +68,138 @@ class tt {
68
68
  return this.elapsed;
69
69
  }
70
70
  }
71
- const z = new tt();
72
- function et(n) {
71
+ const _ = new rt();
72
+ function ot(e) {
73
73
  const {
74
- integrator: i,
74
+ integrator: n,
75
75
  from: t,
76
- to: e,
77
- velocity: o = 0,
78
- onUpdate: s,
79
- onComplete: l,
80
- onStart: r
81
- } = n;
82
- let c = { position: t, velocity: o }, u = !0, m = 0, g = !1;
83
- const y = (S) => {
76
+ to: i,
77
+ velocity: r = 0,
78
+ onUpdate: o,
79
+ onComplete: c,
80
+ onStart: a
81
+ } = e;
82
+ let s = { position: t, velocity: r }, u = !0, h = 0, p = !1;
83
+ const w = (v) => {
84
84
  if (u) {
85
- if (g || (g = !0, r == null || r()), c = i.step(c, e, S), i.isSettled(c, e)) {
86
- if (m += Math.min(S, 0.033), m >= X) {
87
- c = { position: e, velocity: 0 }, u = !1, s(c.position), z.unsubscribe(y), l();
85
+ if (p || (p = !0, a == null || a()), s = n.step(s, i, v), n.isSettled(s, i)) {
86
+ if (h += Math.min(v, 0.033), h >= $) {
87
+ s = { position: i, velocity: 0 }, u = !1, o(s.position), _.unsubscribe(w), c();
88
88
  return;
89
89
  }
90
90
  } else
91
- m = 0;
92
- s(c.position);
91
+ h = 0;
92
+ o(s.position);
93
93
  }
94
94
  };
95
- return z.subscribe(y), {
95
+ return _.subscribe(w), {
96
96
  stop: () => {
97
- u && (u = !1, z.unsubscribe(y));
97
+ u && (u = !1, _.unsubscribe(w));
98
98
  },
99
- getPosition: () => c.position,
100
- getVelocity: () => c.velocity,
99
+ getPosition: () => s.position,
100
+ getVelocity: () => s.velocity,
101
101
  isRunning: () => u
102
102
  };
103
103
  }
104
- const x = 1e3 / 60;
105
- function it(n, i, t, e = 0) {
106
- let s = { position: i, velocity: e }, l = 0;
107
- const r = [];
108
- for (let c = 0; c < 600; c++) {
109
- const u = c * x;
110
- if (r.push({
104
+ const M = 1e3 / 60;
105
+ function st(e, n, t, i = 0) {
106
+ let o = { position: n, velocity: i }, c = 0;
107
+ const a = [];
108
+ for (let s = 0; s < 600; s++) {
109
+ const u = s * M;
110
+ if (a.push({
111
111
  time: u,
112
- position: s.position,
113
- velocity: s.velocity
114
- }), s = n.step(s, t, x / 1e3), n.isSettled(s, t)) {
115
- if (l += x / 1e3, l >= X) {
116
- r.push({
117
- time: (c + 1) * x,
112
+ position: o.position,
113
+ velocity: o.velocity
114
+ }), o = e.step(o, t, M / 1e3), e.isSettled(o, t)) {
115
+ if (c += M / 1e3, c >= $) {
116
+ a.push({
117
+ time: (s + 1) * M,
118
118
  position: t,
119
119
  velocity: 0
120
120
  });
121
121
  break;
122
122
  }
123
123
  } else
124
- l = 0;
124
+ c = 0;
125
125
  }
126
- return r;
126
+ return a;
127
127
  }
128
- function H(n, i) {
129
- if (n.length === 0)
128
+ function Y(e, n) {
129
+ if (e.length === 0)
130
130
  return { position: 0, velocity: 0 };
131
- const t = n[0], e = n[n.length - 1];
132
- if (i <= 0)
131
+ const t = e[0], i = e[e.length - 1];
132
+ if (n <= 0)
133
133
  return { position: t.position, velocity: t.velocity };
134
- if (i >= e.time)
135
- return { position: e.position, velocity: e.velocity };
136
- let o = 0, s = n.length - 1;
137
- for (; o < s - 1; ) {
138
- const u = Math.floor((o + s) / 2);
139
- n[u].time <= i ? o = u : s = u;
134
+ if (n >= i.time)
135
+ return { position: i.position, velocity: i.velocity };
136
+ let r = 0, o = e.length - 1;
137
+ for (; r < o - 1; ) {
138
+ const u = Math.floor((r + o) / 2);
139
+ e[u].time <= n ? r = u : o = u;
140
140
  }
141
- const l = n[o], r = n[s], c = (i - l.time) / (r.time - l.time);
141
+ const c = e[r], a = e[o], s = (n - c.time) / (a.time - c.time);
142
142
  return {
143
- position: l.position + (r.position - l.position) * c,
144
- velocity: l.velocity + (r.velocity - l.velocity) * c
143
+ position: c.position + (a.position - c.position) * s,
144
+ velocity: c.velocity + (a.velocity - c.velocity) * s
145
145
  };
146
146
  }
147
- function nt(n, i) {
148
- return n.map((t) => i(t.position));
147
+ function at(e, n) {
148
+ return e.map((t) => n(t.position));
149
149
  }
150
- function rt(n) {
150
+ function ct(e) {
151
151
  const {
152
- integrator: i,
152
+ integrator: n,
153
153
  element: t,
154
- from: e,
155
- to: o,
156
- velocity: s = 0,
157
- style: l,
158
- onComplete: r,
159
- onStart: c
160
- } = n, u = it(i, e, o, s);
154
+ from: i,
155
+ to: r,
156
+ velocity: o = 0,
157
+ style: c,
158
+ onComplete: a,
159
+ onStart: s
160
+ } = e, u = st(n, i, r, o);
161
161
  if (u.length === 0)
162
- return c == null || c(), r(), {
162
+ return s == null || s(), a(), {
163
163
  stop: () => {
164
164
  },
165
- getPosition: () => o,
165
+ getPosition: () => r,
166
166
  getVelocity: () => 0,
167
167
  isRunning: () => !1
168
168
  };
169
- const m = nt(u, l), g = u[u.length - 1], y = g.time, S = t.animate(m, {
170
- duration: y,
169
+ const h = at(u, c), p = u[u.length - 1], w = p.time, v = h[0];
170
+ if (v)
171
+ for (const y of Object.keys(v))
172
+ t.style[y] = "";
173
+ const d = t.animate(h, {
174
+ duration: w,
171
175
  fill: "forwards",
172
- easing: "linear"
176
+ easing: "linear",
177
+ composite: "replace"
173
178
  });
174
- let a = !0;
175
- const f = performance.now();
176
- return c == null || c(), S.onfinish = () => {
177
- a && (a = !1, r());
179
+ let l = !0;
180
+ const C = performance.now();
181
+ return s == null || s(), d.onfinish = () => {
182
+ l && (l = !1, a());
178
183
  }, {
179
184
  stop: () => {
180
- a && (a = !1, S.cancel());
185
+ l && (l = !1, d.cancel());
181
186
  },
182
187
  getPosition: () => {
183
- if (!a)
184
- return g.position;
185
- const A = performance.now() - f;
186
- return H(u, A).position;
188
+ if (!l)
189
+ return p.position;
190
+ const y = performance.now() - C;
191
+ return Y(u, y).position;
187
192
  },
188
193
  getVelocity: () => {
189
- if (!a)
194
+ if (!l)
190
195
  return 0;
191
- const A = performance.now() - f;
192
- return H(u, A).velocity;
196
+ const y = performance.now() - C;
197
+ return Y(u, y).velocity;
193
198
  },
194
- isRunning: () => a
199
+ isRunning: () => l
195
200
  };
196
201
  }
197
- class ot {
202
+ class lt {
198
203
  /**
199
204
  * Get bound runner based on animation mode
200
205
  *
@@ -202,59 +207,83 @@ class ot {
202
207
  * @returns Bound runner function or null if no animation mode specified
203
208
  * @throws Error if both tick and css are provided
204
209
  */
205
- static from(i) {
206
- const { tick: t, css: e } = i;
207
- if (t && e)
210
+ static from(n) {
211
+ const { tick: t, css: i } = n;
212
+ if (t && i)
208
213
  throw new Error("Cannot use both 'tick' and 'css' options together");
209
- return e ? (o) => rt({
210
- ...o,
211
- element: e.element,
212
- style: e.style
213
- }) : t ? (o) => et({
214
- ...o,
214
+ return i ? (r) => ct({
215
+ ...r,
216
+ element: i.element,
217
+ style: i.style
218
+ }) : t ? (r) => ot({
219
+ ...r,
215
220
  onUpdate: t
216
221
  }) : null;
217
222
  }
218
223
  }
219
- class Y {
224
+ class K {
220
225
  }
221
- const st = { stiffness: 300, damping: 30 };
222
- class O extends Y {
226
+ const ut = { stiffness: 300, damping: 30 };
227
+ class j extends K {
223
228
  constructor(t) {
224
229
  super();
225
- d(this, "options");
226
- d(this, "runner");
227
- d(this, "controls", null);
228
- d(this, "isAnimating", !1);
229
- d(this, "currentValue");
230
- d(this, "currentVelocity", 0);
231
- this.options = {
230
+ m(this, "options");
231
+ m(this, "runner");
232
+ m(this, "controls", null);
233
+ m(this, "isAnimating", !1);
234
+ m(this, "currentValue");
235
+ m(this, "currentVelocity", 0);
236
+ m(this, "updateFn");
237
+ if (this.options = {
232
238
  from: t.from ?? 0,
233
239
  to: t.to ?? 1,
234
240
  physics: t.physics,
235
241
  onComplete: t.onComplete ?? (() => {
236
242
  }),
237
243
  onStart: t.onStart
238
- }, this.currentValue = this.options.from, this.runner = ot.from({
244
+ }, this.currentValue = this.options.from, t.tick)
245
+ this.updateFn = (i) => {
246
+ var r;
247
+ return (r = t.tick) == null ? void 0 : r.call(t, i);
248
+ };
249
+ else if (t.css) {
250
+ const { element: i, style: r } = t.css;
251
+ this.updateFn = (o) => {
252
+ const c = r(o);
253
+ for (const [a, s] of Object.entries(c))
254
+ i.style[a] = typeof s == "number" ? String(s) : s;
255
+ };
256
+ } else
257
+ this.updateFn = () => {
258
+ };
259
+ this.runner = lt.from({
239
260
  tick: t.tick,
240
261
  css: t.css
241
262
  });
242
263
  }
264
+ /**
265
+ * Sync element state to current progress value
266
+ * Uses the update callback if provided
267
+ */
268
+ syncState() {
269
+ var t;
270
+ (t = this.updateFn) == null || t.call(this, this.currentValue);
271
+ }
243
272
  /**
244
273
  * Create Integrator from physics options
245
274
  * Priority: integrator factory > inertia/spring config > default spring
246
275
  */
247
276
  createIntegrator() {
248
277
  const t = this.options.physics;
249
- return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? Q.from({
278
+ return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? it.from({
250
279
  spring: t.spring,
251
280
  inertia: t.inertia
252
- }) : new Z(st);
281
+ }) : new nt(ut);
253
282
  }
254
283
  runAnimation(t) {
255
- var e, o;
284
+ var i, r;
256
285
  if (this.isAnimating = !0, !this.runner) {
257
- (o = (e = this.options).onStart) == null || o.call(e), this.currentValue = t, this.currentVelocity = 0, this.isAnimating = !1, this.options.onComplete();
286
+ (r = (i = this.options).onStart) == null || r.call(i), this.currentValue = t, this.currentVelocity = 0, this.isAnimating = !1, this.options.onComplete();
258
287
  return;
259
288
  }
260
289
  this.controls = this.runner({
@@ -309,46 +338,46 @@ class O extends Y {
309
338
  updateOptions(t) {
310
339
  this.options = { ...this.options, ...t };
311
340
  }
312
- static fromState(t, e) {
313
- const o = new O(e);
314
- return o.setValue(t.position), o.setVelocity(t.velocity), o;
315
- }
316
341
  }
317
- class L extends Y {
342
+ class L extends K {
318
343
  constructor(t) {
319
344
  super();
320
- d(this, "config");
321
- d(this, "animators", /* @__PURE__ */ new Map());
322
- d(this, "springOrder", []);
323
- d(this, "completedCount", 0);
324
- d(this, "completedAnimators", /* @__PURE__ */ new Set());
325
- d(this, "direction", "forward");
326
- d(this, "idCounter", 0);
327
- d(this, "rafId", null);
328
- d(this, "from");
329
- d(this, "to");
330
- this.config = t.config, this.from = t.from, this.to = t.to, this.initializeAnimators();
345
+ m(this, "config");
346
+ m(this, "animators", /* @__PURE__ */ new Map());
347
+ m(this, "itemOrder", []);
348
+ m(this, "completedCount", 0);
349
+ m(this, "completedAnimators", /* @__PURE__ */ new Set());
350
+ m(this, "direction", "forward");
351
+ m(this, "idCounter", 0);
352
+ m(this, "rafId", null);
353
+ m(this, "from");
354
+ m(this, "to");
355
+ m(this, "initialState");
356
+ this.config = t.config, this.from = t.from, this.to = t.to, this.initialState = t.state ?? {
357
+ position: t.from,
358
+ velocity: 0
359
+ }, this.initializeAnimators();
331
360
  }
332
361
  generateId() {
333
362
  return `spring_${this.idCounter++}`;
334
363
  }
335
364
  initializeAnimators() {
336
- this.config.springs.forEach((t) => {
337
- const e = this.generateId(), o = new O({
365
+ this.config.items.forEach((t, i) => {
366
+ const r = this.generateId(), o = new j({
338
367
  from: this.from,
339
368
  to: this.to,
340
369
  physics: t.physics,
341
370
  tick: t.tick,
342
371
  css: t.css,
343
- onComplete: () => this.onAnimatorComplete(e),
372
+ onComplete: () => this.onAnimatorComplete(r),
344
373
  onStart: t.onStart
345
374
  });
346
- this.animators.set(e, {
347
- id: e,
375
+ (i === 0 || t.normalizedOffset === 0) && (o.setValue(this.initialState.position), o.setVelocity(this.initialState.velocity), o.syncState()), this.animators.set(r, {
376
+ id: r,
348
377
  item: t,
349
378
  animator: o,
350
379
  started: !1
351
- }), this.springOrder.push(e);
380
+ }), this.itemOrder.push(r);
352
381
  });
353
382
  }
354
383
  /**
@@ -356,8 +385,8 @@ class L extends Y {
356
385
  * Progress = |position - from| / |to - from|
357
386
  */
358
387
  getAnimatorProgress(t) {
359
- const e = t.animator.getCurrentState(), o = Math.abs(e.to - e.from);
360
- return o === 0 ? 1 : Math.abs(e.position - e.from) / o;
388
+ const i = t.animator.getCurrentState(), r = Math.abs(i.to - i.from);
389
+ return r === 0 ? 1 : Math.abs(i.position - i.from) / r;
361
390
  }
362
391
  /**
363
392
  * Get order of springs based on direction
@@ -365,12 +394,12 @@ class L extends Y {
365
394
  * Backward: n-1, n-2, ..., 0
366
395
  */
367
396
  getOrderedIds() {
368
- return this.direction === "forward" ? this.springOrder : [...this.springOrder].reverse();
397
+ return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
369
398
  }
370
399
  onAnimatorComplete(t) {
371
- var o, s, l, r, c, u;
372
- const e = this.animators.get(t);
373
- !e || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (s = (o = e.item).onComplete) == null || s.call(o), (r = (l = this.config).onProgress) == null || r.call(l, this.completedCount, this.config.springs.length), this.completedCount === this.config.springs.length && (this.stopScheduler(), (u = (c = this.config).onEnd) == null || u.call(c)));
400
+ var r, o, c, a, s, u;
401
+ const i = this.animators.get(t);
402
+ !i || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = i.item).onComplete) == null || o.call(r), (a = (c = this.config).onProgress) == null || a.call(c, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (u = (s = this.config).onEnd) == null || u.call(s)));
374
403
  }
375
404
  /**
376
405
  * Check and start springs based on previous spring's progress
@@ -378,22 +407,22 @@ class L extends Y {
378
407
  */
379
408
  checkAndStartSprings() {
380
409
  const t = this.getOrderedIds();
381
- for (let e = 0; e < t.length; e++) {
382
- const o = t[e], s = this.animators.get(o);
383
- if (!s || s.started) continue;
384
- if (e === 0) {
385
- this.startAnimator(o);
410
+ for (let i = 0; i < t.length; i++) {
411
+ const r = t[i], o = this.animators.get(r);
412
+ if (!o || o.started) continue;
413
+ if (i === 0) {
414
+ this.startAnimator(r);
386
415
  continue;
387
416
  }
388
- const l = t[e - 1], r = this.animators.get(l);
389
- if (!r || !r.started) continue;
390
- const c = this.getAnimatorProgress(r), u = s.item.normalizedOffset;
391
- c >= u && this.startAnimator(o);
417
+ const c = t[i - 1], a = this.animators.get(c);
418
+ if (!a || !a.started) continue;
419
+ const s = this.getAnimatorProgress(a), u = o.item.normalizedOffset;
420
+ s >= u && this.startAnimator(r);
392
421
  }
393
422
  }
394
423
  startAnimator(t) {
395
- const e = this.animators.get(t);
396
- !e || e.started || (e.started = !0, this.direction === "forward" ? e.animator.forward() : e.animator.backward());
424
+ const i = this.animators.get(t);
425
+ !i || i.started || (i.started = !0, this.direction === "forward" ? i.animator.forward() : i.animator.backward());
397
426
  }
398
427
  /**
399
428
  * Start the scheduler loop that checks spring progress
@@ -408,17 +437,17 @@ class L extends Y {
408
437
  this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
409
438
  }
410
439
  getFirstAnimator() {
411
- var e;
412
- const t = this.springOrder[0];
413
- return t ? ((e = this.animators.get(t)) == null ? void 0 : e.animator) ?? null : null;
440
+ var i;
441
+ const t = this.itemOrder[0];
442
+ return t ? ((i = this.animators.get(t)) == null ? void 0 : i.animator) ?? null : null;
414
443
  }
415
444
  forward() {
416
- var t, e;
417
- this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (e = (t = this.config).onStart) == null || e.call(t), this.startScheduler();
445
+ var t, i;
446
+ this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (i = (t = this.config).onStart) == null || i.call(t), this.startScheduler();
418
447
  }
419
448
  backward() {
420
- var t, e;
421
- this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (e = (t = this.config).onStart) == null || e.call(t), this.startScheduler();
449
+ var t, i;
450
+ this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (i = (t = this.config).onStart) == null || i.call(t), this.startScheduler();
422
451
  }
423
452
  resetStartedFlags() {
424
453
  this.animators.forEach((t) => {
@@ -434,21 +463,18 @@ class L extends Y {
434
463
  this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((t) => {
435
464
  if (!t.started)
436
465
  return;
437
- const e = t.animator.getCurrentState();
438
- if (e.position === e.to) {
439
- const s = O.fromState(
440
- { position: this.to, velocity: 0 },
441
- {
442
- from: this.to,
443
- to: this.from,
444
- physics: t.item.physics,
445
- tick: t.item.tick,
446
- css: t.item.css,
447
- onComplete: () => this.onAnimatorComplete(t.id),
448
- onStart: t.item.onStart
449
- }
450
- );
451
- s.forward(), t.animator = s;
466
+ const i = t.animator.getCurrentState();
467
+ if (i.position === i.to) {
468
+ const o = new j({
469
+ from: this.to,
470
+ to: this.from,
471
+ physics: t.item.physics,
472
+ tick: t.item.tick,
473
+ css: t.item.css,
474
+ onComplete: () => this.onAnimatorComplete(t.id),
475
+ onStart: t.item.onStart
476
+ });
477
+ o.setValue(this.to), o.setVelocity(0), o.syncState(), o.forward(), t.animator = o;
452
478
  } else
453
479
  t.animator.reverse();
454
480
  });
@@ -481,16 +507,16 @@ class L extends Y {
481
507
  * TODO: Support per-spring control
482
508
  */
483
509
  setValue(t) {
484
- const e = this.getFirstAnimator();
485
- e == null || e.setValue(t);
510
+ const i = this.getFirstAnimator();
511
+ i == null || i.setValue(t);
486
512
  }
487
513
  /**
488
514
  * Set velocity on first animator
489
515
  * TODO: Support per-spring control
490
516
  */
491
517
  setVelocity(t) {
492
- const e = this.getFirstAnimator();
493
- e == null || e.setVelocity(t);
518
+ const i = this.getFirstAnimator();
519
+ i == null || i.setVelocity(t);
494
520
  }
495
521
  /**
496
522
  * Check if any animation is currently running
@@ -505,28 +531,27 @@ class L extends Y {
505
531
  * Create MultiAnimator from existing state
506
532
  * Uses first animator's state for initialization
507
533
  */
508
- static fromState(t, e) {
509
- const o = new L(e);
510
- return o.setValue(t.position), o.setVelocity(t.velocity), o;
534
+ static fromState(t, i) {
535
+ return new L({ ...i, state: t });
511
536
  }
512
537
  }
513
- const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
514
- runIn: async (i) => {
515
- const { currentAnimation: t } = n;
538
+ const B = Symbol.for("TRANSITION_STRATEGY"), ft = (e) => ({
539
+ runIn: async (n) => {
540
+ const { currentAnimation: t } = e;
516
541
  if (t && t.direction === "out") {
517
- const o = t.controller.getCurrentValue(), s = t.controller.getVelocity();
518
- if (t.controller.stop(), i.out)
542
+ const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
543
+ if (t.controller.stop(), n.out)
519
544
  return {
520
- config: await i.out,
521
- state: { position: o, velocity: s },
545
+ config: await n.out,
546
+ state: { position: r, velocity: o },
522
547
  from: 1,
523
548
  to: 0,
524
549
  direction: "backward"
525
550
  // Will actually go 0→1 (backward means toward 'from')
526
551
  };
527
552
  }
528
- return i.in ? {
529
- config: await i.in,
553
+ return n.in ? {
554
+ config: await n.in,
530
555
  state: {
531
556
  position: 0,
532
557
  velocity: 0
@@ -544,22 +569,22 @@ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
544
569
  direction: "forward"
545
570
  };
546
571
  },
547
- runOut: async (i) => {
548
- const { currentAnimation: t } = n;
572
+ runOut: async (n) => {
573
+ const { currentAnimation: t } = e;
549
574
  if (t && t.direction === "in") {
550
- const o = t.controller.getCurrentValue(), s = t.controller.getVelocity();
551
- if (t.controller.stop(), i.in)
575
+ const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
576
+ if (t.controller.stop(), n.in)
552
577
  return {
553
- config: await i.in,
554
- state: { position: o, velocity: s },
578
+ config: await n.in,
579
+ state: { position: r, velocity: o },
555
580
  from: 0,
556
581
  to: 1,
557
582
  direction: "backward"
558
583
  // Will actually go 1→0 (backward means toward 'from')
559
584
  };
560
585
  }
561
- return i.out ? {
562
- config: await i.out,
586
+ return n.out ? {
587
+ config: await n.out,
563
588
  state: {
564
589
  position: 1,
565
590
  velocity: 0
@@ -577,9 +602,9 @@ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
577
602
  direction: "forward"
578
603
  };
579
604
  }
580
- }), ct = () => ({
581
- runIn: async (n) => n.in ? {
582
- config: await n.in,
605
+ }), mt = () => ({
606
+ runIn: async (e) => e.in ? {
607
+ config: await e.in,
583
608
  state: {
584
609
  position: 0,
585
610
  velocity: 0
@@ -596,8 +621,8 @@ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
596
621
  to: 1,
597
622
  direction: "forward"
598
623
  },
599
- runOut: async (n) => n.out ? {
600
- config: await n.out,
624
+ runOut: async (e) => e.out ? {
625
+ config: await e.out,
601
626
  state: {
602
627
  position: 1,
603
628
  velocity: 0
@@ -614,146 +639,178 @@ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
614
639
  to: 0,
615
640
  direction: "forward"
616
641
  }
617
- }), j = "data-ssgoi-scope", G = "data-ssgoi-scope-ready";
618
- function bt() {
619
- return (n) => {
620
- if (n)
621
- return n.setAttribute(j, ""), queueMicrotask(() => {
642
+ }), J = "data-ssgoi-scope", Q = "data-ssgoi-scope-ready";
643
+ function It() {
644
+ return (e) => {
645
+ if (e)
646
+ return e.setAttribute(J, ""), queueMicrotask(() => {
622
647
  queueMicrotask(() => {
623
- n.setAttribute(G, "true");
648
+ e.setAttribute(Q, "true");
624
649
  });
625
650
  }), () => {
626
651
  };
627
652
  };
628
653
  }
629
- function lt(n) {
630
- return n.hasAttribute(G);
654
+ function dt(e) {
655
+ return e.hasAttribute(Q);
631
656
  }
632
- function ut(n) {
633
- return n.closest(`[${j}]`);
657
+ function ht(e) {
658
+ return e.closest(`[${J}]`);
634
659
  }
635
- function ft(n, i) {
636
- var S;
637
- let t = null, e = null, o = null, s = null;
638
- const l = {
660
+ const gt = (e) => {
661
+ let n = e.parentElement;
662
+ for (; n && n !== document.body; ) {
663
+ const t = window.getComputedStyle(n), i = t.overflow + t.overflowY + t.overflowX;
664
+ if (i.includes("auto") || i.includes("scroll") || n.scrollHeight > n.clientHeight || n.scrollWidth > n.clientWidth)
665
+ return n;
666
+ n = n.parentElement;
667
+ }
668
+ return document.documentElement;
669
+ }, pt = (e) => {
670
+ let n = e.parentElement;
671
+ for (; n && n !== document.body; ) {
672
+ const t = window.getComputedStyle(n).position;
673
+ if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
674
+ return n;
675
+ n = n.parentElement;
676
+ }
677
+ return document.body;
678
+ };
679
+ function W(e) {
680
+ return new Promise((n) => {
681
+ requestAnimationFrame(() => {
682
+ requestAnimationFrame(() => {
683
+ n();
684
+ });
685
+ });
686
+ });
687
+ }
688
+ function wt(e, n) {
689
+ var v;
690
+ let t = null, i = null, r = null, o = null;
691
+ const c = {
639
692
  get currentAnimation() {
640
693
  return t;
641
694
  }
642
- }, r = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, l)) || at(l), c = async (a) => {
643
- var E;
644
- e && (e.remove(), e = null);
645
- const f = n(), A = f.in && f.in(a), k = !(i != null && i.strategy) && f.out ? f.out(a) : void 0;
646
- if (!A)
695
+ }, a = ((v = n == null ? void 0 : n.strategy) == null ? void 0 : v.call(n, c)) || ft(c), s = async (d) => {
696
+ var b;
697
+ i && (i.remove(), i = null);
698
+ const l = e(), C = l.in && l.in(d), y = !(n != null && n.strategy) && l.out ? l.out(d) : void 0;
699
+ if (!C)
647
700
  return;
648
- const R = {
649
- in: P(A),
650
- out: k ? P(k) : void 0
651
- }, v = await r.runIn(R);
652
- if (!v.config) {
701
+ const P = {
702
+ in: F(C),
703
+ out: y ? F(y) : void 0
704
+ }, g = await a.runIn(P);
705
+ if (!g.config) {
653
706
  t && (t.direction = "in");
654
707
  return;
655
708
  }
656
- const p = v.config;
657
- (E = p.prepare) == null || E.call(p, a), p.wait && await p.wait();
658
- const w = U(
709
+ const f = g.config;
710
+ (b = f.prepare) == null || b.call(f);
711
+ const S = X(
659
712
  {
660
- ...p,
713
+ ...f,
661
714
  onEnd: () => {
662
- var C;
663
- t = null, (C = p.onEnd) == null || C.call(p);
715
+ var k;
716
+ t = null, (k = f.onEnd) == null || k.call(f);
664
717
  }
665
718
  },
666
- a
667
- ), h = L.fromState(v.state, {
668
- config: w,
669
- from: v.from,
670
- to: v.to
719
+ d
720
+ );
721
+ f.wait && await f.wait();
722
+ const A = L.fromState(g.state, {
723
+ config: S,
724
+ from: g.from,
725
+ to: g.to
671
726
  });
672
- t = { controller: h, direction: "in" }, v.direction === "forward" ? h.forward() : h.backward();
673
- }, u = async (a) => {
674
- var C;
675
- e = a;
676
- const f = n(), A = !(i != null && i.strategy) && f.in ? f.in(a) : void 0, k = f.out && f.out(a);
677
- if (!k)
727
+ t = { controller: A, direction: "in" }, await W(), g.direction === "forward" ? A.forward() : A.backward();
728
+ }, u = async (d) => {
729
+ var k;
730
+ i = d;
731
+ const l = e(), C = !(n != null && n.strategy) && l.in ? l.in(d) : void 0, y = l.out && l.out(d);
732
+ if (!y)
678
733
  return;
679
- const R = {
680
- in: A ? P(A) : void 0,
681
- out: P(k)
682
- }, v = await r.runOut(R);
683
- if (!v.config) {
684
- t && (t.direction = "out"), e && (e.remove(), e = null);
734
+ const P = {
735
+ in: C ? F(C) : void 0,
736
+ out: F(y)
737
+ }, g = await a.runOut(P);
738
+ if (!g.config) {
739
+ t && (t.direction = "out"), i && (i.remove(), i = null);
685
740
  return;
686
741
  }
687
- const p = v.config;
688
- (C = p.prepare) == null || C.call(p, a), E(), p.wait && await p.wait();
689
- const w = U(
742
+ const f = g.config;
743
+ b(), (k = f.prepare) == null || k.call(f);
744
+ const S = X(
690
745
  {
691
- ...p,
746
+ ...f,
692
747
  onEnd: () => {
693
- var V, I;
694
- (V = p.onEnd) == null || V.call(p), e && (e.remove(), e = null), t = null, (I = i == null ? void 0 : i.onCleanupEnd) == null || I.call(i);
748
+ var V, R;
749
+ (V = f.onEnd) == null || V.call(f), i && (i.remove(), i = null), t = null, (R = n == null ? void 0 : n.onCleanupEnd) == null || R.call(n);
695
750
  }
696
751
  },
697
- a
698
- ), h = L.fromState(v.state, {
699
- config: w,
700
- from: v.from,
701
- to: v.to
752
+ d
753
+ );
754
+ f.wait && await f.wait();
755
+ const A = L.fromState(g.state, {
756
+ config: S,
757
+ from: g.from,
758
+ to: g.to
702
759
  });
703
- t = { controller: h, direction: "out" }, v.direction === "forward" ? h.forward() : h.backward();
704
- function E() {
705
- !o || !e || (s && o.contains(s) ? o.insertBefore(e, s) : o.appendChild(e));
760
+ t = { controller: A, direction: "out" }, await W(), g.direction === "forward" ? A.forward() : A.backward();
761
+ function b() {
762
+ !r || !i || (o && r.contains(o) ? r.insertBefore(i, o) : r.appendChild(i));
706
763
  }
707
764
  };
708
- let m = null, g = !1;
709
- const y = (a) => () => {
710
- if (g) return;
711
- g = !0;
712
- const f = a.cloneNode(!0);
713
- m ? queueMicrotask(() => {
714
- document.contains(m) && u(f);
715
- }) : u(f);
765
+ let h = null, p = !1;
766
+ const w = (d) => () => {
767
+ if (p) return;
768
+ p = !0;
769
+ const l = d.cloneNode(!0);
770
+ h ? queueMicrotask(() => {
771
+ document.contains(h) && u(l);
772
+ }) : u(l);
716
773
  };
717
- return (a) => {
718
- if (a)
774
+ return (d) => {
775
+ if (d)
719
776
  return requestAnimationFrame(() => {
720
- o = a.parentElement, s = a.nextElementSibling;
721
- }), g = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
722
- m = ut(a), !(m && !lt(m)) && c(a);
723
- }) : c(a), y(a);
777
+ r = d.parentElement, o = d.nextElementSibling;
778
+ }), p = !1, (n == null ? void 0 : n.scope) === "local" ? queueMicrotask(() => {
779
+ h = ht(d), !(h && !dt(h)) && s(d);
780
+ }) : s(d), w(d);
724
781
  };
725
782
  }
726
- const b = /* @__PURE__ */ new Map();
727
- let T = null, N = !1;
728
- function $(n) {
729
- if (n instanceof HTMLElement && b.has(n)) {
730
- const t = b.get(n);
731
- b.delete(n), queueMicrotask(() => {
783
+ const T = /* @__PURE__ */ new Map();
784
+ let E = null, N = !1;
785
+ function Z(e) {
786
+ if (e instanceof HTMLElement && T.has(e)) {
787
+ const t = T.get(e);
788
+ T.delete(e), queueMicrotask(() => {
732
789
  t();
733
790
  });
734
791
  }
735
- const i = n.childNodes;
736
- for (let t = 0; t < i.length; t++) {
737
- const e = i[t];
738
- e && $(e);
792
+ const n = e.childNodes;
793
+ for (let t = 0; t < n.length; t++) {
794
+ const i = n[t];
795
+ i && Z(i);
739
796
  }
740
797
  }
741
- function dt() {
742
- N || typeof document > "u" || (N = !0, T = new MutationObserver((n) => {
743
- for (const i of n) {
744
- const t = i.removedNodes;
745
- for (let e = 0; e < t.length; e++) {
746
- const o = t[e];
747
- o && $(o);
798
+ function yt() {
799
+ N || typeof document > "u" || (N = !0, E = new MutationObserver((e) => {
800
+ for (const n of e) {
801
+ const t = n.removedNodes;
802
+ for (let i = 0; i < t.length; i++) {
803
+ const r = t[i];
804
+ r && Z(r);
748
805
  }
749
806
  }
750
- }), document.body ? T.observe(document.body, {
807
+ }), document.body ? E.observe(document.body, {
751
808
  childList: !0,
752
809
  subtree: !0
753
810
  }) : document.addEventListener(
754
811
  "DOMContentLoaded",
755
812
  () => {
756
- T == null || T.observe(document.body, {
813
+ E == null || E.observe(document.body, {
757
814
  childList: !0,
758
815
  subtree: !0
759
816
  });
@@ -761,270 +818,298 @@ function dt() {
761
818
  { once: !0 }
762
819
  ));
763
820
  }
764
- function mt(n, i) {
765
- dt(), b.set(n, i);
821
+ function vt(e, n) {
822
+ yt(), T.set(e, n);
766
823
  }
767
- function kt(n) {
768
- return b.has(n);
824
+ function Ft(e) {
825
+ return T.has(e);
769
826
  }
770
- function Vt() {
771
- return b.size;
827
+ function Mt() {
828
+ return T.size;
772
829
  }
773
- function Rt(n) {
774
- const i = b.get(n);
775
- return i ? (b.delete(n), i(), !0) : !1;
830
+ function xt(e) {
831
+ const n = T.get(e);
832
+ return n ? (T.delete(e), n(), !0) : !1;
776
833
  }
777
- function It() {
778
- b.clear(), T == null || T.disconnect(), T = null, N = !1;
834
+ function Ot() {
835
+ T.clear(), E == null || E.disconnect(), E = null, N = !1;
779
836
  }
780
- const F = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
781
- function ht(n, i, t) {
782
- F.set(n, i);
783
- let e = q.get(n);
784
- if (e)
785
- return e;
786
- const o = i;
787
- return e = ft(
837
+ const O = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
838
+ function St(e, n, t) {
839
+ O.set(e, n);
840
+ let i = U.get(e);
841
+ if (i)
842
+ return i;
843
+ const r = n;
844
+ return i = wt(
788
845
  () => {
789
- const s = F.get(n);
790
- return s || (console.warn(`Transition "${String(n)}" not found`), {});
846
+ const o = O.get(e);
847
+ return o || (console.warn(`Transition "${String(e)}" not found`), {});
791
848
  },
792
849
  {
793
850
  strategy: t == null ? void 0 : t.strategy,
794
851
  scope: t == null ? void 0 : t.scope,
795
852
  onCleanupEnd: () => {
796
- F.get(n) === o && gt(n);
853
+ O.get(e) === r && Ct(e);
797
854
  }
798
855
  }
799
- ), q.set(n, e), e;
856
+ ), U.set(e, i), i;
800
857
  }
801
- function gt(n) {
802
- F.delete(n), q.delete(n), _.delete(n);
858
+ function Ct(e) {
859
+ O.delete(e), U.delete(e), H.delete(e);
803
860
  }
804
- function Pt(n, i = "manual") {
805
- const t = ht(
806
- n.key,
861
+ function Lt(e, n = "manual") {
862
+ const t = St(
863
+ e.key,
807
864
  {
808
- in: n.in,
809
- out: n.out
865
+ in: e.in,
866
+ out: e.out
810
867
  },
811
868
  {
812
- strategy: n[W],
813
- scope: n.scope
869
+ strategy: e[B],
870
+ scope: e.scope
814
871
  }
815
872
  );
816
- if (i === "manual")
873
+ if (n === "manual")
817
874
  return t;
818
- let e = _.get(n.key);
819
- return e || (e = (o) => {
820
- if (o) {
821
- const s = t(o);
822
- s && mt(o, s);
875
+ let i = H.get(e.key);
876
+ return i || (i = (r) => {
877
+ if (r) {
878
+ const o = t(r);
879
+ o && vt(r, o);
823
880
  }
824
- }, _.set(n.key, e), e);
881
+ }, H.set(e.key, i), i);
825
882
  }
826
- function pt(n) {
827
- const i = n.filter((t) => t.symmetric).map((t) => ({
883
+ function At(e) {
884
+ const n = e.filter((t) => t.symmetric).map((t) => ({
828
885
  from: t.to,
829
886
  to: t.from,
830
887
  transition: t.transition
831
888
  }));
832
- return [...n, ...i];
889
+ return [...e, ...n];
833
890
  }
834
- function wt(n) {
835
- let i = !1, t = 0, e = 0, o = !1;
836
- const s = 50, l = (a) => {
837
- if (!n) return;
838
- const f = a.touches[0];
839
- f && (o = f.clientX < s, o && (t = f.clientX, e = f.clientY));
840
- }, r = (a) => {
841
- if (!n || !o) return;
842
- const f = a.touches[0];
843
- if (!f) return;
844
- const A = f.clientX - t, k = f.clientY - e;
845
- A > window.outerWidth / 2 - 5 && Math.abs(A) > Math.abs(k) ? i = !0 : i = !1;
846
- }, c = () => {
847
- n && (o = !1, t = 0, e = 0);
848
- }, u = () => i, m = () => {
849
- typeof window > "u" || n && (window.addEventListener("touchstart", l, { passive: !0 }), window.addEventListener("touchmove", r, { passive: !0 }), window.addEventListener("touchend", c, { passive: !0 }));
850
- }, g = () => {
851
- typeof window > "u" || (window.removeEventListener("touchstart", l), window.removeEventListener("touchmove", r), window.removeEventListener("touchend", c));
891
+ function Et(e) {
892
+ let n = !1, t = 0, i = 0, r = !1;
893
+ const o = 50, c = (d) => {
894
+ if (!e) return;
895
+ const l = d.touches[0];
896
+ l && (r = l.clientX < o, r && (t = l.clientX, i = l.clientY));
897
+ }, a = (d) => {
898
+ if (!e || !r) return;
899
+ const l = d.touches[0];
900
+ if (!l) return;
901
+ const C = l.clientX - t, y = l.clientY - i;
902
+ C > window.outerWidth / 2 - 5 && Math.abs(C) > Math.abs(y) ? n = !0 : n = !1;
903
+ }, s = () => {
904
+ e && (r = !1, t = 0, i = 0);
905
+ }, u = () => n, h = () => {
906
+ typeof window > "u" || e && (window.addEventListener("touchstart", c, { passive: !0 }), window.addEventListener("touchmove", a, { passive: !0 }), window.addEventListener("touchend", s, { passive: !0 }));
907
+ }, p = () => {
908
+ typeof window > "u" || (window.removeEventListener("touchstart", c), window.removeEventListener("touchmove", a), window.removeEventListener("touchend", s));
852
909
  };
853
- let y = 0;
910
+ let w = 0;
854
911
  return {
855
- initialize: m,
856
- cleanup: g,
912
+ initialize: h,
913
+ cleanup: p,
857
914
  isSwipePending: u,
858
915
  resetSwipeDetection: () => {
859
- y++, y > 1 && (y = 0, i = !1);
916
+ w++, w > 1 && (w = 0, n = !1);
860
917
  }
861
918
  };
862
919
  }
863
- const yt = (n) => {
864
- let i = n.parentElement;
865
- for (; i && i !== document.body; ) {
866
- const t = window.getComputedStyle(i), e = t.overflow + t.overflowY + t.overflowX;
867
- if (e.includes("auto") || e.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
868
- return i;
869
- i = i.parentElement;
870
- }
871
- return document.documentElement;
872
- }, vt = (n) => {
873
- let i = n.parentElement;
874
- for (; i && i !== document.body; ) {
875
- const t = window.getComputedStyle(i).position;
876
- if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
877
- return i;
878
- i = i.parentElement;
879
- }
880
- return document.body;
881
- };
882
- function St() {
883
- let n = null, i = null;
920
+ function Tt() {
921
+ let e = null, n = null;
884
922
  const t = /* @__PURE__ */ new Map();
885
- let e = null;
886
- const o = () => {
887
- n && e && t.set(e, {
888
- x: n.scrollLeft,
889
- y: n.scrollTop
923
+ let i = null;
924
+ const r = () => {
925
+ e && i && t.set(i, {
926
+ x: e.scrollLeft,
927
+ y: e.scrollTop
890
928
  });
891
929
  };
892
930
  return {
893
- initializeContext: (m, g) => {
894
- i = m, n || (n = yt(m), (n === document.documentElement ? window : n).addEventListener("scroll", o, {
931
+ initializeContext: (h, p) => {
932
+ n = h, e || (e = gt(h), (e === document.documentElement ? window : e).addEventListener("scroll", r, {
895
933
  passive: !0
896
- })), e = g;
934
+ })), i = p;
897
935
  },
898
- calculateScrollOffset: (m, g) => {
899
- const y = m && t.has(m) ? t.get(m) : { x: 0, y: 0 }, S = g && t.has(g) ? t.get(g) : { x: 0, y: 0 };
936
+ calculateScrollOffset: (h, p) => {
937
+ const w = h && t.has(h) ? t.get(h) : { x: 0, y: 0 }, v = p && t.has(p) ? t.get(p) : { x: 0, y: 0 };
900
938
  return {
901
- x: -S.x + y.x,
902
- y: -S.y + y.y
939
+ x: -v.x + w.x,
940
+ y: -v.y + w.y
903
941
  };
904
942
  },
905
- getScrollContainer: () => n,
906
- getPositionedParentElement: () => i ? vt(i) : document.body,
907
- getScrollPosition: (m) => m && t.has(m) ? t.get(m) : { x: 0, y: 0 }
943
+ getScrollContainer: () => e,
944
+ getPositionedParentElement: () => n ? pt(n) : document.body,
945
+ getScrollPosition: (h) => h && t.has(h) ? t.get(h) : { x: 0, y: 0 }
908
946
  };
909
947
  }
910
- function M(n, i) {
911
- if (i === "*")
948
+ function x(e, n) {
949
+ if (n === "*")
912
950
  return !0;
913
- if (i.endsWith("/*")) {
914
- const t = i.slice(0, -2);
915
- return n === t || n.startsWith(t + "/");
951
+ if (n.endsWith("/*")) {
952
+ const t = n.slice(0, -2);
953
+ return e === t || e.startsWith(t + "/");
916
954
  }
917
- return n === i;
955
+ return e === n;
918
956
  }
919
- function Ct(n, i, t) {
920
- for (const e of t)
921
- if (M(n, e.from) && M(i, e.to))
922
- return e.transition;
923
- for (const e of t)
924
- if ((e.from === "*" || M(n, e.from)) && (e.to === "*" || M(i, e.to)))
925
- return e.transition;
957
+ function G(e, n, t) {
958
+ for (const i of t)
959
+ if (x(e, i.from) && x(n, i.to))
960
+ return i.transition;
961
+ for (const i of t)
962
+ if ((i.from === "*" || x(e, i.from)) && (i.to === "*" || x(n, i.to)))
963
+ return i.transition;
926
964
  return null;
927
965
  }
928
- function xt(n, i) {
966
+ function bt() {
967
+ let e = null;
968
+ function n() {
969
+ if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
970
+ const t = { from: e.from, to: e.to };
971
+ e.outResolve(t), e.inResolve(t), e = null;
972
+ }
973
+ }
974
+ return {
975
+ trigger(t, i) {
976
+ e || (e = {}), i === "out" ? e.from = t : e.to = t;
977
+ },
978
+ get(t) {
979
+ return t === "in" && (!e || !e.from) ? Promise.resolve(null) : new Promise((i) => {
980
+ e || (e = {}), t === "out" ? e.outResolve = i : e.inResolve = i, n();
981
+ });
982
+ }
983
+ };
984
+ }
985
+ function kt() {
986
+ let e = null;
987
+ function n() {
988
+ var i, r;
989
+ e && ((i = e.outResolve) == null || i.call(e, null), (r = e.inResolve) == null || r.call(e, null), e = null);
990
+ }
991
+ function t() {
992
+ if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
993
+ const i = { from: e.from, to: e.to };
994
+ e.outResolve(i), e.inResolve(i), e = null;
995
+ }
996
+ }
997
+ return {
998
+ trigger(i, r) {
999
+ 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;
1000
+ },
1001
+ get(i) {
1002
+ return new Promise((r) => {
1003
+ e || (e = {}), i === "out" ? e.outResolve = r : e.inResolve = r, t();
1004
+ });
1005
+ }
1006
+ };
1007
+ }
1008
+ function Dt(e, n) {
929
1009
  const {
930
1010
  transitions: t = [],
931
- defaultTransition: e,
932
- middleware: o = (w, h) => ({ from: w, to: h }),
1011
+ defaultTransition: i,
1012
+ middleware: r = (g, f) => ({ from: g, to: f }),
933
1013
  // Identity function as default
934
- skipOnIosSwipe: s = !0
1014
+ skipOnIosSwipe: o = !0
935
1015
  // Default to true - skip animations on iOS swipe
936
- } = n, { outFirst: l = !0 } = i || {};
937
- let r = null;
938
- const c = pt(t), {
939
- initializeContext: u,
940
- calculateScrollOffset: m,
941
- getScrollContainer: g,
942
- getPositionedParentElement: y,
943
- getScrollPosition: S
944
- } = St(), a = wt(s);
945
- a.initialize();
946
- function f() {
947
- if (r != null && r.from && (r != null && r.to)) {
948
- const { from: w, to: h } = o(
949
- r.from,
950
- r.to
951
- ), C = Ct(
952
- w,
953
- h,
954
- c
955
- ) || e, V = m(
956
- r.from,
957
- r.to
958
- ), I = {
959
- scrollOffset: V,
960
- scroll: S(r.from),
1016
+ } = e, { outFirst: c = !0, createNavigationDetector: a } = n || {}, s = (a == null ? void 0 : a()) ?? (c ? bt() : kt()), u = At(t), {
1017
+ initializeContext: h,
1018
+ calculateScrollOffset: p,
1019
+ getScrollContainer: w,
1020
+ getPositionedParentElement: v,
1021
+ getScrollPosition: d
1022
+ } = Tt(), l = Et(o);
1023
+ l.initialize();
1024
+ const C = async (g, f) => {
1025
+ if (l.isSwipePending())
1026
+ return l.resetSwipeDetection(), () => ({});
1027
+ s.trigger(g, f);
1028
+ const S = await s.get(f);
1029
+ if (!S) return () => ({});
1030
+ const { from: A, to: b } = r(
1031
+ S.from,
1032
+ S.to
1033
+ ), V = G(
1034
+ A,
1035
+ b,
1036
+ u
1037
+ ) || i;
1038
+ if (!V) return () => ({});
1039
+ const R = p(S.from, S.to);
1040
+ if (f === "out") {
1041
+ const D = {
1042
+ scrollOffset: R,
1043
+ scroll: d(S.from),
961
1044
  get scrollingElement() {
962
- return g() || document.documentElement;
1045
+ return w() || document.documentElement;
963
1046
  },
964
1047
  get positionedParent() {
965
- return y();
1048
+ return v();
966
1049
  }
967
- }, B = {
968
- scrollOffset: V,
1050
+ };
1051
+ return (I) => V.out(I, D);
1052
+ } else {
1053
+ const D = {
1054
+ scrollOffset: R,
969
1055
  get scroll() {
970
- return r ? S(r.to) : { x: 0, y: 0 };
1056
+ return d(S.to);
971
1057
  },
972
1058
  get scrollingElement() {
973
- return g() || document.documentElement;
1059
+ return w() || document.documentElement;
974
1060
  },
975
1061
  get positionedParent() {
976
- return y();
1062
+ return v();
977
1063
  }
978
1064
  };
979
- C && (C.out && r.outResolve && r.outResolve(
980
- (D) => C.out(D, I)
981
- ), C.in && r.inResolve && r.inResolve(
982
- (D) => C.in(D, B)
983
- )), r = null;
1065
+ return async (I) => {
1066
+ const z = await Promise.resolve(V.in(I, D)), q = z.onStart;
1067
+ return z.onStart = () => {
1068
+ I.style.visibility = "visible", q == null || q();
1069
+ }, z;
1070
+ };
984
1071
  }
985
- }
986
- function A() {
987
- r && (r.inResolve && r.inResolve(() => ({})), r.outResolve && r.outResolve(() => ({})), r = null);
988
- }
989
- const v = l ? async (w, h) => a.isSwipePending() ? (a.resetSwipeDetection(), () => ({})) : h === "in" && (!r || !r.from) ? () => ({}) : (r || (r = {}), h === "out" ? (r.from = w, new Promise((E) => {
990
- r.outResolve = E, f();
991
- })) : (r.to = w, new Promise((E) => {
992
- r.inResolve = E, f();
993
- }))) : async (w, h) => a.isSwipePending() ? (a.resetSwipeDetection(), () => ({})) : (r && (h === "out" && r.from && r.from !== w || h === "in" && r.to && r.to !== w) && A(), r || (r = {}), h === "out" ? (r.from = w, new Promise((C) => {
994
- r.outResolve = C, f();
995
- })) : (r.to = w, new Promise((C) => {
996
- r.inResolve = C, f();
997
- })));
998
- return (w) => ({
999
- key: w,
1000
- in: async (h) => (u(h, w), (await v(w, "in"))(h)),
1001
- out: async (h) => (await v(w, "out"))(h),
1072
+ }, y = (g) => ({
1073
+ key: g,
1074
+ in: async (f) => (h(f, g), (await C(g, "in"))(f)),
1075
+ out: async (f) => (await C(g, "out"))(f),
1002
1076
  // Add page transition strategy for page-level transitions
1003
- [W]: ct
1004
- });
1077
+ [B]: mt
1078
+ }), P = (g, f) => {
1079
+ const { from: S, to: A } = r(g, f);
1080
+ return !!(G(
1081
+ S,
1082
+ A,
1083
+ u
1084
+ ) || i);
1085
+ };
1086
+ return a ? {
1087
+ getTransition: y,
1088
+ hasMatchingTransition: P
1089
+ } : y;
1005
1090
  }
1006
1091
  export {
1007
- j as SCOPE_ATTR,
1008
- G as SCOPE_READY_ATTR,
1009
- W as TRANSITION_STRATEGY,
1010
- at as createDefaultStrategy,
1011
- ct as createPageTransitionStrategy,
1012
- xt as createSggoiTransitionContext,
1013
- bt as createTransitionScope,
1014
- ut as findScope,
1015
- Vt as getWatchedCount,
1016
- Ot as isCssAnimation,
1017
- Lt as isMultiSpring,
1018
- lt as isScopeReady,
1019
- Dt as isSingleSpring,
1020
- zt as isTickAnimation,
1021
- kt as isWatched,
1022
- U as normalizeMultiSpringSchedule,
1023
- P as normalizeToMultiSpring,
1024
- It as resetObserver,
1025
- Pt as transition,
1026
- Rt as triggerUnmount,
1027
- Nt as validateAnimationMode,
1028
- qt as validateSpringItem,
1029
- mt as watchUnmount
1092
+ J as SCOPE_ATTR,
1093
+ Q as SCOPE_READY_ATTR,
1094
+ B as TRANSITION_STRATEGY,
1095
+ kt as createAnyOrderDetector,
1096
+ ft as createDefaultStrategy,
1097
+ bt as createOutFirstDetector,
1098
+ mt as createPageTransitionStrategy,
1099
+ Dt as createSggoiTransitionContext,
1100
+ It as createTransitionScope,
1101
+ ht as findScope,
1102
+ Mt as getWatchedCount,
1103
+ _t as isCssAnimation,
1104
+ Nt as isMultiAnimation,
1105
+ dt as isScopeReady,
1106
+ Ut as isSingleAnimation,
1107
+ Ht as isTickAnimation,
1108
+ Ft as isWatched,
1109
+ X as normalizeSchedule,
1110
+ F as normalizeToMultiAnimation,
1111
+ Ot as resetObserver,
1112
+ Lt as transition,
1113
+ xt as triggerUnmount,
1114
+ vt as watchUnmount
1030
1115
  };