filecat 6.45.0 → 6.45.2

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 (22) hide show
  1. package/build/dist/{1448.9d36cf216585774aa090.js → 1448.5c59beb988af30fd5392.js} +1 -1
  2. package/build/dist/{1472.1d82f53e309eceea3e9a.js → 1472.da125232ac31af35047e.js} +1 -1
  3. package/build/dist/{2542.58c52e3d0bd7af6d9a62.js → 2542.107d541161551f162edb.js} +1 -1
  4. package/build/dist/{2674.c58839496f66c6512ae5.js → 2674.bdae90b4a04916f7bb20.js} +1 -1
  5. package/build/dist/{4488.72cda485aa8175ce03bd.js → 4488.0fdf2f4a552ffff1b206.js} +1 -1
  6. package/build/dist/{5308.cc7a2e88ea22f247ec76.js → 5308.52192ab9a2d34aafc1f2.js} +1 -1
  7. package/build/dist/{5516.e3b6d2b2c1439d8e4cf6.js → 5516.867dcf973e3da3f469ed.js} +1 -1
  8. package/build/dist/{5761.2631a6de5c30fbfb66da.js → 5761.083ffc973613bda0923d.js} +1 -1
  9. package/build/dist/{5937.9e77a5b78996adbdbe1b.js → 5937.e40fafe993cb42cc68a9.js} +1 -1
  10. package/build/dist/{6247.077a555b26c06aa2e96b.js → 6247.251b22d7770a37a87298.js} +1 -1
  11. package/build/dist/{6505.bacc9c5cdd2094604a00.js → 6505.8ce4ae19c126468cdbf9.js} +1 -1
  12. package/build/dist/{678.f0aed27a613d4dd41080.js → 678.3b3b5d3b55fb8da89848.js} +1 -1
  13. package/build/dist/{6892.4db4a81a58e94e4356cc.js → 6892.491e86318d079d70ced4.js} +1 -1
  14. package/build/dist/{7209.f4ad503eb484aa601281.js → 7209.3b487c37072aadaed4ca.js} +1 -1
  15. package/build/dist/{8603.557bbe67c1b08a3627d6.js → 8603.bed222c279303c511397.js} +1 -1
  16. package/build/dist/{8714.3360add5f45201f4c8da.js → 8714.f4a1d7a608d115ca177a.js} +1 -1
  17. package/build/dist/{8765.35d24edc172c477ba795.js → 8765.303ae394e6f728123caf.js} +1 -1
  18. package/build/dist/index.html +1 -1
  19. package/build/dist/{main.151df5e8840564caf370.js → main.d470613b59159e063c46.js} +2 -2
  20. package/build/dist/{main.151df5e8840564caf370.js.LICENSE.txt → main.d470613b59159e063c46.js.LICENSE.txt} +1 -1
  21. package/build/main.js +1 -1
  22. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[678,6010],{83277(e,t,s){s.d(t,{$j:()=>o,Lv:()=>a,qq:()=>i});class n{options_agent_url_list;options_agent_key_list;options_agent_model_list;options_local_file_path_prompt_list}class a{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 s of t)if(s.value===e)return s.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const s of t)if(s.value===e)return!0;return!1}}class i extends n{tool_error_max=50;tool_call_max=300;allow_exec_cmd_directly=!1;proxy_url;open_pick_model;max_recent_messages=12;compress_message_count=16;max_tool_content_chars=200}const c=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function o(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}s.d(t,["CP",0,'\n\n# 工具报错最大尝试次数\ntool_error_max=50\n# 聊天循环最大次数\ntool_call_max=300\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',"cL",0,c])},93583(e,t,s){s.r(t),s.d(t,{default:()=>Y});var n=s(96540),a=s(34843),i=s(34899),c=s(61973),o=s(92275),l=s(14284),r=s(7463),d=s(78247),u=s(40505),m=s(62042),h=s(45907),g=s(53459),p=s(72693),x=s(82893),_=s(61443),f=s(83277);function j(e){return null==e||e<0?"0":e.toLocaleString()}function v(e){const t=(0,f.$j)(e.content);if(t)return t;const s=e.content_list??[];return s.length?s.map(e=>(0,f.$j)(e.content)).filter(Boolean).join("\n\n"):""}const b=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function y(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||b.test(e.name)?"text":"binary"}function w(e){return e.text()}function S(e){return new Promise((t,s)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=s,n.readAsDataURL(e)})}async function N(e){const t=[];for(const s of e){const e=y(s);let n="";if("text"===e)try{const e=await w(s),t=12e4;n=e.length>t?`${e.slice(0,t)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await S(s)}catch{n=`[图片文件: ${s.name}]`}else n=`[二进制文件: ${s.name}]`;t.push({name:s.name,mime_type:s.type,size:s.size,kind:e,content:n})}return t}var k=s(14944);var C=s(52035),A=s(85997),I=s(34299),$=s(74848);function M(e){const t=e.attachments&&e.attachments.length>0?(0,$.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,t)=>(0,$.jsxs)("div",{className:"chat-message-attachment",children:[(0,$.jsx)(A.In,{icon:"attach_file"}),(0,$.jsx)("span",{children:e.name}),(0,$.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${t}`))}):null,s=[];e.images&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(T,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(R,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(P,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,$.jsx)(I.default,{context:e.text}):null;return(0,$.jsxs)($.Fragment,{children:[e.content_list.map((e,t)=>{const s=[],a=(0,f.$j)(e.content);return a&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(I.default,{context:a})},`content-${t}`)),e.tool_call_ends?.length&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(D,{callList:e.tool_call_ends})},`tool-${t}`)),(0,$.jsx)(n.Fragment,{children:s},`part-${t}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,$.jsx)(I.default,{context:e.text}):null]})}(e);return 0===s.length?(0,$.jsxs)($.Fragment,{children:[t,a]}):(0,$.jsxs)($.Fragment,{children:[s,t,a]})}function D({callList:e}){const[t,s]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,$.jsxs)("div",{className:"chat-message-call-list",children:[(0,$.jsxs)("div",{className:"call-list-header",onClick:()=>s(!t),children:[(0,$.jsx)(A.In,{icon:t?"expand_less":"expand_more"}),(0,$.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,$.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),t&&(0,$.jsx)("div",{className:"call-list-body",children:e.map((e,t)=>(0,$.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,$.jsxs)("div",{className:"call-list-item-header",children:[(0,$.jsx)(A.In,{icon:e.success?"check_circle":"error"}),(0,$.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,$.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"参数"}),(0,$.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"错误"}),(0,$.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"结果"}),(0,$.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},t))})]})}function T({images:e,text:t}){let s=e||[];if(!s.length&&t)try{s=JSON.parse(t).data||[]}catch{}return s.length?(0,$.jsxs)("div",{className:"image-generation-result",children:[s.map((e,t)=>(0,$.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${t+1}`,loading:"lazy"})}),e.b64_json&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${t+1}`})}),e.revised_prompt&&(0,$.jsx)("p",{className:"image-generation-prompt",children:(0,$.jsx)("small",{children:e.revised_prompt})})]},t)),t&&!e&&(0,$.jsx)(I.default,{context:t})]}):(0,$.jsx)(I.default,{context:t||""})}function R({audio:e,text:t}){if(e){if(e.url)return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const t=e.mime_type||"audio/mpeg";return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:${t};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const s=t||"";if(s.startsWith("http://")||s.startsWith("https://"))return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:s,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(s);if(e?.data||e?.audio_data){const t=e.data||e.audio_data;return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${t}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,$.jsx)(I.default,{context:s})}function H({content:e,label:t}){const[s,a]=n.useState(!1);return(0,$.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,u.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(A.In,{icon:s?"check":"content_copy"}),s?"已复制":t||"复制"]})}function P({embeddings:e,text:t}){let s=e||null;if(!s&&t)try{s=JSON.parse(t)}catch{return(0,$.jsx)(I.default,{context:t})}if(!s)return(0,$.jsx)(I.default,{context:t||""});const n=s?.data||[],a=s?.usage,i=JSON.stringify(s,null,2);return(0,$.jsxs)("div",{className:"embeddings-result",children:[(0,$.jsxs)("div",{className:"embeddings-summary",children:[(0,$.jsx)("strong",{children:"向量嵌入结果"}),(0,$.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,$.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,$.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,$.jsxs)("div",{className:"embeddings-toolbar",children:[(0,$.jsx)(H,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,$.jsx)(H,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,$.jsx)(H,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,$.jsx)("div",{className:"embeddings-preview",children:(0,$.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,$.jsxs)("details",{children:[(0,$.jsx)("summary",{children:"查看详细数据"}),(0,$.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function E(e,t){const s=function(){try{return(0,C.zp)().get(x.AG.ai_images_extra_params)||{}}catch{return{}}}(),n={prompt:e,n:s.n??1,size:s.size??"1024x1024",session_id:t};if(s.quality&&(n.quality=s.quality),s.style&&(n.style=s.style),s.extra_json)try{const e=JSON.parse(s.extra_json);Object.assign(n,e)}catch(e){console.warn("图片额外参数 JSON 解析失败:",e)}const a=await l.jV.post("images/generations",n);if(0!==a.code)throw new Error(a.message||"图片生成失败");const i=a.data||{},c=(i.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),o=c.map((e,t)=>`![生成图片${t+1}](${e.url||`data:image/png;base64,${e.b64_json}`})${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:i.session_id||t,images:c,text:o||`生成了 ${c.length} 张图片`}}async function F(e,t,s,n){try{switch(e){case"images":{const e=await E(t,s);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,t){const s={input:e,session_id:t};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const t=JSON.parse(e);t.voice&&(s.voice=t.voice),t.speed&&(s.speed=parseFloat(t.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(s)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||t,c=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(c)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(t,s);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,t){const s=await l.jV.post("embeddings",{input:e,session_id:t});if(0!==s.code)throw new Error(s.message||"Embeddings 请求失败");const n=s.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||t,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(t,s);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var L=s(57952),O=s(23430),V=s(87361);const q=({currentModelName:e,setCurrentModelName:t,envConfigRef:s,sysPromptList:n,batchMode:o,selectedMsgCount:r,onToggleSessionPanel:u,onCreateSession:h,onToggleBatchMode:p,onBatchDeleteMessages:f,bgProcessVisible:j,bgProcessCount:v,onToggleBgProcess:b,selectedSysPromptId:y,setSelectedSysPromptId:w})=>{const{t:S}=(0,i.Bd)(),N=(0,c.Zp)(),{check_user_auth:k}=(0,d.MH)(),[,C]=(0,a.fp)(x.AG.ai_session_collapsed);return(0,$.jsxs)(L.A,{children:[(0,$.jsx)(A.rA,{icon:"menu",title:S("会话"),onClick:u}),(0,$.jsx)(A.rA,{icon:"add",title:S("新会话"),onClick:()=>h()}),n.length>0&&(0,$.jsx)(_.l6,{value:y,options:[{title:S("选择系统提示词"),value:""},...n.map(e=>({title:e.note||e.prompt.slice(0,30),value:String(e.index)}))],onChange:e=>{w(e)},no_border:!0,width:"10rem"}),(s.current?.ai_config_env?.options_agent_model_list?.length??0)>0&&(0,$.jsx)(_.l6,{value:e,options:s.current.ai_config_env.options_agent_model_list?.map(e=>({title:e.label,value:e.value}))??[],onChange:e=>{t(e),l.jV.post("set_active_model",{model_name:e}).then(()=>{(0,m.SK)("success"),l.XO.get("ai_agent_setting/env").then(e=>{e.code===g.m.Success&&(s.current=e.data)})}).catch(console.error)},no_border:!0,width:"auto"}),o&&r>0&&(0,$.jsx)(A.rA,{icon:"delete",title:S("删除选中消息"),onClick:f}),(0,$.jsx)(A.rA,{icon:"terminal",title:S("后台进程"),onClick:b,selected:j,tip:v||null}),k(O.oV.ai_agent_setting)&&(0,$.jsx)(A.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{N(`/${V.o.ai_rebot_setting_page}`)}}),k(O.oV.ai_agent_setting)&&(0,$.jsx)(A.rA,{icon:"settings",title:"ai setting",onClick:()=>{N(`/${V.o.ai_agent_setting_page}`)}})]})};var B=s(27690);function K({sessions:e,activeSessionId:t,onSelectSession:s,onRenameSession:c,onDeleteSession:o,onShowUsageStats:l,batchMode:r,selectedSessionIds:d,onToggleSessionSelect:u,onToggleBatchMode:m,onBatchDeleteSessions:h,onClearAllSessions:g}){const{t:p}=(0,i.Bd)(),[_,f]=(0,a.fp)(x.AG.ai_session_collapsed),[j,v]=(0,n.useState)(""),b=j.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(j.toLowerCase())||(e.summary||"").toLowerCase().includes(j.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(j.toLowerCase())):e;return(0,$.jsxs)("aside",{className:`chat-session-list ${_?"active":""} ${_?"collapsed":""}`,children:[(0,$.jsx)("div",{className:"chat-session-search",children:(0,$.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:p("搜索会话"),value:j,onChange:e=>v(e.target.value)})}),(0,$.jsx)("div",{className:"chat-session-items-wrap",children:b.map(e=>{return(0,$.jsx)("div",{children:(0,$.jsxs)("button",{className:`chat-session-item ${t===e.id?"active":""} ${r?"batch-mode":""}`,onClick:()=>{r&&u?u(e.id):s(e.id)},title:e.summary||e.long_term_memory||e.title,children:[r&&(0,$.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:d?.has(e.id)??!1,onChange:()=>u?.(e.id),onClick:e=>e.stopPropagation()}),(0,$.jsx)("span",{children:(n=e.title,n||"新会话")}),(0,$.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,$.jsx)("em",{className:"chat-session-source",children:e.source}),!r&&(0,$.jsx)(B.MenuSelect,{list:[{name:p("重命名"),click:()=>c(e.id,e.title)},{name:p("字符消耗统计"),click:()=>l(e.id)},{name:p("删除"),click:()=>o(e.id)}],children:(0,$.jsx)(A.In,{icon:"more_horiz"})})]})},e.id);var n})}),(0,$.jsxs)("div",{className:"chat-session-actions",children:[(0,$.jsx)(A.rA,{icon:r?"check_circle":"checklist",title:p(r?"取消批量选择":"批量选择"),onClick:m}),r&&(d?.size??0)>0&&(0,$.jsx)(A.rA,{icon:"delete",title:p("删除选中会话"),onClick:h}),!r&&(0,$.jsx)(A.rA,{icon:"delete_sweep",title:p("删除全部会话"),onClick:g})]})]})}const z=({messages:e,batchMode:t,selectedMsgIds:s,sending:n,chatContainerRef:a,messagesEndRef:i,onToggleMsgSelect:c,onDelete:o,onCopy:l,onToggleBatchMode:r,t:d})=>(0,$.jsxs)("div",{className:"chat-messages",ref:a,"data-sending":n?"true":"false",children:[e.map(e=>(0,$.jsxs)("div",{className:`chat-message ${e.sender} ${t?"batch-mode":""} ${e.is_loading?"is-loading":""}`,children:[t&&(0,$.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:s.has(e.id),onChange:()=>c(e.id)}),e.is_loading?(0,$.jsxs)("div",{className:"ai-loading-bubble",children:[(0,$.jsxs)("div",{className:"ai-loading-dots",children:[(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"})]}),(0,$.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,$.jsxs)($.Fragment,{children:[M(e),(0,$.jsx)("div",{className:"message-actions",children:t?(0,$.jsx)("button",{onClick:()=>c(e.id),children:s.has(e.id)?d("取消选择"):d("选择")}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("button",{onClick:()=>o(e.id),children:d("删除")}),(0,$.jsx)("button",{onClick:()=>l(e.text),children:d("复制")}),(0,$.jsx)("button",{onClick:r,children:d("多选")})]})})]})]},e.id)),(0,$.jsx)("div",{ref:i})]});function J({onClose:e}){const{t}=(0,i.Bd)(),[s,c]=(0,a.fp)(x.AG.ai_images_extra_params),[o,l]=(0,n.useState)(s.size||"1024x1024"),[r,d]=(0,n.useState)(String(s.n??1)),[u,m]=(0,n.useState)(s.quality||""),[h,g]=(0,n.useState)(s.style||""),[p,f]=(0,n.useState)(s.extra_json||"");return(0,$.jsxs)("div",{className:"card floating",children:[(0,$.jsx)("div",{className:"card-title",children:(0,$.jsx)("h2",{children:t("图片生成参数设置")})}),(0,$.jsxs)("div",{className:"card-content",children:[(0,$.jsx)(_.Sm,{placeholderOut:t("图片尺寸 (size)"),value:o,handleInputChange:l,placeholder:"1024x1024"}),(0,$.jsx)(_.Sm,{placeholderOut:t("生成数量 (n)"),value:r,handleInputChange:d,type:"number"}),(0,$.jsx)(_.Sm,{placeholderOut:t("画质 (quality)"),value:u,handleInputChange:m,placeholder:"standard / hd"}),(0,$.jsx)(_.Sm,{placeholderOut:t("风格 (style)"),value:h,handleInputChange:g,placeholder:"vivid / natural"}),(0,$.jsx)(_.Sm,{placeholderOut:t("额外参数 JSON"),value:p,handleInputChange:f,placeholder:'{"key":"value"}'})]}),(0,$.jsxs)("div",{className:"card-action",children:[(0,$.jsx)("button",{className:"button button--flat button--grey",onClick:e,children:t("取消")}),(0,$.jsx)("button",{className:"button button--flat",onClick:()=>{const t={size:o,n:parseInt(r)||1};u&&(t.quality=u),h&&(t.style=h),p&&(t.extra_json=p),c(t),e()},children:t("确定")})]})]})}function G({requestType:e}){const{t}=(0,i.Bd)(),[s,a]=(0,n.useState)(!1);return"completions"===e?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A.rA,{icon:"tune",title:t("模型参数设置"),onClick:()=>a(!0)}),s&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("div",{className:"overlay",onClick:()=>a(!1)}),"images"===e&&(0,$.jsx)(J,{onClose:()=>a(!1)})]})]})}const W=(0,n.forwardRef)(function({placeholder:e="",disabled:t=!1,className:s,style:a,onEnter:i,onPaste:c,onChange:o},l){const r=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{const e=r.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(l,()=>({getValue:()=>g(),setValue:e=>{const t=r.current;if(!t)return;t.textContent=e,u(!e);const s=document.createRange();s.selectNodeContents(t),s.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(s)},clear:()=>{const e=r.current;e&&(e.textContent="",u(!0))},focus:()=>r.current?.focus()})),(0,n.useEffect)(()=>{const e=r.current;if(!e)return;const t=()=>u(!e.textContent);return e.addEventListener("input",t),()=>e.removeEventListener("input",t)},[]);return(0,$.jsx)("div",{ref:r,contentEditable:!t,suppressContentEditableWarning:!0,className:"rich-textarea"+(s?" "+s:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),i?.())},onPaste:c,onInput:()=>o?.(g()),onCompositionStart:()=>h(!0),onCompositionEnd:()=>h(!1),"data-placeholder":d?e:void 0})});function Q({pendingAttachments:e,onRemove:t}){return 0===e.length?null:(0,$.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,s)=>(0,$.jsxs)("div",{className:"chat-attachment-chip",children:[(0,$.jsx)(A.In,{icon:"attach_file"}),(0,$.jsx)("span",{title:e.name,children:e.name}),(0,$.jsx)("button",{type:"button",onClick:()=>t(s),children:(0,$.jsx)(A.In,{icon:"close"})})]},`${e.name}_${s}`))})}const U=(0,n.forwardRef)(({onSend:e,sending:t,onAbort:s,pendingAttachments:c,onRemoveAttachment:o,onOpenFilePicker:l,onAddFiles:r,onDrop:d,onDragOver:u,fileInputRef:m,requestType:h},g)=>{const{t:p}=(0,i.Bd)(),_=(0,n.useRef)(null),[f,j]=(0,n.useState)(!1),v=(0,n.useRef)(null),[b,y]=(0,a.fp)(x.AG.ai_chat_input_height);(0,n.useImperativeHandle)(g,()=>({getValue:()=>_.current?.getValue()??"",setValue:e=>_.current?.setValue(e),clear:()=>_.current?.clear()}));const w=(0,n.useCallback)(e=>{const t=v.current;if(!t)return;const s=t.getBoundingClientRect().bottom-e.clientY;let n=Math.round(s/21.375);n=Math.max(2,Math.min(20,n)),y(n)},[y]),S=(0,n.useCallback)(()=>j(!0),[]),N=(0,n.useCallback)(()=>j(!1),[]);(0,n.useEffect)(()=>{if(!f)return;const e=w;return window.addEventListener("pointermove",e),window.addEventListener("pointerup",N),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",N)}},[f,w,N]);const k={minHeight:`${b}em`,maxHeight:`${b}em`};return(0,$.jsxs)("div",{ref:v,className:"chat-input-area",onDrop:d,onDragOver:u,children:[(0,$.jsx)("div",{className:"chat-input-resize-handle"+(f?" dragging":""),onPointerDown:S}),(0,$.jsx)("input",{ref:m,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(r(e.target.files),e.currentTarget.value="")}}),(0,$.jsxs)("div",{className:"chat-input-shell",style:k,children:[(0,$.jsx)(Q,{pendingAttachments:c,onRemove:o}),(0,$.jsx)(W,{ref:_,placeholder:p("输入消息"),onEnter:()=>e(),onPaste:e=>{const t=e.clipboardData?.files;t&&t.length>0&&(e.preventDefault(),r(t))},className:"chat-input",style:k})]}),(0,$.jsx)(A.rA,{title:p("添加文件"),icon:"attach_file",onClick:l}),(0,$.jsx)(G,{requestType:h}),t?(0,$.jsx)(A.Vi,{color:"var( --icon-red)",text:p("暂停"),clickFun:s}):(0,$.jsx)(A.Vi,{text:p("发送"),clickFun:e}),f&&(0,$.jsx)("div",{className:"chat-input-overlay",onPointerUp:N})]})}),X={},Z=function(){const{t:e}=(0,i.Bd)(),[t,s]=(0,n.useState)([]),[c,l]=(0,n.useState)(!1),[r,d]=(0,n.useState)(null),[u,h]=(0,n.useState)(null),[g,p]=(0,n.useState)(!1),[_,f]=(0,a.fp)(x.AG.ai_bg_expanded),[,j]=(0,a.fp)(x.AG.ai_session_collapsed),v=()=>{f(!1)},b=(0,n.useCallback)(async()=>{l(!0);try{const e=new o.hf(o.HK.ai_bg_process_list_req);e.context={};const t=await k.ws.send(e);t?.context?.processes&&(s(t.context.processes),X.onCountChange?.(t.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{l(!1)}},[]);X.refresh=b;const y=(0,n.useCallback)(async e=>{p(!0),d(e);try{const t=new o.hf(o.HK.ai_bg_process_output_req);t.context={pid:e};const s=await k.ws.send(t);h(s.context)}catch(e){console.error("获取进程输出失败",e),(0,m.zN)("获取进程输出失败")}finally{p(!1)}},[]),w=(0,n.useCallback)(async e=>{try{const t=new o.hf(o.HK.ai_bg_process_kill_req);t.context={pid:e};const s=await k.ws.send(t);s?.context?.success?((0,m.SK)("进程已终止"),b(),r===e&&(d(null),h(null))):(0,m.zN)(s?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,m.zN)("终止进程失败")}},[b,r]);(0,n.useEffect)(()=>{b();const e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);const S=t.filter(e=>e.running),N=t.filter(e=>!e.running);return(0,$.jsxs)($.Fragment,{children:[_&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:v}),(0,$.jsxs)("aside",{className:"chat-bg-process-panel "+(_?"expanded":""),children:[(0,$.jsxs)("div",{className:"chat-bg-process-header",children:[(0,$.jsx)("span",{className:"chat-bg-process-title",children:e("后台进程")}),(0,$.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:v})]}),(0,$.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,$.jsx)(A.rA,{icon:"refresh",title:e("刷新"),onClick:b}),(0,$.jsxs)("span",{className:"chat-bg-process-count",children:[S.length," ",e("个运行中"),N.length>0&&` / ${N.length} ${e("个已退出")}`]})]}),(0,$.jsxs)("div",{className:"chat-bg-process-list",children:[c&&0===t.length&&(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}),!c&&0===t.length&&(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("暂无后台进程")}),S.map(t=>(0,$.jsxs)("div",{className:`chat-bg-process-item ${r===t.pid?"active":""} running`,children:[(0,$.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(t.pid),children:[(0,$.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",t.pid]}),(0,$.jsx)("span",{className:"chat-bg-process-cmd",title:t.cmd,children:t.cmd.length>40?t.cmd.slice(0,40)+"...":t.cmd}),(0,$.jsx)("span",{className:"chat-bg-process-time",children:new Date(t.start_time).toLocaleTimeString()}),(0,$.jsx)("span",{className:"chat-bg-process-status running-dot",title:e("运行中"),children:"●"})]}),(0,$.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,$.jsx)(A.rA,{icon:"terminal",title:e("查看输出"),onClick:()=>y(t.pid)}),(0,$.jsx)(A.rA,{icon:"stop",title:e("终止进程"),onClick:()=>w(t.pid)})]})]},t.pid)),N.map(e=>(0,$.jsx)("div",{className:`chat-bg-process-item ${r===e.pid?"active":""} finished`,children:(0,$.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,$.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,$.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,$.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,$.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==r&&(0,$.jsxs)("div",{className:"chat-bg-process-output",children:[(0,$.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,$.jsxs)("span",{children:["PID: ",r," ",e("输出")]}),(0,$.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:()=>{d(null),h(null)}})]}),(0,$.jsx)("div",{className:"chat-bg-process-output-content",children:g?(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}):u?(0,$.jsx)("pre",{className:"chat-bg-process-output-pre",children:u.output||e("(无输出)")}):null})]})]})]})};function Y(){const{t:e}=(0,i.Bd)(),t=((0,c.Zp)(),(0,h.y)()),{check_user_auth:s}=(0,d.MH)();(0,p.w)();const[b,y]=(0,n.useState)([]),[w,S]=(0,n.useState)([]),[C,A]=(0,n.useState)(""),[I,M]=(0,n.useState)(!1),D=(0,n.useRef)(null),[T,R]=(0,n.useState)([]),[H,P]=(0,a.fp)(x.AG.ai_session_collapsed),[E,L]=(0,a.fp)(x.AG.ai_bg_expanded),[O,V]=(0,a.fp)(x.AG.prompt_card),[B,J]=(0,n.useState)(!1),[G,W]=(0,n.useState)(new Set),[Q,Y]=(0,n.useState)(new Set),[ee,te]=(0,n.useState)(""),se=(0,n.useRef)(null),ne=(0,n.useRef)(null),ae=(0,n.useRef)(null),ie=(0,n.useRef)(!0),ce=(0,n.useRef)(new f.qq),[oe,le]=(0,n.useState)([]),[re,de]=(0,n.useState)(""),[ue,me]=(0,n.useState)(0),he=()=>ce?.current?.ai_config?.request_type||"completions",ge=(0,n.useRef)((0,r.sg)(e=>{y(e),ie.current&&pe(!1)},50)).current,pe=(e=!1)=>{const t=ae.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e?"smooth":"auto"})},xe=async()=>{const e=await l.jV.get("sessions");e.code===g.m.Success&&S(e.data??[])},_e=function(e){const{getMessages:t,setMessages:s,setMessagesDebounced:a,setSending:i,getActiveSessionId:c,setActiveSessionId:l,refreshSessions:r,scrollToBottom:d,buildRequestMessages:u,getSelectedSysPromptId:m}=e,h=(0,n.useRef)([]),g=(0,n.useRef)(null),p=(e,n,c)=>{const l=[...t(),n];s(l),i(!0),g.current={abort:()=>{}};const h={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};l.push(h),s([...l]);const p=new Map;let x=!0,_=h;const f=e=>{const t=e.context||{},s=t.text||"",n=t.tool_call_ends,i=t.chunk_index??0;if("[DONE]"!==s)if(x)x=!1,_.text=s,n&&(_.content_list=[{tool_call_ends:n,content:_.text,role:"assistant"}]),_.is_loading=!1,_.chunk_index=i,p.set(i,_),a([...l]);else{const e=p.get(i);if(e)e.text+=s,n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),a([...l]);else{const e={id:Date.now()+Math.random(),sender:"bot",text:s,chunk_index:i};n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),l.push(e),p.set(i,e),a([...l])}}},j=e=>{b(),g.current=null,i(!1),_.is_loading=!1,r(),d(!0),c()},v=e=>{b(),g.current=null,i(!1);const t=e.context||{};_.text="AI请求出错: "+(t.message||"未知错误"),_.is_loading=!1,s([...l]),c()},b=()=>{k.ws.off_message(`message_${o.HK.ai_chat_msg}`,f),k.ws.off_message(`message_${o.HK.ai_chat_end}`,j),k.ws.off_message(`message_${o.HK.ai_chat_error}`,v)};k.ws.addMsg(o.HK.ai_chat_msg,f),k.ws.addMsg(o.HK.ai_chat_end,j),k.ws.addMsg(o.HK.ai_chat_error,v),k.ws.sendData(o.HK.ai_chat_req,{messages:u(n),session_id:e,sys_prompt_id:m()})},x=()=>{const e=h.current;if(0===e.length)return;const t=e.shift();if(!t)return;s(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:t.text,attachments:t.attachments};p(c(),n,x)};return{startChatStream:p,processPendingQueue:x,enqueueMessage:(e,t)=>{h.current.push({text:e,attachments:t})},getQueueLength:()=>h.current.length,abort:()=>{g.current&&(k.ws.sendData(o.HK.ai_chat_abort,{session_id:c()}),g.current=null,i(!1))}}}({getMessages:()=>b,setMessages:y,setMessagesDebounced:ge,setSending:M,getActiveSessionId:()=>C,setActiveSessionId:A,refreshSessions:xe,scrollToBottom:pe,buildRequestMessages:e=>{const t=(e.attachments??[]).filter(e=>"image"===e.kind);if(t.length>0){const s=[];e.text&&s.push({type:"text",text:e.text});for(const e of t)s.push({type:"image_url",image_url:{url:e.content}});return[{content:s,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>ee}),fe=async e=>{const t=await l.jV.get("sessions");if(t.code!==g.m.Success)return;const s=t.data??[];S(s);const n=null===e?s[0]?.id??"":e||C||s[0]?.id||"";n?await je(n):(y([]),A(""))},je=async(e,t=!1)=>{const s=await l.jV.post("session/get",{session_id:e});if(s.code!==g.m.Success||!s.data)return;const n=s.data;A(n.id),y(function(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,t)=>({id:Date.now()+t,sender:"assistant"===e.role?"bot":"user",text:v(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings}))}(n.messages)),t&&P(!1),X.refresh?.(),requestAnimationFrame(()=>pe(!1))},ve=e=>{const t=Array.from(e??[]).filter(Boolean);t.length&&R(e=>[...e,...t])},be=()=>{B&&(W(new Set),Y(new Set)),J(e=>!e)};(0,n.useEffect)(()=>((async()=>{const e=await l.XO.get("ai_agent_setting/env");if(e.code===g.m.Success){ce.current=e.data;const t=e.data.ai_config?.model||"",s=(e.data.ai_config_env?.options_agent_model_list??[]).find(e=>e.label===t);de(s?s.value:t)}await fe();const t=await l.jV.get("system_prompts");t.code===g.m.Success&&le(t.data??[])})(),requestAnimationFrame(()=>pe(!1)),X.onCountChange=me,X.refresh?.(),k.ws.addMsg(o.HK.ai_bg_process_count_notify,e=>{const t=e?.context?.count;"number"==typeof t&&me(t)}),()=>{k.ws.removeMsg(o.HK.ai_bg_process_count_notify)}),[]),(0,n.useEffect)(()=>{const e=ae.current;if(!e)return;const t=()=>{ie.current=((e,t=120)=>{const{scrollTop:s,scrollHeight:n,clientHeight:a}=e;return n-(s+a)<t})(e)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[]),(0,n.useLayoutEffect)(()=>{ie.current&&pe(!1)},[b]);return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)(q,{currentModelName:re,setCurrentModelName:de,envConfigRef:ce,sysPromptList:oe,batchMode:B,selectedMsgCount:G.size,onToggleSessionPanel:()=>{P(e=>!e)},onCreateSession:async e=>{const t=await l.jV.post("session",{title:"新会话"});if(t.code!==g.m.Success)return;const s=t.data;A(s.id),y([]),P(!1),await fe(s.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:()=>{0!==G.size&&t({sub_title:e("确认删除选中的聊天消息吗?"),confirm_fun:async()=>{const e=[];b.forEach((t,s)=>{G.has(t.id)&&e.push(s)}),y(b.filter(e=>!G.has(e.id))),W(new Set),J(!1),C&&e.length>0&&l.jV.post("session/message/delete",{session_id:C,indices:e}).catch(console.error)}})},bgProcessVisible:E,bgProcessCount:ue,onToggleBgProcess:()=>L(e=>!e),selectedSysPromptId:ee,setSelectedSysPromptId:te}),(0,$.jsxs)("div",{className:"chat-page chat-page-with-sessions",children:[H&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:()=>P(!1)}),(0,$.jsx)(K,{sessions:w,activeSessionId:C,onSelectSession:e=>je(e,!1),onRenameSession:(e,s)=>{let n=s;t({confirm_fun:async()=>{await l.jV.post("sessions/update/meta",{id:e,title:n}),await fe(C)},context_div:(0,$.jsx)("div",{className:"card-content",children:(0,$.jsx)(_.Sm,{value:n,handleInputChange:e=>{n=e}})})})},onDeleteSession:e=>{t({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await l.jV.post("session/delete",{session_id:e}),C===e?(A(""),await fe(null)):await fe(C)}})},onShowUsageStats:async t=>{V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-loading",children:e("加载中...")}),cancel:()=>V({open:!1})});try{const s=await l.jV.post("session/usage_stats",{session_id:t});if(s.code===g.m.Success&&s.data){const t=s.data;V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsxs)("div",{className:"usage-stats-panel",children:[[{l:e("对话轮次"),v:(t.turns??0).toString()},{l:e("AI输入Token"),v:j(t.input_tokens)},{l:e("AI输出Token"),v:j(t.output_tokens)},{l:e("AI输入Token(最近一轮)"),v:j(t.recent_input_tokens)},{l:e("AI输出Token(最近一轮)"),v:j(t.recent_output_tokens)}].map((e,t)=>(0,$.jsxs)("div",{className:"usage-stats-row",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,$.jsx)("span",{className:"usage-stats-value",children:e.v})]},t)),(0,$.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e("AI Token总计消耗")}),(0,$.jsx)("span",{className:"usage-stats-value",children:j((t.input_tokens||0)+(t.output_tokens||0))})]})]}),cancel:()=>V({open:!1})})}else V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>V({open:!1})})}catch{V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>V({open:!1})})}},batchMode:B,selectedSessionIds:Q,onToggleSessionSelect:e=>{Y(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onToggleBatchMode:be,onBatchDeleteSessions:()=>{0!==Q.size&&t({sub_title:e("确认删除选中的会话吗?"),confirm_fun:async()=>{for(const e of Q)await l.jV.post("session/delete",{session_id:e});Y(new Set),J(!1),Q.has(C)?(A(""),await fe(null)):await fe(C)}})},onClearAllSessions:()=>{t({sub_title:e("确认删除全部聊天会话吗?"),confirm_fun:async()=>{await l.jV.post("sessions/clear",{}),A(""),y([]),await fe(null)}})}}),(0,$.jsx)(Z,{}),(0,$.jsxs)("section",{className:"chat-main",children:[0===b?.length&&(0,$.jsx)("div",{className:"chat-header",children:(0,$.jsx)("div",{children:e("询问服务器的一切")})}),(0,$.jsx)(z,{messages:b,batchMode:B,selectedMsgIds:G,sending:I,chatContainerRef:ae,messagesEndRef:ne,onToggleMsgSelect:e=>{W(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onDelete:s=>{t({sub_title:e("确认删除这条消息吗?"),confirm_fun:async()=>{const e=b.findIndex(e=>e.id===s);if(e<0)return;const t=b.filter(e=>e.id!==s);y(t),C&&l.jV.post("session/message/delete",{session_id:C,indices:[e]}).catch(console.error)}})},onCopy:async e=>{(0,u.lW)(e),(0,m.SK)("复制成功")},onToggleBatchMode:be,t:e}),(0,$.jsx)(U,{ref:D,onSend:async()=>{const e=(D.current?.getValue()??"").trim();if(!e&&0===T.length)return;if(I){const t=await N(T);_e.enqueueMessage(e,t),D.current?.clear(),R([]);const s={id:Date.now(),sender:"user",text:e+(_e.getQueueLength()>1?" ⏳(排队中...)":""),attachments:t};return void y(e=>[...e,s])}let t=C;if(!t){const s=await l.jV.post("session",{title:(e||T[0]?.name||"新会话").slice(0,28)});if(s.code!==g.m.Success)return;t=s.data.id,A(t),await fe(t)}const s=await N(T),n={id:Date.now(),sender:"user",text:e,attachments:s};D.current?.clear(),R([]);const a=he();if("completions"!==a){const s={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},i=[...b,n,s];y(i),M(!0);return void(await F(a,e,t,async(e,t)=>{s.text=e,s.is_loading=!1,t?.images&&(s.images=t.images),t?.audio&&(s.audio=t.audio),t?.embeddings&&(s.embeddings=t.embeddings),y([...i]),M(!1),xe(),pe(!0),_e.processPendingQueue()})||(s.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,s.is_loading=!1,y([...i]),M(!1),_e.processPendingQueue()))}_e.startChatStream(t,n,()=>_e.processPendingQueue())},sending:I,onAbort:_e.abort,pendingAttachments:T,onRemoveAttachment:e=>{R(t=>t.filter((t,s)=>s!==e))},onOpenFilePicker:()=>{se.current?.click()},onAddFiles:ve,onDrop:e=>{const t=e.dataTransfer?.files;t&&t.length>0&&(e.preventDefault(),ve(t))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:se,requestType:he()})]})]})]})}},72693(e,t,s){s.d(t,{w:()=>u});var n=s(96540),a=s(34899),i=s(14944),c=s(92275),o=s(34843),l=s(82893),r=s(85997),d=s(74848);function u(){const[e,t]=(0,o.fp)(l.AG.prompt_card),{t:s}=(0,a.Bd)(),u=(0,n.useRef)([]),m=(0,n.useRef)(!1),h=(0,n.useCallback)(()=>{if(m.current)return;if(0===u.current.length)return m.current=!1,void t({open:!1});m.current=!0;const e=u.current.shift();e?t({open:!0,title:s("命令确认"),cancel:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()},context_div:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),(0,d.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,d.jsx)(r.$n,{text:s("拒绝"),color:"var(--red)",clickFun:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()}}),(0,d.jsx)(r.$n,{text:s("允许"),clickFun:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!0}),t({open:!1}),m.current=!1,h()}})]})]})}):m.current=!1},[s]),g=(0,n.useCallback)(e=>{u.current.push(e),h()},[h]);(0,n.useEffect)(()=>(i.ws.addMsg(c.HK.ai_confirm_cmd,e=>{const s=e.context||{};if(s.dismiss&&s.askId)return u.current=u.current.filter(e=>e.askId!==s.askId),void(m.current&&(m.current=!1,t({open:!1}),h()));s.askId&&s.cmd&&g({askId:s.askId,cmd:s.cmd})}),()=>{i.ws.removeMsg(c.HK.ai_confirm_cmd)}),[g]),(0,n.useEffect)(()=>()=>{u.current=[],m.current=!1},[])}},34299(e,t,s){s.r(t),s.d(t,{default:()=>p});s(96540);var n=s(73557),a=s(53995),i=s(18569),c=s(77979),o=s(8263),l=s(69428),r=s.n(l),d=(s(3775),s(21499)),u=s(99214),m=s(19878),h=(s(72411),s(74848));const g=new n.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${g.utils.escapeHtml(e)}</code></pre>`}});function p(e){return(0,u.VD)(),(0,h.jsx)("div",{dangerouslySetInnerHTML:{__html:g.render(e.context)}})}g.use(a.A).use(i.A).use(c.A).use(o.A).use(r()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,s,n,a,i)=>{const c=t[s],o=c.content.trim(),l=c.info.trim();let r="";if(l&&m.A.getLanguage(l))try{r=m.A.highlight(o,{language:l}).value}catch(t){r=e.utils.escapeHtml(o)}else try{r=m.A.highlightAuto(o).value}catch(t){r=e.utils.escapeHtml(o)}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(o)}">复制</button>\n </div>\n <pre><code class="hljs ${l?`language-${l}`:""}">${r}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,s,n,a){return a.renderToken(e,t,s)};e.renderer.rules.link_open=(e,s,n,a,i)=>{const c=e[s],o=c.attrIndex("href");if(o>=0){const e=c.attrs[o][1];c.attrs[o][1]=(0,d.bi)(window.location.href,e)}return t(e,s,n,a,i)}})},45907(e,t,s){s.d(t,{y:()=>i});var n=s(34843),a=s(82893);function i(){const[e,t]=(0,n.fp)(a.AG.confirm);return({sub_title:e,confirm_fun:s,title:n,context_div:a})=>{t({open:!0,sub_title:e,handle:()=>{s(),t({open:!1,handle:null})},title:n,context_div:a})}}},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([[678,6010],{83277(e,t,s){s.d(t,{$j:()=>o,Lv:()=>a,qq:()=>i});class n{options_agent_url_list;options_agent_key_list;options_agent_model_list;options_local_file_path_prompt_list}class a{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 s of t)if(s.value===e)return s.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const s of t)if(s.value===e)return!0;return!1}}class i extends n{tool_error_max=50;tool_call_max=300;allow_exec_cmd_directly=!1;proxy_url;open_pick_model;max_recent_messages=12;compress_message_count=16;max_tool_content_chars=200}const c=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function o(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}s.d(t,["CP",0,'\n\n# 工具报错最大尝试次数\ntool_error_max=50\n# 聊天循环最大次数\ntool_call_max=300\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',"cL",0,c])},93583(e,t,s){s.r(t),s.d(t,{default:()=>Y});var n=s(96540),a=s(34843),i=s(34899),c=s(76213),o=s(92275),l=s(14284),r=s(7463),d=s(78247),u=s(40505),m=s(62042),h=s(45907),g=s(53459),p=s(72693),x=s(82893),_=s(61443),f=s(83277);function j(e){return null==e||e<0?"0":e.toLocaleString()}function v(e){const t=(0,f.$j)(e.content);if(t)return t;const s=e.content_list??[];return s.length?s.map(e=>(0,f.$j)(e.content)).filter(Boolean).join("\n\n"):""}const b=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function y(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||b.test(e.name)?"text":"binary"}function w(e){return e.text()}function S(e){return new Promise((t,s)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=s,n.readAsDataURL(e)})}async function N(e){const t=[];for(const s of e){const e=y(s);let n="";if("text"===e)try{const e=await w(s),t=12e4;n=e.length>t?`${e.slice(0,t)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await S(s)}catch{n=`[图片文件: ${s.name}]`}else n=`[二进制文件: ${s.name}]`;t.push({name:s.name,mime_type:s.type,size:s.size,kind:e,content:n})}return t}var k=s(14944);var C=s(52035),A=s(85997),I=s(34299),$=s(74848);function M(e){const t=e.attachments&&e.attachments.length>0?(0,$.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,t)=>(0,$.jsxs)("div",{className:"chat-message-attachment",children:[(0,$.jsx)(A.In,{icon:"attach_file"}),(0,$.jsx)("span",{children:e.name}),(0,$.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${t}`))}):null,s=[];e.images&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(T,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(R,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(P,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,$.jsx)(I.default,{context:e.text}):null;return(0,$.jsxs)($.Fragment,{children:[e.content_list.map((e,t)=>{const s=[],a=(0,f.$j)(e.content);return a&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(I.default,{context:a})},`content-${t}`)),e.tool_call_ends?.length&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(D,{callList:e.tool_call_ends})},`tool-${t}`)),(0,$.jsx)(n.Fragment,{children:s},`part-${t}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,$.jsx)(I.default,{context:e.text}):null]})}(e);return 0===s.length?(0,$.jsxs)($.Fragment,{children:[t,a]}):(0,$.jsxs)($.Fragment,{children:[s,t,a]})}function D({callList:e}){const[t,s]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,$.jsxs)("div",{className:"chat-message-call-list",children:[(0,$.jsxs)("div",{className:"call-list-header",onClick:()=>s(!t),children:[(0,$.jsx)(A.In,{icon:t?"expand_less":"expand_more"}),(0,$.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,$.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),t&&(0,$.jsx)("div",{className:"call-list-body",children:e.map((e,t)=>(0,$.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,$.jsxs)("div",{className:"call-list-item-header",children:[(0,$.jsx)(A.In,{icon:e.success?"check_circle":"error"}),(0,$.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,$.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"参数"}),(0,$.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"错误"}),(0,$.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"结果"}),(0,$.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},t))})]})}function T({images:e,text:t}){let s=e||[];if(!s.length&&t)try{s=JSON.parse(t).data||[]}catch{}return s.length?(0,$.jsxs)("div",{className:"image-generation-result",children:[s.map((e,t)=>(0,$.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${t+1}`,loading:"lazy"})}),e.b64_json&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${t+1}`})}),e.revised_prompt&&(0,$.jsx)("p",{className:"image-generation-prompt",children:(0,$.jsx)("small",{children:e.revised_prompt})})]},t)),t&&!e&&(0,$.jsx)(I.default,{context:t})]}):(0,$.jsx)(I.default,{context:t||""})}function R({audio:e,text:t}){if(e){if(e.url)return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const t=e.mime_type||"audio/mpeg";return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:${t};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const s=t||"";if(s.startsWith("http://")||s.startsWith("https://"))return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:s,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(s);if(e?.data||e?.audio_data){const t=e.data||e.audio_data;return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${t}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,$.jsx)(I.default,{context:s})}function H({content:e,label:t}){const[s,a]=n.useState(!1);return(0,$.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,u.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(A.In,{icon:s?"check":"content_copy"}),s?"已复制":t||"复制"]})}function P({embeddings:e,text:t}){let s=e||null;if(!s&&t)try{s=JSON.parse(t)}catch{return(0,$.jsx)(I.default,{context:t})}if(!s)return(0,$.jsx)(I.default,{context:t||""});const n=s?.data||[],a=s?.usage,i=JSON.stringify(s,null,2);return(0,$.jsxs)("div",{className:"embeddings-result",children:[(0,$.jsxs)("div",{className:"embeddings-summary",children:[(0,$.jsx)("strong",{children:"向量嵌入结果"}),(0,$.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,$.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,$.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,$.jsxs)("div",{className:"embeddings-toolbar",children:[(0,$.jsx)(H,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,$.jsx)(H,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,$.jsx)(H,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,$.jsx)("div",{className:"embeddings-preview",children:(0,$.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,$.jsxs)("details",{children:[(0,$.jsx)("summary",{children:"查看详细数据"}),(0,$.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function E(e,t){const s=function(){try{return(0,C.zp)().get(x.AG.ai_images_extra_params)||{}}catch{return{}}}(),n={prompt:e,n:s.n??1,size:s.size??"1024x1024",session_id:t};if(s.quality&&(n.quality=s.quality),s.style&&(n.style=s.style),s.extra_json)try{const e=JSON.parse(s.extra_json);Object.assign(n,e)}catch(e){console.warn("图片额外参数 JSON 解析失败:",e)}const a=await l.jV.post("images/generations",n);if(0!==a.code)throw new Error(a.message||"图片生成失败");const i=a.data||{},c=(i.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),o=c.map((e,t)=>`![生成图片${t+1}](${e.url||`data:image/png;base64,${e.b64_json}`})${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:i.session_id||t,images:c,text:o||`生成了 ${c.length} 张图片`}}async function F(e,t,s,n){try{switch(e){case"images":{const e=await E(t,s);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,t){const s={input:e,session_id:t};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const t=JSON.parse(e);t.voice&&(s.voice=t.voice),t.speed&&(s.speed=parseFloat(t.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(s)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||t,c=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(c)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(t,s);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,t){const s=await l.jV.post("embeddings",{input:e,session_id:t});if(0!==s.code)throw new Error(s.message||"Embeddings 请求失败");const n=s.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||t,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(t,s);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var L=s(57952),O=s(23430),V=s(87361);const q=({currentModelName:e,setCurrentModelName:t,envConfigRef:s,sysPromptList:n,batchMode:o,selectedMsgCount:r,onToggleSessionPanel:u,onCreateSession:h,onToggleBatchMode:p,onBatchDeleteMessages:f,bgProcessVisible:j,bgProcessCount:v,onToggleBgProcess:b,selectedSysPromptId:y,setSelectedSysPromptId:w})=>{const{t:S}=(0,i.Bd)(),N=(0,c.Zp)(),{check_user_auth:k}=(0,d.MH)(),[,C]=(0,a.fp)(x.AG.ai_session_collapsed);return(0,$.jsxs)(L.A,{children:[(0,$.jsx)(A.rA,{icon:"menu",title:S("会话"),onClick:u}),(0,$.jsx)(A.rA,{icon:"add",title:S("新会话"),onClick:()=>h()}),n.length>0&&(0,$.jsx)(_.l6,{value:y,options:[{title:S("选择系统提示词"),value:""},...n.map(e=>({title:e.note||e.prompt.slice(0,30),value:String(e.index)}))],onChange:e=>{w(e)},no_border:!0,width:"10rem"}),(s.current?.ai_config_env?.options_agent_model_list?.length??0)>0&&(0,$.jsx)(_.l6,{value:e,options:s.current.ai_config_env.options_agent_model_list?.map(e=>({title:e.label,value:e.value}))??[],onChange:e=>{t(e),l.jV.post("set_active_model",{model_name:e}).then(()=>{(0,m.SK)("success"),l.XO.get("ai_agent_setting/env").then(e=>{e.code===g.m.Success&&(s.current=e.data)})}).catch(console.error)},no_border:!0,width:"auto"}),o&&r>0&&(0,$.jsx)(A.rA,{icon:"delete",title:S("删除选中消息"),onClick:f}),(0,$.jsx)(A.rA,{icon:"terminal",title:S("后台进程"),onClick:b,selected:j,tip:v||null}),k(O.oV.ai_agent_setting)&&(0,$.jsx)(A.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{N(`/${V.o.ai_rebot_setting_page}`)}}),k(O.oV.ai_agent_setting)&&(0,$.jsx)(A.rA,{icon:"settings",title:"ai setting",onClick:()=>{N(`/${V.o.ai_agent_setting_page}`)}})]})};var B=s(27690);function K({sessions:e,activeSessionId:t,onSelectSession:s,onRenameSession:c,onDeleteSession:o,onShowUsageStats:l,batchMode:r,selectedSessionIds:d,onToggleSessionSelect:u,onToggleBatchMode:m,onBatchDeleteSessions:h,onClearAllSessions:g}){const{t:p}=(0,i.Bd)(),[_,f]=(0,a.fp)(x.AG.ai_session_collapsed),[j,v]=(0,n.useState)(""),b=j.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(j.toLowerCase())||(e.summary||"").toLowerCase().includes(j.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(j.toLowerCase())):e;return(0,$.jsxs)("aside",{className:`chat-session-list ${_?"active":""} ${_?"collapsed":""}`,children:[(0,$.jsx)("div",{className:"chat-session-search",children:(0,$.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:p("搜索会话"),value:j,onChange:e=>v(e.target.value)})}),(0,$.jsx)("div",{className:"chat-session-items-wrap",children:b.map(e=>{return(0,$.jsx)("div",{children:(0,$.jsxs)("button",{className:`chat-session-item ${t===e.id?"active":""} ${r?"batch-mode":""}`,onClick:()=>{r&&u?u(e.id):s(e.id)},title:e.summary||e.long_term_memory||e.title,children:[r&&(0,$.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:d?.has(e.id)??!1,onChange:()=>u?.(e.id),onClick:e=>e.stopPropagation()}),(0,$.jsx)("span",{children:(n=e.title,n||"新会话")}),(0,$.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,$.jsx)("em",{className:"chat-session-source",children:e.source}),!r&&(0,$.jsx)(B.MenuSelect,{list:[{name:p("重命名"),click:()=>c(e.id,e.title)},{name:p("字符消耗统计"),click:()=>l(e.id)},{name:p("删除"),click:()=>o(e.id)}],children:(0,$.jsx)(A.In,{icon:"more_horiz"})})]})},e.id);var n})}),(0,$.jsxs)("div",{className:"chat-session-actions",children:[(0,$.jsx)(A.rA,{icon:r?"check_circle":"checklist",title:p(r?"取消批量选择":"批量选择"),onClick:m}),r&&(d?.size??0)>0&&(0,$.jsx)(A.rA,{icon:"delete",title:p("删除选中会话"),onClick:h}),!r&&(0,$.jsx)(A.rA,{icon:"delete_sweep",title:p("删除全部会话"),onClick:g})]})]})}const z=({messages:e,batchMode:t,selectedMsgIds:s,sending:n,chatContainerRef:a,messagesEndRef:i,onToggleMsgSelect:c,onDelete:o,onCopy:l,onToggleBatchMode:r,t:d})=>(0,$.jsxs)("div",{className:"chat-messages",ref:a,"data-sending":n?"true":"false",children:[e.map(e=>(0,$.jsxs)("div",{className:`chat-message ${e.sender} ${t?"batch-mode":""} ${e.is_loading?"is-loading":""}`,children:[t&&(0,$.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:s.has(e.id),onChange:()=>c(e.id)}),e.is_loading?(0,$.jsxs)("div",{className:"ai-loading-bubble",children:[(0,$.jsxs)("div",{className:"ai-loading-dots",children:[(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"})]}),(0,$.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,$.jsxs)($.Fragment,{children:[M(e),(0,$.jsx)("div",{className:"message-actions",children:t?(0,$.jsx)("button",{onClick:()=>c(e.id),children:s.has(e.id)?d("取消选择"):d("选择")}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("button",{onClick:()=>o(e.id),children:d("删除")}),(0,$.jsx)("button",{onClick:()=>l(e.text),children:d("复制")}),(0,$.jsx)("button",{onClick:r,children:d("多选")})]})})]})]},e.id)),(0,$.jsx)("div",{ref:i})]});function J({onClose:e}){const{t}=(0,i.Bd)(),[s,c]=(0,a.fp)(x.AG.ai_images_extra_params),[o,l]=(0,n.useState)(s.size||"1024x1024"),[r,d]=(0,n.useState)(String(s.n??1)),[u,m]=(0,n.useState)(s.quality||""),[h,g]=(0,n.useState)(s.style||""),[p,f]=(0,n.useState)(s.extra_json||"");return(0,$.jsxs)("div",{className:"card floating",children:[(0,$.jsx)("div",{className:"card-title",children:(0,$.jsx)("h2",{children:t("图片生成参数设置")})}),(0,$.jsxs)("div",{className:"card-content",children:[(0,$.jsx)(_.Sm,{placeholderOut:t("图片尺寸 (size)"),value:o,handleInputChange:l,placeholder:"1024x1024"}),(0,$.jsx)(_.Sm,{placeholderOut:t("生成数量 (n)"),value:r,handleInputChange:d,type:"number"}),(0,$.jsx)(_.Sm,{placeholderOut:t("画质 (quality)"),value:u,handleInputChange:m,placeholder:"standard / hd"}),(0,$.jsx)(_.Sm,{placeholderOut:t("风格 (style)"),value:h,handleInputChange:g,placeholder:"vivid / natural"}),(0,$.jsx)(_.Sm,{placeholderOut:t("额外参数 JSON"),value:p,handleInputChange:f,placeholder:'{"key":"value"}'})]}),(0,$.jsxs)("div",{className:"card-action",children:[(0,$.jsx)("button",{className:"button button--flat button--grey",onClick:e,children:t("取消")}),(0,$.jsx)("button",{className:"button button--flat",onClick:()=>{const t={size:o,n:parseInt(r)||1};u&&(t.quality=u),h&&(t.style=h),p&&(t.extra_json=p),c(t),e()},children:t("确定")})]})]})}function G({requestType:e}){const{t}=(0,i.Bd)(),[s,a]=(0,n.useState)(!1);return"completions"===e?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A.rA,{icon:"tune",title:t("模型参数设置"),onClick:()=>a(!0)}),s&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("div",{className:"overlay",onClick:()=>a(!1)}),"images"===e&&(0,$.jsx)(J,{onClose:()=>a(!1)})]})]})}const W=(0,n.forwardRef)(function({placeholder:e="",disabled:t=!1,className:s,style:a,onEnter:i,onPaste:c,onChange:o},l){const r=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{const e=r.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(l,()=>({getValue:()=>g(),setValue:e=>{const t=r.current;if(!t)return;t.textContent=e,u(!e);const s=document.createRange();s.selectNodeContents(t),s.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(s)},clear:()=>{const e=r.current;e&&(e.textContent="",u(!0))},focus:()=>r.current?.focus()})),(0,n.useEffect)(()=>{const e=r.current;if(!e)return;const t=()=>u(!e.textContent);return e.addEventListener("input",t),()=>e.removeEventListener("input",t)},[]);return(0,$.jsx)("div",{ref:r,contentEditable:!t,suppressContentEditableWarning:!0,className:"rich-textarea"+(s?" "+s:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),i?.())},onPaste:c,onInput:()=>o?.(g()),onCompositionStart:()=>h(!0),onCompositionEnd:()=>h(!1),"data-placeholder":d?e:void 0})});function Q({pendingAttachments:e,onRemove:t}){return 0===e.length?null:(0,$.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,s)=>(0,$.jsxs)("div",{className:"chat-attachment-chip",children:[(0,$.jsx)(A.In,{icon:"attach_file"}),(0,$.jsx)("span",{title:e.name,children:e.name}),(0,$.jsx)("button",{type:"button",onClick:()=>t(s),children:(0,$.jsx)(A.In,{icon:"close"})})]},`${e.name}_${s}`))})}const U=(0,n.forwardRef)(({onSend:e,sending:t,onAbort:s,pendingAttachments:c,onRemoveAttachment:o,onOpenFilePicker:l,onAddFiles:r,onDrop:d,onDragOver:u,fileInputRef:m,requestType:h},g)=>{const{t:p}=(0,i.Bd)(),_=(0,n.useRef)(null),[f,j]=(0,n.useState)(!1),v=(0,n.useRef)(null),[b,y]=(0,a.fp)(x.AG.ai_chat_input_height);(0,n.useImperativeHandle)(g,()=>({getValue:()=>_.current?.getValue()??"",setValue:e=>_.current?.setValue(e),clear:()=>_.current?.clear()}));const w=(0,n.useCallback)(e=>{const t=v.current;if(!t)return;const s=t.getBoundingClientRect().bottom-e.clientY;let n=Math.round(s/21.375);n=Math.max(2,Math.min(20,n)),y(n)},[y]),S=(0,n.useCallback)(()=>j(!0),[]),N=(0,n.useCallback)(()=>j(!1),[]);(0,n.useEffect)(()=>{if(!f)return;const e=w;return window.addEventListener("pointermove",e),window.addEventListener("pointerup",N),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",N)}},[f,w,N]);const k={minHeight:`${b}em`,maxHeight:`${b}em`};return(0,$.jsxs)("div",{ref:v,className:"chat-input-area",onDrop:d,onDragOver:u,children:[(0,$.jsx)("div",{className:"chat-input-resize-handle"+(f?" dragging":""),onPointerDown:S}),(0,$.jsx)("input",{ref:m,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(r(e.target.files),e.currentTarget.value="")}}),(0,$.jsxs)("div",{className:"chat-input-shell",style:k,children:[(0,$.jsx)(Q,{pendingAttachments:c,onRemove:o}),(0,$.jsx)(W,{ref:_,placeholder:p("输入消息"),onEnter:()=>e(),onPaste:e=>{const t=e.clipboardData?.files;t&&t.length>0&&(e.preventDefault(),r(t))},className:"chat-input",style:k})]}),(0,$.jsx)(A.rA,{title:p("添加文件"),icon:"attach_file",onClick:l}),(0,$.jsx)(G,{requestType:h}),t?(0,$.jsx)(A.Vi,{color:"var( --icon-red)",text:p("暂停"),clickFun:s}):(0,$.jsx)(A.Vi,{text:p("发送"),clickFun:e}),f&&(0,$.jsx)("div",{className:"chat-input-overlay",onPointerUp:N})]})}),X={},Z=function(){const{t:e}=(0,i.Bd)(),[t,s]=(0,n.useState)([]),[c,l]=(0,n.useState)(!1),[r,d]=(0,n.useState)(null),[u,h]=(0,n.useState)(null),[g,p]=(0,n.useState)(!1),[_,f]=(0,a.fp)(x.AG.ai_bg_expanded),[,j]=(0,a.fp)(x.AG.ai_session_collapsed),v=()=>{f(!1)},b=(0,n.useCallback)(async()=>{l(!0);try{const e=new o.hf(o.HK.ai_bg_process_list_req);e.context={};const t=await k.ws.send(e);t?.context?.processes&&(s(t.context.processes),X.onCountChange?.(t.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{l(!1)}},[]);X.refresh=b;const y=(0,n.useCallback)(async e=>{p(!0),d(e);try{const t=new o.hf(o.HK.ai_bg_process_output_req);t.context={pid:e};const s=await k.ws.send(t);h(s.context)}catch(e){console.error("获取进程输出失败",e),(0,m.zN)("获取进程输出失败")}finally{p(!1)}},[]),w=(0,n.useCallback)(async e=>{try{const t=new o.hf(o.HK.ai_bg_process_kill_req);t.context={pid:e};const s=await k.ws.send(t);s?.context?.success?((0,m.SK)("进程已终止"),b(),r===e&&(d(null),h(null))):(0,m.zN)(s?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,m.zN)("终止进程失败")}},[b,r]);(0,n.useEffect)(()=>{b();const e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);const S=t.filter(e=>e.running),N=t.filter(e=>!e.running);return(0,$.jsxs)($.Fragment,{children:[_&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:v}),(0,$.jsxs)("aside",{className:"chat-bg-process-panel "+(_?"expanded":""),children:[(0,$.jsxs)("div",{className:"chat-bg-process-header",children:[(0,$.jsx)("span",{className:"chat-bg-process-title",children:e("后台进程")}),(0,$.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:v})]}),(0,$.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,$.jsx)(A.rA,{icon:"refresh",title:e("刷新"),onClick:b}),(0,$.jsxs)("span",{className:"chat-bg-process-count",children:[S.length," ",e("个运行中"),N.length>0&&` / ${N.length} ${e("个已退出")}`]})]}),(0,$.jsxs)("div",{className:"chat-bg-process-list",children:[c&&0===t.length&&(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}),!c&&0===t.length&&(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("暂无后台进程")}),S.map(t=>(0,$.jsxs)("div",{className:`chat-bg-process-item ${r===t.pid?"active":""} running`,children:[(0,$.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(t.pid),children:[(0,$.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",t.pid]}),(0,$.jsx)("span",{className:"chat-bg-process-cmd",title:t.cmd,children:t.cmd.length>40?t.cmd.slice(0,40)+"...":t.cmd}),(0,$.jsx)("span",{className:"chat-bg-process-time",children:new Date(t.start_time).toLocaleTimeString()}),(0,$.jsx)("span",{className:"chat-bg-process-status running-dot",title:e("运行中"),children:"●"})]}),(0,$.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,$.jsx)(A.rA,{icon:"terminal",title:e("查看输出"),onClick:()=>y(t.pid)}),(0,$.jsx)(A.rA,{icon:"stop",title:e("终止进程"),onClick:()=>w(t.pid)})]})]},t.pid)),N.map(e=>(0,$.jsx)("div",{className:`chat-bg-process-item ${r===e.pid?"active":""} finished`,children:(0,$.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,$.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,$.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,$.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,$.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==r&&(0,$.jsxs)("div",{className:"chat-bg-process-output",children:[(0,$.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,$.jsxs)("span",{children:["PID: ",r," ",e("输出")]}),(0,$.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:()=>{d(null),h(null)}})]}),(0,$.jsx)("div",{className:"chat-bg-process-output-content",children:g?(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}):u?(0,$.jsx)("pre",{className:"chat-bg-process-output-pre",children:u.output||e("(无输出)")}):null})]})]})]})};function Y(){const{t:e}=(0,i.Bd)(),t=((0,c.Zp)(),(0,h.y)()),{check_user_auth:s}=(0,d.MH)();(0,p.w)();const[b,y]=(0,n.useState)([]),[w,S]=(0,n.useState)([]),[C,A]=(0,n.useState)(""),[I,M]=(0,n.useState)(!1),D=(0,n.useRef)(null),[T,R]=(0,n.useState)([]),[H,P]=(0,a.fp)(x.AG.ai_session_collapsed),[E,L]=(0,a.fp)(x.AG.ai_bg_expanded),[O,V]=(0,a.fp)(x.AG.prompt_card),[B,J]=(0,n.useState)(!1),[G,W]=(0,n.useState)(new Set),[Q,Y]=(0,n.useState)(new Set),[ee,te]=(0,n.useState)(""),se=(0,n.useRef)(null),ne=(0,n.useRef)(null),ae=(0,n.useRef)(null),ie=(0,n.useRef)(!0),ce=(0,n.useRef)(new f.qq),[oe,le]=(0,n.useState)([]),[re,de]=(0,n.useState)(""),[ue,me]=(0,n.useState)(0),he=()=>ce?.current?.ai_config?.request_type||"completions",ge=(0,n.useRef)((0,r.sg)(e=>{y(e),ie.current&&pe(!1)},50)).current,pe=(e=!1)=>{const t=ae.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e?"smooth":"auto"})},xe=async()=>{const e=await l.jV.get("sessions");e.code===g.m.Success&&S(e.data??[])},_e=function(e){const{getMessages:t,setMessages:s,setMessagesDebounced:a,setSending:i,getActiveSessionId:c,setActiveSessionId:l,refreshSessions:r,scrollToBottom:d,buildRequestMessages:u,getSelectedSysPromptId:m}=e,h=(0,n.useRef)([]),g=(0,n.useRef)(null),p=(e,n,c)=>{const l=[...t(),n];s(l),i(!0),g.current={abort:()=>{}};const h={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};l.push(h),s([...l]);const p=new Map;let x=!0,_=h;const f=e=>{const t=e.context||{},s=t.text||"",n=t.tool_call_ends,i=t.chunk_index??0;if("[DONE]"!==s)if(x)x=!1,_.text=s,n&&(_.content_list=[{tool_call_ends:n,content:_.text,role:"assistant"}]),_.is_loading=!1,_.chunk_index=i,p.set(i,_),a([...l]);else{const e=p.get(i);if(e)e.text+=s,n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),a([...l]);else{const e={id:Date.now()+Math.random(),sender:"bot",text:s,chunk_index:i};n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),l.push(e),p.set(i,e),a([...l])}}},j=e=>{b(),g.current=null,i(!1),_.is_loading=!1,r(),d(!0),c()},v=e=>{b(),g.current=null,i(!1);const t=e.context||{};_.text="AI请求出错: "+(t.message||"未知错误"),_.is_loading=!1,s([...l]),c()},b=()=>{k.ws.off_message(`message_${o.HK.ai_chat_msg}`,f),k.ws.off_message(`message_${o.HK.ai_chat_end}`,j),k.ws.off_message(`message_${o.HK.ai_chat_error}`,v)};k.ws.addMsg(o.HK.ai_chat_msg,f),k.ws.addMsg(o.HK.ai_chat_end,j),k.ws.addMsg(o.HK.ai_chat_error,v),k.ws.sendData(o.HK.ai_chat_req,{messages:u(n),session_id:e,sys_prompt_id:m()})},x=()=>{const e=h.current;if(0===e.length)return;const t=e.shift();if(!t)return;s(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:t.text,attachments:t.attachments};p(c(),n,x)};return{startChatStream:p,processPendingQueue:x,enqueueMessage:(e,t)=>{h.current.push({text:e,attachments:t})},getQueueLength:()=>h.current.length,abort:()=>{g.current&&(k.ws.sendData(o.HK.ai_chat_abort,{session_id:c()}),g.current=null,i(!1))}}}({getMessages:()=>b,setMessages:y,setMessagesDebounced:ge,setSending:M,getActiveSessionId:()=>C,setActiveSessionId:A,refreshSessions:xe,scrollToBottom:pe,buildRequestMessages:e=>{const t=(e.attachments??[]).filter(e=>"image"===e.kind);if(t.length>0){const s=[];e.text&&s.push({type:"text",text:e.text});for(const e of t)s.push({type:"image_url",image_url:{url:e.content}});return[{content:s,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>ee}),fe=async e=>{const t=await l.jV.get("sessions");if(t.code!==g.m.Success)return;const s=t.data??[];S(s);const n=null===e?s[0]?.id??"":e||C||s[0]?.id||"";n?await je(n):(y([]),A(""))},je=async(e,t=!1)=>{const s=await l.jV.post("session/get",{session_id:e});if(s.code!==g.m.Success||!s.data)return;const n=s.data;A(n.id),y(function(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,t)=>({id:Date.now()+t,sender:"assistant"===e.role?"bot":"user",text:v(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings}))}(n.messages)),t&&P(!1),X.refresh?.(),requestAnimationFrame(()=>pe(!1))},ve=e=>{const t=Array.from(e??[]).filter(Boolean);t.length&&R(e=>[...e,...t])},be=()=>{B&&(W(new Set),Y(new Set)),J(e=>!e)};(0,n.useEffect)(()=>((async()=>{const e=await l.XO.get("ai_agent_setting/env");if(e.code===g.m.Success){ce.current=e.data;const t=e.data.ai_config?.model||"",s=(e.data.ai_config_env?.options_agent_model_list??[]).find(e=>e.label===t);de(s?s.value:t)}await fe();const t=await l.jV.get("system_prompts");t.code===g.m.Success&&le(t.data??[])})(),requestAnimationFrame(()=>pe(!1)),X.onCountChange=me,X.refresh?.(),k.ws.addMsg(o.HK.ai_bg_process_count_notify,e=>{const t=e?.context?.count;"number"==typeof t&&me(t)}),()=>{k.ws.removeMsg(o.HK.ai_bg_process_count_notify)}),[]),(0,n.useEffect)(()=>{const e=ae.current;if(!e)return;const t=()=>{ie.current=((e,t=120)=>{const{scrollTop:s,scrollHeight:n,clientHeight:a}=e;return n-(s+a)<t})(e)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[]),(0,n.useLayoutEffect)(()=>{ie.current&&pe(!1)},[b]);return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)(q,{currentModelName:re,setCurrentModelName:de,envConfigRef:ce,sysPromptList:oe,batchMode:B,selectedMsgCount:G.size,onToggleSessionPanel:()=>{P(e=>!e)},onCreateSession:async e=>{const t=await l.jV.post("session",{title:"新会话"});if(t.code!==g.m.Success)return;const s=t.data;A(s.id),y([]),P(!1),await fe(s.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:()=>{0!==G.size&&t({sub_title:e("确认删除选中的聊天消息吗?"),confirm_fun:async()=>{const e=[];b.forEach((t,s)=>{G.has(t.id)&&e.push(s)}),y(b.filter(e=>!G.has(e.id))),W(new Set),J(!1),C&&e.length>0&&l.jV.post("session/message/delete",{session_id:C,indices:e}).catch(console.error)}})},bgProcessVisible:E,bgProcessCount:ue,onToggleBgProcess:()=>L(e=>!e),selectedSysPromptId:ee,setSelectedSysPromptId:te}),(0,$.jsxs)("div",{className:"chat-page chat-page-with-sessions",children:[H&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:()=>P(!1)}),(0,$.jsx)(K,{sessions:w,activeSessionId:C,onSelectSession:e=>je(e,!1),onRenameSession:(e,s)=>{let n=s;t({confirm_fun:async()=>{await l.jV.post("sessions/update/meta",{id:e,title:n}),await fe(C)},context_div:(0,$.jsx)("div",{className:"card-content",children:(0,$.jsx)(_.Sm,{value:n,handleInputChange:e=>{n=e}})})})},onDeleteSession:e=>{t({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await l.jV.post("session/delete",{session_id:e}),C===e?(A(""),await fe(null)):await fe(C)}})},onShowUsageStats:async t=>{V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-loading",children:e("加载中...")}),cancel:()=>V({open:!1})});try{const s=await l.jV.post("session/usage_stats",{session_id:t});if(s.code===g.m.Success&&s.data){const t=s.data;V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsxs)("div",{className:"usage-stats-panel",children:[[{l:e("对话轮次"),v:(t.turns??0).toString()},{l:e("AI输入Token"),v:j(t.input_tokens)},{l:e("AI输出Token"),v:j(t.output_tokens)},{l:e("AI输入Token(最近一轮)"),v:j(t.recent_input_tokens)},{l:e("AI输出Token(最近一轮)"),v:j(t.recent_output_tokens)}].map((e,t)=>(0,$.jsxs)("div",{className:"usage-stats-row",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,$.jsx)("span",{className:"usage-stats-value",children:e.v})]},t)),(0,$.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e("AI Token总计消耗")}),(0,$.jsx)("span",{className:"usage-stats-value",children:j((t.input_tokens||0)+(t.output_tokens||0))})]})]}),cancel:()=>V({open:!1})})}else V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>V({open:!1})})}catch{V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>V({open:!1})})}},batchMode:B,selectedSessionIds:Q,onToggleSessionSelect:e=>{Y(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onToggleBatchMode:be,onBatchDeleteSessions:()=>{0!==Q.size&&t({sub_title:e("确认删除选中的会话吗?"),confirm_fun:async()=>{for(const e of Q)await l.jV.post("session/delete",{session_id:e});Y(new Set),J(!1),Q.has(C)?(A(""),await fe(null)):await fe(C)}})},onClearAllSessions:()=>{t({sub_title:e("确认删除全部聊天会话吗?"),confirm_fun:async()=>{await l.jV.post("sessions/clear",{}),A(""),y([]),await fe(null)}})}}),(0,$.jsx)(Z,{}),(0,$.jsxs)("section",{className:"chat-main",children:[0===b?.length&&(0,$.jsx)("div",{className:"chat-header",children:(0,$.jsx)("div",{children:e("询问服务器的一切")})}),(0,$.jsx)(z,{messages:b,batchMode:B,selectedMsgIds:G,sending:I,chatContainerRef:ae,messagesEndRef:ne,onToggleMsgSelect:e=>{W(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onDelete:s=>{t({sub_title:e("确认删除这条消息吗?"),confirm_fun:async()=>{const e=b.findIndex(e=>e.id===s);if(e<0)return;const t=b.filter(e=>e.id!==s);y(t),C&&l.jV.post("session/message/delete",{session_id:C,indices:[e]}).catch(console.error)}})},onCopy:async e=>{(0,u.lW)(e),(0,m.SK)("复制成功")},onToggleBatchMode:be,t:e}),(0,$.jsx)(U,{ref:D,onSend:async()=>{const e=(D.current?.getValue()??"").trim();if(!e&&0===T.length)return;if(I){const t=await N(T);_e.enqueueMessage(e,t),D.current?.clear(),R([]);const s={id:Date.now(),sender:"user",text:e+(_e.getQueueLength()>1?" ⏳(排队中...)":""),attachments:t};return void y(e=>[...e,s])}let t=C;if(!t){const s=await l.jV.post("session",{title:(e||T[0]?.name||"新会话").slice(0,28)});if(s.code!==g.m.Success)return;t=s.data.id,A(t),await fe(t)}const s=await N(T),n={id:Date.now(),sender:"user",text:e,attachments:s};D.current?.clear(),R([]);const a=he();if("completions"!==a){const s={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},i=[...b,n,s];y(i),M(!0);return void(await F(a,e,t,async(e,t)=>{s.text=e,s.is_loading=!1,t?.images&&(s.images=t.images),t?.audio&&(s.audio=t.audio),t?.embeddings&&(s.embeddings=t.embeddings),y([...i]),M(!1),xe(),pe(!0),_e.processPendingQueue()})||(s.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,s.is_loading=!1,y([...i]),M(!1),_e.processPendingQueue()))}_e.startChatStream(t,n,()=>_e.processPendingQueue())},sending:I,onAbort:_e.abort,pendingAttachments:T,onRemoveAttachment:e=>{R(t=>t.filter((t,s)=>s!==e))},onOpenFilePicker:()=>{se.current?.click()},onAddFiles:ve,onDrop:e=>{const t=e.dataTransfer?.files;t&&t.length>0&&(e.preventDefault(),ve(t))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:se,requestType:he()})]})]})]})}},72693(e,t,s){s.d(t,{w:()=>u});var n=s(96540),a=s(34899),i=s(14944),c=s(92275),o=s(34843),l=s(82893),r=s(85997),d=s(74848);function u(){const[e,t]=(0,o.fp)(l.AG.prompt_card),{t:s}=(0,a.Bd)(),u=(0,n.useRef)([]),m=(0,n.useRef)(!1),h=(0,n.useCallback)(()=>{if(m.current)return;if(0===u.current.length)return m.current=!1,void t({open:!1});m.current=!0;const e=u.current.shift();e?t({open:!0,title:s("命令确认"),cancel:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()},context_div:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),(0,d.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,d.jsx)(r.$n,{text:s("拒绝"),color:"var(--red)",clickFun:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()}}),(0,d.jsx)(r.$n,{text:s("允许"),clickFun:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!0}),t({open:!1}),m.current=!1,h()}})]})]})}):m.current=!1},[s]),g=(0,n.useCallback)(e=>{u.current.push(e),h()},[h]);(0,n.useEffect)(()=>(i.ws.addMsg(c.HK.ai_confirm_cmd,e=>{const s=e.context||{};if(s.dismiss&&s.askId)return u.current=u.current.filter(e=>e.askId!==s.askId),void(m.current&&(m.current=!1,t({open:!1}),h()));s.askId&&s.cmd&&g({askId:s.askId,cmd:s.cmd})}),()=>{i.ws.removeMsg(c.HK.ai_confirm_cmd)}),[g]),(0,n.useEffect)(()=>()=>{u.current=[],m.current=!1},[])}},34299(e,t,s){s.r(t),s.d(t,{default:()=>p});s(96540);var n=s(73557),a=s(53995),i=s(18569),c=s(77979),o=s(8263),l=s(69428),r=s.n(l),d=(s(3775),s(21499)),u=s(99214),m=s(19878),h=(s(72411),s(74848));const g=new n.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${g.utils.escapeHtml(e)}</code></pre>`}});function p(e){return(0,u.VD)(),(0,h.jsx)("div",{dangerouslySetInnerHTML:{__html:g.render(e.context)}})}g.use(a.A).use(i.A).use(c.A).use(o.A).use(r()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,s,n,a,i)=>{const c=t[s],o=c.content.trim(),l=c.info.trim();let r="";if(l&&m.A.getLanguage(l))try{r=m.A.highlight(o,{language:l}).value}catch(t){r=e.utils.escapeHtml(o)}else try{r=m.A.highlightAuto(o).value}catch(t){r=e.utils.escapeHtml(o)}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(o)}">复制</button>\n </div>\n <pre><code class="hljs ${l?`language-${l}`:""}">${r}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,s,n,a){return a.renderToken(e,t,s)};e.renderer.rules.link_open=(e,s,n,a,i)=>{const c=e[s],o=c.attrIndex("href");if(o>=0){const e=c.attrs[o][1];c.attrs[o][1]=(0,d.bi)(window.location.href,e)}return t(e,s,n,a,i)}})},45907(e,t,s){s.d(t,{y:()=>i});var n=s(34843),a=s(82893);function i(){const[e,t]=(0,n.fp)(a.AG.confirm);return({sub_title:e,confirm_fun:s,title:n,context_div:a})=>{t({open:!0,sub_title:e,handle:()=>{s(),t({open:!1,handle:null})},title:n,context_div:a})}}},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 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6892],{26892(e,t,c){c.r(t),c.d(t,{default:()=>m});c(96540);var s=c(83029),a=(c(27690),c(82893)),n=c(14284),i=c(53459),l=(c(85997),c(57952)),r=c(34899),d=c(78247),o=c(23430),_=c(34843),u=c(62042),f=c(74848);function m(){const{t:e}=(0,r.Bd)(),[t,c]=(0,_.fp)(a.AG.showPrompt),{check_user_auth:m}=(0,d.MH)();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.A,{}),(0,f.jsx)(s.N,{have_auth_edit:m(o.oV.net_site_tag_update),getItems:async()=>{const e=await n.sY.get();return e.code===i.m.Success?e.data:[]},save:async e=>{(await n.sY.post("save",e)).code===i.m.Success&&(0,u.SK)("保存成功")},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"color",preName:"color"}]})]})}},83029(e,t,c){c.d(t,{N:()=>k});var s=c(96540),a=c(34843),n=c(82893),i=c(74848);function l(e){const[t,c]=(0,a.fp)(n.AG.user_base_info);return(0,i.jsx)("div",{children:e.div?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,i.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var r=c(64694),d=c(61443),o=c(85997),_=c(61973),u=c(34899);const f=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,h,p=[];const v=[];function k(e){const[t,c]=(0,s.useState)([]),[k,x]=(0,s.useState)(-1),j=(0,_.zy)(),[y,b]=(0,s.useState)(!1),[g,C]=(0,s.useState)(!1),{t:N}=(0,u.Bd)(),[S,w]=(0,s.useState)([]),[I,A]=(0,a.fp)(n.AG.nav_index_add_item_by_now_list),D=e=>{-1!==k?v[k]._children=e:p=e};(0,s.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();p=t,c(p)})()},[j]);(0,s.useEffect)(()=>{if(I){const e=[...t,{name:"",color:(0,r.Lr)(f),...I}];D(e),c(e),b(!0),A(void 0)}},[I]);const F=e=>{x(k+1),c(e._children),v.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==k&&(0,i.jsx)(o.rA,{title:"返回",icon:"arrow_back",onClick:()=>{c(0===k?p:v[k-1]._children),x(k-1),v.pop()}}),t.map((a,n)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,n),onDrop:e=>((e,s)=>{e.preventDefault();const a=t[m],n=t[s];if(n&&"dir"===n._type){const e=[...t];return e.splice(m,1),n._children||(n._children=[]),n._children.push(a),D(e),void c(e)}const i=[...t],l=i[m];i.splice(m,1),i.splice(s,0,l),D(i),c(i)})(e,n),style:{cursor:y?"move":"pointer"},children:[(0,i.jsx)(l,{name:a.name,item:a,...a,div:y,target:"_blank",click_dir:F,clickItem:e.clickItem}),y&&(void 0!==S.find(e=>e===n)||g)&&(0,i.jsxs)("div",{className:g?"":" site_edit ",children:["dir"===a._type?(0,i.jsxs)(s.Fragment,{children:[(0,i.jsx)(d.Sm,{value:a.name,handleInputChange:e=>{a.name=e},placeholder:N("输入类目名"),no_border:!0}),(0,i.jsx)(d.Sm,{value:a.color,handleInputChange:e=>{a.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(d.Sm,{value:a[e.key],handleInputChange:t=>{a[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!g&&(0,i.jsx)(o.C3,{text:N("折叠"),clickFun:()=>{w((0,r.P1)(S,n))}})]}),y&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(o.C3,{text:N("删除"),clickFun:()=>{(e=>{const s=[...t];s.splice(e,1),D(s),c(s)})(n)}}),(0,i.jsx)(o.C3,{text:N("编辑"),clickFun:()=>{void 0===S.find(e=>e===n)&&w([...S,n])}})]})})]},n)),y&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(o.rA,{title:N("取消"),icon:"cancel",onClick:()=>{w([]),b(!1),h&&(c(h),D(h)),C(!1)}}),(0,i.jsx)(o.rA,{title:N("添加"),icon:"add",onClick:async()=>{const s=[...t,{name:"",color:(0,r.Lr)(f),...e.get_pre_add_item&&await e.get_pre_add_item()}];D(s),c(s)}}),(0,i.jsx)(o.rA,{title:N("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];D(e),c(e)}}),(0,i.jsx)(o.rA,{title:N("全部编辑"),icon:g?"unfold_less":"unfold_more",onClick:()=>{C(!g)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(o.rA,{icon:y?"save":"edit",title:N(y?"保存":"编辑"),onClick:async()=>{y?e.save&&await e.save(p):h=t,b(!y)}})]})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6892],{26892(e,t,c){c.r(t),c.d(t,{default:()=>m});c(96540);var s=c(83029),a=(c(27690),c(82893)),n=c(14284),i=c(53459),l=(c(85997),c(57952)),r=c(34899),d=c(78247),o=c(23430),_=c(34843),u=c(62042),f=c(74848);function m(){const{t:e}=(0,r.Bd)(),[t,c]=(0,_.fp)(a.AG.showPrompt),{check_user_auth:m}=(0,d.MH)();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.A,{}),(0,f.jsx)(s.N,{have_auth_edit:m(o.oV.net_site_tag_update),getItems:async()=>{const e=await n.sY.get();return e.code===i.m.Success?e.data:[]},save:async e=>{(await n.sY.post("save",e)).code===i.m.Success&&(0,u.SK)("保存成功")},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"color",preName:"color"}]})]})}},83029(e,t,c){c.d(t,{N:()=>k});var s=c(96540),a=c(34843),n=c(82893),i=c(74848);function l(e){const[t,c]=(0,a.fp)(n.AG.user_base_info);return(0,i.jsx)("div",{children:e.div?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,i.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var r=c(64694),d=c(61443),o=c(85997),_=c(76213),u=c(34899);const f=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,h,p=[];const v=[];function k(e){const[t,c]=(0,s.useState)([]),[k,x]=(0,s.useState)(-1),j=(0,_.zy)(),[y,b]=(0,s.useState)(!1),[g,C]=(0,s.useState)(!1),{t:N}=(0,u.Bd)(),[S,w]=(0,s.useState)([]),[I,A]=(0,a.fp)(n.AG.nav_index_add_item_by_now_list),D=e=>{-1!==k?v[k]._children=e:p=e};(0,s.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();p=t,c(p)})()},[j]);(0,s.useEffect)(()=>{if(I){const e=[...t,{name:"",color:(0,r.Lr)(f),...I}];D(e),c(e),b(!0),A(void 0)}},[I]);const F=e=>{x(k+1),c(e._children),v.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==k&&(0,i.jsx)(o.rA,{title:"返回",icon:"arrow_back",onClick:()=>{c(0===k?p:v[k-1]._children),x(k-1),v.pop()}}),t.map((a,n)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,n),onDrop:e=>((e,s)=>{e.preventDefault();const a=t[m],n=t[s];if(n&&"dir"===n._type){const e=[...t];return e.splice(m,1),n._children||(n._children=[]),n._children.push(a),D(e),void c(e)}const i=[...t],l=i[m];i.splice(m,1),i.splice(s,0,l),D(i),c(i)})(e,n),style:{cursor:y?"move":"pointer"},children:[(0,i.jsx)(l,{name:a.name,item:a,...a,div:y,target:"_blank",click_dir:F,clickItem:e.clickItem}),y&&(void 0!==S.find(e=>e===n)||g)&&(0,i.jsxs)("div",{className:g?"":" site_edit ",children:["dir"===a._type?(0,i.jsxs)(s.Fragment,{children:[(0,i.jsx)(d.Sm,{value:a.name,handleInputChange:e=>{a.name=e},placeholder:N("输入类目名"),no_border:!0}),(0,i.jsx)(d.Sm,{value:a.color,handleInputChange:e=>{a.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(d.Sm,{value:a[e.key],handleInputChange:t=>{a[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!g&&(0,i.jsx)(o.C3,{text:N("折叠"),clickFun:()=>{w((0,r.P1)(S,n))}})]}),y&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(o.C3,{text:N("删除"),clickFun:()=>{(e=>{const s=[...t];s.splice(e,1),D(s),c(s)})(n)}}),(0,i.jsx)(o.C3,{text:N("编辑"),clickFun:()=>{void 0===S.find(e=>e===n)&&w([...S,n])}})]})})]},n)),y&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(o.rA,{title:N("取消"),icon:"cancel",onClick:()=>{w([]),b(!1),h&&(c(h),D(h)),C(!1)}}),(0,i.jsx)(o.rA,{title:N("添加"),icon:"add",onClick:async()=>{const s=[...t,{name:"",color:(0,r.Lr)(f),...e.get_pre_add_item&&await e.get_pre_add_item()}];D(s),c(s)}}),(0,i.jsx)(o.rA,{title:N("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];D(e),c(e)}}),(0,i.jsx)(o.rA,{title:N("全部编辑"),icon:g?"unfold_less":"unfold_more",onClick:()=>{C(!g)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(o.rA,{icon:y?"save":"edit",title:N(y?"保存":"编辑"),onClick:async()=>{y?e.save&&await e.save(p):h=t,b(!y)}})]})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7209],{77481(e,t,n){n.d(t,{S:()=>l,X:()=>i});var a=n(96540),s=n(74848);function i(e){const[t,n]=a.useState([]);return(0,a.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]),(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:e.headers?.map((e,t)=>(0,s.jsx)("th",{children:e},t))})}),(0,s.jsx)("tbody",{children:t.map((t,n)=>(0,s.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((n,a)=>(0,s.jsx)("td",{style:{width:e.width??"auto"},className:a===t.length-1?"small":"",children:n},a))},n))})]})}function l(e){return(0,s.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,s.jsx)("div",{children:e},t))})}},83029(e,t,n){n.d(t,{N:()=>f});var a=n(96540),s=n(34843),i=n(82893),l=n(74848);function c(e){const[t,n]=(0,s.fp)(i.AG.user_base_info);return(0,l.jsx)("div",{children:e.div?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,l.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var o=n(64694),r=n(61443),d=n(85997),u=n(61973),h=n(34899);const m=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let p,x,_=[];const v=[];function f(e){const[t,n]=(0,a.useState)([]),[f,j]=(0,a.useState)(-1),g=(0,u.zy)(),[y,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),{t:b}=(0,h.Bd)(),[w,I]=(0,a.useState)([]),[N,A]=(0,s.fp)(i.AG.nav_index_add_item_by_now_list),D=e=>{-1!==f?v[f]._children=e:_=e};(0,a.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();_=t,n(_)})()},[g]);(0,a.useEffect)(()=>{if(N){const e=[...t,{name:"",color:(0,o.Lr)(m),...N}];D(e),n(e),k(!0),A(void 0)}},[N]);const F=e=>{j(f+1),n(e._children),v.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==f&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===f?_:v[f-1]._children),j(f-1),v.pop()}}),t.map((s,i)=>(0,l.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{p=t})(0,i),onDrop:e=>((e,a)=>{e.preventDefault();const s=t[p],i=t[a];if(i&&"dir"===i._type){const e=[...t];return e.splice(p,1),i._children||(i._children=[]),i._children.push(s),D(e),void n(e)}const l=[...t],c=l[p];l.splice(p,1),l.splice(a,0,c),D(l),n(l)})(e,i),style:{cursor:y?"move":"pointer"},children:[(0,l.jsx)(c,{name:s.name,item:s,...s,div:y,target:"_blank",click_dir:F,clickItem:e.clickItem}),y&&(void 0!==w.find(e=>e===i)||C)&&(0,l.jsxs)("div",{className:C?"":" site_edit ",children:["dir"===s._type?(0,l.jsxs)(a.Fragment,{children:[(0,l.jsx)(r.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:b("输入类目名"),no_border:!0}),(0,l.jsx)(r.Sm,{value:s.color,handleInputChange:e=>{s.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,l.jsx)("div",{children:(0,l.jsx)(r.Sm,{value:s[e.key],handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!C&&(0,l.jsx)(d.C3,{text:b("折叠"),clickFun:()=>{I((0,o.P1)(w,i))}})]}),y&&(0,l.jsx)("div",{style:{display:"block"},children:(0,l.jsxs)("span",{className:"div-row ",children:[(0,l.jsx)(d.C3,{text:b("删除"),clickFun:()=>{(e=>{const a=[...t];a.splice(e,1),D(a),n(a)})(i)}}),(0,l.jsx)(d.C3,{text:b("编辑"),clickFun:()=>{void 0===w.find(e=>e===i)&&I([...w,i])}})]})})]},i)),y&&(0,l.jsxs)("div",{style:{display:"block"},children:[(0,l.jsx)(d.rA,{title:b("取消"),icon:"cancel",onClick:()=>{I([]),k(!1),x&&(n(x),D(x)),S(!1)}}),(0,l.jsx)(d.rA,{title:b("添加"),icon:"add",onClick:async()=>{const a=[...t,{name:"",color:(0,o.Lr)(m),...e.get_pre_add_item&&await e.get_pre_add_item()}];D(a),n(a)}}),(0,l.jsx)(d.rA,{title:b("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];D(e),n(e)}}),(0,l.jsx)(d.rA,{title:b("全部编辑"),icon:C?"unfold_less":"unfold_more",onClick:()=>{S(!C)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,l.jsx)(d.rA,{icon:y?"save":"edit",title:b(y?"保存":"编辑"),onClick:async()=>{y?e.save&&await e.save(_):x=t,k(!y)}})]})}},87209(e,t,n){n.r(t),n.d(t,{default:()=>I});var a=n(96540),s=n(75725),i=n(61443),l=n(70447),c=n(85997),o=n(34289),r=n(34899),d=n(62042),u=n(14284),h=n(53459),m=n(74848);function p(e){const{t}=(0,r.Bd)(),[n,p]=(0,a.useState)(t("毫秒")),[x,_]=(0,a.useState)(""),[v,f]=(0,a.useState)(""),[j,g]=(0,a.useState)(null),[y,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(Date.now());return(0,a.useEffect)(()=>{(async()=>{const e=await u.Yu.get("sys_time/get");if(e.code===h.m.Success){const t=await e.data;g(t.timestamp),k(t.timezone),S(t.timestamp)}})();const e=setInterval(()=>{S(e=>e+1e3)},1e3);return()=>clearInterval(e)},[]),(0,m.jsxs)(s.fI,{children:[(0,m.jsx)(s.VP,{children:(0,m.jsxs)(l.Zp,{title:t("时间转换器"),rightBottomCom:(0,m.jsx)(c.C3,{text:t("确定"),clickFun:function(){if(!x&&!v)return void(0,d.zN)("不能都为空");let e=0;const t=""!==x&&0!==x;if(t){if(!(0,o.kf)(x))return void(0,d.zN)("must be number !");e=parseInt(x),"分秒"===n&&(e*=1e3)}const a=new Date(t?e:v),s=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(a);if(f(s),!x){const e=a.getTime();_("毫秒"===n?e:e/1e3)}}}),children:[(0,m.jsx)(i.l6,{value:n,options:[{title:t("毫秒"),value:"毫秒"},{title:t("分秒"),value:"分秒"}],onChange:function(e){p(e)}}),(0,m.jsx)(i.Sm,{placeholder:n,value:x,handleInputChange:e=>{_(e)}}),(0,m.jsx)(i.Sm,{placeholder:t("格式化时间"),value:v,handleInputChange:e=>{f(e)}})]})}),(0,m.jsx)(s.VP,{children:null!==j&&null!==y&&(0,m.jsxs)(l.Zp,{title:t("服务器时间"),children:[(0,m.jsxs)("h1",{children:[t("时区"),": ",y]}),(0,m.jsxs)("h1",{children:[t("时间"),": ",new Date(C).toLocaleString(navigator.language,{timeZone:y})]})]})})]})}var x=n(57952),_=n(83029),v=n(78247),f=n(23430);function j(e){const{t}=(0,r.Bd)(),{check_user_auth:n}=(0,v.MH)(),[s,l]=(0,a.useState)(""),o=async e=>{const t=e||s;if(!t)return void(0,d.zN)("mac地址不能为空");(await u._U.post("wol/exec",{mac:t})).code===h.m.Success&&(0,d.SK)("发送唤醒命令成功")};return(0,m.jsxs)("div",{children:[(0,m.jsxs)(x.A,{children:[(0,m.jsx)(c.rA,{icon:"play_arrow",title:t("发送"),onClick:()=>{o()}}),(0,m.jsx)(i.$Z,{placeholder:t("目标设备mac地址"),icon:"laptop_mac",value:s,handleInputChange:e=>l(e)})]}),(0,m.jsx)(_.N,{have_auth_edit:n(f.oV.wol_proxy_tag_update),getItems:async()=>{const e=await u._U.get("wol/tag");return e.code===h.m.Success?e.data:[]},save:async e=>{(await u._U.post("wol/tag/save",e)).code!==h.m.Success&&(0,d.zN)("网络错误")},clickItem:async e=>{l(e.mac),o(e.mac)},items:[{key:"name",preName:t("名字")},{key:"mac",preName:"mac"+t("地址")},{key:"color",preName:"color"}]})]})}var g=n(77481),y=n(34843),k=n(82893),C=n(40505);let S;function b(){const[e,t]=(0,a.useState)("rsa"),[n,o]=(0,a.useState)("pem"),{t:p,i18n:_}=(0,r.Bd)(),[v,f]=(0,y.fp)(k.AG.confirm),[j,b]=(0,a.useState)(""),[w,I]=(0,a.useState)(""),N=async t=>{if(!w||!j)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),f({open:!0,title:p("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${S}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?j:w})).code===h.m.Success&&((0,d.SK)("完成"),f({open:!1,handle:null}))}})};return(0,m.jsxs)(a.Fragment,{children:[(0,m.jsx)(x.A,{children:(0,m.jsx)(g.S,{isFlex:!0,columns:[(0,m.jsx)(i.l6,{tip:p("加密算法"),value:e,width:"auto",onChange:e=>{t(e)},options:[{title:p("RSA"),value:"rsa"},{title:p("DSA"),value:"dsa"},{title:p("ECDSA"),value:"ecdsa"}]}),(0,m.jsx)(i.l6,{tip:p("输出格式"),value:n,width:"auto",onChange:e=>{o(e)},options:[{title:p("普通PEM"),value:"pem"},{title:p("opensshPEM"),value:"openssh_pem"}]}),(0,m.jsx)(c.rA,{icon:"play_arrow",title:p("生成"),onClick:()=>{(async()=>{const t=await u.cD.post("generate",{type:e,form:n});t.code===h.m.Success&&(b(t.data.public_key),I(t.data.private_key),S=t.data.home_path)})()}})]})}),(0,m.jsx)(s.xh,{children:(0,m.jsxs)(s.fI,{children:[(0,m.jsx)(s.VP,{children:(0,m.jsx)(l.Zp,{title:p("公钥"),titleCom:(0,m.jsx)(c.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{j&&((0,C.lW)(j),(0,d.SK)("完成"))}}),rightBottomCom:"openssh_pem"===n&&(0,m.jsx)(c.C3,{text:p("保存到.ssh目录"),clickFun:()=>{N("pub")}}),children:(0,m.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},onChange:e=>{b(e.target.value)},value:j})})}),(0,m.jsx)(s.VP,{children:(0,m.jsx)(l.Zp,{title:p("私钥"),titleCom:(0,m.jsx)(c.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{w&&((0,C.lW)(w),(0,d.SK)("成功"))}}),rightBottomCom:"openssh_pem"===n&&(0,m.jsx)(c.C3,{text:p("保存到.ssh目录"),clickFun:()=>{N("pri")}}),children:(0,m.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},value:w,onChange:e=>{I(e.target.value)}})})})]})})]})}var w=n(87361);function I(e){const{t}=(0,r.Bd)(),{check_user_auth:n}=(0,v.MH)(),a=[];return a.push({index:1,name:t("时间工具"),rto:"timeutil/",component:(0,m.jsx)(p,{})},{index:1,name:t("非对称密钥"),rto:"crypto/",component:(0,m.jsx)(b,{})}),n(f.oV.wol_proxy)&&a.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,m.jsx)(j,{})}),(0,m.jsx)(s.W1,{optionList:a,father_route:w.o.toolbox})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7209],{77481(e,t,n){n.d(t,{S:()=>l,X:()=>i});var a=n(96540),s=n(74848);function i(e){const[t,n]=a.useState([]);return(0,a.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]),(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:e.headers?.map((e,t)=>(0,s.jsx)("th",{children:e},t))})}),(0,s.jsx)("tbody",{children:t.map((t,n)=>(0,s.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((n,a)=>(0,s.jsx)("td",{style:{width:e.width??"auto"},className:a===t.length-1?"small":"",children:n},a))},n))})]})}function l(e){return(0,s.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,s.jsx)("div",{children:e},t))})}},83029(e,t,n){n.d(t,{N:()=>f});var a=n(96540),s=n(34843),i=n(82893),l=n(74848);function c(e){const[t,n]=(0,s.fp)(i.AG.user_base_info);return(0,l.jsx)("div",{children:e.div?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,l.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var o=n(64694),r=n(61443),d=n(85997),u=n(76213),h=n(34899);const m=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let p,x,_=[];const v=[];function f(e){const[t,n]=(0,a.useState)([]),[f,j]=(0,a.useState)(-1),g=(0,u.zy)(),[y,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),{t:b}=(0,h.Bd)(),[w,I]=(0,a.useState)([]),[N,A]=(0,s.fp)(i.AG.nav_index_add_item_by_now_list),D=e=>{-1!==f?v[f]._children=e:_=e};(0,a.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();_=t,n(_)})()},[g]);(0,a.useEffect)(()=>{if(N){const e=[...t,{name:"",color:(0,o.Lr)(m),...N}];D(e),n(e),k(!0),A(void 0)}},[N]);const F=e=>{j(f+1),n(e._children),v.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==f&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===f?_:v[f-1]._children),j(f-1),v.pop()}}),t.map((s,i)=>(0,l.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{p=t})(0,i),onDrop:e=>((e,a)=>{e.preventDefault();const s=t[p],i=t[a];if(i&&"dir"===i._type){const e=[...t];return e.splice(p,1),i._children||(i._children=[]),i._children.push(s),D(e),void n(e)}const l=[...t],c=l[p];l.splice(p,1),l.splice(a,0,c),D(l),n(l)})(e,i),style:{cursor:y?"move":"pointer"},children:[(0,l.jsx)(c,{name:s.name,item:s,...s,div:y,target:"_blank",click_dir:F,clickItem:e.clickItem}),y&&(void 0!==w.find(e=>e===i)||C)&&(0,l.jsxs)("div",{className:C?"":" site_edit ",children:["dir"===s._type?(0,l.jsxs)(a.Fragment,{children:[(0,l.jsx)(r.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:b("输入类目名"),no_border:!0}),(0,l.jsx)(r.Sm,{value:s.color,handleInputChange:e=>{s.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,l.jsx)("div",{children:(0,l.jsx)(r.Sm,{value:s[e.key],handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!C&&(0,l.jsx)(d.C3,{text:b("折叠"),clickFun:()=>{I((0,o.P1)(w,i))}})]}),y&&(0,l.jsx)("div",{style:{display:"block"},children:(0,l.jsxs)("span",{className:"div-row ",children:[(0,l.jsx)(d.C3,{text:b("删除"),clickFun:()=>{(e=>{const a=[...t];a.splice(e,1),D(a),n(a)})(i)}}),(0,l.jsx)(d.C3,{text:b("编辑"),clickFun:()=>{void 0===w.find(e=>e===i)&&I([...w,i])}})]})})]},i)),y&&(0,l.jsxs)("div",{style:{display:"block"},children:[(0,l.jsx)(d.rA,{title:b("取消"),icon:"cancel",onClick:()=>{I([]),k(!1),x&&(n(x),D(x)),S(!1)}}),(0,l.jsx)(d.rA,{title:b("添加"),icon:"add",onClick:async()=>{const a=[...t,{name:"",color:(0,o.Lr)(m),...e.get_pre_add_item&&await e.get_pre_add_item()}];D(a),n(a)}}),(0,l.jsx)(d.rA,{title:b("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];D(e),n(e)}}),(0,l.jsx)(d.rA,{title:b("全部编辑"),icon:C?"unfold_less":"unfold_more",onClick:()=>{S(!C)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,l.jsx)(d.rA,{icon:y?"save":"edit",title:b(y?"保存":"编辑"),onClick:async()=>{y?e.save&&await e.save(_):x=t,k(!y)}})]})}},87209(e,t,n){n.r(t),n.d(t,{default:()=>I});var a=n(96540),s=n(75725),i=n(61443),l=n(70447),c=n(85997),o=n(34289),r=n(34899),d=n(62042),u=n(14284),h=n(53459),m=n(74848);function p(e){const{t}=(0,r.Bd)(),[n,p]=(0,a.useState)(t("毫秒")),[x,_]=(0,a.useState)(""),[v,f]=(0,a.useState)(""),[j,g]=(0,a.useState)(null),[y,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(Date.now());return(0,a.useEffect)(()=>{(async()=>{const e=await u.Yu.get("sys_time/get");if(e.code===h.m.Success){const t=await e.data;g(t.timestamp),k(t.timezone),S(t.timestamp)}})();const e=setInterval(()=>{S(e=>e+1e3)},1e3);return()=>clearInterval(e)},[]),(0,m.jsxs)(s.fI,{children:[(0,m.jsx)(s.VP,{children:(0,m.jsxs)(l.Zp,{title:t("时间转换器"),rightBottomCom:(0,m.jsx)(c.C3,{text:t("确定"),clickFun:function(){if(!x&&!v)return void(0,d.zN)("不能都为空");let e=0;const t=""!==x&&0!==x;if(t){if(!(0,o.kf)(x))return void(0,d.zN)("must be number !");e=parseInt(x),"分秒"===n&&(e*=1e3)}const a=new Date(t?e:v),s=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(a);if(f(s),!x){const e=a.getTime();_("毫秒"===n?e:e/1e3)}}}),children:[(0,m.jsx)(i.l6,{value:n,options:[{title:t("毫秒"),value:"毫秒"},{title:t("分秒"),value:"分秒"}],onChange:function(e){p(e)}}),(0,m.jsx)(i.Sm,{placeholder:n,value:x,handleInputChange:e=>{_(e)}}),(0,m.jsx)(i.Sm,{placeholder:t("格式化时间"),value:v,handleInputChange:e=>{f(e)}})]})}),(0,m.jsx)(s.VP,{children:null!==j&&null!==y&&(0,m.jsxs)(l.Zp,{title:t("服务器时间"),children:[(0,m.jsxs)("h1",{children:[t("时区"),": ",y]}),(0,m.jsxs)("h1",{children:[t("时间"),": ",new Date(C).toLocaleString(navigator.language,{timeZone:y})]})]})})]})}var x=n(57952),_=n(83029),v=n(78247),f=n(23430);function j(e){const{t}=(0,r.Bd)(),{check_user_auth:n}=(0,v.MH)(),[s,l]=(0,a.useState)(""),o=async e=>{const t=e||s;if(!t)return void(0,d.zN)("mac地址不能为空");(await u._U.post("wol/exec",{mac:t})).code===h.m.Success&&(0,d.SK)("发送唤醒命令成功")};return(0,m.jsxs)("div",{children:[(0,m.jsxs)(x.A,{children:[(0,m.jsx)(c.rA,{icon:"play_arrow",title:t("发送"),onClick:()=>{o()}}),(0,m.jsx)(i.$Z,{placeholder:t("目标设备mac地址"),icon:"laptop_mac",value:s,handleInputChange:e=>l(e)})]}),(0,m.jsx)(_.N,{have_auth_edit:n(f.oV.wol_proxy_tag_update),getItems:async()=>{const e=await u._U.get("wol/tag");return e.code===h.m.Success?e.data:[]},save:async e=>{(await u._U.post("wol/tag/save",e)).code!==h.m.Success&&(0,d.zN)("网络错误")},clickItem:async e=>{l(e.mac),o(e.mac)},items:[{key:"name",preName:t("名字")},{key:"mac",preName:"mac"+t("地址")},{key:"color",preName:"color"}]})]})}var g=n(77481),y=n(34843),k=n(82893),C=n(40505);let S;function b(){const[e,t]=(0,a.useState)("rsa"),[n,o]=(0,a.useState)("pem"),{t:p,i18n:_}=(0,r.Bd)(),[v,f]=(0,y.fp)(k.AG.confirm),[j,b]=(0,a.useState)(""),[w,I]=(0,a.useState)(""),N=async t=>{if(!w||!j)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),f({open:!0,title:p("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${S}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?j:w})).code===h.m.Success&&((0,d.SK)("完成"),f({open:!1,handle:null}))}})};return(0,m.jsxs)(a.Fragment,{children:[(0,m.jsx)(x.A,{children:(0,m.jsx)(g.S,{isFlex:!0,columns:[(0,m.jsx)(i.l6,{tip:p("加密算法"),value:e,width:"auto",onChange:e=>{t(e)},options:[{title:p("RSA"),value:"rsa"},{title:p("DSA"),value:"dsa"},{title:p("ECDSA"),value:"ecdsa"}]}),(0,m.jsx)(i.l6,{tip:p("输出格式"),value:n,width:"auto",onChange:e=>{o(e)},options:[{title:p("普通PEM"),value:"pem"},{title:p("opensshPEM"),value:"openssh_pem"}]}),(0,m.jsx)(c.rA,{icon:"play_arrow",title:p("生成"),onClick:()=>{(async()=>{const t=await u.cD.post("generate",{type:e,form:n});t.code===h.m.Success&&(b(t.data.public_key),I(t.data.private_key),S=t.data.home_path)})()}})]})}),(0,m.jsx)(s.xh,{children:(0,m.jsxs)(s.fI,{children:[(0,m.jsx)(s.VP,{children:(0,m.jsx)(l.Zp,{title:p("公钥"),titleCom:(0,m.jsx)(c.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{j&&((0,C.lW)(j),(0,d.SK)("完成"))}}),rightBottomCom:"openssh_pem"===n&&(0,m.jsx)(c.C3,{text:p("保存到.ssh目录"),clickFun:()=>{N("pub")}}),children:(0,m.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},onChange:e=>{b(e.target.value)},value:j})})}),(0,m.jsx)(s.VP,{children:(0,m.jsx)(l.Zp,{title:p("私钥"),titleCom:(0,m.jsx)(c.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{w&&((0,C.lW)(w),(0,d.SK)("成功"))}}),rightBottomCom:"openssh_pem"===n&&(0,m.jsx)(c.C3,{text:p("保存到.ssh目录"),clickFun:()=>{N("pri")}}),children:(0,m.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},value:w,onChange:e=>{I(e.target.value)}})})})]})})]})}var w=n(87361);function I(e){const{t}=(0,r.Bd)(),{check_user_auth:n}=(0,v.MH)(),a=[];return a.push({index:1,name:t("时间工具"),rto:"timeutil/",component:(0,m.jsx)(p,{})},{index:1,name:t("非对称密钥"),rto:"crypto/",component:(0,m.jsx)(b,{})}),n(f.oV.wol_proxy)&&a.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,m.jsx)(j,{})}),(0,m.jsx)(s.W1,{optionList:a,father_route:w.o.toolbox})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8603],{58603(e,t,i){i.r(t),i.d(t,{default:()=>$});var n=i(96540),s=i(75725),r=i(70447),a=i(34843),l=i(82893),o=i(60096),c=i(85997),d=i(34251),m=i(34289),h=i(87361),_=i(14284),u=i(53459),x=i(61443),f=i(34899),p=i(62042),j=(i(47022),i(57952)),k=i(99214),w=i(6960),g=i(88815),v=i(78247),z=i(40505),F=i(23430),b=i(64694),C=i(61973),N=i(74848);function $(){const[e,t]=(0,n.useState)(null),i=(0,n.useRef)(""),$=(0,n.useRef)(""),[y,S]=(0,a.fp)(l.AG.prompt_card),[A,M]=(0,a.fp)(l.AG.share_sort_type),{t:G}=(0,f.Bd)(),[I,U]=(0,a.fp)(l.AG.selectedFileList),[V,W]=(0,a.fp)(l.AG.clickFileList),{click_file:D}=(0,v.kZ)(),[L]=(0,C.ok)(),R=(0,k.oT)(),B=(0,k.xp)(),H=(0,k.Vs)(!0),T=(0,n.useMemo)(()=>{const t=[...e?.items??[]],i=e=>Number(e.mtime??0);return A===F.t8.time_minx_max?t.sort((e,t)=>i(e)-i(t)):A===F.t8.time_max_min&&t.sort((e,t)=>i(t)-i(e)),t},[e?.items,A]),E=async()=>{const e=await _.$M.post("share",{id:i.current,token:$.current});if(e.code===u.m.Success){const n={is_dir:e.data.is_dir};n.items=e.data.files??[];for(const e of n.items)e.origin_size=e.size,e.show_mtime=e.mtime?(0,w.s)(e.mtime):"",e.size=(0,g.v7)(e.size);if(!n.is_dir){const t=e.data.files[0];n.name=t.name,n.size=t.size,n.show_mtime=t.show_mtime}localStorage.setItem(`file_share_token_${i.current}`,$.current);const s=L.get("share_preview_file_name");if(s)try{const t=e.data.files.find(e=>e.name===s);D({file_path:t.path,file_url:_.$M.getDownloadUrlV2(t.path,"share_download",{share_id:i.current,share_token:$.current}),name:t.name,size:t.origin_size,opt_shell:!0,mtime:t.mtime,not_type_tip:G("未知类型,请下载查看"),close:()=>{R("share_preview_file_name",null)}})}catch(e){(0,p.zN)(e?.message||e)}else t(n)}else e.code===u.m.need_token_share&&(localStorage.removeItem(`file_share_token_${i.current}`),(0,p.zN)("需要正确的访问token"),S({open:!0,title:"share file",confirm:()=>{S({open:!1}),E()},context_div:(0,N.jsx)("div",{className:"card-content",children:(0,N.jsx)(x.Sm,{placeholderOut:G("请输入访问token"),value:"",handleInputChange:e=>{$.current=e}})})}))};if((0,n.useEffect)(()=>{const e=(0,m.oW)(`${(0,m.GG)(h.o.share,(0,m.vX)())}`);i.current=e,$.current=localStorage.getItem(`file_share_token_${e}`),E()},[L]),!e)return(0,N.jsx)(s.jW,{isFull:!0,children:(0,N.jsx)("div",{className:"common-box common-box-center",children:"Loading..."})});return(0,N.jsxs)(n.Fragment,{children:[(0,N.jsxs)(j.A,{left_children:(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)("h2",{children:["Share ",e.is_dir?"Folder":"File"]})}),children:[I.length>0&&(0,N.jsx)(c.rA,{icon:"download",title:G("下载"),onClick:function(){const e=[];for(let t=0;t<I.length;t++){const i=T[I[t]];e.push(encodeURIComponent(i.path))}const t=_.$M.getDownloadUrlV2(e,"share_download",{share_id:i.current,share_token:$.current});window.open(t)}}),e.is_dir&&(0,N.jsx)(c.rA,{icon:"grid_view",title:G("切换样式"),onClick:H}),e.is_dir&&(0,N.jsx)(c.rA,{icon:"schedule",title:A===F.t8.time_minx_max?G("时间逆序"):G("时间顺序"),onClick:()=>{const e=(0,b.jH)([F.t8.time_max_min,F.t8.time_minx_max,F.t8.defualt],A);M(e),U([]),W([])}})]}),(0,N.jsx)(s.xh,{children:(0,N.jsx)(s.jW,{isFull:!0,children:(0,N.jsx)("div",{className:"common-box ",children:e.is_dir?(0,N.jsx)(o.QW,{share:{share_id:i.current,share_token:$.current},handleContextMenu:()=>{},file_list:T,clickBlank:e=>{e.target===e.currentTarget&&(U([]),W([]))}}):(0,N.jsx)(r.uF,{children:(0,N.jsxs)("div",{style:{height:"25rem"},className:"common-box common-box-center",children:[(0,N.jsx)("div",{className:"file-icons",children:(0,N.jsx)("div",{"data-type":(0,d.uL)(e.name),"data-dir":e.is_dir,"aria-label":e.name,children:(0,N.jsx)(c.In,{icon:"",style:{fontSize:"10rem",display:"inline-block",lineHeight:1},aria_label:e.name})})}),(0,N.jsx)("div",{className:"",children:e.name}),(0,N.jsx)("div",{className:"",children:e.size}),(0,N.jsx)("div",{className:"",children:e.show_mtime}),(0,N.jsx)(c.C3,{text:"download",clickFun:()=>{const e=T[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:$.current});window.open(t)}}),(0,N.jsx)(c.C3,{text:"copy url",clickFun:()=>{const e=T[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:$.current}),n=_.$M.get_full_url(t);(0,z.lW)(n),(0,p.SK)(n)}}),(0,N.jsx)(c.C3,{text:"preview",clickFun:()=>{const e=T[0];B(e.name)}})]})})})})})]})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8603],{58603(e,t,i){i.r(t),i.d(t,{default:()=>$});var n=i(96540),s=i(75725),r=i(70447),a=i(34843),l=i(82893),o=i(60096),c=i(85997),d=i(34251),m=i(34289),h=i(87361),_=i(14284),u=i(53459),x=i(61443),f=i(34899),p=i(62042),j=(i(47022),i(57952)),k=i(99214),w=i(6960),g=i(88815),v=i(78247),z=i(40505),F=i(23430),b=i(64694),C=i(76213),N=i(74848);function $(){const[e,t]=(0,n.useState)(null),i=(0,n.useRef)(""),$=(0,n.useRef)(""),[y,S]=(0,a.fp)(l.AG.prompt_card),[A,M]=(0,a.fp)(l.AG.share_sort_type),{t:G}=(0,f.Bd)(),[I,U]=(0,a.fp)(l.AG.selectedFileList),[V,W]=(0,a.fp)(l.AG.clickFileList),{click_file:D}=(0,v.kZ)(),[L]=(0,C.ok)(),R=(0,k.oT)(),B=(0,k.xp)(),H=(0,k.Vs)(!0),T=(0,n.useMemo)(()=>{const t=[...e?.items??[]],i=e=>Number(e.mtime??0);return A===F.t8.time_minx_max?t.sort((e,t)=>i(e)-i(t)):A===F.t8.time_max_min&&t.sort((e,t)=>i(t)-i(e)),t},[e?.items,A]),E=async()=>{const e=await _.$M.post("share",{id:i.current,token:$.current});if(e.code===u.m.Success){const n={is_dir:e.data.is_dir};n.items=e.data.files??[];for(const e of n.items)e.origin_size=e.size,e.show_mtime=e.mtime?(0,w.s)(e.mtime):"",e.size=(0,g.v7)(e.size);if(!n.is_dir){const t=e.data.files[0];n.name=t.name,n.size=t.size,n.show_mtime=t.show_mtime}localStorage.setItem(`file_share_token_${i.current}`,$.current);const s=L.get("share_preview_file_name");if(s)try{const t=e.data.files.find(e=>e.name===s);D({file_path:t.path,file_url:_.$M.getDownloadUrlV2(t.path,"share_download",{share_id:i.current,share_token:$.current}),name:t.name,size:t.origin_size,opt_shell:!0,mtime:t.mtime,not_type_tip:G("未知类型,请下载查看"),close:()=>{R("share_preview_file_name",null)}})}catch(e){(0,p.zN)(e?.message||e)}else t(n)}else e.code===u.m.need_token_share&&(localStorage.removeItem(`file_share_token_${i.current}`),(0,p.zN)("需要正确的访问token"),S({open:!0,title:"share file",confirm:()=>{S({open:!1}),E()},context_div:(0,N.jsx)("div",{className:"card-content",children:(0,N.jsx)(x.Sm,{placeholderOut:G("请输入访问token"),value:"",handleInputChange:e=>{$.current=e}})})}))};if((0,n.useEffect)(()=>{const e=(0,m.oW)(`${(0,m.GG)(h.o.share,(0,m.vX)())}`);i.current=e,$.current=localStorage.getItem(`file_share_token_${e}`),E()},[L]),!e)return(0,N.jsx)(s.jW,{isFull:!0,children:(0,N.jsx)("div",{className:"common-box common-box-center",children:"Loading..."})});return(0,N.jsxs)(n.Fragment,{children:[(0,N.jsxs)(j.A,{left_children:(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)("h2",{children:["Share ",e.is_dir?"Folder":"File"]})}),children:[I.length>0&&(0,N.jsx)(c.rA,{icon:"download",title:G("下载"),onClick:function(){const e=[];for(let t=0;t<I.length;t++){const i=T[I[t]];e.push(encodeURIComponent(i.path))}const t=_.$M.getDownloadUrlV2(e,"share_download",{share_id:i.current,share_token:$.current});window.open(t)}}),e.is_dir&&(0,N.jsx)(c.rA,{icon:"grid_view",title:G("切换样式"),onClick:H}),e.is_dir&&(0,N.jsx)(c.rA,{icon:"schedule",title:A===F.t8.time_minx_max?G("时间逆序"):G("时间顺序"),onClick:()=>{const e=(0,b.jH)([F.t8.time_max_min,F.t8.time_minx_max,F.t8.defualt],A);M(e),U([]),W([])}})]}),(0,N.jsx)(s.xh,{children:(0,N.jsx)(s.jW,{isFull:!0,children:(0,N.jsx)("div",{className:"common-box ",children:e.is_dir?(0,N.jsx)(o.QW,{share:{share_id:i.current,share_token:$.current},handleContextMenu:()=>{},file_list:T,clickBlank:e=>{e.target===e.currentTarget&&(U([]),W([]))}}):(0,N.jsx)(r.uF,{children:(0,N.jsxs)("div",{style:{height:"25rem"},className:"common-box common-box-center",children:[(0,N.jsx)("div",{className:"file-icons",children:(0,N.jsx)("div",{"data-type":(0,d.uL)(e.name),"data-dir":e.is_dir,"aria-label":e.name,children:(0,N.jsx)(c.In,{icon:"",style:{fontSize:"10rem",display:"inline-block",lineHeight:1},aria_label:e.name})})}),(0,N.jsx)("div",{className:"",children:e.name}),(0,N.jsx)("div",{className:"",children:e.size}),(0,N.jsx)("div",{className:"",children:e.show_mtime}),(0,N.jsx)(c.C3,{text:"download",clickFun:()=>{const e=T[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:$.current});window.open(t)}}),(0,N.jsx)(c.C3,{text:"copy url",clickFun:()=>{const e=T[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:$.current}),n=_.$M.get_full_url(t);(0,z.lW)(n),(0,p.SK)(n)}}),(0,N.jsx)(c.C3,{text:"preview",clickFun:()=>{const e=T[0];B(e.name)}})]})})})})})]})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8714],{47374(e,t,i){i.d(t,{e:()=>f});var o=i(96540),n=i(61973),s=i(64694),a=i(34289),r=i(61443),l=i(75725),c=i(34899),_=i(85997),d=i(74848);function f(e){let t=(0,n.zy)();const[i,f]=(0,o.useState)([]),[p,m]=(0,o.useState)("/"),[h,u]=(0,o.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();o.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const o=i.indexOf(e.baseRoute),n=[];if(-1!=o){t=(0,s.IO)(i.slice(0,o),e.baseRoute);const a=i.slice(o+1);for(let e=0;e<a.length;e++){const i=a[e];n.push({value:i,href:0===e?`${t}${i}/`:(0,s.IO)(n[e-1].href,i)})}m(t),f(n)}},[t]);const y=t=>{t.stopPropagation(),e.clickFun(t)};return(0,d.jsx)("div",{className:"breadcrumbs",onClick:e=>{u(void 0!==h?void 0:"")},children:(0,d.jsx)(o.Fragment,{children:void 0===h?(0,d.jsxs)(o.Fragment,{children:[(0,d.jsx)("span",{className:"chevron",children:(0,d.jsx)(n.N_,{to:p,onClick:y,children:(0,d.jsx)(_.In,{icon:"home"})})}),i.map((e,t)=>(0,d.jsxs)("span",{className:"chevron",children:[(0,d.jsx)(_.In,{icon:"keyboard_arrow_right"}),(0,d.jsx)(n.N_,{to:e.href,onClick:y,children:decodeURIComponent(e.value)})]},t))]}):(0,d.jsx)(l.QM,{click:()=>{u(void 0)},children:(0,d.jsx)(r.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),u(void 0)}})})})})}},78714(e,t,i){i.r(t),i.d(t,{default:()=>N});var o=i(96540),n=i(47374),s=i(34843),a=i(82893),r=i(14284),l=i(61973),c=i(57952),_=i(27690),d=i(34289),f=i(53459),p=i(99214),m=i(61443),h=i(47022),u=i(62042),w=i(34899),v=i(7523),y=i(78247),g=i(88815),x=i(6960),k=i(47071),j=i(14944),G=i(92275),A=i(23430);var C=i(34251),b=i(60096),z=i(85997),P=i(23496),F=i(12730),M=i(75725),$=i(70447),S=i(87361),D=i(74848);let X={};function I(){const{t:e}=(0,w.Bd)();let t=(0,l.zy)();const i=(0,l.Zp)(),{check_user_auth:n}=(0,y.MH)(),[c,f]=(0,s.fp)(a.AG.nowFileList),[m,g]=(0,s.fp)(a.AG.uploadFiles),[x,k]=(0,s.fp)(a.AG.showPrompt),[b,P]=(0,s.fp)(a.AG.selectedFileList),[I,E]=(0,s.fp)(a.AG.copyedFileList),[K,Y]=(0,s.fp)(a.AG.cutedFileList),[L,R]=(0,s.fp)(a.AG.selectedFileList),[H,N]=(0,s.fp)(a.AG.clickFileList),[U,W]=(0,s.fp)(a.AG.fileShellShow),[B,O]=(0,s.fp)(a.AG.file_root_list),[Z,q]=(0,s.fp)(a.AG.file_root_index),[V,T]=(0,o.useState)(void 0),[J,Q]=(0,o.useState)(""),[ee,te]=(0,s.fp)(a.AG.workflow_show),[ie,oe]=(0,s.fp)(a.AG.workflow_realtime_show),[ne,se]=(0,s.fp)(a.AG.work_flow_show),{initUserInfo:ae}=(0,o.useContext)(v.F),[re,le]=(0,s.fp)(a.AG.user_base_info),{click_file:ce}=(0,y.kZ)(),[_e,de]=(0,s.fp)(a.AG.prompt_card),fe=(0,o.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type!==h.Iw.folder?1:0),0),[c]),pe=(0,o.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type===h.Iw.folder?1:0),0)+(c.folders?.length??0),[c]);function me(e){(0,u.SK)(e)}(0,o.useEffect)(()=>{X={}},[t]),(0,o.useEffect)(()=>()=>{W({show:!1,path:""})},[]);const he=(0,p.Vs)(),ue=t=>{de({open:!0,title:e("信息"),context_div:(0,D.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,D.jsx)(M.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,D.jsx)(M.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,D.jsx)(M.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,D.jsx)(M.Yh,{left:`${e("文件夹数")}`,right:pe}),(0,D.jsx)(M.Yh,{left:`${e("文件数")}`,right:fe}),(0,D.jsx)(M.Yh,{left:`${e("当前位置")}`,right:(0,D.jsx)($.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{j.ws.removeMsg(G.HK.file_info)}})};return(0,D.jsxs)(o.Fragment,{children:[b.length>0&&(0,D.jsx)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{k({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),b.length>0&&(0,D.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,p.ib)(c,b);E(e.map(e=>(0,p.Ok)(e.name))),Y([]),me("已复制")}}),b.length>0&&(0,D.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,p.ib)(c,b);Y(e.map(e=>(0,p.Ok)(e.name))),E([]),me("已剪切")}}),(I.length>0||K.length>0)&&(0,D.jsx)(z.rA,{onClick:function(){k({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:I.length+K.length}),b.length>0&&(0,D.jsx)(z.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,p.ib)(c,b);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,p.Ok)(i.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),b.length>0&&(0,D.jsx)(z.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,p.ib)(c,b);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,p.Ok)(i.name)}e&&0!==e.length?k({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,u.zN)("没有选中")}}),1===b.length&&(0,D.jsx)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){k({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),ne&&(0,D.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{te(!ee)}}),(0,D.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){U.show?W({show:!1,path:""}):W({show:!0,path:(0,d.GG)("file",(0,d.vX)())})}}),n(A.oV.share_file)&&(0,D.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`/${S.o.share_list_setting_page}`)}}),(0,D.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:he}),(0,D.jsx)(z.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){k({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,d.GG)("file",(0,d.vX)())}})}}),(0,D.jsx)(z.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){k({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,d.GG)("file",(0,d.vX)())}})}}),(0,D.jsx)(z.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{k({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const o=[],n=new Set;for(let e=0;e<t.length;e++){const s=t[e],a=i?s.webkitRelativePath:`${s.webkitRelativePath}${s.name}`;s.fullPath=a,i&&n.add((0,F.S)(a)),o.push(s)}const s=[];if(i)for(const e of n)s.push({isDir:!0,fullPath:e,name:e});s.push(...o),g(s),k({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,D.jsx)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!X.now_absolute_path){j.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(X={...X,...i},j.ws.removeMsg(G.HK.file_info),ue(X))});const t=await j.ws.sendData(G.HK.file_info,{type:h.Iw.folder,path:(0,d.GG)("file",(0,d.vX)())});e=t.context,X=e,ue(X)}ue(X)}}),(0,D.jsx)(z.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const o=new C.ik;o.x=t.clientX,o.y=t.clientY,o.type=h.Iw.directory,o.items=B,o.item_pre_value=Z,o.textClick=async t=>{if(-1===t)return i(`/${S.o.setting_private_env_setting}`),k({data:void 0,overlay:!1,type:"",show:!1}),void(0,u.N9)(e("请配置 文件夹路径"));(async e=>{q(e),await r.$M.post("base_switch",{root_index:e}),await ae(),i("/file/"),R([]),N([])})(t),k({data:void 0,overlay:!1,type:"",show:!1})},k({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}})]})}var E=i(2543),K=i(21499),Y=i(64694);const L=o.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),R=o.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636)));let H;function N(){const[e,t]=(0,s.fp)(a.AG.editorSetting),[i,u]=(0,s.fp)(a.AG.file_preview),{t:F}=(0,w.Bd)();let M=(0,l.zy)();const $=(0,l.Zp)(),[X,N]=(0,s.fp)(a.AG.nowFileList),[U,W]=(0,s.fp)(a.AG.showPrompt),[B,O]=(0,s.fp)(a.AG.selectedFileList),[Z,q]=(0,s.fp)(a.AG.clickFileList),[V,T]=(0,s.fp)(a.AG.fileShellShow),[J,Q]=(0,o.useState)(""),[ee,te]=(0,s.fp)(a.AG.workflow_show),[ie,oe]=(0,s.fp)(a.AG.workflow_realtime_show),[ne,se]=(0,s.fp)(a.AG.work_flow_show),{initUserInfo:ae}=(0,o.useContext)(v.F),[re,le]=(0,s.fp)(a.AG.user_base_info),{click_file:ce}=(0,y.kZ)(),[_e,de]=(0,s.fp)(a.AG.to_running_files),[fe,pe]=(0,s.fp)(a.AG.file_page),[me]=(0,s.fp)(a.AG.blank_search_mode),[he,ue]=(0,s.fp)(a.AG.blank_search_mode_for_temp),we=function(){const[e,t]=(0,s.fp)(a.AG.user_base_info),{t:i}=(0,w.Bd)(),{check_user_auth:n}=(0,y.MH)(),[c,f]=(0,s.fp)(a.AG.router_jump),m=(0,l.Zp)(),{initUserInfo:u}=(0,o.useContext)(v.F),[g,x]=(0,s.fp)(a.AG.nowFileList),[k,b]=(0,s.fp)(a.AG.showPrompt),[z,F]=(0,s.fp)(a.AG.fileShellShow),[M,$]=(0,s.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const o=new C.ik;o.x=t.clientX,o.y=t.clientY,o.type=h.Iw.directory;const s=[{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.time_minx_max?"green":void 0},children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.time_max_min?"green":void 0},children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.size_min_max?"green":void 0},children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.size_max_min?"green":void 0},children:i("大小逆序")}),v:A.t8.size_max_min}],l=[{r:(0,D.jsx)("span",{style:{color:e.user_data.file_list_pagination_mode&&e.user_data.file_list_pagination_mode!==A.yM.all?void 0:"green"},children:i("全部加载文件")}),v:A.yM.all},{r:(0,D.jsx)("span",{style:{color:e.user_data.file_list_pagination_mode===A.yM.pagination?"green":void 0},children:i("分页滚动加载文件")}),v:A.yM.pagination}],c=[{r:(0,D.jsx)("span",{style:{color:e.user_data.file_time_show_type&&e.user_data.file_time_show_type!==A.KD.current?void 0:"green"},children:i("最近时间")}),v:A.KD.current},{r:(0,D.jsx)("span",{style:{color:e.user_data.file_time_show_type===A.KD.time?"green":void 0},children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type?void 0:"green"},children:i("系统默认")}),v:A.t8.defualt},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.name?"green":void 0},children:i("名字")}),v:A.t8.name},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min?"green":void 0},children:i("修改时间")}),v:!1,items:s},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min?"green":void 0},children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:l},{r:i("时间展示"),v:"",items:c},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,D.jsx)("span",{style:{color:M?"green":void 0},children:i("以空白搜索模式打开目录")}),v:"blank_search_mode"}]},{r:i("以配置表方式打开目录"),v:"gcfg_dir_config"}];g?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),n(A.oV.code_resource)&&w.push({r:i("添加http资源根目录"),v:"code_resource"}),n(A.oV.http_proxy)&&w.push({r:i("在此目录下载http资源"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,p.LL)([...e.user_data.quick_cmd],w),o.items=w,o.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,d.GG)("file",(0,d.vX)());return b({data:void 0,overlay:!1,type:"",show:!1}),void m(`/${S.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,d.GG)("file",(0,d.vX)());return b({data:void 0,overlay:!1,type:"",show:!1}),void m(`/${S.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await j.ws.sendData(G.HK.file_info,{path:(0,d.GG)("file",(0,d.vX)())});return f({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),b({data:void 0,overlay:!1,type:"",show:!1}),void m("/setting/customer_router/")}if("http_resource"===e){const e=await j.ws.sendData(G.HK.file_info,{path:(0,d.GG)("file",(0,d.vX)())});return f({http_download_map_path:e.context.now_absolute_path}),b({data:void 0,overlay:!1,type:"",show:!1}),void m("/proxy/http/")}if("zoom_adjust"===e)return b({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{b({show:!0,type:_.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",F({show:!0,path:(0,d.GG)("file",(0,d.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return $(!M),void b({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 r.wm.post(P.s.user_save_private_attr,{type:e,...t}),await u(),b({data:void 0,overlay:!1,type:"",show:!1}),m((0,d.vX)())},b({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}}(),ve=async()=>{const e=new k.Nd;e.dir_path=`${(0,d.GG)("file",(0,d.vX)())}`,j.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,p.Ys)(e);for(const e of t.failed_file_list)(0,p.V$)(e);de(new Set(t.running_file_list))}}),await j.ws.sendData(G.HK.workflow_realtime,e)},ye=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,g.v7)(i.size),re.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,K.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,x.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{ve()})),i.name===k.SB&&(t=!0);for(const i of e.folders??[])re.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,K.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,x.s)(i.mtime):"",i.name===k.SB&&(t=!0);se(t)};(0,o.useEffect)(()=>async()=>{de(new Set)},[]);const ge=()=>{(async()=>{const e=(0,d.GG)("file",(0,d.vX)());if(me||he)return;let t;if(re.user_data.file_list_pagination_mode===A.yM.pagination){if(fe.page_num<0)return;t=await r.$M.post("file_get_page",{param_path:e,page_num:fe.page_num,page_size:fe.page_size});const i=t.data;i.files?.length||pe({page_size:fe.page_size,page_num:-1}),i.files=(0,E.cloneDeep)([...X.files,...i.files])}else t=await r.$M.get(e);if(t.code!==f.m.Success)return;const i=t.data;(0,p.yC)(i,re.user_data.dir_show_type),ye(t.data),N(t.data),H=t.data})(),t({open:!1}),u({open:!1}),se(!1)};(0,o.useEffect)(()=>{ge()},[M,fe]);const xe=e=>{e.target===e.currentTarget&&(O([]),q([]))};return(0,D.jsxs)(o.Fragment,{children:[(0,D.jsxs)(c.A,{left_children:(0,D.jsx)(m.$Z,{handleEnterPress:async()=>{if(me||he){if(O([]),q([]),!J||!J.trim())return void N({files:[],folders:[]});const e=(0,d.GG)("file",(0,d.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:J.trim()});if(t.code!==f.m.Success)return;const i=t.data;return(0,p.yC)(i,re.user_data.dir_show_type),ye(i),N(i),void(H=i)}if(!H)return;O([]),q([]);const e=[],t=[];for(const t of H.files??[])t.name.includes(J)&&e.push(t);for(const e of H.folders??[])e.name.includes(J)&&t.push(e);N({files:e,folders:t})},placeholder:F("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{Q(e)},max_width:"25em"}),children:[(0,D.jsx)("div",{className:"mobile-context-btn",children:(0,D.jsx)(z.rA,{icon:"more_horiz",title:F("右键"),onClick:()=>{const e=B[B.length-1];if(void 0!==e){const t=[...X.folders??[],...X.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],o=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},n={preventDefault:()=>{},stopPropagation:()=>{},clientX:o.left+10,clientY:o.bottom??100},s=new C.ik;s.path=(0,Y.IO)((0,d.vX)(),t.name),s.filename=t.name,s.x=n.clientX,s.y=n.clientY,s.type=t.type===h.Iw.folder?h.Iw.folder:(0,C.uL)(t.name),s.size=t.origin_size,W({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:s})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};we(e)}}})}),(0,D.jsx)(I,{})]}),(0,D.jsx)(n.e,{baseRoute:"file",clickFun:function(){O([]),q([])},input_path_enter:e=>{var t;!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?$(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 o=e.length-1-t;o>=0;o--)if(e[o]===i)return e.substring(0,o+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,d.vX)(),e)):(e=e.replace(0===(t=re.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),$(e)),O([]),q([]),N({files:[],folders:[]})}}),re.user_data.file_list_pagination_mode===A.yM.pagination?(0,D.jsx)(b.$J,{handleContextMenu:we,clickBlank:xe,list:X.files}):(0,D.jsx)(b.t$,{handleContextMenu:we,file_list:X.files,folder_list:X.folders,clickBlank:xe}),ee&&(0,D.jsx)(L,{}),ie.open&&(0,D.jsx)(R,{})]})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8714],{47374(e,t,i){i.d(t,{e:()=>f});var o=i(96540),n=i(76213),s=i(64694),a=i(34289),r=i(61443),l=i(75725),c=i(34899),_=i(85997),d=i(74848);function f(e){let t=(0,n.zy)();const[i,f]=(0,o.useState)([]),[p,m]=(0,o.useState)("/"),[h,u]=(0,o.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();o.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const o=i.indexOf(e.baseRoute),n=[];if(-1!=o){t=(0,s.IO)(i.slice(0,o),e.baseRoute);const a=i.slice(o+1);for(let e=0;e<a.length;e++){const i=a[e];n.push({value:i,href:0===e?`${t}${i}/`:(0,s.IO)(n[e-1].href,i)})}m(t),f(n)}},[t]);const y=t=>{t.stopPropagation(),e.clickFun(t)};return(0,d.jsx)("div",{className:"breadcrumbs",onClick:e=>{u(void 0!==h?void 0:"")},children:(0,d.jsx)(o.Fragment,{children:void 0===h?(0,d.jsxs)(o.Fragment,{children:[(0,d.jsx)("span",{className:"chevron",children:(0,d.jsx)(n.N_,{to:p,onClick:y,children:(0,d.jsx)(_.In,{icon:"home"})})}),i.map((e,t)=>(0,d.jsxs)("span",{className:"chevron",children:[(0,d.jsx)(_.In,{icon:"keyboard_arrow_right"}),(0,d.jsx)(n.N_,{to:e.href,onClick:y,children:decodeURIComponent(e.value)})]},t))]}):(0,d.jsx)(l.QM,{click:()=>{u(void 0)},children:(0,d.jsx)(r.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),u(void 0)}})})})})}},78714(e,t,i){i.r(t),i.d(t,{default:()=>N});var o=i(96540),n=i(47374),s=i(34843),a=i(82893),r=i(14284),l=i(76213),c=i(57952),_=i(27690),d=i(34289),f=i(53459),p=i(99214),m=i(61443),h=i(47022),u=i(62042),w=i(34899),v=i(7523),y=i(78247),g=i(88815),x=i(6960),k=i(47071),j=i(14944),G=i(92275),A=i(23430);var C=i(34251),b=i(60096),z=i(85997),P=i(23496),F=i(12730),M=i(75725),$=i(70447),S=i(87361),D=i(74848);let X={};function I(){const{t:e}=(0,w.Bd)();let t=(0,l.zy)();const i=(0,l.Zp)(),{check_user_auth:n}=(0,y.MH)(),[c,f]=(0,s.fp)(a.AG.nowFileList),[m,g]=(0,s.fp)(a.AG.uploadFiles),[x,k]=(0,s.fp)(a.AG.showPrompt),[b,P]=(0,s.fp)(a.AG.selectedFileList),[I,E]=(0,s.fp)(a.AG.copyedFileList),[K,Y]=(0,s.fp)(a.AG.cutedFileList),[L,R]=(0,s.fp)(a.AG.selectedFileList),[H,N]=(0,s.fp)(a.AG.clickFileList),[U,W]=(0,s.fp)(a.AG.fileShellShow),[B,O]=(0,s.fp)(a.AG.file_root_list),[Z,q]=(0,s.fp)(a.AG.file_root_index),[V,T]=(0,o.useState)(void 0),[J,Q]=(0,o.useState)(""),[ee,te]=(0,s.fp)(a.AG.workflow_show),[ie,oe]=(0,s.fp)(a.AG.workflow_realtime_show),[ne,se]=(0,s.fp)(a.AG.work_flow_show),{initUserInfo:ae}=(0,o.useContext)(v.F),[re,le]=(0,s.fp)(a.AG.user_base_info),{click_file:ce}=(0,y.kZ)(),[_e,de]=(0,s.fp)(a.AG.prompt_card),fe=(0,o.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type!==h.Iw.folder?1:0),0),[c]),pe=(0,o.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type===h.Iw.folder?1:0),0)+(c.folders?.length??0),[c]);function me(e){(0,u.SK)(e)}(0,o.useEffect)(()=>{X={}},[t]),(0,o.useEffect)(()=>()=>{W({show:!1,path:""})},[]);const he=(0,p.Vs)(),ue=t=>{de({open:!0,title:e("信息"),context_div:(0,D.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,D.jsx)(M.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,D.jsx)(M.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,D.jsx)(M.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,D.jsx)(M.Yh,{left:`${e("文件夹数")}`,right:pe}),(0,D.jsx)(M.Yh,{left:`${e("文件数")}`,right:fe}),(0,D.jsx)(M.Yh,{left:`${e("当前位置")}`,right:(0,D.jsx)($.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{j.ws.removeMsg(G.HK.file_info)}})};return(0,D.jsxs)(o.Fragment,{children:[b.length>0&&(0,D.jsx)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{k({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),b.length>0&&(0,D.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,p.ib)(c,b);E(e.map(e=>(0,p.Ok)(e.name))),Y([]),me("已复制")}}),b.length>0&&(0,D.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,p.ib)(c,b);Y(e.map(e=>(0,p.Ok)(e.name))),E([]),me("已剪切")}}),(I.length>0||K.length>0)&&(0,D.jsx)(z.rA,{onClick:function(){k({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:I.length+K.length}),b.length>0&&(0,D.jsx)(z.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,p.ib)(c,b);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,p.Ok)(i.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),b.length>0&&(0,D.jsx)(z.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,p.ib)(c,b);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,p.Ok)(i.name)}e&&0!==e.length?k({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,u.zN)("没有选中")}}),1===b.length&&(0,D.jsx)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){k({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),ne&&(0,D.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{te(!ee)}}),(0,D.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){U.show?W({show:!1,path:""}):W({show:!0,path:(0,d.GG)("file",(0,d.vX)())})}}),n(A.oV.share_file)&&(0,D.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`/${S.o.share_list_setting_page}`)}}),(0,D.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:he}),(0,D.jsx)(z.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){k({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,d.GG)("file",(0,d.vX)())}})}}),(0,D.jsx)(z.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){k({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,d.GG)("file",(0,d.vX)())}})}}),(0,D.jsx)(z.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{k({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const o=[],n=new Set;for(let e=0;e<t.length;e++){const s=t[e],a=i?s.webkitRelativePath:`${s.webkitRelativePath}${s.name}`;s.fullPath=a,i&&n.add((0,F.S)(a)),o.push(s)}const s=[];if(i)for(const e of n)s.push({isDir:!0,fullPath:e,name:e});s.push(...o),g(s),k({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,D.jsx)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!X.now_absolute_path){j.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(X={...X,...i},j.ws.removeMsg(G.HK.file_info),ue(X))});const t=await j.ws.sendData(G.HK.file_info,{type:h.Iw.folder,path:(0,d.GG)("file",(0,d.vX)())});e=t.context,X=e,ue(X)}ue(X)}}),(0,D.jsx)(z.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const o=new C.ik;o.x=t.clientX,o.y=t.clientY,o.type=h.Iw.directory,o.items=B,o.item_pre_value=Z,o.textClick=async t=>{if(-1===t)return i(`/${S.o.setting_private_env_setting}`),k({data:void 0,overlay:!1,type:"",show:!1}),void(0,u.N9)(e("请配置 文件夹路径"));(async e=>{q(e),await r.$M.post("base_switch",{root_index:e}),await ae(),i("/file/"),R([]),N([])})(t),k({data:void 0,overlay:!1,type:"",show:!1})},k({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}})]})}var E=i(2543),K=i(21499),Y=i(64694);const L=o.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),R=o.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636)));let H;function N(){const[e,t]=(0,s.fp)(a.AG.editorSetting),[i,u]=(0,s.fp)(a.AG.file_preview),{t:F}=(0,w.Bd)();let M=(0,l.zy)();const $=(0,l.Zp)(),[X,N]=(0,s.fp)(a.AG.nowFileList),[U,W]=(0,s.fp)(a.AG.showPrompt),[B,O]=(0,s.fp)(a.AG.selectedFileList),[Z,q]=(0,s.fp)(a.AG.clickFileList),[V,T]=(0,s.fp)(a.AG.fileShellShow),[J,Q]=(0,o.useState)(""),[ee,te]=(0,s.fp)(a.AG.workflow_show),[ie,oe]=(0,s.fp)(a.AG.workflow_realtime_show),[ne,se]=(0,s.fp)(a.AG.work_flow_show),{initUserInfo:ae}=(0,o.useContext)(v.F),[re,le]=(0,s.fp)(a.AG.user_base_info),{click_file:ce}=(0,y.kZ)(),[_e,de]=(0,s.fp)(a.AG.to_running_files),[fe,pe]=(0,s.fp)(a.AG.file_page),[me]=(0,s.fp)(a.AG.blank_search_mode),[he,ue]=(0,s.fp)(a.AG.blank_search_mode_for_temp),we=function(){const[e,t]=(0,s.fp)(a.AG.user_base_info),{t:i}=(0,w.Bd)(),{check_user_auth:n}=(0,y.MH)(),[c,f]=(0,s.fp)(a.AG.router_jump),m=(0,l.Zp)(),{initUserInfo:u}=(0,o.useContext)(v.F),[g,x]=(0,s.fp)(a.AG.nowFileList),[k,b]=(0,s.fp)(a.AG.showPrompt),[z,F]=(0,s.fp)(a.AG.fileShellShow),[M,$]=(0,s.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const o=new C.ik;o.x=t.clientX,o.y=t.clientY,o.type=h.Iw.directory;const s=[{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.time_minx_max?"green":void 0},children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.time_max_min?"green":void 0},children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.size_min_max?"green":void 0},children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.size_max_min?"green":void 0},children:i("大小逆序")}),v:A.t8.size_max_min}],l=[{r:(0,D.jsx)("span",{style:{color:e.user_data.file_list_pagination_mode&&e.user_data.file_list_pagination_mode!==A.yM.all?void 0:"green"},children:i("全部加载文件")}),v:A.yM.all},{r:(0,D.jsx)("span",{style:{color:e.user_data.file_list_pagination_mode===A.yM.pagination?"green":void 0},children:i("分页滚动加载文件")}),v:A.yM.pagination}],c=[{r:(0,D.jsx)("span",{style:{color:e.user_data.file_time_show_type&&e.user_data.file_time_show_type!==A.KD.current?void 0:"green"},children:i("最近时间")}),v:A.KD.current},{r:(0,D.jsx)("span",{style:{color:e.user_data.file_time_show_type===A.KD.time?"green":void 0},children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type?void 0:"green"},children:i("系统默认")}),v:A.t8.defualt},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.name?"green":void 0},children:i("名字")}),v:A.t8.name},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min?"green":void 0},children:i("修改时间")}),v:!1,items:s},{r:(0,D.jsx)("span",{style:{color:e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min?"green":void 0},children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:l},{r:i("时间展示"),v:"",items:c},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,D.jsx)("span",{style:{color:M?"green":void 0},children:i("以空白搜索模式打开目录")}),v:"blank_search_mode"}]},{r:i("以配置表方式打开目录"),v:"gcfg_dir_config"}];g?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),n(A.oV.code_resource)&&w.push({r:i("添加http资源根目录"),v:"code_resource"}),n(A.oV.http_proxy)&&w.push({r:i("在此目录下载http资源"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,p.LL)([...e.user_data.quick_cmd],w),o.items=w,o.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,d.GG)("file",(0,d.vX)());return b({data:void 0,overlay:!1,type:"",show:!1}),void m(`/${S.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,d.GG)("file",(0,d.vX)());return b({data:void 0,overlay:!1,type:"",show:!1}),void m(`/${S.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await j.ws.sendData(G.HK.file_info,{path:(0,d.GG)("file",(0,d.vX)())});return f({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),b({data:void 0,overlay:!1,type:"",show:!1}),void m("/setting/customer_router/")}if("http_resource"===e){const e=await j.ws.sendData(G.HK.file_info,{path:(0,d.GG)("file",(0,d.vX)())});return f({http_download_map_path:e.context.now_absolute_path}),b({data:void 0,overlay:!1,type:"",show:!1}),void m("/proxy/http/")}if("zoom_adjust"===e)return b({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{b({show:!0,type:_.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",F({show:!0,path:(0,d.GG)("file",(0,d.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return $(!M),void b({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 r.wm.post(P.s.user_save_private_attr,{type:e,...t}),await u(),b({data:void 0,overlay:!1,type:"",show:!1}),m((0,d.vX)())},b({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:o})}}(),ve=async()=>{const e=new k.Nd;e.dir_path=`${(0,d.GG)("file",(0,d.vX)())}`,j.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,p.Ys)(e);for(const e of t.failed_file_list)(0,p.V$)(e);de(new Set(t.running_file_list))}}),await j.ws.sendData(G.HK.workflow_realtime,e)},ye=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,g.v7)(i.size),re.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,K.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,x.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{ve()})),i.name===k.SB&&(t=!0);for(const i of e.folders??[])re.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,K.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,x.s)(i.mtime):"",i.name===k.SB&&(t=!0);se(t)};(0,o.useEffect)(()=>async()=>{de(new Set)},[]);const ge=()=>{(async()=>{const e=(0,d.GG)("file",(0,d.vX)());if(me||he)return;let t;if(re.user_data.file_list_pagination_mode===A.yM.pagination){if(fe.page_num<0)return;t=await r.$M.post("file_get_page",{param_path:e,page_num:fe.page_num,page_size:fe.page_size});const i=t.data;i.files?.length||pe({page_size:fe.page_size,page_num:-1}),i.files=(0,E.cloneDeep)([...X.files,...i.files])}else t=await r.$M.get(e);if(t.code!==f.m.Success)return;const i=t.data;(0,p.yC)(i,re.user_data.dir_show_type),ye(t.data),N(t.data),H=t.data})(),t({open:!1}),u({open:!1}),se(!1)};(0,o.useEffect)(()=>{ge()},[M,fe]);const xe=e=>{e.target===e.currentTarget&&(O([]),q([]))};return(0,D.jsxs)(o.Fragment,{children:[(0,D.jsxs)(c.A,{left_children:(0,D.jsx)(m.$Z,{handleEnterPress:async()=>{if(me||he){if(O([]),q([]),!J||!J.trim())return void N({files:[],folders:[]});const e=(0,d.GG)("file",(0,d.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:J.trim()});if(t.code!==f.m.Success)return;const i=t.data;return(0,p.yC)(i,re.user_data.dir_show_type),ye(i),N(i),void(H=i)}if(!H)return;O([]),q([]);const e=[],t=[];for(const t of H.files??[])t.name.includes(J)&&e.push(t);for(const e of H.folders??[])e.name.includes(J)&&t.push(e);N({files:e,folders:t})},placeholder:F("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{Q(e)},max_width:"25em"}),children:[(0,D.jsx)("div",{className:"mobile-context-btn",children:(0,D.jsx)(z.rA,{icon:"more_horiz",title:F("右键"),onClick:()=>{const e=B[B.length-1];if(void 0!==e){const t=[...X.folders??[],...X.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],o=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},n={preventDefault:()=>{},stopPropagation:()=>{},clientX:o.left+10,clientY:o.bottom??100},s=new C.ik;s.path=(0,Y.IO)((0,d.vX)(),t.name),s.filename=t.name,s.x=n.clientX,s.y=n.clientY,s.type=t.type===h.Iw.folder?h.Iw.folder:(0,C.uL)(t.name),s.size=t.origin_size,W({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:s})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};we(e)}}})}),(0,D.jsx)(I,{})]}),(0,D.jsx)(n.e,{baseRoute:"file",clickFun:function(){O([]),q([])},input_path_enter:e=>{var t;!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?$(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 o=e.length-1-t;o>=0;o--)if(e[o]===i)return e.substring(0,o+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,d.vX)(),e)):(e=e.replace(0===(t=re.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),$(e)),O([]),q([]),N({files:[],folders:[]})}}),re.user_data.file_list_pagination_mode===A.yM.pagination?(0,D.jsx)(b.$J,{handleContextMenu:we,clickBlank:xe,list:X.files}):(0,D.jsx)(b.t$,{handleContextMenu:we,file_list:X.files,folder_list:X.folders,clickBlank:xe}),ee&&(0,D.jsx)(L,{}),ie.open&&(0,D.jsx)(R,{})]})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8765],{60096(e,i,t){t.d(i,{QW:()=>F,Ic:()=>z,t$:()=>$,$J:()=>b});var n=t(96540),s=t(47022),l=t(34843),o=t(82893),a=t(61973),r=t(64694),d=t(14284),f=t(34289),c=t(23430),m=t(62042),h=t(99214),p=t(85997),u=t(74848);function _(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,a]=(0,l.fp)(o.AG.nowFileList),[f,m]=(0,l.fp)(o.AG.confirm),[h,_]=(0,l.fp)(o.AG.user_base_info);return(0,u.jsxs)("div",{...e.extraAttr,onClick:()=>{!async function(i){e.click&&e.click(i,e.name)}(e.index)},className:"item",role:"button","data-type":e.isLink?"invalid_link":e.type,"data-dir":!e.type||e.type===s.Iw.folder,"aria-selected":null!==(0,r.kW)(i,e.index),"aria-label":e.name,style:{"--filewidth":e.itemWidth??"33%"},onDragStart:n=>{return s=e.index,void(i.find(e=>e===s)||t([...i,s]));var s},onDrop:i=>((i,t)=>{const l=i.dataTransfer;let o,a=!1;for(let e=0;e<l.items.length;e++)if("file"===l.items[e].kind){a=!0;break}if(!a){if(h?.user_data?.file_list_pagination_mode===c.yM.pagination){if(o=n.files[t],n.files[t]?.type!==s.Iw.folder)return}else if(o=n.folders[t],n.folders.length<=t)return;m({open:!0,title:`确定将文件移动并覆盖到${o?.name}吗?`,handle:async()=>{await e.draggable_handle(o?.name)}})}})(i,e.index),draggable:void 0!==e.draggable_handle,children:[void 0===e.icon&&(0,u.jsx)("div",{children:e.type!==s.Iw.image||null==e.path||h?.user_data?.not_pre_show_image?(0,u.jsx)(p.In,{icon:""}):(0,u.jsx)("img",{loading:"lazy",src:d.$M.getDownloadUrl(e.path,{mtime:e.mtime,cache:1}),alt:e.name})}),void 0!==e.icon&&(0,u.jsx)("div",{className:"rotating-div",children:(0,u.jsx)("span",{className:"material-icons",children:e.icon})}),(0,u.jsxs)("div",{children:[(0,u.jsx)("p",{className:"name",children:e.name}),e.size?(0,u.jsx)("p",{children:e.size}):(0,u.jsx)("p",{children:"—"}),(0,u.jsx)("p",{children:e.show_mtime})]}),e.children]})}var x=t(27690),g=t(34251),y=t(34899),w=t(78247);function k(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,c]=(0,l.fp)(o.AG.clickFileList),[m,p]=(0,l.fp)(o.AG.nowFileList),[k,v]=(0,l.fp)(o.AG.confirm),[A,j]=(0,l.fp)(o.AG.file_page),[G,F]=(0,l.fp)(o.AG.enterKey),{click_file:z}=(0,w.kZ)(),{t:$}=(0,y.Bd)(),b=(0,a.Zp)();(0,a.zy)();const C=(0,h.A9)(),[W,M]=(0,l.fp)(o.AG.showPrompt);return(0,u.jsx)(_,{extraAttr:{onContextMenu:t=>{((t,n,l,o)=>{t.preventDefault(),t.stopPropagation();const a=new g.ik;a.path=(0,r.IO)((0,f.vX)(),n),a.filename=n,a.x=t.clientX,a.y=t.clientY,a.type=l?s.Iw.folder:(0,g.uL)(n),a.size=o,a.useSelectedList=i.includes(e.index),M({show:!0,type:x.PromptEnum.FileMenu,overlay:!1,data:a})})(t,e.name,e.type===s.Iw.folder,e.origin_size)}},draggable_handle:async e=>{const n=(0,h.ib)(m,i).map(e=>(0,h.Ok)(e.name));await d.$M.post("cut",{files:n,to:`${(0,f.GG)("file",(0,f.vX)())}/${e}`});t([]),v({open:!1,handle:null}),b((0,f.vX)())},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,isLink:e.isLink,path:e.path,icon:e.icon,show_mtime:e.show_mtime,click:async(l,o)=>{if(null!==(0,r.kW)(i,l))t((0,r.P1)(i,l));else if("ctrl"===G)t([...i,l]);else if("shift"===G){const{max:e,min:n}=(0,r.a7)(i),s=[];if(l>=e)for(let i=e;i<=l;i++)s.push(i);else for(let e=n;e>=l;e--)s.push(e);t(s)}else t([l]);if(c([...n,l]),setTimeout(()=>{c((0,r.P1)(n,l))},300),e.type===s.Iw.folder){if(void 0!==n.find(e=>e===l))return void C(o)}else{void 0!==n.find(e=>e===l)&&z({name:o,size:e.origin_size,opt_shell:!0,mtime:e.mtime})}},itemWidth:e.itemWidth})}t(38240);var v=t(64405),A=t(88815);function j(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,c]=(0,l.fp)(o.AG.clickFileList),[p,x]=(0,l.fp)(o.AG.editorSetting),[g,k]=(0,l.fp)(o.AG.shellNowDir),[j,G]=(0,l.fp)(o.AG.sshInfo),[F,z]=(0,l.fp)(o.AG.nowFileList),[$,b]=(0,l.fp)(o.AG.enterKey),[C,W]=(0,l.fp)(o.AG.confirm),M=(0,a.Zp)(),{t:S}=(0,y.Bd)();return(0,u.jsx)(_,{draggable_handle:async n=>{const s=new v.x;Object.assign(s,j),s.target=(0,r.HS)(...g,n);const l=(0,h.ib)(F,i).map(e=>(0,r.HS)(...g,e.name));for(const e of l)if(s.source=e,!await d.Fg.post("move",s))return!1;t([]),W({open:!1,handle:null}),await e.fileHandler()},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:async(l,o)=>{if(null!==(0,r.kW)(i,l))t((0,r.P1)(i,l));else if("ctrl"===$)t([...i,l]);else if("shift"===$){const{max:e,min:n}=(0,r.a7)(i),s=[];if(l>=e)for(let i=e;i<=l;i++)s.push(i);else for(let e=n;e>=l;e--)s.push(e);t(s)}else t([l]);if(c([...n,l]),setTimeout(()=>{c((0,r.P1)(n,l))},300),e.type===s.Iw.folder){if(void 0!==n.find(e=>e===l)){const e=new v.x;return e.key=j.key,e.dir=`/${(0,f.GG)("remoteShell",(0,f.vX)())}${o}`,M((0,r.IO)((0,f.vX)(),o)),t([]),c([]),void z({files:[],folders:[]})}}else{if(void 0!==n.find(e=>e===l)){const i=async()=>{const i=new v.x;i.key=j.key,i.file=`/${(0,f.GG)("remoteShell",(0,f.vX)())}${o}`;const t=await d.Fg.post("get/file/text",i);let n;o.endsWith(s.Iw.workflow_act)?n="ace/mode/yaml":(o.endsWith(s.Iw.draw)||o.endsWith(s.Iw.excalidraw))&&(n="ace/mode/json"),x({model:n,open:!0,fileName:e.name,save:async e=>{i.context=e;0===(await d.Fg.post("update/file/text",i)).code&&(w.xK.set_value_temp(""),(0,m.SK)("success"))}}),w.xK.set_value_temp(t.data)};return"number"==typeof e.origin_size&&e.origin_size>A.o5?void W({open:!0,title:S("提示"),sub_title:"文件超过20MB了确定要打开吗?",handle:async()=>{W({open:!1,handle:null}),await i()}}):void await i()}}}})}function G(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,a]=(0,l.fp)(o.AG.clickFileList),[f,c]=(0,l.fp)(o.AG.enterKey),{click_file:m}=(0,w.kZ)(),[p,k]=(0,l.fp)(o.AG.nowFileList),{t:v}=(0,y.Bd)(),[A,j]=(0,l.fp)(o.AG.showPrompt),G=((0,h.oT)(),(0,h.xp)());return(0,u.jsx)(_,{extraAttr:{onContextMenu:i=>{((i,t,n,l)=>{i.preventDefault(),i.stopPropagation();const o=new g.ik,a=e.item_list;for(const e of a)if(e.name===t){o.path=e.path;break}o.is_share=!0,o.filename=t,o.x=i.clientX,o.y=i.clientY,o.type=n?s.Iw.folder:(0,g.uL)(t),o.size=l,o.share_token=e.share.share_token,o.share_id=e.share.share_id,j({show:!0,type:x.PromptEnum.FileMenu,overlay:!1,data:o})})(i,e.name,e.type===s.Iw.folder,e.origin_size)}},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:async(l,o)=>{if(null!==(0,r.kW)(i,l))t((0,r.P1)(i,l));else if("ctrl"===f)t([...i,l]);else if("shift"===f){const{max:e,min:n}=(0,r.a7)(i),s=[];if(l>=e)for(let i=e;i<=l;i++)s.push(i);else for(let e=n;e>=l;e--)s.push(e);t(s)}else t([l]);if(a([...n,l]),setTimeout(()=>{a((0,r.P1)(n,l))},300),e.type!==s.Iw.folder){const i=n.find(e=>e===l);if(void 0!==i){if(G(o))return;m({file_path:e.item_list[i].path,file_url:d.$M.getDownloadUrlV2(e.item_list[i].path,"share_download",{share_id:e.share.share_id,share_token:e.share.share_token}),name:o,size:e.origin_size,opt_shell:!0,mtime:e.mtime,not_type_tip:v("未知类型,请下载查看")})}}}})}function F({handleContextMenu:e,file_list:i,clickBlank:t,share:s}){const[a,r]=(0,l.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:f}=(0,y.Bd)(),c=(0,h.OJ)(),{file_is_running:m}=(0,w.hg)();return(0,h.UK)(i,[],d),(0,u.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:(0,u.jsx)("div",{onClick:t,children:i.map((e,t)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(G,{share:s,item_list:i,icon:m(e.name)?"refresh":void 0,itemWidth:c,index:t+0,...e})},t+0))})})}function z({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:s,fileHandler:a}){const[r,d]=(0,l.fp)(o.AG.user_base_info),f=(0,n.useRef)(null),{t:c}=(0,y.Bd)(),m=(0,h.OJ)(),{file_is_running:p}=(0,w.hg)(),[_,g]=(0,l.fp)(o.AG.fileShellShow),k=(0,n.useMemo)(()=>t?.length??0,[t]);return(0,h.ei)(f,x.PromptEnum.SshUpload),(0,h.UK)(i,t,f),(0,n.useEffect)(()=>()=>{_.show&&g({show:!1,path:""})},[]),(0,u.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${r?.user_data?.file_list_show_type??""}`,ref:f,children:[t&&t.length>0&&(0,u.jsx)("h2",{children:c("文件夹")}),t&&(0,u.jsx)("div",{onClick:s,children:t.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(j,{fileHandler:a,itemWidth:m,index:i,...e})},i))}),i&&i.length>0&&(0,u.jsx)("h2",{onClick:s,children:c("文件")}),i&&(0,u.jsx)("div",{onClick:s,children:i.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(j,{fileHandler:a,icon:p(e.name)?"refresh":void 0,itemWidth:m,index:i+k,...e})},i+k))})]})}function $({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:s}){const[a,r]=(0,l.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:f}=(0,y.Bd)(),[c]=(0,l.fp)(o.AG.zoom_style_by_percent),m=(0,h.OJ)(),{file_is_running:p}=(0,w.hg)(),[_,g]=(0,l.fp)(o.AG.fileShellShow),v=(0,n.useMemo)(()=>t?.length??0,[t]),A=(0,h.pi)(c);return(0,h.ei)(d,x.PromptEnum.FilesUpload),(0,h.UK)(i,t,d),(0,n.useEffect)(()=>()=>{_.show&&g({show:!1,path:""})},[]),(0,u.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:A.fontSize},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:[t&&t.length>0&&(0,u.jsx)("h2",{children:f("文件夹")}),t&&(0,u.jsx)("div",{onClick:s,children:t.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(k,{itemWidth:m,index:i,...e})},i))}),i&&i.length>0&&(0,u.jsx)("h2",{onClick:s,children:f("文件")}),i&&(0,u.jsx)("div",{onClick:s,children:i.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(k,{icon:p(e.name)?"refresh":void 0,itemWidth:m,index:i+v,...e})},i+v))})]})}function b({handleContextMenu:e,list:i,clickBlank:t}){const[s,a]=(0,l.fp)(o.AG.user_base_info),r=(0,n.useRef)(null),{t:d}=(0,y.Bd)(),[f]=(0,l.fp)(o.AG.zoom_style_by_percent),c=(0,h.OJ)(),{file_is_running:m}=(0,w.hg)(),[p,_]=(0,l.fp)(o.AG.fileShellShow),[g,v]=(0,l.fp)(o.AG.enterKey),[A,j]=(0,l.fp)(o.AG.selectedFileList),[G,F]=(0,l.fp)(o.AG.file_page),z=(0,h.pi)(f);return(0,h.UK)(i,[],r),(0,h.ei)(r,x.PromptEnum.FilesUpload),(0,h.SQ)(r,()=>{F(e=>e.page_num<0?e:{page_size:e.page_size,page_num:e.page_num+1})},()=>{}),(0,n.useEffect)(()=>()=>{p.show&&_({show:!1,path:""})},[]),(0,u.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:z.fontSize},className:`mosaic file-icons ${s?.user_data?.file_list_show_type??""}`,ref:r,children:i&&(0,u.jsx)("div",{onClick:t,children:i.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(k,{icon:m(e.name)?"refresh":void 0,itemWidth:c,index:i,...e})},i))})})}},6960(e,i,t){t.d(i,{s:()=>o});var n=t(72635);const s=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const i=Date.now(),t=Math.abs(i-e)/6e4;return t<1?n.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${n.Ay.t("分钟前")}`:t<s?`${(t/60).toFixed(0)} ${n.Ay.t("小时前")}`:t<43200?`${(t/s).toFixed(0)} ${n.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${n.Ay.t("年前")}`}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8765],{60096(e,i,t){t.d(i,{QW:()=>F,Ic:()=>z,t$:()=>$,$J:()=>b});var n=t(96540),s=t(47022),l=t(34843),o=t(82893),a=t(76213),r=t(64694),d=t(14284),f=t(34289),c=t(23430),m=t(62042),h=t(99214),p=t(85997),u=t(74848);function _(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,a]=(0,l.fp)(o.AG.nowFileList),[f,m]=(0,l.fp)(o.AG.confirm),[h,_]=(0,l.fp)(o.AG.user_base_info);return(0,u.jsxs)("div",{...e.extraAttr,onClick:()=>{!async function(i){e.click&&e.click(i,e.name)}(e.index)},className:"item",role:"button","data-type":e.isLink?"invalid_link":e.type,"data-dir":!e.type||e.type===s.Iw.folder,"aria-selected":null!==(0,r.kW)(i,e.index),"aria-label":e.name,style:{"--filewidth":e.itemWidth??"33%"},onDragStart:n=>{return s=e.index,void(i.find(e=>e===s)||t([...i,s]));var s},onDrop:i=>((i,t)=>{const l=i.dataTransfer;let o,a=!1;for(let e=0;e<l.items.length;e++)if("file"===l.items[e].kind){a=!0;break}if(!a){if(h?.user_data?.file_list_pagination_mode===c.yM.pagination){if(o=n.files[t],n.files[t]?.type!==s.Iw.folder)return}else if(o=n.folders[t],n.folders.length<=t)return;m({open:!0,title:`确定将文件移动并覆盖到${o?.name}吗?`,handle:async()=>{await e.draggable_handle(o?.name)}})}})(i,e.index),draggable:void 0!==e.draggable_handle,children:[void 0===e.icon&&(0,u.jsx)("div",{children:e.type!==s.Iw.image||null==e.path||h?.user_data?.not_pre_show_image?(0,u.jsx)(p.In,{icon:""}):(0,u.jsx)("img",{loading:"lazy",src:d.$M.getDownloadUrl(e.path,{mtime:e.mtime,cache:1}),alt:e.name})}),void 0!==e.icon&&(0,u.jsx)("div",{className:"rotating-div",children:(0,u.jsx)("span",{className:"material-icons",children:e.icon})}),(0,u.jsxs)("div",{children:[(0,u.jsx)("p",{className:"name",children:e.name}),e.size?(0,u.jsx)("p",{children:e.size}):(0,u.jsx)("p",{children:"—"}),(0,u.jsx)("p",{children:e.show_mtime})]}),e.children]})}var x=t(27690),g=t(34251),y=t(34899),w=t(78247);function k(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,c]=(0,l.fp)(o.AG.clickFileList),[m,p]=(0,l.fp)(o.AG.nowFileList),[k,v]=(0,l.fp)(o.AG.confirm),[A,j]=(0,l.fp)(o.AG.file_page),[G,F]=(0,l.fp)(o.AG.enterKey),{click_file:z}=(0,w.kZ)(),{t:$}=(0,y.Bd)(),b=(0,a.Zp)();(0,a.zy)();const C=(0,h.A9)(),[W,M]=(0,l.fp)(o.AG.showPrompt);return(0,u.jsx)(_,{extraAttr:{onContextMenu:t=>{((t,n,l,o)=>{t.preventDefault(),t.stopPropagation();const a=new g.ik;a.path=(0,r.IO)((0,f.vX)(),n),a.filename=n,a.x=t.clientX,a.y=t.clientY,a.type=l?s.Iw.folder:(0,g.uL)(n),a.size=o,a.useSelectedList=i.includes(e.index),M({show:!0,type:x.PromptEnum.FileMenu,overlay:!1,data:a})})(t,e.name,e.type===s.Iw.folder,e.origin_size)}},draggable_handle:async e=>{const n=(0,h.ib)(m,i).map(e=>(0,h.Ok)(e.name));await d.$M.post("cut",{files:n,to:`${(0,f.GG)("file",(0,f.vX)())}/${e}`});t([]),v({open:!1,handle:null}),b((0,f.vX)())},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,isLink:e.isLink,path:e.path,icon:e.icon,show_mtime:e.show_mtime,click:async(l,o)=>{if(null!==(0,r.kW)(i,l))t((0,r.P1)(i,l));else if("ctrl"===G)t([...i,l]);else if("shift"===G){const{max:e,min:n}=(0,r.a7)(i),s=[];if(l>=e)for(let i=e;i<=l;i++)s.push(i);else for(let e=n;e>=l;e--)s.push(e);t(s)}else t([l]);if(c([...n,l]),setTimeout(()=>{c((0,r.P1)(n,l))},300),e.type===s.Iw.folder){if(void 0!==n.find(e=>e===l))return void C(o)}else{void 0!==n.find(e=>e===l)&&z({name:o,size:e.origin_size,opt_shell:!0,mtime:e.mtime})}},itemWidth:e.itemWidth})}t(38240);var v=t(64405),A=t(88815);function j(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,c]=(0,l.fp)(o.AG.clickFileList),[p,x]=(0,l.fp)(o.AG.editorSetting),[g,k]=(0,l.fp)(o.AG.shellNowDir),[j,G]=(0,l.fp)(o.AG.sshInfo),[F,z]=(0,l.fp)(o.AG.nowFileList),[$,b]=(0,l.fp)(o.AG.enterKey),[C,W]=(0,l.fp)(o.AG.confirm),M=(0,a.Zp)(),{t:S}=(0,y.Bd)();return(0,u.jsx)(_,{draggable_handle:async n=>{const s=new v.x;Object.assign(s,j),s.target=(0,r.HS)(...g,n);const l=(0,h.ib)(F,i).map(e=>(0,r.HS)(...g,e.name));for(const e of l)if(s.source=e,!await d.Fg.post("move",s))return!1;t([]),W({open:!1,handle:null}),await e.fileHandler()},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:async(l,o)=>{if(null!==(0,r.kW)(i,l))t((0,r.P1)(i,l));else if("ctrl"===$)t([...i,l]);else if("shift"===$){const{max:e,min:n}=(0,r.a7)(i),s=[];if(l>=e)for(let i=e;i<=l;i++)s.push(i);else for(let e=n;e>=l;e--)s.push(e);t(s)}else t([l]);if(c([...n,l]),setTimeout(()=>{c((0,r.P1)(n,l))},300),e.type===s.Iw.folder){if(void 0!==n.find(e=>e===l)){const e=new v.x;return e.key=j.key,e.dir=`/${(0,f.GG)("remoteShell",(0,f.vX)())}${o}`,M((0,r.IO)((0,f.vX)(),o)),t([]),c([]),void z({files:[],folders:[]})}}else{if(void 0!==n.find(e=>e===l)){const i=async()=>{const i=new v.x;i.key=j.key,i.file=`/${(0,f.GG)("remoteShell",(0,f.vX)())}${o}`;const t=await d.Fg.post("get/file/text",i);let n;o.endsWith(s.Iw.workflow_act)?n="ace/mode/yaml":(o.endsWith(s.Iw.draw)||o.endsWith(s.Iw.excalidraw))&&(n="ace/mode/json"),x({model:n,open:!0,fileName:e.name,save:async e=>{i.context=e;0===(await d.Fg.post("update/file/text",i)).code&&(w.xK.set_value_temp(""),(0,m.SK)("success"))}}),w.xK.set_value_temp(t.data)};return"number"==typeof e.origin_size&&e.origin_size>A.o5?void W({open:!0,title:S("提示"),sub_title:"文件超过20MB了确定要打开吗?",handle:async()=>{W({open:!1,handle:null}),await i()}}):void await i()}}}})}function G(e){const[i,t]=(0,l.fp)(o.AG.selectedFileList),[n,a]=(0,l.fp)(o.AG.clickFileList),[f,c]=(0,l.fp)(o.AG.enterKey),{click_file:m}=(0,w.kZ)(),[p,k]=(0,l.fp)(o.AG.nowFileList),{t:v}=(0,y.Bd)(),[A,j]=(0,l.fp)(o.AG.showPrompt),G=((0,h.oT)(),(0,h.xp)());return(0,u.jsx)(_,{extraAttr:{onContextMenu:i=>{((i,t,n,l)=>{i.preventDefault(),i.stopPropagation();const o=new g.ik,a=e.item_list;for(const e of a)if(e.name===t){o.path=e.path;break}o.is_share=!0,o.filename=t,o.x=i.clientX,o.y=i.clientY,o.type=n?s.Iw.folder:(0,g.uL)(t),o.size=l,o.share_token=e.share.share_token,o.share_id=e.share.share_id,j({show:!0,type:x.PromptEnum.FileMenu,overlay:!1,data:o})})(i,e.name,e.type===s.Iw.folder,e.origin_size)}},name:e.name,index:e.index,mtime:e.mtime,size:e.size,type:e.type,itemWidth:e.itemWidth,show_mtime:e.show_mtime,click:async(l,o)=>{if(null!==(0,r.kW)(i,l))t((0,r.P1)(i,l));else if("ctrl"===f)t([...i,l]);else if("shift"===f){const{max:e,min:n}=(0,r.a7)(i),s=[];if(l>=e)for(let i=e;i<=l;i++)s.push(i);else for(let e=n;e>=l;e--)s.push(e);t(s)}else t([l]);if(a([...n,l]),setTimeout(()=>{a((0,r.P1)(n,l))},300),e.type!==s.Iw.folder){const i=n.find(e=>e===l);if(void 0!==i){if(G(o))return;m({file_path:e.item_list[i].path,file_url:d.$M.getDownloadUrlV2(e.item_list[i].path,"share_download",{share_id:e.share.share_id,share_token:e.share.share_token}),name:o,size:e.origin_size,opt_shell:!0,mtime:e.mtime,not_type_tip:v("未知类型,请下载查看")})}}}})}function F({handleContextMenu:e,file_list:i,clickBlank:t,share:s}){const[a,r]=(0,l.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:f}=(0,y.Bd)(),c=(0,h.OJ)(),{file_is_running:m}=(0,w.hg)();return(0,h.UK)(i,[],d),(0,u.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:(0,u.jsx)("div",{onClick:t,children:i.map((e,t)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(G,{share:s,item_list:i,icon:m(e.name)?"refresh":void 0,itemWidth:c,index:t+0,...e})},t+0))})})}function z({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:s,fileHandler:a}){const[r,d]=(0,l.fp)(o.AG.user_base_info),f=(0,n.useRef)(null),{t:c}=(0,y.Bd)(),m=(0,h.OJ)(),{file_is_running:p}=(0,w.hg)(),[_,g]=(0,l.fp)(o.AG.fileShellShow),k=(0,n.useMemo)(()=>t?.length??0,[t]);return(0,h.ei)(f,x.PromptEnum.SshUpload),(0,h.UK)(i,t,f),(0,n.useEffect)(()=>()=>{_.show&&g({show:!1,path:""})},[]),(0,u.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem"},className:`mosaic file-icons ${r?.user_data?.file_list_show_type??""}`,ref:f,children:[t&&t.length>0&&(0,u.jsx)("h2",{children:c("文件夹")}),t&&(0,u.jsx)("div",{onClick:s,children:t.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(j,{fileHandler:a,itemWidth:m,index:i,...e})},i))}),i&&i.length>0&&(0,u.jsx)("h2",{onClick:s,children:c("文件")}),i&&(0,u.jsx)("div",{onClick:s,children:i.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(j,{fileHandler:a,icon:p(e.name)?"refresh":void 0,itemWidth:m,index:i+k,...e})},i+k))})]})}function $({handleContextMenu:e,file_list:i,folder_list:t,clickBlank:s}){const[a,r]=(0,l.fp)(o.AG.user_base_info),d=(0,n.useRef)(null),{t:f}=(0,y.Bd)(),[c]=(0,l.fp)(o.AG.zoom_style_by_percent),m=(0,h.OJ)(),{file_is_running:p}=(0,w.hg)(),[_,g]=(0,l.fp)(o.AG.fileShellShow),v=(0,n.useMemo)(()=>t?.length??0,[t]),A=(0,h.pi)(c);return(0,h.ei)(d,x.PromptEnum.FilesUpload),(0,h.UK)(i,t,d),(0,n.useEffect)(()=>()=>{_.show&&g({show:!1,path:""})},[]),(0,u.jsxs)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:A.fontSize},className:`mosaic file-icons ${a?.user_data?.file_list_show_type??""}`,ref:d,children:[t&&t.length>0&&(0,u.jsx)("h2",{children:f("文件夹")}),t&&(0,u.jsx)("div",{onClick:s,children:t.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(k,{itemWidth:m,index:i,...e})},i))}),i&&i.length>0&&(0,u.jsx)("h2",{onClick:s,children:f("文件")}),i&&(0,u.jsx)("div",{onClick:s,children:i.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(k,{icon:p(e.name)?"refresh":void 0,itemWidth:m,index:i+v,...e})},i+v))})]})}function b({handleContextMenu:e,list:i,clickBlank:t}){const[s,a]=(0,l.fp)(o.AG.user_base_info),r=(0,n.useRef)(null),{t:d}=(0,y.Bd)(),[f]=(0,l.fp)(o.AG.zoom_style_by_percent),c=(0,h.OJ)(),{file_is_running:m}=(0,w.hg)(),[p,_]=(0,l.fp)(o.AG.fileShellShow),[g,v]=(0,l.fp)(o.AG.enterKey),[A,j]=(0,l.fp)(o.AG.selectedFileList),[G,F]=(0,l.fp)(o.AG.file_page),z=(0,h.pi)(f);return(0,h.UK)(i,[],r),(0,h.ei)(r,x.PromptEnum.FilesUpload),(0,h.SQ)(r,()=>{F(e=>e.page_num<0?e:{page_size:e.page_size,page_num:e.page_num+1})},()=>{}),(0,n.useEffect)(()=>()=>{p.show&&_({show:!1,path:""})},[]),(0,u.jsx)("div",{onContextMenu:e,id:"listing",style:{paddingBottom:"10rem",fontSize:z.fontSize},className:`mosaic file-icons ${s?.user_data?.file_list_show_type??""}`,ref:r,children:i&&(0,u.jsx)("div",{onClick:t,children:i.map((e,i)=>(0,u.jsx)(n.Fragment,{children:(0,u.jsx)(k,{icon:m(e.name)?"refresh":void 0,itemWidth:c,index:i,...e})},i))})})}},6960(e,i,t){t.d(i,{s:()=>o});var n=t(72635);const s=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const i=Date.now(),t=Math.abs(i-e)/6e4;return t<1?n.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${n.Ay.t("分钟前")}`:t<s?`${(t/60).toFixed(0)} ${n.Ay.t("小时前")}`:t<43200?`${(t/s).toFixed(0)} ${n.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${n.Ay.t("年前")}`}}}]);
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"/><script defer="defer" src="main.151df5e8840564caf370.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><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"/><script defer="defer" src="main.d470613b59159e063c46.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>