efficient-shell 10.8.0 → 10.13.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 (248) hide show
  1. package/README.md +18 -1
  2. package/dist/{Browser-EMNG4HTB.js → Browser-36HIDVL6.js} +13 -13
  3. package/dist/Calculator-ZFMTTDQ6.js +29 -0
  4. package/dist/{CurrencyConverter-L4WCQBUO.js → CurrencyConverter-577XB7A3.js} +8 -8
  5. package/dist/{Documents-DEBV3IGR.js → Documents-ZS4M5I3S.js} +3 -3
  6. package/dist/{Files-WMINXPW5.js → Files-7XO7A4YT.js} +18 -18
  7. package/dist/Notepad-6CFMSQCK.js +24 -0
  8. package/dist/PomodoroTimer-CXJVY7U3.js +91 -0
  9. package/dist/{Preview-OWM7JE4U.js → Preview-HV2KB3IU.js} +13 -13
  10. package/dist/{Sidebar-XMDORF77.js → Sidebar-7RR5WNIF.js} +19 -19
  11. package/dist/{Spreadsheet-I7LUDZTI.js → Spreadsheet-J5AGNSGN.js} +12 -12
  12. package/dist/{Stock-CN4KZVHA.js → Stock-M4TDRNCI.js} +2 -2
  13. package/dist/{Weather-N3AC6Q5Z.js → Weather-K634BVDX.js} +41 -41
  14. package/dist/{WorldClock-YTNLKOSF.js → WorldClock-56CYOGR2.js} +6 -6
  15. package/dist/ai/index.d.ts +1 -1
  16. package/dist/ai/index.js +26 -26
  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/SpecChart.js +1 -1
  21. package/dist/chunk-2HMNOLKX.js +1 -0
  22. package/dist/{chunk-7T4E6VMR.js → chunk-2K2W6VIR.js} +1 -1
  23. package/dist/{chunk-235E63CP.js → chunk-37U326EL.js} +7 -7
  24. package/dist/chunk-3GL4OVBB.js +1 -0
  25. package/dist/chunk-3RVLLU2A.js +5 -0
  26. package/dist/chunk-44QWF5X2.js +2 -0
  27. package/dist/chunk-45VOQS5V.js +4 -0
  28. package/dist/chunk-5RE6R3XC.js +2 -0
  29. package/dist/chunk-5X4DBMS6.js +2 -0
  30. package/dist/{chunk-ZQKZCQJA.js → chunk-7PUVPDUZ.js} +4 -4
  31. package/dist/{chunk-YDEIXM2A.js → chunk-7TC3LJQM.js} +1 -1
  32. package/dist/chunk-A4TFCYWN.js +2 -0
  33. package/dist/{chunk-456CJCDK.js → chunk-A5BV6NFA.js} +5 -5
  34. package/dist/chunk-A5SPSAWW.js +2 -0
  35. package/dist/{chunk-JGMQLQTE.js → chunk-AGG4RFXR.js} +9 -9
  36. package/dist/chunk-APLKFBJH.js +2 -0
  37. package/dist/{chunk-CUO62I67.js → chunk-AZ3AR7U7.js} +3 -3
  38. package/dist/chunk-BJXDOM2N.js +2 -0
  39. package/dist/{chunk-JDBMIY7R.js → chunk-BS7IPLRR.js} +1 -1
  40. package/dist/{chunk-T2ULJNQP.js → chunk-CKKUFDZ3.js} +21 -21
  41. package/dist/chunk-COJYPNKF.js +2 -0
  42. package/dist/{chunk-4FX5FZ4Z.js → chunk-DDCMMOB4.js} +1 -1
  43. package/dist/chunk-EDKRGYZX.js +9 -0
  44. package/dist/{chunk-OYEAAX4A.js → chunk-EYZZW6SO.js} +5 -5
  45. package/dist/{chunk-V4W5BG4A.js → chunk-F2MWLDN2.js} +1 -1
  46. package/dist/{chunk-CNPEAHOY.js → chunk-F6JDUMM7.js} +2 -2
  47. package/dist/chunk-FIZKXNCZ.js +2 -0
  48. package/dist/{chunk-X2S2XDZI.js → chunk-GEYM4WN3.js} +1 -1
  49. package/dist/{chunk-NOYVZPAU.js → chunk-H64JJSXC.js} +4 -4
  50. package/dist/chunk-I5VYOWIX.js +2 -0
  51. package/dist/chunk-IABSP2GJ.js +2 -0
  52. package/dist/chunk-IKMWKOT5.js +1 -0
  53. package/dist/chunk-IXZGA4MS.js +2 -0
  54. package/dist/{chunk-4YDCNWNU.js → chunk-JGFY54A4.js} +1 -1
  55. package/dist/{chunk-SKP66IK4.js → chunk-JRZ7PPVJ.js} +4 -4
  56. package/dist/chunk-KLHUKAD3.js +2 -0
  57. package/dist/chunk-KOBYM5JV.js +14 -0
  58. package/dist/chunk-LF27WIN2.js +1 -0
  59. package/dist/chunk-LYJBMVUE.js +4 -0
  60. package/dist/chunk-MIOL4CDN.js +2 -0
  61. package/dist/{chunk-BAPQOY7Q.js → chunk-NPK2TLIU.js} +1 -1
  62. package/dist/{chunk-WN5HHHLO.js → chunk-OOLPDASG.js} +1 -1
  63. package/dist/{chunk-5NIA6CSZ.js → chunk-ORIGX2H5.js} +4 -4
  64. package/dist/chunk-PGKNWSSC.js +2 -0
  65. package/dist/chunk-PJW3BL27.js +2 -0
  66. package/dist/{chunk-35DG7Y4M.js → chunk-QDQ347RL.js} +1 -1
  67. package/dist/chunk-QHUGCISZ.js +2 -0
  68. package/dist/chunk-QKWYCOMM.js +23 -0
  69. package/dist/{chunk-SW7ENSST.js → chunk-QNK2I4IH.js} +9 -9
  70. package/dist/chunk-R7APUBZB.js +29 -0
  71. package/dist/chunk-RRVBOD2U.js +2 -0
  72. package/dist/{chunk-7SIH7VPC.js → chunk-SCPCZCYQ.js} +1 -1
  73. package/dist/{chunk-3LPG6HMG.js → chunk-SMUH7NAN.js} +1 -1
  74. package/dist/chunk-STAVWXWV.js +1 -0
  75. package/dist/chunk-SVUOPZCB.js +2 -0
  76. package/dist/chunk-TNPGO42S.js +4 -0
  77. package/dist/{chunk-GKIU55T5.js → chunk-TVH7IZQ4.js} +2 -2
  78. package/dist/chunk-UCWJA6LT.js +2 -0
  79. package/dist/{chunk-36R3R3IB.js → chunk-ULXCDM7Y.js} +4 -4
  80. package/dist/{chunk-4X75SGTT.js → chunk-UNRPRMQO.js} +11 -11
  81. package/dist/{chunk-TEIJOFHO.js → chunk-W6SC3ZNO.js} +2 -2
  82. package/dist/chunk-WH6NPZ6B.js +2 -0
  83. package/dist/chunk-WTTSB4SV.js +3 -0
  84. package/dist/{chunk-O6G72N3C.js → chunk-XBB6LSSB.js} +5 -5
  85. package/dist/chunk-XGAXRNZS.js +2 -0
  86. package/dist/chunk-XMTGZI2O.js +2 -0
  87. package/dist/chunk-Y3JW2GW5.js +1 -0
  88. package/dist/{chunk-B4KKEVHL.js → chunk-YGSU5KCP.js} +3 -3
  89. package/dist/chunk-Z6KYMY3R.js +5 -0
  90. package/dist/chunk-Z7TJ5Y7T.js +2 -0
  91. package/dist/chunk-ZE5FN26Z.js +5 -0
  92. package/dist/chunk-ZTPMMNAZ.js +1 -0
  93. package/dist/{chunk-I7EF6DW2.js → chunk-ZZOBG6GP.js} +13 -13
  94. package/dist/data/ListLoadError.js +1 -1
  95. package/dist/format/index.d.ts +1 -0
  96. package/dist/format/index.js +1 -1
  97. package/dist/forms/BorderInput.js +1 -1
  98. package/dist/forms/BrandAssetEditor.js +1 -1
  99. package/dist/forms/Calendar.d.ts +1 -5
  100. package/dist/forms/Calendar.js +1 -1
  101. package/dist/forms/ColorPicker.js +1 -1
  102. package/dist/forms/ComposerAttachments.js +1 -1
  103. package/dist/forms/CornersInput.js +1 -1
  104. package/dist/forms/DatePicker.js +1 -1
  105. package/dist/forms/DateRangePicker.d.ts +9 -7
  106. package/dist/forms/DateRangePicker.js +1 -1
  107. package/dist/forms/DateTimePicker.js +1 -1
  108. package/dist/forms/DisplayChips.js +1 -1
  109. package/dist/forms/IconPicker.js +1 -1
  110. package/dist/forms/InputNumber.js +1 -1
  111. package/dist/forms/LinkPicker.js +1 -1
  112. package/dist/forms/MediaLibrary.js +1 -1
  113. package/dist/forms/MediaUploadField.js +1 -1
  114. package/dist/forms/MediaUsedInList.js +1 -1
  115. package/dist/forms/PositionInput.js +1 -1
  116. package/dist/forms/Select.d.ts +1 -1
  117. package/dist/forms/SidesInput.js +1 -1
  118. package/dist/forms/Slider.js +1 -1
  119. package/dist/forms/Snippet.js +1 -1
  120. package/dist/forms/SplitButton.js +1 -1
  121. package/dist/forms/TextToolbar.d.ts +1 -1
  122. package/dist/forms/TextToolbar.js +1 -1
  123. package/dist/forms/TimePicker.js +1 -1
  124. package/dist/forms/WidthsBar.js +1 -1
  125. package/dist/forms/textAlign.d.ts +1 -1
  126. package/dist/icons/efficient-glyphs.d.ts +11 -0
  127. package/dist/icons/efficient-glyphs.js +1 -1
  128. package/dist/icons/efficient-looks.d.ts +16 -0
  129. package/dist/icons/efficient-looks.js +1 -1
  130. package/dist/icons/efficient-meanings.d.ts +11 -0
  131. package/dist/icons/efficient-meanings.js +1 -1
  132. package/dist/icons/efficient.d.ts +11 -0
  133. package/dist/icons/efficient.js +1 -1
  134. package/dist/icons/glyphs/BrandAlipayIcon.d.ts +11 -0
  135. package/dist/icons/glyphs/BrandAlipayIcon.js +1 -0
  136. package/dist/icons/glyphs/BrandDinersclubIcon.d.ts +11 -0
  137. package/dist/icons/glyphs/BrandDinersclubIcon.js +1 -0
  138. package/dist/icons/glyphs/BrandJcbIcon.d.ts +11 -0
  139. package/dist/icons/glyphs/BrandJcbIcon.js +1 -0
  140. package/dist/icons/glyphs/CountUpIcon.d.ts +8 -0
  141. package/dist/icons/glyphs/CountUpIcon.js +1 -0
  142. package/dist/icons/glyphs/DurationIcon.d.ts +8 -0
  143. package/dist/icons/glyphs/DurationIcon.js +1 -0
  144. package/dist/icons/glyphs/HoverLiftIcon.d.ts +8 -0
  145. package/dist/icons/glyphs/HoverLiftIcon.js +1 -0
  146. package/dist/icons/glyphs/HoverNextImageIcon.d.ts +8 -0
  147. package/dist/icons/glyphs/HoverNextImageIcon.js +1 -0
  148. package/dist/icons/glyphs/HoverNoneIcon.d.ts +8 -0
  149. package/dist/icons/glyphs/HoverNoneIcon.js +1 -0
  150. package/dist/icons/glyphs/HoverRotateIcon.d.ts +8 -0
  151. package/dist/icons/glyphs/HoverRotateIcon.js +1 -0
  152. package/dist/icons/glyphs/HoverZoomIcon.d.ts +8 -0
  153. package/dist/icons/glyphs/HoverZoomIcon.js +1 -0
  154. package/dist/icons/glyphs/LoopIcon.d.ts +8 -0
  155. package/dist/icons/glyphs/LoopIcon.js +1 -0
  156. package/dist/icons/index.d.ts +2 -2
  157. package/dist/icons/index.js +1 -1
  158. package/dist/icons/looks/CountUpMiniIcon.d.ts +8 -0
  159. package/dist/icons/looks/CountUpMiniIcon.js +1 -0
  160. package/dist/icons/looks/CountUpSolidIcon.d.ts +8 -0
  161. package/dist/icons/looks/CountUpSolidIcon.js +1 -0
  162. package/dist/icons/looks/DurationMiniIcon.d.ts +8 -0
  163. package/dist/icons/looks/DurationMiniIcon.js +1 -0
  164. package/dist/icons/looks/DurationSolidIcon.d.ts +8 -0
  165. package/dist/icons/looks/DurationSolidIcon.js +1 -0
  166. package/dist/icons/looks/HoverLiftMiniIcon.d.ts +8 -0
  167. package/dist/icons/looks/HoverLiftMiniIcon.js +1 -0
  168. package/dist/icons/looks/HoverLiftSolidIcon.d.ts +8 -0
  169. package/dist/icons/looks/HoverLiftSolidIcon.js +1 -0
  170. package/dist/icons/looks/HoverNextImageMiniIcon.d.ts +8 -0
  171. package/dist/icons/looks/HoverNextImageMiniIcon.js +1 -0
  172. package/dist/icons/looks/HoverNextImageSolidIcon.d.ts +8 -0
  173. package/dist/icons/looks/HoverNextImageSolidIcon.js +1 -0
  174. package/dist/icons/looks/HoverNoneMiniIcon.d.ts +8 -0
  175. package/dist/icons/looks/HoverNoneMiniIcon.js +1 -0
  176. package/dist/icons/looks/HoverNoneSolidIcon.d.ts +8 -0
  177. package/dist/icons/looks/HoverNoneSolidIcon.js +1 -0
  178. package/dist/icons/looks/HoverRotateMiniIcon.d.ts +8 -0
  179. package/dist/icons/looks/HoverRotateMiniIcon.js +1 -0
  180. package/dist/icons/looks/HoverRotateSolidIcon.d.ts +8 -0
  181. package/dist/icons/looks/HoverRotateSolidIcon.js +1 -0
  182. package/dist/icons/looks/HoverZoomMiniIcon.d.ts +8 -0
  183. package/dist/icons/looks/HoverZoomMiniIcon.js +1 -0
  184. package/dist/icons/looks/HoverZoomSolidIcon.d.ts +8 -0
  185. package/dist/icons/looks/HoverZoomSolidIcon.js +1 -0
  186. package/dist/icons/looks/LoopMiniIcon.d.ts +8 -0
  187. package/dist/icons/looks/LoopMiniIcon.js +1 -0
  188. package/dist/icons/looks/LoopSolidIcon.d.ts +8 -0
  189. package/dist/icons/looks/LoopSolidIcon.js +1 -0
  190. package/dist/icons/looks/map.js +1 -1
  191. package/dist/icons/payment.d.ts +46 -0
  192. package/dist/icons/payment.js +4 -0
  193. package/dist/icons/sets.js +1 -1
  194. package/dist/index.d.ts +3 -2
  195. package/dist/index.js +694 -694
  196. package/dist/map/index.js +1 -1
  197. package/dist/names-CwzeaUf6.d.ts +23 -0
  198. package/dist/page-tabs/index.js +5 -5
  199. package/dist/shell/AppUpdateBanner.js +1 -1
  200. package/dist/shell/ContextMenu.js +1 -1
  201. package/dist/shell/DropdownMenu.js +1 -1
  202. package/dist/shell/HelpCenter.js +1 -1
  203. package/dist/shell/ImageLightbox.js +1 -1
  204. package/dist/shell/LanguageSelect.js +1 -1
  205. package/dist/shell/Markdown.d.ts +1 -1
  206. package/dist/shell/Markdown.js +1 -1
  207. package/dist/shell/MilestoneTimeline.js +1 -1
  208. package/dist/shell/PopupMenu.js +1 -1
  209. package/dist/shell/ProductionTimeline.js +1 -1
  210. package/dist/shell/SearchableSelect.js +1 -1
  211. package/dist/shell/SettingRow.js +1 -1
  212. package/dist/shell/TimeAgo.js +1 -1
  213. package/dist/shell/TimelineTrack.js +1 -1
  214. package/dist/shell/TopNav.js +1 -1
  215. package/dist/shell/timelineDates.js +1 -1
  216. package/dist/telemetry/index.js +1 -1
  217. package/dist/templates/ChatTemplate.js +1 -1
  218. package/dist/templates/CheckoutTemplate.js +1 -1
  219. package/dist/templates/DataTablePage.js +1 -1
  220. package/dist/templates/EmailTemplate.js +1 -1
  221. package/dist/templates/FormLayoutPage.js +1 -1
  222. package/dist/ui/index.d.ts +3 -2
  223. package/dist/ui/index.js +1 -1
  224. package/dist/utils/date.js +1 -1
  225. package/dist/utils/dateKey.d.ts +25 -0
  226. package/dist/utils/dateKey.js +1 -0
  227. package/dist/utils/format.js +1 -1
  228. package/dist/version.js +1 -1
  229. package/package.json +6 -1
  230. package/dist/Calculator-QZCD6MHP.js +0 -29
  231. package/dist/Notepad-KM6GRBUP.js +0 -24
  232. package/dist/PomodoroTimer-2Q5DXEYT.js +0 -91
  233. package/dist/chunk-4BYJQU37.js +0 -2
  234. package/dist/chunk-4GSSOUOI.js +0 -29
  235. package/dist/chunk-5OTS2G3M.js +0 -1
  236. package/dist/chunk-632N62BY.js +0 -9
  237. package/dist/chunk-E5MVH3SH.js +0 -14
  238. package/dist/chunk-LPSFFJFK.js +0 -1
  239. package/dist/chunk-MNXRAZJV.js +0 -23
  240. package/dist/chunk-O2GPQ2MX.js +0 -1
  241. package/dist/chunk-P2HDCQBJ.js +0 -1
  242. package/dist/chunk-QZXN5IRK.js +0 -3
  243. package/dist/chunk-TFUIOEBX.js +0 -1
  244. package/dist/chunk-UVA3BITM.js +0 -2
  245. package/dist/chunk-XO7URRTM.js +0 -2
  246. package/dist/names-CyfXNkce.d.ts +0 -23
  247. /package/dist/{chunk-DSIDJYH7.js → chunk-744BFBBV.js} +0 -0
  248. /package/dist/{chunk-EHPZIBOL.js → chunk-NOKZ54GD.js} +0 -0
@@ -0,0 +1,25 @@
1
+ /**
2
+ * ONE calendar day as `YYYY-MM-DD`, read and written from the LOCAL fields.
3
+ *
4
+ * A day is not an instant: local midnight falls in the previous UTC day for
5
+ * every zone east of Greenwich, so a `toISOString()` round-trip moves the day.
6
+ * The Calendar, the date picker and the range picker store and compare days
7
+ * through this pair (and the month key below), and `efficient-shell/format` exports it for code that may
8
+ * not take the kit (a published page asking "is it that day where the visitor
9
+ * is"). Pure: no React, no DOM.
10
+ */
11
+ /** `YYYY-MM-DD` from a Date's local calendar fields — never `toISOString()`. */
12
+ declare function toDateKey(d: Date): string;
13
+ /**
14
+ * The local midnight of a `YYYY-MM-DD`, or `null` for anything else. Built from
15
+ * the parts, never `new Date(string)`, and a day that does not exist
16
+ * (`2026-02-31`, which the constructor rolls into March) is `null`.
17
+ */
18
+ declare function fromDateKey(key: string | null | undefined): Date | null;
19
+ /** `YYYY-MM`, the month a Date's local fields fall in: the key a calendar's
20
+ * page and a range picker's opening month are compared by. */
21
+ declare function toMonthKey(d: Date): string;
22
+ /** The local midnight of the first day of a `YYYY-MM`, or `null`. */
23
+ declare function fromMonthKey(key: string | null | undefined): Date | null;
24
+
25
+ export { fromDateKey, fromMonthKey, toDateKey, toMonthKey };
@@ -0,0 +1 @@
1
+ export{fromDateKey,fromMonthKey,toDateKey,toMonthKey}from"../chunk-2HMNOLKX.js";import"../chunk-LF27WIN2.js";
@@ -1 +1 @@
1
- export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo,toInstant}from"../chunk-X2S2XDZI.js";import"../chunk-5OTS2G3M.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";
1
+ export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo,toInstant}from"../chunk-GEYM4WN3.js";import"../chunk-Y3JW2GW5.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";import"../chunk-LF27WIN2.js";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export{APP_VERSION,VERSION}from"./chunk-P2HDCQBJ.js";
1
+ export{APP_VERSION,VERSION}from"./chunk-STAVWXWV.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-shell",
3
- "version": "10.8.0",
3
+ "version": "10.13.0",
4
4
  "description": "Desktop-style React UI shell — windows, taskbar, start menu, sticky notes, frosted glass theming, and bundled apps.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -123,6 +123,11 @@
123
123
  "import": "./dist/icons/efficient-looks.js",
124
124
  "default": "./dist/icons/efficient-looks.js"
125
125
  },
126
+ "./icons/payment": {
127
+ "types": "./dist/icons/payment.d.ts",
128
+ "import": "./dist/icons/payment.js",
129
+ "default": "./dist/icons/payment.js"
130
+ },
126
131
  "./icons/phosphor": {
127
132
  "types": "./dist/icons/phosphor.d.ts",
128
133
  "import": "./dist/icons/phosphor.js",
@@ -1,29 +0,0 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-JDBMIY7R.js";import{useWidgetSettings as n}from"./chunk-4X75SGTT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-PXQG5EIH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-235E63CP.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import{Icon as r}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-34URULVW.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as l,useEffect as o}from"react";import{jsxs as s,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[b,g]=c(null),[j,N]=c(!1),[y,x]=c(""),[f,C]=c([]),[v,$]=c(!1),[E,T]=c(()=>e(h)),[W,D]=c(!1),[J,M]=c(E),R=i(null);n(l(()=>{M({...E}),D(!0)},[E]));const S=l(e=>{x(""),k(t=>j||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[j]),U=l(()=>{k("0"),d(null),g(null),N(!1)},[]),w=l((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),X=l(e=>{const t=parseFloat(m);if(null!==p&&b&&!j){const e=w(p,t,b);k(String(e)),d(e),C(n=>[`${p} ${b} ${t} = ${e}`,...n].slice(0,20))}else d(t);g(e),N(!0)},[m,p,b,j,w]),H=l(()=>{if(null===p||!b)return;const e=parseFloat(m),t=w(p,e,b),n=`${p} ${b} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),x(n),k(String(t)),d(null),g(null),N(!0)},[m,p,b,w]),P=l(()=>{k(e=>String(parseFloat(e)/100))},[]),B=l(()=>{k(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);o(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?S(e.key):"."===e.key?S("."):"+"===e.key?X("+"):"-"===e.key?X("-"):"*"===e.key?X("×"):"/"===e.key?(e.preventDefault(),X("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&R.current?.contains(e.target)&&e.preventDefault(),H()):"Escape"===e.key?U():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&P())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[S,X,H,U,P]);const G="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",Q=`${G} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,A=`${G} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,F=`${G} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,K=`${G} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
- return s(a,{children:[
3
- /* @__PURE__ */s("div",{ref:R,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */s("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
- /* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:f.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(y||b&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${b} ${j?"":m}`}),
6
- /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
7
- /* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
8
- /* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(m)})]})]}),
9
- /* @__PURE__ */s("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
10
- /* @__PURE__ */u("button",{onClick:U,className:F,children:"AC"}),
11
- /* @__PURE__ */u("button",{onClick:B,className:F,children:"+/−"}),
12
- /* @__PURE__ */u("button",{onClick:P,className:F,children:"%"}),
13
- /* @__PURE__ */u("button",{onClick:()=>X("÷"),className:`${A} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
- /* @__PURE__ */u("button",{onClick:()=>S("7"),className:Q,children:"7"}),
15
- /* @__PURE__ */u("button",{onClick:()=>S("8"),className:Q,children:"8"}),
16
- /* @__PURE__ */u("button",{onClick:()=>S("9"),className:Q,children:"9"}),
17
- /* @__PURE__ */u("button",{onClick:()=>X("×"),className:`${A} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
18
- /* @__PURE__ */u("button",{onClick:()=>S("4"),className:Q,children:"4"}),
19
- /* @__PURE__ */u("button",{onClick:()=>S("5"),className:Q,children:"5"}),
20
- /* @__PURE__ */u("button",{onClick:()=>S("6"),className:Q,children:"6"}),
21
- /* @__PURE__ */u("button",{onClick:()=>X("-"),className:`${A} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
22
- /* @__PURE__ */u("button",{onClick:()=>S("1"),className:Q,children:"1"}),
23
- /* @__PURE__ */u("button",{onClick:()=>S("2"),className:Q,children:"2"}),
24
- /* @__PURE__ */u("button",{onClick:()=>S("3"),className:Q,children:"3"}),
25
- /* @__PURE__ */u("button",{onClick:()=>X("+"),className:`${A} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
26
- /* @__PURE__ */u("button",{onClick:()=>S("0"),className:`${Q} col-span-2`,children:"0"}),
27
- /* @__PURE__ */u("button",{onClick:()=>S("."),className:Q,children:"."}),
28
- /* @__PURE__ */u("button",{onClick:H,className:K,children:"="})]})]}),
29
- /* @__PURE__ */u(t,{open:W,onClose:()=>D(!1),title:"Calculator Settings",appearance:J,onAppearanceChange:M,onSave:()=>{T(J),localStorage.setItem(h,JSON.stringify(J)),D(!1)}})]})}export{m as default};
@@ -1,24 +0,0 @@
1
- import{getNumberingConfigs as e}from"./chunk-3LPG6HMG.js";import{SidebarLayout as t}from"./chunk-A4HJDSRA.js";import"./chunk-QWK6DRSN.js";import"./chunk-DRDYZ633.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-BAPQOY7Q.js";import{useWindowManager as o,client_default as i}from"./chunk-4X75SGTT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import{toast_default as c}from"./chunk-AKM6JBMD.js";import"./chunk-PXQG5EIH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import{useShellPrefs as s}from"./chunk-KC3EX26K.js";import"./chunk-P2HDCQBJ.js";import"./chunk-235E63CP.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import{Icon as l}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-34URULVW.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var y=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:v}=s(),{data:N}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=a({});p(()=>{if(!N)return;const e={};for(const t of N){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[N]);const T=j.notepad_notes||[],[_,D]=d(null),[C,S]=d(""),[W,X]=d(""),[$,M]=d("yellow"),[J,P]=d(!1),[R,U]=d(!1),H=a(null),Q=a();p(()=>{if(!_&&T.length>0){const e=T[0];D(e.id),S(e.title),X(e.content),M(e.color)}},[T.length]);const G=m(e=>{v({notepad_notes:e})},[v]),K=m(()=>{if(!_||!J)return;const e=T.map(e=>e.id===_?{...e,title:C,content:W,color:$,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);G(e),P(!1)},[_,J,C,W,$,T,G]);p(()=>{if(J)return Q.current&&clearTimeout(Q.current),Q.current=setTimeout(K,800),()=>{Q.current&&clearTimeout(Q.current)}},[J,K]),p(()=>()=>{J&&K()},[]);const B=e=>{J&&K(),D(e.id),S(e.title),X(e.content),M(e.color),P(!1),U(!1)},E=e=>{const t=W.slice(0,e),r=W.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=W.slice(e+r[0].length);X(t+n+o),P(!0)},Z=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):c.error(`${n} not found`)}catch{c.error(`Failed to look up ${n}`)}},A="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",I=/* @__PURE__ */h(g,{children:[
2
- /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{J&&K();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...T];G(t),D(e.id),S(""),X(""),M("yellow"),P(!1),U(!0),setTimeout(()=>H.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
- /* @__PURE__ */x(l,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
- /* @__PURE__ */x("div",{className:"flex-1 overflow-y-auto",children:0===T.length?/* @__PURE__ */x("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):T.map(e=>{const t=(n=e.color,y.find(e=>e.key===n)||y[0]);var n;/* @__PURE__ */
5
- return h("button",{onClick:()=>B(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
- /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
- /* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
- /* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
9
- /* @__PURE__ */x("p",{className:"text-xs text-ink-faintest mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
- /* @__PURE__ */x("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
- return h("div",{className:"h-full",children:[
12
- /* @__PURE__ */x(n,{app:"notepad"}),
13
- /* @__PURE__ */x(t,{sidebar:I,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
- /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */x("input",{value:C,onChange:e=>{S(e.target.value),P(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */x("div",{className:"flex gap-1",children:y.map(e=>/* @__PURE__ */x("button",{onClick:()=>{M(e.key),P(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${$===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(G(t),_===e){const e=t[0];e?B(e):(D(null),S(""),X(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(l,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),R?/* @__PURE__ */x("textarea",{ref:H,value:W,onChange:e=>{X(e.target.value),P(!0)},onBlur:()=>{U(!1),J&&K()},placeholder:A,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{U(!0),setTimeout(()=>H.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:W?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let s;for(;null!==(s=c.exec(e));){const e=s[1],t=s[2];if(w.current[e]){const n=s.index,o=s[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>Z(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(s=b.exec(e));){const e="x"===s[1]||"X"===s[1],t=s.index,n=a+t;i.push({idx:t,len:s[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>E(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(l,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
- return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(W):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:A})}),
19
- /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
- /* @__PURE__ */x("span",{children:"[] checkbox"}),
21
- /* @__PURE__ */x("span",{children:"SO#35001 entity link"}),
22
- /* @__PURE__ */x("span",{className:"ml-auto",children:R?"Editing":"Click to edit"})]})]}):/* @__PURE__ */x("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
- /* @__PURE__ */x(l,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
24
- /* @__PURE__ */x("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
@@ -1,91 +0,0 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-JDBMIY7R.js";import{subscribePomo as o,getPomoSnapshot as a,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as l,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as k}from"./chunk-GKIU55T5.js";import{PLACEHOLDER_INK as b}from"./chunk-AYZY3YNC.js";import{useWidgetSettings as x}from"./chunk-4X75SGTT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-URERZUX5.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-RBQWIHYD.js";import"./chunk-GBCH3UHD.js";import"./chunk-KZMJE24J.js";import"./chunk-QHOBK35Y.js";import"./chunk-3DVNXNTF.js";import"./chunk-S2P74CBN.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-AKM6JBMD.js";import"./chunk-PXQG5EIH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import{useShellPrefs as v}from"./chunk-KC3EX26K.js";import"./chunk-235E63CP.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-TXDA7TTP.js";import"./chunk-I4VIEGCX.js";import"./chunk-UQYNPYF4.js";import{Icon as y}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-34URULVW.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-MVZRZTQP.js";import"./chunk-6XBWM453.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-F27JJHNJ.js";import"./chunk-TWVUQUUD.js";import"./chunk-4PAWQEXM.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as N,useEffect as C,useMemo as S,useState as w,useRef as B,useCallback as j}from"react";import{jsxs as M,Fragment as T,jsx as P}from"react/jsx-runtime";var I="pomodoro_appearance",D="pomodoro_active_task_id",A={focus:"Pomodoro",short:"Short Break",long:"Long Break"},V={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var R=25,$=5,L=15,W=!1,E=!1,U=4,J=!0,H=!0,K="bell",G=100,X=1,Q="none",_=50,F=(e,t,o,a)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):a;function Z(){const t=N(o,a,a),{prefs:g,save:k}=v(),b=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:F(t.focusMinutes,1,120,R),shortBreakMinutes:F(t.shortBreakMinutes,1,120,$),longBreakMinutes:F(t.longBreakMinutes,1,120,L),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:W,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:E,longBreakInterval:F(t.longBreakInterval,1,20,U),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:J,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:H,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:K,alarmVolume:F(t.alarmVolume,0,100,G),alarmRepeat:F(t.alarmRepeat,1,5,X),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:Q,focusVolume:F(t.focusVolume,0,100,_)}}(g.pomodoro_settings);C(()=>{n({focus:60*b.focusMinutes,short:60*b.shortBreakMinutes,long:60*b.longBreakMinutes})},[b.focusMinutes,b.shortBreakMinutes,b.longBreakMinutes]),C(()=>{r(b.alarmSound),s(b.alarmVolume,b.alarmRepeat)},[b.alarmSound,b.alarmVolume,b.alarmRepeat]),C(()=>{l({autoStartBreaks:b.autoStartBreaks,autoStartPomodoros:b.autoStartPomodoros,longBreakInterval:b.longBreakInterval})},[b.autoStartBreaks,b.autoStartPomodoros,b.longBreakInterval]),C(()=>{i(b.focusSound,b.focusVolume)},[b.focusSound,b.focusVolume]),C(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const Z=c(),O=Z.tasks,z=S(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return S(()=>t?(e=>{const t=[],o=[];for(const a of e)(a.done?o:t).push(a);return[...t,...o]})(e):e,[e,t])}(S(()=>O.filter(e=>!!e.dueDate&&(e.dueDate===z||e.dueDate<z&&!e.done)),[O,z]),b.checkToBottom),[ee,te]=w(()=>localStorage.getItem(D)),[oe,ae]=w(!1),[ne,re]=w(null),se=B(!1);C(()=>{se.current||(se.current=!0,d(O,Z.setAllTasks))},[]),C(()=>{try{ee?localStorage.setItem(D,ee):localStorage.removeItem(D)}catch{}},[ee]),C(()=>{if(!ne)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ne]);const le=B(t.streak);C(()=>{if(t.streak>le.current&&ee){const e=O.find(e=>e.id===ee);if(e){const t=(e.completed??0)+1,o=e.estimated??0,a=b.autoCheckTasks&&o>0&&t>=o;Z.updateTask(ee,{completed:t,done:e.done||a})}}le.current=t.streak},[t.streak,ee,b.autoCheckTasks,O,Z]);const ce=q.reduce((e,t)=>e+(t.completed??0),0),de=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),ue=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),me=t.running&&"focus"===t.mode?t.remaining:0,he=ue*b.focusMinutes*60+me,pe=new Date(Date.now()+1e3*he).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ge=(he/3600).toFixed(1),fe=ee?O.find(e=>e.id===ee)??null:null,ke=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ve]=w(()=>e(I)),[ye,Ne]=w(!1),[Ce,Se]=w(xe),[we,Be]=w(b);x(j(()=>{Se({...xe}),Be({...b}),Ne(!0)},[xe,b]));const je="focus"!==t.mode,Me=V[t.mode],Te=je?(Pe=Me,Ie=xe.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${Ie})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var Pe,Ie;const De={primary:je?"text-white":"text-gray-900",secondary:je?"text-white/85":"text-gray-700",muted:je?"text-white/65":"text-gray-500",tabActive:je?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:je?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:je?"border-white/30":"border-gray-200",softDivider:je?"border-white/20":"border-gray-200",iconBtn:je?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:je?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Ae=je?Me:"#0f172a";/* @__PURE__ */
2
- return M(T,{children:[
3
- /* @__PURE__ */M("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${De.primary}`,style:{backgroundColor:Te,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */P("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */P("button",{onClick:()=>u(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?De.tabActive:De.tabInactive}`,children:A[e]},e))}),
5
- /* @__PURE__ */M("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[ke,":",be]}),
6
- /* @__PURE__ */P("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */P("button",{onClick:()=>t.running?m():h(),className:"bg-surface px-12 py-3 rounded-md font-bold text-base shadow-[0_4px_0_rgba(0,0,0,0.12)] hover:shadow-[0_3px_0_rgba(0,0,0,0.12)] active:translate-y-1 active:shadow-none transition-all",style:{color:Ae,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
7
- /* @__PURE__ */P("div",{className:"px-3 py-3 text-center",children:fe?/* @__PURE__ */M(T,{children:[
8
- /* @__PURE__ */M("div",{className:`text-xs leading-tight ${De.muted}`,children:["#",(fe.completed??0)+1]}),
9
- /* @__PURE__ */P("div",{className:`text-base font-medium leading-tight truncate mt-0.5 ${De.primary}`,children:fe.name})]}):/* @__PURE__ */P("div",{className:`text-xs italic ${De.muted}`,children:"No task selected"})}),
10
- /* @__PURE__ */M("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
- /* @__PURE__ */P("h3",{className:`text-base font-bold tracking-tight ${De.primary}`,children:"Tasks"}),
12
- /* @__PURE__ */P("button",{className:`rounded p-1 transition-colors ${De.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4"})})]}),
13
- /* @__PURE__ */P("div",{className:`border-t mx-3 mt-2 ${De.divider}`}),
14
- /* @__PURE__ */M("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[q.map(e=>{const t=e.id===ee;/* @__PURE__ */
15
- return M("div",{onClick:()=>te(e.id),className:"bg-surface text-ink-strong rounded-md flex items-center pr-2 py-3 shadow-sm cursor-pointer transition-shadow hover:shadow-(--elevation-panel) "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
16
- /* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,Z.toggleDone(o)},className:"shrink-0",children:e.done?/* @__PURE__ */P("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Ae},children:/* @__PURE__ */P("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */P("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */P("circle",{cx:"12",cy:"12",r:"10"})})}),
17
- /* @__PURE__ */P("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
18
- /* @__PURE__ */M("span",{className:"text-sm tabular-nums mr-2 shrink-0",children:[
19
- /* @__PURE__ */P("span",{className:"font-bold text-gray-500",children:e.completed??0}),
20
- /* @__PURE__ */P("span",{className:"text-gray-400",children:" / "}),
21
- /* @__PURE__ */P("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
- /* @__PURE__ */M("div",{className:"relative",children:[
23
- /* @__PURE__ */P("button",{onClick:t=>{t.stopPropagation(),re(ne===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-ink-faint"})}),ne===e.id&&/* @__PURE__ */P("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,Z.removeTask(o),ee===o&&te(null),re(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),oe?/* @__PURE__ */P(ie,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const a=Z.addTask({name:o,estimated:t,completed:0,dueDate:z});ee||te(a),ae(!1)},onCancel:()=>ae(!1),accentColor:Ae}):/* @__PURE__ */M("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${De.addTaskBtn}`,children:[
24
- /* @__PURE__ */P(y,{name:"add-circle",className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
- /* @__PURE__ */M("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${De.softDivider}`,children:[
26
- /* @__PURE__ */M("span",{className:De.secondary,children:["Pomos: ",
27
- /* @__PURE__ */P("span",{className:`font-bold ${De.primary}`,children:ce}),
28
- /* @__PURE__ */P("span",{className:De.muted,children:" / "}),
29
- /* @__PURE__ */P("span",{className:`font-bold ${De.primary}`,children:de})]}),he>0&&/* @__PURE__ */M("span",{className:De.secondary,children:["Finish At: ",
30
- /* @__PURE__ */P("span",{className:`font-bold ${De.primary}`,children:pe}),
31
- /* @__PURE__ */M("span",{className:De.muted,children:[" (",ge,"h)"]})]})]})]}),
32
- /* @__PURE__ */P(Y,{open:ye,onClose:()=>Ne(!1),onSave:()=>{ve(Ce),localStorage.setItem(I,JSON.stringify(Ce)),k({pomodoro_settings:we}),Ne(!1)},configAppearance:Ce,setConfigAppearance:Se,configPrefs:we,setConfigPrefs:Be})]})}function Y({open:e,onClose:o,onSave:a,configAppearance:n,setConfigAppearance:r,configPrefs:s,setConfigPrefs:l}){const i=(e,t)=>l(o=>({...o,[e]:t}));/* @__PURE__ */
33
- return M(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:a,children:[
34
- /* @__PURE__ */M(O,{icon:/* @__PURE__ */P(re,{}),label:"TIMER",children:[
35
- /* @__PURE__ */M("div",{children:[
36
- /* @__PURE__ */P("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
- /* @__PURE__ */M("div",{className:"grid grid-cols-3 gap-3",children:[
38
- /* @__PURE__ */P(ee,{label:"Pomodoro",value:s.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
39
- /* @__PURE__ */P(ee,{label:"Short Break",value:s.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
40
- /* @__PURE__ */P(ee,{label:"Long Break",value:s.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
41
- /* @__PURE__ */P(z,{label:"Auto Start Breaks",children:/* @__PURE__ */P(ae,{checked:s.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
42
- /* @__PURE__ */P(z,{label:"Auto Start Pomodoros",children:/* @__PURE__ */P(ae,{checked:s.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
43
- /* @__PURE__ */P(z,{label:"Long Break interval",children:/* @__PURE__ */P(te,{value:s.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
- /* @__PURE__ */M(O,{icon:/* @__PURE__ */P(se,{}),label:"TASK",children:[
45
- /* @__PURE__ */P(z,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */P(ae,{checked:s.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
46
- /* @__PURE__ */P(z,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */P(ae,{checked:s.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
47
- /* @__PURE__ */M(O,{icon:/* @__PURE__ */P(le,{}),label:"SOUND",children:[
48
- /* @__PURE__ */P(z,{label:"Alarm Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
49
- /* @__PURE__ */P(oe,{value:s.alarmSound,onChange:e=>i("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>g(s.alarmSound,{volume:s.alarmVolume,repeat:1}),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
50
- /* @__PURE__ */P(q,{value:s.alarmVolume,onChange:e=>i("alarmVolume",e)}),
51
- /* @__PURE__ */P(z,{label:"repeat",children:/* @__PURE__ */P(te,{value:s.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
- /* @__PURE__ */P(z,{label:"Focus Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
53
- /* @__PURE__ */P(oe,{value:s.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==s.focusSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>k(s.focusSound,s.focusVolume),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
54
- /* @__PURE__ */P(q,{value:s.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function O({icon:e,label:t,children:o}){/* @__PURE__ */
55
- return M("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
- /* @__PURE__ */M("div",{className:"flex items-center gap-2 mb-3 text-ink-faintest",children:[e,
57
- /* @__PURE__ */P("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
- /* @__PURE__ */P("div",{className:"space-y-3",children:o})]})}function z({label:e,info:t,children:o}){/* @__PURE__ */
59
- return M("div",{className:"flex items-center justify-between gap-3",children:[
60
- /* @__PURE__ */M("div",{className:"flex items-center gap-2 min-w-0",children:[
61
- /* @__PURE__ */P("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */P(ne,{title:t})]}),
62
- /* @__PURE__ */P("div",{className:"shrink-0",children:o})]})}function q({value:e,onChange:t}){/* @__PURE__ */
63
- return M("div",{className:"flex items-center justify-end gap-3",children:[
64
- /* @__PURE__ */P("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
65
- /* @__PURE__ */P("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function ee({label:e,value:t,onChange:o,min:a=1,max:n=99}){/* @__PURE__ */
66
- return M("label",{className:"flex flex-col",children:[
67
- /* @__PURE__ */P("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
68
- /* @__PURE__ */P(te,{value:t,onChange:o,min:a,max:n})]})}function te({value:e,onChange:t,min:o=1,max:a=99,className:n=""}){/* @__PURE__ */
69
- return P("input",{type:"number",min:o,max:a,value:e,onChange:e=>t(Math.max(o,Math.min(a,parseInt(e.target.value,10)||o))),className:`bg-gray-100 border-0 rounded-md px-2 h-8 text-sm font-medium text-ink-strong focus:outline-none focus:ring-2 focus:ring-blue-500 w-full ${n}`})}function oe({value:e,onChange:t,options:o}){/* @__PURE__ */
70
- return M("div",{className:"relative",children:[
71
- /* @__PURE__ */P("select",{value:e,onChange:e=>t(e.target.value),className:"appearance-none bg-gray-100 border-0 rounded-md pl-3 pr-8 h-8 text-sm font-medium text-ink-strong focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer",children:o.map(e=>/* @__PURE__ */P("option",{value:e.id,children:e.label},e.id))}),
72
- /* @__PURE__ */P(y,{name:"chevron-down",className:`absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 pointer-events-none ${b}`,strokeWidth:2.5})]})}function ae({checked:e,onChange:t}){/* @__PURE__ */
73
- return P("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(e?"bg-emerald-500":"bg-gray-300"),children:/* @__PURE__ */P("span",{className:"absolute h-5 w-5 rounded-full bg-white shadow transition-transform "+(e?"translate-x-[22px]":"translate-x-0.5")})})}function ne({title:e}){/* @__PURE__ */
74
- return P("span",{title:e,className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-on-accent text-3xs font-bold cursor-help",children:"i"})}function re(){/* @__PURE__ */
75
- return M("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
76
- /* @__PURE__ */P("circle",{cx:"12",cy:"12",r:"9"}),
77
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]})}function se(){/* @__PURE__ */
78
- return M("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
79
- /* @__PURE__ */P("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),
80
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function le(){/* @__PURE__ */
81
- return M("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
82
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
83
- /* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function ie({onSubmit:e,onCancel:t,accentColor:o}){const[a,n]=w(""),[r,s]=w(1),l=()=>e(a,r);/* @__PURE__ */
84
- return M("div",{className:"bg-surface text-ink-strong rounded-md p-3 shadow-(--elevation-panel)",children:[
85
- /* @__PURE__ */P("input",{autoFocus:!0,value:a,onChange:e=>n(e.target.value),placeholder:"What are you working on?",onKeyDown:e=>{"Enter"===e.key&&l(),"Escape"===e.key&&t()},className:"w-full text-base font-medium bg-transparent border-0 outline-none placeholder-gray-400"}),
86
- /* @__PURE__ */M("div",{className:"flex items-center justify-between mt-2",children:[
87
- /* @__PURE__ */P("span",{className:"text-xs font-semibold text-gray-500",children:"Est Pomodoros"}),
88
- /* @__PURE__ */P("input",{type:"number",min:1,max:20,value:r,onChange:e=>s(Math.max(1,Math.min(20,parseInt(e.target.value,10)||1))),className:"w-16 bg-gray-100 rounded px-2 py-1 text-sm text-right border-0 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),
89
- /* @__PURE__ */M("div",{className:"flex gap-2 mt-3 justify-end",children:[
90
- /* @__PURE__ */P("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
91
- /* @__PURE__ */P("button",{onClick:l,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:o},children:"Save"})]})]})}export{Z as default};
@@ -1,2 +0,0 @@
1
- import{inputClasses as e}from"./chunk-AYZY3YNC.js";import{useShellLocale as t}from"./chunk-4PAWQEXM.js";import{forwardRef as n}from"react";import{jsx as r}from"react/jsx-runtime";var a=/^\d{2}:\d{2}(:\d{2})?$/,i=e=>String(e).padStart(2,"0");function s(e,t){if(null==e||""===e)return"";if(e instanceof Date){if(Number.isNaN(e.getTime()))return"";const n=`${i(e.getHours())}:${i(e.getMinutes())}`;return t?`${n}:${i(e.getSeconds())}`:n}return a.test(e)?e:""}var u=n(function({value:n,onChange:i,min:u,max:o,invalid:m,size:l,className:c="",step:v,...d},f){const g=null!=v&&Number(v)<60,p=t();/* @__PURE__ */
2
- return r("input",{ref:f,type:"time",lang:p,step:v,"aria-invalid":m||void 0,value:s(n,g),min:s(u,g)||void 0,max:s(o,g)||void 0,onChange:e=>i?.(a.test(e.target.value)?e.target.value:null),className:e({invalid:m,size:l,className:c}),...d})});export{u as TimePicker_default};
@@ -1,29 +0,0 @@
1
- import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-KP2THXEI.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{EmptyState as i}from"./chunk-63L5ORRZ.js";import{ImageLightbox as r}from"./chunk-L3QNKCXH.js";import{DescriptionList as t}from"./chunk-SACUSHVN.js";import{Drawer as o}from"./chunk-3BYLHJLC.js";import{Breadcrumbs as d}from"./chunk-O4V5PEA3.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-7YOQS3C6.js";import{useMediaMoveItems as u}from"./chunk-ZURB2DCM.js";import{copyToClipboard as m}from"./chunk-MQU3PZUS.js";import{DropdownMenu as p}from"./chunk-456CJCDK.js";import{MediaUploadGrid as h}from"./chunk-2VTO64YC.js";import{MediaUsedInList as f}from"./chunk-PBWUEBJ5.js";import{NativeSelect as g}from"./chunk-UWK5Q3R4.js";import{Segmented as v}from"./chunk-3ELLBQPS.js";import{useGridSelection as k}from"./chunk-VLKDWKVR.js";import{useMarquee as y}from"./chunk-OLFYNMTD.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as C}from"./chunk-TEIJOFHO.js";import{Banner as x}from"./chunk-GSKLHUQ6.js";import{Input_default as N}from"./chunk-MAMWQCJ6.js";import{IconButton_default as I}from"./chunk-PUF75SMJ.js";import{useFileIntake as D,FileIntakeAlert as S}from"./chunk-6RX4PVBU.js";import{ColoredBadge as j}from"./chunk-PXQG5EIH.js";import{Button_default as z}from"./chunk-I4VIEGCX.js";import{buttonClasses as T}from"./chunk-UQYNPYF4.js";import{Icon as F}from"./chunk-KKSVRIMP.js";import{Tooltip as O}from"./chunk-6XBWM453.js";import{usePlotWidth as P}from"./chunk-MAFUXCPZ.js";import{useShellStrings as L}from"./chunk-4PAWQEXM.js";import{useRef as E,useMemo as M,useCallback as A,useState as U,useEffect as R}from"react";import{jsxs as K,Fragment as B,jsx as Q}from"react/jsx-runtime";var H="application/x-efficient-media-files",J="application/x-efficient-media-folder",V="application/x-efficient-media-file";function W(e){if(!e||!Array.from(e.types).includes(V))return null;try{const n=JSON.parse(e.getData(V));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var X={type:"all",use:"any",sort:"newest"},G={lock:/* @__PURE__ */Q(F,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */Q(F,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */Q(F,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */Q(F,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */Q(F,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */Q(F,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */Q(F,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */Q(F,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */Q(F,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */Q(F,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */Q(F,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */Q(F,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */Q(F,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */Q(F,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */Q(F,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */Q(F,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},$={link:/* @__PURE__ */Q(F,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */Q(F,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */Q(F,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */Q(F,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function Y({value:e,label:n,onDone:l}){const[a,i]=U(e),r=E(!1),t=e=>{r.current||(r.current=!0,l(e))};/* @__PURE__ */
2
- return Q(N,{size:"sm",autoFocus:!0,"aria-label":n,value:a,onChange:e=>i(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:n=>{n.stopPropagation(),"Enter"===n.key?(n.preventDefault(),t(a.trim()||e)):"Escape"===n.key&&(n.preventDefault(),t(null))},onBlur:()=>t(a.trim()||e),onClick:e=>e.stopPropagation()})}function Z(F){const{mode:W="manage",layout:Z="auto",location:q,onLocationChange:_,folders:ee,products:ne,allFilesCount:le,trashCount:ae,files:ie,query:re,onQueryChange:te,filters:oe=X,onFiltersChange:de,extraFilters:se,view:ce="grid",onViewChange:ue,selectedIds:me,onSelectionChange:pe,usedIn:he,denied:fe={},accept:ge="image/*,video/*",maxSizeBytes:ve,busy:ke,progress:ye,onUpload:be,onNewFolder:we,onRename:Ce,onMove:xe,onTrash:Ne,onDeleteFolder:Ie,onRestore:De,onDeleteForever:Se,onEmptyTrash:je,onReplace:ze,onCropEdit:Te,onOpenInDesign:Fe,onChoose:Oe,onCancel:Pe,pickNote:Le,onDragOut:Ee,className:Me=""}=F,Ae=L().mediaLibrary,Ue=L().media,Re="pick"===W,Ke=!Re,Be=E(null),Qe=P(Be,"phone"===Z?343:1200),He="phone"===Z||"auto"===Z&&Qe<640,Je=M(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,a)=>{for(const i of e){const e=[...a,i];n.set(i.id,{node:i,path:e}),i.children&&l(i.children,e)}};return l(e,[]),n}(ne),[ne]),Ve=M(()=>new Map(ee.map(e=>[e.id,e])),[ee]),We=M(()=>{const e=/* @__PURE__ */new Map;for(const n of ee){const l=n.parentId&&Ve.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[ee,Ve]),Xe=A(e=>{const n=[];for(let l=e?Ve.get(e):void 0;l&&(n.unshift(l),!(n.length>ee.length));l=l.parentId?Ve.get(l.parentId):void 0);return n},[Ve,ee.length]),Ge=A((e,n)=>Xe(e).some(e=>e.id===n),[Xe]),[$e,Ye]=U(()=>/* @__PURE__ */new Set(["@files"])),Ze=e=>Ye(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),qe=A(e=>{Ye(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),_e="files"===(en=q).place?`files:${en.folderId??""}`:"products"===en.place?`products:${en.nodeId??""}`:"trash";var en;R(()=>{if("files"===q.place)qe(["@files",...Xe(q.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===q.place){const e=q.nodeId?Je.get(q.nodeId)?.path??[]:[];qe(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[_e]);const nn="products"===q.place,ln="trash"===q.place,an="files"===q.place,rn=an?q.folderId:null,tn=nn&&q.nodeId?Je.get(q.nodeId)?.path[0]:void 0,on=e=>e?.sharedFrom?`${Ae.readOnly} ${Ae.editedAtHq(e.sharedFrom)}`:Ae.readOnly,dn=M(()=>ie.map(e=>e.id),[ie]),sn=M(()=>new Map(ie.map(e=>[e.id,e])),[ie]),cn=k(dn),un=M(()=>dn.filter(e=>cn.selected.has(e)),[dn,cn.selected]),mn=1===un.length?sn.get(un[0]):void 0,pn=E(!0);R(()=>{pn.current?pn.current=!1:cn.clear()},[_e]);const hn=me?.join("\0");R(()=>{me&&cn.setSelection(me)},[hn]);const fn=E(hn??""),gn=un.join("\0");R(()=>{fn.current!==gn&&(fn.current=gn,pe?.(un))},[gn]);const vn=(e,n={})=>{Re?cn.select(e):cn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[kn,yn]=U(null),bn=e=>{const n=kn;if(yn(null),!n||null==e)return;e!==("folder"===n.kind?Ve.get(n.id)?.name:sn.get(n.id)?.name)&&Ce?.(n,e)},wn=async e=>{if(!we)return;const n=await we(e);qe(["@files",...e?[e]:[]]),"string"==typeof n&&yn({kind:"folder",id:n})},Cn=A(e=>{const n=[],l=n=>{if("files"===e.kind)return n===rn&&an?Ae.alreadyHere:void 0;const l=Ve.get(e.id);return n===e.id||n&&Ge(n,e.id)?Ae.notIntoItself:(l?.parentId??null)===n?Ae.folderAlreadyHere:void 0};n.push({key:s,label:Ae.allFiles,disabledReason:l(null)});const a=(e,i)=>{for(const r of We.get(e)??[])n.push({key:r.id,label:r.name,depth:i,disabledReason:l(r.id)}),a(r.id,i+1)};return a(null,1),n},[We,Ve,an,Ge,rn,Ae]),xn=A(e=>{const n=new Set(e.map(e=>sn.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[sn]),[Nn,In]=U(null),Dn={words:Ae,media:Ue,denied:fe,moveTargets:Cn,kindOf:xn,urlOf:e=>sn.get(e)?.url,newSubfolder:we&&Ke?e=>{wn(e)}:void 0,rename:Ce&&Ke?e=>{"file"!==e.kind||cn.isSelected(e.id)||cn.select(e.id),yn(e)}:void 0,move:xe&&Ke?xe:void 0,trash:Ne&&Ke?Ne:void 0,deleteFolder:Ie&&Ke?Ie:void 0,folderNotEmpty:e=>!!Ve.get(e)?.notEmpty,replace:ze&&Ke?ze:void 0,copyUrl:e=>{const n=sn.get(e)?.url;n&&m(Ae.urlLabel,n)},openInDesign:Fe,restore:De,deleteForever:Se},Sn=e=>c(e,Dn),jn=w(),zn=(e,n)=>{Re||(cn.isSelected(e)||cn.select(e),jn.open(n,(e=>{const n=cn.isSelected(e)?un:[e];return nn?{kind:"render",id:e}:ln?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[Tn,Fn]=U(null),[On,Pn]=U(null),[Ln,En]=U(null);R(()=>{if(!On&&!Tn)return;const e=()=>{Pn(null),Fn(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[On,Tn]);const Mn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),An=(e,n)=>!(!xe||fe.move||Re)&&(!!Mn(e,H)||!(!Mn(e,J)||!Ln)&&(n!==Ln&&!(n&&Ge(n,Ln)))),Un=(e,n)=>({onDragEnter:l=>{An(l,n)&&(l.preventDefault(),Fn(e))},onDragOver:l=>{An(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",Tn!==e&&Fn(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Fn(n=>n===e?null:n)},onDrop:e=>{if(An(e,n))if(e.preventDefault(),Fn(null),Mn(e,H)){let l;try{l=JSON.parse(e.dataTransfer.getData(H))}catch{l=null}Array.isArray(l)&&l.length&&xe({kind:"files",ids:l.map(String)},n)}else Ln&&(xe({kind:"folder",id:Ln},n),En(null))}}),Rn=e=>{const n=e=>Mn(e,H)||Mn(e,J)||Mn(e,"Files");return{onDragEnter:l=>{n(l)&&Pn(e)},onDragOver:l=>{n(l)&&On!==e&&Pn(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Pn(n=>n===e?null:n)}}},Kn=(e,n,l)=>/* @__PURE__ */Q(O,{side:"right",content:On===e?Ae.noDropProducts:on(l),open:On===e||!On&&void 0,children:/* @__PURE__ */Q("span",{children:n})}),Bn=e=>({onContextMenu:n=>{jn.open(n,e)}}),Qn=(e,a,i)=>e.map(e=>{const r=`p:${e.id}`,t=i??e,o=$e.has(r),d=e.children?.length?e.children:null;/* @__PURE__ */
3
- return K("div",{role:"none",className:"contents",children:[
4
- /* @__PURE__ */Q(n,{label:Kn(r,e.name,t),level:a,icon:d&&o?G.folderOpen:G.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ae.fileCount(e.count):void 0,selected:nn&&q.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>Ze(r):void 0,onSelect:()=>_({place:"products",nodeId:e.id}),rowProps:{"data-media-row":r,...Rn(r),...Ke?Bn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */Q(l,{children:Qn(d,a+1,t)})]},e.id)}),Hn=(e,a)=>(We.get(e)??[]).map(e=>{const i=We.get(e.id),r=$e.has(e.id),t="folder"===kn?.kind&&kn.id===e.id,o=Sn({kind:"folder",id:e.id});/* @__PURE__ */
5
- return K("div",{role:"none",className:"contents",children:[
6
- /* @__PURE__ */Q(n,{label:e.name,level:a,icon:i&&r?G.folderOpen:G.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ae.fileCount(e.count):void 0,selected:t||an&&q.folderId===e.id,expanded:i?r:void 0,onToggle:i?()=>Ze(e.id):void 0,onSelect:()=>_({place:"files",folderId:e.id}),drop:Tn===e.id?"into":void 0,dragging:Ln===e.id,draggable:Ke&&!!xe&&!fe.move,rename:t?/* @__PURE__ */Q(Y,{value:e.name,label:Ae.folderName,onDone:bn}):void 0,actions:Ke&&o.length?/* @__PURE__ */Q(p,{align:"end","aria-label":Ae.folderActions,trigger:G.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Un(e.id,e.id),...Ke?Bn({kind:"folder",id:e.id}):{},...Ke&&xe&&!fe.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(J,e.id),En(e.id)},onDragEnd:()=>{En(null),Fn(null)}}:{}}}),i&&r&&/* @__PURE__ */Q(l,{children:Hn(e.id,a+1)})]},e.id)}),Jn=$e.has("@files"),Vn=$e.has("@products"),Wn=/* @__PURE__ */K(e,{"aria-label":Ae.folders,children:[ne&&/* @__PURE__ */K(B,{children:[
7
- /* @__PURE__ */Q(n,{label:Kn("@products",Ae.products),level:1,icon:G.lock,badge:{label:Ae.readOnlyBadge,tone:"neutral"},expanded:ne.length?Vn:void 0,onToggle:()=>Ze("@products"),selected:nn&&null==q.nodeId,onSelect:()=>_({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Rn("@products")}}),Vn&&ne.length>0&&/* @__PURE__ */Q(l,{children:Qn(ne,2)})]}),
8
- /* @__PURE__ */Q(n,{label:Ae.allFiles,level:1,icon:Jn?G.folderOpen:G.folder,count:le,countLabel:null!=le?Ae.fileCount(le):void 0,expanded:We.get(null)?.length?Jn:void 0,onToggle:()=>Ze("@files"),selected:an&&null==q.folderId,onSelect:()=>_({place:"files",folderId:null}),drop:"@files"===Tn?"into":void 0,rowProps:{"data-media-row":"@files",...Un("@files",null)}}),Jn&&(We.get(null)?.length??0)>0&&/* @__PURE__ */Q(l,{children:Hn(null,2)}),Ke&&/* @__PURE__ */Q(n,{label:Ae.trash,level:1,icon:G.trash,count:ae,countLabel:null!=ae?Ae.fileCount(ae):void 0,selected:ln,onSelect:()=>_({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Xn=(()=>{if(ln)return[{label:Ae.trash}];if(nn){const e=q.nodeId?Je.get(q.nodeId)?.path??[]:[];return[{label:Ae.products,onClick:e.length?()=>_({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>_({place:"products",nodeId:n.id}):void 0}))]}const e=Xe(rn);return[{label:Ae.allFiles,onClick:e.length?()=>_({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>_({place:"files",folderId:n.id}):void 0}))]})(),Gn=nn?Ae.readOnly:fe.upload,$n=!!be&&!ln&&!Gn,Yn=D({accept:ge,maxSizeBytes:ve,multiple:!0,disabled:!$n,onAccept:e=>be?.(e,rn)}),Zn=nn?Ae.noProductFolder:fe.newFolder,qn=e=>e?{"aria-disabled":!0,disabledReason:e}:{},_n=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[Ke&&we&&!ln&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.folderPlus,onClick:()=>{wn(rn)},...qn(Zn),children:Ae.newFolder}),be&&!ln&&/* @__PURE__ */Q(z,{variant:"primary",size:"sm",leftIcon:G.upload,onClick:()=>Yn.open(),...qn(Gn),children:Ae.upload}),Ke&&ln&&je&&ie.length>0&&/* @__PURE__ */Q(z,{variant:"danger",size:"sm",onClick:je,...qn(fe.deleteForever),children:Ae.emptyTrash})]}),el=(e,n,l,a,i)=>/* @__PURE__ */Q("div",{style:{width:He?void 0:i,flex:He?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */Q(g,{size:"sm","aria-label":e,value:n,onChange:a,options:l})},e),nl=e=>n=>de?.({...oe,[e]:n}),ll=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[te&&/* @__PURE__ */Q("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */Q(N,{size:"sm",type:"search",leftIcon:G.search,placeholder:nn?Ae.searchProducts:Ae.search,"aria-label":nn?Ae.searchProducts:Ae.search,value:re??"",onChange:e=>te(e.target.value)})}),de&&el(Ae.mediaType,oe.type,[{value:"all",label:Ae.allTypes},{value:"image",label:Ae.images},{value:"video",label:Ae.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],nl("type"),130),de&&!nn&&!ln&&el(Ae.use,oe.use,[{value:"any",label:Ae.anyUse},{value:"email",label:Ae.emailOnly},{value:"website",label:Ae.websiteOnly},{value:"unused",label:Ae.notUsed}],nl("use"),130),de&&Ke&&el(Ae.sort,oe.sort,[{value:"newest",label:Ae.newest},{value:"name",label:Ae.byName},{value:"size",label:Ae.bySize}],nl("sort"),110),se?.map(e=>el(e.label,e.value,e.options,e.onChange,120)),ue&&/* @__PURE__ */Q(v,{size:"sm",label:Ae.view,value:ce,onChange:ue,options:[{value:"grid",label:Ae.grid,icon:G.grid},{value:"list",label:Ae.list,icon:G.list}]})]}),al=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ae.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:$.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ae.used(e.usedCount),count:e.usedCount,icon:$.link,tone:"active"}),e.email&&n.push({key:"e",label:Ae.email,icon:$.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ae.private,icon:$.lock,tone:"neutral"}),n},il=e=>al(e).map(e=>/* @__PURE__ */Q(j,{tone:e.tone,size:"xs",children:e.label},e.key)),rl=Ke&&an&&!!xe&&!fe.move,tl=!!Ee&&!ln,ol=e=>!tl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),dl=ie.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:al(e),dragData:rl?JSON.stringify(cn.isSelected(e.id)?un:[e.id]):ol(e),...rl&&ol(e)?{dragAlso:{[V]:ol(e)}}:{}})),sl=He?Math.max(72,Math.floor((Qe-24-16-1)/3)):112,cl=E(null),ul=y({containerRef:cl,enabled:Ke&&!He&&ie.length>0,selected:cn.selected,setSelection:e=>cn.setSelection(e),clearSelection:cn.clear}),ml=e=>{if(Re){const n=sn.get(e);return void(!n||n.private||n.pickDisabledReason||Oe?.(n))}const n=dn.indexOf(e);n>=0&&In(n)},pl=ie.length?null:re?/* @__PURE__ */Q(i,{variant:"dashed",title:Ae.noMatches}):nn?/* @__PURE__ */Q(i,{variant:"dashed",title:Ae.emptyProducts,description:on(tn)}):ln?/* @__PURE__ */Q(i,{variant:"dashed",title:Ae.trashEmpty}):!$n||Re?/* @__PURE__ */Q(i,{variant:"dashed",title:Ae.emptyFolder}):null,hl="list"===ce&&ie.length>0,fl=pl??(hl?/* @__PURE__ */Q("ul",{role:"listbox","aria-multiselectable":Ke||void 0,"aria-label":Ae.folders,className:"flex flex-col gap-1",children:ie.map(e=>/* @__PURE__ */K("li",{role:"option","aria-selected":cn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>vn(e.id,n),onDoubleClick:()=>ml(e.id),onContextMenu:n=>zn(e.id,n),draggable:!!ol(e)||void 0,onDragStart:ol(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(V,ol(e)),Ee("start")}:void 0,onDragEnd:ol(e)?e=>Ee("none"===e.dataTransfer.dropEffect?"cancelled":"dropped"):void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),vn(e.id,n))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(cn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
9
- /* @__PURE__ */Q("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
10
- /* @__PURE__ */Q("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
11
- /* @__PURE__ */Q("span",{className:"flex shrink-0 items-center gap-1",children:il(e)}),e.sizeLabel&&/* @__PURE__ */Q("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */Q(h,{items:dl,readOnly:!$n||Re,onFiles:$n&&!Re?e=>be(e,rn):void 0,accept:ge,maxSizeBytes:ve,busy:ke,progress:ye,fit:"contain",thumbSize:sl,dragType:rl?H:tl?V:void 0,onDragOutChange:tl?e=>Ee(e):void 0,selected:cn.selected,onItemClick:vn,onItemDoubleClick:ml,onItemContextMenu:Ke?zn:void 0,menuOnMedia:Ke})),gl=u({count:un.length,kind:xn(un),targets:Cn({kind:"files",ids:un}),onPick:e=>xe?.({kind:"files",ids:un},e.key===s?null:e.key)}),vl=T({variant:"secondary",size:"sm"}),kl=/* @__PURE__ */Q(p,{align:"start",triggerClassName:vl,trigger:/* @__PURE__ */K(B,{children:[G.folder,Ae.moveTo]}),items:gl,disabled:!!fe.move}),yl=Ke&&un.length>1&&!nn?/* @__PURE__ */K("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
12
- /* @__PURE__ */Q(b,{checked:un.length===ie.length,indeterminate:un.length<ie.length,onChange:e=>e?cn.selectAll():cn.clear(),label:Ae.selected(un.length)}),/* @__PURE__ */K(B,ln?{children:[De&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.undo,onClick:()=>De(un),...qn(fe.restore),children:Ae.restore}),Se&&/* @__PURE__ */Q(z,{variant:"secondary-danger",size:"sm",onClick:()=>Se(un),...qn(fe.deleteForever),children:Ae.deleteForever})]}:{children:[xe&&kl,Ce&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.edit,disabled:!0,children:Ae.rename}),Ne&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.trash,onClick:()=>Ne({kind:"files",ids:un}),...qn(fe.trash),children:Ae.moveFilesToTrash(un.length)})]}),
13
- /* @__PURE__ */Q(z,{variant:"ghost",size:"sm",onClick:cn.clear,children:Ae.clearSelection})]}):null,bl=e=>{const n=[],l=(e,l,a)=>{null!=a&&""!==a&&n.push({key:e,label:l,value:a})},a="file"===kn?.kind&&kn.id===e.id;l("name",Ae.name,a?/* @__PURE__ */Q(Y,{value:e.name,label:Ae.fileName,onDone:bn}):e.name),l("type",Ae.type,e.typeLabel),l("size",Ae.size,e.sizeLabel),l("resolution",Ae.resolution,e.resolution),nn?(l("design",Ae.design,e.design),l("finish",Ae.finish,e.finish),l("angle",Ae.angleLug,e.angleLug),l("owner",Ae.owner,e.owner)):(l("added",Ae.addedBy,e.addedBy),l("folder",Ae.folder,e.folderPath)),l("used",Ae.usedIn,null!=e.usedCount?Ae.places(e.usedCount):void 0);const i=c({kind:"files",ids:[e.id]},Dn).find(e=>"submenu"===e.type);/* @__PURE__ */
14
- return K("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
15
- /* @__PURE__ */Q("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),nn&&/* @__PURE__ */Q(x,{tone:"neutral",title:Ae.readOnlyBadge,children:on(tn)}),
16
- /* @__PURE__ */Q(t,{size:"sm",columns:1,items:n}),!ln&&/* @__PURE__ */K("div",{className:"flex gap-2",children:[
17
- /* @__PURE__ */Q("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */Q(N,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ae.fileUrl,onFocus:e=>e.currentTarget.select()})}),
18
- /* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.copy,onClick:()=>Dn.copyUrl(e.id),children:Ae.copyUrl})]}),an&&Ke&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[ze&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.swap,onClick:()=>ze(e.id),...qn(fe.replace),children:Ae.replace}),Te&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.crop,onClick:()=>Te(e.id),children:Ae.cropEdit}),xe&&"submenu"===i?.type&&/* @__PURE__ */Q(p,{align:"start",triggerClassName:vl,trigger:/* @__PURE__ */K(B,{children:[G.folder,Ae.moveTo]}),items:i.items,disabled:!!fe.move}),Ce&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.edit,onClick:()=>yn({kind:"file",id:e.id}),...qn(fe.rename),children:Ae.rename}),Ne&&/* @__PURE__ */Q(I,{"aria-label":Ae.moveToTrash,size:"sm",onClick:()=>Ne({kind:"files",ids:[e.id]}),disabledReason:fe.trash,"aria-disabled":!!fe.trash||void 0,children:G.trash})]}),ln&&Ke&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[De&&/* @__PURE__ */Q(z,{variant:"primary",size:"sm",leftIcon:G.undo,onClick:()=>De([e.id]),...qn(fe.restore),children:Ae.restore}),Se&&/* @__PURE__ */Q(z,{variant:"danger",size:"sm",onClick:()=>Se([e.id]),...qn(fe.deleteForever),children:Ae.deleteForever})]}),nn&&Fe&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",leftIcon:G.external,onClick:()=>Fe({kind:"render",id:e.id}),children:Ae.openInDesign}),he&&/* @__PURE__ */Q(f,{items:he})]})},wl=mn?mn.private?Ae.privateNoPick:mn.pickDisabledReason:void 0,Cl=Re?/* @__PURE__ */K("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
19
- /* @__PURE__ */Q("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:mn?Ae.oneChosen(mn.name):Ae.noneChosen}),
20
- /* @__PURE__ */K("div",{className:"flex gap-2",children:[Pe&&/* @__PURE__ */Q(z,{variant:"secondary",size:"sm",onClick:Pe,children:Ae.cancel}),
21
- /* @__PURE__ */Q(z,{variant:"primary",size:"sm",disabled:!mn,...qn(wl),onClick:()=>{mn&&!wl&&Oe?.(mn)},children:Ae.chooseImage})]})]}):null,xl=Ke&&!!mn,Nl=/* @__PURE__ */K("div",{className:"flex min-w-0 flex-col gap-3",children:[Le&&/* @__PURE__ */Q(x,{tone:"neutral",children:Le}),
22
- /* @__PURE__ */K("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
23
- /* @__PURE__ */Q(d,{items:Xn}),_n]}),ll,yl,
24
- /* @__PURE__ */K("div",{ref:cl,className:"relative",onPointerDown:ul.onPointerDown,onKeyDown:e=>{Ke&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),cn.selectAll()):"Escape"===e.key&&cn.size&&cn.clear()},children:[fl,
25
- /* @__PURE__ */Q(a,{rect:ul.rect})]}),$n&&/* @__PURE__ */Q("input",{...Yn.inputProps}),
26
- /* @__PURE__ */Q(S,{rejections:Yn.rejections})]});/* @__PURE__ */
27
- return K("div",{ref:Be,"data-media-library":"","data-layout":He?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Me}`.trim(),children:[/* @__PURE__ */K("div",He?{className:"flex flex-col gap-3 p-3",children:[Wn,Nl]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
28
- /* @__PURE__ */Q("div",{className:"shrink-0 overflow-y-auto border-r border-line p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Wn}),
29
- /* @__PURE__ */Q("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:Nl}),xl&&/* @__PURE__ */Q("div",{className:"shrink-0 overflow-y-auto border-l border-line p-3",style:{width:300},children:bl(mn)})]}),Cl,He&&/* @__PURE__ */Q(o,{open:xl,onClose:cn.clear,side:"bottom",title:mn?.name,children:mn&&bl(mn)}),jn.state&&/* @__PURE__ */Q(C,{...jn.props,items:Sn(jn.state.data)}),null!=Nn&&ie.length>0&&/* @__PURE__ */Q(r,{images:ie.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(Nn,ie.length-1),onClose:()=>In(null)})]})}export{H as MEDIA_FILES_DRAG_TYPE,V as MEDIA_FILE_DRAG_TYPE,J as MEDIA_FOLDER_DRAG_TYPE,Z as MediaLibrary,W as readMediaFileDrag};
@@ -1 +0,0 @@
1
- import{EMPTY_VALUE as e}from"./chunk-36BRD5J3.js";var t=[{key:"DD/MM/YYYY",example:"24/04/2026"},{key:"MM/DD/YYYY",example:"04/24/2026"},{key:"YYYY-MM-DD",example:"2026-04-24"},{key:"DD-MM-YYYY",example:"24-04-2026"},{key:"MM-DD-YYYY",example:"04-24-2026"},{key:"DD.MM.YYYY",example:"24.04.2026"},{key:"YYYY.MM.DD",example:"2026.04.24"},{key:"YYYY/MM/DD",example:"2026/04/24"},{key:"DD/MM/YY",example:"24/04/26"},{key:"MM/DD/YY",example:"04/24/26"},{key:"DD/MMM/YYYY",example:"24/Apr/2026"},{key:"DD/MMM/YY",example:"24/Apr/26"},{key:"DD MMM YYYY",example:"24 Apr 2026"},{key:"MMM DD, YYYY",example:"Apr 24, 2026"},{key:"DD MMMM YYYY",example:"24 April 2026"},{key:"MMMM DD, YYYY",example:"April 24, 2026"}],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],n=["January","February","March","April","May","June","July","August","September","October","November","December"];function a(e){return r[parseInt(e,10)-1]??e}function o(e){return n[parseInt(e,10)-1]??e}function Y(){if("undefined"==typeof window)return"DD/MM/YYYY";try{return localStorage.getItem("user_date_format")||"DD/MM/YYYY"}catch{return"DD/MM/YYYY"}}function u(e){localStorage.setItem("user_date_format",e)}var m="user_timezone",c="auto";function M(){if("undefined"!=typeof window)try{const e=localStorage.getItem(m);return e&&e!==c?e:void 0}catch{return}}function i(e){e&&e!==c?localStorage.setItem(m,e):localStorage.removeItem(m)}function D(e){e&&localStorage.setItem(m,e)}var l={dateStyle:"medium"},s=/* @__PURE__ */new Map;function y(e,t){const r=`${e}|${JSON.stringify(t)}`;let n=s.get(r);return n||(n=new Intl.DateTimeFormat(e,{...t,timeZone:"UTC",calendar:"gregory"}),s.set(r,n)),n}var $=/* @__PURE__ */new Map;function f(e,t){const r=function(e){const t=e??"";let r=$.get(t);if(!r){const n={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23",calendar:"gregory"};try{r=new Intl.DateTimeFormat("en-GB",{...n,timeZone:e})}catch{r=new Intl.DateTimeFormat("en-GB",n)}$.set(t,r)}return r}(t).formatToParts(e),n=e=>r.find(t=>t.type===e)?.value??"";return{y:n("year"),m:n("month"),d:n("day"),hh:n("hour"),mm:n("minute")}}var d=/^(\d{4})-(\d{1,2})-(\d{1,2})$/;function p(t,r){const n=function(e,t){if(!e)return null;const r=d.exec(e);if(r){const[e,t,n]=r.slice(1).map(Number);return t<1||t>12||n<1||n>31?null:{y:String(e),m:String(t).padStart(2,"0"),d:String(n).padStart(2,"0")}}const n=new Date(e);return Number.isNaN(n.getTime())?null:f(n,t)}(t,r?.timeZone||M());return n?r?.locale?y(r.locale,r.style??l).format(new Date(Date.UTC(Number(n.y),Number(n.m)-1,Number(n.d)))):function(e,t,r){switch(Y()){case"MM/DD/YYYY":return`${t}/${r}/${e}`;case"YYYY-MM-DD":return`${e}-${t}-${r}`;case"DD-MM-YYYY":return`${r}-${t}-${e}`;case"MM-DD-YYYY":return`${t}-${r}-${e}`;case"DD.MM.YYYY":return`${r}.${t}.${e}`;case"YYYY.MM.DD":return`${e}.${t}.${r}`;case"YYYY/MM/DD":return`${e}/${t}/${r}`;case"DD/MM/YY":return`${r}/${t}/${e.slice(-2)}`;case"MM/DD/YY":return`${t}/${r}/${e.slice(-2)}`;case"DD/MMM/YYYY":return`${r}/${a(t)}/${e}`;case"DD/MMM/YY":return`${r}/${a(t)}/${e.slice(-2)}`;case"DD MMM YYYY":return`${r} ${a(t)} ${e}`;case"MMM DD, YYYY":return`${a(t)} ${r}, ${e}`;case"DD MMMM YYYY":return`${r} ${o(t)} ${e}`;case"MMMM DD, YYYY":return`${o(t)} ${r}, ${e}`;default:return`${r}/${t}/${e}`}}(n.y,n.m,n.d):e}function h(t,r){if(!t||d.test(t))return e;const n=new Date(t);if(Number.isNaN(n.getTime()))return e;const a=r?.timeZone||M();if(r?.locale)return function(e,t,r){const n={hour:"numeric",minute:"2-digit"};try{return e.toLocaleTimeString(t,{...n,timeZone:r})}catch{return e.toLocaleTimeString(t,n)}}(n,r.locale,a);const{hh:o,mm:Y}=f(n,a);return function(e,t){const r=Number(e);return`${r%12||12}:${t} ${r<12?"am":"pm"}`}(o,Y)}function g(t,r){const n=h(t,r);return n===e?e:`${p(t,r)}, ${n}`}var k={months:n,monthsShort:r,weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Su","Mo","Tu","We","Th","Fr","Sa"],monthYear:(e,t)=>`${n[t]} ${e}`,shortMonthYear:(e,t)=>`${r[t]} ${e}`,longDate:(e,t,r)=>`${r} ${n[t]} ${e}`},S=/* @__PURE__ */new Map;function w(e){if(!e)return k;const t=S.get(e);if(t)return t;const r=t=>y(e,t),n=(e,t,r=1)=>new Date(Date.UTC(e,t,r)),a=r({month:"long"}),o=r({month:"short"}),Y=r({weekday:"long"}),u=r({weekday:"short"}),m=r({month:"long",year:"numeric"}),c=r({month:"short",year:"numeric"}),M=r({day:"numeric",month:"long",year:"numeric"}),i=Array.from({length:12},(e,t)=>t),D=Array.from({length:7},(e,t)=>t),l={months:i.map(e=>a.format(n(2e3,e))),monthsShort:i.map(e=>o.format(n(2e3,e))),weekdays:D.map(e=>Y.format(n(2e3,0,2+e))),weekdaysShort:D.map(e=>u.format(n(2e3,0,2+e))),monthYear:(e,t)=>m.format(n(e,t)),shortMonthYear:(e,t)=>c.format(n(e,t)),longDate:(e,t,r)=>M.format(n(e,t,r))};return S.set(e,l),l}var x=/* @__PURE__ */new Map;function I(e){if(!e)return 0;let t=x.get(e);if(void 0===t){t=0;try{const r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;1===n?.firstDay&&(t=1)}catch{}x.set(e,t)}return t}export{t as DATE_FORMAT_OPTIONS,c as TZ_AUTO,w as calendarNames,I as firstDayOfWeek,p as formatDate,g as formatDateTime,h as formatTime,Y as getUserDateFormat,M as getUserTimezone,u as setUserDateFormat,i as setUserTimezone,D as syncTimezoneFromProfile};
@@ -1,9 +0,0 @@
1
- import{toISODate as e}from"./chunk-MNXRAZJV.js";import{Calendar as t}from"./chunk-E5MVH3SH.js";import{inputClasses as r,PLACEHOLDER_INK as a}from"./chunk-AYZY3YNC.js";import{calendarNames as n}from"./chunk-5OTS2G3M.js";import{Icon as i}from"./chunk-KKSVRIMP.js";import{onOverlayOpen as o}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as l}from"./chunk-62LW225J.js";import{useDropdownPosition as s}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as d}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as u}from"./chunk-TWVUQUUD.js";import{useShellStrings as c,useShellLocale as m}from"./chunk-4PAWQEXM.js";import{forwardRef as f,useState as b,useRef as p,useId as h,useEffect as v}from"react";import{createPortal as g}from"react-dom";import{jsx as y,jsxs as x}from"react/jsx-runtime";var N=/^\d{4}-\d{2}-\d{2}$/,k=/^(aria|data)-/,j=/* @__PURE__ */new Set(["aria-invalid","aria-required"]);function w(t){if(null==t||""===t)return"";if(t instanceof Date)return Number.isNaN(t.getTime())?"":e(t);if(N.test(t))return t;const r=new Date(t);return Number.isNaN(r.getTime())?"":e(r)}function D(e){if(!N.test(e))return null;const[t,r,a]=e.split("-").map(Number),n=new Date(t,r-1,a);return n.getMonth()===r-1&&n.getDate()===a?n:null}function M(e,t){const r=D(e);return r?t.longDate(r.getFullYear(),r.getMonth(),r.getDate()):""}var S=f(function({value:f,onChange:N,min:S,max:E,invalid:F,size:B,native:C,weekStartsOn:W,className:$="","aria-label":q,"aria-describedby":I,"aria-labelledby":O,id:T,name:z,disabled:J,placeholder:L,required:P,clearable:U,form:V,title:Y,tabIndex:A,autoFocus:G,onFocus:H,onBlur:R,...K},Q){const X=U??!P,Z=w(f),_=w(S),ee=w(E),te=c().datePicker,re=m(),ae=n(re),[ne,ie]=b(!1),oe=p(null),le=p(null),se=p(null),de=h(),ue=h(),ce=h(),me=s(le,ne,{popupRef:se}),[fe,be]=b(!1);d(()=>{const e=!!T&&(le.current?.labels?.length??0)>0;e!==fe&&be(e)});const pe=!q&&(!!O||fe);if(v(()=>{if(!ne)return;const e=e=>{const t=e.target;oe.current?.contains(t)||se.current?.contains(t)||ie(!1)};document.addEventListener("pointerdown",e,!0);const t=o(()=>ie(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[ne]),v(()=>{if(ne)return u(e=>"Escape"===e.key&&(ie(!1),le.current?.focus(),!0),()=>se.current)},[ne]),C)/* @__PURE__ */
2
- return y("input",{ref:Q,type:"date",lang:re,id:T,name:z,disabled:J,"aria-label":q,"aria-describedby":I,"aria-invalid":F||void 0,value:Z,min:_||void 0,max:ee||void 0,onChange:e=>N?.(D(e.target.value)),className:r({invalid:F,size:B,className:$}),"aria-labelledby":O,required:P,form:V,title:Y,tabIndex:A,autoFocus:G,onFocus:H,onBlur:R,...K});const he=Object.fromEntries(Object.entries(K).filter(([e])=>k.test(e)&&!j.has(e))),ve=K["aria-required"],ge=!!P||!0===ve||"true"===ve,ye=[pe?ue:void 0,ge?ce:void 0,I].filter(Boolean).join(" ")||void 0,xe=e(/* @__PURE__ */new Date),Ne=(!_||xe>=_)&&(!ee||xe<=ee),ke=L??te.placeholder;/* @__PURE__ */
3
- return x("div",{ref:oe,className:"relative",children:[
4
- /* @__PURE__ */y("input",{ref:Q,type:"hidden",name:z,form:V,value:Z}),
5
- /* @__PURE__ */x("button",{ref:le,type:"button",...he,id:T,disabled:J,title:Y,tabIndex:A,autoFocus:G,onFocus:H,onBlur:R,"aria-haspopup":"dialog","aria-expanded":ne,"aria-controls":ne?de:void 0,"aria-labelledby":O,"aria-describedby":ye,"aria-label":q?`${q}${Z?`, ${M(Z,ae)}`:""}`:void 0,onClick:()=>ie(e=>!e),className:`${r({invalid:F,size:B,className:$})} flex items-center justify-between text-left`,children:[
6
- /* @__PURE__ */y("span",{className:Z?"text-ink-strongest":a,children:Z?M(Z,ae):ke}),
7
- /* @__PURE__ */y(i,{name:"date",className:`h-4 w-4 shrink-0 ${a}`,strokeWidth:"1.75","aria-hidden":"true"})]}),pe&&/* @__PURE__ */y("span",{id:ue,className:"sr-only",children:Z?M(Z,ae):ke}),ge&&/* @__PURE__ */y("span",{id:ce,className:"sr-only",children:te.required}),ne&&g(
8
- /* @__PURE__ */x("div",{ref:se,id:de,role:"dialog","aria-label":q??te.dialog,className:"fixed w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-lg",style:{zIndex:l.popup,left:me?.left,right:me?.right,top:me?.top,bottom:me?.bottom,maxWidth:me?.maxWidth,visibility:me?void 0:"hidden"},children:[
9
- /* @__PURE__ */y(t,{value:Z||null,min:_||null,max:ee||null,weekStartsOn:W,onSelect:e=>{ie(!1),le.current?.focus(),N?.(D(e))}}),(X||Ne)&&/* @__PURE__ */x("div",{className:"mt-2 flex justify-between border-t border-gray-100 pt-2",children:[X&&/* @__PURE__ */y("button",{type:"button",onClick:()=>{ie(!1),le.current?.focus(),N?.(null)},className:"rounded-(--radius-control) px-2 py-1 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700",children:te.clear}),Ne&&/* @__PURE__ */y("button",{type:"button",onClick:()=>{ie(!1),le.current?.focus(),N?.(/* @__PURE__ */new Date)},className:"ml-auto rounded-(--radius-control) px-2 py-1 text-sm font-medium text-blue-600 hover:bg-blue-50",children:te.today})]})]}),document.body)]})});export{S as DatePicker_default};
@@ -1,14 +0,0 @@
1
- import{calendarNames as e,firstDayOfWeek as t}from"./chunk-5OTS2G3M.js";import{Icon as r}from"./chunk-KKSVRIMP.js";import{useBrowserValue as a}from"./chunk-D65T4H6J.js";import{useShellStrings as n,useShellLocale as o}from"./chunk-4PAWQEXM.js";import{useMemo as l,useState as i,useRef as s,useEffect as c}from"react";import{jsxs as u,jsx as g,Fragment as d}from"react/jsx-runtime";var h=e=>String(e).padStart(2,"0"),m="grid grid-cols-[repeat(7,minmax(0,40px))] sm:grid-cols-[repeat(7,minmax(0,32px))] justify-center gap-1";function b(e){return`${e.getFullYear()}-${h(e.getMonth()+1)}-${h(e.getDate())}`}function f(e){if(!e)return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const r=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(r.getTime())?null:r}var v=e=>`${e.getFullYear()}-${h(e.getMonth()+1)}`;var y=()=>b(/* @__PURE__ */new Date);var p=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),x=(e,t)=>{const r=new Date(e.getFullYear(),e.getMonth()+t,1),a=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();return new Date(r.getFullYear(),r.getMonth(),Math.min(e.getDate(),a))};function w({value:h,endValue:w,mode:N="single",onSelect:M,min:D,max:Y,month:k,defaultMonth:F,onMonthChange:j,weekStartsOn:A,quickJump:S=!0,markedDates:$,readOnly:C=!1,"aria-label":P,className:K=""}){const q=l(()=>new Set($??[]),[$]),E=f(h),O=a(y,null),T=f(O),W=n().calendar,H=o(),I=e(H),J=a(()=>t(H),0),R=A??J,U=()=>{if(!T)return null;const e=v(T);return D&&e<D.slice(0,7)?D.slice(0,7):Y&&e>Y.slice(0,7)?Y.slice(0,7):e},[V,B]=i(()=>F||(E?v(E):U())),G=k??V??U(),L=null===G?null:function(e,t){const r=/^(\d{4})-(\d{2})$/.exec(e);return r?new Date(Number(r[1]),Number(r[2])-1,1):t}(G,T),[Q,X]=i(()=>h??O),z=s(null),Z=s(!1),[_,ee]=i("days"),te=l(()=>L?function(e,t){const r=new Date(e.getFullYear(),e.getMonth(),1),a=(r.getDay()-t+7)%7,n=new Date(r.getFullYear(),r.getMonth(),1-a);return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),n.getDate()+t))}(L,R):[],[G,R]),re=e=>!!D&&e<D||!!Y&&e>Y,ae=Q??O,ne=te.some(e=>b(e)===ae),oe=L?te.find(e=>e.getMonth()===L.getMonth())??te[0]:null,le=ne&&ae?ae:oe?b(oe):"";if(c(()=>{Z.current&&(Z.current=!1,z.current?.querySelector('[data-active="true"]')?.focus())},[le,G]),!L)/* @__PURE__ */
2
- return u("div",{className:K,"aria-hidden":"true","data-calendar-pending":"",children:[
3
- /* @__PURE__ */g("div",{className:"mb-2 h-6"}),
4
- /* @__PURE__ */g("div",{className:"space-y-1",children:Array.from({length:7},(e,t)=>/* @__PURE__ */g("div",0===t?{className:"py-1 text-xs",children:" "}:{className:m,children:/* @__PURE__ */g("span",{className:"aspect-square"})},t))})]});const ie=e=>"years"===_?new Date(L.getFullYear()+12*e,L.getMonth(),1):"months"===_?new Date(L.getFullYear()+e,L.getMonth(),1):x(L,e),se=e=>{const t=v(e);void 0===k&&B(t),j?.(t)},ce=P??I.monthYear(L.getFullYear(),L.getMonth());/* @__PURE__ */
5
- return u("div",{className:K,children:[
6
- /* @__PURE__ */u("div",{className:"mb-2 flex items-center justify-between px-1",children:[
7
- /* @__PURE__ */g("button",{type:"button","aria-label":"years"===_?W.previousYears:"months"===_?W.previousYear:W.previousMonth,onClick:()=>se(ie(-1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */g(r,{name:"chevron-left",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}),
8
- /* @__PURE__ */g("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:S?/* @__PURE__ */u(d,{children:["years"!==_&&/* @__PURE__ */g("button",{type:"button","aria-label":W.chooseMonth(I.months[L.getMonth()]),onClick:()=>ee(e=>"months"===e?"days":"months"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:I.months[L.getMonth()]}),
9
- /* @__PURE__ */g("button",{type:"button","aria-label":W.chooseYear(L.getFullYear()),onClick:()=>ee(e=>"years"===e?"days":"years"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:L.getFullYear()})]}):/* @__PURE__ */g("span",{children:I.monthYear(L.getFullYear(),L.getMonth())})}),
10
- /* @__PURE__ */g("button",{type:"button","aria-label":"years"===_?W.nextYears:"months"===_?W.nextYear:W.nextMonth,onClick:()=>se(ie(1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */g(r,{name:"chevron-right",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})})]}),"months"===_&&/* @__PURE__ */g("div",{role:"group","aria-label":W.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:I.monthsShort.map((e,t)=>/* @__PURE__ */g("button",{type:"button","aria-pressed":t===L.getMonth(),onClick:()=>{se(new Date(L.getFullYear(),t,1)),ee("days")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",t===L.getMonth()?"bg-blue-600 font-semibold text-white":T&&t===T.getMonth()&&L.getFullYear()===T.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),"years"===_&&/* @__PURE__ */g("div",{role:"group","aria-label":W.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,t)=>{return r=L.getFullYear(),12*Math.floor(r/12)+t;var r}).map(e=>/* @__PURE__ */g("button",{type:"button","aria-pressed":e===L.getFullYear(),onClick:()=>{se(new Date(e,L.getMonth(),1)),ee("months")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",e===L.getFullYear()?"bg-blue-600 font-semibold text-white":e===T?.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),
11
- /* @__PURE__ */u("div",{ref:z,role:"grid","aria-label":ce,className:"space-y-1","aria-readonly":C||void 0,onKeyDown:e=>{const t=f(le)??T??L,r={ArrowLeft:()=>p(t,-1),ArrowRight:()=>p(t,1),ArrowUp:()=>p(t,-7),ArrowDown:()=>p(t,7),Home:()=>p(t,-(t.getDay()-R+7)%7),End:()=>p(t,6-(t.getDay()-R+7)%7),PageUp:()=>x(t,e.shiftKey?-12:-1),PageDown:()=>x(t,e.shiftKey?12:1)};if(r[e.key])return e.preventDefault(),a=r[e.key](),Z.current=!0,X(b(a)),void(v(a)!==G&&se(a));var a;"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),C||re(le)||M(le))},hidden:"days"!==_,children:[
12
- /* @__PURE__ */g("div",{role:"row",className:`${m} text-center text-xs font-medium text-ink-faint`,children:Array.from({length:7},(e,t)=>(t+R)%7).map(e=>
13
- /* @__PURE__ */g("div",{role:"columnheader","aria-label":I.weekdays[e],className:"py-1",children:/* @__PURE__ */g("abbr",{title:I.weekdays[e],className:"no-underline",children:I.weekdaysShort[e]})},e))}),Array.from({length:6},(e,t)=>/* @__PURE__ */g("div",{role:"row",className:`${m} text-center text-sm`,children:te.slice(7*t,7*t+7).map(e=>{const t=b(e),r=e.getMonth()!==L.getMonth(),a=t===h||"range"===N&&t===w,n=(e=>!("range"!==N||!h||!w)&&e>h&&e<w)(t),o=re(t),l=I.longDate(e.getFullYear(),e.getMonth(),e.getDate()),i=e=>["relative w-full aspect-square rounded-md transition-colors",e?"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",o?"cursor-not-allowed text-gray-300":a?"bg-accent-fill font-semibold text-on-accent":n?"bg-accent-tint-strong text-blue-800":r?"text-ink-faint"+(e?" hover:bg-gray-100":""):"text-ink"+(e?" hover:bg-gray-100":""),t!==O||a?"":"font-semibold text-blue-600"].filter(Boolean).join(" "),s=q.has(t)&&/* @__PURE__ */g("span",{"data-marked":"","aria-hidden":"true",className:"absolute bottom-1 left-1/2 h-1 w-1 -translate-x-1/2 rounded-full "+(a?"bg-surface":r?"bg-gray-400":"bg-blue-500")});/* @__PURE__ */
14
- return g("div",{role:"gridcell","aria-selected":a,"aria-label":C?l:void 0,children:C?/* @__PURE__ */u("span",{"aria-hidden":"true",className:`grid place-items-center ${i(!1)}`,children:[e.getDate(),s]}):/* @__PURE__ */u("button",{type:"button","data-active":t===le,tabIndex:t===le?0:-1,disabled:o,"aria-label":l,"aria-current":t===O?"date":void 0,onClick:()=>{X(t),M(t)},className:i(!0),children:[e.getDate(),s]})},t)})},t))]})]})}export{w as Calendar,f as fromKey,b as toKey};