@flemo/react 1.2.0 → 1.3.1

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,1285 +1,1202 @@
1
- import { jsx as k, jsxs as Bt, Fragment as ye } from "react/jsx-runtime";
2
- import xt, { useEffect as wt, createContext as _t, useContext as jt, useReducer as we, Children as oe, useInsertionEffect as ge, useRef as N, useImperativeHandle as Se, useState as bt, useLayoutEffect as mt } from "react";
3
- import { consumeSelfInducedPop as ve, TaskManger as V, useNavigateStore as J, useHistoryStore as G, getMatchedPathPattern as Ee, transitionMap as ut, decoratorMap as yt, isServer as Ut, compileTransitionStyles as Te, useTransitionStore as Yt, getParams as Pe, markSelfInducedPop as Ft, targetToDecls as xe, easingToCss as be, variantHasAnimation as Ie, animationName as Re, findScrollable as Jt, collectAnimatedProperties as De } from "@flemo/core";
4
- import { createDecorator as rn, createRawDecorator as on, createRawTransition as sn, createTransition as an } from "@flemo/core";
5
- function Le() {
6
- return wt(() => {
7
- const n = async (e) => {
8
- if (ve())
9
- return;
10
- const r = e.state?.id, c = V.generateTaskId();
11
- (await V.addTask(
12
- async (a) => {
13
- const i = e.state?.index, s = e.state?.status, w = e.state?.params, T = e.state?.transitionName, p = e.state?.layoutId, { setStatus: P, setTransitionTaskId: f } = J.getState(), { index: L, addHistory: R, popHistory: A } = G.getState(), b = i < L, U = s === "PUSHING" && i > L, M = s === "REPLACING" && i > L, $ = window.location.pathname;
14
- if (!b && !U && !M) {
15
- a.abort();
16
- return;
17
- }
18
- return f(c), b ? P("POPPING") : U ? (P("PUSHING"), R({
19
- id: r,
20
- pathname: $,
21
- params: w,
22
- transitionName: T,
23
- layoutId: p
24
- })) : M && (P("REPLACING"), R({
25
- id: r,
26
- pathname: $,
27
- params: w,
28
- transitionName: T,
29
- layoutId: p
30
- })), async () => {
31
- b && A(i + 1), P("COMPLETED");
32
- };
33
- },
34
- {
35
- id: c,
36
- control: {
37
- manual: !0
38
- }
39
- }
40
- )).result?.();
41
- };
42
- return window.addEventListener("popstate", n), () => {
43
- window.removeEventListener("popstate", n);
44
- };
45
- }, []), null;
1
+ import e, { Children as t, createContext as n, useContext as r, useEffect as i, useImperativeHandle as a, useInsertionEffect as o, useLayoutEffect as s, useReducer as c, useRef as l, useState as u } from "react";
2
+ import { TaskManger as d, animationName as f, collectAnimatedProperties as p, compileTransitionStyles as m, consumeSelfInducedPop as h, createDecorator as g, createHistoryStore as _, createNavigateStore as v, createRawDecorator as ee, createRawTransition as te, createTransition as y, createTransitionStore as b, decoratorMap as ne, easingToCss as re, findScrollable as ie, getMatchedPathPattern as ae, getParams as x, isServer as oe, markSelfInducedPop as S, targetToDecls as C, transitionMap as w, variantHasAnimation as se } from "@flemo/core";
3
+ import { jsx as T, jsxs as ce } from "react/jsx-runtime";
4
+ //#region \0rolldown/runtime.js
5
+ var le = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), E = n(null);
6
+ //#endregion
7
+ //#region src/stores/useStores.ts
8
+ function D() {
9
+ let e = r(E);
10
+ if (!e) throw Error("flemo stores are missing. Render inside a <Router>.");
11
+ return e;
46
12
  }
47
- var F = {}, Qt;
48
- function Ne() {
49
- if (Qt) return F;
50
- Qt = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.PathError = F.TokenData = void 0, F.parse = p, F.compile = P, F.match = R, F.pathToRegexp = A, F.stringify = X;
51
- const n = "/", e = (o) => o, r = /^[$_\p{ID_Start}]$/u, c = /^[$\u200c\u200d\p{ID_Continue}]$/u, a = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
52
- function i(o) {
53
- return o.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
54
- }
55
- function s(o) {
56
- return o.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
57
- }
58
- class w {
59
- constructor(u, y) {
60
- this.tokens = u, this.originalPath = y;
61
- }
62
- }
63
- F.TokenData = w;
64
- class T extends TypeError {
65
- constructor(u, y) {
66
- let l = u;
67
- y && (l += `: ${y}`), l += "; visit https://git.new/pathToRegexpError for info", super(l), this.originalPath = y;
68
- }
69
- }
70
- F.PathError = T;
71
- function p(o, u = {}) {
72
- const { encodePath: y = e } = u, l = [...o];
73
- let d = 0;
74
- function g(m) {
75
- const x = [];
76
- let S = "";
77
- function D() {
78
- S && (x.push({
79
- type: "text",
80
- value: y(S)
81
- }), S = "");
82
- }
83
- for (; d < l.length; ) {
84
- const I = l[d++];
85
- if (I === m)
86
- return D(), x;
87
- if (I === "\\") {
88
- if (d === l.length)
89
- throw new T(`Unexpected end after \\ at index ${d}`, o);
90
- S += l[d++];
91
- continue;
92
- }
93
- if (I === ":" || I === "*") {
94
- const Y = I === ":" ? "param" : "wildcard";
95
- let v = "";
96
- if (r.test(l[d]))
97
- do
98
- v += l[d++];
99
- while (c.test(l[d]));
100
- else if (l[d] === '"') {
101
- let B = d;
102
- for (; d < l.length; ) {
103
- if (l[++d] === '"') {
104
- d++, B = 0;
105
- break;
106
- }
107
- l[d] === "\\" && d++, v += l[d];
108
- }
109
- if (B)
110
- throw new T(`Unterminated quote at index ${B}`, o);
111
- }
112
- if (!v)
113
- throw new T(`Missing parameter name at index ${d}`, o);
114
- D(), x.push({ type: Y, name: v });
115
- continue;
116
- }
117
- if (I === "{") {
118
- D(), x.push({
119
- type: "group",
120
- tokens: g("}")
121
- });
122
- continue;
123
- }
124
- if (I === "}" || I === "(" || I === ")" || I === "[" || I === "]" || I === "+" || I === "?" || I === "!")
125
- throw new T(`Unexpected ${I} at index ${d - 1}`, o);
126
- S += I;
127
- }
128
- if (m)
129
- throw new T(`Unexpected end at index ${d}, expected ${m}`, o);
130
- return D(), x;
131
- }
132
- return new w(g(""), o);
133
- }
134
- function P(o, u = {}) {
135
- const { encode: y = encodeURIComponent, delimiter: l = n } = u, d = typeof o == "object" ? o : p(o, u), g = f(d.tokens, l, y);
136
- return function(x = {}) {
137
- const S = [], D = g(x, S);
138
- if (S.length)
139
- throw new TypeError(`Missing parameters: ${S.join(", ")}`);
140
- return D;
141
- };
142
- }
143
- function f(o, u, y) {
144
- const l = o.map((d) => L(d, u, y));
145
- return (d, g) => {
146
- let m = "";
147
- for (const x of l)
148
- m += x(d, g);
149
- return m;
150
- };
151
- }
152
- function L(o, u, y) {
153
- if (o.type === "text")
154
- return () => o.value;
155
- if (o.type === "group") {
156
- const d = f(o.tokens, u, y);
157
- return (g, m) => {
158
- const x = m.length, S = d(g, m);
159
- return m.length === x ? S : (m.length = x, "");
160
- };
161
- }
162
- const l = y || e;
163
- return o.type === "wildcard" && y !== !1 ? (d, g) => {
164
- const m = d[o.name];
165
- if (m == null)
166
- return g.push(o.name), "";
167
- if (!Array.isArray(m) || m.length === 0)
168
- throw new TypeError(`Expected "${o.name}" to be a non-empty array`);
169
- let x = "";
170
- for (let S = 0; S < m.length; S++) {
171
- if (typeof m[S] != "string")
172
- throw new TypeError(`Expected "${o.name}/${S}" to be a string`);
173
- S > 0 && (x += u), x += l(m[S]);
174
- }
175
- return x;
176
- } : (d, g) => {
177
- const m = d[o.name];
178
- if (m == null)
179
- return g.push(o.name), "";
180
- if (typeof m != "string")
181
- throw new TypeError(`Expected "${o.name}" to be a string`);
182
- return l(m);
183
- };
184
- }
185
- function R(o, u = {}) {
186
- const { decode: y = decodeURIComponent, delimiter: l = n } = u, { regexp: d, keys: g } = A(o, u), m = g.map((x) => y === !1 ? e : x.type === "param" ? y : (S) => S.split(l).map(y));
187
- return function(S) {
188
- const D = d.exec(S);
189
- if (!D)
190
- return !1;
191
- const I = D[0], Y = /* @__PURE__ */ Object.create(null);
192
- for (let v = 1; v < D.length; v++) {
193
- if (D[v] === void 0)
194
- continue;
195
- const B = g[v - 1], j = m[v - 1];
196
- Y[B.name] = j(D[v]);
197
- }
198
- return { path: I, params: Y };
199
- };
200
- }
201
- function A(o, u = {}) {
202
- const { delimiter: y = n, end: l = !0, sensitive: d = !1, trailing: g = !0 } = u, m = [];
203
- let x = "", S = 0;
204
- function D(Y) {
205
- if (Array.isArray(Y)) {
206
- for (const B of Y)
207
- D(B);
208
- return;
209
- }
210
- const v = typeof Y == "object" ? Y : p(Y, u);
211
- b(v.tokens, 0, [], (B) => {
212
- if (S >= 256)
213
- throw new T("Too many path combinations", v.originalPath);
214
- S > 0 && (x += "|"), x += U(B, y, m, v.originalPath), S++;
215
- });
216
- }
217
- D(o);
218
- let I = `^(?:${x})`;
219
- return g && (I += "(?:" + s(y) + "$)?"), I += l ? "$" : "(?=" + s(y) + "|$)", { regexp: new RegExp(I, d ? "" : "i"), keys: m };
220
- }
221
- function b(o, u, y, l) {
222
- for (; u < o.length; ) {
223
- const d = o[u++];
224
- if (d.type === "group") {
225
- const g = y.length;
226
- b(d.tokens, 0, y, (m) => b(o, u, m, l)), y.length = g;
227
- continue;
228
- }
229
- y.push(d);
230
- }
231
- l(y);
232
- }
233
- function U(o, u, y, l) {
234
- let d = "", g = "", m = "", x = 0, S = 0, D = 0;
235
- function I(v, B) {
236
- for (; v < o.length; ) {
237
- const j = o[v++];
238
- if (j.type === B)
239
- return !0;
240
- if (j.type === "text" && j.value.includes(u))
241
- break;
242
- }
243
- return !1;
244
- }
245
- function Y(v) {
246
- let B = "";
247
- for (; v < o.length; ) {
248
- const j = o[v++];
249
- if (j.type !== "text")
250
- break;
251
- B += j.value;
252
- }
253
- return B;
254
- }
255
- for (; D < o.length; ) {
256
- const v = o[D++];
257
- if (v.type === "text") {
258
- d += s(v.value), g += v.value, x === 2 && (m += v.value), v.value.includes(u) && (S = 0);
259
- continue;
260
- }
261
- if (v.type === "param" || v.type === "wildcard") {
262
- if (x && !g)
263
- throw new T(`Missing text before "${v.name}" ${v.type}`, l);
264
- v.type === "param" ? (d += S & 2 ? `(${M(u, g)}+)` : I(D, "wildcard") ? `(${M(u, Y(D))}+)` : S & 1 ? `(${M(u, g)}+|${s(g)})` : `(${M(u, "")}+)`, S |= x = 1) : (d += S & 2 ? `(${M(g, "")}+)` : m ? `(${M(m, "")}+|${M(u, "")}+)` : "([^]+)", m = "", S |= x = 2), y.push(v), g = "";
265
- continue;
266
- }
267
- throw new TypeError(`Unknown token type: ${v.type}`);
268
- }
269
- return d;
270
- }
271
- function M(o, u) {
272
- return u.length > o.length ? M(u, o) : (o === u && (u = ""), u.length > 1 ? `(?:(?!${s(o)}|${s(u)})[^])` : o.length > 1 ? `(?:(?!${s(o)})[^${s(u)}])` : `[^${s(o + u)}]`);
273
- }
274
- function $(o, u) {
275
- let y = "";
276
- for (; u < o.length; ) {
277
- const l = o[u++];
278
- if (l.type === "text") {
279
- y += i(l.value);
280
- continue;
281
- }
282
- if (l.type === "group") {
283
- y += "{" + $(l.tokens, 0) + "}";
284
- continue;
285
- }
286
- if (l.type === "param") {
287
- y += ":" + O(l.name, o[u]);
288
- continue;
289
- }
290
- if (l.type === "wildcard") {
291
- y += "*" + O(l.name, o[u]);
292
- continue;
293
- }
294
- throw new TypeError(`Unknown token type: ${l.type}`);
295
- }
296
- return y;
297
- }
298
- function X(o) {
299
- return $(o.tokens, 0);
300
- }
301
- function O(o, u) {
302
- return !a.test(o) || u?.type === "text" && c.test(u.value[0]) ? JSON.stringify(o) : o;
303
- }
304
- return F;
13
+ //#endregion
14
+ //#region src/history/HistoryListener.tsx
15
+ function ue() {
16
+ let e = D();
17
+ return i(() => {
18
+ let t = async (t) => {
19
+ if (h()) return;
20
+ let n = t.state?.id, r = d.generateTaskId();
21
+ (await d.addTask(async (i) => {
22
+ let a = t.state?.index, o = t.state?.status, s = t.state?.params, c = t.state?.transitionName, l = t.state?.layoutId, { setStatus: u, setTransitionTaskId: d } = e.navigate.getState(), { index: f, addHistory: p, popHistory: m } = e.history.getState(), h = a < f, g = o === "PUSHING" && a > f, _ = o === "REPLACING" && a > f, v = window.location.pathname;
23
+ if (!h && !g && !_) {
24
+ i.abort();
25
+ return;
26
+ }
27
+ return d(r), h ? u("POPPING") : g ? (u("PUSHING"), p({
28
+ id: n,
29
+ pathname: v,
30
+ params: s,
31
+ transitionName: c,
32
+ layoutId: l
33
+ })) : _ && (u("REPLACING"), p({
34
+ id: n,
35
+ pathname: v,
36
+ params: s,
37
+ transitionName: c,
38
+ layoutId: l
39
+ })), async () => {
40
+ h && m(a + 1), u("COMPLETED");
41
+ };
42
+ }, {
43
+ id: r,
44
+ control: { manual: !0 }
45
+ })).result?.();
46
+ };
47
+ return window.addEventListener("popstate", t), () => {
48
+ window.removeEventListener("popstate", t);
49
+ };
50
+ }, [e]), null;
305
51
  }
306
- var It = Ne();
307
- const ie = _t({
308
- id: "",
309
- isActive: !1,
310
- isRoot: !0,
311
- isPrev: !1,
312
- zIndex: 0,
313
- pathname: "",
314
- params: {},
315
- transitionName: "none",
316
- prevTransitionName: "none",
317
- layoutId: null,
318
- routePath: ""
52
+ //#endregion
53
+ //#region src/screen/ScreenContext.ts
54
+ var O = (/* @__PURE__ */ le(((e) => {
55
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.PathError = e.TokenData = void 0, e.parse = c, e.compile = l, e.pathToRegexp = f;
56
+ var t = "/", n = (e) => e, r = /^[$_\p{ID_Start}]$/u, i = /^[$\u200c\u200d\p{ID_Continue}]$/u;
57
+ function a(e) {
58
+ return e.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
59
+ }
60
+ var o = class {
61
+ constructor(e, t) {
62
+ this.tokens = e, this.originalPath = t;
63
+ }
64
+ };
65
+ e.TokenData = o;
66
+ var s = class extends TypeError {
67
+ constructor(e, t) {
68
+ let n = e;
69
+ t && (n += `: ${t}`), n += "; visit https://git.new/pathToRegexpError for info", super(n), this.originalPath = t;
70
+ }
71
+ };
72
+ e.PathError = s;
73
+ function c(e, t = {}) {
74
+ let { encodePath: a = n } = t, c = [...e], l = 0;
75
+ function u(t) {
76
+ let n = [], o = "";
77
+ function d() {
78
+ o &&= (n.push({
79
+ type: "text",
80
+ value: a(o)
81
+ }), "");
82
+ }
83
+ for (; l < c.length;) {
84
+ let a = c[l++];
85
+ if (a === t) return d(), n;
86
+ if (a === "\\") {
87
+ if (l === c.length) throw new s(`Unexpected end after \\ at index ${l}`, e);
88
+ o += c[l++];
89
+ continue;
90
+ }
91
+ if (a === ":" || a === "*") {
92
+ let t = a === ":" ? "param" : "wildcard", o = "";
93
+ if (r.test(c[l])) do
94
+ o += c[l++];
95
+ while (i.test(c[l]));
96
+ else if (c[l] === "\"") {
97
+ let t = l;
98
+ for (; l < c.length;) {
99
+ if (c[++l] === "\"") {
100
+ l++, t = 0;
101
+ break;
102
+ }
103
+ c[l] === "\\" && l++, o += c[l];
104
+ }
105
+ if (t) throw new s(`Unterminated quote at index ${t}`, e);
106
+ }
107
+ if (!o) throw new s(`Missing parameter name at index ${l}`, e);
108
+ d(), n.push({
109
+ type: t,
110
+ name: o
111
+ });
112
+ continue;
113
+ }
114
+ if (a === "{") {
115
+ d(), n.push({
116
+ type: "group",
117
+ tokens: u("}")
118
+ });
119
+ continue;
120
+ }
121
+ if (a === "}" || a === "(" || a === ")" || a === "[" || a === "]" || a === "+" || a === "?" || a === "!") throw new s(`Unexpected ${a} at index ${l - 1}`, e);
122
+ o += a;
123
+ }
124
+ if (t) throw new s(`Unexpected end at index ${l}, expected ${t}`, e);
125
+ return d(), n;
126
+ }
127
+ return new o(u(""), e);
128
+ }
129
+ function l(e, n = {}) {
130
+ let { encode: r = encodeURIComponent, delimiter: i = t } = n, a = u((typeof e == "object" ? e : c(e, n)).tokens, i, r);
131
+ return function(e = {}) {
132
+ let t = [], n = a(e, t);
133
+ if (t.length) throw TypeError(`Missing parameters: ${t.join(", ")}`);
134
+ return n;
135
+ };
136
+ }
137
+ function u(e, t, n) {
138
+ let r = e.map((e) => d(e, t, n));
139
+ return (e, t) => {
140
+ let n = "";
141
+ for (let i of r) n += i(e, t);
142
+ return n;
143
+ };
144
+ }
145
+ function d(e, t, r) {
146
+ if (e.type === "text") return () => e.value;
147
+ if (e.type === "group") {
148
+ let n = u(e.tokens, t, r);
149
+ return (e, t) => {
150
+ let r = t.length, i = n(e, t);
151
+ return t.length === r ? i : (t.length = r, "");
152
+ };
153
+ }
154
+ let i = r || n;
155
+ return e.type === "wildcard" && r !== !1 ? (n, r) => {
156
+ let a = n[e.name];
157
+ if (a == null) return r.push(e.name), "";
158
+ if (!Array.isArray(a) || a.length === 0) throw TypeError(`Expected "${e.name}" to be a non-empty array`);
159
+ let o = "";
160
+ for (let n = 0; n < a.length; n++) {
161
+ if (typeof a[n] != "string") throw TypeError(`Expected "${e.name}/${n}" to be a string`);
162
+ n > 0 && (o += t), o += i(a[n]);
163
+ }
164
+ return o;
165
+ } : (t, n) => {
166
+ let r = t[e.name];
167
+ if (r == null) return n.push(e.name), "";
168
+ if (typeof r != "string") throw TypeError(`Expected "${e.name}" to be a string`);
169
+ return i(r);
170
+ };
171
+ }
172
+ function f(e, n = {}) {
173
+ let { delimiter: r = t, end: i = !0, sensitive: o = !1, trailing: l = !0 } = n, u = [], d = "", f = 0;
174
+ function h(e) {
175
+ if (Array.isArray(e)) {
176
+ for (let t of e) h(t);
177
+ return;
178
+ }
179
+ let t = typeof e == "object" ? e : c(e, n);
180
+ p(t.tokens, 0, [], (e) => {
181
+ if (f >= 256) throw new s("Too many path combinations", t.originalPath);
182
+ f > 0 && (d += "|"), d += m(e, r, u, t.originalPath), f++;
183
+ });
184
+ }
185
+ h(e);
186
+ let g = `^(?:${d})`;
187
+ return l && (g += "(?:" + a(r) + "$)?"), g += i ? "$" : "(?=" + a(r) + "|$)", {
188
+ regexp: new RegExp(g, o ? "" : "i"),
189
+ keys: u
190
+ };
191
+ }
192
+ function p(e, t, n, r) {
193
+ for (; t < e.length;) {
194
+ let i = e[t++];
195
+ if (i.type === "group") {
196
+ let a = n.length;
197
+ p(i.tokens, 0, n, (n) => p(e, t, n, r)), n.length = a;
198
+ continue;
199
+ }
200
+ n.push(i);
201
+ }
202
+ r(n);
203
+ }
204
+ function m(e, t, n, r) {
205
+ let i = "", o = "", c = "", l = 0, u = 0, d = 0;
206
+ function f(n, r) {
207
+ for (; n < e.length;) {
208
+ let i = e[n++];
209
+ if (i.type === r) return !0;
210
+ if (i.type === "text" && i.value.includes(t)) break;
211
+ }
212
+ return !1;
213
+ }
214
+ function p(t) {
215
+ let n = "";
216
+ for (; t < e.length;) {
217
+ let r = e[t++];
218
+ if (r.type !== "text") break;
219
+ n += r.value;
220
+ }
221
+ return n;
222
+ }
223
+ for (; d < e.length;) {
224
+ let m = e[d++];
225
+ if (m.type === "text") {
226
+ i += a(m.value), o += m.value, l === 2 && (c += m.value), m.value.includes(t) && (u = 0);
227
+ continue;
228
+ }
229
+ if (m.type === "param" || m.type === "wildcard") {
230
+ if (l && !o) throw new s(`Missing text before "${m.name}" ${m.type}`, r);
231
+ m.type === "param" ? (i += u & 2 ? `(${h(t, o)}+)` : f(d, "wildcard") ? `(${h(t, p(d))}+)` : u & 1 ? `(${h(t, o)}+|${a(o)})` : `(${h(t, "")}+)`, u |= l = 1) : (i += u & 2 ? `(${h(o, "")}+)` : c ? `(${h(c, "")}+|${h(t, "")}+)` : "([^]+)", c = "", u |= l = 2), n.push(m), o = "";
232
+ continue;
233
+ }
234
+ throw TypeError(`Unknown token type: ${m.type}`);
235
+ }
236
+ return i;
237
+ }
238
+ function h(e, t) {
239
+ return t.length > e.length ? h(t, e) : (e === t && (t = ""), t.length > 1 ? `(?:(?!${a(e)}|${a(t)})[^])` : e.length > 1 ? `(?:(?!${a(e)})[^${a(t)}])` : `[^${a(e + t)}]`);
240
+ }
241
+ })))(), k = n({
242
+ id: "",
243
+ isActive: !1,
244
+ isRoot: !0,
245
+ isPrev: !1,
246
+ zIndex: 0,
247
+ pathname: "",
248
+ params: {},
249
+ transitionName: "none",
250
+ prevTransitionName: "none",
251
+ layoutId: null,
252
+ routePath: ""
319
253
  });
320
- function gt() {
321
- return jt(ie);
254
+ //#endregion
255
+ //#region src/screen/useScreen.ts
256
+ function A() {
257
+ return r(k);
322
258
  }
323
- const se = _t({}), ae = _t(() => {
324
- });
325
- function ke(n, e) {
326
- return e.type === "SET" ? e.params : n;
259
+ //#endregion
260
+ //#region src/screen/ParamsProvider/ParamsContext.ts
261
+ var j = n({}), M = n(() => {});
262
+ //#endregion
263
+ //#region src/screen/ParamsProvider/ParamsReducer.ts
264
+ function de(e, t) {
265
+ switch (t.type) {
266
+ case "SET": return t.params;
267
+ default: return e;
268
+ }
269
+ }
270
+ //#endregion
271
+ //#region src/screen/ParamsProvider/ParamsProvider.tsx
272
+ function fe({ children: e }) {
273
+ let { isActive: t, params: n } = A(), [r, a] = c(de, n);
274
+ return i(() => {
275
+ let e = async (e) => {
276
+ e.state?.step && await d.addTask(async () => {
277
+ a({
278
+ type: "SET",
279
+ params: e.state?.params || {}
280
+ });
281
+ });
282
+ };
283
+ return t && window.addEventListener("popstate", e), () => {
284
+ window.removeEventListener("popstate", e);
285
+ };
286
+ }, [t, a]), /* @__PURE__ */ T(M.Provider, {
287
+ value: a,
288
+ children: /* @__PURE__ */ T(j.Provider, {
289
+ value: r,
290
+ children: e
291
+ })
292
+ });
293
+ }
294
+ //#endregion
295
+ //#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7/node_modules/zustand/esm/vanilla.mjs
296
+ var N = (e) => {
297
+ let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
298
+ let i = typeof e == "function" ? e(t) : e;
299
+ if (!Object.is(i, t)) {
300
+ let e = t;
301
+ t = r ?? (typeof i != "object" || !i) ? i : Object.assign({}, t, i), n.forEach((n) => n(t, e));
302
+ }
303
+ }, i = () => t, a = {
304
+ setState: r,
305
+ getState: i,
306
+ getInitialState: () => o,
307
+ subscribe: (e) => (n.add(e), () => n.delete(e))
308
+ }, o = t = e(r, i, a);
309
+ return a;
310
+ }, pe = ((e) => e ? N(e) : N), me = (e) => e;
311
+ function P(t, n = me) {
312
+ let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
313
+ return e.useDebugValue(r), r;
314
+ }
315
+ //#endregion
316
+ //#region src/stores/useHistoryStore.ts
317
+ function F(e) {
318
+ return P(D().history, e);
327
319
  }
328
- function Ae({ children: n }) {
329
- const { isActive: e, params: r } = gt(), [c, a] = we(ke, r);
330
- return wt(() => {
331
- const i = async (s) => {
332
- s.state?.step && await V.addTask(async () => {
333
- a({ type: "SET", params: s.state?.params || {} });
334
- });
335
- };
336
- return e && window.addEventListener("popstate", i), () => {
337
- window.removeEventListener("popstate", i);
338
- };
339
- }, [e, a]), /* @__PURE__ */ k(ae.Provider, { value: a, children: /* @__PURE__ */ k(se.Provider, { value: c, children: n }) });
320
+ //#endregion
321
+ //#region src/renderer/Renderer.tsx
322
+ function he({ children: e }) {
323
+ let n = F((e) => e.index), r = F((e) => e.histories);
324
+ return r.map((n) => t.toArray(e).filter((e) => (0, O.pathToRegexp)(e.props.path).regexp.test(n.pathname))).map(([e], t) => /* @__PURE__ */ T(k.Provider, {
325
+ value: {
326
+ id: r[t].id,
327
+ isActive: t === n,
328
+ isRoot: t === 0,
329
+ isPrev: t < n - 1,
330
+ zIndex: t,
331
+ pathname: r[t].pathname,
332
+ params: r[t].params,
333
+ transitionName: r[n].transitionName,
334
+ prevTransitionName: r[n - 1]?.transitionName,
335
+ layoutId: r[t].layoutId,
336
+ routePath: ae(e.props.path, r[t].pathname)
337
+ },
338
+ children: /* @__PURE__ */ T(fe, { children: e })
339
+ }, r[t].id));
340
340
  }
341
- function $e({ children: n }) {
342
- const e = G((c) => c.index), r = G((c) => c.histories);
343
- return r.map(
344
- (c) => oe.toArray(n).filter(
345
- (a) => It.pathToRegexp(a.props.path).regexp.test(
346
- c.pathname
347
- )
348
- )
349
- ).map(([c], a) => /* @__PURE__ */ k(
350
- ie.Provider,
351
- {
352
- value: {
353
- id: r[a].id,
354
- isActive: a === e,
355
- isRoot: a === 0,
356
- isPrev: a < e - 1,
357
- zIndex: a,
358
- pathname: r[a].pathname,
359
- params: r[a].params,
360
- transitionName: r[e].transitionName,
361
- prevTransitionName: r[e - 1]?.transitionName,
362
- layoutId: r[a].layoutId,
363
- routePath: Ee(
364
- c.props.path,
365
- r[a].pathname
366
- )
367
- },
368
- children: /* @__PURE__ */ k(Ae, { children: c })
369
- },
370
- r[a].id
371
- ));
341
+ //#endregion
342
+ //#region src/screen/store.ts
343
+ function ge() {
344
+ return pe((e) => ({
345
+ dragStatus: "IDLE",
346
+ replaceTransitionStatus: "IDLE",
347
+ sharedBars: {},
348
+ setDragStatus: (t) => e({ dragStatus: t }),
349
+ setReplaceTransitionStatus: (t) => e({ replaceTransitionStatus: t }),
350
+ registerSharedBars: (t, n) => e((e) => ({ sharedBars: {
351
+ ...e.sharedBars,
352
+ [t]: n
353
+ } })),
354
+ unregisterSharedBars: (t) => e((e) => {
355
+ let n = { ...e.sharedBars };
356
+ return delete n[t], { sharedBars: n };
357
+ })
358
+ }));
372
359
  }
373
- const Zt = "data-flemo", te = () => {
374
- if (Ut()) return;
375
- const n = Te(ut.values(), yt.values());
376
- let e = document.head.querySelector(`style[${Zt}]`);
377
- e || (e = document.createElement("style"), e.setAttribute(Zt, ""), document.head.appendChild(e)), e.textContent !== n && (e.textContent = n);
360
+ //#endregion
361
+ //#region src/transition/styles.ts
362
+ var _e = "data-flemo", I = () => {
363
+ if (oe()) return;
364
+ let e = m(w.values(), ne.values()), t = document.head.querySelector(`style[${_e}]`);
365
+ t || (t = document.createElement("style"), t.setAttribute(_e, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
378
366
  };
379
- function Ce(n, e) {
380
- ge(() => {
381
- for (const r of n) ut.set(r.name, r);
382
- for (const r of e) yt.set(r.name, r);
383
- return te(), () => {
384
- for (const r of n) ut.delete(r.name);
385
- for (const r of e) yt.delete(r.name);
386
- te();
387
- };
388
- }, [n, e]);
367
+ function L(e, t) {
368
+ o(() => {
369
+ for (let t of e) w.set(t.name, t);
370
+ for (let e of t) ne.set(e.name, e);
371
+ return I(), () => {
372
+ for (let t of e) w.delete(t.name);
373
+ for (let e of t) ne.delete(e.name);
374
+ I();
375
+ };
376
+ }, [e, t]);
389
377
  }
390
- const Me = [], He = [];
391
- function Ke({
392
- children: n,
393
- initPath: e = "/",
394
- defaultTransitionName: r = "cupertino",
395
- transitions: c = Me,
396
- decorators: a = He
397
- }) {
398
- const i = Ut() ? e || "/" : window.location.pathname, s = Ut() ? i.split("?")[1] || "" : window.location.search;
399
- return Yt.setState({
400
- defaultTransitionName: r
401
- }), G.setState({
402
- index: 0,
403
- histories: [
404
- {
405
- id: "root",
406
- pathname: i,
407
- params: Pe(
408
- oe.toArray(n).map((w) => w.props.path).flat(),
409
- i,
410
- s
411
- ),
412
- transitionName: r,
413
- layoutId: null
414
- }
415
- ]
416
- }), Ce(c, a), wt(() => {
417
- window.history.state?.index || window.history.replaceState(
418
- {
419
- id: "root",
420
- index: 0,
421
- status: "IDLE",
422
- params: {},
423
- transitionName: r,
424
- layoutId: null
425
- },
426
- "",
427
- window.location.href
428
- );
429
- }, [r]), /* @__PURE__ */ Bt(ye, { children: [
430
- /* @__PURE__ */ k(Le, {}),
431
- /* @__PURE__ */ k($e, { children: n })
432
- ] });
378
+ //#endregion
379
+ //#region src/Router.tsx
380
+ var R = [], z = [];
381
+ function B({ children: e, initPath: n = "/", defaultTransitionName: a = "cupertino", transitions: o = R, decorators: s = z }) {
382
+ let c = oe() ? n || "/" : window.location.pathname, l = oe() ? c.split("?")[1] || "" : window.location.search, d = r(E), [f] = u(() => {
383
+ let n = {
384
+ id: "root",
385
+ pathname: c,
386
+ params: x(t.toArray(e).map((e) => e.props.path).flat(), c, l),
387
+ transitionName: a,
388
+ layoutId: null
389
+ };
390
+ return d ? (d.history.getState().index === -1 && d.history.setState({
391
+ index: 0,
392
+ histories: [n]
393
+ }), d) : {
394
+ history: _([n], 0),
395
+ navigate: v(),
396
+ transition: b(a),
397
+ screen: ge()
398
+ };
399
+ });
400
+ return f.transition.setState({ defaultTransitionName: a }), L(o, s), i(() => {
401
+ window.history.state?.index || window.history.replaceState({
402
+ id: "root",
403
+ index: 0,
404
+ status: "IDLE",
405
+ params: {},
406
+ transitionName: a,
407
+ layoutId: null
408
+ }, "", window.location.href);
409
+ }, [a]), /* @__PURE__ */ ce(E.Provider, {
410
+ value: f,
411
+ children: [/* @__PURE__ */ T(ue, {}), /* @__PURE__ */ T(he, { children: e })]
412
+ });
433
413
  }
434
- function We({ element: n }) {
435
- return n;
414
+ //#endregion
415
+ //#region src/Route.tsx
416
+ function V({ element: e }) {
417
+ return e;
436
418
  }
437
- function Rt(n, e) {
438
- const r = e ?? {}, c = It.compile(n), a = Object.fromEntries(
439
- Object.entries(r).map(([f, L]) => [f, String(L)])
440
- ), i = c(a), w = (typeof n == "string" ? It.parse(n) : n).tokens.filter((f) => f.type === "param").map((f) => f.name), T = Object.fromEntries(
441
- Object.entries(r).filter(([f]) => !w.includes(f))
442
- ), p = new URLSearchParams(T).toString();
443
- return { pathname: `${i}${p ? `?${p}` : ""}`, toPathname: i };
419
+ //#endregion
420
+ //#region src/utils/buildRoutePath.ts
421
+ function H(e, t) {
422
+ let n = t ?? {}, r = (0, O.compile)(e)(Object.fromEntries(Object.entries(n).map(([e, t]) => [e, String(t)]))), i = (typeof e == "string" ? (0, O.parse)(e) : e).tokens.filter((e) => e.type === "param").map((e) => e.name), a = Object.fromEntries(Object.entries(n).filter(([e]) => !i.includes(e))), o = new URLSearchParams(a).toString();
423
+ return {
424
+ pathname: `${r}${o ? `?${o}` : ""}`,
425
+ toPathname: r
426
+ };
444
427
  }
445
- const Mt = (n, e, r) => {
446
- const { regexp: c } = It.pathToRegexp(n);
447
- for (let a = e - 1; a >= 0; a--)
448
- if (c.test(r[a].pathname))
449
- return e - a;
450
- return -1;
451
- }, Ht = (n, e) => typeof n == "number" && Number.isFinite(n) ? Math.max(0, Math.trunc(n)) : e, Ot = async (n, e) => {
452
- let r;
453
- const c = new Promise((s) => {
454
- r = () => s(!0), window.addEventListener("popstate", r, { once: !0 });
455
- }), a = new Promise((s) => setTimeout(() => s(!1), 200));
456
- if (Ft(), window.history.go(-n), !await Promise.race([c, a])) {
457
- window.removeEventListener("popstate", r);
458
- return;
459
- }
460
- e();
428
+ //#endregion
429
+ //#region src/navigate/useNavigate.ts
430
+ var U = (e, t, n) => {
431
+ let { regexp: r } = (0, O.pathToRegexp)(e);
432
+ for (let e = t - 1; e >= 0; e--) if (r.test(n[e].pathname)) return t - e;
433
+ return -1;
434
+ }, ve = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t, W = async (e, t) => {
435
+ let n, r = new Promise((e) => {
436
+ n = () => e(!0), window.addEventListener("popstate", n, { once: !0 });
437
+ }), i = new Promise((e) => setTimeout(() => e(!1), 200));
438
+ if (S(), window.history.go(-e), !await Promise.race([r, i])) {
439
+ window.removeEventListener("popstate", n);
440
+ return;
441
+ }
442
+ t();
461
443
  };
462
- function Je() {
463
- const n = async (a, i, s) => {
464
- const { status: w } = J.getState();
465
- if (w !== "COMPLETED" && w !== "IDLE")
466
- return;
467
- const T = Yt.getState().defaultTransitionName, { transitionName: p = T, layoutId: P = null } = s ?? {}, f = V.generateTaskId();
468
- (await V.addTask(
469
- async () => {
470
- const { index: L, histories: R, addHistory: A, popHistories: b } = G.getState(), U = (() => {
471
- if (s?.until != null) {
472
- const u = Mt(s.until, L, R);
473
- return u < 0 ? 0 : u;
474
- }
475
- return Math.min(Ht(s?.skip, 0), Math.max(0, L));
476
- })(), { setStatus: M, setTransitionTaskId: $ } = J.getState();
477
- M("PUSHING"), $(f);
478
- const { pathname: X, toPathname: O } = Rt(a, i ?? {}), o = {
479
- id: f,
480
- pathname: O,
481
- params: i ?? {},
482
- transitionName: p,
483
- layoutId: P
484
- };
485
- return U === 0 ? (window.history.pushState(
486
- { id: f, index: L + 1, status: "PUSHING", params: i, transitionName: p, layoutId: P },
487
- "",
488
- X
489
- ), A(o), () => {
490
- M("COMPLETED");
491
- }) : (A(o), await Ot(U, () => {
492
- window.history.pushState(
493
- {
494
- id: f,
495
- index: G.getState().index - U,
496
- status: "PUSHING",
497
- params: i,
498
- transitionName: p,
499
- layoutId: P
500
- },
501
- "",
502
- X
503
- );
504
- }), async () => {
505
- b(U), M("COMPLETED");
506
- });
507
- },
508
- {
509
- id: f,
510
- control: {
511
- manual: !0
512
- }
513
- }
514
- )).result?.();
515
- }, e = async (a, i, s) => {
516
- const { status: w } = J.getState();
517
- if (w !== "COMPLETED" && w !== "IDLE")
518
- return;
519
- const T = Yt.getState().defaultTransitionName, { transitionName: p = T, layoutId: P = null } = s ?? {}, f = V.generateTaskId();
520
- (await V.addTask(
521
- async (L) => {
522
- const { index: R, histories: A, addHistory: b, replaceHistory: U, popHistories: M } = G.getState(), $ = (() => {
523
- if (s?.until != null) {
524
- const l = Mt(s.until, R, A);
525
- return l < 0 ? 0 : l + 1;
526
- }
527
- return Math.min(Ht(s?.skip, 0) + 1, R + 1);
528
- })();
529
- if ($ <= 0) {
530
- L.abort();
531
- return;
532
- }
533
- const { setStatus: X, setTransitionTaskId: O } = J.getState();
534
- X("REPLACING"), O(f);
535
- const { pathname: o, toPathname: u } = Rt(a, i ?? {}), y = {
536
- id: f,
537
- pathname: u,
538
- params: i ?? {},
539
- transitionName: p,
540
- layoutId: P
541
- };
542
- return $ === 1 ? (window.history.replaceState(
543
- { id: f, index: R, status: "REPLACING", params: i, transitionName: p, layoutId: P },
544
- "",
545
- o
546
- ), b(y), async () => {
547
- U(R), X("COMPLETED");
548
- }) : (M($ - 1), b(y), $ <= R ? await Ot($, () => {
549
- window.history.pushState(
550
- {
551
- id: f,
552
- index: G.getState().index - 1,
553
- status: "REPLACING",
554
- params: i,
555
- transitionName: p,
556
- layoutId: P
557
- },
558
- "",
559
- o
560
- );
561
- }) : await Ot(R, () => {
562
- window.history.replaceState(
563
- { id: f, index: 0, status: "REPLACING", params: i, transitionName: p, layoutId: P },
564
- "",
565
- o
566
- );
567
- }), async () => {
568
- U(G.getState().index - 1), X("COMPLETED");
569
- });
570
- },
571
- {
572
- id: f,
573
- control: {
574
- manual: !0
575
- }
576
- }
577
- )).result?.();
578
- }, r = async (a, i) => {
579
- const s = V.generateTaskId();
580
- (await V.addTask(
581
- async (w) => {
582
- const { index: T, histories: p, popHistory: P, popHistories: f, setTransitionName: L } = G.getState();
583
- if (T <= 0) {
584
- w.abort();
585
- return;
586
- }
587
- const R = Math.min(a(T, p), T);
588
- if (R <= 0) {
589
- w.abort();
590
- return;
591
- }
592
- const { setStatus: A, setTransitionTaskId: b } = J.getState();
593
- return i && L(T, i), A("POPPING"), b(s), f(R - 1), Ft(), R === 1 ? window.history.back() : window.history.go(-R), async () => {
594
- P(G.getState().index), A("COMPLETED");
595
- };
596
- },
597
- {
598
- id: s,
599
- control: {
600
- manual: !0
601
- }
602
- }
603
- )).result?.();
604
- };
605
- return {
606
- push: n,
607
- replace: e,
608
- pop: async (a) => {
609
- await r((i, s) => {
610
- if (a?.until != null) {
611
- const T = Mt(a.until, i, s);
612
- return T < 0 ? 0 : T;
613
- }
614
- const w = Ht(a?.skip, 1);
615
- return w <= 0 ? 0 : Math.min(w, i);
616
- }, a?.transitionName);
617
- }
618
- };
444
+ function G() {
445
+ let e = D(), t = async (t, n, r) => {
446
+ let { status: i } = e.navigate.getState();
447
+ if (i !== "COMPLETED" && i !== "IDLE") return;
448
+ let a = e.transition.getState().defaultTransitionName, { transitionName: o = a, layoutId: s = null } = r ?? {}, c = d.generateTaskId();
449
+ (await d.addTask(async () => {
450
+ let { index: i, histories: a, addHistory: l, popHistories: u } = e.history.getState(), d = (() => {
451
+ if (r?.until != null) {
452
+ let e = U(r.until, i, a);
453
+ return e < 0 ? 0 : e;
454
+ }
455
+ return Math.min(ve(r?.skip, 0), Math.max(0, i));
456
+ })(), { setStatus: f, setTransitionTaskId: p } = e.navigate.getState();
457
+ f("PUSHING"), p(c);
458
+ let { pathname: m, toPathname: h } = H(t, n ?? {}), g = {
459
+ id: c,
460
+ pathname: h,
461
+ params: n ?? {},
462
+ transitionName: o,
463
+ layoutId: s
464
+ };
465
+ return d === 0 ? (window.history.pushState({
466
+ id: c,
467
+ index: i + 1,
468
+ status: "PUSHING",
469
+ params: n,
470
+ transitionName: o,
471
+ layoutId: s
472
+ }, "", m), l(g), () => {
473
+ f("COMPLETED");
474
+ }) : (l(g), await W(d, () => {
475
+ window.history.pushState({
476
+ id: c,
477
+ index: e.history.getState().index - d,
478
+ status: "PUSHING",
479
+ params: n,
480
+ transitionName: o,
481
+ layoutId: s
482
+ }, "", m);
483
+ }), async () => {
484
+ u(d), f("COMPLETED");
485
+ });
486
+ }, {
487
+ id: c,
488
+ control: { manual: !0 }
489
+ })).result?.();
490
+ }, n = async (t, n, r) => {
491
+ let { status: i } = e.navigate.getState();
492
+ if (i !== "COMPLETED" && i !== "IDLE") return;
493
+ let a = e.transition.getState().defaultTransitionName, { transitionName: o = a, layoutId: s = null } = r ?? {}, c = d.generateTaskId();
494
+ (await d.addTask(async (i) => {
495
+ let { index: a, histories: l, addHistory: u, replaceHistory: d, popHistories: f } = e.history.getState(), p = (() => {
496
+ if (r?.until != null) {
497
+ let e = U(r.until, a, l);
498
+ return e < 0 ? 0 : e + 1;
499
+ }
500
+ return Math.min(ve(r?.skip, 0) + 1, a + 1);
501
+ })();
502
+ if (p <= 0) {
503
+ i.abort();
504
+ return;
505
+ }
506
+ let { setStatus: m, setTransitionTaskId: h } = e.navigate.getState();
507
+ m("REPLACING"), h(c);
508
+ let { pathname: g, toPathname: _ } = H(t, n ?? {}), v = {
509
+ id: c,
510
+ pathname: _,
511
+ params: n ?? {},
512
+ transitionName: o,
513
+ layoutId: s
514
+ };
515
+ return p === 1 ? (window.history.replaceState({
516
+ id: c,
517
+ index: a,
518
+ status: "REPLACING",
519
+ params: n,
520
+ transitionName: o,
521
+ layoutId: s
522
+ }, "", g), u(v), async () => {
523
+ d(a), m("COMPLETED");
524
+ }) : (f(p - 1), u(v), p <= a ? await W(p, () => {
525
+ window.history.pushState({
526
+ id: c,
527
+ index: e.history.getState().index - 1,
528
+ status: "REPLACING",
529
+ params: n,
530
+ transitionName: o,
531
+ layoutId: s
532
+ }, "", g);
533
+ }) : await W(a, () => {
534
+ window.history.replaceState({
535
+ id: c,
536
+ index: 0,
537
+ status: "REPLACING",
538
+ params: n,
539
+ transitionName: o,
540
+ layoutId: s
541
+ }, "", g);
542
+ }), async () => {
543
+ d(e.history.getState().index - 1), m("COMPLETED");
544
+ });
545
+ }, {
546
+ id: c,
547
+ control: { manual: !0 }
548
+ })).result?.();
549
+ }, r = async (t, n) => {
550
+ let r = d.generateTaskId();
551
+ (await d.addTask(async (i) => {
552
+ let { index: a, histories: o, popHistory: s, popHistories: c, setTransitionName: l } = e.history.getState();
553
+ if (a <= 0) {
554
+ i.abort();
555
+ return;
556
+ }
557
+ let u = Math.min(t(a, o), a);
558
+ if (u <= 0) {
559
+ i.abort();
560
+ return;
561
+ }
562
+ let { setStatus: d, setTransitionTaskId: f } = e.navigate.getState();
563
+ return n && l(a, n), d("POPPING"), f(r), c(u - 1), S(), u === 1 ? window.history.back() : window.history.go(-u), async () => {
564
+ s(e.history.getState().index), d("COMPLETED");
565
+ };
566
+ }, {
567
+ id: r,
568
+ control: { manual: !0 }
569
+ })).result?.();
570
+ };
571
+ return {
572
+ push: t,
573
+ replace: n,
574
+ pop: async (e) => {
575
+ await r((t, n) => {
576
+ if (e?.until != null) {
577
+ let r = U(e.until, t, n);
578
+ return r < 0 ? 0 : r;
579
+ }
580
+ let r = ve(e?.skip, 1);
581
+ return r <= 0 ? 0 : Math.min(r, t);
582
+ }, e?.transitionName);
583
+ }
584
+ };
619
585
  }
620
- function Qe() {
621
- const { routePath: n } = gt(), e = jt(ae);
622
- return {
623
- pushStep: async (i) => {
624
- (await V.addTask(async () => {
625
- const { pathname: s } = Rt(n, i);
626
- return window.history.state?.step || window.history.replaceState(
627
- {
628
- ...window.history.state,
629
- step: !0
630
- },
631
- "",
632
- window.location.pathname
633
- ), window.history.pushState(
634
- {
635
- ...window.history.state,
636
- step: !0,
637
- params: i
638
- },
639
- "",
640
- s
641
- ), async () => e({ type: "SET", params: i });
642
- })).result?.();
643
- },
644
- replaceStep: async (i) => {
645
- (await V.addTask(async () => {
646
- const { pathname: s } = Rt(n, i);
647
- return window.history.replaceState(
648
- {
649
- ...window.history.state,
650
- step: !0,
651
- params: i
652
- },
653
- "",
654
- s
655
- ), async () => e({ type: "SET", params: i });
656
- })).result?.();
657
- },
658
- popStep: async () => {
659
- const i = V.generateTaskId();
660
- (await V.addTask(
661
- async (s) => {
662
- const w = new Promise((A) => {
663
- window.addEventListener(
664
- "popstate",
665
- (b) => A(b.state),
666
- { once: !0 }
667
- );
668
- }), T = new Promise(
669
- (A) => setTimeout(() => A(void 0), 200)
670
- );
671
- Ft(), window.history.back();
672
- const p = await Promise.race([
673
- w,
674
- T
675
- ]);
676
- if (!p) {
677
- s.abort();
678
- return;
679
- }
680
- if (p.step) {
681
- e({ type: "SET", params: p.params ?? {} }), s.abort();
682
- return;
683
- }
684
- const { setStatus: P, setTransitionTaskId: f } = J.getState(), { index: L, popHistory: R } = G.getState();
685
- return P("POPPING"), f(i), async () => {
686
- R(L), P("COMPLETED");
687
- };
688
- },
689
- {
690
- id: i,
691
- control: {
692
- manual: !0
693
- }
694
- }
695
- )).result?.();
696
- }
697
- };
586
+ //#endregion
587
+ //#region src/navigate/useStep.ts
588
+ function ye() {
589
+ let { routePath: e } = A(), t = D(), n = r(M);
590
+ return {
591
+ pushStep: async (t) => {
592
+ (await d.addTask(async () => {
593
+ let { pathname: r } = H(e, t);
594
+ return window.history.state?.step || window.history.replaceState({
595
+ ...window.history.state,
596
+ step: !0
597
+ }, "", window.location.pathname), window.history.pushState({
598
+ ...window.history.state,
599
+ step: !0,
600
+ params: t
601
+ }, "", r), async () => n({
602
+ type: "SET",
603
+ params: t
604
+ });
605
+ })).result?.();
606
+ },
607
+ replaceStep: async (t) => {
608
+ (await d.addTask(async () => {
609
+ let { pathname: r } = H(e, t);
610
+ return window.history.replaceState({
611
+ ...window.history.state,
612
+ step: !0,
613
+ params: t
614
+ }, "", r), async () => n({
615
+ type: "SET",
616
+ params: t
617
+ });
618
+ })).result?.();
619
+ },
620
+ popStep: async () => {
621
+ let e = d.generateTaskId();
622
+ (await d.addTask(async (r) => {
623
+ let i = new Promise((e) => {
624
+ window.addEventListener("popstate", (t) => e(t.state), { once: !0 });
625
+ }), a = new Promise((e) => setTimeout(() => e(void 0), 200));
626
+ S(), window.history.back();
627
+ let o = await Promise.race([i, a]);
628
+ if (!o) {
629
+ r.abort();
630
+ return;
631
+ }
632
+ if (o.step) {
633
+ n({
634
+ type: "SET",
635
+ params: o.params ?? {}
636
+ }), r.abort();
637
+ return;
638
+ }
639
+ let { setStatus: s, setTransitionTaskId: c } = t.navigate.getState(), { index: l, popHistory: u } = t.history.getState();
640
+ return s("POPPING"), c(e), async () => {
641
+ u(l), s("COMPLETED");
642
+ };
643
+ }, {
644
+ id: e,
645
+ control: { manual: !0 }
646
+ })).result?.();
647
+ }
648
+ };
698
649
  }
699
- function Ze() {
700
- return jt(se);
650
+ //#endregion
651
+ //#region src/screen/ParamsProvider/useParams.ts
652
+ function be() {
653
+ return r(j);
701
654
  }
702
- function Oe({ freeze: n, children: e }) {
703
- const r = N(e);
704
- return n || (r.current = e), /* @__PURE__ */ k(
705
- "div",
706
- {
707
- style: {
708
- display: n ? "none" : void 0
709
- },
710
- children: r.current
711
- }
712
- );
655
+ //#endregion
656
+ //#region src/screen/ScreenFreeze.tsx
657
+ function K({ freeze: e, children: t }) {
658
+ let n = l(t);
659
+ return e || (n.current = t), /* @__PURE__ */ T("div", {
660
+ style: { display: e ? "none" : void 0 },
661
+ children: n.current
662
+ });
713
663
  }
714
- function Ge({ ref: n, style: e, ...r }) {
715
- const { isActive: c, transitionName: a } = gt(), i = N(null);
716
- Se(n, () => i.current);
717
- const s = J((P) => P.status), w = ut.get(a) ?? ut.get("none"), { decoratorName: T } = w, p = yt.get(T);
718
- return p ? /* @__PURE__ */ k(
719
- "div",
720
- {
721
- ref: i,
722
- "data-flemo-decorator": !0,
723
- "data-flemo-decorator-name": p.name,
724
- "data-flemo-status": s,
725
- "data-flemo-active": c ? "true" : "false",
726
- style: {
727
- position: "absolute",
728
- top: 0,
729
- left: 0,
730
- width: "100%",
731
- height: "100%",
732
- pointerEvents: "none",
733
- zIndex: 1,
734
- ...e
735
- },
736
- ...r
737
- }
738
- ) : null;
664
+ //#endregion
665
+ //#region src/stores/useNavigateStore.ts
666
+ function xe(e) {
667
+ return P(D().navigate, e);
739
668
  }
740
- const ee = (n) => {
741
- let e;
742
- const r = /* @__PURE__ */ new Set(), c = (p, P) => {
743
- const f = typeof p == "function" ? p(e) : p;
744
- if (!Object.is(f, e)) {
745
- const L = e;
746
- e = P ?? (typeof f != "object" || f === null) ? f : Object.assign({}, e, f), r.forEach((R) => R(e, L));
747
- }
748
- }, a = () => e, w = { setState: c, getState: a, getInitialState: () => T, subscribe: (p) => (r.add(p), () => r.delete(p)) }, T = e = n(c, a, w);
749
- return w;
750
- }, Be = ((n) => n ? ee(n) : ee), Ue = (n) => n;
751
- function Ye(n, e = Ue) {
752
- const r = xt.useSyncExternalStore(
753
- n.subscribe,
754
- xt.useCallback(() => e(n.getState()), [n, e]),
755
- xt.useCallback(() => e(n.getInitialState()), [n, e])
756
- );
757
- return xt.useDebugValue(r), r;
669
+ //#endregion
670
+ //#region src/screen/ScreenDecorator.tsx
671
+ function Se({ ref: e, style: t, ...n }) {
672
+ let { isActive: r, transitionName: i } = A(), o = l(null);
673
+ a(e, () => o.current);
674
+ let s = xe((e) => e.status), { decoratorName: c } = w.get(i) ?? w.get("none"), u = ne.get(c);
675
+ return u ? /* @__PURE__ */ T("div", {
676
+ ref: o,
677
+ "data-flemo-decorator": !0,
678
+ "data-flemo-decorator-name": u.name,
679
+ "data-flemo-status": s,
680
+ "data-flemo-active": r ? "true" : "false",
681
+ style: {
682
+ position: "absolute",
683
+ top: 0,
684
+ left: 0,
685
+ width: "100%",
686
+ height: "100%",
687
+ pointerEvents: "none",
688
+ zIndex: 1,
689
+ ...t
690
+ },
691
+ ...n
692
+ }) : null;
758
693
  }
759
- const ne = (n) => {
760
- const e = Be(n), r = (c) => Ye(e, c);
761
- return Object.assign(r, e), r;
762
- }, Ve = ((n) => n ? ne(n) : ne), Z = Ve((n) => ({
763
- dragStatus: "IDLE",
764
- replaceTransitionStatus: "IDLE",
765
- sharedBars: {},
766
- setDragStatus: (e) => n({ dragStatus: e }),
767
- setReplaceTransitionStatus: (e) => n({ replaceTransitionStatus: e }),
768
- registerSharedBars: (e, r) => n((c) => ({ sharedBars: { ...c.sharedBars, [e]: r } })),
769
- unregisterSharedBars: (e) => n((r) => {
770
- const c = { ...r.sharedBars };
771
- return delete c[e], { sharedBars: c };
772
- })
773
- }));
774
- let Gt = 0;
775
- function _e() {
776
- const [n, e] = bt(0), [r, c] = bt(0);
777
- return wt(() => {
778
- let a = 0;
779
- const i = () => {
780
- cancelAnimationFrame(a), a = requestAnimationFrame(() => {
781
- let s = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
782
- s = s < 0 ? 0 : s;
783
- let w = s - Gt;
784
- w = w < 0 ? 0 : w, Gt || (Gt = s), c(w), e(s);
785
- });
786
- };
787
- return window.visualViewport?.addEventListener("resize", i), window.visualViewport?.addEventListener("scroll", i), () => {
788
- cancelAnimationFrame(a), window.visualViewport?.removeEventListener("resize", i), window.visualViewport?.removeEventListener("scroll", i);
789
- };
790
- }, []), { viewportScrollHeight: n, changedViewportScrollHeight: r };
694
+ //#endregion
695
+ //#region src/screen/useViewportScrollHeight.ts
696
+ var q = 0;
697
+ function Ce() {
698
+ let [e, t] = u(0), [n, r] = u(0);
699
+ return i(() => {
700
+ let e = 0, n = () => {
701
+ cancelAnimationFrame(e), e = requestAnimationFrame(() => {
702
+ let e = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
703
+ e = e < 0 ? 0 : e;
704
+ let n = e - q;
705
+ n = n < 0 ? 0 : n, q ||= e, r(n), t(e);
706
+ });
707
+ };
708
+ return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
709
+ cancelAnimationFrame(e), window.visualViewport?.removeEventListener("resize", n), window.visualViewport?.removeEventListener("scroll", n);
710
+ };
711
+ }, []), {
712
+ viewportScrollHeight: e,
713
+ changedViewportScrollHeight: n
714
+ };
791
715
  }
792
- const je = (n) => typeof HTMLElement < "u" && n instanceof HTMLElement, Vt = /* @__PURE__ */ new WeakMap(), re = (n, e) => {
793
- let r = Vt.get(n);
794
- r || (r = /* @__PURE__ */ new Set(), Vt.set(n, r)), r.add(e);
795
- }, z = (n, e) => {
796
- n.style.transition = "";
797
- const r = Vt.get(n);
798
- if (r && r.size > 0) {
799
- for (const c of r)
800
- n.style.removeProperty(c);
801
- r.clear();
802
- return;
803
- }
804
- n.style.removeProperty("transform"), n.style.removeProperty("opacity");
805
- }, dt = (n, e, r = {}) => {
806
- if (!je(n)) return Promise.resolve();
807
- const c = n, a = xe(e);
808
- if (a.length === 0) return Promise.resolve();
809
- const i = typeof r.duration == "number" ? r.duration : 0, s = typeof r.delay == "number" && r.delay > 0 ? r.delay : 0, w = be(r.ease);
810
- if (i <= 0 && s <= 0) {
811
- c.style.transition = "none";
812
- for (const p of a)
813
- c.style.setProperty(p.property, p.value), re(c, p.property);
814
- return Promise.resolve();
815
- }
816
- const T = a.map((p) => `${p.property} ${i}s ${w} ${s}s`).join(", ");
817
- c.style.transition = T, c.offsetWidth;
818
- for (const p of a)
819
- c.style.setProperty(p.property, p.value), re(c, p.property);
820
- return new Promise((p) => {
821
- let P = !1;
822
- const f = () => {
823
- P || (P = !0, c.removeEventListener("transitionend", L), p());
824
- }, L = (R) => {
825
- R.target === c && f();
826
- };
827
- c.addEventListener("transitionend", L), setTimeout(f, (i + s) * 1e3 + 60);
828
- });
829
- }, pt = J, ht = "data-flemo-skip-animation";
830
- function Fe({
831
- children: n,
832
- statusBarHeight: e,
833
- statusBarColor: r,
834
- systemNavigationBarHeight: c,
835
- systemNavigationBarColor: a,
836
- sharedAppBar: i,
837
- sharedNavigationBar: s,
838
- appBar: w,
839
- navigationBar: T,
840
- hideStatusBar: p,
841
- hideSystemNavigationBar: P,
842
- backgroundColor: f = "white",
843
- contentScrollable: L = !0,
844
- ...R
845
- }) {
846
- const { id: A, isActive: b, isRoot: U, zIndex: M, transitionName: $, prevTransitionName: X } = gt(), O = pt((t) => t.status), o = Z((t) => t.dragStatus), u = Z.getState().setDragStatus, y = Z.getState().setReplaceTransitionStatus, l = G((t) => t.index), d = ut.get($) ?? ut.get("none"), { initial: g, swipeDirection: m, decoratorName: x } = d, S = yt.get(x), { viewportScrollHeight: D } = _e(), I = D > 0, [Y, v] = bt(0), [B, j] = bt(0), Xt = N(null), _ = N(null), tt = N(null), K = N(null), lt = N(null), Q = N({
847
- current: [],
848
- prev: []
849
- }), et = N(!1), ft = N(!1), ot = N(!1), ce = N(0), Dt = N({ x: 0, y: 0 }), St = N({ x: 0, y: 0 }), Lt = N(0), Nt = N({ x: 0, y: 0 }), nt = N({
850
- element: null,
851
- hasMarker: !1
852
- }), it = N({ element: null, hasMarker: !1 }), kt = N(0), At = N(0), st = N(null), at = N(null), $t = (t) => {
853
- const h = St.current;
854
- return {
855
- point: { x: t.clientX, y: t.clientY },
856
- offset: {
857
- x: t.clientX - Dt.current.x,
858
- y: t.clientY - Dt.current.y
859
- },
860
- delta: { x: t.clientX - h.x, y: t.clientY - h.y },
861
- velocity: Nt.current
862
- };
863
- }, ue = (t) => {
864
- const h = t.timeStamp, E = Math.max(1, h - Lt.current), H = St.current;
865
- Nt.current = {
866
- x: (t.clientX - H.x) / E * 1e3,
867
- y: (t.clientY - H.y) / E * 1e3
868
- }, St.current = { x: t.clientX, y: t.clientY }, Lt.current = h;
869
- }, Ct = (t, h, E) => {
870
- const H = dt(t, h, E);
871
- if (t === _.current)
872
- for (const C of Q.current.current)
873
- dt(C, h, E);
874
- else if (t === tt.current)
875
- for (const C of Q.current.prev)
876
- dt(C, h, E);
877
- return H;
878
- }, le = (t) => {
879
- const h = b ? G.getState().histories[l - 1]?.id : G.getState().histories[l]?.id, E = h ? Z.getState().sharedBars[h] : void 0, H = [], C = st.current, ct = at.current;
880
- C && Et && !E?.appBar && H.push(C), ct && Tt && !E?.navigationBar && H.push(ct);
881
- const q = [];
882
- if (t) {
883
- const rt = t.querySelector('[data-flemo-bar="app"]'), Wt = t.querySelector('[data-flemo-bar="nav"]');
884
- rt && !Et && q.push(rt), Wt && !Tt && q.push(Wt);
885
- }
886
- Q.current = { current: H, prev: q };
887
- const Pt = De(d).join(", ");
888
- for (const rt of H) rt.style.willChange = Pt;
889
- for (const rt of q) rt.style.willChange = Pt;
890
- }, qt = () => {
891
- for (const t of Q.current.current)
892
- z(t), t.style.removeProperty("will-change");
893
- for (const t of Q.current.prev)
894
- z(t), t.style.removeProperty("will-change");
895
- Q.current = { current: [], prev: [] };
896
- }, vt = async (t) => {
897
- if (!m || D > 10) return;
898
- const h = _.current;
899
- if (!h) return;
900
- const E = Xt.current?.parentElement?.previousElementSibling;
901
- if (tt.current = E?.querySelector("[data-flemo-screen]") ?? null, lt.current = E?.querySelector("[data-flemo-decorator]") ?? null, !tt.current) return;
902
- ot.current = !0, ce.current = t.timeStamp, Dt.current = { x: t.clientX, y: t.clientY }, St.current = { x: t.clientX, y: t.clientY }, Lt.current = t.timeStamp, Nt.current = { x: 0, y: 0 }, h.setPointerCapture(t.pointerId), le(E), await d?.onSwipeStart(t, $t(t), {
903
- animate: Ct,
904
- currentScreen: h,
905
- prevScreen: tt.current,
906
- onStart: (C) => S?.onSwipeStart?.(C, {
907
- animate: dt,
908
- currentDecorator: K.current,
909
- prevDecorator: lt.current
910
- })
911
- }) ? u("PENDING") : (u("IDLE"), ot.current = !1, qt());
912
- }, de = (t) => {
913
- !m || !ot.current || D > 10 || (ue(t), d.onSwipe(t, $t(t), {
914
- animate: Ct,
915
- currentScreen: _.current,
916
- prevScreen: tt.current,
917
- onProgress: (h, E) => S?.onSwipe?.(h, E, {
918
- animate: dt,
919
- currentDecorator: K.current,
920
- prevDecorator: lt.current
921
- })
922
- }));
923
- }, pe = async (t) => {
924
- if (!m || !ot.current) return;
925
- ot.current = !1;
926
- const h = _.current;
927
- h && h.hasPointerCapture(t.pointerId) && h.releasePointerCapture(t.pointerId);
928
- const E = $t(t);
929
- if (await d?.onSwipeEnd(t, E, {
930
- animate: Ct,
931
- currentScreen: _.current,
932
- prevScreen: tt.current,
933
- onStart: (C) => S?.onSwipeEnd?.(C, {
934
- animate: dt,
935
- currentDecorator: K.current,
936
- prevDecorator: lt.current
937
- })
938
- })) {
939
- _.current?.setAttribute(ht, "true"), K.current?.setAttribute(ht, "true");
940
- for (const C of Q.current.current)
941
- C.style.removeProperty("will-change");
942
- for (const C of Q.current.prev)
943
- z(C), C.style.removeProperty("will-change");
944
- Q.current = { current: [], prev: [] }, window.history.back();
945
- } else
946
- z(_.current), tt.current && z(tt.current), K.current && z(K.current), lt.current && z(lt.current), qt(), u("IDLE");
947
- }, fe = (t) => {
948
- if (!(!U && b && O === "COMPLETED" && o === "IDLE" && !!m && D < 10))
949
- return;
950
- nt.current = Jt(t.target, {
951
- direction: "x",
952
- verifyByScroll: !0
953
- }), it.current = Jt(t.target, {
954
- direction: "y",
955
- verifyByScroll: !0
956
- }), kt.current = t.clientX, At.current = t.clientY, (!nt.current.element && !it.current.element || nt.current.element || it.current.element) && (et.current = !0);
957
- }, me = (t) => {
958
- if (D > 10)
959
- return;
960
- if (ot.current) {
961
- de(t.nativeEvent);
962
- return;
963
- }
964
- const h = !nt.current.element && !it.current.element;
965
- if (et.current && h) {
966
- et.current = !1, ft.current = !0;
967
- const E = t.clientY - At.current, H = t.clientX - kt.current;
968
- (m === "y" && E > 0 || m === "x" && H > 0) && vt(t.nativeEvent);
969
- } else if (et.current && !h) {
970
- const E = t.clientX - kt.current, H = t.clientY - At.current, C = it.current.element && it.current.element.scrollTop <= 0, ct = nt.current.element && nt.current.element.scrollLeft <= 0 && nt.current.hasMarker;
971
- (m === "y" && (C || nt.current.element) && H > 0 && Math.abs(E) < 2 || m === "x" && (ct || it.current.element) && E > 0 && Math.abs(H) < 2) && (et.current = !1, ft.current = !0, vt(t.nativeEvent));
972
- }
973
- }, zt = (t) => {
974
- et.current = !1, ft.current = !1, ot.current && pe(t.nativeEvent);
975
- };
976
- wt(() => {
977
- const t = _.current;
978
- if (!t) return;
979
- const h = (E) => {
980
- ft.current && E.preventDefault(), E.target?.dataset.swipeAtEdgeBar === "true" && E.preventDefault();
981
- };
982
- return t.addEventListener("touchmove", h, {
983
- passive: !1
984
- }), () => {
985
- t.removeEventListener("touchmove", h);
986
- };
987
- }, []), mt(() => {
988
- if (!b) {
989
- O === "REPLACING" && X !== $ && y("PENDING");
990
- return;
991
- }
992
- if (O === "COMPLETED") {
993
- u("IDLE"), y("IDLE"), _.current && (z(_.current), _.current.removeAttribute(ht)), K.current && (z(K.current), K.current.removeAttribute(ht)), st.current && (z(st.current), st.current.style.removeProperty("will-change")), at.current && (z(at.current), at.current.style.removeProperty("will-change"));
994
- return;
995
- }
996
- if (O === "IDLE") return;
997
- const t = _.current;
998
- if (!t) return;
999
- const h = () => {
1000
- const W = pt.getState().transitionTaskId;
1001
- W && V.resolveTask(W);
1002
- }, E = `${O}-true`;
1003
- if (!(!(t.getAttribute(ht) === "true") && Ie(d, E))) {
1004
- queueMicrotask(h);
1005
- return;
1006
- }
1007
- const ct = Re("screen", $, E), q = (W) => {
1008
- W.target === t && W.animationName === ct && (t.removeEventListener("animationend", q), h());
1009
- };
1010
- return t.addEventListener("animationend", q), () => {
1011
- t.removeEventListener("animationend", q);
1012
- };
1013
- }, [
1014
- O,
1015
- b,
1016
- A,
1017
- X,
1018
- $,
1019
- d,
1020
- u,
1021
- y
1022
- ]), mt(() => {
1023
- const t = st.current;
1024
- if (!t) {
1025
- v(0);
1026
- return;
1027
- }
1028
- v(t.offsetHeight);
1029
- const h = new ResizeObserver(([E]) => {
1030
- v(E.contentRect.height);
1031
- });
1032
- return h.observe(t), () => {
1033
- h.disconnect();
1034
- };
1035
- }, [i]), mt(() => {
1036
- const t = at.current;
1037
- if (!t) {
1038
- j(0);
1039
- return;
1040
- }
1041
- j(t.offsetHeight);
1042
- const h = new ResizeObserver(([E]) => {
1043
- j(E.contentRect.height);
1044
- });
1045
- return h.observe(t), () => {
1046
- h.disconnect();
1047
- };
1048
- }, [s]), mt(() => {
1049
- const { registerSharedBars: t, unregisterSharedBars: h } = Z.getState();
1050
- return t(A, {
1051
- appBar: !!i,
1052
- navigationBar: !!s
1053
- }), () => h(A);
1054
- }, [A, i, s]);
1055
- const Kt = b || M === l - 1, Et = !!i, Tt = !!s;
1056
- mt(() => {
1057
- const t = st.current, h = at.current;
1058
- if (!t && !h) return;
1059
- const E = () => {
1060
- if (!(pt.getState().status === "PUSHING" || pt.getState().status === "POPPING" || pt.getState().status === "REPLACING") || !Kt) {
1061
- t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
1062
- return;
1063
- }
1064
- const q = b ? G.getState().histories[l - 1]?.id : G.getState().histories[l]?.id, W = q ? Z.getState().sharedBars[q] : void 0, Pt = Et && !W?.appBar, rt = Tt && !W?.navigationBar;
1065
- t && t.setAttribute("data-flemo-bar-riding", Pt ? "true" : "false"), h && h.setAttribute("data-flemo-bar-riding", rt ? "true" : "false");
1066
- };
1067
- E();
1068
- const H = Z.subscribe(E), C = pt.subscribe(E);
1069
- return () => {
1070
- H(), C(), t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
1071
- };
1072
- }, [Kt, b, l, Et, Tt]);
1073
- const he = (() => {
1074
- if (!b) return {};
1075
- if (O !== "PUSHING" && O !== "REPLACING") return {};
1076
- const t = {};
1077
- return typeof g.x == "number" && (t.transform = `translateX(${g.x}px)`), typeof g.x == "string" && (t.transform = `translateX(${g.x})`), typeof g.y == "number" && (t.transform = `translateY(${g.y}px)`), typeof g.y == "string" && (t.transform = `translateY(${g.y})`), typeof g.opacity == "number" && (t.opacity = `${g.opacity}`), t;
1078
- })();
1079
- return /* @__PURE__ */ Bt(
1080
- "div",
1081
- {
1082
- ref: Xt,
1083
- style: {
1084
- position: "fixed",
1085
- top: 0,
1086
- left: 0,
1087
- width: "100%",
1088
- height: "100%",
1089
- display: "flex",
1090
- // `contain: layout style` keeps layout/style scoped without `paint`,
1091
- // which would make this element the containing block for `position:
1092
- // fixed` descendants and trap consumer overlays (e.g. bottom sheets)
1093
- // inside the screen.
1094
- contain: "layout style",
1095
- flexDirection: "column",
1096
- boxSizing: "border-box",
1097
- overscrollBehavior: "contain"
1098
- },
1099
- children: [
1100
- /* @__PURE__ */ k(
1101
- "div",
1102
- {
1103
- "data-swipe-at-edge-bar": !0,
1104
- style: {
1105
- position: "fixed",
1106
- top: 0,
1107
- left: 0,
1108
- width: 8,
1109
- height: "100%",
1110
- zIndex: 1
1111
- }
1112
- }
1113
- ),
1114
- /* @__PURE__ */ Bt(
1115
- "div",
1116
- {
1117
- ref: _,
1118
- ...R,
1119
- onPointerDown: fe,
1120
- onPointerMove: me,
1121
- onPointerUp: zt,
1122
- onPointerCancel: zt,
1123
- "data-flemo-screen": !0,
1124
- "data-flemo-transition": $,
1125
- "data-flemo-status": O,
1126
- "data-flemo-active": b ? "true" : "false",
1127
- style: {
1128
- display: "flex",
1129
- flexDirection: "column",
1130
- height: "100%",
1131
- backgroundColor: f,
1132
- overflowY: L ? void 0 : "auto",
1133
- touchAction: m === "x" ? "pan-y" : m === "y" ? "pan-x" : "auto",
1134
- ...he,
1135
- ...R.style
1136
- },
1137
- children: [
1138
- !p && e && /* @__PURE__ */ k("div", { style: { minHeight: e }, children: /* @__PURE__ */ k(
1139
- "div",
1140
- {
1141
- style: {
1142
- position: "fixed",
1143
- top: 0,
1144
- width: "100%",
1145
- minHeight: e,
1146
- backgroundColor: r
1147
- }
1148
- }
1149
- ) }),
1150
- i && /* @__PURE__ */ k(
1151
- "div",
1152
- {
1153
- style: {
1154
- width: "100%",
1155
- minHeight: Y
1156
- }
1157
- }
1158
- ),
1159
- w,
1160
- /* @__PURE__ */ k(
1161
- "div",
1162
- {
1163
- style: {
1164
- display: "flex",
1165
- flexDirection: "column",
1166
- flexGrow: 1,
1167
- overflowY: L ? "auto" : void 0
1168
- },
1169
- children: n
1170
- }
1171
- ),
1172
- T,
1173
- s && /* @__PURE__ */ k(
1174
- "div",
1175
- {
1176
- style: {
1177
- display: I ? "none" : void 0,
1178
- width: "100%",
1179
- minHeight: B
1180
- }
1181
- }
1182
- ),
1183
- !P && c && /* @__PURE__ */ k(
1184
- "div",
1185
- {
1186
- style: {
1187
- display: I ? "none" : void 0,
1188
- minHeight: c
1189
- },
1190
- children: /* @__PURE__ */ k(
1191
- "div",
1192
- {
1193
- style: {
1194
- position: "fixed",
1195
- bottom: 0,
1196
- width: "100%",
1197
- minHeight: c,
1198
- backgroundColor: a
1199
- }
1200
- }
1201
- )
1202
- }
1203
- )
1204
- ]
1205
- }
1206
- ),
1207
- i && /* @__PURE__ */ k(
1208
- "div",
1209
- {
1210
- ref: st,
1211
- "data-flemo-bar": "app",
1212
- "data-flemo-bar-transition": $,
1213
- "data-flemo-bar-status": O,
1214
- "data-flemo-bar-active": b ? "true" : "false",
1215
- style: {
1216
- position: "fixed",
1217
- top: p ? 0 : e,
1218
- left: 0,
1219
- width: "100%",
1220
- zIndex: 1
1221
- },
1222
- children: i
1223
- }
1224
- ),
1225
- s && /* @__PURE__ */ k(
1226
- "div",
1227
- {
1228
- ref: at,
1229
- "data-flemo-bar": "nav",
1230
- "data-flemo-bar-transition": $,
1231
- "data-flemo-bar-status": O,
1232
- "data-flemo-bar-active": b ? "true" : "false",
1233
- style: {
1234
- display: I ? "none" : void 0,
1235
- position: "fixed",
1236
- bottom: P ? 0 : c,
1237
- left: 0,
1238
- width: "100%",
1239
- zIndex: 1
1240
- },
1241
- children: s
1242
- }
1243
- ),
1244
- S && /* @__PURE__ */ k(Ge, { ref: K }),
1245
- /* @__PURE__ */ k(
1246
- "div",
1247
- {
1248
- "data-swipe-at-edge-bar": !0,
1249
- style: {
1250
- position: "fixed",
1251
- top: 0,
1252
- right: 0,
1253
- width: 8,
1254
- height: "100%",
1255
- zIndex: 1
1256
- }
1257
- }
1258
- )
1259
- ]
1260
- }
1261
- );
716
+ //#endregion
717
+ //#region src/transition/animateInline.ts
718
+ var we = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, J = /* @__PURE__ */ new WeakMap(), Y = (e, t) => {
719
+ let n = J.get(e);
720
+ n || (n = /* @__PURE__ */ new Set(), J.set(e, n)), n.add(t);
721
+ }, X = (e, t) => {
722
+ if (e.style.transition = "", t) {
723
+ let n = J.get(e);
724
+ for (let r of t) e.style.removeProperty(r), n?.delete(r);
725
+ return;
726
+ }
727
+ let n = J.get(e);
728
+ if (n && n.size > 0) {
729
+ for (let t of n) e.style.removeProperty(t);
730
+ n.clear();
731
+ return;
732
+ }
733
+ e.style.removeProperty("transform"), e.style.removeProperty("opacity");
734
+ }, Z = (e, t, n = {}) => {
735
+ if (!we(e)) return Promise.resolve();
736
+ let r = e, i = C(t);
737
+ if (i.length === 0) return Promise.resolve();
738
+ let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = re(n.ease);
739
+ if (a <= 0 && o <= 0) {
740
+ r.style.transition = "none";
741
+ for (let e of i) r.style.setProperty(e.property, e.value), Y(r, e.property);
742
+ return Promise.resolve();
743
+ }
744
+ let c = i.map((e) => `${e.property} ${a}s ${s} ${o}s`).join(", ");
745
+ r.style.transition = c, r.offsetWidth;
746
+ for (let e of i) r.style.setProperty(e.property, e.value), Y(r, e.property);
747
+ return new Promise((e) => {
748
+ let t = !1, n = () => {
749
+ t || (t = !0, r.removeEventListener("transitionend", i), e());
750
+ }, i = (e) => {
751
+ e.target === r && n();
752
+ };
753
+ r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
754
+ });
755
+ };
756
+ //#endregion
757
+ //#region src/stores/useScreenStore.ts
758
+ function Te(e) {
759
+ return P(D().screen, e);
1262
760
  }
1263
- function tn({ children: n, ...e }) {
1264
- const { isActive: r, isPrev: c, zIndex: a } = gt(), i = G((f) => f.index), s = J((f) => f.status), w = Z((f) => f.dragStatus), T = Z((f) => f.replaceTransitionStatus), P = !r && (s === "COMPLETED" && w === "IDLE") || c && i - 2 <= a && T === "IDLE" || c && i - 2 > a;
1265
- return /* @__PURE__ */ k(Oe, { freeze: P, children: /* @__PURE__ */ k(Fe, { ...e, children: n }) });
761
+ //#endregion
762
+ //#region src/screen/ScreenMotion.tsx
763
+ var Q = "data-flemo-skip-animation";
764
+ function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: a, sharedAppBar: o, sharedNavigationBar: c, appBar: m, navigationBar: h, hideStatusBar: g, hideSystemNavigationBar: _, backgroundColor: v = "white", contentScrollable: ee = !0, ...te }) {
765
+ let { id: y, isActive: b, isRoot: re, zIndex: ae, transitionName: x, prevTransitionName: oe } = A(), S = D(), C = xe((e) => e.status), le = Te((e) => e.dragStatus), E = S.screen.getState().setDragStatus, ue = S.screen.getState().setReplaceTransitionStatus, O = F((e) => e.index), k = w.get(x) ?? w.get("none"), { initial: j, swipeDirection: M, decoratorName: de } = k, fe = ne.get(de), { viewportScrollHeight: N } = Ce(), pe = N > 0, [me, P] = u(0), [he, ge] = u(0), _e = l(null), I = l(null), L = l(null), R = l(null), z = l(null), B = l({
766
+ current: [],
767
+ prev: []
768
+ }), V = l(!1), H = l(!1), U = l(!1), ve = l(0), W = l({
769
+ x: 0,
770
+ y: 0
771
+ }), G = l({
772
+ x: 0,
773
+ y: 0
774
+ }), ye = l(0), be = l({
775
+ x: 0,
776
+ y: 0
777
+ }), K = l({
778
+ element: null,
779
+ hasMarker: !1
780
+ }), q = l({
781
+ element: null,
782
+ hasMarker: !1
783
+ }), we = l(0), J = l(0), Y = l(null), $ = l(null), Ee = (e) => {
784
+ let t = G.current;
785
+ return {
786
+ point: {
787
+ x: e.clientX,
788
+ y: e.clientY
789
+ },
790
+ offset: {
791
+ x: e.clientX - W.current.x,
792
+ y: e.clientY - W.current.y
793
+ },
794
+ delta: {
795
+ x: e.clientX - t.x,
796
+ y: e.clientY - t.y
797
+ },
798
+ velocity: be.current
799
+ };
800
+ }, De = (e) => {
801
+ let t = e.timeStamp, n = Math.max(1, t - ye.current), r = G.current;
802
+ be.current = {
803
+ x: (e.clientX - r.x) / n * 1e3,
804
+ y: (e.clientY - r.y) / n * 1e3
805
+ }, G.current = {
806
+ x: e.clientX,
807
+ y: e.clientY
808
+ }, ye.current = t;
809
+ }, Oe = (e, t, n) => {
810
+ let r = Z(e, t, n);
811
+ if (e === I.current) for (let e of B.current.current) Z(e, t, n);
812
+ else if (e === L.current) for (let e of B.current.prev) Z(e, t, n);
813
+ return r;
814
+ }, ke = (e) => {
815
+ let t = b ? S.history.getState().histories[O - 1]?.id : S.history.getState().histories[O]?.id, n = t ? S.screen.getState().sharedBars[t] : void 0, r = [], i = Y.current, a = $.current;
816
+ i && Re && !n?.appBar && r.push(i), a && ze && !n?.navigationBar && r.push(a);
817
+ let o = [];
818
+ if (e) {
819
+ let t = e.querySelector("[data-flemo-bar=\"app\"]"), n = e.querySelector("[data-flemo-bar=\"nav\"]");
820
+ t && !Re && o.push(t), n && !ze && o.push(n);
821
+ }
822
+ B.current = {
823
+ current: r,
824
+ prev: o
825
+ };
826
+ let s = p(k).join(", ");
827
+ for (let e of r) e.style.willChange = s;
828
+ for (let e of o) e.style.willChange = s;
829
+ }, Ae = () => {
830
+ for (let e of B.current.current) X(e), e.style.removeProperty("will-change");
831
+ for (let e of B.current.prev) X(e), e.style.removeProperty("will-change");
832
+ B.current = {
833
+ current: [],
834
+ prev: []
835
+ };
836
+ }, je = async (e) => {
837
+ if (!M || N > 10) return;
838
+ let t = I.current;
839
+ if (!t) return;
840
+ let n = _e.current?.parentElement?.previousElementSibling;
841
+ L.current = n?.querySelector("[data-flemo-screen]") ?? null, z.current = n?.querySelector("[data-flemo-decorator]") ?? null, L.current && (U.current = !0, ve.current = e.timeStamp, W.current = {
842
+ x: e.clientX,
843
+ y: e.clientY
844
+ }, G.current = {
845
+ x: e.clientX,
846
+ y: e.clientY
847
+ }, ye.current = e.timeStamp, be.current = {
848
+ x: 0,
849
+ y: 0
850
+ }, t.setPointerCapture(e.pointerId), ke(n), await k?.onSwipeStart(e, Ee(e), {
851
+ animate: Oe,
852
+ currentScreen: t,
853
+ prevScreen: L.current,
854
+ onStart: (e) => fe?.onSwipeStart?.(e, {
855
+ animate: Z,
856
+ currentDecorator: R.current,
857
+ prevDecorator: z.current
858
+ })
859
+ }) ? E("PENDING") : (E("IDLE"), U.current = !1, Ae()));
860
+ }, Me = (e) => {
861
+ !M || !U.current || N > 10 || (De(e), k.onSwipe(e, Ee(e), {
862
+ animate: Oe,
863
+ currentScreen: I.current,
864
+ prevScreen: L.current,
865
+ onProgress: (e, t) => fe?.onSwipe?.(e, t, {
866
+ animate: Z,
867
+ currentDecorator: R.current,
868
+ prevDecorator: z.current
869
+ })
870
+ }));
871
+ }, Ne = async (e) => {
872
+ if (!M || !U.current) return;
873
+ U.current = !1;
874
+ let t = I.current;
875
+ t && t.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId);
876
+ let n = Ee(e);
877
+ if (await k?.onSwipeEnd(e, n, {
878
+ animate: Oe,
879
+ currentScreen: I.current,
880
+ prevScreen: L.current,
881
+ onStart: (e) => fe?.onSwipeEnd?.(e, {
882
+ animate: Z,
883
+ currentDecorator: R.current,
884
+ prevDecorator: z.current
885
+ })
886
+ })) {
887
+ I.current?.setAttribute(Q, "true"), R.current?.setAttribute(Q, "true");
888
+ for (let e of B.current.current) e.style.removeProperty("will-change");
889
+ for (let e of B.current.prev) X(e), e.style.removeProperty("will-change");
890
+ B.current = {
891
+ current: [],
892
+ prev: []
893
+ }, window.history.back();
894
+ } else X(I.current), L.current && X(L.current), R.current && X(R.current), z.current && X(z.current), Ae(), E("IDLE");
895
+ }, Pe = (e) => {
896
+ !re && b && C === "COMPLETED" && le === "IDLE" && M && N < 10 && (K.current = ie(e.target, {
897
+ direction: "x",
898
+ verifyByScroll: !0
899
+ }), q.current = ie(e.target, {
900
+ direction: "y",
901
+ verifyByScroll: !0
902
+ }), we.current = e.clientX, J.current = e.clientY, (!K.current.element && !q.current.element || K.current.element || q.current.element) && (V.current = !0));
903
+ }, Fe = (e) => {
904
+ if (N > 10) return;
905
+ if (U.current) {
906
+ Me(e.nativeEvent);
907
+ return;
908
+ }
909
+ let t = !K.current.element && !q.current.element;
910
+ if (V.current && t) {
911
+ V.current = !1, H.current = !0;
912
+ let t = e.clientY - J.current, n = e.clientX - we.current;
913
+ (M === "y" && t > 0 || M === "x" && n > 0) && je(e.nativeEvent);
914
+ } else if (V.current && !t) {
915
+ let t = e.clientX - we.current, n = e.clientY - J.current, r = q.current.element && q.current.element.scrollTop <= 0, i = K.current.element && K.current.element.scrollLeft <= 0 && K.current.hasMarker;
916
+ (M === "y" && (r || K.current.element) && n > 0 && Math.abs(t) < 2 || M === "x" && (i || q.current.element) && t > 0 && Math.abs(n) < 2) && (V.current = !1, H.current = !0, je(e.nativeEvent));
917
+ }
918
+ }, Ie = (e) => {
919
+ V.current = !1, H.current = !1, U.current && Ne(e.nativeEvent);
920
+ };
921
+ i(() => {
922
+ let e = I.current;
923
+ if (!e) return;
924
+ let t = (e) => {
925
+ H.current && e.preventDefault(), e.target?.dataset.swipeAtEdgeBar === "true" && e.preventDefault();
926
+ };
927
+ return e.addEventListener("touchmove", t, { passive: !1 }), () => {
928
+ e.removeEventListener("touchmove", t);
929
+ };
930
+ }, []), s(() => {
931
+ if (!b) {
932
+ C === "REPLACING" && oe !== x && ue("PENDING");
933
+ return;
934
+ }
935
+ if (C === "COMPLETED") {
936
+ E("IDLE"), ue("IDLE"), I.current && (X(I.current), I.current.removeAttribute(Q)), R.current && (X(R.current), R.current.removeAttribute(Q)), Y.current && (X(Y.current), Y.current.style.removeProperty("will-change")), $.current && (X($.current), $.current.style.removeProperty("will-change"));
937
+ return;
938
+ }
939
+ if (C === "IDLE") return;
940
+ let e = I.current;
941
+ if (!e) return;
942
+ let t = () => {
943
+ let e = S.navigate.getState().transitionTaskId;
944
+ e && d.resolveTask(e);
945
+ }, n = `${C}-true`;
946
+ if (!(e.getAttribute(Q) !== "true" && se(k, n))) {
947
+ queueMicrotask(t);
948
+ return;
949
+ }
950
+ let r = f("screen", x, n), i = (n) => {
951
+ n.target === e && n.animationName === r && (e.removeEventListener("animationend", i), t());
952
+ };
953
+ return e.addEventListener("animationend", i), () => {
954
+ e.removeEventListener("animationend", i);
955
+ };
956
+ }, [
957
+ C,
958
+ b,
959
+ y,
960
+ oe,
961
+ x,
962
+ k,
963
+ E,
964
+ ue,
965
+ S.navigate
966
+ ]), s(() => {
967
+ let e = Y.current;
968
+ if (!e) {
969
+ P(0);
970
+ return;
971
+ }
972
+ e.offsetHeight > 0 && P(e.offsetHeight);
973
+ let t = new ResizeObserver(([e]) => {
974
+ e.contentRect.height > 0 && P(e.contentRect.height);
975
+ });
976
+ return t.observe(e), () => {
977
+ t.disconnect();
978
+ };
979
+ }, [o]), s(() => {
980
+ let e = $.current;
981
+ if (!e) {
982
+ ge(0);
983
+ return;
984
+ }
985
+ e.offsetHeight > 0 && ge(e.offsetHeight);
986
+ let t = new ResizeObserver(([e]) => {
987
+ e.contentRect.height > 0 && ge(e.contentRect.height);
988
+ });
989
+ return t.observe(e), () => {
990
+ t.disconnect();
991
+ };
992
+ }, [c]), s(() => {
993
+ let { registerSharedBars: e, unregisterSharedBars: t } = S.screen.getState();
994
+ return e(y, {
995
+ appBar: !!o,
996
+ navigationBar: !!c
997
+ }), () => t(y);
998
+ }, [
999
+ y,
1000
+ o,
1001
+ c,
1002
+ S.screen
1003
+ ]);
1004
+ let Le = b || ae === O - 1, Re = !!o, ze = !!c;
1005
+ s(() => {
1006
+ let e = Y.current, t = $.current;
1007
+ if (!e && !t) return;
1008
+ let n = () => {
1009
+ if (!(S.navigate.getState().status === "PUSHING" || S.navigate.getState().status === "POPPING" || S.navigate.getState().status === "REPLACING") || !Le) {
1010
+ e?.removeAttribute("data-flemo-bar-riding"), t?.removeAttribute("data-flemo-bar-riding");
1011
+ return;
1012
+ }
1013
+ let n = b ? S.history.getState().histories[O - 1]?.id : S.history.getState().histories[O]?.id, r = n ? S.screen.getState().sharedBars[n] : void 0, i = Re && !r?.appBar, a = ze && !r?.navigationBar;
1014
+ e && e.setAttribute("data-flemo-bar-riding", i ? "true" : "false"), t && t.setAttribute("data-flemo-bar-riding", a ? "true" : "false");
1015
+ };
1016
+ n();
1017
+ let r = S.screen.subscribe(n), i = S.navigate.subscribe(n);
1018
+ return () => {
1019
+ r(), i(), e?.removeAttribute("data-flemo-bar-riding"), t?.removeAttribute("data-flemo-bar-riding");
1020
+ };
1021
+ }, [
1022
+ Le,
1023
+ b,
1024
+ O,
1025
+ Re,
1026
+ ze,
1027
+ S.history,
1028
+ S.navigate,
1029
+ S.screen
1030
+ ]);
1031
+ let Be = (() => {
1032
+ if (!b || C !== "PUSHING" && C !== "REPLACING") return {};
1033
+ let e = {};
1034
+ return typeof j.x == "number" && (e.transform = `translateX(${j.x}px)`), typeof j.x == "string" && (e.transform = `translateX(${j.x})`), typeof j.y == "number" && (e.transform = `translateY(${j.y}px)`), typeof j.y == "string" && (e.transform = `translateY(${j.y})`), typeof j.opacity == "number" && (e.opacity = `${j.opacity}`), e;
1035
+ })();
1036
+ return /* @__PURE__ */ ce("div", {
1037
+ ref: _e,
1038
+ style: {
1039
+ position: "fixed",
1040
+ top: 0,
1041
+ left: 0,
1042
+ width: "100%",
1043
+ height: "100%",
1044
+ display: "flex",
1045
+ contain: "layout style",
1046
+ flexDirection: "column",
1047
+ boxSizing: "border-box",
1048
+ overscrollBehavior: "contain"
1049
+ },
1050
+ children: [
1051
+ /* @__PURE__ */ T("div", {
1052
+ "data-swipe-at-edge-bar": !0,
1053
+ style: {
1054
+ position: "fixed",
1055
+ top: 0,
1056
+ left: 0,
1057
+ width: 8,
1058
+ height: "100%",
1059
+ zIndex: 1
1060
+ }
1061
+ }),
1062
+ /* @__PURE__ */ ce("div", {
1063
+ ref: I,
1064
+ ...te,
1065
+ onPointerDown: Pe,
1066
+ onPointerMove: Fe,
1067
+ onPointerUp: Ie,
1068
+ onPointerCancel: Ie,
1069
+ "data-flemo-screen": !0,
1070
+ "data-flemo-transition": x,
1071
+ "data-flemo-status": C,
1072
+ "data-flemo-active": b ? "true" : "false",
1073
+ style: {
1074
+ display: "flex",
1075
+ flexDirection: "column",
1076
+ height: "100%",
1077
+ backgroundColor: v,
1078
+ overflowY: ee ? void 0 : "auto",
1079
+ touchAction: M === "x" ? "pan-y" : M === "y" ? "pan-x" : "auto",
1080
+ ...Be,
1081
+ ...te.style
1082
+ },
1083
+ children: [
1084
+ !g && t && /* @__PURE__ */ T("div", {
1085
+ style: { minHeight: t },
1086
+ children: /* @__PURE__ */ T("div", { style: {
1087
+ position: "fixed",
1088
+ top: 0,
1089
+ width: "100%",
1090
+ minHeight: t,
1091
+ backgroundColor: n
1092
+ } })
1093
+ }),
1094
+ o && /* @__PURE__ */ T("div", { style: {
1095
+ width: "100%",
1096
+ minHeight: me
1097
+ } }),
1098
+ m,
1099
+ /* @__PURE__ */ T("div", {
1100
+ style: {
1101
+ display: "flex",
1102
+ flexDirection: "column",
1103
+ flexGrow: 1,
1104
+ overflowY: ee ? "auto" : void 0
1105
+ },
1106
+ children: e
1107
+ }),
1108
+ h,
1109
+ c && /* @__PURE__ */ T("div", { style: {
1110
+ display: pe ? "none" : void 0,
1111
+ width: "100%",
1112
+ minHeight: he
1113
+ } }),
1114
+ !_ && r && /* @__PURE__ */ T("div", {
1115
+ style: {
1116
+ display: pe ? "none" : void 0,
1117
+ minHeight: r
1118
+ },
1119
+ children: /* @__PURE__ */ T("div", { style: {
1120
+ position: "fixed",
1121
+ bottom: 0,
1122
+ width: "100%",
1123
+ minHeight: r,
1124
+ backgroundColor: a
1125
+ } })
1126
+ })
1127
+ ]
1128
+ }),
1129
+ o && /* @__PURE__ */ T("div", {
1130
+ ref: Y,
1131
+ "data-flemo-bar": "app",
1132
+ "data-flemo-bar-transition": x,
1133
+ "data-flemo-bar-status": C,
1134
+ "data-flemo-bar-active": b ? "true" : "false",
1135
+ style: {
1136
+ position: "fixed",
1137
+ top: g ? 0 : t,
1138
+ left: 0,
1139
+ width: "100%",
1140
+ zIndex: 1
1141
+ },
1142
+ children: o
1143
+ }),
1144
+ c && /* @__PURE__ */ T("div", {
1145
+ ref: $,
1146
+ "data-flemo-bar": "nav",
1147
+ "data-flemo-bar-transition": x,
1148
+ "data-flemo-bar-status": C,
1149
+ "data-flemo-bar-active": b ? "true" : "false",
1150
+ style: {
1151
+ display: pe ? "none" : void 0,
1152
+ position: "fixed",
1153
+ bottom: _ ? 0 : r,
1154
+ left: 0,
1155
+ width: "100%",
1156
+ zIndex: 1
1157
+ },
1158
+ children: c
1159
+ }),
1160
+ fe && /* @__PURE__ */ T(Se, { ref: R }),
1161
+ /* @__PURE__ */ T("div", {
1162
+ "data-swipe-at-edge-bar": !0,
1163
+ style: {
1164
+ position: "fixed",
1165
+ top: 0,
1166
+ right: 0,
1167
+ width: 8,
1168
+ height: "100%",
1169
+ zIndex: 1
1170
+ }
1171
+ })
1172
+ ]
1173
+ });
1266
1174
  }
1267
- export {
1268
- We as Route,
1269
- Ke as Router,
1270
- tn as Screen,
1271
- ie as ScreenContext,
1272
- Ge as ScreenDecorator,
1273
- Oe as ScreenFreeze,
1274
- Fe as ScreenMotion,
1275
- rn as createDecorator,
1276
- on as createRawDecorator,
1277
- sn as createRawTransition,
1278
- an as createTransition,
1279
- Je as useNavigate,
1280
- Ze as useParams,
1281
- gt as useScreen,
1282
- Z as useScreenStore,
1283
- Qe as useStep,
1284
- _e as useViewportScrollHeight
1285
- };
1175
+ //#endregion
1176
+ //#region src/screen/Screen.tsx
1177
+ function Ee({ children: e, ...t }) {
1178
+ let { isActive: n, isPrev: r, zIndex: i } = A(), a = F((e) => e.index), o = xe((e) => e.status), s = Te((e) => e.dragStatus), c = Te((e) => e.replaceTransitionStatus);
1179
+ return /* @__PURE__ */ T(K, {
1180
+ freeze: !n && o === "COMPLETED" && s === "IDLE" || r && a - 2 <= i && c === "IDLE" || r && a - 2 > i,
1181
+ children: /* @__PURE__ */ T($, {
1182
+ ...t,
1183
+ children: e
1184
+ })
1185
+ });
1186
+ }
1187
+ //#endregion
1188
+ //#region src/stores/RouterScopeProvider.tsx
1189
+ function De({ children: e }) {
1190
+ let [t] = u(() => ({
1191
+ history: _(),
1192
+ navigate: v(),
1193
+ transition: b(),
1194
+ screen: ge()
1195
+ }));
1196
+ return /* @__PURE__ */ T(E.Provider, {
1197
+ value: t,
1198
+ children: e
1199
+ });
1200
+ }
1201
+ //#endregion
1202
+ export { V as Route, B as Router, De as RouterScopeProvider, Ee as Screen, k as ScreenContext, Se as ScreenDecorator, K as ScreenFreeze, $ as ScreenMotion, g as createDecorator, ee as createRawDecorator, te as createRawTransition, y as createTransition, F as useHistoryStore, G as useNavigate, xe as useNavigateStore, be as useParams, A as useScreen, Te as useScreenStore, ye as useStep, D as useStores, Ce as useViewportScrollHeight };