@ssgoi/core 6.6.4 → 6.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/web-animation.d.ts +10 -3
- package/dist/animation/web-animation.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +6 -6
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/{multi-animation-Ch5rI3rB.js → multi-animation-1FueEz2Q.js} +126 -91
- package/dist/multi-animation-qtH1IKNG.cjs +1 -0
- package/package.json +1 -1
- package/dist/multi-animation-uzEnQnrG.cjs +0 -1
|
@@ -19,9 +19,11 @@ export interface WebAnimationOptions {
|
|
|
19
19
|
* Lifecycle:
|
|
20
20
|
* 1. `play()` / `reverse()` calls `simulate()` from the current (position,
|
|
21
21
|
* velocity) toward the target bound, producing a frame list.
|
|
22
|
-
* 2. Frames are converted to WAAPI keyframes; `element.animate(...)`
|
|
22
|
+
* 2. Frames are converted to WAAPI keyframes; `element.animate(...)` is armed
|
|
23
|
+
* at 0 ms, waits for the browser's pending setup, then starts.
|
|
23
24
|
* 3. While playing, `getPose()` interpolates the live position from frames
|
|
24
|
-
* using `
|
|
25
|
+
* using WAAPI's `currentTime`, so browser setup latency is not counted as
|
|
26
|
+
* animation progress.
|
|
25
27
|
*
|
|
26
28
|
* Identity for motion matching is the DOM element itself — when a previous
|
|
27
29
|
* animation's pose is handed in via `matchInto`, we look up by element.
|
|
@@ -36,7 +38,10 @@ export declare class WebAnimation extends Animation {
|
|
|
36
38
|
private currentVelocity;
|
|
37
39
|
private frames;
|
|
38
40
|
private waapi;
|
|
39
|
-
private
|
|
41
|
+
private runId;
|
|
42
|
+
private waitingForStart;
|
|
43
|
+
private startReady;
|
|
44
|
+
private pendingFirstFrame;
|
|
40
45
|
private running;
|
|
41
46
|
private paused;
|
|
42
47
|
private settled;
|
|
@@ -68,6 +73,8 @@ export declare class WebAnimation extends Animation {
|
|
|
68
73
|
private runToward;
|
|
69
74
|
private clearWaapi;
|
|
70
75
|
private captureLiveState;
|
|
76
|
+
private startWhenReady;
|
|
77
|
+
private playPreparedWaapi;
|
|
71
78
|
private applyStyleAt;
|
|
72
79
|
}
|
|
73
80
|
//# 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,EACL,KAAK,UAAU,EAGhB,MAAM,cAAc,CAAC;
|
|
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,EACL,KAAK,UAAU,EAGhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,WAAW,CAAC;IAC7C,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAQD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,mBAAmB;IAYrC,IAAI,IAAI,IAAI;IAiBZ,OAAO,IAAI,IAAI;IAQf,KAAK,IAAI,IAAI;IAUb,QAAQ,IAAI,IAAI;IAWhB;;;;;;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;IAS9B,OAAO,CAAC,SAAS;IA8DjB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,gBAAgB;YASV,cAAc;IAsB5B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,YAAY;CAQrB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ut=Object.defineProperty;var Nt=(e,t,n)=>t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t,n)=>Nt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./multi-animation-uzEnQnrG.cjs");function _(e,t){const n=[];for(let s=0;s<e.length;s++)for(let o=s+1;o<e.length;o++){const i=e[s],l=e[o];!i||!l||n.push({from:i,to:l,transition:t(),symmetric:!0})}return n}function Tt(e,t){return[{from:e.exit,to:e.enter,transition:t("enter")},{from:e.enter,to:e.exit,transition:t("exit")}]}function nt(e,t,n){const s=[];for(let o=0;o<e.length;o++)for(let i=o+1;i<e.length;i++){const l=e[o],a=e[i];!l||!a||s.push({from:l,to:a,transition:n(t.forward)},{from:a,to:l,transition:n(t.backward)})}return s}class H{constructor(t){E(this,"omega");E(this,"zeta");E(this,"restDelta");E(this,"restSpeed");const{stiffness:n,damping:s}=t,o=1;this.omega=Math.sqrt(n/o),this.zeta=s/(2*Math.sqrt(n*o)),this.restDelta=t.restDelta??u.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??u.VELOCITY_THRESHOLD}step(t,n,s){const o=Math.min(s,.033),{omega:i,zeta:l}=this,{position:a,velocity:r}=t,c=-2*o*l*i*r,d=o*i*i*(n-a),p=r+c+d;return{position:a+o*p,velocity:p}}isSettled(t,n){const s=Math.abs(n-t.position),o=Math.abs(t.velocity);return s<this.restDelta&&o<this.restSpeed}}class Vt{constructor(t){E(this,"leader");E(this,"follower");E(this,"restDelta");E(this,"restSpeed");this.restDelta=t.restDelta??u.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??u.VELOCITY_THRESHOLD,this.leader=new H({stiffness:t.stiffness,damping:t.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let n,s,o,i;typeof t.follower=="number"?(n=t.stiffness*t.follower,s=t.damping):t.follower?(n=t.follower.stiffness,s=t.follower.damping,o=t.follower.restDelta,i=t.follower.restSpeed):(n=t.stiffness,s=t.damping),this.follower=new H({stiffness:n,damping:s,restDelta:o??this.restDelta,restSpeed:i??this.restSpeed})}step(t,n,s){const i=t._leader??{position:t.position,velocity:t.velocity},l=this.leader.step(i,n,s),a=this.follower.step(t,l.position,s);return{position:a.position,velocity:a.velocity,_leader:l}}isSettled(t,n){const s=t,o=Math.abs(n-t.position)<this.restDelta&&Math.abs(t.velocity)<this.restSpeed;return s._leader?Math.abs(n-s._leader.position)<this.restDelta&&Math.abs(s._leader.velocity)<this.restSpeed&&o:o}}const Xt=.01,Bt=500,Zt=10;class qt{constructor(t){E(this,"acceleration");E(this,"resistance");E(this,"resistanceType");E(this,"min");E(this,"max");E(this,"bounceStiffness");E(this,"bounceDamping");E(this,"restDelta");this.acceleration=t.acceleration,this.resistance=t.resistance,this.resistanceType=t.resistanceType??"quadratic",this.min=t.min,this.max=t.max,this.bounceStiffness=t.bounceStiffness??Bt,this.bounceDamping=t.bounceDamping??Zt,this.restDelta=t.restDelta??Xt}step(t,n,s){const o=Math.min(s,.033),{acceleration:i,resistance:l,resistanceType:a,min:r,max:c}=this,{position:d,velocity:p}=t,f=r!==void 0&&d<r,m=c!==void 0&&d>c;let y;if(f||m){const S=d-(f?r:c),x=-this.bounceStiffness*S,$=-this.bounceDamping*p;y=x+$}else{const w=n>d?1:-1;let S;a==="linear"?S=l*p:S=l*p*Math.abs(p),y=w*i-S}const h=p+y*o;let b=d+h*o;if(!f&&!m){const w=n>d?1:-1;(w>0&&b>n||w<0&&b<n)&&(b=n)}return{position:b,velocity:b===n?0:h}}isSettled(t,n){return Math.abs(n-t.position)<this.restDelta}}class g{static from(t){if(t.spring&&t.inertia)throw new Error("Cannot use both 'spring' and 'inertia' together. Choose one physics type.");if(t.inertia)return new qt({acceleration:t.inertia.acceleration,resistance:t.inertia.resistance,resistanceType:t.inertia.resistanceType,min:t.inertia.min,max:t.inertia.max,bounceStiffness:t.inertia.bounceStiffness,bounceDamping:t.inertia.bounceDamping,restDelta:t.inertia.restDelta});const n=t.spring??{stiffness:300,damping:30};if(n.doubleSpring){const s=n.doubleSpring;let o;return typeof s=="number"?o=s:typeof s=="object"&&(o={stiffness:s.stiffness,damping:s.damping}),new Vt({stiffness:n.stiffness,damping:n.damping,follower:o,restDelta:n.restDelta,restSpeed:n.restSpeed})}return new H({stiffness:n.stiffness,damping:n.damping,restDelta:n.restDelta,restSpeed:n.restSpeed})}static fromSpring(t){return g.from({spring:t})}}class jt{constructor(t){E(this,"durationSec");this.durationSec=Math.max(1/60,t.durationSec)}step(t,n,s){const o=n-t.position;if(o===0)return t;const i=Math.sign(o),l=Math.abs(o)/this.durationSec,a=i*l*s,r=t.position+a;return(i>0?r>=n:r<=n)?{position:n,velocity:0}:{position:r,velocity:i*l}}isSettled(t,n){return Math.abs(t.position-n)<u.POSITION_THRESHOLD}}function R(e,t){function n(i){let l=0,a=0;const r=i.offsetWidth,c=i.offsetHeight;let d=i;for(;d;)l+=d.offsetTop,a+=d.offsetLeft,d=d.offsetParent;return l-=window.scrollY,a-=window.scrollX,{top:l,left:a,width:r,height:c}}const s=n(e),o=n(t);return new DOMRect(o.left-s.left,o.top-s.top,o.width,o.height)}function ot(e,t){const n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),o=e.offsetWidth>0?n.width/e.offsetWidth:1,i=e.offsetHeight>0?n.height/e.offsetHeight:1;return new DOMRect((s.left-n.left)/o,(s.top-n.top)/i,s.width/o,s.height/i)}function O(e,t){const{scrollingElement:n,positionedParent:s}=e,o=n!==s&&n.contains(s)?R(n,s).top:0;return{top:e[t].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-o}}function Dt(e,t){const{scrollingElement:n,positionedParent:s}=e,o=n!==s&&n.contains(s)?R(n,s).top:0;return{top:e[t].scroll.y-o,height:n.clientHeight}}const it=8,rt={spring:{stiffness:1e3,damping:40,doubleSpring:1.2,restDelta:.1,restSpeed:.1}};function Kt({direction:e}){const t=e==="forward"?it:-it;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${t}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${t*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function Gt(){return{outPhysics:rt,inPhysics:rt,composition:{mode:"parallel",startAt:[0,0]},build:Kt}}const at=30,Jt={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},Qt={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function te({direction:e}){const t=e==="forward"?1:-1,n=-at*t,s=at*t;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`translate3d(${n*o}px, 0, 0)`,opacity:`${1-o}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${s}px, 0, 0)`,opacity:"0"},animate:o=>({transform:`translate3d(${s*(1-o)}px, 0, 0)`,opacity:`${o}`})}}}function ee(){return{outPhysics:Jt,inPhysics:Qt,composition:{mode:"sequence"},build:te}}const ne={snappy:Gt(),fluid:ee()},lt=8,se={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},oe={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function ie({direction:e}){const t=e==="forward"?1:-1,n=-lt*t,s=lt*t;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`translate3d(0, ${n*o}px, 0)`,opacity:`${1-o}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${s}px, 0)`,opacity:"0"},animate:o=>({transform:`translate3d(0, ${s*(1-o)}px, 0)`,opacity:`${o}`})}}}function re(){return{outPhysics:se,inPhysics:oe,composition:{mode:"sequence"},build:ie}}const ae=8,le={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},ce={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function pe(e){const t=ae;return{out:{willChange:"opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${t}px, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(0, ${t*(1-n)}px, 0)`,opacity:`${n}`})}}}function de(){return{outPhysics:le,inPhysics:ce,composition:{mode:"sequence"},build:pe}}const ct=re(),fe={snappy:ct,directional:ct,"non-directional":de()},pt={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},U=.1,N=1/3,dt=e=>Math.max(0,Math.min(1,e));function ye({direction:e}){const t=e==="forward"?1:-1,n=1-t*U;return{out:{willChange:"transform, opacity",startStyle:{},animate:s=>({transform:`scale(${1+t*s*U})`,opacity:`${dt(1-s/N)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${n})`,opacity:"0"},animate:s=>({transform:`scale(${n+t*s*U})`,opacity:`${dt((s-N)/(1-N))}`})}}}function he(){return{outPhysics:pt,inPhysics:pt,composition:{mode:"parallel"},build:ye}}const ft={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},V=.1,X=1/3,yt=e=>Math.max(0,Math.min(1,e));function ue(){return{out:{willChange:"opacity",startStyle:{},animate:e=>({opacity:`${yt(1-e/X)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-V})`,opacity:"0"},animate:e=>({transform:`scale(${1-V+e*V})`,opacity:`${yt((e-X)/(1-X))}`})}}}function me(){return{outPhysics:ft,inPhysics:ft,composition:{mode:"parallel"},build:ue}}const ht=he(),ge={snappy:ht,directional:ht,"non-directional":me()},be={x:ne,y:fe,z:ge};function we(e,t){const n=be[e];return n[t]??n.snappy}const Se="x",$e="snappy";function ut(e,t){e.style.willChange=t.willChange,e.style.backfaceVisibility="hidden",e.style.contain="layout paint";for(const[n,s]of Object.entries(t.startStyle))e.style[n]=s}function Ft(e){e.style.willChange="auto",e.style.backfaceVisibility="",e.style.contain="",e.style.transform="",e.style.opacity="",e.style.clipPath=""}function Ce(e){Ft(e),e.style.pointerEvents=""}const Ee=(e={})=>{const t=e.direction??"forward",n=e.type??Se,s=e.feel??$e,o=we(n,s),i=o.build({direction:t});return{prepare:({from:l,to:a})=>(l.then(r=>{ut(r,i.out),r.style.pointerEvents="none"}),a.then(r=>{ut(r,i.in)}),{}),animation:({from:l,to:a,context:r})=>{if(n==="z"){const p=O(r,"from"),f=O(r,"to");l.style.clipPath=`inset(${p.top}px 0 calc(100% - ${p.top+p.height}px) 0)`,a.style.clipPath=`inset(${f.top}px 0 calc(100% - ${f.top+f.height}px) 0)`}const c=new u.WebAnimation({element:l,integrator:g.from(o.outPhysics),style:p=>i.out.animate(p),onComplete:()=>Ce(l)}),d=new u.WebAnimation({element:a,integrator:g.from(o.inPhysics),style:p=>i.in.animate(p),onComplete:()=>Ft(a)});return new u.MultiAnimation([c,d],o.composition)}}};function xe(e,t,n){return e==="y"?t==="non-directional"?"non-directional":"directional":e!=="x"||t==="snappy"||n==="snappy"?"snappy":"fluid"}function Ae(e){const{paths:t}=e,n=e.type??"x",s=e.variant,o=e.feel,i=xe(n,s,o);return nt(t,{forward:"forward",backward:"backward"},l=>Ee({type:n,direction:l,feel:i}))}const Pe={spring:{stiffness:200,damping:22}},_e=10,Ie="horizontal",ve="#000000";function mt(e,t,n,s,o,i){window.getComputedStyle(e).position==="static"&&(e.style.position="relative");const a=document.createElement("div");a.style.cssText=`
|
|
1
|
+
"use strict";var Ut=Object.defineProperty;var Nt=(e,t,n)=>t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t,n)=>Nt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./multi-animation-qtH1IKNG.cjs");function _(e,t){const n=[];for(let s=0;s<e.length;s++)for(let o=s+1;o<e.length;o++){const i=e[s],l=e[o];!i||!l||n.push({from:i,to:l,transition:t(),symmetric:!0})}return n}function Tt(e,t){return[{from:e.exit,to:e.enter,transition:t("enter")},{from:e.enter,to:e.exit,transition:t("exit")}]}function nt(e,t,n){const s=[];for(let o=0;o<e.length;o++)for(let i=o+1;i<e.length;i++){const l=e[o],a=e[i];!l||!a||s.push({from:l,to:a,transition:n(t.forward)},{from:a,to:l,transition:n(t.backward)})}return s}class H{constructor(t){E(this,"omega");E(this,"zeta");E(this,"restDelta");E(this,"restSpeed");const{stiffness:n,damping:s}=t,o=1;this.omega=Math.sqrt(n/o),this.zeta=s/(2*Math.sqrt(n*o)),this.restDelta=t.restDelta??u.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??u.VELOCITY_THRESHOLD}step(t,n,s){const o=Math.min(s,.033),{omega:i,zeta:l}=this,{position:a,velocity:r}=t,c=-2*o*l*i*r,d=o*i*i*(n-a),p=r+c+d;return{position:a+o*p,velocity:p}}isSettled(t,n){const s=Math.abs(n-t.position),o=Math.abs(t.velocity);return s<this.restDelta&&o<this.restSpeed}}class Vt{constructor(t){E(this,"leader");E(this,"follower");E(this,"restDelta");E(this,"restSpeed");this.restDelta=t.restDelta??u.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??u.VELOCITY_THRESHOLD,this.leader=new H({stiffness:t.stiffness,damping:t.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let n,s,o,i;typeof t.follower=="number"?(n=t.stiffness*t.follower,s=t.damping):t.follower?(n=t.follower.stiffness,s=t.follower.damping,o=t.follower.restDelta,i=t.follower.restSpeed):(n=t.stiffness,s=t.damping),this.follower=new H({stiffness:n,damping:s,restDelta:o??this.restDelta,restSpeed:i??this.restSpeed})}step(t,n,s){const i=t._leader??{position:t.position,velocity:t.velocity},l=this.leader.step(i,n,s),a=this.follower.step(t,l.position,s);return{position:a.position,velocity:a.velocity,_leader:l}}isSettled(t,n){const s=t,o=Math.abs(n-t.position)<this.restDelta&&Math.abs(t.velocity)<this.restSpeed;return s._leader?Math.abs(n-s._leader.position)<this.restDelta&&Math.abs(s._leader.velocity)<this.restSpeed&&o:o}}const Xt=.01,Bt=500,Zt=10;class qt{constructor(t){E(this,"acceleration");E(this,"resistance");E(this,"resistanceType");E(this,"min");E(this,"max");E(this,"bounceStiffness");E(this,"bounceDamping");E(this,"restDelta");this.acceleration=t.acceleration,this.resistance=t.resistance,this.resistanceType=t.resistanceType??"quadratic",this.min=t.min,this.max=t.max,this.bounceStiffness=t.bounceStiffness??Bt,this.bounceDamping=t.bounceDamping??Zt,this.restDelta=t.restDelta??Xt}step(t,n,s){const o=Math.min(s,.033),{acceleration:i,resistance:l,resistanceType:a,min:r,max:c}=this,{position:d,velocity:p}=t,f=r!==void 0&&d<r,m=c!==void 0&&d>c;let y;if(f||m){const S=d-(f?r:c),x=-this.bounceStiffness*S,$=-this.bounceDamping*p;y=x+$}else{const w=n>d?1:-1;let S;a==="linear"?S=l*p:S=l*p*Math.abs(p),y=w*i-S}const h=p+y*o;let b=d+h*o;if(!f&&!m){const w=n>d?1:-1;(w>0&&b>n||w<0&&b<n)&&(b=n)}return{position:b,velocity:b===n?0:h}}isSettled(t,n){return Math.abs(n-t.position)<this.restDelta}}class g{static from(t){if(t.spring&&t.inertia)throw new Error("Cannot use both 'spring' and 'inertia' together. Choose one physics type.");if(t.inertia)return new qt({acceleration:t.inertia.acceleration,resistance:t.inertia.resistance,resistanceType:t.inertia.resistanceType,min:t.inertia.min,max:t.inertia.max,bounceStiffness:t.inertia.bounceStiffness,bounceDamping:t.inertia.bounceDamping,restDelta:t.inertia.restDelta});const n=t.spring??{stiffness:300,damping:30};if(n.doubleSpring){const s=n.doubleSpring;let o;return typeof s=="number"?o=s:typeof s=="object"&&(o={stiffness:s.stiffness,damping:s.damping}),new Vt({stiffness:n.stiffness,damping:n.damping,follower:o,restDelta:n.restDelta,restSpeed:n.restSpeed})}return new H({stiffness:n.stiffness,damping:n.damping,restDelta:n.restDelta,restSpeed:n.restSpeed})}static fromSpring(t){return g.from({spring:t})}}class jt{constructor(t){E(this,"durationSec");this.durationSec=Math.max(1/60,t.durationSec)}step(t,n,s){const o=n-t.position;if(o===0)return t;const i=Math.sign(o),l=Math.abs(o)/this.durationSec,a=i*l*s,r=t.position+a;return(i>0?r>=n:r<=n)?{position:n,velocity:0}:{position:r,velocity:i*l}}isSettled(t,n){return Math.abs(t.position-n)<u.POSITION_THRESHOLD}}function R(e,t){function n(i){let l=0,a=0;const r=i.offsetWidth,c=i.offsetHeight;let d=i;for(;d;)l+=d.offsetTop,a+=d.offsetLeft,d=d.offsetParent;return l-=window.scrollY,a-=window.scrollX,{top:l,left:a,width:r,height:c}}const s=n(e),o=n(t);return new DOMRect(o.left-s.left,o.top-s.top,o.width,o.height)}function ot(e,t){const n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),o=e.offsetWidth>0?n.width/e.offsetWidth:1,i=e.offsetHeight>0?n.height/e.offsetHeight:1;return new DOMRect((s.left-n.left)/o,(s.top-n.top)/i,s.width/o,s.height/i)}function O(e,t){const{scrollingElement:n,positionedParent:s}=e,o=n!==s&&n.contains(s)?R(n,s).top:0;return{top:e[t].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-o}}function Dt(e,t){const{scrollingElement:n,positionedParent:s}=e,o=n!==s&&n.contains(s)?R(n,s).top:0;return{top:e[t].scroll.y-o,height:n.clientHeight}}const it=8,rt={spring:{stiffness:800,damping:40,doubleSpring:1.2,restDelta:.1,restSpeed:.1}};function Kt({direction:e}){const t=e==="forward"?it:-it;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${t}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${t*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function Gt(){return{outPhysics:rt,inPhysics:rt,composition:{mode:"parallel",startAt:[0,0]},build:Kt}}const at=30,Jt={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},Qt={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function te({direction:e}){const t=e==="forward"?1:-1,n=-at*t,s=at*t;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`translate3d(${n*o}px, 0, 0)`,opacity:`${1-o}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${s}px, 0, 0)`,opacity:"0"},animate:o=>({transform:`translate3d(${s*(1-o)}px, 0, 0)`,opacity:`${o}`})}}}function ee(){return{outPhysics:Jt,inPhysics:Qt,composition:{mode:"sequence"},build:te}}const ne={snappy:Gt(),fluid:ee()},lt=8,se={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},oe={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function ie({direction:e}){const t=e==="forward"?1:-1,n=-lt*t,s=lt*t;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`translate3d(0, ${n*o}px, 0)`,opacity:`${1-o}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${s}px, 0)`,opacity:"0"},animate:o=>({transform:`translate3d(0, ${s*(1-o)}px, 0)`,opacity:`${o}`})}}}function re(){return{outPhysics:se,inPhysics:oe,composition:{mode:"sequence"},build:ie}}const ae=8,le={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},ce={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function pe(e){const t=ae;return{out:{willChange:"opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${t}px, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(0, ${t*(1-n)}px, 0)`,opacity:`${n}`})}}}function de(){return{outPhysics:le,inPhysics:ce,composition:{mode:"sequence"},build:pe}}const ct=re(),fe={snappy:ct,directional:ct,"non-directional":de()},pt={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},U=.1,N=1/3,dt=e=>Math.max(0,Math.min(1,e));function ye({direction:e}){const t=e==="forward"?1:-1,n=1-t*U;return{out:{willChange:"transform, opacity",startStyle:{},animate:s=>({transform:`scale(${1+t*s*U})`,opacity:`${dt(1-s/N)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${n})`,opacity:"0"},animate:s=>({transform:`scale(${n+t*s*U})`,opacity:`${dt((s-N)/(1-N))}`})}}}function he(){return{outPhysics:pt,inPhysics:pt,composition:{mode:"parallel"},build:ye}}const ft={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},V=.1,X=1/3,yt=e=>Math.max(0,Math.min(1,e));function ue(){return{out:{willChange:"opacity",startStyle:{},animate:e=>({opacity:`${yt(1-e/X)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-V})`,opacity:"0"},animate:e=>({transform:`scale(${1-V+e*V})`,opacity:`${yt((e-X)/(1-X))}`})}}}function me(){return{outPhysics:ft,inPhysics:ft,composition:{mode:"parallel"},build:ue}}const ht=he(),ge={snappy:ht,directional:ht,"non-directional":me()},be={x:ne,y:fe,z:ge};function we(e,t){const n=be[e];return n[t]??n.snappy}const Se="x",$e="snappy";function ut(e,t){e.style.willChange=t.willChange,e.style.backfaceVisibility="hidden",e.style.contain="layout paint";for(const[n,s]of Object.entries(t.startStyle))e.style[n]=s}function Ft(e){e.style.willChange="auto",e.style.backfaceVisibility="",e.style.contain="",e.style.transform="",e.style.opacity="",e.style.clipPath=""}function Ce(e){Ft(e),e.style.pointerEvents=""}const Ee=(e={})=>{const t=e.direction??"forward",n=e.type??Se,s=e.feel??$e,o=we(n,s),i=o.build({direction:t});return{prepare:({from:l,to:a})=>(l.then(r=>{ut(r,i.out),r.style.pointerEvents="none"}),a.then(r=>{ut(r,i.in)}),{}),animation:({from:l,to:a,context:r})=>{if(n==="z"){const p=O(r,"from"),f=O(r,"to");l.style.clipPath=`inset(${p.top}px 0 calc(100% - ${p.top+p.height}px) 0)`,a.style.clipPath=`inset(${f.top}px 0 calc(100% - ${f.top+f.height}px) 0)`}const c=new u.WebAnimation({element:l,integrator:g.from(o.outPhysics),style:p=>i.out.animate(p),onComplete:()=>Ce(l)}),d=new u.WebAnimation({element:a,integrator:g.from(o.inPhysics),style:p=>i.in.animate(p),onComplete:()=>Ft(a)});return new u.MultiAnimation([c,d],o.composition)}}};function xe(e,t,n){return e==="y"?t==="non-directional"?"non-directional":"directional":e!=="x"||t==="snappy"||n==="snappy"?"snappy":"fluid"}function Ae(e){const{paths:t}=e,n=e.type??"x",s=e.variant,o=e.feel,i=xe(n,s,o);return nt(t,{forward:"forward",backward:"backward"},l=>Ee({type:n,direction:l,feel:i}))}const Pe={spring:{stiffness:200,damping:22}},_e=10,Ie="horizontal",ve="#000000";function mt(e,t,n,s,o,i){window.getComputedStyle(e).position==="static"&&(e.style.position="relative");const a=document.createElement("div");a.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
transform: scaleY(${o==="hidden"?0:1});
|
|
28
28
|
transform-origin: ${i==="left"?"top":"bottom"} center;
|
|
29
29
|
will-change: transform;
|
|
30
|
-
`}r.push(d),a.appendChild(d)}return e.appendChild(a),{container:a,blinds:r}}const Oe=(e={})=>{const t=e.blindCount??_e,n=e.direction??Ie,s=e.blindColor??ve,o=e.physics??Pe;return{prepare:async({from:i,to:l})=>{const a=await i,r=await l;a.style.zIndex="1000";const c=mt(a,t,n,s,"hidden","left");r.style.position="relative",r.style.zIndex="0";const d=mt(r,t,n,s,"closed","right");return{fromEl:a,fromBlinds:c.blinds,fromContainer:c.container,toBlinds:d.blinds,toContainer:d.container}},animation:({fromEl:i,fromBlinds:l,fromContainer:a,toBlinds:r,toContainer:c})=>{const d=l.map(y=>new u.WebAnimation({element:y,integrator:g.from(o),style:h=>({transform:n==="horizontal"?`scaleX(${h})`:`scaleY(${h})`})})),p=r.map((y,h)=>new u.WebAnimation({element:y,integrator:g.from(o),style:(b,w)=>({transform:n==="horizontal"?`scaleX(${w})`:`scaleY(${w})`}),onComplete:h===r.length-1?()=>{c.remove(),a.remove(),i.style.zIndex="",i.style.position=""}:void 0})),f=new u.MultiAnimation(d,{mode:"parallel"}),m=new u.MultiAnimation(p,{mode:"parallel"});return new u.MultiAnimation([f,m],{mode:"sequence"})}}};function Te(e){const{paths:t,type:n="horizontal"}=e;return _(t,()=>Oe({direction:n}))}const De={spring:{stiffness:200,damping:20,doubleSpring:.7}},k=.5;function Fe(e){const t=e==="enter"?-100:100,n=e==="enter"?100:-100;return{out:{willChange:"transform, opacity",startStyle:{},animate:s=>({transform:`translate3d(${t*s}%, 0, 0)`,opacity:`${k+(1-k)*(1-s)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${n}%, 0, 0)`,opacity:`${k}`},animate:s=>({transform:`translate3d(${n*(1-s)}%, 0, 0)`,opacity:`${k+(1-k)*s}`})}}}function ke(){return{physics:De,build:Fe}}const Ye={spring:{stiffness:
|
|
30
|
+
`}r.push(d),a.appendChild(d)}return e.appendChild(a),{container:a,blinds:r}}const Oe=(e={})=>{const t=e.blindCount??_e,n=e.direction??Ie,s=e.blindColor??ve,o=e.physics??Pe;return{prepare:async({from:i,to:l})=>{const a=await i,r=await l;a.style.zIndex="1000";const c=mt(a,t,n,s,"hidden","left");r.style.position="relative",r.style.zIndex="0";const d=mt(r,t,n,s,"closed","right");return{fromEl:a,fromBlinds:c.blinds,fromContainer:c.container,toBlinds:d.blinds,toContainer:d.container}},animation:({fromEl:i,fromBlinds:l,fromContainer:a,toBlinds:r,toContainer:c})=>{const d=l.map(y=>new u.WebAnimation({element:y,integrator:g.from(o),style:h=>({transform:n==="horizontal"?`scaleX(${h})`:`scaleY(${h})`})})),p=r.map((y,h)=>new u.WebAnimation({element:y,integrator:g.from(o),style:(b,w)=>({transform:n==="horizontal"?`scaleX(${w})`:`scaleY(${w})`}),onComplete:h===r.length-1?()=>{c.remove(),a.remove(),i.style.zIndex="",i.style.position=""}:void 0})),f=new u.MultiAnimation(d,{mode:"parallel"}),m=new u.MultiAnimation(p,{mode:"parallel"});return new u.MultiAnimation([f,m],{mode:"sequence"})}}};function Te(e){const{paths:t,type:n="horizontal"}=e;return _(t,()=>Oe({direction:n}))}const De={spring:{stiffness:200,damping:20,doubleSpring:.7}},k=.5;function Fe(e){const t=e==="enter"?-100:100,n=e==="enter"?100:-100;return{out:{willChange:"transform, opacity",startStyle:{},animate:s=>({transform:`translate3d(${t*s}%, 0, 0)`,opacity:`${k+(1-k)*(1-s)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${n}%, 0, 0)`,opacity:`${k}`},animate:s=>({transform:`translate3d(${n*(1-s)}%, 0, 0)`,opacity:`${k+(1-k)*s}`})}}}function ke(){return{physics:De,build:Fe}}const Ye={spring:{stiffness:160,damping:22}};function Le(e){const t=e==="enter"?-20:100,n=e==="enter"?100:-20;return{out:{willChange:"transform",startStyle:{},animate:s=>({transform:`translate3d(${t*s}%, 0, 0)`})},in:{willChange:"transform",startStyle:{transform:`translate3d(${n}%, 0, 0)`},animate:s=>({transform:`translate3d(${n*(1-s)}%, 0, 0)`})}}}function Me(){return{physics:Ye,build:Le}}const He={parallax:Me(),crossfade:ke()},I="0",kt="1",v="2",We="parallax";function gt(e,t){e.style.willChange=t.willChange,e.style.backfaceVisibility="hidden",e.style.contain="layout paint";for(const[n,s]of Object.entries(t.startStyle))e.style[n]=s}const ze=(e={})=>{const t=e.direction??"enter",n=He[e.type??We],s=n.physics,o=n.build(t),i=t==="enter"?I:v,l=t==="enter"?v:I;return{prepare:({from:a,to:r})=>(a.then(c=>{gt(c,o.out),c.style.pointerEvents="none",c.style.zIndex=i}),r.then(c=>{gt(c,o.in),c.style.position="relative",c.style.zIndex=l}),{}),animation:({from:a,to:r})=>{const c=new u.WebAnimation({element:a,integrator:g.from(s),style:p=>o.out.animate(p),onComplete:()=>{a.style.willChange="auto",a.style.backfaceVisibility="",a.style.contain="",a.style.transform="",a.style.opacity="",a.style.pointerEvents="",a.style.zIndex=""}}),d=new u.WebAnimation({element:r,integrator:g.from(s),style:p=>o.in.animate(p),onComplete:()=>{r.style.willChange="auto",r.style.backfaceVisibility="",r.style.contain="",r.style.transform="",r.style.opacity="",r.style.position==="relative"&&(r.style.position=""),r.style.zIndex===l&&(r.style.zIndex="")}});for(const p of[c,d]){const f=p.onComplete;p.onComplete=()=>{f==null||f(),p.releaseFill()}}return new u.MultiAnimation([c,d],{mode:"parallel"})}}};function Re(e){return e==="slide"||e==="crossfade"?"crossfade":"parallax"}function Ue(e){const{enter:t,exit:n}=e,s=e.type,o=Re(s);return Tt({enter:t,exit:n},i=>ze({direction:i,type:o}))}const Ne={spring:{stiffness:180,damping:20,doubleSpring:!0}},Ve={spring:{stiffness:170,damping:20,doubleSpring:!0}},Xe=(e={})=>{const t=e.physics??Ve,n=e.physics??Ne;return{prepare:({to:s})=>(s.then(o=>{o.style.opacity="0",o.style.willChange="opacity"}),{}),animation:({from:s,to:o})=>{const i=new u.WebAnimation({element:s,integrator:g.from(n),style:(a,r)=>({opacity:r}),onComplete:()=>{s.style.willChange="auto",s.style.opacity=""}}),l=new u.WebAnimation({element:o,integrator:g.from(t),style:a=>({opacity:a}),onComplete:()=>{o.style.willChange="auto",o.style.opacity=""}});return new u.MultiAnimation([i,l],{mode:"sequence"})}}};function Be(e){const{paths:t}=e;return _(t,()=>Xe())}const B={scaleDown:{stiffness:20,damping:7},translate:{stiffness:15,damping:7},scaleUp:{stiffness:20,damping:7}},D={scaleDown:0,translate:.2,scaleUp:.8},Ze=.8,qe="white",bt=1e3/60,je=600;function Ke(e){const{items:t,from:n,to:s,recordFrame:o}=e,i=bt/1e3,l=Math.abs(s-n),a=t.map(c=>({item:c,integrator:new H({stiffness:c.spring.stiffness,damping:c.spring.damping}),state:{position:n,velocity:0},started:!1,settled:!1,settleTime:0}));for(let c=0;c<a.length;c++)(c===0||a[c].item.offset===0)&&(a[c].started=!0);o(0);let r=0;for(let c=1;c<=je;c++){const d=c*bt;r=d;for(const p of a)!p.started||p.settled||(p.state=p.integrator.step(p.state,s,i),p.integrator.isSettled(p.state,s)?(p.settleTime+=i,p.settleTime>=u.SETTLE_THRESHOLD&&(p.state={position:s,velocity:0},p.settled=!0)):p.settleTime=0,p.item.tick(p.state.position));for(let p=1;p<a.length;p++){const f=a[p];if(f.started)continue;const m=a[p-1];if(!m.started)continue;(l===0?1:Math.abs(m.state.position-n)/l)>=f.item.offset&&(f.started=!0)}if(o(d),a.every(p=>p.settled))return d}return r}function Z(e,t){return e!=null&&e.spring?{stiffness:e.spring.stiffness,damping:e.spring.damping}:t}function wt(e){const{rect:t,scale:n,direction:s,override:o}=e,i=s==="out"?{scale:1,translateY:-t.top}:{scale:n,translateY:-t.top+t.height},l=Z(o,B.scaleDown),a=Z(o,B.translate),r=Z(o,B.scaleUp),c=s==="out"?1:0,d=s==="out"?0:1,p=s==="out"?[{spring:l,offset:D.scaleDown,tick:y=>{const h=1-y;i.scale=1-(1-n)*h}},{spring:a,offset:D.translate,tick:y=>{const h=1-y;i.translateY=-t.top-t.height*h}},{spring:r,offset:D.scaleUp,tick:y=>{const h=1-y;i.scale=n+(1-n)*h}}]:[{spring:l,offset:D.scaleDown,tick:y=>{i.scale=1-(1-n)*y}},{spring:a,offset:D.translate,tick:y=>{i.translateY=-t.top+t.height*(1-y)}},{spring:r,offset:D.scaleUp,tick:y=>{i.scale=n+(1-n)*y}}],f=[],m=Ke({items:p,from:c,to:d,recordFrame:y=>f.push({time:y,scale:i.scale,translateY:i.translateY})});return{snapshots:f,totalDuration:m}}function Ge(e,t){if(e.length===0)return{time:0,scale:1,translateY:0};if(e.length===1||t<=0)return e[0];if(t>=1)return e[e.length-1];const n=t*(e.length-1),s=Math.floor(n),o=Math.ceil(n);if(s===o)return e[s];const i=e[s],l=e[o],a=n-s;return{time:i.time+(l.time-i.time)*a,scale:i.scale+(l.scale-i.scale)*a,translateY:i.translateY+(l.translateY-i.translateY)*a}}const Je=[[1,1],[-1,1],[1,-1],[-1,-1]];function Qe(e,t){const o=(i,l,a)=>{const r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",zIndex:"9999",width:"15px",height:"15px",...i});const c=document.createElement("div");Object.assign(c.style,{position:"absolute",width:"15px",height:"1px",backgroundColor:e,[a]:"0",[l]:"0"});const d=document.createElement("div");return Object.assign(d.style,{position:"absolute",width:"1px",height:"15px",backgroundColor:e,[a]:"0",[l]:"0"}),r.appendChild(c),r.appendChild(d),r};return{topLeft:o({top:`${t.top-1}px`,left:`${t.left-1}px`},"left","top"),topRight:o({top:`${t.top-1}px`,left:`${t.left+t.width-15+1}px`},"right","top"),bottomLeft:o({top:`${t.top+t.height-15+1}px`,left:`${t.left-1}px`},"left","bottom"),bottomRight:o({top:`${t.top+t.height-15+1}px`,left:`${t.left+t.width-15+1}px`},"right","bottom")}}function St(e,t){const n=t.left+t.width/2,s=t.top+t.height/2;e.style.transformOrigin=`${n}px ${s}px`}function $t(e,t){e.style.clipPath=`polygon(
|
|
31
31
|
${t.left}px ${t.top}px,
|
|
32
32
|
${t.left+t.width}px ${t.top}px,
|
|
33
33
|
${t.left+t.width}px ${t.top+t.height}px,
|
|
34
34
|
${t.left}px ${t.top+t.height}px
|
|
35
|
-
)`}function q(e,t,n,s,o){const i=n/1e3;return new u.WebAnimation({element:e,integrator:new jt({durationSec:i}),lowerBound:0,upperBound:1,style:l=>s(Ge(t,l)),onComplete:o})}const tn=(e={})=>{var o;const t=((o=e.border)==null?void 0:o.color)??qe,n=Ze,s=e.physics;return{prepare:({from:i,to:l,context:a})=>{const r=O(a,"from"),c=O(a,"to"),d=R(document.body,a.positionedParent),p=Qe(t,{...r,top:d.top});for(const f of["topLeft","topRight","bottomLeft","bottomRight"])a.positionedParent.appendChild(p[f]);return i.then(f=>{St(f,r),$t(f,r),f.style.transform=`translateY(${-r.top}px)`}),l.then(f=>{St(f,c),$t(f,c),f.style.transform=`translateY(${-c.top+c.height}px) scale(${n})`}),{borders:p,fromRect:r,toRect:c}},animation:({from:i,to:l,context:a,borders:r,fromRect:c,toRect:d})=>{const p=wt({rect:c,scale:n,direction:"out",override:s}),f=wt({rect:d,scale:n,direction:"in",override:s}),m=q(i,p.snapshots,p.totalDuration,S=>({transform:`translateY(${S.translateY}px) scale(${S.scale})`}),()=>{i.style.clipPath="",i.style.transformOrigin="",i.style.transform=""}),y=q(l,f.snapshots,f.totalDuration,S=>({transform:`translateY(${S.translateY}px) scale(${S.scale})`}),()=>{l.style.clipPath="",l.style.transformOrigin="",l.style.transform=""}),h=Je.map(([S,x],$)=>{const C=["topLeft","topRight","bottomLeft","bottomRight"][$];return q(r[C],p.snapshots,p.totalDuration,P=>{const A=(c.width-c.width*P.scale)/2*.7*S,F=(c.height-c.height*P.scale)/2*.7*x;return{transform:`translate(${A}px, ${F}px)`}})}),b=new u.MultiAnimation([m,y,...h],{mode:"parallel"}),w=b.onComplete;return b.onComplete=()=>{w==null||w();const S=a.positionedParent;for(const x of["topLeft","topRight","bottomLeft","bottomRight"]){const $=r[x];$.parentElement===S&&S.removeChild($)}},b}}};function en(e){const{paths:t,options:n}=e,s=(n==null?void 0:n.borderColor)!==void 0?{border:{color:n.borderColor}}:void 0;return _(t,()=>tn(s))}const Ct="data-hero-enter-key",Et="data-hero-exit-key",j="data-hero-key";class nn{constructor(){E(this,"previousFromOpacity","")}prepare(t){t.from.then(n=>{this.previousFromOpacity=n.style.opacity,n.style.opacity="0"})}contribute(t){return t.onComplete(()=>{t.from.style.opacity=this.previousFromOpacity}),[]}}const sn=()=>new nn;class on{contribute(t){const{from:n,to:s,physics:o,onComplete:i}=t,l=n.style.opacity,a=s.style.opacity,r=n.style.willChange,c=s.style.willChange;return s.style.opacity="0",n.style.willChange="opacity",s.style.willChange="opacity",i(()=>{n.style.opacity=l,s.style.opacity=a,n.style.willChange=r,s.style.willChange=c}),[new u.WebAnimation({element:n,integrator:g.from(o),style:(d,p)=>({opacity:p})}),new u.WebAnimation({element:s,integrator:g.from(o),style:d=>({opacity:d})})]}}const rn=()=>new on,an={static:sn,fade:rn},ln={spring:{stiffness:320,damping:30}},cn=()=>ln,pn={spring:{stiffness:300,damping:30,doubleSpring:1}},dn=()=>pn,fn={default:cn,smooth:dn},yn=700,hn="data-hero-aspect-ratio",un="data-hero-radius";function mn(e){if(!e)return null;if(e.includes("/")){const[n,s]=e.split("/"),o=parseFloat(n??""),i=parseFloat(s??"");return!Number.isFinite(o)||!Number.isFinite(i)||o<=0||i<=0?null:o/i}const t=parseFloat(e);return Number.isFinite(t)&&t>0?t:null}function xt(e){const t=e.getAttribute(un);if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)&&n>0?n:0}function W(e){return e.left+e.width/2}function z(e){return e.top+e.height/2}function gn(e,t){return{top:Math.max(0,t.top-e.top),right:Math.max(0,e.left+e.width-(t.left+t.width)),bottom:Math.max(0,e.top+e.height-(t.top+t.height)),left:Math.max(0,t.left-e.left)}}function bn(e,t,n){const s=e.width/e.height;let o,i;return n==="contain"?s>t?(i=e.height,o=i*t):(o=e.width,i=o/t):s>t?(o=e.width,i=o/t):(i=e.height,o=i*t),{left:e.left+(e.width-o)/2,top:e.top+(e.height-i)/2,width:o,height:i}}function At(e,t,n){const s=R(e,t),o=mn(t.getAttribute(hn));if(o===null)return{bbox:s,content:s,window:s,clipInset:{top:0,right:0,bottom:0,left:0}};const i=bn(s,o,n),l=n==="cover"?s:i;return{bbox:s,content:i,window:l,clipInset:gn(i,l)}}function wn(e,t,n,s){const o=n.width/s,i=n.height/s,l=e.width/2+(W(n)-W(t))/s-o/2,a=e.height/2+(z(n)-z(t))/s-i/2;return{top:Math.max(0,a),right:Math.max(0,e.width-l-o),bottom:Math.max(0,e.height-a-i),left:Math.max(0,l)}}function L(e,t){const n=new Map,s=e.querySelectorAll(`[${t}]`);for(const o of Array.from(s)){const i=o.getAttribute(t);i&&(n.has(i)||n.set(i,o))}return n}function Sn(e,t){const n=[],s=L(t,Ct),o=L(e,Et);for(const[a,r]of s){const c=o.get(a);c&&n.push({key:a,fromEl:c,toEl:r,fromFit:"cover",toFit:"contain"})}const i=L(e,Ct),l=L(t,Et);for(const[a,r]of i){const c=l.get(a);c&&n.push({key:a,fromEl:r,toEl:c,fromFit:"contain",toFit:"cover"})}return n}function $n(e,t){const n=[],s=Array.from(t.querySelectorAll(`[${j}]`));for(const o of s){const i=o.getAttribute(j);if(!i)continue;const l=e.querySelector(`[${j}="${i}"]`);l&&n.push({key:i,fromEl:l,toEl:o,fromFit:"contain",toFit:"contain"})}return n}function Cn(e,t){const n=Sn(e,t);return n.length>0?n:$n(e,t)}function En(e,t,n){const{fromEl:s,toEl:o}=t,i=At(e,s,t.fromFit),l=At(e,o,t.toFit),a=i.content,r=i.window,c=l.content,d=l.window,p=l.clipInset,f=xt(s),m=xt(o);if(a.width===0||a.height===0||r.width===0||r.height===0||c.width===0||c.height===0||d.width===0||d.height===0)return null;const y=Math.max(a.width/c.width,a.height/c.height),h=W(a),b=z(a),w=W(c),S=z(c),x=h-w,$=b-S;if(Math.abs($)>n)return null;const C=wn(c,a,r,y);return{toContent:c,hasRadius:f>0||m>0,styleFor:(P,A)=>{const F=A*x,Y=A*$,T=P+A*y,Mt=(f*A+m*P)/T,Ht=C.top*A+p.top*P,Wt=C.right*A+p.right*P,zt=C.bottom*A+p.bottom*P,Rt=C.left*A+p.left*P;return{transform:`translate(${F}px, ${Y}px) scale(${T})`,clipPath:`inset(${Ht}px ${Wt}px ${zt}px ${Rt}px round ${Mt}px)`}}}}function xn(e,t){e.style.transform=t.transform,e.style.clipPath=t.clipPath}class An{contribute(t){const{resolved:n,physics:s,positionedParent:o,maxDistance:i,onComplete:l}=t,a=[];for(const r of n.pairs){const{fromEl:c,toEl:d}=r,p=En(o,r,i);if(!p)continue;const f=d.cloneNode(!0);f.style.position="absolute",f.style.left=`${p.toContent.left}px`,f.style.top=`${p.toContent.top}px`,f.style.width=`${p.toContent.width}px`,f.style.height=`${p.toContent.height}px`,f.style.margin="0",f.style.transformOrigin="center center",f.style.zIndex="1000",f.style.willChange="transform, clip-path",f.style.pointerEvents="none",f.style.maxWidth="none",f.style.maxHeight="none",p.hasRadius&&(f.style.borderRadius="0"),xn(f,p.styleFor(0,1)),o.appendChild(f);const m=c.style.opacity,y=d.style.opacity;c.style.opacity="0",d.style.opacity="0",l(()=>{c.style.opacity=m,d.style.opacity=y,f.parentElement&&f.parentElement.removeChild(f)}),a.push(new u.WebAnimation({element:f,integrator:g.from(s),style:p.styleFor}))}return a}}function Pn(e){return[new An,an[e.type]()]}const _n=e=>{const t=Pn(e),n=fn[e.variant](),s=yn;return{prepare:o=>{var a;const i=Promise.all([o.from,o.to]).then(([r,c])=>({pairs:Cn(r,c)})),l={from:o.from,to:o.to,resolved:i};for(const r of t)(a=r.prepare)==null||a.call(r,l);return i.then(r=>({resolved:r}))},animation:({from:o,to:i,context:l,resolved:a})=>{if(a.pairs.length===0)return new u.MultiAnimation([],{mode:"parallel"});const r=[],c=y=>{r.push(y)},d={from:o,to:i,resolved:a,physics:n,positionedParent:l.positionedParent,maxDistance:s,onComplete:c},p=[];for(const y of t)y.contribute&&p.push(...y.contribute(d));if(p.length===0)return new u.MultiAnimation([],{mode:"parallel"});const f=new u.MultiAnimation(p,{mode:"parallel"}),m=f.onComplete;return f.onComplete=()=>{m==null||m();for(const y of r)try{y()}catch(h){console.error("[hero] cleanup error",h)}},f}}};function In(e){const{paths:t}=e,n=e.type??"static",s=e.variant??"default";return _(t,()=>_n({type:n,variant:s}))}const vn={spring:{stiffness:50,damping:30}},On={spring:{stiffness:80,damping:25}},Tn=(e={})=>{const t=e.physics??vn,n=e.initialRotation??45,s=e.initialScale??.01,o=e.rotationTriggerPoint??.8;return{prepare:({from:i,to:l,context:a})=>(i.then(r=>{r.style.opacity="1"}),l.then(r=>{const c=O(a,"to"),d=Math.min(c.width,c.height)*.4;r.style.setProperty("--max-border-radius",`${d}px`),r.style.setProperty("--border-radius-scale","1"),r.style.willChange="transform",r.style.backfaceVisibility="hidden";const p=c.left+c.width/2,f=c.top+c.height/2;r.style.transformOrigin=`${p}px ${f}px`,r.style.position="fixed",r.style.top=`${c.top}px`,r.style.left=`${c.left}px`,r.style.width=`${c.width}px`,r.style.height=`${c.height}px`,r.style.zIndex="1000",r.style.overflow="hidden",r.style.transform=`rotate(${n}deg) scale(${s}) translateZ(0)`,r.style.borderRadius="calc(var(--max-border-radius) * var(--border-radius-scale))",r.style.opacity="1"}),{}),animation:({from:i,to:l})=>{const a=new u.WebAnimation({element:i,integrator:g.from(On),style:(c,d)=>({opacity:d}),onComplete:()=>{i.style.opacity=""}}),r=new u.WebAnimation({element:l,integrator:g.from(t),style:c=>{let d;if(c<=.05)d=s;else if(c<=o){const y=(c-.05)/(o-.05),h=Math.pow(y,9);d=s+(.8-s)*h}else{const y=(c-o)/(1-o);d=.8+.2*(1-Math.pow(1-y,3))}const p=.7;let f;if(c<=p)f=n;else{const y=(c-p)/(1-p),h=1-Math.pow(1-y,2);f=n*(1-h)}let m;if(c<=p)m=1;else{const y=(c-p)/(1-p);m=1-Math.pow(y,.5)}return{transform:`rotate(${f.toFixed(2)}deg) scale(${d.toFixed(4)}) translateZ(0)`,"--border-radius-scale":m.toFixed(4)}},onComplete:()=>{l.style.willChange="",l.style.backfaceVisibility="",l.style.removeProperty("--max-border-radius"),l.style.removeProperty("--border-radius-scale"),l.style.transform="",l.style.transformOrigin="",l.style.position="",l.style.zIndex="",l.style.top="",l.style.left="",l.style.width="",l.style.height="",l.style.overflow="",l.style.borderRadius=""}});return new u.MultiAnimation([a,r],{mode:"parallel"})}}};function Dn(e){const{paths:t}=e;return _(t,()=>Tn())}const Fn={spring:{stiffness:100,damping:30}},kn=(e={})=>{const t=e.physics??Fn;return{prepare:({from:n,to:s})=>(n.then(o=>{o.style.transformOrigin="center center",o.style.willChange="transform, opacity"}),s.then(o=>{o.style.opacity="0",o.style.transform="rotate(-180deg)",o.style.transformOrigin="center center",o.style.willChange="transform, opacity"}),{}),animation:({from:n,to:s})=>{const o=new u.WebAnimation({element:n,integrator:g.from(t),style:l=>({transform:`rotate(${l*180}deg)`,opacity:l<.5?1:0}),onComplete:()=>{n.style.willChange="auto",n.style.transform="",n.style.transformOrigin="",n.style.opacity=""}}),i=new u.WebAnimation({element:s,integrator:g.from(t),style:(l,a)=>({transform:`rotate(${-a*180}deg)`,opacity:l>.5?1:0}),onComplete:()=>{s.style.willChange="auto",s.style.transform="",s.style.transformOrigin="",s.style.opacity=""}});return new u.MultiAnimation([o,i],{mode:"parallel"})}}};function Yn(e){const{paths:t}=e;return _(t,()=>kn())}const Ln={spring:{stiffness:20,damping:8,doubleSpring:1,restDelta:.001,restSpeed:.001}},Pt=(e={})=>{const t=e.direction??"up",n=e.physics??Ln,s=t==="up",o=s?I:v,i=s?v:I;return{prepare:({from:l,to:a})=>(l.then(r=>{r.style.zIndex=o,r.style.willChange="transform",r.style.backfaceVisibility="hidden",r.style.contain="layout paint",r.style.pointerEvents="none"}),a.then(r=>{r.style.willChange="transform",r.style.backfaceVisibility="hidden",r.style.contain="layout paint",r.style.position="relative",r.style.zIndex=i}),{}),animation:({from:l,to:a})=>{const r=l.offsetHeight,c=a.offsetHeight,d=window.innerHeight,p=Math.max(Math.min(r,c),d),f=new u.WebAnimation({element:l,integrator:g.from(n),style:y=>({transform:`translate3d(0, ${s?-p*y:p*y}px, 0)`}),onComplete:()=>{l.style.willChange="auto",l.style.backfaceVisibility="",l.style.contain="",l.style.transform="",l.style.pointerEvents="",l.style.zIndex=""}}),m=new u.WebAnimation({element:a,integrator:g.from(n),style:(y,h)=>({transform:`translate3d(0, ${s?h*p:h*-p}px, 0)`}),onComplete:()=>{a.style.willChange="auto",a.style.backfaceVisibility="",a.style.contain="",a.style.transform="",a.style.position==="relative"&&(a.style.position=""),a.style.zIndex===i&&(a.style.zIndex="")}});for(const y of[f,m]){const h=y.onComplete;y.onComplete=()=>{h==null||h(),y.releaseFill()}}return new u.MultiAnimation([f,m],{mode:"parallel"})}}};function Mn(e){const{paths:t,type:n="directional"}=e;return n==="non-directional"?_(t,()=>Pt({direction:"up"})):nt(t,{forward:"up",backward:"down"},s=>Pt({direction:s}))}const Hn={spring:{stiffness:200,damping:24}},Wn={inertia:{acceleration:25,resistance:1.2}},K=.2;function zn(){return{enterPhysics:Hn,exitPhysics:Wn,background:{willChange:"transform, opacity",enterStyle:(e,t)=>({transform:`scale(${1-K*e})`,opacity:t}),exitStyle:e=>({transform:`scale(${1-K+K*e})`,opacity:e})}}}const Rn={spring:{stiffness:200,damping:24}},Un={inertia:{acceleration:25,resistance:1.2}},G=.08,Nn=16,J=.6,Vn=e=>`blur(${Math.max(0,e).toFixed(2)}px)`;function Xn(){return{enterPhysics:Rn,exitPhysics:Un,background:{willChange:"transform, opacity",enterStyle:e=>({transform:`scale(${1-G*e})`,opacity:1-(1-J)*e}),exitStyle:e=>({transform:`scale(${1-G+G*e})`,opacity:J+(1-J)*e})},overlay:{willChange:"backdrop-filter",initialStyle:{position:"absolute",left:"0",width:"100%",pointerEvents:"none",backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)"},style:(e,t)=>{const n=e==="enter"?t:1-t,s=Vn(Nn*n);return{backdropFilter:s,WebkitBackdropFilter:s}}}}}const Bn={spring:{stiffness:300,damping:30}},Zn={inertia:{acceleration:30,resistance:1}};function qn(){return{enterPhysics:Bn,exitPhysics:Zn,background:{willChange:"",enterStyle:()=>({}),exitStyle:()=>({})}}}const jn={static:qn(),"background-scale":zn(),blur:Xn()},Kn="static",Gn="transform",Jn=(e={})=>{const t=e.direction??"enter",n=jn[e.type??Kn],s=t==="enter"?n.enterPhysics:n.exitPhysics,o=n.background,i=n.overlay,l=o.willChange!=="";return{prepare:({from:a,to:r,context:c,createElement:d})=>{const p=t==="enter"?r:a,f=t==="enter"?a:r;p.then(y=>{y.style.willChange=Gn,y.style.backfaceVisibility="hidden",y.style.contain="layout paint",y.style.zIndex=v,t==="enter"?y.style.position="relative":y.style.pointerEvents="none"}),f.then(y=>{l&&(y.style.willChange=o.willChange,y.style.backfaceVisibility="hidden",y.style.contain="layout paint"),y.style.zIndex=I,t==="enter"?y.style.pointerEvents="none":y.style.position="relative"});let m;return i&&(m=d("sheet-overlay"),Object.assign(m.style,i.initialStyle),m.style.willChange=i.willChange,c.positionedParent.appendChild(m)),{overlay:m}},animation:({from:a,to:r,context:c,overlay:d})=>{const p=t==="enter"?r:a,f=t==="enter"?a:r,m=O(c,t==="enter"?"to":"from"),y=()=>{a.style.pointerEvents="",a.style.zIndex=""},h=()=>{const $=t==="enter"?v:I;r.style.position==="relative"&&(r.style.position=""),r.style.zIndex===$&&(r.style.zIndex="")},b=$=>{const C=$.onComplete;$.onComplete=()=>{C==null||C(),$.releaseFill()}};p.style.clipPath=`inset(${m.top}px 0 calc(100% - ${m.top+m.height}px) 0)`;const w=t==="enter"?($,C)=>({transform:`translate3d(0, ${C*m.height}px, 0)`}):$=>({transform:`translate3d(0, ${$*m.height}px, 0)`}),S=new u.WebAnimation({element:p,integrator:g.from(s),style:w,onComplete:()=>{p.style.willChange="auto",p.style.backfaceVisibility="",p.style.contain="",p.style.clipPath="",p.style.transform="",y(),h()}});b(S);const x=[S];if(l){const $=f.scrollHeight;$>0&&(f.style.height=`${$}px`);const C=O(c,t==="enter"?"from":"to"),P=C.left+C.width/2,A=C.top+C.height/2;f.style.clipPath=`inset(${C.top}px 0 calc(100% - ${C.top+C.height}px) 0)`,f.style.transformOrigin=`${P}px ${A}px`;const F=t==="enter"?(T,st)=>o.enterStyle(T,st):T=>o.exitStyle(T),Y=new u.WebAnimation({element:f,integrator:g.from(s),style:F,onComplete:()=>{f.style.willChange="auto",f.style.backfaceVisibility="",f.style.contain="",f.style.clipPath="",f.style.transformOrigin="",f.style.transform="",f.style.opacity="",f.style.height=""}});b(Y),x.push(Y)}if(d&&i){d.style.zIndex=kt;const $=Dt(c,"to");d.style.top=`${$.top}px`,d.style.height=`${$.height}px`,x.push(new u.WebAnimation({element:d,integrator:g.from(s),style:C=>i.style(t,C)}))}return new u.MultiAnimation(x,{mode:"parallel"})}}};function Qn(e){return e==="scale"||e==="background-scale"?"background-scale":e==="blur"?"blur":"static"}function ts(e){const{enter:t,exit:n}=e,s=e.type,o=Qn(s);return Tt({enter:t,exit:n},i=>Jn({direction:i,type:o}))}const es={spring:{stiffness:170,damping:22,doubleSpring:.8}},ns=(e={})=>{const t=e.direction??"left",n=e.physics??es,s=t==="left";return{prepare:({from:o,to:i})=>(o.then(l=>{l.style.willChange="transform",l.style.backfaceVisibility="hidden",l.style.contain="layout paint",l.style.pointerEvents="none"}),i.then(l=>{const a=s?100:-100;l.style.transform=`translate3d(${a}%, 0, 0)`,l.style.willChange="transform",l.style.backfaceVisibility="hidden",l.style.contain="layout paint"}),{}),animation:({from:o,to:i})=>{const l=new u.WebAnimation({element:o,integrator:g.from(n),style:r=>({transform:`translate3d(${s?-100*r:100*r}%, 0, 0)`}),onComplete:()=>{o.style.willChange="auto",o.style.backfaceVisibility="",o.style.contain="",o.style.transform="",o.style.pointerEvents=""}}),a=new u.WebAnimation({element:i,integrator:g.from(n),style:(r,c)=>({transform:`translate3d(${s?c*100:c*-100}%, 0, 0)`}),onComplete:()=>{i.style.willChange="auto",i.style.backfaceVisibility="",i.style.contain="",i.style.transform=""}});return new u.MultiAnimation([l,a],{mode:"parallel"})}}};function ss(e){const{paths:t}=e;return nt(t,{forward:"left",backward:"right"},n=>ns({direction:n}))}const os={spring:{stiffness:17,damping:6}},Q=20,M=800,is=(e={})=>{const t=e.physics??os;return{prepare:({from:n,to:s})=>(n.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.pointerEvents="none",o.style.transform=`perspective(${M}px) rotateY(0deg) translate3d(0%, 0, 0)`}),s.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.transform=`perspective(${M}px) rotateY(${Q}deg) translate3d(-100%, 0, 0)`}),{}),animation:({from:n,to:s})=>{const o=new u.WebAnimation({element:n,integrator:g.from(t),style:l=>{const a=-l*Q,r=l*100;return{transform:`perspective(${M}px) rotateY(${a}deg) translate3d(${r}%, 0, 0)`}},onComplete:()=>{n.style.transform="",n.style.willChange="auto",n.style.backfaceVisibility="",n.style.contain="",n.style.pointerEvents=""}}),i=new u.WebAnimation({element:s,integrator:g.from(t),style:(l,a)=>{const r=a*Q,c=-a*100;return{transform:`perspective(${M}px) rotateY(${r}deg) translate3d(${c}%, 0, 0)`}},onComplete:()=>{s.style.transform="",s.style.willChange="auto",s.style.backfaceVisibility="",s.style.contain=""}});return new u.MultiAnimation([o,i],{mode:"sequence"})}}};function rs(e){const{paths:t}=e;return _(t,()=>is())}function as({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s,enterRadius:o,exitRadius:i}){const l=t.left-e.left+(t.width-e.width)/2-s.x,a=t.top-e.top+(t.height-e.height)/2-s.y,r=t.width/e.width,c=t.height/e.height,d=e.top/n.height*100,p=(n.width-(e.left+e.width))/n.width*100,f=(n.height-(e.top+e.height))/n.height*100,m=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:y=>{const h=1-y,b=1+(r-1)*h,w=1+(c-1)*h,x=(i*h+o*(1-h))/((b+w)/2);return{clipPath:`inset(${d*h}% ${p*h}% ${f*h}% ${m*h}% round ${x}px)`,transform:`translate(${l*h}px, ${a*h}px) scale(${b}, ${w})`}}}}function ls({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s,enterRadius:o,exitRadius:i}){const l=t.left-e.left+(t.width-e.width)/2+s.x,a=t.top-e.top+(t.height-e.height)/2+s.y,r=t.width/e.width,c=t.height/e.height,d=e.top/n.height*100,p=(n.width-(e.left+e.width))/n.width*100,f=(n.height-(e.top+e.height))/n.height*100,m=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:y=>{const h=1-y,b=1+(r-1)*h,w=1+(c-1)*h,x=(o*(1-h)+i*h)/((b+w)/2);return{clipPath:`inset(${d*h}% ${p*h}% ${f*h}% ${m*h}% round ${x}px)`,transform:`translate(${l*h-s.x}px, ${a*h}px) scale(${b}, ${w})`}}}}const cs={spring:{stiffness:430,damping:33,doubleSpring:1}},Yt=.12,ps=18;function ds(){return{transformOrigin:"50% 50%",animate:e=>{const t=1-e;return{transform:`scale(${1-Yt*t})`}}}}function fs(){return{transformOrigin:"50% 50%",animate:e=>{const t=1-e;return{transform:`scale(${1-Yt*t})`}}}}const tt={willChange:"backdrop-filter",initialStyle:{position:"absolute",left:"0",width:"100%",pointerEvents:"none",backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)"},style:(e,t)=>{const n=e==="enter"?t:1-t,s=`blur(${ps*n}px)`;return{backdropFilter:s,WebkitBackdropFilter:s}}};class ys{constructor(){E(this,"physics",cs)}contribute(t){const{from:n,to:s,resolved:o,physics:i}=t,l=o.mode==="enter",a=l?n:s,r=l?ds():fs();return r&&(a.style.transformOrigin=r.transformOrigin),[new u.WebAnimation({element:a,integrator:g.from(i),style:l?(c,d)=>r.animate(d):c=>r.animate(c)})]}}class hs{prepare(t){const n=t.createElement("zoom-overlay");return Object.assign(n.style,tt.initialStyle),n.style.willChange=tt.willChange,t.context.positionedParent.appendChild(n),{overlay:n}}contribute(t){const n=t.extras.overlay;if(!n)return[];n.style.zIndex=kt;const s=Dt(t.context,"to");return n.style.top=`${s.top}px`,n.style.height=`${s.height}px`,[new u.WebAnimation({element:n,integrator:g.from(t.physics),style:o=>tt.style(t.resolved.mode,o)})]}}const us={spring:{stiffness:430,damping:33,doubleSpring:1}};function ms({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2+n.x,o=e.top-t.top+(e.height-t.height)/2+n.y,i=e.width/t.width,l=e.height/t.height,a=Math.max(i,l);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:r=>{const c=1-r;return{transform:`translate(${s*c-n.x}px, ${o*c}px) scale(${1+(a-1)*c})`}}}}function gs({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2-n.x,o=e.top-t.top+(e.height-t.height)/2-n.y,i=e.width/t.width,l=e.height/t.height,a=Math.max(i,l);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:r=>{const c=1-r;return{transform:`translate(${s*c}px, ${o*c}px) scale(${1+(a-1)*c})`}}}}class bs{constructor(){E(this,"physics",us)}contribute(t){const{from:n,to:s,resolved:o,input:i,physics:l}=t,a=o.mode==="enter",r=a?n:s,c=a?ms(i):gs(i);return c&&(r.style.transformOrigin=c.transformOrigin),[new u.WebAnimation({element:r,integrator:g.from(l),style:a?(d,p)=>c.animate(p):d=>c.animate(d)})]}}const ws={spring:{stiffness:530,damping:34,doubleSpring:1}};class Ss{constructor(){E(this,"physics",ws)}contribute(t){return[]}}const $s={expand:()=>new bs,static:()=>new Ss,blur:()=>new ys};function Cs(e){return $s[e]()}const et="data-zoom-enter-key",_t="data-zoom-exit-key",Es="data-zoom-radius";function It(e){const t=e.getAttribute(Es);if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)&&n>0?n:0}function xs(e,t){const n=[];let s=t;for(;s&&s!==e;){const o=s.parentElement;if(!o)break;for(const i of Array.from(o.children))i!==s&&i instanceof HTMLElement&&n.push(i);s=o}return n}function vt(e){const t=e.querySelectorAll(`[${et}]`);return t.length!==1?null:t[0]}function Ot(e,t){const n=e.querySelectorAll(`[${_t}]`);for(const s of n)if(s.getAttribute(_t)===t)return s;return null}function As(e,t){const n=vt(e),s=vt(t);if(!n&&s){const o=s.getAttribute(et);if(!o)return null;const i=Ot(e,o);return i?{mode:"enter",enterEl:s,exitEl:i}:null}if(n&&!s){const o=n.getAttribute(et);if(!o)return null;const i=Ot(t,o);return i?{mode:"exit",enterEl:n,exitEl:i}:null}return null}function Ps(e,t,n,s){return{enterRect:ot(e.mode==="enter"?n:t,e.enterEl),exitRect:ot(e.mode==="enter"?t:n,e.exitEl),pageRect:e.mode==="enter"?n.getBoundingClientRect():t.getBoundingClientRect(),scrollOffset:s,enterRadius:It(e.enterEl),exitRadius:It(e.exitEl)}}class _s{prepare(t){t.from.then(n=>{n.style.willChange="transform, clip-path, opacity",n.style.backfaceVisibility="hidden",n.style.contain="layout paint"})}contribute(t){const{from:n,to:s,resolved:o,input:i,physics:l,onComplete:a}=t,r=o.mode==="enter",c=r?as(i):ls(i),d=r?s:n,p=r?"t":"u";c&&(d.style.transformOrigin=c.transformOrigin);const f=r?I:v,m=r?v:I,y=n.style.zIndex;n.style.zIndex=f;const h=s.style.zIndex,b=s.style.position;return s.style.zIndex=m,s.style.position="relative",a(()=>{d.style.willChange="auto",d.style.backfaceVisibility="",d.style.transformOrigin="",d.style.contain="",n.style.zIndex=y,s.style.zIndex===m&&(s.style.zIndex=h),s.style.position==="relative"&&(s.style.position=b),s.style.transformOrigin="",n.style.willChange="auto",n.style.backfaceVisibility="",n.style.transformOrigin="",n.style.contain="",n.style.transform="",n.style.clipPath=""}),[new u.WebAnimation({element:d,integrator:g.from(l),style:p==="t"?w=>c.animate(w):(w,S)=>c.animate(S)})]}}class Is{contribute(t){const{resolved:n,physics:s,from:o,to:i,onComplete:l}=t,a=n.mode==="enter"?i:o,r=xs(a,n.enterEl);if(r.length===0)return[];const c=r.map(d=>d.style.opacity);if(n.mode==="enter")for(const d of r)d.style.opacity="0";return l(()=>{for(let d=0;d<r.length;d++){const p=r[d];p&&(p.style.opacity=c[d]??"")}}),r.map(d=>new u.WebAnimation({element:d,integrator:g.from(s),style:(p,f)=>({opacity:n.mode==="enter"?p:f})}))}}class Lt{contribute(){return[]}}const vs={default:()=>new Lt,fade:()=>new Is};function Os(e){return vs[e]()}class Ts extends Lt{}function Ds(e){const t=Cs(e.type);return{strategies:[new _s,t,Os(e.variant),new Ts,...e.type==="blur"?[new hs]:[]],physics:t.physics}}const Fs=e=>{const{strategies:t,physics:n}=Ds(e);return{prepare:s=>{const o={from:s.from,to:s.to,context:{positionedParent:s.context.positionedParent},createElement:s.createElement},i={};for(const l of t){if(!l.prepare)continue;const a=l.prepare(o);a&&Object.assign(i,a)}return i},animation:({from:s,to:o,context:i,...l})=>{const a=As(s,o);if(!a)return new u.MultiAnimation([],{mode:"parallel"});const r=Ps(a,s,o,i.scrollOffset),c=[],p={from:s,to:o,resolved:a,input:r,physics:n,context:i,extras:l,onComplete:y=>{c.push(y)}},f=[];for(const y of t)y.contribute&&f.push(...y.contribute(p));const m=f[0];if(m){const y=m.onComplete;m.onComplete=()=>{y==null||y();for(const h of c)try{h()}catch(b){console.error("[zoom] cleanup error",b)}}}for(const y of f){if(!(y instanceof u.WebAnimation))continue;const h=y.onComplete;y.onComplete=()=>{h==null||h(),y.releaseFill()}}return new u.MultiAnimation(f,{mode:"parallel"})}}};function ks(e){const t=e.type??"static",n=e.variant??(e.fade?"fade":"default");return{type:t,variant:n}}function Ys(e){const t=ks(e);return _(e.paths,()=>Fs(t))}exports.Animation=u.Animation;exports.MultiAnimation=u.MultiAnimation;exports.WebAnimation=u.WebAnimation;exports.axis=Ae;exports.blind=Te;exports.drill=Ue;exports.fade=Be;exports.film=en;exports.hero=In;exports.jaemin=Dn;exports.rotate=Yn;exports.scroll=Mn;exports.sheet=ts;exports.slide=ss;exports.strip=rs;exports.zoom=Ys;
|
|
35
|
+
)`}function q(e,t,n,s,o){const i=n/1e3;return new u.WebAnimation({element:e,integrator:new jt({durationSec:i}),lowerBound:0,upperBound:1,style:l=>s(Ge(t,l)),onComplete:o})}const tn=(e={})=>{var o;const t=((o=e.border)==null?void 0:o.color)??qe,n=Ze,s=e.physics;return{prepare:({from:i,to:l,context:a})=>{const r=O(a,"from"),c=O(a,"to"),d=R(document.body,a.positionedParent),p=Qe(t,{...r,top:d.top});for(const f of["topLeft","topRight","bottomLeft","bottomRight"])a.positionedParent.appendChild(p[f]);return i.then(f=>{St(f,r),$t(f,r),f.style.transform=`translateY(${-r.top}px)`}),l.then(f=>{St(f,c),$t(f,c),f.style.transform=`translateY(${-c.top+c.height}px) scale(${n})`}),{borders:p,fromRect:r,toRect:c}},animation:({from:i,to:l,context:a,borders:r,fromRect:c,toRect:d})=>{const p=wt({rect:c,scale:n,direction:"out",override:s}),f=wt({rect:d,scale:n,direction:"in",override:s}),m=q(i,p.snapshots,p.totalDuration,S=>({transform:`translateY(${S.translateY}px) scale(${S.scale})`}),()=>{i.style.clipPath="",i.style.transformOrigin="",i.style.transform=""}),y=q(l,f.snapshots,f.totalDuration,S=>({transform:`translateY(${S.translateY}px) scale(${S.scale})`}),()=>{l.style.clipPath="",l.style.transformOrigin="",l.style.transform=""}),h=Je.map(([S,x],$)=>{const C=["topLeft","topRight","bottomLeft","bottomRight"][$];return q(r[C],p.snapshots,p.totalDuration,P=>{const A=(c.width-c.width*P.scale)/2*.7*S,F=(c.height-c.height*P.scale)/2*.7*x;return{transform:`translate(${A}px, ${F}px)`}})}),b=new u.MultiAnimation([m,y,...h],{mode:"parallel"}),w=b.onComplete;return b.onComplete=()=>{w==null||w();const S=a.positionedParent;for(const x of["topLeft","topRight","bottomLeft","bottomRight"]){const $=r[x];$.parentElement===S&&S.removeChild($)}},b}}};function en(e){const{paths:t,options:n}=e,s=(n==null?void 0:n.borderColor)!==void 0?{border:{color:n.borderColor}}:void 0;return _(t,()=>tn(s))}const Ct="data-hero-enter-key",Et="data-hero-exit-key",j="data-hero-key";class nn{constructor(){E(this,"previousFromOpacity","")}prepare(t){t.from.then(n=>{this.previousFromOpacity=n.style.opacity,n.style.opacity="0"})}contribute(t){return t.onComplete(()=>{t.from.style.opacity=this.previousFromOpacity}),[]}}const sn=()=>new nn;class on{contribute(t){const{from:n,to:s,physics:o,onComplete:i}=t,l=n.style.opacity,a=s.style.opacity,r=n.style.willChange,c=s.style.willChange;return s.style.opacity="0",n.style.willChange="opacity",s.style.willChange="opacity",i(()=>{n.style.opacity=l,s.style.opacity=a,n.style.willChange=r,s.style.willChange=c}),[new u.WebAnimation({element:n,integrator:g.from(o),style:(d,p)=>({opacity:p})}),new u.WebAnimation({element:s,integrator:g.from(o),style:d=>({opacity:d})})]}}const rn=()=>new on,an={static:sn,fade:rn},ln={spring:{stiffness:320,damping:30}},cn=()=>ln,pn={spring:{stiffness:300,damping:30,doubleSpring:1}},dn=()=>pn,fn={default:cn,smooth:dn},yn=700,hn="data-hero-aspect-ratio",un="data-hero-radius";function mn(e){if(!e)return null;if(e.includes("/")){const[n,s]=e.split("/"),o=parseFloat(n??""),i=parseFloat(s??"");return!Number.isFinite(o)||!Number.isFinite(i)||o<=0||i<=0?null:o/i}const t=parseFloat(e);return Number.isFinite(t)&&t>0?t:null}function xt(e){const t=e.getAttribute(un);if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)&&n>0?n:0}function W(e){return e.left+e.width/2}function z(e){return e.top+e.height/2}function gn(e,t){return{top:Math.max(0,t.top-e.top),right:Math.max(0,e.left+e.width-(t.left+t.width)),bottom:Math.max(0,e.top+e.height-(t.top+t.height)),left:Math.max(0,t.left-e.left)}}function bn(e,t,n){const s=e.width/e.height;let o,i;return n==="contain"?s>t?(i=e.height,o=i*t):(o=e.width,i=o/t):s>t?(o=e.width,i=o/t):(i=e.height,o=i*t),{left:e.left+(e.width-o)/2,top:e.top+(e.height-i)/2,width:o,height:i}}function At(e,t,n){const s=R(e,t),o=mn(t.getAttribute(hn));if(o===null)return{bbox:s,content:s,window:s,clipInset:{top:0,right:0,bottom:0,left:0}};const i=bn(s,o,n),l=n==="cover"?s:i;return{bbox:s,content:i,window:l,clipInset:gn(i,l)}}function wn(e,t,n,s){const o=n.width/s,i=n.height/s,l=e.width/2+(W(n)-W(t))/s-o/2,a=e.height/2+(z(n)-z(t))/s-i/2;return{top:Math.max(0,a),right:Math.max(0,e.width-l-o),bottom:Math.max(0,e.height-a-i),left:Math.max(0,l)}}function L(e,t){const n=new Map,s=e.querySelectorAll(`[${t}]`);for(const o of Array.from(s)){const i=o.getAttribute(t);i&&(n.has(i)||n.set(i,o))}return n}function Sn(e,t){const n=[],s=L(t,Ct),o=L(e,Et);for(const[a,r]of s){const c=o.get(a);c&&n.push({key:a,fromEl:c,toEl:r,fromFit:"cover",toFit:"contain"})}const i=L(e,Ct),l=L(t,Et);for(const[a,r]of i){const c=l.get(a);c&&n.push({key:a,fromEl:r,toEl:c,fromFit:"contain",toFit:"cover"})}return n}function $n(e,t){const n=[],s=Array.from(t.querySelectorAll(`[${j}]`));for(const o of s){const i=o.getAttribute(j);if(!i)continue;const l=e.querySelector(`[${j}="${i}"]`);l&&n.push({key:i,fromEl:l,toEl:o,fromFit:"contain",toFit:"contain"})}return n}function Cn(e,t){const n=Sn(e,t);return n.length>0?n:$n(e,t)}function En(e,t,n){const{fromEl:s,toEl:o}=t,i=At(e,s,t.fromFit),l=At(e,o,t.toFit),a=i.content,r=i.window,c=l.content,d=l.window,p=l.clipInset,f=xt(s),m=xt(o);if(a.width===0||a.height===0||r.width===0||r.height===0||c.width===0||c.height===0||d.width===0||d.height===0)return null;const y=Math.max(a.width/c.width,a.height/c.height),h=W(a),b=z(a),w=W(c),S=z(c),x=h-w,$=b-S;if(Math.abs($)>n)return null;const C=wn(c,a,r,y);return{toContent:c,hasRadius:f>0||m>0,styleFor:(P,A)=>{const F=A*x,Y=A*$,T=P+A*y,Mt=(f*A+m*P)/T,Ht=C.top*A+p.top*P,Wt=C.right*A+p.right*P,zt=C.bottom*A+p.bottom*P,Rt=C.left*A+p.left*P;return{transform:`translate(${F}px, ${Y}px) scale(${T})`,clipPath:`inset(${Ht}px ${Wt}px ${zt}px ${Rt}px round ${Mt}px)`}}}}function xn(e,t){e.style.transform=t.transform,e.style.clipPath=t.clipPath}class An{contribute(t){const{resolved:n,physics:s,positionedParent:o,maxDistance:i,onComplete:l}=t,a=[];for(const r of n.pairs){const{fromEl:c,toEl:d}=r,p=En(o,r,i);if(!p)continue;const f=d.cloneNode(!0);f.style.position="absolute",f.style.left=`${p.toContent.left}px`,f.style.top=`${p.toContent.top}px`,f.style.width=`${p.toContent.width}px`,f.style.height=`${p.toContent.height}px`,f.style.margin="0",f.style.transformOrigin="center center",f.style.zIndex="1000",f.style.willChange="transform, clip-path",f.style.pointerEvents="none",f.style.maxWidth="none",f.style.maxHeight="none",p.hasRadius&&(f.style.borderRadius="0"),xn(f,p.styleFor(0,1)),o.appendChild(f);const m=c.style.opacity,y=d.style.opacity;c.style.opacity="0",d.style.opacity="0",l(()=>{c.style.opacity=m,d.style.opacity=y,f.parentElement&&f.parentElement.removeChild(f)}),a.push(new u.WebAnimation({element:f,integrator:g.from(s),style:p.styleFor}))}return a}}function Pn(e){return[new An,an[e.type]()]}const _n=e=>{const t=Pn(e),n=fn[e.variant](),s=yn;return{prepare:o=>{var a;const i=Promise.all([o.from,o.to]).then(([r,c])=>({pairs:Cn(r,c)})),l={from:o.from,to:o.to,resolved:i};for(const r of t)(a=r.prepare)==null||a.call(r,l);return i.then(r=>({resolved:r}))},animation:({from:o,to:i,context:l,resolved:a})=>{if(a.pairs.length===0)return new u.MultiAnimation([],{mode:"parallel"});const r=[],c=y=>{r.push(y)},d={from:o,to:i,resolved:a,physics:n,positionedParent:l.positionedParent,maxDistance:s,onComplete:c},p=[];for(const y of t)y.contribute&&p.push(...y.contribute(d));if(p.length===0)return new u.MultiAnimation([],{mode:"parallel"});const f=new u.MultiAnimation(p,{mode:"parallel"}),m=f.onComplete;return f.onComplete=()=>{m==null||m();for(const y of r)try{y()}catch(h){console.error("[hero] cleanup error",h)}},f}}};function In(e){const{paths:t}=e,n=e.type??"static",s=e.variant??"default";return _(t,()=>_n({type:n,variant:s}))}const vn={spring:{stiffness:50,damping:30}},On={spring:{stiffness:80,damping:25}},Tn=(e={})=>{const t=e.physics??vn,n=e.initialRotation??45,s=e.initialScale??.01,o=e.rotationTriggerPoint??.8;return{prepare:({from:i,to:l,context:a})=>(i.then(r=>{r.style.opacity="1"}),l.then(r=>{const c=O(a,"to"),d=Math.min(c.width,c.height)*.4;r.style.setProperty("--max-border-radius",`${d}px`),r.style.setProperty("--border-radius-scale","1"),r.style.willChange="transform",r.style.backfaceVisibility="hidden";const p=c.left+c.width/2,f=c.top+c.height/2;r.style.transformOrigin=`${p}px ${f}px`,r.style.position="fixed",r.style.top=`${c.top}px`,r.style.left=`${c.left}px`,r.style.width=`${c.width}px`,r.style.height=`${c.height}px`,r.style.zIndex="1000",r.style.overflow="hidden",r.style.transform=`rotate(${n}deg) scale(${s}) translateZ(0)`,r.style.borderRadius="calc(var(--max-border-radius) * var(--border-radius-scale))",r.style.opacity="1"}),{}),animation:({from:i,to:l})=>{const a=new u.WebAnimation({element:i,integrator:g.from(On),style:(c,d)=>({opacity:d}),onComplete:()=>{i.style.opacity=""}}),r=new u.WebAnimation({element:l,integrator:g.from(t),style:c=>{let d;if(c<=.05)d=s;else if(c<=o){const y=(c-.05)/(o-.05),h=Math.pow(y,9);d=s+(.8-s)*h}else{const y=(c-o)/(1-o);d=.8+.2*(1-Math.pow(1-y,3))}const p=.7;let f;if(c<=p)f=n;else{const y=(c-p)/(1-p),h=1-Math.pow(1-y,2);f=n*(1-h)}let m;if(c<=p)m=1;else{const y=(c-p)/(1-p);m=1-Math.pow(y,.5)}return{transform:`rotate(${f.toFixed(2)}deg) scale(${d.toFixed(4)}) translateZ(0)`,"--border-radius-scale":m.toFixed(4)}},onComplete:()=>{l.style.willChange="",l.style.backfaceVisibility="",l.style.removeProperty("--max-border-radius"),l.style.removeProperty("--border-radius-scale"),l.style.transform="",l.style.transformOrigin="",l.style.position="",l.style.zIndex="",l.style.top="",l.style.left="",l.style.width="",l.style.height="",l.style.overflow="",l.style.borderRadius=""}});return new u.MultiAnimation([a,r],{mode:"parallel"})}}};function Dn(e){const{paths:t}=e;return _(t,()=>Tn())}const Fn={spring:{stiffness:100,damping:30}},kn=(e={})=>{const t=e.physics??Fn;return{prepare:({from:n,to:s})=>(n.then(o=>{o.style.transformOrigin="center center",o.style.willChange="transform, opacity"}),s.then(o=>{o.style.opacity="0",o.style.transform="rotate(-180deg)",o.style.transformOrigin="center center",o.style.willChange="transform, opacity"}),{}),animation:({from:n,to:s})=>{const o=new u.WebAnimation({element:n,integrator:g.from(t),style:l=>({transform:`rotate(${l*180}deg)`,opacity:l<.5?1:0}),onComplete:()=>{n.style.willChange="auto",n.style.transform="",n.style.transformOrigin="",n.style.opacity=""}}),i=new u.WebAnimation({element:s,integrator:g.from(t),style:(l,a)=>({transform:`rotate(${-a*180}deg)`,opacity:l>.5?1:0}),onComplete:()=>{s.style.willChange="auto",s.style.transform="",s.style.transformOrigin="",s.style.opacity=""}});return new u.MultiAnimation([o,i],{mode:"parallel"})}}};function Yn(e){const{paths:t}=e;return _(t,()=>kn())}const Ln={spring:{stiffness:20,damping:8,doubleSpring:1,restDelta:.001,restSpeed:.001}},Pt=(e={})=>{const t=e.direction??"up",n=e.physics??Ln,s=t==="up",o=s?I:v,i=s?v:I;return{prepare:({from:l,to:a})=>(l.then(r=>{r.style.zIndex=o,r.style.willChange="transform",r.style.backfaceVisibility="hidden",r.style.contain="layout paint",r.style.pointerEvents="none"}),a.then(r=>{r.style.willChange="transform",r.style.backfaceVisibility="hidden",r.style.contain="layout paint",r.style.position="relative",r.style.zIndex=i}),{}),animation:({from:l,to:a})=>{const r=l.offsetHeight,c=a.offsetHeight,d=window.innerHeight,p=Math.max(Math.min(r,c),d),f=new u.WebAnimation({element:l,integrator:g.from(n),style:y=>({transform:`translate3d(0, ${s?-p*y:p*y}px, 0)`}),onComplete:()=>{l.style.willChange="auto",l.style.backfaceVisibility="",l.style.contain="",l.style.transform="",l.style.pointerEvents="",l.style.zIndex=""}}),m=new u.WebAnimation({element:a,integrator:g.from(n),style:(y,h)=>({transform:`translate3d(0, ${s?h*p:h*-p}px, 0)`}),onComplete:()=>{a.style.willChange="auto",a.style.backfaceVisibility="",a.style.contain="",a.style.transform="",a.style.position==="relative"&&(a.style.position=""),a.style.zIndex===i&&(a.style.zIndex="")}});for(const y of[f,m]){const h=y.onComplete;y.onComplete=()=>{h==null||h(),y.releaseFill()}}return new u.MultiAnimation([f,m],{mode:"parallel"})}}};function Mn(e){const{paths:t,type:n="directional"}=e;return n==="non-directional"?_(t,()=>Pt({direction:"up"})):nt(t,{forward:"up",backward:"down"},s=>Pt({direction:s}))}const Hn={spring:{stiffness:200,damping:24}},Wn={inertia:{acceleration:25,resistance:1.2}},K=.2;function zn(){return{enterPhysics:Hn,exitPhysics:Wn,background:{willChange:"transform, opacity",enterStyle:(e,t)=>({transform:`scale(${1-K*e})`,opacity:t}),exitStyle:e=>({transform:`scale(${1-K+K*e})`,opacity:e})}}}const Rn={spring:{stiffness:200,damping:24}},Un={inertia:{acceleration:25,resistance:1.2}},G=.08,Nn=16,J=.6,Vn=e=>`blur(${Math.max(0,e).toFixed(2)}px)`;function Xn(){return{enterPhysics:Rn,exitPhysics:Un,background:{willChange:"transform, opacity",enterStyle:e=>({transform:`scale(${1-G*e})`,opacity:1-(1-J)*e}),exitStyle:e=>({transform:`scale(${1-G+G*e})`,opacity:J+(1-J)*e})},overlay:{willChange:"backdrop-filter",initialStyle:{position:"absolute",left:"0",width:"100%",pointerEvents:"none",backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)"},style:(e,t)=>{const n=e==="enter"?t:1-t,s=Vn(Nn*n);return{backdropFilter:s,WebkitBackdropFilter:s}}}}}const Bn={spring:{stiffness:200,damping:24}},Zn={inertia:{acceleration:25,resistance:1.2}};function qn(){return{enterPhysics:Bn,exitPhysics:Zn,background:{willChange:"",enterStyle:()=>({}),exitStyle:()=>({})}}}const jn={static:qn(),"background-scale":zn(),blur:Xn()},Kn="static",Gn="transform",Jn=(e={})=>{const t=e.direction??"enter",n=jn[e.type??Kn],s=t==="enter"?n.enterPhysics:n.exitPhysics,o=n.background,i=n.overlay,l=o.willChange!=="";return{prepare:({from:a,to:r,context:c,createElement:d})=>{const p=t==="enter"?r:a,f=t==="enter"?a:r;p.then(y=>{y.style.willChange=Gn,y.style.backfaceVisibility="hidden",y.style.contain="layout paint",y.style.zIndex=v,t==="enter"?y.style.position="relative":y.style.pointerEvents="none"}),f.then(y=>{l&&(y.style.willChange=o.willChange,y.style.backfaceVisibility="hidden",y.style.contain="layout paint"),y.style.zIndex=I,t==="enter"?y.style.pointerEvents="none":y.style.position="relative"});let m;return i&&(m=d("sheet-overlay"),Object.assign(m.style,i.initialStyle),m.style.willChange=i.willChange,c.positionedParent.appendChild(m)),{overlay:m}},animation:({from:a,to:r,context:c,overlay:d})=>{const p=t==="enter"?r:a,f=t==="enter"?a:r,m=O(c,t==="enter"?"to":"from"),y=()=>{a.style.pointerEvents="",a.style.zIndex=""},h=()=>{const $=t==="enter"?v:I;r.style.position==="relative"&&(r.style.position=""),r.style.zIndex===$&&(r.style.zIndex="")},b=$=>{const C=$.onComplete;$.onComplete=()=>{C==null||C(),$.releaseFill()}};p.style.clipPath=`inset(${m.top}px 0 calc(100% - ${m.top+m.height}px) 0)`;const w=t==="enter"?($,C)=>({transform:`translate3d(0, ${C*m.height}px, 0)`}):$=>({transform:`translate3d(0, ${$*m.height}px, 0)`}),S=new u.WebAnimation({element:p,integrator:g.from(s),style:w,onComplete:()=>{p.style.willChange="auto",p.style.backfaceVisibility="",p.style.contain="",p.style.clipPath="",p.style.transform="",y(),h()}});b(S);const x=[S];if(l){const $=f.scrollHeight;$>0&&(f.style.height=`${$}px`);const C=O(c,t==="enter"?"from":"to"),P=C.left+C.width/2,A=C.top+C.height/2;f.style.clipPath=`inset(${C.top}px 0 calc(100% - ${C.top+C.height}px) 0)`,f.style.transformOrigin=`${P}px ${A}px`;const F=t==="enter"?(T,st)=>o.enterStyle(T,st):T=>o.exitStyle(T),Y=new u.WebAnimation({element:f,integrator:g.from(s),style:F,onComplete:()=>{f.style.willChange="auto",f.style.backfaceVisibility="",f.style.contain="",f.style.clipPath="",f.style.transformOrigin="",f.style.transform="",f.style.opacity="",f.style.height=""}});b(Y),x.push(Y)}if(d&&i){d.style.zIndex=kt;const $=Dt(c,"to");d.style.top=`${$.top}px`,d.style.height=`${$.height}px`,x.push(new u.WebAnimation({element:d,integrator:g.from(s),style:C=>i.style(t,C)}))}return new u.MultiAnimation(x,{mode:"parallel"})}}};function Qn(e){return e==="scale"||e==="background-scale"?"background-scale":e==="blur"?"blur":"static"}function ts(e){const{enter:t,exit:n}=e,s=e.type,o=Qn(s);return Tt({enter:t,exit:n},i=>Jn({direction:i,type:o}))}const es={spring:{stiffness:170,damping:22,doubleSpring:.8}},ns=(e={})=>{const t=e.direction??"left",n=e.physics??es,s=t==="left";return{prepare:({from:o,to:i})=>(o.then(l=>{l.style.willChange="transform",l.style.backfaceVisibility="hidden",l.style.contain="layout paint",l.style.pointerEvents="none"}),i.then(l=>{const a=s?100:-100;l.style.transform=`translate3d(${a}%, 0, 0)`,l.style.willChange="transform",l.style.backfaceVisibility="hidden",l.style.contain="layout paint"}),{}),animation:({from:o,to:i})=>{const l=new u.WebAnimation({element:o,integrator:g.from(n),style:r=>({transform:`translate3d(${s?-100*r:100*r}%, 0, 0)`}),onComplete:()=>{o.style.willChange="auto",o.style.backfaceVisibility="",o.style.contain="",o.style.transform="",o.style.pointerEvents=""}}),a=new u.WebAnimation({element:i,integrator:g.from(n),style:(r,c)=>({transform:`translate3d(${s?c*100:c*-100}%, 0, 0)`}),onComplete:()=>{i.style.willChange="auto",i.style.backfaceVisibility="",i.style.contain="",i.style.transform=""}});return new u.MultiAnimation([l,a],{mode:"parallel"})}}};function ss(e){const{paths:t}=e;return nt(t,{forward:"left",backward:"right"},n=>ns({direction:n}))}const os={spring:{stiffness:17,damping:6}},Q=20,M=800,is=(e={})=>{const t=e.physics??os;return{prepare:({from:n,to:s})=>(n.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.pointerEvents="none",o.style.transform=`perspective(${M}px) rotateY(0deg) translate3d(0%, 0, 0)`}),s.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.transform=`perspective(${M}px) rotateY(${Q}deg) translate3d(-100%, 0, 0)`}),{}),animation:({from:n,to:s})=>{const o=new u.WebAnimation({element:n,integrator:g.from(t),style:l=>{const a=-l*Q,r=l*100;return{transform:`perspective(${M}px) rotateY(${a}deg) translate3d(${r}%, 0, 0)`}},onComplete:()=>{n.style.transform="",n.style.willChange="auto",n.style.backfaceVisibility="",n.style.contain="",n.style.pointerEvents=""}}),i=new u.WebAnimation({element:s,integrator:g.from(t),style:(l,a)=>{const r=a*Q,c=-a*100;return{transform:`perspective(${M}px) rotateY(${r}deg) translate3d(${c}%, 0, 0)`}},onComplete:()=>{s.style.transform="",s.style.willChange="auto",s.style.backfaceVisibility="",s.style.contain=""}});return new u.MultiAnimation([o,i],{mode:"sequence"})}}};function rs(e){const{paths:t}=e;return _(t,()=>is())}function as({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s,enterRadius:o,exitRadius:i}){const l=t.left-e.left+(t.width-e.width)/2-s.x,a=t.top-e.top+(t.height-e.height)/2-s.y,r=t.width/e.width,c=t.height/e.height,d=e.top/n.height*100,p=(n.width-(e.left+e.width))/n.width*100,f=(n.height-(e.top+e.height))/n.height*100,m=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:y=>{const h=1-y,b=1+(r-1)*h,w=1+(c-1)*h,x=(i*h+o*(1-h))/((b+w)/2);return{clipPath:`inset(${d*h}% ${p*h}% ${f*h}% ${m*h}% round ${x}px)`,transform:`translate(${l*h}px, ${a*h}px) scale(${b}, ${w})`}}}}function ls({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s,enterRadius:o,exitRadius:i}){const l=t.left-e.left+(t.width-e.width)/2+s.x,a=t.top-e.top+(t.height-e.height)/2+s.y,r=t.width/e.width,c=t.height/e.height,d=e.top/n.height*100,p=(n.width-(e.left+e.width))/n.width*100,f=(n.height-(e.top+e.height))/n.height*100,m=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:y=>{const h=1-y,b=1+(r-1)*h,w=1+(c-1)*h,x=(o*(1-h)+i*h)/((b+w)/2);return{clipPath:`inset(${d*h}% ${p*h}% ${f*h}% ${m*h}% round ${x}px)`,transform:`translate(${l*h-s.x}px, ${a*h}px) scale(${b}, ${w})`}}}}const cs={spring:{stiffness:430,damping:33,doubleSpring:1}},Yt=.12,ps=18;function ds(){return{transformOrigin:"50% 50%",animate:e=>{const t=1-e;return{transform:`scale(${1-Yt*t})`}}}}function fs(){return{transformOrigin:"50% 50%",animate:e=>{const t=1-e;return{transform:`scale(${1-Yt*t})`}}}}const tt={willChange:"backdrop-filter",initialStyle:{position:"absolute",left:"0",width:"100%",pointerEvents:"none",backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)"},style:(e,t)=>{const n=e==="enter"?t:1-t,s=`blur(${ps*n}px)`;return{backdropFilter:s,WebkitBackdropFilter:s}}};class ys{constructor(){E(this,"physics",cs)}contribute(t){const{from:n,to:s,resolved:o,physics:i}=t,l=o.mode==="enter",a=l?n:s,r=l?ds():fs();return r&&(a.style.transformOrigin=r.transformOrigin),[new u.WebAnimation({element:a,integrator:g.from(i),style:l?(c,d)=>r.animate(d):c=>r.animate(c)})]}}class hs{prepare(t){const n=t.createElement("zoom-overlay");return Object.assign(n.style,tt.initialStyle),n.style.willChange=tt.willChange,t.context.positionedParent.appendChild(n),{overlay:n}}contribute(t){const n=t.extras.overlay;if(!n)return[];n.style.zIndex=kt;const s=Dt(t.context,"to");return n.style.top=`${s.top}px`,n.style.height=`${s.height}px`,[new u.WebAnimation({element:n,integrator:g.from(t.physics),style:o=>tt.style(t.resolved.mode,o)})]}}const us={spring:{stiffness:430,damping:33,doubleSpring:1}};function ms({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2+n.x,o=e.top-t.top+(e.height-t.height)/2+n.y,i=e.width/t.width,l=e.height/t.height,a=Math.max(i,l);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:r=>{const c=1-r;return{transform:`translate(${s*c-n.x}px, ${o*c}px) scale(${1+(a-1)*c})`}}}}function gs({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2-n.x,o=e.top-t.top+(e.height-t.height)/2-n.y,i=e.width/t.width,l=e.height/t.height,a=Math.max(i,l);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:r=>{const c=1-r;return{transform:`translate(${s*c}px, ${o*c}px) scale(${1+(a-1)*c})`}}}}class bs{constructor(){E(this,"physics",us)}contribute(t){const{from:n,to:s,resolved:o,input:i,physics:l}=t,a=o.mode==="enter",r=a?n:s,c=a?ms(i):gs(i);return c&&(r.style.transformOrigin=c.transformOrigin),[new u.WebAnimation({element:r,integrator:g.from(l),style:a?(d,p)=>c.animate(p):d=>c.animate(d)})]}}const ws={spring:{stiffness:530,damping:34,doubleSpring:1}};class Ss{constructor(){E(this,"physics",ws)}contribute(t){return[]}}const $s={expand:()=>new bs,static:()=>new Ss,blur:()=>new ys};function Cs(e){return $s[e]()}const et="data-zoom-enter-key",_t="data-zoom-exit-key",Es="data-zoom-radius";function It(e){const t=e.getAttribute(Es);if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)&&n>0?n:0}function xs(e,t){const n=[];let s=t;for(;s&&s!==e;){const o=s.parentElement;if(!o)break;for(const i of Array.from(o.children))i!==s&&i instanceof HTMLElement&&n.push(i);s=o}return n}function vt(e){const t=e.querySelectorAll(`[${et}]`);return t.length!==1?null:t[0]}function Ot(e,t){const n=e.querySelectorAll(`[${_t}]`);for(const s of n)if(s.getAttribute(_t)===t)return s;return null}function As(e,t){const n=vt(e),s=vt(t);if(!n&&s){const o=s.getAttribute(et);if(!o)return null;const i=Ot(e,o);return i?{mode:"enter",enterEl:s,exitEl:i}:null}if(n&&!s){const o=n.getAttribute(et);if(!o)return null;const i=Ot(t,o);return i?{mode:"exit",enterEl:n,exitEl:i}:null}return null}function Ps(e,t,n,s){return{enterRect:ot(e.mode==="enter"?n:t,e.enterEl),exitRect:ot(e.mode==="enter"?t:n,e.exitEl),pageRect:e.mode==="enter"?n.getBoundingClientRect():t.getBoundingClientRect(),scrollOffset:s,enterRadius:It(e.enterEl),exitRadius:It(e.exitEl)}}class _s{prepare(t){t.from.then(n=>{n.style.willChange="transform, clip-path, opacity",n.style.backfaceVisibility="hidden",n.style.contain="layout paint"})}contribute(t){const{from:n,to:s,resolved:o,input:i,physics:l,onComplete:a}=t,r=o.mode==="enter",c=r?as(i):ls(i),d=r?s:n,p=r?"t":"u";c&&(d.style.transformOrigin=c.transformOrigin);const f=r?I:v,m=r?v:I,y=n.style.zIndex;n.style.zIndex=f;const h=s.style.zIndex,b=s.style.position;return s.style.zIndex=m,s.style.position="relative",a(()=>{d.style.willChange="auto",d.style.backfaceVisibility="",d.style.transformOrigin="",d.style.contain="",n.style.zIndex=y,s.style.zIndex===m&&(s.style.zIndex=h),s.style.position==="relative"&&(s.style.position=b),s.style.transformOrigin="",n.style.willChange="auto",n.style.backfaceVisibility="",n.style.transformOrigin="",n.style.contain="",n.style.transform="",n.style.clipPath=""}),[new u.WebAnimation({element:d,integrator:g.from(l),style:p==="t"?w=>c.animate(w):(w,S)=>c.animate(S)})]}}class Is{contribute(t){const{resolved:n,physics:s,from:o,to:i,onComplete:l}=t,a=n.mode==="enter"?i:o,r=xs(a,n.enterEl);if(r.length===0)return[];const c=r.map(d=>d.style.opacity);if(n.mode==="enter")for(const d of r)d.style.opacity="0";return l(()=>{for(let d=0;d<r.length;d++){const p=r[d];p&&(p.style.opacity=c[d]??"")}}),r.map(d=>new u.WebAnimation({element:d,integrator:g.from(s),style:(p,f)=>({opacity:n.mode==="enter"?p:f})}))}}class Lt{contribute(){return[]}}const vs={default:()=>new Lt,fade:()=>new Is};function Os(e){return vs[e]()}class Ts extends Lt{}function Ds(e){const t=Cs(e.type);return{strategies:[new _s,t,Os(e.variant),new Ts,...e.type==="blur"?[new hs]:[]],physics:t.physics}}const Fs=e=>{const{strategies:t,physics:n}=Ds(e);return{prepare:s=>{const o={from:s.from,to:s.to,context:{positionedParent:s.context.positionedParent},createElement:s.createElement},i={};for(const l of t){if(!l.prepare)continue;const a=l.prepare(o);a&&Object.assign(i,a)}return i},animation:({from:s,to:o,context:i,...l})=>{const a=As(s,o);if(!a)return new u.MultiAnimation([],{mode:"parallel"});const r=Ps(a,s,o,i.scrollOffset),c=[],p={from:s,to:o,resolved:a,input:r,physics:n,context:i,extras:l,onComplete:y=>{c.push(y)}},f=[];for(const y of t)y.contribute&&f.push(...y.contribute(p));const m=f[0];if(m){const y=m.onComplete;m.onComplete=()=>{y==null||y();for(const h of c)try{h()}catch(b){console.error("[zoom] cleanup error",b)}}}for(const y of f){if(!(y instanceof u.WebAnimation))continue;const h=y.onComplete;y.onComplete=()=>{h==null||h(),y.releaseFill()}}return new u.MultiAnimation(f,{mode:"parallel"})}}};function ks(e){const t=e.type??"static",n=e.variant??(e.fade?"fade":"default");return{type:t,variant:n}}function Ys(e){const t=ks(e);return _(e.paths,()=>Fs(t))}exports.Animation=u.Animation;exports.MultiAnimation=u.MultiAnimation;exports.WebAnimation=u.WebAnimation;exports.axis=Ae;exports.blind=Te;exports.drill=Ue;exports.fade=Be;exports.film=en;exports.hero=In;exports.jaemin=Dn;exports.rotate=Yn;exports.scroll=Mn;exports.sheet=ts;exports.slide=ss;exports.strip=rs;exports.zoom=Ys;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Bt = Object.defineProperty;
|
|
2
2
|
var Zt = (e, t, n) => t in e ? Bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var x = (e, t, n) => Zt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { P as st, V as At, W as m, M as E, S as Wt } from "./multi-animation-
|
|
5
|
-
import { A as Xs } from "./multi-animation-
|
|
4
|
+
import { P as st, V as At, W as m, M as E, S as Wt } from "./multi-animation-1FueEz2Q.js";
|
|
5
|
+
import { A as Xs } from "./multi-animation-1FueEz2Q.js";
|
|
6
6
|
function v(e, t) {
|
|
7
7
|
const n = [];
|
|
8
8
|
for (let s = 0; s < e.length; s++)
|
|
@@ -266,7 +266,7 @@ function Yt(e, t) {
|
|
|
266
266
|
}
|
|
267
267
|
const at = 8, lt = {
|
|
268
268
|
spring: {
|
|
269
|
-
stiffness:
|
|
269
|
+
stiffness: 800,
|
|
270
270
|
damping: 40,
|
|
271
271
|
doubleSpring: 1.2,
|
|
272
272
|
restDelta: 0.1,
|
|
@@ -725,7 +725,7 @@ function Le() {
|
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
727
|
const He = {
|
|
728
|
-
spring: { stiffness:
|
|
728
|
+
spring: { stiffness: 160, damping: 22 }
|
|
729
729
|
};
|
|
730
730
|
function Me(e) {
|
|
731
731
|
const t = e === "enter" ? -20 : 100, n = e === "enter" ? 100 : -20;
|
|
@@ -1669,9 +1669,9 @@ function Rn() {
|
|
|
1669
1669
|
};
|
|
1670
1670
|
}
|
|
1671
1671
|
const Un = {
|
|
1672
|
-
spring: { stiffness:
|
|
1672
|
+
spring: { stiffness: 200, damping: 24 }
|
|
1673
1673
|
}, Nn = {
|
|
1674
|
-
inertia: { acceleration:
|
|
1674
|
+
inertia: { acceleration: 25, resistance: 1.2 }
|
|
1675
1675
|
};
|
|
1676
1676
|
function Vn() {
|
|
1677
1677
|
return {
|
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var It=Object.defineProperty;var Ht=(t,n,e)=>n in t?It(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var F=(t,n,e)=>Ht(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("./multi-animation-uzEnQnrG.cjs");class Mt extends Q.Animation{constructor(){super(...arguments);F(this,"child",null);F(this,"_state","idle");F(this,"_settled",!1);F(this,"listeners",new Set)}attach(e){const s=this.child;if(this.child=e,this._settled=!1,s){const l=s.getPose();s.complete(),e.matchInto(l)}e.playbackRate=this.playbackRate;const o=e.onComplete;e.onComplete=()=>{o==null||o(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const a=e.onUpdate;e.onUpdate=l=>{var u;a==null||a(l),(u=this.onUpdate)==null||u.call(this,l),this.notify()},this._state==="paused"?e.pause():this._state==="reversing"?e.reverse():(this._state="playing",e.play()),this.notify()}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.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(),this.notify()}complete(){var e;(e=this.child)==null||e.complete(),this.notify()}get isAnimating(){var e;return((e=this.child)==null?void 0:e.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}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),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}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Wt=(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"},vt=new Set(["auto","scroll","overlay"]),zt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(vt.has(e.overflowY)||vt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Bt=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 Ft(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const s={};return n.forEach((o,a)=>{s[o]=e[a]}),s})}function Kt(t){const n=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...n]}const Xt=1e6,bt=100,$t=10;function qt(t){const n=t.trim(),e=n.indexOf("#"),s=n.indexOf("?"),o=[e,s].filter(a=>a>=0).reduce((a,l)=>Math.min(a,l),n.length);return n.slice(0,o)}function ut(t){const n=qt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return ut(new URL(n).pathname)}catch{}const s=(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/");return(s.length>1?s.replace(/\/+$/g,""):s)||"/"}function Ut(t){const n=t.trim();return n==="*"?"*":ut(n)}function rt(t){return t==="/"?[]:t.slice(1).split("/")}function Vt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function ct(t,n){const e=ut(t),s=Ut(n);if(s==="*")return{matched:!0,specificity:0};if(e===s)return{matched:!0,specificity:Xt+rt(s).length*bt};const o=rt(e),a=rt(s);let l=0;for(let u=0;u<a.length;u++){const g=a[u],b=o[u],_=u===a.length-1;if(g===void 0)return{matched:!1,specificity:0};if((g==="*"||g==="**")&&_)return{matched:g==="**"?o.length>=u:o.length>u,specificity:l};if(b===void 0)return{matched:!1,specificity:0};if(g==="*"||Vt(g)){l+=$t;continue}if(g!==b)return{matched:!1,specificity:0};l+=bt}return{matched:o.length===a.length,specificity:l}}function Gt(t,n){return ct(t,n).matched}function Yt(t,n,e){let s;for(const o of e){const a=ct(t,o.from);if(!a.matched)continue;const l=ct(n,o.to);if(!l.matched)continue;const u=a.specificity+l.specificity;(!s||u>s.specificity)&&(s={transition:o.transition,specificity:u})}return(s==null?void 0:s.transition)??null}const Zt=768,jt=10,Qt=10;function Jt(t={}){const{preserveScroll:n=f=>f,resolvePath:e=f=>f}=t,s=typeof n=="function"?n:()=>n;let o=null,a=!1,l=!1;const u=()=>{const f=(o==null?void 0:o.clientWidth)??0,d=f>0?f:typeof window<"u"?window.innerWidth:0;return d>0&&d<Zt},g=()=>(l||(a=u(),l=!0),a),b=f=>{var R;const d=e(f),y=s(g());if(y===!1)return{preserves:!1,shared:!1,storageKey:`path:${d}`};if(y===!0)return{preserves:!0,shared:!1,storageKey:`path:${d}`};const E=((R=y.exclude)==null?void 0:R.some(C=>Gt(d,C)))??!1,P=!E&&!!y.key;return{preserves:!E,shared:P,storageKey:P?`shared:${y.key}`:`path:${d}`}},_=f=>b(f).preserves;let O=null;const T=new Map;let L=null,k=!1,W=0;const $=()=>{o&&L&&!k&&T.set(b(L).storageKey,{x:o.scrollLeft,y:o.scrollTop})},z=f=>{if(!o)return;const d=b(f);if(d.preserves&&d.shared&&!T.has(d.storageKey))return;const y=d.preserves&&T.has(d.storageKey)?T.get(d.storageKey):{x:0,y:0};let E=0;const P=()=>{if(!o)return;o.scrollTo({top:y.y,left:y.x}),!(Math.abs(o.scrollTop-y.y)<1&&Math.abs(o.scrollLeft-y.x)<1)&&E<jt&&(E++,requestAnimationFrame(P))};requestAnimationFrame(P)};return{initializeContext:(f,d)=>{k=!0;const y=++W;O=f,o||(o=zt(f),a=u(),l=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{a=u()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",$,{passive:!0})),L=d,z(d);let E=0;const P=()=>{y===W&&(E++,E>=Qt?k=!1:requestAnimationFrame(P))};requestAnimationFrame(P)},calculateScrollOffset:(f,d)=>{const y=f?b(f).storageKey:null,E=y&&T.has(y)?T.get(y):{x:0,y:0},P=d?b(d):null,R=P!=null&&P.preserves?P.storageKey:null,C=R&&T.has(R)?T.get(R):{x:0,y:0};return{x:-C.x+E.x,y:-C.y+E.y}},evictScrollPosition:f=>{T.delete(b(f).storageKey)},shouldPreserve:_,getScrollContainer:()=>o,getPositionedParentElement:()=>O?Bt(O):document.body,getScrollPosition:f=>{const d=f?b(f).storageKey:null;return d&&T.has(d)?T.get(d):{x:0,y:0}},getIsMobile:g}}const St=30,Et=8,Tt=1.2,wt=30,te=600;function ee(){let t=null,n=!1,e=!1,s=null,o=null,a=!1;const l=(h,v)=>{for(let S=0;S<h.length;S++){const m=h.item(S);if(m&&m.identifier===v)return m}return null},u=()=>{s!==null&&(clearTimeout(s),s=null)},g=()=>{o!==null&&(clearTimeout(o),o=null)},b=()=>{n=!0,e=!0,u(),g(),s=setTimeout(()=>{n=!1,e=!1,s=null},te)},_=h=>{if(h.touches.length!==1){t=null;return}const v=h.touches.item(0);if(!v){t=null;return}const S=window.innerWidth,m=v.clientX<=St,w=v.clientX>=S-St;if(!m&&!w){t=null;return}t={identifier:v.identifier,startX:v.clientX,startY:v.clientY,fromLeftEdge:m,moved:!1}},O=h=>{if(!t)return;if(h.touches.length!==1){t=null;return}const v=l(h.touches,t.identifier);if(!v){t=null;return}const S=v.clientX-t.startX,m=v.clientY-t.startY,w=Math.abs(S),I=Math.abs(m);if(I>Et&&I>w*Tt){t=null;return}const f=t.fromLeftEdge?S>0:S<0;w>Et&&w>I*Tt&&f&&(t.moved=!0)},T=h=>{if(!t)return;const v=l(h.changedTouches,t.identifier);if(!v){t=null;return}const S=v.clientX-t.startX,m=t.fromLeftEdge?S>0:S<0;if(t.moved&&m&&Math.abs(S)>=wt){b(),t=null;return}t.moved&&Math.abs(S)>=wt&&b(),t=null},L=()=>{t&&(t.moved&&b(),t=null)};return{initialize:()=>{if(typeof window>"u"||a)return;a=!0;const h={passive:!0,capture:!0};window.addEventListener("touchstart",_,h),window.addEventListener("touchmove",O,h),window.addEventListener("touchend",T,h),window.addEventListener("touchcancel",L,h)},destroy:()=>{if(typeof window>"u"||!a)return;a=!1;const h={capture:!0};window.removeEventListener("touchstart",_,h),window.removeEventListener("touchmove",O,h),window.removeEventListener("touchend",T,h),window.removeEventListener("touchcancel",L,h),u(),g(),t=null,n=!1,e=!1},isSwipeBack:()=>{const h=n||e;return h&&u(),h},onPageEnter:()=>{n=!1,u(),g(),o=setTimeout(()=>{e=!1,o=null},0)}}}function ne(){let t=null;function n(){var s,o;t&&((s=t.outResolve)==null||s.call(t,null),(o=t.inResolve)==null||o.call(t,null),t=null)}function e(){if(t!=null&&t.from&&(t!=null&&t.to)&&(t!=null&&t.outResolve)&&(t!=null&&t.inResolve)){if(t.from===t.to){n();return}const s={from:t.from,to:t.to};t.outResolve(s),t.inResolve(s),t=null}}return{trigger(s,o){var l;o==="out"&&(t==null?void 0:t.to)===s&&!t.from&&((l=t.inResolve)==null||l.call(t,null),t={}),t&&(o==="out"&&t.from&&t.from!==s||o==="in"&&t.to&&t.to!==s)&&n(),t||(t={}),o==="out"?t.from=s:t.to=s},get(s){return new Promise(o=>{t||(t={}),s==="out"?t.outResolve=o:t.inResolve=o,e()})}}}const X=new Map;let Y=null,Pt=!1;function Rt(t,n){if(t instanceof HTMLElement&&X.has(t)&&!t.isConnected){const e=X.get(t);X.delete(t),queueMicrotask(()=>e(n))}for(const e of Array.from(t.childNodes))Rt(e,n)}function se(){if(Pt||typeof document>"u")return;Pt=!0,Y=new MutationObserver(n=>{for(const e of n){const s={parent:e.target,nextSibling:e.nextSibling};for(const o of Array.from(e.removedNodes))Rt(o,s)}});const t=()=>{Y==null||Y.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function ie(t,n){return se(),X.set(t,n),()=>{X.delete(t)}}const lt=new WeakMap;let Z=null;const j="none !important";function K(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function oe(){return Z||(Z=new MutationObserver(t=>{for(const n of t){const e=n.target,s=lt.get(e);if(!s)continue;const o=K(e);o!==s.accounted&&(s.accounted=o,o===j?(s.reactHidden=!0,s.onHide()):o!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),Z)}function re(t,n){const e=K(t),s={accounted:e,reactHidden:e===j,onHide:n.onHide,onShow:n.onShow};return lt.set(t,s),oe().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return K(t)===j},setDisplay(o,a=!1){o===null?t.style.removeProperty("display"):t.style.setProperty("display",o,a?"important":""),s.accounted=K(t)},sync(){s.accounted=K(t),s.reactHidden=s.accounted===j},stop(){lt.delete(t)}}}function ce(t){return Array.isArray(t)}function Ct(t){const n=[];for(const e of t)ce(e)?n.push(...Ct(e)):n.push(e);return n}function le(t,n={}){const{transitions:e=[],middleware:s=(i,r)=>({from:i,to:r}),preserveScroll:o=i=>i}=t,a=n.host??new Mt,l=ne(),u=typeof e=="function"?e:()=>e,g=ee();g.initialize();const b=new Map,_=i=>{let r=b.get(i);return r===void 0&&(r=s(i,i).from,b.set(i,r)),r},{initializeContext:O,calculateScrollOffset:T,evictScrollPosition:L,shouldPreserve:k,getScrollContainer:W,getPositionedParentElement:$,getScrollPosition:z,getIsMobile:h}=Jt({preserveScroll:o,resolvePath:_}),v=new Map,S=()=>{const i=h();let r=v.get(i);return r||(r=Kt(Ct(u({isMobile:i}))),v.set(i,r)),r};let m=null,w=null;const I=new WeakMap,f=i=>{I.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},d=i=>{const r=I.get(i);return r||{parent:i.parentNode,nextSibling:i.nextSibling}},y=new WeakMap,E=new WeakMap;let P=0;const R=i=>{const r=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return r&&r!=="none"?r:"block"},C=(i,r)=>{r.visibleDisplay=i.style.getPropertyValue("display"),r.computedDisplay=R(i)},dt=(i,r)=>{if(E.get(i)!==r)return;E.delete(i);const c=y.get(i);c&&(c.savedCss!==null&&(i.style.cssText=c.savedCss,c.savedCss=null),c.intent==="hidden"?c.vis.setDisplay("none",!0):c.visibleDisplay?(c.vis.setDisplay(c.visibleDisplay,!1),C(i,c)):(c.vis.setDisplay(null),C(i,c)))},Ot=(i,r,c,p,A)=>{const M=p.element,D=A.element,N=(p.mode??"unmount")==="hidden",{parent:U,nextSibling:tt}=p.parent?{parent:p.parent,nextSibling:p.nextSibling}:d(M),V=T(r,c),et={scrollOffset:V,from:{scroll:z(r)},to:{scroll:z(c)},get scrollingElement(){return W()||document.documentElement},get positionedParent(){return $()}};let x;if(N){x=M,x.style.top=`${-1*((V==null?void 0:V.y)??0)}px`;const H=y.get(D);H&&H.savedCss===null&&(H.savedCss=D.style.cssText)}else x=M,Wt(x,et);k(r)||L(r);const G=N?++P:0;N&&(E.set(D,G),E.set(M,G));const yt=Promise.resolve(x),mt=Promise.resolve(D),gt=[],Nt={from:yt,to:mt,context:et,createElement:((H,nt="div")=>{const B=document.createElement(nt);return B.setAttribute("data-ssgoi-id",H),gt.push(B),B})},kt=Promise.resolve(i.prepare?i.prepare(Nt):{});Ft({from:yt,to:mt,extras:kt}).then(({from:H,to:nt,extras:B})=>{!N&&U&&(tt&&U.contains(tt)?U.insertBefore(x,tt):U.appendChild(x));const st=i.animation({from:H,to:nt,context:et,...B}),it=st.onComplete;st.onComplete=()=>{it==null||it(),N?(dt(M,G),dt(D,G)):x.parentNode&&x.parentNode.removeChild(x);for(const ot of gt)ot.parentNode&&ot.parentNode.removeChild(ot)},a.attach(st)})},q=(i,r)=>{const c=g.isSwipeBack();l.trigger(i,r),l.get(r).then(p=>{if(r==="in"&&g.onPageEnter(),!p)return;if(c){r==="out"&&p.from&&!k(p.from)&&L(p.from),m=null,w=null;return}if(r!=="in")return;const{from:A,to:M}=s(p.from,p.to),D=Yt(A,M,S()),J=m,N=w;m=null,w=null,!(!D||!J||!N)&&Ot(D,p.from,p.to,J,N)})},Lt=(i,r)=>{const c=y.get(i);if(!c)return;const p=c.intent==="hidden";if(c.intent="hidden",c.savedCss===null&&(c.savedCss=i.style.cssText),c.vis.setDisplay(c.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",p)return;const A=d(i);m={element:i,parent:A.parent,nextSibling:A.nextSibling,mode:"hidden"};const M=i.getAttribute("data-ssgoi-transition")??r;q(M,"out")},_t=(i,r)=>{const c=y.get(i);if(!c||c.intent==="visible")return;c.intent="visible",C(i,c),c.savedCss!==null&&(i.style.cssText=c.savedCss,c.visibleDisplay?c.vis.setDisplay(c.visibleDisplay,!1):c.vis.setDisplay(null)),O(i,r),w={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling};const p=i.getAttribute("data-ssgoi-transition")??r;q(p,"in")},Dt=(i,r,c)=>{const p=y.get(i);if(p&&(p.vis.stop(),y.delete(i),E.delete(i),p.intent==="hidden")){(m==null?void 0:m.element)===i&&(m=null),(w==null?void 0:w.element)===i&&(w=null);return}const A=c??d(i);m={element:i,parent:A.parent,nextSibling:A.nextSibling,mode:"unmount"};const M=i.getAttribute("data-ssgoi-transition")??r;q(M,"out")},ft=new WeakSet,ht=(i,r)=>{if(ft.has(r))return;ft.add(r),f(r);const c=re(r,{onHide:()=>Lt(r,i),onShow:()=>_t(r,i)}),p={vis:c,savedCss:null,intent:c.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};y.set(r,p),c.isHidden||(C(r,p),O(r,i),w={element:r,parent:r.parentElement,nextSibling:r.nextElementSibling},q(i,"in")),ie(r,A=>Dt(r,i,A))},pt=new Map;return{register:ht,refFor:i=>{let r=pt.get(i);return r||(r=c=>{c&&ht(i,c)},pt.set(i,r)),r}}}const xt="data-ssgoi-root",ae=`[${xt}]`,at="data-ssgoi-transition",At=`[${at}]`,ue="[data-ssgoi-clone]";function de(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function fe(t){return t.nodeType===Node.ELEMENT_NODE}function he(t){return t instanceof HTMLElement}function pe(t,n){if(!de())return()=>{};t.setAttribute(xt,"");const e=l=>l.closest(ae)===t,s=l=>{if(!he(l)||!e(l)||l.closest(ue))return;const u=l.getAttribute(at);u!==null&&n.register(u,l)},o=l=>{if(fe(l)){l.matches(At)&&s(l);for(const u of l.querySelectorAll(At))s(u)}},a=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){s(u.target);continue}for(const g of u.addedNodes)o(g)}});return a.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[at]}),o(t),()=>a.disconnect()}exports.Animation=Q.Animation;exports.MultiAnimation=Q.MultiAnimation;exports.WebAnimation=Q.WebAnimation;exports.HostAnimation=Mt;exports.createSggoiTransitionContext=le;exports.observeSsgoiTransitions=pe;
|
|
1
|
+
"use strict";var It=Object.defineProperty;var Ht=(t,n,e)=>n in t?It(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var F=(t,n,e)=>Ht(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("./multi-animation-qtH1IKNG.cjs");class Mt extends Q.Animation{constructor(){super(...arguments);F(this,"child",null);F(this,"_state","idle");F(this,"_settled",!1);F(this,"listeners",new Set)}attach(e){const s=this.child;if(this.child=e,this._settled=!1,s){const l=s.getPose();s.complete(),e.matchInto(l)}e.playbackRate=this.playbackRate;const o=e.onComplete;e.onComplete=()=>{o==null||o(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const a=e.onUpdate;e.onUpdate=l=>{var u;a==null||a(l),(u=this.onUpdate)==null||u.call(this,l),this.notify()},this._state==="paused"?e.pause():this._state==="reversing"?e.reverse():(this._state="playing",e.play()),this.notify()}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.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(),this.notify()}complete(){var e;(e=this.child)==null||e.complete(),this.notify()}get isAnimating(){var e;return((e=this.child)==null?void 0:e.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}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),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}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Wt=(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"},vt=new Set(["auto","scroll","overlay"]),zt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(vt.has(e.overflowY)||vt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Bt=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 Ft(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const s={};return n.forEach((o,a)=>{s[o]=e[a]}),s})}function Kt(t){const n=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...n]}const Xt=1e6,bt=100,$t=10;function qt(t){const n=t.trim(),e=n.indexOf("#"),s=n.indexOf("?"),o=[e,s].filter(a=>a>=0).reduce((a,l)=>Math.min(a,l),n.length);return n.slice(0,o)}function ut(t){const n=qt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return ut(new URL(n).pathname)}catch{}const s=(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/");return(s.length>1?s.replace(/\/+$/g,""):s)||"/"}function Ut(t){const n=t.trim();return n==="*"?"*":ut(n)}function rt(t){return t==="/"?[]:t.slice(1).split("/")}function Vt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function ct(t,n){const e=ut(t),s=Ut(n);if(s==="*")return{matched:!0,specificity:0};if(e===s)return{matched:!0,specificity:Xt+rt(s).length*bt};const o=rt(e),a=rt(s);let l=0;for(let u=0;u<a.length;u++){const g=a[u],b=o[u],_=u===a.length-1;if(g===void 0)return{matched:!1,specificity:0};if((g==="*"||g==="**")&&_)return{matched:g==="**"?o.length>=u:o.length>u,specificity:l};if(b===void 0)return{matched:!1,specificity:0};if(g==="*"||Vt(g)){l+=$t;continue}if(g!==b)return{matched:!1,specificity:0};l+=bt}return{matched:o.length===a.length,specificity:l}}function Gt(t,n){return ct(t,n).matched}function Yt(t,n,e){let s;for(const o of e){const a=ct(t,o.from);if(!a.matched)continue;const l=ct(n,o.to);if(!l.matched)continue;const u=a.specificity+l.specificity;(!s||u>s.specificity)&&(s={transition:o.transition,specificity:u})}return(s==null?void 0:s.transition)??null}const Zt=768,jt=10,Qt=10;function Jt(t={}){const{preserveScroll:n=f=>f,resolvePath:e=f=>f}=t,s=typeof n=="function"?n:()=>n;let o=null,a=!1,l=!1;const u=()=>{const f=(o==null?void 0:o.clientWidth)??0,d=f>0?f:typeof window<"u"?window.innerWidth:0;return d>0&&d<Zt},g=()=>(l||(a=u(),l=!0),a),b=f=>{var R;const d=e(f),y=s(g());if(y===!1)return{preserves:!1,shared:!1,storageKey:`path:${d}`};if(y===!0)return{preserves:!0,shared:!1,storageKey:`path:${d}`};const E=((R=y.exclude)==null?void 0:R.some(C=>Gt(d,C)))??!1,P=!E&&!!y.key;return{preserves:!E,shared:P,storageKey:P?`shared:${y.key}`:`path:${d}`}},_=f=>b(f).preserves;let O=null;const T=new Map;let L=null,k=!1,W=0;const $=()=>{o&&L&&!k&&T.set(b(L).storageKey,{x:o.scrollLeft,y:o.scrollTop})},z=f=>{if(!o)return;const d=b(f);if(d.preserves&&d.shared&&!T.has(d.storageKey))return;const y=d.preserves&&T.has(d.storageKey)?T.get(d.storageKey):{x:0,y:0};let E=0;const P=()=>{if(!o)return;o.scrollTo({top:y.y,left:y.x}),!(Math.abs(o.scrollTop-y.y)<1&&Math.abs(o.scrollLeft-y.x)<1)&&E<jt&&(E++,requestAnimationFrame(P))};requestAnimationFrame(P)};return{initializeContext:(f,d)=>{k=!0;const y=++W;O=f,o||(o=zt(f),a=u(),l=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{a=u()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",$,{passive:!0})),L=d,z(d);let E=0;const P=()=>{y===W&&(E++,E>=Qt?k=!1:requestAnimationFrame(P))};requestAnimationFrame(P)},calculateScrollOffset:(f,d)=>{const y=f?b(f).storageKey:null,E=y&&T.has(y)?T.get(y):{x:0,y:0},P=d?b(d):null,R=P!=null&&P.preserves?P.storageKey:null,C=R&&T.has(R)?T.get(R):{x:0,y:0};return{x:-C.x+E.x,y:-C.y+E.y}},evictScrollPosition:f=>{T.delete(b(f).storageKey)},shouldPreserve:_,getScrollContainer:()=>o,getPositionedParentElement:()=>O?Bt(O):document.body,getScrollPosition:f=>{const d=f?b(f).storageKey:null;return d&&T.has(d)?T.get(d):{x:0,y:0}},getIsMobile:g}}const St=30,Et=8,Tt=1.2,wt=30,te=600;function ee(){let t=null,n=!1,e=!1,s=null,o=null,a=!1;const l=(h,v)=>{for(let S=0;S<h.length;S++){const m=h.item(S);if(m&&m.identifier===v)return m}return null},u=()=>{s!==null&&(clearTimeout(s),s=null)},g=()=>{o!==null&&(clearTimeout(o),o=null)},b=()=>{n=!0,e=!0,u(),g(),s=setTimeout(()=>{n=!1,e=!1,s=null},te)},_=h=>{if(h.touches.length!==1){t=null;return}const v=h.touches.item(0);if(!v){t=null;return}const S=window.innerWidth,m=v.clientX<=St,w=v.clientX>=S-St;if(!m&&!w){t=null;return}t={identifier:v.identifier,startX:v.clientX,startY:v.clientY,fromLeftEdge:m,moved:!1}},O=h=>{if(!t)return;if(h.touches.length!==1){t=null;return}const v=l(h.touches,t.identifier);if(!v){t=null;return}const S=v.clientX-t.startX,m=v.clientY-t.startY,w=Math.abs(S),I=Math.abs(m);if(I>Et&&I>w*Tt){t=null;return}const f=t.fromLeftEdge?S>0:S<0;w>Et&&w>I*Tt&&f&&(t.moved=!0)},T=h=>{if(!t)return;const v=l(h.changedTouches,t.identifier);if(!v){t=null;return}const S=v.clientX-t.startX,m=t.fromLeftEdge?S>0:S<0;if(t.moved&&m&&Math.abs(S)>=wt){b(),t=null;return}t.moved&&Math.abs(S)>=wt&&b(),t=null},L=()=>{t&&(t.moved&&b(),t=null)};return{initialize:()=>{if(typeof window>"u"||a)return;a=!0;const h={passive:!0,capture:!0};window.addEventListener("touchstart",_,h),window.addEventListener("touchmove",O,h),window.addEventListener("touchend",T,h),window.addEventListener("touchcancel",L,h)},destroy:()=>{if(typeof window>"u"||!a)return;a=!1;const h={capture:!0};window.removeEventListener("touchstart",_,h),window.removeEventListener("touchmove",O,h),window.removeEventListener("touchend",T,h),window.removeEventListener("touchcancel",L,h),u(),g(),t=null,n=!1,e=!1},isSwipeBack:()=>{const h=n||e;return h&&u(),h},onPageEnter:()=>{n=!1,u(),g(),o=setTimeout(()=>{e=!1,o=null},0)}}}function ne(){let t=null;function n(){var s,o;t&&((s=t.outResolve)==null||s.call(t,null),(o=t.inResolve)==null||o.call(t,null),t=null)}function e(){if(t!=null&&t.from&&(t!=null&&t.to)&&(t!=null&&t.outResolve)&&(t!=null&&t.inResolve)){if(t.from===t.to){n();return}const s={from:t.from,to:t.to};t.outResolve(s),t.inResolve(s),t=null}}return{trigger(s,o){var l;o==="out"&&(t==null?void 0:t.to)===s&&!t.from&&((l=t.inResolve)==null||l.call(t,null),t={}),t&&(o==="out"&&t.from&&t.from!==s||o==="in"&&t.to&&t.to!==s)&&n(),t||(t={}),o==="out"?t.from=s:t.to=s},get(s){return new Promise(o=>{t||(t={}),s==="out"?t.outResolve=o:t.inResolve=o,e()})}}}const X=new Map;let Y=null,Pt=!1;function Rt(t,n){if(t instanceof HTMLElement&&X.has(t)&&!t.isConnected){const e=X.get(t);X.delete(t),queueMicrotask(()=>e(n))}for(const e of Array.from(t.childNodes))Rt(e,n)}function se(){if(Pt||typeof document>"u")return;Pt=!0,Y=new MutationObserver(n=>{for(const e of n){const s={parent:e.target,nextSibling:e.nextSibling};for(const o of Array.from(e.removedNodes))Rt(o,s)}});const t=()=>{Y==null||Y.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function ie(t,n){return se(),X.set(t,n),()=>{X.delete(t)}}const lt=new WeakMap;let Z=null;const j="none !important";function K(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function oe(){return Z||(Z=new MutationObserver(t=>{for(const n of t){const e=n.target,s=lt.get(e);if(!s)continue;const o=K(e);o!==s.accounted&&(s.accounted=o,o===j?(s.reactHidden=!0,s.onHide()):o!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),Z)}function re(t,n){const e=K(t),s={accounted:e,reactHidden:e===j,onHide:n.onHide,onShow:n.onShow};return lt.set(t,s),oe().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return K(t)===j},setDisplay(o,a=!1){o===null?t.style.removeProperty("display"):t.style.setProperty("display",o,a?"important":""),s.accounted=K(t)},sync(){s.accounted=K(t),s.reactHidden=s.accounted===j},stop(){lt.delete(t)}}}function ce(t){return Array.isArray(t)}function Ct(t){const n=[];for(const e of t)ce(e)?n.push(...Ct(e)):n.push(e);return n}function le(t,n={}){const{transitions:e=[],middleware:s=(i,r)=>({from:i,to:r}),preserveScroll:o=i=>i}=t,a=n.host??new Mt,l=ne(),u=typeof e=="function"?e:()=>e,g=ee();g.initialize();const b=new Map,_=i=>{let r=b.get(i);return r===void 0&&(r=s(i,i).from,b.set(i,r)),r},{initializeContext:O,calculateScrollOffset:T,evictScrollPosition:L,shouldPreserve:k,getScrollContainer:W,getPositionedParentElement:$,getScrollPosition:z,getIsMobile:h}=Jt({preserveScroll:o,resolvePath:_}),v=new Map,S=()=>{const i=h();let r=v.get(i);return r||(r=Kt(Ct(u({isMobile:i}))),v.set(i,r)),r};let m=null,w=null;const I=new WeakMap,f=i=>{I.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},d=i=>{const r=I.get(i);return r||{parent:i.parentNode,nextSibling:i.nextSibling}},y=new WeakMap,E=new WeakMap;let P=0;const R=i=>{const r=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return r&&r!=="none"?r:"block"},C=(i,r)=>{r.visibleDisplay=i.style.getPropertyValue("display"),r.computedDisplay=R(i)},dt=(i,r)=>{if(E.get(i)!==r)return;E.delete(i);const c=y.get(i);c&&(c.savedCss!==null&&(i.style.cssText=c.savedCss,c.savedCss=null),c.intent==="hidden"?c.vis.setDisplay("none",!0):c.visibleDisplay?(c.vis.setDisplay(c.visibleDisplay,!1),C(i,c)):(c.vis.setDisplay(null),C(i,c)))},Ot=(i,r,c,p,A)=>{const M=p.element,D=A.element,N=(p.mode??"unmount")==="hidden",{parent:U,nextSibling:tt}=p.parent?{parent:p.parent,nextSibling:p.nextSibling}:d(M),V=T(r,c),et={scrollOffset:V,from:{scroll:z(r)},to:{scroll:z(c)},get scrollingElement(){return W()||document.documentElement},get positionedParent(){return $()}};let x;if(N){x=M,x.style.top=`${-1*((V==null?void 0:V.y)??0)}px`;const H=y.get(D);H&&H.savedCss===null&&(H.savedCss=D.style.cssText)}else x=M,Wt(x,et);k(r)||L(r);const G=N?++P:0;N&&(E.set(D,G),E.set(M,G));const yt=Promise.resolve(x),mt=Promise.resolve(D),gt=[],Nt={from:yt,to:mt,context:et,createElement:((H,nt="div")=>{const B=document.createElement(nt);return B.setAttribute("data-ssgoi-id",H),gt.push(B),B})},kt=Promise.resolve(i.prepare?i.prepare(Nt):{});Ft({from:yt,to:mt,extras:kt}).then(({from:H,to:nt,extras:B})=>{!N&&U&&(tt&&U.contains(tt)?U.insertBefore(x,tt):U.appendChild(x));const st=i.animation({from:H,to:nt,context:et,...B}),it=st.onComplete;st.onComplete=()=>{it==null||it(),N?(dt(M,G),dt(D,G)):x.parentNode&&x.parentNode.removeChild(x);for(const ot of gt)ot.parentNode&&ot.parentNode.removeChild(ot)},a.attach(st)})},q=(i,r)=>{const c=g.isSwipeBack();l.trigger(i,r),l.get(r).then(p=>{if(r==="in"&&g.onPageEnter(),!p)return;if(c){r==="out"&&p.from&&!k(p.from)&&L(p.from),m=null,w=null;return}if(r!=="in")return;const{from:A,to:M}=s(p.from,p.to),D=Yt(A,M,S()),J=m,N=w;m=null,w=null,!(!D||!J||!N)&&Ot(D,p.from,p.to,J,N)})},Lt=(i,r)=>{const c=y.get(i);if(!c)return;const p=c.intent==="hidden";if(c.intent="hidden",c.savedCss===null&&(c.savedCss=i.style.cssText),c.vis.setDisplay(c.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",p)return;const A=d(i);m={element:i,parent:A.parent,nextSibling:A.nextSibling,mode:"hidden"};const M=i.getAttribute("data-ssgoi-transition")??r;q(M,"out")},_t=(i,r)=>{const c=y.get(i);if(!c||c.intent==="visible")return;c.intent="visible",C(i,c),c.savedCss!==null&&(i.style.cssText=c.savedCss,c.visibleDisplay?c.vis.setDisplay(c.visibleDisplay,!1):c.vis.setDisplay(null)),O(i,r),w={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling};const p=i.getAttribute("data-ssgoi-transition")??r;q(p,"in")},Dt=(i,r,c)=>{const p=y.get(i);if(p&&(p.vis.stop(),y.delete(i),E.delete(i),p.intent==="hidden")){(m==null?void 0:m.element)===i&&(m=null),(w==null?void 0:w.element)===i&&(w=null);return}const A=c??d(i);m={element:i,parent:A.parent,nextSibling:A.nextSibling,mode:"unmount"};const M=i.getAttribute("data-ssgoi-transition")??r;q(M,"out")},ft=new WeakSet,ht=(i,r)=>{if(ft.has(r))return;ft.add(r),f(r);const c=re(r,{onHide:()=>Lt(r,i),onShow:()=>_t(r,i)}),p={vis:c,savedCss:null,intent:c.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};y.set(r,p),c.isHidden||(C(r,p),O(r,i),w={element:r,parent:r.parentElement,nextSibling:r.nextElementSibling},q(i,"in")),ie(r,A=>Dt(r,i,A))},pt=new Map;return{register:ht,refFor:i=>{let r=pt.get(i);return r||(r=c=>{c&&ht(i,c)},pt.set(i,r)),r}}}const xt="data-ssgoi-root",ae=`[${xt}]`,at="data-ssgoi-transition",At=`[${at}]`,ue="[data-ssgoi-clone]";function de(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function fe(t){return t.nodeType===Node.ELEMENT_NODE}function he(t){return t instanceof HTMLElement}function pe(t,n){if(!de())return()=>{};t.setAttribute(xt,"");const e=l=>l.closest(ae)===t,s=l=>{if(!he(l)||!e(l)||l.closest(ue))return;const u=l.getAttribute(at);u!==null&&n.register(u,l)},o=l=>{if(fe(l)){l.matches(At)&&s(l);for(const u of l.querySelectorAll(At))s(u)}},a=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){s(u.target);continue}for(const g of u.addedNodes)o(g)}});return a.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[at]}),o(t),()=>a.disconnect()}exports.Animation=Q.Animation;exports.MultiAnimation=Q.MultiAnimation;exports.WebAnimation=Q.WebAnimation;exports.HostAnimation=Mt;exports.createSggoiTransitionContext=le;exports.observeSsgoiTransitions=pe;
|
package/dist/internal.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Nt = Object.defineProperty;
|
|
2
2
|
var kt = (t, n, e) => n in t ? Nt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
3
|
var F = (t, n, e) => kt(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
-
import { A as It } from "./multi-animation-
|
|
5
|
-
import { M as Ee, W as we } from "./multi-animation-
|
|
4
|
+
import { A as It } from "./multi-animation-1FueEz2Q.js";
|
|
5
|
+
import { M as Ee, W as we } from "./multi-animation-1FueEz2Q.js";
|
|
6
6
|
class Ht extends It {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
@@ -1,45 +1,62 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var y = (n, r, t) => r in n ? g(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
|
|
3
|
+
var s = (n, r, t) => y(n, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
class m {
|
|
5
5
|
constructor() {
|
|
6
6
|
/** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
|
|
7
|
-
|
|
7
|
+
s(this, "_playbackRate", 1);
|
|
8
8
|
/** Fired every frame with the most recent value. Optional. */
|
|
9
|
-
|
|
9
|
+
s(this, "onUpdate");
|
|
10
10
|
/** Fired once when the animation settles. */
|
|
11
|
-
|
|
11
|
+
s(this, "onComplete");
|
|
12
12
|
}
|
|
13
13
|
get playbackRate() {
|
|
14
14
|
return this._playbackRate;
|
|
15
15
|
}
|
|
16
|
-
set playbackRate(
|
|
17
|
-
this._playbackRate =
|
|
16
|
+
set playbackRate(r) {
|
|
17
|
+
this._playbackRate = r;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const b = 0.01, C = 0.01, v = 0.05;
|
|
21
|
+
function w(n) {
|
|
22
|
+
return new Promise((r) => {
|
|
23
|
+
requestAnimationFrame(() => {
|
|
24
|
+
requestAnimationFrame(() => {
|
|
25
|
+
r();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const p = 1e3 / 60;
|
|
31
|
+
class k extends m {
|
|
22
32
|
constructor(t) {
|
|
23
33
|
super();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
s(this, "element");
|
|
35
|
+
s(this, "integrator");
|
|
36
|
+
s(this, "styleFn");
|
|
37
|
+
s(this, "lowerBound");
|
|
38
|
+
s(this, "upperBound");
|
|
39
|
+
s(this, "currentValue");
|
|
40
|
+
s(this, "currentVelocity", 0);
|
|
41
|
+
s(this, "frames", []);
|
|
42
|
+
s(this, "waapi", null);
|
|
43
|
+
s(this, "runId", 0);
|
|
44
|
+
s(this, "waitingForStart", !1);
|
|
45
|
+
s(this, "startReady", !1);
|
|
46
|
+
s(this, "pendingFirstFrame");
|
|
47
|
+
s(this, "running", !1);
|
|
48
|
+
s(this, "paused", !1);
|
|
49
|
+
s(this, "settled", !1);
|
|
50
|
+
s(this, "reversing", !1);
|
|
38
51
|
this.element = t.element, this.integrator = t.integrator, this.styleFn = t.style, this.lowerBound = t.lowerBound ?? 0, this.upperBound = t.upperBound ?? 1, this.currentValue = this.lowerBound, this.onUpdate = t.onUpdate, this.onComplete = t.onComplete;
|
|
39
52
|
}
|
|
40
53
|
play() {
|
|
41
54
|
if (this.reversing = !1, this.paused && this.waapi) {
|
|
42
|
-
this.paused = !1, this.running = !0, this.
|
|
55
|
+
if (this.paused = !1, this.running = !0, this.waitingForStart) {
|
|
56
|
+
this.startReady && this.playPreparedWaapi(this.waapi);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.waapi.play();
|
|
43
60
|
return;
|
|
44
61
|
}
|
|
45
62
|
this.runToward(this.upperBound);
|
|
@@ -109,12 +126,12 @@ class R extends d {
|
|
|
109
126
|
}
|
|
110
127
|
getTimeline() {
|
|
111
128
|
const t = this.frames.map((e) => {
|
|
112
|
-
const i = e.position,
|
|
129
|
+
const i = e.position, a = this.lowerBound + this.upperBound - i;
|
|
113
130
|
return {
|
|
114
131
|
time: e.time,
|
|
115
132
|
value: e.position,
|
|
116
133
|
velocity: e.velocity,
|
|
117
|
-
style: this.styleFn(i,
|
|
134
|
+
style: this.styleFn(i, a)
|
|
118
135
|
};
|
|
119
136
|
});
|
|
120
137
|
return [{ element: this.element, frames: t }];
|
|
@@ -125,60 +142,74 @@ class R extends d {
|
|
|
125
142
|
}
|
|
126
143
|
/* ───────────────────────────────────────────────────────── private */
|
|
127
144
|
runToward(t) {
|
|
128
|
-
var
|
|
129
|
-
if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames =
|
|
145
|
+
var u;
|
|
146
|
+
if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames = F(
|
|
130
147
|
this.integrator,
|
|
131
148
|
this.currentValue,
|
|
132
149
|
t,
|
|
133
150
|
this.currentVelocity
|
|
134
151
|
), this.frames.length === 0) {
|
|
135
|
-
this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (
|
|
152
|
+
this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (u = this.onComplete) == null || u.call(this);
|
|
136
153
|
return;
|
|
137
154
|
}
|
|
138
|
-
const e = this.frames.map((
|
|
139
|
-
const
|
|
140
|
-
return this.styleFn(
|
|
141
|
-
}), i = e[0]
|
|
142
|
-
if (i)
|
|
143
|
-
for (const o of Object.keys(i))
|
|
144
|
-
this.element.style[o] = "";
|
|
145
|
-
const s = this.frames[this.frames.length - 1], l = s.time;
|
|
146
|
-
this.waapi = this.element.animate(e, {
|
|
155
|
+
const e = this.frames.map((c) => {
|
|
156
|
+
const d = c.position, f = this.lowerBound + this.upperBound - d;
|
|
157
|
+
return this.styleFn(d, f);
|
|
158
|
+
}), i = e[0], a = this.frames[this.frames.length - 1], l = a.time, o = ++this.runId, h = this.element.animate(e, {
|
|
147
159
|
duration: l,
|
|
148
|
-
fill: "
|
|
160
|
+
fill: "both",
|
|
149
161
|
easing: "linear",
|
|
150
162
|
composite: "replace"
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
163
|
+
});
|
|
164
|
+
h.playbackRate = this.playbackRate, h.pause(), h.currentTime = 0, this.waapi = h, this.waitingForStart = !0, this.startReady = !1, this.pendingFirstFrame = i, this.running = !0, h.onfinish = () => {
|
|
165
|
+
var c;
|
|
166
|
+
!this.running || this.waapi !== h || (this.running = !1, this.settled = !0, this.currentValue = a.position, this.currentVelocity = 0, (c = this.onComplete) == null || c.call(this));
|
|
167
|
+
}, this.startWhenReady(h, o);
|
|
155
168
|
}
|
|
156
169
|
clearWaapi() {
|
|
157
170
|
var t;
|
|
158
|
-
(t = this.waapi) == null || t.cancel(), this.waapi = null;
|
|
171
|
+
this.runId++, (t = this.waapi) == null || t.cancel(), this.waapi = null, this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0;
|
|
159
172
|
}
|
|
160
173
|
captureLiveState() {
|
|
161
174
|
if (this.frames.length === 0) return;
|
|
162
|
-
const t =
|
|
175
|
+
const t = S(this.waapi);
|
|
176
|
+
if (t === null) return;
|
|
177
|
+
const { position: e, velocity: i } = R(this.frames, t);
|
|
163
178
|
this.currentValue = e, this.currentVelocity = i;
|
|
164
179
|
}
|
|
180
|
+
async startWhenReady(t, e) {
|
|
181
|
+
try {
|
|
182
|
+
await t.ready, typeof requestAnimationFrame < "u" && await w(this.element);
|
|
183
|
+
} catch {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.runId !== e || this.waapi !== t || (this.startReady = !0, !(!this.running || this.paused) && this.playPreparedWaapi(t));
|
|
187
|
+
}
|
|
188
|
+
playPreparedWaapi(t) {
|
|
189
|
+
if (!(this.waapi !== t || !this.waitingForStart || !this.startReady)) {
|
|
190
|
+
if (this.pendingFirstFrame)
|
|
191
|
+
for (const e of Object.keys(this.pendingFirstFrame))
|
|
192
|
+
this.element.style[e] = "";
|
|
193
|
+
this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0, t.play();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
165
196
|
applyStyleAt(t) {
|
|
166
197
|
const e = this.lowerBound + this.upperBound - t, i = this.styleFn(t, e);
|
|
167
|
-
for (const [
|
|
168
|
-
this.element.style[
|
|
198
|
+
for (const [a, l] of Object.entries(i))
|
|
199
|
+
this.element.style[a] = typeof l == "number" ? String(l) : l;
|
|
169
200
|
}
|
|
170
201
|
}
|
|
171
|
-
function
|
|
172
|
-
if (
|
|
202
|
+
function F(n, r, t, e) {
|
|
203
|
+
if (r === t && e === 0) return [];
|
|
173
204
|
const i = 600;
|
|
174
|
-
let
|
|
175
|
-
const
|
|
176
|
-
for (let
|
|
177
|
-
const u =
|
|
178
|
-
if (
|
|
179
|
-
if (l +=
|
|
180
|
-
|
|
181
|
-
time: (
|
|
205
|
+
let a = { position: r, velocity: e }, l = 0;
|
|
206
|
+
const o = [];
|
|
207
|
+
for (let h = 0; h < i; h++) {
|
|
208
|
+
const u = h * p;
|
|
209
|
+
if (o.push({ time: u, position: a.position, velocity: a.velocity }), a = n.step(a, t, p / 1e3), n.isSettled(a, t)) {
|
|
210
|
+
if (l += p / 1e3, l >= v) {
|
|
211
|
+
o.push({
|
|
212
|
+
time: (h + 1) * p,
|
|
182
213
|
position: t,
|
|
183
214
|
velocity: 0
|
|
184
215
|
});
|
|
@@ -187,35 +218,39 @@ function y(r, a, t, e) {
|
|
|
187
218
|
} else
|
|
188
219
|
l = 0;
|
|
189
220
|
}
|
|
190
|
-
return
|
|
221
|
+
return o;
|
|
191
222
|
}
|
|
192
|
-
function
|
|
193
|
-
if (
|
|
194
|
-
const t =
|
|
195
|
-
if (
|
|
223
|
+
function R(n, r) {
|
|
224
|
+
if (n.length === 0) return { position: 0, velocity: 0 };
|
|
225
|
+
const t = n[0], e = n[n.length - 1];
|
|
226
|
+
if (r <= 0)
|
|
196
227
|
return { position: t.position, velocity: t.velocity };
|
|
197
|
-
if (
|
|
228
|
+
if (r >= e.time)
|
|
198
229
|
return { position: e.position, velocity: e.velocity };
|
|
199
|
-
let i = 0,
|
|
200
|
-
for (; i <
|
|
201
|
-
const u = i +
|
|
202
|
-
|
|
230
|
+
let i = 0, a = n.length - 1;
|
|
231
|
+
for (; i < a - 1; ) {
|
|
232
|
+
const u = i + a >> 1;
|
|
233
|
+
n[u].time <= r ? i = u : a = u;
|
|
203
234
|
}
|
|
204
|
-
const l =
|
|
235
|
+
const l = n[i], o = n[a], h = (r - l.time) / (o.time - l.time);
|
|
205
236
|
return {
|
|
206
|
-
position: l.position + (
|
|
207
|
-
velocity: l.velocity + (
|
|
237
|
+
position: l.position + (o.position - l.position) * h,
|
|
238
|
+
velocity: l.velocity + (o.velocity - l.velocity) * h
|
|
208
239
|
};
|
|
209
240
|
}
|
|
210
|
-
|
|
241
|
+
function S(n) {
|
|
242
|
+
const r = n == null ? void 0 : n.currentTime;
|
|
243
|
+
return typeof r == "number" ? r : null;
|
|
244
|
+
}
|
|
245
|
+
class A extends m {
|
|
211
246
|
constructor(t, e = {}) {
|
|
212
247
|
super();
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((i,
|
|
248
|
+
s(this, "children");
|
|
249
|
+
s(this, "startAt");
|
|
250
|
+
s(this, "pendingComplete", 0);
|
|
251
|
+
s(this, "running", !1);
|
|
252
|
+
s(this, "pendingStartTimers", []);
|
|
253
|
+
this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((i, a) => a === 0 ? 0 : 1) : this.startAt = e.startAt ?? [];
|
|
219
254
|
}
|
|
220
255
|
play() {
|
|
221
256
|
this.startRun("play");
|
|
@@ -290,21 +325,21 @@ class b extends d {
|
|
|
290
325
|
this.children[t][e]();
|
|
291
326
|
const i = t + 1;
|
|
292
327
|
if (i >= this.children.length) return;
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
328
|
+
const a = this.startAt[i];
|
|
329
|
+
if (a === void 0 || a <= 0) {
|
|
295
330
|
this.scheduleStart(i, e);
|
|
296
331
|
return;
|
|
297
332
|
}
|
|
298
|
-
const l = this.children[t].findTimeForProgress(
|
|
333
|
+
const l = this.children[t].findTimeForProgress(a);
|
|
299
334
|
if (l === null || l <= 0) {
|
|
300
335
|
this.scheduleStart(i, e);
|
|
301
336
|
return;
|
|
302
337
|
}
|
|
303
|
-
const
|
|
338
|
+
const o = Math.abs(this.playbackRate) || 1, h = l / o, u = setTimeout(() => {
|
|
304
339
|
this.pendingStartTimers = this.pendingStartTimers.filter(
|
|
305
|
-
(
|
|
340
|
+
(c) => c !== u
|
|
306
341
|
), this.running && this.scheduleStart(i, e);
|
|
307
|
-
},
|
|
342
|
+
}, h);
|
|
308
343
|
this.pendingStartTimers.push(u);
|
|
309
344
|
}
|
|
310
345
|
clearPendingStartTimers() {
|
|
@@ -323,10 +358,10 @@ class b extends d {
|
|
|
323
358
|
}
|
|
324
359
|
}
|
|
325
360
|
export {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
361
|
+
m as A,
|
|
362
|
+
A as M,
|
|
363
|
+
b as P,
|
|
364
|
+
v as S,
|
|
365
|
+
C as V,
|
|
366
|
+
k as W
|
|
332
367
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var y=Object.defineProperty;var S=(n,r,t)=>r in n?y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[r]=t;var s=(n,r,t)=>S(n,typeof r!="symbol"?r+"":r,t);class d{constructor(){s(this,"_playbackRate",1);s(this,"onUpdate");s(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(r){this._playbackRate=r}}const v=.01,R=.01,f=.05;function T(n){return new Promise(r=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})})}const p=1e3/60;class w extends d{constructor(t){super();s(this,"element");s(this,"integrator");s(this,"styleFn");s(this,"lowerBound");s(this,"upperBound");s(this,"currentValue");s(this,"currentVelocity",0);s(this,"frames",[]);s(this,"waapi",null);s(this,"runId",0);s(this,"waitingForStart",!1);s(this,"startReady",!1);s(this,"pendingFirstFrame");s(this,"running",!1);s(this,"paused",!1);s(this,"settled",!1);s(this,"reversing",!1);this.element=t.element,this.integrator=t.integrator,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete}play(){if(this.reversing=!1,this.paused&&this.waapi){if(this.paused=!1,this.running=!0,this.waitingForStart){this.startReady&&this.playPreparedWaapi(this.waapi);return}this.waapi.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),this.running=!1,this.paused=!0)}complete(){var t;this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,(t=this.onComplete)==null||t.call(this)}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=>{const i=e.position,a=this.lowerBound+this.upperBound-i;return{time:e.time,value:e.position,velocity:e.velocity,style:this.styleFn(i,a)}});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)}runToward(t){var u;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=F(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(u=this.onComplete)==null||u.call(this);return}const e=this.frames.map(c=>{const m=c.position,g=this.lowerBound+this.upperBound-m;return this.styleFn(m,g)}),i=e[0],a=this.frames[this.frames.length-1],l=a.time,o=++this.runId,h=this.element.animate(e,{duration:l,fill:"both",easing:"linear",composite:"replace"});h.playbackRate=this.playbackRate,h.pause(),h.currentTime=0,this.waapi=h,this.waitingForStart=!0,this.startReady=!1,this.pendingFirstFrame=i,this.running=!0,h.onfinish=()=>{var c;!this.running||this.waapi!==h||(this.running=!1,this.settled=!0,this.currentValue=a.position,this.currentVelocity=0,(c=this.onComplete)==null||c.call(this))},this.startWhenReady(h,o)}clearWaapi(){var t;this.runId++,(t=this.waapi)==null||t.cancel(),this.waapi=null,this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0}captureLiveState(){if(this.frames.length===0)return;const t=A(this.waapi);if(t===null)return;const{position:e,velocity:i}=b(this.frames,t);this.currentValue=e,this.currentVelocity=i}async startWhenReady(t,e){try{await t.ready,typeof requestAnimationFrame<"u"&&await T(this.element)}catch{return}this.runId!==e||this.waapi!==t||(this.startReady=!0,!(!this.running||this.paused)&&this.playPreparedWaapi(t))}playPreparedWaapi(t){if(!(this.waapi!==t||!this.waitingForStart||!this.startReady)){if(this.pendingFirstFrame)for(const e of Object.keys(this.pendingFirstFrame))this.element.style[e]="";this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0,t.play()}}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[a,l]of Object.entries(i))this.element.style[a]=typeof l=="number"?String(l):l}}function F(n,r,t,e){if(r===t&&e===0)return[];const i=600;let a={position:r,velocity:e},l=0;const o=[];for(let h=0;h<i;h++){const u=h*p;if(o.push({time:u,position:a.position,velocity:a.velocity}),a=n.step(a,t,p/1e3),n.isSettled(a,t)){if(l+=p/1e3,l>=f){o.push({time:(h+1)*p,position:t,velocity:0});break}}else l=0}return o}function b(n,r){if(n.length===0)return{position:0,velocity:0};const t=n[0],e=n[n.length-1];if(r<=0)return{position:t.position,velocity:t.velocity};if(r>=e.time)return{position:e.position,velocity:e.velocity};let i=0,a=n.length-1;for(;i<a-1;){const u=i+a>>1;n[u].time<=r?i=u:a=u}const l=n[i],o=n[a],h=(r-l.time)/(o.time-l.time);return{position:l.position+(o.position-l.position)*h,velocity:l.velocity+(o.velocity-l.velocity)*h}}function A(n){const r=n==null?void 0:n.currentTime;return typeof r=="number"?r:null}class C extends d{constructor(t,e={}){super();s(this,"children");s(this,"startAt");s(this,"pendingComplete",0);s(this,"running",!1);s(this,"pendingStartTimers",[]);this.children=t,(e.mode??"parallel")==="sequence"?this.startAt=t.map((i,a)=>a===0?0:1):this.startAt=e.startAt??[]}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.running=!1,this.clearPendingStartTimers();for(const t of this.children)t.pause()}complete(){var t;this.running=!1,this.clearPendingStartTimers();for(const e of this.children)e.complete();(t=this.onComplete)==null||t.call(this)}get progress(){if(this.children.length===0)return 0;let t=0;for(const e of this.children)t+=e.progress;return t/this.children.length}getPose(){return this.children.flatMap(t=>t.getPose())}getTimeline(){return this.children.flatMap(t=>t.getTimeline())}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.children.every(t=>t.isComplete)}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){if(this.running&&this.pause(),this.running=!0,this.pendingComplete=this.children.length,this.pendingComplete===0){this.handleFinished();return}for(const e of this.children){const i=e.onComplete;e.onComplete=()=>{i==null||i(),this.handleChildComplete()}}this.scheduleStart(0,t)}scheduleStart(t,e){if(!this.running||t>=this.children.length)return;this.children[t][e]();const i=t+1;if(i>=this.children.length)return;const a=this.startAt[i];if(a===void 0||a<=0){this.scheduleStart(i,e);return}const l=this.children[t].findTimeForProgress(a);if(l===null||l<=0){this.scheduleStart(i,e);return}const o=Math.abs(this.playbackRate)||1,h=l/o,u=setTimeout(()=>{this.pendingStartTimers=this.pendingStartTimers.filter(c=>c!==u),this.running&&this.scheduleStart(i,e)},h);this.pendingStartTimers.push(u)}clearPendingStartTimers(){for(const t of this.pendingStartTimers)clearTimeout(t);this.pendingStartTimers=[]}handleChildComplete(){this.pendingComplete--,this.pendingComplete<=0&&this.handleFinished()}handleFinished(){var t;this.running=!1,this.clearPendingStartTimers(),(t=this.onComplete)==null||t.call(this)}findTimeForProgress(t){return null}}exports.Animation=d;exports.MultiAnimation=C;exports.POSITION_THRESHOLD=v;exports.SETTLE_THRESHOLD=f;exports.VELOCITY_THRESHOLD=R;exports.WebAnimation=w;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var g=(r,a,t)=>a in r?f(r,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[a]=t;var n=(r,a,t)=>g(r,typeof a!="symbol"?a+"":a,t);class d{constructor(){n(this,"_playbackRate",1);n(this,"onUpdate");n(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(a){this._playbackRate=a}}const y=.01,T=.01,m=.05,c=1e3/60;class v extends d{constructor(t){super();n(this,"element");n(this,"integrator");n(this,"styleFn");n(this,"lowerBound");n(this,"upperBound");n(this,"currentValue");n(this,"currentVelocity",0);n(this,"frames",[]);n(this,"waapi",null);n(this,"startTime",0);n(this,"running",!1);n(this,"paused",!1);n(this,"settled",!1);n(this,"reversing",!1);this.element=t.element,this.integrator=t.integrator,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete}play(){if(this.reversing=!1,this.paused&&this.waapi){this.paused=!1,this.running=!0,this.waapi.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),this.running=!1,this.paused=!0)}complete(){var t;this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,(t=this.onComplete)==null||t.call(this)}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=>{const i=e.position,s=this.lowerBound+this.upperBound-i;return{time:e.time,value:e.position,velocity:e.velocity,style:this.styleFn(i,s)}});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)}runToward(t){var h;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=S(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(h=this.onComplete)==null||h.call(this);return}const e=this.frames.map(o=>{const u=o.position,p=this.lowerBound+this.upperBound-u;return this.styleFn(u,p)}),i=e[0];if(i)for(const o of Object.keys(i))this.element.style[o]="";const s=this.frames[this.frames.length-1],l=s.time;this.waapi=this.element.animate(e,{duration:l,fill:"forwards",easing:"linear",composite:"replace"}),this.waapi.playbackRate=this.playbackRate,this.startTime=performance.now(),this.running=!0,this.waapi.onfinish=()=>{var o;this.running&&(this.running=!1,this.settled=!0,this.currentValue=s.position,this.currentVelocity=0,(o=this.onComplete)==null||o.call(this))}}clearWaapi(){var t;(t=this.waapi)==null||t.cancel(),this.waapi=null}captureLiveState(){if(this.frames.length===0)return;const t=performance.now()-this.startTime,{position:e,velocity:i}=R(this.frames,t);this.currentValue=e,this.currentVelocity=i}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[s,l]of Object.entries(i))this.element.style[s]=typeof l=="number"?String(l):l}}function S(r,a,t,e){if(a===t&&e===0)return[];const i=600;let s={position:a,velocity:e},l=0;const h=[];for(let o=0;o<i;o++){const u=o*c;if(h.push({time:u,position:s.position,velocity:s.velocity}),s=r.step(s,t,c/1e3),r.isSettled(s,t)){if(l+=c/1e3,l>=m){h.push({time:(o+1)*c,position:t,velocity:0});break}}else l=0}return h}function R(r,a){if(r.length===0)return{position:0,velocity:0};const t=r[0],e=r[r.length-1];if(a<=0)return{position:t.position,velocity:t.velocity};if(a>=e.time)return{position:e.position,velocity:e.velocity};let i=0,s=r.length-1;for(;i<s-1;){const u=i+s>>1;r[u].time<=a?i=u:s=u}const l=r[i],h=r[s],o=(a-l.time)/(h.time-l.time);return{position:l.position+(h.position-l.position)*o,velocity:l.velocity+(h.velocity-l.velocity)*o}}class w extends d{constructor(t,e={}){super();n(this,"children");n(this,"startAt");n(this,"pendingComplete",0);n(this,"running",!1);n(this,"pendingStartTimers",[]);this.children=t,(e.mode??"parallel")==="sequence"?this.startAt=t.map((i,s)=>s===0?0:1):this.startAt=e.startAt??[]}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.running=!1,this.clearPendingStartTimers();for(const t of this.children)t.pause()}complete(){var t;this.running=!1,this.clearPendingStartTimers();for(const e of this.children)e.complete();(t=this.onComplete)==null||t.call(this)}get progress(){if(this.children.length===0)return 0;let t=0;for(const e of this.children)t+=e.progress;return t/this.children.length}getPose(){return this.children.flatMap(t=>t.getPose())}getTimeline(){return this.children.flatMap(t=>t.getTimeline())}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.children.every(t=>t.isComplete)}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){if(this.running&&this.pause(),this.running=!0,this.pendingComplete=this.children.length,this.pendingComplete===0){this.handleFinished();return}for(const e of this.children){const i=e.onComplete;e.onComplete=()=>{i==null||i(),this.handleChildComplete()}}this.scheduleStart(0,t)}scheduleStart(t,e){if(!this.running||t>=this.children.length)return;this.children[t][e]();const i=t+1;if(i>=this.children.length)return;const s=this.startAt[i];if(s===void 0||s<=0){this.scheduleStart(i,e);return}const l=this.children[t].findTimeForProgress(s);if(l===null||l<=0){this.scheduleStart(i,e);return}const h=Math.abs(this.playbackRate)||1,o=l/h,u=setTimeout(()=>{this.pendingStartTimers=this.pendingStartTimers.filter(p=>p!==u),this.running&&this.scheduleStart(i,e)},o);this.pendingStartTimers.push(u)}clearPendingStartTimers(){for(const t of this.pendingStartTimers)clearTimeout(t);this.pendingStartTimers=[]}handleChildComplete(){this.pendingComplete--,this.pendingComplete<=0&&this.handleFinished()}handleFinished(){var t;this.running=!1,this.clearPendingStartTimers(),(t=this.onComplete)==null||t.call(this)}findTimeForProgress(t){return null}}exports.Animation=d;exports.MultiAnimation=w;exports.POSITION_THRESHOLD=y;exports.SETTLE_THRESHOLD=m;exports.VELOCITY_THRESHOLD=T;exports.WebAnimation=v;
|