@ssgoi/core 7.3.0-beta.2 → 7.3.0-beta.3

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.
@@ -1,34 +1,16 @@
1
+ type FrameCallback = () => void;
1
2
  /**
2
- * Do not let one delayed rendering opportunity consume an unbounded amount of
3
- * animation time while startup is still being stabilized. A 30 Hz display is
4
- * still a normal cadence, so only gaps larger than two nominal 60 Hz frames
5
- * are treated as catch-up.
6
- */
7
- export declare const MAX_FRAME_DELTA: number;
8
- export declare const STABLE_FRAME_THRESHOLD: number;
9
- export type FrameTick = {
10
- /** Frame time used by frame-paced animation drivers. */
11
- delta: number;
12
- /** Actual gap between rendering opportunities. */
13
- rawDelta: number;
14
- };
15
- type FramePhase = "drive" | "observe";
16
- type FrameCallback = (tick: FrameTick) => void;
17
- /**
18
- * One requestAnimationFrame loop shared by animation drivers and composition
19
- * observers. Drivers always run first so observers see the pose that will be
20
- * painted for the current rendering opportunity.
3
+ * One requestAnimationFrame loop shared by everything that has to poll once
4
+ * per rendering opportunity, such as a MultiAnimation waiting for a child's
5
+ * live progress to release its dependants. Playback itself is native WAAPI
6
+ * and never runs through here; the loop is idle whenever nothing is waiting.
21
7
  */
22
8
  declare class FrameScheduler {
23
- private drivers;
24
- private observers;
9
+ private callbacks;
25
10
  private frameRequest;
26
- private previousTimestamp;
27
- subscribe(callback: FrameCallback, phase?: FramePhase): () => void;
11
+ subscribe(callback: FrameCallback): () => void;
28
12
  private requestFrame;
29
13
  private tick;
30
- private runPhase;
31
- private hasCallbacks;
32
14
  private stopIfIdle;
33
15
  }
34
16
  export declare const frameScheduler: FrameScheduler;
@@ -1 +1 @@
1
- {"version":3,"file":"frame-scheduler.d.ts","sourceRoot":"","sources":["../../src/lib/animation/frame-scheduler.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAY,CAAC;AACzC,eAAO,MAAM,sBAAsB,QAAsB,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG;IACtB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AACtC,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;AAE/C;;;;GAIG;AACH,cAAM,cAAc;IAClB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,iBAAiB,CAAuB;IAEhD,SAAS,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,GAAE,UAAoB,GAAG,MAAM,IAAI;IAW3E,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,IAAI,CAkBV;IAEF,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,UAAU;CAWnB;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
1
+ {"version":3,"file":"frame-scheduler.d.ts","sourceRoot":"","sources":["../../src/lib/animation/frame-scheduler.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,MAAM,IAAI,CAAC;AAEhC;;;;;GAKG;AACH,cAAM,cAAc;IAClB,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAE3C,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,IAAI;IAU9C,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,IAAI,CAMV;IAEF,OAAO,CAAC,UAAU;CAOnB;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"multi-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/multi-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,E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WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAKtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAG5B;IAID,OAAO,CAAC,QAAQ;IAoHhB,OAAO,CAAC,iBAAiB;IA2CzB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,0BAA0B;IAKlC,OAAO,CAAC,yBAAyB;IAKjC,OAAO,CAAC,cAAc;IAatB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAMvD"}
@@ -48,16 +48,16 @@ export interface WebAnimationOptions {
48
48
  * Lifecycle:
49
49
  * 1. `play()` / `reverse()` calls `simulate()` from the current (position,
50
50
  * velocity) toward the target bound, producing a frame list.
51
- * 2. Frames are converted to WAAPI keyframes; `element.animate(...)` is held
52
- * at 0 ms until the pending pause is acknowledged and the browser has had
53
- * a rendering opportunity.
54
- * 3. Startup is advanced by a shared frame clock until two rendering
55
- * opportunities arrive without a long gap. Delayed mount work during
56
- * this startup window therefore cannot be charged to the document
57
- * timeline in one catch-up jump.
58
- * 4. Playback is handed to native WAAPI once rendering is stable, preserving
59
- * compositor playback for the remainder of the transition.
60
- * 5. While playing, `getPose()` interpolates the live position from frames
51
+ * 2. Frames are converted to WAAPI keyframes and `element.animate(...)`
52
+ * plays natively from the start. Its start time is pending until the
53
+ * browser's next rendering update, so main-thread work still queued in
54
+ * the current task (page mount effects, forced layout) is never charged
55
+ * to the animation. The effect applies while pending, which is why the
56
+ * inline start styles are cleared at once.
57
+ * 3. The run is seeked one nominal frame in before that first update, so a
58
+ * handoff from a moving element does not repeat the pose the previous
59
+ * frame already painted.
60
+ * 4. While playing, `getPose()` interpolates the live position from frames
61
61
  * using WAAPI's `currentTime`, so browser setup latency is not counted as
62
62
  * animation progress.
63
63
  *
@@ -81,11 +81,6 @@ export declare class WebAnimation extends Animation {
81
81
  private frames;
82
82
  private waapi;
83
83
  private runId;
84
- private waitingForStart;
85
- private startReady;
86
- private pendingFirstFrame;
87
- private stopStartupClock;
88
- private startupStableFrames;
89
84
  private running;
90
85
  private paused;
91
86
  private settled;
@@ -166,17 +161,16 @@ export declare class WebAnimation extends Animation {
166
161
  private bridgeKeyframes;
167
162
  private clearWaapi;
168
163
  private captureLiveState;
169
- private startFramePacedPlayback;
170
164
  /**
171
- * Inline start styles are cleared in the same rendering update as the first
172
- * seek, after the paused 0 ms WAAPI frame has had its own frame. Clearing
173
- * earlier can expose the underlying, unanimated style while the animation is
174
- * still pending.
165
+ * `Element.animate()` auto-plays with a pending start time that the browser
166
+ * resolves at its next rendering update, after whatever the current task
167
+ * still has to do. The run is seeked one nominal frame in while pending, so
168
+ * its first painted frame follows the frame that showed its first keyframe.
169
+ * A negative rate takes WAAPI's own auto-rewind: `play()` seeks to the end
170
+ * and runs the baked path backwards.
175
171
  */
176
- private clearStartStyles;
177
- private advanceFramePacedStartup;
178
- private handOffToWaapi;
179
- private finishFramePacedRun;
172
+ private beginPlayback;
173
+ private clearInlineStyle;
180
174
  private applyStyleAt;
181
175
  }
182
176
  //# sourceMappingURL=web-animation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAOhE,OAAO,EACL,SAAS,EAET,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,g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,CAAC,MAAM;IAad,IAAI,cAAc;;;;;;MAQjB;IAED,kFAAkF;IAClF,iBAAiB,IAAI,iBAAiB;IA8BtC,KAAK,CAAC,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,IAAI;IA4GlD,gFAAgF;IAChF,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,kBAAkB;IAgD1B;;;;;;OAMG;IACH,WAAW,IAAI,IAAI;IAInB,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,QAAQ,IAAI,MAAM,CAMrB;IAED,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAcrD,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAG5B;IAED,OAAO,IAAI,IAAI,EAAE;IAcjB,WAAW,IAAI,QAAQ,EAAE;IAczB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAU9B,OAAO,CAAC,SAAS;IAmFjB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IA0GvB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,gBAAgB;IAgBxB;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,YAAY;CAQrB"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Oe=Object.defineProperty;var Me=(t,e,n)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var M=(t,e,n)=>Me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-CtyacfH7.cjs"),b=require("./retain-opacity-C5ajTKSI.cjs"),S=require("./provider-JDtJ5Jzf.cjs"),z=require("./page-motion-Dhj3UfzO.cjs");class ae{constructor(e){M(this,"durationSec");this.durationSec=Math.max(1/60,e.durationSec)}step(e,n,o){const i=n-e.position;if(i===0)return e;const r=Math.sign(i),c=Math.abs(i)/this.durationSec,s=r*c*o,l=e.position+s;return(r>0?l>=n:l<=n)?{position:n,velocity:0}:{position:l,velocity:r*c}}isSettled(e,n){return Math.abs(e.position-n)<S.POSITION_THRESHOLD}}function Rt(t,e){function n(r){let c=0,s=0;const l=r.offsetWidth,a=r.offsetHeight;let d=r;for(;d;)c+=d.offsetTop,s+=d.offsetLeft,d=d.offsetParent;return c-=window.scrollY,s-=window.scrollX,{top:c,left:s,width:l,height:a}}const o=n(t),i=n(e);return new DOMRect(i.left-o.left,i.top-o.top,i.width,i.height)}function L(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=(s,l)=>l>0&&Math.abs(s-l)>.5?s/l:1,r=i(n.width,t.offsetWidth),c=i(n.height,t.offsetHeight);return new DOMRect((o.left-n.left)/r,(o.top-n.top)/c,o.width/r,o.height/c)}function N(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-i}}function ce(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y-i,height:n.clientHeight}}const Dt=8,Ft={spring:{stiffness:600,damping:40,doubleSpring:1.2}};function Te({direction:t}){const e=t==="forward"?Dt:-Dt;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${e}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${e*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function _e(){return{outPhysics:Ft,inPhysics:Ft,composition:{mode:"parallel",startAt:[0,0]},build:Te}}const Yt=30,ke={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},De={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function Fe({direction:t}){const e=t==="forward"?1:-1,n=-Yt*e,o=Yt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(${n*i}px, 0, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${o}px, 0, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(${o*(1-i)}px, 0, 0)`,opacity:`${i}`})}}}function Ye(){return{outPhysics:ke,inPhysics:De,composition:{mode:"sequence"},build:Fe}}const Le={snappy:_e(),fluid:Ye()},Lt=8,We={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},He={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function ze({direction:t}){const e=t==="forward"?1:-1,n=-Lt*e,o=Lt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(0, ${n*i}px, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${o}px, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(0, ${o*(1-i)}px, 0)`,opacity:`${i}`})}}}function Ne(){return{outPhysics:We,inPhysics:He,composition:{mode:"sequence"},build:ze}}const Ve=40,Xe={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},Be={spring:{stiffness:400,damping:30,doubleSpring:1.2,restDelta:.1,restSpeed:.1}};function Ue(t){const e=Ve;return{out:{willChange:"opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${e}px, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(0, ${e*(1-n)}px, 0)`,opacity:`${n}`})}}}function je(){return{outPhysics:Xe,inPhysics:Be,composition:{mode:"parallel",startAt:[0,0]},build:Ue}}const Wt=Ne(),Ze={snappy:Wt,directional:Wt,"non-directional":je()},Ht={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},lt=.1,dt=1/3,zt=t=>Math.max(0,Math.min(1,t));function Ge({direction:t}){const e=t==="forward"?1:-1,n=1-e*lt;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`scale(${1+e*o*lt})`,opacity:`${zt(1-o/dt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${n})`,opacity:"0"},animate:o=>({transform:`scale(${n+e*o*lt})`,opacity:`${zt((o-dt)/(1-dt))}`})}}}function qe(){return{outPhysics:Ht,inPhysics:Ht,composition:{mode:"parallel"},build:Ge}}const Nt={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},ut=.1,pt=1/3,Vt=t=>Math.max(0,Math.min(1,t));function Ke(){return{out:{willChange:"opacity",startStyle:{},animate:t=>({opacity:`${Vt(1-t/pt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-ut})`,opacity:"0"},animate:t=>({transform:`scale(${1-ut+t*ut})`,opacity:`${Vt((t-pt)/(1-pt))}`})}}}function Je(){return{outPhysics:Nt,inPhysics:Nt,composition:{mode:"parallel"},build:Ke}}const Xt=qe(),Qe={snappy:Xt,directional:Xt,"non-directional":Je()},tn={x:Le,y:Ze,z:Qe};function en(t,e){const n=tn[t];return n[e]??n.snappy}const nn="x",on="snappy";function Bt(t,e){t.style.willChange=e.willChange,t.style.backfaceVisibility="hidden",t.style.contain="layout paint";for(const[n,o]of Object.entries(e.startStyle))t.style[n]=o}function le(t){t.style.willChange="auto",t.style.backfaceVisibility="",t.style.contain="",t.style.transform="",t.style.opacity="",t.style.clipPath=""}function rn(t){le(t),t.style.pointerEvents=""}const sn=(t={})=>{const e=t.type??nn,n=t.feel??on,o=en(e,n),i=r=>{const c=o.build({direction:r});return{prepare:({from:s,to:l})=>(s.then(a=>{Bt(a,c.out),a.style.pointerEvents="none"}),l.then(a=>{Bt(a,c.in)}),{}),animation:({from:s,to:l,context:a})=>{if(e==="z"){const y=N(a,"from"),p=N(a,"to");s.style.clipPath=`inset(${y.top}px 0 calc(100% - ${y.top+y.height}px) 0)`,l.style.clipPath=`inset(${p.top}px 0 calc(100% - ${p.top+p.height}px) 0)`}const d=new b.WebAnimation({element:s,integrator:S.IntegratorProvider.from(o.outPhysics),style:y=>c.out.animate(y),onDispose:()=>rn(s)}),u=new b.WebAnimation({element:l,integrator:S.IntegratorProvider.from(o.inPhysics),style:y=>c.in.animate(y),onDispose:()=>le(l)});return new b.MultiAnimation({out:d,in:u},o.composition)}}};return v.defineTransition({forward:i("forward"),backward:i("backward")})};function an(t,e,n){return t==="y"?e==="non-directional"?"non-directional":"directional":t!=="x"||e==="snappy"||n==="snappy"?"snappy":"fluid"}function cn(t={},e={}){const n=t.type??"x",o=t.variant,i=t.feel,r=an(n,o,i);return v.withOverride(sn({type:n,feel:r}),e.override)}const ln={spring:{stiffness:200,damping:22}},dn=10,un="horizontal",pn="#000000";function Ut(t,e,n,o,i,r){window.getComputedStyle(t).position==="static"&&(t.style.position="relative");const s=document.createElement("div");s.style.cssText=`
1
+ "use strict";var Oe=Object.defineProperty;var Me=(t,e,n)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var M=(t,e,n)=>Me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-CtyacfH7.cjs"),b=require("./retain-opacity-5kqI1OCo.cjs"),S=require("./provider-JDtJ5Jzf.cjs"),z=require("./page-motion-Dhj3UfzO.cjs");class ae{constructor(e){M(this,"durationSec");this.durationSec=Math.max(1/60,e.durationSec)}step(e,n,o){const i=n-e.position;if(i===0)return e;const r=Math.sign(i),c=Math.abs(i)/this.durationSec,s=r*c*o,l=e.position+s;return(r>0?l>=n:l<=n)?{position:n,velocity:0}:{position:l,velocity:r*c}}isSettled(e,n){return Math.abs(e.position-n)<S.POSITION_THRESHOLD}}function Rt(t,e){function n(r){let c=0,s=0;const l=r.offsetWidth,a=r.offsetHeight;let d=r;for(;d;)c+=d.offsetTop,s+=d.offsetLeft,d=d.offsetParent;return c-=window.scrollY,s-=window.scrollX,{top:c,left:s,width:l,height:a}}const o=n(t),i=n(e);return new DOMRect(i.left-o.left,i.top-o.top,i.width,i.height)}function L(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=(s,l)=>l>0&&Math.abs(s-l)>.5?s/l:1,r=i(n.width,t.offsetWidth),c=i(n.height,t.offsetHeight);return new DOMRect((o.left-n.left)/r,(o.top-n.top)/c,o.width/r,o.height/c)}function N(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-i}}function ce(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y-i,height:n.clientHeight}}const Dt=8,Ft={spring:{stiffness:600,damping:40,doubleSpring:1.2}};function Te({direction:t}){const e=t==="forward"?Dt:-Dt;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${e}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${e*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function _e(){return{outPhysics:Ft,inPhysics:Ft,composition:{mode:"parallel",startAt:[0,0]},build:Te}}const Yt=30,ke={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},De={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function Fe({direction:t}){const e=t==="forward"?1:-1,n=-Yt*e,o=Yt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(${n*i}px, 0, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${o}px, 0, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(${o*(1-i)}px, 0, 0)`,opacity:`${i}`})}}}function Ye(){return{outPhysics:ke,inPhysics:De,composition:{mode:"sequence"},build:Fe}}const Le={snappy:_e(),fluid:Ye()},Lt=8,We={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},He={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function ze({direction:t}){const e=t==="forward"?1:-1,n=-Lt*e,o=Lt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(0, ${n*i}px, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${o}px, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(0, ${o*(1-i)}px, 0)`,opacity:`${i}`})}}}function Ne(){return{outPhysics:We,inPhysics:He,composition:{mode:"sequence"},build:ze}}const Ve=40,Xe={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},Be={spring:{stiffness:400,damping:30,doubleSpring:1.2,restDelta:.1,restSpeed:.1}};function Ue(t){const e=Ve;return{out:{willChange:"opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${e}px, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(0, ${e*(1-n)}px, 0)`,opacity:`${n}`})}}}function je(){return{outPhysics:Xe,inPhysics:Be,composition:{mode:"parallel",startAt:[0,0]},build:Ue}}const Wt=Ne(),Ze={snappy:Wt,directional:Wt,"non-directional":je()},Ht={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},lt=.1,dt=1/3,zt=t=>Math.max(0,Math.min(1,t));function Ge({direction:t}){const e=t==="forward"?1:-1,n=1-e*lt;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`scale(${1+e*o*lt})`,opacity:`${zt(1-o/dt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${n})`,opacity:"0"},animate:o=>({transform:`scale(${n+e*o*lt})`,opacity:`${zt((o-dt)/(1-dt))}`})}}}function qe(){return{outPhysics:Ht,inPhysics:Ht,composition:{mode:"parallel"},build:Ge}}const Nt={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},ut=.1,pt=1/3,Vt=t=>Math.max(0,Math.min(1,t));function Ke(){return{out:{willChange:"opacity",startStyle:{},animate:t=>({opacity:`${Vt(1-t/pt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-ut})`,opacity:"0"},animate:t=>({transform:`scale(${1-ut+t*ut})`,opacity:`${Vt((t-pt)/(1-pt))}`})}}}function Je(){return{outPhysics:Nt,inPhysics:Nt,composition:{mode:"parallel"},build:Ke}}const Xt=qe(),Qe={snappy:Xt,directional:Xt,"non-directional":Je()},tn={x:Le,y:Ze,z:Qe};function en(t,e){const n=tn[t];return n[e]??n.snappy}const nn="x",on="snappy";function Bt(t,e){t.style.willChange=e.willChange,t.style.backfaceVisibility="hidden",t.style.contain="layout paint";for(const[n,o]of Object.entries(e.startStyle))t.style[n]=o}function le(t){t.style.willChange="auto",t.style.backfaceVisibility="",t.style.contain="",t.style.transform="",t.style.opacity="",t.style.clipPath=""}function rn(t){le(t),t.style.pointerEvents=""}const sn=(t={})=>{const e=t.type??nn,n=t.feel??on,o=en(e,n),i=r=>{const c=o.build({direction:r});return{prepare:({from:s,to:l})=>(s.then(a=>{Bt(a,c.out),a.style.pointerEvents="none"}),l.then(a=>{Bt(a,c.in)}),{}),animation:({from:s,to:l,context:a})=>{if(e==="z"){const y=N(a,"from"),p=N(a,"to");s.style.clipPath=`inset(${y.top}px 0 calc(100% - ${y.top+y.height}px) 0)`,l.style.clipPath=`inset(${p.top}px 0 calc(100% - ${p.top+p.height}px) 0)`}const d=new b.WebAnimation({element:s,integrator:S.IntegratorProvider.from(o.outPhysics),style:y=>c.out.animate(y),onDispose:()=>rn(s)}),u=new b.WebAnimation({element:l,integrator:S.IntegratorProvider.from(o.inPhysics),style:y=>c.in.animate(y),onDispose:()=>le(l)});return new b.MultiAnimation({out:d,in:u},o.composition)}}};return v.defineTransition({forward:i("forward"),backward:i("backward")})};function an(t,e,n){return t==="y"?e==="non-directional"?"non-directional":"directional":t!=="x"||e==="snappy"||n==="snappy"?"snappy":"fluid"}function cn(t={},e={}){const n=t.type??"x",o=t.variant,i=t.feel,r=an(n,o,i);return v.withOverride(sn({type:n,feel:r}),e.override)}const ln={spring:{stiffness:200,damping:22}},dn=10,un="horizontal",pn="#000000";function Ut(t,e,n,o,i,r){window.getComputedStyle(t).position==="static"&&(t.style.position="relative");const s=document.createElement("div");s.style.cssText=`
2
2
  position: absolute;
3
3
  top: 0;
4
4
  left: 0;
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@ var ke = Object.defineProperty;
2
2
  var De = (t, e, n) => e in t ? ke(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var _ = (t, e, n) => De(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { d as k, w as D } from "./index-B_K3Vnj-.js";
5
- import { W as w, M as I, r as ot } from "./retain-opacity-ChyA_fg_.js";
6
- import { A as ur } from "./retain-opacity-ChyA_fg_.js";
5
+ import { W as w, M as I, r as ot } from "./retain-opacity-Bp_Y__-B.js";
6
+ import { A as ur } from "./retain-opacity-Bp_Y__-B.js";
7
7
  import { P as Fe, I as x, S as vt, b as Me, d as Pt, a as Te, D as Ye } from "./provider-BLf6XeXT.js";
8
8
  import { F as Le, a as He, p as it, S as ze } from "./page-motion-CoPTk-Gd.js";
9
9
  class Ne {
package/dist/internal.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var kt=Object.defineProperty;var Tt=(t,n,e)=>n in t?kt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var K=(t,n,e)=>Tt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("./resolve-transition-rule-BL12rDDu.cjs"),G=require("./retain-opacity-C5ajTKSI.cjs"),He=require("./provider-JDtJ5Jzf.cjs");function oe(t){return[...t.getMotionTracks()]}class dt extends G.Animation{constructor(){super(...arguments);K(this,"child",null);K(this,"run",null);K(this,"retiring",[]);K(this,"owners",new WeakMap);K(this,"epoch",0);K(this,"prepared",null);K(this,"_state","idle");K(this,"_settled",!1);K(this,"listeners",new Set);K(this,"onHandoff")}prepareHandoff(){var e;if(!this.prepared){this.prepared=this.sceneSnapshots(),(e=this.child)==null||e.pause();for(const s of this.retiring)for(const l of s.releases)l.pause()}}attach(e,s={}){var L;if(this.child===e)return;e.validate();const l=this.run,r=this.prepared??this.sceneSnapshots();this.prepared=null;const h=++this.epoch,c=oe(e),v=r.filter(u=>u.lifetime!=="temporary"&&!c.some(o=>o.element===u.target)&&(s.targets??[]).some(o=>{var a;return o===u.target||((a=o.contains)==null?void 0:a.call(o,u.target))})&&("transform"in u.channels||"opacity"in u.channels)).map(u=>{const o=u.target,a={transform:o.style.transform,opacity:o.style.opacity},w=o.style.opacity||1;return new G.WebAnimation({element:o,integrator:new He.SpringIntegrator({stiffness:200,damping:24}),style:()=>({transform:"none",opacity:w}),motion:{key:u.key,role:u.role,space:u.space},onDispose:()=>{!a.transform&&o.style.transform==="none"&&(o.style.transform=""),!a.opacity&&String(o.style.opacity)===String(w)&&(o.style.opacity="")}})});if(v.length){const u=e.onDispose;e.onDispose=void 0,e=new G.MultiAnimation({effect:e,restore:new G.MultiAnimation(v)}),e.onDispose=u}const g=oe(e),m=new Set([...s.targets??[],...g.map(u=>u.element)]);for(const u of s.targets??[])this.owners.set(u,h);for(const u of c)this.owners.set(u.element,h);this.child=e;const d={animation:e,epoch:h,targets:m,hidden:[]};this.run=d,this._settled=!1;const y=[];if(e.supportsInterruption&&(!l||l.animation.supportsInterruption)){const u=He.matchMotion(r,g.map(o=>o.motionIdentity));u.forEach((o,a)=>{y.push({kind:o.reason,target:o.next.target,key:o.next.key}),o.previous&&g[a].adopt(o.previous),g[a].handoffFallbacks.length&&y.push({kind:"fallback",target:o.next.target,channels:g[a].handoffFallbacks,fallback:g[a].handoffFallbackMode})});for(const o of u){if(!o.previous||o.previous.target===o.next.target)continue;if(o.previous.lifetime==="temporary"){o.previous.target.remove();continue}const a=G.retainOpacity(o.previous.target);a.set(0),d.hidden.push(a.restore)}for(const o of[...this.retiring]){for(const a of o.releases)(m.has(a.element)||u.some(C=>{var W;return((W=C.previous)==null?void 0:W.target)===a.element}))&&a.cancel({reason:"interrupted",owns:()=>!1});o.releases=o.releases.filter(a=>a.isAnimating||a.isPaused),o.releases.length||this.disposeRetiring(o)}l&&this.retire(l,r,new Set([...m,...u.flatMap(o=>o.previous?[o.previous.target]:[])]),y)}else if(l){y.push({kind:"fallback"});const u=[...m].map(o=>[o,o.style.cssText]);l.animation.complete();for(const[o,a]of u)o.style.cssText=a}e.playbackRate=this.playbackRate;const E=e.onDispose;e.onDispose=u=>{try{E==null||E(u)}finally{for(const o of d.hidden.splice(0))o()}};const O=e.onComplete;e.onComplete=()=>{O==null||O(),this.child===e&&(this.child=null,this.run=null,this._state="idle",this._settled=this.retiring.length===0),this.notify()};const M=e.onUpdate;e.onUpdate=u=>{var o;M==null||M(u),this.child===e&&((o=this.onUpdate)==null||o.call(this,u),this.notify())},this._state==="paused"?e.pause():(this._state="playing",e.play());for(const u of this.retiring)for(const o of u.releases)this._state!=="paused"&&o.isPaused&&o.play();(L=this.onHandoff)==null||L.call(this,y),this.notify()}sceneSnapshots(){return[...this.child?oe(this.child).map(e=>e.getMotionSnapshot()):[],...this.run?[...this.run.targets].filter(e=>!oe(this.run.animation).some(s=>s.element===e)).map(e=>({target:e,channels:G.createWebPresentationCodec(e).read({transform:typeof getComputedStyle=="function"&&getComputedStyle(e).transform||"none",opacity:typeof getComputedStyle=="function"&&getComputedStyle(e).opacity||"1"})})):[],...this.retiring.flatMap(e=>e.releases.map(s=>s.getMotionSnapshot()))]}disposal(e){return{reason:"interrupted",owns:s=>!this.owners.has(s)||this.owners.get(s)===e.epoch}}retire(e,s,l,r){var g,m,d;e.animation.stop();const h=oe(e.animation),c={...e,releases:[]},v=new Set([...e.targets,...l]);for(const y of e.targets){if(l.has(y)||[...v].some(a=>{var w;return a!==y&&((w=a.contains)==null?void 0:w.call(a,y))}))continue;const E=s.find(a=>a.target===y);if(!E||((g=h.find(a=>a.element===y))==null?void 0:g.motion.release)==="remove")continue;const O=(m=h.find(a=>a.element===y))==null?void 0:m.motion.release;if(typeof O=="function")try{const a=O(E);if(a.element!==y)throw new Error("Release must own the retiring target");a.validate();const w=a.onComplete;a.onComplete=()=>{w==null||w(),c.releases.every(C=>C.isComplete)&&this.disposeRetiring(c)},a.adopt(E),a.playbackRate=this.playbackRate,c.releases.push(a),r.push({kind:"release",target:y});continue}catch(a){console.error("[ssgoi] invalid release; using fade",a),r.push({kind:"fallback",target:y})}const L=G.createWebPresentationCodec(y).write(E.channels),u=Number(L.opacity??1),o=new G.WebAnimation({element:y,integrator:{step:(a,w,C)=>({position:Math.min(w,a.position+C/.18),velocity:a.position>=w?0:1/.18}),isSettled:(a,w)=>a.position>=w},style:(a,w)=>({...L,opacity:u*w}),motion:{...(d=h.find(a=>a.element===y))==null?void 0:d.motion,handoffDuration:180},onComplete:()=>{c.releases.every(a=>a.isComplete)&&this.disposeRetiring(c)}});o.adopt(E),o.playbackRate=this.playbackRate,c.releases.push(o),r.push({kind:"release",target:y})}if(!c.releases.length){e.animation.cancel(this.disposal(e));return}this.retiring.push(c);for(const y of c.releases)y.play(),this._state==="paused"&&y.pause();for(;this.retiring.length>8;)this.disposeRetiring(this.retiring[0])}disposeRetiring(e){if(this.retiring.includes(e)){this.retiring=this.retiring.filter(s=>s!==e);for(const s of e.releases)s.cancel({reason:"disposed",owns:()=>!1});e.animation.cancel(this.disposal(e)),!this.child&&!this.retiring.length&&(this._settled=!0),this.notify()}}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.play();for(const s of this.retiring)for(const l of s.releases)l.play();this.notify()}reverse(){var e;this._state="reversing",this._settled=!1,(e=this.child)==null||e.reverse(),this.notify()}pause(){var e;this._state="paused",(e=this.child)==null||e.pause();for(const s of this.retiring)for(const l of s.releases)l.pause();this.notify()}complete(){var e;this.prepared=null,(e=this.child)==null||e.complete();for(const s of[...this.retiring])this.disposeRetiring(s);this.notify()}cancel(e){this.prepared=null;const s=this.child;this.child=null,this.run=null,this._state="idle",s==null||s.cancel(e);for(const l of[...this.retiring])this.disposeRetiring(l);this._settled=!0,this.notify()}get isAnimating(){var e;return!!((e=this.child)!=null&&e.isAnimating)||this.retiring.some(s=>s.releases.some(l=>l.isAnimating))}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child&&!this.retiring.length}get isReversing(){var e;return((e=this.child)==null?void 0:e.isReversing)??this._state==="reversing"}get progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var s;return((s=this.child)==null?void 0:s.findTimeForProgress(e))??null}get playbackRate(){return super.playbackRate}set playbackRate(e){super.playbackRate=e,this.child&&(this.child.playbackRate=e);for(const s of this.retiring)for(const l of s.releases)l.playbackRate=e;this.notify()}getPose(){var e;return((e=this.child)==null?void 0:e.getPose())??[]}getTimeline(){var e;return((e=this.child)==null?void 0:e.getTimeline())??[]}matchInto(e){var s;(s=this.child)==null||s.matchInto(e)}get activeChild(){return this.child}get retiringCount(){return this.retiring.length}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Pt=(t,n)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=n==null?void 0:n.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},tt=new Set(["auto","scroll","overlay"]),Rt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(tt.has(e.overflowY)||tt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Mt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return n;n=n.parentElement}return document.body};function xt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const s={};return n.forEach((l,r)=>{s[l]=e[r]}),s})}const Oe=new WeakMap;function Ct(t){let n=Oe.get(t);if(!n){const s=t.ownerDocument,r=t===s.documentElement||t===s.scrollingElement?s:t,h=m=>{m.type==="wheel"&&m.ctrlKey||m.type==="touchmove"&&m.touches.length>1||m.cancelable&&m.preventDefault()},c={passive:!1,capture:!0};r.addEventListener("wheel",h,c),r.addEventListener("touchmove",h,c);const v=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," "]),g=m=>{var y,E;const d=m;if(!(d.defaultPrevented||d.altKey||!v.has(d.key))){for(const O of d.composedPath()){const M=O;if(M.isContentEditable||(y=M.matches)!=null&&y.call(M,"input, textarea, select, [role=slider], [role=spinbutton], [role=listbox], [role=menu], [role=tablist]")||d.key===" "&&((E=M.matches)!=null&&E.call(M,"button, [role=button]")))return}d.cancelable&&d.preventDefault()}};r.addEventListener("keydown",g,{capture:!0}),n={owners:0,restore(){r.removeEventListener("wheel",h,{capture:!0}),r.removeEventListener("touchmove",h,{capture:!0}),r.removeEventListener("keydown",g,{capture:!0})}},Oe.set(t,n)}n.owners++;let e=!1;return()=>{e||(e=!0,--n.owners===0&&(Oe.delete(t),n.restore()))}}const At=768,Ot=10,Dt=10;function Lt(t={}){const{resolvePath:n=b=>b}=t;let e=null,s=null;const l=new Set,r=b=>{const k=b&&e?Ct(e):()=>{},_=()=>{l.delete(_)&&k()};return l.add(_),_};let h=!1,c=!1;const v=()=>{const b=(e==null?void 0:e.clientWidth)??0,k=b>0?b:typeof window<"u"?window.innerWidth:0;return k>0&&k<At},g=()=>(c||(h=v(),c=!0),h),m=b=>`path:${n(b)}`;let d=null;const y=new Map;let E=null,O=!1,M=0,L=0,u=0;const o=()=>{e&&E&&!O&&!l.size&&y.set(m(E),{x:e.scrollLeft,y:e.scrollTop})},a=(b,k,_)=>{if(!e)return;const D=++L,N=m(b),A=k&&y.has(N)?y.get(N):{x:0,y:0};let H=0;const B=()=>{if(!e||_!==M||D!==L)return;k||y.set(N,A),e.scrollTo({top:A.y,left:A.x,behavior:"instant"}),!(Math.abs(e.scrollTop-A.y)<1&&Math.abs(e.scrollLeft-A.x)<1)&&H<Ot&&(H++,requestAnimationFrame(B))};requestAnimationFrame(B)};return{beginTransition:r,disconnect(){++M,++L;for(const b of l)b();e&&(e===document.documentElement?window:e).removeEventListener("scroll",o),s==null||s.disconnect(),s=null,e=null,d=null,E=null,c=!1},initializeContext:(b,k,_)=>{O=!0;const D=E===k?M:++M;d=b,e||(e=Rt(b),h=v(),c=!0,typeof ResizeObserver<"u"&&(s=new ResizeObserver(()=>{h=v()}),s.observe(e)),(e===document.documentElement?window:e).addEventListener("scroll",o,{passive:!0})),E=k;const N=m(k),A=y.get(N),H=ee=>{D===M&&(u=D,ee&&A&&y.set(N,A),a(k,ee,D))};_!==void 0?H(_):requestAnimationFrame(()=>{u!==D&&D===M&&H(!1)});let B=0;const V=()=>{D===M&&(B++,B>=Dt?O=!1:requestAnimationFrame(V))};return requestAnimationFrame(V),H},calculateScrollOffset:(b,k,_=!1)=>{const D=b?m(b):null,N=D&&y.has(D)?y.get(D):{x:0,y:0},A=k&&_?m(k):null,H=A&&y.has(A)?y.get(A):{x:0,y:0};return{x:-H.x+N.x,y:-H.y+N.y}},evictScrollPosition:b=>{y.delete(m(b))},getScrollContainer:()=>e,getPositionedParentElement:()=>d?Mt(d):document.body,getScrollPosition:(b,k=!0)=>{if(!k)return{x:0,y:0};const _=b?m(b):null;return _&&y.has(_)?y.get(_):{x:0,y:0}},getIsMobile:g}}const nt=30,st=8,ot=1.2,rt=30,_t=600;function Ht(){let t=null,n=!1,e=!1,s=null,l=null,r=!1;const h=(o,a)=>{for(let w=0;w<o.length;w++){const C=o.item(w);if(C&&C.identifier===a)return C}return null},c=()=>{s!==null&&(clearTimeout(s),s=null)},v=()=>{l!==null&&(clearTimeout(l),l=null)},g=()=>{n=!0,e=!0,c(),v(),s=setTimeout(()=>{n=!1,e=!1,s=null},_t)},m=o=>{if(o.touches.length!==1){t=null;return}const a=o.touches.item(0);if(!a){t=null;return}const w=window.innerWidth,C=a.clientX<=nt,W=a.clientX>=w-nt;if(!C&&!W){t=null;return}t={identifier:a.identifier,startX:a.clientX,startY:a.clientY,fromLeftEdge:C,moved:!1}},d=o=>{if(!t)return;if(o.touches.length!==1){t=null;return}const a=h(o.touches,t.identifier);if(!a){t=null;return}const w=a.clientX-t.startX,C=a.clientY-t.startY,W=Math.abs(w),Y=Math.abs(C);if(Y>st&&Y>W*ot){t=null;return}const ie=t.fromLeftEdge?w>0:w<0;W>st&&W>Y*ot&&ie&&(t.moved=!0)},y=o=>{if(!t)return;const a=h(o.changedTouches,t.identifier);if(!a){t=null;return}const w=a.clientX-t.startX,C=t.fromLeftEdge?w>0:w<0;if(t.moved&&C&&Math.abs(w)>=rt){g(),t=null;return}t.moved&&Math.abs(w)>=rt&&g(),t=null},E=()=>{t&&(t.moved&&g(),t=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const o={passive:!0,capture:!0};window.addEventListener("touchstart",m,o),window.addEventListener("touchmove",d,o),window.addEventListener("touchend",y,o),window.addEventListener("touchcancel",E,o)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const o={capture:!0};window.removeEventListener("touchstart",m,o),window.removeEventListener("touchmove",d,o),window.removeEventListener("touchend",y,o),window.removeEventListener("touchcancel",E,o),c(),v(),t=null,n=!1,e=!1},isSwipeBack:()=>{const o=n||e;return o&&c(),o},onPageEnter:()=>{n=!1,c(),v(),l=setTimeout(()=>{e=!1,l=null},0)}}}const it="__ssgoi_entry_v1",De=new WeakMap,pt={read:()=>null,previous:()=>null,dispose(){}};function It(){if(typeof window>"u")return pt;const t=window.navigation,n=window;let e=De.get(n);e||(e=Nt(n,t),De.set(n,e)),e.users++;const s=e;let l=!1;return{read:s.read,previous:s.previous,dispose(){l||(l=!0,--s.users===0&&(s.dispose(),De.delete(n)))}}}function lt(t){return t&&typeof t.key=="string"&&typeof t.url=="string"&&Number.isSafeInteger(t.index)&&t.index>=0?{key:t.key,index:t.index,url:t.url}:null}function Le(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype}function Nt(t,n){var L;const e=t.history,s=e.pushState,l=e.replaceState,r=`${Date.now()}-${Math.random().toString(36).slice(2)}-`;let h=0,c=!0,v=null,g=null;const m=()=>{const u=lt(n==null?void 0:n.currentEntry);return(u==null?void 0:u.url)===t.location.href?u:null},d=()=>{const u=e.state,o=Le(u)?u[it]:null;return!Le(o)||typeof o.key!="string"||!o.key.startsWith(r)||!Number.isSafeInteger(o.index)?m():{key:o.key,index:o.index,url:t.location.href}},y=(u,o)=>u!==null&&!Le(u)?u:{...u,[it]:o},E=u=>({key:`${r}${++h}`,index:u});try{l.call(e,y(e.state,E(((L=m())==null?void 0:L.index)??0)),"")}catch{return{...pt,read:m,users:0}}const O=function(u,o,a){var W;if(!c)return s.call(this,u,o,a);const w=d(),C=E(((w==null?void 0:w.index)??0)+1);s.call(this,y(u,C),o,a),v=w,g=((W=d())==null?void 0:W.key)??null},M=function(u,o,a){if(!c)return l.call(this,u,o,a);const w=d();l.call(this,y(u,w??E(0)),o,a)};return e.pushState=O,e.replaceState=M,{users:0,read:d,previous:()=>{var o;if(((o=d())==null?void 0:o.key)===g)return v;const u=m();return u?lt(n==null?void 0:n.entries().find(a=>a.index===u.index-1)):null},dispose(){c=!1,e.pushState===O&&(e.pushState=s),e.replaceState===M&&(e.replaceState=l)}}}function Wt(){let t=null,n=null;const e=new Set,s=r=>{r&&e.add(r.key),e.size>200&&e.delete(e.values().next().value)},l=()=>{t||(t=It(),n=t.read(),s(n))};return{connect:l,resolve(r,h){l();const c=t.read();let v=n,g="unknown";if(v&&c&&(c.key===v.key||c.index===v.index?g="replace":c.index<v.index?g="back":g=e.has(c.key)?"forward":"push"),g==="push"){const m=t.previous();m&&m.index===c.index-1&&_e.normalizePath(new URL(m.url).pathname)===_e.normalizePath(r)&&(v=m)}return n=c,s(v),s(c),{kind:g,direction:g==="back"?"backward":"forward",from:v,to:c}},dispose(){t==null||t.dispose(),t=null,n=null,e.clear()}}}function Ft(){const t=Wt(),n=new Map;return{connect:t.connect,resolve(e,s,l){var g,m;const r=t.resolve(e,s),h=(g=r.from)==null?void 0:g.key,c=(m=r.to)==null?void 0:m.key;if(r.kind==="back"&&h&&c){const d=n.get(h);if((d==null?void 0:d.source)===c&&d.from===s&&d.to===e)return d.rule?{...d.rule,direction:d.rule.direction==="forward"?"backward":"forward",preserveScroll:{from:d.rule.preserveScroll.to,to:d.rule.preserveScroll.from}}:null}if(r.kind==="forward"&&h&&c){const d=n.get(c);if((d==null?void 0:d.source)===h&&d.from===e&&d.to===s)return d.rule}const v=l(r.direction);if(c&&r.kind==="replace"&&n.delete(c),c&&h&&r.kind==="push"){for(const[d,y]of n)y.index>=r.to.index&&n.delete(d);n.set(c,{source:h,index:r.to.index,from:e,to:s,rule:v?{...v,preserveScroll:{...v.preserveScroll}}:null}),n.size>100&&n.delete(n.keys().next().value)}return v},dispose(){t.dispose(),n.clear()}}}function Bt(t={}){let n=null,e=null;function s(){var r,h;n&&((r=n.out)==null||r.resolve(null),(h=n.in)==null||h.resolve(null),n=null)}function l(){if(n!=null&&n.out&&n.in){if(n.out.path===n.in.path){s();return}const r={from:n.out.path,to:n.in.path,out:n.out.payload,in:n.in.payload};e=r,n.out.resolve(r),n.in.resolve(r),n=null}}return{arrive(r,h,c){return new Promise(v=>{var y,E;const g=e===null?null:h==="out"?{path:e.from,payload:e.out}:{path:e.to,payload:e.in};if((g==null?void 0:g.path)===r){v(null);return}h==="out"&&((y=n==null?void 0:n.in)==null?void 0:y.path)===r&&!n.out&&(n.in.resolve(null),n.in=void 0);const m=n==null?void 0:n[h];m&&m.path!==r&&s(),n||(n={});const d=n[h];if(d){if(((E=t.keepCurrent)==null?void 0:E.call(t,{type:h,path:r,current:d.payload,next:c}))??!1){v(null);return}d.resolve(null)}n[h]={path:r,payload:c,resolve:v},l()})},cancel(r){(n!=null&&n.out&&r(n.out.payload)||n!=null&&n.in&&r(n.in.payload))&&s(),(e&&r(e.out)||e&&r(e.in))&&(e=null)}}}const zt={},Q=new Map;let we=null,at=!1;function ht(t,n,e){t instanceof HTMLElement&&Q.has(t)&&!t.isConnected&&e.set(t,{entry:Q.get(t),anchor:n});for(const s of Array.from(t.childNodes))ht(s,n,e)}function Gt(t){const n=new Set(Array.from(t.values(),({entry:e})=>e));for(const[e,{entry:s,anchor:l}]of t){Q.delete(e);let r=s.parent,h=!1;for(;r;){if(r.group===s.group&&n.has(r)){h=!0;break}r=r.parent}queueMicrotask(()=>s.callback(l,{emit:!h}))}}function Kt(){if(at||typeof document>"u")return;at=!0,we=new MutationObserver(n=>{const e=new Map;for(const s of n){const l={parent:s.target,nextSibling:s.nextSibling};for(const r of Array.from(s.removedNodes))ht(r,l,e)}Gt(e)});const t=()=>{we==null||we.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Ut(t,n,e=zt){Kt();let s=t.parentElement,l=null;for(;s;){const r=Q.get(s);if((r==null?void 0:r.group)===e){l=r;break}s=s.parentElement}return Q.set(t,{element:t,callback:n,group:e,parent:l}),()=>{Q.delete(t)}}const Ie=new WeakMap;let be=null;const Se="none !important";function re(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function Xt(){return be||(be=new MutationObserver(t=>{for(const n of t){const e=n.target,s=Ie.get(e);if(!s)continue;const l=re(e);l!==s.accounted&&(s.accounted=l,l===Se?(s.reactHidden=!0,s.onHide()):l!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),be)}function qt(t,n){const e=re(t),s={accounted:e,reactHidden:e===Se,onHide:n.onHide,onShow:n.onShow};return Ie.set(t,s),Xt().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return re(t)===Se},setDisplay(l,r=!1){l===null?t.style.removeProperty("display"):t.style.setProperty("display",l,r?"important":""),s.accounted=re(t)},sync(){s.accounted=re(t),s.reactHidden=s.accounted===Se},stop(){Ie.delete(t)}}}const $t=5e3;function Vt(t,n={}){const{transitions:e=[],middleware:s=(i,f)=>({from:i,to:f})}=t,l=n.host??new dt,r={},h=Bt({keepCurrent:({current:i,next:f})=>i.element.contains(f.element)}),c=Ft(),v=typeof e=="function"?e:()=>e,g=Ht();g.initialize();const m=new Map,d=i=>{let f=m.get(i);return f===void 0&&(f=s(i,i).from,m.set(i,f)),f},{initializeContext:y,beginTransition:E,disconnect:O,calculateScrollOffset:M,evictScrollPosition:L,getScrollContainer:u,getPositionedParentElement:o,getScrollPosition:a,getIsMobile:w}=Lt({resolvePath:d}),C=new Map,W=()=>{const i=w();let f=C.get(i);return f||(f=v({isMobile:i}),C.set(i,f)),f},Y=new WeakMap,ie=i=>{Y.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},le=i=>{const f=Y.get(i);return f||{parent:i.parentNode,nextSibling:i.nextSibling}},b=new WeakMap,k=new WeakMap;let _=0,D=0,N=null,A=null,H=!1;const B=new WeakMap,V=()=>{D++,N==null||N.abort(),A==null||A(),A=null},ee=i=>{const f=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return f&&f!=="none"?f:"block"},ae=(i,f)=>{f.visibleDisplay=i.style.getPropertyValue("display"),f.computedDisplay=ee(i)},ke=(i,f)=>{if(k.get(i)!==f)return;k.delete(i);const p=b.get(i);p&&(p.savedCss!==null&&(i.style.cssText=p.savedCss,p.savedCss=null),p.intent==="hidden"?p.vis.setDisplay("none",!0):p.visibleDisplay?(p.vis.setDisplay(p.visibleDisplay,!1),ae(i,p)):(p.vis.setDisplay(null),ae(i,p)))},Te=(i,f)=>{if(i.mode!=="hidden")return;const p=Array.from(new Set([i.element,f==null?void 0:f.element].filter(Boolean))),I=++_;for(const S of p)k.set(S,I);l.complete();for(const S of p)ke(S,I)};let te=0;const yt=(i,f,p,I,S,T,z)=>{var $e;const P=S.element,x=T.element,$=++_;k.set(x,$),k.set(P,$);const de=E(t.scrollLock!==!1);V();const J=D;N=new AbortController;const j=N.signal;l.prepareHandoff();for(const R of[P,x])B.has(R)||B.set(R,(($e=b.get(R))==null?void 0:$e.savedCss)??R.style.cssText);const pe=(S.mode??"unmount")==="hidden",{parent:he,nextSibling:Re}=S.parent?{parent:S.parent,nextSibling:S.nextSibling}:le(P),me=M(p,I,z.to),ye={direction:f,scrollOffset:me,from:{scroll:a(p)},to:{scroll:a(I,z.to)},get scrollingElement(){return u()||document.documentElement},get positionedParent(){return o()}};let F;if(pe){F=P,F.style.top=`${-1*((me==null?void 0:me.y)??0)}px`;const R=b.get(x);R&&R.savedCss===null&&(R.savedCss=x.style.cssText)}else F=P,Pt(F,ye);z.from||L(p);const Be=Promise.resolve(F),ze=Promise.resolve(x),Me=[],Ge=[];let xe=!1;const ge=()=>{if(!xe){xe=!0;for(const R of Ge)try{R()}catch(U){console.error("[ssgoi] prepare cleanup",U)}for(const R of Me)R.remove()}},bt={from:Be,to:ze,context:ye,createElement:((R,U="div")=>{const se=document.createElement(U);return se.setAttribute("data-ssgoi-id",R),Me.push(se),se}),signal:j,onCleanup:R=>{xe?R():Ge.push(R)}};let Ke=!1,ne=!1;const ve=()=>{ne||(ne=!0,clearTimeout(qe),ge(),de())},Ue=()=>{for(const R of[P,x]){if(k.get(R)!==$)continue;const U=B.get(R);U!==void 0&&(R.style.cssText=U),B.delete(R),ke(R,$)}};A=()=>{ge(),Ue(),ve()};const Xe=R=>{ge();const U=ne||j.aborted||H||J!==D;if(A&&J===D&&(A=null),U){ve();return}l.cancel({reason:"disposed",owns:()=>!0}),Ue(),pe||F.remove(),ve(),console.error("[SSGOI] Page transition failed",R)},qe=setTimeout(()=>{Ke||ne||Xe(new Error("Page transition preparation timed out"))},$t),St=Promise.resolve().then(()=>j.aborted?{}:i.prepare?i.prepare(bt):{});xt({from:Be,to:ze,extras:St}).then(({from:R,to:U,extras:se})=>{var je,Ze,Je,Qe;if(ne||j.aborted||H||J!==D){ge();return}Ke=!0,clearTimeout(qe),A=null,!pe&&he&&(Re&&he.contains(Re)?he.insertBefore(F,Re):he.appendChild(F));const Z=i.animation({from:R,to:U,context:ye,...se}),Et=Z.getMotionTracks();for(const X of Et)Me.includes(X.element)&&((je=X.motion).lifetime??(je.lifetime="temporary"),(Ze=X.motion).role??(Ze.role="overlay"),(Je=X.motion).key??(Je.key=X.element.getAttribute("data-ssgoi-id")??void 0),(Qe=X.motion).space??(Qe.space=ye.positionedParent));const Ce=Z.onDispose;let Ve=!1;const Ye=X=>{if(!Ve){Ve=!0;try{Ce==null||Ce(X)}catch(q){console.error("[ssgoi] effect cleanup failed",q)}try{for(const q of[P,x]){if(k.get(q)!==$||!X.owns(q))continue;const et=B.get(q);et!==void 0&&(q.style.cssText=et),B.delete(q),b.has(q)?ke(q,$):k.delete(q)}!pe&&X.owns(F)&&F.parentNode&&!k.has(F)&&F.parentNode.removeChild(F)}finally{ve()}}};Z.onDispose=Ye;const Ae=Z.onComplete;Z.onComplete=()=>{try{Ae==null||Ae()}finally{Z.supportsInterruption||Ye(G.finishedDisposal)}},l.attach(Z,{targets:[P,x]})}).catch(Xe)},ce=(i,f,p)=>{if(H)return;const I=te,S=g.isSwipeBack();h.arrive(i,f,p).then(T=>{var $,de,J,j;if(H||I!==te)return;if(f==="in"&&g.onPageEnter(),!T){f==="out"&&Te(p);return}if(f!=="in")return;const{from:z,to:P}=s(T.from,T.to),x=c.resolve(T.from,T.to,Fe=>_e.resolveTransitionRule(z,P,W(),Fe));if(!x){(de=($=T.in).applyScrollPolicy)==null||de.call($,!1),L(T.from),V(),Te(T.out,T.in),l.complete();return}if((j=(J=T.in).applyScrollPolicy)==null||j.call(J,x.preserveScroll.to),S){x.preserveScroll.from||L(T.from),V(),Te(T.out,T.in),l.complete();return}yt(x.transition,x.direction,T.from,T.to,T.out,T.in,x.preserveScroll)})},gt=(i,f)=>{const p=b.get(i);if(!p)return;const I=p.intent==="hidden";if(p.intent="hidden",p.savedCss===null&&(p.savedCss=i.style.cssText),p.vis.setDisplay(p.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",I)return;const S=le(i),T={element:i,parent:S.parent,nextSibling:S.nextSibling,mode:"hidden"},z=p.pendingOutPath??p.currentPath??f;p.pendingOutPath=null,ce(z,"out",T)},vt=(i,f)=>{const p=b.get(i);if(!p||p.intent==="visible")return;p.intent="visible",p.currentPath=i.getAttribute("data-ssgoi-transition")??p.currentPath??f,p.pendingOutPath=null,p.pathRevision++,ae(i,p),p.savedCss!==null&&(i.style.cssText=p.savedCss,p.visibleDisplay?p.vis.setDisplay(p.visibleDisplay,!1):p.vis.setDisplay(null));const I=p.currentPath,S=y(i,I),T={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling,applyScrollPolicy:S};ce(I,"in",T)},wt=(i,f,p,I=!0)=>{const S=b.get(i);fe.delete(i);const T=(S==null?void 0:S.pendingOutPath)??(S==null?void 0:S.currentPath)??f;if(S&&(S.vis.stop(),ue.delete(S.vis),b.delete(i),k.delete(i),S.intent==="hidden")){h.cancel(x=>x.element===i);return}if(!I)return;const z=p??le(i),P={element:i,parent:z.parent,nextSibling:z.nextSibling,mode:"unmount"};ce(T,"out",P)};let Pe=new WeakSet;const ue=new Set,fe=new Map,Ne=(i,f,{enter:p=!0}={})=>{if(H=!1,c.connect(),g.initialize(),Pe.has(f)){const P=b.get(f);if(P&&P.currentPath!==i){P.intent==="visible"&&P.pendingOutPath===null&&(P.pendingOutPath=P.currentPath),P.currentPath=i;const x=++P.pathRevision;queueMicrotask(()=>{P.pathRevision===x&&(P.pendingOutPath=null)})}return}Pe.add(f);const I=te;ie(f);const S=qt(f,{onHide:()=>gt(f,i),onShow:()=>vt(f,i)});ue.add(S);const T={vis:S,savedCss:null,intent:S.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:i,pendingOutPath:null,pathRevision:0};if(b.set(f,T),!S.isHidden&&(ae(f,T),p)){const P=y(f,i),x={element:f,parent:f.parentElement,nextSibling:f.nextElementSibling,applyScrollPolicy:P};ce(i,"in",x)}const z=Ut(f,(P,x)=>{I===te&&wt(f,i,P,(x==null?void 0:x.emit)??!0)},r);fe.set(f,z)},We=new Map;return{register:Ne,refFor:i=>{let f=We.get(i);return f||(f=p=>{p&&Ne(i,p)},We.set(i,f)),f},disconnect(){H=!0,te++,h.cancel(()=>!0),V();try{l.cancel({reason:"disposed",owns:()=>!0})}finally{for(const i of ue)i.stop();ue.clear();for(const i of fe.values())i();fe.clear(),Pe=new WeakSet,O(),g.destroy(),c.dispose()}}}}const mt="data-ssgoi-root",Yt=`[${mt}]`,Ee="data-ssgoi-transition",ct=`[${Ee}]`,jt="[data-ssgoi-clone]";function Zt(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function Jt(t){return t.nodeType===Node.ELEMENT_NODE}function Qt(t){return t instanceof HTMLElement}function ut(t){let n=0,e=t.parentElement;for(;e;)n++,e=e.parentElement;return n}function ft(t,n,e=t){const s=Array.from(t).sort((l,r)=>ut(l)-ut(r));for(const l of s){const r=l.getAttribute(Ee);if(r===null)continue;let h=l.parentElement,c=!1;for(;h;){if(e.has(h)){c=!0;break}h=h.parentElement}n.register(r,l,{enter:!c})}}function en(t,n){if(!Zt())return()=>{};t.setAttribute(mt,"");const e=c=>c.closest(Yt)===t,s=c=>!Qt(c)||!e(c)||c.closest(jt)||c.getAttribute(Ee)===null?null:c,l=(c,v)=>{if(Jt(c)){if(c.matches(ct)){const g=s(c);g&&v.add(g)}for(const g of c.querySelectorAll(ct)){const m=s(g);m&&v.add(m)}}},r=new MutationObserver(c=>{const v=new Set,g=new Set;for(const m of c){if(m.type==="attributes"){const d=s(m.target);d&&v.add(d);continue}for(const d of m.addedNodes)l(d,g)}for(const m of g)v.add(m);ft(v,n,g)});r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Ee]});const h=new Set;return l(t,h),ft(h,n),()=>{var c;r.disconnect(),(c=n.disconnect)==null||c.call(n)}}exports.Animation=G.Animation;exports.MultiAnimation=G.MultiAnimation;exports.WebAnimation=G.WebAnimation;exports.simulate=He.simulate;exports.HostAnimation=dt;exports.createSggoiTransitionContext=Vt;exports.observeSsgoiTransitions=en;
1
+ "use strict";var kt=Object.defineProperty;var Tt=(t,n,e)=>n in t?kt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var K=(t,n,e)=>Tt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("./resolve-transition-rule-BL12rDDu.cjs"),G=require("./retain-opacity-5kqI1OCo.cjs"),He=require("./provider-JDtJ5Jzf.cjs");function oe(t){return[...t.getMotionTracks()]}class dt extends G.Animation{constructor(){super(...arguments);K(this,"child",null);K(this,"run",null);K(this,"retiring",[]);K(this,"owners",new WeakMap);K(this,"epoch",0);K(this,"prepared",null);K(this,"_state","idle");K(this,"_settled",!1);K(this,"listeners",new Set);K(this,"onHandoff")}prepareHandoff(){var e;if(!this.prepared){this.prepared=this.sceneSnapshots(),(e=this.child)==null||e.pause();for(const s of this.retiring)for(const l of s.releases)l.pause()}}attach(e,s={}){var L;if(this.child===e)return;e.validate();const l=this.run,r=this.prepared??this.sceneSnapshots();this.prepared=null;const h=++this.epoch,c=oe(e),v=r.filter(u=>u.lifetime!=="temporary"&&!c.some(o=>o.element===u.target)&&(s.targets??[]).some(o=>{var a;return o===u.target||((a=o.contains)==null?void 0:a.call(o,u.target))})&&("transform"in u.channels||"opacity"in u.channels)).map(u=>{const o=u.target,a={transform:o.style.transform,opacity:o.style.opacity},w=o.style.opacity||1;return new G.WebAnimation({element:o,integrator:new He.SpringIntegrator({stiffness:200,damping:24}),style:()=>({transform:"none",opacity:w}),motion:{key:u.key,role:u.role,space:u.space},onDispose:()=>{!a.transform&&o.style.transform==="none"&&(o.style.transform=""),!a.opacity&&String(o.style.opacity)===String(w)&&(o.style.opacity="")}})});if(v.length){const u=e.onDispose;e.onDispose=void 0,e=new G.MultiAnimation({effect:e,restore:new G.MultiAnimation(v)}),e.onDispose=u}const g=oe(e),m=new Set([...s.targets??[],...g.map(u=>u.element)]);for(const u of s.targets??[])this.owners.set(u,h);for(const u of c)this.owners.set(u.element,h);this.child=e;const d={animation:e,epoch:h,targets:m,hidden:[]};this.run=d,this._settled=!1;const y=[];if(e.supportsInterruption&&(!l||l.animation.supportsInterruption)){const u=He.matchMotion(r,g.map(o=>o.motionIdentity));u.forEach((o,a)=>{y.push({kind:o.reason,target:o.next.target,key:o.next.key}),o.previous&&g[a].adopt(o.previous),g[a].handoffFallbacks.length&&y.push({kind:"fallback",target:o.next.target,channels:g[a].handoffFallbacks,fallback:g[a].handoffFallbackMode})});for(const o of u){if(!o.previous||o.previous.target===o.next.target)continue;if(o.previous.lifetime==="temporary"){o.previous.target.remove();continue}const a=G.retainOpacity(o.previous.target);a.set(0),d.hidden.push(a.restore)}for(const o of[...this.retiring]){for(const a of o.releases)(m.has(a.element)||u.some(C=>{var W;return((W=C.previous)==null?void 0:W.target)===a.element}))&&a.cancel({reason:"interrupted",owns:()=>!1});o.releases=o.releases.filter(a=>a.isAnimating||a.isPaused),o.releases.length||this.disposeRetiring(o)}l&&this.retire(l,r,new Set([...m,...u.flatMap(o=>o.previous?[o.previous.target]:[])]),y)}else if(l){y.push({kind:"fallback"});const u=[...m].map(o=>[o,o.style.cssText]);l.animation.complete();for(const[o,a]of u)o.style.cssText=a}e.playbackRate=this.playbackRate;const E=e.onDispose;e.onDispose=u=>{try{E==null||E(u)}finally{for(const o of d.hidden.splice(0))o()}};const O=e.onComplete;e.onComplete=()=>{O==null||O(),this.child===e&&(this.child=null,this.run=null,this._state="idle",this._settled=this.retiring.length===0),this.notify()};const M=e.onUpdate;e.onUpdate=u=>{var o;M==null||M(u),this.child===e&&((o=this.onUpdate)==null||o.call(this,u),this.notify())},this._state==="paused"?e.pause():(this._state="playing",e.play());for(const u of this.retiring)for(const o of u.releases)this._state!=="paused"&&o.isPaused&&o.play();(L=this.onHandoff)==null||L.call(this,y),this.notify()}sceneSnapshots(){return[...this.child?oe(this.child).map(e=>e.getMotionSnapshot()):[],...this.run?[...this.run.targets].filter(e=>!oe(this.run.animation).some(s=>s.element===e)).map(e=>({target:e,channels:G.createWebPresentationCodec(e).read({transform:typeof getComputedStyle=="function"&&getComputedStyle(e).transform||"none",opacity:typeof getComputedStyle=="function"&&getComputedStyle(e).opacity||"1"})})):[],...this.retiring.flatMap(e=>e.releases.map(s=>s.getMotionSnapshot()))]}disposal(e){return{reason:"interrupted",owns:s=>!this.owners.has(s)||this.owners.get(s)===e.epoch}}retire(e,s,l,r){var g,m,d;e.animation.stop();const h=oe(e.animation),c={...e,releases:[]},v=new Set([...e.targets,...l]);for(const y of e.targets){if(l.has(y)||[...v].some(a=>{var w;return a!==y&&((w=a.contains)==null?void 0:w.call(a,y))}))continue;const E=s.find(a=>a.target===y);if(!E||((g=h.find(a=>a.element===y))==null?void 0:g.motion.release)==="remove")continue;const O=(m=h.find(a=>a.element===y))==null?void 0:m.motion.release;if(typeof O=="function")try{const a=O(E);if(a.element!==y)throw new Error("Release must own the retiring target");a.validate();const w=a.onComplete;a.onComplete=()=>{w==null||w(),c.releases.every(C=>C.isComplete)&&this.disposeRetiring(c)},a.adopt(E),a.playbackRate=this.playbackRate,c.releases.push(a),r.push({kind:"release",target:y});continue}catch(a){console.error("[ssgoi] invalid release; using fade",a),r.push({kind:"fallback",target:y})}const L=G.createWebPresentationCodec(y).write(E.channels),u=Number(L.opacity??1),o=new G.WebAnimation({element:y,integrator:{step:(a,w,C)=>({position:Math.min(w,a.position+C/.18),velocity:a.position>=w?0:1/.18}),isSettled:(a,w)=>a.position>=w},style:(a,w)=>({...L,opacity:u*w}),motion:{...(d=h.find(a=>a.element===y))==null?void 0:d.motion,handoffDuration:180},onComplete:()=>{c.releases.every(a=>a.isComplete)&&this.disposeRetiring(c)}});o.adopt(E),o.playbackRate=this.playbackRate,c.releases.push(o),r.push({kind:"release",target:y})}if(!c.releases.length){e.animation.cancel(this.disposal(e));return}this.retiring.push(c);for(const y of c.releases)y.play(),this._state==="paused"&&y.pause();for(;this.retiring.length>8;)this.disposeRetiring(this.retiring[0])}disposeRetiring(e){if(this.retiring.includes(e)){this.retiring=this.retiring.filter(s=>s!==e);for(const s of e.releases)s.cancel({reason:"disposed",owns:()=>!1});e.animation.cancel(this.disposal(e)),!this.child&&!this.retiring.length&&(this._settled=!0),this.notify()}}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.play();for(const s of this.retiring)for(const l of s.releases)l.play();this.notify()}reverse(){var e;this._state="reversing",this._settled=!1,(e=this.child)==null||e.reverse(),this.notify()}pause(){var e;this._state="paused",(e=this.child)==null||e.pause();for(const s of this.retiring)for(const l of s.releases)l.pause();this.notify()}complete(){var e;this.prepared=null,(e=this.child)==null||e.complete();for(const s of[...this.retiring])this.disposeRetiring(s);this.notify()}cancel(e){this.prepared=null;const s=this.child;this.child=null,this.run=null,this._state="idle",s==null||s.cancel(e);for(const l of[...this.retiring])this.disposeRetiring(l);this._settled=!0,this.notify()}get isAnimating(){var e;return!!((e=this.child)!=null&&e.isAnimating)||this.retiring.some(s=>s.releases.some(l=>l.isAnimating))}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child&&!this.retiring.length}get isReversing(){var e;return((e=this.child)==null?void 0:e.isReversing)??this._state==="reversing"}get progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var s;return((s=this.child)==null?void 0:s.findTimeForProgress(e))??null}get playbackRate(){return super.playbackRate}set playbackRate(e){super.playbackRate=e,this.child&&(this.child.playbackRate=e);for(const s of this.retiring)for(const l of s.releases)l.playbackRate=e;this.notify()}getPose(){var e;return((e=this.child)==null?void 0:e.getPose())??[]}getTimeline(){var e;return((e=this.child)==null?void 0:e.getTimeline())??[]}matchInto(e){var s;(s=this.child)==null||s.matchInto(e)}get activeChild(){return this.child}get retiringCount(){return this.retiring.length}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Pt=(t,n)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=n==null?void 0:n.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},tt=new Set(["auto","scroll","overlay"]),Rt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(tt.has(e.overflowY)||tt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Mt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return n;n=n.parentElement}return document.body};function xt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const s={};return n.forEach((l,r)=>{s[l]=e[r]}),s})}const Oe=new WeakMap;function Ct(t){let n=Oe.get(t);if(!n){const s=t.ownerDocument,r=t===s.documentElement||t===s.scrollingElement?s:t,h=m=>{m.type==="wheel"&&m.ctrlKey||m.type==="touchmove"&&m.touches.length>1||m.cancelable&&m.preventDefault()},c={passive:!1,capture:!0};r.addEventListener("wheel",h,c),r.addEventListener("touchmove",h,c);const v=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," "]),g=m=>{var y,E;const d=m;if(!(d.defaultPrevented||d.altKey||!v.has(d.key))){for(const O of d.composedPath()){const M=O;if(M.isContentEditable||(y=M.matches)!=null&&y.call(M,"input, textarea, select, [role=slider], [role=spinbutton], [role=listbox], [role=menu], [role=tablist]")||d.key===" "&&((E=M.matches)!=null&&E.call(M,"button, [role=button]")))return}d.cancelable&&d.preventDefault()}};r.addEventListener("keydown",g,{capture:!0}),n={owners:0,restore(){r.removeEventListener("wheel",h,{capture:!0}),r.removeEventListener("touchmove",h,{capture:!0}),r.removeEventListener("keydown",g,{capture:!0})}},Oe.set(t,n)}n.owners++;let e=!1;return()=>{e||(e=!0,--n.owners===0&&(Oe.delete(t),n.restore()))}}const At=768,Ot=10,Dt=10;function Lt(t={}){const{resolvePath:n=b=>b}=t;let e=null,s=null;const l=new Set,r=b=>{const k=b&&e?Ct(e):()=>{},_=()=>{l.delete(_)&&k()};return l.add(_),_};let h=!1,c=!1;const v=()=>{const b=(e==null?void 0:e.clientWidth)??0,k=b>0?b:typeof window<"u"?window.innerWidth:0;return k>0&&k<At},g=()=>(c||(h=v(),c=!0),h),m=b=>`path:${n(b)}`;let d=null;const y=new Map;let E=null,O=!1,M=0,L=0,u=0;const o=()=>{e&&E&&!O&&!l.size&&y.set(m(E),{x:e.scrollLeft,y:e.scrollTop})},a=(b,k,_)=>{if(!e)return;const D=++L,N=m(b),A=k&&y.has(N)?y.get(N):{x:0,y:0};let H=0;const B=()=>{if(!e||_!==M||D!==L)return;k||y.set(N,A),e.scrollTo({top:A.y,left:A.x,behavior:"instant"}),!(Math.abs(e.scrollTop-A.y)<1&&Math.abs(e.scrollLeft-A.x)<1)&&H<Ot&&(H++,requestAnimationFrame(B))};requestAnimationFrame(B)};return{beginTransition:r,disconnect(){++M,++L;for(const b of l)b();e&&(e===document.documentElement?window:e).removeEventListener("scroll",o),s==null||s.disconnect(),s=null,e=null,d=null,E=null,c=!1},initializeContext:(b,k,_)=>{O=!0;const D=E===k?M:++M;d=b,e||(e=Rt(b),h=v(),c=!0,typeof ResizeObserver<"u"&&(s=new ResizeObserver(()=>{h=v()}),s.observe(e)),(e===document.documentElement?window:e).addEventListener("scroll",o,{passive:!0})),E=k;const N=m(k),A=y.get(N),H=ee=>{D===M&&(u=D,ee&&A&&y.set(N,A),a(k,ee,D))};_!==void 0?H(_):requestAnimationFrame(()=>{u!==D&&D===M&&H(!1)});let B=0;const V=()=>{D===M&&(B++,B>=Dt?O=!1:requestAnimationFrame(V))};return requestAnimationFrame(V),H},calculateScrollOffset:(b,k,_=!1)=>{const D=b?m(b):null,N=D&&y.has(D)?y.get(D):{x:0,y:0},A=k&&_?m(k):null,H=A&&y.has(A)?y.get(A):{x:0,y:0};return{x:-H.x+N.x,y:-H.y+N.y}},evictScrollPosition:b=>{y.delete(m(b))},getScrollContainer:()=>e,getPositionedParentElement:()=>d?Mt(d):document.body,getScrollPosition:(b,k=!0)=>{if(!k)return{x:0,y:0};const _=b?m(b):null;return _&&y.has(_)?y.get(_):{x:0,y:0}},getIsMobile:g}}const nt=30,st=8,ot=1.2,rt=30,_t=600;function Ht(){let t=null,n=!1,e=!1,s=null,l=null,r=!1;const h=(o,a)=>{for(let w=0;w<o.length;w++){const C=o.item(w);if(C&&C.identifier===a)return C}return null},c=()=>{s!==null&&(clearTimeout(s),s=null)},v=()=>{l!==null&&(clearTimeout(l),l=null)},g=()=>{n=!0,e=!0,c(),v(),s=setTimeout(()=>{n=!1,e=!1,s=null},_t)},m=o=>{if(o.touches.length!==1){t=null;return}const a=o.touches.item(0);if(!a){t=null;return}const w=window.innerWidth,C=a.clientX<=nt,W=a.clientX>=w-nt;if(!C&&!W){t=null;return}t={identifier:a.identifier,startX:a.clientX,startY:a.clientY,fromLeftEdge:C,moved:!1}},d=o=>{if(!t)return;if(o.touches.length!==1){t=null;return}const a=h(o.touches,t.identifier);if(!a){t=null;return}const w=a.clientX-t.startX,C=a.clientY-t.startY,W=Math.abs(w),Y=Math.abs(C);if(Y>st&&Y>W*ot){t=null;return}const ie=t.fromLeftEdge?w>0:w<0;W>st&&W>Y*ot&&ie&&(t.moved=!0)},y=o=>{if(!t)return;const a=h(o.changedTouches,t.identifier);if(!a){t=null;return}const w=a.clientX-t.startX,C=t.fromLeftEdge?w>0:w<0;if(t.moved&&C&&Math.abs(w)>=rt){g(),t=null;return}t.moved&&Math.abs(w)>=rt&&g(),t=null},E=()=>{t&&(t.moved&&g(),t=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const o={passive:!0,capture:!0};window.addEventListener("touchstart",m,o),window.addEventListener("touchmove",d,o),window.addEventListener("touchend",y,o),window.addEventListener("touchcancel",E,o)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const o={capture:!0};window.removeEventListener("touchstart",m,o),window.removeEventListener("touchmove",d,o),window.removeEventListener("touchend",y,o),window.removeEventListener("touchcancel",E,o),c(),v(),t=null,n=!1,e=!1},isSwipeBack:()=>{const o=n||e;return o&&c(),o},onPageEnter:()=>{n=!1,c(),v(),l=setTimeout(()=>{e=!1,l=null},0)}}}const it="__ssgoi_entry_v1",De=new WeakMap,pt={read:()=>null,previous:()=>null,dispose(){}};function It(){if(typeof window>"u")return pt;const t=window.navigation,n=window;let e=De.get(n);e||(e=Nt(n,t),De.set(n,e)),e.users++;const s=e;let l=!1;return{read:s.read,previous:s.previous,dispose(){l||(l=!0,--s.users===0&&(s.dispose(),De.delete(n)))}}}function lt(t){return t&&typeof t.key=="string"&&typeof t.url=="string"&&Number.isSafeInteger(t.index)&&t.index>=0?{key:t.key,index:t.index,url:t.url}:null}function Le(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype}function Nt(t,n){var L;const e=t.history,s=e.pushState,l=e.replaceState,r=`${Date.now()}-${Math.random().toString(36).slice(2)}-`;let h=0,c=!0,v=null,g=null;const m=()=>{const u=lt(n==null?void 0:n.currentEntry);return(u==null?void 0:u.url)===t.location.href?u:null},d=()=>{const u=e.state,o=Le(u)?u[it]:null;return!Le(o)||typeof o.key!="string"||!o.key.startsWith(r)||!Number.isSafeInteger(o.index)?m():{key:o.key,index:o.index,url:t.location.href}},y=(u,o)=>u!==null&&!Le(u)?u:{...u,[it]:o},E=u=>({key:`${r}${++h}`,index:u});try{l.call(e,y(e.state,E(((L=m())==null?void 0:L.index)??0)),"")}catch{return{...pt,read:m,users:0}}const O=function(u,o,a){var W;if(!c)return s.call(this,u,o,a);const w=d(),C=E(((w==null?void 0:w.index)??0)+1);s.call(this,y(u,C),o,a),v=w,g=((W=d())==null?void 0:W.key)??null},M=function(u,o,a){if(!c)return l.call(this,u,o,a);const w=d();l.call(this,y(u,w??E(0)),o,a)};return e.pushState=O,e.replaceState=M,{users:0,read:d,previous:()=>{var o;if(((o=d())==null?void 0:o.key)===g)return v;const u=m();return u?lt(n==null?void 0:n.entries().find(a=>a.index===u.index-1)):null},dispose(){c=!1,e.pushState===O&&(e.pushState=s),e.replaceState===M&&(e.replaceState=l)}}}function Wt(){let t=null,n=null;const e=new Set,s=r=>{r&&e.add(r.key),e.size>200&&e.delete(e.values().next().value)},l=()=>{t||(t=It(),n=t.read(),s(n))};return{connect:l,resolve(r,h){l();const c=t.read();let v=n,g="unknown";if(v&&c&&(c.key===v.key||c.index===v.index?g="replace":c.index<v.index?g="back":g=e.has(c.key)?"forward":"push"),g==="push"){const m=t.previous();m&&m.index===c.index-1&&_e.normalizePath(new URL(m.url).pathname)===_e.normalizePath(r)&&(v=m)}return n=c,s(v),s(c),{kind:g,direction:g==="back"?"backward":"forward",from:v,to:c}},dispose(){t==null||t.dispose(),t=null,n=null,e.clear()}}}function Ft(){const t=Wt(),n=new Map;return{connect:t.connect,resolve(e,s,l){var g,m;const r=t.resolve(e,s),h=(g=r.from)==null?void 0:g.key,c=(m=r.to)==null?void 0:m.key;if(r.kind==="back"&&h&&c){const d=n.get(h);if((d==null?void 0:d.source)===c&&d.from===s&&d.to===e)return d.rule?{...d.rule,direction:d.rule.direction==="forward"?"backward":"forward",preserveScroll:{from:d.rule.preserveScroll.to,to:d.rule.preserveScroll.from}}:null}if(r.kind==="forward"&&h&&c){const d=n.get(c);if((d==null?void 0:d.source)===h&&d.from===e&&d.to===s)return d.rule}const v=l(r.direction);if(c&&r.kind==="replace"&&n.delete(c),c&&h&&r.kind==="push"){for(const[d,y]of n)y.index>=r.to.index&&n.delete(d);n.set(c,{source:h,index:r.to.index,from:e,to:s,rule:v?{...v,preserveScroll:{...v.preserveScroll}}:null}),n.size>100&&n.delete(n.keys().next().value)}return v},dispose(){t.dispose(),n.clear()}}}function Bt(t={}){let n=null,e=null;function s(){var r,h;n&&((r=n.out)==null||r.resolve(null),(h=n.in)==null||h.resolve(null),n=null)}function l(){if(n!=null&&n.out&&n.in){if(n.out.path===n.in.path){s();return}const r={from:n.out.path,to:n.in.path,out:n.out.payload,in:n.in.payload};e=r,n.out.resolve(r),n.in.resolve(r),n=null}}return{arrive(r,h,c){return new Promise(v=>{var y,E;const g=e===null?null:h==="out"?{path:e.from,payload:e.out}:{path:e.to,payload:e.in};if((g==null?void 0:g.path)===r){v(null);return}h==="out"&&((y=n==null?void 0:n.in)==null?void 0:y.path)===r&&!n.out&&(n.in.resolve(null),n.in=void 0);const m=n==null?void 0:n[h];m&&m.path!==r&&s(),n||(n={});const d=n[h];if(d){if(((E=t.keepCurrent)==null?void 0:E.call(t,{type:h,path:r,current:d.payload,next:c}))??!1){v(null);return}d.resolve(null)}n[h]={path:r,payload:c,resolve:v},l()})},cancel(r){(n!=null&&n.out&&r(n.out.payload)||n!=null&&n.in&&r(n.in.payload))&&s(),(e&&r(e.out)||e&&r(e.in))&&(e=null)}}}const zt={},Q=new Map;let we=null,at=!1;function ht(t,n,e){t instanceof HTMLElement&&Q.has(t)&&!t.isConnected&&e.set(t,{entry:Q.get(t),anchor:n});for(const s of Array.from(t.childNodes))ht(s,n,e)}function Gt(t){const n=new Set(Array.from(t.values(),({entry:e})=>e));for(const[e,{entry:s,anchor:l}]of t){Q.delete(e);let r=s.parent,h=!1;for(;r;){if(r.group===s.group&&n.has(r)){h=!0;break}r=r.parent}queueMicrotask(()=>s.callback(l,{emit:!h}))}}function Kt(){if(at||typeof document>"u")return;at=!0,we=new MutationObserver(n=>{const e=new Map;for(const s of n){const l={parent:s.target,nextSibling:s.nextSibling};for(const r of Array.from(s.removedNodes))ht(r,l,e)}Gt(e)});const t=()=>{we==null||we.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Ut(t,n,e=zt){Kt();let s=t.parentElement,l=null;for(;s;){const r=Q.get(s);if((r==null?void 0:r.group)===e){l=r;break}s=s.parentElement}return Q.set(t,{element:t,callback:n,group:e,parent:l}),()=>{Q.delete(t)}}const Ie=new WeakMap;let be=null;const Se="none !important";function re(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function Xt(){return be||(be=new MutationObserver(t=>{for(const n of t){const e=n.target,s=Ie.get(e);if(!s)continue;const l=re(e);l!==s.accounted&&(s.accounted=l,l===Se?(s.reactHidden=!0,s.onHide()):l!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),be)}function qt(t,n){const e=re(t),s={accounted:e,reactHidden:e===Se,onHide:n.onHide,onShow:n.onShow};return Ie.set(t,s),Xt().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return re(t)===Se},setDisplay(l,r=!1){l===null?t.style.removeProperty("display"):t.style.setProperty("display",l,r?"important":""),s.accounted=re(t)},sync(){s.accounted=re(t),s.reactHidden=s.accounted===Se},stop(){Ie.delete(t)}}}const $t=5e3;function Vt(t,n={}){const{transitions:e=[],middleware:s=(i,f)=>({from:i,to:f})}=t,l=n.host??new dt,r={},h=Bt({keepCurrent:({current:i,next:f})=>i.element.contains(f.element)}),c=Ft(),v=typeof e=="function"?e:()=>e,g=Ht();g.initialize();const m=new Map,d=i=>{let f=m.get(i);return f===void 0&&(f=s(i,i).from,m.set(i,f)),f},{initializeContext:y,beginTransition:E,disconnect:O,calculateScrollOffset:M,evictScrollPosition:L,getScrollContainer:u,getPositionedParentElement:o,getScrollPosition:a,getIsMobile:w}=Lt({resolvePath:d}),C=new Map,W=()=>{const i=w();let f=C.get(i);return f||(f=v({isMobile:i}),C.set(i,f)),f},Y=new WeakMap,ie=i=>{Y.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},le=i=>{const f=Y.get(i);return f||{parent:i.parentNode,nextSibling:i.nextSibling}},b=new WeakMap,k=new WeakMap;let _=0,D=0,N=null,A=null,H=!1;const B=new WeakMap,V=()=>{D++,N==null||N.abort(),A==null||A(),A=null},ee=i=>{const f=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return f&&f!=="none"?f:"block"},ae=(i,f)=>{f.visibleDisplay=i.style.getPropertyValue("display"),f.computedDisplay=ee(i)},ke=(i,f)=>{if(k.get(i)!==f)return;k.delete(i);const p=b.get(i);p&&(p.savedCss!==null&&(i.style.cssText=p.savedCss,p.savedCss=null),p.intent==="hidden"?p.vis.setDisplay("none",!0):p.visibleDisplay?(p.vis.setDisplay(p.visibleDisplay,!1),ae(i,p)):(p.vis.setDisplay(null),ae(i,p)))},Te=(i,f)=>{if(i.mode!=="hidden")return;const p=Array.from(new Set([i.element,f==null?void 0:f.element].filter(Boolean))),I=++_;for(const S of p)k.set(S,I);l.complete();for(const S of p)ke(S,I)};let te=0;const yt=(i,f,p,I,S,T,z)=>{var $e;const P=S.element,x=T.element,$=++_;k.set(x,$),k.set(P,$);const de=E(t.scrollLock!==!1);V();const J=D;N=new AbortController;const j=N.signal;l.prepareHandoff();for(const R of[P,x])B.has(R)||B.set(R,(($e=b.get(R))==null?void 0:$e.savedCss)??R.style.cssText);const pe=(S.mode??"unmount")==="hidden",{parent:he,nextSibling:Re}=S.parent?{parent:S.parent,nextSibling:S.nextSibling}:le(P),me=M(p,I,z.to),ye={direction:f,scrollOffset:me,from:{scroll:a(p)},to:{scroll:a(I,z.to)},get scrollingElement(){return u()||document.documentElement},get positionedParent(){return o()}};let F;if(pe){F=P,F.style.top=`${-1*((me==null?void 0:me.y)??0)}px`;const R=b.get(x);R&&R.savedCss===null&&(R.savedCss=x.style.cssText)}else F=P,Pt(F,ye);z.from||L(p);const Be=Promise.resolve(F),ze=Promise.resolve(x),Me=[],Ge=[];let xe=!1;const ge=()=>{if(!xe){xe=!0;for(const R of Ge)try{R()}catch(U){console.error("[ssgoi] prepare cleanup",U)}for(const R of Me)R.remove()}},bt={from:Be,to:ze,context:ye,createElement:((R,U="div")=>{const se=document.createElement(U);return se.setAttribute("data-ssgoi-id",R),Me.push(se),se}),signal:j,onCleanup:R=>{xe?R():Ge.push(R)}};let Ke=!1,ne=!1;const ve=()=>{ne||(ne=!0,clearTimeout(qe),ge(),de())},Ue=()=>{for(const R of[P,x]){if(k.get(R)!==$)continue;const U=B.get(R);U!==void 0&&(R.style.cssText=U),B.delete(R),ke(R,$)}};A=()=>{ge(),Ue(),ve()};const Xe=R=>{ge();const U=ne||j.aborted||H||J!==D;if(A&&J===D&&(A=null),U){ve();return}l.cancel({reason:"disposed",owns:()=>!0}),Ue(),pe||F.remove(),ve(),console.error("[SSGOI] Page transition failed",R)},qe=setTimeout(()=>{Ke||ne||Xe(new Error("Page transition preparation timed out"))},$t),St=Promise.resolve().then(()=>j.aborted?{}:i.prepare?i.prepare(bt):{});xt({from:Be,to:ze,extras:St}).then(({from:R,to:U,extras:se})=>{var je,Ze,Je,Qe;if(ne||j.aborted||H||J!==D){ge();return}Ke=!0,clearTimeout(qe),A=null,!pe&&he&&(Re&&he.contains(Re)?he.insertBefore(F,Re):he.appendChild(F));const Z=i.animation({from:R,to:U,context:ye,...se}),Et=Z.getMotionTracks();for(const X of Et)Me.includes(X.element)&&((je=X.motion).lifetime??(je.lifetime="temporary"),(Ze=X.motion).role??(Ze.role="overlay"),(Je=X.motion).key??(Je.key=X.element.getAttribute("data-ssgoi-id")??void 0),(Qe=X.motion).space??(Qe.space=ye.positionedParent));const Ce=Z.onDispose;let Ve=!1;const Ye=X=>{if(!Ve){Ve=!0;try{Ce==null||Ce(X)}catch(q){console.error("[ssgoi] effect cleanup failed",q)}try{for(const q of[P,x]){if(k.get(q)!==$||!X.owns(q))continue;const et=B.get(q);et!==void 0&&(q.style.cssText=et),B.delete(q),b.has(q)?ke(q,$):k.delete(q)}!pe&&X.owns(F)&&F.parentNode&&!k.has(F)&&F.parentNode.removeChild(F)}finally{ve()}}};Z.onDispose=Ye;const Ae=Z.onComplete;Z.onComplete=()=>{try{Ae==null||Ae()}finally{Z.supportsInterruption||Ye(G.finishedDisposal)}},l.attach(Z,{targets:[P,x]})}).catch(Xe)},ce=(i,f,p)=>{if(H)return;const I=te,S=g.isSwipeBack();h.arrive(i,f,p).then(T=>{var $,de,J,j;if(H||I!==te)return;if(f==="in"&&g.onPageEnter(),!T){f==="out"&&Te(p);return}if(f!=="in")return;const{from:z,to:P}=s(T.from,T.to),x=c.resolve(T.from,T.to,Fe=>_e.resolveTransitionRule(z,P,W(),Fe));if(!x){(de=($=T.in).applyScrollPolicy)==null||de.call($,!1),L(T.from),V(),Te(T.out,T.in),l.complete();return}if((j=(J=T.in).applyScrollPolicy)==null||j.call(J,x.preserveScroll.to),S){x.preserveScroll.from||L(T.from),V(),Te(T.out,T.in),l.complete();return}yt(x.transition,x.direction,T.from,T.to,T.out,T.in,x.preserveScroll)})},gt=(i,f)=>{const p=b.get(i);if(!p)return;const I=p.intent==="hidden";if(p.intent="hidden",p.savedCss===null&&(p.savedCss=i.style.cssText),p.vis.setDisplay(p.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",I)return;const S=le(i),T={element:i,parent:S.parent,nextSibling:S.nextSibling,mode:"hidden"},z=p.pendingOutPath??p.currentPath??f;p.pendingOutPath=null,ce(z,"out",T)},vt=(i,f)=>{const p=b.get(i);if(!p||p.intent==="visible")return;p.intent="visible",p.currentPath=i.getAttribute("data-ssgoi-transition")??p.currentPath??f,p.pendingOutPath=null,p.pathRevision++,ae(i,p),p.savedCss!==null&&(i.style.cssText=p.savedCss,p.visibleDisplay?p.vis.setDisplay(p.visibleDisplay,!1):p.vis.setDisplay(null));const I=p.currentPath,S=y(i,I),T={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling,applyScrollPolicy:S};ce(I,"in",T)},wt=(i,f,p,I=!0)=>{const S=b.get(i);fe.delete(i);const T=(S==null?void 0:S.pendingOutPath)??(S==null?void 0:S.currentPath)??f;if(S&&(S.vis.stop(),ue.delete(S.vis),b.delete(i),k.delete(i),S.intent==="hidden")){h.cancel(x=>x.element===i);return}if(!I)return;const z=p??le(i),P={element:i,parent:z.parent,nextSibling:z.nextSibling,mode:"unmount"};ce(T,"out",P)};let Pe=new WeakSet;const ue=new Set,fe=new Map,Ne=(i,f,{enter:p=!0}={})=>{if(H=!1,c.connect(),g.initialize(),Pe.has(f)){const P=b.get(f);if(P&&P.currentPath!==i){P.intent==="visible"&&P.pendingOutPath===null&&(P.pendingOutPath=P.currentPath),P.currentPath=i;const x=++P.pathRevision;queueMicrotask(()=>{P.pathRevision===x&&(P.pendingOutPath=null)})}return}Pe.add(f);const I=te;ie(f);const S=qt(f,{onHide:()=>gt(f,i),onShow:()=>vt(f,i)});ue.add(S);const T={vis:S,savedCss:null,intent:S.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:i,pendingOutPath:null,pathRevision:0};if(b.set(f,T),!S.isHidden&&(ae(f,T),p)){const P=y(f,i),x={element:f,parent:f.parentElement,nextSibling:f.nextElementSibling,applyScrollPolicy:P};ce(i,"in",x)}const z=Ut(f,(P,x)=>{I===te&&wt(f,i,P,(x==null?void 0:x.emit)??!0)},r);fe.set(f,z)},We=new Map;return{register:Ne,refFor:i=>{let f=We.get(i);return f||(f=p=>{p&&Ne(i,p)},We.set(i,f)),f},disconnect(){H=!0,te++,h.cancel(()=>!0),V();try{l.cancel({reason:"disposed",owns:()=>!0})}finally{for(const i of ue)i.stop();ue.clear();for(const i of fe.values())i();fe.clear(),Pe=new WeakSet,O(),g.destroy(),c.dispose()}}}}const mt="data-ssgoi-root",Yt=`[${mt}]`,Ee="data-ssgoi-transition",ct=`[${Ee}]`,jt="[data-ssgoi-clone]";function Zt(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function Jt(t){return t.nodeType===Node.ELEMENT_NODE}function Qt(t){return t instanceof HTMLElement}function ut(t){let n=0,e=t.parentElement;for(;e;)n++,e=e.parentElement;return n}function ft(t,n,e=t){const s=Array.from(t).sort((l,r)=>ut(l)-ut(r));for(const l of s){const r=l.getAttribute(Ee);if(r===null)continue;let h=l.parentElement,c=!1;for(;h;){if(e.has(h)){c=!0;break}h=h.parentElement}n.register(r,l,{enter:!c})}}function en(t,n){if(!Zt())return()=>{};t.setAttribute(mt,"");const e=c=>c.closest(Yt)===t,s=c=>!Qt(c)||!e(c)||c.closest(jt)||c.getAttribute(Ee)===null?null:c,l=(c,v)=>{if(Jt(c)){if(c.matches(ct)){const g=s(c);g&&v.add(g)}for(const g of c.querySelectorAll(ct)){const m=s(g);m&&v.add(m)}}},r=new MutationObserver(c=>{const v=new Set,g=new Set;for(const m of c){if(m.type==="attributes"){const d=s(m.target);d&&v.add(d);continue}for(const d of m.addedNodes)l(d,g)}for(const m of g)v.add(m);ft(v,n,g)});r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Ee]});const h=new Set;return l(t,h),ft(h,n),()=>{var c;r.disconnect(),(c=n.disconnect)==null||c.call(n)}}exports.Animation=G.Animation;exports.MultiAnimation=G.MultiAnimation;exports.WebAnimation=G.WebAnimation;exports.simulate=He.simulate;exports.HostAnimation=dt;exports.createSggoiTransitionContext=Vt;exports.observeSsgoiTransitions=en;
package/dist/internal.js CHANGED
@@ -2,7 +2,7 @@ var kt = Object.defineProperty;
2
2
  var Tt = (t, n, e) => n in t ? kt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
3
  var G = (t, n, e) => Tt(t, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { n as Je, r as Pt } from "./resolve-transition-rule-DbkMu0rm.js";
5
- import { A as Rt, W as Qe, M as et, r as xt, c as tt, f as Mt } from "./retain-opacity-ChyA_fg_.js";
5
+ import { A as Rt, W as Qe, M as et, r as xt, c as tt, f as Mt } from "./retain-opacity-Bp_Y__-B.js";
6
6
  import { S as Ct, m as At } from "./provider-BLf6XeXT.js";
7
7
  import { a as gn } from "./provider-BLf6XeXT.js";
8
8
  function se(t) {
@@ -0,0 +1 @@
1
+ "use strict";var at=Object.defineProperty;var lt=(s,n,t)=>n in s?at(s,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[n]=t;var h=(s,n,t)=>lt(s,typeof n!="symbol"?n+"":n,t);const _=require("./provider-JDtJ5Jzf.cjs"),x={reason:"finished",owns:()=>!0};class Z extends _.Animation{constructor(){super(...arguments);h(this,"_startCondition");h(this,"onDispose");h(this,"deferDisposal",!1)}getMotionTracks(){return[]}validate(){}get supportsInterruption(){return!1}stop(){this.pause()}cancel(t){var e;this.isComplete||this.complete(),(e=this.onDispose)==null||e.call(this,t)}get startCondition(){return this._startCondition}set(t){if(t.startAt){const{after:e,at:i}=t.startAt;if(e===this)throw new Error("An animation cannot start after itself");if(i!=="settled"&&(!Number.isFinite(i)||i<0||i>1))throw new Error("startAt.at must be a progress from 0 to 1 or settled")}if(t.integrator!==void 0){if(typeof t.integrator.step!="function"||typeof t.integrator.isSettled!="function")throw new Error("An integrator must implement step and isSettled");this.setIntegrator(t.integrator)}return t.startAt!==void 0&&(this._startCondition=t.startAt?{...t.startAt}:void 0),this}setIntegrator(t){throw new Error("This animation does not support replacing its integrator")}}const H=[1,0,0,1,0,0],rt=(s,n)=>[s[0]*n[0]+s[2]*n[1],s[1]*n[0]+s[3]*n[1],s[0]*n[2]+s[2]*n[3],s[1]*n[2]+s[3]*n[3],s[0]*n[4]+s[2]*n[5]+s[4],s[1]*n[4]+s[3]*n[5]+s[5]];function Q(s){const n=s[0]*s[3]-s[1]*s[2];return Math.abs(n)<1e-10?null:[s[3]/n,-s[1]/n,-s[2]/n,s[0]/n,(s[2]*s[5]-s[3]*s[4])/n,(s[1]*s[4]-s[0]*s[5])/n]}const T=(s,n)=>[1,0,0,1,s,n],U=(s,n)=>[s,0,0,n,0,0];function ht(s,n,t){if(!s||s==="none")return[...H];let e=[...H];const i=/([a-zA-Z][a-zA-Z0-9]*)\(([^()]*)\)/g;let o="";for(const d of s.matchAll(i)){o+=d[0];const p=d[1].toLowerCase(),c=d[2].trim().split(/\s*,\s*|\s+/);if(c.some(r=>!/^[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?(?:px|%|deg|rad|turn)?$/i.test(r)))return null;const m=c.map(Number.parseFloat);if(m.some(r=>!Number.isFinite(r)))return null;const g=(r,y)=>{var a;return m[r]*((a=c[r])!=null&&a.endsWith("%")?y/100:1)},u=r=>{var y,a;return m[r]*((y=c[r])!=null&&y.endsWith("rad")?1:(a=c[r])!=null&&a.endsWith("turn")?2*Math.PI:Math.PI/180)};let l;if(p==="matrix"&&m.length===6)l=m;else if(p==="translate"||p==="translate3d"){if(p==="translate3d"&&m[2]!==0)return null;l=T(g(0,n),c[1]?g(1,t):0)}else if(p==="translatex")l=T(g(0,n),0);else if(p==="translatey")l=T(0,g(0,t));else if(p==="translatez"&&m[0]===0)l=[...H];else if(p==="scale")l=U(m[0],m[1]??m[0]);else if(p==="scalex")l=U(m[0],1);else if(p==="scaley")l=U(1,m[0]);else if(p==="rotate"||p==="rotatez"){const r=u(0);l=[Math.cos(r),Math.sin(r),-Math.sin(r),Math.cos(r),0,0]}else return null;e=rt(e,l)}return o.replace(/\s/g,"")===s.replace(/\s/g,"")?e:null}function tt(s,n){return{schema:s,value:n,velocity:n.map(()=>0)}}const et=/[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi,A=s=>[s[0],s[2],s[4],s[1],s[3],s[5],0,0,1];function O(s,n){return Array.from({length:9},(t,e)=>{const i=Math.floor(e/3),o=e%3;return s[i*3]*n[o]+s[i*3+1]*n[o+3]+s[i*3+2]*n[o+6]})}function ot(s){return Math.abs(s[8])<1e-8||!s.every(Number.isFinite)?null:s.map(n=>n/s[8])}function st(s,n,t){const e=ht(s,n,t);if(e)return A(e);if(typeof DOMMatrix>"u")return null;const i=s.replace(/(translate(?:3d|X|Y)?)\(([^()]*)\)/gi,(o,d,p)=>{const c=p.split(/\s*,\s*|\s+/).map((m,g)=>{if(!m.endsWith("%"))return m;const u=d.toLowerCase()==="translatey"||g===1?t:n;return`${Number.parseFloat(m)*u/100}px`});return`${d}(${c.join(",")})`});try{const o=new DOMMatrix(i);return ot([o.m11,o.m21,o.m41,o.m12,o.m22,o.m42,o.m14,o.m24,o.m44])}catch{return null}}const it="viewport-plane-v1";function q(s){var S;const n=s.offsetWidth||1,t=s.offsetHeight||1,e=typeof getComputedStyle=="function"?getComputedStyle(s):null,i=((e==null?void 0:e.transformOrigin)||`${n/2}px ${t/2}px`).split(" "),o=Number.parseFloat(i[0])||0,d=Number.parseFloat(i[1])||0;let p=!0;if(typeof getComputedStyle=="function")for(let C=s.parentElement;C;C=C.parentElement){const w=getComputedStyle(C);if(w.transform&&w.transform!=="none"||w.perspective&&w.perspective!=="none"){p=!1;break}}const c=(S=s.getBoundingClientRect)==null?void 0:S.call(s),m=st((e==null?void 0:e.transform)||"",n,t)??A(H),g=O(O(A(T(o,d)),m),A(T(-o,-d))),u=[[0,0],[n,0],[0,t],[n,t]].map(([C,w])=>{const k=g[6]*C+g[7]*w+g[8];return[(g[0]*C+g[1]*w+g[2])/k,(g[3]*C+g[4]*w+g[5])/k]}),l=((c==null?void 0:c.left)??0)-Math.min(...u.map(C=>C[0])),r=((c==null?void 0:c.top)??0)-Math.min(...u.map(C=>C[1])),y=T(l+o,r+d),a=rt(T(-o,-d),U(n,t)),f=A(Q(y)),b=A(Q(a));return{frame:p?{left:l,top:r,width:n,height:t}:void 0,read(C){const w={};for(const[k,F]of Object.entries(C)){const M=String(F);if(k==="transform"){if(!p)continue;const I=st(M,n,t),V=I&&ot(O(O(A(y),I),A(a)));if(V){const[N,z,P,D,E,B,j,v]=V,W=N-P*j,$=D-B*j,G=z-P*v,J=E-B*v,L=Math.hypot(W,$);if(L>1e-8){w[k]=tt(it,[P,B,Math.atan2($,W),L,(W*J-$*G)/L,(W*G+$*J)/L,j,v]);continue}}}const R=[...M.matchAll(et)].map(I=>Number(I[0]));R.length&&R.every(Number.isFinite)&&(w[k]=tt(`css:${M.replace(et,"#")}`,R))}return w},write(C){const w={};for(const[k,F]of Object.entries(C))if(k==="transform"&&F.schema===it){const[M,R,I,V,N,z,P,D]=F.value,E=Math.cos(I),B=Math.sin(I),j=[E*V+M*P,E*z-B*N+M*D,M,B*V+R*P,B*z+E*N+R*D,R,P,D,1],v=O(O(f,j),b);Math.abs(v[6])+Math.abs(v[7])<1e-10&&Math.abs(v[8]-1)<1e-10?w[k]=`matrix(${[v[0],v[3],v[1],v[4],v[2],v[5]].join(",")})`:w[k]=`matrix3d(${[v[0],v[3],0,v[6],v[1],v[4],0,v[7],0,0,1,0,v[2],v[5],0,v[8]].join(",")})`}else if(F.schema.startsWith("css:")){let M=0;w[k]=F.schema.slice(4).replace(/#/g,()=>String(F.value[M++]))}return w}}}const ct=1e3/60;class X extends Z{constructor(t){super();h(this,"_element");h(this,"_integrator");h(this,"label");h(this,"styleFn");h(this,"lowerBound");h(this,"upperBound");h(this,"currentValue");h(this,"currentVelocity",0);h(this,"solverState");h(this,"solverTarget",1);h(this,"presentationTime",0);h(this,"renderedStyles",[]);h(this,"frames",[]);h(this,"waapi",null);h(this,"runId",0);h(this,"running",!1);h(this,"paused",!1);h(this,"settled",!1);h(this,"reversing",!1);h(this,"disposed",!1);h(this,"legacyCompletionCleanup");h(this,"motion");h(this,"codec");h(this,"adopted");h(this,"presentationFrames",[]);h(this,"hold",null);h(this,"fallbackCopy",null);h(this,"fallbackChannels",new Set);h(this,"fallbackMode");this._element=t.element,this._integrator=t.integrator,this.label=t.label,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.legacyCompletionCleanup=!!t.onComplete&&!t.onDispose,this.onComplete=t.onComplete,this.onDispose=t.onDispose,this.motion=t.motion??{}}get handoffFallbackMode(){return this.fallbackMode}get handoffFallbacks(){return[...this.fallbackChannels]}get element(){return this._element}get integrator(){return this._integrator}set integrator(t){this._integrator=t,this.solverState=void 0}setIntegrator(t){this._integrator=t,this.solverState=void 0}play(){var e;const t=this.reversing;if(this.reversing=!1,this.paused&&this.waapi&&!t){this.paused=!1,this.running=!0,this.waapi.play(),(e=this.fallbackCopy)==null||e.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t,e;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),(e=this.fallbackCopy)==null||e.pause(),this.running=!1,this.paused=!0)}complete(){this.settled||(this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,this.finish())}validate(){const t=this.motion.handoffDuration??280;if(!Number.isFinite(t)||t<0||t>1e4)throw new Error("handoffDuration must be finite and between 0 and 10000 ms")}getMotionTracks(){return[this]}get supportsInterruption(){return!this.legacyCompletionCleanup}stop(){var t,e;this.captureLiveState(),this.clearWaapi(),(t=this.hold)==null||t.cancel(),this.hold=null,(e=this.fallbackCopy)==null||e.cancel({reason:"disposed",owns:()=>!0}),this.fallbackCopy=null,this.running=!1,this.paused=!1}cancel(t){this.stop(),this.disposeResources(t)}disposeResources(t){var e;if(!this.disposed&&(this.disposed=!0,t.owns(this.element)))try{(e=this.onDispose)==null||e.call(this,t)}catch(i){console.error("[ssgoi] animation cleanup failed",i)}}finish(){var t,e,i,o;this.presentationTime=((t=this.frames[this.frames.length-1])==null?void 0:t.time)??0,this.solverState=void 0,(e=this.hold)==null||e.cancel(),this.hold=null,this.applyStyleAt(this.currentValue),this.clearWaapi(),(i=this.fallbackCopy)==null||i.cancel({reason:"disposed",owns:()=>!0}),this.fallbackCopy=null,this.deferDisposal||this.disposeResources(x),(o=this.onComplete)==null||o.call(this)}get motionIdentity(){return{target:this.element,key:this.motion.key,role:this.motion.role,space:this.motion.space,lifetime:this.motion.lifetime}}getMotionSnapshot(){var o,d;this.running&&this.captureLiveState();const t=this.samplePresentation(nt(this.waapi)??this.presentationTime),e=this.paused?0:this.playbackRate,i={...this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue),...(o=this.codec)==null?void 0:o.write(t)};return{...this.motionIdentity,displayStyle:i,inlineStyle:this.element.style.cssText,frame:(d=this.codec)==null?void 0:d.frame,channels:Object.fromEntries(Object.entries(t).map(([p,c])=>[p,{...c,velocity:c.velocity.map(m=>m*e)}]))}}adopt(t){var p,c,m,g,u;this.codec??(this.codec=this.motion.codec??q(this.element)),this.adopted=t;const e=this.codec.read({transform:"none",opacity:1,...this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue)});this.fallbackChannels.clear(),this.fallbackMode=void 0;const i=this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue),o=t.displayStyle;for(const[l,r]of Object.entries(o??{}))l in i&&String(r)!==String(i[l])&&(!t.channels[l]||!e[l])&&this.fallbackChannels.add(l);for(const[l,r]of Object.entries(t.channels)){const y=e[l];y&&!_.compatibleChannel(r,y)&&this.fallbackChannels.add(l)}if(this.fallbackChannels.size&&(this.fallbackMode="finish"),this.fallbackChannels.size&&this.motion.fallback!=="finish"){const l=t;if(l.frame&&l.displayStyle&&t.target.cloneNode&&t.target.parentElement&&!t.target.shadowRoot&&!((c=(p=t.target).matches)!=null&&c.call(p,"canvas, video, audio, iframe, object, embed"))&&!((g=(m=t.target).querySelector)!=null&&g.call(m,"canvas, video, audio, iframe, object, embed"))){this.fallbackMode="crossfade";const r=t.target.cloneNode(!0);r.removeAttribute("id"),r.removeAttribute("data-ssgoi-transition");for(const a of r.querySelectorAll("[id], [data-ssgoi-transition]"))a.removeAttribute("id"),a.removeAttribute("data-ssgoi-transition");r.style.cssText=l.inlineStyle??"",Object.assign(r.style,l.displayStyle,{position:"fixed",left:`${l.frame.left}px`,top:`${l.frame.top}px`,width:`${l.frame.width}px`,height:`${l.frame.height}px`,margin:"0",pointerEvents:"none",zIndex:"2147483646"}),r.setAttribute("aria-hidden","true"),r.inert=!0,t.target.parentElement.appendChild(r);const y=Number(l.displayStyle.opacity??1);this.fallbackCopy=new X({element:r,integrator:{step:(a,f,b)=>({position:Math.min(f,a.position+b/.18),velocity:0}),isSettled:(a,f)=>a.position>=f},style:(a,f)=>({opacity:y*f}),onDispose:()=>r.remove()}),this.adopted={...t,channels:{...t.channels,opacity:{schema:"css:#",value:[0],velocity:[0]}}}}}const d=this.codec.write(this.adopted.channels);(u=this.hold)==null||u.cancel(),Object.keys(d).length&&(this.hold=this.element.animate([d],{duration:1,fill:"both"}),this.hold.pause(),this.hold.currentTime=0)}channelsAt(t){const e=this.presentationFrames[t];if(e)return e.channels;const i=this.frames[t];return this.codec??(this.codec=this.motion.codec??q(this.element)),this.codec.read({transform:"none",opacity:1,...this.styleFn(i.position,this.lowerBound+this.upperBound-i.position)})}samplePresentation(t){const e=this.frames;if(!e.length)return this.adopted?{...this.adopted.channels}:(this.codec??(this.codec=this.motion.codec??q(this.element)),this.codec.read({transform:"none",opacity:1,...this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue)}));let i=e.findIndex(r=>r.time>t);i<0&&(i=e.length-1);const o=Math.max(0,i-1),d=e[o],p=e[i],c=this.channelsAt(o),m=o===i?c:this.channelsAt(i),g=(p.time-d.time)/1e3,u=g?Math.max(0,Math.min(1,(t-d.time)/(g*1e3))):0,l={};for(const[r,y]of Object.entries(c)){const a=m[r];if(!a||!_.compatibleChannel(y,a)){l[r]=y;continue}l[r]={schema:y.schema,value:y.value.map((f,b)=>f+(a.value[b]-f)*u),velocity:y.value.map((f,b)=>t>=e[e.length-1].time||!g?0:(a.value[b]-f)/g)}}return l}releaseFill(){this.clearWaapi()}get isAnimating(){return this.running}get isPaused(){return this.paused}get isComplete(){return this.settled}get isReversing(){return this.reversing}get progress(){this.running&&this.captureLiveState();const t=this.upperBound-this.lowerBound;if(t===0)return 0;const e=(this.currentValue-this.lowerBound)/t;return e<0?0:e>1?1:e}findTimeForProgress(t){if(this.frames.length<2)return null;const e=this.upperBound-this.lowerBound;if(e===0)return 0;for(const i of this.frames)if((i.position-this.lowerBound)/e>=t)return i.time;return this.frames[this.frames.length-1].time}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.waapi&&(this.waapi.playbackRate=t)}getPose(){return this.running&&this.captureLiveState(),[{element:this._element,value:this.currentValue,velocity:this.currentVelocity}]}getTimeline(){const t=this.frames.map((e,i)=>{const o=e.position,d=this.lowerBound+this.upperBound-o;return{time:e.time,value:e.position,velocity:e.velocity,style:this.renderedStyles[i]??this.styleFn(o,d)}});return[{element:this._element,frames:t}]}matchInto(t){const e=t.find(i=>i.element===this._element);e&&(this.currentValue=e.value,this.currentVelocity=e.velocity,this.solverState=void 0)}runToward(t){var m,g;if(this.validate(),this.running||this.paused){const u=this.getMotionSnapshot();this.captureLiveState(),this.adopted=u}if(this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.disposed=!1,this.presentationTime=0,this.presentationFrames=[],this.solverTarget=t,this.frames=_.simulate(this._integrator,this.currentValue,t,this.currentVelocity,this.solverState,!0),this.frames.length===0&&this.adopted&&(this.frames=[{time:0,position:t,velocity:0}]),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,this.finish();return}const e=u=>this.styleFn(u.position,this.lowerBound+this.upperBound-u.position),i=this.adopted?this.bridgeKeyframes(e):this.frames.map(u=>e(u));this.renderedStyles=i,this.adopted=void 0;const o=i[0],d=this.frames[this.frames.length-1],p=d.time;this.runId++;const c=this._element.animate(i,{duration:p,fill:"both",easing:"linear",composite:"replace"});c.playbackRate=this.playbackRate,this.waapi=c,(m=this.fallbackCopy)==null||m.play(),(g=this.hold)==null||g.cancel(),this.hold=null,this.running=!0,c.onfinish=()=>{!this.running||this.waapi!==c||(this.running=!1,this.settled=!0,this.currentValue=d.position,this.currentVelocity=0,this.finish())},this.clearInlineStyle(o),this.beginPlayback(c,p)}bridgeKeyframes(t){var g;this.codec=this.motion.codec??q(this.element);const e=this.codec,i=Math.max(16,this.motion.handoffDuration??280),o=this.frames[this.frames.length-1];for(let u=o.time+1e3/60;u<i+1e3/60;u+=1e3/60)this.frames.push({time:u,position:o.position,velocity:0});const d=this.frames.map(u=>e.read({transform:"none",opacity:1,...t(u)}));for(let u=1;u<d.length;u++){const l=d[u-1].transform,r=d[u].transform;if((l==null?void 0:l.schema)==="viewport-plane-v1"&&(r==null?void 0:r.schema)===l.schema){const y=[...r.value];y[2]=l.value[2]+Math.atan2(Math.sin(y[2]-l.value[2]),Math.cos(y[2]-l.value[2])),d[u].transform={...r,value:y}}}const p=d[0],c=d[1]??p,m={};for(const[u,l]of Object.entries(((g=this.adopted)==null?void 0:g.channels)??{})){let r=p[u];if(!r){const a=u==="transform"?{transform:"none"}:u==="opacity"?{opacity:1}:{};if(r=e.read(a)[u],r)for(const f of d)f[u]=r}if(!r||!_.compatibleChannel(l,r))continue;const y=c[u]??r;m[u]={offset:l.value.map((a,f)=>{let b=a-r.value[f];return u==="transform"&&l.schema==="viewport-plane-v1"&&f===2&&(b=Math.atan2(Math.sin(b),Math.cos(b))),b}),velocity:l.velocity.map((a,f)=>a/Math.max(Math.abs(this.playbackRate),1e-4)-(y.value[f]-r.value[f])*60)}}return this.presentationFrames=this.frames.map((u,l)=>{const r={...d[l]};for(const[y,a]of Object.entries(m)){const f=r[y];r[y]={...f,value:f.value.map((b,S)=>b+_.residualAt(a.offset[S],a.velocity[S],u.time/1e3,i/1e3).value)}}return{time:u.time,channels:r}}),this.frames.map((u,l)=>{const r=this.presentationFrames[l].channels;return{...t(u),...e.write(Object.fromEntries(Object.keys(m).map(y=>[y,r[y]])))}})}clearWaapi(){var t;this.runId++,(t=this.waapi)==null||t.cancel(),this.waapi=null}captureLiveState(){if(this.frames.length===0)return;const t=nt(this.waapi);if(t===null)return;this.presentationTime=t;const{position:e,velocity:i}=_.interpolateFrame(this.frames,t);this.currentValue=e,this.currentVelocity=i,this.solverState=_.sampleIntegratorState(this.frames,t,this._integrator,this.solverTarget)}beginPlayback(t,e){const i=this.playbackRate;if(i<0){t.play();return}i>0&&(t.currentTime=Math.min(e,ct*i))}clearInlineStyle(t){if(t)for(const e of Object.keys(t))this._element.style[e]=""}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[o,d]of Object.entries(i))this._element.style[o]=typeof d=="number"?String(d):d}}function nt(s){const n=s==null?void 0:s.currentTime;return typeof n=="number"?n:null}class ut{constructor(){h(this,"callbacks",new Set);h(this,"frameRequest",null);h(this,"tick",()=>{this.frameRequest=null;for(const n of[...this.callbacks])this.callbacks.has(n)&&n();this.requestFrame()})}subscribe(n){return this.callbacks.add(n),this.requestFrame(),()=>{this.callbacks.delete(n),this.stopIfIdle()}}requestFrame(){this.frameRequest!==null||this.callbacks.size===0||(this.frameRequest=requestAnimationFrame(this.tick))}stopIfIdle(){this.callbacks.size>0||this.frameRequest===null||(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.frameRequest),this.frameRequest=null)}}const dt=new ut;function pt(s){return typeof s.step=="function"?s:_.IntegratorProvider.from(s)}class Y extends Z{constructor(t,e={}){super();h(this,"_children");h(this,"progressChildren");h(this,"_startAt");h(this,"namedChildren");h(this,"restoreChildCallbacks",[]);h(this,"runId",0);h(this,"pendingComplete",0);h(this,"running",!1);h(this,"disposed",!1);h(this,"settled",!1);h(this,"startedChildren",new Set);h(this,"lastMethod","play");h(this,"pausedRun",!1);h(this,"pendingStartObservers",[]);this.namedChildren=new Map(Array.isArray(t)?[]:Object.entries(t)),this._children=Array.isArray(t)?[...t]:[...this.namedChildren.values()];for(const i of this._children)i.deferDisposal=!0;this.progressChildren=this._children.filter(i=>!(i instanceof Y)||i.progressChildren.length>0),(e.mode??"parallel")==="sequence"?this._startAt=this._children.map((i,o)=>o===0?0:1):this._startAt=e.startAt??[]}get children(){return this._children}get startAt(){return this._startAt}set startAt(t){this._startAt=t}tracks(){return this._children.flatMap(t=>[...t.getMotionTracks()])}getMotionTracks(){return this.tracks()}validate(){this.buildDependencies();for(const t of this._children)t.validate()}select(t){const e=this.namedChildren.get(t);if(!e)throw new Error(`Unknown animation child: ${t}`);return e}set(t,e){if(typeof t=="string"){const i=this.select(t);return(e==null?void 0:e.integrator)!==void 0&&i.set({integrator:pt(e.integrator)}),this}return super.set(t)}setIntegrator(t){for(const e of this._children)e.set({integrator:t})}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.pausedRun=this.running||this.pausedRun,this.running=!1,this.clearPendingStartObservers();for(const t of this._children)t.pause()}complete(){var t;if(!this.settled){this.settled=!0,this.running=!1,this.clearPendingStartObservers(),this.restoreCompletionHandlers();for(const e of this._children)e.complete();if(!this.deferDisposal){for(const e of this._children)e.cancel(x);this.disposeResources(x)}(t=this.onComplete)==null||t.call(this)}}get supportsInterruption(){return this._children.every(t=>t.supportsInterruption)}stop(){this.runId++,this.running=!1,this.clearPendingStartObservers(),this.restoreCompletionHandlers();for(const t of this._children)t.stop()}cancel(t){this.stop();for(const e of this._children)e.cancel(t);this.disposeResources(t)}disposeResources(t){var e;if(!this.disposed){this.disposed=!0;try{(e=this.onDispose)==null||e.call(this,t)}catch(i){console.error("[ssgoi] composite cleanup failed",i)}}}get progress(){if(this.progressChildren.length===0)return 0;let t=0;for(const e of this.progressChildren)t+=e.progress;return t/this.progressChildren.length}getPose(){return this._children.flatMap(t=>t.getPose())}getTimeline(){return this._children.flatMap(t=>t.getTimeline())}matchInto(t){for(const e of this._children)e.matchInto(t)}get isAnimating(){return this._children.some(t=>t.isAnimating)}get isPaused(){return this._children.some(t=>t.isPaused)&&this._children.every(t=>t.isPaused||t.isComplete)}get isComplete(){return this.settled}get isReversing(){return this._children.some(t=>t.isReversing)}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t;for(const e of this._children)e.playbackRate=t}startRun(t){const e=this.buildDependencies(),i=this.pausedRun&&t===this.lastMethod,o=t!==this.lastMethod,d=new Set(this.startedChildren),p=new Set(this._children.filter(a=>a.isComplete)),c=t==="reverse"&&d.size?this._children.filter(a=>d.has(a)):[...this._children],m=t==="reverse"?[...c].reverse():c,g=new Map;if(t==="reverse")for(const[a,f]of e){if(!c.includes(a)||!c.includes(f.after))continue;const b=g.get(f.after)??[];b.push({after:a,at:f.at==="settled"?"settled":1-f.at}),g.set(f.after,b)}else for(const[a,f]of e)g.set(a,[f]);if(o||i)for(const a of d)p.has(a)||g.delete(a);this.running&&this.pause(),this.restoreCompletionHandlers();const u=++this.runId;if(this.running=!0,this.pausedRun=!1,this.lastMethod=t,this.disposed=!1,this.settled=!1,this.pendingComplete=c.length,!i&&!o&&this.startedChildren.clear(),this.pendingComplete===0){this.handleFinished();return}const l=new Set,r=new Set;if(i)for(const a of c)d.has(a)&&p.has(a)&&(r.add(a),l.add(a),this.pendingComplete--);for(const a of c){const f=a.onComplete,b=()=>{if(!(this.runId!==u||!this.running||l.has(a))){try{f==null||f()}catch(S){console.error("[ssgoi] animation completion failed",S)}l.add(a),--this.pendingComplete===0&&this.handleFinished()}};a.onComplete=b,this.restoreChildCallbacks.push(()=>{a.onComplete===b&&(a.onComplete=f)})}const y=()=>{let a=!0;for(;this.running&&this.runId===u&&a;){a=!1;for(const f of m)!this.running||r.has(f)||(g.get(f)??[]).some(S=>!r.has(S.after)||!this.hasReachedThreshold(S.after,S.at,t))||(r.add(f),this.startedChildren.add(f),f[t](),a=!0)}r.size===c.length&&this.clearPendingStartObservers()};y(),this.pendingComplete===0&&this.handleFinished(),this.running&&r.size!==c.length&&this.pendingStartObservers.push(dt.subscribe(y))}buildDependencies(){const t=new Map,e=new Set(this._children);if(e.size!==this._children.length)throw new Error("Each child animation must occur once in a MultiAnimation");this._children.forEach((p,c)=>{const m=p.startCondition;if(m){if(!e.has(m.after))throw new Error("startAt.after must reference a sibling in the same MultiAnimation");t.set(p,{...m})}else c>0&&this._startAt.some(g=>g>0)&&t.set(p,{after:this._children[c-1],at:this._startAt[c]??0})});const i=new Set,o=new Set,d=p=>{if(o.has(p))throw new Error("Animation startAt dependencies form a cycle");if(i.has(p))return;o.add(p);const c=t.get(p);c&&d(c.after),o.delete(p),i.add(p)};return this._children.forEach(d),t}hasReachedThreshold(t,e,i){return t.isComplete?!0:e==="settled"?!1:e<=0?!0:(i==="play"?t.progress:1-t.progress)>=e}clearPendingStartObservers(){for(const t of this.pendingStartObservers)t();this.pendingStartObservers=[]}restoreCompletionHandlers(){for(const t of this.restoreChildCallbacks)t();this.restoreChildCallbacks=[]}handleFinished(){var t;if(this.running){if(this.running=!1,this.settled=!0,this.clearPendingStartObservers(),this.restoreCompletionHandlers(),!this.deferDisposal){for(const e of this._children)e.cancel(x);this.disposeResources(x)}(t=this.onComplete)==null||t.call(this)}}findTimeForProgress(t){return null}}const K=new WeakMap;function ft(s){const n=K.get(s)??{value:s.style.getPropertyValue("opacity"),priority:s.style.getPropertyPriority("opacity"),opacity:typeof getComputedStyle=="function"?Number.parseFloat(getComputedStyle(s).opacity):Number.NaN,users:new Set},t={};n.users.add(t),K.set(s,n);let e=!1;return{opacity:Number.isFinite(n.opacity)?n.opacity:1,set:i=>{t.value=i,s.style.opacity=String(i)},restore:()=>{if(!e){if(e=!0,n.users.delete(t),n.users.size>0){const i=Array.from(n.users),o=i[i.length-1];(o==null?void 0:o.value)!==void 0&&(s.style.opacity=String(o.value));return}n.value?s.style.setProperty("opacity",n.value,n.priority):s.style.removeProperty("opacity"),K.delete(s)}}}}exports.Animation=Z;exports.MultiAnimation=Y;exports.WebAnimation=X;exports.createWebPresentationCodec=q;exports.finishedDisposal=x;exports.retainOpacity=ft;