vue-micro-router 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +687 -671
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,139 +1,139 @@
1
- import { shallowReactive as U, computed as C, defineAsyncComponent as me, reactive as pe, nextTick as k, ref as ee, inject as V, watch as X, onMounted as q, onBeforeUnmount as he, provide as N, toRefs as Oe, toRef as Ke, defineComponent as oe, openBlock as B, createBlock as z, resolveDynamicComponent as ye, mergeProps as Pe, Teleport as We, createElementVNode as j, withModifiers as le, normalizeStyle as be, normalizeClass as Q, createElementBlock as x, createCommentVNode as $e, renderSlot as we, Fragment as te, createVNode as Re, TransitionGroup as Ee, withCtx as ce, renderList as ue, unref as Y } from "vue";
2
- import { i as De, s as Ae, g as H, w as ne, p as _, b as K, n as W, u as Ye } from "./use-audio-manager.mjs";
3
- const Me = Symbol("micro-router");
4
- function ht() {
1
+ import { shallowReactive as F, computed as C, defineAsyncComponent as Pe, reactive as we, nextTick as te, ref as ne, inject as V, watch as X, onMounted as Q, onBeforeUnmount as De, provide as O, toRefs as Ue, toRef as Ye, defineComponent as ie, openBlock as G, createBlock as z, resolveDynamicComponent as Ae, mergeProps as Ce, Teleport as Fe, createElementVNode as q, withModifiers as ce, normalizeStyle as Ie, normalizeClass as k, createElementBlock as j, createCommentVNode as Xe, renderSlot as Re, Fragment as oe, createVNode as Te, TransitionGroup as Le, withCtx as fe, renderList as ge, unref as Y } from "vue";
2
+ import { i as Ee, s as Se, g as H, w as ae, p as I, b as W, n as $, u as xe } from "./use-audio-manager.mjs";
3
+ const Be = Symbol("micro-router");
4
+ function Et() {
5
5
  return Symbol("micro-router-nested");
6
6
  }
7
- const de = Symbol("micro-router-root"), Le = Symbol("micro-route-path"), Te = Symbol("micro-dialog-path"), Ie = Symbol("micro-control-name"), ae = Symbol("micro-attrs-read"), ie = Symbol("micro-attrs-write"), Ue = 550;
8
- function Ce() {
7
+ const me = Symbol("micro-router-root"), Ge = Symbol("micro-route-path"), Ne = Symbol("micro-dialog-path"), Oe = Symbol("micro-control-name"), se = Symbol("micro-attrs-read"), re = Symbol("micro-attrs-write"), ze = 550;
8
+ function be() {
9
9
  const e = /* @__PURE__ */ new Set();
10
- function o(i, t) {
10
+ function n(i, t) {
11
11
  const l = setTimeout(() => {
12
12
  e.delete(l), i();
13
13
  }, t);
14
14
  return e.add(l), l;
15
15
  }
16
- function n() {
16
+ function o() {
17
17
  e.forEach(clearTimeout), e.clear();
18
18
  }
19
- return { schedule: o, cleanup: n };
19
+ return { schedule: n, cleanup: o };
20
20
  }
21
- function fe(e) {
22
- return new Promise((o) => setTimeout(o, e));
21
+ function de(e) {
22
+ return new Promise((n) => setTimeout(n, e));
23
23
  }
24
- function Xe(e, o) {
25
- const n = e.defaultControlName, i = e.onboardingControlName, t = 300, l = Ce();
26
- let c = !1;
27
- const r = U(/* @__PURE__ */ new Map()), u = U(
24
+ function Ve(e, n) {
25
+ const o = e.defaultControlName, i = e.onboardingControlName, t = 300, l = be();
26
+ let u = !1;
27
+ const r = F(/* @__PURE__ */ new Map()), c = F(
28
28
  /* @__PURE__ */ new Map()
29
29
  ), a = C(() => {
30
30
  const s = [];
31
31
  for (const f of r.values())
32
32
  f.activated && s.push(f);
33
33
  return s;
34
- }), m = a, R = C(
35
- () => a.value.some((s) => s.name !== n)
36
- ), L = C(() => {
37
- const s = a.value.find((f) => f.name !== n);
38
- return (s == null ? void 0 : s.name) ?? n;
34
+ }), d = a, R = C(
35
+ () => a.value.some((s) => s.name !== o)
36
+ ), T = C(() => {
37
+ const s = a.value.find((f) => f.name !== o);
38
+ return (s == null ? void 0 : s.name) ?? o;
39
39
  });
40
- function M(s, f, A) {
41
- var d, P, p;
42
- if (!(f && c)) {
43
- f && (c = !0);
40
+ function M(s, f, p) {
41
+ var v, A, y;
42
+ if (!(f && u)) {
43
+ f && (u = !0);
44
44
  try {
45
45
  const h = r.get(s);
46
46
  if (!h) return;
47
- const v = r.get(n), D = s === n || s === i;
47
+ const m = r.get(o), D = s === o || s === i;
48
48
  if (f)
49
- (d = o == null ? void 0 : o.trackGuiEnter) == null || d.call(o, s), D ? r.forEach((w) => {
50
- var S;
51
- w.name !== n && w.activated && ((S = o == null ? void 0 : o.trackGuiLeave) == null || S.call(o, w.name), r.set(w.name, {
49
+ (v = n == null ? void 0 : n.trackGuiEnter) == null || v.call(n, s), D ? r.forEach((w) => {
50
+ var b;
51
+ w.name !== o && w.activated && ((b = n == null ? void 0 : n.trackGuiLeave) == null || b.call(n, w.name), r.set(w.name, {
52
52
  ...w,
53
53
  activated: !1,
54
54
  attrs: void 0
55
55
  }));
56
- }) : v != null && v.activated && ((P = o == null ? void 0 : o.trackGuiLeave) == null || P.call(o, n), r.set(n, { ...v, activated: !1 })), A && u.set(s, { ...A }), r.set(s, {
56
+ }) : m != null && m.activated && ((A = n == null ? void 0 : n.trackGuiLeave) == null || A.call(n, o), r.set(o, { ...m, activated: !1 })), p && c.set(s, { ...p }), r.set(s, {
57
57
  ...h,
58
58
  activated: !0,
59
59
  componentKey: (h.componentKey || 0) + 1,
60
- attrs: A ? { ...A } : void 0
60
+ attrs: p ? { ...p } : void 0
61
61
  });
62
62
  else {
63
- (p = o == null ? void 0 : o.trackGuiLeave) == null || p.call(o, s), u.delete(s), r.set(s, { ...h, activated: !1, attrs: void 0 });
64
- const w = r.get(n);
63
+ (y = n == null ? void 0 : n.trackGuiLeave) == null || y.call(n, s), c.delete(s), r.set(s, { ...h, activated: !1, attrs: void 0 });
64
+ const w = r.get(o);
65
65
  if (!D && w && !w.activated) {
66
66
  if (w.name === i) return;
67
- r.set(n, { ...w, activated: !0 });
67
+ r.set(o, { ...w, activated: !0 });
68
68
  }
69
69
  }
70
70
  } finally {
71
71
  f && l.schedule(() => {
72
- c = !1;
72
+ u = !1;
73
73
  }, t);
74
74
  }
75
75
  }
76
76
  }
77
- function T(s) {
77
+ function L(s) {
78
78
  r.has(s.name) && console.warn(`[vue-micro-router] Control "${s.name}" already registered. Overwriting.`);
79
79
  let { component: f } = s;
80
- De(f) && (f = me(f)), r.set(s.name, {
80
+ Ee(f) && (f = Pe(f)), r.set(s.name, {
81
81
  ...s,
82
- component: Ae(f)
82
+ component: Se(f)
83
83
  });
84
84
  }
85
- function I(s) {
86
- s.forEach(T);
85
+ function _(s) {
86
+ s.forEach(L);
87
87
  }
88
88
  function g(s) {
89
- return u.get(s);
89
+ return c.get(s);
90
90
  }
91
- function y(s, f) {
92
- const A = u.get(s);
93
- u.set(s, { ...A, ...f });
91
+ function P(s, f) {
92
+ const p = c.get(s);
93
+ c.set(s, { ...p, ...f });
94
94
  }
95
95
  return {
96
- resolveControls: m,
96
+ resolveControls: d,
97
97
  activeControl: R,
98
- currentControl: L,
98
+ currentControl: T,
99
99
  toggleControl: M,
100
- registerControl: T,
101
- registerControls: I,
100
+ registerControl: L,
101
+ registerControls: _,
102
102
  getControlAttrs: g,
103
- updateControlAttrs: y,
103
+ updateControlAttrs: P,
104
104
  cleanup: l.cleanup
105
105
  };
106
106
  }
107
- const ge = "micro-router-inspector", Fe = "micro-router-events";
108
- async function ze(e) {
107
+ const ve = "micro-router-inspector", je = "micro-router-events";
108
+ async function qe(e) {
109
109
  if (typeof import.meta < "u") return;
110
- let o;
110
+ let n;
111
111
  try {
112
- o = (await import(
112
+ n = (await import(
113
113
  /* @vite-ignore */
114
114
  "@vue/devtools-api"
115
115
  )).setupDevtoolsPlugin;
116
116
  } catch {
117
117
  return;
118
118
  }
119
- o && o(
119
+ n && n(
120
120
  {
121
121
  id: "vue-micro-router",
122
122
  label: "Micro Router",
123
123
  packageName: "vue-micro-router",
124
124
  homepage: "https://github.com/danh121097/vue-micro-router"
125
125
  },
126
- (n) => {
127
- n.addInspector({
128
- id: ge,
126
+ (o) => {
127
+ o.addInspector({
128
+ id: ve,
129
129
  label: "Micro Router",
130
130
  icon: "route"
131
- }), n.addTimelineLayer({
132
- id: Fe,
131
+ }), o.addTimelineLayer({
132
+ id: je,
133
133
  label: "Micro Router",
134
134
  color: 4372611
135
- }), n.on.getInspectorTree((i) => {
136
- i.inspectorId === ge && (i.rootNodes = [
135
+ }), o.on.getInspectorTree((i) => {
136
+ i.inspectorId === ve && (i.rootNodes = [
137
137
  {
138
138
  id: "routes",
139
139
  label: `Routes (${e.resolveRoutes.value.length} active)`,
@@ -159,8 +159,8 @@ async function ze(e) {
159
159
  }))
160
160
  }
161
161
  ]);
162
- }), n.on.getInspectorState((i) => {
163
- if (i.inspectorId === ge) {
162
+ }), o.on.getInspectorState((i) => {
163
+ if (i.inspectorId === ve) {
164
164
  if (i.nodeId === "routes")
165
165
  i.state = {
166
166
  Navigation: [
@@ -200,80 +200,117 @@ async function ze(e) {
200
200
  }
201
201
  );
202
202
  }
203
- function Ve(e) {
204
- const o = e.activePath.value.split("/").filter(Boolean), n = {};
205
- for (const r of o) {
206
- const u = e.getRouteAttrs(r);
207
- u && (n[r] = { ...u });
203
+ function He(e) {
204
+ const n = e.activePath.value.split("/").filter(Boolean), o = {};
205
+ for (const r of n) {
206
+ const c = e.getRouteAttrs(r);
207
+ c && (o[r] = { ...c });
208
208
  }
209
209
  const i = [], t = {};
210
210
  for (const r of e.resolveDialogs.value) {
211
211
  if (r.closing) continue;
212
212
  i.push(r.path);
213
- const u = e.getDialogAttrs(r.path);
214
- u && (t[r.path] = { ...u });
213
+ const c = e.getDialogAttrs(r.path);
214
+ c && (t[r.path] = { ...c });
215
215
  }
216
- const l = [], c = {};
216
+ const l = [], u = {};
217
217
  for (const r of e.resolveControls.value) {
218
218
  l.push(r.name);
219
- const u = e.getControlAttrs(r.name);
220
- u && (c[r.name] = { ...u });
219
+ const c = e.getControlAttrs(r.name);
220
+ c && (u[r.name] = { ...c });
221
221
  }
222
222
  return {
223
223
  version: 1,
224
- navigation: { activePath: e.activePath.value, routeAttrs: n },
224
+ navigation: { activePath: e.activePath.value, routeAttrs: o },
225
225
  dialogs: { stack: i, attrs: t },
226
- controls: { active: l, attrs: c }
226
+ controls: { active: l, attrs: u }
227
227
  };
228
228
  }
229
- async function xe(e, o) {
230
- if (o.version !== 1) {
231
- console.warn("[vue-micro-router] Unknown serialized state version:", o.version);
229
+ async function Je(e, n) {
230
+ if (n.version !== 1) {
231
+ console.warn("[vue-micro-router] Unknown serialized state version:", n.version);
232
232
  return;
233
233
  }
234
- const { activePath: n, routeAttrs: i } = o.navigation;
235
- await e.push(n);
234
+ const { activePath: o, routeAttrs: i } = n.navigation;
235
+ await e.push(o);
236
236
  for (const [t, l] of Object.entries(i))
237
237
  e.updateRouteAttrs(t, l);
238
- for (const t of o.dialogs.stack) {
239
- const l = o.dialogs.attrs[t];
238
+ for (const t of n.dialogs.stack) {
239
+ const l = n.dialogs.attrs[t];
240
240
  e.openDialog(t, l);
241
241
  }
242
- for (const t of o.controls.active) {
243
- const l = o.controls.attrs[t];
242
+ for (const t of n.controls.active) {
243
+ const l = n.controls.attrs[t];
244
244
  e.toggleControl(t, !0, l);
245
245
  }
246
246
  }
247
- function je(e) {
248
- const n = Ce();
247
+ const Qe = /* @__PURE__ */ new Set(["A", "BUTTON", "INPUT", "SELECT", "TEXTAREA"]), Ze = /iPhone|iPad|iPod|Android/i;
248
+ let B = null, J = null, pe = !1;
249
+ function ke(e) {
250
+ return !(!Qe.has(e.tagName) && !e.hasAttribute("tabindex") || e.tagName === "A" && !e.hasAttribute("href") || e.hidden || e.closest("[hidden],[inert]") || e.getAttribute("aria-hidden") === "true" || e.getAttribute("tabindex") === "-1" || e.hasAttribute("disabled") || e instanceof HTMLInputElement && e.type === "hidden");
251
+ }
252
+ function Me(e) {
253
+ return Array.from(
254
+ e.querySelectorAll("*")
255
+ ).filter(ke);
256
+ }
257
+ function et(e) {
258
+ return Me(e).find((n) => n.hasAttribute("autofocus"));
259
+ }
260
+ function tt(e) {
261
+ const n = Me(e);
262
+ return n.find((o) => o.hasAttribute("autofocus")) ?? n[0] ?? e;
263
+ }
264
+ function nt() {
265
+ typeof document > "u" || typeof navigator > "u" || !Ze.test(navigator.userAgent) || (pe = !0, B == null || B.remove(), B = document.createElement("input"), B.setAttribute("aria-hidden", "true"), B.setAttribute("tabindex", "-1"), B.style.cssText = [
266
+ "position:fixed",
267
+ "top:0",
268
+ "left:0",
269
+ "width:1px",
270
+ "height:1px",
271
+ "opacity:0",
272
+ "border:none",
273
+ "outline:none",
274
+ "padding:0",
275
+ "pointer-events:none",
276
+ "z-index:-1"
277
+ ].join(";"), document.body.appendChild(B), B.focus(), J && clearTimeout(J), J = setTimeout(() => {
278
+ he();
279
+ }, 1500));
280
+ }
281
+ function he() {
282
+ !pe && !B || (pe = !1, J && (clearTimeout(J), J = null), B == null || B.remove(), B = null);
283
+ }
284
+ function ot(e) {
285
+ const o = be();
249
286
  let i = !1;
250
- const t = pe({
287
+ const t = we({
251
288
  activeDialog: "",
252
289
  fromDialog: "",
253
290
  toDialog: "",
254
291
  /** Open order stack — last entry = topmost dialog. Used for z-index and focus management. */
255
292
  dialogStack: [],
256
293
  /** Dialog definitions. Re-set on open/close to trigger shallowReactive reactivity. */
257
- dialogs: U(/* @__PURE__ */ new Map()),
294
+ dialogs: F(/* @__PURE__ */ new Map()),
258
295
  /** Attrs stored separately for useMicroState access inside dialog components */
259
- dialogAttrs: U(/* @__PURE__ */ new Map())
296
+ dialogAttrs: F(/* @__PURE__ */ new Map())
260
297
  }), l = C(() => {
261
- const g = [], y = /* @__PURE__ */ new Set();
298
+ const g = [], P = /* @__PURE__ */ new Set();
262
299
  for (const s of t.dialogStack) {
263
300
  const f = t.dialogs.get(s);
264
- f && (f.activated || f.closing) && (g.push(f), y.add(s));
301
+ f && (f.activated || f.closing) && (g.push(f), P.add(s));
265
302
  }
266
303
  for (const s of t.dialogs.values())
267
- s.closing && !y.has(s.path) && g.push(s);
304
+ s.closing && !P.has(s.path) && g.push(s);
268
305
  return g;
269
- }), c = n.schedule;
270
- function r(g, y) {
271
- return { path: g, attrs: y };
306
+ }), u = o.schedule;
307
+ function r(g, P) {
308
+ return { path: g, attrs: P };
272
309
  }
273
- function u({ path: g, open: y, attrs: s }) {
310
+ function c({ path: g, open: P, attrs: s }) {
274
311
  const f = t.dialogs.get(g);
275
- return f && k(() => {
276
- if (y)
312
+ return f && te(() => {
313
+ if (P)
277
314
  t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g, s && t.dialogAttrs.set(g, { ...s }), t.dialogs.set(g, {
278
315
  ...f,
279
316
  activated: !0,
@@ -283,85 +320,85 @@ function je(e) {
283
320
  path: g,
284
321
  ...s,
285
322
  onClose: () => {
286
- m(g), s != null && s.onClose && typeof s.onClose == "function" && s.onClose();
323
+ d(g), s != null && s.onClose && typeof s.onClose == "function" && s.onClose();
287
324
  }
288
325
  }
289
326
  });
290
327
  else {
291
328
  t.fromDialog = t.activeDialog;
292
- const A = t.dialogStack.indexOf(g);
293
- A > -1 && t.dialogStack.splice(A, 1), t.activeDialog = t.dialogStack.at(-1) ?? "", t.toDialog = t.activeDialog;
294
- const d = f.transitionDuration ?? (f.transition === "slide" ? 500 : 300);
329
+ const p = t.dialogStack.indexOf(g);
330
+ p > -1 && t.dialogStack.splice(p, 1), t.activeDialog = t.dialogStack.at(-1) ?? "", t.toDialog = t.activeDialog;
331
+ const v = f.transitionDuration ?? (f.transition === "slide" ? 500 : 300);
295
332
  t.dialogs.set(g, {
296
333
  ...f,
297
334
  activated: !1,
298
335
  closing: !0,
299
336
  attrs: void 0
300
- }), c(() => {
301
- const P = t.dialogs.get(g);
302
- P && !P.activated && t.dialogs.set(g, { ...P, closing: !1 });
303
- }, d + 200);
337
+ }), u(() => {
338
+ const A = t.dialogs.get(g);
339
+ A && !A.activated && t.dialogs.set(g, { ...A, closing: !1 });
340
+ }, v + 200);
304
341
  }
305
342
  }), r(g, s);
306
343
  }
307
- function a(g, y) {
308
- var s;
309
- if (i) return r(g, y);
310
- i = !0;
344
+ function a(g, P) {
345
+ var s, f;
346
+ if (i) return r(g, P);
347
+ (s = t.dialogs.get(g)) != null && s.focusInput && nt(), i = !0;
311
348
  try {
312
- const f = t.activeDialog || "";
313
- (s = e == null ? void 0 : e.trackDialogEnter) == null || s.call(e, g, f, g);
314
- const A = u({ path: g, open: !0, attrs: y });
315
- return c(() => {
349
+ const p = t.activeDialog || "";
350
+ (f = e == null ? void 0 : e.trackDialogEnter) == null || f.call(e, g, p, g);
351
+ const v = c({ path: g, open: !0, attrs: P });
352
+ return u(() => {
316
353
  i = !1;
317
- }, 300), A;
318
- } catch (f) {
319
- throw i = !1, f;
354
+ }, 300), v;
355
+ } catch (p) {
356
+ throw i = !1, p;
320
357
  }
321
358
  }
322
- function m(g) {
323
- var y;
324
- (y = e == null ? void 0 : e.trackDialogLeave) == null || y.call(e, g, g, ""), t.dialogAttrs.delete(g), u({ path: g, open: !1 });
359
+ function d(g) {
360
+ var P;
361
+ (P = e == null ? void 0 : e.trackDialogLeave) == null || P.call(e, g, g, ""), t.dialogAttrs.delete(g), c({ path: g, open: !1 });
325
362
  }
326
363
  function R() {
327
- const g = [], y = [];
364
+ const g = [], P = [];
328
365
  t.dialogs.forEach((s, f) => {
329
- var A, d;
366
+ var p, v;
330
367
  if (s.activated) {
331
- (A = e == null ? void 0 : e.trackDialogLeave) == null || A.call(e, f, f, "");
332
- const P = (d = s.attrs) == null ? void 0 : d.onClose;
333
- typeof P == "function" && y.push(P), t.dialogs.set(f, {
368
+ (p = e == null ? void 0 : e.trackDialogLeave) == null || p.call(e, f, f, "");
369
+ const A = (v = s.attrs) == null ? void 0 : v.onClose;
370
+ typeof A == "function" && P.push(A), t.dialogs.set(f, {
334
371
  ...s,
335
372
  activated: !1,
336
373
  closing: !0,
337
374
  attrs: void 0
338
375
  }), g.push(f);
339
376
  }
340
- }), y.forEach((s) => s()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], c(() => {
377
+ }), P.forEach((s) => s()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], u(() => {
341
378
  g.forEach((s) => {
342
379
  const f = t.dialogs.get(s);
343
380
  f && !f.activated && t.dialogs.set(s, { ...f, closing: !1 });
344
381
  });
345
382
  }, 500);
346
383
  }
347
- function L(g) {
384
+ function T(g) {
348
385
  t.dialogs.has(g.path) && console.warn(`[vue-micro-router] Dialog "${g.path}" already registered. Overwriting.`);
349
- let { component: y } = g;
350
- De(y) && (y = me(y)), t.dialogs.set(g.path, {
386
+ let { component: P } = g;
387
+ Ee(P) && (P = Pe(P)), t.dialogs.set(g.path, {
351
388
  persistent: !0,
352
389
  ...g,
353
- component: Ae(y)
390
+ component: Se(P)
354
391
  });
355
392
  }
356
393
  function M(g) {
357
- g.forEach(L);
394
+ g.forEach(T);
358
395
  }
359
- function T(g) {
396
+ function L(g) {
360
397
  return t.dialogAttrs.get(g);
361
398
  }
362
- function I(g, y) {
399
+ function _(g, P) {
363
400
  const s = t.dialogAttrs.get(g);
364
- t.dialogAttrs.set(g, { ...s, ...y });
401
+ t.dialogAttrs.set(g, { ...s, ...P });
365
402
  }
366
403
  return {
367
404
  activeDialog: C(() => t.activeDialog),
@@ -369,22 +406,22 @@ function je(e) {
369
406
  toDialog: C(() => t.toDialog),
370
407
  resolveDialogs: l,
371
408
  openDialog: a,
372
- closeDialog: m,
409
+ closeDialog: d,
373
410
  closeAllDialogs: R,
374
- registerDialog: L,
411
+ registerDialog: T,
375
412
  registerDialogs: M,
376
- getDialogAttrs: T,
377
- updateDialogAttrs: I,
378
- cleanup: n.cleanup
413
+ getDialogAttrs: L,
414
+ updateDialogAttrs: _,
415
+ cleanup: o.cleanup
379
416
  };
380
417
  }
381
- const _e = 5e3;
382
- async function ve(e, o, n, i) {
418
+ const Ke = 5e3;
419
+ async function ye(e, n, o, i) {
383
420
  let t;
384
421
  try {
385
422
  const l = await Promise.race([
386
- Promise.resolve(e(o, n)),
387
- new Promise((c, r) => {
423
+ Promise.resolve(e(n, o)),
424
+ new Promise((u, r) => {
388
425
  t = setTimeout(() => r(new Error("Navigation guard timed out")), i);
389
426
  })
390
427
  ]);
@@ -393,135 +430,135 @@ async function ve(e, o, n, i) {
393
430
  return clearTimeout(t), !1;
394
431
  }
395
432
  }
396
- async function He(e, o, n, i = _e) {
433
+ async function at(e, n, o, i = Ke) {
397
434
  for (const t of e)
398
- if (!await ve(t, o, n, i)) return !1;
435
+ if (!await ye(t, n, o, i)) return !1;
399
436
  return !0;
400
437
  }
401
- async function Se(e, o, n, i) {
438
+ async function _e(e, n, o, i) {
402
439
  var r;
403
- const t = n.guardTimeout ?? _e;
404
- if ((r = n.beforeEach) != null && r.length && !await He(n.beforeEach, e, o, t))
440
+ const t = o.guardTimeout ?? Ke;
441
+ if ((r = o.beforeEach) != null && r.length && !await at(o.beforeEach, e, n, t))
405
442
  return !1;
406
443
  const l = H(e);
407
444
  if (l) {
408
- const u = i.getRoute(l);
409
- if (u != null && u.beforeEnter && !await ve(u.beforeEnter, e, o, t))
445
+ const c = i.getRoute(l);
446
+ if (c != null && c.beforeEnter && !await ye(c.beforeEnter, e, n, t))
410
447
  return !1;
411
448
  }
412
- const c = H(o);
413
- if (c) {
414
- const u = i.getRoute(c);
415
- if (u != null && u.beforeLeave && !await ve(u.beforeLeave, e, o, t))
449
+ const u = H(n);
450
+ if (u) {
451
+ const c = i.getRoute(u);
452
+ if (c != null && c.beforeLeave && !await ye(c.beforeLeave, e, n, t))
416
453
  return !1;
417
454
  }
418
455
  return !0;
419
456
  }
420
- function qe(e, o, n) {
421
- if (n != null && n.length)
422
- for (const i of n)
457
+ function it(e, n, o) {
458
+ if (o != null && o.length)
459
+ for (const i of o)
423
460
  try {
424
- i(e, o);
461
+ i(e, n);
425
462
  } catch {
426
463
  }
427
464
  }
428
- function Je(e, o) {
429
- const n = e.maxEntries ?? 50, i = [];
465
+ function st(e, n) {
466
+ const o = e.maxEntries ?? 50, i = [];
430
467
  let t = -1, l = !1;
431
- const c = ee(0);
432
- function r(g, y) {
433
- !e.enabled || l || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: y ? { ...y } : void 0 }), t = i.length - 1, i.length > n && (i.shift(), t--), c.value++);
468
+ const u = ne(0);
469
+ function r(g, P) {
470
+ !e.enabled || l || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: P ? { ...P } : void 0 }), t = i.length - 1, i.length > o && (i.shift(), t--), u.value++);
434
471
  }
435
- const u = C(() => (c.value, [...i])), a = C(() => (c.value, t > 0)), m = C(() => (c.value, t < i.length - 1));
472
+ const c = C(() => (u.value, [...i])), a = C(() => (u.value, t > 0)), d = C(() => (u.value, t < i.length - 1));
436
473
  async function R(g) {
437
474
  if (g < 0 || g >= i.length) return;
438
- const y = i[g];
439
- if (y) {
440
- t = g, l = !0, c.value++;
475
+ const P = i[g];
476
+ if (P) {
477
+ t = g, l = !0, u.value++;
441
478
  try {
442
- await o(y.path);
479
+ await n(P.path);
443
480
  } finally {
444
481
  l = !1;
445
482
  }
446
483
  }
447
484
  }
448
- async function L() {
485
+ async function T() {
449
486
  a.value && await R(t - 1);
450
487
  }
451
488
  async function M() {
452
- m.value && await R(t + 1);
489
+ d.value && await R(t + 1);
453
490
  }
454
- async function T(g) {
455
- const y = t + g;
456
- await R(y);
491
+ async function L(g) {
492
+ const P = t + g;
493
+ await R(P);
457
494
  }
458
- function I() {
459
- i.length = 0, t = -1, c.value++;
495
+ function _() {
496
+ i.length = 0, t = -1, u.value++;
460
497
  }
461
- return { entries: u, canGoBack: a, canGoForward: m, back: L, forward: M, go: T, clear: I, record: r };
498
+ return { entries: c, canGoBack: a, canGoForward: d, back: T, forward: M, go: L, clear: _, record: r };
462
499
  }
463
- function Qe() {
464
- const e = U(/* @__PURE__ */ new Map()), o = /* @__PURE__ */ new Map();
465
- function n(c) {
466
- e.has(c.path) && console.warn(`[vue-micro-router] Route "${c.path}" already registered. Overwriting.`);
467
- let { component: r } = c;
468
- De(r) && (o.set(c.path, r), r = me(r)), e.set(c.path, {
469
- ...c,
470
- component: Ae(r)
471
- }), c.preload === "eager" && o.has(c.path) && ne(o.get(c.path));
500
+ function rt() {
501
+ const e = F(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Map();
502
+ function o(u) {
503
+ e.has(u.path) && console.warn(`[vue-micro-router] Route "${u.path}" already registered. Overwriting.`);
504
+ let { component: r } = u;
505
+ Ee(r) && (n.set(u.path, r), r = Pe(r)), e.set(u.path, {
506
+ ...u,
507
+ component: Se(r)
508
+ }), u.preload === "eager" && n.has(u.path) && ae(n.get(u.path));
472
509
  }
473
- function i(c) {
474
- c.forEach(n);
510
+ function i(u) {
511
+ u.forEach(o);
475
512
  }
476
- async function t(c) {
477
- const r = o.get(c);
478
- r && await ne(r);
513
+ async function t(u) {
514
+ const r = n.get(u);
515
+ r && await ae(r);
479
516
  }
480
- function l(c) {
481
- for (const [r, u] of e.entries())
482
- if (u.preload === "adjacent" && !c.includes(r)) {
483
- const a = o.get(r);
484
- a && ne(a);
517
+ function l(u) {
518
+ for (const [r, c] of e.entries())
519
+ if (c.preload === "adjacent" && !u.includes(r)) {
520
+ const a = n.get(r);
521
+ a && ae(a);
485
522
  }
486
523
  }
487
- return { routes: e, asyncLoaders: o, registerRoute: n, registerRoutes: i, preloadRoute: t, preloadAdjacent: l };
524
+ return { routes: e, asyncLoaders: n, registerRoute: o, registerRoutes: i, preloadRoute: t, preloadAdjacent: l };
488
525
  }
489
- function Ze(e) {
490
- const o = e.stepWiseDelay ?? Math.max(e.stepDelay * 1.2, e.stepDelay + 100);
491
- async function n(t, l) {
526
+ function lt(e) {
527
+ const n = e.stepWiseDelay ?? Math.max(e.stepDelay * 1.2, e.stepDelay + 100);
528
+ async function o(t, l) {
492
529
  if (!t || e.isLocked()) return;
493
- const c = W(t);
494
- if (e.getActivePath() !== c) {
530
+ const u = $(t);
531
+ if (e.getActivePath() !== u) {
495
532
  e.lock();
496
533
  try {
497
534
  if (e.runGuards) {
498
- const a = W(e.getActivePath());
499
- if (!await e.runGuards(c, a)) {
535
+ const a = $(e.getActivePath());
536
+ if (!await e.runGuards(u, a)) {
500
537
  e.unlock();
501
538
  return;
502
539
  }
503
540
  }
504
- const r = _(e.getActivePath()), u = _(c);
541
+ const r = I(e.getActivePath()), c = I(u);
505
542
  if (t.startsWith("/"))
506
- for (let a = 0; a < u.length; a++) {
507
- const m = K(
508
- u.slice(0, a + 1)
543
+ for (let a = 0; a < c.length; a++) {
544
+ const d = W(
545
+ c.slice(0, a + 1)
509
546
  );
510
- if (e.getActivePath() === m) continue;
511
- const R = a === u.length - 1;
512
- await e.pushCore(m, R ? l : void 0), R || await fe(o);
547
+ if (e.getActivePath() === d) continue;
548
+ const R = a === c.length - 1;
549
+ await e.pushCore(d, R ? l : void 0), R || await de(n);
513
550
  }
514
551
  else {
515
- const a = u.filter(
516
- (m) => !r.includes(m)
552
+ const a = c.filter(
553
+ (d) => !r.includes(d)
517
554
  );
518
555
  if (a.length === 0) {
519
556
  await e.pushCore(t, l), e.scheduleUnlock();
520
557
  return;
521
558
  }
522
- for (let m = 0; m < a.length; m++) {
523
- const R = m === a.length - 1;
524
- await e.pushCore(a[m], R ? l : void 0), R || await fe(o);
559
+ for (let d = 0; d < a.length; d++) {
560
+ const R = d === a.length - 1;
561
+ await e.pushCore(a[d], R ? l : void 0), R || await de(n);
525
562
  }
526
563
  }
527
564
  e.scheduleUnlock();
@@ -532,200 +569,200 @@ function Ze(e) {
532
569
  }
533
570
  async function i(t) {
534
571
  if (t < 1 || e.isLocked()) return;
535
- const l = _(e.getActivePath()), c = Math.min(t, l.length - 1);
536
- if (!(c < 1)) {
572
+ const l = I(e.getActivePath()), u = Math.min(t, l.length - 1);
573
+ if (!(u < 1)) {
537
574
  e.lock();
538
575
  try {
539
576
  if (e.runGuards) {
540
- const r = l.slice(0, l.length - c), u = K(r), a = W(e.getActivePath());
541
- if (!await e.runGuards(u, a)) {
577
+ const r = l.slice(0, l.length - u), c = W(r), a = $(e.getActivePath());
578
+ if (!await e.runGuards(c, a)) {
542
579
  e.unlock();
543
580
  return;
544
581
  }
545
582
  }
546
- for (let r = 0; r < c; r++)
547
- await e.pushCore(-1), r < c - 1 && await fe(o);
583
+ for (let r = 0; r < u; r++)
584
+ await e.pushCore(-1), r < u - 1 && await de(n);
548
585
  e.scheduleUnlock();
549
586
  } catch (r) {
550
587
  throw e.unlock(), r;
551
588
  }
552
589
  }
553
590
  }
554
- return { stepWisePush: n, stepWiseBack: i };
591
+ return { stepWisePush: o, stepWiseBack: i };
555
592
  }
556
- function ke(e, o) {
557
- const n = e.defaultPath, i = e.stepDelay ?? Ue, t = e.guards ?? {}, l = e.history ?? {}, c = Ce(), r = Qe(), u = ee(!1), a = pe({
558
- activePath: n,
559
- fromPath: n,
560
- toPath: n,
593
+ function ut(e, n) {
594
+ const o = e.defaultPath, i = e.stepDelay ?? ze, t = e.guards ?? {}, l = e.history ?? {}, u = be(), r = rt(), c = ne(!1), a = we({
595
+ activePath: o,
596
+ fromPath: o,
597
+ toPath: o,
561
598
  /** Attrs stored separately — changes here do NOT invalidate resolveRoutes computed */
562
- routeAttrs: U(/* @__PURE__ */ new Map()),
599
+ routeAttrs: F(/* @__PURE__ */ new Map()),
563
600
  /** Version stamp per segment — incremented on re-navigation to same segment (forces transition) */
564
- routeKeys: U(/* @__PURE__ */ new Map()),
601
+ routeKeys: F(/* @__PURE__ */ new Map()),
565
602
  /** Component key per segment — incremented to force Vue full remount (resets local state) */
566
- componentKeys: U(/* @__PURE__ */ new Map())
567
- }), m = /* @__PURE__ */ new Map(), R = C(() => {
568
- const p = _(a.activePath), h = [];
569
- for (const v of p) {
570
- const D = r.routes.get(v);
603
+ componentKeys: F(/* @__PURE__ */ new Map())
604
+ }), d = /* @__PURE__ */ new Map(), R = C(() => {
605
+ const y = I(a.activePath), h = [];
606
+ for (const m of y) {
607
+ const D = r.routes.get(m);
571
608
  if (!D) continue;
572
- const w = a.routeKeys.get(v) || 0, S = a.componentKeys.get(v) || 0, b = `${D.path}-${w}`, E = m.get(v);
573
- if (E && E.key === b && E.componentKey === S)
609
+ const w = a.routeKeys.get(m) || 0, b = a.componentKeys.get(m) || 0, S = `${D.path}-${w}`, E = d.get(m);
610
+ if (E && E.key === S && E.componentKey === b)
574
611
  h.push(E);
575
612
  else {
576
- const O = { ...D, key: b, componentKey: S };
577
- m.set(v, O), h.push(O);
613
+ const K = { ...D, key: S, componentKey: b };
614
+ d.set(m, K), h.push(K);
578
615
  }
579
616
  }
580
- for (const v of m.keys())
581
- p.includes(v) || m.delete(v);
617
+ for (const m of d.keys())
618
+ y.includes(m) || d.delete(m);
582
619
  return h;
583
620
  });
584
- function L(p, h) {
585
- var O, G;
586
- const v = _(a.activePath), D = Math.min(p, v.length - 1);
621
+ function T(y, h) {
622
+ var K, N;
623
+ const m = I(a.activePath), D = Math.min(y, m.length - 1);
587
624
  if (D <= 0) return;
588
- const w = v.slice(0, -D), S = K(w);
589
- for (let $ = v.length - D; $ < v.length; $++)
590
- a.routeAttrs.delete(v[$]);
591
- const b = w.at(-1);
592
- if (b && h) {
593
- const $ = a.routeAttrs.get(b);
594
- a.routeAttrs.set(b, { ...$, ...h }), a.componentKeys.set(
595
- b,
596
- (a.componentKeys.get(b) || 0) + 1
625
+ const w = m.slice(0, -D), b = W(w);
626
+ for (let U = m.length - D; U < m.length; U++)
627
+ a.routeAttrs.delete(m[U]);
628
+ const S = w.at(-1);
629
+ if (S && h) {
630
+ const U = a.routeAttrs.get(S);
631
+ a.routeAttrs.set(S, { ...U, ...h }), a.componentKeys.set(
632
+ S,
633
+ (a.componentKeys.get(S) || 0) + 1
597
634
  );
598
635
  }
599
636
  const E = a.activePath;
600
- (O = o == null ? void 0 : o.trackPageLeave) == null || O.call(o, E, E, S), a.fromPath = E, a.toPath = S, a.activePath = S, (G = o == null ? void 0 : o.trackPageEnter) == null || G.call(o, S, E, S);
637
+ (K = n == null ? void 0 : n.trackPageLeave) == null || K.call(n, E, E, b), a.fromPath = E, a.toPath = b, a.activePath = b, (N = n == null ? void 0 : n.trackPageEnter) == null || N.call(n, b, E, b);
601
638
  }
602
- async function M(p, h) {
603
- var S, b;
604
- const v = W(p), D = _(v);
639
+ async function M(y, h) {
640
+ var b, S;
641
+ const m = $(y), D = I(m);
605
642
  await Promise.all(
606
- D.map((E) => r.asyncLoaders.get(E)).filter((E) => !!E).map((E) => ne(E))
643
+ D.map((E) => r.asyncLoaders.get(E)).filter((E) => !!E).map((E) => ae(E))
607
644
  );
608
645
  const w = a.activePath;
609
- w !== v && ((S = o == null ? void 0 : o.trackPageLeave) == null || S.call(o, w, w, v)), a.fromPath = w, a.toPath = v, a.activePath = v, h && T(v, h), (b = o == null ? void 0 : o.trackPageEnter) == null || b.call(o, v, w, v);
646
+ w !== m && ((b = n == null ? void 0 : n.trackPageLeave) == null || b.call(n, w, w, m)), a.fromPath = w, a.toPath = m, a.activePath = m, h && L(m, h), (S = n == null ? void 0 : n.trackPageEnter) == null || S.call(n, m, w, m);
610
647
  }
611
- function T(p, h) {
612
- const v = _(p).at(-1);
613
- if (!v) return;
614
- const D = a.routeAttrs.get(v);
615
- a.routeAttrs.set(v, { ...D, ...h });
648
+ function L(y, h) {
649
+ const m = I(y).at(-1);
650
+ if (!m) return;
651
+ const D = a.routeAttrs.get(m);
652
+ a.routeAttrs.set(m, { ...D, ...h });
616
653
  }
617
- function I(p, h) {
618
- const v = a.routeAttrs.get(p);
619
- a.routeAttrs.set(p, { ...v, ...h });
654
+ function _(y, h) {
655
+ const m = a.routeAttrs.get(y);
656
+ a.routeAttrs.set(y, { ...m, ...h });
620
657
  }
621
- function g(p) {
622
- return a.routeAttrs.get(p);
658
+ function g(y) {
659
+ return a.routeAttrs.get(y);
623
660
  }
624
- async function y(p, h) {
625
- if (!p && p !== 0) return;
626
- if (typeof p == "number" && p < 0) {
627
- L(Math.abs(p), h);
661
+ async function P(y, h) {
662
+ if (!y && y !== 0) return;
663
+ if (typeof y == "number" && y < 0) {
664
+ T(Math.abs(y), h);
628
665
  return;
629
666
  }
630
- const v = p.toString();
631
- if (v.startsWith("/")) {
632
- const b = _(v), E = _(a.activePath);
633
- if (b.length < E.length && b.every(($, se) => E[se] === $)) {
634
- if (E.length - b.length === 1)
635
- L(1, h);
667
+ const m = y.toString();
668
+ if (m.startsWith("/")) {
669
+ const S = I(m), E = I(a.activePath);
670
+ if (S.length < E.length && S.every((U, le) => E[le] === U)) {
671
+ if (E.length - S.length === 1)
672
+ T(1, h);
636
673
  else {
637
- const se = E.slice(0, b.length + 1), Ne = K(se);
638
- for (let re = b.length + 1; re < E.length; re++)
639
- a.routeAttrs.delete(E[re]);
640
- a.activePath = Ne, await k(), L(1, h);
674
+ const le = E.slice(0, S.length + 1), $e = W(le);
675
+ for (let ue = S.length + 1; ue < E.length; ue++)
676
+ a.routeAttrs.delete(E[ue]);
677
+ a.activePath = $e, await te(), T(1, h);
641
678
  }
642
679
  return;
643
680
  }
644
- const G = b.at(-1);
645
- G && E.at(-1) === G && a.routeKeys.set(
646
- G,
647
- (a.routeKeys.get(G) || 0) + 1
648
- ), await M(v, h);
681
+ const N = S.at(-1);
682
+ N && E.at(-1) === N && a.routeKeys.set(
683
+ N,
684
+ (a.routeKeys.get(N) || 0) + 1
685
+ ), await M(m, h);
649
686
  return;
650
687
  }
651
- const D = _(a.activePath), w = D.indexOf(v);
688
+ const D = I(a.activePath), w = D.indexOf(m);
652
689
  if (w !== -1) {
653
- const b = D.length - (w + 1);
654
- if (b === 1)
655
- L(1, h);
656
- else if (b > 1) {
657
- const E = D.slice(0, w + 2), O = K(E);
658
- for (let G = w + 2; G < D.length; G++)
659
- a.routeAttrs.delete(D[G]);
660
- a.activePath = O, await k(), L(1, h);
690
+ const S = D.length - (w + 1);
691
+ if (S === 1)
692
+ T(1, h);
693
+ else if (S > 1) {
694
+ const E = D.slice(0, w + 2), K = W(E);
695
+ for (let N = w + 2; N < D.length; N++)
696
+ a.routeAttrs.delete(D[N]);
697
+ a.activePath = K, await te(), T(1, h);
661
698
  } else
662
- a.routeKeys.set(v, (a.routeKeys.get(v) || 0) + 1), await M(
663
- K(D.slice(0, w + 1)),
699
+ a.routeKeys.set(m, (a.routeKeys.get(m) || 0) + 1), await M(
700
+ W(D.slice(0, w + 1)),
664
701
  h
665
702
  );
666
703
  return;
667
704
  }
668
- const S = K([...D, v]);
669
- await M(S, h);
705
+ const b = W([...D, m]);
706
+ await M(b, h);
670
707
  }
671
- function s(p) {
672
- if (typeof p == "number" && p < 0) {
673
- const w = _(a.activePath), S = Math.min(Math.abs(p), w.length - 1);
674
- return S <= 0 ? a.activePath : K(w.slice(0, -S));
708
+ function s(y) {
709
+ if (typeof y == "number" && y < 0) {
710
+ const w = I(a.activePath), b = Math.min(Math.abs(y), w.length - 1);
711
+ return b <= 0 ? a.activePath : W(w.slice(0, -b));
675
712
  }
676
- const h = p.toString();
677
- if (h.startsWith("/")) return W(h);
678
- const v = _(a.activePath), D = v.indexOf(h);
679
- return D !== -1 ? K(v.slice(0, D + 1)) : K([...v, h]);
713
+ const h = y.toString();
714
+ if (h.startsWith("/")) return $(h);
715
+ const m = I(a.activePath), D = m.indexOf(h);
716
+ return D !== -1 ? W(m.slice(0, D + 1)) : W([...m, h]);
680
717
  }
681
- const f = { getRoute: (p) => r.routes.get(p) };
682
- async function A(p, h) {
683
- var v;
684
- if (!u.value) {
685
- u.value = !0;
718
+ const f = { getRoute: (y) => r.routes.get(y) };
719
+ async function p(y, h) {
720
+ var m;
721
+ if (!c.value) {
722
+ c.value = !0;
686
723
  try {
687
- const D = (((v = t.beforeEach) == null ? void 0 : v.length) ?? 0) > 0, w = r.routes.size > 0;
688
- if ((D || w) && p) {
689
- const E = s(p), O = W(a.activePath);
690
- if (!await Se(E, O, t, f)) {
691
- u.value = !1;
724
+ const D = (((m = t.beforeEach) == null ? void 0 : m.length) ?? 0) > 0, w = r.routes.size > 0;
725
+ if ((D || w) && y) {
726
+ const E = s(y), K = $(a.activePath);
727
+ if (!await _e(E, K, t, f)) {
728
+ c.value = !1;
692
729
  return;
693
730
  }
694
731
  }
695
- const S = W(a.activePath);
696
- await y(p, h);
697
- const b = W(a.activePath);
698
- d == null || d.record(b, h), qe(b, S, t.afterEach), r.preloadAdjacent(_(a.activePath)), c.schedule(() => {
699
- u.value = !1;
732
+ const b = $(a.activePath);
733
+ await P(y, h);
734
+ const S = $(a.activePath);
735
+ v == null || v.record(S, h), it(S, b, t.afterEach), r.preloadAdjacent(I(a.activePath)), u.schedule(() => {
736
+ c.value = !1;
700
737
  }, i);
701
738
  } catch (D) {
702
- throw u.value = !1, D;
739
+ throw c.value = !1, D;
703
740
  }
704
741
  }
705
742
  }
706
- const d = l.enabled ? Je(l, async (p) => {
707
- const h = _(a.activePath), v = _(p);
708
- if (v.length < h.length && v.every((w, S) => h[S] === w)) {
709
- const w = h.length - v.length;
710
- await A(-w);
743
+ const v = l.enabled ? st(l, async (y) => {
744
+ const h = I(a.activePath), m = I(y);
745
+ if (m.length < h.length && m.every((w, b) => h[b] === w)) {
746
+ const w = h.length - m.length;
747
+ await p(-w);
711
748
  } else
712
- await A(p);
749
+ await p(y);
713
750
  }) : void 0;
714
- d && d.record(W(n));
715
- const P = Ze({
751
+ v && v.record($(o));
752
+ const A = lt({
716
753
  getActivePath: () => a.activePath,
717
- pushCore: y,
718
- runGuards: (p, h) => Se(p, h, t, f),
719
- scheduleUnlock: () => c.schedule(() => {
720
- u.value = !1;
754
+ pushCore: P,
755
+ runGuards: (y, h) => _e(y, h, t, f),
756
+ scheduleUnlock: () => u.schedule(() => {
757
+ c.value = !1;
721
758
  }, i),
722
759
  lock: () => {
723
- u.value = !0;
760
+ c.value = !0;
724
761
  },
725
762
  unlock: () => {
726
- u.value = !1;
763
+ c.value = !1;
727
764
  },
728
- isLocked: () => u.value,
765
+ isLocked: () => c.value,
729
766
  stepDelay: i
730
767
  });
731
768
  return {
@@ -735,83 +772,83 @@ function ke(e, o) {
735
772
  activePage: C(() => H(a.activePath)),
736
773
  fromPage: C(() => H(a.fromPath)),
737
774
  toPage: C(() => H(a.toPath)),
738
- isNavigating: C(() => u.value),
775
+ isNavigating: C(() => c.value),
739
776
  resolveRoutes: R,
740
- push: A,
741
- stepWisePush: P.stepWisePush,
742
- stepWiseBack: P.stepWiseBack,
777
+ push: p,
778
+ stepWisePush: A.stepWisePush,
779
+ stepWiseBack: A.stepWiseBack,
743
780
  registerRoute: r.registerRoute,
744
781
  registerRoutes: r.registerRoutes,
745
- updateRouteAttrs: I,
782
+ updateRouteAttrs: _,
746
783
  getRouteAttrs: g,
747
784
  preloadRoute: r.preloadRoute,
748
785
  routes: r.routes,
749
- history: d,
750
- cleanup: c.cleanup
786
+ history: v,
787
+ cleanup: u.cleanup
751
788
  };
752
789
  }
753
- const F = () => {
790
+ const x = () => {
754
791
  };
755
- function et(e) {
792
+ function ct(e) {
756
793
  return {
757
- trackPageEnter: (e == null ? void 0 : e.trackPageEnter) ?? F,
758
- trackPageLeave: (e == null ? void 0 : e.trackPageLeave) ?? F,
759
- trackDialogEnter: (e == null ? void 0 : e.trackDialogEnter) ?? F,
760
- trackDialogLeave: (e == null ? void 0 : e.trackDialogLeave) ?? F,
761
- trackGuiEnter: (e == null ? void 0 : e.trackGuiEnter) ?? F,
762
- trackGuiLeave: (e == null ? void 0 : e.trackGuiLeave) ?? F,
763
- cleanupAllSessions: (e == null ? void 0 : e.cleanupAllSessions) ?? F
794
+ trackPageEnter: (e == null ? void 0 : e.trackPageEnter) ?? x,
795
+ trackPageLeave: (e == null ? void 0 : e.trackPageLeave) ?? x,
796
+ trackDialogEnter: (e == null ? void 0 : e.trackDialogEnter) ?? x,
797
+ trackDialogLeave: (e == null ? void 0 : e.trackDialogLeave) ?? x,
798
+ trackGuiEnter: (e == null ? void 0 : e.trackGuiEnter) ?? x,
799
+ trackGuiLeave: (e == null ? void 0 : e.trackGuiLeave) ?? x,
800
+ cleanupAllSessions: (e == null ? void 0 : e.cleanupAllSessions) ?? x
764
801
  };
765
802
  }
766
- function tt(e) {
767
- const o = et(e.tracker), n = ke(
803
+ function ft(e) {
804
+ const n = ct(e.tracker), o = ut(
768
805
  {
769
806
  defaultPath: e.defaultPath,
770
807
  stepDelay: e.stepDelay,
771
808
  guards: e.guards,
772
809
  history: e.history
773
810
  },
774
- o
775
- ), i = je(o), t = Xe(
811
+ n
812
+ ), i = ot(n), t = Ve(
776
813
  {
777
814
  defaultControlName: e.defaultControlName,
778
815
  onboardingControlName: e.onboardingControlName
779
816
  },
780
- o
781
- ), l = e.volumeRef ? Ye({
817
+ n
818
+ ), l = e.volumeRef ? xe({
782
819
  volumeRef: e.volumeRef,
783
820
  defaultBgm: e.defaultBgm
784
- }) : null, c = {
821
+ }) : null, u = {
785
822
  // Navigation
786
- activePath: n.activePath,
787
- fromPath: n.fromPath,
788
- toPath: n.toPath,
789
- activePage: n.activePage,
790
- fromPage: n.fromPage,
791
- toPage: n.toPage,
792
- isNavigating: n.isNavigating,
793
- resolveRoutes: n.resolveRoutes,
794
- push: async (a, m) => {
795
- await n.push(a, m), l && l.updateBackgroundMusic(n.activePath.value, n.routes);
823
+ activePath: o.activePath,
824
+ fromPath: o.fromPath,
825
+ toPath: o.toPath,
826
+ activePage: o.activePage,
827
+ fromPage: o.fromPage,
828
+ toPage: o.toPage,
829
+ isNavigating: o.isNavigating,
830
+ resolveRoutes: o.resolveRoutes,
831
+ push: async (a, d) => {
832
+ await o.push(a, d), l && l.updateBackgroundMusic(o.activePath.value, o.routes);
796
833
  },
797
- stepWisePush: async (a, m) => {
798
- await n.stepWisePush(a, m), l && l.updateBackgroundMusic(n.activePath.value, n.routes);
834
+ stepWisePush: async (a, d) => {
835
+ await o.stepWisePush(a, d), l && l.updateBackgroundMusic(o.activePath.value, o.routes);
799
836
  },
800
837
  stepWiseBack: async (a) => {
801
- await n.stepWiseBack(a), l && l.updateBackgroundMusic(n.activePath.value, n.routes);
838
+ await o.stepWiseBack(a), l && l.updateBackgroundMusic(o.activePath.value, o.routes);
802
839
  },
803
- registerRoute: n.registerRoute,
804
- registerRoutes: n.registerRoutes,
805
- updateRouteAttrs: n.updateRouteAttrs,
806
- getRouteAttrs: n.getRouteAttrs,
807
- preloadRoute: n.preloadRoute,
840
+ registerRoute: o.registerRoute,
841
+ registerRoutes: o.registerRoutes,
842
+ updateRouteAttrs: o.updateRouteAttrs,
843
+ getRouteAttrs: o.getRouteAttrs,
844
+ preloadRoute: o.preloadRoute,
808
845
  // History (conditional — only if enabled)
809
- ...n.history ? {
810
- canGoBack: n.history.canGoBack,
811
- canGoForward: n.history.canGoForward,
812
- historyBack: n.history.back,
813
- historyForward: n.history.forward,
814
- historyGo: n.history.go
846
+ ...o.history ? {
847
+ canGoBack: o.history.canGoBack,
848
+ canGoForward: o.history.canGoForward,
849
+ historyBack: o.history.back,
850
+ historyForward: o.history.forward,
851
+ historyGo: o.history.go
815
852
  } : {},
816
853
  // Dialogs
817
854
  activeDialog: i.activeDialog,
@@ -835,8 +872,8 @@ function tt(e) {
835
872
  getControlAttrs: t.getControlAttrs,
836
873
  updateControlAttrs: t.updateControlAttrs,
837
874
  // Serialization
838
- serialize: () => Ve(c),
839
- restore: (a) => xe(c, a),
875
+ serialize: () => He(u),
876
+ restore: (a) => Je(u, a),
840
877
  // Audio (conditional — only if volumeRef provided in config)
841
878
  ...l ? {
842
879
  playSound: l.playSound,
@@ -846,117 +883,117 @@ function tt(e) {
846
883
  updateBackgroundMusic: l.updateBackgroundMusic
847
884
  } : {}
848
885
  }, r = H(e.defaultPath);
849
- return X(n.activePage, (a, m) => {
850
- if (!m) return;
886
+ return X(o.activePage, (a, d) => {
887
+ if (!d) return;
851
888
  const R = t.currentControl.value;
852
- m === r && a !== r && o.trackGuiLeave(R), a === r && m !== r && o.trackGuiEnter(R);
889
+ d === r && a !== r && n.trackGuiLeave(R), a === r && d !== r && n.trackGuiEnter(R);
853
890
  }), l && e.defaultBgm && e.bgmStartRef && X(e.bgmStartRef, (a) => {
854
891
  a && !l.isStarted() && l.playSoundSync(e.defaultBgm, !0);
855
- }, { flush: "sync" }), q(async () => {
856
- await k(), t.toggleControl(e.defaultControlName, !0), o.trackPageEnter(
857
- n.activePath.value,
892
+ }, { flush: "sync" }), Q(async () => {
893
+ await te(), t.toggleControl(e.defaultControlName, !0), n.trackPageEnter(
894
+ o.activePath.value,
858
895
  void 0,
859
- n.activePath.value
860
- ), l && document.addEventListener("visibilitychange", l.handleVisibilityChange), ze(c);
861
- }), he(() => {
862
- o.cleanupAllSessions(), n.cleanup(), i.cleanup(), t.cleanup(), l && (document.removeEventListener("visibilitychange", l.handleVisibilityChange), l.cleanup());
863
- }), N(Me, c), V(de, null) || N(de, c), c;
896
+ o.activePath.value
897
+ ), l && document.addEventListener("visibilitychange", l.handleVisibilityChange), qe(u);
898
+ }), De(() => {
899
+ n.cleanupAllSessions(), o.cleanup(), i.cleanup(), t.cleanup(), l && (document.removeEventListener("visibilitychange", l.handleVisibilityChange), l.cleanup());
900
+ }), O(Be, u), V(me, null) || O(me, u), u;
864
901
  }
865
- function J(e) {
866
- const o = e != null && e.root ? de : Me, n = V(o);
867
- if (!n)
902
+ function Z(e) {
903
+ const n = e != null && e.root ? me : Be, o = V(n);
904
+ if (!o)
868
905
  throw new Error(
869
906
  e != null && e.root ? "[vue-micro-router] useMicroRouter({ root: true }) failed — no root <MicroRouterView> found." : "[vue-micro-router] useMicroRouter() must be called inside <MicroRouterView>. Did you forget to wrap your app with <MicroRouterView>?"
870
907
  );
871
- return n;
908
+ return o;
872
909
  }
873
- function yt(e) {
874
- const o = V(ae), n = V(ie);
875
- !o && !e && console.warn(
910
+ function St(e) {
911
+ const n = V(se), o = V(re);
912
+ !n && !e && console.warn(
876
913
  "[vue-micro-router] useMicroState() called without provider and no defaults. Ensure component is inside <RoutePage>, <MicroDialog>, or <MicroControlWrapper>."
877
914
  );
878
- const i = (o == null ? void 0 : o()) ?? {}, t = e ? { ...e } : {};
915
+ const i = (n == null ? void 0 : n()) ?? {}, t = e ? { ...e } : {};
879
916
  for (const r of Object.keys(i))
880
917
  t[r] = i[r];
881
- const l = pe(t);
882
- n && X(
918
+ const l = we(t);
919
+ o && X(
883
920
  l,
884
- (r) => n({ ...r }),
921
+ (r) => o({ ...r }),
885
922
  { deep: !0, flush: "post" }
886
923
  );
887
- const c = Oe(l);
888
- return new Proxy(c, {
889
- get(r, u, a) {
890
- return typeof u == "string" && !(u in r) && (r[u] = Ke(l, u)), Reflect.get(r, u, a);
924
+ const u = Ue(l);
925
+ return new Proxy(u, {
926
+ get(r, c, a) {
927
+ return typeof c == "string" && !(c in r) && (r[c] = Ye(l, c)), Reflect.get(r, c, a);
891
928
  }
892
929
  });
893
930
  }
894
- function Pt(e) {
895
- const o = V(Le);
896
- if (!o) {
931
+ function bt(e) {
932
+ const n = V(Ge);
933
+ if (!n) {
897
934
  console.warn(
898
935
  "[vue-micro-router] useRouteLifecycle() must be called inside a route component rendered by <MicroRouterView>."
899
936
  );
900
937
  return;
901
938
  }
902
- const { activePage: n } = J();
903
- let i = n.value === o;
904
- i && q(() => {
939
+ const { activePage: o } = Z();
940
+ let i = o.value === n;
941
+ i && Q(() => {
905
942
  var t;
906
943
  return (t = e.onRouteEnter) == null ? void 0 : t.call(e);
907
- }), X(n, (t) => {
908
- var c, r;
909
- const l = t === o;
910
- l && !i ? (c = e.onRouteEnter) == null || c.call(e) : !l && i && ((r = e.onRouteLeave) == null || r.call(e)), i = l;
944
+ }), X(o, (t) => {
945
+ var u, r;
946
+ const l = t === n;
947
+ l && !i ? (u = e.onRouteEnter) == null || u.call(e) : !l && i && ((r = e.onRouteLeave) == null || r.call(e)), i = l;
911
948
  });
912
949
  }
913
- function wt(e) {
914
- const o = V(Te);
915
- if (!o) {
950
+ function Mt(e) {
951
+ const n = V(Ne);
952
+ if (!n) {
916
953
  console.warn(
917
954
  "[vue-micro-router] useDialogLifecycle() must be called inside a dialog component rendered by <MicroDialog>."
918
955
  );
919
956
  return;
920
957
  }
921
- const { activeDialog: n } = J();
922
- let i = n.value === o;
923
- i && q(() => {
958
+ const { activeDialog: o } = Z();
959
+ let i = o.value === n;
960
+ i && Q(() => {
924
961
  var t;
925
962
  return (t = e.onDialogEnter) == null ? void 0 : t.call(e);
926
- }), X(n, (t) => {
927
- var c, r;
928
- const l = t === o;
929
- l && !i ? (c = e.onDialogEnter) == null || c.call(e) : !l && i && ((r = e.onDialogLeave) == null || r.call(e)), i = l;
963
+ }), X(o, (t) => {
964
+ var u, r;
965
+ const l = t === n;
966
+ l && !i ? (u = e.onDialogEnter) == null || u.call(e) : !l && i && ((r = e.onDialogLeave) == null || r.call(e)), i = l;
930
967
  });
931
968
  }
932
- function Dt(e) {
933
- const o = V(Ie);
934
- if (!o) {
969
+ function Tt(e) {
970
+ const n = V(Oe);
971
+ if (!n) {
935
972
  console.warn(
936
973
  "[vue-micro-router] useControlLifecycle() must be called inside a control component rendered by <MicroControlWrapper>."
937
974
  );
938
975
  return;
939
976
  }
940
- const { currentControl: n } = J();
941
- let i = n.value === o;
942
- i && q(() => {
977
+ const { currentControl: o } = Z();
978
+ let i = o.value === n;
979
+ i && Q(() => {
943
980
  var t;
944
981
  return (t = e.onControlEnter) == null ? void 0 : t.call(e);
945
- }), X(n, (t) => {
946
- var c, r;
947
- const l = t === o;
948
- l && !i ? (c = e.onControlEnter) == null || c.call(e) : !l && i && ((r = e.onControlLeave) == null || r.call(e)), i = l;
982
+ }), X(o, (t) => {
983
+ var u, r;
984
+ const l = t === n;
985
+ l && !i ? (u = e.onControlEnter) == null || u.call(e) : !l && i && ((r = e.onControlLeave) == null || r.call(e)), i = l;
949
986
  });
950
987
  }
951
- function nt(e, o) {
988
+ function gt(e, n) {
952
989
  if (!e.enabled) return;
953
- const n = e.edgeWidth ?? 20, i = e.threshold ?? 0.3, t = e.velocityThreshold ?? 0.5;
954
- let l = 0, c = 0, r = 0, u = !1, a = null, m = null;
990
+ const o = e.edgeWidth ?? 20, i = e.threshold ?? 0.3, t = e.velocityThreshold ?? 0.5;
991
+ let l = 0, u = 0, r = 0, c = !1, a = null, d = null;
955
992
  function R() {
956
- const s = o.containerRef.value;
993
+ const s = n.containerRef.value;
957
994
  return s ? "$el" in s ? s.$el : s : null;
958
995
  }
959
- function L() {
996
+ function T() {
960
997
  const s = R();
961
998
  if (!s) return { current: null, previous: null };
962
999
  const f = s.querySelectorAll(".route-page");
@@ -966,220 +1003,199 @@ function nt(e, o) {
966
1003
  };
967
1004
  }
968
1005
  function M(s) {
969
- var P;
970
- if (!o.canGoBack() || s.clientX > n) return;
971
- const { current: f, previous: A } = L();
1006
+ var A;
1007
+ if (!n.canGoBack() || s.clientX > o) return;
1008
+ const { current: f, previous: p } = T();
972
1009
  if (!f) return;
973
- u = !0, l = s.clientX, c = s.clientY, r = Date.now(), a = f, m = A;
974
- const d = R();
975
- (P = d == null ? void 0 : d.setPointerCapture) == null || P.call(d, s.pointerId), a.style.willChange = "transform", m && (m.style.willChange = "transform", m.style.transition = "none"), a.style.transition = "none";
1010
+ c = !0, l = s.clientX, u = s.clientY, r = Date.now(), a = f, d = p;
1011
+ const v = R();
1012
+ (A = v == null ? void 0 : v.setPointerCapture) == null || A.call(v, s.pointerId), a.style.willChange = "transform", d && (d.style.willChange = "transform", d.style.transition = "none"), a.style.transition = "none";
976
1013
  }
977
- function T(s) {
978
- if (!u || !a) return;
1014
+ function L(s) {
1015
+ if (!c || !a) return;
979
1016
  const f = Math.max(0, s.clientX - l);
980
- if (Math.abs(s.clientY - c) > f * 1.5) {
1017
+ if (Math.abs(s.clientY - u) > f * 1.5) {
981
1018
  g();
982
1019
  return;
983
1020
  }
984
- const d = f / window.innerWidth;
985
- if (a.style.transform = `translateX(${f}px)`, m) {
986
- const P = -20 + 20 * d;
987
- m.style.transform = `translateX(${P}%)`;
1021
+ const v = f / window.innerWidth;
1022
+ if (a.style.transform = `translateX(${f}px)`, d) {
1023
+ const A = -20 + 20 * v;
1024
+ d.style.transform = `translateX(${A}%)`;
988
1025
  }
989
1026
  }
990
- function I(s) {
991
- if (!u || !a) return;
1027
+ function _(s) {
1028
+ if (!c || !a) return;
992
1029
  if (!a.isConnected) {
993
- y(), u = !1;
1030
+ P(), c = !1;
994
1031
  return;
995
1032
  }
996
- const f = s.clientX - l, A = Date.now() - r, d = f / A;
997
- f / window.innerWidth > i || d > t ? (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(100%)", m && (m.style.transition = "transform 0.2s ease-out", m.style.transform = "translateX(0)"), setTimeout(() => {
998
- y(), o.goBack();
999
- }, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", m && (m.style.transition = "transform 0.2s ease-out", m.style.transform = "translateX(-20%)"), setTimeout(y, 200)), u = !1;
1033
+ const f = s.clientX - l, p = Date.now() - r, v = f / p;
1034
+ f / window.innerWidth > i || v > t ? (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(100%)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(0)"), setTimeout(() => {
1035
+ P(), n.goBack();
1036
+ }, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(P, 200)), c = !1;
1000
1037
  }
1001
1038
  function g() {
1002
- u && (a && (a.style.transition = "transform 0.15s ease-out", a.style.transform = "translateX(0)"), m && (m.style.transition = "transform 0.15s ease-out", m.style.transform = "translateX(-20%)"), setTimeout(y, 150), u = !1);
1039
+ c && (a && (a.style.transition = "transform 0.15s ease-out", a.style.transform = "translateX(0)"), d && (d.style.transition = "transform 0.15s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(P, 150), c = !1);
1003
1040
  }
1004
- function y() {
1005
- a && (a.style.willChange = "", a.style.transition = "", a.style.transform = ""), m && (m.style.willChange = "", m.style.transition = "", m.style.transform = ""), a = null, m = null;
1041
+ function P() {
1042
+ a && (a.style.willChange = "", a.style.transition = "", a.style.transform = ""), d && (d.style.willChange = "", d.style.transition = "", d.style.transform = ""), a = null, d = null;
1006
1043
  }
1007
- q(() => {
1044
+ Q(() => {
1008
1045
  const s = R();
1009
- s != null && s.addEventListener && (s.addEventListener("pointerdown", M, { passive: !0 }), s.addEventListener("pointermove", T, { passive: !0 }), s.addEventListener("pointerup", I, { passive: !0 }), s.addEventListener("pointercancel", g, { passive: !0 }));
1010
- }), he(() => {
1046
+ s != null && s.addEventListener && (s.addEventListener("pointerdown", M, { passive: !0 }), s.addEventListener("pointermove", L, { passive: !0 }), s.addEventListener("pointerup", _, { passive: !0 }), s.addEventListener("pointercancel", g, { passive: !0 }));
1047
+ }), De(() => {
1011
1048
  const s = R();
1012
- s != null && s.removeEventListener && (s.removeEventListener("pointerdown", M), s.removeEventListener("pointermove", T), s.removeEventListener("pointerup", I), s.removeEventListener("pointercancel", g));
1049
+ s != null && s.removeEventListener && (s.removeEventListener("pointerdown", M), s.removeEventListener("pointermove", L), s.removeEventListener("pointerup", _), s.removeEventListener("pointercancel", g));
1013
1050
  });
1014
1051
  }
1015
- function At(e) {
1052
+ function Lt(e) {
1016
1053
  return { ...e };
1017
1054
  }
1018
- function ot(e, o) {
1019
- var n, i, t;
1055
+ function dt(e, n) {
1056
+ var o, i, t;
1020
1057
  for (const l of e)
1021
- (n = l.routes) != null && n.length && o.registerRoutes(l.routes), (i = l.dialogs) != null && i.length && o.registerDialogs(l.dialogs), (t = l.controls) != null && t.length && o.registerControls(l.controls);
1058
+ (o = l.routes) != null && o.length && n.registerRoutes(l.routes), (i = l.dialogs) != null && i.length && n.registerDialogs(l.dialogs), (t = l.controls) != null && t.length && n.registerControls(l.controls);
1022
1059
  }
1023
- const at = /* @__PURE__ */ oe({
1060
+ const vt = /* @__PURE__ */ ie({
1024
1061
  __name: "MicroControlWrapper",
1025
1062
  props: {
1026
1063
  control: {}
1027
1064
  },
1028
1065
  setup(e) {
1029
- const o = e, { getControlAttrs: n, updateControlAttrs: i } = J();
1030
- return N(Ie, o.control.name), N(ae, () => n(o.control.name)), N(ie, (t) => {
1031
- i(o.control.name, t);
1032
- }), (t, l) => (B(), z(ye(e.control.component), Pe({
1066
+ const n = e, { getControlAttrs: o, updateControlAttrs: i } = Z();
1067
+ return O(Oe, n.control.name), O(se, () => o(n.control.name)), O(re, (t) => {
1068
+ i(n.control.name, t);
1069
+ }), (t, l) => (G(), z(Ae(e.control.component), Ce({
1033
1070
  key: e.control.componentKey || 0
1034
1071
  }, e.control.attrs), null, 16));
1035
1072
  }
1036
1073
  });
1037
- let Z = 0, Be = "";
1038
- function it() {
1039
- Z === 0 && (Be = document.body.style.overflow, document.body.style.overflow = "hidden"), Z++;
1040
- }
1041
- function st() {
1042
- Z = Math.max(0, Z - 1), Z === 0 && (document.body.style.overflow = Be);
1043
- }
1044
- const rt = /* @__PURE__ */ new Set(["A", "BUTTON", "INPUT", "SELECT", "TEXTAREA"]);
1045
- function lt(e) {
1046
- return !(!rt.has(e.tagName) && !e.hasAttribute("tabindex") || e.tagName === "A" && !e.hasAttribute("href") || e.hidden || e.closest("[hidden],[inert]") || e.getAttribute("aria-hidden") === "true" || e.getAttribute("tabindex") === "-1" || e.hasAttribute("disabled") || e instanceof HTMLInputElement && e.type === "hidden");
1047
- }
1048
- function Ge(e) {
1049
- return Array.from(
1050
- e.querySelectorAll("*")
1051
- ).filter(lt);
1074
+ let ee = 0, We = "";
1075
+ function mt() {
1076
+ ee === 0 && (We = document.body.style.overflow, document.body.style.overflow = "hidden"), ee++;
1052
1077
  }
1053
- function ct(e) {
1054
- const o = Ge(e);
1055
- return o.find((n) => n.hasAttribute("autofocus")) ?? o[0] ?? e;
1078
+ function pt() {
1079
+ ee = Math.max(0, ee - 1), ee === 0 && (document.body.style.overflow = We);
1056
1080
  }
1057
- const ut = /* @__PURE__ */ oe({
1081
+ const ht = 12, yt = /* @__PURE__ */ ie({
1058
1082
  __name: "MicroDialog",
1059
1083
  props: {
1060
1084
  dialog: {},
1061
1085
  stackIndex: {}
1062
1086
  },
1063
1087
  emits: ["close"],
1064
- setup(e, { emit: o }) {
1065
- const n = e, i = o, { getDialogAttrs: t, updateDialogAttrs: l } = J();
1066
- let c = !1, r = 0;
1067
- const u = ee(null), a = ee(null), m = C(() => n.dialog.transition ?? "scale"), R = C(() => n.dialog.transitionDuration != null ? n.dialog.transitionDuration : m.value === "slide" ? 500 : 300), L = C(() => n.dialog.position ?? "standard"), M = C(() => n.dialog.seamless ?? !1);
1068
- function T() {
1069
- return u.value ? Ge(u.value) : [];
1088
+ setup(e, { emit: n }) {
1089
+ const o = e, i = n, { getDialogAttrs: t, updateDialogAttrs: l } = Z();
1090
+ let u = !1, r = 0;
1091
+ const c = ne(null), a = ne(null), d = C(() => o.dialog.transition ?? "scale"), R = C(() => o.dialog.transitionDuration != null ? o.dialog.transitionDuration : d.value === "slide" ? 500 : 300), T = C(() => o.dialog.position ?? "standard"), M = C(() => o.dialog.seamless ?? !1);
1092
+ function L() {
1093
+ return c.value ? Me(c.value) : [];
1070
1094
  }
1071
- function I(d) {
1072
- var w, S;
1073
- if (d.key === "Escape") {
1074
- if (n.dialog.persistent) return;
1075
- d.preventDefault(), d.stopPropagation(), i("close", n.dialog.path);
1095
+ function _(p) {
1096
+ var D, w;
1097
+ if (p.key === "Escape") {
1098
+ if (o.dialog.persistent) return;
1099
+ p.preventDefault(), p.stopPropagation(), i("close", o.dialog.path);
1076
1100
  return;
1077
1101
  }
1078
- if (d.key !== "Tab") return;
1079
- const P = T();
1080
- if (P.length === 0) {
1081
- d.preventDefault(), (w = u.value) == null || w.focus();
1102
+ if (p.key !== "Tab") return;
1103
+ const v = L();
1104
+ if (v.length === 0) {
1105
+ p.preventDefault(), (D = c.value) == null || D.focus();
1082
1106
  return;
1083
1107
  }
1084
- const p = P[0], h = P[P.length - 1], v = document.activeElement, D = !!((S = u.value) != null && S.contains(v));
1085
- d.shiftKey ? (!D || v === p) && (d.preventDefault(), h.focus()) : (!D || v === h) && (d.preventDefault(), p.focus());
1086
- }
1087
- function g(d) {
1088
- n.dialog.persistent || d.target === d.currentTarget && i("close", n.dialog.path);
1108
+ const A = v[0], y = v[v.length - 1], h = document.activeElement, m = !!((w = c.value) != null && w.contains(h));
1109
+ p.shiftKey ? (!m || h === A) && (p.preventDefault(), y.focus()) : (!m || h === y) && (p.preventDefault(), A.focus());
1089
1110
  }
1090
- function y(d) {
1091
- if (!n.dialog.focusInput || !u.value) {
1092
- d();
1093
- return;
1094
- }
1095
- const P = document.createElement("input");
1096
- P.style.cssText = "position:fixed;opacity:0;height:0;width:0;top:-100px;", u.value.appendChild(P), P.focus(), setTimeout(() => {
1097
- P.remove(), d();
1098
- }, 50);
1111
+ function g(p) {
1112
+ o.dialog.persistent || p.target === p.currentTarget && i("close", o.dialog.path);
1099
1113
  }
1100
- function s(d) {
1101
- const P = ++r;
1102
- k(() => {
1103
- if (!u.value || !n.dialog.activated || P !== r) return;
1104
- const p = () => {
1105
- !u.value || !n.dialog.activated || P !== r || ct(u.value).focus();
1106
- };
1107
- if (d) {
1108
- y(p);
1114
+ function P(p) {
1115
+ const v = ++r, A = (y = 0) => {
1116
+ if (!c.value || !o.dialog.activated || v !== r) return;
1117
+ const h = et(c.value);
1118
+ if (h) {
1119
+ h.focus(), he();
1109
1120
  return;
1110
1121
  }
1111
- p();
1112
- });
1122
+ if (p && y < ht) {
1123
+ requestAnimationFrame(() => A(y + 1));
1124
+ return;
1125
+ }
1126
+ tt(c.value).focus(), he();
1127
+ };
1128
+ te(() => A());
1113
1129
  }
1114
- function f() {
1115
- if (c) {
1116
- s(n.dialog.focusInput ?? !1);
1130
+ function s() {
1131
+ if (u) {
1132
+ P(o.dialog.focusInput ?? !1);
1117
1133
  return;
1118
1134
  }
1119
- c = !0, a.value = document.activeElement, it(), s(n.dialog.focusInput ?? !1);
1135
+ u = !0, a.value = document.activeElement, mt(), P(o.dialog.focusInput ?? !1);
1120
1136
  }
1121
- function A() {
1122
- var v;
1123
- if (!c) return;
1124
- r++, c = !1, st();
1125
- const d = a.value;
1137
+ function f() {
1138
+ var h;
1139
+ if (!u) return;
1140
+ r++, u = !1, pt();
1141
+ const p = a.value;
1126
1142
  a.value = null;
1127
- const P = document.activeElement, p = !!((v = u.value) != null && v.contains(P)), h = !P || P === document.body;
1128
- d && typeof d.focus == "function" && document.contains(d) && (p || h) && d.focus();
1143
+ const v = document.activeElement, A = !!((h = c.value) != null && h.contains(v)), y = !v || v === document.body;
1144
+ p && typeof p.focus == "function" && document.contains(p) && (A || y) && p.focus();
1129
1145
  }
1130
- return N(Te, n.dialog.path), N(ae, () => t(n.dialog.path)), N(ie, (d) => {
1131
- l(n.dialog.path, d);
1146
+ return O(Ne, o.dialog.path), O(se, () => t(o.dialog.path)), O(re, (p) => {
1147
+ l(o.dialog.path, p);
1132
1148
  }), X(
1133
- () => n.dialog.activated,
1134
- (d) => {
1135
- d && f();
1149
+ () => o.dialog.activated,
1150
+ (p) => {
1151
+ p && s();
1136
1152
  }
1137
1153
  ), X(
1138
- () => n.dialog.closing,
1139
- (d) => {
1140
- !d && !n.dialog.activated && c && A();
1154
+ () => o.dialog.closing,
1155
+ (p) => {
1156
+ !p && !o.dialog.activated && u && f();
1141
1157
  }
1142
- ), q(() => {
1143
- n.dialog.activated && f();
1144
- }), he(() => {
1145
- c && A();
1146
- }), (d, P) => (B(), z(We, { to: "body" }, [
1147
- j("div", {
1148
- class: Q(["micro-dialog-portal", [
1149
- `micro-dialog--${L.value}`,
1158
+ ), Q(() => {
1159
+ o.dialog.activated && s();
1160
+ }), De(() => {
1161
+ u && f();
1162
+ }), (p, v) => (G(), z(Fe, { to: "body" }, [
1163
+ q("div", {
1164
+ class: k(["micro-dialog-portal", [
1165
+ `micro-dialog--${T.value}`,
1150
1166
  e.dialog.fullscreen && "micro-dialog--fullscreen",
1151
1167
  M.value && "micro-dialog--seamless"
1152
1168
  ]]),
1153
- style: be({
1169
+ style: Ie({
1154
1170
  zIndex: 100 + e.stackIndex,
1155
1171
  "--dialog-duration": `${R.value}ms`
1156
1172
  }),
1157
- onClick: le(g, ["self"])
1173
+ onClick: ce(g, ["self"])
1158
1174
  }, [
1159
- M.value ? $e("", !0) : (B(), x("div", {
1175
+ M.value ? Xe("", !0) : (G(), j("div", {
1160
1176
  key: 0,
1161
- class: Q(["micro-dialog-backdrop", e.dialog.closing && "micro-dialog-backdrop--closing"])
1177
+ class: k(["micro-dialog-backdrop", e.dialog.closing && "micro-dialog-backdrop--closing"])
1162
1178
  }, null, 2)),
1163
- j("div", {
1179
+ q("div", {
1164
1180
  ref_key: "wrapperRef",
1165
- ref: u,
1181
+ ref: c,
1166
1182
  role: "dialog",
1167
1183
  "aria-modal": "true",
1168
1184
  tabindex: "-1",
1169
- class: Q(["micro-dialog", [
1170
- `dialog-transition-${m.value}`,
1185
+ class: k(["micro-dialog", [
1186
+ `dialog-transition-${d.value}`,
1171
1187
  e.dialog.closing && "micro-dialog--closing"
1172
1188
  ]]),
1173
- onClick: le(g, ["self"]),
1174
- onKeydown: I
1189
+ onClick: ce(g, ["self"]),
1190
+ onKeydown: _
1175
1191
  }, [
1176
- j("div", {
1192
+ q("div", {
1177
1193
  class: "micro-dialog__content",
1178
- onClick: P[0] || (P[0] = le(() => {
1194
+ onClick: v[0] || (v[0] = ce(() => {
1179
1195
  }, ["stop"]))
1180
1196
  }, [
1181
- we(d.$slots, "default"),
1182
- (B(), z(ye(e.dialog.component), Pe({
1197
+ Re(p.$slots, "default"),
1198
+ (G(), z(Ae(e.dialog.component), Ce({
1183
1199
  key: e.dialog.componentKey
1184
1200
  }, e.dialog.attrs), null, 16))
1185
1201
  ])
@@ -1187,28 +1203,28 @@ const ut = /* @__PURE__ */ oe({
1187
1203
  ], 6)
1188
1204
  ]));
1189
1205
  }
1190
- }), ft = { class: "route-page" }, gt = { class: "route-page__body" }, dt = /* @__PURE__ */ oe({
1206
+ }), Pt = { class: "route-page" }, wt = { class: "route-page__body" }, Dt = /* @__PURE__ */ ie({
1191
1207
  __name: "RoutePage",
1192
1208
  props: {
1193
1209
  routePath: {}
1194
1210
  },
1195
1211
  setup(e) {
1196
- const o = e;
1197
- if (o.routePath) {
1198
- const n = o.routePath;
1199
- N(Le, n);
1200
- const { updateRouteAttrs: i, getRouteAttrs: t } = J();
1201
- N(ae, () => t(n)), N(ie, (l) => {
1202
- i(n, l);
1212
+ const n = e;
1213
+ if (n.routePath) {
1214
+ const o = n.routePath;
1215
+ O(Ge, o);
1216
+ const { updateRouteAttrs: i, getRouteAttrs: t } = Z();
1217
+ O(se, () => t(o)), O(re, (l) => {
1218
+ i(o, l);
1203
1219
  });
1204
1220
  }
1205
- return (n, i) => (B(), x("div", ft, [
1206
- j("div", gt, [
1207
- we(n.$slots, "default")
1221
+ return (o, i) => (G(), j("div", Pt, [
1222
+ q("div", wt, [
1223
+ Re(o.$slots, "default")
1208
1224
  ])
1209
1225
  ]));
1210
1226
  }
1211
- }), vt = { class: "micro-router-content-layer" }, Ct = /* @__PURE__ */ oe({
1227
+ }), At = { class: "micro-router-content-layer" }, _t = /* @__PURE__ */ ie({
1212
1228
  __name: "MicroRouterView",
1213
1229
  props: {
1214
1230
  config: {},
@@ -1216,120 +1232,120 @@ const ut = /* @__PURE__ */ oe({
1216
1232
  nested: { type: Boolean }
1217
1233
  },
1218
1234
  setup(e) {
1219
- var y, s;
1220
- const o = e, n = tt(o.config);
1221
- (y = o.plugins) != null && y.length && ot(o.plugins, n);
1235
+ var P, s;
1236
+ const n = e, o = ft(n.config);
1237
+ (P = n.plugins) != null && P.length && dt(n.plugins, o);
1222
1238
  const {
1223
1239
  resolveRoutes: i,
1224
1240
  resolveDialogs: t,
1225
1241
  resolveControls: l,
1226
- fromPath: c,
1242
+ fromPath: u,
1227
1243
  toPath: r,
1228
- isNavigating: u,
1244
+ isNavigating: c,
1229
1245
  closeDialog: a
1230
- } = n, m = ee(null), R = C(() => {
1231
- const f = c.value.split("/").filter(Boolean), A = new Set(r.value.split("/").filter(Boolean));
1232
- return f.some((d) => A.has(d));
1233
- }), L = C(() => l.value.length > 0), M = C(() => {
1246
+ } = o, d = ne(null), R = C(() => {
1247
+ const f = u.value.split("/").filter(Boolean), p = new Set(r.value.split("/").filter(Boolean));
1248
+ return f.some((v) => p.has(v));
1249
+ }), T = C(() => l.value.length > 0), M = C(() => {
1234
1250
  const f = i.value.at(-1);
1235
1251
  return (f == null ? void 0 : f.transition) ?? "slide";
1236
- }), T = C(() => M.value === "none" ? "" : M.value === "fade" ? "page-fade" : "page-slide"), I = C(() => {
1252
+ }), L = C(() => M.value === "none" ? "" : M.value === "fade" ? "page-fade" : "page-slide"), _ = C(() => {
1237
1253
  const f = i.value.at(-1);
1238
1254
  return f != null && f.transitionDuration ? f.transitionDuration : M.value === "fade" ? 300 : 500;
1239
1255
  }), g = C(
1240
1256
  () => R.value && M.value !== "none"
1241
1257
  );
1242
- return (s = o.config.gesture) != null && s.enabled && nt(o.config.gesture, {
1243
- containerRef: m,
1244
- goBack: () => n.push(-1),
1258
+ return (s = n.config.gesture) != null && s.enabled && gt(n.config.gesture, {
1259
+ containerRef: d,
1260
+ goBack: () => o.push(-1),
1245
1261
  canGoBack: () => i.value.length > 1
1246
- }), (f, A) => (B(), x(te, null, [
1247
- Re(Ee, {
1262
+ }), (f, p) => (G(), j(oe, null, [
1263
+ Te(Le, {
1248
1264
  ref_key: "pageContainerRef",
1249
- ref: m,
1250
- name: T.value,
1265
+ ref: d,
1266
+ name: L.value,
1251
1267
  css: g.value
1252
1268
  }, {
1253
- default: ce(() => [
1254
- (B(!0), x(te, null, ue(Y(i), (d, P) => (B(), z(dt, {
1255
- key: d.key || d.path,
1256
- "route-path": d.path,
1257
- class: Q({
1258
- deactivate: Y(i).length > 1 && P !== Y(i).length - 1,
1259
- "micro-router--navigating": Y(u)
1269
+ default: fe(() => [
1270
+ (G(!0), j(oe, null, ge(Y(i), (v, A) => (G(), z(Dt, {
1271
+ key: v.key || v.path,
1272
+ "route-path": v.path,
1273
+ class: k({
1274
+ deactivate: Y(i).length > 1 && A !== Y(i).length - 1,
1275
+ "micro-router--navigating": Y(c)
1260
1276
  }),
1261
- style: be({
1262
- transition: g.value ? `transform ${I.value}ms cubic-bezier(0.65, 0, 0.35, 1), opacity ${I.value}ms ease` : "none",
1263
- zIndex: 10 + P,
1277
+ style: Ie({
1278
+ transition: g.value ? `transform ${_.value}ms cubic-bezier(0.65, 0, 0.35, 1), opacity ${_.value}ms ease` : "none",
1279
+ zIndex: 10 + A,
1264
1280
  "--mr-page-height": e.nested ? "100%" : "100dvh"
1265
1281
  })
1266
1282
  }, {
1267
- default: ce(() => [
1268
- (B(), z(ye(d.component), Pe({
1269
- key: d.componentKey
1270
- }, { ref_for: !0 }, Y(n).getRouteAttrs(d.path)), null, 16))
1283
+ default: fe(() => [
1284
+ (G(), z(Ae(v.component), Ce({
1285
+ key: v.componentKey
1286
+ }, { ref_for: !0 }, Y(o).getRouteAttrs(v.path)), null, 16))
1271
1287
  ]),
1272
1288
  _: 2
1273
1289
  }, 1032, ["route-path", "class", "style"]))), 128))
1274
1290
  ]),
1275
1291
  _: 1
1276
1292
  }, 8, ["name", "css"]),
1277
- j("div", vt, [
1278
- we(f.$slots, "default")
1293
+ q("div", At, [
1294
+ Re(f.$slots, "default")
1279
1295
  ]),
1280
- j("div", {
1281
- class: Q(["micro-router-gui-layer", { "gui-visible": L.value }])
1296
+ q("div", {
1297
+ class: k(["micro-router-gui-layer", { "gui-visible": T.value }])
1282
1298
  }, [
1283
- Re(Ee, { name: "control-fade" }, {
1284
- default: ce(() => [
1285
- (B(!0), x(te, null, ue(Y(l), (d) => (B(), z(at, {
1286
- key: d.name + "-" + (d.componentKey || 0),
1287
- control: d
1299
+ Te(Le, { name: "control-fade" }, {
1300
+ default: fe(() => [
1301
+ (G(!0), j(oe, null, ge(Y(l), (v) => (G(), z(vt, {
1302
+ key: v.name + "-" + (v.componentKey || 0),
1303
+ control: v
1288
1304
  }, null, 8, ["control"]))), 128))
1289
1305
  ]),
1290
1306
  _: 1
1291
1307
  })
1292
1308
  ], 2),
1293
- (B(!0), x(te, null, ue(Y(t), (d, P) => (B(), z(ut, {
1294
- key: "dialog-" + d.path,
1295
- dialog: d,
1296
- "stack-index": P,
1309
+ (G(!0), j(oe, null, ge(Y(t), (v, A) => (G(), z(yt, {
1310
+ key: "dialog-" + v.path,
1311
+ dialog: v,
1312
+ "stack-index": A,
1297
1313
  onClose: Y(a)
1298
1314
  }, null, 8, ["dialog", "stack-index", "onClose"]))), 128))
1299
1315
  ], 64));
1300
1316
  }
1301
1317
  });
1302
1318
  export {
1303
- ae as MICRO_ATTRS_READ_KEY,
1304
- ie as MICRO_ATTRS_WRITE_KEY,
1305
- Ie as MICRO_CONTROL_NAME_KEY,
1306
- Te as MICRO_DIALOG_PATH_KEY,
1307
- Me as MICRO_ROUTER_KEY,
1308
- de as MICRO_ROUTER_ROOT_KEY,
1309
- Le as MICRO_ROUTE_PATH_KEY,
1310
- at as MicroControlWrapper,
1311
- ut as MicroDialogComponent,
1312
- Ct as MicroRouterView,
1313
- dt as RoutePage,
1314
- Ue as STEP_DELAY,
1315
- K as buildPathFromSegments,
1316
- ht as createRouterKey,
1317
- At as defineFeaturePlugin,
1319
+ se as MICRO_ATTRS_READ_KEY,
1320
+ re as MICRO_ATTRS_WRITE_KEY,
1321
+ Oe as MICRO_CONTROL_NAME_KEY,
1322
+ Ne as MICRO_DIALOG_PATH_KEY,
1323
+ Be as MICRO_ROUTER_KEY,
1324
+ me as MICRO_ROUTER_ROOT_KEY,
1325
+ Ge as MICRO_ROUTE_PATH_KEY,
1326
+ vt as MicroControlWrapper,
1327
+ yt as MicroDialogComponent,
1328
+ _t as MicroRouterView,
1329
+ Dt as RoutePage,
1330
+ ze as STEP_DELAY,
1331
+ W as buildPathFromSegments,
1332
+ Et as createRouterKey,
1333
+ Lt as defineFeaturePlugin,
1318
1334
  H as getLastSegment,
1319
- De as isAsyncLoader,
1320
- W as normalizePath,
1321
- _ as parsePathSegments,
1322
- ot as registerFeaturePlugins,
1323
- Ae as safeMarkRaw,
1324
- Dt as useControlLifecycle,
1325
- Xe as useControlManager,
1326
- wt as useDialogLifecycle,
1327
- je as useDialogManager,
1328
- nt as useGestureNavigation,
1329
- tt as useGlobalMicroRouter,
1330
- J as useMicroRouter,
1331
- yt as useMicroState,
1332
- ke as useNavigation,
1333
- et as usePageTracker,
1334
- Pt as useRouteLifecycle
1335
+ Ee as isAsyncLoader,
1336
+ $ as normalizePath,
1337
+ I as parsePathSegments,
1338
+ dt as registerFeaturePlugins,
1339
+ Se as safeMarkRaw,
1340
+ Tt as useControlLifecycle,
1341
+ Ve as useControlManager,
1342
+ Mt as useDialogLifecycle,
1343
+ ot as useDialogManager,
1344
+ gt as useGestureNavigation,
1345
+ ft as useGlobalMicroRouter,
1346
+ Z as useMicroRouter,
1347
+ St as useMicroState,
1348
+ ut as useNavigation,
1349
+ ct as usePageTracker,
1350
+ bt as useRouteLifecycle
1335
1351
  };