@archbase/admin 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1566 @@
1
+ import { jsx as A, jsxs as Q, Fragment as AA } from "react/jsx-runtime";
2
+ import j, { useState as oA, useEffect as U, useMemo as SA, useContext as mA, useCallback as _, useLayoutEffect as Ae, createContext as ee, useReducer as oe, useRef as re } from "react";
3
+ import { useArchbaseSecurityManager as ne } from "@archbase/security";
4
+ import { useUncontrolled as te, useMediaQuery as MA, useDisclosure as ae, useFocusTrap as le, useForceUpdate as se } from "@mantine/hooks";
5
+ import { Flex as EA, useMantineColorScheme as aA, Menu as T, ActionIcon as kA, Group as OA, Tooltip as gA, Button as ie, Badge as ce, Center as de, Image as ue, useMantineTheme as TA, px as H, Burger as pe, Box as he, Avatar as fe, Text as UA, ScrollArea as DA, Stack as bA, Paper as ge, AppShell as cA, Drawer as HA } from "@mantine/core";
6
+ import { IconSun as GA, IconMoonStars as KA, IconTerminal as be, IconSearch as we, IconDots as me, IconChevronRight as ke, IconChevronLeft as ve, IconHome2 as Ce, IconDashboard as ye, IconUsers as xe, IconListSearch as YA, IconUserPlus as Se, IconNews as Ee, IconFilePlus as De, IconSettings as Re } from "@tabler/icons-react";
7
+ import { useArchbaseAppContext as RA, getI18nextInstance as R, useArchbaseTranslation as LA, archbaseI18next as dA, useArchbaseValidator as Le, ARCHBASE_IOC_API_TYPE as Qe } from "@archbase/core";
8
+ import { BRFlag as pA, USFlag as VA, ESFlag as yA, VEFlag as ze, UYFlag as Ie, SVFlag as Pe, PYFlag as Me, PEFlag as Ne, PAFlag as Fe, NIFlag as $e, MXFlag as Be, HNFlag as Oe, GTFlag as Te, ECFlag as Ue, DOFlag as He, CUFlag as Ge, CRFlag as Ke, COFlag as Ye, CLFlag as Ve, BOFlag as qe, ARFlag as Xe } from "mantine-flagpack";
9
+ import { spotlight as je, Spotlight as uA } from "@mantine/spotlight";
10
+ import { useNavigate as QA, useLocation as zA, matchPath as NA } from "react-router";
11
+ import { Routes as qA, Route as xA, useSearchParams as XA, useNavigate as Je, useLocation as We } from "react-router-dom";
12
+ import { useMediaQuery as Ze } from "usehooks-ts";
13
+ import { useArchbaseNavigateParams as _e, useArchbaseVisible as Ao, ArchbaseNotifications as eo, ArchbaseAvatarEdit as oo, ArchbaseEdit as CA } from "@archbase/components";
14
+ import { SubMenu as ro, MenuItem as FA, menuClasses as F, Sidebar as jA, Menu as JA, sidebarClasses as WA } from "react-pro-sidebar";
15
+ import no from "@rehooks/component-size";
16
+ import { ArchbaseAdvancedTabs as to } from "@archbase/layout";
17
+ import { useArchbaseStore as ao, useArchbaseRemoteServiceApi as lo, useArchbaseRemoteDataSource as so } from "@archbase/data";
18
+ import { ArchbaseFormModalTemplate as io } from "@archbase/template";
19
+ import { create as co } from "zustand";
20
+ const vA = j.createContext({}), uo = ({
21
+ navigationData: o,
22
+ user: e,
23
+ owner: t,
24
+ company: r,
25
+ navigationRootLink: i,
26
+ children: a,
27
+ enableSecurity: d,
28
+ securityOptions: n,
29
+ onNavigationDataChange: s,
30
+ initialSidebarCollapsed: l
31
+ }) => {
32
+ const [u, v] = oA(l), [h, w] = oA(!1), [P, M] = te({
33
+ value: s !== void 0 ? o : void 0,
34
+ defaultValue: d ? [] : o,
35
+ finalValue: [],
36
+ onChange: s
37
+ });
38
+ U(() => {
39
+ }, [P, d]);
40
+ const { securityManager: L } = ne({
41
+ resourceName: n?.navigationResourceName ? n.navigationResourceName : "ArchbaseAdvancedSidebar",
42
+ resourceDescription: n?.navigationResourceDescription ? n.navigationResourceDescription : "archbase:Navegação",
43
+ enableSecurity: d
44
+ });
45
+ return U(() => {
46
+ d && (o.filter((f) => f.showInSidebar).forEach((f) => {
47
+ L.registerAction(f.label, f.label), f?.links?.forEach((z) => L.registerAction(`${f.label} -> ${z.label}`, `${f.label} -> ${z.label}`));
48
+ }), L.apply(() => {
49
+ const f = o.map((z) => ({
50
+ ...z,
51
+ disabled: !L.hasPermission(z.label),
52
+ links: z.links && z.links.map((O) => {
53
+ const $ = L.hasPermission(`${z.label} -> ${O.label}`);
54
+ return {
55
+ ...O,
56
+ disabled: !$
57
+ };
58
+ })
59
+ }));
60
+ M(f);
61
+ }));
62
+ }, [e?.id, d, o, L, M]), /* @__PURE__ */ A(
63
+ vA.Provider,
64
+ {
65
+ value: {
66
+ navigationData: P,
67
+ setNavigationData: M,
68
+ user: e,
69
+ owner: t,
70
+ company: r,
71
+ navigationRootLink: i,
72
+ collapsed: u,
73
+ setCollapsed: v,
74
+ hidden: h,
75
+ setHidden: w,
76
+ onNavigationDataChange: s
77
+ },
78
+ children: a
79
+ }
80
+ );
81
+ }, ir = ({ children: o }) => /* @__PURE__ */ A(EA, { align: "center", direction: "row", wrap: "wrap", h: "100%", children: o }), po = () => {
82
+ const o = RA(), { colorScheme: e } = aA(), t = e === "dark", [r, i] = oA(R().language);
83
+ U(() => {
84
+ const s = (l) => {
85
+ i(l);
86
+ };
87
+ return R().on("languageChanged", s), () => {
88
+ R().off("languageChanged", s);
89
+ };
90
+ }, []);
91
+ const a = (s) => {
92
+ if (!s)
93
+ return /* @__PURE__ */ A(pA, { size: 24 });
94
+ if (s === "en" || s === "en-US")
95
+ return /* @__PURE__ */ A(VA, { size: 24 });
96
+ if (s === "pt-BR")
97
+ return /* @__PURE__ */ A(pA, { size: 24 });
98
+ if (s.includes("es"))
99
+ switch (navigator.language || navigator.languages[0]) {
100
+ case "es":
101
+ case "es-ES":
102
+ return /* @__PURE__ */ A(yA, { size: 24 });
103
+ case "es-AR":
104
+ return /* @__PURE__ */ A(Xe, { size: 24 });
105
+ case "es-BO":
106
+ return /* @__PURE__ */ A(qe, { size: 24 });
107
+ case "es-CL":
108
+ return /* @__PURE__ */ A(Ve, { size: 24 });
109
+ case "es-CO":
110
+ return /* @__PURE__ */ A(Ye, { size: 24 });
111
+ case "es-CR":
112
+ return /* @__PURE__ */ A(Ke, { size: 24 });
113
+ case "es-CU":
114
+ return /* @__PURE__ */ A(Ge, { size: 24 });
115
+ case "es-DO":
116
+ return /* @__PURE__ */ A(He, { size: 24 });
117
+ case "es-EC":
118
+ return /* @__PURE__ */ A(Ue, { size: 24 });
119
+ case "es-GT":
120
+ return /* @__PURE__ */ A(Te, { size: 24 });
121
+ case "es-HN":
122
+ return /* @__PURE__ */ A(Oe, { size: 24 });
123
+ case "es-MX":
124
+ return /* @__PURE__ */ A(Be, { size: 24 });
125
+ case "es-NI":
126
+ return /* @__PURE__ */ A($e, { size: 24 });
127
+ case "es-PA":
128
+ return /* @__PURE__ */ A(Fe, { size: 24 });
129
+ case "es-PE":
130
+ return /* @__PURE__ */ A(Ne, { size: 24 });
131
+ case "es-PY":
132
+ return /* @__PURE__ */ A(Me, { size: 24 });
133
+ case "es-SV":
134
+ return /* @__PURE__ */ A(Pe, { size: 24 });
135
+ case "es-UY":
136
+ return /* @__PURE__ */ A(Ie, { size: 24 });
137
+ case "es-VE":
138
+ return /* @__PURE__ */ A(ze, { size: 24 });
139
+ default:
140
+ return /* @__PURE__ */ A(yA, { size: 24 });
141
+ }
142
+ return /* @__PURE__ */ A(pA, { size: 24 });
143
+ }, d = () => {
144
+ if (o.languages)
145
+ return o.languages.filter((s) => s).map((s) => /* @__PURE__ */ A(
146
+ T.Item,
147
+ {
148
+ onClick: () => n(s.lang),
149
+ leftSection: a(s.lang),
150
+ children: s.name
151
+ },
152
+ s.name
153
+ ));
154
+ }, n = (s) => {
155
+ R().changeLanguage(s);
156
+ };
157
+ return /* @__PURE__ */ Q(T, { shadow: "md", width: 200, position: "bottom-end", children: [
158
+ /* @__PURE__ */ A(T.Target, { children: /* @__PURE__ */ A(kA, { variant: "transparent", color: t ? "white" : "blue", title: R().t("toggleLanguage"), children: a(r) }) }),
159
+ /* @__PURE__ */ A(T.Dropdown, { children: d() })
160
+ ] });
161
+ }, ho = () => {
162
+ const o = RA(), { colorScheme: e } = aA(), { t, i18n: r } = LA(), i = (n) => n === "en" ? /* @__PURE__ */ A(VA, { size: 24 }) : n === "pt-BR" ? /* @__PURE__ */ A(pA, { size: 24 }) : n === "es" ? /* @__PURE__ */ A(yA, { size: 24 }) : /* @__PURE__ */ A(pA, { size: 24 }), a = () => {
163
+ if (o.languages)
164
+ return o.languages.filter((n) => n).map((n) => /* @__PURE__ */ A(
165
+ T.Item,
166
+ {
167
+ onClick: () => d(n.lang),
168
+ leftSection: i(n.lang),
169
+ children: n.name
170
+ },
171
+ n.name
172
+ ));
173
+ }, d = (n) => {
174
+ r.changeLanguage(n);
175
+ };
176
+ return /* @__PURE__ */ Q(T, { children: [
177
+ /* @__PURE__ */ A(T.Target, { children: /* @__PURE__ */ Q(
178
+ OA,
179
+ {
180
+ w: "100%",
181
+ justify: "flex-start",
182
+ p: "calc(var(--mantine-spacing-xs) / 1.5) var(--mantine-spacing-xs)",
183
+ c: "var(--mantine-text-color)",
184
+ variant: "transparent",
185
+ fw: 400,
186
+ gap: 4,
187
+ title: R().t("archbase:toggleLanguage"),
188
+ children: [
189
+ i(r.language),
190
+ `${o.languages.find((n) => n.lang === r.language)?.name ?? "Português"}`
191
+ ]
192
+ }
193
+ ) }),
194
+ /* @__PURE__ */ A(T.Dropdown, { children: a() })
195
+ ] });
196
+ }, fo = ({
197
+ toggleColorScheme: o,
198
+ sunColor: e = "white",
199
+ moonColor: t = "blue"
200
+ }) => {
201
+ const { t: r } = LA(), { colorScheme: i, toggleColorScheme: a } = aA(), d = () => {
202
+ o ? o() : a();
203
+ }, n = i === "dark";
204
+ return /* @__PURE__ */ A(
205
+ kA,
206
+ {
207
+ variant: "transparent",
208
+ color: n ? e : t,
209
+ onClick: () => d(),
210
+ title: R().t("archbase:toggleColorScheme"),
211
+ children: n ? /* @__PURE__ */ A(GA, { size: "1.5rem" }) : /* @__PURE__ */ A(KA, { size: "1.5rem" })
212
+ }
213
+ );
214
+ }, go = (o) => /* @__PURE__ */ A(OA, { gap: "sm", children: o.children });
215
+ function bo({ category: o, label: e, color: t, description: r, image: i, onClick: a }) {
216
+ return /* @__PURE__ */ A(
217
+ uA.Action,
218
+ {
219
+ onClick: a,
220
+ label: `${R().t(e || "")}`,
221
+ description: r ? R().t(r) : void 0,
222
+ leftSection: i ? /* @__PURE__ */ A(de, { children: /* @__PURE__ */ A(ue, { src: i, alt: R().t(e || ""), width: 24, height: 24 }) }) : void 0,
223
+ rightSection: o ? /* @__PURE__ */ A(ce, { color: t, size: "sm", children: R().t(o) }) : void 0
224
+ },
225
+ e
226
+ );
227
+ }
228
+ const wo = ({ navigationData: o, color: e }) => {
229
+ const [t, r] = oA(""), i = QA(), { t: a } = LA(), d = SA(() => {
230
+ const s = new Array();
231
+ return o.forEach((l) => {
232
+ l.links ? l.links.forEach((u) => {
233
+ !u.disabled && u.showInSidebar && s.push({
234
+ id: u.label,
235
+ category: u.category ? u.category.toUpperCase() : "",
236
+ color: u.color,
237
+ label: u.label,
238
+ link: u.link,
239
+ onClick: () => {
240
+ u.link && i(u.link);
241
+ }
242
+ });
243
+ }) : !l.disabled && l.showInSidebar && s.push({
244
+ id: l.label,
245
+ onClick: () => {
246
+ l.link && i(l.link);
247
+ },
248
+ category: l.category ? l.category.toUpperCase() : "",
249
+ color: l.color,
250
+ label: l.label,
251
+ link: l.link
252
+ });
253
+ }), s;
254
+ }, [o, i]), n = d.filter((s) => {
255
+ const l = `${a(s.label || "")}`;
256
+ return l && l.toLowerCase().includes(t.toLowerCase().trim());
257
+ }).map((s) => /* @__PURE__ */ A(bo, { ...s }, s.id));
258
+ return /* @__PURE__ */ A(AA, { children: d && d.length > 0 ? /* @__PURE__ */ Q(AA, { children: [
259
+ /* @__PURE__ */ A(gA, { withinPortal: !0, withArrow: !0, label: `${a("archbase:Comandos ⌘M")}`, children: /* @__PURE__ */ A(ie, { color: e, leftSection: /* @__PURE__ */ A(be, { size: "24px" }), onClick: () => je.open() }) }),
260
+ /* @__PURE__ */ Q(
261
+ uA.Root,
262
+ {
263
+ shortcut: ["mod + M", "/"],
264
+ onQueryChange: (s) => r(s),
265
+ query: t,
266
+ children: [
267
+ /* @__PURE__ */ A(uA.Search, { placeholder: `${a("archbase:Localizar...")}`, leftSection: /* @__PURE__ */ A(we, { size: "1.2rem" }) }),
268
+ /* @__PURE__ */ A(uA.ActionsList, { children: n.length > 0 ? n : /* @__PURE__ */ A(uA.Empty, { children: R().t("archbase:Nenhum resultado...") }) })
269
+ ]
270
+ }
271
+ )
272
+ ] }) : null });
273
+ }, mo = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAsLCwsMCw0ODg0SExETEhoYFhYYGiccHhweHCc8JSslJSslPDVANDA0QDVfSkJCSl9tXFdcbYR2doSnnqfa2v8BCwsLCwwLDQ4ODRITERMSGhgWFhgaJxweHB4cJzwlKyUlKyU8NUA0MDRANV9KQkJKX21cV1xthHZ2hKeep9ra///CABEIA7IDsgMBIgACEQEDEQH/xAAaAAEAAwEBAQAAAAAAAAAAAAAAAwQFAgEH/9oACAEBAAAAAPoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHMMUfPg9de9ddSd9gAAAAAAAAAAAAAAAOK9eIAAHUs08gAAAAAAAAAAAAAACCrAAAABLbsAAAAAAAAAAAAAAHNWtwAAAAE+h6AAAAAAAAAAAAAEdSsAAAAAT6IAAAAAAAAAAAAB5SqgAAAAA1JAAAAAAAAAAAAAIKPAAAAAAGjOePQAAAAAAAAAAAKdMAAAAAA96888ezXJQAAAAAAAAAAChWAAAAAAAB7ozAAAAAAAAAAAUKwAAAAAAADvU9AAAAAAAAAACpSAAAAAAAAFy4AAAAAAAAAAIswAAAAAAAAPdXoAAAAAAAAAAzIgAAAAAAAAWrwAAAA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Ixvqv5s0v9JekWNWY7mzS/wBJekHPCjHYWeW+kPJ6QmWpDpubPKn8s9m6Qmzmgs8oeceD0hMGsU9gBZ5dqRQNx0g7cTsdybOCVIO2AQQCOjorcMNj2tMtEqpQ6jTo6ZiVIQemtpVirAjCOrqCOjI0YIKDmtcOI0Nqj3GEdXFR0SSAMRJn0T+8EkmptiuyGqnEKOr5HJuhq0w8yi5L8x/5h4jufmNwhzDpkcxhIqPofY9BMyqKkgYeaGiD3OGd35jdEmIi9x3wkxDbX5TfnjImpz2GHmXPKKYJJNSa3hXZeUkYWaYcwBwseG3rTzeXmETLU9sPHiP60Gwvyu68rEYWaccwBwsxDb1p5xW5vMIuQzOHjO+poNh0GrsnKxGFmmHMK4WNDfRvY2+JMIuQzOHiu+py26ISLETRsLND9y4V0fNSDanjonc9sPGd9TQbDowEjTCTMRdfmGEmIbetD3szx0Tudhh4zv60Gw6RSI6aHCTSnmFMAhhUGosLx0T1qe2Hju/rQbDpVWZTVSRhJr0ce4wrKwqpr+teYRdPmOHjRH1NBsOmQxU1BocQ5r0ce4wGDCoNR+piTKjJczh4jvzN06rshqpphJlTk+RwCD+liRkh9zth4rxNTlt1CkR05ThJlTkwof8AmAQf0JIAqTTEWZJyTIb9SpEdOU4hzKtk2R/3xIqw9ddsPEeIc+qEivD0OW2IcZHy0O3+yLMAZJmd8Ekmp6rhzDLk2YwrqwqpqP8ATMZQj1dLk/FH+P8A/8QAFBEBAAAAAAAAAAAAAAAAAAAAsP/aAAgBAgEBPwBhD//EABQRAQAAAAAAAAAAAAAAAAAAALD/2gAIAQMBAT8AYQ//2Q==", cr = ({
274
+ userMenuItems: o,
275
+ showUserMenuToggleColorScheme: e = !0,
276
+ showUserMenuOptionsLabel: t = !0,
277
+ userMenuToggleColorSchemeIconSize: r = 14,
278
+ showMenuItemsAfterToggleColorScheme: i = !0,
279
+ userMenuItemsAfterToggleColorScheme: a,
280
+ showMenuItemsBeforeToggleColorScheme: d = !0,
281
+ userMenuItemsBeforeToggleColorScheme: n,
282
+ hideAutoHeaderActionsOnUserMenu: s = !0,
283
+ showHeaderActions: l = !0,
284
+ showHeaderToggleColorScheme: u = !0,
285
+ hideAutoHeaderActionsOnUserMenuBreakPoint: v,
286
+ withDividerAfterUserMenuToggleColorScheme: h = !0,
287
+ user: w,
288
+ navigationData: P = [],
289
+ logo: M,
290
+ headerActions: L,
291
+ styleLogo: D,
292
+ showLanguageSelector: f = !1,
293
+ sideBarHiddenBreakPoint: z,
294
+ headerLeftContent: O,
295
+ toggleColorScheme: $,
296
+ logoLeftSection: Y,
297
+ logoRightSection: G,
298
+ showBurger: W = !0,
299
+ showCommands: V = !0,
300
+ sunColor: J,
301
+ moonColor: q,
302
+ styles: p
303
+ }) => {
304
+ const c = TA(), { colorScheme: g, toggleColorScheme: m } = aA(), x = mA(vA), b = MA(
305
+ `(max-width: ${z ? H(z) : c.breakpoints.md})`
306
+ ), y = MA(
307
+ `(max-width: ${v ? H(v) : c.breakpoints.md})`
308
+ );
309
+ let K = !1, S = !1;
310
+ return s && (l = !y, u = !y, e = y, t = y, d = y, h = y, f && (S = !y, K = y)), /* @__PURE__ */ Q(AA, { children: [
311
+ /* @__PURE__ */ Q(EA, { style: { width: 300, height: 50 }, align: "center", children: [
312
+ Y,
313
+ /* @__PURE__ */ A(
314
+ "img",
315
+ {
316
+ style: {
317
+ height: 50,
318
+ ...D
319
+ },
320
+ alt: "logo",
321
+ src: M
322
+ }
323
+ ),
324
+ G
325
+ ] }),
326
+ W && /* @__PURE__ */ A(
327
+ pe,
328
+ {
329
+ opened: x.hidden ? x.hidden : !1,
330
+ onClick: () => x.setHidden(!x.hidden),
331
+ size: "sm",
332
+ color: c.colors.gray[7],
333
+ mx: { base: "xs", xs: "lg", sm: "xl" },
334
+ display: b ? "" : "none"
335
+ }
336
+ ),
337
+ /* @__PURE__ */ A("div", { children: V && /* @__PURE__ */ A(wo, { navigationData: P }) }),
338
+ /* @__PURE__ */ A(he, { style: { flex: 1 }, children: O }),
339
+ /* @__PURE__ */ Q(go, { children: [
340
+ l && L,
341
+ u && /* @__PURE__ */ A(fo, { toggleColorScheme: $, sunColor: J, moonColor: q }),
342
+ S && /* @__PURE__ */ A(po, {}),
343
+ /* @__PURE__ */ Q(T, { shadow: "md", width: 200, position: "bottom-end", styles: p?.menu, children: [
344
+ /* @__PURE__ */ A(T.Target, { children: /* @__PURE__ */ Q("div", { children: [
345
+ /* @__PURE__ */ A(
346
+ fe,
347
+ {
348
+ style: { cursor: "pointer" },
349
+ radius: "xl",
350
+ ml: 8,
351
+ src: w ? w.photo : mo,
352
+ alt: w ? w.displayName : ""
353
+ }
354
+ ),
355
+ w && w.isAdmin ? /* @__PURE__ */ A(
356
+ "div",
357
+ {
358
+ style: {
359
+ width: "16px",
360
+ display: "flex",
361
+ border: "1px solid yellow",
362
+ justifyContent: "center",
363
+ alignItems: "center",
364
+ height: "16px",
365
+ bottom: 5,
366
+ right: 5,
367
+ position: "absolute",
368
+ zIndex: 400,
369
+ borderRadius: 50,
370
+ backgroundColor: "green"
371
+ },
372
+ children: /* @__PURE__ */ A(UA, { size: "xs", c: "white", children: "A" })
373
+ }
374
+ ) : null
375
+ ] }) }),
376
+ /* @__PURE__ */ Q(T.Dropdown, { children: [
377
+ o,
378
+ t && /* @__PURE__ */ A(T.Label, { children: `${R().t("archbase:Opções")}` }),
379
+ d && n,
380
+ e && /* @__PURE__ */ A(
381
+ T.Item,
382
+ {
383
+ leftSection: g === "dark" ? /* @__PURE__ */ A(GA, { size: r }) : /* @__PURE__ */ A(KA, { size: r }),
384
+ onClick: $ || m,
385
+ children: `${R().t("archbase:toggleColorScheme")}`
386
+ }
387
+ ),
388
+ K && /* @__PURE__ */ A(ho, {}),
389
+ h && /* @__PURE__ */ A(T.Divider, {}),
390
+ i && a
391
+ ] })
392
+ ] })
393
+ ] })
394
+ ] });
395
+ };
396
+ function $A(o, e, t, r, i, a, d, n, s, l) {
397
+ const u = a ? o.colorScheme === "dark" ? o.colors[o.primaryColor][8] : o.colors[o.primaryColor][7] : void 0, v = a ? (o.colorScheme === "dark", o.colors[o.primaryColor][0]) : void 0;
398
+ if (r.links) {
399
+ if (!(r.disabled && r.hideDisabledItem))
400
+ return /* @__PURE__ */ A(gA, { disabled: !e, label: dA.t(r.label), children: /* @__PURE__ */ A(
401
+ ro,
402
+ {
403
+ rootStyles: {
404
+ fontSize: "16px",
405
+ [`.${F.button}`]: {
406
+ "&:hover": {
407
+ [`.${F.icon}`]: {
408
+ color: "white"
409
+ },
410
+ [`.${F.label}`]: {
411
+ color: "white"
412
+ }
413
+ }
414
+ },
415
+ [`.${F.subMenuContent}`]: {
416
+ width: e && l
417
+ }
418
+ },
419
+ id: r.label,
420
+ icon: r.icon,
421
+ defaultOpen: !r.disabled,
422
+ label: e ? "" : dA.t(r.label),
423
+ disabled: r.disabled,
424
+ children: r.links && r.links.filter((h) => h.showInSidebar === !0 && (!h.disabled || !h.hideDisabledItem)).map((h, w) => /* @__PURE__ */ A(
425
+ FA,
426
+ {
427
+ onClick: () => t(h),
428
+ rootStyles: {
429
+ [`.${F.icon}`]: {
430
+ background: u,
431
+ color: n && h.link === d ? "white" : v
432
+ },
433
+ [`.${F.label}`]: {
434
+ color: n && h.link === d ? "white" : s
435
+ },
436
+ [`.${F.button}`]: {
437
+ paddingLeft: "40px !important",
438
+ "&:hover": {
439
+ [`.${F.icon}`]: {
440
+ color: "white"
441
+ },
442
+ [`.${F.label}`]: {
443
+ color: "white"
444
+ }
445
+ }
446
+ }
447
+ },
448
+ id: h.label,
449
+ icon: h.icon,
450
+ disabled: typeof h.disabled == "function" ? h.disabled() : h.disabled,
451
+ active: n && h.link === d,
452
+ children: dA.t(h.label)
453
+ },
454
+ w
455
+ ))
456
+ },
457
+ i
458
+ ) });
459
+ } else if (r.showInSidebar && (!r.disabled || !r.hideDisabledItem))
460
+ return /* @__PURE__ */ A(gA, { disabled: !e, label: dA.t(r.label), children: /* @__PURE__ */ A(
461
+ FA,
462
+ {
463
+ rootStyles: {
464
+ fontSize: "16px",
465
+ [`.${F.button}`]: {
466
+ "&:hover": {
467
+ [`.${F.icon}`]: {
468
+ color: "white"
469
+ },
470
+ [`.${F.label}`]: {
471
+ color: "white"
472
+ }
473
+ }
474
+ },
475
+ [`.${F.icon}`]: {
476
+ background: u,
477
+ color: n && r.link === d ? "white" : v
478
+ },
479
+ [`.${F.label}`]: {
480
+ color: n && r.link === d ? "white" : s
481
+ }
482
+ },
483
+ id: r.label,
484
+ disabled: typeof r.disabled == "function" ? r.disabled() : r.disabled,
485
+ onClick: () => t(r),
486
+ icon: r.icon,
487
+ active: n && r.link === d,
488
+ children: e ? "" : dA.t(r.label)
489
+ },
490
+ i
491
+ ) });
492
+ return null;
493
+ }
494
+ const ko = (o) => ({
495
+ light: {
496
+ sidebar: {
497
+ backgroundColor: "#ffffff",
498
+ color: "#607489"
499
+ },
500
+ menu: {
501
+ menuContent: "#fbfcfd",
502
+ icon: "#0098e5",
503
+ hover: {
504
+ backgroundColor: "#c5e4ff",
505
+ color: "#44596e"
506
+ },
507
+ disabled: {
508
+ color: "#9fb6cf"
509
+ }
510
+ }
511
+ },
512
+ dark: {
513
+ sidebar: {
514
+ backgroundColor: "#0b2948",
515
+ color: "#8ba1b7"
516
+ },
517
+ menu: {
518
+ menuContent: "#082440",
519
+ icon: "#59d0ff",
520
+ hover: {
521
+ backgroundColor: "#00458b",
522
+ color: "#b6c8d9"
523
+ },
524
+ disabled: {
525
+ color: "#3e5e7e"
526
+ }
527
+ }
528
+ }
529
+ }), vo = (o, e, t, r, i, a, d, n, s, l, u) => {
530
+ const v = ko(), h = a ? {} : { padding: t ? `0 ${(i - r) / 2}px` : "0 20px" }, w = a ? {} : { display: "none" }, P = d ? o === "dark" ? e.colors[e.primaryColor][8] : e.colors[e.primaryColor][0] : void 0;
531
+ return {
532
+ root: {
533
+ fontSize: "14px",
534
+ fontWeight: 400,
535
+ backgroundColor: s,
536
+ color: e.white
537
+ },
538
+ icon: {
539
+ background: P,
540
+ color: u,
541
+ [`&.${F.disabled}`]: {
542
+ color: v[o].menu.disabled.color
543
+ }
544
+ },
545
+ SubMenuExpandIcon: {
546
+ color: "#b6b7b9",
547
+ ...w
548
+ },
549
+ subMenuContent: () => ({
550
+ backgroundColor: o === "dark" ? e.colors.dark[8] : e.colors[e.primaryColor][0]
551
+ }),
552
+ button: {
553
+ [`&.${F.disabled}`]: {
554
+ color: v[o].menu.disabled.color
555
+ },
556
+ "&:hover": {
557
+ backgroundColor: e.colors[e.primaryColor][6],
558
+ color: e.white
559
+ },
560
+ [`&.${F.active}`]: {
561
+ backgroundColor: e.colors[e.primaryColor][6]
562
+ },
563
+ height: n,
564
+ ...h
565
+ },
566
+ label: ({ open: M }) => ({
567
+ fontWeight: M ? 600 : void 0,
568
+ color: l,
569
+ "&:hover": {
570
+ color: e.white
571
+ }
572
+ })
573
+ };
574
+ };
575
+ function Co(o, e, t, r, i, a, d, n, s, l, u) {
576
+ return /* @__PURE__ */ Q(
577
+ jA,
578
+ {
579
+ ref: o,
580
+ rootStyles: {
581
+ [`.${WA.container}`]: {
582
+ position: "absolute",
583
+ background: u,
584
+ overflowX: "hidden",
585
+ overflowY: "hidden",
586
+ left: 0,
587
+ right: 0,
588
+ height: d ? "calc(100vh - 28px)" : `${H(n)}px`
589
+ }
590
+ },
591
+ collapsed: e,
592
+ width: `${H(t)}px`,
593
+ collapsedWidth: `${H(r)}px`,
594
+ children: [
595
+ s && /* @__PURE__ */ A(AA, { children: s }),
596
+ /* @__PURE__ */ A(DA, { style: { overflowY: "auto", overflowX: "hidden", height: n }, children: /* @__PURE__ */ A(JA, { rootStyles: { background: u }, menuItemStyles: i, closeOnClick: !0, children: a && /* @__PURE__ */ A(AA, { children: a }) }) }),
597
+ l && /* @__PURE__ */ A(AA, { children: l })
598
+ ]
599
+ }
600
+ );
601
+ }
602
+ function BA({
603
+ navigationData: o,
604
+ sidebarGroupWidth: e = "80px",
605
+ sidebarWidth: t = "360px",
606
+ sidebarHeight: r = "calc(100vh - var(--app-shell-header-offset, 0px))",
607
+ sidebarCollapsedWidth: i = "60px",
608
+ selectedGroupColor: a,
609
+ groupColor: d,
610
+ backgroundGroupColor: n,
611
+ isHidden: s = !1,
612
+ sideBarFooterHeight: l,
613
+ sideBarFooterContent: u,
614
+ groupLabelDarkColor: v,
615
+ groupLabelLightColor: h,
616
+ collapsed: w,
617
+ onMenuItemClick: P,
618
+ onClickActionIcon: M,
619
+ withBorder: L = !1,
620
+ showGroupLabels: D = !0,
621
+ theme: f,
622
+ sidebarRef: z,
623
+ defaultGroupIcon: O,
624
+ selectedGroupName: $,
625
+ sideBarHeaderContent: Y,
626
+ iconsWithBackground: G = !1,
627
+ menuItemHeight: W = 40,
628
+ highlightActiveMenuItem: V = !0,
629
+ backgroundDarkColor: J,
630
+ backgroundLightColor: q,
631
+ textDarkColor: p,
632
+ textLightColor: c,
633
+ iconDarkColor: g,
634
+ iconLightColor: m,
635
+ collapsedSubmenuWidth: x
636
+ }) {
637
+ const [b, y] = oA(""), K = RA(), S = zA(), { colorScheme: k } = aA(), X = k === "dark" ? J ?? f.colors.dark[7] : q ?? f.white, lA = a || (k === "dark" ? f.colors[f.primaryColor][8] : f.colors[f.primaryColor][0]), eA = k === "dark" ? p ?? "var(--mantine-color-text)" : c ?? "var(--mantine-color-text)", hA = k === "dark" ? g ?? f.colors[f.primaryColor][0] : m ?? f.colors[f.primaryColor][7], N = SA(() => {
638
+ const B = /* @__PURE__ */ new Set();
639
+ return o.forEach((E) => {
640
+ if (E.showInSidebar && (!E.disabled || !E.hideDisabledItem)) {
641
+ let Z = !1;
642
+ E.group || (E.group = {
643
+ icon: O || /* @__PURE__ */ A(me, { size: "2.2rem", color: "#63B1FB", stroke: 1 }),
644
+ label: "Default",
645
+ name: "Default",
646
+ hint: "Default",
647
+ indexOrder: 0
648
+ }), B.forEach((C) => {
649
+ C.name === E.group.name && (Z = !0);
650
+ }), Z || B.add({
651
+ name: E.group.name,
652
+ indexOrder: E.group.indexOrder,
653
+ component: /* @__PURE__ */ A(
654
+ gA,
655
+ {
656
+ content: E.group.hint,
657
+ label: E.group.label,
658
+ disabled: D,
659
+ children: /* @__PURE__ */ Q(
660
+ bA,
661
+ {
662
+ gap: "2px",
663
+ style: {
664
+ alignItems: "center",
665
+ alignContent: "center",
666
+ justifyContent: "center",
667
+ textAlign: "center"
668
+ },
669
+ children: [
670
+ /* @__PURE__ */ A(
671
+ kA,
672
+ {
673
+ size: "48px",
674
+ variant: E.group.name === b ? "filled" : n ? "subtle" : "light",
675
+ color: E.group.name === b ? lA : d,
676
+ onClick: () => {
677
+ y((C) => (M && M(C, E.group.name), E.group.name === C && !s ? "" : E.group.name));
678
+ },
679
+ children: E.group.icon
680
+ }
681
+ ),
682
+ D ? /* @__PURE__ */ A(
683
+ UA,
684
+ {
685
+ size: "xs",
686
+ c: k === "dark" ? v || f.colors[f.primaryColor][2] : h || f.colors[f.primaryColor][2],
687
+ children: E.group.label
688
+ }
689
+ ) : !1
690
+ ]
691
+ }
692
+ )
693
+ },
694
+ E.group.name
695
+ )
696
+ });
697
+ }
698
+ }), B.forEach((E) => {
699
+ const Z = o.filter((C) => C.showInSidebar === !0 && (!C.disabled || !C.hideDisabledItem) && C.group && C.group.name === E.name);
700
+ E.links = Z.map((C, I) => $A(f, w, P, C, I, G, S.pathname, V, eA, x));
701
+ }), [...B].sort((E, Z) => E.indexOrder - Z.indexOrder);
702
+ }, [o, b, k, w, K.selectedCompany, V, S]), rA = vo(
703
+ k,
704
+ f,
705
+ w,
706
+ 35,
707
+ Number(H(i)),
708
+ N.length > 1,
709
+ G,
710
+ W,
711
+ X,
712
+ eA,
713
+ hA
714
+ ), nA = w || b === "" ? "0px" : `calc(${t} - ${e})`, fA = n || (k === "dark" ? f.colors[f.primaryColor][6] : f.colors[f.primaryColor][7]), iA = _(() => {
715
+ $ && N.map((B) => B.name).includes($) ? y($) : N.length > 1 && y("Default");
716
+ }, []);
717
+ return U(() => {
718
+ iA();
719
+ }, []), U(() => {
720
+ w ? y("") : b === "" && iA();
721
+ }, [w]), /* @__PURE__ */ A(AA, { children: N.length == 1 ? Co(
722
+ z,
723
+ w,
724
+ t,
725
+ i,
726
+ rA,
727
+ o.map((B, sA) => $A(f, w, P, B, sA, G, S.pathname, V, eA, x)),
728
+ s,
729
+ r,
730
+ Y,
731
+ u,
732
+ X
733
+ ) : /* @__PURE__ */ Q(EA, { direction: "column", w: w ? i : t, children: [
734
+ /* @__PURE__ */ A("div", { style: { height: "auto", width: "100%" }, children: Y }),
735
+ /* @__PURE__ */ Q(ge, { withBorder: L, h: r, w: "100%", display: "flex", children: [
736
+ N.length !== 0 && /* @__PURE__ */ A(
737
+ bA,
738
+ {
739
+ gap: "4px",
740
+ style: {
741
+ height: r,
742
+ width: e,
743
+ padding: "4px",
744
+ backgroundColor: fA
745
+ },
746
+ children: N.map((B) => B.component)
747
+ }
748
+ ),
749
+ b !== "" && /* @__PURE__ */ A(
750
+ jA,
751
+ {
752
+ ref: z,
753
+ rootStyles: {
754
+ [`.${WA.container}`]: {
755
+ background: X,
756
+ overflowX: "hidden",
757
+ overflowY: "hidden",
758
+ left: 0,
759
+ height: `${H(r)}px`
760
+ }
761
+ },
762
+ style: { borderColor: k === "dark" ? "#000" : "#efefef" },
763
+ collapsed: w,
764
+ width: `${H(nA)}`,
765
+ collapsedWidth: "0px",
766
+ children: /* @__PURE__ */ A(
767
+ DA,
768
+ {
769
+ style: {
770
+ overflowY: "auto",
771
+ overflowX: "hidden",
772
+ height: "100%",
773
+ width: nA
774
+ },
775
+ children: /* @__PURE__ */ A(JA, { rootStyles: { background: X }, menuItemStyles: rA, closeOnClick: !0, children: N.find((B) => B.name === b)?.links?.map((B, sA) => /* @__PURE__ */ A(j.Fragment, { children: B }, sA)) || null })
776
+ }
777
+ )
778
+ }
779
+ )
780
+ ] }),
781
+ /* @__PURE__ */ A("div", { style: { height: "auto", width: "100%" }, children: u })
782
+ ] }) });
783
+ }
784
+ const wA = (o) => null, yo = ({ children: o, ...e }) => {
785
+ const t = j.Children.toArray(o), r = t.filter((a) => j.isValidElement(a) ? a.type === wA : !1), i = t.filter((a) => j.isValidElement(a) ? a.type !== wA : !1);
786
+ return /* @__PURE__ */ Q(AA, { children: [
787
+ r.map((a) => /* @__PURE__ */ A(xo, { ...a.props, routesProps: e }, a.key)),
788
+ /* @__PURE__ */ A(qA, { ...e, children: i })
789
+ ] });
790
+ }, xo = ({ element: o, routesProps: e, ...t }) => {
791
+ const [r, i] = oA(!1);
792
+ return /* @__PURE__ */ Q(AA, { children: [
793
+ /* @__PURE__ */ A("div", { style: { display: r ? "unset" : "none" }, children: o }),
794
+ /* @__PURE__ */ A(qA, { ...e, children: /* @__PURE__ */ A(xA, { ...t, element: /* @__PURE__ */ A(So, { onRouteMatchChange: i }) }) })
795
+ ] });
796
+ }, So = ({ onRouteMatchChange: o }) => (Ae(() => (o(!0), () => {
797
+ o(!1);
798
+ }), [o]), null);
799
+ function Eo(o, e, t, r, i, a) {
800
+ return /* @__PURE__ */ A(
801
+ "div",
802
+ {
803
+ style: {
804
+ position: "absolute",
805
+ left: t.collapsed ? `calc(${i} - 14px)` : `calc(${r} - 14px)`,
806
+ top: "calc(100vh / 2)",
807
+ zIndex: "101"
808
+ },
809
+ children: /* @__PURE__ */ A(
810
+ kA,
811
+ {
812
+ bg: e.colors[e.primaryColor][4],
813
+ color: e.colors[e.primaryColor][6],
814
+ variant: "filled",
815
+ radius: "xl",
816
+ onClick: a,
817
+ children: t.collapsed ? /* @__PURE__ */ A(ke, {}) : /* @__PURE__ */ A(ve, {})
818
+ }
819
+ )
820
+ }
821
+ );
822
+ }
823
+ function Do({
824
+ children: o,
825
+ header: e,
826
+ footer: t,
827
+ sideBarWidth: r = "360px",
828
+ sideBarCollapsedWidth: i = "74px",
829
+ sideBarHiddenBreakPoint: a,
830
+ sideBarFooterHeight: d,
831
+ sideBarFooterContent: n,
832
+ onCollapsedSideBar: s,
833
+ onHiddenSidebar: l,
834
+ sidebarSelectedGroupName: u,
835
+ sidebarDefaultGroupIcon: v,
836
+ sideBarHeaderHeight: h,
837
+ sideBarHeaderContent: w,
838
+ selectedGroupColor: P = "#132441",
839
+ groupColor: M = "white",
840
+ backgroundGroupColor: L = "#132441",
841
+ groupLabelDarkColor: D = "white",
842
+ groupLabelLightColor: f = "white",
843
+ headerColor: z,
844
+ footerHeight: O,
845
+ iconsWithBackground: $,
846
+ menuItemHeight: Y,
847
+ showSideBar: G = !0,
848
+ showHeader: W = !0,
849
+ headerStyle: V = {},
850
+ highlightActiveMenuItem: J = !0,
851
+ customRenderSidebar: q,
852
+ showCollapsedButton: p = !0,
853
+ sideBarBackgroundDarkColor: c,
854
+ sideBarBackgroundLightColor: g,
855
+ sideBarTextDarkColor: m,
856
+ sideBarTextLightColor: x,
857
+ sideBarIconDarkColor: b,
858
+ sideBarIconLightColor: y,
859
+ sideBarCollapsedSubmenuWidth: K
860
+ }) {
861
+ const S = TA(), k = mA(vA), { colorScheme: X } = aA(), lA = _e(), [eA, hA] = Ao(), N = Ze(
862
+ `(max-width: ${a ? H(a) : S.breakpoints.md})`
863
+ ), rA = (C) => {
864
+ C.link && (C.routeParams ? lA(C.link, {}, C.routeParams) : lA(C.link));
865
+ }, nA = (C, I) => {
866
+ C == I && k.collapsed && k.setCollapsed(!1), k.setCollapsed(C == I);
867
+ }, fA = () => {
868
+ let C = 0, I = 0;
869
+ return h && (C = Number(H(h))), d && (I = Number(H(d))), `calc(100vh - var(--app-shell-header-offset, 0px) - ${C + I}px)`;
870
+ }, iA = () => {
871
+ let C = 0, I = 0;
872
+ return h && (C = Number(H(h))), d && (I = Number(H(d))), `calc(100vh - 28px - ${C + I}px)`;
873
+ }, B = SA(() => {
874
+ const C = [];
875
+ return k.navigationData.forEach((I, IA) => {
876
+ I.links ? I.links.forEach((tA, PA) => {
877
+ tA.keepAlive ? C.push(
878
+ /* @__PURE__ */ A(wA, { path: tA.link, element: tA.component }, `${tA.link}_${PA}`)
879
+ ) : C.push(/* @__PURE__ */ A(xA, { path: tA.link, element: tA.component }, `${tA.link}_${PA}`));
880
+ }) : I.keepAlive ? C.push(
881
+ /* @__PURE__ */ A(wA, { path: I.link, element: I.component }, `${I.link}_${IA}`)
882
+ ) : C.push(
883
+ /* @__PURE__ */ A(xA, { path: I.link, element: I.component }, `${I.link}_${IA}`)
884
+ );
885
+ }), C;
886
+ }, [k.navigationData, k.collapsed]), sA = _(() => {
887
+ k.setCollapsed(!k.collapsed);
888
+ }, [k.setCollapsed, k.collapsed]), E = _(() => {
889
+ k.setHidden(!k.hidden);
890
+ }, [k.setHidden, k.hidden]);
891
+ U(() => {
892
+ l && l(k.hidden);
893
+ }, [k.hidden, E]), U(() => {
894
+ s && s(k.collapsed);
895
+ }, [k.collapsed, s]);
896
+ const Z = k.collapsed ? i : r;
897
+ return /* @__PURE__ */ Q(
898
+ cA,
899
+ {
900
+ header: { height: "60px", collapsed: !W },
901
+ footer: { height: O || "0px" },
902
+ styles: {
903
+ main: {
904
+ background: X === "dark" ? S.colors.dark[8] : S.colors.gray[0],
905
+ overflow: "hidden"
906
+ }
907
+ },
908
+ children: [
909
+ /* @__PURE__ */ A(
910
+ cA.Header,
911
+ {
912
+ p: "xs",
913
+ color: z,
914
+ display: "flex",
915
+ style: {
916
+ backgroundColor: "var(--mantine-primary-color-8)",
917
+ alignItems: "center",
918
+ borderBottom: "none",
919
+ ...V
920
+ },
921
+ children: e
922
+ }
923
+ ),
924
+ /* @__PURE__ */ A(cA.Navbar, { children: !N && G ? q ? q({ width: r, height: fA(), isHidden: N }) : /* @__PURE__ */ A(
925
+ BA,
926
+ {
927
+ navigationData: k.navigationData,
928
+ sidebarHeight: fA(),
929
+ sidebarGroupWidth: i,
930
+ sidebarCollapsedWidth: i,
931
+ selectedGroupColor: P,
932
+ groupColor: M,
933
+ backgroundGroupColor: L,
934
+ groupLabelDarkColor: D,
935
+ groupLabelLightColor: f,
936
+ showGroupLabels: !1,
937
+ collapsed: k.collapsed,
938
+ sidebarWidth: r,
939
+ isHidden: N,
940
+ onMenuItemClick: rA,
941
+ onClickActionIcon: nA,
942
+ sideBarFooterHeight: d,
943
+ sideBarFooterContent: n,
944
+ sideBarHeaderContent: w,
945
+ theme: S,
946
+ sidebarRef: eA,
947
+ defaultGroupIcon: v,
948
+ selectedGroupName: u,
949
+ iconsWithBackground: $,
950
+ menuItemHeight: Y,
951
+ highlightActiveMenuItem: J,
952
+ backgroundDarkColor: c,
953
+ backgroundLightColor: g,
954
+ textDarkColor: m,
955
+ textLightColor: x,
956
+ iconDarkColor: b,
957
+ iconLightColor: y,
958
+ collapsedSubmenuWidth: K
959
+ }
960
+ ) : void 0 }),
961
+ /* @__PURE__ */ Q(cA.Main, { bg: X === "dark" ? S.colors.dark[8] : S.colors.gray[0], children: [
962
+ !N && p && Eo(
963
+ X,
964
+ S,
965
+ k,
966
+ r,
967
+ i,
968
+ sA
969
+ ),
970
+ /* @__PURE__ */ Q(
971
+ "div",
972
+ {
973
+ style: {
974
+ height: "calc(100vh - var(--app-shell-header-offset, 0px) - var(--app-shell-footer-offset, 0px) - var(--app-shell-padding) - 1rem)",
975
+ width: `calc(100vw - var(--app-shell-padding) - calc(${N ? "0px" : Z} + 1rem))`,
976
+ marginTop: "0.5rem",
977
+ marginLeft: `calc(${N ? "0px" : Z} + 0.5rem)`,
978
+ border: `1px solid ${X === "dark" ? S.colors.dark[4] : "#e4e9ef"}`,
979
+ borderRadius: "4px",
980
+ overflow: "none"
981
+ },
982
+ children: [
983
+ o,
984
+ /* @__PURE__ */ A("div", { style: { width: "100%", height: "calc(100% - 48px)" }, children: /* @__PURE__ */ Q(yo, { children: [
985
+ ...B
986
+ ] }) })
987
+ ]
988
+ }
989
+ ),
990
+ G && /* @__PURE__ */ A(
991
+ HA,
992
+ {
993
+ opened: k.hidden || !1,
994
+ onClose: E,
995
+ size: r,
996
+ padding: 0,
997
+ styles: {
998
+ header: { minHeight: "10px" }
999
+ },
1000
+ children: q ? q({ width: r, height: iA(), isHidden: N }) : /* @__PURE__ */ A(
1001
+ BA,
1002
+ {
1003
+ navigationData: k.navigationData,
1004
+ sidebarWidth: r,
1005
+ sidebarHeight: iA(),
1006
+ sidebarCollapsedWidth: i,
1007
+ sidebarGroupWidth: i,
1008
+ selectedGroupColor: P,
1009
+ groupColor: M,
1010
+ backgroundGroupColor: L,
1011
+ groupLabelDarkColor: D,
1012
+ groupLabelLightColor: f,
1013
+ showGroupLabels: !1,
1014
+ isHidden: N,
1015
+ onMenuItemClick: rA,
1016
+ onClickActionIcon: nA,
1017
+ theme: S,
1018
+ sidebarRef: eA,
1019
+ defaultGroupIcon: v,
1020
+ selectedGroupName: u,
1021
+ iconsWithBackground: $,
1022
+ menuItemHeight: Y,
1023
+ sideBarHeaderContent: w,
1024
+ sideBarFooterContent: n,
1025
+ sideBarFooterHeight: d,
1026
+ highlightActiveMenuItem: J,
1027
+ backgroundDarkColor: c,
1028
+ backgroundLightColor: g,
1029
+ textDarkColor: m,
1030
+ textLightColor: x,
1031
+ iconDarkColor: b,
1032
+ iconLightColor: y,
1033
+ collapsedSubmenuWidth: K
1034
+ }
1035
+ )
1036
+ }
1037
+ )
1038
+ ] }),
1039
+ /* @__PURE__ */ A(cA.Footer, { children: t })
1040
+ ]
1041
+ }
1042
+ );
1043
+ }
1044
+ function dr({
1045
+ navigationRootLink: o = "/",
1046
+ navigationData: e,
1047
+ user: t,
1048
+ children: r,
1049
+ header: i,
1050
+ footer: a,
1051
+ owner: d,
1052
+ company: n,
1053
+ sideBarWidth: s,
1054
+ sideBarCollapsedWidth: l,
1055
+ sideBarHiddenBreakPoint: u,
1056
+ sideBarFooterHeight: v,
1057
+ sideBarFooterContent: h,
1058
+ onCollapsedSideBar: w,
1059
+ onHiddenSidebar: P,
1060
+ sidebarDefaultGroupIcon: M,
1061
+ sidebarSelectedGroupName: L,
1062
+ sideBarHeaderHeight: D,
1063
+ sideBarHeaderContent: f,
1064
+ selectedGroupColor: z = "#132441",
1065
+ groupColor: O = "white",
1066
+ backgroundGroupColor: $ = "#132441",
1067
+ groupLabelDarkColor: Y = "white",
1068
+ groupLabelLightColor: G = "white",
1069
+ headerColor: W,
1070
+ footerHeight: V,
1071
+ iconsWithBackground: J,
1072
+ menuItemHeight: q,
1073
+ showSideBar: p,
1074
+ showHeader: c,
1075
+ headerStyle: g,
1076
+ highlightActiveMenuItem: m,
1077
+ enableSecurity: x = !1,
1078
+ securityOptions: b,
1079
+ customRenderSidebar: y,
1080
+ onNavigationDataChange: K,
1081
+ showCollapsedButton: S,
1082
+ initialSidebarCollapsed: k = !1,
1083
+ sideBarBackgroundDarkColor: X,
1084
+ sideBarBackgroundLightColor: lA,
1085
+ sideBarTextDarkColor: eA,
1086
+ sideBarTextLightColor: hA,
1087
+ sideBarIconDarkColor: N,
1088
+ sideBarIconLightColor: rA,
1089
+ sideBarCollapsedSubmenuWidth: nA
1090
+ }) {
1091
+ return /* @__PURE__ */ A(
1092
+ uo,
1093
+ {
1094
+ navigationData: e,
1095
+ navigationRootLink: o,
1096
+ user: t,
1097
+ owner: d,
1098
+ company: n,
1099
+ enableSecurity: x,
1100
+ securityOptions: b,
1101
+ onNavigationDataChange: K,
1102
+ initialSidebarCollapsed: k,
1103
+ children: /* @__PURE__ */ A(
1104
+ Do,
1105
+ {
1106
+ navigationRootLink: o,
1107
+ user: t,
1108
+ header: i,
1109
+ footer: a,
1110
+ owner: d,
1111
+ company: n,
1112
+ sideBarWidth: s,
1113
+ sideBarCollapsedWidth: l,
1114
+ sideBarHiddenBreakPoint: u,
1115
+ sideBarHeaderHeight: D,
1116
+ sideBarHeaderContent: f,
1117
+ sideBarFooterHeight: v,
1118
+ sideBarFooterContent: h,
1119
+ selectedGroupColor: z,
1120
+ groupColor: O,
1121
+ backgroundGroupColor: $,
1122
+ groupLabelDarkColor: Y,
1123
+ groupLabelLightColor: G,
1124
+ onCollapsedSideBar: w,
1125
+ onHiddenSidebar: P,
1126
+ sidebarDefaultGroupIcon: M,
1127
+ sidebarSelectedGroupName: L,
1128
+ headerColor: W,
1129
+ footerHeight: V,
1130
+ iconsWithBackground: J,
1131
+ menuItemHeight: q,
1132
+ showSideBar: p,
1133
+ showHeader: c,
1134
+ headerStyle: g,
1135
+ highlightActiveMenuItem: m,
1136
+ enableSecurity: x,
1137
+ customRenderSidebar: y,
1138
+ showCollapsedButton: S,
1139
+ sideBarBackgroundDarkColor: X,
1140
+ sideBarBackgroundLightColor: lA,
1141
+ sideBarTextDarkColor: eA,
1142
+ sideBarTextLightColor: hA,
1143
+ sideBarIconDarkColor: N,
1144
+ sideBarIconLightColor: rA,
1145
+ sideBarCollapsedSubmenuWidth: nA,
1146
+ children: r
1147
+ }
1148
+ )
1149
+ }
1150
+ );
1151
+ }
1152
+ const ZA = ee({
1153
+ state: { userCloseLinkRequest: "", linkClosed: "", isClosing: !1 },
1154
+ dispatch: (o) => null
1155
+ }), ur = ({ children: o }) => {
1156
+ const e = {
1157
+ userCloseLinkRequest: "",
1158
+ linkClosed: "",
1159
+ isClosing: !1
1160
+ }, t = (a, d) => {
1161
+ switch (d.type) {
1162
+ case "USER_CLOSE_REQUEST":
1163
+ return { ...a, userCloseLinkRequest: d.link, isClosing: !0 };
1164
+ case "CLOSE_ALLOWED":
1165
+ return { ...a, linkClosed: d.link, userCloseLinkRequest: "", isClosing: !1, payload: d.payload };
1166
+ case "DONE":
1167
+ return { ...a, linkClosed: d.link, isClosing: !1 };
1168
+ case "CLEAR_PAYLOAD":
1169
+ const n = { ...a };
1170
+ return delete n.payload, n;
1171
+ default:
1172
+ return a;
1173
+ }
1174
+ }, [r, i] = oe(t, e);
1175
+ return /* @__PURE__ */ A(ZA.Provider, { value: { state: r, dispatch: i }, children: o });
1176
+ }, _A = () => {
1177
+ const o = mA(ZA);
1178
+ if (!o)
1179
+ throw new Error("useArchbaseNavigationContext deve ser usado dentro de um ArchbaseNavigationProvider");
1180
+ return o;
1181
+ }, pr = (o, e) => {
1182
+ const t = _A(), { state: r, dispatch: i } = t, a = _((n) => {
1183
+ i({ type: "CLOSE_ALLOWED", link: o, payload: n });
1184
+ }, [i, o]);
1185
+ U(() => {
1186
+ r && r.userCloseLinkRequest && r.userCloseLinkRequest === o && e();
1187
+ }, [r, o, e]);
1188
+ const d = r.isClosing && r.userCloseLinkRequest === o;
1189
+ return { closeAllowed: a, isClosing: d };
1190
+ };
1191
+ function hr({
1192
+ navigationData: o,
1193
+ onChangeOpenedTabs: e,
1194
+ onChangeActiveTabId: t,
1195
+ activeTabId: r,
1196
+ openedTabs: i = []
1197
+ }) {
1198
+ const [a, d] = j.useTransition(), n = QA(), { colorScheme: s } = aA(), [l, u] = oA(i), [v, h] = oA(r), w = zA(), P = re([]);
1199
+ no(P);
1200
+ const M = _A(), { state: L, dispatch: D } = M, f = mA(vA), z = _((p, c) => {
1201
+ const g = l.findIndex((S) => S.path === p);
1202
+ let m = c?.redirectUrl;
1203
+ !m && g >= 0 && (m = l[g].redirect);
1204
+ const x = l.filter((S) => S.id !== p);
1205
+ let b = -1;
1206
+ x.forEach((S, k) => S.id === v && (b = k));
1207
+ let y = null;
1208
+ x.length > 0 && x[b] ? y = x[b].id : x.length > 0 ? y = x[x.length - 1].id : y = null;
1209
+ const K = x.map((S) => ({
1210
+ ...S,
1211
+ active: y === S.id
1212
+ }));
1213
+ u(K), e && e(K), y && y != null ? (h(y), t && t(y), n(m || y)) : (h(void 0), t && t(void 0), n(f.navigationRootLink)), D({ type: "DONE", link: "" });
1214
+ }, [l, v, n, f.navigationRootLink, D, e, t]);
1215
+ U(() => {
1216
+ L?.linkClosed && z(L?.linkClosed, L?.payload);
1217
+ }, [L?.linkClosed, L?.payload, z]);
1218
+ const O = (p) => {
1219
+ const c = {
1220
+ item: void 0,
1221
+ title: void 0,
1222
+ link: p,
1223
+ redirect: void 0,
1224
+ customTitle: void 0
1225
+ };
1226
+ return o.forEach((g) => {
1227
+ if (g.links)
1228
+ g.links.forEach((m) => {
1229
+ NA({ path: m.link || "" }, location.pathname) && (c.item = m, c.title = `${R().t(m.label)}`, c.redirect = m.redirect, c.customTitle = m.customTitle);
1230
+ });
1231
+ else if (g.link && !c.item) {
1232
+ const m = NA({ path: g.link }, location.pathname);
1233
+ m && (m.params && Object.keys(m.params).length > 0 ? c.title = `${m.params[Object.keys(m.params)[0]]}` : c.title = `${R().t(g.label)}`, c.item = g, c.redirect = g.redirect, c.customTitle = g.customTitle);
1234
+ }
1235
+ }), c.customTitle && (c.customTitle = c.customTitle.replace("$title", c.title)), c;
1236
+ };
1237
+ U(() => {
1238
+ u(i);
1239
+ }, [JSON.stringify(i)]), U(() => {
1240
+ const p = O(w.pathname);
1241
+ if (p && p.item) {
1242
+ const c = l.findIndex((g) => g.path === p.link);
1243
+ c !== -1 ? (l[c].title = p.title, h(l[c].id), t && t(l[c].id)) : u((g) => (g.push({
1244
+ id: `${p.link}`,
1245
+ title: `${p.title}`,
1246
+ path: `${p.link}`,
1247
+ active: !0,
1248
+ content: p.item.component,
1249
+ iconClass: p.item.icon,
1250
+ closeButton: !0,
1251
+ redirect: p.redirect,
1252
+ customTitle: p.customTitle
1253
+ }), e && e(l), h(`${p.link}`), g));
1254
+ }
1255
+ }, [w.pathname]);
1256
+ const $ = (p) => {
1257
+ const c = l.filter((g) => g.id === p);
1258
+ c && c.length > 0 && w.pathname !== c[0].path && n(c[0].path), d(() => {
1259
+ h(p), t && t(p);
1260
+ });
1261
+ }, Y = (p) => {
1262
+ try {
1263
+ D({ type: "USER_CLOSE_REQUEST", link: p });
1264
+ } catch (c) {
1265
+ console.error("[TabContainer] Dispatch failed:", c);
1266
+ }
1267
+ }, G = _(() => {
1268
+ u([]), e && e([]), h(void 0), t && t(void 0), n(f.navigationRootLink);
1269
+ }, [n, f.navigationRootLink, e, t]), W = _((p) => {
1270
+ const c = l.findIndex((b) => b.id === p);
1271
+ if (c <= 0)
1272
+ return;
1273
+ const g = l.slice(c), m = g.find((b) => b.id === v)?.id || g[0]?.id, x = g.map((b) => ({
1274
+ ...b,
1275
+ active: b.id === m
1276
+ }));
1277
+ if (u(x), e && e(x), m) {
1278
+ h(m), t && t(m);
1279
+ const b = x.find((y) => y.id === m);
1280
+ b && w.pathname !== b.path && n(b.path);
1281
+ }
1282
+ }, [l, v, n, w.pathname, e, t]), V = _((p) => {
1283
+ const c = l.findIndex((b) => b.id === p);
1284
+ if (c === -1 || c >= l.length - 1)
1285
+ return;
1286
+ const g = l.slice(0, c + 1), m = g.find((b) => b.id === v)?.id || g[g.length - 1]?.id, x = g.map((b) => ({
1287
+ ...b,
1288
+ active: b.id === m
1289
+ }));
1290
+ if (u(x), e && e(x), m) {
1291
+ h(m), t && t(m);
1292
+ const b = x.find((y) => y.id === m);
1293
+ b && w.pathname !== b.path && n(b.path);
1294
+ }
1295
+ }, [l, v, n, w.pathname, e, t]), J = _((p) => {
1296
+ const c = l.find((m) => m.id === p);
1297
+ if (!c)
1298
+ return;
1299
+ const g = [{ ...c, active: !0 }];
1300
+ u(g), e && e(g), h(p), t && t(p), w.pathname !== c.path && n(c.path);
1301
+ }, [l, n, w.pathname, e, t]);
1302
+ return /* @__PURE__ */ A("div", { ref: P, children: /* @__PURE__ */ A(
1303
+ to,
1304
+ {
1305
+ buttonCloseOnlyActiveTab: !0,
1306
+ onClick: (p) => $(p),
1307
+ onTabClose: (p) => Y(p),
1308
+ onTabChange: (p) => null,
1309
+ onCloseAllTabs: G,
1310
+ onCloseLeftTabs: W,
1311
+ onCloseRightTabs: V,
1312
+ onCloseOtherTabs: J,
1313
+ currentTabs: ((p) => p.map((c) => ({
1314
+ key: c.id,
1315
+ favicon: c.iconClass,
1316
+ title: c.title,
1317
+ customTitle: c.customTitle
1318
+ })))(l),
1319
+ activeTab: v,
1320
+ dark: s === "dark"
1321
+ }
1322
+ ) });
1323
+ }
1324
+ const Ro = () => j.createElement("div", null, "Home View"), Lo = () => j.createElement("div", null, "Pedido Form"), Qo = () => j.createElement("div", null, "Pedido View"), zo = () => j.createElement("div", null, "Pessoa Form"), Io = () => j.createElement("div", null, "Pessoa View"), Po = {
1325
+ label: "Dashboard",
1326
+ icon: /* @__PURE__ */ A(ye, {}),
1327
+ link: "/dashboard",
1328
+ category: "DASHBOARD",
1329
+ color: "teal",
1330
+ component: /* @__PURE__ */ A("div", {}),
1331
+ showInSidebar: !0
1332
+ }, Mo = {
1333
+ label: "Home",
1334
+ icon: /* @__PURE__ */ A(Ce, {}),
1335
+ link: "/home",
1336
+ category: "HOME",
1337
+ color: "teal",
1338
+ component: /* @__PURE__ */ A(Ro, {}),
1339
+ showInSidebar: !0
1340
+ }, No = {
1341
+ label: "Consulta lista pessoas",
1342
+ link: "/pessoa/consulta",
1343
+ icon: /* @__PURE__ */ A(YA, {}),
1344
+ category: "PESSOAS",
1345
+ color: "pink",
1346
+ component: /* @__PURE__ */ A(Io, {}),
1347
+ showInSidebar: !0
1348
+ }, Fo = {
1349
+ label: "Nova pessoa",
1350
+ link: "/pessoa/nova",
1351
+ icon: /* @__PURE__ */ A(Se, {}),
1352
+ category: "PESSOAS",
1353
+ color: "pink",
1354
+ component: /* @__PURE__ */ A(zo, {}),
1355
+ showInSidebar: !0
1356
+ }, $o = {
1357
+ label: "Pessoas",
1358
+ icon: /* @__PURE__ */ A(xe, {}),
1359
+ links: [No, Fo],
1360
+ category: "PESSOAS",
1361
+ color: "pink",
1362
+ showInSidebar: !0
1363
+ }, Bo = {
1364
+ label: "Consulta lista pedidos",
1365
+ link: "/pedido/consulta",
1366
+ icon: /* @__PURE__ */ A(YA, {}),
1367
+ category: "PEDIDOS",
1368
+ color: "yellow",
1369
+ component: /* @__PURE__ */ A(Qo, {}),
1370
+ showInSidebar: !0
1371
+ }, Oo = {
1372
+ label: "Novo pedido",
1373
+ link: "/pedido/novo",
1374
+ icon: /* @__PURE__ */ A(De, {}),
1375
+ category: "PEDIDOS",
1376
+ color: "yellow",
1377
+ component: /* @__PURE__ */ A(Lo, {}),
1378
+ showInSidebar: !0
1379
+ }, To = {
1380
+ label: "Pedidos",
1381
+ icon: /* @__PURE__ */ A(Ee, {}),
1382
+ links: [Bo, Oo],
1383
+ category: "PEDIDOS",
1384
+ color: "yellow",
1385
+ showInSidebar: !0
1386
+ }, Uo = {
1387
+ label: "Configurações",
1388
+ link: "/config",
1389
+ icon: /* @__PURE__ */ A(Re, {}),
1390
+ category: "CONFIGURAÇÕES",
1391
+ color: "lime",
1392
+ component: /* @__PURE__ */ A("div", {}),
1393
+ showInSidebar: !0
1394
+ }, fr = [
1395
+ Mo,
1396
+ Po,
1397
+ $o,
1398
+ To,
1399
+ Uo
1400
+ ];
1401
+ function gr({ children: o, title: e = "", size: t = "440px", drawerKey: r, styles: i }) {
1402
+ const [a, { open: d, close: n }] = ae(!1), [s] = XA(), l = Je(), u = We();
1403
+ return U(() => {
1404
+ s.get("drawer") === r && d();
1405
+ }, [s]), /* @__PURE__ */ A(
1406
+ HA,
1407
+ {
1408
+ position: "right",
1409
+ opened: a,
1410
+ onClose: () => {
1411
+ n();
1412
+ const h = new URLSearchParams(s);
1413
+ h.delete("drawer"), l({
1414
+ pathname: u.pathname,
1415
+ search: h.toString()
1416
+ });
1417
+ },
1418
+ title: e,
1419
+ size: t,
1420
+ styles: i,
1421
+ children: o
1422
+ }
1423
+ );
1424
+ }
1425
+ function Ho(o) {
1426
+ const e = QA(), t = zA(), [r] = XA();
1427
+ return { openDrawer: () => {
1428
+ const a = new URLSearchParams(r);
1429
+ a.set("drawer", o), e({
1430
+ pathname: t.pathname,
1431
+ search: a.toString()
1432
+ });
1433
+ } };
1434
+ }
1435
+ function br({ drawerKey: o }) {
1436
+ const { openDrawer: e } = Ho(o);
1437
+ return U(() => {
1438
+ e();
1439
+ }, []), null;
1440
+ }
1441
+ const Go = {
1442
+ // Campos de identificação
1443
+ showNickname: !0,
1444
+ // Configurações de campos obrigatórios
1445
+ requiredNickname: !0,
1446
+ avatarMaxSizeKB: 2e3,
1447
+ avatarImageQuality: 1
1448
+ };
1449
+ function wr({ opened: o, handleClose: e, userId: t, updateUser: r, options: i }) {
1450
+ const a = le(), d = se(), n = Le(), s = ao(`myProfile${t}Store`), l = lo(Qe.User), u = { ...Go, ...i ?? {} }, { dataSource: v, isLoading: h, error: w, isError: P, clearError: M } = so({
1451
+ name: `dsUser${t}`,
1452
+ label: `${R().t("archbase:My Profile")}`,
1453
+ service: l,
1454
+ store: s,
1455
+ pageSize: 50,
1456
+ loadOnStart: !0,
1457
+ validator: n,
1458
+ id: t,
1459
+ onLoadComplete: (D) => {
1460
+ D.isBrowsing() && D.edit(), d();
1461
+ },
1462
+ onDestroy: (D) => {
1463
+ },
1464
+ onError: (D, f) => {
1465
+ eo.showError(R().t("archbase:WARNING"), D, f);
1466
+ }
1467
+ });
1468
+ U(() => {
1469
+ o && v && v.isBrowsing() && v.edit();
1470
+ }, [v, o]);
1471
+ const L = (D) => {
1472
+ D && (console.log(D), r(D.name, D.avatar));
1473
+ };
1474
+ return /* @__PURE__ */ A(
1475
+ io,
1476
+ {
1477
+ title: R().t("archbase:My Profile"),
1478
+ size: 800,
1479
+ height: "500px",
1480
+ opened: o,
1481
+ dataSource: v,
1482
+ onClickOk: e,
1483
+ onClickCancel: e,
1484
+ onAfterSave: L,
1485
+ children: /* @__PURE__ */ A(DA, { style: { height: "440px" }, ref: a, children: /* @__PURE__ */ Q(bA, { children: [
1486
+ /* @__PURE__ */ A(bA, { align: "center", children: /* @__PURE__ */ A(
1487
+ oo,
1488
+ {
1489
+ dataSource: v,
1490
+ dataField: "avatar",
1491
+ width: 200,
1492
+ height: 200,
1493
+ maxSizeKB: u.avatarMaxSizeKB,
1494
+ imageQuality: u.avatarImageQuality
1495
+ }
1496
+ ) }),
1497
+ /* @__PURE__ */ A(
1498
+ CA,
1499
+ {
1500
+ label: `${R().t("archbase:Nome completo")}`,
1501
+ placeholder: `${R().t("archbase:Informe o nome completo do usuário")}`,
1502
+ dataSource: v,
1503
+ dataField: "name",
1504
+ required: !0
1505
+ }
1506
+ ),
1507
+ u.showNickname && /* @__PURE__ */ A(
1508
+ CA,
1509
+ {
1510
+ label: `${R().t("archbase:Apelido")}`,
1511
+ placeholder: `${R().t("archbase:Apelido")}`,
1512
+ dataSource: v,
1513
+ dataField: "nickname",
1514
+ required: u.requiredNickname
1515
+ }
1516
+ ),
1517
+ /* @__PURE__ */ A(
1518
+ CA,
1519
+ {
1520
+ label: `${R().t("archbase:Descrição do usuário")}`,
1521
+ placeholder: `${R().t("archbase:Informe a descrição do usuário")}`,
1522
+ dataSource: v,
1523
+ dataField: "description",
1524
+ required: !0
1525
+ }
1526
+ )
1527
+ ] }) })
1528
+ }
1529
+ );
1530
+ }
1531
+ const mr = co((o) => ({
1532
+ nameStore: "ADMIN_STORE",
1533
+ openedTabs: [],
1534
+ activeTabId: void 0,
1535
+ collapsed: !1,
1536
+ setOpenedTabs: (e) => o({ openedTabs: e }),
1537
+ setActiveTabId: (e) => o({ activeTabId: e }),
1538
+ setCollapsed: (e) => o({ collapsed: e })
1539
+ }));
1540
+ export {
1541
+ vA as ArchbaseAdminLayoutContext,
1542
+ ir as ArchbaseAdminLayoutFooter,
1543
+ cr as ArchbaseAdminLayoutHeader,
1544
+ uo as ArchbaseAdminLayoutProvider,
1545
+ dr as ArchbaseAdminMainLayout,
1546
+ hr as ArchbaseAdminTabContainer,
1547
+ BA as ArchbaseAdvancedSidebar,
1548
+ yo as ArchbaseAliveAbleRoutes,
1549
+ po as ArchbaseChangeLanguageAction,
1550
+ fo as ArchbaseColorSchemeAction,
1551
+ gr as ArchbaseDrawerContent,
1552
+ br as ArchbaseDrawerTrigger,
1553
+ go as ArchbaseHeaderNavAction,
1554
+ wA as ArchbaseKeepAliveRoute,
1555
+ wr as ArchbaseMyProfileModal,
1556
+ ZA as ArchbaseNavigationContext,
1557
+ ur as ArchbaseNavigationProvider,
1558
+ wo as CommandPaletteButton,
1559
+ mo as defaultAvatar,
1560
+ Go as defaultMyProfileModalOptions,
1561
+ fr as navigationDataSample,
1562
+ mr as useArchbaseAdminStore,
1563
+ Ho as useArchbaseDrawer,
1564
+ _A as useArchbaseNavigationContext,
1565
+ pr as useArchbaseNavigationListener
1566
+ };