@react-motion-router/core 2.0.0-beta.sha-20ff5ff → 2.0.0-beta.sha-4c84f16

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.
Files changed (34) hide show
  1. package/build/Anchor.d.ts +35 -0
  2. package/build/MetaData.d.ts +5 -5
  3. package/build/NavigationBase.d.ts +33 -14
  4. package/build/RouterBase.d.ts +12 -10
  5. package/build/RouterContext.d.ts +1 -1
  6. package/build/ScreenBase.d.ts +7 -7
  7. package/build/ScreenTransitionLayer.d.ts +2 -2
  8. package/build/ScreenTransitionProvider.d.ts +4 -4
  9. package/build/SharedElement.d.ts +4 -6
  10. package/build/SharedElementTransitionLayer.d.ts +2 -2
  11. package/build/__tests__/Anchor/index.test.d.ts +1 -0
  12. package/build/__tests__/Anchor/push.test.d.ts +1 -0
  13. package/build/__tests__/Anchor/reload.test.d.ts +1 -0
  14. package/build/__tests__/Anchor/replace.test.d.ts +1 -0
  15. package/build/__tests__/Anchor/traverse.test.d.ts +1 -0
  16. package/build/__tests__/RouterBase/get-router-by-id.test.d.ts +1 -0
  17. package/build/__tests__/RouterBase/index.test.d.ts +1 -0
  18. package/build/__tests__/RouterBase/preload-screen.test.d.ts +1 -0
  19. package/build/__tests__/RouterBase/screen-child-from-pathname.test.d.ts +1 -0
  20. package/build/__tests__/common/utils.d.ts +33 -0
  21. package/build/__tests__/lazy.test.d.ts +1 -0
  22. package/build/__tests__/load-event.test.d.ts +1 -0
  23. package/build/__tests__/meta-data.test.d.ts +1 -0
  24. package/build/__tests__/screen.test.d.ts +1 -0
  25. package/build/common/constants.d.ts +4 -0
  26. package/build/common/events.d.ts +5 -18
  27. package/build/common/promise-wrapper.d.ts +8 -0
  28. package/build/common/test-utils.d.ts +12 -0
  29. package/build/common/types.d.ts +17 -15
  30. package/build/common/utils.d.ts +4 -3
  31. package/build/index.d.ts +5 -0
  32. package/build/index.js +1141 -702
  33. package/build/index.js.map +1 -1
  34. package/package.json +5 -5
package/build/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsx as b, jsxs as Ht, Fragment as ae } from "react/jsx-runtime";
2
- import { createContext as dt, Component as it, createRef as K, lazy as oe, cloneElement as Xt, Suspense as Tt, isValidElement as Zt, Children as Bt, useContext as ht, useDebugValue as le, useSyncExternalStore as ce, useRef as he, useEffect as ue, useCallback as de } from "react";
3
- const Yt = dt(null);
4
- class qe extends it {
5
- ref = K();
6
- static contextType = Yt;
1
+ import { jsx as T, jsxs as ee, Fragment as ye } from "react/jsx-runtime";
2
+ import Lt, { createContext as gt, Component as at, createRef as z, Suspense as xt, isValidElement as ne, cloneElement as ie, lazy as we, Children as Xt, useContext as ft, useDebugValue as Ee, useSyncExternalStore as re, useRef as Ft, useEffect as se, useCallback as be } from "react";
3
+ const ae = gt(null);
4
+ class Je extends at {
5
+ ref = z();
6
+ static contextType = ae;
7
7
  componentDidMount() {
8
8
  this.scene.addNode(this);
9
9
  }
@@ -44,7 +44,7 @@ class qe extends it {
44
44
  this.ref.current && (this.ref.current.style.visibility = "visible");
45
45
  }
46
46
  render() {
47
- return /* @__PURE__ */ b(
47
+ return /* @__PURE__ */ T(
48
48
  "div",
49
49
  {
50
50
  ref: this.ref,
@@ -55,208 +55,34 @@ class qe extends it {
55
55
  );
56
56
  }
57
57
  }
58
- function bt(s, t) {
59
- s.endsWith("*") || (s += "**");
60
- const e = window.location.origin, n = new URLPattern(s, e).exec(t, e);
61
- if (!n)
62
- return null;
63
- const a = Object.keys(n.pathname.groups).filter((o) => !isNaN(Number(o))).map((o) => n.pathname.groups[o]).filter((o) => o !== void 0).at(-1) ?? "";
64
- return new URL(t.replace(a, ""), window.location.origin);
65
- }
66
- function _t(s, t, e = `${window.location.origin}/`, n = !0) {
67
- n || (s = s.toLowerCase(), t = t.toLowerCase());
68
- const r = bt(e, t)?.href;
69
- if (!r)
70
- return null;
71
- const a = new URLPattern({ baseURL: r, pathname: s }).exec({ pathname: t, baseURL: r }), o = a?.pathname.groups ?? {};
72
- return a ? {
73
- params: o,
74
- caseSensitive: n
75
- } : null;
76
- }
77
- function ze(s, t, e = window.location.origin) {
78
- return s.some(({ pattern: n, caseSensitive: r }) => _t(n, t, e, r));
79
- }
80
- function pe(s, t = window) {
81
- return new Promise((e) => {
82
- queueMicrotask(() => e(
83
- t.dispatchEvent(s)
84
- ));
85
- });
86
- }
87
- function Ge(s) {
88
- const t = oe(s);
89
- return t.load = async () => (t.module ??= await s(), t.module), t;
90
- }
91
- function He() {
92
- return !!window.navigation;
93
- }
94
- function Xe() {
95
- return !!globalThis.URLPattern;
96
- }
97
- async function Ze() {
98
- const { URLPattern: s } = await import(
99
- /*webpackIgnore: true*/
100
- "urlpattern-polyfill"
101
- );
102
- globalThis.URLPattern = s;
103
- }
104
- async function Ye() {
105
- const { applyPolyfill: s } = await import(
106
- /*webpackIgnore: true*/
107
- "@virtualstate/navigation"
108
- );
109
- s({
110
- history: !0,
111
- interceptEvents: !0,
112
- patch: !0,
113
- persist: !0,
114
- persistState: !0
115
- });
116
- }
117
- async function fe(s) {
118
- const t = [];
119
- for (const e of s)
120
- t.push(await e);
121
- return t;
122
- }
123
- function me(s) {
124
- return s.replace(/-([a-z])/g, (t) => t[1].toUpperCase());
125
- }
126
- function _e(s, t) {
127
- return Xt(s, t);
128
- }
129
- class ge extends Event {
130
- constructor() {
131
- super("transition-start");
132
- }
133
- }
134
- class ye extends Event {
135
- constructor() {
136
- super("transition-cancel");
137
- }
138
- }
139
- class ve extends Event {
140
- constructor() {
141
- super("transition-end");
142
- }
143
- }
144
- class Je extends Event {
145
- constructor() {
146
- super("motion-progress-start");
147
- }
148
- }
149
- class Qe extends Event {
150
- constructor() {
151
- super("motion-progress-end");
152
- }
153
- }
154
- class we extends Event {
155
- #t = "load";
156
- #e = !1;
157
- #c = !0;
158
- #h = !1;
159
- #u = null;
160
- #d = null;
161
- #a;
162
- #i;
163
- #o = new AbortController();
164
- #l = !1;
165
- #n = [];
166
- #s = null;
167
- hasUAVisualTransition = !1;
168
- constructor() {
169
- super("navigate", { cancelable: !1, bubbles: !1, composed: !1 });
170
- const t = window.navigation.currentEntry;
171
- if (!t)
172
- throw new Error("Current entry is null");
173
- this.#a = {
174
- getState() {
175
- return t.getState();
176
- },
177
- url: t.url ?? new URL(window.location.href).href,
178
- key: t.key,
179
- index: t.index,
180
- id: t.id,
181
- sameDocument: !0
182
- }, this.#i = this.#o.signal, window.navigation.addEventListener("navigate", this.#r, { signal: this.#i });
183
- }
184
- #r = (t) => {
185
- t !== this ? this.#o.abort() : this.#n.length || window.navigation.removeEventListener("navigate", this.#r);
186
- };
187
- intercept(t) {
188
- if (this.#l)
189
- throw new DOMException("Failed to execute 'intercept' on 'NavigateEvent': intercept() may only be called while the navigate event is being dispatched.");
190
- let e = null;
191
- this.#s || (this.#s = {
192
- finished: new Promise((r) => e = r),
193
- from: window.navigation.currentEntry,
194
- navigationType: "load"
195
- });
196
- const n = t?.handler?.();
197
- n && this.#n.push(n), this.#n.length === 1 && fe(this.#n).then(() => {
198
- this.#l = !0, window.removeEventListener("navigate", this.#r), e?.();
199
- });
200
- }
201
- scroll() {
202
- throw new Error("Method not implemented.");
203
- }
204
- get transition() {
205
- return this.#s;
206
- }
207
- get navigationType() {
208
- return this.#t;
209
- }
210
- get userInitiated() {
211
- return this.#e;
212
- }
213
- get canIntercept() {
214
- return this.#c;
215
- }
216
- get hashChange() {
217
- return this.#h;
218
- }
219
- get formData() {
220
- return this.#u;
221
- }
222
- get downloadRequest() {
223
- return this.#d;
224
- }
225
- get destination() {
226
- return this.#a;
227
- }
228
- get signal() {
229
- return this.#i;
230
- }
231
- }
232
- const Wt = dt(null);
233
- class Ee extends it {
234
- ref = K();
235
- static contextType = Wt;
236
- index = 0;
58
+ const Kt = gt(null), Qe = 2147483647, tn = 100, en = 0, nn = 0, rn = 1, oe = -1, O = 0, J = 1, sn = 0;
59
+ class Te extends at {
60
+ ref = z();
61
+ static contextType = Kt;
62
+ index = O;
237
63
  exiting = !1;
238
64
  state = {
239
65
  zIndex: "unset"
240
66
  };
241
- onAnimationEnd = () => {
67
+ onroutertransitionend() {
242
68
  this.ref.current && (this.ref.current.style.willChange = "auto", this.ref.current.style.pointerEvents = "auto");
243
- };
244
- onAnimationStart = () => {
69
+ }
70
+ onroutertransitionstart() {
245
71
  this.ref.current && (this.ref.current.style.willChange = "transform, opacity", this.ref.current.style.pointerEvents = "none");
246
- };
72
+ }
247
73
  componentDidMount() {
248
- this.props.navigation.addEventListener("transition-start", this.onAnimationStart), this.props.navigation.addEventListener("transition-end", this.onAnimationEnd), this.props.navigation.addEventListener("transition-cancel", this.onAnimationEnd);
74
+ this.props.navigation.addEventListener("routertransitionstart", this), this.props.navigation.addEventListener("routertransitionend", this), this.props.navigation.addEventListener("routertransitioncancel", this);
249
75
  }
250
76
  componentWillUnmount() {
251
- this.props.navigation.removeEventListener("transition-start", this.onAnimationStart), this.props.navigation.removeEventListener("transition-end", this.onAnimationEnd), this.props.navigation.removeEventListener("transition-cancel", this.onAnimationEnd);
77
+ this.props.navigation.removeEventListener("routertransitionstart", this), this.props.navigation.removeEventListener("routertransitionend", this), this.props.navigation.removeEventListener("routertransitioncancel", this);
252
78
  }
253
79
  get animationEffect() {
254
- const t = this.props.animation, { animation: e, direction: n, hasUAVisualTransition: r } = this.context, { timeline: a, playbackRate: o } = e, { index: l, exiting: m, ref: p } = this, w = this.context.screens.map((R) => R.current?.name);
80
+ const t = this.props.animation, { animation: e, direction: n, hasUAVisualTransition: r } = this.context, { timeline: a, playbackRate: o } = e, { index: l, exiting: f, ref: d } = this, m = this.context.screens.map((S) => S.current?.name);
255
81
  return t?.({
256
- ref: p.current,
82
+ ref: d.current,
257
83
  index: l,
258
- screens: w,
259
- exiting: m,
84
+ screens: m,
85
+ exiting: f,
260
86
  timeline: a,
261
87
  direction: n,
262
88
  playbackRate: o,
@@ -268,7 +94,7 @@ class Ee extends it {
268
94
  }
269
95
  render() {
270
96
  const t = this.props.renderAs, e = this.props.focused ? void 0 : "";
271
- return /* @__PURE__ */ b(
97
+ return /* @__PURE__ */ T(
272
98
  t,
273
99
  {
274
100
  id: this.props.id,
@@ -287,8 +113,8 @@ class Ee extends it {
287
113
  );
288
114
  }
289
115
  }
290
- const Jt = dt(null), pt = dt(null), Qt = dt(null);
291
- class Te {
116
+ const le = gt(null), vt = gt(null), ce = gt(null);
117
+ class Se {
292
118
  id;
293
119
  nodes = /* @__PURE__ */ new Map();
294
120
  getScreenRect = () => new DOMRect();
@@ -323,12 +149,12 @@ class Te {
323
149
  return !this.nodes.size;
324
150
  }
325
151
  }
326
- class be extends it {
152
+ class Re extends at {
327
153
  sharedElementScene;
328
- #t = K();
329
- ref = K();
154
+ #t = z();
155
+ ref = z();
330
156
  nestedRouterData;
331
- static contextType = pt;
157
+ static contextType = vt;
332
158
  state = {
333
159
  focused: !1,
334
160
  config: {},
@@ -336,7 +162,12 @@ class be extends it {
336
162
  elementType: "div"
337
163
  };
338
164
  constructor(t, e) {
339
- super(t), this.sharedElementScene = new Te(`${this.name}-shared-element-scene`), this.sharedElementScene.getScreenRect = () => this.ref.current?.getBoundingClientRect() || new DOMRect(), this.nestedRouterData = { parentScreen: this, parentRouter: e };
165
+ super(t), this.sharedElementScene = new Se(
166
+ `${this.name}-shared-element-scene`
167
+ ), this.sharedElementScene.getScreenRect = () => this.ref.current?.getBoundingClientRect() || new DOMRect(), this.nestedRouterData = {
168
+ parentScreen: this,
169
+ parentRouter: e
170
+ };
340
171
  }
341
172
  setParams(t) {
342
173
  this.setState(({ params: e }) => ({ params: { ...e, ...t } }));
@@ -351,17 +182,21 @@ class be extends it {
351
182
  return this.props.name ? this.props.name.toLowerCase().replace(/[^\w-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "") : B(this.props.component) ? this.props.component.module?.default.name.toLowerCase() : this.props.component.name.toLowerCase();
352
183
  }
353
184
  blur() {
354
- return new Promise((t) => this.setState({ focused: !1 }, t));
185
+ return new Promise((t) => {
186
+ this.setState({ focused: !1 }, t);
187
+ });
355
188
  }
356
189
  focus() {
357
- return new Promise((t) => this.setState({ focused: !0 }, t));
190
+ return new Promise((t) => {
191
+ this.setState({ focused: !0 }, t);
192
+ });
358
193
  }
359
194
  async load(t) {
360
195
  const e = this.props.component, n = this.props.config?.header?.component, r = this.props.config?.footer?.component;
361
196
  let a;
362
197
  B(e) ? a = await e.load() : a = { default: e }, B(n) && await n.load(), B(r) && await r.load();
363
- const o = this.context.navigation, l = this.routeProp, m = !1;
364
- return await this.props.config?.onLoad?.({ navigation: o, route: l, signal: t, preloading: m }), a;
198
+ const o = this.context.navigation, l = this.routeProp, f = !1;
199
+ return await this.props.config?.onLoad?.({ navigation: o, route: l, signal: t, preloading: f }), a;
365
200
  }
366
201
  async onExited(t) {
367
202
  await this.routeProp.config.onExited?.({
@@ -403,8 +238,8 @@ class be extends it {
403
238
  }
404
239
  render() {
405
240
  const t = this.context.navigation, e = this.routeProp, n = this.props.component, r = e.config.header?.component, a = e.config.footer?.component;
406
- return /* @__PURE__ */ b(
407
- Ee,
241
+ return /* @__PURE__ */ T(
242
+ Te,
408
243
  {
409
244
  ref: this.#t,
410
245
  renderAs: this.state.elementType,
@@ -412,7 +247,7 @@ class be extends it {
412
247
  animation: e.config.animation,
413
248
  navigation: t,
414
249
  focused: this.state.focused,
415
- children: /* @__PURE__ */ b(
250
+ children: /* @__PURE__ */ T(
416
251
  "div",
417
252
  {
418
253
  id: `${this.context.id}-${this.name}`,
@@ -425,10 +260,58 @@ class be extends it {
425
260
  flexDirection: "column",
426
261
  pointerEvents: "inherit"
427
262
  },
428
- children: /* @__PURE__ */ b(Yt.Provider, { value: this.sharedElementScene, children: /* @__PURE__ */ b(Qt.Provider, { value: e, children: /* @__PURE__ */ Ht(Jt.Provider, { value: this.nestedRouterData, children: [
429
- /* @__PURE__ */ b(Tt, { fallback: /* @__PURE__ */ b(Z, { component: e.config.header?.fallback, route: e, navigation: t }), children: /* @__PURE__ */ b(Z, { component: r, route: e, navigation: t }) }),
430
- /* @__PURE__ */ b(Tt, { fallback: /* @__PURE__ */ b(Z, { component: this.props.fallback, route: e, navigation: t }), children: /* @__PURE__ */ b(Z, { component: n, route: e, navigation: t }) }),
431
- /* @__PURE__ */ b(Tt, { fallback: /* @__PURE__ */ b(Z, { component: e.config.footer?.fallback, route: e, navigation: t }), children: /* @__PURE__ */ b(Z, { component: a, route: e, navigation: t }) })
263
+ children: /* @__PURE__ */ T(ae.Provider, { value: this.sharedElementScene, children: /* @__PURE__ */ T(ce.Provider, { value: e, children: /* @__PURE__ */ ee(le.Provider, { value: this.nestedRouterData, children: [
264
+ /* @__PURE__ */ T(xt, { fallback: /* @__PURE__ */ T(
265
+ _,
266
+ {
267
+ component: e.config.header?.fallback,
268
+ route: e,
269
+ navigation: t
270
+ }
271
+ ), children: /* @__PURE__ */ T(
272
+ _,
273
+ {
274
+ component: r,
275
+ route: e,
276
+ navigation: t
277
+ }
278
+ ) }),
279
+ /* @__PURE__ */ T(xt, { fallback: /* @__PURE__ */ T(
280
+ _,
281
+ {
282
+ component: this.props.fallback,
283
+ route: e,
284
+ navigation: t
285
+ }
286
+ ), children: /* @__PURE__ */ T(
287
+ _,
288
+ {
289
+ component: n,
290
+ route: e,
291
+ navigation: t
292
+ }
293
+ ) }),
294
+ /* @__PURE__ */ T(
295
+ xt,
296
+ {
297
+ fallback: /* @__PURE__ */ T(
298
+ _,
299
+ {
300
+ component: e.config.footer?.fallback,
301
+ route: e,
302
+ navigation: t
303
+ }
304
+ ),
305
+ children: /* @__PURE__ */ T(
306
+ _,
307
+ {
308
+ component: a,
309
+ route: e,
310
+ navigation: t
311
+ }
312
+ )
313
+ }
314
+ )
432
315
  ] }) }) })
433
316
  }
434
317
  )
@@ -436,41 +319,41 @@ class be extends it {
436
319
  );
437
320
  }
438
321
  }
439
- function Z({ component: s, route: t, navigation: e }) {
440
- B(s) && s.module?.default && (s = s.module.default);
441
- const n = s ?? null;
442
- return typeof n == "function" || te(n) ? /* @__PURE__ */ b(
322
+ function _({ component: i, route: t, navigation: e }) {
323
+ B(i) && i.module?.default && (i = i.module.default);
324
+ const n = i ?? null;
325
+ return typeof n == "function" || he(n) ? /* @__PURE__ */ T(
443
326
  n,
444
327
  {
445
328
  navigation: e,
446
329
  route: t
447
330
  }
448
- ) : Zt(n) ? Xt(n, {
331
+ ) : ne(n) ? ie(n, {
449
332
  navigation: e,
450
333
  route: t
451
- }) : /* @__PURE__ */ b(ae, { children: n });
334
+ }) : /* @__PURE__ */ T(ye, { children: n });
452
335
  }
453
- function Se(s) {
454
- return Zt(s) ? Object.getPrototypeOf(s.type) === be : !1;
336
+ function ke(i) {
337
+ return ne(i) ? Object.getPrototypeOf(i.type) === Re : !1;
455
338
  }
456
- function te(s) {
457
- return typeof s == "object" && s !== null && s.$$typeof === Symbol.for("react.lazy");
339
+ function he(i) {
340
+ return typeof i == "object" && i !== null && i.$$typeof === Symbol.for("react.lazy");
458
341
  }
459
- function B(s) {
460
- return te(s) && "load" in s;
342
+ function B(i) {
343
+ return he(i) && "load" in i;
461
344
  }
462
- function Re(s) {
463
- return "style" in s && s.style instanceof CSSStyleDeclaration;
345
+ function xe(i) {
346
+ return "style" in i && i.style instanceof CSSStyleDeclaration;
464
347
  }
465
- var ke = Object.defineProperty, xe = (s, t, e) => t in s ? ke(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, j = (s, t, e) => (xe(s, typeof t != "symbol" ? t + "" : t, e), e), It = (s, t, e) => {
466
- if (!t.has(s))
348
+ var Ce = Object.defineProperty, Le = (i, t, e) => t in i ? Ce(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, F = (i, t, e) => (Le(i, typeof t != "symbol" ? t + "" : t, e), e), Bt = (i, t, e) => {
349
+ if (!t.has(i))
467
350
  throw TypeError("Cannot " + e);
468
- }, i = (s, t, e) => (It(s, t, "read from private field"), e ? e.call(s) : t.get(s)), g = (s, t, e) => {
469
- if (t.has(s))
351
+ }, s = (i, t, e) => (Bt(i, t, "read from private field"), e ? e.call(i) : t.get(i)), v = (i, t, e) => {
352
+ if (t.has(i))
470
353
  throw TypeError("Cannot add the same private member more than once");
471
- t instanceof WeakSet ? t.add(s) : t.set(s, e);
472
- }, c = (s, t, e, n) => (It(s, t, "write to private field"), n ? n.call(s, e) : t.set(s, e), e), f = (s, t, e) => (It(s, t, "access private method"), e);
473
- const ut = {
354
+ t instanceof WeakSet ? t.add(i) : t.set(i, e);
355
+ }, c = (i, t, e, n) => (Bt(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), g = (i, t, e) => (Bt(i, t, "access private method"), e);
356
+ const pt = {
474
357
  delay: 0,
475
358
  direction: "normal",
476
359
  duration: "auto",
@@ -479,80 +362,80 @@ const ut = {
479
362
  fill: "auto",
480
363
  iterationStart: 0,
481
364
  iterations: 1
482
- }, $t = 1e3, Ce = window.Animation, ft = window.KeyframeEffect;
483
- function Ft(s) {
484
- return Array.isArray(s);
365
+ }, qt = 1e3, Me = window.Animation, yt = window.KeyframeEffect;
366
+ function Yt(i) {
367
+ return Array.isArray(i);
485
368
  }
486
- function H(s) {
487
- return typeof s == "object" && s === null;
369
+ function Y(i) {
370
+ return typeof i == "object" && i === null;
488
371
  }
489
- function h(s, t) {
490
- return H(s) || typeof s == "number" ? s : (t || ([t] = Object.keys(s.type())), s.to(t).value);
372
+ function h(i, t) {
373
+ return Y(i) || typeof i == "number" ? i : (t || ([t] = Object.keys(i.type())), i.to(t).value);
491
374
  }
492
- function Me(s, t = ut) {
375
+ function Pe(i, t = pt) {
493
376
  let { duration: e = "auto", iterations: n = 1, playbackRate: r = 1 } = t;
494
- if (H(s))
495
- return s;
496
- if (typeof s == "number" || s.type().percent === void 0)
377
+ if (Y(i))
378
+ return i;
379
+ if (typeof i == "number" || i.type().percent === void 0)
497
380
  throw new DOMException(
498
381
  "CSSNumericValue must be a percentage for progress based animations.",
499
382
  "NotSupportedError"
500
383
  );
501
384
  if (e === "auto")
502
- e = $t;
385
+ e = qt;
503
386
  else if (e instanceof CSSNumericValue)
504
387
  e = e.to("ms").value;
505
388
  else if (typeof e == "string")
506
389
  throw new TypeError("Unknown effect duration keyword.");
507
- const { delay: a = 0, endDelay: o = 0 } = t, l = e / n * n / Math.abs(r), m = a + l + o;
508
- return st(
509
- s.to("percent").value,
390
+ const { delay: a = 0, endDelay: o = 0 } = t, l = e / n * n / Math.abs(r), f = a + l + o;
391
+ return ot(
392
+ i.to("percent").value,
510
393
  [0, 100],
511
- [0, m]
394
+ [0, f]
512
395
  );
513
396
  }
514
- function Et(s) {
515
- if (H(s) || typeof s == "number")
516
- return s;
517
- if (s.type().time !== void 0)
397
+ function kt(i) {
398
+ if (Y(i) || typeof i == "number")
399
+ return i;
400
+ if (i.type().time !== void 0)
518
401
  throw new DOMException(
519
402
  "CSSNumericValue must be a time value for time based animations.",
520
403
  "NotSupportedError"
521
404
  );
522
- return s.to("ms").value;
405
+ return i.to("ms").value;
523
406
  }
524
- function Kt(s, t) {
525
- const e = t.length - 1, n = Math.floor(s * e), r = t[n], a = t[Math.min(n + 1, e)], o = s * e - n;
407
+ function Zt(i, t) {
408
+ const e = t.length - 1, n = Math.floor(i * e), r = t[n], a = t[Math.min(n + 1, e)], o = i * e - n;
526
409
  return r + o * (a - r);
527
410
  }
528
- function Le(s, t, e) {
411
+ function De(i, t, e) {
529
412
  let n = 0, r = 0;
530
- for (const [a, o] of Object.entries(s)) {
531
- const { min: l, max: m } = t, p = e[a] ?? 1, w = (o - l[a]) / (m[a] - l[a]) * p;
532
- n += w, r += p;
413
+ for (const [a, o] of Object.entries(i)) {
414
+ const { min: l, max: f } = t, d = e[a] ?? 1, m = (o - l[a]) / (f[a] - l[a]) * d;
415
+ n += m, r += d;
533
416
  }
534
417
  return n / r;
535
418
  }
536
- function st(s, t, e, n = {}) {
419
+ function ot(i, t, e, n = {}) {
537
420
  let r;
538
- if (typeof s == "number" && Ft(t)) {
421
+ if (typeof i == "number" && Yt(t)) {
539
422
  const o = { x: t[0] }, l = { x: t[1] };
540
- t = { min: o, max: l }, s = { x: s };
423
+ t = { min: o, max: l }, i = { x: i };
541
424
  } else
542
425
  throw new TypeError("Input and input range must have the same dimensions.");
543
- if (r = Le(s, t, n), r = Pe(r, 0, 1), Ft(e))
544
- return Kt(r, e);
426
+ if (r = De(i, t, n), r = Ne(r, 0, 1), Yt(e))
427
+ return Zt(r, e);
545
428
  const a = {};
546
429
  for (const o of Object.keys(e.min)) {
547
- const l = e.min[o], m = e.max[o], p = [l, m];
548
- a[o] = Kt(r, p);
430
+ const l = e.min[o], f = e.max[o], d = [l, f];
431
+ a[o] = Zt(r, d);
549
432
  }
550
433
  return a;
551
434
  }
552
- function Pe(s, t, e) {
553
- return s < t ? t : e && s > e ? e : s;
435
+ function Ne(i, t, e) {
436
+ return i < t ? t : e && i > e ? e : i;
554
437
  }
555
- function Ot(s) {
438
+ function zt(i) {
556
439
  let {
557
440
  duration: t = "auto",
558
441
  iterations: e = 1,
@@ -561,37 +444,37 @@ function Ot(s) {
561
444
  endDelay: a = 0,
562
445
  localTime: o = null,
563
446
  progress: l = null
564
- } = s;
565
- const m = new CSSUnitValue(100, "percent");
447
+ } = i;
448
+ const f = new CSSUnitValue(100, "percent");
566
449
  if (t === "auto")
567
- t = $t, r = 0, a = 0;
450
+ t = qt, r = 0, a = 0;
568
451
  else if (t instanceof CSSNumericValue)
569
452
  t = t.to("ms").value;
570
453
  else if (typeof t == "string")
571
454
  throw TypeError("Unknown effect duration keyword.");
572
- const p = t / e, w = p * e / Math.abs(n), R = r + w + a;
573
- t = new CSSUnitValue(p / R * 100, "percent");
574
- const T = CSS.percent(t.to("percent").value * e / Math.abs(n));
575
- return o !== null && (l = h(o, "percent") / m.value), {
576
- ...s,
455
+ const d = t / e, m = d * e / Math.abs(n), S = r + m + a;
456
+ t = new CSSUnitValue(d / S * 100, "percent");
457
+ const E = CSS.percent(t.to("percent").value * e / Math.abs(n));
458
+ return o !== null && (l = h(o, "percent") / f.value), {
459
+ ...i,
577
460
  progress: l,
578
- activeDuration: T,
461
+ activeDuration: E,
579
462
  duration: t,
580
463
  iterations: e,
581
464
  delay: r,
582
465
  endDelay: a,
583
- endTime: m
466
+ endTime: f
584
467
  };
585
468
  }
586
- function ee(s, t) {
587
- let { activeDuration: e = 0, localTime: n = null, endTime: r = 1 / 0, delay: a = 0 } = s;
469
+ function ue(i, t) {
470
+ let { activeDuration: e = 0, localTime: n = null, endTime: r = 1 / 0, delay: a = 0 } = i;
588
471
  if (r = h(r), e = h(e), n = h(n), n == null || n === void 0)
589
472
  return "idle";
590
473
  const o = Math.max(Math.min(a, r), 0), l = Math.max(Math.min(a + e, r), 0);
591
474
  return n < o || t === "backwards" && n === o ? "before" : n > l || t === "forwards" && n === l ? "after" : "active";
592
475
  }
593
- function De(s, t) {
594
- let { localTime: e = null, delay: n = 0, activeDuration: r = 0, fill: a } = s;
476
+ function Ue(i, t) {
477
+ let { localTime: e = null, delay: n = 0, activeDuration: r = 0, fill: a } = i;
595
478
  if (r = h(r), e = h(e), e == null || e === void 0)
596
479
  return null;
597
480
  switch (t) {
@@ -605,50 +488,50 @@ function De(s, t) {
605
488
  return null;
606
489
  }
607
490
  }
608
- function Ae(s, t, e) {
609
- const { duration: n = 0, iterations: r = 1, iterationStart: a = 0 } = s;
491
+ function Ae(i, t, e) {
492
+ const { duration: n = 0, iterations: r = 1, iterationStart: a = 0 } = i;
610
493
  if (typeof n != "number")
611
494
  throw new TypeError("Duration cannot be unresolved");
612
495
  let o = 0;
613
- return n === 0 ? t === "before" ? o = 0 : o = r : o = e / Et(n), o + a;
496
+ return n === 0 ? t === "before" ? o = 0 : o = r : o = e / kt(n), o + a;
614
497
  }
615
- function Ne(s, t, e, n) {
616
- const { iterations: r = 1, iterationStart: a = 0, activeDuration: o = 0 } = s;
617
- if (H(e))
498
+ function Ie(i, t, e, n) {
499
+ const { iterations: r = 1, iterationStart: a = 0, activeDuration: o = 0 } = i;
500
+ if (Y(e))
618
501
  return null;
619
502
  let l = 0;
620
503
  return e === 1 / 0 && (l = a % 1), l === 0 && (t === "active" || t === "after") && o === n && r !== 0 && (l = 1), l;
621
504
  }
622
- function ne(s, t) {
623
- const { iterations: e = 1 } = s, n = De(s, t);
624
- if (H(n))
505
+ function de(i, t) {
506
+ const { iterations: e = 1 } = i, n = Ue(i, t);
507
+ if (Y(n))
625
508
  return null;
626
509
  if (t === "after" && e === 1 / 0)
627
510
  return 1 / 0;
628
- const r = Ae(s, t, n);
629
- return Ne(s, t, r, n) === 1 ? Math.floor(r) - 1 : Math.floor(r);
511
+ const r = Ae(i, t, n);
512
+ return Ie(i, t, r, n) === 1 ? Math.floor(r) - 1 : Math.floor(r);
630
513
  }
631
- class Ue extends Event {
514
+ class We extends Event {
632
515
  constructor(t) {
633
- super("update", { bubbles: !1, cancelable: !1, composed: !1 }), j(this, "currentTime"), this.currentTime = t;
516
+ super("update", { bubbles: !1, cancelable: !1, composed: !1 }), F(this, "currentTime"), this.currentTime = t;
634
517
  }
635
518
  }
636
- var N, Y;
637
- class E extends EventTarget {
519
+ var U, Q;
520
+ class b extends EventTarget {
638
521
  constructor(t = { type: "swipe", axis: "x", rangeStart: 0, rangeEnd: window.screen.availWidth, source: document.body }) {
639
- super(), g(this, N, void 0), g(this, Y, void 0), t.source.addEventListener(t.type, this.onGesture.bind(this)), c(this, Y, CSS.percent(0)), c(this, N, t);
522
+ super(), v(this, U, void 0), v(this, Q, void 0), t.source.addEventListener(t.type, this.onGesture.bind(this)), c(this, Q, CSS.percent(0)), c(this, U, t);
640
523
  }
641
524
  onGesture(t) {
642
- const e = i(this, N).source.getBoundingClientRect();
525
+ const e = s(this, U).source.getBoundingClientRect();
643
526
  let n = 0;
644
527
  const r = {
645
528
  x: t.x - e.left,
646
529
  y: t.y - e.top
647
530
  };
648
- switch (i(this, N).type) {
531
+ switch (s(this, U).type) {
649
532
  case "swipe": {
650
- const { rangeStart: a, rangeEnd: o } = i(this, N), l = i(this, N).axis;
651
- n = st(
533
+ const { rangeStart: a, rangeEnd: o } = s(this, U), l = s(this, U).axis;
534
+ n = ot(
652
535
  r[l],
653
536
  [h(a, "px"), h(o, "px")],
654
537
  [0, 100]
@@ -656,9 +539,9 @@ class E extends EventTarget {
656
539
  break;
657
540
  }
658
541
  case "pan": {
659
- const { rangeStart: a, rangeEnd: o } = i(this, N), { x: l, y: m } = r;
660
- n = st(
661
- { x: l, y: m },
542
+ const { rangeStart: a, rangeEnd: o } = s(this, U), { x: l, y: f } = r;
543
+ n = ot(
544
+ { x: l, y: f },
662
545
  {
663
546
  min: { x: h(a.x, "px"), y: h(a.y, "px") },
664
547
  max: { x: h(o.x, "px"), y: h(o.y, "px") }
@@ -669,8 +552,8 @@ class E extends EventTarget {
669
552
  break;
670
553
  }
671
554
  case "pinch": {
672
- const { rangeStart: a, rangeEnd: o } = i(this, N), { scale: l } = t;
673
- n = st(
555
+ const { rangeStart: a, rangeEnd: o } = s(this, U), { scale: l } = t;
556
+ n = ot(
674
557
  l,
675
558
  [h(a, ""), h(o, "")],
676
559
  // figure out which unit
@@ -679,15 +562,15 @@ class E extends EventTarget {
679
562
  break;
680
563
  }
681
564
  case "rotate": {
682
- const { rangeStart: a, rangeEnd: o } = i(this, N), { rotation: l } = t;
683
- n = st(
565
+ const { rangeStart: a, rangeEnd: o } = s(this, U), { rotation: l } = t;
566
+ n = ot(
684
567
  l,
685
568
  [h(a, "deg"), h(o, "deg")],
686
569
  [0, 100]
687
570
  );
688
571
  }
689
572
  }
690
- c(this, Y, CSS.percent(n)), this.dispatchEvent(new Ue(i(this, Y)));
573
+ c(this, Q, CSS.percent(n)), this.dispatchEvent(new We(s(this, Q)));
691
574
  }
692
575
  addEventListener(t, e, n) {
693
576
  super.addEventListener(t, e, n);
@@ -696,26 +579,26 @@ class E extends EventTarget {
696
579
  super.removeEventListener(t, e, n);
697
580
  }
698
581
  get currentTime() {
699
- return i(this, Y);
582
+ return s(this, Q);
700
583
  }
701
584
  get phase() {
702
585
  return "active";
703
586
  }
704
587
  }
705
- N = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
706
- const A = /* @__PURE__ */ new WeakMap();
707
- var rt;
708
- class mt extends ft {
588
+ U = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap();
589
+ const N = /* @__PURE__ */ new WeakMap();
590
+ var lt;
591
+ class wt extends yt {
709
592
  constructor(t, e = null) {
710
- super(t), g(this, rt, null), c(this, rt, e);
593
+ super(t), v(this, lt, null), c(this, lt, e);
711
594
  }
712
595
  get parent() {
713
- return i(this, rt);
596
+ return s(this, lt);
714
597
  }
715
598
  getTiming() {
716
599
  var t;
717
600
  const e = super.getTiming();
718
- if (((t = A.get(this)) == null ? void 0 : t.timeline) instanceof E) {
601
+ if (((t = N.get(this)) == null ? void 0 : t.timeline) instanceof b) {
719
602
  if (e.duration === 1 / 0)
720
603
  throw TypeError("Effect duration cannot be Infinity for non-monotonic timelines.");
721
604
  if (e.iterations === 1 / 0)
@@ -726,12 +609,12 @@ class mt extends ft {
726
609
  getComputedTiming() {
727
610
  var t;
728
611
  const e = super.getComputedTiming();
729
- if (((t = A.get(this)) == null ? void 0 : t.timeline) instanceof E) {
612
+ if (((t = N.get(this)) == null ? void 0 : t.timeline) instanceof b) {
730
613
  if (e.duration === 1 / 0)
731
614
  throw TypeError("Effect duration cannot be Infinity for non-monotonic timelines.");
732
615
  if (e.iterations === 1 / 0)
733
616
  throw TypeError("Effect iterations cannot be Infinity for non-monotonic timelines.");
734
- return Ot(e);
617
+ return zt(e);
735
618
  }
736
619
  return e;
737
620
  }
@@ -743,12 +626,12 @@ class mt extends ft {
743
626
  duration: n.duration instanceof CSSNumericValue ? n.duration.to("ms").value : n.duration,
744
627
  ...t
745
628
  };
746
- let r = i(this, rt);
629
+ let r = s(this, lt);
747
630
  for (; r; ) {
748
631
  const a = r.getTiming();
749
632
  t != null && t.delay && (t.delay += a.delay ?? 0), t != null && t.endDelay && (t.endDelay += a.endDelay ?? 0), t != null && t.iterationStart && (t.iterationStart += a.iterationStart ?? 0), t != null && t.iterations && (t.iterations *= a.iterations ?? 1), t != null && t.playbackRate && (t.playbackRate *= a.playbackRate ?? 1), a.duration && typeof a.duration != "string" && t?.duration === "auto" && (t.duration = h(a.duration, "ms")), r = r.parent;
750
633
  }
751
- if (((e = A.get(this)) == null ? void 0 : e.timeline) instanceof E) {
634
+ if (((e = N.get(this)) == null ? void 0 : e.timeline) instanceof b) {
752
635
  if (t?.duration === 1 / 0)
753
636
  throw TypeError("Effect duration cannot be Infinity for non-monotonic timelines.");
754
637
  if (t != null && t.iterations)
@@ -757,17 +640,17 @@ class mt extends ft {
757
640
  return super.updateTiming(t);
758
641
  }
759
642
  }
760
- rt = /* @__PURE__ */ new WeakMap();
761
- var U, _;
762
- const We = class gt {
643
+ lt = /* @__PURE__ */ new WeakMap();
644
+ var A, tt;
645
+ const $e = class Et {
763
646
  constructor(t) {
764
- g(this, U, []), g(this, _, null), c(this, U, t.map((e) => (e instanceof gt ? c(e, _, this) : e instanceof ft && (e = new mt(e, this)), e)));
647
+ v(this, A, []), v(this, tt, null), c(this, A, t.map((e) => (e instanceof Et ? c(e, tt, this) : e instanceof yt && (e = new wt(e, this)), e)));
765
648
  }
766
649
  get parent() {
767
- return i(this, _);
650
+ return s(this, tt);
768
651
  }
769
652
  get children() {
770
- const t = i(this, U);
653
+ const t = s(this, A);
771
654
  return {
772
655
  length: t.length,
773
656
  item(e) {
@@ -776,30 +659,30 @@ const We = class gt {
776
659
  };
777
660
  }
778
661
  get firstChild() {
779
- return i(this, U).at(0) ?? null;
662
+ return s(this, A).at(0) ?? null;
780
663
  }
781
664
  get lastChild() {
782
- return i(this, U).at(-1) ?? null;
665
+ return s(this, A).at(-1) ?? null;
783
666
  }
784
667
  clone() {
785
668
  return structuredClone(this);
786
669
  }
787
670
  append(...t) {
788
671
  t.forEach((e) => {
789
- i(this, U).includes(e) || (e instanceof gt ? c(e, _, this) : e instanceof ft && (e = new mt(e, this)), i(this, U).push(e));
672
+ s(this, A).includes(e) || (e instanceof Et ? c(e, tt, this) : e instanceof yt && (e = new wt(e, this)), s(this, A).push(e));
790
673
  });
791
674
  }
792
675
  prepend(...t) {
793
676
  t.forEach((e) => {
794
- i(this, U).includes(e) || (e instanceof gt ? c(e, _, this) : e instanceof ft && (e = new mt(e, this)), i(this, U).unshift(e));
677
+ s(this, A).includes(e) || (e instanceof Et ? c(e, tt, this) : e instanceof yt && (e = new wt(e, this)), s(this, A).unshift(e));
795
678
  });
796
679
  }
797
680
  };
798
- U = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap();
799
- let Vt = We;
800
- class nt {
681
+ A = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap();
682
+ let Ht = $e;
683
+ class st {
801
684
  constructor() {
802
- j(this, "promise"), j(this, "state"), j(this, "nativeResolve"), j(this, "nativeReject"), this.state = "pending", this.nativeResolve = this.nativeReject = null, this.promise = new Promise((t, e) => {
685
+ F(this, "promise"), F(this, "state"), F(this, "nativeResolve"), F(this, "nativeReject"), this.state = "pending", this.nativeResolve = this.nativeReject = null, this.promise = new Promise((t, e) => {
803
686
  this.nativeResolve = t, this.nativeReject = e;
804
687
  });
805
688
  }
@@ -813,11 +696,11 @@ class nt {
813
696
  }), (e = this.nativeReject) == null || e.call(this, t);
814
697
  }
815
698
  }
816
- var J, St, ie;
817
- class Ie extends Vt {
818
- constructor(t, e = ut) {
819
- super(t), g(this, St), g(this, J, void 0), c(this, J, {
820
- ...ut,
699
+ var et, Mt, fe;
700
+ class Oe extends Ht {
701
+ constructor(t, e = pt) {
702
+ super(t), v(this, Mt), v(this, et, void 0), c(this, et, {
703
+ ...pt,
821
704
  ...e
822
705
  });
823
706
  }
@@ -828,31 +711,31 @@ class Ie extends Vt {
828
711
  super.append(...t), t.forEach((e) => e.updateTiming());
829
712
  }
830
713
  getTiming() {
831
- return i(this, J);
714
+ return s(this, et);
832
715
  }
833
716
  getComputedTiming() {
834
717
  var t, e;
835
718
  const n = this.getTiming(), r = { ...n }, { delay: a = 0 } = ((t = this.children.item(0)) == null ? void 0 : t.getComputedTiming()) ?? {}, { endDelay: o = 0, endTime: l = 0 } = ((e = this.children.item(this.children.length - 1)) == null ? void 0 : e.getComputedTiming()) ?? {};
836
719
  n.delay = n.delay ? n.delay + a : a, n.endDelay = n.endDelay ? n.endDelay + o : o, r.endTime = l;
837
720
  for (let C = 0; C < this.children.length; C++) {
838
- const M = this.children.item(C);
839
- if (!M)
721
+ const L = this.children.item(C);
722
+ if (!L)
840
723
  continue;
841
724
  let {
842
- duration: L = "auto",
843
- activeDuration: jt = 0
844
- } = M.getComputedTiming();
845
- r.activeDuration = r.activeDuration ? h(r.activeDuration, "ms") + h(jt, "ms") : jt, n.duration = n.duration instanceof CSSNumericValue ? n.duration.to("ms").value : n.duration, L = L instanceof CSSNumericValue ? L.to("ms").value : L, typeof L != "string" && (n.duration === "auto" ? n.duration = h(L, "ms") : typeof n.duration != "string" && (n.duration = n.duration ? n.duration + L : L));
725
+ duration: M = "auto",
726
+ activeDuration: Gt = 0
727
+ } = L.getComputedTiming();
728
+ r.activeDuration = r.activeDuration ? h(r.activeDuration, "ms") + h(Gt, "ms") : Gt, n.duration = n.duration instanceof CSSNumericValue ? n.duration.to("ms").value : n.duration, M = M instanceof CSSNumericValue ? M.to("ms").value : M, typeof M != "string" && (n.duration === "auto" ? n.duration = h(M, "ms") : typeof n.duration != "string" && (n.duration = n.duration ? n.duration + M : M));
846
729
  }
847
- const { timeline: m, startTime: p, currentTime: w } = A.get(this) ?? {}, R = m instanceof E ? "percent" : "ms";
848
- let { duration: T = 0, iterations: X = 1 } = r;
849
- if (T === "auto" && (T = 0), typeof T == "string")
730
+ const { timeline: f, startTime: d, currentTime: m } = N.get(this) ?? {}, S = f instanceof b ? "percent" : "ms";
731
+ let { duration: E = 0, iterations: Z = 1 } = r;
732
+ if (E === "auto" && (E = 0), typeof E == "string")
850
733
  throw new TypeError("Unknown effect duration keyword.");
851
- return r.duration = T, r.activeDuration = Et(T) * X, r.startTime = p ?? void 0, r.localTime = w, r.currentIteration = ne(r, ee(r, i(this, St, ie))), m instanceof E ? Ot(r) : (m instanceof DocumentTimeline && (r.progress = w && h(w, R) / h(l, R)), r);
734
+ return r.duration = E, r.activeDuration = kt(E) * Z, r.startTime = d ?? void 0, r.localTime = m, r.currentIteration = de(r, ue(r, s(this, Mt, fe))), f instanceof b ? zt(r) : (f instanceof DocumentTimeline && (r.progress = m && h(m, S) / h(l, S)), r);
852
735
  }
853
736
  updateTiming(t) {
854
- c(this, J, {
855
- ...i(this, J),
737
+ c(this, et, {
738
+ ...s(this, et),
856
739
  ...t
857
740
  });
858
741
  for (let e = 0; e < this.children.length; e++) {
@@ -861,23 +744,23 @@ class Ie extends Vt {
861
744
  }
862
745
  }
863
746
  }
864
- J = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ie = function() {
865
- const { playbackRate: s = 1 } = A.get(this) ?? {};
866
- return s < 0 ? "backwards" : "forwards";
747
+ et = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakSet(), fe = function() {
748
+ const { playbackRate: i = 1 } = N.get(this) ?? {};
749
+ return i < 0 ? "backwards" : "forwards";
867
750
  };
868
- var d, x, ct, v, S, P, u, y, k, z, O, at, W, yt, Rt, Q, ot, q, tt, kt, qt, xt, zt, Ct, Gt, F, G, lt, vt, Mt, I, V, D, $, wt, Lt, Pt;
869
- const se = class extends EventTarget {
751
+ var p, x, dt, w, R, P, u, y, k, G, V, ct, I, bt, Pt, nt, ht, H, it, Dt, _t, Nt, Jt, Ut, Qt, q, X, ut, Tt, At, W, j, D, $, St, It, Wt;
752
+ const pe = class extends EventTarget {
870
753
  constructor(t, e) {
871
- super(), g(this, yt), g(this, Q), g(this, q), g(this, kt), g(this, xt), g(this, Ct), g(this, F), g(this, vt), g(this, I), g(this, D), j(this, "id", ""), j(this, "oncancel", null), j(this, "onfinish", null), j(this, "onremove", null), g(this, d, void 0), g(this, x, void 0), g(this, ct, "active"), g(this, v, {
754
+ super(), v(this, bt), v(this, nt), v(this, H), v(this, Dt), v(this, Nt), v(this, Ut), v(this, q), v(this, Tt), v(this, W), v(this, D), F(this, "id", ""), F(this, "oncancel", null), F(this, "onfinish", null), F(this, "onremove", null), v(this, p, void 0), v(this, x, void 0), v(this, dt, "active"), v(this, w, {
872
755
  task: null,
873
756
  playbackRate: null
874
- }), g(this, S, new nt()), g(this, P, new nt()), g(this, u, null), g(this, y, null), g(this, k, []), g(this, z, null), g(this, O, !1), g(this, at, 0), g(this, W, 1), g(this, lt, () => {
875
- f(this, F, G).call(this);
876
- }), g(this, wt, () => {
757
+ }), v(this, R, new st()), v(this, P, new st()), v(this, u, null), v(this, y, null), v(this, k, []), v(this, G, null), v(this, V, !1), v(this, ct, 0), v(this, I, 1), v(this, ut, () => {
758
+ g(this, q, X).call(this);
759
+ }), v(this, St, () => {
877
760
  var n;
878
- if (i(this, P).state !== "pending" || this.playState !== "finished")
761
+ if (s(this, P).state !== "pending" || this.playState !== "finished")
879
762
  return;
880
- i(this, P).resolve(this);
763
+ s(this, P).resolve(this);
881
764
  const r = this.currentTime, a = (n = this.timeline) == null ? void 0 : n.currentTime, o = new AnimationPlaybackEvent(
882
765
  "finish",
883
766
  {
@@ -893,7 +776,7 @@ const se = class extends EventTarget {
893
776
  var l;
894
777
  this.dispatchEvent(o), (l = this.onfinish) == null || l.call(this, o);
895
778
  });
896
- }), g(this, Lt, () => {
779
+ }), v(this, It, () => {
897
780
  var n, r;
898
781
  const a = this.currentTime, o = (n = this.timeline) == null ? void 0 : n.currentTime, l = new AnimationPlaybackEvent(
899
782
  "cancel",
@@ -907,20 +790,20 @@ const se = class extends EventTarget {
907
790
  }
908
791
  );
909
792
  this.dispatchEvent(l), (r = this.oncancel) == null || r.call(this, l);
910
- }), g(this, Pt, () => {
793
+ }), v(this, Wt, () => {
911
794
  var n;
912
795
  const r = new Event("remove");
913
796
  this.dispatchEvent(r), (n = this.onremove) == null || n.call(this, r);
914
- }), i(this, S).resolve(this), c(this, x, t ?? null), c(this, d, e ?? document.timeline), i(this, x) && A.set(i(this, x), this), f(this, vt, Mt).call(this), e instanceof E && e.addEventListener("update", i(this, lt));
797
+ }), s(this, R).resolve(this), c(this, x, t ?? null), c(this, p, e ?? document.timeline), s(this, x) && N.set(s(this, x), this), g(this, Tt, At).call(this), e instanceof b && e.addEventListener("update", s(this, ut));
915
798
  }
916
799
  reverse() {
917
800
  var t;
918
- const { endTime: e = 0 } = ((t = i(this, x)) == null ? void 0 : t.getComputedTiming()) ?? {}, n = i(this, v).playbackRate ?? i(this, W), r = h(this.currentTime), a = e === 1 / 0, o = n !== 0 && (n < 0 || r && r > 0 || !a);
919
- if (!i(this, d) || !o) {
920
- o && (i(this, v).playbackRate = -n);
801
+ const { endTime: e = 0 } = ((t = s(this, x)) == null ? void 0 : t.getComputedTiming()) ?? {}, n = s(this, w).playbackRate ?? s(this, I), r = h(this.currentTime), a = e === 1 / 0, o = n !== 0 && (n < 0 || r && r > 0 || !a);
802
+ if (!s(this, p) || !o) {
803
+ o && (s(this, w).playbackRate = -n);
921
804
  return;
922
805
  }
923
- if (i(this, d).currentTime === null)
806
+ if (s(this, p).currentTime === null)
924
807
  throw new DOMException(
925
808
  "Cannot reverse an animation with no active timeline",
926
809
  "InvalidStateError"
@@ -928,58 +811,57 @@ const se = class extends EventTarget {
928
811
  this.updatePlaybackRate(-n), this.play();
929
812
  }
930
813
  play() {
931
- const t = this.playState === "paused" && this.pending;
932
- let e = this.currentTime;
933
- (i(this, v).playbackRate ?? this.playbackRate) === 0 && e === null && c(this, y, 0), e === null && c(this, O, !0), (this.playState === "finished" || t) && (c(this, u, null), c(this, y, null), c(this, O, !0)), i(this, y) && c(this, u, null), i(this, v).task && (i(this, v).task = null), !(i(this, u) !== null && i(this, y) === null && !t && i(this, v).playbackRate === null) && (f(this, F, G).call(this), f(this, Q, ot).call(this), i(this, v).task = "play", f(this, I, V).call(this, !1));
814
+ const t = this.playState === "paused" && this.pending, e = this.currentTime;
815
+ (s(this, w).playbackRate ?? this.playbackRate) === 0 && e === null && c(this, y, 0), e === null && c(this, V, !0), (this.playState === "finished" || t) && (c(this, u, null), c(this, y, null), c(this, V, !0)), s(this, y) && c(this, u, null), s(this, w).task && (s(this, w).task = null), !(s(this, u) !== null && s(this, y) === null && !t && s(this, w).playbackRate === null) && (g(this, q, X).call(this), g(this, nt, ht).call(this), s(this, w).task = "play", g(this, W, j).call(this, !1));
934
816
  }
935
817
  pause() {
936
- this.playState !== "paused" && (this.currentTime === null && c(this, O, !0), i(this, v).task && (i(this, v).task = null), f(this, Q, ot).call(this), i(this, v).task = "pause");
818
+ this.playState !== "paused" && (this.currentTime === null && c(this, V, !0), s(this, w).task && (s(this, w).task = null), g(this, nt, ht).call(this), s(this, w).task = "pause");
937
819
  }
938
820
  persist() {
939
- i(this, k).forEach((t) => t.persist()), c(this, ct, "persisted");
821
+ s(this, k).forEach((t) => t.persist()), c(this, dt, "persisted");
940
822
  }
941
823
  finish() {
942
824
  var t;
943
- const { endTime: e = 0 } = ((t = this.effect) == null ? void 0 : t.getComputedTiming()) ?? {}, n = i(this, v).playbackRate ?? i(this, W);
825
+ const { endTime: e = 0 } = ((t = this.effect) == null ? void 0 : t.getComputedTiming()) ?? {}, n = s(this, w).playbackRate ?? s(this, I);
944
826
  if (n === 0 || n > 0 && e === 1 / 0)
945
827
  throw new DOMException("InvalidStateError");
946
- f(this, D, $).call(this);
828
+ g(this, D, $).call(this);
947
829
  let r;
948
- if (n > 0 ? r = e : r = 0, f(this, yt, Rt).call(this, r), this.startTime === null && i(this, d) !== null && i(this, d).currentTime !== null && r !== null) {
949
- const a = i(this, d) instanceof E ? "percent" : "ms";
830
+ if (n > 0 ? r = e : r = 0, g(this, bt, Pt).call(this, r), this.startTime === null && s(this, p) !== null && s(this, p).currentTime !== null && r !== null) {
831
+ const a = s(this, p) instanceof b ? "percent" : "ms";
950
832
  r = h(r, a);
951
- const o = h(i(this, d).currentTime, a);
833
+ const o = h(s(this, p).currentTime, a);
952
834
  c(this, u, o - r / n);
953
835
  }
954
- i(this, v).task === "pause" && i(this, u) !== null && (c(this, y, null), f(this, q, tt).call(this), i(this, S).resolve(this)), i(this, v).task === "play" && i(this, u) !== null && (f(this, q, tt).call(this), i(this, S).resolve(this)), f(this, I, V).call(this, !0), i(this, k).forEach((a) => a.finish());
836
+ s(this, w).task === "pause" && s(this, u) !== null && (c(this, y, null), g(this, H, it).call(this), s(this, R).resolve(this)), s(this, w).task === "play" && s(this, u) !== null && (g(this, H, it).call(this), s(this, R).resolve(this)), g(this, W, j).call(this, !0), s(this, k).forEach((a) => a.finish());
955
837
  }
956
838
  commitStyles() {
957
- i(this, k).forEach((t) => {
958
- t.effect instanceof mt && (t.effect.target === null || t.effect.pseudoElement !== null) || t.commitStyles();
839
+ s(this, k).forEach((t) => {
840
+ t.effect instanceof wt && (t.effect.target === null || t.effect.pseudoElement !== null) || t.commitStyles();
959
841
  });
960
842
  }
961
843
  cancel() {
962
- this.playState !== "idle" && (f(this, D, $).call(this), i(this, S).reject(new DOMException("The user aborted a request", "AbortError")), f(this, q, tt).call(this), c(this, S, new nt()), i(this, P).state === "pending" && i(this, P).reject(new DOMException("The user aborted a request", "AbortError")), c(this, P, new nt()), i(this, k).forEach((t) => t.cancel())), c(this, u, null), c(this, y, null);
844
+ this.playState !== "idle" && (g(this, D, $).call(this), s(this, R).reject(new DOMException("The user aborted a request", "AbortError")), g(this, H, it).call(this), c(this, R, new st()), s(this, P).state === "pending" && s(this, P).reject(new DOMException("The user aborted a request", "AbortError")), c(this, P, new st()), s(this, k).forEach((t) => t.cancel())), c(this, u, null), c(this, y, null);
963
845
  }
964
846
  updatePlaybackRate(t) {
965
847
  var e;
966
- i(this, v).playbackRate = t;
848
+ s(this, w).playbackRate = t;
967
849
  const n = this.playState;
968
- if (i(this, S).state !== "pending")
850
+ if (s(this, R).state !== "pending")
969
851
  switch (n) {
970
852
  case "idle":
971
853
  case "paused":
972
- f(this, D, $).call(this);
854
+ g(this, D, $).call(this);
973
855
  break;
974
856
  case "finished": {
975
- const r = i(this, d) instanceof E ? "percent" : "ms", a = ((e = i(this, d)) == null ? void 0 : e.currentTime) ?? null;
857
+ const r = s(this, p) instanceof b ? "percent" : "ms", a = ((e = s(this, p)) == null ? void 0 : e.currentTime) ?? null;
976
858
  if (t === 0)
977
859
  c(this, u, h(a, r));
978
860
  else if (a !== null) {
979
861
  let o = null;
980
- o = (h(a, r) - (i(this, u) ?? 0)) * this.playbackRate, i(this, u) !== null && o !== null && c(this, u, (h(a, r) - o) / t);
862
+ o = (h(a, r) - (s(this, u) ?? 0)) * this.playbackRate, s(this, u) !== null && o !== null && c(this, u, (h(a, r) - o) / t);
981
863
  }
982
- f(this, D, $).call(this), f(this, I, V).call(this, !1), f(this, F, G).call(this);
864
+ g(this, D, $).call(this), g(this, W, j).call(this, !1), g(this, q, X).call(this);
983
865
  break;
984
866
  }
985
867
  default:
@@ -993,212 +875,210 @@ const se = class extends EventTarget {
993
875
  super.removeEventListener(t, e, n);
994
876
  }
995
877
  set playbackRate(t) {
996
- c(this, W, t), i(this, k).forEach((e) => {
878
+ c(this, I, t), s(this, k).forEach((e) => {
997
879
  e.playbackRate *= t;
998
880
  });
999
881
  }
1000
882
  set startTime(t) {
1001
- c(this, u, h(t)), i(this, k).forEach((e) => e.startTime = t);
883
+ c(this, u, h(t)), s(this, k).forEach((e) => e.startTime = t);
1002
884
  }
1003
885
  set currentTime(t) {
1004
886
  var e;
1005
- const n = i(this, d) instanceof E ? "percent" : "ms", r = h(((e = i(this, d)) == null ? void 0 : e.currentTime) ?? null, n);
1006
- if (H(t) && !H(r))
887
+ const n = s(this, p) instanceof b ? "percent" : "ms", r = h(((e = s(this, p)) == null ? void 0 : e.currentTime) ?? null, n);
888
+ if (Y(t) && !Y(r))
1007
889
  throw new TypeError("currentTime may not be changed from resolved to unresolved.");
1008
- c(this, O, !1), i(this, y) !== null || i(this, u) === null || r === null || this.playbackRate === 0 ? c(this, y, h(t, n)) : c(this, u, r - h(t, n) / this.playbackRate), (i(this, d) === null || r === null) && c(this, u, null), c(this, z, null), f(this, yt, Rt).call(this, t), i(this, v).task === "pause" && (c(this, y, h(t, n)), f(this, D, $).call(this), c(this, u, null), f(this, q, tt).call(this), i(this, S).resolve(this)), f(this, I, V).call(this, !0);
890
+ c(this, V, !1), s(this, y) !== null || s(this, u) === null || r === null || this.playbackRate === 0 ? c(this, y, h(t, n)) : c(this, u, r - h(t, n) / this.playbackRate), (s(this, p) === null || r === null) && c(this, u, null), c(this, G, null), g(this, bt, Pt).call(this, t), s(this, w).task === "pause" && (c(this, y, h(t, n)), g(this, D, $).call(this), c(this, u, null), g(this, H, it).call(this), s(this, R).resolve(this)), g(this, W, j).call(this, !0);
1009
891
  }
1010
892
  set timeline(t) {
1011
893
  var e, n;
1012
894
  const r = this.timeline;
1013
895
  if (r === t)
1014
896
  return;
1015
- i(this, d) instanceof E && i(this, d).removeEventListener("update", i(this, lt));
1016
- const a = this.playState, o = r instanceof E ? "percent" : "ms", l = h(this.currentTime, o), { progress: m = null, endTime: p = 0 } = ((e = i(this, x)) == null ? void 0 : e.getComputedTiming()) ?? {}, w = h(p, o), R = r instanceof E, T = t instanceof E, X = t instanceof DocumentTimeline, C = this.pending;
1017
- if (T)
1018
- c(this, d, t), t.addEventListener("update", i(this, lt)), f(this, D, $).call(this), c(this, O, !0), c(this, u, null), c(this, y, null), (a === "running" || a === "finished") && ((!i(this, S) || i(this, S).state === "resolved") && f(this, Q, ot).call(this), i(this, v).task = "play", i(this, k).forEach((M) => M.pause())), a === "paused" && m !== null && c(this, y, m * w), C && ((!i(this, S) || i(this, S).state === "resolved") && f(this, Q, ot).call(this), a === "paused" ? i(this, v).task = "pause" : i(this, v).task = "play"), i(this, u) !== null && c(this, y, null), f(this, I, V).call(this, !1);
1019
- else if (X) {
1020
- if (c(this, d, t), R) {
1021
- if (l !== null && m !== null) {
1022
- const { endTime: M = 0 } = ((n = i(this, x)) == null ? void 0 : n.getComputedTiming()) ?? {}, L = h(M, "ms");
1023
- this.currentTime = m * L;
897
+ s(this, p) instanceof b && s(this, p).removeEventListener("update", s(this, ut));
898
+ const a = this.playState, o = r instanceof b ? "percent" : "ms", l = h(this.currentTime, o), { progress: f = null, endTime: d = 0 } = ((e = s(this, x)) == null ? void 0 : e.getComputedTiming()) ?? {}, m = h(d, o), S = r instanceof b, E = t instanceof b, Z = t instanceof DocumentTimeline, C = this.pending;
899
+ if (E)
900
+ c(this, p, t), t.addEventListener("update", s(this, ut)), g(this, D, $).call(this), c(this, V, !0), c(this, u, null), c(this, y, null), (a === "running" || a === "finished") && ((!s(this, R) || s(this, R).state === "resolved") && g(this, nt, ht).call(this), s(this, w).task = "play", s(this, k).forEach((L) => L.pause())), a === "paused" && f !== null && c(this, y, f * m), C && ((!s(this, R) || s(this, R).state === "resolved") && g(this, nt, ht).call(this), a === "paused" ? s(this, w).task = "pause" : s(this, w).task = "play"), s(this, u) !== null && c(this, y, null), g(this, W, j).call(this, !1);
901
+ else if (Z) {
902
+ if (c(this, p, t), S) {
903
+ if (l !== null && f !== null) {
904
+ const { endTime: L = 0 } = ((n = s(this, x)) == null ? void 0 : n.getComputedTiming()) ?? {}, M = h(L, "ms");
905
+ this.currentTime = f * M;
1024
906
  }
1025
907
  switch (a) {
1026
908
  case "paused":
1027
- i(this, k).forEach((M) => M.pause());
909
+ s(this, k).forEach((L) => L.pause());
1028
910
  break;
1029
911
  case "running":
1030
912
  case "finished":
1031
- i(this, k).forEach((M) => M.play());
913
+ s(this, k).forEach((L) => L.play());
1032
914
  }
1033
915
  }
1034
916
  } else
1035
917
  throw TypeError("Unsupported timeline: " + t);
1036
918
  }
1037
919
  set effect(t) {
1038
- if (t !== i(this, x)) {
1039
- if (this.pending && f(this, q, tt).call(this), i(this, x) && A.delete(i(this, x)), t) {
1040
- const e = A.get(t);
1041
- e && (e.effect = null), A.set(t, this);
920
+ if (t !== s(this, x)) {
921
+ if (this.pending && g(this, H, it).call(this), s(this, x) && N.delete(s(this, x)), t) {
922
+ const e = N.get(t);
923
+ e && (e.effect = null), N.set(t, this);
1042
924
  }
1043
- c(this, x, t), f(this, vt, Mt).call(this), f(this, I, V).call(this, !1);
925
+ c(this, x, t), g(this, Tt, At).call(this), g(this, W, j).call(this, !1);
1044
926
  }
1045
927
  }
1046
928
  get ready() {
1047
- return i(this, S).promise;
929
+ return s(this, R).promise;
1048
930
  }
1049
931
  get finished() {
1050
- return i(this, P).promise;
932
+ return s(this, P).promise;
1051
933
  }
1052
934
  get playState() {
1053
935
  var t;
1054
936
  let { endTime: e = 0 } = ((t = this.effect) == null ? void 0 : t.getComputedTiming()) ?? {};
1055
- const n = i(this, d) instanceof E ? "percent" : "ms", r = h(this.startTime, n), a = h(this.currentTime, n);
1056
- return e = h(e, n), a === null && r === null && i(this, v).task === null ? "idle" : i(this, v).task === "pause" || r === null && i(this, v).task !== "play" ? "paused" : a !== null && (i(this, W) > 0 && a >= e || i(this, W) < 0 && a <= 0) ? "finished" : "running";
937
+ const n = s(this, p) instanceof b ? "percent" : "ms", r = h(this.startTime, n), a = h(this.currentTime, n);
938
+ return e = h(e, n), a === null && r === null && s(this, w).task === null ? "idle" : s(this, w).task === "pause" || r === null && s(this, w).task !== "play" ? "paused" : a !== null && (s(this, I) > 0 && a >= e || s(this, I) < 0 && a <= 0) ? "finished" : "running";
1057
939
  }
1058
940
  get playbackRate() {
1059
- return i(this, W);
941
+ return s(this, I);
1060
942
  }
1061
943
  get replaceState() {
1062
- return i(this, ct);
944
+ return s(this, dt);
1063
945
  }
1064
946
  get pending() {
1065
- return i(this, S).state === "pending";
947
+ return s(this, R).state === "pending";
1066
948
  }
1067
949
  get currentTime() {
1068
950
  var t;
1069
951
  const e = ((t = this.timeline) == null ? void 0 : t.currentTime) ?? null;
1070
- if (i(this, y)) {
952
+ if (s(this, y)) {
1071
953
  if (typeof e == "number")
1072
- return i(this, y);
1073
- const a = i(this, d) instanceof E ? "percent" : "ms";
1074
- return new CSSUnitValue(i(this, y), a);
954
+ return s(this, y);
955
+ const a = s(this, p) instanceof b ? "percent" : "ms";
956
+ return new CSSUnitValue(s(this, y), a);
1075
957
  }
1076
- if (e === null || i(this, u) === null)
958
+ if (e === null || s(this, u) === null)
1077
959
  return null;
1078
- const n = i(this, d) instanceof E ? "percent" : "ms";
1079
- let r = (h(e, n) - i(this, u)) * this.playbackRate;
960
+ const n = s(this, p) instanceof b ? "percent" : "ms";
961
+ let r = (h(e, n) - s(this, u)) * this.playbackRate;
1080
962
  return r === -0 && (r = 0), typeof e == "number" ? r : new CSSUnitValue(r, n);
1081
963
  }
1082
964
  get startTime() {
1083
965
  var t;
1084
- if (i(this, u) === null)
966
+ if (s(this, u) === null)
1085
967
  return null;
1086
968
  if (typeof (((t = this.timeline) == null ? void 0 : t.currentTime) ?? null) == "number")
1087
- return i(this, u);
1088
- const e = i(this, d) instanceof E ? "percent" : "ms";
1089
- return new CSSUnitValue(i(this, u), e);
969
+ return s(this, u);
970
+ const e = s(this, p) instanceof b ? "percent" : "ms";
971
+ return new CSSUnitValue(s(this, u), e);
1090
972
  }
1091
973
  get timeline() {
1092
- return i(this, d);
974
+ return s(this, p);
1093
975
  }
1094
976
  get effect() {
1095
- return i(this, x);
977
+ return s(this, x);
1096
978
  }
1097
979
  };
1098
- d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ct = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), yt = /* @__PURE__ */ new WeakSet(), Rt = function(s) {
980
+ p = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), ct = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakSet(), Pt = function(i) {
1099
981
  var t;
1100
- const e = h(((t = i(this, d)) == null ? void 0 : t.currentTime) ?? null);
1101
- if (s === null && e !== null)
982
+ const e = h(((t = s(this, p)) == null ? void 0 : t.currentTime) ?? null);
983
+ if (i === null && e !== null)
1102
984
  throw new TypeError();
1103
- s === null || e === null || (s = h(s), c(this, O, !1), i(this, y) !== null || i(this, u) === null || i(this, d) instanceof E && i(this, d).phase === "inactive" || i(this, W) === 0 ? c(this, y, s) : c(this, u, e - s / i(this, W)), i(this, d) instanceof E && i(this, d).phase === "inactive" && c(this, u, null), c(this, z, null));
1104
- }, Q = /* @__PURE__ */ new WeakSet(), ot = function() {
1105
- i(this, S).state !== "pending" && c(this, S, new nt()), cancelAnimationFrame(i(this, at)), c(this, at, requestAnimationFrame(() => {
1106
- var s;
1107
- (((s = i(this, d)) == null ? void 0 : s.currentTime) ?? null) !== null && (f(this, Ct, Gt).call(this), i(this, v).task === "play" && (i(this, u) !== null || i(this, y) !== null) ? f(this, kt, qt).call(this) : i(this, v).task === "pause" && f(this, xt, zt).call(this), Promise.all(i(this, k).map((t) => t.finished)).then(i(this, wt)), Promise.all(i(this, k).map((t) => new Promise((e) => t.onremove = e))).then(i(this, Pt)), Promise.all(i(this, k).map((t) => new Promise((e) => t.oncancel = e))).then(i(this, Lt)).then(() => c(this, ct, "removed")));
985
+ i === null || e === null || (i = h(i), c(this, V, !1), s(this, y) !== null || s(this, u) === null || s(this, p) instanceof b && s(this, p).phase === "inactive" || s(this, I) === 0 ? c(this, y, i) : c(this, u, e - i / s(this, I)), s(this, p) instanceof b && s(this, p).phase === "inactive" && c(this, u, null), c(this, G, null));
986
+ }, nt = /* @__PURE__ */ new WeakSet(), ht = function() {
987
+ s(this, R).state !== "pending" && c(this, R, new st()), cancelAnimationFrame(s(this, ct)), c(this, ct, requestAnimationFrame(() => {
988
+ var i;
989
+ (((i = s(this, p)) == null ? void 0 : i.currentTime) ?? null) !== null && (g(this, Ut, Qt).call(this), s(this, w).task === "play" && (s(this, u) !== null || s(this, y) !== null) ? g(this, Dt, _t).call(this) : s(this, w).task === "pause" && g(this, Nt, Jt).call(this), Promise.all(s(this, k).map((t) => t.finished)).then(s(this, St)), Promise.all(s(this, k).map((t) => new Promise((e) => t.onremove = e))).then(s(this, Wt)), Promise.all(s(this, k).map((t) => new Promise((e) => t.oncancel = e))).then(s(this, It)).then(() => c(this, dt, "removed")));
1108
990
  }));
1109
- }, q = /* @__PURE__ */ new WeakSet(), tt = function() {
1110
- cancelAnimationFrame(i(this, at)), i(this, v).task = null;
1111
- }, kt = /* @__PURE__ */ new WeakSet(), qt = function() {
1112
- var s;
1113
- const t = ((s = this.timeline) == null ? void 0 : s.currentTime) ?? null;
991
+ }, H = /* @__PURE__ */ new WeakSet(), it = function() {
992
+ cancelAnimationFrame(s(this, ct)), s(this, w).task = null;
993
+ }, Dt = /* @__PURE__ */ new WeakSet(), _t = function() {
994
+ var i;
995
+ const t = ((i = this.timeline) == null ? void 0 : i.currentTime) ?? null;
1114
996
  if (t === null)
1115
997
  return;
1116
- const e = i(this, d) instanceof E ? "percent" : "ms";
1117
- if (i(this, y) !== null)
1118
- f(this, D, $).call(this), this.playbackRate === 0 ? c(this, u, h(t, e)) : (c(this, u, h(t, e) - i(this, y) / this.playbackRate), c(this, y, null));
1119
- else if (i(this, u) !== null && i(this, v).playbackRate !== null) {
1120
- const n = (h(t, e) - i(this, u)) * this.playbackRate;
1121
- f(this, D, $).call(this);
998
+ const e = s(this, p) instanceof b ? "percent" : "ms";
999
+ if (s(this, y) !== null)
1000
+ g(this, D, $).call(this), this.playbackRate === 0 ? c(this, u, h(t, e)) : (c(this, u, h(t, e) - s(this, y) / this.playbackRate), c(this, y, null));
1001
+ else if (s(this, u) !== null && s(this, w).playbackRate !== null) {
1002
+ const n = (h(t, e) - s(this, u)) * this.playbackRate;
1003
+ g(this, D, $).call(this);
1122
1004
  const r = this.playbackRate;
1123
1005
  r === 0 ? (c(this, y, null), c(this, u, h(t, e))) : c(this, u, h(t, e) - n / r);
1124
1006
  }
1125
- i(this, S).state === "pending" && i(this, S).resolve(this), f(this, I, V).call(this, !1), f(this, F, G).call(this), i(this, v).task = null, this.timeline instanceof DocumentTimeline && i(this, k).forEach((n) => n.play());
1126
- }, xt = /* @__PURE__ */ new WeakSet(), zt = function() {
1127
- var s;
1128
- const t = ((s = this.timeline) == null ? void 0 : s.currentTime) ?? null;
1007
+ s(this, R).state === "pending" && s(this, R).resolve(this), g(this, W, j).call(this, !1), g(this, q, X).call(this), s(this, w).task = null, this.timeline instanceof DocumentTimeline && s(this, k).forEach((n) => n.play());
1008
+ }, Nt = /* @__PURE__ */ new WeakSet(), Jt = function() {
1009
+ var i;
1010
+ const t = ((i = this.timeline) == null ? void 0 : i.currentTime) ?? null;
1129
1011
  if (t === null)
1130
1012
  return;
1131
- const e = i(this, d) instanceof E ? "percent" : "ms", n = t;
1132
- i(this, u) !== null && i(this, y) === null && c(this, y, (h(n, e) - i(this, u)) * this.playbackRate), f(this, D, $).call(this), c(this, u, null), i(this, S).resolve(this), f(this, I, V).call(this, !1), f(this, F, G).call(this), i(this, v).task = null, i(this, k).forEach((r) => r.pause());
1133
- }, Ct = /* @__PURE__ */ new WeakSet(), Gt = function() {
1134
- if (i(this, O) && !(!i(this, d) || !i(this, d).currentTime) && !(this.playState === "idle" || this.playState === "paused" && i(this, y) !== null)) {
1135
- if (i(this, d) instanceof E) {
1136
- const s = i(this, v).playbackRate ?? this.playbackRate;
1137
- c(this, u, s >= 0 ? 0 : 100);
1013
+ const e = s(this, p) instanceof b ? "percent" : "ms", n = t;
1014
+ s(this, u) !== null && s(this, y) === null && c(this, y, (h(n, e) - s(this, u)) * this.playbackRate), g(this, D, $).call(this), c(this, u, null), s(this, R).resolve(this), g(this, W, j).call(this, !1), g(this, q, X).call(this), s(this, w).task = null, s(this, k).forEach((r) => r.pause());
1015
+ }, Ut = /* @__PURE__ */ new WeakSet(), Qt = function() {
1016
+ if (s(this, V) && !(!s(this, p) || !s(this, p).currentTime) && !(this.playState === "idle" || this.playState === "paused" && s(this, y) !== null)) {
1017
+ if (s(this, p) instanceof b) {
1018
+ const i = s(this, w).playbackRate ?? this.playbackRate;
1019
+ c(this, u, i >= 0 ? 0 : 100);
1138
1020
  } else
1139
- c(this, u, h(i(this, d).currentTime, "ms"));
1021
+ c(this, u, h(s(this, p).currentTime, "ms"));
1140
1022
  c(this, y, null);
1141
1023
  }
1142
- }, F = /* @__PURE__ */ new WeakSet(), G = function() {
1143
- var s;
1144
- const t = ((s = i(this, d)) == null ? void 0 : s.currentTime) ?? null;
1024
+ }, q = /* @__PURE__ */ new WeakSet(), X = function() {
1025
+ var i;
1026
+ const t = ((i = s(this, p)) == null ? void 0 : i.currentTime) ?? null;
1145
1027
  if (t === null)
1146
1028
  return;
1147
- const e = i(this, x), n = i(this, d) instanceof E ? Me(t, e?.getTiming()) : Et(t);
1029
+ const e = s(this, x), n = s(this, p) instanceof b ? Pe(t, e?.getTiming()) : kt(t);
1148
1030
  let r = null;
1149
- if (i(this, u) !== null) {
1031
+ if (s(this, u) !== null) {
1150
1032
  const a = h(t, "percent") === (this.playbackRate < 0 ? 0 : 100) ? this.playbackRate < 0 ? 1e-3 : -1e-3 : 0;
1151
- r = (n - i(this, u)) * this.playbackRate, r += a;
1152
- } else if (i(this, y) !== null)
1153
- r = i(this, y);
1033
+ r = (n - s(this, u)) * this.playbackRate, r += a;
1034
+ } else if (s(this, y) !== null)
1035
+ r = s(this, y);
1154
1036
  else
1155
1037
  return;
1156
- i(this, k).forEach((a) => a.currentTime = r);
1157
- }, lt = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakSet(), Mt = function() {
1158
- var s;
1159
- let t = i(this, x);
1160
- const e = [];
1161
- if (t instanceof Vt)
1038
+ s(this, k).forEach((a) => a.currentTime = r);
1039
+ }, ut = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakSet(), At = function() {
1040
+ var i;
1041
+ const t = s(this, x), e = [];
1042
+ if (t instanceof Ht)
1162
1043
  for (let n = 0; n < t.children.length; n++) {
1163
- const r = new se(t.children.item(n));
1164
- if (t instanceof Ie && n > 0) {
1165
- const { endTime: a = null } = ((s = e[n - 1].effect) == null ? void 0 : s.getComputedTiming()) ?? {};
1044
+ const r = new pe(t.children.item(n));
1045
+ if (t instanceof Oe && n > 0) {
1046
+ const { endTime: a = null } = ((i = e[n - 1].effect) == null ? void 0 : i.getComputedTiming()) ?? {};
1166
1047
  r.startTime = h(a, "ms");
1167
1048
  }
1168
1049
  e.push(r);
1169
1050
  }
1170
1051
  else {
1171
- const n = i(this, d) instanceof E ? document.timeline : i(this, d);
1172
- e.push(new Ce(t, n));
1052
+ const n = s(this, p) instanceof b ? document.timeline : s(this, p);
1053
+ e.push(new Me(t, n));
1173
1054
  }
1174
1055
  c(this, k, e);
1175
- }, I = /* @__PURE__ */ new WeakSet(), V = function(s) {
1056
+ }, W = /* @__PURE__ */ new WeakSet(), j = function(i) {
1176
1057
  var t, e;
1177
- const n = ((t = i(this, d)) == null ? void 0 : t.currentTime) ?? null, r = i(this, d) instanceof E ? "percent" : "ms";
1178
- let a = h(this.currentTime, r);
1179
- if (a && i(this, u) !== null && !this.pending) {
1180
- let { delay: o = 0, endDelay: l = 0, iterations: m = 1, duration: p = "auto" } = ((e = i(this, x)) == null ? void 0 : e.getTiming()) ?? {};
1181
- const w = i(this, v).playbackRate ?? this.playbackRate;
1182
- if (p === "auto")
1183
- p = i(this, d) instanceof E ? $t : 0;
1184
- else if (p instanceof CSSNumericValue)
1185
- p = p.to("ms").value;
1186
- else if (typeof p == "string")
1058
+ const n = ((t = s(this, p)) == null ? void 0 : t.currentTime) ?? null, r = s(this, p) instanceof b ? "percent" : "ms", a = h(this.currentTime, r);
1059
+ if (a && s(this, u) !== null && !this.pending) {
1060
+ let { delay: o = 0, endDelay: l = 0, iterations: f = 1, duration: d = "auto" } = ((e = s(this, x)) == null ? void 0 : e.getTiming()) ?? {};
1061
+ const m = s(this, w).playbackRate ?? this.playbackRate;
1062
+ if (d === "auto")
1063
+ d = s(this, p) instanceof b ? qt : 0;
1064
+ else if (d instanceof CSSNumericValue)
1065
+ d = d.to("ms").value;
1066
+ else if (typeof d == "string")
1187
1067
  throw new TypeError("Unknown effect duration keyword.");
1188
- const R = o + p * m + l;
1189
- let T = h(i(this, z), r);
1190
- w > 0 && a >= R && i(this, z) !== null ? ((T === null || T < R) && (T = R), c(this, y, s ? a : T)) : w < 0 && a <= 0 ? ((T === null || T > 0) && (T = 0), c(this, y, s ? a : T)) : w !== 0 && (s && i(this, y) !== null && (n !== null ? c(this, u, h(n, r) - i(this, y) / w) : c(this, u, null)), c(this, y, null));
1068
+ const S = o + d * f + l;
1069
+ let E = h(s(this, G), r);
1070
+ m > 0 && a >= S && s(this, G) !== null ? ((E === null || E < S) && (E = S), c(this, y, i ? a : E)) : m < 0 && a <= 0 ? ((E === null || E > 0) && (E = 0), c(this, y, i ? a : E)) : m !== 0 && (i && s(this, y) !== null && (n !== null ? c(this, u, h(n, r) - s(this, y) / m) : c(this, u, null)), c(this, y, null));
1191
1071
  }
1192
- f(this, F, G).call(this), c(this, z, this.currentTime), this.playState === "finished" ? i(this, P).state === "pending" && i(this, wt).call(this) : i(this, P).state === "resolved" && c(this, P, new nt());
1072
+ g(this, q, X).call(this), c(this, G, this.currentTime), this.playState === "finished" ? s(this, P).state === "pending" && s(this, St).call(this) : s(this, P).state === "resolved" && c(this, P, new st());
1193
1073
  }, D = /* @__PURE__ */ new WeakSet(), $ = function() {
1194
- i(this, v).playbackRate && (this.playbackRate = i(this, v).playbackRate), i(this, v).playbackRate = null;
1195
- }, wt = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap();
1196
- let $e = se;
1197
- var et, Dt, re;
1198
- class At extends Vt {
1199
- constructor(t, e = ut) {
1200
- super(t), g(this, Dt), g(this, et, void 0), c(this, et, {
1201
- ...ut,
1074
+ s(this, w).playbackRate && (this.playbackRate = s(this, w).playbackRate), s(this, w).playbackRate = null;
1075
+ }, St = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap();
1076
+ let Ve = pe;
1077
+ var rt, $t, me;
1078
+ class Ot extends Ht {
1079
+ constructor(t, e = pt) {
1080
+ super(t), v(this, $t), v(this, rt, void 0), c(this, rt, {
1081
+ ...pt,
1202
1082
  ...e
1203
1083
  }), t.forEach((n) => n.updateTiming());
1204
1084
  }
@@ -1209,32 +1089,32 @@ class At extends Vt {
1209
1089
  super.append(...t), t.forEach((e) => e.updateTiming());
1210
1090
  }
1211
1091
  getTiming() {
1212
- return i(this, et);
1092
+ return s(this, rt);
1213
1093
  }
1214
1094
  getComputedTiming() {
1215
1095
  const t = this.getTiming(), e = { ...t };
1216
- for (let w = 0; w < this.children.length; w++) {
1217
- const R = this.children.item(w);
1218
- if (!R)
1096
+ for (let m = 0; m < this.children.length; m++) {
1097
+ const S = this.children.item(m);
1098
+ if (!S)
1219
1099
  continue;
1220
1100
  let {
1221
- delay: T = 0,
1222
- endDelay: X = 0,
1101
+ delay: E = 0,
1102
+ endDelay: Z = 0,
1223
1103
  duration: C = "auto",
1224
- activeDuration: M = 0,
1225
- endTime: L = 0
1226
- } = R.getComputedTiming();
1227
- t.delay = t.delay ? Math.min(t.delay, T) : T, t.endDelay = t.endDelay ? Math.max(t.endDelay, X) : X, e.endTime = e.endTime ? Math.max(h(e.endTime, "ms"), h(L, "ms")) : L, e.activeDuration = e.activeDuration ? Math.max(h(e.activeDuration, "ms"), h(M, "ms")) : M, t.duration = t.duration instanceof CSSNumericValue ? t.duration.to("ms").value : t.duration, C = C instanceof CSSNumericValue ? C.to("ms").value : C, typeof C != "string" && (t.duration === "auto" ? t.duration = h(C, "ms") : typeof t.duration != "string" && (t.duration = t.duration ? Math.max(t.duration, C) : C));
1104
+ activeDuration: L = 0,
1105
+ endTime: M = 0
1106
+ } = S.getComputedTiming();
1107
+ t.delay = t.delay ? Math.min(t.delay, E) : E, t.endDelay = t.endDelay ? Math.max(t.endDelay, Z) : Z, e.endTime = e.endTime ? Math.max(h(e.endTime, "ms"), h(M, "ms")) : M, e.activeDuration = e.activeDuration ? Math.max(h(e.activeDuration, "ms"), h(L, "ms")) : L, t.duration = t.duration instanceof CSSNumericValue ? t.duration.to("ms").value : t.duration, C = C instanceof CSSNumericValue ? C.to("ms").value : C, typeof C != "string" && (t.duration === "auto" ? t.duration = h(C, "ms") : typeof t.duration != "string" && (t.duration = t.duration ? Math.max(t.duration, C) : C));
1228
1108
  }
1229
- const { timeline: n, startTime: r, currentTime: a } = A.get(this) ?? {}, o = n instanceof E ? "percent" : "ms";
1230
- let { duration: l = 0, iterations: m = 1, endTime: p = 0 } = e;
1109
+ const { timeline: n, startTime: r, currentTime: a } = N.get(this) ?? {}, o = n instanceof b ? "percent" : "ms";
1110
+ let { duration: l = 0, iterations: f = 1, endTime: d = 0 } = e;
1231
1111
  if (l === "auto" && (l = 0), typeof l == "string")
1232
1112
  throw new TypeError("Unknown effect duration keyword.");
1233
- return e.duration = l, e.activeDuration = Et(l) * m, e.startTime = r ?? void 0, e.localTime = a, e.currentIteration = ne(e, ee(e, i(this, Dt, re))), n instanceof E ? Ot(e) : (n instanceof DocumentTimeline && (e.progress = a && h(a, o) / h(p, o)), e);
1113
+ return e.duration = l, e.activeDuration = kt(l) * f, e.startTime = r ?? void 0, e.localTime = a, e.currentIteration = de(e, ue(e, s(this, $t, me))), n instanceof b ? zt(e) : (n instanceof DocumentTimeline && (e.progress = a && h(a, o) / h(d, o)), e);
1234
1114
  }
1235
1115
  updateTiming(t) {
1236
- c(this, et, {
1237
- ...i(this, et),
1116
+ c(this, rt, {
1117
+ ...s(this, rt),
1238
1118
  ...t
1239
1119
  });
1240
1120
  for (let e = 0; e < this.children.length; e++) {
@@ -1243,12 +1123,135 @@ class At extends Vt {
1243
1123
  }
1244
1124
  }
1245
1125
  }
1246
- et = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakSet(), re = function() {
1247
- const { playbackRate: s = 1 } = A.get(this) ?? {};
1248
- return s < 0 ? "backwards" : "forwards";
1126
+ rt = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakSet(), me = function() {
1127
+ const { playbackRate: i = 1 } = N.get(this) ?? {};
1128
+ return i < 0 ? "backwards" : "forwards";
1249
1129
  };
1250
- class Oe extends it {
1251
- ref = K();
1130
+ function Vt(i, t) {
1131
+ i.endsWith("*") || (i += "**");
1132
+ const e = window.location.origin, n = new URLPattern(i, e).exec(t, e);
1133
+ if (!n)
1134
+ return null;
1135
+ const a = Object.keys(n.pathname.groups).filter((o) => !isNaN(Number(o))).map((o) => n.pathname.groups[o]).filter((o) => o !== void 0).at(oe) ?? "";
1136
+ return new URL(
1137
+ t.replace(a, ""),
1138
+ window.location.origin
1139
+ );
1140
+ }
1141
+ function te(i, t, e = `${window.location.origin}/`, n = !0) {
1142
+ n || (i = i.toLowerCase(), t = t.toLowerCase());
1143
+ const r = Vt(e, t)?.href;
1144
+ if (!r)
1145
+ return null;
1146
+ const a = new URLPattern({
1147
+ baseURL: r,
1148
+ pathname: i
1149
+ }).exec({ pathname: t, baseURL: r }), o = a?.pathname.groups ?? {};
1150
+ return a ? {
1151
+ params: o,
1152
+ caseSensitive: n
1153
+ } : null;
1154
+ }
1155
+ function je(i, t = window) {
1156
+ return new Promise((e) => {
1157
+ queueMicrotask(() => e(
1158
+ t.dispatchEvent(i)
1159
+ ));
1160
+ });
1161
+ }
1162
+ function on(i) {
1163
+ const t = we(i);
1164
+ return t.load = async () => (t.module ??= await i(), t.module), t;
1165
+ }
1166
+ function ln() {
1167
+ return !!window.navigation;
1168
+ }
1169
+ function cn() {
1170
+ return !!globalThis.URLPattern;
1171
+ }
1172
+ async function hn() {
1173
+ const { URLPattern: i } = await import("urlpattern-polyfill");
1174
+ globalThis.URLPattern = i;
1175
+ }
1176
+ async function un() {
1177
+ const { applyPolyfill: i } = await import("@virtualstate/navigation");
1178
+ i({
1179
+ history: !0,
1180
+ interceptEvents: !0,
1181
+ patch: !0,
1182
+ persist: !0,
1183
+ persistState: !0
1184
+ });
1185
+ }
1186
+ async function Fe(i) {
1187
+ const t = [];
1188
+ for (const e of i)
1189
+ t.push(await e);
1190
+ return t;
1191
+ }
1192
+ function Ke(i) {
1193
+ return i.replace(/-([a-z])/g, (t) => t[1].toUpperCase());
1194
+ }
1195
+ function dn(i, t) {
1196
+ return ie(i, t);
1197
+ }
1198
+ function Be(i, t) {
1199
+ const e = { ...i };
1200
+ for (const n of t)
1201
+ delete e[n];
1202
+ return e;
1203
+ }
1204
+ function qe(i) {
1205
+ return Object.create(
1206
+ EventTarget.prototype,
1207
+ {
1208
+ id: {
1209
+ value: i.id,
1210
+ enumerable: !0,
1211
+ writable: !1,
1212
+ configurable: !1
1213
+ },
1214
+ key: {
1215
+ value: i.key,
1216
+ enumerable: !0,
1217
+ writable: !1,
1218
+ configurable: !1
1219
+ },
1220
+ url: {
1221
+ value: i.url,
1222
+ enumerable: !0,
1223
+ writable: !1,
1224
+ configurable: !1
1225
+ },
1226
+ index: {
1227
+ value: i.index,
1228
+ enumerable: !0,
1229
+ writable: !1,
1230
+ configurable: !1
1231
+ },
1232
+ sameDocument: {
1233
+ value: i.sameDocument,
1234
+ enumerable: !0,
1235
+ writable: !1,
1236
+ configurable: !1
1237
+ },
1238
+ getState: {
1239
+ value: () => i.getState(),
1240
+ enumerable: !1,
1241
+ writable: !1,
1242
+ configurable: !1
1243
+ },
1244
+ ondispose: {
1245
+ value: null,
1246
+ enumerable: !0,
1247
+ writable: !0,
1248
+ configurable: !1
1249
+ }
1250
+ }
1251
+ );
1252
+ }
1253
+ class ze extends at {
1254
+ ref = z();
1252
1255
  #t = null;
1253
1256
  #e = null;
1254
1257
  state = {
@@ -1270,12 +1273,12 @@ class Oe extends it {
1270
1273
  const n = {}, r = window.getComputedStyle(t);
1271
1274
  for (const a of e) {
1272
1275
  let o;
1273
- a === "offset" ? o = "cssOffset" : a === "float" ? o = "cssFloat" : o = me(a), n[o] = r.getPropertyValue(a);
1276
+ a === "offset" ? o = "cssOffset" : a === "float" ? o = "cssFloat" : o = Ke(a), n[o] = r.getPropertyValue(a);
1274
1277
  }
1275
1278
  return n;
1276
1279
  }
1277
1280
  copyStyles(t, e, n) {
1278
- if (!Re(t))
1281
+ if (!xe(t))
1279
1282
  return;
1280
1283
  const r = window.getComputedStyle(t);
1281
1284
  for (const a of n) {
@@ -1356,7 +1359,7 @@ class Oe extends it {
1356
1359
  );
1357
1360
  break;
1358
1361
  case "morph": {
1359
- const m = Array.from(/* @__PURE__ */ new Set([...t.instance.styles, ...e.instance.styles]));
1362
+ const f = Array.from(/* @__PURE__ */ new Set([...t.instance.styles, ...e.instance.styles]));
1360
1363
  n.push(
1361
1364
  new KeyframeEffect(
1362
1365
  e.clone,
@@ -1369,7 +1372,7 @@ class Oe extends it {
1369
1372
  },
1370
1373
  {
1371
1374
  ...Object.fromEntries((e.instance.ref.current?.firstElementChild).attributeStyleMap),
1372
- ...this.getKeyframeProperties(e.instance.ref.current?.firstElementChild, m),
1375
+ ...this.getKeyframeProperties(e.instance.ref.current?.firstElementChild, f),
1373
1376
  transform: l,
1374
1377
  width: `${e.rect.width}px`,
1375
1378
  height: `${e.rect.height}px`
@@ -1381,7 +1384,7 @@ class Oe extends it {
1381
1384
  break;
1382
1385
  }
1383
1386
  }
1384
- return new At(n);
1387
+ return new Ot(n);
1385
1388
  }
1386
1389
  get animationEffect() {
1387
1390
  const t = this.outgoingScreen?.current?.sharedElementScene, e = this.incomingScreen?.current?.sharedElementScene;
@@ -1393,23 +1396,23 @@ class Oe extends it {
1393
1396
  const o = a.getBoundingClientRect(), l = t.nodes.get(r);
1394
1397
  if (!l?.canTransition || !a.canTransition)
1395
1398
  continue;
1396
- const m = l.getBoundingClientRect(), p = a.clone(), w = l.clone();
1397
- if (!w || !p)
1399
+ const f = l.getBoundingClientRect(), d = a.clone(), m = l.clone();
1400
+ if (!m || !d)
1398
1401
  continue;
1399
- const R = Array.from(/* @__PURE__ */ new Set([...l.styles, ...a.styles]));
1400
- a.transitionType !== "morph" ? (w.id = `${r}-start`, w.style.position = "absolute", w.style.gridArea = "1 / 1", w.style.margin = "0", this.copyStyles(l.ref.current?.firstElementChild, w, R), this.copyStyles(a.ref.current?.firstElementChild, p, R), w.style.width = `${m.width}px`, w.style.height = `${m.height}px`, p.style.width = `${o.width}px`, p.style.height = `${o.height}px`, this.ref.current?.prepend(w)) : (this.copyStyles(l.ref.current?.firstElementChild, p, R), p.style.width = `${m.width}px`, p.style.height = `${m.height}px`), p.id = `${r}${a.transitionType === "morph" ? "" : "-end"}`, p.style.position = "absolute", p.style.gridArea = "1 / 1", p.style.margin = "0", this.ref.current?.prepend(p), l.hide(), a.hide();
1401
- const T = async () => {
1402
- this.props.direction === "forwards" ? a.unhide() : l.unhide(), p.remove(), w.remove();
1402
+ const S = Array.from(/* @__PURE__ */ new Set([...l.styles, ...a.styles]));
1403
+ a.transitionType !== "morph" ? (m.id = `${r}-start`, m.style.position = "absolute", m.style.gridArea = "1 / 1", m.style.margin = "0", this.copyStyles(l.ref.current?.firstElementChild, m, S), this.copyStyles(a.ref.current?.firstElementChild, d, S), m.style.width = `${f.width}px`, m.style.height = `${f.height}px`, d.style.width = `${o.width}px`, d.style.height = `${o.height}px`, this.ref.current?.prepend(m)) : (this.copyStyles(l.ref.current?.firstElementChild, d, S), d.style.width = `${f.width}px`, d.style.height = `${f.height}px`), d.id = `${r}${a.transitionType === "morph" ? "" : "-end"}`, d.style.position = "absolute", d.style.gridArea = "1 / 1", d.style.margin = "0", this.ref.current?.prepend(d), l.hide(), a.hide();
1404
+ const E = async () => {
1405
+ this.props.direction === "forwards" ? a.unhide() : l.unhide(), d.remove(), m.remove();
1403
1406
  };
1404
- this.props.navigation.addEventListener("transition-end", T, { once: !0 }), this.props.navigation.addEventListener("transition-cancel", T, { once: !0 }), n.push(this.getAnimationEffect(
1405
- { instance: l, clone: w, rect: m },
1406
- { instance: a, clone: p, rect: o }
1407
+ this.props.navigation.addEventListener("routertransitionend", E, { once: !0 }), this.props.navigation.addEventListener("routertransitioncancel", E, { once: !0 }), n.push(this.getAnimationEffect(
1408
+ { instance: l, clone: m, rect: f },
1409
+ { instance: a, clone: d, rect: o }
1407
1410
  ));
1408
1411
  }
1409
- return new At(n);
1412
+ return new Ot(n);
1410
1413
  }
1411
1414
  render() {
1412
- return /* @__PURE__ */ b("dialog", { className: "shared-element-layer", ref: this.ref, style: {
1415
+ return /* @__PURE__ */ T("dialog", { className: "shared-element-layer", ref: this.ref, style: {
1413
1416
  maxWidth: "unset",
1414
1417
  maxHeight: "unset",
1415
1418
  width: "100vw",
@@ -1419,28 +1422,30 @@ class Oe extends it {
1419
1422
  border: "none",
1420
1423
  backgroundColor: "transparent",
1421
1424
  isolation: "isolate"
1422
- }, children: /* @__PURE__ */ b("style", { children: `
1423
- .shared-element-layer::backdrop {display: none}
1424
- .shared-element-layer[open] {display:grid}
1425
- ` }) });
1425
+ }, children: /* @__PURE__ */ T("style", { children: `
1426
+ .shared-element-layer::backdrop {display: none}
1427
+ .shared-element-layer[open] {display:grid}
1428
+ ` }) });
1426
1429
  }
1427
1430
  }
1428
- class Ve extends it {
1429
- sharedElementTransitionLayer = K();
1430
- animation = new $e();
1431
+ class He extends at {
1432
+ sharedElementTransitionLayer = z();
1433
+ animation = new Ve();
1431
1434
  #t = "normal";
1432
1435
  #e = [];
1433
1436
  state = {
1434
1437
  gestureNavigating: !1
1435
1438
  };
1436
1439
  onTransitionCancel() {
1437
- this.props.navigation.dispatchEvent(new ye());
1440
+ this.props.navigation.dispatchEvent(
1441
+ new TransitionEvent("routertransitioncancel")
1442
+ );
1438
1443
  }
1439
1444
  onTransitionStart() {
1440
- this.props.navigation.dispatchEvent(new ge());
1445
+ this.props.navigation.dispatchEvent(new TransitionEvent("routertransitionstart"));
1441
1446
  }
1442
1447
  onTransitionEnd() {
1443
- this.props.navigation.dispatchEvent(new ve());
1448
+ this.props.navigation.dispatchEvent(new TransitionEvent("routertransitionend"));
1444
1449
  }
1445
1450
  get screens() {
1446
1451
  return this.#e;
@@ -1458,7 +1463,7 @@ class Ve extends it {
1458
1463
  return this.props.hasUAVisualTransition;
1459
1464
  }
1460
1465
  transition() {
1461
- const t = new At(
1466
+ const t = new Ot(
1462
1467
  this.screens.map((r) => r.current?.transitionProvider?.current?.animationEffect ?? null).filter((r) => r !== null)
1463
1468
  ), e = this.sharedElementTransitionLayer.current?.animationEffect, n = t.getComputedTiming().duration;
1464
1469
  return e && (e.updateTiming({
@@ -1471,16 +1476,16 @@ class Ve extends it {
1471
1476
  }), this.animation;
1472
1477
  }
1473
1478
  render() {
1474
- return /* @__PURE__ */ Ht(Wt.Provider, { value: this, children: [
1475
- /* @__PURE__ */ b(
1476
- Oe,
1479
+ return /* @__PURE__ */ ee(Kt.Provider, { value: this, children: [
1480
+ /* @__PURE__ */ T(
1481
+ ze,
1477
1482
  {
1478
1483
  ref: this.sharedElementTransitionLayer,
1479
1484
  navigation: this.props.navigation,
1480
1485
  direction: this.animation.playbackRate > 0 ? "forwards" : "backwards"
1481
1486
  }
1482
1487
  ),
1483
- /* @__PURE__ */ b(
1488
+ /* @__PURE__ */ T(
1484
1489
  "div",
1485
1490
  {
1486
1491
  className: this.props.id,
@@ -1497,41 +1502,170 @@ class Ve extends it {
1497
1502
  ] });
1498
1503
  }
1499
1504
  }
1500
- class Nt extends it {
1501
- ref = K();
1502
- screenTransitionLayer = K();
1505
+ class Ge {
1506
+ promise;
1507
+ state;
1508
+ #t;
1509
+ #e;
1510
+ constructor() {
1511
+ this.state = "pending", this.#t = this.#e = null, this.promise = new Promise((t, e) => {
1512
+ this.#t = t, this.#e = e;
1513
+ });
1514
+ }
1515
+ resolve(t) {
1516
+ this.state = "resolved", this.#t?.(t);
1517
+ }
1518
+ reject(t) {
1519
+ this.state = "rejected", this.promise.catch(() => {
1520
+ }), this.#e?.(t);
1521
+ }
1522
+ }
1523
+ class ge extends Event {
1524
+ #t;
1525
+ #e = !1;
1526
+ #r = !0;
1527
+ #n = !1;
1528
+ #d = null;
1529
+ #f = null;
1530
+ #l;
1531
+ #s;
1532
+ #c = new AbortController();
1533
+ #h = !1;
1534
+ #i = [];
1535
+ #a = null;
1536
+ #u = new Ge();
1537
+ hasUAVisualTransition = !1;
1538
+ constructor(t, e) {
1539
+ super("navigate", { cancelable: !1, bubbles: !1, composed: !1 }), this.#t = t;
1540
+ const {
1541
+ destination: n = window.navigation.currentEntry
1542
+ } = e ?? {};
1543
+ if (!n)
1544
+ throw new Error("Destination is null");
1545
+ this.#l = {
1546
+ getState() {
1547
+ return n.getState();
1548
+ },
1549
+ url: n.url ?? new URL(window.location.href).href,
1550
+ key: n.key,
1551
+ index: n.index,
1552
+ id: n.id,
1553
+ sameDocument: !0
1554
+ }, this.#s = this.#c.signal, window.navigation.addEventListener(
1555
+ "navigate",
1556
+ this.#o,
1557
+ { signal: this.#s }
1558
+ );
1559
+ }
1560
+ #o = (t) => {
1561
+ t !== this ? this.#c.abort() : this.#i.length || window.navigation.removeEventListener("navigate", this.#o);
1562
+ };
1563
+ intercept(t) {
1564
+ if (this.#h)
1565
+ throw new DOMException("Failed to execute 'intercept' on 'NavigateEvent': intercept() may only be called while the navigate event is being dispatched.");
1566
+ const e = t?.handler?.();
1567
+ e && this.#i.push(e), this.#i.length === J && Fe(this.#i).then(() => {
1568
+ this.#h = !0, window.removeEventListener("navigate", this.#o), this.#u.resolve();
1569
+ });
1570
+ }
1571
+ scroll() {
1572
+ throw new Error("Method not implemented.");
1573
+ }
1574
+ get transition() {
1575
+ return this.#a || (this.#a = {
1576
+ finished: this.#u.promise,
1577
+ from: window.navigation.currentEntry,
1578
+ navigationType: this.#t
1579
+ }), this.#a;
1580
+ }
1581
+ get navigationType() {
1582
+ return this.#t;
1583
+ }
1584
+ get userInitiated() {
1585
+ return this.#e;
1586
+ }
1587
+ get canIntercept() {
1588
+ return this.#r;
1589
+ }
1590
+ get hashChange() {
1591
+ return this.#n;
1592
+ }
1593
+ get formData() {
1594
+ return this.#d;
1595
+ }
1596
+ get downloadRequest() {
1597
+ return this.#f;
1598
+ }
1599
+ get destination() {
1600
+ return this.#l;
1601
+ }
1602
+ get signal() {
1603
+ return this.#s;
1604
+ }
1605
+ }
1606
+ class Rt extends at {
1607
+ ref = z();
1608
+ screenTransitionLayer = z();
1503
1609
  parent = null;
1504
1610
  #t = null;
1505
1611
  loadDispatched = !1;
1506
1612
  hasUAVisualTransition = !1;
1507
1613
  parentScreen = null;
1508
1614
  static rootRouterRef = null;
1509
- static contextType = Jt;
1615
+ static contextType = le;
1510
1616
  constructor(t, e) {
1511
- super(t), this.parentScreen = e?.parentScreen ?? null, this.parent = e?.parentRouter ?? null, this.parent && (this.parent.child = this), this.isRoot && (Nt.rootRouterRef = new WeakRef(this));
1617
+ super(t), this.parentScreen = e?.parentScreen ?? null, this.parent = e?.parentRouter ?? null;
1618
+ }
1619
+ static get events() {
1620
+ return Object.getOwnPropertyNames(this.prototype).filter((t) => /^on/.test(t)).map((t) => t.replace("on", ""));
1512
1621
  }
1513
1622
  componentDidMount() {
1514
- this.isRoot && window.navigation.addEventListener("navigate", this.handleNavigationDispatch), this.loadDispatched || (window.navigation.dispatchEvent(new we()), this.loadDispatched = !0);
1623
+ if (this.parent)
1624
+ this.parent.child = this;
1625
+ else {
1626
+ const t = Rt.rootRouterRef?.deref();
1627
+ if (this !== t && t?.mounted)
1628
+ throw new Error("It looks like you have two navigators at the same level. Try simplifying your navigation structure by using a nested router instead.");
1629
+ Rt.rootRouterRef = new WeakRef(this), window.navigation.addEventListener(
1630
+ "navigate",
1631
+ this
1632
+ );
1633
+ }
1634
+ this.#e(), this.loadDispatched || (window.navigation.dispatchEvent(new ge("load")), this.loadDispatched = !0);
1515
1635
  }
1516
1636
  componentWillUnmount() {
1517
- this.isRoot && window.navigation.removeEventListener("navigate", this.handleNavigationDispatch);
1637
+ this.#r(), this.isRoot && window.navigation.removeEventListener(
1638
+ "navigate",
1639
+ this
1640
+ );
1518
1641
  }
1519
- handleNavigationDispatch = (t) => {
1520
- const n = [...this.#e()].findLast((r) => r.canIntercept(t));
1642
+ onnavigate(t) {
1643
+ const n = [...this.#n()].findLast(
1644
+ (r) => r.canIntercept(t)
1645
+ );
1521
1646
  n && (n.intercept(t), this.hasUAVisualTransition = t.hasUAVisualTransition);
1522
- };
1523
- *#e() {
1524
- let t = this;
1525
- for (; t; )
1526
- yield t, t = t.child;
1647
+ }
1648
+ #e() {
1649
+ this.constructor.events.forEach((e) => {
1650
+ this.ref.current?.addEventListener(e, this);
1651
+ });
1652
+ }
1653
+ #r() {
1654
+ this.constructor.events.forEach((e) => {
1655
+ this.ref.current?.removeEventListener(e, this);
1656
+ });
1657
+ }
1658
+ *#n(t = Rt.rootRouterRef?.deref() ?? null) {
1659
+ let e = t;
1660
+ for (; e; )
1661
+ yield e, e = e.child;
1527
1662
  }
1528
1663
  getRouterById(t, e) {
1529
- const n = e ?? Nt.rootRouterRef?.deref();
1530
- return n.id === t ? n ?? null : n?.child ? this.getRouterById(t, n.child) : null;
1664
+ return [...this.#n(e)].find((r) => r.id === t) ?? null;
1531
1665
  }
1532
1666
  dispatchEvent(t) {
1533
1667
  const e = this.ref.current ?? void 0;
1534
- return pe(t, e);
1668
+ return je(t, e);
1535
1669
  }
1536
1670
  addEventListener(t, e, n) {
1537
1671
  const r = this.ref.current;
@@ -1541,11 +1675,15 @@ class Nt extends it {
1541
1675
  removeEventListener(t, e, n) {
1542
1676
  return this.ref.current?.removeEventListener(t, e, n);
1543
1677
  }
1678
+ handleEvent(t) {
1679
+ const e = `on${t.type}`;
1680
+ this[e]?.(t);
1681
+ }
1544
1682
  screenChildFromPathname(t) {
1545
- for (const e of Bt.toArray(this.props.children)) {
1546
- if (!Se(e))
1683
+ for (const e of Xt.toArray(this.props.children)) {
1684
+ if (!ke(e))
1547
1685
  continue;
1548
- const n = _t(
1686
+ const n = te(
1549
1687
  e.props.path,
1550
1688
  t,
1551
1689
  this.baseURLPattern.pathname,
@@ -1564,6 +1702,9 @@ class Nt extends it {
1564
1702
  return B(t.props.component) && n.push(t.props.component.load()), B(e?.header?.component) && n.push(e?.header?.component.load()), B(e?.footer?.component) && n.push(e?.footer?.component.load()), Promise.all(n).then(() => {
1565
1703
  });
1566
1704
  }
1705
+ includesRoute(t, e = window.location.origin) {
1706
+ return this.pathPatterns.some(({ pattern: n, caseSensitive: r }) => te(n, t, e, r));
1707
+ }
1567
1708
  get id() {
1568
1709
  if (this.props.id)
1569
1710
  return this.props.id;
@@ -1574,14 +1715,20 @@ class Nt extends it {
1574
1715
  return !this.parent;
1575
1716
  }
1576
1717
  get baseURL() {
1577
- const t = this.isRoot ? window.location.pathname : this.parentScreen?.resolvedPathname, e = this.baseURLPattern.pathname;
1578
- return bt(e, t);
1718
+ const t = this.isRoot ? window.location.pathname : this.parentScreen.resolvedPathname, e = this.baseURLPattern.pathname;
1719
+ return Vt(e, t);
1579
1720
  }
1580
1721
  get baseURLPattern() {
1581
1722
  let t = window.location.origin + "/", e = this.props.config?.basePath;
1582
1723
  if (e || (this.isRoot ? e = "/" : e = "."), this.parent && this.parentScreen) {
1583
- const { resolvedPathname: n = window.location.pathname, path: r } = this.parentScreen, a = this.parent.baseURL?.href, o = new URLPattern({ baseURL: a, pathname: r });
1584
- t = bt(
1724
+ const {
1725
+ resolvedPathname: n = window.location.pathname,
1726
+ path: r
1727
+ } = this.parentScreen, a = this.parent.baseURL?.href, o = new URLPattern({
1728
+ baseURL: a,
1729
+ pathname: r
1730
+ });
1731
+ t = Vt(
1585
1732
  o.pathname,
1586
1733
  n
1587
1734
  ).href;
@@ -1589,7 +1736,10 @@ class Nt extends it {
1589
1736
  return new URLPattern({ baseURL: t, pathname: e });
1590
1737
  }
1591
1738
  get pathPatterns() {
1592
- return Bt.map(this.props.children, (t) => ({ pattern: t.props.path, caseSensitive: !!t.props.caseSensitive }));
1739
+ return Xt.map(this.props.children, (t) => ({
1740
+ pattern: t.props.path,
1741
+ caseSensitive: !!t.props.caseSensitive
1742
+ }));
1593
1743
  }
1594
1744
  get mounted() {
1595
1745
  return !!this.ref.current;
@@ -1599,21 +1749,21 @@ class Nt extends it {
1599
1749
  }
1600
1750
  set child(t) {
1601
1751
  const e = this.#t?.deref();
1602
- if (e && t?.id !== e.id && t?.parentScreen?.id === e.parentScreen?.id && e.mounted)
1752
+ if (e && t !== e && t?.parentScreen?.id === e.parentScreen?.id && e.mounted)
1603
1753
  throw new Error("It looks like you have two navigators at the same level. Try simplifying your navigation structure by using a nested router instead.");
1604
1754
  t ? this.#t = new WeakRef(t) : this.#t = null;
1605
1755
  }
1606
1756
  render() {
1607
1757
  if (this.navigation)
1608
- return /* @__PURE__ */ b(
1758
+ return /* @__PURE__ */ T(
1609
1759
  "div",
1610
1760
  {
1611
1761
  id: this.id,
1612
1762
  className: "react-motion-router",
1613
1763
  style: { width: "100%", height: "100%" },
1614
1764
  ref: this.ref,
1615
- children: /* @__PURE__ */ b(pt.Provider, { value: this, children: /* @__PURE__ */ b(
1616
- Ve,
1765
+ children: /* @__PURE__ */ T(vt.Provider, { value: this, children: /* @__PURE__ */ T(
1766
+ He,
1617
1767
  {
1618
1768
  id: `${this.id}-transition-layer`,
1619
1769
  ref: this.screenTransitionLayer,
@@ -1626,11 +1776,13 @@ class Nt extends it {
1626
1776
  );
1627
1777
  }
1628
1778
  }
1629
- class je {
1779
+ class Xe {
1630
1780
  #t = /* @__PURE__ */ new Map();
1631
1781
  mutationObserver;
1632
1782
  constructor() {
1633
- this.mutationObserver = new MutationObserver(this.observeMutations.bind(this));
1783
+ this.mutationObserver = new MutationObserver(
1784
+ this.observeMutations.bind(this)
1785
+ );
1634
1786
  const { head: t } = document;
1635
1787
  this.mutationObserver.observe(t, {
1636
1788
  childList: !0
@@ -1638,25 +1790,29 @@ class je {
1638
1790
  this.mutationObserver.observe(e, {
1639
1791
  attributes: !0
1640
1792
  });
1641
- }), Array.from(t.querySelectorAll("meta")).forEach(this.metaDataFromNode.bind(this));
1793
+ }), Array.from(
1794
+ t.querySelectorAll("meta")
1795
+ ).forEach(
1796
+ this.metaDataFromNode.bind(this)
1797
+ );
1642
1798
  }
1643
1799
  get(t) {
1644
- const e = this.getMetaKey(t), n = this.#t.get(e);
1800
+ const e = this.formatMetaKey(t), n = this.#t.get(e);
1645
1801
  if (!n)
1646
1802
  return;
1647
1803
  let r;
1648
1804
  return n.includes(",") && n.includes("=") ? r = n.split(/,\s*/).map((a) => a.split("=")) : r = n, r;
1649
1805
  }
1650
1806
  set(t, e) {
1651
- const n = this.getMetaKey(t), r = this.getMetaContent(e);
1652
- this.#t.set(n, r), this.updateMetaElement(n, r);
1807
+ const n = this.formatMetaKey(t), r = this.formatMetaContent(e);
1808
+ this.#t.set(n, r), typeof t == "string" && (t = ["name", t]), this.updateMetaElement(t, r);
1653
1809
  }
1654
1810
  has(t) {
1655
- const e = this.getMetaKey(t);
1811
+ const e = this.formatMetaKey(t);
1656
1812
  return this.#t.has(e);
1657
1813
  }
1658
1814
  delete(t) {
1659
- const e = this.getMetaKey(t);
1815
+ const e = this.formatMetaKey(t);
1660
1816
  this.#t.delete(e), document.head.querySelector(`meta[${e}]`)?.remove();
1661
1817
  }
1662
1818
  clear() {
@@ -1681,7 +1837,10 @@ class je {
1681
1837
  return;
1682
1838
  e.removedNodes.forEach((n) => {
1683
1839
  if (n.nodeName === "META") {
1684
- const [r] = Array.from(n.attributes).filter((l) => l.nodeName !== "content"), o = [r.nodeName, r.value].join("=");
1840
+ const r = Array.from(n.attributes).find((l) => l.nodeName !== "content");
1841
+ if (!r || !r.value)
1842
+ return;
1843
+ const a = [r.nodeName, r.value], o = this.formatMetaKey(a);
1685
1844
  this.#t.has(o) && this.#t.delete(o);
1686
1845
  }
1687
1846
  }), e.addedNodes.forEach((n) => {
@@ -1690,141 +1849,421 @@ class je {
1690
1849
  }
1691
1850
  }
1692
1851
  metaDataFromNode(t) {
1693
- const [e] = Array.from(t.attributes).filter((o) => o.nodeName !== "content"), [n] = Array.from(t.attributes).filter((o) => o.nodeName === "content"), a = [e.nodeName, e.value].join("=");
1852
+ const e = Array.from(t.attributes).find((o) => o.nodeName !== "content"), n = Array.from(t.attributes).find((o) => o.nodeName === "content");
1853
+ if (!e || !e.value)
1854
+ return;
1855
+ const r = [e.nodeName, e.value], a = this.formatMetaKey(r);
1694
1856
  this.#t.set(a, n?.value);
1695
1857
  }
1696
- getMetaKey(t) {
1858
+ formatMetaKey(t) {
1697
1859
  let e;
1698
- return typeof t == "string" ? e = `name=${t}` : e = t.join("="), e;
1860
+ if (typeof t == "string")
1861
+ e = `name="${t}"`;
1862
+ else {
1863
+ const [n, r] = t;
1864
+ e = `${n}="${r}"`;
1865
+ }
1866
+ return e;
1699
1867
  }
1700
- getMetaContent(t) {
1868
+ formatMetaContent(t) {
1701
1869
  if (!t)
1702
1870
  return;
1703
1871
  let e;
1704
1872
  return typeof t == "string" ? e = t : e = t.map((n) => n.join("=")).join(", "), e;
1705
1873
  }
1706
1874
  updateMetaElement(t, e) {
1707
- const n = document.querySelector(`meta[${t}]`) || document.createElement("meta"), r = t.split("=");
1708
- n.setAttribute(...r), e ? n.setAttribute("content", e) : n.removeAttribute("content"), n.parentElement || document.head.appendChild(n);
1875
+ const n = document.querySelector(`meta[${this.formatMetaKey(t)}]`) || document.createElement("meta"), [r, a] = t;
1876
+ n.setAttribute(r, a), e ? n.setAttribute("content", e) : n.removeAttribute("content"), n.parentElement || document.head.appendChild(n);
1709
1877
  }
1710
1878
  }
1711
- class Ut {
1879
+ class jt {
1712
1880
  static rootNavigatorRef = null;
1713
- metaData = new je();
1714
- constructor() {
1715
- const t = Ut.rootNavigatorRef?.deref();
1716
- (!t || !t.isInDocument) && (Ut.rootNavigatorRef = new WeakRef(this));
1717
- }
1718
- addEventListener(t, e, n) {
1719
- return this.router.addEventListener(t, e, n);
1720
- }
1721
- removeEventListener(t, e, n) {
1722
- return this.router.removeEventListener(t, e, n);
1723
- }
1724
- dispatchEvent(t) {
1725
- return this.router.dispatchEvent?.(t);
1726
- }
1727
- get parent() {
1728
- return this.router.parent?.navigation ?? null;
1729
- }
1730
- get routerId() {
1731
- return this.router.id;
1732
- }
1733
- get baseURL() {
1734
- return this.router.baseURL;
1735
- }
1736
- get baseURLPattern() {
1737
- return this.router.baseURLPattern;
1881
+ metaData = new Xe();
1882
+ addEventListener;
1883
+ removeEventListener;
1884
+ dispatchEvent;
1885
+ parent;
1886
+ routerId;
1887
+ baseURL;
1888
+ baseURLPattern;
1889
+ getNavigatorById;
1890
+ constructor(t) {
1891
+ const e = jt.rootNavigatorRef?.deref();
1892
+ (!e || !e.isInDocument) && (jt.rootNavigatorRef = new WeakRef(this)), this.addEventListener = t.addEventListener, this.removeEventListener = t.removeEventListener, this.dispatchEvent = t.dispatchEvent, this.parent = t.parent, this.routerId = t.routerId, this.baseURL = t.baseURL, this.baseURLPattern = t.baseURLPattern, this.getNavigatorById = t.getNavigatorById;
1738
1893
  }
1739
- getNavigatorById(t) {
1740
- return this.router.getRouterById(t)?.navigation ?? null;
1894
+ preload(t, e) {
1895
+ const n = new URL(t, this.baseURL).href, r = {
1896
+ getState() {
1897
+ return e;
1898
+ },
1899
+ index: oe,
1900
+ sameDocument: !0,
1901
+ url: n,
1902
+ id: null,
1903
+ key: null
1904
+ }, a = new ge("preload", { destination: r });
1905
+ window.navigation.dispatchEvent(a);
1906
+ const o = qe(r);
1907
+ return {
1908
+ finished: a.transition.finished.then(() => o),
1909
+ committed: Promise.resolve(o)
1910
+ };
1741
1911
  }
1742
1912
  get isInDocument() {
1743
1913
  return !!document.getElementById(`${this.routerId}`);
1744
1914
  }
1745
1915
  }
1746
- function en() {
1747
- const s = ht(pt);
1748
- if (s)
1749
- return s.navigation;
1916
+ function fn() {
1917
+ const i = ft(vt);
1918
+ if (i)
1919
+ return i.navigation;
1750
1920
  throw new Error("Router is null. You may be trying to call useNavigation outside a Router.");
1751
1921
  }
1752
- function nn() {
1753
- return ht(pt);
1754
- }
1755
- function sn() {
1756
- le("Motion");
1757
- const s = ht(pt), e = ht(Wt).animation, n = 1;
1758
- return ce(
1759
- (r) => s.addEventListener("transition-start", async () => {
1760
- do
1761
- await new Promise((a) => {
1762
- requestAnimationFrame(a);
1763
- }), r();
1764
- while (e.playState === "running");
1765
- }),
1922
+ function pn() {
1923
+ return ft(vt);
1924
+ }
1925
+ function mn() {
1926
+ Ee("Motion");
1927
+ const i = ft(vt), e = ft(Kt).animation, n = 1;
1928
+ return re(
1929
+ (r) => {
1930
+ const a = async () => {
1931
+ do
1932
+ await new Promise((o) => {
1933
+ requestAnimationFrame(o);
1934
+ }), r();
1935
+ while (e.playState === "running");
1936
+ };
1937
+ return i.addEventListener("routertransitionstart", a), () => {
1938
+ i.removeEventListener("routertransitionstart", a);
1939
+ };
1940
+ },
1766
1941
  () => {
1767
1942
  const { progress: r } = e?.effect?.getComputedTiming() ?? {};
1768
1943
  return r ?? n;
1769
1944
  }
1770
1945
  );
1771
1946
  }
1772
- function Be() {
1773
- const s = ht(Qt);
1774
- if (s)
1775
- return s;
1947
+ function Ye() {
1948
+ const i = ft(ce);
1949
+ if (i)
1950
+ return i;
1776
1951
  throw new Error("Router is null. You may be trying to call useRoute outside a Router.");
1777
1952
  }
1778
- function rn(s, t) {
1779
- const e = Be(), n = t instanceof Function ? t() : t, r = he(e);
1780
- ue(() => {
1953
+ function gn(i, t) {
1954
+ const e = Ye(), n = t instanceof Function ? t() : t, r = Ft(e);
1955
+ se(() => {
1781
1956
  r.current = e;
1782
1957
  }, [e]);
1783
- const a = de((l) => {
1784
- const { params: m, setParams: p } = r.current;
1785
- l instanceof Function && (l = l(m[s] ?? n)), p({ [s]: l });
1786
- }, [n, s]);
1787
- return [e.params[s] ?? n, a];
1958
+ const a = be((l) => {
1959
+ const { params: f, setParams: d } = r.current;
1960
+ l instanceof Function && (l = l(f[i] ?? n)), d({ [i]: l });
1961
+ }, [n, i]);
1962
+ return [e.params[i] ?? n, a];
1963
+ }
1964
+ const mt = "--rerender";
1965
+ function vn() {
1966
+ return re(
1967
+ (i) => (globalThis.addEventListener(
1968
+ mt,
1969
+ i,
1970
+ { once: !0 }
1971
+ ), () => {
1972
+ globalThis.removeEventListener(mt, i);
1973
+ }),
1974
+ () => document.timeline.currentTime
1975
+ );
1976
+ }
1977
+ function yn(i) {
1978
+ const t = Ft(i);
1979
+ t.current = i, se(() => {
1980
+ const e = t.current;
1981
+ return globalThis.addEventListener(mt, e), () => {
1982
+ globalThis.removeEventListener(mt, e);
1983
+ };
1984
+ });
1985
+ }
1986
+ function wn() {
1987
+ globalThis.dispatchEvent(new Event(mt));
1988
+ }
1989
+ function En(i, t) {
1990
+ return Object.create(EventTarget.prototype, {
1991
+ id: {
1992
+ value: crypto.randomUUID(),
1993
+ writable: !1,
1994
+ enumerable: !0,
1995
+ configurable: !1
1996
+ },
1997
+ key: {
1998
+ value: crypto.randomUUID(),
1999
+ writable: !1,
2000
+ enumerable: !0,
2001
+ configurable: !1
2002
+ },
2003
+ index: {
2004
+ value: t,
2005
+ writable: !1,
2006
+ enumerable: !0,
2007
+ configurable: !1
2008
+ },
2009
+ url: {
2010
+ value: i,
2011
+ writable: !1,
2012
+ enumerable: !0,
2013
+ configurable: !1
2014
+ },
2015
+ sameDocument: {
2016
+ value: !0,
2017
+ writable: !1,
2018
+ enumerable: !0,
2019
+ configurable: !1
2020
+ },
2021
+ ondispose: {
2022
+ value: null,
2023
+ writable: !0,
2024
+ enumerable: !0,
2025
+ configurable: !0
2026
+ },
2027
+ getState: {
2028
+ value() {
2029
+ },
2030
+ writable: !1,
2031
+ enumerable: !0,
2032
+ configurable: !1
2033
+ }
2034
+ });
2035
+ }
2036
+ function bn() {
2037
+ if (!window.navigation)
2038
+ throw new Error("window.navigation is not available in this environment");
2039
+ }
2040
+ async function Tn() {
2041
+ await new Promise((i) => {
2042
+ window.navigation.addEventListener(
2043
+ "navigatesuccess",
2044
+ i,
2045
+ { once: !0 }
2046
+ );
2047
+ });
2048
+ }
2049
+ async function Ct(i) {
2050
+ await window.navigation.navigate(i).finished;
2051
+ }
2052
+ async function Sn(i) {
2053
+ await window.navigation.traverseTo(i).finished;
2054
+ }
2055
+ async function Rn() {
2056
+ const i = window.navigation.entries()[0];
2057
+ await window.navigation.traverseTo(i.key).finished;
2058
+ }
2059
+ async function kn() {
2060
+ await Ct("/one"), await Ct("/two"), await Ct("/three");
2061
+ }
2062
+ const ve = (i) => {
2063
+ i.intercept({
2064
+ handler() {
2065
+ return Promise.resolve();
2066
+ }
2067
+ });
2068
+ };
2069
+ async function xn() {
2070
+ window.navigation.addEventListener("navigate", ve);
2071
+ }
2072
+ async function Cn() {
2073
+ window.navigation.removeEventListener("navigate", ve);
2074
+ }
2075
+ class K extends Lt.Component {
2076
+ constructor(t) {
2077
+ super(t), this.state = {
2078
+ href: this.href
2079
+ };
2080
+ }
2081
+ anchorRef = Lt.createRef();
2082
+ static directionFromRel(t) {
2083
+ return t?.split(" ").findLast((e) => e === "next" || e === "prev") ?? "prev";
2084
+ }
2085
+ static findClosestEntryByHref(t, e, n, r) {
2086
+ if (!Array.isArray(n) || r < O || r >= n.length || n.length === J)
2087
+ return;
2088
+ let a = r - J, o = r + J;
2089
+ const l = K.directionFromRel(e);
2090
+ for (l === "next" && (a = O), l === "prev" && (o = n.length); a >= O || o < n.length; ) {
2091
+ if (a >= O && n[a]?.url === t)
2092
+ return n[a];
2093
+ if (o < n.length && n[o]?.url === t)
2094
+ return n[o];
2095
+ a--, o++;
2096
+ }
2097
+ }
2098
+ static findClosestEntry(t, e, n) {
2099
+ switch (K.directionFromRel(t)) {
2100
+ case "prev":
2101
+ return e[n - J];
2102
+ case "next":
2103
+ return e[n + J];
2104
+ }
2105
+ }
2106
+ componentDidMount() {
2107
+ window.navigation?.addEventListener("navigatesuccess", this.onNavigate);
2108
+ }
2109
+ componentWillUnmount() {
2110
+ window.navigation?.removeEventListener("navigatesuccess", this.onNavigate);
2111
+ }
2112
+ onNavigate = () => {
2113
+ const { href: t } = this;
2114
+ this.setState({ href: t });
2115
+ };
2116
+ get href() {
2117
+ const { href: t, traverse: e, reload: n, historyEntryKey: r, rel: a } = this.props;
2118
+ if (t === void 0 && e) {
2119
+ let o;
2120
+ return r ? o = window.navigation?.entries().find((l) => l.key === r) : a && (t ? o = K.findClosestEntryByHref(
2121
+ t,
2122
+ a,
2123
+ window.navigation.entries(),
2124
+ window.navigation.currentEntry?.index ?? O
2125
+ ) : o = K.findClosestEntry(
2126
+ a,
2127
+ window.navigation.entries(),
2128
+ window.navigation.currentEntry?.index ?? O
2129
+ )), o?.url;
2130
+ } else if (n)
2131
+ return ".";
2132
+ return t;
2133
+ }
2134
+ get search() {
2135
+ return this.props.search ? this.props.search.startsWith("?") ? this.props.search : `?${this.props.search}` : "";
2136
+ }
2137
+ handleClick = (t) => {
2138
+ if (this.props.onClick?.(t), t.defaultPrevented)
2139
+ return;
2140
+ t.preventDefault();
2141
+ const e = window.navigation, {
2142
+ rel: n,
2143
+ historyEntryKey: r,
2144
+ reload: a,
2145
+ replace: o,
2146
+ traverse: l,
2147
+ navigateInfo: f,
2148
+ navigateState: d
2149
+ } = this.props, m = this.anchorRef.current?.href;
2150
+ if (r) {
2151
+ e.traverseTo(r, { info: f });
2152
+ return;
2153
+ }
2154
+ if (l) {
2155
+ const S = e.entries();
2156
+ let E;
2157
+ if (m ? E = K.findClosestEntryByHref(
2158
+ m,
2159
+ n,
2160
+ S,
2161
+ e.currentEntry?.index ?? O
2162
+ ) : E = K.findClosestEntry(
2163
+ n,
2164
+ S,
2165
+ e.currentEntry?.index ?? O
2166
+ ), E) {
2167
+ e.traverseTo(E.key, { info: f });
2168
+ return;
2169
+ }
2170
+ }
2171
+ if (o && m) {
2172
+ e.navigate(m, { info: f, state: d, history: "replace" });
2173
+ return;
2174
+ }
2175
+ if (a) {
2176
+ e.reload({ info: f, state: d });
2177
+ return;
2178
+ }
2179
+ m && e.navigate(m, { info: f, state: d });
2180
+ };
2181
+ render() {
2182
+ const {
2183
+ rel: t,
2184
+ children: e
2185
+ } = this.props, { href: n } = this.state, { search: r } = this, a = Be(this.props, [
2186
+ "historyEntryKey",
2187
+ "navigateInfo",
2188
+ "navigateState",
2189
+ "reload",
2190
+ "replace",
2191
+ "traverse"
2192
+ ]);
2193
+ return /* @__PURE__ */ T(
2194
+ "a",
2195
+ {
2196
+ ...a,
2197
+ ref: this.anchorRef,
2198
+ href: n ? `${n}${r}` : void 0,
2199
+ rel: t,
2200
+ onClick: this.handleClick,
2201
+ children: e
2202
+ }
2203
+ );
2204
+ }
2205
+ }
2206
+ function Ln({ ref: i, ...t }) {
2207
+ const e = Ft(null);
2208
+ return Lt.useImperativeHandle(
2209
+ i,
2210
+ () => e.current?.anchorRef.current ?? null
2211
+ ), /* @__PURE__ */ T(K, { ref: e, ...t });
1788
2212
  }
1789
- const an = 2147483647, on = 100, ln = 0, cn = 0, hn = 1;
1790
2213
  export {
1791
- we as LoadEvent,
1792
- hn as MAX_NORM_PROGRESS,
1793
- on as MAX_PROGRESS,
1794
- an as MAX_Z_INDEX,
1795
- cn as MIN_NORM_PROGRESS,
1796
- ln as MIN_PROGRESS,
1797
- Qe as MotionProgressEndEvent,
1798
- Je as MotionProgressStartEvent,
1799
- Ut as NavigationBase,
1800
- Jt as NestedRouterContext,
1801
- fe as PromiseAllDynamic,
1802
- Nt as RouterBase,
1803
- pt as RouterContext,
1804
- be as ScreenBase,
1805
- qe as SharedElement,
1806
- ye as TransitionCancelEvent,
1807
- ve as TransitionEndEvent,
1808
- ge as TransitionStartEvent,
1809
- _e as cloneAndInject,
1810
- pe as dispatchEvent,
1811
- ze as includesRoute,
2214
+ Ln as Anchor,
2215
+ K as AnchorBase,
2216
+ sn as EMPTY_COLLECTION_LENGTH,
2217
+ O as FIRST_INDEX,
2218
+ oe as LAST_INDEX,
2219
+ ge as LoadEvent,
2220
+ rn as MAX_NORM_PROGRESS,
2221
+ tn as MAX_PROGRESS,
2222
+ Qe as MAX_Z_INDEX,
2223
+ nn as MIN_NORM_PROGRESS,
2224
+ en as MIN_PROGRESS,
2225
+ jt as NavigationBase,
2226
+ le as NestedRouterContext,
2227
+ Fe as PromiseAllSequential,
2228
+ Ge as PromiseWrapper,
2229
+ ce as RoutePropContext,
2230
+ Rt as RouterBase,
2231
+ vt as RouterContext,
2232
+ J as SINGLE_ELEMENT_LENGTH,
2233
+ Re as ScreenBase,
2234
+ Je as SharedElement,
2235
+ bn as assertNavigationAvailable,
2236
+ dn as cloneAndInject,
2237
+ En as createHistoryEntry,
2238
+ je as dispatchEvent,
2239
+ qe as historyEntryFromDestination,
2240
+ xn as installInterceptor,
1812
2241
  B as isLazyExoticComponent,
1813
- te as isNativeLazyExoticComponent,
1814
- He as isNavigationSupported,
1815
- Re as isStylableElement,
1816
- Xe as isURLPatternSupported,
1817
- Se as isValidScreenChild,
1818
- Ge as lazy,
1819
- _t as matchRoute,
1820
- Ye as polyfillNavigation,
1821
- Ze as polyfillURLPattern,
1822
- bt as resolveBaseURLFromPattern,
1823
- me as toCamelCase,
1824
- sn as useMotion,
1825
- en as useNavigationBase,
1826
- rn as useParamsBase,
1827
- Be as useRouteBase,
1828
- nn as useRouterBase
2242
+ he as isNativeLazyExoticComponent,
2243
+ ln as isNavigationSupported,
2244
+ xe as isStylableElement,
2245
+ cn as isURLPatternSupported,
2246
+ ke as isValidScreenChild,
2247
+ on as lazy,
2248
+ te as matchRoute,
2249
+ Ct as navTo,
2250
+ Be as omit,
2251
+ un as polyfillNavigation,
2252
+ hn as polyfillURLPattern,
2253
+ Vt as resolveBaseURLFromPattern,
2254
+ kn as seedHistory,
2255
+ Ke as toCamelCase,
2256
+ Sn as traverseTo,
2257
+ Rn as traverseToStart,
2258
+ wn as triggerRerender,
2259
+ Cn as uninstallInterceptor,
2260
+ mn as useMotion,
2261
+ fn as useNavigationBase,
2262
+ gn as useParamsBase,
2263
+ vn as useRerender,
2264
+ yn as useRerenderCallback,
2265
+ Ye as useRouteBase,
2266
+ pn as useRouterBase,
2267
+ Tn as waitForNavigateSuccess
1829
2268
  };
1830
2269
  //# sourceMappingURL=index.js.map