@react-motion-router/core 2.0.0-beta.sha-01914d6 → 2.0.0-beta.sha-20ff5ff

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsx as b, jsxs as Gt, Fragment as oe } from "react/jsx-runtime";
2
- import { createContext as it, Component as st, createRef as K, lazy as le, cloneElement as Ht, Suspense as bt, isValidElement as Xt, Children as jt, useContext as vt, useDebugValue as ce, useRef as he, useEffect as ue, useCallback as de } from "react";
3
- const Zt = it(null);
4
- class ze extends st {
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
5
  ref = K();
6
- static contextType = Zt;
6
+ static contextType = Yt;
7
7
  componentDidMount() {
8
8
  this.scene.addNode(this);
9
9
  }
@@ -55,7 +55,7 @@ class ze extends st {
55
55
  );
56
56
  }
57
57
  }
58
- function Tt(s, t) {
58
+ function bt(s, t) {
59
59
  s.endsWith("*") || (s += "**");
60
60
  const e = window.location.origin, n = new URLPattern(s, e).exec(t, e);
61
61
  if (!n)
@@ -63,9 +63,9 @@ function Tt(s, t) {
63
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
64
  return new URL(t.replace(a, ""), window.location.origin);
65
65
  }
66
- function Yt(s, t, e = `${window.location.origin}/`, n = !0) {
66
+ function _t(s, t, e = `${window.location.origin}/`, n = !0) {
67
67
  n || (s = s.toLowerCase(), t = t.toLowerCase());
68
- const r = Tt(e, t)?.href;
68
+ const r = bt(e, t)?.href;
69
69
  if (!r)
70
70
  return null;
71
71
  const a = new URLPattern({ baseURL: r, pathname: s }).exec({ pathname: t, baseURL: r }), o = a?.pathname.groups ?? {};
@@ -74,8 +74,8 @@ function Yt(s, t, e = `${window.location.origin}/`, n = !0) {
74
74
  caseSensitive: n
75
75
  } : null;
76
76
  }
77
- function Ge(s, t, e = window.location.origin) {
78
- return s.some(({ pattern: n, caseSensitive: r }) => Yt(n, t, e, r));
77
+ function ze(s, t, e = window.location.origin) {
78
+ return s.some(({ pattern: n, caseSensitive: r }) => _t(n, t, e, r));
79
79
  }
80
80
  function pe(s, t = window) {
81
81
  return new Promise((e) => {
@@ -84,24 +84,24 @@ function pe(s, t = window) {
84
84
  ));
85
85
  });
86
86
  }
87
- function He(s) {
88
- const t = le(s);
87
+ function Ge(s) {
88
+ const t = oe(s);
89
89
  return t.load = async () => (t.module ??= await s(), t.module), t;
90
90
  }
91
- function Xe() {
91
+ function He() {
92
92
  return !!window.navigation;
93
93
  }
94
- function Ze() {
94
+ function Xe() {
95
95
  return !!globalThis.URLPattern;
96
96
  }
97
- async function Ye() {
97
+ async function Ze() {
98
98
  const { URLPattern: s } = await import(
99
99
  /*webpackIgnore: true*/
100
100
  "urlpattern-polyfill"
101
101
  );
102
102
  globalThis.URLPattern = s;
103
103
  }
104
- async function _e() {
104
+ async function Ye() {
105
105
  const { applyPolyfill: s } = await import(
106
106
  /*webpackIgnore: true*/
107
107
  "@virtualstate/navigation"
@@ -123,8 +123,8 @@ async function fe(s) {
123
123
  function me(s) {
124
124
  return s.replace(/-([a-z])/g, (t) => t[1].toUpperCase());
125
125
  }
126
- function Je(s, t) {
127
- return Ht(s, t);
126
+ function _e(s, t) {
127
+ return Xt(s, t);
128
128
  }
129
129
  class ge extends Event {
130
130
  constructor() {
@@ -141,23 +141,17 @@ class ve extends Event {
141
141
  super("transition-end");
142
142
  }
143
143
  }
144
- class Qe extends Event {
144
+ class Je extends Event {
145
145
  constructor() {
146
146
  super("motion-progress-start");
147
147
  }
148
148
  }
149
- class we extends Event {
150
- progress;
151
- constructor(t) {
152
- super("motion-progress"), this.progress = t;
153
- }
154
- }
155
- class tn extends Event {
149
+ class Qe extends Event {
156
150
  constructor() {
157
151
  super("motion-progress-end");
158
152
  }
159
153
  }
160
- class Ee extends Event {
154
+ class we extends Event {
161
155
  #t = "load";
162
156
  #e = !1;
163
157
  #c = !0;
@@ -235,10 +229,10 @@ class Ee extends Event {
235
229
  return this.#i;
236
230
  }
237
231
  }
238
- const _t = it(null);
239
- class be extends st {
232
+ const Wt = dt(null);
233
+ class Ee extends it {
240
234
  ref = K();
241
- static contextType = _t;
235
+ static contextType = Wt;
242
236
  index = 0;
243
237
  exiting = !1;
244
238
  state = {
@@ -293,7 +287,7 @@ class be extends st {
293
287
  );
294
288
  }
295
289
  }
296
- const Jt = it(null), wt = it(null), Qt = it(null);
290
+ const Jt = dt(null), pt = dt(null), Qt = dt(null);
297
291
  class Te {
298
292
  id;
299
293
  nodes = /* @__PURE__ */ new Map();
@@ -329,12 +323,12 @@ class Te {
329
323
  return !this.nodes.size;
330
324
  }
331
325
  }
332
- class Se extends st {
326
+ class be extends it {
333
327
  sharedElementScene;
334
328
  #t = K();
335
329
  ref = K();
336
330
  nestedRouterData;
337
- static contextType = wt;
331
+ static contextType = pt;
338
332
  state = {
339
333
  focused: !1,
340
334
  config: {},
@@ -354,7 +348,7 @@ class Se extends st {
354
348
  return this.state.focused;
355
349
  }
356
350
  get name() {
357
- return this.props.name ? this.props.name.toLowerCase().replace(/[^\w-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "") : F(this.props.component) ? this.props.component.module?.default.name.toLowerCase() : this.props.component.name.toLowerCase();
351
+ 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();
358
352
  }
359
353
  blur() {
360
354
  return new Promise((t) => this.setState({ focused: !1 }, t));
@@ -365,7 +359,7 @@ class Se extends st {
365
359
  async load(t) {
366
360
  const e = this.props.component, n = this.props.config?.header?.component, r = this.props.config?.footer?.component;
367
361
  let a;
368
- F(e) ? a = await e.load() : a = { default: e }, F(n) && await n.load(), F(r) && await r.load();
362
+ B(e) ? a = await e.load() : a = { default: e }, B(n) && await n.load(), B(r) && await r.load();
369
363
  const o = this.context.navigation, l = this.routeProp, m = !1;
370
364
  return await this.props.config?.onLoad?.({ navigation: o, route: l, signal: t, preloading: m }), a;
371
365
  }
@@ -410,7 +404,7 @@ class Se extends st {
410
404
  render() {
411
405
  const t = this.context.navigation, e = this.routeProp, n = this.props.component, r = e.config.header?.component, a = e.config.footer?.component;
412
406
  return /* @__PURE__ */ b(
413
- be,
407
+ Ee,
414
408
  {
415
409
  ref: this.#t,
416
410
  renderAs: this.state.elementType,
@@ -431,10 +425,10 @@ class Se extends st {
431
425
  flexDirection: "column",
432
426
  pointerEvents: "inherit"
433
427
  },
434
- children: /* @__PURE__ */ b(Zt.Provider, { value: this.sharedElementScene, children: /* @__PURE__ */ b(Qt.Provider, { value: e, children: /* @__PURE__ */ Gt(Jt.Provider, { value: this.nestedRouterData, children: [
435
- /* @__PURE__ */ b(bt, { fallback: /* @__PURE__ */ b(Z, { component: e.config.header?.fallback, route: e, navigation: t }), children: /* @__PURE__ */ b(Z, { component: r, route: e, navigation: t }) }),
436
- /* @__PURE__ */ b(bt, { fallback: /* @__PURE__ */ b(Z, { component: this.props.fallback, route: e, navigation: t }), children: /* @__PURE__ */ b(Z, { component: n, route: e, navigation: t }) }),
437
- /* @__PURE__ */ b(bt, { fallback: /* @__PURE__ */ b(Z, { component: e.config.footer?.fallback, route: e, navigation: t }), children: /* @__PURE__ */ b(Z, { component: a, route: e, navigation: t }) })
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 }) })
438
432
  ] }) }) })
439
433
  }
440
434
  )
@@ -443,7 +437,7 @@ class Se extends st {
443
437
  }
444
438
  }
445
439
  function Z({ component: s, route: t, navigation: e }) {
446
- F(s) && s.module?.default && (s = s.module.default);
440
+ B(s) && s.module?.default && (s = s.module.default);
447
441
  const n = s ?? null;
448
442
  return typeof n == "function" || te(n) ? /* @__PURE__ */ b(
449
443
  n,
@@ -451,31 +445,31 @@ function Z({ component: s, route: t, navigation: e }) {
451
445
  navigation: e,
452
446
  route: t
453
447
  }
454
- ) : Xt(n) ? Ht(n, {
448
+ ) : Zt(n) ? Xt(n, {
455
449
  navigation: e,
456
450
  route: t
457
- }) : /* @__PURE__ */ b(oe, { children: n });
451
+ }) : /* @__PURE__ */ b(ae, { children: n });
458
452
  }
459
- function Re(s) {
460
- return Xt(s) ? Object.getPrototypeOf(s.type) === Se : !1;
453
+ function Se(s) {
454
+ return Zt(s) ? Object.getPrototypeOf(s.type) === be : !1;
461
455
  }
462
456
  function te(s) {
463
457
  return typeof s == "object" && s !== null && s.$$typeof === Symbol.for("react.lazy");
464
458
  }
465
- function F(s) {
459
+ function B(s) {
466
460
  return te(s) && "load" in s;
467
461
  }
468
- function ke(s) {
462
+ function Re(s) {
469
463
  return "style" in s && s.style instanceof CSSStyleDeclaration;
470
464
  }
471
- var xe = Object.defineProperty, Ce = (s, t, e) => t in s ? xe(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, j = (s, t, e) => (Ce(s, typeof t != "symbol" ? t + "" : t, e), e), Wt = (s, t, e) => {
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) => {
472
466
  if (!t.has(s))
473
467
  throw TypeError("Cannot " + e);
474
- }, i = (s, t, e) => (Wt(s, t, "read from private field"), e ? e.call(s) : t.get(s)), g = (s, t, e) => {
468
+ }, i = (s, t, e) => (It(s, t, "read from private field"), e ? e.call(s) : t.get(s)), g = (s, t, e) => {
475
469
  if (t.has(s))
476
470
  throw TypeError("Cannot add the same private member more than once");
477
471
  t instanceof WeakSet ? t.add(s) : t.set(s, e);
478
- }, c = (s, t, e, n) => (Wt(s, t, "write to private field"), n ? n.call(s, e) : t.set(s, e), e), f = (s, t, e) => (Wt(s, t, "access private method"), 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);
479
473
  const ut = {
480
474
  delay: 0,
481
475
  direction: "normal",
@@ -485,7 +479,7 @@ const ut = {
485
479
  fill: "auto",
486
480
  iterationStart: 0,
487
481
  iterations: 1
488
- }, It = 1e3, Me = window.Animation, dt = window.KeyframeEffect;
482
+ }, $t = 1e3, Ce = window.Animation, ft = window.KeyframeEffect;
489
483
  function Ft(s) {
490
484
  return Array.isArray(s);
491
485
  }
@@ -495,7 +489,7 @@ function H(s) {
495
489
  function h(s, t) {
496
490
  return H(s) || typeof s == "number" ? s : (t || ([t] = Object.keys(s.type())), s.to(t).value);
497
491
  }
498
- function Le(s, t = ut) {
492
+ function Me(s, t = ut) {
499
493
  let { duration: e = "auto", iterations: n = 1, playbackRate: r = 1 } = t;
500
494
  if (H(s))
501
495
  return s;
@@ -505,13 +499,13 @@ function Le(s, t = ut) {
505
499
  "NotSupportedError"
506
500
  );
507
501
  if (e === "auto")
508
- e = It;
502
+ e = $t;
509
503
  else if (e instanceof CSSNumericValue)
510
504
  e = e.to("ms").value;
511
505
  else if (typeof e == "string")
512
506
  throw new TypeError("Unknown effect duration keyword.");
513
507
  const { delay: a = 0, endDelay: o = 0 } = t, l = e / n * n / Math.abs(r), m = a + l + o;
514
- return rt(
508
+ return st(
515
509
  s.to("percent").value,
516
510
  [0, 100],
517
511
  [0, m]
@@ -527,11 +521,11 @@ function Et(s) {
527
521
  );
528
522
  return s.to("ms").value;
529
523
  }
530
- function Bt(s, t) {
524
+ function Kt(s, t) {
531
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;
532
526
  return r + o * (a - r);
533
527
  }
534
- function Pe(s, t, e) {
528
+ function Le(s, t, e) {
535
529
  let n = 0, r = 0;
536
530
  for (const [a, o] of Object.entries(s)) {
537
531
  const { min: l, max: m } = t, p = e[a] ?? 1, w = (o - l[a]) / (m[a] - l[a]) * p;
@@ -539,26 +533,26 @@ function Pe(s, t, e) {
539
533
  }
540
534
  return n / r;
541
535
  }
542
- function rt(s, t, e, n = {}) {
536
+ function st(s, t, e, n = {}) {
543
537
  let r;
544
538
  if (typeof s == "number" && Ft(t)) {
545
539
  const o = { x: t[0] }, l = { x: t[1] };
546
540
  t = { min: o, max: l }, s = { x: s };
547
541
  } else
548
542
  throw new TypeError("Input and input range must have the same dimensions.");
549
- if (r = Pe(s, t, n), r = De(r, 0, 1), Ft(e))
550
- return Bt(r, e);
543
+ if (r = Le(s, t, n), r = Pe(r, 0, 1), Ft(e))
544
+ return Kt(r, e);
551
545
  const a = {};
552
546
  for (const o of Object.keys(e.min)) {
553
547
  const l = e.min[o], m = e.max[o], p = [l, m];
554
- a[o] = Bt(r, p);
548
+ a[o] = Kt(r, p);
555
549
  }
556
550
  return a;
557
551
  }
558
- function De(s, t, e) {
552
+ function Pe(s, t, e) {
559
553
  return s < t ? t : e && s > e ? e : s;
560
554
  }
561
- function $t(s) {
555
+ function Ot(s) {
562
556
  let {
563
557
  duration: t = "auto",
564
558
  iterations: e = 1,
@@ -570,7 +564,7 @@ function $t(s) {
570
564
  } = s;
571
565
  const m = new CSSUnitValue(100, "percent");
572
566
  if (t === "auto")
573
- t = It, r = 0, a = 0;
567
+ t = $t, r = 0, a = 0;
574
568
  else if (t instanceof CSSNumericValue)
575
569
  t = t.to("ms").value;
576
570
  else if (typeof t == "string")
@@ -596,7 +590,7 @@ function ee(s, t) {
596
590
  const o = Math.max(Math.min(a, r), 0), l = Math.max(Math.min(a + e, r), 0);
597
591
  return n < o || t === "backwards" && n === o ? "before" : n > l || t === "forwards" && n === l ? "after" : "active";
598
592
  }
599
- function Ae(s, t) {
593
+ function De(s, t) {
600
594
  let { localTime: e = null, delay: n = 0, activeDuration: r = 0, fill: a } = s;
601
595
  if (r = h(r), e = h(e), e == null || e === void 0)
602
596
  return null;
@@ -611,14 +605,14 @@ function Ae(s, t) {
611
605
  return null;
612
606
  }
613
607
  }
614
- function Ne(s, t, e) {
608
+ function Ae(s, t, e) {
615
609
  const { duration: n = 0, iterations: r = 1, iterationStart: a = 0 } = s;
616
610
  if (typeof n != "number")
617
611
  throw new TypeError("Duration cannot be unresolved");
618
612
  let o = 0;
619
613
  return n === 0 ? t === "before" ? o = 0 : o = r : o = e / Et(n), o + a;
620
614
  }
621
- function Ue(s, t, e, n) {
615
+ function Ne(s, t, e, n) {
622
616
  const { iterations: r = 1, iterationStart: a = 0, activeDuration: o = 0 } = s;
623
617
  if (H(e))
624
618
  return null;
@@ -626,15 +620,15 @@ function Ue(s, t, e, n) {
626
620
  return e === 1 / 0 && (l = a % 1), l === 0 && (t === "active" || t === "after") && o === n && r !== 0 && (l = 1), l;
627
621
  }
628
622
  function ne(s, t) {
629
- const { iterations: e = 1 } = s, n = Ae(s, t);
623
+ const { iterations: e = 1 } = s, n = De(s, t);
630
624
  if (H(n))
631
625
  return null;
632
626
  if (t === "after" && e === 1 / 0)
633
627
  return 1 / 0;
634
- const r = Ne(s, t, n);
635
- return Ue(s, t, r, n) === 1 ? Math.floor(r) - 1 : Math.floor(r);
628
+ const r = Ae(s, t, n);
629
+ return Ne(s, t, r, n) === 1 ? Math.floor(r) - 1 : Math.floor(r);
636
630
  }
637
- class We extends Event {
631
+ class Ue extends Event {
638
632
  constructor(t) {
639
633
  super("update", { bubbles: !1, cancelable: !1, composed: !1 }), j(this, "currentTime"), this.currentTime = t;
640
634
  }
@@ -654,7 +648,7 @@ class E extends EventTarget {
654
648
  switch (i(this, N).type) {
655
649
  case "swipe": {
656
650
  const { rangeStart: a, rangeEnd: o } = i(this, N), l = i(this, N).axis;
657
- n = rt(
651
+ n = st(
658
652
  r[l],
659
653
  [h(a, "px"), h(o, "px")],
660
654
  [0, 100]
@@ -663,7 +657,7 @@ class E extends EventTarget {
663
657
  }
664
658
  case "pan": {
665
659
  const { rangeStart: a, rangeEnd: o } = i(this, N), { x: l, y: m } = r;
666
- n = rt(
660
+ n = st(
667
661
  { x: l, y: m },
668
662
  {
669
663
  min: { x: h(a.x, "px"), y: h(a.y, "px") },
@@ -676,7 +670,7 @@ class E extends EventTarget {
676
670
  }
677
671
  case "pinch": {
678
672
  const { rangeStart: a, rangeEnd: o } = i(this, N), { scale: l } = t;
679
- n = rt(
673
+ n = st(
680
674
  l,
681
675
  [h(a, ""), h(o, "")],
682
676
  // figure out which unit
@@ -686,14 +680,14 @@ class E extends EventTarget {
686
680
  }
687
681
  case "rotate": {
688
682
  const { rangeStart: a, rangeEnd: o } = i(this, N), { rotation: l } = t;
689
- n = rt(
683
+ n = st(
690
684
  l,
691
685
  [h(a, "deg"), h(o, "deg")],
692
686
  [0, 100]
693
687
  );
694
688
  }
695
689
  }
696
- c(this, Y, CSS.percent(n)), this.dispatchEvent(new We(i(this, Y)));
690
+ c(this, Y, CSS.percent(n)), this.dispatchEvent(new Ue(i(this, Y)));
697
691
  }
698
692
  addEventListener(t, e, n) {
699
693
  super.addEventListener(t, e, n);
@@ -710,13 +704,13 @@ class E extends EventTarget {
710
704
  }
711
705
  N = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
712
706
  const A = /* @__PURE__ */ new WeakMap();
713
- var at;
714
- class pt extends dt {
707
+ var rt;
708
+ class mt extends ft {
715
709
  constructor(t, e = null) {
716
- super(t), g(this, at, null), c(this, at, e);
710
+ super(t), g(this, rt, null), c(this, rt, e);
717
711
  }
718
712
  get parent() {
719
- return i(this, at);
713
+ return i(this, rt);
720
714
  }
721
715
  getTiming() {
722
716
  var t;
@@ -737,7 +731,7 @@ class pt extends dt {
737
731
  throw TypeError("Effect duration cannot be Infinity for non-monotonic timelines.");
738
732
  if (e.iterations === 1 / 0)
739
733
  throw TypeError("Effect iterations cannot be Infinity for non-monotonic timelines.");
740
- return $t(e);
734
+ return Ot(e);
741
735
  }
742
736
  return e;
743
737
  }
@@ -749,7 +743,7 @@ class pt extends dt {
749
743
  duration: n.duration instanceof CSSNumericValue ? n.duration.to("ms").value : n.duration,
750
744
  ...t
751
745
  };
752
- let r = i(this, at);
746
+ let r = i(this, rt);
753
747
  for (; r; ) {
754
748
  const a = r.getTiming();
755
749
  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;
@@ -763,11 +757,11 @@ class pt extends dt {
763
757
  return super.updateTiming(t);
764
758
  }
765
759
  }
766
- at = /* @__PURE__ */ new WeakMap();
760
+ rt = /* @__PURE__ */ new WeakMap();
767
761
  var U, _;
768
- const Ie = class ft {
762
+ const We = class gt {
769
763
  constructor(t) {
770
- g(this, U, []), g(this, _, null), c(this, U, t.map((e) => (e instanceof ft ? c(e, _, this) : e instanceof dt && (e = new pt(e, this)), e)));
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)));
771
765
  }
772
766
  get parent() {
773
767
  return i(this, _);
@@ -792,17 +786,17 @@ const Ie = class ft {
792
786
  }
793
787
  append(...t) {
794
788
  t.forEach((e) => {
795
- i(this, U).includes(e) || (e instanceof ft ? c(e, _, this) : e instanceof dt && (e = new pt(e, this)), i(this, U).push(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));
796
790
  });
797
791
  }
798
792
  prepend(...t) {
799
793
  t.forEach((e) => {
800
- i(this, U).includes(e) || (e instanceof ft ? c(e, _, this) : e instanceof dt && (e = new pt(e, this)), i(this, U).unshift(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));
801
795
  });
802
796
  }
803
797
  };
804
798
  U = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap();
805
- let Ot = Ie;
799
+ let Vt = We;
806
800
  class nt {
807
801
  constructor() {
808
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) => {
@@ -820,7 +814,7 @@ class nt {
820
814
  }
821
815
  }
822
816
  var J, St, ie;
823
- class $e extends Ot {
817
+ class Ie extends Vt {
824
818
  constructor(t, e = ut) {
825
819
  super(t), g(this, St), g(this, J, void 0), c(this, J, {
826
820
  ...ut,
@@ -846,15 +840,15 @@ class $e extends Ot {
846
840
  continue;
847
841
  let {
848
842
  duration: L = "auto",
849
- activeDuration: Vt = 0
843
+ activeDuration: jt = 0
850
844
  } = M.getComputedTiming();
851
- r.activeDuration = r.activeDuration ? h(r.activeDuration, "ms") + h(Vt, "ms") : Vt, 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));
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));
852
846
  }
853
847
  const { timeline: m, startTime: p, currentTime: w } = A.get(this) ?? {}, R = m instanceof E ? "percent" : "ms";
854
848
  let { duration: T = 0, iterations: X = 1 } = r;
855
849
  if (T === "auto" && (T = 0), typeof T == "string")
856
850
  throw new TypeError("Unknown effect duration keyword.");
857
- 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 ? $t(r) : (m instanceof DocumentTimeline && (r.progress = w && h(w, R) / h(l, R)), r);
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);
858
852
  }
859
853
  updateTiming(t) {
860
854
  c(this, J, {
@@ -871,15 +865,15 @@ J = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ie = func
871
865
  const { playbackRate: s = 1 } = A.get(this) ?? {};
872
866
  return s < 0 ? "backwards" : "forwards";
873
867
  };
874
- var d, x, ht, v, S, P, u, y, k, z, O, ot, W, mt, Rt, Q, lt, q, tt, kt, Kt, xt, qt, Ct, zt, B, G, ct, gt, Mt, I, V, D, $, yt, Lt, Pt;
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;
875
869
  const se = class extends EventTarget {
876
870
  constructor(t, e) {
877
- super(), g(this, mt), g(this, Q), g(this, q), g(this, kt), g(this, xt), g(this, Ct), g(this, B), g(this, gt), 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, ht, "active"), g(this, v, {
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, {
878
872
  task: null,
879
873
  playbackRate: null
880
- }), 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, ot, 0), g(this, W, 1), g(this, ct, () => {
881
- f(this, B, G).call(this);
882
- }), g(this, yt, () => {
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, () => {
883
877
  var n;
884
878
  if (i(this, P).state !== "pending" || this.playState !== "finished")
885
879
  return;
@@ -917,7 +911,7 @@ const se = class extends EventTarget {
917
911
  var n;
918
912
  const r = new Event("remove");
919
913
  this.dispatchEvent(r), (n = this.onremove) == null || n.call(this, r);
920
- }), 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, gt, Mt).call(this), e instanceof E && e.addEventListener("update", i(this, ct));
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));
921
915
  }
922
916
  reverse() {
923
917
  var t;
@@ -936,13 +930,13 @@ const se = class extends EventTarget {
936
930
  play() {
937
931
  const t = this.playState === "paused" && this.pending;
938
932
  let e = this.currentTime;
939
- (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, B, G).call(this), f(this, Q, lt).call(this), i(this, v).task = "play", f(this, I, V).call(this, !1));
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));
940
934
  }
941
935
  pause() {
942
- this.playState !== "paused" && (this.currentTime === null && c(this, O, !0), i(this, v).task && (i(this, v).task = null), f(this, Q, lt).call(this), i(this, v).task = "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");
943
937
  }
944
938
  persist() {
945
- i(this, k).forEach((t) => t.persist()), c(this, ht, "persisted");
939
+ i(this, k).forEach((t) => t.persist()), c(this, ct, "persisted");
946
940
  }
947
941
  finish() {
948
942
  var t;
@@ -951,7 +945,7 @@ const se = class extends EventTarget {
951
945
  throw new DOMException("InvalidStateError");
952
946
  f(this, D, $).call(this);
953
947
  let r;
954
- if (n > 0 ? r = e : r = 0, f(this, mt, Rt).call(this, r), this.startTime === null && i(this, d) !== null && i(this, d).currentTime !== null && r !== null) {
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) {
955
949
  const a = i(this, d) instanceof E ? "percent" : "ms";
956
950
  r = h(r, a);
957
951
  const o = h(i(this, d).currentTime, a);
@@ -961,7 +955,7 @@ const se = class extends EventTarget {
961
955
  }
962
956
  commitStyles() {
963
957
  i(this, k).forEach((t) => {
964
- t.effect instanceof pt && (t.effect.target === null || t.effect.pseudoElement !== null) || t.commitStyles();
958
+ t.effect instanceof mt && (t.effect.target === null || t.effect.pseudoElement !== null) || t.commitStyles();
965
959
  });
966
960
  }
967
961
  cancel() {
@@ -985,7 +979,7 @@ const se = class extends EventTarget {
985
979
  let o = null;
986
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);
987
981
  }
988
- f(this, D, $).call(this), f(this, I, V).call(this, !1), f(this, B, G).call(this);
982
+ f(this, D, $).call(this), f(this, I, V).call(this, !1), f(this, F, G).call(this);
989
983
  break;
990
984
  }
991
985
  default:
@@ -1011,17 +1005,17 @@ const se = class extends EventTarget {
1011
1005
  const n = i(this, d) instanceof E ? "percent" : "ms", r = h(((e = i(this, d)) == null ? void 0 : e.currentTime) ?? null, n);
1012
1006
  if (H(t) && !H(r))
1013
1007
  throw new TypeError("currentTime may not be changed from resolved to unresolved.");
1014
- 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, mt, 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);
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);
1015
1009
  }
1016
1010
  set timeline(t) {
1017
1011
  var e, n;
1018
1012
  const r = this.timeline;
1019
1013
  if (r === t)
1020
1014
  return;
1021
- i(this, d) instanceof E && i(this, d).removeEventListener("update", i(this, ct));
1015
+ i(this, d) instanceof E && i(this, d).removeEventListener("update", i(this, lt));
1022
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;
1023
1017
  if (T)
1024
- c(this, d, t), t.addEventListener("update", i(this, ct)), 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, lt).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, lt).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);
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);
1025
1019
  else if (X) {
1026
1020
  if (c(this, d, t), R) {
1027
1021
  if (l !== null && m !== null) {
@@ -1046,7 +1040,7 @@ const se = class extends EventTarget {
1046
1040
  const e = A.get(t);
1047
1041
  e && (e.effect = null), A.set(t, this);
1048
1042
  }
1049
- c(this, x, t), f(this, gt, Mt).call(this), f(this, I, V).call(this, !1);
1043
+ c(this, x, t), f(this, vt, Mt).call(this), f(this, I, V).call(this, !1);
1050
1044
  }
1051
1045
  }
1052
1046
  get ready() {
@@ -1065,7 +1059,7 @@ const se = class extends EventTarget {
1065
1059
  return i(this, W);
1066
1060
  }
1067
1061
  get replaceState() {
1068
- return i(this, ht);
1062
+ return i(this, ct);
1069
1063
  }
1070
1064
  get pending() {
1071
1065
  return i(this, S).state === "pending";
@@ -1101,20 +1095,20 @@ const se = class extends EventTarget {
1101
1095
  return i(this, x);
1102
1096
  }
1103
1097
  };
1104
- d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @__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(), ot = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakSet(), Rt = function(s) {
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) {
1105
1099
  var t;
1106
1100
  const e = h(((t = i(this, d)) == null ? void 0 : t.currentTime) ?? null);
1107
1101
  if (s === null && e !== null)
1108
1102
  throw new TypeError();
1109
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));
1110
- }, Q = /* @__PURE__ */ new WeakSet(), lt = function() {
1111
- i(this, S).state !== "pending" && c(this, S, new nt()), cancelAnimationFrame(i(this, ot)), c(this, ot, requestAnimationFrame(() => {
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(() => {
1112
1106
  var s;
1113
- (((s = i(this, d)) == null ? void 0 : s.currentTime) ?? null) !== null && (f(this, Ct, zt).call(this), i(this, v).task === "play" && (i(this, u) !== null || i(this, y) !== null) ? f(this, kt, Kt).call(this) : i(this, v).task === "pause" && f(this, xt, qt).call(this), Promise.all(i(this, k).map((t) => t.finished)).then(i(this, yt)), 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, ht, "removed")));
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")));
1114
1108
  }));
1115
1109
  }, q = /* @__PURE__ */ new WeakSet(), tt = function() {
1116
- cancelAnimationFrame(i(this, ot)), i(this, v).task = null;
1117
- }, kt = /* @__PURE__ */ new WeakSet(), Kt = function() {
1110
+ cancelAnimationFrame(i(this, at)), i(this, v).task = null;
1111
+ }, kt = /* @__PURE__ */ new WeakSet(), qt = function() {
1118
1112
  var s;
1119
1113
  const t = ((s = this.timeline) == null ? void 0 : s.currentTime) ?? null;
1120
1114
  if (t === null)
@@ -1128,15 +1122,15 @@ d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @_
1128
1122
  const r = this.playbackRate;
1129
1123
  r === 0 ? (c(this, y, null), c(this, u, h(t, e))) : c(this, u, h(t, e) - n / r);
1130
1124
  }
1131
- i(this, S).state === "pending" && i(this, S).resolve(this), f(this, I, V).call(this, !1), f(this, B, G).call(this), i(this, v).task = null, this.timeline instanceof DocumentTimeline && i(this, k).forEach((n) => n.play());
1132
- }, xt = /* @__PURE__ */ new WeakSet(), qt = function() {
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() {
1133
1127
  var s;
1134
1128
  const t = ((s = this.timeline) == null ? void 0 : s.currentTime) ?? null;
1135
1129
  if (t === null)
1136
1130
  return;
1137
1131
  const e = i(this, d) instanceof E ? "percent" : "ms", n = t;
1138
- 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, B, G).call(this), i(this, v).task = null, i(this, k).forEach((r) => r.pause());
1139
- }, Ct = /* @__PURE__ */ new WeakSet(), zt = function() {
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() {
1140
1134
  if (i(this, O) && !(!i(this, d) || !i(this, d).currentTime) && !(this.playState === "idle" || this.playState === "paused" && i(this, y) !== null)) {
1141
1135
  if (i(this, d) instanceof E) {
1142
1136
  const s = i(this, v).playbackRate ?? this.playbackRate;
@@ -1145,12 +1139,12 @@ d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @_
1145
1139
  c(this, u, h(i(this, d).currentTime, "ms"));
1146
1140
  c(this, y, null);
1147
1141
  }
1148
- }, B = /* @__PURE__ */ new WeakSet(), G = function() {
1142
+ }, F = /* @__PURE__ */ new WeakSet(), G = function() {
1149
1143
  var s;
1150
1144
  const t = ((s = i(this, d)) == null ? void 0 : s.currentTime) ?? null;
1151
1145
  if (t === null)
1152
1146
  return;
1153
- const e = i(this, x), n = i(this, d) instanceof E ? Le(t, e?.getTiming()) : Et(t);
1147
+ const e = i(this, x), n = i(this, d) instanceof E ? Me(t, e?.getTiming()) : Et(t);
1154
1148
  let r = null;
1155
1149
  if (i(this, u) !== null) {
1156
1150
  const a = h(t, "percent") === (this.playbackRate < 0 ? 0 : 100) ? this.playbackRate < 0 ? 1e-3 : -1e-3 : 0;
@@ -1160,14 +1154,14 @@ d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @_
1160
1154
  else
1161
1155
  return;
1162
1156
  i(this, k).forEach((a) => a.currentTime = r);
1163
- }, ct = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakSet(), Mt = function() {
1157
+ }, lt = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakSet(), Mt = function() {
1164
1158
  var s;
1165
1159
  let t = i(this, x);
1166
1160
  const e = [];
1167
- if (t instanceof Ot)
1161
+ if (t instanceof Vt)
1168
1162
  for (let n = 0; n < t.children.length; n++) {
1169
1163
  const r = new se(t.children.item(n));
1170
- if (t instanceof $e && n > 0) {
1164
+ if (t instanceof Ie && n > 0) {
1171
1165
  const { endTime: a = null } = ((s = e[n - 1].effect) == null ? void 0 : s.getComputedTiming()) ?? {};
1172
1166
  r.startTime = h(a, "ms");
1173
1167
  }
@@ -1175,7 +1169,7 @@ d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @_
1175
1169
  }
1176
1170
  else {
1177
1171
  const n = i(this, d) instanceof E ? document.timeline : i(this, d);
1178
- e.push(new Me(t, n));
1172
+ e.push(new Ce(t, n));
1179
1173
  }
1180
1174
  c(this, k, e);
1181
1175
  }, I = /* @__PURE__ */ new WeakSet(), V = function(s) {
@@ -1186,7 +1180,7 @@ d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @_
1186
1180
  let { delay: o = 0, endDelay: l = 0, iterations: m = 1, duration: p = "auto" } = ((e = i(this, x)) == null ? void 0 : e.getTiming()) ?? {};
1187
1181
  const w = i(this, v).playbackRate ?? this.playbackRate;
1188
1182
  if (p === "auto")
1189
- p = i(this, d) instanceof E ? It : 0;
1183
+ p = i(this, d) instanceof E ? $t : 0;
1190
1184
  else if (p instanceof CSSNumericValue)
1191
1185
  p = p.to("ms").value;
1192
1186
  else if (typeof p == "string")
@@ -1195,13 +1189,13 @@ d = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), ht = /* @_
1195
1189
  let T = h(i(this, z), r);
1196
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));
1197
1191
  }
1198
- f(this, B, G).call(this), c(this, z, this.currentTime), this.playState === "finished" ? i(this, P).state === "pending" && i(this, yt).call(this) : i(this, P).state === "resolved" && c(this, P, new nt());
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());
1199
1193
  }, D = /* @__PURE__ */ new WeakSet(), $ = function() {
1200
1194
  i(this, v).playbackRate && (this.playbackRate = i(this, v).playbackRate), i(this, v).playbackRate = null;
1201
- }, yt = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap();
1202
- let Oe = se;
1195
+ }, wt = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap();
1196
+ let $e = se;
1203
1197
  var et, Dt, re;
1204
- class At extends Ot {
1198
+ class At extends Vt {
1205
1199
  constructor(t, e = ut) {
1206
1200
  super(t), g(this, Dt), g(this, et, void 0), c(this, et, {
1207
1201
  ...ut,
@@ -1236,7 +1230,7 @@ class At extends Ot {
1236
1230
  let { duration: l = 0, iterations: m = 1, endTime: p = 0 } = e;
1237
1231
  if (l === "auto" && (l = 0), typeof l == "string")
1238
1232
  throw new TypeError("Unknown effect duration keyword.");
1239
- 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 ? $t(e) : (n instanceof DocumentTimeline && (e.progress = a && h(a, o) / h(p, o)), e);
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);
1240
1234
  }
1241
1235
  updateTiming(t) {
1242
1236
  c(this, et, {
@@ -1253,7 +1247,7 @@ et = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakSet(), re = fun
1253
1247
  const { playbackRate: s = 1 } = A.get(this) ?? {};
1254
1248
  return s < 0 ? "backwards" : "forwards";
1255
1249
  };
1256
- class Ve extends st {
1250
+ class Oe extends it {
1257
1251
  ref = K();
1258
1252
  #t = null;
1259
1253
  #e = null;
@@ -1281,7 +1275,7 @@ class Ve extends st {
1281
1275
  return n;
1282
1276
  }
1283
1277
  copyStyles(t, e, n) {
1284
- if (!ke(t))
1278
+ if (!Re(t))
1285
1279
  return;
1286
1280
  const r = window.getComputedStyle(t);
1287
1281
  for (const a of n) {
@@ -1431,32 +1425,23 @@ class Ve extends st {
1431
1425
  ` }) });
1432
1426
  }
1433
1427
  }
1434
- const ae = it(0);
1435
- class je extends st {
1428
+ class Ve extends it {
1436
1429
  sharedElementTransitionLayer = K();
1437
- animation = new Oe();
1430
+ animation = new $e();
1438
1431
  #t = "normal";
1439
1432
  #e = [];
1440
1433
  state = {
1441
- gestureNavigating: !1,
1442
- progress: 1
1434
+ gestureNavigating: !1
1443
1435
  };
1444
- onAnimationFrame() {
1445
- const t = this.animation.effect?.getComputedTiming().progress;
1446
- t && this.onProgress(t), this.animation.playState === "running" && requestAnimationFrame(this.onAnimationFrame.bind(this));
1447
- }
1448
1436
  onTransitionCancel() {
1449
1437
  this.props.navigation.dispatchEvent(new ye());
1450
1438
  }
1451
1439
  onTransitionStart() {
1452
- this.props.navigation.dispatchEvent(new ge()), this.onAnimationFrame();
1440
+ this.props.navigation.dispatchEvent(new ge());
1453
1441
  }
1454
1442
  onTransitionEnd() {
1455
1443
  this.props.navigation.dispatchEvent(new ve());
1456
1444
  }
1457
- onProgress(t) {
1458
- this.setState({ progress: t }), this.props.navigation.dispatchEvent(new we(t));
1459
- }
1460
1445
  get screens() {
1461
1446
  return this.#e;
1462
1447
  }
@@ -1482,12 +1467,13 @@ class je extends st {
1482
1467
  this.sharedElementTransitionLayer.current?.ref.current?.close(), this.onTransitionCancel(), this.animation.effect = null;
1483
1468
  }, this.animation.finished.then(() => {
1484
1469
  this.animation.commitStyles(), this.onTransitionEnd(), this.sharedElementTransitionLayer.current?.ref.current?.close(), this.animation.effect = null;
1470
+ }).catch(() => {
1485
1471
  }), this.animation;
1486
1472
  }
1487
1473
  render() {
1488
- return /* @__PURE__ */ Gt(_t.Provider, { value: this, children: [
1474
+ return /* @__PURE__ */ Ht(Wt.Provider, { value: this, children: [
1489
1475
  /* @__PURE__ */ b(
1490
- Ve,
1476
+ Oe,
1491
1477
  {
1492
1478
  ref: this.sharedElementTransitionLayer,
1493
1479
  navigation: this.props.navigation,
@@ -1503,16 +1489,15 @@ class je extends st {
1503
1489
  height: "100%",
1504
1490
  display: "grid",
1505
1491
  contain: "layout",
1506
- isolation: "isolate",
1507
- "--motion-progress": this.state.progress
1492
+ isolation: "isolate"
1508
1493
  },
1509
- children: /* @__PURE__ */ b(ae.Provider, { value: this.state.progress, children: this.props.children })
1494
+ children: this.props.children
1510
1495
  }
1511
1496
  )
1512
1497
  ] });
1513
1498
  }
1514
1499
  }
1515
- class Nt extends st {
1500
+ class Nt extends it {
1516
1501
  ref = K();
1517
1502
  screenTransitionLayer = K();
1518
1503
  parent = null;
@@ -1526,7 +1511,7 @@ class Nt extends st {
1526
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));
1527
1512
  }
1528
1513
  componentDidMount() {
1529
- this.isRoot && window.navigation.addEventListener("navigate", this.handleNavigationDispatch), this.loadDispatched || (window.navigation.dispatchEvent(new Ee()), this.loadDispatched = !0);
1514
+ this.isRoot && window.navigation.addEventListener("navigate", this.handleNavigationDispatch), this.loadDispatched || (window.navigation.dispatchEvent(new we()), this.loadDispatched = !0);
1530
1515
  }
1531
1516
  componentWillUnmount() {
1532
1517
  this.isRoot && window.navigation.removeEventListener("navigate", this.handleNavigationDispatch);
@@ -1549,16 +1534,18 @@ class Nt extends st {
1549
1534
  return pe(t, e);
1550
1535
  }
1551
1536
  addEventListener(t, e, n) {
1552
- return this.ref.current?.addEventListener(t, e, n);
1537
+ const r = this.ref.current;
1538
+ return r ? (r.addEventListener(t, e, n), () => r.removeEventListener(t, e, n)) : () => {
1539
+ };
1553
1540
  }
1554
1541
  removeEventListener(t, e, n) {
1555
1542
  return this.ref.current?.removeEventListener(t, e, n);
1556
1543
  }
1557
1544
  screenChildFromPathname(t) {
1558
- for (const e of jt.toArray(this.props.children)) {
1559
- if (!Re(e))
1545
+ for (const e of Bt.toArray(this.props.children)) {
1546
+ if (!Se(e))
1560
1547
  continue;
1561
- const n = Yt(
1548
+ const n = _t(
1562
1549
  e.props.path,
1563
1550
  t,
1564
1551
  this.baseURLPattern.pathname,
@@ -1574,7 +1561,7 @@ class Nt extends st {
1574
1561
  }
1575
1562
  preloadScreen(t) {
1576
1563
  const e = t.props.config, n = [];
1577
- return F(t.props.component) && n.push(t.props.component.load()), F(e?.header?.component) && n.push(e?.header?.component.load()), F(e?.footer?.component) && n.push(e?.footer?.component.load()), Promise.all(n).then(() => {
1564
+ 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(() => {
1578
1565
  });
1579
1566
  }
1580
1567
  get id() {
@@ -1588,13 +1575,13 @@ class Nt extends st {
1588
1575
  }
1589
1576
  get baseURL() {
1590
1577
  const t = this.isRoot ? window.location.pathname : this.parentScreen?.resolvedPathname, e = this.baseURLPattern.pathname;
1591
- return Tt(e, t);
1578
+ return bt(e, t);
1592
1579
  }
1593
1580
  get baseURLPattern() {
1594
1581
  let t = window.location.origin + "/", e = this.props.config?.basePath;
1595
1582
  if (e || (this.isRoot ? e = "/" : e = "."), this.parent && this.parentScreen) {
1596
1583
  const { resolvedPathname: n = window.location.pathname, path: r } = this.parentScreen, a = this.parent.baseURL?.href, o = new URLPattern({ baseURL: a, pathname: r });
1597
- t = Tt(
1584
+ t = bt(
1598
1585
  o.pathname,
1599
1586
  n
1600
1587
  ).href;
@@ -1602,7 +1589,7 @@ class Nt extends st {
1602
1589
  return new URLPattern({ baseURL: t, pathname: e });
1603
1590
  }
1604
1591
  get pathPatterns() {
1605
- return jt.map(this.props.children, (t) => ({ pattern: t.props.path, caseSensitive: !!t.props.caseSensitive }));
1592
+ return Bt.map(this.props.children, (t) => ({ pattern: t.props.path, caseSensitive: !!t.props.caseSensitive }));
1606
1593
  }
1607
1594
  get mounted() {
1608
1595
  return !!this.ref.current;
@@ -1625,10 +1612,10 @@ class Nt extends st {
1625
1612
  className: "react-motion-router",
1626
1613
  style: { width: "100%", height: "100%" },
1627
1614
  ref: this.ref,
1628
- children: /* @__PURE__ */ b(wt.Provider, { value: this, children: /* @__PURE__ */ b(
1629
- je,
1615
+ children: /* @__PURE__ */ b(pt.Provider, { value: this, children: /* @__PURE__ */ b(
1616
+ Ve,
1630
1617
  {
1631
- id: `${this.id}-transition-provider`,
1618
+ id: `${this.id}-transition-layer`,
1632
1619
  ref: this.screenTransitionLayer,
1633
1620
  navigation: this.navigation,
1634
1621
  hasUAVisualTransition: this.hasUAVisualTransition,
@@ -1639,7 +1626,7 @@ class Nt extends st {
1639
1626
  );
1640
1627
  }
1641
1628
  }
1642
- class Fe {
1629
+ class je {
1643
1630
  #t = /* @__PURE__ */ new Map();
1644
1631
  mutationObserver;
1645
1632
  constructor() {
@@ -1723,13 +1710,13 @@ class Fe {
1723
1710
  }
1724
1711
  class Ut {
1725
1712
  static rootNavigatorRef = null;
1726
- metaData = new Fe();
1713
+ metaData = new je();
1727
1714
  constructor() {
1728
1715
  const t = Ut.rootNavigatorRef?.deref();
1729
1716
  (!t || !t.isInDocument) && (Ut.rootNavigatorRef = new WeakRef(this));
1730
1717
  }
1731
1718
  addEventListener(t, e, n) {
1732
- return this.router.addEventListener(t, e, n), () => this.router.removeEventListener(t, e, n);
1719
+ return this.router.addEventListener(t, e, n);
1733
1720
  }
1734
1721
  removeEventListener(t, e, n) {
1735
1722
  return this.router.removeEventListener(t, e, n);
@@ -1756,25 +1743,39 @@ class Ut {
1756
1743
  return !!document.getElementById(`${this.routerId}`);
1757
1744
  }
1758
1745
  }
1759
- function nn() {
1760
- const s = vt(wt);
1746
+ function en() {
1747
+ const s = ht(pt);
1761
1748
  if (s)
1762
1749
  return s.navigation;
1763
1750
  throw new Error("Router is null. You may be trying to call useNavigation outside a Router.");
1764
1751
  }
1765
- function sn() {
1766
- return vt(wt);
1752
+ function nn() {
1753
+ return ht(pt);
1767
1754
  }
1768
- function rn() {
1769
- return ce("Motion"), vt(ae);
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
+ }),
1766
+ () => {
1767
+ const { progress: r } = e?.effect?.getComputedTiming() ?? {};
1768
+ return r ?? n;
1769
+ }
1770
+ );
1770
1771
  }
1771
1772
  function Be() {
1772
- const s = vt(Qt);
1773
+ const s = ht(Qt);
1773
1774
  if (s)
1774
1775
  return s;
1775
1776
  throw new Error("Router is null. You may be trying to call useRoute outside a Router.");
1776
1777
  }
1777
- function an(s, t) {
1778
+ function rn(s, t) {
1778
1779
  const e = Be(), n = t instanceof Function ? t() : t, r = he(e);
1779
1780
  ue(() => {
1780
1781
  r.current = e;
@@ -1785,47 +1786,45 @@ function an(s, t) {
1785
1786
  }, [n, s]);
1786
1787
  return [e.params[s] ?? n, a];
1787
1788
  }
1788
- const on = 2147483647, ln = 100, cn = 0, hn = 0, un = 1;
1789
+ const an = 2147483647, on = 100, ln = 0, cn = 0, hn = 1;
1789
1790
  export {
1790
- Ee as LoadEvent,
1791
- un as MAX_NORM_PROGRESS,
1792
- ln as MAX_PROGRESS,
1793
- on as MAX_Z_INDEX,
1794
- hn as MIN_NORM_PROGRESS,
1795
- cn as MIN_PROGRESS,
1796
- ae as MotionContext,
1797
- tn as MotionProgressEndEvent,
1798
- we as MotionProgressEvent,
1799
- Qe as MotionProgressStartEvent,
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,
1800
1799
  Ut as NavigationBase,
1801
1800
  Jt as NestedRouterContext,
1802
1801
  fe as PromiseAllDynamic,
1803
1802
  Nt as RouterBase,
1804
- wt as RouterContext,
1805
- Se as ScreenBase,
1806
- ze as SharedElement,
1803
+ pt as RouterContext,
1804
+ be as ScreenBase,
1805
+ qe as SharedElement,
1807
1806
  ye as TransitionCancelEvent,
1808
1807
  ve as TransitionEndEvent,
1809
1808
  ge as TransitionStartEvent,
1810
- Je as cloneAndInject,
1809
+ _e as cloneAndInject,
1811
1810
  pe as dispatchEvent,
1812
- Ge as includesRoute,
1813
- F as isLazyExoticComponent,
1811
+ ze as includesRoute,
1812
+ B as isLazyExoticComponent,
1814
1813
  te as isNativeLazyExoticComponent,
1815
- Xe as isNavigationSupported,
1816
- ke as isStylableElement,
1817
- Ze as isURLPatternSupported,
1818
- Re as isValidScreenChild,
1819
- He as lazy,
1820
- Yt as matchRoute,
1821
- _e as polyfillNavigation,
1822
- Ye as polyfillURLPattern,
1823
- Tt as resolveBaseURLFromPattern,
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,
1824
1823
  me as toCamelCase,
1825
- rn as useMotion,
1826
- nn as useNavigationBase,
1827
- an as useParamsBase,
1824
+ sn as useMotion,
1825
+ en as useNavigationBase,
1826
+ rn as useParamsBase,
1828
1827
  Be as useRouteBase,
1829
- sn as useRouterBase
1828
+ nn as useRouterBase
1830
1829
  };
1831
1830
  //# sourceMappingURL=index.js.map