@vellumai/web 0.10.11-dev.202607222129.31c06e5 → 0.10.11-dev.202607222325.35fc367

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 (103) hide show
  1. package/dist/assets/{account-page-CzZuoekz.js → account-page-GZyBTNUh.js} +1 -1
  2. package/dist/assets/{acp-run-detail-panel-DssICbn8.js → acp-run-detail-panel-rUaOd-hf.js} +1 -1
  3. package/dist/assets/{activity-steps-panel-CeLVlAeY.js → activity-steps-panel-5VIG5OqK.js} +1 -1
  4. package/dist/assets/{add-credits-modal-BFTdUmH6.js → add-credits-modal-CzzFGQWP.js} +1 -1
  5. package/dist/assets/{ai-page-ukSnDSJr.js → ai-page-CM4iIEf6.js} +1 -1
  6. package/dist/assets/api-Cg02JjXP.js +1 -0
  7. package/dist/assets/{api-CxAtNZ-r.js → api-Jhp24FhR.js} +1 -1
  8. package/dist/assets/{api-key-screen-DD_TJKco.js → api-key-screen-XB0o3VGu.js} +1 -1
  9. package/dist/assets/{assistant-status-panel-gpwr0glD.js → assistant-status-panel-3QLq7XTz.js} +1 -1
  10. package/dist/assets/{auth-store-Lzg3kiaw.js → auth-store-quPkF_4z.js} +1 -1
  11. package/dist/assets/{background-task-detail-panel-BCXH3MXV.js → background-task-detail-panel-CtnQ4o8Y.js} +1 -1
  12. package/dist/assets/{billing-page-BZwgqWS1.js → billing-page-BuH7Flj1.js} +1 -1
  13. package/dist/assets/{bookmarks-page-B-PbfvFN.js → bookmarks-page-BPYxHwvq.js} +1 -1
  14. package/dist/assets/{build-state-Bo2Ut5Js.js → build-state-rDsVeVLA.js} +1 -1
  15. package/dist/assets/{channels-page-route-DEwl411M.js → channels-page-route-CPi_Fp88.js} +1 -1
  16. package/dist/assets/chat-AyO7_TjY.js +1 -0
  17. package/dist/assets/{command-palette-DNujIsf0.js → command-palette-DSjWseMw.js} +1 -1
  18. package/dist/assets/{command-palette-window-page-mWNMMe4I.js → command-palette-window-page-Dj8qEe_8.js} +1 -1
  19. package/dist/assets/{community-page-DEcDCjsQ.js → community-page-C5z-9PeA.js} +1 -1
  20. package/dist/assets/{connect-page-DuBhY8KD.js → connect-page-CovLqmQK.js} +1 -1
  21. package/dist/assets/{contacts-page-route-BS2duMoh.js → contacts-page-route-C0blpiOy.js} +1 -1
  22. package/dist/assets/{credentials-page-DDgYexAA.js → credentials-page-BYLMj-Vi.js} +1 -1
  23. package/dist/assets/{debug-page-B_us491I.js → debug-page-BXDNUKAc.js} +1 -1
  24. package/dist/assets/{deploy-dialogs-CB5PSyxZ.js → deploy-dialogs-SI8FNwW3.js} +1 -1
  25. package/dist/assets/{detail-panel-stop-button-26G26Tqs.js → detail-panel-stop-button-DYV4AyIE.js} +1 -1
  26. package/dist/assets/{developer-page-Dqug_k0U.js → developer-page-4qC6bfMI.js} +1 -1
  27. package/dist/assets/{dictation-overlay-page-Rz3bqW3f.js → dictation-overlay-page-w-7_v7vX.js} +1 -1
  28. package/dist/assets/{document-viewer-page-DmHPShuz.js → document-viewer-page-D5v9jurM.js} +1 -1
  29. package/dist/assets/{emails-page-s9TxP6jP.js → emails-page-CrxG8ZDa.js} +1 -1
  30. package/dist/assets/{general-page-DsrG3cM2.js → general-page-ZuhMFVx3.js} +1 -1
  31. package/dist/assets/{hatching-screen-CuzULcU_.js → hatching-screen-CeQF1pRn.js} +1 -1
  32. package/dist/assets/{home-page-route-Cc3ksf3X.js → home-page-route-BSswnfjb.js} +1 -1
  33. package/dist/assets/{hosting-screen-DufVMlwF.js → hosting-screen-CoPWPYM0.js} +1 -1
  34. package/dist/assets/{identity-page-route-CUrEsO_0.js → identity-page-route-5CTzy7R7.js} +1 -1
  35. package/dist/assets/{index-C7ix_asE.js → index-Ck1SrvnM.js} +15 -15
  36. package/dist/assets/index-Co1WDHMj.css +2 -0
  37. package/dist/assets/{inspect-page-BUAbv6xj.js → inspect-page-CbL5eNZP.js} +1 -1
  38. package/dist/assets/{integrations-page-9JcrAORp.js → integrations-page-hX8eENSt.js} +1 -1
  39. package/dist/assets/{intelligence-layout-DJjUScCy.js → intelligence-layout-Che-CPPC.js} +1 -1
  40. package/dist/assets/{library-detail-page-BCAZmbR6.js → library-detail-page-CHLvGvqm.js} +1 -1
  41. package/dist/assets/{library-page-CiTHHvZ5.js → library-page-CyX22JKU.js} +1 -1
  42. package/dist/assets/{login-flow-DYrO-od6.js → login-flow-DbD8dpQO.js} +1 -1
  43. package/dist/assets/{login-page-DAFzFbRp.js → login-page-Bk7ZkXmL.js} +1 -1
  44. package/dist/assets/{logout-page-CsPkQ-4I.js → logout-page-b5UKcm6I.js} +1 -1
  45. package/dist/assets/{logs-layout-DBJaWlOK.js → logs-layout-DqmiOqxX.js} +1 -1
  46. package/dist/assets/{memory-page-route-CpPfBU9j.js → memory-page-route-z1B9mzGX.js} +1 -1
  47. package/dist/assets/{memory-router-playground-page-DfGhXcZW.js → memory-router-playground-page-BkNOYakH.js} +1 -1
  48. package/dist/assets/{mobile-sidebar-drawer-CVT3O8os.js → mobile-sidebar-drawer-CZXirrGr.js} +1 -1
  49. package/dist/assets/{notifications-page-DcHyVoSk.js → notifications-page-ChodICPa.js} +1 -1
  50. package/dist/assets/{oauth-complete-page-DjKBNbdN.js → oauth-complete-page-DAbVLddu.js} +1 -1
  51. package/dist/assets/{oauth-popup-complete-page-2KKVC5zM.js → oauth-popup-complete-page-DgH2GYyB.js} +1 -1
  52. package/dist/assets/{pairing-page-7NMcVDJj.js → pairing-page-B7TF3mjM.js} +1 -1
  53. package/dist/assets/{personality-page-CwaMBzXV.js → personality-page-BfD3xcZs.js} +1 -1
  54. package/dist/assets/{plans-page-Cre3Gpys.js → plans-page-BkxM9GzA.js} +1 -1
  55. package/dist/assets/{platform-loopback-page-CIcVs3UP.js → platform-loopback-page-CdL_j5rg.js} +1 -1
  56. package/dist/assets/{plugin-detail-page-R7HOcOd1.js → plugin-detail-page-DD3KG_Ob.js} +1 -1
  57. package/dist/assets/{privacy-page-CTQpOjs-.js → privacy-page-BOhDW3Tr.js} +1 -1
  58. package/dist/assets/{privacy-screen-DgHmBdN-.js → privacy-screen-DsKCxStT.js} +1 -1
  59. package/dist/assets/{provider-callback-page-kcYxB4WF.js → provider-callback-page-Dy-XHz3J.js} +1 -1
  60. package/dist/assets/{provider-signup-page-D9aI4WFt.js → provider-signup-page-Cw_EuUcw.js} +1 -1
  61. package/dist/assets/{quick-input-page-D2Bqa3St.js → quick-input-page-DgKCQboP.js} +1 -1
  62. package/dist/assets/{research-mock-page-C6zrZtBI.js → research-mock-page-DuWAP5WQ.js} +1 -1
  63. package/dist/assets/{research-onboarding-route-AYDHEowO.js → research-onboarding-route-DqSzV4R1.js} +1 -1
  64. package/dist/assets/{review-terms-screen-BSa9jNvG.js → review-terms-screen-C4VOK9eY.js} +1 -1
  65. package/dist/assets/{risk-C-ZyBTAb.js → risk-BbqTlLoT.js} +1 -1
  66. package/dist/assets/{schedules-page-gqD1Tbf8.js → schedules-page-CKnLdKQE.js} +1 -1
  67. package/dist/assets/{select-assistant-screen-CFvCmydl.js → select-assistant-screen-CKk_y6Wj.js} +1 -1
  68. package/dist/assets/{settings-layout-XYxLMpW0.js → settings-layout-Cntp7oUe.js} +1 -1
  69. package/dist/assets/{share-feedback-modal-Bjh3dK-n.js → share-feedback-modal-vBcYayA4.js} +1 -1
  70. package/dist/assets/{sidebar-tree-CDqUGPSK.js → sidebar-tree-X01ptIng.js} +1 -1
  71. package/dist/assets/{signup-page-DgYRwrxX.js → signup-page-CkcipBzC.js} +1 -1
  72. package/dist/assets/{site-favicon-DHBOONR1.js → site-favicon-qbssi9h0.js} +1 -1
  73. package/dist/assets/{skill-detail-page-Dnh8ep5N.js → skill-detail-page-sf-eYZtq.js} +1 -1
  74. package/dist/assets/{skill-detail-panel-DIn7RLCC.js → skill-detail-panel-bqurW7AD.js} +1 -1
  75. package/dist/assets/{start-screen-CJb-0lgs.js → start-screen-BGwp_xBH.js} +1 -1
  76. package/dist/assets/{subagent-detail-panel-V44LtNl6.js → subagent-detail-panel-BzMMipi4.js} +1 -1
  77. package/dist/assets/{subagent-store-CPEG25fH.js → subagent-store-ZCAfa32m.js} +1 -1
  78. package/dist/assets/{superpowers-page-X0kSM_TF.js → superpowers-page-D3EekoAk.js} +1 -1
  79. package/dist/assets/{system-events-page-Duos2ubJ.js → system-events-page-tOTktdXx.js} +1 -1
  80. package/dist/assets/{theme-stage-page-BU-Gj4c2.js → theme-stage-page-CkPg3HLk.js} +1 -1
  81. package/dist/assets/{tier-upgrade-resize-modal-CbRtJhAf.js → tier-upgrade-resize-modal-BWDhujpc.js} +1 -1
  82. package/dist/assets/{tiptap-document-editor-D1aVS6nK.js → tiptap-document-editor-4dcMTA_h.js} +1 -1
  83. package/dist/assets/{tool-detail-panel-C-O4opDs.js → tool-detail-panel-hH1I4AMa.js} +1 -1
  84. package/dist/assets/{upgrade-cancel-page-UaVSwAVr.js → upgrade-cancel-page-B_bh0PIP.js} +1 -1
  85. package/dist/assets/{upgrade-success-page-CBs03tVb.js → upgrade-success-page-DmQqjklp.js} +1 -1
  86. package/dist/assets/{use-assistant-identity-details-CKel0e_r.js → use-assistant-identity-details-DRCMhHXZ.js} +1 -1
  87. package/dist/assets/{use-edge-swipe-back-Dv1ShCT7.js → use-edge-swipe-back-2Yjfb81V.js} +1 -1
  88. package/dist/assets/{use-invite-link-dialog-BfVPh6F5.js → use-invite-link-dialog-DNAxfIHK.js} +1 -1
  89. package/dist/assets/use-is-org-ready-DP2_SBJo.js +1 -0
  90. package/dist/assets/{use-onboarding-login-DMLLDHRX.js → use-onboarding-login-6LWa5XdQ.js} +1 -1
  91. package/dist/assets/{use-skill-actions-DPXX5qWL.js → use-skill-actions-FLVJkX9f.js} +1 -1
  92. package/dist/assets/{use-skill-detail-files-CuoCiyOy.js → use-skill-detail-files-DHBiaT9K.js} +1 -1
  93. package/dist/assets/{voice-page-DdjI8A76.js → voice-page-Cex0WiYJ.js} +1 -1
  94. package/dist/assets/{weather-forecast-display-0GtxW555.js → weather-forecast-display-BoH2wKfc.js} +1 -1
  95. package/dist/assets/{welcome-screen-DZhajJW3.js → welcome-screen-BE8PhNfU.js} +1 -1
  96. package/dist/assets/{workflow-detail-panel-Cw0kRLTK.js → workflow-detail-panel-CO0C-Lqo.js} +1 -1
  97. package/dist/assets/{workspace-page-7j1DZUlp.js → workspace-page-eR-YtX-j.js} +1 -1
  98. package/dist/index.html +13 -13
  99. package/package.json +1 -1
  100. package/dist/assets/api-DqHVnn1b.js +0 -1
  101. package/dist/assets/chat-CNlH625o.js +0 -1
  102. package/dist/assets/index-BRSW3eiH.css +0 -2
  103. package/dist/assets/use-is-org-ready-Ba5vxuqM.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{n as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./typography-1kyF_Eu1.js";import{t as s}from"./card-Cf8bWrcq.js";import{t as c}from"./notice-CvJ7MBx5.js";import{n as l}from"./toast-zHo1wvF9.js";import{u}from"./routes-D4ff4ONd.js";import{H as d,do as f,fo as p,uo as m}from"./index-C7ix_asE.js";var h=e(t(),1),g=a();function _(){let e=p({platformHostedOnly:!0}),t=m(),a=f(),_=i();return(0,h.useEffect)(()=>{t&&(l.info(`Upgrade canceled. No changes to your plan.`,{id:`pro-upgrade-cancel`}),_(u.settings.usageBilling,{replace:!0}))},[_,t]),e===`gated`?(0,g.jsx)(r,{replace:!0,to:u.settings.general}):e===`disabled`?(0,g.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,g.jsx)(d,{children:`Log in to the Vellum platform to manage billing and usage.`})}):!t&&!a?(0,g.jsxs)(`div`,{className:`max-w-4xl space-y-6`,children:[(0,g.jsx)(c,{tone:`warning`,children:`Billing isn't available for the current assistant state.`}),(0,g.jsx)(`div`,{className:`flex justify-end`,children:(0,g.jsx)(n,{variant:`primary`,onClick:()=>_(u.settings.usageBilling,{replace:!0}),children:`Return to billing`})})]}):(0,g.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,g.jsxs)(s,{padding:`lg`,children:[(0,g.jsx)(o,{as:`h1`,variant:`title-large`,children:`Upgrade canceled`}),(0,g.jsx)(o,{as:`p`,variant:`body-medium-default`,className:`mt-2`,children:`Returning you to billing settings…`})]})})}export{_ as UpgradeCancelPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{n as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./typography-1kyF_Eu1.js";import{t as s}from"./card-Cf8bWrcq.js";import{t as c}from"./notice-CvJ7MBx5.js";import{n as l}from"./toast-zHo1wvF9.js";import{u}from"./routes-D4ff4ONd.js";import{H as d,do as f,fo as p,uo as m}from"./index-Ck1SrvnM.js";var h=e(t(),1),g=a();function _(){let e=p({platformHostedOnly:!0}),t=m(),a=f(),_=i();return(0,h.useEffect)(()=>{t&&(l.info(`Upgrade canceled. No changes to your plan.`,{id:`pro-upgrade-cancel`}),_(u.settings.usageBilling,{replace:!0}))},[_,t]),e===`gated`?(0,g.jsx)(r,{replace:!0,to:u.settings.general}):e===`disabled`?(0,g.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,g.jsx)(d,{children:`Log in to the Vellum platform to manage billing and usage.`})}):!t&&!a?(0,g.jsxs)(`div`,{className:`max-w-4xl space-y-6`,children:[(0,g.jsx)(c,{tone:`warning`,children:`Billing isn't available for the current assistant state.`}),(0,g.jsx)(`div`,{className:`flex justify-end`,children:(0,g.jsx)(n,{variant:`primary`,onClick:()=>_(u.settings.usageBilling,{replace:!0}),children:`Return to billing`})})]}):(0,g.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,g.jsxs)(s,{padding:`lg`,children:[(0,g.jsx)(o,{as:`h1`,variant:`title-large`,children:`Upgrade canceled`}),(0,g.jsx)(o,{as:`p`,variant:`body-medium-default`,className:`mt-2`,children:`Returning you to billing settings…`})]})})}export{_ as UpgradeCancelPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{n as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./typography-1kyF_Eu1.js";import{t as l}from"./card-Cf8bWrcq.js";import{t as u}from"./circle-alert-CTnM6GCb.js";import{t as d}from"./circle-check-DqvTjWle.js";import{t as f}from"./loader-circle-Ck8fq3yv.js";import{t as p}from"./notice-CvJ7MBx5.js";import{u as m}from"./routes-D4ff4ONd.js";import{H as h,Ji as g,Yi as _,do as v,fo as y,uo as b}from"./index-C7ix_asE.js";var x=e(t(),1),S=s(),C=1e3,w=1e4,T=2500;function E(){let e=y({platformHostedOnly:!0}),t=b(),s=v(),c=e===`full`&&t,u=i(),d=a(),[f,E]=(0,x.useState)(!1);(0,x.useEffect)(()=>{d.invalidateQueries({queryKey:_()})},[d]);let{data:j,isError:M}=o({...g(),enabled:c,refetchInterval:e=>e.state.data?.plan_id===`pro`||f?!1:C,refetchIntervalInBackground:!1}),N=c?j:void 0,P=c?M:!1;(0,x.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>E(!0),w);return()=>clearTimeout(e)},[c]);let F=N?.plan_id===`pro`;(0,x.useEffect)(()=>{if(!F)return;let e=setTimeout(()=>{u(m.settings.usageBilling,{replace:!0})},T);return()=>clearTimeout(e)},[F,u]);let I=()=>u(m.settings.usageBilling,{replace:!0});return e===`gated`?(0,S.jsx)(r,{replace:!0,to:m.settings.general}):e===`disabled`?(0,S.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,S.jsx)(h,{children:`Log in to the Vellum platform to manage billing and usage.`})}):!c&&!s?(0,S.jsxs)(`div`,{className:`max-w-4xl space-y-6`,children:[(0,S.jsx)(p,{tone:`warning`,children:`We can't confirm your upgrade for the current assistant. Return to billing to retry.`}),(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(n,{variant:`primary`,"data-testid":`upgrade-success-go-to-billing`,onClick:I,children:`Go to billing`})})]}):(0,S.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,S.jsxs)(l,{padding:`lg`,children:[F?(0,S.jsx)(O,{}):P?(0,S.jsx)(A,{}):f?(0,S.jsx)(k,{}):(0,S.jsx)(D,{}),(F||P||f)&&(0,S.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,S.jsx)(n,{variant:F||P?`primary`:`outlined`,"data-testid":`upgrade-success-go-to-billing`,onClick:I,children:`Go to billing`})})]})})}function D(){return(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,S.jsx)(f,{className:`h-6 w-6 animate-spin text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,S.jsx)(c,{variant:`title-small`,as:`h1`,children:`Finalizing your upgrade…`}),(0,S.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`Stripe is confirming your subscription. This usually takes a few seconds.`})]})}function O(){return(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,S.jsx)(d,{className:`h-8 w-8 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),(0,S.jsx)(c,{variant:`title-small`,as:`h1`,children:`Welcome to Pro`}),(0,S.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`Your Pro plan is active. You'll be redirected back to billing in a moment.`})]})}function k(){return(0,S.jsx)(p,{tone:`warning`,children:`We're processing your upgrade — refresh in a moment to see your new plan.`})}function A(){return(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,S.jsx)(u,{className:`h-8 w-8 text-[var(--system-negative-strong)]`,"aria-hidden":`true`}),(0,S.jsx)(c,{variant:`title-small`,as:`h1`,children:`Couldn't reach billing`}),(0,S.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`We hit a problem checking your subscription. Your upgrade may still be processing — return to billing to refresh.`})]})}export{E as UpgradeSuccessPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{n as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./typography-1kyF_Eu1.js";import{t as l}from"./card-Cf8bWrcq.js";import{t as u}from"./circle-alert-CTnM6GCb.js";import{t as d}from"./circle-check-DqvTjWle.js";import{t as f}from"./loader-circle-Ck8fq3yv.js";import{t as p}from"./notice-CvJ7MBx5.js";import{u as m}from"./routes-D4ff4ONd.js";import{H as h,Ji as g,Yi as _,do as v,fo as y,uo as b}from"./index-Ck1SrvnM.js";var x=e(t(),1),S=s(),C=1e3,w=1e4,T=2500;function E(){let e=y({platformHostedOnly:!0}),t=b(),s=v(),c=e===`full`&&t,u=i(),d=a(),[f,E]=(0,x.useState)(!1);(0,x.useEffect)(()=>{d.invalidateQueries({queryKey:_()})},[d]);let{data:j,isError:M}=o({...g(),enabled:c,refetchInterval:e=>e.state.data?.plan_id===`pro`||f?!1:C,refetchIntervalInBackground:!1}),N=c?j:void 0,P=c?M:!1;(0,x.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>E(!0),w);return()=>clearTimeout(e)},[c]);let F=N?.plan_id===`pro`;(0,x.useEffect)(()=>{if(!F)return;let e=setTimeout(()=>{u(m.settings.usageBilling,{replace:!0})},T);return()=>clearTimeout(e)},[F,u]);let I=()=>u(m.settings.usageBilling,{replace:!0});return e===`gated`?(0,S.jsx)(r,{replace:!0,to:m.settings.general}):e===`disabled`?(0,S.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,S.jsx)(h,{children:`Log in to the Vellum platform to manage billing and usage.`})}):!c&&!s?(0,S.jsxs)(`div`,{className:`max-w-4xl space-y-6`,children:[(0,S.jsx)(p,{tone:`warning`,children:`We can't confirm your upgrade for the current assistant. Return to billing to retry.`}),(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(n,{variant:`primary`,"data-testid":`upgrade-success-go-to-billing`,onClick:I,children:`Go to billing`})})]}):(0,S.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,S.jsxs)(l,{padding:`lg`,children:[F?(0,S.jsx)(O,{}):P?(0,S.jsx)(A,{}):f?(0,S.jsx)(k,{}):(0,S.jsx)(D,{}),(F||P||f)&&(0,S.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,S.jsx)(n,{variant:F||P?`primary`:`outlined`,"data-testid":`upgrade-success-go-to-billing`,onClick:I,children:`Go to billing`})})]})})}function D(){return(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,S.jsx)(f,{className:`h-6 w-6 animate-spin text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,S.jsx)(c,{variant:`title-small`,as:`h1`,children:`Finalizing your upgrade…`}),(0,S.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`Stripe is confirming your subscription. This usually takes a few seconds.`})]})}function O(){return(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,S.jsx)(d,{className:`h-8 w-8 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),(0,S.jsx)(c,{variant:`title-small`,as:`h1`,children:`Welcome to Pro`}),(0,S.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`Your Pro plan is active. You'll be redirected back to billing in a moment.`})]})}function k(){return(0,S.jsx)(p,{tone:`warning`,children:`We're processing your upgrade — refresh in a moment to see your new plan.`})}function A(){return(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,S.jsx)(u,{className:`h-8 w-8 text-[var(--system-negative-strong)]`,"aria-hidden":`true`}),(0,S.jsx)(c,{variant:`title-small`,as:`h1`,children:`Couldn't reach billing`}),(0,S.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`We hit a problem checking your subscription. Your upgrade may still be processing — return to billing to refresh.`})]})}export{E as UpgradeSuccessPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-anSemq95.js";import{t as n}from"./react-DJZBPgpf.js";import{P as r}from"./button-CW7wKp2r.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import"./src-BT0gNVcT.js";import{V as o,bn as s,tt as c,xn as l}from"./sdk.gen-BR-xXIZm.js";import{r as u}from"./api-CxAtNZ-r.js";import{t as d}from"./proxy-DoUA9mK6.js";import{t as f}from"./use-reduced-motion-DpK6cQN-.js";import{Dn as p,Ra as m,Tn as h,wn as g}from"./index-C7ix_asE.js";import{l as _,n as v,t as y}from"./latest-assistant-text-CQ8YGbvQ.js";var b=e(n(),1),x=a(),S=.25,C=.46,w=.3,T=.85,E=.4,D=14,O=8;function k({components:e,traits:t,stage:n,entrance:r=!1,entranceDelay:i=0}){let a=f(),{w:o,h:s}=n,[c,l]=(0,b.useState)({x:0,y:0});(0,b.useEffect)(()=>{if(a)return;let e=e=>{l({x:(e.clientX/window.innerWidth-.5)*2,y:(e.clientY/window.innerHeight-.5)*2})};return window.addEventListener(`mousemove`,e),()=>window.removeEventListener(`mousemove`,e)},[a]);let u=r&&!a,[p,m]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!r);(0,b.useEffect)(()=>{if(a||!_)return;let e=!1,t,n=n=>{e||(m(!0),t=setTimeout(()=>{e||(m(!1),t=setTimeout(n,140))},140))},i=()=>{t=setTimeout(()=>n(i),2500+Math.random()*4e3)};return r?n(()=>n(i)):i(),()=>{e=!0,clearTimeout(t)}},[a,_,r]);let y=(0,b.useMemo)(()=>{let n=e.eyeStyles.find(e=>e.id===t.eyeStyle);return n?{paths:n.paths,bbox:h(n.paths.map(e=>g(e.svgPath)))}:null},[e,t.eyeStyle]);if(!y||o===0||s===0)return null;let k=o*T,A=Math.min(Math.min(o,s)*w,k*y.bbox.h/y.bbox.w),j=A*y.bbox.w/y.bbox.h,M=(o-j)/2,N=s-(1-S)*A,P=E*s-(N+A/2),F=(C-S)*A,I=y.bbox.x+y.bbox.w/2,L=y.bbox.y+y.bbox.h/2;return(0,x.jsx)(d.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2]`,style:{left:M,top:N,width:j,height:A,transformOrigin:`center`},initial:u?{y:P,scale:.35}:!1,animate:u?{y:[P,F,0],scale:[.35,1,1]}:{y:0,scale:1},transition:u?{duration:1,delay:i,times:[0,.7,1],ease:`easeInOut`}:{duration:0},onAnimationComplete:()=>v(!0),children:(0,x.jsx)(`div`,{style:{transform:`translate(${c.x*D}px, ${c.y*O}px)`,transition:`transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,x.jsx)(`svg`,{viewBox:`${y.bbox.x} ${y.bbox.y} ${y.bbox.w} ${y.bbox.h}`,width:j,height:A,style:{overflow:`visible`,display:`block`},children:(0,x.jsx)(`g`,{style:{transform:p?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${I}px ${L}px`,transition:`transform 0.14s ease-in-out`},children:y.paths.map((e,t)=>(0,x.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})})}var A=w*(1-S),j=`#17191C`,M=24,N=.2,P=96,F=160,I=(0,b.createContext)(null);function L(){let e=(0,b.useContext)(I);if(!e)throw Error(`useAssistantStage must be used inside <AssistantStage>`);return e}function R(e,t){return!e||!t?null:e.colors.find(e=>e.id===t.color)?.hex??null}function z({components:e,traits:t,customImageUrl:n,entrance:i=!1,children:a,className:o}){let{ref:s,size:c}=v(),l=R(e,t)??j,u=p(l),d=!!(e&&t),f=!d&&!!n,m=Math.round(Math.min(F,Math.max(P,Math.min(c.w,c.h)*N))),h=c.h-m-M,g=d?Math.round(A*Math.min(c.w,c.h))+16:f?m+M+16:24;return(0,x.jsxs)(`div`,{ref:s,className:r(`relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-[var(--border-base)]`,o),style:{backgroundColor:l,color:u.fg},children:[d&&e&&t&&(0,x.jsx)(k,{components:e,traits:t,stage:c,entrance:i}),f&&n&&(0,x.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2] overflow-hidden rounded-full ring-4 ring-white/25`,style:{left:(c.w-m)/2,top:h,width:m,height:m},children:(0,x.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,draggable:!1})}),(0,x.jsx)(I.Provider,{value:{stage:c,tone:u,bottomReserve:g},children:(0,x.jsx)(`div`,{className:`relative z-10 flex min-h-0 flex-1 flex-col`,children:a})})]})}var B=[{id:`companion-coworker`,left:`Companion`,right:`Coworker`},{id:`genz-boomer`,left:`Gen Z`,right:`Baby Boomer`},{id:`execute-collaborate`,left:`Independent`,right:`Collaborative`},{id:`playful-serious`,left:`Playful`,right:`Serious`},{id:`polite-unfiltered`,left:`Polite`,right:`Unfiltered`}],V=50,H=1500,U=12e4,W=e=>new Promise(t=>setTimeout(t,e));async function G({assistantId:e,content:n,title:r,context:i}){let a,u=!1;try{let t=await c({path:{assistant_id:e},body:{conversationType:`standard`,title:r},throwOnError:!1});if(a=t.data?.id,!t.response?.ok||!a)return!1;let i={conversationId:a,content:n,sourceChannel:`vellum`,interface:`vellum`,clientMessageId:crypto.randomUUID()};if(!(await l({path:{assistant_id:e},body:i,throwOnError:!1})).response?.ok)return!1;let o=Date.now()+U,d=``,f=0,p=!1;for(;Date.now()<o;){await W(H);let t=await s({path:{assistant_id:e},query:{conversationId:a},throwOnError:!1}),n=y(t.data?.messages??[]);if(n&&(f=n===d?f+1:0,d=n),t.data?.processing===!0&&(p=!0),_({processing:t.data?.processing,sawProcessing:p,hasReply:n.length>0,stableReads:f})){u=!0;break}}}catch(e){t(e,{context:i})}finally{if(a)try{await o({path:{assistant_id:e,id:a},throwOnError:!1})}catch(e){t(e,{context:`${i}_archive`})}}return u}function K(e){return[`assistant-identity-details`,e]}function q(e){return i({queryKey:K(e),queryFn:async()=>{let[t,n]=await Promise.all([m(e),u(e).catch(()=>({ok:!1,status:0,error:{}}))]);return{identity:t,createdAt:n.ok?n.data.created:null}}})}export{V as a,L as c,B as i,q as n,z as o,G as r,R as s,K as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-anSemq95.js";import{t as n}from"./react-DJZBPgpf.js";import{P as r}from"./button-CW7wKp2r.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import"./src-BT0gNVcT.js";import{V as o,bn as s,tt as c,xn as l}from"./sdk.gen-BR-xXIZm.js";import{r as u}from"./api-Jhp24FhR.js";import{t as d}from"./proxy-DoUA9mK6.js";import{t as f}from"./use-reduced-motion-DpK6cQN-.js";import{Dn as p,Ra as m,Tn as h,wn as g}from"./index-Ck1SrvnM.js";import{l as _,n as v,t as y}from"./latest-assistant-text-CQ8YGbvQ.js";var b=e(n(),1),x=a(),S=.25,C=.46,w=.3,T=.85,E=.4,D=14,O=8;function k({components:e,traits:t,stage:n,entrance:r=!1,entranceDelay:i=0}){let a=f(),{w:o,h:s}=n,[c,l]=(0,b.useState)({x:0,y:0});(0,b.useEffect)(()=>{if(a)return;let e=e=>{l({x:(e.clientX/window.innerWidth-.5)*2,y:(e.clientY/window.innerHeight-.5)*2})};return window.addEventListener(`mousemove`,e),()=>window.removeEventListener(`mousemove`,e)},[a]);let u=r&&!a,[p,m]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!r);(0,b.useEffect)(()=>{if(a||!_)return;let e=!1,t,n=n=>{e||(m(!0),t=setTimeout(()=>{e||(m(!1),t=setTimeout(n,140))},140))},i=()=>{t=setTimeout(()=>n(i),2500+Math.random()*4e3)};return r?n(()=>n(i)):i(),()=>{e=!0,clearTimeout(t)}},[a,_,r]);let y=(0,b.useMemo)(()=>{let n=e.eyeStyles.find(e=>e.id===t.eyeStyle);return n?{paths:n.paths,bbox:h(n.paths.map(e=>g(e.svgPath)))}:null},[e,t.eyeStyle]);if(!y||o===0||s===0)return null;let k=o*T,A=Math.min(Math.min(o,s)*w,k*y.bbox.h/y.bbox.w),j=A*y.bbox.w/y.bbox.h,M=(o-j)/2,N=s-(1-S)*A,P=E*s-(N+A/2),F=(C-S)*A,I=y.bbox.x+y.bbox.w/2,L=y.bbox.y+y.bbox.h/2;return(0,x.jsx)(d.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2]`,style:{left:M,top:N,width:j,height:A,transformOrigin:`center`},initial:u?{y:P,scale:.35}:!1,animate:u?{y:[P,F,0],scale:[.35,1,1]}:{y:0,scale:1},transition:u?{duration:1,delay:i,times:[0,.7,1],ease:`easeInOut`}:{duration:0},onAnimationComplete:()=>v(!0),children:(0,x.jsx)(`div`,{style:{transform:`translate(${c.x*D}px, ${c.y*O}px)`,transition:`transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,x.jsx)(`svg`,{viewBox:`${y.bbox.x} ${y.bbox.y} ${y.bbox.w} ${y.bbox.h}`,width:j,height:A,style:{overflow:`visible`,display:`block`},children:(0,x.jsx)(`g`,{style:{transform:p?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${I}px ${L}px`,transition:`transform 0.14s ease-in-out`},children:y.paths.map((e,t)=>(0,x.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})})}var A=w*(1-S),j=`#17191C`,M=24,N=.2,P=96,F=160,I=(0,b.createContext)(null);function L(){let e=(0,b.useContext)(I);if(!e)throw Error(`useAssistantStage must be used inside <AssistantStage>`);return e}function R(e,t){return!e||!t?null:e.colors.find(e=>e.id===t.color)?.hex??null}function z({components:e,traits:t,customImageUrl:n,entrance:i=!1,children:a,className:o}){let{ref:s,size:c}=v(),l=R(e,t)??j,u=p(l),d=!!(e&&t),f=!d&&!!n,m=Math.round(Math.min(F,Math.max(P,Math.min(c.w,c.h)*N))),h=c.h-m-M,g=d?Math.round(A*Math.min(c.w,c.h))+16:f?m+M+16:24;return(0,x.jsxs)(`div`,{ref:s,className:r(`relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-[var(--border-base)]`,o),style:{backgroundColor:l,color:u.fg},children:[d&&e&&t&&(0,x.jsx)(k,{components:e,traits:t,stage:c,entrance:i}),f&&n&&(0,x.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2] overflow-hidden rounded-full ring-4 ring-white/25`,style:{left:(c.w-m)/2,top:h,width:m,height:m},children:(0,x.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,draggable:!1})}),(0,x.jsx)(I.Provider,{value:{stage:c,tone:u,bottomReserve:g},children:(0,x.jsx)(`div`,{className:`relative z-10 flex min-h-0 flex-1 flex-col`,children:a})})]})}var B=[{id:`companion-coworker`,left:`Companion`,right:`Coworker`},{id:`genz-boomer`,left:`Gen Z`,right:`Baby Boomer`},{id:`execute-collaborate`,left:`Independent`,right:`Collaborative`},{id:`playful-serious`,left:`Playful`,right:`Serious`},{id:`polite-unfiltered`,left:`Polite`,right:`Unfiltered`}],V=50,H=1500,U=12e4,W=e=>new Promise(t=>setTimeout(t,e));async function G({assistantId:e,content:n,title:r,context:i}){let a,u=!1;try{let t=await c({path:{assistant_id:e},body:{conversationType:`standard`,title:r},throwOnError:!1});if(a=t.data?.id,!t.response?.ok||!a)return!1;let i={conversationId:a,content:n,sourceChannel:`vellum`,interface:`vellum`,clientMessageId:crypto.randomUUID()};if(!(await l({path:{assistant_id:e},body:i,throwOnError:!1})).response?.ok)return!1;let o=Date.now()+U,d=``,f=0,p=!1;for(;Date.now()<o;){await W(H);let t=await s({path:{assistant_id:e},query:{conversationId:a},throwOnError:!1}),n=y(t.data?.messages??[]);if(n&&(f=n===d?f+1:0,d=n),t.data?.processing===!0&&(p=!0),_({processing:t.data?.processing,sawProcessing:p,hasReply:n.length>0,stableReads:f})){u=!0;break}}}catch(e){t(e,{context:i})}finally{if(a)try{await o({path:{assistant_id:e,id:a},throwOnError:!1})}catch(e){t(e,{context:`${i}_archive`})}}return u}function K(e){return[`assistant-identity-details`,e]}function q(e){return i({queryKey:K(e),queryFn:async()=>{let[t,n]=await Promise.all([m(e),u(e).catch(()=>({ok:!1,status:0,error:{}}))]);return{identity:t,createdAt:n.ok?n.data.created:null}}})}export{V as a,L as c,B as i,q as n,z as o,G as r,R as s,K as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./edge-swipe-arbiter-store-a9LiewmS.js";import{nr as r,rr as i}from"./index-C7ix_asE.js";var a=e(t(),1),o=200,s=180,c=200,l=.25,u=50;function d(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function f({containerRef:e,onBack:t,enabled:f,navKey:p}){let m=(0,a.useRef)(t);(0,a.useLayoutEffect)(()=>{m.current=t},[t]);let h=(0,a.useRef)(!1),g=(0,a.useRef)(new Set),_=(0,a.useRef)(!1),v=n.use.registerBackOwner(),y=n.use.unregisterBackOwner();(0,a.useEffect)(()=>{if(f)return v(),y},[f,v,y]),(0,a.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&d(n)}},[e]);let b=(e,t)=>{let n=setTimeout(()=>{g.current.delete(n),_.current||e()},t);g.current.add(n)},x=(e,t)=>{e.style.transform=t===0?``:`translateX(${t}px)`},S=e=>{e.style.transition=`transform ${o}ms ease-out`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),d(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>d(e),o+u)},C=e=>{e.style.transition=`transform ${s}ms ease-in`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*l);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,m.current(),b(()=>{h.current&&(h.current=!1,d(e))},c*2)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,s+u)};i({enabled:f,onConfirm:()=>{let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,n)=>{let i=e.current;i&&x(i,r(t,n))},onCommit:()=>{let t=e.current;if(!t){m.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):d(n))}}),(0,a.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,r=()=>{n||(n=!0,t.removeEventListener(`transitionend`,r),d(t))};t.style.transition=`transform ${c}ms ease-out, opacity ${c}ms ease-out`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,r,{once:!0});let i=setTimeout(r,c+u);return()=>{clearTimeout(i),t.removeEventListener(`transitionend`,r),d(t)}},[p,e])}export{f as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./edge-swipe-arbiter-store-a9LiewmS.js";import{nr as r,rr as i}from"./index-Ck1SrvnM.js";var a=e(t(),1),o=200,s=180,c=200,l=.25,u=50;function d(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function f({containerRef:e,onBack:t,enabled:f,navKey:p}){let m=(0,a.useRef)(t);(0,a.useLayoutEffect)(()=>{m.current=t},[t]);let h=(0,a.useRef)(!1),g=(0,a.useRef)(new Set),_=(0,a.useRef)(!1),v=n.use.registerBackOwner(),y=n.use.unregisterBackOwner();(0,a.useEffect)(()=>{if(f)return v(),y},[f,v,y]),(0,a.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&d(n)}},[e]);let b=(e,t)=>{let n=setTimeout(()=>{g.current.delete(n),_.current||e()},t);g.current.add(n)},x=(e,t)=>{e.style.transform=t===0?``:`translateX(${t}px)`},S=e=>{e.style.transition=`transform ${o}ms ease-out`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),d(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>d(e),o+u)},C=e=>{e.style.transition=`transform ${s}ms ease-in`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*l);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,m.current(),b(()=>{h.current&&(h.current=!1,d(e))},c*2)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,s+u)};i({enabled:f,onConfirm:()=>{let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,n)=>{let i=e.current;i&&x(i,r(t,n))},onCommit:()=>{let t=e.current;if(!t){m.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):d(n))}}),(0,a.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,r=()=>{n||(n=!0,t.removeEventListener(`transitionend`,r),d(t))};t.style.transition=`transform ${c}ms ease-out, opacity ${c}ms ease-out`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,r,{once:!0});let i=setTimeout(r,c+u);return()=>{clearTimeout(i),t.removeEventListener(`transitionend`,r),d(t)}},[p,e])}export{f as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-1kyF_Eu1.js";import{t as c}from"./check-wF3S-AV4.js";import{o as l}from"./list-row-CVw67M2Z.js";import{t as u}from"./link-2-B9c5ZsFq.js";import{t as d}from"./loader-circle-Ck8fq3yv.js";import{t as f}from"./input-D3MhHg0d.js";import{t as p}from"./modal-D_Y2RPD5.js";import{Jt as m,Qt as h,en as g}from"./sdk.gen-BR-xXIZm.js";import{G as _,K as v,U as y,W as b,o as x,s as S,x as C}from"./react-query.gen-DfzfX_Jv.js";import{r as w}from"./utils-DvUW9GK8.js";import{n as T,r as E,t as D}from"./api-errors-CoE1wFl2.js";import{n as O}from"./sdk.gen-BhtkuoSl.js";import{t as k}from"./assistant-feature-flag-store-Bh-_qc7v.js";import{Bt as A,C as ee,S as te,Ta as j,b as ne,wa as M,x as re,zt as N}from"./index-C7ix_asE.js";import{t as P}from"./mutation-error-CSy2D6ry.js";import{t as F}from"./a2a-invite-sGxHSsPS.js";function I(e){return e?.trim()||`your assistant`}var L=e(t(),1),R=o(),z=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],B=`trusted_contacts`,V=new Set([`platform`,`a2a`]),H=new Set([`vellum`,`whatsapp`]);function U(e){return H.has(e)}var W={no_one:`No one`,guardian_only:`Only you`,trusted_contacts:`Verified contacts`,any_contact:`Any contact`,strangers:`Strangers`};function G(e){return{no_one:`No one can message ${e} on this channel — every message is blocked, including yours.`,guardian_only:`Only you can message ${e}. Everyone else is turned away.`,trusted_contacts:`You and the people you’ve verified can message ${e}. Anyone else is asked to verify first, and you’re notified.`,any_contact:`You and any known contact can message ${e}, including contacts you haven’t verified yet. Strangers are asked to verify first.`,strangers:`Anyone can message ${e}, including complete strangers.`}}function K(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function q({open:e,assistantId:t,onClose:r}){let[i,o]=(0,L.useState)(!1),u=(0,L.useRef)(null),m=(0,L.useRef)(!1),h=a({...y({path:{assistant_id:t}})}),g=(0,L.useRef)(h.mutate);(0,L.useLayoutEffect)(()=>{g.current=h.mutate});let _=(0,L.useRef)(h.reset);(0,L.useLayoutEffect)(()=>{_.current=h.reset}),(0,L.useEffect)(()=>{e&&!m.current&&g.current({path:{assistant_id:t}}),m.current=e},[e,t]),(0,L.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]);let v=(0,L.useCallback)(()=>{_.current(),o(!1),u.current&&=(clearTimeout(u.current),null),r()},[r]),b=(0,L.useCallback)(e=>{navigator.clipboard.writeText(e).then(()=>{o(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),2e3)})},[]),x=h.isSuccess&&h.data.token?F({senderAssistantId:t,token:h.data.token}):``;return(0,R.jsx)(p.Root,{open:e,onOpenChange:e=>{e||v()},children:(0,R.jsxs)(p.Content,{size:`sm`,children:[(0,R.jsx)(p.Header,{children:(0,R.jsx)(p.Title,{children:`Share Connection Link`})}),(0,R.jsx)(p.Body,{children:h.isPending?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,R.jsx)(d,{className:`h-4 w-4 animate-spin`}),`Creating invite link…`]}):h.isError?(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:`Failed to create invite link. Make sure A2A is enabled for your assistant.`}),(0,R.jsx)(n,{variant:`outlined`,onClick:()=>h.mutate({path:{assistant_id:t}}),children:`Try Again`})]}):h.isSuccess?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(s,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:`Share this link with another assistant owner to establish a connection.`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(f,{type:`text`,readOnly:!0,value:x,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>b(x),"aria-label":`Copy invite link`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-[var(--border-base)] hover:bg-[var(--surface-hover)]`,children:i?(0,R.jsx)(c,{className:`h-4 w-4`}):(0,R.jsx)(l,{className:`h-4 w-4`})})]}),h.data.expiresAt!=null&&(0,R.jsx)(s,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:K(h.data.expiresAt)})]}):null}),(0,R.jsx)(p.Footer,{children:(0,R.jsx)(n,{variant:`outlined`,onClick:v,children:`Done`})})]})})}function J({onClick:e}){return(0,R.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:(0,R.jsx)(u,{className:`h-3.5 w-3.5`}),onClick:e,children:`Share Connection Link`})}function Y(e){return typeof e==`string`&&z.includes(e)}function X(e){return V.has(e)}function Z(e){return(e?.policies??[]).filter(e=>!X(e.channelType)&&!U(e.channelType)).map(e=>({...e,policy:Y(e.policy)?e.policy:`trusted_contacts`}))}async function ie(e,t,n,r){if(X(t))throw new D(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:i,error:a,response:o}=await O({path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},throwOnError:!1});if(T(o,a,`Failed to save channel policy.`),!o.ok)throw new D(o.status,E(a,o,`Failed to save channel policy.`));if(!i?.policy)throw new D(500,`Gateway returned no policy in response.`);return i.policy}var ae=`0.10.0`;function Q(){return w(ae)}function oe(e){let t=r(),n=k.use.channelTrustFloors(),o=Q(),s=n&&o,c=(0,L.useMemo)(()=>({path:{assistant_id:e}}),[e]),l=(0,L.useMemo)(()=>j(c),[c]),u=i({...M(c),enabled:s,select:Z}),d=(0,L.useMemo)(()=>{let e={};for(let t of u.data??[])A(t.channelType)&&(e[t.channelType]=t.policy);return e},[u.data]),f=a({mutationFn:({channelKey:t,policy:n})=>ie(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:l}),onError:P(`Failed to save channel policy`)}),p=(0,L.useCallback)((e,t)=>{f.mutate({channelKey:e,policy:t})},[f]);return s?{policies:d,savingKey:f.isPending?f.variables?.channelKey??null:null,isLoading:u.isPending,isError:u.isError,onChange:p}:{policies:void 0,savingKey:null,isLoading:!1,isError:!1,onChange:void 0}}var $={slack:`I want to reach you on Slack. Let's set it up.`,telegram:`I want to reach you on Telegram. Let's set it up.`,phone:`I want to be able to call you. Let's set you up with a phone number.`},se=15e3;function ce({assistantId:e,onStartSetupConversation:t}){let n=r(),o=(0,L.useMemo)(()=>({path:{assistant_id:e}}),[e]),s=(0,L.useMemo)(()=>S(o),[o]),c=i({...x(o),enabled:!!e,refetchInterval:se,select:e=>e.snapshots}),l=(0,L.useMemo)(()=>le(c.data??[]),[c.data]),u=l.some(e=>e.key===`slack`&&e.status===`ready`),d=i({...b(o),enabled:u,select:e=>e.threadMode}),f=oe(e),p=(0,L.useCallback)(()=>n.invalidateQueries({queryKey:s}),[n,s]),y=a({mutationFn:async t=>{let n={path:{assistant_id:e},throwOnError:!0};t===`slack`?await m(n):t===`telegram`?await h(n):t===`phone`&&await g(n)},onSettled:(t,r,i)=>{p(),i===`slack`&&ee(n,e)}}),C=re({assistantId:e}),w=te({assistantId:e}),T=ne({assistantId:e}),E=a({...v(),onSuccess:()=>{n.invalidateQueries({queryKey:_(o)})}}),D=C.mutateAsync,O=(0,L.useCallback)(async e=>{await D(e)},[D]),k=w.mutate,A=(0,L.useCallback)((e,t)=>{k({botToken:e,appToken:t})},[k]),j=E.mutate,M=(0,L.useCallback)(t=>{j({path:{assistant_id:e},body:{threadMode:t}})},[j,e]),N=T.mutateAsync,P=(0,L.useCallback)(async(e,t)=>{await N({accountSid:e,authToken:t})},[N]),F=(0,L.useCallback)(e=>{t&&t($[e])},[t]),I=y.mutate,R=(0,L.useCallback)(e=>{I(e)},[I]);return{channels:l,pendingChannelKey:y.isPending?y.variables??null:null,slackThreadMode:d.data,slackThreadModePending:E.isPending,channelPolicies:f.policies,policySavingKey:f.savingKey,policiesLoading:f.isLoading,policiesError:f.isError,onChannelPolicyChange:f.onChange,onSetup:t?F:void 0,onDisconnect:R,onSaveTelegramToken:O,onSaveSlackConfig:A,slackSaveStatus:w.status,slackSaveError:w.error?.message??null,onSlackThreadModeChange:M,onSaveTwilioCredentials:P}}function le(e){let t=new Map;for(let n of e)t.set(n.channel,n);return N.map(e=>{let n=t.get(e);return{key:e,status:ue(n),address:n?.channelHandle??void 0}})}function ue(e){return e?e.ready||e.setupStatus===`ready`?`ready`:e.setupStatus===`incomplete`?`incomplete`:`not_configured`:`not_configured`}function de(e){let t=r(),[n,i]=(0,L.useState)(!1);return{isOpen:n,open:(0,L.useCallback)(()=>{i(!0)},[]),close:(0,L.useCallback)(()=>{i(!1),t.invalidateQueries({queryKey:C({path:{assistant_id:e}})})},[t,e])}}export{J as a,z as c,I as d,Z as i,W as l,ce as n,q as o,Q as r,B as s,de as t,G as u};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-1kyF_Eu1.js";import{t as c}from"./check-wF3S-AV4.js";import{o as l}from"./list-row-CVw67M2Z.js";import{t as u}from"./link-2-B9c5ZsFq.js";import{t as d}from"./loader-circle-Ck8fq3yv.js";import{t as f}from"./input-D3MhHg0d.js";import{t as p}from"./modal-D_Y2RPD5.js";import{Jt as m,Qt as h,en as g}from"./sdk.gen-BR-xXIZm.js";import{G as _,K as v,U as y,W as b,o as x,s as S,x as C}from"./react-query.gen-DfzfX_Jv.js";import{r as w}from"./utils-DvUW9GK8.js";import{n as T,r as E,t as D}from"./api-errors-CoE1wFl2.js";import{n as O}from"./sdk.gen-BhtkuoSl.js";import{t as k}from"./assistant-feature-flag-store-Bh-_qc7v.js";import{Bt as A,C as ee,S as te,Ta as j,b as ne,wa as M,x as re,zt as N}from"./index-Ck1SrvnM.js";import{t as P}from"./mutation-error-CSy2D6ry.js";import{t as F}from"./a2a-invite-sGxHSsPS.js";function I(e){return e?.trim()||`your assistant`}var L=e(t(),1),R=o(),z=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],B=`trusted_contacts`,V=new Set([`platform`,`a2a`]),H=new Set([`vellum`,`whatsapp`]);function U(e){return H.has(e)}var W={no_one:`No one`,guardian_only:`Only you`,trusted_contacts:`Verified contacts`,any_contact:`Any contact`,strangers:`Strangers`};function G(e){return{no_one:`No one can message ${e} on this channel — every message is blocked, including yours.`,guardian_only:`Only you can message ${e}. Everyone else is turned away.`,trusted_contacts:`You and the people you’ve verified can message ${e}. Anyone else is asked to verify first, and you’re notified.`,any_contact:`You and any known contact can message ${e}, including contacts you haven’t verified yet. Strangers are asked to verify first.`,strangers:`Anyone can message ${e}, including complete strangers.`}}function K(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function q({open:e,assistantId:t,onClose:r}){let[i,o]=(0,L.useState)(!1),u=(0,L.useRef)(null),m=(0,L.useRef)(!1),h=a({...y({path:{assistant_id:t}})}),g=(0,L.useRef)(h.mutate);(0,L.useLayoutEffect)(()=>{g.current=h.mutate});let _=(0,L.useRef)(h.reset);(0,L.useLayoutEffect)(()=>{_.current=h.reset}),(0,L.useEffect)(()=>{e&&!m.current&&g.current({path:{assistant_id:t}}),m.current=e},[e,t]),(0,L.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]);let v=(0,L.useCallback)(()=>{_.current(),o(!1),u.current&&=(clearTimeout(u.current),null),r()},[r]),b=(0,L.useCallback)(e=>{navigator.clipboard.writeText(e).then(()=>{o(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),2e3)})},[]),x=h.isSuccess&&h.data.token?F({senderAssistantId:t,token:h.data.token}):``;return(0,R.jsx)(p.Root,{open:e,onOpenChange:e=>{e||v()},children:(0,R.jsxs)(p.Content,{size:`sm`,children:[(0,R.jsx)(p.Header,{children:(0,R.jsx)(p.Title,{children:`Share Connection Link`})}),(0,R.jsx)(p.Body,{children:h.isPending?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,R.jsx)(d,{className:`h-4 w-4 animate-spin`}),`Creating invite link…`]}):h.isError?(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:`Failed to create invite link. Make sure A2A is enabled for your assistant.`}),(0,R.jsx)(n,{variant:`outlined`,onClick:()=>h.mutate({path:{assistant_id:t}}),children:`Try Again`})]}):h.isSuccess?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(s,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:`Share this link with another assistant owner to establish a connection.`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(f,{type:`text`,readOnly:!0,value:x,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>b(x),"aria-label":`Copy invite link`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-[var(--border-base)] hover:bg-[var(--surface-hover)]`,children:i?(0,R.jsx)(c,{className:`h-4 w-4`}):(0,R.jsx)(l,{className:`h-4 w-4`})})]}),h.data.expiresAt!=null&&(0,R.jsx)(s,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:K(h.data.expiresAt)})]}):null}),(0,R.jsx)(p.Footer,{children:(0,R.jsx)(n,{variant:`outlined`,onClick:v,children:`Done`})})]})})}function J({onClick:e}){return(0,R.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:(0,R.jsx)(u,{className:`h-3.5 w-3.5`}),onClick:e,children:`Share Connection Link`})}function Y(e){return typeof e==`string`&&z.includes(e)}function X(e){return V.has(e)}function Z(e){return(e?.policies??[]).filter(e=>!X(e.channelType)&&!U(e.channelType)).map(e=>({...e,policy:Y(e.policy)?e.policy:`trusted_contacts`}))}async function ie(e,t,n,r){if(X(t))throw new D(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:i,error:a,response:o}=await O({path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},throwOnError:!1});if(T(o,a,`Failed to save channel policy.`),!o.ok)throw new D(o.status,E(a,o,`Failed to save channel policy.`));if(!i?.policy)throw new D(500,`Gateway returned no policy in response.`);return i.policy}var ae=`0.10.0`;function Q(){return w(ae)}function oe(e){let t=r(),n=k.use.channelTrustFloors(),o=Q(),s=n&&o,c=(0,L.useMemo)(()=>({path:{assistant_id:e}}),[e]),l=(0,L.useMemo)(()=>j(c),[c]),u=i({...M(c),enabled:s,select:Z}),d=(0,L.useMemo)(()=>{let e={};for(let t of u.data??[])A(t.channelType)&&(e[t.channelType]=t.policy);return e},[u.data]),f=a({mutationFn:({channelKey:t,policy:n})=>ie(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:l}),onError:P(`Failed to save channel policy`)}),p=(0,L.useCallback)((e,t)=>{f.mutate({channelKey:e,policy:t})},[f]);return s?{policies:d,savingKey:f.isPending?f.variables?.channelKey??null:null,isLoading:u.isPending,isError:u.isError,onChange:p}:{policies:void 0,savingKey:null,isLoading:!1,isError:!1,onChange:void 0}}var $={slack:`I want to reach you on Slack. Let's set it up.`,telegram:`I want to reach you on Telegram. Let's set it up.`,phone:`I want to be able to call you. Let's set you up with a phone number.`},se=15e3;function ce({assistantId:e,onStartSetupConversation:t}){let n=r(),o=(0,L.useMemo)(()=>({path:{assistant_id:e}}),[e]),s=(0,L.useMemo)(()=>S(o),[o]),c=i({...x(o),enabled:!!e,refetchInterval:se,select:e=>e.snapshots}),l=(0,L.useMemo)(()=>le(c.data??[]),[c.data]),u=l.some(e=>e.key===`slack`&&e.status===`ready`),d=i({...b(o),enabled:u,select:e=>e.threadMode}),f=oe(e),p=(0,L.useCallback)(()=>n.invalidateQueries({queryKey:s}),[n,s]),y=a({mutationFn:async t=>{let n={path:{assistant_id:e},throwOnError:!0};t===`slack`?await m(n):t===`telegram`?await h(n):t===`phone`&&await g(n)},onSettled:(t,r,i)=>{p(),i===`slack`&&ee(n,e)}}),C=re({assistantId:e}),w=te({assistantId:e}),T=ne({assistantId:e}),E=a({...v(),onSuccess:()=>{n.invalidateQueries({queryKey:_(o)})}}),D=C.mutateAsync,O=(0,L.useCallback)(async e=>{await D(e)},[D]),k=w.mutate,A=(0,L.useCallback)((e,t)=>{k({botToken:e,appToken:t})},[k]),j=E.mutate,M=(0,L.useCallback)(t=>{j({path:{assistant_id:e},body:{threadMode:t}})},[j,e]),N=T.mutateAsync,P=(0,L.useCallback)(async(e,t)=>{await N({accountSid:e,authToken:t})},[N]),F=(0,L.useCallback)(e=>{t&&t($[e])},[t]),I=y.mutate,R=(0,L.useCallback)(e=>{I(e)},[I]);return{channels:l,pendingChannelKey:y.isPending?y.variables??null:null,slackThreadMode:d.data,slackThreadModePending:E.isPending,channelPolicies:f.policies,policySavingKey:f.savingKey,policiesLoading:f.isLoading,policiesError:f.isError,onChannelPolicyChange:f.onChange,onSetup:t?F:void 0,onDisconnect:R,onSaveTelegramToken:O,onSaveSlackConfig:A,slackSaveStatus:w.status,slackSaveError:w.error?.message??null,onSlackThreadModeChange:M,onSaveTwilioCredentials:P}}function le(e){let t=new Map;for(let n of e)t.set(n.channel,n);return N.map(e=>{let n=t.get(e);return{key:e,status:ue(n),address:n?.channelHandle??void 0}})}function ue(e){return e?e.ready||e.setupStatus===`ready`?`ready`:e.setupStatus===`incomplete`?`incomplete`:`not_configured`:`not_configured`}function de(e){let t=r(),[n,i]=(0,L.useState)(!1);return{isOpen:n,open:(0,L.useCallback)(()=>{i(!0)},[]),close:(0,L.useCallback)(()=>{i(!1),t.invalidateQueries({queryKey:C({path:{assistant_id:e}})})},[t,e])}}export{J as a,z as c,I as d,Z as i,W as l,ce as n,q as o,Q as r,B as s,de as t,G as u};
@@ -0,0 +1 @@
1
+ import{D as e,T as t,i as n}from"./auth-store-quPkF_4z.js";function r(){let r=e.use.currentOrganizationId();return e.use.status(),n()?r!=null||t()!=null:!0}export{r as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{l as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./is-electron-y5bNUVyG.js";import{f as i}from"./native-biometric-DG8Pfu_V.js";import{u as a}from"./routes-D4ff4ONd.js";import{n as o,t as s}from"./build-state-Bo2Ut5Js.js";import{n as c}from"./login-flow-DYrO-od6.js";var l=e(t(),1);function u(e){let t=n(),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(null),m=(0,l.useRef)(0);return{loading:u,error:f,login:async()=>{let n=e??o(s({sessionSettled:!0,isAuthenticated:!0}),t.pathname),r=++m.current;p(null),d(!0);try{await i(c,`${a.account.providerCallback}?returnTo=${encodeURIComponent(n)}`,{returnTo:n})}catch{if(r!==m.current)return;p(`Something went wrong. Please try again.`),d(!1)}},cancel:()=>{m.current++,d(!1),p(null),r()&&window.vellum?.auth?.cancelOAuth()}}}export{u as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{l as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./is-electron-y5bNUVyG.js";import{f as i}from"./native-biometric-DG8Pfu_V.js";import{u as a}from"./routes-D4ff4ONd.js";import{n as o,t as s}from"./build-state-rDsVeVLA.js";import{n as c}from"./login-flow-DbD8dpQO.js";var l=e(t(),1);function u(e){let t=n(),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(null),m=(0,l.useRef)(0);return{loading:u,error:f,login:async()=>{let n=e??o(s({sessionSettled:!0,isAuthenticated:!0}),t.pathname),r=++m.current;p(null),d(!0);try{await i(c,`${a.account.providerCallback}?returnTo=${encodeURIComponent(n)}`,{returnTo:n})}catch{if(r!==m.current)return;p(`Something went wrong. Please try again.`),d(!1)}},cancel:()=>{m.current++,d(!1),p(null),r()&&window.vellum?.auth?.cancelOAuth()}}}export{u as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{n}from"./QueryClientProvider-DKhXIxGb.js";import{t as r}from"./useMutation-Lj4VunQV.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./card-Cf8bWrcq.js";import{t as o}from"./createLucideIcon-Bjb-Kuq7.js";import{t as s}from"./brain-Ci5ws6Wl.js";import{t as c}from"./globe-DgKSh933.js";import{t as l}from"./puzzle-C894zd87.js";import"./src-BT0gNVcT.js";import{t as u}from"./tag-CJyI1Y2J.js";import{pr as d}from"./sdk.gen-BR-xXIZm.js";import{on as f}from"./react-query.gen-DfzfX_Jv.js";import{n as p,r as m,t as h}from"./api-errors-CoE1wFl2.js";import{Ho as g,zo as _}from"./index-C7ix_asE.js";import{t as v}from"./skills-BFnEzvAC.js";var y=o(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),b=e(t(),1),x=i();function S({skill:e,className:t,fallback:n=`🧩`}){let[r,i]=(0,b.useState)(!1);return e.icon&&!r?(0,x.jsx)(`img`,{src:`/assistant/skills/${e.id}/${e.icon}`,alt:``,className:`${t} object-contain`,onError:()=>i(!0)}):(0,x.jsx)(`span`,{className:t,children:e.emoji??n})}var C={vellum:{label:`Vellum`,icon:y},clawhub:{label:`Clawhub`,icon:c},skillssh:{label:`skills.sh`,icon:g},custom:{label:`Custom`,icon:_},"assistant-memory":{label:`Assistant's Memory`,icon:s}};function w({origin:e}){let t=e in C?C[e]:{label:e.replace(/-/g,` `),icon:l};return(0,x.jsx)(u,{tone:`neutral`,leftIcon:(0,b.createElement)(t.icon),className:`capitalize`,children:t.label})}function T(e){return e.kind===`installed`||e.kind===`bundled`}function E(e){return e.kind===`catalog`}function D({icon:e,iconColor:t=`var(--content-tertiary)`,title:n,subtitle:r,children:i}){return(0,x.jsx)(a.Root,{children:(0,x.jsxs)(a.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,x.jsx)(e,{className:`mb-3 h-8 w-8`,style:{color:t},"aria-hidden":!0}),(0,x.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,x.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r}),i]})})}async function O(e,t,n){let{data:r,error:i,response:a}=await d({path:{assistant_id:e},body:n?{slug:t,version:n}:{slug:t},throwOnError:!1});if(p(a,i,`Failed to install skill.`),!a.ok)throw new h(a.status,m(i,a,`Failed to install skill.`));return r??{ok:!0}}function k(e,{onRemoved:t}={}){let i=n(),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(null),d=(0,b.useCallback)(()=>{v(i,e)},[e,i]),p=r({mutationFn:t=>O(e,t),onMutate:e=>o(e),onSettled:()=>{o(null),d()}}),m=f({onMutate:e=>c(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{c(null),d()}}),h=(0,b.useCallback)(e=>{p.mutate(e.slug??e.id)},[p]),g=(0,b.useCallback)(e=>{u(e)},[]),_=(0,b.useCallback)(()=>{l&&(m.mutate({path:{assistant_id:e,id:l.id}}),u(null))},[e,l,m]),y=(0,b.useCallback)(()=>{u(null)},[]);return{handleInstall:h,handleRemove:g,isInstallingSkill:(0,b.useCallback)(e=>a===(e.slug??e.id),[a]),isRemovingSkill:(0,b.useCallback)(e=>s===e.id,[s]),skillPendingRemoval:l,confirmRemove:_,cancelRemove:y}}export{w as a,T as i,D as n,S as o,E as r,y as s,k as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{n}from"./QueryClientProvider-DKhXIxGb.js";import{t as r}from"./useMutation-Lj4VunQV.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./card-Cf8bWrcq.js";import{t as o}from"./createLucideIcon-Bjb-Kuq7.js";import{t as s}from"./brain-Ci5ws6Wl.js";import{t as c}from"./globe-DgKSh933.js";import{t as l}from"./puzzle-C894zd87.js";import"./src-BT0gNVcT.js";import{t as u}from"./tag-CJyI1Y2J.js";import{pr as d}from"./sdk.gen-BR-xXIZm.js";import{on as f}from"./react-query.gen-DfzfX_Jv.js";import{n as p,r as m,t as h}from"./api-errors-CoE1wFl2.js";import{Ho as g,zo as _}from"./index-Ck1SrvnM.js";import{t as v}from"./skills-BFnEzvAC.js";var y=o(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),b=e(t(),1),x=i();function S({skill:e,className:t,fallback:n=`🧩`}){let[r,i]=(0,b.useState)(!1);return e.icon&&!r?(0,x.jsx)(`img`,{src:`/assistant/skills/${e.id}/${e.icon}`,alt:``,className:`${t} object-contain`,onError:()=>i(!0)}):(0,x.jsx)(`span`,{className:t,children:e.emoji??n})}var C={vellum:{label:`Vellum`,icon:y},clawhub:{label:`Clawhub`,icon:c},skillssh:{label:`skills.sh`,icon:g},custom:{label:`Custom`,icon:_},"assistant-memory":{label:`Assistant's Memory`,icon:s}};function w({origin:e}){let t=e in C?C[e]:{label:e.replace(/-/g,` `),icon:l};return(0,x.jsx)(u,{tone:`neutral`,leftIcon:(0,b.createElement)(t.icon),className:`capitalize`,children:t.label})}function T(e){return e.kind===`installed`||e.kind===`bundled`}function E(e){return e.kind===`catalog`}function D({icon:e,iconColor:t=`var(--content-tertiary)`,title:n,subtitle:r,children:i}){return(0,x.jsx)(a.Root,{children:(0,x.jsxs)(a.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,x.jsx)(e,{className:`mb-3 h-8 w-8`,style:{color:t},"aria-hidden":!0}),(0,x.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,x.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r}),i]})})}async function O(e,t,n){let{data:r,error:i,response:a}=await d({path:{assistant_id:e},body:n?{slug:t,version:n}:{slug:t},throwOnError:!1});if(p(a,i,`Failed to install skill.`),!a.ok)throw new h(a.status,m(i,a,`Failed to install skill.`));return r??{ok:!0}}function k(e,{onRemoved:t}={}){let i=n(),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(null),d=(0,b.useCallback)(()=>{v(i,e)},[e,i]),p=r({mutationFn:t=>O(e,t),onMutate:e=>o(e),onSettled:()=>{o(null),d()}}),m=f({onMutate:e=>c(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{c(null),d()}}),h=(0,b.useCallback)(e=>{p.mutate(e.slug??e.id)},[p]),g=(0,b.useCallback)(e=>{u(e)},[]),_=(0,b.useCallback)(()=>{l&&(m.mutate({path:{assistant_id:e,id:l.id}}),u(null))},[e,l,m]),y=(0,b.useCallback)(()=>{u(null)},[]);return{handleInstall:h,handleRemove:g,isInstallingSkill:(0,b.useCallback)(e=>a===(e.slug??e.id),[a]),isRemovingSkill:(0,b.useCallback)(e=>s===e.id,[s]),skillPendingRemoval:l,confirmRemove:_,cancelRemove:y}}export{w as a,T as i,D as n,S as o,E as r,y as s,k as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./useQuery-B45lW1Kk.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{vt as a,yt as o}from"./react-query.gen-DfzfX_Jv.js";import{u as s}from"./routes-D4ff4ONd.js";import{t as c}from"./misc-BMp6WHdm.js";import{Ks as l}from"./index-C7ix_asE.js";var u=i();function d({skill:e,className:t,onNavigate:r}){return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,u.jsxs)(n,{to:s.conversation(e.sourceConversationId),onClick:r,className:c(`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)] hover:underline`,t),children:[`Learned from this conversation`,(0,u.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var f=e(t(),1);function p(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function m(e,t){let[n,i]=(0,f.useState)(null),s=r({...o({path:{assistant_id:e??``,id:t}}),select:e=>e??null,enabled:!!e}),c=(0,f.useMemo)(()=>s.data?.files??[],[s.data]),l=(0,f.useMemo)(()=>c.find(e=>e.name===`SKILL.md`),[c]),u=p(c,n),d=r({...a({path:{assistant_id:e??``,id:t},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:c,skillMd:l,selectedPath:n,setSelectedPath:i,activePath:u,activeFile:c.find(e=>e.path===u),isFilesLoading:s.isLoading,isFilesPending:s.isPending,fileContent:d.data?.content??null,isBinary:!!d.data?.isBinary,isContentLoading:d.isLoading,isContentPending:d.isPending}}export{d as n,m as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./useQuery-B45lW1Kk.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{vt as a,yt as o}from"./react-query.gen-DfzfX_Jv.js";import{u as s}from"./routes-D4ff4ONd.js";import{t as c}from"./misc-BMp6WHdm.js";import{Ks as l}from"./index-Ck1SrvnM.js";var u=i();function d({skill:e,className:t,onNavigate:r}){return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,u.jsxs)(n,{to:s.conversation(e.sourceConversationId),onClick:r,className:c(`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)] hover:underline`,t),children:[`Learned from this conversation`,(0,u.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var f=e(t(),1);function p(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function m(e,t){let[n,i]=(0,f.useState)(null),s=r({...o({path:{assistant_id:e??``,id:t}}),select:e=>e??null,enabled:!!e}),c=(0,f.useMemo)(()=>s.data?.files??[],[s.data]),l=(0,f.useMemo)(()=>c.find(e=>e.name===`SKILL.md`),[c]),u=p(c,n),d=r({...a({path:{assistant_id:e??``,id:t},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:c,skillMd:l,selectedPath:n,setSelectedPath:i,activePath:u,activeFile:c.find(e=>e.path===u),isFilesLoading:s.isLoading,isFilesPending:s.isPending,fileContent:d.data?.content??null,isBinary:!!d.data?.isBinary,isContentLoading:d.isLoading,isContentPending:d.isPending}}export{d as n,m as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,c as n,i as r}from"./local-settings-C-dW2vkq.js";import{t as i}from"./react-DJZBPgpf.js";import{t as a}from"./button-CW7wKp2r.js";import{m as o}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./useMutation-Lj4VunQV.js";import{t as u}from"./jsx-runtime-CVSDxk6A.js";import{t as d}from"./card-Cf8bWrcq.js";import{t as f}from"./chevron-down-DpYf9Gwq.js";import{n as p}from"./list-row-CVw67M2Z.js";import{t as m}from"./info-CqgkBvyS.js";import{j as h,k as g}from"./src-BT0gNVcT.js";import{t as _}from"./toggle-Ca1aoG-l.js";import{t as v}from"./dropdown-DQozlhbb.js";import{At as y,Mt as b,Nt as x,Ot as S}from"./react-query.gen-DfzfX_Jv.js";import{a as C,i as w,n as T,r as E,t as D}from"./sound-manager-DHHv5UT4.js";import{J as ee,Lr as O,Rr as k,Sr as A,U as j,Vo as te,W as ne,_r as re,br as ie,gr as M,hr as N,in as P,mr as F,pr as ae,rn as oe,ts as I,vr as L,xr as se,yr as ce}from"./index-C7ix_asE.js";import{t as R}from"./detail-card-CAHT277C.js";import{r as le,t as z}from"./shared-ui-CUd8SsYi.js";var B=e(i(),1),V=u();function H({label:e,description:t,checked:n,disabled:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),t&&(0,V.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,V.jsx)(_,{checked:n,disabled:r,onChange:i,label:e})]})}function U(){return(0,V.jsx)(`div`,{className:`border-t border-[var(--border-base)]`})}function W({event:e,eventConfig:t,availableSounds:n,globalEnabled:r,onToggle:i,onAddSound:a,onRemoveSound:o,onPreview:s}){let[c,l]=(0,B.useState)(!1),u=n.filter(e=>!t.sounds.includes(e.filename)),d=n.length>0&&u.length===0;return(0,V.jsxs)(`div`,{className:`py-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:T[e]}),(0,V.jsx)(_,{checked:t.enabled,disabled:!r,onChange:i,label:`Enable ${T[e]}`})]}),t.enabled&&(0,V.jsxs)(`div`,{className:`mt-2 space-y-1 pl-2`,children:[t.sounds.length===0?(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default Blip`}):t.sounds.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-small-default text-[var(--content-secondary)]`,title:e,children:C(e)}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>s(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Preview ${e}`,children:(0,V.jsx)(I,{className:`h-3 w-3`})}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Remove ${e}`,children:(0,V.jsx)(te,{className:`h-3 w-3`})})]})]},e)),n.length===0?(0,V.jsx)(`p`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`No sound files yet. Drop audio files into data/sounds/ in your workspace.`}):d?(0,V.jsx)(`button`,{type:`button`,disabled:!0,className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-disabled)] disabled:cursor-not-allowed dark:bg-[var(--surface-lift)] dark:text-[var(--content-tertiary)]`,children:`All sounds added`}):(0,V.jsxs)(`div`,{className:`relative inline-block`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[`Add sound`,(0,V.jsx)(f,{className:`h-3 w-3`})]}),c&&(0,V.jsx)(`div`,{className:`absolute left-0 z-10 mt-1 max-h-64 w-56 overflow-auto rounded-md border border-[var(--border-base)] bg-white p-1 shadow-lg dark:bg-[var(--surface-lift)]`,onMouseLeave:()=>l(!1),children:u.map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>{a(e.filename),l(!1)},className:`block w-full truncate rounded px-2 py-1 text-left text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:hover:bg-[var(--ghost-hover)]`,title:e.filename,children:e.label},e.filename))})]})]})]})}function ue(){let e=s(),t=ee(),n=(0,B.useMemo)(()=>y({path:{assistant_id:t}}),[t]),r=(0,B.useMemo)(()=>S({path:{assistant_id:t}}),[t]),{data:i}=c(n),{data:a}=c(r),o=i??w(),u=a?.sounds??[],f=(0,B.useMemo)(()=>({path:{assistant_id:t}}),[t]),p=l({...x(f),onMutate:async t=>{await e.cancelQueries({queryKey:n.queryKey});let r=e.getQueryData(n.queryKey);return b(e,f,t.body),{previous:r}},onError:(t,n,r)=>{r?.previous!==void 0&&b(e,f,r.previous)},onSettled:()=>{e.invalidateQueries({queryKey:n.queryKey})}}),m=(0,B.useCallback)(r=>{let i=r(e.getQueryData(n.queryKey)??w());p.mutate({path:{assistant_id:t},body:i})},[t,n.queryKey,e,p]),h=e=>{m(t=>({...t,globalEnabled:e}))},g=e=>{m(t=>({...t,volume:e}))},[_,v]=(0,B.useState)(null),C=_??o.volume,T=(e,t)=>{m(n=>({...n,events:{...n.events,[e]:{...n.events[e]??{enabled:!1,sounds:[]},enabled:t}}}))},O=(e,t)=>{m(n=>{let r=n.events[e]??{enabled:!0,sounds:[]};return r.sounds.includes(t)?n:{...n,events:{...n.events,[e]:{...r,sounds:[...r.sounds,t]}}}})},k=(e,t)=>{m(n=>{let r=n.events[e];return r?{...n,events:{...n.events,[e]:{...r,sounds:r.sounds.filter(e=>e!==t)}}}:n})},A=()=>{D().previewFallbackBlip(o.volume)},j=e=>{D().previewSound(e,o.volume)};return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(d,{children:[(0,V.jsx)(H,{label:`Enable sound effects`,description:`Master switch for every event-driven sound.`,checked:o.globalEnabled,onChange:h}),(0,V.jsx)(U,{}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Volume`}),(0,V.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:C,onChange:e=>v(parseFloat(e.target.value)),onPointerUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onKeyUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onBlur:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},className:`h-1 w-48 cursor-pointer`,disabled:!o.globalEnabled,"aria-label":`Sound effect volume`}),(0,V.jsxs)(`span`,{className:`tabular-nums text-body-small-default text-[var(--content-tertiary)]`,children:[Math.round(C*100),`%`]})]}),(0,V.jsx)(U,{}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Preview default blip`}),(0,V.jsxs)(`button`,{type:`button`,onClick:A,disabled:!o.globalEnabled,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-white px-3 py-1.5 text-body-medium-lighter text-[var(--content-default)] hover:bg-[var(--surface-base)] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[(0,V.jsx)(I,{className:`h-3.5 w-3.5`}),`Preview`]})]})]}),(0,V.jsxs)(d,{children:[(0,V.jsxs)(`div`,{className:`pb-2`,children:[(0,V.jsx)(`h3`,{className:`text-title-small text-[var(--content-default)]`,children:`Sound Events`}),(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add one or more sounds per event. When multiple are configured, one plays at random.`})]}),(0,V.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:E.map(e=>(0,V.jsx)(W,{event:e,eventConfig:o.events[e]??{enabled:!1,sounds:[]},availableSounds:u,globalEnabled:o.globalEnabled,onToggle:t=>T(e,t),onAddSound:t=>O(e,t),onRemoveSound:t=>k(e,t),onPreview:e=>j(e)},e))})]})]})}function de(){return(0,V.jsx)(z,{title:`Text-to-Speech`,subtitle:`Configure how your assistant speaks`,children:(0,V.jsx)(j,{})})}function fe(){return(0,V.jsx)(z,{title:`Speech-to-Text`,subtitle:`Configure how your assistant transcribes speech`,children:(0,V.jsx)(ne,{})})}var pe=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],G=`We recommend keeping both off to start. It feels more like a real conversation.`;function me(){return(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Recommended off`})}function he({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,V.jsx)(me,{}):null]}),t?(0,V.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,V.jsx)(_,{checked:r,onChange:i,"aria-label":e})]})}function ge({showDescription:e=!1,showRecommendedBadge:t=!1}){let n=P.use.showUserTranscript(),r=P.use.showAssistantTranscript(),i=P.use.setShowUserTranscript(),a=P.use.setShowAssistantTranscript(),o={showUserTranscript:{checked:n,onChange:i},showAssistantTranscript:{checked:r,onChange:a}};return(0,V.jsx)(V.Fragment,{children:pe.map(n=>{let r=o[n.prefKey];return(0,V.jsx)(he,{label:n.label,description:e?n.description:void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var K=`vellum:voice:conversationTimeoutSeconds`,q=[{label:`Ctrl`,activator:{kind:`modifierOnly`,modifiers:[`control`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}},{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}}],J={label:`Fn`,activator:N},Y=[{label:`5 seconds`,value:`5`},{label:`10 seconds`,value:`10`},{label:`15 seconds`,value:`15`},{label:`30 seconds`,value:`30`},{label:`60 seconds`,value:`60`}],X=`30`,Z=`text-body-small-default text-[var(--content-tertiary)]`,_e=[`voice`,`services`,`sounds`];function ve(e){return _e.includes(e)}function ye(){let[e,t]=o(),n=e.get(`tab`),r=ve(n)?n:`voice`;return(0,V.jsx)(`div`,{className:`space-y-6`,children:(0,V.jsxs)(p.Root,{value:r,onValueChange:n=>{let r=new URLSearchParams(e);n===`voice`?r.delete(`tab`):r.set(`tab`,n),t(r,{replace:!0})},children:[(0,V.jsxs)(p.List,{children:[(0,V.jsx)(p.Trigger,{value:`voice`,children:`Voice`}),(0,V.jsx)(p.Trigger,{value:`services`,children:`Services`}),(0,V.jsx)(p.Trigger,{value:`sounds`,children:`Sounds`})]}),(0,V.jsx)(p.Panel,{value:`voice`,className:`pt-4`,children:(0,V.jsx)(xe,{})}),(0,V.jsx)(p.Panel,{value:`services`,className:`pt-4`,children:(0,V.jsx)(be,{})}),(0,V.jsx)(p.Panel,{value:`sounds`,className:`pt-4`,children:(0,V.jsx)(ue,{})})]})})}function be(){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,V.jsx)(le,{}),(0,V.jsx)(de,{}),(0,V.jsx)(fe,{})]})}function xe(){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,V.jsx)(Ce,{}),(0,V.jsx)(we,{}),(0,V.jsx)(Te,{}),(0,V.jsx)(De,{}),(0,V.jsx)(Oe,{}),(0,V.jsx)(Se,{})]})}function Se(){return(0,V.jsx)(R,{title:`Transcription`,subtitle:`Show live text of what you and the assistant say during a voice conversation.`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(ge,{showDescription:!0}),(0,V.jsx)(`p`,{className:`${Z} pt-1`,children:G})]})})}var Q=``;function Ce(){let[e,r]=(0,B.useState)([]),[i,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(()=>k()),l=(0,B.useCallback)(async()=>{if(navigator.mediaDevices?.enumerateDevices)try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`);o(e.length>0&&e.every(e=>!e.label)),r(e.filter(e=>e.deviceId!==``&&e.deviceId!==`default`&&e.deviceId!==`communications`))}catch{r([]),o(!1)}},[]),u=(0,B.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}l()},[l]);(0,B.useEffect)(()=>{l();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void l();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[l]);let d=(0,B.useMemo)(()=>[{value:Q,label:`System Default`},...e.map((e,t)=>({value:e.deviceId,label:e.label||`Microphone ${t+1}`}))],[e]),f=(0,B.useCallback)(e=>{c(e),e===Q?t(O):n(O,e)},[]);return(0,V.jsx)(R,{title:`Microphone`,subtitle:`Which input device is used for dictation and voice conversations.`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(v,{options:d,value:d.some(e=>e.value===s)?s:Q,onChange:f,"aria-label":`Microphone`})}),i&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(a,{variant:`outlined`,onClick:u,children:`Allow Microphone Access`}),(0,V.jsx)(`span`,{className:Z,children:`Grant microphone access to list your available input devices.`})]})]})})}function we(){let e=ae(),[t,i]=(0,B.useState)(()=>{let t=r(M,``);return t?ie(t,{preserveFunction:e}):e?J.activator:{kind:`off`}}),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)([]),l=(0,B.useRef)(null),u=(0,B.useRef)(!1),d=(0,B.useMemo)(()=>e?[J,...q]:q,[e]),f=t.kind!==`off`,p=f&&!e,h=(0,B.useCallback)(e=>{i(e),n(M,se(e)),o(!1),c([])},[]),g=(0,B.useCallback)(()=>{o(!0),c([]),u.current=!1,requestAnimationFrame(()=>{l.current?.focus()})},[]),v=(0,B.useCallback)(()=>{o(!1),c([]),u.current=!1},[]),y=(0,B.useCallback)(t=>{let n=[];return e&&t.getModifierState(`Fn`)&&n.push(`function`),t.ctrlKey&&n.push(`control`),t.altKey&&n.push(`option`),t.shiftKey&&n.push(`shift`),t.metaKey&&n.push(`command`),n},[e]),b=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){v();return}let t=y(e),n=e.key;if(n===`Control`||n===`Alt`||n===`Shift`||n===`Meta`||n===`Fn`){c(t.includes(`function`)?N.modifiers:A(t));return}if(t.includes(`function`)){h(N);return}u.current=!0,h({kind:`key`,label:n.length===1?n.toUpperCase():n,modifiers:t})},[v,y,h]),x=(0,B.useCallback)(e=>{if(!a)return;e.preventDefault(),e.stopPropagation();let t=e.key;if(t===`Control`||t===`Alt`||t===`Shift`||t===`Meta`||t===`Fn`){if(u.current){u.current=!1,c([]);return}y(e).length===0&&s.length>0&&h({kind:`modifierOnly`,modifiers:s})}},[y,a,s,h]);(0,B.useEffect)(()=>{if(!a)return;let e=e=>{l.current&&!l.current.contains(e.target)&&v()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[v,a]);let S=f&&!d.some(e=>L(e.activator,t));return(0,V.jsx)(R,{title:`Push to Talk`,subtitle:`Hold the activation key to dictate text or start a voice conversation.`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(_,{checked:f,onChange:n=>{n?t.kind===`off`&&h(e?J.activator:F):h({kind:`off`})},label:`Enable Push to Talk`}),f&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`span`,{className:Z,children:`Activation Key:`}),(0,V.jsxs)(`div`,{ref:l,tabIndex:a?0:-1,onKeyDown:a?b:void 0,onKeyUp:a?x:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[d.map(e=>{let n=L(e.activator,t);return(0,V.jsx)($,{label:e.label,selected:n,onClick:()=>h(e.activator)},e.label)}),a?(0,V.jsx)($,{label:s.length>0?ce(s):`Press any key…`,selected:!0,recording:!0,onClick:v}):(0,V.jsx)($,{label:S?re(t):`Custom`,selected:S,onClick:g})]}),p&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--content-quiet)]`,children:[(0,V.jsx)(m,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:`Push-to-Talk only works while this tab is focused, and browsers may intercept some shortcuts (e.g. Ctrl+T) before the page can see them. For always-on PTT, use the Vellum desktop app.`})]})]})]})})}function $({label:e,selected:t,recording:n=!1,onClick:r}){return(0,V.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,V.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,V.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function Te(){let[e,t]=(0,B.useState)(()=>{let e=r(K,X);return Y.find(t=>t.value===e)?.value??X});return(0,V.jsx)(R,{title:`Conversation Timeout`,subtitle:`How long the assistant waits for you to start speaking before ending a voice conversation turn.`,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(v,{options:Y,value:e,onChange:(0,B.useCallback)(e=>{t(e),n(K,e)},[]),"aria-label":`Conversation timeout`})})})}var Ee=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}];function De(){let e=P.use.pauseBeforeReplyMs(),t=P.use.setPauseBeforeReplyMs();return(0,V.jsx)(R,{title:`Pause before reply`,subtitle:`How long the assistant waits after you stop speaking before it replies. A longer pause lets you gather your thoughts mid-sentence without being cut off.`,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(g,{value:(e??1200)/1e3,onValueChange:e=>{typeof e==`number`&&t(Math.round(e*1e3))},min:500/1e3,max:oe/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":`Pause before reply`})})})}function Oe(){let e=P.use.interruptSensitivity(),t=P.use.setInterruptSensitivity();return(0,V.jsx)(R,{title:`Interrupt sensitivity`,subtitle:`How easily talking over the assistant interrupts it. Lower it if the assistant cuts itself off on background noise or filler words; raise it to interrupt more quickly.`,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(h,{items:Ee,value:e??`medium`,onChange:t,ariaLabel:`Interrupt sensitivity`})})})}export{ye as VoicePage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,c as n,i as r}from"./local-settings-C-dW2vkq.js";import{t as i}from"./react-DJZBPgpf.js";import{t as a}from"./button-CW7wKp2r.js";import{m as o}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./useMutation-Lj4VunQV.js";import{t as u}from"./jsx-runtime-CVSDxk6A.js";import{t as d}from"./card-Cf8bWrcq.js";import{t as f}from"./chevron-down-DpYf9Gwq.js";import{n as p}from"./list-row-CVw67M2Z.js";import{t as m}from"./info-CqgkBvyS.js";import{j as h,k as g}from"./src-BT0gNVcT.js";import{t as _}from"./toggle-Ca1aoG-l.js";import{t as v}from"./dropdown-DQozlhbb.js";import{At as y,Mt as b,Nt as x,Ot as S}from"./react-query.gen-DfzfX_Jv.js";import{a as C,i as w,n as T,r as E,t as D}from"./sound-manager-DHHv5UT4.js";import{J as ee,Lr as O,Rr as k,Sr as A,U as j,Vo as te,W as ne,_r as re,br as ie,gr as M,hr as N,in as P,mr as F,pr as ae,rn as oe,ts as I,vr as L,xr as se,yr as ce}from"./index-Ck1SrvnM.js";import{t as R}from"./detail-card-CAHT277C.js";import{r as le,t as z}from"./shared-ui-CUd8SsYi.js";var B=e(i(),1),V=u();function H({label:e,description:t,checked:n,disabled:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),t&&(0,V.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,V.jsx)(_,{checked:n,disabled:r,onChange:i,label:e})]})}function U(){return(0,V.jsx)(`div`,{className:`border-t border-[var(--border-base)]`})}function W({event:e,eventConfig:t,availableSounds:n,globalEnabled:r,onToggle:i,onAddSound:a,onRemoveSound:o,onPreview:s}){let[c,l]=(0,B.useState)(!1),u=n.filter(e=>!t.sounds.includes(e.filename)),d=n.length>0&&u.length===0;return(0,V.jsxs)(`div`,{className:`py-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:T[e]}),(0,V.jsx)(_,{checked:t.enabled,disabled:!r,onChange:i,label:`Enable ${T[e]}`})]}),t.enabled&&(0,V.jsxs)(`div`,{className:`mt-2 space-y-1 pl-2`,children:[t.sounds.length===0?(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default Blip`}):t.sounds.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-small-default text-[var(--content-secondary)]`,title:e,children:C(e)}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>s(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Preview ${e}`,children:(0,V.jsx)(I,{className:`h-3 w-3`})}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Remove ${e}`,children:(0,V.jsx)(te,{className:`h-3 w-3`})})]})]},e)),n.length===0?(0,V.jsx)(`p`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`No sound files yet. Drop audio files into data/sounds/ in your workspace.`}):d?(0,V.jsx)(`button`,{type:`button`,disabled:!0,className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-disabled)] disabled:cursor-not-allowed dark:bg-[var(--surface-lift)] dark:text-[var(--content-tertiary)]`,children:`All sounds added`}):(0,V.jsxs)(`div`,{className:`relative inline-block`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[`Add sound`,(0,V.jsx)(f,{className:`h-3 w-3`})]}),c&&(0,V.jsx)(`div`,{className:`absolute left-0 z-10 mt-1 max-h-64 w-56 overflow-auto rounded-md border border-[var(--border-base)] bg-white p-1 shadow-lg dark:bg-[var(--surface-lift)]`,onMouseLeave:()=>l(!1),children:u.map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>{a(e.filename),l(!1)},className:`block w-full truncate rounded px-2 py-1 text-left text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:hover:bg-[var(--ghost-hover)]`,title:e.filename,children:e.label},e.filename))})]})]})]})}function ue(){let e=s(),t=ee(),n=(0,B.useMemo)(()=>y({path:{assistant_id:t}}),[t]),r=(0,B.useMemo)(()=>S({path:{assistant_id:t}}),[t]),{data:i}=c(n),{data:a}=c(r),o=i??w(),u=a?.sounds??[],f=(0,B.useMemo)(()=>({path:{assistant_id:t}}),[t]),p=l({...x(f),onMutate:async t=>{await e.cancelQueries({queryKey:n.queryKey});let r=e.getQueryData(n.queryKey);return b(e,f,t.body),{previous:r}},onError:(t,n,r)=>{r?.previous!==void 0&&b(e,f,r.previous)},onSettled:()=>{e.invalidateQueries({queryKey:n.queryKey})}}),m=(0,B.useCallback)(r=>{let i=r(e.getQueryData(n.queryKey)??w());p.mutate({path:{assistant_id:t},body:i})},[t,n.queryKey,e,p]),h=e=>{m(t=>({...t,globalEnabled:e}))},g=e=>{m(t=>({...t,volume:e}))},[_,v]=(0,B.useState)(null),C=_??o.volume,T=(e,t)=>{m(n=>({...n,events:{...n.events,[e]:{...n.events[e]??{enabled:!1,sounds:[]},enabled:t}}}))},O=(e,t)=>{m(n=>{let r=n.events[e]??{enabled:!0,sounds:[]};return r.sounds.includes(t)?n:{...n,events:{...n.events,[e]:{...r,sounds:[...r.sounds,t]}}}})},k=(e,t)=>{m(n=>{let r=n.events[e];return r?{...n,events:{...n.events,[e]:{...r,sounds:r.sounds.filter(e=>e!==t)}}}:n})},A=()=>{D().previewFallbackBlip(o.volume)},j=e=>{D().previewSound(e,o.volume)};return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(d,{children:[(0,V.jsx)(H,{label:`Enable sound effects`,description:`Master switch for every event-driven sound.`,checked:o.globalEnabled,onChange:h}),(0,V.jsx)(U,{}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Volume`}),(0,V.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:C,onChange:e=>v(parseFloat(e.target.value)),onPointerUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onKeyUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onBlur:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},className:`h-1 w-48 cursor-pointer`,disabled:!o.globalEnabled,"aria-label":`Sound effect volume`}),(0,V.jsxs)(`span`,{className:`tabular-nums text-body-small-default text-[var(--content-tertiary)]`,children:[Math.round(C*100),`%`]})]}),(0,V.jsx)(U,{}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Preview default blip`}),(0,V.jsxs)(`button`,{type:`button`,onClick:A,disabled:!o.globalEnabled,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-white px-3 py-1.5 text-body-medium-lighter text-[var(--content-default)] hover:bg-[var(--surface-base)] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[(0,V.jsx)(I,{className:`h-3.5 w-3.5`}),`Preview`]})]})]}),(0,V.jsxs)(d,{children:[(0,V.jsxs)(`div`,{className:`pb-2`,children:[(0,V.jsx)(`h3`,{className:`text-title-small text-[var(--content-default)]`,children:`Sound Events`}),(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add one or more sounds per event. When multiple are configured, one plays at random.`})]}),(0,V.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:E.map(e=>(0,V.jsx)(W,{event:e,eventConfig:o.events[e]??{enabled:!1,sounds:[]},availableSounds:u,globalEnabled:o.globalEnabled,onToggle:t=>T(e,t),onAddSound:t=>O(e,t),onRemoveSound:t=>k(e,t),onPreview:e=>j(e)},e))})]})]})}function de(){return(0,V.jsx)(z,{title:`Text-to-Speech`,subtitle:`Configure how your assistant speaks`,children:(0,V.jsx)(j,{})})}function fe(){return(0,V.jsx)(z,{title:`Speech-to-Text`,subtitle:`Configure how your assistant transcribes speech`,children:(0,V.jsx)(ne,{})})}var pe=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],G=`We recommend keeping both off to start. It feels more like a real conversation.`;function me(){return(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Recommended off`})}function he({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,V.jsx)(me,{}):null]}),t?(0,V.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,V.jsx)(_,{checked:r,onChange:i,"aria-label":e})]})}function ge({showDescription:e=!1,showRecommendedBadge:t=!1}){let n=P.use.showUserTranscript(),r=P.use.showAssistantTranscript(),i=P.use.setShowUserTranscript(),a=P.use.setShowAssistantTranscript(),o={showUserTranscript:{checked:n,onChange:i},showAssistantTranscript:{checked:r,onChange:a}};return(0,V.jsx)(V.Fragment,{children:pe.map(n=>{let r=o[n.prefKey];return(0,V.jsx)(he,{label:n.label,description:e?n.description:void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var K=`vellum:voice:conversationTimeoutSeconds`,q=[{label:`Ctrl`,activator:{kind:`modifierOnly`,modifiers:[`control`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}},{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}}],J={label:`Fn`,activator:N},Y=[{label:`5 seconds`,value:`5`},{label:`10 seconds`,value:`10`},{label:`15 seconds`,value:`15`},{label:`30 seconds`,value:`30`},{label:`60 seconds`,value:`60`}],X=`30`,Z=`text-body-small-default text-[var(--content-tertiary)]`,_e=[`voice`,`services`,`sounds`];function ve(e){return _e.includes(e)}function ye(){let[e,t]=o(),n=e.get(`tab`),r=ve(n)?n:`voice`;return(0,V.jsx)(`div`,{className:`space-y-6`,children:(0,V.jsxs)(p.Root,{value:r,onValueChange:n=>{let r=new URLSearchParams(e);n===`voice`?r.delete(`tab`):r.set(`tab`,n),t(r,{replace:!0})},children:[(0,V.jsxs)(p.List,{children:[(0,V.jsx)(p.Trigger,{value:`voice`,children:`Voice`}),(0,V.jsx)(p.Trigger,{value:`services`,children:`Services`}),(0,V.jsx)(p.Trigger,{value:`sounds`,children:`Sounds`})]}),(0,V.jsx)(p.Panel,{value:`voice`,className:`pt-4`,children:(0,V.jsx)(xe,{})}),(0,V.jsx)(p.Panel,{value:`services`,className:`pt-4`,children:(0,V.jsx)(be,{})}),(0,V.jsx)(p.Panel,{value:`sounds`,className:`pt-4`,children:(0,V.jsx)(ue,{})})]})})}function be(){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,V.jsx)(le,{}),(0,V.jsx)(de,{}),(0,V.jsx)(fe,{})]})}function xe(){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,V.jsx)(Ce,{}),(0,V.jsx)(we,{}),(0,V.jsx)(Te,{}),(0,V.jsx)(De,{}),(0,V.jsx)(Oe,{}),(0,V.jsx)(Se,{})]})}function Se(){return(0,V.jsx)(R,{title:`Transcription`,subtitle:`Show live text of what you and the assistant say during a voice conversation.`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(ge,{showDescription:!0}),(0,V.jsx)(`p`,{className:`${Z} pt-1`,children:G})]})})}var Q=``;function Ce(){let[e,r]=(0,B.useState)([]),[i,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(()=>k()),l=(0,B.useCallback)(async()=>{if(navigator.mediaDevices?.enumerateDevices)try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`);o(e.length>0&&e.every(e=>!e.label)),r(e.filter(e=>e.deviceId!==``&&e.deviceId!==`default`&&e.deviceId!==`communications`))}catch{r([]),o(!1)}},[]),u=(0,B.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}l()},[l]);(0,B.useEffect)(()=>{l();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void l();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[l]);let d=(0,B.useMemo)(()=>[{value:Q,label:`System Default`},...e.map((e,t)=>({value:e.deviceId,label:e.label||`Microphone ${t+1}`}))],[e]),f=(0,B.useCallback)(e=>{c(e),e===Q?t(O):n(O,e)},[]);return(0,V.jsx)(R,{title:`Microphone`,subtitle:`Which input device is used for dictation and voice conversations.`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(v,{options:d,value:d.some(e=>e.value===s)?s:Q,onChange:f,"aria-label":`Microphone`})}),i&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(a,{variant:`outlined`,onClick:u,children:`Allow Microphone Access`}),(0,V.jsx)(`span`,{className:Z,children:`Grant microphone access to list your available input devices.`})]})]})})}function we(){let e=ae(),[t,i]=(0,B.useState)(()=>{let t=r(M,``);return t?ie(t,{preserveFunction:e}):e?J.activator:{kind:`off`}}),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)([]),l=(0,B.useRef)(null),u=(0,B.useRef)(!1),d=(0,B.useMemo)(()=>e?[J,...q]:q,[e]),f=t.kind!==`off`,p=f&&!e,h=(0,B.useCallback)(e=>{i(e),n(M,se(e)),o(!1),c([])},[]),g=(0,B.useCallback)(()=>{o(!0),c([]),u.current=!1,requestAnimationFrame(()=>{l.current?.focus()})},[]),v=(0,B.useCallback)(()=>{o(!1),c([]),u.current=!1},[]),y=(0,B.useCallback)(t=>{let n=[];return e&&t.getModifierState(`Fn`)&&n.push(`function`),t.ctrlKey&&n.push(`control`),t.altKey&&n.push(`option`),t.shiftKey&&n.push(`shift`),t.metaKey&&n.push(`command`),n},[e]),b=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){v();return}let t=y(e),n=e.key;if(n===`Control`||n===`Alt`||n===`Shift`||n===`Meta`||n===`Fn`){c(t.includes(`function`)?N.modifiers:A(t));return}if(t.includes(`function`)){h(N);return}u.current=!0,h({kind:`key`,label:n.length===1?n.toUpperCase():n,modifiers:t})},[v,y,h]),x=(0,B.useCallback)(e=>{if(!a)return;e.preventDefault(),e.stopPropagation();let t=e.key;if(t===`Control`||t===`Alt`||t===`Shift`||t===`Meta`||t===`Fn`){if(u.current){u.current=!1,c([]);return}y(e).length===0&&s.length>0&&h({kind:`modifierOnly`,modifiers:s})}},[y,a,s,h]);(0,B.useEffect)(()=>{if(!a)return;let e=e=>{l.current&&!l.current.contains(e.target)&&v()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[v,a]);let S=f&&!d.some(e=>L(e.activator,t));return(0,V.jsx)(R,{title:`Push to Talk`,subtitle:`Hold the activation key to dictate text or start a voice conversation.`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(_,{checked:f,onChange:n=>{n?t.kind===`off`&&h(e?J.activator:F):h({kind:`off`})},label:`Enable Push to Talk`}),f&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`span`,{className:Z,children:`Activation Key:`}),(0,V.jsxs)(`div`,{ref:l,tabIndex:a?0:-1,onKeyDown:a?b:void 0,onKeyUp:a?x:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[d.map(e=>{let n=L(e.activator,t);return(0,V.jsx)($,{label:e.label,selected:n,onClick:()=>h(e.activator)},e.label)}),a?(0,V.jsx)($,{label:s.length>0?ce(s):`Press any key…`,selected:!0,recording:!0,onClick:v}):(0,V.jsx)($,{label:S?re(t):`Custom`,selected:S,onClick:g})]}),p&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--content-quiet)]`,children:[(0,V.jsx)(m,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:`Push-to-Talk only works while this tab is focused, and browsers may intercept some shortcuts (e.g. Ctrl+T) before the page can see them. For always-on PTT, use the Vellum desktop app.`})]})]})]})})}function $({label:e,selected:t,recording:n=!1,onClick:r}){return(0,V.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,V.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,V.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function Te(){let[e,t]=(0,B.useState)(()=>{let e=r(K,X);return Y.find(t=>t.value===e)?.value??X});return(0,V.jsx)(R,{title:`Conversation Timeout`,subtitle:`How long the assistant waits for you to start speaking before ending a voice conversation turn.`,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(v,{options:Y,value:e,onChange:(0,B.useCallback)(e=>{t(e),n(K,e)},[]),"aria-label":`Conversation timeout`})})})}var Ee=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}];function De(){let e=P.use.pauseBeforeReplyMs(),t=P.use.setPauseBeforeReplyMs();return(0,V.jsx)(R,{title:`Pause before reply`,subtitle:`How long the assistant waits after you stop speaking before it replies. A longer pause lets you gather your thoughts mid-sentence without being cut off.`,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(g,{value:(e??1200)/1e3,onValueChange:e=>{typeof e==`number`&&t(Math.round(e*1e3))},min:500/1e3,max:oe/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":`Pause before reply`})})})}function Oe(){let e=P.use.interruptSensitivity(),t=P.use.setInterruptSensitivity();return(0,V.jsx)(R,{title:`Interrupt sensitivity`,subtitle:`How easily talking over the assistant interrupts it. Lower it if the assistant cuts itself off on background noise or filler words; raise it to interrupt more quickly.`,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(h,{items:Ee,value:e??`medium`,onChange:t,ariaLabel:`Interrupt sensitivity`})})})}export{ye as VoicePage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./moon-h3xmz34k.js";import{t as i}from"./misc-BMp6WHdm.js";import{Ds as a,Fs as o,Io as s,Is as c,Ko as l,Ms as u,Ns as d,Ps as f,Uo as p,ct as m,dt as h,js as g,lt as _,ut as v}from"./index-C7ix_asE.js";var y=e(t(),1),b={"sun.max.fill":{icon:p,className:`text-orange-500`},"cloud.sun.fill":{icon:u,className:`text-amber-400`},"moon.fill":{icon:r,className:`text-blue-400`},"cloud.moon.fill":{icon:f,className:`text-blue-400`},"cloud.fill":{icon:g,className:`text-stone-400`},"cloud.rain.fill":{icon:d,className:`text-blue-400`},snowflake:{icon:l,className:`text-blue-300`},"cloud.bolt.fill":{icon:o,className:`text-orange-500`},"cloud.fog.fill":{icon:c,className:`text-stone-400`}},x={sunny:{icon:p,className:`text-orange-500`},clear:{icon:p,className:`text-orange-500`},"partly cloudy":{icon:u,className:`text-amber-400`},"mostly sunny":{icon:u,className:`text-amber-400`},cloudy:{icon:g,className:`text-stone-400`},overcast:{icon:g,className:`text-stone-400`},rainy:{icon:d,className:`text-blue-400`},rain:{icon:d,className:`text-blue-400`},drizzle:{icon:d,className:`text-blue-400`},snow:{icon:l,className:`text-blue-300`},snowy:{icon:l,className:`text-blue-300`},thunderstorm:{icon:o,className:`text-orange-500`},thunder:{icon:o,className:`text-orange-500`},foggy:{icon:c,className:`text-stone-400`},fog:{icon:c,className:`text-stone-400`},mist:{icon:c,className:`text-stone-400`},hazy:{icon:c,className:`text-stone-400`},night:{icon:r,className:`text-blue-400`},"mainly clear":{icon:p,className:`text-orange-500`},"mostly cloudy":{icon:g,className:`text-stone-400`},breezy:{icon:s,className:`text-stone-400`},windy:{icon:s,className:`text-stone-400`},cool:{icon:g,className:`text-stone-400`},warm:{icon:p,className:`text-orange-500`},hot:{icon:p,className:`text-orange-500`},cold:{icon:l,className:`text-blue-300`},"cold snap":{icon:l,className:`text-blue-300`},"warm, mostly sunny":{icon:u,className:`text-amber-400`},"cooler, breezy":{icon:s,className:`text-stone-400`}},S={icon:g,className:`text-stone-400`};function C(e){let t=b[e];if(t)return t;let n=e.toLowerCase(),r=x[n];if(r)return r;for(let[e,t]of Object.entries(x))if(n.includes(e))return t;return S}function w(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function T(e){let t;if(typeof e.location==`string`)t=e.location;else{let n=v(e.location);n&&typeof n.name==`string`&&(t=n.name)}if(!t)return null;let n=v(e.current),r=_(n?.temp)??_(e.currentTemp)??_(e.temperature)??_(e.temp),i=_(n?.feelsLike)??_(n?.feels_like)??_(n?.apparentTemperature)??_(e.feelsLike)??_(e.feels_like)??_(e.apparentTemperature),a=h(n?.condition)??h(e.condition),o=_(n?.humidity)??_(e.humidity),s=w(n?.wind??e.wind),c=_(n?.windSpeed)??_(n?.wind_speed)??_(e.windSpeed)??_(e.wind_speed)??s.speed,l=h(n?.windDirection)??h(n?.wind_direction)??h(e.windDirection)??h(e.wind_direction)??s.direction,u=v(e.units),d=h(u?.temperature)??h(n?.unit)??h(e.unit)??`F`,f=h(u?.speed)??h(e.windUnit)??h(e.wind_unit),p=m(e.hourly).map((e,t)=>({id:h(e.id)??String(t),time:h(e.time)??``,icon:h(e.icon)??h(e.condition)??`cloud.fill`,temp:_(e.tempC)??_(e.temp)??_(e.temperature),tempC:_(e.tempC)})),g=m([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:h(e.id)??String(t),day:h(e.day)??h(e.date),dayLabel:h(e.dayLabel)??h(e.date),icon:h(e.icon)??h(e.condition)??`cloud.fill`,low:_(e.low),high:_(e.high),lowC:_(e.lowC),highC:_(e.highC),precip:_(e.precip)??_(e.precipitation)??_(e.precipitationProbability),condition:h(e.condition)}));return{location:t,currentTemp:r,feelsLike:i,condition:a,humidity:o,windSpeed:c,windDirection:l,windUnit:f,unit:d,hourly:p.length>0?p:void 0,forecast:g.length>0?g:void 0}}function E(e){return e*9/5+32}function D(e){return(e-32)*5/9}function O(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=D(e)),!t&&n&&(r=E(e)),`${Math.round(r)}`}function k(e,t,n){return e.tempC===void 0?e.temp===void 0?null:O(e.temp,t,n):O(e.tempC,!1,n)}function A(e,t,n){return e.lowC===void 0?O(e.low,t,n):O(e.lowC,!1,n)}function j(e,t,n){return e.highC===void 0?O(e.high,t,n):O(e.highC,!1,n)}var M=n();function N({icon:e,size:t=20}){let{icon:n,className:r}=C(e);return(0,M.jsx)(n,{width:t,height:t,className:r})}function P({useFahrenheit:e,onToggle:t}){return(0,M.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:`°F`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:`°C`})]})}function F({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let i=e.location,o=O(e.currentTemp,t,n),c=O(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?j(u,t,n):null,f=u?A(u,t,n):null,p=null;return e.windSpeed!==void 0&&(p=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(p=`${e.windDirection} ${p}`)),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i}),o!==null&&(0,M.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[o,`°`,l]}),e.condition&&(0,M.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,M.jsx)(P,{useFahrenheit:n,onToggle:r})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[c!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`Feels like `,c,`°`]}),d!==null&&f!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`H:`,d,`° L:`,f,`°`]}),p&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(s,{width:12,height:12}),p]}),e.humidity!==void 0&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(a,{width:12,height:12}),e.humidity,`%`]})]})]})}function I({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,r)=>{let i=e.time.toLowerCase()===`now`,a=k(e,t,n);return(0,M.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,M.jsx)(`span`,{className:i?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:i?`Now`:e.time}),(0,M.jsx)(N,{icon:e.icon,size:18}),a!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[a,`°`]})]},e.id??r)})})})}function L({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,y.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=A(e,n,r),f=j(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,M.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,M.jsx)(N,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,M.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,M.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,M.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,M.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function R({templateData:e,fallback:t}){let n=(0,y.useMemo)(()=>T(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,y.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,M.jsxs)(`div`,{className:`mt-3`,children:[(0,M.jsx)(F,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,M.jsx)(I,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,M.jsx)(L,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{R as WeatherForecastDisplay};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./moon-h3xmz34k.js";import{t as i}from"./misc-BMp6WHdm.js";import{Ds as a,Fs as o,Io as s,Is as c,Ko as l,Ms as u,Ns as d,Ps as f,Uo as p,ct as m,dt as h,js as g,lt as _,ut as v}from"./index-Ck1SrvnM.js";var y=e(t(),1),b={"sun.max.fill":{icon:p,className:`text-orange-500`},"cloud.sun.fill":{icon:u,className:`text-amber-400`},"moon.fill":{icon:r,className:`text-blue-400`},"cloud.moon.fill":{icon:f,className:`text-blue-400`},"cloud.fill":{icon:g,className:`text-stone-400`},"cloud.rain.fill":{icon:d,className:`text-blue-400`},snowflake:{icon:l,className:`text-blue-300`},"cloud.bolt.fill":{icon:o,className:`text-orange-500`},"cloud.fog.fill":{icon:c,className:`text-stone-400`}},x={sunny:{icon:p,className:`text-orange-500`},clear:{icon:p,className:`text-orange-500`},"partly cloudy":{icon:u,className:`text-amber-400`},"mostly sunny":{icon:u,className:`text-amber-400`},cloudy:{icon:g,className:`text-stone-400`},overcast:{icon:g,className:`text-stone-400`},rainy:{icon:d,className:`text-blue-400`},rain:{icon:d,className:`text-blue-400`},drizzle:{icon:d,className:`text-blue-400`},snow:{icon:l,className:`text-blue-300`},snowy:{icon:l,className:`text-blue-300`},thunderstorm:{icon:o,className:`text-orange-500`},thunder:{icon:o,className:`text-orange-500`},foggy:{icon:c,className:`text-stone-400`},fog:{icon:c,className:`text-stone-400`},mist:{icon:c,className:`text-stone-400`},hazy:{icon:c,className:`text-stone-400`},night:{icon:r,className:`text-blue-400`},"mainly clear":{icon:p,className:`text-orange-500`},"mostly cloudy":{icon:g,className:`text-stone-400`},breezy:{icon:s,className:`text-stone-400`},windy:{icon:s,className:`text-stone-400`},cool:{icon:g,className:`text-stone-400`},warm:{icon:p,className:`text-orange-500`},hot:{icon:p,className:`text-orange-500`},cold:{icon:l,className:`text-blue-300`},"cold snap":{icon:l,className:`text-blue-300`},"warm, mostly sunny":{icon:u,className:`text-amber-400`},"cooler, breezy":{icon:s,className:`text-stone-400`}},S={icon:g,className:`text-stone-400`};function C(e){let t=b[e];if(t)return t;let n=e.toLowerCase(),r=x[n];if(r)return r;for(let[e,t]of Object.entries(x))if(n.includes(e))return t;return S}function w(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function T(e){let t;if(typeof e.location==`string`)t=e.location;else{let n=v(e.location);n&&typeof n.name==`string`&&(t=n.name)}if(!t)return null;let n=v(e.current),r=_(n?.temp)??_(e.currentTemp)??_(e.temperature)??_(e.temp),i=_(n?.feelsLike)??_(n?.feels_like)??_(n?.apparentTemperature)??_(e.feelsLike)??_(e.feels_like)??_(e.apparentTemperature),a=h(n?.condition)??h(e.condition),o=_(n?.humidity)??_(e.humidity),s=w(n?.wind??e.wind),c=_(n?.windSpeed)??_(n?.wind_speed)??_(e.windSpeed)??_(e.wind_speed)??s.speed,l=h(n?.windDirection)??h(n?.wind_direction)??h(e.windDirection)??h(e.wind_direction)??s.direction,u=v(e.units),d=h(u?.temperature)??h(n?.unit)??h(e.unit)??`F`,f=h(u?.speed)??h(e.windUnit)??h(e.wind_unit),p=m(e.hourly).map((e,t)=>({id:h(e.id)??String(t),time:h(e.time)??``,icon:h(e.icon)??h(e.condition)??`cloud.fill`,temp:_(e.tempC)??_(e.temp)??_(e.temperature),tempC:_(e.tempC)})),g=m([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:h(e.id)??String(t),day:h(e.day)??h(e.date),dayLabel:h(e.dayLabel)??h(e.date),icon:h(e.icon)??h(e.condition)??`cloud.fill`,low:_(e.low),high:_(e.high),lowC:_(e.lowC),highC:_(e.highC),precip:_(e.precip)??_(e.precipitation)??_(e.precipitationProbability),condition:h(e.condition)}));return{location:t,currentTemp:r,feelsLike:i,condition:a,humidity:o,windSpeed:c,windDirection:l,windUnit:f,unit:d,hourly:p.length>0?p:void 0,forecast:g.length>0?g:void 0}}function E(e){return e*9/5+32}function D(e){return(e-32)*5/9}function O(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=D(e)),!t&&n&&(r=E(e)),`${Math.round(r)}`}function k(e,t,n){return e.tempC===void 0?e.temp===void 0?null:O(e.temp,t,n):O(e.tempC,!1,n)}function A(e,t,n){return e.lowC===void 0?O(e.low,t,n):O(e.lowC,!1,n)}function j(e,t,n){return e.highC===void 0?O(e.high,t,n):O(e.highC,!1,n)}var M=n();function N({icon:e,size:t=20}){let{icon:n,className:r}=C(e);return(0,M.jsx)(n,{width:t,height:t,className:r})}function P({useFahrenheit:e,onToggle:t}){return(0,M.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:`°F`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:`°C`})]})}function F({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let i=e.location,o=O(e.currentTemp,t,n),c=O(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?j(u,t,n):null,f=u?A(u,t,n):null,p=null;return e.windSpeed!==void 0&&(p=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(p=`${e.windDirection} ${p}`)),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i}),o!==null&&(0,M.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[o,`°`,l]}),e.condition&&(0,M.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,M.jsx)(P,{useFahrenheit:n,onToggle:r})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[c!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`Feels like `,c,`°`]}),d!==null&&f!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`H:`,d,`° L:`,f,`°`]}),p&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(s,{width:12,height:12}),p]}),e.humidity!==void 0&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(a,{width:12,height:12}),e.humidity,`%`]})]})]})}function I({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,r)=>{let i=e.time.toLowerCase()===`now`,a=k(e,t,n);return(0,M.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,M.jsx)(`span`,{className:i?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:i?`Now`:e.time}),(0,M.jsx)(N,{icon:e.icon,size:18}),a!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[a,`°`]})]},e.id??r)})})})}function L({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,y.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=A(e,n,r),f=j(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,M.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,M.jsx)(N,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,M.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,M.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,M.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,M.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function R({templateData:e,fallback:t}){let n=(0,y.useMemo)(()=>T(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,y.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,M.jsxs)(`div`,{className:`mt-3`,children:[(0,M.jsx)(F,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,M.jsx)(I,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,M.jsx)(L,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{R as WeatherForecastDisplay};
@@ -1 +1 @@
1
- import{t as e}from"./button-CW7wKp2r.js";import{u as t}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{l as r}from"./local-mode-Dydd46cS.js";import{u as i}from"./routes-D4ff4ONd.js";import{t as a}from"./use-onboarding-login-DMLLDHRX.js";import{hn as o}from"./index-C7ix_asE.js";var s=n();function c(){let n=t(),{loading:c,error:l,login:u,cancel:d}=a();return(0,s.jsx)(o,{children:(0,s.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center px-6 pb-40 text-[var(--content-default)]`,children:(0,s.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:[(0,s.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Welcome to Vellum`}),(0,s.jsx)(`p`,{className:`mt-3 text-body-medium-lighter text-[var(--content-tertiary)]`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Your own personal intelligence is just a step away.`}),l&&(0,s.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:l}),(0,s.jsxs)(`div`,{className:`mt-10 flex w-full max-w-sm flex-col gap-3`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,s.jsx)(e,{variant:`primary`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:c?d:()=>void u(),children:c?`Cancel`:`Log In`}),(0,s.jsx)(e,{variant:`ghost`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:()=>{c&&d(),r()?n(i.selectAssistant):n(i.onboarding.hosting)},children:`Continue without account`})]})]})})})}export{c as WelcomeScreen};
1
+ import{t as e}from"./button-CW7wKp2r.js";import{u as t}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{l as r}from"./local-mode-Dydd46cS.js";import{u as i}from"./routes-D4ff4ONd.js";import{t as a}from"./use-onboarding-login-6LWa5XdQ.js";import{hn as o}from"./index-Ck1SrvnM.js";var s=n();function c(){let n=t(),{loading:c,error:l,login:u,cancel:d}=a();return(0,s.jsx)(o,{children:(0,s.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center px-6 pb-40 text-[var(--content-default)]`,children:(0,s.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:[(0,s.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Welcome to Vellum`}),(0,s.jsx)(`p`,{className:`mt-3 text-body-medium-lighter text-[var(--content-tertiary)]`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Your own personal intelligence is just a step away.`}),l&&(0,s.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:l}),(0,s.jsxs)(`div`,{className:`mt-10 flex w-full max-w-sm flex-col gap-3`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,s.jsx)(e,{variant:`primary`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:c?d:()=>void u(),children:c?`Cancel`:`Log In`}),(0,s.jsx)(e,{variant:`ghost`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:()=>{c&&d(),r()?n(i.selectAssistant):n(i.onboarding.hosting)},children:`Continue without account`})]})]})})})}export{c as WelcomeScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-1kyF_Eu1.js";import{t as a}from"./arrow-left-C2re-gYj.js";import{n as o,r as s,t as c}from"./metric-card-TrndloL3.js";import{t as l}from"./ban-Bvfp1f1I.js";import{r as u}from"./panel-item-D1WbMkez.js";import{t as d}from"./circle-check-DqvTjWle.js";import{t as f}from"./triangle-alert-CnjNKhNx.js";import{t as p}from"./users--1gWeHEq.js";import{t as m}from"./x-CswtfvgS.js";import"./src-BT0gNVcT.js";import{n as h,r as g,t as _}from"./workflow-status-PqQ1OqJN.js";import{t as v}from"./proxy-DoUA9mK6.js";import{t as y}from"./AnimatePresence-C42g9zWi.js";import{t as b}from"./use-reduced-motion-DpK6cQN-.js";import{t as x}from"./three-dot-indicator-BuZzHFUJ.js";import{Fo as S,Go as C,Js as w,gt as T,vt as E,yt as D}from"./index-C7ix_asE.js";import{t as O}from"./status-badge-pill-j3ke1d9o.js";var k=e(t(),1),A=r();function j({onClick:e,ariaLabel:t}){return(0,A.jsxs)(`button`,{type:`button`,"aria-label":t,onClick:e,className:`flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border border-[var(--system-negative-strong)] bg-transparent px-2.5 py-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:[(0,A.jsx)(C,{className:`h-3 w-3`,fill:`currentColor`}),(0,A.jsx)(i,{variant:`label-small-default`,children:`Stop`})]})}function M({title:e,body:t,emptyText:n}){return(0,A.jsxs)(`div`,{className:`mb-5`,children:[(0,A.jsx)(i,{variant:`body-medium-default`,as:`h3`,className:`mb-2 text-[var(--content-emphasised)]`,children:e}),t?(0,A.jsx)(i,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:t}):(0,A.jsx)(i,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-tertiary)]`,children:n})]})}function N({leaf:e}){let t=e.status===`running`?`Running…`:`No result summary`;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`mb-5 grid grid-cols-2 gap-3`,children:[(0,A.jsx)(c,{icon:(0,A.jsx)(w,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens??0,format:e=>o(Math.round(e)),label:`Input`}),(0,A.jsx)(c,{icon:(0,A.jsx)(s,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens??0,format:e=>o(Math.round(e)),label:`Output`})]}),(0,A.jsx)(M,{title:`Prompt`,body:e.promptSummary,emptyText:`No prompt summary`}),(0,A.jsx)(M,{title:`Result`,body:e.resultSummary,emptyText:t})]})}function P({status:e}){return(0,A.jsx)(O,{color:h(e),label:g(e)})}function F(e){switch(e){case`completed`:return`var(--system-positive-strong)`;case`failed`:return`var(--system-negative-strong)`;case`cancelled`:return`var(--content-secondary)`;default:return`var(--primary-base)`}}function I(e){switch(e){case`completed`:return`Completed`;case`failed`:return`Failed`;case`cancelled`:return`Cancelled`;default:return`Running`}}function L({status:e}){return(0,A.jsx)(O,{color:F(e),label:I(e)})}function R({status:e}){let t=b(),n=`h-3.5 w-3.5 shrink-0`,r;return r=e===`running`?(0,A.jsx)(x,{className:`shrink-0`,dotSize:4,gap:2}):e===`completed`?(0,A.jsx)(d,{className:n,style:{color:`var(--system-positive-strong)`}}):e===`failed`?(0,A.jsx)(f,{className:n,style:{color:`var(--system-negative-strong)`}}):(0,A.jsx)(l,{className:n,style:{color:`var(--content-secondary)`},role:`img`,"aria-label":`Cancelled`}),(0,A.jsx)(y,{mode:`wait`,initial:!1,children:(0,A.jsx)(v.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t?{duration:0}:{duration:.15,ease:[.16,1,.3,1]},className:`flex shrink-0 items-center`,children:r},e)})}function z({runId:e,leaf:t,components:n,onSelect:r}){let a=t.label??`Subagent ${t.seq}`,o=t.promptSummary,s=T(`${e}:${t.seq}`);return(0,A.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Open ${a} details`,className:`flex w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] px-2 py-1.5 text-left transition-colors hover:bg-[var(--surface-overlay)]`,children:(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(R,{status:t.status}),n?(0,A.jsx)(D,{components:n,bodyShapeId:s.bodyShape,eyeStyleId:s.eyeStyle,colorId:s.color,size:16}):(0,A.jsx)(`div`,{style:{width:16,height:16,flexShrink:0},"aria-hidden":!0}),(0,A.jsx)(i,{variant:`body-medium-default`,title:a,className:`max-w-[60%] shrink-0 truncate text-[var(--content-default)]`,children:a}),o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[var(--content-tertiary)] opacity-10`,children:`|`}),(0,A.jsx)(i,{variant:`body-medium-lighter`,title:o,className:`min-w-0 truncate text-[var(--content-tertiary)]`,children:o})]})]})})}function B({entry:e,onClose:t,onStop:r,onRequestJournal:l}){let d=_(e.status),f=b(),h=e.label??e.runId,g=e.agentsSpawned||e.leaves.size,y=E(),x=[...e.leaves.values()].sort((e,t)=>e.seq-t.seq),[C,O]=(0,k.useState)(null),[M,F]=(0,k.useState)(e.runId);M!==e.runId&&(F(e.runId),O(null));let I=C==null?void 0:e.leaves.get(C),R=I?T(`${e.runId}:${I.seq}`):void 0,B=(0,k.useCallback)(()=>O(null),[]),V=I?I.label??`Subagent ${I.seq}`:``,H=I?V:h,U=d?`live`:`final`;return(0,k.useEffect)(()=>{l?.(e.runId)},[e.runId,U,l]),(0,A.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden rounded-xl bg-[var(--surface-lift)]`,children:[I&&(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:B,title:h,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,A.jsx)(i,{variant:`body-small-default`,as:`span`,children:h})}),(0,A.jsx)(u,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,A.jsx)(i,{variant:`body-small-default`,as:`span`,title:V,className:`min-w-0 shrink truncate text-[var(--content-secondary)]`,children:V})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-[var(--border-hover)] px-5 py-4`,children:[I&&(0,A.jsx)(n,{variant:`outlined`,iconOnly:(0,A.jsx)(a,{}),onClick:B,"aria-label":`Back to subagents`,tooltip:`Back`,className:`shrink-0 rounded-lg`}),I?y&&R?(0,A.jsx)(D,{components:y,bodyShapeId:R.bodyShape,eyeStyleId:R.eyeStyle,colorId:R.color,size:32}):(0,A.jsx)(`div`,{style:{width:32,height:32,flexShrink:0},"aria-hidden":!0}):(0,A.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-[6px] bg-[var(--surface-overlay)]`,children:(0,A.jsx)(S,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})}),(0,A.jsx)(i,{variant:`title-medium`,title:H,className:`min-w-0 shrink truncate text-[var(--content-default)]`,children:H}),I?(0,A.jsx)(L,{status:I.status}):(0,A.jsx)(P,{status:e.status}),(0,A.jsx)(`span`,{className:`flex-1`}),d&&r&&(0,A.jsx)(j,{onClick:()=>r(e.runId),ariaLabel:`Stop workflow`}),(0,A.jsx)(n,{variant:`outlined`,iconOnly:(0,A.jsx)(m,{}),onClick:t,"aria-label":`Close workflow detail`,tooltip:`Close`,className:`shrink-0 rounded-lg`})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5`,children:(0,A.jsx)(v.div,{initial:{opacity:0},animate:{opacity:1},transition:f?{duration:0}:{duration:.18,ease:[.16,1,.3,1]},children:I?(0,A.jsx)(N,{leaf:I}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`mb-5 grid grid-cols-3 gap-3`,children:[(0,A.jsx)(c,{icon:(0,A.jsx)(w,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens,format:e=>o(Math.round(e)),label:`Input`}),(0,A.jsx)(c,{icon:(0,A.jsx)(s,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens,format:e=>o(Math.round(e)),label:`Output`}),(0,A.jsx)(c,{icon:(0,A.jsx)(p,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:g,format:e=>o(Math.round(e)),label:`Agents`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(i,{variant:`body-medium-default`,as:`h3`,className:`mb-4 text-[var(--content-emphasised)]`,children:`Subagents`}),x.length===0?(0,A.jsx)(i,{variant:`body-small-default`,className:`py-4 text-center text-[var(--content-tertiary)]`,children:`No subagents yet`}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(t=>(0,A.jsx)(z,{runId:e.runId,leaf:t,components:y,onSelect:()=>O(t.seq)},t.seq))})]})]})},I?String(I.seq):`list`)})]})}export{B as WorkflowDetailPanel};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-1kyF_Eu1.js";import{t as a}from"./arrow-left-C2re-gYj.js";import{n as o,r as s,t as c}from"./metric-card-TrndloL3.js";import{t as l}from"./ban-Bvfp1f1I.js";import{r as u}from"./panel-item-D1WbMkez.js";import{t as d}from"./circle-check-DqvTjWle.js";import{t as f}from"./triangle-alert-CnjNKhNx.js";import{t as p}from"./users--1gWeHEq.js";import{t as m}from"./x-CswtfvgS.js";import"./src-BT0gNVcT.js";import{n as h,r as g,t as _}from"./workflow-status-PqQ1OqJN.js";import{t as v}from"./proxy-DoUA9mK6.js";import{t as y}from"./AnimatePresence-C42g9zWi.js";import{t as b}from"./use-reduced-motion-DpK6cQN-.js";import{t as x}from"./three-dot-indicator-BuZzHFUJ.js";import{Fo as S,Go as C,Js as w,gt as T,vt as E,yt as D}from"./index-Ck1SrvnM.js";import{t as O}from"./status-badge-pill-j3ke1d9o.js";var k=e(t(),1),A=r();function j({onClick:e,ariaLabel:t}){return(0,A.jsxs)(`button`,{type:`button`,"aria-label":t,onClick:e,className:`flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border border-[var(--system-negative-strong)] bg-transparent px-2.5 py-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:[(0,A.jsx)(C,{className:`h-3 w-3`,fill:`currentColor`}),(0,A.jsx)(i,{variant:`label-small-default`,children:`Stop`})]})}function M({title:e,body:t,emptyText:n}){return(0,A.jsxs)(`div`,{className:`mb-5`,children:[(0,A.jsx)(i,{variant:`body-medium-default`,as:`h3`,className:`mb-2 text-[var(--content-emphasised)]`,children:e}),t?(0,A.jsx)(i,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:t}):(0,A.jsx)(i,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-tertiary)]`,children:n})]})}function N({leaf:e}){let t=e.status===`running`?`Running…`:`No result summary`;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`mb-5 grid grid-cols-2 gap-3`,children:[(0,A.jsx)(c,{icon:(0,A.jsx)(w,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens??0,format:e=>o(Math.round(e)),label:`Input`}),(0,A.jsx)(c,{icon:(0,A.jsx)(s,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens??0,format:e=>o(Math.round(e)),label:`Output`})]}),(0,A.jsx)(M,{title:`Prompt`,body:e.promptSummary,emptyText:`No prompt summary`}),(0,A.jsx)(M,{title:`Result`,body:e.resultSummary,emptyText:t})]})}function P({status:e}){return(0,A.jsx)(O,{color:h(e),label:g(e)})}function F(e){switch(e){case`completed`:return`var(--system-positive-strong)`;case`failed`:return`var(--system-negative-strong)`;case`cancelled`:return`var(--content-secondary)`;default:return`var(--primary-base)`}}function I(e){switch(e){case`completed`:return`Completed`;case`failed`:return`Failed`;case`cancelled`:return`Cancelled`;default:return`Running`}}function L({status:e}){return(0,A.jsx)(O,{color:F(e),label:I(e)})}function R({status:e}){let t=b(),n=`h-3.5 w-3.5 shrink-0`,r;return r=e===`running`?(0,A.jsx)(x,{className:`shrink-0`,dotSize:4,gap:2}):e===`completed`?(0,A.jsx)(d,{className:n,style:{color:`var(--system-positive-strong)`}}):e===`failed`?(0,A.jsx)(f,{className:n,style:{color:`var(--system-negative-strong)`}}):(0,A.jsx)(l,{className:n,style:{color:`var(--content-secondary)`},role:`img`,"aria-label":`Cancelled`}),(0,A.jsx)(y,{mode:`wait`,initial:!1,children:(0,A.jsx)(v.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t?{duration:0}:{duration:.15,ease:[.16,1,.3,1]},className:`flex shrink-0 items-center`,children:r},e)})}function z({runId:e,leaf:t,components:n,onSelect:r}){let a=t.label??`Subagent ${t.seq}`,o=t.promptSummary,s=T(`${e}:${t.seq}`);return(0,A.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Open ${a} details`,className:`flex w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] px-2 py-1.5 text-left transition-colors hover:bg-[var(--surface-overlay)]`,children:(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(R,{status:t.status}),n?(0,A.jsx)(D,{components:n,bodyShapeId:s.bodyShape,eyeStyleId:s.eyeStyle,colorId:s.color,size:16}):(0,A.jsx)(`div`,{style:{width:16,height:16,flexShrink:0},"aria-hidden":!0}),(0,A.jsx)(i,{variant:`body-medium-default`,title:a,className:`max-w-[60%] shrink-0 truncate text-[var(--content-default)]`,children:a}),o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[var(--content-tertiary)] opacity-10`,children:`|`}),(0,A.jsx)(i,{variant:`body-medium-lighter`,title:o,className:`min-w-0 truncate text-[var(--content-tertiary)]`,children:o})]})]})})}function B({entry:e,onClose:t,onStop:r,onRequestJournal:l}){let d=_(e.status),f=b(),h=e.label??e.runId,g=e.agentsSpawned||e.leaves.size,y=E(),x=[...e.leaves.values()].sort((e,t)=>e.seq-t.seq),[C,O]=(0,k.useState)(null),[M,F]=(0,k.useState)(e.runId);M!==e.runId&&(F(e.runId),O(null));let I=C==null?void 0:e.leaves.get(C),R=I?T(`${e.runId}:${I.seq}`):void 0,B=(0,k.useCallback)(()=>O(null),[]),V=I?I.label??`Subagent ${I.seq}`:``,H=I?V:h,U=d?`live`:`final`;return(0,k.useEffect)(()=>{l?.(e.runId)},[e.runId,U,l]),(0,A.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden rounded-xl bg-[var(--surface-lift)]`,children:[I&&(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:B,title:h,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,A.jsx)(i,{variant:`body-small-default`,as:`span`,children:h})}),(0,A.jsx)(u,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,A.jsx)(i,{variant:`body-small-default`,as:`span`,title:V,className:`min-w-0 shrink truncate text-[var(--content-secondary)]`,children:V})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-[var(--border-hover)] px-5 py-4`,children:[I&&(0,A.jsx)(n,{variant:`outlined`,iconOnly:(0,A.jsx)(a,{}),onClick:B,"aria-label":`Back to subagents`,tooltip:`Back`,className:`shrink-0 rounded-lg`}),I?y&&R?(0,A.jsx)(D,{components:y,bodyShapeId:R.bodyShape,eyeStyleId:R.eyeStyle,colorId:R.color,size:32}):(0,A.jsx)(`div`,{style:{width:32,height:32,flexShrink:0},"aria-hidden":!0}):(0,A.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-[6px] bg-[var(--surface-overlay)]`,children:(0,A.jsx)(S,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})}),(0,A.jsx)(i,{variant:`title-medium`,title:H,className:`min-w-0 shrink truncate text-[var(--content-default)]`,children:H}),I?(0,A.jsx)(L,{status:I.status}):(0,A.jsx)(P,{status:e.status}),(0,A.jsx)(`span`,{className:`flex-1`}),d&&r&&(0,A.jsx)(j,{onClick:()=>r(e.runId),ariaLabel:`Stop workflow`}),(0,A.jsx)(n,{variant:`outlined`,iconOnly:(0,A.jsx)(m,{}),onClick:t,"aria-label":`Close workflow detail`,tooltip:`Close`,className:`shrink-0 rounded-lg`})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5`,children:(0,A.jsx)(v.div,{initial:{opacity:0},animate:{opacity:1},transition:f?{duration:0}:{duration:.18,ease:[.16,1,.3,1]},children:I?(0,A.jsx)(N,{leaf:I}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`mb-5 grid grid-cols-3 gap-3`,children:[(0,A.jsx)(c,{icon:(0,A.jsx)(w,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens,format:e=>o(Math.round(e)),label:`Input`}),(0,A.jsx)(c,{icon:(0,A.jsx)(s,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens,format:e=>o(Math.round(e)),label:`Output`}),(0,A.jsx)(c,{icon:(0,A.jsx)(p,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:g,format:e=>o(Math.round(e)),label:`Agents`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(i,{variant:`body-medium-default`,as:`h3`,className:`mb-4 text-[var(--content-emphasised)]`,children:`Subagents`}),x.length===0?(0,A.jsx)(i,{variant:`body-small-default`,className:`py-4 text-center text-[var(--content-tertiary)]`,children:`No subagents yet`}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(t=>(0,A.jsx)(z,{runId:e.runId,leaf:t,components:y,onSelect:()=>O(t.seq)},t.seq))})]})]})},I?String(I.seq):`list`)})]})}export{B as WorkflowDetailPanel};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{m as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./queryOptions-BtNi-_9H.js";import{t as l}from"./createLucideIcon-Bjb-Kuq7.js";import{t as u}from"./chevron-down-DpYf9Gwq.js";import{n as d,r as f,t as p}from"./panel-item-D1WbMkez.js";import{t as m}from"./menu-DSB0wFjY.js";import{t as h}from"./download-B6XjnEzx.js";import{t as g}from"./eye-off-BQ9J3pF2.js";import{t as _}from"./eye-C2rSrbD-.js";import{t as v}from"./file-text-DA128T4K.js";import{t as y}from"./file-C8pjlmtk.js";import{t as b}from"./folder-open-7DKBH5WB.js";import{t as x}from"./loader-circle-Ck8fq3yv.js";import{t as S}from"./pencil-CsnkG5VN.js";import{t as C}from"./plus-DZZypDUF.js";import{t as w}from"./x-CswtfvgS.js";import{O as T}from"./src-BT0gNVcT.js";import{t as E}from"./input-D3MhHg0d.js";import{t as D}from"./modal-D_Y2RPD5.js";import{t as O}from"./confirm-dialog-DxBl6zcI.js";import{n as k,t as A}from"./file-markdown-BCMtcYze.js";import{Br as j,Hr as M,Ir as N,Lr as P,Rr as F,Ur as ee,zr as I}from"./sdk.gen-BR-xXIZm.js";import{n as L}from"./native-file-CKFw72Il.js";import{Cs as R,Ha as z,J as B,Ro as V,Vo as te,Zo as ne,bs as H,ws as U}from"./index-C7ix_asE.js";import{n as W,t as re}from"./mobile-sidebar-drawer-CVT3O8os.js";import{i as G,n as ie,r as K,t as q}from"./file-editor-BdFicqX_.js";import{t as J}from"./format-file-size-B9DWgk-8.js";var ae=l(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),oe=l(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),Y=l(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),X=e(t(),1);async function se(e){let{data:t,error:n}=await P({path:{assistant_id:e.assistantId},query:{path:e.path,...e.showHidden?{showHidden:`true`}:{}},parseAs:`blob`,throwOnError:!1});if(n||!(t instanceof Blob))throw Error(`Failed to download file`);await L(t,e.filename)}function ce(e){if(!e)return``;let t=e.indexOf(`;`);return(t===-1?e:e.slice(0,t)).trim()}function le(e,t){return ce(t)===`application/json`?!0:(e??``).toLowerCase().endsWith(`.json`)}function ue(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function de(e){return e.split(`/`).some(e=>e.startsWith(`.`))}var Z=s();function fe(e){let{assistantId:t,path:n,name:r,showHidden:i}=e,[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1);return{isDownloading:a,error:s,download:(0,X.useCallback)(async()=>{c(!1),o(!0);try{await se({assistantId:t,path:n,filename:r,showHidden:i})}catch{c(!0)}finally{o(!1)}},[t,n,r,i])}}function pe({assistantId:e,path:t,name:r,showHidden:i}){let{isDownloading:a,error:o,download:s}=fe({assistantId:e,path:t,name:r,showHidden:i});return(0,Z.jsx)(n,{variant:`ghost`,size:`regular`,iconOnly:a?(0,Z.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(h,{"aria-hidden":!0}),onClick:()=>void s(),disabled:a,"aria-label":`Download ${r}`,tooltip:o?`Download failed. Try again.`:`Download`})}function me(e){return c({queryFn:async()=>{let{data:t,error:n}=await F({path:e.path,query:{path:e.query.path,...e.query.showHidden?{showHidden:`true`}:{}}});if(n)throw n;return t},queryKey:[`assistantsWorkspaceFileRetrieve`,e]})}function he({mimeType:e}){let t=e.indexOf(`;`),n=(t===-1?e:e.slice(0,t)).trim(),r=v;return n.startsWith(`image/`)?r=H:n.startsWith(`video/`)?r=V:!n.startsWith(`text/`)&&n!==`application/json`&&n!==`application/octet-stream`&&(r=y),(0,Z.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 10%, transparent)`},children:(0,Z.jsx)(r,{className:`h-3.5 w-3.5`,style:{color:`var(--content-default)`}})})}function ge({viewMode:e,onChange:t}){return(0,Z.jsx)(`div`,{className:`inline-flex rounded-md p-0.5`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 6%, transparent)`},children:[`preview`,`source`].map(r=>{let i=e===r;return(0,Z.jsx)(n,{variant:`ghost`,onClick:()=>t(r),className:`h-auto rounded border-0 px-2.5 py-1 text-body-small-default hover:bg-transparent`,style:{backgroundColor:i?`var(--surface-lift)`:`transparent`,color:i?`var(--content-default)`:`var(--content-tertiary)`,boxShadow:i?`0 1px 2px rgba(0,0,0,0.15)`:void 0},children:r===`preview`?`Preview`:`Source`},r)})})}function Q({name:e,mimeType:t,size:n,rightContent:r}){return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(he,{mimeType:t}),(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e}),n!=null&&(0,Z.jsx)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:J(n)})]}),r]})}function _e({assistantId:e,path:t,mimeType:n,showHidden:r}){let{data:i,isLoading:o}=a({queryFn:async()=>{let n=await P({path:{assistant_id:e},query:{path:t,...r?{showHidden:`true`}:{}},parseAs:`blob`});if(n.error)throw n.error;return n.data},queryKey:[`assistantsWorkspaceFileContentRetrieve`,{assistantId:e,path:t,showHidden:r}],enabled:!!t}),[s,c]=(0,X.useState)(null);return(0,X.useEffect)(()=>{if(!i)return;let e=URL.createObjectURL(i);return c(e),()=>{URL.revokeObjectURL(e),c(null)}},[i]),o?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Z.jsx)(x,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):s?n.startsWith(`image/`)?(0,Z.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Z.jsx)(`img`,{src:s,alt:t.split(`/`).pop()??`image`,className:`max-h-[70vh] max-w-full rounded object-contain`})}):n.startsWith(`video/`)?(0,Z.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-[70vh] max-w-full rounded`})}):null:null}function ve({assistantId:e,path:t,name:r,mimeType:i,size:a,modifiedAt:o,showHidden:s}){let{isDownloading:c,error:l,download:u}=fe({assistantId:e,path:t,name:r,showHidden:s});return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:r,mimeType:i,size:a}),(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,Z.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border p-6 text-center`,style:{borderColor:`var(--border-base)`,backgroundColor:`var(--surface-lift)`},children:[(0,Z.jsx)(y,{className:`mx-auto h-10 w-10`,style:{color:`var(--content-tertiary)`}}),(0,Z.jsx)(`p`,{className:`mt-3 text-body-medium-default`,style:{color:`var(--content-default)`},children:r}),(0,Z.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:i}),(0,Z.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:J(a,`Unknown size`)}),o&&(0,Z.jsxs)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:[`Modified: `,new Date(o).toLocaleString()]})]}),(0,Z.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:c?(0,Z.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(h,{"aria-hidden":!0}),onClick:u,disabled:c,"aria-label":`Download ${r}`,className:`mt-4`,children:c?`Downloading…`:`Download`}),l&&(0,Z.jsx)(`p`,{className:`mt-2 text-body-small-default`,style:{color:`var(--system-error)`},children:`Download failed. Try again.`})]})})]})}function ye({assistantId:e,selectedPath:t,showHidden:r,viewMode:s,onChangeViewMode:c,onBrowse:l,pathRename:u,pathDelete:d}){let f=i(),{data:p,isLoading:m}=a({...me({path:{assistant_id:e},query:{path:t??``,showHidden:r}}),enabled:!!t}),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(null);(0,X.useEffect)(()=>{if(!u)return;let{from:e,to:t}=u,n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;g(e=>e==null?e:n(e)),v(e=>e==null?e:{...e,path:n(e.path)})},[u]),(0,X.useEffect)(()=>{if(!d)return;let{path:e}=d,t=t=>t===e||t.startsWith(`${e}/`);g(e=>e!=null&&t(e)?null:e),v(e=>e!=null&&t(e.path)?null:e)},[d]);let y=h!=null&&h===t,S=p?.content??``,C=_?.path===t?_.content:S,w=()=>{g(null),v(null)},T=o({mutationFn:async({path:t,content:n})=>{let{error:r,response:i}=await ee({path:{assistant_id:e},body:{path:t,content:n,encoding:`utf8`},throwOnError:!1});if(!i?.ok||r)throw Error(`Failed to save file`)},onSuccess:(e,t)=>{g(e=>e===t.path?null:e),v(e=>e?.path===t.path?null:e),f.invalidateQueries({queryKey:[`assistantsWorkspaceFileRetrieve`]})}}),E=C!==S,D=(0,X.useCallback)(()=>{t&&E&&!T.isPending&&T.mutate({path:t,content:C})},[t,E,T,C]);if(!t)return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view`}),l&&(0,Z.jsx)(n,{type:`button`,onClick:l,leftIcon:(0,Z.jsx)(b,{"aria-hidden":!0}),className:`sm:hidden`,children:`Browse files`})]});if(m)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(x,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})});if(!p)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`File not found`})});let O=p.mimeType??`application/octet-stream`,j=p.name??t.split(`/`).pop()??t,M=k(j,O),N=le(j,O),P=p.content!=null&&!M&&!N,F=t?de(t):!0,I=y&&(0,Z.jsx)(ie,{isDirty:E,isSaving:T.isPending,error:T.isError?`Save failed`:null,onSave:D,onDiscard:w});if(M&&p.content!=null){let e=y?C:p.content;return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,rightContent:(0,Z.jsx)(ge,{viewMode:s,onChange:e=>{y&&w(),c(e)}})}),(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:y,onToggleEdit:()=>y?w():g(t)}),s===`preview`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Z.jsx)(A,{content:e})}):y?(0,Z.jsx)(K,{value:C,onChange:e=>v({path:t,content:e}),onSave:D}):(0,Z.jsx)(G,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}if(N&&p.content!=null){let e=y?C:p.content,n=ue(e);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,rightContent:(0,Z.jsx)(ge,{viewMode:s,onChange:e=>{y&&w(),c(e)}})}),(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:s===`preview`?n:e,downloadContent:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:y,onToggleEdit:()=>y?w():g(t)}),s===`preview`?(0,Z.jsx)(G,{content:n,readOnly:!0,whiteSpace:`pre`}):y?(0,Z.jsx)(K,{value:C,onChange:e=>v({path:t,content:e}),onSave:D}):(0,Z.jsx)(G,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}return P?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,size:p.size}),(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:y?C:p.content??``,fileName:j,mimeType:O,showEdit:!F,isEditing:y,onToggleEdit:()=>y?w():g(t)}),y?(0,Z.jsx)(K,{value:C,onChange:e=>v({path:t,content:e}),onSave:D}):(0,Z.jsx)(G,{content:p.content??``,readOnly:F,onStartEdit:()=>g(t)})]}),I]}):O.startsWith(`image/`)||O.startsWith(`video/`)?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,size:p.size,rightContent:(0,Z.jsx)(pe,{assistantId:e,path:t,name:j,showHidden:r})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,Z.jsx)(_e,{assistantId:e,path:t,mimeType:O,showHidden:r})})]}):(0,Z.jsx)(ve,{assistantId:e,path:t,name:j,mimeType:O,size:p.size,modifiedAt:p.modifiedAt,showHidden:r})}function be(e,t){if(t===`name`)return e;let n=e.slice();return n.sort((e,t)=>{let n=e.size??null,r=t.size??null;return n===null&&r===null?(e.name??``).localeCompare(t.name??``):n===null?1:r===null?-1:n===r?(e.name??``).localeCompare(t.name??``):r-n}),n}function $(e){return c({queryFn:async()=>{let t={};e.query?.path&&(t.path=e.query.path),e.query?.showHidden&&(t.showHidden=`true`),e.query?.includeDirSizes&&(t.includeDirSizes=`true`);let{data:n,error:r}=await M({path:e.path,query:t});if(r)throw r;if(!n)throw Error(`Failed to load workspace tree`);return n},queryKey:[`assistantsWorkspaceTreeRetrieve`,e]})}async function xe(e,t,n,r){let i=n.toLowerCase(),a=r?.toLowerCase(),{data:o}=await M({path:{assistant_id:e},query:t?{path:t}:{}});if(o?.entries?.some(e=>{let t=(e.name??``).toLowerCase();return t===i&&t!==a}))throw Error(`"${n}" already exists here.`)}function Se({entry:e}){return e.type===`directory`?(0,Z.jsx)(R,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`image/`)?(0,Z.jsx)(H,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`video/`)?(0,Z.jsx)(V,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Z.jsx)(v,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}})}function Ce({entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:d,onRequestRename:p,onRequestCreate:m,depth:h}){let g=e.path??``,_=e.name??``,v=e.type===`directory`,y=n.has(g),b=r===g,x=_.startsWith(`.`),C=!de(g),w=v&&(y||s.length>0),{data:E}=a({...$({path:{assistant_id:t},query:{path:g,showHidden:i,includeDirSizes:o===`size`}}),enabled:v&&w}),D=(0,X.useMemo)(()=>be(E?.entries??[],o),[E?.entries,o]),O=s===``||_.toLowerCase().includes(s);if(s!==``&&!v&&!O)return null;let k=(0,Z.jsxs)(`button`,{onClick:()=>{v?c(g):l(g)},className:`flex w-full items-center gap-1.5 px-2 py-1 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{paddingLeft:`${h*14+8}px`,paddingRight:`8px`,color:b?`var(--content-default)`:x?`var(--content-tertiary)`:`var(--content-default)`,backgroundColor:b?`color-mix(in oklab, var(--primary-base) 12%, transparent)`:void 0,opacity:x&&!b?.7:1},children:[v?w?(0,Z.jsx)(u,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Z.jsx)(f,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Z.jsx)(`span`,{className:`h-3 w-3 shrink-0`}),(0,Z.jsx)(Se,{entry:e}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_}),e.size!=null&&(0,Z.jsx)(`span`,{className:`shrink-0 text-label-medium-default tabular-nums`,style:{color:`var(--content-tertiary)`},children:J(e.size)})]});return(0,Z.jsxs)(`div`,{children:[C?(0,Z.jsxs)(T.Root,{children:[(0,Z.jsx)(T.Trigger,{children:k}),(0,Z.jsxs)(T.Content,{children:[v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(U,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`file`,parentPath:g}),children:`New File`}),(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(Y,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`folder`,parentPath:g}),children:`New Folder`}),(0,Z.jsx)(T.Separator,{})]}),(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(te,{className:`h-3.5 w-3.5`}),onSelect:()=>d({path:g,name:_,isDirectory:v}),children:`Delete`}),(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(S,{className:`h-3.5 w-3.5`}),onSelect:()=>p({path:g,name:_,isDirectory:v}),children:`Rename`})]})]}):k,v&&w&&D.length>0&&(0,Z.jsx)(`div`,{children:D.map(e=>(0,Z.jsx)(Ce,{entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:d,onRequestRename:p,onRequestCreate:m,depth:h+1},e.path))})]})}function we({title:e,placeholder:t,confirmLabel:r,pendingLabel:i,initialName:a,onCancel:o,onConfirm:s,pending:c,error:l}){let u=(0,X.useRef)(null),[d,f]=(0,X.useState)(a??``),p=d.trim(),m=p.length>0&&(/[/\\]/.test(p)||p===`.`||p===`..`),h=p.length>0&&!m&&!c;return(0,Z.jsx)(D.Root,{open:!0,onOpenChange:e=>{!e&&!c&&o()},children:(0,Z.jsx)(D.Content,{size:`sm`,hideCloseButton:!0,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault();let t=u.current;t&&(t.focus(),requestAnimationFrame(()=>{t.setSelectionRange(0,t.value.length)}))},onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),c||o()},children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h&&s(p)},children:[(0,Z.jsx)(D.Header,{children:(0,Z.jsx)(D.Title,{children:e})}),(0,Z.jsx)(D.Body,{children:(0,Z.jsx)(E,{ref:u,label:`Name`,value:d,onChange:e=>f(e.target.value),placeholder:t,errorText:l??(m?`Enter a single file or folder name without slashes.`:void 0),autoComplete:`off`,spellCheck:!1,fullWidth:!0})}),(0,Z.jsxs)(D.Footer,{children:[(0,Z.jsx)(n,{type:`button`,variant:`outlined`,onClick:o,disabled:c,children:`Cancel`}),(0,Z.jsx)(n,{type:`submit`,variant:`primary`,disabled:!h,children:c?i:r})]})]})})})}function Te({assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,onToggleExpand:l,onExpandPath:u,onSelectPath:d,onToggleShowHidden:f,onChangeSortMode:p,onPathDeleted:m,onPathRenamed:h}){let v=i(),[y,b]=(0,X.useState)(``),x=y.trim().toLowerCase(),[S,C]=(0,X.useState)(!1),[T,D]=(0,X.useState)(null),[k,A]=(0,X.useState)(null),M=(0,X.useCallback)(()=>{D(null),A(null)},[]),{data:P,isLoading:F}=a($({path:{assistant_id:e},query:{showHidden:s,includeDirSizes:c===`size`}})),L=(0,X.useMemo)(()=>be(P?.entries??[],c),[P?.entries,c]),R=(0,X.useCallback)(()=>{for(let e of[`assistantsWorkspaceTreeRetrieve`,`assistantsWorkspaceFileRetrieve`,`assistantsWorkspaceFileContentRetrieve`])v.invalidateQueries({queryKey:[e]})},[v]),z=o({mutationFn:async t=>{let n=t.parentPath?`${t.parentPath}/${t.name}`:t.name;await xe(e,t.parentPath,t.name);let{error:r,response:i}=t.kind===`file`?await ee({path:{assistant_id:e},body:{path:n,content:``,encoding:`utf8`},throwOnError:!1}):await I({path:{assistant_id:e},body:{path:n},throwOnError:!1});if(r||!i?.ok)throw Error(typeof r==`string`?r:`Failed to create — check the name and try again.`);return{...t,path:n}},onSuccess:e=>{M(),R(),e.parentPath&&u(e.parentPath),e.kind===`file`?d(e.path):u(e.path)},onError:e=>{A(e instanceof Error?e.message:`Failed to create.`)}}),B=o({mutationFn:async t=>{let n=t.oldPath.lastIndexOf(`/`),r=n===-1?``:t.oldPath.slice(0,n),i=t.oldPath.slice(n+1),a=r?`${r}/${t.newName}`:t.newName;await xe(e,r,t.newName,i);let{error:o,response:s}=await j({path:{assistant_id:e},body:{oldPath:t.oldPath,newPath:a},throwOnError:!1});if(o||!s?.ok)throw Error(typeof o==`string`?o:`Failed to rename — check the name and try again.`);return{oldPath:t.oldPath,newPath:a}},onSuccess:({oldPath:e,newPath:t})=>{M(),R(),h(e,t)},onError:e=>{A(e instanceof Error?e.message:`Failed to rename.`)}}),V=(0,X.useCallback)(e=>{A(null),D({type:`create`,...e})},[]),te=(0,X.useCallback)(e=>{A(null),D({type:`rename`,path:e.path,name:e.name})},[]),[H,U]=(0,X.useState)(null),W=o({mutationFn:async t=>{let{error:n,response:r}=await N({path:{assistant_id:e},body:{path:t.path},throwOnError:!1});if(n||!r?.ok)throw Error(typeof n==`string`?n:`Failed to delete — try again.`);return t},onSuccess:e=>{U(null),R(),m(e.path)}}),re=(0,X.useCallback)(e=>{W.reset(),U(e)},[W]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-secondary)`},children:`Files`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:c===`size`?(0,Z.jsx)(oe,{"aria-hidden":!0}):(0,Z.jsx)(ae,{"aria-hidden":!0}),onClick:()=>p(c===`size`?`name`:`size`),"aria-label":c===`size`?`Sort by name`:`Sort by size`,title:c===`size`?`Sorted by size — switch to name`:`Sorted by name — switch to size`,tintColor:c===`size`?`var(--content-default)`:`var(--content-tertiary)`}),(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:s?(0,Z.jsx)(_,{"aria-hidden":!0}):(0,Z.jsx)(g,{"aria-hidden":!0}),onClick:f,"aria-label":s?`Hide hidden files`:`Show hidden files`,title:s?`Hide hidden files`:`Show hidden files`,tintColor:s?`var(--content-default)`:`var(--content-tertiary)`}),(0,Z.jsx)(Ee,{open:S,onOpenChange:C,onSelectKind:e=>{C(!1),V({kind:e,parentPath:``})}})]})]}),(0,Z.jsx)(`div`,{className:`px-3 py-2`,children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(E,{type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Search files`,leftIcon:(0,Z.jsx)(ne,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,spellCheck:!1,autoComplete:`off`}),y&&(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(w,{"aria-hidden":!0}),onClick:()=>b(``),"aria-label":`Clear search`,className:`absolute right-1.5 top-1/2 -translate-y-1/2`,tintColor:`var(--content-tertiary)`})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:F?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`,style:{color:`var(--content-tertiary)`}})}):L.length?L.map(n=>(0,Z.jsx)(Ce,{entry:n,assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,searchLower:x,onToggleExpand:l,onSelectPath:d,onRequestDelete:re,onRequestRename:te,onRequestCreate:V,depth:0},n.path)):(0,Z.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files found`})}),T?.type===`create`&&(0,Z.jsx)(we,{title:T.kind===`file`?`New File`:`New Folder`,placeholder:T.kind===`file`?`filename.md`:`folder-name`,confirmLabel:`Create`,pendingLabel:`Creating…`,onCancel:M,onConfirm:e=>{A(null),z.mutate({kind:T.kind,parentPath:T.parentPath,name:e})},pending:z.isPending,error:k},`create-${T.kind}-${T.parentPath}`),T?.type===`rename`&&(0,Z.jsx)(we,{title:`Rename`,placeholder:T.name,confirmLabel:`Rename`,pendingLabel:`Renaming…`,initialName:T.name,onCancel:M,onConfirm:e=>{if(e===T.name){M();return}A(null),B.mutate({oldPath:T.path,newName:e})},pending:B.isPending,error:k},`rename-${T.path}`),(0,Z.jsx)(O,{open:H!==null,title:H?.isDirectory?`Delete Folder`:`Delete File`,message:(0,Z.jsxs)(Z.Fragment,{children:[`Are you sure you want to delete`,` `,(0,Z.jsx)(`span`,{style:{color:`var(--content-default)`},children:H?.name}),H?.isDirectory?` and all of its contents`:``,`? This cannot be undone.`,W.error&&(0,Z.jsx)(`span`,{className:`mt-2 block`,style:{color:`var(--system-negative-strong)`},children:W.error.message})]}),confirmLabel:W.isPending?`Deleting…`:`Delete`,destructive:!0,isPending:W.isPending,onConfirm:()=>{H&&W.mutate(H)},onCancel:()=>U(null)})]})}function Ee({open:e,onOpenChange:t,onSelectKind:r}){return z()?(0,Z.jsxs)(d.Root,{open:e,onOpenChange:t,children:[(0,Z.jsx)(d.Trigger,{asChild:!0,children:(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(C,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Z.jsxs)(d.Content,{children:[(0,Z.jsx)(d.Header,{className:`sr-only`,children:(0,Z.jsx)(d.Title,{children:`Create new`})}),(0,Z.jsxs)(d.Body,{className:`pt-0`,children:[(0,Z.jsx)(p,{icon:U,label:`New File`,onSelect:()=>r(`file`)}),(0,Z.jsx)(p,{icon:Y,label:`New Folder`,onSelect:()=>r(`folder`)})]})]})]}):(0,Z.jsxs)(m.Root,{open:e,onOpenChange:t,children:[(0,Z.jsx)(m.Trigger,{asChild:!0,children:(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(C,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Z.jsxs)(m.Content,{align:`end`,sideOffset:4,children:[(0,Z.jsx)(m.Item,{leftIcon:(0,Z.jsx)(U,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`file`),children:`New File`}),(0,Z.jsx)(m.Item,{leftIcon:(0,Z.jsx)(Y,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`folder`),children:`New Folder`})]})]})}function De(e){let t=e.split(`/`),n=new Set;for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`));return n}function Oe({assistantId:e}){let[t,n]=r(),[i,a]=(0,X.useState)(()=>{let e=t.get(`file`);return e?De(e):new Set}),[o,s]=(0,X.useState)(()=>t.get(`file`)),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(()=>t.get(`sort`)===`size`?`size`:`name`),[f,p]=(0,X.useState)(`preview`);(0,X.useEffect)(()=>{t.get(`file`)&&n(e=>{let t=new URLSearchParams(e);return t.delete(`file`),t},{replace:!0})},[]);let m=(0,X.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=(0,X.useCallback)(e=>{a(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),[g,_]=(0,X.useState)(!1),v=(0,X.useCallback)(e=>{s(e),_(!1)},[]),[y,b]=(0,X.useState)(null),x=(0,X.useCallback)(e=>{let t=t=>t===e||t.startsWith(`${e}/`);s(e=>e!==null&&t(e)?null:e),a(e=>{let n=new Set([...e].filter(e=>!t(e)));return n.size===e.size?e:n}),b({path:e})},[]),[S,C]=(0,X.useState)(null),w={assistantId:e,expandedPaths:i,selectedPath:o,showHidden:c,sortMode:u,onToggleExpand:m,onExpandPath:h,onSelectPath:v,onToggleShowHidden:()=>l(e=>!e),onChangeSortMode:d,onPathDeleted:x,onPathRenamed:(0,X.useCallback)((e,t)=>{let n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;s(e=>e===null?e:n(e)),a(e=>{let t=!1,r=new Set;for(let i of e){let e=n(i);e!==i&&(t=!0),r.add(e)}return t?r:e}),C({from:e,to:t})},[])};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,Z.jsx)(W,{onClick:()=>_(!0)})}),(0,Z.jsx)(re,{open:g,onClose:()=>_(!1),title:`Files`,children:(0,Z.jsx)(Te,{...w})}),(0,Z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-4 sm:grid-cols-[320px_1fr]`,children:[(0,Z.jsx)(`div`,{className:`hidden min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border sm:flex`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Z.jsx)(Te,{...w})}),(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Z.jsx)(ye,{assistantId:e,selectedPath:o,showHidden:c,viewMode:f,onChangeViewMode:p,onBrowse:()=>_(!0),pathRename:S,pathDelete:y})})]})]})}function ke(){return(0,Z.jsx)(Oe,{assistantId:B()})}export{ke as WorkspacePage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{m as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./queryOptions-BtNi-_9H.js";import{t as l}from"./createLucideIcon-Bjb-Kuq7.js";import{t as u}from"./chevron-down-DpYf9Gwq.js";import{n as d,r as f,t as p}from"./panel-item-D1WbMkez.js";import{t as m}from"./menu-DSB0wFjY.js";import{t as h}from"./download-B6XjnEzx.js";import{t as g}from"./eye-off-BQ9J3pF2.js";import{t as _}from"./eye-C2rSrbD-.js";import{t as v}from"./file-text-DA128T4K.js";import{t as y}from"./file-C8pjlmtk.js";import{t as b}from"./folder-open-7DKBH5WB.js";import{t as x}from"./loader-circle-Ck8fq3yv.js";import{t as S}from"./pencil-CsnkG5VN.js";import{t as C}from"./plus-DZZypDUF.js";import{t as w}from"./x-CswtfvgS.js";import{O as T}from"./src-BT0gNVcT.js";import{t as E}from"./input-D3MhHg0d.js";import{t as D}from"./modal-D_Y2RPD5.js";import{t as O}from"./confirm-dialog-DxBl6zcI.js";import{n as k,t as A}from"./file-markdown-BCMtcYze.js";import{Br as j,Hr as M,Ir as N,Lr as P,Rr as F,Ur as ee,zr as I}from"./sdk.gen-BR-xXIZm.js";import{n as L}from"./native-file-CKFw72Il.js";import{Cs as R,Ha as z,J as B,Ro as V,Vo as te,Zo as ne,bs as H,ws as U}from"./index-Ck1SrvnM.js";import{n as W,t as re}from"./mobile-sidebar-drawer-CZXirrGr.js";import{i as G,n as ie,r as K,t as q}from"./file-editor-BdFicqX_.js";import{t as J}from"./format-file-size-B9DWgk-8.js";var ae=l(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),oe=l(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),Y=l(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),X=e(t(),1);async function se(e){let{data:t,error:n}=await P({path:{assistant_id:e.assistantId},query:{path:e.path,...e.showHidden?{showHidden:`true`}:{}},parseAs:`blob`,throwOnError:!1});if(n||!(t instanceof Blob))throw Error(`Failed to download file`);await L(t,e.filename)}function ce(e){if(!e)return``;let t=e.indexOf(`;`);return(t===-1?e:e.slice(0,t)).trim()}function le(e,t){return ce(t)===`application/json`?!0:(e??``).toLowerCase().endsWith(`.json`)}function ue(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function de(e){return e.split(`/`).some(e=>e.startsWith(`.`))}var Z=s();function fe(e){let{assistantId:t,path:n,name:r,showHidden:i}=e,[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1);return{isDownloading:a,error:s,download:(0,X.useCallback)(async()=>{c(!1),o(!0);try{await se({assistantId:t,path:n,filename:r,showHidden:i})}catch{c(!0)}finally{o(!1)}},[t,n,r,i])}}function pe({assistantId:e,path:t,name:r,showHidden:i}){let{isDownloading:a,error:o,download:s}=fe({assistantId:e,path:t,name:r,showHidden:i});return(0,Z.jsx)(n,{variant:`ghost`,size:`regular`,iconOnly:a?(0,Z.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(h,{"aria-hidden":!0}),onClick:()=>void s(),disabled:a,"aria-label":`Download ${r}`,tooltip:o?`Download failed. Try again.`:`Download`})}function me(e){return c({queryFn:async()=>{let{data:t,error:n}=await F({path:e.path,query:{path:e.query.path,...e.query.showHidden?{showHidden:`true`}:{}}});if(n)throw n;return t},queryKey:[`assistantsWorkspaceFileRetrieve`,e]})}function he({mimeType:e}){let t=e.indexOf(`;`),n=(t===-1?e:e.slice(0,t)).trim(),r=v;return n.startsWith(`image/`)?r=H:n.startsWith(`video/`)?r=V:!n.startsWith(`text/`)&&n!==`application/json`&&n!==`application/octet-stream`&&(r=y),(0,Z.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 10%, transparent)`},children:(0,Z.jsx)(r,{className:`h-3.5 w-3.5`,style:{color:`var(--content-default)`}})})}function ge({viewMode:e,onChange:t}){return(0,Z.jsx)(`div`,{className:`inline-flex rounded-md p-0.5`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 6%, transparent)`},children:[`preview`,`source`].map(r=>{let i=e===r;return(0,Z.jsx)(n,{variant:`ghost`,onClick:()=>t(r),className:`h-auto rounded border-0 px-2.5 py-1 text-body-small-default hover:bg-transparent`,style:{backgroundColor:i?`var(--surface-lift)`:`transparent`,color:i?`var(--content-default)`:`var(--content-tertiary)`,boxShadow:i?`0 1px 2px rgba(0,0,0,0.15)`:void 0},children:r===`preview`?`Preview`:`Source`},r)})})}function Q({name:e,mimeType:t,size:n,rightContent:r}){return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(he,{mimeType:t}),(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e}),n!=null&&(0,Z.jsx)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:J(n)})]}),r]})}function _e({assistantId:e,path:t,mimeType:n,showHidden:r}){let{data:i,isLoading:o}=a({queryFn:async()=>{let n=await P({path:{assistant_id:e},query:{path:t,...r?{showHidden:`true`}:{}},parseAs:`blob`});if(n.error)throw n.error;return n.data},queryKey:[`assistantsWorkspaceFileContentRetrieve`,{assistantId:e,path:t,showHidden:r}],enabled:!!t}),[s,c]=(0,X.useState)(null);return(0,X.useEffect)(()=>{if(!i)return;let e=URL.createObjectURL(i);return c(e),()=>{URL.revokeObjectURL(e),c(null)}},[i]),o?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Z.jsx)(x,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):s?n.startsWith(`image/`)?(0,Z.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Z.jsx)(`img`,{src:s,alt:t.split(`/`).pop()??`image`,className:`max-h-[70vh] max-w-full rounded object-contain`})}):n.startsWith(`video/`)?(0,Z.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-[70vh] max-w-full rounded`})}):null:null}function ve({assistantId:e,path:t,name:r,mimeType:i,size:a,modifiedAt:o,showHidden:s}){let{isDownloading:c,error:l,download:u}=fe({assistantId:e,path:t,name:r,showHidden:s});return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:r,mimeType:i,size:a}),(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,Z.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border p-6 text-center`,style:{borderColor:`var(--border-base)`,backgroundColor:`var(--surface-lift)`},children:[(0,Z.jsx)(y,{className:`mx-auto h-10 w-10`,style:{color:`var(--content-tertiary)`}}),(0,Z.jsx)(`p`,{className:`mt-3 text-body-medium-default`,style:{color:`var(--content-default)`},children:r}),(0,Z.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:i}),(0,Z.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:J(a,`Unknown size`)}),o&&(0,Z.jsxs)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:[`Modified: `,new Date(o).toLocaleString()]})]}),(0,Z.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:c?(0,Z.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(h,{"aria-hidden":!0}),onClick:u,disabled:c,"aria-label":`Download ${r}`,className:`mt-4`,children:c?`Downloading…`:`Download`}),l&&(0,Z.jsx)(`p`,{className:`mt-2 text-body-small-default`,style:{color:`var(--system-error)`},children:`Download failed. Try again.`})]})})]})}function ye({assistantId:e,selectedPath:t,showHidden:r,viewMode:s,onChangeViewMode:c,onBrowse:l,pathRename:u,pathDelete:d}){let f=i(),{data:p,isLoading:m}=a({...me({path:{assistant_id:e},query:{path:t??``,showHidden:r}}),enabled:!!t}),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(null);(0,X.useEffect)(()=>{if(!u)return;let{from:e,to:t}=u,n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;g(e=>e==null?e:n(e)),v(e=>e==null?e:{...e,path:n(e.path)})},[u]),(0,X.useEffect)(()=>{if(!d)return;let{path:e}=d,t=t=>t===e||t.startsWith(`${e}/`);g(e=>e!=null&&t(e)?null:e),v(e=>e!=null&&t(e.path)?null:e)},[d]);let y=h!=null&&h===t,S=p?.content??``,C=_?.path===t?_.content:S,w=()=>{g(null),v(null)},T=o({mutationFn:async({path:t,content:n})=>{let{error:r,response:i}=await ee({path:{assistant_id:e},body:{path:t,content:n,encoding:`utf8`},throwOnError:!1});if(!i?.ok||r)throw Error(`Failed to save file`)},onSuccess:(e,t)=>{g(e=>e===t.path?null:e),v(e=>e?.path===t.path?null:e),f.invalidateQueries({queryKey:[`assistantsWorkspaceFileRetrieve`]})}}),E=C!==S,D=(0,X.useCallback)(()=>{t&&E&&!T.isPending&&T.mutate({path:t,content:C})},[t,E,T,C]);if(!t)return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view`}),l&&(0,Z.jsx)(n,{type:`button`,onClick:l,leftIcon:(0,Z.jsx)(b,{"aria-hidden":!0}),className:`sm:hidden`,children:`Browse files`})]});if(m)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(x,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})});if(!p)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`File not found`})});let O=p.mimeType??`application/octet-stream`,j=p.name??t.split(`/`).pop()??t,M=k(j,O),N=le(j,O),P=p.content!=null&&!M&&!N,F=t?de(t):!0,I=y&&(0,Z.jsx)(ie,{isDirty:E,isSaving:T.isPending,error:T.isError?`Save failed`:null,onSave:D,onDiscard:w});if(M&&p.content!=null){let e=y?C:p.content;return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,rightContent:(0,Z.jsx)(ge,{viewMode:s,onChange:e=>{y&&w(),c(e)}})}),(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:y,onToggleEdit:()=>y?w():g(t)}),s===`preview`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Z.jsx)(A,{content:e})}):y?(0,Z.jsx)(K,{value:C,onChange:e=>v({path:t,content:e}),onSave:D}):(0,Z.jsx)(G,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}if(N&&p.content!=null){let e=y?C:p.content,n=ue(e);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,rightContent:(0,Z.jsx)(ge,{viewMode:s,onChange:e=>{y&&w(),c(e)}})}),(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:s===`preview`?n:e,downloadContent:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:y,onToggleEdit:()=>y?w():g(t)}),s===`preview`?(0,Z.jsx)(G,{content:n,readOnly:!0,whiteSpace:`pre`}):y?(0,Z.jsx)(K,{value:C,onChange:e=>v({path:t,content:e}),onSave:D}):(0,Z.jsx)(G,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}return P?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,size:p.size}),(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:y?C:p.content??``,fileName:j,mimeType:O,showEdit:!F,isEditing:y,onToggleEdit:()=>y?w():g(t)}),y?(0,Z.jsx)(K,{value:C,onChange:e=>v({path:t,content:e}),onSave:D}):(0,Z.jsx)(G,{content:p.content??``,readOnly:F,onStartEdit:()=>g(t)})]}),I]}):O.startsWith(`image/`)||O.startsWith(`video/`)?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(Q,{name:j,mimeType:O,size:p.size,rightContent:(0,Z.jsx)(pe,{assistantId:e,path:t,name:j,showHidden:r})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,Z.jsx)(_e,{assistantId:e,path:t,mimeType:O,showHidden:r})})]}):(0,Z.jsx)(ve,{assistantId:e,path:t,name:j,mimeType:O,size:p.size,modifiedAt:p.modifiedAt,showHidden:r})}function be(e,t){if(t===`name`)return e;let n=e.slice();return n.sort((e,t)=>{let n=e.size??null,r=t.size??null;return n===null&&r===null?(e.name??``).localeCompare(t.name??``):n===null?1:r===null?-1:n===r?(e.name??``).localeCompare(t.name??``):r-n}),n}function $(e){return c({queryFn:async()=>{let t={};e.query?.path&&(t.path=e.query.path),e.query?.showHidden&&(t.showHidden=`true`),e.query?.includeDirSizes&&(t.includeDirSizes=`true`);let{data:n,error:r}=await M({path:e.path,query:t});if(r)throw r;if(!n)throw Error(`Failed to load workspace tree`);return n},queryKey:[`assistantsWorkspaceTreeRetrieve`,e]})}async function xe(e,t,n,r){let i=n.toLowerCase(),a=r?.toLowerCase(),{data:o}=await M({path:{assistant_id:e},query:t?{path:t}:{}});if(o?.entries?.some(e=>{let t=(e.name??``).toLowerCase();return t===i&&t!==a}))throw Error(`"${n}" already exists here.`)}function Se({entry:e}){return e.type===`directory`?(0,Z.jsx)(R,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`image/`)?(0,Z.jsx)(H,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`video/`)?(0,Z.jsx)(V,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Z.jsx)(v,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}})}function Ce({entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:d,onRequestRename:p,onRequestCreate:m,depth:h}){let g=e.path??``,_=e.name??``,v=e.type===`directory`,y=n.has(g),b=r===g,x=_.startsWith(`.`),C=!de(g),w=v&&(y||s.length>0),{data:E}=a({...$({path:{assistant_id:t},query:{path:g,showHidden:i,includeDirSizes:o===`size`}}),enabled:v&&w}),D=(0,X.useMemo)(()=>be(E?.entries??[],o),[E?.entries,o]),O=s===``||_.toLowerCase().includes(s);if(s!==``&&!v&&!O)return null;let k=(0,Z.jsxs)(`button`,{onClick:()=>{v?c(g):l(g)},className:`flex w-full items-center gap-1.5 px-2 py-1 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{paddingLeft:`${h*14+8}px`,paddingRight:`8px`,color:b?`var(--content-default)`:x?`var(--content-tertiary)`:`var(--content-default)`,backgroundColor:b?`color-mix(in oklab, var(--primary-base) 12%, transparent)`:void 0,opacity:x&&!b?.7:1},children:[v?w?(0,Z.jsx)(u,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Z.jsx)(f,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Z.jsx)(`span`,{className:`h-3 w-3 shrink-0`}),(0,Z.jsx)(Se,{entry:e}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_}),e.size!=null&&(0,Z.jsx)(`span`,{className:`shrink-0 text-label-medium-default tabular-nums`,style:{color:`var(--content-tertiary)`},children:J(e.size)})]});return(0,Z.jsxs)(`div`,{children:[C?(0,Z.jsxs)(T.Root,{children:[(0,Z.jsx)(T.Trigger,{children:k}),(0,Z.jsxs)(T.Content,{children:[v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(U,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`file`,parentPath:g}),children:`New File`}),(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(Y,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`folder`,parentPath:g}),children:`New Folder`}),(0,Z.jsx)(T.Separator,{})]}),(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(te,{className:`h-3.5 w-3.5`}),onSelect:()=>d({path:g,name:_,isDirectory:v}),children:`Delete`}),(0,Z.jsx)(T.Item,{leftIcon:(0,Z.jsx)(S,{className:`h-3.5 w-3.5`}),onSelect:()=>p({path:g,name:_,isDirectory:v}),children:`Rename`})]})]}):k,v&&w&&D.length>0&&(0,Z.jsx)(`div`,{children:D.map(e=>(0,Z.jsx)(Ce,{entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:d,onRequestRename:p,onRequestCreate:m,depth:h+1},e.path))})]})}function we({title:e,placeholder:t,confirmLabel:r,pendingLabel:i,initialName:a,onCancel:o,onConfirm:s,pending:c,error:l}){let u=(0,X.useRef)(null),[d,f]=(0,X.useState)(a??``),p=d.trim(),m=p.length>0&&(/[/\\]/.test(p)||p===`.`||p===`..`),h=p.length>0&&!m&&!c;return(0,Z.jsx)(D.Root,{open:!0,onOpenChange:e=>{!e&&!c&&o()},children:(0,Z.jsx)(D.Content,{size:`sm`,hideCloseButton:!0,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault();let t=u.current;t&&(t.focus(),requestAnimationFrame(()=>{t.setSelectionRange(0,t.value.length)}))},onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),c||o()},children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h&&s(p)},children:[(0,Z.jsx)(D.Header,{children:(0,Z.jsx)(D.Title,{children:e})}),(0,Z.jsx)(D.Body,{children:(0,Z.jsx)(E,{ref:u,label:`Name`,value:d,onChange:e=>f(e.target.value),placeholder:t,errorText:l??(m?`Enter a single file or folder name without slashes.`:void 0),autoComplete:`off`,spellCheck:!1,fullWidth:!0})}),(0,Z.jsxs)(D.Footer,{children:[(0,Z.jsx)(n,{type:`button`,variant:`outlined`,onClick:o,disabled:c,children:`Cancel`}),(0,Z.jsx)(n,{type:`submit`,variant:`primary`,disabled:!h,children:c?i:r})]})]})})})}function Te({assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,onToggleExpand:l,onExpandPath:u,onSelectPath:d,onToggleShowHidden:f,onChangeSortMode:p,onPathDeleted:m,onPathRenamed:h}){let v=i(),[y,b]=(0,X.useState)(``),x=y.trim().toLowerCase(),[S,C]=(0,X.useState)(!1),[T,D]=(0,X.useState)(null),[k,A]=(0,X.useState)(null),M=(0,X.useCallback)(()=>{D(null),A(null)},[]),{data:P,isLoading:F}=a($({path:{assistant_id:e},query:{showHidden:s,includeDirSizes:c===`size`}})),L=(0,X.useMemo)(()=>be(P?.entries??[],c),[P?.entries,c]),R=(0,X.useCallback)(()=>{for(let e of[`assistantsWorkspaceTreeRetrieve`,`assistantsWorkspaceFileRetrieve`,`assistantsWorkspaceFileContentRetrieve`])v.invalidateQueries({queryKey:[e]})},[v]),z=o({mutationFn:async t=>{let n=t.parentPath?`${t.parentPath}/${t.name}`:t.name;await xe(e,t.parentPath,t.name);let{error:r,response:i}=t.kind===`file`?await ee({path:{assistant_id:e},body:{path:n,content:``,encoding:`utf8`},throwOnError:!1}):await I({path:{assistant_id:e},body:{path:n},throwOnError:!1});if(r||!i?.ok)throw Error(typeof r==`string`?r:`Failed to create — check the name and try again.`);return{...t,path:n}},onSuccess:e=>{M(),R(),e.parentPath&&u(e.parentPath),e.kind===`file`?d(e.path):u(e.path)},onError:e=>{A(e instanceof Error?e.message:`Failed to create.`)}}),B=o({mutationFn:async t=>{let n=t.oldPath.lastIndexOf(`/`),r=n===-1?``:t.oldPath.slice(0,n),i=t.oldPath.slice(n+1),a=r?`${r}/${t.newName}`:t.newName;await xe(e,r,t.newName,i);let{error:o,response:s}=await j({path:{assistant_id:e},body:{oldPath:t.oldPath,newPath:a},throwOnError:!1});if(o||!s?.ok)throw Error(typeof o==`string`?o:`Failed to rename — check the name and try again.`);return{oldPath:t.oldPath,newPath:a}},onSuccess:({oldPath:e,newPath:t})=>{M(),R(),h(e,t)},onError:e=>{A(e instanceof Error?e.message:`Failed to rename.`)}}),V=(0,X.useCallback)(e=>{A(null),D({type:`create`,...e})},[]),te=(0,X.useCallback)(e=>{A(null),D({type:`rename`,path:e.path,name:e.name})},[]),[H,U]=(0,X.useState)(null),W=o({mutationFn:async t=>{let{error:n,response:r}=await N({path:{assistant_id:e},body:{path:t.path},throwOnError:!1});if(n||!r?.ok)throw Error(typeof n==`string`?n:`Failed to delete — try again.`);return t},onSuccess:e=>{U(null),R(),m(e.path)}}),re=(0,X.useCallback)(e=>{W.reset(),U(e)},[W]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-secondary)`},children:`Files`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:c===`size`?(0,Z.jsx)(oe,{"aria-hidden":!0}):(0,Z.jsx)(ae,{"aria-hidden":!0}),onClick:()=>p(c===`size`?`name`:`size`),"aria-label":c===`size`?`Sort by name`:`Sort by size`,title:c===`size`?`Sorted by size — switch to name`:`Sorted by name — switch to size`,tintColor:c===`size`?`var(--content-default)`:`var(--content-tertiary)`}),(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:s?(0,Z.jsx)(_,{"aria-hidden":!0}):(0,Z.jsx)(g,{"aria-hidden":!0}),onClick:f,"aria-label":s?`Hide hidden files`:`Show hidden files`,title:s?`Hide hidden files`:`Show hidden files`,tintColor:s?`var(--content-default)`:`var(--content-tertiary)`}),(0,Z.jsx)(Ee,{open:S,onOpenChange:C,onSelectKind:e=>{C(!1),V({kind:e,parentPath:``})}})]})]}),(0,Z.jsx)(`div`,{className:`px-3 py-2`,children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(E,{type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Search files`,leftIcon:(0,Z.jsx)(ne,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,spellCheck:!1,autoComplete:`off`}),y&&(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(w,{"aria-hidden":!0}),onClick:()=>b(``),"aria-label":`Clear search`,className:`absolute right-1.5 top-1/2 -translate-y-1/2`,tintColor:`var(--content-tertiary)`})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:F?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`,style:{color:`var(--content-tertiary)`}})}):L.length?L.map(n=>(0,Z.jsx)(Ce,{entry:n,assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,searchLower:x,onToggleExpand:l,onSelectPath:d,onRequestDelete:re,onRequestRename:te,onRequestCreate:V,depth:0},n.path)):(0,Z.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files found`})}),T?.type===`create`&&(0,Z.jsx)(we,{title:T.kind===`file`?`New File`:`New Folder`,placeholder:T.kind===`file`?`filename.md`:`folder-name`,confirmLabel:`Create`,pendingLabel:`Creating…`,onCancel:M,onConfirm:e=>{A(null),z.mutate({kind:T.kind,parentPath:T.parentPath,name:e})},pending:z.isPending,error:k},`create-${T.kind}-${T.parentPath}`),T?.type===`rename`&&(0,Z.jsx)(we,{title:`Rename`,placeholder:T.name,confirmLabel:`Rename`,pendingLabel:`Renaming…`,initialName:T.name,onCancel:M,onConfirm:e=>{if(e===T.name){M();return}A(null),B.mutate({oldPath:T.path,newName:e})},pending:B.isPending,error:k},`rename-${T.path}`),(0,Z.jsx)(O,{open:H!==null,title:H?.isDirectory?`Delete Folder`:`Delete File`,message:(0,Z.jsxs)(Z.Fragment,{children:[`Are you sure you want to delete`,` `,(0,Z.jsx)(`span`,{style:{color:`var(--content-default)`},children:H?.name}),H?.isDirectory?` and all of its contents`:``,`? This cannot be undone.`,W.error&&(0,Z.jsx)(`span`,{className:`mt-2 block`,style:{color:`var(--system-negative-strong)`},children:W.error.message})]}),confirmLabel:W.isPending?`Deleting…`:`Delete`,destructive:!0,isPending:W.isPending,onConfirm:()=>{H&&W.mutate(H)},onCancel:()=>U(null)})]})}function Ee({open:e,onOpenChange:t,onSelectKind:r}){return z()?(0,Z.jsxs)(d.Root,{open:e,onOpenChange:t,children:[(0,Z.jsx)(d.Trigger,{asChild:!0,children:(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(C,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Z.jsxs)(d.Content,{children:[(0,Z.jsx)(d.Header,{className:`sr-only`,children:(0,Z.jsx)(d.Title,{children:`Create new`})}),(0,Z.jsxs)(d.Body,{className:`pt-0`,children:[(0,Z.jsx)(p,{icon:U,label:`New File`,onSelect:()=>r(`file`)}),(0,Z.jsx)(p,{icon:Y,label:`New Folder`,onSelect:()=>r(`folder`)})]})]})]}):(0,Z.jsxs)(m.Root,{open:e,onOpenChange:t,children:[(0,Z.jsx)(m.Trigger,{asChild:!0,children:(0,Z.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(C,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Z.jsxs)(m.Content,{align:`end`,sideOffset:4,children:[(0,Z.jsx)(m.Item,{leftIcon:(0,Z.jsx)(U,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`file`),children:`New File`}),(0,Z.jsx)(m.Item,{leftIcon:(0,Z.jsx)(Y,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`folder`),children:`New Folder`})]})]})}function De(e){let t=e.split(`/`),n=new Set;for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`));return n}function Oe({assistantId:e}){let[t,n]=r(),[i,a]=(0,X.useState)(()=>{let e=t.get(`file`);return e?De(e):new Set}),[o,s]=(0,X.useState)(()=>t.get(`file`)),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(()=>t.get(`sort`)===`size`?`size`:`name`),[f,p]=(0,X.useState)(`preview`);(0,X.useEffect)(()=>{t.get(`file`)&&n(e=>{let t=new URLSearchParams(e);return t.delete(`file`),t},{replace:!0})},[]);let m=(0,X.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=(0,X.useCallback)(e=>{a(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),[g,_]=(0,X.useState)(!1),v=(0,X.useCallback)(e=>{s(e),_(!1)},[]),[y,b]=(0,X.useState)(null),x=(0,X.useCallback)(e=>{let t=t=>t===e||t.startsWith(`${e}/`);s(e=>e!==null&&t(e)?null:e),a(e=>{let n=new Set([...e].filter(e=>!t(e)));return n.size===e.size?e:n}),b({path:e})},[]),[S,C]=(0,X.useState)(null),w={assistantId:e,expandedPaths:i,selectedPath:o,showHidden:c,sortMode:u,onToggleExpand:m,onExpandPath:h,onSelectPath:v,onToggleShowHidden:()=>l(e=>!e),onChangeSortMode:d,onPathDeleted:x,onPathRenamed:(0,X.useCallback)((e,t)=>{let n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;s(e=>e===null?e:n(e)),a(e=>{let t=!1,r=new Set;for(let i of e){let e=n(i);e!==i&&(t=!0),r.add(e)}return t?r:e}),C({from:e,to:t})},[])};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,Z.jsx)(W,{onClick:()=>_(!0)})}),(0,Z.jsx)(re,{open:g,onClose:()=>_(!1),title:`Files`,children:(0,Z.jsx)(Te,{...w})}),(0,Z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-4 sm:grid-cols-[320px_1fr]`,children:[(0,Z.jsx)(`div`,{className:`hidden min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border sm:flex`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Z.jsx)(Te,{...w})}),(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Z.jsx)(ye,{assistantId:e,selectedPath:o,showHidden:c,viewMode:f,onChangeViewMode:p,onBrowse:()=>_(!0),pathRename:S,pathDelete:y})})]})]})}function ke(){return(0,Z.jsx)(Oe,{assistantId:B()})}export{ke as WorkspacePage};