cc-viewer 1.6.227 → 1.6.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/App-VLXeimII.js +1 -0
- package/dist/assets/{AppHeader.module-CrzlxDiA.js → AppHeader.module-ObnvAJgf.js} +2 -2
- package/dist/assets/{MdxEditorPanel-BXSJAxH2.js → MdxEditorPanel-DcTZHds3.js} +1 -1
- package/dist/assets/{Mobile-DAGHxG11.js → Mobile-DzXxKLN1.js} +1 -1
- package/dist/assets/{index-Cyrwto3U.js → index-xdUdMhzS.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/server.js +8 -4
- package/dist/assets/App-DvP94XPo.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as jsxRuntimeExports}from"./vendor-codemirror-Bh_IP9SJ.js";import{a as reactExports,s as staticMethods}from"./vendor-antd-DW2QvF0l.js";import{M as MDXEditor,h as headingsPlugin,l as listsPlugin,q as quotePlugin,a as linkPlugin,b as linkDialogPlugin,i as imagePlugin,t as tablePlugin,c as codeBlockPlugin,d as codeMirrorPlugin,e as thematicBreakPlugin,m as markdownShortcutPlugin,f as diffSourcePlugin,g as toolbarPlugin,D as DiffSourceToggleWrapper,U as UndoRedo,S as Separator,B as BoldItalicUnderlineToggles,C as CodeToggle,j as BlockTypeSelect,L as ListsToggle,k as CreateLink,I as InsertImage,n as InsertTable,o as InsertCodeBlock,p as InsertThematicBreak}from"./vendor-mdxeditor-DmzrSr0n.js";import{t,g as getLang}from"./AppHeader.module-
|
|
1
|
+
import{j as jsxRuntimeExports}from"./vendor-codemirror-Bh_IP9SJ.js";import{a as reactExports,s as staticMethods}from"./vendor-antd-DW2QvF0l.js";import{M as MDXEditor,h as headingsPlugin,l as listsPlugin,q as quotePlugin,a as linkPlugin,b as linkDialogPlugin,i as imagePlugin,t as tablePlugin,c as codeBlockPlugin,d as codeMirrorPlugin,e as thematicBreakPlugin,m as markdownShortcutPlugin,f as diffSourcePlugin,g as toolbarPlugin,D as DiffSourceToggleWrapper,U as UndoRedo,S as Separator,B as BoldItalicUnderlineToggles,C as CodeToggle,j as BlockTypeSelect,L as ListsToggle,k as CreateLink,I as InsertImage,n as InsertTable,o as InsertCodeBlock,p as InsertThematicBreak}from"./vendor-mdxeditor-DmzrSr0n.js";import{t,g as getLang}from"./AppHeader.module-ObnvAJgf.js";import"./index-xdUdMhzS.js";import"./vendor-markdown-Bpu4AByL.js";import"./vendor-xterm-DckPrCx1.js";import"./vendor-highlight-IFTJ9nxW.js";import"./vendor-virtuoso-CU5wFM1_.js";const styles={container:"_container_3d9hl_25",light:"_light_3d9hl_3",contentEditable:"_contentEditable_3d9hl_16"},PASSTHROUGH_TYPES=new Set(["image/png","image/gif","image/webp","image/svg+xml"]);function readAsDataURL(file){return new Promise((resolve,reject)=>{const reader=new FileReader;reader.onload=()=>resolve(reader.result),reader.onerror=()=>reject(new Error("FileReader failed")),reader.readAsDataURL(file)})}async function compressImageToDataURL(file,opts={}){if(!(file instanceof Blob))throw new Error("compressImageToDataURL: input must be a File or Blob");if(!file.type||!file.type.startsWith("image/"))throw new Error(`Unsupported file type: ${file.type||"unknown"}`);if(file.size>10485760)throw new Error(`Image too large: ${(file.size/1024/1024).toFixed(1)}MB > 10MB limit`);const maxEdge=opts.maxEdge??2e3,quality=opts.quality??.85;if(PASSTHROUGH_TYPES.has(file.type))return await readAsDataURL(file);const originalDataURL=await readAsDataURL(file),img=await(src=originalDataURL,new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img),img.onerror=()=>reject(new Error("Image decode failed")),img.src=src}));var src;const longestEdge=Math.max(img.naturalWidth,img.naturalHeight),scale=longestEdge>maxEdge?maxEdge/longestEdge:1,targetW=Math.max(1,Math.round(img.naturalWidth*scale)),targetH=Math.max(1,Math.round(img.naturalHeight*scale)),canvas=document.createElement("canvas");canvas.width=targetW,canvas.height=targetH;const ctx=canvas.getContext("2d");if(!ctx)return originalDataURL;let compressed;ctx.drawImage(img,0,0,targetW,targetH);try{compressed=canvas.toDataURL("image/jpeg",quality)}catch{return originalDataURL}return!compressed||"data:,"===compressed||compressed.length>=originalDataURL.length?originalDataURL:compressed}const ZH={contentArea:{editableMarkdown:"可编辑 Markdown"},dialog:{close:"关闭"},dialogControls:{cancel:"取消",save:"保存"},createLink:{text:"链接文字",textTooltip:"链接显示的文字",title:"标题",titleTooltip:"链接的 title 属性(鼠标悬停时显示)",url:"链接地址",urlPlaceholder:"请输入链接地址",saveTooltip:"保存链接",cancelTooltip:"取消编辑"},linkPreview:{open:"在新窗口打开 {{url}}",edit:"编辑链接",copyToClipboard:"复制链接到剪贴板",copied:"已复制",remove:"移除链接"},uploadImage:{dialogTitle:"插入图片",uploadInstructions:"从本地选择图片上传",addViaUrlInstructions:"或输入图片地址",addViaUrlInstructionsNoUpload:"请输入图片地址",autoCompletePlaceholder:"搜索已有图片",alt:"替代文字",title:"标题",width:"宽度",height:"高度"},imageEditor:{editImage:"编辑图片",deleteImage:"删除图片"},table:{columnMenu:"列菜单",rowMenu:"行菜单",textAlignment:"文字对齐",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",insertColumnLeft:"在左侧插入列",insertColumnRight:"在右侧插入列",insertRowAbove:"在上方插入行",insertRowBelow:"在下方插入行",deleteColumn:"删除列",deleteRow:"删除行",deleteTable:"删除表格"},codeBlock:{language:"语言",inlineLanguage:"行内语言",selectLanguage:"选择语言"},codeblock:{delete:"删除代码块"},toolbar:{undo:"撤销 {{shortcut}}",redo:"重做 {{shortcut}}",blockTypeSelect:{placeholder:"块类型",selectBlockTypeTooltip:"选择块类型"},blockTypes:{paragraph:"段落",heading:"标题 {{level}}",quote:"引用"}}};function mdxZhTranslation(key,defaultValue,interpolations){return function(template,values){if(!values)return template;let out=template.replace(/\{\{\s*(\w+)\s*\}\}/g,(_,k)=>k in values?String(values[k]):`{{${k}}}`);return out=out.replace(/\{(\w+)\}/g,(_,k)=>k in values?String(values[k]):`{${k}}`),out}(function(obj,path){const parts=path.split(".");let cur=obj;for(const p of parts){if(!cur||"object"!=typeof cur||!(p in cur))return;cur=cur[p]}return"string"==typeof cur?cur:void 0}(ZH,key)??defaultValue??key,interpolations)}function getDocTheme(){return"undefined"==typeof document?"dark":"light"===document.documentElement.getAttribute("data-theme")?"light":"dark"}const CODE_BLOCK_LANGUAGES={"":"Plain text",js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",sh:"Shell",bash:"Bash",json:"JSON",yaml:"YAML",md:"Markdown",html:"HTML",css:"CSS",sql:"SQL",go:"Go",rust:"Rust",java:"Java",cpp:"C++"},MdxEditorPanel=reactExports.forwardRef(function({initialMarkdown:initialMarkdown,onChange:onChange,onError:onError,onParseError:onParseError},ref){const editorRef=reactExports.useRef(null),[theme,setTheme]=reactExports.useState(getDocTheme),lang="function"==typeof getLang?getLang():"en";reactExports.useEffect(()=>{const target=document.documentElement,obs=new MutationObserver(()=>setTheme(getDocTheme()));return obs.observe(target,{attributes:!0,attributeFilter:["data-theme"]}),()=>obs.disconnect()},[]);const imageUploadHandler=reactExports.useCallback(async file=>{try{return await compressImageToDataURL(file,{maxEdge:2e3,quality:.85})}catch(err){const msg=`${t("ui.mdEditor.uploadFailed")}: ${err.message??err}`;try{staticMethods.error(msg)}catch{}throw"function"==typeof onError&&onError(err),err}},[onError]);reactExports.useImperativeHandle(ref,()=>({getMarkdown:()=>{var _a,_b;return(null==(_b=null==(_a=editorRef.current)?void 0:_a.getMarkdown)?void 0:_b.call(_a))??""},setMarkdown:md=>{var _a,_b;return null==(_b=null==(_a=editorRef.current)?void 0:_a.setMarkdown)?void 0:_b.call(_a,md??"")},focus:()=>{var _a,_b;return null==(_b=null==(_a=editorRef.current)?void 0:_a.focus)?void 0:_b.call(_a)}}),[]);const translation="zh"===lang||"zh-TW"===lang?mdxZhTranslation:void 0;return jsxRuntimeExports.jsx("div",{className:`${styles.container} ${"dark"===theme?`dark-theme ${styles.dark}`:styles.light}`,children:jsxRuntimeExports.jsx(MDXEditor,{ref:editorRef,markdown:initialMarkdown??"",onChange:onChange,onError:payload=>{if("function"==typeof onParseError)try{onParseError(payload)}catch{}},translation:translation,contentEditableClassName:styles.contentEditable,plugins:[headingsPlugin(),listsPlugin(),quotePlugin(),linkPlugin(),linkDialogPlugin(),imagePlugin({imageUploadHandler:imageUploadHandler}),tablePlugin(),codeBlockPlugin({defaultCodeBlockLanguage:""}),codeMirrorPlugin({codeBlockLanguages:CODE_BLOCK_LANGUAGES}),thematicBreakPlugin(),markdownShortcutPlugin(),diffSourcePlugin({viewMode:"rich-text",diffMarkdown:initialMarkdown??""}),toolbarPlugin({toolbarContents:()=>jsxRuntimeExports.jsxs(DiffSourceToggleWrapper,{children:[jsxRuntimeExports.jsx(UndoRedo,{}),jsxRuntimeExports.jsx(Separator,{}),jsxRuntimeExports.jsx(BoldItalicUnderlineToggles,{}),jsxRuntimeExports.jsx(CodeToggle,{}),jsxRuntimeExports.jsx(Separator,{}),jsxRuntimeExports.jsx(BlockTypeSelect,{}),jsxRuntimeExports.jsx(ListsToggle,{}),jsxRuntimeExports.jsx(Separator,{}),jsxRuntimeExports.jsx(CreateLink,{}),jsxRuntimeExports.jsx(InsertImage,{}),jsxRuntimeExports.jsx(InsertTable,{}),jsxRuntimeExports.jsx(InsertCodeBlock,{}),jsxRuntimeExports.jsx(InsertThematicBreak,{})]})})]})})});export{MdxEditorPanel as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__publicField=(obj,key,value)=>((obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value)(obj,"symbol"!=typeof key?key+"":key,value);import{j as jsxRuntimeExports}from"./vendor-codemirror-Bh_IP9SJ.js";import{a as reactExports,I as Icon,b as _extends,R as React__default,M as Modal,s as staticMethods,B as Badge,i as Button,C as ConfigProvider,j as RefIcon$3,k as RefIcon$4,S as Spin,l as Switch,m as Select,n as RefIcon$5}from"./vendor-antd-DW2QvF0l.js";import{f as fetchAllRepos,a as apiUrl,t,b as buildGitTree,i as isImageFile,I as ImageLightbox,F as FullFileDiffView,c as ImageViewer,d as FileContentView,e as computeTokenStats,h as computeToolUsageStats,j as computeSkillUsageStats,k as computeCacheRebuildStats,l as classifyRequest,s as styles$3,C as ConceptHelp,m as formatTokenCount,A as AppBase,n as isSystemText,o as classifyUserContent,p as isMainAgent,q as styles$4,u as uploadFileAndGetPath,r as getEffectiveModel,T as TerminalWsProvider,R as RefIcon$1,v as getModelMaxTokens,O as OPTIMISTIC_CLEAR_PERCENT,w as RefIcon$2,x as ChatView,y as TerminalPanel,z as OpenFolderIcon,B as ToolApprovalPanel}from"./AppHeader.module-CrzlxDiA.js";import{i as isIOS,a as isPad,s as setViewMode}from"./index-Cyrwto3U.js";import"./vendor-markdown-Bpu4AByL.js";import"./vendor-mdxeditor-DmzrSr0n.js";import"./vendor-xterm-DckPrCx1.js";import"./vendor-highlight-IFTJ9nxW.js";import"./vendor-virtuoso-CU5wFM1_.js";var RollbackOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M793 242H366v-74c0-6.7-7.7-10.4-12.9-6.3l-142 112a8 8 0 000 12.6l142 112c5.2 4.1 12.9.4 12.9-6.3v-74h415v470H175c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-28.7 64-64V306c0-35.3-28.7-64-64-64z"}}]},name:"rollback",theme:"outlined"},RollbackOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref:ref,icon:RollbackOutlined$1}))},RefIcon=reactExports.forwardRef(RollbackOutlined);const styles$2_container="_container_tjqxo_1",styles$2_fileListSection="_fileListSection_tjqxo_10",styles$2_header="_header_tjqxo_19",styles$2_headerLeft="_headerLeft_tjqxo_28",styles$2_headerTitle="_headerTitle_tjqxo_34",styles$2_fileCount="_fileCount_tjqxo_42",styles$2_closeBtn="_closeBtn_tjqxo_50",styles$2_changesContainer="_changesContainer_tjqxo_66",styles$2_changeItem="_changeItem_tjqxo_73",styles$2_changeItemActive="_changeItemActive_tjqxo_90",styles$2_dirItem="_dirItem_tjqxo_99",styles$2_dirArrow="_dirArrow_tjqxo_110",styles$2_dirName="_dirName_tjqxo_119",styles$2_status="_status_tjqxo_124",styles$2_icon="_icon_tjqxo_133",styles$2_fileName="_fileName_tjqxo_142",styles$2_diffSection="_diffSection_tjqxo_149",styles$2_diffHeader="_diffHeader_tjqxo_157",styles$2_diffFilePath="_diffFilePath_tjqxo_167",styles$2_diffBadge="_diffBadge_tjqxo_177",styles$2_diffContent="_diffContent_tjqxo_189",styles$2_diffPlaceholder="_diffPlaceholder_tjqxo_195",styles$2_statusText="_statusText_tjqxo_206",styles$2_errorText="_errorText_tjqxo_213",styles$2_emptyText="_emptyText_tjqxo_220",styles$2_warningText="_warningText_tjqxo_227",styles$2_fileSizeNote="_fileSizeNote_tjqxo_239",styles$2_statusTextItalic="_statusTextItalic_tjqxo_244",styles$2_imagePreviewWrap="_imagePreviewWrap_tjqxo_248",styles$2_imagePreview="_imagePreview_tjqxo_248",styles$2_rotated90="_rotated90_tjqxo_264",styles$2_repoHeader="_repoHeader_tjqxo_269",styles$2_repoArrow="_repoArrow_tjqxo_288",styles$2_repoArrowExpanded="_repoArrowExpanded_tjqxo_299",styles$2_repoName="_repoName_tjqxo_303",styles$2_repoBadge="_repoBadge_tjqxo_310",STATUS_COLORS={M:"#e2c08d",A:"#73c991",D:"#f14c4c",R:"#73c991",C:"#73c991",U:"#e2c08d","?":"#73c991","??":"#73c991"},STATUS_LABELS={"??":"U"},EXT_COLORS$1={js:"#e8d44d",jsx:"#61dafb",ts:"#3178c6",tsx:"#3178c6",json:"#999",md:"#519aba",css:"#a86fd9",scss:"#cd6799",html:"#e34c26",py:"#3572a5",go:"#00add8",rs:"#dea584"};function getFileIcon$1(name){const ext=name.includes(".")?name.split(".").pop().toLowerCase():"",color=EXT_COLORS$1[ext]||"#888";return jsxRuntimeExports.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:color,strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function TreeDir({name:name,node:node,depth:depth,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repoPath,onFileClick:onFileClick}){const dirNames=Object.keys(node.dirs).sort(),files=[...node.files].sort((a,b)=>a.name.localeCompare(b.name));return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[name&&jsxRuntimeExports.jsxs("div",{className:styles$2_dirItem,style:{paddingLeft:8+16*depth},children:[jsxRuntimeExports.jsx("span",{className:styles$2_dirArrow,children:jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:styles$2_rotated90,children:jsxRuntimeExports.jsx("polyline",{points:"9 6 15 12 9 18"})})}),jsxRuntimeExports.jsx("span",{className:styles$2_icon,children:jsxRuntimeExports.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"#c09553",stroke:"none",children:jsxRuntimeExports.jsx("path",{d:"M2 6c0-1.1.9-2 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"})})}),jsxRuntimeExports.jsx("span",{className:styles$2_dirName,children:name})]}),dirNames.map(dir=>jsxRuntimeExports.jsx(TreeDir,{name:dir,node:node.dirs[dir],depth:name?depth+1:depth,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repoPath,onFileClick:onFileClick},dir)),files.map(file=>jsxRuntimeExports.jsxs("div",{className:`${styles$2_changeItem} ${selectedFile===file.fullPath&&selectedRepo===repoPath?styles$2_changeItemActive:""}`,style:{paddingLeft:8+16*(name?depth+1:depth)},onClick:()=>onFileClick&&onFileClick(repoPath,file.fullPath),children:[jsxRuntimeExports.jsx("span",{className:styles$2_icon,children:getFileIcon$1(file.name)}),jsxRuntimeExports.jsx("span",{className:styles$2_fileName,children:file.name}),jsxRuntimeExports.jsx("span",{className:styles$2_status,style:{color:STATUS_COLORS[file.status]||"#888"},children:STATUS_LABELS[file.status]||file.status})]},file.fullPath))]})}function MobileGitDiff({visible:visible,onClose:onClose}){const[repos,setRepos]=reactExports.useState(null),[error,setError]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!0),[selectedFile,setSelectedFile]=reactExports.useState(null),[selectedRepo,setSelectedRepo]=reactExports.useState(null),[collapsedRepos,setCollapsedRepos]=reactExports.useState(new Set),[diffData,setDiffData]=reactExports.useState(null),[diffError,setDiffError]=reactExports.useState(null),[diffLoading,setDiffLoading]=reactExports.useState(!1),[lightboxOpen,setLightboxOpen]=reactExports.useState(!1),mounted=reactExports.useRef(!0);reactExports.useEffect(()=>{if(mounted.current=!0,visible)return setLoading(!0),setError(null),fetchAllRepos().then(results=>{mounted.current&&(setRepos(results),setLoading(!1))}).catch(()=>{mounted.current&&(setError("Failed to load git status"),setLoading(!1))}),()=>{mounted.current=!1}},[visible]),reactExports.useEffect(()=>{if(!selectedFile||!selectedRepo)return setDiffData(null),void setDiffError(null);setDiffLoading(!0),setDiffData(null),setDiffError(null);const repoParam=selectedRepo&&"."!==selectedRepo?`&repo=${encodeURIComponent(selectedRepo)}`:"";fetch(apiUrl(`/api/git-diff?files=${encodeURIComponent(selectedFile)}${repoParam}`)).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}).then(data=>{mounted.current&&(data.diffs&&data.diffs[0]?setDiffData(data.diffs[0]):setDiffError("No diff data available"),setDiffLoading(!1))}).catch(err=>{mounted.current&&(setDiffError(`${t("ui.fileLoadError")}: ${err.message}`),setDiffLoading(!1))})},[selectedFile,selectedRepo]);const totalChanges=reactExports.useMemo(()=>repos?repos.reduce((sum,r)=>sum+r.changes.length,0):0,[repos]),isSingleRepo=!repos||repos.length<=1,handleFileClick=(repoPath,filePath)=>{setSelectedFile(filePath),setSelectedRepo(repoPath)},diffDisplayPath=selectedFile&&selectedRepo&&"."!==selectedRepo?`${selectedRepo}/${selectedFile}`:selectedFile;return jsxRuntimeExports.jsxs("div",{className:styles$2_container,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_fileListSection,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_header,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_headerLeft,children:[jsxRuntimeExports.jsx("span",{className:styles$2_headerTitle,children:t("ui.gitChanges")}),jsxRuntimeExports.jsx("span",{className:styles$2_fileCount,children:totalChanges})]}),onClose&&jsxRuntimeExports.jsx("button",{className:styles$2_closeBtn,onClick:onClose,children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_changesContainer,children:[loading&&jsxRuntimeExports.jsx("div",{className:styles$2_statusText,children:"Loading..."}),error&&jsxRuntimeExports.jsx("div",{className:styles$2_errorText,children:error}),!loading&&!error&&(!repos||0===repos.length)&&jsxRuntimeExports.jsx("div",{className:styles$2_emptyText,children:"No changes"}),!loading&&!error&&repos&&repos.map(repo=>{const collapsed=collapsedRepos.has(repo.path);return isSingleRepo?jsxRuntimeExports.jsx(TreeDir,{name:"",node:buildGitTree(repo.changes),depth:0,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repo.path,onFileClick:handleFileClick},repo.path):jsxRuntimeExports.jsxs(React__default.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$2_repoHeader,onClick:()=>setCollapsedRepos(prev=>{const next=new Set(prev);return collapsed?next.delete(repo.path):next.add(repo.path),next}),children:[jsxRuntimeExports.jsx("span",{className:`${styles$2_repoArrow} ${collapsed?"":styles$2_repoArrowExpanded}`,children:jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("polyline",{points:"9 6 15 12 9 18"})})}),jsxRuntimeExports.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[jsxRuntimeExports.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),jsxRuntimeExports.jsx("circle",{cx:"18",cy:"6",r:"3"}),jsxRuntimeExports.jsx("circle",{cx:"6",cy:"18",r:"3"}),jsxRuntimeExports.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),jsxRuntimeExports.jsx("span",{className:styles$2_repoName,children:repo.name}),jsxRuntimeExports.jsx("span",{className:styles$2_repoBadge,children:repo.changes.length})]}),!collapsed&&jsxRuntimeExports.jsx(TreeDir,{name:"",node:buildGitTree(repo.changes),depth:1,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repo.path,onFileClick:handleFileClick})]},repo.path)})]})]}),jsxRuntimeExports.jsx("div",{className:styles$2_diffSection,children:selectedFile?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$2_diffHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$2_diffFilePath,children:diffDisplayPath}),jsxRuntimeExports.jsx("span",{className:styles$2_diffBadge,children:"DIFF"})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_diffContent,children:[diffLoading&&jsxRuntimeExports.jsx("div",{className:styles$2_statusText,children:t("ui.loading")}),diffError&&jsxRuntimeExports.jsx("div",{className:styles$2_errorText,children:diffError}),!diffLoading&&!diffError&&diffData&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:diffData.is_large?jsxRuntimeExports.jsxs("div",{className:styles$2_warningText,children:[jsxRuntimeExports.jsx("p",{children:t("ui.largeFileWarning")}),jsxRuntimeExports.jsxs("p",{className:styles$2_fileSizeNote,children:[t("ui.fileSize"),": ",(diffData.size/1048576).toFixed(2)," MB"]})]}):isImageFile(selectedFile)&&!diffData.is_deleted?jsxRuntimeExports.jsxs("div",{className:styles$2_imagePreviewWrap,children:[jsxRuntimeExports.jsx("img",{className:styles$2_imagePreview,src:apiUrl(`/api/file-raw?path=${encodeURIComponent(diffDisplayPath)}`),alt:selectedFile,onClick:()=>setLightboxOpen(!0)}),lightboxOpen&&jsxRuntimeExports.jsx(ImageLightbox,{src:apiUrl(`/api/file-raw?path=${encodeURIComponent(diffDisplayPath)}`),alt:selectedFile,onClose:()=>setLightboxOpen(!1)})]}):diffData.is_binary?jsxRuntimeExports.jsx("div",{className:`${styles$2_statusText} ${styles$2_statusTextItalic}`,children:t("ui.binaryFileNotice")}):jsxRuntimeExports.jsx(FullFileDiffView,{file_path:selectedFile,old_string:diffData.old_content,new_string:diffData.new_content})})]})]}):jsxRuntimeExports.jsxs("div",{className:styles$2_diffPlaceholder,children:[jsxRuntimeExports.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"#333",strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),jsxRuntimeExports.jsx("circle",{cx:"18",cy:"6",r:"3"}),jsxRuntimeExports.jsx("circle",{cx:"6",cy:"18",r:"3"}),jsxRuntimeExports.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),jsxRuntimeExports.jsx("span",{children:t("ui.mobileGitDiffHint")})]})})]})}const styles$1_container="_container_1hzyt_1",styles$1_fileListSection="_fileListSection_1hzyt_10",styles$1_header="_header_1hzyt_19",styles$1_headerLeft="_headerLeft_1hzyt_28",styles$1_headerTitle="_headerTitle_1hzyt_34",styles$1_fileCount="_fileCount_1hzyt_42",styles$1_closeBtn="_closeBtn_1hzyt_50",styles$1_treeContainer="_treeContainer_1hzyt_66",styles$1_treeItem="_treeItem_1hzyt_73",styles$1_treeItemActive="_treeItemActive_1hzyt_90",styles$1_treeItemIgnored="_treeItemIgnored_1hzyt_99",styles$1_arrow="_arrow_1hzyt_103",styles$1_arrowExpanded="_arrowExpanded_1hzyt_113",styles$1_icon="_icon_1hzyt_117",styles$1_fileName="_fileName_1hzyt_126",styles$1_contentSection="_contentSection_1hzyt_133",styles$1_contentPlaceholder="_contentPlaceholder_1hzyt_141",styles$1_statusText="_statusText_1hzyt_152",styles$1_errorText="_errorText_1hzyt_159",styles$1_emptyText="_emptyText_1hzyt_166",EXT_COLORS={js:"#e8d44d",jsx:"#61dafb",ts:"#3178c6",tsx:"#3178c6",json:"#999",md:"#519aba",css:"#a86fd9",scss:"#cd6799",html:"#e34c26",py:"#3572a5",go:"#00add8",rs:"#dea584"};function getFileIcon(name){const ext=name.includes(".")?name.split(".").pop().toLowerCase():"",color=EXT_COLORS[ext]||"#888";return jsxRuntimeExports.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:color,strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function MobileTreeNode({item:item,path:path,depth:depth,expandedPaths:expandedPaths,onToggleExpand:onToggleExpand,currentFile:currentFile,onFileClick:onFileClick}){const[children,setChildren]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!1),childPath=path?`${path}/${item.name}`:item.name,expanded=expandedPaths.has(childPath),isDir="directory"===item.type,isSelected=!isDir&¤tFile===childPath,isGitIgnored=item.gitIgnored||!1;reactExports.useEffect(()=>{isDir&&expanded&&null===children&&!loading&&(setLoading(!0),fetch(apiUrl(`/api/files?path=${encodeURIComponent(childPath)}`)).then(r=>r.ok?r.json():Promise.reject()).then(data=>{setChildren(data),setLoading(!1)}).catch(()=>{setLoading(!1)}))},[expanded]);const handleClick=reactExports.useCallback(()=>{isDir?onToggleExpand(childPath):onFileClick(childPath)},[isDir,childPath,onToggleExpand,onFileClick]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:`${styles$1_treeItem} ${isSelected?styles$1_treeItemActive:""} ${isGitIgnored?styles$1_treeItemIgnored:""}`,style:{paddingLeft:8+16*depth},onClick:handleClick,children:[isDir?jsxRuntimeExports.jsx("span",{className:`${styles$1_arrow} ${expanded?styles$1_arrowExpanded:""}`,children:jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("polyline",{points:"9 6 15 12 9 18"})})}):jsxRuntimeExports.jsx("span",{style:{width:16,flexShrink:0}}),jsxRuntimeExports.jsx("span",{className:styles$1_icon,children:isDir?jsxRuntimeExports.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"#c09553",stroke:"none",children:jsxRuntimeExports.jsx("path",{d:"M2 6c0-1.1.9-2 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"})}):getFileIcon(item.name)}),jsxRuntimeExports.jsx("span",{className:styles$1_fileName,children:item.name}),loading&&jsxRuntimeExports.jsx("span",{style:{fontSize:10,color:"var(--text-disabled)"},children:"..."})]}),isDir&&expanded&&children&&children.map(child=>jsxRuntimeExports.jsx(MobileTreeNode,{item:child,path:childPath,depth:depth+1,expandedPaths:expandedPaths,onToggleExpand:onToggleExpand,currentFile:currentFile,onFileClick:onFileClick},child.name))]})}function MobileFileExplorer({visible:visible,onClose:onClose,targetFile:targetFile}){const[items,setItems]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!0),[error,setError]=reactExports.useState(null),[expandedPaths,setExpandedPaths]=reactExports.useState(new Set),[currentFile,setCurrentFile]=reactExports.useState(null),mounted=reactExports.useRef(!0),lastTargetRef=reactExports.useRef(null);reactExports.useEffect(()=>(mounted.current=!0,visible?(setLoading(!0),setError(null),fetch(apiUrl("/api/files?path=")).then(r=>r.ok?r.json():Promise.reject()).then(data=>{mounted.current&&(setItems(data),setLoading(!1))}).catch(()=>{mounted.current&&(setError(t("ui.fileLoadError")),setLoading(!1))}),()=>{mounted.current=!1}):(setCurrentFile(null),setExpandedPaths(new Set),void(lastTargetRef.current=null))),[visible]),reactExports.useEffect(()=>{targetFile&&visible&&lastTargetRef.current!==targetFile.file&&(lastTargetRef.current=targetFile.file,setCurrentFile(targetFile.file),targetFile.ancestors&&targetFile.ancestors.length>0&&setExpandedPaths(prev=>{const next=new Set(prev);return targetFile.ancestors.forEach(p=>next.add(p)),next}))},[targetFile,visible]);const handleToggleExpand=reactExports.useCallback(path=>{setExpandedPaths(prev=>{const next=new Set(prev);return next.has(path)?next.delete(path):next.add(path),next})},[]),handleFileClick=reactExports.useCallback(path=>{setCurrentFile(path)},[]),handleFileClose=reactExports.useCallback(()=>{setCurrentFile(null)},[]),itemCount=items?items.length:0;return jsxRuntimeExports.jsxs("div",{className:styles$1_container,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_fileListSection,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_header,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_headerLeft,children:[jsxRuntimeExports.jsx("span",{className:styles$1_headerTitle,children:t("ui.projectFolder")}),jsxRuntimeExports.jsx("span",{className:styles$1_fileCount,children:itemCount})]}),onClose&&jsxRuntimeExports.jsx("button",{className:styles$1_closeBtn,onClick:onClose,children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$1_treeContainer,children:[loading&&jsxRuntimeExports.jsx("div",{className:styles$1_statusText,children:t("ui.loading")}),error&&jsxRuntimeExports.jsx("div",{className:styles$1_errorText,children:t("ui.fileLoadError")}),!loading&&!error&&(!items||0===items.length)&&jsxRuntimeExports.jsx("div",{className:styles$1_emptyText,children:t("ui.mobileFileExplorerHint")}),!loading&&!error&&items&&items.map(item=>jsxRuntimeExports.jsx(MobileTreeNode,{item:item,path:"",depth:0,expandedPaths:expandedPaths,onToggleExpand:handleToggleExpand,currentFile:currentFile,onFileClick:handleFileClick},item.name))]})]}),jsxRuntimeExports.jsx("div",{className:styles$1_contentSection,children:currentFile?isImageFile(currentFile)?jsxRuntimeExports.jsx(ImageViewer,{filePath:currentFile,onClose:handleFileClose}):jsxRuntimeExports.jsx(FileContentView,{filePath:currentFile,onClose:handleFileClose}):jsxRuntimeExports.jsxs("div",{className:styles$1_contentPlaceholder,children:[jsxRuntimeExports.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M2 6c0-1.1.9-2 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"})}),jsxRuntimeExports.jsx("span",{children:t("ui.mobileFileExplorerHint")})]})})]})}const styles_container="_container_1bb9n_1",styles_header="_header_1bb9n_9",styles_headerTitle="_headerTitle_1bb9n_18",styles_closeBtn="_closeBtn_1bb9n_24",styles_content="_content_1bb9n_38",styles_empty="_empty_1bb9n_47",styles_fixedTable="_fixedTable_1bb9n_54",styles_ellipsisCell="_ellipsisCell_1bb9n_58",styles_thLeft="_thLeft_1bb9n_65",styles_colWide="_colWide_1bb9n_69",styles_colNarrow="_colNarrow_1bb9n_73",REASON_KEYS=["ttl","system_change","tools_change","model_change","msg_truncated","msg_modified","key_change"],I18N_MAP={ttl:"cacheLoss.ttl",system_change:"cacheLoss.systemChange",tools_change:"cacheLoss.toolsChange",model_change:"cacheLoss.modelChange",msg_truncated:"cacheLoss.msgTruncated",msg_modified:"cacheLoss.msgModified",key_change:"cacheLoss.keyChange"};function MobileStats({requests:requests=[],visible:visible,onClose:onClose}){const{byModel:byModel,models:models,toolStats:toolStats,skillStats:skillStats,cacheStats:cacheStats,activeReasons:activeReasons,totalCount:totalCount,totalCache:totalCache,hasCacheStats:hasCacheStats,subAgentEntries:subAgentEntries,hasSubAgentStats:hasSubAgentStats,teammateEntries:teammateEntries,hasTeammateStats:hasTeammateStats,isEmpty:isEmpty}=reactExports.useMemo(()=>{const byModel2=computeTokenStats(requests),models2=Object.keys(byModel2),toolStats2=computeToolUsageStats(requests),skillStats2=computeSkillUsageStats(requests),cacheStats2=computeCacheRebuildStats(requests),activeReasons2=REASON_KEYS.filter(k=>cacheStats2[k].count>0),totalCount2=activeReasons2.reduce((sum,k)=>sum+cacheStats2[k].count,0),totalCache2=activeReasons2.reduce((sum,k)=>sum+cacheStats2[k].cacheCreate,0),hasCacheStats2=activeReasons2.length>0,subAgentCounts={},teammateCounts={};for(let i=0;i<requests.length;i++){const cls=classifyRequest(requests[i],requests[i+1]);if("SubAgent"===cls.type){const label=cls.subType||"Other";subAgentCounts[label]=(subAgentCounts[label]||0)+1}else if("Teammate"===cls.type){const label=cls.subType||"Teammate";teammateCounts[label]=(teammateCounts[label]||0)+1}}const subAgentEntries2=Object.entries(subAgentCounts).sort((a,b)=>b[1]-a[1]),hasSubAgentStats2=subAgentEntries2.length>0,teammateEntries2=Object.entries(teammateCounts).sort((a,b)=>b[1]-a[1]),hasTeammateStats2=teammateEntries2.length>0,isEmpty2=0===models2.length&&0===toolStats2.length&&!hasCacheStats2&&!hasSubAgentStats2&&!hasTeammateStats2&&0===skillStats2.length;return{byModel:byModel2,models:models2,toolStats:toolStats2,skillStats:skillStats2,cacheStats:cacheStats2,activeReasons:activeReasons2,totalCount:totalCount2,totalCache:totalCache2,hasCacheStats:hasCacheStats2,subAgentEntries:subAgentEntries2,hasSubAgentStats:hasSubAgentStats2,teammateEntries:teammateEntries2,hasTeammateStats:hasTeammateStats2,isEmpty:isEmpty2}},[requests]);return visible?jsxRuntimeExports.jsxs("div",{className:styles_container,children:[jsxRuntimeExports.jsxs("div",{className:styles_header,children:[jsxRuntimeExports.jsx("span",{className:styles_headerTitle,children:t("ui.tokenStats")}),jsxRuntimeExports.jsx("button",{className:styles_closeBtn,onClick:onClose,children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsx("div",{className:styles_content,children:isEmpty?jsxRuntimeExports.jsx("div",{className:styles_empty,children:"—"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[skillStats.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:t("ui.skillUsageStats")}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"Skill"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[skillStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:name}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),skillStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:skillStats.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasSubAgentStats&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:t("ui.subAgentStats")}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"SubAgent"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[subAgentEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:styles$3.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`SubAgent-${name}`})]}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),subAgentEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:subAgentEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasTeammateStats&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:"Teammate"}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"Name"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[teammateEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:name}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),teammateEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:teammateEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),toolStats.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:t("ui.toolUsageStats")}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"Tool"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[toolStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:styles$3.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`Tool-${name}`})]}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),toolStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:toolStats.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasCacheStats&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.modelName,children:["MainAgent",jsxRuntimeExports.jsx(ConceptHelp,{doc:"MainAgent"})," ",t("ui.cacheRebuildStats"),jsxRuntimeExports.jsx(ConceptHelp,{doc:"CacheRebuild"})]}),jsxRuntimeExports.jsxs("table",{className:`${styles$3.statsTable} ${styles_fixedTable}`,children:[jsxRuntimeExports.jsxs("colgroup",{children:[jsxRuntimeExports.jsx("col",{className:styles_colWide}),jsxRuntimeExports.jsx("col",{className:styles_colNarrow}),jsxRuntimeExports.jsx("col",{className:styles_colNarrow})]}),jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:t("ui.cacheRebuild.reason")}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.cacheCreate")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[activeReasons.map(k=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.label} ${styles_ellipsisCell}`,title:t(`ui.${I18N_MAP[k]}`),children:t(`ui.${I18N_MAP[k]}`)}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:cacheStats[k].count}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(cacheStats[k].cacheCreate)})]},k)),activeReasons.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:totalCount}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(totalCache)})]})]})]})]}),models.map(model=>{const s=byModel[model],totalInput=s.input+s.cacheCreation+s.cacheRead,cacheHitRate=totalInput>0?(s.cacheRead/totalInput*100).toFixed(1):"0.0";return jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:model}),jsxRuntimeExports.jsx("table",{className:styles$3.statsTable,children:jsxRuntimeExports.jsxs("tbody",{children:[jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Token"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"input"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"output"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(totalInput)}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(s.output)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Cache"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"create"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"read"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(s.cacheCreation)}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(s.cacheRead)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:t("ui.hitRate")}),jsxRuntimeExports.jsxs("td",{colSpan:2,className:styles$3.td,children:[cacheHitRate,"%"]})]})]})})]},model)})]})})]}):null}const _Mobile=class _Mobile extends AppBase{constructor(props){super(props),__publicField(this,"_handleMobileOpenFile",(filePath,ancestors)=>{this.state.localLogFile||this.setState({mobileFileExplorerVisible:!0,mobileFileExplorerTarget:{file:filePath,ancestors:ancestors||[]},mobileGitDiffVisible:!1,mobileTerminalVisible:!1,mobileStatsVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileChatVisible:!1})}),__publicField(this,"handleExportPromptsTxt",prompts=>{if(!prompts||0===prompts.length)return;const blocks=[];for(const p of prompts){const lines=[],ts=p.timestamp?new Date(p.timestamp).toLocaleString():"";ts&&lines.push(`${ts}:\n`);const textParts=(p.segments||[]).filter(seg=>"text"===seg.type).map(seg=>seg.content);textParts.length>0&&lines.push(textParts.join("\n")),blocks.push(lines.join("\n"))}if(0===blocks.length)return;const blob=new Blob([blocks.join("\n\n\n\n")],{type:"text/plain;charset=utf-8"}),url=URL.createObjectURL(blob),a=document.createElement("a");a.href=url,a.download=`user-prompts-${(new Date).toISOString().slice(0,10)}.txt`,a.click(),URL.revokeObjectURL(url)}),__publicField(this,"handlePendingPermission",data=>{this.setState({globalPermission:data})}),__publicField(this,"handlePendingPlanApproval",data=>{this.setState({globalPlanApproval:data})}),__publicField(this,"handleAutoApproveChange",seconds=>{this.setState({autoApproveSeconds:seconds}),fetch(apiUrl("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoApproveSeconds:seconds})}).catch(()=>{})}),__publicField(this,"_isInternalDrag",e=>e.dataTransfer.types.includes("text/x-preset-reorder")),__publicField(this,"_onDragOver",e=>{if(e.preventDefault(),this._isInternalDrag(e))return;e.target.closest&&e.target.closest("[data-file-explorer]")?this.state.isDragging&&this.setState({isDragging:!1}):this.state.isDragging||this.setState({isDragging:!0})}),__publicField(this,"_onDragLeave",e=>{const layout=this._layoutRef.current;layout&&!layout.contains(e.relatedTarget)&&this.setState({isDragging:!1})}),__publicField(this,"_onDrop",e=>{if(e.preventDefault(),this._isInternalDrag(e))return;this.setState({isDragging:!1});const files=Array.from(e.dataTransfer.files);if(!files.length)return;const toTerminal=this.state.mobileTerminalVisible;Promise.all(files.map(file=>uploadFileAndGetPath(file).then(path=>({name:file.name,path:path})).catch(err=>(staticMethods.error(`${file.name}: ${err.message}`),null)))).then(results=>{const uploaded=results.filter(Boolean);uploaded.length&&(toTerminal?this.setState(prev=>({terminalPendingImages:[...prev.terminalPendingImages,...uploaded.map(r=>({path:r.path,source:"drop"}))]})):this.setState(prev=>({pendingUploadPaths:[...prev.pendingUploadPaths||[],...uploaded.map(r=>`"${r.path}"`)]})))})}),__publicField(this,"handleUploadPathsConsumed",()=>{this.setState({pendingUploadPaths:[]})}),__publicField(this,"_handleTerminalFilePath",path=>{this.setState(prev=>({terminalPendingImages:[...prev.terminalPendingImages,{path:path,source:"terminal"}]}))}),__publicField(this,"_handleRemoveTerminalImage",idx=>{this.setState(prev=>({terminalPendingImages:prev.terminalPendingImages.filter((_,i)=>i!==idx)}))}),__publicField(this,"_handleClearTerminalImages",()=>{this.setState({terminalPendingImages:[]})}),Object.assign(this.state,{mobileMenuVisible:!1,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileTerminalVisible:!1,mobileFileExplorerVisible:!1,globalPermission:null,globalPlanApproval:null,autoApproveSeconds:0,hasGit:!0,terminalPendingImages:[]}),this._lastContextPercent=0}componentDidMount(){super.componentDidMount(),fetch(apiUrl("/api/git-repos")).then(r=>r.ok?r.json():Promise.reject()).then(data=>{var _a;(null==(_a=data.repos)?void 0:_a.length)||this.setState({hasGit:!1,mobileGitDiffVisible:!1})}).catch(()=>{fetch(apiUrl("/api/git-status")).then(r=>{r.ok||this.setState({hasGit:!1,mobileGitDiffVisible:!1})}).catch(()=>this.setState({hasGit:!1,mobileGitDiffVisible:!1}))}),isIOS&&!isPad&&window.visualViewport&&(this._onVisualViewportChange=()=>{const el=this._layoutRef.current;if(!el)return;const vv=window.visualViewport;el.style.position="fixed",el.style.top=`${vv.offsetTop}px`,el.style.height=`${vv.height}px`,el.style.width="100%",el.style.left="0"},window.visualViewport.addEventListener("resize",this._onVisualViewportChange),window.visualViewport.addEventListener("scroll",this._onVisualViewportChange),this._onVisualViewportChange()),isPad&&(this._mqlWide=window.matchMedia("(min-width: 1400px)"),this._modeSwitchDialog=null,this._onWideChange=e=>{e.matches?this._modeSwitchDialog=Modal.confirm({title:t("ui.modeSwitchTitle"),content:t("ui.modeSwitchToFullView"),okText:t("ui.ok"),onOk:()=>{this._modeSwitchDialog=null,setViewMode("pc")},onCancel:()=>{this._modeSwitchDialog=null}}):this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null)},this._mqlWide.addEventListener("change",this._onWideChange))}componentWillUnmount(){this._onVisualViewportChange&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",this._onVisualViewportChange),window.visualViewport.removeEventListener("scroll",this._onVisualViewportChange)),this._mqlWide&&this._mqlWide.removeEventListener("change",this._onWideChange),this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null),super.componentWillUnmount()}static parseSegments(text){const segments=[],regex=/<([a-zA-Z_][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g;let match,lastIndex=0;for(;null!==(match=regex.exec(text));){const before=text.slice(lastIndex,match.index).trim();before&&segments.push({type:"text",content:before});const tagName=match[1];if(lastIndex=match.index+match[0].length,_Mobile.COMMAND_TAGS.has(tagName))continue;const innerRegex=new RegExp(`^<${tagName}(?:\\s[^>]*)?>([\\s\\S]*)<\\/${tagName}>$`),innerMatch=match[0].match(innerRegex),content2=innerMatch?innerMatch[1].trim():match[0].trim();segments.push({type:"system",content:content2,label:tagName})}const after=text.slice(lastIndex).trim();return after&&segments.push({type:"text",content:after}),segments}static extractUserTexts(messages){const userMsgs=[],fullTexts=[];let slashCmd=null;for(const msg of messages)if("user"===msg.role)if("string"==typeof msg.content){const text=msg.content.trim();if(!text)continue;if(!isSystemText(text)){if(/Implement the following plan:/i.test(text))continue;userMsgs.push(text),fullTexts.push(text)}}else if(Array.isArray(msg.content)){const{commands:commands,textBlocks:textBlocks}=classifyUserContent(msg.content);commands.length>0&&(slashCmd=commands[commands.length-1]);const userParts=[];for(const b of textBlocks)/Implement the following plan:/i.test((b.text||"").trim())||userParts.push(b.text.trim());const allParts=msg.content.filter(b=>{var _a;return"text"===b.type&&(null==(_a=b.text)?void 0:_a.trim())}).map(b=>b.text.trim());userParts.length>0&&(userMsgs.push(userParts.join("\n")),fullTexts.push(allParts.join("\n")))}return{userMsgs:userMsgs,fullTexts:fullTexts,slashCmd:slashCmd}}extractUserPrompts(requests){var _a;const prompts=[],seen=new Set;let prevSlashCmd=null;const mainAgentRequests=requests.filter(r=>isMainAgent(r));for(let ri=0;ri<mainAgentRequests.length;ri++){const req=mainAgentRequests[ri],messages=(null==(_a=req.body)?void 0:_a.messages)||[],timestamp=req.timestamp||"",{userMsgs:userMsgs,fullTexts:fullTexts,slashCmd:slashCmd}=_Mobile.extractUserTexts(messages);slashCmd&&"/compact"!==slashCmd&&slashCmd!==prevSlashCmd&&prompts.push({type:"prompt",segments:[{type:"text",content:slashCmd}],timestamp:timestamp}),prevSlashCmd=slashCmd;for(let i=0;i<userMsgs.length;i++){const key=userMsgs[i];if(seen.has(key))continue;seen.add(key);const raw=fullTexts[i]||key;prompts.push({type:"prompt",segments:_Mobile.parseSegments(raw),timestamp:timestamp})}}return prompts}renderOriginalPrompt(p){const textSegments=p.segments.filter(seg=>"text"===seg.type);return 0===textSegments.length?null:jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptCard,children:textSegments.map((seg,j)=>jsxRuntimeExports.jsx("pre",{className:styles$4.mobilePromptPreText,children:seg.content},j))})}render(){const{filteredRequests:filteredRequests,fileLoading:fileLoading,fileLoadingCount:fileLoadingCount,mainAgentSessions:mainAgentSessions}=this.renderPrepare();if(this.state.workspaceMode)return this.renderWorkspaceMode();const mobileIsLocalLog=!!this._isLocalLog;let mobileModelName=null;for(let i=filteredRequests.length-1;i>=0;i--){const effective=getEffectiveModel(filteredRequests[i]);if(isMainAgent(filteredRequests[i])&&effective){mobileModelName=effective;break}}const wsOpen=!mobileIsLocalLog&&!this.state.sdkMode;return jsxRuntimeExports.jsx(TerminalWsProvider,{open:wsOpen,children:jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIRoot,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[this.state.isDragging&&jsxRuntimeExports.jsx("div",{className:styles$4.dragOverlay,children:jsxRuntimeExports.jsxs("div",{className:styles$4.dragOverlayContent,children:[jsxRuntimeExports.jsx(RefIcon$1,{className:styles$4.dragIcon}),jsxRuntimeExports.jsx("p",{children:t("ui.dragDropHint")})]})}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIHeader,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIHeaderLeft,children:[jsxRuntimeExports.jsx("button",{className:styles$4.mobileMenuBtn,onClick:()=>this.setState(prev=>({mobileMenuVisible:!prev.mobileMenuVisible})),"aria-label":t("ui.mobileMenu"),children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),jsxRuntimeExports.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),mobileIsLocalLog?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Badge,{status:"processing",color:"green"}),jsxRuntimeExports.jsx("span",{className:styles$4.mobileCLIStatusLabel,children:t("ui.historyLog",{file:this._localLogFile})})]}):(()=>{var _a,_b;const contextWindow=this.state.contextWindow;let contextPercent=0;if(null!=(null==contextWindow?void 0:contextWindow.used_percentage))contextPercent=Math.min(100,Math.max(0,Math.round(contextWindow.used_percentage/83.5*100)));else if(filteredRequests.length>0)for(let i=filteredRequests.length-1;i>=0;i--)if(isMainAgent(filteredRequests[i])&&(null==(_b=null==(_a=filteredRequests[i].response)?void 0:_a.body)?void 0:_b.usage)){const u=filteredRequests[i].response.body.usage,total=(u.input_tokens||0)+(u.cache_creation_input_tokens||0)+(u.cache_read_input_tokens||0),usable=.835*((null==contextWindow?void 0:contextWindow.context_window_size)||getModelMaxTokens(getEffectiveModel(filteredRequests[i])||this.state.settingsModel));usable>0&&total>0&&(contextPercent=Math.min(100,Math.max(0,Math.round(total/usable*100))));break}0===contextPercent&&this._lastContextPercent>0?contextPercent=this._lastContextPercent:this._lastContextPercent=contextPercent,this.state.contextBarOptimistic&&(contextPercent=OPTIMISTIC_CLEAR_PERCENT);const ctxColor=contextPercent>=80?"var(--color-error-light)":contextPercent>=60?"var(--color-warning-light)":"var(--color-success)",ctxLabel=`${t("ui.liveMonitoring")}${this.state.projectName?`: ${this.state.projectName}`:""}`;return jsxRuntimeExports.jsxs("span",{className:styles$4.mobileCtxTag,style:{borderColor:ctxColor,color:ctxColor},title:ctxLabel,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileCtxTagFill,style:{width:`${contextPercent}%`,backgroundColor:ctxColor}}),jsxRuntimeExports.jsx("span",{className:styles$4.mobileCtxTagContent,children:ctxLabel})]})})()]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIHeaderRight,children:[mobileIsLocalLog?jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon,{}),onClick:()=>history.back(),className:styles$4.mobileNavBtn,children:t("ui.mobileGoBack")}):this.state.hasGit?jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon$2,{}),onClick:()=>this.setState(prev=>({mobileGitDiffVisible:!prev.mobileGitDiffVisible,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileStatsVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})),style:{color:this.state.mobileGitDiffVisible?"var(--color-primary)":"var(--text-tertiary)",fontSize:12},children:this.state.mobileGitDiffVisible?t("ui.mobileGitDiffExit"):t("ui.mobileGitDiffBrowse")}):null,!mobileIsLocalLog&&jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("polyline",{points:"4 17 10 11 4 5"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),onClick:()=>this.setState(prev=>({mobileTerminalVisible:!prev.mobileTerminalVisible,mobileGitDiffVisible:!1,mobileStatsVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})),style:{color:this.state.mobileTerminalVisible?"var(--color-primary)":"var(--text-tertiary)",fontSize:12},children:this.state.mobileTerminalVisible?t("ui.mobileTerminalExit"):t("ui.mobileTerminalBrowse")})]}),this.state.mobileMenuVisible&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:styles$4.mobileMenuOverlay,onClick:()=>this.setState({mobileMenuVisible:!1})}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileMenuDropdown,children:[jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileLogMgmtVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1}),this.handleImportLocalLogs()},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntimeExports.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntimeExports.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),t("ui.logManagement")]}),jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileStatsVisible:!0,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),jsxRuntimeExports.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),jsxRuntimeExports.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),jsxRuntimeExports.jsx("rect",{x:"14",y:"14",width:"7",height:"7"})]}),t("ui.tokenStats")]}),jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileSettingsVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntimeExports.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 4.68 15a1.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 9 4.68a1.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 19.4 9a1.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"})]}),t("ui.settings")]}),!mobileIsLocalLog&&jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileFileExplorerVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1})},children:[jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),t("ui.projectFolder")]}),jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobilePromptVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobileFileExplorerVisible:!1})},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"12",x2:"9",y2:"15"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"12",x2:"15",y2:"15"})]}),t("ui.userPrompt")]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIBody,children:[!mobileIsLocalLog&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[fileLoading&&jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLoadingOverlay,children:[jsxRuntimeExports.jsx("div",{className:styles$4.mobileLoadingSpinner}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLoadingLabel,children:[t("ui.loadingChat"),fileLoadingCount>0?` (${fileLoadingCount})`:""]})]}),jsxRuntimeExports.jsx(ConfigProvider,{theme:this.themeConfig,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileChatInner,children:jsxRuntimeExports.jsx(ChatView,{requests:filteredRequests,mainAgentSessions:mainAgentSessions,streamingLatest:this.state.streamingLatest,userProfile:this.state.userProfile,collapseToolResults:this.state.collapseToolResults,expandThinking:this.state.expandThinking,showFullToolContent:this.state.showFullToolContent,showThinkingSummaries:this.state.showThinkingSummaries,onViewRequest:null,scrollToTimestamp:null,onScrollTsDone:()=>{},cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,terminalVisible:this.state.mobileTerminalVisible,mobileChatVisible:!0,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,hasMoreHistory:this.state.hasMoreHistory,loadingMore:this.state.loadingMore,onLoadMoreHistory:()=>this.loadMoreHistory(),loadingSessionId:this.state.loadingSessionId,onLoadSession:sid=>this.loadSession(sid),onPendingPermission:this.handlePendingPermission,onPendingPlanApproval:this.handlePendingPlanApproval,suppressInlineApprovalPanels:!0,pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,onMobileOpenFile:this._handleMobileOpenFile,onClearContextOptimistic:this.handleClearContextOptimistic})})})]}),!mobileIsLocalLog&&jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileChatOverlay} ${this.state.mobileTerminalVisible?styles$4.mobileChatOverlayVisible:""}`,children:jsxRuntimeExports.jsx(TerminalPanel,{modelName:mobileModelName,onFilePath:this._handleTerminalFilePath,pendingImages:this.state.terminalPendingImages,onRemovePendingImage:this._handleRemoveTerminalImage,onClearPendingImages:this._handleClearTerminalImages,onClearContextOptimistic:this.handleClearContextOptimistic})}),jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileGitDiffOverlay} ${this.state.mobileGitDiffVisible?styles$4.mobileGitDiffOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileGitDiffInner,children:jsxRuntimeExports.jsx(MobileGitDiff,{visible:this.state.mobileGitDiffVisible,onClose:()=>this.setState({mobileGitDiffVisible:!1})})})}),jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileFileExplorerOverlay} ${this.state.mobileFileExplorerVisible?styles$4.mobileFileExplorerOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileFileExplorerInner,children:jsxRuntimeExports.jsx(MobileFileExplorer,{visible:this.state.mobileFileExplorerVisible,onClose:()=>this.setState({mobileFileExplorerVisible:!1,mobileFileExplorerTarget:null}),targetFile:this.state.mobileFileExplorerTarget})})}),jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileStatsOverlay} ${this.state.mobileStatsVisible?styles$4.mobileStatsOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileStatsInner,children:jsxRuntimeExports.jsx(MobileStats,{requests:filteredRequests,visible:this.state.mobileStatsVisible,onClose:()=>this.setState({mobileStatsVisible:!1})})})}),jsxRuntimeExports.jsxs("div",{className:`${styles$4.mobileLogMgmtOverlay} ${this.state.mobileLogMgmtVisible?styles$4.mobileLogMgmtOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsxs("span",{className:styles$4.mobileLogMgmtTitle,children:[jsxRuntimeExports.jsx(OpenFolderIcon,{apiEndpoint:apiUrl("/api/open-log-dir"),title:t("ui.openLogDir"),size:14}),t("ui.importLocalLogs")]}),jsxRuntimeExports.jsx("button",{className:styles$4.mobileLogMgmtClose,onClick:()=>this.setState({mobileLogMgmtVisible:!1,selectedLogs:new Set}),children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtActions,children:[jsxRuntimeExports.jsx(Button,{size:"small",type:this.state.selectedLogs.size>=2?"primary":"default",disabled:this.state.selectedLogs.size<2,onClick:this.handleMergeLogs,style:this.state.selectedLogs.size<2?{color:"var(--text-muted)",borderColor:"var(--border-light)"}:void 0,children:t("ui.mergeLogs")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$3,{}),disabled:0===this.state.selectedLogs.size,onClick:this.handleDeleteLogs,style:0===this.state.selectedLogs.size?{color:"var(--text-muted)",borderColor:"var(--border-light)"}:{color:"var(--color-error-light)",borderColor:"var(--color-error-light)"},children:t("ui.deleteLogs")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$4,{spin:this.state.refreshingStats}),loading:this.state.refreshingStats,onClick:this.handleRefreshStats,children:t("ui.refreshStats")})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileLogMgmtBody,children:this.state.localLogsLoading?jsxRuntimeExports.jsx("div",{className:styles$4.spinCenter,children:jsxRuntimeExports.jsx(Spin,{})}):(()=>{const currentLogs=this.state.localLogs[this.state.currentProject];return currentLogs&&0!==currentLogs.length?jsxRuntimeExports.jsx(ConfigProvider,{theme:this.themeConfig,children:jsxRuntimeExports.jsx("div",{className:styles$4.logListContainer,children:this.renderLogTable(currentLogs,!0)})}):jsxRuntimeExports.jsx("div",{className:styles$4.emptyCenter,children:t("ui.noLogs")})})()})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$4.mobileSettingsOverlay} ${this.state.mobileSettingsVisible?styles$4.mobileSettingsOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileLogMgmtTitle,children:t("ui.settings")}),jsxRuntimeExports.jsx("button",{className:styles$4.mobileLogMgmtClose,onClick:()=>this.setState({mobileSettingsVisible:!1}),children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsBody,children:[jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsSectionTitle,children:t("ui.chatDisplaySwitches")}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileSettingsLabel,children:t("ui.collapseToolResults")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.collapseToolResults,onChange:this.handleCollapseToolResultsChange})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileSettingsLabel,children:t("ui.expandThinking")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.expandThinking,onChange:this.handleExpandThinkingChange})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileSettingsLabel,children:t("ui.showFullToolContent")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.showFullToolContent,onChange:this.handleShowFullToolContentChange})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsSectionTitle,children:t("ui.themeColor")}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsRow,children:jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.themeColor||"dark",onChange:this.handleThemeColorChange,options:[{label:t("ui.themeColor.dark"),value:"dark"},{label:t("ui.themeColor.light"),value:"light"}],style:{width:140}})}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsSectionTitle,children:t("ui.permission.autoApprove.setting")}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsRow,children:jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.autoApproveSeconds||0,onChange:this.handleAutoApproveChange,options:[{label:t("ui.permission.autoApprove.off"),value:0},{label:"3s",value:3},{label:"5s",value:5},{label:"10s",value:10},{label:"15s",value:15},{label:"20s",value:20},{label:"30s",value:30},{label:"60s",value:60}],style:{width:100}})})]})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$4.mobilePromptOverlay} ${this.state.mobilePromptVisible?styles$4.mobilePromptOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileLogMgmtTitle,children:t("ui.userPrompt")}),jsxRuntimeExports.jsx("button",{className:styles$4.mobileLogMgmtClose,onClick:()=>this.setState({mobilePromptVisible:!1}),children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptBody,children:(()=>{const prompts=this.extractUserPrompts(filteredRequests);return 0===prompts.length?jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptEmpty,children:t("ui.noPrompt")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobilePromptHeader,children:[jsxRuntimeExports.jsxs("span",{className:styles$4.mobilePromptCount,children:[prompts.length," ",t("ui.promptCountUnit")]}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$5,{}),onClick:()=>this.handleExportPromptsTxt(prompts),children:t("ui.exportPromptsTxt")})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptList,children:prompts.map((p,i)=>jsxRuntimeExports.jsxs("div",{className:styles$4.mobilePromptItem,children:[p.timestamp&&jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptTimestamp,children:new Date(p.timestamp).toLocaleString()}),this.renderOriginalPrompt(p)]},i))})]})})()})]})]}),this.state.globalPermission&&jsxRuntimeExports.jsx(ToolApprovalPanel,{toolName:this.state.globalPermission.permission.toolName,toolInput:this.state.globalPermission.permission.input,requestId:this.state.globalPermission.permission.id,onAllow:this.state.globalPermission.handlers.allow,onAllowSession:this.state.globalPermission.handlers.allowSession,onDeny:this.state.globalPermission.handlers.deny,visible:!0,global:!0,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,modelName:this.state.globalPermission.modelName}),this.state.globalPlanApproval&&jsxRuntimeExports.jsx(ToolApprovalPanel,{toolName:"ExitPlanMode",toolInput:this.state.globalPlanApproval.plan.input,requestId:this.state.globalPlanApproval.plan.id,onAllow:this.state.globalPlanApproval.handlers.approve,onDeny:id=>this.state.globalPlanApproval.handlers.reject(id,""),visible:!0,global:!0})]})})}};__publicField(_Mobile,"COMMAND_TAGS",new Set(["command-name","command-message","command-args","local-command-caveat","local-command-stdout"]));let Mobile=_Mobile;export{Mobile as default};
|
|
1
|
+
var __defProp=Object.defineProperty,__publicField=(obj,key,value)=>((obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value)(obj,"symbol"!=typeof key?key+"":key,value);import{j as jsxRuntimeExports}from"./vendor-codemirror-Bh_IP9SJ.js";import{a as reactExports,I as Icon,b as _extends,R as React__default,M as Modal,s as staticMethods,B as Badge,i as Button,C as ConfigProvider,j as RefIcon$3,k as RefIcon$4,S as Spin,l as Switch,m as Select,n as RefIcon$5}from"./vendor-antd-DW2QvF0l.js";import{f as fetchAllRepos,a as apiUrl,t,b as buildGitTree,i as isImageFile,I as ImageLightbox,F as FullFileDiffView,c as ImageViewer,d as FileContentView,e as computeTokenStats,h as computeToolUsageStats,j as computeSkillUsageStats,k as computeCacheRebuildStats,l as classifyRequest,s as styles$3,C as ConceptHelp,m as formatTokenCount,A as AppBase,n as isSystemText,o as classifyUserContent,p as isMainAgent,q as styles$4,u as uploadFileAndGetPath,r as getEffectiveModel,T as TerminalWsProvider,R as RefIcon$1,v as getModelMaxTokens,O as OPTIMISTIC_CLEAR_PERCENT,w as RefIcon$2,x as ChatView,y as TerminalPanel,z as OpenFolderIcon,B as ToolApprovalPanel}from"./AppHeader.module-ObnvAJgf.js";import{i as isIOS,a as isPad,s as setViewMode}from"./index-xdUdMhzS.js";import"./vendor-markdown-Bpu4AByL.js";import"./vendor-mdxeditor-DmzrSr0n.js";import"./vendor-xterm-DckPrCx1.js";import"./vendor-highlight-IFTJ9nxW.js";import"./vendor-virtuoso-CU5wFM1_.js";var RollbackOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M793 242H366v-74c0-6.7-7.7-10.4-12.9-6.3l-142 112a8 8 0 000 12.6l142 112c5.2 4.1 12.9.4 12.9-6.3v-74h415v470H175c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-28.7 64-64V306c0-35.3-28.7-64-64-64z"}}]},name:"rollback",theme:"outlined"},RollbackOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref:ref,icon:RollbackOutlined$1}))},RefIcon=reactExports.forwardRef(RollbackOutlined);const styles$2_container="_container_tjqxo_1",styles$2_fileListSection="_fileListSection_tjqxo_10",styles$2_header="_header_tjqxo_19",styles$2_headerLeft="_headerLeft_tjqxo_28",styles$2_headerTitle="_headerTitle_tjqxo_34",styles$2_fileCount="_fileCount_tjqxo_42",styles$2_closeBtn="_closeBtn_tjqxo_50",styles$2_changesContainer="_changesContainer_tjqxo_66",styles$2_changeItem="_changeItem_tjqxo_73",styles$2_changeItemActive="_changeItemActive_tjqxo_90",styles$2_dirItem="_dirItem_tjqxo_99",styles$2_dirArrow="_dirArrow_tjqxo_110",styles$2_dirName="_dirName_tjqxo_119",styles$2_status="_status_tjqxo_124",styles$2_icon="_icon_tjqxo_133",styles$2_fileName="_fileName_tjqxo_142",styles$2_diffSection="_diffSection_tjqxo_149",styles$2_diffHeader="_diffHeader_tjqxo_157",styles$2_diffFilePath="_diffFilePath_tjqxo_167",styles$2_diffBadge="_diffBadge_tjqxo_177",styles$2_diffContent="_diffContent_tjqxo_189",styles$2_diffPlaceholder="_diffPlaceholder_tjqxo_195",styles$2_statusText="_statusText_tjqxo_206",styles$2_errorText="_errorText_tjqxo_213",styles$2_emptyText="_emptyText_tjqxo_220",styles$2_warningText="_warningText_tjqxo_227",styles$2_fileSizeNote="_fileSizeNote_tjqxo_239",styles$2_statusTextItalic="_statusTextItalic_tjqxo_244",styles$2_imagePreviewWrap="_imagePreviewWrap_tjqxo_248",styles$2_imagePreview="_imagePreview_tjqxo_248",styles$2_rotated90="_rotated90_tjqxo_264",styles$2_repoHeader="_repoHeader_tjqxo_269",styles$2_repoArrow="_repoArrow_tjqxo_288",styles$2_repoArrowExpanded="_repoArrowExpanded_tjqxo_299",styles$2_repoName="_repoName_tjqxo_303",styles$2_repoBadge="_repoBadge_tjqxo_310",STATUS_COLORS={M:"#e2c08d",A:"#73c991",D:"#f14c4c",R:"#73c991",C:"#73c991",U:"#e2c08d","?":"#73c991","??":"#73c991"},STATUS_LABELS={"??":"U"},EXT_COLORS$1={js:"#e8d44d",jsx:"#61dafb",ts:"#3178c6",tsx:"#3178c6",json:"#999",md:"#519aba",css:"#a86fd9",scss:"#cd6799",html:"#e34c26",py:"#3572a5",go:"#00add8",rs:"#dea584"};function getFileIcon$1(name){const ext=name.includes(".")?name.split(".").pop().toLowerCase():"",color=EXT_COLORS$1[ext]||"#888";return jsxRuntimeExports.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:color,strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function TreeDir({name:name,node:node,depth:depth,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repoPath,onFileClick:onFileClick}){const dirNames=Object.keys(node.dirs).sort(),files=[...node.files].sort((a,b)=>a.name.localeCompare(b.name));return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[name&&jsxRuntimeExports.jsxs("div",{className:styles$2_dirItem,style:{paddingLeft:8+16*depth},children:[jsxRuntimeExports.jsx("span",{className:styles$2_dirArrow,children:jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:styles$2_rotated90,children:jsxRuntimeExports.jsx("polyline",{points:"9 6 15 12 9 18"})})}),jsxRuntimeExports.jsx("span",{className:styles$2_icon,children:jsxRuntimeExports.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"#c09553",stroke:"none",children:jsxRuntimeExports.jsx("path",{d:"M2 6c0-1.1.9-2 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"})})}),jsxRuntimeExports.jsx("span",{className:styles$2_dirName,children:name})]}),dirNames.map(dir=>jsxRuntimeExports.jsx(TreeDir,{name:dir,node:node.dirs[dir],depth:name?depth+1:depth,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repoPath,onFileClick:onFileClick},dir)),files.map(file=>jsxRuntimeExports.jsxs("div",{className:`${styles$2_changeItem} ${selectedFile===file.fullPath&&selectedRepo===repoPath?styles$2_changeItemActive:""}`,style:{paddingLeft:8+16*(name?depth+1:depth)},onClick:()=>onFileClick&&onFileClick(repoPath,file.fullPath),children:[jsxRuntimeExports.jsx("span",{className:styles$2_icon,children:getFileIcon$1(file.name)}),jsxRuntimeExports.jsx("span",{className:styles$2_fileName,children:file.name}),jsxRuntimeExports.jsx("span",{className:styles$2_status,style:{color:STATUS_COLORS[file.status]||"#888"},children:STATUS_LABELS[file.status]||file.status})]},file.fullPath))]})}function MobileGitDiff({visible:visible,onClose:onClose}){const[repos,setRepos]=reactExports.useState(null),[error,setError]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!0),[selectedFile,setSelectedFile]=reactExports.useState(null),[selectedRepo,setSelectedRepo]=reactExports.useState(null),[collapsedRepos,setCollapsedRepos]=reactExports.useState(new Set),[diffData,setDiffData]=reactExports.useState(null),[diffError,setDiffError]=reactExports.useState(null),[diffLoading,setDiffLoading]=reactExports.useState(!1),[lightboxOpen,setLightboxOpen]=reactExports.useState(!1),mounted=reactExports.useRef(!0);reactExports.useEffect(()=>{if(mounted.current=!0,visible)return setLoading(!0),setError(null),fetchAllRepos().then(results=>{mounted.current&&(setRepos(results),setLoading(!1))}).catch(()=>{mounted.current&&(setError("Failed to load git status"),setLoading(!1))}),()=>{mounted.current=!1}},[visible]),reactExports.useEffect(()=>{if(!selectedFile||!selectedRepo)return setDiffData(null),void setDiffError(null);setDiffLoading(!0),setDiffData(null),setDiffError(null);const repoParam=selectedRepo&&"."!==selectedRepo?`&repo=${encodeURIComponent(selectedRepo)}`:"";fetch(apiUrl(`/api/git-diff?files=${encodeURIComponent(selectedFile)}${repoParam}`)).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}).then(data=>{mounted.current&&(data.diffs&&data.diffs[0]?setDiffData(data.diffs[0]):setDiffError("No diff data available"),setDiffLoading(!1))}).catch(err=>{mounted.current&&(setDiffError(`${t("ui.fileLoadError")}: ${err.message}`),setDiffLoading(!1))})},[selectedFile,selectedRepo]);const totalChanges=reactExports.useMemo(()=>repos?repos.reduce((sum,r)=>sum+r.changes.length,0):0,[repos]),isSingleRepo=!repos||repos.length<=1,handleFileClick=(repoPath,filePath)=>{setSelectedFile(filePath),setSelectedRepo(repoPath)},diffDisplayPath=selectedFile&&selectedRepo&&"."!==selectedRepo?`${selectedRepo}/${selectedFile}`:selectedFile;return jsxRuntimeExports.jsxs("div",{className:styles$2_container,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_fileListSection,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_header,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_headerLeft,children:[jsxRuntimeExports.jsx("span",{className:styles$2_headerTitle,children:t("ui.gitChanges")}),jsxRuntimeExports.jsx("span",{className:styles$2_fileCount,children:totalChanges})]}),onClose&&jsxRuntimeExports.jsx("button",{className:styles$2_closeBtn,onClick:onClose,children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_changesContainer,children:[loading&&jsxRuntimeExports.jsx("div",{className:styles$2_statusText,children:"Loading..."}),error&&jsxRuntimeExports.jsx("div",{className:styles$2_errorText,children:error}),!loading&&!error&&(!repos||0===repos.length)&&jsxRuntimeExports.jsx("div",{className:styles$2_emptyText,children:"No changes"}),!loading&&!error&&repos&&repos.map(repo=>{const collapsed=collapsedRepos.has(repo.path);return isSingleRepo?jsxRuntimeExports.jsx(TreeDir,{name:"",node:buildGitTree(repo.changes),depth:0,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repo.path,onFileClick:handleFileClick},repo.path):jsxRuntimeExports.jsxs(React__default.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$2_repoHeader,onClick:()=>setCollapsedRepos(prev=>{const next=new Set(prev);return collapsed?next.delete(repo.path):next.add(repo.path),next}),children:[jsxRuntimeExports.jsx("span",{className:`${styles$2_repoArrow} ${collapsed?"":styles$2_repoArrowExpanded}`,children:jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("polyline",{points:"9 6 15 12 9 18"})})}),jsxRuntimeExports.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[jsxRuntimeExports.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),jsxRuntimeExports.jsx("circle",{cx:"18",cy:"6",r:"3"}),jsxRuntimeExports.jsx("circle",{cx:"6",cy:"18",r:"3"}),jsxRuntimeExports.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),jsxRuntimeExports.jsx("span",{className:styles$2_repoName,children:repo.name}),jsxRuntimeExports.jsx("span",{className:styles$2_repoBadge,children:repo.changes.length})]}),!collapsed&&jsxRuntimeExports.jsx(TreeDir,{name:"",node:buildGitTree(repo.changes),depth:1,selectedFile:selectedFile,selectedRepo:selectedRepo,repoPath:repo.path,onFileClick:handleFileClick})]},repo.path)})]})]}),jsxRuntimeExports.jsx("div",{className:styles$2_diffSection,children:selectedFile?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$2_diffHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$2_diffFilePath,children:diffDisplayPath}),jsxRuntimeExports.jsx("span",{className:styles$2_diffBadge,children:"DIFF"})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_diffContent,children:[diffLoading&&jsxRuntimeExports.jsx("div",{className:styles$2_statusText,children:t("ui.loading")}),diffError&&jsxRuntimeExports.jsx("div",{className:styles$2_errorText,children:diffError}),!diffLoading&&!diffError&&diffData&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:diffData.is_large?jsxRuntimeExports.jsxs("div",{className:styles$2_warningText,children:[jsxRuntimeExports.jsx("p",{children:t("ui.largeFileWarning")}),jsxRuntimeExports.jsxs("p",{className:styles$2_fileSizeNote,children:[t("ui.fileSize"),": ",(diffData.size/1048576).toFixed(2)," MB"]})]}):isImageFile(selectedFile)&&!diffData.is_deleted?jsxRuntimeExports.jsxs("div",{className:styles$2_imagePreviewWrap,children:[jsxRuntimeExports.jsx("img",{className:styles$2_imagePreview,src:apiUrl(`/api/file-raw?path=${encodeURIComponent(diffDisplayPath)}`),alt:selectedFile,onClick:()=>setLightboxOpen(!0)}),lightboxOpen&&jsxRuntimeExports.jsx(ImageLightbox,{src:apiUrl(`/api/file-raw?path=${encodeURIComponent(diffDisplayPath)}`),alt:selectedFile,onClose:()=>setLightboxOpen(!1)})]}):diffData.is_binary?jsxRuntimeExports.jsx("div",{className:`${styles$2_statusText} ${styles$2_statusTextItalic}`,children:t("ui.binaryFileNotice")}):jsxRuntimeExports.jsx(FullFileDiffView,{file_path:selectedFile,old_string:diffData.old_content,new_string:diffData.new_content})})]})]}):jsxRuntimeExports.jsxs("div",{className:styles$2_diffPlaceholder,children:[jsxRuntimeExports.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"#333",strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),jsxRuntimeExports.jsx("circle",{cx:"18",cy:"6",r:"3"}),jsxRuntimeExports.jsx("circle",{cx:"6",cy:"18",r:"3"}),jsxRuntimeExports.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),jsxRuntimeExports.jsx("span",{children:t("ui.mobileGitDiffHint")})]})})]})}const styles$1_container="_container_1hzyt_1",styles$1_fileListSection="_fileListSection_1hzyt_10",styles$1_header="_header_1hzyt_19",styles$1_headerLeft="_headerLeft_1hzyt_28",styles$1_headerTitle="_headerTitle_1hzyt_34",styles$1_fileCount="_fileCount_1hzyt_42",styles$1_closeBtn="_closeBtn_1hzyt_50",styles$1_treeContainer="_treeContainer_1hzyt_66",styles$1_treeItem="_treeItem_1hzyt_73",styles$1_treeItemActive="_treeItemActive_1hzyt_90",styles$1_treeItemIgnored="_treeItemIgnored_1hzyt_99",styles$1_arrow="_arrow_1hzyt_103",styles$1_arrowExpanded="_arrowExpanded_1hzyt_113",styles$1_icon="_icon_1hzyt_117",styles$1_fileName="_fileName_1hzyt_126",styles$1_contentSection="_contentSection_1hzyt_133",styles$1_contentPlaceholder="_contentPlaceholder_1hzyt_141",styles$1_statusText="_statusText_1hzyt_152",styles$1_errorText="_errorText_1hzyt_159",styles$1_emptyText="_emptyText_1hzyt_166",EXT_COLORS={js:"#e8d44d",jsx:"#61dafb",ts:"#3178c6",tsx:"#3178c6",json:"#999",md:"#519aba",css:"#a86fd9",scss:"#cd6799",html:"#e34c26",py:"#3572a5",go:"#00add8",rs:"#dea584"};function getFileIcon(name){const ext=name.includes(".")?name.split(".").pop().toLowerCase():"",color=EXT_COLORS[ext]||"#888";return jsxRuntimeExports.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:color,strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function MobileTreeNode({item:item,path:path,depth:depth,expandedPaths:expandedPaths,onToggleExpand:onToggleExpand,currentFile:currentFile,onFileClick:onFileClick}){const[children,setChildren]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!1),childPath=path?`${path}/${item.name}`:item.name,expanded=expandedPaths.has(childPath),isDir="directory"===item.type,isSelected=!isDir&¤tFile===childPath,isGitIgnored=item.gitIgnored||!1;reactExports.useEffect(()=>{isDir&&expanded&&null===children&&!loading&&(setLoading(!0),fetch(apiUrl(`/api/files?path=${encodeURIComponent(childPath)}`)).then(r=>r.ok?r.json():Promise.reject()).then(data=>{setChildren(data),setLoading(!1)}).catch(()=>{setLoading(!1)}))},[expanded]);const handleClick=reactExports.useCallback(()=>{isDir?onToggleExpand(childPath):onFileClick(childPath)},[isDir,childPath,onToggleExpand,onFileClick]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:`${styles$1_treeItem} ${isSelected?styles$1_treeItemActive:""} ${isGitIgnored?styles$1_treeItemIgnored:""}`,style:{paddingLeft:8+16*depth},onClick:handleClick,children:[isDir?jsxRuntimeExports.jsx("span",{className:`${styles$1_arrow} ${expanded?styles$1_arrowExpanded:""}`,children:jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("polyline",{points:"9 6 15 12 9 18"})})}):jsxRuntimeExports.jsx("span",{style:{width:16,flexShrink:0}}),jsxRuntimeExports.jsx("span",{className:styles$1_icon,children:isDir?jsxRuntimeExports.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"#c09553",stroke:"none",children:jsxRuntimeExports.jsx("path",{d:"M2 6c0-1.1.9-2 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"})}):getFileIcon(item.name)}),jsxRuntimeExports.jsx("span",{className:styles$1_fileName,children:item.name}),loading&&jsxRuntimeExports.jsx("span",{style:{fontSize:10,color:"var(--text-disabled)"},children:"..."})]}),isDir&&expanded&&children&&children.map(child=>jsxRuntimeExports.jsx(MobileTreeNode,{item:child,path:childPath,depth:depth+1,expandedPaths:expandedPaths,onToggleExpand:onToggleExpand,currentFile:currentFile,onFileClick:onFileClick},child.name))]})}function MobileFileExplorer({visible:visible,onClose:onClose,targetFile:targetFile}){const[items,setItems]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!0),[error,setError]=reactExports.useState(null),[expandedPaths,setExpandedPaths]=reactExports.useState(new Set),[currentFile,setCurrentFile]=reactExports.useState(null),mounted=reactExports.useRef(!0),lastTargetRef=reactExports.useRef(null);reactExports.useEffect(()=>(mounted.current=!0,visible?(setLoading(!0),setError(null),fetch(apiUrl("/api/files?path=")).then(r=>r.ok?r.json():Promise.reject()).then(data=>{mounted.current&&(setItems(data),setLoading(!1))}).catch(()=>{mounted.current&&(setError(t("ui.fileLoadError")),setLoading(!1))}),()=>{mounted.current=!1}):(setCurrentFile(null),setExpandedPaths(new Set),void(lastTargetRef.current=null))),[visible]),reactExports.useEffect(()=>{targetFile&&visible&&lastTargetRef.current!==targetFile.file&&(lastTargetRef.current=targetFile.file,setCurrentFile(targetFile.file),targetFile.ancestors&&targetFile.ancestors.length>0&&setExpandedPaths(prev=>{const next=new Set(prev);return targetFile.ancestors.forEach(p=>next.add(p)),next}))},[targetFile,visible]);const handleToggleExpand=reactExports.useCallback(path=>{setExpandedPaths(prev=>{const next=new Set(prev);return next.has(path)?next.delete(path):next.add(path),next})},[]),handleFileClick=reactExports.useCallback(path=>{setCurrentFile(path)},[]),handleFileClose=reactExports.useCallback(()=>{setCurrentFile(null)},[]),itemCount=items?items.length:0;return jsxRuntimeExports.jsxs("div",{className:styles$1_container,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_fileListSection,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_header,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_headerLeft,children:[jsxRuntimeExports.jsx("span",{className:styles$1_headerTitle,children:t("ui.projectFolder")}),jsxRuntimeExports.jsx("span",{className:styles$1_fileCount,children:itemCount})]}),onClose&&jsxRuntimeExports.jsx("button",{className:styles$1_closeBtn,onClick:onClose,children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$1_treeContainer,children:[loading&&jsxRuntimeExports.jsx("div",{className:styles$1_statusText,children:t("ui.loading")}),error&&jsxRuntimeExports.jsx("div",{className:styles$1_errorText,children:t("ui.fileLoadError")}),!loading&&!error&&(!items||0===items.length)&&jsxRuntimeExports.jsx("div",{className:styles$1_emptyText,children:t("ui.mobileFileExplorerHint")}),!loading&&!error&&items&&items.map(item=>jsxRuntimeExports.jsx(MobileTreeNode,{item:item,path:"",depth:0,expandedPaths:expandedPaths,onToggleExpand:handleToggleExpand,currentFile:currentFile,onFileClick:handleFileClick},item.name))]})]}),jsxRuntimeExports.jsx("div",{className:styles$1_contentSection,children:currentFile?isImageFile(currentFile)?jsxRuntimeExports.jsx(ImageViewer,{filePath:currentFile,onClose:handleFileClose}):jsxRuntimeExports.jsx(FileContentView,{filePath:currentFile,onClose:handleFileClose}):jsxRuntimeExports.jsxs("div",{className:styles$1_contentPlaceholder,children:[jsxRuntimeExports.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M2 6c0-1.1.9-2 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"})}),jsxRuntimeExports.jsx("span",{children:t("ui.mobileFileExplorerHint")})]})})]})}const styles_container="_container_1bb9n_1",styles_header="_header_1bb9n_9",styles_headerTitle="_headerTitle_1bb9n_18",styles_closeBtn="_closeBtn_1bb9n_24",styles_content="_content_1bb9n_38",styles_empty="_empty_1bb9n_47",styles_fixedTable="_fixedTable_1bb9n_54",styles_ellipsisCell="_ellipsisCell_1bb9n_58",styles_thLeft="_thLeft_1bb9n_65",styles_colWide="_colWide_1bb9n_69",styles_colNarrow="_colNarrow_1bb9n_73",REASON_KEYS=["ttl","system_change","tools_change","model_change","msg_truncated","msg_modified","key_change"],I18N_MAP={ttl:"cacheLoss.ttl",system_change:"cacheLoss.systemChange",tools_change:"cacheLoss.toolsChange",model_change:"cacheLoss.modelChange",msg_truncated:"cacheLoss.msgTruncated",msg_modified:"cacheLoss.msgModified",key_change:"cacheLoss.keyChange"};function MobileStats({requests:requests=[],visible:visible,onClose:onClose}){const{byModel:byModel,models:models,toolStats:toolStats,skillStats:skillStats,cacheStats:cacheStats,activeReasons:activeReasons,totalCount:totalCount,totalCache:totalCache,hasCacheStats:hasCacheStats,subAgentEntries:subAgentEntries,hasSubAgentStats:hasSubAgentStats,teammateEntries:teammateEntries,hasTeammateStats:hasTeammateStats,isEmpty:isEmpty}=reactExports.useMemo(()=>{const byModel2=computeTokenStats(requests),models2=Object.keys(byModel2),toolStats2=computeToolUsageStats(requests),skillStats2=computeSkillUsageStats(requests),cacheStats2=computeCacheRebuildStats(requests),activeReasons2=REASON_KEYS.filter(k=>cacheStats2[k].count>0),totalCount2=activeReasons2.reduce((sum,k)=>sum+cacheStats2[k].count,0),totalCache2=activeReasons2.reduce((sum,k)=>sum+cacheStats2[k].cacheCreate,0),hasCacheStats2=activeReasons2.length>0,subAgentCounts={},teammateCounts={};for(let i=0;i<requests.length;i++){const cls=classifyRequest(requests[i],requests[i+1]);if("SubAgent"===cls.type){const label=cls.subType||"Other";subAgentCounts[label]=(subAgentCounts[label]||0)+1}else if("Teammate"===cls.type){const label=cls.subType||"Teammate";teammateCounts[label]=(teammateCounts[label]||0)+1}}const subAgentEntries2=Object.entries(subAgentCounts).sort((a,b)=>b[1]-a[1]),hasSubAgentStats2=subAgentEntries2.length>0,teammateEntries2=Object.entries(teammateCounts).sort((a,b)=>b[1]-a[1]),hasTeammateStats2=teammateEntries2.length>0,isEmpty2=0===models2.length&&0===toolStats2.length&&!hasCacheStats2&&!hasSubAgentStats2&&!hasTeammateStats2&&0===skillStats2.length;return{byModel:byModel2,models:models2,toolStats:toolStats2,skillStats:skillStats2,cacheStats:cacheStats2,activeReasons:activeReasons2,totalCount:totalCount2,totalCache:totalCache2,hasCacheStats:hasCacheStats2,subAgentEntries:subAgentEntries2,hasSubAgentStats:hasSubAgentStats2,teammateEntries:teammateEntries2,hasTeammateStats:hasTeammateStats2,isEmpty:isEmpty2}},[requests]);return visible?jsxRuntimeExports.jsxs("div",{className:styles_container,children:[jsxRuntimeExports.jsxs("div",{className:styles_header,children:[jsxRuntimeExports.jsx("span",{className:styles_headerTitle,children:t("ui.tokenStats")}),jsxRuntimeExports.jsx("button",{className:styles_closeBtn,onClick:onClose,children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsx("div",{className:styles_content,children:isEmpty?jsxRuntimeExports.jsx("div",{className:styles_empty,children:"—"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[skillStats.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:t("ui.skillUsageStats")}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"Skill"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[skillStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:name}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),skillStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:skillStats.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasSubAgentStats&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:t("ui.subAgentStats")}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"SubAgent"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[subAgentEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:styles$3.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`SubAgent-${name}`})]}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),subAgentEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:subAgentEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasTeammateStats&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:"Teammate"}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"Name"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[teammateEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:name}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),teammateEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:teammateEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),toolStats.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:t("ui.toolUsageStats")}),jsxRuntimeExports.jsxs("table",{className:styles$3.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:"Tool"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[toolStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:styles$3.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`Tool-${name}`})]}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:count})]},name)),toolStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:toolStats.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasCacheStats&&jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.modelName,children:["MainAgent",jsxRuntimeExports.jsx(ConceptHelp,{doc:"MainAgent"})," ",t("ui.cacheRebuildStats"),jsxRuntimeExports.jsx(ConceptHelp,{doc:"CacheRebuild"})]}),jsxRuntimeExports.jsxs("table",{className:`${styles$3.statsTable} ${styles_fixedTable}`,children:[jsxRuntimeExports.jsxs("colgroup",{children:[jsxRuntimeExports.jsx("col",{className:styles_colWide}),jsxRuntimeExports.jsx("col",{className:styles_colNarrow}),jsxRuntimeExports.jsx("col",{className:styles_colNarrow})]}),jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.th} ${styles_thLeft}`,children:t("ui.cacheRebuild.reason")}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.count")}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:t("ui.cacheRebuild.cacheCreate")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[activeReasons.map(k=>jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:`${styles$3.label} ${styles_ellipsisCell}`,title:t(`ui.${I18N_MAP[k]}`),children:t(`ui.${I18N_MAP[k]}`)}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:cacheStats[k].count}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(cacheStats[k].cacheCreate)})]},k)),activeReasons.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$3.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:totalCount}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(totalCache)})]})]})]})]}),models.map(model=>{const s=byModel[model],totalInput=s.input+s.cacheCreation+s.cacheRead,cacheHitRate=totalInput>0?(s.cacheRead/totalInput*100).toFixed(1):"0.0";return jsxRuntimeExports.jsxs("div",{className:styles$3.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$3.modelName,children:model}),jsxRuntimeExports.jsx("table",{className:styles$3.statsTable,children:jsxRuntimeExports.jsxs("tbody",{children:[jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Token"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"input"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"output"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(totalInput)}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(s.output)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:"Cache"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"create"}),jsxRuntimeExports.jsx("td",{className:styles$3.th,children:"read"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$3.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$3.label}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(s.cacheCreation)}),jsxRuntimeExports.jsx("td",{className:styles$3.td,children:formatTokenCount(s.cacheRead)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$3.label,children:t("ui.hitRate")}),jsxRuntimeExports.jsxs("td",{colSpan:2,className:styles$3.td,children:[cacheHitRate,"%"]})]})]})})]},model)})]})})]}):null}const _Mobile=class _Mobile extends AppBase{constructor(props){super(props),__publicField(this,"_handleMobileOpenFile",(filePath,ancestors)=>{this.state.localLogFile||this.setState({mobileFileExplorerVisible:!0,mobileFileExplorerTarget:{file:filePath,ancestors:ancestors||[]},mobileGitDiffVisible:!1,mobileTerminalVisible:!1,mobileStatsVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileChatVisible:!1})}),__publicField(this,"handleExportPromptsTxt",prompts=>{if(!prompts||0===prompts.length)return;const blocks=[];for(const p of prompts){const lines=[],ts=p.timestamp?new Date(p.timestamp).toLocaleString():"";ts&&lines.push(`${ts}:\n`);const textParts=(p.segments||[]).filter(seg=>"text"===seg.type).map(seg=>seg.content);textParts.length>0&&lines.push(textParts.join("\n")),blocks.push(lines.join("\n"))}if(0===blocks.length)return;const blob=new Blob([blocks.join("\n\n\n\n")],{type:"text/plain;charset=utf-8"}),url=URL.createObjectURL(blob),a=document.createElement("a");a.href=url,a.download=`user-prompts-${(new Date).toISOString().slice(0,10)}.txt`,a.click(),URL.revokeObjectURL(url)}),__publicField(this,"handlePendingPermission",data=>{this.setState({globalPermission:data})}),__publicField(this,"handlePendingPlanApproval",data=>{this.setState({globalPlanApproval:data})}),__publicField(this,"handleAutoApproveChange",seconds=>{this.setState({autoApproveSeconds:seconds}),fetch(apiUrl("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoApproveSeconds:seconds})}).catch(()=>{})}),__publicField(this,"_isInternalDrag",e=>e.dataTransfer.types.includes("text/x-preset-reorder")),__publicField(this,"_onDragOver",e=>{if(e.preventDefault(),this._isInternalDrag(e))return;e.target.closest&&e.target.closest("[data-file-explorer]")?this.state.isDragging&&this.setState({isDragging:!1}):this.state.isDragging||this.setState({isDragging:!0})}),__publicField(this,"_onDragLeave",e=>{const layout=this._layoutRef.current;layout&&!layout.contains(e.relatedTarget)&&this.setState({isDragging:!1})}),__publicField(this,"_onDrop",e=>{if(e.preventDefault(),this._isInternalDrag(e))return;this.setState({isDragging:!1});const files=Array.from(e.dataTransfer.files);if(!files.length)return;const toTerminal=this.state.mobileTerminalVisible;Promise.all(files.map(file=>uploadFileAndGetPath(file).then(path=>({name:file.name,path:path})).catch(err=>(staticMethods.error(`${file.name}: ${err.message}`),null)))).then(results=>{const uploaded=results.filter(Boolean);uploaded.length&&(toTerminal?this.setState(prev=>({terminalPendingImages:[...prev.terminalPendingImages,...uploaded.map(r=>({path:r.path,source:"drop"}))]})):this.setState(prev=>({pendingUploadPaths:[...prev.pendingUploadPaths||[],...uploaded.map(r=>`"${r.path}"`)]})))})}),__publicField(this,"handleUploadPathsConsumed",()=>{this.setState({pendingUploadPaths:[]})}),__publicField(this,"_handleTerminalFilePath",path=>{this.setState(prev=>({terminalPendingImages:[...prev.terminalPendingImages,{path:path,source:"terminal"}]}))}),__publicField(this,"_handleRemoveTerminalImage",idx=>{this.setState(prev=>({terminalPendingImages:prev.terminalPendingImages.filter((_,i)=>i!==idx)}))}),__publicField(this,"_handleClearTerminalImages",()=>{this.setState({terminalPendingImages:[]})}),Object.assign(this.state,{mobileMenuVisible:!1,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileTerminalVisible:!1,mobileFileExplorerVisible:!1,globalPermission:null,globalPlanApproval:null,autoApproveSeconds:0,hasGit:!0,terminalPendingImages:[]}),this._lastContextPercent=0}componentDidMount(){super.componentDidMount(),fetch(apiUrl("/api/git-repos")).then(r=>r.ok?r.json():Promise.reject()).then(data=>{var _a;(null==(_a=data.repos)?void 0:_a.length)||this.setState({hasGit:!1,mobileGitDiffVisible:!1})}).catch(()=>{fetch(apiUrl("/api/git-status")).then(r=>{r.ok||this.setState({hasGit:!1,mobileGitDiffVisible:!1})}).catch(()=>this.setState({hasGit:!1,mobileGitDiffVisible:!1}))}),isIOS&&!isPad&&window.visualViewport&&(this._onVisualViewportChange=()=>{const el=this._layoutRef.current;if(!el)return;const vv=window.visualViewport;el.style.position="fixed",el.style.top=`${vv.offsetTop}px`,el.style.height=`${vv.height}px`,el.style.width="100%",el.style.left="0"},window.visualViewport.addEventListener("resize",this._onVisualViewportChange),window.visualViewport.addEventListener("scroll",this._onVisualViewportChange),this._onVisualViewportChange()),isPad&&(this._mqlWide=window.matchMedia("(min-width: 1400px)"),this._modeSwitchDialog=null,this._onWideChange=e=>{e.matches?this._modeSwitchDialog=Modal.confirm({title:t("ui.modeSwitchTitle"),content:t("ui.modeSwitchToFullView"),okText:t("ui.ok"),onOk:()=>{this._modeSwitchDialog=null,setViewMode("pc")},onCancel:()=>{this._modeSwitchDialog=null}}):this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null)},this._mqlWide.addEventListener("change",this._onWideChange))}componentWillUnmount(){this._onVisualViewportChange&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",this._onVisualViewportChange),window.visualViewport.removeEventListener("scroll",this._onVisualViewportChange)),this._mqlWide&&this._mqlWide.removeEventListener("change",this._onWideChange),this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null),super.componentWillUnmount()}static parseSegments(text){const segments=[],regex=/<([a-zA-Z_][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g;let match,lastIndex=0;for(;null!==(match=regex.exec(text));){const before=text.slice(lastIndex,match.index).trim();before&&segments.push({type:"text",content:before});const tagName=match[1];if(lastIndex=match.index+match[0].length,_Mobile.COMMAND_TAGS.has(tagName))continue;const innerRegex=new RegExp(`^<${tagName}(?:\\s[^>]*)?>([\\s\\S]*)<\\/${tagName}>$`),innerMatch=match[0].match(innerRegex),content2=innerMatch?innerMatch[1].trim():match[0].trim();segments.push({type:"system",content:content2,label:tagName})}const after=text.slice(lastIndex).trim();return after&&segments.push({type:"text",content:after}),segments}static extractUserTexts(messages){const userMsgs=[],fullTexts=[];let slashCmd=null;for(const msg of messages)if("user"===msg.role)if("string"==typeof msg.content){const text=msg.content.trim();if(!text)continue;if(!isSystemText(text)){if(/Implement the following plan:/i.test(text))continue;userMsgs.push(text),fullTexts.push(text)}}else if(Array.isArray(msg.content)){const{commands:commands,textBlocks:textBlocks}=classifyUserContent(msg.content);commands.length>0&&(slashCmd=commands[commands.length-1]);const userParts=[];for(const b of textBlocks)/Implement the following plan:/i.test((b.text||"").trim())||userParts.push(b.text.trim());const allParts=msg.content.filter(b=>{var _a;return"text"===b.type&&(null==(_a=b.text)?void 0:_a.trim())}).map(b=>b.text.trim());userParts.length>0&&(userMsgs.push(userParts.join("\n")),fullTexts.push(allParts.join("\n")))}return{userMsgs:userMsgs,fullTexts:fullTexts,slashCmd:slashCmd}}extractUserPrompts(requests){var _a;const prompts=[],seen=new Set;let prevSlashCmd=null;const mainAgentRequests=requests.filter(r=>isMainAgent(r));for(let ri=0;ri<mainAgentRequests.length;ri++){const req=mainAgentRequests[ri],messages=(null==(_a=req.body)?void 0:_a.messages)||[],timestamp=req.timestamp||"",{userMsgs:userMsgs,fullTexts:fullTexts,slashCmd:slashCmd}=_Mobile.extractUserTexts(messages);slashCmd&&"/compact"!==slashCmd&&slashCmd!==prevSlashCmd&&prompts.push({type:"prompt",segments:[{type:"text",content:slashCmd}],timestamp:timestamp}),prevSlashCmd=slashCmd;for(let i=0;i<userMsgs.length;i++){const key=userMsgs[i];if(seen.has(key))continue;seen.add(key);const raw=fullTexts[i]||key;prompts.push({type:"prompt",segments:_Mobile.parseSegments(raw),timestamp:timestamp})}}return prompts}renderOriginalPrompt(p){const textSegments=p.segments.filter(seg=>"text"===seg.type);return 0===textSegments.length?null:jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptCard,children:textSegments.map((seg,j)=>jsxRuntimeExports.jsx("pre",{className:styles$4.mobilePromptPreText,children:seg.content},j))})}render(){const{filteredRequests:filteredRequests,fileLoading:fileLoading,fileLoadingCount:fileLoadingCount,mainAgentSessions:mainAgentSessions}=this.renderPrepare();if(this.state.workspaceMode)return this.renderWorkspaceMode();const mobileIsLocalLog=!!this._isLocalLog;let mobileModelName=null;for(let i=filteredRequests.length-1;i>=0;i--){const effective=getEffectiveModel(filteredRequests[i]);if(isMainAgent(filteredRequests[i])&&effective){mobileModelName=effective;break}}const wsOpen=!mobileIsLocalLog&&!this.state.sdkMode;return jsxRuntimeExports.jsx(TerminalWsProvider,{open:wsOpen,children:jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIRoot,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[this.state.isDragging&&jsxRuntimeExports.jsx("div",{className:styles$4.dragOverlay,children:jsxRuntimeExports.jsxs("div",{className:styles$4.dragOverlayContent,children:[jsxRuntimeExports.jsx(RefIcon$1,{className:styles$4.dragIcon}),jsxRuntimeExports.jsx("p",{children:t("ui.dragDropHint")})]})}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIHeader,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIHeaderLeft,children:[jsxRuntimeExports.jsx("button",{className:styles$4.mobileMenuBtn,onClick:()=>this.setState(prev=>({mobileMenuVisible:!prev.mobileMenuVisible})),"aria-label":t("ui.mobileMenu"),children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),jsxRuntimeExports.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),mobileIsLocalLog?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Badge,{status:"processing",color:"green"}),jsxRuntimeExports.jsx("span",{className:styles$4.mobileCLIStatusLabel,children:t("ui.historyLog",{file:this._localLogFile})})]}):(()=>{var _a,_b;const contextWindow=this.state.contextWindow;let contextPercent=0;if(null!=(null==contextWindow?void 0:contextWindow.used_percentage))contextPercent=Math.min(100,Math.max(0,Math.round(contextWindow.used_percentage/83.5*100)));else if(filteredRequests.length>0)for(let i=filteredRequests.length-1;i>=0;i--)if(isMainAgent(filteredRequests[i])&&(null==(_b=null==(_a=filteredRequests[i].response)?void 0:_a.body)?void 0:_b.usage)){const u=filteredRequests[i].response.body.usage,total=(u.input_tokens||0)+(u.cache_creation_input_tokens||0)+(u.cache_read_input_tokens||0),usable=.835*((null==contextWindow?void 0:contextWindow.context_window_size)||getModelMaxTokens(getEffectiveModel(filteredRequests[i])||this.state.settingsModel));usable>0&&total>0&&(contextPercent=Math.min(100,Math.max(0,Math.round(total/usable*100))));break}0===contextPercent&&this._lastContextPercent>0?contextPercent=this._lastContextPercent:this._lastContextPercent=contextPercent,this.state.contextBarOptimistic&&(contextPercent=OPTIMISTIC_CLEAR_PERCENT);const ctxColor=contextPercent>=80?"var(--color-error-light)":contextPercent>=60?"var(--color-warning-light)":"var(--color-success)",ctxLabel=`${t("ui.liveMonitoring")}${this.state.projectName?`: ${this.state.projectName}`:""}`;return jsxRuntimeExports.jsxs("span",{className:styles$4.mobileCtxTag,style:{borderColor:ctxColor,color:ctxColor},title:ctxLabel,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileCtxTagFill,style:{width:`${contextPercent}%`,backgroundColor:ctxColor}}),jsxRuntimeExports.jsx("span",{className:styles$4.mobileCtxTagContent,children:ctxLabel})]})})()]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIHeaderRight,children:[mobileIsLocalLog?jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon,{}),onClick:()=>history.back(),className:styles$4.mobileNavBtn,children:t("ui.mobileGoBack")}):this.state.hasGit?jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon$2,{}),onClick:()=>this.setState(prev=>({mobileGitDiffVisible:!prev.mobileGitDiffVisible,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileStatsVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})),style:{color:this.state.mobileGitDiffVisible?"var(--color-primary)":"var(--text-tertiary)",fontSize:12},children:this.state.mobileGitDiffVisible?t("ui.mobileGitDiffExit"):t("ui.mobileGitDiffBrowse")}):null,!mobileIsLocalLog&&jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("polyline",{points:"4 17 10 11 4 5"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),onClick:()=>this.setState(prev=>({mobileTerminalVisible:!prev.mobileTerminalVisible,mobileGitDiffVisible:!1,mobileStatsVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})),style:{color:this.state.mobileTerminalVisible?"var(--color-primary)":"var(--text-tertiary)",fontSize:12},children:this.state.mobileTerminalVisible?t("ui.mobileTerminalExit"):t("ui.mobileTerminalBrowse")})]}),this.state.mobileMenuVisible&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:styles$4.mobileMenuOverlay,onClick:()=>this.setState({mobileMenuVisible:!1})}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileMenuDropdown,children:[jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileLogMgmtVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1}),this.handleImportLocalLogs()},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntimeExports.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntimeExports.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),t("ui.logManagement")]}),jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileStatsVisible:!0,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),jsxRuntimeExports.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),jsxRuntimeExports.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),jsxRuntimeExports.jsx("rect",{x:"14",y:"14",width:"7",height:"7"})]}),t("ui.tokenStats")]}),jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileSettingsVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobilePromptVisible:!1,mobileFileExplorerVisible:!1})},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntimeExports.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 4.68 15a1.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 9 4.68a1.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 19.4 9a1.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"})]}),t("ui.settings")]}),!mobileIsLocalLog&&jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobileFileExplorerVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1})},children:[jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),t("ui.projectFolder")]}),jsxRuntimeExports.jsxs("button",{className:styles$4.mobileMenuItem,onClick:()=>{this.setState({mobileMenuVisible:!1,mobilePromptVisible:!0,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileTerminalVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobileFileExplorerVisible:!1})},children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntimeExports.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"12",x2:"9",y2:"15"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"12",x2:"15",y2:"15"})]}),t("ui.userPrompt")]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileCLIBody,children:[!mobileIsLocalLog&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[fileLoading&&jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLoadingOverlay,children:[jsxRuntimeExports.jsx("div",{className:styles$4.mobileLoadingSpinner}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLoadingLabel,children:[t("ui.loadingChat"),fileLoadingCount>0?` (${fileLoadingCount})`:""]})]}),jsxRuntimeExports.jsx(ConfigProvider,{theme:this.themeConfig,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileChatInner,children:jsxRuntimeExports.jsx(ChatView,{requests:filteredRequests,mainAgentSessions:mainAgentSessions,streamingLatest:this.state.streamingLatest,userProfile:this.state.userProfile,collapseToolResults:this.state.collapseToolResults,expandThinking:this.state.expandThinking,showFullToolContent:this.state.showFullToolContent,showThinkingSummaries:this.state.showThinkingSummaries,onViewRequest:null,scrollToTimestamp:null,onScrollTsDone:()=>{},cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,terminalVisible:this.state.mobileTerminalVisible,mobileChatVisible:!0,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,hasMoreHistory:this.state.hasMoreHistory,loadingMore:this.state.loadingMore,onLoadMoreHistory:()=>this.loadMoreHistory(),loadingSessionId:this.state.loadingSessionId,onLoadSession:sid=>this.loadSession(sid),onPendingPermission:this.handlePendingPermission,onPendingPlanApproval:this.handlePendingPlanApproval,suppressInlineApprovalPanels:!0,pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,onMobileOpenFile:this._handleMobileOpenFile,onClearContextOptimistic:this.handleClearContextOptimistic})})})]}),!mobileIsLocalLog&&jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileChatOverlay} ${this.state.mobileTerminalVisible?styles$4.mobileChatOverlayVisible:""}`,children:jsxRuntimeExports.jsx(TerminalPanel,{modelName:mobileModelName,onFilePath:this._handleTerminalFilePath,pendingImages:this.state.terminalPendingImages,onRemovePendingImage:this._handleRemoveTerminalImage,onClearPendingImages:this._handleClearTerminalImages,onClearContextOptimistic:this.handleClearContextOptimistic})}),jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileGitDiffOverlay} ${this.state.mobileGitDiffVisible?styles$4.mobileGitDiffOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileGitDiffInner,children:jsxRuntimeExports.jsx(MobileGitDiff,{visible:this.state.mobileGitDiffVisible,onClose:()=>this.setState({mobileGitDiffVisible:!1})})})}),jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileFileExplorerOverlay} ${this.state.mobileFileExplorerVisible?styles$4.mobileFileExplorerOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileFileExplorerInner,children:jsxRuntimeExports.jsx(MobileFileExplorer,{visible:this.state.mobileFileExplorerVisible,onClose:()=>this.setState({mobileFileExplorerVisible:!1,mobileFileExplorerTarget:null}),targetFile:this.state.mobileFileExplorerTarget})})}),jsxRuntimeExports.jsx("div",{className:`${styles$4.mobileStatsOverlay} ${this.state.mobileStatsVisible?styles$4.mobileStatsOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$4.mobileStatsInner,children:jsxRuntimeExports.jsx(MobileStats,{requests:filteredRequests,visible:this.state.mobileStatsVisible,onClose:()=>this.setState({mobileStatsVisible:!1})})})}),jsxRuntimeExports.jsxs("div",{className:`${styles$4.mobileLogMgmtOverlay} ${this.state.mobileLogMgmtVisible?styles$4.mobileLogMgmtOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsxs("span",{className:styles$4.mobileLogMgmtTitle,children:[jsxRuntimeExports.jsx(OpenFolderIcon,{apiEndpoint:apiUrl("/api/open-log-dir"),title:t("ui.openLogDir"),size:14}),t("ui.importLocalLogs")]}),jsxRuntimeExports.jsx("button",{className:styles$4.mobileLogMgmtClose,onClick:()=>this.setState({mobileLogMgmtVisible:!1,selectedLogs:new Set}),children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtActions,children:[jsxRuntimeExports.jsx(Button,{size:"small",type:this.state.selectedLogs.size>=2?"primary":"default",disabled:this.state.selectedLogs.size<2,onClick:this.handleMergeLogs,style:this.state.selectedLogs.size<2?{color:"var(--text-muted)",borderColor:"var(--border-light)"}:void 0,children:t("ui.mergeLogs")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$3,{}),disabled:0===this.state.selectedLogs.size,onClick:this.handleDeleteLogs,style:0===this.state.selectedLogs.size?{color:"var(--text-muted)",borderColor:"var(--border-light)"}:{color:"var(--color-error-light)",borderColor:"var(--color-error-light)"},children:t("ui.deleteLogs")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$4,{spin:this.state.refreshingStats}),loading:this.state.refreshingStats,onClick:this.handleRefreshStats,children:t("ui.refreshStats")})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileLogMgmtBody,children:this.state.localLogsLoading?jsxRuntimeExports.jsx("div",{className:styles$4.spinCenter,children:jsxRuntimeExports.jsx(Spin,{})}):(()=>{const currentLogs=this.state.localLogs[this.state.currentProject];return currentLogs&&0!==currentLogs.length?jsxRuntimeExports.jsx(ConfigProvider,{theme:this.themeConfig,children:jsxRuntimeExports.jsx("div",{className:styles$4.logListContainer,children:this.renderLogTable(currentLogs,!0)})}):jsxRuntimeExports.jsx("div",{className:styles$4.emptyCenter,children:t("ui.noLogs")})})()})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$4.mobileSettingsOverlay} ${this.state.mobileSettingsVisible?styles$4.mobileSettingsOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileLogMgmtTitle,children:t("ui.settings")}),jsxRuntimeExports.jsx("button",{className:styles$4.mobileLogMgmtClose,onClick:()=>this.setState({mobileSettingsVisible:!1}),children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsBody,children:[jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsSectionTitle,children:t("ui.chatDisplaySwitches")}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileSettingsLabel,children:t("ui.collapseToolResults")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.collapseToolResults,onChange:this.handleCollapseToolResultsChange})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileSettingsLabel,children:t("ui.expandThinking")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.expandThinking,onChange:this.handleExpandThinkingChange})]}),jsxRuntimeExports.jsxs("div",{className:styles$4.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileSettingsLabel,children:t("ui.showFullToolContent")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.showFullToolContent,onChange:this.handleShowFullToolContentChange})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsSectionTitle,children:t("ui.themeColor")}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsRow,children:jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.themeColor||"dark",onChange:this.handleThemeColorChange,options:[{label:t("ui.themeColor.dark"),value:"dark"},{label:t("ui.themeColor.light"),value:"light"}],style:{width:140}})}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsSectionTitle,children:t("ui.permission.autoApprove.setting")}),jsxRuntimeExports.jsx("div",{className:styles$4.mobileSettingsRow,children:jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.autoApproveSeconds||0,onChange:this.handleAutoApproveChange,options:[{label:t("ui.permission.autoApprove.off"),value:0},{label:"3s",value:3},{label:"5s",value:5},{label:"10s",value:10},{label:"15s",value:15},{label:"20s",value:20},{label:"30s",value:30},{label:"60s",value:60}],style:{width:100}})})]})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$4.mobilePromptOverlay} ${this.state.mobilePromptVisible?styles$4.mobilePromptOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$4.mobileLogMgmtTitle,children:t("ui.userPrompt")}),jsxRuntimeExports.jsx("button",{className:styles$4.mobileLogMgmtClose,onClick:()=>this.setState({mobilePromptVisible:!1}),children:jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptBody,children:(()=>{const prompts=this.extractUserPrompts(filteredRequests);return 0===prompts.length?jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptEmpty,children:t("ui.noPrompt")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$4.mobilePromptHeader,children:[jsxRuntimeExports.jsxs("span",{className:styles$4.mobilePromptCount,children:[prompts.length," ",t("ui.promptCountUnit")]}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$5,{}),onClick:()=>this.handleExportPromptsTxt(prompts),children:t("ui.exportPromptsTxt")})]}),jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptList,children:prompts.map((p,i)=>jsxRuntimeExports.jsxs("div",{className:styles$4.mobilePromptItem,children:[p.timestamp&&jsxRuntimeExports.jsx("div",{className:styles$4.mobilePromptTimestamp,children:new Date(p.timestamp).toLocaleString()}),this.renderOriginalPrompt(p)]},i))})]})})()})]})]}),this.state.globalPermission&&jsxRuntimeExports.jsx(ToolApprovalPanel,{toolName:this.state.globalPermission.permission.toolName,toolInput:this.state.globalPermission.permission.input,requestId:this.state.globalPermission.permission.id,onAllow:this.state.globalPermission.handlers.allow,onAllowSession:this.state.globalPermission.handlers.allowSession,onDeny:this.state.globalPermission.handlers.deny,visible:!0,global:!0,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,modelName:this.state.globalPermission.modelName}),this.state.globalPlanApproval&&jsxRuntimeExports.jsx(ToolApprovalPanel,{toolName:"ExitPlanMode",toolInput:this.state.globalPlanApproval.plan.input,requestId:this.state.globalPlanApproval.plan.id,onAllow:this.state.globalPlanApproval.handlers.approve,onDeny:id=>this.state.globalPlanApproval.handlers.reject(id,""),visible:!0,global:!0})]})})}};__publicField(_Mobile,"COMMAND_TAGS",new Set(["command-name","command-message","command-args","local-command-caveat","local-command-stdout"]));let Mobile=_Mobile;export{Mobile as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Mobile-
|
|
2
|
-
import{_ as __vitePreload}from"./vendor-mdxeditor-DmzrSr0n.js";import{j as jsxRuntimeExports}from"./vendor-codemirror-Bh_IP9SJ.js";import{o as requireReactDom,g as getDefaultExportFromCjs}from"./vendor-antd-DW2QvF0l.js";!function(){const relList=document.createElement("link").relList;if(!(relList&&relList.supports&&relList.supports("modulepreload"))){for(const link of document.querySelectorAll('link[rel="modulepreload"]'))processPreload(link);new MutationObserver(mutations=>{for(const mutation of mutations)if("childList"===mutation.type)for(const node of mutation.addedNodes)"LINK"===node.tagName&&"modulepreload"===node.rel&&processPreload(node)}).observe(document,{childList:!0,subtree:!0})}function processPreload(link){if(link.ep)return;link.ep=!0;const fetchOpts=function(link){const fetchOpts={};return link.integrity&&(fetchOpts.integrity=link.integrity),link.referrerPolicy&&(fetchOpts.referrerPolicy=link.referrerPolicy),"use-credentials"===link.crossOrigin?fetchOpts.credentials="include":"anonymous"===link.crossOrigin?fetchOpts.credentials="omit":fetchOpts.credentials="same-origin",fetchOpts}(link);fetch(link.href,fetchOpts)}}(),function(){let token=null;function addToken(url){const t=function(){if(token)return token;const params=new URLSearchParams(window.location.search);return token=params.get("token")||"",token}();if(!t)return url;if(url.startsWith("/")){const separator=url.includes("?")?"&":"?";return`${url}${separator}token=${encodeURIComponent(t)}`}try{const urlObj=new URL(url);if(urlObj.origin===window.location.origin)return urlObj.searchParams.set("token",t),urlObj.toString()}catch{}return url}const originalFetch=window.fetch;window.fetch=function(url,options){return originalFetch(addToken(url),options)};const OriginalEventSource=window.EventSource;window.EventSource=function(url,config){return new OriginalEventSource(addToken(url),config)};const OriginalWebSocket=window.WebSocket;window.WebSocket=function(url,protocols){return new OriginalWebSocket(addToken(url),protocols)},window.WebSocket.prototype=OriginalWebSocket.prototype,window.WebSocket.CONNECTING=OriginalWebSocket.CONNECTING,window.WebSocket.OPEN=OriginalWebSocket.OPEN,window.WebSocket.CLOSING=OriginalWebSocket.CLOSING,window.WebSocket.CLOSED=OriginalWebSocket.CLOSED}();var hasRequiredClient,client={};const ReactDOM=getDefaultExportFromCjs(function(){if(hasRequiredClient)return client;hasRequiredClient=1;var m=requireReactDom();return client.createRoot=m.createRoot,client.hydrateRoot=m.hydrateRoot,client}()),_isIPadOS=navigator.maxTouchPoints>1&&/Macintosh/i.test(navigator.userAgent),_params=new URLSearchParams(window.location.search),_forceMobile="1"===_params.get("mobile"),_forcePad="1"===_params.get("ipad"),_savedMode=_forceMobile||_forcePad?null:localStorage.getItem("ccv_viewMode"),_autoNarrow=!_forceMobile&&!_forcePad&&!_savedMode&&!/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)&&!_isIPadOS&&window.innerWidth<750,isPad=_forcePad||"pad"===_savedMode||_autoNarrow,isMobile=_forcePad||_forceMobile||"pad"===_savedMode||_autoNarrow||"pc"!==_savedMode&&(/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)||_isIPadOS),isIOS=/iPhone|iPad|iPod/i.test(navigator.userAgent)||_isIPadOS;function setViewMode(mode){localStorage.setItem("ccv_viewMode",mode),location.reload()}isPad&&document.documentElement.classList.add("pad-mode"),isMobile&&isIOS&&!isPad&&document.documentElement.classList.add("mobile-ios");function safeStorage(key,value){try{if(void 0===value)return Number(sessionStorage.getItem(key)||0);sessionStorage.setItem(key,value)}catch{}return 0}function shouldReloadStaleChunk(name){const key=`_chunkReloadedAt:${name}`,last=safeStorage(key);return!(Date.now()-last<=3e5)&&(safeStorage(key,String(Date.now())),!0)}function handleStaleChunk(name,err,{onReload:onReload}={}){if(!shouldReloadStaleChunk(name))throw err;try{null==onReload||onReload()}catch{}return setTimeout(()=>window.location.reload(),200),new Promise(()=>{})}const root=ReactDOM.createRoot(document.getElementById("root")),onLoadError=err=>{(console.error("Failed to load app module:",err),!shouldReloadStaleChunk(isMobile?"Mobile":"App")||(window.location.reload(),0))&&(document.getElementById("root").textContent="Loading failed. Please refresh the page.")};isMobile?__vitePreload(async()=>{const{default:Mobile}=await import("./Mobile-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Mobile-DzXxKLN1.js","assets/vendor-codemirror-Bh_IP9SJ.js","assets/vendor-antd-DW2QvF0l.js","assets/AppHeader.module-ObnvAJgf.js","assets/vendor-markdown-Bpu4AByL.js","assets/vendor-mdxeditor-DmzrSr0n.js","assets/vendor-xterm-DckPrCx1.js","assets/vendor-highlight-IFTJ9nxW.js","assets/vendor-virtuoso-CU5wFM1_.js","assets/AppHeader-eYPHFv75.css","assets/Mobile-DolwHzoQ.css","assets/App-VLXeimII.js","assets/vendor-qrcode-CXOKgQeD.js","assets/App-2BwFLSES.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as __vitePreload}from"./vendor-mdxeditor-DmzrSr0n.js";import{j as jsxRuntimeExports}from"./vendor-codemirror-Bh_IP9SJ.js";import{o as requireReactDom,g as getDefaultExportFromCjs}from"./vendor-antd-DW2QvF0l.js";!function(){const relList=document.createElement("link").relList;if(!(relList&&relList.supports&&relList.supports("modulepreload"))){for(const link of document.querySelectorAll('link[rel="modulepreload"]'))processPreload(link);new MutationObserver(mutations=>{for(const mutation of mutations)if("childList"===mutation.type)for(const node of mutation.addedNodes)"LINK"===node.tagName&&"modulepreload"===node.rel&&processPreload(node)}).observe(document,{childList:!0,subtree:!0})}function processPreload(link){if(link.ep)return;link.ep=!0;const fetchOpts=function(link){const fetchOpts={};return link.integrity&&(fetchOpts.integrity=link.integrity),link.referrerPolicy&&(fetchOpts.referrerPolicy=link.referrerPolicy),"use-credentials"===link.crossOrigin?fetchOpts.credentials="include":"anonymous"===link.crossOrigin?fetchOpts.credentials="omit":fetchOpts.credentials="same-origin",fetchOpts}(link);fetch(link.href,fetchOpts)}}(),function(){let token=null;function addToken(url){const t=function(){if(token)return token;const params=new URLSearchParams(window.location.search);return token=params.get("token")||"",token}();if(!t)return url;if(url.startsWith("/")){const separator=url.includes("?")?"&":"?";return`${url}${separator}token=${encodeURIComponent(t)}`}try{const urlObj=new URL(url);if(urlObj.origin===window.location.origin)return urlObj.searchParams.set("token",t),urlObj.toString()}catch{}return url}const originalFetch=window.fetch;window.fetch=function(url,options){return originalFetch(addToken(url),options)};const OriginalEventSource=window.EventSource;window.EventSource=function(url,config){return new OriginalEventSource(addToken(url),config)};const OriginalWebSocket=window.WebSocket;window.WebSocket=function(url,protocols){return new OriginalWebSocket(addToken(url),protocols)},window.WebSocket.prototype=OriginalWebSocket.prototype,window.WebSocket.CONNECTING=OriginalWebSocket.CONNECTING,window.WebSocket.OPEN=OriginalWebSocket.OPEN,window.WebSocket.CLOSING=OriginalWebSocket.CLOSING,window.WebSocket.CLOSED=OriginalWebSocket.CLOSED}();var hasRequiredClient,client={};const ReactDOM=getDefaultExportFromCjs(function(){if(hasRequiredClient)return client;hasRequiredClient=1;var m=requireReactDom();return client.createRoot=m.createRoot,client.hydrateRoot=m.hydrateRoot,client}()),_isIPadOS=navigator.maxTouchPoints>1&&/Macintosh/i.test(navigator.userAgent),_params=new URLSearchParams(window.location.search),_forceMobile="1"===_params.get("mobile"),_forcePad="1"===_params.get("ipad"),_savedMode=_forceMobile||_forcePad?null:localStorage.getItem("ccv_viewMode"),_autoNarrow=!_forceMobile&&!_forcePad&&!_savedMode&&!/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)&&!_isIPadOS&&window.innerWidth<750,isPad=_forcePad||"pad"===_savedMode||_autoNarrow,isMobile=_forcePad||_forceMobile||"pad"===_savedMode||_autoNarrow||"pc"!==_savedMode&&(/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)||_isIPadOS),isIOS=/iPhone|iPad|iPod/i.test(navigator.userAgent)||_isIPadOS;function setViewMode(mode){localStorage.setItem("ccv_viewMode",mode),location.reload()}isPad&&document.documentElement.classList.add("pad-mode"),isMobile&&isIOS&&!isPad&&document.documentElement.classList.add("mobile-ios");function safeStorage(key,value){try{if(void 0===value)return Number(sessionStorage.getItem(key)||0);sessionStorage.setItem(key,value)}catch{}return 0}function shouldReloadStaleChunk(name){const key=`_chunkReloadedAt:${name}`,last=safeStorage(key);return!(Date.now()-last<=3e5)&&(safeStorage(key,String(Date.now())),!0)}function handleStaleChunk(name,err,{onReload:onReload}={}){if(!shouldReloadStaleChunk(name))throw err;try{null==onReload||onReload()}catch{}return setTimeout(()=>window.location.reload(),200),new Promise(()=>{})}const root=ReactDOM.createRoot(document.getElementById("root")),onLoadError=err=>{(console.error("Failed to load app module:",err),!shouldReloadStaleChunk(isMobile?"Mobile":"App")||(window.location.reload(),0))&&(document.getElementById("root").textContent="Loading failed. Please refresh the page.")};isMobile?__vitePreload(async()=>{const{default:Mobile}=await import("./Mobile-DzXxKLN1.js");return{default:Mobile}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(({default:Mobile})=>{root.render(jsxRuntimeExports.jsx(Mobile,{}))}).catch(onLoadError):__vitePreload(async()=>{const{default:App}=await import("./App-VLXeimII.js");return{default:App}},__vite__mapDeps([11,1,2,3,4,5,6,7,8,9,12,13])).then(({default:App})=>{root.render(jsxRuntimeExports.jsx(App,{}))}).catch(onLoadError);export{isPad as a,isMobile as b,handleStaleChunk as h,isIOS as i,setViewMode as s};
|
package/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>Claude Code Viewer</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico?v=1">
|
|
8
8
|
<link rel="shortcut icon" href="/favicon.ico?v=1">
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-xdUdMhzS.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/vendor-antd-DW2QvF0l.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-Bh_IP9SJ.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/vendor-mdxeditor-DmzrSr0n.js">
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -311,11 +311,15 @@ async function handleRequest(req, res) {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// DNS rebinding 防护:即使带了正确 token,Host header 必须落在 allowlist 里。
|
|
314
|
-
// 默认放行
|
|
315
|
-
//
|
|
314
|
+
// 默认放行 loopback + 本机所有 LAN IPv4(getAllLocalIps()):cc-viewer 核心场景就是手机扫码访问 LAN URL,
|
|
315
|
+
// 要求用户每次手动设 CCV_ALLOWED_HOSTS 不可接受。token 仍是必需(server.js:300-310 ACCESS_TOKEN gate),
|
|
316
|
+
// DNS rebinding 攻击者需精确知道用户 LAN IP 才能利用,门槛降低但不增新攻击面;Vite/Cursor 同行也默认放开 LAN。
|
|
317
|
+
// CCV_ALLOWED_HOSTS 显式设(包括 '*' 关闭防护)时完全沿用用户值,与 1.6.227 行为一致,向后兼容。
|
|
318
|
+
// 静态资源和 OPTIONS 预检不挡。
|
|
316
319
|
if (!isStaticAsset && method !== 'OPTIONS') {
|
|
317
|
-
const allowedHosts =
|
|
318
|
-
|
|
320
|
+
const allowedHosts = process.env.CCV_ALLOWED_HOSTS
|
|
321
|
+
? process.env.CCV_ALLOWED_HOSTS.split(',').map(s => s.trim()).filter(Boolean)
|
|
322
|
+
: ['localhost', '127.0.0.1', '::1', '[::1]', ...getAllLocalIps()];
|
|
319
323
|
if (!allowedHosts.includes('*')) {
|
|
320
324
|
const hostHeader = (req.headers.host || '').toLowerCase();
|
|
321
325
|
// 端口剥离:RFC 3986 要求 IPv6 Host 必须带 brackets `[::1]:port`,bare `::1` 末尾 `\d` 会被错剥成 `:`。
|