@ssgoi/core 7.1.0-beta.1 → 7.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +673 -536
- package/dist/ssgoi-transition/browser-history.d.ts +13 -0
- package/dist/ssgoi-transition/browser-history.d.ts.map +1 -0
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-direction.d.ts +12 -9
- package/dist/ssgoi-transition/navigation-direction.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-transition.d.ts +9 -0
- package/dist/ssgoi-transition/navigation-transition.d.ts.map +1 -0
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,9 @@ Rule forms:
|
|
|
49
49
|
- `from`/`to`: precise pair. Reverse matching is enabled by default.
|
|
50
50
|
- `ordered`: array order decides forward and backward.
|
|
51
51
|
- `priority`: higher values win before path specificity.
|
|
52
|
+
- Web Back reverses the effect recorded for the exact visited entry pair;
|
|
53
|
+
Forward replays it. Fresh push/replace rematch these rules. Unrecorded returns
|
|
54
|
+
also rematch. See [history behavior](https://ssgoi.dev/llms/route-rules.txt).
|
|
52
55
|
- Scroll is automatic: `on` and `from`/`to` restore the forward `from` side
|
|
53
56
|
and reset `to`; `ordered` restores both. Use
|
|
54
57
|
`preserveScroll: { from: boolean, to: boolean }` for an exact override.
|
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 Fe=Object.defineProperty;var ze=(n,t,e)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var Y=(n,t,e)=>ze(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("./resolve-transition-rule-BL12rDDu.cjs"),oe=require("./multi-animation-B5hEmEgN.cjs");class Le extends oe.Animation{constructor(){super(...arguments);Y(this,"child",null);Y(this,"_state","idle");Y(this,"_settled",!1);Y(this,"listeners",new Set)}attach(e){const o=this.child;if(this.child=e,this._settled=!1,o){const d=o.getPose();o.complete(),e.matchInto(d)}e.playbackRate=this.playbackRate;const a=e.onComplete;e.onComplete=()=>{a==null||a(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const r=e.onUpdate;e.onUpdate=d=>{var s;r==null||r(d),(s=this.onUpdate)==null||s.call(this,d),this.notify()},this._state==="paused"?e.pause():this._state==="reversing"?e.reverse():(this._state="playing",e.play()),this.notify()}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.play(),this.notify()}reverse(){var e;this._state="reversing",this._settled=!1,(e=this.child)==null||e.reverse(),this.notify()}pause(){var e;this._state="paused",(e=this.child)==null||e.pause(),this.notify()}complete(){var e;(e=this.child)==null||e.complete(),this.notify()}get isAnimating(){var e;return((e=this.child)==null?void 0:e.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var e;return((e=this.child)==null?void 0:e.isReversing)??this._state==="reversing"}get progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var o;return((o=this.child)==null?void 0:o.findTimeForProgress(e))??null}get playbackRate(){return super.playbackRate}set playbackRate(e){super.playbackRate=e,this.child&&(this.child.playbackRate=e),this.notify()}getPose(){var e;return((e=this.child)==null?void 0:e.getPose())??[]}getTimeline(){var e;return((e=this.child)==null?void 0:e.getTimeline())??[]}matchInto(e){var o;(o=this.child)==null||o.matchInto(e)}get activeChild(){return this.child}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Xe=(n,t)=>{var e;n.style.position="absolute",n.style.width="100%",n.style.top=`${-1*(((e=t==null?void 0:t.scrollOffset)==null?void 0:e.y)??0)}px`,n.style.left="0"},Ee=new Set(["auto","scroll","overlay"]),qe=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t);if(Ee.has(e.overflowY)||Ee.has(e.overflowX))return t;t=t.parentElement}return document.documentElement},$e=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return t;t=t.parentElement}return document.body};function Ge(n){const t=Object.keys(n);return Promise.all(t.map(e=>n[e])).then(e=>{const o={};return t.forEach((a,r)=>{o[a]=e[r]}),o})}const Ke=768,Ue=10,Ve=10;function Ye(n={}){const{resolvePath:t=m=>m}=n;let e=null,o=!1,a=!1;const r=()=>{const m=(e==null?void 0:e.clientWidth)??0,g=m>0?m:typeof window<"u"?window.innerWidth:0;return g>0&&g<Ke},d=()=>(a||(o=r(),a=!0),o),s=m=>`path:${t(m)}`;let p=null;const u=new Map;let y=null,h=!1,S=0,v=0,E=0;const N=()=>{e&&y&&!h&&u.set(s(y),{x:e.scrollLeft,y:e.scrollTop})},_=(m,g,R)=>{if(!e)return;const M=++v,D=s(m),A=g&&u.has(D)?u.get(D):{x:0,y:0};let L=0;const W=()=>{if(!e||R!==S||M!==v)return;g||u.set(D,A),e.scrollTo({top:A.y,left:A.x}),!(Math.abs(e.scrollTop-A.y)<1&&Math.abs(e.scrollLeft-A.x)<1)&&L<Ue&&(L++,requestAnimationFrame(W))};requestAnimationFrame(W)};return{initializeContext:(m,g,R)=>{h=!0;const M=y===g?S:++S;p=m,e||(e=qe(m),o=r(),a=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{o=r()}).observe(e),(e===document.documentElement?window:e).addEventListener("scroll",N,{passive:!0})),y=g;const D=s(g),A=u.get(D),L=F=>{M===S&&(E=M,F&&A&&u.set(D,A),_(g,F,M))};R!==void 0?L(R):requestAnimationFrame(()=>{E!==M&&M===S&&L(!1)});let W=0;const K=()=>{M===S&&(W++,W>=Ve?h=!1:requestAnimationFrame(K))};return requestAnimationFrame(K),L},calculateScrollOffset:(m,g,R=!1)=>{const M=m?s(m):null,D=M&&u.has(M)?u.get(M):{x:0,y:0},A=g&&R?s(g):null,L=A&&u.has(A)?u.get(A):{x:0,y:0};return{x:-L.x+D.x,y:-L.y+D.y}},evictScrollPosition:m=>{u.delete(s(m))},getScrollContainer:()=>e,getPositionedParentElement:()=>p?$e(p):document.body,getScrollPosition:(m,g=!0)=>{if(!g)return{x:0,y:0};const R=m?s(m):null;return R&&u.has(R)?u.get(R):{x:0,y:0}},getIsMobile:d}}const Se=30,Pe=8,Te=1.2,ke=30,je=600;function Ze(){let n=null,t=!1,e=!1,o=null,a=null,r=!1;const d=(b,P)=>{for(let x=0;x<b.length;x++){const O=b.item(x);if(O&&O.identifier===P)return O}return null},s=()=>{o!==null&&(clearTimeout(o),o=null)},p=()=>{a!==null&&(clearTimeout(a),a=null)},u=()=>{t=!0,e=!0,s(),p(),o=setTimeout(()=>{t=!1,e=!1,o=null},je)},y=b=>{if(b.touches.length!==1){n=null;return}const P=b.touches.item(0);if(!P){n=null;return}const x=window.innerWidth,O=P.clientX<=Se,B=P.clientX>=x-Se;if(!O&&!B){n=null;return}n={identifier:P.identifier,startX:P.clientX,startY:P.clientY,fromLeftEdge:O,moved:!1}},h=b=>{if(!n)return;if(b.touches.length!==1){n=null;return}const P=d(b.touches,n.identifier);if(!P){n=null;return}const x=P.clientX-n.startX,O=P.clientY-n.startY,B=Math.abs(x),m=Math.abs(O);if(m>Pe&&m>B*Te){n=null;return}const g=n.fromLeftEdge?x>0:x<0;B>Pe&&B>m*Te&&g&&(n.moved=!0)},S=b=>{if(!n)return;const P=d(b.changedTouches,n.identifier);if(!P){n=null;return}const x=P.clientX-n.startX,O=n.fromLeftEdge?x>0:x<0;if(n.moved&&O&&Math.abs(x)>=ke){u(),n=null;return}n.moved&&Math.abs(x)>=ke&&u(),n=null},v=()=>{n&&(n.moved&&u(),n=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const b={passive:!0,capture:!0};window.addEventListener("touchstart",y,b),window.addEventListener("touchmove",h,b),window.addEventListener("touchend",S,b),window.addEventListener("touchcancel",v,b)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const b={capture:!0};window.removeEventListener("touchstart",y,b),window.removeEventListener("touchmove",h,b),window.removeEventListener("touchend",S,b),window.removeEventListener("touchcancel",v,b),s(),p(),n=null,t=!1,e=!1},isSwipeBack:()=>{const b=t||e;return b&&s(),b},onPageEnter:()=>{t=!1,s(),p(),a=setTimeout(()=>{e=!1,a=null},0)}}}const xe="__ssgoi_entry_v1",ue=new WeakMap,_e={read:()=>null,previous:()=>null,dispose(){}};function Je(){var r;if(typeof window>"u")return _e;const n=window.navigation;if((r=n==null?void 0:n.currentEntry)!=null&&r.key&&n.currentEntry.index>=0)return{read:()=>Re(n.currentEntry),previous:()=>{var s;const d=(s=n.currentEntry)==null?void 0:s.index;return Re(n.entries().find(p=>p.index===(d??0)-1))},dispose(){}};const t=window;let e=ue.get(t);e||(e=Qe(t),ue.set(t,e)),e.users++;const o=e;let a=!1;return{read:o.read,previous:o.previous,dispose(){a||(a=!0,--o.users===0&&(o.dispose(),ue.delete(t)))}}}function Re(n){return n&&typeof n.key=="string"&&typeof n.url=="string"&&Number.isSafeInteger(n.index)&&n.index>=0?{key:n.key,index:n.index,url:n.url}:null}function de(n){return n!==null&&typeof n=="object"&&Object.getPrototypeOf(n)===Object.prototype}function Qe(n){const t=n.history,e=t.pushState,o=t.replaceState,a=`${Date.now()}-${Math.random().toString(36).slice(2)}-`;let r=0,d=!0,s=null;const p=()=>{const v=t.state,E=de(v)?v[xe]:null;return!de(E)||typeof E.key!="string"||!E.key.startsWith(a)||!Number.isSafeInteger(E.index)?null:{key:E.key,index:E.index,url:n.location.href}},u=(v,E)=>v!==null&&!de(v)?v:{...v,[xe]:E},y=v=>({key:`${a}${++r}`,index:v});try{o.call(t,u(t.state,y(0)),"")}catch{return{..._e,users:0}}const h=function(v,E,N){if(!d)return e.call(this,v,E,N);const _=p(),$=y(((_==null?void 0:_.index)??0)+1);e.call(this,u(v,$),E,N),s=_},S=function(v,E,N){if(!d)return o.call(this,v,E,N);const _=p();o.call(this,u(v,_??y(0)),E,N)};return t.pushState=h,t.replaceState=S,{users:0,read:p,previous:()=>s,dispose(){d=!1,t.pushState===h&&(t.pushState=e),t.replaceState===S&&(t.replaceState=o)}}}function et(){let n=null,t=null;const e=new Set,o=r=>{r&&e.add(r.key),e.size>200&&e.delete(e.values().next().value)},a=()=>{n||(n=Je(),t=n.read(),o(t))};return{connect:a,resolve(r,d){a();const s=n.read();let p=t,u="unknown";if(p&&s&&(s.key===p.key||s.index===p.index?u="replace":s.index<p.index?u="back":u=e.has(s.key)?"forward":"push"),u==="push"){const y=n.previous();y&&y.index===s.index-1&&fe.normalizePath(new URL(y.url).pathname)===fe.normalizePath(r)&&(p=y)}return t=s,o(p),o(s),{kind:u,direction:u==="back"?"backward":"forward",from:p,to:s}},dispose(){n==null||n.dispose(),n=null,t=null,e.clear()}}}function tt(){const n=et(),t=new Map;return{connect:n.connect,resolve(e,o,a){var u,y;const r=n.resolve(e,o),d=(u=r.from)==null?void 0:u.key,s=(y=r.to)==null?void 0:y.key;if(r.kind==="back"&&d&&s){const h=t.get(d);if((h==null?void 0:h.source)===s&&h.from===o&&h.to===e)return h.rule?{...h.rule,direction:h.rule.direction==="forward"?"backward":"forward",preserveScroll:{from:h.rule.preserveScroll.to,to:h.rule.preserveScroll.from}}:null}if(r.kind==="forward"&&d&&s){const h=t.get(s);if((h==null?void 0:h.source)===d&&h.from===e&&h.to===o)return h.rule}const p=a(r.direction);if(s&&r.kind==="replace"&&t.delete(s),s&&d&&r.kind==="push"){for(const[h,S]of t)S.index>=r.to.index&&t.delete(h);t.set(s,{source:d,index:r.to.index,from:e,to:o,rule:p?{...p,preserveScroll:{...p.preserveScroll}}:null}),t.size>100&&t.delete(t.keys().next().value)}return p},dispose(){n.dispose(),t.clear()}}}function nt(n={}){let t=null,e=null;function o(){var r,d;t&&((r=t.out)==null||r.resolve(null),(d=t.in)==null||d.resolve(null),t=null)}function a(){if(t!=null&&t.out&&t.in){if(t.out.path===t.in.path){o();return}const r={from:t.out.path,to:t.in.path,out:t.out.payload,in:t.in.payload};e=r,t.out.resolve(r),t.in.resolve(r),t=null}}return{arrive(r,d,s){return new Promise(p=>{var S,v;const u=e===null?null:d==="out"?{path:e.from,payload:e.out}:{path:e.to,payload:e.in};if((u==null?void 0:u.path)===r){p(null);return}d==="out"&&((S=t==null?void 0:t.in)==null?void 0:S.path)===r&&!t.out&&(t.in.resolve(null),t.in=void 0);const y=t==null?void 0:t[d];y&&y.path!==r&&o(),t||(t={});const h=t[d];if(h){if(((v=n.keepCurrent)==null?void 0:v.call(n,{type:d,path:r,current:h.payload,next:s}))??!1){p(null);return}h.resolve(null)}t[d]={path:r,payload:s,resolve:p},a()})},cancel(r){(t!=null&&t.out&&r(t.out.payload)||t!=null&&t.in&&r(t.in.payload))&&o(),(e&&r(e.out)||e&&r(e.in))&&(e=null)}}}const ot={},G=new Map;let Q=null,Ae=!1;function De(n,t,e){n instanceof HTMLElement&&G.has(n)&&!n.isConnected&&e.set(n,{entry:G.get(n),anchor:t});for(const o of Array.from(n.childNodes))De(o,t,e)}function it(n){const t=new Set(Array.from(n.values(),({entry:e})=>e));for(const[e,{entry:o,anchor:a}]of n){G.delete(e);let r=o.parent,d=!1;for(;r;){if(r.group===o.group&&t.has(r)){d=!0;break}r=r.parent}queueMicrotask(()=>o.callback(a,{emit:!d}))}}function rt(){if(Ae||typeof document>"u")return;Ae=!0,Q=new MutationObserver(t=>{const e=new Map;for(const o of t){const a={parent:o.target,nextSibling:o.nextSibling};for(const r of Array.from(o.removedNodes))De(r,a,e)}it(e)});const n=()=>{Q==null||Q.observe(document.body,{childList:!0,subtree:!0})};document.body?n():document.addEventListener("DOMContentLoaded",n,{once:!0})}function st(n,t,e=ot){rt();let o=n.parentElement,a=null;for(;o;){const r=G.get(o);if((r==null?void 0:r.group)===e){a=r;break}o=o.parentElement}return G.set(n,{element:n,callback:t,group:e,parent:a}),()=>{G.delete(n)}}const pe=new WeakMap;let ee=null;const te="none !important";function j(n){const t=n.style.getPropertyValue("display");return n.style.getPropertyPriority("display")?`${t} !important`:t}function lt(){return ee||(ee=new MutationObserver(n=>{for(const t of n){const e=t.target,o=pe.get(e);if(!o)continue;const a=j(e);a!==o.accounted&&(o.accounted=a,a===te?(o.reactHidden=!0,o.onHide()):a!=="none"&&o.reactHidden&&(o.reactHidden=!1,o.onShow()))}}),ee)}function ct(n,t){const e=j(n),o={accounted:e,reactHidden:e===te,onHide:t.onHide,onShow:t.onShow};return pe.set(n,o),lt().observe(n,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return j(n)===te},setDisplay(a,r=!1){a===null?n.style.removeProperty("display"):n.style.setProperty("display",a,r?"important":""),o.accounted=j(n)},sync(){o.accounted=j(n),o.reactHidden=o.accounted===te},stop(){pe.delete(n)}}}function at(n,t={}){const{transitions:e=[],middleware:o=(i,l)=>({from:i,to:l})}=n,a=t.host??new Le,r={},d=nt({keepCurrent:({current:i,next:l})=>i.element.contains(l.element)}),s=tt(),p=typeof e=="function"?e:()=>e,u=Ze();u.initialize();const y=new Map,h=i=>{let l=y.get(i);return l===void 0&&(l=o(i,i).from,y.set(i,l)),l},{initializeContext:S,calculateScrollOffset:v,evictScrollPosition:E,getScrollContainer:N,getPositionedParentElement:_,getScrollPosition:$,getIsMobile:b}=Ye({resolvePath:h}),P=new Map,x=()=>{const i=b();let l=P.get(i);return l||(l=p({isMobile:i}),P.set(i,l)),l},O=new WeakMap,B=i=>{O.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},m=i=>{const l=O.get(i);return l||{parent:i.parentNode,nextSibling:i.nextSibling}},g=new WeakMap,R=new WeakMap;let M=0;const D=i=>{const l=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return l&&l!=="none"?l:"block"},A=(i,l)=>{l.visibleDisplay=i.style.getPropertyValue("display"),l.computedDisplay=D(i)},L=(i,l)=>{if(R.get(i)!==l)return;R.delete(i);const c=g.get(i);c&&(c.savedCss!==null&&(i.style.cssText=c.savedCss,c.savedCss=null),c.intent==="hidden"?c.vis.setDisplay("none",!0):c.visibleDisplay?(c.vis.setDisplay(c.visibleDisplay,!1),A(i,c)):(c.vis.setDisplay(null),A(i,c)))},W=(i,l)=>{if(i.mode!=="hidden")return;const c=Array.from(new Set([i.element,l==null?void 0:l.element].filter(Boolean))),T=++M;for(const f of c)R.set(f,T);a.complete();for(const f of c)L(f,T)},K=(i,l,c,T,f,w,k)=>{const C=f.element,H=w.element,z=(f.mode??"unmount")==="hidden",{parent:X,nextSibling:U}=f.parent?{parent:f.parent,nextSibling:f.nextSibling}:m(C),Z=v(c,T,k.to),re={direction:l,scrollOffset:Z,from:{scroll:$(c)},to:{scroll:$(T,k.to)},get scrollingElement(){return N()||document.documentElement},get positionedParent(){return _()}};let I;if(z){I=C,I.style.top=`${-1*((Z==null?void 0:Z.y)??0)}px`;const q=g.get(H);q&&q.savedCss===null&&(q.savedCss=H.style.cssText)}else I=C,Xe(I,re);k.from||E(c);const J=z?++M:0;z&&(R.set(H,J),R.set(C,J));const ve=Promise.resolve(I),be=Promise.resolve(H),we=[],We={from:ve,to:be,context:re,createElement:((q,se="div")=>{const V=document.createElement(se);return V.setAttribute("data-ssgoi-id",q),we.push(V),V})},Be=Promise.resolve(i.prepare?i.prepare(We):{});Ge({from:ve,to:be,extras:Be}).then(({from:q,to:se,extras:V})=>{!z&&X&&(U&&X.contains(U)?X.insertBefore(I,U):X.appendChild(I));const le=i.animation({from:q,to:se,context:re,...V}),ce=le.onComplete;le.onComplete=()=>{ce==null||ce(),z?(L(C,J),L(H,J)):I.parentNode&&I.parentNode.removeChild(I);for(const ae of we)ae.parentNode&&ae.parentNode.removeChild(ae)},a.attach(le)})},F=(i,l,c)=>{const T=u.isSwipeBack();d.arrive(i,l,c).then(f=>{var H,ie,z,X;if(l==="in"&&u.onPageEnter(),!f){l==="out"&&W(c);return}if(l!=="in")return;const{from:w,to:k}=o(f.from,f.to),C=s.resolve(f.from,f.to,U=>fe.resolveTransitionRule(w,k,x(),U));if(!C){(ie=(H=f.in).applyScrollPolicy)==null||ie.call(H,!1),E(f.from),W(f.out,f.in);return}if((X=(z=f.in).applyScrollPolicy)==null||X.call(z,C.preserveScroll.to),T){C.preserveScroll.from||E(f.from),W(f.out,f.in);return}K(C.transition,C.direction,f.from,f.to,f.out,f.in,C.preserveScroll)})},he=(i,l)=>{const c=g.get(i);if(!c)return;const T=c.intent==="hidden";if(c.intent="hidden",c.savedCss===null&&(c.savedCss=i.style.cssText),c.vis.setDisplay(c.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",T)return;const f=m(i),w={element:i,parent:f.parent,nextSibling:f.nextSibling,mode:"hidden"},k=c.pendingOutPath??c.currentPath??l;c.pendingOutPath=null,F(k,"out",w)},He=(i,l)=>{const c=g.get(i);if(!c||c.intent==="visible")return;c.intent="visible",c.currentPath=i.getAttribute("data-ssgoi-transition")??c.currentPath??l,c.pendingOutPath=null,c.pathRevision++,A(i,c),c.savedCss!==null&&(i.style.cssText=c.savedCss,c.visibleDisplay?c.vis.setDisplay(c.visibleDisplay,!1):c.vis.setDisplay(null));const T=c.currentPath,f=S(i,T),w={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling,applyScrollPolicy:f};F(T,"in",w)},Ie=(i,l,c,T=!0)=>{const f=g.get(i),w=(f==null?void 0:f.pendingOutPath)??(f==null?void 0:f.currentPath)??l;if(f&&(f.vis.stop(),g.delete(i),R.delete(i),f.intent==="hidden")){d.cancel(H=>H.element===i);return}if(!T)return;const k=c??m(i),C={element:i,parent:k.parent,nextSibling:k.nextSibling,mode:"unmount"};F(w,"out",C)},ye=new WeakSet,me=(i,l,{enter:c=!0}={})=>{if(s.connect(),ye.has(l)){const w=g.get(l);if(w&&w.currentPath!==i){w.intent==="visible"&&w.pendingOutPath===null&&(w.pendingOutPath=w.currentPath),w.currentPath=i;const k=++w.pathRevision;queueMicrotask(()=>{w.pathRevision===k&&(w.pendingOutPath=null)})}return}ye.add(l),B(l);const T=ct(l,{onHide:()=>he(l,i),onShow:()=>He(l,i)}),f={vis:T,savedCss:null,intent:T.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:i,pendingOutPath:null,pathRevision:0};if(g.set(l,f),!T.isHidden&&(A(l,f),c)){const w=S(l,i),k={element:l,parent:l.parentElement,nextSibling:l.nextElementSibling,applyScrollPolicy:w};F(i,"in",k)}st(l,(w,k)=>Ie(l,i,w,(k==null?void 0:k.emit)??!0),r)},ge=new Map;return{register:me,refFor:i=>{let l=ge.get(i);return l||(l=c=>{c&&me(i,c)},ge.set(i,l)),l},disconnect:s.dispose}}const Ne="data-ssgoi-root",ut=`[${Ne}]`,ne="data-ssgoi-transition",Me=`[${ne}]`,dt="[data-ssgoi-clone]";function ft(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function pt(n){return n.nodeType===Node.ELEMENT_NODE}function ht(n){return n instanceof HTMLElement}function Oe(n){let t=0,e=n.parentElement;for(;e;)t++,e=e.parentElement;return t}function Ce(n,t,e=n){const o=Array.from(n).sort((a,r)=>Oe(a)-Oe(r));for(const a of o){const r=a.getAttribute(ne);if(r===null)continue;let d=a.parentElement,s=!1;for(;d;){if(e.has(d)){s=!0;break}d=d.parentElement}t.register(r,a,{enter:!s})}}function yt(n,t){if(!ft())return()=>{};n.setAttribute(Ne,"");const e=s=>s.closest(ut)===n,o=s=>!ht(s)||!e(s)||s.closest(dt)||s.getAttribute(ne)===null?null:s,a=(s,p)=>{if(pt(s)){if(s.matches(Me)){const u=o(s);u&&p.add(u)}for(const u of s.querySelectorAll(Me)){const y=o(u);y&&p.add(y)}}},r=new MutationObserver(s=>{const p=new Set,u=new Set;for(const y of s){if(y.type==="attributes"){const h=o(y.target);h&&p.add(h);continue}for(const h of y.addedNodes)a(h,u)}for(const y of u)p.add(y);Ce(p,t,u)});r.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[ne]});const d=new Set;return a(n,d),Ce(d,t),()=>{var s;r.disconnect(),(s=t.disconnect)==null||s.call(t)}}exports.Animation=oe.Animation;exports.MultiAnimation=oe.MultiAnimation;exports.WebAnimation=oe.WebAnimation;exports.HostAnimation=Le;exports.createSggoiTransitionContext=at;exports.observeSsgoiTransitions=yt;
|