@declarion/react 0.48.2 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/Check-DAfMbQIw.js +38 -0
- package/dist-lib/{DraggableChildrenTable-p2ZSdwzj.js → DraggableChildrenTable-B98Md-Yq.js} +30 -30
- package/dist-lib/{Grid-CjLFAKMZ.js → Grid-BdtEd4R9.js} +2 -2
- package/dist-lib/{LayoutRenderer-DCscqXsv.js → LayoutRenderer-oVU3nEb5.js} +600 -597
- package/dist-lib/ListCardsBody-DYMt1H8l.js +287 -0
- package/dist-lib/{MarkdownRenderer-Sb7zcvj0.js → MarkdownRenderer-E9hbyoUn.js} +1 -1
- package/dist-lib/RefreshControl-B_2eW53M.js +430 -0
- package/dist-lib/{SmartDetailPage.impl-BAW-Tx_H.js → SmartDetailPage.impl-Dg22HOxb.js} +520 -515
- package/dist-lib/SmartListPage.impl-CPhhXT5S.js +2849 -0
- package/dist-lib/{SmartRecordListPage.impl-DtSSlGrI.js → SmartRecordListPage.impl-CF0UKgUj.js} +243 -240
- package/dist-lib/SortHeaderMenu-DodGvb7A.js +106 -0
- package/dist-lib/action-dispatch-CYOw7nkP.js +1984 -0
- package/dist-lib/api/batch.d.ts +5 -2
- package/dist-lib/api/data.d.ts +35 -4
- package/dist-lib/api/entities.d.ts +3 -3
- package/dist-lib/cardProjection-D-AufCh-.js +757 -0
- package/dist-lib/components/{shared → actions}/ObjectActionBar.d.ts +1 -1
- package/dist-lib/components/{shared → actions}/ResponsiveActionBar.d.ts +1 -1
- package/dist-lib/components/fields/cells/factories/date.d.ts +2 -0
- package/dist-lib/components/file-widgets/upload.d.ts +6 -1
- package/dist-lib/components/layout/Layout.d.ts +1 -1
- package/dist-lib/components/layout/TopBar.d.ts +1 -1
- package/dist-lib/components/pages/SmartListPage.d.ts +2 -12
- package/dist-lib/components/pages/SmartListPage.impl.d.ts +4 -0
- package/dist-lib/components/pages/list/ListCardRow.d.ts +40 -0
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +34 -0
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFooter.d.ts +26 -0
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/pages/list/ListNoRows.d.ts +32 -0
- package/dist-lib/components/pages/list/ListTable.d.ts +34 -0
- package/dist-lib/components/pages/list/ListTableRow.d.ts +18 -0
- package/dist-lib/components/pages/list/ListToolbar.d.ts +43 -0
- package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +14 -0
- package/dist-lib/components/pages/list/page-size.d.ts +3 -0
- package/dist-lib/components/pages/list/sortable-header.d.ts +2 -0
- package/dist-lib/components/pages/list/useListColumnLayout.d.ts +37 -0
- package/dist-lib/components/pages/list/useListQuery.d.ts +66 -0
- package/dist-lib/components/pages/list/useListRowInteraction.d.ts +61 -0
- package/dist-lib/components/pages/list/useListSelection.d.ts +31 -0
- package/dist-lib/components/pages/list/useListSort.d.ts +45 -0
- package/dist-lib/components/pages/list/useListViews.d.ts +46 -0
- package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +17 -4
- package/dist-lib/field-classification-DTgUnbzd.js +1134 -0
- package/dist-lib/format-count-DAHCcHZO.js +1551 -0
- package/dist-lib/hooks/useBrandingChrome.d.ts +17 -1
- package/dist-lib/hooks/useText.d.ts +3 -0
- package/dist-lib/hooks/useViews.d.ts +1 -1
- package/dist-lib/index.d.ts +17 -15
- package/dist-lib/index.js +1783 -6287
- package/dist-lib/lib/messages.d.ts +7 -1
- package/dist-lib/lib/rowClickGesture.d.ts +12 -0
- package/dist-lib/lib/timestamp.d.ts +8 -3
- package/dist-lib/peekDraftStore-CnxqkoWN.js +194 -0
- package/dist-lib/record-documents-key-DEFlLxnF.js +27 -0
- package/dist-lib/registry-WypUQQ7t.js +1768 -0
- package/dist-lib/testing.d.ts +17 -2
- package/dist-lib/testing.js +72 -58
- package/dist-lib/types/api.d.ts +54 -12
- package/dist-lib/types/schema.d.ts +22 -6
- package/dist-lib/{useCurrentScreen-BshVTPVq.js → useCurrentScreen-C5Oio-1G.js} +1125 -1068
- package/dist-lib/useListQuery-Dc2vbxqs.js +87 -0
- package/dist-lib/useProperties-C36ENFdY.js +81 -0
- package/dist-lib/{useProperties-DrHFr0A1.js → useTabSearchMirror-sIuYEFaq.js} +116 -194
- package/dist-lib/{value-B1O6QikE.js → value-igT4LsqW.js} +69 -69
- package/package.json +1 -1
- package/dist-lib/RefreshControl-Cnl9nE0x.js +0 -945
- package/dist-lib/registry-CCxnZW2b.js +0 -5281
- /package/dist-lib/components/{shared → actions}/ActionButton.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionDialog.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionResultDialog.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionRunner.d.ts +0 -0
- /package/dist-lib/components/{mass-edit → actions}/PropertyGridEditor.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/RowActionsKebab.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/AssociationTabs.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/AuditMetaStrip.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/Breadcrumbs.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/HighlightsStrip.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/PageHeader.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/RecordHeader.d.ts +0 -0
- /package/dist-lib/components/{shell → layout}/CommandPalette.d.ts +0 -0
- /package/dist-lib/components/{columns → list}/ColumnPicker.d.ts +0 -0
- /package/dist-lib/components/{views → list}/ViewSwitcher.d.ts +0 -0
|
@@ -0,0 +1,1134 @@
|
|
|
1
|
+
import { At as e, Fn as t, Gt as n, St as r, Tt as i, _t as a, bt as o, jt as s, kn as c, kt as l, mt as u, ot as d, pt as f, rt as p, st as m, vt as h } from "./useCurrentScreen-C5Oio-1G.js";
|
|
2
|
+
import { useCallback as g, useEffect as _, useMemo as v, useRef as ee, useState as te } from "react";
|
|
3
|
+
import { parsePath as ne, useLocation as re, useNavigate as ie } from "react-router";
|
|
4
|
+
import { useMutation as y, useQuery as b, useQueryClient as x } from "@tanstack/react-query";
|
|
5
|
+
import { create as S } from "zustand";
|
|
6
|
+
//#region src/api/params.ts
|
|
7
|
+
async function ae() {
|
|
8
|
+
let e = (await n("/api/params/public")).data;
|
|
9
|
+
if (Array.isArray(e)) return { parameters: e };
|
|
10
|
+
let t = e ?? {};
|
|
11
|
+
return {
|
|
12
|
+
parameters: t.parameters ?? [],
|
|
13
|
+
accents: t.accents,
|
|
14
|
+
messages: t.messages,
|
|
15
|
+
meta: t.meta
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function oe(e) {
|
|
19
|
+
return (await n(`/api/params/${encodeURIComponent(e)}`)).data;
|
|
20
|
+
}
|
|
21
|
+
async function se(e) {
|
|
22
|
+
return (await n(`/api/params${e === "tenant" ? "?resolution=tenant" : ""}`)).data ?? [];
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/hooks/useParams.ts
|
|
26
|
+
var ce = "$params";
|
|
27
|
+
function le({ carrierEntityCode: e, rowId: t, enabled: n = !0, onWritten: i }) {
|
|
28
|
+
let a = x(), [s, c] = te(null), l = b({
|
|
29
|
+
queryKey: [
|
|
30
|
+
"params-carrier-detail",
|
|
31
|
+
e,
|
|
32
|
+
t
|
|
33
|
+
],
|
|
34
|
+
queryFn: () => r(e, t),
|
|
35
|
+
enabled: n && !!t,
|
|
36
|
+
staleTime: 3e4
|
|
37
|
+
}), u = l.data?.data, d = !!u && !("$params" in u), f = v(() => Array.isArray(u?.$params) ? u[ce] : [], [u]), p = v(() => new Map(f.map((e) => [e.param_code, e])), [f]), m = g(async (n) => {
|
|
38
|
+
c(null);
|
|
39
|
+
try {
|
|
40
|
+
await o(`${e}.__update`, {
|
|
41
|
+
object_ids: [t],
|
|
42
|
+
entity: e,
|
|
43
|
+
fields: { [ce]: n }
|
|
44
|
+
}), await a.invalidateQueries({ queryKey: ["params-all"] }), await a.invalidateQueries({ queryKey: [
|
|
45
|
+
"params-carrier-detail",
|
|
46
|
+
e,
|
|
47
|
+
t
|
|
48
|
+
] }), i?.();
|
|
49
|
+
} catch (e) {
|
|
50
|
+
c(e instanceof Error ? e.message : "Failed to save parameter.");
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
e,
|
|
54
|
+
t,
|
|
55
|
+
a,
|
|
56
|
+
i
|
|
57
|
+
]), h = g((e, t) => {
|
|
58
|
+
let n = f.filter((t) => t.param_code !== e.code);
|
|
59
|
+
return n.push({
|
|
60
|
+
param_code: e.code,
|
|
61
|
+
value: t
|
|
62
|
+
}), m(n);
|
|
63
|
+
}, [f, m]), _ = g((e) => m(f.filter((t) => t.param_code !== e.code)), [f, m]), ee = g(() => c(null), []);
|
|
64
|
+
return {
|
|
65
|
+
overrides: f,
|
|
66
|
+
overrideByCode: p,
|
|
67
|
+
missingParams: d,
|
|
68
|
+
isLoading: l.isLoading,
|
|
69
|
+
error: s,
|
|
70
|
+
clearError: ee,
|
|
71
|
+
save: h,
|
|
72
|
+
reset: _
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function ue(e) {
|
|
76
|
+
return b({
|
|
77
|
+
queryKey: ["params-all", e ?? "full"],
|
|
78
|
+
queryFn: () => se(e),
|
|
79
|
+
staleTime: 3e4
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function de() {
|
|
83
|
+
return b({
|
|
84
|
+
queryKey: ["params-public"],
|
|
85
|
+
queryFn: ae,
|
|
86
|
+
staleTime: 3e5
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function fe(e, t = {}) {
|
|
90
|
+
let n = t.enabled ?? !0;
|
|
91
|
+
return b({
|
|
92
|
+
queryKey: ["params", e],
|
|
93
|
+
queryFn: () => oe(e),
|
|
94
|
+
enabled: !!e && n,
|
|
95
|
+
staleTime: 6e4
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function pe(e) {
|
|
99
|
+
let t = s((e) => e.isAuthenticated), n = de(), r = fe(e, { enabled: t }), i = me(n.data?.parameters, e);
|
|
100
|
+
if (t && r.data?.found) return {
|
|
101
|
+
value: r.data.value,
|
|
102
|
+
found: !0,
|
|
103
|
+
source: r.data.source,
|
|
104
|
+
loading: !1,
|
|
105
|
+
error: null
|
|
106
|
+
};
|
|
107
|
+
let a = i !== void 0;
|
|
108
|
+
return {
|
|
109
|
+
value: i?.value,
|
|
110
|
+
found: a,
|
|
111
|
+
source: a ? "public" : void 0,
|
|
112
|
+
loading: n.isLoading || t && r.isLoading && !r.data && !r.error,
|
|
113
|
+
error: r.error ?? n.error ?? null
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function me(e, t) {
|
|
117
|
+
return e?.find((e) => e.code === t);
|
|
118
|
+
}
|
|
119
|
+
function he(e, t) {
|
|
120
|
+
let n = b({
|
|
121
|
+
queryKey: ["params", e],
|
|
122
|
+
queryFn: () => oe(e),
|
|
123
|
+
enabled: !!e,
|
|
124
|
+
staleTime: 6e4
|
|
125
|
+
}), r = n.data, i = !!r?.found;
|
|
126
|
+
return {
|
|
127
|
+
value: i ? r.value : t,
|
|
128
|
+
found: i,
|
|
129
|
+
source: r?.source,
|
|
130
|
+
loading: n.isLoading,
|
|
131
|
+
error: n.error ?? null
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/stores/preferences.ts
|
|
136
|
+
var ge = {
|
|
137
|
+
colorScheme: "light",
|
|
138
|
+
accent: "violet",
|
|
139
|
+
density: "compact",
|
|
140
|
+
sidebar: "wide",
|
|
141
|
+
tabsPosition: "top",
|
|
142
|
+
tabsMaxOpen: 12,
|
|
143
|
+
tabsPersist: !0,
|
|
144
|
+
radius: 7,
|
|
145
|
+
zebra: !0,
|
|
146
|
+
aiSurface: "both",
|
|
147
|
+
toastPosition: "bottom-right"
|
|
148
|
+
}, _e = ["light", "dark"], ve = [
|
|
149
|
+
"violet",
|
|
150
|
+
"blue",
|
|
151
|
+
"teal",
|
|
152
|
+
"amber",
|
|
153
|
+
"rose"
|
|
154
|
+
], ye = [
|
|
155
|
+
"compact",
|
|
156
|
+
"comfortable",
|
|
157
|
+
"cozy"
|
|
158
|
+
], be = ["wide", "collapsed"], xe = ["top", "bottom"], Se = [
|
|
159
|
+
"command",
|
|
160
|
+
"panel",
|
|
161
|
+
"both",
|
|
162
|
+
"off"
|
|
163
|
+
], Ce = [
|
|
164
|
+
"top-left",
|
|
165
|
+
"top-center",
|
|
166
|
+
"top-right",
|
|
167
|
+
"bottom-left",
|
|
168
|
+
"bottom-center",
|
|
169
|
+
"bottom-right"
|
|
170
|
+
];
|
|
171
|
+
function C(e, t) {
|
|
172
|
+
return typeof t == "string" && e.includes(t) ? t : void 0;
|
|
173
|
+
}
|
|
174
|
+
function w(e) {
|
|
175
|
+
let t = {}, n = C(_e, e.colorScheme);
|
|
176
|
+
n && (t.colorScheme = n);
|
|
177
|
+
let r = C(ve, e.accent);
|
|
178
|
+
r && (t.accent = r);
|
|
179
|
+
let i = C(ye, e.density);
|
|
180
|
+
i && (t.density = i);
|
|
181
|
+
let a = C(be, e.sidebar);
|
|
182
|
+
a && (t.sidebar = a);
|
|
183
|
+
let o = C(xe, e.tabsPosition);
|
|
184
|
+
o && (t.tabsPosition = o);
|
|
185
|
+
let s = C(Se, e.aiSurface);
|
|
186
|
+
s && (t.aiSurface = s);
|
|
187
|
+
let c = C(Ce, e.toastPosition);
|
|
188
|
+
return c && (t.toastPosition = c), typeof e.tabsMaxOpen == "number" && e.tabsMaxOpen > 0 && (t.tabsMaxOpen = e.tabsMaxOpen), typeof e.radius == "number" && e.radius >= 0 && e.radius <= 32 && (t.radius = e.radius), typeof e.zebra == "boolean" && (t.zebra = e.zebra), typeof e.tabsPersist == "boolean" && (t.tabsPersist = e.tabsPersist), t;
|
|
189
|
+
}
|
|
190
|
+
var we = ["declarion-preferences", "declarion-appearance"];
|
|
191
|
+
function Te() {
|
|
192
|
+
if (!(typeof window > "u")) try {
|
|
193
|
+
for (let e of we) localStorage.removeItem(e);
|
|
194
|
+
} catch {}
|
|
195
|
+
}
|
|
196
|
+
function T(e) {
|
|
197
|
+
if (typeof document > "u") return;
|
|
198
|
+
let t = document.documentElement;
|
|
199
|
+
t.dataset.colorScheme = e.colorScheme, t.dataset.accent = e.accent, t.dataset.density = e.density, t.dataset.sidebar = e.sidebar, t.dataset.tabbar = e.tabsPosition, t.dataset.zebra = e.zebra ? "on" : "off", t.dataset.ai = e.aiSurface, t.style.setProperty("--radius-md", `${e.radius}px`), t.style.setProperty("--radius-lg", `${e.radius + 3}px`);
|
|
200
|
+
}
|
|
201
|
+
function Ee(e) {
|
|
202
|
+
return {
|
|
203
|
+
colorScheme: e.color_scheme,
|
|
204
|
+
accent: e.accent,
|
|
205
|
+
density: e.density,
|
|
206
|
+
sidebar: e.sidebar,
|
|
207
|
+
tabsPosition: e.tabs_position,
|
|
208
|
+
tabsMaxOpen: e.tabs_max_open,
|
|
209
|
+
tabsPersist: e.tabs_persist,
|
|
210
|
+
radius: e.radius,
|
|
211
|
+
zebra: e.zebra_rows,
|
|
212
|
+
aiSurface: e.ai_surface,
|
|
213
|
+
toastPosition: e.toast_position
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
Te();
|
|
217
|
+
var E = /* @__PURE__ */ new Set(), De = { ...ge };
|
|
218
|
+
typeof window < "u" && T(De);
|
|
219
|
+
var D = S((e, t) => ({
|
|
220
|
+
...De,
|
|
221
|
+
set: (n, r) => {
|
|
222
|
+
let i = w({ [n]: r });
|
|
223
|
+
i[n] !== void 0 && (T({
|
|
224
|
+
...t(),
|
|
225
|
+
...i
|
|
226
|
+
}), E.add(n), e(i));
|
|
227
|
+
},
|
|
228
|
+
setMany: (n) => {
|
|
229
|
+
let r = w(n);
|
|
230
|
+
if (Object.keys(r).length) {
|
|
231
|
+
T({
|
|
232
|
+
...t(),
|
|
233
|
+
...r
|
|
234
|
+
});
|
|
235
|
+
for (let e of Object.keys(r)) E.add(e);
|
|
236
|
+
e(r);
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
hydrateFromBranding: (t) => {
|
|
240
|
+
if (!t) return;
|
|
241
|
+
let n = Ee(t), r = {};
|
|
242
|
+
for (let [e, t] of Object.entries(n)) E.has(e) || t !== void 0 && (r[e] = t);
|
|
243
|
+
let i = w(r);
|
|
244
|
+
Object.keys(i).length && (T({
|
|
245
|
+
...D.getState(),
|
|
246
|
+
...i
|
|
247
|
+
}), e(i));
|
|
248
|
+
},
|
|
249
|
+
resetToDefaults: (t) => {
|
|
250
|
+
E.clear(), Te();
|
|
251
|
+
let n = t ? w(Ee(t)) : {}, r = {
|
|
252
|
+
...ge,
|
|
253
|
+
...n
|
|
254
|
+
};
|
|
255
|
+
T(r), e(r);
|
|
256
|
+
}
|
|
257
|
+
})), Oe = ["/login", "/signup"];
|
|
258
|
+
function O(e) {
|
|
259
|
+
return Oe.includes(e);
|
|
260
|
+
}
|
|
261
|
+
function k(e) {
|
|
262
|
+
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//");
|
|
263
|
+
}
|
|
264
|
+
var ke = 4096;
|
|
265
|
+
function A(e) {
|
|
266
|
+
return typeof e == "string" && e.length <= ke;
|
|
267
|
+
}
|
|
268
|
+
function Ae(e) {
|
|
269
|
+
if (e === null) return null;
|
|
270
|
+
if (e === void 0 || typeof e != "object" || Array.isArray(e)) return;
|
|
271
|
+
let t = e;
|
|
272
|
+
if (!k(t.pathname) || t.pathname.length > ke || t.pathname.includes("?") || t.pathname.includes("#")) return;
|
|
273
|
+
let n = { pathname: t.pathname };
|
|
274
|
+
if (t.search !== void 0) {
|
|
275
|
+
if (!A(t.search) || t.search.startsWith("?")) return;
|
|
276
|
+
t.search && (n.search = t.search);
|
|
277
|
+
}
|
|
278
|
+
if (t.hash !== void 0) {
|
|
279
|
+
if (!A(t.hash) || t.hash && !t.hash.startsWith("#")) return;
|
|
280
|
+
t.hash && (n.hash = t.hash);
|
|
281
|
+
}
|
|
282
|
+
for (let e of [
|
|
283
|
+
"tabId",
|
|
284
|
+
"title",
|
|
285
|
+
"icon",
|
|
286
|
+
"screen"
|
|
287
|
+
]) if (t[e] !== void 0) {
|
|
288
|
+
if (!A(t[e])) return;
|
|
289
|
+
t[e] && (n[e] = t[e]);
|
|
290
|
+
}
|
|
291
|
+
return n;
|
|
292
|
+
}
|
|
293
|
+
function j(e) {
|
|
294
|
+
return e.closable !== !1;
|
|
295
|
+
}
|
|
296
|
+
function je(e, t, n, r) {
|
|
297
|
+
if (n === "all") return e.filter(j).map((e) => e.id);
|
|
298
|
+
let i = r ?? t;
|
|
299
|
+
if (!i) return [];
|
|
300
|
+
let a = e.findIndex((e) => e.id === i);
|
|
301
|
+
return a === -1 ? [] : n === "current" ? j(e[a]) ? [e[a].id] : [] : n === "others" ? e.filter((e, t) => t !== a && j(e)).map((e) => e.id) : e.slice(a + 1).filter(j).map((e) => e.id);
|
|
302
|
+
}
|
|
303
|
+
var M = null, N = null;
|
|
304
|
+
function Me(e, t) {
|
|
305
|
+
return `declarion::${e}::${t}::tabs`;
|
|
306
|
+
}
|
|
307
|
+
function Ne() {
|
|
308
|
+
return !M || !N ? null : Me(M, N);
|
|
309
|
+
}
|
|
310
|
+
function Pe(e) {
|
|
311
|
+
let t;
|
|
312
|
+
try {
|
|
313
|
+
t = JSON.parse(e);
|
|
314
|
+
} catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
if (typeof t != "object" || !t) return null;
|
|
318
|
+
let n = t;
|
|
319
|
+
return Array.isArray(n.tabs) ? {
|
|
320
|
+
tabs: n.tabs.filter((e) => typeof e == "object" && !!e && typeof e.id == "string" && typeof e.pathname == "string").map((e) => {
|
|
321
|
+
let t = Ae(e.returnTo);
|
|
322
|
+
if (t === void 0) {
|
|
323
|
+
let { returnTo: t, ...n } = e;
|
|
324
|
+
return n;
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
...e,
|
|
328
|
+
returnTo: t
|
|
329
|
+
};
|
|
330
|
+
}),
|
|
331
|
+
activeTabId: typeof n.activeTabId == "string" ? n.activeTabId : null
|
|
332
|
+
} : null;
|
|
333
|
+
}
|
|
334
|
+
function Fe(e, t) {
|
|
335
|
+
if (typeof window > "u") return null;
|
|
336
|
+
let n = localStorage.getItem(Me(e, t));
|
|
337
|
+
if (!n) return null;
|
|
338
|
+
let r = Pe(n);
|
|
339
|
+
if (!r) return null;
|
|
340
|
+
let i = r.tabs.find((e) => e.id === r.activeTabId), a = i?.pathname;
|
|
341
|
+
if (k(a)) {
|
|
342
|
+
let e = typeof i?.search == "string" ? i.search : "", t = e.startsWith("?") ? e.slice(1) : e;
|
|
343
|
+
return t ? `${a}?${t}` : a;
|
|
344
|
+
}
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
function P(e, t) {
|
|
348
|
+
if (typeof window > "u") return;
|
|
349
|
+
let n = D.getState().tabsPersist, r = Ne();
|
|
350
|
+
if (r) {
|
|
351
|
+
if (!n) {
|
|
352
|
+
try {
|
|
353
|
+
localStorage.removeItem(r);
|
|
354
|
+
} catch {}
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
try {
|
|
358
|
+
localStorage.setItem(r, JSON.stringify({
|
|
359
|
+
tabs: e,
|
|
360
|
+
activeTabId: t
|
|
361
|
+
}));
|
|
362
|
+
} catch {}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function Ie() {
|
|
366
|
+
if (typeof window > "u" || !D.getState().tabsPersist) return null;
|
|
367
|
+
let e = Ne();
|
|
368
|
+
if (!e) return null;
|
|
369
|
+
let t = localStorage.getItem(e);
|
|
370
|
+
return t ? Pe(t) : null;
|
|
371
|
+
}
|
|
372
|
+
var F = S((e, t) => ({
|
|
373
|
+
tabs: [],
|
|
374
|
+
activeTabId: null,
|
|
375
|
+
openTab: (n) => {
|
|
376
|
+
if (O(n.pathname)) return "";
|
|
377
|
+
let r = t(), i = r.tabs.find((e) => e.pathname === n.pathname);
|
|
378
|
+
if (i) return e({ activeTabId: i.id }), P(r.tabs, i.id), i.id;
|
|
379
|
+
let a = crypto.randomUUID(), o = {
|
|
380
|
+
...n,
|
|
381
|
+
id: a
|
|
382
|
+
}, s = [...r.tabs, o], c = D.getState().tabsMaxOpen;
|
|
383
|
+
if (c > 0 && s.length > c) {
|
|
384
|
+
let e = s.findIndex((e) => e.id !== a && e.closable !== !1 && !e.dirty);
|
|
385
|
+
e !== -1 && (s = s.filter((t, n) => n !== e));
|
|
386
|
+
}
|
|
387
|
+
return e({
|
|
388
|
+
tabs: s,
|
|
389
|
+
activeTabId: a
|
|
390
|
+
}), P(s, a), a;
|
|
391
|
+
},
|
|
392
|
+
closeTab: (e) => {
|
|
393
|
+
let n = t(), r = n.tabs.findIndex((t) => t.id === e);
|
|
394
|
+
r !== -1 && n.tabs[r].closable && n.tabs.length !== 1 && t().closeTabs([e]);
|
|
395
|
+
},
|
|
396
|
+
closeTabs: (n) => {
|
|
397
|
+
let r = t(), i = new Set(n);
|
|
398
|
+
if (i.size === 0) return r.tabs.find((e) => e.id === r.activeTabId) ?? null;
|
|
399
|
+
let a = r.tabs.findIndex((e) => e.id === r.activeTabId), o = r.tabs.filter((e) => !(i.has(e.id) && j(e))), s = r.activeTabId;
|
|
400
|
+
return s && !o.some((e) => e.id === s) ? s = o.length === 0 ? null : o[Math.min(Math.max(a, 0), o.length - 1)].id : o.length === 0 && (s = null), e({
|
|
401
|
+
tabs: o,
|
|
402
|
+
activeTabId: s
|
|
403
|
+
}), P(o, s), o.find((e) => e.id === s) ?? null;
|
|
404
|
+
},
|
|
405
|
+
switchTab: (n) => {
|
|
406
|
+
e({ activeTabId: n }), P(t().tabs, n);
|
|
407
|
+
},
|
|
408
|
+
reorderTabs: (t, n) => {
|
|
409
|
+
e((e) => {
|
|
410
|
+
let r = e.tabs.findIndex((e) => e.id === t), i = e.tabs.findIndex((e) => e.id === n);
|
|
411
|
+
if (r === -1 || i === -1 || r === i) return e;
|
|
412
|
+
let a = [...e.tabs], [o] = a.splice(r, 1);
|
|
413
|
+
return a.splice(i, 0, o), { tabs: a };
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
findTabByPathname: (e) => t().tabs.find((t) => t.pathname === e),
|
|
417
|
+
updateTabTitle: (t, n) => {
|
|
418
|
+
e((e) => ({ tabs: e.tabs.map((e) => e.id === t ? {
|
|
419
|
+
...e,
|
|
420
|
+
title: n
|
|
421
|
+
} : e) }));
|
|
422
|
+
},
|
|
423
|
+
updateTabSearch: (t, n) => {
|
|
424
|
+
e((e) => ({ tabs: e.tabs.map((e) => e.id === t ? {
|
|
425
|
+
...e,
|
|
426
|
+
search: n
|
|
427
|
+
} : e) }));
|
|
428
|
+
},
|
|
429
|
+
setReturnTarget: (n, r) => {
|
|
430
|
+
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
431
|
+
...e,
|
|
432
|
+
returnTo: r
|
|
433
|
+
} : e) })), P(t().tabs, t().activeTabId);
|
|
434
|
+
},
|
|
435
|
+
commitTabNavigation: (n, r) => {
|
|
436
|
+
let i = "returnTo" in r;
|
|
437
|
+
e((e) => ({
|
|
438
|
+
tabs: e.tabs.map((e) => e.id === n ? {
|
|
439
|
+
...e,
|
|
440
|
+
search: r.search,
|
|
441
|
+
...i ? { returnTo: r.returnTo } : {}
|
|
442
|
+
} : e),
|
|
443
|
+
activeTabId: n
|
|
444
|
+
})), P(t().tabs, t().activeTabId);
|
|
445
|
+
},
|
|
446
|
+
setDirty: (n, r) => {
|
|
447
|
+
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
448
|
+
...e,
|
|
449
|
+
dirty: r
|
|
450
|
+
} : e) })), P(t().tabs, t().activeTabId);
|
|
451
|
+
},
|
|
452
|
+
setMode: (n, r) => {
|
|
453
|
+
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
454
|
+
...e,
|
|
455
|
+
mode: r
|
|
456
|
+
} : e) })), P(t().tabs, t().activeTabId);
|
|
457
|
+
},
|
|
458
|
+
updateTab: (n, r) => {
|
|
459
|
+
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
460
|
+
...e,
|
|
461
|
+
...r
|
|
462
|
+
} : e) })), P(t().tabs, t().activeTabId);
|
|
463
|
+
},
|
|
464
|
+
setScope: (e, t) => {
|
|
465
|
+
M = e, N = t;
|
|
466
|
+
},
|
|
467
|
+
hydrate: () => {
|
|
468
|
+
let t = Ie();
|
|
469
|
+
t && e({
|
|
470
|
+
tabs: t.tabs,
|
|
471
|
+
activeTabId: t.activeTabId
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
})), I = S((e) => ({
|
|
475
|
+
depth: 0,
|
|
476
|
+
nextIsRoot: !1,
|
|
477
|
+
applyNavigation: (t) => e((e) => e.nextIsRoot ? {
|
|
478
|
+
depth: 0,
|
|
479
|
+
nextIsRoot: !1
|
|
480
|
+
} : t === "PUSH" ? { depth: e.depth + 1 } : t === "POP" ? { depth: Math.max(0, e.depth - 1) } : e),
|
|
481
|
+
markRoot: () => e({ nextIsRoot: !0 }),
|
|
482
|
+
reset: () => e({
|
|
483
|
+
depth: 0,
|
|
484
|
+
nextIsRoot: !1
|
|
485
|
+
})
|
|
486
|
+
}));
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/lib/screen-back.ts
|
|
489
|
+
function Le(e) {
|
|
490
|
+
return e ? e.startsWith("?") ? e.slice(1) : e : "";
|
|
491
|
+
}
|
|
492
|
+
function Re(e) {
|
|
493
|
+
if (e) return e.startsWith("?") ? e : `?${e}`;
|
|
494
|
+
}
|
|
495
|
+
function ze(e, t, n) {
|
|
496
|
+
if (!k(e.pathname) || O(e.pathname) || e.pathname === t) return;
|
|
497
|
+
let r = Le(e.search), i = { pathname: e.pathname };
|
|
498
|
+
return r && (i.search = r), e.hash && (i.hash = e.hash), n?.id && (i.tabId = n.id), n?.title && (i.title = n.title), n?.icon && (i.icon = n.icon), n?.screen && (i.screen = n.screen), i;
|
|
499
|
+
}
|
|
500
|
+
function Be(e, t) {
|
|
501
|
+
return t ? {
|
|
502
|
+
hasOriginBack: !1,
|
|
503
|
+
allowFallbackBack: !0
|
|
504
|
+
} : e === null ? {
|
|
505
|
+
hasOriginBack: !1,
|
|
506
|
+
allowFallbackBack: !1
|
|
507
|
+
} : e && k(e.pathname) ? {
|
|
508
|
+
hasOriginBack: !0,
|
|
509
|
+
allowFallbackBack: !0
|
|
510
|
+
} : {
|
|
511
|
+
hasOriginBack: !1,
|
|
512
|
+
allowFallbackBack: !0
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function Ve(e, t, n) {
|
|
516
|
+
if (n || !e || !k(e.pathname)) return null;
|
|
517
|
+
let r = (e.tabId ? t.find((t) => t.id === e.tabId) : void 0) ?? t.find((t) => t.pathname === e.pathname);
|
|
518
|
+
return {
|
|
519
|
+
kind: r ? "live" : "reopen",
|
|
520
|
+
tabId: r?.id,
|
|
521
|
+
pathname: e.pathname,
|
|
522
|
+
search: e.search,
|
|
523
|
+
hash: e.hash,
|
|
524
|
+
title: e.title,
|
|
525
|
+
icon: e.icon,
|
|
526
|
+
screen: e.screen
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/hooks/useTabNavigate.ts
|
|
531
|
+
function He(e, t) {
|
|
532
|
+
let n = ne(e);
|
|
533
|
+
return {
|
|
534
|
+
pathname: n.pathname ?? e,
|
|
535
|
+
search: Ue(n.search) ?? Ue(t),
|
|
536
|
+
hash: n.hash
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function Ue(e) {
|
|
540
|
+
if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
|
|
541
|
+
}
|
|
542
|
+
function We() {
|
|
543
|
+
let n = ie(), { data: r } = e(), i = f(), a = m();
|
|
544
|
+
return g((e, o) => {
|
|
545
|
+
let { pathname: s, search: c, hash: l } = He(e, o?.search);
|
|
546
|
+
if (i.enabled) {
|
|
547
|
+
a(`${s}${c ?? ""}${l ?? ""}`, { replace: o?.replace });
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
let u = F.getState(), d = o?.topLevel ?? !1, f = Le(c), p = d || typeof window > "u" ? void 0 : ze({
|
|
551
|
+
pathname: window.location.pathname,
|
|
552
|
+
search: window.location.search,
|
|
553
|
+
hash: window.location.hash
|
|
554
|
+
}, s, u.findTabByPathname(window.location.pathname)), m = u.findTabByPathname(s);
|
|
555
|
+
if (m) {
|
|
556
|
+
if (d) {
|
|
557
|
+
let e = f || m.search;
|
|
558
|
+
u.commitTabNavigation(m.id, {
|
|
559
|
+
search: e,
|
|
560
|
+
returnTo: null
|
|
561
|
+
}), n({
|
|
562
|
+
pathname: s,
|
|
563
|
+
search: e ? `?${e}` : "",
|
|
564
|
+
hash: l
|
|
565
|
+
}, { replace: o?.replace });
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
p ? u.commitTabNavigation(m.id, {
|
|
569
|
+
search: f,
|
|
570
|
+
returnTo: p
|
|
571
|
+
}) : u.commitTabNavigation(m.id, { search: f }), n({
|
|
572
|
+
pathname: s,
|
|
573
|
+
search: c,
|
|
574
|
+
hash: l
|
|
575
|
+
}, { replace: o?.replace });
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
let h = o?.title ? void 0 : t(s, r?.screens, r?.entities), g = o?.title ?? h?.title ?? s, _ = o?.icon ?? h?.icon;
|
|
579
|
+
u.openTab({
|
|
580
|
+
pathname: s,
|
|
581
|
+
search: f,
|
|
582
|
+
title: g,
|
|
583
|
+
icon: _,
|
|
584
|
+
closable: !0,
|
|
585
|
+
returnTo: d ? null : p
|
|
586
|
+
}), n({
|
|
587
|
+
pathname: s,
|
|
588
|
+
search: c,
|
|
589
|
+
hash: l
|
|
590
|
+
}, { replace: o?.replace });
|
|
591
|
+
}, [
|
|
592
|
+
n,
|
|
593
|
+
r?.screens,
|
|
594
|
+
r?.entities,
|
|
595
|
+
i.enabled,
|
|
596
|
+
a
|
|
597
|
+
]);
|
|
598
|
+
}
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/stores/page-state.ts
|
|
601
|
+
var L = 18e5, R = null;
|
|
602
|
+
function z(e) {
|
|
603
|
+
R = e;
|
|
604
|
+
}
|
|
605
|
+
function B(e) {
|
|
606
|
+
if (!(!e || !R)) for (let t of e.queryKeys) R.removeQueries({
|
|
607
|
+
queryKey: t,
|
|
608
|
+
exact: !0
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
function V(e, t) {
|
|
612
|
+
let n = e[t];
|
|
613
|
+
if (!n) return e;
|
|
614
|
+
B(n);
|
|
615
|
+
let r = { ...e };
|
|
616
|
+
return delete r[t], r;
|
|
617
|
+
}
|
|
618
|
+
function Ge(e, t) {
|
|
619
|
+
let n = e;
|
|
620
|
+
for (; Object.keys(n).length > 64;) {
|
|
621
|
+
let e = null, r = Infinity;
|
|
622
|
+
for (let [i, a] of Object.entries(n)) i !== t && a.lastActiveAt < r && (r = a.lastActiveAt, e = i);
|
|
623
|
+
if (e === null) break;
|
|
624
|
+
n = V(n, e);
|
|
625
|
+
}
|
|
626
|
+
return n;
|
|
627
|
+
}
|
|
628
|
+
var H = S((e, t) => ({
|
|
629
|
+
entries: {},
|
|
630
|
+
ttlMs: L,
|
|
631
|
+
setTtl: (n) => {
|
|
632
|
+
if (n <= 0) {
|
|
633
|
+
let { entries: r } = t();
|
|
634
|
+
for (let e of Object.keys(r)) B(r[e]);
|
|
635
|
+
e({
|
|
636
|
+
ttlMs: n,
|
|
637
|
+
entries: {}
|
|
638
|
+
});
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
e({ ttlMs: n });
|
|
642
|
+
},
|
|
643
|
+
set: (n, r, i) => {
|
|
644
|
+
let a = t();
|
|
645
|
+
if (a.ttlMs <= 0) return;
|
|
646
|
+
let o = Date.now(), s = a.entries[n], c = s ? {
|
|
647
|
+
...s,
|
|
648
|
+
bag: {
|
|
649
|
+
...s.bag,
|
|
650
|
+
[r]: i
|
|
651
|
+
},
|
|
652
|
+
lastActiveAt: o
|
|
653
|
+
} : {
|
|
654
|
+
bag: { [r]: i },
|
|
655
|
+
lastActiveAt: o,
|
|
656
|
+
queryKeys: []
|
|
657
|
+
};
|
|
658
|
+
e({ entries: Ge({
|
|
659
|
+
...a.entries,
|
|
660
|
+
[n]: c
|
|
661
|
+
}, n) });
|
|
662
|
+
},
|
|
663
|
+
read: (e, n) => {
|
|
664
|
+
let r = t();
|
|
665
|
+
if (!(r.ttlMs <= 0)) return r.entries[e]?.bag[n];
|
|
666
|
+
},
|
|
667
|
+
touch: (n) => {
|
|
668
|
+
let r = t();
|
|
669
|
+
if (r.ttlMs <= 0) return;
|
|
670
|
+
let i = r.entries[n];
|
|
671
|
+
i && e({ entries: {
|
|
672
|
+
...r.entries,
|
|
673
|
+
[n]: {
|
|
674
|
+
...i,
|
|
675
|
+
lastActiveAt: Date.now()
|
|
676
|
+
}
|
|
677
|
+
} });
|
|
678
|
+
},
|
|
679
|
+
registerQueryKey: (n, r) => {
|
|
680
|
+
let i = t();
|
|
681
|
+
if (i.ttlMs <= 0) return;
|
|
682
|
+
let a = Date.now(), o = i.entries[n], s = o?.queryKeys.some((e) => Ke(e, r));
|
|
683
|
+
if (o && s) return;
|
|
684
|
+
let c = o ? {
|
|
685
|
+
...o,
|
|
686
|
+
queryKeys: [...o.queryKeys, r],
|
|
687
|
+
lastActiveAt: a
|
|
688
|
+
} : {
|
|
689
|
+
bag: {},
|
|
690
|
+
lastActiveAt: a,
|
|
691
|
+
queryKeys: [r]
|
|
692
|
+
};
|
|
693
|
+
e({ entries: Ge({
|
|
694
|
+
...i.entries,
|
|
695
|
+
[n]: c
|
|
696
|
+
}, n) });
|
|
697
|
+
},
|
|
698
|
+
kill: (n) => {
|
|
699
|
+
let r = t(), i = V(r.entries, n);
|
|
700
|
+
i !== r.entries && e({ entries: i });
|
|
701
|
+
},
|
|
702
|
+
sweep: (n) => {
|
|
703
|
+
let { ttlMs: r, entries: i } = t(), a = i;
|
|
704
|
+
for (let [e, t] of Object.entries(i)) (r <= 0 || n - t.lastActiveAt > r) && (a = V(a, e));
|
|
705
|
+
a !== i && e({ entries: a });
|
|
706
|
+
},
|
|
707
|
+
clear: () => {
|
|
708
|
+
let { entries: n } = t();
|
|
709
|
+
if (Object.keys(n).length !== 0) {
|
|
710
|
+
for (let e of Object.keys(n)) B(n[e]);
|
|
711
|
+
e({ entries: {} });
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}));
|
|
715
|
+
function Ke(e, t) {
|
|
716
|
+
if (e === t) return !0;
|
|
717
|
+
try {
|
|
718
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
719
|
+
} catch {
|
|
720
|
+
return !1;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/lib/page-inset.ts
|
|
725
|
+
function qe(e) {
|
|
726
|
+
return {
|
|
727
|
+
paddingLeft: `calc(${e}px + var(--safe-area-left))`,
|
|
728
|
+
paddingRight: `calc(${e}px + var(--safe-area-right))`
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
var Je = 1200, U = null, W = null;
|
|
732
|
+
function G() {
|
|
733
|
+
return !U || !W ? null : `declarion::${U}::${W}::listlayout`;
|
|
734
|
+
}
|
|
735
|
+
function K() {
|
|
736
|
+
return {
|
|
737
|
+
v: 2,
|
|
738
|
+
widths: {},
|
|
739
|
+
resizeEduShown: !1
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
function Ye(e) {
|
|
743
|
+
if (typeof e != "object" || !e) return {};
|
|
744
|
+
let t = {};
|
|
745
|
+
for (let [n, r] of Object.entries(e)) typeof r == "number" && Number.isFinite(r) && r >= 60 && (t[n] = r);
|
|
746
|
+
return t;
|
|
747
|
+
}
|
|
748
|
+
function Xe(e) {
|
|
749
|
+
let t;
|
|
750
|
+
try {
|
|
751
|
+
t = JSON.parse(e);
|
|
752
|
+
} catch {
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
if (typeof t != "object" || !t) return null;
|
|
756
|
+
let n = t;
|
|
757
|
+
if (n.v !== 2) return null;
|
|
758
|
+
let r = {};
|
|
759
|
+
if (n.widths && typeof n.widths == "object") for (let [e, t] of Object.entries(n.widths)) r[e] = Ye(t);
|
|
760
|
+
return {
|
|
761
|
+
v: 2,
|
|
762
|
+
widths: r,
|
|
763
|
+
resizeEduShown: n.resizeEduShown === !0
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function q(e) {
|
|
767
|
+
if (typeof window > "u") return;
|
|
768
|
+
let t = G();
|
|
769
|
+
if (t) try {
|
|
770
|
+
localStorage.setItem(t, JSON.stringify(e));
|
|
771
|
+
} catch {}
|
|
772
|
+
}
|
|
773
|
+
function Ze(e, t) {
|
|
774
|
+
return {
|
|
775
|
+
v: 2,
|
|
776
|
+
widths: {
|
|
777
|
+
...e.widths,
|
|
778
|
+
...t.widths
|
|
779
|
+
},
|
|
780
|
+
resizeEduShown: e.resizeEduShown || t.resizeEduShown
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function Qe(e) {
|
|
784
|
+
return Math.min(Je, Math.max(60, Math.round(e)));
|
|
785
|
+
}
|
|
786
|
+
var J = S((e) => ({
|
|
787
|
+
...K(),
|
|
788
|
+
setScope: (e, t) => {
|
|
789
|
+
U = e, W = t;
|
|
790
|
+
},
|
|
791
|
+
hydrate: () => {
|
|
792
|
+
if (typeof window > "u") return;
|
|
793
|
+
let t = G();
|
|
794
|
+
if (!t) {
|
|
795
|
+
e(K());
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
let n = localStorage.getItem(t);
|
|
799
|
+
e((n ? Xe(n) : null) ?? K());
|
|
800
|
+
},
|
|
801
|
+
setWidth: (t, n, r) => {
|
|
802
|
+
e((e) => {
|
|
803
|
+
let i = {
|
|
804
|
+
...e.widths[t] ?? {},
|
|
805
|
+
[n]: Qe(r)
|
|
806
|
+
}, a = {
|
|
807
|
+
...e,
|
|
808
|
+
widths: {
|
|
809
|
+
...e.widths,
|
|
810
|
+
[t]: i
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
return q(a), a;
|
|
814
|
+
});
|
|
815
|
+
},
|
|
816
|
+
setWidths: (t, n) => {
|
|
817
|
+
e((e) => {
|
|
818
|
+
let r = {};
|
|
819
|
+
for (let [e, t] of Object.entries(n)) r[e] = Qe(t);
|
|
820
|
+
let i = {
|
|
821
|
+
...e.widths[t] ?? {},
|
|
822
|
+
...r
|
|
823
|
+
}, a = {
|
|
824
|
+
...e,
|
|
825
|
+
widths: {
|
|
826
|
+
...e.widths,
|
|
827
|
+
[t]: i
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
return q(a), a;
|
|
831
|
+
});
|
|
832
|
+
},
|
|
833
|
+
resetWidths: (t) => {
|
|
834
|
+
e((e) => {
|
|
835
|
+
let n = {
|
|
836
|
+
...e,
|
|
837
|
+
widths: {
|
|
838
|
+
...e.widths,
|
|
839
|
+
[t]: {}
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
return q(n), n;
|
|
843
|
+
});
|
|
844
|
+
},
|
|
845
|
+
prune: (t, n) => {
|
|
846
|
+
let r = new Set(n);
|
|
847
|
+
e((e) => {
|
|
848
|
+
let n = e.widths[t];
|
|
849
|
+
if (!n) return e;
|
|
850
|
+
let i = {}, a = !1;
|
|
851
|
+
for (let [e, t] of Object.entries(n)) r.has(e) ? i[e] = t : a = !0;
|
|
852
|
+
if (!a) return e;
|
|
853
|
+
let o = {
|
|
854
|
+
...e,
|
|
855
|
+
widths: {
|
|
856
|
+
...e.widths,
|
|
857
|
+
[t]: i
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
return q(o), o;
|
|
861
|
+
});
|
|
862
|
+
},
|
|
863
|
+
markResizeEduShown: () => {
|
|
864
|
+
e((e) => {
|
|
865
|
+
if (e.resizeEduShown) return e;
|
|
866
|
+
let t = {
|
|
867
|
+
...e,
|
|
868
|
+
resizeEduShown: !0
|
|
869
|
+
};
|
|
870
|
+
return q(t), t;
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
})), $e = !1;
|
|
874
|
+
function et() {
|
|
875
|
+
typeof window > "u" || $e || ($e = !0, window.addEventListener("storage", (e) => {
|
|
876
|
+
let t = G();
|
|
877
|
+
if (!t || e.key !== t || e.newValue == null) return;
|
|
878
|
+
let n = Xe(e.newValue);
|
|
879
|
+
n && J.setState((e) => Ze(e, n));
|
|
880
|
+
}));
|
|
881
|
+
}
|
|
882
|
+
var tt = {}, Y = () => {};
|
|
883
|
+
function nt(e) {
|
|
884
|
+
let t = !!e && G() !== null, n = J((t) => e ? t.widths[e] : void 0), r = J((e) => e.resizeEduShown === !0), i = g((n, r) => {
|
|
885
|
+
t && e && J.getState().setWidth(e, n, r);
|
|
886
|
+
}, [t, e]), a = g((n) => {
|
|
887
|
+
t && e && J.getState().setWidths(e, n);
|
|
888
|
+
}, [t, e]), o = g(() => {
|
|
889
|
+
t && e && J.getState().resetWidths(e);
|
|
890
|
+
}, [t, e]), s = g((n) => {
|
|
891
|
+
t && e && J.getState().prune(e, n);
|
|
892
|
+
}, [t, e]), c = g(() => {
|
|
893
|
+
t && J.getState().markResizeEduShown();
|
|
894
|
+
}, [t]);
|
|
895
|
+
return {
|
|
896
|
+
widths: t ? n ?? tt : tt,
|
|
897
|
+
resizeEduShown: r,
|
|
898
|
+
setWidth: t ? i : Y,
|
|
899
|
+
setWidths: t ? a : Y,
|
|
900
|
+
resetWidths: t ? o : Y,
|
|
901
|
+
prune: t ? s : Y,
|
|
902
|
+
markResizeEduShown: t ? c : Y
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
//#endregion
|
|
906
|
+
//#region src/lib/canonical-url.ts
|
|
907
|
+
function rt(e) {
|
|
908
|
+
return e.length > 1 && e.endsWith("/") ? e.replace(/\/+$/, "") || "/" : e;
|
|
909
|
+
}
|
|
910
|
+
function X(e) {
|
|
911
|
+
let t = rt(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, i = new URLSearchParams(r);
|
|
912
|
+
for (let e of u) i.delete(e);
|
|
913
|
+
i.sort();
|
|
914
|
+
let a = i.toString();
|
|
915
|
+
return a ? `${t}?${a}` : t;
|
|
916
|
+
}
|
|
917
|
+
function it(e) {
|
|
918
|
+
return rt(e.pathname);
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/hooks/usePageStateTtl.ts
|
|
922
|
+
var at = "ui_page_state_ttl_ms";
|
|
923
|
+
function ot() {
|
|
924
|
+
let { value: e } = he(at, L);
|
|
925
|
+
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? L : e;
|
|
926
|
+
}
|
|
927
|
+
//#endregion
|
|
928
|
+
//#region src/hooks/usePageStateRuntime.ts
|
|
929
|
+
var st = [
|
|
930
|
+
["entity-data"],
|
|
931
|
+
["entity-count"],
|
|
932
|
+
["entity-item"],
|
|
933
|
+
["entity-data-cursor"],
|
|
934
|
+
["entity-data-all"],
|
|
935
|
+
["action-data"],
|
|
936
|
+
["action-data-cursor"]
|
|
937
|
+
], ct = 6e4;
|
|
938
|
+
function lt(e, t) {
|
|
939
|
+
for (let n of st) e.setQueryDefaults(n, { gcTime: t });
|
|
940
|
+
}
|
|
941
|
+
function ut() {
|
|
942
|
+
let e = x(), t = ot(), n = re(), r = ee(n);
|
|
943
|
+
r.current = n, _(() => (z(e), () => z(null)), [e]), _(() => {
|
|
944
|
+
if (H.getState().setTtl(t), lt(e, t), t <= 0) for (let t of st) e.removeQueries({ queryKey: t });
|
|
945
|
+
}, [e, t]), _(() => {
|
|
946
|
+
if (t <= 0) return;
|
|
947
|
+
let e = setInterval(() => {
|
|
948
|
+
let e = H.getState(), t = r.current;
|
|
949
|
+
e.touch(X(t)), e.touch(it(t)), e.sweep(Date.now());
|
|
950
|
+
}, ct);
|
|
951
|
+
return () => clearInterval(e);
|
|
952
|
+
}, [t]);
|
|
953
|
+
}
|
|
954
|
+
function dt(e, t = !0) {
|
|
955
|
+
let n = X(re()), r = e ? JSON.stringify(e) : "";
|
|
956
|
+
_(() => {
|
|
957
|
+
!t || !e || H.getState().registerQueryKey(n, e);
|
|
958
|
+
}, [
|
|
959
|
+
n,
|
|
960
|
+
r,
|
|
961
|
+
t
|
|
962
|
+
]);
|
|
963
|
+
}
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/hooks/useChildrenData.ts
|
|
966
|
+
var Z = "entity-children";
|
|
967
|
+
function ft(e, t, r, i, a, o) {
|
|
968
|
+
let s = Array.isArray(i) ? i : [i], l = Array.isArray(i) ? c(t, s.length) : [t];
|
|
969
|
+
return b({
|
|
970
|
+
queryKey: [
|
|
971
|
+
Z,
|
|
972
|
+
e,
|
|
973
|
+
t,
|
|
974
|
+
r,
|
|
975
|
+
a,
|
|
976
|
+
o
|
|
977
|
+
],
|
|
978
|
+
queryFn: () => {
|
|
979
|
+
let e = new URLSearchParams();
|
|
980
|
+
if (!l) throw Error("invalid composite parent id");
|
|
981
|
+
let t = s.map((e, t) => ({
|
|
982
|
+
field: e,
|
|
983
|
+
op: "eq",
|
|
984
|
+
value: l[t]
|
|
985
|
+
}));
|
|
986
|
+
return e.set("filters", JSON.stringify(t)), a && e.set("sort", a), o && e.set("limit", String(o)), n(`/api/data/${r}?${e.toString()}`);
|
|
987
|
+
},
|
|
988
|
+
enabled: !!e && !!t && !!r && !!i && l !== null
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
//#endregion
|
|
992
|
+
//#region src/stores/realtime.ts
|
|
993
|
+
var pt = S((e, t) => ({
|
|
994
|
+
degradedEntities: /* @__PURE__ */ new Set(),
|
|
995
|
+
markDegraded: (n) => {
|
|
996
|
+
if (!n || t().degradedEntities.has(n)) return;
|
|
997
|
+
let r = new Set(t().degradedEntities);
|
|
998
|
+
r.add(n), e({ degradedEntities: r });
|
|
999
|
+
}
|
|
1000
|
+
}));
|
|
1001
|
+
function mt(e, t, n) {
|
|
1002
|
+
return e === !0 && !t.has(n);
|
|
1003
|
+
}
|
|
1004
|
+
//#endregion
|
|
1005
|
+
//#region src/hooks/useMutations.ts
|
|
1006
|
+
function Q(e) {
|
|
1007
|
+
p.error(e.message);
|
|
1008
|
+
}
|
|
1009
|
+
function $(e, t, n = {}) {
|
|
1010
|
+
e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [Z, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
|
|
1011
|
+
}
|
|
1012
|
+
function ht(e) {
|
|
1013
|
+
let t = x();
|
|
1014
|
+
return y({
|
|
1015
|
+
mutationFn: (t) => a(e, t),
|
|
1016
|
+
onSuccess: () => {
|
|
1017
|
+
$(t, e), p.success("Record created");
|
|
1018
|
+
},
|
|
1019
|
+
onError: Q
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
function gt(e) {
|
|
1023
|
+
let t = x();
|
|
1024
|
+
return y({
|
|
1025
|
+
mutationFn: ({ pkValues: t, data: n }) => l(e, t, n),
|
|
1026
|
+
onSuccess: () => {
|
|
1027
|
+
$(t, e, {
|
|
1028
|
+
item: !0,
|
|
1029
|
+
children: !0,
|
|
1030
|
+
objectMeta: !0
|
|
1031
|
+
}), p.success("Record updated");
|
|
1032
|
+
},
|
|
1033
|
+
onError: Q
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function _t(e) {
|
|
1037
|
+
let t = x();
|
|
1038
|
+
return y({
|
|
1039
|
+
mutationFn: (t) => h(e, t),
|
|
1040
|
+
onSuccess: () => {
|
|
1041
|
+
$(t, e, { item: !0 }), p.success("Record deleted");
|
|
1042
|
+
},
|
|
1043
|
+
onError: Q
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
function vt(e) {
|
|
1047
|
+
let t = x();
|
|
1048
|
+
return y({
|
|
1049
|
+
mutationFn: (t) => i(e, t),
|
|
1050
|
+
onSuccess: () => {
|
|
1051
|
+
$(t, e, {
|
|
1052
|
+
item: !0,
|
|
1053
|
+
objectMeta: !0
|
|
1054
|
+
}), p.success("Record restored");
|
|
1055
|
+
},
|
|
1056
|
+
onError: Q
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/hooks/useScreenBack.ts
|
|
1061
|
+
function yt(n) {
|
|
1062
|
+
let r = ie(), i = f(), a = d(), o = I((e) => e.depth), { data: s } = e(), c = n?.fallback, l = F((e) => {
|
|
1063
|
+
let t = e.tabs.find((t) => t.id === e.activeTabId);
|
|
1064
|
+
return t ? t.returnTo : void 0;
|
|
1065
|
+
}), { hasOriginBack: u, allowFallbackBack: p } = v(() => Be(l, i.enabled), [l, i.enabled]), m = g(() => {
|
|
1066
|
+
if (i.enabled) {
|
|
1067
|
+
I.getState().depth > 0 ? a() : c?.();
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
let e = F.getState(), n = Ve(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
|
|
1071
|
+
if (!n) {
|
|
1072
|
+
c?.();
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
if (n.kind === "live" && n.tabId) e.commitTabNavigation(n.tabId, { search: n.search ?? "" });
|
|
1076
|
+
else if (n.kind === "reopen") {
|
|
1077
|
+
let r = n.title ? void 0 : t(n.pathname, s?.screens, s?.entities);
|
|
1078
|
+
e.openTab({
|
|
1079
|
+
pathname: n.pathname,
|
|
1080
|
+
search: n.search ?? "",
|
|
1081
|
+
title: n.title ?? r?.title ?? n.pathname,
|
|
1082
|
+
icon: n.icon ?? r?.icon,
|
|
1083
|
+
screen: n.screen,
|
|
1084
|
+
closable: !0
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
r({
|
|
1088
|
+
pathname: n.pathname,
|
|
1089
|
+
search: Re(n.search),
|
|
1090
|
+
hash: n.hash || void 0
|
|
1091
|
+
});
|
|
1092
|
+
}, [
|
|
1093
|
+
i.enabled,
|
|
1094
|
+
a,
|
|
1095
|
+
c,
|
|
1096
|
+
r,
|
|
1097
|
+
s?.screens,
|
|
1098
|
+
s?.entities
|
|
1099
|
+
]);
|
|
1100
|
+
return {
|
|
1101
|
+
canGoBack: i.enabled ? o > 0 || !!c : u || !!c,
|
|
1102
|
+
hasOriginBack: u,
|
|
1103
|
+
allowFallbackBack: p,
|
|
1104
|
+
goBack: m
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
//#endregion
|
|
1108
|
+
//#region src/lib/field-classification.ts
|
|
1109
|
+
function bt(e, t) {
|
|
1110
|
+
let n = e?.field_access?.[t];
|
|
1111
|
+
return !n || n.read === "granted";
|
|
1112
|
+
}
|
|
1113
|
+
function xt(e, t) {
|
|
1114
|
+
let n = e?.field_access?.[t];
|
|
1115
|
+
return !n || n.write === "granted";
|
|
1116
|
+
}
|
|
1117
|
+
function St(e, t) {
|
|
1118
|
+
return e?.field_access?.[t]?.classification;
|
|
1119
|
+
}
|
|
1120
|
+
function Ct(e, t) {
|
|
1121
|
+
return e?.field_access?.[t]?.required_permission;
|
|
1122
|
+
}
|
|
1123
|
+
function wt(e, t, n) {
|
|
1124
|
+
let r = St(t, n);
|
|
1125
|
+
if (r) return e?.classifications?.[r];
|
|
1126
|
+
}
|
|
1127
|
+
function Tt(e, t, n) {
|
|
1128
|
+
return !!wt(e, t, n)?.sod_protected;
|
|
1129
|
+
}
|
|
1130
|
+
function Et(e, t) {
|
|
1131
|
+
return e?.field_access?.[t];
|
|
1132
|
+
}
|
|
1133
|
+
//#endregion
|
|
1134
|
+
export { H as A, pe as B, X as C, J as D, nt as E, F, de as H, T as I, D as L, I as M, Fe as N, qe as O, je as P, ue as R, it as S, et as T, fe as U, he as V, lt as _, bt as a, at as b, yt as c, vt as d, gt as f, ft as g, Z as h, Ct as i, We as j, L as k, ht as l, pt as m, Et as n, Tt as o, mt as p, St as r, xt as s, wt as t, _t as u, ut as v, Je as w, ot as x, dt as y, le as z };
|