@ssgoi/core 7.0.0-beta.0 → 7.0.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/README.md CHANGED
@@ -1,292 +1,122 @@
1
- # SSGOI
1
+ # @ssgoi/core
2
2
 
3
- The framework-agnostic animation engine behind [SSGOI](https://ssgoi.dev) — native app-like page transitions for the web.
3
+ Framework-agnostic route transition engine for SSGOI.
4
4
 
5
- > Most apps should install a framework binding (`@ssgoi/react`, `@ssgoi/svelte`, `@ssgoi/vue`, `@ssgoi/solid`, `@ssgoi/angular`, `@ssgoi/qwik`), which depend on this package. Install `@ssgoi/core` directly only when building a custom integration.
5
+ [![SSGOI live showcase](https://ssgoi.dev/readme.png)](https://ssgoi.dev)
6
6
 
7
- try this: [ssgoi.dev](https://ssgoi.dev)
7
+ [Live demos](https://ssgoi.dev) · [Hero, Zoom, Film, and Sheet in motion](https://ssgoi.dev/blog/view-transition-api-limitations)
8
8
 
9
- ![SSGOI Demo](https://ssgoi.dev/ssgoi.gif)
10
-
11
- ## AI-Assisted Setup
12
-
13
- Using Claude, Cursor, ChatGPT, or another AI assistant? Point it at:
14
-
15
- ```
16
- https://ssgoi.dev/llms.txt
17
- ```
18
-
19
- It has the full setup guide, every transition, the API, and troubleshooting — everything an agent needs to wire SSGOI into your app.
20
-
21
- ## What is SSGOI?
22
-
23
- SSGOI brings native app-like page transitions to the web. Transform your static page navigations into smooth, delightful experiences that users love.
24
-
25
- ### ✨ Key Features
26
-
27
- - **🌍 Works Everywhere** - Unlike the browser's View Transition API, SSGOI works in all modern browsers (Chrome, Firefox, Safari)
28
- - **🚀 SSR Ready** - Perfect compatibility with Next.js, Nuxt, SvelteKit, SolidStart, Qwik City. No hydration issues, SEO-friendly
29
- - **🎯 Use Your Router** - Keep your existing routing. React Router, Next.js App Router, SvelteKit, Qwik City - all work seamlessly
30
- - **💾 State Persistence** - Remembers animation state during navigation, even with browser back/forward
31
- - **🎨 Framework Agnostic** - One consistent API for React, Svelte, Vue, Solid, Angular, and more
32
-
33
- ## Quick Start
34
-
35
- ### Installation
9
+ Most applications should install a framework package:
36
10
 
37
11
  ```bash
38
- # Pick the binding for your framework
39
12
  npm install @ssgoi/react
40
- # or @ssgoi/svelte, @ssgoi/vue, @ssgoi/solid, @ssgoi/angular, @ssgoi/qwik
13
+ # or @ssgoi/svelte, @ssgoi/vue, @ssgoi/solid, @ssgoi/qwik
41
14
  ```
42
15
 
43
- ### Add Transitions in 30 Seconds
44
-
45
- #### 1. Wrap your React app
46
-
47
- ```tsx
48
- import { Ssgoi } from "@ssgoi/react";
49
- import { fade } from "@ssgoi/react/view-transitions";
50
- import { SsgoiTransitionBoundary } from "./ssgoi-transition-boundary";
16
+ Agent setup guide: https://ssgoi.dev/llms.txt
51
17
 
52
- const config = {
53
- transitions: [{ from: "/", to: "/about", transition: fade() }],
54
- };
18
+ ## Configuration
55
19
 
56
- export default function App() {
57
- return (
58
- <div className="relative z-0 min-h-dvh bg-white">
59
- {/* Layout shell above: positioned ancestor + stacking context for the OUT clone. */}
60
- <Ssgoi config={config}>
61
- {/* Routed content marker. Layout positioning belongs to the outer wrapper. */}
62
- <SsgoiTransitionBoundary className="min-h-full bg-white">
63
- {/* Your app */}
64
- </SsgoiTransitionBoundary>
65
- </Ssgoi>
66
- </div>
67
- );
68
- }
69
- ```
20
+ `SsgoiConfig` contains route matching and effects. Layout lifetime belongs to
21
+ framework-specific transition boundaries, not this config.
70
22
 
71
- #### 2. Keep React pages unmarked
23
+ ```ts
24
+ import { drill, slide, zoom, type SsgoiConfig } from "@ssgoi/core";
72
25
 
73
- ```tsx
74
- export default function HomePage() {
75
- return (
76
- <main>
77
- <h1>Welcome</h1>
78
- {/* Page content */}
79
- </main>
80
- );
81
- }
82
- ```
83
-
84
- For React adapters, create one router-specific `SsgoiTransitionBoundary` utility
85
- in your layout. It reads the current pathname internally, sets the transition
86
- boundary key, and uses that pathname as a logical page id matched by config such
87
- as `/products/*`. Use `/products/**` when the parent path itself should match
88
- too.
89
-
90
- Next.js implementation:
91
-
92
- ```tsx
93
- "use client";
94
-
95
- import { type ElementType, type ReactNode } from "react";
96
- import { usePathname } from "next/navigation";
97
-
98
- export function SsgoiTransitionBoundary({
99
- children,
100
- as,
101
- className,
102
- }: {
103
- children: ReactNode;
104
- as?: ElementType;
105
- className?: string;
106
- }) {
107
- const pathname = usePathname();
108
- const Component = as ?? "div";
109
-
110
- return (
111
- <Component
112
- key={pathname}
113
- data-ssgoi-transition={pathname}
114
- className={className}
115
- >
116
- {children}
117
- </Component>
118
- );
119
- }
26
+ const config: SsgoiConfig = {
27
+ preserveScroll: { exclude: ["/posts/*"] },
28
+ transitions: [
29
+ { on: "/posts/**", except: "/posts", transition: drill() },
30
+ { from: "/gallery", to: "/gallery/*", transition: zoom() },
31
+ {
32
+ ordered: ["/tabs/a", "/tabs/b", "/tabs/c"],
33
+ transition: slide(),
34
+ },
35
+ ],
36
+ };
120
37
  ```
121
38
 
122
- React Router and TanStack Router use the same component body with their own
123
- pathname hook.
124
-
125
- For SvelteKit, Nuxt/Vue, Solid, Angular, and Qwik, mark each routed page boundary
126
- directly with `data-ssgoi-transition` instead of using a layout-level utility.
127
- The value can be a hard-coded logical id; it only has to match your config.
39
+ Rule forms:
128
40
 
129
- **That's it!** Your configured pages now transition smoothly with a fade effect.
41
+ - `on`: route family. Entering is forward; leaving is backward.
42
+ - `from`/`to`: precise pair. Reverse matching is enabled by default.
43
+ - `ordered`: array order decides forward and backward.
44
+ - `priority`: higher values win before path specificity.
130
45
 
131
- ## Advanced Transitions
46
+ Path patterns:
132
47
 
133
- ### Route-based Transitions
48
+ - `/posts`: exact.
49
+ - `/posts/*`: exactly one arbitrary segment.
50
+ - `/posts/**`: the parent and every descendant.
134
51
 
135
- Transition factories return one effect-only `TransitionConfig`. Put that
136
- effect inside a flat route rule:
52
+ A bare `*` remains a compatibility alias for `/**`. Named single-segment forms
53
+ remain supported and rank above a single-segment `*` when rules overlap, but
54
+ their names are not captured or exposed.
137
55
 
138
- ```tsx
139
- import { fade, drill, zoom } from "@ssgoi/react/view-transitions";
56
+ ## Boundary model
140
57
 
141
- const config = {
142
- transitions: [
143
- // Calm cross-fade between tabs
144
- { from: "/home", to: "/about", transition: fade() },
58
+ A framework adapter observes elements marked with:
145
59
 
146
- // iOS-style drill-in when entering details
147
- {
148
- on: "/products/**",
149
- except: "/products",
150
- transition: drill(),
151
- },
152
-
153
- // Card-to-detail zoom (needs matching data-zoom-*-key)
154
- {
155
- from: "/gallery",
156
- to: "/photo/:id",
157
- transition: zoom({ type: "expand" }),
158
- },
159
- ],
160
- };
161
- ```
162
-
163
- Route rules come in three shapes:
164
-
165
- - **`{ on, except?, transition }`** — a route family. Entering is forward,
166
- leaving is backward, and internal navigation uses popstate/semantic history.
167
- - **`{ from, to, transition, bidirectional? }`** — a precise pair. Arrays on
168
- either side mean OR; reverse matching is enabled by default.
169
- - **`{ ordered, transition }`** — both endpoints must be in the ordered list.
170
- Increasing index is forward; decreasing index is backward.
171
-
172
- Rules may set `priority` (default `0`). Candidates are chosen by higher
173
- priority, then path specificity, then earlier declaration order. Patterns
174
- support exact paths, `:id` (one dynamic segment), `*` (exactly one arbitrary
175
- segment), and suffix `**` (zero or more segments).
176
-
177
- Factories accept only their effect options: `{ type?, variant?, options? }`.
178
- The dispatcher passes semantic direction through the transition context.
179
-
180
- ### Individual Element Animations
181
-
182
- Animate specific elements during mount/unmount with `transition()`:
183
-
184
- ```tsx
185
- import { transition } from "@ssgoi/react";
186
- import { fade, slide } from "@ssgoi/react/transitions";
187
-
188
- function Card() {
189
- return (
190
- <div
191
- ref={transition({
192
- key: "card",
193
- in: fade(),
194
- out: slide({ direction: "up" }),
195
- })}
196
- >
197
- <h2>Animated Card</h2>
198
- </div>
199
- );
200
- }
60
+ ```html
61
+ <div data-ssgoi-transition="/posts/1">...</div>
201
62
  ```
202
63
 
203
- ## Built-in Transitions
204
-
205
- ### Page Transitions (`@ssgoi/<framework>/view-transitions`)
206
-
207
- - `fade` - Calm cross-fade. Safe default for unrelated pages
208
- - `drill` - iOS-style hierarchical navigation (list → detail)
209
- - `slide` - Horizontal push for tabs / sequential flows
210
- - `scroll` - Vertical page scroll for onboarding / paginated views
211
- - `axis` - Material/Flutter shared-axis swap for sibling/tab routes
212
- - `sheet` - Bottom sheet that slides up (modal-like flows)
213
- - `hero` - Shared element transition (matching `data-hero-*-key`)
214
- - `zoom` - Card-to-detail expansion (matching `data-zoom-*-key`)
215
- - `strip` - 3D Y-axis perspective flip
216
- - `blind` - Window-blinds wipe reveal
217
- - `film` - Cinematic shrink + tile (gallery / lightbox)
218
- - `rotate` - Card flip between siblings
219
- - `jaemin` - Playful rotated zoom for special moments
220
-
221
- ### Element Transitions (`@ssgoi/<framework>/transitions`)
222
-
223
- For mount/unmount of individual elements (not whole pages):
224
-
225
- - `fade` - Fade in/out
226
- - `scale` - Scale in/out
227
- - `slide` - Slide (direction: up/down/left/right)
228
- - `rotate` - Rotate
229
- - `bounce` - Bounce
230
- - `blur` - Blur
231
- - `fly` - Fly (custom x, y position)
232
-
233
- ## Layout Requirements
234
-
235
- The outer element wrapping the SSGOI provider / `<Ssgoi>` needs
236
- `position: relative` and `z-index: 0`.
237
-
238
- When a page leaves, SSGOI clones it back into the DOM with `position: absolute`
239
- so it can animate out while the new page animates in. Without a positioned,
240
- stacking-context ancestor the clone jumps to the wrong place or falls behind the
241
- background. Add `overflow-x-clip` too if you use horizontal transitions
242
- (`slide`, `drill`). Keep these layout classes on the outer wrapper, not on the
243
- route boundary marker.
244
-
245
- ```tsx
246
- <div className="relative z-0 overflow-x-clip">
247
- <Ssgoi config={config}>{children}</Ssgoi>
248
- </div>
249
- ```
250
-
251
- ## Why SSGOI?
64
+ The framework decides when that element is replaced. Nested boundaries follow
65
+ DOM lifetime:
252
66
 
253
- ### vs View Transition API
67
+ - Parent and child change together: the outer changed boundary owns the event.
68
+ - Parent remains mounted: the changed child owns the event.
254
69
 
255
- - ✅ Works in all browsers, not just Chrome
256
- - ✅ More animation options with spring physics
257
- - ✅ Better developer experience
70
+ This supports persistent layouts, inner tab transitions, and bottom navigation
71
+ with one SSGOI instance.
258
72
 
259
- ### vs Other Animation Libraries
73
+ ## Transition context
260
74
 
261
- - ✅ Built specifically for page transitions
262
- - ✅ SSR-first design
263
- - ✅ No router lock-in
264
- - ✅ Minimal bundle size
75
+ Custom effects receive semantic direction through `context`:
265
76
 
266
- ## How It Works
77
+ ```ts
78
+ import { defineTransition } from "@ssgoi/core";
267
79
 
268
- SSGOI orchestrates two simultaneous animations on every route change:
80
+ const effect = defineTransition({
81
+ prepare: ({ from, to, context }) => {
82
+ // Pre-paint setup.
83
+ return {};
84
+ },
85
+ animation: ({ from, to, context }) => {
86
+ // context.direction is "forward" or "backward".
87
+ return animation;
88
+ },
89
+ });
90
+ ```
269
91
 
270
- 1. **Route Change**: Your router changes the URL
271
- 2. **Exit (OUT)**: SSGOI clones the leaving page with `position: absolute` and animates it out
272
- 3. **Enter (IN)**: The new page mounts in place and animates in
273
- 4. **State Sync**: Animation state persists across navigation, including browser back/forward
92
+ ## Effect index
274
93
 
275
- All powered by a spring physics engine — springs are pre-computed into Web Animations API keyframes, so animations run at 60fps off the main thread.
94
+ - `fade`: unrelated pages.
95
+ - `drill`: list → detail hierarchy.
96
+ - `slide`: ordered tabs and steps.
97
+ - `axis`: sibling destinations.
98
+ - `sheet`: modal-like routes.
99
+ - `zoom`: card or image → detail.
100
+ - `hero`: shared elements plus page chrome.
101
+ - `scroll`: vertical sequences.
102
+ - `strip`, `film`, `rotate`, `blind`, `jaemin`: expressive transitions.
276
103
 
277
- ## Documentation
104
+ Effect references: https://ssgoi.dev/llms.txt#7-transition-index
278
105
 
279
- Visit [https://ssgoi.dev](https://ssgoi.dev) for:
106
+ ## Layout requirements
280
107
 
281
- - Detailed API reference
282
- - Interactive examples
283
- - Framework integration guides
284
- - Custom transition recipes
108
+ The shell around the framework root should provide:
285
109
 
286
- ## Contributing
110
+ ```css
111
+ .ssgoi-shell {
112
+ position: relative;
113
+ z-index: 0;
114
+ overflow-x: clip;
115
+ }
116
+ ```
287
117
 
288
- We welcome contributions! Please see our [contributing guide](https://github.com/meursyphus/ssgoi/blob/main/CONTRIBUTING.md) for details.
118
+ `overflow-x: clip` is needed for horizontal effects.
289
119
 
290
120
  ## License
291
121
 
292
- MIT © [MeurSyphus](https://github.com/meursyphus)
122
+ MIT
package/dist/internal.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Wt=Object.defineProperty;var Ft=(t,n,e)=>n in t?Wt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var q=(t,n,e)=>Ft(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const nt=require("./multi-animation-6124HEke.cjs");class At extends nt.Animation{constructor(){super(...arguments);q(this,"child",null);q(this,"_state","idle");q(this,"_settled",!1);q(this,"listeners",new Set)}attach(e){const i=this.child;if(this.child=e,this._settled=!1,i){const l=i.getPose();i.complete(),e.matchInto(l)}e.playbackRate=this.playbackRate;const o=e.onComplete;e.onComplete=()=>{o==null||o(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const r=e.onUpdate;e.onUpdate=l=>{var u;r==null||r(l),(u=this.onUpdate)==null||u.call(this,l),this.notify()},this._state==="paused"?e.pause():this._state==="reversing"?e.reverse():(this._state="playing",e.play()),this.notify()}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.play(),this.notify()}reverse(){var e;this._state="reversing",this._settled=!1,(e=this.child)==null||e.reverse(),this.notify()}pause(){var e;this._state="paused",(e=this.child)==null||e.pause(),this.notify()}complete(){var e;(e=this.child)==null||e.complete(),this.notify()}get isAnimating(){var e;return((e=this.child)==null?void 0:e.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var e;return((e=this.child)==null?void 0:e.isReversing)??this._state==="reversing"}get progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var i;return((i=this.child)==null?void 0:i.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 i;(i=this.child)==null||i.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 Bt=(t,n)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=n==null?void 0:n.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},St=new Set(["auto","scroll","overlay"]),zt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(St.has(e.overflowY)||St.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Kt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return n;n=n.parentElement}return document.body};function Xt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const i={};return n.forEach((o,r)=>{i[o]=e[r]}),i})}const $t=1e6,wt=100,qt=10,Ut=1;function Vt(t){const n=t.trim(),e=n.indexOf("#"),i=n.indexOf("?"),o=[e,i].filter(r=>r>=0).reduce((r,l)=>Math.min(r,l),n.length);return n.slice(0,o)}function G(t){const n=Vt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return G(new URL(n).pathname)}catch{}const i=(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/");return(i.length>1?i.replace(/\/+$/g,""):i)||"/"}function Gt(t){const n=t.trim();return n==="*"?"/**":G(n)}function ut(t){return t==="/"?[]:t.slice(1).split("/")}function Yt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function Ct(t,n){const e=G(t),i=Gt(n);if(e===i)return{matched:!0,specificity:$t+ut(i).length*wt,pattern:n};const o=ut(e),r=ut(i);let l=0;for(let u=0;u<r.length;u++){const y=r[u],d=o[u],S=u===r.length-1;if(y==="**")return{matched:S&&o.length>=u,specificity:l,pattern:n};if(d===void 0||y===void 0)return{matched:!1,specificity:0,pattern:n};if(y==="*"){l+=Ut;continue}if(Yt(y)){l+=qt;continue}if(y!==d)return{matched:!1,specificity:0,pattern:n};l+=wt}return{matched:o.length===r.length,specificity:l,pattern:n}}function I(t,n){const e=typeof n=="string"?[n]:n;let i=null;for(const o of e){const r=Ct(t,o);r.matched&&(!i||r.specificity>i.specificity)&&(i=r)}return i}function Zt(t,n){return Ct(t,n).matched}const jt=768,Qt=10,Jt=10;function te(t={}){const{preserveScroll:n=h=>h,resolvePath:e=h=>h}=t,i=typeof n=="function"?n:()=>n;let o=null,r=!1,l=!1;const u=()=>{const h=(o==null?void 0:o.clientWidth)??0,m=h>0?h:typeof window<"u"?window.innerWidth:0;return m>0&&m<jt},y=()=>(l||(r=u(),l=!0),r),d=h=>{var _;const m=e(h),b=i(y());if(b===!1)return{preserves:!1,shared:!1,storageKey:`path:${m}`};if(b===!0)return{preserves:!0,shared:!1,storageKey:`path:${m}`};const w=((_=b.exclude)==null?void 0:_.some(F=>Zt(m,F)))??!1,E=!w&&!!b.key;return{preserves:!w,shared:E,storageKey:E?`shared:${b.key}`:`path:${m}`}},S=h=>d(h).preserves;let g=null;const f=new Map;let x=null,A=!1,C=0;const k=()=>{o&&x&&!A&&f.set(d(x).storageKey,{x:o.scrollLeft,y:o.scrollTop})},X=h=>{if(!o)return;const m=d(h);if(m.preserves&&m.shared&&!f.has(m.storageKey))return;const b=m.preserves&&f.has(m.storageKey)?f.get(m.storageKey):{x:0,y:0};let w=0;const E=()=>{if(!o)return;o.scrollTo({top:b.y,left:b.x}),!(Math.abs(o.scrollTop-b.y)<1&&Math.abs(o.scrollLeft-b.x)<1)&&w<Qt&&(w++,requestAnimationFrame(E))};requestAnimationFrame(E)};return{initializeContext:(h,m)=>{A=!0;const b=++C;g=h,o||(o=zt(h),r=u(),l=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=u()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",k,{passive:!0})),x=m,X(m);let w=0;const E=()=>{b===C&&(w++,w>=Jt?A=!1:requestAnimationFrame(E))};requestAnimationFrame(E)},calculateScrollOffset:(h,m)=>{const b=h?d(h).storageKey:null,w=b&&f.has(b)?f.get(b):{x:0,y:0},E=m?d(m):null,_=E!=null&&E.preserves?E.storageKey:null,F=_&&f.has(_)?f.get(_):{x:0,y:0};return{x:-F.x+w.x,y:-F.y+w.y}},evictScrollPosition:h=>{f.delete(d(h).storageKey)},shouldPreserve:S,getScrollContainer:()=>o,getPositionedParentElement:()=>g?Kt(g):document.body,getScrollPosition:h=>{const m=h?d(h).storageKey:null;return m&&f.has(m)?f.get(m):{x:0,y:0}},getIsMobile:y}}const Et=30,Tt=8,Pt=1.2,xt=30,ee=600;function ne(){let t=null,n=!1,e=!1,i=null,o=null,r=!1;const l=(p,T)=>{for(let P=0;P<p.length;P++){const O=p.item(P);if(O&&O.identifier===T)return O}return null},u=()=>{i!==null&&(clearTimeout(i),i=null)},y=()=>{o!==null&&(clearTimeout(o),o=null)},d=()=>{n=!0,e=!0,u(),y(),i=setTimeout(()=>{n=!1,e=!1,i=null},ee)},S=p=>{if(p.touches.length!==1){t=null;return}const T=p.touches.item(0);if(!T){t=null;return}const P=window.innerWidth,O=T.clientX<=Et,R=T.clientX>=P-Et;if(!O&&!R){t=null;return}t={identifier:T.identifier,startX:T.clientX,startY:T.clientY,fromLeftEdge:O,moved:!1}},g=p=>{if(!t)return;if(p.touches.length!==1){t=null;return}const T=l(p.touches,t.identifier);if(!T){t=null;return}const P=T.clientX-t.startX,O=T.clientY-t.startY,R=Math.abs(P),L=Math.abs(O);if(L>Tt&&L>R*Pt){t=null;return}const h=t.fromLeftEdge?P>0:P<0;R>Tt&&R>L*Pt&&h&&(t.moved=!0)},f=p=>{if(!t)return;const T=l(p.changedTouches,t.identifier);if(!T){t=null;return}const P=T.clientX-t.startX,O=t.fromLeftEdge?P>0:P<0;if(t.moved&&O&&Math.abs(P)>=xt){d(),t=null;return}t.moved&&Math.abs(P)>=xt&&d(),t=null},x=()=>{t&&(t.moved&&d(),t=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const p={passive:!0,capture:!0};window.addEventListener("touchstart",S,p),window.addEventListener("touchmove",g,p),window.addEventListener("touchend",f,p),window.addEventListener("touchcancel",x,p)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const p={capture:!0};window.removeEventListener("touchstart",S,p),window.removeEventListener("touchmove",g,p),window.removeEventListener("touchend",f,p),window.removeEventListener("touchcancel",x,p),u(),y(),t=null,n=!1,e=!1},isSwipeBack:()=>{const p=n||e;return p&&u(),p},onPageEnter:()=>{n=!1,u(),y(),o=setTimeout(()=>{e=!1,o=null},0)}}}function ie(t,n){return n?t.priority!==n.priority?t.priority>n.priority:t.specificity!==n.specificity?t.specificity>n.specificity:t.ruleIndex<n.ruleIndex:!0}function se(t,n,e,i){let o=null;return e.forEach((r,l)=>{const u=r.priority??0;let y=null;if(r.on!==void 0){const d=r.except!==void 0&&I(t,r.except)!==null,S=r.except!==void 0&&I(n,r.except)!==null,g=d?null:I(t,r.on),f=S?null:I(n,r.on);if(g||f){const x=!g&&f?"forward":g&&!f?"backward":i;y={transition:r.transition,direction:x,ruleIndex:l,priority:u,specificity:Math.max((g==null?void 0:g.specificity)??0,(f==null?void 0:f.specificity)??0),reason:!g&&f?"on-enter":g&&!f?"on-leave":"on-history"}}}else if(r.ordered!==void 0){let d=-1,S=-1,g=-1,f=-1;r.ordered.forEach((x,A)=>{const C=I(t,x);C&&C.specificity>g&&(d=A,g=C.specificity);const k=I(n,x);k&&k.specificity>f&&(S=A,f=k.specificity)}),d>=0&&S>=0&&d!==S&&(y={transition:r.transition,direction:d<S?"forward":"backward",ruleIndex:l,priority:u,specificity:g+f,reason:"ordered"})}else{const d=I(t,r.from),S=I(n,r.to),g=r.bidirectional===!1?null:I(t,r.to),f=r.bidirectional===!1?null:I(n,r.from),x=d&&S,A=g&&f;if(x||A){const C=x?d.specificity+S.specificity:-1,k=A?g.specificity+f.specificity:-1,X=x&&A&&C===k?i:C>=k?"forward":"backward";y={transition:r.transition,direction:X,ruleIndex:l,priority:u,specificity:Math.max(C,k),reason:"pair"}}}y&&ie(y,o)&&(o=y)}),o}function oe(){const t=[];let n=!1;const e=()=>{n=!0};return typeof window<"u"&&window.addEventListener("popstate",e),{resolve(i,o){const r=G(i),l=G(o);if(t.length===0)t.push(r);else if(t[t.length-1]!==r){const d=t.lastIndexOf(r);d>=0?t.splice(d+1):t.push(r)}const u=t[t.length-2],y=n||u===l?"backward":"forward";if(n=!1,y==="backward"){const d=t.lastIndexOf(l);d>=0?t.splice(d+1):t.push(l)}else t[t.length-1]!==l&&t.push(l);return y},dispose(){typeof window<"u"&&window.removeEventListener("popstate",e)}}}function re(){let t=null;function n(){var i,o;t&&((i=t.outResolve)==null||i.call(t,null),(o=t.inResolve)==null||o.call(t,null),t=null)}function e(){if(t!=null&&t.from&&(t!=null&&t.to)&&(t!=null&&t.outResolve)&&(t!=null&&t.inResolve)){if(t.from===t.to){n();return}const i={from:t.from,to:t.to};t.outResolve(i),t.inResolve(i),t=null}}return{trigger(i,o){var l;o==="out"&&(t==null?void 0:t.to)===i&&!t.from&&((l=t.inResolve)==null||l.call(t,null),t={}),t&&(o==="out"&&t.from&&t.from!==i||o==="in"&&t.to&&t.to!==i)&&n(),t||(t={}),o==="out"?t.from=i:t.to=i},get(i){return new Promise(o=>{t||(t={}),i==="out"?t.outResolve=o:t.inResolve=o,e()})}}}const V=new Map;let J=null,Rt=!1;function Lt(t,n){if(t instanceof HTMLElement&&V.has(t)&&!t.isConnected){const e=V.get(t);V.delete(t),queueMicrotask(()=>e(n))}for(const e of Array.from(t.childNodes))Lt(e,n)}function ce(){if(Rt||typeof document>"u")return;Rt=!0,J=new MutationObserver(n=>{for(const e of n){const i={parent:e.target,nextSibling:e.nextSibling};for(const o of Array.from(e.removedNodes))Lt(o,i)}});const t=()=>{J==null||J.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function le(t,n){return ce(),V.set(t,n),()=>{V.delete(t)}}const dt=new WeakMap;let tt=null;const et="none !important";function U(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function ae(){return tt||(tt=new MutationObserver(t=>{for(const n of t){const e=n.target,i=dt.get(e);if(!i)continue;const o=U(e);o!==i.accounted&&(i.accounted=o,o===et?(i.reactHidden=!0,i.onHide()):o!=="none"&&i.reactHidden&&(i.reactHidden=!1,i.onShow()))}}),tt)}function ue(t,n){const e=U(t),i={accounted:e,reactHidden:e===et,onHide:n.onHide,onShow:n.onShow};return dt.set(t,i),ae().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return U(t)===et},setDisplay(o,r=!1){o===null?t.style.removeProperty("display"):t.style.setProperty("display",o,r?"important":""),i.accounted=U(t)},sync(){i.accounted=U(t),i.reactHidden=i.accounted===et},stop(){dt.delete(t)}}}function de(t,n={}){const{transitions:e=[],middleware:i=(s,c)=>({from:s,to:c}),preserveScroll:o=s=>s}=t,r=n.host??new At,l=re(),u=oe(),y=typeof e=="function"?e:()=>e,d=ne();d.initialize();const S=new Map,g=s=>{let c=S.get(s);return c===void 0&&(c=i(s,s).from,S.set(s,c)),c},{initializeContext:f,calculateScrollOffset:x,evictScrollPosition:A,shouldPreserve:C,getScrollContainer:k,getPositionedParentElement:X,getScrollPosition:p,getIsMobile:T}=te({preserveScroll:o,resolvePath:g}),P=new Map,O=()=>{const s=T();let c=P.get(s);return c||(c=y({isMobile:s}),P.set(s,c)),c};let R=null,L=null;const h=new WeakMap,m=s=>{h.set(s,{parent:s.parentNode,nextSibling:s.nextSibling})},b=s=>{const c=h.get(s);return c||{parent:s.parentNode,nextSibling:s.nextSibling}},w=new WeakMap,E=new WeakMap;let _=0;const F=s=>{const c=typeof getComputedStyle<"u"?getComputedStyle(s).display:"";return c&&c!=="none"?c:"block"},Y=(s,c)=>{c.visibleDisplay=s.style.getPropertyValue("display"),c.computedDisplay=F(s)},ht=(s,c)=>{if(E.get(s)!==c)return;E.delete(s);const a=w.get(s);a&&(a.savedCss!==null&&(s.style.cssText=a.savedCss,a.savedCss=null),a.intent==="hidden"?a.vis.setDisplay("none",!0):a.visibleDisplay?(a.vis.setDisplay(a.visibleDisplay,!1),Y(s,a)):(a.vis.setDisplay(null),Y(s,a)))},kt=(s,c,a,v,M,H)=>{const B=M.element,N=H.element,W=(M.mode??"unmount")==="hidden",{parent:z,nextSibling:st}=M.parent?{parent:M.parent,nextSibling:M.nextSibling}:b(B),j=x(a,v),ot={direction:c,scrollOffset:j,from:{scroll:p(a)},to:{scroll:p(v)},get scrollingElement(){return k()||document.documentElement},get positionedParent(){return X()}};let D;if(W){D=B,D.style.top=`${-1*((j==null?void 0:j.y)??0)}px`;const K=w.get(N);K&&K.savedCss===null&&(K.savedCss=N.style.cssText)}else D=B,Bt(D,ot);C(a)||A(a);const Q=W?++_:0;W&&(E.set(N,Q),E.set(B,Q));const gt=Promise.resolve(D),vt=Promise.resolve(N),bt=[],Nt={from:gt,to:vt,context:ot,createElement:((K,rt="div")=>{const $=document.createElement(rt);return $.setAttribute("data-ssgoi-id",K),bt.push($),$})},Ht=Promise.resolve(s.prepare?s.prepare(Nt):{});Xt({from:gt,to:vt,extras:Ht}).then(({from:K,to:rt,extras:$})=>{!W&&z&&(st&&z.contains(st)?z.insertBefore(D,st):z.appendChild(D));const ct=s.animation({from:K,to:rt,context:ot,...$}),lt=ct.onComplete;ct.onComplete=()=>{lt==null||lt(),W?(ht(B,Q),ht(N,Q)):D.parentNode&&D.parentNode.removeChild(D);for(const at of bt)at.parentNode&&at.parentNode.removeChild(at)},r.attach(ct)})},Z=(s,c)=>{const a=d.isSwipeBack();l.trigger(s,c),l.get(c).then(v=>{if(c==="in"&&d.onPageEnter(),!v)return;if(a&&c==="in"){const z=i(v.from,v.to);u.resolve(z.from,z.to)}if(a){c==="out"&&v.from&&!C(v.from)&&A(v.from),R=null,L=null;return}if(c!=="in")return;const{from:M,to:H}=i(v.from,v.to),B=u.resolve(M,H),N=se(M,H,O(),B),it=R,W=L;R=null,L=null,!(!N||!it||!W)&&kt(N.transition,N.direction,v.from,v.to,it,W)})},_t=(s,c)=>{const a=w.get(s);if(!a)return;const v=a.intent==="hidden";if(a.intent="hidden",a.savedCss===null&&(a.savedCss=s.style.cssText),a.vis.setDisplay(a.computedDisplay||"block",!0),s.style.position="absolute",s.style.width="100%",s.style.left="0",v)return;const M=b(s);R={element:s,parent:M.parent,nextSibling:M.nextSibling,mode:"hidden"};const H=s.getAttribute("data-ssgoi-transition")??c;Z(H,"out")},Dt=(s,c)=>{const a=w.get(s);if(!a||a.intent==="visible")return;a.intent="visible",Y(s,a),a.savedCss!==null&&(s.style.cssText=a.savedCss,a.visibleDisplay?a.vis.setDisplay(a.visibleDisplay,!1):a.vis.setDisplay(null)),f(s,c),L={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling};const v=s.getAttribute("data-ssgoi-transition")??c;Z(v,"in")},It=(s,c,a)=>{const v=w.get(s);if(v&&(v.vis.stop(),w.delete(s),E.delete(s),v.intent==="hidden")){(R==null?void 0:R.element)===s&&(R=null),(L==null?void 0:L.element)===s&&(L=null);return}const M=a??b(s);R={element:s,parent:M.parent,nextSibling:M.nextSibling,mode:"unmount"};const H=s.getAttribute("data-ssgoi-transition")??c;Z(H,"out")},pt=new WeakSet,yt=(s,c)=>{if(pt.has(c))return;pt.add(c),m(c);const a=ue(c,{onHide:()=>_t(c,s),onShow:()=>Dt(c,s)}),v={vis:a,savedCss:null,intent:a.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};w.set(c,v),a.isHidden||(Y(c,v),f(c,s),L={element:c,parent:c.parentElement,nextSibling:c.nextElementSibling},Z(s,"in")),le(c,M=>It(c,s,M))},mt=new Map;return{register:yt,refFor:s=>{let c=mt.get(s);return c||(c=a=>{a&&yt(s,a)},mt.set(s,c)),c}}}const Ot="data-ssgoi-root",fe=`[${Ot}]`,ft="data-ssgoi-transition",Mt=`[${ft}]`,he="[data-ssgoi-clone]";function pe(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ye(t){return t.nodeType===Node.ELEMENT_NODE}function me(t){return t instanceof HTMLElement}function ge(t,n){if(!pe())return()=>{};t.setAttribute(Ot,"");const e=l=>l.closest(fe)===t,i=l=>{if(!me(l)||!e(l)||l.closest(he))return;const u=l.getAttribute(ft);u!==null&&n.register(u,l)},o=l=>{if(ye(l)){l.matches(Mt)&&i(l);for(const u of l.querySelectorAll(Mt))i(u)}},r=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){i(u.target);continue}for(const y of u.addedNodes)o(y)}});return r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[ft]}),o(t),()=>r.disconnect()}exports.Animation=nt.Animation;exports.MultiAnimation=nt.MultiAnimation;exports.WebAnimation=nt.WebAnimation;exports.HostAnimation=At;exports.createSggoiTransitionContext=de;exports.observeSsgoiTransitions=ge;
1
+ "use strict";var Bt=Object.defineProperty;var Ft=(t,e,n)=>e in t?Bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>Ft(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("./multi-animation-6124HEke.cjs");class kt extends it.Animation{constructor(){super(...arguments);G(this,"child",null);G(this,"_state","idle");G(this,"_settled",!1);G(this,"listeners",new Set)}attach(n){const s=this.child;if(this.child=n,this._settled=!1,s){const l=s.getPose();s.complete(),n.matchInto(l)}n.playbackRate=this.playbackRate;const r=n.onComplete;n.onComplete=()=>{r==null||r(),this.child===n&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const i=n.onUpdate;n.onUpdate=l=>{var a;i==null||i(l),(a=this.onUpdate)==null||a.call(this,l),this.notify()},this._state==="paused"?n.pause():this._state==="reversing"?n.reverse():(this._state="playing",n.play()),this.notify()}play(){var n;this._state="playing",this._settled=!1,(n=this.child)==null||n.play(),this.notify()}reverse(){var n;this._state="reversing",this._settled=!1,(n=this.child)==null||n.reverse(),this.notify()}pause(){var n;this._state="paused",(n=this.child)==null||n.pause(),this.notify()}complete(){var n;(n=this.child)==null||n.complete(),this.notify()}get isAnimating(){var n;return((n=this.child)==null?void 0:n.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var n;return((n=this.child)==null?void 0:n.isReversing)??this._state==="reversing"}get progress(){var n;return((n=this.child)==null?void 0:n.progress)??0}findTimeForProgress(n){var s;return((s=this.child)==null?void 0:s.findTimeForProgress(n))??null}get playbackRate(){return super.playbackRate}set playbackRate(n){super.playbackRate=n,this.child&&(this.child.playbackRate=n),this.notify()}getPose(){var n;return((n=this.child)==null?void 0:n.getPose())??[]}getTimeline(){var n;return((n=this.child)==null?void 0:n.getTimeline())??[]}matchInto(n){var s;(s=this.child)==null||s.matchInto(n)}get activeChild(){return this.child}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}notify(){for(const n of this.listeners)n()}}const zt=(t,e)=>{var n;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((n=e==null?void 0:e.scrollOffset)==null?void 0:n.y)??0)}px`,t.style.left="0"},bt=new Set(["auto","scroll","overlay"]),Kt=t=>{let e=t.parentElement;for(;e&&e!==document.body;){const n=window.getComputedStyle(e);if(bt.has(n.overflowY)||bt.has(n.overflowX))return e;e=e.parentElement}return document.documentElement},Xt=t=>{let e=t.parentElement;for(;e&&e!==document.body;){const n=window.getComputedStyle(e).position;if(n==="relative"||n==="absolute"||n==="fixed"||n==="sticky")return e;e=e.parentElement}return document.body};function $t(t){const e=Object.keys(t);return Promise.all(e.map(n=>t[n])).then(n=>{const s={};return e.forEach((r,i)=>{s[r]=n[i]}),s})}const qt=1e6,Et=100,Gt=10,Ut=1;function Vt(t){const e=t.trim(),n=e.indexOf("#"),s=e.indexOf("?"),r=[n,s].filter(i=>i>=0).reduce((i,l)=>Math.min(i,l),e.length);return e.slice(0,r)}function V(t){const e=Vt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e))return V(new URL(e).pathname)}catch{}const s=(e.startsWith("/")?e:`/${e}`).replace(/\/+/g,"/");return(s.length>1?s.replace(/\/+$/g,""):s)||"/"}function Yt(t){const e=t.trim();return e==="*"?"/**":V(e)}function ut(t){return t==="/"?[]:t.slice(1).split("/")}function Zt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function Ot(t,e){const n=V(t),s=Yt(e);if(n===s)return{matched:!0,specificity:qt+ut(s).length*Et,pattern:e};const r=ut(n),i=ut(s);let l=0;for(let a=0;a<i.length;a++){const f=i[a],u=r[a],y=a===i.length-1;if(f==="**")return{matched:y&&r.length>=a,specificity:l,pattern:e};if(u===void 0||f===void 0)return{matched:!1,specificity:0,pattern:e};if(f==="*"){l+=Ut;continue}if(Zt(f)){l+=Gt;continue}if(f!==u)return{matched:!1,specificity:0,pattern:e};l+=Et}return{matched:r.length===i.length,specificity:l,pattern:e}}function N(t,e){const n=typeof e=="string"?[e]:e;let s=null;for(const r of n){const i=Ot(t,r);i.matched&&(!s||i.specificity>s.specificity)&&(s=i)}return s}function jt(t,e){return Ot(t,e).matched}const Qt=768,Jt=10,te=10;function ee(t={}){const{preserveScroll:e=v=>v,resolvePath:n=v=>v}=t,s=typeof e=="function"?e:()=>e;let r=null,i=!1,l=!1;const a=()=>{const v=(r==null?void 0:r.clientWidth)??0,g=v>0?v:typeof window<"u"?window.innerWidth:0;return g>0&&g<Qt},f=()=>(l||(i=a(),l=!0),i),u=v=>{var _;const g=n(v),E=s(f());if(E===!1)return{preserves:!1,shared:!1,storageKey:`path:${g}`};if(E===!0)return{preserves:!0,shared:!1,storageKey:`path:${g}`};const P=((_=E.exclude)==null?void 0:_.some(D=>jt(g,D)))??!1,A=!P&&!!E.key;return{preserves:!P,shared:A,storageKey:A?`shared:${E.key}`:`path:${g}`}},y=v=>u(v).preserves;let p=null;const h=new Map;let S=null,M=!1,k=0;const R=()=>{r&&S&&!M&&h.set(u(S).storageKey,{x:r.scrollLeft,y:r.scrollTop})},K=v=>{if(!r)return;const g=u(v);if(g.preserves&&g.shared&&!h.has(g.storageKey))return;const E=g.preserves&&h.has(g.storageKey)?h.get(g.storageKey):{x:0,y:0};let P=0;const A=()=>{if(!r)return;r.scrollTo({top:E.y,left:E.x}),!(Math.abs(r.scrollTop-E.y)<1&&Math.abs(r.scrollLeft-E.x)<1)&&P<Jt&&(P++,requestAnimationFrame(A))};requestAnimationFrame(A)};return{initializeContext:(v,g)=>{M=!0;const E=++k;p=v,r||(r=Kt(v),i=a(),l=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{i=a()}).observe(r),(r===document.documentElement?window:r).addEventListener("scroll",R,{passive:!0})),S=g,K(g);let P=0;const A=()=>{E===k&&(P++,P>=te?M=!1:requestAnimationFrame(A))};requestAnimationFrame(A)},calculateScrollOffset:(v,g)=>{const E=v?u(v).storageKey:null,P=E&&h.has(E)?h.get(E):{x:0,y:0},A=g?u(g):null,_=A!=null&&A.preserves?A.storageKey:null,D=_&&h.has(_)?h.get(_):{x:0,y:0};return{x:-D.x+P.x,y:-D.y+P.y}},evictScrollPosition:v=>{h.delete(u(v).storageKey)},shouldPreserve:y,getScrollContainer:()=>r,getPositionedParentElement:()=>p?Xt(p):document.body,getScrollPosition:v=>{const g=v?u(v).storageKey:null;return g&&h.has(g)?h.get(g):{x:0,y:0}},getIsMobile:f}}const St=30,wt=8,Tt=1.2,Pt=30,ne=600;function ie(){let t=null,e=!1,n=!1,s=null,r=null,i=!1;const l=(b,w)=>{for(let T=0;T<b.length;T++){const O=b.item(T);if(O&&O.identifier===w)return O}return null},a=()=>{s!==null&&(clearTimeout(s),s=null)},f=()=>{r!==null&&(clearTimeout(r),r=null)},u=()=>{e=!0,n=!0,a(),f(),s=setTimeout(()=>{e=!1,n=!1,s=null},ne)},y=b=>{if(b.touches.length!==1){t=null;return}const w=b.touches.item(0);if(!w){t=null;return}const T=window.innerWidth,O=w.clientX<=St,W=w.clientX>=T-St;if(!O&&!W){t=null;return}t={identifier:w.identifier,startX:w.clientX,startY:w.clientY,fromLeftEdge:O,moved:!1}},p=b=>{if(!t)return;if(b.touches.length!==1){t=null;return}const w=l(b.touches,t.identifier);if(!w){t=null;return}const T=w.clientX-t.startX,O=w.clientY-t.startY,W=Math.abs(T),F=Math.abs(O);if(F>wt&&F>W*Tt){t=null;return}const v=t.fromLeftEdge?T>0:T<0;W>wt&&W>F*Tt&&v&&(t.moved=!0)},h=b=>{if(!t)return;const w=l(b.changedTouches,t.identifier);if(!w){t=null;return}const T=w.clientX-t.startX,O=t.fromLeftEdge?T>0:T<0;if(t.moved&&O&&Math.abs(T)>=Pt){u(),t=null;return}t.moved&&Math.abs(T)>=Pt&&u(),t=null},S=()=>{t&&(t.moved&&u(),t=null)};return{initialize:()=>{if(typeof window>"u"||i)return;i=!0;const b={passive:!0,capture:!0};window.addEventListener("touchstart",y,b),window.addEventListener("touchmove",p,b),window.addEventListener("touchend",h,b),window.addEventListener("touchcancel",S,b)},destroy:()=>{if(typeof window>"u"||!i)return;i=!1;const b={capture:!0};window.removeEventListener("touchstart",y,b),window.removeEventListener("touchmove",p,b),window.removeEventListener("touchend",h,b),window.removeEventListener("touchcancel",S,b),a(),f(),t=null,e=!1,n=!1},isSwipeBack:()=>{const b=e||n;return b&&a(),b},onPageEnter:()=>{e=!1,a(),f(),r=setTimeout(()=>{n=!1,r=null},0)}}}function se(t,e){return e?t.priority!==e.priority?t.priority>e.priority:t.specificity!==e.specificity?t.specificity>e.specificity:t.ruleIndex<e.ruleIndex:!0}function oe(t,e,n,s){let r=null;return n.forEach((i,l)=>{const a=i.priority??0;let f=null;if(i.on!==void 0){const u=i.except!==void 0&&N(t,i.except)!==null,y=i.except!==void 0&&N(e,i.except)!==null,p=u?null:N(t,i.on),h=y?null:N(e,i.on);if(p||h){const S=!p&&h?"forward":p&&!h?"backward":s;f={transition:i.transition,direction:S,ruleIndex:l,priority:a,specificity:Math.max((p==null?void 0:p.specificity)??0,(h==null?void 0:h.specificity)??0),reason:!p&&h?"on-enter":p&&!h?"on-leave":"on-history"}}}else if(i.ordered!==void 0){let u=-1,y=-1,p=-1,h=-1;i.ordered.forEach((S,M)=>{const k=N(t,S);k&&k.specificity>p&&(u=M,p=k.specificity);const R=N(e,S);R&&R.specificity>h&&(y=M,h=R.specificity)}),u>=0&&y>=0&&u!==y&&(f={transition:i.transition,direction:u<y?"forward":"backward",ruleIndex:l,priority:a,specificity:p+h,reason:"ordered"})}else{const u=N(t,i.from),y=N(e,i.to),p=i.bidirectional===!1?null:N(t,i.to),h=i.bidirectional===!1?null:N(e,i.from),S=u&&y,M=p&&h;if(S||M){const k=S?u.specificity+y.specificity:-1,R=M?p.specificity+h.specificity:-1,K=S&&M&&k===R?s:k>=R?"forward":"backward";f={transition:i.transition,direction:K,ruleIndex:l,priority:a,specificity:Math.max(k,R),reason:"pair"}}}f&&se(f,r)&&(r=f)}),r}function re(){const t=[];let e=!1;const n=()=>{e=!0};return typeof window<"u"&&window.addEventListener("popstate",n),{resolve(s,r){const i=V(s),l=V(r);if(t.length===0)t.push(i);else if(t[t.length-1]!==i){const u=t.lastIndexOf(i);u>=0?t.splice(u+1):t.push(i)}const a=t[t.length-2],f=e||a===l?"backward":"forward";if(e=!1,f==="backward"){const u=t.lastIndexOf(l);u>=0?t.splice(u+1):t.push(l)}else t[t.length-1]!==l&&t.push(l);return f},dispose(){typeof window<"u"&&window.removeEventListener("popstate",n)}}}function ce(t={}){let e=null,n=null;function s(){var i,l;e&&((i=e.out)==null||i.resolve(null),(l=e.in)==null||l.resolve(null),e=null)}function r(){if(e!=null&&e.out&&e.in){if(e.out.path===e.in.path){s();return}const i={from:e.out.path,to:e.in.path,out:e.out.payload,in:e.in.payload};n=i,e.out.resolve(i),e.in.resolve(i),e=null}}return{arrive(i,l,a){return new Promise(f=>{var h,S;const u=n===null?null:l==="out"?{path:n.from,payload:n.out}:{path:n.to,payload:n.in};if((u==null?void 0:u.path)===i){f(null);return}l==="out"&&((h=e==null?void 0:e.in)==null?void 0:h.path)===i&&!e.out&&(e.in.resolve(null),e.in=void 0);const y=e==null?void 0:e[l];y&&y.path!==i&&s(),e||(e={});const p=e[l];if(p){if(((S=t.keepCurrent)==null?void 0:S.call(t,{type:l,path:i,current:p.payload,next:a}))??!1){f(null);return}p.resolve(null)}e[l]={path:i,payload:a,resolve:f},r()})},cancel(i){(e!=null&&e.out&&i(e.out.payload)||e!=null&&e.in&&i(e.in.payload))&&s(),(n&&i(n.out)||n&&i(n.in))&&(n=null)}}}const le={},$=new Map;let J=null,xt=!1;function Rt(t,e,n){t instanceof HTMLElement&&$.has(t)&&!t.isConnected&&n.set(t,{entry:$.get(t),anchor:e});for(const s of Array.from(t.childNodes))Rt(s,e,n)}function ae(t){const e=new Set(Array.from(t.values(),({entry:n})=>n));for(const[n,{entry:s,anchor:r}]of t){$.delete(n);let i=s.parent,l=!1;for(;i;){if(i.group===s.group&&e.has(i)){l=!0;break}i=i.parent}queueMicrotask(()=>s.callback(r,{emit:!l}))}}function ue(){if(xt||typeof document>"u")return;xt=!0,J=new MutationObserver(e=>{const n=new Map;for(const s of e){const r={parent:s.target,nextSibling:s.nextSibling};for(const i of Array.from(s.removedNodes))Rt(i,r,n)}ae(n)});const t=()=>{J==null||J.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function de(t,e,n=le){ue();let s=t.parentElement,r=null;for(;s;){const i=$.get(s);if((i==null?void 0:i.group)===n){r=i;break}s=s.parentElement}return $.set(t,{element:t,callback:e,group:n,parent:r}),()=>{$.delete(t)}}const dt=new WeakMap;let tt=null;const et="none !important";function U(t){const e=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${e} !important`:e}function fe(){return tt||(tt=new MutationObserver(t=>{for(const e of t){const n=e.target,s=dt.get(n);if(!s)continue;const r=U(n);r!==s.accounted&&(s.accounted=r,r===et?(s.reactHidden=!0,s.onHide()):r!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),tt)}function he(t,e){const n=U(t),s={accounted:n,reactHidden:n===et,onHide:e.onHide,onShow:e.onShow};return dt.set(t,s),fe().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return U(t)===et},setDisplay(r,i=!1){r===null?t.style.removeProperty("display"):t.style.setProperty("display",r,i?"important":""),s.accounted=U(t)},sync(){s.accounted=U(t),s.reactHidden=s.accounted===et},stop(){dt.delete(t)}}}function pe(t,e={}){const{transitions:n=[],middleware:s=(o,c)=>({from:o,to:c}),preserveScroll:r=o=>o}=t,i=e.host??new kt,l={},a=ce({keepCurrent:({current:o,next:c})=>o.element.contains(c.element)}),f=re(),u=typeof n=="function"?n:()=>n,y=ie();y.initialize();const p=new Map,h=o=>{let c=p.get(o);return c===void 0&&(c=s(o,o).from,p.set(o,c)),c},{initializeContext:S,calculateScrollOffset:M,evictScrollPosition:k,shouldPreserve:R,getScrollContainer:K,getPositionedParentElement:b,getScrollPosition:w,getIsMobile:T}=ee({preserveScroll:r,resolvePath:h}),O=new Map,W=()=>{const o=T();let c=O.get(o);return c||(c=u({isMobile:o}),O.set(o,c)),c},F=new WeakMap,v=o=>{F.set(o,{parent:o.parentNode,nextSibling:o.nextSibling})},g=o=>{const c=F.get(o);return c||{parent:o.parentNode,nextSibling:o.nextSibling}},E=new WeakMap,P=new WeakMap;let A=0;const _=o=>{const c=typeof getComputedStyle<"u"?getComputedStyle(o).display:"";return c&&c!=="none"?c:"block"},D=(o,c)=>{c.visibleDisplay=o.style.getPropertyValue("display"),c.computedDisplay=_(o)},ft=(o,c)=>{if(P.get(o)!==c)return;P.delete(o);const d=E.get(o);d&&(d.savedCss!==null&&(o.style.cssText=d.savedCss,d.savedCss=null),d.intent==="hidden"?d.vis.setDisplay("none",!0):d.visibleDisplay?(d.vis.setDisplay(d.visibleDisplay,!1),D(o,d)):(d.vis.setDisplay(null),D(o,d)))},_t=(o,c,d,C,m,L)=>{const x=m.element,H=L.element,B=(m.mode??"unmount")==="hidden",{parent:Z,nextSibling:st}=m.parent?{parent:m.parent,nextSibling:m.nextSibling}:g(x),j=M(d,C),ot={direction:c,scrollOffset:j,from:{scroll:w(d)},to:{scroll:w(C)},get scrollingElement(){return K()||document.documentElement},get positionedParent(){return b()}};let I;if(B){I=x,I.style.top=`${-1*((j==null?void 0:j.y)??0)}px`;const z=E.get(H);z&&z.savedCss===null&&(z.savedCss=H.style.cssText)}else I=x,zt(I,ot);R(d)||k(d);const Q=B?++A:0;B&&(P.set(H,Q),P.set(x,Q));const mt=Promise.resolve(I),gt=Promise.resolve(H),vt=[],Ht={from:mt,to:gt,context:ot,createElement:((z,rt="div")=>{const q=document.createElement(rt);return q.setAttribute("data-ssgoi-id",z),vt.push(q),q})},Wt=Promise.resolve(o.prepare?o.prepare(Ht):{});$t({from:mt,to:gt,extras:Wt}).then(({from:z,to:rt,extras:q})=>{!B&&Z&&(st&&Z.contains(st)?Z.insertBefore(I,st):Z.appendChild(I));const ct=o.animation({from:z,to:rt,context:ot,...q}),lt=ct.onComplete;ct.onComplete=()=>{lt==null||lt(),B?(ft(x,Q),ft(H,Q)):I.parentNode&&I.parentNode.removeChild(I);for(const at of vt)at.parentNode&&at.parentNode.removeChild(at)},i.attach(ct)})},Y=(o,c,d)=>{const C=y.isSwipeBack();a.arrive(o,c,d).then(m=>{if(c==="in"&&y.onPageEnter(),!m)return;if(C&&c==="in"){const B=s(m.from,m.to);f.resolve(B.from,B.to)}if(C){c==="out"&&m.from&&!R(m.from)&&k(m.from);return}if(c!=="in")return;const{from:L,to:x}=s(m.from,m.to),H=f.resolve(L,x),X=oe(L,x,W(),H);X&&_t(X.transition,X.direction,m.from,m.to,m.out,m.in)})},Dt=(o,c)=>{const d=E.get(o);if(!d)return;const C=d.intent==="hidden";if(d.intent="hidden",d.savedCss===null&&(d.savedCss=o.style.cssText),d.vis.setDisplay(d.computedDisplay||"block",!0),o.style.position="absolute",o.style.width="100%",o.style.left="0",C)return;const m=g(o),L={element:o,parent:m.parent,nextSibling:m.nextSibling,mode:"hidden"},x=o.getAttribute("data-ssgoi-transition")??c;Y(x,"out",L)},It=(o,c)=>{const d=E.get(o);if(!d||d.intent==="visible")return;d.intent="visible",D(o,d),d.savedCss!==null&&(o.style.cssText=d.savedCss,d.visibleDisplay?d.vis.setDisplay(d.visibleDisplay,!1):d.vis.setDisplay(null)),S(o,c);const C={element:o,parent:o.parentElement,nextSibling:o.nextElementSibling},m=o.getAttribute("data-ssgoi-transition")??c;Y(m,"in",C)},Nt=(o,c,d,C=!0)=>{const m=E.get(o);if(m&&(m.vis.stop(),E.delete(o),P.delete(o),m.intent==="hidden")){a.cancel(X=>X.element===o);return}if(!C)return;const L=d??g(o),x={element:o,parent:L.parent,nextSibling:L.nextSibling,mode:"unmount"},H=o.getAttribute("data-ssgoi-transition")??c;Y(H,"out",x)},ht=new WeakSet,pt=(o,c,{enter:d=!0}={})=>{if(ht.has(c))return;ht.add(c),v(c);const C=he(c,{onHide:()=>Dt(c,o),onShow:()=>It(c,o)}),m={vis:C,savedCss:null,intent:C.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};if(E.set(c,m),!C.isHidden&&(D(c,m),d)){S(c,o);const L={element:c,parent:c.parentElement,nextSibling:c.nextElementSibling};Y(o,"in",L)}de(c,(L,x)=>Nt(c,o,L,(x==null?void 0:x.emit)??!0),l)},yt=new Map;return{register:pt,refFor:o=>{let c=yt.get(o);return c||(c=d=>{d&&pt(o,d)},yt.set(o,c)),c}}}const Lt="data-ssgoi-root",ye=`[${Lt}]`,nt="data-ssgoi-transition",At=`[${nt}]`,me="[data-ssgoi-clone]";function ge(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ve(t){return t.nodeType===Node.ELEMENT_NODE}function be(t){return t instanceof HTMLElement}function Ct(t){let e=0,n=t.parentElement;for(;n;)e++,n=n.parentElement;return e}function Mt(t,e,n=t){const s=Array.from(t).sort((r,i)=>Ct(r)-Ct(i));for(const r of s){const i=r.getAttribute(nt);if(i===null)continue;let l=r.parentElement,a=!1;for(;l;){if(n.has(l)){a=!0;break}l=l.parentElement}e.register(i,r,{enter:!a})}}function Ee(t,e){if(!ge())return()=>{};t.setAttribute(Lt,"");const n=a=>a.closest(ye)===t,s=a=>!be(a)||!n(a)||a.closest(me)||a.getAttribute(nt)===null?null:a,r=(a,f)=>{if(ve(a)){if(a.matches(At)){const u=s(a);u&&f.add(u)}for(const u of a.querySelectorAll(At)){const y=s(u);y&&f.add(y)}}},i=new MutationObserver(a=>{const f=new Set,u=new Set;for(const y of a){if(y.type==="attributes"){const p=s(y.target);p&&f.add(p);continue}for(const p of y.addedNodes)r(p,u)}for(const y of u)f.add(y);Mt(f,e,u)});i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[nt]});const l=new Set;return r(t,l),Mt(l,e),()=>i.disconnect()}exports.Animation=it.Animation;exports.MultiAnimation=it.MultiAnimation;exports.WebAnimation=it.WebAnimation;exports.HostAnimation=kt;exports.createSggoiTransitionContext=pe;exports.observeSsgoiTransitions=Ee;