efficient-shell 14.7.0 → 15.2.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 (268) hide show
  1. package/README.md +3 -2
  2. package/dist/Browser-42QAXKYW.js +44 -0
  3. package/dist/Calculator-C7APPCLE.js +29 -0
  4. package/dist/CurrencyConverter-VFTDSYQ3.js +21 -0
  5. package/dist/{Files-EQBPHAUH.js → Files-OAVWF6EW.js} +68 -68
  6. package/dist/Notepad-LNNSVEFG.js +24 -0
  7. package/dist/PdfViewer-ADPTYOAO.js +1 -0
  8. package/dist/PomodoroTimer-AGSHX2JO.js +91 -0
  9. package/dist/{Preview-ZHZ4CEWF.js → Preview-GDNUQKGN.js} +40 -40
  10. package/dist/Sidebar-SWLVNJ6L.js +44 -0
  11. package/dist/{Stock-S3LKKT3K.js → Stock-NNDDNQBJ.js} +5 -5
  12. package/dist/{Weather-KEOJ3BBV.js → Weather-NGQALCXO.js} +19 -19
  13. package/dist/{WorldClock-GKMDG2KU.js → WorldClock-LX4BQPZJ.js} +7 -7
  14. package/dist/ai/index.js +118 -118
  15. package/dist/apps/index.js +1 -1
  16. package/dist/bin/browser-check.js +1 -1
  17. package/dist/bin/media-host-check.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/charts/ChordChart.js +1 -1
  21. package/dist/charts/FlowChart.js +1 -1
  22. package/dist/charts/RadarChart.js +1 -1
  23. package/dist/charts/SankeyChart.js +1 -1
  24. package/dist/charts/SpecChart.js +1 -1
  25. package/dist/charts/SunburstChart.js +1 -1
  26. package/dist/charts/TreemapChart.js +1 -1
  27. package/dist/{chunk-P5J7G7OV.js → chunk-26I3OTGP.js} +1 -1
  28. package/dist/{chunk-RXCBSQA2.js → chunk-2M3KB4RH.js} +1 -1
  29. package/dist/chunk-2MUZFHZW.js +6 -0
  30. package/dist/{chunk-727NHWCZ.js → chunk-2QUACZ6O.js} +1 -1
  31. package/dist/{chunk-3ZJAQSFS.js → chunk-32HTOZFT.js} +3 -3
  32. package/dist/{chunk-OYQWBJ37.js → chunk-3CIJFWB4.js} +1 -1
  33. package/dist/chunk-3HPCQMYH.js +15 -0
  34. package/dist/{chunk-TBDILJ6G.js → chunk-3TVMQCYR.js} +1 -1
  35. package/dist/{chunk-MPC3CHAO.js → chunk-4H4HJIWI.js} +1 -1
  36. package/dist/chunk-52YTUQW3.js +2 -0
  37. package/dist/{chunk-DNPAYNNU.js → chunk-5JQCWXIQ.js} +1 -1
  38. package/dist/{chunk-5SQHRDFC.js → chunk-5R25GNE2.js} +2 -2
  39. package/dist/{chunk-T46I4YOI.js → chunk-6F3XQJR6.js} +1 -1
  40. package/dist/{chunk-G3TC2GIA.js → chunk-7FYTL6SD.js} +1 -1
  41. package/dist/{chunk-YX3JD6PA.js → chunk-7M7GKYHS.js} +5 -5
  42. package/dist/{chunk-HTBACICQ.js → chunk-7QFXUNFA.js} +6 -6
  43. package/dist/{chunk-XIX72C7K.js → chunk-7T6NWAPG.js} +1 -1
  44. package/dist/chunk-7YJBWOQG.js +2 -0
  45. package/dist/{chunk-WBUAO7T7.js → chunk-7ZJ7VK2N.js} +1 -1
  46. package/dist/{chunk-7WF6LFOJ.js → chunk-ABAUJLI4.js} +1 -1
  47. package/dist/{chunk-DBBOD5QW.js → chunk-ABRCV7DQ.js} +1 -1
  48. package/dist/{chunk-AH5MLH54.js → chunk-AVUH35GW.js} +1 -1
  49. package/dist/{chunk-GY7MJTIZ.js → chunk-BMZL5BHA.js} +1 -1
  50. package/dist/{chunk-QCLKRFL4.js → chunk-BN37AISA.js} +1 -1
  51. package/dist/{chunk-47BGAQWD.js → chunk-C5Q4AKXO.js} +1 -1
  52. package/dist/chunk-CIT4YPEO.js +8 -0
  53. package/dist/{chunk-JPVD3VS7.js → chunk-CMC25URA.js} +6 -6
  54. package/dist/{chunk-24BF22NF.js → chunk-D3L2QCGF.js} +1 -1
  55. package/dist/chunk-DTZDOXK3.js +19 -0
  56. package/dist/{chunk-UYUNREAL.js → chunk-DXTRHNP4.js} +3 -3
  57. package/dist/{chunk-ZA6ANC2D.js → chunk-ECZEJ6BE.js} +6 -6
  58. package/dist/chunk-EQDYCSUX.js +13 -0
  59. package/dist/{chunk-XNKNX5L3.js → chunk-FM5ASDVN.js} +1 -1
  60. package/dist/{chunk-RA5G4K3N.js → chunk-FYHUCRLU.js} +1 -1
  61. package/dist/{chunk-JU722M5V.js → chunk-FZZBBZXZ.js} +6 -6
  62. package/dist/{chunk-U75MSD4F.js → chunk-GBCLIWUQ.js} +1 -1
  63. package/dist/{chunk-NRX6JQV5.js → chunk-HBAATSUS.js} +1 -1
  64. package/dist/{chunk-EOYKUV2U.js → chunk-HKXP3JJ5.js} +1 -1
  65. package/dist/{chunk-6RU2PGQK.js → chunk-HMTZP7NJ.js} +1 -1
  66. package/dist/chunk-HVWRF7N4.js +23 -0
  67. package/dist/chunk-IBPJJO4N.js +28 -0
  68. package/dist/{chunk-7D2QZ6JA.js → chunk-IIUFCTT6.js} +1 -1
  69. package/dist/{chunk-EHNW3UNC.js → chunk-IJWRJPX6.js} +6 -6
  70. package/dist/{chunk-TFQC67XR.js → chunk-ILH7RDAD.js} +9 -9
  71. package/dist/{chunk-IVEM2BPC.js → chunk-J43RRDEP.js} +1 -1
  72. package/dist/{chunk-ION3XGLN.js → chunk-JE4BGFDJ.js} +1 -1
  73. package/dist/{chunk-P3XXFQG5.js → chunk-JFTLFF52.js} +3 -3
  74. package/dist/chunk-JHEHW5BE.js +5 -0
  75. package/dist/{chunk-EHPY3BFC.js → chunk-JJ5W4BRW.js} +1 -1
  76. package/dist/{chunk-U5OSLUDU.js → chunk-JVITCC65.js} +1 -1
  77. package/dist/{chunk-PTLVNC3V.js → chunk-K3OLOLFT.js} +6 -6
  78. package/dist/{chunk-I7WAOKU2.js → chunk-KKZXGWSX.js} +2 -2
  79. package/dist/chunk-KWBYE5MN.js +9 -0
  80. package/dist/{chunk-Y6FULJWJ.js → chunk-L664TIIV.js} +6 -6
  81. package/dist/{chunk-2RLWGWOU.js → chunk-LFGJUJRZ.js} +13 -13
  82. package/dist/{chunk-3L7BEEBW.js → chunk-LKNDLXL3.js} +1 -1
  83. package/dist/{chunk-EN3GYSCE.js → chunk-M4NT6HGJ.js} +1 -1
  84. package/dist/{chunk-NHALP3MW.js → chunk-M5JEYZ3A.js} +4 -4
  85. package/dist/chunk-M6ODRWTM.js +7 -0
  86. package/dist/chunk-M6T7N4SN.js +14 -0
  87. package/dist/{chunk-2TNG32QT.js → chunk-MDGM5NUO.js} +8 -8
  88. package/dist/chunk-MQERW3QR.js +3 -0
  89. package/dist/{chunk-LJS7UF3M.js → chunk-NBV3XK3Q.js} +2 -2
  90. package/dist/{chunk-2XDO7FZC.js → chunk-NJJG2VAW.js} +12 -12
  91. package/dist/chunk-NTVACRKD.js +4 -0
  92. package/dist/chunk-NXPIX7NO.js +2 -0
  93. package/dist/chunk-OCITNQGF.js +11 -0
  94. package/dist/{chunk-7OVMWXFM.js → chunk-OCKOZV46.js} +1 -1
  95. package/dist/{chunk-UGA5NGW4.js → chunk-OEZC5N6J.js} +1 -1
  96. package/dist/{chunk-EDRELF6L.js → chunk-PAD65HG7.js} +1 -1
  97. package/dist/{chunk-MKHOXO5O.js → chunk-PYGXSGXC.js} +1 -1
  98. package/dist/{chunk-BUUAALHH.js → chunk-QBR73AJX.js} +20 -20
  99. package/dist/{chunk-Y5RTVKMB.js → chunk-QI2LJ7OL.js} +9 -9
  100. package/dist/{chunk-DO6P6LYU.js → chunk-QIAJ3QNV.js} +1 -1
  101. package/dist/{chunk-4BRVZAIW.js → chunk-QJY52ZHG.js} +1 -1
  102. package/dist/{chunk-R36VZ35L.js → chunk-QMUW35QL.js} +6 -6
  103. package/dist/chunk-QQ6TGD7K.js +92 -0
  104. package/dist/chunk-QVGASI5H.js +9 -0
  105. package/dist/chunk-QZYV4TDD.js +1 -0
  106. package/dist/{chunk-XJK6VNXV.js → chunk-S3F2TY7X.js} +1 -1
  107. package/dist/chunk-S6IW2F4J.js +8 -0
  108. package/dist/chunk-SH7PJC4P.js +1 -0
  109. package/dist/{chunk-HAEZUUDT.js → chunk-SKPAIZSC.js} +3 -3
  110. package/dist/{chunk-Y5YVKUM4.js → chunk-SXNT73VT.js} +19 -19
  111. package/dist/chunk-T43ATI2N.js +6 -0
  112. package/dist/{chunk-4SFWQPOB.js → chunk-T65TAQLW.js} +7 -7
  113. package/dist/{chunk-DOJSWVBX.js → chunk-TB7BO2XS.js} +6 -6
  114. package/dist/{chunk-NC5FIFAY.js → chunk-TVMDDQJP.js} +1 -1
  115. package/dist/{chunk-GVAVIYE6.js → chunk-TWSROAS7.js} +1 -1
  116. package/dist/{chunk-EHSK43WG.js → chunk-UA7SWROJ.js} +8 -8
  117. package/dist/chunk-UMLXFQVC.js +1 -0
  118. package/dist/{chunk-6X32SWQI.js → chunk-VIBGF2HJ.js} +1 -1
  119. package/dist/{chunk-WYAKASF3.js → chunk-VNKLIWNQ.js} +1 -1
  120. package/dist/{chunk-2SOGTOUQ.js → chunk-VQ3OSYTA.js} +4 -4
  121. package/dist/{chunk-EEAOFYW5.js → chunk-VTYALYW4.js} +12 -12
  122. package/dist/chunk-WHHHECBC.js +2 -0
  123. package/dist/chunk-XQMVECQM.js +15 -0
  124. package/dist/{chunk-6AYAB5FN.js → chunk-YVI2XJCB.js} +5 -5
  125. package/dist/{chunk-ZEGCKIAL.js → chunk-YX4QGW7Z.js} +3 -3
  126. package/dist/chunk-Z2MP46QJ.js +1 -0
  127. package/dist/chunk-ZC2FZLYX.js +4 -0
  128. package/dist/{chunk-SP4S4HUJ.js → chunk-ZQWKVLSY.js} +13 -13
  129. package/dist/{chunk-5O4HMXPQ.js → chunk-ZS36DB4X.js} +2 -2
  130. package/dist/chunk-ZUQ72WER.js +7 -0
  131. package/dist/{chunk-IZ6D4KGR.js → chunk-ZYWLX5EK.js} +3 -3
  132. package/dist/{chunk-CXEELIRW.js → chunk-ZZKBCNK6.js} +9 -9
  133. package/dist/data/DataTable.js +1 -1
  134. package/dist/data/EntityList.js +1 -1
  135. package/dist/data/Gantt.js +1 -1
  136. package/dist/data/ListLoadError.js +1 -1
  137. package/dist/data/ListToolbar.js +1 -1
  138. package/dist/data/ResizableTable.js +1 -1
  139. package/dist/data/statusColumn.js +1 -1
  140. package/dist/forms/AlignmentGrid.js +1 -1
  141. package/dist/forms/BorderInput.js +1 -1
  142. package/dist/forms/BrandAssetEditor.js +1 -1
  143. package/dist/forms/Button.js +1 -1
  144. package/dist/forms/ColorPicker.js +1 -1
  145. package/dist/forms/ComposerAttachments.js +1 -1
  146. package/dist/forms/CornersInput.js +1 -1
  147. package/dist/forms/DatePicker.js +1 -1
  148. package/dist/forms/DateRangePicker.js +1 -1
  149. package/dist/forms/DisplayChips.js +1 -1
  150. package/dist/forms/FilePicker.js +1 -1
  151. package/dist/forms/IconButton.js +1 -1
  152. package/dist/forms/IconPicker.js +1 -1
  153. package/dist/forms/Input.js +1 -1
  154. package/dist/forms/InputNumber.js +1 -1
  155. package/dist/forms/LinkPicker.js +1 -1
  156. package/dist/forms/MediaLibrary.js +1 -1
  157. package/dist/forms/MediaUploadField.js +1 -1
  158. package/dist/forms/MediaUploadGrid.js +1 -1
  159. package/dist/forms/MediaUsedInList.js +1 -1
  160. package/dist/forms/NumericKeypad.js +1 -1
  161. package/dist/forms/PictureTiles.js +1 -1
  162. package/dist/forms/PositionInput.js +1 -1
  163. package/dist/forms/RenameField.js +1 -1
  164. package/dist/forms/SearchInput.js +1 -1
  165. package/dist/forms/Segmented.d.ts +1 -1
  166. package/dist/forms/Segmented.js +1 -1
  167. package/dist/forms/Select.js +1 -1
  168. package/dist/forms/SidesInput.js +1 -1
  169. package/dist/forms/Slider.js +1 -1
  170. package/dist/forms/Snippet.js +1 -1
  171. package/dist/forms/SplitButton.js +1 -1
  172. package/dist/forms/TagInput.js +1 -1
  173. package/dist/forms/TextToolbar.js +1 -1
  174. package/dist/forms/UnitMenu.js +1 -1
  175. package/dist/forms/WidthsBar.js +1 -1
  176. package/dist/icons/index.js +1 -1
  177. package/dist/index.d.ts +2 -2
  178. package/dist/index.js +662 -662
  179. package/dist/map/index.js +10 -10
  180. package/dist/page-tabs/index.js +5 -5
  181. package/dist/pdf/index.js +1 -1
  182. package/dist/routine-index.json +1 -1
  183. package/dist/shell/AppUpdateBanner.js +1 -1
  184. package/dist/shell/ColoredBadge.js +1 -1
  185. package/dist/shell/ConfirmDialog.js +1 -1
  186. package/dist/shell/ContextMenu.js +1 -1
  187. package/dist/shell/Dialog.js +1 -1
  188. package/dist/shell/Drawer.d.ts +4 -5
  189. package/dist/shell/Drawer.js +1 -1
  190. package/dist/shell/DropdownMenu.js +1 -1
  191. package/dist/shell/EditableGrid.js +1 -1
  192. package/dist/shell/FloatingBar.js +1 -1
  193. package/dist/shell/GlobalSearch.js +1 -1
  194. package/dist/shell/HelpCenter.js +1 -1
  195. package/dist/shell/IconRail.js +1 -1
  196. package/dist/shell/ImageLightbox.js +1 -1
  197. package/dist/shell/ItemCount.js +1 -1
  198. package/dist/shell/LanguageSelect.js +1 -1
  199. package/dist/shell/Markdown.js +1 -1
  200. package/dist/shell/Popover.js +1 -1
  201. package/dist/shell/PopupMenu.js +1 -1
  202. package/dist/shell/ResizeHandle.js +1 -1
  203. package/dist/shell/SearchableSelect.js +1 -1
  204. package/dist/shell/SettingReset.js +1 -1
  205. package/dist/shell/SidebarLayout.js +1 -1
  206. package/dist/shell/SidebarNav.js +1 -1
  207. package/dist/shell/SortableList.js +1 -1
  208. package/dist/shell/StatusBadge.js +1 -1
  209. package/dist/shell/Tabs.js +1 -1
  210. package/dist/shell/Tooltip.js +1 -1
  211. package/dist/shell/TopNav.js +1 -1
  212. package/dist/shell/TransferProgress.js +1 -1
  213. package/dist/shell/Tree.js +1 -1
  214. package/dist/shell/discardGuard.js +1 -1
  215. package/dist/telemetry/index.js +1 -1
  216. package/dist/templates/AuthScreen.js +1 -1
  217. package/dist/templates/ChatTemplate.js +1 -1
  218. package/dist/templates/CheckoutTemplate.js +1 -1
  219. package/dist/templates/DashboardTemplate.js +1 -1
  220. package/dist/templates/DataTablePage.js +1 -1
  221. package/dist/templates/EmailTemplate.js +1 -1
  222. package/dist/templates/ErrorBoundary.d.ts +1 -1
  223. package/dist/templates/ErrorBoundary.js +1 -1
  224. package/dist/templates/FormLayoutPage.js +1 -1
  225. package/dist/templates/GalleryTemplate.js +1 -1
  226. package/dist/tokens/spacing.d.ts +4 -3
  227. package/dist/tokens/spacing.js +1 -1
  228. package/dist/ui/index.d.ts +1 -1
  229. package/dist/ui/index.js +1 -1
  230. package/dist/ui.css +6 -4
  231. package/dist/value-index.json +1 -1
  232. package/dist/version.js +1 -1
  233. package/package.json +1 -1
  234. package/dist/Browser-HX3QY73A.js +0 -44
  235. package/dist/Calculator-TJDZOTG7.js +0 -29
  236. package/dist/CurrencyConverter-JL5JIVJG.js +0 -21
  237. package/dist/Notepad-5BQUYQNJ.js +0 -24
  238. package/dist/PdfViewer-FWGHFO4N.js +0 -1
  239. package/dist/PomodoroTimer-7W5ZHKUL.js +0 -91
  240. package/dist/Sidebar-2TYZENQL.js +0 -44
  241. package/dist/chunk-4DNPUG3T.js +0 -7
  242. package/dist/chunk-5IXCLPVZ.js +0 -1
  243. package/dist/chunk-A3VLZZHJ.js +0 -9
  244. package/dist/chunk-AJPQJ7TC.js +0 -6
  245. package/dist/chunk-ALZHFQRX.js +0 -4
  246. package/dist/chunk-AW7TOB6N.js +0 -1
  247. package/dist/chunk-CHDGSJLV.js +0 -8
  248. package/dist/chunk-DTFX624I.js +0 -8
  249. package/dist/chunk-EBODRYXS.js +0 -19
  250. package/dist/chunk-ERI63O4A.js +0 -28
  251. package/dist/chunk-FFPIT2LB.js +0 -3
  252. package/dist/chunk-GRZPIV2G.js +0 -14
  253. package/dist/chunk-HOPHOF2C.js +0 -2
  254. package/dist/chunk-HX5QSQ2C.js +0 -2
  255. package/dist/chunk-M5IZ7QLQ.js +0 -7
  256. package/dist/chunk-MEP6CZJ3.js +0 -2
  257. package/dist/chunk-MNZAAQLH.js +0 -15
  258. package/dist/chunk-MYH5H43C.js +0 -1
  259. package/dist/chunk-NDCS4COQ.js +0 -11
  260. package/dist/chunk-PWON7O3N.js +0 -9
  261. package/dist/chunk-RTK77DMP.js +0 -15
  262. package/dist/chunk-UZATF4OZ.js +0 -92
  263. package/dist/chunk-VUBDHFG5.js +0 -4
  264. package/dist/chunk-W4IH3BE3.js +0 -23
  265. package/dist/chunk-W6REY3SV.js +0 -5
  266. package/dist/chunk-Y7D2CZ4H.js +0 -13
  267. package/dist/chunk-ZSVU44OB.js +0 -6
  268. /package/dist/{chunk-5YTZBYG4.js → chunk-LPQQNPH5.js} +0 -0
@@ -1,19 +1,19 @@
1
- import{textWidth as e}from"./chunk-UVCMV2TL.js";import{escapeHtml as t}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as n}from"./chunk-G3TC2GIA.js";import{useBrowserLayoutEffect as r}from"./chunk-PU2GJVMG.js";import{useShellStrings as o}from"./chunk-NRHG4R2Q.js";import{useRef as l,useState as c,useEffect as a,useCallback as s,useMemo as i}from"react";import{createPortal as u}from"react-dom";import{jsxs as h,jsx as d,Fragment as w}from"react/jsx-runtime";function m(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:e,...n}){const r=i(()=>({__html:t(e)}),[e]);/* @__PURE__ */
2
- return d("div",{...n,dangerouslySetInnerHTML:r})}function f({columns:t,data:f,onChange:p,onColumnsChange:b,fixedRows:y=!1,minRows:v=15,maxHeight:x="260px",cellStyles:M,onFocusChange:D,onSelectionChange:k}){const C=l(null),E=o().grid,[L,$]=c(null);a(()=>{D?.(L)},[L,D]);const[S,N]=c({}),z=l(null),[A,O]=c({}),R=l(null),[K,T]=c(null),[P,F]=c(null),[I,j]=c(null),[H,X]=c(null),[Y,G]=c(null),W=l(null);r(()=>{const e=W.current;if(!e||e.row!==Y?.row||e.col!==Y?.col)return;W.current=null;const t=C.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[Y]);const[q,V]=c(null),[B,U]=c(null);a(()=>{k?.(q&&B?{anchor:q,end:B}:null)},[q,B,k]);const _=l(!1),[J,Q]=c(null),Z=l(!1),ee=l({a:null,e:null});ee.current={a:q,e:B};const te=q&&B&&(q.row!==B.row||q.col!==B.col),ne=[...f];if(!y)for(;ne.length<v;)ne.push(Array(t.length).fill(""));const re=s((e,n,r)=>{const o=ne.map(e=>[...e]);for(;o.length<=e;)o.push(Array(t.length).fill(""));for(;o[e].length<t.length;)o[e].push("");o[e][n]=r,p(o)},[ne,t.length,p]),oe=s((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ne[e]?.[t]||"")){const r=ne.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}_.current=!0,e.shiftKey&&q||V({row:t,col:n}),U({row:t,col:n})},[ne,p,q]),le=s((e,t)=>{_.current&&U({row:e,col:t})},[]);a(()=>{const e=()=>{_.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),a(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!B)return;const t=window.getSelection();if(t&&t.toString().length>0&&!te)return;const n=Math.min(q.row,B.row),r=Math.max(q.row,B.row),o=Math.min(q.col,B.col),l=Math.max(q.col,B.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ne[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,B,ne,te]),a(()=>{const e=e=>{if(!L)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!C.current?.contains(n))return;const r=e.clipboardData?.getData("text/plain");if(!r)return;e.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ne.map(e=>[...e]);for(let e=0;e<o.length;e++){const n=L.row+e;for(;l.length<=n;)l.push(Array(t.length).fill(""));for(;l[n].length<t.length;)l[n].push("");for(let r=0;r<o[e].length;r++){const c=L.col+r;if(c>=t.length)break;t[c].readOnly||(l[n][c]=o[e][r].trim())}}p(y?l:m(l,t.length)),V({row:L.row,col:L.col}),U({row:Math.min(L.row+o.length-1,l.length-1),col:Math.min(L.col+(o[0]?.length||1)-1,t.length-1)})};return window.addEventListener("paste",e),()=>window.removeEventListener("paste",e)},[L,ne,t,p,y]);const ce=s((e,n,r)=>{const o=e.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;e.preventDefault();const c=ne.map(e=>[...e]);for(let e=0;e<l.length;e++){const o=n+e;for(;c.length<=o;)c.push(Array(t.length).fill(""));for(;c[o].length<t.length;)c[o].push("");for(let n=0;n<l[e].length;n++){const a=r+n;if(a>=t.length)break;t[a].readOnly||(c[o][a]=l[e][n].trim())}}p(y?c:m(c,t.length))},[ne,t,p,y]),ae=s((e,n,r)=>{let o=n,l=r;if("Tab"===e.key)e.preventDefault(),l=e.shiftKey?r-1:r+1,l>=t.length&&(l=0,o=n+1),l<0&&(l=t.length-1,o=n-1);else if("Enter"===e.key)e.preventDefault(),o=e.shiftKey?n-1:n+1;else if("ArrowDown"===e.key)e.preventDefault(),o=n+1;else if("ArrowUp"===e.key)e.preventDefault(),o=n-1;else if("ArrowLeft"===e.key)e.preventDefault(),l=r-1;else{if("ArrowRight"!==e.key){if("Delete"===e.key||"Backspace"===e.key){const o=e.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(e.preventDefault(),re(n,r,"")));if(e.preventDefault(),q&&B){const e=Math.min(q.row,B.row),n=Math.max(q.row,B.row),r=Math.min(q.col,B.col),o=Math.max(q.col,B.col),l=ne.map(e=>[...e]);for(let c=e;c<=n;c++)for(let e=r;e<=o;e++)l[c]&&!t[e]?.readOnly&&(l[c][e]="");p(l)}else re(n,r,"");return}return}e.preventDefault(),l=r+1}for(;l>=0&&l<t.length&&t[l].readOnly;)l+="Tab"===e.key&&e.shiftKey?-1:1;if(o>=0&&o<ne.length&&l>=0&&l<t.length){const e=C.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),$({row:o,col:l}),G(null),V({row:o,col:l}),U({row:o,col:l}))}},[t,ne,ne.length,re,q,B,p]),se=s(e=>{if(!y&&e>=ne.length-2){const e=ne.map(e=>[...e]);for(let n=0;n<5;n++)e.push(Array(t.length).fill(""));p(e)}},[y,ne,t.length,p]),[ie,ue]=c(null);a(()=>{if(!ie)return;const e=()=>ue(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ie]);const he=s(e=>{const n=ne.map(e=>[...e]);n.splice(e,0,Array(t.length).fill("")),p(n)},[ne,t.length,p]),de=s(e=>{if(ne.length<=1)return;const t=ne.filter((t,n)=>n!==e);p(t)},[ne,p]),we=s(e=>{const t=ne.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[ne,p]),me=s(e=>{if(t.length<=1)return;const n=ne.map(t=>{const n=[...t];return n.splice(e,1),n});p(n)},[ne,t.length,p]),ge=s((e,t)=>{e.preventDefault(),y||ue({x:e.clientX,y:e.clientY,items:[{label:E.insertRowAbove,onClick:()=>{he(t),ue(null)}},{label:E.insertRowBelow,onClick:()=>{he(t+1),ue(null)}},{label:E.deleteRow(t+1),onClick:()=>{de(t),ue(null)}}]})},[y,he,de,E]),fe=s((e,n)=>{e.preventDefault(),y||ue({x:e.clientX,y:e.clientY,items:[{label:E.insertColumnLeft,onClick:()=>{we(n),ue(null)}},{label:E.insertColumnRight,onClick:()=>{we(n+1),ue(null)}},{label:E.deleteColumn(String(t[n]?.title||n+1)),onClick:()=>{me(n),ue(null)}}]})},[y,t,we,me,E]),pe=e=>S[e]??t[e]?.width??150;a(()=>{const e=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);N(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&b){const e=t.map((e,t)=>({...e,width:S[t]??e.width}));e[z.current.col]={...e[z.current.col],width:S[z.current.col]??t[z.current.col].width},b(e)}z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)}},[t,S,b]);const be=e=>A[e]??28;a(()=>{const e=e=>{if(!R.current)return;const t=e.clientY-R.current.startY,n=Math.max(20,R.current.startH+t);O(e=>({...e,[R.current.row]:n}))},t=()=>{R.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=s(n=>{const r="12px ui-monospace, SFMono-Regular, Menlo, monospace";if(null===e("",r))return;let o=0;for(const t of ne){const l=String(t[n]??"").replace(/<[^>]*>/g,""),c=e(l,r)??0;c>o&&(o=c)}const l=e(t[n]?.title??"",r)??0;l>o&&(o=l);const c=Math.max(40,Math.ceil(o+24));if(N(e=>({...e,[n]:c})),b){const e=t.map((e,t)=>({...e,width:t===n?c:S[t]??e.width}));b(e)}},[ne,t,S,b]),ve=s(e=>{O(t=>{const n={...t};return delete n[e],n})},[]),xe=s(e=>{const{a:n,e:r}=ee.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,h=a;e.row>l?i=e.row:e.row<o&&(s=e.row),e.col>a?h=e.col:e.col<c&&(u=e.col);const d=l-o+1,w=a-c+1,m=ne.map(e=>[...e]);for(;m.length<=i;)m.push(Array(t.length).fill(""));for(const e of m)for(;e.length<=h;)e.push("");function g(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=g(Array.from({length:d},(e,n)=>m[o+n]?.[t]??""));if(r){const c=parseFloat(m[l]?.[t]??"0"),a=parseFloat(m[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=m[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=g(Array.from({length:w},(t,n)=>m[e]?.[c+n]??""));if(r){const o=parseFloat(m[e]?.[a]??"0"),l=parseFloat(m[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=m[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=m[o+r]?.[c+l]??""}m[e][t]=n}p(m),V({row:s,col:u}),U({row:i,col:h})},[ne,t.length,p]);a(()=>{const e=e=>{if(!Z.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);Q({row:r,col:o})},t=()=>{Z.current&&J&&xe(J),Z.current=!1,Q(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[J,xe]);const Me=e=>{e.preventDefault(),e.stopPropagation(),Z.current=!0,document.body.style.cursor="crosshair"},De=l(null),[ke,Ce]=c(0),[Ee,Le]=c(800);a(()=>{const e=De.current;if(!e)return;const t=()=>Le(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const $e=ne.length>100,Se=$e?Math.max(0,Math.floor(ke/28)-20):0,Ne=$e?Math.min(ne.length,Math.ceil((ke+Ee)/28)+20):ne.length,ze=i(()=>ne.slice(Se,Ne),[ne,Se,Ne]),Ae=28*Se,Oe=28*(ne.length-Ne),Re="px-2 h-8 text-left text-xs font-medium text-ink-faint uppercase bg-gray-100 border-b border-r border-line select-none";/* @__PURE__ */
1
+ import{textWidth as e}from"./chunk-UVCMV2TL.js";import{escapeHtml as t}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as n}from"./chunk-7FYTL6SD.js";import{createShellPortal as r}from"./chunk-52YTUQW3.js";import{useBrowserLayoutEffect as o}from"./chunk-PU2GJVMG.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{useRef as c,useState as s,useEffect as a,useCallback as i,useMemo as u}from"react";import{jsxs as h,jsx as d,Fragment as w}from"react/jsx-runtime";function m(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:e,...n}){const r=u(()=>({__html:t(e)}),[e]);/* @__PURE__ */
2
+ return d("div",{...n,dangerouslySetInnerHTML:r})}function f({columns:t,data:f,onChange:p,onColumnsChange:b,fixedRows:y=!1,minRows:v=15,maxHeight:x="260px",cellStyles:M,onFocusChange:D,onSelectionChange:k}){const C=c(null),E=l().grid,[L,S]=s(null);a(()=>{D?.(L)},[L,D]);const[$,N]=s({}),z=c(null),[A,O]=s({}),R=c(null),[T,K]=s(null),[P,F]=s(null),[j,Y]=s(null),[H,I]=s(null),[X,W]=s(null),q=c(null);o(()=>{const e=q.current;if(!e||e.row!==X?.row||e.col!==X?.col)return;q.current=null;const t=C.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[X]);const[G,U]=s(null),[V,B]=s(null);a(()=>{k?.(G&&V?{anchor:G,end:V}:null)},[G,V,k]);const Q=c(!1),[_,J]=s(null),Z=c(!1),ee=c({a:null,e:null});ee.current={a:G,e:V};const te=G&&V&&(G.row!==V.row||G.col!==V.col),ne=[...f];if(!y)for(;ne.length<v;)ne.push(Array(t.length).fill(""));const re=i((e,n,r)=>{const o=ne.map(e=>[...e]);for(;o.length<=e;)o.push(Array(t.length).fill(""));for(;o[e].length<t.length;)o[e].push("");o[e][n]=r,p(o)},[ne,t.length,p]),oe=i((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ne[e]?.[t]||"")){const r=ne.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}Q.current=!0,e.shiftKey&&G||U({row:t,col:n}),B({row:t,col:n})},[ne,p,G]),le=i((e,t)=>{Q.current&&B({row:e,col:t})},[]);a(()=>{const e=()=>{Q.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),a(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!G||!V)return;const t=window.getSelection();if(t&&t.toString().length>0&&!te)return;const n=Math.min(G.row,V.row),r=Math.max(G.row,V.row),o=Math.min(G.col,V.col),l=Math.max(G.col,V.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ne[e]?.[n]||"");c.push(t.join("\t"))}const s=c.join("\n");s&&(e.preventDefault(),navigator.clipboard.writeText(s))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[G,V,ne,te]),a(()=>{const e=e=>{if(!L)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!C.current?.contains(n))return;const r=e.clipboardData?.getData("text/plain");if(!r)return;e.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ne.map(e=>[...e]);for(let e=0;e<o.length;e++){const n=L.row+e;for(;l.length<=n;)l.push(Array(t.length).fill(""));for(;l[n].length<t.length;)l[n].push("");for(let r=0;r<o[e].length;r++){const c=L.col+r;if(c>=t.length)break;t[c].readOnly||(l[n][c]=o[e][r].trim())}}p(y?l:m(l,t.length)),U({row:L.row,col:L.col}),B({row:Math.min(L.row+o.length-1,l.length-1),col:Math.min(L.col+(o[0]?.length||1)-1,t.length-1)})};return window.addEventListener("paste",e),()=>window.removeEventListener("paste",e)},[L,ne,t,p,y]);const ce=i((e,n,r)=>{const o=e.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;e.preventDefault();const c=ne.map(e=>[...e]);for(let e=0;e<l.length;e++){const o=n+e;for(;c.length<=o;)c.push(Array(t.length).fill(""));for(;c[o].length<t.length;)c[o].push("");for(let n=0;n<l[e].length;n++){const s=r+n;if(s>=t.length)break;t[s].readOnly||(c[o][s]=l[e][n].trim())}}p(y?c:m(c,t.length))},[ne,t,p,y]),se=i((e,n,r)=>{let o=n,l=r;if("Tab"===e.key)e.preventDefault(),l=e.shiftKey?r-1:r+1,l>=t.length&&(l=0,o=n+1),l<0&&(l=t.length-1,o=n-1);else if("Enter"===e.key)e.preventDefault(),o=e.shiftKey?n-1:n+1;else if("ArrowDown"===e.key)e.preventDefault(),o=n+1;else if("ArrowUp"===e.key)e.preventDefault(),o=n-1;else if("ArrowLeft"===e.key)e.preventDefault(),l=r-1;else{if("ArrowRight"!==e.key){if("Delete"===e.key||"Backspace"===e.key){const o=e.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(e.preventDefault(),re(n,r,"")));if(e.preventDefault(),G&&V){const e=Math.min(G.row,V.row),n=Math.max(G.row,V.row),r=Math.min(G.col,V.col),o=Math.max(G.col,V.col),l=ne.map(e=>[...e]);for(let c=e;c<=n;c++)for(let e=r;e<=o;e++)l[c]&&!t[e]?.readOnly&&(l[c][e]="");p(l)}else re(n,r,"");return}return}e.preventDefault(),l=r+1}for(;l>=0&&l<t.length&&t[l].readOnly;)l+="Tab"===e.key&&e.shiftKey?-1:1;if(o>=0&&o<ne.length&&l>=0&&l<t.length){const e=C.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),S({row:o,col:l}),W(null),U({row:o,col:l}),B({row:o,col:l}))}},[t,ne,ne.length,re,G,V,p]),ae=i(e=>{if(!y&&e>=ne.length-2){const e=ne.map(e=>[...e]);for(let n=0;n<5;n++)e.push(Array(t.length).fill(""));p(e)}},[y,ne,t.length,p]),[ie,ue]=s(null);a(()=>{if(!ie)return;const e=()=>ue(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ie]);const he=i(e=>{const n=ne.map(e=>[...e]);n.splice(e,0,Array(t.length).fill("")),p(n)},[ne,t.length,p]),de=i(e=>{if(ne.length<=1)return;const t=ne.filter((t,n)=>n!==e);p(t)},[ne,p]),we=i(e=>{const t=ne.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[ne,p]),me=i(e=>{if(t.length<=1)return;const n=ne.map(t=>{const n=[...t];return n.splice(e,1),n});p(n)},[ne,t.length,p]),ge=i((e,t)=>{e.preventDefault(),y||ue({x:e.clientX,y:e.clientY,items:[{label:E.insertRowAbove,onClick:()=>{he(t),ue(null)}},{label:E.insertRowBelow,onClick:()=>{he(t+1),ue(null)}},{label:E.deleteRow(t+1),onClick:()=>{de(t),ue(null)}}]})},[y,he,de,E]),fe=i((e,n)=>{e.preventDefault(),y||ue({x:e.clientX,y:e.clientY,items:[{label:E.insertColumnLeft,onClick:()=>{we(n),ue(null)}},{label:E.insertColumnRight,onClick:()=>{we(n+1),ue(null)}},{label:E.deleteColumn(String(t[n]?.title||n+1)),onClick:()=>{me(n),ue(null)}}]})},[y,t,we,me,E]),pe=e=>$[e]??t[e]?.width??150;a(()=>{const e=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);N(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&b){const e=t.map((e,t)=>({...e,width:$[t]??e.width}));e[z.current.col]={...e[z.current.col],width:$[z.current.col]??t[z.current.col].width},b(e)}z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)}},[t,$,b]);const be=e=>A[e]??28;a(()=>{const e=e=>{if(!R.current)return;const t=e.clientY-R.current.startY,n=Math.max(20,R.current.startH+t);O(e=>({...e,[R.current.row]:n}))},t=()=>{R.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=i(n=>{const r="12px ui-monospace, SFMono-Regular, Menlo, monospace";if(null===e("",r))return;let o=0;for(const t of ne){const l=String(t[n]??"").replace(/<[^>]*>/g,""),c=e(l,r)??0;c>o&&(o=c)}const l=e(t[n]?.title??"",r)??0;l>o&&(o=l);const c=Math.max(40,Math.ceil(o+24));if(N(e=>({...e,[n]:c})),b){const e=t.map((e,t)=>({...e,width:t===n?c:$[t]??e.width}));b(e)}},[ne,t,$,b]),ve=i(e=>{O(t=>{const n={...t};return delete n[e],n})},[]),xe=i(e=>{const{a:n,e:r}=ee.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),s=Math.max(n.col,r.col);let a=o,i=l,u=c,h=s;e.row>l?i=e.row:e.row<o&&(a=e.row),e.col>s?h=e.col:e.col<c&&(u=e.col);const d=l-o+1,w=s-c+1,m=ne.map(e=>[...e]);for(;m.length<=i;)m.push(Array(t.length).fill(""));for(const e of m)for(;e.length<=h;)e.push("");function g(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=a;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=s)continue;let n;if(1===w&&u===c&&h===s){const r=g(Array.from({length:d},(e,n)=>m[o+n]?.[t]??""));if(r){const c=parseFloat(m[l]?.[t]??"0"),s=parseFloat(m[o]?.[t]??"0"),a=e>l?e-l:-(o-e);n=String((e>l?c:s)+r.step*a)}else{const r=((e-o)%d+d)%d;n=m[o+r]?.[t]??""}}else if(1===d&&a===o&&i===l){const r=g(Array.from({length:w},(t,n)=>m[e]?.[c+n]??""));if(r){const o=parseFloat(m[e]?.[s]??"0"),l=parseFloat(m[e]?.[c]??"0"),a=t>s?t-s:-(c-t);n=String((t>s?o:l)+r.step*a)}else{const r=((t-c)%w+w)%w;n=m[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=m[o+r]?.[c+l]??""}m[e][t]=n}p(m),U({row:a,col:u}),B({row:i,col:h})},[ne,t.length,p]);a(()=>{const e=e=>{if(!Z.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);J({row:r,col:o})},t=()=>{Z.current&&_&&xe(_),Z.current=!1,J(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[_,xe]);const Me=e=>{e.preventDefault(),e.stopPropagation(),Z.current=!0,document.body.style.cursor="crosshair"},De=c(null),[ke,Ce]=s(0),[Ee,Le]=s(800);a(()=>{const e=De.current;if(!e)return;const t=()=>Le(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Se=ne.length>100,$e=Se?Math.max(0,Math.floor(ke/28)-20):0,Ne=Se?Math.min(ne.length,Math.ceil((ke+Ee)/28)+20):ne.length,ze=u(()=>ne.slice($e,Ne),[ne,$e,Ne]),Ae=28*$e,Oe=28*(ne.length-Ne),Re="px-2 h-8 text-left text-xs font-medium text-ink-faint uppercase bg-gray-100 border-b border-r border-line select-none";/* @__PURE__ */
3
3
  return h("div",{ref:De,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:x,height:x},onScroll:e=>Ce(e.target.scrollTop),children:[
4
4
  /* @__PURE__ */h("table",{ref:C,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+t.reduce((e,n)=>e+pe(t.indexOf(n)),0)},children:[
5
5
  /* @__PURE__ */h("colgroup",{children:[
6
6
  /* @__PURE__ */d("col",{style:{width:36}}),t.map((e,t)=>/* @__PURE__ */d("col",{style:{width:pe(t)}},e.key))]}),
7
7
  /* @__PURE__ */d("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */h("tr",{children:[
8
- /* @__PURE__ */d("th",{className:`${n} ${Re} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{V({row:0,col:0}),U({row:ne.length-1,col:t.length-1})},title:E.selectAll,children:"#"}),t.map((e,r)=>{const o=q&&B&&Math.min(q.col,B.col)<=r&&r<=Math.max(q.col,B.col)&&0===Math.min(q.row,B.row)&&Math.max(q.row,B.row)===ne.length-1;/* @__PURE__ */
9
- return h("th",{className:`${n} ${Re} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${H===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>j(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),X(t)})(e,r),onDrop:()=>(e=>{if(null===I||I===e)return j(null),void X(null);const n=ne.map(t=>{const n=[...t],[r]=n.splice(I,1);return n.splice(e,0,r),n});if(p(n),b){const n=[...t],[r]=n.splice(I,1);n.splice(e,0,r),b(n)}j(null),X(null)})(r),onDragEnd:()=>{j(null),X(null)},onClick:e=>{e.shiftKey&&q||V({row:0,col:r}),U({row:ne.length-1,col:r})},onContextMenu:e=>fe(e,r),children:[e.title,
8
+ /* @__PURE__ */d("th",{className:`${n} ${Re} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{U({row:0,col:0}),B({row:ne.length-1,col:t.length-1})},title:E.selectAll,children:"#"}),t.map((e,r)=>{const o=G&&V&&Math.min(G.col,V.col)<=r&&r<=Math.max(G.col,V.col)&&0===Math.min(G.row,V.row)&&Math.max(G.row,V.row)===ne.length-1;/* @__PURE__ */
9
+ return h("th",{className:`${n} ${Re} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${H===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>Y(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),I(t)})(e,r),onDrop:()=>(e=>{if(null===j||j===e)return Y(null),void I(null);const n=ne.map(t=>{const n=[...t],[r]=n.splice(j,1);return n.splice(e,0,r),n});if(p(n),b){const n=[...t],[r]=n.splice(j,1);n.splice(e,0,r),b(n)}Y(null),I(null)})(r),onDragEnd:()=>{Y(null),I(null)},onClick:e=>{e.shiftKey&&G||U({row:0,col:r}),B({row:ne.length-1,col:r})},onContextMenu:e=>fe(e,r),children:[e.title,
10
10
  /* @__PURE__ */d("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={col:t,startX:e.clientX,startW:pe(t)},document.body.style.cursor="col-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:E.resize})]},e.key)})]})}),
11
- /* @__PURE__ */h("tbody",{children:[Ae>0&&/* @__PURE__ */d("tr",{style:{height:Ae}}),ze.map((e,n)=>{const r=Se+n,o=q&&B&&Math.min(q.row,B.row)<=r&&r<=Math.max(q.row,B.row)&&0===Math.min(q.col,B.col)&&Math.max(q.col,B.col)===t.length-1;/* @__PURE__ */
11
+ /* @__PURE__ */h("tbody",{children:[Ae>0&&/* @__PURE__ */d("tr",{style:{height:Ae}}),ze.map((e,n)=>{const r=$e+n,o=G&&V&&Math.min(G.row,V.row)<=r&&r<=Math.max(G.row,V.row)&&0===Math.min(G.col,V.col)&&Math.max(G.col,V.col)===t.length-1;/* @__PURE__ */
12
12
  return h("tr",{style:{height:be(r)},children:[
13
- /* @__PURE__ */h("td",{className:`relative px-1 py-1 text-center text-2xs text-ink-faintest border-b border-r border-line bg-surface-sunken select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${P===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>T(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),F(t)})(e,r),onDrop:()=>(e=>{if(null===K||K===e)return T(null),void F(null);const t=ne.map(e=>[...e]),[n]=t.splice(K,1);t.splice(e,0,n),p(t),T(null),F(null)})(r),onDragEnd:()=>{T(null),F(null)},onClick:e=>{e.shiftKey&&q||V({row:r,col:0}),U({row:r,col:t.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
14
- /* @__PURE__ */d("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),R.current={row:t,startY:e.clientY,startH:be(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ve(r)},title:E.resize})]}),t.map((t,n)=>{const o=q&&B&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(q,B,r,n),l=Y?.row===r&&Y?.col===n&&!t.readOnly,c=L?.row===r&&L?.col===n,a=M?.[`${r}:${n}`],s=q&&B?Math.max(q.row,B.row):-1,i=q&&B?Math.max(q.col,B.col):-1,u=q&&B&&r===s&&n===i,w=Z.current&&J&&q&&B&&(()=>{const e=Math.min(q.row,B.row),t=Math.max(q.row,B.row),o=Math.min(q.col,B.col),l=Math.max(q.col,B.col);let c=e,a=t,s=o,i=l;return J.row>t?a=J.row:J.row<e&&(c=J.row),J.col>l?i=J.col:J.col<o&&(s=J.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",f=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
15
- return h("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${t.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${w?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){oe(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>le(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:e=>{e.target!==e.currentTarget||t.readOnly||G({row:r,col:n})},children:[
16
- /* @__PURE__ */d(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===t.align?"text-right":"center"===t.align?"text-center":""} ${t.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>oe(e,r,n),onMouseEnter:()=>le(r,n),onDoubleClick:()=>{t.readOnly||G({row:r,col:n})},onFocus:()=>{$({row:r,col:n}),_.current||(V({row:r,col:n}),U({row:r,col:n}))},onBlur:t=>{const o=t.currentTarget.textContent||"";o!==(e[n]||"")&&re(r,n,o),G(null)},onInput:()=>se(r),onPaste:e=>ce(e,r,n),onKeyDown:e=>{if(!(l||t.readOnly||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey))return e.preventDefault(),re(r,n,e.key),W.current={row:r,col:n},void G({row:r,col:n});ae(e,r,n)},text:e[n]||""}),u&&/* @__PURE__ */d("div",{onMouseDown:Me,title:E.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Oe>0&&/* @__PURE__ */d("tr",{style:{height:Oe}})]})]}),ie&&u(
13
+ /* @__PURE__ */h("td",{className:`relative px-1 py-1 text-center text-2xs text-ink-faintest border-b border-r border-line bg-surface-sunken select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${P===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>K(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),F(t)})(e,r),onDrop:()=>(e=>{if(null===T||T===e)return K(null),void F(null);const t=ne.map(e=>[...e]),[n]=t.splice(T,1);t.splice(e,0,n),p(t),K(null),F(null)})(r),onDragEnd:()=>{K(null),F(null)},onClick:e=>{e.shiftKey&&G||U({row:r,col:0}),B({row:r,col:t.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
14
+ /* @__PURE__ */d("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),R.current={row:t,startY:e.clientY,startH:be(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ve(r)},title:E.resize})]}),t.map((t,n)=>{const o=G&&V&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),s=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=s}(G,V,r,n),l=X?.row===r&&X?.col===n&&!t.readOnly,c=L?.row===r&&L?.col===n,s=M?.[`${r}:${n}`],a=G&&V?Math.max(G.row,V.row):-1,i=G&&V?Math.max(G.col,V.col):-1,u=G&&V&&r===a&&n===i,w=Z.current&&_&&G&&V&&(()=>{const e=Math.min(G.row,V.row),t=Math.max(G.row,V.row),o=Math.min(G.col,V.col),l=Math.max(G.col,V.col);let c=e,s=t,a=o,i=l;return _.row>t?s=_.row:_.row<e&&(c=_.row),_.col>l?i=_.col:_.col<o&&(a=_.col),r>=c&&r<=s&&n>=a&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===s?.fontSize?"text-2xs":"lg"===s?.fontSize?"text-sm":"xl"===s?.fontSize?"text-base":"text-xs",f=`${s?.bold?" font-bold":""}${s?.italic?" italic":""}${s?.underline?" underline":""}`;/* @__PURE__ */
15
+ return h("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${t.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${w?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){oe(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>le(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:e=>{e.target!==e.currentTarget||t.readOnly||W({row:r,col:n})},children:[
16
+ /* @__PURE__ */d(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===t.align?"text-right":"center"===t.align?"text-center":""} ${t.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>oe(e,r,n),onMouseEnter:()=>le(r,n),onDoubleClick:()=>{t.readOnly||W({row:r,col:n})},onFocus:()=>{S({row:r,col:n}),Q.current||(U({row:r,col:n}),B({row:r,col:n}))},onBlur:t=>{const o=t.currentTarget.textContent||"";o!==(e[n]||"")&&re(r,n,o),W(null)},onInput:()=>ae(r),onPaste:e=>ce(e,r,n),onKeyDown:e=>{if(!(l||t.readOnly||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey))return e.preventDefault(),re(r,n,e.key),q.current={row:r,col:n},void W({row:r,col:n});se(e,r,n)},text:e[n]||""}),u&&/* @__PURE__ */d("div",{onMouseDown:Me,title:E.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Oe>0&&/* @__PURE__ */d("tr",{style:{height:Oe}})]})]}),ie&&r(
17
17
  /* @__PURE__ */h(w,{children:[
18
18
  /* @__PURE__ */d("div",{className:"fixed inset-0 z-(--z-popup)",onPointerDown:()=>ue(null)}),
19
19
  /* @__PURE__ */d("div",{className:"fixed z-(--z-popup) bg-surface rounded-lg shadow-lg border border-line py-1 min-w-[160px]",style:{left:ie.x,top:ie.y},children:ie.items.map((e,t)=>/* @__PURE__ */d("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-ink hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{f as EditableGrid,m as withSpareRow};
@@ -1,4 +1,4 @@
1
- import{Tooltip as e}from"./chunk-AJPQJ7TC.js";import{jsxs as r,Fragment as n,jsx as i}from"react/jsx-runtime";var l=e=>!0===e||"true"===e;function o(e){e.preventDefault(),e.stopPropagation()}var t=(e,r)=>[e,r].filter(Boolean).join(" ")||void 0;function a({reason:l,id:o,block:t=!1,children:a}){/* @__PURE__ */
1
+ import{Tooltip as e}from"./chunk-2MUZFHZW.js";import{jsxs as r,Fragment as n,jsx as i}from"react/jsx-runtime";var l=e=>!0===e||"true"===e;function o(e){e.preventDefault(),e.stopPropagation()}var t=(e,r)=>[e,r].filter(Boolean).join(" ")||void 0;function a({reason:l,id:o,block:t=!1,children:a}){/* @__PURE__ */
2
2
  return r(n,{children:[
3
3
  /* @__PURE__ */i(e,{content:l,describe:!1,className:t?"relative flex w-full":"relative inline-flex",children:a}),
4
4
  /* @__PURE__ */i("span",{id:o,className:"sr-only",children:l})]})}export{a as OffWithReason,t as describedByWith,l as isAriaDisabled,o as swallowPress};
@@ -1,4 +1,4 @@
1
- import{GROUP_COLORS as e}from"./chunk-EDRELF6L.js";import{SpinnerRing as r}from"./chunk-R2VKEMZH.js";import{Tooltip as n}from"./chunk-AJPQJ7TC.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{jsx as t,jsxs as i,Fragment as a}from"react/jsx-runtime";var s="inline-flex items-center gap-1 whitespace-nowrap rounded-md border border-current/20 py-0.5 pl-2 pr-1 text-2xs font-medium";function o({label:e,glyph:r,onClick:l}){/* @__PURE__ */
1
+ import{GROUP_COLORS as e}from"./chunk-PAD65HG7.js";import{SpinnerRing as r}from"./chunk-R2VKEMZH.js";import{Tooltip as n}from"./chunk-2MUZFHZW.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{jsx as t,jsxs as i,Fragment as a}from"react/jsx-runtime";var s="inline-flex items-center gap-1 whitespace-nowrap rounded-md border border-current/20 py-0.5 pl-2 pr-1 text-2xs font-medium";function o({label:e,glyph:r,onClick:l}){/* @__PURE__ */
2
2
  return t(n,{content:e,describe:!1,children:/* @__PURE__ */t("button",{type:"button",onClick:l,"aria-label":e,className:"flex h-4 w-4 items-center justify-center rounded-full leading-none hover:bg-current/10 rosh-focus-ring focus-visible:ring-2",children:/* @__PURE__ */t("span",{"aria-hidden":"true",children:r})})})}function c({state:n,label:c,verb:u,subject:m,pct:p,onCancel:d,onRetry:h,onDismiss:f,className:b=""}){const g=l().transfer;if("idle"===n)return null==c?null:/* @__PURE__ */t("span",{className:`${s} ${e.neutral} pr-2 ${b}`.trim(),children:c});if("error"===n)/* @__PURE__ */
3
3
  return i("span",{role:"status",className:`${s} ${e.danger} ${b}`.trim(),children:[
4
4
  /* @__PURE__ */t("span",{children:g.error}),h&&/* @__PURE__ */t(o,{label:g.retry,glyph:"↻",onClick:h}),f&&/* @__PURE__ */t(o,{label:g.dismiss,glyph:"×",onClick:f})]});const y=u??g.uploading,$=null==p||Number.isNaN(p)?null:Math.max(0,Math.min(100,Math.round(p))),k="string"==typeof y?g.cancelVerb(y.toLowerCase()):g.cancel,N=e=>[e,m,null==$?"":`${$}%`].filter(Boolean).join(" ");/* @__PURE__ */
@@ -1,5 +1,5 @@
1
- import{InputNumber_default as e,stepRounding as a}from"./chunk-I7WAOKU2.js";import{IconButton_default as r}from"./chunk-MYH5H43C.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{Tooltip as t}from"./chunk-AJPQJ7TC.js";import{jsx as n,jsxs as o,Fragment as d}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={padding:{top:/* @__PURE__ */n(i,{name:"padding-top","aria-hidden":"true",className:l}),right:/* @__PURE__ */n(i,{name:"padding-right","aria-hidden":"true",className:l}),bottom:/* @__PURE__ */n(i,{name:"padding-bottom","aria-hidden":"true",className:l}),left:/* @__PURE__ */n(i,{name:"padding-left","aria-hidden":"true",className:l}),vertical:/* @__PURE__ */n(i,{name:"padding-y","aria-hidden":"true",className:l}),horizontal:/* @__PURE__ */n(i,{name:"padding-left-right","aria-hidden":"true",className:l})},crop:{top:/* @__PURE__ */n(i,{name:"crop-top","aria-hidden":"true",className:l}),right:/* @__PURE__ */n(i,{name:"crop-right","aria-hidden":"true",className:l}),bottom:/* @__PURE__ */n(i,{name:"crop-bottom","aria-hidden":"true",className:l}),left:/* @__PURE__ */n(i,{name:"crop-left","aria-hidden":"true",className:l}),vertical:/* @__PURE__ */n(i,{name:"crop-y","aria-hidden":"true",className:l}),horizontal:/* @__PURE__ */n(i,{name:"crop-left-right","aria-hidden":"true",className:l})}},m=/* @__PURE__ */new Set(["ArrowUp","ArrowDown","PageUp","PageDown"]),p=e=>{m.has(e.key)&&(e.preventDefault(),e.stopPropagation())},c=e=>e.stopPropagation(),h=/* @__PURE__ */n(i,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var u=(e,a,r)=>null===e[r]?a[r]:String(e[r]);function g(e,a){const r=r=>u(e,a,r);return r("left")!==r("right")||r("top")!==r("bottom")}function f({label:r,value:i,onChange:t,each:l,placeholder:m,words:h,min:g=0,max:f=200,step:b=4,readOnly:v,glyphs:N="padding",units:y,sideDisplay:w}){const x=s[N],C=(e,a)=>{const r={...i};for(const i of e)r[i]=a;t(r)},j=(r,t,o)=>{const d=r.map(e=>w?.[e]?.word),l=d[0]&&d.every(e=>e===d[0])?d[0]:void 0;if(l)/* @__PURE__ */
2
- return n("div",{"data-side":r.join("-"),className:"min-w-0",onKeyDownCapture:p,onWheelCapture:c,children:/* @__PURE__ */n(e,{value:null,onChange:e=>C(r,e),min:g,max:f,step:b,snap:!0,...a(b),readOnly:v,placeholder:l,display:()=>l,reportWhileTyping:!1,prefix:o,"aria-label":t})});const s=d.some(Boolean)?"mixed":function(e,a){const r=a.map(a=>e[a]);return r.every(e=>e===r[0])?r[0]:"mixed"}(i,r),N=r.map(e=>u(i,m,e)),x="mixed"!==s&&N.every(e=>e===N[0])?N[0]:"–";/* @__PURE__ */
3
- return n("div",{"data-side":r.join("-"),className:"min-w-0",children:/* @__PURE__ */n(e,{value:"mixed"===s?null:s,onChange:e=>C(r,e),min:g,max:f,step:b,snap:!0,...a(b),steppers:"compact",readOnly:v,placeholder:x,prefix:o,suffix:h.unit,units:y,"aria-label":t})})};/* @__PURE__ */
1
+ import{InputNumber_default as e,stepRounding as a}from"./chunk-KKZXGWSX.js";import{IconButton_default as r}from"./chunk-QZYV4TDD.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{Tooltip as t}from"./chunk-2MUZFHZW.js";import{jsx as n,jsxs as o,Fragment as d}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={padding:{top:/* @__PURE__ */n(i,{name:"padding-top","aria-hidden":"true",className:l}),right:/* @__PURE__ */n(i,{name:"padding-right","aria-hidden":"true",className:l}),bottom:/* @__PURE__ */n(i,{name:"padding-bottom","aria-hidden":"true",className:l}),left:/* @__PURE__ */n(i,{name:"padding-left","aria-hidden":"true",className:l}),vertical:/* @__PURE__ */n(i,{name:"padding-y","aria-hidden":"true",className:l}),horizontal:/* @__PURE__ */n(i,{name:"padding-left-right","aria-hidden":"true",className:l})},crop:{top:/* @__PURE__ */n(i,{name:"crop-top","aria-hidden":"true",className:l}),right:/* @__PURE__ */n(i,{name:"crop-right","aria-hidden":"true",className:l}),bottom:/* @__PURE__ */n(i,{name:"crop-bottom","aria-hidden":"true",className:l}),left:/* @__PURE__ */n(i,{name:"crop-left","aria-hidden":"true",className:l}),vertical:/* @__PURE__ */n(i,{name:"crop-y","aria-hidden":"true",className:l}),horizontal:/* @__PURE__ */n(i,{name:"crop-left-right","aria-hidden":"true",className:l})}},m=/* @__PURE__ */new Set(["ArrowUp","ArrowDown","PageUp","PageDown"]),p=e=>{m.has(e.key)&&(e.preventDefault(),e.stopPropagation())},c=e=>e.stopPropagation(),h=/* @__PURE__ */n(i,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var u=(e,a,r)=>null===e[r]?a[r]:String(e[r]);function g(e,a){const r=r=>u(e,a,r);return r("left")!==r("right")||r("top")!==r("bottom")}function f({label:r,value:i,onChange:t,each:l,placeholder:m,words:h,min:g=0,max:f=200,step:b=4,readOnly:v,glyphs:N="padding",units:y,sideDisplay:w}){const x=s[N],D=(e,a)=>{const r={...i};for(const i of e)r[i]=a;t(r)},j=(r,t,o)=>{const d=r.map(e=>w?.[e]?.word),l=d[0]&&d.every(e=>e===d[0])?d[0]:void 0;if(l)/* @__PURE__ */
2
+ return n("div",{"data-side":r.join("-"),className:"min-w-0",onKeyDownCapture:p,onWheelCapture:c,children:/* @__PURE__ */n(e,{value:null,onChange:e=>D(r,e),min:g,max:f,step:b,snap:!0,...a(b),readOnly:v,placeholder:l,display:()=>l,reportWhileTyping:!1,prefix:o,"aria-label":t})});const s=d.some(Boolean)?"mixed":function(e,a){const r=a.map(a=>e[a]);return r.every(e=>e===r[0])?r[0]:"mixed"}(i,r),N=r.map(e=>u(i,m,e)),x="mixed"!==s&&N.every(e=>e===N[0])?N[0]:"–";/* @__PURE__ */
3
+ return n("div",{"data-side":r.join("-"),className:"min-w-0",children:/* @__PURE__ */n(e,{value:"mixed"===s?null:s,onChange:e=>D(r,e),min:g,max:f,step:b,snap:!0,...a(b),steppers:"compact",readOnly:v,placeholder:x,prefix:o,suffix:h.unit,units:y,"aria-label":t})})};/* @__PURE__ */
4
4
  return n("div",{role:"group","aria-label":r,"data-sides":l?"each":"pairs",className:"grid min-w-0 grid-cols-2 gap-2",children:/* @__PURE__ */o(d,l?{children:[j(["left"],h.sides.left,x.left),j(["top"],h.sides.top,x.top),j(["right"],h.sides.right,x.right),j(["bottom"],h.sides.bottom,x.bottom)]}:{children:[j(["left","right"],h.horizontal,x.horizontal),j(["top","bottom"],h.vertical,x.vertical)]})})}function b({each:e,onChange:a,label:i,disabled:o}){/* @__PURE__ */
5
5
  return n(t,{content:i,children:/* @__PURE__ */n(r,{size:"md","aria-label":i,"aria-pressed":e,disabled:o,onClick:()=>a(!e),children:h})})}export{b as SidesEachToggle,f as SidesInput,g as sidesStartEach};
@@ -0,0 +1,5 @@
1
+ import{inputClasses as r,PLACEHOLDER_INK as e}from"./chunk-AYZY3YNC.js";import{DropdownMenu as n}from"./chunk-M6ODRWTM.js";import{IconButton_default as t}from"./chunk-QZYV4TDD.js";import{Tooltip as i}from"./chunk-2MUZFHZW.js";import{useRowControlSize as a}from"./chunk-UMLXFQVC.js";import{iconButtonClasses as s}from"./chunk-UQYNPYF4.js";import{forwardRef as o}from"react";import{jsx as l,jsxs as c}from"react/jsx-runtime";var m={sm:"sm",md:"sm",lg:"md",touch:"touch-sm"},p={sm:"pr-8",md:"pr-8",lg:"pr-10",touch:"pr-12"};function d({children:r}){/* @__PURE__ */
2
+ return l("span",{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-1",children:r})}function u({action:r,size:e="md"}){/* @__PURE__ */
3
+ return l(f,{action:r,size:m[e]})}var h=["","pr-8","pr-16"];function f({action:r,size:e}){const{label:a,icon:o,onClick:c,menu:m}=r;/* @__PURE__ */
4
+ return l(i,{content:a,describe:!1,children:m?/* @__PURE__ */l(n,{"aria-label":a,trigger:o,items:m,triggerClassName:s({size:e})}):/* @__PURE__ */l(t,{"aria-label":a,size:e,onClick:c,children:o})})}var g=o(function({invalid:n,leftIcon:t,rightAdornment:i,endAction:s,size:o,className:m="",readOnly:h,...f},g){const v=a(o),N=v??"md",j=`${t?"pl-10":""} ${s?p[N]:i?"pr-10":""}`.trim(),k=
5
+ /* @__PURE__ */l("input",{ref:g,"aria-invalid":n||void 0,readOnly:h,className:r({invalid:n,size:v,readOnly:h,className:[j,m].filter(Boolean).join(" ")}),...f});return t||i||s?/* @__PURE__ */c("div",{className:"relative",children:[t&&/* @__PURE__ */l("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${e}`,children:t}),k,s?/* @__PURE__ */l(d,{children:/* @__PURE__ */l(u,{action:s,size:N})}):i&&/* @__PURE__ */l("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:i})]}):k});export{h as END_ACTIONS_PAD,m as INPUT_END_ACTION_SIZE,u as InputEndActionButton,d as InputEndActionSlot,g as Input_default};
@@ -1,4 +1,4 @@
1
- import{SidebarLayout as e}from"./chunk-JU722M5V.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{Input_default as a}from"./chunk-W6REY3SV.js";import{Button_default as i}from"./chunk-MEP6CZJ3.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],m=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
1
+ import{SidebarLayout as e}from"./chunk-FZZBBZXZ.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{Input_default as a}from"./chunk-JHEHW5BE.js";import{Button_default as i}from"./chunk-7YJBWOQG.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],m=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
2
2
  return n("div",{className:"h-full",children:/* @__PURE__ */n(e,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */n("div",{className:"h-full overflow-auto",children:r.map(e=>/* @__PURE__ */l("button",{onClick:()=>o(e.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(e.id===d?"bg-blue-50/50":""),children:[
3
3
  /* @__PURE__ */n(t,{name:e.name,status:e.status}),
4
4
  /* @__PURE__ */l("div",{className:"min-w-0 flex-1",children:[
@@ -1 +1 @@
1
- import{client_default as a}from"./chunk-UZATF4OZ.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
1
+ import{client_default as a}from"./chunk-QQ6TGD7K.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
@@ -1,11 +1,11 @@
1
- import{MediaUploadField as e}from"./chunk-Y6FULJWJ.js";import{BrandMark as r}from"./chunk-MI67DI3H.js";import{Button_default as a}from"./chunk-MEP6CZJ3.js";import{useShellStrings as t}from"./chunk-NRHG4R2Q.js";import{useRef as i,useState as l,useEffect as s}from"react";import{jsxs as n,jsx as c}from"react/jsx-runtime";function d({committedUrl:d,committedHasAlpha:o=null,committedIsLight:m=null,fallbackUrl:g,fallbackHasAlpha:h=null,fallbackIsLight:u=null,subjectName:b,assetName:p,onSave:x,onRemove:f,accept:v="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:y="PNG · ICO · SVG · JPG · WEBP",maxBytes:N=5242880,previews:w=[],disabled:k=!1}){const j=i(null),[L,R]=l(null),[U,C]=l(""),[H,F]=l(""),[I,A]=l(!1),[E,G]=l(!1),J=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(p),O=t().brandAsset,P=U||d||g||"",B=L?null:d?o:h,S=L?null:d?m:u;s(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]);const $=()=>{j.current&&(URL.revokeObjectURL(j.current),j.current=null)};/* @__PURE__ */
2
- return n("section",{"aria-label":O.region(p,b),className:"grid gap-4 lg:grid-cols-2",children:[
1
+ import{MediaUploadField as e}from"./chunk-L664TIIV.js";import{BrandMark as r}from"./chunk-MI67DI3H.js";import{Button_default as a}from"./chunk-7YJBWOQG.js";import{useShellStrings as t}from"./chunk-NRHG4R2Q.js";import{useRef as i,useState as l,useEffect as s}from"react";import{jsxs as n,jsx as c}from"react/jsx-runtime";function d({committedUrl:d,committedHasAlpha:o=null,committedIsLight:m=null,fallbackUrl:g,fallbackHasAlpha:h=null,fallbackIsLight:u=null,subjectName:b,assetName:p,onSave:x,onRemove:f,accept:v="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:y="PNG · ICO · SVG · JPG · WEBP",maxBytes:N=5242880,previews:w=[],disabled:k=!1}){const j=i(null),[L,R]=l(null),[U,I]=l(""),[H,C]=l(""),[G,O]=l(!1),[A,B]=l(!1),F=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(p),E=t().brandAsset,P=U||d||g||"",S=L?null:d?o:h,$=L?null:d?m:u;s(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]);const z=()=>{j.current&&(URL.revokeObjectURL(j.current),j.current=null)};/* @__PURE__ */
2
+ return n("section",{"aria-label":E.region(p,b),className:"grid gap-4 lg:grid-cols-2",children:[
3
3
  /* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4",children:[
4
- /* @__PURE__ */c(e,{value:P,onChange:()=>{},onFile:e=>{if(k)return;$();const r=URL.createObjectURL(e);j.current=r,R(e),C(r),F("")},label:p,hint:H||O.usedFor(b),error:H||void 0,accept:v,acceptHint:y,maxSizeBytes:N,fit:"contain",height:180,allowRemove:!1,busy:I||E,disabled:k}),
4
+ /* @__PURE__ */c(e,{value:P,onChange:()=>{},onFile:e=>{if(k)return;z();const r=URL.createObjectURL(e);j.current=r,R(e),I(r),C("")},label:p,hint:H||E.usedFor(b),error:H||void 0,accept:v,acceptHint:y,maxSizeBytes:N,fit:"contain",height:180,allowRemove:!1,busy:G||A,disabled:k}),
5
5
  /* @__PURE__ */n("div",{className:"mt-3 flex flex-wrap gap-2",children:[
6
- /* @__PURE__ */c(a,{onClick:async()=>{if(L&&!k&&!I){A(!0),F("");try{await x(L),$(),R(null),C("")}catch(e){F(e instanceof Error?e.message:O.saveFailed(J,p))}finally{A(!1)}}},disabled:!L||k,loading:I,children:O.save(J,p)}),(L||d)&&/* @__PURE__ */c(a,{variant:"ghost-danger",onClick:async()=>{if(!k&&!E){if(L)return $(),R(null),C(""),void F("");if(d){G(!0),F("");try{await f()}catch(e){F(e instanceof Error?e.message:O.removeFailed(J,p))}finally{G(!1)}}}},disabled:k,loading:E,children:L?O.discard:O.remove(J,p)})]})]}),w.length>0&&/* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":O.previews(p),children:[
7
- /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-900",children:O.preview}),
8
- /* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:P,alt:O.alt(b,p),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:B,isLight:S,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
6
+ /* @__PURE__ */c(a,{onClick:async()=>{if(L&&!k&&!G){O(!0),C("");try{await x(L),z(),R(null),I("")}catch(e){C(e instanceof Error?e.message:E.saveFailed(F,p))}finally{O(!1)}}},disabled:!L||k,loading:G,children:E.save(F,p)}),(L||d)&&/* @__PURE__ */c(a,{variant:"ghost-danger",onClick:async()=>{if(!k&&!A){if(L)return z(),R(null),I(""),void C("");if(d){B(!0),C("");try{await f()}catch(e){C(e instanceof Error?e.message:E.removeFailed(F,p))}finally{B(!1)}}}},disabled:k,loading:A,children:L?E.discard:E.remove(F,p)})]})]}),w.length>0&&/* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":E.previews(p),children:[
7
+ /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-900",children:E.preview}),
8
+ /* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:P,alt:E.alt(b,p),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:S,isLight:$,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
9
9
  return n("div",{"data-brand-preview":!0,className:"dark"===e.surface?"text-white":"text-gray-900",children:[
10
10
  /* @__PURE__ */c("div",{className:"mb-2 text-xs font-medium text-gray-500",children:e.label}),"browser-tab"===e.kind?/* @__PURE__ */n("div",{className:"flex items-end gap-1 border-b border-gray-200",children:[
11
11
  /* @__PURE__ */n("div",{className:"flex max-w-[220px] items-center gap-2 rounded-t-lg border border-b-0 border-gray-200 bg-white px-3 py-2",children:[a,
@@ -1,3 +1,3 @@
1
- import{unitBox as e}from"./chunk-GVAVIYE6.js";import{useSettingAuto as r}from"./chunk-2NMW66P5.js";import{inputClasses as t}from"./chunk-AYZY3YNC.js";import{IconButton_default as n}from"./chunk-MYH5H43C.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{useBrowserLayoutEffect as i}from"./chunk-PU2GJVMG.js";import{registerModalEscapeInterceptor as a}from"./chunk-TWVUQUUD.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{forwardRef as c,useId as s,useState as u,useRef as d,useCallback as p,useEffect as f}from"react";import{jsx as m,jsxs as v,Fragment as h}from"react/jsx-runtime";function b(e){const r=String(e),t=/e-(\d+)$/.exec(r);return t?Number(t[1]):r.split(".")[1]?.length??0}function g(e){return 0===b(e)?{precision:0}:{snap:!0}}var x=(e,r)=>null==e?"":null!=r?e.toFixed(r):String(e),y={compact:{right:"var(--space-16)",least:"var(--space-32)"},steppers:{right:"calc(var(--space-40) + var(--space-20))",least:"calc(var(--space-48) * 2)"},plain:{right:"var(--space-8)",least:"var(--space-40)"}};function w(e){const r=d(null),[t,n]=u(0);return i(()=>{const e=r.current;if(!e)return;const t=()=>n(Math.ceil(e.getBoundingClientRect().width));if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[e]),[r,t]}function k(e,r,t){if(!r)return e;const n=e.trimEnd();for(let e=r.length;e>(t?0:r.length-1);e--)if(n.endsWith(r.slice(0,e)))return n.slice(0,-e).trimEnd();return e}function N({dir:e,compact:r,label:t,disabled:i,onStep:a}){const l=d(a);l.current=a;const c=d({}),s=p(()=>{const e=c.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),c.current={}},[]);f(()=>s,[s]),f(()=>{i&&s()},[i,s]);const u=/* @__PURE__ */m(o,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:r?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:r?2.6:2}),v={tabIndex:-1,"aria-label":t,disabled:i,onPointerDown:e=>{if(0!==e.button||i)return;e.preventDefault(),s();const r=e.shiftKey;l.current(r);const t=e.currentTarget.ownerDocument.defaultView??window;t.addEventListener("pointerup",s),c.current={off:()=>t.removeEventListener("pointerup",s),wait:setTimeout(()=>{c.current.every=setInterval(()=>l.current(r),60)},400)}},onPointerLeave:s,onPointerCancel:s,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return r?/* @__PURE__ */m("button",{type:"button",...v,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:u}):/* @__PURE__ */m(n,{size:"sm",...v,children:u})}var j=c(function({value:n,onChange:o,min:i,max:c,precision:g,step:j,shiftStep:E,disabled:D,readOnly:B,invalid:C,placeholder:M,size:S,prefix:$,suffix:O,suffixControl:P,units:F,id:R,name:U,className:V="",onBlur:K,onFocus:W,steppers:Y,stepFrom:z,snap:I=!1,allowEmpty:L=!0,appearance:T="box",display:A,reportWhileTyping:G=!0,onRevert:H,"aria-label":Q,"aria-labelledby":J,"aria-describedby":X,auto:Z,...q},_){const ee="bare"===T,re=P??("string"==typeof O?e(O,F,D||B):void 0),te=r(),ne=Z??te,oe=s(),ie="string"==typeof O&&""!==O.trim()?O.trim():void 0,ae=e=>function(e,r,t=!1){let n=k(e.trim(),r,t);if(n=n.replace(",","."),""===n||"-"===n||"."===n||"-."===n)return null;const o=Number(n);return Number.isFinite(o)?o:null}(e,ie,Boolean(re)),le=Boolean(O||re),ce=Object.fromEntries(Object.entries(q).filter(([e])=>e.startsWith("data-"))),se=l(),[ue,de]=u(()=>x(n,g)),pe=d(ue);pe.current=ue;const fe=d(null),me=p(e=>{fe.current=e,"function"==typeof _?_(e):_&&(_.current=e)},[_]),ve=d(n),he=d(n);he.current=n;const be=Boolean(D||B),ge=Y??!1,xe="compact"===ge,[ye,we]=w($),[ke,Ne]=w(Boolean(re)),je=xe?y.compact:ge?y.steppers:y.plain;f(()=>{ae(pe.current)!==n&&de(x(n,g))},[n,g]);const Ee=e=>{if(be)return;let r=(ae(pe.current)??z??(M?ae(M):null)??0)+e;null!=i&&r<i&&(r=i),null!=c&&r>c&&(r=c);const t=g??String(j??1).split(".")[1]?.length??0;r=Number(r.toFixed(t));const n=x(r,g);pe.current=n,de(n),o(r),Oe()},De=d(Ee);De.current=Ee;const Be=d({unit:j??1,big:E??10*(j??1),locked:be});Be.current={unit:j??1,big:E??10*(j??1),locked:be},f(()=>{const e=fe.current;if(!e)return;const r=r=>{const{unit:t,big:n,locked:o}=Be.current;if(o||e.ownerDocument.activeElement!==e)return;const i=r.deltaY||r.deltaX;i&&(r.preventDefault(),De.current((i<0?1:-1)*(r.shiftKey?n:t)))};return e.addEventListener("wheel",r,{passive:!1}),()=>e.removeEventListener("wheel",r)},[]);const[Ce,Me]=u(!1),[Se,$e]=u(0),Oe=()=>{ee&&$e(e=>e+1)};f(()=>{ee&&Ce&&document.activeElement===fe.current&&fe.current?.select()},[ee,Ce,Se]);const Pe=d(!1);f(()=>{if(Ce&&!be)return a(e=>{if("Escape"!==e.key||document.activeElement!==fe.current)return!1;const r=ve.current;if(ae(pe.current)===r)return!1;const t=x(r,g);return pe.current=t,de(t),he.current!==r&&(H??o)(r),Oe(),!0})},[Ce,be,g,o,H]);const Fe=()=>{const e=ae(pe.current);if(null==e){if(!L){const e=x(he.current,g);return pe.current=e,de(e),he.current}return pe.current="",de(""),null!==he.current&&o(null),null}let r=e;const t=g??(I?Math.max(b(j??1),b(i??0)):void 0);I&&(r=function(e,r,t){const n=(e-t)/r;return t+Math.round(n+1e-9*Math.sign(e))*r}(r,j??1,i??0)),null!=i&&r<i&&(r=i),null!=c&&r>c&&(r=c),null!=t&&(r=Number(r.toFixed(t)));const n=x(r,g);return pe.current=n,de(n),r===e&&r===he.current||o(r),r},Re=/* @__PURE__ */m("input",{ref:me,id:R,"data-number-input":"",name:U,type:"text",inputMode:0===g?"numeric":"decimal",value:!Ce&&A?A(n):ue,disabled:D,readOnly:B,placeholder:M,step:j,role:"spinbutton","aria-valuenow":n??void 0,"aria-valuemin":i,"aria-valuemax":c,"aria-valuetext":null==n?M||void 0:`${x(n,g)}${ee&&ie?ie:""}`,"aria-describedby":[X,ne?oe:void 0].filter(Boolean).join(" ")||void 0,"data-appearance":ee?"bare":void 0,...ce,autoComplete:ee?"off":void 0,spellCheck:!ee&&void 0,"aria-invalid":C||void 0,"aria-label":Q,"aria-labelledby":J,onChange:e=>(e=>{if(B)return;const r=k(e,ie,Boolean(re));if(""!==r&&!/^-?\d*[.,]?\d*$/.test(r))return;if(de(e),!G)return;const t=ae(e);(null!==t||L)&&o(t)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!be)return ve.current=Fe(),void Oe();const r=j??1,t=E??10*r,n="ArrowUp"===e.key?e.shiftKey?t:r:"ArrowDown"===e.key?-(e.shiftKey?t:r):"PageUp"===e.key?10*r:"PageDown"===e.key?10*-r:null;null===n||be||(e.preventDefault(),Ee(n))},onFocus:()=>{ve.current=he.current,Me(!0),Pe.current=!0,W?.()},onMouseUp:ee?e=>{Pe.current&&(Pe.current=!1,e.preventDefault())}:void 0,onBlur:()=>{Me(!1),Pe.current=!1,Fe(),K?.()},className:ee?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",Ce?"bg-surface":"bg-transparent",be?"cursor-default":"cursor-text",V].filter(Boolean).join(" "):t({invalid:C,size:S,readOnly:B,auto:ne,className:[$?"pl-[max(var(--space-24),calc(var(--space-control-x-sm)+var(--rosh-number-prefix-width)+var(--space-icon-gap-sm)))]":"",re?"pr-(--rosh-number-suffix-room)":xe?le?"pr-10":"pr-6":ge?le?"pr-24":"pr-16":le?"pr-10":"","text-left tabular-nums",re&&!Ce?"text-ellipsis":"",V].filter(Boolean).join(" ")})}),Ue=ne?/* @__PURE__ */m("span",{id:oe,hidden:!0,children:se.settingView.auto}):null;if(ee||!$&&!le&&!ge)return Ue?/* @__PURE__ */v(h,{children:[Re,Ue]}):Re;const Ve=ae(ue);/* @__PURE__ */
2
- return v("div",{className:"relative","data-number-box":"",style:$||re?{...$?{"--rosh-number-prefix-width":`${we}px`}:{},...re?{"--rosh-number-suffix-room":`max(${je.least}, calc(${je.right} + ${Ne}px))`}:{}}:void 0,children:[$&&/* @__PURE__ */m("span",{ref:ye,className:"pointer-events-none absolute left-(--space-control-x-sm) top-1/2 -translate-y-1/2 whitespace-nowrap text-sm text-ink-faint",children:$}),Re,Ue,re?/* @__PURE__ */m("span",{ref:ke,className:"absolute top-1/2 flex -translate-y-1/2",style:{right:je.right},children:re}):O&&/* @__PURE__ */m("span",{className:`pointer-events-none absolute ${xe?"right-6":ge?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-xs text-ink-faint`,children:O}),ge&&(()=>{const e=/* @__PURE__ */m(N,{dir:-1,compact:xe,label:se.number.decrease,disabled:be||null!=i&&null!=Ve&&Ve<=i,onStep:e=>De.current(-(e?E??10*(j??1):j??1))}),r=/* @__PURE__ */m(N,{dir:1,compact:xe,label:se.number.increase,disabled:be||null!=c&&null!=Ve&&Ve>=c,onStep:e=>De.current(e?E??10*(j??1):j??1)});/* @__PURE__ */
1
+ import{unitBox as e}from"./chunk-TWSROAS7.js";import{useSettingAuto as r}from"./chunk-2NMW66P5.js";import{inputClasses as t}from"./chunk-AYZY3YNC.js";import{IconButton_default as n}from"./chunk-QZYV4TDD.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{useBrowserLayoutEffect as i}from"./chunk-PU2GJVMG.js";import{registerModalEscapeInterceptor as a}from"./chunk-TWVUQUUD.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{forwardRef as c,useId as s,useState as u,useRef as d,useCallback as p,useEffect as f}from"react";import{jsx as m,jsxs as v,Fragment as h}from"react/jsx-runtime";function b(e){const r=String(e),t=/e-(\d+)$/.exec(r);return t?Number(t[1]):r.split(".")[1]?.length??0}function g(e){return 0===b(e)?{precision:0}:{snap:!0}}var x=(e,r)=>null==e?"":null!=r?e.toFixed(r):String(e),y={compact:{right:"var(--space-16)",least:"var(--space-32)"},steppers:{right:"calc(var(--space-40) + var(--space-20))",least:"calc(var(--space-48) * 2)"},plain:{right:"var(--space-8)",least:"var(--space-40)"}};function w(e){const r=d(null),[t,n]=u(0);return i(()=>{const e=r.current;if(!e)return;const t=()=>n(Math.ceil(e.getBoundingClientRect().width));if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[e]),[r,t]}function k(e,r,t){if(!r)return e;const n=e.trimEnd();for(let e=r.length;e>(t?0:r.length-1);e--)if(n.endsWith(r.slice(0,e)))return n.slice(0,-e).trimEnd();return e}function N({dir:e,compact:r,label:t,disabled:i,onStep:a}){const l=d(a);l.current=a;const c=d({}),s=p(()=>{const e=c.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),c.current={}},[]);f(()=>s,[s]),f(()=>{i&&s()},[i,s]);const u=/* @__PURE__ */m(o,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:r?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:r?2.6:2}),v={tabIndex:-1,"aria-label":t,disabled:i,onPointerDown:e=>{if(0!==e.button||i)return;e.preventDefault(),s();const r=e.shiftKey;l.current(r);const t=e.currentTarget.ownerDocument.defaultView??window;t.addEventListener("pointerup",s),c.current={off:()=>t.removeEventListener("pointerup",s),wait:setTimeout(()=>{c.current.every=setInterval(()=>l.current(r),60)},400)}},onPointerLeave:s,onPointerCancel:s,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return r?/* @__PURE__ */m("button",{type:"button",...v,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:u}):/* @__PURE__ */m(n,{size:"sm",...v,children:u})}var j=c(function({value:n,onChange:o,min:i,max:c,precision:g,step:j,shiftStep:D,disabled:E,readOnly:B,invalid:S,placeholder:C,size:O,prefix:$,suffix:M,suffixControl:P,units:R,id:F,name:T,className:U="",onBlur:W,onFocus:K,steppers:V,stepFrom:z,snap:L=!1,allowEmpty:Y=!0,appearance:A="box",display:I,reportWhileTyping:G=!0,onRevert:Q,"aria-label":Z,"aria-labelledby":H,"aria-describedby":J,auto:X,...q},_){const ee="bare"===A,re=P??("string"==typeof M?e(M,R,E||B):void 0),te=r(),ne=X??te,oe=s(),ie="string"==typeof M&&""!==M.trim()?M.trim():void 0,ae=e=>function(e,r,t=!1){let n=k(e.trim(),r,t);if(n=n.replace(",","."),""===n||"-"===n||"."===n||"-."===n)return null;const o=Number(n);return Number.isFinite(o)?o:null}(e,ie,Boolean(re)),le=Boolean(M||re),ce=Object.fromEntries(Object.entries(q).filter(([e])=>e.startsWith("data-"))),se=l(),[ue,de]=u(()=>x(n,g)),pe=d(ue);pe.current=ue;const fe=d(null),me=p(e=>{fe.current=e,"function"==typeof _?_(e):_&&(_.current=e)},[_]),ve=d(n),he=d(n);he.current=n;const be=Boolean(E||B),ge=V??!1,xe="compact"===ge,[ye,we]=w($),[ke,Ne]=w(Boolean(re)),je=xe?y.compact:ge?y.steppers:y.plain;f(()=>{ae(pe.current)!==n&&de(x(n,g))},[n,g]);const De=e=>{if(be)return;let r=(ae(pe.current)??z??(C?ae(C):null)??0)+e;null!=i&&r<i&&(r=i),null!=c&&r>c&&(r=c);const t=g??String(j??1).split(".")[1]?.length??0;r=Number(r.toFixed(t));const n=x(r,g);pe.current=n,de(n),o(r),Me()},Ee=d(De);Ee.current=De;const Be=d({unit:j??1,big:D??10*(j??1),locked:be});Be.current={unit:j??1,big:D??10*(j??1),locked:be},f(()=>{const e=fe.current;if(!e)return;const r=r=>{const{unit:t,big:n,locked:o}=Be.current;if(o||e.ownerDocument.activeElement!==e)return;const i=r.deltaY||r.deltaX;i&&(r.preventDefault(),Ee.current((i<0?1:-1)*(r.shiftKey?n:t)))};return e.addEventListener("wheel",r,{passive:!1}),()=>e.removeEventListener("wheel",r)},[]);const[Se,Ce]=u(!1),[Oe,$e]=u(0),Me=()=>{ee&&$e(e=>e+1)};f(()=>{ee&&Se&&document.activeElement===fe.current&&fe.current?.select()},[ee,Se,Oe]);const Pe=d(!1);f(()=>{if(Se&&!be)return a(e=>{if("Escape"!==e.key||document.activeElement!==fe.current)return!1;const r=ve.current;if(ae(pe.current)===r)return!1;const t=x(r,g);return pe.current=t,de(t),he.current!==r&&(Q??o)(r),Me(),!0})},[Se,be,g,o,Q]);const Re=()=>{const e=ae(pe.current);if(null==e){if(!Y){const e=x(he.current,g);return pe.current=e,de(e),he.current}return pe.current="",de(""),null!==he.current&&o(null),null}let r=e;const t=g??(L?Math.max(b(j??1),b(i??0)):void 0);L&&(r=function(e,r,t){const n=(e-t)/r;return t+Math.round(n+1e-9*Math.sign(e))*r}(r,j??1,i??0)),null!=i&&r<i&&(r=i),null!=c&&r>c&&(r=c),null!=t&&(r=Number(r.toFixed(t)));const n=x(r,g);return pe.current=n,de(n),r===e&&r===he.current||o(r),r},Fe=/* @__PURE__ */m("input",{ref:me,id:F,"data-number-input":"",name:T,type:"text",inputMode:0===g?"numeric":"decimal",value:!Se&&I?I(n):ue,disabled:E,readOnly:B,placeholder:C,step:j,role:"spinbutton","aria-valuenow":n??void 0,"aria-valuemin":i,"aria-valuemax":c,"aria-valuetext":null==n?C||void 0:`${x(n,g)}${ee&&ie?ie:""}`,"aria-describedby":[J,ne?oe:void 0].filter(Boolean).join(" ")||void 0,"data-appearance":ee?"bare":void 0,...ce,autoComplete:ee?"off":void 0,spellCheck:!ee&&void 0,"aria-invalid":S||void 0,"aria-label":Z,"aria-labelledby":H,onChange:e=>(e=>{if(B)return;const r=k(e,ie,Boolean(re));if(""!==r&&!/^-?\d*[.,]?\d*$/.test(r))return;if(de(e),!G)return;const t=ae(e);(null!==t||Y)&&o(t)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!be)return ve.current=Re(),void Me();const r=j??1,t=D??10*r,n="ArrowUp"===e.key?e.shiftKey?t:r:"ArrowDown"===e.key?-(e.shiftKey?t:r):"PageUp"===e.key?10*r:"PageDown"===e.key?10*-r:null;null===n||be||(e.preventDefault(),De(n))},onFocus:()=>{ve.current=he.current,Ce(!0),Pe.current=!0,K?.()},onMouseUp:ee?e=>{Pe.current&&(Pe.current=!1,e.preventDefault())}:void 0,onBlur:()=>{Ce(!1),Pe.current=!1,Re(),W?.()},className:ee?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",Se?"bg-surface":"bg-transparent",be?"cursor-default":"cursor-text",U].filter(Boolean).join(" "):t({invalid:S,size:O,readOnly:B,auto:ne,className:[$?"pl-[max(var(--space-24),calc(var(--space-control-x-sm)+var(--rosh-number-prefix-width)+var(--space-icon-gap-sm)))]":"",re?"pr-(--rosh-number-suffix-room)":xe?le?"pr-10":"pr-6":ge?le?"pr-24":"pr-16":le?"pr-10":"","text-left tabular-nums",re&&!Se?"text-ellipsis":"",U].filter(Boolean).join(" ")})}),Te=ne?/* @__PURE__ */m("span",{id:oe,hidden:!0,children:se.settingView.auto}):null;if(ee||!$&&!le&&!ge)return Te?/* @__PURE__ */v(h,{children:[Fe,Te]}):Fe;const Ue=ae(ue);/* @__PURE__ */
2
+ return v("div",{className:"relative","data-number-box":"",style:$||re?{...$?{"--rosh-number-prefix-width":`${we}px`}:{},...re?{"--rosh-number-suffix-room":`max(${je.least}, calc(${je.right} + ${Ne}px))`}:{}}:void 0,children:[$&&/* @__PURE__ */m("span",{ref:ye,className:"pointer-events-none absolute left-(--space-control-x-sm) top-1/2 -translate-y-1/2 whitespace-nowrap text-sm text-ink-faint",children:$}),Fe,Te,re?/* @__PURE__ */m("span",{ref:ke,className:"absolute top-1/2 flex -translate-y-1/2",style:{right:je.right},children:re}):M&&/* @__PURE__ */m("span",{className:`pointer-events-none absolute ${xe?"right-6":ge?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-xs text-ink-faint`,children:M}),ge&&(()=>{const e=/* @__PURE__ */m(N,{dir:-1,compact:xe,label:se.number.decrease,disabled:be||null!=i&&null!=Ue&&Ue<=i,onStep:e=>Ee.current(-(e?D??10*(j??1):j??1))}),r=/* @__PURE__ */m(N,{dir:1,compact:xe,label:se.number.increase,disabled:be||null!=c&&null!=Ue&&Ue>=c,onStep:e=>Ee.current(e?D??10*(j??1):j??1)});/* @__PURE__ */
3
3
  return v("span",xe?{"data-steppers":"compact",className:"absolute inset-y-px right-px flex w-4 flex-col overflow-hidden rounded-r-(--radius-control)",children:[r,e]}:{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5",children:[e,r]})})()]})});export{j as InputNumber_default,g as stepRounding};
@@ -0,0 +1,9 @@
1
+ import{Calendar as e}from"./chunk-PPHGBEJA.js";import{inputClasses as r,PLACEHOLDER_INK as t}from"./chunk-AYZY3YNC.js";import{calendarNames as a,userToday as n}from"./chunk-NHKT5IH6.js";import{fromDateKey as i,toDateKey as o}from"./chunk-JRQMX4PK.js";import{Icon as l}from"./chunk-ISVODSRP.js";import{onOverlayOpen as s}from"./chunk-PGN5ME7B.js";import{createShellPortal as d}from"./chunk-52YTUQW3.js";import{Z_LAYERS as u}from"./chunk-62LW225J.js";import{useDropdownPosition as c}from"./chunk-TAHHZGRH.js";import{useBrowserLayoutEffect as m}from"./chunk-PU2GJVMG.js";import{registerModalEscapeInterceptor as p}from"./chunk-TWVUQUUD.js";import{useShellStrings as f,useShellLocale as b}from"./chunk-NRHG4R2Q.js";import{forwardRef as h,useState as v,useRef as g,useId as y,useEffect as x}from"react";import{jsx as N,jsxs as k}from"react/jsx-runtime";var j=/^\d{4}-\d{2}-\d{2}$/,w=/^(aria|data)-/,D=/* @__PURE__ */new Set(["aria-invalid","aria-required"]);function F(e){if(null==e||""===e)return"";if(e instanceof Date)return Number.isNaN(e.getTime())?"":o(e);if(j.test(e))return e;const r=new Date(e);return Number.isNaN(r.getTime())?"":o(r)}function H(e,r){const t=i(e);return t?r.longDate(t.getFullYear(),t.getMonth(),t.getDate()):""}var P=h(function({value:o,onChange:h,min:j,max:P,invalid:$,size:B,native:C,weekStartsOn:E,className:G="","aria-label":I,"aria-describedby":R,"aria-labelledby":S,id:T,name:W,disabled:q,placeholder:O,required:U,clearable:Y,form:z,title:J,tabIndex:M,autoFocus:Q,onFocus:A,onBlur:L,formatDisplay:V,...K},Z){const X=Y??!U,_=F(o),ee=F(j),re=F(P),te=f().datePicker,ae=b(),ne=a(ae),[ie,oe]=v(!1),le=g(null),se=g(null),de=g(null),ue=y(),ce=y(),me=y(),pe=c(se,ie,{popupRef:de}),[fe,be]=v(!1);m(()=>{const e=!!T&&(se.current?.labels?.length??0)>0;e!==fe&&be(e)});const he=!I&&(!!S||fe);if(x(()=>{if(!ie)return;const e=e=>{const r=e.target;le.current?.contains(r)||de.current?.contains(r)||oe(!1)};document.addEventListener("pointerdown",e,!0);const r=s(()=>oe(!1));return()=>{document.removeEventListener("pointerdown",e,!0),r()}},[ie]),x(()=>{if(ie)return p(e=>"Escape"===e.key&&(oe(!1),se.current?.focus(),!0),()=>de.current)},[ie]),C)/* @__PURE__ */
2
+ return N("input",{ref:Z,type:"date",lang:ae,id:T,name:W,disabled:q,"aria-label":I,"aria-describedby":R,"aria-invalid":$||void 0,value:_,min:ee||void 0,max:re||void 0,onChange:e=>h?.(i(e.target.value)),className:r({invalid:$,size:B,className:G}),"aria-labelledby":S,required:U,form:z,title:J,tabIndex:M,autoFocus:Q,onFocus:A,onBlur:L,...K});const ve=Object.fromEntries(Object.entries(K).filter(([e])=>w.test(e)&&!D.has(e))),ge=K["aria-required"],ye=!!U||!0===ge||"true"===ge,xe=[he?ce:void 0,ye?me:void 0,R].filter(Boolean).join(" ")||void 0,Ne=n(),ke=!!Ne&&(!ee||Ne>=ee)&&(!re||Ne<=re),je=O??te.placeholder;/* @__PURE__ */
3
+ return k("div",{ref:le,className:"relative",children:[
4
+ /* @__PURE__ */N("input",{ref:Z,type:"hidden",name:W,form:z,value:_}),
5
+ /* @__PURE__ */k("button",{ref:se,type:"button",...ve,id:T,disabled:q,title:J,tabIndex:M,autoFocus:Q,onFocus:A,onBlur:L,"aria-haspopup":"dialog","aria-expanded":ie,"aria-controls":ie?ue:void 0,"aria-labelledby":S,"aria-describedby":xe,"aria-label":I?`${I}${_?`, ${H(_,ne)}`:""}`:void 0,onClick:()=>oe(e=>!e),className:`${r({invalid:$,size:B,className:G})} flex items-center justify-between gap-2 text-left`,children:[
6
+ /* @__PURE__ */N("span",{className:`min-w-0 truncate whitespace-nowrap ${_?"text-ink-strongest":t}`,children:_?V?V(_):H(_,ne):je}),
7
+ /* @__PURE__ */N(l,{name:"date",className:`h-4 w-4 shrink-0 ${t}`,strokeWidth:"1.75","aria-hidden":"true"})]}),he&&/* @__PURE__ */N("span",{id:ce,className:"sr-only",children:_?H(_,ne):je}),ye&&/* @__PURE__ */N("span",{id:me,className:"sr-only",children:te.required}),ie&&d(
8
+ /* @__PURE__ */k("div",{ref:de,id:ue,role:"dialog","aria-label":I??te.dialog,className:"fixed w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-lg",style:{zIndex:u.popup,left:pe?.left,right:pe?.right,top:pe?.top,bottom:pe?.bottom,maxWidth:pe?.maxWidth,visibility:pe?void 0:"hidden"},children:[
9
+ /* @__PURE__ */N(e,{value:_||null,min:ee||null,max:re||null,weekStartsOn:E,onSelect:e=>{oe(!1),se.current?.focus(),h?.(i(e))}}),(X||ke)&&/* @__PURE__ */k("div",{className:"mt-2 flex justify-between border-t border-gray-100 pt-2",children:[X&&/* @__PURE__ */N("button",{type:"button",onClick:()=>{oe(!1),se.current?.focus(),h?.(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}),ke&&/* @__PURE__ */N("button",{type:"button",onClick:()=>{oe(!1),se.current?.focus(),h?.(i(Ne))},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{P as DatePicker_default};
@@ -1,11 +1,11 @@
1
- import{ImageFocusPoint as e}from"./chunk-CUJ537IY.js";import{FormField as i}from"./chunk-6KBDNYRW.js";import{Segmented as a}from"./chunk-ALZHFQRX.js";import{isVideoUrl as t,mediaPromptLine as r,mediaFileName as o,FilenameBadge as n,BusyOverlay as s,UploadGlyph as l,zoneFocusClass as c,dropzoneClass as d}from"./chunk-MPC3CHAO.js";import{TransferProgress as u}from"./chunk-ION3XGLN.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-TNGIXSTM.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{useShellStrings as b}from"./chunk-NRHG4R2Q.js";import{useState as f,useRef as g,useEffect as v,useId as y}from"react";import{jsxs as k,jsx as x,Fragment as N}from"react/jsx-runtime";var j=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:R,onFile:C,label:$,hint:F,error:U,required:z,className:O,accept:P="image/*",maxSizeBytes:H,fit:I="cover",height:S,shape:q="rect",placeholder:A,cta:B,acceptHint:G,showFilename:X=!0,allowReplace:D=!0,allowRemove:K=!0,replaceLabel:M,removeLabel:Q,busy:T=!1,busyLabel:V,choosingLabel:W,pickFailedLabel:Y,progress:_,disabled:J=!1,kind:Z,onKindChange:E,focus:ee,onFocusChange:ie,focusLabel:ae}){const te=b().media,re="circle"===q,oe=S??(re?96:112),ne=B??te.cta,se=Z??(/video/.test(P)&&!/image/.test(P)?"video":"image"),le="string"==typeof Q&&Q?Q:te.remove,[ce,de]=f(!1),[ue,me]=f(!1),he=g(!0);v(()=>()=>{he.current=!1},[]);const pe=T||ce,be=ce&&!T?W??te.choosing:V??te.uploading,fe=U??(ue?Y??te.pickFailed:void 0),ge=e=>{if(!R)return;me(!1);const i=R(e);i&&"function"==typeof i.then&&(de(!0),i.then(e=>{he.current&&(de(!1),"string"==typeof e&&e&&L(e))},()=>{he.current&&(de(!1),me(!0))}))},ve=y(),ye=g(null),[ke,xe]=f(null);v(()=>()=>{ye.current&&URL.revokeObjectURL(ye.current)},[]);const Ne=J||pe,je=!!w&&(t(w,P)||w===ke),we=A??r(P,te),Le=M??(je||"video"===se?te.changeVideo:te.changeImage),Re=e=>{R?ge(e):C?C(e):(e=>{ye.current&&URL.revokeObjectURL(ye.current);const i=URL.createObjectURL(e);ye.current=i,xe(e.type.startsWith("video/")?i:null),L(i)})(e)},Ce=m({accept:P,maxSizeBytes:H,acceptHint:G,multiple:!1,disabled:Ne,onAccept:([e])=>Re(e)}),{dragOver:$e}=Ce,Fe=()=>{Ne||(R?ge():Ce.open())},Ue=w?o(w):"",ze=!re&&!je&&!!ie,Oe=J||!D&&!K?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:[re?"absolute inset-0 flex items-center justify-center gap-1 p-1 text-(--status-on-solid)":"absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[D&&/* @__PURE__ */k("button",{id:ze?void 0:ve,type:"button","aria-labelledby":`${ve}-change`,onClick:()=>Fe(),disabled:pe,className:re?`w-8 shrink-0 ${j}`:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${j}`,children:[
1
+ import{ImageFocusPoint as e}from"./chunk-CUJ537IY.js";import{FormField as i}from"./chunk-6KBDNYRW.js";import{Segmented as a}from"./chunk-NTVACRKD.js";import{isVideoUrl as t,mediaPromptLine as r,mediaFileName as o,FilenameBadge as n,BusyOverlay as s,UploadGlyph as l,zoneFocusClass as c,dropzoneClass as d}from"./chunk-4H4HJIWI.js";import{TransferProgress as u}from"./chunk-JE4BGFDJ.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-TNGIXSTM.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{useShellStrings as b}from"./chunk-NRHG4R2Q.js";import{useState as f,useRef as g,useEffect as v,useId as y}from"react";import{jsxs as k,jsx as x,Fragment as N}from"react/jsx-runtime";var j=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:R,onPick:L,onFile:C,label:$,hint:F,error:U,required:z,className:I,accept:P="image/*",maxSizeBytes:H,fit:O="cover",height:S,shape:q="rect",placeholder:B,cta:D,acceptHint:J,showFilename:G=!0,allowReplace:K=!0,allowRemove:T=!0,replaceLabel:V,removeLabel:W,busy:A=!1,busyLabel:Y,choosingLabel:_,pickFailedLabel:E,progress:M,disabled:Q=!1,kind:X,onKindChange:Z,focus:ee,onFocusChange:ie,focusLabel:ae}){const te=b().media,re="circle"===q,oe=S??(re?96:112),ne=D??te.cta,se=X??(/video/.test(P)&&!/image/.test(P)?"video":"image"),le="string"==typeof W&&W?W:te.remove,[ce,de]=f(!1),[ue,me]=f(!1),he=g(!0);v(()=>()=>{he.current=!1},[]);const pe=A||ce,be=ce&&!A?_??te.choosing:Y??te.uploading,fe=U??(ue?E??te.pickFailed:void 0),ge=e=>{if(!L)return;me(!1);const i=L(e);i&&"function"==typeof i.then&&(de(!0),i.then(e=>{he.current&&(de(!1),"string"==typeof e&&e&&R(e))},()=>{he.current&&(de(!1),me(!0))}))},ve=y(),ye=g(null),[ke,xe]=f(null);v(()=>()=>{ye.current&&URL.revokeObjectURL(ye.current)},[]);const Ne=Q||pe,je=!!w&&(t(w,P)||w===ke),we=B??r(P,te),Re=V??(je||"video"===se?te.changeVideo:te.changeImage),Le=e=>{L?ge(e):C?C(e):(e=>{ye.current&&URL.revokeObjectURL(ye.current);const i=URL.createObjectURL(e);ye.current=i,xe(e.type.startsWith("video/")?i:null),R(i)})(e)},Ce=m({accept:P,maxSizeBytes:H,acceptHint:J,multiple:!1,disabled:Ne,onAccept:([e])=>Le(e)}),{dragOver:$e}=Ce,Fe=()=>{Ne||(L?ge():Ce.open())},Ue=w?o(w):"",ze=!re&&!je&&!!ie,Ie=Q||!K&&!T?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:[re?"absolute inset-0 flex items-center justify-center gap-1 p-1 text-(--status-on-solid)":"absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[K&&/* @__PURE__ */k("button",{id:ze?void 0:ve,type:"button","aria-labelledby":`${ve}-change`,onClick:()=>Fe(),disabled:pe,className:re?`w-8 shrink-0 ${j}`:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${j}`,children:[
2
2
  /* @__PURE__ */x(p,{name:"swap","aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
3
- /* @__PURE__ */x("span",{id:`${ve}-change`,className:re?"sr-only":"truncate",children:Le})]}),K&&/* @__PURE__ */x("button",{type:"button","aria-label":le,onClick:()=>{ye.current&&(URL.revokeObjectURL(ye.current),ye.current=null),xe(null),L("")},disabled:pe,className:`${re?"":"ml-auto "}w-8 shrink-0 ${j}`,children:/* @__PURE__ */x(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Pe=/* @__PURE__ */k("div",{...Ce.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden border transition-colors",re?"shrink-0 rounded-full":"rounded-(--radius-control)",ze?"":"bg-gray-100",$e?"border-blue-500":"border-line"].join(" "),style:ze?void 0:re?{height:oe,width:oe}:{height:oe},children:[ze?
4
- /* @__PURE__ */x(e,{value:ee??"",onChange:e=>ie?.(e),label:ae??te.focus,image:w,hint:null,id:ve,disabled:Ne,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):je?/* @__PURE__ */x("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Ue||void 0,className:"h-full w-full",style:{objectFit:I}}):/* @__PURE__ */x("img",{src:w??void 0,alt:Ue,className:"h-full w-full",style:{objectFit:I,objectPosition:ee||void 0}}),X&&!re&&w&&/* @__PURE__ */x(n,{children:Ue}),Oe,pe&&/* @__PURE__ */x(s,{label:be,progress:_,rounded:re?"rounded-full":"rounded-md"})]}),He=/* @__PURE__ */k(N,{children:[
3
+ /* @__PURE__ */x("span",{id:`${ve}-change`,className:re?"sr-only":"truncate",children:Re})]}),T&&/* @__PURE__ */x("button",{type:"button","aria-label":le,onClick:()=>{ye.current&&(URL.revokeObjectURL(ye.current),ye.current=null),xe(null),R("")},disabled:pe,className:`${re?"":"ml-auto "}w-8 shrink-0 ${j}`,children:/* @__PURE__ */x(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Pe=/* @__PURE__ */k("div",{...Ce.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden border transition-colors",re?"shrink-0 rounded-full":"rounded-(--radius-control)",ze?"":"bg-gray-100",$e?"border-blue-500":"border-line"].join(" "),style:ze?void 0:re?{height:oe,width:oe}:{height:oe},children:[ze?
4
+ /* @__PURE__ */x(e,{value:ee??"",onChange:e=>ie?.(e),label:ae??te.focus,image:w,hint:null,id:ve,disabled:Ne,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):je?/* @__PURE__ */x("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Ue||void 0,className:"h-full w-full",style:{objectFit:O}}):/* @__PURE__ */x("img",{src:w??void 0,alt:Ue,className:"h-full w-full",style:{objectFit:O,objectPosition:ee||void 0}}),G&&!re&&w&&/* @__PURE__ */x(n,{children:Ue}),Ie,pe&&/* @__PURE__ */x(s,{label:be,progress:M,rounded:re?"rounded-full":"rounded-md"})]}),He=/* @__PURE__ */k(N,{children:[
5
5
  /* @__PURE__ */x("span",{className:"px-3 text-xs text-ink-faint",children:we}),
6
- /* @__PURE__ */x("span",{className:"text-sm font-medium text-blue-600",children:ne}),G&&/* @__PURE__ */x("span",{className:"text-xs text-ink-faintest",children:G})]}),Ie=/* @__PURE__ */k("button",{type:"button",id:ve,onClick:()=>Fe(),disabled:Ne,"aria-label":"string"==typeof we?we:te.upload,"aria-busy":pe||void 0,"aria-invalid":!!fe||void 0,"aria-required":z||void 0,"aria-describedby":fe?`${ve}-error`:F?`${ve}-hint`:void 0,...Ce.zoneProps,"data-media-circle":"",className:["group/zone flex w-full items-center gap-4 rounded-lg text-left",Ne?"cursor-not-allowed opacity-60":"cursor-pointer",c(Ne)].join(" "),children:[
6
+ /* @__PURE__ */x("span",{className:"text-sm font-medium text-blue-600",children:ne}),J&&/* @__PURE__ */x("span",{className:"text-xs text-ink-faintest",children:J})]}),Oe=/* @__PURE__ */k("button",{type:"button",id:ve,onClick:()=>Fe(),disabled:Ne,"aria-label":"string"==typeof we?we:te.upload,"aria-busy":pe||void 0,"aria-invalid":!!fe||void 0,"aria-required":z||void 0,"aria-describedby":fe?`${ve}-error`:F?`${ve}-hint`:void 0,...Ce.zoneProps,"data-media-circle":"",className:["group/zone flex w-full items-center gap-4 rounded-lg text-left",Ne?"cursor-not-allowed opacity-60":"cursor-pointer",c(Ne)].join(" "),children:[
7
7
  /* @__PURE__ */x("span",{className:["flex shrink-0 items-center justify-center rounded-full border-2 border-dashed text-ink-faintest transition-colors",$e?"border-accent-fill bg-accent-tint":"border-line-strong bg-surface-sunken group-hover/zone:bg-accent-tint"].join(" "),style:{height:oe,width:oe},children:/* @__PURE__ */x(l,{})}),
8
- /* @__PURE__ */x("span",{className:"flex min-w-0 flex-col items-start gap-1 [&>span]:px-0",children:pe?/* @__PURE__ */x(u,{state:"busy",verb:be,pct:_}):He})]}),Se=re?Ie:/* @__PURE__ */x("button",{type:"button",id:ve,onClick:()=>Fe(),disabled:Ne,"aria-label":"string"==typeof we?we:te.upload,"aria-busy":pe||void 0,"aria-invalid":!!fe||void 0,"aria-required":z||void 0,"aria-describedby":fe?`${ve}-error`:F?`${ve}-hint`:void 0,...Ce.zoneProps,className:d($e,Ne,c(Ne)),style:{minHeight:oe},children:pe?/* @__PURE__ */x(u,{state:"busy",verb:be,pct:_}):/* @__PURE__ */k(N,{children:[
8
+ /* @__PURE__ */x("span",{className:"flex min-w-0 flex-col items-start gap-1 [&>span]:px-0",children:pe?/* @__PURE__ */x(u,{state:"busy",verb:be,pct:M}):He})]}),Se=re?Oe:/* @__PURE__ */x("button",{type:"button",id:ve,onClick:()=>Fe(),disabled:Ne,"aria-label":"string"==typeof we?we:te.upload,"aria-busy":pe||void 0,"aria-invalid":!!fe||void 0,"aria-required":z||void 0,"aria-describedby":fe?`${ve}-error`:F?`${ve}-hint`:void 0,...Ce.zoneProps,className:d($e,Ne,c(Ne)),style:{minHeight:oe},children:pe?/* @__PURE__ */x(u,{state:"busy",verb:be,pct:M}):/* @__PURE__ */k(N,{children:[
9
9
  /* @__PURE__ */x("span",{className:"text-ink-faintest",children:/* @__PURE__ */x(l,{})}),He]})});/* @__PURE__ */
10
- return k(i,{label:$,htmlFor:ve,hint:F,error:fe,required:z,className:O,children:[E&&/* @__PURE__ */x("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */x(a,{value:se,onChange:e=>E(e),options:[{value:"image",label:te.image,icon:/* @__PURE__ */x(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne},{value:"video",label:te.video,icon:/* @__PURE__ */x(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne}],block:!0,size:"md",label:"string"==typeof $&&$?$:te.upload})}),w?Pe:Se,!R&&/* @__PURE__ */x("input",{...Ce.inputProps}),
10
+ return k(i,{label:$,htmlFor:ve,hint:F,error:fe,required:z,className:I,children:[Z&&/* @__PURE__ */x("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */x(a,{value:se,onChange:e=>Z(e),options:[{value:"image",label:te.image,icon:/* @__PURE__ */x(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne},{value:"video",label:te.video,icon:/* @__PURE__ */x(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne}],block:!0,size:"md",label:"string"==typeof $&&$?$:te.upload})}),w?Pe:Se,!L&&/* @__PURE__ */x("input",{...Ce.inputProps}),
11
11
  /* @__PURE__ */x(h,{rejections:Ce.rejections})]})}export{w as MediaUploadField};
@@ -1,20 +1,20 @@
1
- import{Checkbox_default as e}from"./chunk-CGZBDI6C.js";import{Pagination as t}from"./chunk-Q2RNFBYS.js";import{SpinnerRing as r}from"./chunk-R2VKEMZH.js";import{TH_ONE_LINE as o,OneLineLabel as n}from"./chunk-G3TC2GIA.js";import{useBrowserLayoutEffect as l}from"./chunk-PU2GJVMG.js";import{useShellStrings as s}from"./chunk-NRHG4R2Q.js";import{useState as i,useRef as a}from"react";import{jsxs as c,Fragment as d,jsx as h}from"react/jsx-runtime";function u(e){const t={};if(!e)return t;for(const[r,o]of Object.entries(e))!r.startsWith("data-")||"string"!=typeof o&&"number"!=typeof o&&"boolean"!=typeof o||(t[r]=o);return t}var m=e=>Array.isArray(e.columns),f=e=>"wide"===e.only?"rosh-dt-only-wide":"stacked"===e.only?"rosh-dt-only-stacked":"",g="rosh-dt-row-link rosh-focus-ring underline-offset-4 hover:underline",p={sm:"px-2 py-2",md:"px-3 py-2"},y={left:"text-left",right:"text-right",center:"text-center"};function b({direction:e}){/* @__PURE__ */
1
+ import{Checkbox_default as e}from"./chunk-CGZBDI6C.js";import{Pagination as t}from"./chunk-Q2RNFBYS.js";import{SpinnerRing as r}from"./chunk-R2VKEMZH.js";import{TH_ONE_LINE as o,OneLineLabel as n}from"./chunk-7FYTL6SD.js";import{useBrowserLayoutEffect as l}from"./chunk-PU2GJVMG.js";import{useShellStrings as s}from"./chunk-NRHG4R2Q.js";import{useState as i,useRef as a}from"react";import{jsxs as c,Fragment as d,jsx as h}from"react/jsx-runtime";function u(e){const t={};if(!e)return t;for(const[r,o]of Object.entries(e))!r.startsWith("data-")||"string"!=typeof o&&"number"!=typeof o&&"boolean"!=typeof o||(t[r]=o);return t}var m=e=>Array.isArray(e.columns),f=e=>"wide"===e.only?"rosh-dt-only-wide":"stacked"===e.only?"rosh-dt-only-stacked":"",g="rosh-dt-row-link rosh-focus-ring underline-offset-4 hover:underline",p={sm:"px-2 py-2",md:"px-3 py-2"},y={left:"text-left",right:"text-right",center:"text-center"};function b({direction:e}){/* @__PURE__ */
2
2
  return c("span",{className:"ml-1 inline-flex flex-col leading-none","aria-hidden":"true",children:[
3
3
  /* @__PURE__ */h("svg",{className:"h-2 w-2 "+("asc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */h("path",{d:"M4 0L8 5H0z"})}),
4
- /* @__PURE__ */h("svg",{className:"h-2 w-2 "+("desc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */h("path",{d:"M4 5L0 0h8z"})})]})}function w(e,t=!1){const r=t?"":" whitespace-nowrap";return e.code?`font-mono${r}`:e.numeric?`tabular-nums${r}`:""}function x({columns:x,data:v,rowKey:k,sort:N=null,onSortChange:C,pagination:j,caption:M,loading:B=!1,bordered:S=!1,size:$="md",minWidth:z,rowClassName:H,onRow:I,rowHref:R,onRowPress:T,linkAs:G,emptyText:A,selection:F,footer:P,virtualized:E,stackOnNarrow:L=!1,stackBelow:O,className:D=""}){const K=s(),W=A??K.table.empty,Q=(e,t)=>"function"==typeof k?k(e,t):String(e[k]),V=L&&!E,Z=V?x:x.flatMap(e=>{if(!m(e))return"stacked"===e.only?[]:[e];const t=e.columns.filter(e=>"stacked"!==e.only);return t.length?[{...e,columns:t}]:[]}),J=e=>V?{role:e}:{},U=(e,t)=>(t??("string"==typeof e||"number"==typeof e?String(e):"")).trim()||void 0,[Y,q]=i(0),X=E?.overscan??6,_=E?e=>{const t=Math.max(0,Math.floor(e.currentTarget.scrollTop/E.rowHeight)-X);q(e=>e===t?e:t)}:void 0,ee=E?Math.ceil(E.height/E.rowHeight)+2*X:v.length,te=E?Math.min(Y,Math.max(0,v.length-ee)):0,re=Math.min(v.length,te+ee),oe=E?te*E.rowHeight:0,ne=E?(v.length-re)*E.rowHeight:0,le=a(null),[se,ie]=i(0);l(()=>{if(!E)return;const e=le.current?.offsetHeight??0;ie(t=>t===e?t:e)});const ae=e=>e.sortField??e.key,ce=e=>N&&N.field===ae(e)?N.direction:null,de=Z.flatMap(e=>m(e)?e.columns:[e]),he=Z.some(m),ue=/* @__PURE__ */new Map;if(V)for(const e of Z)if(m(e))for(const t of e.columns)ue.set(t,U(e.title,e.label));const me=e=>{const t=U(e.title,e.label),r=ue.get(e);return t&&r?`${r} · ${t}`:t},fe=new Set(F?.selected??[]),ge=F?v.map((e,t)=>Q(e,t)):[],pe=ge.length>0&&ge.every(e=>fe.has(e)),ye=ge.some(e=>fe.has(e)),be=F?36:0,we=de.length+(F?1:0),xe=de.some(e=>"left"===e.fixed),ve=V&&!F&&de.some(e=>e.cardCorner),ke=G??"a",Ne=`${p[$]} ${"sm"===$?"text-xs":"text-sm"}`,Ce=(e,t)=>e.ellipsis?/* @__PURE__ */h("span",{className:"block w-0 min-w-full",children:t}):t,je=(e,t,r,l=0)=>{const s=ce(e),i=y[e.align??(e.numeric?"right":"left")],a="left"===e.fixed,d=!(!e.sortable||!C);/* @__PURE__ */
5
- return h("th",{scope:"col",...J("columnheader"),rowSpan:r>1?r:void 0,"aria-sort":"asc"===s?"ascending":"desc"===s?"descending":d?"none":void 0,style:{width:e.width,...a?{left:(Be[t]??0)+be}:{},...E?{top:l}:{}},className:[Ne,i,o,"font-semibold uppercase tracking-wide text-gray-500","sm"===$?"text-2xs":"text-xs",a?E?"sticky z-20 bg-gray-50":"sticky z-10 bg-gray-50":E?"sticky z-10 bg-gray-50":"",V&&d?"rosh-dt-sort":"",V?f(e):"",e.headerClassName??""].filter(Boolean).join(" "),children:Ce(e,d?/* @__PURE__ */c("button",{type:"button",onClick:()=>(e=>{if(!C)return;const t=ae(e),r=ce(e),o=e.sortFirst??"asc";C(null===r?{field:t,direction:o}:r===o?{field:t,direction:"asc"===o?"desc":"asc"}:null)})(e),"data-group":V?ue.get(e):void 0,className:`inline-flex max-w-full items-center font-semibold uppercase tracking-wide hover:text-ink ${i}`,children:[
4
+ /* @__PURE__ */h("svg",{className:"h-2 w-2 "+("desc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */h("path",{d:"M4 5L0 0h8z"})})]})}function w(e,t=!1){const r=t?"":" whitespace-nowrap";return e.code?`font-mono${r}`:e.numeric?`tabular-nums${r}`:""}function x({columns:x,data:v,rowKey:k,sort:N=null,onSortChange:C,pagination:j,caption:M,loading:B=!1,bordered:S=!1,size:$="md",minWidth:z,rowClassName:H,onRow:R,rowHref:T,onRowPress:F,linkAs:I,emptyText:L,selection:P,footer:A,virtualized:D,stackOnNarrow:E=!1,stackBelow:G,className:O=""}){const K=s(),W=L??K.table.empty,Q=(e,t)=>"function"==typeof k?k(e,t):String(e[k]),V=E&&!D,Y=V?x:x.flatMap(e=>{if(!m(e))return"stacked"===e.only?[]:[e];const t=e.columns.filter(e=>"stacked"!==e.only);return t.length?[{...e,columns:t}]:[]}),Z=e=>V?{role:e}:{},J=(e,t)=>(t??("string"==typeof e||"number"==typeof e?String(e):"")).trim()||void 0,[U,q]=i(0),X=D?.overscan??6,_=D?e=>{const t=Math.max(0,Math.floor(e.currentTarget.scrollTop/D.rowHeight)-X);q(e=>e===t?e:t)}:void 0,ee=D?Math.ceil(D.height/D.rowHeight)+2*X:v.length,te=D?Math.min(U,Math.max(0,v.length-ee)):0,re=Math.min(v.length,te+ee),oe=D?te*D.rowHeight:0,ne=D?(v.length-re)*D.rowHeight:0,le=a(null),[se,ie]=i(0);l(()=>{if(!D)return;const e=le.current?.offsetHeight??0;ie(t=>t===e?t:e)});const ae=e=>e.sortField??e.key,ce=e=>N&&N.field===ae(e)?N.direction:null,de=Y.flatMap(e=>m(e)?e.columns:[e]),he=Y.some(m),ue=/* @__PURE__ */new Map;if(V)for(const e of Y)if(m(e))for(const t of e.columns)ue.set(t,J(e.title,e.label));const me=e=>{const t=J(e.title,e.label),r=ue.get(e);return t&&r?`${r} · ${t}`:t},fe=new Set(P?.selected??[]),ge=P?v.map((e,t)=>Q(e,t)):[],pe=ge.length>0&&ge.every(e=>fe.has(e)),ye=ge.some(e=>fe.has(e)),be=P?36:0,we=de.length+(P?1:0),xe=de.some(e=>"left"===e.fixed),ve=V&&!P&&de.some(e=>e.cardCorner),ke=I??"a",Ne=`${p[$]} ${"sm"===$?"text-xs":"text-sm"}`,Ce=(e,t)=>e.ellipsis?/* @__PURE__ */h("span",{className:"block w-0 min-w-full",children:t}):t,je=(e,t,r,l=0)=>{const s=ce(e),i=y[e.align??(e.numeric?"right":"left")],a="left"===e.fixed,d=!(!e.sortable||!C);/* @__PURE__ */
5
+ return h("th",{scope:"col",...Z("columnheader"),rowSpan:r>1?r:void 0,"aria-sort":"asc"===s?"ascending":"desc"===s?"descending":d?"none":void 0,style:{width:e.width,...a?{left:(Be[t]??0)+be}:{},...D?{top:l}:{}},className:[Ne,i,o,"font-semibold uppercase tracking-wide text-gray-500","sm"===$?"text-2xs":"text-xs",a?D?"sticky z-20 bg-gray-50":"sticky z-10 bg-gray-50":D?"sticky z-10 bg-gray-50":"",V&&d?"rosh-dt-sort":"",V?f(e):"",e.headerClassName??""].filter(Boolean).join(" "),children:Ce(e,d?/* @__PURE__ */c("button",{type:"button",onClick:()=>(e=>{if(!C)return;const t=ae(e),r=ce(e),o=e.sortFirst??"asc";C(null===r?{field:t,direction:o}:r===o?{field:t,direction:"asc"===o?"desc":"asc"}:null)})(e),"data-group":V?ue.get(e):void 0,className:`inline-flex max-w-full items-center font-semibold uppercase tracking-wide hover:text-ink ${i}`,children:[
6
6
  /* @__PURE__ */h(n,{children:e.title}),
7
7
  /* @__PURE__ */h(b,{direction:s})]}):/* @__PURE__ */h(n,{children:e.title}))},e.key)};let Me=0;const Be=de.map(e=>{if("left"!==e.fixed)return null;const t=Me;return Me+=e.width??0,t}),Se=/* @__PURE__ */c(d,{children:[
8
- /* @__PURE__ */c("div",{onScroll:_,style:E?{maxHeight:E.height}:void 0,className:`relative overflow-x-auto ${E?"overflow-y-auto":""} ${S?"rounded-lg border border-gray-200":""}${V?" rosh-dt-scroll":""}`.trim(),children:[B&&
8
+ /* @__PURE__ */c("div",{onScroll:_,style:D?{maxHeight:D.height}:void 0,className:`relative overflow-x-auto ${D?"overflow-y-auto":""} ${S?"rounded-lg border border-gray-200":""}${V?" rosh-dt-scroll":""}`.trim(),children:[B&&
9
9
  /* @__PURE__ */c("div",{className:"absolute inset-0 z-20 flex items-start justify-center bg-white/60 pt-8",role:"status","aria-live":"polite",children:[
10
10
  /* @__PURE__ */h(r,{className:"h-6 w-6"}),
11
11
  /* @__PURE__ */h("span",{className:"sr-only",children:K.table.loading})]}),
12
- /* @__PURE__ */c("table",{...J("table"),className:(V?"rosh-dt-table ":"")+"w-full border-collapse tabular-nums",style:z?{minWidth:z}:void 0,children:[M&&/* @__PURE__ */h("caption",{className:"sr-only",children:M}),
13
- /* @__PURE__ */c("thead",{...J("rowgroup"),className:V?"rosh-dt-head":void 0,children:[
14
- /* @__PURE__ */c("tr",{ref:le,...J("row"),className:"border-b border-gray-200 bg-gray-50",children:[F&&/* @__PURE__ */h("th",{scope:"col",...J("columnheader"),rowSpan:he?2:void 0,style:{width:36,...E?{top:0}:{}},className:[Ne,o,xe||E?"sticky z-20 bg-gray-50":"",xe?"left-0":"",V?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */h(e,{"aria-label":K.table.selectAll,checked:pe,indeterminate:ye&&!pe,onChange:()=>{if(!F)return;const e=new Set(ge);F.onChange(pe?F.selected.filter(t=>!e.has(t)):[...F.selected,...ge.filter(e=>!fe.has(e))])}})}),Z.map((e,t)=>m(e)?/* @__PURE__ */h("th",{scope:"colgroup",...J("columnheader"),colSpan:e.columns.length,style:E?{top:0}:void 0,className:[Ne,"text-center",o,"font-semibold uppercase tracking-wide text-gray-500","sm"===$?"text-2xs":"text-xs","border-b border-gray-200",E?"sticky z-10 bg-gray-50":"",e.headerClassName??""].filter(Boolean).join(" "),children:/* @__PURE__ */h(n,{children:e.title})},e.key??`group-${t}`):je(e,de.indexOf(e),he?2:1))]}),he&&/* @__PURE__ */h("tr",{...J("row"),className:"border-b border-gray-200 bg-gray-50",children:Z.flatMap(e=>m(e)?e.columns:[]).map(e=>je(e,de.indexOf(e),1,se))})]}),
15
- /* @__PURE__ */h("tbody",{...J("rowgroup"),className:V?"rosh-dt-body":void 0,children:0!==v.length||B?/* @__PURE__ */c(d,{children:[oe>0&&/* @__PURE__ */h("tr",{"aria-hidden":"true",children:/* @__PURE__ */h("td",{colSpan:we,style:{height:oe,padding:0,border:0}})}),v.slice(te,re).map((t,r)=>{const o=te+r,n=I?.(t,o),l=!!n?.current,s=R?.(t,o),i=void 0===s&&T?()=>T(t,o):void 0,a=void 0!==s||void 0!==i;let d=!1;const m=(e,t)=>{if(d=!0,!a)return e;const r=[g,i?"cursor-pointer text-left":"",t?.className??""].filter(Boolean).join(" "),o=l?"true":void 0;return void 0!==s?/* @__PURE__ */h(ke,{href:s,className:r,"aria-current":o,children:e}):/* @__PURE__ */h("button",{type:"button",onClick:i,className:r,"aria-current":o,children:e})},p=de.map(e=>e.render?e.render(t,o,m):e.dataIndex?t[e.dataIndex]:null);if(a&&!d){const e=de.findIndex(e=>"stacked"!==e.only&&!e.cardCorner),t=de.findIndex(e=>"wide"!==e.only&&!e.cardCorner);for(const r of/* @__PURE__ */new Set([e,t]))r>=0&&(p[r]=m(p[r]))}const b=e=>e?t=>{t.currentTarget.contains(t.relatedTarget)||e()}:void 0;/* @__PURE__ */
16
- return c("tr",{...u(n),...J("row"),style:E?{height:E.rowHeight}:void 0,onClick:n?.onClick,onMouseEnter:n?.onMouseEnter,onMouseLeave:n?.onMouseLeave,onFocus:b(n?.onFocus),onBlur:b(n?.onBlur),"aria-current":l&&!a?"true":void 0,...n?.onClick?{tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick?.()))}}:{},className:[V?F?"rosh-dt-row rosh-dt-row-select":"rosh-dt-row":"",V&&ve?"rosh-dt-row-corner":"","border-b border-gray-100 last:border-b-0",n?.onClick?"cursor-pointer hover:bg-gray-50 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",a?"rosh-dt-linked hover:bg-gray-50":"",l?"rosh-dt-current":"",H?.(t,o)??"",n?.className??""].filter(Boolean).join(" "),children:[F&&(()=>{const r=Q(t,o);/* @__PURE__ */
17
- return h("td",{...J("cell"),style:{width:36},onClick:e=>e.stopPropagation(),className:[Ne,xe?"sticky left-0 z-10 bg-white":"",V?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */h(e,{"aria-label":K.table.selectRow,checked:fe.has(r),onChange:()=>(e=>{F&&F.onChange(fe.has(e)?F.selected.filter(t=>t!==e):[...F.selected,e])})(r)})})})(),de.map((e,t)=>{const r="left"===e.fixed,o=p[t],n=ve&&!!e.cardCorner,l=V&&!n&&"wide"!==e.only;/* @__PURE__ */
18
- return h("td",{...J("cell"),"data-label":l?me(e):void 0,style:r?{left:(Be[t]??0)+be}:void 0,className:[l?e.ellipsis?"rosh-dt-cell rosh-dt-clip":"rosh-dt-cell":"",n?"rosh-dt-corner":"",V?f(e):"",Ne,y[e.align??(e.numeric?"right":"left")],V?"":w(e),"text-ink-strongest",e.ellipsis?"max-w-0 truncate":"",r?"sticky z-10 bg-white":"",e.className??""].filter(Boolean).join(" "),children:V?
19
- /* @__PURE__ */h("span",{className:["rosh-dt-value",w(e,!0)].filter(Boolean).join(" "),children:o}):o},e.key)})]},Q(t,o))}),ne>0&&/* @__PURE__ */h("tr",{"aria-hidden":"true",children:/* @__PURE__ */h("td",{colSpan:we,style:{height:ne,padding:0,border:0}})})]}):/* @__PURE__ */h("tr",{...J("row"),className:V?"rosh-dt-empty":void 0,children:/* @__PURE__ */h("td",{...J("cell"),colSpan:we,className:`${Ne} py-10 text-center text-gray-500`,children:W})})})]}),P]}),j&&j.pageCount>1&&/* @__PURE__ */h("div",{className:V?"rosh-dt-pager mt-3 flex justify-end":"mt-3 flex justify-end",children:/* @__PURE__ */h(t,{page:j.page,pageCount:j.pageCount,onPageChange:j.onPageChange})})]});/* @__PURE__ */
20
- return h("div",V?void 0!==O&&O>0&&40!==O?{className:`rosh-dt-at ${D}`.trim(),children:/* @__PURE__ */h("div",{className:"rosh-dt-stack",style:{width:40/O*100+"%"},children:/* @__PURE__ */h("div",{className:"rosh-dt-fit",style:{width:O/40*100+"%"},children:Se})})}:{className:`rosh-dt-stack ${D}`.trim(),children:Se}:{className:D,children:Se})}export{x as DataTable};
12
+ /* @__PURE__ */c("table",{...Z("table"),className:(V?"rosh-dt-table ":"")+"w-full border-collapse tabular-nums",style:z?{minWidth:z}:void 0,children:[M&&/* @__PURE__ */h("caption",{className:"sr-only",children:M}),
13
+ /* @__PURE__ */c("thead",{...Z("rowgroup"),className:V?"rosh-dt-head":void 0,children:[
14
+ /* @__PURE__ */c("tr",{ref:le,...Z("row"),className:"border-b border-gray-200 bg-gray-50",children:[P&&/* @__PURE__ */h("th",{scope:"col",...Z("columnheader"),rowSpan:he?2:void 0,style:{width:36,...D?{top:0}:{}},className:[Ne,o,xe||D?"sticky z-20 bg-gray-50":"",xe?"left-0":"",V?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */h(e,{"aria-label":K.table.selectAll,checked:pe,indeterminate:ye&&!pe,onChange:()=>{if(!P)return;const e=new Set(ge);P.onChange(pe?P.selected.filter(t=>!e.has(t)):[...P.selected,...ge.filter(e=>!fe.has(e))])}})}),Y.map((e,t)=>m(e)?/* @__PURE__ */h("th",{scope:"colgroup",...Z("columnheader"),colSpan:e.columns.length,style:D?{top:0}:void 0,className:[Ne,"text-center",o,"font-semibold uppercase tracking-wide text-gray-500","sm"===$?"text-2xs":"text-xs","border-b border-gray-200",D?"sticky z-10 bg-gray-50":"",e.headerClassName??""].filter(Boolean).join(" "),children:/* @__PURE__ */h(n,{children:e.title})},e.key??`group-${t}`):je(e,de.indexOf(e),he?2:1))]}),he&&/* @__PURE__ */h("tr",{...Z("row"),className:"border-b border-gray-200 bg-gray-50",children:Y.flatMap(e=>m(e)?e.columns:[]).map(e=>je(e,de.indexOf(e),1,se))})]}),
15
+ /* @__PURE__ */h("tbody",{...Z("rowgroup"),className:V?"rosh-dt-body":void 0,children:0!==v.length||B?/* @__PURE__ */c(d,{children:[oe>0&&/* @__PURE__ */h("tr",{"aria-hidden":"true",children:/* @__PURE__ */h("td",{colSpan:we,style:{height:oe,padding:0,border:0}})}),v.slice(te,re).map((t,r)=>{const o=te+r,n=R?.(t,o),l=!!n?.current,s=T?.(t,o),i=void 0===s&&F?()=>F(t,o):void 0,a=void 0!==s||void 0!==i;let d=!1;const m=(e,t)=>{if(d=!0,!a)return e;const r=[g,i?"cursor-pointer text-left":"",t?.className??""].filter(Boolean).join(" "),o=l?"true":void 0;return void 0!==s?/* @__PURE__ */h(ke,{href:s,className:r,"aria-current":o,children:e}):/* @__PURE__ */h("button",{type:"button",onClick:i,className:r,"aria-current":o,children:e})},p=de.map(e=>e.render?e.render(t,o,m):e.dataIndex?t[e.dataIndex]:null);if(a&&!d){const e=de.findIndex(e=>"stacked"!==e.only&&!e.cardCorner),t=de.findIndex(e=>"wide"!==e.only&&!e.cardCorner);for(const r of/* @__PURE__ */new Set([e,t]))r>=0&&(p[r]=m(p[r]))}const b=e=>e?t=>{t.currentTarget.contains(t.relatedTarget)||e()}:void 0;/* @__PURE__ */
16
+ return c("tr",{...u(n),...Z("row"),style:D?{height:D.rowHeight}:void 0,onClick:n?.onClick,onMouseEnter:n?.onMouseEnter,onMouseLeave:n?.onMouseLeave,onFocus:b(n?.onFocus),onBlur:b(n?.onBlur),"aria-current":l&&!a?"true":void 0,...n?.onClick?{tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick?.()))}}:{},className:[V?P?"rosh-dt-row rosh-dt-row-select":"rosh-dt-row":"",V&&ve?"rosh-dt-row-corner":"","border-b border-gray-100 last:border-b-0",n?.onClick?"cursor-pointer hover:bg-gray-50 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",a?"rosh-dt-linked hover:bg-gray-50":"",l?"rosh-dt-current":"",H?.(t,o)??"",n?.className??""].filter(Boolean).join(" "),children:[P&&(()=>{const r=Q(t,o);/* @__PURE__ */
17
+ return h("td",{...Z("cell"),style:{width:36},onClick:e=>e.stopPropagation(),className:[Ne,xe?"sticky left-0 z-10 bg-white":"",V?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */h(e,{"aria-label":K.table.selectRow,checked:fe.has(r),onChange:()=>(e=>{P&&P.onChange(fe.has(e)?P.selected.filter(t=>t!==e):[...P.selected,e])})(r)})})})(),de.map((e,t)=>{const r="left"===e.fixed,o=p[t],n=ve&&!!e.cardCorner,l=V&&!n&&"wide"!==e.only;/* @__PURE__ */
18
+ return h("td",{...Z("cell"),"data-label":l?me(e):void 0,style:r?{left:(Be[t]??0)+be}:void 0,className:[l?e.ellipsis?"rosh-dt-cell rosh-dt-clip":"rosh-dt-cell":"",n?"rosh-dt-corner":"",V?f(e):"",Ne,y[e.align??(e.numeric?"right":"left")],V?"":w(e),"text-ink-strongest",e.ellipsis?"max-w-0 truncate":"",r?"sticky z-10 bg-white":"",e.className??""].filter(Boolean).join(" "),children:V?
19
+ /* @__PURE__ */h("span",{className:["rosh-dt-value",w(e,!0)].filter(Boolean).join(" "),children:o}):o},e.key)})]},Q(t,o))}),ne>0&&/* @__PURE__ */h("tr",{"aria-hidden":"true",children:/* @__PURE__ */h("td",{colSpan:we,style:{height:ne,padding:0,border:0}})})]}):/* @__PURE__ */h("tr",{...Z("row"),className:V?"rosh-dt-empty":void 0,children:/* @__PURE__ */h("td",{...Z("cell"),colSpan:we,className:`${Ne} py-10 text-center text-gray-500`,children:W})})})]}),A]}),j&&j.pageCount>1&&/* @__PURE__ */h("div",{className:V?"rosh-dt-pager mt-3 flex justify-end":"mt-3 flex justify-end",children:/* @__PURE__ */h(t,{page:j.page,pageCount:j.pageCount,onPageChange:j.onPageChange})})]});/* @__PURE__ */
20
+ return h("div",V?void 0!==G&&G>0&&40!==G?{className:`rosh-dt-at ${O}`.trim(),children:/* @__PURE__ */h("div",{className:"rosh-dt-stack",style:{width:40/G*100+"%"},children:/* @__PURE__ */h("div",{className:"rosh-dt-fit",style:{width:G/40*100+"%"},children:Se})})}:{className:`rosh-dt-stack ${O}`.trim(),children:Se}:{className:O,children:Se})}export{x as DataTable};
@@ -1,2 +1,2 @@
1
- import{Tooltip as e}from"./chunk-AJPQJ7TC.js";import{Fragment as r}from"react";import{jsx as l,jsxs as a}from"react/jsx-runtime";var i="58px",t="--picture-tiles-columns";function o(e){let r=0;for(const l of e)for(const e of l.label.split(/\s+/))r=Math.max(r,[...e].length);return r}function s({options:t,value:s,onChange:n,onClear:c,columns:u,captions:p=!1,label:d,className:b="","aria-labelledby":m}){const f=p?{"--picture-tiles-min":i,"--picture-tiles-longest-word":o(t),...u?{"--picture-tiles-default-columns":u}:{}}:{gridTemplateColumns:u?`repeat(${u}, minmax(0, 1fr))`:`repeat(auto-fill, minmax(${i}, 1fr))`};/* @__PURE__ */
1
+ import{Tooltip as e}from"./chunk-2MUZFHZW.js";import{Fragment as r}from"react";import{jsx as l,jsxs as a}from"react/jsx-runtime";var i="58px",t="--picture-tiles-columns";function o(e){let r=0;for(const l of e)for(const e of l.label.split(/\s+/))r=Math.max(r,[...e].length);return r}function s({options:t,value:s,onChange:n,onClear:c,columns:u,captions:p=!1,label:d,className:b="","aria-labelledby":m}){const f=p?{"--picture-tiles-min":i,"--picture-tiles-longest-word":o(t),...u?{"--picture-tiles-default-columns":u}:{}}:{gridTemplateColumns:u?`repeat(${u}, minmax(0, 1fr))`:`repeat(auto-fill, minmax(${i}, 1fr))`};/* @__PURE__ */
2
2
  return l("div",{role:"group","aria-label":m?void 0:d,"aria-labelledby":m,style:f,className:`${p?"rosh-picture-tiles rosh-one-height-rows"+(u?"":" rosh-picture-tiles-fit"):"grid"} gap-(--space-8) ${b}`.replace(/\s+/g," ").trim(),children:t.map(i=>{const t=i.value===s,o=/* @__PURE__ */a("button",{type:"button","aria-pressed":t,"aria-label":p?void 0:i.label,disabled:i.disabled||void 0,onClick:()=>{t?c?.():n(i.value)},className:`flex w-full min-w-0 flex-col items-center justify-center gap-(--space-4) rounded-(--radius-control) border transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)] disabled:cursor-not-allowed disabled:opacity-50 ${p?"px-(--space-4) py-(--space-8)":"p-(--space-4)"} ${t?"border-blue-600 bg-surface text-blue-600 ring-2 ring-blue-400/40":"border-line bg-surface text-ink-faint hover:bg-row-hover hover:text-ink"}`,children:[i.picture,p&&/* @__PURE__ */l("span",{className:"max-w-full text-center text-2xs leading-4 break-normal",children:i.label})]});return p?/* @__PURE__ */l(r,{children:o},i.value):/* @__PURE__ */l(e,{content:i.label,describe:!1,className:"relative flex min-w-0",children:o},i.value)})})}export{t as PICTURE_TILES_COLUMNS_VAR,s as PictureTiles};
@@ -1,2 +1,2 @@
1
- import{InputNumber_default as a,stepRounding as e}from"./chunk-I7WAOKU2.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{jsxs as n,jsx as i}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={x:/* @__PURE__ */i(r,{name:"nudge-x","aria-hidden":"true",className:l}),y:/* @__PURE__ */i(r,{name:"nudge-y","aria-hidden":"true",className:l})};function m({label:r,value:l,onChange:m,words:t,placeholder:d,min:o=-200,max:c=200,step:u=1,readOnly:p,units:h}){const x=r=>/* @__PURE__ */i("div",{"data-axis":r,className:"min-w-0",children:/* @__PURE__ */i(a,{value:l[r],onChange:a=>m({...l,[r]:a}),min:o,max:c,step:u,...e(u),steppers:"compact",readOnly:p,placeholder:d[r],prefix:s[r],suffix:t.unit,units:h,"aria-label":t[r]})});/* @__PURE__ */
1
+ import{InputNumber_default as a,stepRounding as e}from"./chunk-KKZXGWSX.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{jsxs as n,jsx as i}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={x:/* @__PURE__ */i(r,{name:"nudge-x","aria-hidden":"true",className:l}),y:/* @__PURE__ */i(r,{name:"nudge-y","aria-hidden":"true",className:l})};function m({label:r,value:l,onChange:m,words:t,placeholder:d,min:o=-200,max:c=200,step:u=1,readOnly:p,units:h}){const x=r=>/* @__PURE__ */i("div",{"data-axis":r,className:"min-w-0",children:/* @__PURE__ */i(a,{value:l[r],onChange:a=>m({...l,[r]:a}),min:o,max:c,step:u,...e(u),steppers:"compact",readOnly:p,placeholder:d[r],prefix:s[r],suffix:t.unit,units:h,"aria-label":t[r]})});/* @__PURE__ */
2
2
  return n("div",{role:"group","aria-label":r,className:"grid min-w-0 grid-cols-2 gap-2",children:[x("x"),x("y")]})}export{m as PositionInput};
@@ -1,8 +1,8 @@
1
- import{railLabelsShown as e}from"./chunk-FQEALPZJ.js";import{ChoiceContent as t,choiceItemClass as n,choiceTipClass as r,choiceTrackClass as o}from"./chunk-EFKJLUYP.js";import{Tooltip as l}from"./chunk-AJPQJ7TC.js";import{useBrowserLayoutEffect as a}from"./chunk-PU2GJVMG.js";import{useRef as i,useState as c,useEffect as d}from"react";import{jsx as s,jsxs as u,Fragment as m}from"react/jsx-runtime";var b=(e,t)=>`flex items-center border-b border-gray-200${e?"":" gap-1"} ${t}`.trim();function f(e,t,n="default"){return`-mb-px inline-flex items-center gap-2 border-b-2 px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${t?"flex-1 justify-center ":""}${e?"border-blue-600 text-blue-600":`border-transparent ${"warning"===n?"text-amber-700":"text-gray-900"} hover:border-gray-300`}`}function h(e){if(!e||!e.startsWith("#")||e.length<2)return null;try{return document.getElementById(decodeURIComponent(e.slice(1)))}catch{return null}}function p(e,t){const n=e.filter(e=>!e.disabled).map(e=>({id:e.id,section:h(e.href)})).filter(e=>null!=e.section);if(0===n.length)return null;const r=function(e){for(let t=e.parentElement;t;t=t.parentElement){const e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t}return document.scrollingElement??document.documentElement}(n[0].section);if(r.scrollTop>0&&r.scrollTop+r.clientHeight>=r.scrollHeight-1)return n[n.length-1].id;const o=Math.max(0,t.getBoundingClientRect().bottom)+8;let l=n[0].id;for(const e of n)e.section.getBoundingClientRect().top<=o&&(l=e.id);return l}function g({items:e,value:n,onChange:o,block:c=!1,className:u="","aria-label":m,"aria-labelledby":g}){const v=i(null),y=function(e,t,n,r){const o=i(0),l=i({items:t,value:n,onChange:r});l.current={items:t,value:n,onChange:r};const c=i(()=>{});return c.current=()=>{const t=e.current;if(!t||Date.now()<o.current)return;const n=p(l.current.items,t);null!=n&&n!==l.current.value&&l.current.onChange(n)},a(()=>{c.current()},[t]),d(()=>{let e=0;const t=()=>{e||(e=requestAnimationFrame(()=>{e=0,c.current()}))};return document.addEventListener("scroll",t,{capture:!0,passive:!0}),window.addEventListener("resize",t),()=>{document.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),e&&cancelAnimationFrame(e)}},[]),e=>{o.current=Date.now()+800,e!==l.current.value&&l.current.onChange(e),window.setTimeout(()=>c.current(),850)}}(v,e,n,o);/* @__PURE__ */
2
- return s("nav",{ref:v,"aria-label":m,"aria-labelledby":g,className:b(c,u),children:e.map(e=>{const o=e.id===n,a=/* @__PURE__ */s("a",{href:e.disabled?void 0:e.href,"aria-current":o?"location":void 0,"aria-disabled":e.disabled||void 0,onClick:e.disabled?void 0:t=>((e,t)=>{const n=h(t.href);n&&(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))(e)&&(e.preventDefault(),y(t.id),n.scrollIntoView({block:"start",behavior:"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))})(t,e),className:`${f(o,c,"warning"===e.tone?"warning":"default")}${e.disabled?" cursor-not-allowed opacity-50":""}`,children:/* @__PURE__ */s(t,{icon:e.icon,label:e.label})},e.id);return null!=e.tooltip&&!1!==e.tooltip?/* @__PURE__ */s(l,{content:e.tooltip,className:c?r(c):void 0,children:a},e.id):a})})}var v=(e,t)=>`${e}-tab-${t}`,y=(e,t)=>`${e}-panel-${t}`;function w(e,t){const n=getComputedStyle(e),r=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0)+(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),o=(parseFloat(n.columnGap)||0)*Math.max(0,t-1),l=e.parentElement;let a=1/0;if(l){const e=getComputedStyle(l);a=l.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)}return{chrome:r+o,room:a}}function x(e){return e.items.some(e=>null!=e.href)?/* @__PURE__ */s(g,{...e}):/* @__PURE__ */s(k,{...e})}function k({items:h,value:p,onChange:g,variant:x="underline",block:k=!1,idPrefix:F,className:E="","aria-label":L,"aria-labelledby":N,labelsFit:A=!1,dotLabel:R="Has a setting"}){const $=i([]),S=i(null),M="pill"===x,[W,j]=c(null),z=W??"none",D=i(()=>{});D.current=()=>{const t=S.current;if(!t||!A)return;const n=function(e){return[...e.querySelectorAll('[role="tab"]')].map(e=>{const t=getComputedStyle(e),n=(parseFloat(t.paddingLeft)||0)+(parseFloat(t.paddingRight)||0)+(parseFloat(t.borderLeftWidth)||0)+(parseFloat(t.borderRightWidth)||0),r=e.querySelector("[data-tab-glyph]")?.getBoundingClientRect().width??0,o=e.querySelector("[data-tab-word]")?.scrollWidth??0;return{bare:n+r,worded:n+r+(r&&o?8:0)+o,active:"true"===e.getAttribute("aria-selected")}})}(t);j(function({tabs:t,block:n,chrome:r,room:o}){if(!n)return e({buttons:t,orientation:"horizontal",chrome:r,room:o});if(0===t.length)return"none";const l=e=>r+e*t.length<=o+.5;if(l(Math.max(...t.map(e=>e.worded))))return"all";const a=t.find(e=>e.active);return a&&l(Math.max(a.worded,...t.map(e=>e.bare)))?"chosen":"none"}({tabs:n,block:k,...w(t,n.length)}))},a(()=>{D.current()}),d(()=>{const e=S.current?.parentElement;if(!A||!e)return;let t=!0;const n=()=>{t&&D.current()},r="undefined"==typeof ResizeObserver?void 0:ResizeObserver,o=r?new r(n):null;return o?.observe(e),document.fonts?.ready.then(n,()=>{}),()=>{t=!1,o?.disconnect()}},[A]);const H=(e,t)=>{for(let n=1;n<=h.length;n+=1){const r=((e+t*n)%h.length+h.length)%h.length;if(!h[r]?.disabled)return r}return null},K=e=>{const t=1===e?h.map((e,t)=>t):h.map((e,t)=>h.length-1-t);for(const e of t)if(!h[e]?.disabled)return e;return null};/* @__PURE__ */
3
- return s("div",{ref:S,role:"tablist","data-labels-shown":A?z:void 0,"aria-label":L,"aria-labelledby":N,onKeyDown:e=>{const t=h.findIndex(e=>e.id===p);let n=null;if("ArrowRight"===e.key||"ArrowDown"===e.key)n=H(t,1);else if("ArrowLeft"===e.key||"ArrowUp"===e.key)n=H(t,-1);else if("Home"===e.key)n=K(1);else{if("End"!==e.key)return;n=K(-1)}e.preventDefault(),null!==n&&n!==t&&(g(h[n].id),$.current[n]?.focus())},className:M?o(k,E):b(k,E),children:h.map((e,o)=>{const a=e.id===p,i=A&&null!=e.icon,c="all"===z||"chosen"===z&&a,d=e.dot?/* @__PURE__ */s(C,{label:e.label,on:a,said:R}):e.label,b=/* @__PURE__ */s("button",{ref:e=>{$.current[o]=e},type:"button",role:"tab",id:F?v(F,e.id):void 0,"aria-controls":F?y(F,e.id):void 0,"aria-selected":a,tabIndex:a?0:-1,disabled:e.disabled,onClick:()=>g(e.id),className:M?n({selected:a,disabled:e.disabled,block:k}):f(a,k,"warning"===e.tone?"warning":"default"),children:i?/* @__PURE__ */u(m,{children:[
1
+ import{railLabelsShown as e}from"./chunk-FQEALPZJ.js";import{ChoiceContent as t,choiceItemClass as n,choiceTipClass as r,choiceTrackClass as o}from"./chunk-EFKJLUYP.js";import{Tooltip as l}from"./chunk-2MUZFHZW.js";import{useBrowserLayoutEffect as a}from"./chunk-PU2GJVMG.js";import{useRef as i,useState as c,useEffect as d}from"react";import{jsx as s,jsxs as u,Fragment as m}from"react/jsx-runtime";var b=(e,t)=>`flex items-center border-b border-gray-200${e?"":" gap-1"} ${t}`.trim();function f(e,t,n="default"){return`-mb-px inline-flex items-center gap-2 border-b-2 px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${t?"flex-1 justify-center ":""}${e?"border-blue-600 text-blue-600":`border-transparent ${"warning"===n?"text-amber-700":"text-gray-900"} hover:border-gray-300`}`}function h(e){if(!e||!e.startsWith("#")||e.length<2)return null;try{return document.getElementById(decodeURIComponent(e.slice(1)))}catch{return null}}function p(e,t){const n=e.filter(e=>!e.disabled).map(e=>({id:e.id,section:h(e.href)})).filter(e=>null!=e.section);if(0===n.length)return null;const r=function(e){for(let t=e.parentElement;t;t=t.parentElement){const e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t}return document.scrollingElement??document.documentElement}(n[0].section);if(r.scrollTop>0&&r.scrollTop+r.clientHeight>=r.scrollHeight-1)return n[n.length-1].id;const o=Math.max(0,t.getBoundingClientRect().bottom)+8;let l=n[0].id;for(const e of n)e.section.getBoundingClientRect().top<=o&&(l=e.id);return l}function g({items:e,value:n,onChange:o,block:c=!1,className:u="","aria-label":m,"aria-labelledby":g}){const v=i(null),y=function(e,t,n,r){const o=i(0),l=i({items:t,value:n,onChange:r});l.current={items:t,value:n,onChange:r};const c=i(()=>{});return c.current=()=>{const t=e.current;if(!t||Date.now()<o.current)return;const n=p(l.current.items,t);null!=n&&n!==l.current.value&&l.current.onChange(n)},a(()=>{c.current()},[t]),d(()=>{let e=0;const t=()=>{e||(e=requestAnimationFrame(()=>{e=0,c.current()}))};return document.addEventListener("scroll",t,{capture:!0,passive:!0}),window.addEventListener("resize",t),()=>{document.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),e&&cancelAnimationFrame(e)}},[]),e=>{o.current=Date.now()+800,e!==l.current.value&&l.current.onChange(e),window.setTimeout(()=>c.current(),850)}}(v,e,n,o);/* @__PURE__ */
2
+ return s("nav",{ref:v,"aria-label":m,"aria-labelledby":g,className:b(c,u),children:e.map(e=>{const o=e.id===n,a=/* @__PURE__ */s("a",{href:e.disabled?void 0:e.href,"aria-current":o?"location":void 0,"aria-disabled":e.disabled||void 0,onClick:e.disabled?void 0:t=>((e,t)=>{const n=h(t.href);n&&(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))(e)&&(e.preventDefault(),y(t.id),n.scrollIntoView({block:"start",behavior:"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))})(t,e),className:`${f(o,c,"warning"===e.tone?"warning":"default")}${e.disabled?" cursor-not-allowed opacity-50":""}`,children:/* @__PURE__ */s(t,{icon:e.icon,label:e.label})},e.id);return null!=e.tooltip&&!1!==e.tooltip?/* @__PURE__ */s(l,{content:e.tooltip,className:c?r(c):void 0,children:a},e.id):a})})}var v=(e,t)=>`${e}-tab-${t}`,y=(e,t)=>`${e}-panel-${t}`;function w(e,t){const n=getComputedStyle(e),r=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0)+(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),o=(parseFloat(n.columnGap)||0)*Math.max(0,t-1),l=e.parentElement;let a=1/0;if(l){const e=getComputedStyle(l);a=l.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)}return{chrome:r+o,room:a}}function x(e){return e.items.some(e=>null!=e.href)?/* @__PURE__ */s(g,{...e}):/* @__PURE__ */s(k,{...e})}function k({items:h,value:p,onChange:g,variant:x="underline",block:k=!1,idPrefix:C,className:E="","aria-label":L,"aria-labelledby":N,labelsFit:R=!1,dotLabel:A="Has a setting"}){const $=i([]),M=i(null),S="pill"===x,[W,H]=c(null),j=W??"none",z=i(()=>{});z.current=()=>{const t=M.current;if(!t||!R)return;const n=function(e){return[...e.querySelectorAll('[role="tab"]')].map(e=>{const t=getComputedStyle(e),n=(parseFloat(t.paddingLeft)||0)+(parseFloat(t.paddingRight)||0)+(parseFloat(t.borderLeftWidth)||0)+(parseFloat(t.borderRightWidth)||0),r=e.querySelector("[data-tab-glyph]")?.getBoundingClientRect().width??0,o=e.querySelector("[data-tab-word]")?.scrollWidth??0;return{bare:n+r,worded:n+r+(r&&o?8:0)+o,active:"true"===e.getAttribute("aria-selected")}})}(t);H(function({tabs:t,block:n,chrome:r,room:o}){if(!n)return e({buttons:t,orientation:"horizontal",chrome:r,room:o});if(0===t.length)return"none";const l=e=>r+e*t.length<=o+.5;if(l(Math.max(...t.map(e=>e.worded))))return"all";const a=t.find(e=>e.active);return a&&l(Math.max(a.worded,...t.map(e=>e.bare)))?"chosen":"none"}({tabs:n,block:k,...w(t,n.length)}))},a(()=>{z.current()}),d(()=>{const e=M.current?.parentElement;if(!R||!e)return;let t=!0;const n=()=>{t&&z.current()},r="undefined"==typeof ResizeObserver?void 0:ResizeObserver,o=r?new r(n):null;return o?.observe(e),document.fonts?.ready.then(n,()=>{}),()=>{t=!1,o?.disconnect()}},[R]);const D=(e,t)=>{for(let n=1;n<=h.length;n+=1){const r=((e+t*n)%h.length+h.length)%h.length;if(!h[r]?.disabled)return r}return null},K=e=>{const t=1===e?h.map((e,t)=>t):h.map((e,t)=>h.length-1-t);for(const e of t)if(!h[e]?.disabled)return e;return null};/* @__PURE__ */
3
+ return s("div",{ref:M,role:"tablist","data-labels-shown":R?j:void 0,"aria-label":L,"aria-labelledby":N,onKeyDown:e=>{const t=h.findIndex(e=>e.id===p);let n=null;if("ArrowRight"===e.key||"ArrowDown"===e.key)n=D(t,1);else if("ArrowLeft"===e.key||"ArrowUp"===e.key)n=D(t,-1);else if("Home"===e.key)n=K(1);else{if("End"!==e.key)return;n=K(-1)}e.preventDefault(),null!==n&&n!==t&&(g(h[n].id),$.current[n]?.focus())},className:S?o(k,E):b(k,E),children:h.map((e,o)=>{const a=e.id===p,i=R&&null!=e.icon,c="all"===j||"chosen"===j&&a,d=e.dot?/* @__PURE__ */s(F,{label:e.label,on:a,said:A}):e.label,b=/* @__PURE__ */s("button",{ref:e=>{$.current[o]=e},type:"button",role:"tab",id:C?v(C,e.id):void 0,"aria-controls":C?y(C,e.id):void 0,"aria-selected":a,tabIndex:a?0:-1,disabled:e.disabled,onClick:()=>g(e.id),className:S?n({selected:a,disabled:e.disabled,block:k}):f(a,k,"warning"===e.tone?"warning":"default"),children:i?/* @__PURE__ */u(m,{children:[
4
4
  /* @__PURE__ */s("span",{"aria-hidden":"true","data-tab-glyph":"",className:"inline-flex shrink-0",children:e.icon}),
5
- /* @__PURE__ */s("span",{"data-tab-word":c?"shown":"hidden",className:c?"whitespace-nowrap":"sr-only",children:d})]}):/* @__PURE__ */s(t,{icon:e.icon,label:d})},e.id),h=i?e.tooltip??e.label:e.tooltip;return null!=h&&!1!==h?/* @__PURE__ */s(l,{content:h,className:M||k?r(k):void 0,children:b},e.id):b})})}function C({label:e,on:t,said:n}){/* @__PURE__ */
5
+ /* @__PURE__ */s("span",{"data-tab-word":c?"shown":"hidden",className:c?"whitespace-nowrap":"sr-only",children:d})]}):/* @__PURE__ */s(t,{icon:e.icon,label:d})},e.id),h=i?e.tooltip??e.label:e.tooltip;return null!=h&&!1!==h?/* @__PURE__ */s(l,{content:h,className:S||k?r(k):void 0,children:b},e.id):b})})}function F({label:e,on:t,said:n}){/* @__PURE__ */
6
6
  return u("span",{className:"inline-flex items-center gap-(--space-4)",children:[e,
7
7
  /* @__PURE__ */s("span",{"aria-hidden":"true","data-tab-dot":t?"on":"off",className:"size-2 shrink-0 rounded-full "+(t?"bg-current":"bg-accent-fill")}),
8
8
  /* @__PURE__ */s("span",{className:"sr-only",children:n})]})}export{x as Tabs,v as tabButtonId,y as tabPanelId};
@@ -0,0 +1,7 @@
1
+ import{isFocusableEntry as e,menuStatusIds as t,renderMenuEntries as r}from"./chunk-FM5ASDVN.js";import{useTabLayer as n,focusableIn as o}from"./chunk-DWGYC7OD.js";import{PopupMenu as i,PopupMenuDivider as a}from"./chunk-3HPCQMYH.js";import{onOverlayOpen as l}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as s}from"./chunk-62LW225J.js";import{placeMenu as d,popupBounds as c,followAnchor as u}from"./chunk-TAHHZGRH.js";import{useBrowserLayoutEffect as p}from"./chunk-PU2GJVMG.js";import{registerModalEscapeInterceptor as f}from"./chunk-TWVUQUUD.js";import{useState as m,useRef as h,useId as g,useCallback as v,useEffect as b}from"react";import{jsxs as y,jsx as x}from"react/jsx-runtime";var k="inline-flex items-center justify-center rounded-(--radius-control) text-gray-600 transition-colors not-disabled:not-aria-disabled:hover:bg-gray-100 not-disabled:not-aria-disabled:hover:text-ink-strongest rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] disabled:cursor-not-allowed disabled:opacity-60",w=/(^|[\s:])!?z-/,D={paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:"0.25rem",paddingBottom:"0.25rem"};function H({trigger:H,items:j,align:A="end",side:C="bottom","aria-label":W,className:$="",triggerClassName:E,menuClassName:S="",minWidth:K=180,linkAs:L,disabled:N,id:M,"aria-describedby":T,"aria-disabled":U=!1,onOpenChange:G,footer:I,footerLabel:P}){const[q,B]=m(!1),[R,V]=m(-1),Y=h(null),z=h(null),J=h(null),O=h(null),Q=h(null),F=null!=I&&!1!==I,Z=h({text:"",at:0}),X=g(),_=g(),ee=M??_,te=h(G);te.current=G;const re=h(q);re.current=q;const ne=v(e=>{B(!1),re.current&&(re.current=!1,te.current?.(!1)),e&&z.current?.focus()},[]),oe=(t,r)=>{const n=j.length;for(let o=0;o<n;o+=1){const i=((t+r*o)%n+n)%n;if(e(j[i]))return i}return-1},ie=()=>J.current?.closest("[data-popup-menu-tree]")??null;b(()=>{if(!q)return;const e=e=>{const t=e.target;if(Y.current?.contains(t)||ie()?.contains(t))return;const r=ie()?.getAttribute("data-popup-menu-tree"),n=t.closest?.("[data-popup-menu-tree]");r&&n?.getAttribute("data-popup-menu-tree")===r||ne(!1)};document.addEventListener("pointerdown",e,!0);const t=l(()=>ne(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[q,ne]);const ae=v(()=>{const e=ie(),t=z.current;if(!e||!t)return;const r=e.style;r.left="0px",r.top="0px",r.maxWidth="none",r.maxHeight="none";const n={width:e.offsetWidth,height:e.offsetHeight},o=d({trigger:t.getBoundingClientRect(),menu:n,bounds:c(t),align:A,side:C});r.left=`${o.left}px`,r.top=`${o.top}px`,r.maxWidth=`${o.maxWidth}px`,r.maxHeight=`${o.maxHeight}px`,r.overflowY=n.height>o.maxHeight?"auto":"",e.dataset.side=o.side,e.dataset.align=A},[A,C]);p(()=>{q&&ae()}),b(()=>{if(q)return u(()=>z.current,ae)},[q,ae]),b(()=>{if(!q)return;const t=J.current,r=e(j[R])?t?.querySelector(`[data-dropdown-index="${R}"]`):null;(r??t)?.focus({preventScroll:!0})},[q,R]),b(()=>{if(q)return f(e=>"Escape"===e.key&&(ne(!0),!0),()=>O.current)},[q,ne]),n(O,q&&F);const le=h(null),se=t=>{const r=j.findIndex(t=>"radio"===t.type&&"colour"===t.mark&&t.checked&&e(t));return r>=0?r:"first"===t?oe(0,1):oe(j.length-1,-1)},de=e=>{V(se(e)),B(!0),re.current||(re.current=!0,le.current=e,G?.(!0))};p(()=>{const e=le.current;if(!q||!e)return;le.current=null;const t=se(e);t!==R&&V(t)});const ce=t(j,X),ue="function"==typeof I?I({close:()=>ne(!0)}):I,pe={...w.test(S)?{}:{zIndex:s.popup},minWidth:K};/* @__PURE__ */
2
+ return y("div",{ref:Y,className:`relative inline-flex ${$}`.trim(),children:[
3
+ /* @__PURE__ */x("button",{ref:z,id:ee,type:"button","aria-haspopup":"menu","aria-expanded":q,"aria-controls":q?X:void 0,"aria-label":W,"aria-describedby":T,"aria-disabled":U||void 0,disabled:N,onClick:()=>{U||(q?ne(!1):de("first"))},onKeyDown:e=>{U||("ArrowDown"===e.key||"Enter"===e.key||" "===e.key?(e.preventDefault(),de("first")):"ArrowUp"===e.key&&(e.preventDefault(),de("last")))},className:E??`${k} ${W?"h-8 min-w-8 px-0":"h-8 min-w-8 gap-2 px-3"}`,children:H}),q&&
4
+ /* @__PURE__ */x(i,{portal:!0,className:S,style:pe,children:/* @__PURE__ */y("div",{ref:O,children:[
5
+ /* @__PURE__ */x("div",{ref:J,id:X,role:"menu","aria-orientation":"vertical","aria-label":W,"aria-labelledby":W?void 0:ee,"aria-describedby":ce,tabIndex:-1,onKeyDown:t=>{if(!t.target.closest?.("[data-popup-submenu-panel]")||"Tab"===t.key)if("ArrowDown"===t.key)t.preventDefault(),V(oe(R+1,1));else if("ArrowUp"===t.key)t.preventDefault(),V(oe(R-1,-1));else if("Home"===t.key)t.preventDefault(),V(oe(0,1));else if("End"===t.key)t.preventDefault(),V(oe(j.length-1,-1));else if("Tab"===t.key){t.preventDefault();const e=!t.shiftKey&&Q.current?o(Q.current)[0]:void 0;e?e.focus({preventScroll:!0}):ne(!0)}else if(" "===t.key){const e=t.target;e.matches?.("a[href]")&&(t.preventDefault(),e.click())}else 1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey||(t=>{const r=Date.now(),n=t.key.toLowerCase(),o=r-Z.current.at<500?Z.current.text+n:n;Z.current={text:o,at:r};const i=[...o].every(e=>e===o[0]),a=i?o[0]:o,l=i?R+1:Math.max(R,0),s=J.current,d=j.length;for(let r=0;r<d;r+=1){const n=((l+r)%d+d)%d;if(e(j[n])&&(s?.querySelector(`[data-dropdown-index="${n}"]`)?.textContent?.trim().toLowerCase()??"").startsWith(a))return t.preventDefault(),void V(n)}})(t)},children:r(j,{menuId:X,choose:e=>{e.disabled||(ne(!0),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>ne(!0),rowProps:(e,t)=>({"data-dropdown-index":e,tabIndex:e===R?0:-1,onMouseEnter:()=>{t.disabled||Q.current?.contains(document.activeElement)||V(e)}}),linkAs:L})}),F&&/* @__PURE__ */y("div",{ref:Q,role:"group","aria-label":P,"data-dropdown-footer":"",onKeyDown:e=>{const t=Q.current;if("Tab"!==e.key||!t||!t.contains(e.target))return;const r=o(t),n=document.activeElement;if(e.shiftKey){if(r.length>0&&n!==r[0])return;e.preventDefault();const t=J.current?.querySelector(`[data-dropdown-index="${R}"]`);return void(t??J.current)?.focus({preventScroll:!0})}r.length>0&&n!==r[r.length-1]||(e.preventDefault(),ne(!0))},children:[
6
+ /* @__PURE__ */x("div",{"aria-hidden":"true",children:/* @__PURE__ */x(a,{})}),
7
+ /* @__PURE__ */x("div",{style:D,children:ue})]})]})})]})}export{H as DropdownMenu,k as TRIGGER_CLASS};