@ssgoi/core 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../src/lib/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAGb,MAAM,SAAS,CAAC;AA6IjB;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,GACnB,YAAY,CAwId"}
1
+ {"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../src/lib/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAGb,MAAM,SAAS,CAAC;AAyJjB;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,GACnB,YAAY,CAwId"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var N=Object.defineProperty;var D=(n,t,o)=>t in n?N(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var y=(n,t,o)=>D(n,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion");class C{constructor(t){y(this,"options");y(this,"currentValue");y(this,"velocity");y(this,"isAnimating",!1);y(this,"controls",null);y(this,"animationMap",null);y(this,"activeAnimations",new Set);y(this,"completedAnimations",new Set);y(this,"updatedProperties",new Set);y(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const o=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(o);return}let e=this.currentValue,i=performance.now();const m={from:this.currentValue,to:o,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(m.velocity=this.velocity*1e3),this.controls=R.animate({...m,onUpdate:l=>{const p=performance.now(),r=(p-i)/1e3;if(r>0){if(typeof l=="number"&&typeof e=="number"){const u=(l-e)/r;this.velocity=u/1e3}else if(typeof l=="object"&&l!==null){const u={};Object.keys(l).forEach(f=>{const c=l[f],a=e[f];if(typeof c=="number"&&typeof a=="number"){const h=(c-a)/r;u[f]=h/1e3}}),this.velocity=u}e=l,i=p}this.currentValue=l,this.options.onUpdate(l)},onComplete:()=>{this.currentValue=o,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(l=>{this.velocity[l]=0}):this.velocity=0,this.options.onComplete()}})});y(this,"animateObject",t=>{const o=this.currentValue,e=Object.keys(o);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const i={...o},m={};let l=!1;const p=()=>{const r=e.filter(f=>!this.completedAnimations.has(f));if(r.every(f=>this.updatedProperties.has(f))&&r.length>0){if(typeof this.velocity=="object"&&this.velocity){const f=performance.now();Object.keys(i).forEach(c=>{if(m[c]){const a=(f-m[c])/1e3,h=this.currentValue[c],s=i[c];typeof h=="number"&&typeof s=="number"&&a>0&&(this.velocity[c]=(s-h)/a/1e3)}m[c]=f})}this.currentValue={...i},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!l&&this.options.onStart&&(l=!0,this.options.onStart())}};e.forEach(r=>{this.activeAnimations.add(r);const u={from:o[r],to:t[r],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&r in this.velocity&&(u.velocity=this.velocity[r]*1e3);const f=R.animate({...u,onUpdate:c=>{i[r]=c,this.updatedProperties.add(r),p()},onComplete:()=>{this.completedAnimations.add(r),this.updatedProperties.delete(r),this.completedAnimations.size===e.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(c=>{this.velocity[c]=0}),this.options.onComplete())}});this.animationMap.set(r,f)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const o={};Object.keys(this.options.from).forEach(e=>{o[e]=0}),this.velocity=o}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const o=this.shouldReverse();this.stop(),this.animate(!o)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const o=this.shouldReverse();this.stop(),this.animate(!o)}}static fromState(t,o){const e=new C(o);return e.setValue(t.position),e.setVelocity(t.velocity),e}}const E=Symbol.for("TRANSITION_STRATEGY"),x=n=>({runIn:async t=>{const{currentAnimation:o}=n;if(o&&o.direction==="out"){const l=o.animator.getCurrentState();if(o.animator.stop(),t.out){const p=await t.out,{from:r=1,to:u=0}=p;return{config:p,state:l,from:r,to:u,direction:"backward"}}}const e=await t.in;if(!e)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:i=0,to:m=1}=e;return{config:e,state:{position:i,velocity:0},from:i,to:m,direction:"forward"}},runOut:async t=>{const{currentAnimation:o}=n;if(o&&o.direction==="in"){const l=o.animator.getCurrentState();if(o.animator.stop(),t.in){const p=await t.in,{from:r=0,to:u=1}=p;return{config:p,state:{position:l.position,velocity:l.velocity},from:r,to:u,direction:"backward"}}}const e=await t.out;if(!e)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:i=1,to:m=0}=e;return{config:e,state:{position:i,velocity:0},from:i,to:m,direction:"forward"}}}),U=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:o=0,to:e=1}=t;return{config:t,state:{position:o,velocity:0},from:o,to:e,direction:"forward"}},runOut:async n=>{const t=await n.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:o=1,to:e=0}=t;return{config:t,state:{position:o,velocity:0},from:o,to:e,direction:"forward"}}});function k(n,t){var f;let o=null,e=null,i=null,m=null;const l={get currentAnimation(){return o}},p=((f=t==null?void 0:t.strategy)==null?void 0:f.call(t,l))||x(l),r=async c=>{var w,S;e&&(e.remove(),e=null);const a=n(),h={in:a.in&&Promise.resolve(a.in(c)),out:a.out&&Promise.resolve(a.out(c))},s=await p.runIn(h);if(!s.config)return;(S=(w=s.config).prepare)==null||S.call(w,c),s.config.wait&&await s.config.wait();const g=C.fromState(s.state,{from:s.from,to:s.to,spring:s.config.spring,onStart:s.config.onStart,onUpdate:s.config.tick,onComplete:()=>{var v,d;o=null,(d=(v=s.config)==null?void 0:v.onEnd)==null||d.call(v)}});o={animator:g,direction:"in"},s.direction==="forward"?g.forward():g.backward()},u=async c=>{var S,v;e=c;const a=n(),h={in:a.in&&Promise.resolve(a.in(c)),out:a.out&&Promise.resolve(a.out(c))},s=await p.runOut(h);if(!s.config)return;(v=(S=s.config).prepare)==null||v.call(S,c),w(),s.config.wait&&await s.config.wait();const g=C.fromState(s.state,{from:s.from,to:s.to,spring:s.config.spring,onStart:s.config.onStart,onUpdate:s.config.tick,onComplete:()=>{var d,V,P;(V=(d=s.config)==null?void 0:d.onEnd)==null||V.call(d),e&&(e.remove(),e=null),o=null,(P=t==null?void 0:t.onCleanupEnd)==null||P.call(t)}});o={animator:g,direction:"out"},s.direction==="forward"?g.forward():g.backward();function w(){!i||!e||(m&&i.contains(m)?i.insertBefore(e,m):i.appendChild(e))}};return c=>{if(c)return i=c.parentElement,m=c.nextElementSibling,r(c),()=>{const a=c.cloneNode(!0);u(a)}}}const K=3,$=n=>{if(!n)return null;const t=n.split(`
2
- `).map(o=>o.trim());for(let o=K;o<Math.min(t.length,6);o++){const e=t[o],i=e==null?void 0:e.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!i)continue;const m=i[1]??"",l=i[2]??"0",p=i[3]??"0";return{file:m.split(/[\\/]/).pop()||m,line:l,column:p}}return null},A=new Map,T=new Map;function F(n,t,o){A.set(n,t);let e=T.get(n);return e||(e=k(()=>{const i=A.get(n);return i||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:o,onCleanupEnd:()=>_(n)}),T.set(n,e),e)}function _(n){A.delete(n),T.delete(n)}function I(){const n=$(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const O=globalThis.FinalizationRegistry,j=O?new O(n=>{try{_(n)}catch{}}):void 0;function W(n){const t=n.key??I();if(n.ref&&j)try{j.register(n.ref,t)}catch{}return F(t,{in:n.in,out:n.out},n[E])}const L=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const o=window.getComputedStyle(t),e=o.overflow+o.overflowY+o.overflowX;if(e.includes("auto")||e.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},M=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const o=window.getComputedStyle(t).position;if(o==="relative"||o==="absolute"||o==="fixed"||o==="sticky")return t;t=t.parentElement}return document.body};function Y(n){const t=n.filter(o=>o.symmetric).map(o=>({from:o.to,to:o.from,transition:o.transition}));return[...n,...t]}function z(){let n=null;const t=new Map;let o=null;const e=()=>{n&&o&&t.set(o,{x:n.scrollLeft,y:n.scrollTop})};return{startScrollTracking:(r,u)=>{n||(n=L(r),(n===document.documentElement?window:n).addEventListener("scroll",e,{passive:!0})),o=u},calculateScrollOffset:(r,u)=>{const f=r&&t.has(r)?t.get(r):{x:0,y:0},c=u&&t.has(u)?t.get(u):{x:0,y:0};return{x:-c.x+f.x,y:-c.y+f.y}},getScrollContainer:()=>n,getScrollPosition:r=>r&&t.has(r)?t.get(r):{x:0,y:0}}}function G(n){const{transitions:t=[],defaultTransition:o,middleware:e=(a,h)=>({from:a,to:h})}=n;let i=null;const m=Y(t),{startScrollTracking:l,calculateScrollOffset:p,getScrollContainer:r,getScrollPosition:u}=z();function f(){if(i!=null&&i.from&&(i!=null&&i.to)){const{from:a,to:h}=e(i.from,i.to),g=H(a,h,m)||o,w=p(i.from,i.to),S={scrollOffset:w,scroll:u(i.from),get scrollingElement(){return r()||document.documentElement},get positionedParent(){const d=r();return d?M(d):document.body}},v={scrollOffset:w,scroll:u(i.to),get scrollingElement(){return r()||document.documentElement},get positionedParent(){const d=r();return d?M(d):document.body}};g&&(g.out&&i.outResolve&&i.outResolve(d=>g.out(d,S)),g.in&&i.inResolve&&i.inResolve(d=>g.in(d,v))),i=null}}const c=async(a,h)=>h==="in"&&(!i||!i.from)?()=>({}):(i||(i={}),h==="out"?(i.from=a,new Promise(s=>{i.outResolve=s,f()})):(i.to=a,new Promise(s=>{i.inResolve=s,f()})));return a=>({key:a,in:async h=>(l(h,a),(await c(a,"in"))(h)),out:async h=>(await c(a,"out"))(h),[E]:U})}function H(n,t,o){for(const e of o)if(b(n,e.from)&&b(t,e.to))return e.transition;for(const e of o)if((e.from==="*"||b(n,e.from))&&(e.to==="*"||b(t,e.to)))return e.transition;return null}function b(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const o=t.slice(0,-2);return n===o||n.startsWith(o+"/")}return n===t}exports.TRANSITION_STRATEGY=E;exports.createDefaultStrategy=x;exports.createPageTransitionStrategy=U;exports.createSggoiTransitionContext=G;exports.generateAutoKey=I;exports.transition=W;
1
+ "use strict";var I=Object.defineProperty;var N=(o,t,n)=>t in o?I(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var g=(o,t,n)=>N(o,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion");class E{constructor(t){g(this,"options");g(this,"currentValue");g(this,"velocity");g(this,"isAnimating",!1);g(this,"controls",null);g(this,"animationMap",null);g(this,"activeAnimations",new Set);g(this,"completedAnimations",new Set);g(this,"updatedProperties",new Set);g(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const n=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(n);return}let e=this.currentValue,i=performance.now();const f={from:this.currentValue,to:n,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(f.velocity=this.velocity*1e3),this.controls=R.animate({...f,onUpdate:l=>{const h=performance.now(),a=(h-i)/1e3;if(a>0){if(typeof l=="number"&&typeof e=="number"){const p=(l-e)/a;this.velocity=p/1e3}else if(typeof l=="object"&&l!==null){const p={};Object.keys(l).forEach(c=>{const s=l[c],u=e[c];if(typeof s=="number"&&typeof u=="number"){const d=(s-u)/a;p[c]=d/1e3}}),this.velocity=p}e=l,i=h}this.currentValue=l,this.options.onUpdate(l)},onComplete:()=>{this.currentValue=n,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(l=>{this.velocity[l]=0}):this.velocity=0,this.options.onComplete()}})});g(this,"animateObject",t=>{const n=this.currentValue,e=Object.keys(n);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const i={...n},f={};let l=!1;const h=()=>{const a=e.filter(c=>!this.completedAnimations.has(c));if(a.every(c=>this.updatedProperties.has(c))&&a.length>0){if(typeof this.velocity=="object"&&this.velocity){const c=performance.now();Object.keys(i).forEach(s=>{if(f[s]){const u=(c-f[s])/1e3,d=this.currentValue[s],r=i[s];typeof d=="number"&&typeof r=="number"&&u>0&&(this.velocity[s]=(r-d)/u/1e3)}f[s]=c})}this.currentValue={...i},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!l&&this.options.onStart&&(l=!0,this.options.onStart())}};e.forEach(a=>{this.activeAnimations.add(a);const p={from:n[a],to:t[a],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&a in this.velocity&&(p.velocity=this.velocity[a]*1e3);const c=R.animate({...p,onUpdate:s=>{i[a]=s,this.updatedProperties.add(a),h()},onComplete:()=>{this.completedAnimations.add(a),this.updatedProperties.delete(a),this.completedAnimations.size===e.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(s=>{this.velocity[s]=0}),this.options.onComplete())}});this.animationMap.set(a,c)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const n={};Object.keys(this.options.from).forEach(e=>{n[e]=0}),this.velocity=n}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const n=this.shouldReverse();this.stop(),this.animate(!n)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const n=this.shouldReverse();this.stop(),this.animate(!n)}}static fromState(t,n){const e=new E(n);return e.setValue(t.position),e.setVelocity(t.velocity),e}}const V=Symbol.for("TRANSITION_STRATEGY"),j=o=>({runIn:async t=>{const{currentAnimation:n}=o;if(n&&n.direction==="out"){const l=n.animator.getCurrentState();if(n.animator.stop(),t.out){const h=await t.out,{from:a=1,to:p=0}=h;return{config:h,state:l,from:a,to:p,direction:"backward"}}}const e=await t.in;if(!e)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:i=0,to:f=1}=e;return{config:e,state:{position:i,velocity:0},from:i,to:f,direction:"forward"}},runOut:async t=>{const{currentAnimation:n}=o;if(n&&n.direction==="in"){const l=n.animator.getCurrentState();if(n.animator.stop(),t.in){const h=await t.in,{from:a=0,to:p=1}=h;return{config:h,state:{position:l.position,velocity:l.velocity},from:a,to:p,direction:"backward"}}}const e=await t.out;if(!e)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:i=1,to:f=0}=e;return{config:e,state:{position:i,velocity:0},from:i,to:f,direction:"forward"}}}),M=()=>({runIn:async o=>{const t=await o.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:n=0,to:e=1}=t;return{config:t,state:{position:n,velocity:0},from:n,to:e,direction:"forward"}},runOut:async o=>{const t=await o.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:n=1,to:e=0}=t;return{config:t,state:{position:n,velocity:0},from:n,to:e,direction:"forward"}}});function D(o,t){var c;let n=null,e=null,i=null,f=null;const l={get currentAnimation(){return n}},h=((c=t==null?void 0:t.strategy)==null?void 0:c.call(t,l))||j(l),a=async s=>{var y,v;e&&(e.remove(),e=null);const u=o(),d={in:u.in&&Promise.resolve(u.in(s)),out:u.out&&Promise.resolve(u.out(s))},r=await h.runIn(d);if(!r.config)return;(v=(y=r.config).prepare)==null||v.call(y,s),r.config.wait&&await r.config.wait();const m=E.fromState(r.state,{from:r.from,to:r.to,spring:r.config.spring,onStart:r.config.onStart,onUpdate:r.config.tick,onComplete:()=>{var w,S;n=null,(S=(w=r.config)==null?void 0:w.onEnd)==null||S.call(w)}});n={animator:m,direction:"in"},r.direction==="forward"?m.forward():m.backward()},p=async s=>{var v,w;e=s;const u=o(),d={in:u.in&&Promise.resolve(u.in(s)),out:u.out&&Promise.resolve(u.out(s))},r=await h.runOut(d);if(!r.config)return;(w=(v=r.config).prepare)==null||w.call(v,s),y(),r.config.wait&&await r.config.wait();const m=E.fromState(r.state,{from:r.from,to:r.to,spring:r.config.spring,onStart:r.config.onStart,onUpdate:r.config.tick,onComplete:()=>{var S,C,b;(C=(S=r.config)==null?void 0:S.onEnd)==null||C.call(S),e&&(e.remove(),e=null),n=null,(b=t==null?void 0:t.onCleanupEnd)==null||b.call(t)}});n={animator:m,direction:"out"},r.direction==="forward"?m.forward():m.backward();function y(){!i||!e||(f&&i.contains(f)?i.insertBefore(e,f):i.appendChild(e))}};return s=>{if(s)return i=s.parentElement,f=s.nextElementSibling,a(s),()=>{const u=s.cloneNode(!0);p(u)}}}const z=3,K=o=>{if(!o)return null;const t=o.split(`
2
+ `).map(n=>n.trim());for(let n=z;n<Math.min(t.length,6);n++){const e=t[n],i=e==null?void 0:e.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!i)continue;const f=i[1]??"",l=i[2]??"0",h=i[3]??"0";return{file:f.split(/[\\/]/).pop()||f,line:l,column:h}}return null},T=new Map,P=new Map;function $(o,t,n){T.set(o,t);let e=P.get(o);return e||(e=D(()=>{const i=T.get(o);return i||(console.warn(`Transition "${String(o)}" not found`),{})},{strategy:n,onCleanupEnd:()=>U(o)}),P.set(o,e),e)}function U(o){T.delete(o),P.delete(o)}function _(){const o=K(new Error().stack);return o?`auto_${o.file}_${o.line}_${o.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const O=globalThis.FinalizationRegistry,x=O?new O(o=>{try{U(o)}catch{}}):void 0;function F(o){const t=o.key??_();if(o.ref&&x)try{x.register(o.ref,t)}catch{}return $(t,{in:o.in,out:o.out},o[V])}const W=o=>{let t=o.parentElement;for(;t&&t!==document.body;){const n=window.getComputedStyle(t),e=n.overflow+n.overflowY+n.overflowX;if(e.includes("auto")||e.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},k=o=>{let t=o.parentElement;for(;t&&t!==document.body;){const n=window.getComputedStyle(t).position;if(n==="relative"||n==="absolute"||n==="fixed"||n==="sticky")return t;t=t.parentElement}return document.body};function L(o){const t=o.filter(n=>n.symmetric).map(n=>({from:n.to,to:n.from,transition:n.transition}));return[...o,...t]}function Y(){let o=null,t=null;const n=new Map;let e=null;const i=()=>{o&&e&&n.set(e,{x:o.scrollLeft,y:o.scrollTop})};return{initializeContext:(c,s)=>{t=c,o||(o=W(c),(o===document.documentElement?window:o).addEventListener("scroll",i,{passive:!0})),e=s},calculateScrollOffset:(c,s)=>{const u=c&&n.has(c)?n.get(c):{x:0,y:0},d=s&&n.has(s)?n.get(s):{x:0,y:0};return{x:-d.x+u.x,y:-d.y+u.y}},getScrollContainer:()=>o,getPositionedParentElement:()=>t?k(t):document.body,getScrollPosition:c=>c&&n.has(c)?n.get(c):{x:0,y:0}}}function G(o){const{transitions:t=[],defaultTransition:n,middleware:e=(r,m)=>({from:r,to:m})}=o;let i=null;const f=L(t),{initializeContext:l,calculateScrollOffset:h,getScrollContainer:a,getPositionedParentElement:p,getScrollPosition:c}=Y();function s(){if(i!=null&&i.from&&(i!=null&&i.to)){const{from:r,to:m}=e(i.from,i.to),v=H(r,m,f)||n,w=h(i.from,i.to),S={scrollOffset:w,scroll:c(i.from),get scrollingElement(){return a()||document.documentElement},get positionedParent(){return p()}},C={scrollOffset:w,get scroll(){return i?c(i.to):{x:0,y:0}},get scrollingElement(){return a()||document.documentElement},get positionedParent(){return p()}};v&&(v.out&&i.outResolve&&i.outResolve(b=>v.out(b,S)),v.in&&i.inResolve&&i.inResolve(b=>v.in(b,C))),i=null}}const u=async(r,m)=>m==="in"&&(!i||!i.from)?()=>({}):(i||(i={}),m==="out"?(i.from=r,new Promise(y=>{i.outResolve=y,s()})):(i.to=r,new Promise(y=>{i.inResolve=y,s()})));return r=>({key:r,in:async m=>(l(m,r),(await u(r,"in"))(m)),out:async m=>(await u(r,"out"))(m),[V]:M})}function H(o,t,n){for(const e of n)if(A(o,e.from)&&A(t,e.to))return e.transition;for(const e of n)if((e.from==="*"||A(o,e.from))&&(e.to==="*"||A(t,e.to)))return e.transition;return null}function A(o,t){if(t==="*")return!0;if(t.endsWith("/*")){const n=t.slice(0,-2);return o===n||o.startsWith(n+"/")}return o===t}exports.TRANSITION_STRATEGY=V;exports.createDefaultStrategy=j;exports.createPageTransitionStrategy=M;exports.createSggoiTransitionContext=G;exports.generateAutoKey=_;exports.transition=F;