@vellumai/web 0.10.3-staging.1 → 0.10.3

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 (74) hide show
  1. package/dist/assets/{account-page-BB5Phl5s.js → account-page-CCYCSy2-.js} +1 -1
  2. package/dist/assets/{advanced-page-CMAf1fno.js → advanced-page-CVnT0zH-.js} +1 -1
  3. package/dist/assets/{ai-page-DcOYf6ki.js → ai-page-kEbHR7cH.js} +1 -1
  4. package/dist/assets/{api-key-screen-A7FySG-O.js → api-key-screen-DGVn66y4.js} +1 -1
  5. package/dist/assets/{archive-page-m3yQFOvD.js → archive-page-Dl6HLIJt.js} +1 -1
  6. package/dist/assets/{billing-page-C-JoA25u.js → billing-page-Cq_yLwUC.js} +1 -1
  7. package/dist/assets/{bookmarks-page-Cl2O0te-.js → bookmarks-page-CANlE7hP.js} +1 -1
  8. package/dist/assets/{command-palette-AdQxXi8M.js → command-palette-GZu_zgQg.js} +1 -1
  9. package/dist/assets/{command-palette-window-page-9TqGuzVu.js → command-palette-window-page-CzWu42Ee.js} +1 -1
  10. package/dist/assets/{community-page-DPCIsZX3.js → community-page-Dhgypa-h.js} +1 -1
  11. package/dist/assets/{contacts-page-route-BvCp-gAp.js → contacts-page-route-C3QiOxjO.js} +1 -1
  12. package/dist/assets/{debug-page-CTD3JrfL.js → debug-page-CBozmAQQ.js} +1 -1
  13. package/dist/assets/{deploy-dialogs-C0aZYWkv.js → deploy-dialogs-jf5VL1UP.js} +1 -1
  14. package/dist/assets/{developer-page-Dx6SbGPL.js → developer-page-iEL4eJ8x.js} +1 -1
  15. package/dist/assets/{devices-page-DtqksGFR.js → devices-page-RMaPGcXe.js} +1 -1
  16. package/dist/assets/{dictation-overlay-page-B9zcq9IK.js → dictation-overlay-page-BxQCzLMY.js} +1 -1
  17. package/dist/assets/{document-viewer-page-oeRhq2Yx.js → document-viewer-page-57OuXxYw.js} +1 -1
  18. package/dist/assets/{earn-credits-modal-3vmD9Fug.js → earn-credits-modal-Nm1VymMp.js} +1 -1
  19. package/dist/assets/{emails-page-C_RKF4jL.js → emails-page-0gRZqa6y.js} +1 -1
  20. package/dist/assets/{file-editor-wIYQnMM_.js → file-editor-BNkJJbUv.js} +1 -1
  21. package/dist/assets/{general-page-Bjr3EfG_.js → general-page-aZxTpnpI.js} +1 -1
  22. package/dist/assets/{hatching-screen-OMSxOyvX.js → hatching-screen-KPinlCES.js} +1 -1
  23. package/dist/assets/{home-page-route-BDyODWxN.js → home-page-route-CudtBGg1.js} +1 -1
  24. package/dist/assets/{hosting-screen-dwUA84uS.js → hosting-screen-C14KAJ6m.js} +1 -1
  25. package/dist/assets/{identity-page-route-Ds4SXg6o.js → identity-page-route-C0BFcTAF.js} +1 -1
  26. package/dist/assets/{index-BIDC22lX.js → index-PRnvH2Y1.js} +7 -7
  27. package/dist/assets/{inspect-page-CpIdOQCU.js → inspect-page-CWasyuSO.js} +1 -1
  28. package/dist/assets/{install-b0ONV1om.js → install-C3xe8ARr.js} +1 -1
  29. package/dist/assets/{integrations-page-Dw3rJqPE.js → integrations-page-WhBpTYP2.js} +1 -1
  30. package/dist/assets/{intelligence-layout-DovsSaK4.js → intelligence-layout-CvTumtjv.js} +1 -1
  31. package/dist/assets/{keyboard-shortcuts-page-B2rDCmXw.js → keyboard-shortcuts-page-kiOEZKzE.js} +1 -1
  32. package/dist/assets/{library-detail-page-BfwLhTzc.js → library-detail-page-rPvN9G1a.js} +1 -1
  33. package/dist/assets/{library-page-CKwzimBZ.js → library-page-BHejhapZ.js} +1 -1
  34. package/dist/assets/{login-page-aWGeNMsB.js → login-page-BGLVK82t.js} +1 -1
  35. package/dist/assets/{logout-page-BgczaAe_.js → logout-page-Bl6AD21S.js} +1 -1
  36. package/dist/assets/{logs-layout-Bb4h3S2N.js → logs-layout-C9eUE1Pt.js} +1 -1
  37. package/dist/assets/{memory-router-playground-page-gcwT23uj.js → memory-router-playground-page-Dhi3uqxr.js} +1 -1
  38. package/dist/assets/{mobile-sidebar-drawer-wA5GnkLS.js → mobile-sidebar-drawer-DqXFL0Ke.js} +1 -1
  39. package/dist/assets/{notifications-page-BilxDebz.js → notifications-page-pHiDPA0p.js} +1 -1
  40. package/dist/assets/{oauth-complete-page-CzAcy6Qj.js → oauth-complete-page-DiGMWbOb.js} +1 -1
  41. package/dist/assets/{oauth-popup-complete-page-CvE_74ec.js → oauth-popup-complete-page-CwoZnzdc.js} +1 -1
  42. package/dist/assets/{pairing-page-ddUW7kSm.js → pairing-page-clFaUgzL.js} +1 -1
  43. package/dist/assets/{plugin-detail-page-B-d90SJ8.js → plugin-detail-page-IRPeI4lP.js} +1 -1
  44. package/dist/assets/{plugins-page-tUsEY9_b.js → plugins-page-BaYp2QOe.js} +1 -1
  45. package/dist/assets/{prechat-route-in5c2S6S.js → prechat-route-BaMWiiaf.js} +1 -1
  46. package/dist/assets/{privacy-page-CpYx1RMr.js → privacy-page-BUhxrIRn.js} +1 -1
  47. package/dist/assets/{privacy-screen-Cd4yErpJ.js → privacy-screen-BaHYtKEt.js} +1 -1
  48. package/dist/assets/{provider-callback-page-BCXiAoax.js → provider-callback-page-CxFC4PH1.js} +1 -1
  49. package/dist/assets/{research-mock-page-DfC4Xf4z.js → research-mock-page-ttrrPwo3.js} +1 -1
  50. package/dist/assets/{research-onboarding-route-QentSADF.js → research-onboarding-route-Cxai0fux.js} +1 -1
  51. package/dist/assets/{review-terms-screen-kUBWOFsV.js → review-terms-screen-DEiifDmK.js} +1 -1
  52. package/dist/assets/{select-assistant-screen-DDdKrCaI.js → select-assistant-screen-UoixBMN2.js} +1 -1
  53. package/dist/assets/{settings-layout-CIAca9J9.js → settings-layout-CQ3Z9Raj.js} +1 -1
  54. package/dist/assets/{share-feedback-modal-sqz1cvkl.js → share-feedback-modal-CTwByE7B.js} +1 -1
  55. package/dist/assets/{sidebar-tree-BNLVikyu.js → sidebar-tree-BJkXpCut.js} +1 -1
  56. package/dist/assets/{signup-page-DOYf5rnz.js → signup-page-CKDYl9Wb.js} +1 -1
  57. package/dist/assets/{skills-page-pXRiOYxp.js → skills-page-DVjqqfMw.js} +1 -1
  58. package/dist/assets/{sounds-page-DZjipsnL.js → sounds-page-mens6EAJ.js} +1 -1
  59. package/dist/assets/{step-indicator-dots-D1EQV6VE.js → step-indicator-dots-CEVbsP8r.js} +1 -1
  60. package/dist/assets/{subagent-detail-panel-BhMGv4KW.js → subagent-detail-panel-DVQAkMjF.js} +1 -1
  61. package/dist/assets/{system-events-page-8chSE8WO.js → system-events-page-Dro8iNrx.js} +1 -1
  62. package/dist/assets/{tiptap-document-editor-BIYDH0gu.js → tiptap-document-editor-D2t4qYzv.js} +1 -1
  63. package/dist/assets/{tool-detail-panel-CltEAL4k.js → tool-detail-panel-DRD2DIMF.js} +1 -1
  64. package/dist/assets/{trace-page-Ceqkb39z.js → trace-page-DRWPaAuQ.js} +1 -1
  65. package/dist/assets/{upgrade-cancel-page-BLYBOQhL.js → upgrade-cancel-page-Cwv5eMh9.js} +1 -1
  66. package/dist/assets/{upgrade-success-page-Besx7BnU.js → upgrade-success-page-DnJ8Kyyj.js} +1 -1
  67. package/dist/assets/{usage-page-UvJrF1jZ.js → usage-page-DJHRS0lZ.js} +1 -1
  68. package/dist/assets/{voice-page-B6ocZCAN.js → voice-page-kQZ2ya5j.js} +1 -1
  69. package/dist/assets/{weather-forecast-display-JXZ2NoLx.js → weather-forecast-display-Cu3W6OZF.js} +1 -1
  70. package/dist/assets/{welcome-screen-4_W-iOJc.js → welcome-screen-Bd7PCfAf.js} +1 -1
  71. package/dist/assets/{workflow-detail-panel-BYvRNK8S.js → workflow-detail-panel-CMmPPsuL.js} +1 -1
  72. package/dist/assets/{workspace-page-D6Ak7heg.js → workspace-page-BR4pOxs5.js} +1 -1
  73. package/dist/index.html +1 -1
  74. package/package.json +1 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-DdS6bb-3.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{n as s,t as c}from"./panel-item-nGTDevWP.js";import{t as l}from"./menu-C_97pis4.js";import{t as u}from"./notice-CqRgVmeL.js";import{t as d}from"./popover-CL-JL6vG.js";import{t as f}from"./input-C8kfrq9r.js";import{n as p}from"./toast-2TW5tj1Y.js";import{t as m}from"./createLucideIcon-BlMXrA59.js";import{t as h}from"./bell-DB1SrBre.js";import{t as g}from"./check-D6WkI0gF.js";import{t as _}from"./loader-circle-IIzBGiwm.js";import{t as v}from"./moon-CK8MXzOo.js";import{t as y}from"./triangle-alert-DKOyShqD.js";import{a as b}from"./routes-DVqkwUEe.js";import{n as x}from"./use-is-mobile-Cy10kl9u.js";import{ct as S,dt as C,ft as w,lt as T,mt as E,pt as D,ut as O}from"./react-query.gen-rp6Krcco.js";import{an as k,in as A,rn as j,x as M}from"./index-BIDC22lX.js";import{t as N}from"./mutation-error-CsyN8rYH.js";import{r as P}from"./format-date-CLlHK5gl.js";var F=m(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),I=m(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),L=e(t(),1);function R(e){e.invalidateQueries({queryKey:O()}),e.invalidateQueries({queryKey:E()})}function z(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var B=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],V=o();function H({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(D()),u=x(),[d,f]=(0,L.useState)(!1),p=()=>R(i),m=t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();o.mutate({path:{id:e},body:{snoozed_until:n}},{onSuccess:p,onError:N(`Failed to snooze notification`)})},h=()=>{o.mutate({path:{id:e},body:{snoozed_until:null}},{onSuccess:p,onError:N(`Failed to clear snooze`)})};return u?(0,V.jsxs)(s.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:n}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Snooze until…`})}),(0,V.jsxs)(s.Body,{children:[B.map(({label:e,hours:t})=>(0,V.jsx)(c,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,V.jsx)(c,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,V.jsxs)(l.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(l.Trigger,{children:n}),(0,V.jsxs)(l.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,V.jsx)(l.Label,{children:`Snooze until…`}),B.map(({label:e,hours:t})=>(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>m(t),children:e},e)),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l.Separator,{}),(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>h(),children:`Clear snooze`})]})]})]})}function U({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(C()),l=a(w()),[u,d]=(0,L.useState)(``),p=()=>R(s),m=()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();c.mutate({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}},{onSuccess:e=>{n(e),p(),t()},onError:N(`Failed to pause alerts`)})},h=e=>{l.mutate({path:{rule_id:e}},{onSuccess:()=>{i(e),p(),t()},onError:N(`Failed to resume alerts`)})},g=c.isPending||l.isPending;return(0,V.jsxs)(`div`,{children:[!o&&(0,V.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,V.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,P(e.expires_at)]})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h(e.id),disabled:g,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,V.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(),disabled:g,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,V.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function W({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=z(e),a=!e.is_read;return(0,V.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,V.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,V.jsx)(y,{className:`h-3 w-3`}),`Alert`]}),i&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,V.jsx)(g,{className:`h-3 w-3`}),`Resolved`]})]}),(0,V.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,V.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsxs)(`span`,{children:[`Last seen `,P(e.last_seen_at)]}),e.occurrence_count>1&&(0,V.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(g,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,V.jsx)(H,{notificationId:e.id,currentlySnoozed:i,children:(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function G(){let e=k({platformHostedOnly:!0}),t=j(),o=A(),c=r(),l=x(),[f,m]=(0,L.useState)(`open`),[g,v]=(0,L.useState)(!1),[y,C]=(0,L.useState)([]),{data:w,isLoading:E,isError:D,refetch:O}=i({...T({query:{status:f}}),enabled:e===`full`&&t}),N=e===`full`&&o||(t?E:!1);(0,L.useEffect)(()=>{!t&&g&&v(!1)},[t,g]);let P=t?D:!1,z=t?w?.results??[]:[],B=z.filter(e=>!e.is_read&&!e.is_resolved),H=a(S()),[G,K]=(0,L.useState)(new Set),[q,J]=(0,L.useState)(!1),Y=(0,L.useCallback)(()=>R(c),[c]),X=async(e,t)=>{K(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),Y()}catch(e){p.error(e instanceof Error?e.message:`Failed to update notification`)}finally{K(t=>{let n=new Set(t);return n.delete(e),n})}},Z=async()=>{if(!(B.length===0||q)){J(!0);try{await Promise.allSettled(B.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{Y(),J(!1)}}},Q=(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,V.jsx)(F,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),$=(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,V.jsx)(n,{replace:!0,to:b.settings.general}):e===`disabled`?(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,V.jsx)(M,{children:`Log in to the Vellum platform to view notifications.`})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(l?(0,V.jsxs)(s.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:Q}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Pause alerts`})}),(0,V.jsx)(s.Body,{children:(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,V.jsxs)(d.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(d.Trigger,{asChild:!0,children:Q}),(0,V.jsx)(d.Content,{align:`end`,className:`w-72`,children:$})]}))]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&B.length>1&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>void Z(),disabled:q,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[q?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(I,{className:`h-3 w-3`}),`Mark all as read (`,B.length,`)`]})]}),N?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,V.jsx)(_,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):P?(0,V.jsxs)(u,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,V.jsx)(`button`,{type:`button`,onClick:()=>void O(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):z.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,V.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,V.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,V.jsx)(`div`,{className:`space-y-3`,children:z.map(e=>(0,V.jsx)(W,{notification:e,onAck:(e,t)=>void X(e,t),isAcking:G.has(e.id)},e.id))})]})}export{G as NotificationsPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-DdS6bb-3.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{n as s,t as c}from"./panel-item-nGTDevWP.js";import{t as l}from"./menu-C_97pis4.js";import{t as u}from"./notice-CqRgVmeL.js";import{t as d}from"./popover-CL-JL6vG.js";import{t as f}from"./input-C8kfrq9r.js";import{n as p}from"./toast-2TW5tj1Y.js";import{t as m}from"./createLucideIcon-BlMXrA59.js";import{t as h}from"./bell-DB1SrBre.js";import{t as g}from"./check-D6WkI0gF.js";import{t as _}from"./loader-circle-IIzBGiwm.js";import{t as v}from"./moon-CK8MXzOo.js";import{t as y}from"./triangle-alert-DKOyShqD.js";import{a as b}from"./routes-DVqkwUEe.js";import{n as x}from"./use-is-mobile-Cy10kl9u.js";import{ct as S,dt as C,ft as w,lt as T,mt as E,pt as D,ut as O}from"./react-query.gen-rp6Krcco.js";import{an as k,in as A,rn as j,x as M}from"./index-PRnvH2Y1.js";import{t as N}from"./mutation-error-CsyN8rYH.js";import{r as P}from"./format-date-CLlHK5gl.js";var F=m(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),I=m(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),L=e(t(),1);function R(e){e.invalidateQueries({queryKey:O()}),e.invalidateQueries({queryKey:E()})}function z(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var B=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],V=o();function H({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(D()),u=x(),[d,f]=(0,L.useState)(!1),p=()=>R(i),m=t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();o.mutate({path:{id:e},body:{snoozed_until:n}},{onSuccess:p,onError:N(`Failed to snooze notification`)})},h=()=>{o.mutate({path:{id:e},body:{snoozed_until:null}},{onSuccess:p,onError:N(`Failed to clear snooze`)})};return u?(0,V.jsxs)(s.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:n}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Snooze until…`})}),(0,V.jsxs)(s.Body,{children:[B.map(({label:e,hours:t})=>(0,V.jsx)(c,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,V.jsx)(c,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,V.jsxs)(l.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(l.Trigger,{children:n}),(0,V.jsxs)(l.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,V.jsx)(l.Label,{children:`Snooze until…`}),B.map(({label:e,hours:t})=>(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>m(t),children:e},e)),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l.Separator,{}),(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>h(),children:`Clear snooze`})]})]})]})}function U({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(C()),l=a(w()),[u,d]=(0,L.useState)(``),p=()=>R(s),m=()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();c.mutate({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}},{onSuccess:e=>{n(e),p(),t()},onError:N(`Failed to pause alerts`)})},h=e=>{l.mutate({path:{rule_id:e}},{onSuccess:()=>{i(e),p(),t()},onError:N(`Failed to resume alerts`)})},g=c.isPending||l.isPending;return(0,V.jsxs)(`div`,{children:[!o&&(0,V.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,V.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,P(e.expires_at)]})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h(e.id),disabled:g,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,V.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(),disabled:g,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,V.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function W({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=z(e),a=!e.is_read;return(0,V.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,V.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,V.jsx)(y,{className:`h-3 w-3`}),`Alert`]}),i&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,V.jsx)(g,{className:`h-3 w-3`}),`Resolved`]})]}),(0,V.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,V.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsxs)(`span`,{children:[`Last seen `,P(e.last_seen_at)]}),e.occurrence_count>1&&(0,V.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(g,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,V.jsx)(H,{notificationId:e.id,currentlySnoozed:i,children:(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function G(){let e=k({platformHostedOnly:!0}),t=j(),o=A(),c=r(),l=x(),[f,m]=(0,L.useState)(`open`),[g,v]=(0,L.useState)(!1),[y,C]=(0,L.useState)([]),{data:w,isLoading:E,isError:D,refetch:O}=i({...T({query:{status:f}}),enabled:e===`full`&&t}),N=e===`full`&&o||(t?E:!1);(0,L.useEffect)(()=>{!t&&g&&v(!1)},[t,g]);let P=t?D:!1,z=t?w?.results??[]:[],B=z.filter(e=>!e.is_read&&!e.is_resolved),H=a(S()),[G,K]=(0,L.useState)(new Set),[q,J]=(0,L.useState)(!1),Y=(0,L.useCallback)(()=>R(c),[c]),X=async(e,t)=>{K(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),Y()}catch(e){p.error(e instanceof Error?e.message:`Failed to update notification`)}finally{K(t=>{let n=new Set(t);return n.delete(e),n})}},Z=async()=>{if(!(B.length===0||q)){J(!0);try{await Promise.allSettled(B.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{Y(),J(!1)}}},Q=(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,V.jsx)(F,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),$=(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,V.jsx)(n,{replace:!0,to:b.settings.general}):e===`disabled`?(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,V.jsx)(M,{children:`Log in to the Vellum platform to view notifications.`})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(l?(0,V.jsxs)(s.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:Q}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Pause alerts`})}),(0,V.jsx)(s.Body,{children:(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,V.jsxs)(d.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(d.Trigger,{asChild:!0,children:Q}),(0,V.jsx)(d.Content,{align:`end`,className:`w-72`,children:$})]}))]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&B.length>1&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>void Z(),disabled:q,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[q?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(I,{className:`h-3 w-3`}),`Mark all as read (`,B.length,`)`]})]}),N?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,V.jsx)(_,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):P?(0,V.jsxs)(u,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,V.jsx)(`button`,{type:`button`,onClick:()=>void O(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):z.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,V.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,V.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,V.jsx)(`div`,{className:`space-y-3`,children:z.map(e=>(0,V.jsx)(W,{notification:e,onAck:(e,t)=>void X(e,t),isAcking:G.has(e.id)},e.id))})]})}export{G as NotificationsPage};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{Et as i}from"./index-BIDC22lX.js";var a=e(t(),1),o=r();function s(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,o.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function c(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var l=`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{Et as i}from"./index-PRnvH2Y1.js";var a=e(t(),1),o=r();function s(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,o.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function c(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var l=`
2
2
  :root {
3
3
  --oauth-surface: #F5F3EB;
4
4
  --oauth-surface-card: #FFFFFF;
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{n as i,r as a}from"./native-deep-link-BYNI6pkW.js";import{Et as o}from"./index-BIDC22lX.js";var s=e(t(),1),c=r();function l(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,c.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function u(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var d=`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{n as i,r as a}from"./native-deep-link-BYNI6pkW.js";import{Et as o}from"./index-PRnvH2Y1.js";var s=e(t(),1),c=r();function l(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,c.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function u(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var d=`
2
2
  :root {
3
3
  --oauth-surface: #F5F3EB;
4
4
  --oauth-surface-card: #FFFFFF;
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{h as a}from"./local-mode-CvrNMtPF.js";import{t as o}from"./circle-alert-DvNg50UK.js";import{t as s}from"./circle-check-DzlJxj_M.js";import{t as c}from"./loader-circle-IIzBGiwm.js";import{a as l,i as u,n as d,o as f,r as p,t as m}from"./return-to-ByvaXBKr.js";import{a as h}from"./routes-DVqkwUEe.js";import{t as g}from"./index-BIDC22lX.js";var _=e(t(),1),v=i();function y(e){switch(e.kind){case`starting`:return{title:`Starting pairing`,body:`Creating a code for this browser.`};case`approved`:return{title:`Connected`,body:`Opening your assistant.`};case`expired`:return{title:`Pairing expired`,body:`Start a new web pairing from the local assistant.`};case`error`:return{title:`Pairing failed`,body:e.message};case`polling`:return{title:`Waiting for approval`,body:`Confirm this code on the machine running your assistant.`}}}function b({state:e}){return e.kind===`approved`?(0,v.jsx)(s,{className:`h-5 w-5 text-green-600`,"aria-hidden":!0}):e.kind===`starting`||e.kind===`polling`?(0,v.jsx)(c,{className:`h-5 w-5 animate-spin text-blue-600`,"aria-hidden":!0}):(0,v.jsx)(o,{className:`h-5 w-5 text-red-600`,"aria-hidden":!0})}function x(){let e=r(),t=n(),i=a(),o=(0,_.useMemo)(()=>m(new URLSearchParams(e.search).get(`returnTo`),h.assistant),[e.search]),s=(0,_.useMemo)(()=>f(`${e.pathname}${e.search}${e.hash}`),[e.pathname,e.search,e.hash]),[c,x]=(0,_.useState)(()=>s.deviceCode?{deviceCode:s.deviceCode,userCode:s.userCode}:null),[S,C]=(0,_.useState)(c?{kind:`polling`,expiresAt:null}:{kind:`starting`});if((0,_.useEffect)(()=>{if(!i||c)return;let e=new AbortController;return(async()=>{try{let t=await u(e.signal);x({deviceCode:t.deviceCode,userCode:t.userCode}),C({kind:`polling`,expiresAt:t.expiresAt})}catch{if(e.signal.aborted)return;C({kind:`error`,message:`The assistant could not start pairing. Refresh the page to try again.`})}})(),()=>{e.abort()}},[i,c]),(0,_.useEffect)(()=>{if(!i||!c?.deviceCode)return;let e=new AbortController,n=null,r=async()=>{try{let i=await l(c.deviceCode,e.signal);if(i.status===`pending`){C({kind:`polling`,expiresAt:i.expiresAt||null}),n=setTimeout(()=>void r(),Math.max(1,i.intervalSeconds)*1e3);return}p(i),C({kind:`approved`}),n=setTimeout(()=>t(o,{replace:!0}),250)}catch(t){if(e.signal.aborted)return;if(t instanceof d&&t.status===401){C({kind:`expired`});return}C({kind:`error`,message:`The assistant could not complete pairing. Try starting a new pairing.`})}};return r(),()=>{e.abort(),n&&clearTimeout(n)}},[i,c?.deviceCode,t,o]),!i)return(0,v.jsx)(g,{});let w=y(S);return(0,v.jsx)(`main`,{className:`flex min-h-svh items-center justify-center bg-[var(--background-default)] px-6 py-10 text-[var(--content-primary)]`,children:(0,v.jsxs)(`section`,{className:`w-full max-w-md rounded-lg border border-[var(--border-default)] bg-[var(--background-surface)] p-8 shadow-sm`,children:[(0,v.jsxs)(`div`,{className:`mb-5 flex items-center gap-3`,children:[(0,v.jsx)(b,{state:S}),(0,v.jsx)(`h1`,{className:`text-xl font-semibold`,children:w.title})]}),c?.userCode?(0,v.jsxs)(`div`,{className:`mb-5 rounded-md border border-[var(--border-subtle)] bg-[var(--background-muted)] p-4 text-center`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium uppercase text-[var(--content-secondary)]`,children:`Pairing code`}),(0,v.jsx)(`div`,{className:`mt-2 font-mono text-3xl font-semibold tracking-[0.18em]`,children:c.userCode})]}):null,(0,v.jsx)(`p`,{className:`text-sm leading-6 text-[var(--content-secondary)]`,children:w.body}),S.kind===`polling`&&S.expiresAt?(0,v.jsxs)(`p`,{className:`mt-4 text-xs text-[var(--content-tertiary)]`,children:[`Expires `,new Date(S.expiresAt).toLocaleTimeString(),`.`]}):null]})})}export{x as RemoteWebPairingPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{h as a}from"./local-mode-CvrNMtPF.js";import{t as o}from"./circle-alert-DvNg50UK.js";import{t as s}from"./circle-check-DzlJxj_M.js";import{t as c}from"./loader-circle-IIzBGiwm.js";import{a as l,i as u,n as d,o as f,r as p,t as m}from"./return-to-ByvaXBKr.js";import{a as h}from"./routes-DVqkwUEe.js";import{t as g}from"./index-PRnvH2Y1.js";var _=e(t(),1),v=i();function y(e){switch(e.kind){case`starting`:return{title:`Starting pairing`,body:`Creating a code for this browser.`};case`approved`:return{title:`Connected`,body:`Opening your assistant.`};case`expired`:return{title:`Pairing expired`,body:`Start a new web pairing from the local assistant.`};case`error`:return{title:`Pairing failed`,body:e.message};case`polling`:return{title:`Waiting for approval`,body:`Confirm this code on the machine running your assistant.`}}}function b({state:e}){return e.kind===`approved`?(0,v.jsx)(s,{className:`h-5 w-5 text-green-600`,"aria-hidden":!0}):e.kind===`starting`||e.kind===`polling`?(0,v.jsx)(c,{className:`h-5 w-5 animate-spin text-blue-600`,"aria-hidden":!0}):(0,v.jsx)(o,{className:`h-5 w-5 text-red-600`,"aria-hidden":!0})}function x(){let e=r(),t=n(),i=a(),o=(0,_.useMemo)(()=>m(new URLSearchParams(e.search).get(`returnTo`),h.assistant),[e.search]),s=(0,_.useMemo)(()=>f(`${e.pathname}${e.search}${e.hash}`),[e.pathname,e.search,e.hash]),[c,x]=(0,_.useState)(()=>s.deviceCode?{deviceCode:s.deviceCode,userCode:s.userCode}:null),[S,C]=(0,_.useState)(c?{kind:`polling`,expiresAt:null}:{kind:`starting`});if((0,_.useEffect)(()=>{if(!i||c)return;let e=new AbortController;return(async()=>{try{let t=await u(e.signal);x({deviceCode:t.deviceCode,userCode:t.userCode}),C({kind:`polling`,expiresAt:t.expiresAt})}catch{if(e.signal.aborted)return;C({kind:`error`,message:`The assistant could not start pairing. Refresh the page to try again.`})}})(),()=>{e.abort()}},[i,c]),(0,_.useEffect)(()=>{if(!i||!c?.deviceCode)return;let e=new AbortController,n=null,r=async()=>{try{let i=await l(c.deviceCode,e.signal);if(i.status===`pending`){C({kind:`polling`,expiresAt:i.expiresAt||null}),n=setTimeout(()=>void r(),Math.max(1,i.intervalSeconds)*1e3);return}p(i),C({kind:`approved`}),n=setTimeout(()=>t(o,{replace:!0}),250)}catch(t){if(e.signal.aborted)return;if(t instanceof d&&t.status===401){C({kind:`expired`});return}C({kind:`error`,message:`The assistant could not complete pairing. Try starting a new pairing.`})}};return r(),()=>{e.abort(),n&&clearTimeout(n)}},[i,c?.deviceCode,t,o]),!i)return(0,v.jsx)(g,{});let w=y(S);return(0,v.jsx)(`main`,{className:`flex min-h-svh items-center justify-center bg-[var(--background-default)] px-6 py-10 text-[var(--content-primary)]`,children:(0,v.jsxs)(`section`,{className:`w-full max-w-md rounded-lg border border-[var(--border-default)] bg-[var(--background-surface)] p-8 shadow-sm`,children:[(0,v.jsxs)(`div`,{className:`mb-5 flex items-center gap-3`,children:[(0,v.jsx)(b,{state:S}),(0,v.jsx)(`h1`,{className:`text-xl font-semibold`,children:w.title})]}),c?.userCode?(0,v.jsxs)(`div`,{className:`mb-5 rounded-md border border-[var(--border-subtle)] bg-[var(--background-muted)] p-4 text-center`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium uppercase text-[var(--content-secondary)]`,children:`Pairing code`}),(0,v.jsx)(`div`,{className:`mt-2 font-mono text-3xl font-semibold tracking-[0.18em]`,children:c.userCode})]}):null,(0,v.jsx)(`p`,{className:`text-sm leading-6 text-[var(--content-secondary)]`,children:w.body}),S.kind===`polling`&&S.expiresAt?(0,v.jsxs)(`p`,{className:`mt-4 text-xs text-[var(--content-tertiary)]`,children:[`Expires `,new Date(S.expiresAt).toLocaleTimeString(),`.`]}):null]})})}export{x as RemoteWebPairingPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,p as i,r as a,t as o}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./card-BibIM9x3.js";import"./src-CK6bncSg.js";import{t as d}from"./confirm-dialog-CfOXCE1N.js";import{n as f}from"./toast-2TW5tj1Y.js";import{t as p}from"./arrow-left-CP-EhDNF.js";import{t as m}from"./external-link-DPAtkBJ2.js";import{t as h}from"./loader-circle-IIzBGiwm.js";import{t as g}from"./triangle-alert-DKOyShqD.js";import{$ as _,Ht as v,Q as y,Ut as b,Wt as x,it as S,nt as C,tt as w}from"./react-query.gen-CQLyoqYk.js";import{a as T}from"./routes-DVqkwUEe.js";import{t as E}from"./assistant-feature-flag-store-Dl92XRsM.js";import{Fi as D,Ir as O,L as k,Qi as A,ia as j}from"./index-BIDC22lX.js";import{t as M}from"./use-active-assistant-id-C-RHQ9f6.js";import{n as N,r as P,t as F}from"./use-plugin-drift-Bj693x0f.js";var I=e(t(),1),L=l();function R(e){return e?e.slice(0,7):`unknown`}function z(){let e=E.use.hasHydrated(),t=E.use.externalPlugins(),l=M(),{name:m}=i(),h=r(),g=s(),[D,O]=(0,I.useState)(!1),[A,j]=(0,I.useState)(!1),P=c({...y({path:{assistant_id:l,name:m??``}}),enabled:!!l&&!!m}),z=P.data?.installed??!1,G=N({assistantId:l,name:m??``,enabled:z}).data,K=(0,I.useCallback)(()=>{g.invalidateQueries({queryKey:C({path:{assistant_id:l}})}),g.invalidateQueries({queryKey:S({path:{assistant_id:l}})}),m&&(g.invalidateQueries({queryKey:_({path:{assistant_id:l,name:m}})}),g.invalidateQueries({queryKey:w({path:{assistant_id:l,name:m}})}))},[l,m,g]),q=x({onSuccess:()=>{K(),f.success(`Installed ${m??`plugin`}`)}}),J=v({onSuccess:()=>{K(),h(T.plugins)}}),Y=b({onSuccess:e=>{K(),f.success(e.outcome===`already-up-to-date`?`${m??`Plugin`} is already up to date`:`Upgraded ${m??`plugin`} to ${R(e.toCommit)}`)}});if(!e)return null;if(!t)return(0,L.jsx)(a,{to:T.identity,replace:!0});if(!m)return(0,L.jsx)(a,{to:T.plugins,replace:!0});let X=()=>{q.mutate({path:{assistant_id:l},body:{name:m}})},Z=()=>{O(!1),J.mutate({path:{assistant_id:l,name:m}})},Q=()=>{Y.mutate({path:{assistant_id:l,name:m},body:{}})},ee=()=>{if(F(G)){j(!0);return}Q()},te=()=>{j(!1),Q()},$=P.data??null;return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,L.jsx)(n,{asChild:!0,variant:`ghost`,children:(0,L.jsx)(o,{to:T.plugins,"aria-label":`Back to plugins`,children:(0,L.jsx)(p,{"aria-hidden":!0})})}),(0,L.jsx)(B,{name:m,plugin:$,drift:G,onInstall:X,onRemove:()=>O(!0),onUpgrade:ee,isInstalling:q.isPending,isRemoving:J.isPending,isUpgrading:Y.isPending})]}),(q.isError||J.isError||Y.isError)&&(0,L.jsx)(W,{message:q.isError?`Failed to install plugin. Please try again.`:J.isError?`Failed to remove plugin. Please try again.`:`Failed to upgrade plugin. Please try again.`}),(0,L.jsx)(u.Root,{asChild:!0,children:(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:P.isLoading?(0,L.jsx)(H,{}):P.isError||!$?(0,L.jsx)(U,{}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(V,{plugin:$}),$.readme?(0,L.jsx)(k,{content:$.readme}):(0,L.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})}),(0,L.jsx)(d,{open:D,title:`Remove plugin`,message:`Remove "${$?.name??m}" from this assistant?`,confirmLabel:`Remove`,destructive:!0,onConfirm:Z,onCancel:()=>O(!1)}),(0,L.jsx)(d,{open:A,title:`Upgrade plugin`,message:`"${$?.name??m}" has local edits that will be overwritten by the upgrade. Continue?`,confirmLabel:`Upgrade anyway`,destructive:!0,onConfirm:te,onCancel:()=>j(!1)})]})}function B({name:e,plugin:t,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l}){let u=t?.installed??!1,d=t?.source?.kind===`github`,f=t?.artifact??null,p=r?.status===`update-available`,m=p?`Upgrade ${R(r?.local?.commit??null)} \u2192 ${R(r?.remote?.commit??null)}`:void 0;return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:d?`📦`:`🧩`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsx)(`h2`,{className:`truncate text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,L.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,d?(0,L.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-tertiary)`},children:`external`}):null,p?(0,L.jsx)(P,{}):null]}),t?.description?(0,L.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?u?(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[f?(0,L.jsx)(n,{asChild:!0,leftIcon:(0,L.jsx)(D,{"aria-hidden":!0}),children:(0,L.jsx)(`a`,{href:f.url,download:!0,children:f.label??`Download`})}):null,p?(0,L.jsx)(n,{type:`button`,onClick:o,disabled:l,title:m,leftIcon:l?(0,L.jsx)(h,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(A,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,L.jsx)(n,{type:`button`,variant:`dangerOutline`,onClick:a,disabled:c,leftIcon:c?(0,L.jsx)(h,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(O,{"aria-hidden":!0}),children:`Remove`})]}):(0,L.jsx)(n,{type:`button`,onClick:i,disabled:s,leftIcon:s?(0,L.jsx)(h,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(j,{"aria-hidden":!0}),children:`Install`}):null]})}function V({plugin:e}){let t=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&t.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&t.push({label:`License`,value:e.license}),(0,L.jsx)(`dl`,{className:`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,style:{borderColor:`var(--border-base)`},children:t.map(e=>(0,L.jsxs)(`div`,{className:`contents`,children:[(0,L.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,L.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,L.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,L.jsx)(m,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function H(){return(0,L.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,L.jsx)(h,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function U(){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,L.jsx)(g,{className:`h-6 w-6`,"aria-hidden":!0}),(0,L.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,L.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function W({message:e}){return(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,L.jsx)(g,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),e]})}export{z as PluginDetailPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,p as i,r as a,t as o}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./card-BibIM9x3.js";import"./src-CK6bncSg.js";import{t as d}from"./confirm-dialog-CfOXCE1N.js";import{n as f}from"./toast-2TW5tj1Y.js";import{t as p}from"./arrow-left-CP-EhDNF.js";import{t as m}from"./external-link-DPAtkBJ2.js";import{t as h}from"./loader-circle-IIzBGiwm.js";import{t as g}from"./triangle-alert-DKOyShqD.js";import{$ as _,Ht as v,Q as y,Ut as b,Wt as x,it as S,nt as C,tt as w}from"./react-query.gen-CQLyoqYk.js";import{a as T}from"./routes-DVqkwUEe.js";import{t as E}from"./assistant-feature-flag-store-Dl92XRsM.js";import{Fi as D,Ir as O,L as k,Qi as A,ia as j}from"./index-PRnvH2Y1.js";import{t as M}from"./use-active-assistant-id-C-RHQ9f6.js";import{n as N,r as P,t as F}from"./use-plugin-drift-Bj693x0f.js";var I=e(t(),1),L=l();function R(e){return e?e.slice(0,7):`unknown`}function z(){let e=E.use.hasHydrated(),t=E.use.externalPlugins(),l=M(),{name:m}=i(),h=r(),g=s(),[D,O]=(0,I.useState)(!1),[A,j]=(0,I.useState)(!1),P=c({...y({path:{assistant_id:l,name:m??``}}),enabled:!!l&&!!m}),z=P.data?.installed??!1,G=N({assistantId:l,name:m??``,enabled:z}).data,K=(0,I.useCallback)(()=>{g.invalidateQueries({queryKey:C({path:{assistant_id:l}})}),g.invalidateQueries({queryKey:S({path:{assistant_id:l}})}),m&&(g.invalidateQueries({queryKey:_({path:{assistant_id:l,name:m}})}),g.invalidateQueries({queryKey:w({path:{assistant_id:l,name:m}})}))},[l,m,g]),q=x({onSuccess:()=>{K(),f.success(`Installed ${m??`plugin`}`)}}),J=v({onSuccess:()=>{K(),h(T.plugins)}}),Y=b({onSuccess:e=>{K(),f.success(e.outcome===`already-up-to-date`?`${m??`Plugin`} is already up to date`:`Upgraded ${m??`plugin`} to ${R(e.toCommit)}`)}});if(!e)return null;if(!t)return(0,L.jsx)(a,{to:T.identity,replace:!0});if(!m)return(0,L.jsx)(a,{to:T.plugins,replace:!0});let X=()=>{q.mutate({path:{assistant_id:l},body:{name:m}})},Z=()=>{O(!1),J.mutate({path:{assistant_id:l,name:m}})},Q=()=>{Y.mutate({path:{assistant_id:l,name:m},body:{}})},ee=()=>{if(F(G)){j(!0);return}Q()},te=()=>{j(!1),Q()},$=P.data??null;return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,L.jsx)(n,{asChild:!0,variant:`ghost`,children:(0,L.jsx)(o,{to:T.plugins,"aria-label":`Back to plugins`,children:(0,L.jsx)(p,{"aria-hidden":!0})})}),(0,L.jsx)(B,{name:m,plugin:$,drift:G,onInstall:X,onRemove:()=>O(!0),onUpgrade:ee,isInstalling:q.isPending,isRemoving:J.isPending,isUpgrading:Y.isPending})]}),(q.isError||J.isError||Y.isError)&&(0,L.jsx)(W,{message:q.isError?`Failed to install plugin. Please try again.`:J.isError?`Failed to remove plugin. Please try again.`:`Failed to upgrade plugin. Please try again.`}),(0,L.jsx)(u.Root,{asChild:!0,children:(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:P.isLoading?(0,L.jsx)(H,{}):P.isError||!$?(0,L.jsx)(U,{}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(V,{plugin:$}),$.readme?(0,L.jsx)(k,{content:$.readme}):(0,L.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})}),(0,L.jsx)(d,{open:D,title:`Remove plugin`,message:`Remove "${$?.name??m}" from this assistant?`,confirmLabel:`Remove`,destructive:!0,onConfirm:Z,onCancel:()=>O(!1)}),(0,L.jsx)(d,{open:A,title:`Upgrade plugin`,message:`"${$?.name??m}" has local edits that will be overwritten by the upgrade. Continue?`,confirmLabel:`Upgrade anyway`,destructive:!0,onConfirm:te,onCancel:()=>j(!1)})]})}function B({name:e,plugin:t,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l}){let u=t?.installed??!1,d=t?.source?.kind===`github`,f=t?.artifact??null,p=r?.status===`update-available`,m=p?`Upgrade ${R(r?.local?.commit??null)} \u2192 ${R(r?.remote?.commit??null)}`:void 0;return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:d?`📦`:`🧩`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsx)(`h2`,{className:`truncate text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,L.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,d?(0,L.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-tertiary)`},children:`external`}):null,p?(0,L.jsx)(P,{}):null]}),t?.description?(0,L.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?u?(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[f?(0,L.jsx)(n,{asChild:!0,leftIcon:(0,L.jsx)(D,{"aria-hidden":!0}),children:(0,L.jsx)(`a`,{href:f.url,download:!0,children:f.label??`Download`})}):null,p?(0,L.jsx)(n,{type:`button`,onClick:o,disabled:l,title:m,leftIcon:l?(0,L.jsx)(h,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(A,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,L.jsx)(n,{type:`button`,variant:`dangerOutline`,onClick:a,disabled:c,leftIcon:c?(0,L.jsx)(h,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(O,{"aria-hidden":!0}),children:`Remove`})]}):(0,L.jsx)(n,{type:`button`,onClick:i,disabled:s,leftIcon:s?(0,L.jsx)(h,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(j,{"aria-hidden":!0}),children:`Install`}):null]})}function V({plugin:e}){let t=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&t.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&t.push({label:`License`,value:e.license}),(0,L.jsx)(`dl`,{className:`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,style:{borderColor:`var(--border-base)`},children:t.map(e=>(0,L.jsxs)(`div`,{className:`contents`,children:[(0,L.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,L.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,L.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,L.jsx)(m,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function H(){return(0,L.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,L.jsx)(h,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function U(){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,L.jsx)(g,{className:`h-6 w-6`,"aria-hidden":!0}),(0,L.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,L.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function W({message:e}){return(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,L.jsx)(g,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),e]})}export{z as PluginDetailPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-BibIM9x3.js";import"./src-CK6bncSg.js";import{t as s}from"./input-C8kfrq9r.js";import{t as c}from"./chevron-right-B6vEpVY0.js";import{t as l}from"./loader-circle-IIzBGiwm.js";import{t as u}from"./triangle-alert-DKOyShqD.js";import{bn as d}from"./sdk.gen-1aYqVbMj.js";import{nt as f,rt as p}from"./react-query.gen-CQLyoqYk.js";import{a as m}from"./routes-DVqkwUEe.js";import{t as h}from"./assistant-feature-flag-store-Dl92XRsM.js";import{$r as g,Jr as _}from"./index-BIDC22lX.js";import{t as v}from"./use-active-assistant-id-C-RHQ9f6.js";import{n as y,r as b}from"./use-plugin-drift-Bj693x0f.js";var x=e(t(),1),S=a();function C({match:e}){return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`📦`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name})}),e.description&&(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.description}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},title:e.path,children:e.path})]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}function w({plugin:e,assistantId:t}){let n=y({assistantId:t,name:e.name}).data?.status===`update-available`;return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`🧩`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),e.version?(0,S.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,n?(0,S.jsx)(b,{}):null]}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,S.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}var T=300*1e3;function E(e,...t){return e?t.some(t=>t?.toLowerCase().includes(e)):!0}function D({assistantId:e}){let[t,n]=(0,x.useState)(``),r=t.trim().toLowerCase(),a=i({queryKey:f({path:{assistant_id:e},query:{q:void 0}}),queryFn:async({signal:t})=>{let n=await d({path:{assistant_id:e},query:{q:void 0},signal:t,throwOnError:!1});if(n.response?.status===404)return{plugins:[]};if(!n.response?.ok)throw Error(`Failed to load plugins`);return n.data??{plugins:[]}},enabled:!!e,staleTime:T}),o=i({...p({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:T}),s=(0,x.useMemo)(()=>O(a.data?.plugins??[]),[a.data?.plugins]),c=(0,x.useMemo)(()=>new Set(s.map(e=>e.name)),[s]),l=(0,x.useMemo)(()=>s.filter(e=>E(r,e.name,e.description)),[s,r]),u=(0,x.useMemo)(()=>(o.data?.matches??[]).filter(e=>!c.has(e.name)&&E(r,e.name,e.description)),[o.data?.matches,c,r]),m=a.isFetching&&!a.isLoading||o.isFetching&&!o.isLoading,h=a.isLoading,g=o.isLoading,_=!h&&!a.isError&&l.length===0,v=!g&&u.length===0;return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(k,{search:t,onSearchChange:n,isSearching:m}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:[(0,S.jsx)(A,{title:`Installed`}),h?(0,S.jsx)(j,{}):a.isError?(0,S.jsx)(P,{}):_?(0,S.jsx)(M,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map(t=>(0,S.jsx)(`li`,{children:(0,S.jsx)(w,{plugin:t,assistantId:e})},t.id))}),(0,S.jsx)(`div`,{className:`mt-6`}),(0,S.jsx)(A,{title:`Available to install`}),g?(0,S.jsx)(j,{}):o.isError?(0,S.jsx)(F,{}):v?(0,S.jsx)(N,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(C,{match:e})},e.path))})]})]})}function O(e){return[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}))}function k({search:e,onSearchChange:t,isSearching:n}){return(0,S.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,S.jsx)(s,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search Plugins`,"aria-label":`Search Plugins`,leftIcon:(0,S.jsx)(_,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:n?(0,S.jsx)(l,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`})})}function A({title:e}){return(0,S.jsx)(`h3`,{className:`mb-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e})}function j(){return(0,S.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,S.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function M({hasQuery:e}){let t=e?`No installed plugins match`:`No Plugins Installed`,n=e?`Try a different search term, or browse the catalog below.`:`Install a plugin with the CLI, or browse the catalog below.`,r=e?_:g;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(r,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function N({hasQuery:e}){let t=e?`No catalog entries match`:`Catalog is empty`,n=e?`Try a different search term, or remove the filter to browse everything.`:`No plugins are currently published in the catalog.`;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(_,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function P(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(u,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function F(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(g,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Couldn't load catalog`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed above.`})]})})}function I(){let e=h.use.hasHydrated(),t=h.use.externalPlugins(),r=v();return e?t?(0,S.jsx)(D,{assistantId:r}):(0,S.jsx)(n,{to:m.identity,replace:!0}):null}export{I as PluginsPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-BibIM9x3.js";import"./src-CK6bncSg.js";import{t as s}from"./input-C8kfrq9r.js";import{t as c}from"./chevron-right-B6vEpVY0.js";import{t as l}from"./loader-circle-IIzBGiwm.js";import{t as u}from"./triangle-alert-DKOyShqD.js";import{bn as d}from"./sdk.gen-1aYqVbMj.js";import{nt as f,rt as p}from"./react-query.gen-CQLyoqYk.js";import{a as m}from"./routes-DVqkwUEe.js";import{t as h}from"./assistant-feature-flag-store-Dl92XRsM.js";import{$r as g,Jr as _}from"./index-PRnvH2Y1.js";import{t as v}from"./use-active-assistant-id-C-RHQ9f6.js";import{n as y,r as b}from"./use-plugin-drift-Bj693x0f.js";var x=e(t(),1),S=a();function C({match:e}){return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`📦`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name})}),e.description&&(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.description}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},title:e.path,children:e.path})]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}function w({plugin:e,assistantId:t}){let n=y({assistantId:t,name:e.name}).data?.status===`update-available`;return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`🧩`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),e.version?(0,S.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,n?(0,S.jsx)(b,{}):null]}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,S.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}var T=300*1e3;function E(e,...t){return e?t.some(t=>t?.toLowerCase().includes(e)):!0}function D({assistantId:e}){let[t,n]=(0,x.useState)(``),r=t.trim().toLowerCase(),a=i({queryKey:f({path:{assistant_id:e},query:{q:void 0}}),queryFn:async({signal:t})=>{let n=await d({path:{assistant_id:e},query:{q:void 0},signal:t,throwOnError:!1});if(n.response?.status===404)return{plugins:[]};if(!n.response?.ok)throw Error(`Failed to load plugins`);return n.data??{plugins:[]}},enabled:!!e,staleTime:T}),o=i({...p({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:T}),s=(0,x.useMemo)(()=>O(a.data?.plugins??[]),[a.data?.plugins]),c=(0,x.useMemo)(()=>new Set(s.map(e=>e.name)),[s]),l=(0,x.useMemo)(()=>s.filter(e=>E(r,e.name,e.description)),[s,r]),u=(0,x.useMemo)(()=>(o.data?.matches??[]).filter(e=>!c.has(e.name)&&E(r,e.name,e.description)),[o.data?.matches,c,r]),m=a.isFetching&&!a.isLoading||o.isFetching&&!o.isLoading,h=a.isLoading,g=o.isLoading,_=!h&&!a.isError&&l.length===0,v=!g&&u.length===0;return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(k,{search:t,onSearchChange:n,isSearching:m}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:[(0,S.jsx)(A,{title:`Installed`}),h?(0,S.jsx)(j,{}):a.isError?(0,S.jsx)(P,{}):_?(0,S.jsx)(M,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map(t=>(0,S.jsx)(`li`,{children:(0,S.jsx)(w,{plugin:t,assistantId:e})},t.id))}),(0,S.jsx)(`div`,{className:`mt-6`}),(0,S.jsx)(A,{title:`Available to install`}),g?(0,S.jsx)(j,{}):o.isError?(0,S.jsx)(F,{}):v?(0,S.jsx)(N,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(C,{match:e})},e.path))})]})]})}function O(e){return[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}))}function k({search:e,onSearchChange:t,isSearching:n}){return(0,S.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,S.jsx)(s,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search Plugins`,"aria-label":`Search Plugins`,leftIcon:(0,S.jsx)(_,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:n?(0,S.jsx)(l,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`})})}function A({title:e}){return(0,S.jsx)(`h3`,{className:`mb-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e})}function j(){return(0,S.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,S.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function M({hasQuery:e}){let t=e?`No installed plugins match`:`No Plugins Installed`,n=e?`Try a different search term, or browse the catalog below.`:`Install a plugin with the CLI, or browse the catalog below.`,r=e?_:g;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(r,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function N({hasQuery:e}){let t=e?`No catalog entries match`:`Catalog is empty`,n=e?`Try a different search term, or remove the filter to browse everything.`:`No plugins are currently published in the catalog.`;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(_,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function P(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(u,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function F(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(g,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Couldn't load catalog`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed above.`})]})})}function I(){let e=h.use.hasHydrated(),t=h.use.externalPlugins(),r=v();return e?t?(0,S.jsx)(D,{assistantId:r}):(0,S.jsx)(n,{to:m.identity,replace:!0}):null}export{I as PluginsPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.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"./card-BibIM9x3.js";import{t as l}from"./input-C8kfrq9r.js";import{c as u,f as d,o as f}from"./local-mode-CvrNMtPF.js";import{t as p}from"./is-electron-C_ZTVhv8.js";import{n as m}from"./resolved-assistants-store-Cp4J43BK.js";import{t as h}from"./check-D6WkI0gF.js";import{t as g}from"./chevron-left-DghyKSEE.js";import{t as _}from"./loader-circle-IIzBGiwm.js";import{t as v}from"./pencil-DbB9rxpY.js";import{t as y}from"./x-KVxA2ZL0.js";import{$ as b,L as ee,M as te,Q as x,a as S,n as C,o as w}from"./auth-store-Kfxhs2oI.js";import{t as T}from"./client.gen-Cs6pCK0s.js";import{a as E}from"./routes-DVqkwUEe.js";import{o as D,r as O}from"./prefs-C_oq5G87.js";import{t as k}from"./client-feature-flag-store-C1kdd1EO.js";import{b as ne,r as A,yt as re}from"./react-query.gen-rp6Krcco.js";import{c as j,l as ie,n as ae,t as M}from"./prechat-B28Vzu55.js";import{n as oe,t as N}from"./browser-CKX_K5ev.js";import{t as P}from"./public-asset-Fx_laYnf.js";import{Ct as F,Et as I,J as L,Ni as se,Ot as ce,Tt as le,c as ue,d as de,kt as R,l as fe,q as z,s as pe,wt as B}from"./index-BIDC22lX.js";import{c as me,i as he,n as V,o as ge,r as _e,s as ve,t as H}from"./step-indicator-dots-D1EQV6VE.js";import{n as U,r as ye}from"./prechat-names-CRduluk-.js";var W=e(t(),1);async function be(){try{let{data:e,response:t}=await T.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var G=s(),xe=[{label:`Push notifications`,detail:`stay in the loop even when the browser is closed`},{label:`Biometric login`,detail:`Face ID & Touch ID for instant, secure access`},{label:`Native haptics`,detail:`tactile feedback that feels part of the device`},{label:`Home screen access`,detail:`launch your assistant with a single tap`}];function Se({onComplete:e}){function t(){fe(),pe(),e()}return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col items-center justify-center px-6 pb-40 text-center`,children:[(0,G.jsx)(`div`,{className:`mb-8 flex size-16 items-center justify-center rounded-2xl border`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,boxShadow:`0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04)`,animation:`fadeInUp 0.3s ease-out both`},children:(0,G.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--content-default)`},"aria-hidden":!0,children:[(0,G.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,G.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,G.jsx)(`p`,{className:`text-label-small-default mb-3 uppercase tracking-[0.2em]`,style:{color:`var(--content-tertiary)`,animation:`fadeInUp 0.3s ease-out 0.05s both`},children:`One more thing`}),(0,G.jsx)(`h1`,{className:`mb-3 text-3xl font-semibold tracking-tight`,style:{color:`var(--content-default)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Your assistant, in your pocket.`}),(0,G.jsx)(`p`,{className:`text-body-medium-lighter mb-10 max-w-sm`,style:{color:`var(--content-secondary)`,animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`The iOS app keeps your assistant a tap away — with push notifications, biometric login, and native haptics.`}),(0,G.jsx)(`div`,{className:`mb-10 w-full rounded-xl border px-5 py-4`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,animation:`fadeInUp 0.3s ease-out 0.2s both`},children:(0,G.jsx)(`ul`,{className:`space-y-4`,children:xe.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,G.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full`,style:{background:`var(--system-positive-weak)`},children:(0,G.jsx)(h,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,G.jsxs)(`span`,{className:`text-left`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,G.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var K=`google`,Ce=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)}];function we({assistantId:e,assistantName:t,onConnect:r,onSkip:i,onBack:o}){let s=p(),c=a(),l=te(),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(null),m=(0,W.useRef)(null),h=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(null),[b,x]=(0,W.useState)(!1),S=(0,W.useCallback)(()=>{d.current=null,x(!1)},[]),C=(0,W.useCallback)(()=>{h.current&&=(window.removeEventListener(`message`,h.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),w=(0,W.useCallback)(()=>{u.current&&!u.current.closed&&u.current.close(),u.current=null,f.current&&=(clearInterval(f.current),null),m.current&&=(clearTimeout(m.current),null)},[]),T=re();(0,W.useEffect)(()=>()=>{f.current&&clearInterval(f.current),m.current&&clearTimeout(m.current),u.current&&!u.current.closed&&u.current.close(),h.current&&window.removeEventListener(`message`,h.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let D=(0,W.useCallback)(async e=>{try{return(await c.fetchQuery({...ne({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===K&&e.connected)??null}catch{return null}},[c]),O=(0,W.useCallback)(async()=>{let e=d.current?.platformAssistantId;w(),S(),r((e?await D(e):null)?.scopes_granted??[])},[S,w,D,r]),k=(0,W.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!d.current||e.requestId!==d.current.requestId||(e.oauthStatus===`connected`?O():(w(),S())))},[S,w,O]),A=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=F(e,window.location.origin,t.requestId);n&&k(n)},[k]),j=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=B(e,t.requestId);n&&(k(n),window.localStorage.removeItem(I(t.requestId)))},[k]);ce((0,W.useCallback)(e=>{let t=d.current;t&&e.requestId===t.requestId&&k({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[k]));let ie=(0,W.useCallback)(()=>{let t=crypto.randomUUID();if(C(),h.current=A,v.current=j,l){x(!0),(async()=>{let n;try{n=await ee(e)}catch{S();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){N(e.connect_url)},onError(){S()}})})(),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),y.current&&y.current();let n=oe(()=>{let e=d.current;if(!e){n(),y.current=null;return}(async()=>{let t=await D(e.platformAssistantId);d.current&&(t?await O():S(),C(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){C();return}u.current=n,x(!0),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),f.current=setInterval(()=>{u.current&&u.current.closed&&d.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=d.current;if(!e)return;let t=window.localStorage.getItem(I(e.requestId));if(t)try{let n=JSON.parse(t);if(le(n,e.requestId)){k(n),window.localStorage.removeItem(I(e.requestId)),C();return}}catch{}let n=await D(e.platformAssistantId);d.current&&(n?await O():(w(),S()),C())},1e3))},100),(async()=>{let n;try{n=await ee(e)}catch{w(),S(),C();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){u.current&&!u.current.closed?u.current.location.href=e.connect_url:d.current&&(w(),S(),C())},onError(){w(),S(),C()}})})()},[e,S,w,D,k,A,j,O,l,C,T]),ae=t||`your assistant`,M=t||`Your assistant`;return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${s?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${s?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`mt-4 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you use Google, ${ae} can use Gmail, Calendar, and Drive with your permission.`}),(0,G.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:Ce.map(e=>(0,G.jsxs)(`div`,{className:`flex w-24 flex-col items-center gap-2.5 rounded-2xl bg-[var(--surface-lift)] px-3 pb-3 pt-4`,children:[(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,G.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,G.jsx)(`p`,{className:`mt-8 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.25s both`},children:`${M} will never send email, change calendar events, or edit files without your permission. You can disconnect at any time.`}),(0,G.jsxs)(`div`,{className:`${s?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.35s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:ie,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:b||T.isPending?(0,G.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,G.jsx)(_,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}function Te({userName:e,assistantName:t,selectedGroupId:r,displayedAssistantNames:i,onUserNameChange:a,onAssistantNameChange:o,onGroupChange:s,onBack:c,onComplete:u,onSkip:d}){let f=p();return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${f?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),c?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,G.jsxs)(`div`,{className:`${f?`mt-6`:`mt-8`} flex w-full flex-col ${f?`gap-4`:`gap-6`}`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>o(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:U.map(e=>(0,G.jsx)(Ee,{group:e,isActive:r===e.id,onToggle:()=>s(r===e.id?null:e.id)},e.id))})]})]}),(0,G.jsxs)(`div`,{className:`${f?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function Ee({group:e,isActive:t,onToggle:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":`${e.label}, ${e.descriptor}`,className:`flex cursor-pointer flex-col items-start gap-0.5 rounded-lg border p-3 text-left transition-colors ${t?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,G.jsx)(`span`,{className:`text-body-small-default ${t?`text-[var(--content-inset)] opacity-60`:`text-[var(--content-tertiary)]`}`,children:e.tagline})]})}function De({userName:e,assistantName:t,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onBack:o,onContinue:s,onSkip:c,currentStep:u,totalSteps:d}){return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[o?(0,G.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:o,"aria-label":`Back`}):(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(H,{current:u,total:d})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.jsx)(`h1`,{className:`text-center text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Let's get to know each other.`}),(0,G.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,G.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]})]})]}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var Oe=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:P(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:P(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:P(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:P(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:P(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:P(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:P(`/images/prior-assistants/copilot.svg`)}];function ke({selectedAssistants:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>q(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(J(e));(0,W.useEffect)(()=>{let t=J(e);if(t===m.current)return;let n=q(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}Ae(n,e)||(m.current=J(n),t(n))},[s]);let h=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center grid-cols-[auto_1fr_auto]`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,G.jsxs)(`div`,{className:`${o?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Oe.map(t=>(0,G.jsx)(je,{assistant:t,selected:e.has(t.id),onToggle:()=>h(t.id)},t.id)),d?null:(0,G.jsx)(Me,{onClick:()=>f(!0)})]}),d?(0,G.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function Ae(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function q(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function J(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function je({assistant:e,selected:t,onToggle:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(Ne,{assistant:e,size:32}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,G.jsx)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Me({onClick:e}){return(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(se,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Ne({assistant:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,G.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Pe({selectedTasks:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),s=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${o?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,G.jsx)(`div`,{className:`${o?`mt-6`:`mt-8`} flex w-full flex-col ${o?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:z.map(t=>{let n=L[t.iconKey],r=e.has(t.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>s(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${o?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,G.jsx)(n,{className:`h-4 w-4`}):null}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-md ${r?`bg-[var(--primary-base)]`:`border-[1.5px] border-[var(--border-element)]`}`,children:r?(0,G.jsx)(h,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Fe=new Set([`gmail`,`google-calendar`,`google-drive`]),Ie=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:P(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:P(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:P(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:P(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:P(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:P(`/images/integrations/github.svg`),logoSrcDark:P(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:P(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:P(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:P(`/images/integrations/apple-notes.svg`)}];function Le(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>Y(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(X(e));(0,W.useEffect)(()=>{let t=X(e);if(t===m.current)return;let n=Y(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(m.current=X(n),t(n))},[s]);let h=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${r?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),r?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,G.jsxs)(`div`,{className:`grid w-full gap-2 ${o?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Ie.map(t=>(0,G.jsx)(Z,{tool:t,selected:e.has(t.id),onToggle:()=>h(t.id),electron:o},t.id)),d?null:(0,G.jsx)(Q,{onClick:()=>f(!0),electron:o})]}),d?(0,G.jsx)(c,{padding:o?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col ${o?`gap-2`:`gap-3`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function X(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Z({tool:e,selected:t,onToggle:n,electron:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex ${r?`h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)($,{tool:e,size:32}),(0,G.jsx)(`span`,{className:`${r?`w-full truncate`:`line-clamp-2`} text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,G.jsx)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Q({onClick:e,electron:t}){return(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex ${t?`min-h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(se,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function $({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,G.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Be({selectedGroupId:e,onGroupChange:t,onBack:r,onContinue:i,onSkip:a,currentStep:o,totalSteps:s}){return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:r,"aria-label":`Back`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(H,{current:o,total:s})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.jsx)(`h1`,{className:`w-full text-left text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`What's my vibe?`}),(0,G.jsx)(`p`,{className:`mt-2 w-full text-left text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change this any time.`}),(0,G.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:U.map(n=>{let r=e===n.id;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(r?null:n.id),"aria-pressed":r,className:`flex cursor-pointer items-center justify-between rounded-xl border px-4 py-4 text-left transition-colors ${r?`border-[var(--content-default)] bg-[var(--surface-lift)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,G.jsx)(`span`,{className:`flex h-5 w-5 items-center justify-center rounded-full border-2 transition-colors ${r?`border-[var(--content-default)]`:`border-[var(--content-disabled)]`}`,children:r&&(0,G.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ve(e){let[t,n]=(0,W.useState)(()=>(e??``).trim()),r=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,W.useCallback)(e=>{r.current=!0,n(e)},[])}}var He=[`gmail`,`google-calendar`,`google-drive`],Ue=`experiment-activation-flow-2026-06-03`,We=`BOOTSTRAP-ACTIVATION-RAIL.md`;function Ge(e,t,n){return t?.initialMessage?t.initialMessage:n?ae(e):M}function Ke(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...He]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:Le([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Ue,i.bootstrapTemplate=We);let a=e.userName.trim();a&&(i.userName=a);let o=e.occupation?.trim();o&&(i.occupation=o);let s=e.assistantName.trim();return s&&(i.assistantName=s),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=Le([...e.selectedPriorAssistants])),i.initialMessage=Ge(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function qe(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Je(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:V.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:V.controlWorkType,enabled:!t},{id:`tools`,funnelStep:V.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:V.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?V.gmailConnect:V.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:V.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ye(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Xe=`1`;function Ze(e){return e===`nativeVibe`||e===Xe?`nativeVibe`:null}function Qe(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function et(){let e=r(),t=te(),n=D()&&O();return(0,W.useEffect)(()=>{!n&&!t&&e(E.onboarding.privacy,{replace:!0})},[n,t,e]),t||n}function tt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,W.useState)(()=>t?`nativeName`:`name`),a=(0,W.useCallback)(e=>{if(n)try{e===null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},[n]);return(0,W.useLayoutEffect)(()=>{if(n)try{let e=Ze(sessionStorage.getItem(n));e&&i(e)}catch{}},[n]),(0,W.useEffect)(()=>{t&&a(r===`nativeVibe`?`nativeVibe`:null)},[t,r,a]),{currentStep:r,setCurrentStep:i,clearPersistedStep:(0,W.useCallback)(()=>{a(null)},[a])}}var nt=3;function rt(){let e=u();return e?.cloud===`vellum`?e.assistantId:f()[0]?.assistantId??null}function it(){let e=r(),[t]=i(),n=t.get(`preview`)===`true`,a=C.use.user(),s=S(),c=w(),l=a?.id??null,u=a?.firstName??``,f=a?.lastName??``,p=te(),h=m.use.activeAssistantId(),g=d(),_=de()&&!ue(),v=k.use.stringFlags().preChatOnboardingExperiment20260606??`control`,y=(k.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,ee=k.use.selfIntroGreeting(),T=ge(v),D=ve()??T,O=D===_e.paredDown,ne=g?rt():null,re=et(),{currentStep:ae,setCurrentStep:M,clearPersistedStep:oe}=tt(l,p),N=C.use.platformSession(),P=b(N),[F,I]=(0,W.useState)(()=>new Set),[L,se]=(0,W.useState)(()=>new Set),[ce,le]=(0,W.useState)(()=>new Set),{value:R,onChange:fe}=Ve(g&&!P?``:u||f),[z,pe]=(0,W.useState)(null),[B]=(0,W.useState)(()=>ye()),[V,H]=(0,W.useState)(``),[U,xe]=(0,W.useState)(!1),[K,Ce]=(0,W.useState)([]),{data:Ee}=o({...A(),enabled:!c&&s&&(!g||P)}),{data:Oe,isLoading:Ae}=o({queryKey:[`onboarding-recipe`,l],queryFn:be,enabled:!c&&s&&!p&&!g,staleTime:1/0}),q=Oe??null,J=Ee?.id??h??ne,je=qe({localMode:g,platformSession:N,hasCachedPlatformAssistant:ne!==null}),Me=je,Ne=je,Ie=async()=>{await x.checkAssistant(),e(`${E.assistant}?onboarding=1`,{replace:!0})};function Le(e,t=D){n||he(e,{userId:l,variant:me(t)})}let ze=[...F].some(e=>Fe.has(e)),Y=p?Ye():Je({paredDown:O,canOfferPriorAssistants:Ne,canOfferGoogleStep:n?!1:Me,hasGoogleTool:ze,showIOSAppStep:_});function X(t){if(n){e(-1);return}ie(Ke({mode:p?`native`:O?`paredDown`:`control`,recipe:p?null:q,selectedTools:F,selectedTasks:L,selectedPriorAssistants:t?.selectedPriorAssistants??ce,tone:z??q?.tone??`grounded`,userName:R,assistantName:V,selfIntroGreetingEnabled:ee,activationFlowEnabled:p?void 0:y,googleConnected:U,googleScopes:K,connectedScopes:t?.connectedScopes}));let r=V.trim();r&&j(r),p?(oe(),e(E.onboarding.privacy)):(x.markExpectingFirstMessage(),Ie())}let Z=(e,t)=>{e.funnelStep&&Le(e.funnelStep);let n=Qe(Y,e.id);n?M(n):X(t)},Q=e=>{let t=$e(Y,e.id);t&&M(t)};if(!re||Ae)return null;let $=Y.find(e=>e.id===ae)??Y[0];return $?$.id===`nativeName`?(0,G.jsx)(De,{userName:R,assistantName:V,displayedAssistantNames:B,onUserNameChange:fe,onAssistantNameChange:H,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:nt}):$.id===`nativeVibe`?(0,G.jsx)(Be,{selectedGroupId:z,onGroupChange:pe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:nt}):$.id===`name`?(0,G.jsx)(Te,{userName:R,assistantName:V,selectedGroupId:z,displayedAssistantNames:B,onUserNameChange:fe,onAssistantNameChange:H,onGroupChange:pe,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,G.jsx)(Pe,{selectedTasks:L,onChange:se,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,G.jsx)(Re,{selectedTools:F,onChange:I,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,G.jsx)(ke,{selectedAssistants:ce,onChange:le,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;le(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?J?(0,G.jsx)(we,{assistantId:J,assistantName:V,onConnect:e=>{xe(!0),Ce(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,G.jsx)(Se,{onComplete:()=>Z($)}):null:null}function at(){return(0,G.jsx)(it,{})}export{at as PreChatRoute};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.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"./card-BibIM9x3.js";import{t as l}from"./input-C8kfrq9r.js";import{c as u,f as d,o as f}from"./local-mode-CvrNMtPF.js";import{t as p}from"./is-electron-C_ZTVhv8.js";import{n as m}from"./resolved-assistants-store-Cp4J43BK.js";import{t as h}from"./check-D6WkI0gF.js";import{t as g}from"./chevron-left-DghyKSEE.js";import{t as _}from"./loader-circle-IIzBGiwm.js";import{t as v}from"./pencil-DbB9rxpY.js";import{t as y}from"./x-KVxA2ZL0.js";import{$ as b,L as ee,M as te,Q as x,a as S,n as C,o as w}from"./auth-store-Kfxhs2oI.js";import{t as T}from"./client.gen-Cs6pCK0s.js";import{a as E}from"./routes-DVqkwUEe.js";import{o as D,r as O}from"./prefs-C_oq5G87.js";import{t as k}from"./client-feature-flag-store-C1kdd1EO.js";import{b as ne,r as A,yt as re}from"./react-query.gen-rp6Krcco.js";import{c as j,l as ie,n as ae,t as M}from"./prechat-B28Vzu55.js";import{n as oe,t as N}from"./browser-CKX_K5ev.js";import{t as P}from"./public-asset-Fx_laYnf.js";import{Ct as F,Et as I,J as L,Ni as se,Ot as ce,Tt as le,c as ue,d as de,kt as R,l as fe,q as z,s as pe,wt as B}from"./index-PRnvH2Y1.js";import{c as me,i as he,n as V,o as ge,r as _e,s as ve,t as H}from"./step-indicator-dots-CEVbsP8r.js";import{n as U,r as ye}from"./prechat-names-CRduluk-.js";var W=e(t(),1);async function be(){try{let{data:e,response:t}=await T.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var G=s(),xe=[{label:`Push notifications`,detail:`stay in the loop even when the browser is closed`},{label:`Biometric login`,detail:`Face ID & Touch ID for instant, secure access`},{label:`Native haptics`,detail:`tactile feedback that feels part of the device`},{label:`Home screen access`,detail:`launch your assistant with a single tap`}];function Se({onComplete:e}){function t(){fe(),pe(),e()}return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col items-center justify-center px-6 pb-40 text-center`,children:[(0,G.jsx)(`div`,{className:`mb-8 flex size-16 items-center justify-center rounded-2xl border`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,boxShadow:`0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04)`,animation:`fadeInUp 0.3s ease-out both`},children:(0,G.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--content-default)`},"aria-hidden":!0,children:[(0,G.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,G.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,G.jsx)(`p`,{className:`text-label-small-default mb-3 uppercase tracking-[0.2em]`,style:{color:`var(--content-tertiary)`,animation:`fadeInUp 0.3s ease-out 0.05s both`},children:`One more thing`}),(0,G.jsx)(`h1`,{className:`mb-3 text-3xl font-semibold tracking-tight`,style:{color:`var(--content-default)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Your assistant, in your pocket.`}),(0,G.jsx)(`p`,{className:`text-body-medium-lighter mb-10 max-w-sm`,style:{color:`var(--content-secondary)`,animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`The iOS app keeps your assistant a tap away — with push notifications, biometric login, and native haptics.`}),(0,G.jsx)(`div`,{className:`mb-10 w-full rounded-xl border px-5 py-4`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,animation:`fadeInUp 0.3s ease-out 0.2s both`},children:(0,G.jsx)(`ul`,{className:`space-y-4`,children:xe.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,G.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full`,style:{background:`var(--system-positive-weak)`},children:(0,G.jsx)(h,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,G.jsxs)(`span`,{className:`text-left`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,G.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var K=`google`,Ce=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)}];function we({assistantId:e,assistantName:t,onConnect:r,onSkip:i,onBack:o}){let s=p(),c=a(),l=te(),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(null),m=(0,W.useRef)(null),h=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(null),[b,x]=(0,W.useState)(!1),S=(0,W.useCallback)(()=>{d.current=null,x(!1)},[]),C=(0,W.useCallback)(()=>{h.current&&=(window.removeEventListener(`message`,h.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),w=(0,W.useCallback)(()=>{u.current&&!u.current.closed&&u.current.close(),u.current=null,f.current&&=(clearInterval(f.current),null),m.current&&=(clearTimeout(m.current),null)},[]),T=re();(0,W.useEffect)(()=>()=>{f.current&&clearInterval(f.current),m.current&&clearTimeout(m.current),u.current&&!u.current.closed&&u.current.close(),h.current&&window.removeEventListener(`message`,h.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let D=(0,W.useCallback)(async e=>{try{return(await c.fetchQuery({...ne({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===K&&e.connected)??null}catch{return null}},[c]),O=(0,W.useCallback)(async()=>{let e=d.current?.platformAssistantId;w(),S(),r((e?await D(e):null)?.scopes_granted??[])},[S,w,D,r]),k=(0,W.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!d.current||e.requestId!==d.current.requestId||(e.oauthStatus===`connected`?O():(w(),S())))},[S,w,O]),A=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=F(e,window.location.origin,t.requestId);n&&k(n)},[k]),j=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=B(e,t.requestId);n&&(k(n),window.localStorage.removeItem(I(t.requestId)))},[k]);ce((0,W.useCallback)(e=>{let t=d.current;t&&e.requestId===t.requestId&&k({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[k]));let ie=(0,W.useCallback)(()=>{let t=crypto.randomUUID();if(C(),h.current=A,v.current=j,l){x(!0),(async()=>{let n;try{n=await ee(e)}catch{S();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){N(e.connect_url)},onError(){S()}})})(),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),y.current&&y.current();let n=oe(()=>{let e=d.current;if(!e){n(),y.current=null;return}(async()=>{let t=await D(e.platformAssistantId);d.current&&(t?await O():S(),C(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){C();return}u.current=n,x(!0),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),f.current=setInterval(()=>{u.current&&u.current.closed&&d.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=d.current;if(!e)return;let t=window.localStorage.getItem(I(e.requestId));if(t)try{let n=JSON.parse(t);if(le(n,e.requestId)){k(n),window.localStorage.removeItem(I(e.requestId)),C();return}}catch{}let n=await D(e.platformAssistantId);d.current&&(n?await O():(w(),S()),C())},1e3))},100),(async()=>{let n;try{n=await ee(e)}catch{w(),S(),C();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){u.current&&!u.current.closed?u.current.location.href=e.connect_url:d.current&&(w(),S(),C())},onError(){w(),S(),C()}})})()},[e,S,w,D,k,A,j,O,l,C,T]),ae=t||`your assistant`,M=t||`Your assistant`;return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${s?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${s?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`mt-4 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you use Google, ${ae} can use Gmail, Calendar, and Drive with your permission.`}),(0,G.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:Ce.map(e=>(0,G.jsxs)(`div`,{className:`flex w-24 flex-col items-center gap-2.5 rounded-2xl bg-[var(--surface-lift)] px-3 pb-3 pt-4`,children:[(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,G.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,G.jsx)(`p`,{className:`mt-8 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.25s both`},children:`${M} will never send email, change calendar events, or edit files without your permission. You can disconnect at any time.`}),(0,G.jsxs)(`div`,{className:`${s?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.35s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:ie,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:b||T.isPending?(0,G.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,G.jsx)(_,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}function Te({userName:e,assistantName:t,selectedGroupId:r,displayedAssistantNames:i,onUserNameChange:a,onAssistantNameChange:o,onGroupChange:s,onBack:c,onComplete:u,onSkip:d}){let f=p();return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${f?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),c?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,G.jsxs)(`div`,{className:`${f?`mt-6`:`mt-8`} flex w-full flex-col ${f?`gap-4`:`gap-6`}`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>o(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:U.map(e=>(0,G.jsx)(Ee,{group:e,isActive:r===e.id,onToggle:()=>s(r===e.id?null:e.id)},e.id))})]})]}),(0,G.jsxs)(`div`,{className:`${f?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function Ee({group:e,isActive:t,onToggle:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":`${e.label}, ${e.descriptor}`,className:`flex cursor-pointer flex-col items-start gap-0.5 rounded-lg border p-3 text-left transition-colors ${t?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,G.jsx)(`span`,{className:`text-body-small-default ${t?`text-[var(--content-inset)] opacity-60`:`text-[var(--content-tertiary)]`}`,children:e.tagline})]})}function De({userName:e,assistantName:t,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onBack:o,onContinue:s,onSkip:c,currentStep:u,totalSteps:d}){return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[o?(0,G.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:o,"aria-label":`Back`}):(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(H,{current:u,total:d})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.jsx)(`h1`,{className:`text-center text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Let's get to know each other.`}),(0,G.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,G.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]})]})]}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var Oe=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:P(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:P(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:P(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:P(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:P(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:P(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:P(`/images/prior-assistants/copilot.svg`)}];function ke({selectedAssistants:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>q(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(J(e));(0,W.useEffect)(()=>{let t=J(e);if(t===m.current)return;let n=q(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}Ae(n,e)||(m.current=J(n),t(n))},[s]);let h=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center grid-cols-[auto_1fr_auto]`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,G.jsxs)(`div`,{className:`${o?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Oe.map(t=>(0,G.jsx)(je,{assistant:t,selected:e.has(t.id),onToggle:()=>h(t.id)},t.id)),d?null:(0,G.jsx)(Me,{onClick:()=>f(!0)})]}),d?(0,G.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function Ae(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function q(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function J(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function je({assistant:e,selected:t,onToggle:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(Ne,{assistant:e,size:32}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,G.jsx)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Me({onClick:e}){return(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(se,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Ne({assistant:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,G.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Pe({selectedTasks:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),s=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${o?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,G.jsx)(`div`,{className:`${o?`mt-6`:`mt-8`} flex w-full flex-col ${o?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:z.map(t=>{let n=L[t.iconKey],r=e.has(t.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>s(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${o?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,G.jsx)(n,{className:`h-4 w-4`}):null}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-md ${r?`bg-[var(--primary-base)]`:`border-[1.5px] border-[var(--border-element)]`}`,children:r?(0,G.jsx)(h,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Fe=new Set([`gmail`,`google-calendar`,`google-drive`]),Ie=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:P(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:P(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:P(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:P(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:P(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:P(`/images/integrations/github.svg`),logoSrcDark:P(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:P(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:P(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:P(`/images/integrations/apple-notes.svg`)}];function Le(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>Y(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(X(e));(0,W.useEffect)(()=>{let t=X(e);if(t===m.current)return;let n=Y(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(m.current=X(n),t(n))},[s]);let h=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${r?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),r?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,G.jsxs)(`div`,{className:`grid w-full gap-2 ${o?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Ie.map(t=>(0,G.jsx)(Z,{tool:t,selected:e.has(t.id),onToggle:()=>h(t.id),electron:o},t.id)),d?null:(0,G.jsx)(Q,{onClick:()=>f(!0),electron:o})]}),d?(0,G.jsx)(c,{padding:o?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col ${o?`gap-2`:`gap-3`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function X(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Z({tool:e,selected:t,onToggle:n,electron:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex ${r?`h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)($,{tool:e,size:32}),(0,G.jsx)(`span`,{className:`${r?`w-full truncate`:`line-clamp-2`} text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,G.jsx)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Q({onClick:e,electron:t}){return(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex ${t?`min-h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(se,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function $({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,G.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Be({selectedGroupId:e,onGroupChange:t,onBack:r,onContinue:i,onSkip:a,currentStep:o,totalSteps:s}){return(0,G.jsx)(R,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,G.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:r,"aria-label":`Back`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(H,{current:o,total:s})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.jsx)(`h1`,{className:`w-full text-left text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`What's my vibe?`}),(0,G.jsx)(`p`,{className:`mt-2 w-full text-left text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change this any time.`}),(0,G.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:U.map(n=>{let r=e===n.id;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(r?null:n.id),"aria-pressed":r,className:`flex cursor-pointer items-center justify-between rounded-xl border px-4 py-4 text-left transition-colors ${r?`border-[var(--content-default)] bg-[var(--surface-lift)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,G.jsx)(`span`,{className:`flex h-5 w-5 items-center justify-center rounded-full border-2 transition-colors ${r?`border-[var(--content-default)]`:`border-[var(--content-disabled)]`}`,children:r&&(0,G.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ve(e){let[t,n]=(0,W.useState)(()=>(e??``).trim()),r=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,W.useCallback)(e=>{r.current=!0,n(e)},[])}}var He=[`gmail`,`google-calendar`,`google-drive`],Ue=`experiment-activation-flow-2026-06-03`,We=`BOOTSTRAP-ACTIVATION-RAIL.md`;function Ge(e,t,n){return t?.initialMessage?t.initialMessage:n?ae(e):M}function Ke(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...He]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:Le([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Ue,i.bootstrapTemplate=We);let a=e.userName.trim();a&&(i.userName=a);let o=e.occupation?.trim();o&&(i.occupation=o);let s=e.assistantName.trim();return s&&(i.assistantName=s),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=Le([...e.selectedPriorAssistants])),i.initialMessage=Ge(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function qe(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Je(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:V.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:V.controlWorkType,enabled:!t},{id:`tools`,funnelStep:V.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:V.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?V.gmailConnect:V.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:V.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ye(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Xe=`1`;function Ze(e){return e===`nativeVibe`||e===Xe?`nativeVibe`:null}function Qe(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function et(){let e=r(),t=te(),n=D()&&O();return(0,W.useEffect)(()=>{!n&&!t&&e(E.onboarding.privacy,{replace:!0})},[n,t,e]),t||n}function tt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,W.useState)(()=>t?`nativeName`:`name`),a=(0,W.useCallback)(e=>{if(n)try{e===null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},[n]);return(0,W.useLayoutEffect)(()=>{if(n)try{let e=Ze(sessionStorage.getItem(n));e&&i(e)}catch{}},[n]),(0,W.useEffect)(()=>{t&&a(r===`nativeVibe`?`nativeVibe`:null)},[t,r,a]),{currentStep:r,setCurrentStep:i,clearPersistedStep:(0,W.useCallback)(()=>{a(null)},[a])}}var nt=3;function rt(){let e=u();return e?.cloud===`vellum`?e.assistantId:f()[0]?.assistantId??null}function it(){let e=r(),[t]=i(),n=t.get(`preview`)===`true`,a=C.use.user(),s=S(),c=w(),l=a?.id??null,u=a?.firstName??``,f=a?.lastName??``,p=te(),h=m.use.activeAssistantId(),g=d(),_=de()&&!ue(),v=k.use.stringFlags().preChatOnboardingExperiment20260606??`control`,y=(k.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,ee=k.use.selfIntroGreeting(),T=ge(v),D=ve()??T,O=D===_e.paredDown,ne=g?rt():null,re=et(),{currentStep:ae,setCurrentStep:M,clearPersistedStep:oe}=tt(l,p),N=C.use.platformSession(),P=b(N),[F,I]=(0,W.useState)(()=>new Set),[L,se]=(0,W.useState)(()=>new Set),[ce,le]=(0,W.useState)(()=>new Set),{value:R,onChange:fe}=Ve(g&&!P?``:u||f),[z,pe]=(0,W.useState)(null),[B]=(0,W.useState)(()=>ye()),[V,H]=(0,W.useState)(``),[U,xe]=(0,W.useState)(!1),[K,Ce]=(0,W.useState)([]),{data:Ee}=o({...A(),enabled:!c&&s&&(!g||P)}),{data:Oe,isLoading:Ae}=o({queryKey:[`onboarding-recipe`,l],queryFn:be,enabled:!c&&s&&!p&&!g,staleTime:1/0}),q=Oe??null,J=Ee?.id??h??ne,je=qe({localMode:g,platformSession:N,hasCachedPlatformAssistant:ne!==null}),Me=je,Ne=je,Ie=async()=>{await x.checkAssistant(),e(`${E.assistant}?onboarding=1`,{replace:!0})};function Le(e,t=D){n||he(e,{userId:l,variant:me(t)})}let ze=[...F].some(e=>Fe.has(e)),Y=p?Ye():Je({paredDown:O,canOfferPriorAssistants:Ne,canOfferGoogleStep:n?!1:Me,hasGoogleTool:ze,showIOSAppStep:_});function X(t){if(n){e(-1);return}ie(Ke({mode:p?`native`:O?`paredDown`:`control`,recipe:p?null:q,selectedTools:F,selectedTasks:L,selectedPriorAssistants:t?.selectedPriorAssistants??ce,tone:z??q?.tone??`grounded`,userName:R,assistantName:V,selfIntroGreetingEnabled:ee,activationFlowEnabled:p?void 0:y,googleConnected:U,googleScopes:K,connectedScopes:t?.connectedScopes}));let r=V.trim();r&&j(r),p?(oe(),e(E.onboarding.privacy)):(x.markExpectingFirstMessage(),Ie())}let Z=(e,t)=>{e.funnelStep&&Le(e.funnelStep);let n=Qe(Y,e.id);n?M(n):X(t)},Q=e=>{let t=$e(Y,e.id);t&&M(t)};if(!re||Ae)return null;let $=Y.find(e=>e.id===ae)??Y[0];return $?$.id===`nativeName`?(0,G.jsx)(De,{userName:R,assistantName:V,displayedAssistantNames:B,onUserNameChange:fe,onAssistantNameChange:H,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:nt}):$.id===`nativeVibe`?(0,G.jsx)(Be,{selectedGroupId:z,onGroupChange:pe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:nt}):$.id===`name`?(0,G.jsx)(Te,{userName:R,assistantName:V,selectedGroupId:z,displayedAssistantNames:B,onUserNameChange:fe,onAssistantNameChange:H,onGroupChange:pe,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,G.jsx)(Pe,{selectedTasks:L,onChange:se,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,G.jsx)(Re,{selectedTools:F,onChange:I,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,G.jsx)(ke,{selectedAssistants:ce,onChange:le,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;le(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?J?(0,G.jsx)(we,{assistantId:J,assistantName:V,onConnect:e=>{xe(!0),Ce(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,G.jsx)(Se,{onComplete:()=>Z($)}):null:null}function at(){return(0,G.jsx)(it,{})}export{at as PreChatRoute};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,n,o as r,r as i,s as a}from"./device-settings-BBwtGKJb.js";import{t as o}from"./react-DJZBPgpf.js";import{O as s,t as c}from"./button-D7s2Q_uG.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./useMutation-Lj4VunQV.js";import{t as f}from"./jsx-runtime-CVSDxk6A.js";import{t as p}from"./cn-DvW5mxZR.js";import{t as m}from"./card-BibIM9x3.js";import{t as h}from"./dropdown-CL8VmqrY.js";import{t as g}from"./confirm-dialog-CfOXCE1N.js";import{t as _}from"./notice-CqRgVmeL.js";import{t as v}from"./tag-B_-QAvJF.js";import{t as y}from"./input-C8kfrq9r.js";import{t as b}from"./toggle-X_kQW5my.js";import{n as x}from"./toast-2TW5tj1Y.js";import{t as S}from"./chevron-right-B6vEpVY0.js";import{t as C}from"./loader-circle-IIzBGiwm.js";import{t as w}from"./pencil-DbB9rxpY.js";import{t as T}from"./x-KVxA2ZL0.js";import{C as E,D,E as O,M as k,O as A,S as ee,T as te,f as j,n as ne,r as re,w as ie}from"./auth-store-Kfxhs2oI.js";import{t as ae}from"./sdk.gen-D-_js_oC.js";import{a as oe,i as se}from"./routes-DVqkwUEe.js";import{n as ce,t as le}from"./react-query.gen-rp6Krcco.js";import{$i as ue,B as de,Gr as M,H as fe,Ir as pe,V as N,Zt as me,an as P,cn as F,g as I,h as L,in as R,ln as z,m as B,p as V,rn as he,sn as ge,x as _e}from"./index-BIDC22lX.js";import{t as H}from"./use-active-assistant-id-C-RHQ9f6.js";import{t as U}from"./detail-card-BIwpXT5F.js";import{t as W}from"./setting-row-o44aWwYt.js";var G=e(o(),1),K=f(),q=[{id:`accessibility`,type:`system`,sourceKind:`accessibility`,label:`Accessibility`,description:`Allows your assistant to click, type, and control apps on your behalf.`},{id:`screen`,type:`system`,sourceKind:`screen`,label:`Screen Recording`,description:`Allows your assistant to capture screen context during computer-use tasks.`},{id:`microphone`,type:`system`,sourceKind:`microphone`,label:`Microphone`,description:`Allows your assistant to capture audio for voice input and recordings.`},{id:`speechRecognition`,type:`system`,sourceKind:`speechRecognition`,label:`Speech Recognition`,description:`Allows your assistant to transcribe your speech into text on-device.`},{id:`notifications`,type:`system`,sourceKind:`notifications`,label:`Notifications`,description:`Allows your assistant to send macOS alerts for approvals, messages, and task updates.`}],ve=[{id:`notificationBadges`,type:`local`,label:`Notification Badges`,description:`Allows your assistant to show unseen conversation counts on the Dock icon.`}];function ye(){let[e,t]=(0,G.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function be(){let[e,r]=(0,G.useState)(()=>n(`dockBadgesEnabled`,!0));return(0,G.useEffect)(()=>a(`dockBadgesEnabled`,()=>{r(n(`dockBadgesEnabled`,!0))}),[]),[e,e=>{r(e),t(`dockBadgesEnabled`,e),e||me(0)}]}function xe({row:e,onToggle:t}){return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(b,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:p(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,K.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,K.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function Se(){return(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--content-tertiary)]`})}function Ce({compact:e=!1}){let{state:t,loading:n,error:r,supported:i,refresh:a}=z(),{pendingKind:o,run:s}=ye(),[c,l]=be(),u=(0,G.useMemo)(()=>{let e=new Map;if(!t)return e;for(let n of q){let r=t[n.sourceKind];r&&e.set(n.id,{meta:n,item:r})}return e},[t]),d=(0,G.useMemo)(()=>{let e=q.map(e=>{let t=u.get(e.id)?.item;return t?{id:e.id,label:e.label,description:e.description,checked:t.status===`granted`,disabled:o===e.id||t.status===`restricted`,...t.error?{error:t.error}:{}}:null}).filter(Boolean),t=ve.map(e=>({id:e.id,label:e.label,description:e.description,checked:c,disabled:o===e.id}));return[...e,...t]},[c,o,u]);if(!i)return null;let f=async(e,t)=>{t.status===`granted`||t.status===`denied`||!t.canRequest?await ge(e.sourceKind):await F(e.sourceKind),await a()},p=e=>{let t=u.get(e);if(t){s(e,()=>f(t.meta,t.item));return}e===`notificationBadges`&&s(e,async()=>{l(!c)})};return(0,K.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,K.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:`System Permissions`}),n&&d.length===0?(0,K.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,K.jsx)(Se,{}),`Checking permissions...`]}):(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,K.jsx)(xe,{row:e,onToggle:p},e.id))}),r&&(0,K.jsx)(`div`,{role:`alert`,className:`mt-6 rounded-lg border border-[color-mix(in_srgb,var(--system-negative-strong)_25%,transparent)] bg-[var(--system-negative-weak)] p-3 text-body-medium-lighter text-[var(--content-secondary)]`,children:r})]})}function we(){let e=P({platformHostedOnly:!0}),t=he(),n=R(),r=l(),{data:i,isLoading:a,isError:o}=u({...le(),enabled:e===`full`&&t}),s=d({mutationFn:async e=>{let{data:t}=await ae({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{ce(r,void 0,e),x.success(e?.access_consented?`Admin data access enabled.`:`Admin data access disabled.`)},onError:()=>{x.error(`Failed to update log access consent.`)}});if(e===`gated`)return null;let c=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||o||s.isPending;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow Staff Access`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:`When enabled, Vellum Staff will be able to access your assistant and its data for debugging purposes. It's suggested that you leave this off and only turn it on temporarily if you need Vellum Support's help in investigating an issue.`}),e===`full`&&o&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,K.jsxs)(K.Fragment,{children:[(s.isPending||c)&&(0,K.jsx)(C,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,K.jsx)(b,{checked:f,disabled:p,onChange:()=>s.mutate(!f)})]})})]}),e===`disabled`&&(0,K.jsx)(_e,{className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function Te(){let e=k(),[t,n]=(0,G.useState)(()=>te()),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(`Face ID`),[s,c]=(0,G.useState)(!1);if((0,G.useEffect)(()=>{e&&(ie().then(i),E().then(o))},[e]),!e||!r)return null;let l=async()=>{c(!0);try{if(t)O(!1),await ee(),n(!1);else{let e=A();e&&await D(e),O(!0),n(!0)}}finally{c(!1)}};return(0,K.jsx)(U,{title:`Security`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,a,` for sign-in`]}),(0,K.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`When your session expires, verify with `,a,` or your device passcode instead of signing in again.`]})]}),(0,K.jsx)(b,{checked:t,onChange:()=>void l(),disabled:s})]})})}function J(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var Y=V.map(e=>({value:e.id,label:e.label,icon:(0,K.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function Ee(){let e=H(),t=l(),{data:n,isError:r}=u({queryKey:[`thresholds`,e],queryFn:()=>L(e),staleTime:3e4}),[i,a]=(0,G.useState)(`relaxed`),[o,s]=(0,G.useState)(`conservative`),[c,d]=(0,G.useState)(`strict`),[f,p]=(0,G.useState)(!1),g=(0,G.useRef)(!1),[_,v]=(0,G.useState)(!1),y=(0,G.useRef)(null),b=(0,G.useRef)(null);(0,G.useEffect)(()=>{!n||g.current||(a(B(n.interactive).id),s(B(n.autonomous).id),d(B(n.headless).id),v(!0))},[n]),(0,G.useEffect)(()=>()=>{y.current!==null&&(clearTimeout(y.current),y.current=null,b.current?.(),b.current=null)},[]);let x=(0,G.useCallback)((n,r,i)=>{if(!e||!_)return;let a=V.find(e=>e.id===n)?.riskThreshold,o=V.find(e=>e.id===r)?.riskThreshold,s=V.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||I(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,_,t]),C=(0,G.useCallback)((e,t,n)=>{y.current!==null&&clearTimeout(y.current),b.current=()=>x(e,t,n),y.current=setTimeout(()=>{b.current?.(),y.current=null,b.current=null},500)},[x]),w=(0,G.useCallback)(e=>{g.current=!0,a(e),C(e,o,c)},[o,c,C]),T=(0,G.useCallback)(e=>{g.current=!0,s(e),C(i,e,c)},[i,c,C]),E=(0,G.useCallback)(e=>{g.current=!0,d(e),C(i,o,e)},[i,o,C]),D=V.find(e=>e.id===i),O=V.find(e=>e.id===o),k=V.find(e=>e.id===c),A=!e||!_;return(0,K.jsxs)(m,{children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Risk Tolerance`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Control which actions your assistant can take without asking first. Each action is classified by risk level — your tolerance determines which levels auto-approve.`}),r&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--system-negative-strong)]`,children:`Could not load threshold settings. Check your connection and reload.`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:i,onChange:w,options:Y,disabled:A})}),D&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:D.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":f,children:[f?(0,K.jsx)(ue,{className:`h-4 w-4`}):(0,K.jsx)(S,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,K.jsxs)(`div`,{className:f?`mt-4 space-y-4`:`hidden`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When your assistant acts without you — scheduled tasks, background jobs, and external triggers.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:o,onChange:T,options:Y,disabled:A})}),O&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:O.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:c,onChange:E,options:Y,disabled:A})}),k&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:k.description})]})]})]})]})]})}var X=e(s(),1),Z=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`],De=[{value:`low`,label:`Low`,description:`Auto-approve without prompting`},{value:`medium`,label:`Medium`,description:`Prompt before executing`},{value:`high`,label:`High`,description:`Always require explicit approval`}];function Oe({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,G.useRef)(null),[a,o]=(0,G.useState)(t.tool),[s,c]=(0,G.useState)(t.pattern),[l,u]=(0,G.useState)(t.risk),[d,f]=(0,G.useState)(t.description??``),[p,m]=(0,G.useState)(!1),[g,v]=(0,G.useState)(null),b=s.trim(),x=b.length>0&&!p,S=(0,G.useCallback)(async n=>{if(n.preventDefault(),!x)return;let i=d.trim()||`${a} — ${b}`;m(!0),v(null);try{await fe(e,t.id,{risk:l,description:i}),r()}catch(e){v(e instanceof Error?e.message:`Failed to save trust rule.`)}finally{m(!1)}},[e,x,d,t,r,l,a,b]);return(0,X.createPortal)((0,K.jsx)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rule-form-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&n()},[n]),onClick:(0,G.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[calc(100vh-2rem)] w-full max-w-md flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(T,{className:`h-4 w-4`})})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void S(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[g&&(0,K.jsx)(_,{tone:`error`,children:g}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,K.jsx)(`div`,{className:`mt-1`,children:(0,K.jsx)(h,{value:a,onChange:o,disabled:!0,options:Z.map(e=>({value:e,label:e}))})})]}),(0,K.jsx)(y,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,K.jsx)(`div`,{className:`mt-2 flex gap-2`,children:De.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>u(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${l===e.value?e.value===`low`?`border-[var(--system-positive-strong)] bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`:e.value===`medium`?`border-[var(--system-warning-strong)] bg-[var(--system-warning-weak)] text-[var(--system-warning-strong)]`:`border-[var(--system-negative-strong)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] text-[var(--content-default)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`div`,{children:e.label}),(0,K.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,K.jsx)(y,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`${a} — ${b||`pattern`}`}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-[var(--border-element)] bg-white px-4 py-2 text-body-medium-default text-[var(--content-default)] transition-colors hover:bg-[var(--surface-base)] dark:border-[var(--border-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:`Cancel`}),(0,K.jsx)(`button`,{type:`submit`,disabled:!x,className:`rounded-lg bg-[var(--system-positive-strong)] px-4 py-2 text-body-medium-default text-white transition-colors hover:bg-[var(--system-positive-strong)] disabled:cursor-not-allowed disabled:opacity-50`,children:p?`Saving…`:`Save`})]})]})]})}),document.body)}function ke(e){return e.origin===`default`&&!e.userModified}function Ae(e,t){let n=new Set,r=[];for(let t of e)n.has(t.id)||(n.add(t.id),r.push(t));for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r.sort((e,t)=>e.tool===t.tool?e.description.localeCompare(t.description):e.tool.localeCompare(t.tool))}function je(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Q(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Me({assistantId:e,onClose:t}){let n=(0,G.useRef)(null),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(!0),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1),y=(0,G.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([N(e),N(e,{origin:`default`})]);return Ae(t,n)}return N(e)},[e]),x=(0,G.useCallback)(async()=>{o(!0);try{i(await y(m)),l(null)}catch(e){l(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[y,m]);(0,G.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await y(m);e||(i(t),l(null))}catch(t){e||l(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[y,m]);let S=(0,G.useCallback)(async()=>{if(f)try{await de(e,f.id),x()}catch(e){l(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{p(null)}},[e,f,x]);return(0,X.createPortal)((0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:n,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rules-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&t()},[t]),onClick:(0,G.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(b,{checked:m,onChange:h,label:`Show all defaults`}),(0,K.jsx)(c,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,K.jsx)(`div`,{className:`mb-3`,children:(0,K.jsx)(_,{tone:`error`,children:s})}),a?(0,K.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,K.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,K.jsx)(M,{className:`h-8 w-8`}),(0,K.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:`No trust rules yet. Rules are created when you classify actions from permission prompts.`})]}):(0,K.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=ke(e);return(0,K.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,K.jsx)(v,{tone:je(e.risk),children:Q(e.risk)}),e.origin===`default`&&(0,K.jsx)(v,{tone:`neutral`,children:`Default`}),e.userModified&&(0,K.jsx)(v,{tone:`warning`,children:`Modified`})]}),(0,K.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>d(e),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(w,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,K.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.tool} rule`,onClick:()=>p(e),className:`rounded-lg p-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(pe,{className:`h-4 w-4`})})]})]},e.id)})})]})]})}),u&&(0,K.jsx)(Oe,{assistantId:e,existingRule:u,onClose:()=>d(null),onSaved:()=>{d(null),x()}}),(0,K.jsx)(g,{open:f!==null,title:`Delete Trust Rule?`,message:f?`Remove the ${Q(f.risk).toLowerCase()}-risk rule for ${f.tool} matching "${f.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void S(),onCancel:()=>p(null)})]}),document.body)}function Ne(){let e=H(),[t,n]=(0,G.useState)(!1);return(0,K.jsxs)(m,{children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(M,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Manage per-tool rules that control which actions auto-approve and which require your explicit permission.`})]}),(0,K.jsx)(c,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,K.jsx)(Me,{assistantId:e,onClose:()=>n(!1)})]})}var Pe=[{value:`dontRetain`,label:`Don't retain`},{value:`oneHour`,label:`1 hour`},{value:`oneDay`,label:`1 day`},{value:`sevenDays`,label:`7 days`},{value:`thirtyDays`,label:`30 days`},{value:`ninetyDays`,label:`90 days`},{value:`keepForever`,label:`Keep forever`}],Fe=`thirtyDays`;function $(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Ie(){let e=P({platformHostedOnly:!0}),t=re(),a=t,o=ne.use.user()?.id??null,[s,c]=(0,G.useState)(()=>n(`shareAnalytics`,!0)),[l,u]=(0,G.useState)(()=>n(`shareDiagnostics`,!0)),[d,f]=(0,G.useState)(()=>i(`llmLogRetention`,Fe));return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(Te,{}),(0,K.jsx)(Ce,{}),(0,K.jsx)(Ne,{}),(0,K.jsx)(Ee,{}),(0,K.jsx)(U,{title:`Privacy`,subtitle:t?(0,K.jsxs)(K.Fragment,{children:[`View details about what data we collect and how it's used in our`,` `,(0,K.jsx)(`a`,{href:se(oe.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`privacy policy`}),`.`]}):void 0,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(W,{label:`Share Analytics`,helperText:`Send aggregated product usage data`,checked:s,onChange:()=>{let e=!s;c(e),j(`share_analytics`,e,{userId:o,hasPlatformSession:t})},variant:`toggle-trailing`}),(0,K.jsx)($,{}),(0,K.jsx)(W,{label:`Share Diagnostics`,helperText:`Send crash reports, conversation traces, and session replay data`,checked:l,onChange:()=>{let e=!l;u(e),j(`share_diagnostics`,e,{userId:o,hasPlatformSession:t})},variant:`toggle-trailing`}),(0,K.jsx)($,{})]}),(0,K.jsx)(we,{}),e!==`gated`&&(0,K.jsx)($,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:d,onChange:e=>{f(e),r(`llmLogRetention`,e)},options:Pe})}),(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:`How long to keep LLM request and response logs on this device. These logs record the prompts and completions sent to model providers and are used for debugging. Shorter retention improves privacy; longer retention helps troubleshoot issues.`})]})]})})]})}export{Ie as PrivacyPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,n,o as r,r as i,s as a}from"./device-settings-BBwtGKJb.js";import{t as o}from"./react-DJZBPgpf.js";import{O as s,t as c}from"./button-D7s2Q_uG.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./useMutation-Lj4VunQV.js";import{t as f}from"./jsx-runtime-CVSDxk6A.js";import{t as p}from"./cn-DvW5mxZR.js";import{t as m}from"./card-BibIM9x3.js";import{t as h}from"./dropdown-CL8VmqrY.js";import{t as g}from"./confirm-dialog-CfOXCE1N.js";import{t as _}from"./notice-CqRgVmeL.js";import{t as v}from"./tag-B_-QAvJF.js";import{t as y}from"./input-C8kfrq9r.js";import{t as b}from"./toggle-X_kQW5my.js";import{n as x}from"./toast-2TW5tj1Y.js";import{t as S}from"./chevron-right-B6vEpVY0.js";import{t as C}from"./loader-circle-IIzBGiwm.js";import{t as w}from"./pencil-DbB9rxpY.js";import{t as T}from"./x-KVxA2ZL0.js";import{C as E,D,E as O,M as k,O as A,S as ee,T as te,f as j,n as ne,r as re,w as ie}from"./auth-store-Kfxhs2oI.js";import{t as ae}from"./sdk.gen-D-_js_oC.js";import{a as oe,i as se}from"./routes-DVqkwUEe.js";import{n as ce,t as le}from"./react-query.gen-rp6Krcco.js";import{$i as ue,B as de,Gr as M,H as fe,Ir as pe,V as N,Zt as me,an as P,cn as F,g as I,h as L,in as R,ln as z,m as B,p as V,rn as he,sn as ge,x as _e}from"./index-PRnvH2Y1.js";import{t as H}from"./use-active-assistant-id-C-RHQ9f6.js";import{t as U}from"./detail-card-BIwpXT5F.js";import{t as W}from"./setting-row-o44aWwYt.js";var G=e(o(),1),K=f(),q=[{id:`accessibility`,type:`system`,sourceKind:`accessibility`,label:`Accessibility`,description:`Allows your assistant to click, type, and control apps on your behalf.`},{id:`screen`,type:`system`,sourceKind:`screen`,label:`Screen Recording`,description:`Allows your assistant to capture screen context during computer-use tasks.`},{id:`microphone`,type:`system`,sourceKind:`microphone`,label:`Microphone`,description:`Allows your assistant to capture audio for voice input and recordings.`},{id:`speechRecognition`,type:`system`,sourceKind:`speechRecognition`,label:`Speech Recognition`,description:`Allows your assistant to transcribe your speech into text on-device.`},{id:`notifications`,type:`system`,sourceKind:`notifications`,label:`Notifications`,description:`Allows your assistant to send macOS alerts for approvals, messages, and task updates.`}],ve=[{id:`notificationBadges`,type:`local`,label:`Notification Badges`,description:`Allows your assistant to show unseen conversation counts on the Dock icon.`}];function ye(){let[e,t]=(0,G.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function be(){let[e,r]=(0,G.useState)(()=>n(`dockBadgesEnabled`,!0));return(0,G.useEffect)(()=>a(`dockBadgesEnabled`,()=>{r(n(`dockBadgesEnabled`,!0))}),[]),[e,e=>{r(e),t(`dockBadgesEnabled`,e),e||me(0)}]}function xe({row:e,onToggle:t}){return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(b,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:p(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,K.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,K.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function Se(){return(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--content-tertiary)]`})}function Ce({compact:e=!1}){let{state:t,loading:n,error:r,supported:i,refresh:a}=z(),{pendingKind:o,run:s}=ye(),[c,l]=be(),u=(0,G.useMemo)(()=>{let e=new Map;if(!t)return e;for(let n of q){let r=t[n.sourceKind];r&&e.set(n.id,{meta:n,item:r})}return e},[t]),d=(0,G.useMemo)(()=>{let e=q.map(e=>{let t=u.get(e.id)?.item;return t?{id:e.id,label:e.label,description:e.description,checked:t.status===`granted`,disabled:o===e.id||t.status===`restricted`,...t.error?{error:t.error}:{}}:null}).filter(Boolean),t=ve.map(e=>({id:e.id,label:e.label,description:e.description,checked:c,disabled:o===e.id}));return[...e,...t]},[c,o,u]);if(!i)return null;let f=async(e,t)=>{t.status===`granted`||t.status===`denied`||!t.canRequest?await ge(e.sourceKind):await F(e.sourceKind),await a()},p=e=>{let t=u.get(e);if(t){s(e,()=>f(t.meta,t.item));return}e===`notificationBadges`&&s(e,async()=>{l(!c)})};return(0,K.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,K.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:`System Permissions`}),n&&d.length===0?(0,K.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,K.jsx)(Se,{}),`Checking permissions...`]}):(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,K.jsx)(xe,{row:e,onToggle:p},e.id))}),r&&(0,K.jsx)(`div`,{role:`alert`,className:`mt-6 rounded-lg border border-[color-mix(in_srgb,var(--system-negative-strong)_25%,transparent)] bg-[var(--system-negative-weak)] p-3 text-body-medium-lighter text-[var(--content-secondary)]`,children:r})]})}function we(){let e=P({platformHostedOnly:!0}),t=he(),n=R(),r=l(),{data:i,isLoading:a,isError:o}=u({...le(),enabled:e===`full`&&t}),s=d({mutationFn:async e=>{let{data:t}=await ae({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{ce(r,void 0,e),x.success(e?.access_consented?`Admin data access enabled.`:`Admin data access disabled.`)},onError:()=>{x.error(`Failed to update log access consent.`)}});if(e===`gated`)return null;let c=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||o||s.isPending;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow Staff Access`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:`When enabled, Vellum Staff will be able to access your assistant and its data for debugging purposes. It's suggested that you leave this off and only turn it on temporarily if you need Vellum Support's help in investigating an issue.`}),e===`full`&&o&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,K.jsxs)(K.Fragment,{children:[(s.isPending||c)&&(0,K.jsx)(C,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,K.jsx)(b,{checked:f,disabled:p,onChange:()=>s.mutate(!f)})]})})]}),e===`disabled`&&(0,K.jsx)(_e,{className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function Te(){let e=k(),[t,n]=(0,G.useState)(()=>te()),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(`Face ID`),[s,c]=(0,G.useState)(!1);if((0,G.useEffect)(()=>{e&&(ie().then(i),E().then(o))},[e]),!e||!r)return null;let l=async()=>{c(!0);try{if(t)O(!1),await ee(),n(!1);else{let e=A();e&&await D(e),O(!0),n(!0)}}finally{c(!1)}};return(0,K.jsx)(U,{title:`Security`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,a,` for sign-in`]}),(0,K.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`When your session expires, verify with `,a,` or your device passcode instead of signing in again.`]})]}),(0,K.jsx)(b,{checked:t,onChange:()=>void l(),disabled:s})]})})}function J(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var Y=V.map(e=>({value:e.id,label:e.label,icon:(0,K.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function Ee(){let e=H(),t=l(),{data:n,isError:r}=u({queryKey:[`thresholds`,e],queryFn:()=>L(e),staleTime:3e4}),[i,a]=(0,G.useState)(`relaxed`),[o,s]=(0,G.useState)(`conservative`),[c,d]=(0,G.useState)(`strict`),[f,p]=(0,G.useState)(!1),g=(0,G.useRef)(!1),[_,v]=(0,G.useState)(!1),y=(0,G.useRef)(null),b=(0,G.useRef)(null);(0,G.useEffect)(()=>{!n||g.current||(a(B(n.interactive).id),s(B(n.autonomous).id),d(B(n.headless).id),v(!0))},[n]),(0,G.useEffect)(()=>()=>{y.current!==null&&(clearTimeout(y.current),y.current=null,b.current?.(),b.current=null)},[]);let x=(0,G.useCallback)((n,r,i)=>{if(!e||!_)return;let a=V.find(e=>e.id===n)?.riskThreshold,o=V.find(e=>e.id===r)?.riskThreshold,s=V.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||I(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,_,t]),C=(0,G.useCallback)((e,t,n)=>{y.current!==null&&clearTimeout(y.current),b.current=()=>x(e,t,n),y.current=setTimeout(()=>{b.current?.(),y.current=null,b.current=null},500)},[x]),w=(0,G.useCallback)(e=>{g.current=!0,a(e),C(e,o,c)},[o,c,C]),T=(0,G.useCallback)(e=>{g.current=!0,s(e),C(i,e,c)},[i,c,C]),E=(0,G.useCallback)(e=>{g.current=!0,d(e),C(i,o,e)},[i,o,C]),D=V.find(e=>e.id===i),O=V.find(e=>e.id===o),k=V.find(e=>e.id===c),A=!e||!_;return(0,K.jsxs)(m,{children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Risk Tolerance`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Control which actions your assistant can take without asking first. Each action is classified by risk level — your tolerance determines which levels auto-approve.`}),r&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--system-negative-strong)]`,children:`Could not load threshold settings. Check your connection and reload.`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:i,onChange:w,options:Y,disabled:A})}),D&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:D.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":f,children:[f?(0,K.jsx)(ue,{className:`h-4 w-4`}):(0,K.jsx)(S,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,K.jsxs)(`div`,{className:f?`mt-4 space-y-4`:`hidden`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When your assistant acts without you — scheduled tasks, background jobs, and external triggers.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:o,onChange:T,options:Y,disabled:A})}),O&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:O.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:c,onChange:E,options:Y,disabled:A})}),k&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:k.description})]})]})]})]})]})}var X=e(s(),1),Z=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`],De=[{value:`low`,label:`Low`,description:`Auto-approve without prompting`},{value:`medium`,label:`Medium`,description:`Prompt before executing`},{value:`high`,label:`High`,description:`Always require explicit approval`}];function Oe({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,G.useRef)(null),[a,o]=(0,G.useState)(t.tool),[s,c]=(0,G.useState)(t.pattern),[l,u]=(0,G.useState)(t.risk),[d,f]=(0,G.useState)(t.description??``),[p,m]=(0,G.useState)(!1),[g,v]=(0,G.useState)(null),b=s.trim(),x=b.length>0&&!p,S=(0,G.useCallback)(async n=>{if(n.preventDefault(),!x)return;let i=d.trim()||`${a} — ${b}`;m(!0),v(null);try{await fe(e,t.id,{risk:l,description:i}),r()}catch(e){v(e instanceof Error?e.message:`Failed to save trust rule.`)}finally{m(!1)}},[e,x,d,t,r,l,a,b]);return(0,X.createPortal)((0,K.jsx)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rule-form-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&n()},[n]),onClick:(0,G.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[calc(100vh-2rem)] w-full max-w-md flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(T,{className:`h-4 w-4`})})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void S(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[g&&(0,K.jsx)(_,{tone:`error`,children:g}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,K.jsx)(`div`,{className:`mt-1`,children:(0,K.jsx)(h,{value:a,onChange:o,disabled:!0,options:Z.map(e=>({value:e,label:e}))})})]}),(0,K.jsx)(y,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,K.jsx)(`div`,{className:`mt-2 flex gap-2`,children:De.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>u(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${l===e.value?e.value===`low`?`border-[var(--system-positive-strong)] bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`:e.value===`medium`?`border-[var(--system-warning-strong)] bg-[var(--system-warning-weak)] text-[var(--system-warning-strong)]`:`border-[var(--system-negative-strong)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] text-[var(--content-default)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`div`,{children:e.label}),(0,K.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,K.jsx)(y,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`${a} — ${b||`pattern`}`}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-[var(--border-element)] bg-white px-4 py-2 text-body-medium-default text-[var(--content-default)] transition-colors hover:bg-[var(--surface-base)] dark:border-[var(--border-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:`Cancel`}),(0,K.jsx)(`button`,{type:`submit`,disabled:!x,className:`rounded-lg bg-[var(--system-positive-strong)] px-4 py-2 text-body-medium-default text-white transition-colors hover:bg-[var(--system-positive-strong)] disabled:cursor-not-allowed disabled:opacity-50`,children:p?`Saving…`:`Save`})]})]})]})}),document.body)}function ke(e){return e.origin===`default`&&!e.userModified}function Ae(e,t){let n=new Set,r=[];for(let t of e)n.has(t.id)||(n.add(t.id),r.push(t));for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r.sort((e,t)=>e.tool===t.tool?e.description.localeCompare(t.description):e.tool.localeCompare(t.tool))}function je(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Q(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Me({assistantId:e,onClose:t}){let n=(0,G.useRef)(null),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(!0),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1),y=(0,G.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([N(e),N(e,{origin:`default`})]);return Ae(t,n)}return N(e)},[e]),x=(0,G.useCallback)(async()=>{o(!0);try{i(await y(m)),l(null)}catch(e){l(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[y,m]);(0,G.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await y(m);e||(i(t),l(null))}catch(t){e||l(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[y,m]);let S=(0,G.useCallback)(async()=>{if(f)try{await de(e,f.id),x()}catch(e){l(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{p(null)}},[e,f,x]);return(0,X.createPortal)((0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:n,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rules-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&t()},[t]),onClick:(0,G.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(b,{checked:m,onChange:h,label:`Show all defaults`}),(0,K.jsx)(c,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,K.jsx)(`div`,{className:`mb-3`,children:(0,K.jsx)(_,{tone:`error`,children:s})}),a?(0,K.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,K.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,K.jsx)(M,{className:`h-8 w-8`}),(0,K.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:`No trust rules yet. Rules are created when you classify actions from permission prompts.`})]}):(0,K.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=ke(e);return(0,K.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,K.jsx)(v,{tone:je(e.risk),children:Q(e.risk)}),e.origin===`default`&&(0,K.jsx)(v,{tone:`neutral`,children:`Default`}),e.userModified&&(0,K.jsx)(v,{tone:`warning`,children:`Modified`})]}),(0,K.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>d(e),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(w,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,K.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.tool} rule`,onClick:()=>p(e),className:`rounded-lg p-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(pe,{className:`h-4 w-4`})})]})]},e.id)})})]})]})}),u&&(0,K.jsx)(Oe,{assistantId:e,existingRule:u,onClose:()=>d(null),onSaved:()=>{d(null),x()}}),(0,K.jsx)(g,{open:f!==null,title:`Delete Trust Rule?`,message:f?`Remove the ${Q(f.risk).toLowerCase()}-risk rule for ${f.tool} matching "${f.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void S(),onCancel:()=>p(null)})]}),document.body)}function Ne(){let e=H(),[t,n]=(0,G.useState)(!1);return(0,K.jsxs)(m,{children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(M,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Manage per-tool rules that control which actions auto-approve and which require your explicit permission.`})]}),(0,K.jsx)(c,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,K.jsx)(Me,{assistantId:e,onClose:()=>n(!1)})]})}var Pe=[{value:`dontRetain`,label:`Don't retain`},{value:`oneHour`,label:`1 hour`},{value:`oneDay`,label:`1 day`},{value:`sevenDays`,label:`7 days`},{value:`thirtyDays`,label:`30 days`},{value:`ninetyDays`,label:`90 days`},{value:`keepForever`,label:`Keep forever`}],Fe=`thirtyDays`;function $(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Ie(){let e=P({platformHostedOnly:!0}),t=re(),a=t,o=ne.use.user()?.id??null,[s,c]=(0,G.useState)(()=>n(`shareAnalytics`,!0)),[l,u]=(0,G.useState)(()=>n(`shareDiagnostics`,!0)),[d,f]=(0,G.useState)(()=>i(`llmLogRetention`,Fe));return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(Te,{}),(0,K.jsx)(Ce,{}),(0,K.jsx)(Ne,{}),(0,K.jsx)(Ee,{}),(0,K.jsx)(U,{title:`Privacy`,subtitle:t?(0,K.jsxs)(K.Fragment,{children:[`View details about what data we collect and how it's used in our`,` `,(0,K.jsx)(`a`,{href:se(oe.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`privacy policy`}),`.`]}):void 0,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(W,{label:`Share Analytics`,helperText:`Send aggregated product usage data`,checked:s,onChange:()=>{let e=!s;c(e),j(`share_analytics`,e,{userId:o,hasPlatformSession:t})},variant:`toggle-trailing`}),(0,K.jsx)($,{}),(0,K.jsx)(W,{label:`Share Diagnostics`,helperText:`Send crash reports, conversation traces, and session replay data`,checked:l,onChange:()=>{let e=!l;u(e),j(`share_diagnostics`,e,{userId:o,hasPlatformSession:t})},variant:`toggle-trailing`}),(0,K.jsx)($,{})]}),(0,K.jsx)(we,{}),e!==`gated`&&(0,K.jsx)($,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(h,{value:d,onChange:e=>{f(e),r(`llmLogRetention`,e)},options:Pe})}),(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:`How long to keep LLM request and response logs on this device. These logs record the prompts and completions sent to model providers and are used for debugging. Shorter retention improves privacy; longer retention helps troubleshoot issues.`})]})]})})]})}export{Ie as PrivacyPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{f as o}from"./local-mode-CvrNMtPF.js";import{t as s}from"./is-electron-C_ZTVhv8.js";import{M as c,d as l,i as u,n as d}from"./auth-store-Kfxhs2oI.js";import{a as f}from"./routes-DVqkwUEe.js";import{d as p,f as m,l as h,u as g}from"./prefs-C_oq5G87.js";import{t as _}from"./client-feature-flag-store-C1kdd1EO.js";import{kt as v}from"./index-BIDC22lX.js";import{a as y,c as b,i as x,n as S,o as C,t as w}from"./step-indicator-dots-D1EQV6VE.js";import{n as T,t as E}from"./consent-controls-BSZV4rW3.js";var D=e(t(),1);function O({researchOnboardingEnabled:e,isNative:t,isLocalMode:n}){return e&&!t&&!n?f.onboarding.research:f.onboarding.hatching}var k=a();function A(){let e=r(),[t]=i(),a=d.use.user()?.id??null,A=s(),j=c(),M=_.use.stringFlags().preChatOnboardingExperiment20260606??`control`,N=_.use.researchOnboarding(),P=C(M),[F,I]=g(),[L,R]=p(),[z,B]=m(),[V,H]=h(),U=u();(0,D.useEffect)(()=>{j||y()},[j]);let W=t.get(`preview`)===`true`,G=(0,D.useCallback)(e=>{},[]),K=W?G:I,q=W?G:R,J=W?G:B,Y=W?G:H,X=(0,D.useCallback)(()=>{if(W){e(`${f.onboarding.prechat}?preview=true`);return}if(l({userId:a,tos:z,privacy:V,shareAnalytics:F,shareDiagnostics:L,hasPlatformSession:U}),!j){let e=b(P);x(S.privacyTos,{userId:a,variant:e})}let n=t.get(`hosting`),r=new URLSearchParams;n&&r.set(`hosting`,n);let i=r.toString();e(`${O({researchOnboardingEnabled:N,isNative:j,isLocalMode:o()})}${i?`?${i}`:``}`)},[V,U,j,W,e,P,N,t,F,L,z,a]);return(0,k.jsx)(v,{children:(0,k.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${A?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[j&&(0,k.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,k.jsx)(w,{current:2,total:3})}),(0,k.jsx)(`h1`,{className:A?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Before You Start`}),(0,k.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${A?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Choose your privacy preferences. You can update these anytime in the Settings.`}),(0,k.jsx)(T,{electron:A,shareAnalytics:F,shareDiagnostics:L,onShareAnalyticsChange:K,onShareDiagnosticsChange:q,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`}}),(0,k.jsx)(E,{electron:A,privacyConsent:V,tosAccepted:z,onPrivacyChange:Y,onTosChange:J,className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`}}),(0,k.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${A?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,k.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!z||!V,onClick:X,className:A?void 0:`h-11 text-base`,children:`Start`}),(0,k.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(-1),className:A?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{A as PrivacyScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{f as o}from"./local-mode-CvrNMtPF.js";import{t as s}from"./is-electron-C_ZTVhv8.js";import{M as c,d as l,i as u,n as d}from"./auth-store-Kfxhs2oI.js";import{a as f}from"./routes-DVqkwUEe.js";import{d as p,f as m,l as h,u as g}from"./prefs-C_oq5G87.js";import{t as _}from"./client-feature-flag-store-C1kdd1EO.js";import{kt as v}from"./index-PRnvH2Y1.js";import{a as y,c as b,i as x,n as S,o as C,t as w}from"./step-indicator-dots-CEVbsP8r.js";import{n as T,t as E}from"./consent-controls-BSZV4rW3.js";var D=e(t(),1);function O({researchOnboardingEnabled:e,isNative:t,isLocalMode:n}){return e&&!t&&!n?f.onboarding.research:f.onboarding.hatching}var k=a();function A(){let e=r(),[t]=i(),a=d.use.user()?.id??null,A=s(),j=c(),M=_.use.stringFlags().preChatOnboardingExperiment20260606??`control`,N=_.use.researchOnboarding(),P=C(M),[F,I]=g(),[L,R]=p(),[z,B]=m(),[V,H]=h(),U=u();(0,D.useEffect)(()=>{j||y()},[j]);let W=t.get(`preview`)===`true`,G=(0,D.useCallback)(e=>{},[]),K=W?G:I,q=W?G:R,J=W?G:B,Y=W?G:H,X=(0,D.useCallback)(()=>{if(W){e(`${f.onboarding.prechat}?preview=true`);return}if(l({userId:a,tos:z,privacy:V,shareAnalytics:F,shareDiagnostics:L,hasPlatformSession:U}),!j){let e=b(P);x(S.privacyTos,{userId:a,variant:e})}let n=t.get(`hosting`),r=new URLSearchParams;n&&r.set(`hosting`,n);let i=r.toString();e(`${O({researchOnboardingEnabled:N,isNative:j,isLocalMode:o()})}${i?`?${i}`:``}`)},[V,U,j,W,e,P,N,t,F,L,z,a]);return(0,k.jsx)(v,{children:(0,k.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${A?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[j&&(0,k.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,k.jsx)(w,{current:2,total:3})}),(0,k.jsx)(`h1`,{className:A?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Before You Start`}),(0,k.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${A?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Choose your privacy preferences. You can update these anytime in the Settings.`}),(0,k.jsx)(T,{electron:A,shareAnalytics:F,shareDiagnostics:L,onShareAnalyticsChange:K,onShareDiagnosticsChange:q,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`}}),(0,k.jsx)(E,{electron:A,privacyConsent:V,tosAccepted:z,onPrivacyChange:Y,onTosChange:J,className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`}}),(0,k.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${A?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,k.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!z||!V,onClick:X,className:A?void 0:`h-11 text-base`,children:`Start`}),(0,k.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(-1),className:A?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{A as PrivacyScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Hr1Yo2kx.js";import{t as n}from"./react-DJZBPgpf.js";import{d as r,h as i,t as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{S as s,f as c}from"./local-mode-CvrNMtPF.js";import{F as l,K as u,V as d,n as f}from"./auth-store-Kfxhs2oI.js";import{c as p}from"./api-2kc3MHRz.js";import{a as m}from"./routes-DVqkwUEe.js";import{a as h,i as g}from"./login-flow-DPi11n3h.js";import{n as _}from"./index-BIDC22lX.js";import{r as v,t as y}from"./account-shell-b6GjlQ0u.js";var b=e(n(),1),x=o();function S(){let[e]=i(),n=r(),o=f.use.refreshSession(),S=e.get(`error`),[C,w]=(0,b.useState)(null),T=(0,b.useRef)(!1),E=e.get(`returnTo`),D=g(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await u(),r=l(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),c())try{let e=await p();if(e.ok&&e.data.length>0&&(await s(e.data,d.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=h({returnTo:E,fallback:e,authIntent:D});r?window.location.href=t:n(t,{replace:!0});break}case`provider_signup`:{let t=e.get(`returnTo`);n(t?`${m.account.providerSignup}?returnTo=${encodeURIComponent(t)}`:m.account.providerSignup,{replace:!0});break}case`error`:w(r.message);break}}catch(e){t(e,{context:`provider_callback`}),w(`Something went wrong. Please try signing in again.`)}})())},[D,S,o,E,n,e]),S===`signup_closed`?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Signups are currently closed`,subtitle:`Join the community to request access or learn when signups reopen.`}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Join the community`}),(0,x.jsx)(a,{to:m.account.login,className:`text-sm font-medium text-[var(--content-emphasised)] hover:underline`,children:`Back to sign in`})]})]}):S||C?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Authentication failed`,subtitle:C??`Something went wrong during social sign-in. Please try again or use a different method.`}),(0,x.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,x.jsx)(a,{to:m.account.login,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Back to sign in`})})]}):(0,x.jsx)(y,{children:(0,x.jsx)(v,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Hr1Yo2kx.js";import{t as n}from"./react-DJZBPgpf.js";import{d as r,h as i,t as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{S as s,f as c}from"./local-mode-CvrNMtPF.js";import{F as l,K as u,V as d,n as f}from"./auth-store-Kfxhs2oI.js";import{c as p}from"./api-2kc3MHRz.js";import{a as m}from"./routes-DVqkwUEe.js";import{a as h,i as g}from"./login-flow-DPi11n3h.js";import{n as _}from"./index-PRnvH2Y1.js";import{r as v,t as y}from"./account-shell-b6GjlQ0u.js";var b=e(n(),1),x=o();function S(){let[e]=i(),n=r(),o=f.use.refreshSession(),S=e.get(`error`),[C,w]=(0,b.useState)(null),T=(0,b.useRef)(!1),E=e.get(`returnTo`),D=g(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await u(),r=l(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),c())try{let e=await p();if(e.ok&&e.data.length>0&&(await s(e.data,d.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=h({returnTo:E,fallback:e,authIntent:D});r?window.location.href=t:n(t,{replace:!0});break}case`provider_signup`:{let t=e.get(`returnTo`);n(t?`${m.account.providerSignup}?returnTo=${encodeURIComponent(t)}`:m.account.providerSignup,{replace:!0});break}case`error`:w(r.message);break}}catch(e){t(e,{context:`provider_callback`}),w(`Something went wrong. Please try signing in again.`)}})())},[D,S,o,E,n,e]),S===`signup_closed`?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Signups are currently closed`,subtitle:`Join the community to request access or learn when signups reopen.`}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Join the community`}),(0,x.jsx)(a,{to:m.account.login,className:`text-sm font-medium text-[var(--content-emphasised)] hover:underline`,children:`Back to sign in`})]})]}):S||C?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Authentication failed`,subtitle:C??`Something went wrong during social sign-in. Please try again or use a different method.`}),(0,x.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,x.jsx)(a,{to:m.account.login,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Back to sign in`})})]}):(0,x.jsx)(y,{children:(0,x.jsx)(v,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};