@vellumai/web 0.8.9-staging.3 → 0.8.9-staging.5
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.
- package/dist/assets/{account-page-JOmrd7O5.js → account-page-DLWgiDpL.js} +1 -1
- package/dist/assets/add-credits-modal-KR3l-hlL.js +1 -0
- package/dist/assets/{advanced-page-DfQKcHki.js → advanced-page-CM1prrIX.js} +1 -1
- package/dist/assets/ai-page-DfYw7V-1.js +1 -0
- package/dist/assets/{api-key-screen-BFaPTjaE.js → api-key-screen-_pmVhsup.js} +1 -1
- package/dist/assets/{archive-page-BA9_f8tE.js → archive-page-C3-LAH2o.js} +1 -1
- package/dist/assets/{assistant-status-panel-B2a_ey3l.js → assistant-status-panel-AFf9Mjwp.js} +1 -1
- package/dist/assets/auth-store-CiQCAKS1.js +6 -0
- package/dist/assets/billing-page-o68CnS02.js +34 -0
- package/dist/assets/{chunk-5KNZJZUH-B4b1m-Ya.js → chunk-5KNZJZUH-DdS6bb-3.js} +2 -2
- package/dist/assets/{command-palette-BiZB4OSo.js → command-palette-BcHAzecz.js} +1 -1
- package/dist/assets/{community-page-j-8N5lFa.js → community-page-BCX3CsOx.js} +1 -1
- package/dist/assets/{connect-page-zFzMI9NA.js → connect-page-DXB8Xkpw.js} +1 -1
- package/dist/assets/{contacts-gateway-DjUsIJ09.js → contacts-gateway-DBRvewkn.js} +1 -1
- package/dist/assets/contacts-page-route-8pMuZN4b.js +1 -0
- package/dist/assets/danger-zone-redirect-page-G9ozZFrR.js +1 -0
- package/dist/assets/debug-page-CS2bRZp9.js +3 -0
- package/dist/assets/deploy-dialogs-EImApd6S.js +1 -0
- package/dist/assets/{developer-page-CZfUJHd7.js → developer-page-C6j4GZcn.js} +1 -1
- package/dist/assets/devices-page-C1id1sIt.js +1 -0
- package/dist/assets/{document-viewer-page-DP01_kUJ.js → document-viewer-page-D-zkJQlm.js} +1 -1
- package/dist/assets/{earn-credits-modal-QwO92K15.js → earn-credits-modal-RXLM_09P.js} +1 -1
- package/dist/assets/{emails-page-Bqv0y6Lp.js → emails-page-BFlPmeFT.js} +1 -1
- package/dist/assets/general-page-q3bvwcHU.js +1 -0
- package/dist/assets/{hatching-screen-B8RlGI3J.js → hatching-screen-6TxMgPxR.js} +1 -1
- package/dist/assets/home-page-route-mDiWda9f.js +1 -0
- package/dist/assets/{hosting-screen-DoltpG5X.js → hosting-screen-XKK-VeRo.js} +1 -1
- package/dist/assets/identity-page-route-BCiHzwmk.js +1 -0
- package/dist/assets/index-BjEJFZTJ.js +124 -0
- package/dist/assets/{inspect-page-Dmp2FUpn.js → inspect-page-BrUzgvle.js} +2 -2
- package/dist/assets/{install-Db4K638M.js → install-Uj6CrGld.js} +1 -1
- package/dist/assets/integrations-page-BL9LXHFe.js +1 -0
- package/dist/assets/{intelligence-layout-D96EIdSw.js → intelligence-layout-BwYGHEw7.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-page-LBckCCBl.js → keyboard-shortcuts-page-QHFTyWOo.js} +1 -1
- package/dist/assets/library-detail-page-nUyEDHke.js +1 -0
- package/dist/assets/library-page-B0AzCNkJ.js +1 -0
- package/dist/assets/{login-flow-CaZb4l04.js → login-flow-Bi4ujzeb.js} +1 -1
- package/dist/assets/{login-page-C-HGOjOK.js → login-page-BOH-K9Pj.js} +1 -1
- package/dist/assets/{logout-page-Dl5euYyX.js → logout-page-B1QXMyiH.js} +1 -1
- package/dist/assets/{logs-layout-BTlzvT2f.js → logs-layout-zcrIEQRy.js} +1 -1
- package/dist/assets/{memory-router-playground-page-BBlTxde7.js → memory-router-playground-page-CeZ4XMd2.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-9EUmVwhv.js → mobile-sidebar-drawer-BjPgVWjw.js} +1 -1
- package/dist/assets/notifications-page-omwlGRbj.js +1 -0
- package/dist/assets/{oauth-complete-page-AZTJJBVl.js → oauth-complete-page--ojS1AzN.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-CzA0WXr4.js → oauth-popup-complete-page-D5wVrngS.js} +2 -2
- package/dist/assets/password-reset-page-BJo9vGl_.js +1 -0
- package/dist/assets/{platform-loopback-page-CNTdcgsZ.js → platform-loopback-page--72P008D.js} +1 -1
- package/dist/assets/{plugin-detail-page-CS_wmEDi.js → plugin-detail-page-Co_JFwRa.js} +1 -1
- package/dist/assets/{plugins-page-CRtYNHW4.js → plugins-page-D7VpzRFc.js} +1 -1
- package/dist/assets/pre-chat-flow-BoePpEU7.js +1 -0
- package/dist/assets/privacy-page-DpKZ9VJG.js +1 -0
- package/dist/assets/{privacy-screen-qeQ2XoHu.js → privacy-screen-CEsX-1V3.js} +1 -1
- package/dist/assets/{provider-callback-page-C87AasMA.js → provider-callback-page-DDEEkkDM.js} +1 -1
- package/dist/assets/{provider-signup-page-CfbGs1zY.js → provider-signup-page-CZqSVAQl.js} +1 -1
- package/dist/assets/{review-terms-screen-BnGyRURw.js → review-terms-screen-CYFxXWmR.js} +1 -1
- package/dist/assets/routes-Dk5Qeryt.js +1 -0
- package/dist/assets/schedules-page-Dk-YbWK3.js +1 -0
- package/dist/assets/select-assistant-screen-CYpMf074.js +1 -0
- package/dist/assets/settings-layout-C_sqrv5S.js +1 -0
- package/dist/assets/share-feedback-modal-Cg8gci5A.js +1 -0
- package/dist/assets/{sidebar-tree-DyEHuZeN.js → sidebar-tree-Cme65q7r.js} +1 -1
- package/dist/assets/{signup-page-BTfxDffn.js → signup-page-BBM_CboU.js} +1 -1
- package/dist/assets/skills-page-J6mZv9bN.js +1 -0
- package/dist/assets/{sounds-page-CkLyWMqe.js → sounds-page-DpRhAAJv.js} +1 -1
- package/dist/assets/{step-indicator-dots-BjA1nnWA.js → step-indicator-dots-Dmj2aMuo.js} +1 -1
- package/dist/assets/{subagent-detail-panel-4B8mdN25.js → subagent-detail-panel-Dq-GDI61.js} +2 -2
- package/dist/assets/system-events-page-DNln669W.js +1 -0
- package/dist/assets/system-events-redirect-page-DY7BhERh.js +1 -0
- package/dist/assets/{tiptap-document-editor-D_JJ-i8w.js → tiptap-document-editor-DucA37Km.js} +1 -1
- package/dist/assets/tool-detail-panel-CwQTuANT.js +1 -0
- package/dist/assets/trace-page-CKTCZonQ.js +1 -0
- package/dist/assets/upgrade-cancel-page-BsW23ioD.js +1 -0
- package/dist/assets/upgrade-success-page-DqSBwFJv.js +1 -0
- package/dist/assets/{usage-page-DTCDhatY.js → usage-page-D6cPGTNn.js} +1 -1
- package/dist/assets/{use-current-platform-assistant-4FcCb-TC.js → use-current-platform-assistant-Cu95G65M.js} +1 -1
- package/dist/assets/use-is-org-ready-IPLcsl77.js +1 -0
- package/dist/assets/{use-oauth-complete-deep-link-listener-DODuMYm6.js → use-oauth-complete-deep-link-listener-BQZGv8sr.js} +1 -1
- package/dist/assets/{use-onboarding-login-CEqnm099.js → use-onboarding-login-Cd72-1Qe.js} +1 -1
- package/dist/assets/voice-page-D8IZifkA.js +1 -0
- package/dist/assets/{weather-forecast-display-CEt-zNG2.js → weather-forecast-display-DgqpUX3a.js} +1 -1
- package/dist/assets/{welcome-screen-3Gi6zm9f.js → welcome-screen-B2tizoBp.js} +1 -1
- package/dist/assets/workspace-page-Bu8beso_.js +1 -0
- package/dist/index.html +5 -5
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-D1PUmkv8.js +0 -1
- package/dist/assets/ai-page-BHdzWA1C.js +0 -1
- package/dist/assets/auth-store-oleg80LZ.js +0 -6
- package/dist/assets/billing-page-BtGA4D1N.js +0 -34
- package/dist/assets/contacts-page-route-CIhz_sJO.js +0 -1
- package/dist/assets/danger-zone-redirect-page-BOK4eL8M.js +0 -1
- package/dist/assets/debug-page-EPqbjJSc.js +0 -3
- package/dist/assets/deploy-dialogs-DlIjxp-4.js +0 -1
- package/dist/assets/devices-page-CjKo24zw.js +0 -1
- package/dist/assets/general-page-BSf6qSem.js +0 -1
- package/dist/assets/home-page-route-D3PEij2C.js +0 -1
- package/dist/assets/identity-page-route-MDSvMuG9.js +0 -1
- package/dist/assets/index-DM63H2B6.js +0 -124
- package/dist/assets/integrations-page-DKhH4frU.js +0 -1
- package/dist/assets/library-detail-page-T4MedcS4.js +0 -1
- package/dist/assets/library-page-RtbQs7L5.js +0 -1
- package/dist/assets/notifications-page-DlDftqR1.js +0 -1
- package/dist/assets/password-reset-page-DyimUxBH.js +0 -1
- package/dist/assets/pre-chat-flow-BDhreJ7B.js +0 -1
- package/dist/assets/privacy-page-C1kpEJg_.js +0 -1
- package/dist/assets/routes-DMbyM_oF.js +0 -1
- package/dist/assets/schedules-page-DL7EfeDQ.js +0 -1
- package/dist/assets/select-assistant-screen-BGPc4tCz.js +0 -1
- package/dist/assets/settings-layout-Ce4VYURq.js +0 -1
- package/dist/assets/share-feedback-modal-le4GoR2Z.js +0 -1
- package/dist/assets/skills-page-D_8aU82C.js +0 -1
- package/dist/assets/system-events-page-BuSkwmMl.js +0 -1
- package/dist/assets/system-events-redirect-page-Dq56rHVE.js +0 -1
- package/dist/assets/tool-detail-panel-WvA0b4nW.js +0 -1
- package/dist/assets/trace-page-Ckyukuwf.js +0 -1
- package/dist/assets/upgrade-cancel-page-C_KXGnp0.js +0 -1
- package/dist/assets/upgrade-success-page-yvoI0p_k.js +0 -1
- package/dist/assets/use-is-org-ready-tTrrZoWV.js +0 -1
- package/dist/assets/voice-page-pG9E3NoZ.js +0 -1
- package/dist/assets/workspace-page-DNw6D4Sj.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./useQuery-D2zf6Uhu.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./button-DdEh-9f_.js";import{t as a}from"./card-CL5iEMJO.js";import"./src-hn7lwVCD.js";import{t as o}from"./tag-Ccr7Quy6.js";import{t as s}from"./createLucideIcon-D6d6iDdi.js";import{t as c}from"./globe-ByNYDdSW.js";import{t as l}from"./loader-circle-BSAFLoPH.js";import{kn as u}from"./sdk.gen-AJllUeDf.js";import{N as d,P as f}from"./react-query.gen-B8xaBreR.js";import{n as p,r as m,t as h}from"./api-errors-ChauV4ed.js";import{
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./useQuery-D2zf6Uhu.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./button-DdEh-9f_.js";import{t as a}from"./card-CL5iEMJO.js";import"./src-hn7lwVCD.js";import{t as o}from"./tag-Ccr7Quy6.js";import{t as s}from"./createLucideIcon-D6d6iDdi.js";import{t as c}from"./globe-ByNYDdSW.js";import{t as l}from"./loader-circle-BSAFLoPH.js";import{kn as u}from"./sdk.gen-AJllUeDf.js";import{N as d,P as f}from"./react-query.gen-B8xaBreR.js";import{n as p,r as m,t as h}from"./api-errors-ChauV4ed.js";import{La as g,Ni as _,Oi as v,Pa as y,Pi as b,bo as x,ta as S,xo as C}from"./index-BjEJFZTJ.js";import{n as w,t as T}from"./file-markdown-DX5x9ziL.js";var E=s(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),D=e(t(),1),O=r();function k({skill:e,className:t,fallback:n=`🧩`}){let[r,i]=(0,D.useState)(!1);return e.icon&&!r?(0,O.jsx)(`img`,{src:`/assistant/skills/${e.id}/${e.icon}`,alt:``,className:`${t} object-contain`,onError:()=>i(!0)}):(0,O.jsx)(`span`,{className:t,children:e.emoji??n})}var A={vellum:{label:`Vellum`,icon:E},clawhub:{label:`Clawhub`,icon:c},skillssh:{label:`skills.sh`,icon:b},custom:{label:`Custom`,icon:v}};function j({origin:e}){let t=e in A?A[e]:{label:e.replace(/-/g,` `),icon:S};return(0,O.jsx)(o,{tone:`neutral`,leftIcon:(0,D.createElement)(t.icon),className:`capitalize`,children:t.label})}function M(e){return e.kind===`installed`||e.kind===`bundled`}function N(e){return e.kind===`catalog`}function P(e){return e.kind===`installed`}function F({assistantId:e,skill:t,onBack:r,onInstall:o,onRemove:s,isInstalling:c=!1,isRemoving:u=!1}){let[p,m]=(0,D.useState)(null),h=N(t),v=P(t),b=n({...f({path:{assistant_id:e,id:t.id}}),select:e=>e??null}),S=(0,D.useMemo)(()=>b.data?.files??[],[b.data]),w=(0,D.useMemo)(()=>S.find(e=>e.name===`SKILL.md`),[S]),T=p??w?.path??null,E=n({...d({path:{assistant_id:e,id:t.id},query:{path:T??``}}),select:e=>e??null,enabled:!!T}),A=S.find(e=>e.path===T);return(0,O.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,O.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,O.jsx)(x,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:r}),(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,O.jsx)(k,{skill:t,className:`h-8 w-8 text-3xl`}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,O.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,O.jsx)(j,{origin:t.origin})]}),(0,O.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description})]})]}),h?c?(0,O.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,O.jsx)(l,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,O.jsx)(i,{type:`button`,onClick:o,disabled:!o,leftIcon:(0,O.jsx)(C,{"aria-hidden":!0}),children:`Install`}):(0,O.jsx)(i,{type:`button`,variant:v?`dangerOutline`:`outlined`,onClick:s,disabled:!v||u||!s,leftIcon:u?(0,O.jsx)(l,{className:`animate-spin`,"aria-hidden":!0}):(0,O.jsx)(_,{"aria-hidden":!0}),children:`Remove`})]})]}),(0,O.jsx)(a.Root,{asChild:!0,noPadding:!0,children:(0,O.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,O.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto border-b p-2 sm:max-h-none sm:border-b-0 sm:border-r`,style:{borderColor:`var(--border-base)`},children:b.isLoading?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,O.jsx)(l,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):S.length===0?(0,O.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files available.`}):S.map(e=>{let t=T===e.path,n=(e.mimeType??``).endsWith(`/directory`);return(0,O.jsxs)(`button`,{type:`button`,onClick:()=>m(e.path),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:t?`var(--primary-base)`:`var(--content-default)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:void 0},children:[n?(0,O.jsx)(y,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,O.jsx)(g,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,O.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:E.isLoading?(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,O.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):A?(0,O.jsx)(I,{fileName:A.name,content:E.data?.content??null,isBinary:!!E.data?.isBinary}):(0,O.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]})}function I({fileName:e,content:t,isBinary:n}){return n?(0,O.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`}):t===null?(0,O.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,e,`.`]}):w(e,void 0)?(0,O.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,O.jsx)(T,{content:t})}):(0,O.jsx)(`pre`,{className:`h-full overflow-auto p-4 font-mono text-body-small-default`,style:{color:`var(--content-default)`},children:t})}async function L(e,t,n){let{data:r,error:i,response:a}=await u({path:{assistant_id:e},body:n?{slug:t,version:n}:{slug:t},throwOnError:!1});if(p(a,i,`Failed to install skill.`),!a.ok)throw new h(a.status,m(i,a,`Failed to install skill.`));return r??{ok:!0}}export{P as a,E as c,M as i,F as n,j as o,N as r,k as s,L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{r as t,s as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./capture-error-CZsNGL6n.js";import{t as i}from"./react-DJZBPgpf.js";import{d as a,h as o}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as s}from"./QueryClientProvider-DNHWXaGq.js";import{t as c}from"./useQuery-D2zf6Uhu.js";import{t as l}from"./useMutation-BuofVRHk.js";import{t as u}from"./jsx-runtime-CVSDxk6A.js";import{t as d}from"./button-DdEh-9f_.js";import{t as f}from"./card-CL5iEMJO.js";import{t as p}from"./confirm-dialog-NYG-K9zN.js";import{t as m}from"./notice-CF2pptne.js";import{n as h,r as g,t as _}from"./panel-item-FzMfzMJA.js";import{t as v}from"./input-Cu3PPVCq.js";import{n as y}from"./toast-DU1nH33j.js";import{t as b}from"./external-link-BCB1rbW9.js";import{t as x}from"./loader-circle-BSAFLoPH.js";import{t as S}from"./pencil-BA9LOIzP.js";import{t as C}from"./x-BDqbYVtS.js";import{$t as w,Qt as T,Xt as E,Zt as D,en as O,nn as k,rn as A,tn as j}from"./sdk.gen-AJllUeDf.js";import{r as M}from"./api-errors-ChauV4ed.js";import{O as ee}from"./auth-store-CiQCAKS1.js";import{r as N}from"./api-DEEx3e9R.js";import{i as P}from"./routes-Dk5Qeryt.js";import{n as F}from"./use-is-mobile-D_xrnINF.js";import{Bi as I,Ct as L,G as R,Ja as z,M as B,Ni as V,O as H,St as te,W as ne,Yi as U,bt as W,et as G,j as K,k as re,mo as q,na as J,po as Y,so as ie,xt as ae}from"./index-BjEJFZTJ.js";import{t as oe}from"./use-oauth-complete-deep-link-listener-BQZGv8sr.js";var X=e(i(),1);async function se(e){let{data:t,error:n}=await A({path:{assistant_id:e},throwOnError:!1});if(n||!t)throw Error(`Failed to fetch OAuth providers`);return t.providers}async function ce(e,t){let{data:n,error:r}=await k({path:{assistant_id:e,providerKey:t},throwOnError:!1});if(r||!n)throw Error(`Failed to fetch OAuth provider detail`);return{oauth_callback_url:n.oauth_callback_url??null}}function Z(e,t){if(e&&typeof e==`object`){let t=e;if(t.error?.message)return t.error.message;if(t.detail)return t.detail;if(t.message)return t.message}return t}async function le(e,t){let{data:n,error:r}=await w({path:{assistant_id:e},query:{provider_key:t},throwOnError:!1});if(r||!n)throw Error(Z(r,`Failed to load OAuth apps`));return n.apps}async function ue(e,t){let{data:n,error:r}=await O({path:{assistant_id:e},body:t,throwOnError:!1});if(r||!n)throw Error(Z(r,`Failed to create OAuth app`));return n.app}async function de(e,t){let{error:n}=await T({path:{assistant_id:e,id:t},throwOnError:!1});if(n)throw Error(Z(n,`Failed to delete OAuth app`))}async function fe(e,t){let{data:n,error:r}=await D({path:{assistant_id:e,appId:t},throwOnError:!1});if(r||!n)throw Error(Z(r,`Failed to load OAuth app connections`));return n.connections}async function pe(e,t){let{error:n}=await j({path:{assistant_id:e,id:t},throwOnError:!1});if(n)throw Error(Z(n,`Failed to disconnect OAuth account`))}async function me(e,t,n){let{data:r,error:i}=await E({path:{assistant_id:e,appId:t},body:{callback_transport:`gateway`,scopes:n??[]},throwOnError:!1});if(i||!r)throw Error(Z(i,`Failed to start OAuth flow`));if(!(`auth_url`in r))throw Error(`OAuth flow did not return an authorization URL`);return{authUrl:r.auth_url,state:r.state}}function he(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function ge(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}var Q=u();function _e(e){return new Promise(t=>setTimeout(t,e))}function ve(e){return JSON.stringify({status:e.status,connected:e.connected,account_label:e.account_label,scopes_granted:[...e.scopes_granted].sort(),expires_at:e.expires_at})}function ye(e,t){return new Map((e??[]).filter(e=>e.provider===t).map(e=>[e.id,ve(e)]))}function be(e,t,n){return e.some(e=>e.provider===t&&e.connected&&n.get(e.id)!==ve(e))}function xe({assistantId:e,providerKey:t,displayName:n,description:r,logoUrl:i,platformGate:a,onClose:o}){let u=s(),f=ee(),h=a===`full`,[g,_]=(0,X.useState)(a===`gated`?`your-own`:`managed`),[v,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(null),[O,k]=(0,X.useState)(!1),A=(0,X.useCallback)(()=>{T.current=null,k(!1)},[]),j=(0,X.useCallback)(()=>{w.current&&!w.current.closed&&w.current.close(),w.current=null,E.current&&=(clearInterval(E.current),null),D.current&&=(clearTimeout(D.current),null)},[]),N=ae({path:{assistant_id:e}}),F=(0,X.useCallback)(e=>{if(e.type!==`vellum:oauth-complete`||!T.current||e.requestId!==T.current.requestId)return;let{oauthStatus:t,oauthCode:r}=e;if(j(),A(),t===`connected`)y.success(`${n} account connected.`),u.invalidateQueries({queryKey:N});else{let e=r?`Error: ${r}`:`Authorization failed`;y.error(`${n} ${e}`)}},[A,j,N,n,u]),I=(0,X.useCallback)(async n=>{if(!h)return!1;for(let r=0;r<8;r+=1){r>0&&await _e(750);try{if(u.invalidateQueries({queryKey:N}),be(await u.fetchQuery({...W({path:{assistant_id:e}}),staleTime:0}),t,n))return!0}catch{}}return!1},[e,N,h,t,u]);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};document.addEventListener(`keydown`,e);let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,e),document.body.style.overflow=t}},[o]),(0,X.useEffect)(()=>{let e=e=>{let t=T.current;if(!t)return;let n=H(e,window.location.origin,t.requestId);n&&F(n)},t=e=>{let t=T.current;if(!t)return;let n=re(e,t.requestId);n&&(F(n),window.localStorage.removeItem(K(t.requestId)))};return window.addEventListener(`message`,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`storage`,t)}},[F]),oe((0,X.useCallback)(e=>{let t=T.current;t&&e.requestId===t.requestId&&F({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[F])),(0,X.useEffect)(()=>R(()=>{let e=T.current;e&&(async()=>{let t=await I(e.baselineConnectionSignatures);T.current&&(A(),t&&y.success(`${n} account connected.`))})()}),[A,I,n]),(0,X.useEffect)(()=>()=>{E.current&&clearInterval(E.current),D.current&&clearTimeout(D.current),w.current&&!w.current.closed&&w.current.close()},[]);let{data:z,isLoading:V}=c({...W({path:{assistant_id:e}}),enabled:h}),U=(z??[]).filter(e=>e.provider===t&&e.connected),G=l({...L()}),q=l({...te(),onSuccess(e,t){y.success(`${n} account disconnected.`);let r=t.path.connection_id;u.setQueryData(N,e=>e?.filter(e=>e.id!==r)),u.invalidateQueries({queryKey:N}),b(null)},onError(e){let t=M(e,void 0,`Failed to disconnect ${n} account.`);y.error(t),b(null)}}),J=(0,X.useCallback)(()=>{if(!h)return;let r=crypto.randomUUID();if(f){k(!0),T.current={requestId:r,provider:t,baselineConnectionSignatures:ye(u.getQueryData(N)??z,t)},G.mutate({path:{assistant_id:e,provider:t},body:{requested_scopes:[],redirect_after_connect:`${P.account.oauth.popupComplete}?requestId=${r}&native=1`}},{onSuccess(e){ne(e.connect_url)},onError(e){A();let t=M(e,void 0,`Failed to start ${n} authorization.`);y.error(t)}});return}let i=window.open(``,`_blank`,`width=500,height=600`);if(i===null){y.error(`Popup blocked. Please enable popups and try again.`);return}w.current=i,k(!0),T.current={requestId:r,provider:t,baselineConnectionSignatures:ye(u.getQueryData(N)??z,t)},E.current=setInterval(()=>{w.current&&w.current.closed&&T.current&&!D.current&&(D.current=setTimeout(async()=>{D.current=null;let e=T.current;if(!e)return;let t=window.localStorage.getItem(K(e.requestId));if(t)try{F(JSON.parse(t)),window.localStorage.removeItem(K(e.requestId));return}catch{}let r=await I(e.baselineConnectionSignatures);if(T.current){if(r){j(),A(),y.success(`${n} account connected.`);return}j(),A(),y.error(`${n} connection failed: authorization popup closed.`)}},1e3))},100),G.mutate({path:{assistant_id:e,provider:t},body:{requested_scopes:[],redirect_after_connect:`${P.account.oauth.popupComplete}?requestId=${r}`}},{onSuccess(e){w.current&&!w.current.closed?w.current.location.href=e.connect_url:T.current&&(j(),A(),y.error(`${n} connection failed: popup closed.`))},onError(e){j(),A();let t=M(e,void 0,`Failed to start ${n} authorization.`);y.error(t)}})},[e,t,n,z,N,u,A,j,F,I,G,f,h]),Y=e=>{S(e)},ie=()=>{let t=x;S(null),t&&(b(t.id),q.mutate({path:{assistant_id:e,connection_id:t.id}}))},se=r?`Configure ${n} OAuth for ${r}`:`Configure ${n} OAuth`;return(0,Q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,children:[(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`integration-modal-title`,className:`flex w-full max-w-[520px] flex-col overflow-hidden rounded-xl bg-white shadow-xl dark:bg-[var(--surface-lift)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-[var(--border-base)] px-5 py-4 dark:border-[var(--border-base)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(B,{providerKey:t,displayName:n,logoUrl:i,size:32}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`h2`,{id:`integration-modal-title`,className:`text-title-small text-[var(--content-default)]`,children:[n,` OAuth`]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:se})]})]}),(0,Q.jsx)(d,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(C,{}),"aria-label":`Close`,onClick:o})]}),(0,Q.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[a!==`gated`&&(0,Q.jsxs)(`div`,{role:`tablist`,"aria-label":`OAuth mode`,className:`flex w-full rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-0.5 dark:border-[var(--border-base)] dark:bg-[var(--surface-base)]/40`,children:[(0,Q.jsx)(Se,{active:g===`managed`,onClick:()=>_(`managed`),children:`Managed`}),(0,Q.jsx)(Se,{active:g===`your-own`,onClick:()=>_(`your-own`),children:`Your Own`})]}),g===`managed`&&a!==`gated`?a===`disabled`?(0,Q.jsx)(m,{tone:`info`,children:`Log in to the Vellum platform to manage OAuth connections.`}):(0,Q.jsx)(Ce,{displayName:n,providerKey:t,logoUrl:i,connections:U,connectionsLoading:V,startPending:G.isPending,oauthInProgress:O,disconnectingId:q.isPending?v:null,onConnect:J,onDisconnect:Y}):(0,Q.jsx)(we,{assistantId:e,providerKey:t,displayName:n,logoUrl:i})]}),(0,Q.jsx)(`div`,{className:`flex justify-end border-t border-[var(--border-base)] px-5 py-3 dark:border-[var(--border-base)]`,children:(0,Q.jsx)(d,{variant:`outlined`,size:`compact`,onClick:o,children:`Confirm`})})]}),(0,Q.jsx)(p,{open:x!==null,title:`Disconnect ${n}?`,message:x?`Disconnect ${x.account_label??`${n} Account`}? You can reconnect later.`:``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:ie,onCancel:()=>S(null)})]})}function Se({active:e,onClick:t,children:n}){return(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:`flex-1 cursor-pointer rounded-[5px] px-3 py-1.5 text-body-medium-default transition-colors ${e?`bg-white text-[var(--content-default)] shadow-sm dark:bg-[var(--surface-lift)] dark:text-[var(--content-default)]`:`text-[var(--content-secondary)] hover:text-[var(--content-default)] dark:text-[var(--content-disabled)] dark:hover:text-[var(--content-default)]`}`,children:n})}function Ce({displayName:e,providerKey:t,logoUrl:n,connections:r,connectionsLoading:i,startPending:a,oauthInProgress:o,disconnectingId:s,onConnect:c,onDisconnect:l}){return i?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(x,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):r.length===0?a||o?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,Q.jsx)(B,{providerKey:t,displayName:e,logoUrl:n,size:48}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}),`Waiting for authorization...`]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,Q.jsx)(B,{providerKey:t,displayName:e,logoUrl:n,size:48}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Connect Account to continue`}),(0,Q.jsx)(d,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(J,{}),onClick:c,disabled:a||o,children:`Connect Account`})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:[(0,Q.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(r=>{let i=s===r.id;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,Q.jsx)(B,{providerKey:t,displayName:e,logoUrl:n,size:20}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-default text-[var(--content-default)]`,children:r.account_label??`${e} Account`}),(0,Q.jsx)(d,{variant:`dangerOutline`,size:`compact`,iconOnly:i?(0,Q.jsx)(x,{className:`animate-spin`}):(0,Q.jsx)(V,{}),onClick:()=>l(r),disabled:i,"aria-label":`Disconnect ${r.account_label??`${e} account`}`})]},r.id)})}),(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-base)] px-4 py-3 dark:border-[var(--border-base)]`,children:a||o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}),`Waiting for authorization...`]}):(0,Q.jsx)(d,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(b,{}),onClick:c,disabled:a||o,children:`Connect account`})})]})}function we({assistantId:e,providerKey:t,displayName:n,logoUrl:r}){let[i,a]=(0,X.useState)([]),[o,s]=(0,X.useState)({}),[c,l]=(0,X.useState)(!0),[u,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),[_,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(null),[ee,N]=(0,X.useState)(null),[P,F]=(0,X.useState)(null),[I,L]=(0,X.useState)(null),R=(0,X.useCallback)(async t=>{try{let n=await fe(e,t);s(e=>({...e,[t]:n}))}catch(e){let t=e instanceof Error?e.message:`Failed to load connections`;y.error(t)}},[e]),H=(0,X.useCallback)(async()=>{l(!0);try{let n=await le(e,t);a(n),await Promise.all(n.map(e=>R(e.id)))}catch(e){let t=e instanceof Error?e.message:`Failed to load OAuth apps`;y.error(t)}finally{l(!1)}},[e,t,R]);(0,X.useEffect)(()=>{H()},[H]),(0,X.useEffect)(()=>{let n=!0;return ce(e,t).then(e=>{n&&E(e.oauth_callback_url)},()=>{}),()=>{n=!1}},[e,t]);let te=i.length===0||u,ne=async()=>{if(!(!h.trim()||!_.trim())){w(!0);try{let r=await ue(e,{provider_key:t,client_id:h.trim(),client_secret:_.trim()});a(e=>[...e,r]),s(e=>({...e,[r.id]:[]})),g(``),S(``),m(!1),y.success(`${n} OAuth app added.`)}catch(e){let t=e instanceof Error?e.message:`Failed to create OAuth app`;y.error(t)}finally{w(!1)}}},U=e=>{F(e)},W=async()=>{let t=P;if(F(null),t){A(t.id);try{await de(e,t.id),a(e=>e.filter(e=>e.id!==t.id)),s(e=>{let n={...e};return delete n[t.id],n}),y.success(`OAuth app deleted.`)}catch(e){let t=e instanceof Error?e.message:`Failed to delete OAuth app`;y.error(t)}finally{A(null)}}},G=async t=>{M(t.id);try{let{authUrl:n}=await me(e,t.id);window.location.href=n}catch(e){let t=e instanceof Error?e.message:`Failed to start OAuth flow`;y.error(t),M(null)}},K=(e,t)=>{L({appId:e,connection:t})},re=async()=>{let t=I;if(L(null),!t)return;let{appId:r,connection:i}=t;N(i.id);try{await pe(e,i.id),s(e=>({...e,[r]:(e[r]??[]).filter(e=>e.id!==i.id)})),y.success(`${n} account disconnected.`)}catch(e){let t=e instanceof Error?e.message:`Failed to disconnect account`;y.error(t)}finally{N(null)}};return c?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(x,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[te?(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:i.length===0?`Add your own ${n} OAuth app`:`Add another ${n} OAuth app`}),(0,Q.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-tertiary)]`,children:`Credentials are stored encrypted on the assistant and are never sent to Vellum.`})]}),T?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Redirect URL`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(v,{type:`text`,value:T,readOnly:!0,fullWidth:!0}),(0,Q.jsx)(d,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{navigator.clipboard.writeText(T).then(()=>{O(!0),y.success(`Copied to clipboard!`),setTimeout(()=>O(!1),2e3)})},"aria-label":D?`Copied`:`Copy redirect URL`,iconOnly:D?(0,Q.jsx)(q,{"aria-hidden":!0}):(0,Q.jsx)(z,{"aria-hidden":!0})})]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add this URL to your OAuth app's redirect settings.`})]}):null,(0,Q.jsx)(v,{label:`Client ID`,type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Enter your client ID`,fullWidth:!0}),(0,Q.jsx)(v,{label:`Client Secret`,type:`password`,value:_,onChange:e=>S(e.target.value),placeholder:`Enter your client secret`,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[i.length>0?(0,Q.jsx)(d,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{m(!1),g(``),S(``)},disabled:C,children:`Cancel`}):null,(0,Q.jsx)(d,{type:`button`,size:`compact`,onClick:ne,disabled:C||!h.trim()||!_.trim(),leftIcon:C?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(J,{"aria-hidden":!0}),children:`Add App`})]})]})}):null,i.map(e=>{let i=o[e.id]??[],a=k===e.id,s=j===e.id;return(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Q.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:he(e.client_id)}),(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Added `,ge(e.created_at)]})]}),(0,Q.jsx)(d,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>U(e),disabled:a,"aria-label":`Delete OAuth app ${he(e.client_id)}`,iconOnly:a?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(V,{"aria-hidden":!0})})]}),i.length>0?(0,Q.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:i.map(i=>{let a=ee===i.id;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Q.jsx)(B,{providerKey:t,displayName:n,logoUrl:r,size:18}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:i.account_info??`${n} Account`}),(0,Q.jsx)(d,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>K(e.id,i),disabled:a,"aria-label":`Disconnect ${i.account_info??`${n} account`}`,iconOnly:a?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(V,{"aria-hidden":!0})})]},i.id)})}):null,(0,Q.jsx)(d,{type:`button`,size:`compact`,onClick:()=>G(e),disabled:s,className:`w-full`,leftIcon:s?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(b,{"aria-hidden":!0}),children:s?`Waiting for authorization...`:`Connect account`})]})},e.id)}),i.length>0&&!u?(0,Q.jsx)(d,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>m(!0),className:`w-full border-dashed`,leftIcon:(0,Q.jsx)(J,{"aria-hidden":!0}),children:`Add Another App`}):null,(0,Q.jsx)(p,{open:P!==null,title:`Delete OAuth app`,message:P?`Delete OAuth app '${he(P.client_id)}'? This will disconnect all linked accounts.`:``,confirmLabel:`Delete`,destructive:!0,onConfirm:()=>{W()},onCancel:()=>F(null)}),(0,Q.jsx)(p,{open:I!==null,title:`Disconnect ${n}?`,message:I?`Disconnect ${I.connection.account_info??`${n} Account`}? You can reconnect later.`:``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{re()},onCancel:()=>L(null)})]})}function Te({assistantId:e,providerKey:t,displayName:n,description:r,logoUrl:i,connection:a,platformGate:o,onConfigure:c}){let u=s(),m=!!a?.connected,[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),b=F(),x=ae({path:{assistant_id:e}}),S=l({...te(),onSuccess(e,t){y.success(`${n} account disconnected.`);let r=t.path.connection_id;u.setQueryData(x,e=>e?.filter(e=>e.id!==r)),u.invalidateQueries({queryKey:x})},onError(e){let t=M(e,void 0,`Failed to disconnect ${n} account.`);y.error(t)}}),C=()=>{a?.id&&v(!0)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{padding:`sm`,className:`flex items-center gap-4 px-4`,children:[(0,Q.jsx)(B,{providerKey:t,displayName:n,logoUrl:i,size:32}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-title-small text-[var(--content-default)]`,children:n}),r&&(0,Q.jsx)(`p`,{className:`truncate text-body-medium-lighter text-[var(--content-tertiary)]`,children:r})]}),m&&o===`full`?(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(Ee,{displayName:n,open:h,onOpenChange:g,onEditConnections:()=>{g(!1),c()},onDisable:()=>{g(!1),C()},disablePending:S.isPending,isMobile:b})}):(0,Q.jsx)(d,{variant:`primary`,onClick:c,className:`shrink-0`,children:`Enable`})]})}),(0,Q.jsx)(p,{open:_,title:`Disconnect ${n}?`,message:`Disconnect your ${n} account? You can reconnect it later.`,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{v(!1),a?.id&&S.mutate({path:{assistant_id:e,connection_id:a.id}})},onCancel:()=>v(!1)})]})}function Ee({displayName:e,open:t,onOpenChange:n,onEditConnections:r,onDisable:i,disablePending:a,isMobile:o}){return o?(0,Q.jsxs)(h.Root,{open:t,onOpenChange:n,children:[(0,Q.jsx)(h.Trigger,{asChild:!0,children:(0,Q.jsx)(d,{variant:`outlined`,rightIcon:(0,Q.jsx)(Y,{}),"aria-haspopup":`menu`,"aria-expanded":t,children:`Configure`})}),(0,Q.jsxs)(h.Content,{children:[(0,Q.jsx)(h.Header,{children:(0,Q.jsx)(h.Title,{children:e})}),(0,Q.jsxs)(h.Body,{children:[(0,Q.jsx)(_,{icon:S,label:`Edit connections`,onSelect:r}),(0,Q.jsx)(_,{icon:a?x:ie,label:`Disable`,onSelect:()=>{a||i()}})]})]})]}):(0,Q.jsxs)(g.Root,{open:t,onOpenChange:n,children:[(0,Q.jsx)(g.Trigger,{asChild:!0,children:(0,Q.jsx)(d,{variant:`outlined`,rightIcon:(0,Q.jsx)(Y,{}),"aria-haspopup":`menu`,"aria-expanded":t,children:`Configure`})}),(0,Q.jsxs)(g.Content,{align:`end`,sideOffset:4,role:`menu`,className:`w-56 overflow-hidden p-0`,children:[(0,Q.jsx)(d,{type:`button`,role:`menuitem`,variant:`ghost`,onClick:r,className:`w-full justify-start rounded-none`,leftIcon:(0,Q.jsx)(S,{"aria-hidden":!0}),children:`Edit connections`}),(0,Q.jsx)(d,{type:`button`,role:`menuitem`,variant:`dangerGhost`,onClick:i,disabled:a,className:`w-full justify-start rounded-none`,leftIcon:a?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(ie,{"aria-hidden":!0}),children:`Disable`})]})]})}var De=`vellum:integrations:bannerDismissed`,Oe=[{value:`all`,label:`All`},{value:`enabled`,label:`Enabled`},{value:`not-enabled`,label:`Not Enabled`}];function $(e,t){return e?.find(e=>e.provider===t)??null}function ke(){let[e]=o(),i=a(),s=G(),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!0),[p,h]=(0,X.useState)(``),[_,b]=(0,X.useState)(`all`),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!0),[E,D]=(0,X.useState)(null);(0,X.useEffect)(()=>{T(t(De,`false`)===`true`)},[]);let O=()=>{T(!0),n(De,`true`)};(0,X.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await N();e&&t.ok&&u(t.data)}catch(e){r(e,{context:`integrations.getAssistant`})}finally{e&&f(!1)}})(),()=>{e=!1}},[]);let{data:k,isLoading:A,isError:j}=c({queryKey:[`oauth-providers`,l?.id],queryFn:()=>se(l.id),enabled:!!l}),{data:M,isLoading:ee}=c({...W({path:{assistant_id:l?.id??``}}),enabled:!!l&&s===`full`});(0,X.useEffect)(()=>{let t=e.get(`oauth_status`);if(!t)return;let n=e.get(`oauth_provider`),r=n?n.charAt(0).toUpperCase()+n.slice(1):null;if(t===`connected`)y.success(r?`${r} account connected successfully.`:`Account connected successfully.`);else if(t===`error`){let t=e.get(`oauth_code`)??`unknown`;y.error({denied:`Authorization was denied. Please try again.`,state_invalid:`Authorization state was invalid. Please try again.`,state_expired:`Authorization expired. Please try again.`,exchange_failed:`Failed to complete authorization. Please try again.`,identity_failed:`Failed to verify account identity. Please try again.`}[t]??(r?`Failed to connect ${r}.`:`Failed to connect. Please try again.`))}i(P.settings.integrations,{replace:!0})},[e,i]);let F=(0,X.useMemo)(()=>k?.filter(e=>e.supports_managed_mode)??[],[k]),L=(0,X.useMemo)(()=>{let e=p.trim().toLowerCase(),t=F.filter(t=>{if(!e)return!0;let n=(t.display_name??t.provider_key).toLowerCase(),r=(t.description??``).toLowerCase();return n.includes(e)||r.includes(e)});return _!==`all`&&(t=t.filter(e=>{let t=!!$(M,e.provider_key)?.connected;return _===`enabled`?t:!t})),[...t].sort((e,t)=>{let n=!!$(M,e.provider_key)?.connected;if(n!==!!$(M,t.provider_key)?.connected)return n?-1:1;let r=(e.display_name??e.provider_key).toLowerCase(),i=(t.display_name??t.provider_key).toLowerCase();return r.localeCompare(i)})},[F,M,p,_]),R=d||A||ee,z=Oe.find(e=>e.value===_)?.label??`All`,B=(()=>{if(p.trim())return`No integrations matched`;switch(_){case`enabled`:return`No Enabled Integrations`;case`not-enabled`:return`All Integrations Are Enabled`;default:return`No Integrations Available`}})(),V=(()=>{if(p.trim())return`No integrations matched "${p.trim()}"`;switch(_){case`enabled`:return`Connect an integration to get started.`;case`not-enabled`:return`All available integrations have been connected.`;default:return`Check your connection and try again.`}})(),H=(0,X.useMemo)(()=>E?F.find(e=>e.provider_key===E)??null:null,[F,E]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[!w&&(0,Q.jsxs)(m,{tone:`info`,icon:(0,Q.jsx)(I,{className:`h-3.5 w-3.5`}),onDismiss:O,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default`,children:`Tip:`}),` You can enable integrations by mentioning them in chat.`]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(v,{type:`text`,value:p,onChange:e=>h(e.target.value),placeholder:`Search Integrations`,"aria-label":`Search integrations`,leftIcon:(0,Q.jsx)(U,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,wrapperClassName:`flex-1`}),(0,Q.jsxs)(g.Root,{open:S,onOpenChange:C,children:[(0,Q.jsx)(g.Trigger,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":S,className:`flex w-36 cursor-pointer items-center justify-between gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-lighter text-[var(--content-default)] transition-colors hover:bg-[var(--ghost-hover)]`,children:[(0,Q.jsx)(`span`,{children:z}),(0,Q.jsx)(Y,{className:`h-3.5 w-3.5`})]})}),(0,Q.jsx)(g.Content,{align:`end`,sideOffset:4,className:`w-36 overflow-hidden p-0`,children:(0,Q.jsx)(`div`,{role:`listbox`,children:Oe.map(e=>{let t=e.value===_;return(0,Q.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>{b(e.value),C(!1)},className:`flex w-full cursor-pointer items-center px-3 py-1.5 text-left hover:bg-[var(--ghost-hover)] ${t?`text-body-medium-default text-[var(--content-default)]`:`text-body-medium-lighter text-[var(--content-default)]`}`,children:e.label},e.value)})})})]})]}),(0,Q.jsx)(`div`,{children:R?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(x,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{children:`Loading...`})]}):j?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Failed to load integrations. Please try again.`}):l?L.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-lg border border-dashed border-[var(--border-element)] px-4 py-12 text-center`,children:[(0,Q.jsx)(U,{className:`h-6 w-6 text-[var(--content-disabled)]`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:B}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:V})]}):(0,Q.jsx)(`div`,{className:`space-y-2`,children:L.map(e=>(0,Q.jsx)(Te,{assistantId:l.id,providerKey:e.provider_key,displayName:e.display_name??e.provider_key,description:e.description,logoUrl:e.logo_url,connection:$(M,e.provider_key),platformGate:s,onConfigure:()=>D(e.provider_key)},e.provider_key))}):(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No assistant found. Hatch an assistant to connect integrations.`})}),H&&l&&(0,Q.jsx)(xe,{assistantId:l.id,providerKey:H.provider_key,displayName:H.display_name??H.provider_key,description:H.description,logoUrl:H.logo_url,platformGate:s,onClose:()=>D(null)})]})}function Ae(){return(0,Q.jsx)(`div`,{className:`space-y-6`,children:(0,Q.jsx)(X.Suspense,{children:(0,Q.jsx)(ke,{})})})}export{Ae as IntegrationsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,n as r,u as i}from"./chunk-5KNZJZUH-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,n as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./cn-DFqQkJlk.js";import{t as s}from"./typography-Czgs_2w_.js";import"./src-hn7lwVCD.js";import{i as c}from"./routes-Dk5Qeryt.js";import{t as l}from"./assistant-feature-flag-store-0382ImYF.js";import{n as u}from"./use-is-mobile-D_xrnINF.js";import{t as d}from"./assistant-identity-store-dQ1LxIr0.js";import{An as f}from"./index-BjEJFZTJ.js";import{t as p}from"./page-shell-CYsp3hSr.js";var m=e(t(),1),h=a(),g=[{label:`Identity`,to:c.identity},{label:`Skills`,to:c.skills},{label:`Workspace`,to:c.workspace},{label:`Contacts`,to:c.contacts.root}],_={label:`Plugins`,to:c.plugins};function v(){let e=d.use.name(),t=l.use.hasHydrated(),a=l.use.externalPlugins(),{pathname:c}=i(),v=u(),y=f.use.setTopBarCenter();(0,m.useEffect)(()=>(y(v?(0,h.jsxs)(s,{variant:`body-medium-default`,className:`truncate text-[var(--content-secondary)]`,children:[`About `,e||`Assistant`]}):null),()=>{y(null)}),[v,e,y]);let b=t&&a?[g[0],_,...g.slice(1)]:g;return(0,h.jsxs)(p,{children:[(0,h.jsxs)(`h1`,{className:`mb-4 shrink-0 text-title-large text-[var(--content-default)] max-md:hidden`,children:[`About `,e||`Assistant`]}),(0,h.jsx)(`nav`,{className:`mb-4 flex shrink-0 items-center overflow-x-auto border-b border-[var(--border-base)]`,style:{scrollbarWidth:`none`,WebkitOverflowScrolling:`touch`},"aria-label":`About assistant sections`,children:b.map(({label:e,to:t})=>{let n=c===t||c.startsWith(t+`/`);return(0,h.jsx)(r,{to:t,className:o(`relative -mb-px inline-flex cursor-pointer items-center gap-1.5 border-b-2 border-transparent bg-transparent px-2.5 py-[7px]`,`text-body-medium-default whitespace-nowrap`,`text-[var(--content-secondary)] transition-colors`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-0`,`hover:bg-[var(--surface-hover)] hover:text-[var(--content-default)]`,n&&`border-[var(--border-active)] text-[var(--primary-active)]`,n&&`hover:bg-transparent`),children:e},t)})}),(0,h.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:(0,h.jsx)(n,{})})]})}export{v as IntelligenceLayout};
|
package/dist/assets/{keyboard-shortcuts-page-LBckCCBl.js → keyboard-shortcuts-page-QHFTyWOo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-
|
|
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{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./button-DdEh-9f_.js";import{t as a}from"./card-CL5iEMJO.js";import{t as o}from"./notice-CF2pptne.js";import{t as s}from"./shortcut-keys-FXO7qQjX.js";import{t as c}from"./is-electron-CavSPgmY.js";import{t as l}from"./x-BDqbYVtS.js";import{i as u}from"./routes-Dk5Qeryt.js";import{Qi as d}from"./index-BjEJFZTJ.js";var f=e(t(),1);async function p(){if(!c())return[];let e=window.vellum;return e?.hotkeys?e.hotkeys.get():[]}async function m(e,t){if(!c())return;let n=window.vellum;n?.hotkeys&&await n.hotkeys.set(e,t)}function h(e){if(!c())return()=>{};let t=window.vellum;return t?.hotkeys?t.hotkeys.onChange(e):()=>{}}var g={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},_=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),v=e=>{let t=e.code;return _.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:g[t]??null},y=e=>{let t=v(e);if(t===null)return null;let n=[];return e.metaKey&&n.push(`CmdOrCtrl`),e.ctrlKey&&n.push(`Control`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),[...n,t].join(`+`)},b=(e,t,n)=>n===``?null:e.find(e=>e.key!==t&&e.accelerator===n)??null,x=r(),S=[{scope:`global`,title:`Global shortcuts`,description:`Work anywhere, even when Vellum is in the background.`},{scope:`menu`,title:`App shortcuts`,description:`Work while a Vellum window is focused.`}];function C({hotkey:e,recording:t,conflictLabel:n,onStartRecording:r,onCancelRecording:a,onReset:o,onRemove:c}){let u=e.accelerator===``,f=e.override!==null;return(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,x.jsxs)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:[`Already used by `,n]})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,x.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Recording… press a shortcut, or Esc to cancel`}):u?(0,x.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`Disabled`}):(0,x.jsx)(s,{accelerator:e.accelerator}),t?(0,x.jsx)(i,{variant:`ghost`,size:`compact`,onClick:a,children:`Cancel`}):(0,x.jsx)(i,{variant:`outlined`,size:`compact`,onClick:r,"aria-label":`Record shortcut for ${e.label}`,children:`Record`}),(0,x.jsx)(i,{variant:`ghost`,size:`compact`,disabled:!f,leftIcon:(0,x.jsx)(d,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":`Reset ${e.label} to default`}),(0,x.jsx)(i,{variant:`ghost`,size:`compact`,disabled:u,leftIcon:(0,x.jsx)(l,{className:`h-3.5 w-3.5`}),onClick:c,"aria-label":`Remove ${e.label} binding`})]})]})}function w(){let[e,t]=(0,f.useState)([]),[r,i]=(0,f.useState)(null),[s,l]=(0,f.useState)(null),d=(0,f.useCallback)(()=>{p().then(t)},[]);(0,f.useEffect)(()=>(d(),h(t)),[d]);let g=(0,f.useCallback)(()=>{i(null),l(null)},[]);(0,f.useEffect)(()=>{if(r===null)return;let t=t=>{if(t.preventDefault(),t.stopPropagation(),t.code===`Escape`){g();return}let n=y(t);if(n===null)return;let i=b(e,r,n);if(i!==null){l({key:r,label:i.label});return}m(r,n).then(d),g()};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[r,e,d,g]);let _=(0,f.useCallback)(e=>{l(null),i(e)},[]),v=(0,f.useCallback)(t=>{let n=b(e,t,e.find(e=>e.key===t)?.defaultAccelerator??``);if(n!==null){i(null),l({key:t,label:n.label});return}g(),m(t,null).then(d)},[e,d,g]),w=(0,f.useCallback)(e=>{g(),m(e,``).then(d)},[d,g]),T=(0,f.useMemo)(()=>S.map(t=>({...t,commands:e.filter(e=>e.rebindable&&e.scope===t.scope)})).filter(e=>e.commands.length>0),[e]);return c()?(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Keyboard Shortcuts`}),(0,x.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Customize the shortcuts for Vellum's commands.`})]}),s!==null&&(0,x.jsxs)(o,{tone:`warning`,children:[`That shortcut is already used by `,s.label,`.`,` `,r===null?`Remove or change that binding before resetting.`:`Pick a different combination, or press Esc to cancel.`]}),T.map(e=>(0,x.jsxs)(a,{bordered:!0,children:[(0,x.jsxs)(`div`,{className:`mb-2`,children:[(0,x.jsx)(`div`,{className:`text-body-medium-emphasised text-[var(--content-default)]`,children:e.title}),(0,x.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,x.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,x.jsx)(C,{hotkey:e,recording:r===e.key,conflictLabel:s!==null&&s.key===e.key?s.label:null,onStartRecording:()=>_(e.key),onCancelRecording:g,onReset:()=>v(e.key),onRemove:()=>w(e.key)},e.key))})]},e.scope))]}):(0,x.jsx)(n,{replace:!0,to:u.settings.general})}export{w as KeyboardShortcutsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,p as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import"./src-hn7lwVCD.js";import{n as a}from"./toast-DU1nH33j.js";import{t as o}from"./loader-circle-BSAFLoPH.js";import{n as s}from"./sdk.gen-AJllUeDf.js";import{i as c}from"./routes-Dk5Qeryt.js";import{r as l}from"./app-html-cache-DNQd-TK8.js";import{V as u,Z as d,n as f}from"./index-BjEJFZTJ.js";import{t as p}from"./use-active-assistant-id-BIhArlF_.js";var m=e(t(),1),h=i();function g(){let{appId:e}=r(),t=p(),i=n(),[g,_]=(0,m.useState)(null),[v,y]=(0,m.useState)(null),[b,x]=(0,m.useState)(!1),S=(0,m.useRef)(null);(0,m.useEffect)(()=>{if(e)return S.current=e,_(null),y(null),s({path:{assistant_id:t,id:e},throwOnError:!0}).then(({data:n})=>{S.current===e&&(l(t,n.appId,n.html),_({appId:n.appId,dirName:n.dirName,name:n.name,html:n.html}))}).catch(t=>{S.current===e&&y(t instanceof Error?t.message:`Failed to open app`)}),()=>{S.current=null}},[t,e]);let C=(0,m.useCallback)(()=>{i(c.library.root)},[i]),w=f(),T=(0,m.useCallback)(()=>{g&&w(g)},[g,w]),E=(0,m.useCallback)(async()=>{if(!(!g||b)){x(!0);try{await d(t,g.appId,g.name),a.success(`App exported`,{description:`${g.name}.vellum`})}catch(e){a.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{x(!1)}}},[t,g,b]);return e?v?(0,h.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4`,children:[(0,h.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:v}),(0,h.jsx)(`button`,{type:`button`,onClick:C,className:`text-body-medium-default text-[var(--primary-base)] underline`,children:`Back to Library`})]}):g?(0,h.jsx)(u,{appId:g.appId,appName:g.name,html:g.html,assistantId:t,onClose:C,onEdit:T,onShare:E,isSharing:b,enableFullscreen:!0}):(0,h.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,h.jsx)(o,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}):null}export{g as LibraryDetailPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DNHWXaGq.js";import{t as i}from"./useQuery-D2zf6Uhu.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./button-DdEh-9f_.js";import{t as s}from"./menu-B79-l6IU.js";import"./src-hn7lwVCD.js";import{t as c}from"./confirm-dialog-NYG-K9zN.js";import{n as l,t as u}from"./panel-item-FzMfzMJA.js";import{t as d}from"./input-Cu3PPVCq.js";import{n as f}from"./toast-DU1nH33j.js";import{t as p}from"./arrow-up-BLnb2N1m.js";import{t as m}from"./globe-ByNYDdSW.js";import{s as h,t as g}from"./sdk.gen-AJllUeDf.js";import{f as _,n as v,t as y}from"./react-query.gen-B8xaBreR.js";import{i as b}from"./routes-Dk5Qeryt.js";import{t as x}from"./assistant-feature-flag-store-0382ImYF.js";import{n as S}from"./use-is-mobile-D_xrnINF.js";import{n as C,t as w}from"./app-html-cache-DNQd-TK8.js";import{t as T}from"./misc-MEUnNRwX.js";import{Ai as E,Ha as D,La as O,N as k,Ni as A,Ta as j,X as M,Yi as N,Z as P,aa as F,oa as I,yn as L}from"./index-BjEJFZTJ.js";import{t as R}from"./deploy-dialogs-EImApd6S.js";import{t as z}from"./use-active-assistant-id-BIhArlF_.js";import{t as B}from"./page-shell-CYsp3hSr.js";import{t as V}from"./format-date-lYqfuFdi.js";var H=e(t(),1),U=a();function W({app:e,isDeleting:t,onConfirm:n,onCancel:r}){return(0,U.jsx)(c,{open:e!==null,title:`Delete app`,message:e?`"${e.name}" will be permanently removed.`:``,confirmLabel:t?`Deleting…`:`Delete`,destructive:!0,onConfirm:n,onCancel:r})}function G(e){return e===1?`1 word`:`${e} words`}function K({document:e,onOpen:t}){return(0,U.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:T(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,U.jsx)(O,{size:34,className:`text-[var(--content-tertiary)]`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:G(e.wordCount)})]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:V(new Date(e.updatedAt))})]})]})}function q({fileInputRef:e,isImporting:t,onImportBundle:n,onNewConversation:r}){return(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,U.jsx)(`input`,{ref:e,type:`file`,accept:`.vellum`,className:`hidden`,onChange:n}),(0,U.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,U.jsx)(j,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,U.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Your library is empty`}),(0,U.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:`Ask your assistant to build something, or import a shared app`}),(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o,{variant:`primary`,size:`regular`,onClick:r,children:`New Conversation`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:`or`})]}):null,(0,U.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>e.current?.click(),disabled:t,children:[t?(0,U.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,U.jsx)(E,{size:14}),(0,U.jsx)(`span`,{className:`ml-1.5`,children:`Import .vellum File`})]})]})]})}function J({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:a,onDeploy:o,justImported:s,onAnimationEnd:c}){let[l,u]=(0,H.useState)(!1),d=(0,H.useCallback)(()=>C(t,e.id),[t,e.id]),p=(0,H.useCallback)(async()=>{if(!l){u(!0);try{await P(t,e.id,e.name),f.success(`App exported`,{description:`${e.name}.vellum`})}catch(e){f.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{u(!1)}}},[t,e.id,e.name,l]),[m,h]=(0,H.useState)(!1),g=S();return(0,U.jsxs)(`div`,{className:T(`group relative flex flex-col gap-2`,s&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:s?c:void 0,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:T(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,U.jsx)(k,{name:e.name,icon:e.icon,loadHtml:d})}),(0,U.jsx)(`div`,{className:T(`absolute right-2 top-2 z-20 transition-opacity`,`max-md:opacity-100`,`md:group-hover:opacity-100 md:group-focus-within:opacity-100`,m?`opacity-100`:`md:opacity-0`),children:(0,U.jsx)(Y,{appName:e.name,isPinned:n,open:m,onOpenChange:h,onPin:()=>i(e),onDelete:a?()=>a(e):void 0,onShare:p,onDeploy:o,isMobile:g})}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.name}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:V(new Date(e.createdAt))})]})]})}function Y({appName:e,isPinned:t,open:n,onOpenChange:r,onPin:i,onDelete:a,onShare:c,onDeploy:d,isMobile:f}){return f?(0,U.jsxs)(l.Root,{open:n,onOpenChange:r,children:[(0,U.jsx)(l.Trigger,{asChild:!0,children:(0,U.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,U.jsx)(D,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,U.jsxs)(l.Content,{children:[(0,U.jsx)(l.Header,{className:`sr-only`,children:(0,U.jsx)(l.Title,{children:e})}),(0,U.jsxs)(l.Body,{className:`pt-0`,children:[(0,U.jsx)(u,{icon:t?I:F,label:t?`Unpin`:`Pin`,onSelect:()=>{r(!1),i()}}),c?(0,U.jsx)(u,{icon:p,label:(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,U.jsx)(`span`,{children:`Share`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Export as .vellum file`})]}),onSelect:()=>{r(!1),c()}}):null,d?(0,U.jsx)(u,{icon:m,label:(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,U.jsx)(`span`,{children:`Deploy to Vercel`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Publish as a static page`})]}),onSelect:()=>{r(!1),d()}}):null,a?(0,U.jsx)(u,{icon:A,label:`Delete`,onSelect:()=>{r(!1),a()}}):null]})]})]}):(0,U.jsxs)(s.Root,{open:n,onOpenChange:r,children:[(0,U.jsx)(s.Trigger,{asChild:!0,children:(0,U.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,U.jsx)(D,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,U.jsxs)(s.Content,{align:`end`,sideOffset:4,children:[(0,U.jsx)(s.Item,{leftIcon:t?(0,U.jsx)(I,{size:14}):(0,U.jsx)(F,{size:14}),onSelect:()=>i(),className:`whitespace-nowrap`,children:t?`Unpin`:`Pin`}),c?(0,U.jsx)(s.Item,{leftIcon:(0,U.jsx)(p,{size:14}),onSelect:()=>c(),className:`whitespace-nowrap`,children:`Share`}):null,d?(0,U.jsx)(s.Item,{leftIcon:(0,U.jsx)(m,{size:14}),onSelect:()=>d(),className:`whitespace-nowrap`,children:`Deploy to Vercel`}):null,a?(0,U.jsx)(s.Item,{leftIcon:(0,U.jsx)(A,{size:14,className:`text-red-600`}),onSelect:()=>a(),className:`whitespace-nowrap text-red-600 data-[highlighted]:text-red-700`,children:`Delete`}):null]})]})}function X({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:e}),(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:t.map(e=>(0,U.jsx)(J,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var Z=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function Q(e){let t=L.use.pinnedAppIds(),{data:n=[],isLoading:r,error:a}=i({...y({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=i({..._({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=a&&c?a instanceof Error?a.message:`Failed to load library`:null,[d,f]=(0,H.useState)(``),p=(0,H.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:o,filteredApps:p,pinnedApps:(0,H.useMemo)(()=>p.filter(e=>t.has(e.id)).sort(Z),[p,t]),recentApps:(0,H.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort(Z),[p,t]),filteredDocuments:(0,H.useMemo)(()=>{if(!d.trim())return o;let e=d.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,d]),searchText:d,setSearchText:f,loading:l,error:u}}async function ee(e,t){let{data:n,error:r,response:i}=await h({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function $({assistantId:e,assistantName:t,title:n,onNewConversation:i,onOpenDocument:a,onOpenApp:s}){let c=r(),l=x.use.deployToVercel(),u=L.use.togglePin(),p=L.use.pinnedAppIds(),m=M.use.isDeploying(),{apps:h,documents:_,filteredApps:y,pinnedApps:b,recentApps:S,filteredDocuments:T,searchText:D,setSearchText:O,loading:k,error:A}=Q(e),[j,P]=(0,H.useState)(null),[F,I]=(0,H.useState)(!1),z=(0,H.useCallback)(async()=>{let t=j;if(!(!t||F)){I(!0);try{await g({path:{assistant_id:e,id:t.id},throwOnError:!0}),w(e,t.id),c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),p.has(t.id)&&u(t),P(null)}catch(e){f.error(e instanceof Error?e.message:`Failed to delete app`)}finally{I(!1)}}},[j,F,e,p,u,c]),B=(0,H.useCallback)(()=>{F||P(null)},[F]),V=(0,H.useRef)(null),[G,J]=(0,H.useState)(!1),Y=(0,H.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||G)){J(!0);try{let t=await ee(e,n);await c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),f.success(t.name+` imported`),s(t.appId)}catch(e){f.error(e instanceof Error?e.message:`Failed to import app`)}finally{J(!1),V.current&&(V.current.value=``)}}},[e,G,c,s]),Z=(0,H.useCallback)(async t=>{if(m)return;let n=h.find(e=>e.id===t)?.name??`this app`;try{let r=await C(e,t);M.getState().deployApp(e,t,n,r)}catch{M.getState().deployApp(e,t,n,``)}},[e,m,h]),$=(0,H.useCallback)(e=>u(e),[u]);return k?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,U.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":`Loading apps`})}):A?(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,U.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:A}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:`Retry`})]}):h.length===0&&_.length===0?(0,U.jsx)(q,{fileInputRef:V,isImporting:G,onImportBundle:Y,onNewConversation:i?()=>i():void 0}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-4`,children:[n?(0,U.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:n}):(0,U.jsx)(`span`,{}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{ref:V,type:`file`,accept:`.vellum`,className:`hidden`,onChange:Y}),(0,U.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>V.current?.click(),disabled:G,children:[G?(0,U.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,U.jsx)(E,{size:14}),(0,U.jsx)(`span`,{className:`ml-1.5`,children:`Import`})]})]})]}),(0,U.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,U.jsx)(d,{fullWidth:!0,type:`text`,placeholder:`Search your library`,value:D,onChange:e=>O(e.target.value),leftIcon:(0,U.jsx)(N,{size:16})})}),(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:y.length===0&&T.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,U.jsx)(N,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,U.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`No apps or documents matched “`,D,`”`]})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,U.jsx)(X,{title:`Pinned`,apps:b,assistantId:e,pinnedAppIds:p,onOpen:s,onPin:$,onDelete:P,onDeploy:l?Z:void 0}),(0,U.jsx)(X,{title:`Recents`,apps:S,assistantId:e,pinnedAppIds:p,onOpen:s,onPin:$,onDelete:P,onDeploy:l?Z:void 0}),T.length>0?(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:`Documents`}),(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:T.map(e=>(0,U.jsx)(K,{document:e,onOpen:e=>{a&&a(e)}},e.surfaceId))})]}):null]})}),(0,U.jsx)(R,{assistantId:e,assistantName:t,onStartConversation:i}),(0,U.jsx)(W,{app:j,isDeleting:F,onConfirm:z,onCancel:B})]})}function te(){let e=z(),t=n();return(0,U.jsx)(B,{children:(0,U.jsx)($,{assistantId:e,title:`Library`,onNewConversation:(0,H.useCallback)(e=>{t(b.assistant)},[t]),onOpenDocument:(0,H.useCallback)(e=>{t(b.document(e))},[t]),onOpenApp:(0,H.useCallback)(e=>{t(b.library.app(e))},[t])})})}export{te as LibraryPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./routes-
|
|
1
|
+
import{i as e}from"./routes-Dk5Qeryt.js";import{Tr as t,mr as n}from"./index-BjEJFZTJ.js";var r=`workos-oidc`,i=e.account.providerCallback,a=`authIntent`;function o(e,t={}){let n=new URLSearchParams;e&&n.set(`returnTo`,e),t.authIntent&&n.set(a,t.authIntent);let r=n.toString();return r?`${i}?${r}`:i}function s(e){return e.get(a)===`signup`?`signup`:`login`}function c(e){return e.startsWith(`http`)||e.startsWith(`/accounts/`)||e.startsWith(`/v1/`)||e.startsWith(`/_allauth/`)}function l(e,t){return u({returnTo:e,fallback:t,authIntent:`login`})}function u({returnTo:e,fallback:r,authIntent:i}){let a=t(n(),{kind:`post-auth`,authIntent:i,returnTo:e,fallback:r}),o=a.action===`redirect`?a.to:r;return{destination:o,requiresFullPageNavigation:c(o)}}export{u as a,s as i,r as n,l as o,o as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./cn-DFqQkJlk.js";import{t as o}from"./button-DdEh-9f_.js";import"./src-hn7lwVCD.js";import{D as s,E as c,O as l}from"./auth-store-CiQCAKS1.js";import{i as u}from"./routes-Dk5Qeryt.js";import{t as d}from"./google-logo-mNxCGWd3.js";import{t as f}from"./public-asset-Dx4la7Nv.js";import{F as p,ba as m}from"./index-BjEJFZTJ.js";import{n as h,r as g}from"./login-flow-Bi4ujzeb.js";var _=e(t(),1),v=i();function y({children:e}){return(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(`img`,{src:f(`/vellum-logo.svg`),alt:`Vellum`,width:220,height:66,className:`block dark:hidden`}),(0,v.jsx)(`img`,{src:f(`/vellum-logo-white.svg`),alt:`Vellum`,width:220,height:66,className:`hidden dark:block`}),e,(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 w-full max-w-[900px] -translate-x-1/2`,style:{bottom:0},children:(0,v.jsx)(`img`,{src:f(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}function b(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`pointer-events-none absolute top-[120px] left-1/2 z-0 -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:f(`/vellum-logo-white.svg`),alt:`Vellum`,width:92,height:28})}),(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-0 bottom-0 left-1/2 z-0 w-full max-w-[1100px] -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:f(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}var x=`flex w-full max-w-[448px] flex-col gap-6 rounded-lg border border-[var(--border-disabled)] bg-[var(--surface-lift)] p-6`;function S({children:e}){return(0,v.jsx)(`div`,{className:x,children:e})}function C({children:e}){return(0,v.jsx)(`h1`,{className:`text-title-large text-center text-[var(--content-emphasised)]`,children:e})}function w({children:e,className:t}){return(0,v.jsx)(`p`,{className:a(`text-body-small-default text-center text-[var(--system-negative-strong)]`,t),children:e})}function T({children:e}){return(0,v.jsx)(`div`,{className:`dark`,children:(0,v.jsxs)(`div`,{className:`relative min-h-screen overflow-x-hidden bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(b,{}),(0,v.jsx)(`div`,{className:`relative z-10 flex min-h-screen flex-col items-center justify-center px-4`,children:e})]})})}function E({signUpHref:e}){return(0,v.jsxs)(`p`,{className:`text-body-small-default flex justify-center gap-1`,children:[(0,v.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Don't have an account?`}),(0,v.jsx)(r,{to:e,className:`font-medium text-[var(--content-emphasised)] hover:underline`,children:`Sign up`})]})}function D({returnTo:e,loading:t,errorMessage:n,onProviderClick:r}){let i=e?`${u.account.signup}?returnTo=${encodeURIComponent(e)}`:u.account.signup;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(C,{children:`Sign in to Vellum`}),n&&(0,v.jsx)(w,{children:n}),(0,v.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(`AppleOAuth`),disabled:t,leftIcon:(0,v.jsx)(p,{}),className:`max-w-[300px] gap-3`,children:`Continue with Apple`}),(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(`GoogleOAuth`),disabled:t,leftIcon:(0,v.jsx)(d,{}),className:`max-w-[300px] gap-3`,children:`Continue with Google`}),(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(),disabled:t,leftIcon:(0,v.jsx)(m,{}),className:`max-w-[300px] gap-3`,children:`Continue with Email`})]}),(0,v.jsx)(E,{signUpHref:i})]})}var O={signup_closed:`Sign-ups are currently closed. Visit vellum.ai/community to request access.`};function k({returnTo:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),a=async()=>{n(null),i(!0);try{await s({returnTo:e??null})}catch(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;if(t===`USER_CANCELLED`){i(!1);return}if(t===`AUTH_ERROR`){let t=e&&typeof e==`object`&&`data`in e&&e.data&&typeof e.data==`object`&&`authError`in e.data&&typeof e.data.authError==`string`?e.data.authError:void 0;n((t&&O[t])??`Something went wrong. Please try again.`)}else console.error(`[native-auth] auth flow failed:`,e),n(`Something went wrong. Please try again.`);i(!1)}};return(0,v.jsx)(y,{children:(0,v.jsxs)(`div`,{className:`z-10 mt-8 flex w-full max-w-[320px] flex-col items-center gap-3`,children:[t&&(0,v.jsx)(w,{className:`max-w-[280px]`,children:t}),(0,v.jsx)(o,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>{a()},disabled:r,className:`max-w-[300px]`,children:`Sign in`})]})})}function A({returnTo:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),a=g(e),o=async t=>{n(null),i(!0);try{await c(h,a,{...t?{providerHint:t}:{},returnTo:e})}catch(e){console.error(`[web-login] auth flow failed:`,e),n(`Something went wrong. Please try again.`),i(!1)}};return(0,v.jsx)(T,{children:(0,v.jsx)(S,{children:(0,v.jsx)(D,{returnTo:e,loading:r,errorMessage:t,onProviderClick:e=>{o(e)}})})})}function j(){let[e]=n(),t=l(),r=e.get(`returnTo`);return t?(0,v.jsx)(k,{returnTo:r}):(0,v.jsx)(A,{returnTo:r})}export{j as LoginPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{
|
|
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{j as i,n as a}from"./auth-store-CiQCAKS1.js";import{i as o}from"./routes-Dk5Qeryt.js";import{or as s}from"./index-BjEJFZTJ.js";import{r as c,t as l}from"./account-shell-qQqbocXz.js";var u=e(t(),1),d=r();function f(){let[e]=n(),t=a.use.logout(),r=(0,u.useRef)(!1);return(0,u.useEffect)(()=>{if(r.current)return;r.current=!0;let n=i(e.get(`returnTo`),o.account.login),a=n.startsWith(`http`)||n===o.account.login?n:`${o.account.login}?returnTo=${encodeURIComponent(n)}`,c=!1;return t().then(()=>{c||s(a)},()=>{c||s(a)}),()=>{c=!0}},[t,e]),(0,d.jsx)(l,{children:(0,d.jsx)(c,{title:`Signing out...`})})}export{f as LogoutPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,u as r}from"./chunk-5KNZJZUH-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./createLucideIcon-D6d6iDdi.js";import{i as o}from"./routes-Dk5Qeryt.js";import{Xi as s,ba as c,et as l,ho as u}from"./index-BjEJFZTJ.js";import{n as d,t as f}from"./sidebar-tree-Cme65q7r.js";var p=a(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),m=e(t(),1),h=[{id:`usage`,label:`Usage`,href:o.logs.usage,icon:u},{id:`logs`,label:`Logs`,href:o.logs.trace,icon:s},{id:`emails`,label:`Emails`,href:o.logs.emails,icon:c},{id:`system-events`,label:`System Events`,href:o.logs.systemEvents,icon:p}],g=i();function _(){let e=l({platformHostedOnly:!0}),t=l(),{pathname:i}=r(),a=(0,m.useMemo)(()=>h.filter(n=>!(n.id===`system-events`&&e===`gated`||n.id===`emails`&&t===`gated`)),[e,t]),s=(0,m.useMemo)(()=>{let e=h.find(e=>i===e.href||i.startsWith(e.href+`/`));return e?e.label:i===o.logs.root?h[0]?.label??`Logs & Usage`:`Logs & Usage`},[i]);return(0,g.jsx)(d,{backHref:o.assistant,sidebar:(0,g.jsx)(f,{items:a}),title:s,menuRoute:o.logs.root,children:(0,g.jsx)(n,{})})}export{_ as LogsLayout};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./useQuery-D2zf6Uhu.js";import{t as r}from"./useMutation-BuofVRHk.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./card-CL5iEMJO.js";import"./src-hn7lwVCD.js";import{Bt as o,Ht as s,S as c,Vt as l}from"./sdk.gen-AJllUeDf.js";import{a as u,n as d}from"./auth-store-oleg80LZ.js";import{In as f,fr as p}from"./index-DM63H2B6.js";import{t as m}from"./use-active-assistant-id-BIhArlF_.js";var h=e(t(),1),g=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function _(e,t,n){let{data:r,response:i}=await s({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new g(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new g(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:v(a)}}function v(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function y(e){return r({mutationFn:async t=>{if(!e)throw new g(0,`Missing assistantId`);return _(e,t)}})}async function b(e,t){let{data:n,response:r}=await c({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load LLM profiles`);if(!n)throw new g(r.status,`Empty response from profile list endpoint`);return n}function ee(e){return n({queryKey:[`llm-profiles`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return b(e,t)},enabled:!!e,staleTime:6e4})}async function x(e,t){let{data:n,response:r}=await l({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load router prompt template`);if(!n)throw new g(r.status,`Empty response from router prompt template endpoint`);return n}function te(e){return n({queryKey:[`router-prompt-template`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return x(e,t)},enabled:!!e,staleTime:1440*60*1e3})}async function S(e,t){let{data:n,response:r}=await o({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load NOW.md`);if(!n)throw new g(r.status,`Empty response from now-text endpoint`);return n}function C(e){return n({queryKey:[`memory-router-now-text`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return S(e,t)},enabled:!!e,staleTime:1/0})}var w=i();function T(){let e=d.use.user(),t=u(),n=p.use.memoryRouterPlayground();return t?(0,w.jsx)($,{children:`Loading…`}):!f(e)||!n?(0,w.jsx)($,{children:`Memory router playground is not available.`}):(0,w.jsx)(D,{})}var E={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function D(){let e=m(),t=y(e),n=y(e),r=ee(e),i=te(e),a=C(e),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)([{assistantMessage:``,userMessage:``}]),[u,d]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(u)return;let e=a.data?.nowText;typeof e==`string`&&o===``&&s(e)},[a.data?.nowText,o,u]);let[f,p]=(0,h.useState)(E),[g,_]=(0,h.useState)(E),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),T=c[c.length-1].userMessage,D=e=>{let r=e===`A`?f:g,i=e===`A`?b:S,a=e===`A`?t:n;i(null);let s;try{s=O(r)}catch(e){i(e instanceof Error?e.message:`Invalid override input`);return}let l=r.profile.trim().length>0?r.profile:void 0,u=r.customPrompt.trim().length>0?r.customPrompt:void 0,d=c.map((e,t)=>t===c.length-1?{...e,userMessage:e.userMessage.trim()}:e);a.mutate({recentTurnPairs:d,nowText:o,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...u===void 0?{}:{routerPromptOverride:u}})},k=()=>{D(`A`),D(`B`)},M=T.trim().length>0,P=M&&!t.isPending,F=M&&!n.isPending;return(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,w.jsx)(A,{}),(0,w.jsx)(j,{nowText:o,onNowTextChange:e=>{d(!0),s(e)},onReloadNowText:()=>{let e=a.data?.nowText;typeof e==`string`&&(s(e),d(!1))},nowTextLoading:a.isLoading,pairs:c,onPairsChange:l}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:f,onChange:p,onRun:()=>D(`A`),canRun:P,isRunning:t.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``}),(0,w.jsx)(N,{paneId:`B`,overrides:g,onChange:_,onRun:()=>D(`B`),canRun:F,isRunning:n.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``})]}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(ne,{onClick:k,disabled:!M||t.isPending||n.isPending,isRunning:t.isPending||n.isPending})}),(0,w.jsx)(re,{visible:t.data!==void 0&&n.data!==void 0}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(R,{paneId:`A`,userMessage:T,mutation:t,otherResult:n.data?.response,validation:v}),(0,w.jsx)(R,{paneId:`B`,userMessage:T,mutation:n,otherResult:t.data?.response,validation:x})]})]})})}function O(e){let t={...k(`tier1_size`,e.tier1),...k(`tier2_size`,e.tier2),...k(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function k(e,t){let n=t.trim();if(n===``)return{};if(n===`null`)return{[e]:null};let r=Number(n);if(!Number.isInteger(r)||r<1)throw Error(`${e} must be a positive integer or 'null' (got "${n}")`);return{[e]:r}}function A(){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:`Memory Router Playground`}),(0,w.jsxs)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:[`Dry-run the v4 router with custom tier/batch overrides. Read-only — no rows are written to `,(0,w.jsx)(`code`,{children:`memory_v2_injection_events`}),` or`,` `,(0,w.jsx)(`code`,{children:`memory_v2_activation_logs`}),`, and no activation state is mutated. Leave an override blank to inherit the live config value; enter`,` `,(0,w.jsx)(`code`,{children:`null`}),` to explicitly disable a tier.`]})]})}function j({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let s=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},c=()=>{o([{assistantMessage:``,userMessage:``},...i])},l=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Conversational context (shared by both panes)`}),(0,w.jsx)(M,{id:`memory-router-playground-now`,label:`<now> block`,value:e,onChange:t,rows:6,monospace:!0,placeholder:r?`Loading current NOW.md…`:`Pre-filled with the live NOW.md. Edit to test alternate states.`,trailing:(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:`Reload live NOW.md`})}),(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`Recent (assistant, user) pairs · oldest first`}),(0,w.jsx)(`button`,{type:`button`,onClick:c,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:`+ Add older pair`})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[`Pair `,t+1,` of `,i.length,n?` · most recent`:``]}),!n&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`rounded px-2 py-1 text-label-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:`Remove`})]}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-assistant`,label:`[assistant]: reply`,value:e.assistantMessage,onChange:e=>s(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?`Leave blank for a first-turn scenario.`:`Assistant's reply that came before the user message below.`}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-user`,label:n?`Just-arrived [user]: message`:`[user]: message`,value:e.userMessage,onChange:e=>s(t,{userMessage:e}),rows:3,placeholder:n?`e.g. what should we ship next`:`User's message.`,required:n})]},t)})]})})}function M({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`label`,{htmlFor:e,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,w.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function N({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:l}){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:[`Config `,e]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(I,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,w.jsx)(I,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,w.jsx)(I,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,w.jsx)(F,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,w.jsx)(P,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:l}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?`Running…`:`Run ${e}`})})]})})}function P({paneId:e,value:t,onChange:n,defaultTemplate:r}){let[i,a]=(0,h.useState)(!1),o=`memory-router-playground-${e}-prompt`,s=t.trim().length>0;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` System prompt`,` `,(0,w.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,s?`custom`:`bundled`,`)`]})]}),i&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:`Load default`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!s,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:s?`pointer`:`not-allowed`},children:`Reset`})]})]}),i&&(0,w.jsx)(`textarea`,{id:o,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:`Custom router system prompt. Available placeholders:
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./useQuery-D2zf6Uhu.js";import{t as r}from"./useMutation-BuofVRHk.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./card-CL5iEMJO.js";import"./src-hn7lwVCD.js";import{Bt as o,Ht as s,S as c,Vt as l}from"./sdk.gen-AJllUeDf.js";import{a as u,n as d}from"./auth-store-CiQCAKS1.js";import{pr as f,wn as p}from"./index-BjEJFZTJ.js";import{t as m}from"./use-active-assistant-id-BIhArlF_.js";var h=e(t(),1),g=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function _(e,t,n){let{data:r,response:i}=await s({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new g(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new g(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:v(a)}}function v(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function y(e){return r({mutationFn:async t=>{if(!e)throw new g(0,`Missing assistantId`);return _(e,t)}})}async function b(e,t){let{data:n,response:r}=await c({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load LLM profiles`);if(!n)throw new g(r.status,`Empty response from profile list endpoint`);return n}function ee(e){return n({queryKey:[`llm-profiles`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return b(e,t)},enabled:!!e,staleTime:6e4})}async function x(e,t){let{data:n,response:r}=await l({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load router prompt template`);if(!n)throw new g(r.status,`Empty response from router prompt template endpoint`);return n}function te(e){return n({queryKey:[`router-prompt-template`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return x(e,t)},enabled:!!e,staleTime:1440*60*1e3})}async function S(e,t){let{data:n,response:r}=await o({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load NOW.md`);if(!n)throw new g(r.status,`Empty response from now-text endpoint`);return n}function C(e){return n({queryKey:[`memory-router-now-text`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return S(e,t)},enabled:!!e,staleTime:1/0})}var w=i();function T(){let e=d.use.user(),t=u(),n=f.use.memoryRouterPlayground();return t?(0,w.jsx)($,{children:`Loading…`}):!p(e)||!n?(0,w.jsx)($,{children:`Memory router playground is not available.`}):(0,w.jsx)(D,{})}var E={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function D(){let e=m(),t=y(e),n=y(e),r=ee(e),i=te(e),a=C(e),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)([{assistantMessage:``,userMessage:``}]),[u,d]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(u)return;let e=a.data?.nowText;typeof e==`string`&&o===``&&s(e)},[a.data?.nowText,o,u]);let[f,p]=(0,h.useState)(E),[g,_]=(0,h.useState)(E),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),T=c[c.length-1].userMessage,D=e=>{let r=e===`A`?f:g,i=e===`A`?b:S,a=e===`A`?t:n;i(null);let s;try{s=O(r)}catch(e){i(e instanceof Error?e.message:`Invalid override input`);return}let l=r.profile.trim().length>0?r.profile:void 0,u=r.customPrompt.trim().length>0?r.customPrompt:void 0,d=c.map((e,t)=>t===c.length-1?{...e,userMessage:e.userMessage.trim()}:e);a.mutate({recentTurnPairs:d,nowText:o,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...u===void 0?{}:{routerPromptOverride:u}})},k=()=>{D(`A`),D(`B`)},M=T.trim().length>0,P=M&&!t.isPending,F=M&&!n.isPending;return(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,w.jsx)(A,{}),(0,w.jsx)(j,{nowText:o,onNowTextChange:e=>{d(!0),s(e)},onReloadNowText:()=>{let e=a.data?.nowText;typeof e==`string`&&(s(e),d(!1))},nowTextLoading:a.isLoading,pairs:c,onPairsChange:l}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:f,onChange:p,onRun:()=>D(`A`),canRun:P,isRunning:t.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``}),(0,w.jsx)(N,{paneId:`B`,overrides:g,onChange:_,onRun:()=>D(`B`),canRun:F,isRunning:n.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``})]}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(ne,{onClick:k,disabled:!M||t.isPending||n.isPending,isRunning:t.isPending||n.isPending})}),(0,w.jsx)(re,{visible:t.data!==void 0&&n.data!==void 0}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(R,{paneId:`A`,userMessage:T,mutation:t,otherResult:n.data?.response,validation:v}),(0,w.jsx)(R,{paneId:`B`,userMessage:T,mutation:n,otherResult:t.data?.response,validation:x})]})]})})}function O(e){let t={...k(`tier1_size`,e.tier1),...k(`tier2_size`,e.tier2),...k(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function k(e,t){let n=t.trim();if(n===``)return{};if(n===`null`)return{[e]:null};let r=Number(n);if(!Number.isInteger(r)||r<1)throw Error(`${e} must be a positive integer or 'null' (got "${n}")`);return{[e]:r}}function A(){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:`Memory Router Playground`}),(0,w.jsxs)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:[`Dry-run the v4 router with custom tier/batch overrides. Read-only — no rows are written to `,(0,w.jsx)(`code`,{children:`memory_v2_injection_events`}),` or`,` `,(0,w.jsx)(`code`,{children:`memory_v2_activation_logs`}),`, and no activation state is mutated. Leave an override blank to inherit the live config value; enter`,` `,(0,w.jsx)(`code`,{children:`null`}),` to explicitly disable a tier.`]})]})}function j({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let s=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},c=()=>{o([{assistantMessage:``,userMessage:``},...i])},l=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Conversational context (shared by both panes)`}),(0,w.jsx)(M,{id:`memory-router-playground-now`,label:`<now> block`,value:e,onChange:t,rows:6,monospace:!0,placeholder:r?`Loading current NOW.md…`:`Pre-filled with the live NOW.md. Edit to test alternate states.`,trailing:(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:`Reload live NOW.md`})}),(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`Recent (assistant, user) pairs · oldest first`}),(0,w.jsx)(`button`,{type:`button`,onClick:c,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:`+ Add older pair`})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[`Pair `,t+1,` of `,i.length,n?` · most recent`:``]}),!n&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`rounded px-2 py-1 text-label-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:`Remove`})]}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-assistant`,label:`[assistant]: reply`,value:e.assistantMessage,onChange:e=>s(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?`Leave blank for a first-turn scenario.`:`Assistant's reply that came before the user message below.`}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-user`,label:n?`Just-arrived [user]: message`:`[user]: message`,value:e.userMessage,onChange:e=>s(t,{userMessage:e}),rows:3,placeholder:n?`e.g. what should we ship next`:`User's message.`,required:n})]},t)})]})})}function M({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`label`,{htmlFor:e,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,w.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function N({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:l}){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:[`Config `,e]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(I,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,w.jsx)(I,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,w.jsx)(I,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,w.jsx)(F,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,w.jsx)(P,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:l}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?`Running…`:`Run ${e}`})})]})})}function P({paneId:e,value:t,onChange:n,defaultTemplate:r}){let[i,a]=(0,h.useState)(!1),o=`memory-router-playground-${e}-prompt`,s=t.trim().length>0;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` System prompt`,` `,(0,w.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,s?`custom`:`bundled`,`)`]})]}),i&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:`Load default`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!s,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:s?`pointer`:`not-allowed`},children:`Reset`})]})]}),i&&(0,w.jsx)(`textarea`,{id:o,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:`Custom router system prompt. Available placeholders:
|
|
2
2
|
{{ASSISTANT_NAME}}, {{USER_NAME}}, {{PAGE_INDEX}}
|
|
3
3
|
Leave blank to use the bundled template. "Load default" seeds the textarea with the bundled body for editing.`,className:`rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,resize:`vertical`,minHeight:`120px`}})]})}function F({paneId:e,value:t,onChange:n,profiles:r,activeProfile:i}){let a=`memory-router-playground-${e}-profile`,o=i!==null&&i.length>0?`inherit active (${i})`:`inherit active`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:a,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`llm.profiles override`}),(0,w.jsxs)(`select`,{id:a,value:t,onChange:e=>n(e.target.value),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`},children:[(0,w.jsx)(`option`,{value:``,children:o}),r.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))]})]})}function I({paneId:e,label:t,value:n,onChange:r}){let i=`memory-router-playground-${e}-${t}`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:i,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:t}),(0,w.jsx)(`input`,{id:i,value:n,onChange:e=>r(e.target.value),placeholder:`inherit`,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`}})]})}function ne({onClick:e,disabled:t,isRunning:n}){return(0,w.jsx)(`button`,{type:`button`,onClick:e,disabled:t,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:t?`var(--surface-overlay)`:`var(--primary-base)`,color:t?`var(--content-disabled)`:`var(--content-on-primary)`,border:`none`,cursor:t?`not-allowed`:`pointer`},children:n?`Running…`:`Run both`})}function re({visible:e}){return e?(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-md px-4 py-2 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`},children:[(0,w.jsx)(L,{marker:`●`,markerColor:`var(--content-default)`,label:`in both`}),(0,w.jsx)(L,{marker:`◆`,markerColor:X(`A`),label:`A only`}),(0,w.jsx)(L,{marker:`◇`,markerColor:X(`B`),label:`B only`})]}):null}function L({marker:e,markerColor:t,label:n}){return(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{style:{color:t},children:e}),(0,w.jsx)(`span`,{children:n})]})}function R({paneId:e,userMessage:t,mutation:n,otherResult:r,validation:i}){let a=n.data;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(V,{paneId:e}),i!==null&&(0,w.jsx)(Q,{message:i}),n.isError&&(0,w.jsx)(Q,{message:n.error instanceof Error?n.error.message:`Failed to run simulation`}),a!==void 0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(H,{paneId:e,userMessage:t,result:a.response,otherResult:r}),(0,w.jsx)(z,{paneId:e,rawRequest:a.rawRequest,rawResponse:a.rawResponse})]})]})}function z({paneId:e,rawRequest:t,rawResponse:n}){let[r,i]=(0,h.useState)(!1);return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[r?`▾`:`▸`,` Raw API exchange`]}),r&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(B,{label:`Request (Pane ${e})`,body:t}),(0,w.jsx)(B,{label:`Response (Pane ${e})`,body:n})]})]})})}function B({label:e,body:t}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`pre`,{className:`overflow-auto rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,maxHeight:`320px`,whiteSpace:`pre`},children:t.length===0?`(empty)`:t})]})}function V({paneId:e}){return(0,w.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:[`Pane `,e]})}function H({paneId:e,userMessage:t,result:n,otherResult:r}){let i=(0,h.useMemo)(()=>U(n,r),[n,r]),a=(0,h.useMemo)(()=>q(n),[n]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(G,{result:n,userMessage:t,otherResult:r,counts:(0,h.useMemo)(()=>W(i),[i])}),(0,w.jsx)(K,{result:n}),n.failureReason!==null&&(0,w.jsx)(Q,{message:`Router failure: ${n.failureReason}`}),a.length===0?(0,w.jsx)(oe,{}):a.map(t=>(0,w.jsx)(ae,{paneId:e,source:t.source,slugs:t.slugs,scores:n.scores,diff:i},t.source))]})}function U(e,t){let n=new Map;if(t===void 0){for(let t of e.selectedSlugs)n.set(t,`both`);return n}let r=new Set(t.selectedSlugs);for(let t of e.selectedSlugs)n.set(t,r.has(t)?`both`:`only-here`);return n}function W(e){let t=0,n=0;for(let r of e.values())r===`both`?t++:n++;return{total:e.size,shared:t,unique:n}}function G({result:e,userMessage:t,otherResult:n,counts:r}){let i=[{label:`User message`,value:t},{label:`Total candidate pages`,value:e.totalCandidatePages.toLocaleString()},{label:`Selected`,value:`${e.selectedSlugs.length} (live max_page_ids: ${e.effectiveConfig.max_page_ids})`}];return n!==void 0&&i.push({label:`Diff`,value:`${r.shared} shared · ${r.unique} unique to this pane`}),(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Summary`}),(0,w.jsx)(Z,{rows:i})]})})}function K({result:e}){let t=[`tier1_size`,`tier2_size`,`batch_size`,`max_page_ids`].map(t=>{let n=e.effectiveConfig[t],r=e.overrides[t];return{label:t,value:`${n===null?`null`:String(n)}${r===void 0?``:` (override)`}`}});return t.push({label:`llm.profiles override`,value:e.profileOverride===null?`inherit active`:`${e.profileOverride} (override)`}),t.push({label:`system prompt`,value:e.routerPromptOverridden?`custom`:`bundled`}),(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Effective config`}),(0,w.jsx)(Z,{rows:t})]})})}function q(e){let t=new Map;for(let n of e.selectedSlugs){let r=e.sourceBySlug[n];if(r===void 0)continue;let i=t.get(r)??[];i.push(n),t.set(r,i)}return[...t.keys()].sort((e,t)=>J(e)-J(t)).map(e=>({source:e,slugs:t.get(e)}))}function J(e){return e===`tier1`?0:e===`tier2`?1:e.startsWith(`tier3:`)?2+Number(e.slice(6)):2**53-1}function Y(e){return e===`tier1`?`tier 1`:e===`tier2`?`tier 2`:e.startsWith(`tier3:`)?`tier 3 · b${e.slice(6)}`:e}function X(e){return e===`A`?`var(--system-mid-strong)`:`var(--primary-base)`}function ie(e,t){return t===`both`?{color:`var(--content-default)`,marker:`●`}:{color:X(e),marker:e===`A`?`◆`:`◇`}}function ae({paneId:e,source:t,slugs:n,scores:r,diff:i}){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:Y(t)}),(0,w.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[n.length,` `,n.length===1?`page`:`pages`]})]}),(0,w.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>{let{color:a,marker:o}=ie(e,i.get(n)??`only-here`);return(0,w.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,w.jsx)(`span`,{style:{color:a},children:o}),(0,w.jsx)(`code`,{className:`text-body-medium-default`,style:{color:a},children:n})]}),t===`tier2`&&(0,w.jsxs)(`span`,{className:`tabular-nums text-label-default`,style:{color:`var(--content-secondary)`},children:[`EMA `,(r[n]??0).toFixed(3)]})]},n)})})]})})}function oe(){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`No pages selected`}),(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`The router returned an empty selection. Try a more specific query, or relax the override values.`})]})})}function Z({rows:e}){return(0,w.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(({label:e,value:t})=>(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsx)(`span`,{className:`shrink-0 text-label-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`span`,{className:`text-right text-body-medium-lighter`,style:{color:`var(--content-default)`},children:t})]},e))})}function Q({message:e}){return(0,w.jsx)(`div`,{className:`rounded-md px-4 py-3 text-body-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--system-negative-strong)`},children:e})}function $({children:e}){return(0,w.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-8 text-label-default`,style:{color:`var(--content-tertiary)`},children:e})}export{T as MemoryRouterPlaygroundPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./button-DdEh-9f_.js";import"./src-hn7lwVCD.js";import{t as i}from"./x-BDqbYVtS.js";import{
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./button-DdEh-9f_.js";import"./src-hn7lwVCD.js";import{t as i}from"./x-BDqbYVtS.js";import{va as a}from"./index-BjEJFZTJ.js";var o=e(t(),1),s=n(),c=`(min-width: 640px)`,l=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function u({open:e,onClose:t,children:n,title:a}){let u=(0,o.useRef)(null),d=(0,o.useRef)(null),f=(0,o.useRef)(t);return(0,o.useEffect)(()=>{f.current=t}),(0,o.useEffect)(()=>{if(!e)return;d.current?.focus();let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.matchMedia(c),r=e=>{e.matches&&f.current()};n.addEventListener(`change`,r);let i=e=>{if(e.key===`Escape`){f.current();return}if(e.key!==`Tab`||!u.current)return;let t=u.current.querySelectorAll(l),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=u.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),n.removeEventListener(`change`,r),document.body.style.overflow=t}},[e]),e?(0,s.jsxs)(`div`,{ref:u,className:`fixed inset-0 sm:hidden`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":a,children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":`Close sidebar`,className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,s.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`},children:[(0,s.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,s.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:a}),(0,s.jsx)(r,{ref:d,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,s.jsx)(i,{"aria-hidden":!0}),onClick:t,"aria-label":`Close`,tintColor:`var(--content-tertiary)`})]}),(0,s.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:n})]})]}):null}function d({onClick:e}){return(0,s.jsx)(r,{type:`button`,variant:`ghost`,iconOnly:(0,s.jsx)(a,{"aria-hidden":!0}),onClick:e,"aria-label":`Open sidebar`,tintColor:`var(--content-secondary)`,className:`sm:hidden`})}export{d as n,u as t};
|
|
@@ -0,0 +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-DNHWXaGq.js";import{t as i}from"./useQuery-D2zf6Uhu.js";import{t as a}from"./useMutation-BuofVRHk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./menu-B79-l6IU.js";import{t as c}from"./notice-CF2pptne.js";import{n as l,r as u,t as d}from"./panel-item-FzMfzMJA.js";import{t as f}from"./input-Cu3PPVCq.js";import{t as p}from"./createLucideIcon-D6d6iDdi.js";import{t as m}from"./bell-C7RL04h4.js";import{t as h}from"./loader-circle-BSAFLoPH.js";import{i as g}from"./routes-Dk5Qeryt.js";import{n as _}from"./use-is-mobile-D_xrnINF.js";import{$ as v,Q as y,dn as b,et as x,fa as S,fn as C,hn as w,ji as T,ln as E,mn as D,mo as O,pn as k,un as A}from"./index-BjEJFZTJ.js";import{r as j}from"./format-date-lYqfuFdi.js";var M=p(`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`}]]),N=p(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),P=e(t(),1);function F(e){e.invalidateQueries({queryKey:b()}),e.invalidateQueries({queryKey:w()})}function I(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var L=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],R=o();function z({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(D()),c=_(),[u,f]=(0,P.useState)(!1),p=()=>F(i),m=async t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();await o.mutateAsync({path:{id:e},body:{snoozed_until:n}}),p()},h=async()=>{await o.mutateAsync({path:{id:e},body:{snoozed_until:null}}),p()};return c?(0,R.jsxs)(l.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:n}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Snooze until…`})}),(0,R.jsxs)(l.Body,{children:[L.map(({label:e,hours:t})=>(0,R.jsx)(d,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,R.jsx)(d,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,R.jsxs)(s.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(s.Trigger,{children:n}),(0,R.jsxs)(s.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,R.jsx)(s.Label,{children:`Snooze until…`}),L.map(({label:e,hours:t})=>(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void m(t),children:e},e)),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(s.Separator,{}),(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void h(),children:`Clear snooze`})]})]})]})}function B({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(C()),l=a(k()),[u,d]=(0,P.useState)(``),p=()=>F(s),m=async()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();n(await c.mutateAsync({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}})),p(),t()},g=async e=>{await l.mutateAsync({path:{rule_id:e}}),i(e),p(),t()},_=c.isPending||l.isPending;return(0,R.jsxs)(`div`,{children:[!o&&(0,R.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,R.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,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,R.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,j(e.expires_at)]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void g(e.id),disabled:_,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,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,R.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(),disabled:_,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,R.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function V({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=I(e),a=!e.is_read;return(0,R.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,R.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,R.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,R.jsx)(T,{className:`h-3 w-3`}),`Alert`]}),i&&(0,R.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,R.jsx)(S,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,R.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,R.jsx)(O,{className:`h-3 w-3`}),`Resolved`]})]}),(0,R.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,R.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsxs)(`span`,{children:[`Last seen `,j(e.last_seen_at)]}),e.occurrence_count>1&&(0,R.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,R.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,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(O,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,R.jsx)(z,{notificationId:e.id,currentlySnoozed:i,children:(0,R.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,R.jsx)(S,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function H(){let e=x({platformHostedOnly:!0}),t=y(),o=v(),s=r(),d=_(),[f,p]=(0,P.useState)(`open`),[b,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),{data:T,isLoading:D,isError:O,refetch:k}=i({...A({query:{status:f}}),enabled:e===`full`&&t}),j=e===`full`&&o||(t?D:!1);(0,P.useEffect)(()=>{!t&&b&&S(!1)},[t,b]);let I=t?O:!1,L=t?T?.results??[]:[],z=L.filter(e=>!e.is_read&&!e.is_resolved),H=a(E()),[U,W]=(0,P.useState)(new Set),[G,K]=(0,P.useState)(!1),q=(0,P.useCallback)(()=>F(s),[s]),J=async(e,t)=>{W(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),q()}finally{W(t=>{let n=new Set(t);return n.delete(e),n})}},Y=async()=>{if(!(z.length===0||G)){K(!0);try{await Promise.allSettled(z.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{q(),K(!1)}}},X=(0,R.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,R.jsx)(M,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),Z=(0,R.jsx)(B,{existingRules:C,onClose:()=>S(!1),onPauseCreated:e=>w(t=>[...t,e]),onPauseDeleted:e=>w(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,R.jsx)(n,{replace:!0,to:g.settings.general}):e===`disabled`?(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,R.jsx)(c,{tone:`info`,children:`Log in to the Vellum platform to view notifications.`})]}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(d?(0,R.jsxs)(l.Root,{open:b,onOpenChange:S,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:X}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Pause alerts`})}),(0,R.jsx)(l.Body,{children:(0,R.jsx)(B,{existingRules:C,onClose:()=>S(!1),onPauseCreated:e=>w(t=>[...t,e]),onPauseDeleted:e=>w(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,R.jsxs)(u.Root,{open:b,onOpenChange:S,children:[(0,R.jsx)(u.Trigger,{asChild:!0,children:X}),(0,R.jsx)(u.Content,{align:`end`,className:`w-72`,children:Z})]}))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.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,R.jsx)(`button`,{type:`button`,onClick:()=>p(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`&&z.length>1&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void Y(),disabled:G,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:[G?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(N,{className:`h-3 w-3`}),`Mark all as read (`,z.length,`)`]})]}),j?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,R.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):I?(0,R.jsxs)(c,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>void k(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):L.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,R.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,R.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,R.jsx)(`div`,{className:`space-y-3`,children:L.map(e=>(0,R.jsx)(V,{notification:e,onAck:(e,t)=>void J(e,t),isAcking:U.has(e.id)},e.id))})]})}export{H as NotificationsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{
|
|
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{j as i}from"./index-BjEJFZTJ.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;
|
package/dist/assets/{oauth-popup-complete-page-CzA0WXr4.js → oauth-popup-complete-page-D5wVrngS.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{
|
|
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{D as i,E as a,j as o}from"./index-BjEJFZTJ.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;
|
|
@@ -102,4 +102,4 @@ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";impor
|
|
|
102
102
|
color: var(--oauth-text-secondary);
|
|
103
103
|
margin: 0;
|
|
104
104
|
}
|
|
105
|
-
`;function f(e){return e.split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function p(){let[e]=n(),t=e.get(`requestId`),r=e.get(`oauth_status`),p=e.get(`oauth_provider`),m=e.get(`oauth_code`),h=e.get(`native`)===`1`,g=p?f(p):``,_=r===`connected`,v=_?g?`Connected to ${g}`:`Authorization Successful`:`Authorization Failed`,y=_?`You can close this popup and return to the app.`:`${g||`Service`} connection failed. Please try again.`;return(0,s.useEffect)(()=>{if(h&&t){let e=
|
|
105
|
+
`;function f(e){return e.split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function p(){let[e]=n(),t=e.get(`requestId`),r=e.get(`oauth_status`),p=e.get(`oauth_provider`),m=e.get(`oauth_code`),h=e.get(`native`)===`1`,g=p?f(p):``,_=r===`connected`,v=_?g?`Connected to ${g}`:`Authorization Successful`:`Authorization Failed`,y=_?`You can close this popup and return to the app.`:`${g||`Service`} connection failed. Please try again.`;return(0,s.useEffect)(()=>{if(h&&t){let e=i(window.location.host);if(e){window.location.href=a(e,{requestId:t,oauthStatus:r||null,oauthProvider:p||null,oauthCode:m||null});return}}let e={type:`vellum:oauth-complete`,requestId:t,oauthStatus:r||null,oauthProvider:p||null,oauthCode:m||null};if(window.opener&&t&&window.opener.postMessage(e,window.location.origin),t)try{window.localStorage.setItem(o(t),JSON.stringify(e))}catch{}window.close()},[t,r,p,m,h]),(0,c.jsxs)(`div`,{className:`oauth-page`,children:[(0,c.jsx)(`style`,{dangerouslySetInnerHTML:{__html:d}}),(0,c.jsxs)(`div`,{className:`oauth-card`,children:[_?(0,c.jsx)(l,{}):(0,c.jsx)(u,{}),(0,c.jsx)(`h1`,{children:v}),(0,c.jsx)(`p`,{children:y}),!_&&m&&(0,c.jsxs)(`p`,{style:{marginTop:8,fontSize:11,color:`var(--oauth-text-secondary)`,opacity:.7},children:[`Error: `,m]})]})]})}export{p as OAuthPopupCompletePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t}from"./jsx-runtime-CVSDxk6A.js";import{i as n}from"./routes-Dk5Qeryt.js";var r=t();function i(){return(0,r.jsx)(e,{to:n.account.login,replace:!0})}export{i as PasswordResetPage};
|
package/dist/assets/{platform-loopback-page-CNTdcgsZ.js → platform-loopback-page--72P008D.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{b as a}from"./resolved-assistants-store-ub66utfl.js";import{k as o,n as s}from"./auth-store-CiQCAKS1.js";import{c}from"./api-DEEx3e9R.js";import{i as l}from"./routes-Dk5Qeryt.js";var u=e(t(),1),d=i(),f=`vellum:loopback:state`,p=`vellum:loopback:returnTo`;function m(){let[e]=r(),t=n(),[i,m]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let n=e.get(`state`),r=e.get(`session_token`),i=sessionStorage.getItem(f),u=sessionStorage.getItem(p)||l.assistant;if(sessionStorage.removeItem(f),sessionStorage.removeItem(p),!n||n!==i){m(`Login failed: state mismatch. Please try again.`);return}if(!r){m(`Login failed: no session token received. Please try again.`);return}if(!/^[a-zA-Z0-9]+$/.test(r)){m(`Login failed: invalid session token.`);return}document.cookie=`sessionid=${r}; path=/; samesite=lax; max-age=1209600`,(async()=>{await s.getState().initSession(),await o(!0);try{let e=await c();if(e.ok&&e.data.length>0){await a(e.data),t(l.assistant,{replace:!0});return}}catch{}t(u,{replace:!0})})()},[e,t]),i?(0,d.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,d.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,d.jsx)(`p`,{className:`text-body-medium-default`,children:i}),(0,d.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-[var(--border-disabled)] px-4 py-2 text-sm hover:bg-[var(--surface-lift)]`,onClick:()=>void t(l.welcome),children:`Back to Welcome`})]})}):(0,d.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,d.jsx)(`p`,{className:`text-body-medium-default`,children:`Completing login...`})})}export{m as PlatformLoopbackPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{p as n,r,t as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DNHWXaGq.js";import{t as o}from"./useQuery-D2zf6Uhu.js";import{t as s}from"./useMutation-BuofVRHk.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./button-DdEh-9f_.js";import{t as u}from"./card-CL5iEMJO.js";import"./src-hn7lwVCD.js";import{t as d}from"./confirm-dialog-NYG-K9zN.js";import{t as f}from"./external-link-BCB1rbW9.js";import{t as p}from"./loader-circle-BSAFLoPH.js";import{D as m,E as h,O as g,T as _,j as v,k as y}from"./react-query.gen-B8xaBreR.js";import{i as b}from"./routes-Dk5Qeryt.js";import{t as x}from"./assistant-feature-flag-store-0382ImYF.js";import{Ni as S,bo as C,ji as w,xo as T}from"./index-BjEJFZTJ.js";import{t as E}from"./use-active-assistant-id-BIhArlF_.js";import{t as D}from"./file-markdown-DX5x9ziL.js";var O=e(t(),1),k=c();function A(){let e=x.use.hasHydrated(),t=x.use.externalPlugins(),c=E(),{name:f}=n(),p=a(),[S,w]=(0,O.useState)(!1),T=o({...h({path:{assistant_id:c,name:f??``}}),enabled:!!c&&!!f}),A=(0,O.useCallback)(()=>{p.invalidateQueries({queryKey:g({path:{assistant_id:c}})}),p.invalidateQueries({queryKey:v({path:{assistant_id:c}})}),f&&p.invalidateQueries({queryKey:m({path:{assistant_id:c,name:f}})})},[c,f,p]),I=s({...y(),onSuccess:A}),L=s({..._(),onSuccess:A});if(!e)return null;if(!t)return(0,k.jsx)(r,{to:b.identity,replace:!0});if(!f)return(0,k.jsx)(r,{to:b.plugins,replace:!0});let R=()=>{I.mutate({path:{assistant_id:c},body:{name:f}})},z=()=>{w(!1),L.mutate({path:{assistant_id:c,name:f}})},B=T.data??null;return(0,k.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,k.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,k.jsx)(l,{asChild:!0,variant:`ghost`,children:(0,k.jsx)(i,{to:b.plugins,"aria-label":`Back to plugins`,children:(0,k.jsx)(C,{"aria-hidden":!0})})}),(0,k.jsx)(j,{name:f,plugin:B,onInstall:R,onRemove:()=>w(!0),isInstalling:I.isPending,isRemoving:L.isPending})]}),(I.isError||L.isError)&&(0,k.jsx)(F,{message:I.isError?`Failed to install plugin. Please try again.`:`Failed to remove plugin. Please try again.`}),(0,k.jsx)(u.Root,{asChild:!0,children:(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:T.isLoading?(0,k.jsx)(N,{}):T.isError||!B?(0,k.jsx)(P,{}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(M,{plugin:B}),B.readme?(0,k.jsx)(D,{content:B.readme}):(0,k.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})}),(0,k.jsx)(d,{open:S,title:`Remove plugin`,message:`Remove "${B?.name??f}" from this assistant?`,confirmLabel:`Remove`,destructive:!0,onConfirm:z,onCancel:()=>w(!1)})]})}function j({name:e,plugin:t,onInstall:n,onRemove:r,isInstalling:i,isRemoving:a}){let o=t?.installed??!1,s=t?.source.kind===`github`;return(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,k.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:s?`📦`:`🧩`}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,k.jsx)(`h2`,{className:`truncate text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,k.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,s?(0,k.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]}),t?.description?(0,k.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?o?(0,k.jsx)(l,{type:`button`,variant:`dangerOutline`,onClick:r,disabled:a,leftIcon:a?(0,k.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,k.jsx)(S,{"aria-hidden":!0}),children:`Remove`}):(0,k.jsx)(l,{type:`button`,onClick:n,disabled:i,leftIcon:i?(0,k.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,k.jsx)(T,{"aria-hidden":!0}),children:`Install`}):null]})}function M({plugin:e}){let t=[{label:`Source`,value:e.source.kind===`github`?e.source.repo:`First-party`,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,k.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,k.jsxs)(`div`,{className:`contents`,children:[(0,k.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,k.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,k.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,k.jsx)(f,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function N(){return(0,k.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,k.jsx)(p,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function P(){return(0,k.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,k.jsx)(w,{className:`h-6 w-6`,"aria-hidden":!0}),(0,k.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,k.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function F({message:e}){return(0,k.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,k.jsx)(w,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),e]})}export{A 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-
|
|
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-D2zf6Uhu.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-CL5iEMJO.js";import"./src-hn7lwVCD.js";import{t as s}from"./input-Cu3PPVCq.js";import{t as c}from"./chevron-right-zTNPbA1m.js";import{t as l}from"./loader-circle-BSAFLoPH.js";import{sn as u}from"./sdk.gen-AJllUeDf.js";import{A as d,O as f}from"./react-query.gen-B8xaBreR.js";import{i as p}from"./routes-Dk5Qeryt.js";import{t as m}from"./assistant-feature-flag-store-0382ImYF.js";import{Yi as h,ji as g,ta as _}from"./index-BjEJFZTJ.js";import{t as v}from"./use-active-assistant-id-BIhArlF_.js";var y=e(t(),1),b=a();function x({match:e}){let t=e.source.kind===`github`;return(0,b.jsx)(o.Root,{asChild:!0,children:(0,b.jsxs)(r,{to:p.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,b.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`📦`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),t&&(0,b.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`})]}),e.description&&(0,b.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.description}),(0,b.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},title:e.path,children:e.path})]}),(0,b.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 S({plugin:e}){return(0,b.jsx)(o.Root,{asChild:!0,children:(0,b.jsxs)(r,{to:p.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,b.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`🧩`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),e.version?(0,b.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null]}),(0,b.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,b.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,b.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 C=300*1e3;function w(e,...t){return e?t.some(t=>t?.toLowerCase().includes(e)):!0}function T({assistantId:e}){let[t,n]=(0,y.useState)(``),r=t.trim().toLowerCase(),a=i({queryKey:f({path:{assistant_id:e},query:{q:void 0}}),queryFn:async({signal:t})=>{let n=await u({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:C}),o=i({...d({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:C}),s=(0,y.useMemo)(()=>E(a.data?.plugins??[]),[a.data?.plugins]),c=(0,y.useMemo)(()=>new Set(s.map(e=>e.name)),[s]),l=(0,y.useMemo)(()=>s.filter(e=>w(r,e.name,e.description)),[s,r]),p=(0,y.useMemo)(()=>(o.data?.matches??[]).filter(e=>!c.has(e.name)&&w(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&&p.length===0;return(0,b.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[(0,b.jsx)(D,{search:t,onSearchChange:n,isSearching:m}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:[(0,b.jsx)(O,{title:`Installed`}),h?(0,b.jsx)(k,{}):a.isError?(0,b.jsx)(M,{}):_?(0,b.jsx)(A,{hasQuery:!!r}):(0,b.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(S,{plugin:e})},e.id))}),(0,b.jsx)(`div`,{className:`mt-6`}),(0,b.jsx)(O,{title:`Available to install`}),g?(0,b.jsx)(k,{}):o.isError?(0,b.jsx)(N,{}):v?(0,b.jsx)(j,{hasQuery:!!r}):(0,b.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(x,{match:e})},e.path))})]})]})}function E(e){return[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}))}function D({search:e,onSearchChange:t,isSearching:n}){return(0,b.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,b.jsx)(s,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search Plugins`,"aria-label":`Search Plugins`,leftIcon:(0,b.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:n?(0,b.jsx)(l,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`})})}function O({title:e}){return(0,b.jsx)(`h3`,{className:`mb-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e})}function k(){return(0,b.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,b.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function A({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?h:_;return(0,b.jsx)(o.Root,{children:(0,b.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,b.jsx)(r,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,b.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,b.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function j({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,b.jsx)(o.Root,{children:(0,b.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,b.jsx)(h,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,b.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,b.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function M(){return(0,b.jsx)(o.Root,{children:(0,b.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,b.jsx)(g,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,b.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,b.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 N(){return(0,b.jsx)(o.Root,{children:(0,b.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,b.jsx)(_,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,b.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Couldn't load catalog`}),(0,b.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 P(){let e=m.use.hasHydrated(),t=m.use.externalPlugins(),r=v();return e?t?(0,b.jsx)(T,{assistantId:r}):(0,b.jsx)(n,{to:p.identity,replace:!0}):null}export{P as PluginsPage};
|