tide-commander 1.28.0 → 1.29.0

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 (33) hide show
  1. package/dist/assets/{BossLogsModal-BiUU-KHw.js → BossLogsModal-yZMMUymF.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-mITpV0s-.js → BossSpawnModal-DTYHA3bs.js} +1 -1
  3. package/dist/assets/{ControlsModal-B-vHuy-H.js → ControlsModal-q01g5mtX.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-4J3N6Rwf.js → DockerLogsModal-ChMsMs6X.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-CxIoV9U_.js → EmbeddedEditor-CsR8Jffx.js} +1 -1
  6. package/dist/assets/{IframeModal-gjstRkqg.js → IframeModal-BizOIQC2.js} +1 -1
  7. package/dist/assets/{LogViewerModal-CHscrq-v.js → LogViewerModal-wKmq37Bu.js} +1 -1
  8. package/dist/assets/{PM2LogsModal-DEHU-djL.js → PM2LogsModal-620HJLNq.js} +1 -1
  9. package/dist/assets/{RestoreArchivedAreaModal-CG0oth5W.js → RestoreArchivedAreaModal-DSPSAN4u.js} +1 -1
  10. package/dist/assets/{SaveSnapshotModal-DE-TCpvr.js → SaveSnapshotModal-Dw-EHO0V.js} +1 -1
  11. package/dist/assets/{Scene2DCanvas-D6I-Wzw1.js → Scene2DCanvas-B-5kHM6-.js} +1 -1
  12. package/dist/assets/{SceneManager-xFOFMELt.js → SceneManager-C_C81vSz.js} +1 -1
  13. package/dist/assets/{SkillsPanel-DuphMhLu.js → SkillsPanel-lmUsjmSB.js} +1 -1
  14. package/dist/assets/{SnapshotManager-CZyM-TWc.js → SnapshotManager--SX8oMOb.js} +1 -1
  15. package/dist/assets/{SpawnModal-VhtMU5On.js → SpawnModal-B8E6Nbxi.js} +1 -1
  16. package/dist/assets/{SubordinateAssignmentModal-Dd9BzYcG.js → SubordinateAssignmentModal-Dyok_6p1.js} +1 -1
  17. package/dist/assets/{SupervisorPanel-BMDfEsoY.js → SupervisorPanel-C69P3fSQ.js} +1 -1
  18. package/dist/assets/{camera-BYsvMlB2.js → camera-3pUjdK0X.js} +1 -1
  19. package/dist/assets/{index-DEqOMh2B.js → index-2eGWcGUM.js} +3 -3
  20. package/dist/assets/{index-BN2JLAZB.js → index-B5NAnuEW.js} +1 -1
  21. package/dist/assets/{index-Dg5B9Zmf.js → index-BfrJ-1c_.js} +1 -1
  22. package/dist/assets/{index-IMo35jZt.js → index-BnBMyrJu.js} +1 -1
  23. package/dist/assets/{index-BalKXSiJ.js → index-D1eq7t6u.js} +1 -1
  24. package/dist/assets/{index-BG1NUWRk.js → index-D4qywTfe.js} +1 -1
  25. package/dist/assets/{index-B-yhKijA.js → index-ixBTiGHK.js} +2 -2
  26. package/dist/assets/{index-CCLJvIPL.js → index-jo_HBZE1.js} +1 -1
  27. package/dist/assets/{main-BxXKe5js.js → main-B_diMezF.js} +62 -62
  28. package/dist/assets/main-DQpuQfqS.css +1 -0
  29. package/dist/assets/{web-Cvrd0zFy.js → web-DGB_bLvv.js} +1 -1
  30. package/dist/assets/{web-yJrUQlXr.js → web-dPW2_YeE.js} +1 -1
  31. package/dist/index.html +2 -2
  32. package/package.json +1 -1
  33. package/dist/assets/main-nQFNb9Sw.css +0 -1
@@ -1 +1 @@
1
- import{u as M,f as N,r as m,s as u,j as r}from"./main-BxXKe5js.js";import{L as v}from"./LogViewerModal-CHscrq-v.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function C(o){const n=["#3498db","#2ecc71","#9b59b6","#e67e22","#1abc9c","#e74c3c","#f1c40f","#00bcd4"];let a=0;for(let t=0;t<o.length;t++)a=o.charCodeAt(t)+((a<<5)-a);return n[Math.abs(a)%n.length]}function w({building:o,isOpen:n,onClose:a}){const{t}=M(["terminal","common"]),{bossStreamingLogs:b,buildings:f}=N(),l=b.get(o.id)||[],[i,d]=m.useState(null),c=o.subordinateBuildingIds||[],g=c.map(e=>f.get(e)).filter(e=>e!==void 0);m.useEffect(()=>(n&&c.length>0&&u.startBossLogStreaming(o.id),()=>{o.id&&u.stopBossLogStreaming(o.id)}),[n,o.id,c.length]);const h=m.useMemo(()=>{const e=new Set;return l.forEach(s=>e.add(s.subordinateName)),Array.from(e)},[l]),p=m.useMemo(()=>(i?l.filter(s=>s.subordinateName===i):l).map((s,j)=>({text:s.chunk,lineNumber:j+1,sourceLabel:s.subordinateName,sourceColor:C(s.subordinateName),isError:s.isError})),[l,i]),x=g.some(e=>{var s;return(s=e.pm2)==null?void 0:s.enabled}),S=h.length>1?r.jsxs("select",{className:"toolbar-btn source-filter",value:i||"",onChange:e=>d(e.target.value||null),children:[r.jsx("option",{value:"",children:t("terminal:logs.allSources")}),h.map(e=>r.jsx("option",{value:e,children:e},e))]}):void 0,L=i?r.jsxs("div",{className:"shortcut",style:{marginLeft:"auto"},children:[r.jsxs("span",{children:[t("terminal:logs.filtered"),": ",i]}),r.jsx("button",{style:{background:"transparent",border:"none",color:"inherit",cursor:"pointer",marginLeft:"0.5rem"},onClick:()=>d(null),children:"x"})]}):void 0;return r.jsx(v,{isOpen:n,onClose:a,title:`${o.name} - ${t("terminal:logs.bossLogs")}`,icon:"👑",lines:p,isStreaming:c.length>0,streamingIndicatorLabel:`${g.length} ${t("terminal:logs.units")}`,onClear:()=>u.clearBossStreamingLogs(o.id),emptyMessage:x?l.length===0?t("terminal:logs.waitingForLogs"):t("terminal:logs.noMatchingLogs"):t("terminal:logs.noPM2Subordinates"),extraToolbar:S,extraFooter:L,modalClassName:"boss-logs-modal"})}export{w as BossLogsModal};
1
+ import{u as M,f as N,r as m,s as u,j as r}from"./main-B_diMezF.js";import{L as v}from"./LogViewerModal-wKmq37Bu.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function C(o){const n=["#3498db","#2ecc71","#9b59b6","#e67e22","#1abc9c","#e74c3c","#f1c40f","#00bcd4"];let a=0;for(let t=0;t<o.length;t++)a=o.charCodeAt(t)+((a<<5)-a);return n[Math.abs(a)%n.length]}function w({building:o,isOpen:n,onClose:a}){const{t}=M(["terminal","common"]),{bossStreamingLogs:b,buildings:f}=N(),l=b.get(o.id)||[],[i,d]=m.useState(null),c=o.subordinateBuildingIds||[],g=c.map(e=>f.get(e)).filter(e=>e!==void 0);m.useEffect(()=>(n&&c.length>0&&u.startBossLogStreaming(o.id),()=>{o.id&&u.stopBossLogStreaming(o.id)}),[n,o.id,c.length]);const h=m.useMemo(()=>{const e=new Set;return l.forEach(s=>e.add(s.subordinateName)),Array.from(e)},[l]),p=m.useMemo(()=>(i?l.filter(s=>s.subordinateName===i):l).map((s,j)=>({text:s.chunk,lineNumber:j+1,sourceLabel:s.subordinateName,sourceColor:C(s.subordinateName),isError:s.isError})),[l,i]),x=g.some(e=>{var s;return(s=e.pm2)==null?void 0:s.enabled}),S=h.length>1?r.jsxs("select",{className:"toolbar-btn source-filter",value:i||"",onChange:e=>d(e.target.value||null),children:[r.jsx("option",{value:"",children:t("terminal:logs.allSources")}),h.map(e=>r.jsx("option",{value:e,children:e},e))]}):void 0,L=i?r.jsxs("div",{className:"shortcut",style:{marginLeft:"auto"},children:[r.jsxs("span",{children:[t("terminal:logs.filtered"),": ",i]}),r.jsx("button",{style:{background:"transparent",border:"none",color:"inherit",cursor:"pointer",marginLeft:"0.5rem"},onClick:()=>d(null),children:"x"})]}):void 0;return r.jsx(v,{isOpen:n,onClose:a,title:`${o.name} - ${t("terminal:logs.bossLogs")}`,icon:"👑",lines:p,isStreaming:c.length>0,streamingIndicatorLabel:`${g.length} ${t("terminal:logs.units")}`,onClear:()=>u.clearBossStreamingLogs(o.id),emptyMessage:x?l.length===0?t("terminal:logs.waitingForLogs"):t("terminal:logs.noMatchingLogs"):t("terminal:logs.noPM2Subordinates"),extraToolbar:S,extraFooter:L,modalClassName:"boss-logs-modal"})}export{w as BossLogsModal};
@@ -1 +1 @@
1
- import{u as $e,f as Ae,E as Le,D as Ee,r as t,I as De,S as se,p as _e,J as R,A as ae,W as O,X as j,j as s,M as Ie,N as Be,P,O as A,U as L,V as Re,s as Oe}from"./main-BxXKe5js.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function ne(p){const h=j.filter(S=>!p.has(`Boss ${S}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function Ue({isOpen:p,onClose:h,onSpawnStart:S,onSpawnEnd:E,spawnPosition:le}){const{t:n}=$e(["terminal","common"]),{agents:g}=Ae(),o=Le(),C=Ee(),[r,d]=t.useState(""),[k,te]=t.useState(()=>De(se.LAST_CWD)),[c,D]=t.useState("boss"),[T,q]=t.useState(!1),[ie,M]=t.useState(!1),[F,ce]=t.useState(!0),[U,oe]=t.useState("bypass"),[m,W]=t.useState("claude"),[f,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[G,re]=t.useState("haiku"),[K,de]=t.useState("gpt-5.3-codex"),[v,y]=t.useState(new Set),[z,_]=t.useState(new Set),[u,ue]=t.useState(""),[b,pe]=t.useState(""),[J,me]=t.useState(""),$=t.useRef(null),I=t.useRef(!1),H=t.useRef(!1),x=t.useMemo(()=>C.filter(e=>e.enabled),[C]),X=t.useMemo(()=>{if(!b.trim())return x;const e=b.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,b]),he=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?C.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,C]),we=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(p&&!H.current&&x.length>0){const a=x.filter(l=>we.includes(l.slug)).map(l=>l.id);a.length>0&&_(new Set(a))}H.current=p},[p,x]);const xe=t.useCallback(e=>{_(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),i=t.useMemo(()=>o.find(e=>e.id===c),[o,c]),fe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return _e(`/api/custom-models/${i.id}`)},[i]),je=i==null?void 0:i.modelScale,Ne=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),V=Array.from(g.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),Y=t.useMemo(()=>{if(!u.trim())return o;const e=u.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,u]),Q=t.useMemo(()=>{if(!u.trim())return R;const e=u.toLowerCase();return R.filter(a=>{const l=ae[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Z=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=O.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(p&&!I.current){I.current=!0;const e=new Set(Array.from(g.values()).map(l=>l.name)),a=o.find(l=>l.id===c);if(a){const l=j.filter(w=>!e.has(`${a.name} ${w}`));if(l.length===0){const w=j[Math.floor(Math.random()*j.length)];d(`${a.name} ${w}-${Date.now()%1e3}`)}else d(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else d(ne(e));y(new Set),$.current&&($.current.focus(),$.current.select())}else p||(I.current=!1)},[p,g]),t.useEffect(()=>{if(!p)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);d(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`${e.name} ${l}`)}else d(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`Boss ${l}`)}else r.startsWith("Boss ")||d(`Boss ${r}`)}},[c]);const ve=()=>{if(M(!1),!k.trim()){M(!0);return}if(!r.trim()){const l=new Set(Array.from(g.values()).map(w=>w.name));d(ne(l));return}Re(se.LAST_CWD,k),S();const e=J.trim()||void 0,a=Array.from(z);Oe.spawnBossAgent(r.trim(),c,k.trim(),le||void 0,Array.from(v),m==="claude"?F:!1,U,m,m==="codex"?f:void 0,m==="codex"?K:void 0,m==="claude"?G:void 0,e,a),d(""),y(new Set),_(new Set),E(),h()},Se=()=>{q(!1),d(""),y(new Set),E(),h()},ge=()=>{q(!1),M(!0),E()};t.useEffect(()=>(window.__bossSpawnModalSuccess=Se,window.__bossSpawnModalError=ge,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const Ce=e=>{e.target===e.currentTarget&&h()},ke=e=>{e.key==="Escape"&&h()},Me=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),y(a)};if(!p)return null;const B=O.boss;return s.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onClick:Ce,onKeyDown:ke,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"boss-header-icon",children:B.icon}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(Ie,{agentClass:Ne,modelFile:fe,customModelUrl:be,modelScale:je,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+R.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>ue(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[Y.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:e.description,children:[s.jsx("span",{className:"class-chip-icon",children:e.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Z&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>D("boss"),title:B.description,children:[s.jsx("span",{className:"class-chip-icon",children:B.icon}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Q.map(e=>{const a=ae[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:a.description,children:[s.jsx("span",{className:"class-chip-icon",children:a.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&Y.length===0&&!Z&&Q.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:$,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>d(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Be,{value:k,onChange:e=>{te(e),M(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:ie,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${m==="claude"?"selected":""}`,onClick:()=>W("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${m==="codex"?"selected":""}`,onClick:()=>W("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(P).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>oe(e),title:P[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:P[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),m==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(A).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:A[e].description,children:[s.jsx("span",{children:A[e].icon}),s.jsx("span",{children:A[e].label})]},e))}):m==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(L).map(e=>s.jsxs("button",{className:`spawn-select-btn ${K===e?"selected":""}`,onClick:()=>de(e),title:L[e].description,children:[s.jsx("span",{children:L[e].icon}),s.jsx("span",{children:L[e].label})]},e))}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:F,onChange:e=>ce(e.target.checked),disabled:m!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),m==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:f.fullAuto!==!1,onChange:e=>N(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!f.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),f.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:f.sandbox||"workspace-write",onChange:e=>N(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:f.approvalMode||"on-request",onChange:e=>N(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:f.profile||"",onChange:e=>N(a=>({...a,profile:e.target.value||void 0}))})]})]})}),x.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),x.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:b,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[X.map(e=>{const a=z.has(e.id);return he.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>xe(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),b&&X.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:b})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:J,onChange:e=>me(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:V.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):V.map(e=>{const a=v.has(e.id),l=O[e.class],w=o.find(ye=>ye.id===e.class),ee=l||w||{icon:"🤖",color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>Me(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ee.color},children:ee.icon}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),v.size>0&&s.jsxs("div",{className:"subordinates-count",children:[v.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:h,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:ve,disabled:T,children:n(T?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{Ue as BossSpawnModal};
1
+ import{u as $e,f as Ae,E as Le,D as Ee,r as t,I as De,S as se,p as _e,J as R,A as ae,W as O,X as j,j as s,M as Ie,N as Be,P,O as A,U as L,V as Re,s as Oe}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function ne(p){const h=j.filter(S=>!p.has(`Boss ${S}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function Ue({isOpen:p,onClose:h,onSpawnStart:S,onSpawnEnd:E,spawnPosition:le}){const{t:n}=$e(["terminal","common"]),{agents:g}=Ae(),o=Le(),C=Ee(),[r,d]=t.useState(""),[k,te]=t.useState(()=>De(se.LAST_CWD)),[c,D]=t.useState("boss"),[T,q]=t.useState(!1),[ie,M]=t.useState(!1),[F,ce]=t.useState(!0),[U,oe]=t.useState("bypass"),[m,W]=t.useState("claude"),[f,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[G,re]=t.useState("haiku"),[K,de]=t.useState("gpt-5.3-codex"),[v,y]=t.useState(new Set),[z,_]=t.useState(new Set),[u,ue]=t.useState(""),[b,pe]=t.useState(""),[J,me]=t.useState(""),$=t.useRef(null),I=t.useRef(!1),H=t.useRef(!1),x=t.useMemo(()=>C.filter(e=>e.enabled),[C]),X=t.useMemo(()=>{if(!b.trim())return x;const e=b.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,b]),he=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?C.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,C]),we=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(p&&!H.current&&x.length>0){const a=x.filter(l=>we.includes(l.slug)).map(l=>l.id);a.length>0&&_(new Set(a))}H.current=p},[p,x]);const xe=t.useCallback(e=>{_(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),i=t.useMemo(()=>o.find(e=>e.id===c),[o,c]),fe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return _e(`/api/custom-models/${i.id}`)},[i]),je=i==null?void 0:i.modelScale,Ne=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),V=Array.from(g.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),Y=t.useMemo(()=>{if(!u.trim())return o;const e=u.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,u]),Q=t.useMemo(()=>{if(!u.trim())return R;const e=u.toLowerCase();return R.filter(a=>{const l=ae[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Z=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=O.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(p&&!I.current){I.current=!0;const e=new Set(Array.from(g.values()).map(l=>l.name)),a=o.find(l=>l.id===c);if(a){const l=j.filter(w=>!e.has(`${a.name} ${w}`));if(l.length===0){const w=j[Math.floor(Math.random()*j.length)];d(`${a.name} ${w}-${Date.now()%1e3}`)}else d(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else d(ne(e));y(new Set),$.current&&($.current.focus(),$.current.select())}else p||(I.current=!1)},[p,g]),t.useEffect(()=>{if(!p)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);d(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`${e.name} ${l}`)}else d(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`Boss ${l}`)}else r.startsWith("Boss ")||d(`Boss ${r}`)}},[c]);const ve=()=>{if(M(!1),!k.trim()){M(!0);return}if(!r.trim()){const l=new Set(Array.from(g.values()).map(w=>w.name));d(ne(l));return}Re(se.LAST_CWD,k),S();const e=J.trim()||void 0,a=Array.from(z);Oe.spawnBossAgent(r.trim(),c,k.trim(),le||void 0,Array.from(v),m==="claude"?F:!1,U,m,m==="codex"?f:void 0,m==="codex"?K:void 0,m==="claude"?G:void 0,e,a),d(""),y(new Set),_(new Set),E(),h()},Se=()=>{q(!1),d(""),y(new Set),E(),h()},ge=()=>{q(!1),M(!0),E()};t.useEffect(()=>(window.__bossSpawnModalSuccess=Se,window.__bossSpawnModalError=ge,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const Ce=e=>{e.target===e.currentTarget&&h()},ke=e=>{e.key==="Escape"&&h()},Me=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),y(a)};if(!p)return null;const B=O.boss;return s.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onClick:Ce,onKeyDown:ke,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"boss-header-icon",children:B.icon}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(Ie,{agentClass:Ne,modelFile:fe,customModelUrl:be,modelScale:je,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+R.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>ue(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[Y.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:e.description,children:[s.jsx("span",{className:"class-chip-icon",children:e.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Z&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>D("boss"),title:B.description,children:[s.jsx("span",{className:"class-chip-icon",children:B.icon}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Q.map(e=>{const a=ae[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:a.description,children:[s.jsx("span",{className:"class-chip-icon",children:a.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&Y.length===0&&!Z&&Q.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:$,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>d(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Be,{value:k,onChange:e=>{te(e),M(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:ie,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${m==="claude"?"selected":""}`,onClick:()=>W("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${m==="codex"?"selected":""}`,onClick:()=>W("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(P).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>oe(e),title:P[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:P[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),m==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(A).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:A[e].description,children:[s.jsx("span",{children:A[e].icon}),s.jsx("span",{children:A[e].label})]},e))}):m==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(L).map(e=>s.jsxs("button",{className:`spawn-select-btn ${K===e?"selected":""}`,onClick:()=>de(e),title:L[e].description,children:[s.jsx("span",{children:L[e].icon}),s.jsx("span",{children:L[e].label})]},e))}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:F,onChange:e=>ce(e.target.checked),disabled:m!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),m==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:f.fullAuto!==!1,onChange:e=>N(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!f.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),f.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:f.sandbox||"workspace-write",onChange:e=>N(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:f.approvalMode||"on-request",onChange:e=>N(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:f.profile||"",onChange:e=>N(a=>({...a,profile:e.target.value||void 0}))})]})]})}),x.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),x.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:b,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[X.map(e=>{const a=z.has(e.id);return he.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>xe(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),b&&X.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:b})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:J,onChange:e=>me(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:V.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):V.map(e=>{const a=v.has(e.id),l=O[e.class],w=o.find(ye=>ye.id===e.class),ee=l||w||{icon:"🤖",color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>Me(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ee.color},children:ee.icon}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),v.size>0&&s.jsxs("div",{className:"subordinates-count",children:[v.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:h,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:ve,disabled:T,children:n(T?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{Ue as BossSpawnModal};
@@ -1 +1 @@
1
- import{u as S,b0 as Y,r as m,b1 as X,a$ as w,j as e,f as _,b2 as W,b3 as Z,q as U,h as q,s as y,b4 as z,b5 as A}from"./main-BxXKe5js.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function H({shortcut:t,onUpdate:a}){const{t:s}=S(["config","terminal"]),o=Y(),[l,h]=m.useState(!1),[i,j]=m.useState(null),f=m.useRef(null),v=m.useMemo(()=>i?X(o,i,t.id,t.context):[],[i,o,t.id,t.context]);m.useEffect(()=>{if(!l)return;const p=c=>{if(c.preventDefault(),c.stopPropagation(),c.key==="Escape"&&!c.ctrlKey&&!c.altKey&&!c.shiftKey&&!c.metaKey){h(!1),j(null);return}if(["Control","Alt","Shift","Meta"].includes(c.key))return;let b=c.key;c.code.startsWith("Key")&&c.code.length===4?b=c.code.charAt(3).toLowerCase():c.code.startsWith("Digit")&&c.code.length===6?b=c.code.charAt(5):c.code==="Space"&&(b="Space");const x={key:b,modifiers:{ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey,meta:c.metaKey}};j(x)};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[l]),m.useEffect(()=>{if(!l)return;const p=c=>{f.current&&!f.current.contains(c.target)&&(i&&v.length===0&&a(i),h(!1),j(null))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l,i,v,a]);const k=()=>{l?(i&&v.length===0&&a(i),h(!1),j(null)):(h(!0),j(null))},g=p=>{p.stopPropagation(),a({key:"",modifiers:{}})};let d;return l?i?d=w({...t,...i}):d=s("config:shortcuts.pressKeys"):t.key?d=w(t):d=s("config:shortcuts.notSet"),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{ref:f,className:`key-capture-input ${l?"capturing":""} ${v.length>0?"conflict":""} ${t.enabled?"":"disabled"}`,onClick:k,title:s(l?"config:shortcuts.pressKeysOrClick":"config:shortcuts.clickToChange"),children:e.jsx("span",{className:"key-capture-value",children:d})}),t.key&&!l&&e.jsx("button",{className:"key-capture-clear",onClick:g,title:s("config:shortcuts.clearShortcut"),children:"×"}),v.length>0&&e.jsx("div",{className:"key-capture-conflict",children:s("config:shortcuts.conflictsWith",{names:v.map(p=>s(`terminal:controls.shortcuts.${p.id}.name`,{defaultValue:p.name})).join(", ")})})]})}const V={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},Q={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},R={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},J={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function oe({isOpen:t,onClose:a}){const{t:s}=S(["terminal","common"]),o=_(),l=W(),h=Z(),[i,j]=m.useState("keyboard"),[f,v]=m.useState(""),[k,g]=m.useState("all"),[d,p]=m.useState(!1),[c,b]=m.useState(null),x=U.useRef(null),{handleMouseDown:D,handleClick:M}=q(a);if(m.useEffect(()=>{if(!t||d)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),a())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,a,d]),m.useEffect(()=>{t||(v(""),p(!1),b(null))},[t]),m.useEffect(()=>{if(!t||!d)return;const r=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),p(!1),b(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let u=n.key;n.code.startsWith("Key")&&n.code.length===4?u=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?u=n.code.charAt(5):n.code==="Space"&&(u="Space"),b({key:u,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,d]),!t)return null;const E=o.shortcuts.filter(r=>{const n=s(`terminal:controls.shortcuts.${r.id}.name`,{defaultValue:r.name}),u=s(`terminal:controls.shortcuts.${r.id}.description`,{defaultValue:r.description});if(d&&c){const O=C=>C===" "||C==="Space"?"Space":C.length===1?C.toLowerCase():C,$=O(r.key),B=O(c.key);if(!(B.length===1&&/^[a-zA-Z]$/.test($)?`Key${$.toUpperCase()}`==`Key${B.toUpperCase()}`:$===B))return!1;const K=r.modifiers,T=c.modifiers;return(K.ctrl||!1)===(T.ctrl||!1)&&(K.alt||!1)===(T.alt||!1)&&(K.shift||!1)===(T.shift||!1)&&(K.meta||!1)===(T.meta||!1)}if(!f)return!0;const N=f.toLowerCase();return n.toLowerCase().includes(N)||u.toLowerCase().includes(N)||w(r).toLowerCase().includes(N)}),L=E.reduce((r,n)=>(r[n.context]||(r[n.context]=[]),r[n.context].push(n),r),{}),G=(r,n)=>{y.updateShortcut(r,n)},F=()=>{i==="keyboard"?confirm(s("terminal:controls.confirmResetKeyboard"))&&y.resetShortcuts():i==="mouse"?confirm(s("terminal:controls.confirmResetMouse"))&&y.resetMouseControls():i==="trackpad"&&confirm(s("terminal:controls.confirmResetTrackpad"))&&y.resetMouseControls()},P=["global","commander","toolbox"],I=l.bindings.reduce((r,n)=>(R.camera.includes(n.action)?r.camera.push(n):R.interaction.includes(n.action)&&r.interaction.push(n),r),{camera:[],interaction:[]});return e.jsx("div",{className:"shortcuts-modal-overlay",onMouseDown:D,onClick:M,children:e.jsxs("div",{className:"shortcuts-modal controls-modal",children:[e.jsxs("div",{className:"shortcuts-modal-header",children:[e.jsxs("div",{className:"shortcuts-modal-title",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:s("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:a,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${i==="keyboard"?"active":""}`,onClick:()=>j("keyboard"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),s("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${i==="mouse"?"active":""}`,onClick:()=>j("mouse"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]}),s("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${i==="trackpad"?"active":""}`,onClick:()=>j("trackpad"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),s("terminal:controls.trackpad")]})]}),i==="keyboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[d?e.jsxs("div",{className:"shortcuts-search find-by-shortcut-active",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),c?e.jsxs("span",{className:"find-by-shortcut-display",children:[w({key:c.key,modifiers:c.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>b(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:s("terminal:controls.pressKeyCombination")})]}):e.jsxs("div",{className:"shortcuts-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:x,type:"text",placeholder:s("terminal:controls.searchShortcuts"),value:f,onChange:r=>v(r.target.value),autoFocus:!0}),f&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>v(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${d?"active":""}`,onClick:()=>{p(!d),b(null),v("")},title:s(d?"terminal:controls.switchToTextSearch":"terminal:controls.findByPressingKeys"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]})}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${k==="all"?"active":""}`,onClick:()=>g("all"),children:[s("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:E.length})]}),P.map(r=>{var u;const n=((u=L[r])==null?void 0:u.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${k===r?"active":""}`,onClick:()=>g(r),children:[s(V[r]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},r)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[P.map(r=>{const n=L[r]||[];return n.length===0||k!=="all"&&k!==r?null:e.jsxs("div",{className:"shortcuts-context-group",children:[k==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s(V[r])}),e.jsx("span",{className:"shortcuts-context-description",children:s(Q[r])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:s(`terminal:controls.shortcuts.${u.id}.name`,{defaultValue:u.name})}),e.jsx("span",{className:"shortcut-item-description",children:s(`terminal:controls.shortcuts.${u.id}.description`,{defaultValue:u.description})})]}),e.jsx(H,{shortcut:u,onUpdate:N=>G(u.id,N)})]},u.id))})]},r)}),E.length===0&&e.jsx("div",{className:"shortcuts-empty",children:d?c?e.jsx("p",{children:s("terminal:controls.noShortcutBoundTo",{keys:w({key:c.key,modifiers:c.modifiers})})}):e.jsx("p",{children:s("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:s("terminal:controls.noShortcutsFound",{query:f})})})]})]}),i==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-modal-content mouse-controls-content",children:[e.jsx("div",{className:"mouse-controls-bindings",children:Object.entries(I).map(([r,n])=>e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsx("div",{className:"shortcuts-context-header",children:e.jsx("span",{className:"shortcuts-context-label",children:s(J[r])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsx(ee,{binding:u},u.id))})]},r))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:s("terminal:controls.adjustCameraSpeed")})]}),e.jsx(te,{sensitivity:l.sensitivity})]})]})]}),i==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(se,{config:h})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:s(i==="keyboard"?d?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":i==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]})})}function ee({binding:t}){const{t:a}=S(["terminal"]),s=W(),[o,l]=m.useState(!1),[h,i]=m.useState(null);m.useEffect(()=>{if(!o)return;const d=x=>{x.preventDefault(),x.stopPropagation();const M={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[x.button];M&&i({button:M,modifiers:{ctrl:x.ctrlKey,alt:x.altKey,shift:x.shiftKey,meta:x.metaKey}})},p=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l(!1),i(null))},c=()=>{h&&z(s.bindings,h,t.id).length===0&&y.updateMouseBinding(t.id,{button:h.button,modifiers:h.modifiers}),l(!1),i(null)},b=setTimeout(()=>{document.addEventListener("mousedown",d,!0),document.addEventListener("keydown",p,!0),document.addEventListener("click",c,!0)},100);return()=>{clearTimeout(b),document.removeEventListener("mousedown",d,!0),document.removeEventListener("keydown",p,!0),document.removeEventListener("click",c,!0)}},[o,h,t.id,s.bindings]);const j=h?z(s.bindings,h,t.id):[],f=a(`terminal:controls.mouseBindings.${t.id}.name`,{defaultValue:t.name}),v=a(`terminal:controls.mouseBindings.${t.id}.description`,{defaultValue:t.description}),k=d=>a(`terminal:controls.mouseButtons.${d}`,{defaultValue:d}),g=h?A({...t,...h},k):A(t,k);return e.jsxs("div",{className:`shortcut-item ${t.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:f}),e.jsx("span",{className:"shortcut-item-description",children:v})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${o?"capturing":""} ${j.length>0?"conflict":""}`,onClick:()=>l(!0),children:o?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:g}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:a("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:g})}),j.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[a("terminal:controls.conflicts"),": ",j.map(d=>a(`terminal:controls.mouseBindings.${d.id}.name`,{defaultValue:d.name})).join(", ")]})]})]})}function te({sensitivity:t}){const{t:a}=S(["terminal"]),s=m.useCallback((o,l)=>{y.updateCameraSensitivity({[o]:l})},[]);return e.jsxs("div",{className:"sensitivity-inline-settings",children:[e.jsxs("div",{className:"sensitivity-sliders",children:[e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.panSpeed,onChange:o=>s("panSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.orbitSpeed,onChange:o=>s("orbitSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.zoomSpeed,onChange:o=>s("zoomSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:t.smoothing,onChange:o=>s("smoothing",parseFloat(o.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:t.smoothing.toFixed(1)})]})]}),e.jsxs("div",{className:"sensitivity-checkboxes-inline",children:[e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertPanX,onChange:o=>s("invertPanX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertPanY,onChange:o=>s("invertPanY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitX,onChange:o=>s("invertOrbitX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitY,onChange:o=>s("invertOrbitY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitY")})]})]})]})}function se({config:t}){const{t:a}=S(["terminal"]),s=m.useCallback((l,h)=>{y.updateTrackpadConfig({[l]:h})},[]),o=m.useCallback((l,h)=>{y.updateTrackpadConfig({sensitivity:{[l]:h}})},[]);return e.jsxs("div",{className:"trackpad-settings",children:[e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>s("enabled",l.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:a("terminal:controls.enableTrackpadGestures")})]})})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.pinchToZoom,onChange:l=>s("pinchToZoom",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.twoFingerPan,onChange:l=>s("twoFingerPan",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.shiftTwoFingerOrbit,onChange:l=>s("shiftTwoFingerOrbit",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.shiftTwoFingerOrbitDesc")})]})]})]})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.zoom,onChange:l=>o("zoom",parseFloat(l.target.value)),disabled:!t.enabled||!t.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.pan,onChange:l=>o("pan",parseFloat(l.target.value)),disabled:!t.enabled||!t.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.orbit,onChange:l=>o("orbit",parseFloat(l.target.value)),disabled:!t.enabled||!t.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{oe as ControlsModal};
1
+ import{u as S,b0 as Y,r as m,b1 as X,a$ as w,j as e,f as _,b2 as W,b3 as Z,q as U,h as q,s as y,b4 as z,b5 as A}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function H({shortcut:t,onUpdate:a}){const{t:s}=S(["config","terminal"]),o=Y(),[l,h]=m.useState(!1),[i,j]=m.useState(null),f=m.useRef(null),v=m.useMemo(()=>i?X(o,i,t.id,t.context):[],[i,o,t.id,t.context]);m.useEffect(()=>{if(!l)return;const p=c=>{if(c.preventDefault(),c.stopPropagation(),c.key==="Escape"&&!c.ctrlKey&&!c.altKey&&!c.shiftKey&&!c.metaKey){h(!1),j(null);return}if(["Control","Alt","Shift","Meta"].includes(c.key))return;let b=c.key;c.code.startsWith("Key")&&c.code.length===4?b=c.code.charAt(3).toLowerCase():c.code.startsWith("Digit")&&c.code.length===6?b=c.code.charAt(5):c.code==="Space"&&(b="Space");const x={key:b,modifiers:{ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey,meta:c.metaKey}};j(x)};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[l]),m.useEffect(()=>{if(!l)return;const p=c=>{f.current&&!f.current.contains(c.target)&&(i&&v.length===0&&a(i),h(!1),j(null))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l,i,v,a]);const k=()=>{l?(i&&v.length===0&&a(i),h(!1),j(null)):(h(!0),j(null))},g=p=>{p.stopPropagation(),a({key:"",modifiers:{}})};let d;return l?i?d=w({...t,...i}):d=s("config:shortcuts.pressKeys"):t.key?d=w(t):d=s("config:shortcuts.notSet"),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{ref:f,className:`key-capture-input ${l?"capturing":""} ${v.length>0?"conflict":""} ${t.enabled?"":"disabled"}`,onClick:k,title:s(l?"config:shortcuts.pressKeysOrClick":"config:shortcuts.clickToChange"),children:e.jsx("span",{className:"key-capture-value",children:d})}),t.key&&!l&&e.jsx("button",{className:"key-capture-clear",onClick:g,title:s("config:shortcuts.clearShortcut"),children:"×"}),v.length>0&&e.jsx("div",{className:"key-capture-conflict",children:s("config:shortcuts.conflictsWith",{names:v.map(p=>s(`terminal:controls.shortcuts.${p.id}.name`,{defaultValue:p.name})).join(", ")})})]})}const V={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},Q={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},R={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},J={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function oe({isOpen:t,onClose:a}){const{t:s}=S(["terminal","common"]),o=_(),l=W(),h=Z(),[i,j]=m.useState("keyboard"),[f,v]=m.useState(""),[k,g]=m.useState("all"),[d,p]=m.useState(!1),[c,b]=m.useState(null),x=U.useRef(null),{handleMouseDown:D,handleClick:M}=q(a);if(m.useEffect(()=>{if(!t||d)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),a())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,a,d]),m.useEffect(()=>{t||(v(""),p(!1),b(null))},[t]),m.useEffect(()=>{if(!t||!d)return;const r=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),p(!1),b(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let u=n.key;n.code.startsWith("Key")&&n.code.length===4?u=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?u=n.code.charAt(5):n.code==="Space"&&(u="Space"),b({key:u,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,d]),!t)return null;const E=o.shortcuts.filter(r=>{const n=s(`terminal:controls.shortcuts.${r.id}.name`,{defaultValue:r.name}),u=s(`terminal:controls.shortcuts.${r.id}.description`,{defaultValue:r.description});if(d&&c){const O=C=>C===" "||C==="Space"?"Space":C.length===1?C.toLowerCase():C,$=O(r.key),B=O(c.key);if(!(B.length===1&&/^[a-zA-Z]$/.test($)?`Key${$.toUpperCase()}`==`Key${B.toUpperCase()}`:$===B))return!1;const K=r.modifiers,T=c.modifiers;return(K.ctrl||!1)===(T.ctrl||!1)&&(K.alt||!1)===(T.alt||!1)&&(K.shift||!1)===(T.shift||!1)&&(K.meta||!1)===(T.meta||!1)}if(!f)return!0;const N=f.toLowerCase();return n.toLowerCase().includes(N)||u.toLowerCase().includes(N)||w(r).toLowerCase().includes(N)}),L=E.reduce((r,n)=>(r[n.context]||(r[n.context]=[]),r[n.context].push(n),r),{}),G=(r,n)=>{y.updateShortcut(r,n)},F=()=>{i==="keyboard"?confirm(s("terminal:controls.confirmResetKeyboard"))&&y.resetShortcuts():i==="mouse"?confirm(s("terminal:controls.confirmResetMouse"))&&y.resetMouseControls():i==="trackpad"&&confirm(s("terminal:controls.confirmResetTrackpad"))&&y.resetMouseControls()},P=["global","commander","toolbox"],I=l.bindings.reduce((r,n)=>(R.camera.includes(n.action)?r.camera.push(n):R.interaction.includes(n.action)&&r.interaction.push(n),r),{camera:[],interaction:[]});return e.jsx("div",{className:"shortcuts-modal-overlay",onMouseDown:D,onClick:M,children:e.jsxs("div",{className:"shortcuts-modal controls-modal",children:[e.jsxs("div",{className:"shortcuts-modal-header",children:[e.jsxs("div",{className:"shortcuts-modal-title",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:s("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:a,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${i==="keyboard"?"active":""}`,onClick:()=>j("keyboard"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),s("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${i==="mouse"?"active":""}`,onClick:()=>j("mouse"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]}),s("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${i==="trackpad"?"active":""}`,onClick:()=>j("trackpad"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),s("terminal:controls.trackpad")]})]}),i==="keyboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[d?e.jsxs("div",{className:"shortcuts-search find-by-shortcut-active",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),c?e.jsxs("span",{className:"find-by-shortcut-display",children:[w({key:c.key,modifiers:c.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>b(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:s("terminal:controls.pressKeyCombination")})]}):e.jsxs("div",{className:"shortcuts-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:x,type:"text",placeholder:s("terminal:controls.searchShortcuts"),value:f,onChange:r=>v(r.target.value),autoFocus:!0}),f&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>v(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${d?"active":""}`,onClick:()=>{p(!d),b(null),v("")},title:s(d?"terminal:controls.switchToTextSearch":"terminal:controls.findByPressingKeys"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]})}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${k==="all"?"active":""}`,onClick:()=>g("all"),children:[s("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:E.length})]}),P.map(r=>{var u;const n=((u=L[r])==null?void 0:u.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${k===r?"active":""}`,onClick:()=>g(r),children:[s(V[r]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},r)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[P.map(r=>{const n=L[r]||[];return n.length===0||k!=="all"&&k!==r?null:e.jsxs("div",{className:"shortcuts-context-group",children:[k==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s(V[r])}),e.jsx("span",{className:"shortcuts-context-description",children:s(Q[r])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:s(`terminal:controls.shortcuts.${u.id}.name`,{defaultValue:u.name})}),e.jsx("span",{className:"shortcut-item-description",children:s(`terminal:controls.shortcuts.${u.id}.description`,{defaultValue:u.description})})]}),e.jsx(H,{shortcut:u,onUpdate:N=>G(u.id,N)})]},u.id))})]},r)}),E.length===0&&e.jsx("div",{className:"shortcuts-empty",children:d?c?e.jsx("p",{children:s("terminal:controls.noShortcutBoundTo",{keys:w({key:c.key,modifiers:c.modifiers})})}):e.jsx("p",{children:s("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:s("terminal:controls.noShortcutsFound",{query:f})})})]})]}),i==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-modal-content mouse-controls-content",children:[e.jsx("div",{className:"mouse-controls-bindings",children:Object.entries(I).map(([r,n])=>e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsx("div",{className:"shortcuts-context-header",children:e.jsx("span",{className:"shortcuts-context-label",children:s(J[r])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsx(ee,{binding:u},u.id))})]},r))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:s("terminal:controls.adjustCameraSpeed")})]}),e.jsx(te,{sensitivity:l.sensitivity})]})]})]}),i==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(se,{config:h})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:s(i==="keyboard"?d?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":i==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]})})}function ee({binding:t}){const{t:a}=S(["terminal"]),s=W(),[o,l]=m.useState(!1),[h,i]=m.useState(null);m.useEffect(()=>{if(!o)return;const d=x=>{x.preventDefault(),x.stopPropagation();const M={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[x.button];M&&i({button:M,modifiers:{ctrl:x.ctrlKey,alt:x.altKey,shift:x.shiftKey,meta:x.metaKey}})},p=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l(!1),i(null))},c=()=>{h&&z(s.bindings,h,t.id).length===0&&y.updateMouseBinding(t.id,{button:h.button,modifiers:h.modifiers}),l(!1),i(null)},b=setTimeout(()=>{document.addEventListener("mousedown",d,!0),document.addEventListener("keydown",p,!0),document.addEventListener("click",c,!0)},100);return()=>{clearTimeout(b),document.removeEventListener("mousedown",d,!0),document.removeEventListener("keydown",p,!0),document.removeEventListener("click",c,!0)}},[o,h,t.id,s.bindings]);const j=h?z(s.bindings,h,t.id):[],f=a(`terminal:controls.mouseBindings.${t.id}.name`,{defaultValue:t.name}),v=a(`terminal:controls.mouseBindings.${t.id}.description`,{defaultValue:t.description}),k=d=>a(`terminal:controls.mouseButtons.${d}`,{defaultValue:d}),g=h?A({...t,...h},k):A(t,k);return e.jsxs("div",{className:`shortcut-item ${t.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:f}),e.jsx("span",{className:"shortcut-item-description",children:v})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${o?"capturing":""} ${j.length>0?"conflict":""}`,onClick:()=>l(!0),children:o?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:g}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:a("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:g})}),j.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[a("terminal:controls.conflicts"),": ",j.map(d=>a(`terminal:controls.mouseBindings.${d.id}.name`,{defaultValue:d.name})).join(", ")]})]})]})}function te({sensitivity:t}){const{t:a}=S(["terminal"]),s=m.useCallback((o,l)=>{y.updateCameraSensitivity({[o]:l})},[]);return e.jsxs("div",{className:"sensitivity-inline-settings",children:[e.jsxs("div",{className:"sensitivity-sliders",children:[e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.panSpeed,onChange:o=>s("panSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.orbitSpeed,onChange:o=>s("orbitSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.zoomSpeed,onChange:o=>s("zoomSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:t.smoothing,onChange:o=>s("smoothing",parseFloat(o.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:t.smoothing.toFixed(1)})]})]}),e.jsxs("div",{className:"sensitivity-checkboxes-inline",children:[e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertPanX,onChange:o=>s("invertPanX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertPanY,onChange:o=>s("invertPanY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitX,onChange:o=>s("invertOrbitX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitY,onChange:o=>s("invertOrbitY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitY")})]})]})]})}function se({config:t}){const{t:a}=S(["terminal"]),s=m.useCallback((l,h)=>{y.updateTrackpadConfig({[l]:h})},[]),o=m.useCallback((l,h)=>{y.updateTrackpadConfig({sensitivity:{[l]:h}})},[]);return e.jsxs("div",{className:"trackpad-settings",children:[e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>s("enabled",l.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:a("terminal:controls.enableTrackpadGestures")})]})})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.pinchToZoom,onChange:l=>s("pinchToZoom",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.twoFingerPan,onChange:l=>s("twoFingerPan",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.shiftTwoFingerOrbit,onChange:l=>s("shiftTwoFingerOrbit",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.shiftTwoFingerOrbitDesc")})]})]})]})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.zoom,onChange:l=>o("zoom",parseFloat(l.target.value)),disabled:!t.enabled||!t.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.pan,onChange:l=>o("pan",parseFloat(l.target.value)),disabled:!t.enabled||!t.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.orbit,onChange:l=>o("orbit",parseFloat(l.target.value)),disabled:!t.enabled||!t.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{oe as ControlsModal};
@@ -1,2 +1,2 @@
1
- import{u as l,f as L,r as m,s as r,j as x}from"./main-BxXKe5js.js";import{L as S}from"./LogViewerModal-CHscrq-v.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function B({building:t,isOpen:o,onClose:n}){var a;const{t:i}=l(["terminal"]),{streamingBuildingLogs:c,streamingBuildingIds:g}=L(),s=c.get(t.id)||"",p=g.has(t.id);m.useEffect(()=>{var e;return o&&((e=t.docker)!=null&&e.enabled)&&r.startLogStreaming(t.id,200),()=>{t.id&&r.stopLogStreaming(t.id)}},[o,t.id,(a=t.docker)==null?void 0:a.enabled]);const d=m.useMemo(()=>s.split(`
1
+ import{u as l,f as L,r as m,s as r,j as x}from"./main-B_diMezF.js";import{L as S}from"./LogViewerModal-wKmq37Bu.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function B({building:t,isOpen:o,onClose:n}){var a;const{t:i}=l(["terminal"]),{streamingBuildingLogs:c,streamingBuildingIds:g}=L(),s=c.get(t.id)||"",p=g.has(t.id);m.useEffect(()=>{var e;return o&&((e=t.docker)!=null&&e.enabled)&&r.startLogStreaming(t.id,200),()=>{t.id&&r.stopLogStreaming(t.id)}},[o,t.id,(a=t.docker)==null?void 0:a.enabled]);const d=m.useMemo(()=>s.split(`
2
2
  `).map((e,f)=>({text:e,lineNumber:f+1})),[s]);return x.jsx(S,{isOpen:o,onClose:n,title:`${t.name} - ${i("terminal:logs.dockerLogs")}`,icon:"🐳",lines:d,isStreaming:p,onClear:()=>r.clearStreamingLogs(t.id)})}export{B as DockerLogsModal};
@@ -1 +1 @@
1
- import{r as e,j as s}from"./main-BxXKe5js.js";import{g as j,l as k,h as N,a as R,f as T,d as A,r as w,i as C,b as K,c as L,e as M,j as q,s as B,k as D,o as G,E as f,m as H,n as O,p as V,q as W,t as F,u as I,v as U,w as Y,x as z}from"./index-DEqOMh2B.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";const J=1e3,ee=({content:_,extension:p,onSave:h,onCancel:b})=>{const c=e.useRef(null),i=e.useRef(null),t=e.useRef(null),o=e.useRef(!1),v=e.useRef(h);v.current=h;const[u,d]=e.useState("idle"),[S,l]=e.useState(null),a=e.useCallback(async()=>{if(!(!i.current||o.current)){o.current=!0,d("saving"),l(null);try{const r=i.current.state.doc.toString();await v.current(r),d("saved"),setTimeout(()=>d(n=>n==="saved"?"idle":n),1500)}catch(r){d("error"),l(r.message||"Save failed")}finally{o.current=!1}}},[]),x=e.useCallback(()=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{a()},J)},[a]),g=e.useCallback(()=>{t.current&&(clearTimeout(t.current),t.current=null,a()),b()},[b,a]);return e.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]),e.useEffect(()=>{if(!c.current)return;const r=j(p),n=[k(),N(),R(),T(),A(),w(),C(),K(),L(),M(),q(),B({top:!0}),D(z,{fallback:!0}),G,f.lineWrapping,H.of([...O,...V,...W,...F,...I,U,{key:"Mod-s",run:()=>(t.current&&(clearTimeout(t.current),t.current=null),a(),!0)},{key:"Escape",run:()=>(g(),!0)}]),f.updateListener.of(y=>{y.docChanged&&(l(null),x())})];r&&n.push(r);const E=Y.create({doc:_,extensions:n}),m=new f({state:E,parent:c.current});return i.current=m,requestAnimationFrame(()=>m.focus()),()=>{m.destroy(),i.current=null}},[]),s.jsxs("div",{className:"embedded-editor",children:[s.jsxs("div",{className:"embedded-editor__toolbar",children:[s.jsxs("div",{className:"embedded-editor__toolbar-left",children:[u==="saving"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saving",children:"Saving..."}),u==="saved"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saved",children:"Saved"}),u==="error"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--error",children:S||"Save failed"})]}),s.jsxs("div",{className:"embedded-editor__toolbar-right",children:[s.jsx("span",{className:"embedded-editor__shortcut-hint",children:"Auto-saves · Esc to close"}),s.jsx("button",{className:"embedded-editor__btn embedded-editor__btn--close",onClick:g,children:"Close"})]})]}),s.jsx("div",{className:"embedded-editor__container",ref:c})]})};export{ee as EmbeddedEditor};
1
+ import{r as e,j as s}from"./main-B_diMezF.js";import{g as j,l as k,h as N,a as R,f as T,d as A,r as w,i as C,b as K,c as L,e as M,j as q,s as B,k as D,o as G,E as f,m as H,n as O,p as V,q as W,t as F,u as I,v as U,w as Y,x as z}from"./index-2eGWcGUM.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";const J=1e3,ee=({content:_,extension:p,onSave:h,onCancel:b})=>{const c=e.useRef(null),i=e.useRef(null),t=e.useRef(null),o=e.useRef(!1),v=e.useRef(h);v.current=h;const[u,d]=e.useState("idle"),[S,l]=e.useState(null),a=e.useCallback(async()=>{if(!(!i.current||o.current)){o.current=!0,d("saving"),l(null);try{const r=i.current.state.doc.toString();await v.current(r),d("saved"),setTimeout(()=>d(n=>n==="saved"?"idle":n),1500)}catch(r){d("error"),l(r.message||"Save failed")}finally{o.current=!1}}},[]),x=e.useCallback(()=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{a()},J)},[a]),g=e.useCallback(()=>{t.current&&(clearTimeout(t.current),t.current=null,a()),b()},[b,a]);return e.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]),e.useEffect(()=>{if(!c.current)return;const r=j(p),n=[k(),N(),R(),T(),A(),w(),C(),K(),L(),M(),q(),B({top:!0}),D(z,{fallback:!0}),G,f.lineWrapping,H.of([...O,...V,...W,...F,...I,U,{key:"Mod-s",run:()=>(t.current&&(clearTimeout(t.current),t.current=null),a(),!0)},{key:"Escape",run:()=>(g(),!0)}]),f.updateListener.of(y=>{y.docChanged&&(l(null),x())})];r&&n.push(r);const E=Y.create({doc:_,extensions:n}),m=new f({state:E,parent:c.current});return i.current=m,requestAnimationFrame(()=>m.focus()),()=>{m.destroy(),i.current=null}},[]),s.jsxs("div",{className:"embedded-editor",children:[s.jsxs("div",{className:"embedded-editor__toolbar",children:[s.jsxs("div",{className:"embedded-editor__toolbar-left",children:[u==="saving"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saving",children:"Saving..."}),u==="saved"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saved",children:"Saved"}),u==="error"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--error",children:S||"Save failed"})]}),s.jsxs("div",{className:"embedded-editor__toolbar-right",children:[s.jsx("span",{className:"embedded-editor__shortcut-hint",children:"Auto-saves · Esc to close"}),s.jsx("button",{className:"embedded-editor__btn embedded-editor__btn--close",onClick:g,children:"Close"})]})]}),s.jsx("div",{className:"embedded-editor__container",ref:c})]})};export{ee as EmbeddedEditor};
@@ -1 +1 @@
1
- import{u as K,r as a,j as e}from"./main-BxXKe5js.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function ae({url:l,title:W,isOpen:g,onClose:I,initialWidth:H=480,initialHeight:B=360,minWidth:M=320,minHeight:b=240}){const{t:n}=K(["terminal","common"]),[Z,h]=a.useState(!0),[L,k]=a.useState(!1),[o,$]=a.useState({width:H,height:B}),[s,y]=a.useState(null),[f,z]=a.useState(1),[O,R]=a.useState(!1),[T,X]=a.useState(!1),N=a.useRef(null),U=a.useRef(null),d=a.useRef(null),r=a.useRef(null);a.useEffect(()=>{if(g&&!s){const t=Math.max(50,(window.innerWidth-o.width)/2),c=Math.max(50,(window.innerHeight-o.height)/2);y({x:t,y:c})}},[g,s,o.width,o.height]),a.useEffect(()=>{h(!0),k(!1)},[l]);const A=a.useCallback(()=>{h(!1)},[]),V=a.useCallback(()=>{h(!1),k(!0)},[]),Y=a.useCallback(()=>{N.current&&(h(!0),k(!1),N.current.src=l)},[l]),_=a.useCallback(()=>{window.open(l,"_blank")},[l]),q=a.useCallback(()=>{z(t=>Math.min(2,t+.25))},[]),F=a.useCallback(()=>{z(t=>Math.max(.25,t-.25))},[]),G=a.useCallback(()=>{z(1)},[]),J=a.useCallback(t=>{if(t.target.closest(".iframe-modal-btn"))return;t.preventDefault(),R(!0),d.current={startX:t.clientX,startY:t.clientY,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0};const c=m=>{if(!d.current)return;const w=m.clientX-d.current.startX,j=m.clientY-d.current.startY;y({x:Math.max(0,Math.min(window.innerWidth-100,d.current.startPosX+w)),y:Math.max(0,Math.min(window.innerHeight-50,d.current.startPosY+j))})},x=()=>{d.current=null,R(!1),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",x)},[s]),i=a.useCallback((t,c)=>{t.preventDefault(),t.stopPropagation(),X(!0);const x={startX:t.clientX,startY:t.clientY,startW:o.width,startH:o.height,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0,direction:c};r.current=x;const m=j=>{if(!r.current)return;const p=j.clientX-r.current.startX,C=j.clientY-r.current.startY,v=r.current.direction;let E=r.current.startW,D=r.current.startH,P=r.current.startPosX,S=r.current.startPosY;if(v.includes("e")&&(E=Math.max(M,r.current.startW+p)),v.includes("w")){const u=r.current.startW-p;u>=M&&(E=u,P=r.current.startPosX+p)}if(v.includes("s")&&(D=Math.max(b,r.current.startH+C)),v.includes("n")){const u=r.current.startH-C;u>=b&&(D=u,S=r.current.startPosY+C)}$({width:E,height:D}),y({x:P,y:S})},w=()=>{r.current=null,X(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",m),document.addEventListener("mouseup",w)},[o,s,M,b]);return g?e.jsxs("div",{ref:U,className:`iframe-modal ${O?"dragging":""} ${T?"resizing":""}`,style:{left:(s==null?void 0:s.x)??0,top:(s==null?void 0:s.y)??0,width:o.width,height:o.height},children:[e.jsxs("div",{className:"iframe-modal-toolbar",onMouseDown:J,children:[e.jsx("div",{className:"iframe-modal-title",title:l,children:W||l}),e.jsxs("div",{className:"iframe-modal-actions",children:[e.jsx("button",{className:"iframe-modal-btn",onClick:F,title:n("terminal:iframeModal.zoomOut"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("button",{className:"iframe-modal-btn iframe-modal-zoom-label",onClick:G,title:n("terminal:iframeModal.resetZoom"),children:[Math.round(f*100),"%"]}),e.jsx("button",{className:"iframe-modal-btn",onClick:q,title:n("terminal:iframeModal.zoomIn"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("div",{className:"iframe-modal-separator"}),e.jsx("button",{className:"iframe-modal-btn",onClick:Y,title:n("terminal:iframeModal.refresh"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M23 4v6h-6M1 20v-6h6"}),e.jsx("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]})}),e.jsx("button",{className:"iframe-modal-btn",onClick:_,title:n("terminal:iframeModal.openInBrowser"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}),e.jsx("button",{className:"iframe-modal-btn iframe-modal-close",onClick:I,title:n("common:buttons.close"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"iframe-modal-content",children:[Z&&e.jsxs("div",{className:"iframe-modal-loading",children:[e.jsx("div",{className:"iframe-modal-spinner"}),e.jsx("span",{children:n("common:status.loading")})]}),L&&e.jsxs("div",{className:"iframe-modal-error",children:[e.jsx("span",{children:n("terminal:iframeModal.failedToLoad")}),e.jsx("button",{onClick:Y,children:n("terminal:iframeModal.retry")})]}),e.jsx("iframe",{ref:N,src:l,className:"iframe-modal-frame",onLoad:A,onError:V,style:{display:L?"none":"block",transform:`scale(${f})`,transformOrigin:"top left",width:`${100/f}%`,height:`${100/f}%`}})]}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-n",onMouseDown:t=>i(t,"n")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-s",onMouseDown:t=>i(t,"s")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-e",onMouseDown:t=>i(t,"e")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-w",onMouseDown:t=>i(t,"w")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-ne",onMouseDown:t=>i(t,"ne")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-nw",onMouseDown:t=>i(t,"nw")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-se",onMouseDown:t=>i(t,"se")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-sw",onMouseDown:t=>i(t,"sw")})]}):null}export{ae as IframeModal,ae as default};
1
+ import{u as K,r as a,j as e}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function ae({url:l,title:W,isOpen:g,onClose:I,initialWidth:H=480,initialHeight:B=360,minWidth:M=320,minHeight:b=240}){const{t:n}=K(["terminal","common"]),[Z,h]=a.useState(!0),[L,k]=a.useState(!1),[o,$]=a.useState({width:H,height:B}),[s,y]=a.useState(null),[f,z]=a.useState(1),[O,R]=a.useState(!1),[T,X]=a.useState(!1),N=a.useRef(null),U=a.useRef(null),d=a.useRef(null),r=a.useRef(null);a.useEffect(()=>{if(g&&!s){const t=Math.max(50,(window.innerWidth-o.width)/2),c=Math.max(50,(window.innerHeight-o.height)/2);y({x:t,y:c})}},[g,s,o.width,o.height]),a.useEffect(()=>{h(!0),k(!1)},[l]);const A=a.useCallback(()=>{h(!1)},[]),V=a.useCallback(()=>{h(!1),k(!0)},[]),Y=a.useCallback(()=>{N.current&&(h(!0),k(!1),N.current.src=l)},[l]),_=a.useCallback(()=>{window.open(l,"_blank")},[l]),q=a.useCallback(()=>{z(t=>Math.min(2,t+.25))},[]),F=a.useCallback(()=>{z(t=>Math.max(.25,t-.25))},[]),G=a.useCallback(()=>{z(1)},[]),J=a.useCallback(t=>{if(t.target.closest(".iframe-modal-btn"))return;t.preventDefault(),R(!0),d.current={startX:t.clientX,startY:t.clientY,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0};const c=m=>{if(!d.current)return;const w=m.clientX-d.current.startX,j=m.clientY-d.current.startY;y({x:Math.max(0,Math.min(window.innerWidth-100,d.current.startPosX+w)),y:Math.max(0,Math.min(window.innerHeight-50,d.current.startPosY+j))})},x=()=>{d.current=null,R(!1),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",x)},[s]),i=a.useCallback((t,c)=>{t.preventDefault(),t.stopPropagation(),X(!0);const x={startX:t.clientX,startY:t.clientY,startW:o.width,startH:o.height,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0,direction:c};r.current=x;const m=j=>{if(!r.current)return;const p=j.clientX-r.current.startX,C=j.clientY-r.current.startY,v=r.current.direction;let E=r.current.startW,D=r.current.startH,P=r.current.startPosX,S=r.current.startPosY;if(v.includes("e")&&(E=Math.max(M,r.current.startW+p)),v.includes("w")){const u=r.current.startW-p;u>=M&&(E=u,P=r.current.startPosX+p)}if(v.includes("s")&&(D=Math.max(b,r.current.startH+C)),v.includes("n")){const u=r.current.startH-C;u>=b&&(D=u,S=r.current.startPosY+C)}$({width:E,height:D}),y({x:P,y:S})},w=()=>{r.current=null,X(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",m),document.addEventListener("mouseup",w)},[o,s,M,b]);return g?e.jsxs("div",{ref:U,className:`iframe-modal ${O?"dragging":""} ${T?"resizing":""}`,style:{left:(s==null?void 0:s.x)??0,top:(s==null?void 0:s.y)??0,width:o.width,height:o.height},children:[e.jsxs("div",{className:"iframe-modal-toolbar",onMouseDown:J,children:[e.jsx("div",{className:"iframe-modal-title",title:l,children:W||l}),e.jsxs("div",{className:"iframe-modal-actions",children:[e.jsx("button",{className:"iframe-modal-btn",onClick:F,title:n("terminal:iframeModal.zoomOut"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("button",{className:"iframe-modal-btn iframe-modal-zoom-label",onClick:G,title:n("terminal:iframeModal.resetZoom"),children:[Math.round(f*100),"%"]}),e.jsx("button",{className:"iframe-modal-btn",onClick:q,title:n("terminal:iframeModal.zoomIn"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("div",{className:"iframe-modal-separator"}),e.jsx("button",{className:"iframe-modal-btn",onClick:Y,title:n("terminal:iframeModal.refresh"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M23 4v6h-6M1 20v-6h6"}),e.jsx("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]})}),e.jsx("button",{className:"iframe-modal-btn",onClick:_,title:n("terminal:iframeModal.openInBrowser"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}),e.jsx("button",{className:"iframe-modal-btn iframe-modal-close",onClick:I,title:n("common:buttons.close"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"iframe-modal-content",children:[Z&&e.jsxs("div",{className:"iframe-modal-loading",children:[e.jsx("div",{className:"iframe-modal-spinner"}),e.jsx("span",{children:n("common:status.loading")})]}),L&&e.jsxs("div",{className:"iframe-modal-error",children:[e.jsx("span",{children:n("terminal:iframeModal.failedToLoad")}),e.jsx("button",{onClick:Y,children:n("terminal:iframeModal.retry")})]}),e.jsx("iframe",{ref:N,src:l,className:"iframe-modal-frame",onLoad:A,onError:V,style:{display:L?"none":"block",transform:`scale(${f})`,transformOrigin:"top left",width:`${100/f}%`,height:`${100/f}%`}})]}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-n",onMouseDown:t=>i(t,"n")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-s",onMouseDown:t=>i(t,"s")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-e",onMouseDown:t=>i(t,"e")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-w",onMouseDown:t=>i(t,"w")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-ne",onMouseDown:t=>i(t,"ne")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-nw",onMouseDown:t=>i(t,"nw")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-se",onMouseDown:t=>i(t,"se")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-sw",onMouseDown:t=>i(t,"sw")})]}):null}export{ae as IframeModal,ae as default};
@@ -1 +1 @@
1
- import{u as ue,r as l,h as he,j as e,i as de}from"./main-BxXKe5js.js";function ge({isOpen:E,onClose:w,title:Q,icon:_,lines:c,isStreaming:P,onClear:q,emptyMessage:U,streamingIndicatorLabel:z,extraToolbar:J,extraFooter:X,modalClassName:Y}){const{t:a}=ue(["terminal","common"]),[u,$]=l.useState(""),[h,L]=l.useState(!1),[x,S]=l.useState(!1),[M,R]=l.useState(""),[k,p]=l.useState(!0),[D,Z]=l.useState(!0),[O,B]=l.useState(null),[r,ee]=l.useState([]),[m,j]=l.useState(0),[v,te]=l.useState(!1),[T,se]=l.useState(5),[F,C]=l.useState(null),[y,le]=l.useState(!0),o=l.useRef(null),I=l.useRef(null),A=l.useRef(null),H=l.useRef(!1),V=l.useRef(0),K=l.useMemo(()=>c.map(t=>t.text),[c]),b=l.useMemo(()=>{if(!u)return C(null),null;try{const t=v?u:u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(t,"gi");return C(null),s}catch(t){return C(t.message),null}},[u,v]),N=l.useMemo(()=>{if(!b)return[];const t=[];for(let s=0;s<K.length;s++)b.test(K[s])&&t.push(s),b.lastIndex=0;return t},[K,b]);l.useEffect(()=>{ee(N),m>=N.length&&j(Math.max(0,N.length-1))},[N]);const ne=l.useMemo(()=>{const t=c.map((i,f)=>({entry:i,originalIndex:f}));if(!u||!b||y)return t;if(N.length===0)return[];const s=new Set;for(const i of N){const f=Math.max(0,i-T),ie=Math.min(c.length-1,i+T);for(let G=f;G<=ie;G++)s.add(G)}const n=Array.from(s).sort((i,f)=>i-f),d=[];for(let i=0;i<n.length;i++){const f=n[i];i>0&&f-n[i-1]>1&&d.push({entry:{text:"",lineNumber:-1},originalIndex:-1,isSeparator:!0}),d.push({entry:c[f],originalIndex:f})}return d},[c,u,b,N,T,y]);l.useEffect(()=>{k&&o.current&&c.length>V.current&&(H.current=!0,requestAnimationFrame(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight),setTimeout(()=>{H.current=!1},50)})),V.current=c.length},[c.length,k]),l.useEffect(()=>{h&&I.current&&I.current.focus()},[h]),l.useEffect(()=>{x&&A.current&&A.current.focus()},[x]);const g=l.useCallback(t=>{if(!o.current)return;const n=t*18;o.current.scrollTop=n-100,B(t),setTimeout(()=>B(null),2e3)},[]);l.useEffect(()=>{if(!E)return;const t=s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),h?L(!1):x?S(!1):w();return}if(s.key==="/"&&!h&&!x&&(s.preventDefault(),L(!0)),s.key==="g"&&s.ctrlKey&&(s.preventDefault(),S(!0)),s.key==="End"&&s.ctrlKey&&o.current&&(o.current.scrollTop=o.current.scrollHeight),s.key==="Home"&&s.ctrlKey&&o.current&&(o.current.scrollTop=0),(s.key==="F3"||s.key==="Enter"&&h)&&r.length>0)if(s.preventDefault(),s.shiftKey){const n=(m-1+r.length)%r.length;j(n),g(r[n])}else{const n=(m+1)%r.length;j(n),g(r[n])}if(!h&&!x&&r.length>0){if(s.key==="n"&&!s.ctrlKey){s.preventDefault();const n=(m+1)%r.length;j(n),g(r[n])}else if(s.key==="N"){s.preventDefault();const n=(m-1+r.length)%r.length;j(n),g(r[n])}}!h&&!x&&o.current&&(s.key==="j"?(s.preventDefault(),o.current.scrollTop+=60,p(!1)):s.key==="k"?(s.preventDefault(),o.current.scrollTop-=60,p(!1)):s.key==="G"&&!s.ctrlKey?(s.preventDefault(),o.current.scrollTop=o.current.scrollHeight,p(!0)):s.key==="g"&&!s.ctrlKey&&(s.preventDefault(),o.current.scrollTop=0,p(!1)))};return window.addEventListener("keydown",t,{capture:!0}),()=>window.removeEventListener("keydown",t,{capture:!0})},[E,h,x,r,m,w,g]);const W=l.useCallback(()=>{const t=parseInt(M,10);!isNaN(t)&&t>0&&t<=c.length&&(g(t-1),p(!1)),S(!1),R("")},[M,c.length,g]),re=l.useCallback(()=>{if(H.current||!o.current)return;const{scrollTop:t,scrollHeight:s,clientHeight:n}=o.current,d=s-t-n<50;!d&&k&&p(!1),d&&!k&&p(!0)},[k]),ae=l.useCallback(t=>{if(!u||!b)return t;const s=v?u:u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");try{const n=new RegExp(`(${s})`,"gi");return t.replace(n,'<mark class="search-highlight">$1</mark>')}catch{return t}},[u,b,v]),{handleMouseDown:oe,handleClick:ce}=he(w);return E?e.jsx("div",{className:"pm2-logs-modal-overlay",onMouseDown:oe,onClick:ce,children:e.jsxs("div",{className:`pm2-logs-modal ${Y||""}`,children:[e.jsxs("div",{className:"pm2-logs-modal-header",children:[e.jsxs("div",{className:"header-left",children:[e.jsx("span",{className:"modal-icon",children:_}),e.jsx("span",{className:"modal-title",children:Q}),P&&e.jsxs("span",{className:"streaming-indicator",title:"Live streaming",children:[e.jsx("span",{className:"pulse"}),z||a("terminal:logs.live")]})]}),e.jsxs("div",{className:"header-right",children:[e.jsx("span",{className:"line-count",children:a("terminal:logs.lines",{count:c.length})}),e.jsx("button",{className:"modal-close",onClick:w,title:a("terminal:logs.closeEsc"),children:"×"})]})]}),e.jsxs("div",{className:"pm2-logs-modal-toolbar",children:[e.jsxs("div",{className:"toolbar-left",children:[e.jsxs("button",{className:`toolbar-btn ${h?"active":""}`,onClick:()=>L(!h),title:a("terminal:logs.searchShortcut"),children:["🔍 ",a("terminal:logs.search")]}),e.jsxs("button",{className:"toolbar-btn",onClick:()=>S(!0),title:a("terminal:logs.goToLineShortcut"),children:["⏬ ",a("terminal:logs.goToLine")]}),J,e.jsxs("button",{className:`toolbar-btn ${D?"active":""}`,onClick:()=>Z(!D),title:a("terminal:logs.toggleWrap"),children:["↩ ",a("terminal:logs.wrap")]}),e.jsxs("button",{className:`toolbar-btn ${k?"active":""}`,onClick:()=>p(!k),title:a("terminal:logs.autoScrollToBottom"),children:["↓ ",a("terminal:logs.auto")]})]}),e.jsx("div",{className:"toolbar-right",children:e.jsxs("button",{className:"toolbar-btn danger",onClick:q,title:a("terminal:logs.clear"),children:["🗑 ",a("terminal:logs.clear")]})})]}),h&&e.jsxs("div",{className:"pm2-logs-search-bar",children:[e.jsx("input",{ref:I,type:"text",placeholder:a(v?"terminal:logs.regexPlaceholder":"terminal:logs.searchPlaceholder"),value:u,onChange:t=>{$(t.target.value),j(0)},onKeyDown:t=>{t.key==="Escape"&&(L(!1),$(""),C(null))}}),e.jsx("button",{className:`toolbar-btn small ${v?"active":""}`,onClick:()=>te(!v),title:"Toggle regex mode",children:".*"}),e.jsx("button",{className:`toolbar-btn small ${y?"active":""}`,onClick:()=>le(!y),title:y?"Show all lines (highlight matches)":"Show only context around matches",children:y?"All":"Ctx"}),e.jsxs("div",{className:`context-control ${y?"hidden":""}`,title:"Lines of context around matches",children:[e.jsx("label",{children:"±"}),e.jsx("input",{type:"number",min:"0",max:"100",value:T,onChange:t=>se(Math.max(0,parseInt(t.target.value)||0)),className:"context-input"})]}),e.jsx("button",{className:"toolbar-btn small",onClick:()=>{if(r.length===0)return;const t=(m-1+r.length)%r.length;j(t),g(r[t])},disabled:r.length===0,title:"Previous match (Shift+F3)",children:"▲"}),e.jsx("button",{className:"toolbar-btn small",onClick:()=>{if(r.length===0)return;const t=(m+1)%r.length;j(t),g(r[t])},disabled:r.length===0,title:"Next match (F3)",children:"▼"}),u&&e.jsx("span",{className:"match-count",children:F?e.jsx("span",{className:"regex-error",title:F,children:a("terminal:logs.invalidRegex")}):r.length>0?`${m+1}/${r.length}`:a("terminal:logs.noMatches")}),e.jsx("button",{className:"search-close",onClick:()=>{L(!1),$(""),C(null)},children:"×"})]}),x&&e.jsxs("div",{className:"pm2-logs-goto-line",children:[e.jsxs("label",{children:[a("terminal:logs.goToLineLabel"),":"]}),e.jsx("input",{ref:A,type:"number",min:"1",max:c.length,placeholder:`1-${c.length}`,value:M,onChange:t=>R(t.target.value),onKeyDown:t=>{t.key==="Enter"?W():t.key==="Escape"&&(S(!1),R(""))}}),e.jsx("button",{onClick:W,children:a("terminal:logs.go")}),e.jsx("button",{onClick:()=>S(!1),children:a("common:buttons.cancel")})]}),e.jsx("div",{ref:o,className:`pm2-logs-content ${D?"wrap":"nowrap"}`,onScroll:re,children:c.length===0?e.jsx("div",{className:"logs-empty",children:U||a(P?"terminal:logs.waitingForLogs":"terminal:logs.noLogs")}):e.jsx("div",{className:"logs-lines",children:ne.map((t,s)=>{if("isSeparator"in t&&t.isSeparator)return e.jsxs("div",{className:"log-separator",children:[e.jsx("span",{className:"separator-line"}),e.jsx("span",{className:"separator-label",children:"…"}),e.jsx("span",{className:"separator-line"})]},`sep-${s}`);const{entry:n,originalIndex:d}=t,i=u&&N.includes(d);return e.jsxs("div",{className:`log-line ${O===d?"highlighted":""} ${r[m]===d?"current-match":""} ${i?"match-line":""} ${n.isError?"error-line":""}`,children:[e.jsx("span",{className:"line-number",children:n.lineNumber}),n.sourceLabel&&e.jsxs("span",{className:"boss-log-source",style:{color:n.sourceColor},children:["[",n.sourceLabel,"]"]}),e.jsx("span",{className:"line-content",dangerouslySetInnerHTML:{__html:ae(de(n.text))}})]},d)})})}),e.jsxs("div",{className:"pm2-logs-modal-footer",children:[e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"j"}),"/",e.jsx("kbd",{children:"k"})," Scroll"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"g"}),"/",e.jsx("kbd",{children:"G"})," Top/Bottom"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"/"})," Search"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"n"}),"/",e.jsx("kbd",{children:"N"})," Next/Prev match"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"Ctrl+G"})," Go to line"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"Esc"})," Close"]}),X]})]})}):null}export{ge as L};
1
+ import{u as ue,r as l,h as he,j as e,i as de}from"./main-B_diMezF.js";function ge({isOpen:E,onClose:w,title:Q,icon:_,lines:c,isStreaming:P,onClear:q,emptyMessage:U,streamingIndicatorLabel:z,extraToolbar:J,extraFooter:X,modalClassName:Y}){const{t:a}=ue(["terminal","common"]),[u,$]=l.useState(""),[h,L]=l.useState(!1),[x,S]=l.useState(!1),[M,R]=l.useState(""),[k,p]=l.useState(!0),[D,Z]=l.useState(!0),[O,B]=l.useState(null),[r,ee]=l.useState([]),[m,j]=l.useState(0),[v,te]=l.useState(!1),[T,se]=l.useState(5),[F,C]=l.useState(null),[y,le]=l.useState(!0),o=l.useRef(null),I=l.useRef(null),A=l.useRef(null),H=l.useRef(!1),V=l.useRef(0),K=l.useMemo(()=>c.map(t=>t.text),[c]),b=l.useMemo(()=>{if(!u)return C(null),null;try{const t=v?u:u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(t,"gi");return C(null),s}catch(t){return C(t.message),null}},[u,v]),N=l.useMemo(()=>{if(!b)return[];const t=[];for(let s=0;s<K.length;s++)b.test(K[s])&&t.push(s),b.lastIndex=0;return t},[K,b]);l.useEffect(()=>{ee(N),m>=N.length&&j(Math.max(0,N.length-1))},[N]);const ne=l.useMemo(()=>{const t=c.map((i,f)=>({entry:i,originalIndex:f}));if(!u||!b||y)return t;if(N.length===0)return[];const s=new Set;for(const i of N){const f=Math.max(0,i-T),ie=Math.min(c.length-1,i+T);for(let G=f;G<=ie;G++)s.add(G)}const n=Array.from(s).sort((i,f)=>i-f),d=[];for(let i=0;i<n.length;i++){const f=n[i];i>0&&f-n[i-1]>1&&d.push({entry:{text:"",lineNumber:-1},originalIndex:-1,isSeparator:!0}),d.push({entry:c[f],originalIndex:f})}return d},[c,u,b,N,T,y]);l.useEffect(()=>{k&&o.current&&c.length>V.current&&(H.current=!0,requestAnimationFrame(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight),setTimeout(()=>{H.current=!1},50)})),V.current=c.length},[c.length,k]),l.useEffect(()=>{h&&I.current&&I.current.focus()},[h]),l.useEffect(()=>{x&&A.current&&A.current.focus()},[x]);const g=l.useCallback(t=>{if(!o.current)return;const n=t*18;o.current.scrollTop=n-100,B(t),setTimeout(()=>B(null),2e3)},[]);l.useEffect(()=>{if(!E)return;const t=s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),h?L(!1):x?S(!1):w();return}if(s.key==="/"&&!h&&!x&&(s.preventDefault(),L(!0)),s.key==="g"&&s.ctrlKey&&(s.preventDefault(),S(!0)),s.key==="End"&&s.ctrlKey&&o.current&&(o.current.scrollTop=o.current.scrollHeight),s.key==="Home"&&s.ctrlKey&&o.current&&(o.current.scrollTop=0),(s.key==="F3"||s.key==="Enter"&&h)&&r.length>0)if(s.preventDefault(),s.shiftKey){const n=(m-1+r.length)%r.length;j(n),g(r[n])}else{const n=(m+1)%r.length;j(n),g(r[n])}if(!h&&!x&&r.length>0){if(s.key==="n"&&!s.ctrlKey){s.preventDefault();const n=(m+1)%r.length;j(n),g(r[n])}else if(s.key==="N"){s.preventDefault();const n=(m-1+r.length)%r.length;j(n),g(r[n])}}!h&&!x&&o.current&&(s.key==="j"?(s.preventDefault(),o.current.scrollTop+=60,p(!1)):s.key==="k"?(s.preventDefault(),o.current.scrollTop-=60,p(!1)):s.key==="G"&&!s.ctrlKey?(s.preventDefault(),o.current.scrollTop=o.current.scrollHeight,p(!0)):s.key==="g"&&!s.ctrlKey&&(s.preventDefault(),o.current.scrollTop=0,p(!1)))};return window.addEventListener("keydown",t,{capture:!0}),()=>window.removeEventListener("keydown",t,{capture:!0})},[E,h,x,r,m,w,g]);const W=l.useCallback(()=>{const t=parseInt(M,10);!isNaN(t)&&t>0&&t<=c.length&&(g(t-1),p(!1)),S(!1),R("")},[M,c.length,g]),re=l.useCallback(()=>{if(H.current||!o.current)return;const{scrollTop:t,scrollHeight:s,clientHeight:n}=o.current,d=s-t-n<50;!d&&k&&p(!1),d&&!k&&p(!0)},[k]),ae=l.useCallback(t=>{if(!u||!b)return t;const s=v?u:u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");try{const n=new RegExp(`(${s})`,"gi");return t.replace(n,'<mark class="search-highlight">$1</mark>')}catch{return t}},[u,b,v]),{handleMouseDown:oe,handleClick:ce}=he(w);return E?e.jsx("div",{className:"pm2-logs-modal-overlay",onMouseDown:oe,onClick:ce,children:e.jsxs("div",{className:`pm2-logs-modal ${Y||""}`,children:[e.jsxs("div",{className:"pm2-logs-modal-header",children:[e.jsxs("div",{className:"header-left",children:[e.jsx("span",{className:"modal-icon",children:_}),e.jsx("span",{className:"modal-title",children:Q}),P&&e.jsxs("span",{className:"streaming-indicator",title:"Live streaming",children:[e.jsx("span",{className:"pulse"}),z||a("terminal:logs.live")]})]}),e.jsxs("div",{className:"header-right",children:[e.jsx("span",{className:"line-count",children:a("terminal:logs.lines",{count:c.length})}),e.jsx("button",{className:"modal-close",onClick:w,title:a("terminal:logs.closeEsc"),children:"×"})]})]}),e.jsxs("div",{className:"pm2-logs-modal-toolbar",children:[e.jsxs("div",{className:"toolbar-left",children:[e.jsxs("button",{className:`toolbar-btn ${h?"active":""}`,onClick:()=>L(!h),title:a("terminal:logs.searchShortcut"),children:["🔍 ",a("terminal:logs.search")]}),e.jsxs("button",{className:"toolbar-btn",onClick:()=>S(!0),title:a("terminal:logs.goToLineShortcut"),children:["⏬ ",a("terminal:logs.goToLine")]}),J,e.jsxs("button",{className:`toolbar-btn ${D?"active":""}`,onClick:()=>Z(!D),title:a("terminal:logs.toggleWrap"),children:["↩ ",a("terminal:logs.wrap")]}),e.jsxs("button",{className:`toolbar-btn ${k?"active":""}`,onClick:()=>p(!k),title:a("terminal:logs.autoScrollToBottom"),children:["↓ ",a("terminal:logs.auto")]})]}),e.jsx("div",{className:"toolbar-right",children:e.jsxs("button",{className:"toolbar-btn danger",onClick:q,title:a("terminal:logs.clear"),children:["🗑 ",a("terminal:logs.clear")]})})]}),h&&e.jsxs("div",{className:"pm2-logs-search-bar",children:[e.jsx("input",{ref:I,type:"text",placeholder:a(v?"terminal:logs.regexPlaceholder":"terminal:logs.searchPlaceholder"),value:u,onChange:t=>{$(t.target.value),j(0)},onKeyDown:t=>{t.key==="Escape"&&(L(!1),$(""),C(null))}}),e.jsx("button",{className:`toolbar-btn small ${v?"active":""}`,onClick:()=>te(!v),title:"Toggle regex mode",children:".*"}),e.jsx("button",{className:`toolbar-btn small ${y?"active":""}`,onClick:()=>le(!y),title:y?"Show all lines (highlight matches)":"Show only context around matches",children:y?"All":"Ctx"}),e.jsxs("div",{className:`context-control ${y?"hidden":""}`,title:"Lines of context around matches",children:[e.jsx("label",{children:"±"}),e.jsx("input",{type:"number",min:"0",max:"100",value:T,onChange:t=>se(Math.max(0,parseInt(t.target.value)||0)),className:"context-input"})]}),e.jsx("button",{className:"toolbar-btn small",onClick:()=>{if(r.length===0)return;const t=(m-1+r.length)%r.length;j(t),g(r[t])},disabled:r.length===0,title:"Previous match (Shift+F3)",children:"▲"}),e.jsx("button",{className:"toolbar-btn small",onClick:()=>{if(r.length===0)return;const t=(m+1)%r.length;j(t),g(r[t])},disabled:r.length===0,title:"Next match (F3)",children:"▼"}),u&&e.jsx("span",{className:"match-count",children:F?e.jsx("span",{className:"regex-error",title:F,children:a("terminal:logs.invalidRegex")}):r.length>0?`${m+1}/${r.length}`:a("terminal:logs.noMatches")}),e.jsx("button",{className:"search-close",onClick:()=>{L(!1),$(""),C(null)},children:"×"})]}),x&&e.jsxs("div",{className:"pm2-logs-goto-line",children:[e.jsxs("label",{children:[a("terminal:logs.goToLineLabel"),":"]}),e.jsx("input",{ref:A,type:"number",min:"1",max:c.length,placeholder:`1-${c.length}`,value:M,onChange:t=>R(t.target.value),onKeyDown:t=>{t.key==="Enter"?W():t.key==="Escape"&&(S(!1),R(""))}}),e.jsx("button",{onClick:W,children:a("terminal:logs.go")}),e.jsx("button",{onClick:()=>S(!1),children:a("common:buttons.cancel")})]}),e.jsx("div",{ref:o,className:`pm2-logs-content ${D?"wrap":"nowrap"}`,onScroll:re,children:c.length===0?e.jsx("div",{className:"logs-empty",children:U||a(P?"terminal:logs.waitingForLogs":"terminal:logs.noLogs")}):e.jsx("div",{className:"logs-lines",children:ne.map((t,s)=>{if("isSeparator"in t&&t.isSeparator)return e.jsxs("div",{className:"log-separator",children:[e.jsx("span",{className:"separator-line"}),e.jsx("span",{className:"separator-label",children:"…"}),e.jsx("span",{className:"separator-line"})]},`sep-${s}`);const{entry:n,originalIndex:d}=t,i=u&&N.includes(d);return e.jsxs("div",{className:`log-line ${O===d?"highlighted":""} ${r[m]===d?"current-match":""} ${i?"match-line":""} ${n.isError?"error-line":""}`,children:[e.jsx("span",{className:"line-number",children:n.lineNumber}),n.sourceLabel&&e.jsxs("span",{className:"boss-log-source",style:{color:n.sourceColor},children:["[",n.sourceLabel,"]"]}),e.jsx("span",{className:"line-content",dangerouslySetInnerHTML:{__html:ae(de(n.text))}})]},d)})})}),e.jsxs("div",{className:"pm2-logs-modal-footer",children:[e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"j"}),"/",e.jsx("kbd",{children:"k"})," Scroll"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"g"}),"/",e.jsx("kbd",{children:"G"})," Top/Bottom"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"/"})," Search"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"n"}),"/",e.jsx("kbd",{children:"N"})," Next/Prev match"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"Ctrl+G"})," Go to line"]}),e.jsxs("span",{className:"shortcut",children:[e.jsx("kbd",{children:"Esc"})," Close"]}),X]})]})}):null}export{ge as L};
@@ -1,2 +1,2 @@
1
- import{u as L,f as d,r as m,s as o,j as x}from"./main-BxXKe5js.js";import{L as S}from"./LogViewerModal-CHscrq-v.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function $({building:t,isOpen:e,onClose:n}){var a;const{t:i}=L(["terminal"]),{streamingBuildingLogs:p,streamingBuildingIds:c}=d(),r=p.get(t.id)||"",g=c.has(t.id);m.useEffect(()=>{var s;return e&&((s=t.pm2)!=null&&s.enabled)&&o.startLogStreaming(t.id,200),()=>{t.id&&o.stopLogStreaming(t.id)}},[e,t.id,(a=t.pm2)==null?void 0:a.enabled]);const f=m.useMemo(()=>r.split(`
1
+ import{u as L,f as d,r as m,s as o,j as x}from"./main-B_diMezF.js";import{L as S}from"./LogViewerModal-wKmq37Bu.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function $({building:t,isOpen:e,onClose:n}){var a;const{t:i}=L(["terminal"]),{streamingBuildingLogs:p,streamingBuildingIds:c}=d(),r=p.get(t.id)||"",g=c.has(t.id);m.useEffect(()=>{var s;return e&&((s=t.pm2)!=null&&s.enabled)&&o.startLogStreaming(t.id,200),()=>{t.id&&o.stopLogStreaming(t.id)}},[e,t.id,(a=t.pm2)==null?void 0:a.enabled]);const f=m.useMemo(()=>r.split(`
2
2
  `).map((s,l)=>({text:s,lineNumber:l+1})),[r]);return x.jsx(S,{isOpen:e,onClose:n,title:`${t.name} - ${i("terminal:logs.pm2Logs")}`,icon:"📄",lines:f,isStreaming:g,onClear:()=>o.clearStreamingLogs(t.id)})}export{$ as PM2LogsModal};
@@ -1 +1 @@
1
- import{u as m,B as f,j as e,s as d}from"./main-BxXKe5js.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function N(r){const t=Date.now()-r,i=Math.floor(t/1e3),a=Math.floor(i/60),c=Math.floor(a/60),n=Math.floor(c/24);return n>0?`${n} day${n>1?"s":""} ago`:c>0?`${c} hour${c>1?"s":""} ago`:a>0?`${a} min${a>1?"s":""} ago`:"just now"}function k({isOpen:r,restorePosition:l,onClose:t,onRestored:i}){const{t:a}=m(["terminal","common"]),c=f(),n=Array.from(c.values()).filter(s=>s.archived===!0),o=(s,j)=>{const x=j?void 0:l||void 0;d.restoreArchivedArea(s,x),i==null||i(),t()},h=()=>{for(const s of n)d.restoreArchivedArea(s.id);i==null||i(),t()},v=s=>{s.target===s.currentTarget&&t()},u=s=>{s.key==="Escape"&&t()};return r?e.jsx("div",{className:`modal-overlay ${r?"visible":""}`,onClick:v,onKeyDown:u,children:e.jsxs("div",{className:"modal restore-archived-modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("span",{className:"header-icon",children:"📦"}),a("terminal:areas.restoreArchivedZone")]}),e.jsx("div",{className:"modal-body restore-archived-body",children:n.length===0?e.jsx("div",{className:"archived-empty",children:a("terminal:areas.noArchivedZones")}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"restore-info",children:a("terminal:areas.restoreInfo")}),e.jsx("div",{className:"archived-list",children:n.map(s=>e.jsx(g,{area:s,onRestoreHere:()=>o(s.id,!1),onRestoreOriginal:()=>o(s.id,!0),hasRestorePosition:!!l},s.id))}),n.length>1&&e.jsx("div",{className:"restore-all-section",children:e.jsx("button",{className:"btn btn-secondary",onClick:h,children:a("terminal:areas.restoreAllOriginal")})})]})}),e.jsx("div",{className:"modal-footer",children:e.jsx("button",{className:"btn btn-secondary",onClick:t,children:a("common:buttons.cancel")})})]})}):null}function g({area:r,onRestoreHere:l,onRestoreOriginal:t,hasRestorePosition:i}){const{t:a}=m(["terminal","common"]),c=r.assignedAgentIds.length,n=r.directories.length;return e.jsxs("div",{className:"archived-item",children:[e.jsx("div",{className:"archived-item-color",style:{backgroundColor:r.color}}),e.jsxs("div",{className:"archived-item-info",children:[e.jsx("div",{className:"archived-item-name",children:r.name}),e.jsxs("div",{className:"archived-item-meta",children:[e.jsx("span",{className:"archived-item-type",children:r.type}),c>0&&e.jsx("span",{className:"archived-item-agents",children:a("terminal:areas.agentCount",{count:c})}),n>0&&e.jsx("span",{className:"archived-item-dirs",children:a("terminal:areas.folderCount",{count:n})}),r.archivedAt&&e.jsx("span",{className:"archived-item-time",children:N(r.archivedAt)})]})]}),e.jsxs("div",{className:"archived-item-actions",children:[i&&e.jsx("button",{className:"btn btn-small btn-primary",onClick:l,title:a("terminal:areas.placeAtClickedPosition"),children:a("terminal:areas.restoreHere")}),e.jsx("button",{className:"btn btn-small",onClick:t,title:a("terminal:areas.restoreToOriginal"),children:a(i?"terminal:areas.original":"terminal:areas.restore")})]})]})}export{k as RestoreArchivedAreaModal};
1
+ import{u as m,B as f,j as e,s as d}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function N(r){const t=Date.now()-r,i=Math.floor(t/1e3),a=Math.floor(i/60),c=Math.floor(a/60),n=Math.floor(c/24);return n>0?`${n} day${n>1?"s":""} ago`:c>0?`${c} hour${c>1?"s":""} ago`:a>0?`${a} min${a>1?"s":""} ago`:"just now"}function k({isOpen:r,restorePosition:l,onClose:t,onRestored:i}){const{t:a}=m(["terminal","common"]),c=f(),n=Array.from(c.values()).filter(s=>s.archived===!0),o=(s,j)=>{const x=j?void 0:l||void 0;d.restoreArchivedArea(s,x),i==null||i(),t()},h=()=>{for(const s of n)d.restoreArchivedArea(s.id);i==null||i(),t()},v=s=>{s.target===s.currentTarget&&t()},u=s=>{s.key==="Escape"&&t()};return r?e.jsx("div",{className:`modal-overlay ${r?"visible":""}`,onClick:v,onKeyDown:u,children:e.jsxs("div",{className:"modal restore-archived-modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("span",{className:"header-icon",children:"📦"}),a("terminal:areas.restoreArchivedZone")]}),e.jsx("div",{className:"modal-body restore-archived-body",children:n.length===0?e.jsx("div",{className:"archived-empty",children:a("terminal:areas.noArchivedZones")}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"restore-info",children:a("terminal:areas.restoreInfo")}),e.jsx("div",{className:"archived-list",children:n.map(s=>e.jsx(g,{area:s,onRestoreHere:()=>o(s.id,!1),onRestoreOriginal:()=>o(s.id,!0),hasRestorePosition:!!l},s.id))}),n.length>1&&e.jsx("div",{className:"restore-all-section",children:e.jsx("button",{className:"btn btn-secondary",onClick:h,children:a("terminal:areas.restoreAllOriginal")})})]})}),e.jsx("div",{className:"modal-footer",children:e.jsx("button",{className:"btn btn-secondary",onClick:t,children:a("common:buttons.cancel")})})]})}):null}function g({area:r,onRestoreHere:l,onRestoreOriginal:t,hasRestorePosition:i}){const{t:a}=m(["terminal","common"]),c=r.assignedAgentIds.length,n=r.directories.length;return e.jsxs("div",{className:"archived-item",children:[e.jsx("div",{className:"archived-item-color",style:{backgroundColor:r.color}}),e.jsxs("div",{className:"archived-item-info",children:[e.jsx("div",{className:"archived-item-name",children:r.name}),e.jsxs("div",{className:"archived-item-meta",children:[e.jsx("span",{className:"archived-item-type",children:r.type}),c>0&&e.jsx("span",{className:"archived-item-agents",children:a("terminal:areas.agentCount",{count:c})}),n>0&&e.jsx("span",{className:"archived-item-dirs",children:a("terminal:areas.folderCount",{count:n})}),r.archivedAt&&e.jsx("span",{className:"archived-item-time",children:N(r.archivedAt)})]})]}),e.jsxs("div",{className:"archived-item-actions",children:[i&&e.jsx("button",{className:"btn btn-small btn-primary",onClick:l,title:a("terminal:areas.placeAtClickedPosition"),children:a("terminal:areas.restoreHere")}),e.jsx("button",{className:"btn btn-small",onClick:t,title:a("terminal:areas.restoreToOriginal"),children:a(i?"terminal:areas.original":"terminal:areas.restore")})]})]})}export{k as RestoreArchivedAreaModal};
@@ -1 +1 @@
1
- import{u as D,r as h,j as s}from"./main-BxXKe5js.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function B({isOpen:t,onClose:n,agent:d,outputCount:b,trackedFiles:p,onSave:g,isSaving:l=!1,error:x}){const{t:a}=D(["terminal","common"]),m=h.useCallback(()=>{const z=new Date().toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`${d.name} - ${z}`},[d.name]),[r,u]=h.useState(m()),[j,N]=h.useState("");h.useEffect(()=>{t&&(u(m()),N(""))},[t,m]);const y=async e=>{e.preventDefault(),r.trim()&&await g({agentId:d.id,title:r.trim(),description:j.trim()||void 0})},w=e=>{e.key==="Escape"&&n()};if(!t)return null;const i=(p==null?void 0:p.files)||[],o=i.filter(e=>e.type==="created"),c=i.filter(e=>e.type==="modified");return s.jsx("div",{className:"modal-overlay visible",onClick:n,onKeyDown:w,children:s.jsxs("div",{className:"modal snapshot-modal",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"snapshot-modal-icon",children:"⭐"}),a("terminal:snapshot.save")]}),s.jsxs("form",{onSubmit:y,children:[s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"snapshot-field",children:[s.jsxs("label",{className:"snapshot-label",children:[a("common:labels.title")," ",s.jsx("span",{className:"snapshot-required",children:"*"})]}),s.jsx("input",{type:"text",className:"snapshot-input",value:r,onChange:e=>u(e.target.value),placeholder:a("terminal:snapshot.enterTitle"),autoFocus:!0,disabled:l})]}),s.jsxs("div",{className:"snapshot-field",children:[s.jsxs("label",{className:"snapshot-label",children:[a("common:labels.description")," ",s.jsx("span",{className:"snapshot-optional",children:a("common:labels.optional")})]}),s.jsx("textarea",{className:"snapshot-textarea",value:j,onChange:e=>N(e.target.value),placeholder:a("terminal:snapshot.whatWasAccomplished"),rows:3,disabled:l})]}),s.jsxs("div",{className:"snapshot-preview",children:[s.jsx("div",{className:"snapshot-preview-header",children:a("terminal:snapshot.whatWillBeCaptured")}),s.jsxs("div",{className:"snapshot-preview-stats",children:[s.jsxs("div",{className:"snapshot-stat",children:[s.jsx("span",{className:"snapshot-stat-icon",children:"💬"}),s.jsx("span",{className:"snapshot-stat-value",children:b}),s.jsx("span",{className:"snapshot-stat-label",children:a("terminal:snapshot.messages")})]}),s.jsxs("div",{className:"snapshot-stat",children:[s.jsx("span",{className:"snapshot-stat-icon",children:"📄"}),s.jsx("span",{className:"snapshot-stat-value",children:i.length}),s.jsx("span",{className:"snapshot-stat-label",children:a("terminal:snapshot.files")})]})]}),i.length>0&&s.jsxs("div",{className:"snapshot-files-preview",children:[o.length>0&&s.jsxs("div",{className:"snapshot-file-group",children:[s.jsxs("div",{className:"snapshot-file-group-label",children:[s.jsx("span",{className:"snapshot-file-type created",children:"+"}),a("terminal:snapshot.createdFiles",{count:o.length})]}),s.jsxs("div",{className:"snapshot-file-list",children:[o.slice(0,5).map(e=>s.jsxs("div",{className:"snapshot-file-item",children:[s.jsx("span",{className:"snapshot-file-path",title:e.path,children:v(e.path)}),e.size!==void 0&&s.jsx("span",{className:"snapshot-file-size",children:f(e.size)})]},e.path)),o.length>5&&s.jsx("div",{className:"snapshot-file-more",children:a("terminal:snapshot.more",{count:o.length-5})})]})]}),c.length>0&&s.jsxs("div",{className:"snapshot-file-group",children:[s.jsxs("div",{className:"snapshot-file-group-label",children:[s.jsx("span",{className:"snapshot-file-type modified",children:"~"}),a("terminal:snapshot.modifiedFiles",{count:c.length})]}),s.jsxs("div",{className:"snapshot-file-list",children:[c.slice(0,5).map(e=>s.jsxs("div",{className:"snapshot-file-item",children:[s.jsx("span",{className:"snapshot-file-path",title:e.path,children:v(e.path)}),e.size!==void 0&&s.jsx("span",{className:"snapshot-file-size",children:f(e.size)})]},e.path)),c.length>5&&s.jsx("div",{className:"snapshot-file-more",children:a("terminal:snapshot.more",{count:c.length-5})})]})]})]}),i.length===0&&s.jsx("div",{className:"snapshot-no-files",children:a("terminal:snapshot.noFilesChanged")})]}),x&&s.jsx("div",{className:"snapshot-error",children:x})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:n,disabled:l,children:a("common:buttons.cancel")}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:!r.trim()||l,children:l?a("terminal:snapshot.saving"):`⭐ ${a("terminal:snapshot.save")}`})]})]})]})})}function v(t){const n=t.split("/");return n[n.length-1]||t}function f(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}export{B as SaveSnapshotModal};
1
+ import{u as D,r as h,j as s}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function B({isOpen:t,onClose:n,agent:d,outputCount:b,trackedFiles:p,onSave:g,isSaving:l=!1,error:x}){const{t:a}=D(["terminal","common"]),m=h.useCallback(()=>{const z=new Date().toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`${d.name} - ${z}`},[d.name]),[r,u]=h.useState(m()),[j,N]=h.useState("");h.useEffect(()=>{t&&(u(m()),N(""))},[t,m]);const y=async e=>{e.preventDefault(),r.trim()&&await g({agentId:d.id,title:r.trim(),description:j.trim()||void 0})},w=e=>{e.key==="Escape"&&n()};if(!t)return null;const i=(p==null?void 0:p.files)||[],o=i.filter(e=>e.type==="created"),c=i.filter(e=>e.type==="modified");return s.jsx("div",{className:"modal-overlay visible",onClick:n,onKeyDown:w,children:s.jsxs("div",{className:"modal snapshot-modal",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"snapshot-modal-icon",children:"⭐"}),a("terminal:snapshot.save")]}),s.jsxs("form",{onSubmit:y,children:[s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"snapshot-field",children:[s.jsxs("label",{className:"snapshot-label",children:[a("common:labels.title")," ",s.jsx("span",{className:"snapshot-required",children:"*"})]}),s.jsx("input",{type:"text",className:"snapshot-input",value:r,onChange:e=>u(e.target.value),placeholder:a("terminal:snapshot.enterTitle"),autoFocus:!0,disabled:l})]}),s.jsxs("div",{className:"snapshot-field",children:[s.jsxs("label",{className:"snapshot-label",children:[a("common:labels.description")," ",s.jsx("span",{className:"snapshot-optional",children:a("common:labels.optional")})]}),s.jsx("textarea",{className:"snapshot-textarea",value:j,onChange:e=>N(e.target.value),placeholder:a("terminal:snapshot.whatWasAccomplished"),rows:3,disabled:l})]}),s.jsxs("div",{className:"snapshot-preview",children:[s.jsx("div",{className:"snapshot-preview-header",children:a("terminal:snapshot.whatWillBeCaptured")}),s.jsxs("div",{className:"snapshot-preview-stats",children:[s.jsxs("div",{className:"snapshot-stat",children:[s.jsx("span",{className:"snapshot-stat-icon",children:"💬"}),s.jsx("span",{className:"snapshot-stat-value",children:b}),s.jsx("span",{className:"snapshot-stat-label",children:a("terminal:snapshot.messages")})]}),s.jsxs("div",{className:"snapshot-stat",children:[s.jsx("span",{className:"snapshot-stat-icon",children:"📄"}),s.jsx("span",{className:"snapshot-stat-value",children:i.length}),s.jsx("span",{className:"snapshot-stat-label",children:a("terminal:snapshot.files")})]})]}),i.length>0&&s.jsxs("div",{className:"snapshot-files-preview",children:[o.length>0&&s.jsxs("div",{className:"snapshot-file-group",children:[s.jsxs("div",{className:"snapshot-file-group-label",children:[s.jsx("span",{className:"snapshot-file-type created",children:"+"}),a("terminal:snapshot.createdFiles",{count:o.length})]}),s.jsxs("div",{className:"snapshot-file-list",children:[o.slice(0,5).map(e=>s.jsxs("div",{className:"snapshot-file-item",children:[s.jsx("span",{className:"snapshot-file-path",title:e.path,children:v(e.path)}),e.size!==void 0&&s.jsx("span",{className:"snapshot-file-size",children:f(e.size)})]},e.path)),o.length>5&&s.jsx("div",{className:"snapshot-file-more",children:a("terminal:snapshot.more",{count:o.length-5})})]})]}),c.length>0&&s.jsxs("div",{className:"snapshot-file-group",children:[s.jsxs("div",{className:"snapshot-file-group-label",children:[s.jsx("span",{className:"snapshot-file-type modified",children:"~"}),a("terminal:snapshot.modifiedFiles",{count:c.length})]}),s.jsxs("div",{className:"snapshot-file-list",children:[c.slice(0,5).map(e=>s.jsxs("div",{className:"snapshot-file-item",children:[s.jsx("span",{className:"snapshot-file-path",title:e.path,children:v(e.path)}),e.size!==void 0&&s.jsx("span",{className:"snapshot-file-size",children:f(e.size)})]},e.path)),c.length>5&&s.jsx("div",{className:"snapshot-file-more",children:a("terminal:snapshot.more",{count:c.length-5})})]})]})]}),i.length===0&&s.jsx("div",{className:"snapshot-no-files",children:a("terminal:snapshot.noFilesChanged")})]}),x&&s.jsx("div",{className:"snapshot-error",children:x})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:n,disabled:l,children:a("common:buttons.cancel")}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:!r.trim()||l,children:l?a("terminal:snapshot.saving"):`⭐ ${a("terminal:snapshot.save")}`})]})]})]})})}function v(t){const n=t.split("/");return n[n.length-1]||t}function f(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}export{B as SaveSnapshotModal};