@opengeni/react 1.0.1 → 1.0.2-canary.37202341988001

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 (632) hide show
  1. package/README.md +660 -21
  2. package/dist/accounts.d.ts +64 -0
  3. package/dist/accounts.js +822 -0
  4. package/dist/accounts.js.map +1 -0
  5. package/dist/approvals.d.ts +2 -1
  6. package/dist/artifacts-document.js +3 -2
  7. package/dist/artifacts-presentation.js +3 -2
  8. package/dist/artifacts-spreadsheet.js +2 -2
  9. package/dist/artifacts.d.ts +4 -1
  10. package/dist/artifacts.js +518 -42
  11. package/dist/artifacts.js.map +1 -1
  12. package/dist/browser-viewer-SHYKQRNX.js +16 -0
  13. package/dist/capability-catalog-row.d.ts +20 -0
  14. package/dist/capability-logo-fallback.d.ts +3 -0
  15. package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
  16. package/dist/chat-interactive-block-UGBTNB3L.js.map +1 -0
  17. package/dist/chunk-26ZNDDLZ.js +453 -0
  18. package/dist/chunk-26ZNDDLZ.js.map +1 -0
  19. package/dist/chunk-3CTRFMAK.js +359 -0
  20. package/dist/chunk-3CTRFMAK.js.map +1 -0
  21. package/dist/chunk-447JLCBU.js +209 -0
  22. package/dist/chunk-447JLCBU.js.map +1 -0
  23. package/dist/chunk-4RVYOY4O.js +379 -0
  24. package/dist/chunk-4RVYOY4O.js.map +1 -0
  25. package/dist/chunk-5CVXZA3Y.js +292 -0
  26. package/dist/chunk-5CVXZA3Y.js.map +1 -0
  27. package/dist/chunk-5J4FOW6Q.js +108 -0
  28. package/dist/chunk-5J4FOW6Q.js.map +1 -0
  29. package/dist/chunk-742CZ3L3.js +481 -0
  30. package/dist/chunk-742CZ3L3.js.map +1 -0
  31. package/dist/chunk-A2PI6UMY.js +41 -0
  32. package/dist/chunk-A2PI6UMY.js.map +1 -0
  33. package/dist/{chunk-7WCLAEFV.js → chunk-A4UJB2MM.js} +37 -27
  34. package/dist/chunk-A4UJB2MM.js.map +1 -0
  35. package/dist/chunk-B3V6TG77.js +41 -0
  36. package/dist/chunk-B3V6TG77.js.map +1 -0
  37. package/dist/chunk-BRM6FVZA.js +302 -0
  38. package/dist/chunk-BRM6FVZA.js.map +1 -0
  39. package/dist/chunk-C5X5AJXK.js +182 -0
  40. package/dist/chunk-C5X5AJXK.js.map +1 -0
  41. package/dist/{chunk-6KLX2RH5.js → chunk-DO544OSV.js} +1075 -79
  42. package/dist/chunk-DO544OSV.js.map +1 -0
  43. package/dist/{chunk-R3AZOAB5.js → chunk-DYWBUX5Q.js} +29 -123
  44. package/dist/chunk-DYWBUX5Q.js.map +1 -0
  45. package/dist/{chunk-HA46CYQK.js → chunk-EESD3PY3.js} +792 -537
  46. package/dist/chunk-EESD3PY3.js.map +1 -0
  47. package/dist/{chunk-5UQPNLIO.js → chunk-EN3YTHKR.js} +4117 -3896
  48. package/dist/chunk-EN3YTHKR.js.map +1 -0
  49. package/dist/chunk-ERGYJIBB.js +21 -0
  50. package/dist/chunk-ERGYJIBB.js.map +1 -0
  51. package/dist/chunk-FZCP527Y.js +116 -0
  52. package/dist/chunk-FZCP527Y.js.map +1 -0
  53. package/dist/chunk-GIMRELBW.js +14 -0
  54. package/dist/chunk-GIMRELBW.js.map +1 -0
  55. package/dist/chunk-GYVRFZDY.js +2733 -0
  56. package/dist/chunk-GYVRFZDY.js.map +1 -0
  57. package/dist/{chunk-LLOLUHVG.js → chunk-HDJWDK7W.js} +1358 -2746
  58. package/dist/chunk-HDJWDK7W.js.map +1 -0
  59. package/dist/chunk-I7IWRQLN.js +1608 -0
  60. package/dist/chunk-I7IWRQLN.js.map +1 -0
  61. package/dist/chunk-IT4BJUGF.js +13055 -0
  62. package/dist/chunk-IT4BJUGF.js.map +1 -0
  63. package/dist/chunk-IWIDV7SB.js +1 -0
  64. package/dist/chunk-IWIDV7SB.js.map +1 -0
  65. package/dist/chunk-J2QWVSQY.js +312 -0
  66. package/dist/chunk-J2QWVSQY.js.map +1 -0
  67. package/dist/chunk-J6DBS4T3.js +371 -0
  68. package/dist/chunk-J6DBS4T3.js.map +1 -0
  69. package/dist/{chunk-B6WPZSTT.js → chunk-JIQYUGVL.js} +1331 -1163
  70. package/dist/chunk-JIQYUGVL.js.map +1 -0
  71. package/dist/chunk-JT4JW7BC.js +54 -0
  72. package/dist/chunk-JT4JW7BC.js.map +1 -0
  73. package/dist/chunk-K3HQAKQX.js +24 -0
  74. package/dist/chunk-K3HQAKQX.js.map +1 -0
  75. package/dist/{chunk-PEI6RANI.js → chunk-PNY3JKBJ.js} +309 -74
  76. package/dist/chunk-PNY3JKBJ.js.map +1 -0
  77. package/dist/chunk-RHREZ7BO.js +11 -0
  78. package/dist/chunk-RHREZ7BO.js.map +1 -0
  79. package/dist/chunk-RLUSC2WA.js +299 -0
  80. package/dist/chunk-RLUSC2WA.js.map +1 -0
  81. package/dist/{chunk-IGC6A2ZI.js → chunk-RSI7XYXL.js} +777 -246
  82. package/dist/chunk-RSI7XYXL.js.map +1 -0
  83. package/dist/chunk-SCOTPE2I.js +589 -0
  84. package/dist/chunk-SCOTPE2I.js.map +1 -0
  85. package/dist/{chunk-C5ZPSSS5.js → chunk-TKOTKRWY.js} +5 -4
  86. package/dist/{chunk-C5ZPSSS5.js.map → chunk-TKOTKRWY.js.map} +1 -1
  87. package/dist/chunk-TMYGL6X5.js +742 -0
  88. package/dist/chunk-TMYGL6X5.js.map +1 -0
  89. package/dist/chunk-UGLEYEMP.js +33 -0
  90. package/dist/chunk-UGLEYEMP.js.map +1 -0
  91. package/dist/chunk-UK4TINKT.js +27 -0
  92. package/dist/chunk-UK4TINKT.js.map +1 -0
  93. package/dist/chunk-UTRTG6LH.js +220 -0
  94. package/dist/chunk-UTRTG6LH.js.map +1 -0
  95. package/dist/chunk-WEHMPOXK.js +39 -0
  96. package/dist/chunk-WEHMPOXK.js.map +1 -0
  97. package/dist/chunk-WGXVEJO5.js +319 -0
  98. package/dist/chunk-WGXVEJO5.js.map +1 -0
  99. package/dist/chunk-WRHIZYZF.js +988 -0
  100. package/dist/chunk-WRHIZYZF.js.map +1 -0
  101. package/dist/{chunk-HUIKIDM5.js → chunk-WUISZ3WU.js} +223 -115
  102. package/dist/chunk-WUISZ3WU.js.map +1 -0
  103. package/dist/chunk-XCHWDJ22.js +107 -0
  104. package/dist/chunk-XCHWDJ22.js.map +1 -0
  105. package/dist/{chunk-KCGXPP5V.js → chunk-Y2PRMYLC.js} +11 -6
  106. package/dist/chunk-Y2PRMYLC.js.map +1 -0
  107. package/dist/chunk-YBXQDQFX.js +1772 -0
  108. package/dist/chunk-YBXQDQFX.js.map +1 -0
  109. package/dist/chunk-YM2DE7BQ.js +3124 -0
  110. package/dist/chunk-YM2DE7BQ.js.map +1 -0
  111. package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
  112. package/dist/chunk-YQEAA6LT.js.map +1 -0
  113. package/dist/chunk-YV4L3ILF.js +9 -0
  114. package/dist/chunk-YV4L3ILF.js.map +1 -0
  115. package/dist/chunk-ZYRGEKWS.js +216 -0
  116. package/dist/chunk-ZYRGEKWS.js.map +1 -0
  117. package/dist/client.d.ts +7 -4
  118. package/dist/clipboard.js +1 -0
  119. package/dist/commands/types.d.ts +2 -0
  120. package/dist/components/anthropic-mark.d.ts +3 -0
  121. package/dist/components/approval-surface.d.ts +15 -0
  122. package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
  123. package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
  124. package/dist/components/artifacts/artifact-surface.d.ts +3 -1
  125. package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
  126. package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
  127. package/dist/components/artifacts/document-editor.d.ts +4 -2
  128. package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
  129. package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
  130. package/dist/components/artifacts/editable-document.d.ts +1 -1
  131. package/dist/components/artifacts/editable-presentation.d.ts +2 -2
  132. package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
  133. package/dist/components/artifacts/index.d.ts +8 -1
  134. package/dist/components/artifacts/inline-html-document.d.ts +2 -0
  135. package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
  136. package/dist/components/artifacts/presentation-editor.d.ts +6 -2
  137. package/dist/components/artifacts/published-html-artifact-frame.d.ts +48 -3
  138. package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
  139. package/dist/components/artifacts/site-view.d.ts +23 -0
  140. package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
  141. package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
  142. package/dist/components/browser-select-control.d.ts +16 -0
  143. package/dist/components/browser-viewer.d.ts +10 -1
  144. package/dist/components/chat-composer.d.ts +21 -3
  145. package/dist/components/child-session-link.d.ts +5 -0
  146. package/dist/components/claude-mark.d.ts +3 -0
  147. package/dist/components/code-editor.d.ts +1 -4
  148. package/dist/components/composer.d.ts +45 -4
  149. package/dist/components/computer-viewer.d.ts +4 -1
  150. package/dist/components/copy-button.d.ts +3 -1
  151. package/dist/components/desktop-viewer.d.ts +1 -1
  152. package/dist/components/enrollment-consent.d.ts +6 -3
  153. package/dist/components/file-browser.d.ts +10 -1
  154. package/dist/components/fleet-tile.d.ts +2 -2
  155. package/dist/components/grok-mark.d.ts +26 -0
  156. package/dist/components/human-input-form.d.ts +21 -2
  157. package/dist/components/human-input-surface.d.ts +6 -3
  158. package/dist/components/machine-card.d.ts +4 -1
  159. package/dist/components/machines/machine-detail.d.ts +4 -1
  160. package/dist/components/machines/machine-operation-policy.d.ts +11 -0
  161. package/dist/components/machines-dashboard.d.ts +3 -1
  162. package/dist/components/markdown-table-layout.d.ts +12 -0
  163. package/dist/components/markdown.d.ts +47 -3
  164. package/dist/components/message-timeline.d.ts +72 -9
  165. package/dist/components/model-mark.d.ts +29 -0
  166. package/dist/components/model-policy-picker-menu.d.ts +9 -0
  167. package/dist/components/model-policy-picker.d.ts +62 -13
  168. package/dist/components/open-geni-chat.d.ts +58 -0
  169. package/dist/components/open-geni-links.d.ts +68 -0
  170. package/dist/components/openrouter-mark.d.ts +6 -0
  171. package/dist/components/pierre-file.d.ts +1 -1
  172. package/dist/components/preview-loading.d.ts +2 -0
  173. package/dist/components/queue-item-content.d.ts +9 -0
  174. package/dist/components/sandbox-files.d.ts +13 -2
  175. package/dist/components/sandbox-workspace.d.ts +43 -3
  176. package/dist/components/session-capability-frame.d.ts +35 -0
  177. package/dist/components/session-chrome.d.ts +66 -8
  178. package/dist/components/session-commands-panel.d.ts +6 -0
  179. package/dist/components/session-commands.d.ts +6 -0
  180. package/dist/components/session-connection-request.d.ts +8 -0
  181. package/dist/components/session-conversation.d.ts +89 -0
  182. package/dist/components/session-list.d.ts +36 -0
  183. package/dist/components/session-mcp-capability-card.d.ts +41 -0
  184. package/dist/components/session-proxy-scope.d.ts +21 -0
  185. package/dist/components/timeline-anchor.d.ts +24 -0
  186. package/dist/components/timeline-annotation-chrome.d.ts +25 -0
  187. package/dist/components/timeline-annotation-layout.d.ts +42 -0
  188. package/dist/components/timeline-annotation-markers.d.ts +8 -0
  189. package/dist/components/timeline-annotation-reveal-context.d.ts +4 -0
  190. package/dist/components/timeline-annotation-shared.d.ts +31 -0
  191. package/dist/components/timeline-annotations-dialog.d.ts +3 -2
  192. package/dist/components/timeline-annotations.d.ts +13 -3
  193. package/dist/components/timeline-reading-progress.d.ts +11 -0
  194. package/dist/components/timeline-search.d.ts +34 -0
  195. package/dist/components/timeline-settlement.d.ts +16 -0
  196. package/dist/components/tip-follow.d.ts +16 -0
  197. package/dist/components/usage-limit-notice.d.ts +49 -0
  198. package/dist/components/usage-member-list.d.ts +91 -0
  199. package/dist/components/usage-meter.d.ts +73 -0
  200. package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
  201. package/dist/components/user-message-body.d.ts +10 -1
  202. package/dist/components/workspace-dock.d.ts +6 -2
  203. package/dist/composer.d.ts +5 -4
  204. package/dist/composer.js +15 -9
  205. package/dist/computer-viewer-6SRGWRUX.js +19 -0
  206. package/dist/computer-viewer-6SRGWRUX.js.map +1 -0
  207. package/dist/connect-account-identity.d.ts +8 -0
  208. package/dist/connect-accounts.d.ts +15 -0
  209. package/dist/connect-chooser.d.ts +18 -0
  210. package/dist/connect-panel.d.ts +18 -0
  211. package/dist/connect-setup.d.ts +16 -0
  212. package/dist/connect.d.ts +21 -0
  213. package/dist/connect.js +2129 -0
  214. package/dist/connect.js.map +1 -0
  215. package/dist/connection-catalog.d.ts +38 -0
  216. package/dist/connection-discovery.d.ts +12 -0
  217. package/dist/connection-installed.d.ts +17 -0
  218. package/dist/connection-logo.d.ts +9 -0
  219. package/dist/connection-service-logo.d.ts +8 -0
  220. package/dist/connection-service-presentation.d.ts +13 -0
  221. package/dist/connection-skeleton.d.ts +5 -0
  222. package/dist/connection-type-picker.d.ts +6 -0
  223. package/dist/conversation-timeline.d.ts +5 -0
  224. package/dist/desktop.d.ts +7 -0
  225. package/dist/desktop.js +26 -0
  226. package/dist/desktop.js.map +1 -0
  227. package/dist/device-authorization.d.ts +23 -0
  228. package/dist/diffs.d.ts +8 -0
  229. package/dist/diffs.js +14 -0
  230. package/dist/diffs.js.map +1 -0
  231. package/dist/discovery-cache.d.ts +5 -0
  232. package/dist/editor.d.ts +7 -0
  233. package/dist/editor.js +21 -0
  234. package/dist/editor.js.map +1 -0
  235. package/dist/embedded-session-client.d.ts +23 -0
  236. package/dist/file-node-visibility.d.ts +15 -0
  237. package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
  238. package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
  239. package/dist/hooks/channel-cache.d.ts +23 -0
  240. package/dist/hooks/latest-question.d.ts +25 -0
  241. package/dist/hooks/shared-machines-list.d.ts +14 -0
  242. package/dist/hooks/use-attached-browsers.d.ts +2 -1
  243. package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
  244. package/dist/hooks/use-browser-session.d.ts +12 -1
  245. package/dist/hooks/use-channels.d.ts +1 -0
  246. package/dist/hooks/use-codex-accounts.d.ts +25 -7
  247. package/dist/hooks/use-composer.d.ts +45 -9
  248. package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
  249. package/dist/hooks/use-computer-input-posture.d.ts +13 -0
  250. package/dist/hooks/use-computer-session.d.ts +2 -0
  251. package/dist/hooks/use-connect.d.ts +22 -0
  252. package/dist/hooks/use-desktop-stream.d.ts +1 -1
  253. package/dist/hooks/use-file-attachments.d.ts +21 -2
  254. package/dist/hooks/use-machine-chip.d.ts +3 -3
  255. package/dist/hooks/use-machines.d.ts +19 -1
  256. package/dist/hooks/use-sandbox-files.d.ts +5 -1
  257. package/dist/hooks/use-session-background-commands.d.ts +14 -0
  258. package/dist/hooks/use-session-events.d.ts +30 -8
  259. package/dist/hooks/use-session-lineage.d.ts +4 -0
  260. package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
  261. package/dist/hooks/use-session.d.ts +6 -0
  262. package/dist/hooks/use-turn-queue.d.ts +12 -0
  263. package/dist/hooks/use-usage.d.ts +40 -0
  264. package/dist/hooks/use-workspace-edit.d.ts +4 -0
  265. package/dist/hooks/use-workspace-sessions.d.ts +27 -5
  266. package/dist/human-input.d.ts +3 -1
  267. package/dist/identity-link-accounts.d.ts +11 -0
  268. package/dist/identity-link-consent.d.ts +18 -0
  269. package/dist/index.d.ts +60 -17
  270. package/dist/index.js +2238 -6201
  271. package/dist/index.js.map +1 -1
  272. package/dist/interaction.d.ts +1 -1
  273. package/dist/interaction.js +35 -184
  274. package/dist/interaction.js.map +1 -1
  275. package/dist/latest-question-HTRIS4KJ.js +117 -0
  276. package/dist/latest-question-HTRIS4KJ.js.map +1 -0
  277. package/dist/lib/error-message.d.ts +7 -0
  278. package/dist/lib/format.d.ts +36 -2
  279. package/dist/lib/host-theme.d.ts +70 -0
  280. package/dist/lib/interaction-errors.d.ts +6 -0
  281. package/dist/lib/menu-styles.d.ts +22 -0
  282. package/dist/lib/pierre-diffs-loader.d.ts +20 -0
  283. package/dist/lib/workbench-peers.d.ts +36 -0
  284. package/dist/lib/xterm-theme.d.ts +7 -5
  285. package/dist/machines.d.ts +4 -2
  286. package/dist/machines.js +14 -4
  287. package/dist/markdown-table-layout-QXSLK4BY.js +106 -0
  288. package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
  289. package/dist/mcp-connection-status.d.ts +14 -0
  290. package/dist/model-policy-picker-menu-M54ISBMN.js +14 -0
  291. package/dist/model-policy-picker-menu-M54ISBMN.js.map +1 -0
  292. package/dist/model-policy.d.ts +19 -3
  293. package/dist/model-policy.js +9 -1
  294. package/dist/older-history.d.ts +30 -0
  295. package/dist/platform-activity-row-627BFZ46.js +182 -0
  296. package/dist/platform-activity-row-627BFZ46.js.map +1 -0
  297. package/dist/plugin-details.d.ts +14 -0
  298. package/dist/plugin-discovery.d.ts +25 -0
  299. package/dist/provider.d.ts +13 -1
  300. package/dist/{queue-surface-implementation-2KVJTYXH.js → queue-surface-implementation-ZHFI5JBP.js} +131 -44
  301. package/dist/queue-surface-implementation-ZHFI5JBP.js.map +1 -0
  302. package/dist/realtime/realtime-control.d.ts +6 -3
  303. package/dist/realtime.js +133 -74
  304. package/dist/realtime.js.map +1 -1
  305. package/dist/sandbox-files-GORZOUUJ.js +20 -0
  306. package/dist/sandbox-files-GORZOUUJ.js.map +1 -0
  307. package/dist/session-auth-recommendation.d.ts +5 -0
  308. package/dist/session-capability-policy.d.ts +12 -0
  309. package/dist/session-ui.d.ts +30 -2
  310. package/dist/session-ui.js +85 -7
  311. package/dist/session-ui.js.map +1 -1
  312. package/dist/session.d.ts +8 -2
  313. package/dist/session.js +30 -19
  314. package/dist/sites-ui.d.ts +34 -0
  315. package/dist/sites.d.ts +3 -0
  316. package/dist/sites.js +11 -0
  317. package/dist/sites.js.map +1 -0
  318. package/dist/skill-discovery.d.ts +47 -0
  319. package/dist/terminal.d.ts +8 -0
  320. package/dist/terminal.js +31 -0
  321. package/dist/terminal.js.map +1 -0
  322. package/dist/timeline/activity-rail.d.ts +11 -2
  323. package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
  324. package/dist/timeline/compaction-copy.d.ts +10 -0
  325. package/dist/timeline/entrance.d.ts +13 -1
  326. package/dist/timeline/genie-loading.d.ts +34 -0
  327. package/dist/timeline/index.d.ts +6 -2
  328. package/dist/timeline/knowledge-receipt.d.ts +17 -0
  329. package/dist/timeline/platform-activity-row.d.ts +14 -0
  330. package/dist/timeline/presented-image.d.ts +6 -0
  331. package/dist/timeline/projection.d.ts +31 -2
  332. package/dist/timeline/registry.d.ts +2 -0
  333. package/dist/timeline/retained-image.d.ts +18 -0
  334. package/dist/timeline/rolling-activity.d.ts +11 -0
  335. package/dist/timeline/screenshot-lightbox.d.ts +16 -1
  336. package/dist/timeline/shared.d.ts +8 -3
  337. package/dist/timeline/startup-preference.d.ts +3 -0
  338. package/dist/timeline/startup-timings.d.ts +4 -0
  339. package/dist/timeline/tool-display-name.d.ts +2 -1
  340. package/dist/timeline/turn-summary.d.ts +34 -3
  341. package/dist/timeline/types.d.ts +147 -7
  342. package/dist/timeline-annotation-markers-GNDHTGBD.js +165 -0
  343. package/dist/timeline-annotation-markers-GNDHTGBD.js.map +1 -0
  344. package/dist/timeline-annotation-selection-DMLMM2TX.js +241 -0
  345. package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
  346. package/dist/timeline-annotations-dialog-ELRDBHTS.js +273 -0
  347. package/dist/timeline-annotations-dialog-ELRDBHTS.js.map +1 -0
  348. package/dist/types/machines.d.ts +2 -2
  349. package/dist/usage/allowance-copy.d.ts +25 -0
  350. package/dist/usage/summary.d.ts +35 -0
  351. package/dist/usage.d.ts +13 -0
  352. package/dist/usage.js +1074 -0
  353. package/dist/usage.js.map +1 -0
  354. package/package.json +44 -4
  355. package/src/accounts.tsx +1072 -0
  356. package/src/approvals.ts +8 -1
  357. package/src/artifacts.ts +42 -0
  358. package/src/assets/README.md +8 -0
  359. package/src/assets/gmail.ico +0 -0
  360. package/src/assets/outlook.ico +0 -0
  361. package/src/capability-catalog-row.tsx +94 -0
  362. package/src/capability-logo-fallback.ts +22 -0
  363. package/src/client.ts +22 -13
  364. package/src/commands/registry.ts +18 -15
  365. package/src/commands/types.ts +2 -0
  366. package/src/components/anthropic-mark.tsx +10 -0
  367. package/src/components/approval-surface.tsx +171 -37
  368. package/src/components/artifacts/artifact-chrome.tsx +413 -0
  369. package/src/components/artifacts/artifact-sandbox.tsx +185 -0
  370. package/src/components/artifacts/artifact-surface.tsx +39 -19
  371. package/src/components/artifacts/chat-interactive-block.tsx +260 -0
  372. package/src/components/artifacts/deferred-chat-media.tsx +67 -0
  373. package/src/components/artifacts/document-editor.tsx +141 -16
  374. package/src/components/artifacts/editable-artifact-ui.tsx +4 -2
  375. package/src/components/artifacts/editable-artifact-view.tsx +187 -0
  376. package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
  377. package/src/components/artifacts/editable-document.tsx +37 -36
  378. package/src/components/artifacts/editable-presentation.tsx +36 -18
  379. package/src/components/artifacts/editable-spreadsheet.tsx +5 -2
  380. package/src/components/artifacts/index.ts +44 -0
  381. package/src/components/artifacts/inline-html-document.ts +24 -0
  382. package/src/components/artifacts/latest-task-runner.ts +49 -0
  383. package/src/components/artifacts/presentation-editor.tsx +323 -67
  384. package/src/components/artifacts/published-html-artifact-frame.tsx +338 -5
  385. package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
  386. package/src/components/artifacts/site-view.tsx +116 -0
  387. package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
  388. package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
  389. package/src/components/artifacts/spreadsheet-grid.tsx +12 -13
  390. package/src/components/artifacts/visualization-assets/base.css +1015 -0
  391. package/src/components/artifacts/visualization-assets/helpers.html +349 -0
  392. package/src/components/artifacts/visualization-assets.gen.ts +3 -0
  393. package/src/components/browser-select-control.tsx +312 -0
  394. package/src/components/browser-viewer.tsx +1054 -314
  395. package/src/components/chat-composer.tsx +131 -85
  396. package/src/components/child-session-link.tsx +27 -0
  397. package/src/components/claude-mark.tsx +10 -0
  398. package/src/components/code-editor.tsx +13 -16
  399. package/src/components/composer-transcription-control.tsx +7 -5
  400. package/src/components/composer.tsx +376 -49
  401. package/src/components/computer-viewer.tsx +1041 -329
  402. package/src/components/copy-button.tsx +13 -5
  403. package/src/components/desktop-viewer.tsx +1 -1
  404. package/src/components/enrollment-consent.tsx +65 -7
  405. package/src/components/enrollment-device-flow.tsx +1 -1
  406. package/src/components/file-browser.tsx +158 -34
  407. package/src/components/fleet-tile.tsx +8 -16
  408. package/src/components/generated-video-player.tsx +4 -2
  409. package/src/components/grok-mark.tsx +33 -0
  410. package/src/components/human-input-form.tsx +455 -114
  411. package/src/components/human-input-surface.tsx +18 -7
  412. package/src/components/interaction-intervention-banner.tsx +2 -2
  413. package/src/components/machine-card.tsx +119 -4
  414. package/src/components/machine-dock-bar.tsx +1 -1
  415. package/src/components/machine-input-display.ts +23 -2
  416. package/src/components/machines/machine-detail.tsx +52 -2
  417. package/src/components/machines/machine-operation-policy.tsx +179 -0
  418. package/src/components/machines-dashboard.tsx +8 -17
  419. package/src/components/markdown-table-layout.ts +132 -0
  420. package/src/components/markdown.tsx +473 -44
  421. package/src/components/message-timeline.tsx +2754 -665
  422. package/src/components/model-mark.tsx +90 -0
  423. package/src/components/model-picker.tsx +15 -4
  424. package/src/components/model-policy-picker-menu.tsx +424 -0
  425. package/src/components/model-policy-picker.tsx +337 -381
  426. package/src/components/open-geni-chat.tsx +338 -0
  427. package/src/components/open-geni-links.tsx +179 -0
  428. package/src/components/openrouter-mark.tsx +13 -0
  429. package/src/components/pierre-diff.tsx +41 -16
  430. package/src/components/pierre-file.tsx +36 -11
  431. package/src/components/preview-loading.tsx +154 -0
  432. package/src/components/queue-item-content.ts +14 -0
  433. package/src/components/queue-surface-implementation.tsx +132 -42
  434. package/src/components/queue-surface-state.tsx +3 -1
  435. package/src/components/sandbox-files.tsx +267 -35
  436. package/src/components/sandbox-terminal.tsx +48 -11
  437. package/src/components/sandbox-workspace.tsx +337 -135
  438. package/src/components/session-capability-frame.tsx +192 -0
  439. package/src/components/session-chrome.tsx +1027 -328
  440. package/src/components/session-commands-panel.tsx +126 -0
  441. package/src/components/session-commands.tsx +18 -0
  442. package/src/components/session-connection-request.tsx +97 -0
  443. package/src/components/session-conversation.tsx +526 -0
  444. package/src/components/session-list.tsx +250 -0
  445. package/src/components/session-mcp-capability-card.tsx +680 -0
  446. package/src/components/session-proxy-scope.tsx +92 -0
  447. package/src/components/session-status.tsx +1 -1
  448. package/src/components/timeline-anchor.tsx +119 -0
  449. package/src/components/timeline-annotation-chrome.tsx +196 -0
  450. package/src/components/timeline-annotation-layout.ts +268 -0
  451. package/src/components/timeline-annotation-markers.tsx +185 -0
  452. package/src/components/timeline-annotation-reveal-context.ts +9 -0
  453. package/src/components/timeline-annotation-selection.tsx +106 -54
  454. package/src/components/timeline-annotation-shared.ts +245 -0
  455. package/src/components/timeline-annotations-dialog.tsx +185 -128
  456. package/src/components/timeline-annotations.tsx +189 -45
  457. package/src/components/timeline-reading-progress.ts +80 -0
  458. package/src/components/timeline-search.tsx +168 -0
  459. package/src/components/timeline-settlement.ts +60 -0
  460. package/src/components/tip-follow.ts +70 -7
  461. package/src/components/tooltip.tsx +38 -5
  462. package/src/components/usage-limit-notice.tsx +179 -0
  463. package/src/components/usage-member-list.tsx +792 -0
  464. package/src/components/usage-meter.tsx +382 -0
  465. package/src/components/use-viewer-menu-dismiss.ts +33 -0
  466. package/src/components/user-message-body.tsx +194 -49
  467. package/src/components/workspace-dock.tsx +141 -175
  468. package/src/composer.ts +6 -1
  469. package/src/connect-account-identity.tsx +34 -0
  470. package/src/connect-accounts.tsx +233 -0
  471. package/src/connect-chooser.tsx +336 -0
  472. package/src/connect-panel.tsx +99 -0
  473. package/src/connect-setup.tsx +307 -0
  474. package/src/connect.ts +60 -0
  475. package/src/connection-assets.d.ts +4 -0
  476. package/src/connection-catalog.tsx +162 -0
  477. package/src/connection-discovery.tsx +235 -0
  478. package/src/connection-installed.tsx +51 -0
  479. package/src/connection-logo.tsx +37 -0
  480. package/src/connection-service-logo.tsx +55 -0
  481. package/src/connection-service-presentation.ts +46 -0
  482. package/src/connection-skeleton.tsx +16 -0
  483. package/src/connection-type-picker.tsx +36 -0
  484. package/src/conversation-timeline.ts +92 -0
  485. package/src/desktop.ts +24 -0
  486. package/src/device-authorization.tsx +98 -0
  487. package/src/diffs.ts +16 -0
  488. package/src/discovery-cache.ts +42 -0
  489. package/src/editor.ts +13 -0
  490. package/src/embedded-session-client.ts +104 -0
  491. package/src/file-node-visibility.ts +66 -0
  492. package/src/hooks/channel-cache.ts +104 -0
  493. package/src/hooks/internal.ts +3 -2
  494. package/src/hooks/latest-question.ts +164 -0
  495. package/src/hooks/shared-machines-list.ts +239 -0
  496. package/src/hooks/use-attached-browsers.ts +5 -1
  497. package/src/hooks/use-available-models.ts +20 -14
  498. package/src/hooks/use-browser-frame-stream.ts +25 -3
  499. package/src/hooks/use-browser-session.ts +271 -71
  500. package/src/hooks/use-browser-sessions.ts +7 -1
  501. package/src/hooks/use-channels.ts +32 -10
  502. package/src/hooks/use-codex-accounts.ts +78 -21
  503. package/src/hooks/use-composer.ts +1034 -320
  504. package/src/hooks/use-computer-frame-stream.ts +39 -16
  505. package/src/hooks/use-computer-input-posture.ts +94 -0
  506. package/src/hooks/use-computer-session.ts +110 -32
  507. package/src/hooks/use-computer-sessions.ts +8 -1
  508. package/src/hooks/use-connect.ts +23 -0
  509. package/src/hooks/use-desktop-stream.ts +19 -28
  510. package/src/hooks/use-file-attachments.ts +118 -10
  511. package/src/hooks/use-goal.ts +36 -9
  512. package/src/hooks/use-human-input.ts +31 -4
  513. package/src/hooks/use-last-started-turn-policy.ts +15 -13
  514. package/src/hooks/use-machine-chip.ts +23 -6
  515. package/src/hooks/use-machines.ts +104 -6
  516. package/src/hooks/use-sandbox-files.ts +253 -150
  517. package/src/hooks/use-sandbox-git.ts +58 -29
  518. package/src/hooks/use-session-background-commands.ts +67 -0
  519. package/src/hooks/use-session-capabilities.ts +21 -2
  520. package/src/hooks/use-session-events.ts +759 -433
  521. package/src/hooks/use-session-lineage.ts +28 -6
  522. package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
  523. package/src/hooks/use-session.ts +75 -16
  524. package/src/hooks/use-slash-commands.ts +6 -11
  525. package/src/hooks/use-turn-queue.ts +113 -13
  526. package/src/hooks/use-usage.ts +100 -0
  527. package/src/hooks/use-video-artifact-playback.ts +1 -1
  528. package/src/hooks/use-voice-input.ts +12 -1
  529. package/src/hooks/use-workspace-capture.ts +3 -2
  530. package/src/hooks/use-workspace-edit.ts +23 -5
  531. package/src/hooks/use-workspace-sessions.ts +99 -11
  532. package/src/human-input.ts +12 -1
  533. package/src/identity-link-accounts.tsx +148 -0
  534. package/src/identity-link-consent.tsx +192 -0
  535. package/src/index.ts +157 -12
  536. package/src/interaction.ts +1 -0
  537. package/src/lib/error-message.ts +37 -0
  538. package/src/lib/format.ts +150 -14
  539. package/src/lib/host-theme.ts +511 -0
  540. package/src/lib/interaction-errors.ts +33 -0
  541. package/src/lib/menu-styles.ts +44 -0
  542. package/src/lib/pierre-diffs-loader.ts +53 -0
  543. package/src/lib/workbench-peers.ts +62 -0
  544. package/src/lib/xterm-theme.ts +23 -21
  545. package/src/machines.ts +9 -1
  546. package/src/mcp-connection-status.ts +35 -0
  547. package/src/model-policy.ts +223 -69
  548. package/src/older-history.ts +87 -0
  549. package/src/plugin-details.tsx +185 -0
  550. package/src/plugin-discovery.tsx +196 -0
  551. package/src/provider.tsx +55 -14
  552. package/src/realtime/dropdown-menu.tsx +19 -12
  553. package/src/realtime/realtime-control.tsx +133 -46
  554. package/src/session-auth-recommendation.ts +48 -0
  555. package/src/session-capability-policy.ts +83 -0
  556. package/src/session-context.ts +4 -3
  557. package/src/session-ui.ts +66 -2
  558. package/src/session.ts +18 -1
  559. package/src/sites-ui.tsx +402 -0
  560. package/src/sites.ts +3 -0
  561. package/src/skill-discovery.tsx +208 -0
  562. package/src/terminal.ts +26 -0
  563. package/src/timeline/activity-rail.tsx +171 -80
  564. package/src/timeline/allowance-exhausted-row.tsx +86 -0
  565. package/src/timeline/compaction-copy.ts +42 -0
  566. package/src/timeline/entrance.tsx +28 -3
  567. package/src/timeline/fleet-decision-projection.ts +2 -1
  568. package/src/timeline/fleet-decision-row.tsx +1 -0
  569. package/src/timeline/genie-loading.tsx +136 -0
  570. package/src/timeline/index.ts +11 -0
  571. package/src/timeline/knowledge-receipt.tsx +100 -0
  572. package/src/timeline/parsers.ts +2 -2
  573. package/src/timeline/platform-activity-row.tsx +216 -0
  574. package/src/timeline/presented-image.ts +49 -0
  575. package/src/timeline/projection.ts +1609 -84
  576. package/src/timeline/registry.ts +15 -3
  577. package/src/timeline/retained-image.ts +97 -0
  578. package/src/timeline/rolling-activity.tsx +92 -0
  579. package/src/timeline/screenshot-lightbox.tsx +115 -17
  580. package/src/timeline/shared.tsx +47 -15
  581. package/src/timeline/startup-preference.ts +33 -0
  582. package/src/timeline/startup-timings.tsx +145 -0
  583. package/src/timeline/tool-display-name.ts +8 -6
  584. package/src/timeline/tool-renderers.tsx +497 -128
  585. package/src/timeline/turn-summary.tsx +218 -44
  586. package/src/timeline/types.ts +192 -7
  587. package/src/types/machines.ts +10 -0
  588. package/src/usage/allowance-copy.ts +64 -0
  589. package/src/usage/summary.ts +93 -0
  590. package/src/usage.ts +50 -0
  591. package/styles/compiled.css +2098 -757
  592. package/styles/connect.css +284 -0
  593. package/styles/connect.d.ts +1 -0
  594. package/styles/effective-tokens.css +1 -0
  595. package/styles/index.css +201 -9
  596. package/styles/responsive.css +27 -1
  597. package/styles/session-capability.css +44 -0
  598. package/styles/tokens.css +135 -65
  599. package/dist/chunk-5UQPNLIO.js.map +0 -1
  600. package/dist/chunk-6KLX2RH5.js.map +0 -1
  601. package/dist/chunk-7WCLAEFV.js.map +0 -1
  602. package/dist/chunk-B6WPZSTT.js.map +0 -1
  603. package/dist/chunk-FK6VG4LL.js +0 -90
  604. package/dist/chunk-FK6VG4LL.js.map +0 -1
  605. package/dist/chunk-HA46CYQK.js.map +0 -1
  606. package/dist/chunk-HUIKIDM5.js.map +0 -1
  607. package/dist/chunk-IGC6A2ZI.js.map +0 -1
  608. package/dist/chunk-KCGXPP5V.js.map +0 -1
  609. package/dist/chunk-KZ73RL76.js.map +0 -1
  610. package/dist/chunk-LAKLF4PA.js +0 -141
  611. package/dist/chunk-LAKLF4PA.js.map +0 -1
  612. package/dist/chunk-LLOLUHVG.js.map +0 -1
  613. package/dist/chunk-MKPIAGVL.js +0 -465
  614. package/dist/chunk-MKPIAGVL.js.map +0 -1
  615. package/dist/chunk-PEI6RANI.js.map +0 -1
  616. package/dist/chunk-R3AZOAB5.js.map +0 -1
  617. package/dist/chunk-WSK7G5LE.js +0 -170
  618. package/dist/chunk-WSK7G5LE.js.map +0 -1
  619. package/dist/chunk-XBZWOM2K.js +0 -218
  620. package/dist/chunk-XBZWOM2K.js.map +0 -1
  621. package/dist/chunk-Y7OEDUJ5.js +0 -8810
  622. package/dist/chunk-Y7OEDUJ5.js.map +0 -1
  623. package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
  624. package/dist/hooks/use-packs.d.ts +0 -32
  625. package/dist/interactive-workbench-viewers-TOHBXJEE.js +0 -15
  626. package/dist/queue-surface-implementation-2KVJTYXH.js.map +0 -1
  627. package/dist/timeline-annotation-selection-3L7LHGG2.js +0 -187
  628. package/dist/timeline-annotation-selection-3L7LHGG2.js.map +0 -1
  629. package/dist/timeline-annotations-dialog-U7EVLR75.js +0 -196
  630. package/dist/timeline-annotations-dialog-U7EVLR75.js.map +0 -1
  631. package/src/hooks/use-packs.ts +0 -157
  632. /package/dist/{interactive-workbench-viewers-TOHBXJEE.js.map → browser-viewer-SHYKQRNX.js.map} +0 -0
package/dist/usage.js ADDED
@@ -0,0 +1,1074 @@
1
+ import {
2
+ DEFAULT_ALLOWANCE_LABELS,
3
+ allowanceLabels,
4
+ allowanceResetSentence,
5
+ formatAllowanceDate,
6
+ formatAllowanceInstant
7
+ } from "./chunk-B3V6TG77.js";
8
+ import {
9
+ usePolledValue
10
+ } from "./chunk-YQEAA6LT.js";
11
+ import "./chunk-UGLEYEMP.js";
12
+ import {
13
+ OpenGeniContext
14
+ } from "./chunk-TKOTKRWY.js";
15
+ import {
16
+ cn
17
+ } from "./chunk-22KP6LR5.js";
18
+
19
+ // src/hooks/use-usage.ts
20
+ import {
21
+ getMyUsage
22
+ } from "@opengeni/sdk/usage-allowances";
23
+ import { useCallback, useContext, useEffect, useMemo, useRef } from "react";
24
+
25
+ // src/usage/summary.ts
26
+ function reading(scope, usage) {
27
+ if (usage.limit === null) return null;
28
+ return {
29
+ scope,
30
+ fraction: usage.fraction ?? (usage.limit === 0 ? 1 : usage.used / usage.limit),
31
+ status: usage.status,
32
+ resetsAt: usage.resetsAt,
33
+ used: usage.used,
34
+ limit: usage.limit,
35
+ remaining: Math.max(0, usage.remaining ?? usage.limit - usage.used)
36
+ };
37
+ }
38
+ function summarizeUsage(usage, subjectId) {
39
+ const row = subjectId === void 0 ? usage.members[0] : usage.members.find((member2) => member2.subjectId === subjectId);
40
+ const member = row ? reading("member", row) : null;
41
+ const workspace = reading("workspace", usage.workspace);
42
+ const readings = [member, workspace].filter((value) => value !== null);
43
+ if (readings.length === 0) return { state: "unlimited", binding: null, member, workspace };
44
+ const exhausted = (workspace?.status === "exhausted" ? workspace : null) ?? (member?.status === "exhausted" ? member : null);
45
+ if (exhausted) return { state: "exhausted", binding: exhausted, member, workspace };
46
+ const warnings = readings.filter((value) => value.status === "warning");
47
+ const candidates = warnings.length > 0 ? warnings : readings;
48
+ const binding = candidates.reduce(
49
+ (tightest, value) => value.remaining < tightest.remaining ? value : tightest
50
+ );
51
+ return { state: warnings.length > 0 ? "warning" : "ok", binding, member, workspace };
52
+ }
53
+ function usagePercentLabel(fraction) {
54
+ if (!Number.isFinite(fraction) || fraction <= 0) return "0";
55
+ if (fraction < 0.01) return "<1";
56
+ if (fraction < 1 && Math.round(fraction * 100) === 100) return "99";
57
+ return String(Math.round(fraction * 100));
58
+ }
59
+
60
+ // src/hooks/use-usage.ts
61
+ function readOwnUsage(client, workspaceId, period, signal) {
62
+ const query = period === void 0 ? {} : { period };
63
+ const options = signal ? { signal } : {};
64
+ if ("getMyUsage" in client && typeof client.getMyUsage === "function") {
65
+ return client.getMyUsage(workspaceId, query, options);
66
+ }
67
+ if ("requestJson" in client && typeof client.requestJson === "function") {
68
+ return getMyUsage(client, workspaceId, query, options);
69
+ }
70
+ throw new Error("@opengeni/react: the usage client needs getMyUsage or requestJson.");
71
+ }
72
+ function useUsage(options = {}) {
73
+ const context = useContext(OpenGeniContext);
74
+ const client = options.client ?? context?.client;
75
+ const workspaceId = options.workspaceId ?? context?.workspaceId;
76
+ if (!client || !workspaceId) {
77
+ throw new Error(
78
+ "@opengeni/react: useUsage needs a client and workspace. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId }."
79
+ );
80
+ }
81
+ const period = options.period;
82
+ const load = useCallback(
83
+ (signal) => readOwnUsage(client, workspaceId, period, signal),
84
+ [client, workspaceId, period]
85
+ );
86
+ const state = usePolledValue(load, {
87
+ pollIntervalMs: options.pollIntervalMs,
88
+ enabled: options.enabled
89
+ });
90
+ const refreshKey = options.refreshKey;
91
+ const seenKey = useRef(refreshKey);
92
+ const refresh = state.refresh;
93
+ useEffect(() => {
94
+ if (Object.is(seenKey.current, refreshKey)) return;
95
+ seenKey.current = refreshKey;
96
+ void refresh();
97
+ }, [refreshKey, refresh]);
98
+ const usage = state.data;
99
+ const summary = useMemo(() => usage ? summarizeUsage(usage) : null, [usage]);
100
+ return { usage, summary, loading: state.loading, error: state.error, refresh };
101
+ }
102
+
103
+ // src/components/usage-meter.tsx
104
+ import { jsx, jsxs } from "react/jsx-runtime";
105
+ var DEFAULT_USAGE_METER_LABELS = {
106
+ ...allowanceLabels(),
107
+ title: "Your usage",
108
+ workspaceTitle: "Workspace usage",
109
+ left: (percent) => `${percent}% left`,
110
+ used: (percent) => `${percent}% used`,
111
+ limitReached: "Limit reached",
112
+ nearLimit: "Near limit",
113
+ amountLeft: (amount) => `${amount} left`,
114
+ unlimited: "No usage limit",
115
+ loading: "Checking usage\u2026",
116
+ error: "Couldn't load usage",
117
+ retry: "Try again",
118
+ amounts: (used, limit) => `${used} of ${limit} used`,
119
+ workspaceLine: (value) => `Workspace: ${value}`
120
+ };
121
+ function UsageMeter({
122
+ usage,
123
+ client,
124
+ workspaceId,
125
+ period,
126
+ refreshKey,
127
+ ...view
128
+ }) {
129
+ if (usage !== void 0) {
130
+ return /* @__PURE__ */ jsx(
131
+ UsageMeterView,
132
+ {
133
+ ...view,
134
+ summary: usage ? summarizeUsage(usage) : null,
135
+ loading: usage === null
136
+ }
137
+ );
138
+ }
139
+ return /* @__PURE__ */ jsx(
140
+ LoadingUsageMeter,
141
+ {
142
+ ...view,
143
+ client,
144
+ workspaceId,
145
+ period,
146
+ refreshKey
147
+ }
148
+ );
149
+ }
150
+ function LoadingUsageMeter({
151
+ client,
152
+ workspaceId,
153
+ period,
154
+ refreshKey,
155
+ ...view
156
+ }) {
157
+ const state = useUsage({ client, workspaceId, period, refreshKey });
158
+ return /* @__PURE__ */ jsx(
159
+ UsageMeterView,
160
+ {
161
+ ...view,
162
+ summary: state.summary,
163
+ loading: state.loading && !state.summary,
164
+ error: state.summary ? null : state.error,
165
+ onRetry: () => void state.refresh()
166
+ }
167
+ );
168
+ }
169
+ var FILL = {
170
+ ok: "bg-og-accent",
171
+ warning: "bg-og-status-waiting",
172
+ exhausted: "bg-og-danger"
173
+ };
174
+ function valueText(reading2, measure, labels) {
175
+ if (reading2.status === "exhausted") return labels.limitReached;
176
+ return measure === "left" ? labels.left(usagePercentLabel(Math.max(0, 1 - reading2.fraction))) : labels.used(usagePercentLabel(reading2.fraction));
177
+ }
178
+ function UsageMeterView({
179
+ summary,
180
+ loading = false,
181
+ error = null,
182
+ onRetry,
183
+ measure = "left",
184
+ formatAmount,
185
+ labels: overrides,
186
+ density = "default",
187
+ showWorkspace = true,
188
+ className
189
+ }) {
190
+ const labels = { ...DEFAULT_USAGE_METER_LABELS, ...overrides };
191
+ const compact = density === "compact";
192
+ if (loading || error || !summary) {
193
+ return /* @__PURE__ */ jsx(
194
+ "div",
195
+ {
196
+ className: cn("og-root min-w-0 text-og-sm", className),
197
+ "data-og-usage-meter": error ? "error" : "loading",
198
+ "aria-busy": loading || void 0,
199
+ children: error ? /* @__PURE__ */ jsxs("p", { className: "flex flex-wrap items-center gap-x-2 text-og-fg-muted", role: "alert", children: [
200
+ labels.error,
201
+ onRetry ? /* @__PURE__ */ jsx(
202
+ "button",
203
+ {
204
+ type: "button",
205
+ onClick: onRetry,
206
+ className: "rounded-og-sm text-og-fg underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-og-accent",
207
+ children: labels.retry
208
+ }
209
+ ) : null
210
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-og-fg-subtle", children: labels.loading })
211
+ }
212
+ );
213
+ }
214
+ const primary = summary.member ?? summary.workspace;
215
+ if (!primary) {
216
+ return /* @__PURE__ */ jsxs(
217
+ "div",
218
+ {
219
+ className: cn("og-root min-w-0 text-og-sm text-og-fg-muted", className),
220
+ "data-og-usage-meter": "unlimited",
221
+ children: [
222
+ compact ? null : /* @__PURE__ */ jsxs("span", { className: "font-medium text-og-fg", children: [
223
+ labels.title,
224
+ " \xB7 "
225
+ ] }),
226
+ labels.unlimited
227
+ ]
228
+ }
229
+ );
230
+ }
231
+ const title = summary.member ? labels.title : labels.workspaceTitle;
232
+ const value = valueText(primary, measure, labels);
233
+ const fill = Math.min(1, Math.max(0, primary.fraction));
234
+ const reset = allowanceResetSentence(labels, primary.resetsAt);
235
+ const pool = showWorkspace && summary.member && summary.workspace && (summary.binding?.scope === "workspace" || summary.workspace.status !== "ok") ? summary.workspace : null;
236
+ const meterProps = {
237
+ role: "meter",
238
+ "aria-label": title || labels.title,
239
+ "aria-valuemin": 0,
240
+ "aria-valuemax": 100,
241
+ "aria-valuenow": Math.round(fill * 100),
242
+ "aria-valuetext": `${value}. ${reset}${pool ? ` ${labels.workspaceLine(valueText(pool, measure, labels))}.` : ""}`
243
+ };
244
+ const bar = /* @__PURE__ */ jsx(
245
+ "span",
246
+ {
247
+ "aria-hidden": true,
248
+ className: cn(
249
+ "relative block overflow-hidden rounded-full",
250
+ density === "hero" ? "h-1.5" : "h-1",
251
+ primary.status === "exhausted" ? "bg-og-danger/15" : "bg-og-surface-3",
252
+ compact ? "w-16 shrink-0" : "w-full"
253
+ ),
254
+ children: /* @__PURE__ */ jsx(
255
+ "span",
256
+ {
257
+ className: cn("absolute inset-y-0 left-0 rounded-full", FILL[primary.status]),
258
+ style: { width: `${Math.round(fill * 1e3) / 10}%` }
259
+ }
260
+ )
261
+ }
262
+ );
263
+ const valueClass = cn(
264
+ "shrink-0 whitespace-nowrap tabular-nums",
265
+ primary.status === "ok" ? "text-og-fg-muted" : "font-medium",
266
+ primary.status === "warning" && "text-og-status-waiting",
267
+ primary.status === "exhausted" && "text-og-danger"
268
+ );
269
+ if (compact) {
270
+ return /* @__PURE__ */ jsxs(
271
+ "span",
272
+ {
273
+ ...meterProps,
274
+ "data-og-usage-meter": primary.status,
275
+ title: primary.resetsAt ? `${reset} ${formatAllowanceInstant(primary.resetsAt)}` : reset,
276
+ className: cn("og-root inline-flex min-w-0 items-center gap-2 text-og-xs", className),
277
+ children: [
278
+ /* @__PURE__ */ jsx("span", { className: valueClass, children: value }),
279
+ bar
280
+ ]
281
+ }
282
+ );
283
+ }
284
+ const amounts = formatAmount ? labels.amounts(formatAmount(primary.used), formatAmount(primary.limit)) : null;
285
+ if (density === "hero") {
286
+ const headline = formatAmount ? labels.amountLeft(formatAmount(primary.remaining)) : labels.left(usagePercentLabel(Math.max(0, 1 - primary.fraction)));
287
+ return /* @__PURE__ */ jsxs(
288
+ "div",
289
+ {
290
+ ...meterProps,
291
+ "data-og-usage-meter": primary.status,
292
+ className: cn("og-root flex min-w-0 flex-col gap-3", className),
293
+ children: [
294
+ title ? /* @__PURE__ */ jsx("span", { className: "text-og-sm font-medium text-og-fg-muted", children: title }) : null,
295
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1", children: [
296
+ /* @__PURE__ */ jsx("span", { className: "text-2xl leading-8 font-semibold tracking-[-0.5px] text-og-fg tabular-nums", children: headline }),
297
+ primary.status !== "ok" ? /* @__PURE__ */ jsxs(
298
+ "span",
299
+ {
300
+ className: cn(
301
+ "inline-flex h-[22px] items-center gap-1.5 rounded-full border px-2 text-og-xs font-medium",
302
+ primary.status === "warning" ? "border-og-status-waiting/30 text-og-status-waiting" : "border-og-danger/30 text-og-danger"
303
+ ),
304
+ children: [
305
+ /* @__PURE__ */ jsx(
306
+ "span",
307
+ {
308
+ "aria-hidden": true,
309
+ className: cn(
310
+ "size-1.5 rounded-full",
311
+ primary.status === "warning" ? "bg-og-status-waiting" : "bg-og-danger"
312
+ )
313
+ }
314
+ ),
315
+ primary.status === "warning" ? labels.nearLimit : labels.limitReached
316
+ ]
317
+ }
318
+ ) : null
319
+ ] }),
320
+ bar,
321
+ /* @__PURE__ */ jsxs("p", { className: "text-og-xs text-og-fg-muted tabular-nums", children: [
322
+ [
323
+ amounts ?? labels.used(usagePercentLabel(primary.fraction)),
324
+ amounts ? `${usagePercentLabel(primary.fraction)}%` : null
325
+ ].filter(Boolean).join(" \xB7 "),
326
+ " ",
327
+ "\xB7",
328
+ " ",
329
+ /* @__PURE__ */ jsx("span", { title: primary.resetsAt ? formatAllowanceInstant(primary.resetsAt) : void 0, children: reset })
330
+ ] }),
331
+ pool ? /* @__PURE__ */ jsx(PoolLine, { reading: pool, measure, labels }) : null
332
+ ]
333
+ }
334
+ );
335
+ }
336
+ return /* @__PURE__ */ jsxs(
337
+ "div",
338
+ {
339
+ ...meterProps,
340
+ "data-og-usage-meter": primary.status,
341
+ className: cn("og-root flex min-w-0 flex-col gap-2 text-og-sm", className),
342
+ children: [
343
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [
344
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate font-medium text-og-fg", children: title }),
345
+ /* @__PURE__ */ jsx("span", { className: valueClass, children: value })
346
+ ] }),
347
+ bar,
348
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-1 text-og-xs text-og-fg-subtle", children: [
349
+ /* @__PURE__ */ jsx("span", { title: primary.resetsAt ? formatAllowanceInstant(primary.resetsAt) : void 0, children: reset }),
350
+ amounts ? /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: amounts }) : null
351
+ ] }),
352
+ pool ? /* @__PURE__ */ jsx(PoolLine, { reading: pool, measure, labels }) : null
353
+ ]
354
+ }
355
+ );
356
+ }
357
+ function PoolLine({
358
+ reading: reading2,
359
+ measure,
360
+ labels
361
+ }) {
362
+ return /* @__PURE__ */ jsx(
363
+ "p",
364
+ {
365
+ className: cn(
366
+ "text-og-xs",
367
+ reading2.status === "exhausted" ? "font-medium text-og-danger" : reading2.status === "warning" ? "text-og-status-waiting" : "text-og-fg-muted"
368
+ ),
369
+ children: labels.workspaceLine(valueText(reading2, measure, labels))
370
+ }
371
+ );
372
+ }
373
+
374
+ // src/components/usage-limit-notice.tsx
375
+ import { GaugeIcon, XIcon } from "lucide-react";
376
+ import { useEffect as useEffect2, useState } from "react";
377
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
378
+ var DEFAULT_USAGE_LIMIT_NOTICE_LABELS = {
379
+ ...allowanceLabels(),
380
+ memberWarning: (percent) => `You've used ${percent}% of your usage limit.`,
381
+ workspaceWarning: (percent) => `This workspace has used ${percent}% of its usage budget.`,
382
+ memberExhausted: "You've reached your usage limit.",
383
+ workspaceExhausted: "This workspace has reached its usage limit.",
384
+ dismiss: "Dismiss"
385
+ };
386
+ function UsageLimitNotice({
387
+ usage,
388
+ client,
389
+ workspaceId,
390
+ period,
391
+ refreshKey,
392
+ ...view
393
+ }) {
394
+ if (usage !== void 0) {
395
+ return /* @__PURE__ */ jsx2(UsageLimitNoticeView, { ...view, summary: usage ? summarizeUsage(usage) : null });
396
+ }
397
+ return /* @__PURE__ */ jsx2(
398
+ LoadingNotice,
399
+ {
400
+ ...view,
401
+ client,
402
+ workspaceId,
403
+ period,
404
+ refreshKey
405
+ }
406
+ );
407
+ }
408
+ function LoadingNotice({
409
+ client,
410
+ workspaceId,
411
+ period,
412
+ refreshKey,
413
+ ...view
414
+ }) {
415
+ const { summary } = useUsage({ client, workspaceId, period, refreshKey });
416
+ return /* @__PURE__ */ jsx2(UsageLimitNoticeView, { ...view, summary });
417
+ }
418
+ function readDismissed(key) {
419
+ if (!key || typeof sessionStorage === "undefined") return false;
420
+ try {
421
+ return sessionStorage.getItem(key) === "1";
422
+ } catch {
423
+ return false;
424
+ }
425
+ }
426
+ function UsageLimitNoticeView({
427
+ summary,
428
+ labels: overrides,
429
+ action,
430
+ dismissStorageKey,
431
+ className
432
+ }) {
433
+ const labels = { ...DEFAULT_USAGE_LIMIT_NOTICE_LABELS, ...overrides };
434
+ const binding = summary?.binding ?? null;
435
+ const state = summary?.state;
436
+ const key = dismissStorageKey && binding && state === "warning" ? `${dismissStorageKey}:warning:${binding.scope}:${binding.resetsAt ?? "none"}` : null;
437
+ const [dismissed, setDismissed] = useState(() => readDismissed(key));
438
+ useEffect2(() => setDismissed(readDismissed(key)), [key]);
439
+ if (!summary || !binding || state !== "warning" && state !== "exhausted") return null;
440
+ if (state === "warning" && dismissed) return null;
441
+ const workspace = binding.scope === "workspace";
442
+ const exhausted = state === "exhausted";
443
+ const headline = exhausted ? workspace ? labels.workspaceExhausted : labels.memberExhausted : workspace ? labels.workspaceWarning(usagePercentLabel(binding.fraction)) : labels.memberWarning(usagePercentLabel(binding.fraction));
444
+ const reset = allowanceResetSentence(labels, binding.resetsAt);
445
+ const dismiss = () => {
446
+ setDismissed(true);
447
+ if (!key) return;
448
+ try {
449
+ sessionStorage.setItem(key, "1");
450
+ } catch {
451
+ }
452
+ };
453
+ return /* @__PURE__ */ jsxs2(
454
+ "div",
455
+ {
456
+ role: "status",
457
+ "data-og-usage-notice": exhausted ? "exhausted" : "warning",
458
+ "data-og-usage-scope": binding.scope,
459
+ className: cn(
460
+ "og-root flex min-w-0 items-start gap-2 px-3.5 pt-2.5 text-og-sm md:px-4",
461
+ className
462
+ ),
463
+ children: [
464
+ /* @__PURE__ */ jsx2(GaugeIcon, { "aria-hidden": true, className: "mt-0.5 size-3.5 shrink-0 text-og-status-waiting" }),
465
+ /* @__PURE__ */ jsxs2("p", { className: "min-w-0 flex-1 text-og-fg-muted", children: [
466
+ /* @__PURE__ */ jsx2("span", { className: cn(exhausted && "font-medium text-og-fg"), children: headline }),
467
+ " ",
468
+ exhausted ? /* @__PURE__ */ jsxs2(Fragment, { children: [
469
+ workspace ? labels.workspaceRemedy : labels.memberRemedy,
470
+ " "
471
+ ] }) : null,
472
+ /* @__PURE__ */ jsx2(
473
+ "span",
474
+ {
475
+ className: "whitespace-nowrap",
476
+ title: binding.resetsAt ? formatAllowanceInstant(binding.resetsAt) : void 0,
477
+ children: reset
478
+ }
479
+ )
480
+ ] }),
481
+ action ? /* @__PURE__ */ jsx2("div", { className: "shrink-0", children: action(summary) }) : null,
482
+ !exhausted ? /* @__PURE__ */ jsx2(
483
+ "button",
484
+ {
485
+ type: "button",
486
+ "aria-label": labels.dismiss,
487
+ onClick: dismiss,
488
+ className: "-mt-0.5 -mr-1 grid size-6 shrink-0 place-items-center rounded-og-sm text-og-fg-subtle transition hover:bg-og-surface-2 hover:text-og-fg focus-visible:outline-2 focus-visible:outline-og-accent pointer-coarse:size-9",
489
+ children: /* @__PURE__ */ jsx2(XIcon, { "aria-hidden": true, className: "size-3.5" })
490
+ }
491
+ ) : null
492
+ ]
493
+ }
494
+ );
495
+ }
496
+
497
+ // src/components/usage-member-list.tsx
498
+ import { Slider } from "radix-ui";
499
+ import { useId, useMemo as useMemo2, useState as useState2 } from "react";
500
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
501
+ var DEFAULT_USAGE_MEMBER_LIST_LABELS = {
502
+ listLabel: "Member usage",
503
+ used: (percent) => `${percent}% used`,
504
+ noLimitUsed: "No individual limit",
505
+ amounts: (used, limit) => `${used} of ${limit}`,
506
+ nearLimit: "Near limit",
507
+ limitReached: "Limit reached",
508
+ limit: "Limit",
509
+ defaultEqualShare: (percent) => `Equal share \xB7 ${percent}%`,
510
+ defaultNone: "No individual limit",
511
+ defaultShare: (percent) => `Default \xB7 ${percent}%`,
512
+ defaultAmount: (amount) => `Default \xB7 ${amount}`,
513
+ share: (percent) => `${percent}% of budget`,
514
+ amount: (amount) => `${amount} fixed`,
515
+ fixedAmountHidden: "Fixed amount",
516
+ edit: (name) => `Change limit for ${name}`,
517
+ editorTitle: (name) => `Limit for ${name}`,
518
+ optionDefault: "Default",
519
+ optionShare: "Share of budget",
520
+ optionAmount: "Fixed amount",
521
+ fixedAmountHint: "Each period. Doesn't grow when the budget does.",
522
+ shareSlider: "Share of the workspace budget",
523
+ shareInput: "Share, percent",
524
+ amountInput: "Fixed amount",
525
+ equalShareMultiple: (multiple) => `${multiple}\xD7 an equal share`,
526
+ sameAsEqualShare: "About an equal share",
527
+ atBudget: (amount) => `About ${amount} at the current budget`,
528
+ save: "Save",
529
+ saving: "Saving\u2026",
530
+ cancel: "Cancel",
531
+ saveFailed: "Couldn't save the limit. Refresh and try again.",
532
+ invalidAmount: "Enter an amount of zero or more.",
533
+ totalWithin: (percent) => `Member limits add up to ${percent}% of the budget.`,
534
+ totalOver: (percent) => `Member limits add up to ${percent}% of the budget.`,
535
+ oversubscribedHelp: "That's allowed: limits are ceilings, not reservations. The workspace budget still caps what everyone spends together.",
536
+ unlimitedMembers: (count) => count === 1 ? "1 member has no individual limit." : `${count} members have no individual limit.`,
537
+ empty: "No members yet."
538
+ };
539
+ var STATUS_RANK = { exhausted: 0, warning: 1, ok: 2 };
540
+ function shareBase(usage) {
541
+ return usage.workspace.includedCredits + usage.workspace.grantsRemaining;
542
+ }
543
+ function formatPercent(value) {
544
+ const scaled = value * 100;
545
+ return Number.isInteger(Math.round(scaled * 10) / 10) || scaled >= 10 ? String(Math.round(scaled)) : (Math.round(scaled * 10) / 10).toFixed(1);
546
+ }
547
+ function formatMultiple(value) {
548
+ return value >= 10 ? String(Math.round(value)) : (Math.round(value * 10) / 10).toString();
549
+ }
550
+ function describeMemberLimit(member, context) {
551
+ const labels = { ...DEFAULT_USAGE_MEMBER_LIST_LABELS, ...context.labels };
552
+ const ofBudget = (limit) => limit !== null && context.shareBase > 0 ? formatPercent(limit / context.shareBase) : "0";
553
+ const rule = member.rule;
554
+ if (rule && "share" in rule) return labels.share(formatPercent(rule.share));
555
+ if (rule && "credits" in rule) {
556
+ return context.amounts ? labels.amount(context.amounts.format(rule.credits)) : labels.fixedAmountHidden;
557
+ }
558
+ const fallback = context.memberDefault ?? "none";
559
+ if (fallback === "none" || member.limit === null) return labels.defaultNone;
560
+ if (fallback === "equal_share") return labels.defaultEqualShare(ofBudget(member.limit));
561
+ if ("share" in fallback) return labels.defaultShare(formatPercent(fallback.share));
562
+ return context.amounts ? labels.defaultAmount(context.amounts.format(fallback.credits)) : labels.defaultShare(ofBudget(member.limit));
563
+ }
564
+ function UsageMemberList({
565
+ usage,
566
+ memberDefault,
567
+ describe,
568
+ onChangeRule,
569
+ amounts,
570
+ labels: overrides,
571
+ framed = true,
572
+ className
573
+ }) {
574
+ const labels = { ...DEFAULT_USAGE_MEMBER_LIST_LABELS, ...overrides };
575
+ const base = shareBase(usage);
576
+ const [editing, setEditing] = useState2(null);
577
+ const name = (member) => describe?.(member) ?? {
578
+ name: member.externalIdentity?.externalId ?? member.subjectId,
579
+ detail: null
580
+ };
581
+ const members = useMemo2(
582
+ () => [...usage.members].sort(
583
+ (left, right) => STATUS_RANK[left.status] - STATUS_RANK[right.status] || right.used - left.used
584
+ ),
585
+ [usage.members]
586
+ );
587
+ if (members.length === 0) {
588
+ return /* @__PURE__ */ jsx3("p", { className: cn("og-root text-og-sm text-og-fg-muted", className), children: labels.empty });
589
+ }
590
+ return /* @__PURE__ */ jsxs3("div", { className: cn("og-root flex min-w-0 flex-col gap-3", className), children: [
591
+ /* @__PURE__ */ jsx3(AllocationSummary, { usage, base, labels, framed }),
592
+ /* @__PURE__ */ jsx3(
593
+ "ul",
594
+ {
595
+ "aria-label": labels.listLabel,
596
+ className: cn(
597
+ "divide-y divide-og-border",
598
+ framed && "overflow-hidden rounded-og-md border border-og-border"
599
+ ),
600
+ children: members.map((member) => /* @__PURE__ */ jsx3(
601
+ MemberRow,
602
+ {
603
+ member,
604
+ identity: name(member),
605
+ usage,
606
+ base,
607
+ memberDefault,
608
+ amounts,
609
+ labels,
610
+ framed,
611
+ editing: editing === member.subjectId,
612
+ onEdit: onChangeRule ? () => setEditing(
613
+ (current) => current === member.subjectId ? null : member.subjectId
614
+ ) : void 0,
615
+ onClose: () => setEditing(null),
616
+ onSave: onChangeRule ? async (rule) => {
617
+ await onChangeRule(member, rule);
618
+ setEditing(null);
619
+ } : void 0
620
+ },
621
+ member.subjectId
622
+ ))
623
+ }
624
+ )
625
+ ] });
626
+ }
627
+ function memberShares(usage, base) {
628
+ let total = 0;
629
+ let unlimited = 0;
630
+ for (const member of usage.members) {
631
+ if (member.limit === null) unlimited += 1;
632
+ else total += base > 0 ? member.limit / base : 0;
633
+ }
634
+ return { total, unlimited };
635
+ }
636
+ function AllocationSummary({
637
+ usage,
638
+ base,
639
+ labels,
640
+ framed
641
+ }) {
642
+ if (base <= 0) return null;
643
+ const { total, unlimited } = memberShares(usage, base);
644
+ const limited = usage.members.length - unlimited;
645
+ const over = total > 1.005;
646
+ const shaped = usage.members.some((member) => member.rule !== null);
647
+ if (limited === 0 || !over && !shaped && unlimited === 0) return null;
648
+ return /* @__PURE__ */ jsxs3(
649
+ "div",
650
+ {
651
+ "data-og-usage-allocation": over ? "oversubscribed" : "within",
652
+ className: cn(
653
+ "flex min-w-0 flex-col gap-1 text-og-sm",
654
+ framed || over ? "rounded-og-md px-3 py-2" : "pt-1",
655
+ over ? "bg-og-status-waiting/8 text-og-fg" : framed ? "bg-og-surface-1 text-og-fg-muted" : "text-og-fg-muted"
656
+ ),
657
+ children: [
658
+ limited > 0 ? /* @__PURE__ */ jsx3(AllocationBar, { total, over, children: over ? labels.totalOver(formatPercent(total)) : labels.totalWithin(formatPercent(total)) }) : null,
659
+ over ? /* @__PURE__ */ jsx3("p", { className: "text-og-xs text-og-fg-muted", children: labels.oversubscribedHelp }) : null,
660
+ unlimited > 0 ? /* @__PURE__ */ jsx3("p", { className: "text-og-xs text-og-fg-muted", children: labels.unlimitedMembers(unlimited) }) : null
661
+ ]
662
+ }
663
+ );
664
+ }
665
+ function AllocationBar({
666
+ total,
667
+ over,
668
+ children
669
+ }) {
670
+ const scale = Math.max(1, total);
671
+ return /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
672
+ /* @__PURE__ */ jsx3("p", { className: cn(over && "font-medium"), children }),
673
+ /* @__PURE__ */ jsxs3("span", { "aria-hidden": true, className: "relative block h-1 overflow-hidden rounded-full bg-og-surface-3", children: [
674
+ /* @__PURE__ */ jsx3(
675
+ "span",
676
+ {
677
+ className: "absolute inset-y-0 left-0 bg-og-accent/70",
678
+ style: { width: `${Math.min(total, 1) / scale * 100}%` }
679
+ }
680
+ ),
681
+ over ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
682
+ /* @__PURE__ */ jsx3(
683
+ "span",
684
+ {
685
+ className: "absolute inset-y-0 bg-og-status-waiting",
686
+ style: { left: `${1 / scale * 100}%`, right: 0 }
687
+ }
688
+ ),
689
+ /* @__PURE__ */ jsx3(
690
+ "span",
691
+ {
692
+ className: "absolute inset-y-[-2px] w-px bg-og-fg",
693
+ style: { left: `${1 / scale * 100}%` }
694
+ }
695
+ )
696
+ ] }) : null
697
+ ] })
698
+ ] });
699
+ }
700
+ function MemberRow({
701
+ member,
702
+ identity,
703
+ usage,
704
+ base,
705
+ memberDefault,
706
+ amounts,
707
+ labels,
708
+ framed,
709
+ editing,
710
+ onEdit,
711
+ onClose,
712
+ onSave
713
+ }) {
714
+ const editorId = useId();
715
+ const limited = member.limit !== null;
716
+ const fraction = member.fraction ?? 0;
717
+ const limitText = describeMemberLimit(member, {
718
+ memberDefault,
719
+ shareBase: base,
720
+ amounts,
721
+ labels
722
+ });
723
+ return /* @__PURE__ */ jsxs3("li", { className: cn("min-w-0", framed && "bg-og-bg"), "data-og-usage-member": member.subjectId, children: [
724
+ /* @__PURE__ */ jsxs3(
725
+ "div",
726
+ {
727
+ className: cn(
728
+ "grid min-w-0 grid-cols-1 gap-x-4 gap-y-2 py-3 sm:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_11rem] sm:items-center",
729
+ framed && "px-3.5"
730
+ ),
731
+ children: [
732
+ /* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
733
+ /* @__PURE__ */ jsx3("p", { className: "truncate text-og-sm font-medium text-og-fg", children: identity.name }),
734
+ identity.detail ? /* @__PURE__ */ jsx3("p", { className: "truncate text-og-xs text-og-fg-subtle", children: identity.detail }) : null
735
+ ] }),
736
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col gap-1", children: [
737
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-baseline justify-between gap-2 text-og-xs", children: [
738
+ /* @__PURE__ */ jsx3(
739
+ "span",
740
+ {
741
+ className: cn(
742
+ "tabular-nums",
743
+ member.status === "ok" && "text-og-fg-muted",
744
+ member.status === "warning" && "font-medium text-og-status-waiting",
745
+ member.status === "exhausted" && "font-medium text-og-danger"
746
+ ),
747
+ children: limited ? member.status === "exhausted" ? labels.limitReached : `${labels.used(usagePercentLabel(fraction))}${member.status === "warning" ? ` \xB7 ${labels.nearLimit}` : ""}` : labels.noLimitUsed
748
+ }
749
+ ),
750
+ amounts ? /* @__PURE__ */ jsx3("span", { className: "truncate text-og-fg-subtle tabular-nums", children: limited ? labels.amounts(amounts.format(member.used), amounts.format(member.limit)) : amounts.format(member.used) }) : null
751
+ ] }),
752
+ /* @__PURE__ */ jsx3(
753
+ "span",
754
+ {
755
+ "aria-hidden": true,
756
+ className: cn(
757
+ "relative block h-1 overflow-hidden rounded-full",
758
+ limited ? "bg-og-surface-3" : "bg-transparent"
759
+ ),
760
+ children: limited ? /* @__PURE__ */ jsx3(
761
+ "span",
762
+ {
763
+ className: cn(
764
+ "absolute inset-y-0 left-0 rounded-full",
765
+ member.status === "ok" ? "bg-og-accent" : member.status === "warning" ? "bg-og-status-waiting" : "bg-og-danger"
766
+ ),
767
+ style: { width: `${Math.min(1, Math.max(0, fraction)) * 100}%` }
768
+ }
769
+ ) : null
770
+ }
771
+ )
772
+ ] }),
773
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center justify-between gap-2 sm:justify-end", children: [
774
+ /* @__PURE__ */ jsx3("span", { className: "text-og-xs text-og-fg-subtle sm:hidden", children: labels.limit }),
775
+ onEdit ? /* @__PURE__ */ jsx3(
776
+ "button",
777
+ {
778
+ type: "button",
779
+ onClick: onEdit,
780
+ "aria-expanded": editing,
781
+ "aria-controls": editing ? editorId : void 0,
782
+ "aria-label": `${labels.edit(identity.name)}: ${limitText}`,
783
+ className: "inline-flex h-8 max-w-full items-center gap-1.5 truncate rounded-og-sm border border-og-border px-2.5 text-og-control text-og-fg transition hover:bg-og-surface-2 focus-visible:outline-2 focus-visible:outline-og-accent pointer-coarse:h-10",
784
+ children: limitText
785
+ }
786
+ ) : /* @__PURE__ */ jsx3("span", { className: "truncate text-og-xs text-og-fg-muted", children: limitText })
787
+ ] })
788
+ ]
789
+ }
790
+ ),
791
+ editing && onSave ? /* @__PURE__ */ jsx3(
792
+ MemberLimitEditor,
793
+ {
794
+ id: editorId,
795
+ member,
796
+ name: identity.name,
797
+ usage,
798
+ base,
799
+ memberDefault,
800
+ amounts,
801
+ labels,
802
+ framed,
803
+ onCancel: onClose,
804
+ onSave
805
+ }
806
+ ) : null
807
+ ] });
808
+ }
809
+ function initialMode(rule, amounts) {
810
+ if (rule === null) return "share";
811
+ if ("share" in rule) return "share";
812
+ return amounts ? "amount" : "share";
813
+ }
814
+ function MemberLimitEditor({
815
+ id,
816
+ member,
817
+ name,
818
+ usage,
819
+ base,
820
+ memberDefault,
821
+ amounts,
822
+ labels,
823
+ framed,
824
+ onCancel,
825
+ onSave
826
+ }) {
827
+ const count = Math.max(1, usage.members.length);
828
+ const equal = 1 / count;
829
+ const currentShare = member.rule && "share" in member.rule ? member.rule.share : member.limit !== null && base > 0 ? member.limit / base : equal;
830
+ const startPercent = Math.min(100, Math.max(0, Math.round(currentShare * 100)));
831
+ const startAmount = amounts && member.rule && "credits" in member.rule ? stripPrefix(amounts.format(member.rule.credits), amounts.prefix) : amounts && member.limit !== null ? stripPrefix(amounts.format(member.limit), amounts.prefix) : "";
832
+ const [mode, setMode] = useState2(() => initialMode(member.rule, amounts));
833
+ const [sharePercent, setSharePercent] = useState2(startPercent);
834
+ const [amountText, setAmountText] = useState2(startAmount);
835
+ const [saving, setSaving] = useState2(false);
836
+ const [error, setError] = useState2(null);
837
+ const share = sharePercent / 100;
838
+ const parsedAmount = amounts && mode === "amount" ? amounts.parse(amountText) : null;
839
+ const defaultLimitText = describeMemberLimit(
840
+ {
841
+ rule: null,
842
+ limit: member.rule === null ? member.limit : defaultLimitFor(memberDefault, base, count)
843
+ },
844
+ { memberDefault, shareBase: base, amounts, labels }
845
+ );
846
+ const unchanged = mode === "default" ? member.rule === null : mode === "share" ? (member.rule === null || "share" in member.rule) && sharePercent === startPercent : member.rule !== null && "credits" in member.rule && amountText === startAmount;
847
+ const draftLimit = mode === "share" ? share * base : mode === "amount" ? parsedAmount : defaultLimitFor(memberDefault, base, count);
848
+ const others = usage.members.reduce(
849
+ (sum, other) => other.subjectId === member.subjectId || other.limit === null ? sum : sum + other.limit,
850
+ 0
851
+ );
852
+ const draftTotal = base > 0 && draftLimit !== null ? (others + draftLimit) / base : null;
853
+ async function save() {
854
+ let rule;
855
+ if (mode === "default") rule = null;
856
+ else if (mode === "share") rule = { share };
857
+ else {
858
+ if (parsedAmount === null || !Number.isSafeInteger(parsedAmount) || parsedAmount < 0) {
859
+ setError(labels.invalidAmount);
860
+ return;
861
+ }
862
+ rule = { credits: parsedAmount };
863
+ }
864
+ setSaving(true);
865
+ setError(null);
866
+ try {
867
+ await onSave(rule);
868
+ } catch (cause) {
869
+ setError(cause instanceof Error && cause.message ? cause.message : labels.saveFailed);
870
+ setSaving(false);
871
+ }
872
+ }
873
+ const modes = [
874
+ { value: "share", label: labels.optionShare },
875
+ ...amounts ? [{ value: "amount", label: labels.optionAmount }] : [],
876
+ { value: "default", label: labels.optionDefault }
877
+ ];
878
+ return /* @__PURE__ */ jsxs3(
879
+ "div",
880
+ {
881
+ id,
882
+ role: "group",
883
+ "aria-label": labels.editorTitle(name),
884
+ className: cn(
885
+ "bg-og-surface-1 px-3.5 py-3",
886
+ framed ? "border-t border-og-border" : "mb-3 rounded-og-md"
887
+ ),
888
+ onKeyDown: (event) => {
889
+ if (event.key === "Escape" && !saving) {
890
+ event.stopPropagation();
891
+ onCancel();
892
+ }
893
+ },
894
+ children: [
895
+ /* @__PURE__ */ jsxs3("fieldset", { className: "flex min-w-0 flex-col gap-3", disabled: saving, children: [
896
+ /* @__PURE__ */ jsx3("legend", { className: "sr-only", children: labels.editorTitle(name) }),
897
+ /* @__PURE__ */ jsx3(
898
+ "div",
899
+ {
900
+ role: "radiogroup",
901
+ "aria-label": labels.limit,
902
+ className: "inline-flex w-fit max-w-full flex-wrap gap-0.5 rounded-og-sm bg-og-surface-3/60 p-0.5",
903
+ children: modes.map((option) => /* @__PURE__ */ jsxs3(
904
+ "label",
905
+ {
906
+ className: cn(
907
+ "relative inline-flex h-7 cursor-pointer items-center rounded-[5px] px-2.5 text-og-control transition has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-og-accent pointer-coarse:h-9",
908
+ mode === option.value ? "bg-og-bg font-medium text-og-fg shadow-sm" : "text-og-fg-muted hover:text-og-fg"
909
+ ),
910
+ children: [
911
+ /* @__PURE__ */ jsx3(
912
+ "input",
913
+ {
914
+ type: "radio",
915
+ name: `${id}-mode`,
916
+ value: option.value,
917
+ checked: mode === option.value,
918
+ onChange: () => setMode(option.value),
919
+ className: "sr-only"
920
+ }
921
+ ),
922
+ option.label
923
+ ]
924
+ },
925
+ option.value
926
+ ))
927
+ }
928
+ ),
929
+ mode === "share" ? /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col gap-2", children: [
930
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-3", children: [
931
+ /* @__PURE__ */ jsxs3(
932
+ Slider.Root,
933
+ {
934
+ value: [sharePercent],
935
+ min: 0,
936
+ max: 100,
937
+ step: 1,
938
+ onValueChange: (next) => setSharePercent(next[0] ?? 0),
939
+ "data-og-share-slider": "",
940
+ className: "relative flex h-6 min-w-0 flex-1 touch-none items-center select-none pointer-coarse:h-10",
941
+ children: [
942
+ /* @__PURE__ */ jsx3(Slider.Track, { className: "relative h-1.5 grow overflow-hidden rounded-full bg-og-surface-3", children: /* @__PURE__ */ jsx3(Slider.Range, { className: "absolute h-full rounded-full bg-og-accent" }) }),
943
+ count > 1 ? /* @__PURE__ */ jsx3(
944
+ "span",
945
+ {
946
+ "aria-hidden": true,
947
+ className: "pointer-events-none absolute top-1/2 h-3.5 w-0.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-og-fg-subtle",
948
+ style: { left: `${equal * 100}%` }
949
+ }
950
+ ) : null,
951
+ /* @__PURE__ */ jsx3(
952
+ Slider.Thumb,
953
+ {
954
+ "aria-label": labels.shareSlider,
955
+ "aria-valuetext": `${sharePercent}%`,
956
+ className: "block size-4 rounded-full border-2 border-og-accent bg-og-bg shadow-sm transition focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-og-accent pointer-coarse:size-6"
957
+ }
958
+ )
959
+ ]
960
+ }
961
+ ),
962
+ /* @__PURE__ */ jsxs3("label", { className: "flex shrink-0 items-center gap-1 text-og-sm text-og-fg", children: [
963
+ /* @__PURE__ */ jsx3(
964
+ "input",
965
+ {
966
+ type: "number",
967
+ inputMode: "numeric",
968
+ min: 0,
969
+ max: 100,
970
+ step: 1,
971
+ value: sharePercent,
972
+ "aria-label": labels.shareInput,
973
+ onChange: (event) => {
974
+ const next = Number(event.target.value);
975
+ if (Number.isFinite(next))
976
+ setSharePercent(Math.min(100, Math.max(0, Math.round(next))));
977
+ },
978
+ className: "h-8 w-16 rounded-og-sm border border-og-border bg-og-bg px-2 text-right tabular-nums focus-visible:outline-2 focus-visible:outline-og-accent pointer-coarse:h-10"
979
+ }
980
+ ),
981
+ "%"
982
+ ] })
983
+ ] }),
984
+ /* @__PURE__ */ jsx3("p", { className: "text-og-xs text-og-fg-subtle", "aria-live": "polite", children: [
985
+ count > 1 ? Math.abs(share * count - 1) < 0.05 ? labels.sameAsEqualShare : labels.equalShareMultiple(formatMultiple(share * count)) : null,
986
+ amounts && base > 0 ? labels.atBudget(amounts.format(Math.round(share * base))) : null
987
+ ].filter(Boolean).join(" \xB7 ") })
988
+ ] }) : mode === "amount" && amounts ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 text-og-sm text-og-fg", children: [
989
+ amounts.prefix ? /* @__PURE__ */ jsx3("span", { className: "text-og-fg-subtle", children: amounts.prefix }) : null,
990
+ /* @__PURE__ */ jsx3(
991
+ "input",
992
+ {
993
+ type: "number",
994
+ inputMode: "decimal",
995
+ min: 0,
996
+ step: amounts.step ?? 0.01,
997
+ value: amountText,
998
+ "aria-label": labels.amountInput,
999
+ "aria-invalid": error === labels.invalidAmount || void 0,
1000
+ onChange: (event) => setAmountText(event.target.value),
1001
+ className: "h-8 w-28 rounded-og-sm border border-og-border bg-og-bg px-2 tabular-nums focus-visible:outline-2 focus-visible:outline-og-accent pointer-coarse:h-10"
1002
+ }
1003
+ ),
1004
+ /* @__PURE__ */ jsx3("span", { className: "ml-2 text-og-xs text-og-fg-subtle", children: labels.fixedAmountHint })
1005
+ ] }) : /* @__PURE__ */ jsx3("p", { className: "text-og-sm text-og-fg-muted", children: defaultLimitText })
1006
+ ] }),
1007
+ draftTotal !== null ? /* @__PURE__ */ jsx3(
1008
+ "p",
1009
+ {
1010
+ className: cn("mt-3 text-og-xs", draftTotal > 1.005 ? "text-og-fg" : "text-og-fg-subtle"),
1011
+ children: draftTotal > 1.005 ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
1012
+ /* @__PURE__ */ jsx3("span", { className: "font-medium", children: labels.totalOver(formatPercent(draftTotal)) }),
1013
+ " ",
1014
+ /* @__PURE__ */ jsx3("span", { className: "text-og-fg-muted", children: labels.oversubscribedHelp })
1015
+ ] }) : labels.totalWithin(formatPercent(draftTotal))
1016
+ }
1017
+ ) : null,
1018
+ error ? /* @__PURE__ */ jsx3("p", { role: "alert", className: "mt-2 text-og-xs text-og-danger", children: error }) : null,
1019
+ /* @__PURE__ */ jsxs3("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
1020
+ /* @__PURE__ */ jsx3(
1021
+ "button",
1022
+ {
1023
+ type: "button",
1024
+ onClick: onCancel,
1025
+ disabled: saving,
1026
+ className: "inline-flex h-8 items-center rounded-og-sm px-3 text-og-control text-og-fg transition hover:bg-og-surface-2 focus-visible:outline-2 focus-visible:outline-og-accent disabled:opacity-50 pointer-coarse:h-10",
1027
+ children: labels.cancel
1028
+ }
1029
+ ),
1030
+ /* @__PURE__ */ jsx3(
1031
+ "button",
1032
+ {
1033
+ type: "button",
1034
+ onClick: () => void save(),
1035
+ disabled: saving || unchanged,
1036
+ className: "inline-flex h-8 items-center rounded-og-sm border border-og-primary-border bg-og-primary px-3 text-og-control font-medium text-og-primary-fg transition hover:bg-og-primary-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:h-10",
1037
+ children: saving ? labels.saving : labels.save
1038
+ }
1039
+ )
1040
+ ] })
1041
+ ]
1042
+ }
1043
+ );
1044
+ }
1045
+ function stripPrefix(text, prefix) {
1046
+ const plain = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
1047
+ return plain.replace(/,/g, "");
1048
+ }
1049
+ function defaultLimitFor(memberDefault, base, count) {
1050
+ const fallback = memberDefault ?? "none";
1051
+ if (fallback === "none") return null;
1052
+ if (fallback === "equal_share") return base / count;
1053
+ if ("share" in fallback) return fallback.share * base;
1054
+ return fallback.credits;
1055
+ }
1056
+ export {
1057
+ DEFAULT_ALLOWANCE_LABELS,
1058
+ DEFAULT_USAGE_LIMIT_NOTICE_LABELS,
1059
+ DEFAULT_USAGE_MEMBER_LIST_LABELS,
1060
+ DEFAULT_USAGE_METER_LABELS,
1061
+ UsageLimitNotice,
1062
+ UsageLimitNoticeView,
1063
+ UsageMemberList,
1064
+ UsageMeter,
1065
+ UsageMeterView,
1066
+ allowanceLabels,
1067
+ allowanceResetSentence,
1068
+ describeMemberLimit,
1069
+ formatAllowanceDate,
1070
+ summarizeUsage,
1071
+ usagePercentLabel,
1072
+ useUsage
1073
+ };
1074
+ //# sourceMappingURL=usage.js.map