efficient-shell 8.20.0 → 8.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/README.md +4 -3
  2. package/dist/{Browser-KK4DSPFA.js → Browser-WJ7YGO3M.js} +14 -14
  3. package/dist/Calculator-FHN36ZE3.js +29 -0
  4. package/dist/{CurrencyConverter-PD2CEL6V.js → CurrencyConverter-ONCRQNI4.js} +9 -9
  5. package/dist/{Documents-QRU3INP2.js → Documents-YEMIR4WQ.js} +5 -5
  6. package/dist/{Files-NQBM46JA.js → Files-QWSOYRD4.js} +25 -25
  7. package/dist/{Notepad-KU2VK5QB.js → Notepad-MFVUGAGD.js} +10 -10
  8. package/dist/PdfViewer-ZFZ4PEAV.js +1 -0
  9. package/dist/{PomodoroTimer-JEQTTMGA.js → PomodoroTimer-JVQ5K7B4.js} +68 -68
  10. package/dist/{Preview-C6VU5P3N.js → Preview-7G2WM7DN.js} +44 -44
  11. package/dist/Sidebar-OFRMBB5V.js +43 -0
  12. package/dist/{Spreadsheet-HLH3EHCX.js → Spreadsheet-VKOS3PUA.js} +13 -13
  13. package/dist/{Stock-VCMJMUCW.js → Stock-TWJNCTNT.js} +3 -3
  14. package/dist/{Weather-HF3E3N3M.js → Weather-RM7GPLAH.js} +16 -16
  15. package/dist/{WorldClock-PM5CJQSL.js → WorldClock-ITJ2MO75.js} +6 -6
  16. package/dist/ai/index.js +17 -17
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/charts/BoxPlotChart.js +1 -1
  21. package/dist/charts/CandlestickChart.js +1 -1
  22. package/dist/charts/CartesianPlot.js +1 -1
  23. package/dist/charts/ChartBrush.js +1 -1
  24. package/dist/charts/ChartFrame.js +1 -1
  25. package/dist/charts/ChartSkeleton.js +1 -1
  26. package/dist/charts/ChordChart.js +1 -1
  27. package/dist/charts/ColumnChart.js +1 -1
  28. package/dist/charts/FunnelChart.js +1 -1
  29. package/dist/charts/HeatmapChart.js +1 -1
  30. package/dist/charts/HistogramChart.js +1 -1
  31. package/dist/charts/Meter.js +1 -1
  32. package/dist/charts/PieChart.js +1 -1
  33. package/dist/charts/RadarChart.js +1 -1
  34. package/dist/charts/RadialBarChart.js +1 -1
  35. package/dist/charts/RangeChart.js +1 -1
  36. package/dist/charts/RankedBars.js +1 -1
  37. package/dist/charts/SankeyChart.js +1 -1
  38. package/dist/charts/ScatterChart.js +1 -1
  39. package/dist/charts/StatTile.js +1 -1
  40. package/dist/charts/SunburstChart.js +1 -1
  41. package/dist/charts/TimeSeriesChart.js +1 -1
  42. package/dist/charts/TreemapChart.js +1 -1
  43. package/dist/charts/WaterfallChart.js +1 -1
  44. package/dist/chunk-22S6LG6D.js +6 -0
  45. package/dist/{chunk-CQXKO5PB.js → chunk-24L7NLA3.js} +1 -1
  46. package/dist/{chunk-O3HXASSH.js → chunk-2BS74SYW.js} +1 -1
  47. package/dist/{chunk-THPTJGV5.js → chunk-2H6PDKTC.js} +7 -7
  48. package/dist/chunk-36MUTG34.js +1 -0
  49. package/dist/{chunk-VWVFKMU7.js → chunk-3HNK7IRJ.js} +3 -3
  50. package/dist/{chunk-KSSIZW3C.js → chunk-3PQHPFXP.js} +5 -5
  51. package/dist/{chunk-5TVF4BCM.js → chunk-3Z7LIHMB.js} +1 -1
  52. package/dist/chunk-4CANQ3B3.js +1 -0
  53. package/dist/{chunk-UEUCGC6G.js → chunk-4CWKK5HV.js} +4 -4
  54. package/dist/chunk-4IU5BSVE.js +2 -0
  55. package/dist/chunk-4PZN25MV.js +20 -0
  56. package/dist/{chunk-RC5SGXXR.js → chunk-4VK3GJZI.js} +1 -1
  57. package/dist/chunk-4XOTP5CB.js +2 -0
  58. package/dist/{chunk-PXCARPLZ.js → chunk-55WFJELE.js} +1 -1
  59. package/dist/{chunk-MRBC7GLE.js → chunk-5Z2WLSFM.js} +15 -15
  60. package/dist/{chunk-KB6BGPQK.js → chunk-6GVJ6IKD.js} +1 -1
  61. package/dist/{chunk-7T3COEQK.js → chunk-6KO5VTL7.js} +1 -1
  62. package/dist/{chunk-AZWEWGYG.js → chunk-6V753BUI.js} +3 -3
  63. package/dist/{chunk-FOSCSAJZ.js → chunk-735HKUTV.js} +1 -1
  64. package/dist/chunk-73DAZUJP.js +14 -0
  65. package/dist/{chunk-C6LV3HJW.js → chunk-7DKPJUGU.js} +1 -1
  66. package/dist/{chunk-IGH6DECG.js → chunk-7M7ESM5V.js} +12 -12
  67. package/dist/{chunk-UEMGH6EO.js → chunk-7S2I6ACG.js} +1 -1
  68. package/dist/{chunk-RZT7QES5.js → chunk-A4U4BTN3.js} +4 -4
  69. package/dist/{chunk-EQZAHIUG.js → chunk-ACZZXO5S.js} +2 -2
  70. package/dist/{chunk-5GMWOYTF.js → chunk-AH2AUQYM.js} +1 -1
  71. package/dist/{chunk-AILWMDWP.js → chunk-AJ42UE53.js} +1 -1
  72. package/dist/{chunk-XDG2RWUO.js → chunk-AX7KPMDV.js} +2 -2
  73. package/dist/{chunk-B36HEVMT.js → chunk-AXZEINMF.js} +19 -19
  74. package/dist/{chunk-OAYHU7YN.js → chunk-B4XPFCCQ.js} +2 -2
  75. package/dist/{chunk-JSOO4O5K.js → chunk-B55IXYDR.js} +2 -2
  76. package/dist/chunk-B5VOHZCD.js +1 -0
  77. package/dist/{chunk-MVCNSGM4.js → chunk-BIS5PHHV.js} +2 -2
  78. package/dist/{chunk-3V6UFR7M.js → chunk-BXM72C73.js} +1 -1
  79. package/dist/{chunk-X3II54HU.js → chunk-CDRXZBVR.js} +1 -1
  80. package/dist/{chunk-6SBPGUSR.js → chunk-CFLVEKSH.js} +1 -1
  81. package/dist/{chunk-FBSQABH2.js → chunk-CMYLTCPA.js} +1 -1
  82. package/dist/{chunk-YZCRHDOB.js → chunk-CU2B7G5A.js} +1 -1
  83. package/dist/{chunk-P5QRK7WD.js → chunk-CUT7PAXL.js} +1 -1
  84. package/dist/{chunk-5SULG7D5.js → chunk-D323R2FT.js} +1 -1
  85. package/dist/{chunk-AK632G3F.js → chunk-D5HHU5AO.js} +7 -7
  86. package/dist/{chunk-UELYZT4T.js → chunk-DIKOEJ2Y.js} +1 -1
  87. package/dist/{chunk-CVNM25BM.js → chunk-DLCIGDKC.js} +6 -6
  88. package/dist/chunk-DLS2VCBK.js +3 -0
  89. package/dist/{chunk-QSPW43OC.js → chunk-DMLJOBQS.js} +8 -8
  90. package/dist/chunk-DNKACLRF.js +11 -0
  91. package/dist/{chunk-D6FSZBJ5.js → chunk-DO6XTJ77.js} +1 -1
  92. package/dist/chunk-DZT2O3JD.js +11 -0
  93. package/dist/{chunk-KZ6P7WC6.js → chunk-EAEUSMYL.js} +1 -1
  94. package/dist/{chunk-XSFQR374.js → chunk-ECZT7SIE.js} +1 -1
  95. package/dist/{chunk-VYKITRFG.js → chunk-EDQBTPDF.js} +7 -7
  96. package/dist/{chunk-XBXEK6XP.js → chunk-EKWSGPJ4.js} +7 -7
  97. package/dist/{chunk-JJ6IUIYX.js → chunk-EL3O7ZFQ.js} +1 -1
  98. package/dist/chunk-ERFM5U3M.js +12 -0
  99. package/dist/{chunk-TLJCUUZU.js → chunk-ET32NQHX.js} +1 -1
  100. package/dist/chunk-ETSKG62F.js +1 -0
  101. package/dist/{chunk-XDAR2DSX.js → chunk-EXMFUK3A.js} +8 -8
  102. package/dist/chunk-F2Z6IXMM.js +2 -0
  103. package/dist/{chunk-KS3AQKHD.js → chunk-FPDKMCQH.js} +7 -7
  104. package/dist/{chunk-TF3E5J3Y.js → chunk-GI7FOLDX.js} +1 -1
  105. package/dist/{chunk-DCNXCFAD.js → chunk-H7ZXUGXX.js} +26 -26
  106. package/dist/{chunk-ZLHF5XRR.js → chunk-HJIBTA6V.js} +9 -9
  107. package/dist/{chunk-Z6V3EY6F.js → chunk-HVVPBAP5.js} +3 -3
  108. package/dist/chunk-HYFHCPNJ.js +15 -0
  109. package/dist/{chunk-DBLJIK5J.js → chunk-IAQC775L.js} +1 -1
  110. package/dist/{chunk-J67YIQEN.js → chunk-IGCXJHAK.js} +1 -1
  111. package/dist/{chunk-DBDJQVQM.js → chunk-IJA5ZAGL.js} +1 -1
  112. package/dist/{chunk-YUIWG2QT.js → chunk-IKNNHEVY.js} +1 -1
  113. package/dist/{chunk-EXVR3BWW.js → chunk-IMF537IJ.js} +9 -9
  114. package/dist/{chunk-TKBP5HRY.js → chunk-IPOSLLLU.js} +12 -12
  115. package/dist/{chunk-VXWCX65A.js → chunk-IURSUMDO.js} +8 -8
  116. package/dist/{chunk-7SPX7DLO.js → chunk-IY3CRZRH.js} +16 -16
  117. package/dist/chunk-JGE7S7RQ.js +29 -0
  118. package/dist/{chunk-H5GQWWPA.js → chunk-JYOI66DT.js} +1 -1
  119. package/dist/chunk-K4DZWCUP.js +8 -0
  120. package/dist/{chunk-42BBJJDP.js → chunk-KIBL6M3T.js} +10 -5
  121. package/dist/chunk-KPFOXLN4.js +5 -0
  122. package/dist/chunk-KZEQJVBO.js +3 -0
  123. package/dist/chunk-L2HZ7YXS.js +14 -0
  124. package/dist/chunk-L2YW3END.js +4 -0
  125. package/dist/{chunk-RYC3ZHXM.js → chunk-L65EQCZN.js} +5 -5
  126. package/dist/{chunk-KATRRQD5.js → chunk-L6FLPBU2.js} +5 -5
  127. package/dist/{chunk-3WM23XSR.js → chunk-LDFRVV5R.js} +8 -8
  128. package/dist/{chunk-3KDY6V6I.js → chunk-LMLM4KHQ.js} +8 -8
  129. package/dist/{chunk-LMOPRRQY.js → chunk-LQQMELJM.js} +12 -12
  130. package/dist/{chunk-CQAXN3HN.js → chunk-LVSPLCGG.js} +1 -1
  131. package/dist/{chunk-WGSIYW63.js → chunk-M5BFTFBK.js} +15 -15
  132. package/dist/{chunk-ZDJNTOUS.js → chunk-MEOICYR5.js} +1 -1
  133. package/dist/{chunk-CDBS47XI.js → chunk-MFEJ6TYE.js} +1 -1
  134. package/dist/{chunk-U62AWCZR.js → chunk-MHYOQMBV.js} +1 -1
  135. package/dist/{chunk-RHYMHVFS.js → chunk-MKITHLDU.js} +9 -9
  136. package/dist/chunk-MOOBUMON.js +9 -0
  137. package/dist/{chunk-R6L6PKQP.js → chunk-MTSZ66O4.js} +1 -1
  138. package/dist/{chunk-Q6YPDR7U.js → chunk-MWAYM46R.js} +12 -12
  139. package/dist/{chunk-CHNYSP6K.js → chunk-N6DTTOB6.js} +1 -1
  140. package/dist/{chunk-XXBGWT7L.js → chunk-N7VNKAXZ.js} +1 -1
  141. package/dist/{chunk-F5VXS5JO.js → chunk-NBVF2CXM.js} +1 -1
  142. package/dist/{chunk-VO3HT6IK.js → chunk-NDTMQRR2.js} +1 -1
  143. package/dist/{chunk-MQADQ4YF.js → chunk-NKJDOQVW.js} +1 -1
  144. package/dist/{chunk-QKHTL3FQ.js → chunk-NNKMEF3D.js} +1 -1
  145. package/dist/{chunk-3AVHOYQZ.js → chunk-NRDO5IHL.js} +1 -1
  146. package/dist/{chunk-Q2S76TZH.js → chunk-NSCLFAKK.js} +1 -1
  147. package/dist/{chunk-EVPOZQOI.js → chunk-OCCHDMEV.js} +1 -1
  148. package/dist/chunk-OF6TUQAL.js +7 -0
  149. package/dist/{chunk-DAV7SMCJ.js → chunk-OSSFYFXO.js} +1 -1
  150. package/dist/{chunk-F22KWATP.js → chunk-OSVN2UF7.js} +1 -1
  151. package/dist/{chunk-3RM3D2P3.js → chunk-OTU633XJ.js} +6 -6
  152. package/dist/{chunk-KE6NYTGF.js → chunk-OZF4QAJT.js} +3 -3
  153. package/dist/{chunk-HME2P5VX.js → chunk-OZPYTSPD.js} +23 -23
  154. package/dist/{chunk-MBXTOYMX.js → chunk-P7WUDHIP.js} +6 -6
  155. package/dist/{chunk-ZNZDV6SN.js → chunk-PG6AVBSR.js} +1 -1
  156. package/dist/{chunk-UPHXYWL6.js → chunk-PJCVNFWM.js} +11 -11
  157. package/dist/{chunk-J324R2BM.js → chunk-PTDLNTSK.js} +13 -13
  158. package/dist/{chunk-N7KL336H.js → chunk-PVSGQN5M.js} +6 -6
  159. package/dist/{chunk-47MFBFIX.js → chunk-PWOFYFMO.js} +6 -6
  160. package/dist/{chunk-RQ5RVKRO.js → chunk-QEVIQZIE.js} +2 -2
  161. package/dist/{chunk-4MTC6HA5.js → chunk-RAAUW5OZ.js} +2 -2
  162. package/dist/{chunk-E2YGQAFU.js → chunk-RAI3GTS6.js} +1 -1
  163. package/dist/chunk-RAQESAQZ.js +3 -0
  164. package/dist/{chunk-5JQCPUEO.js → chunk-RCRI6QZV.js} +1 -1
  165. package/dist/{chunk-G3IG4X4Z.js → chunk-RDPUVCXR.js} +1 -1
  166. package/dist/{chunk-4TER5BHR.js → chunk-RZBHO74V.js} +1 -1
  167. package/dist/{chunk-MKTO2FHK.js → chunk-SAKHGHF5.js} +1 -1
  168. package/dist/{chunk-4G5M752L.js → chunk-SXSMIMFY.js} +3 -3
  169. package/dist/{chunk-JSB5G2XQ.js → chunk-THDSOVEH.js} +2 -2
  170. package/dist/{chunk-CHOMUTLT.js → chunk-TT3S2XVQ.js} +1 -1
  171. package/dist/chunk-TW6WEYGO.js +8 -0
  172. package/dist/{chunk-XUK35DKG.js → chunk-U5I7IF72.js} +1 -1
  173. package/dist/{chunk-IM7QHAXT.js → chunk-UFVQ7ZBP.js} +5 -5
  174. package/dist/{chunk-QSW26NAH.js → chunk-UQBPKZUR.js} +1 -1
  175. package/dist/{chunk-F4PESM6A.js → chunk-UY47AKZU.js} +6 -6
  176. package/dist/{chunk-4TL3MRRE.js → chunk-VH6GB73Q.js} +1 -1
  177. package/dist/{chunk-2GPXC6JX.js → chunk-VHAM5TD2.js} +1 -1
  178. package/dist/{chunk-5VUVKP55.js → chunk-VOHZQVFK.js} +6 -6
  179. package/dist/chunk-VT62T6B3.js +19 -0
  180. package/dist/{chunk-IH4SVMXJ.js → chunk-VX4BNYH3.js} +2 -2
  181. package/dist/{chunk-O43QLNPL.js → chunk-VY7EPQEG.js} +1 -1
  182. package/dist/chunk-WBEMN4JG.js +9 -0
  183. package/dist/{chunk-TQP3L4OC.js → chunk-WDXJWC3Y.js} +5 -5
  184. package/dist/{chunk-E4O2ZMXF.js → chunk-WJEDIAG4.js} +1 -1
  185. package/dist/{chunk-7HTURXIA.js → chunk-WRJDHFLD.js} +3 -3
  186. package/dist/chunk-X4EBWJWO.js +1 -0
  187. package/dist/{chunk-4FOTTLL7.js → chunk-XVJCVYDI.js} +2 -2
  188. package/dist/{chunk-NGVODCMV.js → chunk-XWH6KVVB.js} +3 -3
  189. package/dist/chunk-Y5ZWPU4L.js +14 -0
  190. package/dist/{chunk-7RD623PT.js → chunk-YGEK2Z6P.js} +1 -1
  191. package/dist/{chunk-55DONELU.js → chunk-YSHS6QIY.js} +6 -6
  192. package/dist/{chunk-ABD5X73I.js → chunk-YTGWIMXB.js} +1 -1
  193. package/dist/{chunk-2SHDXTB6.js → chunk-YVBFFE4Z.js} +5 -5
  194. package/dist/{chunk-B5MOPSMW.js → chunk-ZBLNVAZ4.js} +3 -3
  195. package/dist/{chunk-BIEKHPZ5.js → chunk-ZDK2JYH5.js} +52 -52
  196. package/dist/{chunk-FFZ7KPIV.js → chunk-ZKOIGLRF.js} +7 -7
  197. package/dist/data/DataTable.js +1 -1
  198. package/dist/data/Kanban.js +1 -1
  199. package/dist/data/ListFooter.js +1 -1
  200. package/dist/data/ListLoadError.js +1 -1
  201. package/dist/data/Pagination.js +1 -1
  202. package/dist/file-intake/index.js +1 -1
  203. package/dist/format/index.js +1 -1
  204. package/dist/forms/AlignmentGrid.js +1 -1
  205. package/dist/forms/BorderInput.js +1 -1
  206. package/dist/forms/BrandAssetEditor.js +1 -1
  207. package/dist/forms/Button.js +1 -1
  208. package/dist/forms/Calendar.js +1 -1
  209. package/dist/forms/ColorPicker.js +1 -1
  210. package/dist/forms/ComposerAttachments.js +1 -1
  211. package/dist/forms/CornersInput.js +1 -1
  212. package/dist/forms/DatePicker.js +1 -1
  213. package/dist/forms/DateRangePicker.js +1 -1
  214. package/dist/forms/DateTimePicker.js +1 -1
  215. package/dist/forms/DisplayChips.js +1 -1
  216. package/dist/forms/FilePicker.js +1 -1
  217. package/dist/forms/FormErrorSummary.js +1 -1
  218. package/dist/forms/IconButton.js +1 -1
  219. package/dist/forms/IconPicker.js +1 -1
  220. package/dist/forms/ImageFocusPoint.js +1 -1
  221. package/dist/forms/InputNumber.js +1 -1
  222. package/dist/forms/LinkPicker.js +1 -1
  223. package/dist/forms/MediaLibrary.d.ts +157 -0
  224. package/dist/forms/MediaLibrary.js +2 -0
  225. package/dist/forms/MediaUploadField.js +1 -1
  226. package/dist/forms/MediaUploadGrid.d.ts +54 -3
  227. package/dist/forms/MediaUploadGrid.js +1 -1
  228. package/dist/forms/MediaUsedInList.js +1 -1
  229. package/dist/forms/NumericKeypad.js +1 -1
  230. package/dist/forms/PictureTiles.js +1 -1
  231. package/dist/forms/PositionInput.js +1 -1
  232. package/dist/forms/Segmented.js +1 -1
  233. package/dist/forms/Select.js +1 -1
  234. package/dist/forms/SidesInput.js +1 -1
  235. package/dist/forms/Slider.js +1 -1
  236. package/dist/forms/Snippet.js +1 -1
  237. package/dist/forms/SplitButton.js +1 -1
  238. package/dist/forms/TagInput.js +1 -1
  239. package/dist/forms/TextToolbar.js +1 -1
  240. package/dist/forms/TimePicker.js +1 -1
  241. package/dist/forms/WidthsBar.js +1 -1
  242. package/dist/forms/mediaLibraryMenu.d.ts +64 -0
  243. package/dist/forms/mediaLibraryMenu.js +2 -0
  244. package/dist/forms/mediaMoveItems.d.ts +42 -3
  245. package/dist/forms/mediaMoveItems.js +1 -1
  246. package/dist/forms/useFileIntake.js +1 -1
  247. package/dist/icons/efficient-glyphs.js +1 -1
  248. package/dist/icons/efficient-looks.js +1 -1
  249. package/dist/icons/efficient.js +1 -1
  250. package/dist/icons/index.js +1 -1
  251. package/dist/icons/looks/map.js +1 -1
  252. package/dist/icons/sets.js +1 -1
  253. package/dist/index.d.ts +4 -2
  254. package/dist/index.js +424 -424
  255. package/dist/locales/zh-Hans.js +1 -1
  256. package/dist/map/index.js +6 -6
  257. package/dist/markdown/index.js +1 -1
  258. package/dist/page-tabs/index.js +5 -5
  259. package/dist/pdf/index.js +1 -1
  260. package/dist/shell/Accordion.js +1 -1
  261. package/dist/shell/AppUpdateBanner.js +1 -1
  262. package/dist/shell/Avatar.js +1 -1
  263. package/dist/shell/Banner.js +1 -1
  264. package/dist/shell/Breadcrumbs.js +1 -1
  265. package/dist/shell/BudgetBar.js +1 -1
  266. package/dist/shell/Card.js +1 -1
  267. package/dist/shell/ColoredBadge.js +1 -1
  268. package/dist/shell/ConfirmDialog.js +1 -1
  269. package/dist/shell/ContainerFillChart.js +1 -1
  270. package/dist/shell/ContextMenu.js +1 -1
  271. package/dist/shell/CountBadge.js +1 -1
  272. package/dist/shell/Dialog.js +1 -1
  273. package/dist/shell/Drawer.js +1 -1
  274. package/dist/shell/DropdownMenu.js +1 -1
  275. package/dist/shell/EditableGrid.js +1 -1
  276. package/dist/shell/EmptyState.js +1 -1
  277. package/dist/shell/GlobalSearch.js +1 -1
  278. package/dist/shell/HelpCenter.js +1 -1
  279. package/dist/shell/IconRail.js +1 -1
  280. package/dist/shell/ImageLightbox.js +1 -1
  281. package/dist/shell/LanguageSelect.js +1 -1
  282. package/dist/shell/Markdown.js +1 -1
  283. package/dist/shell/MetricBar.js +1 -1
  284. package/dist/shell/MetricBarLegend.js +1 -1
  285. package/dist/shell/MilestoneTimeline.js +1 -1
  286. package/dist/shell/PageHeader.js +1 -1
  287. package/dist/shell/PopupMenu.js +1 -1
  288. package/dist/shell/ProductionTimeline.js +1 -1
  289. package/dist/shell/ResizeHandle.js +1 -1
  290. package/dist/shell/Result.js +1 -1
  291. package/dist/shell/SearchableSelect.js +1 -1
  292. package/dist/shell/SettingReset.js +1 -1
  293. package/dist/shell/SettingRow.js +1 -1
  294. package/dist/shell/SidebarLayout.js +1 -1
  295. package/dist/shell/SidebarNav.js +1 -1
  296. package/dist/shell/SortableList.js +1 -1
  297. package/dist/shell/Statistic.js +1 -1
  298. package/dist/shell/StatusBadge.js +1 -1
  299. package/dist/shell/StepChain.js +1 -1
  300. package/dist/shell/Stepper.js +1 -1
  301. package/dist/shell/Tabs.js +1 -1
  302. package/dist/shell/TimeAgo.js +1 -1
  303. package/dist/shell/TimelineTrack.js +1 -1
  304. package/dist/shell/Tooltip.d.ts +9 -1
  305. package/dist/shell/Tooltip.js +1 -1
  306. package/dist/shell/TopNav.js +1 -1
  307. package/dist/shell/TransferProgress.js +1 -1
  308. package/dist/shell/Tree.js +1 -1
  309. package/dist/shell/language.js +1 -1
  310. package/dist/shell/strings.d.ts +88 -0
  311. package/dist/shell/strings.js +1 -1
  312. package/dist/shell/toast.js +1 -1
  313. package/dist/telemetry/index.js +1 -1
  314. package/dist/templates/AuthScreen.js +1 -1
  315. package/dist/templates/ChatTemplate.js +1 -1
  316. package/dist/templates/CheckoutTemplate.js +1 -1
  317. package/dist/templates/DashboardTemplate.js +1 -1
  318. package/dist/templates/DataTablePage.js +1 -1
  319. package/dist/templates/EmailTemplate.js +1 -1
  320. package/dist/templates/ErrorBoundary.js +1 -1
  321. package/dist/templates/ErrorPage.js +1 -1
  322. package/dist/templates/FormLayoutPage.js +1 -1
  323. package/dist/templates/GalleryTemplate.js +1 -1
  324. package/dist/ui/index.d.ts +4 -2
  325. package/dist/ui/index.js +1 -1
  326. package/dist/version.js +1 -1
  327. package/package.json +1 -1
  328. package/dist/Calculator-PH6NVEEZ.js +0 -29
  329. package/dist/PdfViewer-GODDA4GG.js +0 -1
  330. package/dist/Sidebar-SJMMY2Y2.js +0 -43
  331. package/dist/chunk-2LXTJXWC.js +0 -6
  332. package/dist/chunk-36DYXGQI.js +0 -7
  333. package/dist/chunk-3NWCVZRK.js +0 -10
  334. package/dist/chunk-3P7SBAKK.js +0 -3
  335. package/dist/chunk-6UOMJ7E4.js +0 -2
  336. package/dist/chunk-ABDT4M5L.js +0 -19
  337. package/dist/chunk-BZWTFLQD.js +0 -15
  338. package/dist/chunk-CIGHIX6Z.js +0 -14
  339. package/dist/chunk-DAJTVAWO.js +0 -11
  340. package/dist/chunk-ENVCMR3M.js +0 -5
  341. package/dist/chunk-H5VGRHNT.js +0 -9
  342. package/dist/chunk-HLGE6TVE.js +0 -4
  343. package/dist/chunk-HMZLRXLA.js +0 -1
  344. package/dist/chunk-JH4W3R4Q.js +0 -11
  345. package/dist/chunk-KKZZAK76.js +0 -1
  346. package/dist/chunk-LYLEH25Y.js +0 -1
  347. package/dist/chunk-NI76QOA2.js +0 -2
  348. package/dist/chunk-NZ67C5OK.js +0 -12
  349. package/dist/chunk-OHSJWKNV.js +0 -14
  350. package/dist/chunk-Q75PSCZ5.js +0 -20
  351. package/dist/chunk-SIQSD3QT.js +0 -8
  352. package/dist/chunk-TCB2J3PS.js +0 -9
  353. package/dist/chunk-UDD7GB4F.js +0 -2
  354. package/dist/chunk-WMO2JQNL.js +0 -8
  355. package/dist/chunk-WOHOIJRZ.js +0 -3
  356. package/dist/chunk-X7ZBGXUU.js +0 -1
  357. /package/dist/{chunk-PCGZS6S4.js → chunk-276AUQNN.js} +0 -0
@@ -1,59 +1,59 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as d}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as m}from"./chunk-PXCARPLZ.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-Y53KNQKL.js";import{CopyButton as w}from"./chunk-3AVHOYQZ.js";import{confirm as y}from"./chunk-MRBC7GLE.js";import{dialogA11y as g}from"./chunk-VWGWZY7A.js";import{useShellPrefs as b}from"./chunk-KC3EX26K.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-UPHXYWL6.js";import{ColoredBadge as C}from"./chunk-CDBS47XI.js";import{useIsMobile as M,useIsPhone as N}from"./chunk-UGTRSRIW.js";import{StatusBadge as S}from"./chunk-5SULG7D5.js";import{focusableIn as L}from"./chunk-CDAJKLGL.js";import{Button_default as T}from"./chunk-UDD7GB4F.js";import{Icon as z}from"./chunk-42BBJJDP.js";import{LoadingSpinner as A}from"./chunk-Q5MD3VY6.js";import{Z_LAYERS as D}from"./chunk-62LW225J.js";import{runEscapeInterceptors as P}from"./chunk-TWVUQUUD.js";import{useShellStrings as I}from"./chunk-KKZZAK76.js";import{createContext as W,useContext as K,Component as $,useLayoutEffect as R,useRef as O,useEffect as j,useState as F,useSyncExternalStore as q,useCallback as B,isValidElement as H,Fragment as U,Children as Y,cloneElement as X,useMemo as V,useId as G,useReducer as _,Suspense as J}from"react";import{jsxs as Q,jsx as Z,Fragment as ee}from"react/jsx-runtime";import{createPortal as te}from"react-dom";import{useLocation as ne}from"react-router-dom";import{useQueryClient as re,useQuery as oe}from"@tanstack/react-query";function ie(e){return"component"in e}function ae(e){return"endpoint"in e}var se={};function le(e){se=e}var ce=new Proxy({},{get:(e,t)=>se[t],has:(e,t)=>t in se,ownKeys:()=>Object.keys(se),getOwnPropertyDescriptor(e,t){if(t in se)return{configurable:!0,enumerable:!0,value:se[t]}}}),ue=null;function de(e){ue=e}function he(){return null!==ue}var me=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),pe=new Proxy({},{get:(e,t)=>ue?ue[t]:"string"==typeof t&&me.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),fe=W(null);function we(){return K(fe)?.pageSearch??""}var ye=null,ge=/* @__PURE__ */new Set;function be(e){ye!==e&&(ye=e,ge.forEach(e=>e()))}function ve(){return ye}function xe(e){return ge.add(e),()=>{ge.delete(e)}}var ke=null;function Ee(e){ke=e}function Ce({error:e,onReload:t}){const n=h(e);/* @__PURE__ */
1
+ import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{isStaleChunkError as d}from"./chunk-JDCM2VHG.js";import{reportBoundaryError as h}from"./chunk-KNUR2UEG.js";import{Result as m}from"./chunk-55WFJELE.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-Y53KNQKL.js";import{CopyButton as w}from"./chunk-NRDO5IHL.js";import{confirm as y}from"./chunk-5Z2WLSFM.js";import{dialogA11y as g}from"./chunk-VWGWZY7A.js";import{PopupMenu as b,PopupMenuItem as v,PopupMenuDivider as x,PopupMenuLabel as k}from"./chunk-PJCVNFWM.js";import{useIsMobile as E,useIsPhone as C}from"./chunk-UGTRSRIW.js";import{ColoredBadge as M}from"./chunk-MFEJ6TYE.js";import{useShellPrefs as N}from"./chunk-KC3EX26K.js";import{focusableIn as S}from"./chunk-CDAJKLGL.js";import{StatusBadge as L}from"./chunk-D323R2FT.js";import{Button_default as T}from"./chunk-4IU5BSVE.js";import{Icon as z}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as A}from"./chunk-Q5MD3VY6.js";import{Z_LAYERS as D}from"./chunk-62LW225J.js";import{runEscapeInterceptors as P}from"./chunk-TWVUQUUD.js";import{useShellStrings as I}from"./chunk-ETSKG62F.js";import{createContext as W,useContext as K,Component as $,useLayoutEffect as R,useRef as O,useEffect as F,useState as j,useSyncExternalStore as q,useCallback as B,isValidElement as H,Fragment as Y,Children as U,cloneElement as X,useMemo as V,useId as _,useReducer as J,Suspense as G}from"react";import{jsxs as Q,jsx as Z,Fragment as ee}from"react/jsx-runtime";import{createPortal as te}from"react-dom";import{useLocation as ne}from"react-router-dom";import{useQueryClient as re,useQuery as oe}from"@tanstack/react-query";function ie(e){return"component"in e}function ae(e){return"endpoint"in e}var se={};function le(e){se=e}var ce=new Proxy({},{get:(e,t)=>se[t],has:(e,t)=>t in se,ownKeys:()=>Object.keys(se),getOwnPropertyDescriptor(e,t){if(t in se)return{configurable:!0,enumerable:!0,value:se[t]}}}),ue=null;function de(e){ue=e}function he(){return null!==ue}var me=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),pe=new Proxy({},{get:(e,t)=>ue?ue[t]:"string"==typeof t&&me.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),fe=W(null);function we(){return K(fe)?.pageSearch??""}var ye=null,ge=/* @__PURE__ */new Set;function be(e){ye!==e&&(ye=e,ge.forEach(e=>e()))}function ve(){return ye}function xe(e){return ge.add(e),()=>{ge.delete(e)}}var ke=null;function Ee(e){ke=e}function Ce({error:e,onReload:t}){const n=d(e);/* @__PURE__ */
2
2
  return Q("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
3
  /* @__PURE__ */Z(z,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */Q("div",{className:"min-w-0",children:[
5
5
  /* @__PURE__ */Z("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
6
  /* @__PURE__ */Z("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
7
- /* @__PURE__ */Z("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Me=class extends ${state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),d(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */Z(Ce,{error:e,onReload:this.reset}):this.props.children}},Ne=W(null),Se="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Le({className:e="",auto:t=!1}){const n=K(Ne),r=I().undo,o=n?.claimOwnMount;if(R(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
7
+ /* @__PURE__ */Z("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Me=class extends ${state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),h(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */Z(Ce,{error:e,onReload:this.reset}):this.props.children}},Ne=W(null),Se="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Le({className:e="",auto:t=!1}){const n=K(Ne),r=I().undo,o=n?.claimOwnMount;if(R(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
8
8
  return Q("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
9
  /* @__PURE__ */Z("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",p):r.nothingToUndo,className:Se,children:r.undo}),
10
10
  /* @__PURE__ */Z("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",f):r.nothingToRedo,className:Se,children:r.redo})]})}var Te=/* @__PURE__ */new Set([408,429]);function ze(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ae(e){const t=ze(e);return null!=t&&(t>=400&&t<500&&!Te.has(t))}function De(e,t){return!Ae(t)&&e<3}function Pe(e){if("page"!==e.type)return!0;const t=e.route?ce[e.route]:void 0;if(!t||!ie(t))return!0;const n=t;return!n.widget&&!n.utility}function Ie(e){const t=e.route?ce[e.route]:void 0;if(!t||!ie(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var We=(e,t)=>!!t&&"page"===e.type&&e.route===t;function Ke(){const e=I().loading;/* @__PURE__ */
11
11
  return Z(A,{size:"sm",padding:"p-8",label:e.label})}var $e="flex-1 min-h-0";function Re(){const e=I().record;/* @__PURE__ */
12
- return Z(A,{label:e.loading,padding:"",className:$e})}function Oe(e){return e??void 0}function je({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=I().record;if(t||e&&n)/* @__PURE__ */return Z(Re,{});if(r){const e=ze(r);if(401===e)/* @__PURE__ */
12
+ return Z(A,{label:e.loading,padding:"",className:$e})}function Oe(e){return e??void 0}function Fe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=I().record;if(t||e&&n)/* @__PURE__ */return Z(Re,{});if(r){const e=ze(r);if(401===e)/* @__PURE__ */
13
13
  return Z(m,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:$e});if(403===e)/* @__PURE__ */
14
14
  return Z(m,{status:"403",className:$e});if(404===e||410===e)/* @__PURE__ */
15
15
  return Z(m,{status:"404",title:i.notFound,className:$e});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
16
  return Z(m,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */Z(T,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:$e})}/* @__PURE__ */
17
- return Z(m,{status:"404",title:i.notFound,className:$e})}function Fe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */Z(ee,{children:t(e)}):/* @__PURE__ */Z(je,{...n})}var qe=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Be(e){return"string"==typeof e&&(e.startsWith("new-")||qe.test(e))}function He(e){if(Be(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Ue=W({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ye=W(null);function Xe(e){const t=K(Ye),n=O(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),R(()=>{if(t)return t(n.current,e)},[t,e]),j(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Ve(){const e=O(/* @__PURE__ */new Map),[t,n]=F(!1);return{dirty:t,registerDirty:B((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function Ge(){return K(Ue)}function _e(e){if("page"!==e.type&&He(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Je({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Ve(),i=ce[e.route];if(!i||!ie(i))return null;const a=i,s=a.component;/* @__PURE__ */
18
- return Z(Yr,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */Z(Ye.Provider,{value:o,children:/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */Z(Ke,{})}),children:/* @__PURE__ */Z(s,{})})})})}function Qe({entityType:e,entityId:t,label:n}){const r=I(),o=re(),{data:i}=oe({queryKey:["my-profile-sidebar"],enabled:he(),queryFn:()=>pe.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
- return Z("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];pe.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */Z(z,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ze=/* @__PURE__ */new Set;function et({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=ce[e.entityType];if(!o||!ae(o))return null;const i=o,[a,s]=F(!1),{dirty:l,registerDirty:u}=Ve(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Be(e.entityId),p=!i.selfFetching&&!h&&!m&&he(),f=oe({queryKey:[d,e.entityId],queryFn:()=>{return pe.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Oe(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ae(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:De}),w=f.data,y=f.refetch;j(()=>{var t;if(p)return t=t=>{t!==e.id||Ze.has(t)||y({cancelRefetch:!1})},_n.add(t),()=>{_n.delete(t)}},[y,e.id,p]);const g=B(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z(Ke,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z(Yr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */Z(Re,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */Z(Yr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */Z(je,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */Z(Yr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */Z(Ye.Provider,{value:u,children:/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z(Re,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */Z(Fe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function tt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function nt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function rt(e){const t=tt(e),n=t??nt(e);if(!n)return;if(t&&!lr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Jn(o)}function ot(){const e=kr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var it=/* @__PURE__ */new Map;function at(){const e=ot();if(e)return it.get(e)}function st(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var lt="rosh-peek-style",ct=D.peek,ut=D.taskbarPreview;function dt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(lt))return;const e=document.createElement("style");e.id=lt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${ct}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ht(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function mt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=I(),l=O(null),[c,u]=F({w:n,h:Math.round(.75*r)}),[d,h]=F(!1);return R(()=>{const o=l.current;if(!o)return;const i=tt(e)??st(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */Q("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
17
+ return Z(m,{status:"404",title:i.notFound,className:$e})}function je({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */Z(ee,{children:t(e)}):/* @__PURE__ */Z(Fe,{...n})}var qe=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Be(e){return"string"==typeof e&&(e.startsWith("new-")||qe.test(e))}function He(e){if(Be(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Ye=W({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ue=W(null);function Xe(e){const t=K(Ue),n=O(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),R(()=>{if(t)return t(n.current,e)},[t,e]),F(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Ve(){const e=O(/* @__PURE__ */new Map),[t,n]=j(!1);return{dirty:t,registerDirty:B((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function _e(){return K(Ye)}function Je(e){if("page"!==e.type&&He(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Ge({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Ve(),i=ce[e.route];if(!i||!ie(i))return null;const a=i,s=a.component;/* @__PURE__ */
18
+ return Z(Ur,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */Z(Ue.Provider,{value:o,children:/* @__PURE__ */Z(G,{fallback:/* @__PURE__ */Z("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */Z(Ke,{})}),children:/* @__PURE__ */Z(s,{})})})})}function Qe({entityType:e,entityId:t,label:n}){const r=I(),o=re(),{data:i}=oe({queryKey:["my-profile-sidebar"],enabled:he(),queryFn:()=>pe.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
+ return Z("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];pe.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */Z(z,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ze=/* @__PURE__ */new Set;function et({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=ce[e.entityType];if(!o||!ae(o))return null;const i=o,[a,s]=j(!1),{dirty:l,registerDirty:u}=Ve(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Be(e.entityId),p=!i.selfFetching&&!h&&!m&&he(),f=oe({queryKey:[d,e.entityId],queryFn:()=>{return pe.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Oe(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ae(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:De}),w=f.data,y=f.refetch;F(()=>{var t;if(p)return t=t=>{t!==e.id||Ze.has(t)||y({cancelRefetch:!1})},Jn.add(t),()=>{Jn.delete(t)}},[y,e.id,p]);const g=B(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */Z(G,{fallback:/* @__PURE__ */Z(Ke,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */Z(G,{fallback:/* @__PURE__ */Z(Ur,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */Z(Re,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */Z(Ur,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */Z(Fe,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */Z(Ur,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */Z(Ue.Provider,{value:u,children:/* @__PURE__ */Z(G,{fallback:/* @__PURE__ */Z(Re,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */Z(je,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function tt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function nt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function rt(e){const t=tt(e),n=t??nt(e);if(!n)return;if(t&&!lr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Gn(o)}function ot(){const e=kr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var it=/* @__PURE__ */new Map;function at(){const e=ot();if(e)return it.get(e)}function st(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var lt="rosh-peek-style",ct=D.peek,ut=D.taskbarPreview;function dt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(lt))return;const e=document.createElement("style");e.id=lt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${ct}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ht(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function mt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=I(),l=O(null),[c,u]=j({w:n,h:Math.round(.75*r)}),[d,h]=j(!1);return R(()=>{const o=l.current;if(!o)return;const i=tt(e)??st(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */Q("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
20
20
  /* @__PURE__ */Z("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */Q("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
21
21
  /* @__PURE__ */Z(z,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
- /* @__PURE__ */Z("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */Z("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */Z("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */Z(z,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function pt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=I(),s=e.length>1,l=O(null),[c,u]=F({left:-9999,top:-9999,ready:!1}),[d,h]=F(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");R(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),j(()=>ht,[]);const m="top"===d,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return te(
22
+ /* @__PURE__ */Z("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */Z("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */Z("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */Z(z,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function pt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=I(),s=e.length>1,l=O(null),[c,u]=j({left:-9999,top:-9999,ready:!1}),[d,h]=j(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");R(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),F(()=>ht,[]);const m="top"===d,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return te(
23
23
  /* @__PURE__ */Z("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:ut,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ht(),i()},children:e.map(e=>{const t=tt(e.id)??st(e.label),o=t?function(e){if(lr(e))return null;const t=e.getBoundingClientRect(),n=nr(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
24
24
  return Q("div",{className:"group flex flex-col items-center",onMouseEnter:()=>dt(t),children:[!m&&/* @__PURE__ */Z("span",{className:p,children:e.label}),
25
25
  /* @__PURE__ */Z(mt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */Z("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */Q("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-white shadow-sm",children:[
26
- /* @__PURE__ */Z(z,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function ft(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function wt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=I(),[a,s]=F(null);j(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=q(Er,kr),[,u]=F(0);j(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=F(0);j(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=st(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=F(null),[f,w]=F(null),[y,g]=F(null),b=O(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!ce[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?ce[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return te(
26
+ /* @__PURE__ */Z(z,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function ft(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function wt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=I(),[a,s]=j(null);F(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=q(Er,kr),[,u]=j(0);F(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=j(0);F(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=st(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=j(null),[f,w]=j(null),[y,g]=j(null),E=O(null),C=()=>{E.current&&(clearTimeout(E.current),E.current=null),E.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!ce[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?ce[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return te(
27
27
  /* @__PURE__ */Q(ee,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,u=e.items.some(e=>{const t=tt(e.id)??st(e.label);return!!t&&!lr(t)});/* @__PURE__ */
28
- return Q("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&H(n)?X(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */Z(z,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
28
+ return Q("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(E.current&&(clearTimeout(E.current),E.current=null),E.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),E.current&&(clearTimeout(E.current),E.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&H(n)?X(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */Z(z,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
29
  /* @__PURE__ */Z("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */Z("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */Z("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */Z("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */Z(z,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
30
30
  /* @__PURE__ */Z("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */Q("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
31
- /* @__PURE__ */Z(z,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */Q(v,{portal:!0,minWidth:200,style:ft(y.x,y.y),onClose:()=>g(null),children:[
32
- /* @__PURE__ */Z(E,{children:y.label}),
33
- /* @__PURE__ */Q(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Wn.get(e);t&&Qn(t)}(e.id))},children:[
31
+ /* @__PURE__ */Z(z,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */Q(b,{portal:!0,minWidth:200,style:ft(y.x,y.y),onClose:()=>g(null),children:[
32
+ /* @__PURE__ */Z(k,{children:y.label}),
33
+ /* @__PURE__ */Q(v,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Wn.get(e);t&&Qn(t)}(e.id))},children:[
34
34
  /* @__PURE__ */Z(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
35
- /* @__PURE__ */Q(x,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
35
+ /* @__PURE__ */Q(v,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
36
36
  /* @__PURE__ */Z("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */Z("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
37
- /* @__PURE__ */Z(k,{}),
38
- /* @__PURE__ */Q(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
39
- /* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */Z(pt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var yt=["/login","/forgot-password","/reset-password","/force-change-password"];function gt({children:e,windowAccentForRoute:t}){const n=ne(),r=yt.some(e=>n.pathname.startsWith(e)),[o,i]=F([]),a=O(o);R(()=>{a.current=o},[o]);const s=q(xe,ve,ve),l=O(/* @__PURE__ */new Map),c=e=>{const t=Pe(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};j(()=>{it.clear();for(const e of o)e.route&&it.set(e.id,e.route)},[o]);const u=B(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=B(e=>{var t;tt(e)||nt(e)?(t=e,window.dispatchEvent(new CustomEvent(Cr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=zn;t&&Ze.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(An.get(i)??-1)>a)||Jn(o),t&&Ze.delete(e)},50)},m=(e,t,n)=>{const r=ke;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Pe(t))return e.length;if(t.shellOwned&&We(t,n.home))return 0;const r=We(t,n.home)?void 0:Ie(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Pe(e)&&!We(e,n.home)&&Ie(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!We(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&We(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Pe(e[t])&&!We(e[t],n.home)?Ie(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:ve(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=B(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=B((e,t,n,r,o,a={})=>{if(!ce[e]||!ae(ce[e]))return;const s=`${e}:${t}`,l=ot();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Oe(n),openedFrom:l},!!a.append))})},[]),w=B((e,t={})=>{if(!ce[e]||!ie(ce[e]))return;const n=ce[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,jn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=ot();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=B(()=>{},[]),g=B(()=>{},[]),b=d,v=d;/* @__PURE__ */
40
- return Q(Ue.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindows:p,closeEntity:b,minimize:y,items:[],openItems:o,restore:g,remove:v,restoreIfMinimized:()=>!1},children:[e,
41
- /* @__PURE__ */Z(wt,{openWindows:o,onRemove:d,onSplitView:Hr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Jn(e)}})},onActivateById:rt}),
42
- /* @__PURE__ */Z(Ur,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
37
+ /* @__PURE__ */Z(x,{}),
38
+ /* @__PURE__ */Q(v,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
39
+ /* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */Z(pt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{E.current&&(clearTimeout(E.current),E.current=null)},onMouseLeave:C})]}),a)}var yt=["/login","/forgot-password","/reset-password","/force-change-password"];function gt({children:e,windowAccentForRoute:t}){const n=ne(),r=yt.some(e=>n.pathname.startsWith(e)),[o,i]=j([]),a=O(o);R(()=>{a.current=o},[o]);const s=q(xe,ve,ve),l=O(/* @__PURE__ */new Map),c=e=>{const t=Pe(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};F(()=>{it.clear();for(const e of o)e.route&&it.set(e.id,e.route)},[o]);const u=B(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=B(e=>{var t;tt(e)||nt(e)?(t=e,window.dispatchEvent(new CustomEvent(Cr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=zn;t&&Ze.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(An.get(i)??-1)>a)||Gn(o),t&&Ze.delete(e)},50)},m=(e,t,n)=>{const r=ke;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Pe(t))return e.length;if(t.shellOwned&&We(t,n.home))return 0;const r=We(t,n.home)?void 0:Ie(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Pe(e)&&!We(e,n.home)&&Ie(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!We(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&We(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Pe(e[t])&&!We(e[t],n.home)?Ie(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:ve(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=B(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=B((e,t,n,r,o,a={})=>{if(!ce[e]||!ae(ce[e]))return;const s=`${e}:${t}`,l=ot();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Oe(n),openedFrom:l},!!a.append))})},[]),w=B((e,t={})=>{if(!ce[e]||!ie(ce[e]))return;const n=ce[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Fn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=ot();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=B(()=>{},[]),g=B(()=>{},[]),b=d,v=d;/* @__PURE__ */
40
+ return Q(Ye.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindows:p,closeEntity:b,minimize:y,items:[],openItems:o,restore:g,remove:v,restoreIfMinimized:()=>!1},children:[e,
41
+ /* @__PURE__ */Z(wt,{openWindows:o,onRemove:d,onSplitView:Hr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Gn(e)}})},onActivateById:rt}),
42
+ /* @__PURE__ */Z(Yr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
43
43
  /* @__PURE__ */
44
- return Z(fe.Provider,{value:c(e),children:/* @__PURE__ */Z(Me,{fallback:(t,n)=>/* @__PURE__ */Z(Yr,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Z(Ce,{error:t,onReload:n})}),children:/* @__PURE__ */Z(Vt,{spec:_e(e),children:/* @__PURE__ */Z(Zr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Z(Je,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */Z(et,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var bt=400;function vt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=O(null),s=O(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=O(!1),c=O(void 0),u=O(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},bt)};j(()=>{n&&!r&&h()},[n,r]),j(()=>{d&&n&&!r&&h()},[d]),j(()=>()=>clearTimeout(c.current),[]),j(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;const s=t.current?L(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),R(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var xt=null,kt=/* @__PURE__ */new Set;function Et(){return xt}function Ct(e){if(xt!==e){xt=e;for(const e of kt)e()}}function Mt(e){return kt.add(e),()=>{kt.delete(e)}}var Nt=!1,St={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Lt=()=>{};function Tt(e){Nt=e,St={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function zt(e,t){Nt&&("submenu"===e?St.submenus++:St.menus++,St.menuKey=t)}function At(e){if(!Nt)return Lt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Nt)return;const r=performance.now()-t;"move"===e?St.moveMs+=r:St.resizeMs+=r}}function Dt(){const e=St;return St={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Pt=/* @__PURE__ */new Set([S,C]),It=e=>Pt.has(e)||"function"==typeof e&&"badge"===e.titleRole,Wt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Kt=/* @__PURE__ */new Set(["svg"]);function $t(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Rt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Rt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Rt(e,t,n));if(!H(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===U)return void Y.toArray(r.props.children).forEach(e=>Rt(e,t,n));if("string"==typeof r.type){if(Kt.has(r.type))return;if(!Wt.has(r.type))return n.push(" "),Y.toArray(r.props.children).forEach(e=>Rt(e,t,n)),void n.push(" ")}const o=X(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(It(r.type)?t.badges:t.actions).push(o)}var Ot=/* @__PURE__ */new Map,jt=/* @__PURE__ */new Set,Ft=0;function qt(){Ft++,jt.forEach(e=>e())}function Bt(e){return Ot.get(e)}function Ht(e){return jt.add(e),()=>{jt.delete(e)}}function Ut(){return Ft}var Yt=W(""),Xt=W(null);function Vt({spec:e,children:t}){/* @__PURE__ */
45
- return Z(Xt.Provider,{value:e,children:t})}var Gt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),_t='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Jt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Qt(e){return Zt(e).replace(/\s+/g," ").trim()}function Zt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Zt).join("");if(H(e)){const t=e,n="string"==typeof t.type?t.type:"";return Gt.has(n)?"":` ${Zt(t.props?.children)} `}return""}function en(e){const t=K(Yt);j(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var tn={};function nn(e,t,n){const r=K(Yt);j(()=>{if(!r)return;tn[r]||(tn[r]=[]);const o={label:e,icon:n,onClick:t};return tn[r].push(o),()=>{tn[r]=(tn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function rn({title:e}){const t=O(null);return j(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */Z("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function on(e){}var an=W(null);function sn(){return K(Yt)}function ln(){const e=q(Er,kr),t=K(an);return t?.active??(Sn.length<=1||null!=e)}function cn({children:e,position:t="right",quiet:n=!1}){const r=K(an),[o,i]=F(null);return j(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?te(e,o):null}function un({onClick:e,children:t,className:n}){const r=K(an);/* @__PURE__ */
46
- return Z("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var dn="erp_window_positions",hn={};try{const e=localStorage.getItem(dn);e&&(hn=JSON.parse(e))}catch{}var mn=null;function pn(){mn&&clearTimeout(mn),mn=setTimeout(()=>{try{localStorage.setItem(dn,JSON.stringify(hn))}catch{}},500)}var fn="erp_activation_order",wn=[];try{const e=localStorage.getItem(fn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(wn=t)}catch{}var yn=null;function gn(){yn&&clearTimeout(yn),yn=setTimeout(()=>{try{localStorage.setItem(fn,JSON.stringify(wn))}catch{}},500)}function bn(e,t){hn[e]||(hn[e]=t,pn())}function vn(e){return hn[e]?{...hn[e]}:null}function xn(e,t){hn[e]=t,pn()}function kn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(hn))n(hn[e],r,o)&&(delete hn[e],i=!0);i&&pn()}var En={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Cn=4e3,Mn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},Nn={small:.8,medium:1,large:1.25,maximized:1.25},Sn=[],Ln=/* @__PURE__ */new Set,Tn=/* @__PURE__ */new Set,zn=0,An=/* @__PURE__ */new Map;var Dn=0;function Pn(){return Dn}function In(){Dn++,Ln.forEach(e=>e())}var Wn=/* @__PURE__ */new Map,Kn=/* @__PURE__ */new Map,$n=/* @__PURE__ */new Map;function Rn(){for(let e=Sn.length-1;e>=0;e--){const t=$n.get(Sn[e]);if(t?.tab)return t.owner}return null}function On(){return q(Er,Rn,()=>null)}var jn=/* @__PURE__ */new Set;var Fn=null;function qn(e){Fn=null,Jn(e)}function Bn(e){Fn=e;const t=Wn.get(e);t&&qn(t)}var Hn=/* @__PURE__ */new Map;function Un(e){return Hn.get(e)?.holdsChanges()??!1}function Yn(e){const t=Hn.get(e);return t?t.ask():Promise.resolve(!0)}function Xn(e){Fn===e&&(Fn=null)}function Vn(e,t,n){if(n&&$n.set(e,n),t)if(Wn.set(t,e),Kn.set(e,t),jn.delete(t)){Sn.unshift(e);const n=wn.indexOf(t);-1!==n&&wn.splice(n,1),wn.unshift(t),gn()}else!function(e,t){const n=wn.indexOf(t);if(-1===n)return void Sn.push(e);let r=Sn.length;for(let e=0;e<Sn.length;e++){const t=Kn.get(Sn[e]);if(t&&wn.indexOf(t)>n){r=e;break}}Sn.splice(r,0,e)}(e,t),-1===wn.indexOf(t)&&(wn.push(t),gn());else Sn.push(e);In(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Fn===t&&qn(e)}function Gn(e){return e?$n.get(e)?.owner??Kn.get(e)??null:null}var _n=/* @__PURE__ */new Set;function Jn(e){const t=Gn(kr()),n=Sn.indexOf(e);-1!==n&&Sn.splice(n,1),Sn.push(e);const o=$n.get(e);if(o?.root&&o.tab&&r()){const e=Sn.filter(e=>{const t=$n.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)Sn.splice(Sn.indexOf(t),1),Sn.push(t)}Tn.delete(e);const i=Kn.get(e);if(i){const e=wn.indexOf(i);-1!==e&&wn.splice(e,1),wn.push(i),gn(),Fn&&Fn!==i&&(Fn=null)}In(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=Gn(kr());a&&a!==t&&_n.forEach(e=>e(a))}function Qn(e){const t=Sn.indexOf(e);-1!==t&&Sn.splice(t,1),Tn.add(e),An.set(e,++zn);const n=Kn.get(e);if(n){const e=wn.indexOf(n);-1!==e&&(wn.splice(e,1),gn())}In(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Zn=/* @__PURE__ */new Set;var er=8,tr=32;function nr(){return e()}var rr=u.windowBar,or=80,ir=384,ar=400;function sr(e,t=nr()){const n=Math.min(Math.max(e.x,t.x+or-e.w),t.x+t.w-or),r=Math.min(Math.max(e.y,t.y),t.y+t.h-rr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function lr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=nr();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function cr(e){const t=nr(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var ur=null;function dr(e){const t=(ur||((ur=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${D.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(ur)),ur);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function hr(){ur&&(ur.style.opacity="0",ur.style.display="none")}var mr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],pr=350,fr=200;function wr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=F(!1),s=O(void 0),l=O(void 0);j(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),pr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),fr)};/* @__PURE__ */
44
+ return Z(fe.Provider,{value:c(e),children:/* @__PURE__ */Z(Me,{fallback:(t,n)=>/* @__PURE__ */Z(Ur,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Z(Ce,{error:t,onReload:n})}),children:/* @__PURE__ */Z(Vt,{spec:Je(e),children:/* @__PURE__ */Z(Zr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Z(Ge,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */Z(et,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var bt=400;function vt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=O(null),s=O(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=O(!1),c=O(void 0),u=O(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},bt)};F(()=>{n&&!r&&h()},[n,r]),F(()=>{d&&n&&!r&&h()},[d]),F(()=>()=>clearTimeout(c.current),[]),F(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;const s=t.current?S(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),R(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var xt=null,kt=/* @__PURE__ */new Set;function Et(){return xt}function Ct(e){if(xt!==e){xt=e;for(const e of kt)e()}}function Mt(e){return kt.add(e),()=>{kt.delete(e)}}var Nt=!1,St={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Lt=()=>{};function Tt(e){Nt=e,St={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function zt(e,t){Nt&&("submenu"===e?St.submenus++:St.menus++,St.menuKey=t)}function At(e){if(!Nt)return Lt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Nt)return;const r=performance.now()-t;"move"===e?St.moveMs+=r:St.resizeMs+=r}}function Dt(){const e=St;return St={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Pt=/* @__PURE__ */new Set([L,M]),It=e=>Pt.has(e)||"function"==typeof e&&"badge"===e.titleRole,Wt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Kt=/* @__PURE__ */new Set(["svg"]);function $t(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Rt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Rt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Rt(e,t,n));if(!H(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===Y)return void U.toArray(r.props.children).forEach(e=>Rt(e,t,n));if("string"==typeof r.type){if(Kt.has(r.type))return;if(!Wt.has(r.type))return n.push(" "),U.toArray(r.props.children).forEach(e=>Rt(e,t,n)),void n.push(" ")}const o=X(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(It(r.type)?t.badges:t.actions).push(o)}var Ot=/* @__PURE__ */new Map,Ft=/* @__PURE__ */new Set,jt=0;function qt(){jt++,Ft.forEach(e=>e())}function Bt(e){return Ot.get(e)}function Ht(e){return Ft.add(e),()=>{Ft.delete(e)}}function Yt(){return jt}var Ut=W(""),Xt=W(null);function Vt({spec:e,children:t}){/* @__PURE__ */
45
+ return Z(Xt.Provider,{value:e,children:t})}var _t=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Jt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Gt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Qt(e){return Zt(e).replace(/\s+/g," ").trim()}function Zt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Zt).join("");if(H(e)){const t=e,n="string"==typeof t.type?t.type:"";return _t.has(n)?"":` ${Zt(t.props?.children)} `}return""}function en(e){const t=K(Ut);F(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var tn={};function nn(e,t,n){const r=K(Ut);F(()=>{if(!r)return;tn[r]||(tn[r]=[]);const o={label:e,icon:n,onClick:t};return tn[r].push(o),()=>{tn[r]=(tn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function rn({title:e}){const t=O(null);return F(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */Z("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function on(e){}var an=W(null);function sn(){return K(Ut)}function ln(){const e=q(Er,kr),t=K(an);return t?.active??(Sn.length<=1||null!=e)}function cn({children:e,position:t="right",quiet:n=!1}){const r=K(an),[o,i]=j(null);return F(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?te(e,o):null}function un({onClick:e,children:t,className:n}){const r=K(an);/* @__PURE__ */
46
+ return Z("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var dn="erp_window_positions",hn={};try{const e=localStorage.getItem(dn);e&&(hn=JSON.parse(e))}catch{}var mn=null;function pn(){mn&&clearTimeout(mn),mn=setTimeout(()=>{try{localStorage.setItem(dn,JSON.stringify(hn))}catch{}},500)}var fn="erp_activation_order",wn=[];try{const e=localStorage.getItem(fn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(wn=t)}catch{}var yn=null;function gn(){yn&&clearTimeout(yn),yn=setTimeout(()=>{try{localStorage.setItem(fn,JSON.stringify(wn))}catch{}},500)}function bn(e,t){hn[e]||(hn[e]=t,pn())}function vn(e){return hn[e]?{...hn[e]}:null}function xn(e,t){hn[e]=t,pn()}function kn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(hn))n(hn[e],r,o)&&(delete hn[e],i=!0);i&&pn()}var En={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Cn=4e3,Mn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},Nn={small:.8,medium:1,large:1.25,maximized:1.25},Sn=[],Ln=/* @__PURE__ */new Set,Tn=/* @__PURE__ */new Set,zn=0,An=/* @__PURE__ */new Map;var Dn=0;function Pn(){return Dn}function In(){Dn++,Ln.forEach(e=>e())}var Wn=/* @__PURE__ */new Map,Kn=/* @__PURE__ */new Map,$n=/* @__PURE__ */new Map;function Rn(){for(let e=Sn.length-1;e>=0;e--){const t=$n.get(Sn[e]);if(t?.tab)return t.owner}return null}function On(){return q(Er,Rn,()=>null)}var Fn=/* @__PURE__ */new Set;var jn=null;function qn(e){jn=null,Gn(e)}function Bn(e){jn=e;const t=Wn.get(e);t&&qn(t)}var Hn=/* @__PURE__ */new Map;function Yn(e){return Hn.get(e)?.holdsChanges()??!1}function Un(e){const t=Hn.get(e);return t?t.ask():Promise.resolve(!0)}function Xn(e){jn===e&&(jn=null)}function Vn(e,t,n){if(n&&$n.set(e,n),t)if(Wn.set(t,e),Kn.set(e,t),Fn.delete(t)){Sn.unshift(e);const n=wn.indexOf(t);-1!==n&&wn.splice(n,1),wn.unshift(t),gn()}else!function(e,t){const n=wn.indexOf(t);if(-1===n)return void Sn.push(e);let r=Sn.length;for(let e=0;e<Sn.length;e++){const t=Kn.get(Sn[e]);if(t&&wn.indexOf(t)>n){r=e;break}}Sn.splice(r,0,e)}(e,t),-1===wn.indexOf(t)&&(wn.push(t),gn());else Sn.push(e);In(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&jn===t&&qn(e)}function _n(e){return e?$n.get(e)?.owner??Kn.get(e)??null:null}var Jn=/* @__PURE__ */new Set;function Gn(e){const t=_n(kr()),n=Sn.indexOf(e);-1!==n&&Sn.splice(n,1),Sn.push(e);const o=$n.get(e);if(o?.root&&o.tab&&r()){const e=Sn.filter(e=>{const t=$n.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)Sn.splice(Sn.indexOf(t),1),Sn.push(t)}Tn.delete(e);const i=Kn.get(e);if(i){const e=wn.indexOf(i);-1!==e&&wn.splice(e,1),wn.push(i),gn(),jn&&jn!==i&&(jn=null)}In(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=_n(kr());a&&a!==t&&Jn.forEach(e=>e(a))}function Qn(e){const t=Sn.indexOf(e);-1!==t&&Sn.splice(t,1),Tn.add(e),An.set(e,++zn);const n=Kn.get(e);if(n){const e=wn.indexOf(n);-1!==e&&(wn.splice(e,1),gn())}In(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Zn=/* @__PURE__ */new Set;var er=8,tr=32;function nr(){return e()}var rr=u.windowBar,or=80,ir=384,ar=400;function sr(e,t=nr()){const n=Math.min(Math.max(e.x,t.x+or-e.w),t.x+t.w-or),r=Math.min(Math.max(e.y,t.y),t.y+t.h-rr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function lr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=nr();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function cr(e){const t=nr(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var ur=null;function dr(e){const t=(ur||((ur=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${D.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(ur)),ur);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function hr(){ur&&(ur.style.opacity="0",ur.style.display="none")}var mr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],pr=350,fr=200;function wr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=j(!1),s=O(void 0),l=O(void 0);F(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),pr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),fr)};/* @__PURE__ */
47
47
  return Q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
48
- /* @__PURE__ */Z("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */Z("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-2 shadow-lg",children:mr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */Z("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */Z("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var yr="rosh-gesture-style";var gr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},br=4;function vr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(yr))return;const e=document.createElement("style");e.id=yr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=At(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function xr(e){const t=Sn.indexOf(e);if(-1===t)return-1;const n=D.window+t*D.windowStep,o=$n.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of $n){if(!t.root||t.owner!==o.owner)continue;const n=Sn.indexOf(e);-1!==n&&(i=Math.max(i,D.window+n*D.windowStep))}return i>=n?i+2+Math.min(t,7):n}function kr(){return Sn[Sn.length-1]||null}function Er(e){return Ln.add(e),()=>{Ln.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=Sn.length-1;e>=0;e--)Zn.has(Sn[e])||Sn.splice(e,1);wn=wn.filter(e=>{const t=Wn.get(e);return null!=t&&Zn.has(t)}),gn(),In(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Cr="modal-close-request";function Mr(e){q(Er,Pn);const t=K(an);if(Sn.length<=1)return!0;if(e){const t=Wn.get(e);if(null!=t)return kr()===t}return t?.active??null!=kr()}var Nr=!1,Sr=/* @__PURE__ */new Set;function Lr(e){return Sr.add(e),()=>Sr.delete(e)}function Tr(){return Nr}function zr(e){Nr!==e&&(Nr=e,Sr.forEach(e=>e()))}function Ar(){zr(!Nr)}function Dr(){zr(!1)}var Pr=null,Ir=/* @__PURE__ */new Set;function Wr(e){return Ir.add(e),()=>Ir.delete(e)}function Kr(){return Pr}function $r(e){Pr!==e&&(Pr=e,Ir.forEach(e=>e()))}var Rr=null,Or=/* @__PURE__ */new Set;function jr(e){return Or.add(e),()=>Or.delete(e)}function Fr(){return Rr}function qr(e){Rr!==e&&(Rr=e,Or.forEach(e=>e()))}function Br(){if(!Rr)return void zr(!1);$r(Rr),qr(null),zr(!1)}function Hr(){zr(!Nr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Ur(){const e=q(Lr,Tr),[t,n]=F(e),[r,o]=F(e);return j(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?te(
49
- /* @__PURE__ */Z("div",{onMouseDown:e=>{e.stopPropagation(),zr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:D.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function Yr({open:t,onClose:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:E,onMinimize:C,initialBox:S,actions:L,actionsLeft:T,editing:A=!1,allowPinOnTop:W,initialPosition:$,widget:U,compact:Y,appStyle:_,flushBody:J,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:ue}){const[de,he]=F(()=>r()),me=M()&&!de,pe=N()&&!!U,[we,ye]=F(0),[ge,be]=F(!1),ve=O(null),xe=O(0);j(()=>{xe.current=we},[we]);const ke=B(e=>{me&&(ve.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},be(!0),Ct(le??null))},[me,le]),Ee=q(Mt,Et);j(()=>{if(!ge)return;const e=e=>{if(!ve.current)return;const t=e.clientX-ve.current.startX;if(Math.abs(e.clientY-ve.current.startY)>Math.abs(t)+12)return ve.current=null,be(!1),ye(0),void Ct(null);ye(Math.max(0,t))},t=()=>{if(!ve.current)return;const e=.3*window.innerWidth,t=xe.current>e;ve.current=null,be(!1),t?(ye(window.innerWidth),setTimeout(()=>{i(),ye(0),Ct(null)},180)):(ye(0),Ct(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ge]);const[Ce,Se]=F(c),Te=I(),ze=Te.window;j(()=>{Se(c)},[c]);const Ae=V(()=>Qt(Ce).trim()||void 0,[Ce]),De=G(),[Pe,Ie]=F(!1),We=O(!1),[Ke,$e]=F(!1),[Re,Oe]=F(null),je=K(Xt),Fe=K(fe),{prefs:qe,save:Be}=b(),He=!!qe.window_accent_stripe,Ue=qe.favorite_documents||[],Ye=!!je&&Ue.some(e=>e.entityType===je.entityType&&e.entityId===je.entityId),Ve=B(()=>{if(!je)return;const e=Ye?Ue.filter(e=>!(e.entityType===je.entityType&&e.entityId===je.entityId)):[...Ue,{entityType:je.entityType,entityId:je.entityId,label:je.label}];Be({favorite_documents:e})},[je,Ye,Ue,Be]),[_e,Je]=F(null),[Qe,Ze]=F("top-right"===$?"right":"left"),et=O(!1),tt=O(null);R(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=O(!1),rt=O(null),ot=O(null),it=O(null),[at,st]=F(!1),lt=O(null),ct=!!(w||L||T)||at,ut=K(Ne),dt=""!==K(Yt),ht=O(null);ht.current=Fe?{owner:Fe.key,tab:Fe.tab,root:!dt}:null;const mt=se||(Fe&&!dt?Fe.key:null),pt=!!ut&&!dt&&ut.enabled&&ut.hasState&&(A||ut.declaredEditable)&&!ut.handMounted&&ct&&!U&&!Y&&!_&&!me,ft=/* @__PURE__ */Z(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),wt=u&&H(u)?X(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??ft,yt=()=>/* @__PURE__ */Z("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Oe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:wt}),gt=40,{minimize:bt,items:xt,restoreIfMinimized:kt,openWindows:Nt}=Ge(),St=O(`modal-${Math.random().toString(36).slice(2,8)}`).current;j(()=>{if(U)return Zn.add(St),()=>{Zn.delete(St)}},[U,St]),j(()=>{const e=e=>{const t=e.detail;t?.id===St&&Se(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[St]);const[Lt,Tt]=F(D.window),zt=function(e){const t=q(Er,kr);return Sn.length<=1||t===e}(St),At=function(e){return q(Er,()=>Tn.has(e))}(St);vt({panelRef:tt,bodyRef:rt,open:t,widget:!!U,active:zt,minimized:At});const Dt=q(Lr,Tr),Pt=q(Wr,Kr),It=q(jr,Fr),Wt=!W&&!U,Kt=Dt&&Wt,[Rt,jt]=F(!1),Ft=Kt&&It===St,[Bt,Ht]=F(!1),Ut=Bt&&Wt&&Pt===St?"picked":null,Vt=O(Kt);j(()=>{if(Vt.current&&!Kt){Ht(!0);const e=setTimeout(()=>{Ht(!1),Pr===St&&$r(null)},700);return Vt.current=Kt,()=>clearTimeout(e)}Vt.current=Kt},[Kt,St]),j(()=>{Kt||jt(!1)},[Kt]),j(()=>{const e=ot.current,t=it.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),j(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const Gt=O(!1),Zt=B(e,[]),en=B(()=>{const t=e(),n=ae?ae[0]:En[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Nn[Mn()],l=ae?Math.min(ae[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(Sn.length-1),u=Math.max(gt,(i-l)/2),d=(o-a)/2,m=t.h-gt-l-u;return"top-right"===$?{x:t.x+t.w-a-gt,y:t.y+gt,w:a,h:l}:"top-left"===$?{x:t.x+gt,y:t.y+gt,w:a,h:l}:{x:t.x+Math.max(gt,(o-a)/2+gt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),nn=O(!1);t||(nn.current=!1);const rn=se||d||null;j(()=>{if(!t)return;Vn(St,rn,ht.current??void 0),se||Jn(St),Gt.current=!1,Tt(xr(St));const e=()=>{Tt(xr(St))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Jn(St),yn.current)return;const t=nr(),n=Math.min(Ln.current.w,t.w-40),o=Math.min(Ln.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;ln({x:i,y:a,w:n,h:o}),kn(!1)},i=e=>{const t=e.detail;r(t)&&(Jn(St),Oe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Jn(St);const t=Ln.current,n=function(e,t=nr()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=tt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}ln(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=Sn.indexOf(e);-1!==t&&(Sn.splice(t,1),In()),Tn.delete(e),An.delete(e),$n.delete(e);const n=Kn.get(e);n&&(Kn.delete(e),Wn.delete(n))}(St),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,St,rn,Zt]);const on=!U&&"maximized"===Mn(),[sn,ln]=F(()=>{if(rn&&hn[rn]){const e={...hn[rn]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),sr(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:on?Zt():en()}),[cn,un]=F(()=>!ne),dn=O(de),mn=O(null);j(()=>{const e=()=>{const e=r();e!==dn.current&&mn.current?.(e),dn.current=e,he(e),Tt(xr(St))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[St]);const fn=de&&!!Fe?.tab&&!dt&&!U&&!me,wn=fn,yn=O(wn);yn.current=wn;const gn=On(),bn=de&&!!Fe?.tab&&!U&&!me&&!Dt&&gn!==Fe.key,vn=!!U&&de&&!Dt&&null!==gn,[xn,kn]=F(()=>rn&&hn[rn]||S?wn:wn||on),Ln=O(sn);Ln.current=sn;const zn=O(xn);R(()=>{zn.current=xn},[xn]),R(()=>{if(cn||fn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(U?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Ln.current.y)-24),g=w?Math.min(Ln.current.h,y):Math.min(Math.max(n,u+p),y),b=Math.abs(g-o)>1;b&&(o=g,ln(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),U||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&un(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[cn,U,re,ct,fn]),R(()=>{if(!ne||!cn||U||!t)return;const e=lt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||xn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Ln.current.y)-24);ln(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ne,cn,U,t,xn,re]);const Dn=!1!==oe&&!U&&!_&&!me,[Pn,Rn]=F(()=>!Dn);R(()=>{if(Pn||!t)return;if(!Dn||xn)return void Rn(!0);const n=tt.current,r=rt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Ln.current.w,c=0;const u=()=>Rn(!0),d=()=>{c=0;const t=Ln.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),d,gt);b!==t&&(i=b.w,ln(b))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Cn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Pn,t,Dn,xn]);const jn=O(null),Fn=!(!Fe?.tab||dt||U||me);mn.current=t=>{if(!Fn)return;if(t)return jn.current||(jn.current={box:{...Ln.current},maximized:zn.current}),void(zn.current=!0);const r=jn.current;jn.current=null;const o=e();if(r?.maximized)return zn.current=!0,kn(!0),void ln(o);const i=r?.box??(rn?hn[rn]:void 0);if(zn.current=!1,kn(!1),i&&!n(i,o,!1)){const e={...i};ae&&(e.w=ae[0],ne||(e.h=ae[1])),ln(sr(e))}else ln(en())},j(()=>{wn&&(zn.current=!0,kn(!0),ln(Zt()))},[wn,Zt]),j(()=>{if(U)return;const e=()=>{const e=rn?hn[rn]:void 0;if(zn.current=!1,kn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),ln(sr(t))}else ln(en())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[U,en,rn]),j(()=>{t&&rn&&!fn&&(hn[rn]=sn,pn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[sn,t,rn,fn]),j(()=>{if(!t)return;const e=()=>{zn.current?ln(Zt()):document.body.classList.contains("rosh-gesturing")||ln(sr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return xn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,xn,Zt]),j(()=>{if(t&&(Ie(!1),We.current=!1,et.current=!1,Rn(!Dn),!yn.current)){if(rn&&hn[rn]){const e=hn[rn];return void ln(t=>sr({...e,...ne?{h:t.h}:{},...Dn?{x:t.x,w:t.w}:{}}))}S&&(ln({x:S.x,y:S.y,w:S.w,h:S.h}),kn(S.maximized))}},[t]),j(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{tt.current?.contains(t.target)&&!We.current&&(We.current=!0,e=setTimeout(()=>Ie(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const qn="auto"===m?Pe:!0===m,Bn=Fe&&!dt?Fe.key:null,Un=V(()=>$t(Ce),[Ce]),Yn=O({shortcutSpec:je,isOnDesktop:Ye,toggleDesktopShortcut:Ve,taskbarStrings:Te.taskbar});R(()=>{Yn.current={shortcutSpec:je,isOnDesktop:Ye,toggleDesktopShortcut:Ve,taskbarStrings:Te.taskbar}});const Xn=O(null);Xn.current||(Xn.current={open:(e,t)=>Oe({x:e,y:t}),items:()=>{const e=Yn.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of tn[St]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),j(()=>{if(t&&Bn)return()=>{return e=Bn,void(Ot.delete(e)&&qt());var e}},[t,Bn]),Xe(!(se||!t)&&qn);const Gn=B(()=>qn||"auto"===m&&We.current,[qn,m]),_n=B(async e=>{if(et.current)return!1;if(!Gn())return!0;et.current=!0;const t=Ae,n="close"===e?"Are you sure you want to close?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return et.current=!1,r},[Gn,Ae]),rr=B(()=>et.current?Promise.resolve():Gn()?_n("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[Gn,_n,i]),or=B(async()=>{const e=await _n("switch");return e&&(We.current=!1,Ie(!1)),e},[_n]),lr=O(()=>!1);R(()=>{lr.current=Gn}),R(()=>{if(!t||!se)return;const e={holdsChanges:()=>lr.current(),ask:or};return Hn.set(se,e),()=>{Hn.get(se)===e&&Hn.delete(se)}},[t,se,or]),R(()=>{if(!t||!mt)return;const e=e=>{e.detail?.windowKey===mt&&rr()};return window.addEventListener(Cr,e),()=>window.removeEventListener(Cr,e)},[t,mt,rr]);const ur=O(null),mr=B(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Oe(null),Jn(St),yn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=tt.current,s=a?.getBoundingClientRect();let l,c,u,d;if(ur.current){const t=ur.current;ur.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Ln.current.x,c=s?s.top:Ln.current.y,u=s?s.height:Ln.current.h,d=s?s.width:Ln.current.w;kn(!1),ln(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<br&&Math.abs(e.clientY-i)<br)return;r=vr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Ln.current={...Ln.current,x:s,y:u},!U){const t=function(e,t){const n=nr(),r=e<=n.x+er,o=e>=n.x+n.w-er,i=t<=n.y+er,a=t>=n.y+n.h-er,s=e<=n.x+tr,l=e>=n.x+n.w-tr,c=t<=n.y+tr,u=t>=n.y+n.h-tr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?dr(cr(t)):hr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),hr();const e=sr({...Ln.current});if(Ln.current=e,!U&&h){ur.current={x:l,y:c,w:d,h:u};const e=cr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void ln(e)}if(U){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),ln(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),pr=B((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:Ln.current.x,u=l?l.top:Ln.current.y,d=l?l.width:Ln.current.w,h=l?l.height:Ln.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;kn(!1),ln({x:c,y:u,w:d,h:h}),Ln.current={x:c,y:u,w:d,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Ln.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<br&&Math.abs(e.clientY-a)<br)return;o=vr(n,r,gr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(ir,d+e)),w&&(i=Math.max(ar,h+t)),m){const t=Math.max(ir,d-e);n=c+d-t,o=t}if(p){const e=Math.max(ar,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),ln({...Ln.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),fr=B(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Jn(St),"Enter"===e.key)return void(xn?(kn(!1),ln(en())):(kn(!0),ln(Zt())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ur.current||(ur.current={...Ln.current})};if(r<0)return e(),kn(!0),void ln(Zt());if(r>0){if(xn)return kn(!1),void ln(en());if(ur.current){const e=sr(ur.current);return ur.current=null,Ln.current=e,void ln(e)}return void Qn(St)}e(),kn(!1);const t=cr(n<0?"left":"right");return Ln.current=t,void ln(t)}if(xn)return;const o=Ln.current,i=e.shiftKey?{...o,w:Math.max(ir,o.w+24*n),h:Math.max(ar,o.h+24*r)}:sr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Ln.current=i,ln(i)},[St,xn,en,Zt]),yr=B(e=>{ur.current||(ur.current={...Ln.current}),kn(!1);const t=cr(e);Ln.current=t,ln(t),Jn(St)},[St]),Mr=wn||Kt?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:fr},Nr=()=>{kn(!0),ln(Zt())},Sr=B(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(_t);t&&!t.disabled&&t.click()}},[]);j(()=>{if(!t)return;if(U)return;const e=e=>{if(Sn[Sn.length-1]===St&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Jt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,St,U]),j(()=>{if(!t)return;const e=e=>{Sn[Sn.length-1]===St&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:St}})),We.current=!1,Ie(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:St}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),j(()=>{if(!t)return;if(U)return;const e=e=>{if("Escape"===e.key&&Sn[Sn.length-1]===St){if(P(e))return e.preventDefault(),void e.stopPropagation();if(fn&&!A)return;e.preventDefault(),e.stopPropagation(),rr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,rr,St,U,fn,A]);const Ar=t&&(void 0!==p||void 0!==f),[Dr]=F(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Ir=fn&&!Fe?.home&&Un.actions.length>0;j(()=>{t&&Bn&&function(e,t){const n=Ot.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(Ot.set(e,t),qt())}(Bn,{title:Un.text||Ae,dirty:qn,copy:Un.copy,actions:Ir&&Dr?Dr:void 0,menu:Xn.current??void 0})},[t,Bn,Ae,qn,Un.text,Un.copy,Ir,Dr]);const Rr=B(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(j(()=>{if(!t)return;const e=e=>{if(Sn[Sn.length-1]!==St)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Ar&&(e.preventDefault(),p?p():Rr("bottom")),"k"===e.key&&Ar&&(e.preventDefault(),f?f():Rr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Ar,Rr,St]),!t||nn.current)return null;const Or=Kt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=nr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(St):null,qr=Kt&&Or?Math.min(Or.w/sn.w,Or.h/sn.h):1,Br=(()=>{if(Kt&&Or){const e=qr,t=sn.w*e,n=sn.h*e,r=Or.x+(Or.w-t)/2-sn.x,o=Or.y+(Or.h-n)/2-sn.y,i=Rt||Ft;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:D.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Bt&&Wt){const e="picked"===Ut;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:D.expose+30}:{}}}return null})(),Hr=g({modal:!1,titleId:!U&&(fn?!Fe?.home:!me)?De:void 0,label:Un.text||Ae}),Ur=/* @__PURE__ */Q("div",{children:[
50
- /* @__PURE__ */Q("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":St,"data-window-key":se||void 0,...W?{"data-utility":""}:{},...Ke?{"data-pinned-top":""}:{},...U?{"data-widget":""}:{},...Fe?{"data-window-owner":Fe.key}:{},...Fe&&!dt?{"data-window-root":""}:{},...fn?{"data-window-tab":""}:{},...Hr,className:fn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(U?zt?"shadow-xl":"shadow-lg":"border "+(zt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(nt.current=!1,Kt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),$r(St),zr(!1),void Jn(St)}if(!zt&&!U&&!Ke&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===tt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),nt.current=!0,Oe(null),Jn(St),window.addEventListener("mouseup",()=>{setTimeout(()=>{nt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{nt.current&&(nt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Kt)return;Oe(null);e.target.closest("[data-modal-panel]")===tt.current&&(e.target.closest("button, input, a, select, textarea")||Jn(St))},style:me?{zIndex:Lt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${we}px)`,transition:ge?"none":"transform 180ms ease-out",...U?{display:"none"}:{},...Lt<0?{display:"none"}:{},...zt||Ke||Ee&&se===Ee?{}:{display:"none"}}:{zIndex:Ke?D.pinnedWindow:Lt+1,width:sn.w,height:sn.h,top:sn.y,...U&&"right"===Qe?{right:window.innerWidth-sn.x-sn.w}:{left:sn.x},...Lt<0&&!Ke?{display:"none"}:{},...pe?{display:"none"}:{},...bn||vn?{visibility:"hidden",pointerEvents:"none"}:{},...Br??{}},children:[me&&!U&&/* @__PURE__ */Z("div",{onPointerDown:ke,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),U?null:fn?Fe?.home?null:/* @__PURE__ */Q(ee,{children:[
51
- /* @__PURE__ */Z("h2",{id:De,"data-window-title":!0,className:"sr-only",children:Un.text||Ae}),Ir&&Dr&&te(
52
- /* @__PURE__ */Z(ee,{children:Un.actions}),Dr),Un.badges.length>0&&/* @__PURE__ */Z("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:Un.badges})]}):me?null:
53
- /* @__PURE__ */Q("div",Y?{onPointerDown:mr,"data-window-chrome":"",...Mr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
48
+ /* @__PURE__ */Z("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */Z("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-2 shadow-lg",children:mr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */Z("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */Z("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var yr="rosh-gesture-style";var gr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},br=4;function vr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(yr))return;const e=document.createElement("style");e.id=yr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=At(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function xr(e){const t=Sn.indexOf(e);if(-1===t)return-1;const n=D.window+t*D.windowStep,o=$n.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of $n){if(!t.root||t.owner!==o.owner)continue;const n=Sn.indexOf(e);-1!==n&&(i=Math.max(i,D.window+n*D.windowStep))}return i>=n?i+2+Math.min(t,7):n}function kr(){return Sn[Sn.length-1]||null}function Er(e){return Ln.add(e),()=>{Ln.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=Sn.length-1;e>=0;e--)Zn.has(Sn[e])||Sn.splice(e,1);wn=wn.filter(e=>{const t=Wn.get(e);return null!=t&&Zn.has(t)}),gn(),In(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Cr="modal-close-request";function Mr(e){q(Er,Pn);const t=K(an);if(Sn.length<=1)return!0;if(e){const t=Wn.get(e);if(null!=t)return kr()===t}return t?.active??null!=kr()}var Nr=!1,Sr=/* @__PURE__ */new Set;function Lr(e){return Sr.add(e),()=>Sr.delete(e)}function Tr(){return Nr}function zr(e){Nr!==e&&(Nr=e,Sr.forEach(e=>e()))}function Ar(){zr(!Nr)}function Dr(){zr(!1)}var Pr=null,Ir=/* @__PURE__ */new Set;function Wr(e){return Ir.add(e),()=>Ir.delete(e)}function Kr(){return Pr}function $r(e){Pr!==e&&(Pr=e,Ir.forEach(e=>e()))}var Rr=null,Or=/* @__PURE__ */new Set;function Fr(e){return Or.add(e),()=>Or.delete(e)}function jr(){return Rr}function qr(e){Rr!==e&&(Rr=e,Or.forEach(e=>e()))}function Br(){if(!Rr)return void zr(!1);$r(Rr),qr(null),zr(!1)}function Hr(){zr(!Nr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Yr(){const e=q(Lr,Tr),[t,n]=j(e),[r,o]=j(e);return F(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?te(
49
+ /* @__PURE__ */Z("div",{onMouseDown:e=>{e.stopPropagation(),zr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:D.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function Ur({open:t,onClose:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:k,onMinimize:M,initialBox:S,actions:L,actionsLeft:T,editing:A=!1,allowPinOnTop:W,initialPosition:$,widget:Y,compact:U,appStyle:J,flushBody:G,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:ue}){const[de,he]=j(()=>r()),me=E()&&!de,pe=C()&&!!Y,[we,ye]=j(0),[ge,be]=j(!1),ve=O(null),xe=O(0);F(()=>{xe.current=we},[we]);const ke=B(e=>{me&&(ve.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},be(!0),Ct(le??null))},[me,le]),Ee=q(Mt,Et);F(()=>{if(!ge)return;const e=e=>{if(!ve.current)return;const t=e.clientX-ve.current.startX;if(Math.abs(e.clientY-ve.current.startY)>Math.abs(t)+12)return ve.current=null,be(!1),ye(0),void Ct(null);ye(Math.max(0,t))},t=()=>{if(!ve.current)return;const e=.3*window.innerWidth,t=xe.current>e;ve.current=null,be(!1),t?(ye(window.innerWidth),setTimeout(()=>{i(),ye(0),Ct(null)},180)):(ye(0),Ct(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ge]);const[Ce,Se]=j(c),Te=I(),ze=Te.window;F(()=>{Se(c)},[c]);const Ae=V(()=>Qt(Ce).trim()||void 0,[Ce]),De=_(),[Pe,Ie]=j(!1),We=O(!1),[Ke,$e]=j(!1),[Re,Oe]=j(null),Fe=K(Xt),je=K(fe),{prefs:qe,save:Be}=N(),He=!!qe.window_accent_stripe,Ye=qe.favorite_documents||[],Ue=!!Fe&&Ye.some(e=>e.entityType===Fe.entityType&&e.entityId===Fe.entityId),Ve=B(()=>{if(!Fe)return;const e=Ue?Ye.filter(e=>!(e.entityType===Fe.entityType&&e.entityId===Fe.entityId)):[...Ye,{entityType:Fe.entityType,entityId:Fe.entityId,label:Fe.label}];Be({favorite_documents:e})},[Fe,Ue,Ye,Be]),[Je,Ge]=j(null),[Qe,Ze]=j("top-right"===$?"right":"left"),et=O(!1),tt=O(null);R(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=O(!1),rt=O(null),ot=O(null),it=O(null),[at,st]=j(!1),lt=O(null),ct=!!(w||L||T)||at,ut=K(Ne),dt=""!==K(Ut),ht=O(null);ht.current=je?{owner:je.key,tab:je.tab,root:!dt}:null;const mt=se||(je&&!dt?je.key:null),pt=!!ut&&!dt&&ut.enabled&&ut.hasState&&(A||ut.declaredEditable)&&!ut.handMounted&&ct&&!Y&&!U&&!J&&!me,ft=/* @__PURE__ */Z(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),wt=u&&H(u)?X(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??ft,yt=()=>/* @__PURE__ */Z("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Oe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:wt}),gt=40,{minimize:bt,items:xt,restoreIfMinimized:kt,openWindows:Nt}=_e(),St=O(`modal-${Math.random().toString(36).slice(2,8)}`).current;F(()=>{if(Y)return Zn.add(St),()=>{Zn.delete(St)}},[Y,St]),F(()=>{const e=e=>{const t=e.detail;t?.id===St&&Se(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[St]);const[Lt,Tt]=j(D.window),zt=function(e){const t=q(Er,kr);return Sn.length<=1||t===e}(St),At=function(e){return q(Er,()=>Tn.has(e))}(St);vt({panelRef:tt,bodyRef:rt,open:t,widget:!!Y,active:zt,minimized:At});const Dt=q(Lr,Tr),Pt=q(Wr,Kr),It=q(Fr,jr),Wt=!W&&!Y,Kt=Dt&&Wt,[Rt,Ft]=j(!1),jt=Kt&&It===St,[Bt,Ht]=j(!1),Yt=Bt&&Wt&&Pt===St?"picked":null,Vt=O(Kt);F(()=>{if(Vt.current&&!Kt){Ht(!0);const e=setTimeout(()=>{Ht(!1),Pr===St&&$r(null)},700);return Vt.current=Kt,()=>clearTimeout(e)}Vt.current=Kt},[Kt,St]),F(()=>{Kt||Ft(!1)},[Kt]),F(()=>{const e=ot.current,t=it.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),F(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const _t=O(!1),Zt=B(e,[]),en=B(()=>{const t=e(),n=ae?ae[0]:En[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Nn[Mn()],l=ae?Math.min(ae[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(Sn.length-1),u=Math.max(gt,(i-l)/2),d=(o-a)/2,m=t.h-gt-l-u;return"top-right"===$?{x:t.x+t.w-a-gt,y:t.y+gt,w:a,h:l}:"top-left"===$?{x:t.x+gt,y:t.y+gt,w:a,h:l}:{x:t.x+Math.max(gt,(o-a)/2+gt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),nn=O(!1);t||(nn.current=!1);const rn=se||d||null;F(()=>{if(!t)return;Vn(St,rn,ht.current??void 0),se||Gn(St),_t.current=!1,Tt(xr(St));const e=()=>{Tt(xr(St))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Gn(St),yn.current)return;const t=nr(),n=Math.min(Ln.current.w,t.w-40),o=Math.min(Ln.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;ln({x:i,y:a,w:n,h:o}),kn(!1)},i=e=>{const t=e.detail;r(t)&&(Gn(St),Oe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Gn(St);const t=Ln.current,n=function(e,t=nr()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=tt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}ln(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=Sn.indexOf(e);-1!==t&&(Sn.splice(t,1),In()),Tn.delete(e),An.delete(e),$n.delete(e);const n=Kn.get(e);n&&(Kn.delete(e),Wn.delete(n))}(St),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,St,rn,Zt]);const on=!Y&&"maximized"===Mn(),[sn,ln]=j(()=>{if(rn&&hn[rn]){const e={...hn[rn]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),sr(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:on?Zt():en()}),[cn,un]=j(()=>!ne),dn=O(de),mn=O(null);F(()=>{const e=()=>{const e=r();e!==dn.current&&mn.current?.(e),dn.current=e,he(e),Tt(xr(St))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[St]);const fn=de&&!!je?.tab&&!dt&&!Y&&!me,wn=fn,yn=O(wn);yn.current=wn;const gn=On(),bn=de&&!!je?.tab&&!Y&&!me&&!Dt&&gn!==je.key,vn=!!Y&&de&&!Dt&&null!==gn,[xn,kn]=j(()=>rn&&hn[rn]||S?wn:wn||on),Ln=O(sn);Ln.current=sn;const zn=O(xn);R(()=>{zn.current=xn},[xn]),R(()=>{if(cn||fn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(Y?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Ln.current.y)-24),g=w?Math.min(Ln.current.h,y):Math.min(Math.max(n,u+p),y),b=Math.abs(g-o)>1;b&&(o=g,ln(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),Y||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&un(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[cn,Y,re,ct,fn]),R(()=>{if(!ne||!cn||Y||!t)return;const e=lt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||xn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Ln.current.y)-24);ln(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ne,cn,Y,t,xn,re]);const Dn=!1!==oe&&!Y&&!J&&!me,[Pn,Rn]=j(()=>!Dn);R(()=>{if(Pn||!t)return;if(!Dn||xn)return void Rn(!0);const n=tt.current,r=rt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Ln.current.w,c=0;const u=()=>Rn(!0),d=()=>{c=0;const t=Ln.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),d,gt);b!==t&&(i=b.w,ln(b))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Cn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Pn,t,Dn,xn]);const Fn=O(null),jn=!(!je?.tab||dt||Y||me);mn.current=t=>{if(!jn)return;if(t)return Fn.current||(Fn.current={box:{...Ln.current},maximized:zn.current}),void(zn.current=!0);const r=Fn.current;Fn.current=null;const o=e();if(r?.maximized)return zn.current=!0,kn(!0),void ln(o);const i=r?.box??(rn?hn[rn]:void 0);if(zn.current=!1,kn(!1),i&&!n(i,o,!1)){const e={...i};ae&&(e.w=ae[0],ne||(e.h=ae[1])),ln(sr(e))}else ln(en())},F(()=>{wn&&(zn.current=!0,kn(!0),ln(Zt()))},[wn,Zt]),F(()=>{if(Y)return;const e=()=>{const e=rn?hn[rn]:void 0;if(zn.current=!1,kn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),ln(sr(t))}else ln(en())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[Y,en,rn]),F(()=>{t&&rn&&!fn&&(hn[rn]=sn,pn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[sn,t,rn,fn]),F(()=>{if(!t)return;const e=()=>{zn.current?ln(Zt()):document.body.classList.contains("rosh-gesturing")||ln(sr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return xn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,xn,Zt]),F(()=>{if(t&&(Ie(!1),We.current=!1,et.current=!1,Rn(!Dn),!yn.current)){if(rn&&hn[rn]){const e=hn[rn];return void ln(t=>sr({...e,...ne?{h:t.h}:{},...Dn?{x:t.x,w:t.w}:{}}))}S&&(ln({x:S.x,y:S.y,w:S.w,h:S.h}),kn(S.maximized))}},[t]),F(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{tt.current?.contains(t.target)&&!We.current&&(We.current=!0,e=setTimeout(()=>Ie(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const qn="auto"===m?Pe:!0===m,Bn=je&&!dt?je.key:null,Yn=V(()=>$t(Ce),[Ce]),Un=O({shortcutSpec:Fe,isOnDesktop:Ue,toggleDesktopShortcut:Ve,taskbarStrings:Te.taskbar});R(()=>{Un.current={shortcutSpec:Fe,isOnDesktop:Ue,toggleDesktopShortcut:Ve,taskbarStrings:Te.taskbar}});const Xn=O(null);Xn.current||(Xn.current={open:(e,t)=>Oe({x:e,y:t}),items:()=>{const e=Un.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of tn[St]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),F(()=>{if(t&&Bn)return()=>{return e=Bn,void(Ot.delete(e)&&qt());var e}},[t,Bn]),Xe(!(se||!t)&&qn);const _n=B(()=>qn||"auto"===m&&We.current,[qn,m]),Jn=B(async e=>{if(et.current)return!1;if(!_n())return!0;et.current=!0;const t=Ae,n="close"===e?"Are you sure you want to close?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return et.current=!1,r},[_n,Ae]),rr=B(()=>et.current?Promise.resolve():_n()?Jn("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[_n,Jn,i]),or=B(async()=>{const e=await Jn("switch");return e&&(We.current=!1,Ie(!1)),e},[Jn]),lr=O(()=>!1);R(()=>{lr.current=_n}),R(()=>{if(!t||!se)return;const e={holdsChanges:()=>lr.current(),ask:or};return Hn.set(se,e),()=>{Hn.get(se)===e&&Hn.delete(se)}},[t,se,or]),R(()=>{if(!t||!mt)return;const e=e=>{e.detail?.windowKey===mt&&rr()};return window.addEventListener(Cr,e),()=>window.removeEventListener(Cr,e)},[t,mt,rr]);const ur=O(null),mr=B(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Oe(null),Gn(St),yn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=tt.current,s=a?.getBoundingClientRect();let l,c,u,d;if(ur.current){const t=ur.current;ur.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Ln.current.x,c=s?s.top:Ln.current.y,u=s?s.height:Ln.current.h,d=s?s.width:Ln.current.w;kn(!1),ln(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<br&&Math.abs(e.clientY-i)<br)return;r=vr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Ln.current={...Ln.current,x:s,y:u},!Y){const t=function(e,t){const n=nr(),r=e<=n.x+er,o=e>=n.x+n.w-er,i=t<=n.y+er,a=t>=n.y+n.h-er,s=e<=n.x+tr,l=e>=n.x+n.w-tr,c=t<=n.y+tr,u=t>=n.y+n.h-tr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?dr(cr(t)):hr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),hr();const e=sr({...Ln.current});if(Ln.current=e,!Y&&h){ur.current={x:l,y:c,w:d,h:u};const e=cr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void ln(e)}if(Y){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),ln(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),pr=B((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:Ln.current.x,u=l?l.top:Ln.current.y,d=l?l.width:Ln.current.w,h=l?l.height:Ln.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;kn(!1),ln({x:c,y:u,w:d,h:h}),Ln.current={x:c,y:u,w:d,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Ln.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<br&&Math.abs(e.clientY-a)<br)return;o=vr(n,r,gr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(ir,d+e)),w&&(i=Math.max(ar,h+t)),m){const t=Math.max(ir,d-e);n=c+d-t,o=t}if(p){const e=Math.max(ar,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),ln({...Ln.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),fr=B(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Gn(St),"Enter"===e.key)return void(xn?(kn(!1),ln(en())):(kn(!0),ln(Zt())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ur.current||(ur.current={...Ln.current})};if(r<0)return e(),kn(!0),void ln(Zt());if(r>0){if(xn)return kn(!1),void ln(en());if(ur.current){const e=sr(ur.current);return ur.current=null,Ln.current=e,void ln(e)}return void Qn(St)}e(),kn(!1);const t=cr(n<0?"left":"right");return Ln.current=t,void ln(t)}if(xn)return;const o=Ln.current,i=e.shiftKey?{...o,w:Math.max(ir,o.w+24*n),h:Math.max(ar,o.h+24*r)}:sr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Ln.current=i,ln(i)},[St,xn,en,Zt]),yr=B(e=>{ur.current||(ur.current={...Ln.current}),kn(!1);const t=cr(e);Ln.current=t,ln(t),Gn(St)},[St]),Mr=wn||Kt?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:fr},Nr=()=>{kn(!0),ln(Zt())},Sr=B(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Jt);t&&!t.disabled&&t.click()}},[]);F(()=>{if(!t)return;if(Y)return;const e=e=>{if(Sn[Sn.length-1]===St&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Gt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,St,Y]),F(()=>{if(!t)return;const e=e=>{Sn[Sn.length-1]===St&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:St}})),We.current=!1,Ie(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:St}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),F(()=>{if(!t)return;if(Y)return;const e=e=>{if("Escape"===e.key&&Sn[Sn.length-1]===St){if(P(e))return e.preventDefault(),void e.stopPropagation();if(fn&&!A)return;e.preventDefault(),e.stopPropagation(),rr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,rr,St,Y,fn,A]);const Ar=t&&(void 0!==p||void 0!==f),[Dr]=j(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Ir=fn&&!je?.home&&Yn.actions.length>0;F(()=>{t&&Bn&&function(e,t){const n=Ot.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(Ot.set(e,t),qt())}(Bn,{title:Yn.text||Ae,dirty:qn,copy:Yn.copy,actions:Ir&&Dr?Dr:void 0,menu:Xn.current??void 0})},[t,Bn,Ae,qn,Yn.text,Yn.copy,Ir,Dr]);const Rr=B(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(F(()=>{if(!t)return;const e=e=>{if(Sn[Sn.length-1]!==St)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Ar&&(e.preventDefault(),p?p():Rr("bottom")),"k"===e.key&&Ar&&(e.preventDefault(),f?f():Rr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Ar,Rr,St]),!t||nn.current)return null;const Or=Kt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=nr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(St):null,qr=Kt&&Or?Math.min(Or.w/sn.w,Or.h/sn.h):1,Br=(()=>{if(Kt&&Or){const e=qr,t=sn.w*e,n=sn.h*e,r=Or.x+(Or.w-t)/2-sn.x,o=Or.y+(Or.h-n)/2-sn.y,i=Rt||jt;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:D.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Bt&&Wt){const e="picked"===Yt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:D.expose+30}:{}}}return null})(),Hr=g({modal:!1,titleId:!Y&&(fn?!je?.home:!me)?De:void 0,label:Yn.text||Ae}),Yr=/* @__PURE__ */Q("div",{children:[
50
+ /* @__PURE__ */Q("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":St,"data-window-key":se||void 0,...W?{"data-utility":""}:{},...Ke?{"data-pinned-top":""}:{},...Y?{"data-widget":""}:{},...je?{"data-window-owner":je.key}:{},...je&&!dt?{"data-window-root":""}:{},...fn?{"data-window-tab":""}:{},...Hr,className:fn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(Y?zt?"shadow-xl":"shadow-lg":"border "+(zt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(nt.current=!1,Kt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),$r(St),zr(!1),void Gn(St)}if(!zt&&!Y&&!Ke&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===tt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),nt.current=!0,Oe(null),Gn(St),window.addEventListener("mouseup",()=>{setTimeout(()=>{nt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{nt.current&&(nt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Kt)return;Oe(null);e.target.closest("[data-modal-panel]")===tt.current&&(e.target.closest("button, input, a, select, textarea")||Gn(St))},style:me?{zIndex:Lt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${we}px)`,transition:ge?"none":"transform 180ms ease-out",...Y?{display:"none"}:{},...Lt<0?{display:"none"}:{},...zt||Ke||Ee&&se===Ee?{}:{display:"none"}}:{zIndex:Ke?D.pinnedWindow:Lt+1,width:sn.w,height:sn.h,top:sn.y,...Y&&"right"===Qe?{right:window.innerWidth-sn.x-sn.w}:{left:sn.x},...Lt<0&&!Ke?{display:"none"}:{},...pe?{display:"none"}:{},...bn||vn?{visibility:"hidden",pointerEvents:"none"}:{},...Br??{}},children:[me&&!Y&&/* @__PURE__ */Z("div",{onPointerDown:ke,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),Y?null:fn?je?.home?null:/* @__PURE__ */Q(ee,{children:[
51
+ /* @__PURE__ */Z("h2",{id:De,"data-window-title":!0,className:"sr-only",children:Yn.text||Ae}),Ir&&Dr&&te(
52
+ /* @__PURE__ */Z(ee,{children:Yn.actions}),Dr),Yn.badges.length>0&&/* @__PURE__ */Z("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:Yn.badges})]}):me?null:
53
+ /* @__PURE__ */Q("div",U?{onPointerDown:mr,"data-window-chrome":"",...Mr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
54
54
  /* @__PURE__ */Q("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Kt&&yt(),
55
55
  /* @__PURE__ */Z("span",{id:De,className:"truncate",children:Kt?Qt(Ce):Ce})]}),!Kt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[W&&/* @__PURE__ */Z("button",{onClick:()=>$e(e=>!e),title:Ke?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Ke?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3 w-3",fill:Ke?"currentColor":"none",strokeWidth:1.5})}),
56
- /* @__PURE__ */Z("button",{type:"button",onClick:rr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"})})]})]}:_?{onPointerDown:mr,"data-window-chrome":"",...Mr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
56
+ /* @__PURE__ */Z("button",{type:"button",onClick:rr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"})})]})]}:J?{onPointerDown:mr,"data-window-chrome":"",...Mr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
57
57
  /* @__PURE__ */Q("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Kt&&yt(),
58
58
  /* @__PURE__ */Z("span",{id:De,className:"truncate",children:Kt?Qt(Ce):Ce})]}),!Kt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[W&&/* @__PURE__ */Z("button",{onClick:()=>$e(e=>!e),title:Ke?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Ke?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3 w-3",fill:Ke?"currentColor":"none",strokeWidth:1.5})}),
59
59
  /* @__PURE__ */Z("button",{onClick:()=>Qn(St),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!wn&&/* @__PURE__ */Z(wr,{maximized:xn,onToggleMax:()=>{xn?(kn(!1),ln(en())):Nr()},onSnap:yr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:ze}),
@@ -61,20 +61,20 @@ return Q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,
61
61
  /* @__PURE__ */Q("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Kt&&yt(),
62
62
  /* @__PURE__ */Z("span",{id:De,className:"truncate",children:Kt?Qt(Ce):Ce})]}),!Kt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[W&&/* @__PURE__ */Z("button",{onClick:()=>$e(e=>!e),title:Ke?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Ke?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Ke?"currentColor":"none",strokeWidth:1.5})}),
63
63
  /* @__PURE__ */Z("button",{onClick:()=>Qn(St),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!wn&&/* @__PURE__ */Z(wr,{maximized:xn,onToggleMax:()=>{xn?(kn(!1),ln(en())):Nr()},onSnap:yr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:ze}),
64
- /* @__PURE__ */Z("button",{type:"button",onClick:rr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */Z(z,{name:"close",className:"h-5 w-5"})})]})]}),ce&&He&&!U&&!me&&/* @__PURE__ */Z("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
65
- /* @__PURE__ */Z(Yt.Provider,{value:St,children:/* @__PURE__ */Z(an.Provider,{value:{rightRef:ot,leftRef:it,notify:()=>st(!0),active:zt,isDirty:qn,footerOpen:ct&&!U&&!Y&&!_&&!me},children:/* @__PURE__ */Z("div",{ref:rt,...U?{onPointerDown:mr,onContextMenu:e=>{e.preventDefault(),Je({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${U?"p-0 cursor-move":_||J?"p-0":Y?"p-2":"p-4"} ${U||fn?"":"backdrop-blur-sm"} ${!1===E||_||J?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${U?"rounded-2xl select-none":""}`,style:{...U?{touchAction:"none"}:{},backgroundColor:U?"transparent":fn?"rgb(var(--window-content-rgb))":zt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */Z(Me,{children:ue})})})}),U&&_e&&/* @__PURE__ */Q(v,{minWidth:160,style:{left:_e.x,top:_e.y},onClose:()=>Je(null),children:[
66
- /* @__PURE__ */Z(x,{onClick:()=>{Je(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:St}))},children:"Settings"}),
67
- /* @__PURE__ */Z(k,{}),ie&&/* @__PURE__ */Q(ee,{children:[ie,
68
- /* @__PURE__ */Z(k,{})]}),
69
- /* @__PURE__ */Q(x,{onClick:()=>{Je(null),$e(e=>!e)},children:[
64
+ /* @__PURE__ */Z("button",{type:"button",onClick:rr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */Z(z,{name:"close",className:"h-5 w-5"})})]})]}),ce&&He&&!Y&&!me&&/* @__PURE__ */Z("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
65
+ /* @__PURE__ */Z(Ut.Provider,{value:St,children:/* @__PURE__ */Z(an.Provider,{value:{rightRef:ot,leftRef:it,notify:()=>st(!0),active:zt,isDirty:qn,footerOpen:ct&&!Y&&!U&&!J&&!me},children:/* @__PURE__ */Z("div",{ref:rt,...Y?{onPointerDown:mr,onContextMenu:e=>{e.preventDefault(),Ge({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${Y?"p-0 cursor-move":J||G?"p-0":U?"p-2":"p-4"} ${Y||fn?"":"backdrop-blur-sm"} ${!1===k||J||G?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${Y?"rounded-2xl select-none":""}`,style:{...Y?{touchAction:"none"}:{},backgroundColor:Y?"transparent":fn?"rgb(var(--window-content-rgb))":zt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */Z(Me,{children:ue})})})}),Y&&Je&&/* @__PURE__ */Q(b,{minWidth:160,style:{left:Je.x,top:Je.y},onClose:()=>Ge(null),children:[
66
+ /* @__PURE__ */Z(v,{onClick:()=>{Ge(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:St}))},children:"Settings"}),
67
+ /* @__PURE__ */Z(x,{}),ie&&/* @__PURE__ */Q(ee,{children:[ie,
68
+ /* @__PURE__ */Z(x,{})]}),
69
+ /* @__PURE__ */Q(v,{onClick:()=>{Ge(null),$e(e=>!e)},children:[
70
70
  /* @__PURE__ */Z("span",{className:"flex-1",children:"Always on Top"}),Ke&&/* @__PURE__ */Z(z,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
71
- /* @__PURE__ */Z(k,{}),
72
- /* @__PURE__ */Z(x,{onClick:()=>{Je(null),rr()},children:"Close"})]}),
73
- /* @__PURE__ */Q("div",{onPointerDown:mr,ref:lt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${fn?"":" cursor-move"}${zt&&!fn?" backdrop-blur-sm":""}${U||Y||_||me||!ct?" hidden":""}`,style:{touchAction:"none",backgroundColor:fn?"rgb(var(--window-footer-rgb))":zt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
71
+ /* @__PURE__ */Z(x,{}),
72
+ /* @__PURE__ */Z(v,{onClick:()=>{Ge(null),rr()},children:"Close"})]}),
73
+ /* @__PURE__ */Q("div",{onPointerDown:mr,ref:lt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${fn?"":" cursor-move"}${zt&&!fn?" backdrop-blur-sm":""}${Y||U||J||me||!ct?" hidden":""}`,style:{touchAction:"none",backgroundColor:fn?"rgb(var(--window-footer-rgb))":zt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
74
74
  /* @__PURE__ */Q("div",{className:"flex items-center gap-2 min-w-0",children:[pt&&/* @__PURE__ */Z(Le,{auto:!0}),T,
75
75
  /* @__PURE__ */Z("div",{ref:it,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),w]}),
76
76
  /* @__PURE__ */Q("div",{className:"flex items-center gap-2 ml-auto",children:[
77
- /* @__PURE__ */Z("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),L]})]}),!U&&!me&&!Kt&&zt&&!wn&&/* @__PURE__ */Q(ee,{children:[
77
+ /* @__PURE__ */Z("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),L]})]}),!Y&&!me&&!Kt&&zt&&!wn&&/* @__PURE__ */Q(ee,{children:[
78
78
  /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
79
79
  /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
80
80
  /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
@@ -82,18 +82,18 @@ return Q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,
82
82
  /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
83
83
  /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
84
84
  /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
85
- /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Kt&&/* @__PURE__ */Z("div",{className:"absolute inset-0",style:{zIndex:D.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>jt(!0),onMouseLeave:()=>jt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Jn(St),zr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Rt&&/* @__PURE__ */Z("button",{type:"button","data-expose-close":!0,"aria-label":Te.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/qr})`,transformOrigin:"top right",zIndex:D.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),rr()},children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Kt&&Or&&/* @__PURE__ */Z("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Or.x,top:Or.y+Or.h+4,width:Or.w,zIndex:D.expose+(Rt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Qt(Ce)})]}),Yr=Re&&/* @__PURE__ */Q(v,{style:{left:Re.x,top:Re.y},onClose:()=>Oe(null),minWidth:160,children:[!U&&!Y&&!fn&&/* @__PURE__ */Q(ee,{children:[
86
- /* @__PURE__ */Q(x,{onClick:()=>{Qn(St),Oe(null)},children:[
87
- /* @__PURE__ */Z(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!wn&&/* @__PURE__ */Q(x,xn?{onClick:()=>{kn(!1),ln(en()),Oe(null)},children:[
85
+ /* @__PURE__ */Z("div",{onPointerDown:e=>pr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Kt&&/* @__PURE__ */Z("div",{className:"absolute inset-0",style:{zIndex:D.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Ft(!0),onMouseLeave:()=>Ft(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Gn(St),zr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Rt&&/* @__PURE__ */Z("button",{type:"button","data-expose-close":!0,"aria-label":Te.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/qr})`,transformOrigin:"top right",zIndex:D.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),rr()},children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Kt&&Or&&/* @__PURE__ */Z("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Or.x,top:Or.y+Or.h+4,width:Or.w,zIndex:D.expose+(Rt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Qt(Ce)})]}),Ur=Re&&/* @__PURE__ */Q(b,{style:{left:Re.x,top:Re.y},onClose:()=>Oe(null),minWidth:160,children:[!Y&&!U&&!fn&&/* @__PURE__ */Q(ee,{children:[
86
+ /* @__PURE__ */Q(v,{onClick:()=>{Qn(St),Oe(null)},children:[
87
+ /* @__PURE__ */Z(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!wn&&/* @__PURE__ */Q(v,xn?{onClick:()=>{kn(!1),ln(en()),Oe(null)},children:[
88
88
  /* @__PURE__ */Z("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */Z("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),ze.windowed]}:{onClick:()=>{Nr(),Oe(null)},children:[
89
- /* @__PURE__ */Z(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),W&&!fn&&/* @__PURE__ */Q(x,{onClick:()=>{$e(e=>!e),Oe(null)},children:[
90
- /* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-4 w-4 "+(Ke?"text-blue-600":""),fill:Ke?"currentColor":"none",strokeWidth:1.5}),Ke?ze.unpin:ze.pinOnTop]}),je&&/* @__PURE__ */Q(x,{onClick:()=>{Oe(null),Ve()},children:[
91
- /* @__PURE__ */Z(z,{name:"star",className:"h-4 w-4",fill:Ye?"currentColor":"none",strokeWidth:1.5}),Ye?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(tn[St]||[]).length>0&&/* @__PURE__ */Z(ee,{children:(tn[St]||[]).map((e,t)=>/* @__PURE__ */Q(x,{onClick:()=>{Oe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(fn&&Fe?.home)&&/* @__PURE__ */Q(ee,{children:[
92
- /* @__PURE__ */Z(k,{}),
93
- /* @__PURE__ */Q(x,{danger:!0,onClick:()=>{Oe(null),rr()},children:[
94
- /* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Xr=!!se&&Nt.some(e=>e.id===se),Vr=!At||Xr||U?null:/* @__PURE__ */Q("div",{"data-modal-restore-tab":!0,"data-modal-id":St,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
95
- /* @__PURE__ */Z("button",{type:"button",onClick:()=>Jn(St),title:ze.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Ae||ze.windowSuffix}),
96
- /* @__PURE__ */Z("button",{type:"button",onClick:()=>Jn(St),title:ze.restore,"aria-label":ze.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
89
+ /* @__PURE__ */Z(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),W&&!fn&&/* @__PURE__ */Q(v,{onClick:()=>{$e(e=>!e),Oe(null)},children:[
90
+ /* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-4 w-4 "+(Ke?"text-blue-600":""),fill:Ke?"currentColor":"none",strokeWidth:1.5}),Ke?ze.unpin:ze.pinOnTop]}),Fe&&/* @__PURE__ */Q(v,{onClick:()=>{Oe(null),Ve()},children:[
91
+ /* @__PURE__ */Z(z,{name:"star",className:"h-4 w-4",fill:Ue?"currentColor":"none",strokeWidth:1.5}),Ue?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(tn[St]||[]).length>0&&/* @__PURE__ */Z(ee,{children:(tn[St]||[]).map((e,t)=>/* @__PURE__ */Q(v,{onClick:()=>{Oe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(fn&&je?.home)&&/* @__PURE__ */Q(ee,{children:[
92
+ /* @__PURE__ */Z(x,{}),
93
+ /* @__PURE__ */Q(v,{danger:!0,onClick:()=>{Oe(null),rr()},children:[
94
+ /* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Xr=!!se&&Nt.some(e=>e.id===se),Vr=!At||Xr||Y?null:/* @__PURE__ */Q("div",{"data-modal-restore-tab":!0,"data-modal-id":St,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
95
+ /* @__PURE__ */Z("button",{type:"button",onClick:()=>Gn(St),title:ze.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Ae||ze.windowSuffix}),
96
+ /* @__PURE__ */Z("button",{type:"button",onClick:()=>Gn(St),title:ze.restore,"aria-label":ze.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
97
97
  /* @__PURE__ */Z("button",{type:"button",onClick:()=>{rr()},title:ze.close,"aria-label":ze.close,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return te(
98
- /* @__PURE__ */Q(Xt.Provider,{value:null,children:[Ur,Yr,Vr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Nr&&"Escape"===e.key&&(qr(null),zr(!1))});var Xr=100,Vr={past:[],future:[]};function Gr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Xr?r.slice(r.length-Xr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Vr}}var _r=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Jr=500,Qr=250;function Zr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=_(Gr,Vr),s=O(/* @__PURE__ */new Map),[l,c]=F(0),u=l>0,[d,h]=F(0),[m,p]=F(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=O(null),b=O(!1),v=B(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=B((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=B(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=B(e=>{h(t=>t+(e?1:-1))},[]),C=B(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=F(0),S=M>0,L=B(e=>{N(t=>t+(e?1:-1))},[]),T=K(Ne),z=T?.claimReadOnly;j(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;j(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=O({last:0,count:0,tripped:!1}),P=O(!1),I=B((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Qr&&(r.count=0),r.last=o,++r.count>Jr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Jr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),W=B(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),$=B(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"undo",redoStep:t})},[o.past,v,W]),R=B(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"redo",undoStep:t})},[o.future,v,W]),[q,H]=F(0),U=O(0),Y=O(0),X=O(!1),G=B(()=>{b.current=!0,P.current=!1,g.current=null,U.current+=1,Y.current=U.current,H(U.current)},[]),J=O(void 0),ee=B(e=>{void 0!==e&&(void 0!==J.current&&e!==J.current&&(X.current=!0),J.current=e),G()},[G]);j(()=>{b.current&&q===Y.current&&(b.current=!1,g.current=null,(P.current||X.current)&&a({type:"clear"}),P.current=!1,X.current=!1)},[q]);const te=B(()=>{X.current=!0,a({type:"clear"}),G()},[G]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=Mr(r),ie=O({undo:$,redo:R,canUndo:ne,canRedo:re});ie.current={undo:$,redo:R,canUndo:ne,canRedo:re},j(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&_r.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=V(()=>({register:x,unregister:k,record:I,undo:$,redo:R,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:u,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,I,$,R,te,ee,ne,re,y,u,S,L,E,f,C,o.past,o.future]),se=""!==sn(),le=K(an)?.footerOpen??!1,ce=se&&y&&u&&!S&&le;/* @__PURE__ */
99
- return Q(Ne.Provider,{value:ae,children:[ce&&/* @__PURE__ */Z(cn,{position:"left",quiet:!0,children:/* @__PURE__ */Z(Le,{auto:!0})}),e]})}function eo(){const e=K(Ne),t=B(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function to(e){const t=K(Ne),n=t?.claimReadOnly,r=t?.claimEditable;j(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function no(e,t,n){const r=K(Ne),o=G(),i=O(e),a=O(t);a.current=t,j(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=O(r);c.current=r;const u=O({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},j(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function ro(e,t){const[n,r]=F(e);return no(n,e=>r(()=>e),t),[n,r]}export{un as CancelButton,Qe as DocFavStar,je as EntityWindowFallback,Re as EntityWindowLoading,Fe as EntityWindowState,Jt as KEY_ACTIVATED_SELECTOR,Ke as LoadingSpinner,_t as MODAL_SUBMIT_SELECTOR,Yr as Modal,cn as ModalActions,Le as UndoControls,Zr as UndoProvider,ce as WINDOW_REGISTRY,Ce as WindowCrashedFallback,Me as WindowErrorBoundary,gt as WindowManagerProvider,rn as WindowTitle,rt as activateWindowById,At as beginWindowGesture,Xn as cancelWindowFront,pe as client_default,Br as commitExposeHighlight,Yn as confirmWindowDiscard,Dt as drainPerfEvents,Dr as exitExposeMode,kn as forgetMaximizedWindowBoxes,kr as getActiveModalId,at as getActiveWindowRoute,Fr as getExposeHighlight,Ut as getWindowChromeVersion,vn as getWindowPosition,Be as isDraftEntityId,He as isDraftEntityWindow,ae as isEntityEntry,ie as isPageEntry,he as isShellApiClientConfigured,Pe as isTabWindow,zt as markMenuOpen,Bt as readWindowChrome,Bn as requestWindowFront,qr as setExposeHighlight,Tt as setPerfCollecting,de as setShellApiClient,be as setShellHomeRoute,Ee as setShellTabStrip,le as setShellWindowRegistry,bn as setWindowDefaultPosition,xn as setWindowPosition,$t as splitTitle,jr as subscribeExposeHighlight,Ht as subscribeWindowChrome,Ie as tabGroupOf,Ar as toggleExposeMode,On as useCurrentTabKey,sn as useEnclosingModalId,Mr as useIsActiveWindow,ln as useModalActive,we as usePageSearch,eo as useUndo,to as useUndoCanEdit,no as useUndoable,ro as useUndoableState,en as useWidgetSettings,Xe as useWindowDirty,Ge as useWindowManager,nn as useWindowMenuItem,on as useWindowTitle,Un as windowHoldsChanges};
98
+ /* @__PURE__ */Q(Xt.Provider,{value:null,children:[Yr,Ur,Vr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Nr&&"Escape"===e.key&&(qr(null),zr(!1))});var Xr=100,Vr={past:[],future:[]};function _r(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Xr?r.slice(r.length-Xr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Vr}}var Jr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Gr=500,Qr=250;function Zr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=J(_r,Vr),s=O(/* @__PURE__ */new Map),[l,c]=j(0),u=l>0,[d,h]=j(0),[m,p]=j(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=O(null),b=O(!1),v=B(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=B((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=B(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=B(e=>{h(t=>t+(e?1:-1))},[]),C=B(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=j(0),S=M>0,L=B(e=>{N(t=>t+(e?1:-1))},[]),T=K(Ne),z=T?.claimReadOnly;F(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;F(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=O({last:0,count:0,tripped:!1}),P=O(!1),I=B((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Qr&&(r.count=0),r.last=o,++r.count>Gr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Gr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),W=B(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),$=B(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"undo",redoStep:t})},[o.past,v,W]),R=B(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};W(e.values),a({type:"redo",undoStep:t})},[o.future,v,W]),[q,H]=j(0),Y=O(0),U=O(0),X=O(!1),_=B(()=>{b.current=!0,P.current=!1,g.current=null,Y.current+=1,U.current=Y.current,H(Y.current)},[]),G=O(void 0),ee=B(e=>{void 0!==e&&(void 0!==G.current&&e!==G.current&&(X.current=!0),G.current=e),_()},[_]);F(()=>{b.current&&q===U.current&&(b.current=!1,g.current=null,(P.current||X.current)&&a({type:"clear"}),P.current=!1,X.current=!1)},[q]);const te=B(()=>{X.current=!0,a({type:"clear"}),_()},[_]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=Mr(r),ie=O({undo:$,redo:R,canUndo:ne,canRedo:re});ie.current={undo:$,redo:R,canUndo:ne,canRedo:re},F(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Jr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=V(()=>({register:x,unregister:k,record:I,undo:$,redo:R,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:u,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,I,$,R,te,ee,ne,re,y,u,S,L,E,f,C,o.past,o.future]),se=""!==sn(),le=K(an)?.footerOpen??!1,ce=se&&y&&u&&!S&&le;/* @__PURE__ */
99
+ return Q(Ne.Provider,{value:ae,children:[ce&&/* @__PURE__ */Z(cn,{position:"left",quiet:!0,children:/* @__PURE__ */Z(Le,{auto:!0})}),e]})}function eo(){const e=K(Ne),t=B(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function to(e){const t=K(Ne),n=t?.claimReadOnly,r=t?.claimEditable;F(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function no(e,t,n){const r=K(Ne),o=_(),i=O(e),a=O(t);a.current=t,F(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=O(r);c.current=r;const u=O({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},F(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function ro(e,t){const[n,r]=j(e);return no(n,e=>r(()=>e),t),[n,r]}export{un as CancelButton,Qe as DocFavStar,Fe as EntityWindowFallback,Re as EntityWindowLoading,je as EntityWindowState,Gt as KEY_ACTIVATED_SELECTOR,Ke as LoadingSpinner,Jt as MODAL_SUBMIT_SELECTOR,Ur as Modal,cn as ModalActions,Le as UndoControls,Zr as UndoProvider,ce as WINDOW_REGISTRY,Ce as WindowCrashedFallback,Me as WindowErrorBoundary,gt as WindowManagerProvider,rn as WindowTitle,rt as activateWindowById,At as beginWindowGesture,Xn as cancelWindowFront,pe as client_default,Br as commitExposeHighlight,Un as confirmWindowDiscard,Dt as drainPerfEvents,Dr as exitExposeMode,kn as forgetMaximizedWindowBoxes,kr as getActiveModalId,at as getActiveWindowRoute,jr as getExposeHighlight,Yt as getWindowChromeVersion,vn as getWindowPosition,Be as isDraftEntityId,He as isDraftEntityWindow,ae as isEntityEntry,ie as isPageEntry,he as isShellApiClientConfigured,Pe as isTabWindow,zt as markMenuOpen,Bt as readWindowChrome,Bn as requestWindowFront,qr as setExposeHighlight,Tt as setPerfCollecting,de as setShellApiClient,be as setShellHomeRoute,Ee as setShellTabStrip,le as setShellWindowRegistry,bn as setWindowDefaultPosition,xn as setWindowPosition,$t as splitTitle,Fr as subscribeExposeHighlight,Ht as subscribeWindowChrome,Ie as tabGroupOf,Ar as toggleExposeMode,On as useCurrentTabKey,sn as useEnclosingModalId,Mr as useIsActiveWindow,ln as useModalActive,we as usePageSearch,eo as useUndo,to as useUndoCanEdit,no as useUndoable,ro as useUndoableState,en as useWidgetSettings,Xe as useWindowDirty,_e as useWindowManager,nn as useWindowMenuItem,on as useWindowTitle,Yn as windowHoldsChanges};