@fde-desktop/fde-core 0.4.7 → 0.4.9

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