@ssgoi/core 4.1.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.
package/dist/index.js CHANGED
@@ -1,65 +1,65 @@
1
- var J = Object.defineProperty;
2
- var Q = (n, i, t) => i in n ? J(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
3
- var d = (n, i, t) => Q(n, typeof i != "symbol" ? i + "" : i, t);
4
- import { normalizeToMultiAnimation as R, normalizeSchedule as N } from "./types.js";
5
- import { isCssAnimation as Lt, isMultiAnimation as Dt, isSingleAnimation as zt, isTickAnimation as qt } from "./types.js";
6
- import { S as Y, I as Z, a as tt } from "./provider-Cu4NSF1Q.js";
7
- class et {
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 c = e / 1e3;
34
- this.elapsed = o / 1e3, this.nextTime += s + (s >= this.gap ? 4 : this.gap - s), this.listeners.forEach((r) => {
35
- r(c, 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,53 +68,53 @@ class et {
68
68
  return this.elapsed;
69
69
  }
70
70
  }
71
- const D = new et();
72
- function it(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,
76
+ to: i,
77
+ velocity: r = 0,
78
+ onUpdate: o,
79
79
  onComplete: c,
80
- onStart: r
81
- } = n;
82
- let a = { position: t, velocity: o }, u = !0, m = 0, g = !1;
83
- const y = (S) => {
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()), a = i.step(a, e, S), i.isSettled(a, e)) {
86
- if (m += Math.min(S, 0.033), m >= Y) {
87
- a = { position: e, velocity: 0 }, u = !1, s(a.position), D.unsubscribe(y), c();
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(a.position);
91
+ h = 0;
92
+ o(s.position);
93
93
  }
94
94
  };
95
- return D.subscribe(y), {
95
+ return _.subscribe(w), {
96
96
  stop: () => {
97
- u && (u = !1, D.unsubscribe(y));
97
+ u && (u = !1, _.unsubscribe(w));
98
98
  },
99
- getPosition: () => a.position,
100
- getVelocity: () => a.velocity,
99
+ getPosition: () => s.position,
100
+ getVelocity: () => s.velocity,
101
101
  isRunning: () => u
102
102
  };
103
103
  }
104
- const F = 1e3 / 60;
105
- function nt(n, i, t, e = 0) {
106
- let s = { position: i, velocity: e }, c = 0;
107
- const r = [];
108
- for (let a = 0; a < 600; a++) {
109
- const u = a * F;
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, F / 1e3), n.isSettled(s, t)) {
115
- if (c += F / 1e3, c >= Y) {
116
- r.push({
117
- time: (a + 1) * F,
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
  });
@@ -123,83 +123,83 @@ function nt(n, i, t, e = 0) {
123
123
  } else
124
124
  c = 0;
125
125
  }
126
- return r;
126
+ return a;
127
127
  }
128
- function U(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 c = n[o], r = n[s], a = (i - c.time) / (r.time - c.time);
141
+ const c = e[r], a = e[o], s = (n - c.time) / (a.time - c.time);
142
142
  return {
143
- position: c.position + (r.position - c.position) * a,
144
- velocity: c.velocity + (r.velocity - c.velocity) * a
143
+ position: c.position + (a.position - c.position) * s,
144
+ velocity: c.velocity + (a.velocity - c.velocity) * s
145
145
  };
146
146
  }
147
- function rt(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 ot(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,
154
+ from: i,
155
+ to: r,
156
+ velocity: o = 0,
157
157
  style: c,
158
- onComplete: r,
159
- onStart: a
160
- } = n, u = nt(i, e, o, s);
158
+ onComplete: a,
159
+ onStart: s
160
+ } = e, u = st(n, i, r, o);
161
161
  if (u.length === 0)
162
- return a == null || a(), 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 = rt(u, c), g = u[u.length - 1], y = g.time, S = m[0];
170
- if (S)
171
- for (const A of Object.keys(S))
172
- t.style[A] = "";
173
- const f = t.animate(m, {
174
- 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,
175
175
  fill: "forwards",
176
176
  easing: "linear",
177
177
  composite: "replace"
178
178
  });
179
179
  let l = !0;
180
- const E = performance.now();
181
- return a == null || a(), f.onfinish = () => {
182
- l && (l = !1, r());
180
+ const C = performance.now();
181
+ return s == null || s(), d.onfinish = () => {
182
+ l && (l = !1, a());
183
183
  }, {
184
184
  stop: () => {
185
- l && (l = !1, f.cancel());
185
+ l && (l = !1, d.cancel());
186
186
  },
187
187
  getPosition: () => {
188
188
  if (!l)
189
- return g.position;
190
- const A = performance.now() - E;
191
- return U(u, A).position;
189
+ return p.position;
190
+ const y = performance.now() - C;
191
+ return Y(u, y).position;
192
192
  },
193
193
  getVelocity: () => {
194
194
  if (!l)
195
195
  return 0;
196
- const A = performance.now() - E;
197
- return U(u, A).velocity;
196
+ const y = performance.now() - C;
197
+ return Y(u, y).velocity;
198
198
  },
199
199
  isRunning: () => l
200
200
  };
201
201
  }
202
- class st {
202
+ class lt {
203
203
  /**
204
204
  * Get bound runner based on animation mode
205
205
  *
@@ -207,33 +207,33 @@ class st {
207
207
  * @returns Bound runner function or null if no animation mode specified
208
208
  * @throws Error if both tick and css are provided
209
209
  */
210
- static from(i) {
211
- const { tick: t, css: e } = i;
212
- if (t && e)
210
+ static from(n) {
211
+ const { tick: t, css: i } = n;
212
+ if (t && i)
213
213
  throw new Error("Cannot use both 'tick' and 'css' options together");
214
- return e ? (o) => ot({
215
- ...o,
216
- element: e.element,
217
- style: e.style
218
- }) : t ? (o) => it({
219
- ...o,
214
+ return i ? (r) => ct({
215
+ ...r,
216
+ element: i.element,
217
+ style: i.style
218
+ }) : t ? (r) => ot({
219
+ ...r,
220
220
  onUpdate: t
221
221
  }) : null;
222
222
  }
223
223
  }
224
- class j {
224
+ class K {
225
225
  }
226
- const at = { stiffness: 300, damping: 30 };
227
- class H extends j {
226
+ const ut = { stiffness: 300, damping: 30 };
227
+ class j extends K {
228
228
  constructor(t) {
229
229
  super();
230
- d(this, "options");
231
- d(this, "runner");
232
- d(this, "controls", null);
233
- d(this, "isAnimating", !1);
234
- d(this, "currentValue");
235
- d(this, "currentVelocity", 0);
236
- d(this, "updateFn");
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
237
  if (this.options = {
238
238
  from: t.from ?? 0,
239
239
  to: t.to ?? 1,
@@ -242,21 +242,21 @@ class H extends j {
242
242
  }),
243
243
  onStart: t.onStart
244
244
  }, this.currentValue = this.options.from, t.tick)
245
- this.updateFn = (e) => {
246
- var o;
247
- return (o = t.tick) == null ? void 0 : o.call(t, e);
245
+ this.updateFn = (i) => {
246
+ var r;
247
+ return (r = t.tick) == null ? void 0 : r.call(t, i);
248
248
  };
249
249
  else if (t.css) {
250
- const { element: e, style: o } = t.css;
251
- this.updateFn = (s) => {
252
- const c = o(s);
253
- for (const [r, a] of Object.entries(c))
254
- e.style[r] = typeof a == "number" ? String(a) : a;
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
255
  };
256
256
  } else
257
257
  this.updateFn = () => {
258
258
  };
259
- this.runner = st.from({
259
+ this.runner = lt.from({
260
260
  tick: t.tick,
261
261
  css: t.css
262
262
  });
@@ -275,15 +275,15 @@ class H extends j {
275
275
  */
276
276
  createIntegrator() {
277
277
  const t = this.options.physics;
278
- return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? Z.from({
278
+ return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? it.from({
279
279
  spring: t.spring,
280
280
  inertia: t.inertia
281
- }) : new tt(at);
281
+ }) : new nt(ut);
282
282
  }
283
283
  runAnimation(t) {
284
- var e, o;
284
+ var i, r;
285
285
  if (this.isAnimating = !0, !this.runner) {
286
- (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();
287
287
  return;
288
288
  }
289
289
  this.controls = this.runner({
@@ -339,20 +339,20 @@ class H extends j {
339
339
  this.options = { ...this.options, ...t };
340
340
  }
341
341
  }
342
- class M extends j {
342
+ class L extends K {
343
343
  constructor(t) {
344
344
  super();
345
- d(this, "config");
346
- d(this, "animators", /* @__PURE__ */ new Map());
347
- d(this, "itemOrder", []);
348
- d(this, "completedCount", 0);
349
- d(this, "completedAnimators", /* @__PURE__ */ new Set());
350
- d(this, "direction", "forward");
351
- d(this, "idCounter", 0);
352
- d(this, "rafId", null);
353
- d(this, "from");
354
- d(this, "to");
355
- d(this, "initialState");
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
356
  this.config = t.config, this.from = t.from, this.to = t.to, this.initialState = t.state ?? {
357
357
  position: t.from,
358
358
  velocity: 0
@@ -362,22 +362,22 @@ class M extends j {
362
362
  return `spring_${this.idCounter++}`;
363
363
  }
364
364
  initializeAnimators() {
365
- this.config.items.forEach((t, e) => {
366
- const o = this.generateId(), s = new H({
365
+ this.config.items.forEach((t, i) => {
366
+ const r = this.generateId(), o = new j({
367
367
  from: this.from,
368
368
  to: this.to,
369
369
  physics: t.physics,
370
370
  tick: t.tick,
371
371
  css: t.css,
372
- onComplete: () => this.onAnimatorComplete(o),
372
+ onComplete: () => this.onAnimatorComplete(r),
373
373
  onStart: t.onStart
374
374
  });
375
- (e === 0 || t.normalizedOffset === 0) && (s.setValue(this.initialState.position), s.setVelocity(this.initialState.velocity), s.syncState()), this.animators.set(o, {
376
- id: o,
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,
377
377
  item: t,
378
- animator: s,
378
+ animator: o,
379
379
  started: !1
380
- }), this.itemOrder.push(o);
380
+ }), this.itemOrder.push(r);
381
381
  });
382
382
  }
383
383
  /**
@@ -385,8 +385,8 @@ class M extends j {
385
385
  * Progress = |position - from| / |to - from|
386
386
  */
387
387
  getAnimatorProgress(t) {
388
- const e = t.animator.getCurrentState(), o = Math.abs(e.to - e.from);
389
- 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;
390
390
  }
391
391
  /**
392
392
  * Get order of springs based on direction
@@ -397,9 +397,9 @@ class M extends j {
397
397
  return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
398
398
  }
399
399
  onAnimatorComplete(t) {
400
- var o, s, c, r, a, u;
401
- const e = this.animators.get(t);
402
- !e || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (s = (o = e.item).onComplete) == null || s.call(o), (r = (c = this.config).onProgress) == null || r.call(c, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (u = (a = this.config).onEnd) == null || u.call(a)));
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)));
403
403
  }
404
404
  /**
405
405
  * Check and start springs based on previous spring's progress
@@ -407,22 +407,22 @@ class M extends j {
407
407
  */
408
408
  checkAndStartSprings() {
409
409
  const t = this.getOrderedIds();
410
- for (let e = 0; e < t.length; e++) {
411
- const o = t[e], s = this.animators.get(o);
412
- if (!s || s.started) continue;
413
- if (e === 0) {
414
- 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);
415
415
  continue;
416
416
  }
417
- const c = t[e - 1], r = this.animators.get(c);
418
- if (!r || !r.started) continue;
419
- const a = this.getAnimatorProgress(r), u = s.item.normalizedOffset;
420
- a >= 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);
421
421
  }
422
422
  }
423
423
  startAnimator(t) {
424
- const e = this.animators.get(t);
425
- !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());
426
426
  }
427
427
  /**
428
428
  * Start the scheduler loop that checks spring progress
@@ -437,17 +437,17 @@ class M extends j {
437
437
  this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
438
438
  }
439
439
  getFirstAnimator() {
440
- var e;
440
+ var i;
441
441
  const t = this.itemOrder[0];
442
- return t ? ((e = this.animators.get(t)) == null ? void 0 : e.animator) ?? null : null;
442
+ return t ? ((i = this.animators.get(t)) == null ? void 0 : i.animator) ?? null : null;
443
443
  }
444
444
  forward() {
445
- var t, e;
446
- 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();
447
447
  }
448
448
  backward() {
449
- var t, e;
450
- 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();
451
451
  }
452
452
  resetStartedFlags() {
453
453
  this.animators.forEach((t) => {
@@ -463,9 +463,9 @@ class M extends j {
463
463
  this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((t) => {
464
464
  if (!t.started)
465
465
  return;
466
- const e = t.animator.getCurrentState();
467
- if (e.position === e.to) {
468
- const s = new H({
466
+ const i = t.animator.getCurrentState();
467
+ if (i.position === i.to) {
468
+ const o = new j({
469
469
  from: this.to,
470
470
  to: this.from,
471
471
  physics: t.item.physics,
@@ -474,7 +474,7 @@ class M extends j {
474
474
  onComplete: () => this.onAnimatorComplete(t.id),
475
475
  onStart: t.item.onStart
476
476
  });
477
- s.setValue(this.to), s.setVelocity(0), s.syncState(), s.forward(), t.animator = s;
477
+ o.setValue(this.to), o.setVelocity(0), o.syncState(), o.forward(), t.animator = o;
478
478
  } else
479
479
  t.animator.reverse();
480
480
  });
@@ -507,16 +507,16 @@ class M extends j {
507
507
  * TODO: Support per-spring control
508
508
  */
509
509
  setValue(t) {
510
- const e = this.getFirstAnimator();
511
- e == null || e.setValue(t);
510
+ const i = this.getFirstAnimator();
511
+ i == null || i.setValue(t);
512
512
  }
513
513
  /**
514
514
  * Set velocity on first animator
515
515
  * TODO: Support per-spring control
516
516
  */
517
517
  setVelocity(t) {
518
- const e = this.getFirstAnimator();
519
- e == null || e.setVelocity(t);
518
+ const i = this.getFirstAnimator();
519
+ i == null || i.setVelocity(t);
520
520
  }
521
521
  /**
522
522
  * Check if any animation is currently running
@@ -531,27 +531,27 @@ class M extends j {
531
531
  * Create MultiAnimator from existing state
532
532
  * Uses first animator's state for initialization
533
533
  */
534
- static fromState(t, e) {
535
- return new M({ ...e, state: t });
534
+ static fromState(t, i) {
535
+ return new L({ ...i, state: t });
536
536
  }
537
537
  }
538
- const W = Symbol.for("TRANSITION_STRATEGY"), ct = (n) => ({
539
- runIn: async (i) => {
540
- const { currentAnimation: t } = n;
538
+ const B = Symbol.for("TRANSITION_STRATEGY"), ft = (e) => ({
539
+ runIn: async (n) => {
540
+ const { currentAnimation: t } = e;
541
541
  if (t && t.direction === "out") {
542
- const o = t.controller.getCurrentValue(), s = t.controller.getVelocity();
543
- if (t.controller.stop(), i.out)
542
+ const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
543
+ if (t.controller.stop(), n.out)
544
544
  return {
545
- config: await i.out,
546
- state: { position: o, velocity: s },
545
+ config: await n.out,
546
+ state: { position: r, velocity: o },
547
547
  from: 1,
548
548
  to: 0,
549
549
  direction: "backward"
550
550
  // Will actually go 0→1 (backward means toward 'from')
551
551
  };
552
552
  }
553
- return i.in ? {
554
- config: await i.in,
553
+ return n.in ? {
554
+ config: await n.in,
555
555
  state: {
556
556
  position: 0,
557
557
  velocity: 0
@@ -569,22 +569,22 @@ const W = Symbol.for("TRANSITION_STRATEGY"), ct = (n) => ({
569
569
  direction: "forward"
570
570
  };
571
571
  },
572
- runOut: async (i) => {
573
- const { currentAnimation: t } = n;
572
+ runOut: async (n) => {
573
+ const { currentAnimation: t } = e;
574
574
  if (t && t.direction === "in") {
575
- const o = t.controller.getCurrentValue(), s = t.controller.getVelocity();
576
- if (t.controller.stop(), i.in)
575
+ const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
576
+ if (t.controller.stop(), n.in)
577
577
  return {
578
- config: await i.in,
579
- state: { position: o, velocity: s },
578
+ config: await n.in,
579
+ state: { position: r, velocity: o },
580
580
  from: 0,
581
581
  to: 1,
582
582
  direction: "backward"
583
583
  // Will actually go 1→0 (backward means toward 'from')
584
584
  };
585
585
  }
586
- return i.out ? {
587
- config: await i.out,
586
+ return n.out ? {
587
+ config: await n.out,
588
588
  state: {
589
589
  position: 1,
590
590
  velocity: 0
@@ -602,9 +602,9 @@ const W = Symbol.for("TRANSITION_STRATEGY"), ct = (n) => ({
602
602
  direction: "forward"
603
603
  };
604
604
  }
605
- }), lt = () => ({
606
- runIn: async (n) => n.in ? {
607
- config: await n.in,
605
+ }), mt = () => ({
606
+ runIn: async (e) => e.in ? {
607
+ config: await e.in,
608
608
  state: {
609
609
  position: 0,
610
610
  velocity: 0
@@ -621,8 +621,8 @@ const W = Symbol.for("TRANSITION_STRATEGY"), ct = (n) => ({
621
621
  to: 1,
622
622
  direction: "forward"
623
623
  },
624
- runOut: async (n) => n.out ? {
625
- config: await n.out,
624
+ runOut: async (e) => e.out ? {
625
+ config: await e.out,
626
626
  state: {
627
627
  position: 1,
628
628
  velocity: 0
@@ -639,178 +639,178 @@ const W = Symbol.for("TRANSITION_STRATEGY"), ct = (n) => ({
639
639
  to: 0,
640
640
  direction: "forward"
641
641
  }
642
- }), G = "data-ssgoi-scope", $ = "data-ssgoi-scope-ready";
643
- function kt() {
644
- return (n) => {
645
- if (n)
646
- return n.setAttribute(G, ""), 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(() => {
647
647
  queueMicrotask(() => {
648
- n.setAttribute($, "true");
648
+ e.setAttribute(Q, "true");
649
649
  });
650
650
  }), () => {
651
651
  };
652
652
  };
653
653
  }
654
- function ut(n) {
655
- return n.hasAttribute($);
654
+ function dt(e) {
655
+ return e.hasAttribute(Q);
656
656
  }
657
- function ft(n) {
658
- return n.closest(`[${G}]`);
657
+ function ht(e) {
658
+ return e.closest(`[${J}]`);
659
659
  }
660
- const dt = (n) => {
661
- let i = n.parentElement;
662
- for (; i && i !== document.body; ) {
663
- const t = window.getComputedStyle(i), e = t.overflow + t.overflowY + t.overflowX;
664
- if (e.includes("auto") || e.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
665
- return i;
666
- i = i.parentElement;
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
667
  }
668
668
  return document.documentElement;
669
- }, mt = (n) => {
670
- let i = n.parentElement;
671
- for (; i && i !== document.body; ) {
672
- const t = window.getComputedStyle(i).position;
669
+ }, pt = (e) => {
670
+ let n = e.parentElement;
671
+ for (; n && n !== document.body; ) {
672
+ const t = window.getComputedStyle(n).position;
673
673
  if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
674
- return i;
675
- i = i.parentElement;
674
+ return n;
675
+ n = n.parentElement;
676
676
  }
677
677
  return document.body;
678
678
  };
679
- function X(n) {
680
- return new Promise((i) => {
679
+ function W(e) {
680
+ return new Promise((n) => {
681
681
  requestAnimationFrame(() => {
682
682
  requestAnimationFrame(() => {
683
- i();
683
+ n();
684
684
  });
685
685
  });
686
686
  });
687
687
  }
688
- function ht(n, i) {
689
- var S;
690
- let t = null, e = null, o = null, s = null;
688
+ function wt(e, n) {
689
+ var v;
690
+ let t = null, i = null, r = null, o = null;
691
691
  const c = {
692
692
  get currentAnimation() {
693
693
  return t;
694
694
  }
695
- }, r = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, c)) || ct(c), a = async (f) => {
696
- var T;
697
- e && (e.remove(), e = null);
698
- const l = n(), E = l.in && l.in(f), A = !(i != null && i.strategy) && l.out ? l.out(f) : void 0;
699
- if (!E)
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)
700
700
  return;
701
- const I = {
702
- in: R(E),
703
- out: A ? R(A) : void 0
704
- }, v = await r.runIn(I);
705
- 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) {
706
706
  t && (t.direction = "in");
707
707
  return;
708
708
  }
709
- const p = v.config;
710
- (T = p.prepare) == null || T.call(p);
711
- const w = N(
709
+ const f = g.config;
710
+ (b = f.prepare) == null || b.call(f);
711
+ const S = X(
712
712
  {
713
- ...p,
713
+ ...f,
714
714
  onEnd: () => {
715
- var C;
716
- t = null, (C = p.onEnd) == null || C.call(p);
715
+ var k;
716
+ t = null, (k = f.onEnd) == null || k.call(f);
717
717
  }
718
718
  },
719
- f
719
+ d
720
720
  );
721
- p.wait && await p.wait();
722
- const h = M.fromState(v.state, {
723
- config: w,
724
- from: v.from,
725
- to: v.to
721
+ f.wait && await f.wait();
722
+ const A = L.fromState(g.state, {
723
+ config: S,
724
+ from: g.from,
725
+ to: g.to
726
726
  });
727
- t = { controller: h, direction: "in" }, await X(), v.direction === "forward" ? h.forward() : h.backward();
728
- }, u = async (f) => {
729
- var C;
730
- e = f;
731
- const l = n(), E = !(i != null && i.strategy) && l.in ? l.in(f) : void 0, A = l.out && l.out(f);
732
- if (!A)
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)
733
733
  return;
734
- const I = {
735
- in: E ? R(E) : void 0,
736
- out: R(A)
737
- }, v = await r.runOut(I);
738
- if (!v.config) {
739
- 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);
740
740
  return;
741
741
  }
742
- const p = v.config;
743
- T(), (C = p.prepare) == null || C.call(p);
744
- const w = N(
742
+ const f = g.config;
743
+ b(), (k = f.prepare) == null || k.call(f);
744
+ const S = X(
745
745
  {
746
- ...p,
746
+ ...f,
747
747
  onEnd: () => {
748
- var V, P;
749
- (V = p.onEnd) == null || V.call(p), e && (e.remove(), e = null), t = null, (P = i == null ? void 0 : i.onCleanupEnd) == null || P.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);
750
750
  }
751
751
  },
752
- f
752
+ d
753
753
  );
754
- p.wait && await p.wait();
755
- const h = M.fromState(v.state, {
756
- config: w,
757
- from: v.from,
758
- to: v.to
754
+ f.wait && await f.wait();
755
+ const A = L.fromState(g.state, {
756
+ config: S,
757
+ from: g.from,
758
+ to: g.to
759
759
  });
760
- t = { controller: h, direction: "out" }, await X(), v.direction === "forward" ? h.forward() : h.backward();
761
- function T() {
762
- !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));
763
763
  }
764
764
  };
765
- let m = null, g = !1;
766
- const y = (f) => () => {
767
- if (g) return;
768
- g = !0;
769
- const l = f.cloneNode(!0);
770
- m ? queueMicrotask(() => {
771
- document.contains(m) && u(l);
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
772
  }) : u(l);
773
773
  };
774
- return (f) => {
775
- if (f)
774
+ return (d) => {
775
+ if (d)
776
776
  return requestAnimationFrame(() => {
777
- o = f.parentElement, s = f.nextElementSibling;
778
- }), g = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
779
- m = ft(f), !(m && !ut(m)) && a(f);
780
- }) : a(f), y(f);
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);
781
781
  };
782
782
  }
783
- const k = /* @__PURE__ */ new Map();
784
- let b = null, z = !1;
785
- function K(n) {
786
- if (n instanceof HTMLElement && k.has(n)) {
787
- const t = k.get(n);
788
- k.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(() => {
789
789
  t();
790
790
  });
791
791
  }
792
- const i = n.childNodes;
793
- for (let t = 0; t < i.length; t++) {
794
- const e = i[t];
795
- e && K(e);
792
+ const n = e.childNodes;
793
+ for (let t = 0; t < n.length; t++) {
794
+ const i = n[t];
795
+ i && Z(i);
796
796
  }
797
797
  }
798
- function gt() {
799
- z || typeof document > "u" || (z = !0, b = new MutationObserver((n) => {
800
- for (const i of n) {
801
- const t = i.removedNodes;
802
- for (let e = 0; e < t.length; e++) {
803
- const o = t[e];
804
- o && K(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);
805
805
  }
806
806
  }
807
- }), document.body ? b.observe(document.body, {
807
+ }), document.body ? E.observe(document.body, {
808
808
  childList: !0,
809
809
  subtree: !0
810
810
  }) : document.addEventListener(
811
811
  "DOMContentLoaded",
812
812
  () => {
813
- b == null || b.observe(document.body, {
813
+ E == null || E.observe(document.body, {
814
814
  childList: !0,
815
815
  subtree: !0
816
816
  });
@@ -818,249 +818,298 @@ function gt() {
818
818
  { once: !0 }
819
819
  ));
820
820
  }
821
- function pt(n, i) {
822
- gt(), k.set(n, i);
821
+ function vt(e, n) {
822
+ yt(), T.set(e, n);
823
823
  }
824
- function Vt(n) {
825
- return k.has(n);
824
+ function Ft(e) {
825
+ return T.has(e);
826
826
  }
827
- function It() {
828
- return k.size;
827
+ function Mt() {
828
+ return T.size;
829
829
  }
830
- function Pt(n) {
831
- const i = k.get(n);
832
- return i ? (k.delete(n), i(), !0) : !1;
830
+ function xt(e) {
831
+ const n = T.get(e);
832
+ return n ? (T.delete(e), n(), !0) : !1;
833
833
  }
834
- function Rt() {
835
- k.clear(), b == null || b.disconnect(), b = null, z = !1;
834
+ function Ot() {
835
+ T.clear(), E == null || E.disconnect(), E = null, N = !1;
836
836
  }
837
- const O = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
838
- function wt(n, i, t) {
839
- O.set(n, i);
840
- let e = q.get(n);
841
- if (e)
842
- return e;
843
- const o = i;
844
- return e = ht(
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(
845
845
  () => {
846
- const s = O.get(n);
847
- 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`), {});
848
848
  },
849
849
  {
850
850
  strategy: t == null ? void 0 : t.strategy,
851
851
  scope: t == null ? void 0 : t.scope,
852
852
  onCleanupEnd: () => {
853
- O.get(n) === o && yt(n);
853
+ O.get(e) === r && Ct(e);
854
854
  }
855
855
  }
856
- ), q.set(n, e), e;
856
+ ), U.set(e, i), i;
857
857
  }
858
- function yt(n) {
859
- O.delete(n), q.delete(n), _.delete(n);
858
+ function Ct(e) {
859
+ O.delete(e), U.delete(e), H.delete(e);
860
860
  }
861
- function Ft(n, i = "manual") {
862
- const t = wt(
863
- n.key,
861
+ function Lt(e, n = "manual") {
862
+ const t = St(
863
+ e.key,
864
864
  {
865
- in: n.in,
866
- out: n.out
865
+ in: e.in,
866
+ out: e.out
867
867
  },
868
868
  {
869
- strategy: n[W],
870
- scope: n.scope
869
+ strategy: e[B],
870
+ scope: e.scope
871
871
  }
872
872
  );
873
- if (i === "manual")
873
+ if (n === "manual")
874
874
  return t;
875
- let e = _.get(n.key);
876
- return e || (e = (o) => {
877
- if (o) {
878
- const s = t(o);
879
- s && pt(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);
880
880
  }
881
- }, _.set(n.key, e), e);
881
+ }, H.set(e.key, i), i);
882
882
  }
883
- function vt(n) {
884
- const i = n.filter((t) => t.symmetric).map((t) => ({
883
+ function At(e) {
884
+ const n = e.filter((t) => t.symmetric).map((t) => ({
885
885
  from: t.to,
886
886
  to: t.from,
887
887
  transition: t.transition
888
888
  }));
889
- return [...n, ...i];
889
+ return [...e, ...n];
890
890
  }
891
- function St(n) {
892
- let i = !1, t = 0, e = 0, o = !1;
893
- const s = 50, c = (f) => {
894
- if (!n) return;
895
- const l = f.touches[0];
896
- l && (o = l.clientX < s, o && (t = l.clientX, e = l.clientY));
897
- }, r = (f) => {
898
- if (!n || !o) return;
899
- const l = f.touches[0];
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
900
  if (!l) return;
901
- const E = l.clientX - t, A = l.clientY - e;
902
- E > window.outerWidth / 2 - 5 && Math.abs(E) > Math.abs(A) ? i = !0 : i = !1;
903
- }, a = () => {
904
- n && (o = !1, t = 0, e = 0);
905
- }, u = () => i, m = () => {
906
- typeof window > "u" || n && (window.addEventListener("touchstart", c, { passive: !0 }), window.addEventListener("touchmove", r, { passive: !0 }), window.addEventListener("touchend", a, { passive: !0 }));
907
- }, g = () => {
908
- typeof window > "u" || (window.removeEventListener("touchstart", c), window.removeEventListener("touchmove", r), window.removeEventListener("touchend", a));
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));
909
909
  };
910
- let y = 0;
910
+ let w = 0;
911
911
  return {
912
- initialize: m,
913
- cleanup: g,
912
+ initialize: h,
913
+ cleanup: p,
914
914
  isSwipePending: u,
915
915
  resetSwipeDetection: () => {
916
- y++, y > 1 && (y = 0, i = !1);
916
+ w++, w > 1 && (w = 0, n = !1);
917
917
  }
918
918
  };
919
919
  }
920
- function Ct() {
921
- let n = null, i = null;
920
+ function Tt() {
921
+ let e = null, n = null;
922
922
  const t = /* @__PURE__ */ new Map();
923
- let e = null;
924
- const o = () => {
925
- n && e && t.set(e, {
926
- x: n.scrollLeft,
927
- y: n.scrollTop
923
+ let i = null;
924
+ const r = () => {
925
+ e && i && t.set(i, {
926
+ x: e.scrollLeft,
927
+ y: e.scrollTop
928
928
  });
929
929
  };
930
930
  return {
931
- initializeContext: (m, g) => {
932
- i = m, n || (n = dt(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, {
933
933
  passive: !0
934
- })), e = g;
934
+ })), i = p;
935
935
  },
936
- calculateScrollOffset: (m, g) => {
937
- 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 };
938
938
  return {
939
- x: -S.x + y.x,
940
- y: -S.y + y.y
939
+ x: -v.x + w.x,
940
+ y: -v.y + w.y
941
941
  };
942
942
  },
943
- getScrollContainer: () => n,
944
- getPositionedParentElement: () => i ? mt(i) : document.body,
945
- 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 }
946
946
  };
947
947
  }
948
- function x(n, i) {
949
- if (i === "*")
948
+ function x(e, n) {
949
+ if (n === "*")
950
950
  return !0;
951
- if (i.endsWith("/*")) {
952
- const t = i.slice(0, -2);
953
- return n === t || n.startsWith(t + "/");
951
+ if (n.endsWith("/*")) {
952
+ const t = n.slice(0, -2);
953
+ return e === t || e.startsWith(t + "/");
954
954
  }
955
- return n === i;
955
+ return e === n;
956
956
  }
957
- function At(n, i, t) {
958
- for (const e of t)
959
- if (x(n, e.from) && x(i, e.to))
960
- return e.transition;
961
- for (const e of t)
962
- if ((e.from === "*" || x(n, e.from)) && (e.to === "*" || x(i, e.to)))
963
- 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;
964
964
  return null;
965
965
  }
966
- 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) {
967
1009
  const {
968
1010
  transitions: t = [],
969
- defaultTransition: e,
970
- middleware: o = (w, h) => ({ from: w, to: h }),
1011
+ defaultTransition: i,
1012
+ middleware: r = (g, f) => ({ from: g, to: f }),
971
1013
  // Identity function as default
972
- skipOnIosSwipe: s = !0
1014
+ skipOnIosSwipe: o = !0
973
1015
  // Default to true - skip animations on iOS swipe
974
- } = n, { outFirst: c = !0 } = i || {};
975
- let r = null;
976
- const a = vt(t), {
977
- initializeContext: u,
978
- calculateScrollOffset: m,
979
- getScrollContainer: g,
980
- getPositionedParentElement: y,
981
- getScrollPosition: S
982
- } = Ct(), f = St(s);
983
- f.initialize();
984
- function l() {
985
- if (r != null && r.from && (r != null && r.to)) {
986
- const { from: w, to: h } = o(
987
- r.from,
988
- r.to
989
- ), C = At(
990
- w,
991
- h,
992
- a
993
- ) || e, V = m(
994
- r.from,
995
- r.to
996
- ), P = {
997
- scrollOffset: V,
998
- 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),
999
1044
  get scrollingElement() {
1000
- return g() || document.documentElement;
1045
+ return w() || document.documentElement;
1001
1046
  },
1002
1047
  get positionedParent() {
1003
- return y();
1048
+ return v();
1004
1049
  }
1005
- }, B = {
1006
- scrollOffset: V,
1050
+ };
1051
+ return (I) => V.out(I, D);
1052
+ } else {
1053
+ const D = {
1054
+ scrollOffset: R,
1007
1055
  get scroll() {
1008
- return r ? S(r.to) : { x: 0, y: 0 };
1056
+ return d(S.to);
1009
1057
  },
1010
1058
  get scrollingElement() {
1011
- return g() || document.documentElement;
1059
+ return w() || document.documentElement;
1012
1060
  },
1013
1061
  get positionedParent() {
1014
- return y();
1062
+ return v();
1015
1063
  }
1016
1064
  };
1017
- C && (C.out && r.outResolve && r.outResolve(
1018
- (L) => C.out(L, P)
1019
- ), C.in && r.inResolve && r.inResolve(
1020
- (L) => C.in(L, B)
1021
- )), 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
+ };
1022
1071
  }
1023
- }
1024
- function E() {
1025
- r && (r.inResolve && r.inResolve(() => ({})), r.outResolve && r.outResolve(() => ({})), r = null);
1026
- }
1027
- const v = c ? async (w, h) => f.isSwipePending() ? (f.resetSwipeDetection(), () => ({})) : h === "in" && (!r || !r.from) ? () => ({}) : (r || (r = {}), h === "out" ? (r.from = w, new Promise((T) => {
1028
- r.outResolve = T, l();
1029
- })) : (r.to = w, new Promise((T) => {
1030
- r.inResolve = T, l();
1031
- }))) : async (w, h) => f.isSwipePending() ? (f.resetSwipeDetection(), () => ({})) : (r && (h === "out" && r.from && r.from !== w || h === "in" && r.to && r.to !== w) && E(), r || (r = {}), h === "out" ? (r.from = w, new Promise((C) => {
1032
- r.outResolve = C, l();
1033
- })) : (r.to = w, new Promise((C) => {
1034
- r.inResolve = C, l();
1035
- })));
1036
- return (w) => ({
1037
- key: w,
1038
- in: async (h) => (u(h, w), (await v(w, "in"))(h)),
1039
- 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),
1040
1076
  // Add page transition strategy for page-level transitions
1041
- [W]: lt
1042
- });
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;
1043
1090
  }
1044
1091
  export {
1045
- G as SCOPE_ATTR,
1046
- $ as SCOPE_READY_ATTR,
1047
- W as TRANSITION_STRATEGY,
1048
- ct as createDefaultStrategy,
1049
- lt as createPageTransitionStrategy,
1050
- xt as createSggoiTransitionContext,
1051
- kt as createTransitionScope,
1052
- ft as findScope,
1053
- It as getWatchedCount,
1054
- Lt as isCssAnimation,
1055
- Dt as isMultiAnimation,
1056
- ut as isScopeReady,
1057
- zt as isSingleAnimation,
1058
- qt as isTickAnimation,
1059
- Vt as isWatched,
1060
- N as normalizeSchedule,
1061
- R as normalizeToMultiAnimation,
1062
- Rt as resetObserver,
1063
- Ft as transition,
1064
- Pt as triggerUnmount,
1065
- pt 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
1066
1115
  };