@shellui/core 0.0.14 → 0.0.15

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.
Files changed (175) hide show
  1. package/package.json +11 -25
  2. package/src/components/ui/dialog.tsx +3 -1
  3. package/src/components/ui/sidebar.tsx +14 -2
  4. package/src/features/config/ConfigProvider.ts +1 -1
  5. package/src/features/config/useConfig.ts +7 -2
  6. package/src/features/layouts/DefaultLayout.tsx +6 -1
  7. package/src/index.ts +2 -2
  8. package/src/service-worker/register.ts +2 -1
  9. package/dist/ContentView-CZG-ro_B.js +0 -146
  10. package/dist/ContentView-CZG-ro_B.js.map +0 -1
  11. package/dist/CookiePreferencesView-Bb3hFqw1.js +0 -213
  12. package/dist/CookiePreferencesView-Bb3hFqw1.js.map +0 -1
  13. package/dist/DefaultLayout-D3IpgS4j.js +0 -406
  14. package/dist/DefaultLayout-D3IpgS4j.js.map +0 -1
  15. package/dist/FullscreenLayout-Do9vAfl8.js +0 -30
  16. package/dist/FullscreenLayout-Do9vAfl8.js.map +0 -1
  17. package/dist/HomeView-DwckTuxz.js +0 -21
  18. package/dist/HomeView-DwckTuxz.js.map +0 -1
  19. package/dist/NotFoundView-DD7azhz-.js +0 -52
  20. package/dist/NotFoundView-DD7azhz-.js.map +0 -1
  21. package/dist/OverlayShell-kDY56DaN.js +0 -642
  22. package/dist/OverlayShell-kDY56DaN.js.map +0 -1
  23. package/dist/SettingsView-Bt4I-KDT.js +0 -2207
  24. package/dist/SettingsView-Bt4I-KDT.js.map +0 -1
  25. package/dist/ViewRoute-ChSPabOy.js +0 -32
  26. package/dist/ViewRoute-ChSPabOy.js.map +0 -1
  27. package/dist/WindowsLayout-CEqkRKyk.js +0 -633
  28. package/dist/WindowsLayout-CEqkRKyk.js.map +0 -1
  29. package/dist/app.d.ts +0 -3
  30. package/dist/app.d.ts.map +0 -1
  31. package/dist/components/ContentView.d.ts +0 -10
  32. package/dist/components/ContentView.d.ts.map +0 -1
  33. package/dist/components/HomeView.d.ts +0 -2
  34. package/dist/components/HomeView.d.ts.map +0 -1
  35. package/dist/components/LoadingOverlay.d.ts +0 -2
  36. package/dist/components/LoadingOverlay.d.ts.map +0 -1
  37. package/dist/components/NotFoundView.d.ts +0 -2
  38. package/dist/components/NotFoundView.d.ts.map +0 -1
  39. package/dist/components/RouteErrorBoundary.d.ts +0 -2
  40. package/dist/components/RouteErrorBoundary.d.ts.map +0 -1
  41. package/dist/components/ViewRoute.d.ts +0 -7
  42. package/dist/components/ViewRoute.d.ts.map +0 -1
  43. package/dist/components/ui/alert-dialog.d.ts +0 -32
  44. package/dist/components/ui/alert-dialog.d.ts.map +0 -1
  45. package/dist/components/ui/breadcrumb.d.ts +0 -20
  46. package/dist/components/ui/breadcrumb.d.ts.map +0 -1
  47. package/dist/components/ui/button-group.d.ts +0 -7
  48. package/dist/components/ui/button-group.d.ts.map +0 -1
  49. package/dist/components/ui/button.d.ts +0 -12
  50. package/dist/components/ui/button.d.ts.map +0 -1
  51. package/dist/components/ui/dialog.d.ts +0 -24
  52. package/dist/components/ui/dialog.d.ts.map +0 -1
  53. package/dist/components/ui/drawer.d.ts +0 -38
  54. package/dist/components/ui/drawer.d.ts.map +0 -1
  55. package/dist/components/ui/select.d.ts +0 -5
  56. package/dist/components/ui/select.d.ts.map +0 -1
  57. package/dist/components/ui/sidebar.d.ts +0 -46
  58. package/dist/components/ui/sidebar.d.ts.map +0 -1
  59. package/dist/components/ui/sonner.d.ts +0 -6
  60. package/dist/components/ui/sonner.d.ts.map +0 -1
  61. package/dist/components/ui/switch.d.ts +0 -8
  62. package/dist/components/ui/switch.d.ts.map +0 -1
  63. package/dist/constants/urls.d.ts +0 -6
  64. package/dist/constants/urls.d.ts.map +0 -1
  65. package/dist/constants/urls.js +0 -8
  66. package/dist/constants/urls.js.map +0 -1
  67. package/dist/features/alertDialog/DialogContext.d.ts +0 -12
  68. package/dist/features/alertDialog/DialogContext.d.ts.map +0 -1
  69. package/dist/features/config/ConfigProvider.d.ts +0 -15
  70. package/dist/features/config/ConfigProvider.d.ts.map +0 -1
  71. package/dist/features/config/types.d.ts +0 -177
  72. package/dist/features/config/types.d.ts.map +0 -1
  73. package/dist/features/config/useConfig.d.ts +0 -8
  74. package/dist/features/config/useConfig.d.ts.map +0 -1
  75. package/dist/features/cookieConsent/CookieConsentModal.d.ts +0 -6
  76. package/dist/features/cookieConsent/CookieConsentModal.d.ts.map +0 -1
  77. package/dist/features/cookieConsent/CookiePreferencesView.d.ts +0 -2
  78. package/dist/features/cookieConsent/CookiePreferencesView.d.ts.map +0 -1
  79. package/dist/features/cookieConsent/cookieConsent.d.ts +0 -22
  80. package/dist/features/cookieConsent/cookieConsent.d.ts.map +0 -1
  81. package/dist/features/cookieConsent/useCookieConsent.d.ts +0 -15
  82. package/dist/features/cookieConsent/useCookieConsent.d.ts.map +0 -1
  83. package/dist/features/drawer/DrawerContext.d.ts +0 -24
  84. package/dist/features/drawer/DrawerContext.d.ts.map +0 -1
  85. package/dist/features/layouts/AppLayout.d.ts +0 -12
  86. package/dist/features/layouts/AppLayout.d.ts.map +0 -1
  87. package/dist/features/layouts/DefaultLayout.d.ts +0 -10
  88. package/dist/features/layouts/DefaultLayout.d.ts.map +0 -1
  89. package/dist/features/layouts/FullscreenLayout.d.ts +0 -9
  90. package/dist/features/layouts/FullscreenLayout.d.ts.map +0 -1
  91. package/dist/features/layouts/LayoutProviders.d.ts +0 -9
  92. package/dist/features/layouts/LayoutProviders.d.ts.map +0 -1
  93. package/dist/features/layouts/OverlayShell.d.ts +0 -10
  94. package/dist/features/layouts/OverlayShell.d.ts.map +0 -1
  95. package/dist/features/layouts/WindowsLayout.d.ts +0 -24
  96. package/dist/features/layouts/WindowsLayout.d.ts.map +0 -1
  97. package/dist/features/layouts/utils.d.ts +0 -16
  98. package/dist/features/layouts/utils.d.ts.map +0 -1
  99. package/dist/features/modal/ModalContext.d.ts +0 -20
  100. package/dist/features/modal/ModalContext.d.ts.map +0 -1
  101. package/dist/features/sentry/initSentry.d.ts +0 -14
  102. package/dist/features/sentry/initSentry.d.ts.map +0 -1
  103. package/dist/features/settings/SettingsContext.d.ts +0 -10
  104. package/dist/features/settings/SettingsContext.d.ts.map +0 -1
  105. package/dist/features/settings/SettingsIcons.d.ts +0 -22
  106. package/dist/features/settings/SettingsIcons.d.ts.map +0 -1
  107. package/dist/features/settings/SettingsProvider.d.ts +0 -5
  108. package/dist/features/settings/SettingsProvider.d.ts.map +0 -1
  109. package/dist/features/settings/SettingsRoutes.d.ts +0 -7
  110. package/dist/features/settings/SettingsRoutes.d.ts.map +0 -1
  111. package/dist/features/settings/SettingsView.d.ts +0 -2
  112. package/dist/features/settings/SettingsView.d.ts.map +0 -1
  113. package/dist/features/settings/components/Advanced.d.ts +0 -2
  114. package/dist/features/settings/components/Advanced.d.ts.map +0 -1
  115. package/dist/features/settings/components/Appearance.d.ts +0 -2
  116. package/dist/features/settings/components/Appearance.d.ts.map +0 -1
  117. package/dist/features/settings/components/DataPrivacy.d.ts +0 -2
  118. package/dist/features/settings/components/DataPrivacy.d.ts.map +0 -1
  119. package/dist/features/settings/components/Develop.d.ts +0 -2
  120. package/dist/features/settings/components/Develop.d.ts.map +0 -1
  121. package/dist/features/settings/components/LanguageAndRegion.d.ts +0 -2
  122. package/dist/features/settings/components/LanguageAndRegion.d.ts.map +0 -1
  123. package/dist/features/settings/components/ServiceWorker.d.ts +0 -2
  124. package/dist/features/settings/components/ServiceWorker.d.ts.map +0 -1
  125. package/dist/features/settings/components/UpdateApp.d.ts +0 -2
  126. package/dist/features/settings/components/UpdateApp.d.ts.map +0 -1
  127. package/dist/features/settings/components/develop/DialogTestButtons.d.ts +0 -2
  128. package/dist/features/settings/components/develop/DialogTestButtons.d.ts.map +0 -1
  129. package/dist/features/settings/components/develop/DrawerTestButtons.d.ts +0 -2
  130. package/dist/features/settings/components/develop/DrawerTestButtons.d.ts.map +0 -1
  131. package/dist/features/settings/components/develop/ModalTestButtons.d.ts +0 -2
  132. package/dist/features/settings/components/develop/ModalTestButtons.d.ts.map +0 -1
  133. package/dist/features/settings/components/develop/ToastTestButtons.d.ts +0 -2
  134. package/dist/features/settings/components/develop/ToastTestButtons.d.ts.map +0 -1
  135. package/dist/features/settings/hooks/useSettings.d.ts +0 -2
  136. package/dist/features/settings/hooks/useSettings.d.ts.map +0 -1
  137. package/dist/features/sonner/SonnerContext.d.ts +0 -29
  138. package/dist/features/sonner/SonnerContext.d.ts.map +0 -1
  139. package/dist/features/theme/ThemeProvider.d.ts +0 -11
  140. package/dist/features/theme/ThemeProvider.d.ts.map +0 -1
  141. package/dist/features/theme/themes.d.ts +0 -114
  142. package/dist/features/theme/themes.d.ts.map +0 -1
  143. package/dist/features/theme/useTheme.d.ts +0 -10
  144. package/dist/features/theme/useTheme.d.ts.map +0 -1
  145. package/dist/i18n/I18nProvider.d.ts +0 -9
  146. package/dist/i18n/I18nProvider.d.ts.map +0 -1
  147. package/dist/i18n/config.d.ts +0 -23
  148. package/dist/i18n/config.d.ts.map +0 -1
  149. package/dist/i18n/translations/en/common.json.d.ts +0 -19
  150. package/dist/i18n/translations/en/cookieConsent.json.d.ts +0 -53
  151. package/dist/i18n/translations/en/settings.json.d.ts +0 -358
  152. package/dist/i18n/translations/fr/common.json.d.ts +0 -19
  153. package/dist/i18n/translations/fr/cookieConsent.json.d.ts +0 -53
  154. package/dist/i18n/translations/fr/settings.json.d.ts +0 -358
  155. package/dist/index-CfvdAI_Y.js +0 -2168
  156. package/dist/index-CfvdAI_Y.js.map +0 -1
  157. package/dist/index.d.ts +0 -7
  158. package/dist/index.d.ts.map +0 -1
  159. package/dist/index.js +0 -12
  160. package/dist/index.js.map +0 -1
  161. package/dist/lib/utils.d.ts +0 -3
  162. package/dist/lib/utils.d.ts.map +0 -1
  163. package/dist/lib/z-index.d.ts +0 -29
  164. package/dist/lib/z-index.d.ts.map +0 -1
  165. package/dist/router/router.d.ts +0 -3
  166. package/dist/router/router.d.ts.map +0 -1
  167. package/dist/router/routes.d.ts +0 -4
  168. package/dist/router/routes.d.ts.map +0 -1
  169. package/dist/sidebar-Dt-gibIZ.js +0 -336
  170. package/dist/sidebar-Dt-gibIZ.js.map +0 -1
  171. package/dist/style.css +0 -1
  172. package/dist/switch-CuKXfl3x.js +0 -44
  173. package/dist/switch-CuKXfl3x.js.map +0 -1
  174. package/dist/types.js +0 -2
  175. package/dist/types.js.map +0 -1
@@ -1,2168 +0,0 @@
1
- import { jsx as i, jsxs as C, Fragment as R } from "react/jsx-runtime";
2
- import { createContext as Se, useState as ne, createElement as st, useContext as me, forwardRef as G, lazy as M, Suspense as Y, useRef as ue, useEffect as z, useCallback as T, useMemo as Ee, useLayoutEffect as Ge } from "react";
3
- import { useRouteError as at, isRouteErrorResponse as lt, Outlet as ct, createBrowserRouter as dt, RouterProvider as ut } from "react-router";
4
- import { getLogger as Ae, shellui as m } from "@shellui/sdk";
5
- import { useTranslation as Te, initReactI18next as pt } from "react-i18next";
6
- import { Slot as gt } from "@radix-ui/react-slot";
7
- import { cva as Ke } from "class-variance-authority";
8
- import { clsx as ft } from "clsx";
9
- import { twMerge as mt } from "tailwind-merge";
10
- import we from "./constants/urls.js";
11
- import pe from "i18next";
12
- import * as E from "@radix-ui/react-alert-dialog";
13
- import { Workbox as ht } from "workbox-window";
14
- const K = Ae("shellcore"), qe = Se(null);
15
- let Be = !1;
16
- function vt(e) {
17
- const [t] = ne(() => {
18
- try {
19
- let o = __SHELLUI_CONFIG__;
20
- if (o === void 0 && typeof window < "u") {
21
- const s = window;
22
- s.__SHELLUI_CONFIG__ !== void 0 && (o = s.__SHELLUI_CONFIG__);
23
- }
24
- if (o != null && typeof o == "string")
25
- try {
26
- const s = JSON.parse(o);
27
- return typeof window < "u" && s.runtime === "tauri" && (window.__SHELLUI_TAURI__ = !0), process.env.NODE_ENV === "development" && !Be && (Be = !0, K.info("Config loaded from __SHELLUI_CONFIG__", {
28
- hasNavigation: !!s.navigation,
29
- navigationItems: s.navigation?.length || 0
30
- })), s;
31
- } catch (s) {
32
- K.error("Failed to parse config JSON:", { error: s }), K.error("Config value (first 200 chars):", { value: o.substring(0, 200) });
33
- }
34
- const n = globalThis;
35
- if (typeof n.__SHELLUI_CONFIG__ < "u" && o === void 0) {
36
- const s = n.__SHELLUI_CONFIG__, l = typeof s == "string" ? JSON.parse(s) : s;
37
- return typeof window < "u" && l.runtime === "tauri" && (window.__SHELLUI_TAURI__ = !0), process.env.NODE_ENV === "development" && K.warn("Config loaded from globalThis fallback (define may not have worked)"), l;
38
- }
39
- return process.env.NODE_ENV === "development" && K.warn(
40
- "Config not found. Using empty config. Make sure shellui.config.ts is properly loaded and Vite define is configured correctly."
41
- ), {};
42
- } catch (o) {
43
- return K.error("Failed to load ShellUI config:", { error: o }), {};
44
- }
45
- }), r = { config: t };
46
- return st(qe.Provider, { value: r }, e.children);
47
- }
48
- function X() {
49
- const e = me(qe);
50
- if (e === null) {
51
- const t = new Error(
52
- "useConfig must be used within a ConfigProvider. Make sure your app is wrapped with <ConfigProvider> and that Vite define is configured correctly."
53
- );
54
- throw typeof window < "u" && process.env.NODE_ENV === "development" && (console.error("[ShellUI] ConfigProvider error:", t), console.error("[ShellUI] Check that __SHELLUI_CONFIG__ is defined:", typeof window.__SHELLUI_CONFIG__)), t;
55
- }
56
- return e;
57
- }
58
- function $(...e) {
59
- return mt(ft(e));
60
- }
61
- const yt = Ke(
62
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
63
- {
64
- variants: {
65
- variant: {
66
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
67
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
68
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
69
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
70
- ghost: "hover:bg-accent hover:text-accent-foreground",
71
- link: "text-primary underline-offset-4 hover:underline"
72
- },
73
- size: {
74
- default: "h-10 px-4 py-2",
75
- sm: "h-9 rounded-md px-3",
76
- lg: "h-11 rounded-md px-8",
77
- icon: "h-10 w-10"
78
- }
79
- },
80
- defaultVariants: {
81
- variant: "default",
82
- size: "default"
83
- }
84
- }
85
- ), H = G(
86
- ({ className: e, variant: t, size: r, asChild: o = !1, ...n }, s) => /* @__PURE__ */ i(
87
- o ? gt : "button",
88
- {
89
- className: $(yt({ variant: t, size: r, className: e })),
90
- ref: s,
91
- ...n
92
- }
93
- )
94
- );
95
- H.displayName = "Button";
96
- function wt(e) {
97
- if (e instanceof Error) {
98
- const t = e.message.toLowerCase();
99
- return t.includes("loading dynamically imported module") || t.includes("chunk") || t.includes("failed to fetch dynamically imported module");
100
- }
101
- return !1;
102
- }
103
- function bt(e) {
104
- return lt(e) ? e.data?.message ?? e.statusText ?? "Something went wrong" : e instanceof Error ? e.message : String(e);
105
- }
106
- function kt(e) {
107
- return e instanceof Error && e.stack ? e.stack : null;
108
- }
109
- function Ft(e) {
110
- const t = bt(e), r = kt(e);
111
- return r ? `Message:
112
- ${t}
113
-
114
- Stack:
115
- ${r}` : t;
116
- }
117
- function Ct() {
118
- const e = at(), { t } = Te("common"), r = wt(e), o = Ft(e);
119
- return /* @__PURE__ */ i(
120
- "div",
121
- {
122
- className: "flex min-h-screen flex-col items-center justify-center bg-background px-4 py-12",
123
- style: { fontFamily: "var(--heading-font-family, system-ui, sans-serif)" },
124
- children: /* @__PURE__ */ C("div", { className: "w-full max-w-md space-y-6 text-center", children: [
125
- /* @__PURE__ */ C("div", { className: "space-y-2", children: [
126
- /* @__PURE__ */ i("h1", { className: "text-xl font-semibold text-foreground", children: t(r ? "errorBoundary.titleChunk" : "errorBoundary.titleGeneric") }),
127
- /* @__PURE__ */ i("p", { className: "text-sm text-muted-foreground", children: t(r ? "errorBoundary.descriptionChunk" : "errorBoundary.descriptionGeneric") })
128
- ] }),
129
- /* @__PURE__ */ C("div", { className: "flex flex-col gap-3 sm:flex-row sm:justify-center", children: [
130
- /* @__PURE__ */ i(
131
- H,
132
- {
133
- variant: "default",
134
- onClick: () => window.location.reload(),
135
- className: "shrink-0",
136
- children: t("errorBoundary.tryAgain")
137
- }
138
- ),
139
- /* @__PURE__ */ i(
140
- H,
141
- {
142
- variant: "outline",
143
- onClick: () => m.navigate("/"),
144
- className: "shrink-0",
145
- children: t("errorBoundary.goToHome")
146
- }
147
- )
148
- ] }),
149
- /* @__PURE__ */ C("details", { className: "rounded-lg border border-border bg-muted/30 text-left", children: [
150
- /* @__PURE__ */ i("summary", { className: "cursor-pointer px-4 py-3 text-xs font-medium text-muted-foreground hover:text-foreground", children: t("errorBoundary.errorDetails") }),
151
- /* @__PURE__ */ i("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap break-all px-4 pb-3 pt-1 text-xs text-muted-foreground font-mono", children: o })
152
- ] })
153
- ] })
154
- }
155
- );
156
- }
157
- const Le = Se(void 0);
158
- function St() {
159
- const e = me(Le);
160
- if (e === void 0)
161
- throw new Error("useSettings must be used within a SettingsProvider");
162
- return e;
163
- }
164
- const Et = M(
165
- () => import("./DefaultLayout-D3IpgS4j.js").then((e) => ({ default: e.DefaultLayout }))
166
- ), At = M(
167
- () => import("./FullscreenLayout-Do9vAfl8.js").then((e) => ({ default: e.FullscreenLayout }))
168
- ), Tt = M(
169
- () => import("./WindowsLayout-CEqkRKyk.js").then((e) => ({ default: e.WindowsLayout }))
170
- );
171
- function Lt() {
172
- return /* @__PURE__ */ i(
173
- "div",
174
- {
175
- className: "min-h-screen bg-background",
176
- "aria-hidden": !0
177
- }
178
- );
179
- }
180
- function Nt({
181
- layout: e = "sidebar",
182
- title: t,
183
- appIcon: r,
184
- logo: o,
185
- navigation: n
186
- }) {
187
- const { settings: s } = St(), l = s.layout ?? e;
188
- let c, d;
189
- return l === "fullscreen" ? (c = At, d = { title: t, navigation: n }) : l === "windows" ? (c = Tt, d = { title: t, appIcon: r, logo: o, navigation: n }) : (c = Et, d = { title: t, appIcon: r, logo: o, navigation: n }), /* @__PURE__ */ i(Y, { fallback: /* @__PURE__ */ i(Lt, {}), children: /* @__PURE__ */ i(c, { ...d }) });
190
- }
191
- function Eo(e, t) {
192
- return e == null ? "" : typeof e == "string" ? e : e[t] || e.en || e.fr || Object.values(e)[0] || "";
193
- }
194
- function Dt(e) {
195
- return e.length === 0 ? [] : e.flatMap((t) => "title" in t && "items" in t ? t.items : t);
196
- }
197
- function Ao(e, t) {
198
- if (e.length === 0) return [];
199
- const r = t === "mobile", o = t === "desktop";
200
- return e.map((n) => {
201
- if ("title" in n && "items" in n) {
202
- const l = n, c = l.items.filter((d) => !(d.hidden || r && d.hiddenOnMobile || o && d.hiddenOnDesktop));
203
- return c.length === 0 ? null : { ...l, items: c };
204
- }
205
- const s = n;
206
- return s.hidden || r && s.hiddenOnMobile || o && s.hiddenOnDesktop ? null : n;
207
- }).filter((n) => n !== null);
208
- }
209
- function To(e) {
210
- return e.length === 0 ? [] : e.map((t) => {
211
- if ("title" in t && "items" in t) {
212
- const o = t, n = o.items.filter((s) => !s.hidden);
213
- return n.length === 0 ? null : { ...o, items: n };
214
- }
215
- return t.hidden ? null : t;
216
- }).filter((t) => t !== null);
217
- }
218
- function Lo(e) {
219
- const t = [], r = [];
220
- for (const o of e)
221
- if (("position" in o ? o.position ?? "start" : "start") === "end")
222
- if ("title" in o && "items" in o) {
223
- const s = o;
224
- r.push(...s.items.filter((l) => !l.hidden));
225
- } else {
226
- const s = o;
227
- s.hidden || r.push(s);
228
- }
229
- else
230
- t.push(o);
231
- return { start: t, end: r };
232
- }
233
- const It = M(
234
- () => import("./HomeView-DwckTuxz.js").then((e) => ({ default: e.HomeView }))
235
- ), _t = M(
236
- () => import("./SettingsView-Bt4I-KDT.js").then((e) => ({ default: e.SettingsView }))
237
- ), Rt = M(
238
- () => import("./CookiePreferencesView-Bb3hFqw1.js").then((e) => ({
239
- default: e.CookiePreferencesView
240
- }))
241
- ), xt = M(
242
- () => import("./ViewRoute-ChSPabOy.js").then((e) => ({ default: e.ViewRoute }))
243
- ), Ot = M(
244
- () => import("./NotFoundView-DD7azhz-.js").then((e) => ({ default: e.NotFoundView }))
245
- );
246
- function ee() {
247
- return /* @__PURE__ */ i(
248
- "div",
249
- {
250
- className: "min-h-screen bg-background",
251
- "aria-hidden": !0
252
- }
253
- );
254
- }
255
- const Pt = (e) => {
256
- const t = [
257
- {
258
- path: "/",
259
- element: /* @__PURE__ */ i(ct, {}),
260
- errorElement: /* @__PURE__ */ i(Ct, {}),
261
- children: [
262
- {
263
- // Settings route (if configured)
264
- path: `${we.settings.replace(/^\//, "")}/*`,
265
- element: /* @__PURE__ */ i(Y, { fallback: /* @__PURE__ */ i(ee, {}), children: /* @__PURE__ */ i(_t, {}) })
266
- },
267
- {
268
- // Cookie preferences route
269
- path: we.cookiePreferences.replace(/^\//, ""),
270
- element: /* @__PURE__ */ i(Y, { fallback: /* @__PURE__ */ i(ee, {}), children: /* @__PURE__ */ i(Rt, {}) })
271
- },
272
- {
273
- // Catch-all route
274
- path: "*",
275
- element: /* @__PURE__ */ i(Y, { fallback: /* @__PURE__ */ i(ee, {}), children: /* @__PURE__ */ i(Ot, {}) })
276
- }
277
- ]
278
- }
279
- ], r = {
280
- element: /* @__PURE__ */ i(
281
- Nt,
282
- {
283
- layout: e.layout,
284
- title: e.title,
285
- appIcon: e.appIcon,
286
- logo: e.logo,
287
- navigation: e.navigation || []
288
- }
289
- ),
290
- children: [
291
- {
292
- path: "/",
293
- element: /* @__PURE__ */ i(Y, { fallback: /* @__PURE__ */ i(ee, {}), children: /* @__PURE__ */ i(It, {}) })
294
- }
295
- ]
296
- };
297
- if (e.navigation && e.navigation.length > 0) {
298
- const o = Dt(e.navigation);
299
- o.forEach((n) => {
300
- r.children.push({
301
- path: `/${n.path}/*`,
302
- element: /* @__PURE__ */ i(Y, { fallback: /* @__PURE__ */ i(ee, {}), children: /* @__PURE__ */ i(xt, { navigation: o }) })
303
- });
304
- });
305
- }
306
- return t[0].children.push(r), t;
307
- }, Wt = (e) => {
308
- const t = Pt(e);
309
- return dt(t);
310
- }, q = Ae("shellcore");
311
- function Ut(e) {
312
- return e.length === 0 ? [] : e.flatMap((t) => "title" in t && "items" in t ? t.items : [t]);
313
- }
314
- function Bt(e, t) {
315
- return typeof e == "string" ? e : e[t] || e.en || e.fr || Object.values(e)[0] || "";
316
- }
317
- function ae(e, t, r) {
318
- if (!t?.length) return e;
319
- const o = Ut(t).map((n) => ({
320
- path: n.path,
321
- url: n.url,
322
- label: Bt(n.label, r)
323
- }));
324
- return { ...e, navigation: { items: o } };
325
- }
326
- const te = "shellui:settings", Ye = () => typeof window < "u" && Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : "UTC", L = {
327
- developerFeatures: {
328
- enabled: !1
329
- },
330
- errorReporting: {
331
- enabled: !0
332
- },
333
- logging: {
334
- namespaces: {
335
- shellsdk: !1,
336
- shellcore: !1
337
- }
338
- },
339
- appearance: {
340
- theme: "system",
341
- themeName: "default"
342
- },
343
- language: {
344
- code: "en"
345
- },
346
- region: {
347
- timezone: Ye()
348
- },
349
- cookieConsent: {
350
- acceptedHosts: [],
351
- consentedCookieHosts: []
352
- },
353
- serviceWorker: {
354
- enabled: !0
355
- }
356
- };
357
- function Ht({ children: e }) {
358
- const { config: t } = X(), { i18n: r } = Te(), o = ue(null), [n, s] = ne(() => {
359
- let p;
360
- if (m.initialSettings)
361
- return p = m.initialSettings, o.current = p, p;
362
- if (typeof window < "u")
363
- try {
364
- const u = localStorage.getItem(te);
365
- if (u) {
366
- const a = JSON.parse(u);
367
- return p = {
368
- ...L,
369
- ...a,
370
- errorReporting: {
371
- enabled: a.errorReporting?.enabled ?? L.errorReporting.enabled
372
- },
373
- logging: {
374
- namespaces: {
375
- ...L.logging.namespaces,
376
- ...a.logging?.namespaces
377
- }
378
- },
379
- appearance: {
380
- theme: a.appearance?.theme || L.appearance.theme,
381
- themeName: a.appearance?.themeName || L.appearance.themeName
382
- },
383
- language: {
384
- code: a.language?.code || L.language.code
385
- },
386
- region: {
387
- // Only use stored timezone if it exists, otherwise use browser's current timezone
388
- timezone: a.region?.timezone || Ye()
389
- },
390
- cookieConsent: {
391
- acceptedHosts: Array.isArray(a.cookieConsent?.acceptedHosts) ? a.cookieConsent.acceptedHosts : L.cookieConsent?.acceptedHosts ?? [],
392
- consentedCookieHosts: Array.isArray(a.cookieConsent?.consentedCookieHosts) ? a.cookieConsent.consentedCookieHosts : L.cookieConsent?.consentedCookieHosts ?? []
393
- },
394
- serviceWorker: {
395
- // Migrate from legacy "caching" key if present
396
- enabled: a.serviceWorker?.enabled ?? a.caching?.enabled ?? !0
397
- }
398
- }, o.current = p, p;
399
- }
400
- } catch (u) {
401
- q.error("Failed to load settings from localStorage:", { error: u });
402
- }
403
- return o.current = L, L;
404
- });
405
- z(() => {
406
- o.current = n;
407
- }, [n]), z(() => {
408
- if (typeof window > "u")
409
- return;
410
- const p = m.addMessageListener(
411
- "SHELLUI_SETTINGS_UPDATED",
412
- (f) => {
413
- const F = f.payload.settings;
414
- if (F && (s(F), window.parent === window))
415
- try {
416
- localStorage.setItem(te, JSON.stringify(F));
417
- const k = ae(
418
- F,
419
- t?.navigation,
420
- r.language || "en"
421
- );
422
- q.info("Root Parent received settings update", { message: f }), m.propagateMessage({
423
- type: "SHELLUI_SETTINGS",
424
- payload: { settings: k }
425
- });
426
- } catch (k) {
427
- q.error("Failed to update settings from message:", { error: k });
428
- }
429
- }
430
- ), u = m.addMessageListener(
431
- "SHELLUI_SETTINGS_REQUESTED",
432
- () => {
433
- const f = o.current ?? L, g = ae(
434
- f,
435
- t?.navigation,
436
- r.language || "en"
437
- );
438
- m.propagateMessage({
439
- type: "SHELLUI_SETTINGS",
440
- payload: { settings: g }
441
- });
442
- }
443
- ), a = m.addMessageListener(
444
- "SHELLUI_SETTINGS",
445
- (f) => {
446
- const k = f.payload.settings;
447
- k && s(k);
448
- }
449
- );
450
- return () => {
451
- p(), a(), u();
452
- };
453
- }, [n, t?.navigation, r.language]);
454
- const l = T(
455
- (p) => {
456
- const u = { ...n, ...p };
457
- if (typeof window < "u" && window.parent === window)
458
- try {
459
- localStorage.setItem(te, JSON.stringify(u)), s(u);
460
- const a = ae(
461
- u,
462
- t?.navigation,
463
- r.language || "en"
464
- );
465
- m.propagateMessage({
466
- type: "SHELLUI_SETTINGS",
467
- payload: { settings: a }
468
- });
469
- } catch (a) {
470
- q.error("Failed to update settings in localStorage:", { error: a });
471
- }
472
- m.sendMessageToParent({
473
- type: "SHELLUI_SETTINGS_UPDATED",
474
- payload: { settings: u }
475
- });
476
- },
477
- [n, t?.navigation, r.language]
478
- ), c = T(
479
- (p, u) => {
480
- const a = n[p], f = typeof a == "object" && a !== null && !Array.isArray(a) ? { ...a, ...u } : u;
481
- l({ [p]: f });
482
- },
483
- [n, l]
484
- ), d = T(() => {
485
- if (typeof window < "u")
486
- try {
487
- localStorage.removeItem(te);
488
- const p = [];
489
- for (let a = 0; a < localStorage.length; a++) {
490
- const f = localStorage.key(a);
491
- f && f.startsWith("shellui:") && p.push(f);
492
- }
493
- p.forEach((a) => localStorage.removeItem(a));
494
- const u = L;
495
- if (s(u), window.parent === window) {
496
- localStorage.setItem(te, JSON.stringify(u));
497
- const a = ae(
498
- u,
499
- t?.navigation,
500
- r.language || "en"
501
- );
502
- m.propagateMessage({
503
- type: "SHELLUI_SETTINGS",
504
- payload: { settings: a }
505
- });
506
- }
507
- m.sendMessageToParent({
508
- type: "SHELLUI_SETTINGS_UPDATED",
509
- payload: { settings: u }
510
- }), q.info("All app data has been reset");
511
- } catch (p) {
512
- q.error("Failed to reset all data:", { error: p });
513
- }
514
- }, [t?.navigation, r.language]), v = Ee(
515
- () => ({
516
- settings: n,
517
- updateSettings: l,
518
- updateSetting: c,
519
- resetAllData: d
520
- }),
521
- [n, l, c, d]
522
- );
523
- return /* @__PURE__ */ i(Le.Provider, { value: v, children: e });
524
- }
525
- function ie() {
526
- const e = me(Le);
527
- if (e === void 0)
528
- throw new Error("useSettings must be used within a SettingsProvider");
529
- return e;
530
- }
531
- function b(e) {
532
- if (!e || typeof e != "string" || !e.match(/^#?[0-9A-Fa-f]{6}$/))
533
- return e;
534
- const t = e.replace("#", ""), r = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), n = parseInt(t.substring(4, 6), 16);
535
- if (isNaN(r) || isNaN(o) || isNaN(n))
536
- return console.warn(`[Theme] Invalid hex color: ${e}`), e;
537
- const s = r / 255, l = o / 255, c = n / 255, d = Math.max(s, l, c), v = Math.min(s, l, c);
538
- let p = 0, u = 0;
539
- const a = (d + v) / 2;
540
- if (d !== v) {
541
- const y = d - v;
542
- switch (u = a > 0.5 ? y / (2 - d - v) : y / (d + v), d) {
543
- case s:
544
- p = ((l - c) / y + (l < c ? 6 : 0)) / 6;
545
- break;
546
- case l:
547
- p = ((c - s) / y + 2) / 6;
548
- break;
549
- case c:
550
- p = ((s - l) / y + 4) / 6;
551
- break;
552
- }
553
- }
554
- const f = Math.round(p * 360 * 10) / 10, g = Math.round(u * 100 * 10) / 10, F = Math.round(a * 100 * 10) / 10, k = `${f} ${g}% ${F}%`;
555
- return k.match(/^\d+(\.\d+)?\s+\d+(\.\d+)?%\s+\d+(\.\d+)?%$/) ? k : (console.warn(`[Theme] Invalid HSL conversion result for ${e}: ${k}`), e);
556
- }
557
- const zt = {
558
- name: "default",
559
- displayName: "Default",
560
- colors: {
561
- light: {
562
- background: "#FFFFFF",
563
- // White
564
- foreground: "#020617",
565
- // Very dark blue-gray
566
- card: "#FFFFFF",
567
- // White
568
- cardForeground: "#020617",
569
- // Very dark blue-gray
570
- popover: "#FFFFFF",
571
- // White
572
- popoverForeground: "#020617",
573
- // Very dark blue-gray
574
- primary: "#22C55E",
575
- // Green
576
- primaryForeground: "#FFFFFF",
577
- // White
578
- secondary: "#F1F5F9",
579
- // Light gray-blue
580
- secondaryForeground: "#0F172A",
581
- // Dark blue-gray
582
- muted: "#F1F5F9",
583
- // Light gray-blue
584
- mutedForeground: "#64748B",
585
- // Medium gray-blue
586
- accent: "#F1F5F9",
587
- // Light gray-blue
588
- accentForeground: "#0F172A",
589
- // Dark blue-gray
590
- destructive: "#EF4444",
591
- // Red
592
- destructiveForeground: "#F8FAFC",
593
- // Off-white
594
- border: "#E2E8F0",
595
- // Light gray
596
- input: "#E2E8F0",
597
- // Light gray
598
- ring: "#020617",
599
- // Very dark blue-gray
600
- radius: "0.5rem",
601
- sidebarBackground: "#FAFAFA",
602
- // Off-white
603
- sidebarForeground: "#334155",
604
- // Dark gray-blue
605
- sidebarPrimary: "#0F172A",
606
- // Very dark blue-gray
607
- sidebarPrimaryForeground: "#FAFAFA",
608
- // Off-white
609
- sidebarAccent: "#F4F4F5",
610
- // Light gray
611
- sidebarAccentForeground: "#0F172A",
612
- // Very dark blue-gray
613
- sidebarBorder: "#E2E8F0",
614
- // Light gray
615
- sidebarRing: "#3B82F6"
616
- // Blue
617
- },
618
- dark: {
619
- background: "#020617",
620
- // Very dark blue-gray
621
- foreground: "#F8FAFC",
622
- // Off-white
623
- card: "#020617",
624
- // Very dark blue-gray
625
- cardForeground: "#F8FAFC",
626
- // Off-white
627
- popover: "#020617",
628
- // Very dark blue-gray
629
- popoverForeground: "#F8FAFC",
630
- // Off-white
631
- primary: "#4ADE80",
632
- // Bright green
633
- primaryForeground: "#FFFFFF",
634
- // White
635
- secondary: "#1E293B",
636
- // Dark blue-gray
637
- secondaryForeground: "#F8FAFC",
638
- // Off-white
639
- muted: "#1E293B",
640
- // Dark blue-gray
641
- mutedForeground: "#94A3B8",
642
- // Medium gray-blue
643
- accent: "#1E293B",
644
- // Dark blue-gray
645
- accentForeground: "#F8FAFC",
646
- // Off-white
647
- destructive: "#991B1B",
648
- // Dark red
649
- destructiveForeground: "#F8FAFC",
650
- // Off-white
651
- border: "#1E293B",
652
- // Dark blue-gray
653
- input: "#1E293B",
654
- // Dark blue-gray
655
- ring: "#CBD5E1",
656
- // Light gray-blue
657
- radius: "0.5rem",
658
- sidebarBackground: "#0F172A",
659
- // Very dark blue-gray
660
- sidebarForeground: "#F1F5F9",
661
- // Light gray-blue
662
- sidebarPrimary: "#E0E7FF",
663
- // Very light blue
664
- sidebarPrimaryForeground: "#0F172A",
665
- // Very dark blue-gray
666
- sidebarAccent: "#18181B",
667
- // Very dark gray
668
- sidebarAccentForeground: "#F1F5F9",
669
- // Light gray-blue
670
- sidebarBorder: "#18181B",
671
- // Very dark gray
672
- sidebarRing: "#3B82F6"
673
- // Blue
674
- }
675
- }
676
- }, Mt = {
677
- name: "blue",
678
- displayName: "Blue",
679
- colors: {
680
- light: {
681
- background: "#FFFFFF",
682
- // White
683
- foreground: "#020617",
684
- // Very dark blue-gray
685
- card: "#FFFFFF",
686
- // White
687
- cardForeground: "#020617",
688
- // Very dark blue-gray
689
- popover: "#FFFFFF",
690
- // White
691
- popoverForeground: "#020617",
692
- // Very dark blue-gray
693
- primary: "#3B82F6",
694
- // Blue
695
- primaryForeground: "#FFFFFF",
696
- // White
697
- secondary: "#F1F5F9",
698
- // Light gray-blue
699
- secondaryForeground: "#0F172A",
700
- // Dark blue-gray
701
- muted: "#F1F5F9",
702
- // Light gray-blue
703
- mutedForeground: "#64748B",
704
- // Medium gray-blue
705
- accent: "#F1F5F9",
706
- // Light gray-blue
707
- accentForeground: "#0F172A",
708
- // Dark blue-gray
709
- destructive: "#EF4444",
710
- // Red
711
- destructiveForeground: "#F8FAFC",
712
- // Off-white
713
- border: "#E2E8F0",
714
- // Light gray
715
- input: "#E2E8F0",
716
- // Light gray
717
- ring: "#3B82F6",
718
- // Blue
719
- radius: "0.5rem",
720
- sidebarBackground: "#FAFAFA",
721
- // Off-white
722
- sidebarForeground: "#334155",
723
- // Dark gray-blue
724
- sidebarPrimary: "#3B82F6",
725
- // Blue
726
- sidebarPrimaryForeground: "#FFFFFF",
727
- // White
728
- sidebarAccent: "#F4F4F5",
729
- // Light gray
730
- sidebarAccentForeground: "#0F172A",
731
- // Very dark blue-gray
732
- sidebarBorder: "#E2E8F0",
733
- // Light gray
734
- sidebarRing: "#3B82F6"
735
- // Blue
736
- },
737
- dark: {
738
- background: "#020617",
739
- // Very dark blue-gray
740
- foreground: "#F8FAFC",
741
- // Off-white
742
- card: "#020617",
743
- // Very dark blue-gray
744
- cardForeground: "#F8FAFC",
745
- // Off-white
746
- popover: "#020617",
747
- // Very dark blue-gray
748
- popoverForeground: "#F8FAFC",
749
- // Off-white
750
- primary: "#3B82F6",
751
- // Blue
752
- primaryForeground: "#FFFFFF",
753
- // White
754
- secondary: "#1E293B",
755
- // Dark blue-gray
756
- secondaryForeground: "#F8FAFC",
757
- // Off-white
758
- muted: "#1E293B",
759
- // Dark blue-gray
760
- mutedForeground: "#94A3B8",
761
- // Medium gray-blue
762
- accent: "#1E293B",
763
- // Dark blue-gray
764
- accentForeground: "#F8FAFC",
765
- // Off-white
766
- destructive: "#991B1B",
767
- // Dark red
768
- destructiveForeground: "#F8FAFC",
769
- // Off-white
770
- border: "#1E293B",
771
- // Dark blue-gray
772
- input: "#1E293B",
773
- // Dark blue-gray
774
- ring: "#3B82F6",
775
- // Blue
776
- radius: "0.5rem",
777
- sidebarBackground: "#0F172A",
778
- // Very dark blue-gray
779
- sidebarForeground: "#F1F5F9",
780
- // Light gray-blue
781
- sidebarPrimary: "#3B82F6",
782
- // Blue
783
- sidebarPrimaryForeground: "#0F172A",
784
- // Dark blue-gray
785
- sidebarAccent: "#18181B",
786
- // Very dark gray
787
- sidebarAccentForeground: "#F1F5F9",
788
- // Light gray-blue
789
- sidebarBorder: "#18181B",
790
- // Very dark gray
791
- sidebarRing: "#3B82F6"
792
- // Blue
793
- }
794
- }
795
- }, $t = {
796
- name: "warm-yellow",
797
- displayName: "Warm Yellow",
798
- fontFamily: '"Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", cursive, sans-serif',
799
- letterSpacing: "0.02em",
800
- textShadow: "1px 1px 2px rgba(0, 0, 0, 0.1)",
801
- lineHeight: "1.6",
802
- colors: {
803
- light: {
804
- background: "#FFF8E7",
805
- // Warm cream/yellowish
806
- foreground: "#3E2723",
807
- // Warm dark brown
808
- card: "#FFFEF5",
809
- // Slightly off-white cream
810
- cardForeground: "#3E2723",
811
- // Warm dark brown
812
- popover: "#FFFEF5",
813
- // Slightly off-white cream
814
- popoverForeground: "#3E2723",
815
- // Warm dark brown
816
- primary: "#F59E0B",
817
- // Warm golden amber (complements yellow)
818
- primaryForeground: "#FFFFFF",
819
- // White
820
- secondary: "#F5E6D3",
821
- // Warm beige
822
- secondaryForeground: "#3E2723",
823
- // Warm dark brown
824
- muted: "#F5E6D3",
825
- // Warm beige
826
- mutedForeground: "#6D4C41",
827
- // Medium warm brown
828
- accent: "#FFE082",
829
- // Light warm yellow
830
- accentForeground: "#3E2723",
831
- // Warm dark brown
832
- destructive: "#E57373",
833
- // Soft red (works with warm tones)
834
- destructiveForeground: "#FFFFFF",
835
- // White
836
- border: "#E8D5B7",
837
- // Warm tan border
838
- input: "#E8D5B7",
839
- // Warm tan input border
840
- ring: "#F59E0B",
841
- // Warm golden amber ring
842
- radius: "0.5rem",
843
- sidebarBackground: "#FFF5E1",
844
- // Slightly warmer cream (subtle contrast with main background)
845
- sidebarForeground: "#5D4037",
846
- // Medium warm brown
847
- sidebarPrimary: "#F59E0B",
848
- // Warm golden amber
849
- sidebarPrimaryForeground: "#FFFFFF",
850
- // White
851
- sidebarAccent: "#F5E6D3",
852
- // Warm beige
853
- sidebarAccentForeground: "#3E2723",
854
- // Warm dark brown
855
- sidebarBorder: "#E8D5B7",
856
- // Warm tan
857
- sidebarRing: "#F59E0B"
858
- // Warm golden amber
859
- },
860
- dark: {
861
- background: "#2E2419",
862
- // Dark warm brown
863
- foreground: "#FFF8E7",
864
- // Warm cream (inverted)
865
- card: "#3E2723",
866
- // Dark warm brown
867
- cardForeground: "#FFF8E7",
868
- // Warm cream
869
- popover: "#3E2723",
870
- // Dark warm brown
871
- popoverForeground: "#FFF8E7",
872
- // Warm cream
873
- primary: "#FBBF24",
874
- // Bright golden amber (lighter for dark mode)
875
- primaryForeground: "#FFFFFF",
876
- // White for better contrast
877
- secondary: "#4E342E",
878
- // Medium dark warm brown
879
- secondaryForeground: "#FFF8E7",
880
- // Warm cream
881
- muted: "#4E342E",
882
- // Medium dark warm brown
883
- mutedForeground: "#D7CCC8",
884
- // Light warm gray
885
- accent: "#FFB74D",
886
- // Warm orange accent
887
- accentForeground: "#2E2419",
888
- // Dark warm brown for better contrast
889
- destructive: "#EF5350",
890
- // Softer red for dark mode
891
- destructiveForeground: "#FFF8E7",
892
- // Warm cream
893
- border: "#5D4037",
894
- // Medium warm brown border
895
- input: "#5D4037",
896
- // Medium warm brown input border
897
- ring: "#FBBF24",
898
- // Bright golden amber ring
899
- radius: "0.5rem",
900
- sidebarBackground: "#35281F",
901
- // Slightly warmer dark brown (subtle contrast with main background)
902
- sidebarForeground: "#D7CCC8",
903
- // Light warm gray
904
- sidebarPrimary: "#FBBF24",
905
- // Bright golden amber
906
- sidebarPrimaryForeground: "#2E2419",
907
- // Dark warm brown for better contrast
908
- sidebarAccent: "#4E342E",
909
- // Medium dark warm brown
910
- sidebarAccentForeground: "#FFF8E7",
911
- // Warm cream
912
- sidebarBorder: "#5D4037",
913
- // Medium warm brown
914
- sidebarRing: "#FBBF24"
915
- // Bright golden amber
916
- }
917
- }
918
- }, Ne = /* @__PURE__ */ new Map([
919
- ["default", zt],
920
- ["blue", Mt],
921
- ["warm-yellow", $t]
922
- ]);
923
- function jt(e) {
924
- Ne.set(e.name, e);
925
- }
926
- function he(e) {
927
- return Ne.get(e);
928
- }
929
- function No() {
930
- return Array.from(Ne.values());
931
- }
932
- function He(e, t) {
933
- if (typeof document > "u")
934
- return;
935
- const r = document.documentElement, o = t ? e.colors.dark : e.colors.light, n = b(o.primary);
936
- r.style.setProperty("--background", b(o.background)), r.style.setProperty("--foreground", b(o.foreground)), r.style.setProperty("--card", b(o.card)), r.style.setProperty("--card-foreground", b(o.cardForeground)), r.style.setProperty("--popover", b(o.popover)), r.style.setProperty("--popover-foreground", b(o.popoverForeground)), r.style.setProperty("--primary", n), r.style.setProperty("--primary-foreground", b(o.primaryForeground)), r.style.setProperty("--secondary", b(o.secondary)), r.style.setProperty("--secondary-foreground", b(o.secondaryForeground)), r.style.setProperty("--muted", b(o.muted)), r.style.setProperty("--muted-foreground", b(o.mutedForeground)), r.style.setProperty("--accent", b(o.accent)), r.style.setProperty("--accent-foreground", b(o.accentForeground)), r.style.setProperty("--destructive", b(o.destructive)), r.style.setProperty("--destructive-foreground", b(o.destructiveForeground)), r.style.setProperty("--border", b(o.border)), r.style.setProperty("--input", b(o.input)), r.style.setProperty("--ring", b(o.ring)), r.style.setProperty("--radius", o.radius), r.style.setProperty("--sidebar-background", b(o.sidebarBackground)), r.style.setProperty("--sidebar-foreground", b(o.sidebarForeground)), r.style.setProperty("--sidebar-primary", b(o.sidebarPrimary)), r.style.setProperty("--sidebar-primary-foreground", b(o.sidebarPrimaryForeground)), r.style.setProperty("--sidebar-accent", b(o.sidebarAccent)), r.style.setProperty("--sidebar-accent-foreground", b(o.sidebarAccentForeground)), r.style.setProperty("--sidebar-border", b(o.sidebarBorder)), r.style.setProperty("--sidebar-ring", b(o.sidebarRing));
937
- const s = document.head || document.getElementsByTagName("head")[0];
938
- s.querySelectorAll("link[data-theme-font], style[data-theme-font]").forEach((u) => u.remove()), e.fontFiles && e.fontFiles.length > 0 && e.fontFiles.forEach((u, a) => {
939
- if (u.includes("fonts.googleapis.com") || u.endsWith(".css")) {
940
- const f = document.createElement("link");
941
- f.rel = "stylesheet", f.href = u, f.setAttribute("data-theme-font", e.name), s.appendChild(f);
942
- } else {
943
- const f = document.createElement("style");
944
- f.setAttribute("data-theme-font", e.name);
945
- const g = `ThemeFont-${e.name}-${a}`;
946
- f.textContent = `
947
- @font-face {
948
- font-family: '${g}';
949
- src: url('${u}') format('woff2');
950
- }
951
- `, s.appendChild(f);
952
- }
953
- });
954
- const c = e.bodyFontFamily || e.fontFamily, d = e.headingFontFamily || e.fontFamily || c;
955
- if (c ? (r.style.setProperty("--body-font-family", c), r.style.setProperty("--font-family", c), document.body.style.fontFamily = c) : (r.style.removeProperty("--body-font-family"), r.style.removeProperty("--font-family"), document.body.style.fontFamily = ""), d ? r.style.setProperty("--heading-font-family", d) : r.style.removeProperty("--heading-font-family"), e.letterSpacing ? (r.style.setProperty("--letter-spacing", e.letterSpacing), r.style.letterSpacing = e.letterSpacing) : (r.style.removeProperty("--letter-spacing"), r.style.letterSpacing = ""), e.textShadow) {
956
- r.style.setProperty("--text-shadow", e.textShadow);
957
- const u = e.textShadow.replace(/rgba\(([^)]+)\)/, (a, f) => {
958
- const g = f.split(",").map((F) => F.trim());
959
- if (g.length === 4) {
960
- const F = parseFloat(g[3]);
961
- return `rgba(${g[0]}, ${g[1]}, ${g[2]}, ${Math.max(0, F * 0.8)})`;
962
- }
963
- return a;
964
- });
965
- document.body.style.textShadow = u;
966
- } else
967
- r.style.removeProperty("--text-shadow"), document.body.style.textShadow = "";
968
- e.lineHeight ? (r.style.setProperty("--line-height", e.lineHeight), document.body.style.lineHeight = e.lineHeight) : (r.style.removeProperty("--line-height"), document.body.style.lineHeight = "");
969
- const v = r.style.getPropertyValue("--primary"), p = /^\d+(\.\d+)?\s+\d+(\.\d+)?%\s+\d+(\.\d+)?%$/;
970
- !v || v.trim() === "" ? console.error(
971
- `[Theme] Failed to set --primary CSS variable. Expected HSL from ${o.primary}, got: "${v}"`
972
- ) : p.test(v.trim()) || console.error(
973
- `[Theme] Invalid HSL format for --primary: "${v}". Expected format: "H S% L%"`
974
- ), r.offsetHeight;
975
- }
976
- function Vt(e) {
977
- const t = document.documentElement;
978
- e ? t.classList.add("dark") : t.classList.remove("dark");
979
- }
980
- function Gt() {
981
- const { settings: e } = ie(), { config: t } = X(), r = e.appearance?.theme || "system", o = e.appearance?.themeName || "default";
982
- Ge(() => {
983
- const n = o;
984
- t?.themes && t.themes.forEach((l) => {
985
- jt(l);
986
- });
987
- const s = he(n) || he("default");
988
- if (s) {
989
- const c = r === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches : r === "dark";
990
- Vt(c), He(s, c);
991
- } else {
992
- console.error("[Theme] No theme definition found, using fallback");
993
- const l = he("default");
994
- if (l) {
995
- const c = r === "dark" || r === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches;
996
- He(l, c);
997
- }
998
- }
999
- }, [r, o, t]);
1000
- }
1001
- function Kt({ children: e }) {
1002
- return Gt(), /* @__PURE__ */ i(R, { children: e });
1003
- }
1004
- const qt = "Settings", Yt = "Welcome to {{title}}", Jt = "Select a navigation item to get started.", Zt = "Navigation error", Qt = "This URL is not configured in the app navigation.", Xt = { titleChunk: "Page couldn't be loaded", titleGeneric: "Something went wrong", descriptionChunk: "This can happen after an update or due to a network issue. Try refreshing the page.", descriptionGeneric: "An unexpected error occurred. You can try again or go back.", tryAgain: "Try again", goToHome: "Go to home", errorDetails: "Error details" }, er = {
1005
- settings: qt,
1006
- welcome: Yt,
1007
- getStarted: Jt,
1008
- navigationError: Zt,
1009
- navigationNotAllowed: Qt,
1010
- errorBoundary: Xt
1011
- }, tr = "Settings", rr = { preferences: "Preferences", system: "System", developer: "Developer" }, or = { appearance: "Appearance", languageAndRegion: "Language & region", updateApp: "Software update", advanced: "Advanced", dataPrivacy: "Data Privacy", develop: "Develop", serviceWorker: "Service Worker" }, nr = { description: "Check your app version and look for updates. When an update is available, you can install it from here.", currentVersion: "Current version", status: "Update status", statusUpToDate: "Up to date", statusUpdateAvailable: "Update available", checkForUpdate: "Check for update", checking: "Checking…", versionUnknown: "—", tauriComingSoon: "Updates for the desktop app will be available soon. You will be notified when a new version is ready.", swDisabledMessage: "The app will update when you refresh the page.", refreshApp: "Refresh app", youAreUpToDate: "You are up to date", installNow: "Install Now", checkError: "Error checking for updates. Try again", tryAgain: "Try again" }, ir = { title: "Appearance", theme: "Theme", themeDescription: "Choose your preferred color scheme (current: {{theme}})", mode: "Mode", modeDescription: "Choose light, dark, or automatic mode.", colorTheme: "Color Theme", colorThemeDescription: "Select a color theme. Each theme has light and dark variants.", themes: { light: "Light", dark: "Dark", system: "Automatic" } }, sr = { title: "Language & region", description: "Configure your language and regional settings.", language: "Language", languageDescription: "Choose your preferred language. Changes will be applied immediately.", region: "Region", regionDescription: "Select your timezone. Dates throughout the app will adjust to this timezone.", currentDateTime: "Current date and time", timezoneLabel: "Timezone", resetToBrowser: "Reset to automatic timezone", defaultBrowser: "Automatic" }, ar = { title: "Advanced", description: "Advanced settings and configuration options.", errorReporting: { label: "Error reporting", statusConfigured: "Configured. You can turn it off below.", statusNotConfigured: "Not configured.", description: "Allow this app to send error reports to help fix issues." }, developerFeatures: { label: "Show features for developers", description: "Enable developer tools and settings in the settings menu." }, dangerZone: { title: "Danger Zone", description: "Irreversible and destructive actions.", reset: { title: "Reset All Data", warning: "This will permanently delete all your settings, preferences, and other app data. This action cannot be undone.", button: "Reset All Data", toast: { title: "Reset All Data?", description: "This will permanently delete all your settings, preferences, and other app data. This action cannot be undone.", confirm: "Reset All Data", cancel: "Cancel", success: { title: "Data Reset", description: "All app data has been reset successfully." } } } } }, lr = { title: "Data Privacy", description: "Manage your data privacy settings and cookie preferences.", noCookiesConfigured: { title: "Cookie Usage", description: "This application only uses strictly essential cookies that are necessary for the application to function properly. These cookies are accepted by default and cannot be disabled.", info: "No optional cookies are configured for this application." }, cookieConsent: { title: "Cookie Consent", descriptionConsented: "You have made a choice about cookies. Reset to be asked again right away.", descriptionNotConsented: "You have not yet made a choice about cookies.", statusAcceptedAll: "You have accepted all cookies. This helps us provide you with the best experience.", statusRejectedAll: "You have rejected non-essential cookies. Only strictly necessary cookies are active.", statusCustom: "You have customized your cookie preferences. Some cookies are enabled based on your choices.", labelAcceptedAll: "All accepted", labelCustom: "Custom", labelRejectedAll: "All rejected", button: "Reset Cookie Consent", manageButton: "Manage Preferences", dialog: { title: "Reset Cookie Consent?", description: "This will clear your cookie preferences. You will be asked to accept or reject cookies on your next visit.", confirm: "Reset", cancel: "Cancel" }, toast: { title: "Cookie Consent Reset", description: "You will be asked about cookies on your next visit." } }, resetData: { title: "Reset All Data", description: "This will permanently delete all your settings and app data. This action cannot be undone.", button: "Reset All Data", toast: { title: "Reset All Data?", description: "This will permanently delete all your settings, preferences, and other app data. This action cannot be undone.", confirm: "Reset All Data", cancel: "Cancel", success: { title: "Data Reset", description: "All app data has been reset successfully." } } } }, cr = { title: "Service Worker", description: "A service worker runs in the background and can cache the app for faster loading and offline use. When enabled, it stores files locally so the app loads quickly and works without a connection. You can enable or disable it below.", loading: "Loading service worker status...", developmentMode: { title: "Development Mode", description: "App caching is only available in production builds. Build your app with 'shellui build' to enable service worker caching." }, enabled: { title: "Enable service worker", descriptionEnabled: "The service worker is enabled. It caches the app for faster loading and offline access.", descriptionDisabled: "The service worker is disabled. The app will not be cached and will always load from the network." }, status: { title: "Service worker status", registered: "Registered", notRunning: "Not running", disabled: "Disabled", updateAvailable: "Update available", fileNotFound: "Service worker file not found", fileNotFoundDescription: "The service worker file could not be found. Caching is not available. This may be a development server issue." }, update: { title: "Update Available", description: "A new version of the app is available. Install it now to get the latest features and improvements.", button: "Install Now" }, updateInstalling: { title: "Installing Update", description: "The new version is being installed. The page will reload shortly." }, updateError: { title: "Update Failed", description: "Failed to install the update. Please try again later." }, reset: { title: "Reset to Latest Version", description: "Clear all cached files and reload the app to get the latest version from the server.", button: "Reset to Latest Version" }, resetSuccess: { title: "Reset Successful", description: "All cached files have been cleared. The app will reload with the latest version." }, resetError: { title: "Reset Failed", description: "Failed to clear cached files. Please try again later." } }, dr = { title: "Develop", navigation: { title: "Navigate to", description: "Send a navigation request to the root app. This closes any open drawer or modal and navigates to the selected item.", selectLabel: "Navigation item", placeholder: "Select a destination…", empty: "No navigation items available (open from root to see items)." }, layout: { title: "Layout", description: "Switch between sidebar layout and windows (taskbar) layout. This overrides the app config for this session.", sidebar: "Sidebar", windows: "Windows" }, logging: { title: "Logging", description: "Enable or disable logging for specific namespaces. This helps you control which parts of ShellUI output debug information.", shellsdk: { label: "Show ShellSDK logs", description: "Enable logging for ShellUI SDK operations" }, shellcore: { label: "Show ShellCore logs", description: "Enable logging for ShellUI Core operations" } }, testing: { title: "Testing", description: "Test ShellUI features and functionality.", toastNotifications: { title: "Toast Notifications", buttons: { success: "Success Toast", error: "Error Toast", warning: "Warning Toast", info: "Info Toast", default: "Default Toast", loading: "Loading Toast", loadingSuccess: "Loading → Success Toast", withAction: "Toast with Action", withActionAndCancel: "Toast with Action AND cancel", longDuration: "Long Duration Toast" }, messages: { success: { title: "Success!", description: "Operation completed successfully" }, error: { title: "Error", description: "Something went wrong. Please try again." }, warning: { title: "Warning", description: "This action may have unintended consequences" }, info: { title: "Information", description: "Here's some useful information for you" }, default: { title: "Default Toast", description: "This is a default toast notification" }, loading: { title: "Loading...", description: "Please wait while we process your request" }, processing: { title: "Processing...", description: "Uploading your file" }, uploadComplete: { title: "Upload Complete!", description: "Your file has been uploaded successfully" }, withAction: { title: "Toast with Action", description: "This toast has an action button" }, undone: { title: "Undone", description: "Action has been undone" }, cancelled: { title: "Cancelled", description: "Action has been cancelled" }, persistent: { title: "Persistent Toast", description: "This toast will stay until dismissed (10 seconds)" }, actionLabels: { undo: "Undo", cancel: "Cancel" } } }, dialogTesting: { title: "Dialog Testing", buttons: { okDialog: "OK Dialog", okCancelDialog: "OK Cancel Dialog", deleteDialog: "Delete Dialog", confirmDialog: "Confirm Dialog", onlyCancelDialog: "Only Cancel Dialog" }, dialogs: { ok: { title: "Simple OK Dialog", description: "This is a simple dialog with just an OK button." }, okCancel: { title: "OK Cancel Dialog", description: "This dialog has both OK and Cancel buttons." }, delete: { title: "Delete Confirmation", description: "Are you sure you want to delete this item? This action cannot be undone.", okLabel: "Delete", cancelLabel: "Cancel" }, confirm: { title: "Confirm Action", description: "Do you want to proceed with this action?", okLabel: "Confirm", cancelLabel: "Cancel" }, onlyCancel: { title: "Only Cancel Dialog", description: "This dialog only has a Cancel button.", cancelLabel: "Close" } }, toasts: { okClicked: "OK clicked", cancelClicked: "Cancel clicked", itemDeleted: "Item deleted", deletionCancelled: "Deletion cancelled", actionConfirmed: "Action confirmed", actionCancelled: "Action cancelled", dialogClosed: "Dialog closed" } }, modalTesting: { title: "Modal Testing", description: "Opens the settings in a modal. Close with the × button or by clicking outside.", buttons: { openModal: "Open modal (settings)" } }, drawerTesting: { title: "Drawer Testing", buttons: { drawerRight: "Drawer from right", drawerLeft: "Drawer from left", drawerTop: "Drawer from top", drawerBottom: "Drawer from bottom", drawerRightNarrow: "Drawer right (400px)", drawerBottomHalf: "Drawer bottom (60vh)", closeDrawer: "Close drawer" } } } }, ur = {
1012
- title: tr,
1013
- categories: rr,
1014
- routes: or,
1015
- updateApp: nr,
1016
- appearance: ir,
1017
- languageAndRegion: sr,
1018
- advanced: ar,
1019
- dataPrivacy: lr,
1020
- caching: cr,
1021
- develop: dr
1022
- }, pr = "We value your privacy", gr = "We use cookies to improve your experience, analyze how you use the app, and fix issues. You can accept all cookies, reject non-essential ones, or customize your preferences.", fr = "Our cookies have changed", mr = "We've updated our cookie policy with new features or services. Please review and confirm your preferences to continue with the best experience.", hr = "Accept all", vr = "Reject all", yr = "Set preferences", wr = { title: "Cookie Preferences", description: "Manage your cookie preferences. Enable or disable cookies by category or individually.", acceptAll: "Accept all", rejectAll: "Reject all", save: "Save preferences", partial: "Partial", required: "Required", alwaysOn: "Always on", noCookies: "No cookies configured.", categories: { strict_necessary: { title: "Strictly Necessary", description: "Essential for the website to function. Cannot be disabled." }, functional_performance: { title: "Functional & Performance", description: "Help us improve by collecting anonymous usage data and error reports." }, targeting: { title: "Targeting & Advertising", description: "Used to deliver personalized advertisements." }, social_media_embedded: { title: "Social Media & Embedded Content", description: "Enable social media features and embedded content from third parties." } }, duration: { seconds: "{{count}} second", seconds_other: "{{count}} seconds", minutes: "{{count}} minute", minutes_other: "{{count}} minutes", hours: "{{count}} hour", hours_other: "{{count}} hours", days: "{{count}} day", days_other: "{{count}} days", years: "{{count}} year", years_other: "{{count}} years" } }, br = {
1023
- title: pr,
1024
- description: gr,
1025
- titleRenewal: fr,
1026
- descriptionRenewal: mr,
1027
- accept: hr,
1028
- reject: vr,
1029
- setPreferences: yr,
1030
- preferences: wr
1031
- }, kr = "Paramètres", Fr = "Bienvenue sur {{title}}", Cr = "Sélectionnez un élément de navigation pour commencer.", Sr = "Erreur de navigation", Er = "Cette URL n'est pas configurée dans la navigation de l'application.", Ar = { titleChunk: "La page n'a pas pu être chargée", titleGeneric: "Une erreur s'est produite", descriptionChunk: "Cela peut arriver après une mise à jour ou en cas de problème réseau. Essayez d'actualiser la page.", descriptionGeneric: "Une erreur inattendue s'est produite. Vous pouvez réessayer ou revenir à l'accueil.", tryAgain: "Réessayer", goToHome: "Retour à l'accueil", errorDetails: "Détails de l'erreur" }, Tr = {
1032
- settings: kr,
1033
- welcome: Fr,
1034
- getStarted: Cr,
1035
- navigationError: Sr,
1036
- navigationNotAllowed: Er,
1037
- errorBoundary: Ar
1038
- }, Lr = "Paramètres", Nr = { preferences: "Préférences", system: "Système", developer: "Développeur" }, Dr = { appearance: "Apparence", languageAndRegion: "Langue et région", updateApp: "Mise à jour logicielle", advanced: "Avancé", dataPrivacy: "Confidentialité des données", develop: "Développement", serviceWorker: "Service Worker" }, Ir = { description: "Consultez la version de l'application et vérifiez les mises à jour. Lorsqu'une mise à jour est disponible, vous pouvez l'installer depuis ici.", currentVersion: "Version actuelle", status: "État des mises à jour", statusUpToDate: "À jour", statusUpdateAvailable: "Mise à jour disponible", checkForUpdate: "Vérifier les mises à jour", checking: "Vérification…", versionUnknown: "—", tauriComingSoon: "Les mises à jour de l'application bureau seront bientôt disponibles. Vous serez notifié lorsqu'une nouvelle version sera prête.", swDisabledMessage: "L'application se mettra à jour lors du rechargement de la page.", refreshApp: "Actualiser l'application", youAreUpToDate: "Vous êtes à jour", installNow: "Installer maintenant", checkError: "Erreur lors de la vérification des mises à jour. Réessayer", tryAgain: "Réessayer" }, _r = { title: "Apparence", theme: "Thème", themeDescription: "Choisissez votre schéma de couleurs préféré (actuel : {{theme}})", mode: "Mode", modeDescription: "Choisissez le mode clair, sombre ou automatique.", colorTheme: "Thème de couleur", colorThemeDescription: "Sélectionnez un thème de couleur. Chaque thème a des variantes claires et sombres.", themes: { light: "Clair", dark: "Sombre", system: "Automatique" } }, Rr = { title: "Langue et région", description: "Configurez vos paramètres de langue et de région.", language: "Langue", languageDescription: "Choisissez votre langue préférée. Les modifications seront appliquées immédiatement.", region: "Région", regionDescription: "Sélectionnez votre fuseau horaire. Les dates dans toute l'application s'adapteront à ce fuseau horaire.", currentDateTime: "Date et heure actuelles", timezoneLabel: "Fuseau horaire", resetToBrowser: "Réinitialiser au fuseau horaire automatique", defaultBrowser: "Automatique" }, xr = { title: "Avancé", description: "Paramètres avancés et options de configuration.", errorReporting: { label: "Signalement d'erreurs", statusConfigured: "Configuré. Vous pouvez le désactiver ci-dessous.", statusNotConfigured: "Non configuré.", description: "Autoriser cette application à envoyer des rapports d'erreurs pour aider à corriger les problèmes." }, developerFeatures: { label: "Afficher les fonctionnalités pour les développeurs", description: "Activez les outils et paramètres de développement dans le menu des paramètres." }, dangerZone: { title: "Zone de danger", description: "Actions irréversibles et destructives.", reset: { title: "Réinitialiser toutes les données", warning: "Cela supprimera définitivement tous vos paramètres, préférences et autres données d'application. Cette action ne peut pas être annulée.", button: "Réinitialiser toutes les données", toast: { title: "Réinitialiser toutes les données ?", description: "Cela supprimera définitivement tous vos paramètres, préférences et autres données d'application. Cette action ne peut pas être annulée.", confirm: "Réinitialiser toutes les données", cancel: "Annuler", success: { title: "Données réinitialisées", description: "Toutes les données de l'application ont été réinitialisées avec succès." } } } } }, Or = { title: "Confidentialité des données", description: "Gérez vos paramètres de confidentialité des données et vos préférences de cookies.", noCookiesConfigured: { title: "Utilisation des cookies", description: "Cette application n'utilise que des cookies strictement essentiels nécessaires au bon fonctionnement de l'application. Ces cookies sont acceptés par défaut et ne peuvent pas être désactivés.", info: "Aucun cookie optionnel n'est configuré pour cette application." }, cookieConsent: { title: "Consentement aux cookies", descriptionConsented: "Vous avez fait un choix concernant les cookies. Réinitialisez pour être redemandé immédiatement.", descriptionNotConsented: "Vous n'avez pas encore fait de choix concernant les cookies.", statusAcceptedAll: "Vous avez accepté tous les cookies. Cela nous aide à vous offrir la meilleure expérience.", statusRejectedAll: "Vous avez refusé les cookies non essentiels. Seuls les cookies strictement nécessaires sont actifs.", statusCustom: "Vous avez personnalisé vos préférences de cookies. Certains cookies sont activés selon vos choix.", labelAcceptedAll: "Tous acceptés", labelCustom: "Personnalisé", labelRejectedAll: "Tous refusés", button: "Réinitialiser le consentement", manageButton: "Gérer les préférences", dialog: { title: "Réinitialiser le consentement aux cookies ?", description: "Cela effacera vos préférences de cookies. Vous serez invité à accepter ou refuser les cookies lors de votre prochaine visite.", confirm: "Réinitialiser", cancel: "Annuler" }, toast: { title: "Consentement réinitialisé", description: "Vous serez invité à choisir vos préférences de cookies lors de votre prochaine visite." } }, resetData: { title: "Réinitialiser toutes les données", description: "Cela supprimera définitivement tous vos paramètres et données d'application. Cette action ne peut pas être annulée.", button: "Réinitialiser toutes les données", toast: { title: "Réinitialiser toutes les données ?", description: "Cela supprimera définitivement tous vos paramètres, préférences et autres données d'application. Cette action ne peut pas être annulée.", confirm: "Réinitialiser toutes les données", cancel: "Annuler", success: { title: "Données réinitialisées", description: "Toutes les données de l'application ont été réinitialisées avec succès." } } } }, Pr = { title: "Service Worker", description: "Un service worker s'exécute en arrière-plan et peut mettre en cache l'application pour un chargement plus rapide et une utilisation hors ligne. Lorsqu'il est activé, il stocke les fichiers localement pour que l'application se charge rapidement et fonctionne sans connexion. Vous pouvez l'activer ou le désactiver ci-dessous.", loading: "Chargement du statut du service worker...", developmentMode: { title: "Mode développement", description: "La mise en cache de l'application n'est disponible que dans les builds de production. Compilez votre application avec 'shellui build' pour activer la mise en cache du service worker." }, enabled: { title: "Activer le service worker", descriptionEnabled: "Le service worker est activé. Il met en cache l'application pour un chargement plus rapide et un accès hors ligne.", descriptionDisabled: "Le service worker est désactivé. L'application ne sera pas mise en cache et se chargera toujours depuis le réseau." }, status: { title: "Statut du service worker", registered: "Enregistré", notRunning: "Non actif", disabled: "Désactivé", updateAvailable: "Mise à jour disponible", fileNotFound: "Fichier du service worker introuvable", fileNotFoundDescription: "Le fichier du service worker est introuvable. La mise en cache n'est pas disponible. Il peut s'agir d'un problème de serveur de développement." }, update: { title: "Mise à jour disponible", description: "Une nouvelle version de l'application est disponible. Installez-la maintenant pour obtenir les dernières fonctionnalités et améliorations.", button: "Installer maintenant" }, updateInstalling: { title: "Installation de la mise à jour", description: "La nouvelle version est en cours d'installation. La page sera rechargée sous peu." }, updateError: { title: "Échec de la mise à jour", description: "Échec de l'installation de la mise à jour. Veuillez réessayer plus tard." }, reset: { title: "Réinitialiser à la dernière version", description: "Effacer tous les fichiers mis en cache et recharger l'application pour obtenir la dernière version du serveur.", button: "Réinitialiser à la dernière version" }, resetSuccess: { title: "Réinitialisation réussie", description: "Tous les fichiers mis en cache ont été effacés. L'application sera rechargée avec la dernière version." }, resetError: { title: "Échec de la réinitialisation", description: "Échec de l'effacement des fichiers mis en cache. Veuillez réessayer plus tard." } }, Wr = { title: "Développement", navigation: { title: "Naviguer vers", description: "Envoyer une demande de navigation à l'application racine. Cela ferme tout tiroir ou modal ouvert et navigue vers l'élément sélectionné.", selectLabel: "Élément de navigation", placeholder: "Choisir une destination…", empty: "Aucun élément de navigation disponible (ouvrez depuis la racine pour voir les éléments)." }, layout: { title: "Disposition", description: "Basculer entre la disposition avec barre latérale et la disposition fenêtres (barre des tâches). Remplace la config de l'app pour cette session.", sidebar: "Barre latérale", windows: "Fenêtres" }, logging: { title: "Journalisation", description: "Activez ou désactivez la journalisation pour des espaces de noms spécifiques. Cela vous aide à contrôler quelles parties de ShellUI affichent des informations de débogage.", shellsdk: { label: "Afficher les journaux ShellSDK", description: "Activez la journalisation pour les opérations ShellUI SDK" }, shellcore: { label: "Afficher les journaux ShellCore", description: "Activez la journalisation pour les opérations ShellUI Core" } }, testing: { title: "Tests", description: "Testez les fonctionnalités de ShellUI.", toastNotifications: { title: "Notifications Toast", buttons: { success: "Toast de succès", error: "Toast d'erreur", warning: "Toast d'avertissement", info: "Toast d'information", default: "Toast par défaut", loading: "Toast de chargement", loadingSuccess: "Toast de chargement → Succès", withAction: "Toast avec action", withActionAndCancel: "Toast avec action ET annulation", longDuration: "Toast longue durée" }, messages: { success: { title: "Succès !", description: "Opération terminée avec succès" }, error: { title: "Erreur", description: "Quelque chose s'est mal passé. Veuillez réessayer." }, warning: { title: "Avertissement", description: "Cette action peut avoir des conséquences imprévues" }, info: { title: "Information", description: "Voici des informations utiles pour vous" }, default: { title: "Toast par défaut", description: "Ceci est une notification toast par défaut" }, loading: { title: "Chargement...", description: "Veuillez patienter pendant le traitement de votre demande" }, processing: { title: "Traitement...", description: "Téléchargement de votre fichier" }, uploadComplete: { title: "Téléchargement terminé !", description: "Votre fichier a été téléchargé avec succès" }, withAction: { title: "Toast avec action", description: "Ce toast a un bouton d'action" }, undone: { title: "Annulé", description: "L'action a été annulée" }, cancelled: { title: "Annulé", description: "L'action a été annulée" }, persistent: { title: "Toast persistant", description: "Ce toast restera jusqu'à sa fermeture (10 secondes)" }, actionLabels: { undo: "Annuler", cancel: "Annuler" } } }, dialogTesting: { title: "Tests de dialogue", buttons: { okDialog: "Dialogue OK", okCancelDialog: "Dialogue OK Annuler", deleteDialog: "Dialogue de suppression", confirmDialog: "Dialogue de confirmation", onlyCancelDialog: "Dialogue Annuler uniquement" }, dialogs: { ok: { title: "Dialogue OK simple", description: "Ceci est un dialogue simple avec uniquement un bouton OK." }, okCancel: { title: "Dialogue OK Annuler", description: "Ce dialogue a à la fois des boutons OK et Annuler." }, delete: { title: "Confirmation de suppression", description: "Êtes-vous sûr de vouloir supprimer cet élément ? Cette action ne peut pas être annulée.", okLabel: "Supprimer", cancelLabel: "Annuler" }, confirm: { title: "Confirmer l'action", description: "Voulez-vous procéder à cette action ?", okLabel: "Confirmer", cancelLabel: "Annuler" }, onlyCancel: { title: "Dialogue Annuler uniquement", description: "Ce dialogue n'a qu'un bouton Annuler.", cancelLabel: "Fermer" } }, toasts: { okClicked: "OK cliqué", cancelClicked: "Annuler cliqué", itemDeleted: "Élément supprimé", deletionCancelled: "Suppression annulée", actionConfirmed: "Action confirmée", actionCancelled: "Action annulée", dialogClosed: "Dialogue fermé" } }, modalTesting: { title: "Tests du modal", description: "Ouvre les paramètres dans un modal. Fermez avec le bouton × ou en cliquant à l'extérieur.", buttons: { openModal: "Ouvrir le modal (paramètres)" } }, drawerTesting: { title: "Tests du tiroir", buttons: { drawerRight: "Tiroir depuis la droite", drawerLeft: "Tiroir depuis la gauche", drawerTop: "Tiroir depuis le haut", drawerBottom: "Tiroir depuis le bas", drawerRightNarrow: "Tiroir droite (400px)", drawerBottomHalf: "Tiroir bas (60vh)", closeDrawer: "Fermer le tiroir" } } } }, Ur = {
1039
- title: Lr,
1040
- categories: Nr,
1041
- routes: Dr,
1042
- updateApp: Ir,
1043
- appearance: _r,
1044
- languageAndRegion: Rr,
1045
- advanced: xr,
1046
- dataPrivacy: Or,
1047
- caching: Pr,
1048
- develop: Wr
1049
- }, Br = "Votre vie privée compte", Hr = "Nous utilisons des cookies pour améliorer votre expérience, analyser l'utilisation de l'application et corriger les problèmes. Vous pouvez tout accepter, tout refuser ou personnaliser vos préférences.", zr = "Nos cookies ont évolué", Mr = "Nous avons mis à jour notre politique de cookies avec de nouvelles fonctionnalités ou services. Veuillez confirmer vos préférences pour continuer avec la meilleure expérience.", $r = "Tout accepter", jr = "Tout refuser", Vr = "Personnaliser", Gr = { title: "Préférences des cookies", description: "Gérez vos préférences de cookies. Activez ou désactivez les cookies par catégorie ou individuellement.", acceptAll: "Tout accepter", rejectAll: "Tout refuser", save: "Enregistrer les préférences", partial: "Partiel", required: "Requis", alwaysOn: "Toujours actif", noCookies: "Aucun cookie configuré.", categories: { strict_necessary: { title: "Strictement nécessaires", description: "Essentiels au fonctionnement du site. Ne peuvent pas être désactivés." }, functional_performance: { title: "Fonctionnels et performance", description: "Nous aident à améliorer le site en collectant des données d'utilisation anonymes et des rapports d'erreurs." }, targeting: { title: "Ciblage et publicité", description: "Utilisés pour diffuser des publicités personnalisées." }, social_media_embedded: { title: "Réseaux sociaux et contenu intégré", description: "Activent les fonctionnalités de réseaux sociaux et le contenu intégré de tiers." } }, duration: { seconds: "{{count}} seconde", seconds_other: "{{count}} secondes", minutes: "{{count}} minute", minutes_other: "{{count}} minutes", hours: "{{count}} heure", hours_other: "{{count}} heures", days: "{{count}} jour", days_other: "{{count}} jours", years: "{{count}} an", years_other: "{{count}} ans" } }, Kr = {
1050
- title: Br,
1051
- description: Hr,
1052
- titleRenewal: zr,
1053
- descriptionRenewal: Mr,
1054
- accept: $r,
1055
- reject: jr,
1056
- setPreferences: Vr,
1057
- preferences: Gr
1058
- }, ge = [
1059
- { code: "en", name: "English", nativeName: "English" },
1060
- { code: "fr", name: "French", nativeName: "Français" }
1061
- ], qr = {
1062
- en: {
1063
- common: er,
1064
- settings: ur,
1065
- cookieConsent: br
1066
- },
1067
- fr: {
1068
- common: Tr,
1069
- settings: Ur,
1070
- cookieConsent: Kr
1071
- }
1072
- }, Yr = (e) => {
1073
- if (typeof window < "u")
1074
- try {
1075
- const t = localStorage.getItem("shellui:settings");
1076
- if (t) {
1077
- const o = JSON.parse(t).language?.code;
1078
- if (o && e.includes(o))
1079
- return o;
1080
- }
1081
- } catch {
1082
- }
1083
- return e[0] || "en";
1084
- };
1085
- let ze = !1;
1086
- const Je = (e) => {
1087
- const r = (e ? Array.isArray(e) ? e : [e] : ge.map((s) => s.code)).filter(
1088
- (s) => ge.some((l) => l.code === s)
1089
- ), o = r.length > 0 ? r : ["en"], n = Yr(o);
1090
- return ze ? pe.changeLanguage(n) : (pe.use(pt).init({
1091
- resources: qr,
1092
- defaultNS: "common",
1093
- lng: n,
1094
- fallbackLng: "en",
1095
- supportedLngs: o,
1096
- interpolation: {
1097
- escapeValue: !1
1098
- // React already escapes values
1099
- },
1100
- react: {
1101
- useSuspense: !1
1102
- // Disable suspense for better PWA compatibility
1103
- }
1104
- }), ze = !0), o;
1105
- };
1106
- Je();
1107
- const Do = (e) => {
1108
- const t = e ? Array.isArray(e) ? e : [e] : ge.map((r) => r.code);
1109
- return ge.filter((r) => t.includes(r.code));
1110
- };
1111
- function Jr({ children: e }) {
1112
- const { settings: t } = ie(), { config: r } = X(), o = t.language?.code || "en";
1113
- return z(() => {
1114
- r?.language && Je(r.language);
1115
- }, [r?.language]), z(() => {
1116
- pe.language !== o && pe.changeLanguage(o);
1117
- }, [o]), /* @__PURE__ */ i(R, { children: e });
1118
- }
1119
- const fe = {
1120
- /** Sidebar trigger (above main content, below modals) */
1121
- SIDEBAR_TRIGGER: 9999,
1122
- /** Modal overlay and content (settings panel, etc.) */
1123
- MODAL_OVERLAY: 1e4,
1124
- MODAL_CONTENT: 10001,
1125
- /** Drawer overlay and content (slide-out panels; same level as modal) */
1126
- DRAWER_OVERLAY: 1e4,
1127
- DRAWER_CONTENT: 10001,
1128
- /** Toasts (above modals so they stay clickable when modal is open) */
1129
- TOAST: 10100,
1130
- /** Alert dialog overlay and content (confirmations; above toasts) */
1131
- ALERT_DIALOG_OVERLAY: 10200,
1132
- ALERT_DIALOG_CONTENT: 10201,
1133
- /** Cookie consent (above everything to ensure visibility) */
1134
- COOKIE_CONSENT_OVERLAY: 10300,
1135
- COOKIE_CONSENT_CONTENT: 10301,
1136
- /** Windows layout: taskbar (below windows), windows use dynamic z-index above this */
1137
- WINDOWS_TASKBAR: 9e3,
1138
- /** Base z-index for windows; each window gets base + order */
1139
- WINDOWS_WINDOW_BASE: 9001
1140
- }, Me = E.Root, Ze = E.Portal, De = G(({ className: e, ...t }, r) => /* @__PURE__ */ i(
1141
- E.Overlay,
1142
- {
1143
- ref: r,
1144
- "data-dialog-overlay": !0,
1145
- className: $("fixed inset-0 bg-[hsl(var(--background)/0.8)] backdrop-blur-[1px]", e),
1146
- style: { zIndex: fe.ALERT_DIALOG_OVERLAY },
1147
- ...t
1148
- }
1149
- ));
1150
- De.displayName = E.Overlay.displayName;
1151
- const Zr = Ke(
1152
- "fixed left-[50%] top-[50%] grid w-full min-w-0 max-w-[calc(100vw-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background py-6 shadow-lg box-border overflow-hidden sm:rounded-lg",
1153
- {
1154
- variants: {
1155
- size: {
1156
- default: "max-w-lg",
1157
- sm: "max-w-sm"
1158
- }
1159
- },
1160
- defaultVariants: {
1161
- size: "default"
1162
- }
1163
- }
1164
- ), Qe = G(({ className: e, size: t = "default", children: r, style: o, ...n }, s) => /* @__PURE__ */ C(Ze, { children: [
1165
- /* @__PURE__ */ i(De, {}),
1166
- /* @__PURE__ */ i(
1167
- E.Content,
1168
- {
1169
- ref: s,
1170
- "data-dialog-content": !0,
1171
- className: $(Zr({ size: t }), "group", e),
1172
- "data-size": t,
1173
- style: { zIndex: fe.ALERT_DIALOG_CONTENT, ...o },
1174
- ...n,
1175
- children: r
1176
- }
1177
- )
1178
- ] }));
1179
- Qe.displayName = E.Content.displayName;
1180
- const Xe = ({ className: e, ...t }) => /* @__PURE__ */ i(
1181
- "div",
1182
- {
1183
- className: $(
1184
- "flex flex-col px-6 space-y-2 text-left group-data-[size=sm]:items-center group-data-[size=sm]:text-center",
1185
- e
1186
- ),
1187
- ...t
1188
- }
1189
- );
1190
- Xe.displayName = "AlertDialogHeader";
1191
- const et = ({ className: e, ...t }) => /* @__PURE__ */ i(
1192
- "div",
1193
- {
1194
- className: $(
1195
- "flex size-10 shrink-0 items-center justify-center rounded-lg mb-4 [&>svg]:size-5",
1196
- e
1197
- ),
1198
- ...t
1199
- }
1200
- );
1201
- et.displayName = "AlertDialogMedia";
1202
- const tt = ({ className: e, ...t }) => /* @__PURE__ */ i(
1203
- "div",
1204
- {
1205
- className: $(
1206
- "flex w-full min-w-full flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
1207
- "-mb-6 mt-2 border-t border-border bg-muted/50 px-6 py-3 sm:rounded-b-lg",
1208
- "[&_button]:h-8 [&_button]:text-xs [&_button]:px-3",
1209
- "group-data-[size=sm]:flex-row group-data-[size=sm]:gap-2",
1210
- "group-data-[size=sm]:[&>*:not(:only-child)]:min-w-0 group-data-[size=sm]:[&>*:not(:only-child)]:flex-1",
1211
- e
1212
- ),
1213
- ...t
1214
- }
1215
- );
1216
- tt.displayName = "AlertDialogFooter";
1217
- const be = G(({ className: e, ...t }, r) => /* @__PURE__ */ i(
1218
- E.Title,
1219
- {
1220
- ref: r,
1221
- className: $("text-lg font-semibold leading-none tracking-tight", e),
1222
- ...t
1223
- }
1224
- ));
1225
- be.displayName = E.Title.displayName;
1226
- const ke = G(({ className: e, ...t }, r) => /* @__PURE__ */ i(
1227
- E.Description,
1228
- {
1229
- ref: r,
1230
- className: $("text-sm text-muted-foreground", e),
1231
- ...t
1232
- }
1233
- ));
1234
- ke.displayName = E.Description.displayName;
1235
- const J = G(({ className: e, variant: t, size: r, ...o }, n) => /* @__PURE__ */ i(E.Action, { asChild: !0, children: /* @__PURE__ */ i(
1236
- H,
1237
- {
1238
- ref: n,
1239
- variant: t,
1240
- size: r,
1241
- className: e,
1242
- ...o
1243
- }
1244
- ) }));
1245
- J.displayName = E.Action.displayName;
1246
- const re = G(({ className: e, variant: t, size: r, ...o }, n) => /* @__PURE__ */ i(E.Cancel, { asChild: !0, children: /* @__PURE__ */ i(
1247
- H,
1248
- {
1249
- ref: n,
1250
- variant: t,
1251
- size: r,
1252
- className: e,
1253
- ...o
1254
- }
1255
- ) }));
1256
- re.displayName = E.Cancel.displayName;
1257
- const Qr = 200, Xr = () => /* @__PURE__ */ C(
1258
- "svg",
1259
- {
1260
- xmlns: "http://www.w3.org/2000/svg",
1261
- width: "20",
1262
- height: "20",
1263
- viewBox: "0 0 24 24",
1264
- fill: "none",
1265
- stroke: "currentColor",
1266
- strokeWidth: "2",
1267
- strokeLinecap: "round",
1268
- strokeLinejoin: "round",
1269
- "aria-hidden": !0,
1270
- children: [
1271
- /* @__PURE__ */ i("path", { d: "M3 6h18" }),
1272
- /* @__PURE__ */ i("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
1273
- /* @__PURE__ */ i("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
1274
- /* @__PURE__ */ i(
1275
- "line",
1276
- {
1277
- x1: "10",
1278
- x2: "10",
1279
- y1: "11",
1280
- y2: "17"
1281
- }
1282
- ),
1283
- /* @__PURE__ */ i(
1284
- "line",
1285
- {
1286
- x1: "14",
1287
- x2: "14",
1288
- y1: "11",
1289
- y2: "17"
1290
- }
1291
- )
1292
- ]
1293
- }
1294
- ), eo = ({ className: e }) => /* @__PURE__ */ i(
1295
- "svg",
1296
- {
1297
- xmlns: "http://www.w3.org/2000/svg",
1298
- viewBox: "0 0 256 256",
1299
- fill: "currentColor",
1300
- className: e,
1301
- children: /* @__PURE__ */ i("path", { d: "M164.49 163.51a12 12 0 1 1-17 0a12 12 0 0 1 17 0m-81-8a12 12 0 1 0 17 0a12 12 0 0 0-16.98 0Zm9-39a12 12 0 1 0-17 0a12 12 0 0 0 17-.02Zm48-1a12 12 0 1 0 0 17a12 12 0 0 0 0-17M232 128A104 104 0 1 1 128 24a8 8 0 0 1 8 8a40 40 0 0 0 40 40a8 8 0 0 1 8 8a40 40 0 0 0 40 40a8 8 0 0 1 8 8m-16.31 7.39A56.13 56.13 0 0 1 168.5 87.5a56.13 56.13 0 0 1-47.89-47.19a88 88 0 1 0 95.08 95.08" })
1302
- }
1303
- ), rt = Se(void 0);
1304
- function to() {
1305
- const e = me(rt);
1306
- if (!e)
1307
- throw new Error("useDialog must be used within a DialogProvider");
1308
- return e;
1309
- }
1310
- const ro = ({ children: e }) => {
1311
- const [t, r] = ne(null), [o, n] = ne(!1), s = ue(null), l = T(() => {
1312
- s.current && clearTimeout(s.current), s.current = setTimeout(() => {
1313
- s.current = null, r(null);
1314
- }, Qr);
1315
- }, []), c = T(
1316
- (g) => {
1317
- n(g), !g && t && (t.from && t.from.length > 0 ? m.sendMessage({
1318
- type: "SHELLUI_DIALOG_CANCEL",
1319
- payload: { id: t.id },
1320
- to: t.from
1321
- }) : t.id && (m.callbackRegistry.triggerCancel(t.id), m.callbackRegistry.clear(t.id)), l());
1322
- },
1323
- [t, l]
1324
- ), d = T(() => {
1325
- t?.from && t.from.length > 0 ? m.sendMessage({
1326
- type: "SHELLUI_DIALOG_OK",
1327
- payload: { id: t.id },
1328
- to: t.from
1329
- }) : t?.id && (m.callbackRegistry.triggerAction(t.id), m.callbackRegistry.clear(t.id)), n(!1), l();
1330
- }, [t, l]), v = T(() => {
1331
- t?.from && t.from.length > 0 ? m.sendMessage({
1332
- type: "SHELLUI_DIALOG_CANCEL",
1333
- payload: { id: t.id },
1334
- to: t.from
1335
- }) : t?.id && (m.callbackRegistry.triggerCancel(t.id), m.callbackRegistry.clear(t.id)), n(!1), l();
1336
- }, [t, l]), p = T(() => {
1337
- t?.from && t.from.length > 0 ? m.sendMessage({
1338
- type: "SHELLUI_DIALOG_SECONDARY",
1339
- payload: { id: t.id },
1340
- to: t.from
1341
- }) : t?.id && (m.callbackRegistry.triggerSecondary(t.id), m.callbackRegistry.clear(t.id)), n(!1), l();
1342
- }, [t, l]), u = T((g) => {
1343
- if (typeof window > "u" || window.parent !== window)
1344
- return;
1345
- s.current && (clearTimeout(s.current), s.current = null);
1346
- const F = g.id || `dialog-${Date.now()}-${Math.random()}`;
1347
- (g.onOk || g.onCancel || g.secondaryButton?.onClick) && m.callbackRegistry.register(F, {
1348
- action: g.onOk,
1349
- cancel: g.onCancel,
1350
- secondary: g.secondaryButton?.onClick
1351
- }), r({
1352
- id: F,
1353
- title: g.title,
1354
- description: g.description,
1355
- mode: g.mode || "ok",
1356
- okLabel: g.okLabel,
1357
- cancelLabel: g.cancelLabel,
1358
- size: g.size,
1359
- position: g.position,
1360
- secondaryButton: g.secondaryButton,
1361
- iconType: g.icon === "cookie" ? "cookie" : void 0
1362
- }), n(!0);
1363
- }, []);
1364
- z(() => {
1365
- if (typeof window > "u" || window.parent !== window)
1366
- return;
1367
- const g = m.addMessageListener("SHELLUI_DIALOG", (k) => {
1368
- s.current && (clearTimeout(s.current), s.current = null);
1369
- const y = k.payload;
1370
- r({
1371
- id: y.id,
1372
- title: y.title,
1373
- description: y.description,
1374
- mode: y.mode || "ok",
1375
- okLabel: y.okLabel,
1376
- cancelLabel: y.cancelLabel,
1377
- size: y.size,
1378
- position: y.position,
1379
- secondaryButton: y.secondaryButton,
1380
- iconType: y.icon === "cookie" ? "cookie" : void 0,
1381
- from: k.from
1382
- }), n(!0);
1383
- }), F = m.addMessageListener(
1384
- "SHELLUI_DIALOG_UPDATE",
1385
- (k) => {
1386
- s.current && (clearTimeout(s.current), s.current = null);
1387
- const y = k.payload;
1388
- r({
1389
- id: y.id,
1390
- title: y.title,
1391
- description: y.description,
1392
- mode: y.mode || "ok",
1393
- okLabel: y.okLabel,
1394
- cancelLabel: y.cancelLabel,
1395
- size: y.size,
1396
- position: y.position,
1397
- secondaryButton: y.secondaryButton,
1398
- iconType: y.icon === "cookie" ? "cookie" : void 0,
1399
- from: k.from
1400
- }), n(!0);
1401
- }
1402
- );
1403
- return () => {
1404
- g(), F(), s.current && clearTimeout(s.current);
1405
- };
1406
- }, []);
1407
- const a = () => {
1408
- if (!t) return null;
1409
- const { mode: g, okLabel: F, cancelLabel: k, secondaryButton: y } = t;
1410
- if (y && t.position === "bottom-left")
1411
- return /* @__PURE__ */ C(R, { children: [
1412
- /* @__PURE__ */ i(
1413
- H,
1414
- {
1415
- size: "sm",
1416
- variant: "ghost",
1417
- onClick: p,
1418
- children: y.label
1419
- }
1420
- ),
1421
- /* @__PURE__ */ C("div", { className: "flex gap-2", children: [
1422
- g === "okCancel" && /* @__PURE__ */ i(
1423
- H,
1424
- {
1425
- size: "sm",
1426
- variant: "ghost",
1427
- onClick: v,
1428
- children: k || "Cancel"
1429
- }
1430
- ),
1431
- /* @__PURE__ */ i(
1432
- H,
1433
- {
1434
- size: "sm",
1435
- onClick: d,
1436
- children: F || "OK"
1437
- }
1438
- )
1439
- ] })
1440
- ] });
1441
- switch (g) {
1442
- case "ok":
1443
- return /* @__PURE__ */ i(J, { onClick: d, children: F || "OK" });
1444
- case "okCancel":
1445
- return /* @__PURE__ */ C(R, { children: [
1446
- /* @__PURE__ */ i(
1447
- re,
1448
- {
1449
- variant: "outline",
1450
- onClick: v,
1451
- children: k || "Cancel"
1452
- }
1453
- ),
1454
- /* @__PURE__ */ i(J, { onClick: d, children: F || "OK" })
1455
- ] });
1456
- case "delete":
1457
- return /* @__PURE__ */ C(R, { children: [
1458
- /* @__PURE__ */ i(
1459
- re,
1460
- {
1461
- variant: "outline",
1462
- onClick: v,
1463
- children: k || "Cancel"
1464
- }
1465
- ),
1466
- /* @__PURE__ */ i(
1467
- J,
1468
- {
1469
- variant: "destructive",
1470
- onClick: d,
1471
- children: F || "Delete"
1472
- }
1473
- )
1474
- ] });
1475
- case "confirm":
1476
- return /* @__PURE__ */ C(R, { children: [
1477
- /* @__PURE__ */ i(
1478
- re,
1479
- {
1480
- variant: "outline",
1481
- onClick: v,
1482
- children: k || "Cancel"
1483
- }
1484
- ),
1485
- /* @__PURE__ */ i(J, { onClick: d, children: F || "Confirm" })
1486
- ] });
1487
- case "onlyCancel":
1488
- return /* @__PURE__ */ i(
1489
- re,
1490
- {
1491
- variant: "outline",
1492
- onClick: v,
1493
- children: k || "Cancel"
1494
- }
1495
- );
1496
- default:
1497
- return /* @__PURE__ */ i(J, { onClick: d, children: F || "OK" });
1498
- }
1499
- }, f = () => !t || t.position !== "bottom-left" ? null : /* @__PURE__ */ i(
1500
- Me,
1501
- {
1502
- open: o,
1503
- onOpenChange: c,
1504
- children: /* @__PURE__ */ C(Ze, { children: [
1505
- /* @__PURE__ */ i(De, { style: { zIndex: fe.COOKIE_CONSENT_OVERLAY } }),
1506
- /* @__PURE__ */ C(
1507
- E.Content,
1508
- {
1509
- className: "fixed w-[calc(100%-32px)] max-w-[520px] rounded-xl border border-border bg-background text-foreground shadow-lg sm:w-full",
1510
- style: {
1511
- bottom: 16,
1512
- left: 16,
1513
- zIndex: fe.COOKIE_CONSENT_CONTENT,
1514
- backgroundColor: "hsl(var(--background))",
1515
- top: "auto",
1516
- right: "auto",
1517
- transform: "none"
1518
- },
1519
- "data-dialog-content": !0,
1520
- "data-cookie-consent": !0,
1521
- children: [
1522
- /* @__PURE__ */ C("div", { className: "flex items-start gap-4 p-6 sm:gap-5 sm:p-7", children: [
1523
- t.iconType === "cookie" && /* @__PURE__ */ i(
1524
- "div",
1525
- {
1526
- className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10",
1527
- "aria-hidden": !0,
1528
- children: /* @__PURE__ */ i(eo, { className: "h-5 w-5 text-primary" })
1529
- }
1530
- ),
1531
- /* @__PURE__ */ C("div", { className: "flex-1 space-y-2", children: [
1532
- /* @__PURE__ */ i(be, { className: "text-base font-semibold leading-tight", children: t.title }),
1533
- t.description && /* @__PURE__ */ i(ke, { className: "text-sm leading-relaxed", children: t.description })
1534
- ] })
1535
- ] }),
1536
- /* @__PURE__ */ i("div", { className: "flex items-center justify-between rounded-b-xl border-t border-border bg-muted/50 px-6 py-4 sm:px-7", children: a() })
1537
- ]
1538
- }
1539
- )
1540
- ] })
1541
- }
1542
- );
1543
- return /* @__PURE__ */ C(rt.Provider, { value: { dialog: u }, children: [
1544
- e,
1545
- t && /* @__PURE__ */ i(R, { children: t.position === "bottom-left" ? f() : /* @__PURE__ */ i(
1546
- Me,
1547
- {
1548
- open: o,
1549
- onOpenChange: c,
1550
- children: /* @__PURE__ */ C(Qe, { size: t.size ?? "default", children: [
1551
- /* @__PURE__ */ C(Xe, { children: [
1552
- t.mode === "delete" && /* @__PURE__ */ i(et, { className: "bg-destructive/10 text-destructive dark:bg-destructive/20 dark:text-destructive", children: /* @__PURE__ */ i(Xr, {}) }),
1553
- /* @__PURE__ */ i(be, { children: t.title }),
1554
- t.description && /* @__PURE__ */ i(ke, { children: t.description })
1555
- ] }),
1556
- /* @__PURE__ */ i(tt, { children: a() })
1557
- ] })
1558
- }
1559
- ) })
1560
- ] });
1561
- };
1562
- function $e() {
1563
- const { t: e } = Te("cookieConsent"), { config: t } = X(), { settings: r, updateSetting: o } = ie(), { dialog: n } = to(), s = ue(!1), l = ue(!1), d = t?.cookieConsent?.cookies ?? [], v = r?.cookieConsent?.consentedCookieHosts ?? [], p = d.map((j) => j.host), u = d.filter((j) => j.category === "strict_necessary").map((j) => j.host), a = p.some((j) => !v.includes(j)), f = v.length === 0, g = !f && a, k = typeof window < "u" && window.parent === window && d.length > 0 && (f || a), y = e(g ? "titleRenewal" : "title"), Re = e(g ? "descriptionRenewal" : "description"), xe = T(() => {
1564
- o("cookieConsent", {
1565
- acceptedHosts: p,
1566
- consentedCookieHosts: p
1567
- });
1568
- }, [p, o]), Oe = T(() => {
1569
- o("cookieConsent", {
1570
- acceptedHosts: u,
1571
- consentedCookieHosts: p
1572
- });
1573
- }, [u, p, o]), Pe = T(() => {
1574
- s.current = !0, xe();
1575
- }, [xe]), We = T(() => {
1576
- s.current = !0, Oe();
1577
- }, [Oe]), Ue = T(() => {
1578
- s.current = !0, m.openDrawer({ url: `${we.cookiePreferences}?initial=true`, size: "420px" });
1579
- }, []);
1580
- return z(() => {
1581
- if (!k) {
1582
- l.current = !1;
1583
- return;
1584
- }
1585
- l.current || (l.current = !0, m.propagateMessage({ type: "SHELLUI_CLOSE_MODAL", payload: {} }), m.propagateMessage({ type: "SHELLUI_CLOSE_DRAWER", payload: {} }), s.current = !1, n({
1586
- title: y,
1587
- description: Re,
1588
- mode: "okCancel",
1589
- okLabel: e("accept"),
1590
- cancelLabel: e("reject"),
1591
- position: "bottom-left",
1592
- icon: "cookie",
1593
- secondaryButton: {
1594
- label: e("setPreferences"),
1595
- onClick: Ue
1596
- },
1597
- onOk: Pe,
1598
- onCancel: We
1599
- }));
1600
- }, [
1601
- k,
1602
- y,
1603
- Re,
1604
- e,
1605
- Pe,
1606
- We,
1607
- Ue,
1608
- n
1609
- ]), null;
1610
- }
1611
- const oo = "shellui:settings";
1612
- function Ie() {
1613
- if (typeof globalThis > "u") return;
1614
- const t = globalThis.__SHELLUI_CONFIG__;
1615
- if (t != null)
1616
- return typeof t == "string" ? JSON.parse(t) : t;
1617
- }
1618
- function _e() {
1619
- if (typeof window > "u")
1620
- return { acceptedHosts: [], consentedCookieHosts: [] };
1621
- try {
1622
- const e = localStorage.getItem(oo);
1623
- if (!e) return { acceptedHosts: [], consentedCookieHosts: [] };
1624
- const t = JSON.parse(e);
1625
- return {
1626
- acceptedHosts: Array.isArray(t?.cookieConsent?.acceptedHosts) ? t.cookieConsent.acceptedHosts : [],
1627
- consentedCookieHosts: Array.isArray(t?.cookieConsent?.consentedCookieHosts) ? t.cookieConsent.consentedCookieHosts : []
1628
- };
1629
- } catch {
1630
- return { acceptedHosts: [], consentedCookieHosts: [] };
1631
- }
1632
- }
1633
- function no(e) {
1634
- const t = Ie();
1635
- if (!t?.cookieConsent?.cookies?.length || !new Set(t.cookieConsent.cookies.map((n) => n.host)).has(e)) return !0;
1636
- const { acceptedHosts: o } = _e();
1637
- return o.includes(e);
1638
- }
1639
- function io() {
1640
- const e = Ie();
1641
- if (!e?.cookieConsent?.cookies?.length) return !1;
1642
- const { consentedCookieHosts: t } = _e();
1643
- if (t.length === 0) return !0;
1644
- const r = new Set(e.cookieConsent.cookies.map((o) => o.host));
1645
- for (const o of r)
1646
- if (!t.includes(o)) return !0;
1647
- return !1;
1648
- }
1649
- function Io() {
1650
- const e = Ie();
1651
- if (!e?.cookieConsent?.cookies?.length) return [];
1652
- const { consentedCookieHosts: t } = _e(), r = new Set(t);
1653
- return e.cookieConsent.cookies.map((o) => o.host).filter((o) => !r.has(o));
1654
- }
1655
- const so = "shellui:settings";
1656
- let Fe = !1;
1657
- function ao() {
1658
- if (typeof window > "u") return !0;
1659
- if (!no("sentry.io")) return !1;
1660
- try {
1661
- const e = localStorage.getItem(so);
1662
- return e ? JSON.parse(e)?.errorReporting?.enabled !== !1 : !0;
1663
- } catch {
1664
- return !0;
1665
- }
1666
- }
1667
- function lo() {
1668
- if (!ao())
1669
- return;
1670
- const e = globalThis, t = e.__SHELLUI_SENTRY_DSN__;
1671
- !t || typeof t != "string" || import("@sentry/react").then((r) => {
1672
- r.init({
1673
- dsn: t,
1674
- environment: e.__SHELLUI_SENTRY_ENVIRONMENT__ ?? "production",
1675
- release: e.__SHELLUI_SENTRY_RELEASE__
1676
- }), Fe = !0;
1677
- });
1678
- }
1679
- function _o() {
1680
- Fe && import("@sentry/react").then((e) => {
1681
- e.close(), Fe = !1;
1682
- });
1683
- }
1684
- lo();
1685
- const w = Ae("shellcore");
1686
- let h = null, A = !1, S = null, V = null, ce = [], N = !1, de = !1, Z = null, x = !1, oe = !1, ot = typeof window < "u" ? Date.now() : 0;
1687
- const co = 5e3;
1688
- let I = null, O = null, _ = null, P = null, W = null, U = null, B = null;
1689
- function ve(e) {
1690
- if (!e) return !1;
1691
- const t = e;
1692
- return t.__SHELLUI_TAURI__ === !0 ? !0 : !!(t.__TAURI__ ?? t.__TAURI_INTERNALS__);
1693
- }
1694
- function se() {
1695
- if (typeof window > "u") return !1;
1696
- if (ve(window)) return !0;
1697
- try {
1698
- if (window !== window.top && ve(window.top) || window.parent && window.parent !== window && ve(window.parent)) return !0;
1699
- } catch {
1700
- }
1701
- return !1;
1702
- }
1703
- let le = null, je = 0;
1704
- const uo = 5e3;
1705
- async function D() {
1706
- const t = {
1707
- registered: await it(),
1708
- updateAvailable: A
1709
- };
1710
- ce.forEach((r) => r(t));
1711
- }
1712
- async function ye(e) {
1713
- const t = Date.now() - ot;
1714
- if (oe || t < co) {
1715
- console.warn(
1716
- `[Service Worker] NOT disabling - registration in progress or within grace period. Reason: ${e}, isRegistering: ${oe}, timeSinceStart: ${t}ms`
1717
- ), w.warn(
1718
- `Not disabling service worker - registration in progress or within grace period: ${e}`
1719
- );
1720
- return;
1721
- }
1722
- w.error(`Auto-disabling caching due to error: ${e}`);
1723
- try {
1724
- if (await Q(), typeof window < "u") {
1725
- const r = "shellui:settings";
1726
- try {
1727
- const o = localStorage.getItem(r);
1728
- if (o) {
1729
- const n = JSON.parse(o);
1730
- n.serviceWorker?.enabled !== !1 && (n.serviceWorker = { enabled: !1 }, n.caching !== void 0 && delete n.caching, localStorage.setItem(r, JSON.stringify(n)), m.sendMessageToParent({
1731
- type: "SHELLUI_SETTINGS_UPDATED",
1732
- payload: { settings: n }
1733
- }), window.dispatchEvent(
1734
- new CustomEvent("shellui:settings-updated", {
1735
- detail: { settings: n }
1736
- })
1737
- ), m.toast({
1738
- title: "Service Worker Disabled",
1739
- description: `The service worker has been automatically disabled due to an error: ${e}`,
1740
- type: "error",
1741
- duration: 1e4
1742
- }));
1743
- } else {
1744
- const n = {
1745
- serviceWorker: { enabled: !1 }
1746
- };
1747
- localStorage.setItem(r, JSON.stringify(n)), m.toast({
1748
- title: "Service Worker Disabled",
1749
- description: `The service worker has been automatically disabled due to an error: ${e}`,
1750
- type: "error",
1751
- duration: 1e4
1752
- });
1753
- }
1754
- } catch (o) {
1755
- w.error("Failed to disable service worker in settings:", { error: o }), m.toast({
1756
- title: "Service Worker Error",
1757
- description: `Service worker error: ${e}. Please disable it manually in settings.`,
1758
- type: "error",
1759
- duration: 1e4
1760
- });
1761
- }
1762
- }
1763
- } catch (r) {
1764
- w.error("Failed to disable caching automatically:", { error: r });
1765
- }
1766
- }
1767
- async function Ce() {
1768
- const e = Date.now();
1769
- return le && e - je < uo || (le = (async () => {
1770
- try {
1771
- const t = await fetch(`/sw.js?t=${Date.now()}`, {
1772
- method: "GET",
1773
- cache: "no-store",
1774
- headers: {
1775
- "Cache-Control": "no-cache",
1776
- Pragma: "no-cache"
1777
- }
1778
- });
1779
- if (t.status >= 500)
1780
- return console.warn(
1781
- `[Service Worker] Server error (${t.status}) when fetching service worker - not disabling`
1782
- ), w.warn(
1783
- `Server error (${t.status}) when fetching service worker - not disabling to avoid false positives`
1784
- ), !1;
1785
- if (!t.ok || t.status === 404)
1786
- return !1;
1787
- const r = t.headers.get("content-type") || "", o = r.includes("javascript") || r.includes("application/javascript") || r.includes("text/javascript");
1788
- if (r.includes("text/html"))
1789
- return !1;
1790
- const n = await t.text(), s = n.includes("workbox") || n.includes("precache") || n.includes("serviceWorker") || n.includes("self.addEventListener");
1791
- return !o && !s ? (console.warn("[Service Worker] File does not look like a service worker - not disabling"), w.warn(
1792
- "Service worker file appears to be invalid or corrupted - not disabling to avoid false positives"
1793
- ), !1) : o || s;
1794
- } catch (t) {
1795
- return t instanceof TypeError && t.message.includes("Failed to fetch") ? (console.warn("[Service Worker] Network error when checking file existence - not disabling"), !1) : (console.warn("[Service Worker] Error checking file existence - not disabling:", t), w.warn(
1796
- "Network error checking service worker file - not disabling to avoid false positives",
1797
- { error: t }
1798
- ), !1);
1799
- }
1800
- })(), je = e), le;
1801
- }
1802
- async function nt(e = { enabled: !0 }) {
1803
- if (!("serviceWorker" in navigator))
1804
- return;
1805
- if (se()) {
1806
- await Q(), h = null;
1807
- return;
1808
- }
1809
- if (!e.enabled) {
1810
- await Q(), h = null;
1811
- return;
1812
- }
1813
- if (!await Ce()) {
1814
- V || setTimeout(async () => {
1815
- const r = await Ce();
1816
- r && !V ? nt(e) : r || w.warn("Service worker file not found. Service workers may not be available.");
1817
- }, 1e3);
1818
- return;
1819
- }
1820
- return V || (V = (async () => {
1821
- oe = !0, ot = Date.now();
1822
- try {
1823
- const r = await navigator.serviceWorker.getRegistration();
1824
- if (r?.waiting && !r.installing) {
1825
- console.info(
1826
- "[Service Worker] Waiting service worker found on page load - automatically activating"
1827
- ), w.info(
1828
- "Waiting service worker found on page load - automatically activating since user refreshed"
1829
- );
1830
- const l = r.waiting;
1831
- S = l, typeof window < "u" && sessionStorage.setItem("shellui:service-worker:auto-activated", "true");
1832
- try {
1833
- l.postMessage({ type: "SKIP_WAITING" }), console.info(
1834
- "[Service Worker] Sent SKIP_WAITING to waiting service worker - will reload when it takes control"
1835
- );
1836
- } catch (c) {
1837
- w.error("Failed to activate waiting service worker:", { error: c }), typeof window < "u" && sessionStorage.removeItem("shellui:service-worker:auto-activated");
1838
- }
1839
- }
1840
- if (r && h) {
1841
- N = !1, h.update();
1842
- return;
1843
- }
1844
- N = !navigator.serviceWorker.controller;
1845
- const o = !h;
1846
- if (h || (h = new ht("/sw.js", {
1847
- type: "classic",
1848
- updateViaCache: "none"
1849
- // Always check network for service worker updates
1850
- })), h && (I && (h.removeEventListener("waiting", I), I = null), O && (h.removeEventListener("activated", O), O = null), _ && (h.removeEventListener("controlling", _), _ = null), P && (h.removeEventListener("registered", P), P = null), W && (h.removeEventListener("redundant", W), W = null), U && (navigator.serviceWorker.removeEventListener("error", U), U = null), B && (navigator.serviceWorker.removeEventListener("messageerror", B), B = null), de = !1), o && !de) {
1851
- de = !0;
1852
- const l = "shellui:update-available";
1853
- I = async () => {
1854
- try {
1855
- const c = typeof window < "u" && sessionStorage.getItem("shellui:service-worker:auto-activated") === "true", d = await navigator.serviceWorker.getRegistration();
1856
- if (!d || !d.waiting)
1857
- return;
1858
- const v = d.waiting, p = v.scriptURL;
1859
- if (c) {
1860
- console.info(
1861
- "[Service Worker] Waiting event fired during auto-activation - skipping toast"
1862
- ), A = !0, S = v, D();
1863
- return;
1864
- }
1865
- if (Z === p) {
1866
- A = !0, S = v, D();
1867
- return;
1868
- }
1869
- if (Z = p, A = !0, S = v, D(), e.onUpdateAvailable)
1870
- e.onUpdateAvailable();
1871
- else {
1872
- const u = () => {
1873
- w.info("Install Now clicked, updating service worker..."), S ? Ve().catch((a) => {
1874
- w.error("Failed to update service worker:", { error: a });
1875
- }) : (w.warn("Install Now clicked but no waiting service worker found"), navigator.serviceWorker.getRegistration().then((a) => {
1876
- a?.waiting && (S = a.waiting, Ve().catch((f) => {
1877
- w.error("Failed to update service worker:", { error: f });
1878
- }));
1879
- }));
1880
- };
1881
- m.toast({
1882
- id: l,
1883
- // Use consistent ID to prevent duplicates
1884
- title: "New version available",
1885
- description: "A new version of the app is available. Install now or later?",
1886
- type: "info",
1887
- duration: 0,
1888
- // Don't auto-dismiss
1889
- position: "bottom-left",
1890
- action: {
1891
- label: "Install Now",
1892
- onClick: u
1893
- // Use the handler function
1894
- },
1895
- cancel: {
1896
- label: "Later",
1897
- onClick: () => {
1898
- }
1899
- }
1900
- });
1901
- }
1902
- } catch (c) {
1903
- w.error("Error in waiting handler:", { error: c }), Z = null;
1904
- }
1905
- }, h.addEventListener("waiting", I), O = (c) => {
1906
- const d = c ?? {};
1907
- console.info("[Service Worker] Service worker activated:", {
1908
- isUpdate: d.isUpdate,
1909
- isInitialRegistration: N
1910
- }), D(), A = !1, S = null, Z = null;
1911
- const v = typeof window < "u" && sessionStorage.getItem("shellui:service-worker:intentional-update") === "true", p = x || v;
1912
- typeof window < "u" && sessionStorage.removeItem("shellui:service-worker:intentional-update"), d.isUpdate && !N && p ? (console.info("[Service Worker] Reloading page after intentional update"), window.location.reload()) : d.isUpdate && !N && !p && console.info(
1913
- "[Service Worker] Service worker auto-activated on page load - new version is now active"
1914
- ), N = !1;
1915
- }, h.addEventListener("activated", O), _ = () => {
1916
- D();
1917
- const c = typeof window < "u" && sessionStorage.getItem("shellui:service-worker:auto-activated") === "true", d = typeof window < "u" && sessionStorage.getItem("shellui:service-worker:intentional-update") === "true", v = x || d || c;
1918
- c && typeof window < "u" && sessionStorage.removeItem("shellui:service-worker:auto-activated"), !N && v && (console.info(
1919
- c ? "[Service Worker] Auto-activated service worker took control - reloading to use new version" : "[Service Worker] User clicked Install Now - reloading to use new version"
1920
- ), window.location.reload()), N = !1;
1921
- }, h.addEventListener("controlling", _), P = () => {
1922
- D();
1923
- }, h.addEventListener("registered", P), W = (c) => {
1924
- w.info("Service worker became redundant:", c);
1925
- const d = typeof window < "u" && sessionStorage.getItem("shellui:service-worker:intentional-update") === "true";
1926
- x || d || !!S ? (console.info(
1927
- "[Service Worker] Redundant event: Intentional update detected - ignoring"
1928
- ), w.info(
1929
- "Service worker became redundant as part of normal update - this is expected and safe"
1930
- )) : navigator.serviceWorker.getRegistration().then((u) => {
1931
- const a = !!u?.waiting, f = !!u?.installing, g = !!u?.active;
1932
- !a && !f && !g ? (console.warn(
1933
- "[Service Worker] Redundant event: No service workers found, disabling"
1934
- ), w.warn(
1935
- "Service worker became redundant unexpectedly (no service workers found)"
1936
- ), ye(
1937
- "Service worker became redundant (no service workers found)"
1938
- )) : (console.info(
1939
- "[Service Worker] Redundant event: Service workers exist, likely update in progress - ignoring"
1940
- ), w.info(
1941
- "Service worker became redundant but other service workers exist - likely update in progress, ignoring"
1942
- ));
1943
- }).catch((u) => {
1944
- console.warn(
1945
- "[Service Worker] Redundant event: Async check failed, but NOT disabling:",
1946
- u
1947
- ), w.warn(
1948
- "Service worker redundant event: Async check failed, but NOT disabling to avoid false positives",
1949
- { error: u }
1950
- );
1951
- });
1952
- }, h.addEventListener("redundant", W), U = (c) => {
1953
- w.error("Service worker error event:", c);
1954
- const d = typeof window < "u" && sessionStorage.getItem("shellui:service-worker:intentional-update") === "true";
1955
- if (x || d)
1956
- console.info("[Service Worker] Error during update flow, ignoring"), w.info("Service worker error during update flow, ignoring");
1957
- else {
1958
- const p = c ?? {}, u = p.error, a = p.message || u?.message || "Unknown error", f = u?.name || "";
1959
- !a.includes("update") && !a.includes("activate") && !a.includes("install") && !f.includes("AbortError") && !f.includes("NetworkError") ? ye(`Service worker error: ${a}`) : (console.warn("[Service Worker] Non-critical error, ignoring:", a), w.warn("Service worker non-critical error, not disabling:", {
1960
- errorMessage: a,
1961
- errorName: f
1962
- }));
1963
- }
1964
- }, navigator.serviceWorker.addEventListener("error", U), B = (c) => {
1965
- w.error("Service worker message error:", c);
1966
- }, navigator.serviceWorker.addEventListener("messageerror", B);
1967
- }
1968
- await h.register();
1969
- const n = await navigator.serviceWorker.getRegistration();
1970
- if (n && n.waiting && I) {
1971
- const l = n.waiting.scriptURL;
1972
- S === n.waiting && A === !0 ? (A = !0, S = n.waiting, D()) : Z !== l ? (A = !0, S = n.waiting, I()) : (A = !0, S = n.waiting, D());
1973
- }
1974
- D(), setInterval(
1975
- () => {
1976
- h && e.enabled && h.update();
1977
- },
1978
- 3600 * 1e3
1979
- );
1980
- let s = null;
1981
- typeof document < "u" && (s = () => {
1982
- !document.hidden && h && e.enabled && h.update();
1983
- }, document.addEventListener("visibilitychange", s)), oe = !1;
1984
- } catch (r) {
1985
- const o = r instanceof Error ? r.message : String(r), n = r instanceof Error ? r.name : "";
1986
- w.error("Registration failed:", { error: r }), o.includes("Failed to register") && !o.includes("already registered") || o.includes("script error") && !o.includes("network") || o.includes("SyntaxError") || o.includes("TypeError") && !o.includes("fetch") || r instanceof DOMException && r.name !== "SecurityError" && r.name !== "AbortError" ? await ye(`Registration failed: ${o}`) : (console.warn(
1987
- "[Service Worker] Non-critical registration error, NOT disabling:",
1988
- o
1989
- ), w.warn("Non-critical registration error, not disabling:", { errorMessage: o, errorName: n }));
1990
- } finally {
1991
- oe = !1, V = null;
1992
- }
1993
- })(), V);
1994
- }
1995
- async function Ve() {
1996
- if (!(!h || !S))
1997
- try {
1998
- if (typeof window < "u" && sessionStorage.setItem("shellui:service-worker:intentional-update", "true"), x = !0, typeof window < "u") {
1999
- const o = "shellui:settings";
2000
- try {
2001
- const n = localStorage.getItem(o);
2002
- if (n) {
2003
- const s = JSON.parse(n);
2004
- s.serviceWorker = { enabled: !0 }, localStorage.setItem(o, JSON.stringify(s)), m.sendMessageToParent({
2005
- type: "SHELLUI_SETTINGS_UPDATED",
2006
- payload: { settings: s }
2007
- });
2008
- } else {
2009
- const s = {
2010
- serviceWorker: { enabled: !0 }
2011
- };
2012
- localStorage.setItem(o, JSON.stringify(s));
2013
- }
2014
- } catch (n) {
2015
- w.warn("Failed to preserve settings before update:", { error: n });
2016
- }
2017
- }
2018
- N = !1;
2019
- const t = () => {
2020
- m.sendMessageToParent({
2021
- type: "SHELLUI_REFRESH_PAGE",
2022
- payload: {}
2023
- }) || window.location.reload();
2024
- }, r = () => {
2025
- t(), h?.removeEventListener("controlling", r), setTimeout(() => {
2026
- x = !1;
2027
- }, 1e3);
2028
- };
2029
- h.addEventListener("controlling", r), S.postMessage({ type: "SKIP_WAITING" }), setTimeout(() => {
2030
- _ && h?.removeEventListener("controlling", _), navigator.serviceWorker.controller && t(), setTimeout(() => {
2031
- x = !1;
2032
- }, 1e3);
2033
- }, 2e3);
2034
- } catch (e) {
2035
- w.error("Failed to update service worker:", { error: e }), x = !1;
2036
- }
2037
- }
2038
- async function Q() {
2039
- if ("serviceWorker" in navigator)
2040
- try {
2041
- N = !0;
2042
- const e = await navigator.serviceWorker.getRegistration();
2043
- if (e && (await e.unregister(), "caches" in window)) {
2044
- const t = await caches.keys();
2045
- await Promise.all(t.map((r) => caches.delete(r)));
2046
- }
2047
- h && (I && h.removeEventListener("waiting", I), O && h.removeEventListener("activated", O), _ && h.removeEventListener("controlling", _), P && h.removeEventListener("registered", P), W && h.removeEventListener("redundant", W), U && navigator.serviceWorker.removeEventListener("error", U), B && navigator.serviceWorker.removeEventListener("messageerror", B), I = null, O = null, _ = null, P = null, W = null, U = null, B = null, h = null), A = !1, S = null, N = !1, Z = null, de = !1, x = !1, D();
2048
- } catch (e) {
2049
- w.error("Failed to unregister service worker:", { error: e }), N = !1;
2050
- }
2051
- }
2052
- async function it() {
2053
- if (!("serviceWorker" in navigator) || se() || !await Ce())
2054
- return !1;
2055
- try {
2056
- const t = await navigator.serviceWorker.getRegistration();
2057
- return t ? !!(t.active || t.waiting || t.installing || navigator.serviceWorker.controller) : !1;
2058
- } catch {
2059
- return !1;
2060
- }
2061
- }
2062
- async function Ro() {
2063
- const e = await it();
2064
- let t = !1;
2065
- if (e && !se())
2066
- try {
2067
- const r = await navigator.serviceWorker.getRegistration();
2068
- r?.waiting ? (t = !0, A = !0, S = r.waiting) : (t = !1, A = !1, S = null);
2069
- } catch (r) {
2070
- w.error("Failed to check service worker registration:", { error: r }), t = A;
2071
- }
2072
- else
2073
- t = !1, A = !1, S = null;
2074
- return {
2075
- registered: e,
2076
- updateAvailable: t
2077
- };
2078
- }
2079
- async function xo() {
2080
- se() || !h || await h.update();
2081
- }
2082
- function Oo(e) {
2083
- return ce.push(e), () => {
2084
- ce = ce.filter((t) => t !== e);
2085
- };
2086
- }
2087
- const po = () => {
2088
- const { config: e } = X(), { settings: t } = ie();
2089
- z(() => {
2090
- if (e?.favicon) {
2091
- const o = document.querySelector('link[rel="icon"]');
2092
- o && (o.href = e.favicon);
2093
- }
2094
- }, [e?.favicon]), z(() => {
2095
- if (se()) {
2096
- Q();
2097
- return;
2098
- }
2099
- const o = t?.serviceWorker?.enabled ?? !0;
2100
- if (!e?.navigation || e.navigation.length === 0) {
2101
- o && (console.warn("[Service Worker] Disabled: No navigation items configured"), Q());
2102
- return;
2103
- }
2104
- o ? nt({
2105
- enabled: !0
2106
- }) : Q();
2107
- }, [t?.serviceWorker?.enabled, e?.navigation]);
2108
- const r = Ee(() => e ? Wt(e) : null, [e]);
2109
- return !e.navigation || e.navigation.length === 0 ? /* @__PURE__ */ C(R, { children: [
2110
- /* @__PURE__ */ i($e, {}),
2111
- /* @__PURE__ */ C("div", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" }, children: [
2112
- /* @__PURE__ */ i("h1", { children: e.title || "ShellUI" }),
2113
- /* @__PURE__ */ i("p", { children: "No navigation items configured." })
2114
- ] })
2115
- ] }) : r ? /* @__PURE__ */ C(R, { children: [
2116
- /* @__PURE__ */ i($e, {}),
2117
- /* @__PURE__ */ i(ut, { router: r })
2118
- ] }) : null;
2119
- }, Po = () => {
2120
- const [e, t] = ne(!0);
2121
- return Ge(() => {
2122
- m.init().then(() => {
2123
- t(!1);
2124
- });
2125
- }, []), e ? null : /* @__PURE__ */ i(vt, { children: /* @__PURE__ */ i(Ht, { children: /* @__PURE__ */ i(Kt, { children: /* @__PURE__ */ i(Jr, { children: /* @__PURE__ */ i(ro, { children: /* @__PURE__ */ i(po, {}) }) }) }) }) });
2126
- };
2127
- function Wo(e) {
2128
- const { config: t } = X(), { settings: r } = ie();
2129
- return Ee(() => {
2130
- const n = t?.cookieConsent?.cookies ?? [], s = r?.cookieConsent?.acceptedHosts ?? [];
2131
- if (!n.length)
2132
- return { isAccepted: !0, needsConsent: !1 };
2133
- if (!new Set(n.map((v) => v.host)).has(e))
2134
- return { isAccepted: !0, needsConsent: !1 };
2135
- const c = s.includes(e), d = s.length === 0 || io();
2136
- return { isAccepted: c, needsConsent: d };
2137
- }, [t?.cookieConsent, r?.cookieConsent?.acceptedHosts, e]);
2138
- }
2139
- export {
2140
- Po as A,
2141
- H as B,
2142
- fe as Z,
2143
- ie as a,
2144
- Dt as b,
2145
- $ as c,
2146
- To as d,
2147
- jt as e,
2148
- Ao as f,
2149
- No as g,
2150
- Do as h,
2151
- se as i,
2152
- Oo as j,
2153
- Ve as k,
2154
- Ro as l,
2155
- xo as m,
2156
- lo as n,
2157
- _o as o,
2158
- Ce as p,
2159
- it as q,
2160
- Eo as r,
2161
- Lo as s,
2162
- no as t,
2163
- X as u,
2164
- io as v,
2165
- Io as w,
2166
- Wo as x
2167
- };
2168
- //# sourceMappingURL=index-CfvdAI_Y.js.map