flemo 1.3.1 → 1.3.3

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.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as M, jsxs as dt } from "react/jsx-runtime";
2
- import W, { useEffect as j, createContext as et, useReducer as Tt, Children as pt, useContext as nt, Suspense as Dt, useImperativeHandle as Lt, useRef as U } from "react";
3
- import { transform as st, useAnimate as ft, motion as ht, useDragControls as It, AnimatePresence as vt, MotionConfig as Nt } from "motion/react";
4
- var G = {}, at;
5
- function xt() {
6
- if (at) return G;
7
- at = 1, Object.defineProperty(G, "__esModule", { value: !0 }), G.PathError = G.TokenData = void 0, G.parse = l, G.compile = S, G.match = L, G.pathToRegexp = D, G.stringify = O;
8
- const n = "/", e = (o) => o, t = /^[$_\p{ID_Start}]$/u, r = /^[$\u200c\u200d\p{ID_Continue}]$/u, s = {
1
+ import { jsx as N, jsxs as gt } from "react/jsx-runtime";
2
+ import tt, { useEffect as Y, createContext as ot, useContext as it, useReducer as Ct, Children as mt, Suspense as At, useImperativeHandle as Rt, useRef as F } from "react";
3
+ import { transform as ct, useAnimate as Et, motion as X, useDragControls as bt, AnimatePresence as Ot, MotionConfig as Gt } from "motion/react";
4
+ var U = {}, lt;
5
+ function $t() {
6
+ if (lt) return U;
7
+ lt = 1, Object.defineProperty(U, "__esModule", { value: !0 }), U.PathError = U.TokenData = void 0, U.parse = l, U.compile = m, U.match = T, U.pathToRegexp = L, U.stringify = G;
8
+ const n = "/", e = (i) => i, t = /^[$_\p{ID_Start}]$/u, s = /^[$\u200c\u200d\p{ID_Continue}]$/u, r = {
9
9
  // Groups.
10
10
  "{": "{",
11
11
  "}": "}",
@@ -18,256 +18,256 @@ function xt() {
18
18
  "?": "?",
19
19
  "!": "!"
20
20
  };
21
- function a(o) {
22
- return o.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
21
+ function a(i) {
22
+ return i.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
23
23
  }
24
- function i(o) {
25
- return o.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
24
+ function o(i) {
25
+ return i.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
26
26
  }
27
- class u {
28
- constructor(p, g) {
29
- this.tokens = p, this.originalPath = g;
27
+ class c {
28
+ constructor(y, g) {
29
+ this.tokens = y, this.originalPath = g;
30
30
  }
31
31
  }
32
- G.TokenData = u;
33
- class f extends TypeError {
34
- constructor(p, g) {
35
- let m = p;
36
- g && (m += `: ${g}`), m += "; visit https://git.new/pathToRegexpError for info", super(m), this.originalPath = g;
32
+ U.TokenData = c;
33
+ class h extends TypeError {
34
+ constructor(y, g) {
35
+ let E = y;
36
+ g && (E += `: ${g}`), E += "; visit https://git.new/pathToRegexpError for info", super(E), this.originalPath = g;
37
37
  }
38
38
  }
39
- G.PathError = f;
40
- function l(o, p = {}) {
41
- const { encodePath: g = e } = p, m = [...o], y = [];
42
- let d = 0, I = 0;
43
- function T() {
44
- let P = "";
45
- if (t.test(m[d]))
39
+ U.PathError = h;
40
+ function l(i, y = {}) {
41
+ const { encodePath: g = e } = y, E = [...i], f = [];
42
+ let p = 0, v = 0;
43
+ function w() {
44
+ let S = "";
45
+ if (t.test(E[p]))
46
46
  do
47
- P += m[d++];
48
- while (r.test(m[d]));
49
- else if (m[d] === '"') {
50
- let C = d;
51
- for (; d++ < m.length; ) {
52
- if (m[d] === '"') {
53
- d++, C = 0;
47
+ S += E[p++];
48
+ while (s.test(E[p]));
49
+ else if (E[p] === '"') {
50
+ let M = p;
51
+ for (; p++ < E.length; ) {
52
+ if (E[p] === '"') {
53
+ p++, M = 0;
54
54
  break;
55
55
  }
56
- m[d] === "\\" && d++, P += m[d];
56
+ E[p] === "\\" && p++, S += E[p];
57
57
  }
58
- if (C)
59
- throw new f(`Unterminated quote at index ${C}`, o);
58
+ if (M)
59
+ throw new h(`Unterminated quote at index ${M}`, i);
60
60
  }
61
- if (!P)
62
- throw new f(`Missing parameter name at index ${d}`, o);
63
- return P;
61
+ if (!S)
62
+ throw new h(`Missing parameter name at index ${p}`, i);
63
+ return S;
64
64
  }
65
- for (; d < m.length; ) {
66
- const P = m[d], C = s[P];
67
- C ? y.push({ type: C, index: d++, value: P }) : P === "\\" ? y.push({ type: "escape", index: d++, value: m[d++] }) : P === ":" ? y.push({ type: "param", index: d++, value: T() }) : P === "*" ? y.push({ type: "wildcard", index: d++, value: T() }) : y.push({ type: "char", index: d++, value: P });
65
+ for (; p < E.length; ) {
66
+ const S = E[p], M = r[S];
67
+ M ? f.push({ type: M, index: p++, value: S }) : S === "\\" ? f.push({ type: "escape", index: p++, value: E[p++] }) : S === ":" ? f.push({ type: "param", index: p++, value: w() }) : S === "*" ? f.push({ type: "wildcard", index: p++, value: w() }) : f.push({ type: "char", index: p++, value: S });
68
68
  }
69
- y.push({ type: "end", index: d, value: "" });
70
- function R(P) {
71
- const C = [];
69
+ f.push({ type: "end", index: p, value: "" });
70
+ function A(S) {
71
+ const M = [];
72
72
  for (; ; ) {
73
- const k = y[I++];
74
- if (k.type === P)
73
+ const I = f[v++];
74
+ if (I.type === S)
75
75
  break;
76
- if (k.type === "char" || k.type === "escape") {
77
- let E = k.value, v = y[I];
78
- for (; v.type === "char" || v.type === "escape"; )
79
- E += v.value, v = y[++I];
80
- C.push({
76
+ if (I.type === "char" || I.type === "escape") {
77
+ let k = I.value, H = f[v];
78
+ for (; H.type === "char" || H.type === "escape"; )
79
+ k += H.value, H = f[++v];
80
+ M.push({
81
81
  type: "text",
82
- value: g(E)
82
+ value: g(k)
83
83
  });
84
84
  continue;
85
85
  }
86
- if (k.type === "param" || k.type === "wildcard") {
87
- C.push({
88
- type: k.type,
89
- name: k.value
86
+ if (I.type === "param" || I.type === "wildcard") {
87
+ M.push({
88
+ type: I.type,
89
+ name: I.value
90
90
  });
91
91
  continue;
92
92
  }
93
- if (k.type === "{") {
94
- C.push({
93
+ if (I.type === "{") {
94
+ M.push({
95
95
  type: "group",
96
- tokens: R("}")
96
+ tokens: A("}")
97
97
  });
98
98
  continue;
99
99
  }
100
- throw new f(`Unexpected ${k.type} at index ${k.index}, expected ${P}`, o);
100
+ throw new h(`Unexpected ${I.type} at index ${I.index}, expected ${S}`, i);
101
101
  }
102
- return C;
102
+ return M;
103
103
  }
104
- return new u(R("end"), o);
104
+ return new c(A("end"), i);
105
105
  }
106
- function S(o, p = {}) {
107
- const { encode: g = encodeURIComponent, delimiter: m = n } = p, y = typeof o == "object" ? o : l(o, p), d = h(y.tokens, m, g);
108
- return function(T = {}) {
109
- const [R, ...P] = d(T);
110
- if (P.length)
111
- throw new TypeError(`Missing parameters: ${P.join(", ")}`);
112
- return R;
106
+ function m(i, y = {}) {
107
+ const { encode: g = encodeURIComponent, delimiter: E = n } = y, f = typeof i == "object" ? i : l(i, y), p = d(f.tokens, E, g);
108
+ return function(w = {}) {
109
+ const [A, ...S] = p(w);
110
+ if (S.length)
111
+ throw new TypeError(`Missing parameters: ${S.join(", ")}`);
112
+ return A;
113
113
  };
114
114
  }
115
- function h(o, p, g) {
116
- const m = o.map((y) => c(y, p, g));
117
- return (y) => {
118
- const d = [""];
119
- for (const I of m) {
120
- const [T, ...R] = I(y);
121
- d[0] += T, d.push(...R);
115
+ function d(i, y, g) {
116
+ const E = i.map((f) => u(f, y, g));
117
+ return (f) => {
118
+ const p = [""];
119
+ for (const v of E) {
120
+ const [w, ...A] = v(f);
121
+ p[0] += w, p.push(...A);
122
122
  }
123
- return d;
123
+ return p;
124
124
  };
125
125
  }
126
- function c(o, p, g) {
127
- if (o.type === "text")
128
- return () => [o.value];
129
- if (o.type === "group") {
130
- const y = h(o.tokens, p, g);
131
- return (d) => {
132
- const [I, ...T] = y(d);
133
- return T.length ? [""] : [I];
126
+ function u(i, y, g) {
127
+ if (i.type === "text")
128
+ return () => [i.value];
129
+ if (i.type === "group") {
130
+ const f = d(i.tokens, y, g);
131
+ return (p) => {
132
+ const [v, ...w] = f(p);
133
+ return w.length ? [""] : [v];
134
134
  };
135
135
  }
136
- const m = g || e;
137
- return o.type === "wildcard" && g !== !1 ? (y) => {
138
- const d = y[o.name];
139
- if (d == null)
140
- return ["", o.name];
141
- if (!Array.isArray(d) || d.length === 0)
142
- throw new TypeError(`Expected "${o.name}" to be a non-empty array`);
136
+ const E = g || e;
137
+ return i.type === "wildcard" && g !== !1 ? (f) => {
138
+ const p = f[i.name];
139
+ if (p == null)
140
+ return ["", i.name];
141
+ if (!Array.isArray(p) || p.length === 0)
142
+ throw new TypeError(`Expected "${i.name}" to be a non-empty array`);
143
143
  return [
144
- d.map((I, T) => {
145
- if (typeof I != "string")
146
- throw new TypeError(`Expected "${o.name}/${T}" to be a string`);
147
- return m(I);
148
- }).join(p)
144
+ p.map((v, w) => {
145
+ if (typeof v != "string")
146
+ throw new TypeError(`Expected "${i.name}/${w}" to be a string`);
147
+ return E(v);
148
+ }).join(y)
149
149
  ];
150
- } : (y) => {
151
- const d = y[o.name];
152
- if (d == null)
153
- return ["", o.name];
154
- if (typeof d != "string")
155
- throw new TypeError(`Expected "${o.name}" to be a string`);
156
- return [m(d)];
150
+ } : (f) => {
151
+ const p = f[i.name];
152
+ if (p == null)
153
+ return ["", i.name];
154
+ if (typeof p != "string")
155
+ throw new TypeError(`Expected "${i.name}" to be a string`);
156
+ return [E(p)];
157
157
  };
158
158
  }
159
- function L(o, p = {}) {
160
- const { decode: g = decodeURIComponent, delimiter: m = n } = p, { regexp: y, keys: d } = D(o, p), I = d.map((T) => g === !1 ? e : T.type === "param" ? g : (R) => R.split(m).map(g));
161
- return function(R) {
162
- const P = y.exec(R);
163
- if (!P)
159
+ function T(i, y = {}) {
160
+ const { decode: g = decodeURIComponent, delimiter: E = n } = y, { regexp: f, keys: p } = L(i, y), v = p.map((w) => g === !1 ? e : w.type === "param" ? g : (A) => A.split(E).map(g));
161
+ return function(A) {
162
+ const S = f.exec(A);
163
+ if (!S)
164
164
  return !1;
165
- const C = P[0], k = /* @__PURE__ */ Object.create(null);
166
- for (let E = 1; E < P.length; E++) {
167
- if (P[E] === void 0)
165
+ const M = S[0], I = /* @__PURE__ */ Object.create(null);
166
+ for (let k = 1; k < S.length; k++) {
167
+ if (S[k] === void 0)
168
168
  continue;
169
- const v = d[E - 1], b = I[E - 1];
170
- k[v.name] = b(P[E]);
169
+ const H = p[k - 1], Z = v[k - 1];
170
+ I[H.name] = Z(S[k]);
171
171
  }
172
- return { path: C, params: k };
172
+ return { path: M, params: I };
173
173
  };
174
174
  }
175
- function D(o, p = {}) {
176
- const { delimiter: g = n, end: m = !0, sensitive: y = !1, trailing: d = !0 } = p, I = [], T = y ? "" : "i", R = [];
177
- for (const k of N(o, [])) {
178
- const E = typeof k == "object" ? k : l(k, p);
179
- for (const v of w(E.tokens, 0, []))
180
- R.push(x(v, g, I, E.originalPath));
175
+ function L(i, y = {}) {
176
+ const { delimiter: g = n, end: E = !0, sensitive: f = !1, trailing: p = !0 } = y, v = [], w = f ? "" : "i", A = [];
177
+ for (const I of x(i, [])) {
178
+ const k = typeof I == "object" ? I : l(I, y);
179
+ for (const H of P(k.tokens, 0, []))
180
+ A.push(C(H, g, v, k.originalPath));
181
181
  }
182
- let P = `^(?:${R.join("|")})`;
183
- return d && (P += `(?:${i(g)}$)?`), P += m ? "$" : `(?=${i(g)}|$)`, { regexp: new RegExp(P, T), keys: I };
182
+ let S = `^(?:${A.join("|")})`;
183
+ return p && (S += `(?:${o(g)}$)?`), S += E ? "$" : `(?=${o(g)}|$)`, { regexp: new RegExp(S, w), keys: v };
184
184
  }
185
- function N(o, p) {
186
- if (Array.isArray(o))
187
- for (const g of o)
188
- N(g, p);
185
+ function x(i, y) {
186
+ if (Array.isArray(i))
187
+ for (const g of i)
188
+ x(g, y);
189
189
  else
190
- p.push(o);
191
- return p;
190
+ y.push(i);
191
+ return y;
192
192
  }
193
- function* w(o, p, g) {
194
- if (p === o.length)
193
+ function* P(i, y, g) {
194
+ if (y === i.length)
195
195
  return yield g;
196
- const m = o[p];
197
- if (m.type === "group")
198
- for (const y of w(m.tokens, 0, g.slice()))
199
- yield* w(o, p + 1, y);
196
+ const E = i[y];
197
+ if (E.type === "group")
198
+ for (const f of P(E.tokens, 0, g.slice()))
199
+ yield* P(i, y + 1, f);
200
200
  else
201
- g.push(m);
202
- yield* w(o, p + 1, g);
201
+ g.push(E);
202
+ yield* P(i, y + 1, g);
203
203
  }
204
- function x(o, p, g, m) {
205
- let y = "", d = "", I = !0;
206
- for (const T of o) {
207
- if (T.type === "text") {
208
- y += i(T.value), d += T.value, I || (I = T.value.includes(p));
204
+ function C(i, y, g, E) {
205
+ let f = "", p = "", v = !0;
206
+ for (const w of i) {
207
+ if (w.type === "text") {
208
+ f += o(w.value), p += w.value, v || (v = w.value.includes(y));
209
209
  continue;
210
210
  }
211
- if (T.type === "param" || T.type === "wildcard") {
212
- if (!I && !d)
213
- throw new f(`Missing text before "${T.name}" ${T.type}`, m);
214
- T.type === "param" ? y += `(${F(p, I ? "" : d)}+)` : y += "([\\s\\S]+)", g.push(T), d = "", I = !1;
211
+ if (w.type === "param" || w.type === "wildcard") {
212
+ if (!v && !p)
213
+ throw new h(`Missing text before "${w.name}" ${w.type}`, E);
214
+ w.type === "param" ? f += `(${$(y, v ? "" : p)}+)` : f += "([\\s\\S]+)", g.push(w), p = "", v = !1;
215
215
  continue;
216
216
  }
217
217
  }
218
- return y;
218
+ return f;
219
219
  }
220
- function F(o, p) {
221
- return p.length < 2 ? o.length < 2 ? `[^${i(o + p)}]` : `(?:(?!${i(o)})[^${i(p)}])` : o.length < 2 ? `(?:(?!${i(p)})[^${i(o)}])` : `(?:(?!${i(p)}|${i(o)})[\\s\\S])`;
220
+ function $(i, y) {
221
+ return y.length < 2 ? i.length < 2 ? `[^${o(i + y)}]` : `(?:(?!${o(i)})[^${o(y)}])` : i.length < 2 ? `(?:(?!${o(y)})[^${o(i)}])` : `(?:(?!${o(y)}|${o(i)})[\\s\\S])`;
222
222
  }
223
- function A(o) {
224
- let p = "", g = 0;
225
- function m(y) {
226
- return Y(y) && X(o[g]) ? y : JSON.stringify(y);
223
+ function R(i) {
224
+ let y = "", g = 0;
225
+ function E(f) {
226
+ return W(f) && V(i[g]) ? f : JSON.stringify(f);
227
227
  }
228
- for (; g < o.length; ) {
229
- const y = o[g++];
230
- if (y.type === "text") {
231
- p += a(y.value);
228
+ for (; g < i.length; ) {
229
+ const f = i[g++];
230
+ if (f.type === "text") {
231
+ y += a(f.value);
232
232
  continue;
233
233
  }
234
- if (y.type === "group") {
235
- p += `{${A(y.tokens)}}`;
234
+ if (f.type === "group") {
235
+ y += `{${R(f.tokens)}}`;
236
236
  continue;
237
237
  }
238
- if (y.type === "param") {
239
- p += `:${m(y.name)}`;
238
+ if (f.type === "param") {
239
+ y += `:${E(f.name)}`;
240
240
  continue;
241
241
  }
242
- if (y.type === "wildcard") {
243
- p += `*${m(y.name)}`;
242
+ if (f.type === "wildcard") {
243
+ y += `*${E(f.name)}`;
244
244
  continue;
245
245
  }
246
- throw new TypeError(`Unknown token type: ${y.type}`);
246
+ throw new TypeError(`Unknown token type: ${f.type}`);
247
247
  }
248
- return p;
248
+ return y;
249
249
  }
250
- function O(o) {
251
- return A(o.tokens);
250
+ function G(i) {
251
+ return R(i.tokens);
252
252
  }
253
- function Y(o) {
254
- const [p, ...g] = o;
255
- return t.test(p) && g.every((m) => r.test(m));
253
+ function W(i) {
254
+ const [y, ...g] = i;
255
+ return t.test(y) && g.every((E) => s.test(E));
256
256
  }
257
- function X(o) {
258
- return o && o.type === "text" ? !r.test(o.value[0]) : !0;
257
+ function V(i) {
258
+ return i && i.type === "text" ? !s.test(i.value[0]) : !0;
259
259
  }
260
- return G;
260
+ return U;
261
261
  }
262
- var B = xt();
263
- function kt(n, e, t) {
264
- const r = Array.isArray(n) ? n.find((u) => B.pathToRegexp(u).regexp.test(e)) || "" : B.pathToRegexp(n).regexp.test(e) ? n : "", s = B.match(r)(e), a = new URLSearchParams(t), i = Object.fromEntries(a.entries());
265
- return s ? { ...s.params, ...i } : {};
262
+ var B = $t();
263
+ function Ut(n, e, t) {
264
+ const s = Array.isArray(n) ? n.find((c) => B.pathToRegexp(c).regexp.test(e)) || "" : B.pathToRegexp(n).regexp.test(e) ? n : "", r = B.match(s)(e), a = new URLSearchParams(t), o = Object.fromEntries(a.entries());
265
+ return r ? { ...r.params, ...o } : {};
266
266
  }
267
- function ot() {
267
+ function dt() {
268
268
  return typeof document > "u";
269
269
  }
270
- class Mt {
270
+ class _t {
271
271
  tasks = /* @__PURE__ */ new Map();
272
272
  instanceId = Date.now().toString();
273
273
  isLocked = !1;
@@ -277,7 +277,7 @@ class Mt {
277
277
  pendingTaskQueue = [];
278
278
  isProcessingPending = !1;
279
279
  async acquireLock(e) {
280
- for (let s = 0; s < 10; s++) {
280
+ for (let r = 0; r < 10; r++) {
281
281
  if (!this.isLocked)
282
282
  return this.isLocked = !0, this.currentTaskId = e, !0;
283
283
  await new Promise((a) => setTimeout(a, 100));
@@ -292,8 +292,8 @@ class Mt {
292
292
  }
293
293
  emitSignal(e) {
294
294
  const t = this.signalListeners.get(e);
295
- t && (t.forEach((r) => {
296
- this.resolveTask(r);
295
+ t && (t.forEach((s) => {
296
+ this.resolveTask(s);
297
297
  }), this.signalListeners.delete(e));
298
298
  }
299
299
  // 대기 중인 태스크들을 처리하는 메서드
@@ -320,7 +320,7 @@ class Mt {
320
320
  return new Promise((e) => {
321
321
  const t = () => {
322
322
  this.pendingTaskQueue.filter(
323
- (s) => s.status === "MANUAL_PENDING" || s.status === "SIGNAL_PENDING"
323
+ (r) => r.status === "MANUAL_PENDING" || r.status === "SIGNAL_PENDING"
324
324
  ).length === 0 ? e() : setTimeout(t, 100);
325
325
  };
326
326
  t();
@@ -328,88 +328,88 @@ class Mt {
328
328
  }
329
329
  // 태스크 상태 변경 시 대기 큐 처리
330
330
  async onTaskStatusChange(e, t) {
331
- (t === "COMPLETED" || t === "FAILED" || t === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((r) => r.id !== e), await this.processPendingTasks());
331
+ (t === "COMPLETED" || t === "FAILED" || t === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((s) => s.id !== e), await this.processPendingTasks());
332
332
  }
333
333
  async addTask(e, t = {}) {
334
- const r = t.id || this.generateTaskId();
335
- return new Promise((s, a) => {
334
+ const s = t.id || this.generateTaskId();
335
+ return new Promise((r, a) => {
336
336
  this.taskQueue = this.taskQueue.then(async () => {
337
337
  try {
338
- const { control: i, validate: u, rollback: f, dependencies: l = [], delay: S } = t, h = new AbortController(), c = {
339
- id: r,
338
+ const { control: o, validate: c, rollback: h, dependencies: l = [], delay: m } = t, d = new AbortController(), u = {
339
+ id: s,
340
340
  execute: e,
341
341
  timestamp: Date.now(),
342
342
  retryCount: 0,
343
343
  status: "PENDING",
344
344
  dependencies: l,
345
345
  instanceId: this.instanceId,
346
- validate: u,
347
- rollback: f,
348
- control: i,
349
- abortController: h
346
+ validate: c,
347
+ rollback: h,
348
+ control: o,
349
+ abortController: d
350
350
  };
351
- this.tasks.set(c.id, c), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(c), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((D) => D.id !== c.id));
351
+ this.tasks.set(u.id, u), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(u), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((L) => L.id !== u.id));
352
352
  try {
353
- if (!await this.acquireLock(c.id))
354
- throw c.status = "FAILED", new Error("FAILED");
353
+ if (!await this.acquireLock(u.id))
354
+ throw u.status = "FAILED", new Error("FAILED");
355
355
  try {
356
- c.status = "PROCESSING";
357
- for (const w of c.dependencies) {
358
- const x = this.tasks.get(w);
359
- if (!x || x.status !== "COMPLETED")
360
- throw c.status = "FAILED", new Error("FAILED");
356
+ u.status = "PROCESSING";
357
+ for (const P of u.dependencies) {
358
+ const C = this.tasks.get(P);
359
+ if (!C || C.status !== "COMPLETED")
360
+ throw u.status = "FAILED", new Error("FAILED");
361
361
  }
362
- if (c.validate && !await c.validate())
363
- throw c.status = "FAILED", new Error("FAILED");
364
- S && S > 0 && await new Promise((w) => setTimeout(w, S));
365
- const N = await c.execute(c.abortController);
366
- if (c.abortController.signal.aborted) {
367
- c.status = "COMPLETED", await this.onTaskStatusChange(c.id, "COMPLETED"), s({
362
+ if (u.validate && !await u.validate())
363
+ throw u.status = "FAILED", new Error("FAILED");
364
+ m && m > 0 && await new Promise((P) => setTimeout(P, m));
365
+ const x = await u.execute(u.abortController);
366
+ if (u.abortController.signal.aborted) {
367
+ u.status = "COMPLETED", await this.onTaskStatusChange(u.id, "COMPLETED"), r({
368
368
  success: !0,
369
369
  result: void 0,
370
- taskId: c.id,
370
+ taskId: u.id,
371
371
  timestamp: Date.now(),
372
372
  instanceId: this.instanceId
373
373
  });
374
374
  return;
375
375
  }
376
376
  if (t.control) {
377
- const w = t.control;
378
- if (w.delay && w.delay > 0 && await new Promise((x) => setTimeout(x, w.delay)), w.manual) {
379
- c.status = "MANUAL_PENDING", c.manualResolver = { resolve: s, reject: a, result: N }, this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "MANUAL_PENDING");
377
+ const P = t.control;
378
+ if (P.delay && P.delay > 0 && await new Promise((C) => setTimeout(C, P.delay)), P.manual) {
379
+ u.status = "MANUAL_PENDING", u.manualResolver = { resolve: r, reject: a, result: x }, this.pendingTaskQueue.push(u), await this.onTaskStatusChange(u.id, "MANUAL_PENDING");
380
380
  return;
381
381
  }
382
- if (w.signal) {
383
- c.status = "SIGNAL_PENDING", c.manualResolver = { resolve: s, reject: a, result: N }, this.signalListeners.has(w.signal) || this.signalListeners.set(w.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(w.signal).add(c.id), this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "SIGNAL_PENDING");
382
+ if (P.signal) {
383
+ u.status = "SIGNAL_PENDING", u.manualResolver = { resolve: r, reject: a, result: x }, this.signalListeners.has(P.signal) || this.signalListeners.set(P.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(P.signal).add(u.id), this.pendingTaskQueue.push(u), await this.onTaskStatusChange(u.id, "SIGNAL_PENDING");
384
384
  return;
385
385
  }
386
- if (w.condition && !await w.condition()) {
387
- c.status = "MANUAL_PENDING", c.manualResolver = { resolve: s, reject: a, result: N }, this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "MANUAL_PENDING");
386
+ if (P.condition && !await P.condition()) {
387
+ u.status = "MANUAL_PENDING", u.manualResolver = { resolve: r, reject: a, result: x }, this.pendingTaskQueue.push(u), await this.onTaskStatusChange(u.id, "MANUAL_PENDING");
388
388
  return;
389
389
  }
390
390
  }
391
- c.status = "COMPLETED", await this.onTaskStatusChange(c.id, "COMPLETED"), s({
391
+ u.status = "COMPLETED", await this.onTaskStatusChange(u.id, "COMPLETED"), r({
392
392
  success: !0,
393
- result: N,
394
- taskId: c.id,
393
+ result: x,
394
+ taskId: u.id,
395
395
  timestamp: Date.now(),
396
396
  instanceId: this.instanceId
397
397
  });
398
- } catch (N) {
399
- if (c.status = "FAILED", c.rollback)
398
+ } catch (x) {
399
+ if (u.status = "FAILED", u.rollback)
400
400
  try {
401
- await c.rollback(), c.status = "ROLLEDBACK";
401
+ await u.rollback(), u.status = "ROLLEDBACK";
402
402
  } catch {
403
403
  }
404
- throw await this.onTaskStatusChange(c.id, c.status), N;
404
+ throw await this.onTaskStatusChange(u.id, u.status), x;
405
405
  } finally {
406
- this.releaseLock(c.id);
406
+ this.releaseLock(u.id);
407
407
  }
408
- } catch (D) {
409
- a(D);
408
+ } catch (L) {
409
+ a(L);
410
410
  }
411
- } catch (i) {
412
- a(i);
411
+ } catch (o) {
412
+ a(o);
413
413
  }
414
414
  }).catch(a);
415
415
  });
@@ -422,10 +422,10 @@ class Mt {
422
422
  if (t.control?.condition && !await t.control.condition())
423
423
  return !1;
424
424
  t.status = "COMPLETED";
425
- const r = t.manualResolver;
426
- return r.resolve({
425
+ const s = t.manualResolver;
426
+ return s.resolve({
427
427
  success: !0,
428
- result: r.result,
428
+ result: s.result,
429
429
  taskId: t.id,
430
430
  timestamp: Date.now(),
431
431
  instanceId: this.instanceId
@@ -440,29 +440,29 @@ class Mt {
440
440
  await Promise.all(e.map((t) => this.resolveTask(t.id)));
441
441
  }
442
442
  }
443
- const _ = new Mt(), it = (n) => {
443
+ const Q = new _t(), pt = (n) => {
444
444
  let e;
445
- const t = /* @__PURE__ */ new Set(), r = (l, S) => {
446
- const h = typeof l == "function" ? l(e) : l;
447
- if (!Object.is(h, e)) {
448
- const c = e;
449
- e = S ?? (typeof h != "object" || h === null) ? h : Object.assign({}, e, h), t.forEach((L) => L(e, c));
445
+ const t = /* @__PURE__ */ new Set(), s = (l, m) => {
446
+ const d = typeof l == "function" ? l(e) : l;
447
+ if (!Object.is(d, e)) {
448
+ const u = e;
449
+ e = m ?? (typeof d != "object" || d === null) ? d : Object.assign({}, e, d), t.forEach((T) => T(e, u));
450
450
  }
451
- }, s = () => e, u = { setState: r, getState: s, getInitialState: () => f, subscribe: (l) => (t.add(l), () => t.delete(l)) }, f = e = n(r, s, u);
452
- return u;
453
- }, Ct = ((n) => n ? it(n) : it), At = (n) => n;
454
- function Rt(n, e = At) {
455
- const t = W.useSyncExternalStore(
451
+ }, r = () => e, c = { setState: s, getState: r, getInitialState: () => h, subscribe: (l) => (t.add(l), () => t.delete(l)) }, h = e = n(s, r, c);
452
+ return c;
453
+ }, Ht = ((n) => n ? pt(n) : pt), Ft = (n) => n;
454
+ function Qt(n, e = Ft) {
455
+ const t = tt.useSyncExternalStore(
456
456
  n.subscribe,
457
- W.useCallback(() => e(n.getState()), [n, e]),
458
- W.useCallback(() => e(n.getInitialState()), [n, e])
457
+ tt.useCallback(() => e(n.getState()), [n, e]),
458
+ tt.useCallback(() => e(n.getInitialState()), [n, e])
459
459
  );
460
- return W.useDebugValue(t), t;
460
+ return tt.useDebugValue(t), t;
461
461
  }
462
- const ct = (n) => {
463
- const e = Ct(n), t = (r) => Rt(e, r);
462
+ const ft = (n) => {
463
+ const e = Ht(n), t = (s) => Qt(e, s);
464
464
  return Object.assign(t, e), t;
465
- }, z = ((n) => n ? ct(n) : ct), H = z((n) => ({
465
+ }, et = ((n) => n ? ft(n) : ft), j = et((n) => ({
466
466
  index: -1,
467
467
  histories: [],
468
468
  addHistory: (e) => n((t) => ({
@@ -475,37 +475,37 @@ const ct = (n) => {
475
475
  })),
476
476
  popHistory: (e) => n((t) => ({
477
477
  index: t.index - 1,
478
- histories: t.histories.filter((r, s) => s !== e)
478
+ histories: t.histories.filter((s, r) => r !== e)
479
479
  }))
480
- })), $ = z((n) => ({
480
+ })), _ = et((n) => ({
481
481
  status: "IDLE",
482
482
  setStatus: (e) => n({ status: e })
483
483
  }));
484
- function bt() {
485
- return j(() => {
484
+ function jt() {
485
+ return Y(() => {
486
486
  const n = async (e) => {
487
487
  const t = e.state?.id;
488
- (await _.addTask(
489
- async (r) => {
490
- const s = e.state?.index, a = e.state?.status, i = e.state?.params, u = e.state?.transitionName, f = e.state?.layoutId, l = $.getState().setStatus, { index: S, addHistory: h, popHistory: c } = H.getState(), L = s < S, D = a === "PUSHING" && s > S, N = a === "REPLACING" && s > S, w = window.location.pathname;
491
- if (!L && !D && !N) {
492
- r.abort();
488
+ (await Q.addTask(
489
+ async (s) => {
490
+ const r = e.state?.index, a = e.state?.status, o = e.state?.params, c = e.state?.transitionName, h = e.state?.layoutId, l = _.getState().setStatus, { index: m, addHistory: d, popHistory: u } = j.getState(), T = r < m, L = a === "PUSHING" && r > m, x = a === "REPLACING" && r > m, P = window.location.pathname;
491
+ if (!T && !L && !x) {
492
+ s.abort();
493
493
  return;
494
494
  }
495
- return L ? l("POPPING") : D ? (l("PUSHING"), h({
495
+ return T ? l("POPPING") : L ? (l("PUSHING"), d({
496
496
  id: t,
497
- pathname: w,
498
- params: i,
499
- transitionName: u,
500
- layoutId: f
501
- })) : N && (l("REPLACING"), h({
497
+ pathname: P,
498
+ params: o,
499
+ transitionName: c,
500
+ layoutId: h
501
+ })) : x && (l("REPLACING"), d({
502
502
  id: t,
503
- pathname: w,
504
- params: i,
505
- transitionName: u,
506
- layoutId: f
503
+ pathname: P,
504
+ params: o,
505
+ transitionName: c,
506
+ layoutId: h
507
507
  })), async () => {
508
- L && c(s + 1), l("COMPLETED");
508
+ T && u(r + 1), l("COMPLETED");
509
509
  };
510
510
  },
511
511
  {
@@ -521,9 +521,9 @@ function bt() {
521
521
  };
522
522
  }, []), null;
523
523
  }
524
- const yt = et({}), gt = et(() => {
524
+ const St = ot({}), wt = ot(() => {
525
525
  });
526
- function Ot(n, e) {
526
+ function qt(n, e) {
527
527
  switch (e.type) {
528
528
  case "SET":
529
529
  return e.params;
@@ -531,24 +531,7 @@ function Ot(n, e) {
531
531
  return n;
532
532
  }
533
533
  }
534
- function Gt({
535
- children: n,
536
- active: e,
537
- params: t
538
- }) {
539
- const [r, s] = Tt(Ot, t);
540
- return j(() => {
541
- const a = async (i) => {
542
- i.state?.step && await _.addTask(async () => {
543
- s({ type: "SET", params: i.state?.params || {} });
544
- });
545
- };
546
- return e && window.addEventListener("popstate", a), () => {
547
- window.removeEventListener("popstate", a);
548
- };
549
- }, [e, s]), /* @__PURE__ */ M(gt.Provider, { value: s, children: /* @__PURE__ */ M(yt.Provider, { value: r, children: n }) });
550
- }
551
- const mt = et({
534
+ const Pt = ot({
552
535
  id: "",
553
536
  isActive: !1,
554
537
  isRoot: !0,
@@ -560,40 +543,56 @@ const mt = et({
560
543
  prevTransitionName: "none",
561
544
  layoutId: null
562
545
  });
563
- function $t({ children: n }) {
564
- const e = H((r) => r.index), t = H((r) => r.histories);
546
+ function z() {
547
+ return it(Pt);
548
+ }
549
+ function Bt({ children: n }) {
550
+ const { isActive: e, params: t } = z(), [s, r] = Ct(qt, t);
551
+ return Y(() => {
552
+ const a = async (o) => {
553
+ o.state?.step && await Q.addTask(async () => {
554
+ r({ type: "SET", params: o.state?.params || {} });
555
+ });
556
+ };
557
+ return e && window.addEventListener("popstate", a), () => {
558
+ window.removeEventListener("popstate", a);
559
+ };
560
+ }, [e, r]), /* @__PURE__ */ N(wt.Provider, { value: r, children: /* @__PURE__ */ N(St.Provider, { value: s, children: n }) });
561
+ }
562
+ function Yt({ children: n }) {
563
+ const e = j((s) => s.index), t = j((s) => s.histories);
565
564
  return t.map(
566
- (r) => pt.toArray(n).filter(
567
- (s) => B.pathToRegexp(s.props.path).regexp.test(
568
- r.pathname
565
+ (s) => mt.toArray(n).filter(
566
+ (r) => B.pathToRegexp(r.props.path).regexp.test(
567
+ s.pathname
569
568
  )
570
569
  )
571
- ).map(([r], s) => /* @__PURE__ */ M(
572
- mt.Provider,
570
+ ).map(([s], r) => /* @__PURE__ */ N(
571
+ Pt.Provider,
573
572
  {
574
573
  value: {
575
- id: t[s].id,
576
- isActive: s === e,
577
- isRoot: s === 0,
578
- isPrev: s < e - 1,
579
- zIndex: s,
580
- pathname: t[s].pathname,
581
- params: t[s].params,
574
+ id: t[r].id,
575
+ isActive: r === e,
576
+ isRoot: r === 0,
577
+ isPrev: r < e - 1,
578
+ zIndex: r,
579
+ pathname: t[r].pathname,
580
+ params: t[r].params,
582
581
  transitionName: t[e].transitionName,
583
582
  prevTransitionName: t[e - 1]?.transitionName,
584
- layoutId: t[s].layoutId
583
+ layoutId: t[r].layoutId
585
584
  },
586
- children: /* @__PURE__ */ M(Gt, { active: s === e, params: t[s].params, children: r })
585
+ children: /* @__PURE__ */ N(Bt, { children: s })
587
586
  },
588
- t[s].id
587
+ t[r].id
589
588
  ));
590
589
  }
591
- function Ut({
590
+ function Xt({
592
591
  name: n,
593
592
  initial: e,
594
593
  enter: t,
595
- exit: r,
596
- options: s
594
+ exit: s,
595
+ options: r
597
596
  }) {
598
597
  return {
599
598
  name: n,
@@ -601,19 +600,19 @@ function Ut({
601
600
  variants: {
602
601
  "IDLE-true": t,
603
602
  "IDLE-false": t,
604
- "PUSHING-false": r,
603
+ "PUSHING-false": s,
605
604
  "PUSHING-true": t,
606
- "REPLACING-false": r,
605
+ "REPLACING-false": s,
607
606
  "REPLACING-true": t,
608
607
  "POPPING-false": t,
609
608
  "POPPING-true": t,
610
- "COMPLETED-false": r,
609
+ "COMPLETED-false": s,
611
610
  "COMPLETED-true": t
612
611
  },
613
- ...s
612
+ ...r
614
613
  };
615
614
  }
616
- const _t = Ut({
615
+ const Kt = Xt({
617
616
  name: "overlay",
618
617
  initial: {
619
618
  opacity: 0,
@@ -647,8 +646,8 @@ const _t = Ut({
647
646
  duration: 0.3
648
647
  }
649
648
  ),
650
- onSwipe: (n, e, { animate: t, prevDecorator: r }) => t(
651
- r,
649
+ onSwipe: (n, e, { animate: t, prevDecorator: s }) => t(
650
+ s,
652
651
  {
653
652
  opacity: Math.max(0, 1 - e / 100)
654
653
  },
@@ -666,19 +665,19 @@ const _t = Ut({
666
665
  }
667
666
  )
668
667
  }
669
- }), rt = /* @__PURE__ */ new Map([["overlay", _t]]), Z = z((n) => ({
668
+ }), ut = /* @__PURE__ */ new Map([["overlay", Kt]]), st = et((n) => ({
670
669
  defaultTransitionName: "cupertino",
671
670
  setDefaultTransitionName: (e) => n({ defaultTransitionName: e })
672
671
  }));
673
- function J({
672
+ function nt({
674
673
  name: n,
675
674
  initial: e,
676
675
  idle: t,
677
- enter: r,
678
- enterBack: s,
676
+ enter: s,
677
+ enterBack: r,
679
678
  exit: a,
680
- exitBack: i,
681
- options: u
679
+ exitBack: o,
680
+ options: c
682
681
  }) {
683
682
  return {
684
683
  name: n,
@@ -687,18 +686,18 @@ function J({
687
686
  "IDLE-true": t,
688
687
  "IDLE-false": t,
689
688
  "PUSHING-false": a,
690
- "PUSHING-true": r,
689
+ "PUSHING-true": s,
691
690
  "REPLACING-false": a,
692
- "REPLACING-true": r,
693
- "POPPING-false": i,
694
- "POPPING-true": s,
691
+ "REPLACING-true": s,
692
+ "POPPING-false": o,
693
+ "POPPING-true": r,
695
694
  "COMPLETED-false": a,
696
- "COMPLETED-true": r
695
+ "COMPLETED-true": s
697
696
  },
698
- ...u
697
+ ...c
699
698
  };
700
699
  }
701
- const Ht = J({
700
+ const Vt = nt({
702
701
  name: "cupertino",
703
702
  initial: {
704
703
  x: "100%"
@@ -751,31 +750,31 @@ const Ht = J({
751
750
  decoratorName: "overlay",
752
751
  swipeDirection: "x",
753
752
  onSwipeStart: async () => !0,
754
- onSwipe: (n, e, { animate: t, currentScreen: r, prevScreen: s, onProgress: a }) => {
755
- const { offset: i } = e, u = i.x, f = st(u, [0, window.innerWidth], [0, 100]);
756
- return a?.(!0, f), t(
757
- r,
753
+ onSwipe: (n, e, { animate: t, currentScreen: s, prevScreen: r, onProgress: a }) => {
754
+ const { offset: o } = e, c = o.x, h = ct(c, [0, window.innerWidth], [0, 100]);
755
+ return a?.(!0, h), t(
756
+ s,
758
757
  {
759
- x: Math.max(0, u)
758
+ x: Math.max(0, c)
760
759
  },
761
760
  {
762
761
  duration: 0
763
762
  }
764
763
  ), t(
765
- s,
764
+ r,
766
765
  {
767
- x: -100 + f
766
+ x: -100 + h
768
767
  },
769
768
  {
770
769
  duration: 0
771
770
  }
772
- ), f;
771
+ ), h;
773
772
  },
774
- onSwipeEnd: async (n, e, { animate: t, currentScreen: r, prevScreen: s, onStart: a }) => {
775
- const { offset: i, velocity: u } = e, l = i.x > 50 || u.x > 20;
773
+ onSwipeEnd: async (n, e, { animate: t, currentScreen: s, prevScreen: r, onStart: a }) => {
774
+ const { offset: o, velocity: c } = e, l = o.x > 50 || c.x > 20;
776
775
  return a?.(l), await Promise.all([
777
776
  t(
778
- r,
777
+ s,
779
778
  {
780
779
  x: l ? "100%" : 0
781
780
  },
@@ -785,7 +784,7 @@ const Ht = J({
785
784
  }
786
785
  ),
787
786
  t(
788
- s,
787
+ r,
789
788
  {
790
789
  x: l ? 0 : -100
791
790
  },
@@ -797,7 +796,7 @@ const Ht = J({
797
796
  ]), l;
798
797
  }
799
798
  }
800
- }), Ft = J({
799
+ }), zt = nt({
801
800
  name: "layout",
802
801
  initial: {
803
802
  opacity: 0.97
@@ -846,24 +845,24 @@ const Ht = J({
846
845
  decoratorName: "overlay",
847
846
  swipeDirection: "y",
848
847
  onSwipeStart: async () => !0,
849
- onSwipe: (n, e, { animate: t, currentScreen: r, onProgress: s }) => {
850
- const { offset: a } = e, i = a.y, u = Math.max(0, Math.min(56, i)), f = st(u, [0, 56], [1, 0.96]), l = Math.max(0, i - 56), S = Math.min(1, l / 160), h = Math.sqrt(S) * 12, c = Math.max(0, u + h), L = Math.min(56, c);
851
- return s?.(!0, 100), t(
852
- r,
848
+ onSwipe: (n, e, { animate: t, currentScreen: s, onProgress: r }) => {
849
+ const { offset: a } = e, o = a.y, c = Math.max(0, Math.min(56, o)), h = ct(c, [0, 56], [1, 0.96]), l = Math.max(0, o - 56), m = Math.min(1, l / 160), d = Math.sqrt(m) * 12, u = Math.max(0, c + d), T = Math.min(56, u);
850
+ return r?.(!0, 100), t(
851
+ s,
853
852
  {
854
- y: c,
855
- opacity: f
853
+ y: u,
854
+ opacity: h
856
855
  },
857
856
  {
858
857
  duration: 0
859
858
  }
860
- ), L;
859
+ ), T;
861
860
  },
862
- onSwipeEnd: async (n, e, { animate: t, currentScreen: r, prevScreen: s, onStart: a }) => {
863
- const { offset: i, velocity: u } = e, l = i.y > 56 || u.y > 20;
861
+ onSwipeEnd: async (n, e, { animate: t, currentScreen: s, prevScreen: r, onStart: a }) => {
862
+ const { offset: o, velocity: c } = e, l = o.y > 56 || c.y > 20;
864
863
  return a?.(l), await Promise.all([
865
864
  t(
866
- r,
865
+ s,
867
866
  {
868
867
  y: l ? "100%" : 0,
869
868
  opacity: l ? 0.96 : 1
@@ -873,7 +872,7 @@ const Ht = J({
873
872
  }
874
873
  ),
875
874
  t(
876
- s,
875
+ r,
877
876
  {
878
877
  y: 0,
879
878
  opacity: l ? 1 : 0.97
@@ -885,7 +884,7 @@ const Ht = J({
885
884
  ]), l;
886
885
  }
887
886
  }
888
- }), Qt = J({
887
+ }), Wt = nt({
889
888
  name: "material",
890
889
  initial: {
891
890
  y: "100%",
@@ -943,31 +942,31 @@ const Ht = J({
943
942
  options: {
944
943
  swipeDirection: "y",
945
944
  onSwipeStart: async () => !0,
946
- onSwipe: (n, e, { animate: t, currentScreen: r, prevScreen: s, onProgress: a }) => {
947
- const { offset: i } = e, u = i.y, f = Math.max(0, Math.min(56, u)), l = st(f, [0, 56], [1, 0.96]), S = Math.max(0, u - 56), h = Math.min(1, S / 160), c = Math.sqrt(h) * 12, L = Math.max(0, f + c), D = Math.min(56, L);
948
- return a?.(!0, D), t(
949
- r,
945
+ onSwipe: (n, e, { animate: t, currentScreen: s, prevScreen: r, onProgress: a }) => {
946
+ const { offset: o } = e, c = o.y, h = Math.max(0, Math.min(56, c)), l = ct(h, [0, 56], [1, 0.96]), m = Math.max(0, c - 56), d = Math.min(1, m / 160), u = Math.sqrt(d) * 12, T = Math.max(0, h + u), L = Math.min(56, T);
947
+ return a?.(!0, L), t(
948
+ s,
950
949
  {
951
- y: L,
950
+ y: T,
952
951
  opacity: l
953
952
  },
954
953
  {
955
954
  duration: 0
956
955
  }
957
956
  ), t(
958
- s,
957
+ r,
959
958
  {
960
- y: -56 + D,
961
- opacity: D / 56
959
+ y: -56 + L,
960
+ opacity: L / 56
962
961
  },
963
962
  { duration: 0 }
964
- ), D;
963
+ ), L;
965
964
  },
966
- onSwipeEnd: async (n, e, { animate: t, currentScreen: r, prevScreen: s, onStart: a }) => {
967
- const { offset: i, velocity: u } = e, l = i.y > 56 || u.y > 20;
965
+ onSwipeEnd: async (n, e, { animate: t, currentScreen: s, prevScreen: r, onStart: a }) => {
966
+ const { offset: o, velocity: c } = e, l = o.y > 56 || c.y > 20;
968
967
  return a?.(l), await Promise.all([
969
968
  t(
970
- r,
969
+ s,
971
970
  {
972
971
  y: l ? "100%" : 0,
973
972
  opacity: l ? 0.96 : 1
@@ -978,7 +977,7 @@ const Ht = J({
978
977
  }
979
978
  ),
980
979
  t(
981
- s,
980
+ r,
982
981
  {
983
982
  y: l ? 0 : -56,
984
983
  opacity: l ? 1 : 0.96
@@ -991,7 +990,7 @@ const Ht = J({
991
990
  ]), l;
992
991
  }
993
992
  }
994
- }), Bt = J({
993
+ }), Jt = nt({
995
994
  name: "none",
996
995
  initial: {},
997
996
  idle: {
@@ -1024,46 +1023,46 @@ const Ht = J({
1024
1023
  duration: 0
1025
1024
  }
1026
1025
  }
1027
- }), K = /* @__PURE__ */ new Map([
1028
- ["none", Bt],
1029
- ["cupertino", Ht],
1030
- ["material", Qt],
1031
- ["layout", Ft]
1032
- ]), jt = (() => {
1026
+ }), J = /* @__PURE__ */ new Map([
1027
+ ["none", Jt],
1028
+ ["cupertino", Vt],
1029
+ ["material", Wt],
1030
+ ["layout", zt]
1031
+ ]), Zt = (() => {
1033
1032
  const n = /* @__PURE__ */ Object.create(null), e = Object.prototype.hasOwnProperty;
1034
- for (const t of K.values()) {
1035
- const r = t.variants["IDLE-true"].value;
1036
- for (const s in r)
1037
- e.call(r, s) && (n[s] = r[s]);
1033
+ for (const t of J.values()) {
1034
+ const s = t.variants["IDLE-true"].value;
1035
+ for (const r in s)
1036
+ e.call(s, r) && (n[r] = s[r]);
1038
1037
  }
1039
1038
  return n;
1040
1039
  })();
1041
- function Jt({
1040
+ function ie({
1042
1041
  children: n,
1043
1042
  initPath: e = "/",
1044
1043
  defaultTransitionName: t = "cupertino",
1045
- transitions: r = [],
1046
- decorators: s = []
1044
+ transitions: s = [],
1045
+ decorators: r = []
1047
1046
  }) {
1048
- const a = ot() ? e || "/" : window.location.pathname, i = ot() ? a.split("?")[1] || "" : window.location.search;
1049
- return Z.setState({
1047
+ const a = dt() ? e || "/" : window.location.pathname, o = dt() ? a.split("?")[1] || "" : window.location.search;
1048
+ return st.setState({
1050
1049
  defaultTransitionName: t
1051
- }), H.setState({
1050
+ }), j.setState({
1052
1051
  index: 0,
1053
1052
  histories: [
1054
1053
  {
1055
1054
  id: "root",
1056
1055
  pathname: a,
1057
- params: kt(
1058
- pt.toArray(n).map((u) => u.props.path).flat(),
1056
+ params: Ut(
1057
+ mt.toArray(n).map((c) => c.props.path).flat(),
1059
1058
  a,
1060
- i
1059
+ o
1061
1060
  ),
1062
1061
  transitionName: t,
1063
1062
  layoutId: null
1064
1063
  }
1065
1064
  ]
1066
- }), j(() => {
1065
+ }), Y(() => {
1067
1066
  window.history.state?.index || window.history.replaceState(
1068
1067
  {
1069
1068
  id: "root",
@@ -1076,11 +1075,11 @@ function Jt({
1076
1075
  "",
1077
1076
  window.location.pathname
1078
1077
  );
1079
- }, [t]), j(() => {
1080
- r.forEach((u) => K.set(u.name, u));
1081
- }, [r]), j(() => {
1082
- s.forEach((u) => rt.set(u.name, u));
1083
- }, [s]), /* @__PURE__ */ dt(
1078
+ }, [t]), Y(() => {
1079
+ s.forEach((c) => J.set(c.name, c));
1080
+ }, [s]), Y(() => {
1081
+ r.forEach((c) => ut.set(c.name, c));
1082
+ }, [r]), /* @__PURE__ */ gt(
1084
1083
  "div",
1085
1084
  {
1086
1085
  style: {
@@ -1091,91 +1090,91 @@ function Jt({
1091
1090
  height: "100%"
1092
1091
  },
1093
1092
  children: [
1094
- /* @__PURE__ */ M(bt, {}),
1095
- /* @__PURE__ */ M($t, { children: n })
1093
+ /* @__PURE__ */ N(jt, {}),
1094
+ /* @__PURE__ */ N(Yt, { children: n })
1096
1095
  ]
1097
1096
  }
1098
1097
  );
1099
1098
  }
1100
- function Zt({ element: n }) {
1099
+ function ce({ element: n }) {
1101
1100
  return n;
1102
1101
  }
1103
- function te() {
1102
+ function ue() {
1104
1103
  return {
1105
- push: async (r, s, a = {}) => {
1106
- const { status: i, setStatus: u } = $.getState();
1107
- if (i !== "COMPLETED" && i !== "IDLE")
1104
+ push: async (s, r, a = {}) => {
1105
+ const { status: o, setStatus: c } = _.getState();
1106
+ if (o !== "COMPLETED" && o !== "IDLE")
1108
1107
  return;
1109
- const { index: f, addHistory: l } = H.getState(), S = Z.getState().defaultTransitionName, { transitionName: h = S, layoutId: c = null } = a, L = _.generateTaskId();
1110
- (await _.addTask(
1108
+ const { index: h, addHistory: l } = j.getState(), m = st.getState().defaultTransitionName, { transitionName: d = m, layoutId: u = null } = a, T = Q.generateTaskId();
1109
+ (await Q.addTask(
1111
1110
  async () => {
1112
- u("PUSHING");
1113
- const D = B.compile(r)(s), N = B.parse(r).tokens.filter((A) => A.type === "param").map((A) => A.name), w = Object.fromEntries(
1114
- Object.entries(s).filter(([A]) => !N.includes(A))
1115
- ), x = new URLSearchParams(w).toString(), F = `${D}${x ? `?${x}` : ""}`;
1111
+ c("PUSHING");
1112
+ const L = B.compile(s)(r), x = B.parse(s).tokens.filter((R) => R.type === "param").map((R) => R.name), P = Object.fromEntries(
1113
+ Object.entries(r).filter(([R]) => !x.includes(R))
1114
+ ), C = new URLSearchParams(P).toString(), $ = `${L}${C ? `?${C}` : ""}`;
1116
1115
  return window.history.pushState(
1117
1116
  {
1118
- id: L,
1119
- index: f + 1,
1117
+ id: T,
1118
+ index: h + 1,
1120
1119
  status: "PUSHING",
1121
- params: s,
1122
- transitionName: h,
1123
- layoutId: c
1120
+ params: r,
1121
+ transitionName: d,
1122
+ layoutId: u
1124
1123
  },
1125
1124
  "",
1126
- F
1125
+ $
1127
1126
  ), l({
1128
- id: L,
1129
- pathname: D,
1130
- params: s,
1131
- transitionName: h,
1132
- layoutId: c
1127
+ id: T,
1128
+ pathname: L,
1129
+ params: r,
1130
+ transitionName: d,
1131
+ layoutId: u
1133
1132
  }), () => {
1134
- u("COMPLETED");
1133
+ c("COMPLETED");
1135
1134
  };
1136
1135
  },
1137
1136
  {
1138
- id: L,
1137
+ id: T,
1139
1138
  control: {
1140
1139
  manual: !0
1141
1140
  }
1142
1141
  }
1143
1142
  )).result?.();
1144
1143
  },
1145
- replace: async (r, s, a = {}) => {
1146
- const { status: i, setStatus: u } = $.getState();
1147
- if (i !== "COMPLETED" && i !== "IDLE")
1144
+ replace: async (s, r, a = {}) => {
1145
+ const { status: o, setStatus: c } = _.getState();
1146
+ if (o !== "COMPLETED" && o !== "IDLE")
1148
1147
  return;
1149
- const { index: f, addHistory: l } = H.getState(), S = H.getState().replaceHistory, h = Z.getState().defaultTransitionName, { transitionName: c = h, layoutId: L = null } = a, D = _.generateTaskId();
1150
- (await _.addTask(
1148
+ const { index: h, addHistory: l } = j.getState(), m = j.getState().replaceHistory, d = st.getState().defaultTransitionName, { transitionName: u = d, layoutId: T = null } = a, L = Q.generateTaskId();
1149
+ (await Q.addTask(
1151
1150
  async () => {
1152
- u("REPLACING");
1153
- const N = B.compile(r)(s), w = B.parse(r).tokens.filter((O) => O.type === "param").map((O) => O.name), x = Object.fromEntries(
1154
- Object.entries(s).filter(([O]) => !w.includes(O))
1155
- ), F = new URLSearchParams(x).toString(), A = `${N}${F ? `?${F}` : ""}`;
1151
+ c("REPLACING");
1152
+ const x = B.compile(s)(r), P = B.parse(s).tokens.filter((G) => G.type === "param").map((G) => G.name), C = Object.fromEntries(
1153
+ Object.entries(r).filter(([G]) => !P.includes(G))
1154
+ ), $ = new URLSearchParams(C).toString(), R = `${x}${$ ? `?${$}` : ""}`;
1156
1155
  return window.history.replaceState(
1157
1156
  {
1158
- id: D,
1159
- index: f,
1157
+ id: L,
1158
+ index: h,
1160
1159
  status: "REPLACING",
1161
- params: s,
1162
- transitionName: c,
1163
- layoutId: L
1160
+ params: r,
1161
+ transitionName: u,
1162
+ layoutId: T
1164
1163
  },
1165
1164
  "",
1166
- A
1165
+ R
1167
1166
  ), l({
1168
- id: D,
1169
- pathname: N,
1170
- params: s,
1171
- transitionName: c,
1172
- layoutId: L
1167
+ id: L,
1168
+ pathname: x,
1169
+ params: r,
1170
+ transitionName: u,
1171
+ layoutId: T
1173
1172
  }), async () => {
1174
- S(f), u("COMPLETED");
1173
+ m(h), c("COMPLETED");
1175
1174
  };
1176
1175
  },
1177
1176
  {
1178
- id: D,
1177
+ id: L,
1179
1178
  control: {
1180
1179
  manual: !0
1181
1180
  }
@@ -1183,18 +1182,18 @@ function te() {
1183
1182
  )).result?.();
1184
1183
  },
1185
1184
  pop: () => {
1186
- const r = $.getState().status;
1187
- r !== "COMPLETED" && r !== "IDLE" || window.history.back();
1185
+ const s = _.getState().status;
1186
+ s !== "COMPLETED" && s !== "IDLE" || window.history.back();
1188
1187
  }
1189
1188
  };
1190
1189
  }
1191
- function ee() {
1192
- const n = nt(gt);
1190
+ function le() {
1191
+ const n = it(wt);
1193
1192
  return {
1194
- pushStep: async (s) => {
1195
- const a = $.getState().status;
1196
- a !== "COMPLETED" && a !== "IDLE" || (await _.addTask(async () => {
1197
- const i = new URLSearchParams(s).toString(), u = `${window.location.pathname}${i ? `?${i}` : ""}`;
1193
+ pushStep: async (r) => {
1194
+ const a = _.getState().status;
1195
+ a !== "COMPLETED" && a !== "IDLE" || (await Q.addTask(async () => {
1196
+ const o = new URLSearchParams(r).toString(), c = `${window.location.pathname}${o ? `?${o}` : ""}`;
1198
1197
  return window.history.state?.step || window.history.replaceState(
1199
1198
  {
1200
1199
  ...window.history.state,
@@ -1206,53 +1205,50 @@ function ee() {
1206
1205
  {
1207
1206
  ...window.history.state,
1208
1207
  step: !0,
1209
- params: s
1208
+ params: r
1210
1209
  },
1211
1210
  "",
1212
- u
1213
- ), async () => n({ type: "SET", params: s });
1211
+ c
1212
+ ), async () => n({ type: "SET", params: r });
1214
1213
  })).result?.();
1215
1214
  },
1216
- replaceStep: async (s) => {
1217
- const a = $.getState().status;
1218
- a !== "COMPLETED" && a !== "IDLE" || (await _.addTask(async () => {
1219
- const i = new URLSearchParams(s).toString(), u = `${window.location.pathname}${i ? `?${i}` : ""}`;
1215
+ replaceStep: async (r) => {
1216
+ const a = _.getState().status;
1217
+ a !== "COMPLETED" && a !== "IDLE" || (await Q.addTask(async () => {
1218
+ const o = new URLSearchParams(r).toString(), c = `${window.location.pathname}${o ? `?${o}` : ""}`;
1220
1219
  return window.history.replaceState(
1221
1220
  {
1222
1221
  ...window.history.state,
1223
1222
  step: !0,
1224
- params: s
1223
+ params: r
1225
1224
  },
1226
1225
  "",
1227
- u
1228
- ), async () => n({ type: "SET", params: s });
1226
+ c
1227
+ ), async () => n({ type: "SET", params: r });
1229
1228
  })).result?.();
1230
1229
  },
1231
1230
  popStep: () => {
1232
- const s = $.getState().status;
1233
- s !== "COMPLETED" && s !== "IDLE" || window.history.back();
1231
+ const r = _.getState().status;
1232
+ r !== "COMPLETED" && r !== "IDLE" || window.history.back();
1234
1233
  }
1235
1234
  };
1236
1235
  }
1237
- function V() {
1238
- return nt(mt);
1239
- }
1240
- function ne() {
1241
- return nt(yt);
1236
+ function de() {
1237
+ return it(St);
1242
1238
  }
1243
- function se({
1239
+ function pe({
1244
1240
  name: n,
1245
1241
  initial: e,
1246
1242
  idle: t,
1247
- pushOnEnter: r,
1248
- pushOnExit: s,
1243
+ pushOnEnter: s,
1244
+ pushOnExit: r,
1249
1245
  replaceOnEnter: a,
1250
- replaceOnExit: i,
1251
- popOnEnter: u,
1252
- popOnExit: f,
1246
+ replaceOnExit: o,
1247
+ popOnEnter: c,
1248
+ popOnExit: h,
1253
1249
  completedOnExit: l,
1254
- completedOnEnter: S,
1255
- options: h
1250
+ completedOnEnter: m,
1251
+ options: d
1256
1252
  }) {
1257
1253
  return {
1258
1254
  name: n,
@@ -1260,31 +1256,31 @@ function se({
1260
1256
  variants: {
1261
1257
  "IDLE-true": t,
1262
1258
  "IDLE-false": t,
1263
- "PUSHING-false": s,
1264
- "PUSHING-true": r,
1265
- "REPLACING-false": i,
1259
+ "PUSHING-false": r,
1260
+ "PUSHING-true": s,
1261
+ "REPLACING-false": o,
1266
1262
  "REPLACING-true": a,
1267
- "POPPING-false": f,
1268
- "POPPING-true": u,
1263
+ "POPPING-false": h,
1264
+ "POPPING-true": c,
1269
1265
  "COMPLETED-false": l,
1270
- "COMPLETED-true": S
1266
+ "COMPLETED-true": m
1271
1267
  },
1272
- ...h
1268
+ ...d
1273
1269
  };
1274
1270
  }
1275
- function re({
1271
+ function fe({
1276
1272
  name: n,
1277
1273
  initial: e,
1278
1274
  idle: t,
1279
- pushOnEnter: r,
1280
- pushOnExit: s,
1275
+ pushOnEnter: s,
1276
+ pushOnExit: r,
1281
1277
  replaceOnEnter: a,
1282
- replaceOnExit: i,
1283
- popOnEnter: u,
1284
- popOnExit: f,
1278
+ replaceOnExit: o,
1279
+ popOnEnter: c,
1280
+ popOnExit: h,
1285
1281
  completedOnEnter: l,
1286
- completedOnExit: S,
1287
- options: h
1282
+ completedOnExit: m,
1283
+ options: d
1288
1284
  }) {
1289
1285
  return {
1290
1286
  name: n,
@@ -1292,93 +1288,93 @@ function re({
1292
1288
  variants: {
1293
1289
  "IDLE-true": t,
1294
1290
  "IDLE-false": t,
1295
- "PUSHING-false": s,
1296
- "PUSHING-true": r,
1297
- "REPLACING-false": i,
1291
+ "PUSHING-false": r,
1292
+ "PUSHING-true": s,
1293
+ "REPLACING-false": o,
1298
1294
  "REPLACING-true": a,
1299
- "POPPING-false": f,
1300
- "POPPING-true": u,
1301
- "COMPLETED-false": S,
1295
+ "POPPING-false": h,
1296
+ "POPPING-true": c,
1297
+ "COMPLETED-false": m,
1302
1298
  "COMPLETED-true": l
1303
1299
  },
1304
- ...h
1300
+ ...d
1305
1301
  };
1306
1302
  }
1307
- const qt = { then() {
1303
+ const te = { then() {
1308
1304
  } };
1309
- function Yt({
1305
+ function ee({
1310
1306
  freeze: n,
1311
1307
  children: e
1312
1308
  }) {
1313
1309
  if (n)
1314
- throw qt;
1310
+ throw te;
1315
1311
  return e;
1316
1312
  }
1317
- function Et({ freeze: n, children: e, placeholder: t }) {
1318
- return /* @__PURE__ */ M(Dt, { fallback: t, children: /* @__PURE__ */ M(Yt, { freeze: n, children: e }) });
1313
+ function Tt({ freeze: n, children: e, placeholder: t }) {
1314
+ return /* @__PURE__ */ N(At, { fallback: t, children: /* @__PURE__ */ N(ee, { freeze: n, children: e }) });
1319
1315
  }
1320
- function ut(n, e) {
1316
+ function ht(n, e) {
1321
1317
  const {
1322
1318
  direction: t = "x",
1323
- markerSelector: r = "[data-swipe-at-edge]",
1324
- depthLimit: s = 24,
1319
+ markerSelector: s = "[data-swipe-at-edge]",
1320
+ depthLimit: r = 24,
1325
1321
  verifyByScroll: a = !1
1326
- } = e ?? {}, i = Xt(n);
1327
- if (!i) return { element: null, hasMarker: !1 };
1328
- const u = i.closest?.(r);
1329
- if (u instanceof HTMLElement && tt(u, t) && (!a || lt(u, t)))
1330
- return { element: u, hasMarker: !0 };
1331
- let f = i, l = 0;
1332
- for (; f && f !== document.body && l < s; ) {
1333
- if (tt(f, t) && (!a || lt(f, t)))
1334
- return { element: f, hasMarker: !1 };
1335
- f = f.parentElement, l++;
1322
+ } = e ?? {}, o = ne(n);
1323
+ if (!o) return { element: null, hasMarker: !1 };
1324
+ const c = o.closest?.(s);
1325
+ if (c instanceof HTMLElement && at(c, t) && (!a || yt(c, t)))
1326
+ return { element: c, hasMarker: !0 };
1327
+ let h = o, l = 0;
1328
+ for (; h && h !== document.body && l < r; ) {
1329
+ if (at(h, t) && (!a || yt(h, t)))
1330
+ return { element: h, hasMarker: !1 };
1331
+ h = h.parentElement, l++;
1336
1332
  }
1337
1333
  return { element: null, hasMarker: !1 };
1338
1334
  }
1339
- function Xt(n) {
1335
+ function ne(n) {
1340
1336
  if (!n) return null;
1341
1337
  const e = n, t = typeof e.composedPath == "function" ? e.composedPath() : void 0;
1342
1338
  if (t && t.length) {
1343
- for (const r of t)
1344
- if (r instanceof HTMLElement) return r;
1339
+ for (const s of t)
1340
+ if (s instanceof HTMLElement) return s;
1345
1341
  }
1346
1342
  return n;
1347
1343
  }
1348
- function tt(n, e) {
1344
+ function at(n, e) {
1349
1345
  return e === "y" ? n.scrollHeight - n.clientHeight > 1 : n.scrollWidth - n.clientWidth > 1;
1350
1346
  }
1351
- function lt(n, e) {
1352
- if (!tt(n, e)) return !1;
1347
+ function yt(n, e) {
1348
+ if (!at(n, e)) return !1;
1353
1349
  if (e === "y") {
1354
1350
  const t = n.scrollTop;
1355
1351
  if (n.scrollTop = t + 1, n.scrollTop !== t)
1356
1352
  return n.scrollTop = t, !0;
1357
1353
  n.scrollTop = t - 1;
1358
- const s = n.scrollTop !== t;
1359
- return n.scrollTop = t, s;
1354
+ const r = n.scrollTop !== t;
1355
+ return n.scrollTop = t, r;
1360
1356
  } else {
1361
1357
  const t = n.scrollLeft;
1362
1358
  if (n.scrollLeft = t + 1, n.scrollLeft !== t)
1363
1359
  return n.scrollLeft = t, !0;
1364
1360
  n.scrollLeft = t - 1;
1365
- const s = n.scrollLeft !== t;
1366
- return n.scrollLeft = t, s;
1361
+ const r = n.scrollLeft !== t;
1362
+ return n.scrollLeft = t, r;
1367
1363
  }
1368
1364
  }
1369
- function Kt({ children: n, ref: e, ...t }) {
1370
- const { isActive: r, transitionName: s } = V(), [a, i] = ft();
1371
- Lt(e, () => a.current);
1372
- const u = $((c) => c.status), f = K.get(s), { decoratorName: l } = f, { initial: S, variants: h } = rt.get(l);
1373
- return j(() => {
1365
+ function re({ children: n, ref: e, ...t }) {
1366
+ const { isActive: s, transitionName: r } = z(), [a, o] = Et();
1367
+ Rt(e, () => a.current);
1368
+ const c = _((u) => u.status), h = J.get(r), { decoratorName: l } = h, { initial: m, variants: d } = ut.get(l);
1369
+ return Y(() => {
1374
1370
  if (!a.current) return;
1375
- const { value: c, options: L } = h[`${u}-${r}`];
1376
- i(a.current, c, L);
1377
- }, [u, r, i, h, a]), /* @__PURE__ */ M(
1378
- ht.div,
1371
+ const { value: u, options: T } = d[`${c}-${s}`];
1372
+ o(a.current, u, T);
1373
+ }, [c, s, o, d, a]), /* @__PURE__ */ N(
1374
+ X.div,
1379
1375
  {
1380
1376
  ref: a,
1381
- initial: S,
1377
+ initial: m,
1382
1378
  style: {
1383
1379
  position: "absolute",
1384
1380
  top: 0,
@@ -1392,125 +1388,123 @@ function Kt({ children: n, ref: e, ...t }) {
1392
1388
  }
1393
1389
  );
1394
1390
  }
1395
- const q = z((n) => ({
1391
+ const K = et((n) => ({
1396
1392
  dragStatus: "IDLE",
1397
1393
  replaceTransitionStatus: "IDLE",
1398
1394
  setDragStatus: (e) => n({ dragStatus: e }),
1399
1395
  setReplaceTransitionStatus: (e) => n({ replaceTransitionStatus: e })
1400
1396
  }));
1401
- function St({
1397
+ function vt({
1402
1398
  children: n,
1403
- ...e
1399
+ statusBarHeight: e,
1400
+ statusBarColor: t,
1401
+ systemNavigationBarHeight: s,
1402
+ systemNavigationBarColor: r,
1403
+ appBar: a,
1404
+ navigationBar: o,
1405
+ hideStatusBar: c,
1406
+ hideSystemNavigationBar: h,
1407
+ ...l
1404
1408
  }) {
1405
- const [t, r] = ft(), { id: s, isActive: a, isRoot: i, transitionName: u, prevTransitionName: f } = V(), l = It(), S = $((E) => E.status), h = q((E) => E.dragStatus), c = q.getState().setDragStatus, L = q.getState().setReplaceTransitionStatus, D = K.get(u), { variants: N, initial: w, swipeDirection: x, decoratorName: F } = D, A = rt.get(F), O = U(null), Y = U(null), X = U(null), o = U(!1), p = U(!1), g = U({
1409
+ const [m, d] = Et(), { id: u, isActive: T, isRoot: L, transitionName: x, prevTransitionName: P } = z(), C = bt(), $ = _((D) => D.status), R = K((D) => D.dragStatus), G = K.getState().setDragStatus, W = K.getState().setReplaceTransitionStatus, V = J.get(x), { variants: i, initial: y, swipeDirection: g, decoratorName: E } = V, f = ut.get(E), p = F(null), v = F(null), w = F(null), A = F(null), S = F(!1), M = F(!1), I = F({
1406
1410
  element: null,
1407
1411
  hasMarker: !1
1408
- }), m = U({ element: null, hasMarker: !1 }), y = U(0), d = U(0), I = async (E, v) => {
1409
- if (!x)
1412
+ }), k = F({ element: null, hasMarker: !1 }), H = F(0), Z = F(0), It = async (D, b) => {
1413
+ if (!g)
1410
1414
  return;
1411
- O.current = t.current?.previousSibling, X.current = t.current?.previousSibling?.querySelector("[data-decorator]");
1412
- const b = await D?.onSwipeStart(E, v, {
1413
- animate: r,
1414
- currentScreen: t.current,
1415
- prevScreen: O.current,
1416
- dragControls: l,
1417
- onStart: (Q) => A?.onSwipeStart?.(Q, {
1418
- animate: r,
1419
- currentDecorator: Y.current,
1420
- prevDecorator: X.current
1415
+ const O = p.current?.previousSibling;
1416
+ v.current = O?.querySelector("[data-screen]"), A.current = O?.querySelector("[data-decorator]");
1417
+ const q = await V?.onSwipeStart(D, b, {
1418
+ animate: d,
1419
+ currentScreen: m.current,
1420
+ prevScreen: v.current,
1421
+ dragControls: C,
1422
+ onStart: (rt) => f?.onSwipeStart?.(rt, {
1423
+ animate: d,
1424
+ currentDecorator: w.current,
1425
+ prevDecorator: A.current
1421
1426
  })
1422
1427
  });
1423
- c(b ? "PENDING" : "IDLE");
1424
- }, T = (E, v) => {
1425
- !x || h !== "PENDING" || D?.onSwipe(E, v, {
1426
- animate: r,
1427
- currentScreen: t.current,
1428
- prevScreen: O.current,
1429
- dragControls: l,
1430
- onProgress: (b, Q) => A?.onSwipe?.(b, Q, {
1431
- animate: r,
1432
- currentDecorator: Y.current,
1433
- prevDecorator: X.current
1428
+ G(q ? "PENDING" : "IDLE");
1429
+ }, Dt = (D, b) => {
1430
+ !g || R !== "PENDING" || V?.onSwipe(D, b, {
1431
+ animate: d,
1432
+ currentScreen: m.current,
1433
+ prevScreen: v.current,
1434
+ dragControls: C,
1435
+ onProgress: (O, q) => f?.onSwipe?.(O, q, {
1436
+ animate: d,
1437
+ currentDecorator: w.current,
1438
+ prevDecorator: A.current
1434
1439
  })
1435
1440
  });
1436
- }, R = async (E, v) => {
1437
- if (!x || h !== "PENDING")
1441
+ }, Lt = async (D, b) => {
1442
+ if (!g || R !== "PENDING")
1438
1443
  return;
1439
- await D?.onSwipeEnd(E, v, {
1440
- animate: r,
1441
- currentScreen: t.current,
1442
- prevScreen: O.current,
1443
- onStart: (Q) => A?.onSwipeEnd?.(Q, {
1444
- animate: r,
1445
- currentDecorator: Y.current,
1446
- prevDecorator: X.current
1444
+ await V?.onSwipeEnd(D, b, {
1445
+ animate: d,
1446
+ currentScreen: m.current,
1447
+ prevScreen: v.current,
1448
+ onStart: (q) => f?.onSwipeEnd?.(q, {
1449
+ animate: d,
1450
+ currentDecorator: w.current,
1451
+ prevDecorator: A.current
1447
1452
  })
1448
- }) ? window.history.back() : c("IDLE");
1449
- }, P = (E) => {
1450
- if (!(!i && a && S === "COMPLETED" && h === "IDLE" && !!x))
1453
+ }) ? window.history.back() : G("IDLE");
1454
+ }, Nt = (D) => {
1455
+ if (!(!L && T && $ === "COMPLETED" && R === "IDLE" && !!g))
1451
1456
  return;
1452
- g.current = ut(E.target, {
1457
+ I.current = ht(D.target, {
1453
1458
  direction: "x",
1454
1459
  verifyByScroll: !0
1455
- }), m.current = ut(E.target, {
1460
+ }), k.current = ht(D.target, {
1456
1461
  direction: "y",
1457
1462
  verifyByScroll: !0
1458
- }), y.current = E.clientX, d.current = E.clientY, (!g.current.element && !m.current.element || g.current.element || m.current.element) && (o.current = !0);
1459
- }, C = (E) => {
1460
- const v = !g.current.element && !m.current.element;
1461
- if (o.current && v)
1462
- o.current = !1, p.current = !0, l.start(E);
1463
- else if (o.current && !v) {
1464
- const b = E.clientX - y.current, Q = E.clientY - d.current, wt = m.current.element && m.current.element.scrollTop <= 0 && m.current.hasMarker, Pt = g.current.element && g.current.element.scrollLeft <= 0 && g.current.hasMarker;
1465
- (x === "y" && (wt || g.current.element) && Q > 0 && Math.abs(b) < 4 || x === "x" && (Pt || m.current.element) && b > 0 && Math.abs(Q) < 4) && (o.current = !1, p.current = !0, l.start(E));
1463
+ }), H.current = D.clientX, Z.current = D.clientY, (!I.current.element && !k.current.element || I.current.element || k.current.element) && (S.current = !0);
1464
+ }, xt = (D) => {
1465
+ const b = !I.current.element && !k.current.element;
1466
+ if (S.current && b)
1467
+ S.current = !1, M.current = !0, C.start(D);
1468
+ else if (S.current && !b) {
1469
+ const O = D.clientX - H.current, q = D.clientY - Z.current, rt = k.current.element && k.current.element.scrollTop <= 0 && k.current.hasMarker, Mt = I.current.element && I.current.element.scrollLeft <= 0 && I.current.hasMarker;
1470
+ (g === "y" && (rt || I.current.element) && q > 0 && Math.abs(O) < 4 || g === "x" && (Mt || k.current.element) && O > 0 && Math.abs(q) < 4) && (S.current = !1, M.current = !0, C.start(D));
1466
1471
  }
1467
- }, k = () => {
1468
- o.current = !1, p.current = !1;
1472
+ }, kt = () => {
1473
+ S.current = !1, M.current = !1;
1469
1474
  };
1470
- return j(() => {
1471
- const E = t.current;
1472
- if (!E) return;
1473
- const v = (b) => {
1474
- p.current && b.preventDefault(), b.target?.dataset.swipeAtEdgeBar === "true" && b.preventDefault();
1475
+ return Y(() => {
1476
+ const D = m.current;
1477
+ if (!D) return;
1478
+ const b = (O) => {
1479
+ M.current && O.preventDefault(), O.target?.dataset.swipeAtEdgeBar === "true" && O.preventDefault();
1475
1480
  };
1476
- return E.addEventListener("touchmove", v, {
1481
+ return D.addEventListener("touchmove", b, {
1477
1482
  passive: !1
1478
1483
  }), () => {
1479
- E.removeEventListener("touchmove", v);
1484
+ D.removeEventListener("touchmove", b);
1480
1485
  };
1481
- }, [t]), j(() => {
1482
- t.current && (async () => {
1483
- const { value: E, options: v } = N[`${S}-${a}`];
1484
- !a && S === "REPLACING" && f !== u && (L("PENDING"), await r(t.current, jt, {
1486
+ }, [m]), Y(() => {
1487
+ m.current && (async () => {
1488
+ const { value: D, options: b } = i[`${$}-${T}`];
1489
+ !T && $ === "REPLACING" && P !== x && (W("PENDING"), await d(m.current, Zt, {
1485
1490
  duration: 0.1
1486
- })), a && S === "COMPLETED" && (c("IDLE"), L("IDLE")), await r(t.current, E, v), await _.resolveTask(s);
1491
+ })), T && $ === "COMPLETED" && (G("IDLE"), W("IDLE")), await d(m.current, D, b), await Q.resolveTask(u);
1487
1492
  })();
1488
1493
  }, [
1489
- S,
1490
- a,
1491
- s,
1492
- f,
1494
+ $,
1495
+ T,
1493
1496
  u,
1494
- r,
1495
- t,
1496
- N,
1497
- c,
1498
- L
1499
- ]), /* @__PURE__ */ dt(
1500
- ht.div,
1497
+ P,
1498
+ x,
1499
+ d,
1500
+ m,
1501
+ i,
1502
+ G,
1503
+ W
1504
+ ]), /* @__PURE__ */ gt(
1505
+ X.div,
1501
1506
  {
1502
- ref: t,
1503
- ...e,
1504
- initial: w,
1505
- drag: x,
1506
- dragListener: !1,
1507
- dragControls: l,
1508
- onDragStart: I,
1509
- onDrag: T,
1510
- onDragEnd: R,
1511
- onPointerDown: P,
1512
- onPointerMove: C,
1513
- onPointerUp: k,
1507
+ ref: p,
1514
1508
  style: {
1515
1509
  position: "absolute",
1516
1510
  top: 0,
@@ -1518,17 +1512,10 @@ function St({
1518
1512
  width: "100%",
1519
1513
  height: "100%",
1520
1514
  display: "flex",
1521
- flexDirection: "column",
1522
- backgroundColor: "white",
1523
- boxSizing: "border-box",
1524
- touchAction: "none",
1525
- isolation: "isolate",
1526
- contain: "strict",
1527
- overscrollBehavior: "contain",
1528
- ...e.style
1515
+ flexDirection: "column"
1529
1516
  },
1530
1517
  children: [
1531
- /* @__PURE__ */ M(
1518
+ /* @__PURE__ */ N(
1532
1519
  "div",
1533
1520
  {
1534
1521
  "data-swipe-at-edge-bar": !0,
@@ -1542,21 +1529,64 @@ function St({
1542
1529
  }
1543
1530
  }
1544
1531
  ),
1545
- /* @__PURE__ */ M(
1546
- "div",
1532
+ !c && e && /* @__PURE__ */ N(
1533
+ X.div,
1547
1534
  {
1535
+ animate: {
1536
+ backgroundColor: t
1537
+ },
1548
1538
  style: {
1549
- position: "absolute",
1550
- top: 0,
1551
- left: 0,
1552
1539
  width: "100%",
1553
- height: "100%"
1540
+ minHeight: e
1541
+ }
1542
+ }
1543
+ ),
1544
+ a && /* @__PURE__ */ N(X.div, { children: a }),
1545
+ /* @__PURE__ */ N(
1546
+ X.div,
1547
+ {
1548
+ ref: m,
1549
+ ...l,
1550
+ initial: y,
1551
+ drag: g,
1552
+ dragListener: !1,
1553
+ dragControls: C,
1554
+ onDragStart: It,
1555
+ onDrag: Dt,
1556
+ onDragEnd: Lt,
1557
+ onPointerDown: Nt,
1558
+ onPointerMove: xt,
1559
+ onPointerUp: kt,
1560
+ "data-screen": !0,
1561
+ style: {
1562
+ flexGrow: 1,
1563
+ backgroundColor: "white",
1564
+ boxSizing: "border-box",
1565
+ isolation: "isolate",
1566
+ contain: "strict",
1567
+ overscrollBehavior: "contain",
1568
+ overflowY: "auto",
1569
+ touchAction: "none",
1570
+ ...l.style
1554
1571
  },
1555
1572
  children: n
1556
1573
  }
1557
1574
  ),
1558
- A && /* @__PURE__ */ M(Kt, { ref: Y }),
1559
- /* @__PURE__ */ M(
1575
+ o && /* @__PURE__ */ N(X.div, { children: o }),
1576
+ !h && s && /* @__PURE__ */ N(
1577
+ X.div,
1578
+ {
1579
+ animate: {
1580
+ backgroundColor: r
1581
+ },
1582
+ style: {
1583
+ width: "100%",
1584
+ minHeight: s
1585
+ }
1586
+ }
1587
+ ),
1588
+ f && /* @__PURE__ */ N(re, { ref: w }),
1589
+ /* @__PURE__ */ N(
1560
1590
  "div",
1561
1591
  {
1562
1592
  "data-swipe-at-edge-bar": !0,
@@ -1574,53 +1604,47 @@ function St({
1574
1604
  }
1575
1605
  );
1576
1606
  }
1577
- function ae({
1578
- children: n,
1579
- ...e
1580
- }) {
1581
- const { isActive: t, isPrev: r, zIndex: s } = V(), a = H((h) => h.index), i = $((h) => h.status), u = q((h) => h.dragStatus), f = q((h) => h.replaceTransitionStatus), S = !t && (i === "COMPLETED" && u === "IDLE") || r && a - 2 <= s && f === "IDLE" || r && a - 2 > s;
1582
- return /* @__PURE__ */ M(Et, { freeze: S, children: /* @__PURE__ */ M(St, { ...e, children: n }) });
1607
+ function he({ children: n, ...e }) {
1608
+ const { isActive: t, isPrev: s, zIndex: r } = z(), a = j((d) => d.index), o = _((d) => d.status), c = K((d) => d.dragStatus), h = K((d) => d.replaceTransitionStatus), m = !t && (o === "COMPLETED" && c === "IDLE") || s && a - 2 <= r && h === "IDLE" || s && a - 2 > r;
1609
+ return /* @__PURE__ */ N(Tt, { freeze: m, children: /* @__PURE__ */ N(vt, { ...e, children: n }) });
1583
1610
  }
1584
- function oe({
1585
- children: n,
1586
- ...e
1587
- }) {
1588
- const { isActive: t, isPrev: r, zIndex: s } = V(), a = H((h) => h.index), i = $((h) => h.status), u = q((h) => h.dragStatus), f = q((h) => h.replaceTransitionStatus), S = !t && (i === "COMPLETED" && u === "IDLE") || r && a - 2 <= s && f === "IDLE" || r && a - 2 > s;
1589
- return /* @__PURE__ */ M(Et, { freeze: S, children: /* @__PURE__ */ M(
1590
- St,
1611
+ function ye({ children: n, ...e }) {
1612
+ const { isActive: t, isPrev: s, zIndex: r } = z(), a = j((d) => d.index), o = _((d) => d.status), c = K((d) => d.dragStatus), h = K((d) => d.replaceTransitionStatus), m = !t && (o === "COMPLETED" && c === "IDLE") || s && a - 2 <= r && h === "IDLE" || s && a - 2 > r;
1613
+ return /* @__PURE__ */ N(Tt, { freeze: m, children: /* @__PURE__ */ N(
1614
+ vt,
1591
1615
  {
1592
1616
  ...e,
1593
1617
  style: {
1594
1618
  backgroundColor: "transparent",
1595
1619
  ...e.style
1596
1620
  },
1597
- children: /* @__PURE__ */ M(vt, { children: n })
1621
+ children: /* @__PURE__ */ N(Ot, { children: n })
1598
1622
  }
1599
1623
  ) });
1600
1624
  }
1601
- function ie({ children: n, ...e }) {
1602
- const { isActive: t, transitionName: r } = V(), s = $((i) => i.status), a = K.get(r);
1603
- return /* @__PURE__ */ M(
1604
- Nt,
1625
+ function ge({ children: n, ...e }) {
1626
+ const { isActive: t, transitionName: s } = z(), r = _((o) => o.status), a = J.get(s);
1627
+ return /* @__PURE__ */ N(
1628
+ Gt,
1605
1629
  {
1606
- transition: a?.variants[`${s}-${t}`]?.options,
1630
+ transition: a?.variants[`${r}-${t}`]?.options,
1607
1631
  ...e,
1608
1632
  children: n
1609
1633
  }
1610
1634
  );
1611
1635
  }
1612
1636
  export {
1613
- ie as LayoutConfig,
1614
- oe as LayoutScreen,
1615
- Zt as Route,
1616
- Jt as Router,
1617
- ae as Screen,
1618
- Ut as createDecorator,
1619
- re as createRawDecorator,
1620
- se as createRawTransition,
1621
- J as createTransition,
1622
- te as useNavigate,
1623
- ne as useParams,
1624
- V as useScreen,
1625
- ee as useStep
1637
+ ge as LayoutConfig,
1638
+ ye as LayoutScreen,
1639
+ ce as Route,
1640
+ ie as Router,
1641
+ he as Screen,
1642
+ Xt as createDecorator,
1643
+ fe as createRawDecorator,
1644
+ pe as createRawTransition,
1645
+ nt as createTransition,
1646
+ ue as useNavigate,
1647
+ de as useParams,
1648
+ z as useScreen,
1649
+ le as useStep
1626
1650
  };