@ssgoi/core 5.2.1 → 6.0.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 (240) hide show
  1. package/dist/animation/animation.d.ts +50 -0
  2. package/dist/animation/animation.d.ts.map +1 -0
  3. package/dist/animation/host-animation.d.ts +43 -0
  4. package/dist/animation/host-animation.d.ts.map +1 -0
  5. package/dist/animation/index.d.ts +6 -0
  6. package/dist/animation/index.d.ts.map +1 -0
  7. package/dist/animation/integrator/double-spring-integrator.d.ts.map +1 -0
  8. package/dist/{animator → animation}/integrator/index.d.ts +1 -0
  9. package/dist/animation/integrator/index.d.ts.map +1 -0
  10. package/dist/animation/integrator/inertia-integrator.d.ts.map +1 -0
  11. package/dist/animation/integrator/linear-integrator.d.ts +23 -0
  12. package/dist/animation/integrator/linear-integrator.d.ts.map +1 -0
  13. package/dist/{animator → animation}/integrator/provider.d.ts +1 -1
  14. package/dist/animation/integrator/provider.d.ts.map +1 -0
  15. package/dist/animation/integrator/spring-integrator.d.ts.map +1 -0
  16. package/dist/animation/integrator/types.d.ts.map +1 -0
  17. package/dist/animation/multi-animation.d.ts +39 -0
  18. package/dist/animation/multi-animation.d.ts.map +1 -0
  19. package/dist/animation/web-animation.d.ts +63 -0
  20. package/dist/animation/web-animation.d.ts.map +1 -0
  21. package/dist/index.cjs +35 -1
  22. package/dist/index.d.ts +4 -7
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1271 -1192
  25. package/dist/internal.cjs +1 -0
  26. package/dist/internal.d.ts +4 -0
  27. package/dist/internal.d.ts.map +1 -0
  28. package/dist/internal.js +504 -0
  29. package/dist/multi-animation-B_Hl1HEU.cjs +1 -0
  30. package/dist/multi-animation-CST6aZ8y.js +276 -0
  31. package/dist/ssgoi-transition/create-context-manager.d.ts +1 -1
  32. package/dist/ssgoi-transition/create-context-manager.d.ts.map +1 -1
  33. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +18 -31
  34. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  35. package/dist/ssgoi-transition/find-matching-transition.d.ts +4 -4
  36. package/dist/ssgoi-transition/find-matching-transition.d.ts.map +1 -1
  37. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +5 -15
  38. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -1
  39. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +2 -2
  40. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +1 -1
  41. package/dist/ssgoi-transition/unmount-observer.d.ts +17 -0
  42. package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -0
  43. package/dist/transitions/blind/index.d.ts +6 -0
  44. package/dist/transitions/blind/index.d.ts.map +1 -0
  45. package/dist/transitions/blind/transition.d.ts +16 -0
  46. package/dist/transitions/blind/transition.d.ts.map +1 -0
  47. package/dist/transitions/drill/index.d.ts +9 -0
  48. package/dist/transitions/drill/index.d.ts.map +1 -0
  49. package/dist/transitions/drill/provider/crossfade.d.ts +3 -0
  50. package/dist/transitions/drill/provider/crossfade.d.ts.map +1 -0
  51. package/dist/transitions/drill/provider/index.d.ts +3 -0
  52. package/dist/transitions/drill/provider/index.d.ts.map +1 -0
  53. package/dist/transitions/drill/provider/parallax.d.ts +3 -0
  54. package/dist/transitions/drill/provider/parallax.d.ts.map +1 -0
  55. package/dist/transitions/drill/transition.d.ts +5 -0
  56. package/dist/transitions/drill/transition.d.ts.map +1 -0
  57. package/dist/transitions/drill/types.d.ts +23 -0
  58. package/dist/transitions/drill/types.d.ts.map +1 -0
  59. package/dist/transitions/fade/index.d.ts +6 -0
  60. package/dist/transitions/fade/index.d.ts.map +1 -0
  61. package/dist/transitions/fade/transition.d.ts +6 -0
  62. package/dist/transitions/fade/transition.d.ts.map +1 -0
  63. package/dist/transitions/film/index.d.ts +6 -0
  64. package/dist/transitions/film/index.d.ts.map +1 -0
  65. package/dist/transitions/film/transition.d.ts +27 -0
  66. package/dist/transitions/film/transition.d.ts.map +1 -0
  67. package/dist/transitions/hero/index.d.ts +6 -0
  68. package/dist/transitions/hero/index.d.ts.map +1 -0
  69. package/dist/transitions/hero/transition.d.ts +7 -0
  70. package/dist/transitions/hero/transition.d.ts.map +1 -0
  71. package/dist/transitions/index.d.ts +10 -12
  72. package/dist/transitions/index.d.ts.map +1 -1
  73. package/dist/transitions/jaemin/index.d.ts +6 -0
  74. package/dist/transitions/jaemin/index.d.ts.map +1 -0
  75. package/dist/transitions/jaemin/transition.d.ts +18 -0
  76. package/dist/transitions/jaemin/transition.d.ts.map +1 -0
  77. package/dist/transitions/rotate/index.d.ts +6 -0
  78. package/dist/transitions/rotate/index.d.ts.map +1 -0
  79. package/dist/transitions/rotate/transition.d.ts +6 -0
  80. package/dist/transitions/rotate/transition.d.ts.map +1 -0
  81. package/dist/transitions/scroll/index.d.ts +15 -0
  82. package/dist/transitions/scroll/index.d.ts.map +1 -0
  83. package/dist/transitions/scroll/transition.d.ts +7 -0
  84. package/dist/transitions/scroll/transition.d.ts.map +1 -0
  85. package/dist/transitions/sheet/index.d.ts +9 -0
  86. package/dist/transitions/sheet/index.d.ts.map +1 -0
  87. package/dist/transitions/sheet/provider/background-scale.d.ts +3 -0
  88. package/dist/transitions/sheet/provider/background-scale.d.ts.map +1 -0
  89. package/dist/transitions/sheet/provider/index.d.ts +3 -0
  90. package/dist/transitions/sheet/provider/index.d.ts.map +1 -0
  91. package/dist/transitions/sheet/provider/static.d.ts +3 -0
  92. package/dist/transitions/sheet/provider/static.d.ts.map +1 -0
  93. package/dist/transitions/sheet/transition.d.ts +5 -0
  94. package/dist/transitions/sheet/transition.d.ts.map +1 -0
  95. package/dist/transitions/sheet/types.d.ts +19 -0
  96. package/dist/transitions/sheet/types.d.ts.map +1 -0
  97. package/dist/transitions/slide/index.d.ts +6 -0
  98. package/dist/transitions/slide/index.d.ts.map +1 -0
  99. package/dist/transitions/slide/transition.d.ts +7 -0
  100. package/dist/transitions/slide/transition.d.ts.map +1 -0
  101. package/dist/transitions/strip/index.d.ts +6 -0
  102. package/dist/transitions/strip/index.d.ts.map +1 -0
  103. package/dist/transitions/strip/transition.d.ts +6 -0
  104. package/dist/transitions/strip/transition.d.ts.map +1 -0
  105. package/dist/transitions/utils.d.ts +11 -7
  106. package/dist/transitions/utils.d.ts.map +1 -1
  107. package/dist/transitions/zoom/index.d.ts +8 -0
  108. package/dist/transitions/zoom/index.d.ts.map +1 -0
  109. package/dist/transitions/zoom/provider/expand.d.ts +5 -0
  110. package/dist/transitions/zoom/provider/expand.d.ts.map +1 -0
  111. package/dist/transitions/zoom/provider/index.d.ts +3 -0
  112. package/dist/transitions/zoom/provider/index.d.ts.map +1 -0
  113. package/dist/transitions/zoom/provider/static.d.ts +5 -0
  114. package/dist/transitions/zoom/provider/static.d.ts.map +1 -0
  115. package/dist/transitions/zoom/transition.d.ts +5 -0
  116. package/dist/transitions/zoom/transition.d.ts.map +1 -0
  117. package/dist/transitions/zoom/types.d.ts +34 -0
  118. package/dist/transitions/zoom/types.d.ts.map +1 -0
  119. package/dist/transitions/zoom/zoom-element.d.ts +4 -0
  120. package/dist/transitions/zoom/zoom-element.d.ts.map +1 -0
  121. package/dist/types/index.d.ts +175 -0
  122. package/dist/types/index.d.ts.map +1 -0
  123. package/dist/types.cjs +1 -1
  124. package/dist/types.d.ts +2 -504
  125. package/dist/types.js +3 -77
  126. package/dist/utils/get-scrolling-element.d.ts.map +1 -1
  127. package/dist/utils/get-viewport-rect.d.ts +17 -0
  128. package/dist/utils/get-viewport-rect.d.ts.map +1 -0
  129. package/dist/utils/index.d.ts +2 -0
  130. package/dist/utils/index.d.ts.map +1 -1
  131. package/dist/utils/prepare-outgoing.d.ts +2 -2
  132. package/dist/utils/prepare-outgoing.d.ts.map +1 -1
  133. package/dist/utils/promise-all.d.ts +18 -0
  134. package/dist/utils/promise-all.d.ts.map +1 -0
  135. package/package.json +7 -19
  136. package/dist/animator/integrator/double-spring-integrator.d.ts.map +0 -1
  137. package/dist/animator/integrator/index.d.ts.map +0 -1
  138. package/dist/animator/integrator/inertia-integrator.d.ts.map +0 -1
  139. package/dist/animator/integrator/provider.d.ts.map +0 -1
  140. package/dist/animator/integrator/spring-integrator.d.ts.map +0 -1
  141. package/dist/animator/integrator/types.d.ts.map +0 -1
  142. package/dist/animator/multi-animator.d.ts +0 -101
  143. package/dist/animator/multi-animator.d.ts.map +0 -1
  144. package/dist/animator/runner/css-runner.d.ts +0 -17
  145. package/dist/animator/runner/css-runner.d.ts.map +0 -1
  146. package/dist/animator/runner/keyframes-runner.d.ts +0 -14
  147. package/dist/animator/runner/keyframes-runner.d.ts.map +0 -1
  148. package/dist/animator/runner/provider.d.ts +0 -44
  149. package/dist/animator/runner/provider.d.ts.map +0 -1
  150. package/dist/animator/runner/tick-runner.d.ts +0 -16
  151. package/dist/animator/runner/tick-runner.d.ts.map +0 -1
  152. package/dist/animator/runner/ticker.d.ts +0 -38
  153. package/dist/animator/runner/ticker.d.ts.map +0 -1
  154. package/dist/animator/runner/types.d.ts +0 -34
  155. package/dist/animator/runner/types.d.ts.map +0 -1
  156. package/dist/animator/single-animator.d.ts +0 -65
  157. package/dist/animator/single-animator.d.ts.map +0 -1
  158. package/dist/animator/types.d.ts +0 -57
  159. package/dist/animator/types.d.ts.map +0 -1
  160. package/dist/presets/index.cjs +0 -1
  161. package/dist/presets/index.d.ts +0 -22
  162. package/dist/presets/index.d.ts.map +0 -1
  163. package/dist/presets/index.js +0 -50
  164. package/dist/provider-B2B8CK6H.js +0 -142
  165. package/dist/provider-BKaONTeg.cjs +0 -1
  166. package/dist/spring-integrator-95Mh7mdw.cjs +0 -1
  167. package/dist/spring-integrator-BM4a-82c.js +0 -33
  168. package/dist/transition/create-transition-callback.d.ts +0 -8
  169. package/dist/transition/create-transition-callback.d.ts.map +0 -1
  170. package/dist/transition/transition-scope.d.ts +0 -36
  171. package/dist/transition/transition-scope.d.ts.map +0 -1
  172. package/dist/transition/transition-strategy.d.ts +0 -75
  173. package/dist/transition/transition-strategy.d.ts.map +0 -1
  174. package/dist/transition/transition.d.ts +0 -51
  175. package/dist/transition/transition.d.ts.map +0 -1
  176. package/dist/transition/unmount-observer.d.ts +0 -43
  177. package/dist/transition/unmount-observer.d.ts.map +0 -1
  178. package/dist/transitions/blur.d.ts +0 -12
  179. package/dist/transitions/blur.d.ts.map +0 -1
  180. package/dist/transitions/bounce.d.ts +0 -13
  181. package/dist/transitions/bounce.d.ts.map +0 -1
  182. package/dist/transitions/fade.d.ts +0 -10
  183. package/dist/transitions/fade.d.ts.map +0 -1
  184. package/dist/transitions/fly.d.ts +0 -11
  185. package/dist/transitions/fly.d.ts.map +0 -1
  186. package/dist/transitions/index.cjs +0 -1
  187. package/dist/transitions/index.js +0 -285
  188. package/dist/transitions/mask.d.ts +0 -12
  189. package/dist/transitions/mask.d.ts.map +0 -1
  190. package/dist/transitions/none.d.ts +0 -8
  191. package/dist/transitions/none.d.ts.map +0 -1
  192. package/dist/transitions/rotate.d.ts +0 -15
  193. package/dist/transitions/rotate.d.ts.map +0 -1
  194. package/dist/transitions/scale.d.ts +0 -11
  195. package/dist/transitions/scale.d.ts.map +0 -1
  196. package/dist/transitions/slide.d.ts +0 -13
  197. package/dist/transitions/slide.d.ts.map +0 -1
  198. package/dist/types.d.ts.map +0 -1
  199. package/dist/view-transitions/blind.d.ts +0 -11
  200. package/dist/view-transitions/blind.d.ts.map +0 -1
  201. package/dist/view-transitions/curtain-reveal.d.ts +0 -18
  202. package/dist/view-transitions/curtain-reveal.d.ts.map +0 -1
  203. package/dist/view-transitions/depth.d.ts +0 -21
  204. package/dist/view-transitions/depth.d.ts.map +0 -1
  205. package/dist/view-transitions/drill.d.ts +0 -9
  206. package/dist/view-transitions/drill.d.ts.map +0 -1
  207. package/dist/view-transitions/fade.d.ts +0 -8
  208. package/dist/view-transitions/fade.d.ts.map +0 -1
  209. package/dist/view-transitions/film.d.ts +0 -10
  210. package/dist/view-transitions/film.d.ts.map +0 -1
  211. package/dist/view-transitions/hero.d.ts +0 -9
  212. package/dist/view-transitions/hero.d.ts.map +0 -1
  213. package/dist/view-transitions/index.cjs +0 -35
  214. package/dist/view-transitions/index.d.ts +0 -18
  215. package/dist/view-transitions/index.d.ts.map +0 -1
  216. package/dist/view-transitions/index.js +0 -1614
  217. package/dist/view-transitions/instagram.d.ts +0 -8
  218. package/dist/view-transitions/instagram.d.ts.map +0 -1
  219. package/dist/view-transitions/jaemin.d.ts +0 -21
  220. package/dist/view-transitions/jaemin.d.ts.map +0 -1
  221. package/dist/view-transitions/pinterest.d.ts +0 -8
  222. package/dist/view-transitions/pinterest.d.ts.map +0 -1
  223. package/dist/view-transitions/rotate.d.ts +0 -6
  224. package/dist/view-transitions/rotate.d.ts.map +0 -1
  225. package/dist/view-transitions/scroll.d.ts +0 -8
  226. package/dist/view-transitions/scroll.d.ts.map +0 -1
  227. package/dist/view-transitions/sheet.d.ts +0 -21
  228. package/dist/view-transitions/sheet.d.ts.map +0 -1
  229. package/dist/view-transitions/slide.d.ts +0 -8
  230. package/dist/view-transitions/slide.d.ts.map +0 -1
  231. package/dist/view-transitions/snap.d.ts +0 -16
  232. package/dist/view-transitions/snap.d.ts.map +0 -1
  233. package/dist/view-transitions/strip.d.ts +0 -7
  234. package/dist/view-transitions/strip.d.ts.map +0 -1
  235. package/dist/view-transitions/swap.d.ts +0 -15
  236. package/dist/view-transitions/swap.d.ts.map +0 -1
  237. /package/dist/{animator → animation}/integrator/double-spring-integrator.d.ts +0 -0
  238. /package/dist/{animator → animation}/integrator/inertia-integrator.d.ts +0 -0
  239. /package/dist/{animator → animation}/integrator/spring-integrator.d.ts +0 -0
  240. /package/dist/{animator → animation}/integrator/types.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,1291 +1,1370 @@
1
- var nt = Object.defineProperty;
2
- var it = (e, i, t) => i in e ? nt(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
- var d = (e, i, t) => it(e, typeof i != "symbol" ? i + "" : i, t);
4
- import { normalizeToMultiAnimation as F, normalizeSchedule as W } from "./types.js";
5
- import { isCssAnimation as Gt, isKeyframesAnimation as $t, isMultiAnimation as Zt, isSingleAnimation as Jt, isTickAnimation as Qt } from "./types.js";
6
- import { S as $, a as rt } from "./spring-integrator-BM4a-82c.js";
7
- import { I as ot } from "./provider-B2B8CK6H.js";
8
- class st {
9
- constructor() {
10
- d(this, "listeners", /* @__PURE__ */ new Set());
11
- d(this, "rafId", null);
12
- d(this, "isRunning", !1);
13
- // Timing
14
- d(this, "startTime", Date.now());
15
- d(this, "lastUpdate", this.startTime);
16
- d(this, "elapsed", 0);
17
- // Lag smoothing (mobile optimization)
18
- d(this, "lagThreshold", 500);
19
- // ms - detect tab switches, backgrounding
20
- d(this, "adjustedLag", 33);
21
- // ms - max time jump to prevent animation skip
22
- d(this, "maxDeltaTime", 33);
23
- // ms - clamp for physics stability (30fps minimum)
24
- // FPS throttling
25
- d(this, "gap", 1e3 / 240);
26
- // max 240fps
27
- d(this, "nextTime", this.gap);
28
- d(this, "tick", () => {
29
- const i = Date.now();
30
- let n = i - this.lastUpdate;
31
- n > this.lagThreshold || n < 0 ? (this.startTime += n - this.adjustedLag, n = this.adjustedLag) : n > this.maxDeltaTime && (n = this.maxDeltaTime), this.lastUpdate = i;
32
- const r = i - this.startTime, o = r - this.nextTime;
33
- if (o > 0) {
34
- const s = n / 1e3;
35
- this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((m) => {
36
- m(s, this.elapsed);
37
- });
38
- }
39
- this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
40
- });
41
- }
42
- subscribe(i) {
43
- return this.listeners.add(i), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
44
- this.unsubscribe(i);
45
- };
46
- }
47
- unsubscribe(i) {
48
- this.listeners.delete(i), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
49
- }
50
- /**
51
- * Configure lag smoothing behavior
52
- * @param threshold - Time threshold to detect lag (default: 500ms)
53
- * @param adjustedLag - Max time jump when lag detected (default: 33ms)
54
- */
55
- lagSmoothing(i, t) {
56
- this.lagThreshold = i, this.adjustedLag = Math.min(t, i);
57
- }
58
- /**
59
- * Set maximum FPS
60
- * @param fps - Target FPS (default: 240)
61
- */
62
- fps(i) {
63
- this.gap = 1e3 / i, this.nextTime = this.elapsed * 1e3 + this.gap;
64
- }
65
- getListenerCount() {
66
- return this.listeners.size;
67
- }
68
- getElapsed() {
69
- return this.elapsed;
70
- }
71
- }
72
- const z = new st();
73
- function at(e) {
74
- const {
75
- integrator: i,
76
- from: t,
77
- to: n,
78
- velocity: r = 0,
79
- onUpdate: o,
80
- onComplete: s,
81
- onStart: m
82
- } = e;
83
- let l = { position: t, velocity: r }, u = !0, h = 0, v = !1;
84
- const A = (S) => {
85
- if (u) {
86
- if (v || (v = !0, m == null || m()), l = i.step(l, n, S), i.isSettled(l, n)) {
87
- if (h += Math.min(S, 0.033), h >= $) {
88
- l = { position: n, velocity: 0 }, u = !1, o(l.position), z.unsubscribe(A), s();
89
- return;
90
- }
91
- } else
92
- h = 0;
93
- o(l.position);
1
+ var ht = Object.defineProperty;
2
+ var mt = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var S = (e, t, n) => mt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { P as B, V as nt, W as w, M as $, S as ut } from "./multi-animation-CST6aZ8y.js";
5
+ import { A as Xe } from "./multi-animation-CST6aZ8y.js";
6
+ function P(e, t) {
7
+ const n = [];
8
+ for (let s = 0; s < e.length; s++)
9
+ for (let o = s + 1; o < e.length; o++) {
10
+ const a = e[s], i = e[o];
11
+ !a || !i || n.push({
12
+ from: a,
13
+ to: i,
14
+ transition: t(),
15
+ symmetric: !0
16
+ });
94
17
  }
95
- };
96
- return z.subscribe(A), {
97
- stop: () => {
98
- u && (u = !1, z.unsubscribe(A));
99
- },
100
- getPosition: () => l.position,
101
- getVelocity: () => l.velocity,
102
- isRunning: () => u
103
- };
104
- }
105
- const L = 1e3 / 60;
106
- function ct(e, i, t, n = 0) {
107
- let o = { position: i, velocity: n }, s = 0;
108
- const m = [];
109
- for (let l = 0; l < 600; l++) {
110
- const u = l * L;
111
- if (m.push({
112
- time: u,
113
- position: o.position,
114
- velocity: o.velocity
115
- }), o = e.step(o, t, L / 1e3), e.isSettled(o, t)) {
116
- if (s += L / 1e3, s >= $) {
117
- m.push({
118
- time: (l + 1) * L,
119
- position: t,
120
- velocity: 0
121
- });
122
- break;
123
- }
124
- } else
125
- s = 0;
126
- }
127
- return m;
128
- }
129
- function H(e, i) {
130
- if (e.length === 0)
131
- return { position: 0, velocity: 0 };
132
- const t = e[0], n = e[e.length - 1];
133
- if (i <= 0)
134
- return { position: t.position, velocity: t.velocity };
135
- if (i >= n.time)
136
- return { position: n.position, velocity: n.velocity };
137
- let r = 0, o = e.length - 1;
138
- for (; r < o - 1; ) {
139
- const u = Math.floor((r + o) / 2);
140
- e[u].time <= i ? r = u : o = u;
141
- }
142
- const s = e[r], m = e[o], l = (i - s.time) / (m.time - s.time);
143
- return {
144
- position: s.position + (m.position - s.position) * l,
145
- velocity: s.velocity + (m.velocity - s.velocity) * l
146
- };
147
- }
148
- function lt(e, i) {
149
- return e.map((t) => i(t.position));
150
- }
151
- function ut(e) {
152
- const {
153
- integrator: i,
154
- element: t,
155
- from: n,
156
- to: r,
157
- velocity: o = 0,
158
- style: s,
159
- onComplete: m,
160
- onStart: l
161
- } = e, u = ct(i, n, r, o);
162
- if (u.length === 0)
163
- return l == null || l(), m(), {
164
- stop: () => {
165
- },
166
- getPosition: () => r,
167
- getVelocity: () => 0,
168
- isRunning: () => !1
169
- };
170
- const h = lt(u, s), v = u[u.length - 1], A = v.time, S = h[0];
171
- if (S)
172
- for (const T of Object.keys(S))
173
- t.style[T] = "";
174
- const y = t.animate(h, {
175
- duration: A,
176
- fill: "forwards",
177
- easing: "linear",
178
- composite: "replace"
179
- });
180
- let p = !0;
181
- const k = performance.now();
182
- return l == null || l(), y.onfinish = () => {
183
- p && (p = !1, m());
184
- }, {
185
- stop: () => {
186
- p && (p = !1, y.cancel());
187
- },
188
- getPosition: () => {
189
- if (!p)
190
- return v.position;
191
- const T = performance.now() - k;
192
- return H(u, T).position;
193
- },
194
- getVelocity: () => {
195
- if (!p)
196
- return 0;
197
- const T = performance.now() - k;
198
- return H(u, T).velocity;
199
- },
200
- isRunning: () => p
201
- };
202
- }
203
- function ft(e) {
204
- const {
205
- element: i,
206
- frames: t,
207
- duration: n,
208
- easing: r = "linear",
209
- from: o,
210
- to: s,
211
- onComplete: m,
212
- onStart: l
213
- } = e, u = t[0];
214
- if (u)
215
- for (const S of Object.keys(u))
216
- S === "offset" || S === "easing" || S === "composite" || (i.style[S] = "");
217
- const h = i.animate(t, {
218
- duration: n,
219
- fill: "forwards",
220
- easing: r,
221
- composite: "replace"
222
- });
223
- let v = !0;
224
- const A = performance.now();
225
- return l == null || l(), h.onfinish = () => {
226
- v && (v = !1, m());
227
- }, {
228
- stop: () => {
229
- v && (v = !1, h.cancel());
230
- },
231
- // Linear progress mapped onto [from, to] — used by MultiAnimator for
232
- // stagger thresholds. The actual visual motion is whatever the keyframes
233
- // dictate; this mapping just gives the orchestration layer a monotonic
234
- // progress signal.
235
- getPosition: () => {
236
- if (!v) return s;
237
- const S = performance.now() - A, y = Math.min(Math.max(S / n, 0), 1);
238
- return o + (s - o) * y;
239
- },
240
- // Baked animations don't expose velocity — interruption/resumption isn't
241
- // supported here (you can stop, but can't resume mid-flight with momentum).
242
- getVelocity: () => 0,
243
- isRunning: () => v
244
- };
18
+ return n;
245
19
  }
246
- function mt(e) {
247
- const { to: i, onStart: t, onComplete: n } = e;
248
- return t == null || t(), n(), {
249
- stop: () => {
20
+ function st(e, t) {
21
+ return [
22
+ {
23
+ from: e.exit,
24
+ to: e.enter,
25
+ transition: t("enter")
250
26
  },
251
- getPosition: () => i,
252
- getVelocity: () => 0,
253
- isRunning: () => !1
254
- };
27
+ {
28
+ from: e.enter,
29
+ to: e.exit,
30
+ transition: t("exit")
31
+ }
32
+ ];
255
33
  }
256
- class dt {
257
- /**
258
- * Get bound runner based on animation mode
259
- *
260
- * @param options Animation mode options — exactly one of tick / css / keyframes
261
- * @returns Bound runner function (empty runner if no animation mode specified)
262
- * @throws Error if more than one mode is provided
263
- */
264
- static from(i) {
265
- const { tick: t, css: n, keyframes: r } = i;
266
- if ((t ? 1 : 0) + (n ? 1 : 0) + (r ? 1 : 0) > 1)
267
- throw new Error(
268
- "Cannot use more than one of 'tick', 'css', 'keyframes' together"
34
+ function ot(e, t, n) {
35
+ const s = [];
36
+ for (let o = 0; o < e.length; o++)
37
+ for (let a = o + 1; a < e.length; a++) {
38
+ const i = e[o], l = e[a];
39
+ !i || !l || s.push(
40
+ {
41
+ from: i,
42
+ to: l,
43
+ transition: n(t.forward)
44
+ },
45
+ {
46
+ from: l,
47
+ to: i,
48
+ transition: n(t.backward)
49
+ }
269
50
  );
270
- return r ? (s) => ft({
271
- element: r.element,
272
- frames: r.frames,
273
- duration: r.duration,
274
- easing: r.easing,
275
- from: s.from,
276
- to: s.to,
277
- onComplete: s.onComplete,
278
- onStart: s.onStart
279
- }) : n ? (s) => {
280
- if (!s.integrator)
281
- throw new Error("css mode requires an integrator");
282
- return ut({
283
- integrator: s.integrator,
284
- from: s.from,
285
- to: s.to,
286
- velocity: s.velocity,
287
- onComplete: s.onComplete,
288
- onStart: s.onStart,
289
- element: n.element,
290
- style: n.style
291
- });
292
- } : t ? (s) => {
293
- if (!s.integrator)
294
- throw new Error("tick mode requires an integrator");
295
- return at({
296
- integrator: s.integrator,
297
- from: s.from,
298
- to: s.to,
299
- velocity: s.velocity,
300
- onComplete: s.onComplete,
301
- onStart: s.onStart,
302
- onUpdate: t
303
- });
304
- } : mt;
305
- }
306
- }
307
- class Z {
51
+ }
52
+ return s;
308
53
  }
309
- const ht = { stiffness: 300, damping: 30 };
310
- class K extends Z {
54
+ class v {
311
55
  constructor(t) {
312
- super();
313
- d(this, "options");
314
- d(this, "runner");
315
- d(this, "controls", null);
316
- d(this, "isAnimating", !1);
317
- d(this, "currentValue");
318
- d(this, "currentVelocity", 0);
319
- d(this, "updateFn");
320
- d(this, "isKeyframesMode");
321
- if (this.options = {
322
- from: t.from ?? 0,
323
- to: t.to ?? 1,
324
- physics: t.physics,
325
- onComplete: t.onComplete ?? (() => {
326
- }),
327
- onStart: t.onStart
328
- }, this.currentValue = this.options.from, this.isKeyframesMode = !!t.keyframes, t.tick)
329
- this.updateFn = (n) => {
330
- var r;
331
- return (r = t.tick) == null ? void 0 : r.call(t, n);
332
- };
333
- else if (t.css) {
334
- const { element: n, style: r } = t.css;
335
- this.updateFn = (o) => {
336
- const s = r(o);
337
- for (const [m, l] of Object.entries(s))
338
- n.style[m] = typeof l == "number" ? String(l) : l;
339
- };
340
- } else
341
- this.updateFn = () => {
342
- };
343
- this.runner = dt.from({
344
- tick: t.tick,
345
- css: t.css,
346
- keyframes: t.keyframes
347
- });
348
- }
349
- /**
350
- * Sync element state to current progress value
351
- * Uses the update callback if provided
352
- */
353
- syncState() {
354
- var t;
355
- (t = this.updateFn) == null || t.call(this, this.currentValue);
356
- }
357
- /**
358
- * Create Integrator from physics options
359
- * Priority: integrator factory > inertia/spring config > default spring
360
- */
361
- createIntegrator() {
362
- const t = this.options.physics;
363
- return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? ot.from({
364
- spring: t.spring,
365
- inertia: t.inertia
366
- }) : new rt(ht);
367
- }
368
- runAnimation(t) {
369
- this.isAnimating = !0, this.controls = this.runner({
370
- // Keyframes mode plays a pre-baked WAAPI animation — no integrator
371
- // needed. tick/css modes still require one.
372
- integrator: this.isKeyframesMode ? void 0 : this.createIntegrator(),
373
- from: this.currentValue,
374
- to: t,
375
- velocity: this.currentVelocity,
376
- onStart: this.options.onStart,
377
- onComplete: () => {
378
- this.currentValue = t, this.currentVelocity = 0, this.isAnimating = !1, this.controls = null, this.options.onComplete();
379
- }
380
- });
56
+ S(this, "omega");
57
+ // Angular frequency
58
+ S(this, "zeta");
59
+ // Damping ratio
60
+ S(this, "restDelta");
61
+ S(this, "restSpeed");
62
+ const { stiffness: n, damping: s } = t, o = 1;
63
+ this.omega = Math.sqrt(n / o), this.zeta = s / (2 * Math.sqrt(n * o)), this.restDelta = t.restDelta ?? B, this.restSpeed = t.restSpeed ?? nt;
381
64
  }
382
- forward() {
383
- this.stop(), this.runAnimation(this.options.to);
384
- }
385
- backward() {
386
- this.stop(), this.runAnimation(this.options.from);
387
- }
388
- reverse() {
389
- const t = this.options.from;
390
- this.options.from = this.options.to, this.options.to = t, this.isAnimating && (this.stop(), this.runAnimation(this.options.to));
391
- }
392
- stop() {
393
- this.controls && (this.currentValue = this.controls.getPosition(), this.currentVelocity = this.controls.getVelocity(), this.controls.stop(), this.controls = null), this.isAnimating = !1;
394
- }
395
- getVelocity() {
396
- var t;
397
- return ((t = this.controls) == null ? void 0 : t.getVelocity()) ?? this.currentVelocity;
398
- }
399
- getCurrentValue() {
400
- var t;
401
- return ((t = this.controls) == null ? void 0 : t.getPosition()) ?? this.currentValue;
402
- }
403
- getIsAnimating() {
404
- return this.isAnimating;
405
- }
406
- getCurrentState() {
65
+ step(t, n, s) {
66
+ const o = Math.min(s, 0.033), { omega: a, zeta: i } = this, { position: l, velocity: c } = t, r = -2 * o * i * a * c, p = o * a * a * (n - l), d = c + r + p;
407
67
  return {
408
- position: this.getCurrentValue(),
409
- velocity: this.getVelocity(),
410
- from: this.options.from,
411
- to: this.options.to
68
+ position: l + o * d,
69
+ velocity: d
412
70
  };
413
71
  }
414
- setValue(t) {
415
- this.currentValue = t;
416
- }
417
- setVelocity(t) {
418
- this.currentVelocity = t;
419
- }
420
- updateOptions(t) {
421
- this.options = { ...this.options, ...t };
72
+ isSettled(t, n) {
73
+ const s = Math.abs(n - t.position), o = Math.abs(t.velocity);
74
+ return s < this.restDelta && o < this.restSpeed;
422
75
  }
423
76
  }
424
- class D extends Z {
77
+ class yt {
425
78
  constructor(t) {
426
- super();
427
- d(this, "config");
428
- d(this, "animators", /* @__PURE__ */ new Map());
429
- d(this, "itemOrder", []);
430
- d(this, "completedCount", 0);
431
- d(this, "completedAnimators", /* @__PURE__ */ new Set());
432
- d(this, "direction", "forward");
433
- d(this, "idCounter", 0);
434
- d(this, "rafId", null);
435
- d(this, "from");
436
- d(this, "to");
437
- d(this, "initialState");
438
- this.config = t.config, this.from = t.from, this.to = t.to, this.initialState = t.state ?? {
439
- position: t.from,
440
- velocity: 0
441
- }, this.initializeAnimators();
442
- }
443
- generateId() {
444
- return `spring_${this.idCounter++}`;
445
- }
446
- initializeAnimators() {
447
- this.config.items.forEach((t, n) => {
448
- const r = this.generateId(), o = new K({
449
- from: this.from,
450
- to: this.to,
451
- physics: t.physics,
452
- tick: t.tick,
453
- css: t.css,
454
- keyframes: t.keyframes,
455
- onComplete: () => this.onAnimatorComplete(r),
456
- onStart: t.onStart
457
- });
458
- (n === 0 || t.normalizedOffset === 0) && (o.setValue(this.initialState.position), o.setVelocity(this.initialState.velocity), o.syncState()), this.animators.set(r, {
459
- id: r,
460
- item: t,
461
- animator: o,
462
- started: !1
463
- }), this.itemOrder.push(r);
79
+ S(this, "leader");
80
+ S(this, "follower");
81
+ S(this, "restDelta");
82
+ S(this, "restSpeed");
83
+ this.restDelta = t.restDelta ?? B, this.restSpeed = t.restSpeed ?? nt, this.leader = new v({
84
+ stiffness: t.stiffness,
85
+ damping: t.damping,
86
+ restDelta: this.restDelta,
87
+ restSpeed: this.restSpeed
88
+ });
89
+ let n, s, o, a;
90
+ typeof t.follower == "number" ? (n = t.stiffness * t.follower, s = t.damping) : t.follower ? (n = t.follower.stiffness, s = t.follower.damping, o = t.follower.restDelta, a = t.follower.restSpeed) : (n = t.stiffness, s = t.damping), this.follower = new v({
91
+ stiffness: n,
92
+ damping: s,
93
+ restDelta: o ?? this.restDelta,
94
+ restSpeed: a ?? this.restSpeed
464
95
  });
465
96
  }
466
- /**
467
- * Calculate progress of an animator (0-1)
468
- * Progress = |position - from| / |to - from|
469
- */
470
- getAnimatorProgress(t) {
471
- const n = t.animator.getCurrentState(), r = Math.abs(n.to - n.from);
472
- return r === 0 ? 1 : Math.abs(n.position - n.from) / r;
473
- }
474
- /**
475
- * Get order of springs based on direction
476
- * Forward: 0, 1, 2, ...
477
- * Backward: n-1, n-2, ..., 0
478
- */
479
- getOrderedIds() {
480
- return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
481
- }
482
- onAnimatorComplete(t) {
483
- var r, o, s, m, l, u;
484
- const n = this.animators.get(t);
485
- !n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = n.item).onComplete) == null || o.call(r), (m = (s = this.config).onProgress) == null || m.call(s, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (u = (l = this.config).onEnd) == null || u.call(l)));
486
- }
487
- /**
488
- * Check and start springs based on previous spring's progress
489
- * Called on each frame while animation is running
490
- */
491
- checkAndStartSprings() {
492
- const t = this.getOrderedIds();
493
- for (let n = 0; n < t.length; n++) {
494
- const r = t[n], o = this.animators.get(r);
495
- if (!o || o.started) continue;
496
- if (n === 0) {
497
- this.startAnimator(r);
498
- continue;
499
- }
500
- const s = t[n - 1], m = this.animators.get(s);
501
- if (!m || !m.started) continue;
502
- const l = this.getAnimatorProgress(m), u = o.item.normalizedOffset;
503
- l >= u && this.startAnimator(r);
504
- }
505
- }
506
- startAnimator(t) {
507
- const n = this.animators.get(t);
508
- !n || n.started || (n.started = !0, this.direction === "forward" ? n.animator.forward() : n.animator.backward());
509
- }
510
- /**
511
- * Start the scheduler loop that checks spring progress
512
- */
513
- startScheduler() {
514
- const t = () => {
515
- this.checkAndStartSprings(), this.getIsAnimating() && (this.rafId = requestAnimationFrame(t));
97
+ step(t, n, s) {
98
+ const a = t._leader ?? {
99
+ position: t.position,
100
+ velocity: t.velocity
101
+ }, i = this.leader.step(a, n, s), l = this.follower.step(
102
+ t,
103
+ i.position,
104
+ s
105
+ );
106
+ return {
107
+ position: l.position,
108
+ velocity: l.velocity,
109
+ _leader: i
516
110
  };
517
- t();
518
- }
519
- stopScheduler() {
520
- this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
521
- }
522
- getFirstAnimator() {
523
- var n;
524
- const t = this.itemOrder[0];
525
- return t ? ((n = this.animators.get(t)) == null ? void 0 : n.animator) ?? null : null;
526
- }
527
- forward() {
528
- var t, n;
529
- this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (n = (t = this.config).onStart) == null || n.call(t), this.startScheduler();
530
- }
531
- backward() {
532
- var t, n;
533
- this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (n = (t = this.config).onStart) == null || n.call(t), this.startScheduler();
534
- }
535
- resetStartedFlags() {
536
- this.animators.forEach((t) => {
537
- t.started = !1;
538
- });
539
111
  }
540
- stop() {
541
- this.stopScheduler(), this.animators.forEach((t) => {
542
- t.animator.stop(), t.started = !1;
543
- });
112
+ isSettled(t, n) {
113
+ const s = t, o = Math.abs(n - t.position) < this.restDelta && Math.abs(t.velocity) < this.restSpeed;
114
+ return s._leader ? Math.abs(n - s._leader.position) < this.restDelta && Math.abs(s._leader.velocity) < this.restSpeed && o : o;
544
115
  }
545
- reverse() {
546
- this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((t) => {
547
- if (!t.started)
548
- return;
549
- const n = t.animator.getCurrentState();
550
- if (n.position === n.to) {
551
- const o = new K({
552
- from: this.to,
553
- to: this.from,
554
- physics: t.item.physics,
555
- tick: t.item.tick,
556
- css: t.item.css,
557
- keyframes: t.item.keyframes,
558
- onComplete: () => this.onAnimatorComplete(t.id),
559
- onStart: t.item.onStart
560
- });
561
- o.setValue(this.to), o.setVelocity(0), o.syncState(), o.forward(), t.animator = o;
562
- } else
563
- t.animator.reverse();
564
- });
116
+ }
117
+ const gt = 0.01, wt = 500, bt = 10;
118
+ class St {
119
+ constructor(t) {
120
+ S(this, "acceleration");
121
+ S(this, "resistance");
122
+ S(this, "resistanceType");
123
+ S(this, "min");
124
+ S(this, "max");
125
+ S(this, "bounceStiffness");
126
+ S(this, "bounceDamping");
127
+ S(this, "restDelta");
128
+ this.acceleration = t.acceleration, this.resistance = t.resistance, this.resistanceType = t.resistanceType ?? "quadratic", this.min = t.min, this.max = t.max, this.bounceStiffness = t.bounceStiffness ?? wt, this.bounceDamping = t.bounceDamping ?? bt, this.restDelta = t.restDelta ?? gt;
565
129
  }
566
- getCurrentState() {
567
- const t = this.getFirstAnimator();
568
- return t ? t.getCurrentState() : {
569
- position: 0,
570
- velocity: 0,
571
- from: 0,
572
- to: 1
130
+ step(t, n, s) {
131
+ const o = Math.min(s, 0.033), { acceleration: a, resistance: i, resistanceType: l, min: c, max: r } = this, { position: p, velocity: d } = t, h = c !== void 0 && p < c, u = r !== void 0 && p > r;
132
+ let f;
133
+ if (h || u) {
134
+ const b = p - (h ? c : r), C = -this.bounceStiffness * b, E = -this.bounceDamping * d;
135
+ f = C + E;
136
+ } else {
137
+ const x = n > p ? 1 : -1;
138
+ let b;
139
+ l === "linear" ? b = i * d : b = i * d * Math.abs(d), f = x * a - b;
140
+ }
141
+ const m = d + f * o;
142
+ let y = p + m * o;
143
+ if (!h && !u) {
144
+ const x = n > p ? 1 : -1;
145
+ (x > 0 && y > n || x < 0 && y < n) && (y = n);
146
+ }
147
+ return {
148
+ position: y,
149
+ velocity: y === n ? 0 : m
573
150
  };
574
151
  }
575
- /**
576
- * Get current position value from first animator
577
- */
578
- getCurrentValue() {
579
- const t = this.getFirstAnimator();
580
- return (t == null ? void 0 : t.getCurrentValue()) ?? 0;
152
+ isSettled(t, n) {
153
+ return Math.abs(n - t.position) < this.restDelta;
581
154
  }
155
+ }
156
+ class g {
582
157
  /**
583
- * Get current velocity from first animator
158
+ * Create an Integrator from physics config
159
+ *
160
+ * @param config Physics configuration (spring or inertia)
161
+ * @returns Appropriate Integrator instance
162
+ * @throws Error if both spring and inertia are provided
584
163
  */
585
- getVelocity() {
586
- const t = this.getFirstAnimator();
587
- return (t == null ? void 0 : t.getVelocity()) ?? 0;
164
+ static from(t) {
165
+ if (t.spring && t.inertia)
166
+ throw new Error(
167
+ "Cannot use both 'spring' and 'inertia' together. Choose one physics type."
168
+ );
169
+ if (t.inertia)
170
+ return new St({
171
+ acceleration: t.inertia.acceleration,
172
+ resistance: t.inertia.resistance,
173
+ resistanceType: t.inertia.resistanceType,
174
+ min: t.inertia.min,
175
+ max: t.inertia.max,
176
+ bounceStiffness: t.inertia.bounceStiffness,
177
+ bounceDamping: t.inertia.bounceDamping,
178
+ restDelta: t.inertia.restDelta
179
+ });
180
+ const n = t.spring ?? { stiffness: 300, damping: 30 };
181
+ if (n.doubleSpring) {
182
+ const s = n.doubleSpring;
183
+ let o;
184
+ return typeof s == "number" ? o = s : typeof s == "object" && (o = {
185
+ stiffness: s.stiffness,
186
+ damping: s.damping
187
+ }), new yt({
188
+ stiffness: n.stiffness,
189
+ damping: n.damping,
190
+ follower: o,
191
+ restDelta: n.restDelta,
192
+ restSpeed: n.restSpeed
193
+ });
194
+ }
195
+ return new v({
196
+ stiffness: n.stiffness,
197
+ damping: n.damping,
198
+ restDelta: n.restDelta,
199
+ restSpeed: n.restSpeed
200
+ });
588
201
  }
589
202
  /**
590
- * Set position value on first animator
591
- * TODO: Support per-spring control
203
+ * Create an Integrator from SpringConfig (legacy support)
204
+ * @deprecated Use from({ spring: config }) instead
592
205
  */
593
- setValue(t) {
594
- const n = this.getFirstAnimator();
595
- n == null || n.setValue(t);
206
+ static fromSpring(t) {
207
+ return g.from({ spring: t });
596
208
  }
597
- /**
598
- * Set velocity on first animator
599
- * TODO: Support per-spring control
600
- */
601
- setVelocity(t) {
602
- const n = this.getFirstAnimator();
603
- n == null || n.setVelocity(t);
209
+ }
210
+ class $t {
211
+ constructor(t) {
212
+ S(this, "durationSec");
213
+ this.durationSec = Math.max(1 / 60, t.durationSec);
604
214
  }
605
- /**
606
- * Check if any animation is currently running
607
- */
608
- getIsAnimating() {
609
- for (const t of this.animators.values())
610
- if (t.animator.getIsAnimating())
611
- return !0;
612
- return !1;
215
+ step(t, n, s) {
216
+ const o = n - t.position;
217
+ if (o === 0) return t;
218
+ const a = Math.sign(o), i = Math.abs(o) / this.durationSec, l = a * i * s, c = t.position + l;
219
+ return (a > 0 ? c >= n : c <= n) ? { position: n, velocity: 0 } : { position: c, velocity: a * i };
613
220
  }
614
- /**
615
- * Create MultiAnimator from existing state
616
- * Uses first animator's state for initialization
617
- */
618
- static fromState(t, n) {
619
- return new D({ ...n, state: t });
221
+ isSettled(t, n) {
222
+ return Math.abs(t.position - n) < B;
620
223
  }
621
224
  }
622
- const J = Symbol.for("TRANSITION_STRATEGY"), gt = (e) => ({
623
- runIn: async (i) => {
624
- const { currentAnimation: t } = e;
625
- if (t && t.direction === "out") {
626
- const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
627
- if (t.controller.stop(), i.out)
628
- return {
629
- config: await i.out,
630
- state: { position: r, velocity: o },
631
- from: 1,
632
- to: 0,
633
- direction: "backward"
634
- // Will actually go 0→1 (backward means toward 'from')
635
- };
636
- }
637
- return i.in ? {
638
- config: await i.in,
639
- state: {
640
- position: 0,
641
- velocity: 0
642
- },
643
- from: 0,
644
- to: 1,
645
- direction: "forward"
646
- } : {
647
- state: {
648
- position: 0,
649
- velocity: 0
650
- },
651
- from: 0,
652
- to: 1,
653
- direction: "forward"
654
- };
655
- },
656
- runOut: async (i) => {
657
- const { currentAnimation: t } = e;
658
- if (t && t.direction === "in") {
659
- const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
660
- if (t.controller.stop(), i.in)
661
- return {
662
- config: await i.in,
663
- state: { position: r, velocity: o },
664
- from: 0,
665
- to: 1,
666
- direction: "backward"
667
- // Will actually go 1→0 (backward means toward 'from')
668
- };
225
+ const xt = {
226
+ spring: { stiffness: 200, damping: 22 }
227
+ }, Ct = 10, Et = "horizontal", Pt = "#000000";
228
+ function N(e, t, n, s, o, a) {
229
+ window.getComputedStyle(e).position === "static" && (e.style.position = "relative");
230
+ const l = document.createElement("div");
231
+ l.style.cssText = `
232
+ position: absolute;
233
+ top: 0;
234
+ left: 0;
235
+ width: 100%;
236
+ height: 100%;
237
+ pointer-events: none;
238
+ z-index: 9999;
239
+ overflow: hidden;
240
+ `;
241
+ const c = [];
242
+ for (let r = 0; r < t; r++) {
243
+ const p = document.createElement("div");
244
+ if (n === "horizontal") {
245
+ const d = 100 / t;
246
+ p.style.cssText = `
247
+ position: absolute;
248
+ top: ${d * r}%;
249
+ left: 0;
250
+ width: 100%;
251
+ height: calc(${d}% + 1px);
252
+ background: ${s};
253
+ transform: scaleX(${o === "hidden" ? 0 : 1});
254
+ transform-origin: ${a} center;
255
+ will-change: transform;
256
+ `;
257
+ } else {
258
+ const d = 100 / t;
259
+ p.style.cssText = `
260
+ position: absolute;
261
+ top: 0;
262
+ left: ${d * r}%;
263
+ width: calc(${d}% + 1px);
264
+ height: 100%;
265
+ background: ${s};
266
+ transform: scaleY(${o === "hidden" ? 0 : 1});
267
+ transform-origin: ${a === "left" ? "top" : "bottom"} center;
268
+ will-change: transform;
269
+ `;
669
270
  }
670
- return i.out ? {
671
- config: await i.out,
672
- state: {
673
- position: 1,
674
- velocity: 0
675
- },
676
- from: 1,
677
- to: 0,
678
- direction: "forward"
679
- } : {
680
- state: {
681
- position: 1,
682
- velocity: 0
683
- },
684
- from: 1,
685
- to: 0,
686
- direction: "forward"
687
- };
271
+ c.push(p), l.appendChild(p);
688
272
  }
689
- }), yt = () => ({
690
- runIn: async (e) => e.in ? {
691
- config: await e.in,
692
- state: {
693
- position: 0,
694
- velocity: 0
695
- },
696
- from: 0,
697
- to: 1,
698
- direction: "forward"
699
- } : {
700
- state: {
701
- position: 0,
702
- velocity: 0
273
+ return e.appendChild(l), { container: l, blinds: c };
274
+ }
275
+ const Dt = (e = {}) => {
276
+ const t = e.blindCount ?? Ct, n = e.direction ?? Et, s = e.blindColor ?? Pt, o = e.physics ?? xt;
277
+ return {
278
+ prepare: async ({ from: a, to: i }) => {
279
+ const l = await a, c = await i;
280
+ l.style.zIndex = "1000";
281
+ const r = N(
282
+ l,
283
+ t,
284
+ n,
285
+ s,
286
+ "hidden",
287
+ "left"
288
+ );
289
+ c.style.position = "relative", c.style.zIndex = "0";
290
+ const p = N(
291
+ c,
292
+ t,
293
+ n,
294
+ s,
295
+ "closed",
296
+ "right"
297
+ );
298
+ return {
299
+ fromBlinds: r.blinds,
300
+ fromContainer: r.container,
301
+ toBlinds: p.blinds,
302
+ toContainer: p.container
303
+ };
703
304
  },
704
- from: 0,
705
- to: 1,
706
- direction: "forward"
707
- },
708
- runOut: async (e) => e.out ? {
709
- config: await e.out,
710
- state: {
711
- position: 1,
712
- velocity: 0
305
+ animation: ({ fromBlinds: a, fromContainer: i, toBlinds: l, toContainer: c }) => {
306
+ const r = a.map(
307
+ (u) => new w({
308
+ element: u,
309
+ integrator: g.from(o),
310
+ style: (f) => ({
311
+ transform: n === "horizontal" ? `scaleX(${f})` : `scaleY(${f})`
312
+ })
313
+ })
314
+ ), p = l.map(
315
+ (u, f) => new w({
316
+ element: u,
317
+ integrator: g.from(o),
318
+ style: (m, y) => ({
319
+ transform: n === "horizontal" ? `scaleX(${y})` : `scaleY(${y})`
320
+ }),
321
+ onComplete: f === l.length - 1 ? () => {
322
+ c.remove(), i.remove();
323
+ } : void 0
324
+ })
325
+ ), d = new $(r, { mode: "parallel" }), h = new $(p, { mode: "parallel" });
326
+ return new $([d, h], { mode: "sequence" });
327
+ }
328
+ };
329
+ };
330
+ function Ie({ paths: e }) {
331
+ return P(e, () => Dt());
332
+ }
333
+ const Ot = {
334
+ spring: { stiffness: 200, damping: 20, doubleSpring: 0.7 }
335
+ }, I = 0.5;
336
+ function It(e) {
337
+ const t = e === "enter" ? -100 : 100, n = e === "enter" ? 100 : -100;
338
+ return {
339
+ out: {
340
+ willChange: "transform, opacity",
341
+ startStyle: {},
342
+ animate: (s) => ({
343
+ transform: `translate3d(${t * s}%, 0, 0)`,
344
+ opacity: `${I + (1 - I) * (1 - s)}`
345
+ })
713
346
  },
714
- from: 1,
715
- to: 0,
716
- direction: "forward"
717
- } : {
718
- state: {
719
- position: 1,
720
- velocity: 0
347
+ in: {
348
+ willChange: "transform, opacity",
349
+ startStyle: {
350
+ transform: `translate3d(${n}%, 0, 0)`,
351
+ opacity: `${I}`
352
+ },
353
+ animate: (s) => ({
354
+ transform: `translate3d(${n * (1 - s)}%, 0, 0)`,
355
+ opacity: `${I + (1 - I) * s}`
356
+ })
357
+ }
358
+ };
359
+ }
360
+ function Tt() {
361
+ return {
362
+ physics: Ot,
363
+ build: It
364
+ };
365
+ }
366
+ const At = {
367
+ spring: { stiffness: 170, damping: 22 }
368
+ };
369
+ function _t(e) {
370
+ const t = e === "enter" ? -20 : 100, n = e === "enter" ? 100 : -20;
371
+ return {
372
+ out: {
373
+ willChange: "transform",
374
+ startStyle: {},
375
+ animate: (s) => ({
376
+ transform: `translate3d(${t * s}%, 0, 0)`
377
+ })
721
378
  },
722
- from: 1,
723
- to: 0,
724
- direction: "forward"
725
- }
726
- }), Q = "data-ssgoi-scope", tt = "data-ssgoi-scope-ready";
727
- function Nt() {
728
- return (e) => {
729
- if (e)
730
- return e.setAttribute(Q, ""), queueMicrotask(() => {
731
- queueMicrotask(() => {
732
- e.setAttribute(tt, "true");
733
- });
734
- }), () => {
735
- };
379
+ in: {
380
+ willChange: "transform",
381
+ startStyle: {
382
+ transform: `translate3d(${n}%, 0, 0)`
383
+ },
384
+ animate: (s) => ({
385
+ transform: `translate3d(${n * (1 - s)}%, 0, 0)`
386
+ })
387
+ }
736
388
  };
737
389
  }
738
- function wt(e) {
739
- return e.hasAttribute(tt);
390
+ function kt() {
391
+ return {
392
+ physics: At,
393
+ build: _t
394
+ };
740
395
  }
741
- function pt(e) {
742
- return e.closest(`[${Q}]`);
396
+ const vt = {
397
+ parallax: kt(),
398
+ crossfade: Tt()
399
+ }, Lt = "parallax";
400
+ function Z(e, t) {
401
+ e.style.willChange = t.willChange, e.style.backfaceVisibility = "hidden", e.style.contain = "layout paint";
402
+ for (const [n, s] of Object.entries(t.startStyle))
403
+ e.style[n] = s;
743
404
  }
744
- const vt = (e) => {
745
- let i = e.parentElement;
746
- for (; i && i !== document.body; ) {
747
- const t = window.getComputedStyle(i), n = t.overflow + t.overflowY + t.overflowX;
748
- if (n.includes("auto") || n.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
749
- return i;
750
- i = i.parentElement;
751
- }
752
- return document.documentElement;
753
- }, St = (e) => {
754
- let i = e.parentElement;
755
- for (; i && i !== document.body; ) {
756
- const t = window.getComputedStyle(i).position;
757
- if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
758
- return i;
759
- i = i.parentElement;
760
- }
761
- return document.body;
762
- };
763
- function U(e) {
764
- return new Promise((i) => {
765
- requestAnimationFrame(() => {
766
- requestAnimationFrame(() => {
767
- i();
405
+ const Yt = (e = {}) => {
406
+ const t = e.direction ?? "enter", n = vt[e.type ?? Lt], s = n.physics, o = n.build(t);
407
+ return {
408
+ prepare: ({ from: a, to: i }) => (a.then((l) => {
409
+ Z(l, o.out), l.style.pointerEvents = "none", l.style.zIndex = t === "enter" ? "-1" : "100";
410
+ }), i.then((l) => {
411
+ Z(l, o.in);
412
+ }), {}),
413
+ animation: ({ from: a, to: i }) => {
414
+ const l = new w({
415
+ element: a,
416
+ integrator: g.from(s),
417
+ style: (r) => o.out.animate(r)
418
+ }), c = new w({
419
+ element: i,
420
+ integrator: g.from(s),
421
+ style: (r) => o.in.animate(r),
422
+ onComplete: () => {
423
+ i.style.willChange = "auto", i.style.backfaceVisibility = "", i.style.contain = "", i.style.transform = "", i.style.opacity = "";
424
+ }
768
425
  });
769
- });
770
- });
771
- }
772
- function At(e, i) {
773
- var S;
774
- let t = null, n = null, r = null, o = null;
775
- const s = {
776
- get currentAnimation() {
777
- return t;
778
- }
779
- }, m = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, s)) || gt(s), l = async (y) => {
780
- var g, E;
781
- n && (n.remove(), n = null);
782
- const p = e(), k = p.in && p.in(y), T = !(i != null && i.strategy) && p.out ? p.out(y) : void 0;
783
- if (!k)
784
- return;
785
- const w = {
786
- in: F(k),
787
- out: T ? F(T) : void 0
788
- }, f = await m.runIn(w);
789
- if (!f.config) {
790
- t && (t.direction = "in");
791
- return;
426
+ return new $([l, c], { mode: "parallel" });
792
427
  }
793
- const a = f.config;
794
- (g = a.prepare) == null || g.call(a);
795
- const C = W(
796
- {
797
- ...a,
798
- onEnd: () => {
799
- var b;
800
- t = null, (b = a.onEnd) == null || b.call(a);
428
+ };
429
+ };
430
+ function Te({ type: e, ...t }) {
431
+ return st(
432
+ t,
433
+ (n) => Yt({ direction: n, type: e })
434
+ );
435
+ }
436
+ const Ft = {
437
+ spring: { stiffness: 180, damping: 20, doubleSpring: !0 }
438
+ }, Mt = {
439
+ spring: { stiffness: 170, damping: 20, doubleSpring: !0 }
440
+ }, Ht = (e = {}) => {
441
+ const t = e.physics ?? Mt, n = e.physics ?? Ft;
442
+ return {
443
+ prepare: ({ to: s }) => (s.then((o) => {
444
+ o.style.opacity = "0", o.style.willChange = "opacity";
445
+ }), {}),
446
+ animation: ({ from: s, to: o }) => {
447
+ const a = new w({
448
+ element: s,
449
+ integrator: g.from(n),
450
+ // Default bounds (0, 1). `u` runs 1→0 as the animation moves
451
+ // forward, mapping opacity from fully visible to invisible.
452
+ style: (l, c) => ({ opacity: c }),
453
+ onComplete: () => {
454
+ s.style.willChange = "auto";
801
455
  }
802
- },
803
- y
804
- );
805
- a.wait && await a.wait();
806
- const c = D.fromState(f.state, {
807
- config: C,
808
- from: f.from,
809
- to: f.to
810
- });
811
- t = { controller: c, direction: "in" }, (E = a.onReady) == null || E.call(a), await U(), f.direction === "forward" ? c.forward() : c.backward();
812
- }, u = async (y) => {
813
- var E, b;
814
- n = y;
815
- const p = e(), k = !(i != null && i.strategy) && p.in ? p.in(y) : void 0, T = p.out && p.out(y);
816
- if (!T)
817
- return;
818
- const w = {
819
- in: k ? F(k) : void 0,
820
- out: F(T)
821
- }, f = await m.runOut(w);
822
- if (!f.config) {
823
- t && (t.direction = "out"), n && (n.remove(), n = null);
824
- return;
825
- }
826
- const a = f.config;
827
- g(), (E = a.prepare) == null || E.call(a);
828
- const C = W(
829
- {
830
- ...a,
831
- onEnd: () => {
832
- var R, M;
833
- (R = a.onEnd) == null || R.call(a), n && (n.remove(), n = null), t = null, (M = i == null ? void 0 : i.onCleanupEnd) == null || M.call(i);
456
+ }), i = new w({
457
+ element: o,
458
+ integrator: g.from(t),
459
+ style: (l) => ({ opacity: l }),
460
+ onComplete: () => {
461
+ o.style.willChange = "auto", o.style.opacity = "";
834
462
  }
835
- },
836
- y
837
- );
838
- a.wait && await a.wait();
839
- const c = D.fromState(f.state, {
840
- config: C,
841
- from: f.from,
842
- to: f.to
843
- });
844
- t = { controller: c, direction: "out" }, (b = a.onReady) == null || b.call(a), await U(), f.direction === "forward" ? c.forward() : c.backward();
845
- function g() {
846
- !r || !n || (o && r.contains(o) ? r.insertBefore(n, o) : r.appendChild(n));
463
+ });
464
+ return new $([a, i], { mode: "sequence" });
847
465
  }
848
466
  };
849
- let h = null, v = !1;
850
- const A = (y) => () => {
851
- if (v) return;
852
- v = !0;
853
- const p = y.cloneNode(!0);
854
- h ? queueMicrotask(() => {
855
- document.contains(h) && u(p);
856
- }) : u(p);
857
- };
858
- return (y) => {
859
- if (y)
860
- return requestAnimationFrame(() => {
861
- r = y.parentElement, o = y.nextElementSibling;
862
- }), v = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
863
- h = pt(y), !(h && !wt(h)) && l(y);
864
- }) : l(y), A(y);
865
- };
467
+ };
468
+ function Ae({ paths: e }) {
469
+ return P(e, () => Ht());
866
470
  }
867
- const P = /* @__PURE__ */ new Map();
868
- let I = null, q = !1;
869
- function et(e) {
870
- if (e instanceof HTMLElement && P.has(e)) {
871
- const t = P.get(e);
872
- P.delete(e), queueMicrotask(() => {
873
- t();
874
- });
875
- }
876
- const i = e.childNodes;
877
- for (let t = 0; t < i.length; t++) {
878
- const n = i[t];
879
- n && et(n);
471
+ function O(e, t) {
472
+ function n(a) {
473
+ let i = 0, l = 0;
474
+ const c = a.offsetWidth, r = a.offsetHeight;
475
+ let p = a;
476
+ for (; p; )
477
+ i += p.offsetTop, l += p.offsetLeft, p = p.offsetParent;
478
+ return i -= window.scrollY, l -= window.scrollX, { top: i, left: l, width: c, height: r };
880
479
  }
480
+ const s = n(e), o = n(t);
481
+ return new DOMRect(
482
+ o.left - s.left,
483
+ o.top - s.top,
484
+ o.width,
485
+ o.height
486
+ );
881
487
  }
882
- function Ct() {
883
- q || typeof document > "u" || (q = !0, I = new MutationObserver((e) => {
884
- for (const i of e) {
885
- const t = i.removedNodes;
886
- for (let n = 0; n < t.length; n++) {
887
- const r = t[n];
888
- r && et(r);
889
- }
890
- }
891
- }), document.body ? I.observe(document.body, {
892
- childList: !0,
893
- subtree: !0
894
- }) : document.addEventListener(
895
- "DOMContentLoaded",
896
- () => {
897
- I == null || I.observe(document.body, {
898
- childList: !0,
899
- subtree: !0
900
- });
901
- },
902
- { once: !0 }
903
- ));
904
- }
905
- function Et(e, i) {
906
- Ct(), P.set(e, i);
488
+ function T(e, t) {
489
+ const { scrollingElement: n, positionedParent: s } = e, o = n !== s && n.contains(s) ? O(n, s).top : 0;
490
+ return {
491
+ top: e[t].scroll.y,
492
+ left: 0,
493
+ width: n.clientWidth,
494
+ height: n.clientHeight - o
495
+ };
907
496
  }
497
+ const M = {
498
+ scaleDown: { stiffness: 20, damping: 7 },
499
+ translate: { stiffness: 15, damping: 7 },
500
+ scaleUp: { stiffness: 20, damping: 7 }
501
+ }, D = {
502
+ scaleDown: 0,
503
+ translate: 0.2,
504
+ scaleUp: 0.8
505
+ }, Ut = 0.8, zt = "white", q = 1e3 / 60, Vt = 600;
908
506
  function Xt(e) {
909
- return P.has(e);
910
- }
911
- function Wt() {
912
- return P.size;
913
- }
914
- function Ht(e) {
915
- const i = P.get(e);
916
- return i ? (P.delete(e), i(), !0) : !1;
507
+ const { items: t, from: n, to: s, recordFrame: o } = e, a = q / 1e3, i = Math.abs(s - n), l = t.map((r) => ({
508
+ item: r,
509
+ integrator: new v({
510
+ stiffness: r.spring.stiffness,
511
+ damping: r.spring.damping
512
+ }),
513
+ state: { position: n, velocity: 0 },
514
+ started: !1,
515
+ settled: !1,
516
+ settleTime: 0
517
+ }));
518
+ for (let r = 0; r < l.length; r++)
519
+ (r === 0 || l[r].item.offset === 0) && (l[r].started = !0);
520
+ o(0);
521
+ let c = 0;
522
+ for (let r = 1; r <= Vt; r++) {
523
+ const p = r * q;
524
+ c = p;
525
+ for (const d of l)
526
+ !d.started || d.settled || (d.state = d.integrator.step(d.state, s, a), d.integrator.isSettled(d.state, s) ? (d.settleTime += a, d.settleTime >= ut && (d.state = { position: s, velocity: 0 }, d.settled = !0)) : d.settleTime = 0, d.item.tick(d.state.position));
527
+ for (let d = 1; d < l.length; d++) {
528
+ const h = l[d];
529
+ if (h.started) continue;
530
+ const u = l[d - 1];
531
+ if (!u.started) continue;
532
+ (i === 0 ? 1 : Math.abs(u.state.position - n) / i) >= h.item.offset && (h.started = !0);
533
+ }
534
+ if (o(p), l.every((d) => d.settled)) return p;
535
+ }
536
+ return c;
917
537
  }
918
- function Kt() {
919
- P.clear(), I == null || I.disconnect(), I = null, q = !1;
538
+ function H(e, t) {
539
+ return e != null && e.spring ? {
540
+ stiffness: e.spring.stiffness,
541
+ damping: e.spring.damping
542
+ } : t;
920
543
  }
921
- const O = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
922
- function Tt(e, i, t) {
923
- O.set(e, i);
924
- let n = N.get(e);
925
- if (n)
926
- return n;
927
- const r = i;
928
- return n = At(
929
- () => {
930
- const o = O.get(e);
931
- return o || (console.warn(`Transition "${String(e)}" not found`), {});
544
+ function j(e) {
545
+ const { rect: t, scale: n, direction: s, override: o } = e, a = s === "out" ? { scale: 1, translateY: -t.top } : { scale: n, translateY: -t.top + t.height }, i = H(o, M.scaleDown), l = H(o, M.translate), c = H(o, M.scaleUp), r = s === "out" ? 1 : 0, p = s === "out" ? 0 : 1, d = s === "out" ? [
546
+ {
547
+ spring: i,
548
+ offset: D.scaleDown,
549
+ tick: (f) => {
550
+ const m = 1 - f;
551
+ a.scale = 1 - (1 - n) * m;
552
+ }
553
+ },
554
+ {
555
+ spring: l,
556
+ offset: D.translate,
557
+ tick: (f) => {
558
+ const m = 1 - f;
559
+ a.translateY = -t.top - t.height * m;
560
+ }
932
561
  },
933
562
  {
934
- strategy: t == null ? void 0 : t.strategy,
935
- scope: t == null ? void 0 : t.scope,
936
- onCleanupEnd: () => {
937
- O.get(e) === r && bt(e);
563
+ spring: c,
564
+ offset: D.scaleUp,
565
+ tick: (f) => {
566
+ const m = 1 - f;
567
+ a.scale = n + (1 - n) * m;
938
568
  }
939
569
  }
940
- ), N.set(e, n), n;
941
- }
942
- function bt(e) {
943
- O.delete(e), N.delete(e), X.delete(e);
944
- }
945
- function Ut(e, i = "manual") {
946
- const t = Tt(
947
- e.key,
570
+ ] : [
948
571
  {
949
- in: e.in,
950
- out: e.out
572
+ spring: i,
573
+ offset: D.scaleDown,
574
+ tick: (f) => {
575
+ a.scale = 1 - (1 - n) * f;
576
+ }
951
577
  },
952
578
  {
953
- strategy: e[J],
954
- scope: e.scope
955
- }
956
- );
957
- if (i === "manual")
958
- return t;
959
- let n = X.get(e.key);
960
- return n || (n = (r) => {
961
- if (r) {
962
- const o = t(r);
963
- o && Et(r, o);
579
+ spring: l,
580
+ offset: D.translate,
581
+ tick: (f) => {
582
+ a.translateY = -t.top + t.height * (1 - f);
583
+ }
584
+ },
585
+ {
586
+ spring: c,
587
+ offset: D.scaleUp,
588
+ tick: (f) => {
589
+ a.scale = n + (1 - n) * f;
590
+ }
964
591
  }
965
- }, X.set(e.key, n), n);
966
- }
967
- function kt(e) {
968
- const i = e.filter((t) => t.symmetric).map((t) => ({
969
- from: t.to,
970
- to: t.from,
971
- transition: t.transition
972
- }));
973
- return [...e, ...i];
974
- }
975
- function V(e, i) {
976
- if (i === "*")
977
- return !0;
978
- if (i.endsWith("/*")) {
979
- const t = i.slice(0, -1);
980
- return e.startsWith(t) && e.length > t.length;
981
- }
982
- return e === i;
983
- }
984
- function Rt(e, i, t) {
985
- for (const n of t)
986
- if (V(e, n.from) && V(i, n.to))
987
- return n.transition;
988
- for (const n of t)
989
- if ((n.from === "*" || V(e, n.from)) && (n.to === "*" || V(i, n.to)))
990
- return n.transition;
991
- return null;
592
+ ], h = [], u = Xt({
593
+ items: d,
594
+ from: r,
595
+ to: p,
596
+ recordFrame: (f) => h.push({
597
+ time: f,
598
+ scale: a.scale,
599
+ translateY: a.translateY
600
+ })
601
+ });
602
+ return { snapshots: h, totalDuration: u };
992
603
  }
993
- const It = 768, Pt = 10, Mt = 10;
994
- function Vt(e = {}) {
995
- const { preserveScroll: i = (c) => c } = e, t = typeof i == "function" ? i : () => i;
996
- let n = null, r = !1, o = !1;
997
- const s = () => {
998
- const c = (n == null ? void 0 : n.clientWidth) ?? 0, g = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
999
- return g > 0 && g < It;
1000
- }, m = () => (o || (r = s(), o = !0), r), l = (c) => {
1001
- const g = t(m());
1002
- return g === !1 ? !1 : g === !0 ? !0 : !g.exclude.some((E) => V(c, E));
604
+ function Bt(e, t) {
605
+ if (e.length === 0) return { time: 0, scale: 1, translateY: 0 };
606
+ if (e.length === 1 || t <= 0) return e[0];
607
+ if (t >= 1) return e[e.length - 1];
608
+ const n = t * (e.length - 1), s = Math.floor(n), o = Math.ceil(n);
609
+ if (s === o) return e[s];
610
+ const a = e[s], i = e[o], l = n - s;
611
+ return {
612
+ time: a.time + (i.time - a.time) * l,
613
+ scale: a.scale + (i.scale - a.scale) * l,
614
+ translateY: a.translateY + (i.translateY - a.translateY) * l
1003
615
  };
1004
- let u = null;
1005
- const h = /* @__PURE__ */ new Map();
1006
- let v = null, A = !1, S = 0;
1007
- const y = () => {
1008
- n && v && !A && h.set(v, {
1009
- x: n.scrollLeft,
1010
- y: n.scrollTop
616
+ }
617
+ const Wt = [
618
+ [1, 1],
619
+ [-1, 1],
620
+ [1, -1],
621
+ [-1, -1]
622
+ ];
623
+ function Nt(e, t) {
624
+ const o = (a, i, l) => {
625
+ const c = document.createElement("div");
626
+ Object.assign(c.style, {
627
+ position: "fixed",
628
+ pointerEvents: "none",
629
+ zIndex: "9999",
630
+ width: "15px",
631
+ height: "15px",
632
+ ...a
1011
633
  });
1012
- }, p = (c) => {
1013
- if (!n) return;
1014
- const g = l(c) && h.has(c) ? h.get(c) : { x: 0, y: 0 };
1015
- let E = 0;
1016
- const b = () => {
1017
- if (!n) return;
1018
- n.scrollTo({
1019
- top: g.y,
1020
- left: g.x
1021
- }), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && E < Pt && (E++, requestAnimationFrame(b));
1022
- };
1023
- requestAnimationFrame(b);
634
+ const r = document.createElement("div");
635
+ Object.assign(r.style, {
636
+ position: "absolute",
637
+ width: "15px",
638
+ height: "1px",
639
+ backgroundColor: e,
640
+ [l]: "0",
641
+ [i]: "0"
642
+ });
643
+ const p = document.createElement("div");
644
+ return Object.assign(p.style, {
645
+ position: "absolute",
646
+ width: "1px",
647
+ height: "15px",
648
+ backgroundColor: e,
649
+ [l]: "0",
650
+ [i]: "0"
651
+ }), c.appendChild(r), c.appendChild(p), c;
1024
652
  };
1025
653
  return {
1026
- initializeContext: (c, g) => {
1027
- A = !0;
1028
- const E = ++S;
1029
- u = c, n || (n = vt(c), r = s(), o = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
1030
- r = s();
1031
- }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", y, {
1032
- passive: !0
1033
- })), v = g, p(g);
1034
- let b = 0;
1035
- const R = () => {
1036
- E === S && (b++, b >= Mt ? A = !1 : requestAnimationFrame(R));
1037
- };
1038
- requestAnimationFrame(R);
1039
- },
1040
- calculateScrollOffset: (c, g) => {
1041
- const E = c && h.has(c) ? h.get(c) : { x: 0, y: 0 }, b = g && l(g) && h.has(g) ? h.get(g) : { x: 0, y: 0 };
1042
- return {
1043
- x: -b.x + E.x,
1044
- y: -b.y + E.y
1045
- };
1046
- },
1047
- evictScrollPosition: (c) => {
1048
- h.delete(c);
1049
- },
1050
- shouldPreserve: l,
1051
- getScrollContainer: () => n,
1052
- getPositionedParentElement: () => u ? St(u) : document.body,
1053
- getScrollPosition: (c) => c && h.has(c) ? h.get(c) : { x: 0, y: 0 }
654
+ topLeft: o(
655
+ {
656
+ top: `${t.top - 1}px`,
657
+ left: `${t.left - 1}px`
658
+ },
659
+ "left",
660
+ "top"
661
+ ),
662
+ topRight: o(
663
+ {
664
+ top: `${t.top - 1}px`,
665
+ left: `${t.left + t.width - 15 + 1}px`
666
+ },
667
+ "right",
668
+ "top"
669
+ ),
670
+ bottomLeft: o(
671
+ {
672
+ top: `${t.top + t.height - 15 + 1}px`,
673
+ left: `${t.left - 1}px`
674
+ },
675
+ "left",
676
+ "bottom"
677
+ ),
678
+ bottomRight: o(
679
+ {
680
+ top: `${t.top + t.height - 15 + 1}px`,
681
+ left: `${t.left + t.width - 15 + 1}px`
682
+ },
683
+ "right",
684
+ "bottom"
685
+ )
1054
686
  };
1055
687
  }
1056
- const j = 30, B = 8, Y = 1.2, G = 30, xt = 600;
1057
- function Ft() {
1058
- let e = null, i = !1, t = !1, n = null, r = null, o = !1;
1059
- const s = (w, f) => {
1060
- for (let a = 0; a < w.length; a++) {
1061
- const C = w.item(a);
1062
- if (C && C.identifier === f) return C;
1063
- }
1064
- return null;
1065
- }, m = () => {
1066
- n !== null && (clearTimeout(n), n = null);
1067
- }, l = () => {
1068
- r !== null && (clearTimeout(r), r = null);
1069
- }, u = () => {
1070
- i = !0, t = !0, m(), l(), n = setTimeout(() => {
1071
- i = !1, t = !1, n = null;
1072
- }, xt);
1073
- }, h = (w) => {
1074
- if (w.touches.length !== 1) {
1075
- e = null;
1076
- return;
1077
- }
1078
- const f = w.touches.item(0);
1079
- if (!f) {
1080
- e = null;
1081
- return;
1082
- }
1083
- const a = window.innerWidth, C = f.clientX <= j, c = f.clientX >= a - j;
1084
- if (!C && !c) {
1085
- e = null;
1086
- return;
688
+ function G(e, t) {
689
+ const n = t.left + t.width / 2, s = t.top + t.height / 2;
690
+ e.style.transformOrigin = `${n}px ${s}px`;
691
+ }
692
+ function K(e, t) {
693
+ e.style.clipPath = `polygon(
694
+ ${t.left}px ${t.top}px,
695
+ ${t.left + t.width}px ${t.top}px,
696
+ ${t.left + t.width}px ${t.top + t.height}px,
697
+ ${t.left}px ${t.top + t.height}px
698
+ )`;
699
+ }
700
+ function U(e, t, n, s, o) {
701
+ const a = n / 1e3;
702
+ return new w({
703
+ element: e,
704
+ integrator: new $t({ durationSec: a }),
705
+ lowerBound: 0,
706
+ upperBound: 1,
707
+ style: (i) => s(Bt(t, i)),
708
+ onComplete: o
709
+ });
710
+ }
711
+ const Zt = (e = {}) => {
712
+ var o;
713
+ const t = ((o = e.border) == null ? void 0 : o.color) ?? zt, n = Ut, s = e.physics;
714
+ return {
715
+ prepare: ({ from: a, to: i, context: l }) => {
716
+ const c = T(l, "from"), r = T(l, "to"), p = O(document.body, l.positionedParent), d = Nt(t, {
717
+ ...c,
718
+ top: p.top
719
+ });
720
+ for (const h of [
721
+ "topLeft",
722
+ "topRight",
723
+ "bottomLeft",
724
+ "bottomRight"
725
+ ])
726
+ l.positionedParent.appendChild(d[h]);
727
+ return a.then((h) => {
728
+ G(h, c), K(h, c), h.style.transform = `translateY(${-c.top}px)`;
729
+ }), i.then((h) => {
730
+ G(h, r), K(h, r), h.style.transform = `translateY(${-r.top + r.height}px) scale(${n})`;
731
+ }), { borders: d, fromRect: c, toRect: r };
732
+ },
733
+ animation: ({ from: a, to: i, context: l, borders: c, fromRect: r, toRect: p }) => {
734
+ const d = j({
735
+ rect: r,
736
+ scale: n,
737
+ direction: "out",
738
+ override: s
739
+ }), h = j({
740
+ rect: p,
741
+ scale: n,
742
+ direction: "in",
743
+ override: s
744
+ }), u = U(
745
+ a,
746
+ d.snapshots,
747
+ d.totalDuration,
748
+ (b) => ({
749
+ transform: `translateY(${b.translateY}px) scale(${b.scale})`
750
+ }),
751
+ () => {
752
+ a.style.clipPath = "", a.style.transformOrigin = "";
753
+ }
754
+ ), f = U(
755
+ i,
756
+ h.snapshots,
757
+ h.totalDuration,
758
+ (b) => ({
759
+ transform: `translateY(${b.translateY}px) scale(${b.scale})`
760
+ }),
761
+ () => {
762
+ i.style.clipPath = "", i.style.transformOrigin = "", i.style.transform = "";
763
+ }
764
+ ), m = Wt.map(([b, C], E) => {
765
+ const L = ["topLeft", "topRight", "bottomLeft", "bottomRight"][E];
766
+ return U(
767
+ c[L],
768
+ d.snapshots,
769
+ d.totalDuration,
770
+ (A) => {
771
+ const Y = (r.width - r.width * A.scale) / 2 * 0.7 * b, F = (r.height - r.height * A.scale) / 2 * 0.7 * C;
772
+ return { transform: `translate(${Y}px, ${F}px)` };
773
+ }
774
+ );
775
+ }), y = new $([u, f, ...m], {
776
+ mode: "parallel"
777
+ }), x = y.onComplete;
778
+ return y.onComplete = () => {
779
+ x == null || x();
780
+ const b = l.positionedParent;
781
+ for (const C of [
782
+ "topLeft",
783
+ "topRight",
784
+ "bottomLeft",
785
+ "bottomRight"
786
+ ]) {
787
+ const E = c[C];
788
+ E.parentElement === b && b.removeChild(E);
789
+ }
790
+ }, y;
1087
791
  }
1088
- e = {
1089
- identifier: f.identifier,
1090
- startX: f.clientX,
1091
- startY: f.clientY,
1092
- fromLeftEdge: C,
1093
- moved: !1
1094
- };
1095
- }, v = (w) => {
1096
- if (!e) return;
1097
- if (w.touches.length !== 1) {
1098
- e = null;
1099
- return;
792
+ };
793
+ };
794
+ function _e({ paths: e }) {
795
+ return P(e, () => Zt());
796
+ }
797
+ const qt = {
798
+ spring: { stiffness: 300, damping: 30 }
799
+ };
800
+ function jt(e, t) {
801
+ return e.querySelector(`[data-hero-key="${t}"]`);
802
+ }
803
+ const Gt = (e = {}) => {
804
+ const t = e.physics ?? qt, n = e.maxDistance ?? 700;
805
+ return {
806
+ prepare: ({ from: s }) => (s.then((o) => {
807
+ o.style.opacity = "0";
808
+ }), {}),
809
+ animation: ({ from: s, to: o, context: a }) => {
810
+ const i = s, l = o, c = Array.from(
811
+ l.querySelectorAll("[data-hero-key]")
812
+ ), r = [];
813
+ for (const f of c) {
814
+ const m = f.getAttribute("data-hero-key");
815
+ if (!m) continue;
816
+ const y = jt(i, m);
817
+ y && r.push({ key: m, fromEl: y, toEl: f });
818
+ }
819
+ if (r.length === 0)
820
+ return new $([], { mode: "parallel" });
821
+ const p = [], d = [];
822
+ for (const { fromEl: f, toEl: m } of r) {
823
+ const y = O(i, f), x = O(l, m), b = y.left - x.left - a.scrollOffset.x, C = y.top - x.top - a.scrollOffset.y, E = y.width / x.width, L = y.height / x.height;
824
+ if (Math.abs(C) > n) continue;
825
+ const A = m.style.transform, Y = m.style.position, F = m.style.transformOrigin, at = m.style.zIndex, lt = m.style.willChange;
826
+ m.style.position = "relative", m.style.transformOrigin = "top left", m.style.zIndex = "1000", m.style.willChange = "transform", p.push(
827
+ new w({
828
+ element: m,
829
+ integrator: g.from(t),
830
+ style: (W, _) => {
831
+ const ct = _ * b, pt = _ * C, dt = W + _ * E, ft = W + _ * L;
832
+ return {
833
+ transform: `translate(${ct}px, ${pt}px) scale(${dt}, ${ft})`
834
+ };
835
+ }
836
+ })
837
+ ), d.push(() => {
838
+ m.style.transform = A, m.style.position = Y, m.style.transformOrigin = F, m.style.zIndex = at, m.style.willChange = lt;
839
+ });
840
+ }
841
+ const h = new $(p, {
842
+ mode: "parallel"
843
+ }), u = h.onComplete;
844
+ return h.onComplete = () => {
845
+ for (const f of d) f();
846
+ u == null || u();
847
+ }, h;
1100
848
  }
1101
- const f = s(w.touches, e.identifier);
1102
- if (!f) {
1103
- e = null;
1104
- return;
849
+ };
850
+ };
851
+ function ke({ paths: e }) {
852
+ return P(e, () => Gt());
853
+ }
854
+ const Kt = {
855
+ spring: { stiffness: 50, damping: 30 }
856
+ }, Jt = {
857
+ spring: { stiffness: 80, damping: 25 }
858
+ }, Qt = (e = {}) => {
859
+ const t = e.physics ?? Kt, n = e.initialRotation ?? 45, s = e.initialScale ?? 0.01, o = e.rotationTriggerPoint ?? 0.8;
860
+ return {
861
+ prepare: ({ from: a, to: i, context: l }) => (a.then((c) => {
862
+ c.style.opacity = "1";
863
+ }), i.then((c) => {
864
+ const r = T(l, "to"), p = Math.min(r.width, r.height) * 0.4;
865
+ c.style.setProperty("--max-border-radius", `${p}px`), c.style.setProperty("--border-radius-scale", "1"), c.style.willChange = "transform", c.style.backfaceVisibility = "hidden";
866
+ const d = r.left + r.width / 2, h = r.top + r.height / 2;
867
+ c.style.transformOrigin = `${d}px ${h}px`, c.style.position = "fixed", c.style.top = `${r.top}px`, c.style.left = `${r.left}px`, c.style.width = `${r.width}px`, c.style.height = `${r.height}px`, c.style.zIndex = "1000", c.style.overflow = "hidden", c.style.transform = `rotate(${n}deg) scale(${s}) translateZ(0)`, c.style.borderRadius = "calc(var(--max-border-radius) * var(--border-radius-scale))", c.style.opacity = "1";
868
+ }), {}),
869
+ animation: ({ from: a, to: i }) => {
870
+ const l = new w({
871
+ element: a,
872
+ integrator: g.from(Jt),
873
+ style: (r, p) => ({ opacity: p })
874
+ }), c = new w({
875
+ element: i,
876
+ integrator: g.from(t),
877
+ style: (r) => {
878
+ let p;
879
+ if (r <= 0.05)
880
+ p = s;
881
+ else if (r <= o) {
882
+ const f = (r - 0.05) / (o - 0.05), m = Math.pow(f, 9);
883
+ p = s + (0.8 - s) * m;
884
+ } else {
885
+ const f = (r - o) / (1 - o);
886
+ p = 0.8 + 0.2 * (1 - Math.pow(1 - f, 3));
887
+ }
888
+ const d = 0.7;
889
+ let h;
890
+ if (r <= d)
891
+ h = n;
892
+ else {
893
+ const f = (r - d) / (1 - d), m = 1 - Math.pow(1 - f, 2);
894
+ h = n * (1 - m);
895
+ }
896
+ let u;
897
+ if (r <= d)
898
+ u = 1;
899
+ else {
900
+ const f = (r - d) / (1 - d);
901
+ u = 1 - Math.pow(f, 0.5);
902
+ }
903
+ return {
904
+ transform: `rotate(${h.toFixed(2)}deg) scale(${p.toFixed(4)}) translateZ(0)`,
905
+ "--border-radius-scale": u.toFixed(4)
906
+ };
907
+ },
908
+ onComplete: () => {
909
+ i.style.willChange = "", i.style.backfaceVisibility = "", i.style.removeProperty("--max-border-radius"), i.style.removeProperty("--border-radius-scale"), i.style.transform = "", i.style.transformOrigin = "", i.style.position = "", i.style.zIndex = "", i.style.top = "", i.style.left = "", i.style.width = "", i.style.height = "", i.style.overflow = "", i.style.borderRadius = "";
910
+ }
911
+ });
912
+ return new $([l, c], { mode: "parallel" });
1105
913
  }
1106
- const a = f.clientX - e.startX, C = f.clientY - e.startY, c = Math.abs(a), g = Math.abs(C);
1107
- if (g > B && g > c * Y) {
1108
- e = null;
1109
- return;
914
+ };
915
+ };
916
+ function ve({ paths: e }) {
917
+ return P(e, () => Qt());
918
+ }
919
+ const Rt = {
920
+ spring: { stiffness: 100, damping: 30 }
921
+ }, te = (e = {}) => {
922
+ const t = e.physics ?? Rt;
923
+ return {
924
+ prepare: ({ from: n, to: s }) => (n.then((o) => {
925
+ o.style.transformOrigin = "center center", o.style.willChange = "transform, opacity";
926
+ }), s.then((o) => {
927
+ o.style.opacity = "0", o.style.transform = "rotate(-180deg)", o.style.transformOrigin = "center center", o.style.willChange = "transform, opacity";
928
+ }), {}),
929
+ animation: ({ from: n, to: s }) => {
930
+ const o = new w({
931
+ element: n,
932
+ integrator: g.from(t),
933
+ style: (i) => ({
934
+ transform: `rotate(${i * 180}deg)`,
935
+ opacity: i < 0.5 ? 1 : 0
936
+ })
937
+ }), a = new w({
938
+ element: s,
939
+ integrator: g.from(t),
940
+ // u runs 1→0, so -u*180 unwinds -180→0.
941
+ style: (i, l) => ({
942
+ transform: `rotate(${-l * 180}deg)`,
943
+ opacity: i > 0.5 ? 1 : 0
944
+ }),
945
+ onComplete: () => {
946
+ s.style.willChange = "auto", s.style.transform = "", s.style.transformOrigin = "", s.style.opacity = "";
947
+ }
948
+ });
949
+ return new $([o, a], { mode: "parallel" });
1110
950
  }
1111
- const E = e.fromLeftEdge ? a > 0 : a < 0;
1112
- c > B && c > g * Y && E && (e.moved = !0);
1113
- }, A = (w) => {
1114
- if (!e) return;
1115
- const f = s(w.changedTouches, e.identifier);
1116
- if (!f) {
1117
- e = null;
1118
- return;
951
+ };
952
+ };
953
+ function Le({ paths: e }) {
954
+ return P(e, () => te());
955
+ }
956
+ const ee = {
957
+ spring: {
958
+ stiffness: 20,
959
+ damping: 8,
960
+ doubleSpring: 1,
961
+ restDelta: 1e-3,
962
+ restSpeed: 1e-3
963
+ }
964
+ }, J = (e = {}) => {
965
+ const t = e.direction ?? "up", n = e.physics ?? ee, s = t === "up";
966
+ return {
967
+ prepare: ({ from: o, to: a }) => (o.then((i) => {
968
+ i.style.zIndex = s ? "-1" : "1", i.style.willChange = "transform", i.style.backfaceVisibility = "hidden", i.style.contain = "layout paint", i.style.pointerEvents = "none";
969
+ }), a.then((i) => {
970
+ i.style.willChange = "transform", i.style.backfaceVisibility = "hidden", i.style.contain = "layout paint";
971
+ }), {}),
972
+ animation: ({ from: o, to: a }) => {
973
+ const i = o.offsetHeight, l = a.offsetHeight, c = window.innerHeight, r = Math.max(Math.min(i, l), c), p = new w({
974
+ element: o,
975
+ integrator: g.from(n),
976
+ style: (h) => ({ transform: `translate3d(0, ${s ? -r * h : r * h}px, 0)` })
977
+ }), d = new w({
978
+ element: a,
979
+ integrator: g.from(n),
980
+ style: (h, u) => ({ transform: `translate3d(0, ${s ? u * r : u * -r}px, 0)` }),
981
+ onComplete: () => {
982
+ a.style.willChange = "auto", a.style.backfaceVisibility = "", a.style.contain = "", a.style.transform = "";
983
+ }
984
+ });
985
+ return new $([p, d], { mode: "parallel" });
1119
986
  }
1120
- const a = f.clientX - e.startX, C = e.fromLeftEdge ? a > 0 : a < 0;
1121
- if (e.moved && C && Math.abs(a) >= G) {
1122
- u(), e = null;
1123
- return;
987
+ };
988
+ };
989
+ function Ye({
990
+ paths: e,
991
+ type: t = "directional",
992
+ direction: n = "up"
993
+ }) {
994
+ return t === "non-directional" ? P(
995
+ e,
996
+ () => J({ direction: n })
997
+ ) : ot(
998
+ e,
999
+ { forward: "up", backward: "down" },
1000
+ (s) => J({ direction: s })
1001
+ );
1002
+ }
1003
+ const ne = {
1004
+ spring: { stiffness: 200, damping: 24 }
1005
+ }, se = {
1006
+ inertia: { acceleration: 25, resistance: 1.2 }
1007
+ }, z = 0.2;
1008
+ function oe() {
1009
+ return {
1010
+ enterPhysics: ne,
1011
+ exitPhysics: se,
1012
+ background: {
1013
+ willChange: "transform, opacity",
1014
+ enterStyle: (e, t) => ({
1015
+ transform: `scale(${1 - z * e})`,
1016
+ opacity: t
1017
+ }),
1018
+ exitStyle: (e) => ({
1019
+ transform: `scale(${1 - z + z * e})`,
1020
+ opacity: e
1021
+ })
1124
1022
  }
1125
- e.moved && Math.abs(a) >= G && u(), e = null;
1126
- }, S = () => {
1127
- e && (e.moved && u(), e = null);
1128
1023
  };
1129
- return { initialize: () => {
1130
- if (typeof window > "u" || o) return;
1131
- o = !0;
1132
- const w = { passive: !0, capture: !0 };
1133
- window.addEventListener("touchstart", h, w), window.addEventListener("touchmove", v, w), window.addEventListener("touchend", A, w), window.addEventListener("touchcancel", S, w);
1134
- }, destroy: () => {
1135
- if (typeof window > "u" || !o) return;
1136
- o = !1;
1137
- const w = { capture: !0 };
1138
- window.removeEventListener("touchstart", h, w), window.removeEventListener("touchmove", v, w), window.removeEventListener("touchend", A, w), window.removeEventListener("touchcancel", S, w), m(), l(), e = null, i = !1, t = !1;
1139
- }, isSwipeBack: () => {
1140
- const w = i || t;
1141
- return w && m(), w;
1142
- }, onPageEnter: () => {
1143
- i = !1, m(), l(), r = setTimeout(() => {
1144
- t = !1, r = null;
1145
- }, 0);
1146
- } };
1147
1024
  }
1148
- function Lt() {
1149
- let e = null;
1150
- function i() {
1151
- if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
1152
- const t = { from: e.from, to: e.to };
1153
- e.outResolve(t), e.inResolve(t), e = null;
1025
+ const ie = {
1026
+ spring: { stiffness: 200, damping: 24 }
1027
+ }, re = {
1028
+ inertia: { acceleration: 25, resistance: 1.2 }
1029
+ };
1030
+ function ae() {
1031
+ return {
1032
+ enterPhysics: ie,
1033
+ exitPhysics: re,
1034
+ background: {
1035
+ willChange: "",
1036
+ enterStyle: () => ({}),
1037
+ exitStyle: () => ({})
1154
1038
  }
1155
- }
1039
+ };
1040
+ }
1041
+ const le = {
1042
+ static: ae(),
1043
+ "background-scale": oe()
1044
+ }, ce = "static", pe = "transform", de = (e = {}) => {
1045
+ const t = e.direction ?? "enter", n = le[e.type ?? ce], s = t === "enter" ? n.enterPhysics : n.exitPhysics, o = n.background, a = o.willChange !== "";
1156
1046
  return {
1157
- trigger(t, n) {
1158
- e || (e = {}), n === "out" ? e.from = t : e.to = t;
1047
+ prepare: ({ from: i, to: l }) => {
1048
+ const c = t === "enter" ? l : i, r = t === "enter" ? i : l;
1049
+ return c.then((p) => {
1050
+ p.style.willChange = pe, p.style.backfaceVisibility = "hidden", p.style.contain = "layout paint", t === "exit" && (p.style.pointerEvents = "none", p.style.zIndex = "100");
1051
+ }), r.then((p) => {
1052
+ a && (p.style.willChange = o.willChange, p.style.backfaceVisibility = "hidden", p.style.contain = "layout paint"), t === "enter" && (p.style.pointerEvents = "none", p.style.zIndex = "-1");
1053
+ }), {};
1159
1054
  },
1160
- get(t) {
1161
- return t === "in" && (!e || !e.from) ? Promise.resolve(null) : new Promise((n) => {
1162
- e || (e = {}), t === "out" ? e.outResolve = n : e.inResolve = n, i();
1055
+ animation: ({ from: i, to: l, context: c }) => {
1056
+ const r = t === "enter" ? l : i, p = t === "enter" ? i : l, d = T(
1057
+ c,
1058
+ t === "enter" ? "to" : "from"
1059
+ );
1060
+ r.style.clipPath = `inset(${d.top}px 0 calc(100% - ${d.top + d.height}px) 0)`;
1061
+ const h = t === "enter" ? (C, E) => ({
1062
+ transform: `translate3d(0, ${E * d.height}px, 0)`
1063
+ }) : (C) => ({
1064
+ transform: `translate3d(0, ${C * d.height}px, 0)`
1065
+ }), u = new w({
1066
+ element: r,
1067
+ integrator: g.from(s),
1068
+ style: h,
1069
+ onComplete: () => {
1070
+ r.style.willChange = "auto", r.style.backfaceVisibility = "", r.style.contain = "", r.style.clipPath = "", r.style.transform = "";
1071
+ }
1163
1072
  });
1073
+ if (!a)
1074
+ return new $([u], { mode: "parallel" });
1075
+ const f = T(
1076
+ c,
1077
+ t === "enter" ? "from" : "to"
1078
+ ), m = f.left + f.width / 2, y = f.top + f.height / 2;
1079
+ p.style.clipPath = `inset(${f.top}px 0 calc(100% - ${f.top + f.height}px) 0)`, p.style.transformOrigin = `${m}px ${y}px`;
1080
+ const x = t === "enter" ? (C, E) => o.enterStyle(C, E) : (C) => o.exitStyle(C), b = new w({
1081
+ element: p,
1082
+ integrator: g.from(s),
1083
+ style: x,
1084
+ onComplete: t === "exit" ? () => {
1085
+ p.style.willChange = "auto", p.style.backfaceVisibility = "", p.style.contain = "", p.style.clipPath = "", p.style.transformOrigin = "";
1086
+ } : void 0
1087
+ });
1088
+ return new $([u, b], { mode: "parallel" });
1164
1089
  }
1165
1090
  };
1091
+ };
1092
+ function Fe({ type: e, ...t }) {
1093
+ return st(
1094
+ t,
1095
+ (n) => de({ direction: n, type: e })
1096
+ );
1166
1097
  }
1167
- function Ot() {
1168
- let e = null;
1169
- function i() {
1170
- var n, r;
1171
- e && ((n = e.outResolve) == null || n.call(e, null), (r = e.inResolve) == null || r.call(e, null), e = null);
1172
- }
1173
- function t() {
1174
- if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
1175
- if (e.from === e.to) {
1176
- i();
1177
- return;
1178
- }
1179
- const n = { from: e.from, to: e.to };
1180
- e.outResolve(n), e.inResolve(n), e = null;
1181
- }
1182
- }
1098
+ const fe = {
1099
+ spring: { stiffness: 170, damping: 22, doubleSpring: 0.8 }
1100
+ }, he = (e = {}) => {
1101
+ const t = e.direction ?? "left", n = e.physics ?? fe, s = t === "left";
1183
1102
  return {
1184
- trigger(n, r) {
1185
- e && (r === "out" && e.from && e.from !== n || r === "in" && e.to && e.to !== n) && i(), e || (e = {}), r === "out" ? e.from = n : e.to = n;
1186
- },
1187
- get(n) {
1188
- return new Promise((r) => {
1189
- e || (e = {}), n === "out" ? e.outResolve = r : e.inResolve = r, t();
1103
+ prepare: ({ from: o, to: a }) => (o.then((i) => {
1104
+ i.style.willChange = "transform", i.style.backfaceVisibility = "hidden", i.style.contain = "layout paint", i.style.pointerEvents = "none";
1105
+ }), a.then((i) => {
1106
+ const l = s ? 100 : -100;
1107
+ i.style.transform = `translate3d(${l}%, 0, 0)`, i.style.willChange = "transform", i.style.backfaceVisibility = "hidden", i.style.contain = "layout paint";
1108
+ }), {}),
1109
+ animation: ({ from: o, to: a }) => {
1110
+ const i = new w({
1111
+ element: o,
1112
+ integrator: g.from(n),
1113
+ style: (c) => ({ transform: `translate3d(${s ? -100 * c : 100 * c}%, 0, 0)` })
1114
+ }), l = new w({
1115
+ element: a,
1116
+ integrator: g.from(n),
1117
+ style: (c, r) => ({ transform: `translate3d(${s ? r * 100 : r * -100}%, 0, 0)` }),
1118
+ onComplete: () => {
1119
+ a.style.willChange = "auto", a.style.backfaceVisibility = "", a.style.contain = "", a.style.transform = "";
1120
+ }
1190
1121
  });
1122
+ return new $([i, l], { mode: "parallel" });
1191
1123
  }
1192
1124
  };
1125
+ };
1126
+ function Me({ paths: e }) {
1127
+ return ot(
1128
+ e,
1129
+ { forward: "left", backward: "right" },
1130
+ (t) => he({ direction: t })
1131
+ );
1193
1132
  }
1194
- function jt(e, i) {
1195
- const {
1196
- transitions: t = [],
1197
- defaultTransition: n,
1198
- middleware: r = (f, a) => ({ from: f, to: a }),
1199
- // Identity function as default
1200
- preserveScroll: o = (f) => f
1201
- } = e, { outFirst: s = !0 } = i || {}, m = s ? Lt() : Ot(), l = kt(t), u = Ft();
1202
- u.initialize();
1203
- const {
1204
- initializeContext: h,
1205
- calculateScrollOffset: v,
1206
- evictScrollPosition: A,
1207
- shouldPreserve: S,
1208
- getScrollContainer: y,
1209
- getPositionedParentElement: p,
1210
- getScrollPosition: k
1211
- } = Vt({
1212
- preserveScroll: o
1213
- }), T = async (f, a) => {
1214
- const C = u.isSwipeBack();
1215
- m.trigger(f, a);
1216
- const c = await m.get(a);
1217
- if (a === "in" && u.onPageEnter(), !c) return () => ({});
1218
- if (C)
1219
- return a === "out" && c.from && !S(c.from) && A(c.from), () => ({});
1220
- const { from: g, to: E } = r(
1221
- c.from,
1222
- c.to
1223
- ), R = Rt(
1224
- g,
1225
- E,
1226
- l
1227
- ) || n;
1228
- if (!R) return () => ({});
1229
- const M = v(c.from, c.to);
1230
- if (a === "out") {
1231
- const x = {
1232
- scrollOffset: M,
1233
- scroll: k(c.from),
1234
- get scrollingElement() {
1235
- return y() || document.documentElement;
1236
- },
1237
- get positionedParent() {
1238
- return p();
1133
+ const me = {
1134
+ spring: { stiffness: 17, damping: 6 }
1135
+ }, V = 20, k = 800, ue = (e = {}) => {
1136
+ const t = e.physics ?? me;
1137
+ return {
1138
+ prepare: ({ from: n, to: s }) => (n.then((o) => {
1139
+ o.style.willChange = "transform", o.style.backfaceVisibility = "hidden", o.style.contain = "layout paint", o.style.pointerEvents = "none", o.style.transform = `perspective(${k}px) rotateY(0deg) translate3d(0%, 0, 0)`;
1140
+ }), s.then((o) => {
1141
+ o.style.willChange = "transform", o.style.backfaceVisibility = "hidden", o.style.contain = "layout paint", o.style.transform = `perspective(${k}px) rotateY(${V}deg) translate3d(-100%, 0, 0)`;
1142
+ }), {}),
1143
+ animation: ({ from: n, to: s }) => {
1144
+ const o = new w({
1145
+ element: n,
1146
+ integrator: g.from(t),
1147
+ style: (i) => {
1148
+ const l = -i * V, c = i * 100;
1149
+ return {
1150
+ transform: `perspective(${k}px) rotateY(${l}deg) translate3d(${c}%, 0, 0)`
1151
+ };
1239
1152
  }
1240
- };
1241
- return c.from && !S(c.from) && A(c.from), (_) => R.out(_, x);
1242
- } else {
1243
- const x = {
1244
- scrollOffset: M,
1245
- get scroll() {
1246
- return k(c.to);
1153
+ }), a = new w({
1154
+ element: s,
1155
+ integrator: g.from(t),
1156
+ style: (i, l) => {
1157
+ const c = l * V, r = -l * 100;
1158
+ return {
1159
+ transform: `perspective(${k}px) rotateY(${c}deg) translate3d(${r}%, 0, 0)`
1160
+ };
1247
1161
  },
1248
- get scrollingElement() {
1249
- return y() || document.documentElement;
1250
- },
1251
- get positionedParent() {
1252
- return p();
1162
+ onComplete: () => {
1163
+ s.style.transform = "", s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "";
1253
1164
  }
1165
+ });
1166
+ return new $([o, a], { mode: "sequence" });
1167
+ }
1168
+ };
1169
+ };
1170
+ function He({ paths: e }) {
1171
+ return P(e, () => ue());
1172
+ }
1173
+ function it({
1174
+ enterRect: e,
1175
+ exitRect: t,
1176
+ pageRect: n,
1177
+ scrollOffset: s
1178
+ }) {
1179
+ const o = t.left - e.left + (t.width - e.width) / 2 - s.x, a = t.top - e.top + (t.height - e.height) / 2 - s.y, i = t.width / e.width, l = t.height / e.height, c = Math.max(i, l), r = e.top / n.height * 100, p = (n.width - (e.left + e.width)) / n.width * 100, d = (n.height - (e.top + e.height)) / n.height * 100, h = e.left / n.width * 100;
1180
+ return {
1181
+ transformOrigin: `${e.left + e.width / 2}px ${e.top + e.height / 2}px`,
1182
+ animate: (u) => {
1183
+ const f = 1 - u;
1184
+ return {
1185
+ clipPath: `inset(${r * f}% ${p * f}% ${d * f}% ${h * f}%)`,
1186
+ transform: `translate(${o * f}px, ${a * f}px) scale(${1 + (c - 1) * f})`
1254
1187
  };
1255
- return (_) => R.in(_, x);
1256
1188
  }
1257
1189
  };
1258
- return (f) => ({
1259
- key: f,
1260
- in: async (a) => (h(a, f), (await T(f, "in"))(a)),
1261
- out: async (a) => (await T(f, "out"))(a),
1262
- // Add page transition strategy for page-level transitions
1263
- [J]: yt
1264
- });
1190
+ }
1191
+ function rt({
1192
+ enterRect: e,
1193
+ exitRect: t,
1194
+ pageRect: n,
1195
+ scrollOffset: s
1196
+ }) {
1197
+ const o = t.left - e.left + (t.width - e.width) / 2 + s.x, a = t.top - e.top + (t.height - e.height) / 2 + s.y, i = t.width / e.width, l = t.height / e.height, c = Math.min(i, l), r = e.top / n.height * 100, p = (n.width - (e.left + e.width)) / n.width * 100, d = (n.height - (e.top + e.height)) / n.height * 100, h = e.left / n.width * 100;
1198
+ return {
1199
+ transformOrigin: `${e.left + e.width / 2}px ${e.top + e.height / 2}px`,
1200
+ animate: (u) => {
1201
+ const f = 1 - u;
1202
+ return {
1203
+ clipPath: `inset(${r * f}% ${p * f}% ${d * f}% ${h * f}%)`,
1204
+ transform: `translate(${o * f - s.x}px, ${a * f}px) scale(${1 + (c - 1) * f})`
1205
+ };
1206
+ }
1207
+ };
1208
+ }
1209
+ const ye = {
1210
+ spring: { stiffness: 340, damping: 30, doubleSpring: 1 }
1211
+ };
1212
+ function ge({
1213
+ enterRect: e,
1214
+ exitRect: t,
1215
+ scrollOffset: n
1216
+ }) {
1217
+ const s = e.left - t.left + (e.width - t.width) / 2 + n.x, o = e.top - t.top + (e.height - t.height) / 2 + n.y, a = e.width / t.width, i = e.height / t.height, l = Math.max(a, i);
1218
+ return {
1219
+ transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
1220
+ animate: (c) => {
1221
+ const r = 1 - c;
1222
+ return {
1223
+ transform: `translate(${s * r - n.x}px, ${o * r}px) scale(${1 + (l - 1) * r})`,
1224
+ opacity: `${1 - r}`
1225
+ };
1226
+ }
1227
+ };
1228
+ }
1229
+ function we({
1230
+ enterRect: e,
1231
+ exitRect: t,
1232
+ scrollOffset: n
1233
+ }) {
1234
+ const s = e.left - t.left + (e.width - t.width) / 2 - n.x, o = e.top - t.top + (e.height - t.height) / 2 - n.y, a = e.width / t.width, i = e.height / t.height, l = Math.max(a, i);
1235
+ return {
1236
+ transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
1237
+ animate: (c) => {
1238
+ const r = 1 - c;
1239
+ return {
1240
+ transform: `translate(${s * r}px, ${o * r}px) scale(${1 + (l - 1) * r})`,
1241
+ opacity: `${c}`
1242
+ };
1243
+ }
1244
+ };
1245
+ }
1246
+ function be() {
1247
+ return {
1248
+ physics: ye,
1249
+ in: it,
1250
+ out: rt,
1251
+ backgroundIn: we,
1252
+ backgroundOut: ge
1253
+ };
1254
+ }
1255
+ const Se = {
1256
+ spring: { stiffness: 420, damping: 34 }
1257
+ };
1258
+ function Q() {
1259
+ return {
1260
+ transformOrigin: "",
1261
+ animate: () => ({})
1262
+ };
1263
+ }
1264
+ function $e() {
1265
+ return {
1266
+ physics: Se,
1267
+ in: it,
1268
+ out: rt,
1269
+ backgroundIn: () => Q(),
1270
+ backgroundOut: () => Q()
1271
+ };
1272
+ }
1273
+ const xe = {
1274
+ expand: be(),
1275
+ static: $e()
1276
+ }, X = "data-zoom-enter-key", R = "data-zoom-exit-key";
1277
+ function tt(e) {
1278
+ const t = e.querySelectorAll(`[${X}]`);
1279
+ return t.length !== 1 ? null : t[0];
1280
+ }
1281
+ function et(e, t) {
1282
+ const n = e.querySelectorAll(`[${R}]`);
1283
+ for (const s of n)
1284
+ if (s.getAttribute(R) === t)
1285
+ return s;
1286
+ return null;
1287
+ }
1288
+ function Ce(e, t) {
1289
+ const n = tt(e), s = tt(t);
1290
+ if (!n && s) {
1291
+ const o = s.getAttribute(X);
1292
+ if (!o) return null;
1293
+ const a = et(e, o);
1294
+ return a ? { mode: "enter", enterEl: s, exitEl: a } : null;
1295
+ }
1296
+ if (n && !s) {
1297
+ const o = n.getAttribute(X);
1298
+ if (!o) return null;
1299
+ const a = et(t, o);
1300
+ return a ? { mode: "exit", enterEl: n, exitEl: a } : null;
1301
+ }
1302
+ return null;
1303
+ }
1304
+ function Ee(e, t, n, s) {
1305
+ return {
1306
+ enterRect: O(
1307
+ e.mode === "enter" ? n : t,
1308
+ e.enterEl
1309
+ ),
1310
+ exitRect: O(
1311
+ e.mode === "enter" ? t : n,
1312
+ e.exitEl
1313
+ ),
1314
+ pageRect: e.mode === "enter" ? n.getBoundingClientRect() : t.getBoundingClientRect(),
1315
+ scrollOffset: s
1316
+ };
1317
+ }
1318
+ const Pe = (e) => {
1319
+ const t = xe[e.type], n = t.physics;
1320
+ return {
1321
+ prepare: ({ from: s }) => (s.then((o) => {
1322
+ o.style.willChange = "transform, clip-path, opacity", o.style.backfaceVisibility = "hidden", o.style.contain = "layout paint";
1323
+ }), {}),
1324
+ animation: ({ from: s, to: o, context: a }) => {
1325
+ const i = Ce(s, o);
1326
+ if (!i)
1327
+ return new $([], { mode: "parallel" });
1328
+ const l = Ee(i, s, o, a.scrollOffset), c = i.mode === "enter" ? t.in(l) : t.backgroundIn(l), r = i.mode === "enter" ? t.backgroundOut(l) : t.out(l);
1329
+ c && (o.style.transformOrigin = c.transformOrigin), r && (s.style.transformOrigin = r.transformOrigin);
1330
+ const p = i.mode === "enter" ? o : s, d = p.style.zIndex;
1331
+ p.style.zIndex = "9999";
1332
+ const h = new w({
1333
+ element: s,
1334
+ integrator: g.from(n),
1335
+ // The provider's `animate` was authored against legacy convention
1336
+ // where OUT runs `progress: 1 → 0`. Our `u` mirrors that, so feeding
1337
+ // `u` keeps the visual direction (full page → shrunk to tile) intact.
1338
+ style: (f, m) => r.animate(m)
1339
+ }), u = new w({
1340
+ element: o,
1341
+ integrator: g.from(n),
1342
+ style: (f) => c.animate(f),
1343
+ onComplete: () => {
1344
+ o.style.willChange = "auto", o.style.backfaceVisibility = "", o.style.transformOrigin = "", o.style.contain = "", p.style.zIndex = d;
1345
+ }
1346
+ });
1347
+ return new $([h, u], { mode: "parallel" });
1348
+ }
1349
+ };
1350
+ };
1351
+ function Ue({ paths: e, type: t }) {
1352
+ return P(e, () => Pe({ type: t }));
1265
1353
  }
1266
1354
  export {
1267
- Q as SCOPE_ATTR,
1268
- tt as SCOPE_READY_ATTR,
1269
- J as TRANSITION_STRATEGY,
1270
- Ot as createAnyOrderDetector,
1271
- gt as createDefaultStrategy,
1272
- Lt as createOutFirstDetector,
1273
- yt as createPageTransitionStrategy,
1274
- jt as createSggoiTransitionContext,
1275
- Nt as createTransitionScope,
1276
- pt as findScope,
1277
- Wt as getWatchedCount,
1278
- Gt as isCssAnimation,
1279
- $t as isKeyframesAnimation,
1280
- Zt as isMultiAnimation,
1281
- wt as isScopeReady,
1282
- Jt as isSingleAnimation,
1283
- Qt as isTickAnimation,
1284
- Xt as isWatched,
1285
- W as normalizeSchedule,
1286
- F as normalizeToMultiAnimation,
1287
- Kt as resetObserver,
1288
- Ut as transition,
1289
- Ht as triggerUnmount,
1290
- Et as watchUnmount
1355
+ Xe as Animation,
1356
+ $ as MultiAnimation,
1357
+ w as WebAnimation,
1358
+ Ie as blind,
1359
+ Te as drill,
1360
+ Ae as fade,
1361
+ _e as film,
1362
+ ke as hero,
1363
+ ve as jaemin,
1364
+ Le as rotate,
1365
+ Ye as scroll,
1366
+ Fe as sheet,
1367
+ Me as slide,
1368
+ He as strip,
1369
+ Ue as zoom
1291
1370
  };