@xdev-asia/ui 0.0.0-stage → 4.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/AGENTS.md +66 -0
  2. package/LICENSE +202 -0
  3. package/README.md +149 -2
  4. package/assets/brand/mobile/android-background-1024.png +0 -0
  5. package/assets/brand/mobile/android-background.svg +13 -0
  6. package/assets/brand/mobile/android-foreground-1024.png +0 -0
  7. package/assets/brand/mobile/android-foreground.svg +13 -0
  8. package/assets/brand/mobile/android-monochrome-1024.png +0 -0
  9. package/assets/brand/mobile/android-monochrome.svg +3 -0
  10. package/assets/brand/mobile/ios-icon-1024.png +0 -0
  11. package/assets/brand/mobile/ios-icon-dark-1024.png +0 -0
  12. package/assets/brand/mobile/ios-icon-dark.svg +22 -0
  13. package/assets/brand/mobile/ios-icon.svg +22 -0
  14. package/assets/brand/systems/xdev-ui-icon.svg +23 -0
  15. package/assets/brand/systems/xdev-ui-lockup-dark.svg +24 -0
  16. package/assets/brand/systems/xdev-ui-lockup-light.svg +24 -0
  17. package/assets/brand/systems/xdev-ui-mark-lit.svg +13 -0
  18. package/assets/brand/systems/xdev-ui-mark.svg +3 -0
  19. package/assets/brand/xdev-icon-512.png +0 -0
  20. package/assets/brand/xdev-icon-blue.svg +23 -0
  21. package/assets/brand/xdev-icon.svg +23 -0
  22. package/assets/brand/xdev-lockup-dark.svg +24 -0
  23. package/assets/brand/xdev-lockup-light.svg +24 -0
  24. package/assets/brand/xdev-mark-lit.svg +13 -0
  25. package/assets/brand/xdev-mark-tile.svg +3 -0
  26. package/assets/brand/xdev-mark.svg +3 -0
  27. package/bin/xdev-ui-skills.mjs +142 -0
  28. package/dist/Workspace.stories.d.ts +15 -0
  29. package/dist/ai-manifest.json +3727 -0
  30. package/dist/chunks/FileDrop-C-ygn8kF.js +891 -0
  31. package/dist/chunks/FileDrop-C-ygn8kF.js.map +1 -0
  32. package/dist/chunks/Popover-Ds4RBtZv.js +121 -0
  33. package/dist/chunks/Popover-Ds4RBtZv.js.map +1 -0
  34. package/dist/chunks/crop-CahE3q01.js +55 -0
  35. package/dist/chunks/crop-CahE3q01.js.map +1 -0
  36. package/dist/chunks/modal-BYFY08ti.js +54 -0
  37. package/dist/chunks/modal-BYFY08ti.js.map +1 -0
  38. package/dist/components/ActionTile/ActionTile.d.ts +14 -0
  39. package/dist/components/ActionTile/ActionTile.stories.d.ts +18 -0
  40. package/dist/components/ActivityBar/ActivityBar.d.ts +36 -0
  41. package/dist/components/ActivityBar/ActivityBar.stories.d.ts +27 -0
  42. package/dist/components/AgentChip/AgentChip.d.ts +10 -0
  43. package/dist/components/AgentChip/AgentChip.stories.d.ts +21 -0
  44. package/dist/components/AgentRow/AgentRow.d.ts +24 -0
  45. package/dist/components/AgentRow/AgentRow.stories.d.ts +19 -0
  46. package/dist/components/AppShell/AppShell.d.ts +58 -0
  47. package/dist/components/AppShell/AppShell.stories.d.ts +17 -0
  48. package/dist/components/ApprovalBar/ApprovalBar.d.ts +23 -0
  49. package/dist/components/ApprovalBar/ApprovalBar.stories.d.ts +18 -0
  50. package/dist/components/AttentionInbox/AttentionInbox.d.ts +43 -0
  51. package/dist/components/AttentionInbox/AttentionInbox.stories.d.ts +16 -0
  52. package/dist/components/AudioPreview/AudioPreview.d.ts +33 -0
  53. package/dist/components/AudioPreview/AudioPreview.stories.d.ts +23 -0
  54. package/dist/components/AudioPreview/audio-preview-store.d.ts +14 -0
  55. package/dist/components/AuthShell/AuthShell.d.ts +24 -0
  56. package/dist/components/AuthShell/AuthShell.stories.d.ts +20 -0
  57. package/dist/components/Avatar/Avatar.d.ts +13 -0
  58. package/dist/components/Avatar/Avatar.stories.d.ts +21 -0
  59. package/dist/components/Badge/Badge.d.ts +14 -0
  60. package/dist/components/Badge/Badge.stories.d.ts +26 -0
  61. package/dist/components/Banner/Banner.d.ts +11 -0
  62. package/dist/components/Banner/Banner.stories.d.ts +23 -0
  63. package/dist/components/BarChart/BarChart.d.ts +20 -0
  64. package/dist/components/BarChart/BarChart.stories.d.ts +24 -0
  65. package/dist/components/Board/Board.d.ts +9 -0
  66. package/dist/components/Board/Board.stories.d.ts +18 -0
  67. package/dist/components/BoardCard/BoardCard.d.ts +32 -0
  68. package/dist/components/BoardColumn/BoardColumn.d.ts +24 -0
  69. package/dist/components/BottomNav/BottomNav.d.ts +40 -0
  70. package/dist/components/BottomNav/BottomNav.stories.d.ts +40 -0
  71. package/dist/components/BrandMark/BrandMark.d.ts +20 -0
  72. package/dist/components/BrandMark/BrandMark.stories.d.ts +28 -0
  73. package/dist/components/Breadcrumb/Breadcrumb.d.ts +22 -0
  74. package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts +27 -0
  75. package/dist/components/BulkBar/BulkBar.d.ts +21 -0
  76. package/dist/components/BulkBar/BulkBar.stories.d.ts +16 -0
  77. package/dist/components/Button/Button.d.ts +42 -0
  78. package/dist/components/Button/Button.stories.d.ts +41 -0
  79. package/dist/components/Card/Card.d.ts +22 -0
  80. package/dist/components/Card/Card.stories.d.ts +307 -0
  81. package/dist/components/Checkbox/Checkbox.d.ts +10 -0
  82. package/dist/components/Checkbox/Checkbox.stories.d.ts +18 -0
  83. package/dist/components/Coachmark/Coachmark.d.ts +31 -0
  84. package/dist/components/Coachmark/Coachmark.stories.d.ts +27 -0
  85. package/dist/components/Coachmark/placeCoachmark.d.ts +31 -0
  86. package/dist/components/CodeBlock/CodeBlock.d.ts +19 -0
  87. package/dist/components/CodeBlock/CodeBlock.stories.d.ts +22 -0
  88. package/dist/components/CodeInput/CodeInput.d.ts +25 -0
  89. package/dist/components/CodeInput/CodeInput.stories.d.ts +32 -0
  90. package/dist/components/CodeInput/normalizeCode.d.ts +10 -0
  91. package/dist/components/ColorField/ColorField.d.ts +29 -0
  92. package/dist/components/Combobox/Combobox.d.ts +105 -0
  93. package/dist/components/Combobox/Combobox.stories.d.ts +42 -0
  94. package/dist/components/CommandPalette/CommandPalette.d.ts +94 -0
  95. package/dist/components/CommandPalette/CommandPalette.stories.d.ts +39 -0
  96. package/dist/components/Comment/Comment.d.ts +25 -0
  97. package/dist/components/Comment/Comment.stories.d.ts +24 -0
  98. package/dist/components/CommitGraph/CommitGraph.d.ts +15 -0
  99. package/dist/components/CommitGraph/CommitGraph.stories.d.ts +15 -0
  100. package/dist/components/CommitGraph/graphLanes.d.ts +56 -0
  101. package/dist/components/Composer/Composer.d.ts +31 -0
  102. package/dist/components/Composer/Composer.stories.d.ts +17 -0
  103. package/dist/components/Container/Container.d.ts +11 -0
  104. package/dist/components/Container/Container.stories.d.ts +14 -0
  105. package/dist/components/DataTable/DataTable.d.ts +79 -0
  106. package/dist/components/DataTable/DataTable.stories.d.ts +26 -0
  107. package/dist/components/DataTable/table-helpers.d.ts +16 -0
  108. package/dist/components/DataTable/table-reorder.d.ts +40 -0
  109. package/dist/components/DatePicker/Calendar.d.ts +51 -0
  110. package/dist/components/DatePicker/DatePicker.d.ts +51 -0
  111. package/dist/components/DatePicker/DatePicker.stories.d.ts +42 -0
  112. package/dist/components/DateRangePicker/DateRangePicker.d.ts +59 -0
  113. package/dist/components/DateRangePicker/DateRangePicker.stories.d.ts +42 -0
  114. package/dist/components/DescriptionList/DescriptionList.d.ts +14 -0
  115. package/dist/components/DescriptionList/DescriptionList.stories.d.ts +21 -0
  116. package/dist/components/Dialog/Dialog.d.ts +43 -0
  117. package/dist/components/Dialog/Dialog.stories.d.ts +22 -0
  118. package/dist/components/DiffStat/DiffStat.d.ts +12 -0
  119. package/dist/components/DiffStat/DiffStat.stories.d.ts +15 -0
  120. package/dist/components/Disclosure/Disclosure.d.ts +18 -0
  121. package/dist/components/Disclosure/Disclosure.stories.d.ts +27 -0
  122. package/dist/components/DonutChart/DonutChart.d.ts +30 -0
  123. package/dist/components/DonutChart/DonutChart.stories.d.ts +26 -0
  124. package/dist/components/Drawer/Drawer.d.ts +27 -0
  125. package/dist/components/Drawer/Drawer.stories.d.ts +18 -0
  126. package/dist/components/Emblem/Emblem.d.ts +19 -0
  127. package/dist/components/Emblem/Emblem.stories.d.ts +19 -0
  128. package/dist/components/EmptyState/EmptyState.d.ts +43 -0
  129. package/dist/components/EmptyState/EmptyState.stories.d.ts +17 -0
  130. package/dist/components/EndpointPanel/EndpointPanel.d.ts +29 -0
  131. package/dist/components/FacetFilter/FacetFilter.d.ts +39 -0
  132. package/dist/components/FacetFilter/FacetFilter.stories.d.ts +23 -0
  133. package/dist/components/FacetFilter/facet-helpers.d.ts +5 -0
  134. package/dist/components/Field/Field.d.ts +27 -0
  135. package/dist/components/Field/Field.stories.d.ts +25 -0
  136. package/dist/components/FieldMessage/FieldMessage.d.ts +10 -0
  137. package/dist/components/FieldMessage/FieldMessage.stories.d.ts +14 -0
  138. package/dist/components/FileDrop/FileDrop.d.ts +72 -0
  139. package/dist/components/FileDrop/FileDrop.stories.d.ts +18 -0
  140. package/dist/components/FileIcon/FileIcon.d.ts +25 -0
  141. package/dist/components/FileIcon/FileIcon.stories.d.ts +14 -0
  142. package/dist/components/FilterChip/FilterChip.d.ts +9 -0
  143. package/dist/components/FilterChip/FilterChip.stories.d.ts +19 -0
  144. package/dist/components/FlowMap/FlowMap.d.ts +74 -0
  145. package/dist/components/FlowMap/FlowMap.stories.d.ts +24 -0
  146. package/dist/components/FontField/FontField.d.ts +15 -0
  147. package/dist/components/FontField/FontField.stories.d.ts +17 -0
  148. package/dist/components/FormDialog/FormDialog.d.ts +40 -0
  149. package/dist/components/FormDialog/FormDialog.stories.d.ts +22 -0
  150. package/dist/components/FormSection/FormSection.d.ts +19 -0
  151. package/dist/components/FormSection/FormSection.stories.d.ts +16 -0
  152. package/dist/components/Grid/Grid.d.ts +23 -0
  153. package/dist/components/Grid/Grid.stories.d.ts +19 -0
  154. package/dist/components/Grid/breakpoints.d.ts +25 -0
  155. package/dist/components/Heatmap/Heatmap.d.ts +22 -0
  156. package/dist/components/Heatmap/Heatmap.stories.d.ts +24 -0
  157. package/dist/components/Icon/Icon.d.ts +14 -0
  158. package/dist/components/Icon/Icon.stories.d.ts +20 -0
  159. package/dist/components/IconButton/IconButton.d.ts +16 -0
  160. package/dist/components/IconButton/IconButton.stories.d.ts +27 -0
  161. package/dist/components/Identity/Identity.d.ts +14 -0
  162. package/dist/components/Identity/Identity.stories.d.ts +14 -0
  163. package/dist/components/Kbd/Kbd.d.ts +5 -0
  164. package/dist/components/Kbd/Kbd.stories.d.ts +13 -0
  165. package/dist/components/Label/Label.d.ts +15 -0
  166. package/dist/components/Label/Label.stories.d.ts +16 -0
  167. package/dist/components/LaunchCard/LaunchCard.d.ts +36 -0
  168. package/dist/components/LaunchCard/LaunchCard.stories.d.ts +32 -0
  169. package/dist/components/List/List.d.ts +11 -0
  170. package/dist/components/List/List.stories.d.ts +13 -0
  171. package/dist/components/ListRow/ListRow.d.ts +20 -0
  172. package/dist/components/ListRow/ListRow.stories.d.ts +27 -0
  173. package/dist/components/Menu/Menu.d.ts +53 -0
  174. package/dist/components/Menu/Menu.stories.d.ts +85 -0
  175. package/dist/components/Menu/MenuButton.d.ts +23 -0
  176. package/dist/components/Menu/MenuButton.stories.d.ts +46 -0
  177. package/dist/components/Menu/menu-keys.d.ts +26 -0
  178. package/dist/components/Meter/Meter.d.ts +18 -0
  179. package/dist/components/Meter/Meter.stories.d.ts +34 -0
  180. package/dist/components/ModelChip/ModelChip.d.ts +26 -0
  181. package/dist/components/ModelChip/ModelChip.stories.d.ts +18 -0
  182. package/dist/components/NavList/NavList.d.ts +56 -0
  183. package/dist/components/NavList/NavList.stories.d.ts +25 -0
  184. package/dist/components/PageHeader/PageHeader.d.ts +14 -0
  185. package/dist/components/PageHeader/PageHeader.stories.d.ts +14 -0
  186. package/dist/components/Pagination/Pagination.d.ts +28 -0
  187. package/dist/components/Pagination/Pagination.stories.d.ts +16 -0
  188. package/dist/components/PairingCode/PairingCode.d.ts +17 -0
  189. package/dist/components/PairingCode/PairingCode.stories.d.ts +24 -0
  190. package/dist/components/PaletteTrigger/PaletteTrigger.d.ts +16 -0
  191. package/dist/components/PanZoom/PanZoom.d.ts +24 -0
  192. package/dist/components/PanZoom/PanZoom.stories.d.ts +11 -0
  193. package/dist/components/Popover/Popover.d.ts +24 -0
  194. package/dist/components/Popover/Popover.stories.d.ts +25 -0
  195. package/dist/components/Prose/Prose.d.ts +8 -0
  196. package/dist/components/Prose/Prose.stories.d.ts +12 -0
  197. package/dist/components/RadioGroup/RadioGroup.d.ts +27 -0
  198. package/dist/components/RadioGroup/RadioGroup.stories.d.ts +22 -0
  199. package/dist/components/ReactionBar/ReactionBar.d.ts +21 -0
  200. package/dist/components/ReactionBar/ReactionBar.stories.d.ts +26 -0
  201. package/dist/components/ResourceCard/ResourceCard.d.ts +30 -0
  202. package/dist/components/ResourceCard/ResourceCard.stories.d.ts +19 -0
  203. package/dist/components/ReviewComment/ReviewComment.d.ts +41 -0
  204. package/dist/components/ReviewComment/ReviewComment.stories.d.ts +19 -0
  205. package/dist/components/RouteDiagram/RouteDiagram.d.ts +27 -0
  206. package/dist/components/RunTimeline/RunTimeline.d.ts +28 -0
  207. package/dist/components/RunTimeline/RunTimeline.stories.d.ts +31 -0
  208. package/dist/components/SaveBar/SaveBar.d.ts +56 -0
  209. package/dist/components/SaveBar/SaveBar.stories.d.ts +16 -0
  210. package/dist/components/SearchInput/SearchInput.d.ts +22 -0
  211. package/dist/components/SearchInput/SearchInput.stories.d.ts +18 -0
  212. package/dist/components/SearchPicker/SearchPicker.d.ts +49 -0
  213. package/dist/components/SearchPicker/SearchPicker.stories.d.ts +33 -0
  214. package/dist/components/Segmented/Segmented.d.ts +18 -0
  215. package/dist/components/Segmented/Segmented.stories.d.ts +18 -0
  216. package/dist/components/Select/Select.d.ts +26 -0
  217. package/dist/components/Select/Select.stories.d.ts +22 -0
  218. package/dist/components/ServiceStatus/ServiceStatus.d.ts +13 -0
  219. package/dist/components/SessionBar/SessionBar.d.ts +33 -0
  220. package/dist/components/SessionBar/SessionBar.stories.d.ts +27 -0
  221. package/dist/components/SettingRow/SettingRow.d.ts +17 -0
  222. package/dist/components/SettingRow/SettingRow.stories.d.ts +26 -0
  223. package/dist/components/SettingsShell/SettingsShell.d.ts +52 -0
  224. package/dist/components/SettingsShell/SettingsShell.stories.d.ts +9 -0
  225. package/dist/components/ShellTitle/ShellTitle.d.ts +25 -0
  226. package/dist/components/SiteShell/SiteShell.d.ts +24 -0
  227. package/dist/components/SiteShell/SiteShell.stories.d.ts +18 -0
  228. package/dist/components/Skeleton/Skeleton.d.ts +20 -0
  229. package/dist/components/Skeleton/Skeleton.stories.d.ts +15 -0
  230. package/dist/components/SortableList/SortableList.d.ts +30 -0
  231. package/dist/components/SortableList/SortableList.stories.d.ts +16 -0
  232. package/dist/components/Spinner/Spinner.d.ts +15 -0
  233. package/dist/components/Spinner/Spinner.stories.d.ts +14 -0
  234. package/dist/components/SplitHandle/SplitHandle.d.ts +25 -0
  235. package/dist/components/SplitHandle/SplitHandle.stories.d.ts +18 -0
  236. package/dist/components/Stack/Stack.d.ts +18 -0
  237. package/dist/components/Stack/Stack.stories.d.ts +12 -0
  238. package/dist/components/StatTile/StatTile.d.ts +30 -0
  239. package/dist/components/StatTile/StatTile.stories.d.ts +32 -0
  240. package/dist/components/StatusBar/StatusBar.d.ts +8 -0
  241. package/dist/components/StatusBar/StatusBar.stories.d.ts +15 -0
  242. package/dist/components/StatusDot/StatusDot.d.ts +18 -0
  243. package/dist/components/StatusDot/StatusDot.stories.d.ts +24 -0
  244. package/dist/components/StepDots/StepDots.d.ts +15 -0
  245. package/dist/components/StepDots/StepDots.stories.d.ts +15 -0
  246. package/dist/components/SwatchGroup/SwatchGroup.d.ts +20 -0
  247. package/dist/components/SwatchGroup/SwatchGroup.stories.d.ts +33 -0
  248. package/dist/components/Switch/Switch.d.ts +10 -0
  249. package/dist/components/Switch/Switch.stories.d.ts +17 -0
  250. package/dist/components/TabStrip/TabStrip.d.ts +44 -0
  251. package/dist/components/TabStrip/TabStrip.stories.d.ts +66 -0
  252. package/dist/components/Tabs/Tabs.d.ts +28 -0
  253. package/dist/components/Tabs/Tabs.stories.d.ts +34 -0
  254. package/dist/components/Tag/Tag.d.ts +12 -0
  255. package/dist/components/Tag/Tag.stories.d.ts +21 -0
  256. package/dist/components/Textarea/Textarea.d.ts +15 -0
  257. package/dist/components/Textarea/Textarea.stories.d.ts +19 -0
  258. package/dist/components/ThemeEditor/ThemeEditor.d.ts +56 -0
  259. package/dist/components/ThemePreview/ThemePreview.d.ts +15 -0
  260. package/dist/components/ThemeSwitch/ThemeSwitch.d.ts +30 -0
  261. package/dist/components/ThemeSwitch/ThemeSwitch.stories.d.ts +15 -0
  262. package/dist/components/TimeField/TimeField.d.ts +32 -0
  263. package/dist/components/TimeField/TimeField.stories.d.ts +36 -0
  264. package/dist/components/TimeField/time-text.d.ts +26 -0
  265. package/dist/components/TimeSeriesChart/TimeSeriesChart.d.ts +30 -0
  266. package/dist/components/TimeSeriesChart/TimeSeriesChart.stories.d.ts +29 -0
  267. package/dist/components/Toast/Toast.d.ts +18 -0
  268. package/dist/components/Toast/Toast.stories.d.ts +15 -0
  269. package/dist/components/Toast/Toaster.d.ts +18 -0
  270. package/dist/components/Toast/Toaster.stories.d.ts +16 -0
  271. package/dist/components/Toast/toast-region.d.ts +17 -0
  272. package/dist/components/Toast/toast-store.d.ts +46 -0
  273. package/dist/components/ToggleButton/ToggleButton.d.ts +16 -0
  274. package/dist/components/ToggleButton/ToggleButton.stories.d.ts +20 -0
  275. package/dist/components/Toolbar/Toolbar.d.ts +21 -0
  276. package/dist/components/Toolbar/Toolbar.stories.d.ts +25 -0
  277. package/dist/components/Tooltip/Tooltip.d.ts +13 -0
  278. package/dist/components/Tooltip/Tooltip.stories.d.ts +23 -0
  279. package/dist/components/TreeView/TreeView.d.ts +42 -0
  280. package/dist/components/TreeView/TreeView.stories.d.ts +26 -0
  281. package/dist/components/TreeView/pathRows.d.ts +16 -0
  282. package/dist/components/TreeView/treeKeys.d.ts +16 -0
  283. package/dist/components/UsageMeterRow/UsageMeterRow.d.ts +28 -0
  284. package/dist/components/UsageMeterRow/UsageMeterRow.stories.d.ts +26 -0
  285. package/dist/components/WorktreeRow/WorktreeRow.d.ts +32 -0
  286. package/dist/components/WorktreeRow/WorktreeRow.stories.d.ts +32 -0
  287. package/dist/components/ZoomBar/ZoomBar.d.ts +22 -0
  288. package/dist/components/ZoomBar/ZoomBar.stories.d.ts +17 -0
  289. package/dist/editor/RichTextEditor/EditorToolbar.d.ts +35 -0
  290. package/dist/editor/RichTextEditor/ImageBar.d.ts +17 -0
  291. package/dist/editor/RichTextEditor/LinkForm.d.ts +16 -0
  292. package/dist/editor/RichTextEditor/RichTextEditor.d.ts +45 -0
  293. package/dist/editor/RichTextEditor/RichTextEditor.stories.d.ts +43 -0
  294. package/dist/editor/RichTextEditor/extensions.d.ts +23 -0
  295. package/dist/editor/RichTextEditor/icons.d.ts +23 -0
  296. package/dist/editor/RichTextEditor/insertImage.d.ts +28 -0
  297. package/dist/editor/RichTextEditor/labels.d.ts +32 -0
  298. package/dist/editor/index.d.ts +4 -0
  299. package/dist/editor.js +629 -0
  300. package/dist/editor.js.map +1 -0
  301. package/dist/fonts.css +2 -0
  302. package/dist/icons.d.ts +891 -0
  303. package/dist/image/ImageCropper/ImageCropper.d.ts +39 -0
  304. package/dist/image/ImageCropper/ImageCropper.stories.d.ts +18 -0
  305. package/dist/image/ImageField/ImageField.d.ts +86 -0
  306. package/dist/image/ImageField/ImageField.stories.d.ts +29 -0
  307. package/dist/image/crop.d.ts +39 -0
  308. package/dist/image/index.d.ts +3 -0
  309. package/dist/image.js +377 -0
  310. package/dist/image.js.map +1 -0
  311. package/dist/index.d.ts +138 -0
  312. package/dist/index.js +8253 -0
  313. package/dist/index.js.map +1 -0
  314. package/dist/internal/cx.d.ts +2 -0
  315. package/dist/internal/date.d.ts +96 -0
  316. package/dist/internal/duration.d.ts +4 -0
  317. package/dist/internal/focus.d.ts +34 -0
  318. package/dist/internal/keys.d.ts +21 -0
  319. package/dist/internal/modal.d.ts +8 -0
  320. package/dist/internal/portal.d.ts +9 -0
  321. package/dist/internal/position.d.ts +37 -0
  322. package/dist/internal/reveal.d.ts +6 -0
  323. package/dist/internal/roving.d.ts +25 -0
  324. package/dist/internal/scroll-fade.d.ts +16 -0
  325. package/dist/internal/session-labels.d.ts +3 -0
  326. package/dist/internal/text.d.ts +2 -0
  327. package/dist/llms-full.txt +9786 -0
  328. package/dist/llms.txt +162 -0
  329. package/dist/mcp.js +24706 -0
  330. package/dist/panZoom.d.ts +40 -0
  331. package/dist/styles.css +2 -0
  332. package/dist/styles.layered.css +4 -0
  333. package/dist/tailwind.css +38 -0
  334. package/dist/test-utils.d.ts +5 -0
  335. package/dist/theme/font.d.ts +20 -0
  336. package/dist/theme/index.d.ts +2 -0
  337. package/dist/theme/theme.d.ts +62 -0
  338. package/dist/tokens.css +304 -0
  339. package/dist/tokens.json +267 -0
  340. package/dist/types.d.ts +6 -0
  341. package/package.json +177 -4
  342. package/skills/xdev-ui-admin/SKILL.md +106 -0
  343. package/skills/xdev-ui-admin/references/audit-log.md +18 -0
  344. package/skills/xdev-ui-admin/references/console-chrome.md +119 -0
  345. package/skills/xdev-ui-admin/references/dashboard.md +24 -0
  346. package/skills/xdev-ui-admin/references/detail-and-forms.md +22 -0
  347. package/skills/xdev-ui-admin/references/dialogs.md +33 -0
  348. package/skills/xdev-ui-admin/references/forms.md +60 -0
  349. package/skills/xdev-ui-admin/references/from-other-kits.md +75 -0
  350. package/skills/xdev-ui-admin/references/layout.md +58 -0
  351. package/skills/xdev-ui-admin/references/navigation.md +10 -0
  352. package/skills/xdev-ui-admin/references/permissions.md +26 -0
  353. package/skills/xdev-ui-admin/references/resource-list.md +64 -0
  354. package/skills/xdev-ui-admin/references/responsive.md +68 -0
  355. package/skills/xdev-ui-admin/references/rich-content.md +37 -0
  356. package/skills/xdev-ui-admin/references/settings.md +20 -0
  357. package/skills/xdev-ui-admin/references/sign-in.md +47 -0
  358. package/skills/xdev-ui-admin/references/states-feedback.md +26 -0
  359. package/skills/xdev-ui-admin/references/tree-list.md +50 -0
  360. package/skills/xdev-ui-admin/references/users-roles.md +32 -0
  361. package/skills/xdev-ui-admin/references/ux-principles.md +43 -0
  362. package/skills/xdev-ui-admin/references/visual-identity.md +62 -0
  363. package/skills/xdev-ui-admin/templates/admin/_gitignore +3 -0
  364. package/skills/xdev-ui-admin/templates/admin/_mcp.json +5 -0
  365. package/skills/xdev-ui-admin/templates/admin/_npmrc +2 -0
  366. package/skills/xdev-ui-admin/templates/admin/index.html +14 -0
  367. package/skills/xdev-ui-admin/templates/admin/package.json +24 -0
  368. package/skills/xdev-ui-admin/templates/admin/src/App.tsx +66 -0
  369. package/skills/xdev-ui-admin/templates/admin/src/app.css +26 -0
  370. package/skills/xdev-ui-admin/templates/admin/src/auth/permissions.ts +7 -0
  371. package/skills/xdev-ui-admin/templates/admin/src/auth/session.ts +42 -0
  372. package/skills/xdev-ui-admin/templates/admin/src/data/context.ts +11 -0
  373. package/skills/xdev-ui-admin/templates/admin/src/data/store.ts +84 -0
  374. package/skills/xdev-ui-admin/templates/admin/src/data/useLoad.ts +25 -0
  375. package/skills/xdev-ui-admin/templates/admin/src/i18n/en.ts +98 -0
  376. package/skills/xdev-ui-admin/templates/admin/src/i18n/index.tsx +63 -0
  377. package/skills/xdev-ui-admin/templates/admin/src/i18n/vi.ts +98 -0
  378. package/skills/xdev-ui-admin/templates/admin/src/i18n/xdev-ui-labels.ts +47 -0
  379. package/skills/xdev-ui-admin/templates/admin/src/main.tsx +12 -0
  380. package/skills/xdev-ui-admin/templates/admin/src/notify.tsx +36 -0
  381. package/skills/xdev-ui-admin/templates/admin/src/pages/Dashboard.tsx +55 -0
  382. package/skills/xdev-ui-admin/templates/admin/src/pages/ItemDetail.tsx +83 -0
  383. package/skills/xdev-ui-admin/templates/admin/src/pages/ItemsList.tsx +140 -0
  384. package/skills/xdev-ui-admin/templates/admin/src/pages/NotFound.tsx +17 -0
  385. package/skills/xdev-ui-admin/templates/admin/src/pages/Settings.tsx +37 -0
  386. package/skills/xdev-ui-admin/templates/admin/src/pages/SignIn.tsx +105 -0
  387. package/skills/xdev-ui-admin/templates/admin/src/router.ts +49 -0
  388. package/skills/xdev-ui-admin/templates/admin/src/shell/AccountMenu.tsx +36 -0
  389. package/skills/xdev-ui-admin/templates/admin/src/shell/Shell.tsx +53 -0
  390. package/skills/xdev-ui-admin/templates/admin/src/theme.ts +34 -0
  391. package/skills/xdev-ui-admin/templates/admin/tsconfig.json +16 -0
  392. package/skills/xdev-ui-admin/templates/admin/vite.config.ts +4 -0
  393. package/skills/xdev-ui-build-app/SKILL.md +85 -0
  394. package/skills/xdev-ui-build-app/references/app-shell.md +20 -0
  395. package/skills/xdev-ui-build-app/references/i18n.md +9 -0
  396. package/skills/xdev-ui-build-app/references/responsive-a11y.md +10 -0
  397. package/skills/xdev-ui-build-app/references/routing.md +14 -0
  398. package/skills/xdev-ui-build-app/references/setup.md +25 -0
  399. package/skills/xdev-ui-build-app/references/states.md +25 -0
  400. package/skills/xdev-ui-build-app/references/theme.md +11 -0
  401. package/skills/xdev-ui-build-app/templates/app/_gitignore +3 -0
  402. package/skills/xdev-ui-build-app/templates/app/_mcp.json +5 -0
  403. package/skills/xdev-ui-build-app/templates/app/_npmrc +2 -0
  404. package/skills/xdev-ui-build-app/templates/app/index.html +14 -0
  405. package/skills/xdev-ui-build-app/templates/app/package.json +24 -0
  406. package/skills/xdev-ui-build-app/templates/app/src/App.tsx +77 -0
  407. package/skills/xdev-ui-build-app/templates/app/src/app.css +3 -0
  408. package/skills/xdev-ui-build-app/templates/app/src/i18n/en.ts +35 -0
  409. package/skills/xdev-ui-build-app/templates/app/src/i18n/index.tsx +63 -0
  410. package/skills/xdev-ui-build-app/templates/app/src/i18n/vi.ts +35 -0
  411. package/skills/xdev-ui-build-app/templates/app/src/i18n/xdev-ui-labels.ts +19 -0
  412. package/skills/xdev-ui-build-app/templates/app/src/main.tsx +12 -0
  413. package/skills/xdev-ui-build-app/templates/app/src/notify.tsx +36 -0
  414. package/skills/xdev-ui-build-app/templates/app/src/pages/Home.tsx +22 -0
  415. package/skills/xdev-ui-build-app/templates/app/src/pages/NotFound.tsx +17 -0
  416. package/skills/xdev-ui-build-app/templates/app/src/pages/Settings.tsx +35 -0
  417. package/skills/xdev-ui-build-app/templates/app/src/router.ts +26 -0
  418. package/skills/xdev-ui-build-app/templates/app/src/theme.ts +34 -0
  419. package/skills/xdev-ui-build-app/templates/app/tsconfig.json +16 -0
  420. package/skills/xdev-ui-build-app/templates/app/vite.config.ts +4 -0
  421. package/skills/xdev-ui-design/SKILL.md +111 -0
  422. package/skills/xdev-ui-design/references/brand.md +58 -0
  423. package/skills/xdev-ui-design/references/checklist.md +55 -0
  424. package/skills/xdev-ui-design/references/owner-notes.md +54 -0
  425. package/skills/xdev-ui-design/references/porting.md +56 -0
  426. package/skills/xdev-ui-design/references/rules.md +135 -0
  427. package/skills/xdev-ui-design/references/screens.md +61 -0
  428. package/skills/xdev-ui-design/references/tokens.md +97 -0
  429. package/skills/xdev-ui-improve/SKILL.md +96 -0
  430. package/skills/xdev-ui-improve/references/plan-template.md +59 -0
  431. package/skills/xdev-ui-motion/SKILL.md +87 -0
  432. package/skills/xdev-ui-motion/references/recipes.md +117 -0
  433. package/skills/xdev-ui-review/SKILL.md +141 -0
  434. package/skills/xdev-ui-review/references/checklist.md +92 -0
  435. package/skills/xdev-ui-review/references/grep-recipes.md +37 -0
  436. package/skills/xdev-ui-review/references/pages/dashboard.md +21 -0
  437. package/skills/xdev-ui-review/references/pages/dialogs-forms.md +23 -0
  438. package/skills/xdev-ui-review/references/pages/list.md +22 -0
  439. package/skills/xdev-ui-review/references/pages/provider-grid.md +19 -0
  440. package/skills/xdev-ui-review/references/pages/settings.md +18 -0
  441. package/skills/xdev-ui-review/references/pages/sign-in.md +21 -0
  442. package/skills/xdev-ui-review/references/web-interface.md +73 -0
  443. package/skills/xdev-ui-review/scripts/audit.mjs +775 -0
  444. package/skills/xdev-ui-ux-standards/SKILL.md +88 -0
  445. package/skills/xdev-ui-ux-standards/references/heuristics-checklist.md +129 -0
  446. package/skills/xdev-ui-ux-standards/references/patterns.md +120 -0
  447. package/skills/xdev-ui-ux-standards/references/platforms.md +104 -0
  448. package/skills/xdev-ui-ux-standards/references/standards-map.md +144 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["seq","listeners","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","pct","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","Fragment","menuTriggerKey","menuTriggerKey","_Fragment","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","pad","_Fragment","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","Fragment","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","clamp","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DOT","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","_Fragment","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","DEFAULT_LABELS","Badge","_Fragment","IconButton","Icon","cx","matchesAccept","ICONS","checkFiles","formatBytes","Spinner","FileDrop","clamp$1","usePortal","onViewportChange","resizeKey","positionPanel","rovingIndex","Popover","isShown","inertOutside","focusFirst","restoreFocus","focusableIn","trapTarget","useModal","Fragment$1","audio","playing","seq$1","onFail","listeners$1","set","next","l","fail","token","cb","element","el","playAudioPreview","onError","src","id","started","stopAudioPreview","audioPreviewStore","listener","AUDIO_PREVIEW_LABELS","useAudioPreview","useSyncExternalStore","AudioPreview","labels","key","playingId","name","icon","onClick","stop","play","cls","className","label","Button","scrollFade","overflowX","max","scrollWidth","clientWidth","pos","scrollLeft","start","end","scrollFadeRef","update","fade","ro","child","Segmented","inner","setInner","useState","defaultValue","options","current","value","o","onChange","HEX","normalizeHex","m","text","d","c","commitHexText","hex","ColorField","rest","auto","useId","fieldId","setText","bad","overridden","onReset","StatusDot","dot","pulse","state","pr","check","tone","ThemePreview","mode","title","sample","hint","button","Badge","status","ThemeEditor","keyLabel","groups","g","k","nameError","onName","children","onMode","colors","onColor","issues","i","SwatchGroup","ariaLabel","selected","size","option","CROCKFORD","DIGITS","normalizeCode","raw","keep","alphabet","out","ch","groupCode","chars","n","formatCode","code","group","sep","CodeInput","length","handle","clean","e","onComplete","groupSize","j","invalid","disabled","PairingCode","copyLabel","onCopy","THEME_PREFERENCES","PREFERS_DARK_QUERY","resolveTheme","pref","prefersDark","applyTheme","resolved","watchSystemTheme","mql","matchMedia","systemPrefersDark","currentTheme","root","onThemeChange","fn","observer","makeObserver","readThemeColors","style","getStyle","names","DEFAULT_LABELS$50","ThemeSwitch","variant","shown","ICON","p","v","Select","props","SelectControl","SelectField","_label","_hint","_error","_hide","sm","select","selectId","note","error","noteId","hideLabel","UI_FONT_SUGGESTIONS","FONT_NAME_MAX","CONTROL","fontStack","applyUiFont","stack","DEFAULT_LABELS$49","FontField","listId","suggestions","DEFAULT_LABELS$48","Field","inputId","hintId","labelEl","inputProps","mono","control","type","reveal","PasswordControl","action","setShown","input","DEFAULT_LABELS$47","Label","required","Switch","SwitchControl","SwitchWithHint","Kbd","avatarInitials","words","Avatar","failed","setFailed","showImage","Identity","detail","List","ordered","gap","Prose","Tag","swatch","onRemove","removeLabel","PROFILE_LETTER","AgentChip","profile","letter","DEFAULT_LABELS$46","added","removed","DiffStat","Comment","bot","author","botLabel","stateLabel","time","actions","location","footer","ReactionBar","items","item","onToggle","ServiceStatus","Meter","warnAt","fill","valueText","LEVELS","Heatmap","pad","startWeekday","first","cells","lessLabel","moreLabel","W","H","pct$1","valued","runs","cur","points","TimeSeriesChart","x","y","r2","segs","line","s","area","dots","maxLabel","zeroLabel","has","alone","ticks","t","pct","BarChart","bars","b","share","vertical","orientation","DONUT_COLORS","round","donutArcs","values","slices","total","a","arc","DonutChart","arcs","color","center","Banner","ToastRegionContext","createContext","toastRegions","urgent","splitUrgent","Children","nodes","isValidElement","DEFAULT_LABELS$45","TONE_ICON","Toast","inRegion","useContext","description","actionLabel","onAction","onDismiss","toastReducer","at","visibleToasts","toastDuration","ms","EMPTY","seq","listeners","dispatch","toastStore","toast","DEFAULT_LABELS$44","Toaster","paused","setPaused","timers","useRef","shownKey","map","ids","timer","now","render","position","moveTab","pinned","floor","to","DEFAULT_LABELS$43","TabStrip","defaultSelected","tabs","uid","tabId","dragging","setDragging","over","setOver","onKeyDown","list","onReorder","onClose","isSel","movable","onSelect","onAdd","APPS","APP_LABELS","ActivityBar","active","pending","changeCount","badge","extra","it","apps","base","extraItems","bottomItems","StatusBar","hidden","ITEMS","triggers","menuTriggerKey","setRef","r","Menu","focusTrigger","closeFrom","menu","target","roving","ref","initialFocus","enabled","cand","isCheck","choose","content","Fragment","linkProps","renderLink","menuTriggerKey$1","menuKeyStep","index","count","menuTypeahead","q","query","from","ITEM","TYPEAHEAD_MS","MenuButton","menuId","triggerId","open","setOpen","anchor","pop","focusOnOpen","typed","inPortal","portal","portalled","itemEls","triggerEl","close","restore","openAt","where","useLayoutEffect","els","place","align","useEffect","onFocus","onTriggerKey","onTriggerClick","onMenuKey","step","hit","aria","menuLabel","DEFAULT_LABELS$42","Dialog","cancelText","cancelLabel","titleId","descId","bodyId","backdropRef","modal","triggerRef","trigger","release","body","busy","onCancel","asText","alert","dismissible","jsx","secondaryActions","onConfirm","confirmDisabled","confirmLabel","DEFAULT_LABELS$41","FormDialog","panel","cancel","submit","onSubmit","panelProps","formId","submitDisabled","submitLabel","DEFAULT_LABELS$40","Drawer","side","MIN_ZOOM","MAX_ZOOM","ZOOM_STEP","fitScale","w","box","opts","h","img","clampZoom","min","z","stepZoom","dir","zoomAt","zoom","factor","point","percentOf","fit","zoomKey","wheelFactor","deltaY","PanZoom","drag","node","onWheel","onZoom","onPointerDown","onPointerMove","onPan","onPointerUp","ICON_SIZE","Emblem","FLOW_NODE","FLOW_HUB","PAD","GRID","FIT_MAX","MIN","MAX","DEFAULT_LABELS$39","flowMapLayout","rx","ry","SIDE_GAP","ROW_GAP","flowMapSides","column","left","right","hubY","curve","mx","x1","x2","y1","y2","clamp01","bounds","minX","maxX","minY","maxY","packets","weight","dur","Edge","run","begin","Node","FlowMap","sides","sources","placed","world","setBox","view","setView","setAuto","useCallback","entry","change","refit","centre","hub","Side","RouteDiagram","inputs","outputs","Card","head","subtitle","Heading","headingLevel","titleAside","monoSubtitle","bodyClassName","flush","DEFAULT_LABELS$38","COPIED_MS","CodeBlock","canCopy","setCanCopy","copied","setCopied","copy","language","DEFAULT_LABELS$37","EndpointPanel","aside","url","urlLabel","paths","ROVING_ITEMS","remembered","setRovingStop","rovingRef","last","rovingFocus","rovingKeyDown","DEFAULT_LABELS$36","ZoomBar","onZoomOut","onFit","onZoomIn","onActual","row","DEFAULT_LABELS$35","highlight","CommandPalette","rowFilter","setQ","defaultQuery","filter","setFilter","filters","needle","sections","optionId","flat","setAt","innerScope","setInnerScope","scopes","byId","activeId","clamped","onInputKeyDown","onActiveChange","framed","placeholder","onQueryChange","dialog","inputAddon","scope","onScopeChange","f","idx","emptyText","DEFAULT_LABELS$34","isMac","PaletteTrigger","mac","setMac","onOpen","hotkey","onKey","NAME","fullName","system","YOU","YOU_UPPER","YOU_LOWER","AGENT","AGENT_UPPER","AGENT_LOWER","CORE","AGENT_ORANGE","LIT_FROM","SUB_SHIFT","AgentShape","SHAPE_FIT","FlatBlades","you","MarkSvg","FlatTile","LitTile","shadow","Tile","BrandMark","lead","DIRS","NAMES","EXTS","add","exts","rule","fileIcon","kind","named","FileIcon","Checkbox","indeterminate","RadioGroup","labelId","off","Textarea","resize","DEFAULT_LABELS$33","SearchInput","hasValue","onClear","field","shortcut","DEFAULT_LABELS$32","firstEnabled","searchPickerKey","SearchPicker","chosen","setChosen","showLabel","onValueChange","result","onPick","foldText","DEFAULT_LABELS$31","comboboxFilter","COMBOBOX_CREATE","comboboxRows","rows","comboboxKey","none","idAt","move","Combobox","describedBy","defaultOpen","setQuery","labelOf","onCreate","rowIndex","expanded","showList","setValues","pick","isActive","isChosen","pad$1","isLeapYear","daysInMonth","isValidYmd","toIso","parseIso","iso","mo","isIso","toDayNumber","yy","era","yoe","doy","doe","fromDayNumber","mp","must","dayNum","fromNum","isoFromDate","addDays","addMonths","ny","nm","addYears","clampIso","dayOfWeek","startOfWeek","weekStartsOn","endOfWeek","startOfMonth","monthGrid","isDayDisabled","isDateDisabled","gridKey","ws","readPattern","parts","format","order","formatDate","pat","parseDateText","orderRange","pickRange","utc","monthTitle","locale","weekdayNames","short","long","date","dayLabel","keepInView","focused","months","calendarKey","monthStepAllowed","Calendar","lo","hi","week","isStart","isEnd","DATE_PICKER_LABELS","DatePicker","rawValue","todayProp","today","setFocused","draft","setDraft","setBad","gridRef","moveFocus","show","commit","onInputKey","todayOff","DATE_RANGE_PICKER_LABELS","setRangeEnd","range","which","DateRangePicker","setPending","hover","setHover","pickDay","inputKey","shownEnd","sameRange","presets","maxMin","span","build","parseTime","last2","timeToSeconds","formatTime","totalSeconds","stepTime","unit","steps","TIME_FIELD_LABELS","TimeField","seconds","seen","setSeen","fresh","flagged","committed","settle","FilterChip","pressed","nextPressed","ToggleButton","click","event","onPressedChange","ActionTile","ListRow","Root","leading","meta","trailing","ResourceCard","main","dimmed","revealTrailing","href","ModelChip","codeAction","ModelChipAdd","DEFAULT_LABELS$30","StepDots","DEFAULT_LABELS$29","EmptyState","art","figure","SettingRow","controlId","flash","DEFAULT_LABELS$28","Skeleton","shape","lines","height","width","announce","FieldMessage","Tabs","refs","currentIndex","idPrefix","Disclosure","defaultExpanded","DEFAULT_LABELS$27","holds","NavList","collapsible","depthStyle","depth","accordion","parent","DEFAULT_LABELS$26","Breadcrumb","treeKey","below","DEFAULT_LABELS$25","LETTER","TreeView","focusId","setFocusId","activate","res","byName","pathRows","files","path","walk","only","closed","LANE_COLORS","graphRows","rotate","refColor","marks","previous","lane","firstParent","output","laneLinks","nodeId","matched","passCount","forkCount","passes","joins","forks","spot","spotLane","GRAPH_ROW_HEIGHT","GRAPH_LANE_WIDTH","RADIUS","NODE_Y","graphWidth","laneVar","toNode","fromNode","shift","CommitGraph","links","nx","stroke","DEFAULT_LABELS$24","SplitHandle","axis","direction","onResize","delta","reverse","DEFAULT_LABELS$23","Toolbar","Tooltip","tipId","cloneElement","placement","COACHMARK_MARGIN","COACHMARK_GAP","ARROW_INSET","OPPOSITE","clamp","midX","midY","placeCoachmark","fits","viewport","flipped","top","arrow","DEFAULT_LABELS$22","ESTIMATE","viewportSize","Coachmark","setSize","setViewport","skip","onSkip","onBack","onNext","DEFAULT_LABELS$21","Composer","blank","send","onSend","onAttach","model","onModel","DEFAULT_LABELS$20","AppShell","sideId","menuRef","sideRef","colRef","onNavOpenChange","navOpen","col","navCollapsed","bottomNav","drawerBelow","chromeHidden","navHidden","mainId","sideTheme","brand","nav","navFooter","onNavCollapsedChange","crumbs","toasts","ShellTitle","mark","media","heading","trail","PageHeader","breadcrumb","FormSection","columns","Board","DEFAULT_LABELS$19","BoardColumn","forwardRef","dropTarget","DEFAULT_LABELS$18","DOT$1","BoardCard","handleKeyDown","handleClick","tags","DescriptionList","layout","DEFAULT_LABELS$17","StatTile","loading","deltaTone","deltaTrend","nextTableSort","compare","sortTableRows","sort","sign","paginateRows","pageSize","pages","page","tableSortToParam","tableSortFromParam","param","allowed","moveItem","array","isAction","reorderKeyStep","reorderSlot","slot","mids","slotToIndex","DEFAULT_LABELS$16","rowLabel","DataTable","ReorderableTable","renderTable","reorder","selectable","keys","rowKey","picked","all","toggleAll","toggleRow","onSelectedChange","colSpan","cellAttrs","role","sortable","onSortChange","sortName","caption","empty","liftState","setLift","setDrag","message","setMessage","handles","lift","liftedKey","nameOf","ev","dragTo","dropMark","DEFAULT_LABELS$15","SortableList","getKey","getLabel","renderItem","filterFacetOptions","toggleFacetValue","known","DEFAULT_LABELS$14","FacetFilter","showSearch","searchable","DEFAULT_LABELS$13","BulkBar","DEFAULT_LABELS$12","Pagination","pageSizeOptions","onPageSizeChange","onPageChange","hasNext","DEFAULT_LABELS$11","SaveBar","dirty","onDiscard","onSave","saveDisabled","isInAppNavigation","link","here","useUnsavedGuard","onBeforeUnload","guardLinks","Container","gutter","Stack","justify","wrap","SiteShell","hasFooter","linksLabel","AuthShell","pitch","headline","tagline","BREAKPOINTS","ORDER","breakpointFor","found","bp","atLeast","responsiveEntries","subscribe","lists","snapshot","useBreakpoint","vars","prefix","Grid","custom","minItemWidth","grid","responsive","GridItem","full","formatDuration","toEpoch","DEFAULT_LABELS$10","sortByWait","AttentionInbox","isOpen","onOpenChange","sorted","since","DEFAULT_LABELS$9","ApprovalBar","command","onAllow","onAlways","onDeny","SESSION_STATE_LABELS","DEFAULT_LABELS$8","SessionBar","elapsed","diff","DEFAULT_LABELS$7","WorktreeRow","branch","repo","agents","DEFAULT_LABELS$6","LaunchCard","patch","worktreeLabel","worktrees","modelLabel","models","advanced","onStart","DEFAULT_LABELS$5","TONE","UsageMeterRow","account","windows","DEFAULT_LABELS$4","DOT","RunTimeline","DEFAULT_LABELS$3","ReviewComment","toggle","onReopen","onResolve","toggleLabel","file","suggestion","DEFAULT_LABELS$2","matchesSetting","filterSettingsGroups","scrollToId","SettingsShell","contentId","matches","onQuery","saveBar","DEFAULT_LABELS$1","AgentRow","cli","summary","DEFAULT_LABELS","BOTTOM_NAV_MAX","Badge$1","BottomNav","own","setOwn","more","moreOpen","onMoreOpenChange","inMore","tab","moreCount","sum","ICON_NAMES"],"sources":["../src/components/AudioPreview/audio-preview-store.ts","../src/components/AudioPreview/AudioPreview.tsx","../src/internal/scroll-fade.ts","../src/components/Segmented/Segmented.tsx","../src/components/ColorField/ColorField.tsx","../src/components/StatusDot/StatusDot.tsx","../src/components/ThemePreview/ThemePreview.tsx","../src/components/Badge/Badge.tsx","../src/components/ThemeEditor/ThemeEditor.tsx","../src/components/SwatchGroup/SwatchGroup.tsx","../src/components/CodeInput/normalizeCode.ts","../src/components/CodeInput/CodeInput.tsx","../src/components/PairingCode/PairingCode.tsx","../src/theme/theme.ts","../src/components/ThemeSwitch/ThemeSwitch.tsx","../src/components/Select/Select.tsx","../src/theme/font.ts","../src/components/FontField/FontField.tsx","../src/components/Field/Field.tsx","../src/components/Label/Label.tsx","../src/components/Switch/Switch.tsx","../src/components/Kbd/Kbd.tsx","../src/components/Avatar/Avatar.tsx","../src/components/Identity/Identity.tsx","../src/components/List/List.tsx","../src/components/Prose/Prose.tsx","../src/components/Tag/Tag.tsx","../src/components/AgentChip/AgentChip.tsx","../src/components/DiffStat/DiffStat.tsx","../src/components/Comment/Comment.tsx","../src/components/ReactionBar/ReactionBar.tsx","../src/components/ServiceStatus/ServiceStatus.tsx","../src/components/Meter/Meter.tsx","../src/components/Heatmap/Heatmap.tsx","../src/components/TimeSeriesChart/TimeSeriesChart.tsx","../src/components/BarChart/BarChart.tsx","../src/components/DonutChart/DonutChart.tsx","../src/components/Banner/Banner.tsx","../src/components/Toast/toast-region.tsx","../src/components/Toast/Toast.tsx","../src/components/Toast/toast-store.ts","../src/components/Toast/Toaster.tsx","../src/components/TabStrip/TabStrip.tsx","../src/components/ActivityBar/ActivityBar.tsx","../src/components/StatusBar/StatusBar.tsx","../src/components/Menu/Menu.tsx","../src/components/Menu/menu-keys.ts","../src/components/Menu/MenuButton.tsx","../src/components/Dialog/Dialog.tsx","../src/components/FormDialog/FormDialog.tsx","../src/components/Drawer/Drawer.tsx","../src/panZoom.ts","../src/components/PanZoom/PanZoom.tsx","../src/components/Emblem/Emblem.tsx","../src/components/FlowMap/FlowMap.tsx","../src/components/RouteDiagram/RouteDiagram.tsx","../src/components/Card/Card.tsx","../src/components/CodeBlock/CodeBlock.tsx","../src/components/EndpointPanel/EndpointPanel.tsx","../src/internal/roving.ts","../src/components/ZoomBar/ZoomBar.tsx","../src/internal/reveal.ts","../src/components/CommandPalette/CommandPalette.tsx","../src/components/PaletteTrigger/PaletteTrigger.tsx","../src/components/BrandMark/BrandMark.tsx","../src/components/FileIcon/FileIcon.tsx","../src/components/Checkbox/Checkbox.tsx","../src/components/RadioGroup/RadioGroup.tsx","../src/components/Textarea/Textarea.tsx","../src/components/SearchInput/SearchInput.tsx","../src/components/SearchPicker/SearchPicker.tsx","../src/internal/text.ts","../src/components/Combobox/Combobox.tsx","../src/internal/date.ts","../src/components/DatePicker/Calendar.tsx","../src/components/DatePicker/DatePicker.tsx","../src/components/DateRangePicker/DateRangePicker.tsx","../src/components/TimeField/time-text.ts","../src/components/TimeField/TimeField.tsx","../src/components/FilterChip/FilterChip.tsx","../src/components/ToggleButton/ToggleButton.tsx","../src/components/ActionTile/ActionTile.tsx","../src/components/ListRow/ListRow.tsx","../src/components/ResourceCard/ResourceCard.tsx","../src/components/ModelChip/ModelChip.tsx","../src/components/StepDots/StepDots.tsx","../src/components/EmptyState/EmptyState.tsx","../src/components/SettingRow/SettingRow.tsx","../src/components/Skeleton/Skeleton.tsx","../src/components/FieldMessage/FieldMessage.tsx","../src/components/Tabs/Tabs.tsx","../src/components/Disclosure/Disclosure.tsx","../src/components/NavList/NavList.tsx","../src/components/Breadcrumb/Breadcrumb.tsx","../src/components/TreeView/treeKeys.ts","../src/components/TreeView/TreeView.tsx","../src/components/TreeView/pathRows.ts","../src/components/CommitGraph/graphLanes.ts","../src/components/CommitGraph/CommitGraph.tsx","../src/components/SplitHandle/SplitHandle.tsx","../src/components/Toolbar/Toolbar.tsx","../src/components/Tooltip/Tooltip.tsx","../src/components/Coachmark/placeCoachmark.ts","../src/components/Coachmark/Coachmark.tsx","../src/components/Composer/Composer.tsx","../src/components/AppShell/AppShell.tsx","../src/components/ShellTitle/ShellTitle.tsx","../src/components/PageHeader/PageHeader.tsx","../src/components/FormSection/FormSection.tsx","../src/components/Board/Board.tsx","../src/components/BoardColumn/BoardColumn.tsx","../src/components/BoardCard/BoardCard.tsx","../src/components/DescriptionList/DescriptionList.tsx","../src/components/StatTile/StatTile.tsx","../src/components/DataTable/table-helpers.ts","../src/components/DataTable/table-reorder.ts","../src/components/DataTable/DataTable.tsx","../src/components/SortableList/SortableList.tsx","../src/components/FacetFilter/facet-helpers.ts","../src/components/FacetFilter/FacetFilter.tsx","../src/components/BulkBar/BulkBar.tsx","../src/components/Pagination/Pagination.tsx","../src/components/SaveBar/SaveBar.tsx","../src/components/Container/Container.tsx","../src/components/Stack/Stack.tsx","../src/components/SiteShell/SiteShell.tsx","../src/components/AuthShell/AuthShell.tsx","../src/components/Grid/breakpoints.ts","../src/components/Grid/Grid.tsx","../src/internal/duration.ts","../src/components/AttentionInbox/AttentionInbox.tsx","../src/components/ApprovalBar/ApprovalBar.tsx","../src/internal/session-labels.ts","../src/components/SessionBar/SessionBar.tsx","../src/components/WorktreeRow/WorktreeRow.tsx","../src/components/LaunchCard/LaunchCard.tsx","../src/components/UsageMeterRow/UsageMeterRow.tsx","../src/components/RunTimeline/RunTimeline.tsx","../src/components/ReviewComment/ReviewComment.tsx","../src/components/SettingsShell/SettingsShell.tsx","../src/components/AgentRow/AgentRow.tsx","../src/components/BottomNav/BottomNav.tsx"],"sourcesContent":["/**\n * One clip at a time for the whole page: a lazily created module-level `HTMLAudioElement` and the id of the clip\n * it plays, read with `useSyncExternalStore`. No `Audio` exists on the server, where nothing plays.\n */\n\nlet audio: HTMLAudioElement | null = null;\nlet playing: string | null = null;\n/** Bumped on every play and stop, so a late rejection or error of an older clip changes nothing. */\nlet seq = 0;\nlet onFail: (() => void) | undefined;\nconst listeners = new Set<() => void>();\n\nfunction set(next: string | null): void {\n if (next === playing) return;\n playing = next;\n for (const l of listeners) l();\n}\n\nfunction fail(token: number): void {\n if (token !== seq || playing === null) return;\n const cb = onFail;\n onFail = undefined;\n set(null);\n cb?.();\n}\n\nfunction element(): HTMLAudioElement | null {\n if (audio) return audio;\n if (typeof Audio === \"undefined\") return null;\n const el = new Audio();\n el.preload = \"none\";\n el.addEventListener(\"ended\", () => {\n onFail = undefined;\n set(null);\n });\n el.addEventListener(\"error\", () => fail(seq));\n audio = el;\n return el;\n}\n\n/** Plays `src` as clip `id`, stopping whatever played. `onError` runs if this clip fails to load or play. */\nexport function playAudioPreview(id: string, src: string, onError?: () => void): void {\n const el = element();\n if (!el) return;\n const token = ++seq;\n el.pause();\n onFail = onError;\n el.src = src;\n set(id);\n let started: Promise<void> | undefined;\n try {\n started = el.play();\n } catch {\n return fail(token);\n }\n started?.catch(() => fail(token));\n}\n\n/** Stops whatever preview plays, for example when the dialog that holds the list closes. */\nexport function stopAudioPreview(): void {\n seq++;\n onFail = undefined;\n if (audio) {\n audio.pause();\n // Dropping the source also stops the download; with no src, load() fires no error.\n audio.removeAttribute(\"src\");\n audio.load();\n }\n set(null);\n}\n\n/** The store behind `useAudioPreview`, for `useSyncExternalStore`: the id of the playing clip, or null. */\nexport const audioPreviewStore = {\n subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => void listeners.delete(listener);\n },\n getSnapshot: (): string | null => playing,\n getServerSnapshot: (): string | null => null,\n};\n","import { useSyncExternalStore, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { audioPreviewStore, playAudioPreview, stopAudioPreview } from \"./audio-preview-store\";\n\nexport interface AudioPreviewLabels {\n /** Name of the button while idle (aria-label and title). */\n play: string;\n /** Name of the button while its clip plays. */\n stop: string;\n}\n\nexport const AUDIO_PREVIEW_LABELS: AudioPreviewLabels = { play: \"Play preview\", stop: \"Stop preview\" };\n\nexport interface AudioPreviewProps {\n /** Audio URL. */\n src: string;\n /** Identity of the clip for the playing state. Default `src`. */\n id?: string;\n /** Visible text after the icon; the button then renders as a secondary `Button` with the icon. */\n label?: ReactNode;\n /** Default \"sm\". */\n size?: \"sm\" | \"md\";\n disabled?: boolean;\n /** The clip failed to load or play; the button is back to \"play\". */\n onError?: () => void;\n labels?: Partial<AudioPreviewLabels>;\n className?: string;\n}\n\nexport interface AudioPreviewControls {\n /** Id of the clip playing on the page, or null. */\n playingId: string | null;\n /** Plays `src` as clip `id`, stopping whatever played. */\n play(id: string, src: string, onError?: () => void): void;\n stop(): void;\n}\n\n/** The page-wide preview player: which clip plays, and play and stop. Server render: nothing plays. */\nexport function useAudioPreview(): AudioPreviewControls {\n const playingId = useSyncExternalStore(audioPreviewStore.subscribe, audioPreviewStore.getSnapshot, audioPreviewStore.getServerSnapshot);\n return { playingId, play: playAudioPreview, stop: stopAudioPreview };\n}\n\nexport function AudioPreview({ src, id, label, size = \"sm\", disabled, onError, labels, className }: AudioPreviewProps): JSX.Element {\n const l = { ...AUDIO_PREVIEW_LABELS, ...labels };\n const { playingId, play, stop } = useAudioPreview();\n const key = id ?? src;\n const playing = playingId === key;\n const name = playing ? l.stop : l.play;\n const icon = playing ? \"stop\" : \"play\";\n const onClick = (): void => (playing ? stop() : play(key, src, onError));\n const cls = cx(\"x-audio-preview\", className);\n if (label != null && label !== false && label !== \"\")\n return (\n <Button variant=\"secondary\" size={size} icon={icon} title={name} aria-pressed={playing} data-playing={playing || undefined} disabled={disabled} className={cls} onClick={onClick}>\n {label}\n </Button>\n );\n return <IconButton icon={icon} label={name} size={size} data-playing={playing || undefined} disabled={disabled} className={cls} onClick={onClick} />;\n}\n","/**\n * Edge fade for a row that scrolls sideways (Segmented, Tabs): `data-scroll-fade` names the side or sides that\n * hide more content, and the CSS masks that edge. Pure of React: pass `scrollFadeRef` as the row's callback ref.\n */\n\nexport type ScrollFade = \"start\" | \"end\" | \"both\";\n\ninterface Metrics {\n scrollLeft: number;\n scrollWidth: number;\n clientWidth: number;\n overflowX: string;\n}\n\n/** Which sides hide content. Right-to-left rows report a negative scrollLeft, so the distance is its absolute value. */\nexport function scrollFade({ scrollLeft, scrollWidth, clientWidth, overflowX }: Metrics): ScrollFade | undefined {\n if (overflowX !== \"auto\" && overflowX !== \"scroll\") return undefined;\n const max = scrollWidth - clientWidth;\n if (max <= 1) return undefined;\n const pos = Math.abs(scrollLeft);\n const start = pos > 1;\n const end = pos < max - 1;\n return start && end ? \"both\" : start ? \"start\" : end ? \"end\" : undefined;\n}\n\n/** Callback ref (React 19 cleanup): keeps `data-scroll-fade` current on scroll and resize. */\nexport function scrollFadeRef(el: HTMLElement | null): (() => void) | undefined {\n if (!el) return undefined;\n const update = (): void => {\n const fade = scrollFade({ scrollLeft: el.scrollLeft, scrollWidth: el.scrollWidth, clientWidth: el.clientWidth, overflowX: getComputedStyle(el).overflowX });\n if (fade) el.dataset.scrollFade = fade;\n else delete el.dataset.scrollFade;\n };\n update();\n el.addEventListener(\"scroll\", update, { passive: true });\n if (typeof ResizeObserver === \"function\") {\n // The row and its items: an item growing (a new badge, a translated label) changes the overflow too.\n const ro = new ResizeObserver(update);\n ro.observe(el);\n for (const child of Array.from(el.children)) ro.observe(child);\n return () => {\n el.removeEventListener(\"scroll\", update);\n ro.disconnect();\n };\n }\n window.addEventListener(\"resize\", update);\n return () => {\n el.removeEventListener(\"scroll\", update);\n window.removeEventListener(\"resize\", update);\n };\n}\n","import { useState, type JSX } from \"react\";\nimport { scrollFadeRef } from \"../../internal/scroll-fade\";\n\nexport interface SegmentedOption {\n value: string;\n label: string;\n /** Small count shown after the label (0 is shown). */\n count?: number;\n}\n\nexport interface SegmentedProps {\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** aria-label of the group. */\n label?: string;\n /** Greys out every segment, for example while a save is under way. */\n disabled?: boolean;\n}\n\nexport function Segmented({ options, value, defaultValue, onChange, label, disabled }: SegmentedProps): JSX.Element {\n const [inner, setInner] = useState(defaultValue ?? options[0]?.value);\n const current = value ?? inner;\n return (\n <div className=\"segmented\" role=\"group\" aria-label={label} ref={scrollFadeRef}>\n {options.map((o) => (\n <button\n key={o.value}\n type=\"button\"\n aria-pressed={o.value === current}\n disabled={disabled}\n onClick={() => {\n setInner(o.value);\n onChange?.(o.value);\n }}\n >\n {o.label}\n {o.count != null ? <span className=\"segmented-count\">{o.count}</span> : null}\n </button>\n ))}\n </div>\n );\n}\n","import { useEffect, useId, useState, type HTMLAttributes, type JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nconst HEX = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/** Reads `#rgb` or `#rrggbb` (with or without `#`, any case) and returns lower-case `#rrggbb`, or null. */\nexport function normalizeHex(text: string): string | null {\n const m = HEX.exec(text.trim());\n if (!m) return null;\n const d = m[1]?.toLowerCase();\n if (!d) return null;\n const full = d.length === 3 ? [...d].map((c) => c + c).join(\"\") : d;\n return `#${full}`;\n}\n\n/** Calls `onChange` with the normalised colour when `text` is a valid hex; returns whether it did. */\nexport function commitHexText(text: string, onChange: (hex: string) => void): boolean {\n const hex = normalizeHex(text);\n if (hex) onChange(hex);\n return hex !== null;\n}\n\nexport interface ColorFieldLabels {\n /** Label of the reset button. */\n reset: string;\n /** aria-label of the colour swatch. */\n picker: string;\n /** Message shown while the hex text is not a colour. */\n invalid: string;\n}\n\nexport interface ColorFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"id\"> {\n /** The token name, shown as the visible label. */\n label: string;\n /** The colour in force: `#rrggbb`. */\n value: string;\n /** Whether a value of the user replaces the built-in one; enables reset. */\n overridden: boolean;\n /** Called with a valid lower-case `#rrggbb` only. */\n onChange: (hex: string) => void;\n onReset: () => void;\n labels: ColorFieldLabels;\n /** Id of the hex field; generated when omitted. */\n id?: string;\n \"data-key\"?: string;\n}\n\nexport function ColorField({ label, value, overridden, onChange, onReset, labels, id, className, ...rest }: ColorFieldProps): JSX.Element {\n const auto = useId();\n const fieldId = id ?? `x-colour-${auto}`;\n const [text, setText] = useState(value);\n // The committed value moves (reset, mode switch): the text follows it.\n useEffect(() => setText(value), [value]);\n const bad = normalizeHex(text) === null;\n return (\n <div className={cx(\"x-colour-field\", className)} {...rest}>\n <label className=\"x-colour-field-name\" htmlFor={fieldId}>\n {label}\n </label>\n <input\n type=\"color\"\n className=\"x-colour-field-swatch\"\n aria-label={labels.picker}\n // An empty value is sanitised by the browser to its default colour.\n value={normalizeHex(value) ?? \"\"}\n onChange={(e) => onChange(e.target.value)}\n />\n <input\n id={fieldId}\n className=\"x-colour-field-hex\"\n type=\"text\"\n spellCheck={false}\n autoComplete=\"off\"\n maxLength={7}\n value={text}\n aria-invalid={bad ? true : undefined}\n aria-describedby={bad ? `${fieldId}-error` : undefined}\n onChange={(e) => {\n setText(e.target.value);\n commitHexText(e.target.value, onChange);\n }}\n onBlur={() => {\n if (bad) setText(value);\n }}\n />\n <IconButton className=\"x-colour-field-reset\" icon=\"undo\" label={labels.reset} disabled={!overridden} onClick={onReset} />\n {bad ? (\n <small className=\"x-colour-field-error\" id={`${fieldId}-error`}>\n {labels.invalid}\n </small>\n ) : null}\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { CheckState, PrState, SessionState } from \"../../types\";\n\nexport type StatusTone = \"ok\" | \"warn\" | \"danger\" | \"accent\" | \"neutral\";\n\n/** Pass exactly one of state, pr, check, tone. */\nexport interface StatusDotProps {\n state?: SessionState;\n pr?: PrState;\n check?: CheckState;\n /** Generic status that is not a session, PR or check, e.g. a user who is active, invited or suspended. */\n tone?: StatusTone;\n /** Only with state=\"working\". */\n pulse?: boolean;\n /** Visible text set right after the dot; the dot is then decorative. */\n label?: ReactNode;\n /** Class on the outer element: the `.x-dot-label` wrapper with a label, the dot itself without. */\n className?: string;\n}\n\nexport function StatusDot({ state, pr, check, tone, pulse, label, className }: StatusDotProps): JSX.Element {\n const dot = (\n <span\n className={cx(\"ws-dot\", pulse && \"ws-pulse\", !label && className)}\n aria-hidden={label ? true : undefined}\n data-state={state}\n data-pr={pr}\n data-check={check}\n data-tone={tone}\n />\n );\n if (!label) return dot;\n return (\n <span className={cx(\"x-dot-label\", className)}>\n {dot}\n {label}\n </span>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\n\nexport interface ThemePreviewProps {\n /** The mode shown. The card sets its own `data-theme`, so that mode's tokens paint it. */\n mode: \"dark\" | \"light\";\n /** Heading and accessible name of the card. */\n title: string;\n /** Sample body text. */\n sample: string;\n /** Sample hint text (muted). */\n hint: string;\n /** Text of the sample button. */\n button: string;\n className?: string;\n}\n\nexport function ThemePreview({ mode, title, sample, hint, button, className }: ThemePreviewProps): JSX.Element {\n return (\n <section className={cx(\"x-theme-preview\", className)} data-theme={mode} aria-label={title}>\n <h5 className=\"x-theme-preview-title\">{title}</h5>\n <p className=\"x-theme-preview-text\">{sample}</p>\n <p className=\"x-theme-preview-hint\">{hint}</p>\n <div className=\"x-theme-preview-row\">\n <span className=\"x-theme-preview-button\">{button}</span>\n <StatusDot tone=\"ok\" />\n <StatusDot tone=\"warn\" />\n <StatusDot tone=\"danger\" />\n </div>\n </section>\n );\n}\n","import type { HTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport type BadgeTone = \"neutral\" | \"accent\" | \"ok\" | \"warn\" | \"danger\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Sync status of a file or kit item. */\n status?: \"new\" | \"changed\" | \"unchanged\" | \"foreign\" | \"neutral\";\n /**\n * Semantic tone for a state word (\"active\", \"draft\", \"failed\", \"pending\", \"internal\").\n * When both are set, the tone's look wins; `data-status` is still written.\n */\n tone?: BadgeTone;\n className?: string;\n children: ReactNode;\n}\n\nexport function Badge({ status, tone, className, children, ...rest }: BadgeProps): JSX.Element {\n return (\n <span {...rest} className={cx(\"badge\", className)} data-status={status && status !== \"neutral\" ? status : undefined} data-tone={tone}>\n {children}\n </span>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Badge } from \"../Badge/Badge\";\nimport { ColorField } from \"../ColorField/ColorField\";\nimport { Segmented } from \"../Segmented/Segmented\";\nimport { ThemePreview } from \"../ThemePreview/ThemePreview\";\n\nexport type ThemeEditorMode = \"dark\" | \"light\";\n\nexport interface ThemeEditorGroup {\n id: string;\n /** Legend of the fieldset. */\n title: string;\n keys: { key: string; label: string }[];\n}\n\nexport interface ThemeEditorIssue {\n /** A key of one of the groups. */\n key: string;\n message: string;\n}\n\nexport interface ThemeEditorLabels {\n name: string;\n mode: string;\n dark: string;\n light: string;\n /** Reset button of a colour; `{token}` is replaced by the key's label. */\n reset: string;\n /** Swatch name of a colour; `{token}` is replaced by the key's label. */\n picker: string;\n invalid: string;\n preview: { title: string; sample: string; hint: string; button: string };\n issuesTitle: string;\n /** Shown when `issues` is empty. */\n noIssues: string;\n}\n\nexport interface ThemeEditorProps {\n mode: ThemeEditorMode;\n onMode: (mode: ThemeEditorMode) => void;\n name: string;\n onName: (name: string) => void;\n nameError?: string;\n groups: ThemeEditorGroup[];\n /** The colour of every key in force for `mode`, `#rrggbb`. */\n colors: Record<string, string>;\n /** The keys the theme sets for `mode`. */\n overridden: ReadonlySet<string>;\n onColor: (key: string, hex: string) => void;\n onReset: (key: string) => void;\n issues: ThemeEditorIssue[];\n labels: ThemeEditorLabels;\n /** Extra fields under the name. */\n children?: ReactNode;\n className?: string;\n}\n\nexport function ThemeEditor({\n mode,\n onMode,\n name,\n onName,\n nameError,\n groups,\n colors,\n overridden,\n onColor,\n onReset,\n issues,\n labels,\n children,\n className,\n}: ThemeEditorProps): JSX.Element {\n const keyLabel = new Map(groups.flatMap((g) => g.keys.map((k) => [k.key, k.label] as const)));\n return (\n <div className={cx(\"x-theme-editor\", className)}>\n <label className=\"ws-field\" data-invalid={nameError ? \"\" : undefined}>\n <span>{labels.name}</span>\n <input type=\"text\" data-field=\"themeName\" value={name} maxLength={60} aria-invalid={nameError ? true : undefined} onChange={(e) => onName(e.target.value)} />\n {nameError ? <small role=\"alert\">{nameError}</small> : null}\n </label>\n {children}\n <div className=\"ws-field\">\n <span>{labels.mode}</span>\n <Segmented\n label={labels.mode}\n value={mode}\n options={[\n { value: \"dark\", label: labels.dark },\n { value: \"light\", label: labels.light },\n ]}\n onChange={(next) => onMode(next as ThemeEditorMode)}\n />\n </div>\n {groups.map((g) => (\n <fieldset className=\"x-theme-editor-group\" key={g.id} data-group={g.id}>\n <legend>{g.title}</legend>\n {g.keys.map((k) => (\n <ColorField\n key={`${mode}-${k.key}`}\n data-key={k.key}\n label={k.label}\n value={colors[k.key] ?? \"\"}\n overridden={overridden.has(k.key)}\n onChange={(hex) => onColor(k.key, hex)}\n onReset={() => onReset(k.key)}\n labels={{ reset: labels.reset.replace(\"{token}\", k.label), picker: labels.picker.replace(\"{token}\", k.label), invalid: labels.invalid }}\n />\n ))}\n </fieldset>\n ))}\n <ThemePreview mode={mode} {...labels.preview} />\n <section className=\"x-theme-editor-issues\" aria-label={labels.issuesTitle}>\n <h5>{labels.issuesTitle}</h5>\n <div className=\"x-theme-editor-count\" role=\"status\" aria-live=\"polite\">\n {issues.length === 0 ? <span>{labels.noIssues}</span> : <Badge>{issues.length}</Badge>}\n </div>\n {issues.length > 0 ? (\n <ul className=\"x-theme-editor-issue-list\" role=\"list\">\n {issues.map((i) => (\n <li key={`${i.key}-${i.message}`} data-key={i.key}>\n <strong>{keyLabel.get(i.key) ?? i.key}</strong> {i.message}\n </li>\n ))}\n </ul>\n ) : null}\n </section>\n </div>\n );\n}\n","import type { JSX, KeyboardEvent } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { rovingIndex } from \"../../internal/keys\";\n\nexport type SwatchTone = \"danger\" | \"warning\" | \"accent\" | \"neutral\";\n\nexport interface SwatchOption {\n value: string;\n /** Accessible name of the swatch (\"Red\"). Colour alone says nothing to a screen reader. */\n label: string;\n tone: SwatchTone;\n}\n\nexport interface SwatchGroupProps {\n value: string;\n onChange: (value: string) => void;\n /** At most 8. */\n options: SwatchOption[];\n /** \"sm\" is 24px, \"md\" 32px. Default \"md\". */\n size?: \"sm\" | \"md\";\n /** Names the group (\"Colour\"). */\n \"aria-label\": string;\n className?: string;\n}\n\nexport function SwatchGroup({ value, onChange, options, size = \"md\", \"aria-label\": ariaLabel, className }: SwatchGroupProps): JSX.Element {\n const selected = options.findIndex((o) => o.value === value);\n const stop = selected < 0 ? 0 : selected;\n const onKeyDown = (e: KeyboardEvent<HTMLElement>): void => {\n if (e.key === \"Home\" || e.key === \"End\") return;\n // Up/Down move like Left/Right, as native radios do.\n const key = e.key === \"ArrowDown\" ? \"ArrowRight\" : e.key === \"ArrowUp\" ? \"ArrowLeft\" : e.key;\n const next = rovingIndex(key, stop, options.length);\n const option = next == null ? undefined : options[next];\n if (next == null || !option) return;\n e.preventDefault();\n onChange(option.value);\n (e.currentTarget.querySelectorAll<HTMLElement>('[role=\"radio\"]')[next])?.focus();\n };\n return (\n <div className={cx(\"x-swatches\", className)} role=\"radiogroup\" aria-label={ariaLabel} data-size={size} onKeyDown={onKeyDown}>\n {options.map((o, i) => (\n <button\n key={o.value}\n type=\"button\"\n className=\"x-swatch\"\n role=\"radio\"\n aria-checked={i === selected}\n aria-label={o.label}\n tabIndex={i === stop ? 0 : -1}\n data-tone={o.tone}\n onClick={() => onChange(o.value)}\n />\n ))}\n </div>\n );\n}\n","export type CodeAlphabet = \"crockford\" | \"digits\";\n\n/** Crockford base32: digits and letters without I, L, O, U. */\nconst CROCKFORD = /^[0-9A-HJKMNP-TV-Z]$/;\nconst DIGITS = /^[0-9]$/;\n\n/**\n * Cleans typed or pasted text into code characters: upper case, no spaces or dashes.\n * Crockford maps O to 0 and I or L to 1; characters outside the alphabet are dropped.\n */\nexport function normalizeCode(raw: string, alphabet: CodeAlphabet = \"crockford\"): string {\n const text = raw.toUpperCase().replace(/[\\s-]/g, \"\");\n const keep = alphabet === \"digits\" ? DIGITS : CROCKFORD;\n let out = \"\";\n for (let ch of text) {\n if (alphabet === \"crockford\") ch = ch === \"O\" ? \"0\" : ch === \"I\" || ch === \"L\" ? \"1\" : ch;\n if (keep.test(ch)) out += ch;\n }\n return out;\n}\n\n/** Splits a code into groups of `size` characters; separators in `value` are ignored. */\nexport function groupCode(value: string, size: number): string[] {\n const chars = value.replace(/[\\s-]/g, \"\");\n const n = Math.max(1, Math.floor(size));\n const out: string[] = [];\n for (let i = 0; i < chars.length; i += n) out.push(chars.slice(i, i + n));\n return out;\n}\n\n/** Writes a code in groups of `group` characters joined by `sep` (`7K4QM2XD9P` becomes `7K4QM-2XD9P`). */\nexport function formatCode(code: string, group = 5, sep = \"-\"): string {\n return groupCode(code, group).join(sep);\n}\n","import type { ChangeEvent, JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { normalizeCode, type CodeAlphabet } from \"./normalizeCode\";\n\nexport interface CodeInputProps {\n /** Number of characters: 10 for a pairing code, 6 for a check code. */\n length: number;\n /** Characters per visual group. Default 5. */\n groupSize?: number;\n /** The normalised code, without separators. */\n value: string;\n onChange: (value: string) => void;\n /** Called once when typing or pasting brings the code to `length`. */\n onComplete?: (value: string) => void;\n /** \"crockford\" (default) is base32 without I, L, O, U; \"digits\" takes 0 to 9 only. */\n alphabet?: CodeAlphabet;\n /** Accessible name of the input. Pair it with a visible label (a `Field` or heading). */\n label: string;\n /** 1px danger border and aria-invalid. */\n invalid?: boolean;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Default \"one-time-code\", so the platform can offer a code it received by SMS or email. Pass \"off\" for a code it cannot know. */\n autoComplete?: string;\n className?: string;\n}\n\nexport function CodeInput({\n length,\n groupSize = 5,\n value,\n onChange,\n onComplete,\n alphabet = \"crockford\",\n label,\n invalid = false,\n disabled = false,\n autoFocus = false,\n autoComplete = \"one-time-code\",\n className,\n}: CodeInputProps): JSX.Element {\n const code = value.slice(0, length);\n const handle = (e: ChangeEvent<HTMLInputElement>): void => {\n const clean = normalizeCode(e.target.value, alphabet).slice(0, length);\n if (clean === value) return;\n onChange(clean);\n if (clean.length === length) onComplete?.(clean);\n };\n const size = Math.max(1, Math.floor(groupSize));\n const groups = Array.from({ length: Math.ceil(length / size) }, (_, g) => Array.from({ length: Math.min(size, length - g * size) }, (_, j) => g * size + j));\n const next = Math.min(code.length, length - 1);\n return (\n <div className={cx(\"x-code-input\", className)} data-invalid={invalid ? \"\" : undefined} data-disabled={disabled ? \"\" : undefined}>\n <div className=\"x-code-cells\" aria-hidden=\"true\">\n {groups.map((g) => (\n <span className=\"x-code-group\" key={g[0]}>\n {g.map((i) => (\n <span className=\"x-code-cell\" key={i} data-filled={code[i] ? \"\" : undefined} data-next={i === next ? \"\" : undefined}>\n {code[i]}\n </span>\n ))}\n </span>\n ))}\n </div>\n <input\n className=\"x-code-field\"\n type=\"text\"\n value={code}\n onChange={handle}\n aria-label={label}\n aria-invalid={invalid ? true : undefined}\n disabled={disabled}\n autoFocus={autoFocus}\n inputMode={alphabet === \"digits\" ? \"numeric\" : \"text\"}\n autoComplete={autoComplete}\n autoCapitalize=\"characters\"\n autoCorrect=\"off\"\n spellCheck={false}\n />\n </div>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { groupCode } from \"../CodeInput/normalizeCode\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface PairingCodeProps {\n /** The code, with or without separators: `7K4QM-2XD9P` or `482 913`. */\n value: string;\n /** Characters per group. Default 5; a check code of six digits uses 3. */\n groupSize?: number;\n /** Accessible name of the code (\"Pairing code\"). */\n label?: string;\n /** Shows a copy IconButton with this label (\"Copy code\"). */\n copyLabel?: string;\n /** Called by the copy button; the app writes to the clipboard. */\n onCopy?: () => void;\n /** Default \"lg\". */\n size?: \"md\" | \"lg\";\n className?: string;\n}\n\nexport function PairingCode({ value, groupSize = 5, label, copyLabel, onCopy, size = \"lg\", className }: PairingCodeProps): JSX.Element {\n const groups = groupCode(value, groupSize);\n return (\n <div className={cx(\"x-pairing-code\", className)} role=\"group\" aria-label={label} data-size={size}>\n <span className=\"x-pairing-code-value\" aria-live=\"polite\">\n <span className=\"x-sr-only\">{groups.join(\" \")}</span>\n <span aria-hidden=\"true\" className=\"x-pairing-code-groups\">\n {groups.map((g, i) => (\n <span className=\"x-pairing-code-group\" key={i}>\n {g}\n </span>\n ))}\n </span>\n </span>\n {copyLabel ? <IconButton icon=\"copy\" label={copyLabel} onClick={onCopy} /> : null}\n </div>\n );\n}\n","/** What the user picks. `system` follows the operating system. */\nexport type ThemePreference = \"system\" | \"dark\" | \"light\";\n/** What is painted. */\nexport type ResolvedTheme = \"dark\" | \"light\";\n\nexport const THEME_PREFERENCES: readonly ThemePreference[] = [\"system\", \"dark\", \"light\"];\n\n/** The media query that is true when the system is dark. */\nexport const PREFERS_DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\n/** Anything with `setAttribute`, such as an HTMLElement. */\nexport interface ThemeRoot {\n setAttribute(name: string, value: string): void;\n}\n\n/** The part of MediaQueryList that `watchSystemTheme` uses. */\nexport interface MediaQueryLike {\n matches: boolean;\n addEventListener(type: \"change\", listener: (e: { matches: boolean }) => void): void;\n removeEventListener(type: \"change\", listener: (e: { matches: boolean }) => void): void;\n}\n\nexport type MatchMediaLike = (query: string) => MediaQueryLike;\n\n/** The part of MutationObserver that `onThemeChange` uses. */\nexport interface ObserverLike {\n observe(target: any, options: { attributes: boolean; attributeFilter: string[] }): void;\n disconnect(): void;\n}\n\nexport type ObserverFactory = (callback: () => void) => ObserverLike;\n\n/** Turns a preference into the theme to paint. Unknown values read as `system`. */\nexport function resolveTheme(pref: ThemePreference, prefersDark: boolean): ResolvedTheme {\n if (pref === \"dark\" || pref === \"light\") return pref;\n return prefersDark ? \"dark\" : \"light\";\n}\n\n/** Sets `data-theme` on the root (normally `document.documentElement`). */\nexport function applyTheme(root: ThemeRoot, resolved: ResolvedTheme): void {\n root.setAttribute(\"data-theme\", resolved);\n}\n\n/**\n * Calls `cb(prefersDark)` when the system theme changes. Returns an unsubscribe function.\n * Pass `window.matchMedia.bind(window)`.\n */\nexport function watchSystemTheme(matchMedia: MatchMediaLike, cb: (prefersDark: boolean) => void): () => void {\n const mql = matchMedia(PREFERS_DARK_QUERY);\n const listener = (e: { matches: boolean }): void => cb(e.matches);\n mql.addEventListener(\"change\", listener);\n return () => mql.removeEventListener(\"change\", listener);\n}\n\n/** Reads the current system theme once. */\nexport function systemPrefersDark(matchMedia: MatchMediaLike): boolean {\n return matchMedia(PREFERS_DARK_QUERY).matches;\n}\n\n/** The theme on the root now; anything but `light` reads as `dark`, the default. */\nexport function currentTheme(root: { getAttribute(name: string): string | null }): ResolvedTheme {\n return root.getAttribute(\"data-theme\") === \"light\" ? \"light\" : \"dark\";\n}\n\n/**\n * Calls `cb(resolved)` each time `data-theme` changes on the root. For code that reads colours\n * from JS (a terminal, a canvas). Returns an unsubscribe function.\n * `makeObserver` is for tests; it defaults to `new MutationObserver(cb)`.\n */\nexport function onThemeChange<R extends ThemeRoot & { getAttribute(name: string): string | null }>(\n root: R,\n cb: (resolved: ResolvedTheme) => void,\n makeObserver: ObserverFactory = (fn) => new MutationObserver(fn),\n): () => void {\n const observer = makeObserver(() => cb(currentTheme(root)));\n observer.observe(root, { attributes: true, attributeFilter: [\"data-theme\"] });\n return () => observer.disconnect();\n}\n\n/**\n * Reads CSS custom properties from an element, e.g. `readThemeColors(el, [\"--x-color-bg\"])`.\n * Keys of the result are the names as given; a missing var reads as an empty string.\n * `getStyle` is for tests; it defaults to `getComputedStyle`.\n */\nexport function readThemeColors(\n el: Element,\n names: readonly string[],\n getStyle: (el: Element) => { getPropertyValue(name: string): string } = (e) => getComputedStyle(e),\n): Record<string, string> {\n const style = getStyle(el);\n const out: Record<string, string> = {};\n for (const name of names) out[name] = style.getPropertyValue(name).trim();\n return out;\n}\n","import type { JSX } from \"react\";\nimport { Icon } from \"../Icon/Icon\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Segmented } from \"../Segmented/Segmented\";\nimport { THEME_PREFERENCES, type ResolvedTheme, type ThemePreference } from \"../../theme/theme\";\n\nexport interface ThemeSwitchLabels {\n /** aria-label of the group. */\n group: string;\n system: string;\n dark: string;\n light: string;\n /** aria-label and title of the icon button while the page is light. */\n toDark: string;\n /** aria-label and title of the icon button while the page is dark. */\n toLight: string;\n}\n\nconst DEFAULT_LABELS: ThemeSwitchLabels = {\n group: \"Theme\",\n system: \"System\",\n dark: \"Dark\",\n light: \"Light\",\n toDark: \"Switch to dark mode\",\n toLight: \"Switch to light mode\",\n};\n\nexport interface ThemeSwitchProps {\n value: ThemePreference;\n onChange: (value: ThemePreference) => void;\n /**\n * \"segmented\" (default): System, Dark, Light.\n * \"icon\": one round button for a top bar that flips dark and light; offer System elsewhere (a menu).\n * \"icons\": System, Dark and Light as three icon segments (monitor, moon, sun), each named and titled, for a\n * settings row or a sign-in footer where words would crowd the control.\n */\n variant?: \"segmented\" | \"icon\" | \"icons\";\n /** The theme on screen. The icon variant needs it while `value` is \"system\". Default: `value`, or \"dark\". */\n resolved?: ResolvedTheme;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<ThemeSwitchLabels>;\n disabled?: boolean;\n}\n\nexport function ThemeSwitch({ value, onChange, variant = \"segmented\", resolved, labels, disabled }: ThemeSwitchProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n if (variant === \"icon\") {\n const shown: ResolvedTheme = value === \"system\" ? (resolved ?? \"dark\") : value;\n const next: ResolvedTheme = shown === \"dark\" ? \"light\" : \"dark\";\n return (\n <IconButton\n className=\"x-theme-toggle\"\n icon={shown === \"dark\" ? \"sun\" : \"moon\"}\n label={next === \"dark\" ? l.toDark : l.toLight}\n disabled={disabled}\n onClick={() => onChange(next)}\n />\n );\n }\n if (variant === \"icons\") {\n const ICON = { system: \"monitor\", dark: \"moon\", light: \"sun\" } as const;\n return (\n <div className=\"segmented x-theme-icons\" role=\"group\" aria-label={l.group}>\n {THEME_PREFERENCES.map((p) => (\n <button key={p} type=\"button\" aria-pressed={p === value} aria-label={l[p]} title={l[p]} disabled={disabled} onClick={() => onChange(p)}>\n <Icon name={ICON[p]} size={16} />\n </button>\n ))}\n </div>\n );\n }\n return (\n <Segmented\n label={l.group}\n disabled={disabled}\n value={value}\n options={THEME_PREFERENCES.map((p) => ({ value: p, label: l[p] }))}\n onChange={(v) => {\n if ((THEME_PREFERENCES as readonly string[]).includes(v)) onChange(v as ThemePreference);\n }}\n />\n );\n}\n","import { useId, type JSX, type ReactNode, type Ref, type SelectHTMLAttributes } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, \"size\"> {\n /** Flat list of choices. Use this or `children`, never both: `options` wins when both are set. */\n options?: SelectOption[];\n /** Native `<option>` and `<optgroup>` elements, for grouped or computed lists. Use this or `options`, never both. */\n children?: ReactNode;\n /** \"md\" (32px, forms) by default; \"sm\" (26px, the height of `SearchInput size=\"sm\"`) for toolbars and table filters. */\n size?: \"sm\" | \"md\";\n ref?: Ref<HTMLSelectElement>;\n /** Leading icon inside the control, such as \"globe\" for a language picker. Decorative: the select still needs a label. */\n icon?: IconName;\n /** Visible label above the select, like `Field`: the select then sits in a `.ws-field` with an optional hint or error line. */\n label?: ReactNode;\n /** Line under the select (needs `label`). */\n hint?: ReactNode;\n /** Error line under the select; marks it invalid (needs `label`). */\n error?: ReactNode;\n /** Keep the label for screen readers only. */\n hideLabel?: boolean;\n}\n\nexport function Select(props: SelectProps): JSX.Element {\n // The labelled form needs an id (a hook); the bare select stays a plain function of its props.\n return props.label != null ? <SelectField {...props} /> : SelectControl(props);\n}\n\nfunction SelectControl({ options, children, size = \"md\", className, icon, label: _label, hint: _hint, error: _error, hideLabel: _hide, ...rest }: SelectProps): JSX.Element {\n const sm = size === \"sm\" ? \"sm\" : undefined;\n const select = (\n <select className={cx(\"lang-select\", className)} data-icon={icon ? \"\" : undefined} data-size={sm} {...rest}>\n {options\n ? options.map((o) => (\n <option key={o.value} value={o.value}>\n {o.label}\n </option>\n ))\n : children}\n </select>\n );\n if (!icon) return select;\n return (\n <span className=\"x-select-wrap\" data-size={sm}>\n <Icon name={icon} className=\"x-select-icon\" size={sm ? 14 : 16} />\n {select}\n </span>\n );\n}\n\nfunction SelectField({ label, hint, error, hideLabel, id, className, ...rest }: SelectProps): JSX.Element {\n const auto = useId();\n const selectId = id ?? `x-select-${auto}`;\n const note = error ?? hint;\n const noteId = note ? `${selectId}-hint` : undefined;\n return (\n <div className={cx(\"ws-field x-select-field\", className)} data-invalid={error ? \"\" : undefined}>\n <label htmlFor={selectId} className={hideLabel ? \"x-sr-only\" : undefined}>\n {label}\n {rest.required ? <span className=\"x-label-required\" aria-hidden=\"true\">*</span> : null}\n </label>\n <SelectControl id={selectId} aria-describedby={noteId} aria-invalid={error ? true : undefined} {...rest} />\n {note ? <small id={noteId} role={error ? \"alert\" : undefined}>{note}</small> : null}\n </div>\n );\n}\n","/** Fonts offered as suggestions in a font field. Any installed family name is accepted too. */\nexport const UI_FONT_SUGGESTIONS: readonly string[] = [\n \"Roboto\",\n \"Be Vietnam Pro\",\n \"Inter\",\n \"Segoe UI\",\n \"Noto Sans\",\n \"Arial\",\n];\n\n/** The longest family name `fontStack` accepts. */\nexport const FONT_NAME_MAX = 120;\n\n/** The part of an element that `applyUiFont` uses (an HTMLElement fits). */\nexport interface FontRoot {\n style: { setProperty(name: string, value: string): void; removeProperty(name: string): unknown };\n}\n\nconst CONTROL = /[\\u0000-\\u001f\\u007f-\\u009f]/g;\n\n/**\n * Turns a family name the user typed into a CSS `font-family` value that starts with it, then the\n * default body stack (`var(--x-font-body-fallback)`). Empty input gives `null`, which means \"use\n * the default\". Quotes, slashes, braces and semicolons are dropped so the name cannot end the\n * declaration or add another.\n */\nexport function fontStack(name: string): string | null {\n const clean = Array.from(name.replace(CONTROL, \"\").replace(/[\"'\\\\{};<>]/g, \"\").trim())\n .slice(0, FONT_NAME_MAX)\n .join(\"\")\n .trim();\n if (clean === \"\") return null;\n return `\"${clean}\", var(--x-font-body-fallback)`;\n}\n\n/** Paints the UI font on the root, or restores the default when `name` is empty. */\nexport function applyUiFont(root: FontRoot, name: string): void {\n const stack = fontStack(name);\n if (stack === null) root.style.removeProperty(\"--font-body\");\n else root.style.setProperty(\"--font-body\", stack);\n}\n","import { useId, type InputHTMLAttributes, type JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { fontStack, UI_FONT_SUGGESTIONS } from \"../../theme/font\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface FontFieldLabels {\n /** aria-label of the button that clears the name and returns to the default font. */\n reset: string;\n}\n\nconst DEFAULT_LABELS: FontFieldLabels = { reset: \"Use the default font\" };\n\nexport interface FontFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"value\" | \"onChange\" | \"list\"> {\n /** The family name; empty means the default font. */\n value: string;\n onChange: (value: string) => void;\n /** Names offered in the list. Any other installed family can still be typed. */\n suggestions?: readonly string[];\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<FontFieldLabels>;\n}\n\nexport function FontField({ value, onChange, suggestions = UI_FONT_SUGGESTIONS, labels, className, style, ...rest }: FontFieldProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const listId = `x-font-${useId()}`;\n const stack = fontStack(value);\n return (\n <div className={cx(\"font-field\", className)}>\n <input\n type=\"text\"\n className=\"font-field-input\"\n list={listId}\n value={value}\n spellCheck={false}\n autoComplete=\"off\"\n style={stack || style ? { ...(stack ? { fontFamily: stack } : null), ...style } : undefined}\n onChange={(e) => onChange(e.target.value)}\n {...rest}\n />\n <datalist id={listId}>\n {suggestions.map((name) => (\n <option key={name} value={name} />\n ))}\n </datalist>\n {value !== \"\" ? (\n <button type=\"button\" className=\"font-field-reset\" aria-label={l.reset} disabled={rest.disabled} onClick={() => onChange(\"\")}>\n <Icon name=\"close\" size={14} />\n </button>\n ) : null}\n </div>\n );\n}\n","import { useId, useState, type InputHTMLAttributes, type JSX, type ReactNode, type Ref } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface FieldLabels {\n /** Name of the password toggle while the value is hidden. */\n show: string;\n /** Name of the password toggle while the value is shown. */\n hide: string;\n}\n\nconst DEFAULT_LABELS: FieldLabels = { show: \"Show password\", hide: \"Hide password\" };\n\nexport interface FieldProps extends InputHTMLAttributes<HTMLInputElement> {\n label: ReactNode;\n hint?: ReactNode;\n /** When set, replaces the hint and marks the field invalid. */\n error?: ReactNode;\n /** Keeps the label for screen readers only (visually hidden), for inputs that would otherwise carry just an aria-label. */\n hideLabel?: boolean;\n /** Monospace value, for ids, codes, IPA, paths and keys (like `Textarea mono`). */\n mono?: boolean;\n /** Small control on the label row, end-aligned, such as a \"Generate\" link button. */\n action?: ReactNode;\n /** Content inside the control at its end, such as a unit or a small `IconButton`. The input text stops before it. */\n end?: ReactNode;\n /** With `type=\"password\"`: a show/hide toggle inside the control end (after `end`). Default true; false opts out. */\n reveal?: boolean;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<FieldLabels>;\n ref?: Ref<HTMLInputElement>;\n}\n\nexport function Field({ label, hint, error, hideLabel, mono, action, end, reveal = true, labels, id, className, type, ...rest }: FieldProps): JSX.Element {\n const auto = useId();\n const inputId = id ?? `x-field-${auto}`;\n const note = error ?? hint;\n const hintId = note ? `${inputId}-hint` : undefined;\n const labelEl = (\n <label htmlFor={inputId} className={cx(\"x-label\", hideLabel && \"x-sr-only\")}>\n {label}\n {/* The control's own `required` already tells assistive tech; the asterisk is for the eye. */}\n {rest.required ? <span className=\"x-label-required\" aria-hidden=\"true\">*</span> : null}\n </label>\n );\n const inputProps: InputHTMLAttributes<HTMLInputElement> & { ref?: Ref<HTMLInputElement> } = {\n id: inputId,\n className: mono ? \"ws-mono\" : undefined,\n \"aria-describedby\": hintId,\n \"aria-invalid\": error ? true : undefined,\n type,\n ...rest,\n };\n let control: JSX.Element;\n if (type === \"password\" && reveal) {\n control = <PasswordControl input={inputProps} end={end} labels={{ ...DEFAULT_LABELS, ...labels }} />;\n } else if (end != null) {\n control = (\n <div className=\"x-field-control\">\n <input {...inputProps} />\n <span className=\"x-field-end\">{end}</span>\n </div>\n );\n } else {\n control = <input {...inputProps} />;\n }\n return (\n <div className={cx(\"ws-field\", className)} data-invalid={error ? \"\" : undefined}>\n {action != null ? (\n <div className=\"x-field-label-row\">\n {labelEl}\n <span className=\"x-field-action\">{action}</span>\n </div>\n ) : (\n labelEl\n )}\n {control}\n {note ? <small id={hintId} role={error ? \"alert\" : undefined}>{note}</small> : null}\n </div>\n );\n}\n\ninterface PasswordControlProps {\n input: InputHTMLAttributes<HTMLInputElement> & { ref?: Ref<HTMLInputElement> };\n end: ReactNode;\n labels: FieldLabels;\n}\n\n/** The password input with its show/hide toggle; a component of its own so a plain Field stays free of state. */\nfunction PasswordControl({ input, end, labels }: PasswordControlProps): JSX.Element {\n const [shown, setShown] = useState(false);\n return (\n <div className=\"x-field-control\">\n <input {...input} type={shown ? \"text\" : \"password\"} />\n <span className=\"x-field-end\">\n {end}\n <IconButton\n icon={shown ? \"eye-off\" : \"eye\"}\n // One fixed name with the state in aria-pressed (\"Show password, pressed\"); a name that also flips would contradict it.\n label={labels.show}\n size=\"sm\"\n aria-pressed={shown}\n aria-controls={input.id}\n disabled={input.disabled}\n onClick={() => setShown((v) => !v)}\n />\n </span>\n </div>\n );\n}\n","import type { JSX, LabelHTMLAttributes, Ref } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface LabelLabels {\n /** Read after the label text when `required` is set; the visible marker is an asterisk. */\n required: string;\n}\n\nconst DEFAULT_LABELS: LabelLabels = { required: \"required\" };\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Id of the control this label names. */\n htmlFor: string;\n /** Shows a required marker, read out as `labels.required`. */\n required?: boolean;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<LabelLabels>;\n ref?: Ref<HTMLLabelElement>;\n}\n\nexport function Label({ required, labels, className, children, ...rest }: LabelProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <label className={cx(\"x-label\", className)} {...rest}>\n {children}\n {required ? (\n <span className=\"x-label-required\">\n <span aria-hidden=\"true\">*</span>\n <span className=\"x-sr-only\"> {l.required}</span>\n </span>\n ) : null}\n </label>\n );\n}\n","import { useId, type InputHTMLAttributes, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n /** Names the setting in its \"on\" state. Omit only with aria-label. */\n label?: ReactNode;\n /** One short line under the label, linked with aria-describedby. */\n hint?: ReactNode;\n /** Keeps the label for screen readers only, for table cells whose column header already names the setting. */\n hideLabel?: boolean;\n}\n\nexport function Switch(props: SwitchProps): JSX.Element {\n // The hint needs an id (a hook); without one the switch stays a plain function of its props.\n return props.hint != null ? <SwitchWithHint {...props} /> : SwitchControl(props);\n}\n\nfunction SwitchControl({ label, hint: _hint, hideLabel, className, ...rest }: SwitchProps): JSX.Element {\n const input = <input type=\"checkbox\" role=\"switch\" className={cx(\"agent-switch\", className)} {...rest} />;\n if (!label) return input;\n return (\n <label className=\"x-switch-row\">\n {input}\n {hideLabel ? <span className=\"x-sr-only\">{label}</span> : label}\n </label>\n );\n}\n\nfunction SwitchWithHint({ hint, id, ...rest }: SwitchProps): JSX.Element {\n const auto = useId();\n const inputId = id ?? `x-switch-${auto}`;\n const hintId = `${inputId}-hint`;\n return (\n <span className=\"x-switch-field\">\n <SwitchControl id={inputId} aria-describedby={hintId} {...rest} />\n <small id={hintId} className=\"x-switch-hint\">\n {hint}\n </small>\n </span>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\n\nexport interface KbdProps {\n children: ReactNode;\n}\n\nexport function Kbd({ children }: KbdProps): JSX.Element {\n return <kbd className=\"kbd\">{children}</kbd>;\n}\n","import { useState } from \"react\";\nimport type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface AvatarProps {\n /** Used for the initials and the accessible label. */\n name: string;\n /** A `data:` or same-origin URL. Falls back to the initials when it is missing or fails to load. */\n src?: string | null;\n /** 20, 32 or 48 px. Default \"md\". */\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n}\n\n/** First code point of the first and last words, upper-cased; \"?\" when there is no word. */\nexport function avatarInitials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return \"?\";\n const first = Array.from(words[0] ?? \"\")[0] ?? \"\";\n const last = words.length > 1 ? (Array.from(words[words.length - 1] ?? \"\")[0] ?? \"\") : \"\";\n return (first + last).toLocaleUpperCase();\n}\n\nexport function Avatar({ name, src, size = \"md\", className }: AvatarProps): JSX.Element {\n const [failed, setFailed] = useState<string | null>(null);\n const showImage = Boolean(src) && failed !== src;\n return (\n <span className={cx(\"x-avatar\", className)} data-size={size} role=\"img\" aria-label={name}>\n {showImage ? (\n <img className=\"x-avatar-img\" alt=\"\" src={src ?? undefined} onError={() => setFailed(src ?? null)} />\n ) : (\n <span className=\"x-avatar-initials\" aria-hidden=\"true\">\n {avatarInitials(name)}\n </span>\n )}\n </span>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Avatar } from \"../Avatar/Avatar\";\n\nexport interface IdentityProps {\n /** Display name: the first line, and the avatar's initials. */\n name: string;\n /** Second line, muted: usually the email or the handle. */\n detail?: ReactNode;\n /** Avatar picture; initials show when it is missing or fails. */\n src?: string | null;\n /** Avatar size. Default \"lg\" (48px), for profile and account pages; \"md\" (32px) in lists. */\n size?: \"md\" | \"lg\";\n className?: string;\n}\n\n/** A person at a glance: avatar, name and one muted line. */\nexport function Identity({ name, detail, src, size = \"lg\", className }: IdentityProps): JSX.Element {\n return (\n <div className={cx(\"x-identity\", className)} data-size={size}>\n {/* The name is written next to it, so the picture is decorative here. */}\n <span className=\"x-identity-avatar\" aria-hidden=\"true\">\n <Avatar name={name} src={src} size={size} />\n </span>\n <span className=\"x-identity-text\">\n <strong className=\"x-identity-name\">{name}</strong>\n {detail ? <span className=\"x-identity-detail\">{detail}</span> : null}\n </span>\n </div>\n );\n}\n","import type { HTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { SpaceStep } from \"../Stack/Stack\";\n\nexport interface ListProps extends HTMLAttributes<HTMLElement> {\n /** Render an `ol` instead of a `ul`. Default false. */\n ordered?: boolean;\n /** Space between items on the space scale. Default: 2px, the ListRow spacing. */\n gap?: SpaceStep;\n children?: ReactNode;\n}\n\n/** Plain list for rows (`ListRow as=\"li\"`): no bullets, no indent, one column with a gap. */\nexport function List({ ordered = false, gap, className, children, ...rest }: ListProps): JSX.Element {\n const Tag = ordered ? \"ol\" : \"ul\";\n return (\n <Tag {...rest} className={cx(\"x-list\", className)} data-gap={gap === undefined ? undefined : gap}>\n {children}\n </Tag>\n );\n}\n","import type { ElementType, HTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface ProseProps extends HTMLAttributes<HTMLElement> {\n /** Element to render. Default \"article\". */\n as?: ElementType;\n children?: ReactNode;\n}\n\n/** Long reading text (legal pages, help, release notes): styles the plain h1-h3, p, ul, ol, a and code inside it. */\nexport function Prose({ as: Tag = \"article\", className, children, ...rest }: ProseProps): JSX.Element {\n return (\n <Tag {...rest} className={cx(\"x-prose\", className)}>\n {children}\n </Tag>\n );\n}\n","import type { JSX, KeyboardEvent, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface TagProps {\n tone?: \"default\" | \"warn\";\n /** Makes the tag removable: a trailing button, and Backspace on the focused tag. */\n onRemove?: () => void;\n /** Accessible name of the remove button. Required with `onRemove`. */\n removeLabel?: string;\n /** A CSS colour drawn as a small round dot before the text, for a category whose colour is data. Decoration only. */\n swatch?: string;\n children: ReactNode;\n}\n\nexport function Tag({ tone = \"default\", onRemove, removeLabel, swatch, children }: TagProps): JSX.Element {\n const cls = cx(\"ws-tag\", tone === \"warn\" && \"ws-tag-warn\", swatch && \"ws-tag-swatched\");\n const dot = swatch ? <span className=\"ws-tag-swatch\" style={{ background: swatch }} aria-hidden=\"true\" /> : null;\n if (!onRemove)\n return (\n <span className={cls}>\n {dot}\n {children}\n </span>\n );\n const onKeyDown = (e: KeyboardEvent<HTMLSpanElement>): void => {\n if (e.key !== \"Backspace\" || e.repeat || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;\n e.preventDefault();\n onRemove();\n };\n return (\n <span className={cx(cls, \"ws-tag-removable\")} tabIndex={0} onKeyDown={onKeyDown}>\n {dot}\n {children}\n <IconButton icon=\"close\" label={removeLabel ?? \"Remove\"} className=\"ws-tag-remove\" tabIndex={-1} onClick={onRemove} />\n </span>\n );\n}\n","import type { JSX } from \"react\";\nimport type { AgentProfile } from \"../../types\";\n\nexport interface AgentChipProps {\n profile?: AgentProfile;\n /** Letter for custom profiles. claude → C, codex → X. */\n letter?: string;\n /** Full profile name for hover and screen readers. */\n title?: string;\n}\n\nconst PROFILE_LETTER: Partial<Record<AgentProfile, string>> = { claude: \"C\", codex: \"X\" };\n\nexport function AgentChip({ profile = \"custom\", letter, title }: AgentChipProps): JSX.Element {\n const name = title ?? profile;\n return (\n <span className=\"ws-chip\" data-profile={profile === \"custom\" ? undefined : profile} title={name} aria-label={name} role=\"img\">\n {letter ?? PROFILE_LETTER[profile] ?? \"A\"}\n </span>\n );\n}\n","import type { JSX } from \"react\";\n\nexport interface DiffStatLabels {\n /** Accessible summary, e.g. \"3 added, 1 removed\". */\n diffStat: (added: number, removed: number) => string;\n}\n\nconst DEFAULT_LABELS: DiffStatLabels = { diffStat: (added, removed) => `${added} added, ${removed} removed` };\n\nexport interface DiffStatProps {\n added?: number;\n removed?: number;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<DiffStatLabels>;\n}\n\nexport function DiffStat({ added = 0, removed = 0, labels }: DiffStatProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <span className=\"ws-stat\" aria-label={l.diffStat(added, removed)}>\n <span className=\"ws-stat-add\">+{added}</span> <span className=\"ws-stat-del\">−{removed}</span>\n </span>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Avatar } from \"../Avatar/Avatar\";\nimport { Tag } from \"../Tag/Tag\";\n\nexport interface CommentProps {\n /** Who wrote it. Gives the avatar initials. */\n author: string;\n /** The time as text, already formatted (\"2h ago\"). */\n time?: string;\n /** The author is an automation. Shows `botLabel` when that is given. */\n bot?: boolean;\n /** Text of the bot badge. */\n botLabel?: string;\n /** Tints the comment: a resolved or an outdated review thread. Shows `stateLabel` when that is given. */\n state?: \"resolved\" | \"outdated\";\n /** Text of the state badge. */\n stateLabel?: string;\n /** Under the header: a file and line label or a link. */\n location?: ReactNode;\n /** In the header, after the time: IconButtons or a Menu trigger. */\n actions?: ReactNode;\n /** Under the body: a ReactionBar or a reply composer. */\n footer?: ReactNode;\n className?: string;\n /** The body. Render user text through a sanitizing renderer, never as raw HTML. */\n children: ReactNode;\n}\n\nexport function Comment({\n author,\n time,\n bot = false,\n botLabel,\n state,\n stateLabel,\n location,\n actions,\n footer,\n className,\n children,\n}: CommentProps): JSX.Element {\n return (\n <article className={cx(\"x-comment\", className)} data-state={state} data-bot={bot ? \"\" : undefined}>\n <header className=\"x-comment-head\">\n <Avatar name={author} size=\"sm\" />\n <span className=\"x-comment-author\">{author}</span>\n {bot && botLabel ? <Tag>{botLabel}</Tag> : null}\n {state && stateLabel ? <Tag>{stateLabel}</Tag> : null}\n {time ? <span className=\"x-comment-time\">{time}</span> : null}\n {actions ? <span className=\"x-comment-actions\">{actions}</span> : null}\n </header>\n {location ? <div className=\"x-comment-location\">{location}</div> : null}\n <div className=\"x-comment-body\">{children}</div>\n {footer ? <footer className=\"x-comment-foot\">{footer}</footer> : null}\n </article>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface ReactionItem {\n /** Passed back to `onToggle`. */\n key: string;\n /** Required: the accessible name and title of the button (\"Thumbs up\"). */\n label: string;\n /** What the button shows: an Icon or a short text. */\n symbol: ReactNode;\n count: number;\n /** The signed-in person reacted. Rendered as aria-pressed. */\n mine: boolean;\n}\n\nexport interface ReactionBarProps {\n items: ReactionItem[];\n onToggle: (key: string) => void;\n disabled?: boolean;\n /** Accessible name of the group. */\n label?: string;\n className?: string;\n}\n\nexport function ReactionBar({ items, onToggle, disabled = false, label, className }: ReactionBarProps): JSX.Element {\n return (\n <div className={cx(\"x-reaction-bar\", className)} role=\"group\" aria-label={label}>\n {items.map((item) => (\n <button\n key={item.key}\n type=\"button\"\n className=\"x-reaction\"\n aria-pressed={item.mine}\n aria-label={item.label}\n title={item.label}\n disabled={disabled}\n onClick={() => onToggle(item.key)}\n >\n <span className=\"x-reaction-symbol\">{item.symbol}</span>\n {item.count > 0 ? <span className=\"x-reaction-count\">{item.count}</span> : null}\n </button>\n ))}\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { StatusDot, type StatusTone } from \"../StatusDot/StatusDot\";\n\nexport interface ServiceStatusProps {\n /** ok: up; warn: degraded; danger: down; neutral: unknown. */\n tone: StatusTone;\n /** The state in words (\"Gateway online\"). */\n label: ReactNode;\n /** Quiet mono text at the end: a version, a region, a build. */\n detail?: ReactNode;\n className?: string;\n}\n\n/** One line for the foot of a sidebar: the state of the service this console runs, and its version. */\nexport function ServiceStatus({ tone, label, detail, className }: ServiceStatusProps): JSX.Element {\n return (\n <div className={cx(\"x-service-status\", className)}>\n <StatusDot tone={tone} label={label} />\n {detail != null ? <span className=\"x-service-status-detail\">{detail}</span> : null}\n </div>\n );\n}\n","import type { JSX } from \"react\";\n\nexport type MeterTone = \"ok\" | \"warn\" | \"danger\";\n\nexport interface MeterProps {\n /** 0–100 */\n value: number;\n label?: string;\n /** Fill turns --warn at or above this value. */\n warnAt?: number;\n /** Colour of the fill and number, chosen by the caller (e.g. quota left: ok > 70, warn 30–70, danger < 30). Wins over `warnAt`. */\n tone?: MeterTone;\n /** The bar takes the free width of its row instead of its compact 54px. */\n fill?: boolean;\n /** Text shown after the bar, and read by screen readers, instead of \"NN%\" (e.g. \"750 / 1000 left\"). */\n valueText?: string;\n /** \"lg\": a thicker bar and larger value text, for the one progress a screen is about (the clip on air). Default \"sm\". */\n size?: \"sm\" | \"lg\";\n}\n\nexport function Meter({ value, label, warnAt, tone, fill, valueText, size }: MeterProps): JSX.Element {\n const v = Math.max(0, Math.min(100, value));\n const warn = tone === undefined && warnAt != null && v >= warnAt;\n return (\n <span\n className=\"ws-meter\"\n data-warn={warn ? \"\" : undefined}\n data-tone={tone}\n data-fill={fill ? \"\" : undefined}\n data-size={size === \"lg\" ? \"lg\" : undefined}\n role=\"meter\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={v}\n aria-valuetext={valueText}\n aria-label={label}\n >\n {label ? <span className=\"ws-meter-label\">{label}</span> : null}\n <span className=\"ws-meter-bar\">\n <span className=\"ws-meter-fill\" style={{ width: `${v}%` }} />\n </span>\n <span className=\"ws-meter-pct\">{valueText ?? `${Math.round(v)}%`}</span>\n </span>\n );\n}\n","import type { CSSProperties, JSX } from \"react\";\n\nexport interface HeatmapCell {\n /** Stable key, usually the `YYYY-MM-DD` day. */\n key: string;\n /** 0 is no activity; 4 is the busiest. */\n level: 0 | 1 | 2 | 3 | 4;\n /** Text for the pointer tooltip and assistive tech, already translated. */\n label: string;\n}\n\nexport interface HeatmapProps {\n /** One cell per day, oldest first. */\n cells: readonly HeatmapCell[];\n /** Row of the first cell, 0 to 6; pads the first column. */\n startWeekday?: number;\n /** Accessible name of the whole grid. */\n label: string;\n /** Legend text at the low end; the legend shows only when both ends are set. */\n lessLabel?: string;\n /** Legend text at the high end. */\n moreLabel?: string;\n}\n\nconst LEVELS = [0, 1, 2, 3, 4] as const;\n\nexport function Heatmap({ cells, startWeekday = 0, label, lessLabel, moreLabel }: HeatmapProps): JSX.Element {\n const pad = Math.max(0, Math.min(6, Math.trunc(startWeekday)));\n const first: CSSProperties | undefined = pad > 0 ? { gridRowStart: pad + 1 } : undefined;\n return (\n <figure className=\"x-heatmap\" aria-label={label}>\n <div className=\"x-heatmap-scroll\">\n <div className=\"x-heatmap-grid\">\n {cells.map((c, i) => (\n <span\n key={c.key}\n className=\"x-heatmap-cell\"\n data-level={c.level}\n style={i === 0 ? first : undefined}\n title={c.label}\n role=\"img\"\n aria-label={c.label}\n />\n ))}\n </div>\n </div>\n {lessLabel && moreLabel ? (\n <figcaption className=\"x-heatmap-legend\" aria-hidden=\"true\">\n <span>{lessLabel}</span>\n {LEVELS.map((l) => (\n <span key={l} className=\"x-heatmap-cell\" data-level={l} />\n ))}\n <span>{moreLabel}</span>\n </figcaption>\n ) : null}\n </figure>\n );\n}\n","import type { JSX } from \"react\";\n\nexport interface TimeSeriesPoint {\n /** Stable key, usually the bucket's start time. */\n key: string;\n /** The measure in this bucket; null leaves a gap in the line (no data, not zero). */\n value: number | null;\n /** Text for the hover tooltip and the table view, already translated and formatted (\"12 Nov, 1.2M tokens\"). */\n label: string;\n}\n\nexport interface TimeSeriesTick {\n /** Index into `points` the tick sits under. */\n index: number;\n /** Axis text, already formatted (\"12 Nov\", \"14:00\"). */\n label: string;\n}\n\nexport interface TimeSeriesChartProps {\n /** One point per bucket, oldest first, evenly spaced. */\n points: readonly TimeSeriesPoint[];\n /** Accessible name of the chart; also the caption of its table view. */\n label: string;\n /** Labels along the time axis; keep them sparse (5 to 7). */\n ticks?: readonly TimeSeriesTick[];\n /** Formatted value of the top gridline; the scale's top is the largest value. */\n maxLabel?: string;\n /** Formatted value of the baseline, usually \"0\". */\n zeroLabel?: string;\n /** Mark every point with a dot, not only on hover; suits a short series (a week of days). */\n dots?: boolean;\n}\n\n/** Plot box in viewBox units; the SVG stretches to its container. */\nconst W = 100;\nconst H = 40;\n\nconst pct = (n: number) => `${Math.round(n * 1000) / 1000}%`;\n\nconst valued = (p: TimeSeriesPoint | undefined) => p !== undefined && p.value !== null && Number.isFinite(p.value);\n\n/** Runs of consecutive non-null points, each as [index, value] pairs. */\nfunction runs(points: readonly TimeSeriesPoint[]): [number, number][][] {\n const out: [number, number][][] = [];\n let cur: [number, number][] = [];\n points.forEach((p, i) => {\n if (p.value === null || !Number.isFinite(p.value)) {\n if (cur.length) out.push(cur);\n cur = [];\n } else cur.push([i, Math.max(0, p.value)]);\n });\n if (cur.length) out.push(cur);\n return out;\n}\n\nexport function TimeSeriesChart({ points, label, ticks = [], maxLabel, zeroLabel, dots }: TimeSeriesChartProps): JSX.Element {\n const n = points.length;\n const max = points.reduce((m, p) => (p.value !== null && Number.isFinite(p.value) && p.value > m ? p.value : m), 0);\n const x = (i: number) => ((i + 0.5) / Math.max(1, n)) * W;\n const y = (v: number) => (max > 0 ? H - (v / max) * H : H);\n const r2 = (v: number) => Math.round(v * 100) / 100;\n const segs = runs(points);\n const line = segs\n .filter((s) => s.length > 1)\n .map((s) => s.map(([i, v], k) => `${k === 0 ? \"M\" : \"L\"}${r2(x(i))} ${r2(y(v))}`).join(\"\"))\n .join(\"\");\n const area = segs\n .filter((s) => s.length > 1)\n .map((s) => `M${r2(x(s[0]![0]))} ${H}` + s.map(([i, v]) => `L${r2(x(i))} ${r2(y(v))}`).join(\"\") + `L${r2(x(s[s.length - 1]![0]))} ${H}Z`)\n .join(\"\");\n return (\n <figure className=\"x-tschart\" aria-label={label} data-dots={dots ? \"\" : undefined}>\n <div className=\"x-tschart-plot\">\n <svg className=\"x-tschart-svg\" viewBox={`0 0 ${W} ${H}`} preserveAspectRatio=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <line className=\"x-tschart-grid\" x1=\"0\" x2={W} y1=\"0\" y2=\"0\" />\n <line className=\"x-tschart-grid\" x1=\"0\" x2={W} y1={H / 2} y2={H / 2} />\n <line className=\"x-tschart-base\" x1=\"0\" x2={W} y1={H} y2={H} />\n {area ? <path className=\"x-tschart-area\" d={area} /> : null}\n {line ? <path className=\"x-tschart-line\" d={line} /> : null}\n </svg>\n {maxLabel ? <span className=\"x-tschart-max\" aria-hidden=\"true\">{maxLabel}</span> : null}\n {zeroLabel ? <span className=\"x-tschart-zero\" aria-hidden=\"true\">{zeroLabel}</span> : null}\n <div className=\"x-tschart-cols\" aria-hidden=\"true\">\n {points.map((p, i) => {\n const has = valued(p);\n // A point with no neighbour draws no line, so its dot always shows.\n const alone = has && !valued(points[i - 1]) && !valued(points[i + 1]);\n return (\n <span key={p.key} className=\"x-tschart-col\" data-side={i < n / 2 ? \"start\" : \"end\"}>\n {has ? (\n <span\n className=\"x-tschart-dot\"\n data-alone={alone ? \"\" : undefined}\n style={{ bottom: pct(max > 0 ? (Math.max(0, p.value as number) / max) * 100 : 0) }}\n />\n ) : null}\n <span className=\"x-tschart-tip\">{p.label}</span>\n </span>\n );\n })}\n </div>\n </div>\n {ticks.length ? (\n <div className=\"x-tschart-ticks\" aria-hidden=\"true\">\n {ticks\n .filter((t) => t.index >= 0 && t.index < n)\n .map((t) => (\n <span key={t.index} className=\"x-tschart-tick\" data-align={t.index === 0 ? \"start\" : t.index === n - 1 ? \"end\" : \"center\"} style={{ left: pct(x(t.index)) }}>\n {t.label}\n </span>\n ))}\n </div>\n ) : null}\n <table className=\"x-sr-only\">\n <caption>{label}</caption>\n <tbody>\n {points.map((p) => (\n <tr key={p.key}>\n <td>{p.label}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </figure>\n );\n}\n","import type { JSX } from \"react\";\n\nexport interface BarDatum {\n /** Stable key. */\n key: string;\n /** Category name, shown beside (horizontal) or under (vertical) the bar. */\n label: string;\n /** The measure; negative values draw as zero. */\n value: number;\n /** The value, already formatted (\"1.2M\", \"$3.40\"). */\n valueLabel: string;\n}\n\nexport interface BarChartProps {\n /** One bar per category, in the order to draw them (usually largest first). */\n bars: readonly BarDatum[];\n /** Accessible name of the chart. */\n label: string;\n /** Horizontal bars (default) suit long category names; vertical suits a few short ones. */\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nconst pct = (n: number) => `${Math.round(n * 1000) / 1000}%`;\n\nexport function BarChart({ bars, label, orientation = \"horizontal\" }: BarChartProps): JSX.Element {\n const max = bars.reduce((m, b) => (Number.isFinite(b.value) && b.value > m ? b.value : m), 0);\n const share = (v: number) => pct(max > 0 && Number.isFinite(v) ? (Math.max(0, v) / max) * 100 : 0);\n const vertical = orientation === \"vertical\";\n return (\n <figure className=\"x-barchart\" data-orientation={orientation} aria-label={label}>\n <ul className=\"x-barchart-list\">\n {bars.map((b) => (\n <li key={b.key} className=\"x-barchart-item\" title={`${b.label}: ${b.valueLabel}`}>\n <span className=\"x-barchart-label\">{b.label}</span>\n <span className=\"x-barchart-track\" aria-hidden=\"true\">\n <span className=\"x-barchart-bar\" style={vertical ? { height: share(b.value) } : { width: share(b.value) }} />\n </span>\n <span className=\"x-barchart-value\">{b.valueLabel}</span>\n </li>\n ))}\n </ul>\n </figure>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\n\nexport interface DonutSlice {\n /** Stable key. */\n key: string;\n /** Category name, shown in the legend. */\n label: string;\n /** The measure; negative values count as zero. */\n value: number;\n /** The value, already formatted (\"42%\", \"$3.4k\"). */\n valueLabel: string;\n}\n\nexport interface DonutChartProps {\n /** One slice per category, in the order to draw them clockwise from 12 o'clock (usually largest first). At most 8. */\n slices: readonly DonutSlice[];\n /** Accessible name of the chart. */\n label: string;\n /** Text in the hole, such as the total (\"100%\" over \"Revenue\"). */\n center?: ReactNode;\n /** Diameter of the ring in px. Default 160. */\n size?: number;\n}\n\n/** Categorical colours in order: distinct hues from the theme's tokens, so the ring follows light and dark. */\nexport const DONUT_COLORS = [\"--accent\", \"--ok\", \"--orange\", \"--violet\", \"--warn\", \"--signal\", \"--danger\", \"--text-2\"] as const;\n\nconst round = (n: number) => Math.round(n * 1000) / 1000;\n\n/** Pure: each slice's share of 100 and where it starts, for a ring drawn with pathLength=\"100\". */\nexport function donutArcs(slices: readonly DonutSlice[]): { key: string; share: number; start: number }[] {\n const values = slices.map((s) => (Number.isFinite(s.value) ? Math.max(0, s.value) : 0));\n const total = values.reduce((a, b) => a + b, 0);\n let start = 0;\n return slices.map((s, i) => {\n const share = total > 0 ? ((values[i] ?? 0) / total) * 100 : 0;\n const arc = { key: s.key, share: round(share), start: round(start) };\n start += share;\n return arc;\n });\n}\n\nexport function DonutChart({ slices, label, center, size = 160 }: DonutChartProps): JSX.Element {\n const arcs = donutArcs(slices);\n // A hairline gap between slices; none when one slice fills the ring.\n const gap = arcs.filter((a) => a.share > 0).length > 1 ? 0.6 : 0;\n const color = (i: number) => `var(${DONUT_COLORS[i % DONUT_COLORS.length]})`;\n return (\n <figure className=\"x-donut\" aria-label={label}>\n <div className=\"x-donut-ring\" style={{ width: size, height: size }}>\n <svg viewBox=\"0 0 42 42\" width={size} height={size} aria-hidden=\"true\">\n <circle className=\"x-donut-track\" cx=\"21\" cy=\"21\" r=\"15.9155\" pathLength={100} />\n {arcs.map((a, i) =>\n a.share > 0 ? (\n <circle\n key={a.key}\n className=\"x-donut-slice\"\n cx=\"21\"\n cy=\"21\"\n r=\"15.9155\"\n pathLength={100}\n stroke={color(i)}\n strokeDasharray={`${round(Math.max(a.share - gap, 0.01))} ${round(100 - Math.max(a.share - gap, 0.01))}`}\n strokeDashoffset={round(25 - a.start)}\n />\n ) : null,\n )}\n </svg>\n {center ? <div className=\"x-donut-center\">{center}</div> : null}\n </div>\n <ul className=\"x-donut-legend\">\n {slices.map((s, i) => (\n <li key={s.key} className=\"x-donut-item\" title={`${s.label}: ${s.valueLabel}`}>\n <span className=\"x-donut-swatch\" aria-hidden=\"true\" style={{ background: color(i) }} />\n <span className=\"x-donut-label\">{s.label}</span>\n <span className=\"x-donut-value\">{s.valueLabel}</span>\n </li>\n ))}\n </ul>\n </figure>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport type BannerTone = \"info\" | \"ok\" | \"warn\" | \"danger\";\n\nexport interface BannerProps {\n title: ReactNode;\n children?: ReactNode;\n /** At most one secondary Button. */\n action?: ReactNode;\n /** Default \"warn\". \"danger\" uses role=\"alert\"; the others role=\"status\". */\n tone?: BannerTone;\n}\n\nconst ICON: Record<BannerTone, IconName> = { info: \"info\", ok: \"check-circle\", warn: \"warn\", danger: \"alert\" };\n\nexport function Banner({ title, children, action, tone = \"warn\" }: BannerProps): JSX.Element {\n return (\n <div className={`banner banner-${tone}`} role={tone === \"danger\" ? \"alert\" : \"status\"}>\n <Icon name={ICON[tone] ?? \"warn\"} className=\"banner-icon\" size={20} />\n <div className=\"banner-text\">\n <strong>{title}</strong>\n {children ? <span>{children}</span> : null}\n </div>\n {action ?? null}\n </div>\n );\n}\n","import { Children, createContext, isValidElement, type JSX, type ReactNode } from \"react\";\n\n/** True inside a live region that announces its toasts, so a `Toast` there drops its own role. */\nexport const ToastRegionContext = createContext(false);\n\n/**\n * The two live regions toasts render into. Both are mounted before the first toast, as a live region\n * must exist before its text changes; danger toasts go to the assertive one, the rest to the polite one.\n * A plain function, not a component, so the regions sit in the caller's own element tree.\n */\nexport function toastRegions({ urgent, rest }: { urgent: ReactNode; rest: ReactNode }): JSX.Element {\n return (\n <ToastRegionContext.Provider value={true}>\n <div className=\"x-toast-live\" aria-live=\"assertive\">\n {urgent}\n </div>\n <div className=\"x-toast-live\" aria-live=\"polite\">\n {rest}\n </div>\n </ToastRegionContext.Provider>\n );\n}\n\n/** Splits slot children into danger toasts (an element with `tone=\"danger\"`) and the rest. */\nexport function splitUrgent(nodes: ReactNode): { urgent: ReactNode[]; rest: ReactNode[] } {\n const urgent: ReactNode[] = [];\n const rest: ReactNode[] = [];\n for (const n of Children.toArray(nodes)) (isValidElement<{ tone?: unknown }>(n) && n.props.tone === \"danger\" ? urgent : rest).push(n);\n return { urgent, rest };\n}\n","import { useContext, type JSX, type ReactNode } from \"react\";\nimport type { IconName } from \"../../icons\";\nimport { Button } from \"../Button/Button\";\nimport { Icon } from \"../Icon/Icon\";\nimport { ToastRegionContext } from \"./toast-region\";\nimport type { ToastTone } from \"./toast-store\";\n\nexport interface ToastLabels {\n dismiss: string;\n}\n\nconst DEFAULT_LABELS: ToastLabels = { dismiss: \"Dismiss\" };\n\nexport interface ToastProps {\n children: ReactNode;\n actionLabel?: string;\n onAction?: () => void;\n onDismiss?: () => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<ToastLabels>;\n /** Adds a tone icon and `data-tone`. \"danger\" is announced with role=\"alert\" (inside `AppShell` or `Toaster`: their assertive region). Default: none. */\n tone?: ToastTone;\n /** A second, quieter line under the message. */\n description?: ReactNode;\n}\n\nconst TONE_ICON: Record<ToastTone, IconName> = { ok: \"check\", warn: \"warn\", danger: \"alert\", info: \"info\" };\n\nexport function Toast({ children, actionLabel, onAction, onDismiss, labels, tone, description }: ToastProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n // Inside AppShell or Toaster the region around it announces it; a role here would be a second, nested live region.\n const inRegion = useContext(ToastRegionContext);\n return (\n <div className=\"ws-toast\" role={inRegion ? undefined : tone === \"danger\" ? \"alert\" : \"status\"} data-tone={tone}>\n {tone ? <Icon name={TONE_ICON[tone]} className=\"ws-toast-icon\" /> : null}\n <span className=\"ws-toast-text\">\n {children}\n {description ? <span className=\"ws-toast-desc\">{description}</span> : null}\n </span>\n {actionLabel ? (\n <Button variant=\"secondary\" onClick={onAction}>\n {actionLabel}\n </Button>\n ) : null}\n {onDismiss ? (\n <button type=\"button\" className=\"ws-tab-close\" aria-label={l.dismiss} onClick={onDismiss}>\n ×\n </button>\n ) : null}\n </div>\n );\n}\n","/** Toast queue: a tiny module-level store read with useSyncExternalStore. The reducer and helpers are pure. */\nimport type { ReactNode } from \"react\";\n\nexport type ToastTone = \"ok\" | \"warn\" | \"danger\" | \"info\";\n\nexport interface ToastOptions {\n /** Default \"info\". \"danger\" is announced with role=\"alert\". */\n tone?: ToastTone;\n /** A second, quieter line. */\n description?: ReactNode;\n /** At most one action, usually Undo. Clicking it also dismisses the toast. */\n action?: { label: string; onClick: () => void };\n /** Milliseconds on screen. Default 5000, 8000 for danger; Infinity or 0 keeps it until dismissed. */\n duration?: number;\n /** Reuse an id to update a toast in place (\"Uploading...\" then \"Uploaded\"). */\n id?: string;\n}\n\nexport interface ToastItem extends Omit<ToastOptions, \"id\" | \"tone\"> {\n id: string;\n message: ReactNode;\n tone: ToastTone;\n}\n\nexport type ToastAction = { type: \"add\"; toast: ToastItem } | { type: \"dismiss\"; id?: string };\n\nexport function toastReducer(state: readonly ToastItem[], action: ToastAction): ToastItem[] {\n if (action.type === \"add\") {\n const at = state.findIndex((t) => t.id === action.toast.id);\n if (at === -1) return [...state, action.toast];\n const next = [...state];\n next[at] = action.toast;\n return next;\n }\n if (action.id == null) return state.length ? [] : (state as ToastItem[]);\n return state.some((t) => t.id === action.id) ? state.filter((t) => t.id !== action.id) : (state as ToastItem[]);\n}\n\n/** The toasts on screen: the oldest `max`. The rest wait until one is dismissed. */\nexport function visibleToasts(state: readonly ToastItem[], max: number): ToastItem[] {\n return state.slice(0, Math.max(0, max));\n}\n\n/** How long a toast stays, in ms, or null when it stays until dismissed. */\nexport function toastDuration(t: Pick<ToastItem, \"tone\" | \"duration\">): number | null {\n const ms = t.duration ?? (t.tone === \"danger\" ? 8000 : 5000);\n return Number.isFinite(ms) && ms > 0 ? ms : null;\n}\n\nconst EMPTY: ToastItem[] = [];\nlet state: ToastItem[] = EMPTY;\nlet seq = 0;\nconst listeners = new Set<() => void>();\n\nfunction dispatch(action: ToastAction): void {\n const next = toastReducer(state, action);\n if (next === state) return;\n state = next;\n for (const l of listeners) l();\n}\n\n/** The store behind `toast()`, for `useSyncExternalStore`. */\nexport const toastStore = {\n subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => void listeners.delete(listener);\n },\n getSnapshot: (): ToastItem[] => state,\n getServerSnapshot: (): ToastItem[] => EMPTY,\n};\n\n/** Queues a toast and returns its id. Render the queue once with `<Toaster />`. */\nexport const toast = Object.assign(\n (message: ReactNode, { id, tone = \"info\", ...rest }: ToastOptions = {}): string => {\n const key = id ?? `x-toast-${++seq}`;\n dispatch({ type: \"add\", toast: { id: key, message, tone, ...rest } });\n return key;\n },\n {\n /** Removes one toast, or every toast without an id. */\n dismiss(id?: string): void {\n dispatch({ type: \"dismiss\", id });\n },\n },\n);\n","import { useEffect, useRef, useState, useSyncExternalStore, type FocusEvent, type JSX } from \"react\";\nimport { Toast } from \"./Toast\";\nimport { toastRegions } from \"./toast-region\";\nimport { toast, toastDuration, toastStore, visibleToasts } from \"./toast-store\";\n\nexport interface ToasterLabels {\n /** aria-label of the toast region. */\n region: string;\n dismiss: string;\n}\n\nconst DEFAULT_LABELS: ToasterLabels = { region: \"Notifications\", dismiss: \"Dismiss\" };\n\nexport interface ToasterProps {\n /** Corner of the viewport. Default \"bottom-end\". */\n position?: \"bottom-end\" | \"bottom-start\" | \"bottom-center\" | \"top-end\" | \"top-start\" | \"top-center\";\n /** Toasts on screen at once; the rest wait. Default 3. */\n max?: number;\n labels?: Partial<ToasterLabels>;\n}\n\ninterface Timer {\n remaining: number;\n started: number;\n handle?: ReturnType<typeof setTimeout>;\n}\n\n/**\n * Renders the `toast()` queue. Mount it once, near the root, and not inside `AppShell` `toasts`. Its live regions are\n * mounted before the first toast: danger toasts are assertive, the rest polite. Timers pause while the pointer or focus is on a toast.\n */\nexport function Toaster({ position = \"bottom-end\", max = 3, labels }: ToasterProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const all = useSyncExternalStore(toastStore.subscribe, toastStore.getSnapshot, toastStore.getServerSnapshot);\n const shown = visibleToasts(all, max);\n const [paused, setPaused] = useState(false);\n const timers = useRef(new Map<string, Timer>());\n const shownKey = shown.map((t) => `${t.id}:${String(t.duration)}:${t.tone}`).join(\"|\");\n\n useEffect(() => {\n const map = timers.current;\n const ids = new Set(shown.map((t) => t.id));\n for (const id of map.keys()) if (!ids.has(id)) map.delete(id);\n for (const t of shown) {\n const ms = toastDuration(t);\n if (ms == null) continue;\n let timer = map.get(t.id);\n if (!timer) map.set(t.id, (timer = { remaining: ms, started: 0 }));\n if (paused) continue;\n timer.started = Date.now();\n timer.handle = setTimeout(() => toast.dismiss(t.id), timer.remaining);\n }\n return () => {\n const now = Date.now();\n for (const timer of map.values()) {\n if (timer.handle === undefined) continue;\n clearTimeout(timer.handle);\n timer.handle = undefined;\n timer.remaining = Math.max(0, timer.remaining - (now - timer.started));\n }\n };\n }, [shownKey, paused]); // eslint-disable-line react-hooks/exhaustive-deps -- shownKey stands for shown\n\n const render = (t: (typeof shown)[number]): JSX.Element => (\n <Toast\n key={t.id}\n tone={t.tone}\n description={t.description}\n actionLabel={t.action?.label}\n onAction={\n t.action\n ? () => {\n t.action?.onClick();\n toast.dismiss(t.id);\n }\n : undefined\n }\n onDismiss={() => toast.dismiss(t.id)}\n labels={{ dismiss: l.dismiss }}\n >\n {t.message}\n </Toast>\n );\n\n return (\n <section\n className=\"x-toaster ws-toasts\"\n aria-label={l.region}\n data-position={position}\n onMouseEnter={() => setPaused(true)}\n onMouseLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={(e: FocusEvent<HTMLElement>) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setPaused(false);\n }}\n >\n {toastRegions({ urgent: shown.filter((t) => t.tone === \"danger\").map(render), rest: shown.filter((t) => t.tone !== \"danger\").map(render) })}\n </section>\n );\n}\n","import { useId, useState, type CSSProperties, type DragEvent, type JSX, type KeyboardEvent } from \"react\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\nimport { rovingIndex } from \"../../internal/keys\";\nimport type { AgentProfile, SessionState, TabColor } from \"../../types\";\nimport { AgentChip } from \"../AgentChip/AgentChip\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\n\nexport interface TabItem {\n id: string;\n name: string;\n state?: SessionState;\n profile?: AgentProfile;\n color?: TabColor;\n unread?: boolean;\n dirty?: boolean;\n skipped?: boolean;\n /** Cannot be closed: no close button and Delete does nothing (a home page tab). Also cannot be moved. */\n pinned?: boolean;\n /** Glyph before the name, e.g. the page's menu icon. */\n icon?: IconName;\n}\n\n/** Look of the strip: `chrome` (default) joined tabs, `card` separate boxes, `plain` text with an underline, `brisk` a soft pill. */\nexport type TabStripVariant = \"chrome\" | \"card\" | \"plain\" | \"brisk\";\n\n/** Pure: `ids` with `id` moved to `to` (an index in the list after removal); pinned ids never move and nothing passes them. */\nexport function moveTab(ids: readonly string[], id: string, to: number, pinned: ReadonlySet<string> = new Set()): string[] {\n const from = ids.indexOf(id);\n if (from < 0 || pinned.has(id)) return [...ids];\n const rest = ids.filter((x) => x !== id);\n const floor = rest.filter((x) => pinned.has(x)).length;\n const at = Math.max(floor, Math.min(to, rest.length));\n rest.splice(at, 0, id);\n return rest;\n}\n\nexport interface TabStripLabels {\n skipped: string;\n unsaved: string;\n newTab: string;\n /** aria-label of a tab close button. */\n close: (name: string) => string;\n}\n\nconst DEFAULT_LABELS: TabStripLabels = {\n skipped: \"skipped\",\n unsaved: \"Unsaved\",\n newTab: \"New tab\",\n close: (name) => `Close ${name}`,\n};\n\nexport interface TabStripProps {\n tabs: TabItem[];\n selected?: string;\n defaultSelected?: string;\n onSelect?: (id: string) => void;\n onClose?: (id: string) => void;\n /** false hides the + button. */\n onAdd?: (() => void) | false;\n label?: string;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<TabStripLabels>;\n variant?: TabStripVariant;\n /** Lets people drag tabs, or press Shift+Left/Right on one, to reorder; gets every id in the new order. */\n onReorder?: (ids: string[]) => void;\n}\n\nexport function TabStrip({ tabs, selected, defaultSelected, onSelect, onClose, onAdd, label, labels, variant, onReorder }: TabStripProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [inner, setInner] = useState(defaultSelected ?? tabs[0]?.id);\n const current = selected ?? inner;\n const uid = useId();\n const tabId = (id: string): string => `${uid}-${id}`;\n const stop = tabs.some((t) => t.id === current) ? current : tabs[0]?.id;\n const ids = tabs.map((t) => t.id);\n const pinned = new Set(tabs.filter((t) => t.pinned).map((t) => t.id));\n // State, not a ref: the component stays callable as a plain function in tests.\n const [dragging, setDragging] = useState<string | null>(null);\n const [over, setOver] = useState<string | null>(null);\n const onKeyDown = (e: KeyboardEvent<HTMLButtonElement>, t: TabItem): void => {\n const list = Array.from(e.currentTarget.closest(\".ws-tabstrip\")?.querySelectorAll<HTMLElement>('[role=\"tab\"]') ?? []);\n const at = list.indexOf(e.currentTarget);\n if (onReorder && e.shiftKey && (e.key === \"ArrowLeft\" || e.key === \"ArrowRight\")) {\n e.preventDefault();\n const next = moveTab(ids, t.id, at + (e.key === \"ArrowLeft\" ? -1 : 1), pinned);\n if (next.join(\"\\n\") !== ids.join(\"\\n\")) onReorder(next);\n return;\n }\n if (e.key === \"Delete\") {\n if (!onClose || t.dirty || t.pinned) return;\n e.preventDefault();\n list[at + 1 < list.length ? at + 1 : at - 1]?.focus();\n onClose(t.id);\n return;\n }\n const next = rovingIndex(e.key, at, list.length);\n if (next == null) return;\n e.preventDefault();\n list[next]?.focus();\n list[next]?.click();\n };\n return (\n <div className=\"ws-tabstrip\" data-variant={variant && variant !== \"chrome\" ? variant : undefined}>\n {/* Close buttons sit beside the tabs, so the tablist owns the tab buttons by id instead of containing them. */}\n <div className=\"ws-tabstrip-list\" role=\"tablist\" aria-label={label} aria-owns={tabs.map((t) => tabId(t.id)).join(\" \") || undefined} />\n {tabs.map((t) => {\n const style = t.color ? ({ \"--ws-tab-color\": `var(--x-tab-color-${t.color})` } as CSSProperties) : undefined;\n const isSel = t.id === current;\n const movable = !!onReorder && !t.pinned;\n const drag = onReorder\n ? {\n draggable: movable,\n onDragStart: (e: DragEvent<HTMLDivElement>) => {\n if (!movable) return;\n setDragging(t.id);\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setData(\"text/plain\", t.name);\n },\n onDragOver: (e: DragEvent<HTMLDivElement>) => {\n if (!dragging || t.pinned) return;\n e.preventDefault();\n setOver(t.id);\n },\n onDragLeave: () => setOver((o) => (o === t.id ? null : o)),\n onDrop: (e: DragEvent<HTMLDivElement>) => {\n const id = dragging;\n setDragging(null);\n setOver(null);\n if (!id || id === t.id || t.pinned) return;\n e.preventDefault();\n onReorder(moveTab(ids, id, ids.indexOf(t.id), pinned));\n },\n onDragEnd: () => {\n setDragging(null);\n setOver(null);\n },\n }\n : {};\n return (\n <div\n key={t.id}\n className=\"ws-tab\"\n role=\"presentation\"\n {...drag}\n data-drop={over === t.id ? \"\" : undefined}\n data-selected={isSel ? \"\" : undefined}\n data-color={t.color || undefined}\n data-unread={t.unread ? \"\" : undefined}\n style={style}\n >\n <button\n type=\"button\"\n className=\"ws-tab-main\"\n id={tabId(t.id)}\n role=\"tab\"\n aria-selected={isSel}\n tabIndex={t.id === stop ? 0 : -1}\n onKeyDown={(e) => onKeyDown(e, t)}\n onClick={() => {\n setInner(t.id);\n onSelect?.(t.id);\n }}\n >\n {t.state ? <StatusDot state={t.state} pulse={t.state === \"working\"} /> : null}\n {t.profile ? <AgentChip profile={t.profile} /> : null}\n {t.icon ? <Icon name={t.icon} size={14} /> : null}\n <span className=\"ws-tab-name\">{t.name}</span>\n {t.skipped ? <span className=\"ws-tab-skip\">{l.skipped}</span> : null}\n </button>\n {t.pinned ? null : t.dirty ? (\n <span className=\"ws-tab-dirty\" aria-label={l.unsaved} />\n ) : (\n <button type=\"button\" className=\"ws-tab-close\" aria-label={l.close(t.name)} tabIndex={-1} onClick={() => onClose?.(t.id)}>\n ×\n </button>\n )}\n </div>\n );\n })}\n {onAdd !== false ? (\n <button type=\"button\" className=\"ws-tab-add\" aria-label={l.newTab} onClick={onAdd || undefined}>\n +\n </button>\n ) : null}\n </div>\n );\n}\n","import { useState, type JSX, type ReactNode } from \"react\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport type AppId = \"docs\" | \"changes\" | \"tasks\" | \"squads\" | \"agents\" | \"kit\" | \"accounts\" | \"terminal\";\n\n/** Per-app labels plus the bar name and the Changes count formatter. */\nexport type ActivityBarLabels = Partial<Record<AppId, string>> & {\n /** aria-label of the nav landmark. */\n nav?: string;\n /** Label of Changes with a pending count, e.g. \"Changes (3)\". */\n count?: (base: string, n: number) => string;\n};\n\n/** An item the host adds beside the built-in apps (a board, settings, ...). */\nexport interface ActivityBarItem {\n id: string;\n icon: IconName;\n /** aria-label and title. */\n label: string;\n /** A number shows a count (caps at \"99+\", hidden at 0); `true` shows a dot. */\n badge?: number | boolean;\n}\n\nexport interface ActivityBarProps {\n /** An `AppId`, or the `id` of an extra or bottom item. */\n active?: AppId | (string & {});\n apps?: AppId[];\n /** Items placed after the built-in apps. */\n extraItems?: ActivityBarItem[];\n /** Items pinned to the bottom of the bar (for example settings). */\n bottomItems?: ActivityBarItem[];\n /** Pending changes; badge on Changes, caps at \"99+\", hidden at 0. */\n changeCount?: number;\n /** Method syntax keeps handlers typed `(id: AppId) => void` assignable; extra items pass their own id. */\n onSelect?(id: AppId | (string & {})): void;\n /** Override the English labels (e.g. for vi). */\n labels?: ActivityBarLabels;\n}\n\nexport const APPS: AppId[] = [\"docs\", \"changes\", \"tasks\", \"squads\", \"agents\", \"kit\", \"accounts\", \"terminal\"];\nconst APP_LABELS: Record<AppId, string> = {\n docs: \"Docs\",\n changes: \"Changes\",\n tasks: \"Tasks\",\n squads: \"Squads\",\n agents: \"Agents\",\n kit: \"Kit\",\n accounts: \"Accounts\",\n terminal: \"Terminal\",\n};\n\nexport function ActivityBar({ active, apps = APPS, extraItems, bottomItems, changeCount, onSelect, labels }: ActivityBarProps): JSX.Element {\n const [inner, setInner] = useState<string>(active ?? \"terminal\");\n const current = active ?? inner;\n const pending = changeCount != null && changeCount > 0 ? changeCount : null;\n const button = (id: string, icon: IconName, label: string, badge: ReactNode): JSX.Element => (\n <button\n key={id}\n type=\"button\"\n className=\"activity\"\n aria-label={label}\n title={label}\n aria-current={id === current ? \"page\" : undefined}\n onClick={() => {\n setInner(id);\n onSelect?.(id);\n }}\n >\n <Icon name={icon} size={22} />\n {badge}\n </button>\n );\n const extra = (it: ActivityBarItem): JSX.Element => {\n const n = typeof it.badge === \"number\" && it.badge > 0 ? it.badge : null;\n const badge =\n n !== null ? (\n <span className=\"activity-badge\" aria-hidden=\"true\">\n {n > 99 ? \"99+\" : String(n)}\n </span>\n ) : it.badge === true ? (\n <span className=\"activity-badge\" data-dot aria-hidden=\"true\" />\n ) : null;\n return button(it.id, it.icon, it.label, badge);\n };\n return (\n <nav className=\"activitybar\" aria-label={labels?.nav ?? \"Apps\"}>\n {apps.map((id) => {\n const base = labels?.[id] ?? APP_LABELS[id] ?? id;\n const label = id === \"changes\" && pending !== null ? (labels?.count ?? ((b, n) => `${b} (${n})`))(base, pending) : base;\n const badge =\n id === \"changes\" && pending !== null ? (\n <span className=\"activity-badge\" aria-hidden=\"true\">\n {pending > 99 ? \"99+\" : String(pending)}\n </span>\n ) : null;\n return button(id, id, label, badge);\n })}\n {extraItems?.map(extra)}\n {bottomItems?.length ? <div className=\"activity-end\">{bottomItems.map(extra)}</div> : null}\n </nav>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\n\nexport interface StatusBarProps {\n /** Left to right; the string \"spacer\" pushes the rest right. */\n items: (ReactNode | \"spacer\")[];\n /** Renders nothing, so the shell can hide the bar without unmounting the parent. */\n hidden?: boolean;\n}\n\nexport function StatusBar({ items, hidden }: StatusBarProps): JSX.Element | null {\n if (hidden) return null;\n return (\n <footer className=\"ws-footer\">\n {items.map((it, i) =>\n it === \"spacer\" ? (\n <span key={i} className=\"ws-footer-spacer\" />\n ) : (\n <span key={i} className=\"ws-footer-item\">\n {it}\n </span>\n ),\n )}\n </footer>\n );\n}\n","import { Fragment, type JSX, type KeyboardEvent, type KeyboardEventHandler, type MouseEvent, type ReactNode, type Ref } from \"react\";\nimport { rovingIndex } from \"../../internal/keys\";\nimport type { TabColor } from \"../../types\";\n\nconst ITEMS = '[role^=\"menuitem\"]:not([aria-disabled=\"true\"])';\n/** Trigger element per open menu, captured when the menu mounts so Esc can return focus to it. */\nconst triggers = new WeakMap<object, Element | null>();\n\n/** Which item a trigger key opens the menu on: Enter, Space and ArrowDown open on the first, ArrowUp on the last. */\nexport function menuTriggerKey(key: string): \"first\" | \"last\" | null {\n if (key === \"Enter\" || key === \" \" || key === \"ArrowDown\") return \"first\";\n if (key === \"ArrowUp\") return \"last\";\n return null;\n}\n\nexport type MenuEntry =\n | { type: \"separator\" }\n | { type: \"group\"; label: string }\n | {\n type?: \"item\";\n label: string;\n chord?: string;\n /** Set (true/false) to make it a menuitemcheckbox. */\n checked?: boolean;\n disabled?: boolean;\n danger?: boolean;\n active?: boolean;\n submenu?: boolean;\n swatch?: TabColor;\n /** Renders the item as `<a role=\"menuitem\">`, so middle-click and Cmd/Ctrl-click open a new tab. */\n href?: string;\n onSelect?: () => void;\n };\n\n/** Props `renderLink` must spread on its link (a Next.js `Link`, a router link). */\nexport interface MenuLinkProps {\n href: string;\n className: string;\n role: \"menuitem\";\n tabIndex?: number;\n \"data-active\"?: \"\";\n \"data-danger\"?: \"\";\n onClick: (e: MouseEvent<HTMLAnchorElement>) => void;\n children: ReactNode;\n}\n\nexport interface MenuProps {\n items: MenuEntry[];\n label?: string;\n /** Item focused when the menu mounts: \"first\" (default), \"last\" (ArrowUp on the trigger), or false to leave focus alone. */\n initialFocus?: \"first\" | \"last\" | false;\n /** Called after Esc, Tab, or choosing a plain item. Esc and selection return focus to the trigger first. */\n onClose?: () => void;\n /** Renders `href` items through the app's link component. Default: a plain `<a>`. */\n renderLink?: (props: MenuLinkProps) => ReactNode;\n /** The owner (MenuButton) handles the keyboard and focus; the menu does not move focus itself. */\n roving?: boolean;\n /** Runs after any enabled item is chosen, e.g. to close the menu. */\n onAction?: () => void;\n id?: string;\n onKeyDown?: KeyboardEventHandler<HTMLDivElement>;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst setRef = <T,>(r: Ref<T> | undefined, el: T | null): void => {\n if (typeof r === \"function\") r(el);\n else if (r) (r as { current: T | null }).current = el;\n};\n\nexport function Menu({ items, label, initialFocus = \"first\", onClose, renderLink, roving, onAction, id, onKeyDown, ref }: MenuProps): JSX.Element {\n // Items stay out of the Tab order; focus moves between them with the arrow keys.\n const tabIndex = -1;\n const focusTrigger = (el: HTMLElement): void => {\n const t = triggers.get(el);\n (t as HTMLElement | null | undefined)?.focus?.();\n };\n /** After a plain (not checkable) item is chosen in a standalone menu: focus back to the trigger, then close. */\n const closeFrom = (target: EventTarget | null | undefined): void => {\n const menu = (target as HTMLElement | null | undefined)?.closest?.<HTMLElement>('[role=\"menu\"]');\n if (menu) focusTrigger(menu);\n onClose?.();\n };\n const ownRef = (el: HTMLDivElement | null): void => {\n setRef(ref, el);\n if (!el || triggers.has(el)) return;\n triggers.set(el, document.activeElement);\n if (initialFocus === false) return;\n const list = Array.from(el.querySelectorAll<HTMLElement>(ITEMS));\n (initialFocus === \"last\" ? list[list.length - 1] : list[0])?.focus();\n };\n const ownKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n const el = e.currentTarget;\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n focusTrigger(el);\n onClose?.();\n return;\n }\n if (e.key === \"Tab\") {\n onClose?.();\n return;\n }\n const list = Array.from(el.querySelectorAll<HTMLElement>(ITEMS));\n const at = list.indexOf(document.activeElement as HTMLElement);\n const next = rovingIndex(e.key, at, list.length, \"vertical\");\n if (next != null) {\n e.preventDefault();\n list[next]?.focus();\n return;\n }\n if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.key !== \" \") {\n const enabled = Array.from(el.querySelectorAll<HTMLElement>('[role^=\"menuitem\"]'));\n const start = enabled.indexOf(document.activeElement as HTMLElement);\n const ch = e.key.toLowerCase();\n for (let n = 1; n <= enabled.length; n++) {\n const cand = enabled[(start + n) % enabled.length];\n if (!cand) continue;\n if (cand.getAttribute(\"aria-disabled\") !== \"true\" && (cand.textContent ?? \"\").trim().toLowerCase().startsWith(ch)) {\n e.preventDefault();\n cand.focus();\n return;\n }\n }\n }\n };\n return (\n <div className=\"x-menu\" role=\"menu\" aria-label={label} id={id} ref={roving ? ref : ownRef} onKeyDown={roving ? onKeyDown : ownKeyDown}>\n {items.map((it, i) => {\n if (it.type === \"separator\") return <div key={i} className=\"x-menu-sep\" role=\"separator\" />;\n if (it.type === \"group\")\n return (\n <div key={i} className=\"x-menu-group\" role=\"presentation\">\n {it.label}\n </div>\n );\n const isCheck = it.checked != null;\n const choose = it.disabled\n ? undefined\n : (e?: MouseEvent<HTMLElement>): void => {\n it.onSelect?.();\n onAction?.();\n if (!roving && !isCheck) closeFrom(e?.currentTarget);\n };\n const content = (\n <>\n {it.swatch ? <span className=\"x-menu-swatch\" style={{ background: `var(--x-tab-color-${it.swatch})` }} /> : null}\n <span className=\"x-menu-label\">{it.label}</span>\n {it.chord ? <span className=\"x-menu-chord\">{it.chord}</span> : null}\n </>\n );\n if (it.href != null) {\n if (it.disabled)\n return (\n <a key={i} className=\"x-menu-item\" role=\"menuitem\" aria-disabled=\"true\" tabIndex={tabIndex} data-danger={it.danger ? \"\" : undefined}>\n {content}\n </a>\n );\n const linkProps: MenuLinkProps = {\n href: it.href,\n className: \"x-menu-item\",\n role: \"menuitem\",\n tabIndex,\n \"data-active\": it.active ? \"\" : undefined,\n \"data-danger\": it.danger ? \"\" : undefined,\n onClick: (e) => choose?.(e),\n children: content,\n };\n if (renderLink) return <Fragment key={i}>{renderLink(linkProps)}</Fragment>;\n const { children, ...rest } = linkProps;\n return (\n <a key={i} {...rest}>\n {children}\n </a>\n );\n }\n return (\n <button\n key={i}\n type=\"button\"\n className=\"x-menu-item\"\n role={isCheck ? \"menuitemcheckbox\" : \"menuitem\"}\n aria-checked={isCheck ? Boolean(it.checked) : undefined}\n aria-disabled={it.disabled ? true : undefined}\n tabIndex={tabIndex}\n data-active={it.active ? \"\" : undefined}\n data-danger={it.danger ? \"\" : undefined}\n onClick={choose}\n >\n {isCheck ? (\n <span className=\"x-menu-check\" aria-hidden=\"true\">\n {it.checked ? \"✓\" : \"\"}\n </span>\n ) : null}\n {content}\n {it.submenu ? (\n <span className=\"x-menu-arrow\" aria-hidden=\"true\">\n ›\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n}\n","/** Keyboard helpers behind MenuButton (WAI-ARIA menu button pattern). Pure, so tests need no DOM. */\nimport { rovingIndex } from \"../../internal/keys\";\n\n/**\n * Which item gets focus when `key` on the trigger opens the menu, or null when the key does not open it.\n * Enter and Space are left to the button: its native click opens the menu on the first item.\n */\nexport function menuTriggerKey(key: string): \"first\" | \"last\" | null {\n if (key === \"ArrowDown\") return \"first\";\n if (key === \"ArrowUp\") return \"last\";\n return null;\n}\n\nexport type MenuKeyAction =\n /** Move focus to the item at `index`. */\n | { type: \"focus\"; index: number }\n /** Escape: close and put focus back on the trigger. */\n | { type: \"close\" }\n /** Tab: close, put focus back on the trigger and let the browser move it on. */\n | { type: \"tab\" };\n\n/** What a key does inside an open menu whose focused item is `index` (-1: none) of `count`. Null: not handled. */\nexport function menuKeyStep(key: string, index: number, count: number): MenuKeyAction | null {\n if (key === \"Escape\" || key === \"Esc\") return { type: \"close\" };\n if (key === \"Tab\") return { type: \"tab\" };\n const next = rovingIndex(key, index, count, \"vertical\");\n return next == null ? null : { type: \"focus\", index: next };\n}\n\n/**\n * Typeahead: the first item after `from` (wrapping) whose label starts with `query`. A query of more than one\n * character also accepts the current item, so typing \"de\" stays on \"Delete\". Null when nothing matches.\n */\nexport function menuTypeahead(labels: readonly string[], from: number, query: string): number | null {\n const q = query.toLocaleLowerCase();\n if (!q || labels.length === 0) return null;\n const start = q.length > 1 ? Math.max(0, from) : from + 1;\n for (let n = 0; n < labels.length; n++) {\n const i = (((start + n) % labels.length) + labels.length) % labels.length;\n if (labels[i]?.toLocaleLowerCase().startsWith(q)) return i;\n }\n return null;\n}\n","import { useEffect, useId, useLayoutEffect, useRef, useState, type JSX, type KeyboardEvent } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { usePortal } from \"../../internal/portal\";\nimport { onViewportChange, positionPanel } from \"../../internal/position\";\nimport type { IconName } from \"../../icons\";\nimport { Button } from \"../Button/Button\";\nimport { Icon } from \"../Icon/Icon\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Menu, type MenuEntry, type MenuProps } from \"./Menu\";\nimport { menuKeyStep, menuTriggerKey, menuTypeahead } from \"./menu-keys\";\n\nexport interface MenuButtonProps {\n items: MenuEntry[];\n /** Button text. With `variant=\"icon\"` it is the aria-label and title. */\n label: string;\n /** Leading icon of the button; the glyph with `variant=\"icon\"` (default \"more\"). */\n icon?: IconName;\n /** \"icon\" renders an IconButton; \"ghost\" a borderless button (a row of top-bar menus). Default \"secondary\". */\n variant?: \"primary\" | \"secondary\" | \"ghost\" | \"icon\";\n /** Which trigger edge the menu lines up with. Default \"start\". */\n align?: \"start\" | \"end\";\n /** aria-label of the menu. Default: `label`. */\n menuLabel?: string;\n /** Renders `href` items through the app's link component (a Next.js `Link`). */\n renderLink?: MenuProps[\"renderLink\"];\n disabled?: boolean;\n /** Render the menu into `document.body` (position: fixed, flips above when there is no room below). Default true. */\n portal?: boolean;\n className?: string;\n}\n\nconst ITEM = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"]';\nconst TYPEAHEAD_MS = 500;\n\nexport function MenuButton({\n items,\n label,\n icon,\n variant = \"secondary\",\n align = \"start\",\n menuLabel,\n renderLink,\n disabled,\n portal = true,\n className,\n}: MenuButtonProps): JSX.Element {\n const id = useId();\n const menuId = `x-menubtn-${id}`;\n const triggerId = `${menuId}-trigger`;\n const [open, setOpen] = useState(false);\n const anchor = useRef<HTMLSpanElement | null>(null);\n const pop = useRef<HTMLDivElement | null>(null);\n const menu = useRef<HTMLDivElement | null>(null);\n const focusOnOpen = useRef<\"first\" | \"last\">(\"first\");\n const typed = useRef({ query: \"\", at: 0 });\n const inPortal = usePortal(portal);\n const portalled = inPortal.active;\n\n const itemEls = (): HTMLElement[] => Array.from(menu.current?.querySelectorAll<HTMLElement>(ITEM) ?? []);\n const triggerEl = (): HTMLElement | null => anchor.current?.querySelector<HTMLElement>(\"button\") ?? null;\n const close = (restore = true): void => {\n setOpen(false);\n if (restore) triggerEl()?.focus();\n };\n const openAt = (where: \"first\" | \"last\"): void => {\n focusOnOpen.current = where;\n setOpen(true);\n };\n\n useLayoutEffect(() => {\n if (!open) return;\n const els = itemEls();\n (focusOnOpen.current === \"last\" ? els[els.length - 1] : els[0])?.focus();\n if (!portalled) return;\n const place = (): void => void positionPanel(anchor.current, pop.current, { align });\n place();\n return onViewportChange(place);\n }, [open, portalled, align]); // eslint-disable-line react-hooks/exhaustive-deps -- refs are stable\n\n // Clicking elsewhere without the backdrop (e.g. focus moved by script) still closes it.\n useEffect(() => {\n if (!open) return;\n const onFocus = (e: FocusEvent): void => {\n const t = e.target as Node | null;\n if (t && !menu.current?.contains(t) && !anchor.current?.contains(t)) setOpen(false);\n };\n document.addEventListener(\"focusin\", onFocus);\n return () => document.removeEventListener(\"focusin\", onFocus);\n }, [open]);\n\n const onTriggerKey = (e: KeyboardEvent<HTMLButtonElement>): void => {\n const where = menuTriggerKey(e.key);\n if (!where || disabled) return;\n e.preventDefault();\n openAt(where);\n };\n const onTriggerClick = (): void => {\n if (open) close(false);\n else openAt(\"first\");\n };\n\n const onMenuKey = (e: KeyboardEvent<HTMLDivElement>): void => {\n const els = itemEls();\n const index = els.indexOf(document.activeElement as HTMLElement);\n const step = menuKeyStep(e.key, index, els.length);\n if (step?.type === \"focus\") {\n e.preventDefault();\n els[step.index]?.focus();\n } else if (step?.type === \"close\") {\n e.preventDefault();\n e.stopPropagation();\n close();\n } else if (step?.type === \"tab\") {\n close();\n } else if (e.key === \" \" && (e.target as HTMLElement).tagName === \"A\") {\n e.preventDefault();\n (e.target as HTMLElement).click();\n } else if (e.key.length === 1 && e.key !== \" \" && !e.ctrlKey && !e.metaKey && !e.altKey) {\n const now = Date.now();\n const query = now - typed.current.at < TYPEAHEAD_MS ? typed.current.query + e.key : e.key;\n typed.current = { query, at: now };\n const labels = els.map((el) => el.querySelector(\".x-menu-label\")?.textContent ?? el.textContent ?? \"\");\n const hit = menuTypeahead(labels, index, query);\n if (hit != null) els[hit]?.focus();\n }\n };\n\n const aria = {\n id: triggerId,\n \"aria-haspopup\": \"menu\" as const,\n \"aria-expanded\": open,\n \"aria-controls\": open ? menuId : undefined,\n disabled,\n onKeyDown: onTriggerKey,\n onClick: onTriggerClick,\n };\n return (\n <span className={cx(\"x-menubutton\", className)} ref={anchor}>\n {variant === \"icon\" ? (\n <IconButton icon={icon ?? \"more\"} label={label} {...aria} />\n ) : (\n <Button variant={variant} icon={icon} {...aria}>\n {label}\n <Icon name=\"chevron\" className=\"x-menubutton-caret\" />\n </Button>\n )}\n {open\n ? inPortal(\n <>\n <div className=\"ws-menu-backdrop\" aria-hidden=\"true\" onClick={() => close()} />\n <div className=\"x-menubutton-pop\" data-align={align} data-portal={portalled ? \"\" : undefined} ref={pop}>\n <Menu\n id={menuId}\n ref={menu}\n label={menuLabel ?? label}\n items={items}\n renderLink={renderLink}\n roving\n onAction={() => close()}\n onKeyDown={onMenuKey}\n />\n </div>\n </>,\n )\n : null}\n </span>\n );\n}\n","import { useEffect, useId, useRef, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { focusFirst, focusableIn, inertOutside, restoreFocus, trapTarget } from \"../../internal/focus\";\nimport { usePortal } from \"../../internal/portal\";\nimport { Button } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface DialogLabels {\n confirm: string;\n cancel: string;\n /** Accessible name of the close button (`dismissible`). */\n close: string;\n}\n\nconst DEFAULT_LABELS: DialogLabels = { confirm: \"OK\", cancel: \"Cancel\", close: \"Close\" };\n\nexport interface DialogProps {\n title: ReactNode;\n children?: ReactNode;\n confirmLabel?: string;\n /** null hides Cancel. */\n cancelLabel?: string | null;\n onConfirm?: () => void;\n onCancel?: () => void;\n /** role=\"alertdialog\" for destructive confirms; the body is its aria-describedby. */\n alert?: boolean;\n /** Fixed, full-viewport backdrop: Esc calls onCancel, Tab and Shift+Tab wrap inside the dialog, the page behind it is `inert`, focus moves in on mount and returns to the trigger on unmount. */\n modal?: boolean;\n /** Disables the confirm button, e.g. while saving or while the form is invalid. */\n confirmDisabled?: boolean;\n /** Override the English defaults (e.g. for vi). confirmLabel and cancelLabel win over these. */\n labels?: Partial<DialogLabels>;\n /** \"wide\" fills most of the window (a diagram, an image). Default \"default\", 440px. */\n size?: \"default\" | \"wide\";\n /** \"plain\" wraps children in a div, for block content; \"text\" wraps them in a p. Default: p for a string or number, div otherwise. */\n body?: \"text\" | \"plain\";\n /** One line under the title, linked with aria-describedby. */\n description?: ReactNode;\n /** \"danger\" gives the confirm button the danger variant (destructive confirms). */\n tone?: \"default\" | \"danger\";\n /** Working: both actions are disabled, the confirm button shows a spinner and Esc is ignored. */\n busy?: boolean;\n /** With `modal`, render into `document.body` once mounted, so no parent's overflow, transform or z-index clips it. Default true. */\n portal?: boolean;\n /** More choices between Cancel and the confirm button, as secondary `Button`s: \"Only this one\" next to \"Whole series\". */\n secondaryActions?: ReactNode;\n /** Replaces the built-in Cancel and confirm buttons with your own row (a form's submit, a single Close). `null` renders no action row. */\n actions?: ReactNode;\n /** Adds a close button (×) beside the title that calls onCancel. Use it when the dialog has no Cancel button of its own. */\n dismissible?: boolean;\n}\n\nexport function Dialog({ title, children, confirmLabel, cancelLabel, onConfirm, onCancel, alert, modal, confirmDisabled, labels, size = \"default\", body, description, tone, busy, portal = true, secondaryActions, actions, dismissible }: DialogProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const cancelText = cancelLabel === undefined ? l.cancel : cancelLabel;\n const id = useId();\n const titleId = `x-dialog-${id}`;\n const descId = `x-dialog-d-${id}`;\n const bodyId = `${titleId}-body`;\n const ref = useRef<HTMLDivElement | null>(null);\n const backdropRef = useRef<HTMLDivElement | null>(null);\n const inPortal = usePortal(Boolean(modal) && portal);\n // The trigger is read during the first render, before React commits: a child with `autoFocus`\n // has already taken focus by the time an effect runs, and reading it there would \"restore\" focus\n // into the closed dialog.\n const triggerRef = useRef<HTMLElement | null>(typeof document === \"undefined\" ? null : (document.activeElement as HTMLElement | null));\n useEffect(() => {\n if (!modal) return;\n const trigger = triggerRef.current;\n const release = inertOutside(backdropRef.current);\n const root = ref.current;\n // Keep focus a child already took (`autoFocus`); otherwise start on the first control of the\n // body, so the close button in the header is not the first stop.\n if (!root || !root.contains(document.activeElement)) {\n const body = root?.querySelector?.(\".dialog-body\") as HTMLElement | null | undefined;\n const first = body ? focusableIn(body)[0] : undefined;\n if (first) first.focus();\n else focusFirst(root);\n }\n return () => {\n release();\n restoreFocus(trigger);\n };\n }, [modal, inPortal.active]);\n const onKeyDown = modal\n ? (e: KeyboardEvent<HTMLDivElement>): void => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n if (!busy) onCancel?.();\n } else if (e.key === \"Tab\") {\n const target = trapTarget(focusableIn(ref.current), document.activeElement, e.shiftKey);\n if (target) {\n e.preventDefault();\n target.focus();\n }\n }\n }\n : undefined;\n const asText = body ? body === \"text\" : typeof children === \"string\" || typeof children === \"number\";\n return inPortal(\n <div className=\"dialog-backdrop\" ref={backdropRef} data-modal={modal ? \"true\" : undefined} onKeyDown={onKeyDown}>\n <div className=\"dialog\" data-size={size} ref={ref} tabIndex={modal ? -1 : undefined} role={alert ? \"alertdialog\" : \"dialog\"} aria-modal={modal ? \"true\" : undefined} aria-labelledby={titleId} aria-describedby={[description ? descId : null, alert && children ? bodyId : null].filter(Boolean).join(\" \") || undefined} aria-busy={busy ? \"true\" : undefined}>\n {dismissible ? (\n <div className=\"dialog-head\">\n <div className=\"dialog-head-text\">\n <h2 className=\"dialog-title\" id={titleId}>\n {title}\n </h2>\n {description ? (\n <p className=\"dialog-desc\" id={descId}>\n {description}\n </p>\n ) : null}\n </div>\n <IconButton icon=\"close\" label={l.close} onClick={onCancel} disabled={busy || undefined} />\n </div>\n ) : (\n <>\n <h2 className=\"dialog-title\" id={titleId}>\n {title}\n </h2>\n {description ? (\n <p className=\"dialog-desc\" id={descId}>\n {description}\n </p>\n ) : null}\n </>\n )}\n {!children ? null : asText ? <p className=\"dialog-body\" id={alert ? bodyId : undefined}>{children}</p> : <div className=\"dialog-body\" id={alert ? bodyId : undefined}>{children}</div>}\n {actions !== undefined ? (\n actions === null ? null : <div className=\"dialog-actions\">{actions}</div>\n ) : (\n <div className=\"dialog-actions\">\n {cancelText !== null ? (\n <Button variant=\"secondary\" onClick={onCancel} disabled={busy || undefined}>\n {cancelText}\n </Button>\n ) : null}\n {secondaryActions}\n <Button onClick={onConfirm} disabled={confirmDisabled || busy || undefined} variant={tone === \"danger\" ? \"danger\" : \"primary\"}>\n {busy ? (\n <span className=\"x-spinner\" data-size=\"sm\" aria-hidden=\"true\">\n <span className=\"x-spinner-ring\" />\n </span>\n ) : null}\n {confirmLabel ?? l.confirm}\n </Button>\n </div>\n )}\n </div>\n </div>,\n ) as JSX.Element;\n}\n","import { useId, useRef, type FormEvent, type JSX, type ReactNode, type RefObject } from \"react\";\nimport { useModal } from \"../../internal/modal\";\nimport { usePortal } from \"../../internal/portal\";\nimport { Button } from \"../Button/Button\";\n\nexport interface FormDialogLabels {\n submit: string;\n cancel: string;\n /** Shown on the submit button while `busy`. */\n saving: string;\n}\n\nconst DEFAULT_LABELS: FormDialogLabels = { submit: \"Save\", cancel: \"Cancel\", saving: \"Saving…\" };\n\nexport interface FormDialogProps {\n title: ReactNode;\n /** One line under the title. */\n description?: ReactNode;\n /** The fields. */\n children?: ReactNode;\n /** Called with the submit event; the default navigation is already prevented. */\n onSubmit: (e: FormEvent<HTMLFormElement>) => void;\n formId?: undefined;\n /** Cancel, Esc and the backdrop. Not called while `busy`. */\n onCancel: () => void;\n /** Submitting: the submit button shows `labels.saving` with a spinner and every close request is ignored. */\n busy?: boolean;\n /** A server error for the whole form, shown above the actions with role=\"alert\". Field errors go on each Field. */\n error?: ReactNode;\n /** Disables submit, e.g. while nothing changed. */\n submitDisabled?: boolean;\n /** Overrides `labels.submit` with the verb of the action (\"Create user\"). */\n submitLabel?: string;\n size?: \"default\" | \"wide\";\n /** false renders the markup only (previews). Default true. */\n modal?: boolean;\n labels?: Partial<FormDialogLabels>;\n /** With `modal`, render into `document.body` once mounted, so no parent's overflow, transform or z-index clips it. Default true. */\n portal?: boolean;\n}\n\n/** FormDialog around a `<form id={formId}>` you render in `children` (e.g. one owned by a form library). */\nexport interface FormDialogExternalFormProps extends Omit<FormDialogProps, \"onSubmit\" | \"formId\"> {\n /** id of your form: FormDialog renders no form of its own and the submit button gets `form={formId}`. Handle submit and `busy` on that form. */\n formId: string;\n onSubmit?: undefined;\n}\n\nexport function FormDialog({ title, description, children, onSubmit, formId, onCancel, busy, error, submitDisabled, submitLabel, size = \"default\", modal = true, labels, portal = true }: FormDialogProps | FormDialogExternalFormProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const titleId = `x-fdialog-${id}`;\n const descId = `x-fdialog-d-${id}`;\n const root = useRef<HTMLDivElement | null>(null);\n const panel = useRef<HTMLElement | null>(null);\n const cancel = (): void => {\n if (!busy) onCancel();\n };\n const inPortal = usePortal(modal && portal);\n const onKeyDown = useModal(modal, root, panel, cancel, inPortal.active);\n const submit = (e: FormEvent<HTMLFormElement>): void => {\n e.preventDefault();\n if (!busy) onSubmit?.(e);\n };\n const panelProps = {\n className: \"dialog x-form-dialog\",\n \"data-size\": size,\n role: \"dialog\",\n \"aria-modal\": modal ? (\"true\" as const) : undefined,\n \"aria-labelledby\": titleId,\n \"aria-describedby\": description ? descId : undefined,\n \"aria-busy\": busy ? (\"true\" as const) : undefined,\n tabIndex: modal ? -1 : undefined,\n };\n const content = (\n <>\n <h2 className=\"dialog-title\" id={titleId}>\n {title}\n </h2>\n {description ? (\n <p className=\"x-form-dialog-desc\" id={descId}>\n {description}\n </p>\n ) : null}\n <div className=\"dialog-body x-form-dialog-fields\">{children}</div>\n {error ? (\n <p className=\"x-form-dialog-error\" role=\"alert\">\n {error}\n </p>\n ) : null}\n <div className=\"dialog-actions\">\n <Button variant=\"secondary\" onClick={cancel} disabled={busy}>\n {l.cancel}\n </Button>\n <Button variant=\"primary\" type=\"submit\" form={formId} disabled={submitDisabled || busy}>\n {busy ? (\n <span className=\"x-spinner\" data-size=\"sm\" aria-hidden=\"true\">\n <span className=\"x-spinner-ring\" />\n </span>\n ) : null}\n {busy ? l.saving : (submitLabel ?? l.submit)}\n </Button>\n </div>\n </>\n );\n return inPortal(\n <div className=\"dialog-backdrop\" ref={root} data-modal={modal ? \"true\" : undefined} onKeyDown={onKeyDown}>\n {formId ? (\n <div ref={panel as RefObject<HTMLDivElement | null>} {...panelProps}>\n {content}\n </div>\n ) : (\n <form ref={panel as RefObject<HTMLFormElement | null>} {...panelProps} noValidate onSubmit={submit}>\n {content}\n </form>\n )}\n </div>,\n ) as JSX.Element;\n}\n","import { useId, useRef, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { useModal } from \"../../internal/modal\";\nimport { usePortal } from \"../../internal/portal\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface DrawerLabels {\n close: string;\n}\n\nconst DEFAULT_LABELS: DrawerLabels = { close: \"Close\" };\n\nexport interface DrawerProps {\n title: ReactNode;\n /** One line under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Actions pinned to the bottom (Cancel, then the primary Button). */\n footer?: ReactNode;\n /** Esc, the close button and a click on the backdrop call it. Not called while `busy`. */\n onClose: () => void;\n /** Ignore close requests, e.g. while saving. */\n busy?: boolean;\n /** \"default\" 420px, \"wide\" 640px; both cap at the viewport. */\n size?: \"default\" | \"wide\";\n /** Which edge it slides from. Default \"end\" (right in LTR). \"bottom\" is a sheet: full width, capped at 85% of the height. */\n side?: \"end\" | \"start\" | \"bottom\";\n /** false renders the markup only (previews); default true traps focus and makes the page inert. */\n modal?: boolean;\n labels?: Partial<DrawerLabels>;\n /** With `modal`, render into `document.body` once mounted, so no parent's overflow, transform or z-index clips it. Default true. */\n portal?: boolean;\n className?: string;\n}\n\nexport function Drawer({ title, description, children, footer, onClose, busy, size = \"default\", side = \"end\", modal = true, labels, portal = true, className }: DrawerProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const titleId = `x-drawer-${id}`;\n const descId = `x-drawer-d-${id}`;\n const root = useRef<HTMLDivElement | null>(null);\n const panel = useRef<HTMLDivElement | null>(null);\n const close = (): void => {\n if (!busy) onClose();\n };\n const inPortal = usePortal(modal && portal);\n const onKeyDown = useModal(modal, root, panel, close, inPortal.active);\n return inPortal(\n <div className=\"x-drawer-root\" ref={root} data-modal={modal ? \"true\" : undefined} onKeyDown={onKeyDown}>\n <div className=\"x-drawer-backdrop\" aria-hidden=\"true\" onClick={close} />\n <div\n ref={panel}\n className={cx(\"x-drawer\", className)}\n role=\"dialog\"\n aria-modal={modal ? \"true\" : undefined}\n aria-labelledby={titleId}\n aria-describedby={description ? descId : undefined}\n aria-busy={busy ? \"true\" : undefined}\n data-size={size}\n data-side={side}\n tabIndex={-1}\n >\n <header className=\"x-drawer-head\">\n <div>\n <h2 className=\"x-drawer-title\" id={titleId}>\n {title}\n </h2>\n {description ? (\n <p className=\"x-drawer-desc\" id={descId}>\n {description}\n </p>\n ) : null}\n </div>\n <IconButton icon=\"close\" label={l.close} onClick={close} disabled={busy} />\n </header>\n <div className=\"x-drawer-body\">{children}</div>\n {footer ? <footer className=\"x-drawer-foot\">{footer}</footer> : null}\n </div>\n </div>,\n ) as JSX.Element;\n}\n","/** Pure pan and zoom math for a viewer (an image, a diagram). No DOM, so tests need none. */\n\nexport interface Size {\n w: number;\n h: number;\n}\nexport interface Point {\n x: number;\n y: number;\n}\n/** `zoom` scales the content; `x` and `y` move its top-left corner inside the viewport. */\nexport interface PanZoomState extends Point {\n zoom: number;\n}\n\nexport const MIN_ZOOM = 0.25;\nexport const MAX_ZOOM = 8;\nexport const ZOOM_STEP = 1.25;\n\n/**\n * The scale at which `img` fits inside `box` minus `padding` on every side. Without `upscale` it\n * never goes above 1, so a small raster image stays sharp; a vector image passes `upscale`.\n * An empty size gives 1.\n */\nexport function fitScale(img: Size, box: Size, opts: { padding: number; upscale: boolean }): number {\n const w = box.w - opts.padding * 2;\n const h = box.h - opts.padding * 2;\n if (img.w <= 0 || img.h <= 0 || w <= 0 || h <= 0) return 1;\n const s = Math.min(w / img.w, h / img.h);\n return opts.upscale ? s : Math.min(1, s);\n}\n\nexport function clampZoom(z: number, min = MIN_ZOOM, max = MAX_ZOOM): number {\n return Math.min(max, Math.max(min, z));\n}\n\n/** One step in (`1`) or out (`-1`), clamped. */\nexport function stepZoom(z: number, dir: 1 | -1, step = ZOOM_STEP, min = MIN_ZOOM, max = MAX_ZOOM): number {\n return clampZoom(dir === 1 ? z * step : z / step, min, max);\n}\n\n/**\n * Zooms by `factor` keeping the content under `point` (viewport coordinates) where it is.\n * The result is clamped to `min`..`max` (the absolute zoom, default 0.25..8), so a factor past\n * the limit changes nothing.\n */\nexport function zoomAt(state: PanZoomState, point: Point, factor: number, min = MIN_ZOOM, max = MAX_ZOOM): PanZoomState {\n const zoom = clampZoom(state.zoom * factor, min, max);\n const k = zoom / state.zoom;\n return { zoom, x: point.x - (point.x - state.x) * k, y: point.y - (point.y - state.y) * k };\n}\n\n/** The shown percentage: the zoom on top of the fit scale. */\nexport function percentOf(zoom: number, fit: number): number {\n return Math.round(zoom * fit * 100);\n}\n\n/** What a key does in a pan and zoom viewport, or null when it is not handled. */\nexport function zoomKey(key: string): \"in\" | \"out\" | \"reset\" | null {\n if (key === \"+\" || key === \"=\") return \"in\";\n if (key === \"-\" || key === \"_\") return \"out\";\n if (key === \"0\") return \"reset\";\n return null;\n}\n\n/** The zoom factor of one wheel event: smooth for a trackpad, a step for a mouse wheel. */\nexport function wheelFactor(deltaY: number): number {\n return Math.exp(-Math.max(-100, Math.min(100, deltaY)) * 0.0025);\n}\n","import { useEffect, useRef, type JSX, type KeyboardEvent, type PointerEvent, type ReactNode } from \"react\";\nimport { MAX_ZOOM, MIN_ZOOM, stepZoom, wheelFactor, zoomAt, zoomKey, type PanZoomState } from \"../../panZoom\";\n\nexport interface PanZoomProps {\n /** Scale of the content. */\n zoom: number;\n /** Where the content's top-left corner sits inside the viewport, in px. */\n x: number;\n y: number;\n /** Zoom changed (wheel, keys); `x` and `y` are the pan that keeps the zoom point still. */\n onZoom: (next: PanZoomState) => void;\n /** The `0` key. When given it replaces the default reset to zoom 1 at 0, 0 (a viewer resets to its fit). */\n onReset?: () => void;\n /** The content was dragged. */\n onPan: (x: number, y: number) => void;\n /** Lowest absolute zoom (default 0.25). Pass a value relative to a fit scale when `zoom` 1 is \"fit\". */\n min?: number;\n /** Highest absolute zoom (default 8). */\n max?: number;\n /** Accessible name of the viewport. */\n label: string;\n children?: ReactNode;\n}\n\n/** A viewport that scales and moves its children. The caller owns the state. */\nexport function PanZoom({ zoom, x, y, onZoom, onPan, onReset, label, min = MIN_ZOOM, max = MAX_ZOOM, children }: PanZoomProps): JSX.Element {\n const drag = useRef<{ px: number; py: number; x: number; y: number } | null>(null);\n const root = useRef<HTMLDivElement>(null);\n // A React `onWheel` is passive, so its `preventDefault()` is ignored and the page zooms too.\n useEffect(() => {\n const node = root.current;\n if (!node) return;\n const onWheel = (e: globalThis.WheelEvent): void => {\n if (!e.ctrlKey && !e.metaKey) return;\n e.preventDefault();\n const r = node.getBoundingClientRect();\n onZoom(zoomAt({ zoom, x, y }, { x: e.clientX - r.left, y: e.clientY - r.top }, wheelFactor(e.deltaY), min, max));\n };\n node.addEventListener(\"wheel\", onWheel, { passive: false });\n return () => node.removeEventListener(\"wheel\", onWheel);\n }, [zoom, x, y, onZoom, min, max]);\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n if (e.ctrlKey || e.metaKey || e.altKey) return;\n const action = zoomKey(e.key);\n if (action === null) return;\n e.preventDefault();\n if (action === \"reset\") return onReset ? onReset() : onZoom({ zoom: 1, x: 0, y: 0 });\n const r = e.currentTarget.getBoundingClientRect();\n const next = stepZoom(zoom, action === \"in\" ? 1 : -1, undefined, min, max);\n onZoom(zoomAt({ zoom, x, y }, { x: r.width / 2, y: r.height / 2 }, next / zoom));\n };\n const onPointerDown = (e: PointerEvent<HTMLDivElement>): void => {\n if (e.button !== 0) return;\n drag.current = { px: e.clientX, py: e.clientY, x, y };\n // will-change only while dragging (CSS reads it): a permanent layer would blur the content after a zoom.\n e.currentTarget.setAttribute(\"data-panning\", \"\");\n e.currentTarget.setPointerCapture?.(e.pointerId);\n };\n const onPointerMove = (e: PointerEvent<HTMLDivElement>): void => {\n const d = drag.current;\n if (d) onPan(d.x + e.clientX - d.px, d.y + e.clientY - d.py);\n };\n const onPointerUp = (e: PointerEvent<HTMLDivElement>): void => {\n drag.current = null;\n e.currentTarget.removeAttribute(\"data-panning\");\n e.currentTarget.releasePointerCapture?.(e.pointerId);\n };\n return (\n <div\n ref={root}\n className=\"x-panzoom\"\n role=\"group\"\n aria-label={label}\n tabIndex={0}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n <div className=\"x-panzoom-content\" style={{ transform: `translate(${x}px, ${y}px) scale(${zoom})` }}>\n {children}\n </div>\n </div>\n );\n}\n","import type { CSSProperties, JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { avatarInitials } from \"../Avatar/Avatar\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface EmblemProps {\n /** The thing's name: the accessible label, and the source of the letters when `text` is not given. */\n name: string;\n /** One to three letters to show instead of the initials (\"OA\", \"ARK\"). */\n text?: string;\n /** A logo: a `data:` or same-origin URL. Shown instead of the letters. */\n src?: string | null;\n /** An icon instead of letters, for a thing that is a kind, not a brand. */\n icon?: IconName;\n /** The thing's own colour, any CSS colour. The tile is a tint of it and the letters lean towards it. Default: the accent. */\n color?: string | null;\n /** 24, 32 or 48 px. Default \"md\". */\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n}\n\nconst ICON_SIZE = { sm: 14, md: 18, lg: 24 } as const;\n\n/** A rounded square that stands for one thing (a provider, an integration, a tool): its logo, an icon, or its letters on a tint of its colour. */\nexport function Emblem({ name, text, src, icon, color, size = \"md\", className }: EmblemProps): JSX.Element {\n const style = color ? ({ \"--x-emblem-color\": color } as CSSProperties) : undefined;\n return (\n <span className={cx(\"x-emblem\", className)} data-size={size} data-logo={src ? \"\" : undefined} role=\"img\" aria-label={name} style={style}>\n {src ? (\n <img className=\"x-emblem-img\" alt=\"\" src={src} />\n ) : icon ? (\n <Icon name={icon} size={ICON_SIZE[size]} />\n ) : (\n <span className=\"x-emblem-text\" aria-hidden=\"true\">\n {Array.from(text?.trim() || avatarInitials(name)).slice(0, 3).join(\"\")}\n </span>\n )}\n </span>\n );\n}\n","import { useCallback, useEffect, useId, useRef, useState, type CSSProperties, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { fitScale, stepZoom, zoomAt, type PanZoomState } from \"../../panZoom\";\nimport { Emblem } from \"../Emblem/Emblem\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { PanZoom } from \"../PanZoom/PanZoom\";\n\n/** Size of a node and of the hub in the map, in px at zoom 1. The stylesheet reads them from the root. */\nexport const FLOW_NODE = { w: 220, h: 64 } as const;\nexport const FLOW_HUB = { w: 272, h: 80 } as const;\nconst PAD = 48;\nconst GRID = 24;\n/** Fit never enlarges past this, so one node does not fill the panel. */\nconst FIT_MAX = 1.5;\nconst MIN = 0.1;\nconst MAX = 4;\n\nexport interface FlowMapNode {\n id: string;\n name: string;\n /** Logo URL, as in `Emblem`. */\n src?: string | null;\n /** The thing's own colour and letters, as in `Emblem`. */\n color?: string | null;\n text?: string;\n /** A short line under the name (\"12 requests\"). The state is said here, not only by the edge colour. */\n detail?: string;\n /** Traffic went through this edge: the edge is drawn in colour and moves. */\n active?: boolean;\n /** This node's share of the traffic, 0 to 1: its edge grows from 1.5px to 5px and carries more, faster packets. */\n weight?: number;\n /** Failures: the node's border and edge turn amber or red. Say the same in `detail` (\"3 failed\"). */\n tone?: \"warn\" | \"danger\";\n}\n\nexport interface FlowMapLabels {\n zoomIn: string;\n zoomOut: string;\n fit: string;\n /** aria-label of the controls group. */\n controls: string;\n}\n\nconst DEFAULT_LABELS: FlowMapLabels = { zoomIn: \"Zoom in\", zoomOut: \"Zoom out\", fit: \"Fit to view\", controls: \"Zoom\" };\n\nexport interface FlowMapProps {\n /** The centre every node connects to. `mark` replaces the default letters (a `BrandMark`, an `Emblem`). */\n hub: { name: string; mark?: ReactNode; detail?: string };\n /** Where traffic goes (providers). Round the hub, or in a column on its right when there are `sources`. */\n nodes: FlowMapNode[];\n /** What sends traffic in (callers, apps). Given, the map reads left to right: sources, hub, nodes, on curved edges. */\n sources?: FlowMapNode[];\n /** Accessible name of the map. */\n label: string;\n labels?: Partial<FlowMapLabels>;\n className?: string;\n}\n\n/**\n * Where each of `count` nodes sits around the hub at 0, 0, in px. One node sits straight above it; more go round an\n * ellipse from the top, clockwise, sized so no two boxes (and no box and the hub) come closer than 16 px.\n */\nexport function flowMapLayout(count: number): Array<{ x: number; y: number }> {\n if (count <= 0) return [];\n // Even angles on an ellipse: two neighbours are rx·Δθ apart at the top and ry·Δθ at the sides, and only ~0.7 of each\n // at 45°, hence the 1.45. The minimums keep the hub clear when there are few nodes.\n const step = (2 * Math.PI) / count;\n const rx = Math.max(FLOW_NODE.w / 2 + FLOW_HUB.w / 2 + 48, (1.45 * (FLOW_NODE.w + 24)) / step);\n const ry = Math.max(FLOW_NODE.h + FLOW_HUB.h + 48, (1.45 * (FLOW_NODE.h + 24)) / step);\n return Array.from({ length: count }, (_, i) => {\n const a = -Math.PI / 2 + i * step;\n return { x: Math.abs(Math.cos(a)) < 1e-9 ? 0 : rx * Math.cos(a), y: ry * Math.sin(a) };\n });\n}\n\n/** Room between the hub and a column, for the curves. */\nconst SIDE_GAP = 120;\nconst ROW_GAP = 20;\n\n/**\n * Where `left` sources and `right` nodes sit in the left-to-right map, hub at 0, 0: one column each side, every\n * column centred on the hub, rows 20 px apart.\n */\nexport function flowMapSides(left: number, right: number): { left: Array<{ x: number; y: number }>; right: Array<{ x: number; y: number }> } {\n const x = FLOW_HUB.w / 2 + SIDE_GAP + FLOW_NODE.w / 2;\n const column = (count: number, at: number) =>\n Array.from({ length: count }, (_, i) => ({ x: at, y: (i - (count - 1) / 2) * (FLOW_NODE.h + ROW_GAP) }));\n return { left: column(left, -x), right: column(right, x) };\n}\n\n/** Where the k-th of n edges meets the side of the hub: spread over its middle half so the curves fan out. */\nconst hubY = (k: number, n: number) => (n <= 1 ? 0 : (k / (n - 1) - 0.5) * (FLOW_HUB.h / 2));\n\n/** A horizontal S-curve from one point to another. */\nconst curve = (x1: number, y1: number, x2: number, y2: number) => {\n const mx = (x1 + x2) / 2;\n return `M${x1} ${y1}C${mx} ${y1} ${mx} ${y2} ${x2} ${y2}`;\n};\n\nconst clamp01 = (n: number | undefined) => Math.min(1, Math.max(0, n ?? 0));\n\nfunction bounds(points: Array<{ x: number; y: number }>) {\n let minX = -FLOW_HUB.w / 2, maxX = FLOW_HUB.w / 2, minY = -FLOW_HUB.h / 2, maxY = FLOW_HUB.h / 2;\n for (const p of points) {\n minX = Math.min(minX, p.x - FLOW_NODE.w / 2);\n maxX = Math.max(maxX, p.x + FLOW_NODE.w / 2);\n minY = Math.min(minY, p.y - FLOW_NODE.h / 2);\n maxY = Math.max(maxY, p.y + FLOW_NODE.h / 2);\n }\n return { left: minX - PAD, top: minY - PAD, w: maxX - minX + PAD * 2, h: maxY - minY + PAD * 2 };\n}\n\n/** Packets on an edge: one to three by weight, the heavier the faster, spread evenly along it. */\nfunction packets(weight: number): { dur: number; begins: number[] } {\n const count = 1 + Math.round(weight * 2);\n const dur = Math.round((2.6 - weight * 1.2) * 100) / 100;\n return { dur, begins: Array.from({ length: count }, (_, k) => -Math.round(((dur * k) / count) * 100) / 100) };\n}\n\n/**\n * One edge: a quiet track always; when it carried traffic, a soft glow, the line in colour (width from the node's\n * weight) and packets running along it from the sender to the receiver.\n */\nfunction Edge({ node, side, d }: { node: FlowMapNode; side?: \"in\" | \"out\"; d: string }): JSX.Element {\n const id = `x-flowmap-${useId().replace(/[^\\w-]/g, \"\")}`;\n const weight = clamp01(node.weight);\n const style = { \"--x-flowmap-weight\": weight } as CSSProperties;\n const run = packets(weight);\n return (\n <g data-side={side} data-tone={node.tone}>\n <path className=\"x-flowmap-track\" d={d} />\n {node.active && <path className=\"x-flowmap-glow\" d={d} style={style} />}\n <path id={id} className=\"x-flowmap-edge\" data-active={node.active ? \"\" : undefined} d={d} style={style} />\n {node.active &&\n run.begins.map((begin) => (\n <circle key={begin} className=\"x-flowmap-packet\" r={2.5 + weight * 1.5}>\n <animateMotion dur={`${run.dur}s`} begin={`${begin}s`} repeatCount=\"indefinite\" calcMode=\"linear\">\n <mpath href={`#${id}`} />\n </animateMotion>\n </circle>\n ))}\n </g>\n );\n}\n\nfunction Node({ node: n, style }: { node: FlowMapNode; style: CSSProperties }): JSX.Element {\n return (\n <li className=\"x-flowmap-node\" data-active={n.active ? \"\" : undefined} data-tone={n.tone} style={style}>\n <Emblem name={n.name} src={n.src} color={n.color} text={n.text} size=\"md\" />\n <span className=\"x-flowmap-text\">\n <span className=\"x-flowmap-name\">{n.name}</span>\n {n.detail && <span className=\"x-flowmap-detail\">{n.detail}</span>}\n </span>\n </li>\n );\n}\n\n/** A hub and the things connected to it, on a grid you can pan and zoom (9router's usage topology). */\nexport function FlowMap({ hub, nodes, sources = [], label, labels, className }: FlowMapProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const sides = sources.length > 0;\n const placed = sides ? flowMapSides(sources.length, nodes.length) : { left: [], right: flowMapLayout(nodes.length) };\n const points = placed.right;\n const world = bounds([...placed.left, ...points]);\n const root = useRef<HTMLDivElement>(null);\n const [box, setBox] = useState<{ w: number; h: number } | null>(null);\n const [view, setView] = useState<PanZoomState | null>(null);\n /** True until the user zooms or pans: a resize or a new node then fits again. */\n const [auto, setAuto] = useState(true);\n\n const fit = useCallback((): PanZoomState | null => {\n if (!box) return null;\n const zoom = Math.min(FIT_MAX, fitScale({ w: world.w, h: world.h }, box, { padding: 0, upscale: true }));\n return { zoom, x: (box.w - world.w * zoom) / 2, y: (box.h - world.h * zoom) / 2 };\n }, [box, world.w, world.h]);\n\n useEffect(() => {\n const node = root.current;\n if (!node || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(([entry]) => {\n if (entry) setBox({ w: entry.contentRect.width, h: entry.contentRect.height });\n });\n ro.observe(node);\n return () => ro.disconnect();\n }, []);\n useEffect(() => {\n if (auto) setView(fit());\n }, [auto, fit]);\n\n const current = view ?? { zoom: 1, x: 0, y: 0 };\n const change = (next: PanZoomState): void => {\n setAuto(false);\n setView(next);\n };\n const step = (dir: 1 | -1): void => {\n if (!box) return;\n const next = stepZoom(current.zoom, dir, undefined, MIN, MAX);\n change(zoomAt(current, { x: box.w / 2, y: box.h / 2 }, next / current.zoom, MIN, MAX));\n };\n const refit = (): void => {\n setAuto(true);\n setView(fit());\n };\n\n const at = (p: { x: number; y: number }) => ({ left: p.x - world.left, top: p.y - world.top });\n const centre = at({ x: 0, y: 0 });\n const style = {\n \"--x-flowmap-node-w\": `${FLOW_NODE.w}px`,\n \"--x-flowmap-node-h\": `${FLOW_NODE.h}px`,\n \"--x-flowmap-hub-w\": `${FLOW_HUB.w}px`,\n \"--x-flowmap-hub-h\": `${FLOW_HUB.h}px`,\n \"--x-flowmap-grid\": `${GRID * current.zoom}px`,\n \"--x-flowmap-grid-x\": `${current.x}px`,\n \"--x-flowmap-grid-y\": `${current.y}px`,\n } as CSSProperties;\n\n return (\n <div ref={root} className={cx(\"x-flowmap\", className)} data-ready={view ? \"\" : undefined} style={style}>\n <PanZoom\n zoom={current.zoom}\n x={current.x}\n y={current.y}\n min={MIN}\n max={MAX}\n label={label}\n onZoom={change}\n onPan={(x, y) => change({ ...current, x, y })}\n onReset={refit}\n >\n <div className=\"x-flowmap-world\" style={{ width: world.w, height: world.h }}>\n <svg className=\"x-flowmap-edges\" width={world.w} height={world.h} aria-hidden=\"true\">\n {sources.map((n, i) => {\n const from = at(placed.left[i]!);\n const d = curve(from.left + FLOW_NODE.w / 2, from.top, centre.left - FLOW_HUB.w / 2, centre.top + hubY(i, sources.length));\n return <Edge key={`in-${n.id}`} node={n} side=\"in\" d={d} />;\n })}\n {points.map((p, i) => {\n const node = nodes[i]!;\n const end = at(p);\n const d = sides\n ? curve(centre.left + FLOW_HUB.w / 2, centre.top + hubY(i, nodes.length), end.left - FLOW_NODE.w / 2, end.top)\n : `M${centre.left} ${centre.top}L${end.left} ${end.top}`;\n return <Edge key={node.id} node={node} side={sides ? \"out\" : undefined} d={d} />;\n })}\n </svg>\n {sources.length > 0 && (\n <ul className=\"x-flowmap-nodes\" data-side=\"in\">\n {sources.map((n, i) => (\n <Node key={n.id} node={n} style={at(placed.left[i]!)} />\n ))}\n </ul>\n )}\n {nodes.length > 0 && (\n <ul className=\"x-flowmap-nodes\" data-side={sides ? \"out\" : undefined}>\n {nodes.map((n, i) => (\n <Node key={n.id} node={n} style={at(points[i]!)} />\n ))}\n </ul>\n )}\n <div className=\"x-flowmap-node x-flowmap-hub\" style={centre}>\n {hub.mark ?? <Emblem name={hub.name} size=\"lg\" />}\n <span className=\"x-flowmap-text\">\n <span className=\"x-flowmap-name\">{hub.name}</span>\n {hub.detail && <span className=\"x-flowmap-detail\">{hub.detail}</span>}\n </span>\n </div>\n </div>\n </PanZoom>\n <div className=\"x-flowmap-controls\" role=\"group\" aria-label={l.controls}>\n <IconButton icon=\"plus\" size=\"sm\" label={l.zoomIn} onClick={() => step(1)} />\n <IconButton icon=\"minus\" size=\"sm\" label={l.zoomOut} onClick={() => step(-1)} />\n <IconButton icon=\"maximize\" size=\"sm\" label={l.fit} onClick={refit} />\n </div>\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface RouteNode {\n id: string;\n label: ReactNode;\n /** 16px icon before the label. */\n icon?: IconName;\n /** Quiet second line: a count, a host, a model. */\n detail?: ReactNode;\n}\n\nexport interface RouteDiagramProps {\n /** Accessible name of the figure (\"Request route\"). */\n label: string;\n /** What sends traffic in, on the left (clients, agents, apps). */\n inputs: RouteNode[];\n /** The router in the middle. `mark` is your product mark, usually `BrandMark variant=\"tile\"`. */\n hub: { name: ReactNode; mark?: ReactNode; detail?: ReactNode };\n /** Where traffic leaves to, on the right (providers, accounts, keys). */\n outputs: RouteNode[];\n className?: string;\n}\n\nfunction Side({ side, nodes }: { side: \"in\" | \"out\"; nodes: RouteNode[] }): JSX.Element {\n return (\n <ul className=\"x-route-side\" data-side={side}>\n {nodes.map((n) => (\n <li key={n.id} className=\"x-route-node\">\n {n.icon ? <Icon name={n.icon} size={16} className=\"x-route-icon\" /> : null}\n <span className=\"x-route-text\">\n <span className=\"x-route-label\">{n.label}</span>\n {n.detail != null ? <span className=\"x-route-detail\">{n.detail}</span> : null}\n </span>\n </li>\n ))}\n </ul>\n );\n}\n\n/** Traffic in on the left, the router in the middle, traffic out on the right. Stacks top to bottom in a narrow container. */\nexport function RouteDiagram({ label, inputs, hub, outputs, className }: RouteDiagramProps): JSX.Element {\n return (\n <figure className={cx(\"x-route\", className)} aria-label={label}>\n <div className=\"x-route-body\">\n <Side side=\"in\" nodes={inputs} />\n <span className=\"x-route-line\" data-side=\"in\" aria-hidden=\"true\" />\n <div className=\"x-route-hub\">\n {hub.mark ? <span className=\"x-route-hub-mark\">{hub.mark}</span> : null}\n <span className=\"x-route-hub-name\">{hub.name}</span>\n {hub.detail != null ? <span className=\"x-route-detail\">{hub.detail}</span> : null}\n </div>\n <span className=\"x-route-line\" data-side=\"out\" aria-hidden=\"true\" />\n <Side side=\"out\" nodes={outputs} />\n </div>\n </figure>\n );\n}\n","import { useId, type HTMLAttributes, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface CardProps extends Omit<HTMLAttributes<HTMLElement>, \"title\"> {\n /** Heading of the card; also names the section. */\n title?: ReactNode;\n /** A control set right after the title, outside the heading: a mode or filter select that acts on the whole card. */\n titleAside?: ReactNode;\n /** Line under the title (a path, branch or count). */\n subtitle?: ReactNode;\n /** Set the subtitle in the mono face. */\n monoSubtitle?: boolean;\n /** Buttons at the right of the head. */\n actions?: ReactNode;\n /** Drops the body padding, for a diff or list that runs edge to edge. */\n flush?: boolean;\n children?: ReactNode;\n className?: string;\n /** Class on the `.x-card-body`, e.g. a grid or gap utility for the content. */\n bodyClassName?: string;\n /** Heading element of the title, to fit the page outline. Default 3 (h3). */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n}\n\nexport function Card({ title, titleAside, subtitle, monoSubtitle = false, actions, flush = false, children, className, bodyClassName, headingLevel = 3, ...rest }: CardProps): JSX.Element {\n const titleId = `x-card-${useId()}`;\n const head = title || subtitle || actions;\n const Heading = `h${headingLevel}` as \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <section {...rest} className={cx(\"x-card\", className)} aria-labelledby={title ? titleId : rest[\"aria-labelledby\"]}>\n {head ? (\n <div className=\"x-card-head\">\n <div className=\"x-card-heading\">\n {title && titleAside ? (\n <div className=\"x-card-title-row\">\n <Heading className=\"x-card-title\" id={titleId}>\n {title}\n </Heading>\n {titleAside}\n </div>\n ) : title ? (\n <Heading className=\"x-card-title\" id={titleId}>\n {title}\n </Heading>\n ) : null}\n {subtitle ? <p className={cx(\"x-card-sub\", monoSubtitle && \"ws-mono\")}>{subtitle}</p> : null}\n </div>\n {actions ? <div className=\"x-card-actions\">{actions}</div> : null}\n </div>\n ) : null}\n <div className={cx(\"x-card-body\", bodyClassName)} data-flush={flush ? \"\" : undefined}>\n {children}\n </div>\n </section>\n );\n}\n","import { useEffect, useRef, useState, type JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface CodeBlockLabels {\n /** Copy button text. */\n copy: string;\n /** Button text for a short while after a copy. */\n copied: string;\n}\n\nconst DEFAULT_LABELS: CodeBlockLabels = { copy: \"Copy\", copied: \"Copied\" };\n\nexport interface CodeBlockProps {\n /** Exact text to show and copy. Not highlighted. */\n code: string;\n /** Small label in the head (\"bash\", \"json\", \"MCP config\"). */\n language?: string;\n /** Called after a successful copy. */\n onCopy?: (code: string) => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<CodeBlockLabels>;\n className?: string;\n}\n\nconst COPIED_MS = 1500;\n\nexport function CodeBlock({ code, language, onCopy, labels, className }: CodeBlockProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [canCopy, setCanCopy] = useState(false);\n const [copied, setCopied] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n useEffect(() => {\n setCanCopy(typeof navigator !== \"undefined\" && typeof navigator.clipboard?.writeText === \"function\");\n return () => clearTimeout(timer.current);\n }, []);\n\n const copy = async (): Promise<void> => {\n try {\n await navigator.clipboard.writeText(code);\n } catch {\n return;\n }\n setCopied(true);\n onCopy?.(code);\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), COPIED_MS);\n };\n\n return (\n <div className={cx(\"connect-snippet\", className)}>\n <div className=\"connect-head\">\n {language ? <span className=\"connect-lang\">{language}</span> : <span />}\n <button\n type=\"button\"\n className=\"connect-copy\"\n data-copy={copied ? \"copied\" : \"idle\"}\n hidden={!canCopy}\n onClick={() => void copy()}\n >\n <Icon name={copied ? \"check\" : \"copy\"} size={14} />\n <span aria-live=\"polite\">{copied ? l.copied : l.copy}</span>\n </button>\n </div>\n <div className=\"connect-code\">\n {/* Focusable so a keyboard user can scroll a long line sideways (WCAG 2.1.1, axe scrollable-region-focusable). */}\n <pre tabIndex={0}>\n <code>{code}</code>\n </pre>\n </div>\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Card } from \"../Card/Card\";\nimport { CodeBlock, type CodeBlockLabels } from \"../CodeBlock/CodeBlock\";\nimport { Tag } from \"../Tag/Tag\";\n\nexport interface EndpointPanelLabels extends CodeBlockLabels {\n /** aria-label of the paths list. */\n paths: string;\n}\n\nconst DEFAULT_LABELS: EndpointPanelLabels = { copy: \"Copy\", copied: \"Copied\", paths: \"Paths\" };\n\nexport interface EndpointPanelProps {\n title: ReactNode;\n /** One sentence under the title: what to do with the URL. Wraps on narrow cards. */\n description?: ReactNode;\n /** The base URL a client sets. Shown whole and copied whole. */\n url: string;\n /** Label in the code head (\"Base URL\"). */\n urlLabel?: string;\n /** Paths under the URL, shown as mono tags (\"/v1/chat/completions\"). */\n paths?: string[];\n /** Right side on wide screens, under the URL on narrow ones: usually a `RouteDiagram`. */\n aside?: ReactNode;\n /** Controls at the end of the head (a \"Create key\" button). */\n actions?: ReactNode;\n onCopy?: (url: string) => void;\n /** Heading element of the title. Default 2. */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<EndpointPanelLabels>;\n className?: string;\n}\n\n/** The address a client points at: the base URL to copy, the paths under it, and room for a picture of the route. */\nexport function EndpointPanel({ title, description, url, urlLabel, paths, aside, actions, onCopy, headingLevel = 2, labels, className }: EndpointPanelProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <Card title={title} subtitle={description} actions={actions} headingLevel={headingLevel} className={cx(\"x-endpoint\", className)}>\n <div className=\"x-endpoint-body\" data-aside={aside ? \"\" : undefined}>\n <div className=\"x-endpoint-main\">\n <CodeBlock code={url} language={urlLabel} onCopy={onCopy} labels={{ copy: l.copy, copied: l.copied }} />\n {paths?.length ? (\n <ul className=\"x-endpoint-paths\" aria-label={l.paths}>\n {paths.map((p) => (\n <li key={p}>\n <Tag>\n <span className=\"x-endpoint-path\">{p}</span>\n </Tag>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n {aside ? <div className=\"x-endpoint-aside\">{aside}</div> : null}\n </div>\n </Card>\n );\n}\n","/**\n * Roving tabindex for composites whose items are arbitrary children (Toolbar, ZoomBar): one Tab stop, arrows move inside.\n * DOM based, so it works for any child control. Pure of React: callers pass the handlers to the container.\n */\nimport { rovingIndex } from \"./keys\";\n\n/** Controls that take part in a toolbar's arrow-key ring. */\nexport const ROVING_ITEMS = \"button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), [role='button'][tabindex]\";\n\ninterface Stop {\n tabIndex: number;\n focus: () => void;\n}\ninterface Ring {\n querySelectorAll: (selector: string) => ArrayLike<Stop>;\n}\n\nconst remembered = new WeakMap<object, unknown>();\n\n/** Gives `active` tabIndex 0 and every other item -1. */\nexport function setRovingStop(items: ArrayLike<Stop>, active: unknown): void {\n for (const it of Array.from(items)) it.tabIndex = it === active ? 0 : -1;\n}\n\n/** Callback ref: makes the container a single Tab stop (the last focused item, else the first). */\nexport function rovingRef(el: (object & Ring) | null): void {\n if (!el) return;\n const items = Array.from(el.querySelectorAll(ROVING_ITEMS));\n const last = remembered.get(el);\n setRovingStop(items, items.includes(last as Stop) ? last : items[0]);\n}\n\n/** onFocus (bubbles): the focused item becomes the Tab stop. */\nexport function rovingFocus(e: { target: unknown; currentTarget: Ring }): void {\n const items = Array.from(e.currentTarget.querySelectorAll(ROVING_ITEMS));\n if (!items.includes(e.target as Stop)) return;\n remembered.set(e.currentTarget, e.target);\n setRovingStop(items, e.target);\n}\n\n/** onKeyDown for a horizontal toolbar: Left, Right, Home and End move focus inside the ring. */\nexport function rovingKeyDown(e: { key: string; preventDefault: () => void; currentTarget: Ring }): void {\n const items = Array.from(e.currentTarget.querySelectorAll(ROVING_ITEMS));\n const index = items.indexOf(document.activeElement as unknown as Stop);\n if (index < 0) return;\n const next = rovingIndex(e.key, index, items.length);\n if (next == null) return;\n e.preventDefault();\n items[next]?.focus();\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { rovingFocus, rovingKeyDown, rovingRef } from \"../../internal/roving\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface ZoomBarLabels {\n zoomOut: string;\n zoomIn: string;\n fit: string;\n actual: string;\n /** aria-label of the group. */\n group: string;\n}\n\nconst DEFAULT_LABELS: ZoomBarLabels = {\n zoomOut: \"Zoom out\",\n zoomIn: \"Zoom in\",\n fit: \"Fit to view\",\n actual: \"Actual size\",\n group: \"Zoom\",\n};\n\nexport interface ZoomBarProps {\n /** The shown percentage, or null before the content has a size. */\n zoom: number | null;\n onZoomOut: () => void;\n onFit: () => void;\n onZoomIn: () => void;\n /** The percentage button: back to 100%. */\n onActual: () => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<ZoomBarLabels>;\n className?: string;\n}\n\nexport function ZoomBar({ zoom, onZoomOut, onFit, onZoomIn, onActual, labels, className }: ZoomBarProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <div className={cx(\"x-zoombar\", className)} role=\"toolbar\" aria-label={l.group} ref={rovingRef} onFocus={rovingFocus} onKeyDown={rovingKeyDown}>\n <IconButton icon=\"minus\" label={l.zoomOut} onClick={onZoomOut} />\n <IconButton icon=\"maximize\" label={l.fit} onClick={onFit} />\n <IconButton icon=\"plus\" label={l.zoomIn} onClick={onZoomIn} />\n <button type=\"button\" className=\"btn-secondary x-zoombar-pct\" aria-label={l.actual} title={l.actual} onClick={onActual}>\n {zoom === null ? \"—\" : `${zoom}%`}\n </button>\n </div>\n );\n}\n","/**\n * Ref callback of the active row. Stable, so it fires only when the active row changes and keeps it inside the scrolled\n * list. It scrolls that list only: `scrollIntoView` would also scroll the page, so a palette rendered inline (a docs\n * preview) would pull the page down to it on load.\n */\nexport function reveal(el: HTMLElement | null): void {\n if (!el) return;\n let box = el.parentElement;\n while (box && box.scrollHeight <= box.clientHeight) box = box.parentElement;\n if (!box || box === document.scrollingElement || box === document.body || box === document.documentElement) return;\n const row = el.getBoundingClientRect();\n const view = box.getBoundingClientRect();\n if (row.top < view.top) box.scrollTop -= view.top - row.top;\n else if (row.bottom > view.bottom) box.scrollTop += row.bottom - view.bottom;\n}\n","import { useId, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport type { IconName } from \"../../icons\";\nimport type { SessionState } from \"../../types\";\nimport { rovingIndex } from \"../../internal/keys\";\nimport { focusableIn, trapTarget } from \"../../internal/focus\";\nimport { Icon } from \"../Icon/Icon\";\nimport { Kbd } from \"../Kbd/Kbd\";\nimport { Segmented } from \"../Segmented/Segmented\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\nimport { reveal } from \"../../internal/reveal\";\n\nexport interface PaletteRow {\n /** Stable id of the row; used as the React key and as `data-row-id`. */\n id?: string;\n /** Plain text of the row: the default filter, the match highlight and the accessible name. */\n title: string;\n /** Rendered instead of `title` when present (for example the title with fuzzy hits wrapped). `title` stays the string. */\n label?: ReactNode;\n detail?: string;\n state?: SessionState;\n icon?: IconName;\n /** Shortcut text on the right, after the detail. */\n hint?: string;\n /** Slot before the icon or status dot (for example a kind badge). */\n leading?: ReactNode;\n /** Slot on the right, after `hint` (for example a count or a digit key). */\n meta?: ReactNode;\n /** Row is shown but skipped by the arrow keys and cannot be selected. */\n disabled?: boolean;\n}\n\nexport interface PaletteScope {\n value: string;\n label: string;\n}\n\nexport interface CommandPaletteLabels {\n /** aria-label of the dialog when no title is given. */\n dialog: string;\n /** Input placeholder (the placeholder prop wins). */\n placeholder: string;\n /** aria-label of the input when no title is given (the title names it otherwise). Never the placeholder. */\n search: string;\n noMatches: string;\n move: string;\n open: string;\n close: string;\n /** aria-label of the scope row (only used with `scopes`). */\n scopes?: string;\n /** Announced (politely) as the results change while typing. */\n resultCount?: (n: number) => string;\n}\n\nconst DEFAULT_LABELS: CommandPaletteLabels = {\n dialog: \"Command palette\",\n placeholder: \"Search sessions, files, commands\",\n search: \"Search\",\n noMatches: \"No matches\",\n move: \"move\",\n open: \"open\",\n close: \"close\",\n scopes: \"Scope\",\n resultCount: (n) => `${n} ${n === 1 ? \"result\" : \"results\"}`,\n};\n\nexport interface CommandPaletteProps {\n title?: string;\n placeholder?: string;\n defaultQuery?: string;\n filters?: string[];\n sections: { title: string; rows: PaletteRow[] }[];\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<CommandPaletteLabels>;\n /** Controlled visibility: `false` renders nothing, and a backdrop wraps the dialog. Absent: always rendered inline. */\n open?: boolean;\n /** Called on Escape and on a backdrop click. */\n onClose?: () => void;\n /** Called with the row on click or Enter on the active row. */\n onSelect?: (row: PaletteRow) => void;\n /** Controlled query; pair with `onQueryChange`. `defaultQuery` seeds the uncontrolled one. */\n query?: string;\n onQueryChange?: (query: string) => void;\n /** Scope row under the input (for example all, files, commands). The app filters `sections` itself. */\n scopes?: PaletteScope[];\n /** Controlled scope value; the first scope when absent. */\n scope?: string;\n onScopeChange?: (scope: string) => void;\n /** Replaces the \"No matches\" text. */\n emptyText?: ReactNode;\n /** Extra content on the right of the key-hint bar. */\n footer?: ReactNode;\n /**\n * Row filter. `true` (default): case-insensitive substring match on `title`.\n * `false`: rows are shown as given, in order (the app filters and ranks).\n * A function replaces the test; it gets the row and the current query.\n */\n filter?: boolean | ((row: PaletteRow, query: string) => boolean);\n /** Control rendered next to the input, on its right (for example a scope menu button). */\n inputAddon?: ReactNode;\n /**\n * Called first for every key pressed in the input. If it calls `e.preventDefault()` the palette skips its own handling\n * (arrows, Home/End, Enter). While an IME composes (`e.nativeEvent.isComposing`) the palette never handles keys,\n * so Enter never selects a row.\n */\n onInputKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Controlled active row, matched against `PaletteRow.id`. Absent: the palette tracks it (first row, arrows move it).\n * An id that matches no enabled row falls back to the first enabled row. Pair with `onActiveChange`.\n */\n activeId?: string;\n /** Called with the id of the row an arrow, Home or End key made active. Rows without an `id` are not reported. */\n onActiveChange?: (id: string) => void;\n}\n\nfunction highlight(text: string, query: string): ReactNode {\n if (!query) return text;\n const i = text.toLowerCase().indexOf(query.toLowerCase());\n if (i < 0) return text;\n return (\n <>\n {text.slice(0, i)}\n <span className=\"pal-hit\">{text.slice(i, i + query.length)}</span>\n {text.slice(i + query.length)}\n </>\n );\n}\n\nexport function CommandPalette({\n title,\n placeholder,\n defaultQuery = \"\",\n filters,\n sections,\n labels,\n open,\n onClose,\n onSelect,\n query,\n onQueryChange,\n scopes,\n scope,\n onScopeChange,\n emptyText,\n footer,\n filter: rowFilter = true,\n inputAddon,\n onInputKeyDown,\n activeId,\n onActiveChange,\n}: CommandPaletteProps): JSX.Element | null {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [inner, setQ] = useState(defaultQuery);\n const q = query ?? inner;\n const [filter, setFilter] = useState<string | null>(filters?.[0] ?? null);\n const needle = q.toLowerCase();\n const keep = (r: PaletteRow): boolean => {\n if (rowFilter === false) return true;\n if (typeof rowFilter === \"function\") return rowFilter(r, q);\n return !needle || r.title.toLowerCase().includes(needle);\n };\n const shown = sections\n .map((s) => ({ title: s.title, rows: s.rows.filter(keep) }))\n .filter((s) => s.rows.length > 0);\n const uid = useId();\n const titleId = `${uid}-title`;\n const listId = `${uid}-list`;\n const optionId = (n: number): string => `${uid}-opt-${n}`;\n const flat = shown.flatMap((s) => s.rows);\n const count = flat.length;\n const [at, setAt] = useState(0);\n const [innerScope, setInnerScope] = useState(scopes?.[0]?.value);\n const byId = activeId === undefined ? -1 : flat.findIndex((r) => r.id === activeId);\n const clamped = activeId !== undefined ? (byId >= 0 ? byId : count ? 0 : -1) : count ? Math.min(at, count - 1) : -1;\n const active = clamped >= 0 && flat[clamped]?.disabled ? flat.findIndex((r) => !r.disabled) : clamped;\n const select = (row: PaletteRow | undefined): void => {\n if (row && !row.disabled) onSelect?.(row);\n };\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n onInputKeyDown?.(e);\n if (e.defaultPrevented) return;\n if (e.nativeEvent?.isComposing || e.keyCode === 229) return;\n if (e.key === \"Enter\") {\n if (!onSelect || active < 0) return;\n e.preventDefault();\n select(flat[active]);\n return;\n }\n const next = rovingIndex(e.key, active, count, \"vertical\", (i) => !!flat[i]?.disabled);\n if (next == null) return;\n e.preventDefault();\n setAt(next);\n const id = flat[next]?.id;\n if (id !== undefined) onActiveChange?.(id);\n };\n if (open === false) return null;\n const framed = open !== undefined || onClose !== undefined;\n let n = 0;\n const input = (\n <input\n className=\"pal-input\"\n placeholder={placeholder ?? l.placeholder}\n value={q}\n onChange={(e) => {\n setQ(e.target.value);\n onQueryChange?.(e.target.value);\n setAt(0);\n }}\n onKeyDown={onKeyDown}\n autoFocus={framed}\n role=\"combobox\"\n aria-expanded={count > 0}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={active >= 0 ? optionId(active) : undefined}\n aria-labelledby={title ? titleId : undefined}\n aria-label={title ? undefined : l.search}\n />\n );\n const dialog = (\n <div\n className=\"palette\"\n role=\"dialog\"\n aria-modal={framed ? true : undefined}\n aria-label={title ?? l.dialog}\n onKeyDown={(e) => {\n if (e.key === \"Escape\" && onClose) {\n e.preventDefault();\n onClose();\n return;\n }\n // A modal palette keeps Tab inside it, like a dialog.\n if (e.key === \"Tab\" && framed) {\n const to = trapTarget(focusableIn(e.currentTarget), document.activeElement, e.shiftKey);\n if (to) {\n e.preventDefault();\n to.focus();\n }\n }\n }}\n >\n {title ? <div className=\"pal-title\" id={titleId}>{title}</div> : null}\n {/* Always mounted, so a screen reader hears the count change while typing. */}\n {framed ? (\n <div className=\"x-sr-only\" role=\"status\">\n {q ? (count ? (l.resultCount ?? DEFAULT_LABELS.resultCount!)(count) : l.noMatches) : \"\"}\n </div>\n ) : null}\n {inputAddon ? (\n <div className=\"pal-input-row\">\n {input}\n <div className=\"pal-input-addon\">{inputAddon}</div>\n </div>\n ) : (\n input\n )}\n {scopes ? (\n <div className=\"pal-scopes\">\n <Segmented\n options={scopes}\n label={l.scopes}\n value={scope ?? innerScope}\n onChange={(v) => {\n setInnerScope(v);\n onScopeChange?.(v);\n }}\n />\n </div>\n ) : null}\n {filters ? (\n <div className=\"pal-filters\">\n {filters.map((f) => (\n <button key={f} type=\"button\" className=\"pal-chip\" aria-pressed={f === filter} onClick={() => setFilter(f)}>\n {f}\n </button>\n ))}\n </div>\n ) : null}\n <div className=\"pal-list\" role=\"listbox\" id={listId}>\n {shown.length ? (\n shown.map((s) => (\n <div key={s.title} role=\"group\" aria-label={s.title}>\n <div className=\"pal-section\">{s.title}</div>\n {s.rows.map((r, i) => {\n const idx = n++;\n return (\n <div\n key={r.id ?? i}\n id={optionId(idx)}\n ref={idx === active ? reveal : undefined}\n className=\"pal-row\"\n role=\"option\"\n aria-selected={idx === active}\n aria-disabled={r.disabled ? true : undefined}\n data-row-id={r.id}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => select(r)}\n >\n {r.leading ? <span className=\"pal-leading\">{r.leading}</span> : null}\n {r.state ? <StatusDot state={r.state} /> : <Icon name={r.icon ?? \"terminal\"} className=\"pal-icon\" />}\n <span className=\"pal-title-text\">{r.label ?? highlight(r.title, q)}</span>\n {r.detail ? <span className=\"pal-detail\">{r.detail}</span> : null}\n {r.hint ? <span className=\"pal-hint\">{r.hint}</span> : null}\n {r.meta ? <span className=\"pal-meta\">{r.meta}</span> : null}\n </div>\n );\n })}\n </div>\n ))\n ) : (\n <div className=\"pal-empty\">{emptyText ?? l.noMatches}</div>\n )}\n </div>\n <div className=\"pal-foot\">\n <span>\n <Kbd>↑↓</Kbd> {l.move}\n </span>\n <span>\n <Kbd>Enter</Kbd> {l.open}\n </span>\n <span>\n <Kbd>Esc</Kbd> {l.close}\n </span>\n {footer ? <span className=\"pal-foot-extra\">{footer}</span> : null}\n </div>\n </div>\n );\n if (!framed) return dialog;\n return (\n <div\n className=\"pal-backdrop\"\n onMouseDown={(e) => {\n if (e.target === e.currentTarget) onClose?.();\n }}\n >\n {dialog}\n </div>\n );\n}\n","import { useEffect, useRef, useState, type JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface PaletteTriggerLabels {\n /** Text in the field and the button's name. */\n search: string;\n}\n\nconst DEFAULT_LABELS: PaletteTriggerLabels = { search: \"Search\" };\n\nexport interface PaletteTriggerProps {\n /** Opens your `CommandPalette`. */\n onOpen: () => void;\n /** Listen for Ctrl+K (Cmd+K on a Mac) on the whole page. Default true. Turn it off when the app binds the key itself. */\n hotkey?: boolean;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<PaletteTriggerLabels>;\n className?: string;\n}\n\nconst isMac = (): boolean => typeof navigator !== \"undefined\" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);\n\n/** A search field look-alike for the sidebar or top bar that opens the command palette, with its shortcut shown. */\nexport function PaletteTrigger({ onOpen, hotkey = true, labels, className }: PaletteTriggerProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [mac, setMac] = useState(false);\n const open = useRef(onOpen);\n open.current = onOpen;\n useEffect(() => setMac(isMac()), []);\n useEffect(() => {\n if (!hotkey) return;\n const onKey = (e: KeyboardEvent): void => {\n if (e.key.toLowerCase() === \"k\" && (e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey) {\n e.preventDefault();\n open.current();\n }\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [hotkey]);\n return (\n <button type=\"button\" className={cx(\"x-palette-trigger\", className)} aria-haspopup=\"dialog\" aria-keyshortcuts={hotkey ? \"Control+K Meta+K\" : undefined} onClick={onOpen}>\n <Icon name=\"search\" size={16} className=\"x-palette-trigger-icon\" />\n <span className=\"x-palette-trigger-text\">{l.search}</span>\n {hotkey ? (\n <kbd className=\"kbd x-palette-trigger-key\" aria-hidden=\"true\">\n {mac ? \"⌘K\" : \"Ctrl K\"}\n </kbd>\n ) : null}\n </button>\n );\n}\n","import { useId, type JSX } from \"react\";\n\n/** Edge sizes the app chrome uses; any number is accepted. */\nexport type BrandMarkSize = 16 | 18 | 20 | 64;\n\n/**\n * The parent brand and its sub-systems. Each keeps your blade and has its own agent shape.\n * This package is public: a system is added here only once it is public too.\n */\nexport type BrandSystem = \"xdev\" | \"ui\";\n\nexport interface BrandMarkProps {\n variant?: \"mark\" | \"tile\" | \"lockup\";\n /** Which system the mark stands for (default \"xdev\", the parent brand). */\n system?: BrandSystem;\n /** Mark or tile edge in px (default 24). Lockup wordmark = size × 25/32. A tile from 48 px up is the lit icon. */\n size?: BrandMarkSize | number;\n /** `mark`: set on the svg itself. `tile` and `lockup`: set on the wrapper. */\n className?: string;\n /** Accessible name of the `mark` (default: the system's name). Pass \"\" when the mark is decorative. */\n label?: string;\n}\n\n/** Wordmark parts: the bold lead and the lighter rest. */\nconst NAME: Record<BrandSystem, readonly [lead: string, rest: string]> = {\n xdev: [\"xDev\", \"\"],\n ui: [\"xDev\", \"UI\"],\n};\nconst fullName = (system: BrandSystem): string => NAME[system].filter(Boolean).join(\" \");\n\n// Logo v12 on a 1024 grid: two folded blades that cross into an x. Yours is on the left, the agent's on the right,\n// and where they overlap is the core.\nconst YOU = \"M185 232H335L575 512L335 792H185L425 512Z\";\nconst YOU_UPPER = \"M185 232H335L575 512H425Z\";\nconst YOU_LOWER = \"M425 512H575L335 792H185Z\";\nconst AGENT = \"M839 232H689L449 512L689 792H839L599 512Z\";\nconst AGENT_UPPER = \"M839 232H689L449 512H599Z\";\nconst AGENT_LOWER = \"M599 512H449L689 792H839Z\";\nconst CORE = \"M512 438.5L575 512L512 585.5L449 512Z\";\nconst AGENT_ORANGE = \"var(--brand-agent)\";\n/** The lit icon is used from this edge up; below it the tile is flat. */\nconst LIT_FROM = 48;\n/** A sub-system mark sits 20 to the left so that blade plus shape stay centred. */\nconst SUB_SHIFT = \"translate(-20 0)\";\n\n/** What stands in for the agent blade in a sub-system mark. Shapes inherit their fill. */\nfunction AgentShape({ system }: { system: Exclude<BrandSystem, \"xdev\"> }): JSX.Element {\n switch (system) {\n case \"ui\":\n return (\n <>\n <rect x={608} y={391} width={110} height={110} rx={28} />\n <rect x={740} y={391} width={110} height={110} rx={28} opacity={0.72} />\n <rect x={608} y={523} width={110} height={110} rx={28} opacity={0.72} />\n <rect x={740} y={523} width={110} height={110} rx={28} opacity={0.46} />\n </>\n );\n }\n}\nconst SHAPE_FIT = \"translate(735 512) scale(1.15) translate(-725 -512)\";\n\n/** The flat mark: your blade in `you`, the agent side in the brand orange, the core white. */\nfunction FlatBlades({ system, you }: { system: BrandSystem; you: string }): JSX.Element {\n if (system === \"xdev\") {\n return (\n <>\n <path d={YOU} fill={you} />\n <path d={AGENT} style={{ fill: AGENT_ORANGE }} />\n <path d={CORE} fill=\"#fff\" />\n </>\n );\n }\n return (\n <g transform={SUB_SHIFT}>\n <path d={YOU} fill={you} />\n <g transform={SHAPE_FIT} style={{ fill: AGENT_ORANGE }}>\n <AgentShape system={system} />\n </g>\n </g>\n );\n}\n\nfunction MarkSvg({ system, size, className, label }: { system: BrandSystem; size: number; className?: string; label: string }): JSX.Element {\n return (\n <svg\n className={[\"x-mark\", className].filter(Boolean).join(\" \")}\n width={size}\n height={size}\n viewBox=\"162 162 700 700\"\n role={label ? \"img\" : undefined}\n aria-label={label || undefined}\n aria-hidden={label ? undefined : true}\n focusable=\"false\"\n >\n <FlatBlades system={system} you=\"currentColor\" />\n </svg>\n );\n}\n\n/** Flat tile for small sizes: no light effects, so it stays crisp at 16 to 32 px. */\nfunction FlatTile({ system, size }: { system: BrandSystem; size: number }): JSX.Element {\n return (\n <svg width={size} height={size} viewBox=\"0 0 1024 1024\" aria-hidden=\"true\" focusable=\"false\">\n <rect width={1024} height={1024} rx={224} fill=\"#0d1220\" />\n <FlatBlades system={system} you=\"#5b8cff\" />\n </svg>\n );\n}\n\n/** The lit icon: dark ground with a blue and an orange glow, blades lit from above, a bright core. */\nfunction LitTile({ system, size }: { system: BrandSystem; size: number }): JSX.Element {\n // Paint ids must be unique per instance; useId can hold characters a url() reference does not accept.\n const id = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const ref = (name: string): string => `url(#${id}${name})`;\n const shadow = { opacity: 0.55, filter: ref(\"shadow\"), transform: \"translate(0 22)\" };\n return (\n <svg width={size} height={size} viewBox=\"0 0 1024 1024\" aria-hidden=\"true\" focusable=\"false\">\n <defs>\n <linearGradient id={`${id}base`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0\" stopColor=\"#171d33\" />\n <stop offset=\"1\" stopColor=\"#06080e\" />\n </linearGradient>\n <radialGradient id={`${id}glowYou`} cx=\"330\" cy=\"512\" r=\"430\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#2f62e6\" stopOpacity=\"0.6\" />\n <stop offset=\"1\" stopColor=\"#2f62e6\" stopOpacity=\"0\" />\n </radialGradient>\n <radialGradient id={`${id}glowAgent`} cx=\"700\" cy=\"512\" r=\"400\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#ff7a3d\" stopOpacity=\"0.42\" />\n <stop offset=\"1\" stopColor=\"#ff7a3d\" stopOpacity=\"0\" />\n </radialGradient>\n <linearGradient id={`${id}rim`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.34\" />\n <stop offset=\"0.35\" stopColor=\"#fff\" stopOpacity=\"0.04\" />\n <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.08\" />\n </linearGradient>\n <linearGradient id={`${id}youUpper`} x1=\"0\" y1=\"232\" x2=\"0\" y2=\"512\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#b9cfff\" />\n <stop offset=\"1\" stopColor=\"#4f84ff\" />\n </linearGradient>\n <linearGradient id={`${id}youLower`} x1=\"0\" y1=\"512\" x2=\"0\" y2=\"792\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#2f62e6\" />\n <stop offset=\"1\" stopColor=\"#1a3db3\" />\n </linearGradient>\n <linearGradient id={`${id}agentUpper`} x1=\"0\" y1=\"232\" x2=\"0\" y2=\"512\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#ffc9a3\" />\n <stop offset=\"1\" stopColor=\"#ff8a4f\" />\n </linearGradient>\n <linearGradient id={`${id}agentLower`} x1=\"0\" y1=\"512\" x2=\"0\" y2=\"792\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#ff7a3d\" />\n <stop offset=\"1\" stopColor=\"#d94e14\" />\n </linearGradient>\n <linearGradient id={`${id}shape`} x1=\"0\" y1=\"322\" x2=\"0\" y2=\"702\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#ffc9a3\" />\n <stop offset=\"0.5\" stopColor=\"#ff7a3d\" />\n <stop offset=\"1\" stopColor=\"#d94e14\" />\n </linearGradient>\n <linearGradient id={`${id}core`} x1=\"0\" y1=\"438\" x2=\"0\" y2=\"586\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#fff\" />\n <stop offset=\"1\" stopColor=\"#ffe2cc\" />\n </linearGradient>\n <filter id={`${id}soft`} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n <feGaussianBlur stdDeviation=\"34\" />\n </filter>\n <filter id={`${id}shadow`} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n <feGaussianBlur stdDeviation=\"18\" />\n </filter>\n <clipPath id={`${id}clip`}>\n <rect width={1024} height={1024} rx={230} />\n </clipPath>\n </defs>\n <g clipPath={ref(\"clip\")}>\n <rect width={1024} height={1024} fill={ref(\"base\")} />\n <rect width={1024} height={1024} fill={ref(\"glowYou\")} />\n <rect width={1024} height={1024} fill={ref(\"glowAgent\")} />\n </g>\n <rect x={4} y={4} width={1016} height={1016} rx={226} fill=\"none\" stroke={ref(\"rim\")} strokeWidth={8} />\n {system === \"xdev\" ? (\n <>\n <g {...shadow}>\n <path d={`${YOU} ${AGENT}`} fill=\"#000\" />\n </g>\n <path d={YOU_UPPER} fill={ref(\"youUpper\")} />\n <path d={YOU_LOWER} fill={ref(\"youLower\")} />\n <path d={AGENT_UPPER} fill={ref(\"agentUpper\")} />\n <path d={AGENT_LOWER} fill={ref(\"agentLower\")} />\n <path d={CORE} fill=\"#fff\" filter={ref(\"soft\")} opacity={0.95} />\n <path d={CORE} fill={ref(\"core\")} />\n </>\n ) : (\n <g transform={SUB_SHIFT}>\n <g {...shadow} fill=\"#000\">\n <path d={YOU} />\n <g transform={SHAPE_FIT}>\n <AgentShape system={system} />\n </g>\n </g>\n <path d={YOU_UPPER} fill={ref(\"youUpper\")} />\n <path d={YOU_LOWER} fill={ref(\"youLower\")} />\n <g transform={SHAPE_FIT} fill={ref(\"shape\")}>\n <AgentShape system={system} />\n </g>\n </g>\n )}\n </svg>\n );\n}\n\nfunction Tile({ system, size }: { system: BrandSystem; size: number }): JSX.Element {\n return size >= LIT_FROM ? <LitTile system={system} size={size} /> : <FlatTile system={system} size={size} />;\n}\n\nexport function BrandMark({ variant = \"mark\", system = \"xdev\", size = 24, className, label }: BrandMarkProps): JSX.Element {\n const name = fullName(system);\n if (variant === \"tile\") {\n return (\n <span className={[\"x-mark-tile\", className].filter(Boolean).join(\" \")} role=\"img\" aria-label={name}>\n <Tile system={system} size={size} />\n </span>\n );\n }\n if (variant === \"lockup\") {\n const [lead, rest] = NAME[system];\n return (\n <span\n className={[\"x-lockup\", className].filter(Boolean).join(\" \")}\n role=\"img\"\n aria-label={name}\n style={{ fontSize: Math.round((size * 25) / 32) }}\n >\n <Tile system={system} size={size} />\n <span className=\"x-lockup-word\" aria-hidden=\"true\">{lead}</span>\n {rest ? <span className=\"x-lockup-sub\" aria-hidden=\"true\">{rest}</span> : null}\n </span>\n );\n }\n // Bare svg, no wrapper: your blade takes `currentColor` (.x-mark sets --accent; a later rule may override).\n return <MarkSvg system={system} size={size} className={className} label={label ?? name} />;\n}\n","import type { CSSProperties, JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\n/** Colour family. CSS maps each one to a theme token, so both themes keep their contrast. */\nexport type FileTone =\n | \"folder\"\n | \"folder-open\"\n | \"code\"\n | \"markup\"\n | \"style\"\n | \"data\"\n | \"doc\"\n | \"media\"\n | \"config\"\n | \"shell\"\n | \"test\"\n | \"plain\";\n\nexport interface FileIconMatch {\n icon: IconName;\n tone: FileTone;\n}\n\ntype Rule = readonly [IconName, FileTone];\n\nconst DIRS: Record<string, IconName> = {\n src: \"folder-code\", lib: \"folder-code\", app: \"folder-code\", apps: \"folder-code\", packages: \"folder-package\",\n components: \"folder-code\", pages: \"folder-code\", scripts: \"folder-code\", bin: \"folder-code\",\n \".git\": \"folder-git\", \".github\": \"folder-git\", \".gitlab\": \"folder-git\",\n node_modules: \"folder-package\", vendor: \"folder-package\", dist: \"folder-package\", build: \"folder-package\", out: \"folder-package\",\n assets: \"folder-image\", public: \"folder-image\", static: \"folder-image\", images: \"folder-image\", img: \"folder-image\", icons: \"folder-image\",\n test: \"folder-test\", tests: \"folder-test\", __tests__: \"folder-test\", spec: \"folder-test\", e2e: \"folder-test\",\n config: \"folder-config\", \".vscode\": \"folder-config\", \".claude\": \"folder-config\", \".storybook\": \"folder-config\", \".husky\": \"folder-config\",\n};\n\n/** Whole file names win over extensions. Keys are lowercase. */\nconst NAMES: Record<string, Rule> = {\n \"package.json\": [\"file-package\", \"data\"],\n \"package-lock.json\": [\"file-lock\", \"config\"],\n \"pnpm-lock.yaml\": [\"file-lock\", \"config\"],\n \"yarn.lock\": [\"file-lock\", \"config\"],\n \"bun.lockb\": [\"file-lock\", \"config\"],\n \"cargo.lock\": [\"file-lock\", \"config\"],\n \"cargo.toml\": [\"file-package\", \"data\"],\n \"go.mod\": [\"file-package\", \"data\"],\n \"go.sum\": [\"file-lock\", \"config\"],\n dockerfile: [\"file-config\", \"config\"],\n makefile: [\"file-terminal\", \"shell\"],\n \".gitignore\": [\"file-git\", \"config\"],\n \".gitattributes\": [\"file-git\", \"config\"],\n \".gitmodules\": [\"file-git\", \"config\"],\n \".env\": [\"file-key\", \"config\"],\n \".npmrc\": [\"file-config\", \"config\"],\n \".editorconfig\": [\"file-config\", \"config\"],\n readme: [\"file-info\", \"doc\"],\n \"readme.md\": [\"file-info\", \"doc\"],\n license: [\"file-text\", \"doc\"],\n \"license.md\": [\"file-text\", \"doc\"],\n changelog: [\"file-text\", \"doc\"],\n \"changelog.md\": [\"file-text\", \"doc\"],\n};\n\nconst EXTS: Record<string, Rule> = {};\nconst add = (rule: Rule, exts: string): void => {\n for (const e of exts.split(\" \")) EXTS[e] = rule;\n};\nadd([\"file-code\", \"code\"], \"ts tsx mts cts js jsx mjs cjs py rb go rs java kt kts swift c h cc cpp hpp cs php lua dart scala ex exs zig vue svelte astro\");\nadd([\"file-code\", \"markup\"], \"html htm xml\");\nadd([\"file-image\", \"media\"], \"svg png jpg jpeg gif webp avif ico bmp\");\nadd([\"file-style\", \"style\"], \"css scss sass less styl\");\nadd([\"file-json\", \"data\"], \"json jsonc json5\");\nadd([\"file-data\", \"data\"], \"csv tsv sql db sqlite parquet\");\nadd([\"file-config\", \"config\"], \"yaml yml toml ini conf cfg properties\");\nadd([\"file-text\", \"doc\"], \"md mdx txt rst adoc pdf rtf doc docx\");\nadd([\"file-media\", \"media\"], \"mp3 wav ogg flac mp4 mov webm mkv\");\nadd([\"file-terminal\", \"shell\"], \"sh bash zsh fish ps1 bat cmd\");\nadd([\"file-lock\", \"config\"], \"lock\");\nadd([\"file-key\", \"config\"], \"pem key crt cer p12 env\");\nadd([\"file-zip\", \"plain\"], \"zip tar gz tgz bz2 xz 7z rar\");\nadd([\"file-diff\", \"code\"], \"diff patch\");\nadd([\"file-text\", \"plain\"], \"log woff woff2 ttf otf\");\n\n/** Picks the icon and tone for a tree row. Pure, so a file list can call it without rendering. */\nexport function fileIcon(name: string, kind: \"file\" | \"dir\" = \"file\", open = false): FileIconMatch {\n const base = (name.split(/[\\\\/]/).pop() ?? name).toLowerCase();\n if (kind === \"dir\") return { icon: DIRS[base] ?? (open ? \"folder-open\" : \"folder\"), tone: open ? \"folder-open\" : \"folder\" };\n const named = NAMES[base];\n if (named) return { icon: named[0], tone: named[1] };\n if (base.startsWith(\".env.\")) return { icon: \"file-key\", tone: \"config\" };\n if (/\\.(test|spec)\\.[a-z0-9]+$/.test(base)) return { icon: \"file-check\", tone: \"test\" };\n if (/^(tsconfig|jsconfig)(\\..+)?\\.json$/.test(base) || /\\.config\\.[a-z0-9]+$/.test(base)) return { icon: \"file-config\", tone: \"config\" };\n const dot = base.lastIndexOf(\".\");\n const rule = dot > 0 ? EXTS[base.slice(dot + 1)] : undefined;\n return rule ? { icon: rule[0], tone: rule[1] } : { icon: \"file\", tone: \"plain\" };\n}\n\nexport interface FileIconProps {\n /** File or folder name; a path works too (only the last segment counts). */\n name: string;\n /** Default \"file\". */\n kind?: \"file\" | \"dir\";\n /** Expanded folder. Ignored for files. */\n open?: boolean;\n /** Default 16. */\n size?: number;\n /** Set only when the icon stands alone without the file name next to it. */\n label?: string;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function FileIcon({ name, kind = \"file\", open = false, size = 16, label, className, style }: FileIconProps): JSX.Element {\n const { icon, tone } = fileIcon(name, kind, open);\n return <Icon name={icon} size={size} label={label} className={cx(\"x-file-icon\", className)} style={style} data-tone={tone} />;\n}\n","import { useEffect, useId, useRef, type InputHTMLAttributes, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n /** Names the option in its checked state (\"Delete the branch too\"). Omit only with aria-label. */\n label?: ReactNode;\n /** One short line under the label, linked with aria-describedby. */\n hint?: ReactNode;\n /** Mixed state for a \"select all\" box over a partial selection. Set through the DOM property, so it never reaches the markup. */\n indeterminate?: boolean;\n}\n\nexport function Checkbox({ label, hint, indeterminate = false, id, className, disabled, ...rest }: CheckboxProps): JSX.Element {\n const ref = useRef<HTMLInputElement>(null);\n const auto = useId();\n const inputId = id ?? `x-check-${auto}`;\n const hintId = hint ? `${inputId}-hint` : undefined;\n useEffect(() => {\n if (ref.current) ref.current.indeterminate = indeterminate;\n }, [indeterminate]);\n const input = <input ref={ref} type=\"checkbox\" id={inputId} aria-describedby={hintId} disabled={disabled} {...rest} />;\n if (!label && !hint) return <span className={cx(\"ws-tick\", className)} data-indeterminate={indeterminate ? \"\" : undefined}>{input}</span>;\n return (\n <label\n className={cx(\"ws-tick\", className)}\n htmlFor={inputId}\n data-indeterminate={indeterminate ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n >\n {input}\n <span className=\"ws-tick-text\">\n {label}\n {hint ? (\n <small className=\"ws-tick-hint\" id={hintId}>\n {hint}\n </small>\n ) : null}\n </span>\n </label>\n );\n}\n","import { useId, useState, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface RadioOption {\n value: string;\n label: ReactNode;\n /** One short line under the label. */\n hint?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface RadioGroupProps {\n /** Shared `name` of the native radios. */\n name: string;\n options: RadioOption[];\n /** Controlled value. */\n value?: string;\n /** Uncontrolled starting value. */\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Default \"horizontal\" (one line, like the terminal picker); \"vertical\" stacks options with hints. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Visible group label; also names the radiogroup. Omit only with aria-label. */\n label?: ReactNode;\n \"aria-label\"?: string;\n /** Disables every option. */\n disabled?: boolean;\n className?: string;\n}\n\nexport function RadioGroup({\n name,\n options,\n value,\n defaultValue,\n onChange,\n orientation = \"horizontal\",\n label,\n \"aria-label\": ariaLabel,\n disabled,\n className,\n}: RadioGroupProps): JSX.Element {\n const [inner, setInner] = useState(defaultValue);\n const current = value ?? inner;\n const base = `x-radio-${useId()}`;\n const labelId = label ? `${base}-label` : undefined;\n return (\n <div\n className={cx(\"term-radios\", className)}\n role=\"radiogroup\"\n aria-labelledby={labelId}\n aria-label={labelId ? undefined : ariaLabel}\n aria-disabled={disabled ? true : undefined}\n data-orientation={orientation}\n >\n {label ? (\n <span className=\"term-radios-label\" id={labelId}>\n {label}\n </span>\n ) : null}\n {options.map((o) => {\n const id = `${base}-${o.value}`;\n const hintId = o.hint ? `${id}-hint` : undefined;\n const off = disabled || o.disabled;\n return (\n <label key={o.value} className=\"term-radio\" htmlFor={id} data-disabled={off ? \"\" : undefined}>\n <input\n type=\"radio\"\n id={id}\n name={name}\n value={o.value}\n checked={current === o.value}\n disabled={off}\n aria-describedby={hintId}\n onChange={() => {\n setInner(o.value);\n onChange?.(o.value);\n }}\n />\n <span className=\"term-radio-text\">\n {o.label}\n {o.hint ? (\n <small className=\"term-radio-hint\" id={hintId}>\n {o.hint}\n </small>\n ) : null}\n </span>\n </label>\n );\n })}\n </div>\n );\n}\n","import { useId, type JSX, type ReactNode, type Ref, type TextareaHTMLAttributes } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n label: ReactNode;\n hint?: ReactNode;\n /** When set, replaces the hint and marks the field invalid. */\n error?: ReactNode;\n /** Monospace text, for prompts, commands, JSON or paths. */\n mono?: boolean;\n /** Keep the label for screen readers only, when the surrounding UI already names the box. */\n hideLabel?: boolean;\n /** Default \"vertical\". */\n resize?: \"vertical\" | \"none\" | \"both\";\n ref?: Ref<HTMLTextAreaElement>;\n}\n\nexport function Textarea({ label, hint, error, mono, hideLabel, resize = \"vertical\", id, className, rows = 4, ...rest }: TextareaProps): JSX.Element {\n const auto = useId();\n const inputId = id ?? `x-textarea-${auto}`;\n const note = error ?? hint;\n const hintId = note ? `${inputId}-hint` : undefined;\n return (\n <div className={cx(\"ws-field\", className)} data-invalid={error ? \"\" : undefined}>\n <label htmlFor={inputId} className={cx(\"x-label\", hideLabel && \"x-sr-only\")}>\n {label}\n {rest.required ? <span className=\"x-label-required\" aria-hidden=\"true\">*</span> : null}\n </label>\n <textarea\n id={inputId}\n rows={rows}\n className={cx(\"kit-textarea\", mono && \"ws-mono\")}\n data-resize={resize}\n aria-describedby={hintId}\n aria-invalid={error ? true : undefined}\n {...rest}\n />\n {note ? <small id={hintId} role={error ? \"alert\" : undefined}>{note}</small> : null}\n </div>\n );\n}\n","import type { InputHTMLAttributes, JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\nimport { Kbd } from \"../Kbd/Kbd\";\n\nexport interface SearchInputLabels {\n /** aria-label of the input when no other label is given. */\n search: string;\n /** aria-label of the clear button. */\n clear: string;\n /** Result count read out after the input. */\n count: (n: number) => string;\n}\n\nconst DEFAULT_LABELS: SearchInputLabels = {\n search: \"Search\",\n clear: \"Clear search\",\n count: (n) => (n === 1 ? \"1 result\" : `${n} results`),\n};\n\nexport interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n /** \"md\" (34px, page search) by default; \"sm\" (26px) for panel filters and toolbars. */\n size?: \"sm\" | \"md\";\n /** Shows a clear button while `value` is not empty. */\n onClear?: () => void;\n /** Keyboard shortcut shown while the input is empty, e.g. \"Ctrl K\". */\n shortcut?: string;\n /** Number of matches; shown after the input and announced politely. */\n count?: number;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<SearchInputLabels>;\n}\n\nexport function SearchInput({ size = \"md\", onClear, shortcut, count, labels, className, value, ...rest }: SearchInputProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const hasValue = value != null && String(value) !== \"\";\n const named = rest[\"aria-label\"] != null || rest[\"aria-labelledby\"] != null || rest.id != null;\n return (\n <div className={cx(\"search\", className)} data-size={size}>\n <Icon name=\"search\" className=\"search-icon\" size={size === \"sm\" ? 14 : 16} />\n <input type=\"search\" className=\"search-input\" value={value} aria-label={named ? undefined : l.search} {...rest} />\n {count != null ? (\n <span className=\"search-count\" aria-live=\"polite\">\n {l.count(count)}\n </span>\n ) : null}\n {onClear && hasValue ? (\n <button\n type=\"button\"\n className=\"search-clear\"\n aria-label={l.clear}\n onClick={(e) => {\n // The button goes away once the field is empty; focus goes back to the field instead of the page.\n const field = e.currentTarget.parentElement?.querySelector<HTMLInputElement>(\".search-input\");\n onClear();\n field?.focus();\n }}\n >\n <Icon name=\"close\" size={14} />\n </button>\n ) : shortcut ? (\n <span className=\"ws-search-hint\" aria-hidden=\"true\">\n <Kbd>{shortcut}</Kbd>\n </span>\n ) : null}\n </div>\n );\n}\n","import { useId, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { SearchInput } from \"../SearchInput/SearchInput\";\n\nexport interface SearchPickerItem {\n id: string;\n /** Main line. */\n title: ReactNode;\n /** Second line in muted text. */\n meta?: ReactNode;\n /** Before the text: an icon, StatusDot or Badge. */\n leading?: ReactNode;\n /** Shown but skipped by the arrow keys and ignored by Enter and click. */\n disabled?: boolean;\n}\n\nexport interface SearchPickerLabels {\n /** aria-label of the clear button. */\n clear: string;\n}\n\nconst DEFAULT_LABELS: SearchPickerLabels = { clear: \"Clear search\" };\n\nexport interface SearchPickerProps {\n /** The query. */\n value: string;\n onValueChange: (value: string) => void;\n /** The matches for `value`; the caller searches and filters. */\n items: SearchPickerItem[];\n /** Enter or a click on an enabled option. */\n onPick: (id: string) => void;\n /** A loading, empty or error line under the list; announced politely. */\n status?: ReactNode;\n placeholder?: string;\n /** Accessible name of the box and of the list. */\n label: string;\n /**\n * Show `label` above the box as a real `<label>`, like `Field` and `Combobox`. Use it when the picker sits in a form\n * next to labelled fields; leave it off where a heading or a dialog title already names the search.\n */\n showLabel?: boolean;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<SearchPickerLabels>;\n className?: string;\n}\n\nexport interface KeyResult {\n /** The option that is active after the key. */\n active: string | null;\n /** An option to pick (Enter). */\n pick: string | null;\n /** Escape with a query: clear it and keep the key from reaching a parent dialog. */\n clear: boolean;\n}\n\n/** First enabled option, so the list is never active on a disabled row. */\nfunction firstEnabled(items: SearchPickerItem[]): string | null {\n return items.find((i) => !i.disabled)?.id ?? null;\n}\n\n/** What a key does to the list: arrows move over enabled options, Enter picks, Escape clears a query. Pure, so it can be tested without a DOM. */\nexport function searchPickerKey(items: SearchPickerItem[], active: string | null, key: string, query: string): KeyResult {\n const enabled = items.filter((i) => !i.disabled);\n const at = enabled.findIndex((i) => i.id === active);\n const current = at >= 0 ? (enabled[at]?.id ?? null) : (enabled[0]?.id ?? null);\n if (key === \"ArrowDown\") return { active: enabled[Math.min(at + 1, enabled.length - 1)]?.id ?? null, pick: null, clear: false };\n if (key === \"ArrowUp\") return { active: enabled[Math.max(at - 1, 0)]?.id ?? null, pick: null, clear: false };\n if (key === \"Enter\") return { active: current, pick: current, clear: false };\n if (key === \"Escape\") return { active: current, pick: null, clear: query !== \"\" };\n return { active: current, pick: null, clear: false };\n}\n\nexport function SearchPicker({ value, onValueChange, items, onPick, status, placeholder, label, showLabel, labels, className }: SearchPickerProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const base = `x-search-picker-${useId()}`;\n const listId = `${base}-list`;\n const inputId = `${base}-input`;\n const [chosen, setChosen] = useState<string | null>(null);\n // An active option that left the list falls back to the first enabled one.\n const active = items.some((i) => i.id === chosen && !i.disabled) ? chosen : firstEnabled(items);\n const optionId = (id: string): string => `${base}-opt-${id}`;\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n if (![\"ArrowDown\", \"ArrowUp\", \"Enter\", \"Escape\"].includes(e.key)) return;\n const result = searchPickerKey(items, active, e.key, value);\n if (e.key !== \"Escape\" || result.clear) e.preventDefault();\n if (result.clear) {\n e.stopPropagation();\n onValueChange(\"\");\n }\n if (result.pick !== null) onPick(result.pick);\n else setChosen(result.active);\n };\n\n return (\n <div className={cx(\"x-search-picker\", className)}>\n {showLabel ? (\n <label className=\"x-search-picker-label\" htmlFor={inputId}>\n {label}\n </label>\n ) : null}\n <SearchInput\n id={showLabel ? inputId : undefined}\n role=\"combobox\"\n aria-expanded={items.length > 0}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={active === null ? undefined : optionId(active)}\n aria-label={showLabel ? undefined : label}\n placeholder={placeholder}\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n onKeyDown={onKeyDown}\n onClear={() => onValueChange(\"\")}\n labels={{ clear: l.clear }}\n />\n <div id={listId} className=\"x-search-picker-list\" role=\"listbox\" aria-label={label} hidden={items.length === 0}>\n {items.map((item) => (\n <div\n key={item.id}\n id={optionId(item.id)}\n className=\"x-list-row x-search-picker-option\"\n role=\"option\"\n aria-selected={item.id === active}\n aria-disabled={item.disabled ? true : undefined}\n data-selected={item.id === active ? \"\" : undefined}\n data-disabled={item.disabled ? \"\" : undefined}\n onMouseMove={() => (item.disabled ? undefined : setChosen(item.id))}\n onClick={() => (item.disabled ? undefined : onPick(item.id))}\n >\n <span className=\"x-list-row-main\">\n {item.leading ? <span className=\"x-list-row-lead\">{item.leading}</span> : null}\n <span className=\"x-list-row-text\">\n <span className=\"x-list-row-title\">{item.title}</span>\n {item.meta ? <span className=\"x-list-row-meta\">{item.meta}</span> : null}\n </span>\n </span>\n </div>\n ))}\n </div>\n <div className=\"x-search-picker-status\" aria-live=\"polite\">\n {status ?? null}\n </div>\n </div>\n );\n}\n","/** Lower case without diacritics; \"đ\"/\"Đ\" fold to \"d\", so \"Đà Nẵng\" matches \"da nang\". */\nexport function foldText(s: string): string {\n return s.normalize(\"NFD\").replace(/\\p{M}/gu, \"\").toLowerCase().replace(/đ/g, \"d\");\n}\n","import { useId, useState, type JSX, type KeyboardEvent } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { rovingIndex } from \"../../internal/keys\";\nimport { Icon } from \"../Icon/Icon\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Tag } from \"../Tag/Tag\";\nimport { foldText } from \"../../internal/text\";\n\nexport interface ComboboxOption<T extends string = string> {\n value: T;\n label: string;\n /** Muted second line. */\n meta?: string;\n /** Shown but skipped by the arrow keys and ignored by Enter and click. */\n disabled?: boolean;\n}\n\nexport interface ComboboxLabels {\n /** Line under the box when nothing matches the text. */\n noResults: string;\n /** The option that calls `onCreate`. */\n create: (text: string) => string;\n /** aria-label of a chip's remove button (multiple). */\n remove: (label: string) => string;\n /** aria-label of the clear button. */\n clear: string;\n}\n\nconst DEFAULT_LABELS: ComboboxLabels = {\n noResults: \"No results\",\n create: (text) => `Create “${text}”`,\n remove: (label) => `Remove ${label}`,\n clear: \"Clear\",\n};\n\nexport interface ComboboxBaseProps<T extends string> {\n /** Accessible name of the box and the list; shown above the box unless `hideLabel`. */\n label: string;\n /** Keep `label` as aria-label only, when a heading or a table column already names the box. */\n hideLabel?: boolean;\n options: ComboboxOption<T>[];\n placeholder?: string;\n disabled?: boolean;\n /** Draws the box as invalid and sets aria-invalid; pair it with a FieldMessage in `aria-describedby`. */\n invalid?: boolean;\n \"aria-describedby\"?: string;\n /** Adds a \"Create “text”\" option when the text matches no option exactly. */\n onCreate?: (text: string) => void;\n /** Whether `option` matches the typed `query`. Default: case- and diacritic-insensitive contains on the label. */\n filter?: (option: ComboboxOption<T>, query: string) => boolean;\n /** Opens the list on first render (previews, stories). */\n defaultOpen?: boolean;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<ComboboxLabels>;\n className?: string;\n}\n\nexport interface ComboboxSingleProps<T extends string = string> extends ComboboxBaseProps<T> {\n multiple?: false;\n value: T | null;\n onChange: (value: T | null) => void;\n}\n\nexport interface ComboboxMultipleProps<T extends string = string> extends ComboboxBaseProps<T> {\n multiple: true;\n value: T[];\n onChange: (value: T[]) => void;\n}\n\nexport type ComboboxProps<T extends string = string> = ComboboxSingleProps<T> | ComboboxMultipleProps<T>;\n\nexport { foldText };\n\n/** Default filter: the folded label contains the folded, trimmed query. */\nexport function comboboxFilter(option: { label: string }, query: string): boolean {\n return foldText(option.label).includes(foldText(query.trim()));\n}\n\n/** Id of the \"Create\" row; option values never collide with it because rows of options use their value. */\nexport const COMBOBOX_CREATE = \"\\u0000create\";\n\nexport type ComboboxRow<T extends string = string> =\n | { kind: \"option\"; id: T; option: ComboboxOption<T>; disabled?: boolean }\n | { kind: \"create\"; id: typeof COMBOBOX_CREATE; text: string; disabled?: undefined };\n\n/** The rows of the list for `query`: matching options, then a Create row when `canCreate` and nothing matches exactly. Pure. */\nexport function comboboxRows<T extends string>(\n options: ComboboxOption<T>[],\n query: string,\n opts: { filter?: (option: ComboboxOption<T>, query: string) => boolean; canCreate?: boolean } = {},\n): ComboboxRow<T>[] {\n const filter = opts.filter ?? comboboxFilter;\n const q = query.trim();\n const rows: ComboboxRow<T>[] = (q === \"\" ? options : options.filter((o) => filter(o, query))).map((o) => ({ kind: \"option\", id: o.value, option: o, disabled: o.disabled }));\n if (opts.canCreate && q !== \"\" && !options.some((o) => foldText(o.label) === foldText(q))) rows.push({ kind: \"create\", id: COMBOBOX_CREATE, text: q });\n return rows;\n}\n\nexport interface ComboboxKeyState {\n rows: { id: string; disabled?: boolean }[];\n active: string | null;\n open: boolean;\n /** The text in the box. */\n text: string;\n multiple: boolean;\n /** Something is chosen (single) or at least one chip exists (multiple). */\n hasValue: boolean;\n}\n\nexport interface ComboboxKeyResult {\n /** The key was used: call preventDefault. */\n handled: boolean;\n /** Keep the key from reaching a parent (Escape inside a dialog). */\n stop: boolean;\n open: boolean;\n active: string | null;\n /** Row id to pick. */\n pick: string | null;\n /** Escape on a closed list: empty the box (single: also clear the value). */\n clear: boolean;\n /** Backspace on an empty box (multiple): drop the last chip. */\n removeLast: boolean;\n}\n\n/** What a key does to the combobox. Arrows and Home/End move over enabled rows and wrap, Enter picks, Escape closes then clears, Tab closes. Pure. */\nexport function comboboxKey(s: ComboboxKeyState, key: string): ComboboxKeyResult {\n const none: ComboboxKeyResult = { handled: false, stop: false, open: s.open, active: s.active, pick: null, clear: false, removeLast: false };\n const enabled = (i: number): boolean => !s.rows[i]?.disabled;\n const at = s.rows.findIndex((r) => r.id === s.active && !r.disabled);\n const idAt = (i: number | null): string | null => (i === null || i < 0 ? null : (s.rows[i]?.id ?? null));\n const move = (k: string, from: number): string | null => {\n const i = rovingIndex(k, from, s.rows.length, \"vertical\", (n) => !enabled(n));\n return i === null || !enabled(i) ? null : idAt(i);\n };\n switch (key) {\n case \"ArrowDown\":\n case \"ArrowUp\": {\n if (!s.open) {\n const first = at >= 0 ? s.active : move(key === \"ArrowDown\" ? \"Home\" : \"End\", 0);\n return { ...none, handled: true, open: true, active: first };\n }\n return { ...none, handled: true, active: move(key, at >= 0 ? at : key === \"ArrowDown\" ? -1 : s.rows.length) };\n }\n case \"Home\":\n case \"End\":\n return s.open ? { ...none, handled: true, active: move(key, at) } : none;\n case \"Enter\": {\n if (!s.open || at < 0) return none;\n return { ...none, handled: true, pick: idAt(at) };\n }\n case \"Escape\":\n if (s.open) return { ...none, handled: true, stop: true, open: false };\n if (s.text !== \"\" || (!s.multiple && s.hasValue)) return { ...none, handled: true, stop: true, clear: true };\n return none;\n case \"Backspace\":\n return s.multiple && s.text === \"\" && s.hasValue ? { ...none, handled: true, removeLast: true } : none;\n case \"Tab\":\n return { ...none, open: false };\n default:\n return none;\n }\n}\n\nexport function Combobox<T extends string = string>(props: ComboboxProps<T>): JSX.Element {\n const { label, hideLabel, options, placeholder, disabled, invalid, onCreate, filter, defaultOpen, labels, className } = props;\n const describedBy = props[\"aria-describedby\"];\n const l = { ...DEFAULT_LABELS, ...labels };\n const base = `x-combobox-${useId()}`;\n const inputId = `${base}-input`;\n const listId = `${base}-list`;\n const [open, setOpen] = useState(Boolean(defaultOpen) && !disabled);\n // null: not editing, so a single box shows the chosen label.\n const [query, setQuery] = useState<string | null>(null);\n const [chosen, setChosen] = useState<string | null>(null);\n\n const selected: T[] = props.multiple ? props.value : props.value === null ? [] : [props.value];\n const labelOf = (v: T): string => options.find((o) => o.value === v)?.label ?? v;\n const text = query ?? (props.multiple || props.value === null ? \"\" : labelOf(props.value));\n const rows = comboboxRows(options, query ?? \"\", { filter, canCreate: Boolean(onCreate) });\n const firstEnabled = rows.find((r) => !r.disabled)?.id ?? null;\n const active = rows.some((r) => r.id === chosen && !r.disabled) ? chosen : (rows.find((r) => !r.disabled && selected.includes(r.id as T))?.id ?? firstEnabled);\n const rowIndex = (id: string): number => rows.findIndex((r) => r.id === id);\n const optionId = (id: string): string => `${base}-opt-${rowIndex(id)}`;\n const expanded = open && !disabled;\n const showList = expanded && rows.length > 0;\n\n const setValues = (next: T[]): void => {\n if (props.multiple) props.onChange(next);\n else props.onChange(next[0] ?? null);\n };\n\n const pick = (id: string): void => {\n const row = rows.find((r) => r.id === id);\n if (!row || row.disabled) return;\n if (row.kind === \"create\") onCreate?.(row.text);\n else if (props.multiple) props.onChange(selected.includes(row.id) ? selected.filter((v) => v !== row.id) : [...selected, row.id]);\n else props.onChange(row.id);\n if (props.multiple) {\n setQuery(\"\");\n } else {\n setQuery(null);\n setOpen(false);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n const r = comboboxKey({ rows, active, open: expanded, text, multiple: Boolean(props.multiple), hasValue: selected.length > 0 }, e.key);\n if (r.handled) e.preventDefault();\n if (r.stop) e.stopPropagation();\n if (r.open !== expanded) setOpen(r.open);\n if (r.active !== active) setChosen(r.active);\n if (r.pick !== null) pick(r.pick);\n if (r.clear) {\n setQuery(\"\");\n if (!props.multiple) props.onChange(null);\n }\n if (r.removeLast) setValues(selected.slice(0, -1));\n };\n\n return (\n <div className={cx(\"x-combobox\", className)} data-invalid={invalid ? \"\" : undefined} data-disabled={disabled ? \"\" : undefined}>\n {hideLabel ? null : (\n <label className=\"x-combobox-label\" htmlFor={inputId}>\n {label}\n </label>\n )}\n <div className=\"x-combobox-box\">\n {props.multiple\n ? selected.map((v) => (\n <Tag key={v} onRemove={disabled ? undefined : () => setValues(selected.filter((x) => x !== v))} removeLabel={l.remove(labelOf(v))}>\n {labelOf(v)}\n </Tag>\n ))\n : null}\n <input\n id={inputId}\n className=\"x-combobox-input\"\n type=\"text\"\n role=\"combobox\"\n autoComplete=\"off\"\n aria-label={hideLabel ? label : undefined}\n aria-expanded={showList}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={showList && active !== null ? optionId(active) : undefined}\n aria-invalid={invalid ? true : undefined}\n aria-describedby={describedBy}\n placeholder={props.multiple && selected.length > 0 ? undefined : placeholder}\n disabled={disabled}\n value={text}\n onChange={(e) => {\n setQuery(e.target.value);\n setOpen(true);\n }}\n onClick={() => setOpen(true)}\n onKeyDown={onKeyDown}\n onBlur={() => {\n setOpen(false);\n setQuery(props.multiple ? \"\" : null);\n }}\n />\n {selected.length > 0 && !disabled ? (\n <IconButton\n icon=\"close\"\n label={l.clear}\n className=\"x-combobox-clear\"\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n setValues([]);\n setQuery(props.multiple ? \"\" : null);\n }}\n />\n ) : null}\n </div>\n <div id={listId} className=\"x-combobox-list\" role=\"listbox\" aria-label={label} aria-multiselectable={props.multiple ? true : undefined} hidden={!showList}>\n {rows.map((row, i) => {\n const isActive = row.id === active;\n const isChosen = row.kind === \"option\" && selected.includes(row.id);\n return (\n <div\n key={row.kind === \"create\" ? COMBOBOX_CREATE : row.id}\n id={`${base}-opt-${i}`}\n className=\"x-list-row x-combobox-option\"\n role=\"option\"\n aria-selected={props.multiple ? isChosen : isActive}\n aria-disabled={row.disabled ? true : undefined}\n data-selected={isActive ? \"\" : undefined}\n data-checked={isChosen ? \"\" : undefined}\n data-disabled={row.disabled ? \"\" : undefined}\n data-create={row.kind === \"create\" ? \"\" : undefined}\n onMouseDown={(e) => e.preventDefault()}\n onMouseMove={() => (row.disabled ? undefined : setChosen(row.id))}\n onClick={() => pick(row.id)}\n >\n <span className=\"x-list-row-main\">\n <span className=\"x-list-row-lead x-combobox-check\">{row.kind === \"create\" ? <Icon name=\"plus\" /> : isChosen ? <Icon name=\"check\" /> : null}</span>\n <span className=\"x-list-row-text\">\n <span className=\"x-list-row-title\">{row.kind === \"create\" ? l.create(row.text) : row.option.label}</span>\n {row.kind === \"option\" && row.option.meta ? <span className=\"x-list-row-meta\">{row.option.meta}</span> : null}\n </span>\n </span>\n </div>\n );\n })}\n </div>\n <div className=\"x-combobox-status\" aria-live=\"polite\">\n {expanded && rows.length === 0 ? l.noResults : null}\n </div>\n </div>\n );\n}\n","/**\n * Pure calendar helpers for DatePicker and DateRangePicker. Dates are ISO `YYYY-MM-DD` strings.\n * Arithmetic runs on day numbers (days since 1970-01-01), never through `new Date(isoString)`,\n * so no time zone or DST can shift a day. Names come from `Intl` with `timeZone: \"UTC\"`.\n */\n\n/** 0 = Sunday … 6 = Saturday. */\nexport type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface DateRange {\n start: string | null;\n end: string | null;\n}\n\nexport interface Ymd {\n y: number;\n /** 1–12 */\n m: number;\n d: number;\n}\n\nconst pad = (n: number, w = 2): string => String(n).padStart(w, \"0\");\n\nexport function isLeapYear(y: number): boolean {\n return (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0;\n}\n\n/** Days in month `m` (1–12) of year `y`. */\nexport function daysInMonth(y: number, m: number): number {\n return [31, isLeapYear(y) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m - 1] ?? NaN;\n}\n\nexport function isValidYmd(y: number, m: number, d: number): boolean {\n return Number.isInteger(y) && Number.isInteger(m) && Number.isInteger(d) && y >= 1 && y <= 9999 && m >= 1 && m <= 12 && d >= 1 && d <= daysInMonth(y, m);\n}\n\nexport function toIso(y: number, m: number, d: number): string {\n return `${pad(y, 4)}-${pad(m)}-${pad(d)}`;\n}\n\n/** Parses a strict `YYYY-MM-DD`; null for anything else or an impossible day. */\nexport function parseIso(iso: string | null | undefined): Ymd | null {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso ?? \"\");\n if (!m) return null;\n const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];\n return isValidYmd(y, mo, d) ? { y, m: mo, d } : null;\n}\n\nexport function isIso(iso: string | null | undefined): iso is string {\n return parseIso(iso) !== null;\n}\n\n/** Days since 1970-01-01 (proleptic Gregorian). */\nexport function toDayNumber(y: number, m: number, d: number): number {\n const yy = m <= 2 ? y - 1 : y;\n const era = Math.floor(yy / 400);\n const yoe = yy - era * 400;\n const doy = Math.floor((153 * ((m + 9) % 12) + 2) / 5) + d - 1;\n const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;\n return era * 146097 + doe - 719468;\n}\n\nexport function fromDayNumber(n: number): Ymd {\n const z = n + 719468;\n const era = Math.floor(z / 146097);\n const doe = z - era * 146097;\n const yoe = Math.floor((doe - Math.floor(doe / 1460) + Math.floor(doe / 36524) - Math.floor(doe / 146096)) / 365);\n const doy = doe - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));\n const mp = Math.floor((5 * doy + 2) / 153);\n const d = doy - Math.floor((153 * mp + 2) / 5) + 1;\n const m = mp < 10 ? mp + 3 : mp - 9;\n return { y: yoe + era * 400 + (m <= 2 ? 1 : 0), m, d };\n}\n\nfunction must(iso: string): Ymd {\n const p = parseIso(iso);\n if (!p) throw new RangeError(`Not an ISO date: ${iso}`);\n return p;\n}\n\nconst dayNum = (iso: string): number => {\n const { y, m, d } = must(iso);\n return toDayNumber(y, m, d);\n};\nconst fromNum = (n: number): string => {\n const { y, m, d } = fromDayNumber(n);\n return toIso(y, m, d);\n};\n\n/** The local calendar date of `now` (a `Date` built by the caller, e.g. for the `today` default). */\nexport function isoFromDate(now: Date): string {\n return toIso(now.getFullYear(), now.getMonth() + 1, now.getDate());\n}\n\nexport function addDays(iso: string, n: number): string {\n return fromNum(dayNum(iso) + n);\n}\n\n/** Adds months, keeping the day when it exists and using the last day of the month otherwise (31 Jan + 1 → 28/29 Feb). */\nexport function addMonths(iso: string, n: number): string {\n const { y, m, d } = must(iso);\n const total = y * 12 + (m - 1) + n;\n const ny = Math.floor(total / 12);\n const nm = total - ny * 12 + 1;\n return toIso(ny, nm, Math.min(d, daysInMonth(ny, nm)));\n}\n\nexport function addYears(iso: string, n: number): string {\n return addMonths(iso, n * 12);\n}\n\n/** -1, 0 or 1. */\nexport function compareIso(a: string, b: string): -1 | 0 | 1 {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** Keeps `iso` inside [min, max]; either bound may be missing. */\nexport function clampIso(iso: string, min?: string | null, max?: string | null): string {\n if (min && iso < min) return min;\n if (max && iso > max) return max;\n return iso;\n}\n\nexport function dayOfWeek(iso: string): WeekDay {\n return ((((dayNum(iso) + 4) % 7) + 7) % 7) as WeekDay; // 1970-01-01 was a Thursday\n}\n\nexport function startOfWeek(iso: string, weekStartsOn: WeekDay = 1): string {\n return addDays(iso, -((dayOfWeek(iso) - weekStartsOn + 7) % 7));\n}\n\nexport function endOfWeek(iso: string, weekStartsOn: WeekDay = 1): string {\n return addDays(startOfWeek(iso, weekStartsOn), 6);\n}\n\nexport function startOfMonth(iso: string): string {\n const { y, m } = must(iso);\n return toIso(y, m, 1);\n}\n\nexport function sameMonth(a: string, b: string): boolean {\n return a.slice(0, 7) === b.slice(0, 7);\n}\n\n/** Six weeks of seven ISO days covering month `m` (1–12) of `y`, starting on `weekStartsOn`. */\nexport function monthGrid(y: number, m: number, weekStartsOn: WeekDay = 1): string[][] {\n const first = startOfWeek(toIso(y, m, 1), weekStartsOn);\n const base = dayNum(first);\n return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, d) => fromNum(base + w * 7 + d)));\n}\n\n/** Whether `iso` cannot be picked: outside [min, max] or rejected by `isDateDisabled`. */\nexport function isDayDisabled(iso: string, min?: string | null, max?: string | null, isDateDisabled?: (iso: string) => boolean): boolean {\n return (!!min && iso < min) || (!!max && iso > max) || !!isDateDisabled?.(iso);\n}\n\n/**\n * Where the focused day moves for a key in the calendar grid, or null when the key is not a move.\n * Arrows ±1 / ±7 days, Home / End the week's first / last day, PageUp / PageDown ±1 month, with Shift ±1 year.\n */\nexport function gridKey(key: string, iso: string, opts: { shiftKey?: boolean; weekStartsOn?: WeekDay } = {}): string | null {\n const ws = opts.weekStartsOn ?? 1;\n switch (key) {\n case \"ArrowLeft\":\n return addDays(iso, -1);\n case \"ArrowRight\":\n return addDays(iso, 1);\n case \"ArrowUp\":\n return addDays(iso, -7);\n case \"ArrowDown\":\n return addDays(iso, 7);\n case \"Home\":\n return startOfWeek(iso, ws);\n case \"End\":\n return endOfWeek(iso, ws);\n case \"PageUp\":\n return opts.shiftKey ? addYears(iso, -1) : addMonths(iso, -1);\n case \"PageDown\":\n return opts.shiftKey ? addYears(iso, 1) : addMonths(iso, 1);\n default:\n return null;\n }\n}\n\n/** Splits a display pattern (\"dd/mm/yyyy\", \"yyyy-mm-dd\", \"mm.dd.yyyy\") into field order and separator. */\nfunction readPattern(format: string): { order: (\"d\" | \"m\" | \"y\")[]; sep: string } | null {\n const parts = format.toLowerCase().match(/(yyyy|mm|dd)|[^a-z]+/g) ?? [];\n const order = parts.filter((p) => p === \"yyyy\" || p === \"mm\" || p === \"dd\").map((p) => p[0] as \"d\" | \"m\" | \"y\");\n if (order.length !== 3 || new Set(order).size !== 3) return null;\n const sep = parts.find((p) => !/^(yyyy|mm|dd)$/.test(p)) ?? \"/\";\n return { order, sep };\n}\n\n/** Formats an ISO date with a pattern of `dd`, `mm` and `yyyy` (default `dd/mm/yyyy`); \"\" for an invalid date. */\nexport function formatDate(iso: string | null | undefined, format = \"dd/mm/yyyy\"): string {\n const p = parseIso(iso);\n const pat = readPattern(format);\n if (!p || !pat) return \"\";\n const field = { d: pad(p.d), m: pad(p.m), y: pad(p.y, 4) };\n return pat.order.map((k) => field[k]).join(pat.sep);\n}\n\n/**\n * Parses typed text in the field order of `format` (default `dd/mm/yyyy`). Accepts one- or two-digit\n * day and month, a four-digit year and `/`, `-` or `.` as separators. Returns ISO, or null when the text\n * is not a real date (31/02/2025).\n */\nexport function parseDateText(text: string, format = \"dd/mm/yyyy\"): string | null {\n const pat = readPattern(format);\n const parts = text.trim().split(/\\s*[/.-]\\s*/);\n if (!pat || parts.length !== 3) return null;\n const v: Record<\"d\" | \"m\" | \"y\", string> = { d: \"\", m: \"\", y: \"\" };\n pat.order.forEach((k, i) => (v[k] = parts[i] ?? \"\"));\n if (!/^\\d{1,2}$/.test(v.d) || !/^\\d{1,2}$/.test(v.m) || !/^\\d{4}$/.test(v.y)) return null;\n const [y, m, d] = [Number(v.y), Number(v.m), Number(v.d)];\n return isValidYmd(y, m, d) ? toIso(y, m, d) : null;\n}\n\n/** Orders two days so start ≤ end. */\nexport function orderRange(a: string, b: string): { start: string; end: string } {\n return a <= b ? { start: a, end: b } : { start: b, end: a };\n}\n\n/**\n * A click in a range calendar. With no pending start it starts a new range; otherwise it closes the\n * range, swapping the ends when the second day is earlier. `done` is true once both ends are set.\n */\nexport function pickRange(pending: string | null, iso: string): { range: { start: string; end: string | null }; pending: string | null; done: boolean } {\n if (pending === null) return { range: { start: iso, end: null }, pending: iso, done: false };\n return { range: orderRange(pending, iso), pending: null, done: true };\n}\n\n/** Whether `iso` lies strictly between the range ends (both set). */\nexport function isBetween(iso: string, start: string | null, end: string | null): boolean {\n if (!start || !end) return false;\n const { start: s, end: e } = orderRange(start, end);\n return iso > s && iso < e;\n}\n\nconst utc = (iso: string): Date => {\n const { y, m, d } = must(iso);\n return new Date(Date.UTC(y, m - 1, d));\n};\n\n/** \"November 2026\" in `locale`. */\nexport function monthTitle(y: number, m: number, locale = \"en\"): string {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\", timeZone: \"UTC\" }).format(utc(toIso(y, m, 1)));\n}\n\n/** Seven weekday names starting on `weekStartsOn`, `short` (\"Mon\") and `long` (\"Monday\"). */\nexport function weekdayNames(locale = \"en\", weekStartsOn: WeekDay = 1): { short: string; long: string }[] {\n const short = new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone: \"UTC\" });\n const long = new Intl.DateTimeFormat(locale, { weekday: \"long\", timeZone: \"UTC\" });\n // 2024-01-07 was a Sunday.\n return Array.from({ length: 7 }, (_, i) => {\n const date = utc(addDays(\"2024-01-07\", (weekStartsOn + i) % 7));\n return { short: short.format(date), long: long.format(date) };\n });\n}\n\n/** Full spoken date (\"Friday, November 6, 2026\") for a day's accessible name. */\nexport function dayLabel(iso: string, locale = \"en\"): string {\n return new Intl.DateTimeFormat(locale, { dateStyle: \"full\", timeZone: \"UTC\" }).format(utc(iso));\n}\n\n/**\n * First month to show (as its 1st day) so `focused` stays visible in a calendar of `months` months\n * whose first month is `view`. Unchanged while it is visible.\n */\nexport function keepInView(view: string, focused: string, months = 1): string {\n const first = startOfMonth(view);\n if (focused < first) return startOfMonth(focused);\n if (focused >= addMonths(first, months)) return addMonths(startOfMonth(focused), 1 - months);\n return first;\n}\n","import type { JSX, KeyboardEvent, Ref } from \"react\";\nimport { addDays, addMonths, clampIso, dayLabel, gridKey, isDayDisabled, monthGrid, monthTitle, parseIso, startOfMonth, weekdayNames, type WeekDay } from \"../../internal/date\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\n/** Shared by DatePicker and DateRangePicker; not exported from the package. */\nexport interface CalendarProps {\n /** Any day in the first month shown. */\n view: string;\n months: 1 | 2;\n /** The day that holds the roving tabindex. */\n focused: string;\n today: string;\n locale: string;\n weekStartsOn: WeekDay;\n min?: string | null;\n max?: string | null;\n isDateDisabled?: (iso: string) => boolean;\n /** Range ends and the days between them; a single date is a range whose ends meet. */\n range: { start: string | null; end: string | null };\n onFocusChange: (iso: string) => void;\n /** ±1: the previous or next month button. */\n onMonthStep: (delta: 1 | -1) => void;\n onPick: (iso: string) => void;\n onHover?: (iso: string | null) => void;\n labels: { previousMonth: string; nextMonth: string };\n idBase: string;\n gridRef?: Ref<HTMLDivElement>;\n}\n\nexport type CalendarKeyResult = { move: string } | { pick: string } | null;\n\n/** What a key in the grid does: move the focused day (kept inside min and max) or pick it. Pure. */\nexport function calendarKey(\n key: string,\n focused: string,\n opts: { shiftKey?: boolean; weekStartsOn?: WeekDay; min?: string | null; max?: string | null; isDateDisabled?: (iso: string) => boolean },\n): CalendarKeyResult {\n if (key === \"Enter\" || key === \" \") return isDayDisabled(focused, opts.min, opts.max, opts.isDateDisabled) ? null : { pick: focused };\n const next = gridKey(key, focused, opts);\n return next === null ? null : { move: clampIso(next, opts.min, opts.max) };\n}\n\n/** Whether the previous / next month buttons can move, given min and max. */\nexport function monthStepAllowed(view: string, months: number, min?: string | null, max?: string | null): { prev: boolean; next: boolean } {\n const first = startOfMonth(view);\n return { prev: !min || addDays(first, -1) >= min, next: !max || addMonths(first, months) <= max };\n}\n\nexport function Calendar(p: CalendarProps): JSX.Element {\n const first = startOfMonth(p.view);\n const shown = Array.from({ length: p.months }, (_, i) => parseIso(addMonths(first, i))!);\n const names = weekdayNames(p.locale, p.weekStartsOn);\n const step = monthStepAllowed(first, p.months, p.min, p.max);\n const { start, end } = p.range;\n const lo = start && end && end < start ? end : start;\n const hi = start && end && end < start ? start : end;\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n const r = calendarKey(e.key, p.focused, { shiftKey: e.shiftKey, weekStartsOn: p.weekStartsOn, min: p.min, max: p.max, isDateDisabled: p.isDateDisabled });\n if (!r) return;\n e.preventDefault();\n if (\"pick\" in r) p.onPick(r.pick);\n else p.onFocusChange(r.move);\n };\n\n return (\n <div className=\"x-calendar\" data-months={p.months}>\n <div className=\"x-calendar-nav\">\n <IconButton icon=\"chevron-left\" label={p.labels.previousMonth} disabled={!step.prev} onClick={() => p.onMonthStep(-1)} />\n <IconButton icon=\"chevron-right\" label={p.labels.nextMonth} disabled={!step.next} onClick={() => p.onMonthStep(1)} />\n </div>\n <div className=\"x-calendar-months\" ref={p.gridRef} onKeyDown={onKeyDown} onMouseLeave={p.onHover ? () => p.onHover?.(null) : undefined}>\n {shown.map(({ y, m }) => {\n const titleId = `${p.idBase}-${y}-${m}`;\n return (\n <div className=\"x-calendar-month\" key={titleId}>\n <h2 className=\"x-calendar-title\" id={titleId} aria-live=\"polite\">\n {monthTitle(y, m, p.locale)}\n </h2>\n <table className=\"x-calendar-grid\" role=\"grid\" aria-labelledby={titleId}>\n <thead>\n <tr>\n {names.map((n) => (\n <th key={n.long} scope=\"col\" abbr={n.long}>\n {n.short}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {monthGrid(y, m, p.weekStartsOn).map((week) => (\n <tr key={week[0]}>\n {week.map((iso) => {\n if (parseIso(iso)!.m !== m) return <td key={iso} className=\"x-calendar-day\" data-outside=\"\" />;\n const off = isDayDisabled(iso, p.min, p.max, p.isDateDisabled);\n const isStart = iso === lo;\n const isEnd = iso === hi;\n const middle = !!lo && !!hi && iso > lo && iso < hi;\n const selected = isStart || isEnd || middle;\n return (\n <td\n key={iso}\n className=\"x-calendar-day\"\n tabIndex={iso === p.focused ? 0 : -1}\n aria-selected={selected}\n aria-current={iso === p.today ? \"date\" : undefined}\n aria-disabled={off ? true : undefined}\n aria-label={dayLabel(iso, p.locale)}\n data-iso={iso}\n data-range={lo !== hi && selected ? (isStart ? \"start\" : isEnd ? \"end\" : \"middle\") : undefined}\n onClick={off ? undefined : () => p.onPick(iso)}\n onMouseEnter={p.onHover && !off ? () => p.onHover?.(iso) : undefined}\n >\n {parseIso(iso)!.d}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n","import { useEffect, useId, useRef, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { addMonths, clampIso, formatDate, isDayDisabled, isIso, isoFromDate, parseDateText, type WeekDay } from \"../../internal/date\";\nimport { Button } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Popover } from \"../Popover/Popover\";\nimport { Calendar } from \"./Calendar\";\n\nexport interface DatePickerLabels {\n /** Calendar button. */\n openCalendar: string;\n /** Name of the calendar popover. */\n calendar: string;\n previousMonth: string;\n nextMonth: string;\n today: string;\n clear: string;\n /** Shown under the field when typed text is not a date that can be picked. */\n invalid: string;\n}\n\nexport const DATE_PICKER_LABELS: DatePickerLabels = {\n openCalendar: \"Open calendar\",\n calendar: \"Choose date\",\n previousMonth: \"Previous month\",\n nextMonth: \"Next month\",\n today: \"Today\",\n clear: \"Clear\",\n invalid: \"Enter a valid date\",\n};\n\nexport interface DatePickerProps {\n label: ReactNode;\n /** ISO `YYYY-MM-DD`, or null for no date. */\n value: string | null;\n onChange: (value: string | null) => void;\n /** Earliest day that can be picked (ISO). */\n min?: string;\n /** Latest day that can be picked (ISO). */\n max?: string;\n disabled?: boolean;\n /** Extra days that cannot be picked (weekends, holidays). */\n isDateDisabled?: (iso: string) => boolean;\n /** BCP 47 locale for month and weekday names. Default \"en\". */\n locale?: string;\n /** Display and typing pattern of `dd`, `mm` and `yyyy`. Default \"dd/mm/yyyy\". */\n format?: string;\n /** 0 = Sunday … 6 = Saturday. Default 1 (Monday). */\n weekStartsOn?: WeekDay;\n /** \"Today\" as ISO; defaults to the local date. Pass it for SSR or tests. */\n today?: string;\n hint?: ReactNode;\n /** Keep the label for screen readers only, e.g. a date picker in a table row whose column names it. */\n hideLabel?: boolean;\n /** Replaces the hint and marks the field invalid. */\n error?: ReactNode;\n /** Name of a hidden input that carries the ISO value in a form. */\n name?: string;\n id?: string;\n /** Opens the calendar on mount (previews). */\n defaultOpen?: boolean;\n /** Render the calendar into `document.body` (default true). false keeps it inside the field, for an inline preview or a scrolling panel. */\n portal?: boolean;\n labels?: Partial<DatePickerLabels>;\n className?: string;\n}\n\nexport function DatePicker({\n label,\n value: rawValue,\n onChange,\n min,\n max,\n disabled,\n isDateDisabled,\n locale = \"en\",\n format = \"dd/mm/yyyy\",\n weekStartsOn = 1,\n today: todayProp,\n hint,\n hideLabel,\n error,\n name,\n id,\n defaultOpen = false,\n portal = true,\n labels,\n className,\n}: DatePickerProps): JSX.Element {\n const l = { ...DATE_PICKER_LABELS, ...labels };\n const value = isIso(rawValue) ? rawValue : null;\n const today = isIso(todayProp) ? todayProp : isoFromDate(new Date());\n const auto = useId();\n const inputId = id ?? `x-date-${auto}`;\n const [open, setOpen] = useState(defaultOpen);\n const [focused, setFocused] = useState(() => clampIso(value ?? today, min, max));\n const [draft, setDraft] = useState<string | null>(null);\n const [bad, setBad] = useState(false);\n const gridRef = useRef<HTMLDivElement | null>(null);\n // Only an open the person asks for moves focus into the grid; mounted open (defaultOpen) leaves focus and scroll alone.\n const moveFocus = useRef(false);\n\n // Runs after Popover's own effect (a child), so the day wins over the panel for focus.\n useEffect(() => {\n if (!open || !moveFocus.current) return;\n moveFocus.current = false;\n gridRef.current?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus();\n }, [open, focused]);\n\n const show = (): void => {\n setFocused(clampIso(value ?? today, min, max));\n moveFocus.current = true;\n setOpen(true);\n };\n const pick = (iso: string | null): void => {\n onChange(iso);\n setDraft(null);\n setBad(false);\n if (iso) setFocused(iso);\n setOpen(false);\n };\n const commit = (): void => {\n if (draft === null) return;\n if (draft.trim() === \"\") return pick(null);\n const iso = parseDateText(draft, format);\n if (iso && !isDayDisabled(iso, min, max, isDateDisabled)) {\n if (iso !== value) onChange(iso);\n setDraft(null);\n setBad(false);\n setFocused(iso);\n } else setBad(true);\n };\n const onInputKey = (e: KeyboardEvent<HTMLInputElement>): void => {\n if (e.key === \"Enter\") commit();\n else if (e.key === \"ArrowDown\" && e.altKey) {\n e.preventDefault();\n show();\n }\n };\n\n const note = error ?? (bad ? l.invalid : hint);\n const noteId = note ? `${inputId}-note` : undefined;\n const invalid = !!error || bad;\n const todayOff = isDayDisabled(today, min, max, isDateDisabled);\n\n return (\n <div className={cx(\"ws-field x-date-picker\", className)} data-invalid={invalid ? \"\" : undefined} data-disabled={disabled ? \"\" : undefined}>\n <label htmlFor={inputId} className={hideLabel ? \"x-sr-only\" : undefined}>{label}</label>\n <div className=\"x-date-control\">\n <input\n id={inputId}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n placeholder={format}\n value={draft ?? formatDate(value, format)}\n disabled={disabled}\n aria-invalid={invalid ? true : undefined}\n aria-describedby={noteId}\n onChange={(e) => {\n setDraft(e.target.value);\n setBad(false);\n }}\n onBlur={commit}\n onKeyDown={onInputKey}\n />\n <Popover\n open={open}\n onClose={() => setOpen(false)}\n placement=\"bottom-end\"\n label={l.calendar}\n className=\"x-date-popover\"\n portal={portal}\n trigger={(t) => <IconButton icon=\"calendar\" label={l.openCalendar} disabled={disabled} onClick={() => (open ? setOpen(false) : show())} {...t} />}\n >\n <Calendar\n view={focused}\n months={1}\n focused={focused}\n today={today}\n locale={locale}\n weekStartsOn={weekStartsOn}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n range={{ start: value, end: value }}\n onFocusChange={(iso) => {\n moveFocus.current = true;\n setFocused(iso);\n }}\n onMonthStep={(d) => setFocused((f) => clampIso(addMonths(f, d), min, max))}\n onPick={pick}\n labels={l}\n idBase={`${inputId}-cal`}\n gridRef={gridRef}\n />\n <div className=\"x-calendar-footer\">\n <Button variant=\"secondary\" onClick={() => pick(null)} disabled={value === null}>\n {l.clear}\n </Button>\n <Button variant=\"secondary\" onClick={() => pick(today)} disabled={todayOff}>\n {l.today}\n </Button>\n </div>\n </Popover>\n </div>\n {name ? <input type=\"hidden\" name={name} value={value ?? \"\"} /> : null}\n {note ? <small id={noteId}>{note}</small> : null}\n </div>\n );\n}\n","import { useEffect, useId, useRef, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport {\n addMonths,\n clampIso,\n formatDate,\n isDayDisabled,\n isIso,\n isoFromDate,\n keepInView,\n orderRange,\n parseDateText,\n pickRange,\n startOfMonth,\n type DateRange,\n type WeekDay,\n} from \"../../internal/date\";\nimport { Button } from \"../Button/Button\";\nimport { Calendar } from \"../DatePicker/Calendar\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Popover } from \"../Popover/Popover\";\n\nexport type { DateRange };\n\nexport interface DateRangePreset {\n label: string;\n range: DateRange;\n}\n\nexport interface DateRangePickerLabels {\n openCalendar: string;\n /** Name of the calendar popover. */\n calendar: string;\n previousMonth: string;\n nextMonth: string;\n today: string;\n clear: string;\n /** Name of the first text box. */\n start: string;\n /** Name of the second text box. */\n end: string;\n /** Name of the preset list. */\n presets: string;\n /** Shown under the field when typed text is not a date that can be picked. */\n invalid: string;\n}\n\nexport const DATE_RANGE_PICKER_LABELS: DateRangePickerLabels = {\n openCalendar: \"Open calendar\",\n calendar: \"Choose dates\",\n previousMonth: \"Previous month\",\n nextMonth: \"Next month\",\n today: \"Today\",\n clear: \"Clear\",\n start: \"Start date\",\n end: \"End date\",\n presets: \"Presets\",\n invalid: \"Enter a valid date\",\n};\n\nexport interface DateRangePickerProps {\n label: ReactNode;\n /** ISO `YYYY-MM-DD` ends; either may be null. */\n value: DateRange;\n onChange: (value: DateRange) => void;\n min?: string;\n max?: string;\n disabled?: boolean;\n isDateDisabled?: (iso: string) => boolean;\n /** BCP 47 locale for month and weekday names. Default \"en\". */\n locale?: string;\n /** Display and typing pattern of `dd`, `mm` and `yyyy`. Default \"dd/mm/yyyy\". */\n format?: string;\n /** 0 = Sunday … 6 = Saturday. Default 1 (Monday). */\n weekStartsOn?: WeekDay;\n /** \"Today\" as ISO; defaults to the local date. Pass it for SSR or tests. */\n today?: string;\n /** Quick ranges listed beside the calendar (\"Last 7 days\"). */\n presets?: DateRangePreset[];\n hint?: ReactNode;\n /** Replaces the hint and marks the field invalid. */\n error?: ReactNode;\n id?: string;\n /** Opens the calendar on mount (previews). */\n defaultOpen?: boolean;\n /** Render the calendar into `document.body` (default true). false keeps it inside the field, for an inline preview or a scrolling panel. */\n portal?: boolean;\n labels?: Partial<DateRangePickerLabels>;\n className?: string;\n}\n\ntype End = \"start\" | \"end\";\n\n/** The range after typing `iso` (or clearing with null) into one end; the ends swap when they cross. Pure. */\nexport function setRangeEnd(range: DateRange, which: End, iso: string | null): DateRange {\n const next = { ...range, [which]: iso };\n return next.start && next.end ? orderRange(next.start, next.end) : next;\n}\n\nexport function DateRangePicker({\n label,\n value: rawValue,\n onChange,\n min,\n max,\n disabled,\n isDateDisabled,\n locale = \"en\",\n format = \"dd/mm/yyyy\",\n weekStartsOn = 1,\n today: todayProp,\n presets,\n hint,\n error,\n id,\n defaultOpen = false,\n portal = true,\n labels,\n className,\n}: DateRangePickerProps): JSX.Element {\n const l = { ...DATE_RANGE_PICKER_LABELS, ...labels };\n const value: DateRange = { start: isIso(rawValue?.start) ? rawValue.start : null, end: isIso(rawValue?.end) ? rawValue.end : null };\n const today = isIso(todayProp) ? todayProp : isoFromDate(new Date());\n const auto = useId();\n const base = id ?? `x-date-range-${auto}`;\n const [open, setOpen] = useState(defaultOpen);\n const [focused, setFocused] = useState(() => clampIso(value.start ?? today, min, max));\n const [view, setView] = useState(() => startOfMonth(clampIso(value.start ?? today, min, max)));\n const [pending, setPending] = useState<string | null>(null);\n const [hover, setHover] = useState<string | null>(null);\n const [draft, setDraft] = useState<Record<End, string | null>>({ start: null, end: null });\n const [bad, setBad] = useState<Record<End, boolean>>({ start: false, end: false });\n const gridRef = useRef<HTMLDivElement | null>(null);\n // Only an open the person asks for moves focus into the grid; mounted open (defaultOpen) leaves focus and scroll alone.\n const moveFocus = useRef(false);\n\n useEffect(() => {\n if (!open || !moveFocus.current) return;\n moveFocus.current = false;\n gridRef.current?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus();\n }, [open, focused]);\n\n const show = (): void => {\n const f = clampIso(value.start ?? today, min, max);\n setFocused(f);\n setView(startOfMonth(f));\n setPending(null);\n setHover(null);\n moveFocus.current = true;\n setOpen(true);\n };\n const close = (): void => {\n setPending(null);\n setHover(null);\n setOpen(false);\n };\n const set = (range: DateRange): void => {\n onChange(range);\n setDraft({ start: null, end: null });\n setBad({ start: false, end: false });\n };\n const pickDay = (iso: string): void => {\n const r = pickRange(pending, iso);\n set(r.range);\n setFocused(iso);\n setPending(r.pending);\n if (r.done) close();\n };\n const commit = (which: End): void => {\n const text = draft[which];\n if (text === null) return;\n const iso = text.trim() === \"\" ? null : parseDateText(text, format);\n if (text.trim() !== \"\" && (!iso || isDayDisabled(iso, min, max, isDateDisabled))) {\n setBad((b) => ({ ...b, [which]: true }));\n return;\n }\n onChange(setRangeEnd(value, which, iso));\n setDraft((d) => ({ ...d, [which]: null }));\n setBad((b) => ({ ...b, [which]: false }));\n };\n const inputKey =\n (which: End) =>\n (e: KeyboardEvent<HTMLInputElement>): void => {\n if (e.key === \"Enter\") commit(which);\n else if (e.key === \"ArrowDown\" && e.altKey) {\n e.preventDefault();\n show();\n }\n };\n\n const invalid = !!error || bad.start || bad.end;\n const note = error ?? (bad.start || bad.end ? l.invalid : hint);\n const labelId = `${base}-label`;\n const noteId = note ? `${base}-note` : undefined;\n const shownEnd = value.end ?? (pending && hover ? hover : null);\n const todayOff = isDayDisabled(today, min, max, isDateDisabled);\n const sameRange = (r: DateRange): boolean => r.start === value.start && r.end === value.end;\n\n const input = (which: End): JSX.Element => (\n <input\n id={`${base}-${which}`}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n placeholder={format}\n aria-label={l[which]}\n value={draft[which] ?? formatDate(value[which], format)}\n disabled={disabled}\n aria-invalid={bad[which] || error ? true : undefined}\n aria-describedby={noteId}\n onChange={(e) => {\n const text = e.target.value;\n setDraft((d) => ({ ...d, [which]: text }));\n setBad((b) => ({ ...b, [which]: false }));\n }}\n onBlur={() => commit(which)}\n onKeyDown={inputKey(which)}\n />\n );\n\n return (\n <div\n className={cx(\"ws-field x-date-picker x-date-range-picker\", className)}\n role=\"group\"\n aria-labelledby={labelId}\n data-invalid={invalid ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n >\n <label id={labelId} htmlFor={`${base}-start`}>\n {label}\n </label>\n <div className=\"x-date-control\">\n {input(\"start\")}\n <span className=\"x-date-range-sep\" aria-hidden=\"true\">\n –\n </span>\n {input(\"end\")}\n <Popover\n open={open}\n onClose={close}\n placement=\"bottom-end\"\n label={l.calendar}\n className=\"x-date-popover\"\n portal={portal}\n trigger={(t) => <IconButton icon=\"calendar\" label={l.openCalendar} disabled={disabled} onClick={() => (open ? close() : show())} {...t} />}\n >\n <div className=\"x-date-range-body\">\n {presets?.length ? (\n <div className=\"x-calendar-presets\" role=\"group\" aria-label={l.presets}>\n {presets.map((p) => (\n <button\n key={p.label}\n type=\"button\"\n className=\"x-calendar-preset\"\n aria-pressed={sameRange(p.range)}\n onClick={() => {\n set(p.range);\n close();\n }}\n >\n {p.label}\n </button>\n ))}\n </div>\n ) : null}\n <Calendar\n view={view}\n months={2}\n focused={focused}\n today={today}\n locale={locale}\n weekStartsOn={weekStartsOn}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n range={{ start: value.start, end: shownEnd }}\n onFocusChange={(iso) => {\n moveFocus.current = true;\n setFocused(iso);\n setView((v) => keepInView(v, iso, 2));\n if (pending) setHover(iso);\n }}\n onMonthStep={(d) => {\n setView((v) => addMonths(v, d));\n setFocused((f) => clampIso(addMonths(f, d), min, max));\n }}\n onPick={pickDay}\n onHover={pending ? setHover : undefined}\n labels={l}\n idBase={`${base}-cal`}\n gridRef={gridRef}\n />\n </div>\n <div className=\"x-calendar-footer\">\n <Button\n variant=\"secondary\"\n disabled={!value.start && !value.end}\n onClick={() => {\n set({ start: null, end: null });\n setPending(null);\n }}\n >\n {l.clear}\n </Button>\n <Button variant=\"secondary\" onClick={() => pickDay(today)} disabled={todayOff}>\n {l.today}\n </Button>\n </div>\n </Popover>\n </div>\n {note ? <small id={noteId}>{note}</small> : null}\n </div>\n );\n}\n","/** Pure helpers behind `TimeField`: parse typed time-of-day or duration text, format and step it. */\n\nexport interface TimeTextOptions {\n /** \"time\" (default): a time of day, 00:00 to 23:59. \"duration\": minutes and seconds, `mm:ss`. */\n mode?: \"time\" | \"duration\";\n /** Time mode only: `HH:mm:ss` instead of `HH:mm`. */\n seconds?: boolean;\n /** Duration mode only: the largest minutes value. Default 59. */\n maxMinutes?: number;\n}\n\nconst pad = (n: number): string => String(n).padStart(2, \"0\");\nconst maxMin = (o: TimeTextOptions): number => Math.max(0, Math.floor(o.maxMinutes ?? 59));\n\n/** Number of distinct values in the range, in seconds; stepping wraps modulo this. */\nfunction span(o: TimeTextOptions): number {\n return o.mode === \"duration\" ? maxMin(o) * 60 + 60 : 24 * 3600;\n}\n\nfunction build(h: number, m: number, s: number, o: TimeTextOptions): string | null {\n if (![h, m, s].every(Number.isInteger) || h < 0 || m < 0 || s < 0 || s > 59) return null;\n if (o.mode === \"duration\") return m <= maxMin(o) ? `${pad(m)}:${pad(s)}` : null;\n if (h > 23 || m > 59) return null;\n if (!o.seconds && s !== 0) return null;\n return o.seconds ? `${pad(h)}:${pad(m)}:${pad(s)}` : `${pad(h)}:${pad(m)}`;\n}\n\n/**\n * Parses typed text into the normalised value (`HH:mm`, `HH:mm:ss` or `mm:ss`), or null when it is empty, malformed or out of range.\n * Fields are separated by `:` or `.`, each one or two digits (`9:5` is `09:05`; duration minutes may have more digits when `maxMinutes` allows).\n * Digits only: time mode reads 1–2 digits as hours (`9` is `09:00`), 3–4 as hours and minutes (`930` and `0930` are `09:30`)\n * and, with `seconds`, 5–6 as hours, minutes and seconds. Duration mode reads 1–2 digits as seconds (`45` is `00:45`, `90` is invalid)\n * and 3 or more as minutes then the last two digits as seconds (`130` is `01:30`). With `seconds`, `09:30` is `09:30:00`; without it a seconds field is invalid.\n */\nexport function parseTime(text: string, opts: TimeTextOptions = {}): string | null {\n const t = text.trim();\n if (!t) return null;\n const dur = opts.mode === \"duration\";\n if (/^\\d+$/.test(t)) {\n const n = t.length;\n const last2 = Number(t.slice(-2));\n const head = Number(t.slice(0, -2));\n if (dur) return n <= 2 ? build(0, 0, Number(t), opts) : build(0, head, last2, opts);\n if (n <= 2) return build(Number(t), 0, 0, opts);\n if (n <= 4) return build(head, last2, 0, opts);\n if (opts.seconds && n <= 6) return build(Number(t.slice(0, -4)), Number(t.slice(-4, -2)), last2, opts);\n return null;\n }\n const parts = t.split(/[:.]/);\n if (dur) {\n if (parts.length !== 2 || !/^\\d+$/.test(parts[0] ?? \"\") || !/^\\d{1,2}$/.test(parts[1] ?? \"\")) return null;\n return build(0, Number(parts[0]), Number(parts[1]), opts);\n }\n if (!parts.every((p) => /^\\d{1,2}$/.test(p))) return null;\n if (parts.length === 2) return build(Number(parts[0]), Number(parts[1]), 0, opts);\n if (parts.length === 3 && opts.seconds) return build(Number(parts[0]), Number(parts[1]), Number(parts[2]), opts);\n return null;\n}\n\n/** Seconds since 00:00 (time) or in the duration, for a value `parseTime` accepts; null otherwise. */\nexport function timeToSeconds(value: string | null | undefined, opts: TimeTextOptions = {}): number | null {\n const v = value == null ? null : parseTime(value, opts);\n if (v === null) return null;\n const [h = NaN, m = NaN, s = 0] = v.split(\":\").map(Number);\n if (opts.mode === \"duration\") return h * 60 + m;\n return h * 3600 + m * 60 + s;\n}\n\n/** Formats a number of seconds as a value, wrapped into the range (time mode without `seconds` drops the seconds). */\nexport function formatTime(totalSeconds: number, opts: TimeTextOptions = {}): string {\n const r = span(opts);\n const n = ((Math.floor(totalSeconds) % r) + r) % r;\n if (opts.mode === \"duration\") return `${pad(Math.floor(n / 60))}:${pad(n % 60)}`;\n const h = Math.floor(n / 3600);\n const m = Math.floor((n % 3600) / 60);\n return opts.seconds ? `${pad(h)}:${pad(m)}:${pad(n % 60)}` : `${pad(h)}:${pad(m)}`;\n}\n\n/**\n * Moves a value by `steps` minutes (time) or seconds (duration), wrapping within the range.\n * An empty or invalid value starts from 00:00.\n */\nexport function stepTime(value: string | null | undefined, steps: number, opts: TimeTextOptions = {}): string {\n const unit = opts.mode === \"duration\" ? 1 : 60;\n return formatTime((timeToSeconds(value, opts) ?? 0) + steps * unit, opts);\n}\n","import { useId, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { parseTime, stepTime, type TimeTextOptions } from \"./time-text\";\n\nexport interface TimeFieldLabels {\n /** Shown under the field when the typed text is not a valid time or duration. */\n invalid: string;\n}\n\nexport const TIME_FIELD_LABELS: TimeFieldLabels = { invalid: \"Enter a valid time\" };\n\nexport interface TimeFieldProps {\n label: ReactNode;\n /** `HH:mm`, `HH:mm:ss` (mode \"time\", `seconds`) or `mm:ss` (mode \"duration\"); null for empty. */\n value: string | null;\n /** Called with the normalised value, or null when the box is emptied. Never called with invalid text. */\n onChange: (value: string | null) => void;\n /** \"time\" (default): 00:00 to 23:59(:59). \"duration\": minutes 0 to `maxMinutes`, seconds 0 to 59. */\n mode?: \"time\" | \"duration\";\n /** Time mode only: `HH:mm:ss`. */\n seconds?: boolean;\n /** Duration mode only: the largest minutes value. Default 59. */\n maxMinutes?: number;\n hint?: ReactNode;\n /** Replaces the hint (and the invalid message) and marks the field invalid. */\n error?: ReactNode;\n /** Keeps the label for screen readers only. */\n hideLabel?: boolean;\n disabled?: boolean;\n required?: boolean;\n /** Name of a hidden input that carries the committed value in a form. */\n name?: string;\n id?: string;\n className?: string;\n labels?: Partial<TimeFieldLabels>;\n}\n\nexport function TimeField({\n label,\n value,\n onChange,\n mode = \"time\",\n seconds = false,\n maxMinutes = 59,\n hint,\n error,\n hideLabel,\n disabled,\n required,\n name,\n id,\n className,\n labels,\n}: TimeFieldProps): JSX.Element {\n const l = { ...TIME_FIELD_LABELS, ...labels };\n const opts: TimeTextOptions = { mode, seconds: mode === \"time\" && seconds, maxMinutes };\n const auto = useId();\n const inputId = id ?? `x-time-${auto}`;\n const [draft, setDraft] = useState<string | null>(null);\n const [bad, setBad] = useState(false);\n // A new value from outside replaces whatever text is pending (state adjusted during render, no effect).\n const [seen, setSeen] = useState<string | null>(value);\n const fresh = seen === value;\n if (!fresh) {\n setSeen(value);\n setDraft(null);\n setBad(false);\n }\n const pending = fresh ? draft : null;\n const flagged = fresh && bad;\n const committed = value === null ? \"\" : (parseTime(value, opts) ?? \"\");\n\n const settle = (next: string | null): void => {\n setDraft(null);\n setBad(false);\n if (next !== value) onChange(next);\n };\n const commit = (): void => {\n if (pending === null) return;\n if (pending.trim() === \"\") return settle(null);\n const next = parseTime(pending, opts);\n if (next !== null) settle(next);\n else setBad(true);\n };\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n if (e.key === \"Enter\") commit();\n else if ((e.key === \"ArrowUp\" || e.key === \"ArrowDown\") && !e.altKey && !e.ctrlKey && !e.metaKey) {\n e.preventDefault();\n const base = (pending !== null ? parseTime(pending, opts) : null) ?? (committed || null);\n settle(stepTime(base, e.key === \"ArrowUp\" ? 1 : -1, opts));\n }\n };\n\n const note = error ?? (flagged ? l.invalid : hint);\n const noteId = note ? `${inputId}-note` : undefined;\n const invalid = !!error || flagged;\n const placeholder = mode === \"duration\" ? \"mm:ss\" : opts.seconds ? \"hh:mm:ss\" : \"hh:mm\";\n\n return (\n <div className={cx(\"ws-field x-time-field\", className)} data-invalid={invalid ? \"\" : undefined} data-disabled={disabled ? \"\" : undefined}>\n <label htmlFor={inputId} className={hideLabel ? \"x-sr-only\" : undefined}>{label}</label>\n <input\n id={inputId}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={placeholder}\n value={pending ?? committed}\n disabled={disabled}\n required={required}\n aria-invalid={invalid ? true : undefined}\n aria-describedby={noteId}\n onChange={(e) => {\n setDraft(e.target.value);\n setBad(false);\n }}\n onFocus={(e) => e.currentTarget.select()}\n onBlur={commit}\n onKeyDown={onKeyDown}\n />\n {name ? <input type=\"hidden\" name={name} value={committed} /> : null}\n {note ? <small id={noteId}>{note}</small> : null}\n </div>\n );\n}\n","import type { ButtonHTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface FilterChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n /** Whether the filter is on; rendered as aria-pressed. */\n pressed: boolean;\n /** Items that match this filter. */\n count?: number;\n children: ReactNode;\n}\n\nexport function FilterChip({ pressed, count, children, className, ...rest }: FilterChipProps): JSX.Element {\n return (\n <button type=\"button\" className={cx(\"task-chip\", className)} aria-pressed={pressed} {...rest}>\n <span className=\"task-chip-label\">{children}</span>\n {count != null ? <span className=\"task-chip-count\">{count}</span> : null}\n </button>\n );\n}\n","import type { ButtonHTMLAttributes, JSX, MouseEvent, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport type ToggleButtonTone = \"default\" | \"warning\";\n\nexport interface ToggleButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\" | \"aria-pressed\" | \"onChange\"> {\n /** On or off; rendered as aria-pressed. */\n pressed: boolean;\n /** Called with the next value on click, Space or Enter (native button). Not called when `onClick` calls `preventDefault()`. */\n onPressedChange?: (pressed: boolean) => void;\n /** \"warning\" marks an option that needs care (it grants more than it looks like): warn-coloured border, on and off. Pair it with text that says why. Default \"default\". */\n tone?: ToggleButtonTone;\n /** \"sm\" (24px, default) or \"md\" (32px). */\n size?: \"sm\" | \"md\";\n children: ReactNode;\n}\n\n/** Pure: the value `onPressedChange` receives for a click on a toggle that is `pressed`. */\nexport function nextPressed(pressed: boolean): boolean {\n return !pressed;\n}\n\nexport function ToggleButton({ pressed, onPressedChange, tone = \"default\", size = \"sm\", children, className, onClick, ...rest }: ToggleButtonProps): JSX.Element {\n const click = (event: MouseEvent<HTMLButtonElement>): void => {\n onClick?.(event);\n if (!event.defaultPrevented) onPressedChange?.(nextPressed(pressed));\n };\n return (\n <button\n type=\"button\"\n {...rest}\n className={cx(\"x-toggle\", className)}\n aria-pressed={pressed}\n data-tone={tone === \"warning\" ? \"warning\" : undefined}\n data-size={size}\n onClick={click}\n >\n <Icon name=\"check\" size={12} className=\"x-toggle-check\" />\n <span className=\"x-toggle-label\">{children}</span>\n </button>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface ActionTileProps {\n /** Leading line icon. */\n icon: IconName;\n /** One short label, sentence case. */\n title: string;\n /** One line that says what the action does. */\n description: string;\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\nexport function ActionTile({ icon, title, description, onClick, disabled = false, className }: ActionTileProps): JSX.Element {\n return (\n <button type=\"button\" className={cx(\"x-action-tile\", className)} disabled={disabled} onClick={onClick}>\n <span className=\"x-action-tile-icon\"><Icon name={icon} size={18} /></span>\n <span className=\"x-action-tile-title\">{title}</span>\n <span className=\"x-action-tile-desc\">{description}</span>\n </button>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface ListRowProps {\n /** Main line: a worktree, agent session, task or account name. */\n title: ReactNode;\n /** Second line in muted text (branch, path, last activity). */\n meta?: ReactNode;\n /** Before the text: an icon, StatusDot or AgentChip. */\n leading?: ReactNode;\n /** After the text and outside the main button: badges or IconButtons. */\n trailing?: ReactNode;\n /** Marks the current row with a tint and a 1px accent border, plus aria-current. */\n selected?: boolean;\n disabled?: boolean;\n /** Makes the main area a button. Without it the row is static. */\n onClick?: () => void;\n /** Root element. Use \"li\" inside a ul/ol. Default \"div\". */\n as?: \"div\" | \"li\";\n className?: string;\n}\n\nexport function ListRow({\n title,\n meta,\n leading,\n trailing,\n selected = false,\n disabled = false,\n onClick,\n as: Root = \"div\",\n className,\n}: ListRowProps): JSX.Element {\n const body = (\n <>\n {leading ? <span className=\"x-list-row-lead\">{leading}</span> : null}\n <span className=\"x-list-row-text\">\n <span className=\"x-list-row-title\">{title}</span>\n {meta ? <span className=\"x-list-row-meta\">{meta}</span> : null}\n </span>\n </>\n );\n return (\n <Root\n className={cx(\"x-list-row\", className)}\n data-selected={selected ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n >\n {onClick ? (\n <button type=\"button\" className=\"x-list-row-main\" aria-current={selected ? \"true\" : undefined} disabled={disabled} onClick={onClick}>\n {body}\n </button>\n ) : (\n <div className=\"x-list-row-main\" aria-current={selected ? \"true\" : undefined}>\n {body}\n </div>\n )}\n {trailing ? <span className=\"x-list-row-trail\">{trailing}</span> : null}\n </Root>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\n/** Props handed to `renderLink`; spread them on your router's link. */\nexport interface ResourceCardLinkProps {\n href: string;\n className: string;\n children: ReactNode;\n}\n\nexport interface ResourceCardProps {\n /** Name of the thing: a provider, an integration, a tool. */\n title: ReactNode;\n /** Line under the title: a StatusDot with a label, Badges or one short fact. */\n status?: ReactNode;\n /** Before the text: an Avatar, a logo or an Icon. */\n leading?: ReactNode;\n /** After the text and outside the main link: a Switch or an IconButton. */\n trailing?: ReactNode;\n /** \"hover\" shows `trailing` on hover and focus only (always on touch screens). Default \"always\". */\n revealTrailing?: \"always\" | \"hover\";\n /** Makes the main area a link that opens the thing. */\n href?: string;\n /** Makes the main area a button. Ignored with `href`. Without both the card is static. */\n onClick?: () => void;\n /** Renders the `href` through your link component (e.g. Next `Link`). Default: a plain `<a>`. */\n renderLink?: (props: ResourceCardLinkProps) => ReactNode;\n /** Draws the card fainter, for a thing that is switched off. */\n dimmed?: boolean;\n className?: string;\n}\n\n/** A card for one thing in a grid (a provider, an integration, a tool): its mark, its name, its status, one control. */\nexport function ResourceCard({ title, status, leading, trailing, revealTrailing = \"always\", href, onClick, renderLink, dimmed = false, className }: ResourceCardProps): JSX.Element {\n const body = (\n <>\n {leading ? <span className=\"x-resource-card-lead\">{leading}</span> : null}\n <span className=\"x-resource-card-text\">\n <span className=\"x-resource-card-title\">{title}</span>\n {status ? <span className=\"x-resource-card-status\">{status}</span> : null}\n </span>\n </>\n );\n const main = \"x-resource-card-main\";\n return (\n <div className={cx(\"x-resource-card\", className)} data-dimmed={dimmed ? \"\" : undefined} data-reveal={trailing && revealTrailing === \"hover\" ? \"hover\" : undefined}>\n {href !== undefined ? (\n renderLink ? (\n renderLink({ href, className: main, children: body })\n ) : (\n <a className={main} href={href}>\n {body}\n </a>\n )\n ) : onClick ? (\n <button type=\"button\" className={main} onClick={onClick}>\n {body}\n </button>\n ) : (\n <div className={main}>{body}</div>\n )}\n {trailing ? <span className=\"x-resource-card-trail\">{trailing}</span> : null}\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface ModelChipProps {\n /** The id a client sends, shown in a mono pill: `openai/gpt-5.5`. */\n code: string;\n /** The model's display name, under the pill. */\n name?: ReactNode;\n /** Before the pill. Default: the `bot` icon. */\n leading?: ReactNode;\n /** Right of the pill: one IconButton (size \"sm\"), usually Copy. */\n codeAction?: ReactNode;\n /** Right of the name: IconButtons (size \"sm\") such as Hide, Test, Remove. */\n actions?: ReactNode;\n /** Draws the chip fainter, for a model that is turned off. */\n dimmed?: boolean;\n className?: string;\n}\n\n/** One model in a provider's list: its id in a mono pill, its display name, and small actions beside each. */\nexport function ModelChip({ code, name, leading, codeAction, actions, dimmed = false, className }: ModelChipProps): JSX.Element {\n return (\n <div className={cx(\"x-model-chip\", className)} data-dimmed={dimmed ? \"\" : undefined}>\n <span className=\"x-model-chip-lead\">{leading ?? <Icon name=\"bot\" />}</span>\n <span className=\"x-model-chip-body\">\n <span className=\"x-model-chip-line\">\n <code className=\"x-model-chip-code\" title={code}>\n {code}\n </code>\n {codeAction}\n </span>\n {name || actions ? (\n <span className=\"x-model-chip-line\">\n {name ? <span className=\"x-model-chip-name\">{name}</span> : null}\n {actions ? <span className=\"x-model-chip-actions\">{actions}</span> : null}\n </span>\n ) : null}\n </span>\n </div>\n );\n}\n\nexport interface ModelChipAddProps {\n /** Verb label: \"Add model\". */\n label: string;\n onClick: () => void;\n className?: string;\n}\n\n/** The last chip of a model list: a dashed button that adds a model. */\nexport function ModelChipAdd({ label, onClick, className }: ModelChipAddProps): JSX.Element {\n return (\n <button type=\"button\" className={cx(\"x-model-chip x-model-chip-add\", className)} onClick={onClick}>\n <Icon name=\"plus\" />\n <span>{label}</span>\n </button>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface StepDotsLabels {\n /** Names the dots for screen readers (\"Step 2 of 3\"). */\n step: (current: number, total: number) => string;\n}\n\nconst DEFAULT_LABELS: StepDotsLabels = { step: (current, total) => `Step ${current} of ${total}` };\n\nexport interface StepDotsProps {\n /** Number of steps, at least 1. */\n total: number;\n /** 1-based; clamped to 1…total. */\n current: number;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<StepDotsLabels>;\n className?: string;\n}\n\nexport function StepDots({ total, current, labels, className }: StepDotsProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const count = Math.max(1, Math.floor(total));\n const at = Math.min(count, Math.max(1, Math.floor(current)));\n return (\n <span className={cx(\"x-step-dots\", className)} role=\"img\" aria-label={l.step(at, count)}>\n {Array.from({ length: count }, (_, i) => (\n <span key={i} className=\"x-step-dot\" data-current={i + 1 === at ? \"true\" : undefined} data-done={i + 1 < at ? \"true\" : undefined} />\n ))}\n </span>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\nimport { StepDots, type StepDotsLabels } from \"../StepDots/StepDots\";\n\nexport interface EmptyStateStep {\n /** What to do in this step (\"Open a project\"). */\n label: ReactNode;\n /** The step is finished. Shown as a check mark and read as \"Done\". */\n done?: boolean;\n}\n\nexport interface EmptyStateLabels {\n /** Text read after a finished step. */\n done: string;\n /** Names the step dots (\"Step 2 of 3\"). */\n step: StepDotsLabels[\"step\"];\n /** Names the list of steps. */\n steps: string;\n}\n\nconst DEFAULT_LABELS: EmptyStateLabels = { done: \"Done\", step: (current, total) => `Step ${current} of ${total}`, steps: \"Steps\" };\n\nexport interface EmptyStateProps {\n /** Icon in a soft tile; shown only for size \"center\". */\n icon?: IconName;\n /** A decorative picture for a whole-page status view, in place of the small icon tile (hidden from assistive tech); size \"center\" only. */\n art?: ReactNode;\n /** A large figure above the title for a whole-page status view, such as \"404\"; shown only for size \"center\". */\n figure?: ReactNode;\n /** Render the title as this heading level (1 for a whole-page status view such as 404); a paragraph by default. */\n headingLevel?: 1 | 2 | 3;\n /** What is missing, as a statement (\"No worktrees yet\"). */\n title: ReactNode;\n /** One line on how to fill it. */\n hint?: ReactNode;\n /** Numbered steps under the hint, with `StepDots` above them. For a first-run view that teaches a short path. */\n steps?: EmptyStateStep[];\n /** 1-based step the person is on. Defaults to the first step that is not done. */\n current?: number;\n /** Override the English defaults (e.g. for vi). Only used with `steps`. */\n labels?: Partial<EmptyStateLabels>;\n /** One primary action, maybe one secondary. */\n actions?: ReactNode;\n /** \"inline\" for a short muted line inside a pane; \"center\" for a whole empty view. Default \"inline\". */\n size?: \"inline\" | \"center\";\n className?: string;\n}\n\nexport function EmptyState({ icon, art, figure, headingLevel, title, hint, steps, current, labels, actions, size = \"inline\", className }: EmptyStateProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const first = steps ? steps.findIndex((s) => !s.done) : -1;\n const at = steps?.length ? Math.min(steps.length, Math.max(1, current ?? (first < 0 ? steps.length : first + 1))) : 0;\n return (\n <div className={cx(\"x-empty\", className)} data-size={size}>\n {art && size === \"center\" ? (\n <div className=\"x-empty-art\" aria-hidden=\"true\">\n {art}\n </div>\n ) : icon && size === \"center\" ? (\n <span className=\"x-empty-icon\">\n <Icon name={icon} size={20} />\n </span>\n ) : null}\n {figure && size === \"center\" ? <p className=\"x-empty-figure\">{figure}</p> : null}\n {headingLevel ? (\n (() => {\n const H = `h${headingLevel}` as \"h1\" | \"h2\" | \"h3\";\n return <H className=\"x-empty-title\">{title}</H>;\n })()\n ) : (\n <p className=\"x-empty-title\">{title}</p>\n )}\n {hint ? <p className=\"x-empty-hint\">{hint}</p> : null}\n {steps?.length ? (\n <>\n <StepDots total={steps.length} current={at} labels={{ step: l.step }} />\n <ol className=\"x-empty-steps\" aria-label={l.steps}>\n {steps.map((s, i) => (\n <li key={i} className=\"x-empty-step\" data-done={s.done ? \"\" : undefined} aria-current={i + 1 === at ? \"step\" : undefined}>\n <span className=\"x-empty-step-num\" aria-hidden=\"true\">\n {s.done ? <Icon name=\"check\" size={12} /> : i + 1}\n </span>\n <span className=\"x-empty-step-label\">{s.label}</span>\n {s.done ? <span className=\"x-sr-only\">{l.done}</span> : null}\n </li>\n ))}\n </ol>\n </>\n ) : null}\n {actions ? <div className=\"x-empty-actions\">{actions}</div> : null}\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface SettingRowProps {\n /** Setting name in sentence case (\"Restore sessions on launch\"). */\n label: ReactNode;\n /** One or two lines on what the setting does. */\n description?: ReactNode;\n /** The control at the right: a Switch, Select, Segmented or Button. */\n control?: ReactNode;\n /** Row id, so search results and deep links can scroll to it. */\n id?: string;\n /** Id of the form control. The label then becomes a <label for> and the description its hint id (`<controlId>-hint`). */\n controlId?: string;\n /** Briefly highlights the row after a jump from search. Re-mount or toggle to replay. */\n flash?: boolean;\n className?: string;\n}\n\nexport function SettingRow({ label, description, control, id, controlId, flash = false, className }: SettingRowProps): JSX.Element {\n const hintId = controlId && description ? `${controlId}-hint` : undefined;\n return (\n <div className={cx(\"settings-item\", flash && \"setting-flash\", className)} id={id}>\n <div className=\"settings-item-text\">\n {controlId ? (\n <label className=\"settings-label\" htmlFor={controlId}>\n {label}\n </label>\n ) : (\n <span className=\"settings-label\">{label}</span>\n )}\n {description ? (\n <p className=\"settings-hint\" id={hintId}>\n {description}\n </p>\n ) : null}\n </div>\n {control ? <div className=\"settings-item-control\">{control}</div> : null}\n </div>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface SkeletonLabels {\n /** Read out by screen readers while the placeholder shows; never shown. */\n loading: string;\n}\n\nconst DEFAULT_LABELS: SkeletonLabels = { loading: \"Loading…\" };\n\nexport interface SkeletonProps {\n /** \"line\" is one line of text, \"block\" a card or image, \"circle\" an avatar. Default \"line\". */\n shape?: \"line\" | \"block\" | \"circle\";\n /** Number of text lines for `shape=\"line\"`; the last one is shorter. Default 1. */\n lines?: number;\n /** Height of a block or circle, any CSS length. Default from CSS. */\n height?: string;\n /** Width, any CSS length. Default 100% (circle: same as height). */\n width?: string;\n /** Announce \"Loading…\" to screen readers. Set on one skeleton per region; the rest stay silent. */\n announce?: boolean;\n labels?: Partial<SkeletonLabels>;\n className?: string;\n}\n\nexport function Skeleton({ shape = \"line\", lines = 1, height, width, announce, labels, className }: SkeletonProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const count = shape === \"line\" ? Math.max(1, Math.floor(lines)) : 1;\n const style = height || width ? { height, width } : undefined;\n return (\n <span className={cx(\"x-skeleton\", className)} data-shape={shape} role={announce ? \"status\" : undefined}>\n {Array.from({ length: count }, (_, i) => (\n <span key={i} className=\"x-skeleton-bar\" aria-hidden=\"true\" data-last={count > 1 && i === count - 1 ? \"true\" : undefined} style={style} />\n ))}\n {announce ? <span className=\"x-sr-only\">{l.loading}</span> : null}\n </span>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface FieldMessageProps {\n /** \"error\" is announced at once (role=alert); \"warn\" and \"info\" are read through aria-describedby. Default \"error\". */\n tone?: \"error\" | \"warn\" | \"info\";\n /** Give it an id and point the field's aria-describedby at it. */\n id?: string;\n children: ReactNode;\n className?: string;\n}\n\nexport function FieldMessage({ tone = \"error\", id, children, className }: FieldMessageProps): JSX.Element {\n return (\n <p className={cx(\"x-field-msg\", tone === \"error\" && \"error-text\", className)} data-tone={tone} id={id} role={tone === \"error\" ? \"alert\" : undefined}>\n {children}\n </p>\n );\n}\n","import { useRef, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { rovingIndex } from \"../../internal/keys\";\nimport { scrollFadeRef } from \"../../internal/scroll-fade\";\n\nexport interface TabsItem {\n id: string;\n label: ReactNode;\n /** Count or short status after the label, e.g. unread checks. */\n badge?: ReactNode;\n /** \"danger\" for failures; default is the accent. */\n badgeTone?: \"accent\" | \"danger\";\n disabled?: boolean;\n}\n\nexport interface TabsProps {\n items: TabsItem[];\n /** Controlled selected id. */\n value?: string;\n /** Uncontrolled starting id; defaults to the first item. */\n defaultValue?: string;\n onChange?: (id: string) => void;\n /** \"underline\" (panel and page tabs, default) or \"pill\" (compact switch inside a card). */\n variant?: \"underline\" | \"pill\";\n /** \"md\" (default) or \"sm\": a compact row for panel tabs beside a terminal (smaller type, tighter padding). */\n size?: \"sm\" | \"md\";\n /** aria-label of the tablist. */\n label?: string;\n /** When set, tab ids are `${idPrefix}-tab-${id}` and aria-controls points at `${idPrefix}-panel-${id}`. */\n idPrefix?: string;\n className?: string;\n}\n\nexport function Tabs({ items, value, defaultValue, onChange, variant = \"underline\", size = \"md\", label, idPrefix, className }: TabsProps): JSX.Element {\n const [inner, setInner] = useState(defaultValue ?? items.find((t) => !t.disabled)?.id);\n const current = value ?? inner;\n const refs = useRef<(HTMLButtonElement | null)[]>([]);\n const select = (id: string): void => {\n setInner(id);\n onChange?.(id);\n };\n const currentIndex = Math.max(0, items.findIndex((t) => t.id === current));\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n const from = refs.current.findIndex((b) => b === e.target);\n const next = rovingIndex(e.key, from < 0 ? currentIndex : from, items.length, \"horizontal\", (i) => Boolean(items[i]?.disabled));\n if (next == null) return;\n e.preventDefault();\n refs.current[next]?.focus();\n const target = items[next];\n if (target) select(target.id);\n };\n return (\n <div className={cx(\"kit-tabs\", className)} role=\"tablist\" aria-label={label} data-variant={variant} data-size={size === \"sm\" ? \"sm\" : undefined} onKeyDown={onKeyDown} ref={scrollFadeRef}>\n {items.map((t, i) => {\n const isSel = i === currentIndex;\n return (\n <button\n key={t.id}\n ref={(el) => {\n refs.current[i] = el;\n }}\n type=\"button\"\n role=\"tab\"\n className=\"kit-tab\"\n id={idPrefix ? `${idPrefix}-tab-${t.id}` : undefined}\n aria-controls={idPrefix ? `${idPrefix}-panel-${t.id}` : undefined}\n aria-selected={isSel}\n tabIndex={isSel ? 0 : -1}\n disabled={t.disabled}\n onClick={() => select(t.id)}\n >\n {t.label}\n {t.badge != null ? (\n <span className=\"kit-tab-badge\" data-tone={t.badgeTone === \"danger\" ? \"danger\" : undefined}>\n {t.badge}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n}\n","import { useId, useState, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface DisclosureProps {\n /** Group name in the head (\"Staged\", \"Worktrees\"). */\n title: ReactNode;\n /** Number of items in the group, shown after the title. */\n count?: number;\n /** Controlled open state. Leave undefined for uncontrolled. */\n expanded?: boolean;\n /** Initial open state when uncontrolled. Default true. */\n defaultExpanded?: boolean;\n /** Called with the new state when the head is clicked. */\n onToggle?: (expanded: boolean) => void;\n /** Buttons at the right of the head (e.g. \"Stage all\"). Kept outside the toggle button. */\n actions?: ReactNode;\n children?: ReactNode;\n className?: string;\n}\n\nexport function Disclosure({\n title,\n count,\n expanded,\n defaultExpanded = true,\n onToggle,\n actions,\n children,\n className,\n}: DisclosureProps): JSX.Element {\n const [inner, setInner] = useState(defaultExpanded);\n const open = expanded ?? inner;\n const bodyId = `x-disc-${useId()}`;\n const toggle = (): void => {\n setInner(!open);\n onToggle?.(!open);\n };\n return (\n <section className={cx(\"ws-group\", className)} data-expanded={open ? \"\" : undefined}>\n <div className=\"ws-group-bar\">\n <button type=\"button\" className=\"ws-group-head\" aria-expanded={open} aria-controls={bodyId} onClick={toggle}>\n <Icon name=\"chevron\" size={14} className=\"ws-chevron\" />\n <span className=\"ws-group-title\">{title}</span>\n {count != null ? <span className=\"ws-group-count\">{count}</span> : null}\n </button>\n {actions ? <div className=\"ws-group-actions\">{actions}</div> : null}\n </div>\n <div className=\"ws-group-body\" id={bodyId} hidden={!open}>\n {children}\n </div>\n </section>\n );\n}\n","import { Fragment, type CSSProperties, type JSX, type MouseEventHandler, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Disclosure } from \"../Disclosure/Disclosure\";\nimport { Icon } from \"../Icon/Icon\";\nimport { StatusDot, type StatusTone } from \"../StatusDot/StatusDot\";\n\nexport interface NavListItem {\n id: string;\n label: ReactNode;\n /** 16px icon before the label. */\n icon?: IconName;\n /** Count after the label, e.g. settings that match a search. */\n count?: number;\n /** Renders a link instead of a button. */\n href?: string;\n /** A dot at the end for the state of what the item leads to (a provider that failed). Needs `toneLabel`. */\n tone?: StatusTone;\n /** The state in words, for screen readers and the tooltip (\"2 failing\"). */\n toneLabel?: string;\n /**\n * Sub-items: the item becomes a branch that opens and closes (a native `details`, so keyboard and `aria-expanded`\n * come from the browser). A branch holding the current item opens on render. Nest up to three levels.\n */\n children?: NavListItem[];\n}\n\n/** Props handed to `renderLink`; spread them on your router's link. */\nexport interface NavListLinkProps {\n href: string;\n className: string;\n \"aria-current\"?: \"page\";\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n children: ReactNode;\n /** The item being rendered. */\n item: NavListItem;\n}\n\nexport interface NavListLabels {\n /** aria-label of the nav when there is no title string. */\n nav: string;\n}\n\nconst DEFAULT_LABELS: NavListLabels = { nav: \"Sections\" };\n\nexport interface NavListProps {\n items: NavListItem[];\n /** Id of the current section; gets aria-current=\"page\". */\n value?: string;\n onSelect?: (id: string) => void;\n /** Heading above the items, e.g. \"Settings\". Also names the nav when it is a string. */\n title?: ReactNode;\n /** Renders `href` items through your link component (e.g. Next `Link`) for client-side navigation. Default: a plain `<a>`. */\n renderLink?: (props: NavListLinkProps) => ReactNode;\n /** With a `title`: the title becomes a `Disclosure` head that shows and hides the items. */\n collapsible?: boolean;\n /** Initial open state when `collapsible`. Default true. */\n defaultOpen?: boolean;\n /** Opening a branch closes its open siblings (one submenu at a time, as in many admin sidebars). */\n accordion?: boolean;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<NavListLabels>;\n className?: string;\n}\n\n/** True when `id` is the item or one of its descendants. */\nfunction holds(it: NavListItem, id: string | undefined): boolean {\n return id !== undefined && (it.id === id || !!it.children?.some((c) => holds(c, id)));\n}\n\nexport function NavList({ items, value, onSelect, title, renderLink, collapsible, defaultOpen = true, accordion, labels, className }: NavListProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const group = Boolean(collapsible && title);\n const render = (list: NavListItem[], depth: number, parent: string): JSX.Element[] => list.map((it) => {\n const depthStyle = depth ? ({ [\"--nav-depth\" as string]: depth } as CSSProperties) : undefined;\n if (it.children?.length) {\n return (\n <details key={it.id} className=\"settings-nav-branch\" name={accordion ? `nav-${parent}` : undefined} open={holds(it, value) || undefined}>\n <summary className=\"settings-nav-item\" style={depthStyle} data-current={holds(it, value) ? \"\" : undefined}>\n {it.icon ? <Icon name={it.icon} size={16} className=\"settings-nav-icon\" /> : null}\n <span className=\"settings-nav-label\">{it.label}</span>\n <Icon name=\"chevron\" size={14} className=\"settings-nav-chevron\" />\n </summary>\n <div className=\"settings-nav-sub\">{render(it.children, depth + 1, it.id)}</div>\n </details>\n );\n }\n const current = it.id === value ? (\"page\" as const) : undefined;\n const body = (\n <>\n {it.icon ? <Icon name={it.icon} size={16} className=\"settings-nav-icon\" /> : null}\n <span className=\"settings-nav-label\">{it.label}</span>\n {it.count != null ? <span className=\"settings-nav-count\">{it.count}</span> : null}\n {it.tone ? (\n <span className=\"settings-nav-tone\" title={it.toneLabel}>\n <StatusDot tone={it.tone} />\n {it.toneLabel ? <span className=\"x-sr-only\">{it.toneLabel}</span> : null}\n </span>\n ) : null}\n </>\n );\n if (it.href) {\n const onClick = onSelect ? () => onSelect(it.id) : undefined;\n if (renderLink) {\n return <Fragment key={it.id}>{depthStyle ? <span className=\"settings-nav-depth\" style={depthStyle}>{renderLink({ href: it.href, className: \"settings-nav-item\", \"aria-current\": current, onClick, children: body, item: it })}</span> : renderLink({ href: it.href, className: \"settings-nav-item\", \"aria-current\": current, onClick, children: body, item: it })}</Fragment>;\n }\n return (\n <a key={it.id} className=\"settings-nav-item\" href={it.href} aria-current={current} onClick={onClick} style={depthStyle}>\n {body}\n </a>\n );\n }\n return (\n <button key={it.id} type=\"button\" className=\"settings-nav-item\" aria-current={current} onClick={() => onSelect?.(it.id)} style={depthStyle}>\n {body}\n </button>\n );\n });\n const rows = render(items, 0, \"root\");\n return (\n <nav className={cx(\"settings-nav\", className)} aria-label={typeof title === \"string\" ? title : l.nav} data-collapsible={group ? \"\" : undefined}>\n {group ? (\n <Disclosure title={title} defaultExpanded={defaultOpen} className=\"settings-nav-group\">\n {rows}\n </Disclosure>\n ) : (\n <>\n {title ? <h2 className=\"settings-nav-title\">{title}</h2> : null}\n {rows}\n </>\n )}\n </nav>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Set in the mono face, for paths, branches and ids. */\n mono?: boolean;\n /** Renders the crumb as a link. */\n href?: string;\n /** Renders the crumb as a button. Ignored on the last crumb. */\n onClick?: () => void;\n}\n\nexport interface BreadcrumbLabels {\n /** aria-label of the nav landmark. */\n breadcrumb: string;\n}\n\nconst DEFAULT_LABELS: BreadcrumbLabels = { breadcrumb: \"Breadcrumb\" };\n\nexport interface BreadcrumbProps {\n /** From the root to the current place. The last item is the current one. */\n items: BreadcrumbItem[];\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<BreadcrumbLabels>;\n className?: string;\n}\n\nexport function Breadcrumb({ items, labels, className }: BreadcrumbProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <nav className={cx(\"ws-crumbs\", className)} aria-label={l.breadcrumb}>\n <ol className=\"ws-crumbs-list\">\n {items.map((it, i) => {\n const last = i === items.length - 1;\n const cls = cx(\"ws-crumb\", it.mono && \"ws-mono\");\n let node: ReactNode;\n if (last) node = <span className={cls} aria-current=\"page\">{it.label}</span>;\n else if (it.href) node = <a className={cls} href={it.href} onClick={it.onClick}>{it.label}</a>;\n else if (it.onClick) node = <button type=\"button\" className={cls} onClick={it.onClick}>{it.label}</button>;\n else node = <span className={cls}>{it.label}</span>;\n return (\n <li key={i} className=\"ws-crumb-item\">\n {node}\n {last ? null : <span className=\"ws-crumb-sep\" aria-hidden=\"true\">/</span>}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n","/** Pure keyboard logic for TreeView over a flat list of visible rows. Not exported from the package. */\n\nexport interface TreeKeyRow {\n id: string;\n depth: number;\n kind: \"file\" | \"dir\";\n open?: boolean;\n}\n\n/** What a key press asks for: move focus to a row index, toggle a dir, or open a file. */\nexport type TreeKeyResult = { focus: number } | { toggle: string } | { open: string } | null;\n\nexport function treeKey(key: string, index: number, rows: readonly TreeKeyRow[]): TreeKeyResult {\n const row = rows[index];\n if (!row) return null;\n switch (key) {\n case \"ArrowDown\":\n return index < rows.length - 1 ? { focus: index + 1 } : null;\n case \"ArrowUp\":\n return index > 0 ? { focus: index - 1 } : null;\n case \"Home\":\n return { focus: 0 };\n case \"End\":\n return { focus: rows.length - 1 };\n case \"ArrowRight\":\n if (row.kind !== \"dir\") return null;\n if (!row.open) return { toggle: row.id };\n const below = rows[index + 1];\n return below && below.depth > row.depth ? { focus: index + 1 } : null;\n case \"ArrowLeft\": {\n if (row.kind === \"dir\" && row.open) return { toggle: row.id };\n for (let i = index - 1; i >= 0; i--) if (rows[i]!.depth < row.depth) return { focus: i };\n return null;\n }\n case \"Enter\":\n case \" \":\n return row.kind === \"dir\" ? { toggle: row.id } : { open: row.id };\n default:\n return null;\n }\n}\n","import { useRef, useState, type CSSProperties, type JSX, type KeyboardEvent } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { FileIcon } from \"../FileIcon/FileIcon\";\nimport { treeKey } from \"./treeKeys\";\n\nexport type TreeMark = \"added\" | \"modified\" | \"deleted\" | \"renamed\";\n\nexport interface TreeRow {\n /** Stable id, usually the path. */\n id: string;\n /** 0 for top-level entries. */\n depth: number;\n name: string;\n kind: \"file\" | \"dir\";\n /** Dirs only: whether the children are shown. Pass only visible rows. */\n open?: boolean;\n /** Shows a dot for a dir that holds changed files. */\n changed?: boolean;\n /** Dirs only: how many files are under it. Shown after the name. */\n count?: number;\n /** Git status letter at the end of the row. */\n mark?: TreeMark;\n}\n\nexport interface TreeViewLabels {\n /** aria-label of the tree. */\n tree: string;\n /** Read out for the changed dot. */\n changed: string;\n /** Titles of the status letters. */\n marks: Record<TreeMark, string>;\n}\n\nconst DEFAULT_LABELS: TreeViewLabels = {\n tree: \"Files\",\n changed: \"Changed\",\n marks: { added: \"Added\", modified: \"Modified\", deleted: \"Deleted\", renamed: \"Renamed\" },\n};\n\nconst LETTER: Record<TreeMark, string> = { added: \"A\", modified: \"M\", deleted: \"D\", renamed: \"R\" };\n\nexport interface TreeViewProps {\n /** Visible rows in display order; children follow their dir. */\n rows: TreeRow[];\n /** Id of the selected row (e.g. the file open in the editor). */\n selected?: string;\n /** A dir was clicked or toggled with the keyboard. */\n onToggle?: (id: string) => void;\n /** A file was clicked or opened with Enter. */\n onOpen?: (id: string) => void;\n /** Override the English defaults (e.g. for vi). Partial `marks` merge too. */\n labels?: Partial<Omit<TreeViewLabels, \"marks\">> & { marks?: Partial<Record<TreeMark, string>> };\n className?: string;\n}\n\nexport function TreeView({ rows, selected, onToggle, onOpen, labels, className }: TreeViewProps): JSX.Element {\n const l: TreeViewLabels = { ...DEFAULT_LABELS, ...labels, marks: { ...DEFAULT_LABELS.marks, ...labels?.marks } };\n const [focusId, setFocusId] = useState<string | undefined>(undefined);\n const refs = useRef<(HTMLButtonElement | null)[]>([]);\n const activeId = rows.some((r) => r.id === focusId) ? focusId : rows.some((r) => r.id === selected) ? selected : rows[0]?.id;\n\n const activate = (r: TreeRow): void => {\n setFocusId(r.id);\n if (r.kind === \"dir\") onToggle?.(r.id);\n else onOpen?.(r.id);\n };\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n const index = rows.findIndex((r) => r.id === activeId);\n const res = treeKey(e.key, index, rows);\n if (!res) return;\n e.preventDefault();\n if (\"focus\" in res) {\n const target = rows[res.focus];\n if (target) setFocusId(target.id);\n refs.current[res.focus]?.focus();\n } else if (\"toggle\" in res) onToggle?.(res.toggle);\n else onOpen?.(res.open);\n };\n\n return (\n <div className={cx(\"ws-tree\", className)} role=\"tree\" aria-label={l.tree} onKeyDown={onKeyDown}>\n {rows.map((r, i) => (\n <button\n key={r.id}\n ref={(el) => {\n refs.current[i] = el;\n }}\n type=\"button\"\n role=\"treeitem\"\n className=\"ws-tree-row\"\n aria-level={r.depth + 1}\n aria-expanded={r.kind === \"dir\" ? Boolean(r.open) : undefined}\n aria-selected={r.id === selected}\n tabIndex={r.id === activeId ? 0 : -1}\n data-kind={r.kind}\n style={{ \"--tree-depth\": r.depth } as CSSProperties}\n onClick={() => activate(r)}\n >\n <FileIcon name={r.name} kind={r.kind} open={Boolean(r.open)} size={14} className=\"ws-tree-icon\" />\n <span className=\"ws-tree-name\">{r.name}</span>\n {r.count !== undefined ? <span className=\"ws-tree-count\">{r.count}</span> : null}\n {r.changed ? (\n <span className=\"ws-tree-dot\">\n <span className=\"x-sr-only\">{l.changed}</span>\n </span>\n ) : null}\n {r.mark ? (\n <span className=\"ws-tree-mark\" data-kind={r.mark} title={l.marks[r.mark]}>\n <span aria-hidden=\"true\">{LETTER[r.mark]}</span>\n <span className=\"x-sr-only\">{l.marks[r.mark]}</span>\n </span>\n ) : null}\n </button>\n ))}\n </div>\n );\n}\n","import type { TreeMark, TreeRow } from \"./TreeView\";\n\ninterface Dir {\n path: string;\n name: string;\n dirs: Map<string, Dir>;\n files: { path: string; name: string; mark?: TreeMark }[];\n changed: boolean;\n /** Files at any depth below. */\n total: number;\n}\n\nexport interface PathRowsOptions {\n /** Merge a folder that holds only one folder into it (`a/b/c`), and give each folder a file `count`. */\n compact?: boolean;\n}\n\nconst byName = (a: { name: string }, b: { name: string }): number => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0);\n\n/**\n * Visible `TreeView` rows for a flat list of file paths. Folders come first, each level sorted by name.\n * A folder id is its path with a trailing `/`; a file id is its path. `closed` holds the folder ids\n * whose children are hidden. A folder that holds a marked file gets `changed`. With `compact`, a chain of\n * folders that each hold only the next one is one row named `a/b/c` whose id is the deepest folder, and\n * every folder row has `count`, the files below it.\n */\nexport function pathRows(files: { path: string; mark?: TreeMark }[], closed: ReadonlySet<string>, options: PathRowsOptions = {}): TreeRow[] {\n const root: Dir = { path: \"\", name: \"\", dirs: new Map(), files: [], changed: false, total: 0 };\n for (const f of files) {\n const parts = f.path.split(\"/\");\n let dir = root;\n for (let i = 0; i < parts.length - 1; i++) {\n const path = `${parts.slice(0, i + 1).join(\"/\")}/`;\n let next = dir.dirs.get(path);\n if (!next) {\n next = { path, name: parts[i]!, dirs: new Map(), files: [], changed: false, total: 0 };\n dir.dirs.set(path, next);\n }\n if (f.mark) next.changed = true;\n next.total += 1;\n dir = next;\n }\n dir.files.push({ path: f.path, name: parts[parts.length - 1] ?? \"\", mark: f.mark });\n }\n const rows: TreeRow[] = [];\n const walk = (dir: Dir, depth: number): void => {\n for (const first of [...dir.dirs.values()].sort(byName)) {\n let d = first;\n const names = [d.name];\n while (options.compact && d.files.length === 0 && d.dirs.size === 1) {\n const only = [...d.dirs.values()][0];\n if (!only) break;\n d = only;\n names.push(d.name);\n }\n const open = !closed.has(d.path);\n rows.push({\n id: d.path,\n depth,\n name: names.join(\"/\"),\n kind: \"dir\",\n open,\n ...(d.changed ? { changed: true } : {}),\n ...(options.compact ? { count: d.total } : {}),\n });\n if (open) walk(d, depth + 1);\n }\n for (const f of [...dir.files].sort(byName)) rows.push({ id: f.path, depth, name: f.name, kind: \"file\", mark: f.mark });\n };\n walk(root, 0);\n return rows;\n}\n","/** Which ref a lane follows, or the index of a rotation colour (0..4). */\nexport type LaneColor = number | \"head\" | \"remote\" | \"base\";\n\nexport type RefMark = \"head\" | \"remote\" | \"base\";\n\nexport interface Lane {\n /** The commit this lane is waiting for. */\n id: string;\n color: LaneColor;\n}\n\nexport interface GraphItem {\n id: string;\n parents: string[];\n /** Marks this commit carries beyond `refs` (e.g. a synthetic row). */\n refIds?: RefMark[];\n /** A boundary row (incoming or outgoing changes): drawn as a dashed ring. */\n boundary?: boolean;\n}\n\nexport interface GraphRefs {\n head?: string;\n remote?: string;\n base?: string;\n}\n\nexport interface GraphRow {\n input: Lane[];\n output: Lane[];\n /** Index of the node in `input`, or `input.length` when the commit starts a lane. */\n lane: number;\n color: LaneColor;\n kind: \"commit\" | \"merge\" | \"head\" | \"boundary\";\n}\n\n/** Rotation colours: `x-graph-lane-1..5`. */\nexport const LANE_COLORS = 5;\n\n/**\n * The lanes of a log, one row per item in log order. The rotation counter is\n * local to the call, so the same log always gets the same colours.\n */\nexport function graphRows(items: GraphItem[], refs: GraphRefs = {}): GraphRow[] {\n let next = 0;\n const rotate = (): LaneColor => next++ % LANE_COLORS;\n const refColor = (id: string, marks: RefMark[] = []): LaneColor | undefined => {\n if (marks.includes(\"head\") || id === refs.head) return \"head\";\n if (marks.includes(\"remote\") || id === refs.remote) return \"remote\";\n if (marks.includes(\"base\") || id === refs.base) return \"base\";\n return undefined;\n };\n\n const rows: GraphRow[] = [];\n let previous: Lane[] = [];\n for (const item of items) {\n const input = previous.map((l) => ({ ...l }));\n const index = input.findIndex((l) => l.id === item.id);\n const lane = index === -1 ? input.length : index;\n const color: LaneColor = index === -1 ? (refColor(item.id, item.refIds) ?? rotate()) : input[index]!.color;\n const firstParent = item.parents[0];\n\n const output: Lane[] = [];\n let placed = false;\n for (const l of input) {\n if (l.id !== item.id) {\n output.push({ ...l });\n } else if (!placed) {\n placed = true;\n if (firstParent !== undefined) output.push({ id: firstParent, color: l.color });\n }\n }\n // A commit that starts its own lane hands its colour to its first parent.\n if (!placed && firstParent !== undefined) output.push({ id: firstParent, color });\n for (const parent of item.parents.slice(1)) {\n output.push({ id: parent, color: refColor(parent) ?? rotate() });\n }\n\n const head = item.refIds?.includes(\"head\") || item.id === refs.head;\n const kind = item.boundary ? \"boundary\" : head ? \"head\" : item.parents.length > 1 ? \"merge\" : \"commit\";\n rows.push({ input, output, lane, color, kind });\n previous = output;\n }\n return rows;\n}\n\nexport interface LaneLinks {\n /** Lanes that go past the node: input index to output index. */\n passes: { from: number; to: number; color: LaneColor }[];\n /** Input lanes that end at the node. */\n joins: { from: number; color: LaneColor }[];\n /** Output lanes that start at the node (one per parent). */\n forks: { to: number; color: LaneColor }[];\n}\n\n/** Which lane goes where in one row; what the SVG draws. */\nexport function laneLinks(row: GraphRow): LaneLinks {\n const nodeId = row.input[row.lane]?.id;\n const matched = nodeId !== undefined;\n const passCount = row.input.filter((l) => l.id !== nodeId).length;\n const forkCount = row.output.length - passCount;\n const passes: LaneLinks[\"passes\"] = [];\n const joins: LaneLinks[\"joins\"] = [];\n const forks: LaneLinks[\"forks\"] = [];\n let out = 0;\n let spot = -1;\n row.input.forEach((l, from) => {\n if (l.id !== nodeId) {\n passes.push({ from, to: out++, color: l.color });\n return;\n }\n joins.push({ from, color: l.color });\n if (spot === -1) {\n spot = out;\n if (forkCount > 0) out++;\n }\n });\n const first = matched && forkCount > 0 ? 1 : 0;\n const spotLane = row.output[spot];\n if (first && spotLane) forks.push({ to: spot, color: spotLane.color });\n for (let to = passCount + first; to < row.output.length; to++) {\n forks.push({ to, color: row.output[to]!.color });\n }\n return { passes, joins, forks };\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { laneLinks, type GraphRow, type LaneColor } from \"./graphLanes\";\n\n/** Height of one row. */\nexport const GRAPH_ROW_HEIGHT = 24;\n/** Width of one lane. */\nexport const GRAPH_LANE_WIDTH = 11;\nconst RADIUS = 5;\nconst NODE_Y = GRAPH_ROW_HEIGHT / 2;\n\nexport interface CommitGraphProps {\n row: GraphRow;\n className?: string;\n}\n\n/** Width in px of a row whose lanes number `input` above and `output` below the node. */\nexport function graphWidth(input: number, output: number): number {\n return GRAPH_LANE_WIDTH * (Math.max(input, output, 1) + 1);\n}\n\nexport function laneVar(color: LaneColor): string {\n if (typeof color === \"number\") return `var(--x-graph-lane-${(color % 5) + 1})`;\n return `var(--x-graph-${color})`;\n}\n\nconst x = (lane: number): number => GRAPH_LANE_WIDTH * (lane + 1);\n\n/** Quarter-circle elbow from a vertical lane at `from` into a horizontal run at the node. */\nfunction toNode(from: number, node: number): string {\n const dir = Math.sign(node - from);\n return `M ${from} 0 V ${NODE_Y - RADIUS} Q ${from} ${NODE_Y} ${from + dir * RADIUS} ${NODE_Y} H ${node}`;\n}\n\nfunction fromNode(node: number, to: number): string {\n const dir = Math.sign(to - node);\n return `M ${node} ${NODE_Y} H ${to - dir * RADIUS} Q ${to} ${NODE_Y} ${to} ${NODE_Y + RADIUS} V ${GRAPH_ROW_HEIGHT}`;\n}\n\nfunction shift(from: number, to: number): string {\n const dir = Math.sign(to - from);\n return (\n `M ${from} 0 V ${NODE_Y - RADIUS} Q ${from} ${NODE_Y} ${from + dir * RADIUS} ${NODE_Y} ` +\n `H ${to - dir * RADIUS} Q ${to} ${NODE_Y} ${to} ${NODE_Y + RADIUS} V ${GRAPH_ROW_HEIGHT}`\n );\n}\n\n/** One row of the commit graph: the lanes passing through and the commit node. */\nexport function CommitGraph({ row, className }: CommitGraphProps): JSX.Element {\n const links = laneLinks(row);\n const width = graphWidth(row.input.length, row.output.length);\n const nx = x(row.lane);\n const stroke = { fill: \"none\", strokeWidth: 1, strokeLinecap: \"round\" as const };\n const color = laneVar(row.color);\n return (\n <svg\n className={cx(\"x-commit-graph\", className)}\n width={width}\n height={GRAPH_ROW_HEIGHT}\n viewBox={`0 0 ${width} ${GRAPH_ROW_HEIGHT}`}\n data-kind={row.kind}\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {links.passes.map((p) => (\n <path\n key={`p${p.from}`}\n d={p.from === p.to ? `M ${x(p.from)} 0 V ${GRAPH_ROW_HEIGHT}` : shift(x(p.from), x(p.to))}\n stroke={laneVar(p.color)}\n {...stroke}\n />\n ))}\n {links.joins.map((j) => (\n <path\n key={`j${j.from}`}\n d={j.from === row.lane ? `M ${nx} 0 V ${NODE_Y}` : toNode(x(j.from), nx)}\n stroke={laneVar(j.color)}\n {...stroke}\n />\n ))}\n {links.forks.map((f) => (\n <path\n key={`f${f.to}`}\n d={f.to === row.lane ? `M ${nx} ${NODE_Y} V ${GRAPH_ROW_HEIGHT}` : fromNode(nx, x(f.to))}\n stroke={laneVar(f.color)}\n {...stroke}\n />\n ))}\n {row.kind === \"head\" ? (\n <circle cx={nx} cy={NODE_Y} r={6.5} fill={color} stroke=\"var(--bg-1)\" strokeWidth={1.5} />\n ) : row.kind === \"merge\" ? (\n <>\n <circle cx={nx} cy={NODE_Y} r={4.5} fill={color} />\n <circle cx={nx} cy={NODE_Y} r={2} fill=\"var(--bg-1)\" />\n </>\n ) : row.kind === \"boundary\" ? (\n <circle cx={nx} cy={NODE_Y} r={3.5} fill=\"var(--bg-1)\" stroke={color} strokeWidth={1} strokeDasharray=\"4 2\" />\n ) : (\n <circle cx={nx} cy={NODE_Y} r={3.5} fill={color} />\n )}\n </svg>\n );\n}\n","import { useRef, type JSX, type KeyboardEvent, type PointerEvent } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { clamp, resizeKey } from \"../../internal/keys\";\n\nexport interface SplitHandleLabels {\n /** aria-label of the separator. */\n resize: string;\n}\n\nconst DEFAULT_LABELS: SplitHandleLabels = { resize: \"Resize panel\" };\n\nexport interface SplitHandleProps {\n /** \"horizontal\" resizes a width (a vertical bar, Left/Right keys); \"vertical\" resizes a height (Up/Down). */\n direction: \"horizontal\" | \"vertical\";\n /** Current size in px of the panel this handle resizes. */\n value: number;\n min: number;\n max: number;\n /** Called with the new clamped size while dragging and on key presses. */\n onResize: (value: number) => void;\n /** px per arrow key press. Shift multiplies by 4. Default 10. */\n step?: number;\n /** Set when the panel is on the right or bottom of the handle, so moving toward it shrinks it. */\n reverse?: boolean;\n /** Names the panel (\"Resize file tree\"). Overrides `labels.resize`. */\n label?: string;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<SplitHandleLabels>;\n className?: string;\n}\n\nexport function SplitHandle({\n direction,\n value,\n min,\n max,\n onResize,\n step = 10,\n reverse = false,\n label,\n labels,\n className,\n}: SplitHandleProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const axis = direction === \"horizontal\" ? \"x\" : \"y\";\n const drag = useRef<{ start: number; from: number } | null>(null);\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n const next = resizeKey(e.key, value, { min, max, step, big: e.shiftKey, axis, reverse });\n if (next == null) return;\n e.preventDefault();\n onResize(next);\n };\n const pos = (e: PointerEvent<HTMLDivElement>): number => (axis === \"x\" ? e.clientX : e.clientY);\n const onPointerDown = (e: PointerEvent<HTMLDivElement>): void => {\n drag.current = { start: pos(e), from: value };\n e.currentTarget.setPointerCapture?.(e.pointerId);\n };\n const onPointerMove = (e: PointerEvent<HTMLDivElement>): void => {\n if (!drag.current) return;\n const delta = pos(e) - drag.current.start;\n onResize(clamp(drag.current.from + (reverse ? -delta : delta), min, max));\n };\n const onPointerUp = (e: PointerEvent<HTMLDivElement>): void => {\n drag.current = null;\n e.currentTarget.releasePointerCapture?.(e.pointerId);\n };\n\n return (\n <div\n className={cx(\"ws-handle\", \"x-split-handle\", className)}\n role=\"separator\"\n aria-orientation={direction === \"horizontal\" ? \"vertical\" : \"horizontal\"}\n aria-valuenow={Math.round(value)}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-label={label ?? l.resize}\n tabIndex={0}\n data-direction={direction}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n />\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { rovingFocus, rovingKeyDown, rovingRef } from \"../../internal/roving\";\n\nexport interface ToolbarLabels {\n /** aria-label of the actions group when there is no string title or `label`. */\n actions: string;\n}\n\nconst DEFAULT_LABELS: ToolbarLabels = { actions: \"Actions\" };\n\nexport interface ToolbarProps {\n /** Pane name (\"Changes\") or, for \"bulk\", the selection summary (\"3 selected\"). */\n title?: ReactNode;\n /** Number shown after the title. */\n count?: number;\n /** IconButtons or Buttons, grouped as role=toolbar. One Tab stop: arrow keys, Home and End move focus between them. */\n actions?: ReactNode;\n /** \"head\" is the small uppercase pane head; \"bulk\" is the tinted bar shown while rows are selected. Default \"head\". */\n variant?: \"head\" | \"bulk\";\n /** aria-label of the actions group. Defaults to a string `title`, then `labels.actions`. */\n label?: string;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<ToolbarLabels>;\n className?: string;\n}\n\nexport function Toolbar({ title, count, actions, variant = \"head\", label, labels, className }: ToolbarProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const name = label ?? (typeof title === \"string\" ? title : l.actions);\n return (\n <div className={cx(\"pane-head\", variant === \"bulk\" && \"ws-bulk-bar\", className)} data-variant={variant}>\n <span className=\"pane-title\">\n {title}\n {count != null ? <span className=\"pane-count\">{count}</span> : null}\n </span>\n {actions ? (\n <div className=\"pane-tools\" role=\"toolbar\" aria-label={name} ref={rovingRef} onFocus={rovingFocus} onKeyDown={rovingKeyDown}>\n {actions}\n </div>\n ) : null}\n </div>\n );\n}\n","import { cloneElement, useEffect, useId, useState, type JSX, type ReactElement, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface TooltipProps {\n /** Short text that describes the child. Plain text only; no links or buttons. */\n content: ReactNode;\n /** One focusable element (a button or link). It gets aria-describedby pointing at the tip. */\n children: ReactElement<{ \"aria-describedby\"?: string }>;\n /** Side of the child the tip appears on. Default \"top\". */\n placement?: \"top\" | \"bottom\";\n className?: string;\n}\n\nexport function Tooltip({ content, children, placement = \"top\", className }: TooltipProps): JSX.Element {\n const tipId = `x-tip-${useId()}`;\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent): void => {\n if (e.key === \"Escape\") setOpen(false);\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [open]);\n\n const describedBy = cx(children.props[\"aria-describedby\"], tipId);\n return (\n <span\n className=\"x-tooltip-anchor\"\n onMouseEnter={() => setOpen(true)}\n onMouseLeave={() => setOpen(false)}\n onFocus={() => setOpen(true)}\n onBlur={() => setOpen(false)}\n >\n {cloneElement(children, { \"aria-describedby\": describedBy })}\n <span className={cx(\"x-tooltip\", className)} role=\"tooltip\" id={tipId} data-placement={placement} data-open={open ? \"\" : undefined}>\n {content}\n </span>\n </span>\n );\n}\n","/** Side of the anchor the card sits on. \"start\" is the left and \"end\" the right (left-to-right layouts). */\nexport type CoachmarkPlacement = \"top\" | \"bottom\" | \"start\" | \"end\";\n\n/** The parts of a DOMRect the placement reads. */\nexport interface RectLike {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface CoachmarkSize {\n width: number;\n height: number;\n}\n\nexport interface CoachmarkPosition {\n top: number;\n left: number;\n /** The side actually used: the preferred one, or the opposite one when only that fits. */\n placement: CoachmarkPlacement;\n /** Offset of the arrow along the card edge that faces the anchor, in px. */\n arrow: number;\n}\n\n/** Space kept between the card and the viewport edge (--x-space-2). */\nexport const COACHMARK_MARGIN = 8;\n/** Space between the anchor and the card, room for the arrow (--x-space-3). */\nexport const COACHMARK_GAP = 12;\n/** The arrow stays this far from the card corners. */\nconst ARROW_INSET = 16;\n\nconst OPPOSITE: Record<CoachmarkPlacement, CoachmarkPlacement> = { top: \"bottom\", bottom: \"top\", start: \"end\", end: \"start\" };\n\nfunction clamp(value: number, lo: number, hi: number): number {\n return hi < lo ? lo : Math.min(Math.max(value, lo), hi);\n}\n\nfunction at(anchor: RectLike, size: CoachmarkSize, side: CoachmarkPlacement): { top: number; left: number } {\n const midX = anchor.left + anchor.width / 2;\n const midY = anchor.top + anchor.height / 2;\n switch (side) {\n case \"bottom\":\n return { top: anchor.top + anchor.height + COACHMARK_GAP, left: midX - size.width / 2 };\n case \"top\":\n return { top: anchor.top - COACHMARK_GAP - size.height, left: midX - size.width / 2 };\n case \"end\":\n return { top: midY - size.height / 2, left: anchor.left + anchor.width + COACHMARK_GAP };\n case \"start\":\n return { top: midY - size.height / 2, left: anchor.left - COACHMARK_GAP - size.width };\n }\n}\n\n/**\n * Where a card of `size` goes next to `anchor` inside `viewport`: the preferred side when it fits,\n * else the opposite side when that fits, else the preferred side. The result is clamped into the\n * viewport with COACHMARK_MARGIN. Null when there is no anchor or it has no size (hidden).\n */\nexport function placeCoachmark(anchor: RectLike | null | undefined, size: CoachmarkSize, viewport: CoachmarkSize, placement: CoachmarkPlacement = \"bottom\"): CoachmarkPosition | null {\n if (!anchor || (anchor.width <= 0 && anchor.height <= 0)) return null;\n const vertical = placement === \"top\" || placement === \"bottom\";\n const m = COACHMARK_MARGIN;\n // Only the axis that points away from the anchor decides the side; the other one is clamped.\n const fits = (p: { top: number; left: number }): boolean =>\n vertical ? p.top >= m && p.top + size.height <= viewport.height - m : p.left >= m && p.left + size.width <= viewport.width - m;\n let side = placement;\n let pos = at(anchor, size, side);\n if (!fits(pos)) {\n const flipped = at(anchor, size, OPPOSITE[side]);\n if (fits(flipped)) {\n side = OPPOSITE[side];\n pos = flipped;\n }\n }\n const top = clamp(pos.top, m, viewport.height - m - size.height);\n const left = clamp(pos.left, m, viewport.width - m - size.width);\n const arrow = vertical\n ? clamp(anchor.left + anchor.width / 2 - left, ARROW_INSET, size.width - ARROW_INSET)\n : clamp(anchor.top + anchor.height / 2 - top, ARROW_INSET, size.height - ARROW_INSET);\n return { top, left, placement: side, arrow };\n}\n","import { useEffect, useId, useLayoutEffect, useRef, useState, type CSSProperties, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { restoreFocus } from \"../../internal/focus\";\nimport { Button } from \"../Button/Button\";\nimport { StepDots } from \"../StepDots/StepDots\";\nimport { placeCoachmark, type CoachmarkPlacement, type RectLike, type CoachmarkSize } from \"./placeCoachmark\";\n\nexport interface CoachmarkLabels {\n back: string;\n next: string;\n done: string;\n skip: string;\n /** Names the step dots (\"Step 2 of 3\"). */\n step: (current: number, total: number) => string;\n}\n\nconst DEFAULT_LABELS: CoachmarkLabels = { back: \"Back\", next: \"Next\", done: \"Done\", skip: \"Skip tour\", step: (current, total) => `Step ${current} of ${total}` };\n\n/** Used until the card has measured itself. */\nconst ESTIMATE: CoachmarkSize = { width: 320, height: 160 };\n\nexport interface CoachmarkProps {\n /** Viewport rect of the part the card points at (getBoundingClientRect). Null renders nothing. */\n anchor: RectLike | null;\n /** Preferred side; flips to the opposite one when there is no room. Default \"bottom\". */\n placement?: CoachmarkPlacement;\n title: ReactNode;\n children?: ReactNode;\n /** 1-based. */\n step: number;\n total: number;\n /** Shown from step 2 on. */\n onBack?: () => void;\n /** Also the last step's Done. */\n onNext: () => void;\n /** Skip tour, and Esc. */\n onSkip: () => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<CoachmarkLabels>;\n className?: string;\n}\n\nfunction viewportSize(): CoachmarkSize {\n return typeof window === \"undefined\" ? { width: 1280, height: 800 } : { width: window.innerWidth, height: window.innerHeight };\n}\n\nexport function Coachmark({ anchor, placement = \"bottom\", title, children, step, total, onBack, onNext, onSkip, labels, className }: CoachmarkProps): JSX.Element | null {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const ref = useRef<HTMLDivElement | null>(null);\n const [size, setSize] = useState<CoachmarkSize>(ESTIMATE);\n const [viewport, setViewport] = useState<CoachmarkSize>(viewportSize);\n const skip = useRef(onSkip);\n skip.current = onSkip;\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const next = { width: el.offsetWidth, height: el.offsetHeight };\n if (next.width !== size.width || next.height !== size.height) setSize(next);\n });\n useEffect(() => {\n const onResize = (): void => setViewport(viewportSize());\n const onKey = (e: KeyboardEvent): void => {\n if (e.key === \"Escape\") skip.current();\n };\n window.addEventListener(\"resize\", onResize);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n window.removeEventListener(\"resize\", onResize);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, []);\n useEffect(() => {\n const trigger = document.activeElement as HTMLElement | null;\n return () => restoreFocus(trigger);\n }, []);\n // Back disappears at step 1, so focus Next on every step, not only on mount.\n useEffect(() => {\n ref.current?.querySelector<HTMLElement>(\".x-coachmark-next\")?.focus();\n }, [step]);\n\n const pos = placeCoachmark(anchor, size, viewport, placement);\n if (!pos) return null;\n const last = step >= total;\n const style = { top: pos.top, left: pos.left, \"--coachmark-arrow\": `${pos.arrow}px` } as CSSProperties;\n return (\n <div className={cx(\"x-coachmark\", className)} ref={ref} role=\"dialog\" aria-labelledby={`${id}-t`} aria-describedby={children ? `${id}-b` : undefined} data-placement={pos.placement} style={style}>\n <span className=\"x-coachmark-arrow\" aria-hidden=\"true\" />\n <h2 className=\"x-coachmark-title\" id={`${id}-t`}>\n {title}\n </h2>\n {children ? (\n <div className=\"x-coachmark-body\" id={`${id}-b`}>\n {children}\n </div>\n ) : null}\n <div className=\"x-coachmark-foot\">\n <StepDots total={total} current={step} labels={{ step: l.step }} />\n <div className=\"x-coachmark-actions\">\n <Button variant=\"secondary\" onClick={onSkip}>\n {l.skip}\n </Button>\n {step > 1 && onBack ? (\n <Button variant=\"secondary\" onClick={onBack}>\n {l.back}\n </Button>\n ) : null}\n <Button variant=\"primary\" className=\"x-coachmark-next\" onClick={onNext}>\n {last ? l.done : l.next}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n","import type { JSX, KeyboardEvent } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Select } from \"../Select/Select\";\n\nexport interface ComposerLabels {\n /** aria-label of the text box. */\n input: string;\n send: string;\n attach: string;\n /** aria-label of the model select. */\n model: string;\n}\n\nconst DEFAULT_LABELS: ComposerLabels = {\n input: \"Message\",\n send: \"Send\",\n attach: \"Attach a file\",\n model: \"Model\",\n};\n\nexport interface ComposerProps {\n value: string;\n onChange: (value: string) => void;\n /** Called with Enter or the Send button. Not called while `value` is blank or `disabled`. */\n onSend: () => void;\n /** The model select; omitted when not given. */\n model?: { value: string; options: { value: string; label: string }[] };\n onModel?: (value: string) => void;\n /** Adds the attach button when given. */\n onAttach?: () => void;\n disabled?: boolean;\n placeholder?: string;\n labels?: Partial<ComposerLabels>;\n className?: string;\n}\n\nexport function Composer({ value, onChange, onSend, model, onModel, onAttach, disabled, placeholder, labels, className }: ComposerProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const blank = value.trim() === \"\";\n const send = (): void => {\n if (!disabled && !blank) onSend();\n };\n const onKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>): void => {\n // Enter sends; Shift+Enter keeps the newline; Enter during IME composition is left to the IME.\n if (e.key !== \"Enter\" || e.shiftKey || e.nativeEvent.isComposing) return;\n e.preventDefault();\n send();\n };\n return (\n <div className={cx(\"x-composer\", className)} data-disabled={disabled ? \"\" : undefined}>\n <textarea\n className=\"kit-textarea x-composer-input\"\n data-resize=\"none\"\n rows={2}\n value={value}\n placeholder={placeholder}\n disabled={disabled}\n aria-label={l.input}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={onKeyDown}\n />\n <div className=\"x-composer-bar\">\n {onAttach ? <IconButton icon=\"upload\" label={l.attach} size=\"sm\" disabled={disabled} onClick={onAttach} /> : null}\n {model ? (\n <Select\n className=\"x-composer-model\"\n aria-label={l.model}\n value={model.value}\n options={model.options}\n disabled={disabled}\n onChange={(e) => onModel?.(e.target.value)}\n />\n ) : null}\n <Button variant=\"primary\" size=\"sm\" type=\"button\" icon=\"send\" className=\"x-composer-send\" disabled={disabled || blank} onClick={send}>\n {l.send}\n </Button>\n </div>\n </div>\n );\n}\n","import { useEffect, useId, useRef, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { focusFirst, focusableIn, isShown, restoreFocus, trapTarget } from \"../../internal/focus\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { splitUrgent, toastRegions } from \"../Toast/toast-region\";\n\nexport interface AppShellLabels {\n openNav: string;\n closeNav: string;\n skipToContent: string;\n /** aria-label of the sidebar. */\n nav: string;\n /** Name of the top-bar button that folds the sidebar into a rail of icons. */\n collapseNav: string;\n /** Name of the same button while the sidebar is a rail. */\n expandNav: string;\n}\n\nconst DEFAULT_LABELS: AppShellLabels = { openNav: \"Open navigation\", closeNav: \"Close navigation\", skipToContent: \"Skip to content\", nav: \"Navigation\", collapseNav: \"Collapse sidebar\", expandNav: \"Expand sidebar\" };\n\nexport interface AppShellProps {\n /** Top of the sidebar: BrandMark + product name. */\n brand?: ReactNode;\n /** Sidebar content: one or more NavList. */\n nav: ReactNode;\n /** Bottom of the sidebar: account, version. */\n navFooter?: ReactNode;\n /** Page title at the start of the top bar, usually a `ShellTitle`; the bar grows to fit a description. */\n title?: ReactNode;\n /** Start of the top bar, usually a Breadcrumb. */\n crumbs?: ReactNode;\n /** Width below which the sidebar is a drawer: \"md\" (768px, default) or \"lg\" (1024px). */\n drawerBelow?: \"md\" | \"lg\";\n /** End of the top bar: search, notifications Popover, account Menu. */\n actions?: ReactNode;\n /** Phone tab bar, usually a `BottomNav`. Shown under `main` below 768px only; the sidebar covers wider screens. */\n bottomNav?: ReactNode;\n children: ReactNode;\n /** Toast elements, stacked bottom-right in a fixed .ws-toasts region. Its live regions are always mounted: a `Toast` with `tone=\"danger\"` is announced assertively, the rest politely. */\n toasts?: ReactNode;\n /** Drawer state below 768px; controlled. */\n navOpen?: boolean;\n onNavOpenChange?: (open: boolean) => void;\n /**\n * Wide screens: the sidebar as a rail of icons (labels move to titles and stay readable by screen readers).\n * Controlled; with `onNavCollapsedChange` the top bar gets a button that folds and unfolds it. Below the drawer\n * width the sidebar is a drawer as usual and this has no effect.\n */\n navCollapsed?: boolean;\n onNavCollapsedChange?: (collapsed: boolean) => void;\n /** Hides the sidebar and the top bar so the page fills the window (a \"focus\" or maximized view); Esc is the app's to bind. */\n chromeHidden?: boolean;\n /**\n * Wide screens: no sidebar, the brand moves into the top bar (a \"top navigation\" layout; put the menu in `crumbs`).\n * Below the drawer width the sidebar is the drawer as usual, so phones keep the whole menu.\n */\n navHidden?: boolean;\n /** Draws the sidebar in this theme whatever the page's theme (a dark sidebar on a light page). */\n sideTheme?: \"dark\" | \"light\";\n /** id of <main>, target of the skip link. Default \"main\". */\n mainId?: string;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<AppShellLabels>;\n className?: string;\n}\n\nexport function AppShell({ brand, nav, navFooter, title, crumbs, drawerBelow = \"md\", actions, bottomNav, children, toasts, navOpen = false, onNavOpenChange, navCollapsed = false, onNavCollapsedChange, chromeHidden = false, navHidden = false, sideTheme, mainId = \"main\", labels, className }: AppShellProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const sideId = `x-shell-side-${useId()}`;\n const menuRef = useRef<HTMLButtonElement | null>(null);\n const sideRef = useRef<HTMLElement | null>(null);\n const backdropRef = useRef<HTMLButtonElement | null>(null);\n const colRef = useRef<HTMLDivElement | null>(null);\n const close = useRef(onNavOpenChange);\n close.current = onNavOpenChange;\n useEffect(() => {\n // The drawer only exists below 768px, where the menu button is shown.\n if (!navOpen || !isShown(menuRef.current)) return;\n const menu = menuRef.current;\n const col = colRef.current as (HTMLDivElement & { inert: boolean }) | null;\n if (col) col.inert = true;\n focusFirst(sideRef.current);\n const onKey = (e: globalThis.KeyboardEvent): void => {\n if (e.key === \"Escape\") {\n close.current?.(false);\n } else if (e.key === \"Tab\") {\n const items = [backdropRef.current, ...focusableIn(sideRef.current)].filter((x): x is HTMLElement => x != null);\n const target = trapTarget(items, document.activeElement, e.shiftKey);\n if (target) {\n e.preventDefault();\n target.focus();\n }\n }\n };\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"keydown\", onKey);\n if (col) col.inert = false;\n restoreFocus(menu);\n };\n }, [navOpen]);\n // In a rail only icons show; each item's label (still read by screen readers) becomes its hover title.\n useEffect(() => {\n const side = sideRef.current;\n if (!side) return;\n for (const item of side.querySelectorAll<HTMLElement>(\".settings-nav-item\")) {\n const label = item.querySelector(\".settings-nav-label\")?.textContent?.trim();\n if (navCollapsed && label) item.setAttribute(\"title\", label);\n else if (item.getAttribute(\"title\") === label) item.removeAttribute(\"title\");\n }\n });\n return (\n <div className={cx(\"x-shell x-ws\", className)} data-nav-open={navOpen ? \"true\" : undefined} data-bottom-nav={bottomNav ? \"\" : undefined} data-titled={title ? \"\" : undefined} data-drawer={drawerBelow === \"lg\" ? \"lg\" : undefined} data-nav-collapsed={navCollapsed ? \"\" : undefined} data-chrome-hidden={chromeHidden ? \"\" : undefined} data-nav-hidden={navHidden ? \"\" : undefined}>\n <a\n className=\"x-skip-link\"\n href={`#${mainId}`}\n onClick={(e) => {\n // Focus the region without touching location.hash, which hash-routed apps own.\n e.preventDefault();\n document.getElementById(mainId)?.focus();\n }}\n >\n {l.skipToContent}\n </a>\n {navOpen ? <button type=\"button\" ref={backdropRef} className=\"x-shell-backdrop\" aria-label={l.closeNav} onClick={() => onNavOpenChange?.(false)} /> : null}\n <aside className=\"x-shell-side\" id={sideId} ref={sideRef} aria-label={l.nav} data-theme={sideTheme}>\n {brand ? <div className=\"x-shell-brand\">{brand}</div> : null}\n <div className=\"x-shell-nav\">\n {nav}\n </div>\n {navFooter ? <div className=\"x-shell-side-foot\">{navFooter}</div> : null}\n </aside>\n <div className=\"x-shell-col\" ref={colRef}>\n <header className=\"x-shell-top\">\n <IconButton\n icon=\"menu\"\n label={navOpen ? l.closeNav : l.openNav}\n className=\"x-shell-menu\"\n ref={menuRef}\n aria-controls={sideId}\n aria-expanded={navOpen}\n onClick={() => onNavOpenChange?.(!navOpen)}\n />\n {navHidden && brand ? <div className=\"x-shell-top-brand\">{brand}</div> : null}\n {onNavCollapsedChange && !navHidden ? (\n <IconButton\n icon=\"sidebar\"\n label={navCollapsed ? l.expandNav : l.collapseNav}\n className=\"x-shell-collapse\"\n aria-controls={sideId}\n aria-expanded={!navCollapsed}\n onClick={() => onNavCollapsedChange(!navCollapsed)}\n />\n ) : null}\n {title ? <div className=\"x-shell-heading\">{title}</div> : null}\n <div className=\"x-shell-crumbs\">{crumbs}</div>\n <div className=\"x-shell-actions\">{actions}</div>\n </header>\n <main className=\"x-shell-main\" id={mainId} tabIndex={-1}>\n {children}\n </main>\n {bottomNav ? <div className=\"x-shell-bottom\">{bottomNav}</div> : null}\n </div>\n <div className=\"x-shell-toasts ws-toasts\">\n {toastRegions(splitUrgent(toasts))}\n </div>\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface ShellTitleLabels {\n /** aria-label of the trail when there is a `parent`. Default: \"<parent> / <title>\" when both are strings. */\n trail: string;\n}\n\nexport interface ShellTitleProps {\n /** The page's h1. */\n title: ReactNode;\n /** One sentence under the title; shown from 1024px up. */\n description?: ReactNode;\n /** The page's icon, the same one as in the sidebar. */\n icon?: IconName;\n /** A logo or `Emblem` in place of the icon, e.g. on a detail page. */\n media?: ReactNode;\n /** The list this page belongs to, linked before the title: Providers › OpenAI. */\n parent?: { label: ReactNode; href: string };\n labels?: Partial<ShellTitleLabels>;\n className?: string;\n}\n\n/** The page title in the `AppShell` top bar (its `title` slot): icon, h1 and a one-line description. */\nexport function ShellTitle({ title, description, icon, media, parent, labels, className }: ShellTitleProps): JSX.Element {\n const mark = media ?? (icon ? <Icon name={icon} size={24} /> : null);\n const heading = (\n <div className=\"x-shell-title-body\">\n <div className=\"x-shell-title-row\">\n {mark ? (\n <span className=\"x-shell-title-icon\" aria-hidden=\"true\">\n {mark}\n </span>\n ) : null}\n <h1 className=\"x-shell-title-text\">{title}</h1>\n </div>\n {description ? <p className=\"x-shell-title-desc\">{description}</p> : null}\n </div>\n );\n if (!parent) return <div className={cx(\"x-shell-title\", className)}>{heading}</div>;\n const trail = labels?.trail ?? (typeof parent.label === \"string\" && typeof title === \"string\" ? `${parent.label} / ${title}` : undefined);\n return (\n <nav aria-label={trail} className={cx(\"x-shell-title\", className)}>\n <a className=\"x-shell-title-parent\" href={parent.href}>\n {parent.label}\n </a>\n <Icon name=\"chevron-right\" size={16} className=\"x-shell-title-sep\" />\n {heading}\n </nav>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface PageHeaderProps {\n /** The page's h1. */\n title: ReactNode;\n description?: ReactNode;\n /** Facts beside the title: Tag, StatusDot with label. */\n meta?: ReactNode;\n /** Page actions, primary last; wraps under the title below 480px. */\n actions?: ReactNode;\n /** When the shell top bar does not carry the Breadcrumb. */\n breadcrumb?: ReactNode;\n className?: string;\n}\n\nexport function PageHeader({ title, description, meta, actions, breadcrumb, className }: PageHeaderProps): JSX.Element {\n return (\n <header className={cx(\"x-page-header\", className)}>\n {breadcrumb ? <div className=\"x-page-crumb\">{breadcrumb}</div> : null}\n <div className=\"x-page-row\">\n <div className=\"x-page-heading\">\n <div className=\"x-page-titleline\">\n <h1 className=\"x-page-title\">{title}</h1>\n {meta ? <div className=\"x-page-meta\">{meta}</div> : null}\n </div>\n {description ? <p className=\"x-page-desc\">{description}</p> : null}\n </div>\n {actions ? <div className=\"x-page-actions\">{actions}</div> : null}\n </div>\n </header>\n );\n}\n","import { useId, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface FormSectionProps {\n /** Section heading (h2). */\n title?: ReactNode;\n description?: ReactNode;\n /** 2 = two columns when the section is wider than 480px; always one below. Default 1. */\n columns?: 1 | 2;\n /** Save / Cancel, end-aligned, primary last. */\n actions?: ReactNode;\n /**\n * Read-only view (a role that may see but not change): the fields render inside a native `<fieldset disabled>`, so\n * every input, select, checkbox and button in them is disabled at once and leaves the tab order. Say why in a\n * `Banner` above. `actions` are left out.\n */\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\nexport function FormSection({ title, description, columns = 1, actions, disabled, children, className }: FormSectionProps): JSX.Element {\n const titleId = `x-form-section-${useId()}`;\n return (\n <section className={cx(\"x-form-section\", className)} data-disabled={disabled ? \"\" : undefined} aria-labelledby={title ? titleId : undefined}>\n {title || description ? (\n <div className=\"x-form-section-head\">\n {title ? (\n <h2 className=\"x-form-section-title\" id={titleId}>\n {title}\n </h2>\n ) : null}\n {description ? <p className=\"x-form-section-desc\">{description}</p> : null}\n </div>\n ) : null}\n {disabled ? (\n <fieldset className=\"x-form-section-fields\" data-columns={columns} disabled>\n {children}\n </fieldset>\n ) : (\n <div className=\"x-form-section-fields\" data-columns={columns}>\n {children}\n </div>\n )}\n {actions && !disabled ? <div className=\"x-form-section-actions\">{actions}</div> : null}\n </section>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface BoardProps {\n /** `BoardColumn`s, left to right. */\n children: ReactNode;\n /** Names the board (\"Tasks\"). */\n \"aria-label\": string;\n className?: string;\n}\n\nexport function Board({ children, \"aria-label\": ariaLabel, className }: BoardProps): JSX.Element {\n return (\n <div className={cx(\"x-board\", className)} role=\"group\" aria-label={ariaLabel}>\n {children}\n </div>\n );\n}\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Badge } from \"../Badge/Badge\";\nimport { IconButton } from \"../IconButton/IconButton\";\n\nexport interface BoardColumnLabels {\n /** Name of the add button, e.g. \"Add card\". */\n add: string;\n}\n\nconst DEFAULT_LABELS: BoardColumnLabels = { add: \"Add card\" };\n\nexport interface BoardColumnProps extends Omit<HTMLAttributes<HTMLElement>, \"title\" | \"children\"> {\n /** Column name (\"In progress\"). */\n title: string;\n /** Number of cards, shown as a Badge after the title. */\n count?: number;\n /** Shows a plus IconButton in the head that calls it. Keep it for a column that takes new cards. */\n onAdd?: () => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<BoardColumnLabels>;\n /** At most one primary Button or IconButtons at the right of the head. */\n actions?: ReactNode;\n /** `BoardCard`s. */\n children: ReactNode;\n /** A card is being dragged over this column: 1px accent border and a light tint. */\n dropTarget?: boolean;\n /** Names the list of cards. Defaults to the title. */\n \"aria-label\"?: string;\n}\n\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(function BoardColumn(\n { title, count, onAdd, labels, actions, children, dropTarget = false, \"aria-label\": ariaLabel, className, ...rest },\n ref,\n) {\n const l = { ...DEFAULT_LABELS, ...labels };\n const titleId = `x-board-col-${useId()}`;\n return (\n <section {...rest} ref={ref} className={cx(\"x-board-col\", className)} aria-labelledby={titleId} data-drop-target={dropTarget ? \"\" : undefined}>\n <header className=\"x-board-col-head\">\n <h3 className=\"x-board-col-title\" id={titleId}>\n {title}\n </h3>\n {count !== undefined ? <Badge>{count}</Badge> : null}\n {onAdd || actions ? (\n <div className=\"x-board-col-actions\">\n {actions}\n {onAdd ? <IconButton icon=\"plus\" size=\"sm\" label={l.add} onClick={onAdd} /> : null}\n </div>\n ) : null}\n </header>\n <div className=\"x-board-col-body\" role=\"list\" aria-label={ariaLabel ?? title}>\n {children}\n </div>\n </section>\n );\n});\n","import { forwardRef, type HTMLAttributes, type KeyboardEvent, type MouseEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\n\nexport type BoardCardStatus = \"idle\" | \"running\" | \"waiting\" | \"error\";\n\nexport interface BoardCardLabels {\n /** Text read after the title when `tone=\"need\"`; the tint alone says nothing to a screen reader. */\n need: string;\n /** Text read after the title for each status; the dot alone says nothing to a screen reader. */\n status: Record<BoardCardStatus, string>;\n}\n\nconst DEFAULT_LABELS: BoardCardLabels = { need: \"Needs you\", status: { idle: \"Idle\", running: \"Running\", waiting: \"Waiting\", error: \"Error\" } };\n\nconst DOT = { idle: \"idle\", running: \"working\", waiting: \"waiting\", error: \"failed\" } as const;\n\nexport interface BoardCardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\" | \"role\" | \"children\"> {\n title: string;\n /** Muted line under the title (assignee, date). */\n meta?: ReactNode;\n /** `Tag`s, one row. */\n tags?: ReactNode;\n /** Draws a StatusDot before the title. Omit when the card has no process. */\n status?: BoardCardStatus;\n /** Tint and 1px accent border. */\n selected?: boolean;\n /** `\"need\"` tints the card with the warning colour and a 1px warning border: the card waits for a person. Pair it with `status=\"waiting\"`. */\n tone?: \"need\";\n /** Lowered opacity and an elevation shadow while the card is dragged. */\n dragging?: boolean;\n /** Called on click and on Enter. */\n onOpen?: () => void;\n /** An IconButton that opens a Menu. Its clicks and keys do not reach `onOpen`. */\n menu?: ReactNode;\n /** Inline controls after the title (a count, a small button). Clicks and keys inside do not reach `onOpen`. */\n actions?: ReactNode;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<BoardCardLabels>;\n}\n\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { title, meta, tags, status, tone, selected = false, dragging = false, onOpen, menu, actions, labels, className, onClick, onKeyDown, ...rest },\n ref,\n) {\n const l = { ...DEFAULT_LABELS, ...labels };\n const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n onKeyDown?.(e);\n if (e.key === \"Enter\" && e.target === e.currentTarget) onOpen?.();\n };\n const handleClick = (e: MouseEvent<HTMLDivElement>): void => {\n onClick?.(e);\n onOpen?.();\n };\n return (\n <div\n {...rest}\n ref={ref}\n className={cx(\"x-board-card\", className)}\n role=\"listitem\"\n tabIndex={0}\n aria-current={selected ? \"true\" : undefined}\n data-tone={tone}\n data-selected={selected ? \"\" : undefined}\n data-dragging={dragging ? \"\" : undefined}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <div className=\"x-board-card-head\">\n {status ? <StatusDot state={DOT[status]} /> : null}\n <span className=\"x-board-card-title\">{title}</span>\n {actions ? (\n <span className=\"x-board-card-actions\" onClick={(e) => e.stopPropagation()} onKeyDown={(e) => e.stopPropagation()}>\n {actions}\n </span>\n ) : null}\n {status ? <span className=\"x-sr-only\">{l.status[status]}</span> : null}\n {tone === \"need\" ? <span className=\"x-sr-only\">{l.need}</span> : null}\n {menu ? (\n <span className=\"x-board-card-menu\" onClick={(e) => e.stopPropagation()} onKeyDown={(e) => e.stopPropagation()}>\n {menu}\n </span>\n ) : null}\n </div>\n {meta ? <div className=\"x-board-card-meta\">{meta}</div> : null}\n {tags ? <div className=\"x-board-card-tags\">{tags}</div> : null}\n </div>\n );\n});\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface DescriptionListItem {\n term: ReactNode;\n value: ReactNode;\n /** Set the value in the mono face (ids, emails, paths). */\n mono?: boolean;\n}\n\nexport interface DescriptionListProps {\n items: DescriptionListItem[];\n /** \"rows\": term left, value right (stacks below 480px). \"columns\": term over value in an auto-fit grid. Default \"rows\". */\n layout?: \"rows\" | \"columns\";\n className?: string;\n}\n\nexport function DescriptionList({ items, layout = \"rows\", className }: DescriptionListProps): JSX.Element {\n return (\n <dl className={cx(\"x-dl\", className)} data-layout={layout}>\n {items.map((it, i) => (\n <div className=\"x-dl-item\" key={i}>\n <dt className=\"x-dl-term\">{it.term}</dt>\n <dd className={cx(\"x-dl-value\", it.mono && \"ws-mono\")}>{it.value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport type { IconName } from \"../../icons\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\nexport interface StatTileLabels {\n /** Accessible name of the spinner shown while loading. */\n loading: string;\n}\n\nconst DEFAULT_LABELS: StatTileLabels = { loading: \"Loading…\" };\n\nexport interface StatTileProps {\n label: ReactNode;\n /** The headline number, formatted by the caller. */\n value: ReactNode;\n /** Pre-formatted change (\"+12%\"). */\n delta?: ReactNode;\n /** Draws an arrow-up or arrow-down icon before the delta. */\n deltaTrend?: \"up\" | \"down\";\n /** The caller decides: up is not always good. Default \"neutral\". */\n deltaTone?: \"good\" | \"bad\" | \"neutral\";\n /** Period or basis of the delta (\"vs last 7 days\"). */\n hint?: ReactNode;\n loading?: boolean;\n /** Extra content under the value, e.g. a Meter. */\n children?: ReactNode;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<StatTileLabels>;\n /** A glyph in a soft tile at the top right, naming what is counted (users, messages, orders). */\n icon?: IconName;\n /** \"lg\": the value in `--type-display` with tabular figures, for a wall clock or the one number a screen is about. Default \"md\". */\n size?: \"md\" | \"lg\";\n className?: string;\n}\n\nexport function StatTile({ label, value, delta, deltaTrend, deltaTone = \"neutral\", hint, loading, children, labels, size, icon, className }: StatTileProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <div className={cx(\"x-stat\", className)} data-size={size === \"lg\" ? \"lg\" : undefined} aria-busy={loading ? true : undefined}>\n {icon ? (\n <span className=\"x-stat-icon\" aria-hidden=\"true\">\n <Icon name={icon} size={20} />\n </span>\n ) : null}\n <p className=\"x-stat-label\">{label}</p>\n {loading ? (\n <div className=\"x-stat-loading\">\n <Spinner size=\"md\" label={l.loading} />\n </div>\n ) : (\n <>\n <p className=\"x-stat-value\">{value}</p>\n {delta != null || hint ? (\n <p className=\"x-stat-foot\">\n {delta != null ? (\n <span className=\"x-stat-delta\" data-tone={deltaTone}>\n {deltaTrend ? <Icon name={deltaTrend === \"up\" ? \"arrow-up\" : \"arrow-down\"} size={12} /> : null}\n {delta}\n </span>\n ) : null}\n {hint ? <span className=\"x-stat-hint\">{hint}</span> : null}\n </p>\n ) : null}\n {children ? <div className=\"x-stat-extra\">{children}</div> : null}\n </>\n )}\n </div>\n );\n}\n","import type { TableSort } from \"./DataTable\";\n\n/** Click on a sortable header: a new column starts asc; the same column goes asc, desc, off (null). */\nexport function nextTableSort(current: TableSort | null | undefined, key: string): TableSort | null {\n if (!current || current.key !== key) return { key, dir: \"asc\" };\n return current.dir === \"asc\" ? { key, dir: \"desc\" } : null;\n}\n\nfunction compare(a: string | number, b: string | number): number {\n if (typeof a === \"number\" && typeof b === \"number\") return a - b;\n return String(a).localeCompare(String(b), undefined, { numeric: true, sensitivity: \"base\" });\n}\n\n/** Returns a sorted copy. Stable: equal rows keep their order in both directions. */\nexport function sortTableRows<Row>(rows: Row[], sort: TableSort | null | undefined, value: (row: Row, key: string) => string | number): Row[] {\n if (!sort) return [...rows];\n const sign = sort.dir === \"asc\" ? 1 : -1;\n return rows\n .map((row, index) => ({ row, index, v: value(row, sort.key) }))\n .sort((a, b) => sign * compare(a.v, b.v) || a.index - b.index)\n .map((x) => x.row);\n}\n\n/** Rows of a 1-based page. The page is clamped into range; a page size below 1 counts as 1. */\nexport function paginateRows<Row>(rows: Row[], page: number, pageSize: number): Row[] {\n const size = Math.max(1, Math.floor(pageSize));\n const pages = Math.max(1, Math.ceil(rows.length / size));\n const p = Math.min(Math.max(1, Math.floor(page)), pages);\n return rows.slice((p - 1) * size, p * size);\n}\n\n/**\n * `TableSort` as the `field:dir` text a URL or an API takes (`sort=name:asc`); null for no sort.\n */\nexport function tableSortToParam(sort: TableSort | null | undefined): string | null {\n return sort ? `${sort.key}:${sort.dir}` : null;\n}\n\n/**\n * Reads `field:dir` (or a bare `field`, read as `asc`) back into a `TableSort`. Empty, malformed or a key not in\n * `allowed` (when given) gives null, so a hand-edited URL cannot sort by an unknown column.\n */\nexport function tableSortFromParam(param: string | null | undefined, allowed?: readonly string[]): TableSort | null {\n const m = /^([A-Za-z0-9_.-]+)(?::(asc|desc))?$/.exec((param ?? \"\").trim());\n if (!m) return null;\n const key = m[1];\n if (key === undefined) return null;\n if (allowed && !allowed.includes(key)) return null;\n return { key, dir: (m[2] as TableSort[\"dir\"] | undefined) ?? \"asc\" };\n}\n","/** Pure helpers behind DataTable row reorder. No DOM, so tests need none. */\n\n/** Returns a copy of `array` with the item at `from` moved to `to`. `to` is clamped into range; a bad `from` returns an unchanged copy. */\nexport function moveItem<T>(array: readonly T[], from: number, to: number): T[] {\n const out = [...array];\n if (!Number.isInteger(from) || from < 0 || from >= out.length) return out;\n const target = Math.min(Math.max(0, Math.trunc(to)), out.length - 1);\n out.splice(target, 0, ...out.splice(from, 1));\n return out;\n}\n\n/** A row lifted with the keyboard: it started at `from` and now sits at `at`. */\nexport interface ReorderLift {\n from: number;\n at: number;\n}\nexport type ReorderKeyState = ReorderLift | null;\n\nexport type ReorderKeyEvent =\n | { type: \"lift\"; from: number }\n | { type: \"move\"; from: number; to: number }\n | { type: \"drop\"; from: number; to: number }\n | { type: \"cancel\"; from: number };\n\nexport interface ReorderKeyResult {\n state: ReorderKeyState;\n /** What to announce (and, for \"drop\", to commit). Null when nothing changed. */\n event: ReorderKeyEvent | null;\n /** False when the key is not part of the reorder pattern; the caller leaves it to the browser. */\n handled: boolean;\n}\n\nconst isAction = (key: string): boolean => key === \" \" || key === \"Enter\" || key === \"Spacebar\";\n\n/**\n * Keyboard reorder as a reducer. Space or Enter lifts the row at `index`; while lifted,\n * ArrowUp/ArrowDown (Home/End) move it, Space or Enter drops it, Escape cancels.\n */\nexport function reorderKeyStep(state: ReorderKeyState, key: string, index: number, count: number): ReorderKeyResult {\n if (!state) {\n if (isAction(key) && count > 0 && index >= 0 && index < count) return { state: { from: index, at: index }, event: { type: \"lift\", from: index }, handled: true };\n return { state, event: null, handled: false };\n }\n const last = Math.max(0, count - 1);\n let at: number | null = null;\n if (key === \"ArrowUp\") at = Math.max(0, state.at - 1);\n else if (key === \"ArrowDown\") at = Math.min(last, state.at + 1);\n else if (key === \"Home\") at = 0;\n else if (key === \"End\") at = last;\n if (at != null) return { state: { from: state.from, at }, event: at === state.at ? null : { type: \"move\", from: state.from, to: at }, handled: true };\n if (isAction(key)) return { state: null, event: { type: \"drop\", from: state.from, to: state.at }, handled: true };\n if (key === \"Escape\") return { state: null, event: { type: \"cancel\", from: state.from }, handled: true };\n return { state, event: null, handled: false };\n}\n\n/** Insertion slot (0..rows) for a pointer at `y`: the number of row midpoints above it. */\nexport function reorderSlot(y: number, mids: readonly number[]): number {\n let slot = 0;\n for (const m of mids) if (y > m) slot++;\n return slot;\n}\n\n/** Final index of a row dragged from `from` and dropped into insertion `slot`. */\nexport function slotToIndex(from: number, slot: number): number {\n return slot > from ? slot - 1 : slot;\n}\n","import { useEffect, useRef, useState, type JSX, type KeyboardEvent, type PointerEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { Icon } from \"../Icon/Icon\";\nimport { Select } from \"../Select/Select\";\nimport { Spinner } from \"../Spinner/Spinner\";\nimport { nextTableSort, tableSortFromParam, tableSortToParam } from \"./table-helpers\";\nimport { moveItem, reorderKeyStep, reorderSlot, slotToIndex, type ReorderKeyState } from \"./table-reorder\";\n\nexport type TableSortDir = \"asc\" | \"desc\";\nexport interface TableSort {\n key: string;\n dir: TableSortDir;\n}\n\nexport interface DataTableColumn<Row> {\n key: string;\n header: ReactNode;\n cell: (row: Row) => ReactNode;\n sortable?: boolean;\n align?: \"start\" | \"end\";\n /** Set the cell in the mono face. */\n mono?: boolean;\n /** Dropped when the table container is narrower than 480px. */\n hideNarrow?: boolean;\n /** \"min\" shrinks to content (checkbox, row actions). Default \"auto\". */\n width?: \"auto\" | \"min\";\n /** Pin the column to an edge while the table scrolls sideways. \"end\" keeps a row-actions column reachable on a phone. */\n sticky?: \"start\" | \"end\";\n /** Text label of the cell in `stack` mode. Default: `header` when it is a string. */\n label?: string;\n}\n\nexport interface DataTableLabels {\n selectAll: string;\n selectRow: (rowLabel: string) => string;\n sortedAsc: string;\n sortedDesc: string;\n loading: string;\n /** Visually hidden header of the drag-handle column. */\n reorderColumn: string;\n /** Accessible name of a row's drag handle (\"Reorder Ada\"). */\n reorderHandle: (rowLabel: string) => string;\n /** Announced when a row is lifted with Space or Enter. */\n lifted: (rowLabel: string) => string;\n /** Announced after each arrow key move; `pos` is 1-based. */\n moved: (pos: number, total: number) => string;\n /** Announced when the row is dropped; `pos` is 1-based. */\n dropped: (pos: number, total: number) => string;\n /** Announced when Escape puts the row back. */\n cancelled: string;\n /** Label of the sort select that replaces the sort headers in `stack` mode. */\n sortBy: string;\n /** The sort select's option for no sort. */\n sortNone: string;\n /** One sort select option: a column name and a direction (\"Name, ascending\"). */\n sortOption: (column: string, dir: TableSortDir) => string;\n}\n\nconst DEFAULT_LABELS: DataTableLabels = {\n selectAll: \"Select all rows\",\n selectRow: (rowLabel) => `Select ${rowLabel}`,\n sortedAsc: \"sorted ascending\",\n sortedDesc: \"sorted descending\",\n loading: \"Loading…\",\n reorderColumn: \"Order\",\n reorderHandle: (rowLabel) => `Reorder ${rowLabel}`,\n lifted: (rowLabel) => `${rowLabel} lifted. Use the up and down arrow keys to move it, Space to drop it, Escape to cancel.`,\n moved: (pos, total) => `Moved to position ${pos} of ${total}.`,\n dropped: (pos, total) => `Dropped at position ${pos} of ${total}.`,\n cancelled: \"Reorder cancelled. The row is back in its place.\",\n sortBy: \"Sort by\",\n sortNone: \"Default order\",\n sortOption: (column, dir) => `${column}, ${dir === \"asc\" ? \"ascending\" : \"descending\"}`,\n};\n\nexport interface DataTableProps<Row> {\n columns: DataTableColumn<Row>[];\n rows: Row[];\n rowKey: (row: Row) => string;\n /** Visually hidden <caption>; names the table. */\n caption: string;\n /** Accessible name of a row for its select checkbox. Default: the row key. */\n rowLabel?: (row: Row) => string;\n sort?: TableSort | null;\n onSortChange?: (sort: TableSort | null) => void;\n /** Turns on the checkbox column. */\n selected?: ReadonlySet<string>;\n onSelectedChange?: (next: Set<string>) => void;\n loading?: boolean;\n /** Shown in place of the body when rows is empty and not loading (an EmptyState). */\n empty?: ReactNode;\n /** Adds a leading drag-handle column. Handles are disabled while `sort` is set or `loading`. */\n reorderable?: boolean;\n /** Called with the row's old and new index in `rows` after a pointer or keyboard drop. */\n onReorder?: (fromIndex: number, toIndex: number) => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<DataTableLabels>;\n /**\n * Below a 480px-wide container, show each row as a card of \"label: value\" lines instead of a sideways-scrolling\n * table. Header cells stay for screen readers. With `onSortChange` and sortable columns, a \"Sort by\" select takes the\n * place of the sort headers there (it is hidden at wider sizes).\n */\n stack?: boolean;\n className?: string;\n}\n\n/** What the reorder wrapper adds to the plain table. */\ninterface ReorderParts<Row> {\n /** Rows in display order (a lifted row shows at its new place). */\n rows: Row[];\n handle: (row: Row, index: number) => ReactNode;\n rowAttrs: (row: Row, index: number) => Record<string, string | undefined>;\n live: ReactNode;\n}\n\nexport function DataTable<Row>(props: DataTableProps<Row>): JSX.Element {\n return props.reorderable ? <ReorderableTable<Row> {...props} /> : renderTable(props);\n}\n\nfunction renderTable<Row>({\n columns,\n rows,\n rowKey,\n caption,\n rowLabel,\n sort,\n onSortChange,\n selected,\n onSelectedChange,\n loading,\n empty,\n labels,\n stack,\n className,\n}: DataTableProps<Row>, reorder?: ReorderParts<Row>): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const shown = reorder ? reorder.rows : rows;\n const selectable = selected !== undefined;\n const keys = rows.map(rowKey);\n const picked = keys.filter((k) => selected?.has(k)).length;\n const all = keys.length > 0 && picked === keys.length;\n const toggleAll = (): void => {\n const next = new Set(selected);\n for (const k of keys) {\n if (all) next.delete(k);\n else next.add(k);\n }\n onSelectedChange?.(next);\n };\n const toggleRow = (k: string): void => {\n const next = new Set(selected);\n if (next.has(k)) next.delete(k);\n else next.add(k);\n onSelectedChange?.(next);\n };\n const colSpan = columns.length + (selectable ? 1 : 0) + (reorder ? 1 : 0);\n const cellAttrs = (c: DataTableColumn<Row>) => ({\n \"data-align\": c.align === \"end\" ? \"end\" : undefined,\n \"data-width\": c.width === \"min\" ? \"min\" : undefined,\n \"data-hide-narrow\": c.hideNarrow ? \"true\" : undefined,\n \"data-sticky\": c.sticky,\n });\n // A table whose rows or cells are display:block can lose its table role in some browsers; stack mode states the roles.\n const role = (r: string): string | undefined => (stack ? r : undefined);\n const labelOf = (c: DataTableColumn<Row>): string | undefined => (stack ? (c.label ?? (typeof c.header === \"string\" ? c.header : undefined)) : undefined);\n // Stack mode hides the sort headers, so the sort moves into a select shown only while the rows are stacked.\n const sortable = stack && onSortChange ? columns.filter((c) => c.sortable) : [];\n const sortName = (c: DataTableColumn<Row>): string => c.label ?? (typeof c.header === \"string\" ? c.header : c.key);\n return (\n <div className={cx(\"x-table-wrap\", className)} aria-busy={loading ? true : undefined} data-loading={loading && rows.length ? \"\" : undefined} data-stack={stack ? \"\" : undefined}>\n {sortable.length ? (\n <div className=\"x-table-stack-sort\">\n <Select\n label={l.sortBy}\n value={tableSortToParam(sort) ?? \"\"}\n onChange={(e) => onSortChange?.(tableSortFromParam(e.target.value, sortable.map((c) => c.key)))}\n options={[\n { value: \"\", label: l.sortNone },\n ...sortable.flatMap((c) => ([\"asc\", \"desc\"] as const).map((dir) => ({ value: `${c.key}:${dir}`, label: l.sortOption(sortName(c), dir) }))),\n ]}\n />\n </div>\n ) : null}\n <table className=\"x-table\" role={role(\"table\")}>\n <caption className=\"x-sr-only\">{caption}</caption>\n <thead role={role(\"rowgroup\")}>\n <tr role={role(\"row\")}>\n {reorder ? (\n <th scope=\"col\" role={role(\"columnheader\")} className=\"x-table-handle-cell\" data-width=\"min\">\n <span className=\"x-sr-only\">{l.reorderColumn}</span>\n </th>\n ) : null}\n {selectable ? (\n <th scope=\"col\" role={role(\"columnheader\")} className=\"x-table-check\" data-width=\"min\">\n <Checkbox aria-label={l.selectAll} checked={all} indeterminate={picked > 0 && !all} onChange={toggleAll} disabled={!rows.length} />\n </th>\n ) : null}\n {columns.map((c) => {\n const dir = sort?.key === c.key ? sort.dir : undefined;\n return (\n <th\n role={role(\"columnheader\")}\n key={c.key}\n scope=\"col\"\n {...cellAttrs(c)}\n aria-sort={c.sortable ? (dir === \"asc\" ? \"ascending\" : dir === \"desc\" ? \"descending\" : \"none\") : undefined}\n >\n {c.sortable ? (\n <button type=\"button\" className=\"x-table-sort\" onClick={() => onSortChange?.(nextTableSort(sort, c.key))}>\n {c.header}\n {dir ? <Icon name={dir === \"asc\" ? \"arrow-up\" : \"arrow-down\"} size={12} /> : null}\n {dir ? <span className=\"x-sr-only\">{dir === \"asc\" ? l.sortedAsc : l.sortedDesc}</span> : null}\n </button>\n ) : (\n c.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody role={role(\"rowgroup\")}>\n {loading && !rows.length ? (\n <tr role={role(\"row\")}>\n <td role={role(\"cell\")} className=\"x-table-empty\" colSpan={colSpan}>\n <Spinner size=\"md\" label={l.loading} />\n </td>\n </tr>\n ) : !rows.length ? (\n <tr role={role(\"row\")}>\n <td role={role(\"cell\")} className=\"x-table-empty\" colSpan={colSpan}>\n {empty}\n </td>\n </tr>\n ) : (\n shown.map((row, index) => {\n const k = rowKey(row);\n const isSel = selectable ? selected.has(k) : undefined;\n return (\n <tr key={k} role={role(\"row\")} aria-selected={isSel ? true : undefined} data-selected={isSel ? \"\" : undefined} {...reorder?.rowAttrs(row, index)}>\n {reorder ? (\n <td role={role(\"cell\")} className=\"x-table-handle-cell\" data-width=\"min\">\n {reorder.handle(row, index)}\n </td>\n ) : null}\n {selectable ? (\n <td role={role(\"cell\")} className=\"x-table-check\" data-width=\"min\">\n <Checkbox aria-label={l.selectRow(rowLabel ? rowLabel(row) : k)} checked={Boolean(isSel)} onChange={() => toggleRow(k)} />\n </td>\n ) : null}\n {columns.map((c) => (\n <td key={c.key} className={cx(c.mono && \"ws-mono\")} {...cellAttrs(c)} role={role(\"cell\")} data-label={labelOf(c)}>\n {c.cell(row)}\n </td>\n ))}\n </tr>\n );\n })\n )}\n </tbody>\n </table>\n {reorder?.live}\n </div>\n );\n}\n\nfunction ReorderableTable<Row>(props: DataTableProps<Row>): JSX.Element {\n const { rows, rowKey, rowLabel, sort, loading, onReorder, labels } = props;\n const l = { ...DEFAULT_LABELS, ...labels };\n const [liftState, setLift] = useState<ReorderKeyState>(null);\n const [drag, setDrag] = useState<{ from: number; slot: number } | null>(null);\n const [message, setMessage] = useState(\"\");\n const mids = useRef<number[]>([]);\n const handles = useRef(new Map<string, HTMLButtonElement>());\n const total = rows.length;\n const disabled = Boolean(sort) || Boolean(loading) || total < 2;\n // A lift is dropped silently if the rows change under it.\n const lift = liftState && liftState.from < total && liftState.at < total && !disabled ? liftState : null;\n const shown = lift ? moveItem(rows, lift.from, lift.at) : rows;\n const liftedKey = lift ? rowKey(rows[lift.from]!) : null;\n const nameOf = (row: Row): string => (rowLabel ? rowLabel(row) : rowKey(row));\n\n // Moving a row moves its DOM node, which can drop focus; put it back on the lifted handle.\n useEffect(() => {\n if (liftedKey != null) handles.current.get(liftedKey)?.focus();\n }, [liftedKey, lift?.at]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLButtonElement>, index: number): void => {\n const step = reorderKeyStep(lift, e.key, index, total);\n if (!step.handled) return;\n e.preventDefault();\n setLift(step.state);\n const ev = step.event;\n if (!ev) return;\n if (ev.type === \"lift\") setMessage(l.lifted(nameOf(rows[ev.from]!)));\n else if (ev.type === \"move\") setMessage(l.moved(ev.to + 1, total));\n else if (ev.type === \"drop\") {\n setMessage(l.dropped(ev.to + 1, total));\n if (ev.to !== ev.from) onReorder?.(ev.from, ev.to);\n } else setMessage(l.cancelled);\n };\n\n const onPointerDown = (e: PointerEvent<HTMLButtonElement>, index: number): void => {\n if (disabled || lift || e.button !== 0) return;\n const body = e.currentTarget.closest(\"tbody\");\n if (!body) return;\n mids.current = Array.from(body.rows).map((r) => {\n const b = r.getBoundingClientRect();\n return b.top + b.height / 2;\n });\n e.currentTarget.setPointerCapture?.(e.pointerId);\n e.preventDefault();\n setDrag({ from: index, slot: index });\n };\n const onPointerMove = (e: PointerEvent<HTMLButtonElement>): void => {\n if (!drag) return;\n const slot = reorderSlot(e.clientY, mids.current);\n if (slot !== drag.slot) setDrag({ from: drag.from, slot });\n };\n const onPointerUp = (): void => {\n if (!drag) return;\n const to = slotToIndex(drag.from, drag.slot);\n setDrag(null);\n if (to === drag.from) return;\n setMessage(l.dropped(to + 1, total));\n onReorder?.(drag.from, to);\n };\n\n const dragTo = drag ? slotToIndex(drag.from, drag.slot) : null;\n const dropMark = (index: number): string | undefined => {\n if (!drag || dragTo === drag.from) return undefined;\n if (drag.slot < total) return index === drag.slot ? \"before\" : undefined;\n return index === total - 1 ? \"after\" : undefined;\n };\n\n return renderTable(props, {\n rows: shown,\n rowAttrs: (row, index) => ({\n \"data-lifted\": lift && rowKey(row) === liftedKey ? \"\" : undefined,\n \"data-dragging\": drag && index === drag.from ? \"\" : undefined,\n \"data-drop\": dropMark(index),\n }),\n handle: (row, index) => {\n const k = rowKey(row);\n return (\n <button\n type=\"button\"\n className=\"x-table-handle\"\n ref={(el) => {\n if (el) handles.current.set(k, el);\n else handles.current.delete(k);\n }}\n aria-label={l.reorderHandle(nameOf(row))}\n disabled={disabled}\n onKeyDown={(e) => onKeyDown(e, index)}\n onBlur={(e) => {\n if (lift && e.relatedTarget) {\n setLift(null);\n setMessage(l.cancelled);\n }\n }}\n onPointerDown={(e) => onPointerDown(e, index)}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={() => setDrag(null)}\n >\n <Icon name=\"grip\" size={16} />\n </button>\n );\n },\n live: (\n <div className=\"x-sr-only\" role=\"status\" aria-live=\"polite\">\n {message}\n </div>\n ),\n });\n}\n","import { useEffect, useRef, useState, type JSX, type KeyboardEvent, type PointerEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { moveItem, reorderKeyStep, reorderSlot, slotToIndex, type ReorderKeyState } from \"../DataTable/table-reorder\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface SortableListLabels {\n /** Accessible name of an item's grip handle. */\n handle: (itemLabel: string) => string;\n /** Announced when an item is lifted with Space or Enter. */\n lifted: (itemLabel: string) => string;\n /** Announced after each arrow key move; `pos` is 1-based. */\n moved: (pos: number, total: number) => string;\n /** Announced when the item is dropped; `pos` is 1-based. */\n dropped: (pos: number, total: number) => string;\n /** Announced when Escape puts the item back. */\n cancelled: string;\n}\n\nconst DEFAULT_LABELS: SortableListLabels = {\n handle: (name) => `Drag to reorder: ${name}`,\n lifted: (name) => `${name} lifted. Use the up and down arrow keys to move it, Space to drop it, Escape to cancel.`,\n moved: (pos, total) => `Moved to position ${pos} of ${total}.`,\n dropped: (pos, total) => `Dropped at position ${pos} of ${total}.`,\n cancelled: \"Reorder cancelled. The item is back in its place.\",\n};\n\nexport interface SortableListProps<T> {\n items: readonly T[];\n getKey: (item: T) => string;\n /** Name of an item in the handle label and announcements. Default: its key. */\n getLabel?: (item: T) => string;\n /** Row content. Place `handle` (the grip button) where it belongs in the row. */\n renderItem: (item: T, index: number, handle: ReactNode) => ReactNode;\n /** Called once per finished move. The list is controlled: apply it (e.g. with `moveItem`). */\n onReorder?: (from: number, to: number) => void;\n disabled?: boolean;\n /** aria-label of the list. */\n label?: string;\n labels?: Partial<SortableListLabels>;\n className?: string;\n}\n\n/** A vertical list reordered by dragging a grip handle, or with the keyboard (Space, arrows, Space/Escape). */\nexport function SortableList<T>({ items, getKey, getLabel, renderItem, onReorder, disabled, label, labels, className }: SortableListProps<T>): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [liftState, setLift] = useState<ReorderKeyState>(null);\n const [drag, setDrag] = useState<{ from: number; slot: number } | null>(null);\n const [message, setMessage] = useState(\"\");\n const mids = useRef<number[]>([]);\n const handles = useRef(new Map<string, HTMLButtonElement>());\n const total = items.length;\n const off = Boolean(disabled) || total < 2;\n // A lift is dropped silently if the items change under it.\n const lift = liftState && liftState.from < total && liftState.at < total && !off ? liftState : null;\n const shown = lift ? moveItem(items, lift.from, lift.at) : items;\n const liftedKey = lift ? getKey(items[lift.from]!) : null;\n const nameOf = (item: T): string => (getLabel ? getLabel(item) : getKey(item));\n\n // Moving an item moves its DOM node, which can drop focus; put it back on the lifted handle.\n useEffect(() => {\n if (liftedKey != null) handles.current.get(liftedKey)?.focus();\n }, [liftedKey, lift?.at]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLButtonElement>, index: number): void => {\n if (off) return;\n const step = reorderKeyStep(lift, e.key, index, total);\n if (!step.handled) return;\n e.preventDefault();\n setLift(step.state);\n const ev = step.event;\n if (!ev) return;\n if (ev.type === \"lift\") setMessage(l.lifted(nameOf(items[ev.from]!)));\n else if (ev.type === \"move\") setMessage(l.moved(ev.to + 1, total));\n else if (ev.type === \"drop\") {\n setMessage(l.dropped(ev.to + 1, total));\n if (ev.to !== ev.from) onReorder?.(ev.from, ev.to);\n } else setMessage(l.cancelled);\n };\n\n const onPointerDown = (e: PointerEvent<HTMLButtonElement>, index: number): void => {\n if (off || lift || e.button !== 0) return;\n const list = e.currentTarget.closest(\"ul\");\n if (!list) return;\n mids.current = Array.from(list.children).map((r) => {\n const b = r.getBoundingClientRect();\n return b.top + b.height / 2;\n });\n e.currentTarget.setPointerCapture?.(e.pointerId);\n e.preventDefault();\n setDrag({ from: index, slot: index });\n };\n const onPointerMove = (e: PointerEvent<HTMLButtonElement>): void => {\n if (!drag) return;\n const slot = reorderSlot(e.clientY, mids.current);\n if (slot !== drag.slot) setDrag({ from: drag.from, slot });\n };\n const onPointerUp = (): void => {\n if (!drag) return;\n const to = slotToIndex(drag.from, drag.slot);\n setDrag(null);\n if (to === drag.from) return;\n setMessage(l.dropped(to + 1, total));\n onReorder?.(drag.from, to);\n };\n\n const dragTo = drag ? slotToIndex(drag.from, drag.slot) : null;\n const dropMark = (index: number): string | undefined => {\n if (!drag || dragTo === drag.from) return undefined;\n if (drag.slot < total) return index === drag.slot ? \"before\" : undefined;\n return index === total - 1 ? \"after\" : undefined;\n };\n\n return (\n <>\n <ul className={cx(\"x-sortable\", className)} aria-label={label}>\n {shown.map((item, index) => {\n const k = getKey(item);\n const handle = (\n <button\n type=\"button\"\n className=\"x-sortable-handle\"\n ref={(el) => {\n if (el) handles.current.set(k, el);\n else handles.current.delete(k);\n }}\n aria-label={l.handle(nameOf(item))}\n disabled={off}\n onKeyDown={(e) => onKeyDown(e, index)}\n onBlur={(e) => {\n if (lift && e.relatedTarget) {\n setLift(null);\n setMessage(l.cancelled);\n }\n }}\n onPointerDown={(e) => onPointerDown(e, index)}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={() => setDrag(null)}\n >\n <Icon name=\"grip\" size={16} />\n </button>\n );\n return (\n <li\n key={k}\n className=\"x-sortable-item\"\n data-lifted={lift && k === liftedKey ? \"\" : undefined}\n data-dragging={drag && index === drag.from ? \"\" : undefined}\n data-drop={dropMark(index)}\n >\n {renderItem(item, index, handle)}\n </li>\n );\n })}\n </ul>\n <div className=\"x-sr-only\" role=\"status\" aria-live=\"polite\">\n {message}\n </div>\n </>\n );\n}\n","import { foldText } from \"../../internal/text\";\nimport type { FacetOption } from \"./FacetFilter\";\n\n/** Options whose label contains the query (trimmed, case and diacritic insensitive). An empty query keeps all; order is kept. */\nexport function filterFacetOptions<T extends Pick<FacetOption, \"label\">>(options: readonly T[], query: string): T[] {\n const q = foldText(query.trim());\n if (!q) return [...options];\n return options.filter((o) => foldText(o.label).includes(q));\n}\n\n/** Adds or removes `value`. The result follows the order of `options`; selected values that are not options stay, at the end. */\nexport function toggleFacetValue(selected: readonly string[], value: string, options: readonly Pick<FacetOption, \"value\">[]): string[] {\n const next = new Set(selected);\n if (next.has(value)) next.delete(value);\n else next.add(value);\n const known = options.map((o) => o.value);\n const rest = [...next].filter((v) => !known.includes(v));\n return [...known.filter((v) => next.has(v)), ...rest];\n}\n","import { useState, type JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { Icon } from \"../Icon/Icon\";\nimport { Popover } from \"../Popover/Popover\";\nimport { SearchInput } from \"../SearchInput/SearchInput\";\nimport { filterFacetOptions, toggleFacetValue } from \"./facet-helpers\";\n\nexport interface FacetOption {\n value: string;\n label: string;\n /** Items that match this option alone. */\n count?: number;\n}\n\nexport interface FacetFilterLabels {\n /** aria-label of the search field. */\n search: string;\n /** aria-label of the search field's clear button. */\n clearSearch: string;\n /** Button that unchecks every option. */\n clear: string;\n /** Shown when the search matches no option. */\n noResults: string;\n /** Visually hidden after the trigger label while options are picked (\"2 selected\"). */\n selected: (count: number) => string;\n}\n\nconst DEFAULT_LABELS: FacetFilterLabels = {\n search: \"Search options\",\n clearSearch: \"Clear search\",\n clear: \"Clear\",\n noResults: \"No options match\",\n selected: (n) => `${n} selected`,\n};\n\nexport interface FacetFilterProps {\n /** The facet being filtered (\"Status\"); names the trigger and the panel. */\n label: string;\n options: FacetOption[];\n /** Values that are checked. */\n selected: string[];\n /** Next selection, in the order of `options`. */\n onChange: (next: string[]) => void;\n /** Shows the search field. Default: more than 7 options. */\n searchable?: boolean;\n /** Open on first render (previews, docs). */\n defaultOpen?: boolean;\n /** Render the list into `document.body` (default true). false keeps it inside the filter, for an inline preview. */\n portal?: boolean;\n placement?: \"bottom-start\" | \"bottom-end\";\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<FacetFilterLabels>;\n className?: string;\n}\n\nexport function FacetFilter({\n label,\n options,\n selected,\n onChange,\n searchable,\n defaultOpen = false,\n portal = true,\n placement = \"bottom-start\",\n labels,\n className,\n}: FacetFilterProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [open, setOpen] = useState(defaultOpen);\n const [query, setQuery] = useState(\"\");\n const picked = new Set(selected);\n const count = options.filter((o) => picked.has(o.value)).length;\n const showSearch = searchable ?? options.length > 7;\n const shown = showSearch ? filterFacetOptions(options, query) : options;\n const close = (): void => {\n setOpen(false);\n setQuery(\"\");\n };\n return (\n <Popover\n open={open}\n onClose={close}\n placement={placement}\n label={label}\n portal={portal}\n className={cx(\"x-facet\", className)}\n trigger={(t) => (\n <button type=\"button\" className=\"task-chip x-facet-trigger\" data-active={count ? \"\" : undefined} onClick={() => (open ? close() : setOpen(true))} {...t}>\n <span className=\"task-chip-label\">{label}</span>\n {count ? (\n <>\n <span className=\"task-chip-count\" aria-hidden=\"true\">{count}</span>\n <span className=\"x-sr-only\">{`, ${l.selected(count)}`}</span>\n </>\n ) : null}\n <Icon name=\"chevron\" size={12} />\n </button>\n )}\n >\n {showSearch ? (\n <SearchInput\n size=\"sm\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n onClear={() => setQuery(\"\")}\n labels={{ search: l.search, clear: l.clearSearch }}\n />\n ) : null}\n {shown.length ? (\n <ul className=\"x-facet-list\">\n {shown.map((o) => (\n <li key={o.value}>\n <Checkbox\n checked={picked.has(o.value)}\n onChange={() => onChange(toggleFacetValue(selected, o.value, options))}\n label={\n <span className=\"x-facet-option\">\n <span>{o.label}</span>\n {o.count != null ? <span className=\"x-facet-count\">{o.count}</span> : null}\n </span>\n }\n />\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"x-facet-empty\">{l.noResults}</p>\n )}\n <div className=\"x-facet-foot\">\n <Button variant=\"secondary\" disabled={!count} onClick={() => onChange([])}>\n {l.clear}\n </Button>\n </div>\n </Popover>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface BulkBarLabels {\n /** aria-label of the region. */\n region: string;\n /** Selection summary (\"3 selected\"). */\n selected: (count: number) => string;\n /** Button that empties the selection. */\n clear: string;\n}\n\nconst DEFAULT_LABELS: BulkBarLabels = {\n region: \"Bulk actions\",\n selected: (n) => `${n} selected`,\n clear: \"Clear selection\",\n};\n\nexport interface BulkBarProps {\n /** Number of selected items. The bar renders nothing at 0. */\n count: number;\n /** Empties the selection. */\n onClear: () => void;\n /** Actions on the selection: secondary Buttons, at most four. */\n children?: ReactNode;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<BulkBarLabels>;\n className?: string;\n}\n\nexport function BulkBar({ count, onClear, children, labels, className }: BulkBarProps): JSX.Element | null {\n if (!(count > 0)) return null;\n const l = { ...DEFAULT_LABELS, ...labels };\n return (\n <div className={cx(\"x-bulk-bar\", className)} role=\"region\" aria-label={l.region}>\n <span className=\"x-bulk-count\" aria-live=\"polite\">\n {l.selected(count)}\n </span>\n {children ? <div className=\"x-bulk-actions\">{children}</div> : null}\n <Button variant=\"secondary\" icon=\"close\" className=\"x-bulk-clear\" onClick={onClear}>\n {l.clear}\n </Button>\n </div>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { Select } from \"../Select/Select\";\n\nexport interface PaginationLabels {\n /** aria-label of the nav. */\n nav: string;\n previous: string;\n next: string;\n range: (from: number, to: number, total: number) => string;\n /** aria-label of the page-size select. */\n pageSize: string;\n /** Range text when the total is unknown (cursor paging). */\n page: (page: number) => string;\n}\n\nconst DEFAULT_LABELS: PaginationLabels = {\n nav: \"Pagination\",\n previous: \"Previous page\",\n next: \"Next page\",\n range: (from, to, total) => `${from}–${to} of ${total}`,\n pageSize: \"Rows per page\",\n page: (page) => `Page ${page}`,\n};\n\nexport interface PaginationProps {\n /** 1-based. */\n page: number;\n pageSize: number;\n /** Number of rows in all pages. Leave it out for cursor paging, where only \"is there a next page\" is known: then pass `hasNext`. */\n total?: number;\n /** Cursor paging (no `total`): whether a next page exists. */\n hasNext?: boolean;\n onPageChange: (page: number) => void;\n pageSizeOptions?: number[];\n onPageSizeChange?: (size: number) => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<PaginationLabels>;\n className?: string;\n}\n\nexport function Pagination({ page, pageSize, total, hasNext = false, onPageChange, pageSizeOptions, onPageSizeChange, labels, className }: PaginationProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const known = total != null;\n const pages = known ? Math.max(1, Math.ceil(total / Math.max(1, pageSize))) : Infinity;\n const from = !known || total === 0 ? 0 : (page - 1) * pageSize + 1;\n const to = known ? Math.min(total, page * pageSize) : 0;\n return (\n <nav className={cx(\"x-pagination\", className)} aria-label={l.nav}>\n {pageSizeOptions?.length ? (\n <Select\n aria-label={l.pageSize}\n value={String(pageSize)}\n onChange={(e) => onPageSizeChange?.(Number(e.target.value))}\n options={pageSizeOptions.map((n) => ({ value: String(n), label: String(n) }))}\n />\n ) : null}\n <span className=\"x-pagination-range\" aria-live=\"polite\">\n {known ? l.range(from, to, total) : l.page(page)}\n </span>\n <span className=\"x-pagination-step\">\n <IconButton icon=\"chevron-left\" label={l.previous} disabled={page <= 1} onClick={() => onPageChange(page - 1)} />\n <IconButton icon=\"chevron-right\" label={l.next} disabled={known ? page >= pages : !hasNext} onClick={() => onPageChange(page + 1)} />\n </span>\n </nav>\n );\n}\n","import { useCallback, useEffect, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface SaveBarLabels {\n /** The bar's message and region name. */\n unsaved: string;\n save: string;\n discard: string;\n saving: string;\n}\n\nconst DEFAULT_LABELS: SaveBarLabels = { unsaved: \"You have unsaved changes\", save: \"Save\", discard: \"Discard\", saving: \"Saving…\" };\n\nexport interface SaveBarProps {\n /** The form differs from what is saved. The bar shows only while dirty or busy. */\n dirty: boolean;\n onSave: () => void;\n onDiscard: () => void;\n busy?: boolean;\n /** A save error; replaces the message and is announced. */\n error?: ReactNode;\n /** Disables Save, e.g. while the form is invalid. */\n saveDisabled?: boolean;\n labels?: Partial<SaveBarLabels>;\n className?: string;\n}\n\nexport function SaveBar({ dirty, onSave, onDiscard, busy, error, saveDisabled, labels, className }: SaveBarProps): JSX.Element | null {\n const l = { ...DEFAULT_LABELS, ...labels };\n if (!dirty && !busy) return null;\n return (\n <div className={cx(\"x-savebar\", className)} role=\"region\" aria-label={l.unsaved} data-error={error ? \"true\" : undefined}>\n <p className=\"x-savebar-msg\" role={error ? \"alert\" : \"status\"}>\n {error ?? l.unsaved}\n </p>\n <div className=\"x-savebar-actions\">\n <Button variant=\"secondary\" onClick={onDiscard} disabled={busy}>\n {l.discard}\n </Button>\n <Button variant=\"primary\" onClick={onSave} disabled={busy || saveDisabled}>\n {busy ? l.saving : l.save}\n </Button>\n </div>\n </div>\n );\n}\n\nexport interface UnsavedGuard {\n /** Asks with `window.confirm(message)` when dirty; true means go ahead (not dirty, or the user agreed). Call it before an in-app navigation or before closing a Drawer. */\n confirmLeave: () => boolean;\n}\n\nexport interface UnsavedGuardOptions {\n /**\n * Also ask before following a same-page link while dirty: a click on an `<a href>` whose target is in this\n * document (a `#/route` hash link from `NavList` or `Breadcrumb`, or a same-origin path). The click is cancelled\n * when the user says no. Off by default, so a router that already calls `confirmLeave()` does not ask twice.\n */\n guardLinks?: boolean;\n}\n\n/**\n * Pure: whether a click on a link with `href` leaves the current view inside the same document (and so needs\n * `confirmLeave`). `here` is the current URL. Hash-only links that keep the current hash, other origins, `target`\n * other than `_self`, `download` links and modified clicks are not in-app navigations.\n */\nexport function isInAppNavigation(\n link: { href: string; target?: string | null; download?: boolean },\n here: string,\n click: { button?: number; metaKey?: boolean; ctrlKey?: boolean; shiftKey?: boolean; altKey?: boolean } = {},\n): boolean {\n if ((click.button ?? 0) !== 0 || click.metaKey || click.ctrlKey || click.shiftKey || click.altKey) return false;\n if (link.download || (link.target && link.target !== \"_self\")) return false;\n let to: URL;\n let from: URL;\n try {\n from = new URL(here);\n to = new URL(link.href, from);\n } catch {\n return false;\n }\n if (to.origin !== from.origin) return false;\n return to.pathname !== from.pathname || to.search !== from.search || to.hash !== from.hash;\n}\n\n/**\n * While `dirty`, the browser asks before the tab is closed or reloaded (beforeunload). In-app links are the router's\n * job: call `confirmLeave()` before navigating, or pass `{ guardLinks: true }` to have same-page link clicks\n * (hash routes included) ask first.\n */\nexport function useUnsavedGuard(dirty: boolean, message = \"Leave this page? Your changes are not saved.\", options: UnsavedGuardOptions = {}): UnsavedGuard {\n const { guardLinks = false } = options;\n useEffect(() => {\n if (!dirty || typeof window === \"undefined\") return;\n const onBeforeUnload = (e: BeforeUnloadEvent): void => {\n e.preventDefault();\n e.returnValue = \"\";\n };\n window.addEventListener(\"beforeunload\", onBeforeUnload);\n return () => window.removeEventListener(\"beforeunload\", onBeforeUnload);\n }, [dirty]);\n useEffect(() => {\n if (!dirty || !guardLinks || typeof document === \"undefined\") return;\n const onClick = (e: MouseEvent): void => {\n if (e.defaultPrevented) return;\n const target = e.target as Element | null;\n const a = target && typeof target.closest === \"function\" ? (target.closest(\"a[href]\") as HTMLAnchorElement | null) : null;\n if (!a) return;\n if (!isInAppNavigation({ href: a.href, target: a.target, download: a.hasAttribute(\"download\") }, window.location.href, e)) return;\n if (!window.confirm(message)) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n document.addEventListener(\"click\", onClick, true);\n return () => document.removeEventListener(\"click\", onClick, true);\n }, [dirty, guardLinks, message]);\n const confirmLeave = useCallback(() => !dirty || (typeof window !== \"undefined\" && window.confirm(message)), [dirty, message]);\n return { confirmLeave };\n}\n","import type { ElementType, HTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface ContainerProps extends HTMLAttributes<HTMLElement> {\n /** Max width: `--x-container-<size>`, or \"full\" for no limit. Default \"xl\" (1280px). */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"full\";\n /** Side padding of `--x-space-4`, so content never touches the screen edge. Default true. */\n gutter?: boolean;\n /** Element to render. Default \"div\"; use \"main\" or \"section\" where it fits. */\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport function Container({ size = \"xl\", gutter = true, as: Tag = \"div\", className, children, ...rest }: ContainerProps): JSX.Element {\n return (\n <Tag {...rest} className={cx(\"x-container\", className)} data-size={size} data-gutter={gutter ? undefined : \"false\"}>\n {children}\n </Tag>\n );\n}\n","import type { ElementType, HTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\n/** Steps of the space scale: 1 = 4px, 2 = 8px, 3 = 12px, 4 = 16px, 6 = 24px, 8 = 32px. */\nexport type SpaceStep = 0 | 1 | 2 | 3 | 4 | 6 | 8;\n\nexport interface StackProps extends HTMLAttributes<HTMLElement> {\n /** \"column\" stacks top to bottom, \"row\" left to right. Default \"column\". */\n direction?: \"column\" | \"row\";\n /** Gap between children, a space step. Default 3 (12px). */\n gap?: SpaceStep;\n /** Cross-axis alignment. Default \"stretch\" for a column, \"center\" for a row. */\n align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\n /** Main-axis distribution. Default \"start\". */\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n /** Let a row wrap onto the next line when it runs out of space. Default true for a row. */\n wrap?: boolean;\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport function Stack({ direction = \"column\", gap = 3, align, justify, wrap, as: Tag = \"div\", className, children, ...rest }: StackProps): JSX.Element {\n const row = direction === \"row\";\n return (\n <Tag\n {...rest}\n className={cx(\"x-stack\", className)}\n data-direction={direction}\n data-gap={gap}\n data-align={align ?? (row ? \"center\" : undefined)}\n data-justify={justify}\n data-wrap={(wrap ?? row) ? \"true\" : undefined}\n >\n {children}\n </Tag>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Container, type ContainerProps } from \"../Container/Container\";\n\nexport interface SiteShellLink {\n href: string;\n label: string;\n}\n\nexport interface SiteShellProps {\n /** Start of the top bar: usually a link home with `BrandMark` and the product name. */\n brand: ReactNode;\n /** End of the top bar: a language `Select`, a sign-in button. */\n actions?: ReactNode;\n /** Footer links (privacy, terms). Needs `linksLabel`. */\n links?: SiteShellLink[];\n /** Accessible name of the footer nav, translated (\"Legal\"). */\n linksLabel?: string;\n /** Extra footer content after the links. */\n footer?: ReactNode;\n /** Width of the bar, the page and the footer. Default \"md\" (768px). */\n size?: ContainerProps[\"size\"];\n children?: ReactNode;\n className?: string;\n}\n\n/** Frame for a small public web page (account portal, sign-in, legal): top bar, centred main, footer links. */\nexport function SiteShell({ brand, actions, links, linksLabel, footer, size = \"md\", children, className }: SiteShellProps): JSX.Element {\n const hasFooter = (links && links.length > 0) || footer;\n return (\n <div className={cx(\"x-site\", className)}>\n <header className=\"x-site-header\">\n <Container size={size} className=\"x-site-bar\">\n <div className=\"x-site-brand\">{brand}</div>\n {actions ? <div className=\"x-site-actions\">{actions}</div> : null}\n </Container>\n </header>\n <Container as=\"main\" size={size} className=\"x-site-main\">\n {children}\n </Container>\n {hasFooter ? (\n <footer className=\"x-site-footer\">\n <Container size={size} className=\"x-site-footer-inner\">\n {links && links.length > 0 ? (\n <nav aria-label={linksLabel}>\n {links.map((l) => (\n <a key={l.href} href={l.href}>\n {l.label}\n </a>\n ))}\n </nav>\n ) : null}\n {footer}\n </Container>\n </footer>\n ) : null}\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\n\nexport interface AuthShellProps {\n /** Top of the form pane: `BrandMark` and the product name, often a link home. Shown once, on every width. */\n brand: ReactNode;\n /** End of the form pane's bar: a language `Select`, a `ThemeSwitch`. No buttons. */\n actions?: ReactNode;\n /** Large line on the showcase side (\"One gateway for every model\"). Translated. */\n headline?: ReactNode;\n /** Short line under the headline. Translated. */\n tagline?: ReactNode;\n /** Picture for the showcase side. Leave it out for the built-in pattern (orbit rings over a dot grid). */\n art?: ReactNode;\n /** Copyright and links to terms: at the foot of the showcase from 1024px wide, under the form below that. */\n footer?: ReactNode;\n /** The sign-in form, with the page's `h1`. */\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * Frame for a sign-in, sign-up or reset page: a showcase side (art, then headline and tagline, centred) next to a\n * form pane (brand, actions, form). From 1024px wide they split the width 5 to 3 and the footer sits at the foot of\n * the showcase; below that only the form pane shows, with the footer under it.\n */\nexport function AuthShell({ brand, actions, headline, tagline, art, footer, children, className }: AuthShellProps): JSX.Element {\n const pitch = headline || tagline;\n return (\n <div className={cx(\"x-auth\", className)}>\n <aside className=\"x-auth-showcase\">\n <div className=\"x-auth-art\">\n {art ?? (\n <div className=\"x-auth-orbit\" aria-hidden=\"true\">\n <span />\n <span />\n <span />\n </div>\n )}\n </div>\n {pitch ? (\n <div className=\"x-auth-pitch\">\n {headline ? <p className=\"x-auth-headline\">{headline}</p> : null}\n {tagline ? <p className=\"x-auth-tagline\">{tagline}</p> : null}\n </div>\n ) : null}\n </aside>\n <div className=\"x-auth-pane\">\n <header className=\"x-auth-bar\">\n <div className=\"x-auth-brand\">{brand}</div>\n {actions ? <div className=\"x-auth-actions\">{actions}</div> : null}\n </header>\n <main className=\"x-auth-main\">\n <div className=\"x-auth-form\">{children}</div>\n </main>\n </div>\n {footer ? <footer className=\"x-auth-footer\">{footer}</footer> : null}\n </div>\n );\n}\n","import { useSyncExternalStore } from \"react\";\n\n/** Breakpoint widths in px, the same as `--x-bp-*` in tokens.json and Tailwind's `sm:`…`2xl:`. */\nexport const BREAKPOINTS = { sm: 640, md: 768, lg: 1024, xl: 1280, \"2xl\": 1536 } as const;\n\nexport type Breakpoint = keyof typeof BREAKPOINTS;\n/** \"base\" is below `sm`. */\nexport type BreakpointOrBase = \"base\" | Breakpoint;\n/** One value, or one value per breakpoint (mobile first: a key applies from that width up). */\nexport type Responsive<T> = T | Partial<Record<BreakpointOrBase, T>>;\n\nconst ORDER: Breakpoint[] = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n\n/** Largest breakpoint whose min-width fits `width` (px). Pure. */\nexport function breakpointFor(width: number): BreakpointOrBase {\n let found: BreakpointOrBase = \"base\";\n for (const bp of ORDER) if (width >= BREAKPOINTS[bp]) found = bp;\n return found;\n}\n\n/** True when the viewport is at least `bp`. `current` comes from `useBreakpoint()`. */\nexport function atLeast(current: BreakpointOrBase, bp: Breakpoint): boolean {\n return current !== \"base\" && BREAKPOINTS[current] >= BREAKPOINTS[bp];\n}\n\n/** Splits a Responsive value into [breakpoint, value] pairs; a plain value becomes base. */\nexport function responsiveEntries<T>(value: Responsive<T> | undefined): [BreakpointOrBase, T][] {\n if (value === undefined) return [];\n if (typeof value !== \"object\" || value === null) return [[\"base\", value as T]];\n return ([\"base\", ...ORDER] as BreakpointOrBase[]).flatMap((k) => {\n const v = (value as Partial<Record<BreakpointOrBase, T>>)[k];\n return v === undefined ? [] : [[k, v] as [BreakpointOrBase, T]];\n });\n}\n\nfunction subscribe(onChange: () => void): () => void {\n if (typeof window === \"undefined\" || !window.matchMedia) return () => {};\n const lists = ORDER.map((bp) => window.matchMedia(`(min-width: ${BREAKPOINTS[bp]}px)`));\n for (const l of lists) l.addEventListener(\"change\", onChange);\n return () => {\n for (const l of lists) l.removeEventListener(\"change\", onChange);\n };\n}\n\nfunction snapshot(): BreakpointOrBase {\n return typeof window === \"undefined\" ? \"base\" : breakpointFor(window.innerWidth);\n}\n\n/**\n * Current viewport breakpoint, updated on resize. Renders \"base\" on the server and the first\n * client pass, so prefer CSS (Grid columns, Tailwind `md:`) for layout and use this only for\n * behaviour that CSS cannot express (for example, a Drawer instead of a side panel).\n */\nexport function useBreakpoint(): BreakpointOrBase {\n return useSyncExternalStore(subscribe, snapshot, () => \"base\");\n}\n","import type { CSSProperties, ElementType, HTMLAttributes, JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { SpaceStep } from \"../Stack/Stack\";\nimport { responsiveEntries, type Responsive } from \"./breakpoints\";\n\nexport interface GridProps extends HTMLAttributes<HTMLElement> {\n /** Column count, or one per breakpoint: `{ base: 1, md: 2, xl: 4 }`. Default 1. Ignored with `minItemWidth`. */\n columns?: Responsive<number>;\n /** Fit as many columns as there is room for, each at least this wide (any CSS length, e.g. \"16rem\"). */\n minItemWidth?: string;\n /** Gap between cells, a space step. Default 4 (16px). */\n gap?: SpaceStep;\n /** What the breakpoints measure: the \"viewport\" (default) or the grid's own width (\"container\"), for grids inside panels and drawers. */\n responsive?: \"viewport\" | \"container\";\n as?: ElementType;\n children?: ReactNode;\n}\n\nfunction vars(prefix: string, value: Responsive<number> | undefined): Record<string, number> {\n const out: Record<string, number> = {};\n for (const [bp, v] of responsiveEntries(value)) {\n out[bp === \"base\" ? prefix : `${prefix}-${bp}`] = Math.max(1, Math.floor(v));\n }\n return out;\n}\n\nexport function Grid({ columns = 1, minItemWidth, gap = 4, responsive = \"viewport\", as: Tag = \"div\", className, style, children, ...rest }: GridProps): JSX.Element {\n const custom = minItemWidth ? { \"--x-grid-min\": minItemWidth } : vars(\"--x-grid-cols\", columns);\n const grid = (\n <Tag\n {...rest}\n className={cx(\"x-grid\", className)}\n data-gap={gap}\n data-auto={minItemWidth ? \"true\" : undefined}\n data-scope={responsive === \"container\" ? \"container\" : undefined}\n style={{ ...custom, ...style } as CSSProperties}\n >\n {children}\n </Tag>\n );\n return responsive === \"container\" ? <div className=\"x-grid-scope\">{grid}</div> : grid;\n}\n\nexport interface GridItemProps extends HTMLAttributes<HTMLElement> {\n /** Columns this cell spans, or one per breakpoint. \"full\" spans the whole row. Default 1. */\n span?: Responsive<number> | \"full\";\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport function GridItem({ span, as: Tag = \"div\", className, style, children, ...rest }: GridItemProps): JSX.Element {\n const full = span === \"full\";\n const custom = full ? {} : vars(\"--x-span\", span);\n return (\n <Tag {...rest} className={cx(\"x-grid-item\", className)} data-full={full ? \"true\" : undefined} style={{ ...custom, ...style } as CSSProperties}>\n {children}\n </Tag>\n );\n}\n","/** English short duration: \"42 s\", \"5 min\", \"2 h 5 min\", \"3 d\". Pass a translated formatter through a component's `labels`. */\nexport function formatDuration(ms: number): string {\n const s = Math.max(0, Math.floor(ms / 1000));\n if (s < 60) return `${s} s`;\n const m = Math.floor(s / 60);\n if (m < 60) return `${m} min`;\n const h = Math.floor(m / 60);\n if (h < 24) return m % 60 ? `${h} h ${m % 60} min` : `${h} h`;\n return `${Math.floor(h / 24)} d`;\n}\n\n/** Epoch ms from a number, a Date or a date string; NaN when unparsable. */\nexport function toEpoch(v: number | string | Date): number {\n return typeof v === \"number\" ? v : v instanceof Date ? v.getTime() : Date.parse(v);\n}\n","import { useState, type JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { formatDuration, toEpoch } from \"../../internal/duration\";\nimport type { AgentProfile } from \"../../types\";\nimport { AgentChip } from \"../AgentChip/AgentChip\";\nimport { Button } from \"../Button/Button\";\nimport { Icon } from \"../Icon/Icon\";\nimport { Popover } from \"../Popover/Popover\";\n\nexport type AttentionKind = \"approval\" | \"question\" | \"failed\";\n\nexport interface AttentionItem {\n id: string;\n agent: AgentProfile;\n worktree: string;\n /** What the agent is waiting for or what failed. */\n text: string;\n /** When the wait began: epoch ms, a Date or an ISO string. */\n since: number | string | Date;\n kind: AttentionKind;\n}\n\nexport interface AttentionInboxLabels {\n /** Panel title and name of the dialog. */\n title: string;\n /** aria-label of the header button, e.g. \"Needs you, 3\". */\n button: (count: number) => string;\n /** Shown when nothing waits. */\n empty: string;\n /** Text of each row's button. */\n open: string;\n /** aria-label of a row's button, e.g. \"Open feat/login\". */\n openItem: (item: AttentionItem) => string;\n kind: Record<AttentionKind, string>;\n /** Wait time, e.g. \"5 min\". */\n waited: (ms: number) => string;\n}\n\nconst DEFAULT_LABELS: AttentionInboxLabels = {\n title: \"Needs you\",\n button: (n) => `Needs you, ${n}`,\n empty: \"Nothing is waiting for you.\",\n open: \"Open\",\n openItem: (item) => `Open ${item.worktree}`,\n kind: { approval: \"Approval\", question: \"Question\", failed: \"Failed\" },\n waited: formatDuration,\n};\n\nexport interface AttentionInboxProps {\n items: AttentionItem[];\n /** Called with the item id when its \"Open\" button is pressed. */\n onOpen: (id: string) => void;\n /** Controlled open state. Leave undefined for uncontrolled. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Epoch ms used for wait times. Default: `Date.now()` at render. */\n now?: number;\n labels?: Partial<AttentionInboxLabels>;\n className?: string;\n}\n\n/** Items sorted oldest first (longest wait on top); unparsable times go last. */\nexport function sortByWait(items: AttentionItem[]): AttentionItem[] {\n const t = (i: AttentionItem): number => {\n const v = toEpoch(i.since);\n return Number.isNaN(v) ? Number.POSITIVE_INFINITY : v;\n };\n return [...items].sort((a, b) => t(a) - t(b));\n}\n\nexport function AttentionInbox({ items, onOpen, open, onOpenChange, now, labels, className }: AttentionInboxProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels, kind: { ...DEFAULT_LABELS.kind, ...labels?.kind } };\n const [inner, setInner] = useState(false);\n const isOpen = open ?? inner;\n const set = (v: boolean): void => {\n setInner(v);\n onOpenChange?.(v);\n };\n const count = items.length;\n const at = now ?? Date.now();\n const sorted = sortByWait(items);\n return (\n <>\n <Popover\n open={isOpen}\n onClose={() => set(false)}\n label={l.title}\n placement=\"bottom-end\"\n className={cx(\"x-attention-pop\", className)}\n trigger={(aria) => (\n <button type=\"button\" className=\"x-attention-btn\" aria-label={l.button(count)} data-active={count > 0 ? \"\" : undefined} onClick={() => set(!isOpen)} {...aria}>\n <Icon name=\"bell\" />\n {count > 0 ? (\n <span className=\"x-attention-count\" aria-hidden=\"true\">\n {count > 99 ? \"99+\" : String(count)}\n </span>\n ) : null}\n </button>\n )}\n >\n <div className=\"x-attention\">\n <h2 className=\"x-attention-title\">{l.title}</h2>\n {count === 0 ? (\n <p className=\"x-attention-empty\">{l.empty}</p>\n ) : (\n <ul className=\"x-attention-list\">\n {sorted.map((item) => {\n const since = toEpoch(item.since);\n return (\n <li key={item.id} className=\"x-attention-row\" data-kind={item.kind}>\n <AgentChip profile={item.agent} title={item.agent} />\n <span className=\"x-attention-text\">\n <span className=\"x-attention-wt\">{item.worktree}</span>\n <span className=\"x-attention-ask\">{item.text}</span>\n <span className=\"x-attention-meta\">\n <span className=\"x-attention-kind\">{l.kind[item.kind]}</span>\n {Number.isNaN(since) ? null : <span>{l.waited(Math.max(0, at - since))}</span>}\n </span>\n </span>\n <Button size=\"sm\" variant=\"secondary\" aria-label={l.openItem(item)} onClick={() => onOpen(item.id)}>\n {l.open}\n </Button>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </Popover>\n <span className=\"x-sr-only\" role=\"status\">\n {l.button(count)}\n </span>\n </>\n );\n}\n","import { useEffect, useRef } from \"react\";\nimport type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface ApprovalBarLabels {\n /** aria-label of the group. */\n region: string;\n allow: string;\n always: string;\n deny: string;\n}\n\nconst DEFAULT_LABELS: ApprovalBarLabels = {\n region: \"Approval needed\",\n allow: \"Allow\",\n always: \"Always allow\",\n deny: \"Deny\",\n};\n\nexport interface ApprovalBarProps {\n /** What the agent asks to do, e.g. \"Run a shell command\". */\n title: string;\n /** The command or path the request is about; shown in a mono block. */\n command?: string;\n onAllow: () => void;\n /** Adds the \"Always allow\" button when given. */\n onAlways?: () => void;\n onDeny: () => void;\n /** Disables the buttons while the answer is sent. */\n busy?: boolean;\n labels?: Partial<ApprovalBarLabels>;\n className?: string;\n}\n\nexport function ApprovalBar({ title, command, onAllow, onAlways, onDeny, busy, labels, className }: ApprovalBarProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n return (\n <div ref={ref} className={cx(\"x-approval\", className)} role=\"group\" aria-label={l.region} tabIndex={-1}>\n <div className=\"x-approval-text\" role=\"status\">\n <span className=\"x-approval-title\">{title}</span>\n {command ? <code className=\"x-approval-command\">{command}</code> : null}\n </div>\n <div className=\"x-approval-actions\">\n <Button variant=\"primary\" size=\"sm\" type=\"button\" disabled={busy} onClick={onAllow}>\n {l.allow}\n </Button>\n {onAlways ? (\n <Button variant=\"secondary\" size=\"sm\" type=\"button\" disabled={busy} onClick={onAlways}>\n {l.always}\n </Button>\n ) : null}\n <Button variant=\"ghost\" size=\"sm\" type=\"button\" disabled={busy} onClick={onDeny}>\n {l.deny}\n </Button>\n </div>\n </div>\n );\n}\n","import type { SessionState } from \"../types\";\n\n/** English words for a session state, shared by the parts that print one. */\nexport const SESSION_STATE_LABELS: Record<SessionState, string> = {\n working: \"Working\",\n failed: \"Failed\",\n waiting: \"Needs you\",\n done: \"Done\",\n idle: \"Idle\",\n exited: \"Exited\",\n};\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { formatDuration } from \"../../internal/duration\";\nimport { SESSION_STATE_LABELS } from \"../../internal/session-labels\";\nimport type { SessionState } from \"../../types\";\nimport { DiffStat, type DiffStatLabels } from \"../DiffStat/DiffStat\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\n\nexport interface SessionBarLabels {\n /** aria-label of the bar. */\n region: string;\n /** Visible words of the state, per state. */\n status: Record<SessionState, string>;\n /** aria-label of the model, e.g. \"Model\". */\n model: string;\n /** aria-label of the elapsed time, e.g. \"Elapsed\". */\n elapsed: string;\n /** Formats the elapsed time, e.g. \"5 min\". */\n duration: (ms: number) => string;\n diffStat: DiffStatLabels[\"diffStat\"];\n}\n\nconst DEFAULT_LABELS: SessionBarLabels = {\n region: \"Session\",\n status: SESSION_STATE_LABELS,\n model: \"Model\",\n elapsed: \"Elapsed\",\n duration: formatDuration,\n diffStat: (added, removed) => `${added} added, ${removed} removed`,\n};\n\nexport interface SessionBarProps {\n status: SessionState;\n /** Model name, e.g. \"claude-opus-5-5\". */\n model?: string;\n /** Time since the session started, in ms. */\n elapsed?: number;\n /** Lines added and removed by this session. */\n diff?: { add: number; del: number };\n /** Buttons at the end of the bar (IconButtons or secondary Buttons; no primary here). */\n actions?: ReactNode;\n labels?: Partial<SessionBarLabels>;\n className?: string;\n}\n\nexport function SessionBar({ status, model, elapsed, diff, actions, labels, className }: SessionBarProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels, status: { ...DEFAULT_LABELS.status, ...labels?.status } };\n return (\n <div className={cx(\"x-sessionbar\", className)} role=\"group\" aria-label={l.region} data-state={status}>\n <span className=\"x-sessionbar-status\">\n <StatusDot state={status} pulse={status === \"working\"} label={l.status[status]} />\n </span>\n {model ? (\n <span className=\"x-sessionbar-item x-sessionbar-model\" aria-label={`${l.model}: ${model}`}>\n {model}\n </span>\n ) : null}\n {elapsed != null ? (\n <span className=\"x-sessionbar-item\" aria-label={`${l.elapsed}: ${l.duration(elapsed)}`}>\n {l.duration(elapsed)}\n </span>\n ) : null}\n {diff ? <DiffStat added={diff.add} removed={diff.del} labels={{ diffStat: l.diffStat }} /> : null}\n {actions ? <span className=\"x-sessionbar-actions\">{actions}</span> : null}\n </div>\n );\n}\n","import type { JSX } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { SESSION_STATE_LABELS } from \"../../internal/session-labels\";\nimport type { SessionState } from \"../../types\";\nimport { AgentChip, type AgentChipProps } from \"../AgentChip/AgentChip\";\nimport { DiffStat, type DiffStatLabels } from \"../DiffStat/DiffStat\";\nimport { ListRow } from \"../ListRow/ListRow\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\n\nexport interface WorktreeRowLabels {\n /** Screen reader text of the status dot, per state. */\n status: Record<SessionState, string>;\n /** Accessible summary of the diff stat. */\n diffStat: DiffStatLabels[\"diffStat\"];\n}\n\nconst DEFAULT_LABELS: WorktreeRowLabels = {\n status: SESSION_STATE_LABELS,\n diffStat: (added, removed) => `${added} added, ${removed} removed`,\n};\n\nexport interface WorktreeRowProps {\n /** Main line: the branch of the worktree. */\n branch: string;\n /** Second line: the repository or folder name. */\n repo?: string;\n /** Agents running in this worktree, one chip each. */\n agents: AgentChipProps[];\n /** The one status of the worktree: a dot plus screen reader text. */\n status: SessionState;\n /** Lines added and removed in the worktree. Hidden when omitted. */\n diff?: { add: number; del: number };\n selected?: boolean;\n onSelect: () => void;\n /** Root element. Use \"li\" inside a ul. Default \"div\". */\n as?: \"div\" | \"li\";\n labels?: Partial<WorktreeRowLabels>;\n className?: string;\n}\n\nexport function WorktreeRow({ branch, repo, agents, status, diff, selected, onSelect, as, labels, className }: WorktreeRowProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels, status: { ...DEFAULT_LABELS.status, ...labels?.status } };\n return (\n <ListRow\n className={cx(\"x-worktree-row\", className)}\n as={as}\n selected={selected}\n onClick={onSelect}\n leading={<StatusDot state={status} label={<span className=\"x-sr-only\">{l.status[status]}</span>} />}\n title={<span className=\"x-worktree-branch\">{branch}</span>}\n meta={repo}\n trailing={\n <>\n {agents.length > 0 ? (\n <span className=\"x-worktree-agents\">\n {agents.map((a, i) => (\n <AgentChip key={`${a.profile ?? \"custom\"}-${a.letter ?? \"\"}-${i}`} {...a} />\n ))}\n </span>\n ) : null}\n {diff ? <DiffStat added={diff.add} removed={diff.del} labels={{ diffStat: l.diffStat }} /> : null}\n </>\n }\n />\n );\n}\n","import { useId } from \"react\";\nimport type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\nimport { Disclosure } from \"../Disclosure/Disclosure\";\nimport { Segmented } from \"../Segmented/Segmented\";\nimport { Select } from \"../Select/Select\";\nimport { Tag } from \"../Tag/Tag\";\n\nexport interface LaunchOption {\n value: string;\n label: string;\n}\n\nexport interface LaunchValue {\n agent: string;\n worktree: string;\n model: string;\n prompt: string;\n}\n\nexport interface LaunchCardLabels {\n /** aria-label of the card. */\n region: string;\n agent: string;\n worktree: string;\n model: string;\n prompt: string;\n promptPlaceholder: string;\n /** Title of the disclosure that holds `advanced`. */\n more: string;\n start: string;\n}\n\nconst DEFAULT_LABELS: LaunchCardLabels = {\n region: \"Start an agent\",\n agent: \"Agent\",\n worktree: \"Worktree\",\n model: \"Model\",\n prompt: \"Task\",\n promptPlaceholder: \"Describe what the agent should do\",\n more: \"More options\",\n start: \"Start\",\n};\n\nexport interface LaunchCardProps {\n agents: LaunchOption[];\n worktrees: LaunchOption[];\n models: LaunchOption[];\n value: LaunchValue;\n onChange: (value: LaunchValue) => void;\n onStart: () => void;\n /** Extra fields (branch name, permissions, flags). Shown in a closed \"More options\" disclosure; omitted when not given. */\n advanced?: ReactNode;\n labels?: Partial<LaunchCardLabels>;\n className?: string;\n}\n\nexport function LaunchCard({ agents, worktrees, models, value, onChange, onStart, advanced, labels, className }: LaunchCardProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const set = (patch: Partial<LaunchValue>): void => onChange({ ...value, ...patch });\n const pick = (opts: LaunchOption[], v: string): string | undefined => opts.find((o) => o.value === v)?.label;\n const worktreeLabel = pick(worktrees, value.worktree);\n const modelLabel = pick(models, value.model);\n return (\n <section className={cx(\"x-launch\", className)} aria-label={l.region}>\n <Segmented label={l.agent} options={agents} value={value.agent} onChange={(agent) => set({ agent })} />\n <div className=\"x-launch-row\">\n <div className=\"ws-field\">\n <label htmlFor={`${id}-worktree`}>{l.worktree}</label>\n <Select id={`${id}-worktree`} options={worktrees} value={value.worktree} onChange={(e) => set({ worktree: e.target.value })} />\n </div>\n <div className=\"ws-field\">\n <label htmlFor={`${id}-model`}>{l.model}</label>\n <Select id={`${id}-model`} options={models} value={value.model} onChange={(e) => set({ model: e.target.value })} />\n </div>\n </div>\n <div className=\"ws-field\">\n <label htmlFor={`${id}-prompt`}>{l.prompt}</label>\n <textarea\n id={`${id}-prompt`}\n className=\"kit-textarea\"\n data-resize=\"vertical\"\n rows={4}\n value={value.prompt}\n placeholder={l.promptPlaceholder}\n onChange={(e) => set({ prompt: e.target.value })}\n />\n </div>\n {worktreeLabel || modelLabel ? (\n <div className=\"x-launch-chips\">\n {worktreeLabel ? <Tag>{worktreeLabel}</Tag> : null}\n {modelLabel ? <Tag>{modelLabel}</Tag> : null}\n </div>\n ) : null}\n {advanced ? (\n <Disclosure title={l.more} defaultExpanded={false}>\n {advanced}\n </Disclosure>\n ) : null}\n <div className=\"x-launch-foot\">\n <Button variant=\"primary\" type=\"button\" onClick={onStart}>\n {l.start}\n </Button>\n </div>\n </section>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Meter } from \"../Meter/Meter\";\nimport { StatusDot, type StatusTone } from \"../StatusDot/StatusDot\";\n\n/** State of the account: usable, out of quota, failing, or not signed in. */\nexport type UsageState = \"ok\" | \"limited\" | \"error\" | \"signedOut\";\n\nexport interface UsageWindow {\n /** Name of the window, e.g. \"5 h\" or \"Week\". */\n label: string;\n /** Percent of the quota used, 0 to 100. */\n used: number;\n /** When the window resets, already formatted, e.g. \"Resets in 2 h\". */\n resetText: string;\n}\n\nexport interface UsageMeterRowLabels {\n /** Visible words of the account state. */\n state: Record<UsageState, string>;\n}\n\nconst DEFAULT_LABELS: UsageMeterRowLabels = {\n state: { ok: \"Active\", limited: \"Limit reached\", error: \"Error\", signedOut: \"Signed out\" },\n};\n\nconst TONE: Record<UsageState, StatusTone> = { ok: \"ok\", limited: \"warn\", error: \"danger\", signedOut: \"neutral\" };\n\nexport interface UsageMeterRowProps {\n /** Account name, e.g. an email or \"claude-3\". */\n account: string;\n windows: UsageWindow[];\n state: UsageState;\n /** Meters turn to the warn tone at or above this percent. Default 80. */\n warnAt?: number;\n /** Buttons at the end of the row (Sign in, Switch). No primary here. */\n actions?: ReactNode;\n labels?: Partial<UsageMeterRowLabels>;\n className?: string;\n}\n\nexport function UsageMeterRow({ account, windows, state, warnAt = 80, actions, labels, className }: UsageMeterRowProps): JSX.Element {\n const words = { ...DEFAULT_LABELS.state, ...labels?.state };\n return (\n <div className={cx(\"x-usage\", className)} data-state={state}>\n <div className=\"x-usage-account\">\n <span className=\"x-usage-name\">{account}</span>\n <StatusDot tone={TONE[state]} label={words[state]} />\n </div>\n {windows.length > 0 ? (\n <ul className=\"x-usage-windows\">\n {windows.map((w) => (\n <li key={w.label} className=\"x-usage-window\">\n <Meter value={w.used} label={w.label} warnAt={warnAt} />\n <span className=\"x-usage-reset\">{w.resetText}</span>\n </li>\n ))}\n </ul>\n ) : null}\n {actions ? <div className=\"x-usage-actions\">{actions}</div> : null}\n </div>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { SessionState } from \"../../types\";\nimport { StatusDot } from \"../StatusDot/StatusDot\";\n\nexport type RunStepStatus = \"pending\" | \"running\" | \"done\" | \"failed\" | \"skipped\";\n\nexport interface RunTimelineStep {\n id: string;\n label: ReactNode;\n status: RunStepStatus;\n /** When the step started, as text, already formatted (\"14:02\"). */\n at?: string;\n /** How long it took. Shown as text from `labels.duration`. */\n durationMs?: number;\n}\n\nexport interface RunTimelineLabels {\n /** Names the list for screen readers. */\n list: string;\n /** Text of each status, read by screen readers. */\n status: Record<RunStepStatus, string>;\n /** Formats a duration (\"1.2 s\", \"3 min 4 s\"). */\n duration: (ms: number) => string;\n}\n\nconst DEFAULT_LABELS: RunTimelineLabels = {\n list: \"Run steps\",\n status: { pending: \"Pending\", running: \"Running\", done: \"Done\", failed: \"Failed\", skipped: \"Skipped\" },\n duration: (ms) => {\n const total = Math.max(0, Math.round(ms / 100) / 10);\n if (total < 60) return `${total} s`;\n const s = Math.round(total);\n return `${Math.floor(s / 60)} min ${s % 60} s`;\n },\n};\n\nconst DOT: Record<RunStepStatus, SessionState> = { pending: \"idle\", running: \"working\", done: \"done\", failed: \"failed\", skipped: \"exited\" };\n\nexport interface RunTimelineProps {\n steps: RunTimelineStep[];\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<Omit<RunTimelineLabels, \"status\">> & { status?: Partial<RunTimelineLabels[\"status\"]> };\n className?: string;\n}\n\nexport function RunTimeline({ steps, labels, className }: RunTimelineProps): JSX.Element {\n const l: RunTimelineLabels = { ...DEFAULT_LABELS, ...labels, status: { ...DEFAULT_LABELS.status, ...labels?.status } };\n return (\n <ol className={cx(\"x-run-timeline\", className)} aria-label={l.list}>\n {steps.map((s) => (\n <li key={s.id} className=\"x-run-step\" data-status={s.status} aria-current={s.status === \"running\" ? \"step\" : undefined}>\n <span className=\"x-run-step-mark\">\n <StatusDot state={DOT[s.status]} pulse={s.status === \"running\"} />\n </span>\n <span className=\"x-run-step-label\">{s.label}</span>\n <span className=\"x-sr-only\">{l.status[s.status]}</span>\n {s.at ? <time className=\"x-run-step-at\">{s.at}</time> : null}\n {s.durationMs != null ? <span className=\"x-run-step-dur\">{l.duration(s.durationMs)}</span> : null}\n </li>\n ))}\n </ol>\n );\n}\n","import type { JSX, ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../Button/Button\";\nimport { Comment } from \"../Comment/Comment\";\n\nexport interface ReviewCommentLabels {\n /** Text of the line reference, e.g. \"Line 42\". */\n line: (line: number | string) => string;\n /** Heading of the suggestion block. */\n suggestion: string;\n /** Button that resolves the thread. */\n resolve: string;\n /** Button that reopens a resolved thread. */\n reopen: string;\n /** Badge on a resolved thread. */\n resolved: string;\n}\n\nconst DEFAULT_LABELS: ReviewCommentLabels = {\n line: (line) => `Line ${line}`,\n suggestion: \"Suggested change\",\n resolve: \"Resolve\",\n reopen: \"Reopen\",\n resolved: \"Resolved\",\n};\n\nexport interface ReviewCommentProps {\n /** The line the comment is on: a number or a range label (\"40-44\"). */\n line: number | string;\n /** File path shown before the line reference. */\n file?: string;\n /** Who wrote it. */\n author: string;\n /** The time as text, already formatted. */\n time?: string;\n /** The comment text. Render user text through a sanitizing renderer, never as raw HTML. */\n body?: ReactNode;\n /** The comment text as children, the same as `body` (both given: body first). */\n children?: ReactNode;\n /** Replacement code the author proposes. Shown as plain text in a code block. */\n suggestion?: string;\n /** The thread is resolved: faded body and a badge. */\n resolved?: boolean;\n /** Shows a \"Resolve\" button while the thread is open. */\n onResolve?: () => void;\n /** Shows a \"Reopen\" button once the thread is resolved. */\n onReopen?: () => void;\n /** Under the suggestion: a reply composer or the like. */\n footer?: ReactNode;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<ReviewCommentLabels>;\n className?: string;\n}\n\nexport function ReviewComment({ line, file, author, time, body, children, suggestion, resolved = false, onResolve, onReopen, footer, labels, className }: ReviewCommentProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const toggle = resolved ? onReopen : onResolve;\n const toggleLabel = resolved ? l.reopen : l.resolve;\n const where = file ? `${file} · ${l.line(line)}` : l.line(line);\n return (\n <Comment\n className={cx(\"x-review-comment\", className)}\n author={author}\n time={time}\n state={resolved ? \"resolved\" : undefined}\n stateLabel={l.resolved}\n location={<span className=\"x-review-comment-line\">{where}</span>}\n actions={\n toggle ? (\n <Button variant=\"secondary\" size=\"sm\" type=\"button\" onClick={toggle}>\n {toggleLabel}\n </Button>\n ) : undefined\n }\n footer={footer}\n >\n {body}\n {children}\n {suggestion != null ? (\n <figure className=\"x-review-suggestion\">\n <figcaption className=\"x-review-suggestion-title\">{l.suggestion}</figcaption>\n <pre className=\"x-review-suggestion-code\">\n <code>{suggestion}</code>\n </pre>\n </figure>\n ) : null}\n </Comment>\n );\n}\n","import { useId, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { foldText } from \"../../internal/text\";\nimport { NavList } from \"../NavList/NavList\";\nimport { SearchInput } from \"../SearchInput/SearchInput\";\n\nexport interface SettingsShellItem {\n id: string;\n label: string;\n /** Extra words the search matches besides the label (\"dark\", \"theme\"). */\n keywords?: string[];\n}\n\nexport interface SettingsShellGroup {\n id: string;\n label: string;\n items: SettingsShellItem[];\n}\n\nexport interface SettingsShellLabels {\n /** aria-label of the search input and its placeholder. */\n search: string;\n /** aria-label of the clear button. */\n clear: string;\n /** Result count read out after the search input. */\n count: (n: number) => string;\n /** Shown instead of the content when the query matches nothing. */\n empty: (query: string) => string;\n}\n\nconst DEFAULT_LABELS: SettingsShellLabels = {\n search: \"Search settings\",\n clear: \"Clear search\",\n count: (n) => (n === 1 ? \"1 result\" : `${n} results`),\n empty: (query) => `No settings match \"${query}\"`,\n};\n\n/** What `children` gets when it is a function. */\nexport interface SettingsShellState {\n /** The trimmed query (\"\" when none). */\n query: string;\n /** Whether the item with this id matches the query; true for every id while the query is empty. */\n visible: (id: string) => boolean;\n /** Number of matching items. */\n matches: number;\n}\n\nexport interface SettingsShellProps {\n groups: SettingsShellGroup[];\n /** Id of the selected item. */\n value: string;\n /** Called when an item is chosen, or when Enter in the search jumps to the first match. The shell then scrolls the element with that id into view. */\n onChange: (id: string) => void;\n query: string;\n onQuery: (query: string) => void;\n /** Settings rows (`SettingRow` with `id`s that match the items), or a function of the search state so rows can hide themselves. */\n children: ReactNode | ((state: SettingsShellState) => ReactNode);\n /** Sticky at the bottom of the content, usually a `SaveBar`. */\n saveBar?: ReactNode;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<SettingsShellLabels>;\n className?: string;\n}\n\n/** Whether `item` matches `query` by label or keywords, ignoring case and diacritics. An empty query matches. */\nexport function matchesSetting(item: SettingsShellItem, query: string): boolean {\n const q = foldText(query.trim());\n if (!q) return true;\n return [item.label, ...(item.keywords ?? [])].some((w) => foldText(w).includes(q));\n}\n\n/** The groups with only the matching items; groups left empty are dropped. */\nexport function filterSettingsGroups(groups: SettingsShellGroup[], query: string): SettingsShellGroup[] {\n return groups.map((g) => ({ ...g, items: g.items.filter((it) => matchesSetting(it, query)) })).filter((g) => g.items.length > 0);\n}\n\nfunction scrollToId(id: string): void {\n if (typeof document === \"undefined\") return;\n document.getElementById(id)?.scrollIntoView({ block: \"start\" });\n}\n\nexport function SettingsShell({ groups, value, onChange, query, onQuery, children, saveBar, labels, className }: SettingsShellProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const contentId = `x-settings-shell-${useId()}`;\n const q = query.trim();\n const shown = filterSettingsGroups(groups, q);\n const matches = shown.reduce((n, g) => n + g.items.length, 0);\n const ids = new Set(shown.flatMap((g) => g.items.map((it) => it.id)));\n const state: SettingsShellState = { query: q, visible: (id) => !q || ids.has(id), matches };\n const choose = (id: string): void => {\n onChange(id);\n scrollToId(id);\n };\n const onSearchKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n if (e.key === \"Enter\" && shown[0]) {\n e.preventDefault();\n const first = shown[0].items[0];\n if (first) choose(first.id);\n }\n };\n return (\n <div className={cx(\"x-settings-shell\", className)}>\n <div className=\"x-settings-shell-side\">\n <SearchInput\n value={query}\n onChange={(e) => onQuery(e.target.value)}\n onKeyDown={onSearchKeyDown}\n onClear={() => onQuery(\"\")}\n placeholder={l.search}\n aria-controls={contentId}\n count={q ? matches : undefined}\n labels={{ search: l.search, clear: l.clear, count: l.count }}\n />\n {shown.map((g) => (\n <NavList key={g.id} title={g.label} items={g.items.map((it) => ({ id: it.id, label: it.label }))} value={value} onSelect={choose} />\n ))}\n </div>\n <div className=\"x-settings-shell-main\">\n <div className=\"x-settings-shell-content\" id={contentId}>\n {q && matches === 0 ? <p className=\"x-settings-shell-empty\">{l.empty(q)}</p> : typeof children === \"function\" ? children(state) : children}\n </div>\n <div className=\"x-settings-shell-save\">{saveBar}</div>\n </div>\n </div>\n );\n}\n","import { useId, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface AgentRowLabels {\n /** Name of the details region, e.g. `Claude settings`. */\n details: (name: string) => string;\n}\n\nconst DEFAULT_LABELS: AgentRowLabels = { details: (name) => `${name} settings` };\n\nexport interface AgentRowProps {\n /** Profile name (\"Claude\", \"Codex review\"). */\n name: string;\n /** The command that starts it, shown in mono (\"claude\", \"codex --full-auto\"). */\n cli: string;\n /** What the collapsed row shows after the name: model, account. Text or a few `Tag`s. */\n summary?: ReactNode;\n /** Controlled: the body is shown. Keep at most one row open in a list. */\n expanded: boolean;\n onToggle: (expanded: boolean) => void;\n /** Buttons at the right of the head (Duplicate, Remove). Kept outside the toggle button. */\n actions?: ReactNode;\n /** The profile form, shown while expanded. */\n children?: ReactNode;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<AgentRowLabels>;\n className?: string;\n}\n\nexport function AgentRow({ name, cli, summary, expanded, onToggle, actions, children, labels, className }: AgentRowProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = `x-agent-row-${useId()}`;\n return (\n <article className={cx(\"x-agent-row\", className)} data-expanded={expanded ? \"\" : undefined}>\n <div className=\"x-agent-row-head\">\n <button type=\"button\" className=\"x-agent-row-toggle\" aria-expanded={expanded} aria-controls={`${id}-body`} onClick={() => onToggle(!expanded)}>\n <Icon name=\"chevron\" size={14} className=\"x-agent-row-chevron\" />\n <span className=\"x-agent-row-name\">{name}</span>\n <code className=\"x-agent-row-cli\">{cli}</code>\n {summary ? <span className=\"x-agent-row-summary\">{summary}</span> : null}\n </button>\n {actions ? <div className=\"x-agent-row-actions\">{actions}</div> : null}\n </div>\n <div className=\"x-agent-row-body\" id={`${id}-body`} role=\"region\" aria-label={l.details(name)} hidden={!expanded}>\n {children}\n </div>\n </article>\n );\n}\n","import { useState, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport type { IconName } from \"../../icons\";\nimport { Drawer } from \"../Drawer/Drawer\";\nimport { Icon } from \"../Icon/Icon\";\n\nexport interface BottomNavItem {\n id: string;\n label: string;\n icon: IconName;\n /** Count on the icon. 0 or undefined shows nothing; above 99 shows \"99+\". */\n badge?: number;\n}\n\nexport interface BottomNavMore {\n /** Label of the last tab, e.g. \"More\". */\n label: string;\n icon: IconName;\n /** The destinations that did not fit in the bar. */\n items: BottomNavItem[];\n}\n\nexport interface BottomNavLabels {\n /** aria-label of the nav. */\n nav: string;\n /** Spoken after the label of an item with a badge, e.g. `3 new`. */\n badge: (count: number) => string;\n}\n\nconst DEFAULT_LABELS: BottomNavLabels = { nav: \"Main\", badge: (n) => `${n} new` };\n\n/** The bar shows at most this many tabs, the \"more\" tab included. */\nexport const BOTTOM_NAV_MAX = 5;\n\nexport interface BottomNavProps {\n /** Tabs of the bar. Beyond 5 (4 with `more`) they are dropped; move the rest into `more.items`. */\n items: BottomNavItem[];\n /** Id of the current destination, in `items` or `more.items`. */\n value?: string;\n onChange: (id: string) => void;\n /** Last tab that opens a bottom sheet listing the remaining destinations. */\n more?: BottomNavMore;\n /** Controlled open state of the sheet. Default: the component keeps it. */\n moreOpen?: boolean;\n onMoreOpenChange?: (open: boolean) => void;\n /** Override the English defaults (e.g. for vi). */\n labels?: Partial<BottomNavLabels>;\n className?: string;\n}\n\nfunction Badge({ count, text }: { count?: number; text: (n: number) => string }): JSX.Element | null {\n if (!count || count < 1) return null;\n return (\n <>\n <span className=\"x-bottom-nav-badge\" aria-hidden=\"true\">\n {count > 99 ? \"99+\" : count}\n </span>\n <span className=\"x-sr-only\">{text(count)}</span>\n </>\n );\n}\n\nexport function BottomNav({ items, value, onChange, more, moreOpen, onMoreOpenChange, labels, className }: BottomNavProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const [own, setOwn] = useState(false);\n const open = Boolean(more) && (moreOpen ?? own);\n const setOpen = (next: boolean): void => {\n setOwn(next);\n onMoreOpenChange?.(next);\n };\n const shown = items.slice(0, BOTTOM_NAV_MAX - (more ? 1 : 0));\n const inMore = Boolean(more && value != null && more.items.some((it) => it.id === value));\n const tab = (it: BottomNavItem, onClick: () => void): ReactNode => (\n <button key={it.id} type=\"button\" className=\"x-bottom-nav-item\" aria-current={it.id === value ? \"page\" : undefined} onClick={onClick}>\n <span className=\"x-bottom-nav-icon\">\n <Icon name={it.icon} size={20} />\n <Badge count={it.badge} text={l.badge} />\n </span>\n <span className=\"x-bottom-nav-label\">{it.label}</span>\n </button>\n );\n const moreCount = more ? more.items.reduce((sum, it) => sum + (it.badge ?? 0), 0) : 0;\n return (\n <>\n <nav className={cx(\"x-bottom-nav\", className)} aria-label={l.nav}>\n {shown.map((it) => tab(it, () => onChange(it.id)))}\n {more ? (\n <button type=\"button\" className=\"x-bottom-nav-item\" aria-haspopup=\"dialog\" aria-expanded={open} data-current={inMore ? \"\" : undefined} onClick={() => setOpen(!open)}>\n <span className=\"x-bottom-nav-icon\">\n <Icon name={more.icon} size={20} />\n <Badge count={moreCount} text={l.badge} />\n </span>\n <span className=\"x-bottom-nav-label\">{more.label}</span>\n </button>\n ) : null}\n </nav>\n {open && more ? (\n <Drawer side=\"bottom\" title={more.label} onClose={() => setOpen(false)} className=\"x-bottom-nav-sheet\">\n <ul className=\"x-bottom-nav-list\">\n {more.items.map((it) => (\n <li key={it.id}>\n {tab({ ...it }, () => {\n onChange(it.id);\n setOpen(false);\n })}\n </li>\n ))}\n </ul>\n </Drawer>\n ) : null}\n </>\n );\n}\n"],"mappings":";;;;;;;AAKA,IAAIsG,IAAiC,MACjCC,IAAyB,MAEzBvG,IAAM,GACNyG,GACExG,oBAAY,IAAI,IAAgB;AAEtC,SAAS0G,GAAI,GAA2B;CACtC,IAAIC,MAASL,GACb;MAAUK;EACV,KAAK,IAAMC,KAAK5G,GAAW,EAAE;CADnB;AAEZ;AAEA,SAAS6G,GAAK,GAAqB;CACjC,IAAIC,MAAU/G,KAAOuG,MAAY,MAAM;CACvC,IAAMS,IAAKP;CAGX,AAFA,IAAS,KAAA,GACTE,GAAI,IAAI,GACRK,IAAK;AACP;AAEA,SAASC,KAAmC;CAC1C,IAAIX,GAAO,OAAOA;CAClB,IAAI,OAAO,QAAU,KAAa,OAAO;CACzC,IAAMY,IAAK,IAAI,MAAM;CAQrB,OAPA,EAAG,UAAU,QACbA,EAAG,iBAAiB,eAAe;EAEjC,AADA,IAAS,KAAA,GACTP,GAAI,IAAI;CACV,CAAC,GACDO,EAAG,iBAAiB,eAAeJ,GAAK9G,CAAG,CAAC,GAC5C,IAAQkH,GACDA;AACT;AAGA,SAAgBC,EAAiB,GAAY,GAAa,GAA4B;CACpF,IAAMD,IAAKD,GAAQ;CACnB,IA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