@react-motion-router/core 2.0.0-beta.sha-c19f37e → 2.0.0-beta.sha-9a4805f

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