cc-viewer 1.9.24 → 1.9.26
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/README.md +1 -1
- package/cli.js +14 -0
- package/dist/assets/App-CjP88gbM.css +1 -0
- package/dist/assets/App-CkbwkH74.js +2 -0
- package/dist/assets/ArchivePreview-1XAr8LvB.js +1 -0
- package/dist/assets/AudioPreview-7zCADwCz.css +1 -0
- package/dist/assets/AudioPreview-DGcbrJjl.js +1 -0
- package/dist/assets/{MdxEditorPanel-CT6w8hjl.js → MdxEditorPanel-DFGSL5OM.js} +1 -1
- package/dist/assets/Mobile-DFu8Kn5W.js +1 -0
- package/dist/assets/ProxyStatsModal-BU9liIIO.js +1 -0
- package/dist/assets/SubtitlePreview-BGW9y2LI.css +1 -0
- package/dist/assets/SubtitlePreview-Ca_dpMFL.js +1 -0
- package/dist/assets/{_baseUniq-BGBEhBne.js → _baseUniq-9PjtCZvX.js} +1 -1
- package/dist/assets/{arc-4pbWOEmh.js → arc-C7i0W-3s.js} +1 -1
- package/dist/assets/{architectureDiagram-Q4EWVU46-BHZPDnby.js → architectureDiagram-Q4EWVU46-B0-9CMiF.js} +1 -1
- package/dist/assets/{blockDiagram-DXYQGD6D-DszLU7Pg.js → blockDiagram-DXYQGD6D-v3Zg9ooQ.js} +1 -1
- package/dist/assets/{c4Diagram-AHTNJAMY-DbDJNYxl.js → c4Diagram-AHTNJAMY-BngN_7qF.js} +1 -1
- package/dist/assets/{channel-BpIsxDHj.js → channel-IbZhDvnM.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-ChcBwBh2.js → chunk-4BX2VUAB-8cHviTVA.js} +1 -1
- package/dist/assets/{chunk-4TB4RGXK-DzBEAck_.js → chunk-4TB4RGXK-C3CP4doN.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-9UDvmw07.js → chunk-55IACEB6-FUVA-xfN.js} +1 -1
- package/dist/assets/{chunk-EDXVE4YY-DHEU2DKg.js → chunk-EDXVE4YY-BL4ddY7-.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-sysT0Sy2.js → chunk-FMBD7UC4-fgqPq6Tx.js} +1 -1
- package/dist/assets/{chunk-OYMX7WX6-DLXt2vYo.js → chunk-OYMX7WX6-BGnPcd9h.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-CDIkC7QK.js → chunk-QZHKN3VN-Cs6WjmqO.js} +1 -1
- package/dist/assets/{chunk-YZCP3GAM-D9b_INz7.js → chunk-YZCP3GAM-qq4Q4j7H.js} +1 -1
- package/dist/assets/classDiagram-6PBFFD2Q-Bszndikj.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-Bszndikj.js +1 -0
- package/dist/assets/clone-MC_fW61A.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-DJQwV_Dp.js → cose-bilkent-S5V4N54A-D-uK3RSk.js} +1 -1
- package/dist/assets/{dagre-KV5264BT-bl9Pq21t.js → dagre-KV5264BT-BulmeCnQ.js} +1 -1
- package/dist/assets/{diagram-5BDNPKRD-BA8CJxzI.js → diagram-5BDNPKRD-DI7Q04yx.js} +1 -1
- package/dist/assets/{diagram-G4DWMVQ6-DzSQULuz.js → diagram-G4DWMVQ6-B7zYIZac.js} +1 -1
- package/dist/assets/{diagram-MMDJMWI5-DhfHWnT4.js → diagram-MMDJMWI5-D_f5k-GJ.js} +1 -1
- package/dist/assets/{diagram-TYMM5635-BbAoFfGS.js → diagram-TYMM5635-DQ-vW7nJ.js} +1 -1
- package/dist/assets/{erDiagram-SMLLAGMA-CMjA2eBk.js → erDiagram-SMLLAGMA-BgubHrDi.js} +1 -1
- package/dist/assets/{flowDiagram-DWJPFMVM-bOubqgJ6.js → flowDiagram-DWJPFMVM-fPYA9wmX.js} +1 -1
- package/dist/assets/{ganttDiagram-T4ZO3ILL-BUIu7WwI.js → ganttDiagram-T4ZO3ILL-hNsatnIF.js} +1 -1
- package/dist/assets/{gitGraphDiagram-UUTBAWPF-B_vrztDU.js → gitGraphDiagram-UUTBAWPF-1GijxkLh.js} +1 -1
- package/dist/assets/{graph-BR3YGx52.js → graph-sNq_HPra.js} +1 -1
- package/dist/assets/{index-BMpUfdYI.js → index-BnWh6jkG.js} +1 -1
- package/dist/assets/{index-DtZAmvwJ.js → index-CmwhODrM.js} +1 -1
- package/dist/assets/{index-B88yR2TU.js → index-D6mBgqj7.js} +1 -1
- package/dist/assets/{index-mvm_Pxcf.js → index-DggrqRzx.js} +1 -1
- package/dist/assets/{index-BQx5MOpr.js → index-DiVw76Ih.js} +1 -1
- package/dist/assets/index-Dn7twftJ.js +2 -0
- package/dist/assets/{index-DwMyfQJq.js → index-ijWns1Ex.js} +1 -1
- package/dist/assets/{index-ClTuiPoz.js → index-ng96S3Hy.js} +1 -1
- package/dist/assets/{infoDiagram-42DDH7IO-Co9Db2ir.js → infoDiagram-42DDH7IO-C9HYi6HU.js} +1 -1
- package/dist/assets/{ishikawaDiagram-UXIWVN3A-4z7EydCd.js → ishikawaDiagram-UXIWVN3A-D3Ae6xRc.js} +1 -1
- package/dist/assets/{journeyDiagram-VCZTEJTY-CtLfbhYE.js → journeyDiagram-VCZTEJTY-BMPDBa6W.js} +1 -1
- package/dist/assets/{jszip.min-DtbrAiWv.js → jszip.min-D6JfNfcl.js} +1 -1
- package/dist/assets/{kanban-definition-6JOO6SKY-9ZrhOvdX.js → kanban-definition-6JOO6SKY-BXEtzhr-.js} +1 -1
- package/dist/assets/{layout-Ddo06NJO.js → layout-CbMMhBh2.js} +1 -1
- package/dist/assets/{linear-BZUsBSwS.js → linear-DivVFiS7.js} +1 -1
- package/dist/assets/{mermaid.core-O-x0KuTp.js → mermaid.core-Dq-d8oPN.js} +2 -2
- package/dist/assets/{min-PzJh19JL.js → min-CXI1r_lz.js} +1 -1
- package/dist/assets/{mindmap-definition-QFDTVHPH-C3MVo-7p.js → mindmap-definition-QFDTVHPH-CONBMUxc.js} +1 -1
- package/dist/assets/{pieDiagram-DEJITSTG-CMn9-kQc.js → pieDiagram-DEJITSTG-C0rsPXdi.js} +1 -1
- package/dist/assets/{quadrantDiagram-34T5L4WZ-9eyqTdkj.js → quadrantDiagram-34T5L4WZ-DA2PNu4u.js} +1 -1
- package/dist/assets/{requirementDiagram-MS252O5E-BJbuDOpR.js → requirementDiagram-MS252O5E-DjsBvm40.js} +1 -1
- package/dist/assets/{sankeyDiagram-XADWPNL6-CzQ1KxD3.js → sankeyDiagram-XADWPNL6-Drl_Kmzt.js} +1 -1
- package/dist/assets/{seqResourceLoaders-DH-Nl0yh.css → seqResourceLoaders-CjAnOisT.css} +1 -1
- package/dist/assets/seqResourceLoaders-L-Fzax-z.js +2 -0
- package/dist/assets/{sequenceDiagram-FGHM5R23-CfmSEAYp.js → sequenceDiagram-FGHM5R23-Dcz5NXKY.js} +1 -1
- package/dist/assets/{stateDiagram-FHFEXIEX-Brw2ZXQC.js → stateDiagram-FHFEXIEX-7P3czdgX.js} +1 -1
- package/dist/assets/{stateDiagram-v2-QKLJ7IA2-Dnyo23Rp.js → stateDiagram-v2-QKLJ7IA2-C3xgfAOE.js} +1 -1
- package/dist/assets/{timeline-definition-GMOUNBTQ-DNi7GnlG.js → timeline-definition-GMOUNBTQ-BVe-eF-9.js} +1 -1
- package/dist/assets/util-DUb-88OI.js +1 -0
- package/dist/assets/{vendor-antd-DWLgSkPo.js → vendor-antd-VJVAjRBJ.js} +1 -1
- package/dist/assets/{vendor-codemirror-CKsm_iG4.js → vendor-codemirror-D2yaEhu3.js} +1 -1
- package/dist/assets/{vendor-mdxeditor-Dah6NK0y.js → vendor-mdxeditor-DKI8QSRd.js} +2 -2
- package/dist/assets/{vendor-qrcode-CDcb8weP.js → vendor-qrcode-CDB9Y_Vp.js} +1 -1
- package/dist/assets/{vendor-virtuoso-DKUobZpA.js → vendor-virtuoso-DEFa9UCG.js} +1 -1
- package/dist/assets/{vennDiagram-DHZGUBPP-Cdkdx7gB.js → vennDiagram-DHZGUBPP-C8KL2OR8.js} +1 -1
- package/dist/assets/{wardley-RL74JXVD-YKzsVN4U.js → wardley-RL74JXVD-Dm4mxyoW.js} +1 -1
- package/dist/assets/{wardleyDiagram-NUSXRM2D-gBsb6aut.js → wardleyDiagram-NUSXRM2D-BoA34gDh.js} +1 -1
- package/dist/assets/{xychartDiagram-5P7HB3ND-Bh63NWof.js → xychartDiagram-5P7HB3ND-66ynIBzj.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/server/lib/approval-policy.js +5 -2
- package/server/lib/ask/perm-bridge.js +4 -0
- package/server/lib/ask/perm-request-bridge.js +1 -1
- package/server/lib/audio-stream.js +267 -0
- package/server/lib/auto-approve.js +26 -5
- package/server/lib/restart-helper.js +65 -0
- package/server/lib/restart.js +83 -0
- package/server/lib/sdk-manager.js +19 -10
- package/server/lib/terminal-ws-ping.js +42 -0
- package/server/lib/update-instances.js +42 -0
- package/server/lib/update-job.js +260 -0
- package/server/lib/updater.js +37 -220
- package/server/proxy.js +16 -9
- package/server/pty-manager.js +1 -0
- package/server/routes/ask-perm.js +17 -13
- package/server/routes/files-content.js +65 -0
- package/server/routes/project-meta.js +11 -7
- package/server/routes/update.js +58 -0
- package/server/server.js +67 -11
- package/dist/assets/App-BwRRqrP5.css +0 -1
- package/dist/assets/App-Cfmm41z0.js +0 -2
- package/dist/assets/ArchivePreview-dKWXN9Zp.js +0 -1
- package/dist/assets/Mobile-noWViQpL.js +0 -1
- package/dist/assets/ProxyStatsModal-BeCRPqaC.js +0 -1
- package/dist/assets/classDiagram-6PBFFD2Q-4Lh0SB4X.js +0 -1
- package/dist/assets/classDiagram-v2-HSJHXN6E-4Lh0SB4X.js +0 -1
- package/dist/assets/clone-cWiXtXrO.js +0 -1
- package/dist/assets/index-Ca3a2tOc.js +0 -2
- package/dist/assets/seqResourceLoaders-DeqzMajS.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as jsxRuntimeExports}from"./vendor-codemirror-CKsm_iG4.js";import{a as reactExports,I as Icon,b as _extends,n as RefIcon$1,o as RefIcon$2,p as RefIcon$3,q as RefIcon$4}from"./vendor-antd-DWLgSkPo.js";import{a as apiUrl,w as withViewParams,t}from"./index-Ca3a2tOc.js";import{aj as getPreviewKind,ak as reportSwallowed}from"./seqResourceLoaders-DeqzMajS.js";import"./vendor-mdxeditor-Dah6NK0y.js";import"./vendor-xterm-DckPrCx1.js";import"./vendor-markdown-DOJHsAxX.js";import"./vendor-virtuoso-DKUobZpA.js";import"./vendor-highlight-IFTJ9nxW.js";var LockOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"},LockOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref:ref,icon:LockOutlined$1}))},RefIcon=reactExports.forwardRef(LockOutlined);function archiveNoteText(note,translate,formatSize){const params={...note.params||{}};for(const key of["size","max","shown"])Number.isFinite(params[key])&&(params[key]=formatSize(params[key]));return translate(`ui.archive.note.${note.code}`,params)}function isArchiveEntrySelected(entry,selected2){return!!entry&&entry===selected2}function shouldShowArchiveNotices(result,visible,treeTruncated=!1){return result.notes.length>0||result.truncated||visible.truncated||treeTruncated}function archiveErrorText(error2,translate){var _a,_b;if(!(null==error2?void 0:error2.code))return translate("ui.archive.loadFailed");return translate(`ui.archive.error.${["ENCRYPTED","UNSUPPORTED_METHOD","NO_DECOMPRESSION"].includes(error2.code)?error2.code:"CORRUPT"}`,{format:(null==(_a=error2.params)?void 0:_a.format)||(null==(_b=error2.params)?void 0:_b.method)||""})}class ArchiveError extends Error{constructor(message,code="ARCHIVE_ERROR",params={}){super(message),this.name="ArchiveError",this.code=code,this.params=params}}function toBytes(input){if(input instanceof Uint8Array)return input;if(input instanceof ArrayBuffer)return new Uint8Array(input);if(ArrayBuffer.isView(input))return new Uint8Array(input.buffer,input.byteOffset,input.byteLength);throw new ArchiveError("Archive data must be a Uint8Array or ArrayBuffer.","BAD_INPUT")}function readU16(b,o){return b[o]|b[o+1]<<8}function readU32(b,o){return(b[o]|b[o+1]<<8|b[o+2]<<16|b[o+3]<<24)>>>0}function readU64(b,o){const value=readU32(b,o)+4294967296*readU32(b,o+4);if(!Number.isSafeInteger(value))throw new ArchiveError("ZIP64 value exceeds the safe integer range.","UNSAFE_SIZE");return value}function concatBytes(chunks,total){if(1===chunks.length)return chunks[0];const out=new Uint8Array(total);let offset=0;for(const chunk of chunks)out.set(chunk,offset),offset+=chunk.length;return out}const decoderCache=new Map;function tryDecode(label,bytes,fatal){const decoder=function(label,fatal=!1){const key=`${label}|${fatal}`;if(decoderCache.has(key))return decoderCache.get(key);let decoder;try{decoder=new TextDecoder(label,{fatal:fatal})}catch{decoder=null}return decoderCache.set(key,decoder),decoder}(label,fatal);if(!decoder)return null;try{return decoder.decode(bytes)}catch{return null}}function latin1(bytes){let out="";for(let i=0;i<bytes.length;i+=32768)out+=String.fromCharCode.apply(null,bytes.subarray(i,i+32768));return out}function decodeLegacyText(bytes){const asGbk=tryDecode("gbk",bytes,!0)??(truncated?tryDecode("gbk",bytes,!1):null);return null!==asGbk&&[...asGbk].some(char=>{const code=char.codePointAt(0);return code>=19968&&code<=40959})?{text:asGbk,encoding:"gbk"}:{text:latin1(bytes),encoding:"latin1"}}function decodeFileName(bytes,{utf8Flag:utf8Flag=!1}={}){const b=toBytes(bytes);if(0===b.length)return{name:"",encoding:"utf-8"};const asUtf8=tryDecode("utf-8",b,!0);if(null!==asUtf8)return{name:asUtf8,encoding:"utf-8"};if(utf8Flag)return{name:tryDecode("utf-8",b,!1)??latin1(b),encoding:"utf-8-lossy"};const legacy=decodeLegacyText(b);return{name:legacy.text,encoding:legacy.encoding}}const textEncoder=new TextEncoder;function cleanDisplaySegment(segment){return segment.replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g,"")}function normalizeEntryPath(raw){const input=String(raw??""),truncated2=input.length>4096,source=(truncated2?input.slice(0,4096):input).replace(/\\/g,"/"),trailingSlash=/\/$/.test(input),clean=[];let unsafe=truncated2,length=0;for(const part of source.split("/")){if(!part||"."===part)continue;if((".."===part||/^[a-zA-Z]:$/.test(part)||clean.length>=64)&&(unsafe=!0),clean.length>=64)break;const name2=cleanDisplaySegment(part),nameLength=textEncoder.encode(name2).length;if(length+nameLength>4096){let shortened="",used=0;for(const char of name2){const charLength=textEncoder.encode(char).length;if(length+used+charLength>4096)break;shortened+=char,used+=charLength}shortened&&clean.push(shortened),unsafe=!0;break}clean.push(name2),length+=nameLength}return{path:clean.join("/"),trailingSlash:trailingSlash,unsafe:unsafe}}function decodeTextBytes(input,{maxBytes:maxBytes=4194304,truncated:truncated2=!1}={}){let b=toBytes(input);if(b.length>maxBytes&&(b=b.subarray(0,maxBytes)),b.length>=3&&239===b[0]&&187===b[1]&&191===b[2])return{text:tryDecode("utf-8",b.subarray(3),!1)??"",encoding:"utf-8"};if(b.length>=2&&255===b[0]&&254===b[1])return{text:tryDecode("utf-16le",b.subarray(2),!1)??"",encoding:"utf-16le"};if(b.length>=2&&254===b[0]&&255===b[1])return{text:tryDecode("utf-16be",b.subarray(2),!1)??"",encoding:"utf-16be"};if(truncated2){let end=b.length;for(;end>0&&128==(192&b[end]);)end--;if(end>0&&end<b.length){const lead=b[end],expected=lead>=240?4:lead>=224?3:lead>=194?2:1;b.length-end<expected&&(b=b.subarray(0,end))}}const asUtf8=tryDecode("utf-8",b,!0);return null!==asUtf8?{text:asUtf8,encoding:"utf-8"}:decodeLegacyText(b)}const IMAGE_SIGNATURES=[{mime:"image/png",sig:[137,80,78,71,13,10,26,10]},{mime:"image/jpeg",sig:[255,216,255]},{mime:"image/gif",sig:[71,73,70,56,57,97]},{mime:"image/bmp",sig:[66,77,null,null,null,null,0,0,0,0,null,null,null,null]}];function classifyContent(input){const b=toBytes(input);if(0===b.length)return{kind:"empty",mime:null};if(b.length>=2&&(255===b[0]&&254===b[1]||254===b[0]&&255===b[1]))return{kind:"text",mime:null};for(const item of IMAGE_SIGNATURES)if(item.sig.every((byte,i)=>null===byte||b[i]===byte))return{kind:"image",mime:item.mime};return b.length>=12&&"RIFF"===latin1(b.subarray(0,4))&&"WEBP"===latin1(b.subarray(8,12))?{kind:"image",mime:"image/webp"}:b.length>=4&&37===b[0]&&80===b[1]&&68===b[2]&&70===b[3]?{kind:"binary",mime:"application/pdf"}:function(input){const b=toBytes(input),n=Math.min(b.length,4096);if(0===n)return!0;let ctrl=0;for(let i=0;i<n;i++){const c=b[i];if(0===c||c<9)return!1;(c>13&&c<32||127===c)&&ctrl++}return ctrl/n<.02}(b)?{kind:"text",mime:null}:{kind:"binary",mime:null}}let crcTable=null;function crc32(bytes){crcTable||(crcTable=function(){const table=new Uint32Array(256);for(let i=0;i<256;i++){let c=i;for(let k=0;k<8;k++)c=1&c?3988292384^c>>>1:c>>>1;table[i]=c>>>0}return table}());let c=4294967295;for(let i=0;i<bytes.length;i++)c=crcTable[255&(c^bytes[i])]^c>>>8;return(4294967295^c)>>>0}function formatBytes(n){return Number.isFinite(n)?n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:n<1073741824?`${(n/1024/1024).toFixed(1)} MB`:`${(n/1024/1024/1024).toFixed(2)} GB`:"—"}function compareTreeNodes(a,b){return a.dir!==b.dir?a.dir?-1:1:a.name<b.name?-1:a.name>b.name?1:0}const EXT_TO_FORMAT={zip:"zip",tar:"tar",gz:"gzip",tgz:"tar.gz","tar.gz":"tar.gz","7z":"7z",rar:"rar",xz:"xz","tar.xz":"xz",txz:"xz",bz2:"bz2","tar.bz2":"bz2",tbz2:"bz2",tbz:"bz2"};const MAGIC_CHECKS=[{format:"zip",test:b=>b.length>=4&&80===b[0]&&75===b[1]&&(3===b[2]&&4===b[3]||5===b[2]&&6===b[3]||7===b[2]&&8===b[3])},{format:"gzip",test:b=>b.length>=2&&31===b[0]&&139===b[1]},{format:"7z",test:b=>b.length>=6&&55===b[0]&&122===b[1]&&188===b[2]&&175===b[3]&&39===b[4]&&28===b[5]},{format:"rar",test:b=>b.length>=4&&82===b[0]&&97===b[1]&&114===b[2]&&33===b[3]},{format:"xz",test:b=>b.length>=6&&253===b[0]&&55===b[1]&&122===b[2]&&88===b[3]&&90===b[4]&&0===b[5]},{format:"bz2",test:b=>b.length>=3&&66===b[0]&&90===b[1]&&104===b[2]}];function detect(input,filename=""){const bytes=toBytes(input),extension=function(filename=""){const base=String(filename).split(/[\\/]/).pop().toLowerCase();for(const ext of["tar.gz","tar.xz","tar.bz2"])if(base.endsWith(`.${ext}`))return ext;const dot=base.lastIndexOf(".");return dot>0?base.slice(dot+1):""}(filename),magic=function(input){const b=toBytes(input);for(const check of MAGIC_CHECKS)if(check.test(b))return check.format;return b.length>=263&&117===b[257]&&115===b[258]&&116===b[259]&&97===b[260]&&114===b[261]&&(0===b[262]||32===b[262])?"tar":null}(bytes),format="gzip"!==magic||"tar.gz"!==extension&&"tgz"!==extension?magic||EXT_TO_FORMAT[extension]||null:"tar.gz";return{format:format,supported:"zip"===format||"tar"===format||"gzip"===format||"tar.gz"===format,source:magic?"magic":format?"extension":"none",extension:extension}}const capabilityCache=new Map;function isDecompressionSupported(format="deflate-raw"){if("function"!=typeof DecompressionStream)return!1;if(capabilityCache.has(format))return capabilityCache.get(format);try{return new DecompressionStream(format),capabilityCache.set(format,!0),!0}catch{return capabilityCache.set(format,!1),!1}}async function inflateBytes(input,format="deflate-raw",options={}){const bytes=toBytes(input),maxBytes=options.maxBytes??33554432;if(!Number.isSafeInteger(maxBytes)||maxBytes<0)throw new ArchiveError("Invalid decompression limit.","BAD_LIMIT");if(!isDecompressionSupported(format))throw new ArchiveError(`Decompression is unavailable for ${format}.`,"NO_DECOMPRESSION",{format:format});if(0===maxBytes)return{bytes:new Uint8Array(0),truncated:bytes.length>0};const stream=new DecompressionStream(format),writer=stream.writable.getWriter(),writeDone=writer.write(bytes).then(()=>writer.close()).catch(()=>{}),reader=stream.readable.getReader(),chunks=[];let total=0,truncated2=!1;try{for(;;){const{done:done,value:value}=await reader.read();if(done)break;if(total+value.length>maxBytes){const take=maxBytes-total;take>0&&chunks.push(value.subarray(0,take)),total+=take,truncated2=!0,await reader.cancel().catch(()=>{});break}chunks.push(value),total+=value.length}}catch(err){throw new ArchiveError(`Unable to decompress archive data: ${(null==err?void 0:err.message)||"invalid data"}`,"INFLATE_FAILED")}finally{await writeDone}return{bytes:concatBytes(chunks,total),truncated:truncated2}}const METHOD_NAMES={0:"stored",1:"shrink",6:"implode",8:"deflate",9:"deflate64",12:"bzip2",14:"lzma",93:"zstd",95:"xz",98:"ppmd"};function parseCentralEntry(bytes,p,index){const versionMadeBy=readU16(bytes,p+4),flags=readU16(bytes,p+8),methodId=readU16(bytes,p+10),crc=readU32(bytes,p+16);let compressedSize=readU32(bytes,p+20),size2=readU32(bytes,p+24);const nameLen=readU16(bytes,p+28),extraLen=readU16(bytes,p+30);let diskStart=readU16(bytes,p+34);const externalAttrs=readU32(bytes,p+38);let localHeaderOffset=readU32(bytes,p+42);const extras=function(extra){const map=new Map;let p=0;for(;p+4<=extra.length;){const size2=readU16(extra,p+2),start=p+4;if(start+size2>extra.length)break;map.set(readU16(extra,p),extra.subarray(start,start+size2)),p=start+size2}return map}(bytes.subarray(p+46+nameLen,p+46+nameLen+extraLen)),z64=extras.get(1);let zip64=!1;if(z64){let q=0;4294967295===size2&&q+8<=z64.length&&(size2=readU64(z64,q),q+=8,zip64=!0),4294967295===compressedSize&&q+8<=z64.length&&(compressedSize=readU64(z64,q),q+=8,zip64=!0),4294967295===localHeaderOffset&&q+8<=z64.length&&(localHeaderOffset=readU64(z64,q),q+=8,zip64=!0),65535===diskStart&&q+4<=z64.length&&(diskStart=readU32(z64,q),zip64=!0)}const decoded=decodeFileName(bytes.subarray(p+46,p+46+nameLen),{utf8Flag:!!(2048&flags)}),normalized=normalizeEntryPath(decoded.name),unixMode=versionMadeBy>>8==3||versionMadeBy>>8==19?externalAttrs>>>16:0,dir=normalized.trailingSlash||!!(16&externalAttrs)||16384==(61440&unixMode);let mtime=function(date16,time16){const date=new Date(1980+(date16>>9&127),(date16>>5&15||1)-1,31&date16||1,time16>>11&31,time16>>5&63,2*(31&time16));return Number.isFinite(date.getTime())?date.getTime():null}(readU16(bytes,p+14),readU16(bytes,p+12));const ut=extras.get(21589);return ut&&ut.length>=5&&1&ut[0]&&readU32(ut,1)>0&&(mtime=1e3*readU32(ut,1)),{index:index,path:normalized.path,unsafePath:normalized.unsafe,dir:dir,size:size2,compressedSize:compressedSize,crc32:crc,mtime:mtime,encrypted:!!(65&flags),method:(id=methodId,METHOD_NAMES[id]||`method-${id}`),methodId:methodId,nameEncoding:decoded.encoding,localHeaderOffset:localHeaderOffset,diskStart:diskStart,zip64:zip64,container:"zip"};var id}function parseZip(input,options={}){const bytes=toBytes(input),maxEntries=options.maxEntries??5e3,notes=[],eocd=function(bytes){const len=bytes.length;if(len<22)return null;const min=Math.max(0,len-22-65535);for(let i=len-22;i>=min;i--)if(101010256===readU32(bytes,i)&&i+22+readU16(bytes,i+20)===len)return{offset:i,strict:!0};for(let i=len-22;i>=min;i--)if(101010256===readU32(bytes,i))return{offset:i,strict:!1};return null}(bytes);if(!eocd)throw new ArchiveError("ZIP end-of-central-directory record not found.","BAD_ZIP");let totalEntries=readU16(bytes,eocd.offset+10),cdSize=readU32(bytes,eocd.offset+12),cdOffset=readU32(bytes,eocd.offset+16),zip64=!1;if(65535===totalEntries||4294967295===cdSize||4294967295===cdOffset){const z=function(bytes,eocdOffset){const locatorOffset=eocdOffset-20;if(locatorOffset<0||117853008!==readU32(bytes,locatorOffset))return null;const recordOffset=readU64(bytes,locatorOffset+8);return recordOffset+56>bytes.length||101075792!==readU32(bytes,recordOffset)?null:{totalEntries:readU64(bytes,recordOffset+32),cdSize:readU64(bytes,recordOffset+40),cdOffset:readU64(bytes,recordOffset+48)}}(bytes,eocd.offset);z?({totalEntries:totalEntries,cdSize:cdSize,cdOffset:cdOffset}=z):notes.push({code:"ZIP64_MISSING"}),zip64=!!z}if(0!==readU16(bytes,eocd.offset+4)||0!==readU16(bytes,eocd.offset+6))throw new ArchiveError("Multi-disk ZIP archives are not supported.","UNSUPPORTED_FORMAT");if(cdOffset>bytes.length)throw new ArchiveError("ZIP central directory is out of bounds.","BAD_ZIP");cdOffset+cdSize>bytes.length&¬es.push({code:"CENTRAL_DIR_TRUNCATED"});const entries=[];let truncated2=!1,p=cdOffset;for(let i=0;i<totalEntries;i++){if(entries.length>=maxEntries){truncated2=!0,notes.push({code:"ENTRY_LIMIT",params:{count:maxEntries}});break}if(p+46>bytes.length){if(0===i)throw new ArchiveError("Incomplete ZIP central directory.","BAD_ZIP");notes.push({code:"CENTRAL_DIR_EARLY_END",params:{index:i+1}}),truncated2=!0;break}if(33639248!==readU32(bytes,p)){if(0===i)throw new ArchiveError("Invalid ZIP central directory signature.","BAD_ZIP");notes.push({code:"CENTRAL_DIR_BAD_ENTRY",params:{index:i+1}}),truncated2=!0;break}const entryLength=46+readU16(bytes,p+28)+readU16(bytes,p+30)+readU16(bytes,p+32);if(p+entryLength>bytes.length||p+entryLength>cdOffset+cdSize){if(0===i)throw new ArchiveError("ZIP central directory entry exceeds its declared bounds.","BAD_ZIP");notes.push({code:"CENTRAL_DIR_EARLY_END",params:{index:i+1}}),truncated2=!0;break}const entry=parseCentralEntry(bytes,p,i);if(0!==entry.diskStart)throw new ArchiveError("Multi-disk ZIP entries are not supported.","UNSUPPORTED_FORMAT");entries.push(entry),p+=46+readU16(bytes,p+28)+readU16(bytes,p+30)+readU16(bytes,p+32)}return entries.some(e=>e.zip64)&&(zip64=!0),{entries:entries,notes:notes,truncated:truncated2,zip64:zip64,totalEntries:totalEntries}}async function readZipEntry(bytes,entry,options={}){const maxBytes=options.maxBytes??8388608;if(entry.encrypted)throw new ArchiveError("Encrypted ZIP entry.","ENCRYPTED",{path:entry.path});if(entry.dir)return{bytes:new Uint8Array(0),truncated:!1,crcOk:null,notes:[]};if(0!==entry.methodId&&8!==entry.methodId)throw new ArchiveError(`Unsupported ZIP method: ${entry.method}.`,"UNSUPPORTED_METHOD",{method:entry.method});const dataOffset=function(bytes,entry){const off=entry.localHeaderOffset;if(!Number.isSafeInteger(off)||off<0||off+30>bytes.length||67324752!==readU32(bytes,off))throw new ArchiveError("Invalid ZIP local header.","BAD_LOCAL_HEADER",{path:entry.path});const dataOffset=off+30+readU16(bytes,off+26)+readU16(bytes,off+28);if(dataOffset>bytes.length)throw new ArchiveError("ZIP entry data is out of bounds.","BAD_LOCAL_HEADER",{path:entry.path});return dataOffset}(bytes,entry),rawEnd=dataOffset+entry.compressedSize;if(!Number.isSafeInteger(rawEnd)||rawEnd>bytes.length)throw new ArchiveError("ZIP entry data exceeds the archive.","BAD_ENTRY_DATA",{path:entry.path});const raw=bytes.subarray(dataOffset,rawEnd);let result;const notes=[];if(0===entry.methodId){let data=raw;entry.size>=0&&raw.length>entry.size&&(data=raw.subarray(0,entry.size));const truncated2=data.length>maxBytes;truncated2&&(data=data.subarray(0,maxBytes)),result={bytes:data,truncated:truncated2||data.length<entry.size,crcOk:null}}else result=await inflateBytes(raw,"deflate-raw",{maxBytes:maxBytes}),result.truncated||result.bytes.length===entry.size||notes.push({code:"SIZE_MISMATCH"});return!1!==options.verifyCrc&&!result.truncated&&entry.size>0&&(result.crcOk=crc32(result.bytes)===entry.crc32,result.crcOk||notes.push({code:"CRC_MISMATCH"})),result.notes=notes,result}const TYPE_NAMES={0:"file","\0":"file","":"file",7:"file",1:"hardlink",2:"symlink",3:"char",4:"block",5:"dir",6:"fifo",S:"sparse"};function isZeroBlock(block){return block.every(byte=>0===byte)}function blockChecksum(block){let unsigned=0,signed=0;for(let i=0;i<512;i++){const c=i>=148&&i<156?32:block[i];unsigned+=c,signed+=c>127?c-256:c}return{unsigned:unsigned,signed:signed}}function parseNumericField(block,offset,length,{signed:signed=!1}={}){let value;if(128&block[offset])if(signed){let big=0n;for(let i=0;i<length;i++)big=256n*big+BigInt(block[i]);const signedValue=BigInt.asIntN(8*length,big);value=signedValue>=BigInt(Number.MIN_SAFE_INTEGER)&&signedValue<=BigInt(Number.MAX_SAFE_INTEGER)?Number(signedValue):null}else{value=127&block[offset];for(let i=1;i<length;i++)value=256*value+block[offset+i]}else{const source=latin1(block.subarray(offset,offset+length)).replace(/[\0 ]+$/g,"").trim();value=source?parseInt(source,8):0}if(null===value&&signed)return null;if(!Number.isSafeInteger(value)||!signed&&value<0)throw new ArchiveError("Invalid negative or unsafe TAR numeric field.","BAD_TAR_SIZE");return value}function decodeTarString(bytes){let end=bytes.indexOf(0);end<0&&(end=bytes.length);let slice=bytes.subarray(0,end),tail=slice.length;for(;tail>0&&32===slice[tail-1];)tail--;return decodeFileName(slice.subarray(0,tail))}function parsePaxPayload(data){const out=Object.create(null);let p=0;for(;p<data.length&&!(Object.keys(out).length>=16);){let space=-1;for(let i=p;i<Math.min(p+20,data.length);i++)if(32===data[i]){space=i;break}if(space<0)break;const length=Number(latin1(data.subarray(p,space)));if(!Number.isSafeInteger(length)||length<=0||p+length>data.length)break;const end=p+length,text2=decodeFileName(data.subarray(space+1,10===data[end-1]?end-1:end)).name,eq=text2.indexOf("=");if(eq>0){const key=text2.slice(0,eq);["path","linkpath","size","mtime"].includes(key)&&(out[key]=text2.slice(eq+1))}p=end}return out}function parseTar(input,options={}){const bytes=toBytes(input),maxEntries=options.maxEntries??5e3,maxHeaders=Math.floor(bytes.length/512)+1,entries=[],notes=[],paxState={local:Object.create(null)};let globalPax=Object.create(null),nextPath=null,nextLink=null,truncated2=!1,endOfArchive=!1,p=0,headers=0;for(;p+512<=bytes.length;){if(++headers>maxHeaders)throw new ArchiveError("TAR parser did not advance.","BAD_TAR");const block=bytes.subarray(p,p+512);if(isZeroBlock(block)){endOfArchive=!0;break}const storedChecksum=parseNumericField(block,148,8),sums=blockChecksum(block);if(storedChecksum!==sums.unsigned&&storedChecksum!==sums.signed){notes.push({code:"TAR_CHECKSUM",params:{offset:p}}),truncated2=!0;break}const typeFlag=String.fromCharCode(block[156]||48),declaredSize=parseNumericField(block,124,12),dataOffset=p+512,next=dataOffset+512*Math.ceil(declaredSize/512);if(!Number.isSafeInteger(next)||next<=p)throw new ArchiveError("Invalid TAR entry stride.","BAD_TAR_SIZE");if("x"===typeFlag||"g"===typeFlag||"L"===typeFlag||"K"===typeFlag){if(declaredSize>65536)throw new ArchiveError("TAR extended header exceeds the 64KB metadata limit.","BAD_TAR");if(dataOffset+declaredSize>bytes.length)throw new ArchiveError("Truncated TAR extended header.","BAD_TAR");const payload=bytes.subarray(dataOffset,Math.min(dataOffset+declaredSize,bytes.length));if("x"===typeFlag)paxState.local=parsePaxPayload(payload);else if("g"===typeFlag){const global=parsePaxPayload(payload);delete global.size,globalPax=Object.assign(globalPax,global)}else"L"===typeFlag?nextPath=decodeTarString(payload):nextLink=decodeTarString(payload);p=next;continue}if(entries.length>=maxEntries){truncated2=!0,notes.push({code:"ENTRY_LIMIT",params:{count:maxEntries}});break}const pax=Object.assign(Object.create(null),globalPax,paxState.local);paxState.local=Object.create(null);let effectiveSize=declaredSize;if(void 0!==pax.size&&(effectiveSize=Number(pax.size),!Number.isSafeInteger(effectiveSize)||effectiveSize<0))throw new ArchiveError("Invalid PAX entry size.","BAD_TAR_SIZE");const nextOffset=dataOffset+512*Math.ceil(effectiveSize/512);if(!Number.isSafeInteger(nextOffset)||nextOffset<=p)throw new ArchiveError("Invalid TAR entry stride.","BAD_TAR_SIZE");let name2=nextPath||decodeTarString(block.subarray(0,100));if(!nextPath){const prefix=decodeTarString(block.subarray(345,500));name2={name:prefix.name?`${prefix.name}/${name2.name}`:name2.name,encoding:name2.encoding}}nextPath=null,pax.path&&(name2={name:pax.path,encoding:"utf-8"});let linkname=nextLink||decodeTarString(block.subarray(157,257));nextLink=null,pax.linkpath&&(linkname={name:pax.linkpath,encoding:"utf-8"});let mtime=parseNumericField(block,136,12,{signed:!0});null!==mtime&&(mtime=1e3*mtime||null),void 0!==pax.mtime&&Number.isFinite(Number(pax.mtime))&&(mtime=Math.round(1e3*Number(pax.mtime)));const type=TYPE_NAMES[typeFlag]||"other",normalized=normalizeEntryPath(name2.name),dir="dir"===type||normalized.trailingSlash,entry={index:entries.length,path:normalized.path,unsafePath:normalized.unsafe,dir:dir,size:dir?0:effectiveSize,compressedSize:dir?0:effectiveSize,mtime:mtime,encrypted:!1,method:"none",type:type,linkname:linkname.name||null,nameEncoding:name2.encoding,dataOffset:dataOffset,container:"tar"};if("sparse"===type&&(entry.notes=[{code:"SPARSE_ENTRY"}]),entries.push(entry),dataOffset+effectiveSize>bytes.length){notes.push({code:"TAR_ENTRY_TRUNCATED",params:{path:entry.path}}),truncated2=!0;break}p=nextOffset}return!endOfArchive&&!truncated2&&p<bytes.length&&!isZeroBlock(bytes.subarray(p,Math.min(p+512,bytes.length)))&¬es.push({code:"TAR_TAIL_MISSING"}),{entries:entries,notes:notes,truncated:truncated2,endOfArchive:endOfArchive}}function readTarEntry(bytes,entry,options={}){const maxBytes=options.maxBytes??8388608;if(entry.dir)return{bytes:new Uint8Array(0),truncated:!1,notes:[]};const notes=[...entry.notes||[]];if("symlink"===entry.type||"hardlink"===entry.type?notes.push({code:"LINK_ENTRY",params:{target:entry.linkname||""}}):["char","block","fifo","other"].includes(entry.type)&¬es.push({code:"DEVICE_ENTRY"}),notes.some(note=>["LINK_ENTRY","DEVICE_ENTRY"].includes(note.code)))return{bytes:new Uint8Array(0),truncated:!1,notes:notes};const start=entry.dataOffset,available=Number.isSafeInteger(start)&&start>=0?bytes.length-start:-1,length=Math.max(0,Math.min(entry.size,available,maxBytes)),truncated2=length<entry.size;return truncated2&¬es.push({code:"ENTRY_TRUNCATED",params:{shown:length,size:entry.size}}),{bytes:bytes.subarray(start,start+length),truncated:truncated2,notes:notes}}function isGzip(input){const b=toBytes(input);return b.length>=2&&31===b[0]&&139===b[1]}function parseGzipHeader(input){const b=toBytes(input);if(!isGzip(b))return null;if(b.length<10)throw new ArchiveError("Incomplete gzip header.","BAD_GZIP");if(8!==b[2])throw new ArchiveError("Unsupported gzip compression method.","BAD_GZIP",{method:b[2]});const flags=b[3],mtimeSec=readU32(b,4);let p=10;if(4&flags){if(p+2>b.length)throw new ArchiveError("Incomplete gzip extra field.","BAD_GZIP");p+=2+(b[p]|b[p+1]<<8)}let originalName=null;if(8&flags){const end=p<b.length?b.indexOf(0,p):-1;if(end<0)throw new ArchiveError("Incomplete gzip filename.","BAD_GZIP");originalName=decodeFileName(b.subarray(p,end)).name,p=end+1}let comment=null;if(16&flags){const end=p<b.length?b.indexOf(0,p):-1;if(end<0)throw new ArchiveError("Incomplete gzip comment.","BAD_GZIP");comment=decodeFileName(b.subarray(p,end)).name,p=end+1}if(2&flags&&(p+=2),p>b.length)throw new ArchiveError("Gzip header exceeds input.","BAD_GZIP");return{mtime:mtimeSec>0?1e3*mtimeSec:null,originalName:originalName,comment:comment,flags:flags,os:b[9],headerSize:p}}const gzipCache=new WeakMap;async function gunzipCached(input,options={}){const bytes=toBytes(input),maxBytes=options.maxBytes??67108864;let slot=gzipCache.get(bytes);if(slot||(slot=new Map,gzipCache.set(bytes,slot)),slot.has(maxBytes))return slot.get(maxBytes);const task=async function(input,options={}){const bytes=toBytes(input);if(!isGzip(bytes))throw new ArchiveError("Invalid gzip signature.","BAD_GZIP");return parseGzipHeader(bytes),inflateBytes(bytes,"gzip",{maxBytes:options.maxBytes??67108864})}(bytes,{maxBytes:maxBytes}).catch(err=>{throw slot.delete(maxBytes),err});return slot.set(maxBytes,task),task}const DEFAULT_LIMITS=Object.freeze({maxEntries:5e3,maxEntryBytes:8388608,maxTotalBytes:33554432});function resolveLimits(options={}){const limits={...DEFAULT_LIMITS,...options.limits||{}};for(const key of["maxEntries","maxEntryBytes","maxTotalBytes"])null!=options[key]&&(limits[key]=options[key]);return limits}function finalize(format,entries,truncated2,notes,limits,det){const cleanNotes=[...notes],declaredTotal=entries.reduce((sum,entry)=>sum+(entry.dir?0:entry.size||0),0);declaredTotal>limits.maxTotalBytes&&cleanNotes.push({code:"TOTAL_SIZE_LIMIT",params:{size:declaredTotal,max:limits.maxTotalBytes}});const nonUtf8=entries.filter(entry=>entry.nameEncoding&&"utf-8"!==entry.nameEncoding).length;return nonUtf8&&cleanNotes.push({code:"NAME_ENCODING",params:{count:nonUtf8}}),{format:format,supported:!0,entries:entries,truncated:!!truncated2,notes:cleanNotes,totalEntries:entries.length,declaredTotalBytes:declaredTotal,detect:det}}async function listArchive(input,options={}){const bytes=toBytes(input),limits=resolveLimits(options),det=options.format?{format:options.format,supported:!0,source:"option",extension:""}:detect(bytes,options.filename||"");if(!det.supported)return{format:det.format,supported:!1,entries:[],truncated:!1,notes:[{code:"UNSUPPORTED_FORMAT",params:{format:det.format||""}}],detect:det};try{if("zip"===det.format){const parsed=parseZip(bytes,{maxEntries:limits.maxEntries});return finalize("zip",parsed.entries,parsed.truncated,parsed.notes,limits,det)}if("tar"===det.format){const parsed=parseTar(bytes,{maxEntries:limits.maxEntries});return finalize("tar",parsed.entries,parsed.truncated,parsed.notes,limits,det)}if("gzip"===det.format||"tar.gz"===det.format){if(!isGzip(bytes))throw new ArchiveError("Invalid gzip signature.","BAD_GZIP");const header2=parseGzipHeader(bytes),unpacked=await gunzipCached(bytes,{maxBytes:limits.maxTotalBytes}),notes=unpacked.truncated?[{code:"GZIP_TRUNCATED",params:{max:limits.maxTotalBytes}}]:[];if(function(input){const b=toBytes(input);return!!(b.length>=263&&["ustar\0","ustar "].includes(latin1(b.subarray(257,263))))||b.length>=1024&&isZeroBlock(b.subarray(0,512))&&isZeroBlock(b.subarray(512,1024))}(unpacked.bytes)){const parsed=parseTar(unpacked.bytes,{maxEntries:limits.maxEntries});return finalize("tar.gz",parsed.entries.map(entry=>({...entry,container:"gzip-tar"})),parsed.truncated||unpacked.truncated,[...notes,...parsed.notes],limits,det)}"tar.gz"===det.format&¬es.push({code:"GZIP_NOT_TAR"});const derivedName=normalizeEntryPath((null==header2?void 0:header2.originalName)||String(options.filename||"").replace(/^.*[\\/]/,"").replace(/\.(tar\.)?gz$/i,"")||"gzip-content");return finalize("gzip",[{index:0,path:derivedName.path||"gzip-content",unsafePath:derivedName.unsafe,dir:!1,size:unpacked.bytes.length,compressedSize:bytes.length,mtime:(null==header2?void 0:header2.mtime)||null,encrypted:!1,method:"gzip",type:"file",container:"gzip-raw"}],unpacked.truncated,notes,limits,det)}throw new ArchiveError("Unsupported archive format.","UNSUPPORTED_FORMAT",{format:det.format})}catch(err){if(err instanceof ArchiveError)throw err;throw new ArchiveError(`Archive parsing failed: ${(null==err?void 0:err.message)||err}`,"PARSE_FAILED")}}async function readEntry(input,entry,options={}){const bytes=toBytes(input),limits=resolveLimits(options);if(!entry||"object"!=typeof entry)throw new ArchiveError("Invalid archive entry.","BAD_ENTRY");const cap=Math.min(options.maxEntryBytes??limits.maxEntryBytes,limits.maxTotalBytes);let result;if(entry.dir)return{bytes:new Uint8Array(0),truncated:!1,textualHint:"empty",mime:null,notes:[]};if("zip"===entry.container)result=await readZipEntry(bytes,entry,{maxBytes:cap,verifyCrc:options.verifyCrc});else if("tar"===entry.container)result=readTarEntry(bytes,entry,{maxBytes:cap});else{if("gzip-tar"!==entry.container&&"gzip-raw"!==entry.container)throw new ArchiveError("Entry has an unknown container.","BAD_ENTRY");{const unpacked=await gunzipCached(bytes,{maxBytes:limits.maxTotalBytes});if("gzip-raw"===entry.container){const length=Math.min(entry.size,unpacked.bytes.length,cap);result={bytes:unpacked.bytes.subarray(0,length),truncated:length<entry.size,notes:[]}}else result=readTarEntry(unpacked.bytes,entry,{maxBytes:cap})}}entry.size>cap&&!result.truncated&&(result.truncated=!0),result.truncated&&!(result.notes||[]).some(note=>"ENTRY_TRUNCATED"===note.code)&&(result.notes||(result.notes=[])).push({code:"ENTRY_TRUNCATED",params:{shown:result.bytes.length,size:entry.size}});const classification=classifyContent(result.bytes);return{...result,textualHint:classification.kind,mime:classification.mime}}function resetBudget(input){!function(input){gzipCache.delete(toBytes(input))}(toBytes(input))}const styles_viewer="_viewer_1vp9q_1",styles_header="_header_1vp9q_10",styles_iconButton="_iconButton_1vp9q_20",styles_download="_download_1vp9q_35",styles_filePath="_filePath_1vp9q_36",styles_summary="_summary_1vp9q_38",styles_badge="_badge_1vp9q_39",styles_body="_body_1vp9q_40",styles_tree="_tree_1vp9q_41",styles_row="_row_1vp9q_42",styles_selected="_selected_1vp9q_43",styles_downloadButton="_downloadButton_1vp9q_44",styles_chevron="_chevron_1vp9q_45",styles_name="_name_1vp9q_46",styles_size="_size_1vp9q_47",styles_detail="_detail_1vp9q_48",styles_detailHeader="_detailHeader_1vp9q_49",styles_entryPath="_entryPath_1vp9q_50",styles_detailBody="_detailBody_1vp9q_51",styles_text="_text_1vp9q_52",styles_image="_image_1vp9q_53",styles_encoding="_encoding_1vp9q_54",styles_placeholder="_placeholder_1vp9q_55",styles_state="_state_1vp9q_55",styles_notices="_notices_1vp9q_59",styles_notice="_notice_1vp9q_59",styles_error="_error_1vp9q_61",styles_status="_status_1vp9q_62",styles_showMore="_showMore_1vp9q_63";function EntryDetail({detail:detail2,entry:entry}){return entry?jsxRuntimeExports.jsxs("section",{className:styles_detail,"aria-label":entry.path,children:[jsxRuntimeExports.jsxs("div",{className:styles_detailHeader,children:[jsxRuntimeExports.jsx("span",{className:styles_entryPath,title:entry.path,dir:"ltr",children:entry.path}),jsxRuntimeExports.jsx("span",{children:formatBytes(entry.size)}),entry.method&&jsxRuntimeExports.jsx("span",{children:entry.method}),entry.mtime&&jsxRuntimeExports.jsx("time",{children:new Date(entry.mtime).toLocaleString()})]}),jsxRuntimeExports.jsx("div",{className:styles_detailBody,children:entry.dir||!detail2?jsxRuntimeExports.jsx("div",{className:styles_placeholder,children:t("ui.archive.selectEntry")}):"loading"===detail2.status?jsxRuntimeExports.jsx("div",{className:styles_status,role:"status",children:t("ui.loading")}):"error"===detail2.status?jsxRuntimeExports.jsx("div",{className:styles_error,role:"alert",children:detail2.message}):"image"===detail2.status?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(EntryNotices,{notes:detail2.notes}),jsxRuntimeExports.jsx("img",{className:styles_image,src:detail2.url,alt:entry.path,onError:detail2.onError})]}):"text"===detail2.status?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:styles_encoding,children:t("ui.archive.encoding",{encoding:detail2.encoding})}),jsxRuntimeExports.jsx(EntryNotices,{notes:detail2.notes}),detail2.lineTruncated&&jsxRuntimeExports.jsx("div",{className:styles_notice,children:t("ui.archive.lineLimit",{count:8e3})}),jsxRuntimeExports.jsx("pre",{className:styles_text,dir:"auto",children:detail2.text})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(EntryNotices,{notes:detail2.notes}),jsxRuntimeExports.jsx("div",{className:styles_placeholder,children:t(`ui.archive.entry.${["empty","binary","link","device"].includes(detail2.status)?detail2.status:"binary"}`,{size:formatBytes(entry.size)})})]})})]}):jsxRuntimeExports.jsx("div",{className:styles_placeholder,children:t("ui.archive.selectEntry")})}function EntryNotices({notes:notes=[]}){return notes.map((note,index)=>jsxRuntimeExports.jsx("div",{className:styles_notice,children:archiveNoteText(note,t,formatBytes)},`${note.code}-${index}`))}function ArchivePreview({filePath:filePath2,displayPath:displayPath,onClose:onClose,project:project,instance:instance}){const kind=function(filePath2){if("archive"!==getPreviewKind(filePath2))return null;const name2=String(filePath2||"").split(/[\\/]/).pop().toLowerCase();if(name2.endsWith(".tar.gz")||name2.endsWith(".tgz"))return{supported:!0,format:"tar.gz"};if(name2.endsWith(".zip"))return{supported:!0,format:"zip"};if(name2.endsWith(".tar"))return{supported:!0,format:"tar"};if(name2.endsWith(".gz"))return{supported:!0,format:"gzip"};if(name2.endsWith(".txz"))return{supported:!1,format:"xz"};if(name2.endsWith(".tbz")||name2.endsWith(".tbz2"))return{supported:!1,format:"bz2"};for(const ext of["7z","rar","xz","bz2"])if(name2.endsWith(`.${ext}`))return{supported:!1,format:ext};return{supported:!1,format:"unknown"}}(filePath2),[state2,setState]=reactExports.useState({status:kind.supported?"loading":"unsupported"}),[selected2,setSelected]=reactExports.useState(null),[detail2,setDetail]=reactExports.useState(null),[expanded,setExpanded]=reactExports.useState(new Set),[rowLimit,setRowLimit]=reactExports.useState(2e3),[retry,setRetry]=reactExports.useState(0),bytesRef=reactExports.useRef(null),requestRef=reactExports.useRef(0),imageRef=reactExports.useRef(null),downloadUrl=apiUrl(withViewParams(`/api/download-file?path=${encodeURIComponent(filePath2)}`,{project:project,instance:instance}));reactExports.useEffect(()=>{const controller=new AbortController;let active=!0;return bytesRef.current=null,setSelected(null),setDetail(null),setRowLimit(2e3),kind.supported?"gzip"!==kind.format&&"tar.gz"!==kind.format||isDecompressionSupported("gzip")?(setState({status:"loading"}),fetch(apiUrl(withViewParams(`/api/archive-raw?path=${encodeURIComponent(filePath2)}`,{project:project,instance:instance})),{signal:controller.signal}).then(async response=>{if(!response.ok){const body2=await response.json().catch(error2=>(reportSwallowed("archivePreview.errorBody",error2),{})),reasonKey=`ui.fileLoadError.reason.${body2.reason}`,reasonMessage=body2.reason?t(reasonKey):"",message=body2.reason?reasonMessage===reasonKey?body2.error:reasonMessage:413===response.status?t("ui.archive.tooLarge",{max:formatBytes(body2.maxBytes||33554432)}):body2.error||`HTTP ${response.status}`;throw Object.assign(new Error(message),{displayed:!0,status:response.status})}const buffer=await response.arrayBuffer();if(!active)return null;if(buffer.byteLength>33554432)throw Object.assign(new Error(t("ui.archive.tooLarge",{max:formatBytes(33554432)})),{displayed:!0,status:413});const data=new Uint8Array(buffer);return bytesRef.current=data,listArchive(data,{filename:filePath2})}).then(result2=>{var _a;if(!active||!result2)return;if(!result2.supported)return void setState({status:"unsupported",format:result2.format||kind.format});const tree2=function(entries){const root={name:"",path:"",dir:!0,children:[],entry:null,truncated:!1},map=new Map([["",root]]);let nodes=0;for(const entry of entries||[]){if(nodes>=2e4){root.truncated=!0;continue}const parts=String(entry.path||"").split("/").filter(Boolean).slice(0,64);let parent=root,base="";for(let i=0;i<parts.length;i++){const path=base?`${base}/${parts[i]}`:parts[i],isLeaf=i===parts.length-1;let node=map.get(path);if(!node){if(++nodes>2e4){root.truncated=!0;break}node={name:parts[i],path:path,dir:!isLeaf||!!entry.dir,children:[],entry:null},map.set(path,node),parent.children.push(node)}isLeaf?(isLeaf&&(entry.dir||node.children.length>0)&&(node.dir=!0),isLeaf&&!node.entry&&(node.entry=entry),parent=node,base=path):(node.dir=!0,parent=node,base=path)}}const stack=[root];for(;stack.length;){const node=stack.pop();node.children.sort(compareTreeNodes),stack.push(...node.children)}return root}(result2.entries);setExpanded(function(tree2){const expanded=new Set,stack=[...tree2.children];for(;stack.length;){const node=stack.pop();if(node.dir&&(node.path.split("/").length<=2||1===node.children.length)){if(expanded.size>=100)break;expanded.add(node.path),stack.push(...node.children)}}return expanded}(tree2)),setState({status:"ready",result:result2,tree:tree2,fileSize:(null==(_a=bytesRef.current)?void 0:_a.byteLength)||0})}).catch(error2=>{active&&"AbortError"!==error2.name&&(bytesRef.current&&resetBudget(bytesRef.current),bytesRef.current=null,setState({status:"error",message:error2.displayed?error2.message:archiveErrorText(error2,t),permanent:error2.status>=400&&error2.status<500}))}),()=>{active=!1,controller.abort(),requestRef.current++,imageRef.current&&URL.revokeObjectURL(imageRef.current),imageRef.current=null,bytesRef.current&&resetBudget(bytesRef.current),bytesRef.current=null}):(setState({status:"error",message:t("ui.archive.error.NO_DECOMPRESSION"),permanent:!0}),()=>controller.abort()):(setState({status:"unsupported",format:kind.format}),()=>controller.abort())},[filePath2,project,instance,retry]),reactExports.useEffect(()=>{if(!selected2||!bytesRef.current||selected2.dir)return void setDetail(null);const data=bytesRef.current,seq=++requestRef.current;let active=!0;if(setDetail({status:"loading"}),selected2.encrypted)return void setDetail({status:"error",message:t("ui.archive.error.ENCRYPTED")});const task=/\.(png|jpe?g|gif|bmp|webp)$/i.test(selected2.path)?readEntry(data,selected2,{maxEntryBytes:8388608}):async function(input,entry,options={}){const textLimit=options.textMaxBytes??204800,result=await readEntry(input,entry,{...options,maxEntryBytes:textLimit});return"text"!==result.textualHint?{...result,text:"",encoding:null,looksBinary:!0}:{...result,...decodeTextBytes(result.bytes,{maxBytes:textLimit,truncated:result.truncated}),looksBinary:!1}}(data,selected2,{textMaxBytes:204800});return task.then(result2=>{if(!active||seq!==requestRef.current)return;const status2=function(result){var _a,_b;return"image"!==result.textualHint||result.truncated||!1===result.crcOk?(null==(_a=result.notes)?void 0:_a.some(note=>"LINK_ENTRY"===note.code))?"link":(null==(_b=result.notes)?void 0:_b.some(note=>"DEVICE_ENTRY"===note.code))?"device":["text","empty","binary"].includes(result.textualHint)?result.textualHint:"binary":"image"}(result2);if("image"===status2){const url=URL.createObjectURL(new Blob([result2.bytes],{type:result2.mime}));imageRef.current&&URL.revokeObjectURL(imageRef.current),imageRef.current=url,setDetail({status:status2,url:url,notes:result2.notes,onError:()=>setDetail({status:"binary",notes:result2.notes})})}else if("text"===status2){const lines=result2.text.split("\n"),lineTruncated=lines.length>8e3;setDetail({status:status2,text:lines.slice(0,8e3).join("\n"),encoding:result2.encoding,lineTruncated:lineTruncated,notes:result2.notes})}else setDetail({status:status2,notes:result2.notes})}).catch(error2=>{active&&seq===requestRef.current&&setDetail({status:"error",message:archiveErrorText(error2,t)})}),()=>{active=!1,imageRef.current&&(URL.revokeObjectURL(imageRef.current),imageRef.current=null)}},[selected2]),reactExports.useEffect(()=>()=>{imageRef.current&&URL.revokeObjectURL(imageRef.current)},[]);const activate=reactExports.useCallback(node=>{node.dir?setExpanded(previous=>{const next=new Set(previous);return next.has(node.path)?next.delete(node.path):next.add(node.path),next}):setSelected(node.entry||null)},[]),visible=reactExports.useMemo(()=>state2.tree?function(root,expanded,maxRows=2e3){const rows=[],stack=root.children.slice().reverse().map(node=>({node:node,depth:0}));for(;stack.length&&rows.length<maxRows;){const{node:node,depth:depth}=stack.pop();if(rows.push({node:node,depth:depth}),node.dir&&expanded.has(node.path))for(let i=node.children.length-1;i>=0;i--)stack.push({node:node.children[i],depth:depth+1})}return{rows:rows,truncated:stack.length>0}}(state2.tree,expanded,rowLimit):{rows:[]},[state2.tree,expanded,rowLimit]),result=state2.result;return jsxRuntimeExports.jsxs("div",{className:styles_viewer,children:[jsxRuntimeExports.jsxs("header",{className:styles_header,children:[jsxRuntimeExports.jsx("button",{type:"button",className:styles_iconButton,onClick:onClose,title:t("ui.backToChat"),"aria-label":t("ui.backToChat"),children:"←"}),jsxRuntimeExports.jsx("span",{className:styles_filePath,title:displayPath||filePath2,dir:"ltr",children:displayPath||filePath2}),jsxRuntimeExports.jsx("a",{className:styles_download,href:downloadUrl,title:t("ui.archive.download"),"aria-label":t("ui.archive.download"),children:jsxRuntimeExports.jsx(RefIcon$1,{})}),jsxRuntimeExports.jsx("button",{type:"button",className:styles_iconButton,onClick:onClose,title:t("ui.backToChat"),"aria-label":t("ui.backToChat"),children:"×"})]}),"unsupported"===state2.status?jsxRuntimeExports.jsxs("div",{className:styles_state,role:"status",children:[jsxRuntimeExports.jsx("h2",{children:t("ui.archive.unsupportedTitle")}),jsxRuntimeExports.jsx("p",{children:t(`ui.archive.unsupported.${["7z","rar","xz","bz2"].includes(state2.format||kind.format)?state2.format||kind.format:"unknown"}`)}),jsxRuntimeExports.jsxs("a",{className:styles_downloadButton,href:downloadUrl,children:[jsxRuntimeExports.jsx(RefIcon$1,{}),t("ui.archive.download")]})]}):"error"===state2.status?jsxRuntimeExports.jsxs("div",{className:styles_state,role:"alert",children:[jsxRuntimeExports.jsx("p",{className:styles_error,children:state2.message}),!state2.permanent&&jsxRuntimeExports.jsx("button",{type:"button",className:styles_downloadButton,onClick:()=>setRetry(value=>value+1),children:t("ui.archive.retry")}),jsxRuntimeExports.jsxs("a",{className:styles_downloadButton,href:downloadUrl,children:[jsxRuntimeExports.jsx(RefIcon$1,{}),t("ui.archive.download")]})]}):"loading"===state2.status?jsxRuntimeExports.jsx("div",{className:styles_state,role:"status",children:t("ui.loading")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles_summary,children:[jsxRuntimeExports.jsx("span",{className:styles_badge,children:result.format}),jsxRuntimeExports.jsx("span",{children:t("ui.archive.entries",{count:result.entries.length})}),jsxRuntimeExports.jsx("span",{children:formatBytes(result.declaredTotalBytes)}),jsxRuntimeExports.jsx("span",{children:formatBytes(state2.fileSize)})]}),shouldShowArchiveNotices(result,visible,state2.tree.truncated)&&jsxRuntimeExports.jsxs("div",{className:styles_notices,children:[jsxRuntimeExports.jsx(EntryNotices,{notes:result.notes}),visible.truncated&&jsxRuntimeExports.jsx("div",{className:styles_notice,children:t("ui.archive.rowLimit",{count:visible.rows.length})}),state2.tree.truncated&&jsxRuntimeExports.jsx("div",{className:styles_notice,children:t("ui.archive.treeLimit",{count:result.entries.length})})]}),jsxRuntimeExports.jsxs("div",{className:styles_body,children:[jsxRuntimeExports.jsxs("div",{className:styles_tree,role:"group","aria-label":t("ui.archive.entries",{count:result.entries.length}),children:[visible.truncated&&jsxRuntimeExports.jsx("button",{type:"button",className:styles_showMore,onClick:()=>setRowLimit(limit=>limit+2e3),children:t("ui.archive.showMore",{count:2e3})}),0===visible.rows.length?jsxRuntimeExports.jsx("div",{className:styles_placeholder,children:t("ui.archive.empty")}):visible.rows.map(({node:node,depth:depth})=>{var _a,_b;return jsxRuntimeExports.jsxs("div",{className:`${styles_row} ${isArchiveEntrySelected(node.entry,selected2)?styles_selected:""}`,role:"button",tabIndex:0,"aria-expanded":node.dir?expanded.has(node.path):void 0,"aria-pressed":isArchiveEntrySelected(node.entry,selected2),"aria-label":node.path,style:{paddingInlineStart:16*depth+8+"px"},onClick:()=>activate(node),onKeyDown:event=>{"Enter"!==event.key&&" "!==event.key||(event.preventDefault(),activate(node))},children:[jsxRuntimeExports.jsx("span",{className:styles_chevron,children:node.dir?expanded.has(node.path)?"▾":"▸":""}),node.dir?expanded.has(node.path)?jsxRuntimeExports.jsx(RefIcon$2,{}):jsxRuntimeExports.jsx(RefIcon$3,{}):jsxRuntimeExports.jsx(RefIcon$4,{}),jsxRuntimeExports.jsx("span",{className:styles_name,title:node.name,dir:"ltr",children:node.name}),(null==(_a=node.entry)?void 0:_a.encrypted)&&jsxRuntimeExports.jsx(RefIcon,{title:t("ui.archive.error.ENCRYPTED")}),!node.dir&&jsxRuntimeExports.jsx("span",{className:styles_size,children:formatBytes((null==(_b=node.entry)?void 0:_b.size)||0)})]},node.path)}),visible.truncated&&jsxRuntimeExports.jsx("button",{type:"button",className:styles_showMore,onClick:()=>setRowLimit(limit=>limit+2e3),children:t("ui.archive.showMore",{count:2e3})})]}),jsxRuntimeExports.jsx(EntryDetail,{detail:detail2,entry:selected2},`${(null==selected2?void 0:selected2.container)||"none"}:${(null==selected2?void 0:selected2.index)??"none"}:${(null==selected2?void 0:selected2.path)||""}`)]})]})]})}export{ArchivePreview as default};
|
|
@@ -1 +0,0 @@
|
|
|
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-CKsm_iG4.js";import{a as reactExports,I as Icon,b as _extends,R as React,s as staticMethods,M as Modal,C as ConfigProvider,B as Badge,i as Button,j as RefIcon$3,k as RefIcon$4,S as Select,T as Tooltip,l as RefIcon$5,m as Switch,n as RefIcon$6}from"./vendor-antd-DWLgSkPo.js";import{f as fetchAllRepos,b as buildGitTree,i as isImageFile,I as ImageLightbox,F as FullFileDiffView,g as getFileIcon,u as useSessionStoragePersistedSet,a as ImageViewer,c as FileContentView,l as loadExpandedPaths,s as saveExpandedPaths,d as computeTokenStats,e as computeToolUsageStats,h as computeSkillUsageStats,j as computeCacheRebuildStats,k as classifyRequest,m as sharedChrome,C as ConceptHelp,T as ToolsHelp,n as formatTokenCount,A as AppBase,r as readCalibrationModel,o as fetchPluginPanels,p as loadFsSkills,q as sortSkillsDefault,t as handleSkillToggle,v as handleSkillDelete,w as loadProjectMemory,x as loadClaudeMdList,y as extractDisplayText,z as parseImOrigin,B as classifyUserContent,D as isMainAgent,E as styles$3,G as getEffectiveModel,H as sumUsageContextTokens,J as sumUsageInputTokens,K as computeContextPercent,O as OPTIMISTIC_CLEAR_PERCENT,L as TerminalWsProvider,S as SdkContextUsageProvider,M as ApprovalModal,R as RefIcon$1,N as RefIcon$2,P as PanelIcon,Q as panelTitle,U as ChatView,V as TerminalPanel,W as CachePopoverContent,X as MemoryDetailModal,Y as ResumeSessionsList,Z as FileBrowserModal,_ as SkillsManagerModal,$ as ProjectPrefsManagerModal,a0 as PluginModal,a1 as PluginPanelModal,a2 as ProcessModal,a3 as ProxyModal,a4 as OpenFolderIcon,a5 as Loading,a6 as autoApproveSelectOptions,a7 as askAutoAnswerSelectOptions,a8 as askAutoAnswerPrefValue,a9 as askAutoAnswerUiValue,aa as VoicePackSettings,ab as ToolApprovalPanel,ac as useSdkContextUsage,ad as mergeSdkContextBar,ae as contextSeverityColor,af as appConfig,ag as invalidatePluginPanels,ah as PERM_AUTO_APPROVE_OPTIONS,ai as PLAN_AUTO_APPROVE_OPTIONS}from"./seqResourceLoaders-DeqzMajS.js";import{a as apiUrl,w as withViewParams,t,s as setViewScope,i as isIOS,b as isPad,c as setViewMode,g as getLang,L as LANG_OPTIONS,d as setLang}from"./index-Ca3a2tOc.js";import"./vendor-xterm-DckPrCx1.js";import"./vendor-mdxeditor-Dah6NK0y.js";import"./vendor-markdown-DOJHsAxX.js";import"./vendor-virtuoso-DKUobZpA.js";import"./vendor-highlight-IFTJ9nxW.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_wipb0_1",styles$2_fileListSection="_fileListSection_wipb0_10",styles$2_header="_header_wipb0_19",styles$2_headerLeft="_headerLeft_wipb0_28",styles$2_headerTitle="_headerTitle_wipb0_34",styles$2_fileCount="_fileCount_wipb0_42",styles$2_closeBtn="_closeBtn_wipb0_50",styles$2_changesContainer="_changesContainer_wipb0_66",styles$2_changeItem="_changeItem_wipb0_73",styles$2_changeItemActive="_changeItemActive_wipb0_90",styles$2_dirItem="_dirItem_wipb0_99",styles$2_dirArrow="_dirArrow_wipb0_110",styles$2_dirName="_dirName_wipb0_119",styles$2_status="_status_wipb0_124",styles$2_icon="_icon_wipb0_133",styles$2_fileName="_fileName_wipb0_142",styles$2_diffSection="_diffSection_wipb0_149",styles$2_diffHeader="_diffHeader_wipb0_157",styles$2_diffFilePath="_diffFilePath_wipb0_167",styles$2_diffBadge="_diffBadge_wipb0_177",styles$2_diffContent="_diffContent_wipb0_189",styles$2_diffPlaceholder="_diffPlaceholder_wipb0_195",styles$2_statusText="_statusText_wipb0_206",styles$2_errorText="_errorText_wipb0_213",styles$2_emptyText="_emptyText_wipb0_220",styles$2_warningText="_warningText_wipb0_227",styles$2_fileSizeNote="_fileSizeNote_wipb0_239",styles$2_statusTextItalic="_statusTextItalic_wipb0_244",styles$2_imagePreviewWrap="_imagePreviewWrap_wipb0_248",styles$2_imagePreview="_imagePreview_wipb0_248",styles$2_rotated90="_rotated90_wipb0_264",styles$2_repoHeader="_repoHeader_wipb0_269",styles$2_repoArrow="_repoArrow_wipb0_288",styles$2_repoArrowExpanded="_repoArrowExpanded_wipb0_299",styles$2_repoName="_repoName_wipb0_303",styles$2_repoBadge="_repoBadge_wipb0_310",STATUS_COLORS={M:"#e2c08d",A:"#73c991",D:"#f14c4c",R:"#73c991",C:"#73c991",U:"#e2c08d","?":"#73c991","??":"#73c991"},STATUS_LABELS={"??":"U"};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:getFileIcon("","directory")}),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(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,project:project,instance:instance}){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(project,instance).then(results=>{mounted.current&&(setRepos(results),setLoading(!1))}).catch(()=>{mounted.current&&(setError("Failed to load git status"),setLoading(!1))}),()=>{mounted.current=!1}},[visible,project,instance]),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(withViewParams(`/api/git-diff?files=${encodeURIComponent(selectedFile)}${repoParam}`,{project:project}))).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,project]);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:t("ui.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:t("ui.gitChanges.noChanges")}),!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.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(withViewParams(`/api/file-raw?path=${encodeURIComponent(diffDisplayPath)}`,{project:project})),alt:selectedFile,onClick:()=>setLightboxOpen(!0)}),lightboxOpen&&jsxRuntimeExports.jsx(ImageLightbox,{src:apiUrl(withViewParams(`/api/file-raw?path=${encodeURIComponent(diffDisplayPath)}`,{project:project})),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";function MobileTreeNode({item:item,path:path,depth:depth,expandedPaths:expandedPaths,onToggleExpand:onToggleExpand,currentFile:currentFile,onFileClick:onFileClick,project:project,instance:instance}){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(withViewParams(`/api/files?path=${encodeURIComponent(childPath)}`,{project:project,instance:instance}))).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?getFileIcon(item.name,"directory"):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,project:project,instance:instance},child.name))]})}function MobileFileExplorer({visible:visible,onClose:onClose,targetFile:targetFile,projectName:projectName,project:project,instance:instance}){const[items,setItems]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!0),[error,setError]=reactExports.useState(null),[expandedPaths,setExpandedPaths]=useSessionStoragePersistedSet({projectName:project||projectName,load:loadExpandedPaths,save:saveExpandedPaths}),[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(withViewParams("/api/files?path=",{project:project,instance:instance}))).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),void(lastTargetRef.current=null))),[visible,project,instance]),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,project:project,instance:instance},item.name))]})]}),jsxRuntimeExports.jsx("div",{className:styles$1_contentSection,children:currentFile?isImageFile(currentFile)?jsxRuntimeExports.jsx(ImageViewer,{filePath:currentFile,onClose:handleFileClose,project:project,instance:instance}):jsxRuntimeExports.jsx(FileContentView,{filePath:currentFile,onClose:handleFileClose,project:project,instance:instance}):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:sharedChrome.modelCard,children:[jsxRuntimeExports.jsx("div",{className:sharedChrome.modelName,children:t("ui.skillUsageStats")}),jsxRuntimeExports.jsxs("table",{className:sharedChrome.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${sharedChrome.th} ${styles_thLeft}`,children:t("ui.stats.skill")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[skillStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:name}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:count})]},name)),skillStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.total")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:skillStats.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasSubAgentStats&&jsxRuntimeExports.jsxs("div",{className:sharedChrome.modelCard,children:[jsxRuntimeExports.jsx("div",{className:sharedChrome.modelName,children:t("ui.subAgentStats")}),jsxRuntimeExports.jsxs("table",{className:sharedChrome.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${sharedChrome.th} ${styles_thLeft}`,children:t("ui.stats.subAgent")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[subAgentEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:sharedChrome.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`SubAgent-${name}`})]}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:count})]},name)),subAgentEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.total")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:subAgentEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasTeammateStats&&jsxRuntimeExports.jsxs("div",{className:sharedChrome.modelCard,children:[jsxRuntimeExports.jsx("div",{className:sharedChrome.modelName,children:t("ui.teammateStats.title")}),jsxRuntimeExports.jsxs("table",{className:sharedChrome.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${sharedChrome.th} ${styles_thLeft}`,children:t("ui.teammateStats.name")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[teammateEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:name}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:count})]},name)),teammateEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.total")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:teammateEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),toolStats.length>0&&jsxRuntimeExports.jsxs("div",{className:sharedChrome.modelCard,children:[jsxRuntimeExports.jsxs("div",{className:sharedChrome.modelName,children:[t("ui.toolUsageStats")," ",jsxRuntimeExports.jsx(ToolsHelp,{})]}),jsxRuntimeExports.jsxs("table",{className:sharedChrome.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${sharedChrome.th} ${styles_thLeft}`,children:t("ui.stats.tool")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[toolStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:sharedChrome.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`Tool-${name}`})]}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:count})]},name)),toolStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.total")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:toolStats.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasCacheStats&&jsxRuntimeExports.jsxs("div",{className:sharedChrome.modelCard,children:[jsxRuntimeExports.jsxs("div",{className:sharedChrome.modelName,children:[t("ui.stats.mainAgent"),jsxRuntimeExports.jsx(ConceptHelp,{doc:"MainAgent"})," ",t("ui.cacheRebuildStats"),jsxRuntimeExports.jsx(ConceptHelp,{doc:"CacheRebuild"})]}),jsxRuntimeExports.jsxs("table",{className:`${sharedChrome.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:`${sharedChrome.th} ${styles_thLeft}`,children:t("ui.cacheRebuild.reason")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.cacheRebuild.count")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.cacheRebuild.cacheCreate")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[activeReasons.map(k=>jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:`${sharedChrome.label} ${styles_ellipsisCell}`,title:t(`ui.${I18N_MAP[k]}`),children:t(`ui.${I18N_MAP[k]}`)}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:cacheStats[k].count}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:formatTokenCount(cacheStats[k].cacheCreate)})]},k)),activeReasons.length>1&&jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.total")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:totalCount}),jsxRuntimeExports.jsx("td",{className:sharedChrome.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:sharedChrome.modelCard,children:[jsxRuntimeExports.jsx("div",{className:sharedChrome.modelName,children:model}),jsxRuntimeExports.jsx("table",{className:sharedChrome.statsTable,children:jsxRuntimeExports.jsxs("tbody",{children:[jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.token")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.stats.input")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.stats.output")})]}),jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:formatTokenCount(totalInput)}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:formatTokenCount(s.output)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.stats.cache")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.stats.create")}),jsxRuntimeExports.jsx("td",{className:sharedChrome.th,children:t("ui.stats.read")})]}),jsxRuntimeExports.jsxs("tr",{className:sharedChrome.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:formatTokenCount(s.cacheCreation)}),jsxRuntimeExports.jsx("td",{className:sharedChrome.td,children:formatTokenCount(s.cacheRead)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:sharedChrome.label,children:t("ui.hitRate")}),jsxRuntimeExports.jsxs("td",{colSpan:2,className:sharedChrome.td,children:[cacheHitRate,"%"]})]})]})})]},model)})]})})]}):null}const CALIBRATION_MODELS=appConfig.calibrationModels;function MobileCtxLabelText({projectName:projectName}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[t("ui.liveMonitoring"),projectName?`: ${projectName}`:""]})}function MobileContextTag({projectName:projectName,fallbackPercent:fallbackPercent,onToggle:onToggle}){const sdk=useSdkContextUsage(),merged=mergeSdkContextBar({sdk:sdk,fallbackPercent:fallbackPercent}),ctxColor=contextSeverityColor(merged.percent),label=`${t("ui.openCachePanel")}: ${merged.percent}%`;return jsxRuntimeExports.jsxs("span",{className:styles$3.mobileCtxTag,style:{borderColor:ctxColor,color:ctxColor,cursor:"pointer"},title:`${t("ui.liveMonitoring")}${projectName?`: ${projectName}`:""}`,role:"button",tabIndex:0,"aria-label":label,"aria-haspopup":"dialog",onClick:onToggle,onKeyDown:event=>{"Enter"!==event.key&&" "!==event.key||(event.preventDefault(),onToggle())},children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileCtxTagFill,style:{width:`${merged.percent}%`,backgroundColor:ctxColor}}),jsxRuntimeExports.jsx("span",{className:styles$3.mobileCtxTagContent,children:jsxRuntimeExports.jsx(MobileCtxLabelText,{projectName:projectName})})]})}const _Mobile=class _Mobile extends AppBase{constructor(props){super(props),__publicField(this,"_refreshPluginPanels",async(force=!1)=>{const{panels:panels}=await fetchPluginPanels({force:force});panels&&this.setState({pluginPanels:panels})}),__publicField(this,"_handlePluginModalClose",()=>{this.setState({pluginModalVisible:!1}),invalidatePluginPanels(),this._refreshPluginPanels(!0)}),__publicField(this,"_handlePluginPanelClose",()=>this.setState({activePluginPanel:null})),__publicField(this,"handleCalibrationModelChange",value=>{this.setState({calibrationModel:value}),localStorage.setItem("ccv_calibrationModel",value)}),__publicField(this,"reloadFsSkills",async()=>loadFsSkills(this,{isLocalLog:this._isLocalLog,project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance})),__publicField(this,"handleOpenSkillsModal",async()=>{const cached=this.state._fsSkills,needFetch=!Array.isArray(cached);if(this.setState(prev=>{var _a;return{_skillsModal:{open:!0,loading:needFetch,skills:Array.isArray(cached)?sortSkillsDefault(cached):[],error:null,toggling:(null==(_a=prev._skillsModal)?void 0:_a.toggling)||new Set},mobileCachePanelVisible:!1}},()=>this._onCachePanelOpenChange(!1)),needFetch){const result=await this.reloadFsSkills();this.setState(prev=>({_skillsModal:{...prev._skillsModal,loading:!1,skills:result.ok?sortSkillsDefault(result.skills):[],error:result.ok?null:result.reason}}))}}),__publicField(this,"handleToggleSkill",skill=>handleSkillToggle(this,skill)),__publicField(this,"handleDeleteSkill",skill=>handleSkillDelete(this,skill)),__publicField(this,"loadMemory",async()=>loadProjectMemory(this,{project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance})),__publicField(this,"handleRefreshMemory",async()=>{if(this.state._memoryRefreshing)return;this.setState({_memoryRefreshing:!0});const seq=++this._memorySeq;let ok=!1,stale=!1;try{const r=await fetch(apiUrl(withViewParams("/api/project-memory",{project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance}))),data=await r.json();seq!==this._memorySeq?stale=!0:r.ok?(this.setState({_memory:data}),ok=!0):this.setState({_memory:!1})}catch{seq!==this._memorySeq?stale=!0:this.setState({_memory:!1})}finally{stale||this.setState({_memoryRefreshing:!1})}stale||(ok?staticMethods.success(t("ui.memoryRefreshSuccess")):staticMethods.error(t("ui.memoryRefreshFailed"),5))}),__publicField(this,"loadMemoryDetail",async(name,memoryDir)=>{const seq=++this._memoryDetailSeq;this.setState({_memoryDetail:{name:name,memoryDir:memoryDir,loading:!0}});try{const r=await fetch(apiUrl(withViewParams(`/api/project-memory?file=${encodeURIComponent(name)}`,{project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance}))),data=await r.json();if(seq!==this._memoryDetailSeq)return;if(!r.ok)return void this.setState({_memoryDetail:{name:name,memoryDir:memoryDir,error:data.error||`http:${r.status}`}});this.setState({_memoryDetail:{name:name,memoryDir:memoryDir,content:data.content||"",tokens:data.tokens}})}catch(e){seq===this._memoryDetailSeq&&this.setState({_memoryDetail:{name:name,memoryDir:memoryDir,error:e.message||"network"}})}}),__publicField(this,"_onCachePanelOpenChange",open=>{open&&null===this.state._fsSkills&&!this._isLocalLog&&this.reloadFsSkills(),open&&null===this.state._memory&&this.loadMemory(),open&&null===this.state._claudeMd&&this.loadClaudeMdList()}),__publicField(this,"loadClaudeMdList",async()=>loadClaudeMdList(this,{project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance})),__publicField(this,"loadClaudeMdDetail",async(id,tail,scope)=>{const seq=++this._claudeMdDetailSeq,base={name:`${t("global"===scope?"ui.claudeMdScopeGlobal":"ui.claudeMdScopeProject")} · ${tail}`,id:id};this.setState({_claudeMdDetail:{...base,loading:!0}});try{const r=await fetch(apiUrl(withViewParams(`/api/claude-md?id=${encodeURIComponent(id)}`,{project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance}))),data=await r.json();if(seq!==this._claudeMdDetailSeq)return;if(!r.ok)return void this.setState({_claudeMdDetail:{...base,error:data.error||`http:${r.status}`}});this.setState({_claudeMdDetail:{...base,content:data.content||""}})}catch(e){seq===this._claudeMdDetailSeq&&this.setState({_claudeMdDetail:{...base,error:e.message||"network"}})}}),__publicField(this,"openClaudeMdFolder",()=>{const detail=this.state._claudeMdDetail;(null==detail?void 0:detail.id)&&this.setState({_targetBrowser:{target:{kind:"claude-md",id:detail.id},label:detail.name}})}),__publicField(this,"openSkillFolder",skill=>{(null==skill?void 0:skill.path)&&this.setState({_targetBrowser:{target:{kind:"skill",source:skill.source,path:skill.path},label:skill.name}})}),__publicField(this,"closeTargetBrowser",()=>this.setState({_targetBrowser:null})),__publicField(this,"_handleMobileOpenFile",(filePath,ancestors)=>{this.state.localLogFile||this.setState({...this._closeAllMobileOverlays(),mobileFileExplorerVisible:!0,mobileFileExplorerTarget:{file:filePath,ancestors:ancestors||[]}})}),__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,"handleAutoApproveChange",seconds=>{this.setState({autoApproveSeconds:seconds}),this.context.updatePreferences({autoApproveSeconds:seconds})}),__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,projectPrefsModalOpen:!1,mobilePromptVisible:!1,mobileTerminalVisible:!1,mobileFileExplorerVisible:!1,mobileCachePanelVisible:!1,mobileResumeVisible:!1,globalPermission:null,autoApproveSeconds:3,hasGit:!0,terminalPendingImages:[],_fsSkills:null,_memory:null,_memoryRefreshing:!1,_memoryDetail:null,_claudeMd:null,_claudeMdDetail:null,_targetBrowser:null,pluginModalVisible:!1,processModalVisible:!1,proxyModalVisible:!1,pluginPanels:[],activePluginPanel:null,pluginPanelAttempt:0,_skillsModal:{open:!1,loading:!1,skills:[],error:null,toggling:new Set},calibrationModel:readCalibrationModel(CALIBRATION_MODELS)}),this._lastContextPercent=0,this._fsSkillsSeq=0,this._memorySeq=0,this._memoryDetailSeq=0,this._claudeMdSeq=0,this._claudeMdDetailSeq=0}_closeAllMobileOverlays(){return{mobileMenuVisible:!1,mobileStatsVisible:!1,mobileGitDiffVisible:!1,mobileChatVisible:!1,mobileLogMgmtVisible:!1,mobileSettingsVisible:!1,mobilePromptVisible:!1,mobileTerminalVisible:!1,mobileFileExplorerVisible:!1,mobileCachePanelVisible:!1,mobileResumeVisible:!1,pluginModalVisible:!1,processModalVisible:!1,proxyModalVisible:!1,activePluginPanel:null}}componentDidMount(){var _a,_b,_c,_d;if(super.componentDidMount(),this._refreshPluginPanels(),setViewScope({projectName:this.state.projectName,viewedProject:this.state.viewedProject,viewedInstance:this.state.viewedInstance,boundInstance:null}),fetch(apiUrl("/api/git-repos")).then(r=>r.ok?r.json():Promise.reject()).then(data=>{var _a2;(null==(_a2=data.repos)?void 0:_a2.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){const inElectronTab="undefined"!=typeof window&&!!window.tabBridge;this._modeSwitchDialog=null,inElectronTab?(this._onDeviceMode=on=>{const target=on?"pad":"pc";localStorage.getItem("ccv_viewMode")!==target&&setViewMode(target)},this._disposeDeviceMode=null==(_b=(_a=window.tabBridge).onDeviceModeChange)?void 0:_b.call(_a,this._onDeviceMode),null==(_d=(_c=window.tabBridge).requestDeviceMode)||_d.call(_c)):(this._mqlWide=window.matchMedia("(min-width: 1400px)"),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._disposeDeviceMode&&(this._disposeDeviceMode(),this._disposeDeviceMode=null),this._mqlWide&&this._mqlWide.removeEventListener("change",this._onWideChange),this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null),this._fsSkillsSeq++,this._memorySeq++,this._memoryDetailSeq++,this._claudeMdSeq++,this._claudeMdDetailSeq++,super.componentWillUnmount()}componentDidUpdate(prevProps,prevState){super.componentDidUpdate&&super.componentDidUpdate(prevProps,prevState),setViewScope({projectName:this.state.projectName,viewedProject:this.state.viewedProject,viewedInstance:this.state.viewedInstance,boundInstance:null}),prevState.projectName===this.state.projectName&&prevState.viewedProject===this.state.viewedProject&&prevState.viewedInstance===this.state.viewedInstance||(this._fsSkillsSeq++,this._memorySeq++,this._claudeMdSeq++,this._claudeMdDetailSeq++,this.setState({_fsSkills:null,_memory:null,_memoryDetail:null,_memoryRefreshing:!1,_claudeMd:null,_claudeMdDetail:null,_targetBrowser:null}))}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=extractDisplayText(parseImOrigin(msg.content).text);if(!text)continue;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$3.mobilePromptCard,children:textSegments.map((seg,j)=>jsxRuntimeExports.jsx("pre",{className:styles$3.mobilePromptPreText,children:seg.content},j))})}_captureDropContext(){return{toTerminal:this.state.mobileTerminalVisible}}_dispatchUploadedFiles(results,ctx){const uploaded=results.filter(Boolean);uploaded.length&&((null==ctx?void 0:ctx.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}"`)]})))}render(){var _a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k;const{filteredRequests:filteredRequests,deepRequests:deepRequests,fileLoading:fileLoading,fileLoadingCount:fileLoadingCount,mainAgentSessions:mainAgentSessions,shards:shards,shardLoading:shardLoading,shardPrependCount:shardPrependCount}=this.renderPrepare(),prefs=this._prefValues(),{sessions:displaySessions,upperBoundTs:sessionUpperBoundTs}=this._displaySessionsFor(mainAgentSessions);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}}let mobileContextPercent=0,mobileContextTokens=0;if(!mobileIsLocalLog){const contextWindow=this.state.contextWindow;let lastMainAgent=null,mobileInputTokens=0;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)){lastMainAgent=filteredRequests[i];const u=lastMainAgent.response.body.usage;mobileContextTokens=sumUsageContextTokens(u),mobileInputTokens=sumUsageInputTokens(u);break}mobileContextPercent=computeContextPercent({calibrationModel:this.state.calibrationModel,lastMainAgent:lastMainAgent,projectModelHint:this.state.claudeProjectModel,contextWindow:contextWindow,lastTotalTokens:mobileContextTokens,lastInputTokens:mobileInputTokens}),this.state.contextBarLocked?(this._lastContextPercent=0,mobileContextPercent=0,mobileContextTokens=0):(0===mobileContextPercent&&this._lastContextPercent>0?mobileContextPercent=this._lastContextPercent:this._lastContextPercent=mobileContextPercent,this.state.contextBarOptimistic&&(mobileContextPercent=OPTIMISTIC_CLEAR_PERCENT))}const wsOpen=!mobileIsLocalLog;return jsxRuntimeExports.jsx(TerminalWsProvider,{open:wsOpen,viewedProject:this.state.viewedProject||this.state.projectName||null,viewedInstance:this.state.viewedInstance||(this.state.viewedProject||this.state.projectName)===this.state.projectName&&this._boundInstance||null,children:jsxRuntimeExports.jsx(SdkContextUsageProvider,{enabled:!mobileIsLocalLog&&this.state.sdkMode&&!this.state.attachedSid,viewProject:this.state.viewedProject||this.state.projectName||null,viewInstance:this.state.viewedInstance||null,clearVersion:this.state.sdkContextClearVersion,locked:this.state.contextBarLocked,optimistic:this.state.contextBarOptimistic,children:jsxRuntimeExports.jsx(ApprovalModal,{enabled:isPad&&this.state.approvalPrefs.modalEnabled,soundEnabled:this.state.approvalPrefs.soundEnabled,voicePackPrefs:this.state.approvalPrefs.voicePack,approvalGlobal:this.state.approvalGlobal,dismissedIds:this.state.approvalDismissedIds,onDismiss:this.handleApprovalDismiss,onJumpTab:this.handleApprovalJumpTab,otherTabs:this.state.approvalOtherTabs,children:jsxRuntimeExports.jsx(ConfigProvider,{theme:this.themeConfig,children:jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCLIRoot,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[this.state.isDragging&&jsxRuntimeExports.jsx("div",{className:styles$3.dragOverlay,children:jsxRuntimeExports.jsxs("div",{className:styles$3.dragOverlayContent,children:[jsxRuntimeExports.jsx(RefIcon$1,{className:styles$3.dragIcon}),jsxRuntimeExports.jsx("p",{children:t("ui.dragDropHint")})]})}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCLIHeader,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCLIHeaderLeft,children:[jsxRuntimeExports.jsx("button",{className:styles$3.mobileMenuBtn,onClick:()=>{const opening=!this.state.mobileMenuVisible;this.setState(prev=>({mobileMenuVisible:!prev.mobileMenuVisible})),opening&&this._refreshPluginPanels()},"aria-label":t("ui.mobileMenu"),"aria-expanded":this.state.mobileMenuVisible,"aria-haspopup":"menu",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$3.mobileCLIStatusLabel,children:t("ui.historyLog",{file:this._localLogFile})})]}):(()=>jsxRuntimeExports.jsx(MobileContextTag,{projectName:this.state.projectName,fallbackPercent:mobileContextPercent,onToggle:()=>this.setState(prev=>({...this._closeAllMobileOverlays(),mobileCachePanelVisible:!prev.mobileCachePanelVisible}),()=>this._onCachePanelOpenChange(this.state.mobileCachePanelVisible))}))()]}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCLIHeaderRight,children:[mobileIsLocalLog?jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon,{}),onClick:()=>history.back(),className:styles$3.mobileNavBtn,children:t("ui.mobileGoBack")}):this.state.hasGit?jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon$2,{}),onClick:()=>this.setState(prev=>({...this._closeAllMobileOverlays(),mobileGitDiffVisible:!prev.mobileGitDiffVisible})),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=>({...this._closeAllMobileOverlays(),mobileTerminalVisible:!prev.mobileTerminalVisible})),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$3.mobileMenuOverlay,onClick:()=>this.setState({mobileMenuVisible:!1})}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileMenuDropdown,children:[!mobileIsLocalLog&&jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),mobileFileExplorerVisible:!0})},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$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),mobileLogMgmtVisible:!0}),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")]}),!mobileIsLocalLog&&jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),mobileResumeVisible:!0})},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:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),jsxRuntimeExports.jsx("path",{d:"M3 3v5h5"}),jsxRuntimeExports.jsx("path",{d:"M12 7v5l4 2"})]}),t("ui.resume.navTitle")]}),!mobileIsLocalLog&&("undefined"==typeof window||!window.tabBridge)&&jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),newProjectOpen:!0})},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("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntimeExports.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),t("ui.resume.newProject")]}),jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),mobilePromptVisible:!0})},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("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),pluginModalVisible:!0})},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:"9",y:"2",width:"6",height:"6",rx:"1"}),jsxRuntimeExports.jsx("rect",{x:"2",y:"9",width:"6",height:"6",rx:"1"}),jsxRuntimeExports.jsx("rect",{x:"16",y:"9",width:"6",height:"6",rx:"1"}),jsxRuntimeExports.jsx("rect",{x:"9",y:"16",width:"6",height:"6",rx:"1"})]}),t("ui.pluginManagement")]}),this.state.pluginPanels.filter(p=>p.entryUrl&&!p.desktopOnly).map(p=>jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),activePluginPanel:p,pluginPanelAttempt:0})},children:[jsxRuntimeExports.jsx(PanelIcon,{name:p.icon,style:{fontSize:16}}),panelTitle(p)]},`plugin-panel:${p.name}`)),jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),processModalVisible:!0})},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:"M12 2v4"}),jsxRuntimeExports.jsx("path",{d:"M12 18v4"}),jsxRuntimeExports.jsx("path",{d:"m4.93 4.93 2.83 2.83"}),jsxRuntimeExports.jsx("path",{d:"m16.24 16.24 2.83 2.83"}),jsxRuntimeExports.jsx("path",{d:"M2 12h4"}),jsxRuntimeExports.jsx("path",{d:"M18 12h4"}),jsxRuntimeExports.jsx("path",{d:"m4.93 19.07 2.83-2.83"}),jsxRuntimeExports.jsx("path",{d:"m16.24 7.76 2.83-2.83"})]}),t("ui.processManagement")]}),jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),proxyModalVisible:!0})},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("polyline",{points:"17 1 21 5 17 9"}),jsxRuntimeExports.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),jsxRuntimeExports.jsx("polyline",{points:"7 23 3 19 7 15"}),jsxRuntimeExports.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]}),t("ui.proxySwitch")]}),jsxRuntimeExports.jsx("div",{className:styles$3.mobileMenuDivider}),jsxRuntimeExports.jsxs("button",{className:styles$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),mobileStatsVisible:!0})},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$3.mobileMenuItem,onClick:()=>{this.setState({...this._closeAllMobileOverlays(),mobileSettingsVisible:!0})},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")]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCLIBody,children:[!mobileIsLocalLog&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[fileLoading&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileLoadingOverlay,children:[jsxRuntimeExports.jsx("div",{className:styles$3.mobileLoadingSpinner}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileLoadingLabel,children:[t("ui.loadingChat")," ",this._loadingProgressText()]})]}),jsxRuntimeExports.jsx("div",{className:styles$3.mobileChatInner,children:jsxRuntimeExports.jsx(ChatView,{...this._settingsProps(),requests:deepRequests,thinkingRequests:this.state.thinkingRequests||deepRequests,mainAgentSessions:displaySessions,sessionUpperBoundTs:sessionUpperBoundTs,streamingLatest:this.state.streamingLatest,userProfile:this.state.userProfile,collapseToolResults:prefs.collapseToolResults,expandThinking:prefs.expandThinking,showFullToolContent:prefs.showFullToolContent,minimalChat:prefs.minimalChat,onlyCurrentSession:!mobileIsLocalLog,isLocalLog:mobileIsLocalLog,shards:shards,shardLoading:shardLoading,shardPrependCount:shardPrependCount,onLoadEarlierShard:this._loadEarlierShard,showThinkingSummaries:prefs.showThinkingSummaries,onViewRequest:null,scrollToTimestamp:null,onScrollTsDone:()=>{},cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,onSdkModel:this.handleSdkModel,onSdkSessionState:this.handleSdkSessionState,terminalVisible:this.state.mobileTerminalVisible,mobileChatVisible:!0,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,turnActive:this.state.turnActive,onPendingPermission:this.handlePendingPermission,onPendingAsk:this.handleApprovalAsk,onPendingPtyPlan:this.handleApprovalPtyPlan,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,planAutoApproveSeconds:null==(_c=this.state.approvalPrefs)?void 0:_c.planAutoApproveSeconds,onPlanAutoApproveChange:this.handlePlanAutoApproveChange,askAutoAnswerMinutes:null==(_d=this.state.approvalPrefs)?void 0:_d.askAutoAnswerMinutes,onAskAutoAnswerChange:this.handleAskAutoAnswerChange,ownTabId:this.state.ownTabId,projectName:this.state.projectName,viewedProject:this.state.viewedProject||null,viewInstance:this.state.viewedInstance||(this.state.viewedProject||this.state.projectName)===this.state.projectName&&this._boundInstance||null,viewProject:this.state.viewedProject||this.state.projectName||null,suppressInlineApprovalPanels:!0,pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,uploadingDrop:this.state.uploadingDrop,onMobileOpenFile:this._handleMobileOpenFile,onClearContextOptimistic:this.handleClearContextOptimistic,onUserMessageSent:this.handleUserMessageSent,attachedSid:this.state.attachedSid||null,sdkModel:this.state.sdkModel,proxyProfiles:this.state.proxyProfiles,activeProxyId:this.state.activeProxyId,defaultConfig:this.state.defaultConfig,proxyRoles:this.state.proxyRoles,proxyOfficialDefault:this.state.proxyOfficialDefault,onProxyProfileChange:this.handleProxyProfileChange})})]}),!mobileIsLocalLog&&jsxRuntimeExports.jsx("div",{className:`${styles$3.mobileChatOverlay} ${this.state.mobileTerminalVisible?styles$3.mobileChatOverlayVisible:""}`,children:this.state.sdkMode?jsxRuntimeExports.jsx(TerminalPanel,{scratchOnly:!0,scratchOpen:this.state.mobileTerminalVisible,viewProject:this.state.viewedProject||this.state.projectName||null,viewInstance:this.state.viewedInstance||(this.state.viewedProject||this.state.projectName)===this.state.projectName&&this._boundInstance||null},"sdk-scratch"):jsxRuntimeExports.jsx(TerminalPanel,{...this._settingsProps(),modelName:mobileModelName,onFilePath:this._handleTerminalFilePath,pendingImages:this.state.terminalPendingImages,onRemovePendingImage:this._handleRemoveTerminalImage,onClearPendingImages:this._handleClearTerminalImages,onClearContextOptimistic:this.handleClearContextOptimistic,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,planAutoApproveSeconds:null==(_e=this.state.approvalPrefs)?void 0:_e.planAutoApproveSeconds,onPlanAutoApproveChange:this.handlePlanAutoApproveChange,askAutoAnswerMinutes:null==(_f=this.state.approvalPrefs)?void 0:_f.askAutoAnswerMinutes,onAskAutoAnswerChange:this.handleAskAutoAnswerChange,viewProject:this.state.viewedProject||this.state.projectName||null,viewInstance:this.state.viewedInstance||(this.state.viewedProject||this.state.projectName)===this.state.projectName&&this._boundInstance||null},"pty")}),jsxRuntimeExports.jsx("div",{className:`${styles$3.mobileGitDiffOverlay} ${this.state.mobileGitDiffVisible?styles$3.mobileGitDiffOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$3.mobileGitDiffInner,children:jsxRuntimeExports.jsx(MobileGitDiff,{visible:this.state.mobileGitDiffVisible,onClose:()=>this.setState({mobileGitDiffVisible:!1}),project:this.state.viewedProject||this.state.projectName||null,instance:this.state.viewedInstance||null})})}),jsxRuntimeExports.jsx("div",{className:`${styles$3.mobileCachePanelOverlay} ${this.state.mobileCachePanelVisible?styles$3.mobileCachePanelOverlayVisible:""}`,children:jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCachePanelInner,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileCachePanelHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileCachePanelTitle,children:t("ui.contextManagement")}),jsxRuntimeExports.jsx("button",{className:styles$3.mobileCachePanelClose,onClick:()=>this.setState({mobileCachePanelVisible:!1},()=>this._onCachePanelOpenChange(!1)),"aria-label":t("ui.closeCachePanel"),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$3.mobileCachePanelBody,children:this.state.mobileCachePanelVisible&&jsxRuntimeExports.jsx(CachePopoverContent,{inDrawer:!0,requests:deepRequests,serverCachedContent:this.state.serverCachedContent,contextPercent:mobileContextPercent,contextTokens:mobileContextTokens,fsSkills:this.state._fsSkills,onSkillImported:this.reloadFsSkills,onOpenSkillsModal:this.handleOpenSkillsModal,memory:this.state._memory,memoryRefreshing:this.state._memoryRefreshing,claudeMd:this.state._claudeMd,calibrationModel:this.state.calibrationModel,onCalibrationModelChange:this.handleCalibrationModelChange,onOpenMemoryDetail:this.loadMemoryDetail,onOpenClaudeMd:this.loadClaudeMdDetail,onRefreshMemory:this.handleRefreshMemory})})]})}),jsxRuntimeExports.jsx(MemoryDetailModal,{detail:this.state._memoryDetail,onClose:()=>this.setState({_memoryDetail:null}),onOpenMemoryDetail:this.loadMemoryDetail}),jsxRuntimeExports.jsxs(Modal,{title:t("ui.resume.recentSessions"),open:this.state.mobileResumeVisible,onCancel:()=>this.setState({mobileResumeVisible:!1}),footer:null,destroyOnHidden:!0,children:[jsxRuntimeExports.jsx(ResumeSessionsList,{active:this.state.mobileResumeVisible,project:this.state.viewedProject||this.state.projectName,attachedUuid:this.state.attachedSid||null,isStreaming:this.state.isStreaming,onResumeSession:row=>{this.setState({mobileResumeVisible:!1}),this.handleResumeSession(row)}}),this.state.attachedSid&&jsxRuntimeExports.jsx("div",{style:{marginTop:8,textAlign:"center"},children:jsxRuntimeExports.jsx("a",{onClick:this.handleDetachView,children:t("ui.resume.returnToCurrent")})})]}),("undefined"==typeof window||!window.tabBridge)&&this.renderNewProjectModal(),jsxRuntimeExports.jsx(MemoryDetailModal,{detail:this.state._claudeMdDetail,onClose:()=>this.setState({_claudeMdDetail:null}),onOpenFolder:this.openClaudeMdFolder,linkMode:"passthrough"}),this.state._targetBrowser&&jsxRuntimeExports.jsx(FileBrowserModal,{open:!0,target:this.state._targetBrowser.target,rootLabel:this.state._targetBrowser.label,project:this.state.viewedProject||this.state.projectName,instance:this.state.viewedInstance,zIndex:1120,onClose:this.closeTargetBrowser}),jsxRuntimeExports.jsx(SkillsManagerModal,{open:(null==(_g=this.state._skillsModal)?void 0:_g.open)||!1,loading:(null==(_h=this.state._skillsModal)?void 0:_h.loading)||!1,error:(null==(_i=this.state._skillsModal)?void 0:_i.error)||null,skills:(null==(_j=this.state._skillsModal)?void 0:_j.skills)||[],toggling:null==(_k=this.state._skillsModal)?void 0:_k.toggling,onToggle:s=>this.handleToggleSkill(s),onDelete:s=>this.handleDeleteSkill(s),onOpenFolder:this.openSkillFolder,onClose:()=>this.setState(prev=>({_skillsModal:{...prev._skillsModal,open:!1}}))}),jsxRuntimeExports.jsx(ProjectPrefsManagerModal,{open:this.state.projectPrefsModalOpen,onClose:()=>this.setState({projectPrefsModalOpen:!1}),onChanged:this.refreshAllPrefs}),jsxRuntimeExports.jsx(PluginModal,{open:this.state.pluginModalVisible,onClose:this._handlePluginModalClose}),jsxRuntimeExports.jsx(PluginPanelModal,{panel:this.state.activePluginPanel,open:!!this.state.activePluginPanel,onClose:this._handlePluginPanelClose,attempt:this.state.pluginPanelAttempt,onRetry:()=>this.setState(s=>({pluginPanelAttempt:s.pluginPanelAttempt+1})),theme:this.state.themeColor,lang:getLang(),project:this.state.viewedProject||this.state.projectName||null,instance:this.state.viewedInstance||null}),jsxRuntimeExports.jsx(ProcessModal,{open:this.state.processModalVisible,onClose:()=>this.setState({processModalVisible:!1})}),jsxRuntimeExports.jsx(ProxyModal,{open:this.state.proxyModalVisible,onClose:()=>this.setState({proxyModalVisible:!1}),proxyProfiles:this.state.proxyProfiles,activeProxyId:this.state.activeProxyId,defaultConfig:this.state.defaultConfig,proxyRoles:this.state.proxyRoles,proxyOfficialDefault:this.state.proxyOfficialDefault,onProxyProfileChange:this.handleProxyProfileChange}),jsxRuntimeExports.jsx("div",{className:`${styles$3.mobileFileExplorerOverlay} ${this.state.mobileFileExplorerVisible?styles$3.mobileFileExplorerOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$3.mobileFileExplorerInner,children:jsxRuntimeExports.jsx(MobileFileExplorer,{visible:this.state.mobileFileExplorerVisible,onClose:()=>this.setState({mobileFileExplorerVisible:!1,mobileFileExplorerTarget:null}),targetFile:this.state.mobileFileExplorerTarget,projectName:this.state.projectName,project:this.state.viewedProject||this.state.projectName||null,instance:this.state.viewedInstance||null})})}),jsxRuntimeExports.jsx("div",{className:`${styles$3.mobileStatsOverlay} ${this.state.mobileStatsVisible?styles$3.mobileStatsOverlayVisible:""}`,children:jsxRuntimeExports.jsx("div",{className:styles$3.mobileStatsInner,children:jsxRuntimeExports.jsx(MobileStats,{requests:deepRequests,visible:this.state.mobileStatsVisible,onClose:()=>this.setState({mobileStatsVisible:!1})})})}),jsxRuntimeExports.jsxs("div",{className:`${styles$3.mobileLogMgmtOverlay} ${this.state.mobileLogMgmtVisible?styles$3.mobileLogMgmtOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsxs("span",{className:styles$3.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$3.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$3.mobileLogMgmtActions,children:[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$3.mobileLogMgmtBody,children:this.state.localLogsLoading?jsxRuntimeExports.jsx("div",{className:styles$3.spinCenter,children:jsxRuntimeExports.jsx(Loading,{})}):(()=>{const currentLogs=this.state.localLogs;return currentLogs&&0!==currentLogs.length?jsxRuntimeExports.jsx("div",{className:styles$3.logListContainer,children:this.renderLogTable(currentLogs,!0)}):jsxRuntimeExports.jsx("div",{className:styles$3.emptyCenter,children:t("ui.noLogs")})})()})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$3.mobileSettingsOverlay} ${this.state.mobileSettingsVisible?styles$3.mobileSettingsOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileLogMgmtTitle,children:t("ui.settings")}),jsxRuntimeExports.jsx("button",{className:styles$3.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$3.mobileSettingsBody,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$3.mobileSettingsSectionTitle,children:t("ui.chatDisplay")}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.permission.autoApprove.setting")}),jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.autoApproveSeconds||0,onChange:this.handleAutoApproveChange,options:autoApproveSelectOptions(PERM_AUTO_APPROVE_OPTIONS,t),style:{width:100}})]}),this.state.approvalPrefs&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsxs("span",{className:styles$3.mobileSettingsLabel,children:[t("ui.approval.settings.planAutoApprove"),jsxRuntimeExports.jsx(Tooltip,{title:t("ui.approval.settings.planAutoApproveHelp"),trigger:"click",children:jsxRuntimeExports.jsx(RefIcon$5,{className:styles$3.mobileSettingsHelpIcon})})]}),jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.approvalPrefs.planAutoApproveSeconds||0,onChange:value=>this.handleApprovalPrefsChange({planAutoApproveSeconds:value}),options:autoApproveSelectOptions(PLAN_AUTO_APPROVE_OPTIONS,t),style:{width:100}})]}),this.state.approvalPrefs&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsxs("span",{className:styles$3.mobileSettingsLabel,children:[t("ui.askAutoAnswer.setting"),jsxRuntimeExports.jsx(Tooltip,{title:t("ui.askAutoAnswer.help"),trigger:"click",overlayInnerStyle:{whiteSpace:"pre-line"},children:jsxRuntimeExports.jsx(RefIcon$5,{className:styles$3.mobileSettingsHelpIcon})})]}),jsxRuntimeExports.jsx(Select,{size:"small",value:askAutoAnswerUiValue(this.state.approvalPrefs.askAutoAnswerMinutes),onChange:value=>this.handleApprovalPrefsChange({askAutoAnswerMinutes:askAutoAnswerPrefValue(value)}),options:askAutoAnswerSelectOptions(t),style:{width:100}})]}),isPad&&this.state.approvalPrefs&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.approval.settings.modalEnabled")}),jsxRuntimeExports.jsx(Switch,{checked:!1!==this.state.approvalPrefs.modalEnabled,onChange:checked=>this.handleApprovalPrefsChange({modalEnabled:checked})})]}),"undefined"!=typeof window&&window.tabBridge&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.approval.settings.notifyOnlyWhenHidden")}),jsxRuntimeExports.jsx(Switch,{checked:!1!==this.state.approvalPrefs.notifyOnlyWhenHidden,onChange:checked=>this.handleApprovalPrefsChange({notifyOnlyWhenHidden:checked})})]})]}),this.state.approvalPrefs&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.approval.settings.soundEnabled")}),jsxRuntimeExports.jsx(Switch,{checked:!!this.state.approvalPrefs.soundEnabled,onChange:checked=>this.handleApprovalSoundToggle(checked)})]}),this.state.approvalPrefs&&this.state.approvalPrefs.soundEnabled&&jsxRuntimeExports.jsx(VoicePackSettings,{prefs:this.state.approvalPrefs.voicePack,onChange:this.handleVoicePackChange,embedded:!0}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.expandThinking")}),jsxRuntimeExports.jsx(Switch,{checked:prefs.expandThinking,onChange:this.handleExpandThinkingChange})]}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.showFullToolContent")}),jsxRuntimeExports.jsx(Switch,{checked:prefs.showFullToolContent,onChange:this.handleShowFullToolContentChange})]}),prefs.showFullToolContent&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.collapseToolResults")}),jsxRuntimeExports.jsx(Switch,{checked:prefs.collapseToolResults,onChange:this.handleCollapseToolResultsChange})]}),!prefs.showFullToolContent&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.minimalChat")}),jsxRuntimeExports.jsx(Switch,{checked:!1!==prefs.minimalChat,onChange:this.handleMinimalChatChange})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$3.mobileSettingsSectionTitle,children:t("ui.themeStyle")}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.themeColor")}),jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.themeColor||"light",onChange:this.handleThemeColorChange,options:[{label:t("ui.themeColor.dark"),value:"dark"},{label:t("ui.themeColor.light"),value:"light"}],style:{width:140}})]}),jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.languageSettings")}),jsxRuntimeExports.jsx(Select,{size:"small",value:getLang(),onChange:value=>{setLang(value),this.handleLangChange()},options:LANG_OPTIONS.map(o=>({label:o.label,value:o.value})),style:{width:140}})]})]}),(()=>{const pp=this.context&&this.context.preferences||{},showToggle=!this._isLocalLog&&!!pp._projectName&&!1===pp._isLocal,forkKeys=Array.isArray(pp._projectPrefsKeys)?pp._projectPrefsKeys:[],showManage=!0===pp._isAdmin&&forkKeys.length>0;return showToggle||showManage?jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$3.mobileSettingsSectionTitle,children:t("ui.projectScopedPrefs.group")}),showToggle&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsxs("span",{className:styles$3.mobileSettingsLabel,children:[t("ui.projectScopedPrefs"),jsxRuntimeExports.jsx(Tooltip,{title:t("ui.projectScopedPrefs.help"),children:jsxRuntimeExports.jsx(RefIcon$5,{className:styles$3.mobileSettingsHelpIcon})})]}),jsxRuntimeExports.jsx(Switch,{"aria-label":t("ui.projectScopedPrefs"),checked:!!pp._projectScoped,onChange:checked=>this.handleToggleProjectScoped(checked)})]}),showManage&&jsxRuntimeExports.jsxs("div",{className:styles$3.mobileSettingsRow,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileSettingsLabel,children:t("ui.projectPrefsManage")}),jsxRuntimeExports.jsx(Button,{size:"small",onClick:()=>this.setState({projectPrefsModalOpen:!0}),children:t("ui.projectPrefsManage.open",{count:forkKeys.length})})]})]}):null})()]})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$3.mobilePromptOverlay} ${this.state.mobilePromptVisible?styles$3.mobilePromptOverlayVisible:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobileLogMgmtHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$3.mobileLogMgmtTitle,children:t("ui.userPrompt")}),jsxRuntimeExports.jsx("button",{className:styles$3.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$3.mobilePromptBody,children:(()=>{const prompts=this.extractUserPrompts(filteredRequests);return 0===prompts.length?jsxRuntimeExports.jsx("div",{className:styles$3.mobilePromptEmpty,children:t("ui.noPrompt")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$3.mobilePromptHeader,children:[jsxRuntimeExports.jsxs("span",{className:styles$3.mobilePromptCount,children:[prompts.length," ",t("ui.promptCountUnit")]}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$6,{}),onClick:()=>this.handleExportPromptsTxt(prompts),children:t("ui.exportPromptsTxt")})]}),jsxRuntimeExports.jsx("div",{className:styles$3.mobilePromptList,children:prompts.map((p,i)=>jsxRuntimeExports.jsxs("div",{className:styles$3.mobilePromptItem,children:[p.timestamp&&jsxRuntimeExports.jsx("div",{className:styles$3.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,autoApproveSecondsServer:this.state.globalPermission.permission.autoApproveSeconds??null,autoApproveAt:this.state.globalPermission.permission.autoApproveAt??null,autoCancelled:!0===this.state.globalPermission.permission.autoCancelled,onCancelAutoApprove:this.state.globalPermission.handlers.cancelAutoApprove??null,onAutoApproveChange:this.handleAutoApproveChange})]})})})})})}};__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 +0,0 @@
|
|
|
1
|
-
import{j as jsxRuntimeExports}from"./vendor-codemirror-CKsm_iG4.js";import{a as reactExports,I as Icon,b as _extends,R as React,u as Tag,E as Empty,v as Card,w as Statistic,x as Space,F as ForwardTable,m as Switch,i as Button,k as RefIcon$3,y as Segmented,S as Select,z as TypedInputNumber,T as Tooltip,s as staticMethods}from"./vendor-antd-DWLgSkPo.js";import{t,w as withViewParams,a as apiUrl}from"./index-Ca3a2tOc.js";import{ak as reportSwallowed,a5 as Loading,C as ConceptHelp}from"./seqResourceLoaders-DeqzMajS.js";import"./vendor-mdxeditor-Dah6NK0y.js";import"./vendor-xterm-DckPrCx1.js";import"./vendor-markdown-DOJHsAxX.js";import"./vendor-virtuoso-DKUobZpA.js";import"./vendor-highlight-IFTJ9nxW.js";var CheckCircleOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},CheckCircleOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref:ref,icon:CheckCircleOutlined$1}))},RefIcon$2=reactExports.forwardRef(CheckCircleOutlined),CloseCircleOutlined$1={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},CloseCircleOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref:ref,icon:CloseCircleOutlined$1}))},RefIcon$1=reactExports.forwardRef(CloseCircleOutlined),UndoOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"}}]},name:"undo",theme:"outlined"},UndoOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref:ref,icon:UndoOutlined$1}))},RefIcon=reactExports.forwardRef(UndoOutlined);const styles$3_wrap="_wrap_1glwx_3",styles$3_svg="_svg_1glwx_7",styles$3_bar="_bar_1glwx_12",styles$3_axisLine="_axisLine_1glwx_21",styles$3_gridLine="_gridLine_1glwx_25",styles$3_vLabel="_vLabel_1glwx_30",styles$3_vValue="_vValue_1glwx_34",styles$3_legend="_legend_1glwx_38",styles$3_legendItem="_legendItem_1glwx_46",styles$3_legendSwatch="_legendSwatch_1glwx_51";function groupedBarTitle(label2,value,bi,legend2,valueFormatter){const formatted=valueFormatter(value),name=Array.isArray(legend2)?legend2[bi]:void 0;return name?`${label2} (${name}): ${formatted}`:`${label2}: ${formatted}`}function singleBarTitle(label2,value,valueFormatter){return`${label2}: ${valueFormatter(value)}`}const DEFAULT_COLORS=["var(--color-primary, #1668dc)","var(--color-chart-series-2, #cf6c48)"];const BarChart$1=React.memo(function({data:data=[],height:height=160,grouped:grouped=!1,valueFormatter:valueFormatter=n=>String(n),maxBars:maxBars,legend:legend2,ariaLabel:ariaLabel}){var _a,_b;const wrapRef=reactExports.useRef(null),[width,setWidth]=reactExports.useState(0);reactExports.useEffect(()=>{if(!wrapRef.current)return;const el=wrapRef.current,update=()=>setWidth(el.clientWidth||0);if(update(),"undefined"==typeof ResizeObserver)return;const ro=new ResizeObserver(update);return ro.observe(el),()=>{try{ro.disconnect()}catch{}}},[]);const rows=function(data,{maxBars:maxBars,grouped:grouped=!1}={}){var _a,_b;if(!maxBars||!Array.isArray(data)||data.length<=maxBars)return data;const head=data.slice(0,maxBars),tail=data.slice(maxBars);if(grouped){const seriesCount=(null==(_b=null==(_a=head[0])?void 0:_a.values)?void 0:_b.length)||1,sums=new Array(seriesCount).fill(0);for(const d of tail){const vals=d.values||[];for(let i=0;i<seriesCount;i++)sums[i]+=vals[i]||0}return[...head,{label:"…",value:sums[0],values:sums}]}const otherCount=tail.reduce((s,d)=>s+(d.value||0),0);return[...head,{label:"…",value:otherCount,values:[otherCount]}]}(Array.isArray(data)?data:[],{maxBars:maxBars,grouped:grouped});if(!rows||0===rows.length||0===width)return jsxRuntimeExports.jsx("div",{ref:wrapRef,className:styles$3_wrap,style:{height:height}});const legendEl=grouped&&Array.isArray(legend2)&&legend2.length>0?jsxRuntimeExports.jsx("div",{className:styles$3_legend,"aria-hidden":"true",children:legend2.map((label2,i)=>jsxRuntimeExports.jsxs("span",{className:styles$3_legendItem,children:[jsxRuntimeExports.jsx("span",{className:styles$3_legendSwatch,style:{background:DEFAULT_COLORS[i%DEFAULT_COLORS.length]}}),label2]},i))}):null,innerW=Math.max(0,width-28),innerH=Math.max(0,height-28-16),maxVal=rows.reduce((m,d)=>{const vals=grouped?d.values||[0]:[d.value||0];for(const v of vals)v>m&&(m=v);return m},1),groupW=innerW/rows.length,barW=grouped?Math.max(2,.6*groupW/Math.max(1,(null==(_b=null==(_a=rows[0])?void 0:_a.values)?void 0:_b.length)||1)):Math.max(2,.5*groupW),baseline=28+innerH;return jsxRuntimeExports.jsxs("div",{ref:wrapRef,className:styles$3_wrap,style:{height:height},children:[legendEl,jsxRuntimeExports.jsxs("svg",{className:styles$3_svg,height:height,width:width,role:"img","aria-label":ariaLabel,children:[[.25,.5,.75].map(f=>jsxRuntimeExports.jsx("line",{className:styles$3_gridLine,x1:28,x2:width,y1:28+innerH*(1-f),y2:28+innerH*(1-f)},f)),jsxRuntimeExports.jsx("line",{className:styles$3_axisLine,x1:28,x2:width,y1:baseline,y2:baseline}),rows.map((d,gi)=>{var _a2,_b2;const gx=28+gi*groupW+(groupW-(grouped?((null==(_b2=null==(_a2=rows[0])?void 0:_a2.values)?void 0:_b2.length)||1)*barW:barW))/2,vals=grouped?d.values||[0]:[d.value||0];return jsxRuntimeExports.jsxs("g",{children:[vals.map((v,bi)=>{const h=Math.max(0,v/maxVal*innerH),x=gx+bi*barW,y=baseline-h,color=grouped?DEFAULT_COLORS[bi%DEFAULT_COLORS.length]:DEFAULT_COLORS[0];return jsxRuntimeExports.jsxs("g",{children:[jsxRuntimeExports.jsx("rect",{className:styles$3_bar,x:x,y:y,width:Math.max(1,barW-1),height:h,fill:color,rx:1,children:jsxRuntimeExports.jsx("title",{children:grouped?groupedBarTitle(d.label,v,bi,legend2,valueFormatter):singleBarTitle(d.label,v,valueFormatter)})}),!grouped&&barW>=18&&jsxRuntimeExports.jsx("text",{className:styles$3_vValue,x:x+barW/2,y:Math.max(8,y-4),textAnchor:"middle",children:valueFormatter(v)})]},bi)}),jsxRuntimeExports.jsx("text",{className:styles$3_vLabel,x:28+gi*groupW+groupW/2,y:height-4,textAnchor:"middle",children:String(d.label).slice(0,8)})]},gi)})]})]})});function fmtMs(ms){return ms>0?ms<1e3?`${Math.round(ms)} ms`:`${(ms/1e3).toFixed(2)} s`:"-"}function statusColor(status){return 0===status?"default":status<400?"success":status<500?"warning":"error"}function availColor(pct){return pct>=95?"var(--color-success, #22c55e)":pct>=80?"var(--color-warning, #f59e0b)":"var(--color-error, #ef4444)"}function dominantFailCell(bucket){return bucket&&null!=bucket.dominantFailStatus?jsxRuntimeExports.jsxs(Tag,{color:statusColor(bucket.dominantFailStatus),children:[bucket.dominantFailStatus," × ",bucket.dominantFailCount]}):null}const styles$2_embedded="_embedded_sdeqo_7",styles$2_centerState="_centerState_sdeqo_11",styles$2_header="_header_sdeqo_20",styles$2_cardRow="_cardRow_sdeqo_23",styles$2_statCard="_statCard_sdeqo_33",styles$2_section="_section_sdeqo_70",styles$2_streakRow="_streakRow_sdeqo_83",styles$2_chartWrap="_chartWrap_sdeqo_91",styles$2_chartTitle="_chartTitle_sdeqo_96",styles$2_codeTags="_codeTags_sdeqo_105",styles$2_topRow="_topRow_sdeqo_112",styles$2_rescuedBadge="_rescuedBadge_sdeqo_115",fmtPercent=n=>`${n}%`;function ProxyStatsDashboard({project:project}){const[data,setData]=reactExports.useState(null),[loading,setLoading]=reactExports.useState(!0),[autoRefresh,setAutoRefresh]=reactExports.useState(!0),fetchData=reactExports.useCallback(()=>{setLoading(!0);const url=project?withViewParams("/api/proxy-stats",{project:project}):"/api/proxy-stats";fetch(apiUrl(url)).then(res=>{if(!res.ok)throw new Error(`HTTP ${res.status}`);return res.json()}).then(d=>{setData(d.proxyStats),setLoading(!1)}).catch(err=>{reportSwallowed("proxyStats.fetch",err),setLoading(!1)})},[project]);reactExports.useEffect(()=>{fetchData()},[fetchData]),reactExports.useEffect(()=>{if(!autoRefresh)return;const id=setInterval(fetchData,15e3);return()=>clearInterval(id)},[autoRefresh,fetchData]);const byModelBars=reactExports.useMemo(()=>((null==data?void 0:data.byModel)||[]).map(m=>({label:m.model,values:[m.upstreamAvailabilityPct,m.availabilityPct]})),[data]),retryDistBars=reactExports.useMemo(()=>((null==data?void 0:data.retryDistribution)||[]).map(d=>({label:String(d.retries),value:d.count})),[data]),retryBurdenBars=reactExports.useMemo(()=>((null==data?void 0:data.retryBurden)||[]).map(b=>{return{label:(key=b.key,t(`ui.proxyStats.retryBurdenBuckets.${key}`)),value:b.count};var key}),[data]),recentRecords=reactExports.useMemo(()=>((null==data?void 0:data.recentRecords)||[]).filter(r=>{const status=Number(r.final_status);return 0===status||status>=400||(Number(r.retries)||0)>0}),[data]);if(loading&&!data)return jsxRuntimeExports.jsx("div",{className:`${styles$2_embedded} ${styles$2_centerState}`,children:jsxRuntimeExports.jsx(Loading,{size:"large"})});if(!data||!data.summary||0===data.summary.totalRequests)return jsxRuntimeExports.jsxs("div",{className:styles$2_embedded,children:[jsxRuntimeExports.jsx(DashboardHeader,{onRefresh:fetchData,autoRefresh:autoRefresh,setAutoRefresh:setAutoRefresh}),jsxRuntimeExports.jsx("div",{className:styles$2_centerState,children:jsxRuntimeExports.jsx(Empty,{description:t("ui.proxyStats.noData")})})]});const s=data.summary,rescued=Math.max(0,s.totalSucceeded-s.totalFirstOk);return jsxRuntimeExports.jsxs("div",{className:styles$2_embedded,children:[jsxRuntimeExports.jsx(DashboardHeader,{onRefresh:fetchData,autoRefresh:autoRefresh,setAutoRefresh:setAutoRefresh}),jsxRuntimeExports.jsxs("div",{className:styles$2_cardRow,children:[jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.totalRequests"),value:s.totalRequests})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.totalRetries"),value:s.totalRetries,suffix:s.totalRequests?`(${(s.totalRetries/s.totalRequests).toFixed(1)}/req)`:""})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,style:{"--stat-accent":availColor(s.upstreamAvailabilityPct)},children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.upstreamAvailability"),value:s.upstreamAvailabilityPct,suffix:"%",valueStyle:{color:availColor(s.upstreamAvailabilityPct)}})}),jsxRuntimeExports.jsxs(Card,{className:styles$2_statCard,style:{"--stat-accent":availColor(s.downstreamAvailabilityPct)},children:[jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.downstreamAvailability"),value:s.downstreamAvailabilityPct,suffix:"%",valueStyle:{color:availColor(s.downstreamAvailabilityPct)}}),rescued>0&&jsxRuntimeExports.jsx("span",{className:styles$2_rescuedBadge,children:t("ui.proxyStats.rescuedByRetry",{count:rescued})})]}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,style:{"--stat-accent":"var(--color-error, #ef4444)"},children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.failedRequests"),value:s.totalFailed,valueStyle:{color:"var(--color-error, #ef4444)"}})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.p95Duration"),value:fmtMs(s.p95Ms)})})]}),jsxRuntimeExports.jsxs(Card,{title:t("ui.proxyStats.availabilityAnalysis"),className:styles$2_section,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_streakRow,children:[jsxRuntimeExports.jsxs(Space,{children:[jsxRuntimeExports.jsxs("span",{children:[t("ui.proxyStats.currentStreak"),":"]}),jsxRuntimeExports.jsxs(Tag,{icon:"success"===s.currentStreakType?jsxRuntimeExports.jsx(RefIcon$2,{}):jsxRuntimeExports.jsx(RefIcon$1,{}),color:"success"===s.currentStreakType?"success":"error",children:["success"===s.currentStreakType?t("ui.proxyStats.success"):t("ui.proxyStats.failure")," × ",s.currentStreakCount]})]}),jsxRuntimeExports.jsxs(Space,{children:[jsxRuntimeExports.jsxs("span",{children:[t("ui.proxyStats.worstFailureStreak"),":"]}),jsxRuntimeExports.jsx(Tag,{color:"error",children:s.worstFailureStreak})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_chartWrap,children:[jsxRuntimeExports.jsx("div",{className:styles$2_chartTitle,children:t("ui.proxyStats.upstreamVsDownstream")}),jsxRuntimeExports.jsx(BarChart$1,{height:180,grouped:!0,legend:[t("ui.proxyStats.upstreamAvailability"),t("ui.proxyStats.downstreamAvailability")],ariaLabel:t("ui.proxyStats.upstreamVsDownstream"),data:byModelBars,valueFormatter:fmtPercent,maxBars:10})]}),jsxRuntimeExports.jsx(ForwardTable,{dataSource:data.byModel||[],rowKey:"model",size:"small",pagination:!1,className:styles$2_section,columns:[{title:t("ui.proxyStats.byModel"),dataIndex:"model",key:"model"},{title:t("ui.proxyStats.totalRequests"),dataIndex:"requests",key:"requests"},{title:t("ui.proxyStats.retries"),dataIndex:"retries",key:"retries"},{title:t("ui.proxyStats.upstreamAvailability"),dataIndex:"upstreamAvailabilityPct",key:"upAvail",render:v=>`${v}%`},{title:t("ui.proxyStats.downstreamAvailability"),dataIndex:"availabilityPct",key:"dsAvail",render:v=>`${v}%`},{title:t("ui.proxyStats.dominantFail"),key:"domFail",render:(_,r)=>dominantFailCell(r)||"-"},{title:t("ui.proxyStats.p95Duration"),dataIndex:"p95Ms",key:"p95",render:fmtMs}]})]}),jsxRuntimeExports.jsxs(Card,{title:t("ui.proxyStats.retryDistribution"),className:styles$2_section,children:[jsxRuntimeExports.jsx("div",{className:styles$2_chartWrap,children:jsxRuntimeExports.jsx(BarChart$1,{height:160,ariaLabel:t("ui.proxyStats.retryDistribution"),data:retryDistBars,maxBars:15})}),jsxRuntimeExports.jsxs("div",{className:styles$2_chartWrap,children:[jsxRuntimeExports.jsx("div",{className:styles$2_chartTitle,children:t("ui.proxyStats.retryBurden")}),jsxRuntimeExports.jsx(BarChart$1,{height:160,ariaLabel:t("ui.proxyStats.retryBurden"),data:retryBurdenBars})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_codeTags,children:[jsxRuntimeExports.jsxs("span",{children:[t("ui.proxyStats.retryCodes"),":"]}),jsxRuntimeExports.jsx(Space,{wrap:!0,children:(data.retryCodes||[]).map(c=>jsxRuntimeExports.jsxs(Tag,{color:statusColor(c.code),children:[c.code," × ",c.count]},c.code))})]})]}),jsxRuntimeExports.jsxs(Card,{title:t("ui.proxyStats.durationAnalysis"),className:styles$2_section,children:[jsxRuntimeExports.jsxs("div",{className:styles$2_cardRow,children:[jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.p50Duration"),value:fmtMs(s.p50Ms)})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.p95Duration"),value:fmtMs(s.p95Ms)})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.p99Duration"),value:fmtMs(s.p99Ms)})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.maxDuration"),value:fmtMs(s.maxMs)})}),jsxRuntimeExports.jsx(Card,{className:styles$2_statCard,children:jsxRuntimeExports.jsx(Statistic,{title:t("ui.proxyStats.avgDuration"),value:fmtMs(s.avgMs)})})]}),jsxRuntimeExports.jsxs("div",{className:styles$2_topRow,children:[jsxRuntimeExports.jsx(DurationRecordTable,{title:t("ui.proxyStats.slowest"),record:data.slowest}),jsxRuntimeExports.jsx(DurationRecordTable,{title:t("ui.proxyStats.fastest"),record:data.fastest})]})]}),data.byPath&&data.byPath.length>0&&jsxRuntimeExports.jsx(Card,{title:t("ui.proxyStats.byPath"),className:styles$2_section,children:jsxRuntimeExports.jsx(ForwardTable,{dataSource:data.byPath,rowKey:"path",size:"small",pagination:!1,columns:[{title:t("ui.proxyStats.colPath"),dataIndex:"path",key:"path",ellipsis:!0},{title:t("ui.proxyStats.totalRequests"),dataIndex:"requests",key:"requests"},{title:t("ui.proxyStats.retries"),dataIndex:"retries",key:"retries"},{title:t("ui.proxyStats.downstreamAvailability"),dataIndex:"availabilityPct",key:"avail",render:v=>`${v}%`},{title:t("ui.proxyStats.dominantFail"),key:"domFail",render:(_,r)=>dominantFailCell(r)||"-"}]})}),data.byProfile&&data.byProfile.length>0&&jsxRuntimeExports.jsx(Card,{title:t("ui.proxyStats.byProfile"),className:styles$2_section,children:jsxRuntimeExports.jsx(ForwardTable,{dataSource:data.byProfile,rowKey:"profile_id",size:"small",pagination:!1,columns:[{title:t("ui.proxyStats.byProfile"),dataIndex:"profile_name",key:"profile_name"},{title:t("ui.proxyStats.totalRequests"),dataIndex:"requests",key:"requests"},{title:t("ui.proxyStats.retries"),dataIndex:"retries",key:"retries"},{title:t("ui.proxyStats.upstreamAvailability"),dataIndex:"upstreamAvailabilityPct",key:"upAvail",render:v=>`${v}%`},{title:t("ui.proxyStats.downstreamAvailability"),dataIndex:"availabilityPct",key:"dsAvail",render:v=>`${v}%`},{title:t("ui.proxyStats.dominantFail"),key:"domFail",render:(_,r)=>dominantFailCell(r)||"-"},{title:t("ui.proxyStats.p95Duration"),dataIndex:"p95Ms",key:"p95",render:fmtMs}]})}),jsxRuntimeExports.jsx(Card,{title:t("ui.proxyStats.recentErrors"),className:styles$2_section,children:jsxRuntimeExports.jsx(ForwardTable,{dataSource:recentRecords,rowKey:"ts",size:"small",pagination:{pageSize:20,size:"small"},scroll:{x:"max-content"},columns:[{title:t("ui.proxyStats.colTime"),dataIndex:"ts",key:"ts",width:180,ellipsis:!0,render:v=>v?new Date(v).toLocaleString():"-"},{title:t("ui.proxyStats.colMethod"),dataIndex:"method",key:"method",width:70},{title:t("ui.proxyStats.colPath"),dataIndex:"path",key:"path",ellipsis:!0},{title:t("ui.proxyStats.colModel"),dataIndex:"model",key:"model",ellipsis:!0},{title:t("ui.proxyStats.colStatus"),dataIndex:"final_status",key:"status",width:70,render:v=>jsxRuntimeExports.jsx(Tag,{color:statusColor(v),children:v||"-"})},{title:t("ui.proxyStats.attempts"),dataIndex:"attempts",key:"attempts",width:80},{title:t("ui.proxyStats.retries"),dataIndex:"retries",key:"retries",width:80},{title:t("ui.proxyStats.colDuration"),dataIndex:"duration_ms",key:"dur",width:100,render:fmtMs},{title:t("ui.proxyStats.retryCodes"),dataIndex:"retry_codes",key:"rc",width:120,render:v=>v&&v.length?v.map(c=>jsxRuntimeExports.jsx(Tag,{color:statusColor(c),children:c},c)):"-"}]})})]})}function DurationRecordTable({title:title,record:record}){return jsxRuntimeExports.jsx(ForwardTable,{title:()=>title,dataSource:record?[record]:[],rowKey:"ts",size:"small",pagination:!1,columns:[{title:t("ui.proxyStats.colPath"),dataIndex:"path",key:"path",ellipsis:!0},{title:t("ui.proxyStats.colModel"),dataIndex:"model",key:"model",ellipsis:!0},{title:t("ui.proxyStats.attempts"),dataIndex:"attempts",key:"attempts"},{title:t("ui.proxyStats.colDuration"),dataIndex:"duration_ms",key:"dur",render:fmtMs}]})}function DashboardHeader({onRefresh:onRefresh,autoRefresh:autoRefresh,setAutoRefresh:setAutoRefresh}){return jsxRuntimeExports.jsx("div",{className:styles$2_header,children:jsxRuntimeExports.jsxs(Space,{children:[jsxRuntimeExports.jsx("span",{children:t("ui.proxyStats.autoRefresh")}),jsxRuntimeExports.jsx(Switch,{checked:autoRefresh,onChange:setAutoRefresh,size:"small","aria-label":t("ui.proxyStats.autoRefresh")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$3,{}),onClick:onRefresh,children:t("ui.proxyStats.refresh")})]})})}const styles$1_form="_form_ntb31_3",styles$1_configGrid="_configGrid_ntb31_9",styles$1_configGroup="_configGroup_ntb31_18",styles$1_groupTitle="_groupTitle_ntb31_26",styles$1_row="_row_ntb31_41",styles$1_label="_label_ntb31_53",styles$1_inputCell="_inputCell_ntb31_68",styles$1_hint="_hint_ntb31_76",styles$1_fullWidth="_fullWidth_ntb31_83",styles$1_numField="_numField_ntb31_87",styles$1_numInput="_numInput_ntb31_96",styles$1_unit="_unit_ntb31_101",styles$1_reservedTag="_reservedTag_ntb31_106",styles$1_footer="_footer_ntb31_115",styles$1_footerRight="_footerRight_ntb31_123",styles$1_note="_note_ntb31_128",MODE_VALUES=["off","serial","race","stagger"],STATUS_CODE_OPTIONS=[429,500,502,503,504,508,529,408],NUMERIC_FIELDS=[{key:"retryIntervalMs",unit:"ms",min:0,max:6e5},{key:"retryInterval429Ms",unit:"ms",min:0,max:6e5},{key:"maxRetries",unit:"",min:0,max:1e3},{key:"maxConcurrent",unit:"",min:1,max:100},{key:"connectTimeoutMs",unit:"ms",min:0,max:6e5}];function RetryConfigForm({config:config,defaults:defaults,onSave:onSave}){const[form2,setForm]=reactExports.useState(null),[dirty,setDirty]=reactExports.useState(!1),initializedRef=reactExports.useRef(!1);reactExports.useEffect(()=>{config&&(initializedRef.current?dirty||setForm({...config}):(setForm({...config}),initializedRef.current=!0))},[config,dirty]);const def=defaults||{},patch=(key,value)=>{setDirty(!0),setForm(prev=>prev?{...prev,[key]:value}:prev)},renderResetBtn=key=>(key=>JSON.stringify(null==form2?void 0:form2[key])!==JSON.stringify(def[key]))(key)?jsxRuntimeExports.jsx(Tooltip,{title:t("ui.retryConfig.resetDefault"),children:jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon,{}),onClick:()=>(key=>{setDirty(!0),setForm(prev=>prev?{...prev,[key]:def[key]}:prev)})(key)})}):null;return form2?jsxRuntimeExports.jsxs("div",{className:styles$1_form,children:[jsxRuntimeExports.jsxs("div",{className:styles$1_configGrid,children:[jsxRuntimeExports.jsxs("section",{className:styles$1_configGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$1_groupTitle,children:t("ui.retryConfig.groupStrategy")}),jsxRuntimeExports.jsxs("div",{className:styles$1_row,children:[jsxRuntimeExports.jsxs("span",{className:styles$1_label,children:[t("ui.retryConfig.mode"),renderResetBtn("mode")]}),jsxRuntimeExports.jsxs("div",{className:styles$1_inputCell,children:[jsxRuntimeExports.jsx(Segmented,{value:form2.mode||"off",options:MODE_VALUES.map(v=>({value:v,label:t(`ui.retryConfig.modeLabel.${v}`)})),onChange:v=>patch("mode",v)}),jsxRuntimeExports.jsx("div",{className:styles$1_hint,children:t(`ui.retryConfig.modeHint.${form2.mode||"off"}`)})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$1_row,children:[jsxRuntimeExports.jsxs("span",{className:styles$1_label,children:[t("ui.retryConfig.statusCodes"),renderResetBtn("retryStatusCodes")]}),jsxRuntimeExports.jsxs("div",{className:styles$1_inputCell,children:[jsxRuntimeExports.jsx(Select,{mode:"multiple",className:styles$1_fullWidth,value:form2.retryStatusCodes||[],onChange:v=>patch("retryStatusCodes",v.map(Number).filter(n=>Number.isFinite(n)&&n>0)),options:STATUS_CODE_OPTIONS.map(c=>({label:String(c),value:c}))}),jsxRuntimeExports.jsx("div",{className:styles$1_hint,children:t("ui.retryConfig.statusCodesHint")})]})]})]}),jsxRuntimeExports.jsxs("section",{className:styles$1_configGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$1_groupTitle,children:t("ui.retryConfig.groupExecution")}),NUMERIC_FIELDS.map(f=>jsxRuntimeExports.jsxs("div",{className:styles$1_row,children:[jsxRuntimeExports.jsxs("span",{className:styles$1_label,children:[t(`ui.retryConfig.${f.key}`),renderResetBtn(f.key)]}),jsxRuntimeExports.jsx("div",{className:styles$1_inputCell,children:jsxRuntimeExports.jsxs("div",{className:styles$1_numField,children:[jsxRuntimeExports.jsx(TypedInputNumber,{className:styles$1_numInput,value:form2[f.key],min:f.min,max:f.max,onChange:v=>patch(f.key,v)}),f.unit&&jsxRuntimeExports.jsx("span",{className:styles$1_unit,children:f.unit})]})})]},f.key)),jsxRuntimeExports.jsxs("div",{className:styles$1_row,children:[jsxRuntimeExports.jsxs("span",{className:styles$1_label,children:[t("ui.retryConfig.streamIdleTimeoutMs"),jsxRuntimeExports.jsx(Tooltip,{title:t("ui.retryConfig.streamIdleReserved"),children:jsxRuntimeExports.jsx("span",{className:styles$1_reservedTag,children:t("ui.retryConfig.reserved")})})]}),jsxRuntimeExports.jsx("div",{className:styles$1_inputCell,children:jsxRuntimeExports.jsxs("div",{className:styles$1_numField,children:[jsxRuntimeExports.jsx(TypedInputNumber,{className:styles$1_numInput,value:form2.streamIdleTimeoutMs,disabled:!0}),jsxRuntimeExports.jsx("span",{className:styles$1_unit,children:"ms"})]})})]})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$1_footer,children:[jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon,{}),onClick:()=>{setDirty(!0),setForm({...def})},children:t("ui.retryConfig.resetAll")}),jsxRuntimeExports.jsx("div",{className:styles$1_footerRight,children:jsxRuntimeExports.jsx(Button,{type:"primary",onClick:async()=>{if(form2)if(MODE_VALUES.includes(form2.mode))try{await onSave(form2),staticMethods.success(t("ui.retryConfig.saved")),setDirty(!1)}catch(err){reportSwallowed("retryConfig.save",err)}else staticMethods.warning(t("ui.retryConfig.invalidMode"))},children:t("ui.retryConfig.save")})})]}),jsxRuntimeExports.jsx("div",{className:styles$1_note,children:t("ui.retryConfig.note")})]}):jsxRuntimeExports.jsx("div",{className:styles$1_form,style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"40px 0"},children:jsxRuntimeExports.jsx(Loading,{size:"small"})})}const styles_shell="_shell_1po19_3",styles_toolbar="_toolbar_1po19_5",styles_toolbarTitle="_toolbarTitle_1po19_16",styles_toolbarActions="_toolbarActions_1po19_27",styles_body="_body_1po19_39",styles_configFormWrap="_configFormWrap_1po19_43",styles_configHeader="_configHeader_1po19_44",styles_configHeaderTitle="_configHeaderTitle_1po19_45",styles_configScroll="_configScroll_1po19_35";function ProxyStatsModal({retryConfig:retryConfig,retryDefaults:retryDefaults,onRetryConfigChange:onRetryConfigChange,project:project}){const[tab,setTab]=reactExports.useState("config");return jsxRuntimeExports.jsxs("div",{className:styles_shell,children:[jsxRuntimeExports.jsxs("div",{className:styles_toolbar,children:[jsxRuntimeExports.jsx("h3",{className:styles_toolbarTitle,children:t("ui.proxyStats.title")}),jsxRuntimeExports.jsx("div",{className:styles_toolbarActions,children:jsxRuntimeExports.jsx(Segmented,{size:"small",value:tab,onChange:setTab,options:[{label:t("ui.proxyStats.tabConfig"),value:"config"},{label:t("ui.proxyStats.tabStats"),value:"stats"}]})})]}),jsxRuntimeExports.jsx("div",{className:styles_body,children:"config"===tab?jsxRuntimeExports.jsx("div",{className:styles_configScroll,children:jsxRuntimeExports.jsxs("div",{className:styles_configFormWrap,children:[jsxRuntimeExports.jsxs("div",{className:styles_configHeader,children:[jsxRuntimeExports.jsx("span",{className:styles_configHeaderTitle,children:t("ui.retryConfig.title")}),jsxRuntimeExports.jsx(ConceptHelp,{doc:"RetryConfig",zIndex:1100})]}),jsxRuntimeExports.jsx(RetryConfigForm,{config:retryConfig,defaults:retryDefaults,onSave:async formData=>{await onRetryConfigChange(formData)}})]})}):jsxRuntimeExports.jsx(ProxyStatsDashboard,{project:project})})]})}export{ProxyStatsModal as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as styles_default,c as classRenderer_v3_unified_default,a as classDiagram_default,C as ClassDB}from"./chunk-4TB4RGXK-DzBEAck_.js";import{_ as __name}from"./mermaid.core-O-x0KuTp.js";import"./chunk-FMBD7UC4-sysT0Sy2.js";import"./chunk-YZCP3GAM-D9b_INz7.js";import"./chunk-55IACEB6-9UDvmw07.js";import"./chunk-EDXVE4YY-DHEU2DKg.js";import"./vendor-markdown-DOJHsAxX.js";import"./vendor-mdxeditor-Dah6NK0y.js";import"./vendor-antd-DWLgSkPo.js";import"./vendor-codemirror-CKsm_iG4.js";var diagram={parser:classDiagram_default,get db(){return new ClassDB},renderer:classRenderer_v3_unified_default,styles:styles_default,init:__name(cnf=>{cnf.class||(cnf.class={}),cnf.class.arrowMarkerAbsolute=cnf.arrowMarkerAbsolute},"init")};export{diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as styles_default,c as classRenderer_v3_unified_default,a as classDiagram_default,C as ClassDB}from"./chunk-4TB4RGXK-DzBEAck_.js";import{_ as __name}from"./mermaid.core-O-x0KuTp.js";import"./chunk-FMBD7UC4-sysT0Sy2.js";import"./chunk-YZCP3GAM-D9b_INz7.js";import"./chunk-55IACEB6-9UDvmw07.js";import"./chunk-EDXVE4YY-DHEU2DKg.js";import"./vendor-markdown-DOJHsAxX.js";import"./vendor-mdxeditor-Dah6NK0y.js";import"./vendor-antd-DWLgSkPo.js";import"./vendor-codemirror-CKsm_iG4.js";var diagram={parser:classDiagram_default,get db(){return new ClassDB},renderer:classRenderer_v3_unified_default,styles:styles_default,init:__name(cnf=>{cnf.class||(cnf.class={}),cnf.class.arrowMarkerAbsolute=cnf.arrowMarkerAbsolute},"init")};export{diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as baseClone}from"./graph-BR3YGx52.js";function clone(value){return baseClone(value,4)}export{clone as c};
|