filecat 7.10.2 → 7.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/build/dist/1075.68438aa42e20e5b2d39b.js +1 -0
  2. package/build/dist/1922.77cdb5e5f50b344fcf32.js +2 -0
  3. package/build/dist/1922.77cdb5e5f50b344fcf32.js.LICENSE.txt +23 -0
  4. package/build/dist/259.1c05c3135a8291823002.js +1 -0
  5. package/build/dist/2674.46c009a7ec426b7d8828.js +1 -0
  6. package/build/dist/{3299.de79d172b41af93a8716.js → 3299.5c01eebc0f62cdc7bb39.js} +1 -1
  7. package/build/dist/394.a8337677ef993b923783.js +1 -0
  8. package/build/dist/{4004.f4c06b50348214eb2962.js → 4004.916c0413a6db61a54e11.js} +1 -1
  9. package/build/dist/4903.cac82807407e7342b5ad.js +1 -0
  10. package/build/dist/4935.fe24d47c4075780c9c11.js +1 -0
  11. package/build/dist/5877.e2316c84a95490f77439.js +1 -0
  12. package/build/dist/621.28f07b5c059e80331746.js +1 -0
  13. package/build/dist/{6247.525b0b68872036ac2fa6.js → 6247.6ce123e9fc8b8be16c10.js} +1 -1
  14. package/build/dist/{8302.ce97557b7cf7c8387942.js → 8302.894efa465f6037f9f5a8.js} +1 -1
  15. package/build/dist/892.a62727e6df6e80655ca7.js +1 -0
  16. package/build/dist/9299.4c39ae6b03d41c516b1f.js +1 -0
  17. package/build/dist/9334.f04716a7e41f783abc47.js +1 -0
  18. package/build/dist/index.html +1 -1
  19. package/build/dist/main.65dcea654963fc771a86.js +2 -0
  20. package/build/main.js +1 -1
  21. package/package.json +23 -31
  22. package/build/dist/1075.05eed88707339ca32044.js +0 -1
  23. package/build/dist/259.3c0eb22e9b43ffb63c9c.js +0 -1
  24. package/build/dist/2674.d1bf937289c51ddeceac.js +0 -1
  25. package/build/dist/4903.070aaa53a243baf05133.js +0 -1
  26. package/build/dist/5877.98d0475aaf4058b9a715.js +0 -1
  27. package/build/dist/9299.76095cb6629c36ca3343.js +0 -1
  28. package/build/dist/9334.a25983aafdcbde63ae5e.js +0 -1
  29. package/build/dist/main.26c2c54f6ab534513ebd.js +0 -2
  30. /package/build/dist/{main.26c2c54f6ab534513ebd.js.LICENSE.txt → main.65dcea654963fc771a86.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>a,Lv:()=>s});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function a(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,'\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n\n# ===== 是否支持图片(support_image)=====\n# 开启后:1) 注册 read_image 工具,让 AI 能读取本地图片;\n# 2) 工具读到的图片会以 OpenAI 多模态格式 image_url 随消息发给模型,模型就能真正"看图"。\n# 关闭后:AI 看不到图片,read_image 只会返回一句文字说明。\n# 主流模型(gpt-4o、豆包、qwen-vl、deepseek-vl 等)都支持,默认开启。\nsupport_image=true\n',"cL",0,o])},77481(e,t,n){n.d(t,{S:()=>i,X:()=>r});var s=n(96540),o=n(61443),a=n(74848);function r(e){const[t,n]=s.useState([]),r=(0,s.useRef)(-1),[i,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const p=()=>{r.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let r=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(r=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(r.current=n,l(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=r.current,n=c;p(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:p,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function i(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>$});var s=n(22022),o=n(96540),a=n(85997),r=n(4412),i=n(34843),l=n(82893),c=n(75725),d=n(77481),p=n(61443),m=n(70447),u=n(34299),h=n(74848);var _=n(14284),x=n(53459),g=n(62042),v=n(7523),f=n(78247),j=n(23430),y=n(61973),w=n(14944),C=n(92275),b=n(88815),A=n(64694),k=n(45907),S=n(12721),I=n(24659),N=n(83277);function $(){const{t:e}=(0,s.Bd)(),{initUserInfo:t}=(0,o.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),"model",e("更多属性"),e("备注")],$=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[K,O]=(0,o.useState)([]),[L,M]=(0,o.useState)([]),[P,X]=(0,o.useState)([]),[D,T]=(0,o.useState)(null),H=(0,o.useRef)(),R=(0,o.useRef)(!1),q=(0,o.useRef)(!1),[F,V]=(0,o.useState)([]),[E,Y]=(0,o.useState)(!1),[B,G]=(0,o.useState)({}),[J,W]=(0,i.fp)(l.AG.prompt_card),[z,U]=(0,i.fp)(l.AG.user_base_info),[Z,Q]=(0,o.useState)(!1),ee=P.filter(e=>"http"!==(e.transport??"stdio")),te=P.filter(e=>"http"===e.transport),ne=[e("编号"),e("名称"),e("是否开启"),e("状态"),"command","args","cwd",e("tools|env"),e("备注")],se=[e("编号"),e("名称"),e("是否开启"),e("状态"),e("endpoint"),e("tools|headers"),e("备注")],oe=[e("编号"),e("提示词"),e("LLM编辑开关"),e("llm_pmt"),e("编辑规则"),e("备注")],[ae,re]=(0,o.useState)([]),[ie,le]=(0,o.useState)(!1),ce=function(){const[e,t]=(0,i.fp)(l.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,h.jsx)("div",{children:(0,h.jsx)(u.default,{context:e})})})}}(),{check_user_auth:de}=(0,f.MH)(),[pe,me]=(0,i.fp)(l.AG.editorSetting),ue=(0,y.Zp)(),he=(0,k.y)(),_e=(0,I.K)(),xe=async()=>{const e=await _.jV.get("docs_on_get");e.code===x.m.Success&&Q(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await _.XO.get("ai_agent_setting");e.code===x.m.Success&&O(e.data.models),await w.ws.addMsg(C.HK.ai_load_info,e=>{T(e.context)});const t=await w.ws.sendData(C.HK.ai_load_info,{});t?.context&&T(t.context);const n=await _.XO.get("ai_docs_setting");n.code===x.m.Success&&(H.current=n.data.param,n.data.list?.length&&M(n.data.list));const s=await _.XO.get("ai_mcp_setting");s.code===x.m.Success&&X(s.data.list??[]),await we(),xe();const o=await _.XO.get("ai_system_prompts");o.code===x.m.Success&&re(o.data??[]);const a=await _.XO.get("ai_long_term_memory_setting");a.code===x.m.Success&&le(a.data?.open??!1)})()},[]),(0,o.useEffect)(()=>{w.ws.addMsg(C.HK.mcp_status,e=>{const t=e.context??{},n={};for(const e of t.status??[])n[e.index]={state:e.state,error:e.error,tool_count:e.tool_count};G(n),t.done&&we()})},[]);const ge=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};X([...P,t]),R.current=!0},ve=e=>{const t=P.indexOf(e);t<0||(P.splice(t,1),X([...P]),R.current=!0)},fe=e=>{X([...P,{...e,open:!1}]),R.current=!0},je=async e=>{for(let e=0;e<K.length;e++)K[e].index=e;(await _.XO.post("ai_agent_setting/save",{models:e??K})).code===x.m.Success&&(0,g.SK)("保存成功")},ye=async e=>{for(let e=0;e<P.length;e++)P[e].index=e;(await _.XO.post("ai_mcp_setting/save",{list:e??P})).code===x.m.Success&&((0,g.SK)("保存成功"),R.current=!1,w.ws.sendData(C.HK.mcp_reload,{}))},we=async()=>{const e=await _.XO.get("ai_mcp_tools");return e.code===x.m.Success?(V(e.data??[]),e.data??[]):[]},Ce=async e=>{Y(!0);try{const t=await _.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await we(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{Y(!1)}return null},be=async(t,n,s,o)=>{const a=o??F.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},r=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));W({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,h.jsx)(S.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:r,initialPageId:s,onRefresh:async()=>{const e=await Ce(n);e&&await be(t,n,s,e)},renderPage:t=>{if(!t)return(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,h.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,h.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,h.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,h.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,h.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:"schema:"}),(0,h.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>W({open:!1})})},Ae=t=>{const n=B[t];let s=n?.state,o=n?.error,a=n?.tool_count;if(!s){const e=F.find(e=>e.index===t);s=e?.state,o=e?.error,a=e?.tool_count}switch(s){case"loading":return(0,h.jsx)(m.fq,{loading:!0,text:e("加载中")});case"success":return(0,h.jsx)(m.fq,{success:!0,text:`${a??0} ${e("个工具")}`});case"failed":return(0,h.jsx)("span",{title:o??e("加载失败"),children:(0,h.jsx)(m.fq,{success:!1,text:e("加载失败")})});default:return(0,h.jsx)(m.fq,{text:e("未加载")})}},ke=async e=>{for(let e=0;e<K.length;e++)K[e].index=e;let t={list:L,docs_update_tag:q.current};null!=e&&(t={param:e}),q.current=!1;(await _.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},Se=async()=>{for(let e=0;e<ae.length;e++)ae[e].index=e;(await _.XO.post("ai_system_prompts/save",{list:ae})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,h.jsxs)("div",{children:[(0,h.jsx)(r.aZ,{position:"right",children:de(j.oV.ai_agent_setting)&&(0,h.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{ue(-1)}})}),(0,h.jsx)(c.jW,{isFull:!0,more:!0,children:(0,h.jsx)(c.NN,{children:(0,h.jsxs)(c.xh,{children:[(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:100,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("Model")+" "+e("设置")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...K,{note:"",open:!1,path:"",dotenv:N.CP,json_params:N.cL}])}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await je()}})]}),children:(0,h.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{O((0,A.TI)(K,e,t))},rows:K.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:N.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<K.length;e++)K[e].open=e===n&&t,s.push(K[e]);O(s)})(0,e,n)},options:_e,no_border:!0}),(0,h.jsx)(p.Sm,{type:N.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:N.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,h.jsx)(p.Sm,{value:N.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{f.xK.set_value_temp(K[n].sys_prompt??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{K[n].sys_prompt=e,O(K),f.xK.set_value_temp(""),je(K)}})}}),(0,h.jsx)(a.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{f.xK.set_value_temp(K[n].json_params),me({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{K[n].json_params=e,O(K),f.xK.set_value_temp(""),je(K)},can_format:!0})}}),(0,h.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{f.xK.set_value_temp(K[n].dotenv),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{K[n].dotenv=e,O(K),f.xK.set_value_temp(""),je(K)}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),O([...K])})(n)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{O([...K,{...K[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:70,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>ge("stdio")}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{ye()}})]}),children:(0,h.jsx)(d.X,{headers:ne,onRowDrag:(e,t)=>{X((0,A.TI)(P,P.indexOf(ee[e]),P.indexOf(ee[t]))),R.current=!0},rows:ee.map((t,n)=>{const s=P.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,X([...P]),R.current=!0},options:_e,no_border:!0}),Ae(P.indexOf(t)),(0,h.jsx)(p.Sm,{value:t.command,handleInputChange:e=>{t.command=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.args,handleInputChange:e=>{t.args=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{be(t,s)}}),(0,h.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{f.xK.set_value_temp(t.env??""),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.env=e,X([...P]),f.xK.set_value_temp(""),R.current=!0,ye()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>ve(t)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>fe(t)})]})]}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsxs)(c.VP,{widthPer:70,children:[(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>ge("http")}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{ye()}})]}),children:(0,h.jsx)(d.X,{headers:se,onRowDrag:(e,t)=>{X((0,A.TI)(P,P.indexOf(te[e]),P.indexOf(te[t]))),R.current=!0},rows:te.map((t,n)=>{const s=P.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,X([...P]),R.current=!0},options:_e,no_border:!0}),Ae(P.indexOf(t)),(0,h.jsx)(p.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{be(t,s)}}),(0,h.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{f.xK.set_value_temp(t.headers??""),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.headers=e,X([...P]),f.xK.set_value_temp(""),R.current=!0,ye()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>ve(t)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>fe(t)})]})]}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("系统会话提示词")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{re([...ae,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Se()}})]}),children:(0,h.jsx)(d.X,{headers:oe,onRowDrag:(e,t)=>{re((0,A.TI)(ae,e,t))},rows:ae.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{f.xK.set_value_temp(t.prompt??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,re([...ae]),f.xK.set_value_temp(""),Se()}})}})}),(0,h.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,re([...ae])},title:e("LLM编辑开关")}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"edit_note",title:e("llm_pmt"),onClick:()=>{f.xK.set_value_temp(t.llm_prompt??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,re([...ae]),f.xK.set_value_temp(""),Se()}})}})}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{f.xK.set_value_temp(t.llm_prompt_tip??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,re([...ae]),f.xK.set_value_temp(""),Se()}})}})}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ae.splice(e,1),re([...ae])})(n)})})];return s}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("长期记忆")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),titleCom:(0,h.jsx)("div",{children:(0,h.jsx)(a.Ay,{checked:ie,onChange:async t=>{le(t),await _.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,h.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,h.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const s=await _.XO.get(`ai_long_term_memory_bucket/${t}`),o=s.code===x.m.Success?s.data??"":"";f.xK.set_value_temp(o),me({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async s=>{await _.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:s}),f.xK.set_value_temp(""),(0,g.SK)(`${n} ${e("已保存")}`)}})}},t))})})]})}),(0,h.jsxs)(c.fI,{children:[(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("本地知识库")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.Ay,{checked:Z,onChange:async e=>{await _.jV.post("docs_on_set",{status:e}),xe(),t()},title:e("知识库开关")}),(0,h.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{f.xK.set_value_temp(H.current),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{H.current=e,f.xK.set_value_temp(""),ke(H.current)}})}}),(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...L,{note:"",auto_load:!1,dir:""}]),q.current=!0}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{ke()}})]}),children:(0,h.jsx)(d.X,{headers:$,onRowDrag:(e,t)=>{M((0,A.TI)(L,e,t)),q.current=!0},rows:L.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,q.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,M([...L]),q.current=!0},options:_e,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{L.splice(e,1),M([...L]),q.current=!0})(n)}),(0,h.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{he({sub_title:"手动加载",confirm_fun:()=>{_.jV.post("ai_load_one_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,h.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{he({sub_title:"从索引删除",confirm_fun:()=>{_.jV.post("ai_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),D&&(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsxs)(m.Zp,{title:e("知识库加载信息"),children:[(0,h.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:D?.progress}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:D?.num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:D?.char_num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,b.v7)(D?.size)}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,b.a3)(D?.consume_time_ms_len)}),(0,h.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:D?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>C});var s=n(96540),o=n(23802),a=n(53995),r=n(18569),i=n(77979),l=n(8263),c=n(69428),d=n.n(c),p=(n(3775),n(21499)),m=n(99214),u=n(89117),h=n(86063),_=n(89334),x=n(41105),g=n(52388),v=n(19878),f=(n(72411),n(74848));const j=new o.A({html:!0,highlight:function(e,t){if(t&&v.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${v.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${v.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${j.utils.escapeHtml(e)}</code></pre>`}});async function y(e,t){e.className="md-graph md-graph--mind md-graph--loading",e.textContent=g.A.t("rendering");const n=await(0,h.Hn)(t);e.isConnected&&(e.className="md-graph md-graph--mind",e.textContent="",await n.mount(e))}function w(e){const t=e.className.match(/language-([\w-]+)/);return t?t[1]:""}function C(e){const t=(0,s.useRef)(null);return(0,m.VD)(),(0,s.useEffect)(()=>{t.current&&(t.current.innerHTML=j.render(e.context??""),async function(e){const t=e.querySelectorAll("pre > code[class*='language-']");for(const e of Array.from(t)){const t=w(e),n=(0,u.Hm)(t),s=(0,h.hj)(t);if(!n&&!s)continue;const o=e.closest(".code-block-with-copy")??e.parentElement;if(!o)continue;const a=e.textContent??"",r=document.createElement("div");if(o.replaceWith(r),s){try{await y(r,a)}catch(e){console.error("[mind] render failed",e),r.className="md-graph md-graph--mind",r.textContent=String(e)}continue}r.className="md-graph md-graph--loading",r.textContent=g.A.t("rendering");const i=await(0,u.U6)(t,a);r.isConnected&&(i.error?(r.className="md-graph md-graph--error",r.textContent=i.error):(r.className="md-graph",r.innerHTML=i.svg))}}(t.current),(0,_.rg)(t.current))},[e.context]),(0,f.jsx)("div",{ref:t})}j.use(a.A).use(r.A).use(i.A).use(l.A).use(d()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,s,o,a)=>{const r=t[n],i=r.content.trim(),l=r.info.trim();let c="";if(l&&v.A.getLanguage(l))try{c=v.A.highlight(i,{language:l}).value}catch(t){c=e.utils.escapeHtml(i)}else try{c=v.A.highlightAuto(i).value}catch(t){c=e.utils.escapeHtml(i)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${l||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(i)}">复制</button>\n </div>\n <pre><code class="hljs ${l?`language-${l}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,s,o){return o.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,s,o,a)=>{const r=e[n],i=r.attrIndex("href");if(i>=0){const e=r.attrs[i][1];r.attrs[i][1]=(0,p.bi)(window.location.href,e)}return t(e,n,s,o,a)}}),(0,_.Rh)(j,x.pC)},24659(e,t,n){var s=n(22022);n.d(t,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>a,Lv:()=>s});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function a(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,'\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n\n# ===== 是否支持图片(support_image)=====\n# 开启后:1) 注册 read_image 工具,让 AI 能读取本地图片;\n# 2) 工具读到的图片会以 OpenAI 多模态格式 image_url 随消息发给模型,模型就能真正"看图"。\n# 关闭后:AI 看不到图片,read_image 只会返回一句文字说明。\n# 主流模型(gpt-4o、豆包、qwen-vl、deepseek-vl 等)都支持,默认开启。\nsupport_image=true\n',"cL",0,o])},77481(e,t,n){n.d(t,{S:()=>i,X:()=>r});var s=n(96540),o=n(61443),a=n(74848);function r(e){const[t,n]=s.useState([]),r=(0,s.useRef)(-1),[i,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const p=()=>{r.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let r=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(r=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(r.current=n,l(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=r.current,n=c;p(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:p,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function i(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>$});var s=n(22022),o=n(96540),a=n(85997),r=n(4412),i=n(34843),l=n(82893),c=n(75725),d=n(77481),p=n(61443),m=n(70447),u=n(34299),h=n(74848);var _=n(14284),x=n(53459),g=n(62042),v=n(7523),f=n(78247),j=n(23430),y=n(61973),w=n(14944),C=n(92275),b=n(88815),A=n(64694),k=n(45907),S=n(12721),I=n(24659),N=n(83277);function $(){const{t:e}=(0,s.Bd)(),{initUserInfo:t}=(0,o.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),"model",e("更多属性"),e("备注")],$=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[K,O]=(0,o.useState)([]),[L,M]=(0,o.useState)([]),[P,X]=(0,o.useState)([]),[D,T]=(0,o.useState)(null),H=(0,o.useRef)(),R=(0,o.useRef)(!1),q=(0,o.useRef)(!1),[F,V]=(0,o.useState)([]),[E,Y]=(0,o.useState)(!1),[B,G]=(0,o.useState)({}),[J,W]=(0,i.fp)(l.AG.prompt_card),[z,U]=(0,i.fp)(l.AG.user_base_info),[Z,Q]=(0,o.useState)(!1),ee=P.filter(e=>"http"!==(e.transport??"stdio")),te=P.filter(e=>"http"===e.transport),ne=[e("编号"),e("名称"),e("是否开启"),e("状态"),"command","args","cwd",e("tools|env"),e("备注")],se=[e("编号"),e("名称"),e("是否开启"),e("状态"),e("endpoint"),e("tools|headers"),e("备注")],oe=[e("编号"),e("提示词"),e("LLM编辑开关"),e("llm_pmt"),e("编辑规则"),e("备注")],[ae,re]=(0,o.useState)([]),[ie,le]=(0,o.useState)(!1),ce=function(){const[e,t]=(0,i.fp)(l.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,h.jsx)("div",{children:(0,h.jsx)(u.default,{context:e})})})}}(),{check_user_auth:de}=(0,f.MH)(),[pe,me]=(0,i.fp)(l.AG.editorSetting),ue=(0,y.Zp)(),he=(0,k.y)(),_e=(0,I.K)(),xe=async()=>{const e=await _.jV.get("docs_on_get");e.code===x.m.Success&&Q(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await _.XO.get("ai_agent_setting");e.code===x.m.Success&&O(e.data.models),await w.ws.addMsg(C.HK.ai_load_info,e=>{T(e.context)});const t=await w.ws.sendData(C.HK.ai_load_info,{});t?.context&&T(t.context);const n=await _.XO.get("ai_docs_setting");n.code===x.m.Success&&(H.current=n.data.param,n.data.list?.length&&M(n.data.list));const s=await _.XO.get("ai_mcp_setting");s.code===x.m.Success&&X(s.data.list??[]),await we(),xe();const o=await _.XO.get("ai_system_prompts");o.code===x.m.Success&&re(o.data??[]);const a=await _.XO.get("ai_long_term_memory_setting");a.code===x.m.Success&&le(a.data?.open??!1)})()},[]),(0,o.useEffect)(()=>{w.ws.addMsg(C.HK.mcp_status,e=>{const t=e.context??{},n={};for(const e of t.status??[])n[e.index]={state:e.state,error:e.error,tool_count:e.tool_count};G(n),t.done&&we()})},[]);const ge=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};X([...P,t]),R.current=!0},ve=e=>{const t=P.indexOf(e);t<0||(P.splice(t,1),X([...P]),R.current=!0)},fe=e=>{X([...P,{...e,open:!1}]),R.current=!0},je=async e=>{for(let e=0;e<K.length;e++)K[e].index=e;(await _.XO.post("ai_agent_setting/save",{models:e??K})).code===x.m.Success&&(0,g.SK)("保存成功")},ye=async e=>{for(let e=0;e<P.length;e++)P[e].index=e;(await _.XO.post("ai_mcp_setting/save",{list:e??P})).code===x.m.Success&&((0,g.SK)("保存成功"),R.current=!1,w.ws.sendData(C.HK.mcp_reload,{}))},we=async()=>{const e=await _.XO.get("ai_mcp_tools");return e.code===x.m.Success?(V(e.data??[]),e.data??[]):[]},Ce=async e=>{Y(!0);try{const t=await _.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await we(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{Y(!1)}return null},be=async(t,n,s,o)=>{const a=o??F.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},r=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));W({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,h.jsx)(S.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:r,initialPageId:s,onRefresh:async()=>{const e=await Ce(n);e&&await be(t,n,s,e)},renderPage:t=>{if(!t)return(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,h.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,h.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,h.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,h.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,h.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:"schema:"}),(0,h.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>W({open:!1})})},Ae=t=>{const n=B[t];let s=n?.state,o=n?.error,a=n?.tool_count;if(!s){const e=F.find(e=>e.index===t);s=e?.state,o=e?.error,a=e?.tool_count}switch(s){case"loading":return(0,h.jsx)(m.fq,{loading:!0,text:e("加载中")});case"success":return(0,h.jsx)(m.fq,{success:!0,text:`${a??0} ${e("个工具")}`});case"failed":return(0,h.jsx)("span",{title:o??e("加载失败"),children:(0,h.jsx)(m.fq,{success:!1,text:e("加载失败")})});default:return(0,h.jsx)(m.fq,{text:e("未加载")})}},ke=async e=>{for(let e=0;e<K.length;e++)K[e].index=e;let t={list:L,docs_update_tag:q.current};null!=e&&(t={param:e}),q.current=!1;(await _.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},Se=async()=>{for(let e=0;e<ae.length;e++)ae[e].index=e;(await _.XO.post("ai_system_prompts/save",{list:ae})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,h.jsxs)("div",{children:[(0,h.jsx)(r.aZ,{position:"right",children:de(j.oV.ai_agent_setting)&&(0,h.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{ue(-1)}})}),(0,h.jsx)(c.jW,{isFull:!0,more:!0,children:(0,h.jsx)(c.NN,{children:(0,h.jsxs)(c.xh,{children:[(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:100,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("Model")+" "+e("设置")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...K,{note:"",open:!1,path:"",dotenv:N.CP,json_params:N.cL}])}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await je()}})]}),children:(0,h.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{O((0,A.TI)(K,e,t))},rows:K.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:N.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<K.length;e++)K[e].open=e===n&&t,s.push(K[e]);O(s)})(0,e,n)},options:_e,no_border:!0}),(0,h.jsx)(p.Sm,{type:N.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:N.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,h.jsx)(p.Sm,{value:N.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{f.xK.set_value_temp(K[n].sys_prompt??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{K[n].sys_prompt=e,O(K),f.xK.set_value_temp(""),je(K)}})}}),(0,h.jsx)(a.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{f.xK.set_value_temp(K[n].json_params),me({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{K[n].json_params=e,O(K),f.xK.set_value_temp(""),je(K)},can_format:!0})}}),(0,h.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{f.xK.set_value_temp(K[n].dotenv),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{K[n].dotenv=e,O(K),f.xK.set_value_temp(""),je(K)}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),O([...K])})(n)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{O([...K,{...K[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:70,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>ge("stdio")}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{ye()}})]}),children:(0,h.jsx)(d.X,{headers:ne,onRowDrag:(e,t)=>{X((0,A.TI)(P,P.indexOf(ee[e]),P.indexOf(ee[t]))),R.current=!0},rows:ee.map((t,n)=>{const s=P.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,X([...P]),R.current=!0},options:_e,no_border:!0}),Ae(P.indexOf(t)),(0,h.jsx)(p.Sm,{value:t.command,handleInputChange:e=>{t.command=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.args,handleInputChange:e=>{t.args=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{be(t,s)}}),(0,h.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{f.xK.set_value_temp(t.env??""),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.env=e,X([...P]),f.xK.set_value_temp(""),R.current=!0,ye()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>ve(t)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>fe(t)})]})]}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsxs)(c.VP,{widthPer:70,children:[(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>ge("http")}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{ye()}})]}),children:(0,h.jsx)(d.X,{headers:se,onRowDrag:(e,t)=>{X((0,A.TI)(P,P.indexOf(te[e]),P.indexOf(te[t]))),R.current=!0},rows:te.map((t,n)=>{const s=P.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,R.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,X([...P]),R.current=!0},options:_e,no_border:!0}),Ae(P.indexOf(t)),(0,h.jsx)(p.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{be(t,s)}}),(0,h.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{f.xK.set_value_temp(t.headers??""),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.headers=e,X([...P]),f.xK.set_value_temp(""),R.current=!0,ye()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,R.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>ve(t)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>fe(t)})]})]}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("系统会话提示词")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{re([...ae,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Se()}})]}),children:(0,h.jsx)(d.X,{headers:oe,onRowDrag:(e,t)=>{re((0,A.TI)(ae,e,t))},rows:ae.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{f.xK.set_value_temp(t.prompt??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,re([...ae]),f.xK.set_value_temp(""),Se()}})}})}),(0,h.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,re([...ae])},title:e("LLM编辑开关")}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"edit_note",title:e("llm_pmt"),onClick:()=>{f.xK.set_value_temp(t.llm_prompt??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,re([...ae]),f.xK.set_value_temp(""),Se()}})}})}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{f.xK.set_value_temp(t.llm_prompt_tip??""),me({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,re([...ae]),f.xK.set_value_temp(""),Se()}})}})}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ae.splice(e,1),re([...ae])})(n)})})];return s}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("长期记忆")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),titleCom:(0,h.jsx)("div",{children:(0,h.jsx)(a.Ay,{checked:ie,onChange:async t=>{le(t),await _.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,h.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,h.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const s=await _.XO.get(`ai_long_term_memory_bucket/${t}`),o=s.code===x.m.Success?s.data??"":"";f.xK.set_value_temp(o),me({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async s=>{await _.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:s}),f.xK.set_value_temp(""),(0,g.SK)(`${n} ${e("已保存")}`)}})}},t))})})]})}),(0,h.jsxs)(c.fI,{children:[(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("本地知识库")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{ce("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.Ay,{checked:Z,onChange:async e=>{await _.jV.post("docs_on_set",{status:e}),xe(),t()},title:e("知识库开关")}),(0,h.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{f.xK.set_value_temp(H.current),me({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{H.current=e,f.xK.set_value_temp(""),ke(H.current)}})}}),(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...L,{note:"",auto_load:!1,dir:""}]),q.current=!0}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{ke()}})]}),children:(0,h.jsx)(d.X,{headers:$,onRowDrag:(e,t)=>{M((0,A.TI)(L,e,t)),q.current=!0},rows:L.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,q.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,M([...L]),q.current=!0},options:_e,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{L.splice(e,1),M([...L]),q.current=!0})(n)}),(0,h.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{he({sub_title:"手动加载",confirm_fun:()=>{_.jV.post("docs_load_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,h.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{he({sub_title:"从索引删除",confirm_fun:()=>{_.jV.post("docs_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),D&&(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsxs)(m.Zp,{title:e("知识库加载信息"),children:[(0,h.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:D?.progress}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:D?.num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:D?.char_num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,b.v7)(D?.size)}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,b.a3)(D?.consume_time_ms_len)}),(0,h.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:D?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>C});var s=n(96540),o=n(23802),a=n(53995),r=n(18569),i=n(77979),l=n(8263),c=n(69428),d=n.n(c),p=(n(3775),n(21499)),m=n(99214),u=n(89117),h=n(86063),_=n(89334),x=n(41105),g=n(52388),v=n(19878),f=(n(72411),n(74848));const j=new o.A({html:!0,highlight:function(e,t){if(t&&v.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${v.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${v.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${j.utils.escapeHtml(e)}</code></pre>`}});async function y(e,t){e.className="md-graph md-graph--mind md-graph--loading",e.textContent=g.A.t("rendering");const n=await(0,h.Hn)(t);e.isConnected&&(e.className="md-graph md-graph--mind",e.textContent="",await n.mount(e))}function w(e){const t=e.className.match(/language-([\w-]+)/);return t?t[1]:""}function C(e){const t=(0,s.useRef)(null);return(0,m.VD)(),(0,s.useEffect)(()=>{t.current&&(t.current.innerHTML=j.render(e.context??""),async function(e){const t=e.querySelectorAll("pre > code[class*='language-']");for(const e of Array.from(t)){const t=w(e),n=(0,u.Hm)(t),s=(0,h.hj)(t);if(!n&&!s)continue;const o=e.closest(".code-block-with-copy")??e.parentElement;if(!o)continue;const a=e.textContent??"",r=document.createElement("div");if(o.replaceWith(r),s){try{await y(r,a)}catch(e){console.error("[mind] render failed",e),r.className="md-graph md-graph--mind",r.textContent=String(e)}continue}r.className="md-graph md-graph--loading",r.textContent=g.A.t("rendering");const i=await(0,u.U6)(t,a);r.isConnected&&(i.error?(r.className="md-graph md-graph--error",r.textContent=i.error):(r.className="md-graph",r.innerHTML=i.svg))}}(t.current),(0,_.rg)(t.current))},[e.context]),(0,f.jsx)("div",{ref:t})}j.use(a.A).use(r.A).use(i.A).use(l.A).use(d()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,s,o,a)=>{const r=t[n],i=r.content.trim(),l=r.info.trim();let c="";if(l&&v.A.getLanguage(l))try{c=v.A.highlight(i,{language:l}).value}catch(t){c=e.utils.escapeHtml(i)}else try{c=v.A.highlightAuto(i).value}catch(t){c=e.utils.escapeHtml(i)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${l||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(i)}">复制</button>\n </div>\n <pre><code class="hljs ${l?`language-${l}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,s,o){return o.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,s,o,a)=>{const r=e[n],i=r.attrIndex("href");if(i>=0){const e=r.attrs[i][1];r.attrs[i][1]=(0,p.bi)(window.location.href,e)}return t(e,n,s,o,a)}}),(0,_.Rh)(j,x.pC)},24659(e,t,n){var s=n(22022);n.d(t,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[892],{20892(e,t,n){n.r(t),n.d(t,{default:()=>m});var s=n(96540),i=n(57889),l=n(62042),a=n(22022),r=n(93392),c=n(74848);const o=36,d=4.8;function u(e){return`timeline-node--${e}`}function m(e){const{t}=(0,a.Bd)(),[n,d]=(0,s.useState)(()=>(0,r.bw)()),[u,m]=(0,s.useState)(!0),[p,_]=(0,s.useState)(""),[v,x]=(0,s.useState)(1),[b,g]=(0,s.useState)({}),f=(0,s.useCallback)((e,t)=>{g(n=>n[e]===t?n:{...n,[e]:t})},[]),[j,y]=(0,s.useState)({}),N=(0,s.useCallback)((e,t)=>{y(n=>n[e]===t?n:{...n,[e]:t})},[]),[w,k]=(0,s.useState)(!1),[C,E]=(0,s.useState)(null),[L,R]=(0,s.useState)("event"),$=(0,s.useRef)(null),T=(0,s.useRef)(null),S=(0,s.useRef)(!1),z=(0,s.useRef)({props:e});z.current={props:e};const P=(0,s.useRef)([]),U=(0,s.useRef)([]),[D,O]=(0,s.useState)(0),M=(0,s.useRef)(null),[B,Y]=(0,s.useState)(null),[I,X]=(0,s.useState)(null),F=(0,s.useRef)(n);F.current=n;const A=(0,s.useRef)(v);A.current=v;const K="vertical"===n.layout.direction,q=(0,s.useRef)(w);q.current=w;const G=e=>{e&&!q.current||S.current!==e&&(S.current=e,z.current.props.on_dirty?.(e))},J=(0,s.useCallback)(e=>{P.current[P.current.length-1]!==e&&(P.current.push(e),P.current.length>100&&P.current.shift()),U.current=[],O(e=>e+1)},[]),W=(0,s.useCallback)(e=>{q.current&&(J((0,r.vE)(F.current)),F.current=e,d(e),G(!0))},[J,G]),Z=e=>{q.current?W(e):(F.current=e,d(e))},H=(0,s.useCallback)(()=>{if(!q.current)return;const e=P.current.pop();null!=e&&(U.current.push((0,r.vE)(F.current)),d((0,r.Tz)(JSON.parse(e))),E(null),G(!0),O(e=>e+1))},[]),V=(0,s.useCallback)(()=>{if(!q.current)return;const e=U.current.pop();null!=e&&(P.current.push((0,r.vE)(F.current)),d((0,r.Tz)(JSON.parse(e))),E(null),G(!0),O(e=>e+1))},[]),Q=async()=>{if(!q.current)return!1;const e=await z.current.props.on_save((0,r.vE)(F.current));return e&&G(!1),e};(0,s.useEffect)(()=>{e.register?.({save:Q,is_dirty:()=>S.current,is_edit_mode:()=>w})},[e.register,w]),(0,s.useEffect)(()=>{z.current.props.on_edit_mode_change?.(w)},[w]),(0,s.useEffect)(()=>{if(e.doc)return d(e.doc),x(1),m(!1),void _("");if(!e.url)return;let n=!1;return m(!0),_(""),P.current=[],U.current=[],O(e=>e+1),E(null),G(!1),(async()=>{try{const t=await i.l.get(e.url);if(n)return;const s=(0,r.dO)(t)??(0,r.bw)();d(s),x((0,r.$4)(s.layout.zoom??1,.3,3,1)),window.setTimeout(()=>{const e=T.current;e&&(e.scrollLeft=(s.layout.scroll_x??0)*(s.layout.zoom??1),e.scrollTop=(s.layout.scroll_y??0)*(s.layout.zoom??1))},60)}catch{if(n)return;_(t("加载时间线失败")),(0,l.zN)(t("加载时间线失败"))}finally{n||m(!1)}})(),()=>{n=!0}},[e.url,e.doc]);const ee=e=>{return Math.max(o,(t=e.id,b[t]??o))+10;var t},te=e=>e.collapsed?ee(e):o+(e=>{const t="vertical"===n.layout.direction?96:240,s={left:0,right:0};return e.events.forEach((e,i)=>{const l=n.layout.alternate?i%2==0?"left":"right":e.side;s[l]+=(j[e.id]??t)+12}),Math.max(s.left,s.right)})(e),ne=(0,s.useMemo)(()=>{const e=[];let t=0;for(const s of n.phases)e.push(t),t+=s.collapsed?Math.max(o,b[s.id]??o)+10:te(s);return e},[n.phases,b,j]);(0,s.useEffect)(()=>{const e=e=>{const t=M.current,n=$.current;if(!t||!n)return;const s=n.getBoundingClientRect(),i=A.current,l=("vertical"===F.current.layout.direction?e.clientY-s.top:e.clientX-s.left)/i,a=F.current.phases;let r=a.length-1;for(let e=0;e<a.length;e++){if(l<=ne[e]+te(a[e])){r=e;break}}const c=r<=t.from?ne[r]:ne[r]+te(a[r]);X(c),r!==t.from&&(((e,t)=>{const n=[...F.current.phases];if(e<0||e>=n.length||t<0||t>=n.length||e===t)return;const[s]=n.splice(e,1);n.splice(t,0,s);const i={...F.current,phases:n};F.current=i,d(i)})(t.from,r),t.from=r)},t=()=>{const e=M.current;e&&(M.current=null,document.body.classList.remove("timeline-phase-dragging"),Y(null),X(null),null!=e.snapshot&&e.snapshot!==(0,r.vE)(F.current)&&(J(e.snapshot),G(!0)))};return document.addEventListener("pointermove",e),document.addEventListener("pointerup",t),document.addEventListener("pointercancel",t),()=>{document.removeEventListener("pointermove",e),document.removeEventListener("pointerup",t),document.removeEventListener("pointercancel",t)}},[ne,J]);const se=(e,t,s)=>{if(!q.current)return;if(0!==e.button)return;e.target.closest("input, textarea, button, select, [data-event-width], [data-event-link]")||(e.stopPropagation(),R("event"),E(n.phases[t].events[s].id))},ie=(e,t)=>{if(!q.current)return;const n=F.current.phases[t];if(!n)return;const s="vertical"===F.current.layout.direction,i=A.current;let l=n.head_width??0;if(!l){const t=e.currentTarget.closest(".timeline-phase__head");t&&(l=t.getBoundingClientRect().width/i)}const a=s?e.clientX:e.clientY,c=n.id,o=(0,r.vE)(F.current),u=e=>{let t=((s?e.clientX:e.clientY)-a)/i;s&&(t=-t);const n=Math.round((0,r.$4)(l+t,80,1200,l)),o={...F.current,phases:F.current.phases.map(e=>e.id===c?{...e,head_width:n}:e)};F.current=o,d(o)},m=()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",m),o!==(0,r.vE)(F.current)&&(J(o),G(!0))};document.addEventListener("pointermove",u),document.addEventListener("pointerup",m)},le=(e,t,n,s)=>{if(!q.current)return;const i=F.current.phases[t]?.events[n];if(!i)return;const l="vertical"===F.current.layout.direction,a=A.current;let c=i.width??0;if(!c){const t=e.currentTarget.closest(".timeline-event");t&&(c=t.getBoundingClientRect().width/a)}const o=l?e.clientX:e.clientY,u=i.id,m=(0,r.vE)(F.current),h=e=>{let t=((l?e.clientX:e.clientY)-o)/a;"left"===s&&(t=-t);const n=Math.round((0,r.$4)(c+t,80,1200,c)),i={...F.current,phases:F.current.phases.map(e=>({...e,events:e.events.map(e=>e.id===u?{...e,width:n}:e)}))};F.current=i,d(i)},p=()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",p),m!==(0,r.vE)(F.current)&&(J(m),G(!0))};document.addEventListener("pointermove",h),document.addEventListener("pointerup",p)},ae=(e,t,n,s)=>{if(!q.current)return;const i=F.current.phases[t]?.events[n];if(!i)return;const l="vertical"===F.current.layout.direction,a=A.current,c=i.link_length??42,o=l?e.clientX:e.clientY,u=i.id,m=(0,r.vE)(F.current),h=e=>{let t=((l?e.clientX:e.clientY)-o)/a;"left"===s&&(t=-t);const n=(0,r.$4)(c+t,8,800,c),i={...F.current,phases:F.current.phases.map(e=>({...e,events:e.events.map(e=>e.id===u?{...e,link_length:n}:e)}))};F.current=i,d(i)},p=()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",p),m!==(0,r.vE)(F.current)&&(J(m),G(!0))};document.addEventListener("pointermove",h),document.addEventListener("pointerup",p)};(0,s.useEffect)(()=>{const e=T.current;if(!e)return;const t=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=e.deltaY>0?-.1:.1;x(e=>(0,r.$4)(Number((e+t).toFixed(2)),.3,3,1))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);const re=e=>{W({...F.current,layout:{...F.current.layout,...e}})},ce=e=>{const t=(0,r.$4)(Number(e.toFixed(2)),.3,3,1);x(t),q.current&&re({zoom:t})},oe=(e,t)=>{W({...F.current,phases:F.current.phases.map(n=>({...n,events:n.events.map(n=>n.id===e?{...n,...t}:n)}))})},de=(e,t)=>{Z({...F.current,phases:F.current.phases.map(n=>n.id===e?{...n,...t}:n)})},ue=(e,t)=>{const n=F.current.phases,s=n.findIndex(t=>t.id===e);if(s<0)return;const i="before"===t?s:s+1,l=[...n];l.splice(i,0,(0,r.vT)(i)),Z({...F.current,phases:l})},me=(e,t)=>{const n=[...F.current.phases],s=n.findIndex(t=>t.id===e),i=s+t;s<0||i<0||i>=n.length||([n[s],n[i]]=[n[i],n[s]],W({...F.current,phases:n}))},he=(e,t)=>{W({...F.current,phases:F.current.phases.map(n=>{const s=n.events.findIndex(t=>t.id===e),i=s+t;if(s<0||i<0||i>=n.events.length)return n;const l=[...n.events];return[l[s],l[i]]=[l[i],l[s]],{...n,events:l}})})},pe=e=>{q.current&&(M.current={from:e,snapshot:(0,r.vE)(F.current)},Y(F.current.phases[e]?.id??null),document.body.classList.add("timeline-phase-dragging"))},_e=e=>{const t=F.current.phases.find(t=>t.id===e);if(!t)return;const n=t.events.filter(e=>"left"===e.side).length,s=n<=t.events.length-n?"left":"right",i=(0,r.IG)(s,.5),l=F.current.phases.map(t=>t.id===e?{...t,events:[...t.events,i]}:t);W({...F.current,phases:l}),R("event"),E(i.id)},ve=e=>{W({...F.current,phases:F.current.phases.map(t=>({...t,events:t.events.filter(t=>t.id!==e)}))}),E(t=>t===e?null:t)},xe=e=>{R("phase"),E(e)},be=e=>{W({...F.current,phases:F.current.phases.filter(t=>t.id!==e)}),E(t=>t===e?null:t)},ge=()=>{const e=z.current.props.url??"";let t=e;const n=e.indexOf("?");if(n>=0){t=new URLSearchParams(e.slice(n+1)).get("file")||""}t||(t=e.split("?")[0]);let s=t.split("/").filter(Boolean).pop()??"";for(let e=0;e<2;e++)try{const e=decodeURIComponent(s);if(e===s)break;s=e}catch{break}return s.replace(/\.timeline$/,"")||"timeline"};(0,s.useEffect)(()=>{const e=$.current,t=T.current;if(!e||!t||"vertical"!==n.layout.direction)return;e.style.setProperty("--side-scroll","0px");const s=t.clientWidth/2,i=t.getBoundingClientRect().left+s;let l=0;e.querySelectorAll(".timeline-event").forEach(e=>{const t=e.getBoundingClientRect();l=Math.max(l,i-t.left,t.right-i)}),e.style.setProperty("--side-scroll",`${Math.max(120,Math.ceil(l)+40)}px`)},[n.phases,n.layout.direction,n.layout.card_style,n.layout.node_style,v]);const fe=(0,s.useRef)(0);(0,s.useEffect)(()=>{const e=e=>{const t=e.target;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))return;const n=e.ctrlKey||e.metaKey;return!n||"s"!==e.key&&"S"!==e.key?!n||"z"!==e.key&&"Z"!==e.key?!n||"y"!==e.key&&"Y"!==e.key?void(("Delete"===e.key||"Backspace"===e.key)&&C&&"event"===L&&q.current&&(e.preventDefault(),ve(C))):(e.preventDefault(),e.stopPropagation(),void V()):(e.preventDefault(),e.stopPropagation(),void(e.shiftKey?V():H())):(e.preventDefault(),e.stopPropagation(),void Q())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[C,L]);const je="event"===L&&C?(e=>{for(const t of n.phases){const n=t.events.find(t=>t.id===e);if(n)return{event:n,phase:t}}return null})(C):null,ye="phase"===L&&C?n.phases.find(e=>e.id===C)??null:null,Ne=n.layout,we=n.phases.length>0&&n.phases.every(e=>e.collapsed);return(0,c.jsxs)("div",{className:`timeline-wrap${e.fullscreen?" timeline-wrap--full":""}${e.readonly?" timeline-wrap--readonly":""}`,children:[e.header,!e.readonly&&(0,c.jsxs)("div",{className:"timeline-toolbar",children:[(0,c.jsx)("button",{type:"button",className:"timeline-btn"+(w?" timeline-btn--on":""),title:t(w?"退出编辑模式":"进入编辑模式"),onClick:()=>k(e=>!e),children:(0,c.jsx)("span",{className:"material-icons",children:w?"edit":"visibility"})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t(we?"展开全部阶段":"折叠全部阶段"),onClick:()=>{const e=F.current.phases.some(e=>!e.collapsed);Z({...F.current,phases:F.current.phases.map(t=>({...t,collapsed:e}))})},children:(0,c.jsx)("span",{className:"material-icons",children:we?"unfold_more":"unfold_less"})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("阶段倒置"),onClick:()=>{const e=[...F.current.phases].reverse();Z({...F.current,phases:e})},children:(0,c.jsx)("span",{className:"material-icons",children:"swap_vert"})}),w&&(0,c.jsx)(c.Fragment,{children:(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("添加阶段"),onClick:()=>{const e=F.current.phases.length;W({...F.current,phases:[...F.current.phases,(0,r.vT)(e)]})},children:(0,c.jsx)("span",{className:"material-icons",children:"add_box"})})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("导出 SVG"),onClick:()=>{const e=(0,r.Ao)(F.current),t=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=ge()+".svg",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)},children:(0,c.jsx)("span",{className:"material-icons",children:"download"})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("导出图片"),onClick:()=>{const e=(0,r.Ao)(F.current),n=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),s=URL.createObjectURL(n),i=new Image;i.onload=()=>{const e=document.createElement("canvas");e.width=2*i.width||1200,e.height=2*i.height||800;const t=e.getContext("2d");t&&(t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.drawImage(i,0,0,e.width,e.height),e.toBlob(e=>{if(!e)return;const t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=ge()+".png",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},"image/png")),URL.revokeObjectURL(s)},i.onerror=()=>{(0,l.zN)(t("导出图片失败")),URL.revokeObjectURL(s)},i.src=s},children:(0,c.jsx)("span",{className:"material-icons",children:"image"})}),w&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"timeline-toolbar__divider"}),(0,c.jsxs)("div",{className:"timeline-seg",children:[(0,c.jsx)("button",{type:"button",className:"timeline-seg__btn"+(K?" timeline-seg__btn--on":""),title:t("纵向"),onClick:()=>{K||re({direction:"vertical"})},children:(0,c.jsx)("span",{className:"material-icons",children:"swap_vert"})}),(0,c.jsx)("button",{type:"button",className:"timeline-seg__btn"+(K?"":" timeline-seg__btn--on"),title:t("横向"),onClick:()=>{K&&re({direction:"horizontal"})},children:(0,c.jsx)("span",{className:"material-icons",children:"swap_horiz"})})]}),(0,c.jsxs)("label",{className:"timeline-toolbar__select",title:t("节点样式"),children:[(0,c.jsx)("span",{className:"material-icons",children:"radio_button_checked"}),(0,c.jsxs)("select",{value:Ne.node_style,onChange:e=>re({node_style:e.target.value}),children:[(0,c.jsx)("option",{value:"dot",children:t("圆点")}),(0,c.jsx)("option",{value:"circle",children:t("圆形")}),(0,c.jsx)("option",{value:"square",children:t("方形")}),(0,c.jsx)("option",{value:"image",children:t("图片")})]})]}),(0,c.jsxs)("label",{className:"timeline-toolbar__select",title:t("卡片样式"),children:[(0,c.jsx)("span",{className:"material-icons",children:"crop_square"}),(0,c.jsxs)("select",{value:Ne.card_style,onChange:e=>re({card_style:e.target.value}),children:[(0,c.jsx)("option",{value:"card",children:t("卡片")}),(0,c.jsx)("option",{value:"plain",children:t("朴素")}),(0,c.jsx)("option",{value:"bubble",children:t("气泡")})]})]}),(0,c.jsxs)("label",{className:"timeline-toolbar__select",title:t("连线风格"),children:[(0,c.jsx)("span",{className:"material-icons",children:"linear_scale"}),(0,c.jsxs)("select",{value:Ne.line_style,onChange:e=>re({line_style:e.target.value}),children:[(0,c.jsx)("option",{value:"solid",children:t("实线")}),(0,c.jsx)("option",{value:"dashed",children:t("虚线")}),(0,c.jsx)("option",{value:"dotted",children:t("点线")})]})]}),(0,c.jsx)("button",{type:"button",className:"timeline-btn"+(Ne.show_connector?" timeline-btn--on":""),title:t("显示连线"),onClick:()=>re({show_connector:!Ne.show_connector}),children:(0,c.jsx)("span",{className:"material-icons",children:"timeline"})})]}),(0,c.jsx)("span",{className:"timeline-toolbar__gap"}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("撤销")+" (Ctrl+Z)","data-tick":D,disabled:0===P.current.length,onClick:H,children:(0,c.jsx)("span",{className:"material-icons",children:"undo"})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("重做")+" (Ctrl+Y)",disabled:0===U.current.length,onClick:V,children:(0,c.jsx)("span",{className:"material-icons",children:"redo"})}),(0,c.jsxs)("span",{className:"timeline-toolbar__zoom",children:[Math.round(100*v),"%"]}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("缩小"),onClick:()=>ce(v-.1),children:(0,c.jsx)("span",{className:"material-icons",children:"remove"})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("放大"),onClick:()=>ce(v+.1),children:(0,c.jsx)("span",{className:"material-icons",children:"add"})}),(0,c.jsx)("button",{type:"button",className:"timeline-btn",title:t("重置缩放"),onClick:()=>ce(1),children:(0,c.jsx)("span",{className:"material-icons",children:"restart_alt"})})]}),(0,c.jsxs)("div",{className:"timeline-body",children:[(0,c.jsx)("div",{className:`timeline-canvas timeline-canvas--${Ne.direction}`,ref:T,onScroll:()=>{q.current&&(window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{const e=T.current;if(!e)return;const t=Math.round(e.scrollLeft/A.current),n=Math.round(e.scrollTop/A.current),s=F.current.layout;if(s.scroll_x===t&&s.scroll_y===n)return;const i={...F.current,layout:{...s,scroll_x:t,scroll_y:n}};F.current=i,d(i),G(!0)},250))},children:(0,c.jsxs)("div",{className:"timeline-inner",ref:$,style:{"--zoom":v},children:[null!==I&&(0,c.jsx)("div",{className:"timeline-drop",style:K?{top:`${I}px`}:{left:`${I}px`}}),n.phases.map((e,n)=>(0,c.jsx)(h,{phase:e,phase_index:n,layout:Ne,zoom:v,vertical:K,selected_id:C,on_event_down:se,on_width_down:le,on_link_down:ae,on_add_event:_e,on_delete_event:ve,on_update_phase:de,on_delete_phase:be,on_select_phase:xe,head_height:b[e.id],on_head_height:f,on_phase_width_down:ie,event_heights:j,on_event_height:N,edit_mode:w,on_phase_drag_start:pe,drag_phase_id:B,t},e.id))]})}),w&&!e.readonly&&ye&&(0,c.jsxs)("div",{className:"timeline-panel",children:[(0,c.jsxs)("div",{className:"timeline-panel__title",children:[(0,c.jsx)("span",{className:"material-icons",children:"layers"}),(0,c.jsx)("span",{children:t("阶段")}),(0,c.jsx)("span",{className:"material-icons timeline-panel__close",title:t("关闭"),onClick:()=>E(null),children:"close"})]}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("名称")}),(0,c.jsx)("textarea",{className:"timeline-panel__textarea",readOnly:!w,value:ye.name,onChange:e=>de(ye.id,{name:e.target.value})}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("描述")}),(0,c.jsx)("textarea",{className:"timeline-panel__textarea",readOnly:!w,value:ye.desc??"",onChange:e=>de(ye.id,{desc:e.target.value})}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("颜色")}),(0,c.jsxs)("div",{className:"timeline-panel__colors",children:[r.Tw.map(e=>(0,c.jsx)("span",{className:"timeline-swatch",style:{background:e},onClick:()=>de(ye.id,{color:e})},e)),(0,c.jsx)("label",{className:"timeline-swatch timeline-swatch--pick",title:t("自定义颜色"),children:(0,c.jsx)("input",{type:"color",value:ye.color||Ne.axis_color,onChange:e=>de(ye.id,{color:e.target.value})})})]}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("阶段头")}),(0,c.jsxs)("div",{className:"timeline-panel__seg",children:[(0,c.jsx)("button",{type:"button",className:"timeline-seg__btn"+(!1!==ye.head_visible?" timeline-seg__btn--on":""),onClick:()=>de(ye.id,{head_visible:!0}),children:t("显示")}),(0,c.jsx)("button",{type:"button",className:"timeline-seg__btn"+(!1===ye.head_visible?" timeline-seg__btn--on":""),onClick:()=>de(ye.id,{head_visible:!1}),children:t("隐藏")})]}),(0,c.jsx)("div",{className:"timeline-panel__hint",children:t("拖动阶段头可调整顺序")}),(0,c.jsxs)("div",{className:"timeline-panel__insert",children:[(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>ue(ye.id,"before"),children:[(0,c.jsx)("span",{className:"material-icons",children:"vertical_align_top"}),t("在阶段前插入")]}),(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>ue(ye.id,"after"),children:[(0,c.jsx)("span",{className:"material-icons",children:"vertical_align_bottom"}),t("在阶段后插入")]})]}),(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>_e(ye.id),children:[(0,c.jsx)("span",{className:"material-icons",children:"add_circle"}),t("添加事件")]}),(0,c.jsxs)("div",{className:"timeline-panel__insert",children:[(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>me(ye.id,-1),children:[(0,c.jsx)("span",{className:"material-icons",children:"arrow_upward"}),t("上移")]}),(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>me(ye.id,1),children:[(0,c.jsx)("span",{className:"material-icons",children:"arrow_downward"}),t("下移")]})]}),(0,c.jsxs)("button",{type:"button",className:"timeline-panel__del",onClick:()=>be(ye.id),children:[(0,c.jsx)("span",{className:"material-icons",children:"delete"}),t("删除阶段")]})]}),w&&!e.readonly&&je&&(0,c.jsxs)("div",{className:"timeline-panel",children:[(0,c.jsxs)("div",{className:"timeline-panel__title",children:[(0,c.jsx)("span",{className:"material-icons",children:"edit"}),(0,c.jsx)("span",{children:t("事件")}),(0,c.jsx)("span",{className:"material-icons timeline-panel__close",title:t("关闭"),onClick:()=>E(null),children:"close"})]}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("标题")}),(0,c.jsx)("input",{className:"timeline-panel__input",value:je.event.title,onChange:e=>oe(je.event.id,{title:e.target.value})}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("描述")}),(0,c.jsx)("textarea",{className:"timeline-panel__textarea",readOnly:!w,value:je.event.desc??"",onChange:e=>oe(je.event.id,{desc:e.target.value})}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("时间")}),(0,c.jsxs)("div",{className:"timeline-panel__times",children:[(0,c.jsx)("input",{className:"timeline-panel__input",value:je.event.startTime??"",placeholder:t("起始时间"),onChange:e=>oe(je.event.id,{startTime:e.target.value})}),(0,c.jsx)("input",{className:"timeline-panel__input",value:je.event.endTime??"",placeholder:t("结束时间"),onChange:e=>oe(je.event.id,{endTime:e.target.value})})]}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("图片地址")}),(0,c.jsx)("input",{className:"timeline-panel__input",value:je.event.image??"",placeholder:"https://...",onChange:e=>oe(je.event.id,{image:e.target.value})}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("方向")}),(0,c.jsxs)("div",{className:"timeline-panel__seg",children:[(0,c.jsx)("button",{type:"button",className:"timeline-seg__btn"+("left"===je.event.side?" timeline-seg__btn--on":""),onClick:()=>oe(je.event.id,{side:"left"}),children:t(K?"左侧":"上侧")}),(0,c.jsx)("button",{type:"button",className:"timeline-seg__btn"+("right"===je.event.side?" timeline-seg__btn--on":""),onClick:()=>oe(je.event.id,{side:"right"}),children:t(K?"右侧":"下侧")})]}),(0,c.jsx)("label",{className:"timeline-panel__label",children:t("颜色")}),(0,c.jsxs)("div",{className:"timeline-panel__colors",children:[(0,c.jsx)("span",{className:"timeline-swatch timeline-swatch--auto",title:t("跟随阶段"),onClick:()=>oe(je.event.id,{color:""})}),r.Tw.map(e=>(0,c.jsx)("span",{className:"timeline-swatch",style:{background:e},onClick:()=>oe(je.event.id,{color:e})},e)),(0,c.jsx)("label",{className:"timeline-swatch timeline-swatch--pick",title:t("自定义颜色"),children:(0,c.jsx)("input",{type:"color",value:je.event.color||ye?.color||Ne.axis_color,onChange:e=>oe(je.event.id,{color:e.target.value})})})]}),(0,c.jsx)("div",{className:"timeline-panel__hint",children:t("用上移下移调整事件顺序,用左右切换事件所在侧")}),(0,c.jsxs)("div",{className:"timeline-panel__insert",children:[(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>he(je.event.id,-1),children:[(0,c.jsx)("span",{className:"material-icons",children:"arrow_upward"}),t("上移")]}),(0,c.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>he(je.event.id,1),children:[(0,c.jsx)("span",{className:"material-icons",children:"arrow_downward"}),t("下移")]})]}),(0,c.jsxs)("button",{type:"button",className:"timeline-panel__del",onClick:()=>ve(je.event.id),children:[(0,c.jsx)("span",{className:"material-icons",children:"delete"}),t("删除事件")]})]})]}),u&&(0,c.jsx)("div",{className:"timeline-mask",children:"Loading..."}),p&&(0,c.jsx)("div",{className:"timeline-mask",children:p})]})}function h(e){const{phase:t,layout:n,zoom:i,vertical:l,selected_id:a,t:r}=e,u=t.color||n.axis_color,m=!!t.collapsed,h=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{const n=h.current;if(!n||!1===t.head_visible)return;const s=()=>e.on_head_height(t.id,n.offsetHeight);s();const i=new ResizeObserver(s);return i.observe(n),()=>i.disconnect()},[t.id,t.name,t.desc,t.head_visible]);const _=e.head_height??o,v=(()=>{const s=l?96:240,i={left:0,right:0};return t.events.forEach((t,l)=>{const a=n.alternate?l%2==0?"left":"right":t.side;i[a]+=(e.event_heights[t.id]??s)+12}),d+_+6+Math.max(i.left,i.right)})(),x=m?Math.max(o,d+_+6)+10:v,b="solid"===n.line_style?{background:u}:{borderColor:u,borderStyle:(g=n.line_style,"dashed"===g?"dashed":"dotted"===g?"dotted":"solid")};var g;return(0,c.jsxs)("div",{className:`timeline-phase${m?" timeline-phase--collapsed":""}${e.drag_phase_id===t.id?" timeline-phase--dragging":""}`,style:l?{height:`${x}px`}:{width:`${x}px`},children:[(0,c.jsx)("div",{className:"timeline-phase__band",style:b}),!1!==t.head_visible&&(0,c.jsxs)("div",{className:"timeline-phase__head",ref:h,style:{borderColor:u,...t.head_width?{width:t.head_width,maxWidth:"none"}:{}},onPointerDown:n=>{const s=n.target;s.closest(".timeline-phase__op")||s.closest(".timeline-phase__drag")||s.closest(".timeline-phase__toggle")||e.on_select_phase(t.id)},children:[(0,c.jsx)("span",{className:"material-icons timeline-phase__drag",title:r("拖动排序"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_phase_drag_start(e.phase_index)},children:"drag_indicator"}),(0,c.jsx)("span",{className:"material-icons timeline-phase__toggle",title:r(m?"展开":"折叠"),onClick:()=>e.on_update_phase(t.id,{collapsed:!m}),children:m?"expand_more":"expand_less"}),(0,c.jsx)("div",{className:"timeline-phase__name",style:{color:u},title:t.name,children:t.name}),t.desc&&(0,c.jsx)("div",{className:"timeline-phase__desc",title:t.desc,children:t.desc}),(0,c.jsx)("div",{className:"timeline-phase__width","data-phase-width":t.id,title:r("拖动调整宽度"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_phase_width_down(t,e.phase_index)}})]}),!m&&(0,c.jsxs)(c.Fragment,{children:[!1===t.head_visible&&(0,c.jsx)("span",{className:"material-icons timeline-phase__show-head",title:r("显示阶段头"),onClick:()=>e.on_update_phase(t.id,{head_visible:!0}),children:"visibility"}),(()=>{const o=e=>n.alternate?e%2==0?"left":"right":t.events[e].side,u=l?96:240,m=t=>e.event_heights[t]??u,h={left:0,right:0},v=t.events.map((e,t)=>{const n=o(t),s=h[n];return h[n]=s+m(e.id)+12,s});return t.events.map((u,h)=>{const x=o(h),b=d+_+6+v[h]+m(u.id)/2,g=n.node_style;return(0,c.jsxs)(s.Fragment,{children:[u.startTime&&(0,c.jsx)("div",{className:`timeline-event__time timeline-event__time--start timeline-event--node-${g}`,style:l?{top:b}:{left:b},children:u.startTime}),u.endTime&&(0,c.jsx)("div",{className:`timeline-event__time timeline-event__time--end timeline-event--node-${g}`,style:l?{top:b}:{left:b},children:u.endTime}),(0,c.jsx)(p,{event:u,phase:t,layout:n,vertical:l,zoom:i,side:x,along:v[h],head_size:_,on_height:t=>e.on_event_height(u.id,t),event_index:h,phase_index:e.phase_index,selected:a===u.id,on_down:e.on_event_down,on_width_down:e.on_width_down,on_link_down:e.on_link_down,on_delete:e.on_delete_event,t:r})]},u.id)})})()]})]})}function p(e){const{event:t,phase:n,layout:i,vertical:l,zoom:a,side:r,selected:m,t:h}=e,p=t.color||n.color||i.axis_color,_=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{const t=_.current;if(!t||!e.on_height)return;const n="vertical"===i.direction,s=()=>{const s=t.getBoundingClientRect(),i=Math.round((n?s.height:s.width)/a);i>0&&e.on_height(i)};s();const l=new ResizeObserver(s);l.observe(t);const r=window.setTimeout(s,300);return()=>{l.disconnect(),window.clearTimeout(r)}},[t.title,t.desc,t.image,t.width,a,i.direction,e.on_height]);const v=`${d+(e.head_size??o)+6+e.along}px`,x={"--ev-color":p};null!=t.link_length&&(x["--side-gap"]=`${t.link_length}px`);const b=l?{top:v}:{left:v};return t.width&&(b.width=`${t.width}px`),(0,c.jsxs)("div",{className:`timeline-event timeline-event--${i.card_style} timeline-event--side-${r} timeline-event--node-${i.node_style}`+(m?" timeline-event--on":"")+(i.show_connector?" timeline-event--linked":""),ref:_,style:{...b,...x,borderColor:p},onPointerDown:t=>e.on_down(t,e.phase_index,e.event_index),children:[i.show_connector&&(0,c.jsx)("div",{className:"timeline-event__link",style:{borderColor:p,borderStyle:i.line_style}}),(0,c.jsx)("div",{className:`timeline-node ${u(i.node_style)}`,style:{background:"image"===i.node_style&&t.image?"transparent":p},children:"image"===i.node_style&&t.image?(0,c.jsx)("img",{src:t.image,alt:""}):null}),(0,c.jsxs)("div",{className:"timeline-event__body",children:[(0,c.jsx)("div",{className:"timeline-event__title",style:{color:p},children:t.title||h("未命名")}),t.desc&&(0,c.jsx)("div",{className:"timeline-event__desc",children:t.desc})]}),(0,c.jsx)("div",{className:"timeline-event__width","data-event-width":t.id,title:h("拖动调整卡片宽度"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_width_down(t,e.phase_index,e.event_index,r)}}),i.show_connector&&(0,c.jsx)("div",{className:"timeline-event__link-handle","data-event-link":t.id,title:h("拖动调整连线长度"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_link_down(t,e.phase_index,e.event_index,r)}}),(0,c.jsx)("span",{className:"material-icons timeline-event__del",title:h("删除事件"),onClick:n=>{n.stopPropagation(),e.on_delete(t.id)},children:"close"})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9299],{47374(e,t,i){i.d(t,{e:()=>p});var n=i(96540),s=i(61973),o=i(64694),a=i(34289),l=i(61443),r=i(75725),c=i(22022),d=i(85997),_=i(74848);function p(e){let t=(0,s.zy)();const[i,p]=(0,n.useState)([]),[f,h]=(0,n.useState)("/"),[u,m]=(0,n.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const n=i.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(i.slice(0,n),e.baseRoute);const a=i.slice(n+1);for(let e=0;e<a.length;e++){const i=a[e];s.push({value:i,href:0===e?`${t}${i}/`:(0,o.IO)(s[e-1].href,i)})}h(t),p(s)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:f,onClick:g,children:(0,_.jsx)(d.In,{icon:"home"})})}),i.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,i){i.d(t,{S:()=>l,X:()=>a});var n=i(96540),s=i(61443),o=i(74848);function a(e){const[t,i]=n.useState([]),a=(0,n.useRef)(-1),[l,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?i(Array.isArray(e.children)?e.children:[e.children]):i(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,i)=>{const n=!!e.filter&&(e.filter.column??0)===i;let a=t;if(n){const i=e.filter,n=i.options.find(e=>e.value===i.value);null!=i.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},i)})})}),(0,o.jsx)("tbody",{children:t.map((t,i)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===i?"row-dragging":"")+(c===i?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=i,r(i),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(i))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,i=c;_(),t<0||i<0||t===i||e.onRowDrag?.(t,i)})())},onDragEnd:_,children:t.map((i,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:i},n)})},i)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},19299(e,t,i){i.r(t),i.d(t,{default:()=>q});var n=i(96540),s=i(47374),o=i(34843),a=i(82893),l=i(14284),r=i(61973),c=i(4412),d=i(89824),_=i(34289),p=i(53459),f=i(99214),h=i(61443),u=i(47022),m=i(62042),w=i(22022),v=i(7523),g=i(78247),x=i(88815),y=i(6960),j=i(47071),k=i(14944),G=i(92275),A=i(23430);var b=i(34251),C=i(60096),S=i(87361),M=i(76559),$=i(85997),z=i(77481),D=i(70447),N=i(74848);const P=500;function E(e){const{t}=(0,w.Bd)(),i=(0,r.Zp)(),[,s]=(0,o.fp)(a.AG.prompt_card),[l,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(!1),[p,f]=(0,n.useState)([]),[u,m]=(0,n.useState)(0),[v,g]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>new M.I(window.location.host,"file_deep_search"),[]),y=(0,n.useRef)(!1),j=decodeURIComponent(e.base_path);(0,n.useEffect)(()=>{let e=[],t=null;const i=()=>{if(t=null,y.current||!e.length)return;const i=e;e=[],m(e=>e+i.length),f(e=>e.length>=P?e:[...e,...i].slice(0,P))},n=()=>{y.current||_(!1)};return x.addMsg(G.HK.file_deep_search_data,n=>{y.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(i,100)))}),x.addMsg(G.HK.file_deep_search_end,()=>{y.current||(i(),_(!1))}),x.on_message("close",n),()=>{y.current=!0,clearTimeout(t),x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",n),x.close()}},[]);const k=()=>{const t=l.trim();if(!t||d)return;f([]),m(0),g(!0),_(!0);const i={param_path:e.base_path,keyword:t};x.sendData(G.HK.file_deep_search,i).catch(()=>{})},A=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),i(S.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,N.jsxs)("div",{className:"file-deep-search",children:[(0,N.jsxs)("div",{className:"file-deep-search__bar",children:[(0,N.jsx)(h.$Z,{icon:"search",value:l,placeholder:t("搜文件名"),handleInputChange:e=>c(e),handleEnterPress:k}),(0,N.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,N.jsxs)("div",{className:"file-deep-search__hint",children:[(0,N.jsxs)("span",{children:[t("范围"),":",j]}),u>0&&(0,N.jsx)("span",{className:"file-deep-search__count",children:u>P?`${t("已显示")} 500 / ${u}`:`${u}`})]}),(0,N.jsxs)("div",{className:"file-deep-search__body",children:[p.length>0&&(0,N.jsx)(z.X,{headers:[t("名称"),t("路径"),""],rows:p.map(e=>{const i=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,N.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,N.jsx)(D.xP,{context:i}),(0,N.jsx)($.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>A(e)})]})}),d&&(0,N.jsxs)("div",{className:"file-deep-search__empty",children:[(0,N.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&u>P&&(0,N.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===p.length&&(0,N.jsx)("div",{className:"file-deep-search__empty",children:t(v?"无匹配":"输入后搜")})]})]})}var F=i(23496),I=i(12730),X=i(75725),R=i(40505);let K={};function H(){const{t:e}=(0,w.Bd)();let t=(0,r.zy)();const i=(0,r.Zp)(),{check_user_auth:s}=(0,g.MH)(),[c,p]=(0,o.fp)(a.AG.nowFileList),[h,x]=(0,o.fp)(a.AG.uploadFiles),[y,j]=(0,o.fp)(a.AG.showPrompt),[C,M]=(0,o.fp)(a.AG.selectedFileList),[z,P]=(0,o.fp)(a.AG.copyedFileList),[E,F]=(0,o.fp)(a.AG.cutedFileList),[R,H]=(0,o.fp)(a.AG.selectedFileList),[L,U]=(0,o.fp)(a.AG.clickFileList),[Y,B]=(0,o.fp)(a.AG.fileShellShow),[O]=(0,o.fp)(a.AG.current_mount),[Z,W]=(0,o.fp)(a.AG.file_root_list),[T,V]=(0,o.fp)(a.AG.file_root_index),[q,J]=(0,n.useState)(void 0),[Q,ee]=(0,n.useState)(""),[te,ie]=(0,o.fp)(a.AG.workflow_show),[ne,se]=(0,o.fp)(a.AG.workflow_realtime_show),[oe,ae]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:le}=(0,n.useContext)(v.F),[re,ce]=(0,o.fp)(a.AG.user_base_info),{click_file:de}=(0,f.kZ)(),[_e,pe]=(0,o.fp)(a.AG.prompt_card),fe=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type!==u.Iw.folder?1:0),0),[c]),he=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type===u.Iw.folder?1:0),0)+(c.folders?.length??0),[c]);function ue(e){(0,m.SK)(e)}(0,n.useEffect)(()=>{K={}},[t]),(0,n.useEffect)(()=>()=>{B({show:!1,path:""})},[]);const me=(0,f.Vs)(),we=t=>{pe({open:!0,title:e("信息"),context_div:(0,N.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,N.jsx)(X.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,N.jsx)(X.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,N.jsx)(X.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,N.jsx)(X.Yh,{left:`${e("文件夹数")}`,right:he}),(0,N.jsx)(X.Yh,{left:`${e("文件数")}`,right:fe}),(0,N.jsx)(X.Yh,{left:`${e("当前位置")}`,right:(0,N.jsx)(D.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{k.ws.removeMsg(G.HK.file_info)}})};return(0,N.jsxs)(n.Fragment,{children:[C.length>0&&(0,N.jsx)($.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:d.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),C.length>0&&(0,N.jsx)($.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,f.ib)(c,C);P(e.map(e=>(0,f.Ok)(e.name))),F([]),ue("已复制")}}),C.length>0&&(0,N.jsx)($.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,f.ib)(c,C);F(e.map(e=>(0,f.Ok)(e.name))),P([]),ue("已剪切")}}),(z.length>0||E.length>0)&&(0,N.jsx)($.rA,{onClick:function(){j({show:!0,type:d.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:z.length+E.length}),C.length>0&&(0,N.jsx)($.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,f.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,f.Ok)(i.name))}const t=l.$M.getDownloadUrl(e);window.open(t)}}),C.length>0&&(0,N.jsx)($.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,f.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,f.Ok)(i.name)}e&&0!==e.length?j({show:!0,type:d.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,m.zN)("没有选中")}}),1===C.length&&(0,N.jsx)($.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:d.PromptEnum.FileRename,overlay:!0,data:{}})}}),oe&&(0,N.jsx)($.rA,{icon:"api",title:"workflow",onClick:()=>{ie(!te)}}),!O&&(0,N.jsx)($.rA,{icon:"terminal",title:"shell",onClick:function(){Y.show?B({show:!1,path:""}):B({show:!0,path:(0,_.GG)("file",(0,_.vX)())})}}),s(A.oV.share_file)&&(0,N.jsx)($.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${S.o.share_list_setting_page}`)}}),(0,N.jsx)($.rA,{icon:"grid_view",title:e("切换样式"),onClick:me}),(0,N.jsx)($.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:d.PromptEnum.DirNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,N.jsx)($.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:d.PromptEnum.FileNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,N.jsx)($.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:d.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=i?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,i&&s.add((0,I.S)(a)),n.push(o)}const o=[];if(i)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...n),x(o),j({show:!0,type:d.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,N.jsx)($.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!K.now_absolute_path){k.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(K={...K,...i},k.ws.removeMsg(G.HK.file_info),we(K))});const t=await k.ws.sendData(G.HK.file_info,{type:u.Iw.folder,path:(0,_.GG)("file",(0,_.vX)())});e=t.context,K=e,we(K)}we(K)}}),(0,N.jsx)($.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory,n.items=Z,n.item_pre_value=T,n.textClick=async t=>{if(-1===t)return i(`${S.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,m.N9)(e("请配置 文件夹路径"));(async e=>{V(e),await l.$M.post("base_switch",{root_index:e}),await le(),i("/file/"),H([]),U([])})(t),j({data:void 0,overlay:!1,type:"",show:!1})},j({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var L=i(2543),U=i(21499),Y=i(64694),B=i(17903);const O=n.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),Z=n.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636))),W=n.lazy(()=>Promise.all([i.e(4946),i.e(2626),i.e(892),i.e(9334),i.e(4004)]).then(i.bind(i,95733)));let T,V="";function q(){const[e,t]=(0,o.fp)(a.AG.editorSetting),[,i]=(0,o.fp)(a.AG.md_editor),[,m]=(0,o.fp)(a.AG.log_viewer),[,M]=(0,o.fp)(a.AG.image_editor),[,z]=(0,o.fp)(a.AG.markdown),[,D]=(0,o.fp)(a.AG.excalidraw_editor),[,P]=(0,o.fp)(a.AG.mind_editor),[,I]=(0,o.fp)(a.AG.timeline_editor),[,X]=(0,o.fp)(a.AG.excel_editor),[K,q]=(0,o.fp)(a.AG.file_preview),{t:J}=(0,w.Bd)();let Q=(0,r.zy)();const ee=(0,r.Zp)(),[te,ie]=(0,o.fp)(a.AG.nowFileList),[ne]=(0,o.fp)(a.AG.file_list_refresh),[se]=(0,o.fp)(a.AG.mount_enabled),[oe,ae]=(0,o.fp)(a.AG.current_mount),[le,re]=(0,o.fp)(a.AG.showPrompt),[ce,de]=(0,o.fp)(a.AG.selectedFileList),[_e,pe]=(0,o.fp)(a.AG.clickFileList),[fe,he]=(0,o.fp)(a.AG.fileShellShow),[ue,me]=(0,n.useState)(""),[we,ve]=(0,o.fp)(a.AG.workflow_show),[ge,xe]=(0,o.fp)(a.AG.workflow_realtime_show),[ye,je]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:ke}=(0,n.useContext)(v.F),[Ge,Ae]=(0,o.fp)(a.AG.user_base_info),{check_user_auth:be}=(0,g.MH)(),{click_file:Ce}=(0,f.kZ)(),[Se]=(0,r.ok)(),Me=(0,f._A)(),$e=n.useRef(null),[ze,De]=(0,o.fp)(a.AG.to_running_files),[Ne,Pe]=(0,o.fp)(a.AG.file_page),[Ee]=(0,o.fp)(a.AG.blank_search_mode),[,Fe]=(0,o.fp)(a.AG.prompt_card),[Ie,Xe]=(0,o.fp)(a.AG.blank_search_mode_for_temp),Re=(0,f.oT)(),Ke="1"===Se.get("chat_open"),He=be(A.oV.ai_agent_page);(0,n.useEffect)(()=>{Ge?.user_data&&Ke&&!He&&Re("chat_open",null)},[Ke,He,Ge]);const[Le,Ue]=(0,o.fp)(a.AG.studio_chat_width),Ye=n.useRef(null),[Be,Oe]=(0,n.useState)(!1),[Ze,We]=(0,n.useState)(void 0),Te=(0,f.dN)(),[Ve,qe]=(0,o.fp)(a.AG.ai_chat_session_by_cwd),Je=function(){const[e,t]=(0,o.fp)(a.AG.user_base_info),{t:i}=(0,w.Bd)(),{check_user_auth:s}=(0,g.MH)(),[c,p]=(0,o.fp)(a.AG.router_jump),h=(0,r.Zp)(),{initUserInfo:m}=(0,n.useContext)(v.F),[x,y]=(0,o.fp)(a.AG.nowFileList),[j,C]=(0,o.fp)(a.AG.showPrompt),[M,$]=(0,o.fp)(a.AG.fileShellShow),[z,D]=(0,o.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory;const o=[{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.time_minx_max),children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.time_max_min),children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.size_min_max),children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.size_max_min),children:i("大小逆序")}),v:A.t8.size_max_min}],r=[{r:(0,N.jsx)("span",{style:(0,R.ok)(!e.user_data.file_list_pagination_mode||e.user_data.file_list_pagination_mode===A.yM.all),children:i("全部加载文件")}),v:A.yM.all},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.file_list_pagination_mode===A.yM.pagination),children:i("scrll_l")}),v:A.yM.pagination}],c=[{r:(0,N.jsx)("span",{style:(0,R.ok)(!e.user_data.file_time_show_type||e.user_data.file_time_show_type===A.KD.current),children:i("最近时间")}),v:A.KD.current},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.file_time_show_type===A.KD.time),children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,N.jsx)("span",{style:(0,R.ok)(!e.user_data.dir_show_type),children:i("系统默认")}),v:A.t8.defualt},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.name),children:i("名字")}),v:A.t8.name},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min),children:i("修改时间")}),v:!1,items:o},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min),children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:r},{r:i("时间展示"),v:"",items:c},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,N.jsx)("span",{style:(0,R.ok)(z),children:i("srchbln")}),v:"blank_search_mode"}]}];x?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),s(A.oV.code_resource)&&w.push({r:i("add_rot"),v:"code_resource"}),s(A.oV.http_proxy)&&w.push({r:i("dl_here"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,f.LL)([...e.user_data.quick_cmd],w),n.items=w,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${S.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${S.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return p({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/setting/customer_router/")}if("http_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:d.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",$({show:!0,path:(0,_.GG)("file",(0,_.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return D(!z),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===A.yM.all||e===A.yM.pagination)t.is_pagination_mode=!0;else if(e===A.KD.current||e===A.KD.time)t.is_file_show_type=!0;else{if(e!==A.t8.defualt&&e!==A.t8.name&&e!==A.t8.size_max_min&&e!==A.t8.size_min_max&&e!==A.t8.time_max_min&&e!==A.t8.time_minx_max)return;t.is_dir_list_type=!0}}await l.wm.post(F.s.user_save_private_attr,{type:e,...t}),await m(),C({data:void 0,overlay:!1,type:"",show:!1}),h((0,_.vX)())},C({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}}(),Qe=async()=>{const e=new j.Nd;e.dir_path=`${(0,_.GG)("file",(0,_.vX)())}`,k.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,f.Ys)(e);for(const e of t.failed_file_list)(0,f.V$)(e);De(new Set(t.running_file_list))}}),await k.ws.sendData(G.HK.workflow_realtime,e)},et=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,x.v7)(i.size),Ge.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,U.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{Qe()})),i.name===j.SB&&(t=!0);for(const i of e.folders??[])Ge.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,U.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",i.name===j.SB&&(t=!0);je(t)},tt=n.useRef(null),it=async e=>{if(!0===se){if(tt.current!==e){tt.current=e;try{const t=await l.$M.post("file/mount_info",{param_path:e});ae(t?.data??null)}catch(e){ae(null)}}}else ae(null)},nt=async()=>{const e=(0,_.GG)("file",(0,_.vX)());if(Ee||Ie)return;let t;if(it(e),Ge.user_data.file_list_pagination_mode===A.yM.pagination){if(V!==e){if(V=e,1!==Ne.page_num)return void Pe({page_size:Ne.page_size,page_num:1})}else if(Ne.page_num<0)return;if(t=await l.$M.post("file_get_page",{param_path:e,page_num:Ne.page_num,page_size:Ne.page_size}),t.code!==p.m.Success)return;const i=t.data;return et(i),i.files?.length?(ie(e=>{const t=(0,L.cloneDeep)(1===Ne.page_num?i.files:[...e?.files??[],...i.files]),n={...e,files:t};return(0,f.yC)(n,Ge.user_data.dir_show_type),n}),void(T=t.data)):void Pe({page_size:Ne.page_size,page_num:-1})}if(t=await l.$M.get(e),t.code!==p.m.Success)return;const i=t.data;(0,f.yC)(i,Ge.user_data.dir_show_type),et(t.data),ie(t.data),T=t.data};(0,n.useEffect)(()=>async()=>{De(new Set)},[]);const st=()=>{je(!1),(()=>{const e=Se.get("preview_file_name"),t=Se.get("preview_mode");if(!e||!t)return!1;const n=(0,_.GG)("file",(0,_.vX)());if($e.current===n+e)return!0;$e.current=n+e;const s=()=>Me(null);return"md"===t?(i({url:l.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:s}),!0):"log"===t?(m({show:!0,fileName:e,encoding:Se.get("preview_log_enc")??"utf8",wrap:Se.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?(M({path:(0,Y.IO)((0,_.vX)(),e),name:e,close:s}),!0):(Ce({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),q({open:!1}),i({}),m({show:!1}),M({}),z({}),D({}),P({}),I({}),X({}),nt())};(0,n.useEffect)(()=>{st()},[Q,Ne]),(0,n.useEffect)(()=>{ne>0&&nt()},[ne]);const ot=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==se)return ot.current?void(!0===se?it((0,_.GG)("file",(0,_.vX)())):ae(null)):(ot.current=!0,void(!0===se&&null===oe&&it((0,_.GG)("file",(0,_.vX)()))))},[se]);const at=e=>{e.target===e.currentTarget&&(de([]),pe([]))},lt=n.useCallback((0,L.throttle)(e=>{const t=Ye.current;if(!t||!t.parentElement)return;const i=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),s=n.right-e.clientX,o=Math.min(Math.max(s,320),.7*n.width);Ue(parseFloat((o/i).toFixed(2)))},32),[]),rt=()=>{Oe(!1),document.removeEventListener("pointermove",lt)},ct=(0,N.jsxs)("div",{className:"file-list-main",children:[(0,N.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(de([]),pe([]),Ge.user_data.file_list_pagination_mode===A.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Pe({page_size:Ne.page_size,page_num:1})}},input_path_enter:e=>{var t;de([]),pe([]),ie({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?ee(function(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===i)return e.substring(0,n+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}((0,_.vX)(),e)):(e=e.replace(0===(t=Ge.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),ee(e))}}),oe&&(0,N.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:oe.color},children:[(0,N.jsx)("span",{className:"material-icons",style:{color:oe.color},children:"cloud"}),(0,N.jsx)("span",{children:[oe.credential_note,oe.account_note||(B.C1.find(e=>e.value===oe.driver)?.title??oe.driver),oe.name].filter(Boolean).join(" - ")}),oe.readonly&&(0,N.jsx)("span",{className:"mount-readonly-tag",children:J("只读")})]}),Ge.user_data.file_list_pagination_mode===A.yM.pagination?(0,N.jsx)(C.$J,{handleContextMenu:Je,clickBlank:at,list:te.files}):(0,N.jsx)(C.t$,{handleContextMenu:Je,file_list:te.files,folder_list:te.folders,clickBlank:at})]});return(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)(c.aZ,{children:(0,N.jsx)(h.$Z,{handleEnterPress:async()=>{if(Ee||Ie){if(de([]),pe([]),!ue||!ue.trim())return void ie({files:[],folders:[]});const e=(0,_.GG)("file",(0,_.vX)()),t=await l.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:ue.trim()});if(t.code!==p.m.Success)return;const i=t.data;return(0,f.yC)(i,Ge.user_data.dir_show_type),et(i),ie(i),void(T=i)}if(!T)return;de([]),pe([]);const e=[],t=[];for(const t of T.files??[])t.name.includes(ue)&&e.push(t);for(const e of T.folders??[])e.name.includes(ue)&&t.push(e);ie({files:e,folders:t})},placeholder:J("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,_.GG)("file",(0,_.vX)());Fe({open:!0,title:J("深搜"),context_div:(0,N.jsx)(E,{base_path:e})})},handleInputChange:e=>{me(e)},max_width:"25em"})}),(0,N.jsxs)(c.aZ,{position:"right",children:[be(A.oV.ai_agent_page)&&(0,N.jsx)($.rA,{icon:"smart_toy",title:J("AI 聊天"),selected:Ke,onClick:()=>Re("chat_open",!Ke?"1":null)}),(0,N.jsx)("div",{className:"mobile-context-btn",children:(0,N.jsx)($.rA,{icon:"more_horiz",title:J("右键"),onClick:()=>{const e=ce[ce.length-1];if(void 0!==e){const t=[...te.folders??[],...te.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],n=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},o=new b.ik;o.path=(0,Y.IO)((0,_.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===u.Iw.folder?u.Iw.folder:(0,b.uL)(t.name),o.size=t.origin_size,re({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Je(e)}}})}),(0,N.jsx)(H,{})]}),(0,N.jsxs)("div",{className:"file-list-split"+(Ke?" file-list-split--chat":""),children:[ct,Ke&&(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Ye,onPointerDown:e=>{e.preventDefault(),Oe(!0),document.addEventListener("pointermove",lt),document.addEventListener("pointerup",rt,{once:!0})}}),(0,N.jsx)("div",{className:"studio-chat-panel",style:{width:`${Le}em`},children:(0,N.jsx)(n.Suspense,{fallback:null,children:(0,N.jsx)(W,{inline_header:!0,sync_url:!1,file_cwd_path:Te(),session_id:Ze??(dt=Te(),a.AG.get_ai_chat_session(Ve,dt)),on_session_change:e=>{We(e),((e,t)=>{qe({...Ve,[e]:t})})(Te(),e)}})})})]})]}),Be&&(0,N.jsx)("div",{className:"shell__overlay",onPointerUp:rt}),we&&(0,N.jsx)(O,{}),ge.open&&(0,N.jsx)(Z,{})]});var dt}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9334],{89117(t,e,n){n.d(e,{Hm:()=>s,U6:()=>c});const r=["mermaid","svg"];function s(t){return r.includes(t)}let o=null;let i=0;async function a(t){const e=t.trim();if(!e)return{svg:"",error:null};const r=await(o||(o=n.e(2300).then(n.bind(n,62300)).then(t=>{const e=t.default;return e.initialize({startOnLoad:!1,securityLevel:"loose",theme:"default",fontFamily:"inherit",suppressErrorRendering:!0}),e})),o),s="md-mermaid-"+ ++i;try{const{svg:t}=await r.render(s,e);return{svg:t,error:null}}catch(t){return document.getElementById(s)?.remove(),document.getElementById(`d${s}`)?.remove(),{svg:"",error:t?.message??String(t)}}}async function c(t,e){return"svg"===t?function(t){const e=t.trim();if(!e)return{svg:"",error:null};const n=(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("parsererror");return n?{svg:"",error:n.textContent?.trim()||"SVG 解析失败"}:{svg:e,error:null}}(e):a(e)}},41105(t,e,n){n.d(e,{KR:()=>f,Ne:()=>h,op:()=>E,pC:()=>u,sL:()=>p});var r=n(5338),s=n(96540),o=n(14284),i=n(19878),a=n(89117),c=n(86063),l=n(93392),d=n(20892);function u(t){return btoa(unescape(encodeURIComponent(t)))}function h(t){return decodeURIComponent(escape(atob(t)))}let m="";function p(t){m=t||""}function f(t){if(/^(https?:|data:|blob:|\/\/|\/)/i.test(t))return t;const e=t.replace(/^\.\//,"");return o.$M.getDownloadUrl(m+e)}const g=new Set(["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","small","span","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","var","wbr"]),_=new Set(["align","alt","border","cellpadding","cellspacing","class","colspan","height","href","id","rowspan","src","style","target","title","valign","width"]);function v(t){const e=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild,n=document.createDocumentFragment();if(!e)return n;const r=(t,e)=>{t.childNodes.forEach(t=>{if(t.nodeType===Node.TEXT_NODE)return void e.appendChild(document.createTextNode(t.textContent??""));if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(!g.has(n.tagName.toLowerCase()))return void r(n,e);const s=document.createElement(n.tagName.toLowerCase());for(const t of Array.from(n.attributes)){const e=t.name.toLowerCase();e.startsWith("on")||(_.has(e)||e.startsWith("data-"))&&("href"!==e&&"src"!==e||!/^\s*javascript:/i.test(t.value))&&("src"!==e?s.setAttribute(e,t.value):s.setAttribute(e,f(t.value)))}r(n,s),e.appendChild(s)})};return r(e,n),n}class b{dom;node;view;get_pos;render_box;source_box;source_input;source_hl;source_hl_code;mode="preview";draft=null;constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n,this.dom=document.createElement("div"),this.dom.className="md-html-block",this.dom.setAttribute("data-mode","preview"),this.render_box=document.createElement("div"),this.render_box.className="md-html-block__render",this.source_box=document.createElement("div"),this.source_box.className="md-html-block__source",this.source_input=document.createElement("textarea"),this.source_input.className="md-html-block__input",this.source_input.setAttribute("spellcheck","false"),this.source_input.setAttribute("wrap","off"),this.source_hl=document.createElement("pre"),this.source_hl.className="md-html-block__highlight",this.source_hl.setAttribute("aria-hidden","true");const r=document.createElement("code");this.source_hl.appendChild(r),this.source_hl_code=r,this.source_box.append(this.source_hl,this.source_input);const s=document.createElement("span");s.className="md-html-block__toggle",s.setAttribute("contenteditable","false"),s.textContent="HTML",s.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),this.toggle_mode()}),this.source_input.addEventListener("blur",()=>this.commit()),this.source_input.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),this.draft=null,this.toggle_mode()),t.stopPropagation()}),this.source_input.addEventListener("input",()=>{this.draft=this.source_input.value,this.paint_highlight(),this.source_hl.scrollLeft=this.source_input.scrollLeft}),this.source_hl.addEventListener("scroll",()=>{this.source_input.scrollLeft=this.source_hl.scrollLeft});for(const t of["beforeinput","paste","input","keyup","keypress"])this.source_input.addEventListener(t,t=>t.stopPropagation());this.dom.append(this.render_box,this.source_box,s),this.render_box.replaceChildren(v(t.attrs.value)),this.set_source_value(t.attrs.value)}set_source_value(t){this.source_input.value=t,this.paint_highlight()}paint_highlight(){const t=this.source_input.value;this.source_hl_code.innerHTML=i.A.highlight(t+"\n",{language:"xml",ignoreIllegals:!0}).value}toggle_mode(){if("source"===this.mode)return this.commit(),this.mode="preview",void this.dom.setAttribute("data-mode","preview");this.mode="source",this.dom.setAttribute("data-mode","source"),this.set_source_value(this.node.attrs.value),this.draft=null,this.source_input.focus()}commit(){if(null===this.draft)return;const t=this.draft;if(this.draft=null,t===this.node.attrs.value)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);n&&this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,value:t}))}update(t){return t.type===this.node.type&&(this.node=t,null===this.draft&&(this.render_box.replaceChildren(v(t.attrs.value)),"preview"===this.mode&&this.set_source_value(t.attrs.value)),!0)}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}}class w{dom;node;view;get_pos;constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n,this.dom=document.createElement("span"),this.dom.className="md-html-inline",this.dom.setAttribute("contenteditable","true"),this.dom.textContent=t.attrs.value,this.dom.addEventListener("blur",()=>this.commit());for(const t of["beforeinput","paste","input"])this.dom.addEventListener(t,t=>t.stopPropagation())}commit(){const t=this.dom.textContent??"";if(t===this.node.attrs.value)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);n&&this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,value:t}))}update(t){return t.type===this.node.type&&(this.node=t,!0)}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}}function y(t){const e=t.split(/[?#]/)[0].toLowerCase();return e.endsWith(".mermaid")?"mermaid":e.endsWith(".mind")?"mind":e.endsWith(".timeline")?"timeline":null}class k{dom;node;kind;src;mind_unmount=null;timeline_root=null;constructor(t){this.node=t,this.src=t.attrs.src,this.kind=y(this.src),this.dom=this.kind?this.build_graph():this.build_image()}build_image(){const t=document.createElement("img");t.src=f(this.src),t.alt=this.node.attrs.alt??"";const e=this.node.attrs.title;return e&&(t.title=e),t}build_graph(){const t=document.createElement("span");t.className="md-graph md-graph--file",t.setAttribute("contenteditable","false");const e=document.createElement("span");return e.className="md-graph__body",t.append(e),this.render_graph_body(e),t}render_graph_body(t){const e=f(this.src);t.textContent="loading",fetch(e).then(t=>t.text()).then(async e=>{if(!this.dom.isConnected)return;if("mermaid"===this.kind){const n=await(0,a.U6)("mermaid",e);if(!t.isConnected)return;return n.error?(this.dom.classList.add("md-graph--error"),void(t.textContent=n.error)):void(t.innerHTML=n.svg)}if("timeline"===this.kind){const n=(0,l.dO)(e);if(!t.isConnected)return;if(!n)return this.dom.classList.add("md-graph--error"),void(t.textContent="invalid timeline");this.dom.classList.add("md-graph--timeline"),t.remove(),this.dom.textContent="";const o=document.createElement("div");o.className="md-timeline-embed",this.dom.append(o);const i=(0,r.createRoot)(o);return i.render((0,s.createElement)(d.default,{doc:n,readonly:!0})),void(this.timeline_root=i)}const n=await(0,c.Hn)(e);if(!this.dom.isConnected)return;this.dom.classList.add("md-graph--mind"),t.remove(),this.dom.textContent="";const o=await n.mount(this.dom);this.mind_unmount=()=>o.destroy()}).catch(()=>{t.isConnected&&(this.dom.classList.add("md-graph--error"),t.textContent="load failed")})}update(t){if(t.type!==this.node.type)return!1;this.node=t;const e=t.attrs.src;if(e!==this.src){this.destroy_instance(),this.src=e,this.kind=y(e);const t=this.kind?this.build_graph():this.build_image();this.dom.replaceWith(t),this.dom=t}else if(!this.kind){const e=this.dom;e.alt=t.attrs.alt??"";const n=t.attrs.title;n&&(e.title=n)}return!0}destroy_instance(){this.mind_unmount?.(),this.mind_unmount=null,this.timeline_root?.unmount(),this.timeline_root=null}destroy(){this.destroy_instance()}stopEvent(t){return!!this.kind&&this.dom.contains(t.target)}ignoreMutation(){return!0}}function E(){return{html_block:(t,e,n)=>new b(t,e,n),html_inline:(t,e,n)=>new w(t,e,n),image:t=>new k(t)}}},89334(t,e,n){n.d(e,{Rh:()=>p,V:()=>a,lG:()=>o,rg:()=>f,z$:()=>u});var r=n(41105);n(6704);const s=["math","latex","katex"];function o(t){return s.includes(t.toLowerCase())}const i=[{open:"$$",close:"$$",mode:"block"},{open:"\\[",close:"\\]",mode:"block"},{open:"\\(",close:"\\)",mode:"inline"},{open:"$",close:"$",mode:"inline"}];function a(t){const e=t.trim();if(!e)return null;for(const t of i){if(e.length<=t.open.length+t.close.length)continue;if(!e.startsWith(t.open)||!e.endsWith(t.close))continue;const n=e.slice(t.open.length,e.length-t.close.length);if(("$"!==t.open||!e.startsWith("$$"))&&n.trim())return{tex:n,mode:t.mode,raw:e}}return null}let c=null;const l=new Map;async function d(t,e){const r=t.trim();if(!r)return{html:"",error:null};const s=`${e}\0${r}`,o=l.get(s);if(o)return o;let i;try{const{renderToString:t}=await(c||(c=n.e(2130).then(n.bind(n,99749))),c);i={html:t(r,{displayMode:"block"===e,throwOnError:!1,strict:!1,trust:!1,output:"html"}),error:null}}catch(t){i={html:"",error:t?.message??String(t)}}return l.size>=500&&l.clear(),l.set(s,i),i}async function u(t,e,n,r){const s=await d(e,n);if(t.isConnected){if(t.classList.remove("md-math--loading","md-math--error"),s.error)return t.classList.add("md-math--error"),t.textContent=r,void(t.title=s.error);t.innerHTML=s.html}}function h(t,e){const n=t.pos,r=t.src;if(r.startsWith("$$",n))return!1;const s=[{open:"\\(",close:"\\)"},{open:"$",close:"$"}];for(const o of s){if(!r.startsWith(o.open,n))continue;const s=n+o.open.length,i=r.indexOf(o.close,s);if(i<0)continue;const a=r.slice(s,i);if(a.trim()){if("$"===o.open){const t=r[i+1];if(void 0!==t&&/\d/.test(t))continue}if(!e){const e=t.push("math_inline","span",0);e.content=a,e.markup=o.open,e.meta={raw:r.slice(n,i+o.close.length)}}return t.pos=i+o.close.length,!0}}return!1}function m(t,e,n,r){const s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e],i=t.src.slice(s,o).trim(),a=[{open:"\\[",close:"\\]"},{open:"$$",close:"$$"}];for(const o of a){if(!i.startsWith(o.open))continue;if(i.endsWith(o.close)&&i.length>o.open.length+o.close.length){if(r)return!0;const n=t.push("math_block","div",0);return n.content=i.slice(o.open.length,i.length-o.close.length),n.markup=o.open,n.meta={raw:i},n.map=[e,e+1],t.line=e+1,!0}const a=i.slice(o.open.length);for(let i=e+1;i<n;i++){const n=t.bMarks[i]+t.tShift[i],c=t.eMarks[i],l=t.src.slice(n,c);if(!l.trimEnd().endsWith(o.close))continue;if(r)return!0;const d=[];a.trim()&&d.push(a),t.getLines(e+1,i,t.tShift[e],!1).split("\n").forEach(t=>d.push(t)),d.push(l.trimEnd().slice(0,-o.close.length));const u=t.push("math_block","div",0);return u.content=d.join("\n").trim(),u.markup=o.open,u.meta={raw:t.src.slice(s,t.eMarks[i]).trimEnd()},u.map=[e,i+1],t.line=i+1,!0}}return!1}function p(t,e){t.inline.ruler.before("escape","math_inline",h),t.block.ruler.before("fence","math_block",m,{alt:["paragraph","reference","blockquote","list"]}),t.renderer.rules.math_inline=(t,n)=>`<span data-math-inline="${e(t[n].meta.raw)}"></span>`,t.renderer.rules.math_block=(t,n)=>`<div data-math-block="${e(t[n].meta.raw)}"></div>`;const n=t.renderer.rules.fence||function(t,e,n,r,s){return s.renderToken(t,e,n)};t.renderer.rules.fence=(t,r,s,i,a)=>o(t[r].info.trim())?`<div data-math-block="${e(`$$\n${t[r].content.trim()}\n$$`)}"></div>`:n(t,r,s,i,a)}async function f(t){const e=t.querySelectorAll("[data-math-inline], [data-math-block]");for(const t of Array.from(e)){const e=t.getAttribute("data-math-inline"),n=t.getAttribute("data-math-block"),s=e??n;if(null===s)continue;const o=a((0,r.Ne)(s));if(!o)continue;const i=null!==e?"inline":"block";t.classList.add("md-math","block"===i?"md-math--block":"md-math--inline"),await u(t,o.tex,i,o.raw)}}},86063(t,e,n){function r(t){return"smm-mind"===t}n.d(e,{Hn:()=>d,hj:()=>r,tW:()=>i});const s={mousewheelMoveStep:35,scaleRatio:.08};let o=null;function i(t){return t&&"object"==typeof t?t.data?.nodeData?a(t.data.nodeData):t.root&&"object"==typeof t.root?t.root.data?t.root:c(t.root):t.data&&"object"==typeof t.data?t:c(t):null}function a(t){return{data:{text:"string"==typeof t?.topic?t.topic:"string"==typeof t?.data?.text?t.data.text:""},children:Array.isArray(t?.children)?t.children.map(a):[]}}function c(t){return{data:{text:"string"==typeof t?.text?t.text:"",...t?.note?{note:t.note}:{}},children:Array.isArray(t?.children)?t.children.map(c):[]}}function l(t){t.stopPropagation()}async function d(t){const e=function(t){const e=t.trim();if(!e)return null;let n=null;try{n=JSON.parse(e)}catch{return null}return i(n)}(t),r=await(o||(o=Promise.all([n.e(1417).then(n.bind(n,21417)),n.e(8781).then(n.bind(n,88781))]).then(([t])=>t.default)),o);return{data:e,async mount(t,n){let o=!1;const i=await function(t,e){return new Promise(n=>{const r=()=>{e()?n(!1):t.isConnected&&t.clientWidth&&t.clientHeight?n(!0):window.setTimeout(r,16)};r()})}(t,()=>o);if(!i)return{destroy:()=>{},get_data:()=>null};const a=document.createElement("div");a.className="md-graph__mind-host",!1!==n?.release_wheel&&t.addEventListener("wheel",l,{capture:!0,passive:!0}),t.append(a);const c=new r({el:a,data:e??{data:{text:""}},readonly:!n?.editable,fit:!0,...s});return{destroy:()=>{o=!0,t.removeEventListener("wheel",l,{capture:!0}),c?.destroy?.()},get_data:()=>c?.getData?.(!1)}}}}n.d(e,["k$",0,s])}}]);
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><base href="/"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.26c2c54f6ab534513ebd.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>
1
+ <!doctype html><html lang="en"><head><base href="/"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.65dcea654963fc771a86.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>