vibelet 1.2.230 → 1.2.231

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/inventory-scan-worker.cjs +1 -1
  3. package/dist/runtime-version.cjs +1 -1
  4. package/dist/vibelet.mjs +123 -98
  5. package/dist/web/assets/App-BbkHX6Hv.css +1 -0
  6. package/dist/web/assets/App-TtlYNy7O.js +20 -0
  7. package/dist/web/assets/{BrowserControlPanel-BTBKDi0n.js → BrowserControlPanel-DzDyeCam.js} +1 -1
  8. package/dist/web/assets/{ChipGroup-ImS6VTKx.js → ChipGroup-Do4YgaVh.js} +1 -1
  9. package/dist/web/assets/FilesControlPanel-Dy08iN_7.js +1 -0
  10. package/dist/web/assets/{GlobalPendingDialog-BCLMQc_r.js → GlobalPendingDialog-BokEX_Go.js} +1 -1
  11. package/dist/web/assets/{ImageViewer-BvBKQ6wE.js → ImageViewer-BAycGfGo.js} +1 -1
  12. package/dist/web/assets/{LanguageSettingsPanel-DTDvB4l2.js → LanguageSettingsPanel-db264JO3.js} +1 -1
  13. package/dist/web/assets/NewSessionDialog-BTZlw3Gl.js +1 -0
  14. package/dist/web/assets/{NotificationSettingsPanel-BS01O3sC.js → NotificationSettingsPanel-BYr3-NRw.js} +1 -1
  15. package/dist/web/assets/{TerminalControlPanel-B7S_ebVy.js → TerminalControlPanel-16KT-TCS.js} +1 -1
  16. package/dist/web/assets/{ThemeSettingsPanel-DVaJ6nGu.js → ThemeSettingsPanel-D3-WUp4t.js} +1 -1
  17. package/dist/web/assets/{arrow-right-ORILUMdJ.js → arrow-right-mMC7Zi8G.js} +1 -1
  18. package/dist/web/assets/{collectMessageImages-lfAaZW_Y.js → collectMessageImages-F_MsAk3D.js} +2 -2
  19. package/dist/web/assets/{file-editor-FileCodeEditor-ZAqN9Q2f.js → file-editor-FileCodeEditor-CInvSSQe.js} +3 -3
  20. package/dist/web/assets/{file-editor-MarkdownLivePreview-DXTFwUnj.js → file-editor-MarkdownLivePreview-CRJo_RMu.js} +1 -1
  21. package/dist/web/assets/{file-editor-index-Dj3dV82Z.js → file-editor-index-Cbe_0mr3.js} +1 -1
  22. package/dist/web/assets/{file-editor-index-C4S-qKVH.js → file-editor-index-DXLgqR7Z.js} +1 -1
  23. package/dist/web/assets/{file-editor-index-DKQvp2Qx.js → file-editor-index-Gu3GlV9m.js} +1 -1
  24. package/dist/web/assets/{file-editor-index-Dc2gxJQY.js → file-editor-index-R2lTkg6K.js} +1 -1
  25. package/dist/web/assets/{file-editor-index-Byun61j6.js → file-editor-index-VN_2L1I4.js} +1 -1
  26. package/dist/web/assets/{file-editor-index-BC0Bqs8t.js → file-editor-index-awBV_67q.js} +1 -1
  27. package/dist/web/assets/{file-editor-index-Bo2dEHVF.js → file-editor-index-hdpS6VVW.js} +1 -1
  28. package/dist/web/assets/{file-editor-index-BBHGMD89.js → file-editor-index-ixbyM_m4.js} +1 -1
  29. package/dist/web/assets/{folder-plus-DHw5YJHP.js → folder-plus-DbDHVXck.js} +1 -1
  30. package/dist/web/assets/{highlighted-body-TPN3WLV5-DDb5MlJt.js → highlighted-body-TPN3WLV5-F1GioA6X.js} +1 -1
  31. package/dist/web/assets/{index-ConcKf33.js → index-DJLpIsPI.js} +9 -9
  32. package/dist/web/assets/{index-Be6TVbvo.css → index-XET9GutV.css} +1 -1
  33. package/dist/web/assets/{mermaid-O7DHMXV3-D-5FgaAx.js → mermaid-O7DHMXV3-H7_sz6Xo.js} +3 -3
  34. package/dist/web/index.html +2 -2
  35. package/package.json +1 -1
  36. package/dist/web/assets/App-94_jdzMk.css +0 -1
  37. package/dist/web/assets/App-CapuoJH2.js +0 -18
  38. package/dist/web/assets/DiffDrawer-sMBIj4bW.js +0 -2
  39. package/dist/web/assets/FilesControlPanel-4hHS85Mr.js +0 -1
  40. package/dist/web/assets/NewSessionDialog-LttGZHY7.js +0 -1
@@ -1,2 +0,0 @@
1
- import{r as a,j as e,u as B}from"./index-ConcKf33.js";import{p as M,l as O,b as _,A as U,X as V,c as z}from"./App-CapuoJH2.js";function H(f){let c=0,n=0;return f.split(`
2
- `).map(i=>{const t=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(i);return t?(c=Number(t[1]),n=Number(t[2]),{text:i,kind:"hunk",oldLine:"",newLine:"",sign:""}):i.startsWith("diff ")||i.startsWith("index ")||i.startsWith("---")||i.startsWith("+++")||!c&&!n?{text:i,kind:"header",oldLine:"",newLine:"",sign:""}:i.startsWith("+")?{text:i.slice(1),kind:"add",oldLine:"",newLine:String(n++),sign:"+"}:i.startsWith("-")?{text:i.slice(1),kind:"del",oldLine:String(c++),newLine:"",sign:"−"}:i.startsWith(" ")?{text:i.slice(1),kind:"ctx",oldLine:String(c++),newLine:String(n++),sign:""}:{text:i,kind:"header",oldLine:"",newLine:"",sign:""}})}function J({patch:f,truncated:c,truncatedLabel:n,loadingLabel:i}){const t=a.useMemo(()=>H(f),[f]),[h,p]=a.useState(400),j=a.useRef(null);return a.useEffect(()=>{p(400)},[f]),a.useEffect(()=>{const r=j.current;if(!r)return;const u=new IntersectionObserver(x=>{x.some(o=>o.isIntersecting)&&p(o=>o+400)},{root:r.closest(".diff-patch"),rootMargin:"200px"});return u.observe(r),()=>u.disconnect()},[h,t.length]),e.jsxs("div",{className:"diff-patch-view",children:[t.slice(0,h).map((r,u)=>e.jsxs("div",{className:`diff-line ${r.kind}`,children:[e.jsx("span",{className:"diff-line-number","aria-hidden":"true",children:r.oldLine}),e.jsx("span",{className:"diff-line-number","aria-hidden":"true",children:r.newLine}),e.jsx("span",{className:"diff-line-sign","aria-hidden":"true",children:r.sign}),e.jsx("span",{className:"diff-line-text",children:r.text||" "})]},u)),h<t.length&&e.jsx("div",{ref:j,className:"diff-more",role:"status",children:i}),c&&e.jsx("p",{className:"diff-empty",children:n})]})}function K(f){const c=a.useRef(void 0);return a.useEffect(()=>()=>c.current?.(),[]),{"data-dock-draggable":!!f,onPointerDown:n=>{if(!f||n.button!==0||n.target.closest("button"))return;c.current?.();const i=n.currentTarget,t={x:n.clientX,y:n.clientY},h=document.querySelector(".workspace-documents");if(!h)return;let p=!1;const j=(o,w)=>{const N=h.getBoundingClientRect();return o>=N.left&&o<=N.right&&w>=N.top&&w<=N.bottom},r=o=>{Math.hypot(o.clientX-t.x,o.clientY-t.y)<6&&!p||(p=!0,document.body.classList.add("dock-dragging"),h.classList.toggle("dock-drop-target",j(o.clientX,o.clientY)))},u=()=>{document.body.classList.remove("dock-dragging"),h.classList.remove("dock-drop-target"),window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",u),i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId),c.current=void 0},x=o=>{const w=p&&j(o.clientX,o.clientY);u(),w&&f()};c.current=u,i.setPointerCapture(n.pointerId),window.addEventListener("pointermove",r),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",u),n.preventDefault()}}}const R={loading:!1,files:null,error:null};function ee({client:f,sessionId:c,cwd:n,sessionTitle:i,t,onClose:h,onDock:p,dockLabel:j,presentation:r="drawer",initialScope:u="unstaged",initialPath:x}){const o=a.useId(),w=a.useRef(null),[N,X]=a.useState(!1),C=a.useRef(void 0),P=a.useCallback(()=>{if(C.current===void 0){if(r==="workspace"||window.matchMedia("(prefers-reduced-motion: reduce)").matches){h();return}X(!0),C.current=window.setTimeout(h,180)}},[h,r]);a.useEffect(()=>()=>window.clearTimeout(C.current),[]);const Y=B(P,w,r==="drawer"),v=M(f,{sessionId:c,cwd:n},u),[m,A]=a.useState(u),[y,D]=a.useState({unstaged:R,staged:R,[u]:{...R,files:v.data?.files??null}}),[g,k]=a.useState(x??v.data?.files[0]?.path??null),[L,E]=a.useState(v.patches.get(x??v.data?.files[0]?.path??"")?.data??null),[G,T]=a.useState(!1),[$,S]=a.useState(null),I=K(r==="drawer"&&p?()=>p({scope:m,path:g}):void 0),b=y[m],W=a.useCallback(async s=>{D(l=>({...l,[s]:{loading:!0,files:l[s].files,error:null}}));try{const l=await O(f,{sessionId:c,cwd:n},s);D(d=>({...d,[s]:{loading:!1,files:l.files,error:null}}))}catch(l){D(d=>({...d,[s]:{loading:!1,files:null,error:l instanceof Error?l.message:String(l)}}))}},[f,c,n]);a.useEffect(()=>{W(m)},[m,W]),a.useEffect(()=>{const s=b.files;if(s){if(!s.length){k(null);return}k(l=>s.some(d=>d.path===l)?l:s[0].path)}},[b.files]),a.useEffect(()=>{if(!g){E(null),S(null);return}let s=!1;const l=M(f,{sessionId:c,cwd:n},m).patches.get(g)?.data;return E(d=>l??(d?.path===g?d:null)),T(!l&&L?.path!==g),S(null),_(f,{sessionId:c,cwd:n},m,g).then(d=>{s||(E(d),T(!1))}).catch(d=>{s||(S(d instanceof Error?d.message:String(d)),T(!1))}),()=>{s=!0}},[f,c,n,m,g,b.files]);const q=a.useMemo(()=>{const s=l=>l?l.reduce((d,F)=>({adds:d.adds+F.additions,dels:d.dels+F.deletions,count:d.count+1}),{adds:0,dels:0,count:0}):{adds:0,dels:0,count:0};return{unstaged:s(y.unstaged.files),staged:s(y.staged.files)}},[y]);return e.jsxs("div",{"aria-labelledby":o,"aria-modal":r==="drawer"?!0:void 0,className:`diff-drawer ${r==="workspace"?"diff-workspace":""} ${N?"closing":""}`,ref:Y,role:r==="drawer"?"dialog":"region",tabIndex:-1,children:[r==="drawer"&&e.jsx("div",{className:"diff-drawer-backdrop",onClick:P,"aria-hidden":"true"}),e.jsxs("div",{className:"diff-drawer-panel",children:[e.jsxs("header",{className:"diff-drawer-header",...I,children:[p&&r==="drawer"&&e.jsx("button",{type:"button",className:"icon-button","aria-label":j,title:j,onClick:()=>p({scope:m,path:g}),children:e.jsx(U,{})}),e.jsxs("div",{children:[e.jsx("strong",{id:o,children:t.changes}),e.jsx("span",{children:i})]}),e.jsx("button",{"aria-label":t.closeChanges,className:"icon-button",onClick:P,ref:w,type:"button",title:t.closeChanges,children:e.jsx(V,{"aria-hidden":"true"})})]}),e.jsx("div",{className:"diff-tabs",role:"tablist",children:["unstaged","staged"].map(s=>{const l=q[s],d=m===s;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,className:`diff-tab ${d?"active":""}`,onClick:()=>{s!==m&&(k(null),E(null),S(null),A(s))},children:[e.jsx("span",{className:"diff-tab-label",children:s==="unstaged"?t.workingChanges:t.stagedChanges}),l.count>0?e.jsxs("span",{className:"diff-tab-meta",children:[e.jsxs("span",{className:"diff-add",children:["+",l.adds]}),e.jsxs("span",{className:"diff-del",children:["-",l.dels]})]}):null]},s)})}),e.jsxs("div",{className:"diff-body",children:[e.jsxs("aside",{className:"diff-files","aria-label":t.changedFiles,children:[b.loading&&!b.files?e.jsx("p",{className:"diff-empty",children:t.loading}):null,b.error?e.jsx("p",{className:"diff-empty diff-error",children:b.error}):null,b.files&&b.files.length===0?e.jsx("p",{className:"diff-empty",children:t.noChanges}):null,b.files?.map(s=>e.jsxs("button",{type:"button",className:`diff-file diff-file-${s.status} ${g===s.path?"active":""}`,onClick:()=>k(s.path),children:[e.jsx("span",{className:`diff-status diff-status-${s.status}`,children:s.status}),e.jsx("span",{className:"diff-file-path",title:s.path,children:s.path}),e.jsxs("span",{className:"diff-file-stats",children:[s.binary?e.jsx("span",{className:"diff-binary",children:"bin"}):null,!s.binary&&s.additions>0?e.jsxs("span",{className:"diff-add",children:["+",s.additions]}):null,!s.binary&&s.deletions>0?e.jsxs("span",{className:"diff-del",children:["-",s.deletions]}):null]})]},s.path))]}),e.jsx("section",{className:"diff-patch","aria-label":t.fileDiff,children:g?G?e.jsx("p",{className:"diff-empty",children:t.loadingPatch}):$?e.jsx("p",{className:"diff-empty diff-error",children:$}):L?.binary?e.jsx("p",{className:"diff-empty",children:t.binaryDiffUnavailable}):L?e.jsx(J,{patch:L.patch,truncated:L.truncated,truncatedLabel:t.patchTruncated,loadingLabel:t.loadingPatch},`${m}:${g}`):null:e.jsxs("div",{className:"diff-empty",children:[e.jsx(z,{"aria-hidden":"true"}),e.jsx("p",{children:t.selectFileForDiff})]})})]})]})]})}export{ee as DiffDrawer};
@@ -1 +0,0 @@
1
- import{c as z,j as e,i as J,r as u,E as ne,u as ae,e as se,l as ie}from"./index-ConcKf33.js";import{X as Q,a as oe,P as le,T as ce,i as Z,w as de,n as O,f as $,j as B,k as H,m as ue,L as ee,R as fe,o as pe,e as te,q as re,s as me,t as he,c as ye}from"./App-CapuoJH2.js";import{F as xe}from"./folder-plus-DHw5YJHP.js";const ge=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],be=z("clipboard-paste",ge);const je=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],ke=z("file-code-corner",je);const Ee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],we=z("image",Ee);const De=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],ve=z("link",De);const Ce=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Ne=z("scissors",Ce);function Se({ops:t,onOpen:f,root:j}){const b=u.useRef(null),d=t.menu;u.useLayoutEffect(()=>{const s=b.current,m=document.activeElement,E=s.getBoundingClientRect();s.style.left=`${Math.max(8,Math.min(d.x,innerWidth-E.width-8))}px`,s.style.top=`${Math.max(8,Math.min(d.y,innerHeight-E.height-8))}px`,s.querySelector("button:not(:disabled)")?.focus();const w=l=>{s.contains(l.target)||t.setMenu(null)},x=()=>t.setMenu(null);return document.addEventListener("pointerdown",w),document.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x),s.contains(document.activeElement)&&m?.focus()}},[]);const o=s=>{s.stopPropagation();const m=Array.from(b.current.querySelectorAll("button:not(:disabled)")),E=m.indexOf(document.activeElement);["ArrowUp","ArrowDown","Home","End","Escape","Tab"].includes(s.key)&&s.preventDefault(),(s.key==="Escape"||s.key==="Tab")&&t.setMenu(null),s.key==="ArrowDown"&&m[(E+1)%m.length]?.focus(),s.key==="ArrowUp"&&m[(E-1+m.length)%m.length]?.focus(),s.key==="Home"&&m[0]?.focus(),s.key==="End"&&m.at(-1)?.focus()},y=s=>{t.setMenu(null),s()};return e.jsxs("div",{ref:b,role:"menu","aria-label":t.strings.open,className:"session-context-menu file-tree-menu",style:{left:d.x,top:d.y},onKeyDown:o,onContextMenu:s=>s.preventDefault(),children:[!d.directory&&e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>y(f),children:[e.jsx(ne,{}),t.strings.open]}),d.path!==j&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>t.copy(d,!1),children:[e.jsx(oe,{}),t.strings.copy,e.jsx("kbd",{children:"⌘C"})]}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>t.copy(d,!0),children:[e.jsx(Ne,{}),t.strings.cut,e.jsx("kbd",{children:"⌘X"})]})]}),e.jsxs("button",{type:"button",role:"menuitem",disabled:!t.canPaste,onClick:()=>y(()=>{t.paste(d)}),children:[e.jsx(be,{}),t.strings.paste,e.jsx("kbd",{children:"⌘V"})]}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>y(()=>{t.copyPath(d)}),children:[e.jsx(ve,{}),t.strings.copyPath]}),d.path!==j&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"context-menu-separator"}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>t.startRename(d),children:[e.jsx(le,{}),t.strings.rename,e.jsx("kbd",{children:"F2"})]}),e.jsxs("button",{type:"button",role:"menuitem",className:"danger",onClick:()=>y(()=>t.setDeleting(d)),children:[e.jsx(ce,{}),t.strings.delete]})]})]})}function Fe({ops:t}){const f=ae(()=>{t.busy||t.setDeleting(null)});return e.jsx("div",{className:"modal-backdrop file-tree-backdrop",children:e.jsxs("div",{ref:f,className:"file-tree-delete-dialog",role:"dialog","aria-modal":"true","aria-label":t.strings.confirmDelete,tabIndex:-1,children:[e.jsx("h2",{children:t.strings.confirmDelete}),e.jsx("p",{children:t.deleting?.path}),e.jsx("p",{children:t.strings.deleteHint}),t.error&&e.jsx("p",{role:"alert",children:t.error}),e.jsxs("div",{className:"file-tree-dialog-actions",children:[e.jsx("button",{type:"button",disabled:t.busy,onClick:()=>t.setDeleting(null),children:t.strings.cancel}),e.jsx("button",{type:"button",className:"danger",disabled:t.busy,onClick:()=>{t.deleteItem()},children:t.strings.delete})]})]})})}function _e({ops:t,root:f,onOpen:j}){return e.jsxs(e.Fragment,{children:[t.menu&&J.createPortal(e.jsx(Se,{ops:t,root:f,onOpen:j}),document.body),t.deleting&&J.createPortal(e.jsx(Fe,{ops:t}),document.body),t.error&&!t.deleting&&e.jsxs("div",{className:"file-tree-notice",role:"alert",children:[e.jsx("span",{children:t.error}),e.jsx("button",{type:"button",title:t.strings.dismiss,"aria-label":t.strings.dismiss,onClick:()=>t.setError(""),children:e.jsx(Q,{})})]}),t.undo&&e.jsxs("div",{className:"file-tree-notice",role:"status",children:[e.jsx("span",{children:t.strings.deleted}),e.jsx("button",{type:"button",disabled:t.busy,onClick:()=>{t.restore()},children:t.strings.undo}),e.jsx("button",{type:"button",title:t.strings.dismiss,"aria-label":t.strings.dismiss,onClick:()=>t.setUndo(null),children:e.jsx(Q,{})})]})]})}function Y(t){return[...t].sort((f,j)=>Number(j.isDirectory)-Number(f.isDirectory)||f.name.localeCompare(j.name,void 0,{numeric:!0,sensitivity:"base"}))}function Te(t,f,j){const[b,d]=u.useState(new Set),[o,y]=u.useState({}),[s,m]=u.useState(new Set),[E,w]=u.useState({}),x=u.useRef(0),l=u.useRef(new Set);return u.useEffect(()=>(x.current++,l.current.clear(),d(new Set),y({}),m(new Set),w({}),()=>{x.current++}),[t]),{refresh:async()=>{const g=++x.current;l.current.clear(),m(new Set(b)),w({});const D=await Promise.all([...b].map(async c=>{try{return[c,Y(await j(c))]}catch{return null}}));g===x.current&&(y(Object.fromEntries(D.filter(c=>c!==null))),d(new Set(D.flatMap(c=>c?[c[0]]:[]))),m(new Set))},expanded:b,children:o,loading:s,errors:E,collapse:g=>d(D=>{const c=new Set(D);return c.delete(g),c}),expand:async g=>{if(d(c=>new Set(c).add(g)),o[g]||l.current.has(g))return;const D=x.current;l.current.add(g),m(c=>new Set(c).add(g)),w(c=>{const S={...c};return delete S[g],S});try{const c=await j(g);x.current===D&&y(S=>({...S,[g]:Y(c)}))}catch{x.current===D&&w(c=>({...c,[g]:"unavailable"}))}finally{x.current===D&&(l.current.delete(g),m(c=>{const S=new Set(c);return S.delete(g),S}))}}}}const Me={copy:"Copy",cut:"Cut",paste:"Paste",copyPath:"Copy path",rename:"Rename",delete:"Delete",cancel:"Cancel",confirmDelete:"Delete this item?",deleteHint:"You can undo this deletion after it finishes.",deleted:"Deleted",undo:"Undo",dismiss:"Dismiss",name:"Name",open:"Open",errors:{destination_exists:"An item with this name already exists.",recursive_destination:"Choose a different folder.",outside_root:"Choose a destination inside this folder.",protected_path:"This location is protected.",invalid_operation:"Enter a valid file name.",unsaved_changes:"Save the open file changes first.",daemon_update_required:"Update Vibelet on the connected computer to enable file operations.",ENOENT:"The file or folder no longer exists. Refresh the tree.",EACCES:"Permission denied.",EXDEV:"Moving between disks is unavailable. Copy the item first.",operation_failed:"File operation failed."}},Le={copy:"复制",cut:"剪切",paste:"粘贴",copyPath:"复制路径",rename:"重命名",delete:"删除",cancel:"取消",confirmDelete:"删除这个项目?",deleteHint:"删除完成后可以撤销。",deleted:"已删除",undo:"撤销",dismiss:"关闭",name:"名称",open:"打开",errors:{destination_exists:"已有同名文件或文件夹,请换一个名称。",recursive_destination:"不能移动或复制到自身目录中。",outside_root:"请选择当前文件夹内的目标目录。",protected_path:"不能操作这个受保护的位置。",invalid_operation:"请输入有效的文件名。",unsaved_changes:"请先保存已打开文件的修改。",daemon_update_required:"请更新被连接电脑上的 Vibelet,以启用文件操作。",ENOENT:"文件或文件夹已不存在,请刷新文件树。",EACCES:"没有操作权限。",EXDEV:"暂不支持跨磁盘移动,请先复制。",operation_failed:"文件操作失败。"}},Pe={copy:"複製",cut:"剪下",paste:"貼上",copyPath:"複製路徑",rename:"重新命名",delete:"刪除",cancel:"取消",confirmDelete:"刪除這個項目?",deleteHint:"刪除完成後可以復原。",deleted:"已刪除",undo:"復原",dismiss:"關閉",name:"名稱",open:"開啟",errors:{destination_exists:"已有同名檔案或資料夾,請換一個名稱。",recursive_destination:"不能移動或複製到自身目錄中。",outside_root:"請選擇目前資料夾內的目標目錄。",protected_path:"不能操作這個受保護的位置。",invalid_operation:"請輸入有效的檔案名稱。",unsaved_changes:"請先儲存已開啟檔案的修改。",daemon_update_required:"請更新被連接電腦上的 Vibelet,以啟用檔案操作。",ENOENT:"檔案或資料夾已不存在,請重新整理檔案樹。",EACCES:"沒有操作權限。",EXDEV:"暫不支援跨磁碟移動,請先複製。",operation_failed:"檔案操作失敗。"}};function Ae(){const t=se(ie().language);return t==="en"?Me:t==="zh-TW"?Pe:Le}let T=null,F=null;const W="application/x-vibelet-file",X="vibelet:file-clipboard";function Re(t,f,j){const b=Ae(),[d,o]=u.useState(null),[y,s]=u.useState(null),[m,E]=u.useState(""),[w,x]=u.useState(null),[l,i]=u.useState(null),[K,_]=u.useState(""),[g,D]=u.useState(!1),c=u.useRef(!1),[S,M]=u.useState(null),[,U]=u.useState(0),I=Z(),C=I?.daemonId;u.useEffect(()=>{const n=()=>U(r=>r+1);return window.addEventListener(X,n),()=>window.removeEventListener(X,n)},[]),u.useEffect(()=>{o(null),s(null),x(null),i(null),_(""),M(null)},[t,f,C]);const N=n=>{const r=n instanceof Error?n.message:"operation_failed";_(b.errors[r]??b.errors.operation_failed)},L=async n=>{if(!I||c.current)return!1;c.current=!0,D(!0),_("");try{const r=await ue({...n,root:t,cwd:f},I);return Z()?.daemonId===C&&(r.action==="delete"&&i(r),await j()),!0}catch(r){return N(r),!1}finally{c.current=!1,D(!1)}},V=(n,r)=>{C&&(T={target:n,cut:r,daemonId:C,root:t,cwd:f},window.dispatchEvent(new Event(X)),o(null),_(""))},q=n=>n.directory?n.path:H(n.path)??t,a=!!(T&&T.daemonId===C),v=async n=>{const r=T;if(!a||!r)return;await L({action:r.cut?"move":"copy",path:r.target.path,sourceRoot:r.root,sourceCwd:r.cwd,target:B(q(n),$(r.target.path)),autoRename:!r.cut&&O(q(n),f)===O(H(r.target.path)??r.root,r.cwd)})&&r.cut&&T===r&&(T=null,window.dispatchEvent(new Event(X)))},k=(n,r,R)=>{c.current||o({...n,x:r,y:R})},h=n=>{s(n),E($(n.path)),o(null),_("")},P=async()=>{if(!y)return;const n=m.trim();if(!n||/[/\\\x00]/.test(n)||n==="."||n===".."){N(new Error("invalid_operation"));return}if(n===$(y.path)){s(null);return}await L({action:"move",path:y.path,target:B(H(y.path)??t,n)})&&s(null)},p=(n,r)=>{if(n.target!==n.currentTarget)return!1;if((n.metaKey||n.ctrlKey)&&["c","x","v"].includes(n.key.toLowerCase()))return n.preventDefault(),n.key.toLowerCase()==="v"?v(r):V(r,n.key.toLowerCase()==="x"),!0;if(n.key==="F2")return n.preventDefault(),h(r),!0;if(n.key==="Delete"||n.metaKey&&n.key==="Backspace")return n.preventDefault(),x(r),!0;if(n.key==="ContextMenu"||n.shiftKey&&n.key==="F10"){n.preventDefault();const G=n.currentTarget.getBoundingClientRect();return k(r,G.left+20,G.top+24),!0}return!1},A=n=>{if(!F||F.daemonId!==C||F.root!==t||F.cwd!==f||c.current)return!1;const r=O(F.target.path,f),R=O(n,f);return R!==r&&!R.startsWith(`${r}/`)&&O(H(F.target.path)??t,f)!==R};return{strings:b,menu:d,setMenu:o,rename:y,setRename:s,name:m,setName:E,deleting:w,setDeleting:x,error:K,setError:_,busy:g,undo:l,setUndo:i,canPaste:a,copy:V,paste:v,key:p,startRename:h,commitRename:P,openMenu:k,copyPath:async n=>{try{await de(O(n.path,f))}catch(r){N(r)}},deleteItem:async()=>{w&&await L({action:"delete",path:w.path})&&x(null)},restore:async()=>{l&&await L({action:"restore",path:l.path,recoveryId:l.recoveryId})&&i(null)},isCut:n=>!!(T?.cut&&T.daemonId===C&&T.target.path===n),dropTarget:S,dragStart:(n,r)=>{if(!C||c.current){n.preventDefault();return}F={target:r,cut:!0,daemonId:C,root:t,cwd:f},n.dataTransfer.setData(W,r.path),n.dataTransfer.effectAllowed="copyMove",o(null)},dragEnd:()=>{F=null,M(null)},dragOver:(n,r)=>{!n.dataTransfer.types.includes(W)||!A(r)||(n.preventDefault(),n.stopPropagation(),n.dataTransfer.dropEffect=n.altKey?"copy":"move",M(r))},dragLeave:n=>{n.currentTarget.contains(n.relatedTarget)||M(null)},drop:(n,r)=>{n.preventDefault(),n.stopPropagation(),M(null),!(!n.dataTransfer.types.includes(W)||!A(r)||!F)&&L({action:n.altKey?"copy":"move",path:F.target.path,target:B(r,$(F.target.path))})}}}function Ie(t){return/\.(png|jpe?g|gif|webp|svg|ico)$/i.test(t)?we:/\.(tsx?|jsx?|json|css|html|py|rs|go|swift|ya?ml|sh)$/i.test(t)?ke:ye}function Oe({cwd:t,entries:f,error:j,loaded:b,loading:d,path:o,selectedPath:y,t:s,onListDirectory:m,onLoadChildren:E,onNewFolder:w,onOpenRemoteFile:x}){const l=Te(o,f,E),i=Re(o,t,async()=>{m(o),await l.refresh()}),K=u.useRef(null),[_,g]=u.useState(!1),[D,c]=u.useState(o),[S,M]=u.useState(y),[U,I]=u.useState();u.useEffect(()=>{c(o)},[o]),u.useEffect(()=>I(void 0),[o,f]),u.useEffect(()=>{M(y)},[y]);const C=(a,v)=>{a.isDirectory?l.expanded.has(v)?l.collapse(v):l.expand(v):(M(v),x(v,t))},N=a=>a?.focus(),L=(a,v,k)=>{if(a.stopPropagation(),i.key(a,{path:k,directory:v.isDirectory})||a.target instanceof HTMLInputElement)return;const h=Array.from(K.current?.querySelectorAll('[role="treeitem"]')??[]),P=h.indexOf(a.currentTarget);["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","Enter"," "].includes(a.key)&&a.preventDefault(),a.key==="ArrowUp"&&N(h[Math.max(0,P-1)]),a.key==="ArrowDown"&&N(h[Math.min(h.length-1,P+1)]),a.key==="Home"&&N(h[0]),a.key==="End"&&N(h.at(-1)),a.key==="ArrowRight"&&v.isDirectory&&(!l.expanded.has(k)||l.errors[k]?l.expand(k):N(a.currentTarget.querySelector('[role="treeitem"]'))),a.key==="ArrowLeft"&&(v.isDirectory&&l.expanded.has(k)?l.collapse(k):N(a.currentTarget.parentElement?.closest('[role="treeitem"]'))),(a.key==="Enter"||a.key===" ")&&C(v,k)},V=Y(f),q=(a,v,k)=>a.map((h,P)=>{const p=B(v,h.name),A=l.expanded.has(p),n=h.isDirectory?A?te:re:Ie(h.name);return e.jsxs("div",{role:"treeitem","aria-label":h.name,"aria-level":k+1,"aria-posinset":P+1,"aria-setsize":a.length,"aria-expanded":h.isDirectory?A:void 0,"aria-selected":S===p,"aria-busy":l.loading.has(p)||void 0,"data-path":p,className:"explorer-tree-item",tabIndex:U===p||!U&&k===0&&P===0?0:-1,onFocus:r=>{r.target===r.currentTarget&&I(p)},onKeyDown:r=>L(r,h,p),children:[e.jsxs("div",{className:"explorer-tree-row",draggable:!i.busy&&i.rename?.path!==p,"data-cut":i.isCut(p)||void 0,"data-drop":i.dropTarget===p||void 0,onContextMenu:r=>{r.preventDefault(),r.stopPropagation(),N(r.currentTarget.parentElement),i.openMenu({path:p,directory:h.isDirectory},r.clientX,r.clientY)},onDragStart:r=>i.dragStart(r,{path:p,directory:h.isDirectory}),onDragEnd:i.dragEnd,onDragOver:r=>h.isDirectory&&i.dragOver(r,p),onDragLeave:i.dragLeave,onDrop:r=>h.isDirectory&&i.drop(r,p),style:{paddingLeft:8+k*14},title:p,onClick:r=>{N(r.currentTarget.parentElement),C(h,p)},children:[e.jsx("span",{className:"explorer-chevron","aria-hidden":"true",children:h.isDirectory&&(l.loading.has(p)?e.jsx(ee,{className:"explorer-spinner"}):A?e.jsx(me,{}):e.jsx(he,{}))}),e.jsx(n,{className:h.isDirectory?"explorer-folder-icon":"explorer-file-icon","aria-hidden":"true"}),e.jsx("span",{className:"explorer-entry-name",children:i.rename?.path===p?e.jsx("input",{className:"explorer-rename","aria-label":i.strings.name,autoFocus:!0,value:i.name,disabled:i.busy,onFocus:r=>r.target.select(),onClick:r=>r.stopPropagation(),onChange:r=>i.setName(r.target.value),onKeyDown:r=>{r.stopPropagation(),r.key==="Enter"&&(r.preventDefault(),i.commitRename()),r.key==="Escape"&&(r.preventDefault(),i.setRename(null))}}):h.name})]}),h.isDirectory&&A&&e.jsxs("div",{role:"group",className:"explorer-tree-group",style:{"--tree-guide-left":`${14+k*14}px`},children:[l.children[p]?q(l.children[p],p,k+1):null,l.errors[p]&&e.jsx("button",{className:"explorer-retry",type:"button",onClick:()=>{l.expand(p)},children:s.retry}),l.children[p]?.length===0&&e.jsx("p",{className:"explorer-empty",style:{paddingLeft:36+k*14},children:s.noFilesInDirectory})]})]},p)});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"explorer-heading",children:[e.jsx("h2",{children:s.fileTree}),e.jsxs("div",{className:"explorer-actions",children:[e.jsx("button",{className:"icon-button",title:s.newFolder,"aria-label":s.newFolder,onClick:w,type:"button",children:e.jsx(xe,{"aria-hidden":"true"})}),e.jsx("button",{className:"icon-button",title:s.refreshFiles,"aria-label":s.refreshFiles,disabled:d,onClick:()=>{m(o),l.refresh()},type:"button",children:d?e.jsx(ee,{className:"explorer-spinner","aria-hidden":"true"}):e.jsx(fe,{"aria-hidden":"true"})}),e.jsx("button",{className:"icon-button",title:s.parentFolder,"aria-label":s.parentFolder,disabled:!H(o),onClick:()=>m(H(o)??o),type:"button",children:e.jsx(pe,{"aria-hidden":"true"})})]})]}),e.jsxs("button",{type:"button",className:"explorer-root-path",onContextMenu:a=>{a.preventDefault(),i.openMenu({path:o,directory:!0},a.clientX,a.clientY)},onDragOver:a=>i.dragOver(a,o),onDragLeave:i.dragLeave,onDrop:a=>i.drop(a,o),"data-drop":i.dropTarget===o||void 0,title:o==="."?t:o,onClick:()=>{c(o),g(a=>!a)},children:[e.jsx(te,{"aria-hidden":"true"}),e.jsx("span",{children:$(o==="."?t:o)||o})]}),_&&e.jsx("form",{className:"explorer-path-form",onSubmit:a=>{a.preventDefault(),D.trim()&&(m(D.trim()),g(!1))},children:e.jsx("input",{autoFocus:!0,"aria-label":s.path,value:D,onChange:a=>c(a.target.value),onKeyDown:a=>{a.key==="Escape"&&g(!1)}})}),j&&e.jsx("p",{className:"empty-copy",role:"alert",children:j}),d&&e.jsx("p",{className:"explorer-empty",role:"status",children:s.loadingFiles}),e.jsx("div",{ref:K,role:"tree","aria-label":s.fileTree,className:"explorer-tree","aria-busy":d||i.busy,"data-drop":i.dropTarget===o||void 0,onContextMenu:a=>{a.preventDefault(),i.openMenu({path:o,directory:!0},a.clientX,a.clientY)},onDragOver:a=>i.dragOver(a,o),onDragLeave:i.dragLeave,onDrop:a=>i.drop(a,o),children:q(V,o,0)}),e.jsx(_e,{ops:i,root:o,onOpen:()=>i.menu&&x(i.menu.path,t)}),b&&!d&&!j&&f.length===0&&e.jsx("p",{className:"explorer-empty",children:s.noFilesInDirectory})]})}function $e({busy:t,onLoadChildren:f,cwd:j,directory:b,newDirName:d,remoteFile:o,t:y,onCreateDirectory:s,onListDirectory:m,onNewDirNameChange:E,onOpenRemoteFile:w}){const[x,l]=u.useState(!1);return e.jsx(e.Fragment,{children:e.jsxs("section",{className:"control-section files-explorer",children:[e.jsx(Oe,{cwd:j,selectedPath:o?.path,onLoadChildren:f,onNewFolder:()=>l(i=>!i),entries:b.entries,error:b.error,loaded:b.loaded,loading:b.loading,path:b.path,t:y,onListDirectory:m,onOpenRemoteFile:w}),x&&e.jsxs("div",{className:"field-row file-tree-create",children:[e.jsx("input",{value:d,onChange:i=>E(i.target.value),placeholder:y.newFolder,"aria-label":y.newFolder,autoFocus:!0,onKeyDown:i=>{i.key==="Escape"&&(l(!1),E("")),i.key==="Enter"&&d.trim()&&!t&&s()}}),e.jsxs("button",{className:"icon-text-button",onClick:s,type:"button",disabled:t||!d.trim(),children:[e.jsx(re,{"aria-hidden":"true"}),y.create]})]})]})})}export{$e as FilesControlPanel};
@@ -1 +0,0 @@
1
- import{c as ne,m as F,r as a,u as ae,i as oe,j as t}from"./index-ConcKf33.js";import{j as H,X as le,e as E,g as K,S as ie,h as re}from"./App-CapuoJH2.js";import{F as ce}from"./folder-plus-DHw5YJHP.js";const de=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ue=ne("bot",de),L="vibelet.web.recentCreations";function U(n){try{const s=JSON.parse(F().getItem(L)||"{}")[n];return Array.isArray(s)?s.filter(r=>typeof r.cwd=="string"&&["claude","codex"].includes(r.agent)&&Number.isFinite(r.createdAt)).slice(0,8):[]}catch{return[]}}function he(n,s){try{const r=JSON.parse(F().getItem(L)||"{}");r[n]=[s,...U(n).filter(c=>c.cwd!==s.cwd||c.agent!==s.agent)].slice(0,8),F().setItem(L,JSON.stringify(r))}catch{}}function we(n){const{t:s,device:r,onClose:c,onListDirectories:I}=n,o=s.newSession!=="New session",[l,w]=a.useState(n.cwd),[u,O]=a.useState(n.agent),[y,X]=a.useState(n.approvalMode),[p,C]=a.useState(n.model),[z,G]=a.useState(""),[S,P]=a.useState([]),[R,T]=a.useState(""),B=[{value:"normal",label:s.approvalNormal},{value:"plan",label:s.approvalPlan},{value:"acceptEdits",label:s.approvalEdits},{value:"autoApprove",label:s.approvalAuto}];a.useEffect(()=>{let e=!1;return P([]),T(""),n.onListModels(u).then(i=>{e||P(i)}).catch(()=>{e||T(o?"模型加载失败,请重新选择代理重试。":"Models unavailable. Select the agent again to retry.")}),()=>{e=!0}},[u,n.onListModels,o]);const[d,J]=a.useState([]),[h,V]=a.useState(-1),[x,k]=a.useState(!1),[W,g]=a.useState(""),[Q,D]=a.useState(!1),[N,_]=a.useState(!1),[m,v]=a.useState(null),M=a.useRef(null),Y=ae(c,M),[$]=a.useState(()=>U(r));a.useEffect(()=>{if(J([]),V(-1),g(""),!x||!n.connected)return;let e=!1;const i=/^(?:[a-z]:[\\/]|\\\\)/i.test(l)?l.replaceAll("\\","/"):l,b=i.lastIndexOf("/"),q=b<0?".":i.slice(0,b+1)||"/",te=i.slice(b+1).toLowerCase(),se=window.setTimeout(()=>{D(!0),I(q).then(f=>{e||J(f.filter(j=>j.isDirectory&&j.name.toLowerCase().startsWith(te)).map(j=>H(q,j.name)).slice(0,12))}).catch(f=>{e||g(String(f instanceof Error?f.message:f))}).finally(()=>{e||D(!1)})},180);return()=>{e=!0,window.clearTimeout(se),D(!1)}},[l,x,n.connected,I]);const A=e=>{w(e+(e.endsWith("/")?"":"/")),M.current?.focus()},Z=()=>{!l.trim()||!n.connected||N||(n.onCreate(l.trim(),u,{draft:z,approvalMode:y,model:p}),he(r,{cwd:l.trim(),agent:u,createdAt:Date.now()}),c())},ee=()=>{A(l||n.cwd||"/"),k(!0)};return oe.createPortal(t.jsxs("div",{className:"new-session-layer",children:[t.jsx("div",{className:"new-session-backdrop",onClick:c}),t.jsxs("div",{className:"new-session-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"new-session-title",ref:Y,tabIndex:-1,children:[t.jsxs("header",{children:[t.jsx("h2",{id:"new-session-title",children:s.newSession}),t.jsx("button",{type:"button",className:"icon-button","aria-label":s.close,onClick:c,children:t.jsx(le,{})})]}),t.jsxs("form",{onSubmit:e=>{e.preventDefault(),Z()},children:[t.jsx("div",{className:"new-session-agents",children:["claude","codex"].map(e=>t.jsxs("button",{type:"button","aria-pressed":u===e,onClick:()=>{O(e),C("")},children:[t.jsx(ue,{size:18}),e==="claude"?"Claude":"Codex"]},e))}),t.jsxs("div",{className:"new-session-path-field",children:[t.jsxs("label",{className:"new-session-field",children:[t.jsx("span",{children:s.workingDirectory}),t.jsxs("div",{className:"new-session-path-row",children:[t.jsx("input",{ref:M,value:l,"aria-label":s.workingDirectory,role:"combobox","aria-autocomplete":"list",spellCheck:!1,"aria-expanded":x&&d.length>0,"aria-controls":"new-session-paths","aria-activedescendant":h>=0?`new-session-path-${h}`:void 0,onFocus:()=>k(!0),onBlur:()=>k(!1),onChange:e=>w(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||e.keyCode===229||!d.length||(e.key==="ArrowDown"||e.key==="ArrowUp"?(e.preventDefault(),V(i=>i<0?e.key==="ArrowDown"?0:d.length-1:(i+(e.key==="ArrowDown"?1:-1)+d.length)%d.length)):(e.key==="Enter"||e.key==="Tab")&&h>=0&&(e.preventDefault(),A(d[h])))}}),t.jsx("button",{type:"button",className:"icon-button","aria-label":s.browseDirectories,title:s.browseDirectories,onMouseDown:e=>e.preventDefault(),onClick:()=>{ee()},children:t.jsx(E,{})}),t.jsx("button",{type:"button",className:"icon-button","aria-label":o?"新建文件夹":"New folder",title:o?"新建文件夹":"New folder",onMouseDown:e=>e.preventDefault(),onClick:()=>v(""),children:t.jsx(ce,{})})]})]}),x&&d.length>0&&t.jsx("div",{className:"new-session-paths",id:"new-session-paths",role:"listbox",children:d.map((e,i)=>t.jsxs("button",{type:"button",id:`new-session-path-${i}`,role:"option","aria-selected":h===i,onMouseDown:b=>b.preventDefault(),onClick:()=>A(e),title:e,children:[t.jsx(E,{size:14}),e]},e))}),t.jsx("small",{className:"new-session-path-status",role:W||R?"alert":"status",title:W||R,children:Q?s.loadingDirectories:" "})]}),m!==null&&t.jsxs("div",{className:"new-session-path-row",children:[t.jsx("input",{"aria-label":o?"文件夹名称":"Folder name",value:m,onChange:e=>v(e.target.value)}),t.jsx("button",{type:"button",disabled:N||!m.trim()||/[/\\]/.test(m),onClick:async()=>{_(!0),g("");try{const e=H(l,m.trim());await n.onCreateDirectory(e),w(e),v(null)}catch(e){g(String(e))}finally{_(!1)}},children:o?"创建文件夹":"Create folder"}),t.jsx("button",{type:"button",onClick:()=>v(null),children:s.close})]}),$.length>0&&t.jsxs("section",{className:"new-session-recent",children:[t.jsx("h3",{children:o?"最近创建":"Recent creations"}),$.map(e=>t.jsxs("button",{type:"button",title:e.cwd,onClick:()=>{w(e.cwd),O(e.agent),C("")},children:[t.jsx(E,{size:14}),t.jsx("span",{children:e.cwd}),t.jsx("small",{children:e.agent==="claude"?"Claude":"Codex"})]},e.cwd+e.agent))]}),t.jsxs("label",{className:"new-session-field",children:[t.jsx("span",{children:o?"初始消息(可选)":"Initial message (optional)"}),t.jsx("textarea",{value:z,onChange:e=>G(e.target.value),rows:3})]}),t.jsxs("div",{className:"new-session-options",children:[t.jsx(K,{icon:ie,label:B.find(e=>e.value===y)?.label??s.approvalMode,menuLabel:s.approvalMode,value:y,onSelect:X,options:B}),t.jsx(K,{icon:re,label:S.find(e=>e.value===p)?.label??(p||(o?"默认模型":"Default model")),menuLabel:o?"模型":"Model",value:p,onSelect:C,options:[...S.some(e=>e.value==="")?[]:[{value:"",label:o?"默认模型":"Default model"}],...S.map(e=>({value:e.value,label:e.label,description:e.desc}))]})]}),!n.connected&&t.jsx("p",{role:"status",children:o?"请先连接设备,再创建会话。":"Connect a device before creating a session."}),t.jsxs("footer",{children:[t.jsx("small",{children:o?"创建后自动发送初始消息":"The initial message is sent after creation"}),t.jsx("button",{type:"button",onClick:c,children:o?"取消":"Cancel"}),t.jsx("button",{className:"primary",type:"submit",disabled:!n.connected||!l.trim()||N,children:s.newSession})]})]})]})]}),document.body)}export{we as default};