react-modal-navigation 1.2.0 → 1.3.0

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/dist/index.js CHANGED
@@ -1,7 +1,138 @@
1
- import { jsx as p, jsxs as be } from "react/jsx-runtime";
2
- import Se, { createContext as we, useState as xe, useEffect as U, useRef as P, useMemo as Q, useSyncExternalStore as Oe, useContext as ee, memo as rt, useCallback as _, useReducer as dn, useLayoutEffect as Ae, Suspense as Wt, useInsertionEffect as mn } from "react";
3
- import { createPortal as pn } from "react-dom";
4
- function je(e) {
1
+ import { jsx as m, jsxs as Me } from "react/jsx-runtime";
2
+ import { createPortal as zn, flushSync as Qt } from "react-dom";
3
+ import Oe, { createContext as we, useContext as Y, useSyncExternalStore as Ee, useMemo as V, useRef as G, useLayoutEffect as Se, useEffect as ee, useState as Pe, useInsertionEffect as rn, memo as pt, useCallback as X, useReducer as Nn, Suspense as qt } from "react";
4
+ function on(e) {
5
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
6
+ function o(i, u = "", a = [], c = {}, d = [], g = []) {
7
+ if (!i || typeof i != "object" || Array.isArray(i) || r.has(i)) throw new Error("[react-modal-navigation] Invalid or cyclic screens");
8
+ r.add(i);
9
+ for (const [x, b] of Object.entries(i)) {
10
+ if (!x || !b || typeof b != "object") throw new Error("[react-modal-navigation] Invalid screen");
11
+ const h = u ? `${u}/${x}` : x, { screens: l, layout: y, persistentLayout: C, initialRoute: L, initialParams: S, ...j } = b;
12
+ if (C && (!y || a.length)) throw new Error("[react-modal-navigation] Persistent layouts require a layout and cannot follow a nonpersistent layout");
13
+ if (S !== void 0 && (!l || !S || typeof S != "object" || Array.isArray(S))) throw new Error(`[react-modal-navigation] Invalid group initialParams: ${h}`);
14
+ const D = C ? [...d, { path: h, component: y }] : d, R = y && !C ? [...a, y] : a;
15
+ if (j.component || j.loader || !l) {
16
+ if (t.has(h)) throw new Error(`[react-modal-navigation] Duplicate screen: ${h}`);
17
+ t.set(h, R.length || D.length || g.length || Object.keys(c).length ? { ...c, ...j, ...g.length ? { routeGroups: g } : {}, ...R.length ? { routeLayouts: R } : {}, ...D.length ? { persistentLayouts: D } : {} } : b);
18
+ }
19
+ if (l) {
20
+ const { component: k, loader: O, ...A } = j;
21
+ if (L !== void 0) {
22
+ if (typeof L != "string" || !L || n.has(h)) throw new Error(`[react-modal-navigation] Invalid default route: ${h}`);
23
+ n.set(h, `${h}/${L}`);
24
+ }
25
+ o(l, h, R, { ...c, ...A }, D, [...g, { name: h, params: Object.freeze({ ...S }) }]);
26
+ }
27
+ }
28
+ r.delete(i);
29
+ }
30
+ o(e);
31
+ const s = /* @__PURE__ */ new Map();
32
+ for (const [i, u] of n) {
33
+ if (t.has(i)) throw new Error(`[react-modal-navigation] Default route conflicts with screen: ${i}`);
34
+ let a = u;
35
+ for (; n.has(a); ) a = n.get(a);
36
+ if (!t.has(a)) throw new Error(`[react-modal-navigation] Unknown default route: ${u}`);
37
+ s.set(i, a);
38
+ }
39
+ return { screens: Object.fromEntries(t), aliases: Object.fromEntries(s) };
40
+ }
41
+ function Ct(e, t, n) {
42
+ if (typeof e != "string") return e;
43
+ if (n && (e.startsWith("./") || e.startsWith("../"))) {
44
+ const r = n.split("/").slice(0, -1);
45
+ for (const o of e.split("/"))
46
+ if (o !== ".")
47
+ if (o === "..") {
48
+ if (!r.length) throw new Error("[react-modal-navigation] Relative route escapes root");
49
+ r.pop();
50
+ } else r.push(o);
51
+ e = r.join("/");
52
+ }
53
+ return t && Object.hasOwn(t, e) ? t[e] : e;
54
+ }
55
+ function Bn(e, t) {
56
+ const n = { children: [], groups: /* @__PURE__ */ new Map() };
57
+ for (const r of e) {
58
+ let o = n;
59
+ for (const s of t[r.name].persistentLayouts ?? []) {
60
+ let i = o.groups.get(s.path);
61
+ i || (i = { layout: s, children: [], groups: /* @__PURE__ */ new Map(), routes: [] }, o.groups.set(s.path, i), o.children.push(i)), i.routes.push(r), o = i;
62
+ }
63
+ o.children.push({ route: r });
64
+ }
65
+ return n.children;
66
+ }
67
+ const sn = we(null), an = we(null), at = we(null), st = we(null), It = we(null), $t = we(null), Et = we(null), Pt = we(null), Ot = we(null), cn = we(null), ln = we(null), Je = we(null), Dt = we(null), Kt = we(null), We = we(null), un = we(null), Ht = we(!1);
68
+ function Gn() {
69
+ const e = Y(un);
70
+ if (!e) throw new Error("[react-modal-navigation] useModalMatches requires a modal route");
71
+ return e;
72
+ }
73
+ function Fn() {
74
+ return Gn().at(-2) ?? null;
75
+ }
76
+ function to() {
77
+ return Fn()?.params;
78
+ }
79
+ const dn = () => () => {
80
+ }, Zt = () => null;
81
+ function no(e) {
82
+ const t = Y(We), n = t?.routeGroups.get(e), r = Ee(n?.subscribe ?? dn, n?.getSnapshot ?? Zt, n?.getSnapshot ?? Zt), o = V(() => ({
83
+ setParams: (s) => t.routeGroups.setParams(e, s),
84
+ run: (s) => t.routeGroups.run(e, s)
85
+ }), [t, e]);
86
+ return V(() => r && { ...r, ...o }, [r, o]);
87
+ }
88
+ function ro(e, t, { protectCache: n = !0 } = {}) {
89
+ const r = Y(We), o = Y(at), i = Y(Ht) ? void 0 : o?.routeKey, u = G(t);
90
+ Se(() => {
91
+ u.current = t;
92
+ }, [t]), Se(() => r?.routeGroups.registerGuard(e, (a) => u.current(a), { protectCache: n, ownerKey: i }), [r, e, n, i]);
93
+ }
94
+ function oo(e, t) {
95
+ const r = Y(We)?.routeGroups.get(e), o = V(() => () => r?.getSnapshot().isFocused ?? !1, [r]), s = Ee(r?.subscribe ?? dn, o, o), i = G(t);
96
+ Se(() => {
97
+ i.current = t;
98
+ }, [t]), ee(() => {
99
+ if (s)
100
+ return i.current.onFocus?.(), () => i.current.onBlur?.();
101
+ }, [e, r, s]);
102
+ }
103
+ function Ft({ screen: e, route: t, children: n }) {
104
+ const r = Y(We), o = e.routeGroups ?? qn, s = V(() => {
105
+ const a = o.map((x) => r?.routeGroups.get(x.name));
106
+ let c, d;
107
+ return { getSnapshot: () => {
108
+ const x = o.map((b, h) => a[h]?.getSnapshot().params ?? b.params);
109
+ return (!c || x.some((b, h) => b !== c[h])) && (c = x, d = o.map((b, h) => ({ name: b.name, params: x[h] }))), d;
110
+ }, subscribe: (x) => {
111
+ const b = a.map((h) => {
112
+ if (!h) return;
113
+ let l = h.getSnapshot().params;
114
+ return h.subscribe(() => {
115
+ const y = h.getSnapshot().params;
116
+ Object.is(l, y) || (l = y, x());
117
+ });
118
+ });
119
+ return () => b.forEach((h) => h?.());
120
+ } };
121
+ }, [r, o]), i = Ee(s.subscribe, s.getSnapshot, s.getSnapshot), u = V(() => [...i, t], [i, t]);
122
+ return /* @__PURE__ */ m(un.Provider, { value: u, children: n });
123
+ }
124
+ const qn = [], Wt = we(null);
125
+ function so() {
126
+ return Y(Wt);
127
+ }
128
+ function mn({ layout: e, route: t, navigation: n, children: r, shared: o = !1 }) {
129
+ return /* @__PURE__ */ m(Ht.Provider, { value: o, children: /* @__PURE__ */ m(Wt.Provider, { value: r, children: /* @__PURE__ */ m(e, { route: t, navigation: n, children: r }) }) });
130
+ }
131
+ function fn({ screen: e, route: t, navigation: n, includePersistent: r = !0 }) {
132
+ const o = e.component, s = [...r ? (e.persistentLayouts ?? []).map((u) => ({ layout: u.component, shared: !0 })) : [], ...(e.routeLayouts ?? []).map((u) => ({ layout: u, shared: !1 }))], i = /* @__PURE__ */ m(Ht.Provider, { value: !1, children: /* @__PURE__ */ m(o, { route: t, navigation: n }) });
133
+ return !s.length && !e.persistentLayouts?.length ? /* @__PURE__ */ m(Ft, { screen: e, route: t, children: i }) : /* @__PURE__ */ m(Ft, { screen: e, route: t, children: s.reduceRight((u, { layout: a, shared: c }) => /* @__PURE__ */ m(mn, { shared: c, layout: a, route: t, navigation: n, children: u }), /* @__PURE__ */ m(Wt.Provider, { value: null, children: i })) });
134
+ }
135
+ function $e(e) {
5
136
  let t = e;
6
137
  const n = /* @__PURE__ */ new Set();
7
138
  let r = !1;
@@ -11,13 +142,13 @@ function je(e) {
11
142
  publish(o) {
12
143
  if (!(r || Object.is(t, o))) {
13
144
  t = o;
14
- for (const a of [...n])
15
- if (!(r || !n.has(a)))
145
+ for (const s of [...n])
146
+ if (!(r || !n.has(s)))
16
147
  try {
17
- const l = a();
18
- l && typeof l.then == "function" && Promise.resolve(l).catch((f) => console.error(f));
19
- } catch (l) {
20
- console.error(l);
148
+ const i = s();
149
+ i && typeof i.then == "function" && Promise.resolve(i).catch((u) => console.error(u));
150
+ } catch (i) {
151
+ console.error(i);
21
152
  }
22
153
  }
23
154
  },
@@ -27,22 +158,22 @@ function je(e) {
27
158
  listenerCount: () => n.size
28
159
  };
29
160
  }
30
- const yt = we(null), Gt = we(null), _t = we(null), ot = we(null), Ue = we(null), Pt = we(null), Tt = we(null), vt = we(null), bt = we(null), wt = we(null), Ut = we(null), Vt = we(null), Ve = we(null), Lt = we(null), zt = we(null), at = we(null);
31
- let fn = 0;
32
- const ht = (e, t) => ({ key: `modal-route-${++fn}`, name: e, params: t ?? {} }), Yt = (e, t) => [ht(e, t)];
33
- function mt(e, t) {
161
+ const Lt = we(null);
162
+ let In = 0;
163
+ const Rt = (e, t) => ({ key: `modal-route-${++In}`, name: e, params: t ?? {} }), pn = (e, t) => [Rt(e, t)];
164
+ function kt(e, t) {
34
165
  switch (t.type) {
35
166
  case "COMMIT":
36
167
  return t.stack;
37
168
  case "PUSH":
38
- return [...e, ht(t.name, t.params)];
169
+ return [...e, Rt(t.name, t.params)];
39
170
  case "POP":
40
171
  return e.slice(0, Math.max(1, e.length - t.count));
41
172
  case "RESET":
42
- return Yt(t.name, t.params);
173
+ return pn(t.name, t.params);
43
174
  case "NAVIGATE": {
44
175
  const n = e.findIndex((r) => r.name === t.name);
45
- return n < 0 ? [...e, ht(t.name, t.params)] : e.slice(0, n + 1).map((r, o) => o === n ? { ...r, params: t.params ?? {} } : r);
176
+ return n < 0 ? [...e, Rt(t.name, t.params)] : e.slice(0, n + 1).map((r, o) => o === n ? { ...r, params: t.params ?? {} } : r);
46
177
  }
47
178
  case "SET_OPTIONS":
48
179
  return e.map((n, r) => r === e.length - 1 ? { ...n, options: { ...n.options ?? {}, ...t.options ?? {} } } : n);
@@ -51,120 +182,127 @@ function mt(e, t) {
51
182
  case "BACK":
52
183
  return e.length > 1 ? e.slice(0, -1) : e;
53
184
  case "REPLACE":
54
- return e.length ? [...e.slice(0, -1), ht(t.name, t.params)] : e;
185
+ return e.length ? [...e.slice(0, -1), Rt(t.name, t.params)] : e;
55
186
  default:
56
187
  return e;
57
188
  }
58
189
  }
59
- function $t(e, t, n = 1 / 0, r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set()) {
60
- const a = n === 1 / 0 ? 1 / 0 : Math.max(0, Math.floor(Number(n) || 0)), l = e.slice(0, -1).filter((u) => t[u.name]?.keepAlive !== !1), f = new Set((a === 0 ? [] : l.slice(-a)).map((u) => u.key));
61
- return e.filter((u, i) => i === e.length - 1 || (f.has(u.key) || o.has(u.key)) && !r.has(u.key));
190
+ function Xt(e, t, n = 1 / 0, r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set()) {
191
+ const s = n === 1 / 0 ? 1 / 0 : Math.max(0, Math.floor(Number(n) || 0)), i = e.slice(0, -1).filter((a) => t[a.name]?.keepAlive !== !1), u = new Set((s === 0 ? [] : i.slice(-s)).map((a) => a.key));
192
+ return e.filter((a, c) => c === e.length - 1 || (u.has(a.key) || o.has(a.key)) && !r.has(a.key));
62
193
  }
63
- function hn(e, t, n) {
64
- const r = new Set(t.map((a) => a.key)), o = new Set(e.slice(0, -1).filter((a) => n.has(a.key) || !r.has(a.key)).map((a) => a.key));
65
- return o.size === n.size && [...o].every((a) => n.has(a)) ? n : o;
194
+ function $n(e, t, n) {
195
+ const r = new Set(t.map((s) => s.key)), o = new Set(e.slice(0, -1).filter((s) => n.has(s.key) || !r.has(s.key)).map((s) => s.key));
196
+ return o.size === n.size && [...o].every((s) => n.has(s)) ? n : o;
66
197
  }
67
- function gn(e, t) {
198
+ function Dn(e, t) {
68
199
  const n = e.responsive;
69
200
  if (!n) return e;
70
- const { sm: r, md: o, lg: a, xl: l } = n;
71
- return { ...e, ...t < 768 ? r : t < 1024 ? o : t < 1280 ? a : l, ...e.runtimeLayout };
201
+ const { sm: r, md: o, lg: s, xl: i } = n;
202
+ return { ...e, ...t < 768 ? r : t < 1024 ? o : t < 1280 ? s : i, ...e.runtimeLayout };
72
203
  }
73
- function yn(e, t, n, r) {
204
+ function Kn(e, t, n, r) {
74
205
  const o = Math.max(0, Math.min(n ?? 1 / 0, r));
75
206
  return Math.min(o, Math.max(Math.min(t ?? 240, o), e));
76
207
  }
77
- const vn = Object.freeze({ sm: 400, md: 560, lg: 720, xl: 960, full: "100%" }), Ie = (e) => typeof e == "number" ? `${e}px` : e, It = () => {
208
+ function Hn(e) {
209
+ return [...e.querySelectorAll('a[href],button,input,textarea,select,[tabindex],[contenteditable="true"],summary')].filter((t) => t.tabIndex >= 0 && !t.matches(":disabled") && !t.closest('[inert], [hidden], [aria-hidden="true"]') && t.getClientRects().length > 0 && !["hidden", "collapse"].includes(getComputedStyle(t).visibility)).sort((t, n) => (t.tabIndex || 1 / 0) - (n.tabIndex || 1 / 0));
210
+ }
211
+ const Wn = Object.freeze({ sm: 400, md: 560, lg: 720, xl: 960, full: "100%" }), Ve = (e) => typeof e == "number" ? `${e}px` : e, Jt = () => {
78
212
  if (typeof document > "u") return "light";
79
213
  const e = document.documentElement, t = document.body;
80
214
  return e.classList.contains("dark") || t.classList.contains("dark") || e.dataset.theme === "dark" || t.dataset.theme === "dark" ? "dark" : e.classList.contains("light") || t.classList.contains("light") || e.dataset.theme === "light" || t.dataset.theme === "light" ? "light" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
81
215
  };
82
- let tt = 0;
83
- const Ke = [];
84
- let Mt = null;
85
- function bn() {
86
- if (tt++, tt === 1) {
87
- const t = document.documentElement, n = document.body, r = { html: t.style.overflow, body: n.style.overflow, padding: n.style.paddingRight, width: n.style.getPropertyValue("--modal-scrollbar-width") }, o = Math.max(0, window.innerWidth - t.clientWidth), a = parseFloat(getComputedStyle(n).paddingRight) || 0;
88
- o && (n.style.paddingRight = `${a + o}px`), n.style.setProperty("--modal-scrollbar-width", `${o}px`), t.style.overflow = "hidden", n.style.overflow = "hidden", Mt = () => {
216
+ let mt = 0;
217
+ const Xe = [];
218
+ let Bt = null;
219
+ function _n() {
220
+ if (mt++, mt === 1) {
221
+ const t = document.documentElement, n = document.body, r = { html: t.style.overflow, body: n.style.overflow, padding: n.style.paddingRight, width: n.style.getPropertyValue("--modal-scrollbar-width") }, o = Math.max(0, window.innerWidth - t.clientWidth), s = parseFloat(getComputedStyle(n).paddingRight) || 0;
222
+ o && (n.style.paddingRight = `${s + o}px`), n.style.setProperty("--modal-scrollbar-width", `${o}px`), t.style.overflow = "hidden", n.style.overflow = "hidden", Bt = () => {
89
223
  t.style.overflow = r.html, n.style.overflow = r.body, n.style.paddingRight = r.padding, r.width ? n.style.setProperty("--modal-scrollbar-width", r.width) : n.style.removeProperty("--modal-scrollbar-width");
90
224
  };
91
225
  }
92
226
  let e = !1;
93
227
  return () => {
94
- e || (e = !0, tt = Math.max(0, tt - 1), tt || (Mt?.(), Mt = null));
228
+ e || (e = !0, mt = Math.max(0, mt - 1), mt || (Bt?.(), Bt = null));
95
229
  };
96
230
  }
97
- const wn = 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])', kn = (e) => !e.closest('[inert], [hidden], [aria-hidden="true"]') && e.getClientRects().length > 0 && getComputedStyle(e).visibility !== "hidden" && getComputedStyle(e).display !== "none";
98
- function xn({ dialogRef: e, options: t, requestClose: n, children: r, exiting: o = !1 }) {
99
- const [a, l] = xe(() => typeof window > "u" ? 1024 : window.innerWidth), f = !!t.responsive;
100
- U(() => {
101
- if (!f) return;
102
- const O = () => l(window.innerWidth < 768 ? 0 : window.innerWidth < 1024 ? 768 : window.innerWidth < 1280 ? 1024 : 1280);
103
- return window.addEventListener("resize", O), O(), () => window.removeEventListener("resize", O);
104
- }, [f]), t = gn(t, a);
105
- const [u, i] = xe(null);
106
- U(() => i(null), [t.width, t.placement]);
107
- const d = P(null), g = P(0);
108
- U(() => () => {
231
+ function Un({ dialogRef: e, options: t, requestClose: n, children: r, exiting: o = !1 }) {
232
+ const [s, i] = Pe(() => typeof window > "u" ? 1024 : window.innerWidth), u = !!t.responsive;
233
+ ee(() => {
234
+ if (!u) return;
235
+ const P = () => i(window.innerWidth < 768 ? 0 : window.innerWidth < 1024 ? 768 : window.innerWidth < 1280 ? 1024 : 1280);
236
+ return window.addEventListener("resize", P), P(), () => window.removeEventListener("resize", P);
237
+ }, [u]), t = Dn(t, s);
238
+ const [a, c] = Pe(null);
239
+ ee(() => c(null), [t.width, t.placement]);
240
+ const d = G(null), g = G(0);
241
+ ee(() => () => {
109
242
  g.current && cancelAnimationFrame(g.current);
110
243
  }, []);
111
- const b = P(null), x = P(null), h = P(n);
244
+ const x = G(null), b = G(null), h = G(n);
112
245
  h.current = n;
113
- const s = P(t.closeOnEsc);
114
- s.current = t.closeOnEsc;
115
- const [v, I] = xe(It), z = t.theme === "light" || t.theme === "dark" ? t.theme : v;
116
- U(() => {
246
+ const l = G(t.closeOnEsc);
247
+ l.current = t.closeOnEsc;
248
+ const [y, C] = Pe(Jt), L = t.theme === "light" || t.theme === "dark" ? t.theme : y;
249
+ ee(() => {
117
250
  if (t.theme === "light" || t.theme === "dark") return;
118
- const O = () => I(It()), G = new MutationObserver(O);
119
- for (const Ce of [document.documentElement, document.body]) G.observe(Ce, { attributes: !0, attributeFilter: ["class", "data-theme"] });
120
- const ke = window.matchMedia?.("(prefers-color-scheme: dark)");
121
- return ke?.addEventListener?.("change", O), O(), () => {
122
- G.disconnect(), ke?.removeEventListener?.("change", O);
251
+ const P = () => C(Jt()), F = new MutationObserver(P);
252
+ for (const de of [document.documentElement, document.body]) F.observe(de, { attributes: !0, attributeFilter: ["class", "data-theme"] });
253
+ const Z = window.matchMedia?.("(prefers-color-scheme: dark)");
254
+ return Z?.addEventListener?.("change", P), P(), () => {
255
+ F.disconnect(), Z?.removeEventListener?.("change", P);
123
256
  };
124
- }, [t.theme]), U(() => {
125
- x.current = document.activeElement;
126
- const O = bn(), G = b.current;
127
- Ke.push(G), e.current?.focus({ preventScroll: !0 });
128
- const ke = (K) => {
129
- const de = e.current;
130
- if (!de || Ke.at(-1) !== G) return;
131
- if (K.key === "Escape" && s.current !== !1) {
132
- K.preventDefault(), h.current("escape");
257
+ }, [t.theme]), rn(() => {
258
+ b.current = document.activeElement;
259
+ }, []), ee(() => {
260
+ const P = _n(), F = x.current;
261
+ Xe.push(F), e.current?.focus({ preventScroll: !0 });
262
+ const Z = (te) => {
263
+ const v = e.current;
264
+ if (!v || Xe.at(-1) !== F || te.defaultPrevented || te.isComposing) return;
265
+ if (te.key === "Escape" && l.current !== !1) {
266
+ te.preventDefault(), h.current("escape");
133
267
  return;
134
268
  }
135
- if (K.key !== "Tab") return;
136
- const k = [...de.querySelectorAll(wn)].filter(kn);
137
- if (!k.length) {
138
- K.preventDefault(), de.focus();
269
+ if (te.key !== "Tab") return;
270
+ const H = Hn(v);
271
+ if (!H.length) {
272
+ te.preventDefault(), v.focus();
139
273
  return;
140
274
  }
141
- const ce = k[0], ne = k.at(-1);
142
- de.contains(document.activeElement) ? K.shiftKey && (document.activeElement === ce || document.activeElement === de) ? (K.preventDefault(), ne.focus()) : !K.shiftKey && (document.activeElement === ne || document.activeElement === de) && (K.preventDefault(), ce.focus()) : (K.preventDefault(), (K.shiftKey ? ne : ce).focus());
143
- }, Ce = (K) => {
144
- Ke.at(-1) === G && e.current && !e.current.contains(K.target) && e.current.focus({ preventScroll: !0 });
275
+ const ke = document.activeElement, xe = H.indexOf(ke), Ae = te.shiftKey ? -1 : 1;
276
+ if (H.some((Qe) => Qe.tabIndex > 0) || xe === -1 || (te.shiftKey ? xe === 0 : xe === H.length - 1)) {
277
+ te.preventDefault();
278
+ const Qe = xe === -1 ? te.shiftKey ? H.length - 1 : 0 : (xe + Ae + H.length) % H.length;
279
+ H[Qe].focus({ preventScroll: !0 });
280
+ }
281
+ }, de = (te) => {
282
+ Xe.at(-1) === F && e.current && !e.current.contains(te.target) && e.current.focus({ preventScroll: !0 });
145
283
  };
146
- return document.addEventListener("keydown", ke), document.addEventListener("focusin", Ce), () => {
147
- document.removeEventListener("keydown", ke), document.removeEventListener("focusin", Ce);
148
- const K = Ke.at(-1) === G, de = Ke.indexOf(G);
149
- if (de !== -1 && Ke.splice(de, 1), O(), K) {
150
- const k = x.current;
151
- k?.isConnected && !k.closest("[inert], [hidden]") ? k.focus?.({ preventScroll: !0 }) : Ke.at(-1)?.querySelector("[role=dialog]")?.focus?.({ preventScroll: !0 });
284
+ return document.addEventListener("keydown", Z), document.addEventListener("focusin", de), () => {
285
+ document.removeEventListener("keydown", Z), document.removeEventListener("focusin", de);
286
+ const te = Xe.at(-1) === F, v = Xe.indexOf(F);
287
+ if (v !== -1 && Xe.splice(v, 1), P(), te) {
288
+ const H = b.current;
289
+ H?.isConnected && !H.closest("[inert], [hidden]") ? H.focus?.({ preventScroll: !0 }) : Xe.at(-1)?.querySelector("[role=dialog]")?.focus?.({ preventScroll: !0 });
152
290
  }
153
291
  };
154
292
  }, [e]);
155
- const T = t.backgroundColor ?? t.backgroudColor, E = typeof T == "string" ? T : T?.[z], D = typeof E == "string" && /^(#|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|color|color-mix|light-dark|var)\(|transparent$|currentColor$|[a-z]+$)/i.test(E.trim()) ? E.trim() : null, L = typeof E == "string" && !D ? E.trim() : "", A = !!(D || L), q = ["center", "left", "right", "top", "bottom"].includes(t.placement) ? t.placement : "right", N = Ie(u ?? t.width ?? vn[t.size] ?? 460), Z = Ie(t.height), ue = Ie(t.maxHeight), C = Ie(t.maxWidth), F = Number(t.viewportGap ?? 5), $ = Number.isFinite(F) ? Math.max(0, F) : 5, X = t.top == null ? null : Ie(t.top), B = q !== "bottom" && X !== null ? X : null, te = typeof t.borderRadius == "number" ? `${t.borderRadius}px` : t.borderRadius ?? "12px", V = t.resizable && !t.fullscreen && ["left", "right"].includes(q), oe = (O) => yn(O, t.minWidth, typeof t.maxWidth == "number" ? t.maxWidth : void 0, b.current?.clientWidth - $ * 2 || window.innerWidth), J = (O) => {
156
- !d.current || d.current.id !== O.pointerId || (cancelAnimationFrame(g.current), i(d.current.width), e.current?.style.removeProperty("--pmn-drag-width"), d.current = null);
293
+ const S = t.backgroundColor ?? t.backgroudColor, j = typeof S == "string" ? S : S?.[L], D = typeof j == "string" && /^(#|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|color|color-mix|light-dark|var)\(|transparent$|currentColor$|[a-z]+$)/i.test(j.trim()) ? j.trim() : null, R = typeof j == "string" && !D ? j.trim() : "", k = !!(D || R), O = ["center", "left", "right", "top", "bottom"].includes(t.placement) ? t.placement : "right", A = Ve(a ?? t.width ?? Wn[t.size] ?? 460), N = Ve(t.height), W = Ve(t.maxHeight), Q = Ve(t.maxWidth), ne = Number(t.viewportGap ?? 5), re = Number.isFinite(ne) ? Math.max(0, ne) : 5, I = t.top == null ? null : Ve(t.top), _ = O !== "bottom" && I !== null ? I : null, le = typeof t.borderRadius == "number" ? `${t.borderRadius}px` : t.borderRadius ?? "12px", E = t.resizable && !t.fullscreen && ["left", "right"].includes(O), z = (P) => Kn(P, t.minWidth, typeof t.maxWidth == "number" ? t.maxWidth : void 0, x.current?.clientWidth - re * 2 || window.innerWidth), K = (P) => {
294
+ !d.current || d.current.id !== P.pointerId || (cancelAnimationFrame(g.current), c(d.current.width), e.current?.style.removeProperty("--pmn-drag-width"), d.current = null);
157
295
  };
158
- return pn(/* @__PURE__ */ p(
296
+ return zn(/* @__PURE__ */ m(
159
297
  "div",
160
298
  {
161
- ref: b,
162
- className: `pmn-overlay ${o ? "pmn-exiting" : "pmn-entering"} ${t.animation === !1 ? "pmn-no-animation" : ""} pmn-place-${q} ${t.fullscreen ? "pmn-fullscreen" : ""} ${t.mobileFullscreen ? "pmn-mobile-fullscreen" : ""}`,
163
- style: { padding: $, ...t.bottom != null ? { paddingBottom: Ie(t.bottom) } : {}, ...t.left != null ? { paddingLeft: Ie(t.left) } : {}, ...t.right != null ? { paddingRight: Ie(t.right) } : {}, ...B !== null ? { paddingTop: B, "--pmn-top-offset": B } : {}, "--pmn-animation-duration": `${Math.min(1e3, Math.max(0, Number(t.animationDuration ?? 220) || 0))}ms` },
164
- onMouseDown: (O) => {
165
- O.target === O.currentTarget && t.closeOnOverlay === !0 && h.current("overlay");
299
+ ref: x,
300
+ className: `pmn-overlay ${o ? "pmn-exiting" : "pmn-entering"} ${t.animation === !1 ? "pmn-no-animation" : ""} pmn-place-${O} ${t.fullscreen ? "pmn-fullscreen" : ""} ${t.mobileFullscreen ? "pmn-mobile-fullscreen" : ""}`,
301
+ style: { padding: re, ...t.bottom != null ? { paddingBottom: Ve(t.bottom) } : {}, ...t.left != null ? { paddingLeft: Ve(t.left) } : {}, ...t.right != null ? { paddingRight: Ve(t.right) } : {}, ..._ !== null ? { paddingTop: _, "--pmn-top-offset": _ } : {}, "--pmn-animation-duration": `${Math.min(1e3, Math.max(0, Number(t.animationDuration ?? 220) || 0))}ms` },
302
+ onMouseDown: (P) => {
303
+ P.target === P.currentTarget && t.closeOnOverlay === !0 && h.current("overlay");
166
304
  },
167
- children: /* @__PURE__ */ be(
305
+ children: /* @__PURE__ */ Me(
168
306
  "section",
169
307
  {
170
308
  ref: e,
@@ -172,36 +310,36 @@ function xn({ dialogRef: e, options: t, requestClose: n, children: r, exiting: o
172
310
  role: "dialog",
173
311
  "aria-modal": "true",
174
312
  "aria-label": t.ariaLabel ?? "Dialog",
175
- "data-modal-theme": z,
176
- className: `pmn-dialog ${z === "dark" ? "dark" : ""} ${A ? "pmn-has-custom-background" : ""} ${t.className ?? ""}`,
177
- style: { "--pmn-width": N, "--pmn-gap": `${$}px`, ...B !== null ? { "--pmn-top-offset": B } : {}, ...Z !== void 0 ? { "--pmn-height": Z } : {}, ...ue !== void 0 ? { "--pmn-max-height": ue } : {}, ...C !== void 0 ? { "--pmn-max-width": C } : {}, borderRadius: te },
313
+ "data-modal-theme": L,
314
+ className: `pmn-dialog ${L === "dark" ? "dark" : ""} ${k ? "pmn-has-custom-background" : ""} ${t.className ?? ""}`,
315
+ style: { "--pmn-width": A, "--pmn-gap": `${re}px`, ..._ !== null ? { "--pmn-top-offset": _ } : {}, ...N !== void 0 ? { "--pmn-height": N } : {}, ...W !== void 0 ? { "--pmn-max-height": W } : {}, ...Q !== void 0 ? { "--pmn-max-width": Q } : {}, borderRadius: le },
178
316
  children: [
179
- A && /* @__PURE__ */ p("div", { "aria-hidden": "true", className: `pmn-custom-background-layer ${L}`, style: D ? { backgroundColor: D } : void 0 }),
317
+ k && /* @__PURE__ */ m("div", { "aria-hidden": "true", className: `pmn-custom-background-layer ${R}`, style: D ? { backgroundColor: D } : void 0 }),
180
318
  r,
181
- V && /* @__PURE__ */ p(
319
+ E && /* @__PURE__ */ m(
182
320
  "div",
183
321
  {
184
322
  role: "separator",
185
323
  "aria-label": "调整弹窗宽度",
186
324
  "aria-orientation": "vertical",
187
325
  tabIndex: 0,
188
- className: `pmn-resize-handle pmn-resize-${q}`,
189
- onKeyDown: (O) => {
190
- ["ArrowLeft", "ArrowRight"].includes(O.key) && (O.preventDefault(), i(oe(e.current.getBoundingClientRect().width + (O.key === "ArrowRight" ? 16 : -16) * (q === "left" ? 1 : -1))));
326
+ className: `pmn-resize-handle pmn-resize-${O}`,
327
+ onKeyDown: (P) => {
328
+ ["ArrowLeft", "ArrowRight"].includes(P.key) && (P.preventDefault(), c(z(e.current.getBoundingClientRect().width + (P.key === "ArrowRight" ? 16 : -16) * (O === "left" ? 1 : -1))));
191
329
  },
192
- onPointerDown: (O) => {
193
- if (O.button !== 0) return;
194
- O.preventDefault(), O.currentTarget.setPointerCapture(O.pointerId);
195
- const G = e.current.getBoundingClientRect().width;
196
- d.current = { id: O.pointerId, x: O.clientX, start: G, width: G };
330
+ onPointerDown: (P) => {
331
+ if (P.button !== 0) return;
332
+ P.preventDefault(), P.currentTarget.setPointerCapture(P.pointerId);
333
+ const F = e.current.getBoundingClientRect().width;
334
+ d.current = { id: P.pointerId, x: P.clientX, start: F, width: F };
197
335
  },
198
- onPointerMove: (O) => {
199
- const G = d.current;
200
- !G || G.id !== O.pointerId || (G.width = oe(G.start + (O.clientX - G.x) * (q === "left" ? 1 : -1)), cancelAnimationFrame(g.current), g.current = requestAnimationFrame(() => e.current?.style.setProperty("--pmn-drag-width", `${G.width}px`)));
336
+ onPointerMove: (P) => {
337
+ const F = d.current;
338
+ !F || F.id !== P.pointerId || (F.width = z(F.start + (P.clientX - F.x) * (O === "left" ? 1 : -1)), cancelAnimationFrame(g.current), g.current = requestAnimationFrame(() => e.current?.style.setProperty("--pmn-drag-width", `${F.width}px`)));
201
339
  },
202
- onPointerUp: J,
203
- onPointerCancel: J,
204
- onLostPointerCapture: J
340
+ onPointerUp: K,
341
+ onPointerCancel: K,
342
+ onLostPointerCapture: K
205
343
  }
206
344
  )
207
345
  ]
@@ -210,155 +348,155 @@ function xn({ dialogRef: e, options: t, requestClose: n, children: r, exiting: o
210
348
  }
211
349
  ), document.body);
212
350
  }
213
- const Sn = (e) => e;
214
- function Pe(e, t = Sn, n = Object.is) {
215
- const r = P({ store: null, initialized: !1, selection: void 0 }), o = Q(() => {
216
- let l = !1, f, u;
351
+ const Vn = (e) => e;
352
+ function Fe(e, t = Vn, n = Object.is) {
353
+ const r = G({ store: null, initialized: !1, selection: void 0 }), o = V(() => {
354
+ let i = !1, u, a;
217
355
  return () => {
218
- const i = e.getSnapshot();
219
- if (l && Object.is(f, i)) return u;
220
- const d = t(i);
221
- if (l)
222
- n(u, d) || (u = d);
356
+ const c = e.getSnapshot();
357
+ if (i && Object.is(u, c)) return a;
358
+ const d = t(c);
359
+ if (i)
360
+ n(a, d) || (a = d);
223
361
  else {
224
362
  const g = r.current;
225
- u = g.initialized && g.store === e && n(g.selection, d) ? g.selection : d;
363
+ a = g.initialized && g.store === e && n(g.selection, d) ? g.selection : d;
226
364
  }
227
- return f = i, l = !0, u;
365
+ return u = c, i = !0, a;
228
366
  };
229
- }, [e, t, n]), a = Oe(e.subscribe, o, o);
230
- return U(() => {
231
- r.current = { store: e, initialized: !0, selection: a };
232
- }, [e, a]), a;
367
+ }, [e, t, n]), s = Ee(e.subscribe, o, o);
368
+ return ee(() => {
369
+ r.current = { store: e, initialized: !0, selection: s };
370
+ }, [e, s]), s;
233
371
  }
234
- function He(e, t) {
372
+ function Ye(e, t) {
235
373
  if (Object.is(e, t)) return !0;
236
374
  if (!e || !t || typeof e != "object" || typeof t != "object") return !1;
237
375
  const n = Object.keys(e);
238
376
  return n.length === Object.keys(t).length && n.every((r) => Object.hasOwn(t, r) && Object.is(e[r], t[r]));
239
377
  }
240
- const Ye = (e) => (t) => Object.fromEntries(e.map((n) => [n, t[n]])), Cn = Ye(["pageAnimationDuration", "pageAnimationDistance", "pageAnimation", "animation", "lockCloseWhileLoading", "maxCachedScreens", "bodyClassName", "lazyFallback", "onBlur", "onNavigate", "onRouteChange", "onFocus"]), En = Ye(["bodyClassName", "lazyFallback"]), Rn = Ye(["showHeader", "showTitle", "renderHeader", "renderHeaderRight", "showHeaderBorder", "headerClassName", "showBackButton", "showCloseButton"]), Qt = Ye(["showFooter", "renderFooter", "done", "cancel", "cancle", "showFooterBorder", "footerClassName", "actions", "loadingText", "cancelText", "doneText", "doneDisabled"]), Mn = Ye(["fullscreenable", "fullscreen"]), At = ["responsive", "width", "height", "maxWidth", "maxHeight", "minWidth", "size", "placement", "viewportGap", "top", "bottom", "left", "right", "borderRadius", "resizable", "fullscreen", "mobileFullscreen", "animation", "animationDuration", "closeOnEsc", "closeOnOverlay", "theme", "backgroundColor", "backgroudColor", "ariaLabel", "className"], On = Ye(At);
241
- function Pn(e, t) {
378
+ const it = (e) => (t) => Object.fromEntries(e.map((n) => [n, t[n]])), Yn = it(["pageAnimationDuration", "pageAnimationDistance", "pageAnimation", "animation", "lockCloseWhileLoading", "maxCachedScreens", "bodyClassName", "lazyFallback", "onBlur", "onNavigate", "onRouteChange", "onFocus"]), Qn = it(["bodyClassName", "lazyFallback"]), Zn = it(["showHeader", "showTitle", "renderHeader", "renderHeaderRight", "showHeaderBorder", "headerClassName", "showBackButton", "showCloseButton"]), hn = it(["showFooter", "renderFooter", "done", "cancel", "cancle", "showFooterBorder", "footerClassName", "actions", "loadingText", "cancelText", "doneText", "doneDisabled"]), Xn = it(["fullscreenable", "fullscreen"]), _t = ["responsive", "width", "height", "maxWidth", "maxHeight", "minWidth", "size", "placement", "viewportGap", "top", "bottom", "left", "right", "borderRadius", "resizable", "fullscreen", "mobileFullscreen", "animation", "animationDuration", "closeOnEsc", "closeOnOverlay", "theme", "backgroundColor", "backgroudColor", "ariaLabel", "className"], Jn = it(_t);
379
+ function er(e, t) {
242
380
  const n = { ...e, ...t, ...e.runtimeLayout };
243
- return { ...On(n), runtimeLayout: Object.fromEntries(At.filter((r) => Object.hasOwn(e.runtimeLayout ?? {}, r)).map((r) => [r, e.runtimeLayout[r]])) };
244
- }
245
- function Tn(e, t) {
246
- return He(e.runtimeLayout, t.runtimeLayout) && At.every((n) => Object.is(e[n], t[n]));
247
- }
248
- const Zt = {}, Ln = () => Zt, zn = () => () => {
249
- }, An = Se.memo(function({ action: t, context: n }) {
250
- const r = P(!1), [o, a] = xe(!1), l = P(!1);
251
- return U(() => (l.current = !0, () => {
252
- l.current = !1;
253
- }), []), /* @__PURE__ */ p("button", { type: "button", className: "pmn-icon-button", "aria-label": t.tooltip ?? t.key, title: t.tooltip, disabled: o || t.disabled || t.loading, onClick: async () => {
254
- if (!(r.current || !l.current || t.disabled || t.loading)) {
255
- r.current = !0, a(!0);
381
+ return { ...Jn(n), runtimeLayout: Object.fromEntries(_t.filter((r) => Object.hasOwn(e.runtimeLayout ?? {}, r)).map((r) => [r, e.runtimeLayout[r]])) };
382
+ }
383
+ function tr(e, t) {
384
+ return Ye(e.runtimeLayout, t.runtimeLayout) && _t.every((n) => Object.is(e[n], t[n]));
385
+ }
386
+ const gn = {}, nr = () => gn, rr = () => () => {
387
+ }, or = Oe.memo(function({ action: t, context: n }) {
388
+ const r = G(!1), [o, s] = Pe(!1), i = G(!1);
389
+ return ee(() => (i.current = !0, () => {
390
+ i.current = !1;
391
+ }), []), /* @__PURE__ */ m("button", { type: "button", className: "pmn-icon-button", "aria-label": t.tooltip ?? t.key, title: t.tooltip, disabled: o || t.disabled || t.loading, onClick: async () => {
392
+ if (!(r.current || !i.current || t.disabled || t.loading)) {
393
+ r.current = !0, s(!0);
256
394
  try {
257
395
  await t.onClick?.(n);
258
- } catch (f) {
259
- console.error("[react-modal-navigation] header action", f);
396
+ } catch (u) {
397
+ console.error("[react-modal-navigation] header action", u);
260
398
  } finally {
261
- r.current = !1, l.current && a(!1);
399
+ r.current = !1, i.current && s(!1);
262
400
  }
263
401
  }
264
402
  }, children: o ? "…" : t.icon ?? t.label });
265
403
  });
266
- function Dt({ back: e }) {
267
- return /* @__PURE__ */ p("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "2", children: e ? /* @__PURE__ */ p("path", { d: "m15 18-6-6 6-6" }) : /* @__PURE__ */ p("path", { d: "M18 6 6 18M6 6l12 12" }) });
404
+ function en({ back: e }) {
405
+ return /* @__PURE__ */ m("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "2", children: e ? /* @__PURE__ */ m("path", { d: "m15 18-6-6 6-6" }) : /* @__PURE__ */ m("path", { d: "M18 6 6 18M6 6l12 12" }) });
268
406
  }
269
- function Nn({ options: e, screen: t, route: n, navigation: r, requestClose: o, translate: a, canGoBack: l }) {
270
- const f = ee(yt), u = () => f?.getSnapshot()[n.key] ?? Zt, i = Oe(f?.subscribe ?? zn, u, Ln);
271
- t = { ...t, ...i };
272
- const d = a ?? ((v) => v), g = t.showTitle ?? e.showTitle ?? !0, b = typeof t.title == "function" ? t.title({ t: d, route: n, navigation: r }) : t.title ?? n.name, x = Q(() => ({ route: n, navigation: r, close: o, canGoBack: l, title: b, t: d }), [n, r, o, l, b, d]);
407
+ function sr({ options: e, screen: t, route: n, navigation: r, requestClose: o, translate: s, canGoBack: i }) {
408
+ const u = Y(Lt), a = () => u?.getSnapshot()[n.key] ?? gn, c = Ee(u?.subscribe ?? rr, a, nr);
409
+ t = { ...t, ...c };
410
+ const d = s ?? ((y) => y), g = t.showTitle ?? e.showTitle ?? !0, x = typeof t.title == "function" ? t.title({ t: d, route: n, navigation: r }) : t.title ?? n.name, b = V(() => ({ route: n, navigation: r, close: o, canGoBack: i, title: x, t: d }), [n, r, o, i, x, d]);
273
411
  if (e.showHeader === !1) return null;
274
412
  const h = t.renderHeader ?? e.renderHeader;
275
- if (h) return h(x);
276
- const s = t.renderHeaderRight ?? e.renderHeaderRight;
277
- return /* @__PURE__ */ be("header", { className: `pmn-header ${t.showHeaderBorder ?? e.showHeaderBorder ? "pmn-border-bottom" : ""} ${e.headerClassName ?? ""}`, children: [
278
- (t.showBackButton ?? e.showBackButton) !== !1 && l && /* @__PURE__ */ p("button", { type: "button", className: "pmn-icon-button", "aria-label": d("modal.back"), onClick: () => r.goBack(), children: /* @__PURE__ */ p(Dt, { back: !0 }) }),
279
- g ? /* @__PURE__ */ p("h2", { children: b }) : /* @__PURE__ */ p("div", { className: "pmn-header-spacer" }),
280
- s?.(x),
281
- i.actions?.filter((v) => !v.hidden).map((v) => /* @__PURE__ */ p(An, { action: v, context: x }, `${n.key}:${v.key}`)),
282
- /* @__PURE__ */ p(jn, { hidden: t.showFullscreenButton === !1 }),
283
- (t.showCloseButton ?? e.showCloseButton) !== !1 && /* @__PURE__ */ p("button", { type: "button", className: "pmn-icon-button", "aria-label": d("modal.close"), onClick: () => o("header"), children: /* @__PURE__ */ p(Dt, {}) })
413
+ if (h) return h(b);
414
+ const l = t.renderHeaderRight ?? e.renderHeaderRight;
415
+ return /* @__PURE__ */ Me("header", { className: `pmn-header ${t.showHeaderBorder ?? e.showHeaderBorder ? "pmn-border-bottom" : ""} ${e.headerClassName ?? ""}`, children: [
416
+ (t.showBackButton ?? e.showBackButton) !== !1 && i && /* @__PURE__ */ m("button", { type: "button", className: "pmn-icon-button", "aria-label": d("modal.back"), onClick: () => r.goBack(), children: /* @__PURE__ */ m(en, { back: !0 }) }),
417
+ g ? /* @__PURE__ */ m("h2", { children: x }) : /* @__PURE__ */ m("div", { className: "pmn-header-spacer" }),
418
+ l?.(b),
419
+ c.actions?.filter((y) => !y.hidden).map((y) => /* @__PURE__ */ m(or, { action: y, context: b }, `${n.key}:${y.key}`)),
420
+ /* @__PURE__ */ m(ar, { hidden: t.showFullscreenButton === !1 }),
421
+ (t.showCloseButton ?? e.showCloseButton) !== !1 && /* @__PURE__ */ m("button", { type: "button", className: "pmn-icon-button", "aria-label": d("modal.close"), onClick: () => o("header"), children: /* @__PURE__ */ m(en, {}) })
284
422
  ] });
285
423
  }
286
- const jn = Se.memo(function({ hidden: t }) {
287
- const n = ee(Lt), r = ee(at), o = Pe(r.stores.layout, Mn, He);
288
- return t || !o.fullscreenable ? null : /* @__PURE__ */ p("button", { type: "button", className: "pmn-icon-button", "aria-label": o.fullscreen ? "还原" : "全屏", onClick: n?.toggleFullscreen, children: /* @__PURE__ */ p("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ p("path", { d: o.fullscreen ? "M3 9h6V3 M21 9h-6V3 M3 15h6v6 M21 15h-6v6" : "M3 9V3h6 M15 3h6v6 M3 15v6h6 M15 21h6v-6" }) }) });
289
- }), Xt = rt(function({ store: t, screenOptions: n, ...r }) {
290
- const o = _((l) => Pn(l, n), [n]), a = Pe(t, o, Tn);
291
- return /* @__PURE__ */ p(xn, { ...r, options: a });
292
- }), Jt = rt(function({ store: t, ...n }) {
293
- const r = Pe(t, Rn, He);
294
- return /* @__PURE__ */ p(Nn, { ...n, options: r });
295
- }), Bn = Se.memo(function({ action: t, context: n, loadingApi: r, onError: o, loadingText: a }) {
296
- const l = P(!1), [f, u] = xe(!1), i = P(!1);
297
- U(() => (i.current = !0, () => {
298
- i.current = !1;
424
+ const ar = Oe.memo(function({ hidden: t }) {
425
+ const n = Y(Dt), r = Y(We), o = Fe(r.stores.layout, Xn, Ye);
426
+ return t || !o.fullscreenable ? null : /* @__PURE__ */ m("button", { type: "button", className: "pmn-icon-button", "aria-label": o.fullscreen ? "还原" : "全屏", onClick: n?.toggleFullscreen, children: /* @__PURE__ */ m("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ m("path", { d: o.fullscreen ? "M3 9h6V3 M21 9h-6V3 M3 15h6v6 M21 15h-6v6" : "M3 9V3h6 M15 3h6v6 M3 15v6h6 M15 21h6v-6" }) }) });
427
+ }), yn = pt(function({ store: t, screenOptions: n, ...r }) {
428
+ const o = X((i) => er(i, n), [n]), s = Fe(t, o, tr);
429
+ return /* @__PURE__ */ m(Un, { ...r, options: s });
430
+ }), vn = pt(function({ store: t, ...n }) {
431
+ const r = Fe(t, Zn, Ye);
432
+ return /* @__PURE__ */ m(sr, { ...n, options: r });
433
+ }), ir = Oe.memo(function({ action: t, context: n, loadingApi: r, onError: o, loadingText: s }) {
434
+ const i = G(!1), [u, a] = Pe(!1), c = G(!1);
435
+ ee(() => (c.current = !0, () => {
436
+ c.current = !1;
299
437
  }), []);
300
- const d = f || t.loading === !0, g = t.loadingText ?? a ?? n.t("modal.processing"), b = async () => {
301
- if (!i.current || l.current || t.disabled || t.loading || typeof t.onClick != "function") return;
302
- l.current = !0, u(!0);
303
- const x = r?.begin(n.route.key, g);
438
+ const d = u || t.loading === !0, g = t.loadingText ?? s ?? n.t("modal.processing"), x = async () => {
439
+ if (!c.current || i.current || t.disabled || t.loading || typeof t.onClick != "function") return;
440
+ i.current = !0, a(!0);
441
+ const b = r?.begin(n.route.key, g);
304
442
  try {
305
443
  await t.onClick(n);
306
444
  } catch (h) {
307
445
  o?.(h, { phase: "footer", action: t.key, route: n.route });
308
446
  } finally {
309
- x != null && r?.end(n.route.key, x), l.current = !1, i.current && u(!1);
447
+ b != null && r?.end(n.route.key, b), i.current = !1, c.current && a(!1);
310
448
  }
311
449
  };
312
- return /* @__PURE__ */ p(
450
+ return /* @__PURE__ */ m(
313
451
  "button",
314
452
  {
315
453
  type: "button",
316
454
  disabled: t.disabled === !0 || d,
317
455
  className: `pmn-button ${t.variant === "primary" || t.variant === "danger" ? "pmn-button-primary" : "pmn-button-secondary"} ${t.variant === "danger" ? "pmn-button-danger" : ""}`,
318
- onClick: b,
456
+ onClick: x,
319
457
  children: d ? g : t.label
320
458
  }
321
459
  );
322
460
  });
323
- function en({ screen: e, options: t, override: n, route: r, navigation: o, requestClose: a, translate: l, onError: f, loadingApi: u }) {
324
- const [i, d] = xe(null), g = P(/* @__PURE__ */ new Set()), b = P(!0);
325
- U(() => (b.current = !0, () => {
326
- b.current = !1;
461
+ function bn({ screen: e, options: t, override: n, route: r, navigation: o, requestClose: s, translate: i, onError: u, loadingApi: a }) {
462
+ const [c, d] = Pe(null), g = G(/* @__PURE__ */ new Set()), x = G(!0);
463
+ ee(() => (x.current = !0, () => {
464
+ x.current = !1;
327
465
  }), []);
328
- const x = l ?? ((N) => N), h = { ...t, ...e, ...n }, { showFooter: s, renderFooter: v, done: I, cancel: z, cancle: T } = h, E = z ?? T, D = Q(() => ({ route: r, navigation: o, close: a, t: x }), [r, o, a, x]);
329
- if (s === !1) return null;
330
- const L = `pmn-footer ${h.showFooterBorder ? "pmn-border-top" : ""} ${h.footerClassName ?? ""}`;
331
- if (typeof v == "function") return /* @__PURE__ */ p("footer", { className: L, children: v({ ...D, pending: g.current.size > 0 }) });
332
- const A = Array.isArray(h.actions) ? h.actions : null;
333
- if (!A && typeof I != "function" && typeof E != "function") return null;
334
- const q = async (N, Z, ue) => {
335
- if (!b.current || g.current.size > 0 || g.current.has(N) || typeof Z != "function") return;
336
- g.current.add(N), d(N);
337
- const C = u?.begin(r.key, h.loadingText ?? x("modal.processing"));
466
+ const b = i ?? ((A) => A), h = { ...t, ...e, ...n }, { showFooter: l, renderFooter: y, done: C, cancel: L, cancle: S } = h, j = L ?? S, D = V(() => ({ route: r, navigation: o, close: s, t: b }), [r, o, s, b]);
467
+ if (l === !1) return null;
468
+ const R = `pmn-footer ${h.showFooterBorder ? "pmn-border-top" : ""} ${h.footerClassName ?? ""}`;
469
+ if (typeof y == "function") return /* @__PURE__ */ m("footer", { className: R, children: y({ ...D, pending: g.current.size > 0 }) });
470
+ const k = Array.isArray(h.actions) ? h.actions : null;
471
+ if (!k && typeof C != "function" && typeof j != "function") return null;
472
+ const O = async (A, N, W) => {
473
+ if (!x.current || g.current.size > 0 || g.current.has(A) || typeof N != "function") return;
474
+ g.current.add(A), d(A);
475
+ const Q = a?.begin(r.key, h.loadingText ?? b("modal.processing"));
338
476
  try {
339
- await Z(D);
340
- } catch (F) {
341
- f?.(F, { phase: "footer", action: N, route: r });
477
+ await N(D);
478
+ } catch (ne) {
479
+ u?.(ne, { phase: "footer", action: A, route: r });
342
480
  } finally {
343
- C != null && u?.end(r.key, C), g.current.delete(N), b.current && d((F) => F === N ? null : F);
481
+ Q != null && a?.end(r.key, Q), g.current.delete(A), x.current && d((ne) => ne === A ? null : ne);
344
482
  }
345
483
  };
346
- return A ? /* @__PURE__ */ p("footer", { className: L, children: A.filter((N) => !N.hidden).map(
347
- (N) => /* @__PURE__ */ p(Bn, { action: N, context: D, loadingApi: u, onError: f, loadingText: h.loadingText }, `${r.key}:${N.key}`)
348
- ) }) : /* @__PURE__ */ be("footer", { className: L, children: [
349
- typeof E == "function" && /* @__PURE__ */ p("button", { type: "button", disabled: i !== null, onClick: () => q("cancel", E), className: "pmn-button pmn-button-secondary", children: h.cancelText ?? x("modal.cancel") }),
350
- typeof I == "function" && /* @__PURE__ */ p("button", { type: "button", disabled: i !== null || h.doneDisabled === !0, onClick: () => q("done", I), className: "pmn-button pmn-button-primary", children: i === "done" ? h.loadingText ?? x("modal.processing") : h.doneText ?? x("modal.done") })
484
+ return k ? /* @__PURE__ */ m("footer", { className: R, children: k.filter((A) => !A.hidden).map(
485
+ (A) => /* @__PURE__ */ m(ir, { action: A, context: D, loadingApi: a, onError: u, loadingText: h.loadingText }, `${r.key}:${A.key}`)
486
+ ) }) : /* @__PURE__ */ Me("footer", { className: R, children: [
487
+ typeof j == "function" && /* @__PURE__ */ m("button", { type: "button", disabled: c !== null, onClick: () => O("cancel", j), className: "pmn-button pmn-button-secondary", children: h.cancelText ?? b("modal.cancel") }),
488
+ typeof C == "function" && /* @__PURE__ */ m("button", { type: "button", disabled: c !== null || h.doneDisabled === !0, onClick: () => O("done", C), className: "pmn-button pmn-button-primary", children: c === "done" ? h.loadingText ?? b("modal.processing") : h.doneText ?? b("modal.done") })
351
489
  ] });
352
490
  }
353
- function tn({ loading: e, translate: t }) {
491
+ function wn({ loading: e, translate: t }) {
354
492
  if (!e.visible) return null;
355
- const r = (t ?? ((a) => a))("modal.loading"), o = e.text ?? (r === "modal.loading" ? "加载中..." : r);
356
- return /* @__PURE__ */ p("div", { className: "pmn-loading-overlay", role: "status", "aria-live": "polite", "aria-busy": "true", children: /* @__PURE__ */ be("div", { className: "pmn-loading-content", children: [
357
- /* @__PURE__ */ p("span", { className: "pmn-spinner", "aria-hidden": "true" }),
358
- o && /* @__PURE__ */ p("span", { className: "pmn-loading-text", children: o })
493
+ const r = (t ?? ((s) => s))("modal.loading"), o = e.text ?? (r === "modal.loading" ? "加载中..." : r);
494
+ return /* @__PURE__ */ m("div", { className: "pmn-loading-overlay", role: "status", "aria-live": "polite", "aria-busy": "true", children: /* @__PURE__ */ Me("div", { className: "pmn-loading-content", children: [
495
+ /* @__PURE__ */ m("span", { className: "pmn-spinner", "aria-hidden": "true" }),
496
+ o && /* @__PURE__ */ m("span", { className: "pmn-loading-text", children: o })
359
497
  ] }) });
360
498
  }
361
- class Nt extends Se.Component {
499
+ class Tt extends Oe.Component {
362
500
  state = { error: null };
363
501
  static getDerivedStateFromError(t) {
364
502
  return { error: t };
@@ -370,65 +508,65 @@ class Nt extends Se.Component {
370
508
  t.route?.key !== this.props.route?.key && this.state.error && this.setState({ error: null });
371
509
  }
372
510
  render() {
373
- return this.state.error ? /* @__PURE__ */ be("div", { role: "alert", className: "pmn-error-screen", children: [
374
- /* @__PURE__ */ p("strong", { children: "页面加载失败" }),
375
- /* @__PURE__ */ p("p", { children: this.state.error.message }),
376
- /* @__PURE__ */ p("button", { type: "button", className: "pmn-button pmn-button-secondary", onClick: () => {
511
+ return this.state.error ? /* @__PURE__ */ Me("div", { role: "alert", className: "pmn-error-screen", children: [
512
+ /* @__PURE__ */ m("strong", { children: "页面加载失败" }),
513
+ /* @__PURE__ */ m("p", { children: this.state.error.message }),
514
+ /* @__PURE__ */ m("button", { type: "button", className: "pmn-button pmn-button-secondary", onClick: () => {
377
515
  this.props.onRetry?.(), this.setState({ error: null });
378
516
  }, children: "重试" })
379
517
  ] }) : this.props.children;
380
518
  }
381
519
  }
382
- const qn = { success: "✓", error: "×", warning: "!", info: "i" };
383
- function nn({ items: e, dismiss: t }) {
384
- return e.length ? /* @__PURE__ */ p("div", { className: "pmn-toast-region", "aria-label": "Notifications", children: e.map((n) => /* @__PURE__ */ be("div", { className: `pmn-toast pmn-toast-${n.type}`, role: n.type === "error" || n.type === "warning" ? "alert" : "status", children: [
385
- /* @__PURE__ */ p("span", { className: "pmn-toast-symbol", "aria-hidden": "true", children: qn[n.type] }),
386
- /* @__PURE__ */ p("span", { className: "pmn-toast-message", children: n.message }),
387
- n.dismissible && /* @__PURE__ */ p("button", { type: "button", className: "pmn-toast-close", "aria-label": "Dismiss notification", onClick: () => t(n.id), children: "×" })
520
+ const cr = { success: "✓", error: "×", warning: "!", info: "i" };
521
+ function kn({ items: e, dismiss: t }) {
522
+ return e.length ? /* @__PURE__ */ m("div", { className: "pmn-toast-region", "aria-label": "Notifications", children: e.map((n) => /* @__PURE__ */ Me("div", { className: `pmn-toast pmn-toast-${n.type}`, role: n.type === "error" || n.type === "warning" ? "alert" : "status", children: [
523
+ /* @__PURE__ */ m("span", { className: "pmn-toast-symbol", "aria-hidden": "true", children: cr[n.type] }),
524
+ /* @__PURE__ */ m("span", { className: "pmn-toast-message", children: n.message }),
525
+ n.dismissible && /* @__PURE__ */ m("button", { type: "button", className: "pmn-toast-close", "aria-label": "Dismiss notification", onClick: () => t(n.id), children: "×" })
388
526
  ] }, n.id)) }) : null;
389
527
  }
390
- function rn(e, t, n) {
391
- const r = P(0), o = P(/* @__PURE__ */ new Map()), a = _((u) => {
392
- clearTimeout(o.current.get(u)), o.current.delete(u), t.current && e.current.publish(e.current.getSnapshot().filter((i) => i.id !== u));
393
- }, []), l = _((u, i = {}) => {
394
- if (typeof u != "string" || !u.trim()) throw new TypeError("[react-modal-navigation] toast message must be a non-empty string");
395
- const d = typeof i == "string" ? { type: i } : i ?? {}, g = ["success", "error", "warning", "info"].includes(d.type) ? d.type : "info", b = ++r.current, x = Number.isFinite(d.duration) ? Math.max(0, d.duration) : 3e3;
528
+ function xn(e, t, n) {
529
+ const r = G(0), o = G(/* @__PURE__ */ new Map()), s = X((a) => {
530
+ clearTimeout(o.current.get(a)), o.current.delete(a), t.current && e.current.publish(e.current.getSnapshot().filter((c) => c.id !== a));
531
+ }, []), i = X((a, c = {}) => {
532
+ if (typeof a != "string" || !a.trim()) throw new TypeError("[react-modal-navigation] toast message must be a non-empty string");
533
+ const d = typeof c == "string" ? { type: c } : c ?? {}, g = ["success", "error", "warning", "info"].includes(d.type) ? d.type : "info", x = ++r.current, b = Number.isFinite(d.duration) ? Math.max(0, d.duration) : 3e3;
396
534
  if (!t.current) return null;
397
- const h = e.current.getSnapshot(), s = h.slice(0, Math.max(0, h.length - 4));
398
- for (const v of s)
399
- clearTimeout(o.current.get(v.id)), o.current.delete(v.id);
400
- return e.current.publish([...h.slice(-4), { id: b, message: u, type: g, dismissible: d.dismissible !== !1 }]), x > 0 && o.current.set(b, setTimeout(() => a(b), x)), b;
401
- }, [a]), f = Q(() => {
402
- const u = (i, d) => l(i, d);
403
- for (const i of ["success", "error", "warning", "info"]) u[i] = (d, g = {}) => l(d, { ...g, type: i });
404
- return u.promise = async (i, d, g = {}) => {
405
- const b = l(d.loading, { ...g, type: "info", duration: 0 });
535
+ const h = e.current.getSnapshot(), l = h.slice(0, Math.max(0, h.length - 4));
536
+ for (const y of l)
537
+ clearTimeout(o.current.get(y.id)), o.current.delete(y.id);
538
+ return e.current.publish([...h.slice(-4), { id: x, message: a, type: g, dismissible: d.dismissible !== !1 }]), b > 0 && o.current.set(x, setTimeout(() => s(x), b)), x;
539
+ }, [s]), u = V(() => {
540
+ const a = (c, d) => i(c, d);
541
+ for (const c of ["success", "error", "warning", "info"]) a[c] = (d, g = {}) => i(d, { ...g, type: c });
542
+ return a.promise = async (c, d, g = {}) => {
543
+ const x = i(d.loading, { ...g, type: "info", duration: 0 });
406
544
  try {
407
- const x = await (typeof i == "function" ? i() : i);
408
- b != null && a(b);
409
- const h = typeof d.success == "function" ? d.success(x) : d.success;
410
- return h && l(h, { ...g, type: "success" }), x;
411
- } catch (x) {
412
- b != null && a(b);
413
- const h = typeof d.error == "function" ? d.error(x) : d.error;
414
- throw h && l(h, { ...g, type: "error" }), x;
545
+ const b = await (typeof c == "function" ? c() : c);
546
+ x != null && s(x);
547
+ const h = typeof d.success == "function" ? d.success(b) : d.success;
548
+ return h && i(h, { ...g, type: "success" }), b;
549
+ } catch (b) {
550
+ x != null && s(x);
551
+ const h = typeof d.error == "function" ? d.error(b) : d.error;
552
+ throw h && i(h, { ...g, type: "error" }), b;
415
553
  }
416
- }, u.dismiss = a, u.clear = () => {
417
- for (const i of o.current.values()) clearTimeout(i);
554
+ }, a.dismiss = s, a.clear = () => {
555
+ for (const c of o.current.values()) clearTimeout(c);
418
556
  o.current.clear(), e.current.publish([]);
419
- }, u;
420
- }, [l, a]);
421
- return U(() => {
422
- const u = () => {
557
+ }, a;
558
+ }, [i, s]);
559
+ return ee(() => {
560
+ const a = () => {
423
561
  for (const d of o.current.values()) clearTimeout(d);
424
562
  o.current.clear();
425
- }, i = n?.addCleanup(u);
563
+ }, c = n?.addCleanup(a);
426
564
  return () => {
427
- i?.(), u();
565
+ c?.(), a();
428
566
  };
429
- }, [n]), { toast: f, dismissToast: a };
567
+ }, [n]), { toast: u, dismissToast: s };
430
568
  }
431
- function Fn(e) {
569
+ function lr(e) {
432
570
  let t;
433
571
  return {
434
572
  added(n) {
@@ -443,375 +581,439 @@ function Fn(e) {
443
581
  }
444
582
  };
445
583
  }
446
- function on(e, t, n, r) {
447
- const o = r.loadingTasks, a = r.loadingSequence, l = Q(() => Fn(o.current), [o]), f = _(() => {
584
+ function Sn(e, t, n, r) {
585
+ const o = r.loadingTasks, s = r.loadingSequence, i = V(() => lr(o.current), [o]), u = X(() => {
448
586
  if (!t.current) return;
449
- const h = l.read(), s = e.current.getSnapshot();
450
- (s.visible !== h.visible || s.text !== h.text || s.count !== h.count) && e.current.publish(h);
451
- }, [l]), u = _((h, s) => {
587
+ const h = i.read(), l = e.current.getSnapshot();
588
+ (l.visible !== h.visible || l.text !== h.text || l.count !== h.count) && e.current.publish(h);
589
+ }, [i]), a = X((h, l) => {
452
590
  if (!t.current || h !== "global" && n.current !== h) return null;
453
- const v = ++a.current;
454
- return o.current.set(v, { owner: h, text: s }), l.added(v), f(), v;
455
- }, [f, l]), i = _((h, s) => {
456
- if (s != null)
457
- o.current.get(s)?.owner === h && o.current.delete(s);
591
+ const y = ++s.current;
592
+ return o.current.set(y, { owner: h, text: l }), i.added(y), u(), y;
593
+ }, [u, i]), c = X((h, l) => {
594
+ if (l != null)
595
+ o.current.get(l)?.owner === h && o.current.delete(l);
458
596
  else
459
- for (const [v, I] of o.current) I.owner === h && o.current.delete(v);
460
- f();
461
- }, [f]), d = _((h, s) => {
462
- h ? (i("global"), u("global", s)) : i("global");
463
- }, [u, i]), g = _((h, s, v) => {
464
- s ? (i(h), u(h, v)) : i(h);
465
- }, [u, i]);
466
- return { loadingApi: Q(() => ({ setLoading: d, setScreenLoading: g, begin: u, end: i }), [d, g, u, i]), refreshLoading: f, loadingTasks: o, setLoading: d };
467
- }
468
- const $n = Se.memo(function({ store: t, translate: n }) {
469
- const r = Oe(t.subscribe, t.getSnapshot, t.getSnapshot);
470
- return /* @__PURE__ */ p(tn, { loading: r, translate: n });
471
- }), In = Se.memo(function({ store: t, dismiss: n }) {
472
- const r = Oe(t.subscribe, t.getSnapshot, t.getSnapshot);
473
- return /* @__PURE__ */ p(nn, { items: r, dismiss: n });
474
- }), Dn = Se.memo(function({ store: t, layoutStore: n, routeKey: r, ...o }) {
475
- const a = () => t.getSnapshot()[r], l = Oe(t.subscribe, a, a), f = Pe(n, Qt, He);
476
- return /* @__PURE__ */ p(en, { ...o, options: f, override: l });
477
- }), Kn = Se.memo(function({ route: t, screen: n, navigation: r, focused: o, resultEvent: a, setFooter: l, loadingApi: f, loadingStore: u, bodyClassName: i, notifyError: d, registerDirtyGuard: g, pageMotion: b, lazyFallback: x }) {
478
- const h = n.component, s = P(null), v = P(!1);
479
- Ae(() => {
480
- const E = o && !v.current;
481
- if (v.current = o, !E || !b?.enabled || !s.current?.animate) return;
482
- const D = b.direction === "back" ? -100 : 100;
483
- s.current.style.zIndex = "2";
484
- const L = s.current.animate([
485
- { opacity: 1, transform: `translate3d(${D}%,0,0)` },
597
+ for (const [y, C] of o.current) C.owner === h && o.current.delete(y);
598
+ u();
599
+ }, [u]), d = X((h, l) => {
600
+ h ? (c("global"), a("global", l)) : c("global");
601
+ }, [a, c]), g = X((h, l, y) => {
602
+ l ? (c(h), a(h, y)) : c(h);
603
+ }, [a, c]);
604
+ return { loadingApi: V(() => ({ setLoading: d, setScreenLoading: g, begin: a, end: c }), [d, g, a, c]), refreshLoading: u, loadingTasks: o, setLoading: d };
605
+ }
606
+ const ur = Oe.memo(function({ store: t, translate: n }) {
607
+ const r = Ee(t.subscribe, t.getSnapshot, t.getSnapshot);
608
+ return /* @__PURE__ */ m(wn, { loading: r, translate: n });
609
+ }), dr = Oe.memo(function({ store: t, dismiss: n }) {
610
+ const r = Ee(t.subscribe, t.getSnapshot, t.getSnapshot);
611
+ return /* @__PURE__ */ m(kn, { items: r, dismiss: n });
612
+ }), mr = Oe.memo(function({ store: t, layoutStore: n, routeKey: r, ...o }) {
613
+ const s = () => t.getSnapshot()[r], i = Ee(t.subscribe, s, s), u = Fe(n, hn, Ye);
614
+ return /* @__PURE__ */ m(bn, { ...o, options: u, override: i });
615
+ }), fr = Oe.memo(function({ route: t, screen: n, navigation: r, focused: o, resultEvent: s, setFooter: i, loadingApi: u, loadingStore: a, bodyClassName: c, notifyError: d, registerDirtyGuard: g, pageMotion: x, lazyFallback: b }) {
616
+ const h = G(null), l = G(!1);
617
+ Se(() => {
618
+ const S = o && !l.current;
619
+ if (l.current = o, !S || !x?.enabled || !h.current?.animate) return;
620
+ const j = x.direction === "back" ? -100 : 100;
621
+ h.current.style.zIndex = "2";
622
+ const D = h.current.animate([
623
+ { opacity: 1, transform: `translate3d(${j}%,0,0)` },
486
624
  { opacity: 1, transform: "translate3d(0,0,0)" }
487
- ], { duration: b.duration, easing: "cubic-bezier(.22,1,.36,1)" });
625
+ ], { duration: x.duration, easing: "cubic-bezier(.22,1,.36,1)" });
488
626
  return () => {
489
- L.cancel(), s.current && (s.current.style.zIndex = "");
627
+ D.cancel(), h.current && (h.current.style.zIndex = "");
490
628
  };
491
- }, [o, b?.enabled, b?.direction, b?.duration, b?.distance]);
492
- const I = Q(() => ({ isFocused: o, resultEvent: a, routeKey: t.key, setFooter: l }), [o, a, t.key, l]), z = Q(() => ({
493
- setLoading: (E, D) => f.setScreenLoading(t.key, E, D),
494
- showLoading: (E) => f.begin(t.key, E),
495
- hideLoading: (E) => f.end(t.key, E)
496
- }), [f, t.key]), T = Q(() => ({ routeKey: t.key, registerDirtyGuard: g }), [t.key, g]);
497
- return /* @__PURE__ */ p(Ve.Provider, { value: t, children: /* @__PURE__ */ p(Pt.Provider, { value: T, children: /* @__PURE__ */ p(ot.Provider, { value: I, children: /* @__PURE__ */ p(Ue.Provider, { value: z, children: /* @__PURE__ */ p(wt.Provider, { value: u, children: /* @__PURE__ */ p("div", { ref: s, hidden: !o, inert: !o, "data-modal-route-key": t.key, tabIndex: -1, className: `pmn-body ${o && b?.enabled && typeof Element < "u" && !Element.prototype.animate ? `pmn-page-enter pmn-page-${b.direction}` : ""} ${i ?? ""}`, style: o && b?.enabled ? { "--pmn-page-duration": `${b.duration}ms`, "--pmn-page-distance": `${b.distance}px` } : void 0, children: /* @__PURE__ */ p(Nt, { route: t, onError: d, children: /* @__PURE__ */ p(Wt, { fallback: x ?? /* @__PURE__ */ p("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ p(h, { route: t, navigation: r }) }) }) }) }) }) }) }) });
629
+ }, [o, x?.enabled, x?.direction, x?.duration, x?.distance]);
630
+ const y = V(() => ({ isFocused: o, resultEvent: s, routeKey: t.key, setFooter: i }), [o, s, t.key, i]), C = V(() => ({
631
+ setLoading: (S, j) => u.setScreenLoading(t.key, S, j),
632
+ showLoading: (S) => u.begin(t.key, S),
633
+ hideLoading: (S) => u.end(t.key, S)
634
+ }), [u, t.key]), L = V(() => ({ routeKey: t.key, registerDirtyGuard: g }), [t.key, g]);
635
+ return /* @__PURE__ */ m(Je.Provider, { value: t, children: /* @__PURE__ */ m(It.Provider, { value: L, children: /* @__PURE__ */ m(at.Provider, { value: y, children: /* @__PURE__ */ m(st.Provider, { value: C, children: /* @__PURE__ */ m(Ot.Provider, { value: a, children: /* @__PURE__ */ m("div", { ref: h, hidden: !o, inert: !o, "data-modal-route-key": t.key, tabIndex: -1, className: `pmn-body ${o && x?.enabled && typeof Element < "u" && !Element.prototype.animate ? `pmn-page-enter pmn-page-${x.direction}` : ""} ${c ?? ""}`, style: o && x?.enabled ? { "--pmn-page-duration": `${x.duration}ms`, "--pmn-page-distance": `${x.distance}px` } : void 0, children: /* @__PURE__ */ m(Tt, { route: t, onError: d, children: /* @__PURE__ */ m(qt, { fallback: b ?? /* @__PURE__ */ m("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ m(fn, { screen: n, route: t, navigation: r, includePersistent: !1 }) }) }) }) }) }) }) }) });
636
+ }), pr = Oe.memo(function({ routes: t, screens: n, navigation: r, currentKey: o, resultEvents: s, bodyClassName: i, setFooter: u, loadingApi: a, loadingStore: c, notifyError: d, registerDirtyGuard: g, pageMotion: x, lazyFallback: b }) {
637
+ const h = (l) => l.map((y) => {
638
+ if (y.route) {
639
+ const S = y.route;
640
+ return /* @__PURE__ */ m(
641
+ fr,
642
+ {
643
+ route: S,
644
+ screen: n[S.name],
645
+ navigation: r,
646
+ focused: S.key === o,
647
+ resultEvent: s[S.key] ?? null,
648
+ bodyClassName: i,
649
+ setFooter: u,
650
+ loadingApi: a,
651
+ loadingStore: c,
652
+ notifyError: d,
653
+ registerDirtyGuard: g,
654
+ pageMotion: S.key === o && !n[S.name].persistentLayouts?.length ? x : null,
655
+ lazyFallback: b
656
+ },
657
+ S.key
658
+ );
659
+ }
660
+ const C = y.routes.some((S) => S.key === o), L = C ? t.at(-1) : y.routes.at(-1);
661
+ return /* @__PURE__ */ m("div", { hidden: !C, inert: !C, className: "pmn-persistent-layout", children: /* @__PURE__ */ m(Je.Provider, { value: L, children: /* @__PURE__ */ m(Tt, { route: L, onError: d, children: /* @__PURE__ */ m(Ft, { screen: n[L.name], route: L, children: /* @__PURE__ */ m(qt, { fallback: b ?? /* @__PURE__ */ m("div", { className: "pmn-lazy-loading", role: "status", children: "加载中..." }), children: /* @__PURE__ */ m(mn, { shared: !0, layout: y.layout.component, route: L, navigation: r, children: h(y.children) }) }) }) }) }) }, `layout:${y.layout.path}`);
662
+ });
663
+ return h(t.some((l) => n[l.name].persistentLayouts?.length) ? Bn(t, n) : t.map((l) => ({ route: l })));
664
+ }, (e, t) => {
665
+ const { routes: n, ...r } = e, { routes: o, ...s } = t;
666
+ return n.length === o.length && n.every((i, u) => i === o[u]) && Ye(r, s);
498
667
  });
499
- function Hn({ runtime: e, config: t, initialScreen: n, params: r, translate: o, onRequestClose: a, onOpened: l, registerLoading: f, notifyError: u, error: i, clearError: d, registerDirtyGuard: g, getProtectedCacheKeys: b, canNavigate: x, exiting: h = !1 }) {
500
- const s = Pe(e.stores.layout, Cn, He), [v, I] = dn(mt, e.stores.navigation.getSnapshot().stack), { navigation: z, loading: T, footer: E, toast: D } = e.refs, L = e.alive, A = P(0), { toast: q, dismissToast: N } = rn(D, L, e);
501
- U(() => () => {
502
- A.current++;
668
+ function hr({ runtime: e, config: t, initialScreen: n, params: r, translate: o, onRequestClose: s, onOpened: i, registerLoading: u, notifyError: a, error: c, clearError: d, registerDirtyGuard: g, getProtectedCacheKeys: x, getDirtyRevision: b, canNavigate: h, exiting: l = !1 }) {
669
+ const y = Fe(e.stores.layout, Yn, Ye), [C, L] = Nn(kt, e.stores.navigation.getSnapshot().stack), { navigation: S, loading: j, footer: D, toast: R } = e.refs, k = e.alive, O = G(0), { toast: A, dismissToast: N } = xn(R, k, e);
670
+ ee(() => () => {
671
+ O.current++;
672
+ }, []);
673
+ const [W, Q] = Pe({});
674
+ Ee(e.routeGroups.subscribeGuards, e.routeGroups.getGuardRevision, e.routeGroups.getGuardRevision);
675
+ const [ne, re] = Pe(() => /* @__PURE__ */ new Set()), I = G(/* @__PURE__ */ new Map()), _ = G(null), le = G(null), E = G(null), z = G(null), K = G(null), P = G(!1), F = G(!1), Z = e.pageRequests, de = G(0), te = X((p, T, q) => {
676
+ for (const [oe, ge] of Z.current)
677
+ p.includes(ge.key) && (Z.current.delete(oe), ge.resolve({ status: T, ...T === "returned" ? { value: q } : {} }));
678
+ }, []), v = G(C), H = G(null), ke = G(null);
679
+ Se(() => () => {
680
+ H.current?.(), H.current = null, ke.current?.release(), ke.current = null;
503
681
  }, []);
504
- const [Z, ue] = xe({}), [C, F] = xe(() => /* @__PURE__ */ new Set()), $ = P(/* @__PURE__ */ new Map()), X = P(null), B = P(null), te = P(null), V = P(null), oe = P(null), J = P(!1), O = P(!1), G = e.pageRequests, ke = P(0), Ce = _((m, M, j) => {
505
- for (const [Y, fe] of G.current)
506
- m.includes(fe.key) && (G.current.delete(Y), fe.resolve({ status: M, ...M === "returned" ? { value: j } : {} }));
507
- }, []), K = P(v);
508
- K.current = v;
509
- const de = P(x);
510
- de.current = x;
511
- const k = P(!1), ce = P(0), ne = v.at(-1), re = ne.key, Be = P({ key: re, depth: v.length }), st = Be.current, We = st.key !== re, it = v.length < st.depth ? "back" : "forward";
512
- We && (Be.current = { key: re, depth: v.length });
513
- const Qe = Math.min(1e3, Math.max(0, Number(s.pageAnimationDuration ?? 360) || 0)), ct = Math.min(300, Math.max(0, Number(s.pageAnimationDistance ?? 96) || 0)), Ne = Q(() => ({ distance: ct, enabled: s.pageAnimation !== !1 && s.animation !== !1 && Qe > 0 && We, direction: it, duration: Qe }), [ct, s.pageAnimation, s.animation, Qe, We, it]), lt = P(re);
514
- lt.current = re;
515
- const { loadingApi: Ze, refreshLoading: Ge, loadingTasks: ut, setLoading: De } = on(T, L, lt, e), Ee = t.screens, Te = T, _e = P(f);
516
- _e.current = f, U(() => (_e.current?.({ setLoading: De }), () => _e.current?.(null)), [De]);
517
- const qt = _((m, M) => {
518
- if (!L.current) return;
519
- const j = E.current.getSnapshot();
520
- if (M === null) {
521
- if (!(m in j)) return;
522
- const Y = { ...j };
523
- delete Y[m], E.current.publish(Y);
682
+ const xe = G(h);
683
+ xe.current = h;
684
+ const Ae = G(!1), Qe = G(0), ye = C.at(-1), ve = ye.key, ct = G({ key: ve, depth: C.length }), ht = ct.current, et = ht.key !== ve, gt = C.length < ht.depth ? "back" : "forward";
685
+ et && (ct.current = { key: ve, depth: C.length });
686
+ const lt = Math.min(1e3, Math.max(0, Number(y.pageAnimationDuration ?? 360) || 0)), yt = Math.min(300, Math.max(0, Number(y.pageAnimationDistance ?? 96) || 0)), Ke = V(() => ({ distance: yt, enabled: y.pageAnimation !== !1 && y.animation !== !1 && lt > 0 && et, direction: gt, duration: lt }), [yt, y.pageAnimation, y.animation, lt, et, gt]), vt = G(ve);
687
+ vt.current = ve;
688
+ const { loadingApi: ut, refreshLoading: tt, loadingTasks: bt, setLoading: Ze } = Sn(j, k, vt, e), Le = t.screens, De = j, nt = G(u);
689
+ nt.current = u, ee(() => (nt.current?.({ setLoading: Ze }), () => nt.current?.(null)), [Ze]);
690
+ const Yt = X((p, T) => {
691
+ if (!k.current) return;
692
+ const q = D.current.getSnapshot();
693
+ if (T === null) {
694
+ if (!(p in q)) return;
695
+ const oe = { ...q };
696
+ delete oe[p], D.current.publish(oe);
524
697
  return;
525
698
  }
526
- j[m] !== M && E.current.publish({ ...j, [m]: M });
527
- }, []), kt = _(() => {
699
+ q[p] !== T && D.current.publish({ ...q, [p]: T });
700
+ }, []), At = X(() => {
528
701
  if (typeof document > "u") return;
529
- const m = document.activeElement;
530
- if (!(m instanceof HTMLElement) || !X.current?.contains(m)) return;
531
- const M = m.closest("[data-modal-route-key]");
532
- M && $.current.set(M.dataset.modalRouteKey, m), X.current.focus({ preventScroll: !0 });
533
- }, []), xt = _((m) => {
534
- if (!Object.prototype.hasOwnProperty.call(Ee, m)) throw new Error(`[react-modal-navigation] Unknown modal screen: ${m}`);
535
- }, [Ee]), c = _((m, M) => {
702
+ const p = document.activeElement;
703
+ if (!(p instanceof HTMLElement) || !_.current?.contains(p)) return;
704
+ const T = p.closest("[data-modal-route-key]");
705
+ T && I.current.set(T.dataset.modalRouteKey, p), _.current.focus({ preventScroll: !0 });
706
+ }, []), jt = X((p) => {
707
+ if (!Object.prototype.hasOwnProperty.call(Le, p)) throw new Error(`[react-modal-navigation] Unknown modal screen: ${p}`);
708
+ }, [Le]), f = X((p, T) => {
536
709
  try {
537
- Promise.resolve(s[m]?.(M)).catch((j) => u(j, { phase: m }));
538
- } catch (j) {
539
- u(j, { phase: m });
710
+ Promise.resolve(y[p]?.(T)).catch((q) => a(q, { phase: p }));
711
+ } catch (q) {
712
+ a(q, { phase: p });
540
713
  }
541
- }, [s, u]), y = _(async (m, M, j, Y, fe) => {
542
- if (!L.current || O.current) return !1;
543
- const ve = A.current, se = K.current, Xe = se.at(-1);
544
- if (m !== "BACK" && m !== "POP" && xt(M), m === "POP" && (!Number.isInteger(j) || j < 1 || se.length <= 1) || m === "BACK" && se.length <= 1) return !1;
545
- const Ft = m === "NAVIGATE" ? se.findIndex((Je) => Je.name === M) : -1, $e = m === "POP" ? se.slice(Math.max(1, se.length - j)) : m === "RESET" ? se : m === "BACK" || m === "REPLACE" ? [Xe] : Ft >= 0 ? se.slice(Ft + 1) : [];
546
- O.current = !0;
714
+ }, [y, a]), w = X(async (p, T, q, oe, ge) => {
715
+ if (!k.current || F.current || e.routeGroups.isChecking()) return !1;
716
+ const me = O.current, se = v.current, qe = se.at(-1);
717
+ if (p !== "BACK" && p !== "POP" && (T = Ct(T, t.routeAliases, qe.name), jt(T)), p === "POP" && (!Number.isInteger(q) || q < 1 || se.length <= 1) || p === "BACK" && se.length <= 1) return !1;
718
+ const wt = p === "NAVIGATE" ? se.findIndex((ot) => ot.name === T) : -1, Be = p === "POP" ? se.slice(Math.max(1, se.length - q)) : p === "RESET" ? se : p === "BACK" || p === "REPLACE" ? [qe] : wt >= 0 ? se.slice(wt + 1) : [], Ne = e.beginTransaction();
719
+ if (!Ne) return !1;
720
+ F.current = !0;
547
721
  try {
548
- if ($e.length && de.current && !await de.current($e.map((Me) => Me.key), {
722
+ const ot = p === "POP" ? se[Math.max(0, se.length - q - 1)]?.name : p === "BACK" ? se.at(-2)?.name : T, En = new Set(Be.map((he) => he.key)), Pn = se.filter((he) => !En.has(he.key)), On = b?.(), Ln = e.routeGroups.getGuardRevision(), Tn = e.getRemovalRevision();
723
+ if (!await e.routeGroups.canLeave(qe, { name: ot }, { reason: "navigation", action: p, from: qe, to: ot }, !1, Be, Pn) || Be.length && xe.current && !await xe.current(Be.map((Ge) => Ge.key), {
549
724
  reason: "navigation",
550
- action: m,
551
- from: Xe,
552
- to: m === "POP" ? se[Math.max(0, se.length - j - 1)]?.name : m === "BACK" ? se.at(-2)?.name : M
553
- }) || $e.length && !await e.canRemove($e.map((ge) => ge.key), { reason: "navigation", action: m, from: Xe, to: M }) || !L.current || ve !== A.current || K.current.at(-1)?.key !== Xe.key) return !1;
554
- if (m === "BACK" && Y !== void 0) {
555
- const ge = se.at(-2);
556
- ue((Me) => ({ ...Me, [ge.key]: { id: ++ce.current, data: Y } }));
725
+ action: p,
726
+ from: qe,
727
+ to: p === "POP" ? se[Math.max(0, se.length - q - 1)]?.name : p === "BACK" ? se.at(-2)?.name : T
728
+ }) || Be.length && !await e.canRemove(Be.map((he) => he.key), { reason: "navigation", action: p, from: qe, to: T }) || On !== b?.() || Ln !== e.routeGroups.getGuardRevision() || Tn !== e.getRemovalRevision() || !k.current || me !== O.current || v.current.at(-1)?.key !== qe.key) return !1;
729
+ if (p === "BACK" && oe !== void 0) {
730
+ const he = se.at(-2);
731
+ Q((Ge) => ({ ...Ge, [he.key]: { id: ++Qe.current, data: oe } }));
557
732
  }
558
- if ($e.length) {
559
- const ge = new Set($e.map((Me) => Me.key));
560
- ge.forEach((Me) => $.current.delete(Me)), ue((Me) => Object.fromEntries(Object.entries(Me).filter(([et]) => !ge.has(et))));
733
+ if (Be.length) {
734
+ const he = new Set(Be.map((Ge) => Ge.key));
735
+ he.forEach((Ge) => I.current.delete(Ge)), Q((Ge) => Object.fromEntries(Object.entries(Ge).filter(([dt]) => !he.has(dt))));
561
736
  }
562
- e.tasks.cancelRoutes($e.map((ge) => ge.key)), Ce($e.map((ge) => ge.key), m === "BACK" ? "returned" : "removed", Y);
563
- const Je = [...B.current?.querySelectorAll("[data-modal-route-key]") ?? []].find((ge) => ge.dataset.modalRouteKey === Xe.key);
564
- te.current = Je?.cloneNode(!0) ?? null, kt();
565
- const un = { type: m, name: M, params: j, count: j };
566
- K.current = mt(K.current, un);
567
- const Rt = K.current;
568
- return F((ge) => {
569
- const Me = new Set(Rt.slice(0, -1).filter((et) => ge.has(et.key)).map((et) => et.key));
570
- return Me.size === ge.size ? ge : Me;
571
- }), fe?.(Rt.at(-1)), I({ type: "COMMIT", stack: Rt }), !0;
572
- } catch (Je) {
573
- return L.current && u(Je, { phase: "navigationGuard", action: m }), !1;
737
+ e.tasks.cancelRoutes(Be.map((he) => he.key)), te(Be.map((he) => he.key), p === "BACK" ? "returned" : "removed", oe);
738
+ const An = [...le.current?.querySelectorAll("[data-modal-route-key]") ?? []].find((he) => he.dataset.modalRouteKey === qe.key);
739
+ E.current = Le[qe.name].persistentLayouts?.length ? null : An?.cloneNode(!0) ?? null, At();
740
+ const jn = { type: p, name: T, params: q, count: q };
741
+ v.current = kt(v.current, jn);
742
+ const Nt = v.current;
743
+ return re((he) => {
744
+ const Ge = new Set(Nt.slice(0, -1).filter((dt) => he.has(dt.key)).map((dt) => dt.key));
745
+ return Ge.size === he.size ? he : Ge;
746
+ }), ge?.(Nt.at(-1)), H.current = Ne, Qt(() => L({ type: "COMMIT", stack: Nt })), !0;
747
+ } catch (ot) {
748
+ return H.current === Ne && (H.current = null), k.current && a(ot, { phase: "navigationGuard", action: p }), !1;
574
749
  } finally {
575
- O.current = !1;
750
+ F.current = !1, H.current !== Ne && Ne();
576
751
  }
577
- }, [xt, kt, u, Ce]), R = _((m, M) => y("NAVIGATE", m, M), [y]), w = _((m, M) => y("PUSH", m, M), [y]), H = _((m = 1) => y("POP", null, m), [y]), W = _(() => H(K.current.length - 1), [H]), ae = _((m) => {
578
- const M = K.current.findLastIndex((j) => j.name === m);
579
- return M < 0 ? Promise.resolve(!1) : H(K.current.length - M - 1);
580
- }, [H]), me = _(async (m, M) => {
581
- if (!L.current) return { status: "cancelled" };
582
- let j;
583
- return await y("NAVIGATE", m, M, void 0, (fe) => {
584
- j = new Promise((ve) => {
585
- const se = ++ke.current;
586
- G.current.set(se, { key: fe.key, resolve: ve });
752
+ }, [jt, b, t.routeAliases, At, a, te]), B = X((p, T) => w("NAVIGATE", p, T), [w]), M = X((p, T) => w("PUSH", p, T), [w]), J = X((p = 1) => w("POP", null, p), [w]), U = X(() => J(v.current.length - 1), [J]), fe = X((p) => {
753
+ p = Ct(p, t.routeAliases, v.current.at(-1)?.name);
754
+ const T = v.current.findLastIndex((q) => q.name === p);
755
+ return T < 0 ? Promise.resolve(!1) : J(v.current.length - T - 1);
756
+ }, [J, t.routeAliases]), ae = X(async (p, T) => {
757
+ if (!k.current) return { status: "cancelled" };
758
+ let q;
759
+ return await w("NAVIGATE", p, T, void 0, (ge) => {
760
+ q = new Promise((me) => {
761
+ const se = ++de.current;
762
+ Z.current.set(se, { key: ge.key, resolve: me });
587
763
  });
588
- }) && j ? j : { status: "cancelled" };
589
- }, [y]), ie = _((m, M) => y("REPLACE", m, M), [y]), pe = _((m, M) => y("RESET", m, M), [y]), Re = _((m) => {
590
- if (!m || typeof m != "object" || Array.isArray(m)) throw new TypeError("[react-modal-navigation] setParams expects an object");
591
- if (!L.current) return;
592
- const M = { type: "SET_PARAMS", params: m };
593
- K.current = mt(K.current, M), I({ type: "COMMIT", stack: K.current });
594
- }, []), S = _((m) => {
595
- if (!m || typeof m != "object" || Array.isArray(m)) throw new TypeError("[react-modal-navigation] setOptions expects an object");
596
- if (!L.current) return;
597
- const M = { type: "SET_OPTIONS", options: m };
598
- K.current = mt(K.current, M), I({ type: "COMMIT", stack: K.current });
599
- }, []), le = _((m) => y("BACK", null, void 0, m), [y]), Le = _((m, M) => !L.current || Te.current.getSnapshot().visible && s.lockCloseWhileLoading !== !1 ? Promise.resolve(!1) : a(m, M, { route: ne, stack: v }), [s.lockCloseWhileLoading, a, ne, v]), ye = P(Le);
600
- ye.current = Le;
601
- const he = _((m) => ye.current("api", m), []), ze = _(async (m) => {
602
- if (!L.current || O.current) return !1;
603
- const M = K.current, j = $t(M, Ee, s.maxCachedScreens, C, b?.()).slice(0, -1).filter((Y) => m === void 0 || Y.name === m).map((Y) => Y.key);
604
- if (!j.length) return !1;
605
- O.current = !0;
764
+ }) && q ? q : { status: "cancelled" };
765
+ }, [w]), ie = X((p, T) => w("REPLACE", p, T), [w]), Re = X((p, T) => w("RESET", p, T), [w]), je = X((p) => {
766
+ if (!p || typeof p != "object" || Array.isArray(p)) throw new TypeError("[react-modal-navigation] setParams expects an object");
767
+ if (!k.current) return;
768
+ const T = { type: "SET_PARAMS", params: p };
769
+ v.current = kt(v.current, T), L({ type: "COMMIT", stack: v.current });
770
+ }, []), $ = X((p) => {
771
+ if (!p || typeof p != "object" || Array.isArray(p)) throw new TypeError("[react-modal-navigation] setOptions expects an object");
772
+ if (!k.current) return;
773
+ const T = { type: "SET_OPTIONS", options: p };
774
+ v.current = kt(v.current, T), L({ type: "COMMIT", stack: v.current });
775
+ }, []), ue = X((p) => w("BACK", null, void 0, p), [w]), pe = X((p, T) => !k.current || De.current.getSnapshot().visible && y.lockCloseWhileLoading !== !1 ? Promise.resolve(!1) : s(p, T, { route: ye, stack: C }), [y.lockCloseWhileLoading, s, ye, C]), ze = G(pe);
776
+ ze.current = pe;
777
+ const ce = X((p) => ze.current("api", p), []), rt = X(async (p) => {
778
+ if (!k.current || F.current || e.routeGroups.isChecking()) return !1;
779
+ const T = v.current, q = Xt(T, Le, y.maxCachedScreens, ne, e.routeGroups.getProtectedCacheKeys(T, x?.())), oe = q.slice(0, -1).filter((me) => p === void 0 || me.name === p).map((me) => me.key);
780
+ if (!oe.length) return !1;
781
+ const ge = e.beginTransaction();
782
+ if (!ge) return !1;
783
+ F.current = !0;
606
784
  try {
607
- const Y = { reason: "cache", action: "CLEAR_CACHE", from: M.at(-1) };
608
- return de.current && !await de.current(j, Y) || !await e.canRemove(j, Y) || !L.current || K.current !== M ? !1 : (e.tasks.cancelRoutes(j), j.forEach((fe) => $.current.delete(fe)), F((fe) => /* @__PURE__ */ new Set([...fe, ...j])), !0);
609
- } catch (Y) {
610
- return L.current && u(Y, { phase: "clearCache" }), !1;
785
+ const me = { reason: "cache", action: "CLEAR_CACHE", from: T.at(-1) }, se = new Set(oe), qe = b?.(), wt = e.routeGroups.getGuardRevision(), Be = e.getRemovalRevision();
786
+ return !await e.routeGroups.canLeave(null, T.at(-1), me, !1, q.filter((Ne) => se.has(Ne.key)), q.filter((Ne) => !se.has(Ne.key))) || xe.current && !await xe.current(oe, me) || !await e.canRemove(oe, me) || qe !== b?.() || wt !== e.routeGroups.getGuardRevision() || Be !== e.getRemovalRevision() || !k.current || v.current !== T ? !1 : (e.tasks.cancelRoutes(oe), oe.forEach((Ne) => I.current.delete(Ne)), ke.current = { keys: oe, release: ge }, Qt(() => re((Ne) => /* @__PURE__ */ new Set([...Ne, ...oe]))), !0);
787
+ } catch (me) {
788
+ return ke.current?.release === ge && (ke.current = null), k.current && a(me, { phase: "clearCache" }), !1;
611
789
  } finally {
612
- O.current = !1;
790
+ F.current = !1, ke.current?.release !== ge && ge();
613
791
  }
614
- }, [e, u, Ee, s.maxCachedScreens, C, b]), qe = Q(() => ({ navigate: R, navigateAsync: me, push: w, pop: H, popTo: ae, popToTop: W, replace: ie, reset: pe, setParams: Re, setOptions: S, goBack: le, close: he, setLoading: De, clearCache: ze }), [R, me, w, H, ae, W, ie, pe, Re, S, le, he, De, ze]);
615
- Ae(() => e.registerNavigation(qe), [e, qe]);
616
- const Fe = Q(() => ({ canGoBack: v.length > 1, stack: v, currentRoute: ne }), [v]);
617
- Ae(() => z.current.publish(Fe), [Fe]);
618
- const St = P(null);
619
- St.current || (St.current = Object.defineProperties({}, {
620
- canGoBack: { enumerable: !0, get: () => z.current.getSnapshot().canGoBack },
621
- stack: { enumerable: !0, get: () => z.current.getSnapshot().stack },
622
- currentRoute: { enumerable: !0, get: () => z.current.getSnapshot().currentRoute }
792
+ }, [e, a, Le, y.maxCachedScreens, ne, x, b]), _e = V(() => ({ navigate: B, navigateAsync: ae, push: M, pop: J, popTo: fe, popToTop: U, replace: ie, reset: Re, setParams: je, setOptions: $, goBack: ue, close: ce, setLoading: Ze, clearCache: rt }), [B, ae, M, J, fe, U, ie, Re, je, $, ue, ce, Ze, rt]);
793
+ Se(() => e.registerNavigation(_e), [e, _e]);
794
+ const Te = V(() => ({ canGoBack: C.length > 1, stack: C, currentRoute: ye }), [C]);
795
+ Se(() => {
796
+ if (S.current.publish(Te), C.length !== v.current.length || C.some((T, q) => T.key !== v.current[q].key)) return;
797
+ const p = H.current;
798
+ H.current = null, p?.();
799
+ }, [Te, C]);
800
+ const be = G(null);
801
+ be.current || (be.current = Object.defineProperties({}, {
802
+ canGoBack: { enumerable: !0, get: () => S.current.getSnapshot().canGoBack },
803
+ stack: { enumerable: !0, get: () => S.current.getSnapshot().stack },
804
+ currentRoute: { enumerable: !0, get: () => S.current.getSnapshot().currentRoute }
623
805
  }));
624
- const dt = Q(() => Object.assign(St.current, qe), [qe]);
625
- Ae(() => {
626
- const m = te.current;
627
- if (te.current = null, V.current?.cancel?.(), V.current = null, B.current?.querySelectorAll("[data-pmn-outgoing]").forEach((se) => se.remove()), !We || !Ne.enabled || !m || !B.current || typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
628
- const M = B.current;
629
- m.removeAttribute("hidden"), m.removeAttribute("tabindex"), m.setAttribute("aria-hidden", "true"), m.setAttribute("inert", ""), m.dataset.pmnOutgoing = "true", m.querySelectorAll("[id]").forEach((se) => se.removeAttribute("id")), m.querySelectorAll("[autofocus]").forEach((se) => se.removeAttribute("autofocus")), m.style.cssText += ";position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none;overflow:hidden;background:var(--pmn-body);", M.appendChild(m);
630
- const j = Ne.direction === "back" ? 1 : -1, Y = [...M.querySelectorAll("[data-modal-route-key]")].find((se) => se.dataset.modalRouteKey === re);
631
- Y && (Y.style.zIndex = "2");
632
- const fe = () => {
633
- m.remove(), Y && (Y.style.zIndex = ""), V.current === ve && (V.current = null);
806
+ const Ce = V(() => Object.assign(be.current, _e), [_e]);
807
+ Se(() => {
808
+ const p = E.current;
809
+ if (E.current = null, z.current?.cancel?.(), z.current = null, le.current?.querySelectorAll("[data-pmn-outgoing]").forEach((se) => se.remove()), Le[ye.name].persistentLayouts?.length || !et || !Ke.enabled || !p || !le.current || typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
810
+ const T = le.current;
811
+ p.removeAttribute("hidden"), p.removeAttribute("tabindex"), p.setAttribute("aria-hidden", "true"), p.setAttribute("inert", ""), p.dataset.pmnOutgoing = "true", p.querySelectorAll("[id]").forEach((se) => se.removeAttribute("id")), p.querySelectorAll("[autofocus]").forEach((se) => se.removeAttribute("autofocus")), p.style.cssText += ";position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none;overflow:hidden;background:var(--pmn-body);", T.appendChild(p);
812
+ const q = Ke.direction === "back" ? 1 : -1, oe = [...T.querySelectorAll("[data-modal-route-key]")].find((se) => se.dataset.modalRouteKey === ve);
813
+ oe && (oe.style.zIndex = "2");
814
+ const ge = () => {
815
+ p.remove(), oe && (oe.style.zIndex = ""), z.current === me && (z.current = null);
634
816
  };
635
- let ve;
636
- if (m.animate)
637
- ve = m.animate([
817
+ let me;
818
+ if (p.animate)
819
+ me = p.animate([
638
820
  { opacity: 1, transform: "translate3d(0,0,0)" },
639
- { opacity: 1, transform: `translate3d(${j * 100}%,0,0)` }
640
- ], { duration: Ne.duration, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }), ve.addEventListener("finish", fe, { once: !0 }), ve.addEventListener("cancel", fe, { once: !0 }), V.current = ve;
821
+ { opacity: 1, transform: `translate3d(${q * 100}%,0,0)` }
822
+ ], { duration: Ke.duration, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }), me.addEventListener("finish", ge, { once: !0 }), me.addEventListener("cancel", ge, { once: !0 }), z.current = me;
641
823
  else {
642
- m.classList.add("pmn-page-exit", `pmn-page-exit-${Ne.direction}`), m.style.setProperty("--pmn-page-duration", `${Ne.duration}ms`), m.style.setProperty("--pmn-page-distance", "100%");
643
- const se = setTimeout(fe, Ne.duration + 40);
644
- ve = { cancel: () => {
645
- clearTimeout(se), fe();
646
- } }, V.current = ve;
824
+ p.classList.add("pmn-page-exit", `pmn-page-exit-${Ke.direction}`), p.style.setProperty("--pmn-page-duration", `${Ke.duration}ms`), p.style.setProperty("--pmn-page-distance", "100%");
825
+ const se = setTimeout(ge, Ke.duration + 40);
826
+ me = { cancel: () => {
827
+ clearTimeout(se), ge();
828
+ } }, z.current = me;
647
829
  }
648
830
  return () => {
649
- ve?.cancel?.(), m.remove();
831
+ me?.cancel?.(), p.remove();
650
832
  };
651
- }, [re]), Ae(() => {
652
- J.current = !1;
653
- const m = [...X.current?.querySelectorAll("[data-modal-route-key]") ?? []].find((Y) => Y.dataset.modalRouteKey === re);
654
- if (!m) return;
655
- const M = $.current.get(re);
656
- (M?.isConnected && m.contains(M) && !M.matches(":disabled") && !M.closest("[inert], [hidden]") ? M : m).focus({ preventScroll: !0 });
657
- }, [re]), U(() => {
658
- let m = !1;
659
- for (const [j, Y] of ut.current)
660
- Y.owner !== "global" && Y.owner !== re && (ut.current.delete(j), m = !0);
661
- m && Ge();
662
- const M = new Set(v.map((j) => j.key));
663
- ue((j) => {
664
- const Y = Object.keys(j).filter((ve) => !M.has(ve));
665
- if (!Y.length) return j;
666
- const fe = { ...j };
667
- return Y.forEach((ve) => delete fe[ve]), fe;
833
+ }, [ve]), Se(() => {
834
+ P.current = !1;
835
+ const p = [..._.current?.querySelectorAll("[data-modal-route-key]") ?? []].find((oe) => oe.dataset.modalRouteKey === ve);
836
+ if (!p) return;
837
+ const T = I.current.get(ve);
838
+ (T?.isConnected && p.contains(T) && !T.matches(":disabled") && !T.closest("[inert], [hidden]") ? T : p).focus({ preventScroll: !0 });
839
+ }, [ve]), ee(() => {
840
+ let p = !1;
841
+ for (const [q, oe] of bt.current)
842
+ oe.owner !== "global" && oe.owner !== ve && (bt.current.delete(q), p = !0);
843
+ p && tt();
844
+ const T = new Set(C.map((q) => q.key));
845
+ Q((q) => {
846
+ const oe = Object.keys(q).filter((me) => !T.has(me));
847
+ if (!oe.length) return q;
848
+ const ge = { ...q };
849
+ return oe.forEach((me) => delete ge[me]), ge;
668
850
  });
669
- for (const j of $.current.keys()) M.has(j) || $.current.delete(j);
670
- }, [re, v, Ge]), U(() => {
671
- if (oe.current?.key !== re) {
672
- if (oe.current) {
673
- const m = { from: oe.current, to: ne, stack: v };
674
- c("onBlur", { route: oe.current, ...m }), c("onNavigate", m), c("onRouteChange", m);
851
+ for (const q of I.current.keys()) T.has(q) || I.current.delete(q);
852
+ }, [ve, C, tt]), ee(() => {
853
+ if (K.current?.key !== ve) {
854
+ if (K.current) {
855
+ const p = { from: K.current, to: ye, stack: C };
856
+ f("onBlur", { route: K.current, ...p }), f("onNavigate", p), f("onRouteChange", p);
675
857
  }
676
- c("onFocus", { route: ne, stack: v }), oe.current = ne;
858
+ f("onFocus", { route: ye, stack: C }), K.current = ye;
677
859
  }
678
- }, [ne, re, v, c]), U(() => () => {
679
- ut.current.clear(), $.current.clear();
680
- for (const m of G.current.values()) m.resolve({ status: "dismissed" });
681
- G.current.clear();
682
- }, []), U(() => {
683
- k.current || (k.current = !0, l?.({ route: ne, stack: v }));
860
+ }, [ye, ve, C, f]), ee(() => () => {
861
+ bt.current.clear(), I.current.clear();
862
+ for (const p of Z.current.values()) p.resolve({ status: "dismissed" });
863
+ Z.current.clear();
864
+ }, []), ee(() => {
865
+ Ae.current || (Ae.current = !0, i?.({ route: ye, stack: C }));
684
866
  }, []);
685
- const Ct = $t(v, Ee, s.maxCachedScreens, C, b?.());
686
- Ae(() => {
687
- F((m) => hn(v, Ct, m));
688
- }, [v, Ct]);
689
- const Et = Q(() => ({ ...Ee[ne.name], ...ne.options ?? {} }), [Ee, ne.name, ne.options]), ln = e.refs.header;
690
- return /* @__PURE__ */ p(yt.Provider, { value: ln.current, children: /* @__PURE__ */ p(Tt.Provider, { value: q, children: /* @__PURE__ */ p(Vt.Provider, { value: D.current, children: /* @__PURE__ */ p(Ut.Provider, { value: E.current, children: /* @__PURE__ */ p(_t.Provider, { value: dt, children: /* @__PURE__ */ p(vt.Provider, { value: qe, children: /* @__PURE__ */ p(bt.Provider, { value: z.current, children: /* @__PURE__ */ p(Ue.Provider, { value: Ze, children: /* @__PURE__ */ be(Xt, { store: e.stores.layout, screenOptions: Et.modalOptions, dialogRef: X, requestClose: Le, exiting: h, children: [
691
- /* @__PURE__ */ p(Jt, { store: e.stores.layout, screen: Et, route: ne, navigation: dt, requestClose: Le, translate: o, canGoBack: v.length > 1 }),
692
- /* @__PURE__ */ p("main", { ref: B, className: "pmn-main", children: Ct.map((m) => /* @__PURE__ */ p(
693
- Kn,
867
+ const Ue = Xt(C, Le, y.maxCachedScreens, ne, e.routeGroups.getProtectedCacheKeys(C, x?.()));
868
+ Se(() => {
869
+ const p = new Set(Ue.map((q) => q.key)), T = ke.current;
870
+ T && T.keys.every((q) => !p.has(q)) && (ke.current = null, T.release());
871
+ for (const q of I.current.keys())
872
+ p.has(q) || I.current.delete(q);
873
+ }, [Ue]), Se(() => {
874
+ re((p) => $n(C, Ue, p));
875
+ }, [C, Ue]);
876
+ const He = V(() => ({ ...Le[ye.name], ...ye.options ?? {} }), [Le, ye.name, ye.options]), zt = e.refs.header;
877
+ return /* @__PURE__ */ m(Lt.Provider, { value: zt.current, children: /* @__PURE__ */ m($t.Provider, { value: A, children: /* @__PURE__ */ m(ln.Provider, { value: R.current, children: /* @__PURE__ */ m(cn.Provider, { value: D.current, children: /* @__PURE__ */ m(an.Provider, { value: Ce, children: /* @__PURE__ */ m(Et.Provider, { value: _e, children: /* @__PURE__ */ m(Pt.Provider, { value: S.current, children: /* @__PURE__ */ m(st.Provider, { value: ut, children: /* @__PURE__ */ Me(yn, { store: e.stores.layout, screenOptions: He.modalOptions, dialogRef: _, requestClose: pe, exiting: l, children: [
878
+ /* @__PURE__ */ m(vn, { store: e.stores.layout, screen: He, route: ye, navigation: Ce, requestClose: pe, translate: o, canGoBack: C.length > 1 }),
879
+ /* @__PURE__ */ m("main", { ref: le, className: "pmn-main", children: /* @__PURE__ */ m(
880
+ pr,
694
881
  {
695
- route: m,
696
- screen: Ee[m.name],
697
- navigation: dt,
698
- focused: m.key === re,
699
- resultEvent: Z[m.key] ?? null,
700
- bodyClassName: s.bodyClassName,
701
- setFooter: qt,
702
- loadingApi: Ze,
703
- loadingStore: T.current,
704
- notifyError: u,
882
+ routes: Ue,
883
+ screens: Le,
884
+ navigation: Ce,
885
+ currentKey: ve,
886
+ resultEvents: W,
887
+ bodyClassName: y.bodyClassName,
888
+ setFooter: Yt,
889
+ loadingApi: ut,
890
+ loadingStore: j.current,
891
+ notifyError: a,
705
892
  registerDirtyGuard: g,
706
- pageMotion: m.key === re ? Ne : null,
707
- lazyFallback: s.lazyFallback
708
- },
709
- m.key
710
- )) }),
711
- /* @__PURE__ */ p(
712
- Dn,
893
+ pageMotion: Ke,
894
+ lazyFallback: y.lazyFallback
895
+ }
896
+ ) }),
897
+ /* @__PURE__ */ m(
898
+ mr,
713
899
  {
714
- store: E.current,
715
- routeKey: re,
716
- screen: Et,
900
+ store: D.current,
901
+ routeKey: ve,
902
+ screen: He,
717
903
  layoutStore: e.stores.layout,
718
- route: ne,
719
- navigation: dt,
720
- requestClose: Le,
904
+ route: ye,
905
+ navigation: Ce,
906
+ requestClose: pe,
721
907
  translate: o,
722
- onError: u,
723
- loadingApi: Ze
908
+ onError: a,
909
+ loadingApi: ut
724
910
  },
725
- re
911
+ ve
726
912
  ),
727
- /* @__PURE__ */ p($n, { store: T.current, translate: o }),
728
- /* @__PURE__ */ p(In, { store: D.current, dismiss: N }),
729
- i && /* @__PURE__ */ be("div", { className: "pmn-error", role: "alert", children: [
730
- /* @__PURE__ */ p("span", { children: i.message || String(i) }),
731
- /* @__PURE__ */ p("button", { type: "button", onClick: d, "aria-label": "Dismiss error", children: "×" })
913
+ /* @__PURE__ */ m(ur, { store: j.current, translate: o }),
914
+ /* @__PURE__ */ m(dr, { store: R.current, dismiss: N }),
915
+ c && /* @__PURE__ */ Me("div", { className: "pmn-error", role: "alert", children: [
916
+ /* @__PURE__ */ m("span", { children: c.message || String(c) }),
917
+ /* @__PURE__ */ m("button", { type: "button", onClick: d, "aria-label": "Dismiss error", children: "×" })
732
918
  ] })
733
919
  ] }) }) }) }) }) }) }) }) });
734
920
  }
735
- const Or = (e) => e, Pr = (e) => ({ definitionLoader: e }), pt = /* @__PURE__ */ new WeakMap();
736
- function gt(e) {
737
- if (!pt.has(e)) {
921
+ const ao = (e) => e, io = (e) => ({ definitionLoader: e }), xt = /* @__PURE__ */ new WeakMap();
922
+ function Mt(e) {
923
+ if (!xt.has(e)) {
738
924
  const t = Promise.resolve().then(e).catch((n) => {
739
- throw pt.delete(e), n;
925
+ throw xt.delete(e), n;
740
926
  });
741
- pt.set(e, t);
927
+ xt.set(e, t);
742
928
  }
743
- return pt.get(e);
929
+ return xt.get(e);
744
930
  }
745
- async function an(e, t) {
931
+ async function Rn(e, t) {
746
932
  let n = typeof e == "string" ? t && Object.hasOwn(t, e) ? t[e] : void 0 : e;
747
933
  if (n?.definitionLoader) {
748
- const r = await gt(n.definitionLoader);
934
+ const r = await Mt(n.definitionLoader);
749
935
  n = r.default ?? r;
750
936
  }
751
937
  if (!n || !(n.component || n.loader || n.screens)) throw new Error(`[react-modal-navigation] Unknown or invalid modal: ${typeof e == "string" ? e : "inline"}`);
752
938
  return n;
753
939
  }
754
- async function Wn(e, t, n) {
755
- const r = await an(e, t), a = (Array.isArray(n) ? n : [n ?? r.initialRoute ?? Object.keys(r.screens ?? {})[0]]).map((l) => r.screens ? Object.hasOwn(r.screens, l) ? r.screens[l] : null : r);
756
- if (a.some((l) => !l)) throw new Error("[react-modal-navigation] Unknown preload screen");
757
- return await Promise.all(a.map((l) => l.loader ? gt(l.loader) : void 0)), r;
940
+ async function gr(e, t, n) {
941
+ const r = await Rn(e, t), o = r.screens ? on(r.screens) : null, s = o?.screens, u = (Array.isArray(n) ? n : [n ?? r.initialRoute ?? Object.keys(s ?? {})[0]]).map((a) => {
942
+ const c = Ct(a, o?.aliases);
943
+ return s ? Object.hasOwn(s, c) ? s[c] : null : r;
944
+ });
945
+ if (u.some((a) => !a)) throw new Error("[react-modal-navigation] Unknown preload screen");
946
+ return await Promise.all(u.map((a) => a.loader ? Mt(a.loader) : void 0)), r;
758
947
  }
759
- function Gn(e) {
948
+ function yr(e) {
760
949
  return function(n) {
761
- const [r, o] = xe(() => Se.lazy(() => gt(e)));
762
- return /* @__PURE__ */ p(Nt, { route: n.route, onRetry: () => o(() => Se.lazy(() => gt(e))), children: /* @__PURE__ */ p(r, { ...n }) });
950
+ const [r, o] = Pe(() => Oe.lazy(() => Mt(e)));
951
+ return /* @__PURE__ */ m(Tt, { route: n.route, onRetry: () => o(() => Oe.lazy(() => Mt(e))), children: /* @__PURE__ */ m(r, { ...n }) });
763
952
  };
764
953
  }
765
- function _n(e, { limit: t = 100 } = {}) {
766
- const n = Number.isFinite(t) ? Math.max(1, Math.min(1e3, Math.floor(t))) : 100, r = je({ active: null, queueSize: 0, events: [] });
767
- let o, a = 0, l = !1, f = [];
768
- const u = (g, b) => {
769
- if (l) return;
770
- const x = r.getSnapshot(), h = e.hostStore.getSnapshot().active, s = h?.runtime.alive.current ? h : null, v = s?.runtime.stores.navigation.getSnapshot(), I = s?.runtime.stores.loading.getSnapshot();
771
- let z = s ? { id: s.id, name: s.name, routes: v.stack.map(({ key: L, name: A }) => ({ key: L, name: A })), focusedKey: v.currentRoute?.key, loadingCount: I.count, taskCount: s.runtime.tasks.count() } : null;
772
- const T = g ? [...x.events, { sequence: ++a, time: Date.now(), type: g, id: b }].slice(-n) : x.events, E = x.active;
773
- z && E && z.id === E.id && z.name === E.name && z.focusedKey === E.focusedKey && z.loadingCount === E.loadingCount && z.taskCount === E.taskCount && z.routes.length === E.routes.length && z.routes.every((L, A) => L.key === E.routes[A].key && L.name === E.routes[A].name) && (z = E);
954
+ async function Ie(e, t, n) {
955
+ if (n.aborted) return !1;
956
+ let r;
957
+ const o = new Promise((s) => {
958
+ r = () => s(!1), n.addEventListener("abort", r, { once: !0 });
959
+ });
960
+ try {
961
+ const s = new Promise((u) => u(e(t))), i = await Promise.race([s, o]);
962
+ return !n.aborted && i !== !1;
963
+ } finally {
964
+ n.removeEventListener("abort", r);
965
+ }
966
+ }
967
+ function vr(e, { limit: t = 100 } = {}) {
968
+ const n = Number.isFinite(t) ? Math.max(1, Math.min(1e3, Math.floor(t))) : 100, r = $e({ active: null, queueSize: 0, events: [] });
969
+ let o, s = 0, i = !1, u = [];
970
+ const a = (g, x) => {
971
+ if (i) return;
972
+ const b = r.getSnapshot(), h = e.hostStore.getSnapshot().active, l = h?.runtime.alive.current ? h : null, y = l?.runtime.stores.navigation.getSnapshot(), C = l?.runtime.stores.loading.getSnapshot();
973
+ let L = l ? { id: l.id, name: l.name, routes: y.stack.map(({ key: R, name: k }) => ({ key: R, name: k })), focusedKey: y.currentRoute?.key, loadingCount: C.count, taskCount: l.runtime.tasks.count() } : null;
974
+ const S = g ? [...b.events, { sequence: ++s, time: Date.now(), type: g, id: x }].slice(-n) : b.events, j = b.active;
975
+ L && j && L.id === j.id && L.name === j.name && L.focusedKey === j.focusedKey && L.loadingCount === j.loadingCount && L.taskCount === j.taskCount && L.routes.length === j.routes.length && L.routes.every((R, k) => R.key === j.routes[k].key && R.name === j.routes[k].name) && (L = j);
774
976
  const D = e.statusStore.getSnapshot().queueSize;
775
- z === E && D === x.queueSize && T === x.events || r.publish({ active: z, queueSize: D, events: T });
776
- }, i = () => {
977
+ L === j && D === b.queueSize && S === b.events || r.publish({ active: L, queueSize: D, events: S });
978
+ }, c = () => {
777
979
  const g = e.hostStore.getSnapshot().active?.runtime;
778
- g !== o && (f.forEach((b) => b()), o = g, f = g ? ["ready", "destroy", "change", "routeChange", "routeRemove", "routeBlur", "routeFocus"].map((b) => g.events.on(b, (x) => u(b === "change" ? `store.${x.store}` : `instance.${b}`, x.id))) : []), u();
779
- }, d = [e.hostStore.subscribe(i), e.statusStore.subscribe(() => u()), ...["open", "close", "queueChange"].map((g) => e.commands.on(g, (b) => u(`manager.${g}`, b.id)))];
780
- return i(), {
980
+ g !== o && (u.forEach((x) => x()), o = g, u = g ? ["ready", "destroy", "change", "routeChange", "routeRemove", "routeBlur", "routeFocus"].map((x) => g.events.on(x, (b) => a(x === "change" ? `store.${b.store}` : `instance.${x}`, b.id))) : []), a();
981
+ }, d = [e.hostStore.subscribe(c), e.statusStore.subscribe(() => a()), ...["open", "close", "queueChange"].map((g) => e.commands.on(g, (x) => a(`manager.${g}`, x.id)))];
982
+ return c(), {
781
983
  getSnapshot: r.getSnapshot,
782
984
  subscribe: r.subscribe,
783
- refresh: () => u(),
985
+ refresh: () => a(),
784
986
  clear() {
785
- !l && r.getSnapshot().events.length && r.publish({ ...r.getSnapshot(), events: [] });
987
+ !i && r.getSnapshot().events.length && r.publish({ ...r.getSnapshot(), events: [] });
786
988
  },
787
989
  dispose() {
788
- l || (l = !0, d.forEach((g) => g()), f.forEach((g) => g()), f = [], o = null, r.publish({ active: null, queueSize: 0, events: [] }), r.destroy());
990
+ i || (i = !0, d.forEach((g) => g()), u.forEach((g) => g()), u = [], o = null, r.publish({ active: null, queueSize: 0, events: [] }), r.destroy());
789
991
  }
790
992
  };
791
993
  }
792
- function sn() {
994
+ function Cn() {
793
995
  const e = /* @__PURE__ */ new Map();
794
996
  let t = !1;
795
997
  const n = (r, o) => {
796
- const a = e.get(r);
797
- a?.delete(o), a?.size || e.delete(r);
998
+ const s = e.get(r);
999
+ s?.delete(o), s?.size || e.delete(r);
798
1000
  };
799
1001
  return {
800
1002
  on(r, o) {
801
1003
  if (t) return () => {
802
1004
  };
803
- const a = e.get(r) ?? /* @__PURE__ */ new Set();
804
- return e.set(r, a), a.add(o), () => n(r, o);
1005
+ const s = e.get(r) ?? /* @__PURE__ */ new Set();
1006
+ return e.set(r, s), s.add(o), () => n(r, o);
805
1007
  },
806
1008
  off: n,
807
1009
  emit(r, o) {
808
1010
  if (!t) {
809
- for (const a of [...e.get(r) ?? []])
810
- if (!(t || !e.get(r)?.has(a)))
1011
+ for (const s of [...e.get(r) ?? []])
1012
+ if (!(t || !e.get(r)?.has(s)))
811
1013
  try {
812
- Promise.resolve(a(o)).catch((l) => console.error(l));
813
- } catch (l) {
814
- console.error(l);
1014
+ Promise.resolve(s(o)).catch((i) => console.error(i));
1015
+ } catch (i) {
1016
+ console.error(i);
815
1017
  }
816
1018
  }
817
1019
  },
@@ -823,39 +1025,166 @@ function sn() {
823
1025
  }
824
1026
  };
825
1027
  }
826
- function Un(e, t, n, r) {
827
- const o = n.currentRoute, a = r.currentRoute;
828
- if (o?.key === a?.key && n.stack.length === r.stack.length && n.stack.every((g, b) => g.key === r.stack[b].key)) return;
829
- const l = new Set(n.stack.map((g) => g.key)), f = new Set(r.stack.map((g) => g.key)), u = n.stack.filter((g) => !f.has(g.key)), i = r.stack.filter((g) => !l.has(g.key));
830
- if (o?.key === a?.key && !u.length && !i.length) return;
831
- const d = { id: t, from: o, to: a, added: i, removed: u, stack: r.stack };
832
- e.emit("routeChange", d), u.length && e.emit("routeRemove", d), o?.key !== a?.key && (o && e.emit("routeBlur", { ...d, route: o }), a && e.emit("routeFocus", { ...d, route: a }));
1028
+ function br(e, t) {
1029
+ const n = /* @__PURE__ */ new Map(), r = (R) => (e[R?.name]?.routeGroups ?? []).map((k) => k.name), o = () => new Set(r(t.getSnapshot().currentRoute)), s = o(), i = (R) => new Set(R.flatMap(r));
1030
+ let u = i(t.getSnapshot().stack ?? [t.getSnapshot().currentRoute]);
1031
+ const a = $e(0);
1032
+ let c = !1;
1033
+ const d = new AbortController();
1034
+ let g = !1, x = 0, b = t.getSnapshot().currentRoute?.key, h = t.getSnapshot().currentRoute?.name;
1035
+ const l = (R) => (R.stack ?? [R.currentRoute]).map((k) => [k?.key, k?.name]);
1036
+ let y = l(t.getSnapshot());
1037
+ for (const R of Object.values(e))
1038
+ for (const k of R.routeGroups ?? []) {
1039
+ if (n.has(k.name)) continue;
1040
+ const O = $e({ ...k, isFocused: s.has(k.name), isRetained: u.has(k.name) });
1041
+ n.set(k.name, { store: O, initialParams: k.params, guards: /* @__PURE__ */ new Map(), cacheGuards: /* @__PURE__ */ new Map(), tasks: /* @__PURE__ */ new Set() });
1042
+ }
1043
+ const C = (R) => {
1044
+ const k = [...R.tasks];
1045
+ R.tasks.clear();
1046
+ for (const O of k) O.abort();
1047
+ };
1048
+ let L = !1;
1049
+ const S = [], j = (R) => {
1050
+ const k = R.currentRoute, O = i(R.stack ?? [k]), A = u.size !== O.size || [...u].some((re) => !O.has(re)), N = l(R), W = y.length !== N.length || N.some(([re, I], _) => re !== y[_][0] || I !== y[_][1]);
1051
+ if (k?.key === b && k?.name === h && !A && !W) return;
1052
+ y = N;
1053
+ const Q = u;
1054
+ u = O, b = k?.key, h = k?.name, x++;
1055
+ const ne = new Set(r(k));
1056
+ for (const [re, I] of n) {
1057
+ if (c) break;
1058
+ const _ = I.store.getSnapshot(), le = ne.has(re), E = u.has(re), z = Q.has(re) && !E;
1059
+ _.isFocused === le && _.isRetained === E || (I.store.publish({ ..._, isFocused: le, isRetained: E, ...z ? { params: I.initialParams } : {} }), le || C(I));
1060
+ }
1061
+ }, D = t.subscribe(() => {
1062
+ if (!c && (S.push(t.getSnapshot()), !L)) {
1063
+ L = !0;
1064
+ try {
1065
+ for (; !c && S.length; ) j(S.shift());
1066
+ } finally {
1067
+ L = !1, S.length = 0;
1068
+ }
1069
+ }
1070
+ });
1071
+ return {
1072
+ get: (R) => n.get(R)?.store,
1073
+ isChecking: () => g,
1074
+ subscribeGuards: a.subscribe,
1075
+ getGuardRevision: a.getSnapshot,
1076
+ getProtectedCacheKeys(R, k = /* @__PURE__ */ new Set()) {
1077
+ const O = new Set(k);
1078
+ if (c) return O;
1079
+ const A = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set();
1080
+ for (const [W, Q] of n)
1081
+ for (const ne of Q.cacheGuards.values())
1082
+ ne === void 0 ? A.add(W) : N.add(ne);
1083
+ for (const W of R)
1084
+ (N.has(W.key) || r(W).some((Q) => A.has(Q))) && O.add(W.key);
1085
+ return O;
1086
+ },
1087
+ setParams(R, k) {
1088
+ const O = n.get(R);
1089
+ if (c || !O) return !1;
1090
+ if (!k || typeof k != "object" || Array.isArray(k)) throw new TypeError("Group params must be an object");
1091
+ const A = O.store.getSnapshot();
1092
+ return Object.keys(k).every((N) => Object.hasOwn(A.params, N) && Object.is(A.params[N], k[N])) || O.store.publish({ ...A, params: Object.freeze({ ...A.params, ...k }) }), !0;
1093
+ },
1094
+ registerGuard(R, k, { protectCache: O = !0, ownerKey: A } = {}) {
1095
+ const N = n.get(R);
1096
+ if (c || !N) return () => {
1097
+ };
1098
+ const W = (Q) => k(Q);
1099
+ return N.guards.set(W, A), O && N.cacheGuards.set(W, A), a.publish(a.getSnapshot() + 1), () => {
1100
+ N.guards.delete(W) && (N.cacheGuards.delete(W), a.publish(a.getSnapshot() + 1));
1101
+ };
1102
+ },
1103
+ async canLeave(R, k, O, A = !1, N = [], W = []) {
1104
+ if (c || g || L) return !1;
1105
+ g = !0;
1106
+ const Q = x, ne = a.getSnapshot(), re = () => !c && x === Q && a.getSnapshot() === ne;
1107
+ try {
1108
+ const I = new Set(r(k)), _ = i(W), le = A ? [...n.keys()] : [.../* @__PURE__ */ new Set([
1109
+ ...r(R).filter((P) => !I.has(P)),
1110
+ ...N.flatMap(r).filter((P) => !_.has(P) && !I.has(P))
1111
+ ])], E = new Set(N.map((P) => P.key)), z = new Set(le), K = [...n.keys()].filter((P) => z.has(P) || [...n.get(P).guards.values()].some((F) => F !== void 0 && E.has(F)));
1112
+ for (const P of K.sort((F, Z) => Z.split("/").length - F.split("/").length)) {
1113
+ const { guards: F } = n.get(P);
1114
+ for (const Z of [...F.keys()]) {
1115
+ if (!re()) return !1;
1116
+ if (!F.has(Z)) continue;
1117
+ const de = F.get(Z);
1118
+ if (!z.has(P) && (de === void 0 || !E.has(de))) continue;
1119
+ const te = await Ie(Z, O, d.signal);
1120
+ if (!re() || te === !1) return !1;
1121
+ }
1122
+ }
1123
+ return re();
1124
+ } finally {
1125
+ g = !1;
1126
+ }
1127
+ },
1128
+ async run(R, k) {
1129
+ const O = n.get(R);
1130
+ if (c || L || !o().has(R) || !O?.store.getSnapshot().isFocused) throw new Error("Route group is not focused");
1131
+ const A = new AbortController();
1132
+ O.tasks.add(A);
1133
+ const { signal: N } = A;
1134
+ let W;
1135
+ const Q = new Promise((ne, re) => {
1136
+ W = () => re(new DOMException("Route group task aborted", "AbortError")), N.addEventListener("abort", W, { once: !0 });
1137
+ });
1138
+ try {
1139
+ const ne = new Promise((I) => I(k(N))), re = await Promise.race([Q, ne]);
1140
+ if (N.aborted) throw new DOMException("Route group task aborted", "AbortError");
1141
+ return re;
1142
+ } finally {
1143
+ N.removeEventListener("abort", W), O.tasks.delete(A);
1144
+ }
1145
+ },
1146
+ destroy() {
1147
+ if (!c) {
1148
+ c = !0, d.abort(), D(), a.destroy();
1149
+ for (const R of n.values())
1150
+ C(R), R.guards.clear(), R.cacheGuards.clear(), R.store.destroy({ ...R.store.getSnapshot(), params: R.initialParams, isFocused: !1, isRetained: !1 });
1151
+ }
1152
+ }
1153
+ };
1154
+ }
1155
+ function wr(e, t, n, r) {
1156
+ const o = n.currentRoute, s = r.currentRoute;
1157
+ if (o?.key === s?.key && n.stack.length === r.stack.length && n.stack.every((g, x) => g.key === r.stack[x].key)) return;
1158
+ const i = new Set(n.stack.map((g) => g.key)), u = new Set(r.stack.map((g) => g.key)), a = n.stack.filter((g) => !u.has(g.key)), c = r.stack.filter((g) => !i.has(g.key));
1159
+ if (o?.key === s?.key && !a.length && !c.length) return;
1160
+ const d = { id: t, from: o, to: s, added: c, removed: a, stack: r.stack };
1161
+ e.emit("routeChange", d), a.length && e.emit("routeRemove", d), o?.key !== s?.key && (o && e.emit("routeBlur", { ...d, route: o }), s && e.emit("routeFocus", { ...d, route: s }));
833
1162
  }
834
- function Vn() {
1163
+ function kr() {
835
1164
  const e = /* @__PURE__ */ new Map();
836
1165
  let t = !1;
837
- const n = /* @__PURE__ */ new Set(), r = (a) => {
1166
+ const n = /* @__PURE__ */ new Set(), r = (s) => {
838
1167
  try {
839
- Promise.resolve(a.cancel()).catch((l) => console.error(l));
840
- } catch (l) {
841
- console.error(l);
1168
+ Promise.resolve(s.cancel()).catch((i) => console.error(i));
1169
+ } catch (i) {
1170
+ console.error(i);
842
1171
  }
843
- }, o = (a) => {
844
- for (const [l, f] of [...e])
845
- !a(f) || !e.delete(l) || r(l);
1172
+ }, o = (s) => {
1173
+ for (const [i, u] of [...e])
1174
+ !s(u) || !e.delete(i) || r(i);
846
1175
  };
847
1176
  return {
848
- register(a, l) {
849
- return t || n.has(a) ? (r(l), () => {
850
- }) : (e.set(l, a), () => e.delete(l));
1177
+ register(s, i) {
1178
+ return t || n.has(s) ? (r(i), () => {
1179
+ }) : (e.set(i, s), () => e.delete(i));
851
1180
  },
852
- cancelRoutes(a) {
853
- const l = new Set(a), f = [...l].filter((u) => !n.has(u));
854
- f.forEach((u) => n.add(u));
1181
+ cancelRoutes(s) {
1182
+ const i = new Set(s), u = [...i].filter((a) => !n.has(a));
1183
+ u.forEach((a) => n.add(a));
855
1184
  try {
856
- o((u) => l.has(u));
1185
+ o((a) => i.has(a));
857
1186
  } finally {
858
- f.forEach((u) => n.delete(u));
1187
+ u.forEach((a) => n.delete(a));
859
1188
  }
860
1189
  },
861
1190
  destroy() {
@@ -864,102 +1193,110 @@ function Vn() {
864
1193
  count: () => e.size
865
1194
  };
866
1195
  }
867
- function Yn(e, t) {
868
- const n = e.config.singlePage || Object.keys(e.config.screens).length === 1, r = n ? [{ key: "single", name: e.screen, params: e.params ?? {}, options: {} }] : Yt(e.screen, e.params), o = je({});
869
- o.set = (C, F) => {
870
- const $ = o.getSnapshot();
871
- if (F == null && !(C in $) || Object.is($[C], F)) return;
872
- const X = { ...$ };
873
- F == null ? delete X[C] : X[C] = F, o.publish(X);
1196
+ function xr(e, t) {
1197
+ const n = e.config.singlePage || Object.keys(e.config.screens).length === 1, r = n ? [{ key: "single", name: e.screen, params: e.params ?? {}, options: {} }] : pn(e.screen, e.params), o = $e({});
1198
+ o.set = (E, z) => {
1199
+ const K = o.getSnapshot();
1200
+ if (z == null && !(E in K) || Object.is(K[E], z)) return;
1201
+ const P = { ...K };
1202
+ z == null ? delete P[E] : P[E] = z, o.publish(P);
874
1203
  };
875
- const a = {
876
- layout: je(t),
877
- navigation: je({ canGoBack: !1, stack: r, currentRoute: r[0] }),
1204
+ const s = {
1205
+ layout: $e(t),
1206
+ navigation: $e({ canGoBack: !1, stack: r, currentRoute: r[0] }),
878
1207
  header: o,
879
- footer: je({}),
880
- loading: je({ visible: !1, text: null, count: 0 }),
881
- toast: je([])
882
- }, l = Object.fromEntries(Object.entries(a).map(([C, F]) => [C, { current: F }])), f = sn();
883
- let u;
884
- const i = () => {
885
- const C = Object.entries(a);
886
- return (!u || C.some(([F, $]) => !Object.is(u[F], $.getSnapshot()))) && (u = Object.freeze(Object.fromEntries(C.map(([F, $]) => [F, $.getSnapshot()])))), u;
887
- }, d = (C, F, $ = Object.is, X) => {
888
- if (!s.current) return () => {
1208
+ footer: $e({}),
1209
+ loading: $e({ visible: !1, text: null, count: 0 }),
1210
+ toast: $e([])
1211
+ }, i = br(e.config.screens, s.navigation), u = Object.fromEntries(Object.entries(s).map(([E, z]) => [E, { current: z }])), a = Cn();
1212
+ let c;
1213
+ const d = () => {
1214
+ const E = Object.entries(s);
1215
+ return (!c || E.some(([z, K]) => !Object.is(c[z], K.getSnapshot()))) && (c = Object.freeze(Object.fromEntries(E.map(([z, K]) => [z, K.getSnapshot()])))), c;
1216
+ }, g = (E, z, K = Object.is, P) => {
1217
+ if (!S.current) return () => {
889
1218
  };
890
- const B = X === void 0 ? Object.values(a) : [...new Set(X)].map((J) => {
891
- if (!Object.hasOwn(a, J)) throw new Error(`Unknown runtime store: ${J}`);
892
- return a[J];
1219
+ const F = P === void 0 ? Object.values(s) : [...new Set(P)].map((v) => {
1220
+ if (!Object.hasOwn(s, v)) throw new Error(`Unknown runtime store: ${v}`);
1221
+ return s[v];
893
1222
  });
894
- let te = C(i());
895
- const V = () => {
1223
+ let Z = E(d());
1224
+ const de = () => {
896
1225
  try {
897
- const J = C(i());
898
- if ($(te, J)) return;
899
- const O = te;
900
- te = J, Promise.resolve(F(J, O)).catch((G) => console.error(G));
901
- } catch (J) {
902
- console.error(J);
1226
+ const v = E(d());
1227
+ if (K(Z, v)) return;
1228
+ const H = Z;
1229
+ Z = v, Promise.resolve(z(v, H)).catch((ke) => console.error(ke));
1230
+ } catch (v) {
1231
+ console.error(v);
903
1232
  }
904
- }, oe = B.map((J) => J.subscribe(V));
905
- return () => oe.forEach((J) => J());
906
- }, g = Vn(), b = /* @__PURE__ */ new Map(), x = (C, F) => {
907
- if (!s.current) return () => {
1233
+ }, te = F.map((v) => v.subscribe(de));
1234
+ return () => te.forEach((v) => v());
1235
+ }, x = kr(), b = /* @__PURE__ */ new Map(), h = new AbortController();
1236
+ let l = 0;
1237
+ const y = () => l, C = (E, z) => {
1238
+ if (!S.current) return () => {
908
1239
  };
909
- const $ = b.get(C) ?? /* @__PURE__ */ new Set();
910
- return b.set(C, $), $.add(F), () => {
911
- $.delete(F), !$.size && b.get(C) === $ && b.delete(C);
1240
+ const K = b.get(E) ?? /* @__PURE__ */ new Set(), P = (F) => z(F);
1241
+ return b.set(E, K), K.add(P), l++, () => {
1242
+ K.delete(P) && (!K.size && b.get(E) === K && b.delete(E), l++);
912
1243
  };
913
- }, h = async (C, F) => {
914
- for (const $ of C) for (const X of [...b.get($) ?? []]) {
915
- if (!s.current) return !1;
916
- if (b.get($)?.has(X) && await X(F) === !1)
917
- return !1;
918
- }
919
- return s.current;
920
- }, s = { current: !0 };
921
- let v;
922
- const I = new Promise((C) => {
923
- v = C;
924
- }), z = (C) => s.current ? (N.navigationCommands = C, v(!0), N.hasRegistered || (N.hasRegistered = !0, f.emit("ready", { id: e.id })), () => {
925
- N.navigationCommands === C && (N.navigationCommands = null);
1244
+ }, L = async (E, z) => {
1245
+ const K = l, P = () => S.current && K === l;
1246
+ for (const F of new Set(E)) for (const Z of [...b.get(F) ?? []])
1247
+ if (!P() || await Ie(Z, z, h.signal) === !1 || !P()) return !1;
1248
+ return P();
1249
+ }, S = { current: !0 };
1250
+ let j = null;
1251
+ const D = () => {
1252
+ if (!S.current || j) return null;
1253
+ const E = /* @__PURE__ */ Symbol();
1254
+ return j = E, () => {
1255
+ j === E && (j = null);
1256
+ };
1257
+ };
1258
+ let R;
1259
+ const k = new Promise((E) => {
1260
+ R = E;
1261
+ }), O = (E) => S.current ? (I.navigationCommands = E, R(!0), I.hasRegistered || (I.hasRegistered = !0, a.emit("ready", { id: e.id })), () => {
1262
+ I.navigationCommands === E && (I.navigationCommands = null);
926
1263
  }) : () => {
927
- }, T = /* @__PURE__ */ new Set(), E = { current: /* @__PURE__ */ new Map() }, D = { current: /* @__PURE__ */ new Map() }, L = { current: 0 }, A = (C) => s.current ? (T.add(C), () => T.delete(C)) : (C(), () => {
928
- }), q = () => {
929
- if (s.current) {
930
- s.current = !1, v(!1), N.navigationCommands = null, g.destroy(), b.clear();
931
- for (const C of T)
1264
+ }, A = /* @__PURE__ */ new Set(), N = { current: /* @__PURE__ */ new Map() }, W = { current: /* @__PURE__ */ new Map() }, Q = { current: 0 }, ne = (E) => S.current ? (A.add(E), () => A.delete(E)) : (E(), () => {
1265
+ }), re = () => {
1266
+ if (S.current) {
1267
+ S.current = !1, h.abort(), j = null, R(!1), I.navigationCommands = null, i.destroy(), x.destroy(), b.clear();
1268
+ for (const E of A)
932
1269
  try {
933
- C();
934
- } catch (F) {
935
- console.error(F);
1270
+ E();
1271
+ } catch (z) {
1272
+ console.error(z);
936
1273
  }
937
- T.clear(), E.current.clear();
938
- for (const C of D.current.values()) C.resolve({ status: "dismissed" });
939
- D.current.clear(), a.layout.destroy({}), a.navigation.destroy({ canGoBack: !1, stack: [], currentRoute: null }), a.header.destroy({}), a.footer.destroy({}), a.loading.destroy({ visible: !1, text: null, count: 0 }), a.toast.destroy([]), u = void 0, f.emit("destroy", { id: e.id }), f.destroy();
1274
+ A.clear(), N.current.clear();
1275
+ for (const E of W.current.values()) E.resolve({ status: "dismissed" });
1276
+ W.current.clear(), s.layout.destroy({}), s.navigation.destroy({ canGoBack: !1, stack: [], currentRoute: null }), s.header.destroy({}), s.footer.destroy({}), s.loading.destroy({ visible: !1, text: null, count: 0 }), s.toast.destroy([]), c = void 0, a.emit("destroy", { id: e.id }), a.destroy();
940
1277
  }
941
- }, N = { events: f, getSnapshot: i, subscribeState: d, ready: I, registerNavigation: z, id: e.id, single: n, stores: a, refs: l, alive: s, loadingTasks: E, loadingSequence: L, pageRequests: D, tasks: g, registerRemovalGuard: x, canRemove: h, addCleanup: A, destroy: q }, Z = [];
942
- let ue = !1;
943
- for (const [C, F] of Object.entries(a)) {
944
- let $ = F.getSnapshot();
945
- F.subscribe(() => {
946
- const X = F.getSnapshot(), B = $;
947
- if ($ = X, Z.push({ key: C, old: B, next: X }), !ue) {
948
- ue = !0;
1278
+ }, I = { beginTransaction: D, routeGroups: i, events: a, getSnapshot: d, subscribeState: g, ready: k, registerNavigation: O, id: e.id, single: n, stores: s, refs: u, alive: S, loadingTasks: N, loadingSequence: Q, pageRequests: W, tasks: x, registerRemovalGuard: C, getRemovalRevision: y, canRemove: L, addCleanup: ne, destroy: re }, _ = [];
1279
+ let le = !1;
1280
+ for (const [E, z] of Object.entries(s)) {
1281
+ let K = z.getSnapshot();
1282
+ z.subscribe(() => {
1283
+ const P = z.getSnapshot(), F = K;
1284
+ if (K = P, _.push({ key: E, old: F, next: P }), !le) {
1285
+ le = !0;
949
1286
  try {
950
- for (let te = 0; te < Z.length && s.current; te++) {
951
- const { key: V, old: oe, next: J } = Z[te];
952
- f.emit("change", { id: e.id, store: V, previous: oe, current: J }), V === "navigation" && s.current && Un(f, e.id, oe, J);
1287
+ for (let Z = 0; Z < _.length && S.current; Z++) {
1288
+ const { key: de, old: te, next: v } = _[Z];
1289
+ a.emit("change", { id: e.id, store: de, previous: te, current: v }), de === "navigation" && S.current && wr(a, e.id, te, v);
953
1290
  }
954
1291
  } finally {
955
- Z.length = 0, ue = !1;
1292
+ _.length = 0, le = !1;
956
1293
  }
957
1294
  }
958
1295
  });
959
1296
  }
960
- return N;
1297
+ return I;
961
1298
  }
962
- function nt(e, t, n) {
1299
+ function ft(e, t, n) {
963
1300
  if (typeof e == "string") {
964
1301
  if (!e.trim()) throw new TypeError("[react-modal-navigation] modal name must not be empty");
965
1302
  return { name: e, params: t ?? {}, options: n ?? {} };
@@ -967,19 +1304,19 @@ function nt(e, t, n) {
967
1304
  if (e === null || typeof e != "object" || Array.isArray(e))
968
1305
  throw new TypeError("[react-modal-navigation] open expects a modal name or a configuration object");
969
1306
  if (e.component || e.loader || e.screens || e.definitionLoader) {
970
- const { params: u, options: i, screen: d, ...g } = e;
971
- return { name: g, params: t ?? u ?? {}, options: { ...i, ...n }, screen: d };
1307
+ const { params: a, options: c, screen: d, ...g } = e;
1308
+ return { name: g, params: t ?? a ?? {}, options: { ...c, ...n }, screen: d };
972
1309
  }
973
- const { name: r, screen: o, params: a = {}, options: l = {}, ...f } = e;
1310
+ const { name: r, screen: o, params: s = {}, options: i = {}, ...u } = e;
974
1311
  if (typeof r != "string" || !r.trim())
975
1312
  throw new TypeError("[react-modal-navigation] open config requires a non-empty string name");
976
- if (l === null || typeof l != "object" || Array.isArray(l))
1313
+ if (i === null || typeof i != "object" || Array.isArray(i))
977
1314
  throw new TypeError("[react-modal-navigation] open config options must be an object");
978
1315
  if (o !== void 0 && (typeof o != "string" || !o.trim()))
979
1316
  throw new TypeError("[react-modal-navigation] screen must be a non-empty string");
980
- return { name: r, ...o === void 0 ? {} : { screen: o }, params: a, options: { ...f, ...l } };
1317
+ return { name: r, ...o === void 0 ? {} : { screen: o }, params: s, options: { ...u, ...i } };
981
1318
  }
982
- function Qn() {
1319
+ function Sr() {
983
1320
  const e = /* @__PURE__ */ new Map();
984
1321
  return {
985
1322
  wait(t) {
@@ -998,729 +1335,756 @@ function Qn() {
998
1335
  pendingCount: () => e.size
999
1336
  };
1000
1337
  }
1001
- const Zn = { placement: "right", showHeader: !0, showBackButton: !0, showCloseButton: !0, viewportGap: 5, borderRadius: 12, closeOnOverlay: !1, closeOnEsc: !0 };
1002
- function Xn(e, t) {
1338
+ const Rr = { placement: "right", showHeader: !0, showBackButton: !0, showCloseButton: !0, viewportGap: 5, borderRadius: 12, closeOnOverlay: !1, closeOnEsc: !0 };
1339
+ function Cr(e, t) {
1003
1340
  let n = e;
1004
- const r = sn(), o = /* @__PURE__ */ new Set(), { confirmDiscard: a, onError: l } = n, f = je({ isOpen: !1, activeName: null, isFullscreen: !1, queueSize: 0, error: null }), u = je({ active: null, options: null, exiting: !1, error: null, translate: n.translate });
1005
- let i = null;
1006
- const d = (c) => {
1007
- i = c, Te();
1341
+ const r = Cn(), o = /* @__PURE__ */ new Set(), { confirmDiscard: s, onError: i } = n, u = $e({ isOpen: !1, activeName: null, isFullscreen: !1, queueSize: 0, error: null }), a = $e({ active: null, options: null, exiting: !1, error: null, translate: n.translate });
1342
+ let c = null;
1343
+ const d = (f) => {
1344
+ c = f, De();
1008
1345
  };
1009
1346
  let g = null;
1010
- const b = (c) => {
1011
- g = c, Te();
1347
+ const x = (f) => {
1348
+ g = f, De();
1349
+ };
1350
+ let b = 0;
1351
+ const h = (f) => {
1352
+ b = f, De();
1353
+ }, l = { current: null }, y = { current: /* @__PURE__ */ new Map() }, C = { current: [] }, L = { current: null }, S = { current: null }, j = { current: 0 }, D = { current: null }, R = { current: !1 }, k = { current: 0 }, O = { current: null }, A = { current: /* @__PURE__ */ new Map() };
1354
+ let N = !1;
1355
+ const W = (f) => {
1356
+ N = f, De();
1357
+ }, Q = { current: s };
1358
+ let ne = new AbortController();
1359
+ const re = () => {
1360
+ ne.abort(), ne = new AbortController();
1012
1361
  };
1013
- let x = 0;
1014
- const h = (c) => {
1015
- x = c, Te();
1016
- }, s = { current: null }, v = { current: /* @__PURE__ */ new Map() }, I = { current: [] }, z = { current: null }, T = { current: null }, E = { current: 0 }, D = { current: null }, L = { current: !1 }, A = { current: 0 }, q = { current: null }, N = { current: /* @__PURE__ */ new Map() };
1017
- let Z = !1;
1018
- const ue = (c) => {
1019
- Z = c, Te();
1020
- }, C = { current: a }, F = (c, y) => {
1021
- const R = N.current.get(c) ?? /* @__PURE__ */ new Set();
1022
- return N.current.set(c, R), R.add(y), () => {
1023
- R.delete(y), !R.size && N.current.get(c) === R && N.current.delete(c);
1362
+ let I = 0;
1363
+ const _ = (f, w) => {
1364
+ const B = A.current.get(f) ?? /* @__PURE__ */ new Set();
1365
+ A.current.set(f, B);
1366
+ const M = { get dirty() {
1367
+ return w.dirty;
1368
+ }, get message() {
1369
+ return w.message;
1370
+ }, get onBeforeDiscard() {
1371
+ return w.onBeforeDiscard;
1372
+ } };
1373
+ return B.add(M), I++, () => {
1374
+ B.delete(M) && (I++, !B.size && A.current.get(f) === B && A.current.delete(f));
1024
1375
  };
1025
- }, $ = async (c, y) => {
1026
- for (const R of c) for (const w of [...N.current.get(R) ?? []]) {
1027
- if (!N.current.get(R)?.has(w) || !w.dirty) continue;
1028
- if ((w.onBeforeDiscard ? await w.onBeforeDiscard(y) : C.current ? await C.current(y) : typeof window < "u" && typeof window.confirm == "function" ? window.confirm(w.message || "有未保存的修改,确定放弃吗?") : !1) === !1) return !1;
1376
+ }, le = async (f, w) => {
1377
+ const B = I, M = ne.signal;
1378
+ for (const J of new Set(f)) for (const U of [...A.current.get(J) ?? []]) {
1379
+ if (!A.current.get(J)?.has(U) || !U.dirty) continue;
1380
+ const fe = U.onBeforeDiscard ? await Ie(() => U.onBeforeDiscard(w), w, M) : Q.current ? await Ie(() => Q.current(w), w, M) : typeof window < "u" && typeof window.confirm == "function" ? window.confirm(U.message || "有未保存的修改,确定放弃吗?") : !1;
1381
+ if (M.aborted || fe === !1 || B !== I) return !1;
1029
1382
  }
1030
- return !0;
1031
- }, X = (c) => $([...N.current.keys()], c), B = { current: !0 }, te = { current: null };
1032
- te.current || (te.current = Qn());
1033
- const V = { current: l }, oe = ((c, y) => {
1034
- B.current && b(c);
1383
+ return !M.aborted && B === I;
1384
+ }, E = (f) => le([...A.current.keys()], f), z = { current: !0 }, K = { current: null };
1385
+ K.current || (K.current = Sr());
1386
+ const P = { current: i }, F = ((f, w) => {
1387
+ z.current && x(f);
1035
1388
  try {
1036
- V.current ? V.current(c, y) : console.error("[react-modal-navigation]", c);
1037
- } catch (R) {
1038
- console.error("[react-modal-navigation] onError failed", R);
1389
+ P.current ? P.current(f, w) : console.error("[react-modal-navigation]", f);
1390
+ } catch (B) {
1391
+ console.error("[react-modal-navigation] onError failed", B);
1039
1392
  }
1040
- }), J = ((c, y) => {
1041
- const R = v.current.get(c);
1042
- v.current.delete(c);
1043
- for (const w of R ?? []) w(y);
1044
- }), O = ((c) => ({ ...Zn, ...n.defaultOptions, ...n.theme !== void 0 ? { theme: n.theme } : {}, ...n.backgroundColor !== void 0 ? { backgroundColor: n.backgroundColor } : {}, ...c.config.modalOptions, ...c.overrides, runtimeLayout: c.runtimeLayout })), G = (async (c = "api", y, R = {}) => {
1045
- const w = s.current;
1046
- if (!w || D.current || L.current) return !1;
1047
- const H = A.current;
1048
- D.current = w.id, L.current = !0;
1049
- const W = O(w), ae = { ...R, reason: c, result: y, name: w.name };
1393
+ }), Z = ((f, w) => {
1394
+ const B = y.current.get(f);
1395
+ y.current.delete(f);
1396
+ for (const M of B ?? []) M(w);
1397
+ }), de = ((f) => ({ ...Rr, ...n.defaultOptions, ...n.theme !== void 0 ? { theme: n.theme } : {}, ...n.backgroundColor !== void 0 ? { backgroundColor: n.backgroundColor } : {}, ...f.config.modalOptions, ...f.overrides, runtimeLayout: f.runtimeLayout })), te = (async (f = "api", w, B = {}) => {
1398
+ const M = l.current;
1399
+ if (!M || D.current || R.current) return !1;
1400
+ const J = M.runtime.beginTransaction();
1401
+ if (!J) return !1;
1402
+ const U = k.current, fe = ne.signal;
1403
+ D.current = M.id, R.current = !0;
1404
+ const ae = de(M), ie = { ...B, reason: f, result: w, name: M.name };
1050
1405
  try {
1051
- if (!await X(ae) || H !== A.current || s.current?.id !== w.id || !await w.runtime.canRemove(w.runtime.stores.navigation.getSnapshot().stack.map((pe) => pe.key), ae) || H !== A.current || s.current?.id !== w.id || await W.onBeforeClose?.(ae) === !1 || H !== A.current || s.current?.id !== w.id || !B.current) return !1;
1052
- ue(!0);
1053
- const me = W.animation === !1 || typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, Number(W.animationDuration ?? 220) || 0);
1054
- if (await te.current.wait(Math.min(me, 1e3)), !B.current || s.current?.id !== w.id) return !1;
1055
- w.runtime.destroy(), s.current = null, q.current = null, Z = !1, d(null), N.current.clear();
1056
- const ie = R.confirmed || y !== void 0 ? { status: "confirmed", value: y, reason: c } : { status: "dismissed", reason: c };
1057
- J(w.id, ie), r.emit("close", { id: w.id, name: w.name, result: ie });
1406
+ const Re = I;
1407
+ if (!await E(ie) || U !== k.current || l.current?.id !== M.id) return !1;
1408
+ const je = M.runtime.routeGroups.getGuardRevision(), $ = M.runtime.getRemovalRevision();
1409
+ if (!await M.runtime.routeGroups.canLeave(null, null, ie, !0) || !await M.runtime.canRemove(M.runtime.stores.navigation.getSnapshot().stack.map((ze) => ze.key), ie) || U !== k.current || l.current?.id !== M.id || ae.onBeforeClose && !await Ie(() => ae.onBeforeClose(ie), ie, fe) || U !== k.current || l.current?.id !== M.id || !z.current || Re !== I || je !== M.runtime.routeGroups.getGuardRevision() || $ !== M.runtime.getRemovalRevision()) return !1;
1410
+ W(!0);
1411
+ const ue = ae.animation === !1 || typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, Number(ae.animationDuration ?? 220) || 0);
1412
+ if (await K.current.wait(Math.min(ue, 1e3)), !z.current || l.current?.id !== M.id) return !1;
1413
+ if (Re !== I || je !== M.runtime.routeGroups.getGuardRevision() || $ !== M.runtime.getRemovalRevision())
1414
+ return W(!1), !1;
1415
+ M.runtime.destroy(), l.current = null, O.current = null, N = !1, d(null), A.current.clear();
1416
+ const pe = B.confirmed || w !== void 0 ? { status: "confirmed", value: w, reason: f } : { status: "dismissed", reason: f };
1417
+ Z(M.id, pe), r.emit("close", { id: M.id, name: M.name, result: pe });
1058
1418
  try {
1059
- (R.confirmed || y !== void 0) && await W.onConfirmed?.(y), await W.onClose?.(ae), await W.onClosed?.(ae);
1060
- } catch (pe) {
1061
- H === A.current && oe(pe, { phase: "onClose", name: w.name });
1419
+ (B.confirmed || w !== void 0) && await Ie(() => ae.onConfirmed?.(w), ie, fe), await Ie(() => ae.onClose?.(ie), ie, fe), await Ie(() => ae.onClosed?.(ie), ie, fe);
1420
+ } catch (ze) {
1421
+ U === k.current && F(ze, { phase: "onClose", name: M.name });
1062
1422
  }
1063
1423
  return !0;
1064
- } catch (me) {
1065
- return H === A.current && s.current?.id === w.id && oe(me, { phase: "onBeforeClose", name: w.name }), !1;
1424
+ } catch (Re) {
1425
+ return U === k.current && l.current?.id === M.id && (N && W(!1), F(Re, { phase: "onBeforeClose", name: M.name })), !1;
1066
1426
  } finally {
1067
- D.current === w.id && (D.current = null), H === A.current && (L.current = !1), !s.current && B.current && queueMicrotask(() => T.current?.());
1427
+ J(), D.current === M.id && (D.current = null), U === k.current && (R.current = !1), !l.current && z.current && queueMicrotask(() => S.current?.());
1068
1428
  }
1069
- }), ke = (async (c, y = {}, R = {}, w, H) => {
1070
- if (!B.current || L.current || D.current) return null;
1071
- L.current = !0;
1072
- const W = A.current;
1429
+ }), v = (async (f, w = {}, B = {}, M, J) => {
1430
+ if (!z.current || R.current || D.current) return null;
1431
+ const U = l.current?.runtime, fe = U?.beginTransaction();
1432
+ if (U && !fe) return null;
1433
+ R.current = !0;
1434
+ const ae = k.current, ie = ne.signal;
1073
1435
  try {
1074
- const ae = await an(c, n.registry);
1075
- if (!B.current || W !== A.current) return null;
1076
- const me = (he) => he.loader && !he.component ? { ...he, component: t(he.loader) } : he, ie = ae.screens ? { ...ae, screens: Object.fromEntries(Object.entries(ae.screens).map(([he, ze]) => [he, me(ze)])) } : me(ae);
1077
- c = typeof c == "string" ? c : ae.name ?? "inline";
1078
- const pe = ie?.component && !ie.screens ? { ...ie, singlePage: !0, initialRoute: "__single__", screens: { __single__: { component: ie.component, title: ie.title, ...ae.screenOptions ?? {} } } } : ie;
1079
- if (!pe) throw new Error(`[react-modal-navigation] Unknown modal: ${c}`);
1080
- const Re = H ?? pe.initialRoute ?? Object.keys(pe.screens ?? {})[0];
1081
- if (!pe.screens || !Object.hasOwn(pe.screens, Re) || !pe.screens[Re]) throw new Error(`[react-modal-navigation] Unknown initial screen '${Re}' in modal '${c}'`);
1082
- const S = s.current, le = R.instanceKey ?? pe.modalOptions?.instanceKey, Le = R.duplicateStrategy ?? pe.modalOptions?.duplicateStrategy;
1083
- if (S && le != null && S.instanceKey === le) {
1084
- if (Le === "ignore") return null;
1085
- if (Le === "reuse") {
1086
- if (w) {
1087
- const he = v.current.get(S.id) ?? [];
1088
- he.push(w), v.current.set(S.id, he);
1436
+ const Re = await Rn(f, n.registry);
1437
+ if (!z.current || ae !== k.current) return null;
1438
+ const je = (be) => be.loader && !be.component ? { ...be, component: t(be.loader) } : be, $ = Re.screens ? on(Re.screens) : null, ue = $ ? { ...Re, routeAliases: $.aliases, screens: Object.fromEntries(Object.entries($.screens).map(([be, Ce]) => [be, je(Ce)])) } : je(Re);
1439
+ f = typeof f == "string" ? f : Re.name ?? "inline";
1440
+ const pe = ue?.component && !ue.screens ? { ...ue, singlePage: !0, initialRoute: "__single__", screens: { __single__: { component: ue.component, title: ue.title, ...Re.screenOptions ?? {} } } } : ue;
1441
+ if (!pe) throw new Error(`[react-modal-navigation] Unknown modal: ${f}`);
1442
+ const ze = Ct(J ?? pe.initialRoute ?? Object.keys(pe.screens ?? {})[0], pe.routeAliases);
1443
+ if (!pe.screens || !Object.hasOwn(pe.screens, ze) || !pe.screens[ze]) throw new Error(`[react-modal-navigation] Unknown initial screen '${ze}' in modal '${f}'`);
1444
+ const ce = l.current, rt = B.instanceKey ?? pe.modalOptions?.instanceKey, _e = B.duplicateStrategy ?? pe.modalOptions?.duplicateStrategy;
1445
+ if (ce && rt != null && ce.instanceKey === rt) {
1446
+ if (_e === "ignore") return null;
1447
+ if (_e === "reuse") {
1448
+ if (M) {
1449
+ const be = y.current.get(ce.id) ?? [];
1450
+ be.push(M), y.current.set(ce.id, be);
1089
1451
  }
1090
- return S.id;
1452
+ return ce.id;
1091
1453
  }
1092
1454
  }
1093
- if (S) {
1094
- const he = O(S), ze = { reason: "replace", name: S.name, nextName: c };
1455
+ if (ce) {
1456
+ const be = de(ce), Ce = { reason: "replace", name: ce.name, nextName: f };
1095
1457
  try {
1096
- if (!await X(ze) || W !== A.current || s.current?.id !== S.id || !await S.runtime.canRemove(S.runtime.stores.navigation.getSnapshot().stack.map((Fe) => Fe.key), ze) || W !== A.current || s.current?.id !== S.id || await he.onBeforeClose?.(ze) === !1) return null;
1097
- } catch (Fe) {
1098
- return W === A.current && s.current?.id === S.id && oe(Fe, { phase: "onBeforeClose", name: S.name }), null;
1458
+ const He = I;
1459
+ if (!await E(Ce) || ae !== k.current || l.current?.id !== ce.id) return null;
1460
+ const zt = ce.runtime.routeGroups.getGuardRevision(), p = ce.runtime.getRemovalRevision();
1461
+ if (!await ce.runtime.routeGroups.canLeave(null, null, Ce, !0) || !await ce.runtime.canRemove(ce.runtime.stores.navigation.getSnapshot().stack.map((T) => T.key), Ce) || ae !== k.current || l.current?.id !== ce.id || be.onBeforeClose && !await Ie(() => be.onBeforeClose(Ce), Ce, ie) || He !== I || zt !== ce.runtime.routeGroups.getGuardRevision() || p !== ce.runtime.getRemovalRevision()) return null;
1462
+ } catch (He) {
1463
+ return ae === k.current && l.current?.id === ce.id && F(He, { phase: "onBeforeClose", name: ce.name }), null;
1099
1464
  }
1100
- if (!B.current || W !== A.current || s.current?.id !== S.id) return null;
1101
- S.runtime.destroy(), s.current = null, q.current = null, d(null), N.current.clear();
1102
- const qe = { status: "replaced", reason: "replace" };
1103
- J(S.id, qe), r.emit("close", { id: S.id, name: S.name, result: qe });
1465
+ if (!z.current || ae !== k.current || l.current?.id !== ce.id) return null;
1466
+ ce.runtime.destroy(), l.current = null, O.current = null, d(null), A.current.clear();
1467
+ const Ue = { status: "replaced", reason: "replace" };
1468
+ Z(ce.id, Ue), r.emit("close", { id: ce.id, name: ce.name, result: Ue });
1104
1469
  try {
1105
- await he.onClose?.(ze), await he.onClosed?.(ze);
1106
- } catch (Fe) {
1107
- W === A.current && oe(Fe, { phase: "onClose", name: S.name });
1470
+ await Ie(() => be.onClose?.(Ce), Ce, ie), await Ie(() => be.onClosed?.(Ce), Ce, ie);
1471
+ } catch (He) {
1472
+ ae === k.current && F(He, { phase: "onClose", name: ce.name });
1108
1473
  }
1109
- if (!B.current || W !== A.current) return null;
1474
+ if (!z.current || ae !== k.current) return null;
1110
1475
  }
1111
- const ye = { id: ++E.current, name: c, screen: Re, params: y, config: pe, overrides: R, instanceKey: le };
1112
- return ye.runtime = Yn(ye, O(ye)), ye.runtime.bindings = _e(ye.id), s.current = ye, q.current = null, w && v.current.set(ye.id, [w]), g = null, d(ye), r.emit("open", { id: ye.id, name: ye.name }), ye.id;
1476
+ const Te = { id: ++j.current, name: f, screen: ze, params: w, config: pe, overrides: B, instanceKey: rt };
1477
+ return Te.runtime = xr(Te, de(Te)), Te.runtime.bindings = nt(Te.id), l.current = Te, O.current = null, M && y.current.set(Te.id, [M]), g = null, d(Te), r.emit("open", { id: Te.id, name: Te.name }), Te.id;
1113
1478
  } finally {
1114
- W === A.current && (L.current = !1), !s.current && B.current && queueMicrotask(() => T.current?.());
1479
+ fe?.(), ae === k.current && (R.current = !1), !l.current && z.current && queueMicrotask(() => S.current?.());
1115
1480
  }
1116
1481
  });
1117
- z.current = ke;
1118
- const Ce = (async () => {
1119
- if (!B.current || s.current || L.current || D.current) return;
1120
- const c = I.current.shift();
1121
- if (c) {
1122
- o.add(c), h(I.current.length);
1482
+ L.current = v;
1483
+ const H = (async () => {
1484
+ if (!z.current || l.current || R.current || D.current) return;
1485
+ const f = C.current.shift();
1486
+ if (f) {
1487
+ o.add(f), h(C.current.length);
1123
1488
  try {
1124
- const y = await z.current(c.args.name, c.args.params, c.args.options, c.resolveResult, c.args.screen);
1125
- y === null ? (c.resolveResult?.({ status: "dismissed", reason: "blocked" }), c.resolveId?.(null), queueMicrotask(() => T.current?.())) : c.resolveId?.(y);
1126
- } catch (y) {
1127
- c.reject?.(y), queueMicrotask(() => T.current?.());
1489
+ const w = await L.current(f.args.name, f.args.params, f.args.options, f.resolveResult, f.args.screen);
1490
+ w === null ? (f.resolveResult?.({ status: "dismissed", reason: "blocked" }), f.resolveId?.(null), queueMicrotask(() => S.current?.())) : f.resolveId?.(w);
1491
+ } catch (w) {
1492
+ f.reject?.(w), queueMicrotask(() => S.current?.());
1128
1493
  } finally {
1129
- o.delete(c);
1494
+ o.delete(f);
1130
1495
  }
1131
1496
  }
1132
1497
  });
1133
- T.current = Ce;
1134
- const K = ((c, y, R) => {
1135
- if (!B.current) return Promise.resolve(null);
1136
- const w = nt(c, y, R);
1137
- return typeof w.name == "string" && !n.registry?.[w.name] ? Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${w.name}`)) : new Promise((H, W) => {
1138
- I.current.push({ args: w, resolveId: H, reject: W }), h(I.current.length), queueMicrotask(() => T.current?.());
1498
+ S.current = H;
1499
+ const ke = ((f, w, B) => {
1500
+ if (!z.current) return Promise.resolve(null);
1501
+ const M = ft(f, w, B);
1502
+ return typeof M.name == "string" && !n.registry?.[M.name] ? Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${M.name}`)) : new Promise((J, U) => {
1503
+ C.current.push({ args: M, resolveId: J, reject: U }), h(C.current.length), queueMicrotask(() => S.current?.());
1139
1504
  });
1140
- }), de = ((c, y, R) => {
1141
- if (!B.current) return Promise.resolve({ status: "dismissed", reason: "unmount" });
1142
- const w = nt(c, y, R);
1143
- return typeof w.name == "string" && !n.registry?.[w.name] ? Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${w.name}`)) : new Promise((H, W) => {
1144
- I.current.push({ args: w, resolveResult: H, reject: W }), h(I.current.length), queueMicrotask(() => T.current?.());
1505
+ }), xe = ((f, w, B) => {
1506
+ if (!z.current) return Promise.resolve({ status: "dismissed", reason: "unmount" });
1507
+ const M = ft(f, w, B);
1508
+ return typeof M.name == "string" && !n.registry?.[M.name] ? Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${M.name}`)) : new Promise((J, U) => {
1509
+ C.current.push({ args: M, resolveResult: J, reject: U }), h(C.current.length), queueMicrotask(() => S.current?.());
1145
1510
  });
1146
- }), k = ((c) => {
1147
- if (!c || typeof c != "object" || Array.isArray(c)) throw new TypeError("[react-modal-navigation] update expects an options object");
1148
- const y = s.current;
1149
- return !y || L.current ? !1 : (Object.keys(c).every((R) => Object.is(O(y)[R], c[R])) || (y.overrides = { ...y.overrides, ...c }, y.runtimeLayout = { ...y.runtimeLayout, ...c }, Te()), !0);
1150
- }), ce = ((c, y) => Wn(c, n.registry, y)), ne = ((c) => k({ fullscreen: !!c })), re = (() => ne(!(s.current && O(s.current).fullscreen))), Be = ((c = "queue-cleared") => {
1151
- const y = I.current.splice(0);
1511
+ }), Ae = ((f) => {
1512
+ if (!f || typeof f != "object" || Array.isArray(f)) throw new TypeError("[react-modal-navigation] update expects an options object");
1513
+ const w = l.current;
1514
+ return !w || R.current ? !1 : (Object.keys(f).every((B) => Object.is(de(w)[B], f[B])) || (w.overrides = { ...w.overrides, ...f }, w.runtimeLayout = { ...w.runtimeLayout, ...f }, De()), !0);
1515
+ }), Qe = ((f, w) => gr(f, n.registry, w)), ye = ((f) => Ae({ fullscreen: !!f })), ve = (() => ye(!(l.current && de(l.current).fullscreen))), ct = ((f = "queue-cleared") => {
1516
+ const w = C.current.splice(0);
1152
1517
  h(0);
1153
- for (const R of y)
1154
- R.resolveId?.(null), R.resolveResult?.({ status: "dismissed", reason: c });
1155
- return y.length;
1156
- }), st = ((c, y, R) => {
1157
- const w = nt(c, y, R);
1158
- return ke(w.name, w.params, w.options, void 0, w.screen);
1159
- }), We = ((c, y, R) => {
1160
- const w = nt(c, y, R);
1161
- return new Promise((H, W) => {
1162
- ke(w.name, w.params, w.options, H, w.screen).then((ae) => {
1163
- ae === null && H({ status: "dismissed", reason: "blocked" });
1164
- }, W);
1518
+ for (const B of w)
1519
+ B.resolveId?.(null), B.resolveResult?.({ status: "dismissed", reason: f });
1520
+ return w.length;
1521
+ }), ht = ((f, w, B) => {
1522
+ const M = ft(f, w, B);
1523
+ return v(M.name, M.params, M.options, void 0, M.screen);
1524
+ }), et = ((f, w, B) => {
1525
+ const M = ft(f, w, B);
1526
+ return new Promise((J, U) => {
1527
+ v(M.name, M.params, M.options, J, M.screen).then((fe) => {
1528
+ fe === null && J({ status: "dismissed", reason: "blocked" });
1529
+ }, U);
1165
1530
  });
1166
- }), it = (async (c, y, R) => {
1167
- const w = nt(c, y, R);
1168
- let H;
1169
- const W = new Promise((S) => {
1170
- H = S;
1171
- }), ae = await ke(w.name, w.params, w.options, H, w.screen);
1172
- ae === null && H({ status: "dismissed", reason: "blocked" });
1173
- const me = () => ae !== null && s.current?.id === ae && s.current.runtime.alive.current, ie = () => me() ? s.current.runtime : null, pe = ie()?.ready.then((S) => S && me()) ?? Promise.resolve(!1), Re = (S, ...le) => ie()?.navigationCommands?.[S]?.(...le) ?? !1;
1531
+ }), gt = (async (f, w, B) => {
1532
+ const M = ft(f, w, B);
1533
+ let J;
1534
+ const U = new Promise(($) => {
1535
+ J = $;
1536
+ }), fe = await v(M.name, M.params, M.options, J, M.screen);
1537
+ fe === null && J({ status: "dismissed", reason: "blocked" });
1538
+ const ae = () => fe !== null && l.current?.id === fe && l.current.runtime.alive.current, ie = () => ae() ? l.current.runtime : null, Re = ie()?.ready.then(($) => $ && ae()) ?? Promise.resolve(!1), je = ($, ...ue) => ie()?.navigationCommands?.[$]?.(...ue) ?? !1;
1174
1539
  return {
1175
- id: ae,
1176
- result: W,
1177
- isActive: me,
1178
- replaceOptions: (S) => {
1179
- if (!me() || L.current) return !1;
1180
- const le = s.current;
1181
- return le.overrides = { ...S }, le.runtimeLayout = void 0, Te(), !0;
1540
+ id: fe,
1541
+ result: U,
1542
+ isActive: ae,
1543
+ replaceOptions: ($) => {
1544
+ if (!ae() || R.current) return !1;
1545
+ const ue = l.current;
1546
+ return ue.overrides = { ...$ }, ue.runtimeLayout = void 0, De(), !0;
1182
1547
  },
1183
1548
  dispose: () => {
1184
- if (!me()) return !1;
1185
- const S = s.current;
1186
- A.current++, te.current.cancelAll(), s.current = null, q.current = null, D.current = null, L.current = !1, Z = !1, N.current.clear(), S.runtime.destroy(), d(null);
1187
- const le = { status: "dismissed", reason: "unmount" };
1188
- return J(ae, le), r.emit("close", { id: ae, name: S.name, result: le }), queueMicrotask(() => T.current?.()), !0;
1549
+ if (!ae()) return !1;
1550
+ const $ = l.current;
1551
+ k.current++, re(), K.current.cancelAll(), l.current = null, O.current = null, D.current = null, R.current = !1, N = !1, A.current.clear(), $.runtime.destroy(), d(null);
1552
+ const ue = { status: "dismissed", reason: "unmount" };
1553
+ return Z(fe, ue), r.emit("close", { id: fe, name: $.name, result: ue }), queueMicrotask(() => S.current?.()), !0;
1189
1554
  },
1190
- ready: pe,
1191
- on: (S, le) => ie()?.events.on(S, le) ?? (() => {
1555
+ ready: Re,
1556
+ on: ($, ue) => ie()?.events.on($, ue) ?? (() => {
1192
1557
  }),
1193
- off: (S, le) => ie()?.events.off(S, le),
1558
+ off: ($, ue) => ie()?.events.off($, ue),
1194
1559
  getSnapshot: () => ie()?.getSnapshot() ?? null,
1195
- subscribeState: (S, le, Le, ye) => ie()?.subscribeState(S, le, Le, ye) ?? (() => {
1560
+ subscribeState: ($, ue, pe, ze) => ie()?.subscribeState($, ue, pe, ze) ?? (() => {
1196
1561
  }),
1197
1562
  getState: () => ie()?.stores.navigation.getSnapshot() ?? null,
1198
- subscribe: (S) => ie()?.stores.navigation.subscribe(S) ?? (() => {
1563
+ subscribe: ($) => ie()?.stores.navigation.subscribe($) ?? (() => {
1199
1564
  }),
1200
- clearCache: async (S) => !!await Re("clearCache", S),
1201
- navigate: async (...S) => !!await Re("navigate", ...S),
1202
- setParams: (S) => ie()?.navigationCommands ? (Re("setParams", S), !0) : !1,
1203
- setLoading: (S, le) => ie()?.navigationCommands?.setLoading ? (Re("setLoading", S, le), !0) : !1,
1204
- setOptions: (S) => me() && k(S),
1205
- setFullscreen: (S) => me() && k({ fullscreen: !!S }),
1206
- close: (S) => me() ? G("api", S) : Promise.resolve(!1),
1207
- confirm: (S) => me() ? G("confirm", S, { confirmed: !0 }) : Promise.resolve(!1)
1565
+ clearCache: async ($) => !!await je("clearCache", $),
1566
+ navigate: async (...$) => !!await je("navigate", ...$),
1567
+ setParams: ($) => ie()?.navigationCommands ? (je("setParams", $), !0) : !1,
1568
+ setLoading: ($, ue) => ie()?.navigationCommands?.setLoading ? (je("setLoading", $, ue), !0) : !1,
1569
+ setOptions: ($) => ae() && Ae($),
1570
+ setFullscreen: ($) => ae() && Ae({ fullscreen: !!$ }),
1571
+ close: ($) => ae() ? te("api", $) : Promise.resolve(!1),
1572
+ confirm: ($) => ae() ? te("confirm", $, { confirmed: !0 }) : Promise.resolve(!1)
1208
1573
  };
1209
- }), Qe = ((c) => G("api", c)), ct = ((c = "api") => G(c)), Ne = ((c) => G("confirm", c, { confirmed: !0 })), lt = ((c, y) => q.current?.setLoading(c, y)), Ze = () => b(null), Ge = /* @__PURE__ */ new Set(), De = { inspect: (c) => {
1210
- const y = _n({ hostStore: u, statusStore: f, commands: De }, c), R = y.dispose;
1211
- return y.dispose = () => {
1212
- Ge.delete(y), R();
1213
- }, Ge.add(y), B.current || y.dispose(), y;
1214
- }, on: r.on, off: r.off, open: st, openInstance: it, openAsync: We, enqueue: K, enqueueAsync: de, update: k, setOptions: k, preload: ce, setFullscreen: ne, toggleFullscreen: re, clearQueue: Be, close: Qe, dismiss: ct, confirm: Ne, setLoading: lt, clearError: Ze }, Ee = (c, y) => Object.keys(c).length === Object.keys(y).length && Object.keys(c).every((R) => Object.is(c[R], y[R]));
1215
- function Te() {
1216
- const c = i ? O(i) : null, y = u.getSnapshot();
1217
- i && !Ee(c, i.runtime.stores.layout.getSnapshot()) && i.runtime.stores.layout.publish(c);
1218
- const R = i ? y.active === i ? y.options : c : null, w = { isOpen: !!i, activeName: i?.name ?? null, isFullscreen: !!c?.fullscreen, queueSize: x, error: g }, H = { active: i, options: R, exiting: Z, error: g, translate: n.translate }, W = f.getSnapshot();
1219
- Ee(w, W) || f.publish(w), Ee(H, y) || u.publish(H), W.queueSize !== w.queueSize && r.emit("queueChange", { previous: W.queueSize, current: w.queueSize });
1574
+ }), lt = ((f) => te("api", f)), yt = ((f = "api") => te(f)), Ke = ((f) => te("confirm", f, { confirmed: !0 })), vt = ((f, w) => O.current?.setLoading(f, w)), ut = () => x(null), tt = /* @__PURE__ */ new Set(), Ze = { inspect: (f) => {
1575
+ const w = vr({ hostStore: a, statusStore: u, commands: Ze }, f), B = w.dispose;
1576
+ return w.dispose = () => {
1577
+ tt.delete(w), B();
1578
+ }, tt.add(w), z.current || w.dispose(), w;
1579
+ }, on: r.on, off: r.off, open: ht, openInstance: gt, openAsync: et, enqueue: ke, enqueueAsync: xe, update: Ae, setOptions: Ae, preload: Qe, setFullscreen: ye, toggleFullscreen: ve, clearQueue: ct, close: lt, dismiss: yt, confirm: Ke, setLoading: vt, clearError: ut }, Le = (f, w) => Object.keys(f).length === Object.keys(w).length && Object.keys(f).every((B) => Object.is(f[B], w[B]));
1580
+ function De() {
1581
+ const f = c ? de(c) : null, w = a.getSnapshot();
1582
+ c && !Le(f, c.runtime.stores.layout.getSnapshot()) && c.runtime.stores.layout.publish(f);
1583
+ const B = c ? w.active === c ? w.options : f : null, M = { isOpen: !!c, activeName: c?.name ?? null, isFullscreen: !!f?.fullscreen, queueSize: b, error: g }, J = { active: c, options: B, exiting: N, error: g, translate: n.translate }, U = u.getSnapshot();
1584
+ Le(M, U) || u.publish(M), Le(J, w) || a.publish(J), U.queueSize !== M.queueSize && r.emit("queueChange", { previous: U.queueSize, current: M.queueSize });
1220
1585
  }
1221
- const _e = (c) => ({
1222
- registerLoading: (y) => {
1223
- s.current?.id === c && (q.current = y);
1586
+ const nt = (f) => ({
1587
+ registerLoading: (w) => {
1588
+ l.current?.id === f && (O.current = w);
1224
1589
  },
1225
- registerDirtyGuard: (y, R) => s.current?.id === c ? F(y, R) : () => {
1590
+ registerDirtyGuard: (w, B) => l.current?.id === f ? _(w, B) : () => {
1226
1591
  },
1227
- getProtectedCacheKeys: () => s.current?.id === c ? new Set([...N.current].filter(([, y]) => [...y].some((R) => R.dirty)).map(([y]) => y)) : /* @__PURE__ */ new Set(),
1228
- canNavigate: (y, R) => s.current?.id === c ? $(y, R) : Promise.resolve(!1),
1229
- onRequestClose: (...y) => s.current?.id === c ? G(...y) : Promise.resolve(!1),
1230
- onOpened: (y) => {
1231
- if (s.current?.id !== c) return;
1232
- const R = O(s.current), w = (H, W) => {
1233
- s.current?.id === c && oe(H, { phase: W });
1592
+ getDirtyRevision: () => I,
1593
+ getProtectedCacheKeys: () => l.current?.id === f ? new Set([...A.current].filter(([, w]) => [...w].some((B) => B.dirty)).map(([w]) => w)) : /* @__PURE__ */ new Set(),
1594
+ canNavigate: (w, B) => l.current?.id === f ? le(w, B) : Promise.resolve(!1),
1595
+ onRequestClose: (...w) => l.current?.id === f ? te(...w) : Promise.resolve(!1),
1596
+ onOpened: (w) => {
1597
+ if (l.current?.id !== f) return;
1598
+ const B = de(l.current), M = (J, U) => {
1599
+ l.current?.id === f && F(J, { phase: U });
1234
1600
  };
1235
- for (const H of ["onOpen", "onOpened"])
1601
+ for (const J of ["onOpen", "onOpened"])
1236
1602
  try {
1237
- Promise.resolve(R[H]?.(y)).catch((W) => w(W, H));
1238
- } catch (W) {
1239
- w(W, H);
1603
+ Promise.resolve(B[J]?.(w)).catch((U) => M(U, J));
1604
+ } catch (U) {
1605
+ M(U, J);
1240
1606
  }
1241
1607
  }
1242
1608
  });
1243
- return { commands: De, statusStore: f, hostStore: u, bindInstance: _e, configure: (c) => {
1244
- n = c, C.current = c.confirmDiscard, V.current = c.onError, Te();
1609
+ return { commands: Ze, statusStore: u, hostStore: a, bindInstance: nt, configure: (f) => {
1610
+ n = f, Q.current = f.confirmDiscard, P.current = f.onError, De();
1245
1611
  }, mount: () => {
1246
- B.current = !0;
1612
+ z.current = !0;
1247
1613
  }, destroy: () => {
1248
- B.current = !1;
1249
- for (const c of Ge) c.dispose();
1250
- r.clear(), A.current += 1, te.current.cancelAll(), s.current?.runtime.destroy(), s.current = null, q.current = null, D.current = null, L.current = !1;
1251
- for (const c of v.current.keys()) J(c, { status: "dismissed", reason: "unmount" });
1252
- v.current.clear(), N.current.clear(), i = null, Z = !1, g = null;
1253
- for (const c of o)
1254
- c.resolveId?.(null), c.resolveResult?.({ status: "dismissed", reason: "unmount" });
1255
- o.clear(), Be("unmount"), Te();
1256
- }, reportError: oe };
1257
- }
1258
- const Jn = Se.memo(function({ Screen: t, route: n, navigation: r }) {
1259
- return /* @__PURE__ */ p(t, { route: n, navigation: r });
1260
- }), er = Se.memo(function({ store: t, layoutStore: n, route: r, ...o }) {
1261
- const a = () => t.getSnapshot()[r.key], l = Oe(t.subscribe, a, a), f = Pe(n, Qt, He);
1262
- return /* @__PURE__ */ p(en, { ...o, options: f, route: r, override: l });
1263
- }), tr = Se.memo(function({ store: t, translate: n }) {
1264
- const r = Oe(t.subscribe, t.getSnapshot, t.getSnapshot);
1265
- return /* @__PURE__ */ p(tn, { loading: r, translate: n });
1266
- }), nr = Se.memo(function({ store: t, dismiss: n }) {
1267
- const r = Oe(t.subscribe, t.getSnapshot, t.getSnapshot);
1268
- return /* @__PURE__ */ p(nn, { items: r, dismiss: n });
1614
+ z.current = !1;
1615
+ for (const f of tt) f.dispose();
1616
+ r.clear(), k.current += 1, re(), K.current.cancelAll(), l.current?.runtime.destroy(), l.current = null, O.current = null, D.current = null, R.current = !1;
1617
+ for (const f of y.current.keys()) Z(f, { status: "dismissed", reason: "unmount" });
1618
+ y.current.clear(), A.current.clear(), c = null, N = !1, g = null;
1619
+ for (const f of o)
1620
+ f.resolveId?.(null), f.resolveResult?.({ status: "dismissed", reason: "unmount" });
1621
+ o.clear(), ct("unmount"), De();
1622
+ }, reportError: F };
1623
+ }
1624
+ const Mr = Oe.memo(function({ screen: t, route: n, navigation: r }) {
1625
+ return /* @__PURE__ */ m(fn, { screen: t, route: n, navigation: r });
1626
+ }), Er = Oe.memo(function({ store: t, layoutStore: n, route: r, ...o }) {
1627
+ const s = () => t.getSnapshot()[r.key], i = Ee(t.subscribe, s, s), u = Fe(n, hn, Ye);
1628
+ return /* @__PURE__ */ m(bn, { ...o, options: u, route: r, override: i });
1629
+ }), Pr = Oe.memo(function({ store: t, translate: n }) {
1630
+ const r = Ee(t.subscribe, t.getSnapshot, t.getSnapshot);
1631
+ return /* @__PURE__ */ m(wn, { loading: r, translate: n });
1632
+ }), Or = Oe.memo(function({ store: t, dismiss: n }) {
1633
+ const r = Ee(t.subscribe, t.getSnapshot, t.getSnapshot);
1634
+ return /* @__PURE__ */ m(kn, { items: r, dismiss: n });
1269
1635
  });
1270
- function rr({ runtime: e, config: t, initialScreen: n, params: r, translate: o, onRequestClose: a, onOpened: l, registerLoading: f, notifyError: u, error: i, clearError: d, registerDirtyGuard: g, exiting: b = !1 }) {
1271
- const x = Pe(e.stores.layout, En, He), h = n ?? t.initialRoute ?? Object.keys(t.screens)[0], [s, v] = xe(() => e.stores.navigation.getSnapshot().currentRoute), I = P(s);
1272
- I.current = s;
1273
- const z = t.screens[h], T = e.alive, E = P(null), { navigation: D, footer: L, loading: A, toast: q } = e.refs, N = P("single"), { loadingApi: Z, setLoading: ue } = on(A, T, N, e), { toast: C, dismissToast: F } = rn(q, T, e), $ = _((k, ce) => {
1274
- const ne = L.current, re = ne.getSnapshot();
1275
- if (ce === null) {
1276
- if (re[k] !== void 0) {
1277
- const Be = { ...re };
1278
- delete Be[k], ne.publish(Be);
1636
+ function Lr({ runtime: e, config: t, initialScreen: n, params: r, translate: o, onRequestClose: s, onOpened: i, registerLoading: u, notifyError: a, error: c, clearError: d, registerDirtyGuard: g, exiting: x = !1 }) {
1637
+ const b = Fe(e.stores.layout, Qn, Ye), h = n ?? t.initialRoute ?? Object.keys(t.screens)[0], [l, y] = Pe(() => e.stores.navigation.getSnapshot().currentRoute), C = G(l);
1638
+ C.current = l;
1639
+ const L = t.screens[h], S = e.alive, j = G(null), { navigation: D, footer: R, loading: k, toast: O } = e.refs, A = G("single"), { loadingApi: N, setLoading: W } = Sn(k, S, A, e), { toast: Q, dismissToast: ne } = xn(O, S, e), re = X((v, H) => {
1640
+ const ke = R.current, xe = ke.getSnapshot();
1641
+ if (H === null) {
1642
+ if (xe[v] !== void 0) {
1643
+ const Ae = { ...xe };
1644
+ delete Ae[v], ke.publish(Ae);
1279
1645
  }
1280
- } else re[k] !== ce && ne.publish({ ...re, [k]: ce });
1281
- }, []), X = _((k = "api", ce) => !T.current || A.current.getSnapshot().visible && e.stores.layout.getSnapshot().lockCloseWhileLoading !== !1 ? Promise.resolve(!1) : a(k, ce), [a, e]), B = _(() => Promise.resolve(!1), []), te = Q(() => ({
1282
- navigate: B,
1646
+ } else xe[v] !== H && ke.publish({ ...xe, [v]: H });
1647
+ }, []), I = X((v = "api", H) => !S.current || k.current.getSnapshot().visible && e.stores.layout.getSnapshot().lockCloseWhileLoading !== !1 ? Promise.resolve(!1) : s(v, H), [s, e]), _ = X(() => Promise.resolve(!1), []), le = V(() => ({
1648
+ navigate: _,
1283
1649
  navigateAsync: async () => ({ status: "cancelled" }),
1284
- replace: B,
1285
- reset: B,
1286
- clearCache: B,
1287
- goBack: B,
1288
- push: B,
1289
- pop: B,
1290
- popToTop: B,
1291
- popTo: B,
1292
- setParams: (k) => T.current ? (v((ce) => ({ ...ce, params: { ...ce.params, ...typeof k == "function" ? k(ce.params) : k } })), !0) : !1,
1293
- setOptions: (k) => T.current ? (v((ce) => ({ ...ce, options: { ...ce.options, ...k } })), !0) : !1,
1294
- close: X,
1295
- setLoading: ue,
1650
+ replace: _,
1651
+ reset: _,
1652
+ clearCache: _,
1653
+ goBack: _,
1654
+ push: _,
1655
+ pop: _,
1656
+ popToTop: _,
1657
+ popTo: _,
1658
+ setParams: (v) => S.current ? (y((H) => ({ ...H, params: { ...H.params, ...typeof v == "function" ? v(H.params) : v } })), !0) : !1,
1659
+ setOptions: (v) => S.current ? (y((H) => ({ ...H, options: { ...H.options, ...v } })), !0) : !1,
1660
+ close: I,
1661
+ setLoading: W,
1296
1662
  canGoBack: !1,
1297
- stack: [s],
1298
- currentRoute: s
1299
- }), [X, s, ue, B]), V = P(te);
1300
- V.current = te;
1301
- const oe = Q(() => ({
1302
- clearCache: (...k) => V.current.clearCache(...k),
1303
- navigate: (...k) => V.current.navigate(...k),
1304
- navigateAsync: (...k) => V.current.navigateAsync(...k),
1305
- replace: (...k) => V.current.replace(...k),
1306
- reset: (...k) => V.current.reset(...k),
1307
- goBack: (...k) => V.current.goBack(...k),
1308
- push: (...k) => V.current.push(...k),
1309
- pop: (...k) => V.current.pop(...k),
1310
- popToTop: (...k) => V.current.popToTop(...k),
1311
- popTo: (...k) => V.current.popTo(...k),
1312
- setParams: (...k) => V.current.setParams(...k),
1313
- setOptions: (...k) => V.current.setOptions(...k),
1314
- close: (...k) => V.current.close(...k),
1315
- setLoading: (...k) => V.current.setLoading(...k)
1663
+ stack: [l],
1664
+ currentRoute: l
1665
+ }), [I, l, W, _]), E = G(le);
1666
+ E.current = le;
1667
+ const z = V(() => ({
1668
+ clearCache: (...v) => E.current.clearCache(...v),
1669
+ navigate: (...v) => E.current.navigate(...v),
1670
+ navigateAsync: (...v) => E.current.navigateAsync(...v),
1671
+ replace: (...v) => E.current.replace(...v),
1672
+ reset: (...v) => E.current.reset(...v),
1673
+ goBack: (...v) => E.current.goBack(...v),
1674
+ push: (...v) => E.current.push(...v),
1675
+ pop: (...v) => E.current.pop(...v),
1676
+ popToTop: (...v) => E.current.popToTop(...v),
1677
+ popTo: (...v) => E.current.popTo(...v),
1678
+ setParams: (...v) => E.current.setParams(...v),
1679
+ setOptions: (...v) => E.current.setOptions(...v),
1680
+ close: (...v) => E.current.close(...v),
1681
+ setLoading: (...v) => E.current.setLoading(...v)
1316
1682
  }), []);
1317
- Ae(() => e.registerNavigation(oe), [e, oe]);
1318
- const J = Q(() => ({
1319
- setLoading: (k, ce) => Z.setScreenLoading("single", k, ce),
1320
- showLoading: (k) => Z.begin("single", k),
1321
- hideLoading: (k) => Z.end("single", k)
1322
- }), [Z]), O = Q(() => ({ isFocused: !0, resultEvent: null, routeKey: "single", setFooter: $ }), [$]), G = Q(() => ({ routeKey: "single", registerDirtyGuard: g }), [g]);
1323
- U(() => {
1324
- D.current.publish({ canGoBack: !1, stack: [s], currentRoute: s });
1325
- }, [s]);
1326
- const ke = P(!1);
1327
- U(() => (f?.({ setLoading: ue }), ke.current || (ke.current = !0, l?.({ route: I.current, stack: [I.current] })), () => {
1328
- f?.(null);
1683
+ Se(() => e.registerNavigation(z), [e, z]);
1684
+ const K = V(() => ({
1685
+ setLoading: (v, H) => N.setScreenLoading("single", v, H),
1686
+ showLoading: (v) => N.begin("single", v),
1687
+ hideLoading: (v) => N.end("single", v)
1688
+ }), [N]), P = V(() => ({ isFocused: !0, resultEvent: null, routeKey: "single", setFooter: re }), [re]), F = V(() => ({ routeKey: "single", registerDirtyGuard: g }), [g]);
1689
+ ee(() => {
1690
+ D.current.publish({ canGoBack: !1, stack: [l], currentRoute: l });
1691
+ }, [l]);
1692
+ const Z = G(!1);
1693
+ ee(() => (u?.({ setLoading: W }), Z.current || (Z.current = !0, i?.({ route: C.current, stack: [C.current] })), () => {
1694
+ u?.(null);
1329
1695
  }), []);
1330
- const Ce = Q(() => ({ ...z, ...s.options }), [z, s.options]), K = z.component, de = e.refs.header;
1331
- return /* @__PURE__ */ p(yt.Provider, { value: de.current, children: /* @__PURE__ */ p(Tt.Provider, { value: C, children: /* @__PURE__ */ p(Vt.Provider, { value: q.current, children: /* @__PURE__ */ p(Ut.Provider, { value: L.current, children: /* @__PURE__ */ p(_t.Provider, { value: te, children: /* @__PURE__ */ p(vt.Provider, { value: oe, children: /* @__PURE__ */ p(bt.Provider, { value: D.current, children: /* @__PURE__ */ p(Ue.Provider, { value: Z, children: /* @__PURE__ */ be(Xt, { store: e.stores.layout, screenOptions: Ce.modalOptions, dialogRef: E, requestClose: X, exiting: b, children: [
1332
- /* @__PURE__ */ p(Jt, { store: e.stores.layout, screen: Ce, route: s, navigation: te, requestClose: X, translate: o, canGoBack: !1 }),
1333
- /* @__PURE__ */ p("main", { className: "pmn-main", children: /* @__PURE__ */ p(Ve.Provider, { value: s, children: /* @__PURE__ */ p(Pt.Provider, { value: G, children: /* @__PURE__ */ p(ot.Provider, { value: O, children: /* @__PURE__ */ p(Ue.Provider, { value: J, children: /* @__PURE__ */ p(wt.Provider, { value: A.current, children: /* @__PURE__ */ p("div", { className: `pmn-body ${x.bodyClassName ?? ""}`, "data-modal-route-key": "single", tabIndex: -1, children: /* @__PURE__ */ p(Nt, { route: s, onError: u, children: /* @__PURE__ */ p(Wt, { fallback: x.lazyFallback ?? /* @__PURE__ */ p("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ p(Jn, { Screen: K, route: s, navigation: te }) }) }) }) }) }) }) }) }) }),
1334
- /* @__PURE__ */ p(er, { store: L.current, route: s, screen: Ce, layoutStore: e.stores.layout, navigation: te, requestClose: X, translate: o, onError: u, loadingApi: Z }),
1335
- /* @__PURE__ */ p(tr, { store: A.current, translate: o }),
1336
- /* @__PURE__ */ p(nr, { store: q.current, dismiss: F }),
1337
- i && /* @__PURE__ */ be("div", { className: "pmn-error", role: "alert", children: [
1338
- /* @__PURE__ */ p("span", { children: i.message || String(i) }),
1339
- /* @__PURE__ */ p("button", { type: "button", onClick: d, children: "×" })
1696
+ const de = V(() => ({ ...L, ...l.options }), [L, l.options]), te = e.refs.header;
1697
+ return /* @__PURE__ */ m(Lt.Provider, { value: te.current, children: /* @__PURE__ */ m($t.Provider, { value: Q, children: /* @__PURE__ */ m(ln.Provider, { value: O.current, children: /* @__PURE__ */ m(cn.Provider, { value: R.current, children: /* @__PURE__ */ m(an.Provider, { value: le, children: /* @__PURE__ */ m(Et.Provider, { value: z, children: /* @__PURE__ */ m(Pt.Provider, { value: D.current, children: /* @__PURE__ */ m(st.Provider, { value: N, children: /* @__PURE__ */ Me(yn, { store: e.stores.layout, screenOptions: de.modalOptions, dialogRef: j, requestClose: I, exiting: x, children: [
1698
+ /* @__PURE__ */ m(vn, { store: e.stores.layout, screen: de, route: l, navigation: le, requestClose: I, translate: o, canGoBack: !1 }),
1699
+ /* @__PURE__ */ m("main", { className: "pmn-main", children: /* @__PURE__ */ m(Je.Provider, { value: l, children: /* @__PURE__ */ m(It.Provider, { value: F, children: /* @__PURE__ */ m(at.Provider, { value: P, children: /* @__PURE__ */ m(st.Provider, { value: K, children: /* @__PURE__ */ m(Ot.Provider, { value: k.current, children: /* @__PURE__ */ m("div", { className: `pmn-body ${b.bodyClassName ?? ""}`, "data-modal-route-key": "single", tabIndex: -1, children: /* @__PURE__ */ m(Tt, { route: l, onError: a, children: /* @__PURE__ */ m(qt, { fallback: b.lazyFallback ?? /* @__PURE__ */ m("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ m(Mr, { screen: L, route: l, navigation: le }) }) }) }) }) }) }) }) }) }),
1700
+ /* @__PURE__ */ m(Er, { store: R.current, route: l, screen: de, layoutStore: e.stores.layout, navigation: le, requestClose: I, translate: o, onError: a, loadingApi: N }),
1701
+ /* @__PURE__ */ m(Pr, { store: k.current, translate: o }),
1702
+ /* @__PURE__ */ m(Or, { store: O.current, dismiss: ne }),
1703
+ c && /* @__PURE__ */ Me("div", { className: "pmn-error", role: "alert", children: [
1704
+ /* @__PURE__ */ m("span", { children: c.message || String(c) }),
1705
+ /* @__PURE__ */ m("button", { type: "button", onClick: d, children: "×" })
1340
1706
  ] })
1341
1707
  ] }) }) }) }) }) }) }) }) });
1342
1708
  }
1343
- const or = rt(Hn), ar = rt(rr), sr = rt(function({ manager: t }) {
1344
- const { active: n, options: r, exiting: o, error: a, translate: l } = Oe(t.hostStore.subscribe, t.hostStore.getSnapshot, t.hostStore.getSnapshot), f = n?.id, u = n?.runtime.bindings, i = Q(() => (g, b) => {
1345
- n?.runtime.alive.current && t.hostStore.getSnapshot().active?.id === f && t.reportError(g, b);
1346
- }, [t, n, f]);
1709
+ const Tr = pt(hr), Ar = pt(Lr), jr = pt(function({ manager: t }) {
1710
+ const { active: n, options: r, exiting: o, error: s, translate: i } = Ee(t.hostStore.subscribe, t.hostStore.getSnapshot, t.hostStore.getSnapshot), u = n?.id, a = n?.runtime.bindings, c = V(() => (g, x) => {
1711
+ n?.runtime.alive.current && t.hostStore.getSnapshot().active?.id === u && t.reportError(g, x);
1712
+ }, [t, n, u]);
1347
1713
  if (!n) return null;
1348
- const d = n.config.singlePage || Object.keys(n.config.screens ?? {}).length === 1 ? ar : or;
1349
- return /* @__PURE__ */ p(at.Provider, { value: n.runtime, children: /* @__PURE__ */ p(d, { runtime: n.runtime, config: n.config, initialScreen: n.screen, params: n.params, options: r, translate: l, notifyError: i, error: a, clearError: t.commands.clearError, exiting: o, ...u }, f) });
1350
- }), ir = ".pmn-overlay,.pmn-dialog,.pmn-dialog *{box-sizing:border-box}.pmn-overlay{position:fixed;inset:0;z-index:1000;display:flex;overscroll-behavior:none;background:#00000073}.pmn-place-right{justify-content:flex-end;align-items:stretch}.pmn-place-left{justify-content:flex-start;align-items:stretch}.pmn-place-center{justify-content:center;align-items:center}.pmn-place-top{justify-content:center;align-items:flex-start}.pmn-place-bottom{justify-content:center;align-items:flex-end}.pmn-dialog{--pmn-surface:#fff;--pmn-body:#fff;--pmn-text:#0f172a;--pmn-muted:#475569;--pmn-border:#e2e8f0;--pmn-hover:#f1f5f9;--pmn-overlay-card:rgba(255,255,255,.92);color-scheme:light;position:relative;display:flex;flex-direction:column;min-height:0;width:100%;max-width:min(calc(100vw - var(--pmn-gap)*2),var(--pmn-max-width, var(--pmn-width)));max-height:min(calc(100dvh - var(--pmn-gap)*2),var(--pmn-max-height, 100dvh));height:var(--pmn-height, 100%);overflow:hidden;outline:none;box-shadow:0 25px 50px -12px #00000040;background:var(--pmn-surface);color:var(--pmn-text)}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:calc(100dvh - var(--pmn-gap)*2);max-height:calc(100dvh - var(--pmn-gap)*2)}.pmn-place-center .pmn-dialog{height:var(--pmn-height, auto);min-height:150px}.pmn-place-top .pmn-dialog,.pmn-place-bottom .pmn-dialog{height:var(--pmn-height, auto);min-height:0}.pmn-dialog[data-modal-theme=dark]{--pmn-surface:#334155;--pmn-body:#334155;--pmn-text:#f1f5f9;--pmn-muted:#cbd5e1;--pmn-border:#475569;--pmn-hover:#1e293b;--pmn-overlay-card:rgba(51,65,85,.94);color-scheme:dark}.pmn-main{min-height:0;flex:1;overflow:hidden;display:flex;flex-direction:column;background:transparent}.pmn-body{height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px;flex:1}.pmn-body[hidden]{display:none!important}.pmn-header{display:flex;flex-shrink:0;height:64px;align-items:center;gap:12px;padding:0 20px;background:transparent}.pmn-header h2{font-size:18px;font-weight:600;min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0}.pmn-header-spacer{flex:1}.pmn-border-bottom{border-bottom:1px solid var(--pmn-border)}.pmn-icon-button{display:inline-flex;align-items:center;justify-content:center;padding:8px;border:0;background:transparent;color:inherit;border-radius:8px;cursor:pointer}.pmn-icon-button:hover{background:var(--pmn-hover)}.pmn-footer{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;gap:12px;padding:16px 20px;background:transparent}.pmn-border-top{border-top:1px solid var(--pmn-border)}.pmn-button{padding:8px 16px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer}.pmn-button:disabled{opacity:.5;cursor:not-allowed}.pmn-button-secondary{border:1px solid var(--pmn-border);background:transparent;color:var(--pmn-text)}.pmn-button-secondary:hover:not(:disabled){background:var(--pmn-hover)}.pmn-button-primary{border:1px solid #2563eb;background:#2563eb;color:#fff}.pmn-button-primary:hover:not(:disabled){background:#1d4ed8}.pmn-loading-overlay{position:absolute;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:#ffffffb8;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);cursor:progress}.pmn-dialog[data-modal-theme=dark] .pmn-loading-overlay{background:#0f172ab8}.pmn-loading-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;max-width:85%;text-align:center;color:var(--pmn-text);pointer-events:none}.pmn-loading-text{font-size:14px;font-weight:500;line-height:1.5;overflow-wrap:anywhere}.pmn-spinner{width:38px;height:38px;border:3px solid rgba(37,99,235,.2);border-top-color:#2563eb;border-radius:50%;animation:pmn-spin .8s linear infinite}@keyframes pmn-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:1.8s}}.pmn-error{position:absolute;z-index:60;bottom:8px;left:12px;right:12px;display:flex;justify-content:space-between;gap:12px;padding:12px;border:1px solid #fca5a5;border-radius:8px;background:#fef2f2;color:#991b1b;font-size:13px}.pmn-error button{border:0;background:transparent;font-size:20px;cursor:pointer;color:inherit}.pmn-dialog input:not([type=checkbox]):not([type=radio]),.pmn-dialog textarea,.pmn-dialog select{color:var(--pmn-text);border-color:var(--pmn-border)}.pmn-error-screen{padding:24px;color:var(--pmn-text)}.pmn-error-screen p{color:#dc2626;overflow-wrap:anywhere}@media(max-width:640px){.pmn-overlay.pmn-mobile-fullscreen{padding:0!important}.pmn-mobile-fullscreen .pmn-dialog{max-width:100%;width:100%;height:100dvh;max-height:100dvh;border-radius:0!important}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:2s}}@keyframes pmn-fade-in{0%{opacity:0}to{opacity:1}}@keyframes pmn-fade-out{0%{opacity:1}to{opacity:0}}@keyframes pmn-scale-in{0%{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}@keyframes pmn-scale-out{0%{opacity:1;transform:none}to{opacity:0;transform:translateY(10px) scale(.97)}}@keyframes pmn-right-in{0%{transform:translate(105%)}to{transform:none}}@keyframes pmn-right-out{0%{transform:none}to{transform:translate(105%)}}@keyframes pmn-left-in{0%{transform:translate(-105%)}to{transform:none}}@keyframes pmn-left-out{0%{transform:none}to{transform:translate(-105%)}}@keyframes pmn-top-in{0%{transform:translateY(-105%)}to{transform:none}}@keyframes pmn-top-out{0%{transform:none}to{transform:translateY(-105%)}}@keyframes pmn-bottom-in{0%{transform:translateY(105%)}to{transform:none}}@keyframes pmn-bottom-out{0%{transform:none}to{transform:translateY(105%)}}.pmn-entering{animation:pmn-fade-in var(--pmn-animation-duration) ease-out both}.pmn-exiting{animation:pmn-fade-out var(--pmn-animation-duration) ease-in both;pointer-events:none}.pmn-entering .pmn-dialog{animation:pmn-scale-in var(--pmn-animation-duration) cubic-bezier(.2,.8,.2,1) both}.pmn-exiting .pmn-dialog{animation:pmn-scale-out var(--pmn-animation-duration) ease-in both}.pmn-entering.pmn-place-right .pmn-dialog{animation-name:pmn-right-in}.pmn-exiting.pmn-place-right .pmn-dialog{animation-name:pmn-right-out}.pmn-entering.pmn-place-left .pmn-dialog{animation-name:pmn-left-in}.pmn-exiting.pmn-place-left .pmn-dialog{animation-name:pmn-left-out}.pmn-entering.pmn-place-top .pmn-dialog{animation-name:pmn-top-in}.pmn-exiting.pmn-place-top .pmn-dialog{animation-name:pmn-top-out}.pmn-entering.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-in}.pmn-exiting.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-out}.pmn-no-animation,.pmn-no-animation .pmn-dialog{animation:none!important}@media(prefers-reduced-motion:reduce){.pmn-entering,.pmn-exiting,.pmn-entering .pmn-dialog,.pmn-exiting .pmn-dialog{animation:none!important}}.pmn-toast-region{position:absolute;top:56px;left:12px;right:12px;z-index:80;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;max-height:calc(100% - 72px);overflow:hidden}.pmn-toast{pointer-events:auto;display:flex;align-items:flex-start;gap:10px;width:max-content;max-width:100%;min-width:min(260px,100%);padding:11px 13px;border:1px solid var(--pmn-border);border-radius:9px;background:var(--pmn-surface);color:var(--pmn-text);box-shadow:0 5px 18px #0000001a;font-size:13px;line-height:1.5;overflow-wrap:anywhere}.pmn-toast-symbol{flex:0 0 20px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;font-size:13px;font-weight:700;background:var(--pmn-hover);color:var(--pmn-muted)}.pmn-toast-success .pmn-toast-symbol{background:#dcfce7;color:#15803d}.pmn-toast-error .pmn-toast-symbol{background:#fee2e2;color:#b91c1c}.pmn-toast-warning .pmn-toast-symbol{background:#fef3c7;color:#b45309}.pmn-toast-info .pmn-toast-symbol{background:#dbeafe;color:#1d4ed8}.pmn-toast-message{flex:1;min-width:0;white-space:pre-wrap}.pmn-toast-close{border:0;background:transparent;color:var(--pmn-muted);cursor:pointer;font-size:19px;line-height:18px;padding:0 1px}.pmn-toast-close:hover{color:var(--pmn-text)}.pmn-button-danger{background:#dc2626!important;color:#fff!important;border-color:#dc2626!important}@keyframes pmn-page-forward-in{0%{opacity:.18;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:.18;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}.pmn-page-enter{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.2,.8,.2,1);animation-fill-mode:both;will-change:transform,opacity}.pmn-page-forward{animation-name:pmn-page-forward-in}.pmn-page-back{animation-name:pmn-page-back-in}@media(prefers-reduced-motion:reduce){.pmn-page-enter{animation:none!important;will-change:auto}}.pmn-main{position:relative;isolation:isolate}.pmn-page-exit{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.22,1,.36,1);animation-fill-mode:forwards}@keyframes pmn-page-forward-out{to{opacity:.45;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}}@keyframes pmn-page-back-out{to{opacity:.45;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}}.pmn-page-exit-forward{animation-name:pmn-page-forward-out}.pmn-page-exit-back{animation-name:pmn-page-back-out}@media(prefers-reduced-motion:reduce){.pmn-page-exit{animation:none!important}}.pmn-main>.pmn-body{position:relative;width:100%;flex:1 0 100%;background:var(--pmn-body)}.pmn-page-forward,.pmn-page-back{z-index:2}@keyframes pmn-page-forward-in{0%{opacity:1;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:1;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-forward-out{to{opacity:1;transform:translate3d(-100%,0,0)}}@keyframes pmn-page-back-out{to{opacity:1;transform:translate3d(100%,0,0)}}.pmn-lazy-loading{display:flex;min-height:80px;align-items:center;justify-content:center;color:var(--pmn-muted);font-size:14px}.pmn-place-top .pmn-dialog{max-height:min(calc(100dvh - var(--pmn-top-offset, var(--pmn-gap)) - var(--pmn-gap)),var(--pmn-max-height,100dvh))}.pmn-dialog.pmn-has-custom-background{isolation:isolate;--pmn-body:transparent}.pmn-custom-background-layer{position:absolute;inset:0;z-index:0;pointer-events:none}.pmn-dialog.pmn-has-custom-background>:not(.pmn-custom-background-layer){position:relative;z-index:1}.pmn-dialog.pmn-has-custom-background .pmn-main>.pmn-body{background:transparent}.pmn-overlay.pmn-fullscreen{padding:0!important;align-items:stretch;justify-content:stretch}.pmn-overlay.pmn-fullscreen .pmn-dialog{width:100%;max-width:100%;height:100%;max-height:100%;border-radius:0!important}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:100%;max-height:100%}.pmn-place-center .pmn-dialog{max-height:100%}.pmn-dialog{max-width:min(100%,var(--pmn-drag-width,var(--pmn-max-width,var(--pmn-width))));max-height:min(100%,var(--pmn-max-height,100dvh))}.pmn-dialog .pmn-resize-handle{position:absolute;z-index:5;top:0;bottom:0;width:10px;cursor:ew-resize;touch-action:none;-webkit-user-select:none;user-select:none}.pmn-resize-left{right:0}.pmn-resize-right{left:0}.pmn-resize-handle:hover,.pmn-resize-handle:focus-visible{background:var(--pmn-border)}@media(max-width:640px){.pmn-mobile-fullscreen .pmn-resize-handle{display:none}}.pmn-dialog{max-width:min(100%,var(--pmn-max-width,100%),var(--pmn-drag-width,var(--pmn-width)))}.pmn-overlay.pmn-fullscreen .pmn-dialog{max-width:100%}", Kt = "react-modal-navigation-styles", Ot = /* @__PURE__ */ new WeakMap();
1351
- function cr() {
1352
- mn(() => {
1714
+ const d = n.config.singlePage || Object.keys(n.config.screens ?? {}).length === 1 ? Ar : Tr;
1715
+ return /* @__PURE__ */ m(We.Provider, { value: n.runtime, children: /* @__PURE__ */ m(d, { runtime: n.runtime, config: n.config, initialScreen: n.screen, params: n.params, options: r, translate: i, notifyError: c, error: s, clearError: t.commands.clearError, exiting: o, ...a }, u) });
1716
+ }), zr = ".pmn-overlay,.pmn-dialog,.pmn-dialog *{box-sizing:border-box}.pmn-overlay{position:fixed;inset:0;z-index:1000;display:flex;overscroll-behavior:none;background:#00000073}.pmn-place-right{justify-content:flex-end;align-items:stretch}.pmn-place-left{justify-content:flex-start;align-items:stretch}.pmn-place-center{justify-content:center;align-items:center}.pmn-place-top{justify-content:center;align-items:flex-start}.pmn-place-bottom{justify-content:center;align-items:flex-end}.pmn-dialog{--pmn-surface:#fff;--pmn-body:#fff;--pmn-text:#0f172a;--pmn-muted:#475569;--pmn-border:#e2e8f0;--pmn-hover:#f1f5f9;--pmn-overlay-card:rgba(255,255,255,.92);color-scheme:light;position:relative;display:flex;flex-direction:column;min-height:0;width:100%;max-width:min(calc(100vw - var(--pmn-gap)*2),var(--pmn-max-width, var(--pmn-width)));max-height:min(calc(100dvh - var(--pmn-gap)*2),var(--pmn-max-height, 100dvh));height:var(--pmn-height, 100%);overflow:hidden;outline:none;box-shadow:0 25px 50px -12px #00000040;background:var(--pmn-surface);color:var(--pmn-text)}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:calc(100dvh - var(--pmn-gap)*2);max-height:calc(100dvh - var(--pmn-gap)*2)}.pmn-place-center .pmn-dialog{height:var(--pmn-height, auto);min-height:150px}.pmn-place-top .pmn-dialog,.pmn-place-bottom .pmn-dialog{height:var(--pmn-height, auto);min-height:0}.pmn-dialog[data-modal-theme=dark]{--pmn-surface:#334155;--pmn-body:#334155;--pmn-text:#f1f5f9;--pmn-muted:#cbd5e1;--pmn-border:#475569;--pmn-hover:#1e293b;--pmn-overlay-card:rgba(51,65,85,.94);color-scheme:dark}.pmn-main{min-height:0;flex:1;overflow:hidden;display:flex;flex-direction:column;background:transparent}.pmn-body{height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px;flex:1}.pmn-body[hidden]{display:none!important}.pmn-header{display:flex;flex-shrink:0;height:64px;align-items:center;gap:12px;padding:0 20px;background:transparent}.pmn-header h2{font-size:18px;font-weight:600;min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0}.pmn-header-spacer{flex:1}.pmn-border-bottom{border-bottom:1px solid var(--pmn-border)}.pmn-icon-button{display:inline-flex;align-items:center;justify-content:center;padding:8px;border:0;background:transparent;color:inherit;border-radius:8px;cursor:pointer}.pmn-icon-button:hover{background:var(--pmn-hover)}.pmn-footer{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;gap:12px;padding:16px 20px;background:transparent}.pmn-border-top{border-top:1px solid var(--pmn-border)}.pmn-button{padding:8px 16px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer}.pmn-button:disabled{opacity:.5;cursor:not-allowed}.pmn-button-secondary{border:1px solid var(--pmn-border);background:transparent;color:var(--pmn-text)}.pmn-button-secondary:hover:not(:disabled){background:var(--pmn-hover)}.pmn-button-primary{border:1px solid #2563eb;background:#2563eb;color:#fff}.pmn-button-primary:hover:not(:disabled){background:#1d4ed8}.pmn-loading-overlay{position:absolute;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:#ffffffb8;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);cursor:progress}.pmn-dialog[data-modal-theme=dark] .pmn-loading-overlay{background:#0f172ab8}.pmn-loading-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;max-width:85%;text-align:center;color:var(--pmn-text);pointer-events:none}.pmn-loading-text{font-size:14px;font-weight:500;line-height:1.5;overflow-wrap:anywhere}.pmn-spinner{width:38px;height:38px;border:3px solid rgba(37,99,235,.2);border-top-color:#2563eb;border-radius:50%;animation:pmn-spin .8s linear infinite}@keyframes pmn-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:1.8s}}.pmn-error{position:absolute;z-index:60;bottom:8px;left:12px;right:12px;display:flex;justify-content:space-between;gap:12px;padding:12px;border:1px solid #fca5a5;border-radius:8px;background:#fef2f2;color:#991b1b;font-size:13px}.pmn-error button{border:0;background:transparent;font-size:20px;cursor:pointer;color:inherit}.pmn-dialog input:not([type=checkbox]):not([type=radio]),.pmn-dialog textarea,.pmn-dialog select{color:var(--pmn-text);border-color:var(--pmn-border)}.pmn-error-screen{padding:24px;color:var(--pmn-text)}.pmn-error-screen p{color:#dc2626;overflow-wrap:anywhere}@media(max-width:640px){.pmn-overlay.pmn-mobile-fullscreen{padding:0!important}.pmn-mobile-fullscreen .pmn-dialog{max-width:100%;width:100%;height:100dvh;max-height:100dvh;border-radius:0!important}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:2s}}@keyframes pmn-fade-in{0%{opacity:0}to{opacity:1}}@keyframes pmn-fade-out{0%{opacity:1}to{opacity:0}}@keyframes pmn-scale-in{0%{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}@keyframes pmn-scale-out{0%{opacity:1;transform:none}to{opacity:0;transform:translateY(10px) scale(.97)}}@keyframes pmn-right-in{0%{transform:translate(105%)}to{transform:none}}@keyframes pmn-right-out{0%{transform:none}to{transform:translate(105%)}}@keyframes pmn-left-in{0%{transform:translate(-105%)}to{transform:none}}@keyframes pmn-left-out{0%{transform:none}to{transform:translate(-105%)}}@keyframes pmn-top-in{0%{transform:translateY(-105%)}to{transform:none}}@keyframes pmn-top-out{0%{transform:none}to{transform:translateY(-105%)}}@keyframes pmn-bottom-in{0%{transform:translateY(105%)}to{transform:none}}@keyframes pmn-bottom-out{0%{transform:none}to{transform:translateY(105%)}}.pmn-entering{animation:pmn-fade-in var(--pmn-animation-duration) ease-out both}.pmn-exiting{animation:pmn-fade-out var(--pmn-animation-duration) ease-in both;pointer-events:none}.pmn-entering .pmn-dialog{animation:pmn-scale-in var(--pmn-animation-duration) cubic-bezier(.2,.8,.2,1) both}.pmn-exiting .pmn-dialog{animation:pmn-scale-out var(--pmn-animation-duration) ease-in both}.pmn-entering.pmn-place-right .pmn-dialog{animation-name:pmn-right-in}.pmn-exiting.pmn-place-right .pmn-dialog{animation-name:pmn-right-out}.pmn-entering.pmn-place-left .pmn-dialog{animation-name:pmn-left-in}.pmn-exiting.pmn-place-left .pmn-dialog{animation-name:pmn-left-out}.pmn-entering.pmn-place-top .pmn-dialog{animation-name:pmn-top-in}.pmn-exiting.pmn-place-top .pmn-dialog{animation-name:pmn-top-out}.pmn-entering.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-in}.pmn-exiting.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-out}.pmn-no-animation,.pmn-no-animation .pmn-dialog{animation:none!important}@media(prefers-reduced-motion:reduce){.pmn-entering,.pmn-exiting,.pmn-entering .pmn-dialog,.pmn-exiting .pmn-dialog{animation:none!important}}.pmn-toast-region{position:absolute;top:56px;left:12px;right:12px;z-index:80;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;max-height:calc(100% - 72px);overflow:hidden}.pmn-toast{pointer-events:auto;display:flex;align-items:flex-start;gap:10px;width:max-content;max-width:100%;min-width:min(260px,100%);padding:11px 13px;border:1px solid var(--pmn-border);border-radius:9px;background:var(--pmn-surface);color:var(--pmn-text);box-shadow:0 5px 18px #0000001a;font-size:13px;line-height:1.5;overflow-wrap:anywhere}.pmn-toast-symbol{flex:0 0 20px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;font-size:13px;font-weight:700;background:var(--pmn-hover);color:var(--pmn-muted)}.pmn-toast-success .pmn-toast-symbol{background:#dcfce7;color:#15803d}.pmn-toast-error .pmn-toast-symbol{background:#fee2e2;color:#b91c1c}.pmn-toast-warning .pmn-toast-symbol{background:#fef3c7;color:#b45309}.pmn-toast-info .pmn-toast-symbol{background:#dbeafe;color:#1d4ed8}.pmn-toast-message{flex:1;min-width:0;white-space:pre-wrap}.pmn-toast-close{border:0;background:transparent;color:var(--pmn-muted);cursor:pointer;font-size:19px;line-height:18px;padding:0 1px}.pmn-toast-close:hover{color:var(--pmn-text)}.pmn-button-danger{background:#dc2626!important;color:#fff!important;border-color:#dc2626!important}@keyframes pmn-page-forward-in{0%{opacity:.18;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:.18;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}.pmn-page-enter{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.2,.8,.2,1);animation-fill-mode:both;will-change:transform,opacity}.pmn-page-forward{animation-name:pmn-page-forward-in}.pmn-page-back{animation-name:pmn-page-back-in}@media(prefers-reduced-motion:reduce){.pmn-page-enter{animation:none!important;will-change:auto}}.pmn-main{position:relative;isolation:isolate}.pmn-page-exit{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.22,1,.36,1);animation-fill-mode:forwards}@keyframes pmn-page-forward-out{to{opacity:.45;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}}@keyframes pmn-page-back-out{to{opacity:.45;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}}.pmn-page-exit-forward{animation-name:pmn-page-forward-out}.pmn-page-exit-back{animation-name:pmn-page-back-out}@media(prefers-reduced-motion:reduce){.pmn-page-exit{animation:none!important}}.pmn-main>.pmn-body{position:relative;width:100%;flex:1 0 100%;background:var(--pmn-body)}.pmn-page-forward,.pmn-page-back{z-index:2}@keyframes pmn-page-forward-in{0%{opacity:1;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:1;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-forward-out{to{opacity:1;transform:translate3d(-100%,0,0)}}@keyframes pmn-page-back-out{to{opacity:1;transform:translate3d(100%,0,0)}}.pmn-lazy-loading{display:flex;min-height:80px;align-items:center;justify-content:center;color:var(--pmn-muted);font-size:14px}.pmn-place-top .pmn-dialog{max-height:min(calc(100dvh - var(--pmn-top-offset, var(--pmn-gap)) - var(--pmn-gap)),var(--pmn-max-height,100dvh))}.pmn-dialog.pmn-has-custom-background{isolation:isolate;--pmn-body:transparent}.pmn-custom-background-layer{position:absolute;inset:0;z-index:0;pointer-events:none}.pmn-dialog.pmn-has-custom-background>:not(.pmn-custom-background-layer){position:relative;z-index:1}.pmn-dialog.pmn-has-custom-background .pmn-main>.pmn-body{background:transparent}.pmn-overlay.pmn-fullscreen{padding:0!important;align-items:stretch;justify-content:stretch}.pmn-overlay.pmn-fullscreen .pmn-dialog{width:100%;max-width:100%;height:100%;max-height:100%;border-radius:0!important}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:100%;max-height:100%}.pmn-place-center .pmn-dialog{max-height:100%}.pmn-dialog{max-width:min(100%,var(--pmn-drag-width,var(--pmn-max-width,var(--pmn-width))));max-height:min(100%,var(--pmn-max-height,100dvh))}.pmn-dialog .pmn-resize-handle{position:absolute;z-index:5;top:0;bottom:0;width:10px;cursor:ew-resize;touch-action:none;-webkit-user-select:none;user-select:none}.pmn-resize-left{right:0}.pmn-resize-right{left:0}.pmn-resize-handle:hover,.pmn-resize-handle:focus-visible{background:var(--pmn-border)}@media(max-width:640px){.pmn-mobile-fullscreen .pmn-resize-handle{display:none}}.pmn-dialog{max-width:min(100%,var(--pmn-max-width,100%),var(--pmn-drag-width,var(--pmn-width)))}.pmn-overlay.pmn-fullscreen .pmn-dialog{max-width:100%}.pmn-persistent-layout{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.pmn-persistent-layout[hidden]{display:none!important}", tn = "react-modal-navigation-styles", Gt = /* @__PURE__ */ new WeakMap();
1717
+ function Nr() {
1718
+ rn(() => {
1353
1719
  if (typeof document > "u") return;
1354
1720
  const e = document;
1355
- let t = Ot.get(e);
1721
+ let t = Gt.get(e);
1356
1722
  if (!t) {
1357
- let n = e.getElementById(Kt);
1723
+ let n = e.getElementById(tn);
1358
1724
  const r = !n;
1359
- n || (n = e.createElement("style"), n.id = Kt, n.setAttribute("data-react-modal-navigation", ""), n.textContent = ir, e.head.appendChild(n)), t = { element: n, owned: r, count: 0 }, Ot.set(e, t);
1725
+ n || (n = e.createElement("style"), n.id = tn, n.setAttribute("data-react-modal-navigation", ""), n.textContent = zr, e.head.appendChild(n)), t = { element: n, owned: r, count: 0 }, Gt.set(e, t);
1360
1726
  }
1361
1727
  return t.count += 1, () => {
1362
- t.count -= 1, t.count === 0 && (t.owned && t.element.remove(), Ot.delete(e));
1728
+ t.count -= 1, t.count === 0 && (t.owned && t.element.remove(), Gt.delete(e));
1363
1729
  };
1364
1730
  }, []);
1365
1731
  }
1366
- const lr = Object.freeze({}), ur = (e) => ({ "modal.loading": "加载中...", "modal.processing": "处理中...", "modal.back": "返回", "modal.close": "关闭", "modal.cancel": "取消", "modal.done": "完成" })[e] ?? e;
1367
- function Tr({ children: e, registry: t, defaultOptions: n = lr, backgroundColor: r, theme: o, translate: a = ur, onError: l, confirmDiscard: f }) {
1368
- cr();
1369
- const u = { registry: t, defaultOptions: n, backgroundColor: r, theme: o, translate: a, onError: l, confirmDiscard: f }, [i] = xe(() => Xn(u, Gn));
1370
- return Ae(() => (i.mount(), i.destroy), [i]), Ae(() => {
1371
- i.configure(u);
1372
- }, [i, t, n, r, o, a, l, f]), /* @__PURE__ */ p(Lt.Provider, { value: i.commands, children: /* @__PURE__ */ p(zt.Provider, { value: i.statusStore, children: /* @__PURE__ */ be(Gt.Provider, { value: i.commands, children: [
1732
+ const Br = Object.freeze({}), Gr = (e) => ({ "modal.loading": "加载中...", "modal.processing": "处理中...", "modal.back": "返回", "modal.close": "关闭", "modal.cancel": "取消", "modal.done": "完成" })[e] ?? e;
1733
+ function co({ children: e, registry: t, defaultOptions: n = Br, backgroundColor: r, theme: o, translate: s = Gr, onError: i, confirmDiscard: u }) {
1734
+ Nr();
1735
+ const a = { registry: t, defaultOptions: n, backgroundColor: r, theme: o, translate: s, onError: i, confirmDiscard: u }, [c] = Pe(() => Cr(a, yr));
1736
+ return Se(() => (c.mount(), c.destroy), [c]), Se(() => {
1737
+ c.configure(a);
1738
+ }, [c, t, n, r, o, s, i, u]), /* @__PURE__ */ m(Dt.Provider, { value: c.commands, children: /* @__PURE__ */ m(Kt.Provider, { value: c.statusStore, children: /* @__PURE__ */ Me(sn.Provider, { value: c.commands, children: [
1373
1739
  e,
1374
- /* @__PURE__ */ p(sr, { manager: i })
1740
+ /* @__PURE__ */ m(jr, { manager: c })
1375
1741
  ] }) }) });
1376
1742
  }
1377
- const dr = Object.freeze({ canGoBack: !1, stack: [], currentRoute: null }), Ht = () => () => {
1378
- }, ft = () => dr;
1379
- function Lr({ subscribe: e = !0 } = {}) {
1380
- const t = ee(Gt), n = ee(zt), r = Oe(e && n?.subscribe || Ht, e && n?.getSnapshot || ft, e && n?.getSnapshot || ft), o = Q(() => t ? e ? { ...t, ...r } : t : null, [t, r, e]), a = ee(vt), l = ee(bt), f = Oe(e && l?.subscribe || Ht, e && l?.getSnapshot || ft, e && l?.getSnapshot || ft);
1743
+ const Fr = Object.freeze({ canGoBack: !1, stack: [], currentRoute: null }), nn = () => () => {
1744
+ }, St = () => Fr;
1745
+ function lo({ subscribe: e = !0 } = {}) {
1746
+ const t = Y(sn), n = Y(Kt), r = Ee(e && n?.subscribe || nn, e && n?.getSnapshot || St, e && n?.getSnapshot || St), o = V(() => t ? e ? { ...t, ...r } : t : null, [t, r, e]), s = Y(Et), i = Y(Pt), u = Ee(e && i?.subscribe || nn, e && i?.getSnapshot || St, e && i?.getSnapshot || St);
1381
1747
  if (!o) throw new Error("[react-modal-navigation] useModal requires <ModalProvider>");
1382
- const u = Q(() => {
1383
- const i = () => {
1384
- if (!a) throw new Error("[react-modal-navigation] navigation requires an active modal screen; use modal.open() outside a modal");
1385
- return a;
1748
+ const a = V(() => {
1749
+ const c = () => {
1750
+ if (!s) throw new Error("[react-modal-navigation] navigation requires an active modal screen; use modal.open() outside a modal");
1751
+ return s;
1386
1752
  };
1387
1753
  return {
1388
- clearCache: (...d) => i().clearCache(...d),
1389
- navigateAsync: (...d) => i().navigateAsync(...d),
1390
- navigate: (...d) => i().navigate(...d),
1391
- push: (...d) => i().push(...d),
1392
- pop: (...d) => i().pop(...d),
1393
- popTo: (...d) => i().popTo(...d),
1394
- popToTop: (...d) => i().popToTop(...d),
1395
- replace: (...d) => i().replace(...d),
1396
- reset: (...d) => i().reset(...d),
1397
- setParams: (...d) => i().setParams(...d),
1398
- setOptions: (...d) => i().setOptions(...d),
1399
- goBack: (...d) => i().goBack(...d),
1400
- close: (...d) => i().close(...d),
1401
- setLoading: (...d) => i().setLoading(...d),
1402
- ...e ? { canGoBack: f.canGoBack, stack: f.stack, currentRoute: f.currentRoute } : {}
1754
+ clearCache: (...d) => c().clearCache(...d),
1755
+ navigateAsync: (...d) => c().navigateAsync(...d),
1756
+ navigate: (...d) => c().navigate(...d),
1757
+ push: (...d) => c().push(...d),
1758
+ pop: (...d) => c().pop(...d),
1759
+ popTo: (...d) => c().popTo(...d),
1760
+ popToTop: (...d) => c().popToTop(...d),
1761
+ replace: (...d) => c().replace(...d),
1762
+ reset: (...d) => c().reset(...d),
1763
+ setParams: (...d) => c().setParams(...d),
1764
+ setOptions: (...d) => c().setOptions(...d),
1765
+ goBack: (...d) => c().goBack(...d),
1766
+ close: (...d) => c().close(...d),
1767
+ setLoading: (...d) => c().setLoading(...d),
1768
+ ...e ? { canGoBack: u.canGoBack, stack: u.stack, currentRoute: u.currentRoute } : {}
1403
1769
  };
1404
- }, [a, f, e]);
1405
- return Q(() => ({ ...o, modal: o, navigation: u }), [o, u]);
1770
+ }, [s, u, e]);
1771
+ return V(() => ({ ...o, modal: o, navigation: a }), [o, a]);
1406
1772
  }
1407
- function cn() {
1408
- const e = ee(vt);
1773
+ function Mn() {
1774
+ const e = Y(Et);
1409
1775
  if (!e) throw new Error("useModalNavigationCommands requires an active modal screen");
1410
1776
  return e;
1411
1777
  }
1412
- function mr(e, t) {
1413
- const n = ee(bt);
1778
+ function qr(e, t) {
1779
+ const n = Y(Pt);
1414
1780
  if (!n) throw new Error("useModalNavigationState requires an active modal screen");
1415
- return Pe(n, e, t);
1781
+ return Fe(n, e, t);
1416
1782
  }
1417
- function zr() {
1418
- const e = cn(), t = mr();
1419
- return Q(() => ({ ...e, ...t }), [e, t]);
1783
+ function uo() {
1784
+ const e = Mn(), t = qr();
1785
+ return V(() => ({ ...e, ...t }), [e, t]);
1420
1786
  }
1421
- function jt() {
1422
- const e = ee(ot);
1787
+ function Ut() {
1788
+ const e = Y(at);
1423
1789
  if (!e) throw new Error("useIsFocused must be called inside a modal screen");
1424
1790
  return e.isFocused;
1425
1791
  }
1426
- function Ar(e) {
1427
- const t = jt();
1428
- U(() => {
1792
+ function mo(e) {
1793
+ const t = Ut();
1794
+ ee(() => {
1429
1795
  if (t)
1430
1796
  return e();
1431
1797
  }, [t, e]);
1432
1798
  }
1433
- function Nr(e) {
1434
- const t = ee(ot);
1799
+ function fo(e) {
1800
+ const t = Y(at);
1435
1801
  if (!t) throw new Error("useNavigationResult requires an active modal screen");
1436
- const n = P(e), r = P(null);
1437
- U(() => {
1802
+ const n = G(e), r = G(null);
1803
+ ee(() => {
1438
1804
  n.current = e;
1439
- }, [e]), U(() => {
1805
+ }, [e]), ee(() => {
1440
1806
  !t.isFocused || !t.resultEvent || r.current !== t.resultEvent.id && (r.current = t.resultEvent.id, n.current(t.resultEvent.data));
1441
1807
  }, [t.isFocused, t.resultEvent]);
1442
1808
  }
1443
- function jr(e = {}) {
1444
- const t = ee(ot);
1809
+ function po(e = {}) {
1810
+ const t = Y(at);
1445
1811
  if (!t) throw new Error("[react-modal-navigation] useModalFooter requires an active modal screen");
1446
- const { setFooter: n, routeKey: r } = t, o = P(e);
1812
+ const { setFooter: n, routeKey: r } = t, o = G(e);
1447
1813
  o.current = e;
1448
- const a = Q(() => (...q) => o.current.done?.(...q), []), l = Q(() => (...q) => (o.current.cancel ?? o.current.cancle)?.(...q), []), f = Q(() => (...q) => o.current.renderFooter?.(...q), []), u = typeof e.done == "function", i = typeof (e.cancel ?? e.cancle) == "function", d = typeof e.renderFooter == "function", { showFooter: g, showFooterBorder: b, doneDisabled: x, doneText: h, cancelText: s, loadingText: v, footerClassName: I } = e, z = P({ source: null, normalized: void 0 }), T = Array.isArray(e.actions) ? e.actions : null, E = z.current.source;
1449
- T === E || T && E && T.length === E.length && T.every((q, N) => {
1450
- const Z = E[N];
1451
- return [.../* @__PURE__ */ new Set([...Object.keys(q), ...Object.keys(Z)])].every((C) => C === "onClick" || Object.is(q[C], Z[C]));
1452
- }) || (z.current = {
1453
- source: T?.map((q) => ({ ...q })) ?? null,
1454
- normalized: T?.map((q, N) => ({
1455
- ...q,
1456
- onClick: (...Z) => (o.current.actions?.find((C) => C.key === q.key) ?? o.current.actions?.[N])?.onClick?.(...Z)
1814
+ const s = V(() => (...O) => o.current.done?.(...O), []), i = V(() => (...O) => (o.current.cancel ?? o.current.cancle)?.(...O), []), u = V(() => (...O) => o.current.renderFooter?.(...O), []), a = typeof e.done == "function", c = typeof (e.cancel ?? e.cancle) == "function", d = typeof e.renderFooter == "function", { showFooter: g, showFooterBorder: x, doneDisabled: b, doneText: h, cancelText: l, loadingText: y, footerClassName: C } = e, L = G({ source: null, normalized: void 0 }), S = Array.isArray(e.actions) ? e.actions : null, j = L.current.source;
1815
+ S === j || S && j && S.length === j.length && S.every((O, A) => {
1816
+ const N = j[A];
1817
+ return [.../* @__PURE__ */ new Set([...Object.keys(O), ...Object.keys(N)])].every((Q) => Q === "onClick" || Object.is(O[Q], N[Q]));
1818
+ }) || (L.current = {
1819
+ source: S?.map((O) => ({ ...O })) ?? null,
1820
+ normalized: S?.map((O, A) => ({
1821
+ ...O,
1822
+ onClick: (...N) => (o.current.actions?.find((Q) => Q.key === O.key) ?? o.current.actions?.[A])?.onClick?.(...N)
1457
1823
  }))
1458
1824
  });
1459
- const L = z.current.normalized, A = Q(() => ({
1825
+ const R = L.current.normalized, k = V(() => ({
1460
1826
  showFooter: g,
1461
- showFooterBorder: b,
1462
- doneDisabled: x,
1827
+ showFooterBorder: x,
1828
+ doneDisabled: b,
1463
1829
  doneText: h,
1464
- cancelText: s,
1465
- loadingText: v,
1466
- footerClassName: I,
1467
- ...L !== void 0 ? { actions: L } : {},
1468
- ...u ? { done: a } : {},
1469
- ...i ? { cancel: l } : {},
1470
- ...d ? { renderFooter: f } : {}
1471
- }), [g, b, x, h, s, v, I, L, u, i, d, a, l, f]);
1472
- U(() => {
1473
- n(r, A);
1474
- }, [r, n, A]), U(() => () => n(r, null), [r, n]);
1475
- }
1476
- const pr = (e) => e.visible;
1477
- function Br() {
1478
- const e = ee(Ue), t = ee(wt);
1830
+ cancelText: l,
1831
+ loadingText: y,
1832
+ footerClassName: C,
1833
+ ...R !== void 0 ? { actions: R } : {},
1834
+ ...a ? { done: s } : {},
1835
+ ...c ? { cancel: i } : {},
1836
+ ...d ? { renderFooter: u } : {}
1837
+ }), [g, x, b, h, l, y, C, R, a, c, d, s, i, u]);
1838
+ ee(() => {
1839
+ n(r, k);
1840
+ }, [r, n, k]), ee(() => () => n(r, null), [r, n]);
1841
+ }
1842
+ const Ir = (e) => e.visible;
1843
+ function ho() {
1844
+ const e = Y(st), t = Y(Ot);
1479
1845
  if (!e || !t) throw new Error("[react-modal-navigation] useModalLoading requires an active modal screen");
1480
- const n = Pe(t, pr);
1481
- return Q(() => ({ ...e, isLoading: n }), [e, n]);
1846
+ const n = Fe(t, Ir);
1847
+ return V(() => ({ ...e, isLoading: n }), [e, n]);
1482
1848
  }
1483
- function fr() {
1484
- const e = ee(Ue);
1849
+ function $r() {
1850
+ const e = Y(st);
1485
1851
  if (!e) throw new Error("[react-modal-navigation] useModalLoadingCommands requires an active modal screen");
1486
1852
  return e;
1487
1853
  }
1488
- function qr(e, t) {
1489
- const n = ee(wt);
1854
+ function go(e, t) {
1855
+ const n = Y(Ot);
1490
1856
  if (!n) throw new Error("[react-modal-navigation] useModalLoadingState requires an active modal screen");
1491
- return Pe(n, e, t);
1857
+ return Fe(n, e, t);
1492
1858
  }
1493
- function Fr() {
1494
- const e = ee(at), t = ee(Ve), n = fr(), r = jt(), o = P(!0), a = P(null), [l, f] = xe(!1), [u, i] = xe(null), d = _((x) => {
1495
- if (!x || a.current !== x) return !1;
1496
- a.current = null, x.unregister?.(), o.current && f(!1);
1859
+ function yo() {
1860
+ const e = Y(We), t = Y(Je), n = $r(), r = Ut(), o = G(!0), s = G(null), [i, u] = Pe(!1), [a, c] = Pe(null), d = X((b) => {
1861
+ if (!b || s.current !== b) return !1;
1862
+ s.current = null, b.unregister?.(), o.current && u(!1);
1497
1863
  try {
1498
- x.controller.abort();
1864
+ b.controller.abort();
1499
1865
  } finally {
1500
- x.release();
1866
+ b.release();
1501
1867
  }
1502
1868
  return !0;
1503
- }, []), g = _(() => d(a.current), [d]);
1504
- return U(() => (o.current = !0, () => {
1869
+ }, []), g = X(() => d(s.current), [d]);
1870
+ return ee(() => (o.current = !0, () => {
1505
1871
  o.current = !1, g();
1506
- }), [g]), { run: _(async (x, h = {}) => {
1872
+ }), [g]), { run: X(async (b, h = {}) => {
1507
1873
  if (!o.current || e && !e.alive.current) return { status: "cancelled" };
1508
- if (a.current) return { status: "busy" };
1509
- if (typeof x != "function") throw new TypeError("[react-modal-navigation] run requires a function");
1510
- const s = new AbortController();
1511
- let v, I = !1;
1512
- const z = { controller: s, release: () => {
1513
- I || (I = !0, v != null && n.hideLoading(v));
1874
+ if (s.current) return { status: "busy" };
1875
+ if (typeof b != "function") throw new TypeError("[react-modal-navigation] run requires a function");
1876
+ const l = new AbortController();
1877
+ let y, C = !1;
1878
+ const L = { controller: l, release: () => {
1879
+ C || (C = !0, y != null && n.hideLoading(y));
1514
1880
  } };
1515
- a.current = z, z.cancel = () => d(z), z.unregister = e?.tasks.register(t?.key, z);
1516
- const T = () => o.current && a.current === z && !s.signal.aborted;
1881
+ s.current = L, L.cancel = () => d(L), L.unregister = e?.tasks.register(t?.key, L);
1882
+ const S = () => o.current && s.current === L && !l.signal.aborted;
1517
1883
  try {
1518
- if (!T()) return { status: "cancelled" };
1519
- if (f(!0), i(null), v = n.showLoading(h.loadingText), !T())
1520
- return v != null && I && n.hideLoading(v), { status: "cancelled" };
1521
- const E = await x({ signal: s.signal });
1522
- return T() ? (await h.onSuccess?.(E), T() ? { status: "success", value: E } : { status: "cancelled" }) : { status: "cancelled" };
1523
- } catch (E) {
1524
- if (!T()) return { status: "cancelled" };
1525
- i(E);
1884
+ if (!S()) return { status: "cancelled" };
1885
+ if (u(!0), c(null), y = n.showLoading(h.loadingText), !S())
1886
+ return y != null && C && n.hideLoading(y), { status: "cancelled" };
1887
+ const j = await b({ signal: l.signal });
1888
+ return S() ? (await h.onSuccess?.(j), S() ? { status: "success", value: j } : { status: "cancelled" }) : { status: "cancelled" };
1889
+ } catch (j) {
1890
+ if (!S()) return { status: "cancelled" };
1891
+ c(j);
1526
1892
  try {
1527
- await h.onError?.(E);
1893
+ await h.onError?.(j);
1528
1894
  } catch (D) {
1529
1895
  console.error("[react-modal-navigation] onError failed", D);
1530
1896
  }
1531
- if (!T()) return { status: "cancelled" };
1532
- if (h.throwOnError) throw E;
1533
- return { status: "error", error: E };
1897
+ if (!S()) return { status: "cancelled" };
1898
+ if (h.throwOnError) throw j;
1899
+ return { status: "error", error: j };
1534
1900
  } finally {
1535
- z.unregister?.(), z.release(), a.current === z && (a.current = null, o.current && f(!1));
1901
+ L.unregister?.(), L.release(), s.current === L && (s.current = null, o.current && u(!1));
1536
1902
  }
1537
- }, [n, e, t?.key, d]), cancel: g, pending: l, error: u, clearError: () => i(null), isFocused: r };
1903
+ }, [n, e, t?.key, d]), cancel: g, pending: i, error: a, clearError: () => c(null), isFocused: r };
1538
1904
  }
1539
- function hr(e, t = {}) {
1540
- const n = ee(Pt);
1905
+ function Dr(e, t = {}) {
1906
+ const n = Y(It);
1541
1907
  if (!n) throw new Error("[react-modal-navigation] useModalUnsavedChanges must be used inside a modal screen");
1542
- const r = P({ dirty: e, ...t });
1543
- r.current = { dirty: e, ...t };
1544
- const { routeKey: o, registerDirtyGuard: a } = n;
1545
- U(() => a(o, {
1546
- get dirty() {
1547
- return !!r.current.dirty;
1548
- },
1549
- get message() {
1550
- return r.current.message;
1551
- },
1552
- get onBeforeDiscard() {
1553
- return r.current.onBeforeDiscard;
1554
- }
1555
- }), [o, a]);
1556
- }
1557
- const $r = () => {
1558
- const e = ee(Tt);
1908
+ const { message: r, onBeforeDiscard: o } = t, s = G(o);
1909
+ Se(() => {
1910
+ s.current = o;
1911
+ }, [o]);
1912
+ const { routeKey: i, registerDirtyGuard: u } = n, a = !!e, c = typeof o == "function";
1913
+ Se(() => u(i, {
1914
+ dirty: a,
1915
+ message: r,
1916
+ onBeforeDiscard: c ? (g) => s.current(g) : void 0
1917
+ }), [i, u, a, r, c]);
1918
+ }
1919
+ const vo = () => {
1920
+ const e = Y($t);
1559
1921
  if (!e) throw new Error("[react-modal-navigation] useToast requires an active modal");
1560
1922
  return e;
1561
1923
  };
1562
- function gr() {
1563
- const e = ee(Ve);
1924
+ function Kr() {
1925
+ const e = Y(Je);
1564
1926
  if (!e) throw new Error("[react-modal-navigation] useModalRoute requires a modal screen");
1565
1927
  return e;
1566
1928
  }
1567
- function yr() {
1568
- return gr().params;
1929
+ function Hr() {
1930
+ return Kr().params;
1569
1931
  }
1570
- function Bt() {
1571
- const e = ee(Lt);
1932
+ function Vt() {
1933
+ const e = Y(Dt);
1572
1934
  if (!e) throw new Error("[react-modal-navigation] ModalProvider required");
1573
1935
  return e;
1574
1936
  }
1575
- const vr = (e) => e;
1576
- function br(e = vr, t = Object.is) {
1577
- const n = ee(zt);
1937
+ const Wr = (e) => e;
1938
+ function _r(e = Wr, t = Object.is) {
1939
+ const n = Y(Kt);
1578
1940
  if (!n) throw new Error("[react-modal-navigation] ModalProvider required");
1579
- return Pe(n, e, t);
1941
+ return Fe(n, e, t);
1580
1942
  }
1581
- const wr = (e) => e.isFullscreen;
1582
- function Ir() {
1583
- const { setFullscreen: e, toggleFullscreen: t } = Bt();
1584
- return { isFullscreen: br(wr), setFullscreen: e, toggleFullscreen: t };
1943
+ const Ur = (e) => e.isFullscreen;
1944
+ function bo() {
1945
+ const { setFullscreen: e, toggleFullscreen: t } = Vt();
1946
+ return { isFullscreen: _r(Ur), setFullscreen: e, toggleFullscreen: t };
1585
1947
  }
1586
- function Dr(e = {}) {
1587
- const t = ee(yt), n = ee(Ve);
1948
+ function wo(e = {}) {
1949
+ const t = Y(Lt), n = Y(Je);
1588
1950
  if (!t || !n) throw new Error("[react-modal-navigation] useModalHeader requires a modal screen");
1589
- const r = P(e);
1590
- r.current = e, U(() => {
1951
+ const r = G(e);
1952
+ r.current = e, ee(() => {
1591
1953
  t.set(n.key, r.current);
1592
- }), U(() => () => t.set(n.key, null), [t, n.key]);
1954
+ }), ee(() => () => t.set(n.key, null), [t, n.key]);
1593
1955
  }
1594
- function Kr(e, t) {
1595
- const n = ee(at);
1956
+ function ko(e, t) {
1957
+ const n = Y(We);
1596
1958
  if (!n) throw new Error("[react-modal-navigation] useModalLayout requires an active modal");
1597
- return Pe(n.stores.layout, e, t);
1959
+ return Fe(n.stores.layout, e, t);
1598
1960
  }
1599
- function Hr(e = {}) {
1600
- const t = ee(at), n = ee(Ve), r = jt(), o = P(e);
1601
- U(() => {
1961
+ function xo(e = {}) {
1962
+ const t = Y(We), n = Y(Je), r = Ut(), o = G(e);
1963
+ ee(() => {
1602
1964
  o.current = e;
1603
- }), U(() => (o.current.onMount?.(), () => o.current.onDestroy?.()), []), U(() => {
1965
+ }), ee(() => (o.current.onMount?.(), () => o.current.onDestroy?.()), []), ee(() => {
1604
1966
  if (r)
1605
1967
  return o.current.onFocus?.(), () => o.current.onBlur?.();
1606
- }, [r]), U(() => t?.registerRemovalGuard(n?.key, (a) => o.current.onBeforeRemove?.(a)), [t, n?.key]);
1607
- }
1608
- function Wr({ values: e, initialValues: t, equals: n = Object.is, message: r, onBeforeDiscard: o }) {
1609
- const [a, l] = xe(() => t), f = !n(a, e);
1610
- hr(f, { message: r, onBeforeDiscard: o });
1611
- const u = _((i = e) => l(() => i), [e]);
1612
- return { dirty: f, markSaved: u };
1613
- }
1614
- const kr = (e, t) => e && t && Object.keys(e).length === Object.keys(t).length && Object.keys(e).every((n) => Object.hasOwn(t, n) && Object.is(e[n], t[n]));
1615
- function xr(e, t) {
1616
- let n, r, o, a = !1, l = !1, f = !1, u = 0, i = -1;
1617
- const d = (h) => {
1968
+ }, [r]), ee(() => t?.registerRemovalGuard(n?.key, (s) => o.current.onBeforeRemove?.(s)), [t, n?.key]);
1969
+ }
1970
+ function So({ values: e, initialValues: t, equals: n = Object.is, message: r, onBeforeDiscard: o }) {
1971
+ const [s, i] = Pe(() => t), u = !n(s, e);
1972
+ Dr(u, { message: r, onBeforeDiscard: o });
1973
+ const a = X((c = e) => i(() => c), [e]);
1974
+ return { dirty: u, markSaved: a };
1975
+ }
1976
+ const Vr = (e, t) => e && t && Object.keys(e).length === Object.keys(t).length && Object.keys(e).every((n) => Object.hasOwn(t, n) && Object.is(e[n], t[n]));
1977
+ function Yr(e, t) {
1978
+ let n, r, o, s = !1, i = !1, u = !1, a = 0, c = -1, d = !1;
1979
+ const g = (l) => {
1618
1980
  try {
1619
- a && n?.onError ? Promise.resolve(n.onError(h)).catch((s) => console.error(s)) : console.error(h);
1620
- } catch (s) {
1621
- console.error(s);
1981
+ s && n?.onError ? Promise.resolve(n.onError(l)).catch((y) => console.error(y)) : console.error(l);
1982
+ } catch (y) {
1983
+ console.error(y);
1622
1984
  }
1623
- }, g = (h, ...s) => {
1624
- if (a)
1985
+ }, x = (l, ...y) => {
1986
+ if (s)
1625
1987
  try {
1626
- Promise.resolve(n[h]?.(...s)).catch(d);
1627
- } catch (v) {
1628
- d(v);
1988
+ Promise.resolve(n[l]?.(...y)).catch(g);
1989
+ } catch (C) {
1990
+ g(C);
1629
1991
  }
1630
1992
  }, b = () => {
1631
- f = !0, l || x();
1993
+ u = !0, !(i || d) && (d = !0, queueMicrotask(() => {
1994
+ d = !1, !i && u && h();
1995
+ }));
1632
1996
  };
1633
- async function x() {
1634
- l = !0;
1997
+ async function h() {
1998
+ i = !0;
1635
1999
  try {
1636
- for (; f; ) {
1637
- if (f = !1, !a) {
2000
+ for (; u; ) {
2001
+ if (u = !1, !s) {
1638
2002
  r?.dispose();
1639
2003
  continue;
1640
2004
  }
1641
- const h = n;
1642
- if (!h) continue;
1643
- const s = u;
1644
- if (!h.open) {
1645
- r?.isActive() && i !== s && (i = s, !await r.close() && u === s && g("onBlocked", "close"));
2005
+ const l = n;
2006
+ if (!l) continue;
2007
+ const y = a;
2008
+ if (!l.open) {
2009
+ r?.isActive() && c !== y && (c = y, !await r.close() && a === y && x("onBlocked", "close"));
1646
2010
  continue;
1647
2011
  }
1648
2012
  if (!r?.isActive()) {
1649
- if (i === s) continue;
1650
- i = s;
1651
- const v = await e.openInstance(
1652
- { component: t, title: h.title },
1653
- { children: h.children, title: h.title },
1654
- h.options
2013
+ if (c === y) continue;
2014
+ c = y;
2015
+ const C = await e.openInstance(
2016
+ { component: t, title: l.title },
2017
+ { children: l.children, title: l.title },
2018
+ l.options
1655
2019
  );
1656
- if (r = v, o = h, !v.isActive()) {
1657
- u === s && g("onBlocked", "open");
2020
+ if (r = C, o = l, !C.isActive()) {
2021
+ a === y && x("onBlocked", "open");
1658
2022
  continue;
1659
2023
  }
1660
- if (v.result.then((I) => {
1661
- r === v && (r = null, o = null, n.open && u === i && g("onOpenChange", !1, I), b());
1662
- }).catch(d), !a) {
1663
- v.dispose();
2024
+ if (C.result.then((L) => {
2025
+ r === C && (r = null, o = null, n.open && a === c && x("onOpenChange", !1, L), b());
2026
+ }).catch(g), !s) {
2027
+ C.dispose();
1664
2028
  continue;
1665
2029
  }
1666
2030
  if (!n.open) {
1667
- f = !0;
2031
+ u = !0;
1668
2032
  continue;
1669
2033
  }
1670
- if (!await v.ready || !v.isActive()) continue;
1671
- f = !0;
2034
+ if (!await C.ready || !C.isActive()) continue;
2035
+ u = !0;
1672
2036
  continue;
1673
2037
  }
1674
- i = s, !(!kr(o?.options, h.options) && !r.replaceOptions(h.options)) && ((!o || !Object.is(o.children, h.children) || !Object.is(o.title, h.title)) && !r.setParams({ children: h.children, title: h.title }) || (o = h));
2038
+ c = y, !(!Vr(o?.options, l.options) && !r.replaceOptions(l.options)) && ((!o || !Object.is(o.children, l.children) || !Object.is(o.title, l.title)) && !r.setParams({ children: l.children, title: l.title }) || (o = l));
1675
2039
  }
1676
- } catch (h) {
1677
- d(h);
2040
+ } catch (l) {
2041
+ g(l);
1678
2042
  } finally {
1679
- l = !1, f && b();
2043
+ i = !1, u && b();
1680
2044
  }
1681
2045
  }
1682
2046
  return {
1683
2047
  mount() {
1684
- a = !0;
2048
+ s = !0;
1685
2049
  },
1686
- update(h) {
1687
- (!n || n.open !== h.open) && u++, n = h, b();
2050
+ update(l) {
2051
+ (!n || n.open !== l.open) && a++, n = l, b();
1688
2052
  },
1689
2053
  unmount() {
1690
- a = !1, queueMicrotask(() => {
1691
- a || (r?.dispose(), b());
2054
+ s = !1, queueMicrotask(() => {
2055
+ s || (r?.dispose(), b());
1692
2056
  });
1693
2057
  }
1694
2058
  };
1695
2059
  }
1696
- function Sr() {
1697
- const { children: e, title: t } = yr(), n = cn();
1698
- return Ae(() => {
2060
+ function Qr() {
2061
+ const { children: e, title: t } = Hr(), n = Mn();
2062
+ return Se(() => {
1699
2063
  n.setOptions({ title: t });
1700
2064
  }, [n, t]), e;
1701
2065
  }
1702
- function Gr({ open: e, onOpenChange: t, onBlocked: n, onError: r, children: o, title: a, ...l }) {
1703
- const f = Bt(), u = Q(() => xr(f, Sr), [f]);
1704
- return U(() => (u.mount(), u.unmount), [u]), U(() => {
1705
- u.update({
2066
+ function Ro({ open: e, onOpenChange: t, onBlocked: n, onError: r, children: o, title: s, ...i }) {
2067
+ const u = Vt(), a = V(() => Yr(u, Qr), [u]);
2068
+ return ee(() => (a.mount(), a.unmount), [a]), ee(() => {
2069
+ a.update({
1706
2070
  open: e,
1707
2071
  onOpenChange: t,
1708
2072
  onBlocked: n,
1709
2073
  onError: r,
1710
2074
  children: o,
1711
- title: a,
1712
- options: { ...l, instanceKey: void 0, duplicateStrategy: "allow" }
2075
+ title: s,
2076
+ options: { ...i, instanceKey: void 0, duplicateStrategy: "allow" }
1713
2077
  });
1714
2078
  }), null;
1715
2079
  }
1716
- function Cr({ inspector: e }) {
1717
- const { active: t, queueSize: n, events: r } = Oe(e.subscribe, e.getSnapshot, e.getSnapshot);
1718
- return /* @__PURE__ */ be("details", { style: { font: "12px monospace", padding: 12, border: "1px solid #888", borderRadius: 8 }, children: [
1719
- /* @__PURE__ */ be("summary", { children: [
2080
+ function Zr({ inspector: e }) {
2081
+ const { active: t, queueSize: n, events: r } = Ee(e.subscribe, e.getSnapshot, e.getSnapshot);
2082
+ return /* @__PURE__ */ Me("details", { style: { font: "12px monospace", padding: 12, border: "1px solid #888", borderRadius: 8 }, children: [
2083
+ /* @__PURE__ */ Me("summary", { children: [
1720
2084
  "Modal DevTools · ",
1721
2085
  t?.name ?? "Idle"
1722
2086
  ] }),
1723
- /* @__PURE__ */ be("p", { children: [
2087
+ /* @__PURE__ */ Me("p", { children: [
1724
2088
  "Queue: ",
1725
2089
  n,
1726
2090
  " · Loading: ",
@@ -1728,14 +2092,14 @@ function Cr({ inspector: e }) {
1728
2092
  " · Tasks: ",
1729
2093
  t?.taskCount ?? 0
1730
2094
  ] }),
1731
- /* @__PURE__ */ p("button", { type: "button", onClick: e.refresh, children: "Refresh" }),
2095
+ /* @__PURE__ */ m("button", { type: "button", onClick: e.refresh, children: "Refresh" }),
1732
2096
  " ",
1733
- /* @__PURE__ */ p("button", { type: "button", onClick: e.clear, children: "Clear events" }),
1734
- /* @__PURE__ */ p("ol", { children: t?.routes.map((o) => /* @__PURE__ */ be("li", { children: [
2097
+ /* @__PURE__ */ m("button", { type: "button", onClick: e.clear, children: "Clear events" }),
2098
+ /* @__PURE__ */ m("ol", { children: t?.routes.map((o) => /* @__PURE__ */ Me("li", { children: [
1735
2099
  o.name,
1736
2100
  o.key === t.focusedKey ? " (focused)" : ""
1737
2101
  ] }, o.key)) }),
1738
- /* @__PURE__ */ p("ol", { style: { maxHeight: 240, overflow: "auto" }, children: r.map((o) => /* @__PURE__ */ be("li", { children: [
2102
+ /* @__PURE__ */ m("ol", { style: { maxHeight: 240, overflow: "auto" }, children: r.map((o) => /* @__PURE__ */ Me("li", { children: [
1739
2103
  o.sequence,
1740
2104
  " · ",
1741
2105
  o.type,
@@ -1744,46 +2108,53 @@ function Cr({ inspector: e }) {
1744
2108
  ] }, o.sequence)) })
1745
2109
  ] });
1746
2110
  }
1747
- function _r({ enabled: e = !1, limit: t = 100 }) {
1748
- const n = Bt(), [r, o] = xe(null);
1749
- return U(() => {
2111
+ function Co({ enabled: e = !1, limit: t = 100 }) {
2112
+ const n = Vt(), [r, o] = Pe(null);
2113
+ return ee(() => {
1750
2114
  if (!e) {
1751
2115
  o(null);
1752
2116
  return;
1753
2117
  }
1754
- const a = n.inspect({ limit: t });
1755
- return o(a), a.dispose;
1756
- }, [n, e, t]), e && r ? /* @__PURE__ */ p(Cr, { inspector: r }) : null;
2118
+ const s = n.inspect({ limit: t });
2119
+ return o(s), s.dispose;
2120
+ }, [n, e, t]), e && r ? /* @__PURE__ */ m(Zr, { inspector: r }) : null;
1757
2121
  }
1758
2122
  export {
1759
- Gr as Modal,
1760
- _r as ModalDevTools,
1761
- Hn as ModalNavigator,
1762
- Tr as ModalProvider,
1763
- Or as defineModal,
1764
- Pr as lazyModal,
1765
- He as shallowEqual,
1766
- Ar as useFocusEffect,
1767
- jt as useIsFocused,
1768
- Lr as useModal,
1769
- Bt as useModalCommands,
1770
- jr as useModalFooter,
1771
- Wr as useModalFormGuard,
1772
- Ir as useModalFullscreen,
1773
- Dr as useModalHeader,
1774
- Kr as useModalLayout,
1775
- Hr as useModalLifecycle,
1776
- Br as useModalLoading,
1777
- fr as useModalLoadingCommands,
1778
- qr as useModalLoadingState,
1779
- zr as useModalNavigation,
1780
- cn as useModalNavigationCommands,
1781
- mr as useModalNavigationState,
1782
- yr as useModalParams,
1783
- gr as useModalRoute,
1784
- br as useModalStatus,
1785
- Fr as useModalTask,
1786
- hr as useModalUnsavedChanges,
1787
- Nr as useNavigationResult,
1788
- $r as useToast
2123
+ Ro as Modal,
2124
+ Co as ModalDevTools,
2125
+ hr as ModalNavigator,
2126
+ so as ModalOutlet,
2127
+ co as ModalProvider,
2128
+ ao as defineModal,
2129
+ io as lazyModal,
2130
+ Ye as shallowEqual,
2131
+ mo as useFocusEffect,
2132
+ Ut as useIsFocused,
2133
+ lo as useModal,
2134
+ Vt as useModalCommands,
2135
+ po as useModalFooter,
2136
+ So as useModalFormGuard,
2137
+ bo as useModalFullscreen,
2138
+ ro as useModalGroupGuard,
2139
+ oo as useModalGroupLifecycle,
2140
+ wo as useModalHeader,
2141
+ ko as useModalLayout,
2142
+ xo as useModalLifecycle,
2143
+ ho as useModalLoading,
2144
+ $r as useModalLoadingCommands,
2145
+ go as useModalLoadingState,
2146
+ Gn as useModalMatches,
2147
+ uo as useModalNavigation,
2148
+ Mn as useModalNavigationCommands,
2149
+ qr as useModalNavigationState,
2150
+ Hr as useModalParams,
2151
+ Kr as useModalRoute,
2152
+ no as useModalRouteGroup,
2153
+ _r as useModalStatus,
2154
+ yo as useModalTask,
2155
+ Dr as useModalUnsavedChanges,
2156
+ fo as useNavigationResult,
2157
+ to as useParentParams,
2158
+ Fn as useParentRoute,
2159
+ vo as useToast
1789
2160
  };