@ssgoi/core 7.1.0-beta.1 → 7.1.0-beta.2

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/internal.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var _t=Object.defineProperty;var Nt=(n,e,t)=>e in n?_t(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var K=(n,e,t)=>Nt(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("./resolve-transition-rule-BL12rDDu.cjs"),ot=require("./multi-animation-B5hEmEgN.cjs");class Mt extends ot.Animation{constructor(){super(...arguments);K(this,"child",null);K(this,"_state","idle");K(this,"_settled",!1);K(this,"listeners",new Set)}attach(t){const i=this.child;if(this.child=t,this._settled=!1,i){const f=i.getPose();i.complete(),t.matchInto(f)}t.playbackRate=this.playbackRate;const c=t.onComplete;t.onComplete=()=>{c==null||c(),this.child===t&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const r=t.onUpdate;t.onUpdate=f=>{var u;r==null||r(f),(u=this.onUpdate)==null||u.call(this,f),this.notify()},this._state==="paused"?t.pause():this._state==="reversing"?t.reverse():(this._state="playing",t.play()),this.notify()}play(){var t;this._state="playing",this._settled=!1,(t=this.child)==null||t.play(),this.notify()}reverse(){var t;this._state="reversing",this._settled=!1,(t=this.child)==null||t.reverse(),this.notify()}pause(){var t;this._state="paused",(t=this.child)==null||t.pause(),this.notify()}complete(){var t;(t=this.child)==null||t.complete(),this.notify()}get isAnimating(){var t;return((t=this.child)==null?void 0:t.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var t;return((t=this.child)==null?void 0:t.isReversing)??this._state==="reversing"}get progress(){var t;return((t=this.child)==null?void 0:t.progress)??0}findTimeForProgress(t){var i;return((i=this.child)==null?void 0:i.findTimeForProgress(t))??null}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.child&&(this.child.playbackRate=t),this.notify()}getPose(){var t;return((t=this.child)==null?void 0:t.getPose())??[]}getTimeline(){var t;return((t=this.child)==null?void 0:t.getTimeline())??[]}matchInto(t){var i;(i=this.child)==null||i.matchInto(t)}get activeChild(){return this.child}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t()}}const It=(n,e)=>{var t;n.style.position="absolute",n.style.width="100%",n.style.top=`${-1*(((t=e==null?void 0:e.scrollOffset)==null?void 0:t.y)??0)}px`,n.style.left="0"},vt=new Set(["auto","scroll","overlay"]),Ft=n=>{let e=n.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e);if(vt.has(t.overflowY)||vt.has(t.overflowX))return e;e=e.parentElement}return document.documentElement},Bt=n=>{let e=n.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return e;e=e.parentElement}return document.body};function Wt(n){const e=Object.keys(n);return Promise.all(e.map(t=>n[t])).then(t=>{const i={};return e.forEach((c,r)=>{i[c]=t[r]}),i})}const Xt=768,qt=10,zt=10;function Gt(n={}){const{resolvePath:e=h=>h}=n;let t=null,i=!1,c=!1;const r=()=>{const h=(t==null?void 0:t.clientWidth)??0,p=h>0?h:typeof window<"u"?window.innerWidth:0;return p>0&&p<Xt},f=()=>(c||(i=r(),c=!0),i),u=h=>`path:${e(h)}`;let v=null;const d=new Map;let g=null,S=!1,C=0,L=0,H=0;const Y=()=>{t&&g&&!S&&d.set(u(g),{x:t.scrollLeft,y:t.scrollTop})},$=(h,p,T)=>{if(!t)return;const M=++L,x=u(h),A=p&&d.has(x)?d.get(x):{x:0,y:0};let k=0;const _=()=>{if(!t||T!==C||M!==L)return;p||d.set(x,A),t.scrollTo({top:A.y,left:A.x}),!(Math.abs(t.scrollTop-A.y)<1&&Math.abs(t.scrollLeft-A.x)<1)&&k<qt&&(k++,requestAnimationFrame(_))};requestAnimationFrame(_)};return{initializeContext:(h,p,T)=>{S=!0;const M=g===p?C:++C;v=h,t||(t=Ft(h),i=r(),c=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{i=r()}).observe(t),(t===document.documentElement?window:t).addEventListener("scroll",Y,{passive:!0})),g=p;const x=u(p),A=d.get(x),k=F=>{M===C&&(H=M,F&&A&&d.set(x,A),$(p,F,M))};T!==void 0?k(T):requestAnimationFrame(()=>{H!==M&&M===C&&k(!1)});let _=0;const G=()=>{M===C&&(_++,_>=zt?S=!1:requestAnimationFrame(G))};return requestAnimationFrame(G),k},calculateScrollOffset:(h,p,T=!1)=>{const M=h?u(h):null,x=M&&d.has(M)?d.get(M):{x:0,y:0},A=p&&T?u(p):null,k=A&&d.has(A)?d.get(A):{x:0,y:0};return{x:-k.x+x.x,y:-k.y+x.y}},evictScrollPosition:h=>{d.delete(u(h))},getScrollContainer:()=>t,getPositionedParentElement:()=>v?Bt(v):document.body,getScrollPosition:(h,p=!0)=>{if(!p)return{x:0,y:0};const T=h?u(h):null;return T&&d.has(T)?d.get(T):{x:0,y:0}},getIsMobile:f}}const bt=30,Et=8,wt=1.2,St=30,Vt=600;function Kt(){let n=null,e=!1,t=!1,i=null,c=null,r=!1;const f=(y,b)=>{for(let P=0;P<y.length;P++){const O=y.item(P);if(O&&O.identifier===b)return O}return null},u=()=>{i!==null&&(clearTimeout(i),i=null)},v=()=>{c!==null&&(clearTimeout(c),c=null)},d=()=>{e=!0,t=!0,u(),v(),i=setTimeout(()=>{e=!1,t=!1,i=null},Vt)},g=y=>{if(y.touches.length!==1){n=null;return}const b=y.touches.item(0);if(!b){n=null;return}const P=window.innerWidth,O=b.clientX<=bt,I=b.clientX>=P-bt;if(!O&&!I){n=null;return}n={identifier:b.identifier,startX:b.clientX,startY:b.clientY,fromLeftEdge:O,moved:!1}},S=y=>{if(!n)return;if(y.touches.length!==1){n=null;return}const b=f(y.touches,n.identifier);if(!b){n=null;return}const P=b.clientX-n.startX,O=b.clientY-n.startY,I=Math.abs(P),h=Math.abs(O);if(h>Et&&h>I*wt){n=null;return}const p=n.fromLeftEdge?P>0:P<0;I>Et&&I>h*wt&&p&&(n.moved=!0)},C=y=>{if(!n)return;const b=f(y.changedTouches,n.identifier);if(!b){n=null;return}const P=b.clientX-n.startX,O=n.fromLeftEdge?P>0:P<0;if(n.moved&&O&&Math.abs(P)>=St){d(),n=null;return}n.moved&&Math.abs(P)>=St&&d(),n=null},L=()=>{n&&(n.moved&&d(),n=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const y={passive:!0,capture:!0};window.addEventListener("touchstart",g,y),window.addEventListener("touchmove",S,y),window.addEventListener("touchend",C,y),window.addEventListener("touchcancel",L,y)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const y={capture:!0};window.removeEventListener("touchstart",g,y),window.removeEventListener("touchmove",S,y),window.removeEventListener("touchend",C,y),window.removeEventListener("touchcancel",L,y),u(),v(),n=null,e=!1,t=!1},isSwipeBack:()=>{const y=e||t;return y&&u(),y},onPageEnter:()=>{e=!1,u(),v(),c=setTimeout(()=>{t=!1,c=null},0)}}}function Ut(){let n=!1;const e=()=>{n=!0};return typeof window<"u"&&window.addEventListener("popstate",e,!0),{resolve(t,i){const c=n?"backward":"forward";return n=!1,c},dispose(){typeof window<"u"&&window.removeEventListener("popstate",e,!0)}}}function Yt(n={}){let e=null,t=null;function i(){var r,f;e&&((r=e.out)==null||r.resolve(null),(f=e.in)==null||f.resolve(null),e=null)}function c(){if(e!=null&&e.out&&e.in){if(e.out.path===e.in.path){i();return}const r={from:e.out.path,to:e.in.path,out:e.out.payload,in:e.in.payload};t=r,e.out.resolve(r),e.in.resolve(r),e=null}}return{arrive(r,f,u){return new Promise(v=>{var C,L;const d=t===null?null:f==="out"?{path:t.from,payload:t.out}:{path:t.to,payload:t.in};if((d==null?void 0:d.path)===r){v(null);return}f==="out"&&((C=e==null?void 0:e.in)==null?void 0:C.path)===r&&!e.out&&(e.in.resolve(null),e.in=void 0);const g=e==null?void 0:e[f];g&&g.path!==r&&i(),e||(e={});const S=e[f];if(S){if(((L=n.keepCurrent)==null?void 0:L.call(n,{type:f,path:r,current:S.payload,next:u}))??!1){v(null);return}S.resolve(null)}e[f]={path:r,payload:u,resolve:v},c()})},cancel(r){(e!=null&&e.out&&r(e.out.payload)||e!=null&&e.in&&r(e.in.payload))&&i(),(t&&r(t.out)||t&&r(t.in))&&(t=null)}}}const $t={},z=new Map;let Q=null,Pt=!1;function Ot(n,e,t){n instanceof HTMLElement&&z.has(n)&&!n.isConnected&&t.set(n,{entry:z.get(n),anchor:e});for(const i of Array.from(n.childNodes))Ot(i,e,t)}function jt(n){const e=new Set(Array.from(n.values(),({entry:t})=>t));for(const[t,{entry:i,anchor:c}]of n){z.delete(t);let r=i.parent,f=!1;for(;r;){if(r.group===i.group&&e.has(r)){f=!0;break}r=r.parent}queueMicrotask(()=>i.callback(c,{emit:!f}))}}function Zt(){if(Pt||typeof document>"u")return;Pt=!0,Q=new MutationObserver(e=>{const t=new Map;for(const i of e){const c={parent:i.target,nextSibling:i.nextSibling};for(const r of Array.from(i.removedNodes))Ot(r,c,t)}jt(t)});const n=()=>{Q==null||Q.observe(document.body,{childList:!0,subtree:!0})};document.body?n():document.addEventListener("DOMContentLoaded",n,{once:!0})}function Jt(n,e,t=$t){Zt();let i=n.parentElement,c=null;for(;i;){const r=z.get(i);if((r==null?void 0:r.group)===t){c=r;break}i=i.parentElement}return z.set(n,{element:n,callback:e,group:t,parent:c}),()=>{z.delete(n)}}const ut=new WeakMap;let tt=null;const et="none !important";function U(n){const e=n.style.getPropertyValue("display");return n.style.getPropertyPriority("display")?`${e} !important`:e}function Qt(){return tt||(tt=new MutationObserver(n=>{for(const e of n){const t=e.target,i=ut.get(t);if(!i)continue;const c=U(t);c!==i.accounted&&(i.accounted=c,c===et?(i.reactHidden=!0,i.onHide()):c!=="none"&&i.reactHidden&&(i.reactHidden=!1,i.onShow()))}}),tt)}function te(n,e){const t=U(n),i={accounted:t,reactHidden:t===et,onHide:e.onHide,onShow:e.onShow};return ut.set(n,i),Qt().observe(n,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return U(n)===et},setDisplay(c,r=!1){c===null?n.style.removeProperty("display"):n.style.setProperty("display",c,r?"important":""),i.accounted=U(n)},sync(){i.accounted=U(n),i.reactHidden=i.accounted===et},stop(){ut.delete(n)}}}function ee(n,e={}){const{transitions:t=[],middleware:i=(o,s)=>({from:o,to:s})}=n,c=e.host??new Mt,r={},f=Yt({keepCurrent:({current:o,next:s})=>o.element.contains(s.element)}),u=Ut(),v=typeof t=="function"?t:()=>t,d=Kt();d.initialize();const g=new Map,S=o=>{let s=g.get(o);return s===void 0&&(s=i(o,o).from,g.set(o,s)),s},{initializeContext:C,calculateScrollOffset:L,evictScrollPosition:H,getScrollContainer:Y,getPositionedParentElement:$,getScrollPosition:j,getIsMobile:y}=Gt({resolvePath:S}),b=new Map,P=()=>{const o=y();let s=b.get(o);return s||(s=v({isMobile:o}),b.set(o,s)),s},O=new WeakMap,I=o=>{O.set(o,{parent:o.parentNode,nextSibling:o.nextSibling})},h=o=>{const s=O.get(o);return s||{parent:o.parentNode,nextSibling:o.nextSibling}},p=new WeakMap,T=new WeakMap;let M=0;const x=o=>{const s=typeof getComputedStyle<"u"?getComputedStyle(o).display:"";return s&&s!=="none"?s:"block"},A=(o,s)=>{s.visibleDisplay=o.style.getPropertyValue("display"),s.computedDisplay=x(o)},k=(o,s)=>{if(T.get(o)!==s)return;T.delete(o);const l=p.get(o);l&&(l.savedCss!==null&&(o.style.cssText=l.savedCss,l.savedCss=null),l.intent==="hidden"?l.vis.setDisplay("none",!0):l.visibleDisplay?(l.vis.setDisplay(l.visibleDisplay,!1),A(o,l)):(l.vis.setDisplay(null),A(o,l)))},_=(o,s)=>{if(o.mode!=="hidden")return;const l=Array.from(new Set([o.element,s==null?void 0:s.element].filter(Boolean))),w=++M;for(const a of l)T.set(a,w);c.complete();for(const a of l)k(a,w)},G=(o,s,l,w,a,m,E)=>{const N=a.element,R=m.element,B=(a.mode??"unmount")==="hidden",{parent:W,nextSibling:q}=a.parent?{parent:a.parent,nextSibling:a.nextSibling}:h(N),Z=L(l,w,E.to),st={direction:s,scrollOffset:Z,from:{scroll:j(l)},to:{scroll:j(w,E.to)},get scrollingElement(){return Y()||document.documentElement},get positionedParent(){return $()}};let D;if(B){D=N,D.style.top=`${-1*((Z==null?void 0:Z.y)??0)}px`;const X=p.get(R);X&&X.savedCss===null&&(X.savedCss=R.style.cssText)}else D=N,It(D,st);E.from||H(l);const J=B?++M:0;B&&(T.set(R,J),T.set(N,J));const yt=Promise.resolve(D),mt=Promise.resolve(R),gt=[],Lt={from:yt,to:mt,context:st,createElement:((X,rt="div")=>{const V=document.createElement(rt);return V.setAttribute("data-ssgoi-id",X),gt.push(V),V})},Dt=Promise.resolve(o.prepare?o.prepare(Lt):{});Wt({from:yt,to:mt,extras:Dt}).then(({from:X,to:rt,extras:V})=>{!B&&W&&(q&&W.contains(q)?W.insertBefore(D,q):W.appendChild(D));const lt=o.animation({from:X,to:rt,context:st,...V}),ct=lt.onComplete;lt.onComplete=()=>{ct==null||ct(),B?(k(N,J),k(R,J)):D.parentNode&&D.parentNode.removeChild(D);for(const at of gt)at.parentNode&&at.parentNode.removeChild(at)},c.attach(lt)})},F=(o,s,l)=>{const w=d.isSwipeBack();f.arrive(o,s,l).then(a=>{var it,B,W,q;if(s==="in"&&d.onPageEnter(),!a){s==="out"&&_(l);return}if(s!=="in")return;const{from:m,to:E}=i(a.from,a.to),N=u.resolve(m,E),R=Ht.resolveTransitionRule(m,E,P(),N);if(!R){(B=(it=a.in).applyScrollPolicy)==null||B.call(it,!1),H(a.from),_(a.out,a.in);return}if((q=(W=a.in).applyScrollPolicy)==null||q.call(W,R.preserveScroll.to),w){R.preserveScroll.from||H(a.from),_(a.out,a.in);return}G(R.transition,R.direction,a.from,a.to,a.out,a.in,R.preserveScroll)})},dt=(o,s)=>{const l=p.get(o);if(!l)return;const w=l.intent==="hidden";if(l.intent="hidden",l.savedCss===null&&(l.savedCss=o.style.cssText),l.vis.setDisplay(l.computedDisplay||"block",!0),o.style.position="absolute",o.style.width="100%",o.style.left="0",w)return;const a=h(o),m={element:o,parent:a.parent,nextSibling:a.nextSibling,mode:"hidden"},E=l.pendingOutPath??l.currentPath??s;l.pendingOutPath=null,F(E,"out",m)},kt=(o,s)=>{const l=p.get(o);if(!l||l.intent==="visible")return;l.intent="visible",l.currentPath=o.getAttribute("data-ssgoi-transition")??l.currentPath??s,l.pendingOutPath=null,l.pathRevision++,A(o,l),l.savedCss!==null&&(o.style.cssText=l.savedCss,l.visibleDisplay?l.vis.setDisplay(l.visibleDisplay,!1):l.vis.setDisplay(null));const w=l.currentPath,a=C(o,w),m={element:o,parent:o.parentElement,nextSibling:o.nextElementSibling,applyScrollPolicy:a};F(w,"in",m)},xt=(o,s,l,w=!0)=>{const a=p.get(o),m=(a==null?void 0:a.pendingOutPath)??(a==null?void 0:a.currentPath)??s;if(a&&(a.vis.stop(),p.delete(o),T.delete(o),a.intent==="hidden")){f.cancel(R=>R.element===o);return}if(!w)return;const E=l??h(o),N={element:o,parent:E.parent,nextSibling:E.nextSibling,mode:"unmount"};F(m,"out",N)},ft=new WeakSet,ht=(o,s,{enter:l=!0}={})=>{if(ft.has(s)){const m=p.get(s);if(m&&m.currentPath!==o){m.intent==="visible"&&m.pendingOutPath===null&&(m.pendingOutPath=m.currentPath),m.currentPath=o;const E=++m.pathRevision;queueMicrotask(()=>{m.pathRevision===E&&(m.pendingOutPath=null)})}return}ft.add(s),I(s);const w=te(s,{onHide:()=>dt(s,o),onShow:()=>kt(s,o)}),a={vis:w,savedCss:null,intent:w.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:o,pendingOutPath:null,pathRevision:0};if(p.set(s,a),!w.isHidden&&(A(s,a),l)){const m=C(s,o),E={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling,applyScrollPolicy:m};F(o,"in",E)}Jt(s,(m,E)=>xt(s,o,m,(E==null?void 0:E.emit)??!0),r)},pt=new Map;return{register:ht,refFor:o=>{let s=pt.get(o);return s||(s=l=>{l&&ht(o,l)},pt.set(o,s)),s}}}const Rt="data-ssgoi-root",ne=`[${Rt}]`,nt="data-ssgoi-transition",Tt=`[${nt}]`,oe="[data-ssgoi-clone]";function ie(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function se(n){return n.nodeType===Node.ELEMENT_NODE}function re(n){return n instanceof HTMLElement}function At(n){let e=0,t=n.parentElement;for(;t;)e++,t=t.parentElement;return e}function Ct(n,e,t=n){const i=Array.from(n).sort((c,r)=>At(c)-At(r));for(const c of i){const r=c.getAttribute(nt);if(r===null)continue;let f=c.parentElement,u=!1;for(;f;){if(t.has(f)){u=!0;break}f=f.parentElement}e.register(r,c,{enter:!u})}}function le(n,e){if(!ie())return()=>{};n.setAttribute(Rt,"");const t=u=>u.closest(ne)===n,i=u=>!re(u)||!t(u)||u.closest(oe)||u.getAttribute(nt)===null?null:u,c=(u,v)=>{if(se(u)){if(u.matches(Tt)){const d=i(u);d&&v.add(d)}for(const d of u.querySelectorAll(Tt)){const g=i(d);g&&v.add(g)}}},r=new MutationObserver(u=>{const v=new Set,d=new Set;for(const g of u){if(g.type==="attributes"){const S=i(g.target);S&&v.add(S);continue}for(const S of g.addedNodes)c(S,d)}for(const g of d)v.add(g);Ct(v,e,d)});r.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[nt]});const f=new Set;return c(n,f),Ct(f,e),()=>r.disconnect()}exports.Animation=ot.Animation;exports.MultiAnimation=ot.MultiAnimation;exports.WebAnimation=ot.WebAnimation;exports.HostAnimation=Mt;exports.createSggoiTransitionContext=ee;exports.observeSsgoiTransitions=le;
1
+ "use strict";var _t=Object.defineProperty;var Nt=(n,e,t)=>e in n?_t(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>Nt(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("./resolve-transition-rule-BL12rDDu.cjs"),ot=require("./multi-animation-B5hEmEgN.cjs");class Rt extends ot.Animation{constructor(){super(...arguments);U(this,"child",null);U(this,"_state","idle");U(this,"_settled",!1);U(this,"listeners",new Set)}attach(t){const i=this.child;if(this.child=t,this._settled=!1,i){const c=i.getPose();i.complete(),t.matchInto(c)}t.playbackRate=this.playbackRate;const a=t.onComplete;t.onComplete=()=>{a==null||a(),this.child===t&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const s=t.onUpdate;t.onUpdate=c=>{var u;s==null||s(c),(u=this.onUpdate)==null||u.call(this,c),this.notify()},this._state==="paused"?t.pause():this._state==="reversing"?t.reverse():(this._state="playing",t.play()),this.notify()}play(){var t;this._state="playing",this._settled=!1,(t=this.child)==null||t.play(),this.notify()}reverse(){var t;this._state="reversing",this._settled=!1,(t=this.child)==null||t.reverse(),this.notify()}pause(){var t;this._state="paused",(t=this.child)==null||t.pause(),this.notify()}complete(){var t;(t=this.child)==null||t.complete(),this.notify()}get isAnimating(){var t;return((t=this.child)==null?void 0:t.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var t;return((t=this.child)==null?void 0:t.isReversing)??this._state==="reversing"}get progress(){var t;return((t=this.child)==null?void 0:t.progress)??0}findTimeForProgress(t){var i;return((i=this.child)==null?void 0:i.findTimeForProgress(t))??null}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.child&&(this.child.playbackRate=t),this.notify()}getPose(){var t;return((t=this.child)==null?void 0:t.getPose())??[]}getTimeline(){var t;return((t=this.child)==null?void 0:t.getTimeline())??[]}matchInto(t){var i;(i=this.child)==null||i.matchInto(t)}get activeChild(){return this.child}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t()}}const It=(n,e)=>{var t;n.style.position="absolute",n.style.width="100%",n.style.top=`${-1*(((t=e==null?void 0:e.scrollOffset)==null?void 0:t.y)??0)}px`,n.style.left="0"},vt=new Set(["auto","scroll","overlay"]),Ft=n=>{let e=n.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e);if(vt.has(t.overflowY)||vt.has(t.overflowX))return e;e=e.parentElement}return document.documentElement},Bt=n=>{let e=n.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return e;e=e.parentElement}return document.body};function Wt(n){const e=Object.keys(n);return Promise.all(e.map(t=>n[t])).then(t=>{const i={};return e.forEach((a,s)=>{i[a]=t[s]}),i})}const Xt=768,qt=10,zt=10;function Gt(n={}){const{resolvePath:e=p=>p}=n;let t=null,i=!1,a=!1;const s=()=>{const p=(t==null?void 0:t.clientWidth)??0,m=p>0?p:typeof window<"u"?window.innerWidth:0;return m>0&&m<Xt},c=()=>(a||(i=s(),a=!0),i),u=p=>`path:${e(p)}`;let h=null;const f=new Map;let y=null,b=!1,E=0,w=0,_=0;const q=()=>{t&&y&&!b&&f.set(u(y),{x:t.scrollLeft,y:t.scrollTop})},$=(p,m,A)=>{if(!t)return;const C=++w,L=u(p),R=m&&f.has(L)?f.get(L):{x:0,y:0};let x=0;const N=()=>{if(!t||A!==E||C!==w)return;m||f.set(L,R),t.scrollTo({top:R.y,left:R.x}),!(Math.abs(t.scrollTop-R.y)<1&&Math.abs(t.scrollLeft-R.x)<1)&&x<qt&&(x++,requestAnimationFrame(N))};requestAnimationFrame(N)};return{initializeContext:(p,m,A)=>{b=!0;const C=y===m?E:++E;h=p,t||(t=Ft(p),i=s(),a=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{i=s()}).observe(t),(t===document.documentElement?window:t).addEventListener("scroll",q,{passive:!0})),y=m;const L=u(m),R=f.get(L),x=F=>{C===E&&(_=C,F&&R&&f.set(L,R),$(m,F,C))};A!==void 0?x(A):requestAnimationFrame(()=>{_!==C&&C===E&&x(!1)});let N=0;const V=()=>{C===E&&(N++,N>=zt?b=!1:requestAnimationFrame(V))};return requestAnimationFrame(V),x},calculateScrollOffset:(p,m,A=!1)=>{const C=p?u(p):null,L=C&&f.has(C)?f.get(C):{x:0,y:0},R=m&&A?u(m):null,x=R&&f.has(R)?f.get(R):{x:0,y:0};return{x:-x.x+L.x,y:-x.y+L.y}},evictScrollPosition:p=>{f.delete(u(p))},getScrollContainer:()=>t,getPositionedParentElement:()=>h?Bt(h):document.body,getScrollPosition:(p,m=!0)=>{if(!m)return{x:0,y:0};const A=p?u(p):null;return A&&f.has(A)?f.get(A):{x:0,y:0}},getIsMobile:c}}const bt=30,wt=8,Et=1.2,St=30,Vt=600;function Kt(){let n=null,e=!1,t=!1,i=null,a=null,s=!1;const c=(g,S)=>{for(let k=0;k<g.length;k++){const M=g.item(k);if(M&&M.identifier===S)return M}return null},u=()=>{i!==null&&(clearTimeout(i),i=null)},h=()=>{a!==null&&(clearTimeout(a),a=null)},f=()=>{e=!0,t=!0,u(),h(),i=setTimeout(()=>{e=!1,t=!1,i=null},Vt)},y=g=>{if(g.touches.length!==1){n=null;return}const S=g.touches.item(0);if(!S){n=null;return}const k=window.innerWidth,M=S.clientX<=bt,I=S.clientX>=k-bt;if(!M&&!I){n=null;return}n={identifier:S.identifier,startX:S.clientX,startY:S.clientY,fromLeftEdge:M,moved:!1}},b=g=>{if(!n)return;if(g.touches.length!==1){n=null;return}const S=c(g.touches,n.identifier);if(!S){n=null;return}const k=S.clientX-n.startX,M=S.clientY-n.startY,I=Math.abs(k),p=Math.abs(M);if(p>wt&&p>I*Et){n=null;return}const m=n.fromLeftEdge?k>0:k<0;I>wt&&I>p*Et&&m&&(n.moved=!0)},E=g=>{if(!n)return;const S=c(g.changedTouches,n.identifier);if(!S){n=null;return}const k=S.clientX-n.startX,M=n.fromLeftEdge?k>0:k<0;if(n.moved&&M&&Math.abs(k)>=St){f(),n=null;return}n.moved&&Math.abs(k)>=St&&f(),n=null},w=()=>{n&&(n.moved&&f(),n=null)};return{initialize:()=>{if(typeof window>"u"||s)return;s=!0;const g={passive:!0,capture:!0};window.addEventListener("touchstart",y,g),window.addEventListener("touchmove",b,g),window.addEventListener("touchend",E,g),window.addEventListener("touchcancel",w,g)},destroy:()=>{if(typeof window>"u"||!s)return;s=!1;const g={capture:!0};window.removeEventListener("touchstart",y,g),window.removeEventListener("touchmove",b,g),window.removeEventListener("touchend",E,g),window.removeEventListener("touchcancel",w,g),u(),h(),n=null,e=!1,t=!1},isSwipeBack:()=>{const g=e||t;return g&&u(),g},onPageEnter:()=>{e=!1,u(),h(),a=setTimeout(()=>{t=!1,a=null},0)}}}function Ut(){let n=null,e=null,t=null;const i=()=>{t!==null&&clearTimeout(t),t=null},a=w=>{n=w,e=w,i(),t=setTimeout(()=>{e===w&&(e=null,n===w&&(n=null),t=null)},1e3)},s=()=>{if(e!==null){e=null,i();return}n="backward"};let c=null,u=null,h=null,f=null,y=null,b=null,E=null;return typeof window<"u"&&(window.addEventListener("popstate",s,!0),c=window.history,u=c.back,h=c.forward,f=c.go,y=()=>(a("backward"),u==null?void 0:u.call(c)),b=()=>(a("forward"),h==null?void 0:h.call(c)),E=(w=0)=>(w<0?a("backward"):w>0&&a("forward"),f==null?void 0:f.call(c,w)),c.back=y,c.forward=b,c.go=E),{resolve(w,_){const q=n??"forward";return n=null,q},dispose(){i(),typeof window<"u"&&window.removeEventListener("popstate",s,!0),c&&(c.back===y&&u&&(c.back=u),c.forward===b&&h&&(c.forward=h),c.go===E&&f&&(c.go=f))}}}function Yt(n={}){let e=null,t=null;function i(){var s,c;e&&((s=e.out)==null||s.resolve(null),(c=e.in)==null||c.resolve(null),e=null)}function a(){if(e!=null&&e.out&&e.in){if(e.out.path===e.in.path){i();return}const s={from:e.out.path,to:e.in.path,out:e.out.payload,in:e.in.payload};t=s,e.out.resolve(s),e.in.resolve(s),e=null}}return{arrive(s,c,u){return new Promise(h=>{var E,w;const f=t===null?null:c==="out"?{path:t.from,payload:t.out}:{path:t.to,payload:t.in};if((f==null?void 0:f.path)===s){h(null);return}c==="out"&&((E=e==null?void 0:e.in)==null?void 0:E.path)===s&&!e.out&&(e.in.resolve(null),e.in=void 0);const y=e==null?void 0:e[c];y&&y.path!==s&&i(),e||(e={});const b=e[c];if(b){if(((w=n.keepCurrent)==null?void 0:w.call(n,{type:c,path:s,current:b.payload,next:u}))??!1){h(null);return}b.resolve(null)}e[c]={path:s,payload:u,resolve:h},a()})},cancel(s){(e!=null&&e.out&&s(e.out.payload)||e!=null&&e.in&&s(e.in.payload))&&i(),(t&&s(t.out)||t&&s(t.in))&&(t=null)}}}const $t={},G=new Map;let Q=null,Tt=!1;function Ct(n,e,t){n instanceof HTMLElement&&G.has(n)&&!n.isConnected&&t.set(n,{entry:G.get(n),anchor:e});for(const i of Array.from(n.childNodes))Ct(i,e,t)}function jt(n){const e=new Set(Array.from(n.values(),({entry:t})=>t));for(const[t,{entry:i,anchor:a}]of n){G.delete(t);let s=i.parent,c=!1;for(;s;){if(s.group===i.group&&e.has(s)){c=!0;break}s=s.parent}queueMicrotask(()=>i.callback(a,{emit:!c}))}}function Zt(){if(Tt||typeof document>"u")return;Tt=!0,Q=new MutationObserver(e=>{const t=new Map;for(const i of e){const a={parent:i.target,nextSibling:i.nextSibling};for(const s of Array.from(i.removedNodes))Ct(s,a,t)}jt(t)});const n=()=>{Q==null||Q.observe(document.body,{childList:!0,subtree:!0})};document.body?n():document.addEventListener("DOMContentLoaded",n,{once:!0})}function Jt(n,e,t=$t){Zt();let i=n.parentElement,a=null;for(;i;){const s=G.get(i);if((s==null?void 0:s.group)===t){a=s;break}i=i.parentElement}return G.set(n,{element:n,callback:e,group:t,parent:a}),()=>{G.delete(n)}}const ut=new WeakMap;let tt=null;const et="none !important";function Y(n){const e=n.style.getPropertyValue("display");return n.style.getPropertyPriority("display")?`${e} !important`:e}function Qt(){return tt||(tt=new MutationObserver(n=>{for(const e of n){const t=e.target,i=ut.get(t);if(!i)continue;const a=Y(t);a!==i.accounted&&(i.accounted=a,a===et?(i.reactHidden=!0,i.onHide()):a!=="none"&&i.reactHidden&&(i.reactHidden=!1,i.onShow()))}}),tt)}function te(n,e){const t=Y(n),i={accounted:t,reactHidden:t===et,onHide:e.onHide,onShow:e.onShow};return ut.set(n,i),Qt().observe(n,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return Y(n)===et},setDisplay(a,s=!1){a===null?n.style.removeProperty("display"):n.style.setProperty("display",a,s?"important":""),i.accounted=Y(n)},sync(){i.accounted=Y(n),i.reactHidden=i.accounted===et},stop(){ut.delete(n)}}}function ee(n,e={}){const{transitions:t=[],middleware:i=(o,r)=>({from:o,to:r})}=n,a=e.host??new Rt,s={},c=Yt({keepCurrent:({current:o,next:r})=>o.element.contains(r.element)}),u=Ut(),h=typeof t=="function"?t:()=>t,f=Kt();f.initialize();const y=new Map,b=o=>{let r=y.get(o);return r===void 0&&(r=i(o,o).from,y.set(o,r)),r},{initializeContext:E,calculateScrollOffset:w,evictScrollPosition:_,getScrollContainer:q,getPositionedParentElement:$,getScrollPosition:j,getIsMobile:g}=Gt({resolvePath:b}),S=new Map,k=()=>{const o=g();let r=S.get(o);return r||(r=h({isMobile:o}),S.set(o,r)),r},M=new WeakMap,I=o=>{M.set(o,{parent:o.parentNode,nextSibling:o.nextSibling})},p=o=>{const r=M.get(o);return r||{parent:o.parentNode,nextSibling:o.nextSibling}},m=new WeakMap,A=new WeakMap;let C=0;const L=o=>{const r=typeof getComputedStyle<"u"?getComputedStyle(o).display:"";return r&&r!=="none"?r:"block"},R=(o,r)=>{r.visibleDisplay=o.style.getPropertyValue("display"),r.computedDisplay=L(o)},x=(o,r)=>{if(A.get(o)!==r)return;A.delete(o);const l=m.get(o);l&&(l.savedCss!==null&&(o.style.cssText=l.savedCss,l.savedCss=null),l.intent==="hidden"?l.vis.setDisplay("none",!0):l.visibleDisplay?(l.vis.setDisplay(l.visibleDisplay,!1),R(o,l)):(l.vis.setDisplay(null),R(o,l)))},N=(o,r)=>{if(o.mode!=="hidden")return;const l=Array.from(new Set([o.element,r==null?void 0:r.element].filter(Boolean))),P=++C;for(const d of l)A.set(d,P);a.complete();for(const d of l)x(d,P)},V=(o,r,l,P,d,v,T)=>{const H=d.element,O=v.element,B=(d.mode??"unmount")==="hidden",{parent:W,nextSibling:z}=d.parent?{parent:d.parent,nextSibling:d.nextSibling}:p(H),Z=w(l,P,T.to),rt={direction:r,scrollOffset:Z,from:{scroll:j(l)},to:{scroll:j(P,T.to)},get scrollingElement(){return q()||document.documentElement},get positionedParent(){return $()}};let D;if(B){D=H,D.style.top=`${-1*((Z==null?void 0:Z.y)??0)}px`;const X=m.get(O);X&&X.savedCss===null&&(X.savedCss=O.style.cssText)}else D=H,It(D,rt);T.from||_(l);const J=B?++C:0;B&&(A.set(O,J),A.set(H,J));const mt=Promise.resolve(D),yt=Promise.resolve(O),gt=[],Lt={from:mt,to:yt,context:rt,createElement:((X,st="div")=>{const K=document.createElement(st);return K.setAttribute("data-ssgoi-id",X),gt.push(K),K})},Dt=Promise.resolve(o.prepare?o.prepare(Lt):{});Wt({from:mt,to:yt,extras:Dt}).then(({from:X,to:st,extras:K})=>{!B&&W&&(z&&W.contains(z)?W.insertBefore(D,z):W.appendChild(D));const lt=o.animation({from:X,to:st,context:rt,...K}),ct=lt.onComplete;lt.onComplete=()=>{ct==null||ct(),B?(x(H,J),x(O,J)):D.parentNode&&D.parentNode.removeChild(D);for(const at of gt)at.parentNode&&at.parentNode.removeChild(at)},a.attach(lt)})},F=(o,r,l)=>{const P=f.isSwipeBack();c.arrive(o,r,l).then(d=>{var it,B,W,z;if(r==="in"&&f.onPageEnter(),!d){r==="out"&&N(l);return}if(r!=="in")return;const{from:v,to:T}=i(d.from,d.to),H=u.resolve(v,T),O=Ht.resolveTransitionRule(v,T,k(),H);if(!O){(B=(it=d.in).applyScrollPolicy)==null||B.call(it,!1),_(d.from),N(d.out,d.in);return}if((z=(W=d.in).applyScrollPolicy)==null||z.call(W,O.preserveScroll.to),P){O.preserveScroll.from||_(d.from),N(d.out,d.in);return}V(O.transition,O.direction,d.from,d.to,d.out,d.in,O.preserveScroll)})},dt=(o,r)=>{const l=m.get(o);if(!l)return;const P=l.intent==="hidden";if(l.intent="hidden",l.savedCss===null&&(l.savedCss=o.style.cssText),l.vis.setDisplay(l.computedDisplay||"block",!0),o.style.position="absolute",o.style.width="100%",o.style.left="0",P)return;const d=p(o),v={element:o,parent:d.parent,nextSibling:d.nextSibling,mode:"hidden"},T=l.pendingOutPath??l.currentPath??r;l.pendingOutPath=null,F(T,"out",v)},Ot=(o,r)=>{const l=m.get(o);if(!l||l.intent==="visible")return;l.intent="visible",l.currentPath=o.getAttribute("data-ssgoi-transition")??l.currentPath??r,l.pendingOutPath=null,l.pathRevision++,R(o,l),l.savedCss!==null&&(o.style.cssText=l.savedCss,l.visibleDisplay?l.vis.setDisplay(l.visibleDisplay,!1):l.vis.setDisplay(null));const P=l.currentPath,d=E(o,P),v={element:o,parent:o.parentElement,nextSibling:o.nextElementSibling,applyScrollPolicy:d};F(P,"in",v)},xt=(o,r,l,P=!0)=>{const d=m.get(o),v=(d==null?void 0:d.pendingOutPath)??(d==null?void 0:d.currentPath)??r;if(d&&(d.vis.stop(),m.delete(o),A.delete(o),d.intent==="hidden")){c.cancel(O=>O.element===o);return}if(!P)return;const T=l??p(o),H={element:o,parent:T.parent,nextSibling:T.nextSibling,mode:"unmount"};F(v,"out",H)},ft=new WeakSet,ht=(o,r,{enter:l=!0}={})=>{if(ft.has(r)){const v=m.get(r);if(v&&v.currentPath!==o){v.intent==="visible"&&v.pendingOutPath===null&&(v.pendingOutPath=v.currentPath),v.currentPath=o;const T=++v.pathRevision;queueMicrotask(()=>{v.pathRevision===T&&(v.pendingOutPath=null)})}return}ft.add(r),I(r);const P=te(r,{onHide:()=>dt(r,o),onShow:()=>Ot(r,o)}),d={vis:P,savedCss:null,intent:P.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:o,pendingOutPath:null,pathRevision:0};if(m.set(r,d),!P.isHidden&&(R(r,d),l)){const v=E(r,o),T={element:r,parent:r.parentElement,nextSibling:r.nextElementSibling,applyScrollPolicy:v};F(o,"in",T)}Jt(r,(v,T)=>xt(r,o,v,(T==null?void 0:T.emit)??!0),s)},pt=new Map;return{register:ht,refFor:o=>{let r=pt.get(o);return r||(r=l=>{l&&ht(o,l)},pt.set(o,r)),r}}}const Mt="data-ssgoi-root",ne=`[${Mt}]`,nt="data-ssgoi-transition",Pt=`[${nt}]`,oe="[data-ssgoi-clone]";function ie(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function re(n){return n.nodeType===Node.ELEMENT_NODE}function se(n){return n instanceof HTMLElement}function kt(n){let e=0,t=n.parentElement;for(;t;)e++,t=t.parentElement;return e}function At(n,e,t=n){const i=Array.from(n).sort((a,s)=>kt(a)-kt(s));for(const a of i){const s=a.getAttribute(nt);if(s===null)continue;let c=a.parentElement,u=!1;for(;c;){if(t.has(c)){u=!0;break}c=c.parentElement}e.register(s,a,{enter:!u})}}function le(n,e){if(!ie())return()=>{};n.setAttribute(Mt,"");const t=u=>u.closest(ne)===n,i=u=>!se(u)||!t(u)||u.closest(oe)||u.getAttribute(nt)===null?null:u,a=(u,h)=>{if(re(u)){if(u.matches(Pt)){const f=i(u);f&&h.add(f)}for(const f of u.querySelectorAll(Pt)){const y=i(f);y&&h.add(y)}}},s=new MutationObserver(u=>{const h=new Set,f=new Set;for(const y of u){if(y.type==="attributes"){const b=i(y.target);b&&h.add(b);continue}for(const b of y.addedNodes)a(b,f)}for(const y of f)h.add(y);At(h,e,f)});s.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[nt]});const c=new Set;return a(n,c),At(c,e),()=>s.disconnect()}exports.Animation=ot.Animation;exports.MultiAnimation=ot.MultiAnimation;exports.WebAnimation=ot.WebAnimation;exports.HostAnimation=Rt;exports.createSggoiTransitionContext=ee;exports.observeSsgoiTransitions=le;
package/dist/internal.js CHANGED
@@ -1,32 +1,32 @@
1
1
  var Lt = Object.defineProperty;
2
2
  var Dt = (n, e, t) => e in n ? Lt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var K = (n, e, t) => Dt(n, typeof e != "symbol" ? e + "" : e, t);
3
+ var U = (n, e, t) => Dt(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { r as _t } from "./resolve-transition-rule-DbkMu0rm.js";
5
5
  import { A as Nt } from "./multi-animation-DyZGEfKy.js";
6
- import { M as ye, W as me } from "./multi-animation-DyZGEfKy.js";
6
+ import { M as me, W as ye } from "./multi-animation-DyZGEfKy.js";
7
7
  class It extends Nt {
8
8
  constructor() {
9
9
  super(...arguments);
10
- K(this, "child", null);
11
- K(this, "_state", "idle");
12
- K(this, "_settled", !1);
13
- K(this, "listeners", /* @__PURE__ */ new Set());
10
+ U(this, "child", null);
11
+ U(this, "_state", "idle");
12
+ U(this, "_settled", !1);
13
+ U(this, "listeners", /* @__PURE__ */ new Set());
14
14
  }
15
15
  attach(t) {
16
16
  const i = this.child;
17
17
  if (this.child = t, this._settled = !1, i) {
18
- const f = i.getPose();
19
- i.complete(), t.matchInto(f);
18
+ const c = i.getPose();
19
+ i.complete(), t.matchInto(c);
20
20
  }
21
21
  t.playbackRate = this.playbackRate;
22
- const c = t.onComplete;
22
+ const a = t.onComplete;
23
23
  t.onComplete = () => {
24
- c == null || c(), this.child === t && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
+ a == null || a(), this.child === t && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
25
25
  };
26
- const r = t.onUpdate;
27
- t.onUpdate = (f) => {
26
+ const s = t.onUpdate;
27
+ t.onUpdate = (c) => {
28
28
  var u;
29
- r == null || r(f), (u = this.onUpdate) == null || u.call(this, f), this.notify();
29
+ s == null || s(c), (u = this.onUpdate) == null || u.call(this, c), this.notify();
30
30
  }, this._state === "paused" ? t.pause() : this._state === "reversing" ? t.reverse() : (this._state = "playing", t.play()), this.notify();
31
31
  }
32
32
  play() {
@@ -125,266 +125,277 @@ function Wt(n) {
125
125
  const e = Object.keys(n);
126
126
  return Promise.all(e.map((t) => n[t])).then((t) => {
127
127
  const i = {};
128
- return e.forEach((c, r) => {
129
- i[c] = t[r];
128
+ return e.forEach((a, s) => {
129
+ i[a] = t[s];
130
130
  }), i;
131
131
  });
132
132
  }
133
133
  const Xt = 768, zt = 10, qt = 10;
134
134
  function Gt(n = {}) {
135
- const { resolvePath: e = (h) => h } = n;
136
- let t = null, i = !1, c = !1;
137
- const r = () => {
138
- const h = (t == null ? void 0 : t.clientWidth) ?? 0, p = h > 0 ? h : typeof window < "u" ? window.innerWidth : 0;
139
- return p > 0 && p < Xt;
140
- }, f = () => (c || (i = r(), c = !0), i), u = (h) => `path:${e(h)}`;
141
- let v = null;
142
- const d = /* @__PURE__ */ new Map();
143
- let g = null, S = !1, M = 0, L = 0, I = 0;
144
- const Y = () => {
145
- t && g && !S && d.set(u(g), {
135
+ const { resolvePath: e = (p) => p } = n;
136
+ let t = null, i = !1, a = !1;
137
+ const s = () => {
138
+ const p = (t == null ? void 0 : t.clientWidth) ?? 0, m = p > 0 ? p : typeof window < "u" ? window.innerWidth : 0;
139
+ return m > 0 && m < Xt;
140
+ }, c = () => (a || (i = s(), a = !0), i), u = (p) => `path:${e(p)}`;
141
+ let h = null;
142
+ const f = /* @__PURE__ */ new Map();
143
+ let y = null, w = !1, E = 0, b = 0, _ = 0;
144
+ const z = () => {
145
+ t && y && !w && f.set(u(y), {
146
146
  x: t.scrollLeft,
147
147
  y: t.scrollTop
148
148
  });
149
- }, $ = (h, p, T) => {
149
+ }, $ = (p, m, R) => {
150
150
  if (!t) return;
151
- const O = ++L, x = u(h), C = p && d.has(x) ? d.get(x) : { x: 0, y: 0 };
152
- let k = 0;
153
- const _ = () => {
154
- if (!t || T !== M || O !== L)
151
+ const M = ++b, L = u(p), C = m && f.has(L) ? f.get(L) : { x: 0, y: 0 };
152
+ let x = 0;
153
+ const N = () => {
154
+ if (!t || R !== E || M !== b)
155
155
  return;
156
- p || d.set(x, C), t.scrollTo({
156
+ m || f.set(L, C), t.scrollTo({
157
157
  top: C.y,
158
158
  left: C.x
159
- }), !(Math.abs(t.scrollTop - C.y) < 1 && Math.abs(t.scrollLeft - C.x) < 1) && k < zt && (k++, requestAnimationFrame(_));
159
+ }), !(Math.abs(t.scrollTop - C.y) < 1 && Math.abs(t.scrollLeft - C.x) < 1) && x < zt && (x++, requestAnimationFrame(N));
160
160
  };
161
- requestAnimationFrame(_);
161
+ requestAnimationFrame(N);
162
162
  };
163
163
  return {
164
- initializeContext: (h, p, T) => {
165
- S = !0;
166
- const O = g === p ? M : ++M;
167
- v = h, t || (t = Ft(h), i = r(), c = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
168
- i = r();
169
- }).observe(t), (t === document.documentElement ? window : t).addEventListener("scroll", Y, {
164
+ initializeContext: (p, m, R) => {
165
+ w = !0;
166
+ const M = y === m ? E : ++E;
167
+ h = p, t || (t = Ft(p), i = s(), a = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
168
+ i = s();
169
+ }).observe(t), (t === document.documentElement ? window : t).addEventListener("scroll", z, {
170
170
  passive: !0
171
- })), g = p;
172
- const x = u(p), C = d.get(x), k = (F) => {
173
- O === M && (I = O, F && C && d.set(x, C), $(p, F, O));
171
+ })), y = m;
172
+ const L = u(m), C = f.get(L), x = (F) => {
173
+ M === E && (_ = M, F && C && f.set(L, C), $(m, F, M));
174
174
  };
175
- T !== void 0 ? k(T) : requestAnimationFrame(() => {
176
- I !== O && O === M && k(!1);
175
+ R !== void 0 ? x(R) : requestAnimationFrame(() => {
176
+ _ !== M && M === E && x(!1);
177
177
  });
178
- let _ = 0;
179
- const G = () => {
180
- O === M && (_++, _ >= qt ? S = !1 : requestAnimationFrame(G));
178
+ let N = 0;
179
+ const V = () => {
180
+ M === E && (N++, N >= qt ? w = !1 : requestAnimationFrame(V));
181
181
  };
182
- return requestAnimationFrame(G), k;
182
+ return requestAnimationFrame(V), x;
183
183
  },
184
- calculateScrollOffset: (h, p, T = !1) => {
185
- const O = h ? u(h) : null, x = O && d.has(O) ? d.get(O) : { x: 0, y: 0 }, C = p && T ? u(p) : null, k = C && d.has(C) ? d.get(C) : { x: 0, y: 0 };
184
+ calculateScrollOffset: (p, m, R = !1) => {
185
+ const M = p ? u(p) : null, L = M && f.has(M) ? f.get(M) : { x: 0, y: 0 }, C = m && R ? u(m) : null, x = C && f.has(C) ? f.get(C) : { x: 0, y: 0 };
186
186
  return {
187
- x: -k.x + x.x,
188
- y: -k.y + x.y
187
+ x: -x.x + L.x,
188
+ y: -x.y + L.y
189
189
  };
190
190
  },
191
- evictScrollPosition: (h) => {
192
- d.delete(u(h));
191
+ evictScrollPosition: (p) => {
192
+ f.delete(u(p));
193
193
  },
194
194
  getScrollContainer: () => t,
195
- getPositionedParentElement: () => v ? Bt(v) : document.body,
196
- getScrollPosition: (h, p = !0) => {
197
- if (!p) return { x: 0, y: 0 };
198
- const T = h ? u(h) : null;
199
- return T && d.has(T) ? d.get(T) : { x: 0, y: 0 };
195
+ getPositionedParentElement: () => h ? Bt(h) : document.body,
196
+ getScrollPosition: (p, m = !0) => {
197
+ if (!m) return { x: 0, y: 0 };
198
+ const R = p ? u(p) : null;
199
+ return R && f.has(R) ? f.get(R) : { x: 0, y: 0 };
200
200
  },
201
201
  // Exposed so a functional `transitions` config can branch on device class.
202
- getIsMobile: f
202
+ getIsMobile: c
203
203
  };
204
204
  }
205
- const vt = 30, bt = 8, Et = 1.2, wt = 30, Vt = 600;
205
+ const vt = 30, wt = 8, bt = 1.2, Et = 30, Vt = 600;
206
206
  function Kt() {
207
- let n = null, e = !1, t = !1, i = null, c = null, r = !1;
208
- const f = (y, b) => {
209
- for (let P = 0; P < y.length; P++) {
210
- const R = y.item(P);
211
- if (R && R.identifier === b) return R;
207
+ let n = null, e = !1, t = !1, i = null, a = null, s = !1;
208
+ const c = (g, S) => {
209
+ for (let k = 0; k < g.length; k++) {
210
+ const O = g.item(k);
211
+ if (O && O.identifier === S) return O;
212
212
  }
213
213
  return null;
214
214
  }, u = () => {
215
215
  i !== null && (clearTimeout(i), i = null);
216
- }, v = () => {
217
- c !== null && (clearTimeout(c), c = null);
218
- }, d = () => {
219
- e = !0, t = !0, u(), v(), i = setTimeout(() => {
216
+ }, h = () => {
217
+ a !== null && (clearTimeout(a), a = null);
218
+ }, f = () => {
219
+ e = !0, t = !0, u(), h(), i = setTimeout(() => {
220
220
  e = !1, t = !1, i = null;
221
221
  }, Vt);
222
- }, g = (y) => {
223
- if (y.touches.length !== 1) {
222
+ }, y = (g) => {
223
+ if (g.touches.length !== 1) {
224
224
  n = null;
225
225
  return;
226
226
  }
227
- const b = y.touches.item(0);
228
- if (!b) {
227
+ const S = g.touches.item(0);
228
+ if (!S) {
229
229
  n = null;
230
230
  return;
231
231
  }
232
- const P = window.innerWidth, R = b.clientX <= vt, H = b.clientX >= P - vt;
233
- if (!R && !H) {
232
+ const k = window.innerWidth, O = S.clientX <= vt, H = S.clientX >= k - vt;
233
+ if (!O && !H) {
234
234
  n = null;
235
235
  return;
236
236
  }
237
237
  n = {
238
- identifier: b.identifier,
239
- startX: b.clientX,
240
- startY: b.clientY,
241
- fromLeftEdge: R,
238
+ identifier: S.identifier,
239
+ startX: S.clientX,
240
+ startY: S.clientY,
241
+ fromLeftEdge: O,
242
242
  moved: !1
243
243
  };
244
- }, S = (y) => {
244
+ }, w = (g) => {
245
245
  if (!n) return;
246
- if (y.touches.length !== 1) {
246
+ if (g.touches.length !== 1) {
247
247
  n = null;
248
248
  return;
249
249
  }
250
- const b = f(y.touches, n.identifier);
251
- if (!b) {
250
+ const S = c(g.touches, n.identifier);
251
+ if (!S) {
252
252
  n = null;
253
253
  return;
254
254
  }
255
- const P = b.clientX - n.startX, R = b.clientY - n.startY, H = Math.abs(P), h = Math.abs(R);
256
- if (h > bt && h > H * Et) {
255
+ const k = S.clientX - n.startX, O = S.clientY - n.startY, H = Math.abs(k), p = Math.abs(O);
256
+ if (p > wt && p > H * bt) {
257
257
  n = null;
258
258
  return;
259
259
  }
260
- const p = n.fromLeftEdge ? P > 0 : P < 0;
261
- H > bt && H > h * Et && p && (n.moved = !0);
262
- }, M = (y) => {
260
+ const m = n.fromLeftEdge ? k > 0 : k < 0;
261
+ H > wt && H > p * bt && m && (n.moved = !0);
262
+ }, E = (g) => {
263
263
  if (!n) return;
264
- const b = f(y.changedTouches, n.identifier);
265
- if (!b) {
264
+ const S = c(g.changedTouches, n.identifier);
265
+ if (!S) {
266
266
  n = null;
267
267
  return;
268
268
  }
269
- const P = b.clientX - n.startX, R = n.fromLeftEdge ? P > 0 : P < 0;
270
- if (n.moved && R && Math.abs(P) >= wt) {
271
- d(), n = null;
269
+ const k = S.clientX - n.startX, O = n.fromLeftEdge ? k > 0 : k < 0;
270
+ if (n.moved && O && Math.abs(k) >= Et) {
271
+ f(), n = null;
272
272
  return;
273
273
  }
274
- n.moved && Math.abs(P) >= wt && d(), n = null;
275
- }, L = () => {
276
- n && (n.moved && d(), n = null);
274
+ n.moved && Math.abs(k) >= Et && f(), n = null;
275
+ }, b = () => {
276
+ n && (n.moved && f(), n = null);
277
277
  };
278
278
  return { initialize: () => {
279
- if (typeof window > "u" || r) return;
280
- r = !0;
281
- const y = { passive: !0, capture: !0 };
282
- window.addEventListener("touchstart", g, y), window.addEventListener("touchmove", S, y), window.addEventListener("touchend", M, y), window.addEventListener("touchcancel", L, y);
279
+ if (typeof window > "u" || s) return;
280
+ s = !0;
281
+ const g = { passive: !0, capture: !0 };
282
+ window.addEventListener("touchstart", y, g), window.addEventListener("touchmove", w, g), window.addEventListener("touchend", E, g), window.addEventListener("touchcancel", b, g);
283
283
  }, destroy: () => {
284
- if (typeof window > "u" || !r) return;
285
- r = !1;
286
- const y = { capture: !0 };
287
- window.removeEventListener("touchstart", g, y), window.removeEventListener("touchmove", S, y), window.removeEventListener("touchend", M, y), window.removeEventListener("touchcancel", L, y), u(), v(), n = null, e = !1, t = !1;
284
+ if (typeof window > "u" || !s) return;
285
+ s = !1;
286
+ const g = { capture: !0 };
287
+ window.removeEventListener("touchstart", y, g), window.removeEventListener("touchmove", w, g), window.removeEventListener("touchend", E, g), window.removeEventListener("touchcancel", b, g), u(), h(), n = null, e = !1, t = !1;
288
288
  }, isSwipeBack: () => {
289
- const y = e || t;
290
- return y && u(), y;
289
+ const g = e || t;
290
+ return g && u(), g;
291
291
  }, onPageEnter: () => {
292
- e = !1, u(), v(), c = setTimeout(() => {
293
- t = !1, c = null;
292
+ e = !1, u(), h(), a = setTimeout(() => {
293
+ t = !1, a = null;
294
294
  }, 0);
295
295
  } };
296
296
  }
297
297
  function Ut() {
298
- let n = !1;
299
- const e = () => {
300
- n = !0;
298
+ let n = null, e = null, t = null;
299
+ const i = () => {
300
+ t !== null && clearTimeout(t), t = null;
301
+ }, a = (b) => {
302
+ n = b, e = b, i(), t = setTimeout(() => {
303
+ e === b && (e = null, n === b && (n = null), t = null);
304
+ }, 1e3);
305
+ }, s = () => {
306
+ if (e !== null) {
307
+ e = null, i();
308
+ return;
309
+ }
310
+ n = "backward";
301
311
  };
302
- return typeof window < "u" && window.addEventListener("popstate", e, !0), {
303
- resolve(t, i) {
304
- const c = n ? "backward" : "forward";
305
- return n = !1, c;
312
+ let c = null, u = null, h = null, f = null, y = null, w = null, E = null;
313
+ return typeof window < "u" && (window.addEventListener("popstate", s, !0), c = window.history, u = c.back, h = c.forward, f = c.go, y = () => (a("backward"), u == null ? void 0 : u.call(c)), w = () => (a("forward"), h == null ? void 0 : h.call(c)), E = (b = 0) => (b < 0 ? a("backward") : b > 0 && a("forward"), f == null ? void 0 : f.call(c, b)), c.back = y, c.forward = w, c.go = E), {
314
+ resolve(b, _) {
315
+ const z = n ?? "forward";
316
+ return n = null, z;
306
317
  },
307
318
  dispose() {
308
- typeof window < "u" && window.removeEventListener("popstate", e, !0);
319
+ i(), typeof window < "u" && window.removeEventListener("popstate", s, !0), c && (c.back === y && u && (c.back = u), c.forward === w && h && (c.forward = h), c.go === E && f && (c.go = f));
309
320
  }
310
321
  };
311
322
  }
312
323
  function Yt(n = {}) {
313
324
  let e = null, t = null;
314
325
  function i() {
315
- var r, f;
316
- e && ((r = e.out) == null || r.resolve(null), (f = e.in) == null || f.resolve(null), e = null);
326
+ var s, c;
327
+ e && ((s = e.out) == null || s.resolve(null), (c = e.in) == null || c.resolve(null), e = null);
317
328
  }
318
- function c() {
329
+ function a() {
319
330
  if (e != null && e.out && e.in) {
320
331
  if (e.out.path === e.in.path) {
321
332
  i();
322
333
  return;
323
334
  }
324
- const r = {
335
+ const s = {
325
336
  from: e.out.path,
326
337
  to: e.in.path,
327
338
  out: e.out.payload,
328
339
  in: e.in.payload
329
340
  };
330
- t = r, e.out.resolve(r), e.in.resolve(r), e = null;
341
+ t = s, e.out.resolve(s), e.in.resolve(s), e = null;
331
342
  }
332
343
  }
333
344
  return {
334
- arrive(r, f, u) {
335
- return new Promise((v) => {
336
- var M, L;
337
- const d = t === null ? null : f === "out" ? { path: t.from, payload: t.out } : { path: t.to, payload: t.in };
338
- if ((d == null ? void 0 : d.path) === r) {
339
- v(null);
345
+ arrive(s, c, u) {
346
+ return new Promise((h) => {
347
+ var E, b;
348
+ const f = t === null ? null : c === "out" ? { path: t.from, payload: t.out } : { path: t.to, payload: t.in };
349
+ if ((f == null ? void 0 : f.path) === s) {
350
+ h(null);
340
351
  return;
341
352
  }
342
- f === "out" && ((M = e == null ? void 0 : e.in) == null ? void 0 : M.path) === r && !e.out && (e.in.resolve(null), e.in = void 0);
343
- const g = e == null ? void 0 : e[f];
344
- g && g.path !== r && i(), e || (e = {});
345
- const S = e[f];
346
- if (S) {
347
- if (((L = n.keepCurrent) == null ? void 0 : L.call(n, {
348
- type: f,
349
- path: r,
350
- current: S.payload,
353
+ c === "out" && ((E = e == null ? void 0 : e.in) == null ? void 0 : E.path) === s && !e.out && (e.in.resolve(null), e.in = void 0);
354
+ const y = e == null ? void 0 : e[c];
355
+ y && y.path !== s && i(), e || (e = {});
356
+ const w = e[c];
357
+ if (w) {
358
+ if (((b = n.keepCurrent) == null ? void 0 : b.call(n, {
359
+ type: c,
360
+ path: s,
361
+ current: w.payload,
351
362
  next: u
352
363
  })) ?? !1) {
353
- v(null);
364
+ h(null);
354
365
  return;
355
366
  }
356
- S.resolve(null);
367
+ w.resolve(null);
357
368
  }
358
- e[f] = { path: r, payload: u, resolve: v }, c();
369
+ e[c] = { path: s, payload: u, resolve: h }, a();
359
370
  });
360
371
  },
361
- cancel(r) {
362
- (e != null && e.out && r(e.out.payload) || e != null && e.in && r(e.in.payload)) && i(), (t && r(t.out) || t && r(t.in)) && (t = null);
372
+ cancel(s) {
373
+ (e != null && e.out && s(e.out.payload) || e != null && e.in && s(e.in.payload)) && i(), (t && s(t.out) || t && s(t.in)) && (t = null);
363
374
  }
364
375
  };
365
376
  }
366
- const $t = {}, q = /* @__PURE__ */ new Map();
377
+ const $t = {}, G = /* @__PURE__ */ new Map();
367
378
  let Q = null, St = !1;
368
- function Mt(n, e, t) {
369
- n instanceof HTMLElement && q.has(n) && !n.isConnected && t.set(n, { entry: q.get(n), anchor: e });
379
+ function Rt(n, e, t) {
380
+ n instanceof HTMLElement && G.has(n) && !n.isConnected && t.set(n, { entry: G.get(n), anchor: e });
370
381
  for (const i of Array.from(n.childNodes))
371
- Mt(i, e, t);
382
+ Rt(i, e, t);
372
383
  }
373
384
  function Zt(n) {
374
385
  const e = new Set(
375
386
  Array.from(n.values(), ({ entry: t }) => t)
376
387
  );
377
- for (const [t, { entry: i, anchor: c }] of n) {
378
- q.delete(t);
379
- let r = i.parent, f = !1;
380
- for (; r; ) {
381
- if (r.group === i.group && e.has(r)) {
382
- f = !0;
388
+ for (const [t, { entry: i, anchor: a }] of n) {
389
+ G.delete(t);
390
+ let s = i.parent, c = !1;
391
+ for (; s; ) {
392
+ if (s.group === i.group && e.has(s)) {
393
+ c = !0;
383
394
  break;
384
395
  }
385
- r = r.parent;
396
+ s = s.parent;
386
397
  }
387
- queueMicrotask(() => i.callback(c, { emit: !f }));
398
+ queueMicrotask(() => i.callback(a, { emit: !c }));
388
399
  }
389
400
  }
390
401
  function jt() {
@@ -392,12 +403,12 @@ function jt() {
392
403
  St = !0, Q = new MutationObserver((e) => {
393
404
  const t = /* @__PURE__ */ new Map();
394
405
  for (const i of e) {
395
- const c = {
406
+ const a = {
396
407
  parent: i.target,
397
408
  nextSibling: i.nextSibling
398
409
  };
399
- for (const r of Array.from(i.removedNodes))
400
- Mt(r, c, t);
410
+ for (const s of Array.from(i.removedNodes))
411
+ Rt(s, a, t);
401
412
  }
402
413
  Zt(t);
403
414
  });
@@ -408,28 +419,28 @@ function jt() {
408
419
  }
409
420
  function Jt(n, e, t = $t) {
410
421
  jt();
411
- let i = n.parentElement, c = null;
422
+ let i = n.parentElement, a = null;
412
423
  for (; i; ) {
413
- const r = q.get(i);
414
- if ((r == null ? void 0 : r.group) === t) {
415
- c = r;
424
+ const s = G.get(i);
425
+ if ((s == null ? void 0 : s.group) === t) {
426
+ a = s;
416
427
  break;
417
428
  }
418
429
  i = i.parentElement;
419
430
  }
420
- return q.set(n, {
431
+ return G.set(n, {
421
432
  element: n,
422
433
  callback: e,
423
434
  group: t,
424
- parent: c
435
+ parent: a
425
436
  }), () => {
426
- q.delete(n);
437
+ G.delete(n);
427
438
  };
428
439
  }
429
440
  const at = /* @__PURE__ */ new WeakMap();
430
441
  let tt = null;
431
442
  const et = "none !important";
432
- function U(n) {
443
+ function Y(n) {
433
444
  const e = n.style.getPropertyValue("display");
434
445
  return n.style.getPropertyPriority("display") ? `${e} !important` : e;
435
446
  }
@@ -438,13 +449,13 @@ function Qt() {
438
449
  for (const e of n) {
439
450
  const t = e.target, i = at.get(t);
440
451
  if (!i) continue;
441
- const c = U(t);
442
- c !== i.accounted && (i.accounted = c, c === et ? (i.reactHidden = !0, i.onHide()) : c !== "none" && i.reactHidden && (i.reactHidden = !1, i.onShow()));
452
+ const a = Y(t);
453
+ a !== i.accounted && (i.accounted = a, a === et ? (i.reactHidden = !0, i.onHide()) : a !== "none" && i.reactHidden && (i.reactHidden = !1, i.onShow()));
443
454
  }
444
455
  }), tt);
445
456
  }
446
457
  function te(n, e) {
447
- const t = U(n), i = {
458
+ const t = Y(n), i = {
448
459
  accounted: t,
449
460
  reactHidden: t === et,
450
461
  onHide: e.onHide,
@@ -455,17 +466,17 @@ function te(n, e) {
455
466
  attributeFilter: ["style"]
456
467
  }), {
457
468
  get isHidden() {
458
- return U(n) === et;
469
+ return Y(n) === et;
459
470
  },
460
- setDisplay(c, r = !1) {
461
- c === null ? n.style.removeProperty("display") : n.style.setProperty(
471
+ setDisplay(a, s = !1) {
472
+ a === null ? n.style.removeProperty("display") : n.style.setProperty(
462
473
  "display",
463
- c,
464
- r ? "important" : ""
465
- ), i.accounted = U(n);
474
+ a,
475
+ s ? "important" : ""
476
+ ), i.accounted = Y(n);
466
477
  },
467
478
  sync() {
468
- i.accounted = U(n), i.reactHidden = i.accounted === et;
479
+ i.accounted = Y(n), i.reactHidden = i.accounted === et;
469
480
  },
470
481
  stop() {
471
482
  at.delete(n);
@@ -473,73 +484,73 @@ function te(n, e) {
473
484
  };
474
485
  }
475
486
  function de(n, e = {}) {
476
- const { transitions: t = [], middleware: i = (o, s) => ({ from: o, to: s }) } = n, c = e.host ?? new It(), r = {}, f = Yt({
487
+ const { transitions: t = [], middleware: i = (o, r) => ({ from: o, to: r }) } = n, a = e.host ?? new It(), s = {}, c = Yt({
477
488
  // Nested boundaries can be discovered in separate MutationObserver
478
489
  // batches (notably when Suspense reveals a child later). When the same
479
490
  // side/path repeats before pairing, the outermost DOM boundary owns it.
480
- keepCurrent: ({ current: o, next: s }) => o.element.contains(s.element)
481
- }), u = Ut(), v = typeof t == "function" ? t : () => t, d = Kt();
482
- d.initialize();
483
- const g = /* @__PURE__ */ new Map(), S = (o) => {
484
- let s = g.get(o);
485
- return s === void 0 && (s = i(o, o).from, g.set(o, s)), s;
491
+ keepCurrent: ({ current: o, next: r }) => o.element.contains(r.element)
492
+ }), u = Ut(), h = typeof t == "function" ? t : () => t, f = Kt();
493
+ f.initialize();
494
+ const y = /* @__PURE__ */ new Map(), w = (o) => {
495
+ let r = y.get(o);
496
+ return r === void 0 && (r = i(o, o).from, y.set(o, r)), r;
486
497
  }, {
487
- initializeContext: M,
488
- calculateScrollOffset: L,
489
- evictScrollPosition: I,
490
- getScrollContainer: Y,
498
+ initializeContext: E,
499
+ calculateScrollOffset: b,
500
+ evictScrollPosition: _,
501
+ getScrollContainer: z,
491
502
  getPositionedParentElement: $,
492
503
  getScrollPosition: Z,
493
- getIsMobile: y
494
- } = Gt({ resolvePath: S }), b = /* @__PURE__ */ new Map(), P = () => {
495
- const o = y();
496
- let s = b.get(o);
497
- return s || (s = v({ isMobile: o }), b.set(o, s)), s;
498
- }, R = /* @__PURE__ */ new WeakMap(), H = (o) => {
499
- R.set(o, {
504
+ getIsMobile: g
505
+ } = Gt({ resolvePath: w }), S = /* @__PURE__ */ new Map(), k = () => {
506
+ const o = g();
507
+ let r = S.get(o);
508
+ return r || (r = h({ isMobile: o }), S.set(o, r)), r;
509
+ }, O = /* @__PURE__ */ new WeakMap(), H = (o) => {
510
+ O.set(o, {
500
511
  parent: o.parentNode,
501
512
  nextSibling: o.nextSibling
502
513
  });
503
- }, h = (o) => {
504
- const s = R.get(o);
505
- return s || {
514
+ }, p = (o) => {
515
+ const r = O.get(o);
516
+ return r || {
506
517
  parent: o.parentNode,
507
518
  nextSibling: o.nextSibling
508
519
  };
509
- }, p = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap();
510
- let O = 0;
511
- const x = (o) => {
512
- const s = typeof getComputedStyle < "u" ? getComputedStyle(o).display : "";
513
- return s && s !== "none" ? s : "block";
514
- }, C = (o, s) => {
515
- s.visibleDisplay = o.style.getPropertyValue("display"), s.computedDisplay = x(o);
516
- }, k = (o, s) => {
517
- if (T.get(o) !== s) return;
518
- T.delete(o);
519
- const l = p.get(o);
520
+ }, m = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
521
+ let M = 0;
522
+ const L = (o) => {
523
+ const r = typeof getComputedStyle < "u" ? getComputedStyle(o).display : "";
524
+ return r && r !== "none" ? r : "block";
525
+ }, C = (o, r) => {
526
+ r.visibleDisplay = o.style.getPropertyValue("display"), r.computedDisplay = L(o);
527
+ }, x = (o, r) => {
528
+ if (R.get(o) !== r) return;
529
+ R.delete(o);
530
+ const l = m.get(o);
520
531
  l && (l.savedCss !== null && (o.style.cssText = l.savedCss, l.savedCss = null), l.intent === "hidden" ? l.vis.setDisplay("none", !0) : l.visibleDisplay ? (l.vis.setDisplay(l.visibleDisplay, !1), C(o, l)) : (l.vis.setDisplay(null), C(o, l)));
521
- }, _ = (o, s) => {
532
+ }, N = (o, r) => {
522
533
  if (o.mode !== "hidden") return;
523
534
  const l = Array.from(
524
- new Set([o.element, s == null ? void 0 : s.element].filter(Boolean))
525
- ), w = ++O;
526
- for (const a of l) T.set(a, w);
527
- c.complete();
528
- for (const a of l) k(a, w);
529
- }, G = (o, s, l, w, a, m, E) => {
530
- const N = a.element, A = m.element, B = (a.mode ?? "unmount") === "hidden", { parent: W, nextSibling: z } = a.parent ? { parent: a.parent, nextSibling: a.nextSibling } : h(N), j = L(
535
+ new Set([o.element, r == null ? void 0 : r.element].filter(Boolean))
536
+ ), P = ++M;
537
+ for (const d of l) R.set(d, P);
538
+ a.complete();
539
+ for (const d of l) x(d, P);
540
+ }, V = (o, r, l, P, d, v, T) => {
541
+ const I = d.element, A = v.element, B = (d.mode ?? "unmount") === "hidden", { parent: W, nextSibling: q } = d.parent ? { parent: d.parent, nextSibling: d.nextSibling } : p(I), j = b(
531
542
  l,
532
- w,
533
- E.to
543
+ P,
544
+ T.to
534
545
  ), it = {
535
- direction: s,
546
+ direction: r,
536
547
  scrollOffset: j,
537
548
  from: { scroll: Z(l) },
538
549
  to: {
539
- scroll: Z(w, E.to)
550
+ scroll: Z(P, T.to)
540
551
  },
541
552
  get scrollingElement() {
542
- return Y() || document.documentElement;
553
+ return z() || document.documentElement;
543
554
  },
544
555
  get positionedParent() {
545
556
  return $();
@@ -547,244 +558,244 @@ function de(n, e = {}) {
547
558
  };
548
559
  let D;
549
560
  if (B) {
550
- D = N, D.style.top = `${-1 * ((j == null ? void 0 : j.y) ?? 0)}px`;
551
- const X = p.get(A);
561
+ D = I, D.style.top = `${-1 * ((j == null ? void 0 : j.y) ?? 0)}px`;
562
+ const X = m.get(A);
552
563
  X && X.savedCss === null && (X.savedCss = A.style.cssText);
553
564
  } else
554
- D = N, Ht(D, it);
555
- E.from || I(l);
556
- const J = B ? ++O : 0;
557
- B && (T.set(A, J), T.set(N, J));
558
- const pt = Promise.resolve(D), yt = Promise.resolve(A), mt = [], kt = {
565
+ D = I, Ht(D, it);
566
+ T.from || _(l);
567
+ const J = B ? ++M : 0;
568
+ B && (R.set(A, J), R.set(I, J));
569
+ const pt = Promise.resolve(D), mt = Promise.resolve(A), yt = [], At = {
559
570
  from: pt,
560
- to: yt,
571
+ to: mt,
561
572
  context: it,
562
- createElement: ((X, st = "div") => {
563
- const V = document.createElement(st);
564
- return V.setAttribute("data-ssgoi-id", X), mt.push(V), V;
573
+ createElement: ((X, rt = "div") => {
574
+ const K = document.createElement(rt);
575
+ return K.setAttribute("data-ssgoi-id", X), yt.push(K), K;
565
576
  })
566
577
  }, xt = Promise.resolve(
567
- o.prepare ? o.prepare(kt) : {}
578
+ o.prepare ? o.prepare(At) : {}
568
579
  );
569
580
  Wt({
570
581
  from: pt,
571
- to: yt,
582
+ to: mt,
572
583
  extras: xt
573
- }).then(({ from: X, to: st, extras: V }) => {
574
- !B && W && (z && W.contains(z) ? W.insertBefore(D, z) : W.appendChild(D));
575
- const rt = o.animation({
584
+ }).then(({ from: X, to: rt, extras: K }) => {
585
+ !B && W && (q && W.contains(q) ? W.insertBefore(D, q) : W.appendChild(D));
586
+ const st = o.animation({
576
587
  from: X,
577
- to: st,
588
+ to: rt,
578
589
  context: it,
579
- ...V
580
- }), lt = rt.onComplete;
581
- rt.onComplete = () => {
582
- lt == null || lt(), B ? (k(N, J), k(A, J)) : D.parentNode && D.parentNode.removeChild(D);
583
- for (const ct of mt)
590
+ ...K
591
+ }), lt = st.onComplete;
592
+ st.onComplete = () => {
593
+ lt == null || lt(), B ? (x(I, J), x(A, J)) : D.parentNode && D.parentNode.removeChild(D);
594
+ for (const ct of yt)
584
595
  ct.parentNode && ct.parentNode.removeChild(ct);
585
- }, c.attach(rt);
596
+ }, a.attach(st);
586
597
  });
587
- }, F = (o, s, l) => {
588
- const w = d.isSwipeBack();
589
- f.arrive(o, s, l).then((a) => {
590
- var ot, B, W, z;
591
- if (s === "in" && d.onPageEnter(), !a) {
592
- s === "out" && _(l);
598
+ }, F = (o, r, l) => {
599
+ const P = f.isSwipeBack();
600
+ c.arrive(o, r, l).then((d) => {
601
+ var ot, B, W, q;
602
+ if (r === "in" && f.onPageEnter(), !d) {
603
+ r === "out" && N(l);
593
604
  return;
594
605
  }
595
- if (s !== "in") return;
596
- const { from: m, to: E } = i(
597
- a.from,
598
- a.to
599
- ), N = u.resolve(
600
- m,
601
- E
606
+ if (r !== "in") return;
607
+ const { from: v, to: T } = i(
608
+ d.from,
609
+ d.to
610
+ ), I = u.resolve(
611
+ v,
612
+ T
602
613
  ), A = _t(
603
- m,
604
- E,
605
- P(),
606
- N
614
+ v,
615
+ T,
616
+ k(),
617
+ I
607
618
  );
608
619
  if (!A) {
609
- (B = (ot = a.in).applyScrollPolicy) == null || B.call(ot, !1), I(a.from), _(a.out, a.in);
620
+ (B = (ot = d.in).applyScrollPolicy) == null || B.call(ot, !1), _(d.from), N(d.out, d.in);
610
621
  return;
611
622
  }
612
- if ((z = (W = a.in).applyScrollPolicy) == null || z.call(W, A.preserveScroll.to), w) {
613
- A.preserveScroll.from || I(a.from), _(a.out, a.in);
623
+ if ((q = (W = d.in).applyScrollPolicy) == null || q.call(W, A.preserveScroll.to), P) {
624
+ A.preserveScroll.from || _(d.from), N(d.out, d.in);
614
625
  return;
615
626
  }
616
- G(
627
+ V(
617
628
  A.transition,
618
629
  A.direction,
619
- a.from,
620
- a.to,
621
- a.out,
622
- a.in,
630
+ d.from,
631
+ d.to,
632
+ d.out,
633
+ d.in,
623
634
  A.preserveScroll
624
635
  );
625
636
  });
626
- }, ut = (o, s) => {
627
- const l = p.get(o);
637
+ }, ut = (o, r) => {
638
+ const l = m.get(o);
628
639
  if (!l) return;
629
- const w = l.intent === "hidden";
630
- if (l.intent = "hidden", l.savedCss === null && (l.savedCss = o.style.cssText), l.vis.setDisplay(l.computedDisplay || "block", !0), o.style.position = "absolute", o.style.width = "100%", o.style.left = "0", w) return;
631
- const a = h(o), m = {
640
+ const P = l.intent === "hidden";
641
+ if (l.intent = "hidden", l.savedCss === null && (l.savedCss = o.style.cssText), l.vis.setDisplay(l.computedDisplay || "block", !0), o.style.position = "absolute", o.style.width = "100%", o.style.left = "0", P) return;
642
+ const d = p(o), v = {
632
643
  element: o,
633
- parent: a.parent,
634
- nextSibling: a.nextSibling,
644
+ parent: d.parent,
645
+ nextSibling: d.nextSibling,
635
646
  mode: "hidden"
636
- }, E = l.pendingOutPath ?? l.currentPath ?? s;
637
- l.pendingOutPath = null, F(E, "out", m);
638
- }, Rt = (o, s) => {
639
- const l = p.get(o);
647
+ }, T = l.pendingOutPath ?? l.currentPath ?? r;
648
+ l.pendingOutPath = null, F(T, "out", v);
649
+ }, Mt = (o, r) => {
650
+ const l = m.get(o);
640
651
  if (!l || l.intent === "visible") return;
641
- l.intent = "visible", l.currentPath = o.getAttribute("data-ssgoi-transition") ?? l.currentPath ?? s, l.pendingOutPath = null, l.pathRevision++, C(o, l), l.savedCss !== null && (o.style.cssText = l.savedCss, l.visibleDisplay ? l.vis.setDisplay(l.visibleDisplay, !1) : l.vis.setDisplay(null));
642
- const w = l.currentPath, a = M(o, w), m = {
652
+ l.intent = "visible", l.currentPath = o.getAttribute("data-ssgoi-transition") ?? l.currentPath ?? r, l.pendingOutPath = null, l.pathRevision++, C(o, l), l.savedCss !== null && (o.style.cssText = l.savedCss, l.visibleDisplay ? l.vis.setDisplay(l.visibleDisplay, !1) : l.vis.setDisplay(null));
653
+ const P = l.currentPath, d = E(o, P), v = {
643
654
  element: o,
644
655
  parent: o.parentElement,
645
656
  nextSibling: o.nextElementSibling,
646
- applyScrollPolicy: a
657
+ applyScrollPolicy: d
647
658
  };
648
- F(w, "in", m);
649
- }, At = (o, s, l, w = !0) => {
650
- const a = p.get(o), m = (a == null ? void 0 : a.pendingOutPath) ?? (a == null ? void 0 : a.currentPath) ?? s;
651
- if (a && (a.vis.stop(), p.delete(o), T.delete(o), a.intent === "hidden")) {
652
- f.cancel((A) => A.element === o);
659
+ F(P, "in", v);
660
+ }, Ot = (o, r, l, P = !0) => {
661
+ const d = m.get(o), v = (d == null ? void 0 : d.pendingOutPath) ?? (d == null ? void 0 : d.currentPath) ?? r;
662
+ if (d && (d.vis.stop(), m.delete(o), R.delete(o), d.intent === "hidden")) {
663
+ c.cancel((A) => A.element === o);
653
664
  return;
654
665
  }
655
- if (!w) return;
656
- const E = l ?? h(o), N = {
666
+ if (!P) return;
667
+ const T = l ?? p(o), I = {
657
668
  element: o,
658
- parent: E.parent,
659
- nextSibling: E.nextSibling,
669
+ parent: T.parent,
670
+ nextSibling: T.nextSibling,
660
671
  mode: "unmount"
661
672
  };
662
- F(m, "out", N);
663
- }, dt = /* @__PURE__ */ new WeakSet(), ft = (o, s, { enter: l = !0 } = {}) => {
664
- if (dt.has(s)) {
665
- const m = p.get(s);
666
- if (m && m.currentPath !== o) {
667
- m.intent === "visible" && m.pendingOutPath === null && (m.pendingOutPath = m.currentPath), m.currentPath = o;
668
- const E = ++m.pathRevision;
673
+ F(v, "out", I);
674
+ }, dt = /* @__PURE__ */ new WeakSet(), ft = (o, r, { enter: l = !0 } = {}) => {
675
+ if (dt.has(r)) {
676
+ const v = m.get(r);
677
+ if (v && v.currentPath !== o) {
678
+ v.intent === "visible" && v.pendingOutPath === null && (v.pendingOutPath = v.currentPath), v.currentPath = o;
679
+ const T = ++v.pathRevision;
669
680
  queueMicrotask(() => {
670
- m.pathRevision === E && (m.pendingOutPath = null);
681
+ v.pathRevision === T && (v.pendingOutPath = null);
671
682
  });
672
683
  }
673
684
  return;
674
685
  }
675
- dt.add(s), H(s);
676
- const w = te(s, {
677
- onHide: () => ut(s, o),
678
- onShow: () => Rt(s, o)
679
- }), a = {
680
- vis: w,
686
+ dt.add(r), H(r);
687
+ const P = te(r, {
688
+ onHide: () => ut(r, o),
689
+ onShow: () => Mt(r, o)
690
+ }), d = {
691
+ vis: P,
681
692
  savedCss: null,
682
- intent: w.isHidden ? "hidden" : "visible",
693
+ intent: P.isHidden ? "hidden" : "visible",
683
694
  visibleDisplay: "",
684
695
  computedDisplay: "block",
685
696
  currentPath: o,
686
697
  pendingOutPath: null,
687
698
  pathRevision: 0
688
699
  };
689
- if (p.set(s, a), !w.isHidden && (C(s, a), l)) {
690
- const m = M(s, o), E = {
691
- element: s,
692
- parent: s.parentElement,
693
- nextSibling: s.nextElementSibling,
694
- applyScrollPolicy: m
700
+ if (m.set(r, d), !P.isHidden && (C(r, d), l)) {
701
+ const v = E(r, o), T = {
702
+ element: r,
703
+ parent: r.parentElement,
704
+ nextSibling: r.nextElementSibling,
705
+ applyScrollPolicy: v
695
706
  };
696
- F(o, "in", E);
707
+ F(o, "in", T);
697
708
  }
698
709
  Jt(
699
- s,
700
- (m, E) => At(s, o, m, (E == null ? void 0 : E.emit) ?? !0),
701
- r
710
+ r,
711
+ (v, T) => Ot(r, o, v, (T == null ? void 0 : T.emit) ?? !0),
712
+ s
702
713
  );
703
714
  }, ht = /* @__PURE__ */ new Map();
704
715
  return { register: ft, refFor: (o) => {
705
- let s = ht.get(o);
706
- return s || (s = (l) => {
716
+ let r = ht.get(o);
717
+ return r || (r = (l) => {
707
718
  l && ft(o, l);
708
- }, ht.set(o, s)), s;
719
+ }, ht.set(o, r)), r;
709
720
  } };
710
721
  }
711
- const Ot = "data-ssgoi-root", ee = `[${Ot}]`, nt = "data-ssgoi-transition", Pt = `[${nt}]`, ne = "[data-ssgoi-clone]";
722
+ const Ct = "data-ssgoi-root", ee = `[${Ct}]`, nt = "data-ssgoi-transition", Tt = `[${nt}]`, ne = "[data-ssgoi-clone]";
712
723
  function oe() {
713
724
  return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
714
725
  }
715
726
  function ie(n) {
716
727
  return n.nodeType === Node.ELEMENT_NODE;
717
728
  }
718
- function se(n) {
729
+ function re(n) {
719
730
  return n instanceof HTMLElement;
720
731
  }
721
- function Tt(n) {
732
+ function Pt(n) {
722
733
  let e = 0, t = n.parentElement;
723
734
  for (; t; )
724
735
  e++, t = t.parentElement;
725
736
  return e;
726
737
  }
727
- function Ct(n, e, t = n) {
738
+ function kt(n, e, t = n) {
728
739
  const i = Array.from(n).sort(
729
- (c, r) => Tt(c) - Tt(r)
740
+ (a, s) => Pt(a) - Pt(s)
730
741
  );
731
- for (const c of i) {
732
- const r = c.getAttribute(nt);
733
- if (r === null) continue;
734
- let f = c.parentElement, u = !1;
735
- for (; f; ) {
736
- if (t.has(f)) {
742
+ for (const a of i) {
743
+ const s = a.getAttribute(nt);
744
+ if (s === null) continue;
745
+ let c = a.parentElement, u = !1;
746
+ for (; c; ) {
747
+ if (t.has(c)) {
737
748
  u = !0;
738
749
  break;
739
750
  }
740
- f = f.parentElement;
751
+ c = c.parentElement;
741
752
  }
742
- e.register(r, c, { enter: !u });
753
+ e.register(s, a, { enter: !u });
743
754
  }
744
755
  }
745
756
  function fe(n, e) {
746
757
  if (!oe()) return () => {
747
758
  };
748
- n.setAttribute(Ot, "");
749
- const t = (u) => u.closest(ee) === n, i = (u) => !se(u) || !t(u) || u.closest(ne) || u.getAttribute(nt) === null ? null : u, c = (u, v) => {
759
+ n.setAttribute(Ct, "");
760
+ const t = (u) => u.closest(ee) === n, i = (u) => !re(u) || !t(u) || u.closest(ne) || u.getAttribute(nt) === null ? null : u, a = (u, h) => {
750
761
  if (ie(u)) {
751
- if (u.matches(Pt)) {
752
- const d = i(u);
753
- d && v.add(d);
762
+ if (u.matches(Tt)) {
763
+ const f = i(u);
764
+ f && h.add(f);
754
765
  }
755
- for (const d of u.querySelectorAll(Pt)) {
756
- const g = i(d);
757
- g && v.add(g);
766
+ for (const f of u.querySelectorAll(Tt)) {
767
+ const y = i(f);
768
+ y && h.add(y);
758
769
  }
759
770
  }
760
- }, r = new MutationObserver((u) => {
761
- const v = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
762
- for (const g of u) {
763
- if (g.type === "attributes") {
764
- const S = i(g.target);
765
- S && v.add(S);
771
+ }, s = new MutationObserver((u) => {
772
+ const h = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
773
+ for (const y of u) {
774
+ if (y.type === "attributes") {
775
+ const w = i(y.target);
776
+ w && h.add(w);
766
777
  continue;
767
778
  }
768
- for (const S of g.addedNodes)
769
- c(S, d);
779
+ for (const w of y.addedNodes)
780
+ a(w, f);
770
781
  }
771
- for (const g of d) v.add(g);
772
- Ct(v, e, d);
782
+ for (const y of f) h.add(y);
783
+ kt(h, e, f);
773
784
  });
774
- r.observe(n, {
785
+ s.observe(n, {
775
786
  childList: !0,
776
787
  subtree: !0,
777
788
  attributes: !0,
778
789
  attributeFilter: [nt]
779
790
  });
780
- const f = /* @__PURE__ */ new Set();
781
- return c(n, f), Ct(f, e), () => r.disconnect();
791
+ const c = /* @__PURE__ */ new Set();
792
+ return a(n, c), kt(c, e), () => s.disconnect();
782
793
  }
783
794
  export {
784
795
  Nt as Animation,
785
796
  It as HostAnimation,
786
- ye as MultiAnimation,
787
- me as WebAnimation,
797
+ me as MultiAnimation,
798
+ ye as WebAnimation,
788
799
  de as createSggoiTransitionContext,
789
800
  fe as observeSsgoiTransitions
790
801
  };
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-direction.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/navigation-direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACvD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,0BAA0B,CA2B7E"}
1
+ {"version":3,"file":"navigation-direction.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/navigation-direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACvD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,0BAA0B,CAwF7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/core",
3
- "version": "7.1.0-beta.1",
3
+ "version": "7.1.0-beta.2",
4
4
  "description": "Core animation engine for SSGOI - Native app-like page transitions with spring physics",
5
5
  "private": false,
6
6
  "type": "module",