@react-motion-router/stack 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,14 +1,14 @@
1
- import { NavigationBase as yt, resolveBaseURLFromPattern as wt, matchRoute as X, LAST_INDEX as L, FIRST_INDEX as C, SINGLE_ELEMENT_LENGTH as T, ScreenBase as Et, RoutePropContext as Pt, RouterBase as bt, PromiseWrapper as St, cloneAndInject as _t, LoadEvent as Lt, historyEntryFromDestination as Tt, useNavigationBase as Rt, useRouterBase as kt, useRouteBase as It, useParamsBase as Ft, Anchor as xt } from "@react-motion-router/core";
2
- import { jsx as G } from "react/jsx-runtime";
3
- import N, { useContext as Dt, createRef as Ot, startTransition as $, useDebugValue as H, useRef as Mt, useEffect as U, useCallback as V } from "react";
4
- import { GestureTimeline as Kt, springToLinear as Bt, easingToLinear as q } from "web-animations-extension";
5
- var y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Yt = {}, _ = {};
6
- Object.defineProperty(_, "__esModule", { value: !0 });
7
- var ct;
1
+ import { NavigationBase as wt, resolveBaseURLFromPattern as Et, matchRoute as j, SINGLE_ELEMENT_LENGTH as P, historyEntryFromDestination as Y, LAST_INDEX as L, FIRST_INDEX as D, ScreenBase as Pt, RoutePropContext as St, RouterBase as bt, PromiseWrapper as _t, cloneAndInject as Tt, LoadEvent as Lt, AnchorBase as It, useNavigationBase as Rt, useRouterBase as xt, useRouteBase as kt, useParamsBase as Ft, Anchor as Dt } from "@react-motion-router/core";
2
+ import { jsx as U } from "react/jsx-runtime";
3
+ import W, { createRef as vt, useContext as Ot, startTransition as G, useDebugValue as N, useRef as Mt, useEffect as A, useImperativeHandle as Bt, useCallback as q } from "react";
4
+ import { GestureTimeline as Kt, springToLinear as Yt, easingToLinear as z } from "web-animations-extension";
5
+ var m = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Xt = {}, T = {};
6
+ Object.defineProperty(T, "__esModule", { value: !0 });
7
+ var ut;
8
8
  (function(n) {
9
9
  n[n.tap = 0] = "tap", n[n.longpress = 1] = "longpress", n[n.pinchstart = 2] = "pinchstart", n[n.pinch = 3] = "pinch", n[n.pinchend = 4] = "pinchend", n[n.rotatestart = 5] = "rotatestart", n[n.rotate = 6] = "rotate", n[n.rotateend = 7] = "rotateend", n[n.swipestart = 8] = "swipestart", n[n.swipe = 9] = "swipe", n[n.swipeend = 10] = "swipeend", n[n.panstart = 11] = "panstart", n[n.pan = 12] = "pan", n[n.panend = 13] = "panend", n[n.doubletap = 14] = "doubletap";
10
- })(ct || (ct = {}));
11
- class Xt extends TouchEvent {
10
+ })(ut || (ut = {}));
11
+ class Ct extends TouchEvent {
12
12
  constructor(t, e) {
13
13
  if (super(t, {
14
14
  touches: Array.from(e.touches),
@@ -27,51 +27,51 @@ class Xt extends TouchEvent {
27
27
  this.gestureTarget = e.touches[0].target, this.x = e.touches[0].clientX, this.y = e.touches[0].clientY;
28
28
  }
29
29
  }
30
- _.default = Xt;
31
- var z = {}, Ct = y && y.__importDefault || function(n) {
30
+ T.default = Ct;
31
+ var Z = {}, Ht = m && m.__importDefault || function(n) {
32
32
  return n && n.__esModule ? n : { default: n };
33
33
  };
34
- Object.defineProperty(z, "__esModule", { value: !0 });
35
- const Ut = Ct(_);
36
- class Ht extends Ut.default {
34
+ Object.defineProperty(Z, "__esModule", { value: !0 });
35
+ const jt = Ht(T);
36
+ class At extends jt.default {
37
37
  constructor(t, e) {
38
38
  super("longpress", t), this.duration = 0, this.duration = e;
39
39
  }
40
40
  }
41
- z.default = Ht;
42
- var Z = {}, At = y && y.__importDefault || function(n) {
41
+ Z.default = At;
42
+ var J = {}, Ut = m && m.__importDefault || function(n) {
43
43
  return n && n.__esModule ? n : { default: n };
44
44
  };
45
- Object.defineProperty(Z, "__esModule", { value: !0 });
46
- const jt = At(_);
47
- class Nt extends jt.default {
45
+ Object.defineProperty(J, "__esModule", { value: !0 });
46
+ const Nt = Ut(T);
47
+ class $t extends Nt.default {
48
48
  constructor(t) {
49
49
  super("tap", t), this.duration = 0;
50
50
  }
51
51
  }
52
- Z.default = Nt;
53
- var J = {}, $t = y && y.__importDefault || function(n) {
52
+ J.default = $t;
53
+ var Q = {}, Vt = m && m.__importDefault || function(n) {
54
54
  return n && n.__esModule ? n : { default: n };
55
55
  };
56
- Object.defineProperty(J, "__esModule", { value: !0 });
57
- const Vt = $t(_);
58
- class Wt extends Vt.default {
56
+ Object.defineProperty(Q, "__esModule", { value: !0 });
57
+ const Wt = Vt(T);
58
+ class Gt extends Wt.default {
59
59
  constructor(t) {
60
60
  super("doubletap", t);
61
61
  }
62
62
  }
63
- J.default = Wt;
64
- var x = {}, Gt = y && y.__importDefault || function(n) {
63
+ Q.default = Gt;
64
+ var O = {}, qt = m && m.__importDefault || function(n) {
65
65
  return n && n.__esModule ? n : { default: n };
66
66
  };
67
- Object.defineProperty(x, "__esModule", { value: !0 });
68
- x.SwipeEndEvent = x.SwipeStartEvent = void 0;
69
- const qt = Gt(_);
70
- var ut;
67
+ Object.defineProperty(O, "__esModule", { value: !0 });
68
+ O.SwipeEndEvent = O.SwipeStartEvent = void 0;
69
+ const zt = qt(T);
70
+ var ht;
71
71
  (function(n) {
72
72
  n[n.start = 0] = "start", n[n.end = 1] = "end";
73
- })(ut || (ut = {}));
74
- class Q extends qt.default {
73
+ })(ht || (ht = {}));
74
+ class tt extends zt.default {
75
75
  constructor(t, e, r) {
76
76
  let s;
77
77
  switch (r) {
@@ -87,35 +87,35 @@ class Q extends qt.default {
87
87
  super(s, t), this.velocity = e.velocity, this.direction = e.direction;
88
88
  }
89
89
  }
90
- class zt extends Q {
90
+ class Zt extends tt {
91
91
  constructor(t, e) {
92
92
  super(t, e);
93
93
  }
94
94
  }
95
- x.default = zt;
96
- class Zt extends Q {
95
+ O.default = Zt;
96
+ class Jt extends tt {
97
97
  constructor(t, e) {
98
98
  super(t, e, "start");
99
99
  }
100
100
  }
101
- x.SwipeStartEvent = Zt;
102
- class Jt extends Q {
101
+ O.SwipeStartEvent = Jt;
102
+ class Qt extends tt {
103
103
  constructor(t, e) {
104
104
  super(t, e, "end");
105
105
  }
106
106
  }
107
- x.SwipeEndEvent = Jt;
108
- var D = {}, Qt = y && y.__importDefault || function(n) {
107
+ O.SwipeEndEvent = Qt;
108
+ var M = {}, te = m && m.__importDefault || function(n) {
109
109
  return n && n.__esModule ? n : { default: n };
110
110
  };
111
- Object.defineProperty(D, "__esModule", { value: !0 });
112
- D.PanEndEvent = D.PanStartEvent = void 0;
113
- const te = Qt(_);
114
- var ht;
111
+ Object.defineProperty(M, "__esModule", { value: !0 });
112
+ M.PanEndEvent = M.PanStartEvent = void 0;
113
+ const ee = te(T);
114
+ var lt;
115
115
  (function(n) {
116
116
  n[n.start = 0] = "start", n[n.end = 1] = "end";
117
- })(ht || (ht = {}));
118
- class tt extends te.default {
117
+ })(lt || (lt = {}));
118
+ class et extends ee.default {
119
119
  constructor(t, e, r) {
120
120
  let s;
121
121
  switch (r) {
@@ -138,35 +138,35 @@ class tt extends te.default {
138
138
  };
139
139
  }
140
140
  }
141
- class ee extends tt {
141
+ class ne extends et {
142
142
  constructor(t, e) {
143
143
  super(t, e);
144
144
  }
145
145
  }
146
- D.default = ee;
147
- class ne extends tt {
146
+ M.default = ne;
147
+ class re extends et {
148
148
  constructor(t, e) {
149
149
  super(t, e, "start");
150
150
  }
151
151
  }
152
- D.PanStartEvent = ne;
153
- class re extends tt {
152
+ M.PanStartEvent = re;
153
+ class se extends et {
154
154
  constructor(t, e) {
155
155
  super(t, e, "end");
156
156
  }
157
157
  }
158
- D.PanEndEvent = re;
159
- var O = {}, se = y && y.__importDefault || function(n) {
158
+ M.PanEndEvent = se;
159
+ var B = {}, ie = m && m.__importDefault || function(n) {
160
160
  return n && n.__esModule ? n : { default: n };
161
161
  };
162
- Object.defineProperty(O, "__esModule", { value: !0 });
163
- O.PinchEndEvent = O.PinchStartEvent = void 0;
164
- const ie = se(_);
165
- var lt;
162
+ Object.defineProperty(B, "__esModule", { value: !0 });
163
+ B.PinchEndEvent = B.PinchStartEvent = void 0;
164
+ const ae = ie(T);
165
+ var dt;
166
166
  (function(n) {
167
167
  n[n.start = 0] = "start", n[n.end = 1] = "end";
168
- })(lt || (lt = {}));
169
- class et extends ie.default {
168
+ })(dt || (dt = {}));
169
+ class nt extends ae.default {
170
170
  constructor(t, e, r) {
171
171
  let s;
172
172
  switch (r) {
@@ -185,35 +185,35 @@ class et extends ie.default {
185
185
  });
186
186
  }
187
187
  }
188
- class ae extends et {
188
+ class oe extends nt {
189
189
  constructor(t, e) {
190
190
  super(t, e);
191
191
  }
192
192
  }
193
- O.default = ae;
194
- class oe extends et {
193
+ B.default = oe;
194
+ class ce extends nt {
195
195
  constructor(t, e) {
196
196
  super(t, e, "start");
197
197
  }
198
198
  }
199
- O.PinchStartEvent = oe;
200
- class ce extends et {
199
+ B.PinchStartEvent = ce;
200
+ class ue extends nt {
201
201
  constructor(t, e) {
202
202
  super(t, e, "end");
203
203
  }
204
204
  }
205
- O.PinchEndEvent = ce;
206
- var M = {}, ue = y && y.__importDefault || function(n) {
205
+ B.PinchEndEvent = ue;
206
+ var K = {}, he = m && m.__importDefault || function(n) {
207
207
  return n && n.__esModule ? n : { default: n };
208
208
  };
209
- Object.defineProperty(M, "__esModule", { value: !0 });
210
- M.RotateEndEvent = M.RotateStartEvent = void 0;
211
- const he = ue(_);
212
- var dt;
209
+ Object.defineProperty(K, "__esModule", { value: !0 });
210
+ K.RotateEndEvent = K.RotateStartEvent = void 0;
211
+ const le = he(T);
212
+ var ft;
213
213
  (function(n) {
214
214
  n[n.start = 0] = "start", n[n.end = 1] = "end";
215
- })(dt || (dt = {}));
216
- class nt extends he.default {
215
+ })(ft || (ft = {}));
216
+ class rt extends le.default {
217
217
  constructor(t, e, r) {
218
218
  let s;
219
219
  switch (r) {
@@ -237,33 +237,33 @@ class nt extends he.default {
237
237
  }), this.rotationDeg = e.rotationDeg;
238
238
  }
239
239
  }
240
- class le extends nt {
240
+ class de extends rt {
241
241
  constructor(t, e) {
242
242
  super(t, e);
243
243
  }
244
244
  }
245
- M.default = le;
246
- class de extends nt {
245
+ K.default = de;
246
+ class fe extends rt {
247
247
  constructor(t, e) {
248
248
  super(t, e, "start");
249
249
  }
250
250
  }
251
- M.RotateStartEvent = de;
252
- class fe extends nt {
251
+ K.RotateStartEvent = fe;
252
+ class ge extends rt {
253
253
  constructor(t, e) {
254
254
  super(t, e, "end");
255
255
  }
256
256
  }
257
- M.RotateEndEvent = fe;
258
- var k = {};
259
- Object.defineProperty(k, "__esModule", { value: !0 });
260
- k.closest = k.Vec2 = k.assert = void 0;
257
+ K.RotateEndEvent = ge;
258
+ var x = {};
259
+ Object.defineProperty(x, "__esModule", { value: !0 });
260
+ x.closest = x.Vec2 = x.assert = void 0;
261
261
  function ve(n, t) {
262
262
  if (!n)
263
263
  throw new Error(t);
264
264
  }
265
- k.assert = ve;
266
- class ge {
265
+ x.assert = ve;
266
+ class pe {
267
267
  constructor(t, e) {
268
268
  this._x = 0, this._y = 0, this._clientX = 0, this._clientY = 0, this._clientX = t, this._clientY = e, this._x = this.translateX(t), this._y = this.translateY(e);
269
269
  }
@@ -307,74 +307,74 @@ class ge {
307
307
  return Math.sqrt(Math.pow(this._clientX, 2) + Math.pow(this._clientY, 2));
308
308
  }
309
309
  }
310
- k.Vec2 = ge;
311
- function pe(n, t) {
310
+ x.Vec2 = pe;
311
+ function me(n, t) {
312
312
  return t.reduce((e, r) => {
313
313
  let s = Math.abs(e - n), i = Math.abs(r - n);
314
314
  return s === i ? e > r ? e : r : i < s ? r : e;
315
315
  });
316
316
  }
317
- k.closest = pe;
317
+ x.closest = me;
318
318
  (function(n) {
319
- var t = y && y.__createBinding || (Object.create ? function(h, o, f, P) {
320
- P === void 0 && (P = f), Object.defineProperty(h, P, { enumerable: !0, get: function() {
321
- return o[f];
319
+ var t = m && m.__createBinding || (Object.create ? function(d, o, p, S) {
320
+ S === void 0 && (S = p), Object.defineProperty(d, S, { enumerable: !0, get: function() {
321
+ return o[p];
322
322
  } });
323
- } : function(h, o, f, P) {
324
- P === void 0 && (P = f), h[P] = o[f];
325
- }), e = y && y.__setModuleDefault || (Object.create ? function(h, o) {
326
- Object.defineProperty(h, "default", { enumerable: !0, value: o });
327
- } : function(h, o) {
328
- h.default = o;
329
- }), r = y && y.__importStar || function(h) {
330
- if (h && h.__esModule)
331
- return h;
323
+ } : function(d, o, p, S) {
324
+ S === void 0 && (S = p), d[S] = o[p];
325
+ }), e = m && m.__setModuleDefault || (Object.create ? function(d, o) {
326
+ Object.defineProperty(d, "default", { enumerable: !0, value: o });
327
+ } : function(d, o) {
328
+ d.default = o;
329
+ }), r = m && m.__importStar || function(d) {
330
+ if (d && d.__esModule)
331
+ return d;
332
332
  var o = {};
333
- if (h != null)
334
- for (var f in h)
335
- f !== "default" && Object.prototype.hasOwnProperty.call(h, f) && t(o, h, f);
336
- return e(o, h), o;
337
- }, s = y && y.__importDefault || function(h) {
338
- return h && h.__esModule ? h : { default: h };
333
+ if (d != null)
334
+ for (var p in d)
335
+ p !== "default" && Object.prototype.hasOwnProperty.call(d, p) && t(o, d, p);
336
+ return e(o, d), o;
337
+ }, s = m && m.__importDefault || function(d) {
338
+ return d && d.__esModule ? d : { default: d };
339
339
  };
340
340
  Object.defineProperty(n, "__esModule", { value: !0 }), n.RotateEndEvent = n.RotateEvent = n.RotateStartEvent = n.PinchEndEvent = n.PinchEvent = n.PinchStartEvent = n.PanEndEvent = n.PanEvent = n.PanStartEvent = n.SwipeEndEvent = n.SwipeEvent = n.SwipeStartEvent = n.DoubleTapEvent = n.LongPressEvent = n.GestureEvent = n.TapEvent = void 0;
341
- const i = s(_);
341
+ const i = s(T);
342
342
  n.GestureEvent = i.default;
343
- const a = s(z);
343
+ const a = s(Z);
344
344
  n.LongPressEvent = a.default;
345
- const c = s(Z);
345
+ const c = s(J);
346
346
  n.TapEvent = c.default;
347
- const u = s(J);
347
+ const u = s(Q);
348
348
  n.DoubleTapEvent = u.default;
349
- const l = r(x);
349
+ const l = r(O);
350
350
  n.SwipeEvent = l.default, Object.defineProperty(n, "SwipeEndEvent", { enumerable: !0, get: function() {
351
351
  return l.SwipeEndEvent;
352
352
  } }), Object.defineProperty(n, "SwipeStartEvent", { enumerable: !0, get: function() {
353
353
  return l.SwipeStartEvent;
354
354
  } });
355
- const v = r(D);
356
- n.PanEvent = v.default, Object.defineProperty(n, "PanEndEvent", { enumerable: !0, get: function() {
357
- return v.PanEndEvent;
355
+ const f = r(M);
356
+ n.PanEvent = f.default, Object.defineProperty(n, "PanEndEvent", { enumerable: !0, get: function() {
357
+ return f.PanEndEvent;
358
358
  } }), Object.defineProperty(n, "PanStartEvent", { enumerable: !0, get: function() {
359
- return v.PanStartEvent;
359
+ return f.PanStartEvent;
360
360
  } });
361
- const d = r(O);
362
- n.PinchEvent = d.default, Object.defineProperty(n, "PinchEndEvent", { enumerable: !0, get: function() {
363
- return d.PinchEndEvent;
361
+ const v = r(B);
362
+ n.PinchEvent = v.default, Object.defineProperty(n, "PinchEndEvent", { enumerable: !0, get: function() {
363
+ return v.PinchEndEvent;
364
364
  } }), Object.defineProperty(n, "PinchStartEvent", { enumerable: !0, get: function() {
365
- return d.PinchStartEvent;
365
+ return v.PinchStartEvent;
366
366
  } });
367
- const m = r(M);
368
- n.RotateEvent = m.default, Object.defineProperty(n, "RotateEndEvent", { enumerable: !0, get: function() {
369
- return m.RotateEndEvent;
367
+ const h = r(K);
368
+ n.RotateEvent = h.default, Object.defineProperty(n, "RotateEndEvent", { enumerable: !0, get: function() {
369
+ return h.RotateEndEvent;
370
370
  } }), Object.defineProperty(n, "RotateStartEvent", { enumerable: !0, get: function() {
371
- return m.RotateStartEvent;
371
+ return h.RotateStartEvent;
372
372
  } });
373
- const g = k;
374
- var p;
375
- (function(h) {
376
- h[h.right = 0] = "right", h[h.up = 1] = "up", h[h.left = 2] = "left", h[h.down = 3] = "down";
377
- })(p || (p = {}));
373
+ const g = x;
374
+ var y;
375
+ (function(d) {
376
+ d[d.right = 0] = "right", d[d.up = 1] = "up", d[d.left = 2] = "left", d[d.down = 3] = "down";
377
+ })(y || (y = {}));
378
378
  class w {
379
379
  constructor() {
380
380
  this.touchStart = new TouchEvent("touchstart") || {}, this.touchMove = new TouchEvent("touchmove") || {}, this.touchEnd = new TouchEvent("touchend") || {}, this.touchCancel = new TouchEvent("touchcancel") || {}, this.velocity = 0, this.dxDy = new g.Vec2(0, 0), this.scale = 1, this.rotation = 0, this.rotationDeg = 0, this.anchor = new g.Vec2(0, 0), this.octant = 0, this.isPanning = !1, this.isPinching = !1, this.isSwiping = !1, this.isRotating = !1, this.touchStartTime = 0, this.touchEndTime = 0, this.lastTouchTime = 0, this.taps = 0, this.scaleBase = 0, this.touchMoved = !1, this.touchDown = !1, this.shouldFire = !1, this.pointers = 0, this.isLongPress = !1, this.longPressTimeout = 0, this.touchStartListener = this.onTouchStart.bind(this), this.touchMoveListener = this.onTouchMove.bind(this), this.touchEndListener = this.onTouchEnd.bind(this), this.touchCancelListener = this.onTouchCancel.bind(this), this.currentTarget = window, this.config = {
@@ -396,34 +396,34 @@ k.closest = pe;
396
396
  onPointerLeave(o) {
397
397
  if (!o.touches.length) {
398
398
  if (this.isSwiping) {
399
- const f = new l.SwipeEndEvent(o, {
399
+ const p = new l.SwipeEndEvent(o, {
400
400
  velocity: this.velocity,
401
- direction: p[(0, g.closest)(this.octant, [0, 1, 2, 3])]
401
+ direction: y[(0, g.closest)(this.octant, [0, 1, 2, 3])]
402
402
  });
403
- this.dispatchEvent(f), this.isSwiping = !1;
403
+ this.dispatchEvent(p), this.isSwiping = !1;
404
404
  }
405
405
  if (this.isPanning) {
406
- const f = new v.PanEndEvent(o, {
406
+ const p = new f.PanEndEvent(o, {
407
407
  translation: this.dxDy,
408
408
  velocity: this.velocity
409
409
  });
410
- this.dispatchEvent(f), this.isPanning = !1;
410
+ this.dispatchEvent(p), this.isPanning = !1;
411
411
  }
412
412
  }
413
413
  if (o.touches.length === 1) {
414
414
  if (this.scaleBase = 0, this.isPinching) {
415
- const f = new d.PinchEndEvent(o, {
415
+ const p = new v.PinchEndEvent(o, {
416
416
  scale: this.scale
417
417
  });
418
- this.dispatchEvent(f), this.isPinching = !1;
418
+ this.dispatchEvent(p), this.isPinching = !1;
419
419
  }
420
420
  if (this.isRotating) {
421
- const f = new m.RotateEndEvent(o, {
421
+ const p = new h.RotateEndEvent(o, {
422
422
  rotation: this.rotation,
423
423
  rotationDeg: this.rotationDeg,
424
424
  anchor: this.anchor
425
425
  });
426
- this.dispatchEvent(f), this.isRotating = !1;
426
+ this.dispatchEvent(p), this.isRotating = !1;
427
427
  }
428
428
  }
429
429
  }
@@ -434,21 +434,21 @@ k.closest = pe;
434
434
  }
435
435
  onTouchStart(o) {
436
436
  this.currentTarget !== o.touches[0].target && (this.clean(), this.unbind(this.currentTarget), this.pointers = this.touchEnd.touches.length, this.taps = 0), this.touchStart = o;
437
- const f = parseInt(o.touches[0].target.dataset.minpointers || "0") || this.config.minPointers;
438
- if (this.touchStart.touches.length < f) {
437
+ const p = parseInt(o.touches[0].target.dataset.minpointers || "0") || this.config.minPointers;
438
+ if (this.touchStart.touches.length < p) {
439
439
  this.shouldFire = !1;
440
440
  return;
441
441
  }
442
442
  this.shouldFire = !0, this.touchStartTime = o.timeStamp, this.touchDown = !0, this.pointers || this.bind(o.touches[0].target), this.pointers = this.touchStart.touches.length;
443
- const P = parseFloat(this.currentTarget.dataset.longpressduration || "0") || this.config.longPressDuration;
443
+ const S = parseFloat(this.currentTarget.dataset.longpressduration || "0") || this.config.longPressDuration;
444
444
  if (this.longPressTimeout || (this.longPressTimeout = setTimeout(() => {
445
445
  if (!this.touchMoved && this.touchDown) {
446
- const E = Date.now() - this.touchStartTime, R = new a.default(this.touchStart, E);
447
- this.dispatchEvent(R), this.isLongPress = !0, this.longPressTimeout = 0;
446
+ const E = Date.now() - this.touchStartTime, I = new a.default(this.touchStart, E);
447
+ this.dispatchEvent(I), this.isLongPress = !0, this.longPressTimeout = 0;
448
448
  }
449
- }, P)), this.touchStart.touches.length > 1) {
450
- const E = new g.Vec2(this.touchStart.touches[0].clientX, this.touchStart.touches[0].clientY), R = new g.Vec2(this.touchStart.touches[1].clientX, this.touchStart.touches[1].clientY);
451
- this.scaleBase = E.substract(R).magnitude;
449
+ }, S)), this.touchStart.touches.length > 1) {
450
+ const E = new g.Vec2(this.touchStart.touches[0].clientX, this.touchStart.touches[0].clientY), I = new g.Vec2(this.touchStart.touches[1].clientX, this.touchStart.touches[1].clientY);
451
+ this.scaleBase = E.substract(I).magnitude;
452
452
  } else
453
453
  this.scaleBase = 0;
454
454
  }
@@ -456,82 +456,82 @@ k.closest = pe;
456
456
  if (!this.shouldFire)
457
457
  return;
458
458
  if (this.touchMoved = !0, this.touchMove = o, o.touches.length > 1 && this.touchStart.touches.length > 1 && (o.touches[1].clientX !== this.touchStart.touches[1].clientX || o.touches[1].clientY !== this.touchStart.touches[1].clientY)) {
459
- const b = new g.Vec2(this.touchMove.touches[0].clientX, this.touchMove.touches[0].clientY), A = new g.Vec2(this.touchMove.touches[1].clientX, this.touchMove.touches[1].clientY), at = new g.Vec2(this.touchStart.touches[0].clientX, this.touchStart.touches[0].clientY), ot = b.substract(A);
460
- if (this.scaleBase && Math.abs(this.scaleBase - ot.magnitude) > 10) {
461
- const I = ot.magnitude / this.scaleBase;
462
- if (this.scale = I, this.isPinching) {
463
- const j = new d.default(o, {
464
- scale: I
459
+ const b = new g.Vec2(this.touchMove.touches[0].clientX, this.touchMove.touches[0].clientY), $ = new g.Vec2(this.touchMove.touches[1].clientX, this.touchMove.touches[1].clientY), ot = new g.Vec2(this.touchStart.touches[0].clientX, this.touchStart.touches[0].clientY), ct = b.substract($);
460
+ if (this.scaleBase && Math.abs(this.scaleBase - ct.magnitude) > 10) {
461
+ const k = ct.magnitude / this.scaleBase;
462
+ if (this.scale = k, this.isPinching) {
463
+ const V = new v.default(o, {
464
+ scale: k
465
465
  });
466
- this.dispatchEvent(j);
466
+ this.dispatchEvent(V);
467
467
  } else {
468
- const j = new d.PinchStartEvent(o, {
469
- scale: I
468
+ const V = new v.PinchStartEvent(o, {
469
+ scale: k
470
470
  });
471
- this.dispatchEvent(j), this.isPinching = !0;
471
+ this.dispatchEvent(V), this.isPinching = !0;
472
472
  }
473
473
  }
474
474
  this.anchor = b;
475
- let B = Math.atan2(at.clientY - A.clientY, at.clientX - A.clientX);
476
- if (B < 0 ? B += 1.5708 : B -= 1.5708, this.rotation = B, this.rotationDeg = B * 180 / Math.PI, this.anchor = this.anchor, this.isRotating) {
477
- const I = new m.default(o, {
475
+ let C = Math.atan2(ot.clientY - $.clientY, ot.clientX - $.clientX);
476
+ if (C < 0 ? C += 1.5708 : C -= 1.5708, this.rotation = C, this.rotationDeg = C * 180 / Math.PI, this.anchor = this.anchor, this.isRotating) {
477
+ const k = new h.default(o, {
478
478
  anchor: this.anchor,
479
479
  rotation: this.rotation,
480
480
  rotationDeg: this.rotationDeg
481
481
  });
482
- this.dispatchEvent(I);
482
+ this.dispatchEvent(k);
483
483
  } else {
484
- const I = new m.RotateStartEvent(o, {
484
+ const k = new h.RotateStartEvent(o, {
485
485
  anchor: this.anchor,
486
486
  rotation: this.rotation,
487
487
  rotationDeg: this.rotationDeg
488
488
  });
489
- this.dispatchEvent(I), this.isRotating = !0;
489
+ this.dispatchEvent(k), this.isRotating = !0;
490
490
  }
491
491
  }
492
- const f = new g.Vec2(this.touchStart.touches[0].clientX, this.touchStart.touches[0].clientY), E = new g.Vec2(this.touchMove.touches[0].clientX, this.touchMove.touches[0].clientY).substract(f), R = E.magnitude, it = {
493
- x: E.x / R,
494
- y: E.y / R
495
- }, pt = Math.atan2(it.y, it.x);
496
- this.octant = Math.round(4 * pt / (2 * Math.PI) + 4) % 4;
497
- const mt = (o.timeStamp - this.touchStart.timeStamp) / 1e3, K = E.magnitude / mt;
492
+ const p = new g.Vec2(this.touchStart.touches[0].clientX, this.touchStart.touches[0].clientY), E = new g.Vec2(this.touchMove.touches[0].clientX, this.touchMove.touches[0].clientY).substract(p), I = E.magnitude, at = {
493
+ x: E.x / I,
494
+ y: E.y / I
495
+ }, mt = Math.atan2(at.y, at.x);
496
+ this.octant = Math.round(4 * mt / (2 * Math.PI) + 4) % 4;
497
+ const yt = (o.timeStamp - this.touchStart.timeStamp) / 1e3, X = E.magnitude / yt;
498
498
  if (this.isSwiping) {
499
499
  const b = new l.default(o, {
500
- direction: p[(0, g.closest)(this.octant, [0, 1, 2, 3])],
501
- velocity: K
500
+ direction: y[(0, g.closest)(this.octant, [0, 1, 2, 3])],
501
+ velocity: X
502
502
  });
503
503
  this.dispatchEvent(b);
504
504
  } else {
505
505
  const b = new l.SwipeStartEvent(o, {
506
- direction: p[(0, g.closest)(this.octant, [0, 1, 2, 3])],
507
- velocity: K
506
+ direction: y[(0, g.closest)(this.octant, [0, 1, 2, 3])],
507
+ velocity: X
508
508
  });
509
509
  this.dispatchEvent(b), this.isSwiping = !0;
510
510
  }
511
- if (this.dxDy = E, this.velocity = K, this.isPanning) {
512
- const b = new v.default(o, {
511
+ if (this.dxDy = E, this.velocity = X, this.isPanning) {
512
+ const b = new f.default(o, {
513
513
  translation: E,
514
- velocity: K
514
+ velocity: X
515
515
  });
516
516
  this.dispatchEvent(b);
517
517
  } else {
518
- const b = new v.PanStartEvent(o, {
518
+ const b = new f.PanStartEvent(o, {
519
519
  translation: E,
520
- velocity: K
520
+ velocity: X
521
521
  });
522
522
  this.dispatchEvent(b), this.isPanning = !0;
523
523
  }
524
524
  }
525
525
  onTouchEnd(o) {
526
- const f = parseInt(this.currentTarget.dataset.numberoftaps || "0") || this.config.numberOfTaps;
527
- if (this.taps++, this.shouldFire = this.taps > f, this.shouldFire) {
526
+ const p = parseInt(this.currentTarget.dataset.numberoftaps || "0") || this.config.numberOfTaps;
527
+ if (this.taps++, this.shouldFire = this.taps > p, this.shouldFire) {
528
528
  this.touchEnd = o, this.touchEndTime = o.timeStamp;
529
- const P = parseFloat(this.currentTarget.dataset.tapdelay || "0") || this.config.tapDelay;
529
+ const S = parseFloat(this.currentTarget.dataset.tapdelay || "0") || this.config.tapDelay;
530
530
  if (!this.touchMoved && !this.isLongPress)
531
- if (this.taps === 1 || this.touchEndTime - this.lastTouchTime < P) {
532
- if (this.taps % 2 === f) {
533
- const R = new u.default(o);
534
- this.dispatchEvent(R), this.taps = 0;
531
+ if (this.taps === 1 || this.touchEndTime - this.lastTouchTime < S) {
532
+ if (this.taps % 2 === p) {
533
+ const I = new u.default(o);
534
+ this.dispatchEvent(I), this.taps = 0;
535
535
  }
536
536
  const E = new c.default(o);
537
537
  this.dispatchEvent(E);
@@ -545,8 +545,8 @@ k.closest = pe;
545
545
  }
546
546
  }
547
547
  n.default = w, w.listening = !1, TouchEvent && (window.gestureProvider = new w());
548
- })(Yt);
549
- class me extends Event {
548
+ })(Xt);
549
+ class ye extends Event {
550
550
  routerId;
551
551
  route;
552
552
  props;
@@ -558,7 +558,7 @@ class me extends Event {
558
558
  super("navigate"), this.routerId = t, this.route = e, this.props = r, this.navigationType = s ?? "push", this.signal = i, this.committed = a, this.transition = c;
559
559
  }
560
560
  }
561
- class ye extends Event {
561
+ class we extends Event {
562
562
  routerId;
563
563
  signal;
564
564
  committed;
@@ -567,7 +567,7 @@ class ye extends Event {
567
567
  super("back"), this.routerId = t, this.signal = e, this.committed = r, this.transition = s;
568
568
  }
569
569
  }
570
- class we extends Event {
570
+ class Ee extends Event {
571
571
  routerId;
572
572
  signal;
573
573
  committed;
@@ -576,13 +576,13 @@ class we extends Event {
576
576
  super("forward"), this.routerId = t, this.signal = e, this.committed = r, this.transition = s;
577
577
  }
578
578
  }
579
- class Ee extends Event {
579
+ class Pe extends Event {
580
580
  source;
581
581
  constructor(t) {
582
582
  super("gesture-start"), this.source = t;
583
583
  }
584
584
  }
585
- class Pe extends Event {
585
+ class Se extends Event {
586
586
  source;
587
587
  constructor(t) {
588
588
  super("gesture-end"), this.source = t;
@@ -593,7 +593,7 @@ class be extends Event {
593
593
  super("gesture-cancel");
594
594
  }
595
595
  }
596
- class vt {
596
+ class F {
597
597
  routerId;
598
598
  #t;
599
599
  index;
@@ -606,6 +606,9 @@ class vt {
606
606
  get ondispose() {
607
607
  return this.#t.ondispose;
608
608
  }
609
+ get nativeEntry() {
610
+ return this.#t;
611
+ }
609
612
  get id() {
610
613
  return this.#t.id;
611
614
  }
@@ -634,7 +637,7 @@ class vt {
634
637
  return this.#t.getState();
635
638
  }
636
639
  }
637
- class Se extends yt {
640
+ class _e extends wt {
638
641
  config;
639
642
  constructor(t) {
640
643
  super(t), this.config = t;
@@ -709,17 +712,17 @@ class Se extends yt {
709
712
  createBackEvent(t, e, r) {
710
713
  if (!this.routerId)
711
714
  throw new Error("Router ID is not set");
712
- return new ye(this.routerId, t, e, r);
715
+ return new we(this.routerId, t, e, r);
713
716
  }
714
717
  createForwardEvent(t, e, r) {
715
718
  if (!this.routerId)
716
719
  throw new Error("Router ID is not set");
717
- return new we(this.routerId, t, e, r);
720
+ return new Ee(this.routerId, t, e, r);
718
721
  }
719
722
  createNavigateEvent(t, e, r, s, i, a) {
720
723
  if (!this.routerId)
721
724
  throw new Error("Router ID is not set");
722
- return new me(
725
+ return new ye(
723
726
  this.routerId,
724
727
  t,
725
728
  e,
@@ -817,39 +820,77 @@ class Se extends yt {
817
820
  * without requiring global history rewriting or fragile index arithmetic.
818
821
  */
819
822
  get entries() {
820
- const t = this.config.getPathPatterns().filter(({ pattern: i }) => i.endsWith("**"));
823
+ const t = this.config.getPathPatterns().filter(({ pattern: c }) => c.endsWith("**"));
821
824
  let e = null, r = L, s = !1;
822
- return this.globalEntries.filter((i, a) => {
823
- if (!i.url || s)
825
+ const i = this.globalEntries.filter((c, u) => {
826
+ if (!c.url || s)
824
827
  return !1;
825
- const c = new URL(i.url), u = wt(
828
+ const l = new URL(c.url), f = Et(
826
829
  this.baseURLPattern.pathname,
827
- c.pathname
830
+ l.pathname
828
831
  );
829
- if (!u)
832
+ if (!f)
830
833
  return r !== L && (s = !0), !1;
831
834
  if (e) {
832
- const l = new URLPattern(
835
+ const v = new URLPattern(
833
836
  e.pattern,
834
- u.href
837
+ f.href
835
838
  );
836
- if (X(
837
- c.pathname,
838
- c.pathname,
839
+ if (j(
840
+ l.pathname,
839
841
  l.pathname,
842
+ v.pathname,
840
843
  e.caseSensitive
841
844
  ))
842
845
  return !1;
843
846
  }
844
847
  return e = t.find(
845
- ({ pattern: l, caseSensitive: v }) => X(
846
- l,
847
- c.pathname,
848
+ ({ pattern: v, caseSensitive: h }) => j(
849
+ v,
850
+ l.pathname,
848
851
  this.baseURLPattern.pathname,
849
- v
852
+ h
850
853
  )
851
- ) ?? null, r = a, !0;
852
- }).map((i, a) => new vt(i, this.routerId, a));
854
+ ) ?? null, r = u, !0;
855
+ }).map((c, u) => new F(c, this.routerId, u)), a = this.config.getDestination();
856
+ if (a) {
857
+ const { transition: c } = this;
858
+ switch (c?.navigationType) {
859
+ case "replace":
860
+ i.splice(
861
+ a.index,
862
+ P,
863
+ new F(
864
+ Y(
865
+ a
866
+ ),
867
+ this.routerId,
868
+ a.index
869
+ )
870
+ );
871
+ break;
872
+ case "push": {
873
+ const u = c.from.index + P, l = i.findIndex((f) => f.key === c.from.key);
874
+ i.splice(
875
+ u,
876
+ 1 / 0,
877
+ new F(
878
+ Y({
879
+ ...a,
880
+ getState() {
881
+ return a.getState();
882
+ },
883
+ index: u
884
+ }),
885
+ this.routerId,
886
+ l + P
887
+ )
888
+ );
889
+ break;
890
+ }
891
+ }
892
+ }
893
+ return i;
853
894
  }
854
895
  /**
855
896
  * Returns the **local history index** for this router, derived from the
@@ -949,26 +990,26 @@ class Se extends yt {
949
990
  * ```
950
991
  */
951
992
  get index() {
952
- const t = window.navigation.currentEntry?.index ?? L, e = this.entries.at(C)?.globalIndex ?? L, r = this.entries.at(L)?.globalIndex ?? L;
953
- if (t <= e)
954
- return C;
955
- if (t >= r)
956
- return this.entries.length - T;
993
+ const { transition: t } = this, r = (t?.navigationType === "push" ? t.from.index + P : this.config.getDestination()?.index) ?? window.navigation.currentEntry?.index ?? L, s = this.entries.at(D)?.globalIndex ?? L, i = this.entries.at(L)?.globalIndex ?? L;
994
+ if (r <= s)
995
+ return D;
996
+ if (r >= i)
997
+ return this.entries.length - P;
957
998
  {
958
- const s = this.globalEntries.slice(
959
- e,
960
- t + T
999
+ const a = this.globalEntries.slice(
1000
+ s,
1001
+ r + P
961
1002
  );
962
- return this.entries.findLastIndex((i) => s.findLastIndex(
963
- (a) => i.key === a.key
1003
+ return this.entries.findLastIndex((c) => a.findLastIndex(
1004
+ (u) => c.key === u.key
964
1005
  ) > L);
965
1006
  }
966
1007
  }
967
1008
  get previous() {
968
- return this.entries[this.index - T] ?? null;
1009
+ return this.entries[this.index - P] ?? null;
969
1010
  }
970
1011
  get next() {
971
- return this.entries[this.index + T] ?? null;
1012
+ return this.entries[this.index + P] ?? null;
972
1013
  }
973
1014
  get current() {
974
1015
  return this.entries[this.index];
@@ -980,32 +1021,16 @@ class Se extends yt {
980
1021
  return this.next?.url?.origin === globalThis.location.origin;
981
1022
  }
982
1023
  }
983
- function _e(n) {
1024
+ function Te(n) {
984
1025
  return Object.fromEntries(n.entries());
985
1026
  }
986
1027
  function Le(n) {
987
1028
  return new URLSearchParams(n).toString();
988
1029
  }
989
- function Te(n) {
1030
+ function Ie(n) {
990
1031
  return n && typeof n == "object" && "gesture" in n ? !!n.gesture : !1;
991
1032
  }
992
- function Re(n) {
993
- return n && typeof n == "object" && "rollback" in n ? !!n.rollback : !1;
994
- }
995
- function W(n, t) {
996
- if (n === t)
997
- return !0;
998
- if (n === null || t === null || typeof n != "object" || typeof t != "object")
999
- return !1;
1000
- const e = Object.keys(n), r = Object.keys(t);
1001
- if (e.length !== r.length)
1002
- return !1;
1003
- for (const s of e)
1004
- if (!r.includes(s) || !W(n[s], t[s]))
1005
- return !1;
1006
- return !0;
1007
- }
1008
- function Y(n, { x: t, y: e }, r, s) {
1033
+ function H(n, { x: t, y: e }, r, s) {
1009
1034
  switch (n) {
1010
1035
  case "right":
1011
1036
  return Math.abs(t - r.left) < s;
@@ -1017,21 +1042,23 @@ function Y(n, { x: t, y: e }, r, s) {
1017
1042
  return Math.abs(e - r.bottom) < s;
1018
1043
  }
1019
1044
  }
1020
- class rt extends Et {
1045
+ class st extends Pt {
1021
1046
  #t;
1047
+ ref = vt();
1022
1048
  constructor(t, e) {
1023
- super(t, e);
1024
- const r = this.internalProps.id, s = e.navigation.entries.find((i) => i.key === r);
1025
- if (!s)
1026
- throw new Error(`No history entry found for: ${r}`);
1027
- this.#t = s;
1049
+ super(t, e), this.#t = this.internalProps.entry;
1050
+ let r;
1051
+ t.config?.presentation === "default" ? r = "div" : r = "dialog", this.state = {
1052
+ ...this.state,
1053
+ elementType: r
1054
+ };
1028
1055
  }
1029
1056
  static getDerivedStateFromProps(t) {
1030
1057
  return t.config?.presentation === "dialog" || t.config?.presentation === "modal" ? { elementType: "dialog" } : { elementType: "div" };
1031
1058
  }
1032
1059
  static historyEntryStateFromEntry(t, e) {
1033
1060
  if (t?.url) {
1034
- const r = t.getState() ?? {}, s = _e(t.url.searchParams), { params: i = {} } = e ?? {};
1061
+ const r = t.getState() ?? {}, s = Te(t.url.searchParams), { params: i = {} } = e ?? {};
1035
1062
  return r.params = {
1036
1063
  ...r.params,
1037
1064
  ...s,
@@ -1080,17 +1107,24 @@ class rt extends Et {
1080
1107
  const t = this.#t;
1081
1108
  if (!t.url)
1082
1109
  return {};
1083
- const e = X(
1110
+ const e = j(
1084
1111
  this.props.path,
1085
1112
  t.url.pathname,
1086
- this.context.baseURLPattern.pathname,
1113
+ this.router.baseURLPattern.pathname,
1087
1114
  this.props.caseSensitive
1088
1115
  );
1089
- return rt.historyEntryStateFromEntry(t, e);
1116
+ return st.historyEntryStateFromEntry(t, e);
1117
+ }
1118
+ get inert() {
1119
+ if (!this.state.focused)
1120
+ return !0;
1090
1121
  }
1091
1122
  get id() {
1092
1123
  return this.internalProps.id.toString();
1093
1124
  }
1125
+ get viewTransitionName() {
1126
+ return `${this.router.id}-${this.name}`;
1127
+ }
1094
1128
  get params() {
1095
1129
  return {
1096
1130
  ...this.props.defaultParams,
@@ -1128,33 +1162,50 @@ class rt extends Et {
1128
1162
  };
1129
1163
  window.navigation.updateCurrentEntry({ state: r });
1130
1164
  }
1131
- onClickOutside(t) {
1132
- if (!this.transitionProvider.current?.ref.current)
1165
+ onclick(t) {
1166
+ if (!this.ref.current)
1133
1167
  return;
1134
1168
  const e = this.context?.navigation;
1135
- t.composedPath().includes(this.transitionProvider.current.ref.current) || e?.goBack();
1169
+ t.composedPath().includes(this.ref.current) || e?.goBack();
1136
1170
  }
1137
1171
  onEnter(t) {
1138
- const e = this.transitionProvider.current?.ref;
1139
- if (e?.current instanceof HTMLDialogElement && e.current.open === !1) {
1140
- const r = this.context?.navigation;
1141
- this.props.config?.presentation === "modal" ? e.current.showModal() : e.current.show(), e.current.style.maxHeight = "unset", e.current.style.maxWidth = "unset", e.current.style.width = "max-content", e.current.style.height = "max-content";
1142
- const s = this.onClickOutside.bind(this);
1143
- e.current.addEventListener("close", function() {
1144
- this.returnValue !== "screen-exit" && (this.style.display = "block", r?.goBack()), r?.removeEventListener("click", s);
1145
- }, { once: !0 }), r?.addEventListener("click", s);
1172
+ if (this.ref?.current instanceof HTMLDialogElement && this.ref.current.open === !1) {
1173
+ const e = this.router.navigation;
1174
+ this.props.config?.presentation === "modal" ? this.ref.current.showModal() : this.ref.current.show(), this.ref.current.style.maxHeight = "unset", this.ref.current.style.maxWidth = "unset", this.ref.current.style.width = "max-content", this.ref.current.style.height = "max-content", this.ref.current.addEventListener("close", function() {
1175
+ this.returnValue !== "screen-exit" && (this.style.display = "block", e.goBack());
1176
+ }, { once: !0 }), e.addEventListener("click", this);
1146
1177
  }
1147
1178
  return super.onEnter(t);
1148
1179
  }
1149
1180
  onExited(t) {
1150
- const e = this.transitionProvider.current?.ref;
1151
- return e?.current instanceof HTMLDialogElement && e.current.close("screen-exit"), super.onExited(t);
1181
+ return this.ref?.current instanceof HTMLDialogElement && (this.ref.current.close("screen-exit"), this.router.navigation.removeEventListener("click", this)), super.onExited(t);
1182
+ }
1183
+ render() {
1184
+ const t = this.state.elementType;
1185
+ return /* @__PURE__ */ U(
1186
+ t,
1187
+ {
1188
+ id: this.viewTransitionName,
1189
+ ref: this.ref,
1190
+ className: "screen",
1191
+ inert: this.inert,
1192
+ style: {
1193
+ gridArea: "1 / 1",
1194
+ height: "100%",
1195
+ width: "100%",
1196
+ display: "flex",
1197
+ flexDirection: "column",
1198
+ viewTransitionName: this.viewTransitionName
1199
+ },
1200
+ children: super.render()
1201
+ }
1202
+ );
1152
1203
  }
1153
1204
  }
1154
- function F(n) {
1205
+ function R(n) {
1155
1206
  return !!(n !== null && typeof n == "object" && Object.hasOwn(n, "current"));
1156
1207
  }
1157
- const ke = {
1208
+ const Re = {
1158
1209
  horizontal: ["left", "right"],
1159
1210
  vertical: ["up", "down"],
1160
1211
  up: ["up"],
@@ -1162,21 +1213,21 @@ const ke = {
1162
1213
  left: ["left"],
1163
1214
  right: ["right"]
1164
1215
  };
1165
- function Ie(n, t) {
1166
- return ke[t].includes(n);
1216
+ function xe(n, t) {
1217
+ return Re[t].includes(n);
1167
1218
  }
1168
- function Fe(n) {
1219
+ function ke(n) {
1169
1220
  return n === "left" || n === "right" || n === "horizontal";
1170
1221
  }
1171
- const S = {
1222
+ const _ = {
1172
1223
  gestureHysteresis: 0.5,
1173
1224
  gestureMinFlingVelocity: 400,
1174
1225
  gestureAreaWidth: 100,
1175
1226
  gestureDirection: "right",
1176
1227
  gestureDisabled: !1
1177
- }, xe = 0.5, De = 1, Oe = 24;
1178
- function ft({ clientX: n, clientY: t }, e, r) {
1179
- return Y("left", { x: n, y: t }, e, r) && Y("right", { x: n, y: t }, e, r) && Y("down", { x: n, y: t }, e, r) && Y("up", { x: n, y: t }, e, r);
1228
+ }, Fe = 0.5, De = 1, Oe = 24;
1229
+ function gt({ clientX: n, clientY: t }, e, r) {
1230
+ return H("left", { x: n, y: t }, e, r) && H("right", { x: n, y: t }, e, r) && H("down", { x: n, y: t }, e, r) && H("up", { x: n, y: t }, e, r);
1180
1231
  }
1181
1232
  const Me = (n) => function({
1182
1233
  ref: e,
@@ -1184,29 +1235,29 @@ const Me = (n) => function({
1184
1235
  uaGestureAreaWidth: s = Oe,
1185
1236
  ...i
1186
1237
  }) {
1187
- const a = N.useRef(null), c = Dt(
1188
- Pt
1238
+ const a = W.useRef(null), c = Ot(
1239
+ St
1189
1240
  ) ?? null, { gestureAreaWidth: u = 0 } = c?.config ?? {};
1190
- return N.useImperativeHandle(
1241
+ return W.useImperativeHandle(
1191
1242
  e,
1192
1243
  () => a.current
1193
- ), N.useEffect(() => {
1244
+ ), W.useEffect(() => {
1194
1245
  if (!a.current)
1195
1246
  return;
1196
- const v = a.current, d = (m) => {
1197
- if (!(m instanceof TouchEvent) || r === "none")
1247
+ const f = a.current, v = (h) => {
1248
+ if (!(h instanceof TouchEvent) || r === "none")
1198
1249
  return;
1199
- const g = v.getBoundingClientRect();
1200
- Array.from(m.touches).map((h) => ft(h, g, u)).some(Boolean) && m.stopPropagation(), Array.from(m.touches).map((h) => ft(h, g, s)).some(Boolean) && m.preventDefault();
1250
+ const g = f.getBoundingClientRect();
1251
+ Array.from(h.touches).map((d) => gt(d, g, u)).some(Boolean) && h.stopPropagation(), Array.from(h.touches).map((d) => gt(d, g, s)).some(Boolean) && h.preventDefault();
1201
1252
  };
1202
- return v.addEventListener("touchstart", d), () => {
1203
- v.removeEventListener(
1253
+ return f.addEventListener("touchstart", v), () => {
1254
+ f.removeEventListener(
1204
1255
  "touchstart",
1205
- d
1256
+ v
1206
1257
  );
1207
1258
  };
1208
- }, [s, u, r]), /* @__PURE__ */ G(n, { ref: a, ...i });
1209
- }, Ke = new Proxy(
1259
+ }, [s, u, r]), /* @__PURE__ */ U(n, { ref: a, ...i });
1260
+ }, Be = new Proxy(
1210
1261
  {},
1211
1262
  {
1212
1263
  get(n, t) {
@@ -1218,7 +1269,7 @@ class hn extends bt {
1218
1269
  navigation;
1219
1270
  #t = null;
1220
1271
  constructor(t, e) {
1221
- super(t, e), this.navigation = new Se({
1272
+ super(t, e), this.navigation = new _e({
1222
1273
  addEventListener: this.addEventListener.bind(this),
1223
1274
  removeEventListener: this.removeEventListener.bind(this),
1224
1275
  dispatchEvent: this.dispatchEvent.bind(this),
@@ -1228,15 +1279,16 @@ class hn extends bt {
1228
1279
  baseURLPattern: this.baseURLPattern,
1229
1280
  getCommitted: () => this.committed,
1230
1281
  getTransition: () => this.state.transition,
1282
+ getDestination: () => this.state.destination,
1231
1283
  getPathPatterns: () => this.pathPatterns,
1232
1284
  getNavigatorById: (u) => this.getRouterById(u)?.navigation ?? null
1233
1285
  });
1234
1286
  const {
1235
- gestureAreaWidth: r = S.gestureAreaWidth,
1236
- gestureDirection: s = S.gestureDirection,
1237
- gestureDisabled: i = S.gestureDisabled,
1238
- gestureHysteresis: a = S.gestureHysteresis,
1239
- gestureMinFlingVelocity: c = S.gestureMinFlingVelocity
1287
+ gestureAreaWidth: r = _.gestureAreaWidth,
1288
+ gestureDirection: s = _.gestureDirection,
1289
+ gestureDisabled: i = _.gestureDisabled,
1290
+ gestureHysteresis: a = _.gestureHysteresis,
1291
+ gestureMinFlingVelocity: c = _.gestureMinFlingVelocity
1240
1292
  } = t.config?.screenConfig ?? {};
1241
1293
  this.state = {
1242
1294
  screenStack: [],
@@ -1246,6 +1298,7 @@ class hn extends bt {
1246
1298
  gestureDisabled: i,
1247
1299
  gestureMinFlingVelocity: c,
1248
1300
  transition: null,
1301
+ destination: null,
1249
1302
  documentTitle: document.title,
1250
1303
  fromKey: null,
1251
1304
  destinationKey: null,
@@ -1254,40 +1307,34 @@ class hn extends bt {
1254
1307
  }
1255
1308
  static getDerivedStateFromProps(t, e) {
1256
1309
  const r = e.screenStack.find(
1257
- (s) => F(s.ref) && s.ref.current?.focused
1310
+ (s) => R(s.props.ref) && s.props.ref.current?.focused
1258
1311
  )?.props.config;
1259
1312
  return document.title = r?.title ?? document.title, {
1260
- gestureDirection: r?.gestureDirection ?? S.gestureDirection,
1261
- gestureAreaWidth: r?.gestureAreaWidth ?? S.gestureAreaWidth,
1262
- gestureMinFlingVelocity: r?.gestureMinFlingVelocity ?? S.gestureMinFlingVelocity,
1263
- gestureHysteresis: r?.gestureHysteresis ?? S.gestureHysteresis,
1264
- gestureDisabled: r?.gestureDisabled ?? S.gestureDisabled,
1313
+ gestureDirection: r?.gestureDirection ?? _.gestureDirection,
1314
+ gestureAreaWidth: r?.gestureAreaWidth ?? _.gestureAreaWidth,
1315
+ gestureMinFlingVelocity: r?.gestureMinFlingVelocity ?? _.gestureMinFlingVelocity,
1316
+ gestureHysteresis: r?.gestureHysteresis ?? _.gestureHysteresis,
1317
+ gestureDisabled: r?.gestureDisabled ?? _.gestureDisabled,
1265
1318
  documentTitle: r?.title
1266
1319
  };
1267
1320
  }
1268
1321
  componentDidMount() {
1269
1322
  super.componentDidMount(), window.navigation.addEventListener("currententrychange", this), window.navigation.addEventListener("navigate", this), window.navigation.addEventListener("navigatesuccess", this), window.navigation.addEventListener("navigateerror", this);
1270
1323
  }
1271
- // TODO: figure out how to remove this
1272
- shouldComponentUpdate(t, e) {
1273
- return !W(this.props.config, t.config) || !W(this.state, e) || this.props.id !== t.id;
1274
- }
1275
1324
  componentWillUnmount() {
1276
1325
  window.navigation.removeEventListener("currententrychange", this), window.navigation.removeEventListener("navigate", this), window.navigation.removeEventListener("navigatesuccess", this), window.navigation.removeEventListener("navigateerror", this);
1277
1326
  }
1278
1327
  onnavigate(t) {
1279
- super.onnavigate(t), this.#t = new St();
1328
+ super.onnavigate(t), this.#t = new _t();
1280
1329
  }
1281
1330
  oncurrententrychange() {
1282
- this.#t?.resolve?.(window.navigation.currentEntry);
1283
- }
1284
- onnavigatesuccess() {
1285
- this.#t = null;
1331
+ this.#t?.resolve?.(window.navigation.currentEntry), this.#t = null;
1286
1332
  }
1287
1333
  onnavigateerror({ error: t }) {
1288
- this.#t?.state === "pending" && this.#t.reject?.(t), this.#t = null;
1334
+ this.#t?.state === "pending" && this.#t.reject?.(t), this.#t = null, this.screenTransitionLayer.current?.animation.playState === "running" && this.screenTransitionLayer.current.animation.cancel();
1289
1335
  }
1290
1336
  // TODO: change to use handleEvent paradigm
1337
+ // TODO: refactor this to just cancel the current navigation.
1291
1338
  onGestureCancel = () => {
1292
1339
  if (!this.state.transition)
1293
1340
  throw new Error("Rollback failed, transition is null");
@@ -1299,17 +1346,17 @@ class hn extends bt {
1299
1346
  if (!this.ref.current || this.state.gestureDisabled)
1300
1347
  return !1;
1301
1348
  const e = this.ref.current.getBoundingClientRect(), { direction: r } = t;
1302
- return (r === "down" || r === "right") && !this.navigation.canGoBack() || (r === "up" || r === "left") && !this.navigation.canGoForward() || Y(
1349
+ return (r === "down" || r === "right") && !this.navigation.canGoBack() || (r === "up" || r === "left") && !this.navigation.canGoForward() || H(
1303
1350
  r,
1304
1351
  t,
1305
1352
  e,
1306
1353
  this.state.gestureAreaWidth
1307
- ) ? !1 : Ie(r, this.state.gestureDirection);
1354
+ ) ? !1 : xe(r, this.state.gestureDirection);
1308
1355
  }
1309
1356
  onswipestart(t) {
1310
1357
  if (!this.canGestureNavigate(t) || !this.ref.current || !this.screenTransitionLayer.current)
1311
1358
  return;
1312
- const { direction: e } = t, r = Fe(e) ? "x" : "y";
1359
+ const { direction: e } = t, r = ke(e) ? "x" : "y";
1313
1360
  let s, i;
1314
1361
  switch (e) {
1315
1362
  case "right":
@@ -1339,7 +1386,7 @@ class hn extends bt {
1339
1386
  info: { gesture: a }
1340
1387
  }) : window.navigation.traverseTo(this.navigation.next.key, {
1341
1388
  info: { gesture: a }
1342
- }), this.dispatchEvent(new Ee(t));
1389
+ }), this.dispatchEvent(new Pe(t));
1343
1390
  }
1344
1391
  onswipeend(t) {
1345
1392
  if (!this.screenTransitionLayer.current)
@@ -1348,7 +1395,7 @@ class hn extends bt {
1348
1395
  this.screenTransitionLayer.current.animation.timeline = document.timeline;
1349
1396
  const s = r > 0 ? e > this.state.gestureHysteresis : e < this.state.gestureHysteresis;
1350
1397
  let i = !1;
1351
- t.velocity < this.state.gestureMinFlingVelocity && !s ? (i = !0, this.screenTransitionLayer.current.animation.reverse(), this.dispatchEvent(new be())) : this.dispatchEvent(new Pe(t)), i && this.screenTransitionLayer.current.animation.finished.then(() => {
1398
+ t.velocity < this.state.gestureMinFlingVelocity && !s ? (i = !0, this.screenTransitionLayer.current.animation.reverse(), this.dispatchEvent(new be())) : this.dispatchEvent(new Se(t)), i && this.screenTransitionLayer.current.animation.finished.then(() => {
1352
1399
  this.state.controller?.abort("gesture-cancel");
1353
1400
  });
1354
1401
  }
@@ -1361,34 +1408,37 @@ class hn extends bt {
1361
1408
  ), e = this.state.screenStack.findIndex(
1362
1409
  (r) => r.key === this.state.destinationKey
1363
1410
  );
1364
- return e >= C && e < t;
1411
+ return e >= D && e < t;
1365
1412
  }
1366
1413
  get screens() {
1367
1414
  const t = this.state.screenStack;
1368
1415
  return t.filter((e, r) => {
1369
- const s = e.ref ?? null, i = t.at(r + T)?.ref;
1370
- return F(s) && s.current?.config.keepAlive || F(i) && i.current?.config.presentation === "modal" || F(i) && i.current?.config.presentation === "dialog" || e.key === this.navigation.current?.key || e.key === this.state.fromKey || e.key === this.state.destinationKey;
1416
+ const s = e.props.ref ?? null, i = t.at(
1417
+ r + P
1418
+ )?.props.ref;
1419
+ return R(s) && s.current?.focused || R(s) && s.current?.config.keepAlive || R(i) && i.current?.config.presentation === "modal" || R(i) && i.current?.config.presentation === "dialog" || e.key === this.navigation.current?.key || e.key === this.state.fromKey || e.key === this.state.destinationKey;
1371
1420
  });
1372
1421
  }
1373
- cloneScreenChildFromPathname(t, e) {
1374
- const { child: r } = this.screenChildFromPathname(t) ?? {};
1375
- return r ? (e ??= crypto.randomUUID(), _t(r, {
1422
+ cloneScreenChildFromPathname(t, e, r) {
1423
+ const { child: s } = this.screenChildFromPathname(t) ?? {};
1424
+ return s ? (e ??= crypto.randomUUID(), Tt(s, {
1376
1425
  config: {
1377
1426
  title: document.title,
1378
1427
  ...this.props.config?.screenConfig,
1379
- ...r.props.config
1428
+ ...s.props.config
1380
1429
  },
1381
1430
  id: e,
1382
1431
  resolvedPathname: t,
1432
+ entry: r,
1383
1433
  key: e,
1384
- ref: Ot()
1434
+ ref: vt()
1385
1435
  })) : null;
1386
1436
  }
1387
1437
  getScreenRefByKey(t) {
1388
1438
  const e = this.state.screenStack.find(
1389
1439
  (r) => r.key === t
1390
- )?.ref;
1391
- return F(e) ? e : null;
1440
+ )?.props.ref;
1441
+ return R(e) ? e : null;
1392
1442
  }
1393
1443
  canIntercept(t) {
1394
1444
  const e = new URL(t.destination.url).pathname, r = this.baseURLPattern.pathname;
@@ -1416,19 +1466,20 @@ class hn extends bt {
1416
1466
  }
1417
1467
  }
1418
1468
  handlePreload(t) {
1419
- const e = () => {
1469
+ const e = async () => {
1470
+ await this.state.transition?.finished;
1420
1471
  const { pathname: r } = new URL(t.destination.url), {
1421
1472
  child: s,
1422
1473
  matchInfo: i = null
1423
1474
  } = this.screenChildFromPathname(r) ?? {};
1424
1475
  if (!s)
1425
- return Promise.resolve();
1426
- const { navigation: a } = this, { signal: c } = t, { path: u } = s.props, { transition: l } = t;
1427
- return new Promise((v) => {
1476
+ return;
1477
+ const { navigation: a } = this, { signal: c } = t, { path: u } = s.props, l = t.transition;
1478
+ return new Promise((f) => {
1428
1479
  this.setState({ transition: l }, async () => {
1429
- const d = rt.historyEntryStateFromEntry(
1430
- new vt(
1431
- Tt(t.destination),
1480
+ const v = st.historyEntryStateFromEntry(
1481
+ new F(
1482
+ Y(t.destination),
1432
1483
  this.id,
1433
1484
  L
1434
1485
  ),
@@ -1447,16 +1498,16 @@ class hn extends bt {
1447
1498
  config: {
1448
1499
  ...this.props.config?.screenConfig,
1449
1500
  ...s.props.config,
1450
- ...d.config
1501
+ ...v.config
1451
1502
  },
1452
1503
  params: {
1453
1504
  ...s.props.defaultParams,
1454
1505
  ...i?.params,
1455
- ...d.params
1506
+ ...v.params
1456
1507
  }
1457
1508
  }
1458
1509
  })
1459
- ]), this.setState({ transition: null }, v);
1510
+ ]), this.setState({ transition: null }, f);
1460
1511
  });
1461
1512
  });
1462
1513
  };
@@ -1464,46 +1515,59 @@ class hn extends bt {
1464
1515
  }
1465
1516
  handleLoad(t) {
1466
1517
  const e = () => {
1467
- const r = t.transition?.from?.key ?? null, s = t.destination.key, i = t.transition, a = [], c = this.navigation.entries;
1468
- return c.forEach((u) => {
1469
- if (!u.url)
1518
+ const r = t.transition?.from?.key ?? null, s = t.destination.key, { destination: i, transition: a } = t, c = [], u = this.navigation.entries;
1519
+ return u.length || u.push(
1520
+ new F(
1521
+ Y(
1522
+ i,
1523
+ D
1524
+ ),
1525
+ this.id,
1526
+ D
1527
+ )
1528
+ ), u.forEach((l) => {
1529
+ if (!l.url)
1470
1530
  return null;
1471
- const l = this.cloneScreenChildFromPathname(
1472
- u.url.pathname,
1473
- u.key
1531
+ const f = this.cloneScreenChildFromPathname(
1532
+ l.url.pathname,
1533
+ l.key,
1534
+ l
1474
1535
  );
1475
- if (!l)
1536
+ if (!f)
1476
1537
  return null;
1477
- a.push(l);
1538
+ c.push(f);
1478
1539
  }), new Promise(
1479
- (u, l) => $(() => {
1540
+ (l, f) => G(() => {
1480
1541
  this.setState(
1481
- { screenStack: a, fromKey: r, transition: i, destinationKey: s },
1542
+ { screenStack: c, fromKey: r, transition: a, destination: i, destinationKey: s },
1482
1543
  async () => {
1483
- const { initialPathname: v } = this.props.config ?? {}, [d] = c;
1484
- if (v && c.length === T && d.url && !X(
1544
+ const { initialPathname: v } = this.props.config ?? {}, [h] = u;
1545
+ if (v && u.length === P && h.url && !j(
1485
1546
  v,
1486
- d.url.pathname,
1547
+ h.url.pathname,
1487
1548
  this.baseURLPattern.pathname
1488
1549
  ))
1489
1550
  return (window.navigation.transition?.finished ?? Promise.resolve()).then(() => {
1490
1551
  this.navigation.replace(v).finished.then(() => {
1491
- const w = t.destination.getState() ?? {};
1492
- this.navigation.push(t.destination.url, w);
1552
+ const d = t.destination.getState() ?? {};
1553
+ this.navigation.push(t.destination.url, d);
1493
1554
  });
1494
- }), u();
1495
- const m = t.signal;
1496
- this.navigation.current?.key === void 0 && l(new Error("Current key is undefined"));
1497
- const g = this.getScreenRefByKey(
1498
- this.navigation.current.key
1555
+ }), l();
1556
+ const g = t.signal, y = this.getScreenRefByKey(
1557
+ String(s)
1499
1558
  );
1500
1559
  await this.dispatchLifecycleHandlers(
1501
- g,
1560
+ y,
1502
1561
  null,
1503
- m
1504
- ).catch(l), this.setState(
1505
- { destinationKey: null, fromKey: null, transition: null },
1506
- u
1562
+ g
1563
+ ).catch(f), this.setState(
1564
+ {
1565
+ destinationKey: null,
1566
+ fromKey: null,
1567
+ transition: null,
1568
+ destination: null
1569
+ },
1570
+ l
1507
1571
  );
1508
1572
  }
1509
1573
  );
@@ -1513,114 +1577,145 @@ class hn extends bt {
1513
1577
  t.intercept({ handler: e });
1514
1578
  }
1515
1579
  handleReplace(t) {
1516
- const e = this.state.screenStack, r = t.destination, s = new URL(r.url).pathname, i = window.navigation.currentEntry?.key ?? r.key, a = this.cloneScreenChildFromPathname(
1517
- s,
1518
- i
1519
- );
1520
- if (!a)
1521
- return t.preventDefault();
1522
- const c = () => {
1523
- const u = this.state.transition ?? window.navigation.transition, l = u?.from?.key ?? null, v = e.findIndex(
1524
- (d) => d.key === this.navigation.current?.key
1525
- );
1526
- return e.splice(
1527
- v,
1528
- T,
1529
- a
1530
- ), new Promise(
1531
- (d, m) => $(() => {
1532
- this.setState(
1533
- { destinationKey: i, fromKey: l, transition: u, screenStack: e },
1534
- async () => {
1535
- const g = t.signal, p = this.getScreenRefByKey(
1536
- String(i)
1537
- );
1538
- await this.dispatchLifecycleHandlers(
1539
- p,
1540
- null,
1541
- g
1542
- ).catch(m), this.setState(
1543
- { destinationKey: null, fromKey: null, transition: null },
1544
- d
1545
- );
1546
- }
1547
- );
1548
- })
1580
+ const e = async () => {
1581
+ const r = this.state.screenStack, s = t.destination, i = window.navigation.transition, a = new URL(s.url).pathname, c = window.navigation.currentEntry?.key ?? null, u = i?.from?.key ?? null, l = r.findIndex(
1582
+ (h) => h.key === this.navigation.current?.key
1583
+ ), f = new F(
1584
+ Y(
1585
+ s,
1586
+ l
1587
+ ),
1588
+ this.id,
1589
+ s.index
1590
+ ), v = this.cloneScreenChildFromPathname(
1591
+ a,
1592
+ c,
1593
+ f
1549
1594
  );
1595
+ if (v)
1596
+ return await this.preloadScreen(v), r.splice(
1597
+ l,
1598
+ P,
1599
+ v
1600
+ ), new Promise(
1601
+ (h, g) => G(() => {
1602
+ this.setState(
1603
+ { destinationKey: c, fromKey: u, transition: i, destination: s, screenStack: r },
1604
+ async () => {
1605
+ const y = t.signal, w = this.getScreenRefByKey(
1606
+ String(c)
1607
+ );
1608
+ await this.dispatchLifecycleHandlers(
1609
+ w,
1610
+ null,
1611
+ y
1612
+ ).catch(g), h();
1613
+ }
1614
+ );
1615
+ })
1616
+ ).finally(() => {
1617
+ this.setState({
1618
+ destinationKey: null,
1619
+ fromKey: null,
1620
+ transition: null,
1621
+ destination: null
1622
+ });
1623
+ });
1550
1624
  };
1551
- t.intercept({ handler: c });
1625
+ t.intercept({ precommitHandler: e });
1552
1626
  }
1553
1627
  handleDefault(t) {
1554
- const e = this.state.screenStack, r = t.destination, s = new URL(r.url).pathname;
1555
- if (!this.screenChildFromPathname(s))
1556
- return t.preventDefault();
1557
- const i = () => {
1558
- if (Re(t.info))
1559
- return Promise.resolve();
1560
- const u = window.navigation.transition;
1561
- let l = e.findIndex(
1562
- (p) => p.key === u?.from.key
1628
+ const e = async () => {
1629
+ const s = this.state.screenStack, i = t.destination, a = window.navigation.transition;
1630
+ let c = this.navigation.entries.findIndex(
1631
+ (h) => h.globalIndex === a?.from.index
1563
1632
  );
1564
- l === L && t.navigationType === "traverse" && (l = e.findIndex((p) => u?.from.url ? X(
1565
- p.props.path,
1566
- new URL(u.from.url).pathname,
1567
- this.baseURLPattern.pathname,
1568
- p.props.caseSensitive
1569
- ) : !1));
1570
- const v = (e[l]?.key || u?.from.key) ?? null, d = e.findIndex(
1571
- (p) => p.key === t.destination.key
1572
- ), m = (e[d]?.key || window.navigation.currentEntry?.key) ?? null;
1633
+ if (t.navigationType === "traverse" && c === L && a?.from.url) {
1634
+ const h = It.findClosestEntryByHref(
1635
+ a.from.url,
1636
+ void 0,
1637
+ this.navigation.entries.map((g) => g.nativeEntry),
1638
+ this.navigation.current.index
1639
+ );
1640
+ c = this.navigation.entries.findIndex(
1641
+ (g) => g.globalIndex === h?.index
1642
+ );
1643
+ }
1644
+ const u = s[c]?.key ?? null;
1645
+ let l = this.navigation.entries.findIndex(
1646
+ (h) => h.globalIndex === i.index
1647
+ ), f = s[l]?.key ?? null;
1573
1648
  if (t.navigationType === "push") {
1574
- const p = new URL(r.url).pathname, w = this.cloneScreenChildFromPathname(
1575
- p,
1576
- m
1649
+ l = c + P;
1650
+ const h = new URL(i.url).pathname, g = new F(
1651
+ Y(
1652
+ i,
1653
+ l
1654
+ ),
1655
+ this.id,
1656
+ i.index
1657
+ ), y = this.cloneScreenChildFromPathname(
1658
+ h,
1659
+ f,
1660
+ g
1577
1661
  );
1578
- if (!w)
1579
- return Promise.resolve();
1580
- e.splice(
1581
- l + T,
1662
+ if (!y)
1663
+ return;
1664
+ await this.preloadScreen(y), f = y.key, s.splice(
1665
+ l,
1582
1666
  1 / 0,
1583
1667
  // Remove all screens after current
1584
- w
1668
+ y
1585
1669
  );
1670
+ } else {
1671
+ const h = this.state.screenStack[l];
1672
+ await this.preloadScreen(h);
1586
1673
  }
1587
- const g = new AbortController();
1674
+ const v = new AbortController();
1588
1675
  return new Promise(
1589
- (p, w) => $(() => {
1676
+ (h, g) => G(() => {
1590
1677
  this.setState(
1591
- { controller: g, destinationKey: m, fromKey: v, transition: u, screenStack: e },
1678
+ {
1679
+ controller: v,
1680
+ destinationKey: f,
1681
+ fromKey: u,
1682
+ transition: a,
1683
+ destination: i,
1684
+ screenStack: s
1685
+ },
1592
1686
  async () => {
1593
- g.signal.onabort = w;
1594
- const h = t.signal, o = this.getScreenRefByKey(String(v)), f = this.getScreenRefByKey(
1595
- String(m)
1596
- ), P = this.dispatchLifecycleHandlers(
1597
- f,
1598
- o,
1599
- h
1600
- ).catch(w), E = this.screenTransition(
1601
- f,
1602
- o
1603
- );
1604
- E?.updatePlaybackRate(De), E?.finished.catch(w), await P, this.setState(
1605
- {
1606
- destinationKey: null,
1607
- fromKey: null,
1608
- transition: null,
1609
- controller: null
1610
- },
1611
- p
1687
+ v.signal.onabort = g;
1688
+ const y = t.signal, w = this.getScreenRefByKey(String(u)), d = this.getScreenRefByKey(
1689
+ String(f)
1690
+ ), o = this.dispatchLifecycleHandlers(
1691
+ d,
1692
+ w,
1693
+ y
1694
+ ).catch(g), p = this.screenTransition(
1695
+ d,
1696
+ w
1612
1697
  );
1698
+ p?.updatePlaybackRate(De), p?.finished.catch(g), await o, h();
1613
1699
  }
1614
1700
  );
1615
1701
  })
1616
- );
1702
+ ).finally(() => {
1703
+ this.setState(
1704
+ {
1705
+ destinationKey: null,
1706
+ fromKey: null,
1707
+ transition: null,
1708
+ destination: null,
1709
+ controller: null
1710
+ }
1711
+ );
1712
+ });
1617
1713
  };
1618
- let a;
1619
- Te(t.info) ? (a = "after-transition", this.addEventListener("gesture-end", () => t.commit?.(), { once: !0 }), this.addEventListener("gesture-cancel", this.onGestureCancel, {
1714
+ Ie(t.info) && this.addEventListener("gesture-cancel", this.onGestureCancel, {
1620
1715
  once: !0
1621
- })) : a = "immediate";
1622
- const c = { handler: i, commit: a };
1623
- t.intercept(c);
1716
+ });
1717
+ const r = { precommitHandler: e };
1718
+ t.intercept(r);
1624
1719
  }
1625
1720
  async dispatchLifecycleHandlers(t, e, r) {
1626
1721
  let s = !1;
@@ -1646,29 +1741,47 @@ class hn extends bt {
1646
1741
  const i = s.sharedElementTransitionLayer.current;
1647
1742
  i && (i.outgoingScreen = e, i.incomingScreen = t);
1648
1743
  const a = this.screens.findIndex(
1649
- (c) => c.ref === (r ? e : t)
1744
+ (c) => c.props.ref === (r ? e : t)
1650
1745
  );
1651
- return s.screens = this.screens.map((c, u) => (u = u - a + T, F(c.ref) && c.ref.current?.transitionProvider.current ? (c.ref.current.transitionProvider.current.index = u, c.ref) : null)).filter(F), s.transition();
1746
+ return s.screens = this.screens.map((c, u) => (u = u - a + P, R(c.props.ref) && c.props.ref.current?.transitionProvider.current ? (c.props.ref.current.transitionProvider.current.index = u, c.props.ref) : null)).filter(R), s.transition();
1652
1747
  }
1653
1748
  }
1654
1749
  render() {
1655
- return /* @__PURE__ */ G(Ke.div, { style: { display: "contents" }, children: super.render() });
1750
+ const t = this.state.gestureDisabled ? "none" : "contain", e = this.state.fromKey ? "none" : void 0;
1751
+ return /* @__PURE__ */ U(
1752
+ Be.div,
1753
+ {
1754
+ id: this.id,
1755
+ ref: this.ref,
1756
+ className: "stack",
1757
+ style: {
1758
+ width: "100%",
1759
+ height: "100%",
1760
+ display: "grid",
1761
+ contain: "layout",
1762
+ isolation: "isolate",
1763
+ pointerEvents: e
1764
+ },
1765
+ gestureBehaviour: t,
1766
+ children: super.render()
1767
+ }
1768
+ );
1656
1769
  }
1657
1770
  }
1658
- function Be() {
1659
- return H("Stack.Navigation"), Rt();
1771
+ function Ke() {
1772
+ return N("Stack.Navigation"), Rt();
1660
1773
  }
1661
1774
  function ln() {
1662
- return H("Stack.Router"), kt();
1775
+ return N("Stack.Router"), xt();
1663
1776
  }
1664
1777
  function dn() {
1665
- return H("Stack.Route"), It();
1778
+ return N("Stack.Route"), kt();
1666
1779
  }
1667
1780
  function fn(n, t) {
1668
- return H("Stack.Params"), Ft(n, t);
1781
+ return N("Stack.Params"), Ft(n, t);
1669
1782
  }
1670
1783
  function Ye(n, t, e = {}) {
1671
- const r = V(
1784
+ const r = q(
1672
1785
  (s) => {
1673
1786
  s.forEach((i) => {
1674
1787
  i.isIntersecting && t(i);
@@ -1676,70 +1789,74 @@ function Ye(n, t, e = {}) {
1676
1789
  },
1677
1790
  [t]
1678
1791
  );
1679
- return U(() => {
1792
+ return A(() => {
1680
1793
  const s = new IntersectionObserver(r, e), i = n.current;
1681
1794
  return i && s.observe(i), () => {
1682
1795
  i && s.unobserve(i);
1683
1796
  };
1684
1797
  }, [r, n, e]), n;
1685
1798
  }
1686
- function Xe(n, t, { forceThreshold: e = xe } = {}) {
1687
- const r = V(() => t(), [t]), s = V((i) => {
1799
+ function Xe(n, t, { forceThreshold: e = Fe } = {}) {
1800
+ const r = q(() => t(), [t]), s = q((i) => {
1688
1801
  const a = i.touches[0];
1689
1802
  a && a.force >= e && t();
1690
1803
  }, [e, t]);
1691
- return U(() => {
1804
+ return A(() => {
1692
1805
  const i = n.current;
1693
1806
  return i?.addEventListener("mouseenter", r), () => i?.removeEventListener("mouseenter", r);
1694
- }), U(() => {
1807
+ }), A(() => {
1695
1808
  const i = n.current;
1696
1809
  return i?.addEventListener("touchstart", s), () => i?.removeEventListener("touchstart", s);
1697
1810
  }), n;
1698
1811
  }
1699
- function vn({
1700
- preload: n,
1701
- params: t,
1702
- searchParams: e = t,
1703
- config: r,
1704
- preloadBehaviour: s = {
1812
+ function gn({
1813
+ ref: n,
1814
+ preload: t,
1815
+ params: e,
1816
+ searchParams: r = e,
1817
+ config: s,
1818
+ preloadBehaviour: i = {
1705
1819
  type: "onsight"
1706
1820
  },
1707
- children: i,
1708
- ...a
1821
+ children: a,
1822
+ ...c
1709
1823
  }) {
1710
- const c = Be(), u = s?.type === "onsight" && n, l = s?.type === "onhover" && n, v = s?.type === "force" && n, d = Mt(null);
1711
- Ye(
1712
- d,
1713
- (p) => {
1714
- !u || !p.isIntersecting || !(p.target instanceof HTMLAnchorElement) || c.preload(p.target.href, { params: t, config: r });
1824
+ const u = Ke(), l = i?.type === "onsight" && t, f = i?.type === "onhover" && t, v = i?.type === "force" && t, h = Mt(null);
1825
+ e ??= void 0, Ye(
1826
+ h,
1827
+ (w) => {
1828
+ !l || !w.isIntersecting || !(w.target instanceof HTMLAnchorElement) || u.preload(w.target.href, { params: e, config: s });
1715
1829
  },
1716
- u ? s : {}
1830
+ l ? i : {}
1717
1831
  ), Xe(
1718
- d,
1832
+ h,
1719
1833
  () => {
1720
- !l || !d.current || c.preload(d.current.href, { params: t, config: r });
1834
+ !f || !h.current || u.preload(h.current.href, { params: e, config: s });
1721
1835
  },
1722
- l ? s : {}
1723
- ), U(() => {
1724
- !v || !d.current || c.preload(d.current.href, { params: t, config: r });
1725
- }, [n, c, r, v, t]);
1726
- const m = c?.routerId, g = e ? Le(e) : void 0;
1727
- return /* @__PURE__ */ G(
1728
- xt,
1836
+ f ? i : {}
1837
+ ), A(() => {
1838
+ !v || !h.current || u.preload(h.current.href, { params: e, config: s });
1839
+ }, [t, u, s, v, e]);
1840
+ const g = u?.routerId, y = r ? Le(r) : void 0;
1841
+ return Bt(
1842
+ n,
1843
+ () => h.current
1844
+ ), /* @__PURE__ */ U(
1845
+ Dt,
1729
1846
  {
1730
- ...a,
1731
- "data-router-id": m,
1732
- ref: d,
1733
- search: g,
1847
+ ...c,
1848
+ "data-router-id": g,
1849
+ ref: h,
1850
+ search: y,
1734
1851
  navigateState: {
1735
- config: r,
1736
- params: t
1852
+ config: s,
1853
+ params: e
1737
1854
  },
1738
- children: i
1855
+ children: a
1739
1856
  }
1740
1857
  );
1741
1858
  }
1742
- const gn = [
1859
+ const vn = [
1743
1860
  {
1744
1861
  transform: "translateX(100vw)"
1745
1862
  },
@@ -1760,7 +1877,7 @@ const gn = [
1760
1877
  {
1761
1878
  transform: "translateX(-50vw)"
1762
1879
  }
1763
- ], Ue = [
1880
+ ], He = [
1764
1881
  {
1765
1882
  transform: "translateX(0vw)"
1766
1883
  },
@@ -1774,7 +1891,7 @@ const gn = [
1774
1891
  {
1775
1892
  transform: "translateX(0vw)"
1776
1893
  }
1777
- ], He = [
1894
+ ], je = [
1778
1895
  {
1779
1896
  transform: "translateX(-100vw)"
1780
1897
  },
@@ -1802,7 +1919,7 @@ const gn = [
1802
1919
  {
1803
1920
  transform: "translateY(0vh)"
1804
1921
  }
1805
- ], je = [
1922
+ ], Ue = [
1806
1923
  {
1807
1924
  transform: "translateY(100vh)"
1808
1925
  },
@@ -1823,14 +1940,14 @@ const gn = [
1823
1940
  {
1824
1941
  transform: "translateY(0vh)"
1825
1942
  }
1826
- ], bn = [
1943
+ ], Sn = [
1827
1944
  {
1828
1945
  transform: "translateY(0vh)"
1829
1946
  },
1830
1947
  {
1831
1948
  transform: "translateY(50vh)"
1832
1949
  }
1833
- ], Sn = [
1950
+ ], bn = [
1834
1951
  {
1835
1952
  transform: "scale(0.85)",
1836
1953
  opacity: 0
@@ -1848,14 +1965,14 @@ const gn = [
1848
1965
  transform: "scale(1.15)",
1849
1966
  opacity: 0
1850
1967
  }
1851
- ], Ln = [
1968
+ ], Tn = [
1852
1969
  {
1853
1970
  opacity: 0
1854
1971
  },
1855
1972
  {
1856
1973
  opacity: 1
1857
1974
  }
1858
- ], Tn = [
1975
+ ], Ln = [
1859
1976
  {
1860
1977
  opacity: 1
1861
1978
  },
@@ -1961,17 +2078,17 @@ function Je(n) {
1961
2078
  function Qe(n) {
1962
2079
  return (t) => Math.pow(t, n);
1963
2080
  }
1964
- const st = {
1965
- ...Bt({
2081
+ const it = {
2082
+ ...Yt({
1966
2083
  mass: 3,
1967
2084
  stiffness: 1e3,
1968
2085
  damping: 500,
1969
2086
  velocity: 0,
1970
2087
  steps: 200
1971
2088
  })
1972
- }, gt = {
2089
+ }, pt = {
1973
2090
  duration: 350,
1974
- easing: q(Je(Qe(5)))
2091
+ easing: z(Je(Qe(5)))
1975
2092
  }, tn = {
1976
2093
  duration: 150,
1977
2094
  easing: "linear"
@@ -1983,56 +2100,56 @@ const st = {
1983
2100
  easing: "cubic-bezier(0.35, 0.45, 0, 1)"
1984
2101
  }, rn = {
1985
2102
  duration: 250,
1986
- easing: q((n) => Math.cos((n + 1) * Math.PI) / 2 + 0.5)
2103
+ easing: z((n) => Math.cos((n + 1) * Math.PI) / 2 + 0.5)
1987
2104
  }, sn = {
1988
2105
  duration: 200,
1989
- easing: q((n) => n === 1 ? 1 : Math.pow(n, 2))
2106
+ easing: z((n) => n === 1 ? 1 : Math.pow(n, 2))
1990
2107
  };
1991
- function Rn({ ref: n, direction: t, playbackRate: e, index: r }) {
2108
+ function In({ ref: n, direction: t, playbackRate: e, index: r }) {
1992
2109
  let i = [
1993
- Ue,
2110
+ He,
1994
2111
  Ce
1995
2112
  ][r];
1996
2113
  const a = {
1997
2114
  playbackRate: e,
1998
2115
  fill: "forwards",
1999
- ...st
2116
+ ...it
2000
2117
  };
2001
2118
  return t === "reverse" && (i = i.toReversed()), new KeyframeEffect(n, i, a);
2002
2119
  }
2003
- function kn({ ref: n, direction: t, playbackRate: e, index: r }) {
2120
+ function Rn({ ref: n, direction: t, playbackRate: e, index: r }) {
2004
2121
  let i = [
2005
2122
  Ae,
2006
- He
2123
+ je
2007
2124
  ][r];
2008
2125
  const a = {
2009
2126
  playbackRate: e,
2010
2127
  fill: "forwards",
2011
- ...st
2128
+ ...it
2012
2129
  };
2013
2130
  return t === "reverse" && (i = i.toReversed()), new KeyframeEffect(n, i, a);
2014
2131
  }
2015
- function In({ ref: n, direction: t, playbackRate: e }) {
2016
- let r = je;
2132
+ function xn({ ref: n, direction: t, playbackRate: e }) {
2133
+ let r = Ue;
2017
2134
  const s = {
2018
2135
  playbackRate: e,
2019
2136
  fill: "forwards",
2020
- ...st
2137
+ ...it
2021
2138
  };
2022
2139
  return t === "reverse" && (r = r.toReversed()), new KeyframeEffect(n, r, s);
2023
2140
  }
2024
- function Fn({ ref: n, direction: t, playbackRate: e }) {
2141
+ function kn({ ref: n, direction: t, playbackRate: e }) {
2025
2142
  let r = Ne;
2026
2143
  const s = {
2027
2144
  playbackRate: e,
2028
2145
  fill: "forwards",
2029
- ...gt
2146
+ ...pt
2030
2147
  };
2031
2148
  return t === "reverse" && (r = r.toReversed()), new KeyframeEffect(n, r, s);
2032
2149
  }
2033
- function xn({ ref: n, direction: t, index: e, playbackRate: r }) {
2150
+ function Fn({ ref: n, direction: t, index: e, playbackRate: r }) {
2034
2151
  let s = Ze, i;
2035
- e === C ? i = sn : i = rn;
2152
+ e === D ? i = sn : i = rn;
2036
2153
  const a = {
2037
2154
  playbackRate: r,
2038
2155
  fill: "forwards",
@@ -2058,7 +2175,7 @@ function On({ ref: n, direction: t, index: e, playbackRate: r }) {
2058
2175
  $e
2059
2176
  ];
2060
2177
  let i;
2061
- e === C ? i = tn : i = gt;
2178
+ e === D ? i = tn : i = pt;
2062
2179
  let a = s[e];
2063
2180
  const c = {
2064
2181
  playbackRate: r,
@@ -2080,31 +2197,31 @@ function Mn({ ref: n, direction: t, index: e, playbackRate: r }) {
2080
2197
  return new KeyframeEffect(n, i, a);
2081
2198
  }
2082
2199
  export {
2083
- vn as Anchor,
2084
- Ln as FadeInKeyframes,
2085
- Tn as FadeOutKeyframes,
2086
- Ke as GestureRegion,
2087
- vt as HistoryEntry,
2088
- Se as Navigation,
2200
+ gn as Anchor,
2201
+ Tn as FadeInKeyframes,
2202
+ Ln as FadeOutKeyframes,
2203
+ Be as GestureRegion,
2204
+ F as HistoryEntry,
2205
+ _e as Navigation,
2089
2206
  hn as Router,
2090
- rt as Screen,
2207
+ st as Screen,
2091
2208
  wn as SlideInFromBottomKeyframes,
2092
2209
  mn as SlideInFromLeftKeyframes,
2093
- gn as SlideInFromRightKeyframes,
2210
+ vn as SlideInFromRightKeyframes,
2094
2211
  Pn as SlideInFromTopKeyframes,
2095
- bn as SlideOutToBottomKeyframes,
2212
+ Sn as SlideOutToBottomKeyframes,
2096
2213
  pn as SlideOutToLeftKeyframes,
2097
2214
  yn as SlideOutToRightKeyframes,
2098
2215
  En as SlideOutToTopKeyframes,
2099
- Sn as ZoomInKeyframes,
2216
+ bn as ZoomInKeyframes,
2100
2217
  _n as ZoomOutKeyframes,
2101
2218
  rn as androidBottomSheetSlideInOptions,
2102
2219
  sn as androidBottomSheetSlideOutOptions,
2103
2220
  Ge as androidConcealToBottomKeyframes,
2104
- Fn as androidFadeInFromBottom,
2221
+ kn as androidFadeInFromBottom,
2105
2222
  Ne as androidFadeInFromBottomKeyframes,
2106
- gt as androidFadeInFromBottomOptions,
2107
- xn as androidFadeInFromBottomSheet,
2223
+ pt as androidFadeInFromBottomOptions,
2224
+ Fn as androidFadeInFromBottomSheet,
2108
2225
  Ze as androidFadeInFromBottomSheetKeyframes,
2109
2226
  On as androidFadeInFromRight,
2110
2227
  $e as androidFadeInFromRightKeyframes,
@@ -2118,19 +2235,19 @@ export {
2118
2235
  nn as androidScaleFromCentreOptions,
2119
2236
  ze as androidScaleToCentreKeyframes,
2120
2237
  Me as createGestureRegion,
2121
- st as iOSKeyframeOptions,
2122
- In as iOSSlideInFromBottom,
2123
- je as iOSSlideInFromBottomKeyframes,
2124
- kn as iOSSlideInFromLeft,
2125
- He as iOSSlideInFromLeftKeyframes,
2126
- Rn as iOSSlideInFromRight,
2238
+ it as iOSKeyframeOptions,
2239
+ xn as iOSSlideInFromBottom,
2240
+ Ue as iOSSlideInFromBottomKeyframes,
2241
+ Rn as iOSSlideInFromLeft,
2242
+ je as iOSSlideInFromLeftKeyframes,
2243
+ In as iOSSlideInFromRight,
2127
2244
  Ce as iOSSlideInFromRightKeyframes,
2128
- Ue as iOSSlideOutToLeftKeyframes,
2245
+ He as iOSSlideOutToLeftKeyframes,
2129
2246
  Ae as iOSSlideOutToRightKeyframes,
2130
- Fe as isHorizontalDirection,
2131
- F as isRefObject,
2132
- Ie as isSupportedDirection,
2133
- Be as useNavigation,
2247
+ ke as isHorizontalDirection,
2248
+ R as isRefObject,
2249
+ xe as isSupportedDirection,
2250
+ Ke as useNavigation,
2134
2251
  fn as useParams,
2135
2252
  dn as useRoute,
2136
2253
  ln as useRouter