@ssgoi/core 2.5.0 → 2.5.1

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.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Custom spring animation implementation (replacing popmotion)
3
+ * Interface-compatible with popmotion's animate function
4
+ * Uses optimized semi-implicit Euler method (Allen Chou's approach)
5
+ */
6
+ export interface AnimateOptions {
7
+ from: number;
8
+ to: number;
9
+ stiffness: number;
10
+ damping: number;
11
+ mass: number;
12
+ velocity?: number;
13
+ onUpdate: (value: number) => void;
14
+ onComplete: () => void;
15
+ }
16
+ export interface AnimationControls {
17
+ stop: () => void;
18
+ }
19
+ /**
20
+ * Spring-based animation using optimized semi-implicit Euler
21
+ * Based on Allen Chou's implementation for stability and performance
22
+ *
23
+ * Instead of computing F = -k(x-xt) - d*v, then a = F/m,
24
+ * we use angular frequency (omega) and damping ratio (zeta):
25
+ * - omega = sqrt(k/m) - angular frequency
26
+ * - zeta = d/(2*sqrt(k*m)) - damping ratio
27
+ *
28
+ * Semi-implicit Euler update:
29
+ * v += -2*h*zeta*omega*v + h*omega^2*(xt - x)
30
+ * x += h*v
31
+ *
32
+ * This formulation is more stable and efficient than the naive approach.
33
+ */
34
+ export declare function animate(options: AnimateOptions): AnimationControls;
35
+ //# sourceMappingURL=animate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/lib/animate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAgFlE"}
@@ -0,0 +1,47 @@
1
+ import { MultiSpringConfig, AnimationController, AnimationState } from './types';
2
+ /**
3
+ * AnimationScheduler - Coordinates multiple spring animations
4
+ *
5
+ * Manages the lifecycle and timing of multiple spring animations.
6
+ * Supports three scheduling strategies:
7
+ * - overlap: All springs start immediately (parallel)
8
+ * - wait: Each spring waits for previous to complete (sequential)
9
+ * - chain: Springs start with offset delays
10
+ *
11
+ * Note: getCurrentState() always returns MultiAnimationState (number-based progress)
12
+ */
13
+ export declare class AnimationScheduler<TAnimationValue = number> implements AnimationController<number> {
14
+ private config;
15
+ private animators;
16
+ private springOrder;
17
+ private completedCount;
18
+ private completedAnimators;
19
+ private direction;
20
+ private idCounter;
21
+ private timeoutIds;
22
+ constructor(config: MultiSpringConfig<TAnimationValue>);
23
+ private generateId;
24
+ private initializeAnimators;
25
+ /**
26
+ * Normalize schedule configuration to unified internal representation
27
+ * Uses discriminated union and early return pattern
28
+ *
29
+ * @param direction - "forward" or "backward" direction
30
+ */
31
+ private normalizeSchedule;
32
+ private onAnimatorComplete;
33
+ /**
34
+ * Handle wait mode chaining: start next/previous spring after completion
35
+ */
36
+ private handleWaitModeChaining;
37
+ private startAnimator;
38
+ private startBackwardAnimator;
39
+ forward(): void;
40
+ backward(): void;
41
+ stop(): void;
42
+ reverse(options?: {
43
+ offsetMode?: "immediate" | "mirror" | "reverse";
44
+ }): void;
45
+ getCurrentState(): AnimationState<number>;
46
+ }
47
+ //# sourceMappingURL=animation-scheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation-scheduler.d.ts","sourceRoot":"","sources":["../src/lib/animation-scheduler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EAGjB,mBAAmB,EACnB,cAAc,EACf,MAAM,SAAS,CAAC;AAYjB;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB,CAAC,eAAe,GAAG,MAAM,CACtD,YAAW,mBAAmB,CAAC,MAAM,CAAC;IAEtC,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,SAAS,CAA0D;IAC3E,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAgB;gBAEtB,MAAM,EAAE,iBAAiB,CAAC,eAAe,CAAC;IAKtD,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,mBAAmB;IAsB3B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IA+EzB,OAAO,CAAC,kBAAkB;IA4B1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkC9B,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,qBAAqB;IAqB7B,OAAO,IAAI,IAAI;IAiCf,QAAQ,IAAI,IAAI;IAiChB,IAAI,IAAI,IAAI;IAYZ,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAA;KAAE,GAAG,IAAI;IAoD5E,eAAe,IAAI,cAAc,CAAC,MAAM,CAAC;CAQ1C"}
@@ -1,4 +1,4 @@
1
- import { SpringConfig } from './types';
1
+ import { SpringConfig, AnimationController, AnimationState } from './types';
2
2
  export interface AnimationOptions<TAnimationValue = number> {
3
3
  from: TAnimationValue;
4
4
  to: TAnimationValue;
@@ -14,7 +14,7 @@ export interface AnimationOptions<TAnimationValue = number> {
14
14
  *
15
15
  * @template TAnimationValue - The type of value being animated (number | object)
16
16
  */
17
- export declare class Animator<TAnimationValue = number> {
17
+ export declare class Animator<TAnimationValue = number> implements AnimationController<TAnimationValue> {
18
18
  private options;
19
19
  private currentValue;
20
20
  private velocity;
@@ -35,12 +35,7 @@ export declare class Animator<TAnimationValue = number> {
35
35
  getVelocity(): TAnimationValue extends number ? number : Record<string, number>;
36
36
  getCurrentValue(): TAnimationValue;
37
37
  getIsAnimating(): boolean;
38
- getCurrentState(): {
39
- position: TAnimationValue;
40
- velocity: TAnimationValue extends number ? number : Record<string, number>;
41
- from: TAnimationValue;
42
- to: TAnimationValue;
43
- };
38
+ getCurrentState(): AnimationState<TAnimationValue>;
44
39
  setVelocity(velocity: TAnimationValue extends number ? number : Record<string, number>): void;
45
40
  setValue(value: TAnimationValue): void;
46
41
  updateOptions(newOptions: Partial<AnimationOptions<TAnimationValue>>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../src/lib/animator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,gBAAgB,CAAC,eAAe,GAAG,MAAM;IACxD,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ,CAAC,eAAe,GAAG,MAAM;IAC5C,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAEW;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAqC;IAGrD,OAAO,CAAC,YAAY,CAAkD;IACtE,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,iBAAiB,CAAqB;gBAElC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IA2B/D,OAAO,CAAC,OAAO,CA+Fb;IAEF,OAAO,CAAC,aAAa,CAoHnB;IAGF,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;IAKhB,OAAO,IAAI,IAAI;IAcf,OAAO,CAAC,aAAa;IAYrB,IAAI,IAAI,IAAI;IAyBZ,WAAW,IAAI,eAAe,SAAS,MAAM,GACzC,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI1B,eAAe,IAAI,eAAe;IAIlC,cAAc,IAAI,OAAO;IAIzB,eAAe,IAAI;QACjB,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3E,IAAI,EAAE,eAAe,CAAC;QACtB,EAAE,EAAE,eAAe,CAAC;KACrB;IAUD,WAAW,CACT,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACzE,IAAI;IAIP,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAKtC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GAAG,IAAI;IAY3E,MAAM,CAAC,SAAS,CAAC,eAAe,GAAG,MAAM,EACvC,KAAK,EAAE;QACL,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GACpC,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5B,EACD,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACrD,QAAQ,CAAC,eAAe,CAAC;CAM7B"}
1
+ {"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../src/lib/animator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,gBAAgB,CAAC,eAAe,GAAG,MAAM;IACxD,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ,CAAC,eAAe,GAAG,MAAM,CAC5C,YAAW,mBAAmB,CAAC,eAAe,CAAC;IAE/C,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAEW;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAqC;IAGrD,OAAO,CAAC,YAAY,CAAkD;IACtE,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,iBAAiB,CAAqB;gBAElC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IA2B/D,OAAO,CAAC,OAAO,CA+Fb;IAEF,OAAO,CAAC,aAAa,CAoHnB;IAGF,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;IAKhB,OAAO,IAAI,IAAI;IAcf,OAAO,CAAC,aAAa;IAYrB,IAAI,IAAI,IAAI;IAyBZ,WAAW,IAAI,eAAe,SAAS,MAAM,GACzC,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI1B,eAAe,IAAI,eAAe;IAIlC,cAAc,IAAI,OAAO;IAIzB,eAAe,IAAI,cAAc,CAAC,eAAe,CAAC;IAWlD,WAAW,CACT,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACzE,IAAI;IAIP,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAKtC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GAAG,IAAI;IAY3E,MAAM,CAAC,SAAS,CAAC,eAAe,GAAG,MAAM,EACvC,KAAK,EAAE;QACL,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GACpC,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5B,EACD,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACrD,QAAQ,CAAC,eAAe,CAAC;CAM7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../src/lib/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,wBAAwB,CAAC,eAAe,GAAG,MAAM,EAC/D,aAAa,EAAE,MAAM,UAAU,CAAC,SAAS,EAAE,eAAe,CAAC,EAC3D,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,CA0IpB"}
1
+ {"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../src/lib/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,wBAAwB,CAAC,eAAe,GAAG,MAAM,EAC/D,aAAa,EAAE,MAAM,UAAU,CAAC,SAAS,EAAE,eAAe,CAAC,EAC3D,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,CAsRpB"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var N=Object.defineProperty;var z=(n,t,e)=>t in n?N(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var v=(n,t,e)=>z(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion"),L=require("./jaemin-DL1-g_B5.cjs");class T{constructor(t){v(this,"options");v(this,"currentValue");v(this,"velocity");v(this,"isAnimating",!1);v(this,"controls",null);v(this,"animationMap",null);v(this,"activeAnimations",new Set);v(this,"completedAnimations",new Set);v(this,"updatedProperties",new Set);v(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const e=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(e);return}let i=this.currentValue,s=performance.now();const o={from:this.currentValue,to:e,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(o.velocity=this.velocity*1e3),this.controls=R.animate({...o,onUpdate:u=>{const d=performance.now(),a=(d-s)/1e3;if(a>0){if(typeof u=="number"&&typeof i=="number"){const m=(u-i)/a;this.velocity=m/1e3}else if(typeof u=="object"&&u!==null){const m={};Object.keys(u).forEach(l=>{const r=u[l],f=i[l];if(typeof r=="number"&&typeof f=="number"){const g=(r-f)/a;m[l]=g/1e3}}),this.velocity=m}i=u,s=d}this.currentValue=u,this.options.onUpdate(u)},onComplete:()=>{this.currentValue=e,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(u=>{this.velocity[u]=0}):this.velocity=0,this.options.onComplete()}})});v(this,"animateObject",t=>{const e=this.currentValue,i=Object.keys(e);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const s={...e},o={};let u=!1;const d=()=>{const a=i.filter(l=>!this.completedAnimations.has(l));if(a.every(l=>this.updatedProperties.has(l))&&a.length>0){if(typeof this.velocity=="object"&&this.velocity){const l=performance.now();Object.keys(s).forEach(r=>{if(o[r]){const f=(l-o[r])/1e3,g=this.currentValue[r],c=s[r];typeof g=="number"&&typeof c=="number"&&f>0&&(this.velocity[r]=(c-g)/f/1e3)}o[r]=l})}this.currentValue={...s},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!u&&this.options.onStart&&(u=!0,this.options.onStart())}};i.forEach(a=>{this.activeAnimations.add(a);const m={from:e[a],to:t[a],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&a in this.velocity&&(m.velocity=this.velocity[a]*1e3);const l=R.animate({...m,onUpdate:r=>{s[a]=r,this.updatedProperties.add(a),d()},onComplete:()=>{this.completedAnimations.add(a),this.updatedProperties.delete(a),this.completedAnimations.size===i.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(r=>{this.velocity[r]=0}),this.options.onComplete())}});this.animationMap.set(a,l)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const e={};Object.keys(this.options.from).forEach(i=>{e[i]=0}),this.velocity=e}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const e=this.shouldReverse();this.stop(),this.animate(!e)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const e=this.shouldReverse();this.stop(),this.animate(!e)}}static fromState(t,e){const i=new T(e);return i.setValue(t.position),i.setVelocity(t.velocity),i}}const O=Symbol.for("TRANSITION_STRATEGY"),M=n=>({runIn:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="out"){const u=e.animator.getCurrentState();if(e.animator.stop(),t.out){const d=await t.out,{from:a=1,to:m=0}=d;return{config:d,state:u,from:a,to:m,direction:"backward"}}}const i=await t.in;if(!i)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:s=0,to:o=1}=i;return{config:i,state:{position:s,velocity:0},from:s,to:o,direction:"forward"}},runOut:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="in"){const u=e.animator.getCurrentState();if(e.animator.stop(),t.in){const d=await t.in,{from:a=0,to:m=1}=d;return{config:d,state:{position:u.position,velocity:u.velocity},from:a,to:m,direction:"backward"}}}const i=await t.out;if(!i)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:s=1,to:o=0}=i;return{config:i,state:{position:s,velocity:0},from:s,to:o,direction:"forward"}}}),I=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:e=0,to:i=1}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}},runOut:async n=>{const t=await n.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:e=1,to:i=0}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}}});function K(n,t){var l;let e=null,i=null,s=null,o=null;const u={get currentAnimation(){return e}},d=((l=t==null?void 0:t.strategy)==null?void 0:l.call(t,u))||M(u),a=async r=>{var p,h;i&&(i.remove(),i=null);const f=n(),g={in:f.in&&Promise.resolve(f.in(r)),out:f.out&&Promise.resolve(f.out(r))},c=await d.runIn(g);if(!c.config)return;(h=(p=c.config).prepare)==null||h.call(p,r),c.config.wait&&await c.config.wait();const S=T.fromState(c.state,{from:c.from,to:c.to,spring:c.config.spring,onStart:c.config.onStart,onUpdate:c.config.tick,onComplete:()=>{var y,w;e=null,(w=(y=c.config)==null?void 0:y.onEnd)==null||w.call(y)}});e={animator:S,direction:"in"},c.direction==="forward"?S.forward():S.backward()},m=async r=>{var h,y;i=r;const f=n(),g={in:f.in&&Promise.resolve(f.in(r)),out:f.out&&Promise.resolve(f.out(r))},c=await d.runOut(g);if(!c.config)return;(y=(h=c.config).prepare)==null||y.call(h,r),p(),c.config.wait&&await c.config.wait();const S=T.fromState(c.state,{from:c.from,to:c.to,spring:c.config.spring,onStart:c.config.onStart,onUpdate:c.config.tick,onComplete:()=>{var w,b,C;(b=(w=c.config)==null?void 0:w.onEnd)==null||b.call(w),i&&(i.remove(),i=null),e=null,(C=t==null?void 0:t.onCleanupEnd)==null||C.call(t)}});e={animator:S,direction:"out"},c.direction==="forward"?S.forward():S.backward();function p(){!s||!i||(o&&s.contains(o)?s.insertBefore(i,o):s.appendChild(i))}};return r=>{if(r)return s=r.parentElement,o=r.nextElementSibling,a(r),()=>{const f=r.cloneNode(!0);m(f)}}}const $=3,k=n=>{if(!n)return null;const t=n.split(`
2
- `).map(e=>e.trim());for(let e=$;e<Math.min(t.length,6);e++){const i=t[e],s=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!s)continue;const o=s[1]??"",u=s[2]??"0",d=s[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:u,column:d}}return null},P=new Map,V=new Map;function F(n,t,e){P.set(n,t);let i=V.get(n);return i||(i=K(()=>{const s=P.get(n);return s||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:e,onCleanupEnd:()=>U(n)}),V.set(n,i),i)}function U(n){P.delete(n),V.delete(n)}function _(){const n=k(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const x=globalThis.FinalizationRegistry,j=x?new x(n=>{try{U(n)}catch{}}):void 0;function W(n){const t=n.key??_();if(n.ref&&j)try{j.register(n.ref,t)}catch{}return F(t,{in:n.in,out:n.out},n[O])}const Y=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t),i=e.overflow+e.overflowY+e.overflowX;if(i.includes("auto")||i.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},G=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return t;t=t.parentElement}return document.body};function X(n){const t=n.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...n,...t]}function q(n){let t=!1,e=!1;const i=a=>{if(!n)return;const m=a.touches[0];m&&(e=m.clientX<50)},s=()=>{n&&(e&&(t=!0,setTimeout(()=>{t=!1},500)),e=!1)};return{initialize:()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",i,{passive:!0}),window.addEventListener("touchend",s,{passive:!0}))},cleanup:()=>{typeof window>"u"||(window.removeEventListener("touchstart",i),window.removeEventListener("touchend",s))},isSwipePending:()=>t}}function H(){let n=null,t=null;const e=new Map;let i=null;const s=()=>{n&&i&&e.set(i,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(l,r)=>{t=l,n||(n=Y(l),(n===document.documentElement?window:n).addEventListener("scroll",s,{passive:!0})),i=r},calculateScrollOffset:(l,r)=>{const f=l&&e.has(l)?e.get(l):{x:0,y:0},g=r&&e.has(r)?e.get(r):{x:0,y:0};return{x:-g.x+f.x,y:-g.y+f.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>t?G(t):document.body,getScrollPosition:l=>l&&e.has(l)?e.get(l):{x:0,y:0}}}function B(n){const{transitions:t=[],defaultTransition:e,middleware:i=(p,h)=>({from:p,to:h}),skipOnIosSwipe:s=!0}=n;let o=null;const u=X(t),{initializeContext:d,calculateScrollOffset:a,getScrollContainer:m,getPositionedParentElement:l,getScrollPosition:r}=H(),f=q(s);f.initialize();function g(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:p,to:h}=i(o.from,o.to),w=J(p,h,u)||e,b=a(o.from,o.to),C={scrollOffset:b,scroll:r(o.from),get scrollingElement(){return m()||document.documentElement},get positionedParent(){return l()}},D={scrollOffset:b,get scroll(){return o?r(o.to):{x:0,y:0}},get scrollingElement(){return m()||document.documentElement},get positionedParent(){return l()}};w&&(w.out&&o.outResolve&&o.outResolve(A=>w.out(A,C)),w.in&&o.inResolve&&o.inResolve(A=>w.in(A,D))),o=null}}const c=async(p,h)=>f.isSwipePending()?()=>({}):h==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),h==="out"?(o.from=p,new Promise(y=>{o.outResolve=y,g()})):(o.to=p,new Promise(y=>{o.inResolve=y,g()})));return p=>({key:p,in:async h=>(d(h,p),(await c(p,"in"))(h)),out:async h=>(await c(p,"out"))(h),[O]:I})}function J(n,t,e){for(const i of e)if(E(n,i.from)&&E(t,i.to))return i.transition;for(const i of e)if((i.from==="*"||E(n,i.from))&&(i.to==="*"||E(t,i.to)))return i.transition;return null}function E(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const e=t.slice(0,-2);return n===e||n.startsWith(e+"/")}return n===t}exports.jaeminInternal=L.jaeminInternal;exports.TRANSITION_STRATEGY=O;exports.createDefaultStrategy=M;exports.createPageTransitionStrategy=I;exports.createSggoiTransitionContext=B;exports.generateAutoKey=_;exports.transition=W;
1
+ "use strict";var F=Object.defineProperty;var H=(n,t,e)=>t in n?F(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var d=(n,t,e)=>H(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./types.cjs"),W=require("./jaemin-DL1-g_B5.cjs");class q{constructor(){d(this,"listeners",new Set);d(this,"rafId",null);d(this,"isRunning",!1);d(this,"startTime",Date.now());d(this,"lastUpdate",this.startTime);d(this,"elapsed",0);d(this,"lagThreshold",500);d(this,"adjustedLag",33);d(this,"gap",1e3/240);d(this,"nextTime",this.gap);d(this,"tick",()=>{const t=Date.now();let e=t-this.lastUpdate;(e>this.lagThreshold||e<0)&&(this.startTime+=e-this.adjustedLag,e=this.adjustedLag),this.lastUpdate=t;const i=t-this.startTime,r=i-this.nextTime;if(r>0){const o=e/1e3;this.elapsed=i/1e3,this.nextTime+=r+(r>=this.gap?4:this.gap-r),this.listeners.forEach(s=>{s(o,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(t){return this.listeners.add(t),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(t)}}unsubscribe(t){this.listeners.delete(t),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(t,e){this.lagThreshold=t,this.adjustedLag=Math.min(e,t)}fps(t){this.gap=1e3/t,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const x=new q;function k(n){const{from:t,to:e,stiffness:i,damping:r,mass:o,velocity:s=0,onUpdate:m,onComplete:l}=n;let h=t,u=s,a=!0;const p=Math.sqrt(i/o),c=r/(2*Math.sqrt(i*o)),S=.01,w=.01;let f=0;const g=.05,v=A=>{if(!a)return;const E=Math.min(A,.033),y=-2*E*c*p*u,b=E*p*p*(e-h);u+=y+b,h+=E*u;const T=Math.abs(e-h),C=Math.abs(u);if(T<S&&C<w){if(f+=E,f>=g){h=e,u=0,a=!1,m(h),x.unsubscribe(v),l();return}}else f=0;m(h)};return x.subscribe(v),{stop:()=>{a&&(a=!1,x.unsubscribe(v))}}}class O{constructor(t){d(this,"options");d(this,"currentValue");d(this,"velocity");d(this,"isAnimating",!1);d(this,"controls",null);d(this,"animationMap",null);d(this,"activeAnimations",new Set);d(this,"completedAnimations",new Set);d(this,"updatedProperties",new Set);d(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const e=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(e);return}let i=this.currentValue,r=performance.now();const o={from:this.currentValue,to:e,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(o.velocity=this.velocity*1e3),this.controls=k({...o,onUpdate:s=>{const m=performance.now(),l=(m-r)/1e3;if(l>0){if(typeof s=="number"&&typeof i=="number"){const h=(s-i)/l;this.velocity=h/1e3}else if(typeof s=="object"&&s!==null){const h={};Object.keys(s).forEach(u=>{const a=s[u],p=i[u];if(typeof a=="number"&&typeof p=="number"){const c=(a-p)/l;h[u]=c/1e3}}),this.velocity=h}i=s,r=m}this.currentValue=s,this.options.onUpdate(s)},onComplete:()=>{this.currentValue=e,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(s=>{this.velocity[s]=0}):this.velocity=0,this.options.onComplete()}})});d(this,"animateObject",t=>{const e=this.currentValue,i=Object.keys(e);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const r={...e},o={};let s=!1;const m=()=>{const l=i.filter(u=>!this.completedAnimations.has(u));if(l.every(u=>this.updatedProperties.has(u))&&l.length>0){if(typeof this.velocity=="object"&&this.velocity){const u=performance.now();Object.keys(r).forEach(a=>{if(o[a]){const p=(u-o[a])/1e3,c=this.currentValue[a],S=r[a];typeof c=="number"&&typeof S=="number"&&p>0&&(this.velocity[a]=(S-c)/p/1e3)}o[a]=u})}this.currentValue={...r},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!s&&this.options.onStart&&(s=!0,this.options.onStart())}};i.forEach(l=>{this.activeAnimations.add(l);const h={from:e[l],to:t[l],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&l in this.velocity&&(h.velocity=this.velocity[l]*1e3);const u=k({...h,onUpdate:a=>{r[l]=a,this.updatedProperties.add(l),m()},onComplete:()=>{this.completedAnimations.add(l),this.updatedProperties.delete(l),this.completedAnimations.size===i.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(a=>{this.velocity[a]=0}),this.options.onComplete())}});this.animationMap.set(l,u)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const e={};Object.keys(this.options.from).forEach(i=>{e[i]=0}),this.velocity=e}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const e=this.shouldReverse();this.stop(),this.animate(!e)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{type:"single",position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const e=this.shouldReverse();this.stop(),this.animate(!e)}}static fromState(t,e){const i=new O(e);return i.setValue(t.position),i.setVelocity(t.velocity),i}}class U{constructor(t){d(this,"config");d(this,"animators",new Map);d(this,"springOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"timeoutIds",[]);this.config=t,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const e=this.generateId(),i=new O({from:t.from,to:t.to,spring:t.spring,onUpdate:t.tick,onComplete:()=>this.onAnimatorComplete(e),onStart:t.onStart});this.animators.set(e,{id:e,item:t,animator:i,startTime:null}),this.springOrder.push(e)})}normalizeSchedule(t){const e=this.config.schedule??"overlap";return this.springOrder.map((i,r)=>{const o=this.animators.get(i);if(!o)throw new Error(`AnimationScheduler: animator with id "${i}" not found during normalization`);if(e==="overlap")return{type:"offset",id:i,delay:0};if(e==="wait")return t==="forward"&&r===0?{type:"offset",id:i,delay:0}:t==="backward"&&r===this.springOrder.length-1?{type:"offset",id:i,delay:0}:{type:"wait",id:i};const s=o.item.offset??0;if(t==="forward")return{type:"offset",id:i,delay:s};const m=this.animators.size===0?0:Math.max(...Array.from(this.animators.values()).map(l=>l.item.offset??0));return{type:"offset",id:i,delay:m-s}})}onAnimatorComplete(t){var i,r,o,s,m,l;const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on completion`);return}this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(r=(i=e.item).onComplete)==null||r.call(i),(s=(o=this.config).onProgress)==null||s.call(o,this.completedCount,this.config.springs.length),this.handleWaitModeChaining(t),this.completedCount===this.config.springs.length&&((l=(m=this.config).onEnd)==null||l.call(m)))}handleWaitModeChaining(t){if(this.config.schedule!=="wait")return;const e=this.springOrder.indexOf(t);if(this.direction==="forward"){const o=this.springOrder[e+1];if(!o)return;const s=this.animators.get(o);s&&s.startTime===null&&this.startAnimator(o);return}const i=this.springOrder[e-1];if(!i)return;const r=this.animators.get(i);r&&r.startTime===null&&this.startBackwardAnimator(i)}startAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.forward()}startBackwardAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on backward start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.backward()}forward(){var e,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("forward").forEach(r=>{if(r.type==="wait")return;if(r.delay===0){this.startAnimator(r.id);return}const o=window.setTimeout(()=>this.startAnimator(r.id),r.delay);this.timeoutIds.push(o)})}backward(){var e,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("backward").forEach(r=>{if(r.type==="wait")return;if(r.delay===0){this.startBackwardAnimator(r.id);return}const o=window.setTimeout(()=>this.startBackwardAnimator(r.id),r.delay);this.timeoutIds.push(o)})}stop(){this.timeoutIds.forEach(t=>clearTimeout(t)),this.timeoutIds=[],this.animators.forEach(t=>{t.animator.stop(),t.startTime=null})}reverse(t){((t==null?void 0:t.offsetMode)??"immediate")!=="immediate"&&console.warn('AnimationScheduler.reverse(): Only "immediate" offsetMode is currently supported. Falling back to "immediate".'),this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(i=>{if(i.startTime===null)return;const r=i.animator.getCurrentState();if(r.type!=="single")return;if(r.position===r.to){const s=O.fromState({position:1,velocity:0},{from:i.item.to??1,to:i.item.from??0,spring:i.item.spring,onUpdate:i.item.tick,onComplete:()=>this.onAnimatorComplete(i.id),onStart:i.item.onStart});s.forward(),i.animator=s;return}i.animator.reverse()})}getCurrentState(){return{type:"multi",completed:this.completedCount,total:this.config.springs.length,direction:this.direction}}}const j=Symbol.for("TRANSITION_STRATEGY"),L=n=>({runIn:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="out"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if(t.out){const m=await t.out,{from:l=1,to:h=0}=m;return{config:m,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.in;if(!i)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in i)return{config:i,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:r=0,to:o=1}=i;return{config:i,state:{position:r,velocity:0},from:r,to:o,direction:"forward"}},runOut:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="in"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if(t.in){const m=await t.in,{from:l=0,to:h=1}=m;return{config:m,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.out;if(!i)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in i)return{config:i,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:r=1,to:o=0}=i;return{config:i,state:{position:r,velocity:0},from:r,to:o,direction:"forward"}}}),_=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in t)return{config:t,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:e=0,to:i=1}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}},runOut:async n=>{const t=await n.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in t)return{config:t,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:e=1,to:i=0}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}}});function K(n,t){var u;let e=null,i=null,r=null,o=null;const s={get currentAnimation(){return e}},m=((u=t==null?void 0:t.strategy)==null?void 0:u.call(t,s))||L(s),l=async a=>{var v,A,E;i&&(i.remove(),i=null);const p=n(),c=p.in&&await p.in(a),S=!(t!=null&&t.strategy)&&p.out?await p.out(a):void 0;if(!c)return;if(I.isMultiSpring(c)){const y={in:Promise.resolve(c),out:S&&Promise.resolve(S)};if(!(await m.runIn(y)).config){e&&(e.direction="in");return}(v=c.prepare)==null||v.call(c,a),c.wait&&await c.wait();const T=new U({...c,onEnd:()=>{var C;e=null,(C=c.onEnd)==null||C.call(c)}});e={controller:T,direction:"in"},T.forward();return}const w={in:Promise.resolve(c),out:S&&Promise.resolve(S)},f=await m.runIn(w);if(!f.config)return;if("springs"in f.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(E=(A=f.config).prepare)==null||E.call(A,a),f.config.wait&&await f.config.wait();const g=O.fromState(f.state,{from:f.from,to:f.to,spring:f.config.spring,onStart:f.config.onStart,onUpdate:f.config.tick,onComplete:()=>{var y,b;e=null,(b=(y=f.config)==null?void 0:y.onEnd)==null||b.call(y)}});e={controller:g,direction:"in"},f.direction==="forward"?g.forward():g.backward()},h=async a=>{var v,A,E;i=a;const p=n(),c=p.out&&await p.out(a);if(!c)return;if(I.isMultiSpring(c)){const y={in:void 0,out:Promise.resolve(c)};if(!(await m.runOut(y)).config){e&&(e.direction="out"),i&&(i.remove(),i=null);return}(v=c.prepare)==null||v.call(c,a),g(),c.wait&&await c.wait();const T=new U({...c,onEnd:()=>{var C,M;(C=c.onEnd)==null||C.call(c),i&&(i.remove(),i=null),e=null,(M=t==null?void 0:t.onCleanupEnd)==null||M.call(t)}});e={controller:T,direction:"out"},T.forward();return}const S={in:void 0,out:Promise.resolve(c)},w=await m.runOut(S);if(!w.config)return;if("springs"in w.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(E=(A=w.config).prepare)==null||E.call(A,a),g(),w.config.wait&&await w.config.wait();const f=O.fromState(w.state,{from:w.from,to:w.to,spring:w.config.spring,onStart:w.config.onStart,onUpdate:w.config.tick,onComplete:()=>{var y,b,T;(b=(y=w.config)==null?void 0:y.onEnd)==null||b.call(y),i&&(i.remove(),i=null),e=null,(T=t==null?void 0:t.onCleanupEnd)==null||T.call(t)}});e={controller:f,direction:"out"},w.direction==="forward"?f.forward():f.backward();function g(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};return a=>{if(a)return r=a.parentElement,o=a.nextElementSibling,l(a),()=>{const p=a.cloneNode(!0);h(p)}}}const B=3,Y=n=>{if(!n)return null;const t=n.split(`
2
+ `).map(e=>e.trim());for(let e=B;e<Math.min(t.length,6);e++){const i=t[e],r=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!r)continue;const o=r[1]??"",s=r[2]??"0",m=r[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:s,column:m}}return null},R=new Map,V=new Map;function G(n,t,e){R.set(n,t);let i=V.get(n);return i||(i=K(()=>{const r=R.get(n);return r||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:e,onCleanupEnd:()=>$(n)}),V.set(n,i),i)}function $(n){R.delete(n),V.delete(n)}function N(){const n=Y(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const z=globalThis.FinalizationRegistry,D=z?new z(n=>{try{$(n)}catch{}}):void 0;function X(n){const t=n.key??N();if(n.ref&&D)try{D.register(n.ref,t)}catch{}return G(t,{in:n.in,out:n.out},n[j])}const J=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t),i=e.overflow+e.overflowY+e.overflowX;if(i.includes("auto")||i.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},Q=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return t;t=t.parentElement}return document.body};function Z(n){const t=n.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...n,...t]}function tt(n){let t=!1,e=!1;const i=l=>{if(!n)return;const h=l.touches[0];h&&(e=h.clientX<50)},r=()=>{n&&(e&&(t=!0,setTimeout(()=>{t=!1},500)),e=!1)};return{initialize:()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",i,{passive:!0}),window.addEventListener("touchend",r,{passive:!0}))},cleanup:()=>{typeof window>"u"||(window.removeEventListener("touchstart",i),window.removeEventListener("touchend",r))},isSwipePending:()=>t}}function et(){let n=null,t=null;const e=new Map;let i=null;const r=()=>{n&&i&&e.set(i,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(u,a)=>{t=u,n||(n=J(u),(n===document.documentElement?window:n).addEventListener("scroll",r,{passive:!0})),i=a},calculateScrollOffset:(u,a)=>{const p=u&&e.has(u)?e.get(u):{x:0,y:0},c=a&&e.has(a)?e.get(a):{x:0,y:0};return{x:-c.x+p.x,y:-c.y+p.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>t?Q(t):document.body,getScrollPosition:u=>u&&e.has(u)?e.get(u):{x:0,y:0}}}function it(n){const{transitions:t=[],defaultTransition:e,middleware:i=(f,g)=>({from:f,to:g}),skipOnIosSwipe:r=!1}=n;let o=null;const s=Z(t),{initializeContext:m,calculateScrollOffset:l,getScrollContainer:h,getPositionedParentElement:u,getScrollPosition:a}=et(),p=tt(r);p.initialize();function c(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:f,to:g}=i(o.from,o.to),A=nt(f,g,s)||e,E=l(o.from,o.to),y={scrollOffset:E,scroll:a(o.from),get scrollingElement(){return h()||document.documentElement},get positionedParent(){return u()}},b={scrollOffset:E,get scroll(){return o?a(o.to):{x:0,y:0}},get scrollingElement(){return h()||document.documentElement},get positionedParent(){return u()}};A&&(A.out&&o.outResolve&&o.outResolve(T=>A.out(T,y)),A.in&&o.inResolve&&o.inResolve(T=>A.in(T,b))),o=null}}const S=async(f,g)=>p.isSwipePending()?()=>({}):g==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),g==="out"?(o.from=f,new Promise(v=>{o.outResolve=v,c()})):(o.to=f,new Promise(v=>{o.inResolve=v,c()})));return f=>({key:f,in:async g=>(m(g,f),(await S(f,"in"))(g)),out:async g=>(await S(f,"out"))(g),[j]:_})}function nt(n,t,e){for(const i of e)if(P(n,i.from)&&P(t,i.to))return i.transition;for(const i of e)if((i.from==="*"||P(n,i.from))&&(i.to==="*"||P(t,i.to)))return i.transition;return null}function P(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const e=t.slice(0,-2);return n===e||n.startsWith(e+"/")}return n===t}exports.isMultiSpring=I.isMultiSpring;exports.isSingleSpring=I.isSingleSpring;exports.jaeminInternal=W.jaeminInternal;exports.TRANSITION_STRATEGY=j;exports.createDefaultStrategy=L;exports.createPageTransitionStrategy=_;exports.createSggoiTransitionContext=it;exports.generateAutoKey=N;exports.transition=X;