@fde-desktop/fde-core 0.3.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +419 -68
  2. package/dist/CalendarApp-CHLUCAI7.css +744 -0
  3. package/dist/CalendarApp-K7ZOUZ6C.js +2 -0
  4. package/dist/CalendarApp-OTGEERSS.cjs +8 -0
  5. package/dist/CodeServerApp-5KZGO7HL.css +75 -0
  6. package/dist/CodeServerApp-LUZFCQBI.js +3 -0
  7. package/dist/CodeServerApp-P3TMJPLY.cjs +9 -0
  8. package/dist/CreateItemApp-NAZMXOPK.cjs +14 -0
  9. package/dist/CreateItemApp-PQB5GTFG.css +107 -0
  10. package/dist/CreateItemApp-ZHCTSPQE.js +8 -0
  11. package/dist/DeviceInfoApp-R6YNVIGX.cjs +11 -0
  12. package/dist/DeviceInfoApp-YHCYAO6N.js +5 -0
  13. package/dist/DeviceInfoApp-ZSMRSITP.css +7 -0
  14. package/dist/FilesApp-AKCVRTXR.js +8 -0
  15. package/dist/FilesApp-E6L5W3T2.css +1817 -0
  16. package/dist/FilesApp-RW3Y6ILO.cjs +14 -0
  17. package/dist/ImageViewerApp-5UXNSW2O.js +11 -0
  18. package/dist/ImageViewerApp-N2Q7E7WZ.css +215 -0
  19. package/dist/ImageViewerApp-RRRRKSFN.cjs +17 -0
  20. package/dist/ImageViewerMenuBar-I3TFKQPS.cjs +14 -0
  21. package/dist/ImageViewerMenuBar-TV5C6TM2.js +5 -0
  22. package/dist/ImageViewerMenuBar-XLK4LIHW.css +56 -0
  23. package/dist/MenuEditApp-HUZRFEHE.js +9 -0
  24. package/dist/MenuEditApp-MCUHGTKQ.cjs +15 -0
  25. package/dist/MenuEditApp-YA6HSAMJ.css +94 -0
  26. package/dist/MenuEditMenuBar-7VHMZNRM.css +56 -0
  27. package/dist/MenuEditMenuBar-GF6L4PGZ.cjs +15 -0
  28. package/dist/MenuEditMenuBar-IUXFPZE5.js +6 -0
  29. package/dist/NotesApp-37BV33C6.js +10 -0
  30. package/dist/NotesApp-4EVUQEFZ.cjs +16 -0
  31. package/dist/NotesApp-TQ6IHDNX.css +302 -0
  32. package/dist/NotesMenuBar-25LKN3SE.cjs +15 -0
  33. package/dist/NotesMenuBar-MXLOX7OT.css +56 -0
  34. package/dist/NotesMenuBar-SRV3AIAL.js +6 -0
  35. package/dist/PdfApp-5VBDNRMC.cjs +16 -0
  36. package/dist/PdfApp-BUIC5U5H.css +206 -0
  37. package/dist/PdfApp-RH6MZZX5.js +10 -0
  38. package/dist/PdfMenuBar-NLZC6JHS.js +4 -0
  39. package/dist/PdfMenuBar-QUM72EE4.css +56 -0
  40. package/dist/PdfMenuBar-WBRTKMLN.cjs +13 -0
  41. package/dist/SettingsApp-5LDHEHYV.cjs +20 -0
  42. package/dist/SettingsApp-JVOSEFH3.css +283 -0
  43. package/dist/SettingsApp-X6764D7T.js +14 -0
  44. package/dist/SettingsMenuBar-5CBSSMVM.css +56 -0
  45. package/dist/SettingsMenuBar-VLT6TTCM.js +6 -0
  46. package/dist/SettingsMenuBar-Y5QEXDEO.cjs +15 -0
  47. package/dist/StorybookApp-NQ244BER.css +7 -0
  48. package/dist/StorybookApp-NZDV4X3Y.js +1 -0
  49. package/dist/StorybookApp-VF3KIMU3.cjs +7 -0
  50. package/dist/TerminalApp-CDGWRBFJ.cjs +10 -0
  51. package/dist/TerminalApp-EAATMIMX.css +77 -0
  52. package/dist/TerminalApp-GCKJCM55.js +4 -0
  53. package/dist/TerminalMenuBar-3J26O26Q.css +56 -0
  54. package/dist/TerminalMenuBar-7BH7MGNJ.cjs +14 -0
  55. package/dist/TerminalMenuBar-7JAEQUZ4.js +5 -0
  56. package/dist/UploaderApp-2WYRCUQV.js +10 -0
  57. package/dist/UploaderApp-6KV3TGCT.css +1817 -0
  58. package/dist/UploaderApp-EYFC36PM.cjs +16 -0
  59. package/dist/chunk-2FO445RM.cjs +449 -0
  60. package/dist/chunk-2PSTHGTD.cjs +42 -0
  61. package/dist/chunk-2RQX7QBP.cjs +148 -0
  62. package/dist/chunk-3IICBLEA.js +442 -0
  63. package/dist/chunk-43W6UDUZ.cjs +19 -0
  64. package/dist/chunk-4E45FBAH.js +223 -0
  65. package/dist/chunk-4MCFQPKY.js +444 -0
  66. package/dist/chunk-4OH5RPSQ.cjs +38 -0
  67. package/dist/chunk-4XURSNM4.js +43 -0
  68. package/dist/chunk-4ZCRYHL6.js +407 -0
  69. package/dist/chunk-54PYEQLK.js +283 -0
  70. package/dist/chunk-5C6IQE42.cjs +35 -0
  71. package/dist/chunk-5NOHYJNH.js +84 -0
  72. package/dist/chunk-5PYK5ASL.js +162 -0
  73. package/dist/chunk-5YH6AKEO.js +146 -0
  74. package/dist/chunk-657BJOY5.cjs +324 -0
  75. package/dist/chunk-6QOUYSEE.cjs +2303 -0
  76. package/dist/chunk-7SAFECOJ.js +215 -0
  77. package/dist/chunk-7Y7HB7FB.cjs +53 -0
  78. package/dist/chunk-ABIAPZ6S.cjs +45 -0
  79. package/dist/chunk-AQL372JF.cjs +219 -0
  80. package/dist/chunk-AXDUVZVP.cjs +88 -0
  81. package/dist/chunk-AYFNYHMP.js +541 -0
  82. package/dist/chunk-BDO6B7MZ.cjs +451 -0
  83. package/dist/chunk-BKXEA2BK.cjs +286 -0
  84. package/dist/chunk-BLV47DX2.js +47 -0
  85. package/dist/chunk-BQCD5RAF.cjs +48 -0
  86. package/dist/chunk-BQL3YXMV.js +17429 -0
  87. package/dist/chunk-C6BEZNAM.cjs +45 -0
  88. package/dist/chunk-CFWV2JMR.js +234 -0
  89. package/dist/chunk-CV5PUHAE.cjs +86 -0
  90. package/dist/chunk-D5MVFFID.js +42 -0
  91. package/dist/chunk-D7R55WWT.js +1601 -0
  92. package/dist/chunk-DMNF4CNN.cjs +49 -0
  93. package/dist/chunk-DWP2SYF7.js +55 -0
  94. package/dist/chunk-E55VXNLK.cjs +17498 -0
  95. package/dist/chunk-EAELL43F.js +42 -0
  96. package/dist/chunk-EUQLZW6P.js +48 -0
  97. package/dist/chunk-EX5V2ZTU.js +40 -0
  98. package/dist/chunk-FH4ILMKF.js +38 -0
  99. package/dist/chunk-FRHBM2U7.js +33 -0
  100. package/dist/chunk-FX2TPX3L.cjs +45 -0
  101. package/dist/chunk-GCYD6T52.js +32 -0
  102. package/dist/chunk-GRYCUBJZ.js +9 -0
  103. package/dist/chunk-HWHBSAUC.js +40 -0
  104. package/dist/chunk-ICUE6T7J.cjs +50 -0
  105. package/dist/chunk-IDHP3R4I.js +31 -0
  106. package/dist/chunk-IUOQPOEN.js +2293 -0
  107. package/dist/chunk-J7L2S2GT.cjs +34 -0
  108. package/dist/chunk-JEBKLIMU.cjs +123 -0
  109. package/dist/chunk-KQHICFX3.js +121 -0
  110. package/dist/chunk-LMJE6V4N.cjs +42 -0
  111. package/dist/chunk-MVDGM5Y4.js +68 -0
  112. package/dist/chunk-NVEGEK3N.js +31 -0
  113. package/dist/chunk-NWMSWRUD.js +2236 -0
  114. package/dist/chunk-ODXL6BR3.js +77 -0
  115. package/dist/chunk-OJIDKDKF.js +68 -0
  116. package/dist/chunk-PKPQA5NR.js +15 -0
  117. package/dist/chunk-PNDBLFJW.cjs +50 -0
  118. package/dist/chunk-PYTKNRGM.js +280 -0
  119. package/dist/chunk-Q3WA72BF.cjs +70 -0
  120. package/dist/chunk-QB72BLCJ.cjs +237 -0
  121. package/dist/chunk-QHBBLML3.js +86 -0
  122. package/dist/chunk-RDIDAZ3S.cjs +9 -0
  123. package/dist/chunk-RGJPRXYY.js +48 -0
  124. package/dist/chunk-RQ6OZRUW.cjs +41 -0
  125. package/dist/chunk-SBE4SZAN.cjs +226 -0
  126. package/dist/chunk-SYGUWGWK.cjs +2329 -0
  127. package/dist/chunk-TDZ43MUX.cjs +165 -0
  128. package/dist/chunk-TGWMOHAO.js +17 -0
  129. package/dist/chunk-U4RYIS6Z.cjs +548 -0
  130. package/dist/chunk-UIQCTAVM.cjs +59 -0
  131. package/dist/chunk-XVASHRCE.cjs +70 -0
  132. package/dist/chunk-XYSMVQQD.cjs +1608 -0
  133. package/dist/chunk-YAIWI4Z5.js +7 -0
  134. package/dist/chunk-YP2PLNOF.cjs +34 -0
  135. package/dist/chunk-YSOLW4FS.cjs +11 -0
  136. package/dist/chunk-YY6OUR2U.js +44 -0
  137. package/dist/chunk-YZWS7FDT.cjs +409 -0
  138. package/dist/chunk-Z5YGWL65.cjs +39 -0
  139. package/dist/chunk-ZBGWYTCU.cjs +83 -0
  140. package/dist/chunk-ZHB5Q2M6.js +36 -0
  141. package/dist/chunk-ZHNDXNL4.js +45 -0
  142. package/dist/chunk-ZX3EDZ5C.cjs +17 -0
  143. package/dist/index.cjs +4405 -5156
  144. package/dist/index.css +9192 -0
  145. package/dist/index.d.cts +1324 -762
  146. package/dist/index.d.ts +1324 -762
  147. package/dist/index.js +3648 -5038
  148. package/package.json +14 -6
@@ -0,0 +1,2329 @@
1
+ 'use strict';
2
+
3
+ var chunkLMJE6V4N_cjs = require('./chunk-LMJE6V4N.cjs');
4
+ var chunkYP2PLNOF_cjs = require('./chunk-YP2PLNOF.cjs');
5
+ var chunkICUE6T7J_cjs = require('./chunk-ICUE6T7J.cjs');
6
+ var chunkZX3EDZ5C_cjs = require('./chunk-ZX3EDZ5C.cjs');
7
+ var chunkJ7L2S2GT_cjs = require('./chunk-J7L2S2GT.cjs');
8
+ var chunkZBGWYTCU_cjs = require('./chunk-ZBGWYTCU.cjs');
9
+ var chunk2PSTHGTD_cjs = require('./chunk-2PSTHGTD.cjs');
10
+ var chunkBDO6B7MZ_cjs = require('./chunk-BDO6B7MZ.cjs');
11
+ var chunk6QOUYSEE_cjs = require('./chunk-6QOUYSEE.cjs');
12
+ var chunkZ5YGWL65_cjs = require('./chunk-Z5YGWL65.cjs');
13
+ var chunkE55VXNLK_cjs = require('./chunk-E55VXNLK.cjs');
14
+ var React5 = require('react');
15
+ var reactI18next = require('react-i18next');
16
+ var zustand = require('zustand');
17
+ var middleware = require('zustand/middleware');
18
+ var jsxRuntime = require('react/jsx-runtime');
19
+
20
+ function _interopNamespace(e) {
21
+ if (e && e.__esModule) return e;
22
+ var n = Object.create(null);
23
+ if (e) {
24
+ Object.keys(e).forEach(function (k) {
25
+ if (k !== 'default') {
26
+ var d = Object.getOwnPropertyDescriptor(e, k);
27
+ Object.defineProperty(n, k, d.get ? d : {
28
+ enumerable: true,
29
+ get: function () { return e[k]; }
30
+ });
31
+ }
32
+ });
33
+ }
34
+ n.default = e;
35
+ return Object.freeze(n);
36
+ }
37
+
38
+ var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
39
+
40
+ // src/infrastructure/adapters/DefaultThemeProvider.ts
41
+ var DEFAULT_FDE_THEME_LIGHT = {
42
+ mode: "light",
43
+ colors: {
44
+ desktop: "#f0f4f8",
45
+ taskbar: "rgba(255, 255, 255, 0.9)",
46
+ window: "#ffffff",
47
+ accent: "#339af0"
48
+ },
49
+ window: {
50
+ borderRadius: "8px",
51
+ headerHeight: 40,
52
+ minWidth: 400,
53
+ minHeight: 300,
54
+ defaultWidth: 800,
55
+ defaultHeight: 600,
56
+ shadow: "0 8px 32px rgba(0, 0, 0, 0.2)"
57
+ },
58
+ taskbar: {
59
+ height: 48,
60
+ position: "bottom",
61
+ background: "rgba(0, 0, 0, 0.8)",
62
+ blur: true
63
+ },
64
+ desktop: {
65
+ background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
66
+ iconSize: 64,
67
+ iconSpacing: 16
68
+ }
69
+ };
70
+ var DEFAULT_FDE_THEME_DARK = {
71
+ mode: "dark",
72
+ colors: {
73
+ desktop: "#1a1b1e",
74
+ taskbar: "rgba(26, 27, 30, 0.9)",
75
+ window: "#25262b",
76
+ accent: "#4dabf7"
77
+ },
78
+ window: {
79
+ borderRadius: "8px",
80
+ headerHeight: 40,
81
+ minWidth: 400,
82
+ minHeight: 300,
83
+ defaultWidth: 800,
84
+ defaultHeight: 600,
85
+ shadow: "0 8px 32px rgba(0, 0, 0, 0.2)"
86
+ },
87
+ taskbar: {
88
+ height: 48,
89
+ position: "bottom",
90
+ background: "rgba(0, 0, 0, 0.8)",
91
+ blur: true
92
+ },
93
+ desktop: {
94
+ background: "linear-gradient(135deg, #1a1b1e 0%, #2d1f3d 100%)",
95
+ iconSize: 64,
96
+ iconSpacing: 16
97
+ }
98
+ };
99
+ var DefaultThemeProvider = class {
100
+ mode;
101
+ customColors = null;
102
+ constructor(initialMode = "light") {
103
+ this.mode = initialMode;
104
+ }
105
+ getTheme() {
106
+ const base = this.mode === "light" ? DEFAULT_FDE_THEME_LIGHT : DEFAULT_FDE_THEME_DARK;
107
+ if (!this.customColors) return base;
108
+ return {
109
+ ...base,
110
+ colors: {
111
+ ...base.colors,
112
+ taskbar: this.customColors.taskbar,
113
+ window: this.customColors.window,
114
+ accent: this.customColors.accent
115
+ }
116
+ };
117
+ }
118
+ setMode(mode) {
119
+ this.mode = mode;
120
+ }
121
+ setCustomColors(colors) {
122
+ this.customColors = colors;
123
+ }
124
+ toggle() {
125
+ this.mode = this.mode === "light" ? "dark" : "light";
126
+ }
127
+ };
128
+
129
+ // src/stores/settingsStore.ts
130
+ var SUPPORTED_LANGUAGES = ["en", "es"];
131
+ var DEFAULT_LANGUAGE = "en";
132
+ var getPersistedThemeMode = () => {
133
+ try {
134
+ const newKey = localStorage.getItem("fde-desktop:settings");
135
+ const legacyKey = localStorage.getItem("fran-desktop:settings");
136
+ const stored = newKey ?? legacyKey;
137
+ return JSON.parse(stored ?? "{}")?.state?.theme?.mode ?? null;
138
+ } catch {
139
+ return null;
140
+ }
141
+ };
142
+ var persistedMode = getPersistedThemeMode();
143
+ var detectBrowserLanguage = () => {
144
+ if (typeof navigator === "undefined" || !navigator.language) {
145
+ return DEFAULT_LANGUAGE;
146
+ }
147
+ const browserLang = navigator.language.split("-")[0];
148
+ if (SUPPORTED_LANGUAGES.includes(browserLang)) {
149
+ return browserLang;
150
+ }
151
+ return DEFAULT_LANGUAGE;
152
+ };
153
+ var persistedLanguage = (() => {
154
+ try {
155
+ const newKey = localStorage.getItem("fde-desktop:settings");
156
+ const legacyKey = localStorage.getItem("fran-desktop:settings");
157
+ const storedState = JSON.parse(newKey ?? legacyKey ?? "{}")?.state?.language;
158
+ if (storedState && SUPPORTED_LANGUAGES.includes(storedState)) {
159
+ return storedState;
160
+ }
161
+ return detectBrowserLanguage();
162
+ } catch {
163
+ return detectBrowserLanguage();
164
+ }
165
+ })();
166
+ var themeProvider = new DefaultThemeProvider(persistedMode ?? "light");
167
+ var useSettingsStore = zustand.create()(
168
+ middleware.persist(
169
+ (set) => ({
170
+ wallpaper: null,
171
+ wallpaperModule: "default",
172
+ launcherIcon: "FcElectronics",
173
+ font: "system-ui",
174
+ downloadedFonts: [],
175
+ fontSize: 14,
176
+ animationDuration: 0.3,
177
+ theme: themeProvider.getTheme(),
178
+ themeSetManually: persistedMode !== null,
179
+ customThemeColors: null,
180
+ language: persistedLanguage,
181
+ setWallpaper: (url) => set({ wallpaper: url }),
182
+ setWallpaperModule: (module) => set({ wallpaperModule: module }),
183
+ setLauncherIcon: (icon) => set({ launcherIcon: icon }),
184
+ setFont: (font) => set({ font }),
185
+ markFontDownloaded: (fontName) => set((state) => ({
186
+ downloadedFonts: state.downloadedFonts.includes(fontName) ? state.downloadedFonts : [...state.downloadedFonts, fontName]
187
+ })),
188
+ setFontSize: (size) => set({ fontSize: size }),
189
+ setAnimationDuration: (duration) => set({ animationDuration: duration }),
190
+ setThemeMode: (mode) => {
191
+ themeProvider.setMode(mode);
192
+ set({ theme: themeProvider.getTheme(), themeSetManually: true });
193
+ },
194
+ toggleTheme: () => {
195
+ themeProvider.toggle();
196
+ set({ theme: themeProvider.getTheme(), themeSetManually: true });
197
+ },
198
+ setThemeAutomatic: () => set({ themeSetManually: false }),
199
+ applySystemTheme: (mode) => {
200
+ themeProvider.setMode(mode);
201
+ set({ theme: themeProvider.getTheme() });
202
+ },
203
+ setCustomThemeColors: (colors) => {
204
+ set({ customThemeColors: colors });
205
+ },
206
+ setLanguage: (lang) => set({ language: lang })
207
+ }),
208
+ {
209
+ name: "fde-desktop:settings",
210
+ storage: middleware.createJSONStorage(() => localStorage)
211
+ }
212
+ )
213
+ );
214
+
215
+ // src/components/Apps/SettingsApp/sections/sectionRegistry.ts
216
+ var SETTINGS_SECTIONS = [
217
+ {
218
+ id: "wallpaper",
219
+ label: "Wallpaper",
220
+ fcIcon: "FcPicture",
221
+ description: "Change the desktop background image."
222
+ },
223
+ {
224
+ id: "appearance",
225
+ label: "Appearance",
226
+ fcIcon: "FcBinoculars",
227
+ description: "Switch between light and dark mode."
228
+ },
229
+ {
230
+ id: "launcher",
231
+ label: "Launcher",
232
+ fcIcon: "FcElectronics",
233
+ description: "Choose the launcher button icon."
234
+ },
235
+ {
236
+ id: "font",
237
+ label: "Font",
238
+ fcIcon: "FcEditImage",
239
+ description: "Select the system font family."
240
+ },
241
+ {
242
+ id: "language",
243
+ label: "Language",
244
+ fcIcon: "FcGlobe",
245
+ description: "Choose your preferred language."
246
+ },
247
+ {
248
+ id: "reset",
249
+ label: "Reset to Default",
250
+ fcIcon: "FcDisclaimer",
251
+ description: "Reset all settings and data to defaults."
252
+ }
253
+ ];
254
+ var SettingsSection = ({ title, description, children }) => /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "md", p: "md", children: [
255
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { fw: 600, size: "lg", children: title }),
256
+ description && /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", children: description }),
257
+ children
258
+ ] });
259
+ var SettingsSection_default = SettingsSection;
260
+ var defaultWallpaperSrc = "/Images/wallpaper.jpg";
261
+ var WallpaperSettings = () => {
262
+ const { t } = reactI18next.useTranslation("settings");
263
+ const wallpaper = useSettingsStore((state) => state.wallpaper);
264
+ const wallpaperModule = useSettingsStore((state) => state.wallpaperModule);
265
+ const setWallpaper = useSettingsStore((state) => state.setWallpaper);
266
+ const setWallpaperModule = useSettingsStore((state) => state.setWallpaperModule);
267
+ const [urlInput, setUrlInput] = React5.useState("");
268
+ const [pickerOpen, setPickerOpen] = React5.useState(false);
269
+ const fileInputRef = React5.useRef(null);
270
+ const resolvedWallpaper = chunkICUE6T7J_cjs.useResolvedUrl(wallpaper ?? void 0);
271
+ const previewSrc = resolvedWallpaper ?? defaultWallpaperSrc;
272
+ const handleFileChange = React5.useCallback(
273
+ (e) => {
274
+ const file = e.target.files?.[0];
275
+ if (!file) return;
276
+ const reader = new FileReader();
277
+ reader.onload = (evt) => {
278
+ const result = evt.target?.result;
279
+ if (typeof result === "string") setWallpaper(result);
280
+ };
281
+ reader.readAsDataURL(file);
282
+ },
283
+ [setWallpaper]
284
+ );
285
+ const handleUrlApply = React5.useCallback(() => {
286
+ const trimmed = urlInput.trim();
287
+ if (trimmed) setWallpaper(trimmed);
288
+ }, [urlInput, setWallpaper]);
289
+ const handleReset = React5.useCallback(() => {
290
+ setWallpaper(null);
291
+ setUrlInput("");
292
+ }, [setWallpaper]);
293
+ const handleFsImageSelect = React5.useCallback(
294
+ (node) => {
295
+ const imageUrl = node.url ? node.url.startsWith("idb://") ? node.url : `${undefined.BASE_URL}${node.url}` : null;
296
+ if (imageUrl) {
297
+ setWallpaper(imageUrl);
298
+ }
299
+ setPickerOpen(false);
300
+ },
301
+ [setWallpaper]
302
+ );
303
+ return /* @__PURE__ */ jsxRuntime.jsxs(SettingsSection_default, { title: t("wallpaper.title"), children: [
304
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
305
+ chunkE55VXNLK_cjs.SegmentedControl,
306
+ {
307
+ value: wallpaperModule,
308
+ onChange: setWallpaperModule,
309
+ data: [{ value: "default", label: t("wallpaper.staticImage") }],
310
+ fullWidth: true
311
+ }
312
+ ) }),
313
+ /* @__PURE__ */ jsxRuntime.jsx(
314
+ "img",
315
+ {
316
+ src: previewSrc,
317
+ alt: t("wallpaper.wallpaperPreview"),
318
+ style: { width: "100%", height: 180, objectFit: "cover", borderRadius: 8 }
319
+ }
320
+ ),
321
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { children: [
322
+ /* @__PURE__ */ jsxRuntime.jsx(
323
+ "input",
324
+ {
325
+ ref: fileInputRef,
326
+ type: "file",
327
+ accept: "image/*",
328
+ style: { display: "none" },
329
+ onChange: handleFileChange,
330
+ "aria-label": t("wallpaper.uploadAria", { defaultValue: "Upload wallpaper file" })
331
+ }
332
+ ),
333
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { variant: "light", onClick: () => setPickerOpen(true), children: t("wallpaper.chooseFromImages") }),
334
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { variant: "light", onClick: () => fileInputRef.current?.click(), children: t("wallpaper.uploadFromDisk") }),
335
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { variant: "subtle", color: "red", onClick: handleReset, children: t("wallpaper.resetToDefault") })
336
+ ] }),
337
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { align: "flex-end", children: [
338
+ /* @__PURE__ */ jsxRuntime.jsx(
339
+ chunkE55VXNLK_cjs.TextInput,
340
+ {
341
+ label: t("wallpaper.orEnterUrl"),
342
+ placeholder: "https://example.com/image.jpg",
343
+ value: urlInput,
344
+ onChange: (e) => setUrlInput(e.currentTarget.value),
345
+ style: { flex: 1 }
346
+ }
347
+ ),
348
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { onClick: handleUrlApply, disabled: !urlInput.trim(), children: t("common:actions.apply") })
349
+ ] }),
350
+ /* @__PURE__ */ jsxRuntime.jsx(
351
+ chunkBDO6B7MZ_cjs.FilePickerModal,
352
+ {
353
+ opened: pickerOpen,
354
+ acceptedMimeTypes: ["image/*"],
355
+ onConfirm: handleFsImageSelect,
356
+ onCancel: () => setPickerOpen(false)
357
+ }
358
+ )
359
+ ] });
360
+ };
361
+ var WallpaperSettings_default = WallpaperSettings;
362
+ var AppearanceSettings = () => {
363
+ const { t } = reactI18next.useTranslation("settings");
364
+ const themeMode = useSettingsStore((state) => state.theme.mode);
365
+ const themeSetManually = useSettingsStore((state) => state.themeSetManually);
366
+ const customThemeColors = useSettingsStore((state) => state.customThemeColors);
367
+ const animationDuration = useSettingsStore((state) => state.animationDuration);
368
+ const setThemeMode = useSettingsStore((state) => state.setThemeMode);
369
+ const setThemeAutomatic = useSettingsStore((state) => state.setThemeAutomatic);
370
+ const setCustomThemeColors = useSettingsStore((state) => state.setCustomThemeColors);
371
+ const setAnimationDuration = useSettingsStore((state) => state.setAnimationDuration);
372
+ const currentValue = customThemeColors ? "custom" : themeSetManually ? themeMode : "system";
373
+ const handleChange = React5.useCallback(
374
+ (value) => {
375
+ if (value === "system") {
376
+ setThemeAutomatic();
377
+ setCustomThemeColors(null);
378
+ } else if (value === "custom") {
379
+ setCustomThemeColors({
380
+ taskbar: "#339af0",
381
+ window: "#ffffff",
382
+ accent: "#339af0"
383
+ });
384
+ } else {
385
+ setThemeMode(value);
386
+ setCustomThemeColors(null);
387
+ }
388
+ },
389
+ [setThemeMode, setThemeAutomatic, setCustomThemeColors]
390
+ );
391
+ const handleColorChange = React5.useCallback(
392
+ (key) => (color) => {
393
+ if (customThemeColors) {
394
+ setCustomThemeColors({ ...customThemeColors, [key]: color });
395
+ }
396
+ },
397
+ [customThemeColors, setCustomThemeColors]
398
+ );
399
+ const handleAnimationChange = React5.useCallback(
400
+ (value) => {
401
+ setAnimationDuration(value);
402
+ },
403
+ [setAnimationDuration]
404
+ );
405
+ const isCustom = currentValue === "custom";
406
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "md", p: "md", children: [
407
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { fw: 600, size: "lg", children: t("appearance.title") }),
408
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", children: t("appearance.description") }),
409
+ /* @__PURE__ */ jsxRuntime.jsx(
410
+ chunkE55VXNLK_cjs.SegmentedControl,
411
+ {
412
+ value: currentValue,
413
+ onChange: handleChange,
414
+ data: [
415
+ { label: t("common:theme.light"), value: "light" },
416
+ { label: t("common:theme.dark"), value: "dark" },
417
+ { label: t("common:theme.system"), value: "system" },
418
+ { label: t("common:theme.custom"), value: "custom" }
419
+ ],
420
+ "aria-label": t("appearance.themeMode", { defaultValue: "Theme mode" })
421
+ }
422
+ ),
423
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "sm", mt: "md", children: [
424
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Box, { children: [
425
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, mb: "xs", c: isCustom ? "dark" : void 0, children: t("appearance.taskbar") }),
426
+ /* @__PURE__ */ jsxRuntime.jsx(
427
+ chunkLMJE6V4N_cjs.ColorPicker_default,
428
+ {
429
+ value: customThemeColors?.taskbar ?? "#339af0",
430
+ onChange: handleColorChange("taskbar"),
431
+ disabled: !isCustom
432
+ }
433
+ )
434
+ ] }),
435
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Box, { children: [
436
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, mb: "xs", c: isCustom ? "dark" : void 0, children: t("appearance.window") }),
437
+ /* @__PURE__ */ jsxRuntime.jsx(
438
+ chunkLMJE6V4N_cjs.ColorPicker_default,
439
+ {
440
+ value: customThemeColors?.window ?? "#ffffff",
441
+ onChange: handleColorChange("window"),
442
+ disabled: !isCustom
443
+ }
444
+ )
445
+ ] }),
446
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Box, { children: [
447
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, mb: "xs", c: isCustom ? "dark" : void 0, children: t("appearance.accent") }),
448
+ /* @__PURE__ */ jsxRuntime.jsx(
449
+ chunkLMJE6V4N_cjs.ColorPicker_default,
450
+ {
451
+ value: customThemeColors?.accent ?? "#339af0",
452
+ onChange: handleColorChange("accent"),
453
+ disabled: !isCustom
454
+ }
455
+ )
456
+ ] })
457
+ ] }),
458
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Box, { mt: "md", children: [
459
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, mb: "xs", children: t("appearance.animationDuration") }),
460
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "xs", c: "dimmed", mb: "sm", children: t("appearance.animationDescription") }),
461
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { align: "center", gap: "md", children: [
462
+ /* @__PURE__ */ jsxRuntime.jsx(
463
+ chunkE55VXNLK_cjs.Slider,
464
+ {
465
+ value: animationDuration,
466
+ onChange: handleAnimationChange,
467
+ min: 0.1,
468
+ max: 1,
469
+ step: 0.1,
470
+ style: { flex: 1 },
471
+ marks: [
472
+ { value: 0.1, label: "0.1s" },
473
+ { value: 0.5, label: "0.5s" },
474
+ { value: 1, label: "1.0s" }
475
+ ],
476
+ "aria-label": t("appearance.animationDuration")
477
+ }
478
+ ),
479
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, style: { minWidth: 40 }, children: [
480
+ animationDuration.toFixed(1),
481
+ "s"
482
+ ] })
483
+ ] })
484
+ ] })
485
+ ] });
486
+ };
487
+ var AppearanceSettings_default = AppearanceSettings;
488
+ var LauncherSettings = () => {
489
+ const launcherIcon = useSettingsStore((state) => state.launcherIcon);
490
+ const setLauncherIcon = useSettingsStore((state) => state.setLauncherIcon);
491
+ const [allIconNames, setAllIconNames] = React5.useState([]);
492
+ const [search, setSearch] = React5.useState("");
493
+ const deferredSearch = React5.useDeferredValue(search);
494
+ React5.useEffect(() => {
495
+ import('react-icons/fc').then((mod) => {
496
+ const names = Object.keys(mod).filter((k) => k.startsWith("Fc")).sort();
497
+ setAllIconNames(names);
498
+ });
499
+ }, []);
500
+ const filtered = deferredSearch ? allIconNames.filter((n) => n.toLowerCase().includes(deferredSearch.toLowerCase())) : allIconNames;
501
+ const handleSelect = React5.useCallback(
502
+ (name) => {
503
+ setLauncherIcon(name);
504
+ },
505
+ [setLauncherIcon]
506
+ );
507
+ return /* @__PURE__ */ jsxRuntime.jsxs(SettingsSection_default, { title: "Launcher Icon", description: `Selected: ${launcherIcon}`, children: [
508
+ /* @__PURE__ */ jsxRuntime.jsx(
509
+ chunkE55VXNLK_cjs.TextInput,
510
+ {
511
+ placeholder: "Search icons...",
512
+ value: search,
513
+ onChange: (e) => setSearch(e.currentTarget.value),
514
+ "aria-label": "Search icons"
515
+ }
516
+ ),
517
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.ScrollArea, { style: { flex: 1, height: 300 }, children: /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.SimpleGrid, { cols: 8, spacing: 4, children: filtered.map((name) => /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Tooltip, { label: name, withArrow: true, openDelay: 400, children: /* @__PURE__ */ jsxRuntime.jsx(
518
+ chunkE55VXNLK_cjs.UnstyledButton,
519
+ {
520
+ onClick: () => handleSelect(name),
521
+ "aria-label": name,
522
+ "aria-pressed": name === launcherIcon,
523
+ style: {
524
+ padding: 6,
525
+ borderRadius: 6,
526
+ background: name === launcherIcon ? "var(--mantine-primary-color-light)" : "transparent",
527
+ display: "flex",
528
+ alignItems: "center",
529
+ justifyContent: "center"
530
+ },
531
+ children: /* @__PURE__ */ jsxRuntime.jsx(chunkJ7L2S2GT_cjs.AppIcon_default, { fcIcon: name, size: 24 })
532
+ }
533
+ ) }, name)) }) })
534
+ ] });
535
+ };
536
+ var LauncherSettings_default = LauncherSettings;
537
+
538
+ // src/constants/Fonts.ts
539
+ var AVAILABLE_FONTS = [
540
+ {
541
+ value: "system-ui",
542
+ label: "System Default",
543
+ stack: "system-ui, Avenir, Helvetica, Arial, sans-serif"
544
+ },
545
+ { value: "Courier New", label: "Courier New", stack: '"Courier New", monospace' },
546
+ { value: "Source Code Pro", label: "Source Code Pro", stack: '"Source Code Pro", monospace' },
547
+ { value: "Open Sans", label: "Open Sans", stack: '"Open Sans", monospace' }
548
+ ];
549
+ var FONT_STACKS = Object.fromEntries(
550
+ AVAILABLE_FONTS.map((f) => [f.value, f.stack])
551
+ );
552
+ var GOOGLE_FONTS_HREF = {
553
+ "Source Code Pro": "https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap",
554
+ "Open Sans": "https://fonts.googleapis.com/css2?family=Open+Sans&display=swap"
555
+ };
556
+
557
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/subscribable.js
558
+ var Subscribable = class {
559
+ constructor() {
560
+ this.listeners = /* @__PURE__ */ new Set();
561
+ this.subscribe = this.subscribe.bind(this);
562
+ }
563
+ subscribe(listener) {
564
+ this.listeners.add(listener);
565
+ this.onSubscribe();
566
+ return () => {
567
+ this.listeners.delete(listener);
568
+ this.onUnsubscribe();
569
+ };
570
+ }
571
+ hasListeners() {
572
+ return this.listeners.size > 0;
573
+ }
574
+ onSubscribe() {
575
+ }
576
+ onUnsubscribe() {
577
+ }
578
+ };
579
+
580
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/focusManager.js
581
+ var FocusManager = class extends Subscribable {
582
+ #focused;
583
+ #cleanup;
584
+ #setup;
585
+ constructor() {
586
+ super();
587
+ this.#setup = (onFocus) => {
588
+ if (typeof window !== "undefined" && window.addEventListener) {
589
+ const listener = () => onFocus();
590
+ window.addEventListener("visibilitychange", listener, false);
591
+ return () => {
592
+ window.removeEventListener("visibilitychange", listener);
593
+ };
594
+ }
595
+ return;
596
+ };
597
+ }
598
+ onSubscribe() {
599
+ if (!this.#cleanup) {
600
+ this.setEventListener(this.#setup);
601
+ }
602
+ }
603
+ onUnsubscribe() {
604
+ if (!this.hasListeners()) {
605
+ this.#cleanup?.();
606
+ this.#cleanup = void 0;
607
+ }
608
+ }
609
+ setEventListener(setup) {
610
+ this.#setup = setup;
611
+ this.#cleanup?.();
612
+ this.#cleanup = setup((focused) => {
613
+ if (typeof focused === "boolean") {
614
+ this.setFocused(focused);
615
+ } else {
616
+ this.onFocus();
617
+ }
618
+ });
619
+ }
620
+ setFocused(focused) {
621
+ const changed = this.#focused !== focused;
622
+ if (changed) {
623
+ this.#focused = focused;
624
+ this.onFocus();
625
+ }
626
+ }
627
+ onFocus() {
628
+ const isFocused = this.isFocused();
629
+ this.listeners.forEach((listener) => {
630
+ listener(isFocused);
631
+ });
632
+ }
633
+ isFocused() {
634
+ if (typeof this.#focused === "boolean") {
635
+ return this.#focused;
636
+ }
637
+ return globalThis.document?.visibilityState !== "hidden";
638
+ }
639
+ };
640
+ var focusManager = new FocusManager();
641
+
642
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
643
+ var defaultTimeoutProvider = {
644
+ // We need the wrapper function syntax below instead of direct references to
645
+ // global setTimeout etc.
646
+ //
647
+ // BAD: `setTimeout: setTimeout`
648
+ // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
649
+ //
650
+ // If we use direct references here, then anything that wants to spy on or
651
+ // replace the global setTimeout (like tests) won't work since we'll already
652
+ // have a hard reference to the original implementation at the time when this
653
+ // file was imported.
654
+ setTimeout: (callback, delay) => setTimeout(callback, delay),
655
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId),
656
+ setInterval: (callback, delay) => setInterval(callback, delay),
657
+ clearInterval: (intervalId) => clearInterval(intervalId)
658
+ };
659
+ var TimeoutManager = class {
660
+ // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
661
+ // type at app boot; and if we leave that type, then any new timer provider
662
+ // would need to support the default provider's concrete timer ID, which is
663
+ // infeasible across environments.
664
+ //
665
+ // We settle for type safety for the TimeoutProvider type, and accept that
666
+ // this class is unsafe internally to allow for extension.
667
+ #provider = defaultTimeoutProvider;
668
+ #providerCalled = false;
669
+ setTimeoutProvider(provider) {
670
+ if (process.env.NODE_ENV !== "production") {
671
+ if (this.#providerCalled && provider !== this.#provider) {
672
+ console.error(
673
+ `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
674
+ { previous: this.#provider, provider }
675
+ );
676
+ }
677
+ }
678
+ this.#provider = provider;
679
+ if (process.env.NODE_ENV !== "production") {
680
+ this.#providerCalled = false;
681
+ }
682
+ }
683
+ setTimeout(callback, delay) {
684
+ if (process.env.NODE_ENV !== "production") {
685
+ this.#providerCalled = true;
686
+ }
687
+ return this.#provider.setTimeout(callback, delay);
688
+ }
689
+ clearTimeout(timeoutId) {
690
+ this.#provider.clearTimeout(timeoutId);
691
+ }
692
+ setInterval(callback, delay) {
693
+ if (process.env.NODE_ENV !== "production") {
694
+ this.#providerCalled = true;
695
+ }
696
+ return this.#provider.setInterval(callback, delay);
697
+ }
698
+ clearInterval(intervalId) {
699
+ this.#provider.clearInterval(intervalId);
700
+ }
701
+ };
702
+ var timeoutManager = new TimeoutManager();
703
+ function systemSetTimeoutZero(callback) {
704
+ setTimeout(callback, 0);
705
+ }
706
+
707
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/utils.js
708
+ var isServer = typeof window === "undefined" || "Deno" in globalThis;
709
+ function noop() {
710
+ }
711
+ function isValidTimeout(value) {
712
+ return typeof value === "number" && value >= 0 && value !== Infinity;
713
+ }
714
+ function timeUntilStale(updatedAt, staleTime) {
715
+ return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
716
+ }
717
+ function resolveStaleTime(staleTime, query) {
718
+ return typeof staleTime === "function" ? staleTime(query) : staleTime;
719
+ }
720
+ function resolveEnabled(enabled, query) {
721
+ return typeof enabled === "function" ? enabled(query) : enabled;
722
+ }
723
+ var hasOwn = Object.prototype.hasOwnProperty;
724
+ function replaceEqualDeep(a, b, depth = 0) {
725
+ if (a === b) {
726
+ return a;
727
+ }
728
+ if (depth > 500) return b;
729
+ const array = isPlainArray(a) && isPlainArray(b);
730
+ if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
731
+ const aItems = array ? a : Object.keys(a);
732
+ const aSize = aItems.length;
733
+ const bItems = array ? b : Object.keys(b);
734
+ const bSize = bItems.length;
735
+ const copy = array ? new Array(bSize) : {};
736
+ let equalItems = 0;
737
+ for (let i = 0; i < bSize; i++) {
738
+ const key = array ? i : bItems[i];
739
+ const aItem = a[key];
740
+ const bItem = b[key];
741
+ if (aItem === bItem) {
742
+ copy[key] = aItem;
743
+ if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
744
+ continue;
745
+ }
746
+ if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
747
+ copy[key] = bItem;
748
+ continue;
749
+ }
750
+ const v = replaceEqualDeep(aItem, bItem, depth + 1);
751
+ copy[key] = v;
752
+ if (v === aItem) equalItems++;
753
+ }
754
+ return aSize === bSize && equalItems === aSize ? a : copy;
755
+ }
756
+ function shallowEqualObjects(a, b) {
757
+ if (!b || Object.keys(a).length !== Object.keys(b).length) {
758
+ return false;
759
+ }
760
+ for (const key in a) {
761
+ if (a[key] !== b[key]) {
762
+ return false;
763
+ }
764
+ }
765
+ return true;
766
+ }
767
+ function isPlainArray(value) {
768
+ return Array.isArray(value) && value.length === Object.keys(value).length;
769
+ }
770
+ function isPlainObject(o) {
771
+ if (!hasObjectPrototype(o)) {
772
+ return false;
773
+ }
774
+ const ctor = o.constructor;
775
+ if (ctor === void 0) {
776
+ return true;
777
+ }
778
+ const prot = ctor.prototype;
779
+ if (!hasObjectPrototype(prot)) {
780
+ return false;
781
+ }
782
+ if (!prot.hasOwnProperty("isPrototypeOf")) {
783
+ return false;
784
+ }
785
+ if (Object.getPrototypeOf(o) !== Object.prototype) {
786
+ return false;
787
+ }
788
+ return true;
789
+ }
790
+ function hasObjectPrototype(o) {
791
+ return Object.prototype.toString.call(o) === "[object Object]";
792
+ }
793
+ function replaceData(prevData, data, options) {
794
+ if (typeof options.structuralSharing === "function") {
795
+ return options.structuralSharing(prevData, data);
796
+ } else if (options.structuralSharing !== false) {
797
+ if (process.env.NODE_ENV !== "production") {
798
+ try {
799
+ return replaceEqualDeep(prevData, data);
800
+ } catch (error) {
801
+ console.error(
802
+ `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
803
+ );
804
+ throw error;
805
+ }
806
+ }
807
+ return replaceEqualDeep(prevData, data);
808
+ }
809
+ return data;
810
+ }
811
+ function shouldThrowError(throwOnError, params) {
812
+ if (typeof throwOnError === "function") {
813
+ return throwOnError(...params);
814
+ }
815
+ return !!throwOnError;
816
+ }
817
+
818
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/environmentManager.js
819
+ var environmentManager = /* @__PURE__ */ (() => {
820
+ let isServerFn = () => isServer;
821
+ return {
822
+ /**
823
+ * Returns whether the current runtime should be treated as a server environment.
824
+ */
825
+ isServer() {
826
+ return isServerFn();
827
+ },
828
+ /**
829
+ * Overrides the server check globally.
830
+ */
831
+ setIsServer(isServerValue) {
832
+ isServerFn = isServerValue;
833
+ }
834
+ };
835
+ })();
836
+
837
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/thenable.js
838
+ function pendingThenable() {
839
+ let resolve;
840
+ let reject;
841
+ const thenable = new Promise((_resolve, _reject) => {
842
+ resolve = _resolve;
843
+ reject = _reject;
844
+ });
845
+ thenable.status = "pending";
846
+ thenable.catch(() => {
847
+ });
848
+ function finalize(data) {
849
+ Object.assign(thenable, data);
850
+ delete thenable.resolve;
851
+ delete thenable.reject;
852
+ }
853
+ thenable.resolve = (value) => {
854
+ finalize({
855
+ status: "fulfilled",
856
+ value
857
+ });
858
+ resolve(value);
859
+ };
860
+ thenable.reject = (reason) => {
861
+ finalize({
862
+ status: "rejected",
863
+ reason
864
+ });
865
+ reject(reason);
866
+ };
867
+ return thenable;
868
+ }
869
+
870
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/notifyManager.js
871
+ var defaultScheduler = systemSetTimeoutZero;
872
+ function createNotifyManager() {
873
+ let queue = [];
874
+ let transactions = 0;
875
+ let notifyFn = (callback) => {
876
+ callback();
877
+ };
878
+ let batchNotifyFn = (callback) => {
879
+ callback();
880
+ };
881
+ let scheduleFn = defaultScheduler;
882
+ const schedule = (callback) => {
883
+ if (transactions) {
884
+ queue.push(callback);
885
+ } else {
886
+ scheduleFn(() => {
887
+ notifyFn(callback);
888
+ });
889
+ }
890
+ };
891
+ const flush = () => {
892
+ const originalQueue = queue;
893
+ queue = [];
894
+ if (originalQueue.length) {
895
+ scheduleFn(() => {
896
+ batchNotifyFn(() => {
897
+ originalQueue.forEach((callback) => {
898
+ notifyFn(callback);
899
+ });
900
+ });
901
+ });
902
+ }
903
+ };
904
+ return {
905
+ batch: (callback) => {
906
+ let result;
907
+ transactions++;
908
+ try {
909
+ result = callback();
910
+ } finally {
911
+ transactions--;
912
+ if (!transactions) {
913
+ flush();
914
+ }
915
+ }
916
+ return result;
917
+ },
918
+ /**
919
+ * All calls to the wrapped function will be batched.
920
+ */
921
+ batchCalls: (callback) => {
922
+ return (...args) => {
923
+ schedule(() => {
924
+ callback(...args);
925
+ });
926
+ };
927
+ },
928
+ schedule,
929
+ /**
930
+ * Use this method to set a custom notify function.
931
+ * This can be used to for example wrap notifications with `React.act` while running tests.
932
+ */
933
+ setNotifyFunction: (fn) => {
934
+ notifyFn = fn;
935
+ },
936
+ /**
937
+ * Use this method to set a custom function to batch notifications together into a single tick.
938
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
939
+ */
940
+ setBatchNotifyFunction: (fn) => {
941
+ batchNotifyFn = fn;
942
+ },
943
+ setScheduler: (fn) => {
944
+ scheduleFn = fn;
945
+ }
946
+ };
947
+ }
948
+ var notifyManager = createNotifyManager();
949
+
950
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/onlineManager.js
951
+ var OnlineManager = class extends Subscribable {
952
+ #online = true;
953
+ #cleanup;
954
+ #setup;
955
+ constructor() {
956
+ super();
957
+ this.#setup = (onOnline) => {
958
+ if (typeof window !== "undefined" && window.addEventListener) {
959
+ const onlineListener = () => onOnline(true);
960
+ const offlineListener = () => onOnline(false);
961
+ window.addEventListener("online", onlineListener, false);
962
+ window.addEventListener("offline", offlineListener, false);
963
+ return () => {
964
+ window.removeEventListener("online", onlineListener);
965
+ window.removeEventListener("offline", offlineListener);
966
+ };
967
+ }
968
+ return;
969
+ };
970
+ }
971
+ onSubscribe() {
972
+ if (!this.#cleanup) {
973
+ this.setEventListener(this.#setup);
974
+ }
975
+ }
976
+ onUnsubscribe() {
977
+ if (!this.hasListeners()) {
978
+ this.#cleanup?.();
979
+ this.#cleanup = void 0;
980
+ }
981
+ }
982
+ setEventListener(setup) {
983
+ this.#setup = setup;
984
+ this.#cleanup?.();
985
+ this.#cleanup = setup(this.setOnline.bind(this));
986
+ }
987
+ setOnline(online) {
988
+ const changed = this.#online !== online;
989
+ if (changed) {
990
+ this.#online = online;
991
+ this.listeners.forEach((listener) => {
992
+ listener(online);
993
+ });
994
+ }
995
+ }
996
+ isOnline() {
997
+ return this.#online;
998
+ }
999
+ };
1000
+ var onlineManager = new OnlineManager();
1001
+
1002
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/retryer.js
1003
+ function canFetch(networkMode) {
1004
+ return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
1005
+ }
1006
+
1007
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/query.js
1008
+ function fetchState(data, options) {
1009
+ return {
1010
+ fetchFailureCount: 0,
1011
+ fetchFailureReason: null,
1012
+ fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
1013
+ ...data === void 0 && {
1014
+ error: null,
1015
+ status: "pending"
1016
+ }
1017
+ };
1018
+ }
1019
+
1020
+ // ../../node_modules/.bun/@tanstack+query-core@5.96.1/node_modules/@tanstack/query-core/build/modern/queryObserver.js
1021
+ var QueryObserver = class extends Subscribable {
1022
+ constructor(client, options) {
1023
+ super();
1024
+ this.options = options;
1025
+ this.#client = client;
1026
+ this.#selectError = null;
1027
+ this.#currentThenable = pendingThenable();
1028
+ this.bindMethods();
1029
+ this.setOptions(options);
1030
+ }
1031
+ #client;
1032
+ #currentQuery = void 0;
1033
+ #currentQueryInitialState = void 0;
1034
+ #currentResult = void 0;
1035
+ #currentResultState;
1036
+ #currentResultOptions;
1037
+ #currentThenable;
1038
+ #selectError;
1039
+ #selectFn;
1040
+ #selectResult;
1041
+ // This property keeps track of the last query with defined data.
1042
+ // It will be used to pass the previous data and query to the placeholder function between renders.
1043
+ #lastQueryWithDefinedData;
1044
+ #staleTimeoutId;
1045
+ #refetchIntervalId;
1046
+ #currentRefetchInterval;
1047
+ #trackedProps = /* @__PURE__ */ new Set();
1048
+ bindMethods() {
1049
+ this.refetch = this.refetch.bind(this);
1050
+ }
1051
+ onSubscribe() {
1052
+ if (this.listeners.size === 1) {
1053
+ this.#currentQuery.addObserver(this);
1054
+ if (shouldFetchOnMount(this.#currentQuery, this.options)) {
1055
+ this.#executeFetch();
1056
+ } else {
1057
+ this.updateResult();
1058
+ }
1059
+ this.#updateTimers();
1060
+ }
1061
+ }
1062
+ onUnsubscribe() {
1063
+ if (!this.hasListeners()) {
1064
+ this.destroy();
1065
+ }
1066
+ }
1067
+ shouldFetchOnReconnect() {
1068
+ return shouldFetchOn(
1069
+ this.#currentQuery,
1070
+ this.options,
1071
+ this.options.refetchOnReconnect
1072
+ );
1073
+ }
1074
+ shouldFetchOnWindowFocus() {
1075
+ return shouldFetchOn(
1076
+ this.#currentQuery,
1077
+ this.options,
1078
+ this.options.refetchOnWindowFocus
1079
+ );
1080
+ }
1081
+ destroy() {
1082
+ this.listeners = /* @__PURE__ */ new Set();
1083
+ this.#clearStaleTimeout();
1084
+ this.#clearRefetchInterval();
1085
+ this.#currentQuery.removeObserver(this);
1086
+ }
1087
+ setOptions(options) {
1088
+ const prevOptions = this.options;
1089
+ const prevQuery = this.#currentQuery;
1090
+ this.options = this.#client.defaultQueryOptions(options);
1091
+ if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") {
1092
+ throw new Error(
1093
+ "Expected enabled to be a boolean or a callback that returns a boolean"
1094
+ );
1095
+ }
1096
+ this.#updateQuery();
1097
+ this.#currentQuery.setOptions(this.options);
1098
+ if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
1099
+ this.#client.getQueryCache().notify({
1100
+ type: "observerOptionsUpdated",
1101
+ query: this.#currentQuery,
1102
+ observer: this
1103
+ });
1104
+ }
1105
+ const mounted = this.hasListeners();
1106
+ if (mounted && shouldFetchOptionally(
1107
+ this.#currentQuery,
1108
+ prevQuery,
1109
+ this.options,
1110
+ prevOptions
1111
+ )) {
1112
+ this.#executeFetch();
1113
+ }
1114
+ this.updateResult();
1115
+ if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
1116
+ this.#updateStaleTimeout();
1117
+ }
1118
+ const nextRefetchInterval = this.#computeRefetchInterval();
1119
+ if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
1120
+ this.#updateRefetchInterval(nextRefetchInterval);
1121
+ }
1122
+ }
1123
+ getOptimisticResult(options) {
1124
+ const query = this.#client.getQueryCache().build(this.#client, options);
1125
+ const result = this.createResult(query, options);
1126
+ if (shouldAssignObserverCurrentProperties(this, result)) {
1127
+ this.#currentResult = result;
1128
+ this.#currentResultOptions = this.options;
1129
+ this.#currentResultState = this.#currentQuery.state;
1130
+ }
1131
+ return result;
1132
+ }
1133
+ getCurrentResult() {
1134
+ return this.#currentResult;
1135
+ }
1136
+ trackResult(result, onPropTracked) {
1137
+ return new Proxy(result, {
1138
+ get: (target, key) => {
1139
+ this.trackProp(key);
1140
+ onPropTracked?.(key);
1141
+ if (key === "promise") {
1142
+ this.trackProp("data");
1143
+ if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
1144
+ this.#currentThenable.reject(
1145
+ new Error(
1146
+ "experimental_prefetchInRender feature flag is not enabled"
1147
+ )
1148
+ );
1149
+ }
1150
+ }
1151
+ return Reflect.get(target, key);
1152
+ }
1153
+ });
1154
+ }
1155
+ trackProp(key) {
1156
+ this.#trackedProps.add(key);
1157
+ }
1158
+ getCurrentQuery() {
1159
+ return this.#currentQuery;
1160
+ }
1161
+ refetch({ ...options } = {}) {
1162
+ return this.fetch({
1163
+ ...options
1164
+ });
1165
+ }
1166
+ fetchOptimistic(options) {
1167
+ const defaultedOptions = this.#client.defaultQueryOptions(options);
1168
+ const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
1169
+ return query.fetch().then(() => this.createResult(query, defaultedOptions));
1170
+ }
1171
+ fetch(fetchOptions) {
1172
+ return this.#executeFetch({
1173
+ ...fetchOptions,
1174
+ cancelRefetch: fetchOptions.cancelRefetch ?? true
1175
+ }).then(() => {
1176
+ this.updateResult();
1177
+ return this.#currentResult;
1178
+ });
1179
+ }
1180
+ #executeFetch(fetchOptions) {
1181
+ this.#updateQuery();
1182
+ let promise = this.#currentQuery.fetch(
1183
+ this.options,
1184
+ fetchOptions
1185
+ );
1186
+ if (!fetchOptions?.throwOnError) {
1187
+ promise = promise.catch(noop);
1188
+ }
1189
+ return promise;
1190
+ }
1191
+ #updateStaleTimeout() {
1192
+ this.#clearStaleTimeout();
1193
+ const staleTime = resolveStaleTime(
1194
+ this.options.staleTime,
1195
+ this.#currentQuery
1196
+ );
1197
+ if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
1198
+ return;
1199
+ }
1200
+ const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
1201
+ const timeout = time + 1;
1202
+ this.#staleTimeoutId = timeoutManager.setTimeout(() => {
1203
+ if (!this.#currentResult.isStale) {
1204
+ this.updateResult();
1205
+ }
1206
+ }, timeout);
1207
+ }
1208
+ #computeRefetchInterval() {
1209
+ return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
1210
+ }
1211
+ #updateRefetchInterval(nextInterval) {
1212
+ this.#clearRefetchInterval();
1213
+ this.#currentRefetchInterval = nextInterval;
1214
+ if (environmentManager.isServer() || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
1215
+ return;
1216
+ }
1217
+ this.#refetchIntervalId = timeoutManager.setInterval(() => {
1218
+ if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
1219
+ this.#executeFetch();
1220
+ }
1221
+ }, this.#currentRefetchInterval);
1222
+ }
1223
+ #updateTimers() {
1224
+ this.#updateStaleTimeout();
1225
+ this.#updateRefetchInterval(this.#computeRefetchInterval());
1226
+ }
1227
+ #clearStaleTimeout() {
1228
+ if (this.#staleTimeoutId) {
1229
+ timeoutManager.clearTimeout(this.#staleTimeoutId);
1230
+ this.#staleTimeoutId = void 0;
1231
+ }
1232
+ }
1233
+ #clearRefetchInterval() {
1234
+ if (this.#refetchIntervalId) {
1235
+ timeoutManager.clearInterval(this.#refetchIntervalId);
1236
+ this.#refetchIntervalId = void 0;
1237
+ }
1238
+ }
1239
+ createResult(query, options) {
1240
+ const prevQuery = this.#currentQuery;
1241
+ const prevOptions = this.options;
1242
+ const prevResult = this.#currentResult;
1243
+ const prevResultState = this.#currentResultState;
1244
+ const prevResultOptions = this.#currentResultOptions;
1245
+ const queryChange = query !== prevQuery;
1246
+ const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
1247
+ const { state } = query;
1248
+ let newState = { ...state };
1249
+ let isPlaceholderData = false;
1250
+ let data;
1251
+ if (options._optimisticResults) {
1252
+ const mounted = this.hasListeners();
1253
+ const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
1254
+ const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
1255
+ if (fetchOnMount || fetchOptionally) {
1256
+ newState = {
1257
+ ...newState,
1258
+ ...fetchState(state.data, query.options)
1259
+ };
1260
+ }
1261
+ if (options._optimisticResults === "isRestoring") {
1262
+ newState.fetchStatus = "idle";
1263
+ }
1264
+ }
1265
+ let { error, errorUpdatedAt, status } = newState;
1266
+ data = newState.data;
1267
+ let skipSelect = false;
1268
+ if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
1269
+ let placeholderData;
1270
+ if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
1271
+ placeholderData = prevResult.data;
1272
+ skipSelect = true;
1273
+ } else {
1274
+ placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
1275
+ this.#lastQueryWithDefinedData?.state.data,
1276
+ this.#lastQueryWithDefinedData
1277
+ ) : options.placeholderData;
1278
+ }
1279
+ if (placeholderData !== void 0) {
1280
+ status = "success";
1281
+ data = replaceData(
1282
+ prevResult?.data,
1283
+ placeholderData,
1284
+ options
1285
+ );
1286
+ isPlaceholderData = true;
1287
+ }
1288
+ }
1289
+ if (options.select && data !== void 0 && !skipSelect) {
1290
+ if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {
1291
+ data = this.#selectResult;
1292
+ } else {
1293
+ try {
1294
+ this.#selectFn = options.select;
1295
+ data = options.select(data);
1296
+ data = replaceData(prevResult?.data, data, options);
1297
+ this.#selectResult = data;
1298
+ this.#selectError = null;
1299
+ } catch (selectError) {
1300
+ this.#selectError = selectError;
1301
+ }
1302
+ }
1303
+ }
1304
+ if (this.#selectError) {
1305
+ error = this.#selectError;
1306
+ data = this.#selectResult;
1307
+ errorUpdatedAt = Date.now();
1308
+ status = "error";
1309
+ }
1310
+ const isFetching = newState.fetchStatus === "fetching";
1311
+ const isPending = status === "pending";
1312
+ const isError = status === "error";
1313
+ const isLoading = isPending && isFetching;
1314
+ const hasData = data !== void 0;
1315
+ const result = {
1316
+ status,
1317
+ fetchStatus: newState.fetchStatus,
1318
+ isPending,
1319
+ isSuccess: status === "success",
1320
+ isError,
1321
+ isInitialLoading: isLoading,
1322
+ isLoading,
1323
+ data,
1324
+ dataUpdatedAt: newState.dataUpdatedAt,
1325
+ error,
1326
+ errorUpdatedAt,
1327
+ failureCount: newState.fetchFailureCount,
1328
+ failureReason: newState.fetchFailureReason,
1329
+ errorUpdateCount: newState.errorUpdateCount,
1330
+ isFetched: query.isFetched(),
1331
+ isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
1332
+ isFetching,
1333
+ isRefetching: isFetching && !isPending,
1334
+ isLoadingError: isError && !hasData,
1335
+ isPaused: newState.fetchStatus === "paused",
1336
+ isPlaceholderData,
1337
+ isRefetchError: isError && hasData,
1338
+ isStale: isStale(query, options),
1339
+ refetch: this.refetch,
1340
+ promise: this.#currentThenable,
1341
+ isEnabled: resolveEnabled(options.enabled, query) !== false
1342
+ };
1343
+ const nextResult = result;
1344
+ if (this.options.experimental_prefetchInRender) {
1345
+ const hasResultData = nextResult.data !== void 0;
1346
+ const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
1347
+ const finalizeThenableIfPossible = (thenable) => {
1348
+ if (isErrorWithoutData) {
1349
+ thenable.reject(nextResult.error);
1350
+ } else if (hasResultData) {
1351
+ thenable.resolve(nextResult.data);
1352
+ }
1353
+ };
1354
+ const recreateThenable = () => {
1355
+ const pending = this.#currentThenable = nextResult.promise = pendingThenable();
1356
+ finalizeThenableIfPossible(pending);
1357
+ };
1358
+ const prevThenable = this.#currentThenable;
1359
+ switch (prevThenable.status) {
1360
+ case "pending":
1361
+ if (query.queryHash === prevQuery.queryHash) {
1362
+ finalizeThenableIfPossible(prevThenable);
1363
+ }
1364
+ break;
1365
+ case "fulfilled":
1366
+ if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
1367
+ recreateThenable();
1368
+ }
1369
+ break;
1370
+ case "rejected":
1371
+ if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
1372
+ recreateThenable();
1373
+ }
1374
+ break;
1375
+ }
1376
+ }
1377
+ return nextResult;
1378
+ }
1379
+ updateResult() {
1380
+ const prevResult = this.#currentResult;
1381
+ const nextResult = this.createResult(this.#currentQuery, this.options);
1382
+ this.#currentResultState = this.#currentQuery.state;
1383
+ this.#currentResultOptions = this.options;
1384
+ if (this.#currentResultState.data !== void 0) {
1385
+ this.#lastQueryWithDefinedData = this.#currentQuery;
1386
+ }
1387
+ if (shallowEqualObjects(nextResult, prevResult)) {
1388
+ return;
1389
+ }
1390
+ this.#currentResult = nextResult;
1391
+ const shouldNotifyListeners = () => {
1392
+ if (!prevResult) {
1393
+ return true;
1394
+ }
1395
+ const { notifyOnChangeProps } = this.options;
1396
+ const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
1397
+ if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
1398
+ return true;
1399
+ }
1400
+ const includedProps = new Set(
1401
+ notifyOnChangePropsValue ?? this.#trackedProps
1402
+ );
1403
+ if (this.options.throwOnError) {
1404
+ includedProps.add("error");
1405
+ }
1406
+ return Object.keys(this.#currentResult).some((key) => {
1407
+ const typedKey = key;
1408
+ const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
1409
+ return changed && includedProps.has(typedKey);
1410
+ });
1411
+ };
1412
+ this.#notify({ listeners: shouldNotifyListeners() });
1413
+ }
1414
+ #updateQuery() {
1415
+ const query = this.#client.getQueryCache().build(this.#client, this.options);
1416
+ if (query === this.#currentQuery) {
1417
+ return;
1418
+ }
1419
+ const prevQuery = this.#currentQuery;
1420
+ this.#currentQuery = query;
1421
+ this.#currentQueryInitialState = query.state;
1422
+ if (this.hasListeners()) {
1423
+ prevQuery?.removeObserver(this);
1424
+ query.addObserver(this);
1425
+ }
1426
+ }
1427
+ onQueryUpdate() {
1428
+ this.updateResult();
1429
+ if (this.hasListeners()) {
1430
+ this.#updateTimers();
1431
+ }
1432
+ }
1433
+ #notify(notifyOptions) {
1434
+ notifyManager.batch(() => {
1435
+ if (notifyOptions.listeners) {
1436
+ this.listeners.forEach((listener) => {
1437
+ listener(this.#currentResult);
1438
+ });
1439
+ }
1440
+ this.#client.getQueryCache().notify({
1441
+ query: this.#currentQuery,
1442
+ type: "observerResultsUpdated"
1443
+ });
1444
+ });
1445
+ }
1446
+ };
1447
+ function shouldLoadOnMount(query, options) {
1448
+ return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
1449
+ }
1450
+ function shouldFetchOnMount(query, options) {
1451
+ return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
1452
+ }
1453
+ function shouldFetchOn(query, options, field) {
1454
+ if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
1455
+ const value = typeof field === "function" ? field(query) : field;
1456
+ return value === "always" || value !== false && isStale(query, options);
1457
+ }
1458
+ return false;
1459
+ }
1460
+ function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
1461
+ return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
1462
+ }
1463
+ function isStale(query, options) {
1464
+ return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
1465
+ }
1466
+ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
1467
+ if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
1468
+ return true;
1469
+ }
1470
+ return false;
1471
+ }
1472
+ var QueryClientContext = React5__namespace.createContext(
1473
+ void 0
1474
+ );
1475
+ var useQueryClient = (queryClient) => {
1476
+ const client = React5__namespace.useContext(QueryClientContext);
1477
+ if (!client) {
1478
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
1479
+ }
1480
+ return client;
1481
+ };
1482
+ var IsRestoringContext = React5__namespace.createContext(false);
1483
+ var useIsRestoring = () => React5__namespace.useContext(IsRestoringContext);
1484
+ IsRestoringContext.Provider;
1485
+ function createValue() {
1486
+ let isReset = false;
1487
+ return {
1488
+ clearReset: () => {
1489
+ isReset = false;
1490
+ },
1491
+ reset: () => {
1492
+ isReset = true;
1493
+ },
1494
+ isReset: () => {
1495
+ return isReset;
1496
+ }
1497
+ };
1498
+ }
1499
+ var QueryErrorResetBoundaryContext = React5__namespace.createContext(createValue());
1500
+ var useQueryErrorResetBoundary = () => React5__namespace.useContext(QueryErrorResetBoundaryContext);
1501
+ var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
1502
+ const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
1503
+ if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
1504
+ if (!errorResetBoundary.isReset()) {
1505
+ options.retryOnMount = false;
1506
+ }
1507
+ }
1508
+ };
1509
+ var useClearResetErrorBoundary = (errorResetBoundary) => {
1510
+ React5__namespace.useEffect(() => {
1511
+ errorResetBoundary.clearReset();
1512
+ }, [errorResetBoundary]);
1513
+ };
1514
+ var getHasError = ({
1515
+ result,
1516
+ errorResetBoundary,
1517
+ throwOnError,
1518
+ query,
1519
+ suspense
1520
+ }) => {
1521
+ return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
1522
+ };
1523
+
1524
+ // ../../node_modules/.bun/@tanstack+react-query@5.96.1+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/suspense.js
1525
+ var ensureSuspenseTimers = (defaultedOptions) => {
1526
+ if (defaultedOptions.suspense) {
1527
+ const MIN_SUSPENSE_TIME_MS = 1e3;
1528
+ const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
1529
+ const originalStaleTime = defaultedOptions.staleTime;
1530
+ defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
1531
+ if (typeof defaultedOptions.gcTime === "number") {
1532
+ defaultedOptions.gcTime = Math.max(
1533
+ defaultedOptions.gcTime,
1534
+ MIN_SUSPENSE_TIME_MS
1535
+ );
1536
+ }
1537
+ }
1538
+ };
1539
+ var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
1540
+ var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
1541
+ var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
1542
+ errorResetBoundary.clearReset();
1543
+ });
1544
+ function useBaseQuery(options, Observer, queryClient) {
1545
+ if (process.env.NODE_ENV !== "production") {
1546
+ if (typeof options !== "object" || Array.isArray(options)) {
1547
+ throw new Error(
1548
+ 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
1549
+ );
1550
+ }
1551
+ }
1552
+ const isRestoring = useIsRestoring();
1553
+ const errorResetBoundary = useQueryErrorResetBoundary();
1554
+ const client = useQueryClient();
1555
+ const defaultedOptions = client.defaultQueryOptions(options);
1556
+ client.getDefaultOptions().queries?._experimental_beforeQuery?.(
1557
+ defaultedOptions
1558
+ );
1559
+ const query = client.getQueryCache().get(defaultedOptions.queryHash);
1560
+ if (process.env.NODE_ENV !== "production") {
1561
+ if (!defaultedOptions.queryFn) {
1562
+ console.error(
1563
+ `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
1564
+ );
1565
+ }
1566
+ }
1567
+ defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
1568
+ ensureSuspenseTimers(defaultedOptions);
1569
+ ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
1570
+ useClearResetErrorBoundary(errorResetBoundary);
1571
+ const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
1572
+ const [observer] = React5__namespace.useState(
1573
+ () => new Observer(
1574
+ client,
1575
+ defaultedOptions
1576
+ )
1577
+ );
1578
+ const result = observer.getOptimisticResult(defaultedOptions);
1579
+ const shouldSubscribe = !isRestoring && options.subscribed !== false;
1580
+ React5__namespace.useSyncExternalStore(
1581
+ React5__namespace.useCallback(
1582
+ (onStoreChange) => {
1583
+ const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
1584
+ observer.updateResult();
1585
+ return unsubscribe;
1586
+ },
1587
+ [observer, shouldSubscribe]
1588
+ ),
1589
+ () => observer.getCurrentResult(),
1590
+ () => observer.getCurrentResult()
1591
+ );
1592
+ React5__namespace.useEffect(() => {
1593
+ observer.setOptions(defaultedOptions);
1594
+ }, [defaultedOptions, observer]);
1595
+ if (shouldSuspend(defaultedOptions, result)) {
1596
+ throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
1597
+ }
1598
+ if (getHasError({
1599
+ result,
1600
+ errorResetBoundary,
1601
+ throwOnError: defaultedOptions.throwOnError,
1602
+ query,
1603
+ suspense: defaultedOptions.suspense
1604
+ })) {
1605
+ throw result.error;
1606
+ }
1607
+ client.getDefaultOptions().queries?._experimental_afterQuery?.(
1608
+ defaultedOptions,
1609
+ result
1610
+ );
1611
+ if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
1612
+ const promise = isNewCacheEntry ? (
1613
+ // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1614
+ fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
1615
+ ) : (
1616
+ // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1617
+ query?.promise
1618
+ );
1619
+ promise?.catch(noop).finally(() => {
1620
+ observer.updateResult();
1621
+ });
1622
+ }
1623
+ return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
1624
+ }
1625
+
1626
+ // ../../node_modules/.bun/@tanstack+react-query@5.96.1+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/useQuery.js
1627
+ function useQuery(options, queryClient) {
1628
+ return useBaseQuery(options, QueryObserver);
1629
+ }
1630
+
1631
+ // src/hooks/injectFontLink.ts
1632
+ var injectFontLink = (font) => {
1633
+ const href = GOOGLE_FONTS_HREF[font];
1634
+ if (!href) return;
1635
+ const existing = document.head.querySelector(`link[data-font="${font}"]`);
1636
+ if (existing) return;
1637
+ const link = document.createElement("link");
1638
+ link.rel = "stylesheet";
1639
+ link.href = href;
1640
+ link.setAttribute("data-font", font);
1641
+ document.head.appendChild(link);
1642
+ };
1643
+
1644
+ // src/hooks/useFontDownload.ts
1645
+ var fetchFontCss = async (font) => {
1646
+ const href = GOOGLE_FONTS_HREF[font];
1647
+ if (!href) {
1648
+ throw new Error(`Font "${font}" not found in Google Fonts`);
1649
+ }
1650
+ const response = await fetch(href);
1651
+ if (!response.ok) {
1652
+ throw new Error(`Failed to download font: HTTP ${response.status}`);
1653
+ }
1654
+ await response.text();
1655
+ injectFontLink(font);
1656
+ return { font, success: true };
1657
+ };
1658
+ var useFontDownload = (font) => {
1659
+ const queryClient = useQueryClient();
1660
+ const markFontDownloaded = useSettingsStore((state) => state.markFontDownloaded);
1661
+ const downloadedFonts = useSettingsStore((state) => state.downloadedFonts);
1662
+ const isDownloaded = font ? downloadedFonts.includes(font) : false;
1663
+ const needsDownload = font && !isDownloaded && GOOGLE_FONTS_HREF[font];
1664
+ const query = useQuery({
1665
+ queryKey: ["font", font ?? ""],
1666
+ queryFn: async ({ queryKey }) => {
1667
+ const [, fontName] = queryKey;
1668
+ if (!fontName || !GOOGLE_FONTS_HREF[fontName]) {
1669
+ throw new Error(`Font "${fontName}" not available`);
1670
+ }
1671
+ const result = await fetchFontCss(fontName);
1672
+ if (result.success) {
1673
+ markFontDownloaded(fontName);
1674
+ }
1675
+ return result;
1676
+ },
1677
+ enabled: !!needsDownload,
1678
+ staleTime: Infinity,
1679
+ gcTime: Infinity,
1680
+ retry: false
1681
+ });
1682
+ const progress = query.isFetching ? { status: "downloading", loaded: 0, total: null, percent: null, error: null } : query.isError ? {
1683
+ status: "error",
1684
+ loaded: 0,
1685
+ total: null,
1686
+ percent: null,
1687
+ error: query.error?.message ?? "Unknown error"
1688
+ } : query.isSuccess ? { status: "done", loaded: 0, total: 0, percent: 100, error: null } : { status: "idle", loaded: 0, total: null, percent: null, error: null };
1689
+ const reset = () => {
1690
+ if (font) {
1691
+ queryClient.removeQueries({ queryKey: ["font", font] });
1692
+ }
1693
+ };
1694
+ return {
1695
+ ...query,
1696
+ progress,
1697
+ isDownloaded,
1698
+ reset
1699
+ };
1700
+ };
1701
+ var ERROR_COLOR = chunkZX3EDZ5C_cjs.PRESET_COLORS[1];
1702
+ var FontDownloadStatus = ({ status, error, onDownload }) => {
1703
+ const { t } = reactI18next.useTranslation("settings");
1704
+ if (error) {
1705
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Badge, { color: ERROR_COLOR, variant: "filled", size: "sm", "aria-label": `Download error: ${error}`, children: t("common:status.error") });
1706
+ }
1707
+ return /* @__PURE__ */ jsxRuntime.jsx(
1708
+ chunkE55VXNLK_cjs.Button,
1709
+ {
1710
+ size: "xs",
1711
+ variant: "light",
1712
+ onClick: onDownload,
1713
+ loading: status === "downloading",
1714
+ "aria-label": t("font.download"),
1715
+ children: t("font.download")
1716
+ }
1717
+ );
1718
+ };
1719
+ var FontSettings = () => {
1720
+ const { t } = reactI18next.useTranslation("settings");
1721
+ const font = useSettingsStore((state) => state.font);
1722
+ const setFont = useSettingsStore((state) => state.setFont);
1723
+ const fontSize = useSettingsStore((state) => state.fontSize);
1724
+ const setFontSize = useSettingsStore((state) => state.setFontSize);
1725
+ const downloadedFonts = useSettingsStore((state) => state.downloadedFonts);
1726
+ const markFontDownloaded = useSettingsStore((state) => state.markFontDownloaded);
1727
+ const [activeDownload, setActiveDownload] = React5.useState(null);
1728
+ const fontDownload = useFontDownload(activeDownload);
1729
+ React5.useEffect(() => {
1730
+ if (fontDownload.isSuccess && fontDownload.data?.success && activeDownload) {
1731
+ if (!downloadedFonts.includes(activeDownload)) {
1732
+ markFontDownloaded(activeDownload);
1733
+ }
1734
+ }
1735
+ }, [
1736
+ fontDownload.isSuccess,
1737
+ fontDownload.data,
1738
+ activeDownload,
1739
+ downloadedFonts,
1740
+ markFontDownloaded
1741
+ ]);
1742
+ const handleDownloadFont = React5.useCallback((fontName) => {
1743
+ setActiveDownload(fontName);
1744
+ }, []);
1745
+ const getFontStatus = (fontName) => {
1746
+ if (downloadedFonts.includes(fontName)) return "done";
1747
+ if (activeDownload === fontName) {
1748
+ return fontDownload.progress.status;
1749
+ }
1750
+ return "idle";
1751
+ };
1752
+ const getFontError = (fontName) => {
1753
+ if (activeDownload === fontName) {
1754
+ return fontDownload.progress.error;
1755
+ }
1756
+ return null;
1757
+ };
1758
+ const handleDownloadCustomFont = React5.useCallback((customName) => {
1759
+ const trimmed = customName.trim();
1760
+ if (!trimmed) return;
1761
+ const familyParam = trimmed.replace(/\s+/g, "+");
1762
+ const href = `https://fonts.googleapis.com/css2?family=${familyParam}&display=swap`;
1763
+ GOOGLE_FONTS_HREF[trimmed] = href;
1764
+ setActiveDownload(trimmed);
1765
+ }, []);
1766
+ const availableFontValues = AVAILABLE_FONTS.map((f) => f.value);
1767
+ const customFonts = downloadedFonts.filter((f) => !availableFontValues.includes(f));
1768
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "md", p: "md", children: [
1769
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { fw: 600, size: "lg", children: t("font.title") }),
1770
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", children: t("font.description") }),
1771
+ /* @__PURE__ */ jsxRuntime.jsx(
1772
+ chunkE55VXNLK_cjs.Radio.Group,
1773
+ {
1774
+ value: font,
1775
+ onChange: setFont,
1776
+ "aria-label": t("font.selectionAria", { defaultValue: "Font selection" }),
1777
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "xs", children: [
1778
+ AVAILABLE_FONTS.map((f) => {
1779
+ const hasGoogleFont = !!GOOGLE_FONTS_HREF[f.value];
1780
+ const isDownloaded = downloadedFonts.includes(f.value);
1781
+ const status = getFontStatus(f.value);
1782
+ const error = getFontError(f.value);
1783
+ const isReady = !hasGoogleFont || isDownloaded || status === "done";
1784
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Paper, { p: "sm", withBorder: true, radius: "md", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "xs", children: [
1785
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { justify: "space-between", children: [
1786
+ /* @__PURE__ */ jsxRuntime.jsx(
1787
+ chunkE55VXNLK_cjs.Radio,
1788
+ {
1789
+ value: f.value,
1790
+ label: f.label,
1791
+ "aria-label": f.label,
1792
+ disabled: !isReady
1793
+ }
1794
+ ),
1795
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { gap: "xs", align: "center", children: [
1796
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", style: { fontFamily: f.stack }, children: "AaBbCcDd" }),
1797
+ hasGoogleFont && /* @__PURE__ */ jsxRuntime.jsx(
1798
+ FontDownloadStatus,
1799
+ {
1800
+ fontLabel: f.label,
1801
+ status,
1802
+ error,
1803
+ onDownload: () => handleDownloadFont(f.value),
1804
+ isDownloaded
1805
+ }
1806
+ )
1807
+ ] })
1808
+ ] }),
1809
+ hasGoogleFont && status === "downloading" && /* @__PURE__ */ jsxRuntime.jsx(chunk2PSTHGTD_cjs.DownloadProgress_default, { state: fontDownload.progress })
1810
+ ] }) }, f.value);
1811
+ }),
1812
+ customFonts.map((fontName) => /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Paper, { p: "sm", withBorder: true, radius: "md", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { justify: "space-between", children: [
1813
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Radio, { value: fontName, label: fontName, "aria-label": fontName }),
1814
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", style: { fontFamily: `"${fontName}"` }, children: "AaBbCcDd" })
1815
+ ] }) }, fontName))
1816
+ ] })
1817
+ }
1818
+ ),
1819
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Paper, { p: "sm", withBorder: true, radius: "md", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "xs", children: [
1820
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { justify: "space-between", children: [
1821
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, children: t("font.fontSize") }),
1822
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", children: [
1823
+ fontSize,
1824
+ "px"
1825
+ ] })
1826
+ ] }),
1827
+ /* @__PURE__ */ jsxRuntime.jsx(
1828
+ chunkE55VXNLK_cjs.Slider,
1829
+ {
1830
+ value: fontSize,
1831
+ onChange: setFontSize,
1832
+ min: 10,
1833
+ max: 24,
1834
+ step: 1,
1835
+ marks: [{ value: 10 }, { value: 14 }, { value: 18 }, { value: 20 }, { value: 24 }],
1836
+ "aria-label": t("font.fontSizeAria", { defaultValue: "Font size" })
1837
+ }
1838
+ )
1839
+ ] }) }),
1840
+ /* @__PURE__ */ jsxRuntime.jsx(
1841
+ CustomFontDownloader,
1842
+ {
1843
+ onDownload: handleDownloadCustomFont,
1844
+ activeDownload,
1845
+ fontDownload
1846
+ }
1847
+ )
1848
+ ] });
1849
+ };
1850
+ var CustomFontDownloader = ({
1851
+ onDownload,
1852
+ activeDownload,
1853
+ fontDownload
1854
+ }) => {
1855
+ const { t } = reactI18next.useTranslation("settings");
1856
+ const [customFontName, setCustomFontName] = React5.useState("");
1857
+ const isActive = activeDownload === customFontName.trim();
1858
+ const status = isActive ? fontDownload.progress.status : "idle";
1859
+ const hasError = isActive && fontDownload.progress.status === "error";
1860
+ const handleNameChange = React5.useCallback(
1861
+ (value) => {
1862
+ setCustomFontName(value);
1863
+ if (hasError) {
1864
+ fontDownload.reset?.();
1865
+ }
1866
+ },
1867
+ [hasError, fontDownload]
1868
+ );
1869
+ const handleDownloadClick = React5.useCallback(() => {
1870
+ onDownload(customFontName);
1871
+ }, [customFontName, onDownload]);
1872
+ const isSuccess = isActive && status === "done";
1873
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Paper, { p: "sm", withBorder: true, radius: "md", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "xs", children: [
1874
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, children: [
1875
+ t("font.downloadByName"),
1876
+ " ",
1877
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://fonts.google.com/", target: "_blank", rel: "noreferrer", children: t("font.fromGoogleFonts") })
1878
+ ] }),
1879
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { gap: "xs", align: "flex-start", children: [
1880
+ /* @__PURE__ */ jsxRuntime.jsx(
1881
+ chunkE55VXNLK_cjs.TextInput,
1882
+ {
1883
+ placeholder: t("font.namePlaceholder", { defaultValue: "e.g. Open Sans" }),
1884
+ value: customFontName,
1885
+ onChange: (e) => handleNameChange(e.currentTarget.value),
1886
+ style: { flex: 1 },
1887
+ "aria-label": t("font.customNameAria", { defaultValue: "Custom font name" }),
1888
+ error: hasError ? t("font.downloadError") : void 0
1889
+ }
1890
+ ),
1891
+ /* @__PURE__ */ jsxRuntime.jsx(
1892
+ chunkE55VXNLK_cjs.Button,
1893
+ {
1894
+ onClick: handleDownloadClick,
1895
+ disabled: !customFontName.trim() || status === "downloading",
1896
+ loading: status === "downloading",
1897
+ "aria-label": t("font.downloadCustomAria", { defaultValue: "Download custom font" }),
1898
+ style: { marginTop: hasError ? 0 : void 0 },
1899
+ children: t("font.download")
1900
+ }
1901
+ )
1902
+ ] }),
1903
+ status === "downloading" && /* @__PURE__ */ jsxRuntime.jsx(chunk2PSTHGTD_cjs.DownloadProgress_default, { state: fontDownload.progress }),
1904
+ isSuccess && /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "xs", c: "dimmed", children: t("font.downloadSuccess") })
1905
+ ] }) });
1906
+ };
1907
+ var FontSettings_default = FontSettings;
1908
+
1909
+ // src/infrastructure/i18nConstants.ts
1910
+ var SUPPORTED_LANGUAGES2 = ["en", "es"];
1911
+ var DEFAULT_LANGUAGE2 = "en";
1912
+
1913
+ // src/components/Shared/LanguageFlag/LanguageFlag.module.css
1914
+ var LanguageFlag_default = {};
1915
+ var FLAGS = {
1916
+ en: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 60 40", className: LanguageFlag_default.flag, children: [
1917
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { fill: "#012169", width: "60", height: "40" }),
1918
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L60,40 M60,0 L0,40", stroke: "#fff", strokeWidth: "6" }),
1919
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L60,40 M60,0 L0,40", stroke: "#C8102E", strokeWidth: "4" }),
1920
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M30,0 V40 M0,20 H60", stroke: "#fff", strokeWidth: "10" }),
1921
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M30,0 V40 M0,20 H60", stroke: "#C8102E", strokeWidth: "6" })
1922
+ ] }),
1923
+ es: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 60 40", className: LanguageFlag_default.flag, children: [
1924
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { fill: "#C60B1E", width: "60", height: "40" }),
1925
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { fill: "#FFC400", y: "10", width: "60", height: "20" })
1926
+ ] })
1927
+ };
1928
+ var LanguageFlag = ({ lang, size = 20 }) => /* @__PURE__ */ jsxRuntime.jsx(
1929
+ "div",
1930
+ {
1931
+ style: { width: size * 1.5, height: size },
1932
+ className: LanguageFlag_default.container,
1933
+ "aria-label": lang === "en" ? "English" : "Espa\xF1ol",
1934
+ "data-testid": `flag-${lang}`,
1935
+ children: FLAGS[lang]
1936
+ }
1937
+ );
1938
+ var LanguageFlag_default2 = LanguageFlag;
1939
+ var LANGUAGE_NAMES = {
1940
+ en: "English",
1941
+ es: "Espa\xF1ol"
1942
+ };
1943
+ var LanguageSettings = () => {
1944
+ const { t } = reactI18next.useTranslation("settings");
1945
+ const language = useSettingsStore((state) => state.language);
1946
+ const setLanguage = useSettingsStore((state) => state.setLanguage);
1947
+ const handleSelect = React5.useCallback(
1948
+ (lang) => {
1949
+ setLanguage(lang);
1950
+ },
1951
+ [setLanguage]
1952
+ );
1953
+ return /* @__PURE__ */ jsxRuntime.jsx(SettingsSection_default, { title: t("language.title"), description: t("language.description"), children: /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Stack, { gap: "xs", children: SUPPORTED_LANGUAGES2.map((lang) => /* @__PURE__ */ jsxRuntime.jsx(
1954
+ chunkE55VXNLK_cjs.UnstyledButton,
1955
+ {
1956
+ onClick: () => handleSelect(lang),
1957
+ "aria-label": LANGUAGE_NAMES[lang],
1958
+ "aria-pressed": lang === language,
1959
+ style: {
1960
+ padding: "12px 16px",
1961
+ borderRadius: 8,
1962
+ width: "100%",
1963
+ background: lang === language ? "var(--mantine-primary-color-light)" : "transparent",
1964
+ border: lang === language ? "1px solid var(--mantine-primary-color-filled)" : "1px solid transparent",
1965
+ transition: "all 0.15s ease",
1966
+ cursor: "pointer"
1967
+ },
1968
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { gap: "sm", children: [
1969
+ /* @__PURE__ */ jsxRuntime.jsx(LanguageFlag_default2, { lang, size: 24 }),
1970
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { fw: lang === language ? 600 : 400, children: LANGUAGE_NAMES[lang] })
1971
+ ] })
1972
+ },
1973
+ lang
1974
+ )) }) });
1975
+ };
1976
+ var LanguageSettings_default = LanguageSettings;
1977
+
1978
+ // src/utils/clearBrowserData.ts
1979
+ async function clearBrowserData(options) {
1980
+ const globalScope = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : void 0;
1981
+ if (!globalScope) {
1982
+ return;
1983
+ }
1984
+ if (!options?.keepServiceWorker && "serviceWorker" in globalScope.navigator) {
1985
+ const registrations = await globalScope.navigator.serviceWorker.getRegistrations();
1986
+ for (const registration of registrations) {
1987
+ await registration.unregister();
1988
+ }
1989
+ }
1990
+ if ("caches" in globalScope) {
1991
+ const cacheNames = await globalScope.caches.keys();
1992
+ for (const name of cacheNames) {
1993
+ await globalScope.caches.delete(name);
1994
+ }
1995
+ }
1996
+ if (!options?.keepIndexedDB && "indexedDB" in globalScope) {
1997
+ const dbs = await globalScope.indexedDB.databases();
1998
+ for (const db of dbs) {
1999
+ if (db.name) {
2000
+ globalScope.indexedDB.deleteDatabase(db.name);
2001
+ }
2002
+ }
2003
+ }
2004
+ if (!options?.keepLocalStorage && "localStorage" in globalScope) {
2005
+ globalScope.localStorage.clear();
2006
+ }
2007
+ if (!options?.keepSessionStorage && "sessionStorage" in globalScope) {
2008
+ globalScope.sessionStorage.clear();
2009
+ }
2010
+ }
2011
+
2012
+ // src/utils/resetDockerWorkspace.ts
2013
+ async function resetDockerWorkspace() {
2014
+ if (!chunkZ5YGWL65_cjs.isDocker()) return;
2015
+ await fetch("/api/fs/reset", { method: "POST" });
2016
+ await fetch("/api/fs/seed", { method: "POST" });
2017
+ }
2018
+ var ResetSettings = () => {
2019
+ const { t } = reactI18next.useTranslation("settings");
2020
+ const [modalOpen, setModalOpen] = React5.useState(false);
2021
+ const handleOpenModal = React5.useCallback(() => {
2022
+ setModalOpen(true);
2023
+ }, []);
2024
+ const handleCloseModal = React5.useCallback(() => {
2025
+ setModalOpen(false);
2026
+ }, []);
2027
+ const handleConfirmReset = React5.useCallback(async () => {
2028
+ await resetDockerWorkspace();
2029
+ await clearBrowserData();
2030
+ window.location.reload();
2031
+ }, []);
2032
+ const handleKeepFiles = React5.useCallback(async () => {
2033
+ await resetDockerWorkspace();
2034
+ await clearBrowserData({ keepIndexedDB: true });
2035
+ window.location.reload();
2036
+ }, []);
2037
+ return /* @__PURE__ */ jsxRuntime.jsxs(SettingsSection_default, { title: t("reset.title"), description: t("reset.description"), children: [
2038
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { color: "red", onClick: handleOpenModal, style: { alignSelf: "flex-start" }, children: t("reset.resetButton") }),
2039
+ modalOpen && /* @__PURE__ */ jsxRuntime.jsx(
2040
+ chunkE55VXNLK_cjs.Box,
2041
+ {
2042
+ style: {
2043
+ position: "fixed",
2044
+ top: 0,
2045
+ left: 0,
2046
+ right: 0,
2047
+ bottom: 0,
2048
+ background: "rgba(0,0,0,0.5)",
2049
+ display: "flex",
2050
+ alignItems: "center",
2051
+ justifyContent: "center",
2052
+ zIndex: 1e3
2053
+ },
2054
+ role: "dialog",
2055
+ "aria-label": "Confirm reset",
2056
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2057
+ chunkE55VXNLK_cjs.Box,
2058
+ {
2059
+ style: {
2060
+ background: "var(--mantine-color-default)",
2061
+ borderRadius: 8,
2062
+ padding: 24,
2063
+ maxWidth: 400,
2064
+ width: "100%"
2065
+ },
2066
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: "md", children: [
2067
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { fw: 600, size: "lg", ta: "center", children: t("reset.modalTitle") }),
2068
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", c: "dimmed", ta: "center", children: t("reset.modalDescription") }),
2069
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Group, { justify: "center", gap: "xs", mt: "md", children: [
2070
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { variant: "default", onClick: handleCloseModal, children: t("reset.goBack") }),
2071
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { color: "blue", onClick: handleKeepFiles, children: t("reset.keepFiles") }),
2072
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { color: "red", onClick: handleConfirmReset, children: t("reset.burnEverything") })
2073
+ ] })
2074
+ ] })
2075
+ }
2076
+ )
2077
+ }
2078
+ )
2079
+ ] });
2080
+ };
2081
+ var ResetSettings_default = ResetSettings;
2082
+
2083
+ // src/components/Apps/SettingsApp/SettingsApp.module.css
2084
+ var SettingsApp_default = {};
2085
+
2086
+ // src/constants/profileData.ts
2087
+ var PROFILE = {
2088
+ name: "Francisco N\xFA\xF1ez Palomares",
2089
+ title: "Fullstack Developer & DevOps",
2090
+ email: "frannunpal@gmail.com",
2091
+ phone: "+34 600 275 210",
2092
+ location: "Spain",
2093
+ linkedin: "https://www.linkedin.com/in/francisco-n\xFA\xF1ez-palomares-74a484171/",
2094
+ github: "https://github.com/frannunpal",
2095
+ cvUrls: {
2096
+ en: "Desktop/CV_2026_English.pdf",
2097
+ es: "Desktop/CV 2026.pdf"
2098
+ }
2099
+ };
2100
+ var APP_VERSION = "0.4.0";
2101
+ var getVersionString = () => APP_VERSION;
2102
+ var SECTION_COMPONENTS = {
2103
+ wallpaper: WallpaperSettings_default,
2104
+ appearance: AppearanceSettings_default,
2105
+ launcher: LauncherSettings_default,
2106
+ font: FontSettings_default,
2107
+ language: LanguageSettings_default,
2108
+ reset: ResetSettings_default
2109
+ };
2110
+ var SettingsApp = ({ window: window2, notifyReady }) => {
2111
+ const { t } = reactI18next.useTranslation("settings");
2112
+ const [activeSectionId, setActiveSectionId] = React5.useState(null);
2113
+ const [isDirty, setIsDirty] = React5.useState(false);
2114
+ const windows = chunk6QOUYSEE_cjs.useDesktopStore((state) => state.windows);
2115
+ const windowId = window2?.id ?? windows.find((w) => w.content === "settings")?.id;
2116
+ const wallpaper = useSettingsStore((state) => state.wallpaper);
2117
+ const wallpaperModule = useSettingsStore((state) => state.wallpaperModule);
2118
+ const theme = useSettingsStore((state) => state.theme);
2119
+ const font = useSettingsStore((state) => state.font);
2120
+ const fontSize = useSettingsStore((state) => state.fontSize);
2121
+ const launcherIcon = useSettingsStore((state) => state.launcherIcon);
2122
+ const customThemeColors = useSettingsStore((state) => state.customThemeColors);
2123
+ const animationDuration = useSettingsStore((state) => state.animationDuration);
2124
+ const setWallpaper = useSettingsStore((state) => state.setWallpaper);
2125
+ const setWallpaperModule = useSettingsStore((state) => state.setWallpaperModule);
2126
+ const setFont = useSettingsStore((state) => state.setFont);
2127
+ const setFontSize = useSettingsStore((state) => state.setFontSize);
2128
+ const setLauncherIcon = useSettingsStore((state) => state.setLauncherIcon);
2129
+ const setThemeMode = useSettingsStore((state) => state.setThemeMode);
2130
+ const setCustomThemeColors = useSettingsStore((state) => state.setCustomThemeColors);
2131
+ const setThemeAutomatic = useSettingsStore((state) => state.setThemeAutomatic);
2132
+ const setAnimationDuration = useSettingsStore((state) => state.setAnimationDuration);
2133
+ const snapshotRef = React5.useRef(null);
2134
+ React5.useEffect(() => {
2135
+ if (snapshotRef.current !== null) return;
2136
+ snapshotRef.current = {
2137
+ wallpaper,
2138
+ wallpaperModule,
2139
+ themeMode: theme.mode,
2140
+ font,
2141
+ fontSize,
2142
+ launcherIcon,
2143
+ customThemeColors,
2144
+ animationDuration
2145
+ };
2146
+ }, [
2147
+ wallpaper,
2148
+ wallpaperModule,
2149
+ theme.mode,
2150
+ font,
2151
+ fontSize,
2152
+ launcherIcon,
2153
+ customThemeColors,
2154
+ animationDuration
2155
+ ]);
2156
+ React5.useEffect(() => {
2157
+ if (!snapshotRef.current) return;
2158
+ const current = {
2159
+ wallpaper,
2160
+ wallpaperModule,
2161
+ themeMode: theme.mode,
2162
+ font,
2163
+ fontSize,
2164
+ launcherIcon,
2165
+ customThemeColors,
2166
+ animationDuration
2167
+ };
2168
+ const dirty = JSON.stringify(current) !== JSON.stringify(snapshotRef.current);
2169
+ setIsDirty(dirty);
2170
+ }, [
2171
+ wallpaper,
2172
+ wallpaperModule,
2173
+ theme.mode,
2174
+ font,
2175
+ fontSize,
2176
+ launcherIcon,
2177
+ customThemeColors,
2178
+ animationDuration
2179
+ ]);
2180
+ const revertToSnapshot = React5.useCallback(() => {
2181
+ const snapshot = snapshotRef.current;
2182
+ if (!snapshot) return;
2183
+ setWallpaper(snapshot.wallpaper);
2184
+ setWallpaperModule(snapshot.wallpaperModule);
2185
+ setFont(snapshot.font);
2186
+ setFontSize(snapshot.fontSize);
2187
+ setLauncherIcon(snapshot.launcherIcon);
2188
+ setAnimationDuration(snapshot.animationDuration);
2189
+ if (snapshot.customThemeColors) {
2190
+ setCustomThemeColors(snapshot.customThemeColors);
2191
+ } else {
2192
+ setCustomThemeColors(null);
2193
+ setThemeAutomatic();
2194
+ }
2195
+ setThemeMode(snapshot.themeMode);
2196
+ setIsDirty(false);
2197
+ }, [
2198
+ setWallpaper,
2199
+ setWallpaperModule,
2200
+ setFont,
2201
+ setFontSize,
2202
+ setLauncherIcon,
2203
+ setAnimationDuration,
2204
+ setThemeMode,
2205
+ setCustomThemeColors,
2206
+ setThemeAutomatic
2207
+ ]);
2208
+ React5.useEffect(() => {
2209
+ if (!windowId) return;
2210
+ chunkYP2PLNOF_cjs.useSettingsAppStore.getState().reset(windowId);
2211
+ }, [windowId]);
2212
+ React5.useEffect(() => {
2213
+ if (!windowId) return;
2214
+ chunkYP2PLNOF_cjs.useSettingsAppStore.getState().setIsDirty(windowId, isDirty);
2215
+ }, [windowId, isDirty]);
2216
+ React5.useEffect(() => {
2217
+ notifyReady?.({
2218
+ ...window2?.contentData ?? {},
2219
+ discard: revertToSnapshot
2220
+ });
2221
+ }, [window2, notifyReady, revertToSnapshot]);
2222
+ const isDirtyGetter = React5.useCallback(() => {
2223
+ if (!snapshotRef.current) return false;
2224
+ const current = {
2225
+ wallpaper: useSettingsStore.getState().wallpaper,
2226
+ wallpaperModule: useSettingsStore.getState().wallpaperModule,
2227
+ themeMode: useSettingsStore.getState().theme.mode,
2228
+ font: useSettingsStore.getState().font,
2229
+ fontSize: useSettingsStore.getState().fontSize,
2230
+ launcherIcon: useSettingsStore.getState().launcherIcon,
2231
+ customThemeColors: useSettingsStore.getState().customThemeColors,
2232
+ animationDuration: useSettingsStore.getState().animationDuration
2233
+ };
2234
+ return JSON.stringify(current) !== JSON.stringify(snapshotRef.current);
2235
+ }, []);
2236
+ chunkZBGWYTCU_cjs.useCloseInterceptor({
2237
+ isDirtyGetter,
2238
+ windowId,
2239
+ onDiscard: revertToSnapshot,
2240
+ onSave: () => {
2241
+ }
2242
+ });
2243
+ const handleSelectSection = React5.useCallback((id) => {
2244
+ setActiveSectionId(id);
2245
+ }, []);
2246
+ const handleShowAll = React5.useCallback(() => {
2247
+ setActiveSectionId(null);
2248
+ }, []);
2249
+ const handleContactMe = React5.useCallback(() => {
2250
+ globalThis.location.href = `mailto:${PROFILE.email}`;
2251
+ }, []);
2252
+ const ActiveSection = activeSectionId ? SECTION_COMPONENTS[activeSectionId] : null;
2253
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: SettingsApp_default.root, children: [
2254
+ /* @__PURE__ */ jsxRuntime.jsx("aside", { className: SettingsApp_default.sidebar, children: /* @__PURE__ */ jsxRuntime.jsxs("nav", { "aria-label": "Settings sections", children: [
2255
+ /* @__PURE__ */ jsxRuntime.jsxs(
2256
+ "button",
2257
+ {
2258
+ className: SettingsApp_default.navItem,
2259
+ "data-active": activeSectionId === null || void 0,
2260
+ onClick: handleShowAll,
2261
+ "aria-label": "All Settings",
2262
+ "aria-current": activeSectionId === null ? "page" : void 0,
2263
+ children: [
2264
+ /* @__PURE__ */ jsxRuntime.jsx(chunkJ7L2S2GT_cjs.AppIcon_default, { fcIcon: "FcList", size: 16 }),
2265
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "xs", ml: 6, truncate: true, children: t("all") })
2266
+ ]
2267
+ }
2268
+ ),
2269
+ SETTINGS_SECTIONS.map((section) => /* @__PURE__ */ jsxRuntime.jsxs(
2270
+ "button",
2271
+ {
2272
+ className: SettingsApp_default.navItem,
2273
+ "data-active": activeSectionId === section.id || void 0,
2274
+ onClick: () => handleSelectSection(section.id),
2275
+ "aria-label": section.label,
2276
+ "aria-current": activeSectionId === section.id ? "page" : void 0,
2277
+ children: [
2278
+ /* @__PURE__ */ jsxRuntime.jsx(chunkJ7L2S2GT_cjs.AppIcon_default, { fcIcon: section.fcIcon, size: 16 }),
2279
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "xs", ml: 6, truncate: true, children: t(`sections.${section.id}.label`) })
2280
+ ]
2281
+ },
2282
+ section.id
2283
+ ))
2284
+ ] }) }),
2285
+ /* @__PURE__ */ jsxRuntime.jsx("main", { className: SettingsApp_default.content, children: ActiveSection ? /* @__PURE__ */ jsxRuntime.jsx(ActiveSection, {}) : /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { className: SettingsApp_default.overviewPadding, h: "100%", justify: "space-between", gap: 0, children: [
2286
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2287
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { fw: 500, mb: "md", size: "sm", c: "dimmed", children: t("all") }),
2288
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.SimpleGrid, { cols: 2, spacing: "sm", children: SETTINGS_SECTIONS.map((section) => /* @__PURE__ */ jsxRuntime.jsx(
2289
+ chunkE55VXNLK_cjs.Card,
2290
+ {
2291
+ withBorder: true,
2292
+ padding: "md",
2293
+ radius: "md",
2294
+ className: SettingsApp_default.sectionCard,
2295
+ onClick: () => handleSelectSection(section.id),
2296
+ role: "button",
2297
+ "aria-label": `Open ${section.label} settings`,
2298
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkE55VXNLK_cjs.Stack, { gap: 6, align: "flex-start", children: [
2299
+ /* @__PURE__ */ jsxRuntime.jsx(chunkJ7L2S2GT_cjs.AppIcon_default, { fcIcon: section.fcIcon, size: 28 }),
2300
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "sm", fw: 500, children: t(`sections.${section.id}.label`) }),
2301
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "xs", c: "dimmed", children: t(`sections.${section.id}.description`) })
2302
+ ] })
2303
+ },
2304
+ section.id
2305
+ )) })
2306
+ ] }),
2307
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Button, { gradient: { from: "blue", to: "cyan", deg: 90 }, onClick: handleContactMe, children: "FDE: Fran Desktop Environment" }),
2308
+ /* @__PURE__ */ jsxRuntime.jsx(chunkE55VXNLK_cjs.Text, { size: "xs", c: "dimmed", ta: "center", className: SettingsApp_default.versionFooter, children: getVersionString() })
2309
+ ] }) })
2310
+ ] });
2311
+ };
2312
+ var SettingsApp_default2 = SettingsApp;
2313
+
2314
+ exports.AVAILABLE_FONTS = AVAILABLE_FONTS;
2315
+ exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE2;
2316
+ exports.DefaultThemeProvider = DefaultThemeProvider;
2317
+ exports.FONT_STACKS = FONT_STACKS;
2318
+ exports.GOOGLE_FONTS_HREF = GOOGLE_FONTS_HREF;
2319
+ exports.LanguageFlag_default = LanguageFlag_default2;
2320
+ exports.PROFILE = PROFILE;
2321
+ exports.SETTINGS_SECTIONS = SETTINGS_SECTIONS;
2322
+ exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES2;
2323
+ exports.SettingsApp_default = SettingsApp_default2;
2324
+ exports.SettingsSection_default = SettingsSection_default;
2325
+ exports.clearBrowserData = clearBrowserData;
2326
+ exports.getPersistedThemeMode = getPersistedThemeMode;
2327
+ exports.injectFontLink = injectFontLink;
2328
+ exports.useFontDownload = useFontDownload;
2329
+ exports.useSettingsStore = useSettingsStore;