@vellumai/web 0.10.10-staging.2 → 0.10.10
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-Cn_Ux2k8.js → account-page-B27dNQ3d.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-hdemc9Ns.js → acp-run-detail-panel-B0k2rYpM.js} +1 -1
- package/dist/assets/{activity-steps-panel-CJDoPVUC.js → activity-steps-panel-LDydO3OK.js} +1 -1
- package/dist/assets/{ai-page-DX1CAGiX.js → ai-page-UMlli-yL.js} +1 -1
- package/dist/assets/{api-key-screen-C0F9Kodk.js → api-key-screen-BYdMayOl.js} +1 -1
- package/dist/assets/{background-task-detail-panel-B3sQQ2WB.js → background-task-detail-panel-wG11sk-D.js} +1 -1
- package/dist/assets/{billing-page-DbgQl5CS.js → billing-page-BHg4_D8p.js} +1 -1
- package/dist/assets/{bookmarks-page-Bg1kpqdy.js → bookmarks-page-Dj_WhT38.js} +1 -1
- package/dist/assets/{channels-page-route-Cm7KQpHs.js → channels-page-route-BLMC84yp.js} +1 -1
- package/dist/assets/{command-palette-B23DDF8y.js → command-palette-nEbCvF9B.js} +1 -1
- package/dist/assets/{command-palette-window-page-2gnvF4NV.js → command-palette-window-page-Um5WOMD9.js} +1 -1
- package/dist/assets/{community-page-De9KLKyn.js → community-page-BpLDD6Gw.js} +1 -1
- package/dist/assets/{contacts-page-route-CZwZ6baw.js → contacts-page-route-Na5xsrCM.js} +1 -1
- package/dist/assets/{credentials-page-st-zOas5.js → credentials-page-DiPIjJOv.js} +1 -1
- package/dist/assets/{debug-page-BhcVrLKj.js → debug-page-Op9gPo8_.js} +1 -1
- package/dist/assets/{deploy-dialogs-BJRrRbSc.js → deploy-dialogs-BNZpdpkW.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-c0oweWwM.js → detail-panel-stop-button-QQ20Gb80.js} +1 -1
- package/dist/assets/{developer-page-DRakR84C.js → developer-page-CEm6gJ5c.js} +1 -1
- package/dist/assets/{dictation-overlay-page-jXIAQQGI.js → dictation-overlay-page-DFy73eLq.js} +1 -1
- package/dist/assets/{document-viewer-page-B6lpLvJw.js → document-viewer-page-BB8CFKzx.js} +1 -1
- package/dist/assets/{emails-page-ChYRO5ST.js → emails-page-DfS8M0KH.js} +1 -1
- package/dist/assets/{general-page-0F5njKZW.js → general-page-DRyIIgkk.js} +1 -1
- package/dist/assets/{hatching-screen-CW3BRgRH.js → hatching-screen-D0zBF6G3.js} +1 -1
- package/dist/assets/{home-page-route-D_8JCZ_Q.js → home-page-route-BMbIyFRk.js} +1 -1
- package/dist/assets/{hosting-screen-DHETBcAy.js → hosting-screen-Zb6-T1r9.js} +1 -1
- package/dist/assets/identity-page-route-BmQtmPF0.js +7 -0
- package/dist/assets/{index-CmaRQR9x.js → index-CgcZXB4g.js} +7 -7
- package/dist/assets/{inspect-page-Cj0WVion.js → inspect-page-Iemfgo7r.js} +1 -1
- package/dist/assets/{integrations-page-CH-pFd_e.js → integrations-page-8U6yrpy_.js} +1 -1
- package/dist/assets/{intelligence-layout-BHGZqgWE.js → intelligence-layout-Bk61phvn.js} +1 -1
- package/dist/assets/{latest-assistant-text-DqYv-19M.js → latest-assistant-text-cGlQO-ow.js} +1 -1
- package/dist/assets/{library-detail-page-D1SaX446.js → library-detail-page-BCRw2pXt.js} +1 -1
- package/dist/assets/{library-page-CY_UIQ7K.js → library-page-BCFKyR7R.js} +1 -1
- package/dist/assets/{logout-page-BsVCSXLH.js → logout-page-C27fK6LX.js} +1 -1
- package/dist/assets/{logs-layout-D_7jq15m.js → logs-layout-DrBxBaoW.js} +1 -1
- package/dist/assets/{memory-page-route-BGWq_aq8.js → memory-page-route-BdF70Wmp.js} +1 -1
- package/dist/assets/{memory-router-playground-page-DThWyhXE.js → memory-router-playground-page-BlT9oFs0.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-XsUj_ej1.js → mobile-sidebar-drawer-BmS9adnj.js} +1 -1
- package/dist/assets/{notifications-page-4H3d3TVi.js → notifications-page-DsQJaAsR.js} +1 -1
- package/dist/assets/{oauth-complete-page-IYjT22S6.js → oauth-complete-page-BMqOW3MA.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-B2tgdOeo.js → oauth-popup-complete-page-D-r0oM8y.js} +1 -1
- package/dist/assets/{pairing-page-BsGxP4RT.js → pairing-page-CELMlJeG.js} +1 -1
- package/dist/assets/{personality-page-DWuNCYhT.js → personality-page-BdkuO-Fy.js} +1 -1
- package/dist/assets/{plugins-page-O4J9g6Y8.js → plugins-page-DblHkb06.js} +1 -1
- package/dist/assets/{prechat-route-CoHHHLoD.js → prechat-route-DcgCgSV8.js} +1 -1
- package/dist/assets/{privacy-page-DXHDyrXM.js → privacy-page-Ccn6St6F.js} +1 -1
- package/dist/assets/{privacy-screen-N6-nGjeG.js → privacy-screen-IqygR70e.js} +1 -1
- package/dist/assets/{provider-callback-page-B6zqXdPZ.js → provider-callback-page-fjZoTIWk.js} +1 -1
- package/dist/assets/{quick-input-page-UeFQo32q.js → quick-input-page-BmPU9B6u.js} +1 -1
- package/dist/assets/{research-mock-page-DL9B4Lli.js → research-mock-page-CssYNgG7.js} +1 -1
- package/dist/assets/{research-onboarding-route-CEPszqjJ.js → research-onboarding-route-sFu5EQW9.js} +1 -1
- package/dist/assets/{review-terms-screen-CchSUndG.js → review-terms-screen-Cv_jkYHP.js} +1 -1
- package/dist/assets/{schedules-page-Bj5HEJa-.js → schedules-page-DCFEdNCs.js} +1 -1
- package/dist/assets/{select-assistant-screen-BQLQKCB5.js → select-assistant-screen-B0qoVKd5.js} +1 -1
- package/dist/assets/{settings-layout-Dr3LiWJ0.js → settings-layout-B_NU6GFk.js} +1 -1
- package/dist/assets/{share-feedback-modal-DvC-1HRQ.js → share-feedback-modal-c0vGJBMA.js} +1 -1
- package/dist/assets/{sidebar-tree-r9N8LP3u.js → sidebar-tree-Cq8ACYzP.js} +1 -1
- package/dist/assets/{signup-page-B7lZHfHL.js → signup-page-CQLi5G7p.js} +1 -1
- package/dist/assets/{skill-detail-page-onU_WAHM.js → skill-detail-page-C_-DI2tN.js} +1 -1
- package/dist/assets/{skill-detail-panel-r5S_O0rZ.js → skill-detail-panel-J7W0DU8J.js} +1 -1
- package/dist/assets/{skills-page-Cf86q643.js → skills-page-BhMnBhiu.js} +1 -1
- package/dist/assets/{start-screen-kBX69v2m.js → start-screen-Cbh01xPj.js} +1 -1
- package/dist/assets/{subagent-detail-panel-D6oy2K_C.js → subagent-detail-panel-D9BXd8vR.js} +1 -1
- package/dist/assets/{system-events-page-CXkh6imt.js → system-events-page-BWbjCZVh.js} +1 -1
- package/dist/assets/{theme-stage-page-B1KCcRzM.js → theme-stage-page-DUeQZVJ3.js} +1 -1
- package/dist/assets/{tiptap-document-editor-BVFwGbyO.js → tiptap-document-editor-yCVhNTRu.js} +1 -1
- package/dist/assets/{tool-detail-panel-CI8Z5mU5.js → tool-detail-panel-Dtl2QLOW.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-78mnz39g.js → upgrade-cancel-page-DmdDdCjG.js} +1 -1
- package/dist/assets/{upgrade-success-page-Dnqc4oxD.js → upgrade-success-page-DQoC2Y_H.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-D0dDGwFZ.js → use-assistant-identity-details-D-gTqmOL.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-CzIG6Agy.js → use-edge-swipe-back-Dpo-0Weh.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BLqplXYp.js → use-invite-link-dialog-DhVTs4OS.js} +1 -1
- package/dist/assets/{use-skill-actions-B58D56j9.js → use-skill-actions-fDejA0nc.js} +1 -1
- package/dist/assets/{use-skill-categories-BewT8dcB.js → use-skill-categories-DCOdxAre.js} +1 -1
- package/dist/assets/{use-skill-detail-files-S961Kf-o.js → use-skill-detail-files-DS6fk9Xz.js} +1 -1
- package/dist/assets/{voice-page-IaJC48fm.js → voice-page-BRscGXct.js} +1 -1
- package/dist/assets/{weather-forecast-display-Cd2sZBmz.js → weather-forecast-display-Dcw7Ta6D.js} +1 -1
- package/dist/assets/{welcome-screen-CUTRt2OQ.js → welcome-screen-C35jMBVC.js} +1 -1
- package/dist/assets/{workflow-detail-panel-BRYRq60N.js → workflow-detail-panel-CYjQlhPc.js} +1 -1
- package/dist/assets/{workspace-page-DgDej6f2.js → workspace-page-Dh-OnRd7.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/identity-page-route-B1o8eOMl.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,c as n,i as r}from"./local-settings-C-dW2vkq.js";import{t as i}from"./react-DJZBPgpf.js";import{t as a}from"./button-BQVYX8n_.js";import{m as o,t as s}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as c}from"./QueryClientProvider-DKhXIxGb.js";import{t as l}from"./useQuery-B45lW1Kk.js";import{t as u}from"./useMutation-Lj4VunQV.js";import{t as d}from"./jsx-runtime-CVSDxk6A.js";import{t as f}from"./card-D8zyWtZh.js";import{r as p}from"./middleware-DL-IveDQ.js";import{t as m}from"./chevron-down-DpYf9Gwq.js";import{n as h}from"./list-row-9xgQystQ.js";import{t as g}from"./info-DPHR_AMJ.js";import{j as _,k as v}from"./src-CDdn26Yb.js";import{t as y}from"./toggle-QSEiPr3k.js";import{t as b}from"./dropdown-BMNSccmo.js";import{At as x,Mt as S,Nt as C,Ot as w}from"./react-query.gen-BQH0QRfT.js";import{c as T}from"./routes-XPLb07Av.js";import{Gr as E,Hr as D,Ui as O,Ur as ee,Vr as k,Wr as A,an as te,ar as j,cr as M,dr as ne,fr as N,ia as P,ir as F,lr as I,on as L,or as R,rr as re,sr as ie,ur as ae,vr as z,yr as oe}from"./index-CmaRQR9x.js";import{t as se}from"./use-active-assistant-id-9rGx8kT9.js";import{t as B}from"./detail-card-CA8lPa5K.js";var V=e(i(),1),H=d();function U({label:e,description:t,checked:n,disabled:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),t&&(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,H.jsx)(y,{checked:n,disabled:r,onChange:i,label:e})]})}function W(){return(0,H.jsx)(`div`,{className:`border-t border-[var(--border-base)]`})}function G({event:e,eventConfig:t,availableSounds:n,globalEnabled:r,onToggle:i,onAddSound:a,onRemoveSound:o,onPreview:s}){let[c,l]=(0,V.useState)(!1),u=n.filter(e=>!t.sounds.includes(e.filename)),d=n.length>0&&u.length===0;return(0,H.jsxs)(`div`,{className:`py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:D[e]}),(0,H.jsx)(y,{checked:t.enabled,disabled:!r,onChange:i,label:`Enable ${D[e]}`})]}),t.enabled&&(0,H.jsxs)(`div`,{className:`mt-2 space-y-1 pl-2`,children:[t.sounds.length===0?(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default Blip`}):t.sounds.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-small-default text-[var(--content-secondary)]`,title:e,children:E(e)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Preview ${e}`,children:(0,H.jsx)(P,{className:`h-3 w-3`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Remove ${e}`,children:(0,H.jsx)(O,{className:`h-3 w-3`})})]})]},e)),n.length===0?(0,H.jsx)(`p`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`No sound files yet. Drop audio files into data/sounds/ in your workspace.`}):d?(0,H.jsx)(`button`,{type:`button`,disabled:!0,className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-disabled)] disabled:cursor-not-allowed dark:bg-[var(--surface-lift)] dark:text-[var(--content-tertiary)]`,children:`All sounds added`}):(0,H.jsxs)(`div`,{className:`relative inline-block`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[`Add sound`,(0,H.jsx)(m,{className:`h-3 w-3`})]}),c&&(0,H.jsx)(`div`,{className:`absolute left-0 z-10 mt-1 max-h-64 w-56 overflow-auto rounded-md border border-[var(--border-base)] bg-white p-1 shadow-lg dark:bg-[var(--surface-lift)]`,onMouseLeave:()=>l(!1),children:u.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>{a(e.filename),l(!1)},className:`block w-full truncate rounded px-2 py-1 text-left text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:hover:bg-[var(--ghost-hover)]`,title:e.filename,children:e.label},e.filename))})]})]})]})}function ce(){let e=c(),t=se(),n=(0,V.useMemo)(()=>x({path:{assistant_id:t}}),[t]),r=(0,V.useMemo)(()=>w({path:{assistant_id:t}}),[t]),{data:i}=l(n),{data:a}=l(r),o=i??A(),s=a?.sounds??[],d=(0,V.useMemo)(()=>({path:{assistant_id:t}}),[t]),p=u({...C(d),onMutate:async t=>{await e.cancelQueries({queryKey:n.queryKey});let r=e.getQueryData(n.queryKey);return S(e,d,t.body),{previous:r}},onError:(t,n,r)=>{r?.previous!==void 0&&S(e,d,r.previous)},onSettled:()=>{e.invalidateQueries({queryKey:n.queryKey})}}),m=(0,V.useCallback)(r=>{let i=r(e.getQueryData(n.queryKey)??A());p.mutate({path:{assistant_id:t},body:i})},[t,n.queryKey,e,p]),h=e=>{m(t=>({...t,globalEnabled:e}))},g=e=>{m(t=>({...t,volume:e}))},[_,v]=(0,V.useState)(null),y=_??o.volume,b=(e,t)=>{m(n=>({...n,events:{...n.events,[e]:{...n.events[e]??{enabled:!1,sounds:[]},enabled:t}}}))},T=(e,t)=>{m(n=>{let r=n.events[e]??{enabled:!0,sounds:[]};return r.sounds.includes(t)?n:{...n,events:{...n.events,[e]:{...r,sounds:[...r.sounds,t]}}}})},E=(e,t)=>{m(n=>{let r=n.events[e];return r?{...n,events:{...n.events,[e]:{...r,sounds:r.sounds.filter(e=>e!==t)}}}:n})},D=()=>{k().previewFallbackBlip(o.volume)},O=e=>{k().previewSound(e,o.volume)};return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(f,{children:[(0,H.jsx)(U,{label:`Enable sound effects`,description:`Master switch for every event-driven sound.`,checked:o.globalEnabled,onChange:h}),(0,H.jsx)(W,{}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Volume`}),(0,H.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:y,onChange:e=>v(parseFloat(e.target.value)),onPointerUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onKeyUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onBlur:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},className:`h-1 w-48 cursor-pointer`,disabled:!o.globalEnabled,"aria-label":`Sound effect volume`}),(0,H.jsxs)(`span`,{className:`tabular-nums text-body-small-default text-[var(--content-tertiary)]`,children:[Math.round(y*100),`%`]})]}),(0,H.jsx)(W,{}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Preview default blip`}),(0,H.jsxs)(`button`,{type:`button`,onClick:D,disabled:!o.globalEnabled,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-white px-3 py-1.5 text-body-medium-lighter text-[var(--content-default)] hover:bg-[var(--surface-base)] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[(0,H.jsx)(P,{className:`h-3.5 w-3.5`}),`Preview`]})]})]}),(0,H.jsxs)(f,{children:[(0,H.jsxs)(`div`,{className:`pb-2`,children:[(0,H.jsx)(`h3`,{className:`text-title-small text-[var(--content-default)]`,children:`Sound Events`}),(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add one or more sounds per event. When multiple are configured, one plays at random.`})]}),(0,H.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:ee.map(e=>(0,H.jsx)(G,{event:e,eventConfig:o.events[e]??{enabled:!1,sounds:[]},availableSounds:s,globalEnabled:o.globalEnabled,onToggle:t=>b(e,t),onAddSound:t=>T(e,t),onRemoveSound:t=>E(e,t),onPreview:e=>O(e)},e))})]})]})}var le=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],ue=`We recommend keeping both off to start. It feels more like a real conversation.`;function de(){return(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Recommended off`})}function fe({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,H.jsx)(de,{}):null]}),t?(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,H.jsx)(y,{checked:r,onChange:i,"aria-label":e})]})}function pe({showDescription:e=!1,showRecommendedBadge:t=!1}){let n=L.use.showUserTranscript(),r=L.use.showAssistantTranscript(),i=L.use.setShowUserTranscript(),a=L.use.setShowAssistantTranscript(),o={showUserTranscript:{checked:n,onChange:i},showAssistantTranscript:{checked:r,onChange:a}};return(0,H.jsx)(H.Fragment,{children:le.map(n=>{let r=o[n.prefKey];return(0,H.jsx)(fe,{label:n.label,description:e?n.description:void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var K=`vellum:voice:conversationTimeoutSeconds`,q=[{label:`Ctrl`,activator:{kind:`modifierOnly`,modifiers:[`control`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}},{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}}],J={label:`Fn`,activator:j},Y=[{label:`5 seconds`,value:`5`},{label:`10 seconds`,value:`10`},{label:`15 seconds`,value:`15`},{label:`30 seconds`,value:`30`},{label:`60 seconds`,value:`60`}],X=`30`,Z=`text-body-small-default text-[var(--content-tertiary)]`;function me(){let[e,t]=o(),n=e.get(`tab`)===`sounds`?`sounds`:`voice`;return(0,H.jsx)(`div`,{className:`space-y-6`,children:(0,H.jsxs)(h.Root,{value:n,onValueChange:n=>{let r=new URLSearchParams(e);n===`sounds`?r.set(`tab`,`sounds`):r.delete(`tab`),t(r,{replace:!0})},children:[(0,H.jsxs)(h.List,{children:[(0,H.jsx)(h.Trigger,{value:`voice`,children:`Voice`}),(0,H.jsx)(h.Trigger,{value:`sounds`,children:`Sounds`})]}),(0,H.jsx)(h.Panel,{value:`voice`,className:`pt-4`,children:(0,H.jsx)(he,{})}),(0,H.jsx)(h.Panel,{value:`sounds`,className:`pt-4`,children:(0,H.jsx)(ce,{})})]})})}function he(){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,H.jsx)(_e,{}),(0,H.jsx)(ve,{}),(0,H.jsx)(ye,{}),(0,H.jsx)(be,{}),(0,H.jsx)(Se,{}),(0,H.jsx)(Ce,{}),(0,H.jsx)(ge,{})]})}function ge(){return(0,H.jsx)(B,{title:`Transcription`,subtitle:`Show live text of what you and the assistant say during a voice conversation.`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(pe,{showDescription:!0}),(0,H.jsx)(`p`,{className:`${Z} pt-1`,children:ue})]})})}function _e(){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--field-bg)] px-3 py-2`,children:[(0,H.jsx)(g,{className:`h-3.5 w-3.5 shrink-0 text-[var(--primary-base)]`}),(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Looking to configure Speech-to-Text or Text-to-Speech models?`}),(0,H.jsxs)(s,{to:T.settings.ai,className:`inline-flex items-center gap-1 text-body-medium-lighter text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Go to Models & Services`,(0,H.jsx)(p,{className:`h-3 w-3`})]})]})}var Q=``;function ve(){let[e,r]=(0,V.useState)([]),[i,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(()=>oe()),l=(0,V.useCallback)(async()=>{if(navigator.mediaDevices?.enumerateDevices)try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`);o(e.length>0&&e.every(e=>!e.label)),r(e.filter(e=>e.deviceId!==``&&e.deviceId!==`default`&&e.deviceId!==`communications`))}catch{r([]),o(!1)}},[]),u=(0,V.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}l()},[l]);(0,V.useEffect)(()=>{l();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void l();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[l]);let d=(0,V.useMemo)(()=>[{value:Q,label:`System Default`},...e.map((e,t)=>({value:e.deviceId,label:e.label||`Microphone ${t+1}`}))],[e]),f=(0,V.useCallback)(e=>{c(e),e===Q?t(z):n(z,e)},[]);return(0,H.jsx)(B,{title:`Microphone`,subtitle:`Which input device is used for dictation and voice conversations.`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(b,{options:d,value:d.some(e=>e.value===s)?s:Q,onChange:f,"aria-label":`Microphone`})}),i&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(a,{variant:`outlined`,onClick:u,children:`Allow Microphone Access`}),(0,H.jsx)(`span`,{className:Z,children:`Grant microphone access to list your available input devices.`})]})]})})}function ye(){let e=re(),[t,i]=(0,V.useState)(()=>{let t=r(R,``);return t?ae(t,{preserveFunction:e}):e?J.activator:{kind:`off`}}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)([]),l=(0,V.useRef)(null),u=(0,V.useRef)(!1),d=(0,V.useMemo)(()=>e?[J,...q]:q,[e]),f=t.kind!==`off`,p=f&&!e,m=(0,V.useCallback)(e=>{i(e),n(R,ne(e)),o(!1),c([])},[]),h=(0,V.useCallback)(()=>{o(!0),c([]),u.current=!1,requestAnimationFrame(()=>{l.current?.focus()})},[]),_=(0,V.useCallback)(()=>{o(!1),c([]),u.current=!1},[]),v=(0,V.useCallback)(t=>{let n=[];return e&&t.getModifierState(`Fn`)&&n.push(`function`),t.ctrlKey&&n.push(`control`),t.altKey&&n.push(`option`),t.shiftKey&&n.push(`shift`),t.metaKey&&n.push(`command`),n},[e]),b=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){_();return}let t=v(e),n=e.key;if(n===`Control`||n===`Alt`||n===`Shift`||n===`Meta`||n===`Fn`){c(t.includes(`function`)?j.modifiers:N(t));return}if(t.includes(`function`)){m(j);return}u.current=!0,m({kind:`key`,label:n.length===1?n.toUpperCase():n,modifiers:t})},[_,v,m]),x=(0,V.useCallback)(e=>{if(!a)return;e.preventDefault(),e.stopPropagation();let t=e.key;if(t===`Control`||t===`Alt`||t===`Shift`||t===`Meta`||t===`Fn`){if(u.current){u.current=!1,c([]);return}v(e).length===0&&s.length>0&&m({kind:`modifierOnly`,modifiers:s})}},[v,a,s,m]);(0,V.useEffect)(()=>{if(!a)return;let e=e=>{l.current&&!l.current.contains(e.target)&&_()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[_,a]);let S=f&&!d.some(e=>M(e.activator,t));return(0,H.jsx)(B,{title:`Push to Talk`,subtitle:`Hold the activation key to dictate text or start a voice conversation.`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(y,{checked:f,onChange:n=>{n?t.kind===`off`&&m(e?J.activator:F):m({kind:`off`})},label:`Enable Push to Talk`}),f&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:Z,children:`Activation Key:`}),(0,H.jsxs)(`div`,{ref:l,tabIndex:a?0:-1,onKeyDown:a?b:void 0,onKeyUp:a?x:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[d.map(e=>{let n=M(e.activator,t);return(0,H.jsx)($,{label:e.label,selected:n,onClick:()=>m(e.activator)},e.label)}),a?(0,H.jsx)($,{label:s.length>0?I(s):`Press any key…`,selected:!0,recording:!0,onClick:_}):(0,H.jsx)($,{label:S?ie(t):`Custom`,selected:S,onClick:h})]}),p&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--content-quiet)]`,children:[(0,H.jsx)(g,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:`Push-to-Talk only works while this tab is focused, and browsers may intercept some shortcuts (e.g. Ctrl+T) before the page can see them. For always-on PTT, use the Vellum desktop app.`})]})]})]})})}function $({label:e,selected:t,recording:n=!1,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,H.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,H.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function be(){let[e,t]=(0,V.useState)(()=>{let e=r(K,X);return Y.find(t=>t.value===e)?.value??X});return(0,H.jsx)(B,{title:`Conversation Timeout`,subtitle:`How long the assistant waits for you to start speaking before ending a voice conversation turn.`,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(b,{options:Y,value:e,onChange:(0,V.useCallback)(e=>{t(e),n(K,e)},[]),"aria-label":`Conversation timeout`})})})}var xe=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}];function Se(){let e=L.use.pauseBeforeReplyMs(),t=L.use.setPauseBeforeReplyMs();return(0,H.jsx)(B,{title:`Pause before reply`,subtitle:`How long the assistant waits after you stop speaking before it replies. A longer pause lets you gather your thoughts mid-sentence without being cut off.`,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(v,{value:(e??1200)/1e3,onValueChange:e=>{typeof e==`number`&&t(Math.round(e*1e3))},min:500/1e3,max:te/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":`Pause before reply`})})})}function Ce(){let e=L.use.interruptSensitivity(),t=L.use.setInterruptSensitivity();return(0,H.jsx)(B,{title:`Interrupt sensitivity`,subtitle:`How easily talking over the assistant interrupts it. Lower it if the assistant cuts itself off on background noise or filler words; raise it to interrupt more quickly.`,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(_,{items:xe,value:e??`medium`,onChange:t,ariaLabel:`Interrupt sensitivity`})})})}export{me as VoicePage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,c as n,i as r}from"./local-settings-C-dW2vkq.js";import{t as i}from"./react-DJZBPgpf.js";import{t as a}from"./button-BQVYX8n_.js";import{m as o,t as s}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as c}from"./QueryClientProvider-DKhXIxGb.js";import{t as l}from"./useQuery-B45lW1Kk.js";import{t as u}from"./useMutation-Lj4VunQV.js";import{t as d}from"./jsx-runtime-CVSDxk6A.js";import{t as f}from"./card-D8zyWtZh.js";import{r as p}from"./middleware-DL-IveDQ.js";import{t as m}from"./chevron-down-DpYf9Gwq.js";import{n as h}from"./list-row-9xgQystQ.js";import{t as g}from"./info-DPHR_AMJ.js";import{j as _,k as v}from"./src-CDdn26Yb.js";import{t as y}from"./toggle-QSEiPr3k.js";import{t as b}from"./dropdown-BMNSccmo.js";import{At as x,Mt as S,Nt as C,Ot as w}from"./react-query.gen-BQH0QRfT.js";import{c as T}from"./routes-XPLb07Av.js";import{Gr as E,Hr as D,Ui as O,Ur as ee,Vr as k,Wr as A,an as te,ar as j,cr as M,dr as ne,fr as N,ia as P,ir as F,lr as I,on as L,or as R,rr as re,sr as ie,ur as ae,vr as z,yr as oe}from"./index-CgcZXB4g.js";import{t as se}from"./use-active-assistant-id-9rGx8kT9.js";import{t as B}from"./detail-card-CA8lPa5K.js";var V=e(i(),1),H=d();function U({label:e,description:t,checked:n,disabled:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),t&&(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,H.jsx)(y,{checked:n,disabled:r,onChange:i,label:e})]})}function W(){return(0,H.jsx)(`div`,{className:`border-t border-[var(--border-base)]`})}function G({event:e,eventConfig:t,availableSounds:n,globalEnabled:r,onToggle:i,onAddSound:a,onRemoveSound:o,onPreview:s}){let[c,l]=(0,V.useState)(!1),u=n.filter(e=>!t.sounds.includes(e.filename)),d=n.length>0&&u.length===0;return(0,H.jsxs)(`div`,{className:`py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:D[e]}),(0,H.jsx)(y,{checked:t.enabled,disabled:!r,onChange:i,label:`Enable ${D[e]}`})]}),t.enabled&&(0,H.jsxs)(`div`,{className:`mt-2 space-y-1 pl-2`,children:[t.sounds.length===0?(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default Blip`}):t.sounds.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-small-default text-[var(--content-secondary)]`,title:e,children:E(e)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Preview ${e}`,children:(0,H.jsx)(P,{className:`h-3 w-3`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-body-small-default text-[var(--content-tertiary)] hover:bg-[var(--surface-base)] dark:text-[var(--content-disabled)] dark:hover:bg-[var(--ghost-hover)]`,"aria-label":`Remove ${e}`,children:(0,H.jsx)(O,{className:`h-3 w-3`})})]})]},e)),n.length===0?(0,H.jsx)(`p`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`No sound files yet. Drop audio files into data/sounds/ in your workspace.`}):d?(0,H.jsx)(`button`,{type:`button`,disabled:!0,className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-disabled)] disabled:cursor-not-allowed dark:bg-[var(--surface-lift)] dark:text-[var(--content-tertiary)]`,children:`All sounds added`}):(0,H.jsxs)(`div`,{className:`relative inline-block`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`inline-flex items-center gap-1 rounded-md border border-[var(--border-base)] bg-white px-2 py-1 text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[`Add sound`,(0,H.jsx)(m,{className:`h-3 w-3`})]}),c&&(0,H.jsx)(`div`,{className:`absolute left-0 z-10 mt-1 max-h-64 w-56 overflow-auto rounded-md border border-[var(--border-base)] bg-white p-1 shadow-lg dark:bg-[var(--surface-lift)]`,onMouseLeave:()=>l(!1),children:u.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>{a(e.filename),l(!1)},className:`block w-full truncate rounded px-2 py-1 text-left text-body-small-default text-[var(--content-default)] hover:bg-[var(--surface-base)] dark:hover:bg-[var(--ghost-hover)]`,title:e.filename,children:e.label},e.filename))})]})]})]})}function ce(){let e=c(),t=se(),n=(0,V.useMemo)(()=>x({path:{assistant_id:t}}),[t]),r=(0,V.useMemo)(()=>w({path:{assistant_id:t}}),[t]),{data:i}=l(n),{data:a}=l(r),o=i??A(),s=a?.sounds??[],d=(0,V.useMemo)(()=>({path:{assistant_id:t}}),[t]),p=u({...C(d),onMutate:async t=>{await e.cancelQueries({queryKey:n.queryKey});let r=e.getQueryData(n.queryKey);return S(e,d,t.body),{previous:r}},onError:(t,n,r)=>{r?.previous!==void 0&&S(e,d,r.previous)},onSettled:()=>{e.invalidateQueries({queryKey:n.queryKey})}}),m=(0,V.useCallback)(r=>{let i=r(e.getQueryData(n.queryKey)??A());p.mutate({path:{assistant_id:t},body:i})},[t,n.queryKey,e,p]),h=e=>{m(t=>({...t,globalEnabled:e}))},g=e=>{m(t=>({...t,volume:e}))},[_,v]=(0,V.useState)(null),y=_??o.volume,b=(e,t)=>{m(n=>({...n,events:{...n.events,[e]:{...n.events[e]??{enabled:!1,sounds:[]},enabled:t}}}))},T=(e,t)=>{m(n=>{let r=n.events[e]??{enabled:!0,sounds:[]};return r.sounds.includes(t)?n:{...n,events:{...n.events,[e]:{...r,sounds:[...r.sounds,t]}}}})},E=(e,t)=>{m(n=>{let r=n.events[e];return r?{...n,events:{...n.events,[e]:{...r,sounds:r.sounds.filter(e=>e!==t)}}}:n})},D=()=>{k().previewFallbackBlip(o.volume)},O=e=>{k().previewSound(e,o.volume)};return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(f,{children:[(0,H.jsx)(U,{label:`Enable sound effects`,description:`Master switch for every event-driven sound.`,checked:o.globalEnabled,onChange:h}),(0,H.jsx)(W,{}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Volume`}),(0,H.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:y,onChange:e=>v(parseFloat(e.target.value)),onPointerUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onKeyUp:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},onBlur:e=>{let t=parseFloat(e.currentTarget.value);v(null),t!==o.volume&&g(t)},className:`h-1 w-48 cursor-pointer`,disabled:!o.globalEnabled,"aria-label":`Sound effect volume`}),(0,H.jsxs)(`span`,{className:`tabular-nums text-body-small-default text-[var(--content-tertiary)]`,children:[Math.round(y*100),`%`]})]}),(0,H.jsx)(W,{}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Preview default blip`}),(0,H.jsxs)(`button`,{type:`button`,onClick:D,disabled:!o.globalEnabled,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-white px-3 py-1.5 text-body-medium-lighter text-[var(--content-default)] hover:bg-[var(--surface-base)] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:[(0,H.jsx)(P,{className:`h-3.5 w-3.5`}),`Preview`]})]})]}),(0,H.jsxs)(f,{children:[(0,H.jsxs)(`div`,{className:`pb-2`,children:[(0,H.jsx)(`h3`,{className:`text-title-small text-[var(--content-default)]`,children:`Sound Events`}),(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add one or more sounds per event. When multiple are configured, one plays at random.`})]}),(0,H.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:ee.map(e=>(0,H.jsx)(G,{event:e,eventConfig:o.events[e]??{enabled:!1,sounds:[]},availableSounds:s,globalEnabled:o.globalEnabled,onToggle:t=>b(e,t),onAddSound:t=>T(e,t),onRemoveSound:t=>E(e,t),onPreview:e=>O(e)},e))})]})]})}var le=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],ue=`We recommend keeping both off to start. It feels more like a real conversation.`;function de(){return(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Recommended off`})}function fe({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,H.jsx)(de,{}):null]}),t?(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,H.jsx)(y,{checked:r,onChange:i,"aria-label":e})]})}function pe({showDescription:e=!1,showRecommendedBadge:t=!1}){let n=L.use.showUserTranscript(),r=L.use.showAssistantTranscript(),i=L.use.setShowUserTranscript(),a=L.use.setShowAssistantTranscript(),o={showUserTranscript:{checked:n,onChange:i},showAssistantTranscript:{checked:r,onChange:a}};return(0,H.jsx)(H.Fragment,{children:le.map(n=>{let r=o[n.prefKey];return(0,H.jsx)(fe,{label:n.label,description:e?n.description:void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var K=`vellum:voice:conversationTimeoutSeconds`,q=[{label:`Ctrl`,activator:{kind:`modifierOnly`,modifiers:[`control`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}},{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}}],J={label:`Fn`,activator:j},Y=[{label:`5 seconds`,value:`5`},{label:`10 seconds`,value:`10`},{label:`15 seconds`,value:`15`},{label:`30 seconds`,value:`30`},{label:`60 seconds`,value:`60`}],X=`30`,Z=`text-body-small-default text-[var(--content-tertiary)]`;function me(){let[e,t]=o(),n=e.get(`tab`)===`sounds`?`sounds`:`voice`;return(0,H.jsx)(`div`,{className:`space-y-6`,children:(0,H.jsxs)(h.Root,{value:n,onValueChange:n=>{let r=new URLSearchParams(e);n===`sounds`?r.set(`tab`,`sounds`):r.delete(`tab`),t(r,{replace:!0})},children:[(0,H.jsxs)(h.List,{children:[(0,H.jsx)(h.Trigger,{value:`voice`,children:`Voice`}),(0,H.jsx)(h.Trigger,{value:`sounds`,children:`Sounds`})]}),(0,H.jsx)(h.Panel,{value:`voice`,className:`pt-4`,children:(0,H.jsx)(he,{})}),(0,H.jsx)(h.Panel,{value:`sounds`,className:`pt-4`,children:(0,H.jsx)(ce,{})})]})})}function he(){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,H.jsx)(_e,{}),(0,H.jsx)(ve,{}),(0,H.jsx)(ye,{}),(0,H.jsx)(be,{}),(0,H.jsx)(Se,{}),(0,H.jsx)(Ce,{}),(0,H.jsx)(ge,{})]})}function ge(){return(0,H.jsx)(B,{title:`Transcription`,subtitle:`Show live text of what you and the assistant say during a voice conversation.`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(pe,{showDescription:!0}),(0,H.jsx)(`p`,{className:`${Z} pt-1`,children:ue})]})})}function _e(){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--field-bg)] px-3 py-2`,children:[(0,H.jsx)(g,{className:`h-3.5 w-3.5 shrink-0 text-[var(--primary-base)]`}),(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Looking to configure Speech-to-Text or Text-to-Speech models?`}),(0,H.jsxs)(s,{to:T.settings.ai,className:`inline-flex items-center gap-1 text-body-medium-lighter text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Go to Models & Services`,(0,H.jsx)(p,{className:`h-3 w-3`})]})]})}var Q=``;function ve(){let[e,r]=(0,V.useState)([]),[i,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(()=>oe()),l=(0,V.useCallback)(async()=>{if(navigator.mediaDevices?.enumerateDevices)try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`);o(e.length>0&&e.every(e=>!e.label)),r(e.filter(e=>e.deviceId!==``&&e.deviceId!==`default`&&e.deviceId!==`communications`))}catch{r([]),o(!1)}},[]),u=(0,V.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}l()},[l]);(0,V.useEffect)(()=>{l();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void l();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[l]);let d=(0,V.useMemo)(()=>[{value:Q,label:`System Default`},...e.map((e,t)=>({value:e.deviceId,label:e.label||`Microphone ${t+1}`}))],[e]),f=(0,V.useCallback)(e=>{c(e),e===Q?t(z):n(z,e)},[]);return(0,H.jsx)(B,{title:`Microphone`,subtitle:`Which input device is used for dictation and voice conversations.`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(b,{options:d,value:d.some(e=>e.value===s)?s:Q,onChange:f,"aria-label":`Microphone`})}),i&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(a,{variant:`outlined`,onClick:u,children:`Allow Microphone Access`}),(0,H.jsx)(`span`,{className:Z,children:`Grant microphone access to list your available input devices.`})]})]})})}function ye(){let e=re(),[t,i]=(0,V.useState)(()=>{let t=r(R,``);return t?ae(t,{preserveFunction:e}):e?J.activator:{kind:`off`}}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)([]),l=(0,V.useRef)(null),u=(0,V.useRef)(!1),d=(0,V.useMemo)(()=>e?[J,...q]:q,[e]),f=t.kind!==`off`,p=f&&!e,m=(0,V.useCallback)(e=>{i(e),n(R,ne(e)),o(!1),c([])},[]),h=(0,V.useCallback)(()=>{o(!0),c([]),u.current=!1,requestAnimationFrame(()=>{l.current?.focus()})},[]),_=(0,V.useCallback)(()=>{o(!1),c([]),u.current=!1},[]),v=(0,V.useCallback)(t=>{let n=[];return e&&t.getModifierState(`Fn`)&&n.push(`function`),t.ctrlKey&&n.push(`control`),t.altKey&&n.push(`option`),t.shiftKey&&n.push(`shift`),t.metaKey&&n.push(`command`),n},[e]),b=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){_();return}let t=v(e),n=e.key;if(n===`Control`||n===`Alt`||n===`Shift`||n===`Meta`||n===`Fn`){c(t.includes(`function`)?j.modifiers:N(t));return}if(t.includes(`function`)){m(j);return}u.current=!0,m({kind:`key`,label:n.length===1?n.toUpperCase():n,modifiers:t})},[_,v,m]),x=(0,V.useCallback)(e=>{if(!a)return;e.preventDefault(),e.stopPropagation();let t=e.key;if(t===`Control`||t===`Alt`||t===`Shift`||t===`Meta`||t===`Fn`){if(u.current){u.current=!1,c([]);return}v(e).length===0&&s.length>0&&m({kind:`modifierOnly`,modifiers:s})}},[v,a,s,m]);(0,V.useEffect)(()=>{if(!a)return;let e=e=>{l.current&&!l.current.contains(e.target)&&_()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[_,a]);let S=f&&!d.some(e=>M(e.activator,t));return(0,H.jsx)(B,{title:`Push to Talk`,subtitle:`Hold the activation key to dictate text or start a voice conversation.`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(y,{checked:f,onChange:n=>{n?t.kind===`off`&&m(e?J.activator:F):m({kind:`off`})},label:`Enable Push to Talk`}),f&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:Z,children:`Activation Key:`}),(0,H.jsxs)(`div`,{ref:l,tabIndex:a?0:-1,onKeyDown:a?b:void 0,onKeyUp:a?x:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[d.map(e=>{let n=M(e.activator,t);return(0,H.jsx)($,{label:e.label,selected:n,onClick:()=>m(e.activator)},e.label)}),a?(0,H.jsx)($,{label:s.length>0?I(s):`Press any key…`,selected:!0,recording:!0,onClick:_}):(0,H.jsx)($,{label:S?ie(t):`Custom`,selected:S,onClick:h})]}),p&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--content-quiet)]`,children:[(0,H.jsx)(g,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:`Push-to-Talk only works while this tab is focused, and browsers may intercept some shortcuts (e.g. Ctrl+T) before the page can see them. For always-on PTT, use the Vellum desktop app.`})]})]})]})})}function $({label:e,selected:t,recording:n=!1,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,H.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,H.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function be(){let[e,t]=(0,V.useState)(()=>{let e=r(K,X);return Y.find(t=>t.value===e)?.value??X});return(0,H.jsx)(B,{title:`Conversation Timeout`,subtitle:`How long the assistant waits for you to start speaking before ending a voice conversation turn.`,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(b,{options:Y,value:e,onChange:(0,V.useCallback)(e=>{t(e),n(K,e)},[]),"aria-label":`Conversation timeout`})})})}var xe=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}];function Se(){let e=L.use.pauseBeforeReplyMs(),t=L.use.setPauseBeforeReplyMs();return(0,H.jsx)(B,{title:`Pause before reply`,subtitle:`How long the assistant waits after you stop speaking before it replies. A longer pause lets you gather your thoughts mid-sentence without being cut off.`,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(v,{value:(e??1200)/1e3,onValueChange:e=>{typeof e==`number`&&t(Math.round(e*1e3))},min:500/1e3,max:te/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":`Pause before reply`})})})}function Ce(){let e=L.use.interruptSensitivity(),t=L.use.setInterruptSensitivity();return(0,H.jsx)(B,{title:`Interrupt sensitivity`,subtitle:`How easily talking over the assistant interrupts it. Lower it if the assistant cuts itself off on background noise or filler words; raise it to interrupt more quickly.`,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(_,{items:xe,value:e??`medium`,onChange:t,ariaLabel:`Interrupt sensitivity`})})})}export{me as VoicePage};
|
package/dist/assets/{weather-forecast-display-Cd2sZBmz.js → weather-forecast-display-Dcw7Ta6D.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./moon-Ci1LuSVx.js";import{t as i}from"./misc-Dz1odwkI.js";import{Fa as a,Gi as o,Ia as s,Ji as c,La as l,Na as u,Pa as d,Ra as f,Ri as p,at as m,ct as h,ja as g,ot as _,st as v}from"./index-CmaRQR9x.js";var y=e(t(),1),b={"sun.max.fill":{icon:o,className:`text-orange-500`},"cloud.sun.fill":{icon:d,className:`text-amber-400`},"moon.fill":{icon:r,className:`text-blue-400`},"cloud.moon.fill":{icon:s,className:`text-blue-400`},"cloud.fill":{icon:u,className:`text-stone-400`},"cloud.rain.fill":{icon:a,className:`text-blue-400`},snowflake:{icon:c,className:`text-blue-300`},"cloud.bolt.fill":{icon:l,className:`text-orange-500`},"cloud.fog.fill":{icon:f,className:`text-stone-400`}},x={sunny:{icon:o,className:`text-orange-500`},clear:{icon:o,className:`text-orange-500`},"partly cloudy":{icon:d,className:`text-amber-400`},"mostly sunny":{icon:d,className:`text-amber-400`},cloudy:{icon:u,className:`text-stone-400`},overcast:{icon:u,className:`text-stone-400`},rainy:{icon:a,className:`text-blue-400`},rain:{icon:a,className:`text-blue-400`},drizzle:{icon:a,className:`text-blue-400`},snow:{icon:c,className:`text-blue-300`},snowy:{icon:c,className:`text-blue-300`},thunderstorm:{icon:l,className:`text-orange-500`},thunder:{icon:l,className:`text-orange-500`},foggy:{icon:f,className:`text-stone-400`},fog:{icon:f,className:`text-stone-400`},mist:{icon:f,className:`text-stone-400`},hazy:{icon:f,className:`text-stone-400`},night:{icon:r,className:`text-blue-400`},"mainly clear":{icon:o,className:`text-orange-500`},"mostly cloudy":{icon:u,className:`text-stone-400`},breezy:{icon:p,className:`text-stone-400`},windy:{icon:p,className:`text-stone-400`},cool:{icon:u,className:`text-stone-400`},warm:{icon:o,className:`text-orange-500`},hot:{icon:o,className:`text-orange-500`},cold:{icon:c,className:`text-blue-300`},"cold snap":{icon:c,className:`text-blue-300`},"warm, mostly sunny":{icon:d,className:`text-amber-400`},"cooler, breezy":{icon:p,className:`text-stone-400`}},S={icon:u,className:`text-stone-400`};function C(e){let t=b[e];if(t)return t;let n=e.toLowerCase(),r=x[n];if(r)return r;for(let[e,t]of Object.entries(x))if(n.includes(e))return t;return S}function w(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function T(e){let t;if(typeof e.location==`string`)t=e.location;else{let n=v(e.location);n&&typeof n.name==`string`&&(t=n.name)}if(!t)return null;let n=v(e.current),r=_(n?.temp)??_(e.currentTemp)??_(e.temperature)??_(e.temp),i=_(n?.feelsLike)??_(n?.feels_like)??_(n?.apparentTemperature)??_(e.feelsLike)??_(e.feels_like)??_(e.apparentTemperature),a=h(n?.condition)??h(e.condition),o=_(n?.humidity)??_(e.humidity),s=w(n?.wind??e.wind),c=_(n?.windSpeed)??_(n?.wind_speed)??_(e.windSpeed)??_(e.wind_speed)??s.speed,l=h(n?.windDirection)??h(n?.wind_direction)??h(e.windDirection)??h(e.wind_direction)??s.direction,u=v(e.units),d=h(u?.temperature)??h(n?.unit)??h(e.unit)??`F`,f=h(u?.speed)??h(e.windUnit)??h(e.wind_unit),p=m(e.hourly).map((e,t)=>({id:h(e.id)??String(t),time:h(e.time)??``,icon:h(e.icon)??h(e.condition)??`cloud.fill`,temp:_(e.tempC)??_(e.temp)??_(e.temperature),tempC:_(e.tempC)})),g=m([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:h(e.id)??String(t),day:h(e.day)??h(e.date),dayLabel:h(e.dayLabel)??h(e.date),icon:h(e.icon)??h(e.condition)??`cloud.fill`,low:_(e.low),high:_(e.high),lowC:_(e.lowC),highC:_(e.highC),precip:_(e.precip)??_(e.precipitation)??_(e.precipitationProbability),condition:h(e.condition)}));return{location:t,currentTemp:r,feelsLike:i,condition:a,humidity:o,windSpeed:c,windDirection:l,windUnit:f,unit:d,hourly:p.length>0?p:void 0,forecast:g.length>0?g:void 0}}function E(e){return e*9/5+32}function D(e){return(e-32)*5/9}function O(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=D(e)),!t&&n&&(r=E(e)),`${Math.round(r)}`}function k(e,t,n){return e.tempC===void 0?e.temp===void 0?null:O(e.temp,t,n):O(e.tempC,!1,n)}function A(e,t,n){return e.lowC===void 0?O(e.low,t,n):O(e.lowC,!1,n)}function j(e,t,n){return e.highC===void 0?O(e.high,t,n):O(e.highC,!1,n)}var M=n();function N({icon:e,size:t=20}){let{icon:n,className:r}=C(e);return(0,M.jsx)(n,{width:t,height:t,className:r})}function P({useFahrenheit:e,onToggle:t}){return(0,M.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:`°F`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:`°C`})]})}function F({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let i=e.location,a=O(e.currentTemp,t,n),o=O(e.feelsLike,t,n),s=n?`F`:`C`,c=e.forecast?.[0],l=c?j(c,t,n):null,u=c?A(c,t,n):null,d=null;return e.windSpeed!==void 0&&(d=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(d=`${e.windDirection} ${d}`)),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i}),a!==null&&(0,M.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[a,`°`,s]}),e.condition&&(0,M.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,M.jsx)(P,{useFahrenheit:n,onToggle:r})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[o!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`Feels like `,o,`°`]}),l!==null&&u!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`H:`,l,`° L:`,u,`°`]}),d&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(p,{width:12,height:12}),d]}),e.humidity!==void 0&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(g,{width:12,height:12}),e.humidity,`%`]})]})]})}function I({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,r)=>{let i=e.time.toLowerCase()===`now`,a=k(e,t,n);return(0,M.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,M.jsx)(`span`,{className:i?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:i?`Now`:e.time}),(0,M.jsx)(N,{icon:e.icon,size:18}),a!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[a,`°`]})]},e.id??r)})})})}function L({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,y.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=A(e,n,r),f=j(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,M.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,M.jsx)(N,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,M.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,M.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,M.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,M.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function R({templateData:e,fallback:t}){let n=(0,y.useMemo)(()=>T(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,y.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,M.jsxs)(`div`,{className:`mt-3`,children:[(0,M.jsx)(F,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,M.jsx)(I,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,M.jsx)(L,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{R as WeatherForecastDisplay};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./moon-Ci1LuSVx.js";import{t as i}from"./misc-Dz1odwkI.js";import{Fa as a,Gi as o,Ia as s,Ji as c,La as l,Na as u,Pa as d,Ra as f,Ri as p,at as m,ct as h,ja as g,ot as _,st as v}from"./index-CgcZXB4g.js";var y=e(t(),1),b={"sun.max.fill":{icon:o,className:`text-orange-500`},"cloud.sun.fill":{icon:d,className:`text-amber-400`},"moon.fill":{icon:r,className:`text-blue-400`},"cloud.moon.fill":{icon:s,className:`text-blue-400`},"cloud.fill":{icon:u,className:`text-stone-400`},"cloud.rain.fill":{icon:a,className:`text-blue-400`},snowflake:{icon:c,className:`text-blue-300`},"cloud.bolt.fill":{icon:l,className:`text-orange-500`},"cloud.fog.fill":{icon:f,className:`text-stone-400`}},x={sunny:{icon:o,className:`text-orange-500`},clear:{icon:o,className:`text-orange-500`},"partly cloudy":{icon:d,className:`text-amber-400`},"mostly sunny":{icon:d,className:`text-amber-400`},cloudy:{icon:u,className:`text-stone-400`},overcast:{icon:u,className:`text-stone-400`},rainy:{icon:a,className:`text-blue-400`},rain:{icon:a,className:`text-blue-400`},drizzle:{icon:a,className:`text-blue-400`},snow:{icon:c,className:`text-blue-300`},snowy:{icon:c,className:`text-blue-300`},thunderstorm:{icon:l,className:`text-orange-500`},thunder:{icon:l,className:`text-orange-500`},foggy:{icon:f,className:`text-stone-400`},fog:{icon:f,className:`text-stone-400`},mist:{icon:f,className:`text-stone-400`},hazy:{icon:f,className:`text-stone-400`},night:{icon:r,className:`text-blue-400`},"mainly clear":{icon:o,className:`text-orange-500`},"mostly cloudy":{icon:u,className:`text-stone-400`},breezy:{icon:p,className:`text-stone-400`},windy:{icon:p,className:`text-stone-400`},cool:{icon:u,className:`text-stone-400`},warm:{icon:o,className:`text-orange-500`},hot:{icon:o,className:`text-orange-500`},cold:{icon:c,className:`text-blue-300`},"cold snap":{icon:c,className:`text-blue-300`},"warm, mostly sunny":{icon:d,className:`text-amber-400`},"cooler, breezy":{icon:p,className:`text-stone-400`}},S={icon:u,className:`text-stone-400`};function C(e){let t=b[e];if(t)return t;let n=e.toLowerCase(),r=x[n];if(r)return r;for(let[e,t]of Object.entries(x))if(n.includes(e))return t;return S}function w(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function T(e){let t;if(typeof e.location==`string`)t=e.location;else{let n=v(e.location);n&&typeof n.name==`string`&&(t=n.name)}if(!t)return null;let n=v(e.current),r=_(n?.temp)??_(e.currentTemp)??_(e.temperature)??_(e.temp),i=_(n?.feelsLike)??_(n?.feels_like)??_(n?.apparentTemperature)??_(e.feelsLike)??_(e.feels_like)??_(e.apparentTemperature),a=h(n?.condition)??h(e.condition),o=_(n?.humidity)??_(e.humidity),s=w(n?.wind??e.wind),c=_(n?.windSpeed)??_(n?.wind_speed)??_(e.windSpeed)??_(e.wind_speed)??s.speed,l=h(n?.windDirection)??h(n?.wind_direction)??h(e.windDirection)??h(e.wind_direction)??s.direction,u=v(e.units),d=h(u?.temperature)??h(n?.unit)??h(e.unit)??`F`,f=h(u?.speed)??h(e.windUnit)??h(e.wind_unit),p=m(e.hourly).map((e,t)=>({id:h(e.id)??String(t),time:h(e.time)??``,icon:h(e.icon)??h(e.condition)??`cloud.fill`,temp:_(e.tempC)??_(e.temp)??_(e.temperature),tempC:_(e.tempC)})),g=m([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:h(e.id)??String(t),day:h(e.day)??h(e.date),dayLabel:h(e.dayLabel)??h(e.date),icon:h(e.icon)??h(e.condition)??`cloud.fill`,low:_(e.low),high:_(e.high),lowC:_(e.lowC),highC:_(e.highC),precip:_(e.precip)??_(e.precipitation)??_(e.precipitationProbability),condition:h(e.condition)}));return{location:t,currentTemp:r,feelsLike:i,condition:a,humidity:o,windSpeed:c,windDirection:l,windUnit:f,unit:d,hourly:p.length>0?p:void 0,forecast:g.length>0?g:void 0}}function E(e){return e*9/5+32}function D(e){return(e-32)*5/9}function O(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=D(e)),!t&&n&&(r=E(e)),`${Math.round(r)}`}function k(e,t,n){return e.tempC===void 0?e.temp===void 0?null:O(e.temp,t,n):O(e.tempC,!1,n)}function A(e,t,n){return e.lowC===void 0?O(e.low,t,n):O(e.lowC,!1,n)}function j(e,t,n){return e.highC===void 0?O(e.high,t,n):O(e.highC,!1,n)}var M=n();function N({icon:e,size:t=20}){let{icon:n,className:r}=C(e);return(0,M.jsx)(n,{width:t,height:t,className:r})}function P({useFahrenheit:e,onToggle:t}){return(0,M.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:`°F`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:`°C`})]})}function F({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let i=e.location,a=O(e.currentTemp,t,n),o=O(e.feelsLike,t,n),s=n?`F`:`C`,c=e.forecast?.[0],l=c?j(c,t,n):null,u=c?A(c,t,n):null,d=null;return e.windSpeed!==void 0&&(d=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(d=`${e.windDirection} ${d}`)),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i}),a!==null&&(0,M.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[a,`°`,s]}),e.condition&&(0,M.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,M.jsx)(P,{useFahrenheit:n,onToggle:r})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[o!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`Feels like `,o,`°`]}),l!==null&&u!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:[`H:`,l,`° L:`,u,`°`]}),d&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(p,{width:12,height:12}),d]}),e.humidity!==void 0&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,M.jsx)(g,{width:12,height:12}),e.humidity,`%`]})]})]})}function I({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,r)=>{let i=e.time.toLowerCase()===`now`,a=k(e,t,n);return(0,M.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,M.jsx)(`span`,{className:i?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:i?`Now`:e.time}),(0,M.jsx)(N,{icon:e.icon,size:18}),a!==null&&(0,M.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[a,`°`]})]},e.id??r)})})})}function L({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,y.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,M.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=A(e,n,r),f=j(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,M.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,M.jsx)(N,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,M.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,M.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,M.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,M.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,M.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function R({templateData:e,fallback:t}){let n=(0,y.useMemo)(()=>T(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,y.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,M.jsxs)(`div`,{className:`mt-3`,children:[(0,M.jsx)(F,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,M.jsx)(I,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,M.jsx)(L,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{R as WeatherForecastDisplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./button-BQVYX8n_.js";import{u as t}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{u as r}from"./local-mode-hyYI6_OH.js";import{c as i}from"./routes-XPLb07Av.js";import{t as a}from"./use-onboarding-login-D6BGXpJ1.js";import{vn as o}from"./index-
|
|
1
|
+
import{t as e}from"./button-BQVYX8n_.js";import{u as t}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{u as r}from"./local-mode-hyYI6_OH.js";import{c as i}from"./routes-XPLb07Av.js";import{t as a}from"./use-onboarding-login-D6BGXpJ1.js";import{vn as o}from"./index-CgcZXB4g.js";var s=n();function c(){let n=t(),{loading:c,error:l,login:u,cancel:d}=a();return(0,s.jsx)(o,{children:(0,s.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center px-6 pb-40 text-[var(--content-default)]`,children:(0,s.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:[(0,s.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Welcome to Vellum`}),(0,s.jsx)(`p`,{className:`mt-3 text-body-medium-lighter text-[var(--content-tertiary)]`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Your own personal intelligence is just a step away.`}),l&&(0,s.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:l}),(0,s.jsxs)(`div`,{className:`mt-10 flex w-full max-w-sm flex-col gap-3`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,s.jsx)(e,{variant:`primary`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:c?d:()=>void u(),children:c?`Cancel`:`Log In`}),(0,s.jsx)(e,{variant:`ghost`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:()=>{c&&d(),r()?n(i.selectAssistant):n(i.onboarding.hosting)},children:`Continue without account`})]})]})})})}export{c as WelcomeScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-Cqi8q9o7.js";import{t as a}from"./arrow-left-C2re-gYj.js";import{n as o,r as s,t as c}from"./metric-card-BvFbnMl1.js";import{t as l}from"./ban-Ih5bAOHZ.js";import{t as u}from"./chevron-right-jRymmL7S.js";import{t as d}from"./circle-check-DqvTjWle.js";import{t as f}from"./triangle-alert-DXEpFOj_.js";import{t as p}from"./x-CswtfvgS.js";import"./src-CDdn26Yb.js";import{n as m,r as h,t as g}from"./workflow-status-4RYJ-tdh.js";import{t as _}from"./proxy-BzlH_XAe.js";import{t as v}from"./AnimatePresence-C8APSgIu.js";import{t as y}from"./use-reduced-motion-CcGT6CHV.js";import{t as b}from"./three-dot-indicator-CwchtNVS.js";import{Bi as x,Ja as S,Li as C,gt as w,ht as T,pt as E,qi as D}from"./index-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-Cqi8q9o7.js";import{t as a}from"./arrow-left-C2re-gYj.js";import{n as o,r as s,t as c}from"./metric-card-BvFbnMl1.js";import{t as l}from"./ban-Ih5bAOHZ.js";import{t as u}from"./chevron-right-jRymmL7S.js";import{t as d}from"./circle-check-DqvTjWle.js";import{t as f}from"./triangle-alert-DXEpFOj_.js";import{t as p}from"./x-CswtfvgS.js";import"./src-CDdn26Yb.js";import{n as m,r as h,t as g}from"./workflow-status-4RYJ-tdh.js";import{t as _}from"./proxy-BzlH_XAe.js";import{t as v}from"./AnimatePresence-C8APSgIu.js";import{t as y}from"./use-reduced-motion-CcGT6CHV.js";import{t as b}from"./three-dot-indicator-CwchtNVS.js";import{Bi as x,Ja as S,Li as C,gt as w,ht as T,pt as E,qi as D}from"./index-CgcZXB4g.js";import{t as O}from"./status-badge-pill-j3ke1d9o.js";var k=e(t(),1),A=r();function j({onClick:e,ariaLabel:t}){return(0,A.jsxs)(`button`,{type:`button`,"aria-label":t,onClick:e,className:`flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border border-[var(--system-negative-strong)] bg-transparent px-2.5 py-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:[(0,A.jsx)(D,{className:`h-3 w-3`,fill:`currentColor`}),(0,A.jsx)(i,{variant:`label-small-default`,children:`Stop`})]})}function M({title:e,body:t,emptyText:n}){return(0,A.jsxs)(`div`,{className:`mb-5`,children:[(0,A.jsx)(i,{variant:`body-medium-default`,as:`h3`,className:`mb-2 text-[var(--content-emphasised)]`,children:e}),t?(0,A.jsx)(i,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:t}):(0,A.jsx)(i,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-tertiary)]`,children:n})]})}function N({leaf:e}){let t=e.status===`running`?`Running…`:`No result summary`;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`mb-5 grid grid-cols-2 gap-3`,children:[(0,A.jsx)(c,{icon:(0,A.jsx)(S,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens??0,format:e=>o(Math.round(e)),label:`Input`}),(0,A.jsx)(c,{icon:(0,A.jsx)(s,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens??0,format:e=>o(Math.round(e)),label:`Output`})]}),(0,A.jsx)(M,{title:`Prompt`,body:e.promptSummary,emptyText:`No prompt summary`}),(0,A.jsx)(M,{title:`Result`,body:e.resultSummary,emptyText:t})]})}function P({status:e}){return(0,A.jsx)(O,{color:m(e),label:h(e)})}function F(e){switch(e){case`completed`:return`var(--system-positive-strong)`;case`failed`:return`var(--system-negative-strong)`;case`cancelled`:return`var(--content-secondary)`;default:return`var(--primary-base)`}}function I(e){switch(e){case`completed`:return`Completed`;case`failed`:return`Failed`;case`cancelled`:return`Cancelled`;default:return`Running`}}function L({status:e}){return(0,A.jsx)(O,{color:F(e),label:I(e)})}function R({status:e}){let t=y(),n=`h-3.5 w-3.5 shrink-0`,r;return r=e===`running`?(0,A.jsx)(b,{className:`shrink-0`,dotSize:4,gap:2}):e===`completed`?(0,A.jsx)(d,{className:n,style:{color:`var(--system-positive-strong)`}}):e===`failed`?(0,A.jsx)(f,{className:n,style:{color:`var(--system-negative-strong)`}}):(0,A.jsx)(l,{className:n,style:{color:`var(--content-secondary)`},role:`img`,"aria-label":`Cancelled`}),(0,A.jsx)(v,{mode:`wait`,initial:!1,children:(0,A.jsx)(_.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t?{duration:0}:{duration:.15,ease:[.16,1,.3,1]},className:`flex shrink-0 items-center`,children:r},e)})}function z({runId:e,leaf:t,components:n,onSelect:r}){let a=t.label??`Subagent ${t.seq}`,o=t.promptSummary,s=E(`${e}:${t.seq}`);return(0,A.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Open ${a} details`,className:`flex w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] px-2 py-1.5 text-left transition-colors hover:bg-[var(--surface-overlay)]`,children:(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(R,{status:t.status}),n?(0,A.jsx)(w,{components:n,bodyShapeId:s.bodyShape,eyeStyleId:s.eyeStyle,colorId:s.color,size:16}):(0,A.jsx)(`div`,{style:{width:16,height:16,flexShrink:0},"aria-hidden":!0}),(0,A.jsx)(i,{variant:`body-medium-default`,title:a,className:`max-w-[60%] shrink-0 truncate text-[var(--content-default)]`,children:a}),o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[var(--content-tertiary)] opacity-10`,children:`|`}),(0,A.jsx)(i,{variant:`body-medium-lighter`,title:o,className:`min-w-0 truncate text-[var(--content-tertiary)]`,children:o})]})]})})}function B({entry:e,onClose:t,onStop:r,onRequestJournal:l}){let d=g(e.status),f=y(),m=e.label??e.runId,h=e.agentsSpawned||e.leaves.size,v=T(),b=[...e.leaves.values()].sort((e,t)=>e.seq-t.seq),[D,O]=(0,k.useState)(null),[M,F]=(0,k.useState)(e.runId);M!==e.runId&&(F(e.runId),O(null));let I=D==null?void 0:e.leaves.get(D),R=I?E(`${e.runId}:${I.seq}`):void 0,B=(0,k.useCallback)(()=>O(null),[]),V=I?I.label??`Subagent ${I.seq}`:``,H=I?V:m,U=d?`live`:`final`;return(0,k.useEffect)(()=>{l?.(e.runId)},[e.runId,U,l]),(0,A.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden rounded-xl bg-[var(--surface-lift)]`,children:[I&&(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:B,title:m,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,A.jsx)(i,{variant:`body-small-default`,as:`span`,children:m})}),(0,A.jsx)(u,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,A.jsx)(i,{variant:`body-small-default`,as:`span`,title:V,className:`min-w-0 shrink truncate text-[var(--content-secondary)]`,children:V})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-[var(--border-hover)] px-5 py-4`,children:[I&&(0,A.jsx)(n,{variant:`outlined`,iconOnly:(0,A.jsx)(a,{}),onClick:B,"aria-label":`Back to subagents`,tooltip:`Back`,className:`shrink-0 rounded-lg`}),I?v&&R?(0,A.jsx)(w,{components:v,bodyShapeId:R.bodyShape,eyeStyleId:R.eyeStyle,colorId:R.color,size:32}):(0,A.jsx)(`div`,{style:{width:32,height:32,flexShrink:0},"aria-hidden":!0}):(0,A.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-[6px] bg-[var(--surface-overlay)]`,children:(0,A.jsx)(C,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})}),(0,A.jsx)(i,{variant:`title-medium`,title:H,className:`min-w-0 shrink truncate text-[var(--content-default)]`,children:H}),I?(0,A.jsx)(L,{status:I.status}):(0,A.jsx)(P,{status:e.status}),(0,A.jsx)(`span`,{className:`flex-1`}),d&&r&&(0,A.jsx)(j,{onClick:()=>r(e.runId),ariaLabel:`Stop workflow`}),(0,A.jsx)(n,{variant:`outlined`,iconOnly:(0,A.jsx)(p,{}),onClick:t,"aria-label":`Close workflow detail`,tooltip:`Close`,className:`shrink-0 rounded-lg`})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5`,children:(0,A.jsx)(_.div,{initial:{opacity:0},animate:{opacity:1},transition:f?{duration:0}:{duration:.18,ease:[.16,1,.3,1]},children:I?(0,A.jsx)(N,{leaf:I}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`mb-5 grid grid-cols-3 gap-3`,children:[(0,A.jsx)(c,{icon:(0,A.jsx)(S,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens,format:e=>o(Math.round(e)),label:`Input`}),(0,A.jsx)(c,{icon:(0,A.jsx)(s,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens,format:e=>o(Math.round(e)),label:`Output`}),(0,A.jsx)(c,{icon:(0,A.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:h,format:e=>o(Math.round(e)),label:`Agents`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(i,{variant:`body-medium-default`,as:`h3`,className:`mb-4 text-[var(--content-emphasised)]`,children:`Subagents`}),b.length===0?(0,A.jsx)(i,{variant:`body-small-default`,className:`py-4 text-center text-[var(--content-tertiary)]`,children:`No subagents yet`}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:b.map(t=>(0,A.jsx)(z,{runId:e.runId,leaf:t,components:v,onSelect:()=>O(t.seq)},t.seq))})]})]})},I?String(I.seq):`list`)})]})}export{B as WorkflowDetailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./queryOptions-BtNi-_9H.js";import{t as l}from"./createLucideIcon-Bjb-Kuq7.js";import{t as u}from"./chevron-down-DpYf9Gwq.js";import{t as d}from"./chevron-right-jRymmL7S.js";import{t as f}from"./menu-DpEE6Pur.js";import{t as p}from"./download-CXYjvgB3.js";import{t as m}from"./eye-off-BgOJcVXo.js";import{t as h}from"./eye-Cvo8rdU0.js";import{t as g}from"./file-text-E5adVLLN.js";import{t as _}from"./file-D1SmEL-K.js";import{t as v}from"./folder-open-9vQalGTM.js";import{t as y}from"./loader-circle-D57RZgLH.js";import{t as b}from"./pencil-DEevs4oD.js";import{t as x}from"./plus-CQiIB1qS.js";import{t as S}from"./x-CswtfvgS.js";import{O as C}from"./src-CDdn26Yb.js";import{t as w}from"./input-ZpyYt_a0.js";import{t as T}from"./modal-BtcwNEBj.js";import{n as E,t as D}from"./panel-item-Bvqsr5n9.js";import{t as O}from"./confirm-dialog-CCrDkChx.js";import{n as k,t as A}from"./file-markdown-DZhQRECx.js";import{Ar as j,Ir as M,Lr as ee,Mr as N,Nr as P,Pr as F,jr as I}from"./sdk.gen-D_Qurj4O.js";import{n as L}from"./native-file-CgfJr8IE.js";import{Da as R,Oa as z,Ui as B,ea as te,wa as V,zi as H,zr as U}from"./index-CmaRQR9x.js";import{t as W}from"./use-active-assistant-id-9rGx8kT9.js";import{n as G,t as ne}from"./mobile-sidebar-drawer-XsUj_ej1.js";import{i as K,n as re,r as q,t as J}from"./file-editor-kHnQQ-I8.js";import{t as Y}from"./format-file-size-Dy3zTYKi.js";var ie=l(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),ae=l(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),X=l(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Z=e(t(),1);async function oe(e){let{data:t,error:n}=await I({path:{assistant_id:e.assistantId},query:{path:e.path,...e.showHidden?{showHidden:`true`}:{}},parseAs:`blob`,throwOnError:!1});if(n||!(t instanceof Blob))throw Error(`Failed to download file`);await L(t,e.filename)}function se(e){if(!e)return``;let t=e.indexOf(`;`);return(t===-1?e:e.slice(0,t)).trim()}function ce(e,t){return se(t)===`application/json`?!0:(e??``).toLowerCase().endsWith(`.json`)}function le(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function ue(e){return e.split(`/`).some(e=>e.startsWith(`.`))}var Q=s();function de(e){return c({queryFn:async()=>{let{data:t,error:n}=await N({path:e.path,query:{path:e.query.path,...e.query.showHidden?{showHidden:`true`}:{}}});if(n)throw n;return t},queryKey:[`assistantsWorkspaceFileRetrieve`,e]})}function fe({mimeType:e}){let t=e.indexOf(`;`),n=(t===-1?e:e.slice(0,t)).trim(),r=g;return n.startsWith(`image/`)?r=V:n.startsWith(`video/`)?r=H:!n.startsWith(`text/`)&&n!==`application/json`&&n!==`application/octet-stream`&&(r=_),(0,Q.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 10%, transparent)`},children:(0,Q.jsx)(r,{className:`h-3.5 w-3.5`,style:{color:`var(--content-default)`}})})}function pe({viewMode:e,onChange:t}){return(0,Q.jsx)(`div`,{className:`inline-flex rounded-md p-0.5`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 6%, transparent)`},children:[`preview`,`source`].map(r=>{let i=e===r;return(0,Q.jsx)(n,{variant:`ghost`,onClick:()=>t(r),className:`h-auto rounded border-0 px-2.5 py-1 text-body-small-default hover:bg-transparent`,style:{backgroundColor:i?`var(--surface-lift)`:`transparent`,color:i?`var(--content-default)`:`var(--content-tertiary)`,boxShadow:i?`0 1px 2px rgba(0,0,0,0.15)`:void 0},children:r===`preview`?`Preview`:`Source`},r)})})}function $({name:e,mimeType:t,size:n,rightContent:r}){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(fe,{mimeType:t}),(0,Q.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e}),n!=null&&(0,Q.jsx)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:Y(n)})]}),r]})}function me({assistantId:e,path:t,mimeType:n,showHidden:r}){let{data:i,isLoading:o}=a({queryFn:async()=>{let n=await I({path:{assistant_id:e},query:{path:t,...r?{showHidden:`true`}:{}},parseAs:`blob`});if(n.error)throw n.error;return n.data},queryKey:[`assistantsWorkspaceFileContentRetrieve`,{assistantId:e,path:t,showHidden:r}],enabled:!!t}),[s,c]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(!i)return;let e=URL.createObjectURL(i);return c(e),()=>{URL.revokeObjectURL(e),c(null)}},[i]),o?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Q.jsx)(y,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):s?n.startsWith(`image/`)?(0,Q.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Q.jsx)(`img`,{src:s,alt:t.split(`/`).pop()??`image`,className:`max-h-[70vh] max-w-full rounded object-contain`})}):n.startsWith(`video/`)?(0,Q.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Q.jsx)(`video`,{src:s,controls:!0,className:`max-h-[70vh] max-w-full rounded`})}):null:null}function he({assistantId:e,path:t,name:r,mimeType:i,size:a,modifiedAt:o,showHidden:s}){let[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f=(0,Z.useCallback)(async()=>{d(!1),l(!0);try{await oe({assistantId:e,path:t,filename:r,showHidden:s})}catch{d(!0)}finally{l(!1)}},[e,t,r,s]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:r,mimeType:i,size:a}),(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border p-6 text-center`,style:{borderColor:`var(--border-base)`,backgroundColor:`var(--surface-lift)`},children:[(0,Q.jsx)(_,{className:`mx-auto h-10 w-10`,style:{color:`var(--content-tertiary)`}}),(0,Q.jsx)(`p`,{className:`mt-3 text-body-medium-default`,style:{color:`var(--content-default)`},children:r}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:i}),(0,Q.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:Y(a,`Unknown size`)}),o&&(0,Q.jsxs)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:[`Modified: `,new Date(o).toLocaleString()]})]}),(0,Q.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:c?(0,Q.jsx)(y,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(p,{"aria-hidden":!0}),onClick:f,disabled:c,"aria-label":`Download ${r}`,className:`mt-4`,children:c?`Downloading…`:`Download`}),u&&(0,Q.jsx)(`p`,{className:`mt-2 text-body-small-default`,style:{color:`var(--system-error)`},children:`Download failed. Try again.`})]})})]})}function ge({assistantId:e,selectedPath:t,showHidden:r,viewMode:s,onChangeViewMode:c,onBrowse:l,pathRename:u,pathDelete:d}){let f=i(),{data:p,isLoading:m}=a({...de({path:{assistant_id:e},query:{path:t??``,showHidden:r}}),enabled:!!t}),[h,g]=(0,Z.useState)(null),[_,b]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{if(!u)return;let{from:e,to:t}=u,n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;g(e=>e==null?e:n(e)),b(e=>e==null?e:{...e,path:n(e.path)})},[u]),(0,Z.useEffect)(()=>{if(!d)return;let{path:e}=d,t=t=>t===e||t.startsWith(`${e}/`);g(e=>e!=null&&t(e)?null:e),b(e=>e!=null&&t(e.path)?null:e)},[d]);let x=h!=null&&h===t,S=p?.content??``,C=_?.path===t?_.content:S,w=()=>{g(null),b(null)},T=o({mutationFn:async({path:t,content:n})=>{let{error:r,response:i}=await ee({path:{assistant_id:e},body:{path:t,content:n,encoding:`utf8`},throwOnError:!1});if(!i?.ok||r)throw Error(`Failed to save file`)},onSuccess:(e,t)=>{g(e=>e===t.path?null:e),b(e=>e?.path===t.path?null:e),f.invalidateQueries({queryKey:[`assistantsWorkspaceFileRetrieve`]})}}),E=C!==S,D=(0,Z.useCallback)(()=>{t&&E&&!T.isPending&&T.mutate({path:t,content:C})},[t,E,T,C]);if(!t)return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view`}),l&&(0,Q.jsx)(n,{type:`button`,onClick:l,leftIcon:(0,Q.jsx)(v,{"aria-hidden":!0}),className:`sm:hidden`,children:`Browse files`})]});if(m)return(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsx)(y,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})});if(!p)return(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`File not found`})});let O=p.mimeType??`application/octet-stream`,j=p.name??t.split(`/`).pop()??t,M=k(j,O),N=ce(j,O),P=p.content!=null&&!M&&!N,F=t?ue(t):!0,I=x&&(0,Q.jsx)(re,{isDirty:E,isSaving:T.isPending,error:T.isError?`Save failed`:null,onSave:D,onDiscard:w});if(M&&p.content!=null){let e=x?C:p.content;return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,rightContent:(0,Q.jsx)(pe,{viewMode:s,onChange:e=>{x&&w(),c(e)}})}),(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Q.jsx)(J,{content:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:x,onToggleEdit:()=>x?w():g(t)}),s===`preview`?(0,Q.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Q.jsx)(A,{content:e})}):x?(0,Q.jsx)(q,{value:C,onChange:e=>b({path:t,content:e}),onSave:D}):(0,Q.jsx)(K,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}if(N&&p.content!=null){let e=x?C:p.content,n=le(e);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,rightContent:(0,Q.jsx)(pe,{viewMode:s,onChange:e=>{x&&w(),c(e)}})}),(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Q.jsx)(J,{content:s===`preview`?n:e,downloadContent:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:x,onToggleEdit:()=>x?w():g(t)}),s===`preview`?(0,Q.jsx)(K,{content:n,readOnly:!0,whiteSpace:`pre`}):x?(0,Q.jsx)(q,{value:C,onChange:e=>b({path:t,content:e}),onSave:D}):(0,Q.jsx)(K,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}return P?(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,size:p.size}),(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Q.jsx)(J,{content:x?C:p.content??``,fileName:j,mimeType:O,showEdit:!F,isEditing:x,onToggleEdit:()=>x?w():g(t)}),x?(0,Q.jsx)(q,{value:C,onChange:e=>b({path:t,content:e}),onSave:D}):(0,Q.jsx)(K,{content:p.content??``,readOnly:F,onStartEdit:()=>g(t)})]}),I]}):O.startsWith(`image/`)||O.startsWith(`video/`)?(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,size:p.size}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,Q.jsx)(me,{assistantId:e,path:t,mimeType:O,showHidden:r})})]}):(0,Q.jsx)(he,{assistantId:e,path:t,name:j,mimeType:O,size:p.size,modifiedAt:p.modifiedAt,showHidden:r})}function _e(e,t){if(t===`name`)return e;let n=e.slice();return n.sort((e,t)=>{let n=e.size??null,r=t.size??null;return n===null&&r===null?(e.name??``).localeCompare(t.name??``):n===null?1:r===null?-1:n===r?(e.name??``).localeCompare(t.name??``):r-n}),n}function ve(e){return c({queryFn:async()=>{let t={};e.query?.path&&(t.path=e.query.path),e.query?.showHidden&&(t.showHidden=`true`),e.query?.includeDirSizes&&(t.includeDirSizes=`true`);let{data:n,error:r}=await M({path:e.path,query:t});if(r)throw r;if(!n)throw Error(`Failed to load workspace tree`);return n},queryKey:[`assistantsWorkspaceTreeRetrieve`,e]})}async function ye(e,t,n,r){let i=n.toLowerCase(),a=r?.toLowerCase(),{data:o}=await M({path:{assistant_id:e},query:t?{path:t}:{}});if(o?.entries?.some(e=>{let t=(e.name??``).toLowerCase();return t===i&&t!==a}))throw Error(`"${n}" already exists here.`)}function be({entry:e}){return e.type===`directory`?(0,Q.jsx)(R,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`image/`)?(0,Q.jsx)(V,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`video/`)?(0,Q.jsx)(H,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Q.jsx)(g,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}})}function xe({entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:f,onRequestRename:p,onRequestCreate:m,depth:h}){let g=e.path??``,_=e.name??``,v=e.type===`directory`,y=n.has(g),x=r===g,S=_.startsWith(`.`),w=!ue(g),T=v&&(y||s.length>0),{data:E}=a({...ve({path:{assistant_id:t},query:{path:g,showHidden:i,includeDirSizes:o===`size`}}),enabled:v&&T}),D=(0,Z.useMemo)(()=>_e(E?.entries??[],o),[E?.entries,o]),O=s===``||_.toLowerCase().includes(s);if(s!==``&&!v&&!O)return null;let k=(0,Q.jsxs)(`button`,{onClick:()=>{v?c(g):l(g)},className:`flex w-full items-center gap-1.5 px-2 py-1 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{paddingLeft:`${h*14+8}px`,paddingRight:`8px`,color:x?`var(--content-default)`:S?`var(--content-tertiary)`:`var(--content-default)`,backgroundColor:x?`color-mix(in oklab, var(--primary-base) 12%, transparent)`:void 0,opacity:S&&!x?.7:1},children:[v?T?(0,Q.jsx)(u,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Q.jsx)(d,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Q.jsx)(`span`,{className:`h-3 w-3 shrink-0`}),(0,Q.jsx)(be,{entry:e}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_}),e.size!=null&&(0,Q.jsx)(`span`,{className:`shrink-0 text-label-medium-default tabular-nums`,style:{color:`var(--content-tertiary)`},children:Y(e.size)})]});return(0,Q.jsxs)(`div`,{children:[w?(0,Q.jsxs)(C.Root,{children:[(0,Q.jsx)(C.Trigger,{children:k}),(0,Q.jsxs)(C.Content,{children:[v&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(z,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`file`,parentPath:g}),children:`New File`}),(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(X,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`folder`,parentPath:g}),children:`New Folder`}),(0,Q.jsx)(C.Separator,{})]}),(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(B,{className:`h-3.5 w-3.5`}),onSelect:()=>f({path:g,name:_,isDirectory:v}),children:`Delete`}),(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(b,{className:`h-3.5 w-3.5`}),onSelect:()=>p({path:g,name:_,isDirectory:v}),children:`Rename`})]})]}):k,v&&T&&D.length>0&&(0,Q.jsx)(`div`,{children:D.map(e=>(0,Q.jsx)(xe,{entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:f,onRequestRename:p,onRequestCreate:m,depth:h+1},e.path))})]})}function Se({title:e,placeholder:t,confirmLabel:r,pendingLabel:i,initialName:a,onCancel:o,onConfirm:s,pending:c,error:l}){let u=(0,Z.useRef)(null),[d,f]=(0,Z.useState)(a??``),p=d.trim(),m=p.length>0&&(/[/\\]/.test(p)||p===`.`||p===`..`),h=p.length>0&&!m&&!c;return(0,Q.jsx)(T.Root,{open:!0,onOpenChange:e=>{!e&&!c&&o()},children:(0,Q.jsx)(T.Content,{size:`sm`,hideCloseButton:!0,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault();let t=u.current;t&&(t.focus(),requestAnimationFrame(()=>{t.setSelectionRange(0,t.value.length)}))},onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),c||o()},children:(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h&&s(p)},children:[(0,Q.jsx)(T.Header,{children:(0,Q.jsx)(T.Title,{children:e})}),(0,Q.jsx)(T.Body,{children:(0,Q.jsx)(w,{ref:u,label:`Name`,value:d,onChange:e=>f(e.target.value),placeholder:t,errorText:l??(m?`Enter a single file or folder name without slashes.`:void 0),autoComplete:`off`,spellCheck:!1,fullWidth:!0})}),(0,Q.jsxs)(T.Footer,{children:[(0,Q.jsx)(n,{type:`button`,variant:`outlined`,onClick:o,disabled:c,children:`Cancel`}),(0,Q.jsx)(n,{type:`submit`,variant:`primary`,disabled:!h,children:c?i:r})]})]})})})}function Ce({assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,onToggleExpand:l,onExpandPath:u,onSelectPath:d,onToggleShowHidden:f,onChangeSortMode:p,onPathDeleted:g,onPathRenamed:_}){let v=i(),[y,b]=(0,Z.useState)(``),x=y.trim().toLowerCase(),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(null),M=(0,Z.useCallback)(()=>{D(null),A(null)},[]),{data:N,isLoading:I}=a(ve({path:{assistant_id:e},query:{showHidden:s,includeDirSizes:c===`size`}})),L=(0,Z.useMemo)(()=>_e(N?.entries??[],c),[N?.entries,c]),R=(0,Z.useCallback)(()=>{for(let e of[`assistantsWorkspaceTreeRetrieve`,`assistantsWorkspaceFileRetrieve`,`assistantsWorkspaceFileContentRetrieve`])v.invalidateQueries({queryKey:[e]})},[v]),z=o({mutationFn:async t=>{let n=t.parentPath?`${t.parentPath}/${t.name}`:t.name;await ye(e,t.parentPath,t.name);let{error:r,response:i}=t.kind===`file`?await ee({path:{assistant_id:e},body:{path:n,content:``,encoding:`utf8`},throwOnError:!1}):await P({path:{assistant_id:e},body:{path:n},throwOnError:!1});if(r||!i?.ok)throw Error(typeof r==`string`?r:`Failed to create — check the name and try again.`);return{...t,path:n}},onSuccess:e=>{M(),R(),e.parentPath&&u(e.parentPath),e.kind===`file`?d(e.path):u(e.path)},onError:e=>{A(e instanceof Error?e.message:`Failed to create.`)}}),B=o({mutationFn:async t=>{let n=t.oldPath.lastIndexOf(`/`),r=n===-1?``:t.oldPath.slice(0,n),i=t.oldPath.slice(n+1),a=r?`${r}/${t.newName}`:t.newName;await ye(e,r,t.newName,i);let{error:o,response:s}=await F({path:{assistant_id:e},body:{oldPath:t.oldPath,newPath:a},throwOnError:!1});if(o||!s?.ok)throw Error(typeof o==`string`?o:`Failed to rename — check the name and try again.`);return{oldPath:t.oldPath,newPath:a}},onSuccess:({oldPath:e,newPath:t})=>{M(),R(),_(e,t)},onError:e=>{A(e instanceof Error?e.message:`Failed to rename.`)}}),V=(0,Z.useCallback)(e=>{A(null),D({type:`create`,...e})},[]),H=(0,Z.useCallback)(e=>{A(null),D({type:`rename`,path:e.path,name:e.name})},[]),[U,W]=(0,Z.useState)(null),G=o({mutationFn:async t=>{let{error:n,response:r}=await j({path:{assistant_id:e},body:{path:t.path},throwOnError:!1});if(n||!r?.ok)throw Error(typeof n==`string`?n:`Failed to delete — try again.`);return t},onSuccess:e=>{W(null),R(),g(e.path)}}),ne=(0,Z.useCallback)(e=>{G.reset(),W(e)},[G]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-secondary)`},children:`Files`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:c===`size`?(0,Q.jsx)(ae,{"aria-hidden":!0}):(0,Q.jsx)(ie,{"aria-hidden":!0}),onClick:()=>p(c===`size`?`name`:`size`),"aria-label":c===`size`?`Sort by name`:`Sort by size`,title:c===`size`?`Sorted by size — switch to name`:`Sorted by name — switch to size`,tintColor:c===`size`?`var(--content-default)`:`var(--content-tertiary)`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:s?(0,Q.jsx)(h,{"aria-hidden":!0}):(0,Q.jsx)(m,{"aria-hidden":!0}),onClick:f,"aria-label":s?`Hide hidden files`:`Show hidden files`,title:s?`Hide hidden files`:`Show hidden files`,tintColor:s?`var(--content-default)`:`var(--content-tertiary)`}),(0,Q.jsx)(we,{open:C,onOpenChange:T,onSelectKind:e=>{T(!1),V({kind:e,parentPath:``})}})]})]}),(0,Q.jsx)(`div`,{className:`px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(w,{type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Search files`,leftIcon:(0,Q.jsx)(te,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,spellCheck:!1,autoComplete:`off`}),y&&(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(S,{"aria-hidden":!0}),onClick:()=>b(``),"aria-label":`Clear search`,className:`absolute right-1.5 top-1/2 -translate-y-1/2`,tintColor:`var(--content-tertiary)`})]})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:I?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`,style:{color:`var(--content-tertiary)`}})}):L.length?L.map(n=>(0,Q.jsx)(xe,{entry:n,assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,searchLower:x,onToggleExpand:l,onSelectPath:d,onRequestDelete:ne,onRequestRename:H,onRequestCreate:V,depth:0},n.path)):(0,Q.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files found`})}),E?.type===`create`&&(0,Q.jsx)(Se,{title:E.kind===`file`?`New File`:`New Folder`,placeholder:E.kind===`file`?`filename.md`:`folder-name`,confirmLabel:`Create`,pendingLabel:`Creating…`,onCancel:M,onConfirm:e=>{A(null),z.mutate({kind:E.kind,parentPath:E.parentPath,name:e})},pending:z.isPending,error:k},`create-${E.kind}-${E.parentPath}`),E?.type===`rename`&&(0,Q.jsx)(Se,{title:`Rename`,placeholder:E.name,confirmLabel:`Rename`,pendingLabel:`Renaming…`,initialName:E.name,onCancel:M,onConfirm:e=>{if(e===E.name){M();return}A(null),B.mutate({oldPath:E.path,newName:e})},pending:B.isPending,error:k},`rename-${E.path}`),(0,Q.jsx)(O,{open:U!==null,title:U?.isDirectory?`Delete Folder`:`Delete File`,message:(0,Q.jsxs)(Q.Fragment,{children:[`Are you sure you want to delete`,` `,(0,Q.jsx)(`span`,{style:{color:`var(--content-default)`},children:U?.name}),U?.isDirectory?` and all of its contents`:``,`? This cannot be undone.`,G.error&&(0,Q.jsx)(`span`,{className:`mt-2 block`,style:{color:`var(--system-negative-strong)`},children:G.error.message})]}),confirmLabel:G.isPending?`Deleting…`:`Delete`,destructive:!0,isPending:G.isPending,onConfirm:()=>{U&&G.mutate(U)},onCancel:()=>W(null)})]})}function we({open:e,onOpenChange:t,onSelectKind:r}){return U()?(0,Q.jsxs)(E.Root,{open:e,onOpenChange:t,children:[(0,Q.jsx)(E.Trigger,{asChild:!0,children:(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(x,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Q.jsxs)(E.Content,{children:[(0,Q.jsx)(E.Header,{className:`sr-only`,children:(0,Q.jsx)(E.Title,{children:`Create new`})}),(0,Q.jsxs)(E.Body,{className:`pt-0`,children:[(0,Q.jsx)(D,{icon:z,label:`New File`,onSelect:()=>r(`file`)}),(0,Q.jsx)(D,{icon:X,label:`New Folder`,onSelect:()=>r(`folder`)})]})]})]}):(0,Q.jsxs)(f.Root,{open:e,onOpenChange:t,children:[(0,Q.jsx)(f.Trigger,{asChild:!0,children:(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(x,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Q.jsxs)(f.Content,{align:`end`,sideOffset:4,children:[(0,Q.jsx)(f.Item,{leftIcon:(0,Q.jsx)(z,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`file`),children:`New File`}),(0,Q.jsx)(f.Item,{leftIcon:(0,Q.jsx)(X,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`folder`),children:`New Folder`})]})]})}function Te(e){let t=e.split(`/`),n=new Set;for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`));return n}function Ee({assistantId:e}){let[t,n]=r(),[i,a]=(0,Z.useState)(()=>{let e=t.get(`file`);return e?Te(e):new Set}),[o,s]=(0,Z.useState)(()=>t.get(`file`)),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(()=>t.get(`sort`)===`size`?`size`:`name`),[f,p]=(0,Z.useState)(`preview`);(0,Z.useEffect)(()=>{t.get(`file`)&&n(e=>{let t=new URLSearchParams(e);return t.delete(`file`),t},{replace:!0})},[]);let m=(0,Z.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=(0,Z.useCallback)(e=>{a(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),[g,_]=(0,Z.useState)(!1),v=(0,Z.useCallback)(e=>{s(e),_(!1)},[]),[y,b]=(0,Z.useState)(null),x=(0,Z.useCallback)(e=>{let t=t=>t===e||t.startsWith(`${e}/`);s(e=>e!==null&&t(e)?null:e),a(e=>{let n=new Set([...e].filter(e=>!t(e)));return n.size===e.size?e:n}),b({path:e})},[]),[S,C]=(0,Z.useState)(null),w={assistantId:e,expandedPaths:i,selectedPath:o,showHidden:c,sortMode:u,onToggleExpand:m,onExpandPath:h,onSelectPath:v,onToggleShowHidden:()=>l(e=>!e),onChangeSortMode:d,onPathDeleted:x,onPathRenamed:(0,Z.useCallback)((e,t)=>{let n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;s(e=>e===null?e:n(e)),a(e=>{let t=!1,r=new Set;for(let i of e){let e=n(i);e!==i&&(t=!0),r.add(e)}return t?r:e}),C({from:e,to:t})},[])};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,Q.jsx)(G,{onClick:()=>_(!0)})}),(0,Q.jsx)(ne,{open:g,onClose:()=>_(!1),title:`Files`,children:(0,Q.jsx)(Ce,{...w})}),(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-4 sm:grid-cols-[320px_1fr]`,children:[(0,Q.jsx)(`div`,{className:`hidden min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border sm:flex`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Q.jsx)(Ce,{...w})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Q.jsx)(ge,{assistantId:e,selectedPath:o,showHidden:c,viewMode:f,onChangeViewMode:p,onBrowse:()=>_(!0),pathRename:S,pathDelete:y})})]})]})}function De(){return(0,Q.jsx)(Ee,{assistantId:W()})}export{De as WorkspacePage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./queryOptions-BtNi-_9H.js";import{t as l}from"./createLucideIcon-Bjb-Kuq7.js";import{t as u}from"./chevron-down-DpYf9Gwq.js";import{t as d}from"./chevron-right-jRymmL7S.js";import{t as f}from"./menu-DpEE6Pur.js";import{t as p}from"./download-CXYjvgB3.js";import{t as m}from"./eye-off-BgOJcVXo.js";import{t as h}from"./eye-Cvo8rdU0.js";import{t as g}from"./file-text-E5adVLLN.js";import{t as _}from"./file-D1SmEL-K.js";import{t as v}from"./folder-open-9vQalGTM.js";import{t as y}from"./loader-circle-D57RZgLH.js";import{t as b}from"./pencil-DEevs4oD.js";import{t as x}from"./plus-CQiIB1qS.js";import{t as S}from"./x-CswtfvgS.js";import{O as C}from"./src-CDdn26Yb.js";import{t as w}from"./input-ZpyYt_a0.js";import{t as T}from"./modal-BtcwNEBj.js";import{n as E,t as D}from"./panel-item-Bvqsr5n9.js";import{t as O}from"./confirm-dialog-CCrDkChx.js";import{n as k,t as A}from"./file-markdown-DZhQRECx.js";import{Ar as j,Ir as M,Lr as ee,Mr as N,Nr as P,Pr as F,jr as I}from"./sdk.gen-D_Qurj4O.js";import{n as L}from"./native-file-CgfJr8IE.js";import{Da as R,Oa as z,Ui as B,ea as te,wa as V,zi as H,zr as U}from"./index-CgcZXB4g.js";import{t as W}from"./use-active-assistant-id-9rGx8kT9.js";import{n as G,t as ne}from"./mobile-sidebar-drawer-BmS9adnj.js";import{i as K,n as re,r as q,t as J}from"./file-editor-kHnQQ-I8.js";import{t as Y}from"./format-file-size-Dy3zTYKi.js";var ie=l(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),ae=l(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),X=l(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Z=e(t(),1);async function oe(e){let{data:t,error:n}=await I({path:{assistant_id:e.assistantId},query:{path:e.path,...e.showHidden?{showHidden:`true`}:{}},parseAs:`blob`,throwOnError:!1});if(n||!(t instanceof Blob))throw Error(`Failed to download file`);await L(t,e.filename)}function se(e){if(!e)return``;let t=e.indexOf(`;`);return(t===-1?e:e.slice(0,t)).trim()}function ce(e,t){return se(t)===`application/json`?!0:(e??``).toLowerCase().endsWith(`.json`)}function le(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function ue(e){return e.split(`/`).some(e=>e.startsWith(`.`))}var Q=s();function de(e){return c({queryFn:async()=>{let{data:t,error:n}=await N({path:e.path,query:{path:e.query.path,...e.query.showHidden?{showHidden:`true`}:{}}});if(n)throw n;return t},queryKey:[`assistantsWorkspaceFileRetrieve`,e]})}function fe({mimeType:e}){let t=e.indexOf(`;`),n=(t===-1?e:e.slice(0,t)).trim(),r=g;return n.startsWith(`image/`)?r=V:n.startsWith(`video/`)?r=H:!n.startsWith(`text/`)&&n!==`application/json`&&n!==`application/octet-stream`&&(r=_),(0,Q.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 10%, transparent)`},children:(0,Q.jsx)(r,{className:`h-3.5 w-3.5`,style:{color:`var(--content-default)`}})})}function pe({viewMode:e,onChange:t}){return(0,Q.jsx)(`div`,{className:`inline-flex rounded-md p-0.5`,style:{backgroundColor:`color-mix(in oklab, var(--content-default) 6%, transparent)`},children:[`preview`,`source`].map(r=>{let i=e===r;return(0,Q.jsx)(n,{variant:`ghost`,onClick:()=>t(r),className:`h-auto rounded border-0 px-2.5 py-1 text-body-small-default hover:bg-transparent`,style:{backgroundColor:i?`var(--surface-lift)`:`transparent`,color:i?`var(--content-default)`:`var(--content-tertiary)`,boxShadow:i?`0 1px 2px rgba(0,0,0,0.15)`:void 0},children:r===`preview`?`Preview`:`Source`},r)})})}function $({name:e,mimeType:t,size:n,rightContent:r}){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(fe,{mimeType:t}),(0,Q.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e}),n!=null&&(0,Q.jsx)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:Y(n)})]}),r]})}function me({assistantId:e,path:t,mimeType:n,showHidden:r}){let{data:i,isLoading:o}=a({queryFn:async()=>{let n=await I({path:{assistant_id:e},query:{path:t,...r?{showHidden:`true`}:{}},parseAs:`blob`});if(n.error)throw n.error;return n.data},queryKey:[`assistantsWorkspaceFileContentRetrieve`,{assistantId:e,path:t,showHidden:r}],enabled:!!t}),[s,c]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(!i)return;let e=URL.createObjectURL(i);return c(e),()=>{URL.revokeObjectURL(e),c(null)}},[i]),o?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Q.jsx)(y,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):s?n.startsWith(`image/`)?(0,Q.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Q.jsx)(`img`,{src:s,alt:t.split(`/`).pop()??`image`,className:`max-h-[70vh] max-w-full rounded object-contain`})}):n.startsWith(`video/`)?(0,Q.jsx)(`div`,{className:`flex items-center justify-center p-4`,children:(0,Q.jsx)(`video`,{src:s,controls:!0,className:`max-h-[70vh] max-w-full rounded`})}):null:null}function he({assistantId:e,path:t,name:r,mimeType:i,size:a,modifiedAt:o,showHidden:s}){let[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f=(0,Z.useCallback)(async()=>{d(!1),l(!0);try{await oe({assistantId:e,path:t,filename:r,showHidden:s})}catch{d(!0)}finally{l(!1)}},[e,t,r,s]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:r,mimeType:i,size:a}),(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border p-6 text-center`,style:{borderColor:`var(--border-base)`,backgroundColor:`var(--surface-lift)`},children:[(0,Q.jsx)(_,{className:`mx-auto h-10 w-10`,style:{color:`var(--content-tertiary)`}}),(0,Q.jsx)(`p`,{className:`mt-3 text-body-medium-default`,style:{color:`var(--content-default)`},children:r}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:i}),(0,Q.jsx)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:Y(a,`Unknown size`)}),o&&(0,Q.jsxs)(`p`,{className:`text-body-small-default`,style:{color:`var(--content-secondary, var(--content-tertiary))`},children:[`Modified: `,new Date(o).toLocaleString()]})]}),(0,Q.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:c?(0,Q.jsx)(y,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(p,{"aria-hidden":!0}),onClick:f,disabled:c,"aria-label":`Download ${r}`,className:`mt-4`,children:c?`Downloading…`:`Download`}),u&&(0,Q.jsx)(`p`,{className:`mt-2 text-body-small-default`,style:{color:`var(--system-error)`},children:`Download failed. Try again.`})]})})]})}function ge({assistantId:e,selectedPath:t,showHidden:r,viewMode:s,onChangeViewMode:c,onBrowse:l,pathRename:u,pathDelete:d}){let f=i(),{data:p,isLoading:m}=a({...de({path:{assistant_id:e},query:{path:t??``,showHidden:r}}),enabled:!!t}),[h,g]=(0,Z.useState)(null),[_,b]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{if(!u)return;let{from:e,to:t}=u,n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;g(e=>e==null?e:n(e)),b(e=>e==null?e:{...e,path:n(e.path)})},[u]),(0,Z.useEffect)(()=>{if(!d)return;let{path:e}=d,t=t=>t===e||t.startsWith(`${e}/`);g(e=>e!=null&&t(e)?null:e),b(e=>e!=null&&t(e.path)?null:e)},[d]);let x=h!=null&&h===t,S=p?.content??``,C=_?.path===t?_.content:S,w=()=>{g(null),b(null)},T=o({mutationFn:async({path:t,content:n})=>{let{error:r,response:i}=await ee({path:{assistant_id:e},body:{path:t,content:n,encoding:`utf8`},throwOnError:!1});if(!i?.ok||r)throw Error(`Failed to save file`)},onSuccess:(e,t)=>{g(e=>e===t.path?null:e),b(e=>e?.path===t.path?null:e),f.invalidateQueries({queryKey:[`assistantsWorkspaceFileRetrieve`]})}}),E=C!==S,D=(0,Z.useCallback)(()=>{t&&E&&!T.isPending&&T.mutate({path:t,content:C})},[t,E,T,C]);if(!t)return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view`}),l&&(0,Q.jsx)(n,{type:`button`,onClick:l,leftIcon:(0,Q.jsx)(v,{"aria-hidden":!0}),className:`sm:hidden`,children:`Browse files`})]});if(m)return(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsx)(y,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})});if(!p)return(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`File not found`})});let O=p.mimeType??`application/octet-stream`,j=p.name??t.split(`/`).pop()??t,M=k(j,O),N=ce(j,O),P=p.content!=null&&!M&&!N,F=t?ue(t):!0,I=x&&(0,Q.jsx)(re,{isDirty:E,isSaving:T.isPending,error:T.isError?`Save failed`:null,onSave:D,onDiscard:w});if(M&&p.content!=null){let e=x?C:p.content;return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,rightContent:(0,Q.jsx)(pe,{viewMode:s,onChange:e=>{x&&w(),c(e)}})}),(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Q.jsx)(J,{content:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:x,onToggleEdit:()=>x?w():g(t)}),s===`preview`?(0,Q.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Q.jsx)(A,{content:e})}):x?(0,Q.jsx)(q,{value:C,onChange:e=>b({path:t,content:e}),onSave:D}):(0,Q.jsx)(K,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}if(N&&p.content!=null){let e=x?C:p.content,n=le(e);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,rightContent:(0,Q.jsx)(pe,{viewMode:s,onChange:e=>{x&&w(),c(e)}})}),(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Q.jsx)(J,{content:s===`preview`?n:e,downloadContent:e,fileName:j,mimeType:O,showEdit:!F&&s===`source`,isEditing:x,onToggleEdit:()=>x?w():g(t)}),s===`preview`?(0,Q.jsx)(K,{content:n,readOnly:!0,whiteSpace:`pre`}):x?(0,Q.jsx)(q,{value:C,onChange:e=>b({path:t,content:e}),onSave:D}):(0,Q.jsx)(K,{content:p.content,readOnly:F,onStartEdit:()=>g(t)})]}),I]})}return P?(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,size:p.size}),(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Q.jsx)(J,{content:x?C:p.content??``,fileName:j,mimeType:O,showEdit:!F,isEditing:x,onToggleEdit:()=>x?w():g(t)}),x?(0,Q.jsx)(q,{value:C,onChange:e=>b({path:t,content:e}),onSave:D}):(0,Q.jsx)(K,{content:p.content??``,readOnly:F,onStartEdit:()=>g(t)})]}),I]}):O.startsWith(`image/`)||O.startsWith(`video/`)?(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)($,{name:j,mimeType:O,size:p.size}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,Q.jsx)(me,{assistantId:e,path:t,mimeType:O,showHidden:r})})]}):(0,Q.jsx)(he,{assistantId:e,path:t,name:j,mimeType:O,size:p.size,modifiedAt:p.modifiedAt,showHidden:r})}function _e(e,t){if(t===`name`)return e;let n=e.slice();return n.sort((e,t)=>{let n=e.size??null,r=t.size??null;return n===null&&r===null?(e.name??``).localeCompare(t.name??``):n===null?1:r===null?-1:n===r?(e.name??``).localeCompare(t.name??``):r-n}),n}function ve(e){return c({queryFn:async()=>{let t={};e.query?.path&&(t.path=e.query.path),e.query?.showHidden&&(t.showHidden=`true`),e.query?.includeDirSizes&&(t.includeDirSizes=`true`);let{data:n,error:r}=await M({path:e.path,query:t});if(r)throw r;if(!n)throw Error(`Failed to load workspace tree`);return n},queryKey:[`assistantsWorkspaceTreeRetrieve`,e]})}async function ye(e,t,n,r){let i=n.toLowerCase(),a=r?.toLowerCase(),{data:o}=await M({path:{assistant_id:e},query:t?{path:t}:{}});if(o?.entries?.some(e=>{let t=(e.name??``).toLowerCase();return t===i&&t!==a}))throw Error(`"${n}" already exists here.`)}function be({entry:e}){return e.type===`directory`?(0,Q.jsx)(R,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`image/`)?(0,Q.jsx)(V,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):e.mimeType?.startsWith(`video/`)?(0,Q.jsx)(H,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Q.jsx)(g,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`}})}function xe({entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:f,onRequestRename:p,onRequestCreate:m,depth:h}){let g=e.path??``,_=e.name??``,v=e.type===`directory`,y=n.has(g),x=r===g,S=_.startsWith(`.`),w=!ue(g),T=v&&(y||s.length>0),{data:E}=a({...ve({path:{assistant_id:t},query:{path:g,showHidden:i,includeDirSizes:o===`size`}}),enabled:v&&T}),D=(0,Z.useMemo)(()=>_e(E?.entries??[],o),[E?.entries,o]),O=s===``||_.toLowerCase().includes(s);if(s!==``&&!v&&!O)return null;let k=(0,Q.jsxs)(`button`,{onClick:()=>{v?c(g):l(g)},className:`flex w-full items-center gap-1.5 px-2 py-1 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{paddingLeft:`${h*14+8}px`,paddingRight:`8px`,color:x?`var(--content-default)`:S?`var(--content-tertiary)`:`var(--content-default)`,backgroundColor:x?`color-mix(in oklab, var(--primary-base) 12%, transparent)`:void 0,opacity:S&&!x?.7:1},children:[v?T?(0,Q.jsx)(u,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Q.jsx)(d,{className:`h-3 w-3 shrink-0`,style:{color:`var(--content-tertiary)`}}):(0,Q.jsx)(`span`,{className:`h-3 w-3 shrink-0`}),(0,Q.jsx)(be,{entry:e}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_}),e.size!=null&&(0,Q.jsx)(`span`,{className:`shrink-0 text-label-medium-default tabular-nums`,style:{color:`var(--content-tertiary)`},children:Y(e.size)})]});return(0,Q.jsxs)(`div`,{children:[w?(0,Q.jsxs)(C.Root,{children:[(0,Q.jsx)(C.Trigger,{children:k}),(0,Q.jsxs)(C.Content,{children:[v&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(z,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`file`,parentPath:g}),children:`New File`}),(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(X,{className:`h-3.5 w-3.5`}),onSelect:()=>m({kind:`folder`,parentPath:g}),children:`New Folder`}),(0,Q.jsx)(C.Separator,{})]}),(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(B,{className:`h-3.5 w-3.5`}),onSelect:()=>f({path:g,name:_,isDirectory:v}),children:`Delete`}),(0,Q.jsx)(C.Item,{leftIcon:(0,Q.jsx)(b,{className:`h-3.5 w-3.5`}),onSelect:()=>p({path:g,name:_,isDirectory:v}),children:`Rename`})]})]}):k,v&&T&&D.length>0&&(0,Q.jsx)(`div`,{children:D.map(e=>(0,Q.jsx)(xe,{entry:e,assistantId:t,expandedPaths:n,selectedPath:r,showHidden:i,sortMode:o,searchLower:s,onToggleExpand:c,onSelectPath:l,onRequestDelete:f,onRequestRename:p,onRequestCreate:m,depth:h+1},e.path))})]})}function Se({title:e,placeholder:t,confirmLabel:r,pendingLabel:i,initialName:a,onCancel:o,onConfirm:s,pending:c,error:l}){let u=(0,Z.useRef)(null),[d,f]=(0,Z.useState)(a??``),p=d.trim(),m=p.length>0&&(/[/\\]/.test(p)||p===`.`||p===`..`),h=p.length>0&&!m&&!c;return(0,Q.jsx)(T.Root,{open:!0,onOpenChange:e=>{!e&&!c&&o()},children:(0,Q.jsx)(T.Content,{size:`sm`,hideCloseButton:!0,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault();let t=u.current;t&&(t.focus(),requestAnimationFrame(()=>{t.setSelectionRange(0,t.value.length)}))},onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),c||o()},children:(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h&&s(p)},children:[(0,Q.jsx)(T.Header,{children:(0,Q.jsx)(T.Title,{children:e})}),(0,Q.jsx)(T.Body,{children:(0,Q.jsx)(w,{ref:u,label:`Name`,value:d,onChange:e=>f(e.target.value),placeholder:t,errorText:l??(m?`Enter a single file or folder name without slashes.`:void 0),autoComplete:`off`,spellCheck:!1,fullWidth:!0})}),(0,Q.jsxs)(T.Footer,{children:[(0,Q.jsx)(n,{type:`button`,variant:`outlined`,onClick:o,disabled:c,children:`Cancel`}),(0,Q.jsx)(n,{type:`submit`,variant:`primary`,disabled:!h,children:c?i:r})]})]})})})}function Ce({assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,onToggleExpand:l,onExpandPath:u,onSelectPath:d,onToggleShowHidden:f,onChangeSortMode:p,onPathDeleted:g,onPathRenamed:_}){let v=i(),[y,b]=(0,Z.useState)(``),x=y.trim().toLowerCase(),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(null),M=(0,Z.useCallback)(()=>{D(null),A(null)},[]),{data:N,isLoading:I}=a(ve({path:{assistant_id:e},query:{showHidden:s,includeDirSizes:c===`size`}})),L=(0,Z.useMemo)(()=>_e(N?.entries??[],c),[N?.entries,c]),R=(0,Z.useCallback)(()=>{for(let e of[`assistantsWorkspaceTreeRetrieve`,`assistantsWorkspaceFileRetrieve`,`assistantsWorkspaceFileContentRetrieve`])v.invalidateQueries({queryKey:[e]})},[v]),z=o({mutationFn:async t=>{let n=t.parentPath?`${t.parentPath}/${t.name}`:t.name;await ye(e,t.parentPath,t.name);let{error:r,response:i}=t.kind===`file`?await ee({path:{assistant_id:e},body:{path:n,content:``,encoding:`utf8`},throwOnError:!1}):await P({path:{assistant_id:e},body:{path:n},throwOnError:!1});if(r||!i?.ok)throw Error(typeof r==`string`?r:`Failed to create — check the name and try again.`);return{...t,path:n}},onSuccess:e=>{M(),R(),e.parentPath&&u(e.parentPath),e.kind===`file`?d(e.path):u(e.path)},onError:e=>{A(e instanceof Error?e.message:`Failed to create.`)}}),B=o({mutationFn:async t=>{let n=t.oldPath.lastIndexOf(`/`),r=n===-1?``:t.oldPath.slice(0,n),i=t.oldPath.slice(n+1),a=r?`${r}/${t.newName}`:t.newName;await ye(e,r,t.newName,i);let{error:o,response:s}=await F({path:{assistant_id:e},body:{oldPath:t.oldPath,newPath:a},throwOnError:!1});if(o||!s?.ok)throw Error(typeof o==`string`?o:`Failed to rename — check the name and try again.`);return{oldPath:t.oldPath,newPath:a}},onSuccess:({oldPath:e,newPath:t})=>{M(),R(),_(e,t)},onError:e=>{A(e instanceof Error?e.message:`Failed to rename.`)}}),V=(0,Z.useCallback)(e=>{A(null),D({type:`create`,...e})},[]),H=(0,Z.useCallback)(e=>{A(null),D({type:`rename`,path:e.path,name:e.name})},[]),[U,W]=(0,Z.useState)(null),G=o({mutationFn:async t=>{let{error:n,response:r}=await j({path:{assistant_id:e},body:{path:t.path},throwOnError:!1});if(n||!r?.ok)throw Error(typeof n==`string`?n:`Failed to delete — try again.`);return t},onSuccess:e=>{W(null),R(),g(e.path)}}),ne=(0,Z.useCallback)(e=>{G.reset(),W(e)},[G]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2.5`,style:{borderColor:`var(--border-element)`},children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-secondary)`},children:`Files`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:c===`size`?(0,Q.jsx)(ae,{"aria-hidden":!0}):(0,Q.jsx)(ie,{"aria-hidden":!0}),onClick:()=>p(c===`size`?`name`:`size`),"aria-label":c===`size`?`Sort by name`:`Sort by size`,title:c===`size`?`Sorted by size — switch to name`:`Sorted by name — switch to size`,tintColor:c===`size`?`var(--content-default)`:`var(--content-tertiary)`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:s?(0,Q.jsx)(h,{"aria-hidden":!0}):(0,Q.jsx)(m,{"aria-hidden":!0}),onClick:f,"aria-label":s?`Hide hidden files`:`Show hidden files`,title:s?`Hide hidden files`:`Show hidden files`,tintColor:s?`var(--content-default)`:`var(--content-tertiary)`}),(0,Q.jsx)(we,{open:C,onOpenChange:T,onSelectKind:e=>{T(!1),V({kind:e,parentPath:``})}})]})]}),(0,Q.jsx)(`div`,{className:`px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(w,{type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Search files`,leftIcon:(0,Q.jsx)(te,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,spellCheck:!1,autoComplete:`off`}),y&&(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(S,{"aria-hidden":!0}),onClick:()=>b(``),"aria-label":`Clear search`,className:`absolute right-1.5 top-1/2 -translate-y-1/2`,tintColor:`var(--content-tertiary)`})]})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:I?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`,style:{color:`var(--content-tertiary)`}})}):L.length?L.map(n=>(0,Q.jsx)(xe,{entry:n,assistantId:e,expandedPaths:t,selectedPath:r,showHidden:s,sortMode:c,searchLower:x,onToggleExpand:l,onSelectPath:d,onRequestDelete:ne,onRequestRename:H,onRequestCreate:V,depth:0},n.path)):(0,Q.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files found`})}),E?.type===`create`&&(0,Q.jsx)(Se,{title:E.kind===`file`?`New File`:`New Folder`,placeholder:E.kind===`file`?`filename.md`:`folder-name`,confirmLabel:`Create`,pendingLabel:`Creating…`,onCancel:M,onConfirm:e=>{A(null),z.mutate({kind:E.kind,parentPath:E.parentPath,name:e})},pending:z.isPending,error:k},`create-${E.kind}-${E.parentPath}`),E?.type===`rename`&&(0,Q.jsx)(Se,{title:`Rename`,placeholder:E.name,confirmLabel:`Rename`,pendingLabel:`Renaming…`,initialName:E.name,onCancel:M,onConfirm:e=>{if(e===E.name){M();return}A(null),B.mutate({oldPath:E.path,newName:e})},pending:B.isPending,error:k},`rename-${E.path}`),(0,Q.jsx)(O,{open:U!==null,title:U?.isDirectory?`Delete Folder`:`Delete File`,message:(0,Q.jsxs)(Q.Fragment,{children:[`Are you sure you want to delete`,` `,(0,Q.jsx)(`span`,{style:{color:`var(--content-default)`},children:U?.name}),U?.isDirectory?` and all of its contents`:``,`? This cannot be undone.`,G.error&&(0,Q.jsx)(`span`,{className:`mt-2 block`,style:{color:`var(--system-negative-strong)`},children:G.error.message})]}),confirmLabel:G.isPending?`Deleting…`:`Delete`,destructive:!0,isPending:G.isPending,onConfirm:()=>{U&&G.mutate(U)},onCancel:()=>W(null)})]})}function we({open:e,onOpenChange:t,onSelectKind:r}){return U()?(0,Q.jsxs)(E.Root,{open:e,onOpenChange:t,children:[(0,Q.jsx)(E.Trigger,{asChild:!0,children:(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(x,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Q.jsxs)(E.Content,{children:[(0,Q.jsx)(E.Header,{className:`sr-only`,children:(0,Q.jsx)(E.Title,{children:`Create new`})}),(0,Q.jsxs)(E.Body,{className:`pt-0`,children:[(0,Q.jsx)(D,{icon:z,label:`New File`,onSelect:()=>r(`file`)}),(0,Q.jsx)(D,{icon:X,label:`New Folder`,onSelect:()=>r(`folder`)})]})]})]}):(0,Q.jsxs)(f.Root,{open:e,onOpenChange:t,children:[(0,Q.jsx)(f.Trigger,{asChild:!0,children:(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(x,{"aria-hidden":!0}),"aria-label":`Create new file or folder`,title:`New file or folder`,tintColor:`var(--content-tertiary)`})}),(0,Q.jsxs)(f.Content,{align:`end`,sideOffset:4,children:[(0,Q.jsx)(f.Item,{leftIcon:(0,Q.jsx)(z,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`file`),children:`New File`}),(0,Q.jsx)(f.Item,{leftIcon:(0,Q.jsx)(X,{className:`h-3.5 w-3.5`}),onSelect:()=>r(`folder`),children:`New Folder`})]})]})}function Te(e){let t=e.split(`/`),n=new Set;for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`));return n}function Ee({assistantId:e}){let[t,n]=r(),[i,a]=(0,Z.useState)(()=>{let e=t.get(`file`);return e?Te(e):new Set}),[o,s]=(0,Z.useState)(()=>t.get(`file`)),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(()=>t.get(`sort`)===`size`?`size`:`name`),[f,p]=(0,Z.useState)(`preview`);(0,Z.useEffect)(()=>{t.get(`file`)&&n(e=>{let t=new URLSearchParams(e);return t.delete(`file`),t},{replace:!0})},[]);let m=(0,Z.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=(0,Z.useCallback)(e=>{a(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),[g,_]=(0,Z.useState)(!1),v=(0,Z.useCallback)(e=>{s(e),_(!1)},[]),[y,b]=(0,Z.useState)(null),x=(0,Z.useCallback)(e=>{let t=t=>t===e||t.startsWith(`${e}/`);s(e=>e!==null&&t(e)?null:e),a(e=>{let n=new Set([...e].filter(e=>!t(e)));return n.size===e.size?e:n}),b({path:e})},[]),[S,C]=(0,Z.useState)(null),w={assistantId:e,expandedPaths:i,selectedPath:o,showHidden:c,sortMode:u,onToggleExpand:m,onExpandPath:h,onSelectPath:v,onToggleShowHidden:()=>l(e=>!e),onChangeSortMode:d,onPathDeleted:x,onPathRenamed:(0,Z.useCallback)((e,t)=>{let n=n=>n===e?t:n.startsWith(`${e}/`)?t+n.slice(e.length):n;s(e=>e===null?e:n(e)),a(e=>{let t=!1,r=new Set;for(let i of e){let e=n(i);e!==i&&(t=!0),r.add(e)}return t?r:e}),C({from:e,to:t})},[])};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,Q.jsx)(G,{onClick:()=>_(!0)})}),(0,Q.jsx)(ne,{open:g,onClose:()=>_(!1),title:`Files`,children:(0,Q.jsx)(Ce,{...w})}),(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-4 sm:grid-cols-[320px_1fr]`,children:[(0,Q.jsx)(`div`,{className:`hidden min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border sm:flex`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Q.jsx)(Ce,{...w})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border`,style:{backgroundColor:`var(--surface-overlay)`,borderColor:`var(--border-base)`},children:(0,Q.jsx)(ge,{assistantId:e,selectedPath:o,showHidden:c,viewMode:f,onChangeViewMode:p,onBrowse:()=>_(!0),pathRename:S,pathDelete:y})})]})]})}function De(){return(0,Q.jsx)(Ee,{assistantId:W()})}export{De as WorkspacePage};
|
package/dist/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="apple-touch-icon" href="/assistant/favicon.svg" />
|
|
11
11
|
<title>Vellum Assistant</title>
|
|
12
12
|
<script src="/assistant/theme-init.js"></script>
|
|
13
|
-
<script type="module" crossorigin src="/assistant/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assistant/assets/index-CgcZXB4g.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assistant/assets/chunk-jRWAZmH_.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assistant/assets/preload-helper-BewR0kVT.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assistant/assets/is-electron-DBOtwp5h.js">
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{t as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./card-D8zyWtZh.js";import{t as c}from"./createLucideIcon-Bjb-Kuq7.js";import{t as l}from"./brain-CMiHVWFK.js";import{t as u}from"./chevron-left-B_RAz34t.js";import{t as d}from"./chevron-right-jRymmL7S.js";import{n as f}from"./animated-avatar-CyIeKE-s.js";import{t as p}from"./folder-open-9vQalGTM.js";import{t as m}from"./puzzle-CL8CuOcC.js";import{t as h}from"./sparkles-DDIsk_nZ.js";import"./src-CDdn26Yb.js";import{t as g}from"./tag-B6WeUtBW.js";import{t as _}from"./modal-BtcwNEBj.js";import{n as v}from"./toast-ZoZVyeDI.js";import{St as y,b,ht as x,ln as S,o as C}from"./react-query.gen-BQH0QRfT.js";import{t as w}from"./assistant-identity-store-bwxIa6fM.js";import{c as T}from"./routes-XPLb07Av.js";import{t as E}from"./assistant-feature-flag-store-BpbbAIKZ.js";import{t as D}from"./proxy-BzlH_XAe.js";import{t as O}from"./use-reduced-motion-CcGT6CHV.js";import{Ar as ee,At as k,Bi as A,Dn as j,Fi as M,Hi as te,Mr as ne,Nr as re,On as N,gt as ie,kn as P,kr as F,tn as I}from"./index-CmaRQR9x.js";import{t as L}from"./use-active-assistant-id-9rGx8kT9.js";import{t as R}from"./page-shell-DeTaZ_s4.js";import{a as z,i as B,n as ae,o as oe}from"./latest-assistant-text-DqYv-19M.js";import{a as se,n as ce,r as V,s as H,t as U}from"./use-assistant-identity-details-D0dDGwFZ.js";import{t as le}from"./plugins-surface-Db6GSyl4.js";import{t as W}from"./schedules-Baaz8ToC.js";var ue=c(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),de=c(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),G=e(t(),1),K=o();function q(e,t,n){return n===`forward`?(e+1)%t:(e-1+t)%t}function fe({open:e,onClose:t,assistantId:r,components:i,traits:a,customImageUrl:o,onSaveCharacter:s,onUploadImage:c,assistantName:l,onRenameSubmit:u,isRenaming:d=!1}){let p=(0,G.useRef)(null),[m,h]=(0,G.useState)(null),[g,v]=(0,G.useState)(!1),y=i??m,[b,x]=(0,G.useState)(0),[S,C]=(0,G.useState)(0),[w,T]=(0,G.useState)(0),[E,D]=(0,G.useState)(`character`),[O,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(!1),[P,F]=(0,G.useState)(l??``),I=O??o,L=!!I;(0,G.useEffect)(()=>{e&&F(l??``)},[e,l]);let R=(0,G.useRef)(!1);(0,G.useEffect)(()=>{e&&!R.current&&D(o?`custom`:`character`),R.current=e},[e,o]),(0,G.useEffect)(()=>{if(e)if(y&&a){let e=y.bodyShapes.findIndex(e=>e.id===a.bodyShape),t=y.eyeStyles.findIndex(e=>e.id===a.eyeStyle),n=y.colors.findIndex(e=>e.id===a.color);x(e>=0?e:0),C(t>=0?t:0),T(n>=0?n:0)}else x(0),C(0),T(0)},[e,y,a]),(0,G.useEffect)(()=>{if(!e||y||g)return;let t=!1;return v(!0),ee(r).then(e=>{t||(h(e),v(!1))}),()=>{t=!0}},[e,y,g,r]),(0,G.useEffect)(()=>{if(O)return()=>{URL.revokeObjectURL(O)}},[O]),(0,G.useEffect)(()=>{e||k(null)},[e]);let z=P.trim(),B=!!u&&z.length>0&&z!==(l??``),ae=(0,G.useCallback)(()=>{y&&(D(`character`),x(Math.floor(Math.random()*y.bodyShapes.length)),C(Math.floor(Math.random()*y.eyeStyles.length)),T(Math.floor(Math.random()*y.colors.length)))},[y]),oe=(0,G.useCallback)(()=>{p.current?.click()},[]),se=(0,G.useCallback)(async e=>{let t=e.target.files?.[0];if(!t)return;N(!0);let n=await re(r,t);N(!1),n&&(c(),k(URL.createObjectURL(t)),D(`custom`)),p.current&&(p.current.value=``)},[r,c]),ce=(0,G.useCallback)(async e=>{if(e.preventDefault(),!(A||d)){if(B&&u&&u(z),y&&E===`character`){let e={bodyShape:y.bodyShapes[b].id,eyeStyle:y.eyeStyles[S].id,color:y.colors[w].id};j(!0);try{await ne(r,e),k(null),s(e)}finally{j(!1)}}t()}},[A,d,B,u,z,y,E,b,S,w,r,s,t]),V=y?.bodyShapes[b],H=y?.eyeStyles[S],U=y?.colors[w],le=E===`custom`&&L,W=l!==void 0&&u?(0,K.jsx)(pe,{value:P,onChange:F,disabled:d}):null;return(0,K.jsx)(_.Root,{open:e,onOpenChange:e=>!e&&t(),children:(0,K.jsxs)(_.Content,{size:`sm`,children:[(0,K.jsx)(_.Header,{children:(0,K.jsx)(_.Title,{children:`Update Avatar`})}),(0,K.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:ce,children:[(0,K.jsx)(_.Body,{className:`space-y-4`,children:le?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsx)(`div`,{className:`rounded-2xl bg-[var(--surface-sunken)] p-6`,children:(0,K.jsx)(`img`,{src:I,alt:`Uploaded avatar`,className:`h-40 w-40 rounded-xl object-cover`})})}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[W,(0,K.jsx)(me,{label:`Use a character instead`,description:`Pick from our built-in avatars`,onClick:()=>D(`character`),thumbnail:y&&V&&H&&U?(0,K.jsx)(ie,{components:y,bodyShapeId:V.id,eyeStyleId:H.id,colorId:U.id,size:32}):(0,K.jsx)(f,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})]})]}):y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsx)(`div`,{className:`rounded-2xl bg-[var(--surface-sunken)] p-6`,children:(0,K.jsx)(ie,{components:y,bodyShapeId:V.id,eyeStyleId:H.id,colorId:U.id,size:160})})}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[W,(0,K.jsx)(J,{label:`Body`,value:V.id,onPrev:()=>x(q(b,y.bodyShapes.length,`backward`)),onNext:()=>x(q(b,y.bodyShapes.length,`forward`))}),(0,K.jsx)(J,{label:`Eyes`,value:H.id,onPrev:()=>C(q(S,y.eyeStyles.length,`backward`)),onNext:()=>C(q(S,y.eyeStyles.length,`forward`))}),(0,K.jsx)(J,{label:`Color`,value:U.id,colorHex:U.hex,onPrev:()=>T(q(w,y.colors.length,`backward`)),onNext:()=>T(q(w,y.colors.length,`forward`))})]}),L&&(0,K.jsx)(me,{label:`Keep your uploaded image`,description:`Saving the character replaces it`,onClick:()=>D(`custom`),thumbnail:(0,K.jsx)(`img`,{src:I,alt:``,className:`h-8 w-8 rounded-md object-cover`})})]}):(0,K.jsxs)(K.Fragment,{children:[W,g?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,K.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-element)] border-t-[var(--content-tertiary)]`})}):(0,K.jsx)(`div`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-quiet)]`,children:`Unable to load avatar components. Make sure your assistant is running.`})]})}),(0,K.jsxs)(_.Footer,{className:`justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(n,{type:`button`,variant:`outlined`,iconOnly:(0,K.jsx)(f,{}),"aria-label":`Randomize`,tooltip:`Randomize`,onClick:ae,disabled:!y}),(0,K.jsx)(n,{type:`button`,variant:`outlined`,iconOnly:(0,K.jsx)(te,{}),"aria-label":`Upload image`,tooltip:`Upload image`,onClick:oe,disabled:M})]}),(0,K.jsx)(n,{type:`submit`,variant:`primary`,disabled:A||d||M,children:A||d?`Saving…`:`Save`})]})]}),(0,K.jsx)(`input`,{ref:p,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,className:`hidden`,onChange:se})]})})}function pe({value:e,onChange:t,disabled:n}){return(0,K.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default uppercase tracking-wider text-[var(--content-quiet)]`,children:`Name`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`flex min-w-[80px] items-center justify-center`,children:(0,K.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),disabled:n,maxLength:40,size:8,placeholder:`Name`,"aria-label":`Name`,className:`h-7 min-w-0 field-sizing-content bg-transparent text-center text-body-medium-default text-[var(--content-strong)] outline-none placeholder:text-[var(--content-tertiary)] disabled:cursor-not-allowed disabled:opacity-60`})}),(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-7 shrink-0`})]})]})}function me({label:e,description:t,thumbnail:n,onClick:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full cursor-pointer items-center gap-3 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-3 py-2 text-left transition-colors hover:bg-[var(--surface-hover)]`,children:[(0,K.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-[var(--surface-sunken)]`,children:n}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-body-medium-default text-[var(--content-strong)]`,children:e}),(0,K.jsx)(`span`,{className:`block truncate text-body-small-default text-[var(--content-quiet)]`,children:t})]}),(0,K.jsx)(d,{className:`h-4 w-4 shrink-0 text-[var(--content-quiet)]`})]})}function J({label:e,value:t,colorHex:n,onPrev:r,onNext:i}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default uppercase tracking-wider text-[var(--content-quiet)]`,children:e}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Previous ${e.toLowerCase()}`,className:`flex h-7 w-7 cursor-pointer items-center justify-center rounded-md text-[var(--content-quiet)] transition-colors hover:bg-[var(--surface-active)]`,children:(0,K.jsx)(u,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`flex min-w-[80px] items-center justify-center gap-2`,children:[n&&(0,K.jsx)(`div`,{className:`h-4 w-4 rounded-full border border-[var(--border-element)]`,style:{backgroundColor:n}}),(0,K.jsx)(`span`,{className:`text-body-medium-default capitalize text-[var(--content-strong)]`,children:t})]}),(0,K.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Next ${e.toLowerCase()}`,className:`flex h-7 w-7 cursor-pointer items-center justify-center rounded-md text-[var(--content-quiet)] transition-colors hover:bg-[var(--surface-active)]`,children:(0,K.jsx)(d,{className:`h-4 w-4`})})]})]})}function he(e){let t=e.trim();return`<system-message>
|
|
2
|
-
The user renamed you: your name is now ${t}.
|
|
3
|
-
|
|
4
|
-
Update IDENTITY.md so its name line reads exactly \`- **Name:** ${t}\`. This is a rename only — keep everything else in IDENTITY.md and SOUL.md exactly as it is, and do not touch users/ (that is your user's profile, not your identity). If your name appears elsewhere in those files, update those mentions to ${t} too.
|
|
5
|
-
|
|
6
|
-
Reply with a single short sentence acknowledging your new name.
|
|
7
|
-
</system-message>`}async function ge(e,t){return V({assistantId:e,content:he(t),title:`Updating name`,context:`identity_overview_rename`})}var _e=6e4,ve=3,ye=3;function be(e,t,n){return e===1?t:n}function xe(e,{supportsPlugins:t,showChannels:n}){let r={assistant_id:e},i={staleTime:_e,retry:!1,enabled:!0},o=a({...y({path:r,query:{kind:`installed`}}),select:e=>e.skills.length,...i}),s=a({...k(e),select:e=>e.plugins.filter(e=>e.enabled).slice(0,ve).map(e=>e.name),enabled:t}),c=a({...S({path:r}),select:e=>e.entries.length,...i}),l=a({...b({path:r}),select:e=>e.contacts.length,...i}),u=a({...C({path:r}),select:e=>e.snapshots.filter(e=>e.ready).length,...i,enabled:n}),d=a({queryKey:x({path:r}),queryFn:()=>W(e),select:e=>{let t=e.filter(e=>e.enabled).sort((e,t)=>e.nextRunAt-t.nextRunAt);return{count:t.length,items:t.slice(0,ye).map(e=>({id:e.id,name:e.name,cadence:e.cadenceDescription,nextRunAt:e.nextRunAt}))}},...i}),f=a({queryKey:oe(e),queryFn:()=>z(e),...i});return{personality:{radar:f.data?B(f.data):void 0},skills:o.data===void 0?void 0:{value:o.data,label:`installed`},plugins:s.data===void 0?void 0:s.data.length>0?{chips:s.data}:{text:`None yet`},workspace:c.data===void 0?void 0:{value:c.data,label:be(c.data,`item`,`items`)},contacts:l.data===void 0?void 0:{value:l.data,label:be(l.data,`person`,`people`)},channels:u.data===void 0?void 0:{value:u.data,label:`connected`},schedules:d.data===void 0?void 0:d.data.count===0?{text:`Nothing scheduled yet`}:{value:d.data.count,label:`active`,schedules:{items:d.data.items,more:d.data.count-d.data.items.length}}}}var Y=96,X=150,Se=36,Ce=46,we=58,Te=(e,t,n)=>Math.max(t,Math.min(n,e));function Ee(e,t,n){let r=Te(n.x-e.left,Y,e.width-Y),i=Te(n.y-e.top,Y,e.height-Y);return{rect:e,facing:t,peek:t===`top`?{x:r,y:0}:t===`bottom`?{x:r,y:e.height}:t===`left`?{x:0,y:i}:{x:e.width,y:i}}}var De={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},Oe={type:`spring`,stiffness:150,damping:19},ke=.22,Ae=.15;function je({hex:e,components:t,traits:n,target:r}){let i=r!==null,[a,o]=(0,G.useState)(null);r&&r!==a&&o(r);let s=r??a,[c,l]=(0,G.useState)(!1);(0,G.useEffect)(()=>{let e=!1,t,n=()=>{t=setTimeout(()=>{e||(l(!0),t=setTimeout(()=>{e||(l(!1),n())},140))},2500+Math.random()*4e3)};return n(),()=>{e=!0,clearTimeout(t)}},[]);let u=(0,G.useMemo)(()=>{let e=t.eyeStyles.find(e=>e.id===n.eyeStyle);return e?{paths:e.paths,bbox:N(e.paths.map(e=>j(e.svgPath)))}:null},[t,n.eyeStyle]);if(!u||!s)return null;let{rect:d,facing:f,peek:p}=s,m={x:d.left+p.x,y:d.top+p.y},h=De[f],g=u.bbox.h/u.bbox.w,_=we,v=_*g,y={x:m.x+h.x*Se,y:m.y+h.y*Se},b={x:-h.x*Ce,y:-h.y*Ce},x=u.bbox.x+u.bbox.w/2,S=u.bbox.y+u.bbox.h/2,C=i?{...Oe,delay:ke,opacity:{duration:.15,delay:ke}}:{duration:Ae};return(0,K.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-0`,children:[(0,K.jsx)(D.div,{className:`absolute top-0 left-0 rounded-full`,style:{backgroundColor:e,width:X,height:X},initial:!1,animate:{x:m.x-X/2+(i?0:b.x),y:m.y-X/2+(i?0:b.y),opacity:+!!i},transition:C}),(0,K.jsx)(D.div,{className:`absolute top-0 left-0`,initial:!1,animate:{x:y.x-_/2+(i?0:b.x),y:y.y-v/2+(i?0:b.y),width:_,height:v,opacity:+!!i},transition:C,children:(0,K.jsx)(`svg`,{viewBox:`${u.bbox.x} ${u.bbox.y} ${u.bbox.w} ${u.bbox.h}`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid meet`,style:{overflow:`visible`,display:`block`},children:(0,K.jsx)(`g`,{style:{transform:c?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${x}px ${S}px`,transition:`transform 0.14s ease-in-out`},children:u.paths.map((e,t)=>(0,K.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})]})}var Me=65,Ne=26;function Pe(e,t){let n=O(),[r,i]=(0,G.useState)(n?e.length:0);return(0,G.useEffect)(()=>{if(n){i(e.length);return}i(0);let r=setInterval(()=>{i(t=>t>=e.length?(clearInterval(r),t):t+1)},t);return()=>clearInterval(r)},[e,t,n]),{typed:e.slice(0,r),typing:r<e.length}}function Fe({name:e,isRenaming:t,overrideText:n=null}){let r=n??`Hi, I’m ${e}`,{typed:i,typing:a}=Pe(r,n?Ne:Me);return(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,K.jsxs)(`h1`,{"aria-label":r,className:`relative leading-none whitespace-nowrap text-[var(--content-strong)] ${n?`text-[2.1rem] max-sm:text-[1.4rem]`:`text-[3.25rem] max-sm:text-[2rem]`}`,style:{fontFamily:`var(--font-serif)`},children:[(0,K.jsx)(`span`,{className:`invisible`,"aria-hidden":`true`,children:r}),(0,K.jsxs)(`span`,{className:`absolute inset-0`,"aria-hidden":`true`,children:[i,a&&(0,K.jsx)(`span`,{className:`animate-pulse`,children:`▎`})]})]}),!n&&t&&(0,K.jsx)(`div`,{"aria-label":`Renaming in progress`,className:`h-5 w-5 shrink-0 animate-spin rounded-full border-2 border-[var(--border-base)]`,style:{borderTopColor:`var(--content-default)`}})]})}function Ie({supportsPlugins:e,showChannels:t,showMemory:n}){let r=[{key:`personality`,label:`Personality`,description:`Tune how I talk`,to:T.personality},{key:`schedules`,label:`Schedules`,description:`My routines`,to:T.schedules.root},{key:`skills`,label:`Skills`,description:`What I can do`,to:T.skills.root}];return n&&r.push({key:`memory`,label:`Memory`,description:`What I remember`,to:T.memory}),e&&r.push({key:`plugins`,label:`Plugins`,description:`My add-ons`,to:T.plugins}),r.push({key:`workspace`,label:`Workspace`,description:`My files`,to:T.workspace},{key:`contacts`,label:`Contacts`,description:`People I know`,to:T.contacts.root}),t&&r.push({key:`channels`,label:`Channels`,description:`Where I listen`,to:T.channels}),r}var Z=[{label:`Coworker`,sub:`vs. companion`,value:e=>Q(e,`companion-coworker`)},{label:`Baby Boomer`,sub:`vs. Gen Z`,value:e=>Q(e,`genz-boomer`)},{label:`Collaborative`,sub:`vs. independent`,value:e=>Q(e,`execute-collaborate`)},{label:`Serious`,sub:`vs. playful`,value:e=>Q(e,`playful-serious`)},{label:`Unfiltered`,sub:`vs. polite`,value:e=>Q(e,`polite-unfiltered`)}];function Q(e,t){let n=e[t]??se;return Math.max(0,Math.min(100,n))}var Le=356,Re=246,ze=Le/2,Be=132,$=100,Ve=.1,He=[.25,.5,.75,1],Ue=[{anchor:`middle`,dx:0,dy:-18},{anchor:`start`,dx:9,dy:-2},{anchor:`start`,dx:-10,dy:17},{anchor:`end`,dx:10,dy:17},{anchor:`end`,dx:-9,dy:-2}];function We(e,t){let n=-Math.PI/2+e*2*Math.PI/Z.length;return{x:ze+t*Math.cos(n),y:Be+t*Math.sin(n)}}function Ge(e){return Z.map((t,n)=>{let r=We(n,e(n));return`${r.x.toFixed(1)},${r.y.toFixed(1)}`}).join(` `)}function Ke({values:e,className:t}){let n=Z.map(t=>`${t.label} ${Math.round(t.value(e))}`).join(`, `);return(0,K.jsxs)(`svg`,{viewBox:`0 0 ${Le} ${Re}`,role:`img`,"aria-label":`Personality: ${n}`,className:t,children:[He.map(e=>(0,K.jsx)(`polygon`,{points:Ge(()=>$*e),fill:`none`,stroke:`currentColor`,strokeOpacity:.25,strokeWidth:1,strokeLinejoin:`round`},e)),Z.map((e,t)=>{let n=We(t,$);return(0,K.jsx)(`line`,{x1:ze,y1:Be,x2:n.x,y2:n.y,stroke:`currentColor`,strokeOpacity:.25,strokeWidth:1},t)}),(0,K.jsx)(D.g,{initial:{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{type:`spring`,stiffness:140,damping:16},style:{transformOrigin:`${ze}px ${Be}px`},children:(0,K.jsx)(`polygon`,{points:Ge(t=>$*Math.max(Ve,Z[t].value(e)/100)),fill:`var(--card-accent)`,fillOpacity:.25,stroke:`var(--card-accent)`,strokeWidth:2,strokeLinejoin:`round`})}),Z.map((e,t)=>{let n=Ue[t],r=We(t,$),i=r.x+n.dx;return(0,K.jsxs)(`text`,{x:i,y:r.y+n.dy,textAnchor:n.anchor,children:[(0,K.jsx)(`tspan`,{x:i,fontSize:11.5,fontWeight:500,fill:`currentColor`,children:e.label}),(0,K.jsx)(`tspan`,{x:i,dy:12.5,fontSize:10,fill:`currentColor`,fillOpacity:.8,children:e.sub})]},e.label)})]})}var qe={personality:h,schedules:ue,skills:M,memory:l,plugins:m,workspace:p,contacts:A,channels:de},Je={personality:`rounded-3xl`,schedules:`rounded-3xl`,skills:`rounded-[1.25rem_2.75rem_1.25rem_2.5rem]`,channels:`rounded-[2.25rem_1rem_2.5rem_1.25rem]`,contacts:`rounded-[1rem_2.5rem_1.25rem_2.75rem]`,plugins:`rounded-[2.5rem_1.25rem_2.75rem_1rem]`,workspace:`rounded-[1.25rem_2.5rem_1rem_2.5rem]`},Ye=720,Xe=480,Ze=[`skills`,`memory`,`plugins`,`workspace`,`contacts`,`channels`],Qe={personality:`Go ahead — tweak my soul`,skills:`Everything I know how to do`,memory:`Everything I remember`,plugins:`My add-ons — extra superpowers`,schedules:`What I do on repeat`,workspace:`All the files that power me`,contacts:`The people I know and trust`,channels:`All the places you can reach me`};function $e(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}var et=280,tt=140,nt=.44,rt=1118,it=300,at=.09,ot=14,st=5,ct=22;function lt({assistantId:e}){let t=i(),{components:n,traits:r,customImageUrl:a,isLoading:o,invalidate:s}=F(e),c=ce(e),l=le(),u=E.use.channelTrustFloors(),d=E.use.memoryConceptGraph(),f=xe(e,{supportsPlugins:l,showChannels:u}),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),_=(0,G.useCallback)(n=>{g(!0),ge(e,n).then(r=>{if(g(!1),r){t.invalidateQueries({queryKey:U(e)});let{version:r,setIdentity:i}=w.getState();i(n,r),v.success(`Say hi to ${n}!`)}else v.error(`The rename didn't go through. Please try again.`)})},[e,t]),y=(0,G.useCallback)(()=>{s()},[s]),b=Ie({supportsPlugins:l,showChannels:u,showMemory:d}),x=o||c.isLoading,S=H(n,r);return(0,K.jsxs)(R,{style:S?{backgroundColor:`color-mix(in srgb, ${S} ${ot}%, var(--surface-overlay))`}:void 0,children:[x?(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,K.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2`,style:{borderColor:`var(--border-base)`,borderTopColor:`var(--content-tertiary)`}})}):(0,K.jsx)(ft,{components:n,traits:r,customImageUrl:a,name:c.data?.identity?.name||`Assistant`,sections:b,stats:f,avatarHex:S,isRenaming:h,onOpenAvatarModal:()=>m(!0)}),(0,K.jsx)(fe,{open:p,onClose:()=>m(!1),assistantId:e,components:n,traits:r,customImageUrl:a,onSaveCharacter:y,onUploadImage:y,assistantName:c.data?.identity?.name||`Assistant`,onRenameSubmit:_,isRenaming:h})]})}function ut({section:e,stat:t,gridArea:n,cardStyle:i,hoverFill:a,mini:o,stacked:c,flooded:l=!1,floodOrigin:u,linkRef:d,onHoverChange:f}){let p=qe[e.key]??h,[m,_]=(0,G.useState)({x:50,y:100});u&&u!==m&&_(u);let v=l?`text-[var(--card-flood-fg)]`:`text-[var(--content-default)]`,y=l?`text-[var(--card-flood-fg)]`:`text-[var(--content-strong)]`,b=l?`text-[var(--card-flood-fg)] opacity-75`:`text-[var(--content-secondary)]`,x=(0,K.jsx)(D.span,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{backgroundColor:`var(--card-accent)`},initial:!1,animate:{clipPath:l?`circle(141% at ${m.x}% ${m.y}%)`:`circle(0% at ${m.x}% ${m.y}%)`},transition:l?{duration:.5,ease:`easeOut`}:{duration:.35,ease:`easeIn`}});if(c){let n=t?.value===void 0?t?.chips&&t.chips.length>0?t.chips.join(` · `):t?.text:`${t.value} ${t.label??``}`.trim();return(0,K.jsx)(s.Root,{asChild:!0,bordered:!0,elevated:!0,clipContents:!0,className:`rounded-2xl bg-[var(--card-bg)]`,children:(0,K.jsxs)(r,{to:e.to,className:`relative flex h-full w-full cursor-pointer flex-col gap-1 p-4 text-left transition-all duration-150 hover:bg-[var(--card-hover)] active:scale-[0.98]`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(p,{className:`h-5 w-5 shrink-0 text-[var(--content-default)]`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e.label})]}),(0,K.jsx)(`span`,{className:`text-[13px] text-[var(--content-secondary)]`,children:e.description}),n&&(0,K.jsx)(`span`,{className:`mt-auto truncate pt-1 text-[12px] font-medium text-[var(--content-tertiary)]`,children:n})]})})}if(o){let n=t?.value===void 0?t?.chips&&t.chips.length>0?t.chips.join(` · `):t?.text:`${t.value} ${t.label}`;return(0,K.jsx)(s.Root,{asChild:!0,elevated:!0,clipContents:!0,className:`rounded-[12px] bg-[var(--card-bg)]`,children:(0,K.jsxs)(r,{to:e.to,ref:d,onMouseEnter:()=>f?.(!0),onMouseLeave:()=>f?.(!1),className:`relative flex h-full flex-1 cursor-pointer items-center gap-2 px-4 py-2.5 transition-all duration-150 active:scale-[0.98] ${a?`hover:bg-[var(--card-hover)]`:``}`,children:[x,(0,K.jsx)(`span`,{className:`relative flex h-10 w-10 shrink-0 items-center justify-center`,children:(0,K.jsx)(p,{className:`h-5 w-5 transition-colors duration-300 ${b}`,"aria-hidden":!0})}),(0,K.jsxs)(`span`,{className:`relative flex min-w-0 flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`truncate text-title-small leading-normal transition-colors duration-300 ${y}`,children:e.label}),n&&(0,K.jsx)(`span`,{className:`truncate text-[11px] leading-normal font-medium transition-colors duration-300 ${l?`text-[var(--card-flood-fg)] opacity-75`:`text-[var(--content-tertiary)]`}`,children:n})]})]})})}let S=e.key===`personality`||e.key===`schedules`;return(0,K.jsx)(s.Root,{asChild:!0,bordered:!S,elevated:!S,className:`${Je[e.key]??``} ${S?`bg-[var(--card-feature-bg,var(--card-bg))]`:`bg-[var(--card-bg)]`}`,style:{...n?{gridArea:n}:{},...i},children:(0,K.jsxs)(r,{to:e.to,ref:d,onMouseEnter:()=>f?.(!0),onMouseLeave:()=>f?.(!1),className:`relative flex h-full w-full cursor-pointer flex-col justify-between gap-3 overflow-hidden p-5 text-left transition-all duration-150 active:scale-[0.98] ${a?`hover:bg-[var(--card-hover)]`:``}`,children:[x,n&&t?.radar&&(0,K.jsx)(`span`,{className:`absolute inset-x-5 top-14 bottom-4 flex items-center justify-center transition-colors duration-300 ${l?`text-[var(--card-flood-fg)]`:`text-[var(--content-secondary)]`}`,style:l?{"--card-accent":`var(--card-flood-fg)`}:void 0,children:(0,K.jsx)(Ke,{values:t.radar,className:`h-auto w-full`})}),S?(0,K.jsxs)(`span`,{className:`relative flex items-center gap-2`,children:[(0,K.jsx)(p,{className:`h-5 w-5 transition-colors duration-300 ${v}`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`text-body-medium-default transition-colors duration-300 ${v}`,children:e.label})]}):(0,K.jsxs)(`span`,{className:`relative flex flex-col items-start gap-1.5`,children:[(0,K.jsx)(p,{className:`h-6 w-6 transition-colors duration-300 ${v}`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default transition-colors duration-300 ${v}`,children:e.label}),(0,K.jsx)(`span`,{className:`text-[13px] transition-colors duration-300 ${b}`,children:e.description})]})]}),n&&t?.schedules&&t.schedules.items.length>0&&(0,K.jsxs)(`span`,{className:`relative flex min-h-0 flex-1 flex-col justify-start gap-2 overflow-hidden py-2`,children:[t.schedules.items.map(e=>(0,K.jsxs)(`span`,{className:`flex flex-col gap-0.5 rounded-xl px-3 py-2 transition-colors duration-300`,style:{backgroundColor:l?`color-mix(in srgb, var(--card-flood-fg) 12%, transparent)`:`color-mix(in srgb, var(--content-default) 5%, transparent)`},children:[(0,K.jsx)(`span`,{className:`truncate text-[13px] font-medium transition-colors duration-300 ${v}`,children:e.name}),(0,K.jsxs)(`span`,{className:`truncate text-[12px] transition-colors duration-300 ${b}`,children:[e.cadence,` · next `,$e(e.nextRunAt)]})]},e.id)),t.schedules.more>0&&(0,K.jsxs)(`span`,{className:`text-[12px] font-medium transition-colors duration-300 ${b}`,children:[`View `,t.schedules.more,` more…`]})]}),t?.value===void 0?t?.chips&&t.chips.length>0?(0,K.jsx)(`span`,{className:`relative flex flex-wrap items-center gap-1`,children:t.chips.map(e=>(0,K.jsx)(g,{children:e},e))}):t?.text?(0,K.jsx)(`span`,{className:`relative text-[14px] font-medium italic transition-colors duration-300 ${v}`,children:t.text}):null:(0,K.jsxs)(`span`,{className:`relative flex flex-col leading-none`,children:[(0,K.jsx)(`span`,{className:`text-[3.25rem] transition-colors duration-300 max-lg:text-[2.5rem] ${y}`,style:{fontFamily:`var(--font-serif)`},children:t.value}),(0,K.jsx)(`span`,{className:`mt-1 text-[13px] transition-colors duration-300 ${b}`,children:t.label})]})]})})}function dt({components:e,traits:t,customImageUrl:n,name:r,avatarSize:i,isRenaming:a,onEdit:o}){return(0,K.jsxs)(`div`,{className:`relative z-[1] flex flex-col items-center justify-center gap-5`,children:[(0,K.jsx)(Fe,{name:r,isRenaming:a}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`Update avatar and name`,title:`Update avatar and name`,onClick:o,className:`avatar-edit-cursor outline-none keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:n&&!t?(0,K.jsx)(`img`,{src:n,alt:``,width:i,height:i,className:`rounded-full object-cover`,style:{width:i,height:i}}):(0,K.jsx)(I,{components:e,traits:t,customImageUrl:n,size:i,interactive:!0})})]})}function ft({components:e,traits:t,customImageUrl:n,name:r,sections:i,stats:a,avatarHex:o,isRenaming:s,onOpenAvatarModal:c}){let{ref:l,size:u}=ae(),d=O(),f=u.w>=Ye&&u.h>=Xe,p=Math.round(Math.min(et,Math.max(tt,Math.min(u.w,u.h)*.32))),m=!!(o&&e&&t),h=f&&!d&&m,g=(0,G.useRef)(null),_=(0,G.useRef)({}),[v,y]=(0,G.useState)(null),b=(0,G.useCallback)(e=>{g.current=e,l(e)},[l]),x=(0,G.useCallback)((e,t)=>{if(!h)return;if(!t){y(null);return}let n=g.current,r=_.current[e];if(!n||!r)return;let i=n.getBoundingClientRect(),a=r.getBoundingClientRect(),o={left:a.left-i.left,top:a.top-i.top,width:a.width,height:a.height},s=(o.left+o.width/2-i.width/2)/(i.width/2),c=(o.top+o.height/2-i.height/2)/(i.height/2),l=Ee(o,Math.abs(s)>Math.abs(c)?s<0?`right`:`left`:c<0?`bottom`:`top`,{x:i.width/2,y:i.height/2});y({key:e,target:l,origin:{x:l.peek.x/o.width*100,y:l.peek.y/o.height*100}})},[h]),S=h?v:null,C=S?Qe[S.key]??null:null,w={"--card-bg":o?`color-mix(in srgb, ${o} var(--card-tint-pct, ${st}%), var(--card-surface, var(--surface-lift)))`:`var(--surface-lift)`,"--card-feature-bg":o?`color-mix(in srgb, var(--card-accent) 28%, var(--card-surface, var(--surface-lift)))`:`var(--surface-lift)`,"--card-hover":o?`color-mix(in srgb, ${o} ${ct}%, var(--card-surface, var(--surface-lift)))`:`var(--surface-hover)`,"--card-accent":o??`var(--content-default)`,"--card-flood-fg":o?P(o):`var(--content-default)`},T=(u.h-8)/(1-at),E=Math.round(Math.min(rt,T,Math.max(it,u.w*nt))),ee=Math.round(E*at),k=(0,K.jsx)(dt,{components:e,traits:t,customImageUrl:n,name:r,avatarSize:p,isRenaming:s,onEdit:c});if(!f)return(0,K.jsxs)(`div`,{ref:b,className:`identity-bento flex min-h-0 flex-1 flex-col items-center gap-6 overflow-y-auto px-2 py-4`,style:w,children:[k,(0,K.jsx)(`div`,{className:`grid w-full max-w-md shrink-0 grid-cols-2 gap-3`,children:i.map(e=>(0,K.jsx)(ut,{section:e,stat:a[e.key],hoverFill:!0,stacked:!0},e.key))})]});let A=i.filter(e=>!Ze.includes(e.key)),j=i.filter(e=>Ze.includes(e.key)),M=[1.15,1,.45,.3],te=(u.h-(M.length-1)*12)/M.reduce((e,t)=>e+t,0),ne=Math.round(te*M[0]),re=(m?[`"personality greeting greeting greeting schedules"`,`". . . . schedules"`,`". . . . ."`,`"smalls smalls smalls smalls smalls"`]:[`"personality greeting greeting greeting schedules"`,`". avatar avatar avatar schedules"`,`". avatar avatar avatar ."`,`"smalls smalls smalls smalls smalls"`]).join(` `),N=e=>({section:e,stat:a[e.key],hoverFill:!h,flooded:S?.key===e.key,floodOrigin:S?.key===e.key?S.origin:void 0,linkRef:t=>{_.current[e.key]=t},onHoverChange:t=>x(e.key,t)});return(0,K.jsxs)(`div`,{ref:b,className:`identity-bento relative grid min-h-0 flex-1 gap-3 overflow-hidden`,style:{...w,gridTemplateColumns:`1.55fr 1fr 1fr 1fr 1.55fr`,gridTemplateRows:M.map(e=>`${e}fr`).join(` `),gridTemplateAreas:re},children:[m?(0,K.jsx)(D.div,{className:`pointer-events-none absolute left-1/2 z-0`,style:{width:E,height:E,bottom:-ee,x:`-50%`},initial:!1,animate:S?{scale:.4,opacity:0}:{scale:1,opacity:1},transition:S?{duration:.15}:{delay:.25,type:`spring`,stiffness:210,damping:18},children:(0,K.jsx)(`div`,{role:`button`,tabIndex:0,"aria-label":`Update avatar and name`,title:`Update avatar and name`,onClick:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},className:`avatar-edit-cursor pointer-events-auto relative h-full w-full outline-none keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,K.jsx)(I,{components:e,traits:t,customImageUrl:n,size:E,interactive:!0})})}):(0,K.jsx)(`div`,{className:`relative z-[1] flex items-start justify-center`,style:{gridArea:`avatar`},children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Update avatar and name`,title:`Update avatar and name`,onClick:c,className:`avatar-edit-cursor rounded-full outline-none keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:n?(0,K.jsx)(`img`,{src:n,alt:``,width:p,height:p,className:`rounded-full object-cover`,style:{width:p,height:p}}):(0,K.jsx)(I,{components:e,traits:t,customImageUrl:null,size:p})})}),(0,K.jsx)(`div`,{className:`relative z-[1] flex items-center justify-center`,style:{gridArea:`greeting`},children:(0,K.jsx)(Fe,{name:r,isRenaming:s,overrideText:C})}),h&&o&&e&&t&&(0,K.jsx)(je,{hex:o,components:e,traits:t,target:S?.target??null}),A.map(e=>(0,K.jsx)(ut,{...N(e),gridArea:e.key,cardStyle:e.key===`schedules`?{alignSelf:`start`,height:`auto`,minHeight:ne}:void 0},e.key)),(0,K.jsx)(`div`,{className:`flex min-h-0 items-stretch gap-3`,style:{gridArea:`smalls`},children:j.map(e=>(0,K.jsx)(ut,{...N(e),mini:!0},e.key))})]})}function pt(){return(0,K.jsx)(lt,{assistantId:L()})}function mt(){return(0,K.jsx)(pt,{},L())}export{mt as IdentityPageRoute};
|