filecat 7.29.0 → 7.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/1448.82d4f4b923f523981b07.js +1 -0
- package/build/dist/1636.990a3f2ff89900dded98.js +1 -0
- package/build/dist/2136.b39a58a19d4ac2a5576f.js +1 -0
- package/build/dist/2502.0e9f512987f1214644ce.js +1 -0
- package/build/dist/2547.f05399f9c795bedaa7aa.js +1 -0
- package/build/dist/259.f8c17a36a328425c15fa.js +1 -0
- package/build/dist/3551.704e2e9b4f6cbdf10d19.js +1 -0
- package/build/dist/3659.0789a31dfe6ca2d1e240.js +1 -0
- package/build/dist/{5272.611514ef844840dccbb3.js → 5272.a1a75285ad5fe14a4df6.js} +1 -1
- package/build/dist/6247.f67824d7abd4170c0fbc.js +1 -0
- package/build/dist/6439.ea487c8a5bebd335956f.js +1 -0
- package/build/dist/676.61682e838264c84dacab.js +1 -0
- package/build/dist/6805.06129b472890b825abfe.js +1 -0
- package/build/dist/6919.d048de2bcdec75a3c6d9.js +1 -0
- package/build/dist/{7873.0938199b862e0a30c168.js → 7873.e9f56d6e875e2cec5512.js} +1 -1
- package/build/dist/8319.93ec1e6ae15d07b98704.js +1 -0
- package/build/dist/8603.70880ac558dcfe09f9e0.js +1 -0
- package/build/dist/8649.fc41337cba5ec4e0c513.js +1 -0
- package/build/dist/9546.48d1545833924e3c1bc0.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.1c8323266d441fe5313d.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1448.374f0fb8ecab79f1b6a8.js +0 -1
- package/build/dist/1636.72a76243c352d7b14b86.js +0 -1
- package/build/dist/2136.49957ff61f304afad25f.js +0 -1
- package/build/dist/2502.c8f9f2c98369af4a1a3c.js +0 -1
- package/build/dist/2547.33fc8794c01a9a98acb8.js +0 -1
- package/build/dist/259.73d375f52940d831b517.js +0 -1
- package/build/dist/3551.f0ec20719cd49ad767de.js +0 -1
- package/build/dist/3659.6d636b2698d3b12a31b9.js +0 -1
- package/build/dist/6247.3fcb34a00b0a6e794a64.js +0 -1
- package/build/dist/6439.6ad9e05effce620ca735.js +0 -1
- package/build/dist/676.591751625c1b7f959f6b.js +0 -1
- package/build/dist/6805.3a1b6695ba63b17d39b5.js +0 -1
- package/build/dist/6919.a43ce76cadcdc5759ced.js +0 -1
- package/build/dist/8319.78e87b11f05a2d8f9d18.js +0 -1
- package/build/dist/8603.8fd3023b066ebaf71bfc.js +0 -1
- package/build/dist/8649.72e48164e0d4db52953e.js +0 -1
- package/build/dist/9546.f1c334f1614f2cdcc91b.js +0 -1
- package/build/dist/main.7f86da4174fe9b6d032b.js +0 -2
- /package/build/dist/{main.7f86da4174fe9b6d032b.js.LICENSE.txt → main.1c8323266d441fe5313d.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1448],{11448(e,t,i){i.r(t),i.d(t,{RebotCardContainer:()=>f,default:()=>y});var l=i(22022),s=i(96540),a=i(85997),n=i(4412),r=i(75725),c=i(61443),d=i(70447),o=i(14284),p=i(53459),h=i(62042),x=i(78247),j=i(23430),m=i(61973),_=i(92350),u=i(74848);const b={qq:{key:"qq",label:"QQ 机器人",icon:"QQ",color:"#12B7F5",fields:[{key:"appId",label:"AppId",type:"text",placeholder:"请输入机器人 AppId",required:!0},{key:"clientSecret",label:"密钥",type:"password",placeholder:"请输入机器人密钥",required:!0}]},dingtalk:{key:"dingtalk",label:"钉钉机器人",icon:"钉钉",color:"#0089FF",fields:[{key:"appId",label:"ClientId (AppKey)",type:"text",placeholder:"请输入应用 ClientId",required:!0},{key:"clientSecret",label:"ClientSecret (AppSecret)",type:"password",placeholder:"请输入应用 ClientSecret",required:!0}]},wecom:{key:"wecom",label:"企业微信机器人",icon:"企业微信",color:"#07C160",fields:[{key:"appId",label:"botId",type:"text",placeholder:"请输入机器人 botId",required:!0},{key:"clientSecret",label:"Secret",type:"password",placeholder:"请输入机器人 Secret",required:!0}]},lark:{key:"lark",label:"飞书机器人",icon:"飞书",color:"#3370FF",fields:[{key:"appId",label:"App ID",type:"text",placeholder:"请输入应用 App ID",required:!0},{key:"clientSecret",label:"App Secret",type:"password",placeholder:"请输入应用 App Secret",required:!0}]}},g=Object.entries(b).map(([e,t])=>({value:e,title:t.label,color:t.color}));function f(e){const{t}=(0,l.Bd)(),[i,n]=(0,s.useState)(!1),[r,d]=(0,s.useState)(!1),o=(t,i)=>{const l=[...e.items];l[t]={...l[t],...i},e.setItems(l)},p=t=>{const i=[...e.items];i.splice(t,1),e.setItems(i)},h=t=>{e.setItems([...e.items,{...e.items[t],open:!1,name:(e.items[t].name||"")+" (副本)"}])};return(0,u.jsxs)(s.Fragment,{children:[(0,u.jsx)("div",{className:"airebot-setting__toolbar",children:!1!==e.have_auth_edit&&(0,u.jsxs)(u.Fragment,{children:[i?(0,u.jsxs)("div",{className:"airebot-setting__add-select",children:[(0,u.jsx)(c.l6,{options:g,defaultValue:"qq",onChange:t=>{return i=t,e.setItems([...e.items,{platform:i,name:"",open:!1,appId:"",clientSecret:"",note:""}]),void n(!1);var i},width:"180px"}),(0,u.jsx)(a.rA,{icon:"cancel",title:t("取消"),onClick:()=>n(!1)})]}):(0,u.jsx)(a.rA,{icon:"add",title:t("添加机器人"),onClick:()=>n(!0)}),(0,u.jsx)(a.rA,{icon:"save",title:t(r?"保存中...":"保存"),onClick:()=>{r||(async()=>{d(!0),await e.save(),d(!1)})()}})]})}),0===e.items.length?(0,u.jsxs)("div",{className:"airebot-setting__empty",children:[(0,u.jsx)("span",{className:"material-symbols-outlined airebot-setting__empty-icon",children:"smart_toy"}),(0,u.jsx)("p",{children:t("还没有配置任何机器人")}),(0,u.jsx)("p",{className:"airebot-setting__empty-hint",children:t("点击上方「添加机器人」按钮来开始配置")})]}):(0,u.jsx)("div",{className:"airebot-setting__grid",children:e.items.map((e,t)=>(0,u.jsx)(v,{item:e,index:t,onChange:o,onDelete:p,onCopy:h},t))})]})}const v=({item:e,index:t,onChange:i,onDelete:s,onCopy:n})=>{const{t:r}=(0,l.Bd)(),o=b[e.platform]??b.qq,p=e._status||"disconnected";e.open;return(0,u.jsx)(d.Zp,{self_title:(0,u.jsx)("div",{className:"airebot-setting__card-header",children:(0,u.jsx)("span",{className:"material-symbols-outlined airebot-setting__card-icon",style:{color:o.color},children:o.icon})}),rightTopCom:(0,u.jsxs)("div",{className:"airebot-setting__card-actions",children:[(0,u.jsx)(a.Ay,{checked:!!e.open,onChange:e=>i(t,{open:e})}),(0,u.jsx)(a.rA,{icon:"content_copy",title:r("复制"),onClick:()=>n(t)}),(0,u.jsx)(a.rA,{icon:"delete",title:r("删除"),onClick:()=>s(t)})]}),children:(0,u.jsxs)("div",{className:"airebot-setting__card-fields",children:[(0,u.jsxs)("div",{className:"airebot-setting__field",children:[(0,u.jsx)("label",{className:"airebot-setting__field-label",children:r("平台")}),(0,u.jsx)(c.l6,{options:g,value:e.platform,onChange:e=>i(t,{platform:e}),width:"100%"})]}),(0,u.jsxs)("div",{className:"airebot-setting__field",children:[(0,u.jsx)("label",{className:"airebot-setting__field-label",children:r("名称")}),(0,u.jsx)(c.Sm,{value:e.name||"",handleInputChange:e=>i(t,{name:e}),placeholder:r("给机器人起个名字")})]}),o.fields.map(l=>{const s=e[l.key]??"";return(0,u.jsxs)("div",{className:"airebot-setting__field",children:[(0,u.jsxs)("label",{className:"airebot-setting__field-label",children:[l.label,l.required&&(0,u.jsx)("span",{className:"airebot-setting__field-required",children:"*"})]}),(0,u.jsx)(c.Sm,{type:l.type,value:s,handleInputChange:e=>i(t,{[l.key]:e}),placeholder:l.placeholder})]},l.key)}),(0,u.jsxs)("div",{className:"airebot-setting__field ",children:[(0,u.jsx)("label",{className:"airebot-setting__field-label",children:r("模型编号")}),(0,u.jsx)(c.Sm,{value:e.model_index,handleInputChange:e=>i(t,{model_index:e}),placeholder:r("使用指定模型(可选)")})]}),(0,u.jsxs)("div",{className:"airebot-setting__field ",children:[(0,u.jsx)("label",{className:"airebot-setting__field-label",children:r("用户id")}),(0,u.jsx)(c.Sm,{value:e.user_id||"",handleInputChange:e=>i(t,{user_id:e}),placeholder:r("默认使用root账户(继承权限,可选)")})]}),(0,u.jsxs)("div",{className:"airebot-setting__field airebot-setting__field-full",children:[(0,u.jsx)("label",{className:"airebot-setting__field-label",children:r("备注")}),(0,u.jsx)(c.Sm,{value:e.note||"",handleInputChange:e=>i(t,{note:e}),placeholder:r("备注信息(可选)")})]})]})})};function y(){const{t:e}=(0,l.Bd)(),t=(0,m.Zp)(),{check_user_auth:i}=(0,x.MH)(),[c,d]=(0,s.useState)([]),b=(0,_.Q)(),g=async()=>{const e=await o.XO.get("ai_rebot_setting");e.code===p.m.Success&&d(e.data?.list??[])};(0,s.useEffect)(()=>{g()},[]);return(0,u.jsxs)("div",{className:"airebot-setting",children:[(0,u.jsx)(n.aZ,{position:"right",children:i(j.oV.ai_agent_setting)&&(0,u.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>t(-1)})}),(0,u.jsx)(r.fI,{children:(0,u.jsxs)(r.VP,{widthPer:100,children:[(0,u.jsxs)("div",{className:"airebot-setting__page-title",children:[(0,u.jsx)("h2",{children:e("机器人配置")}),(0,u.jsx)(a.rA,{icon:"info",onClick:()=>{b("机器人配置")},title:"信息"})]}),(0,u.jsx)(f,{items:c,setItems:d,save:async()=>{const t={list:c.map((e,t)=>({...e,index:t}))};(await o.XO.post("ai_rebot_setting/save",t)).code===p.m.Success&&((0,h.SK)(e("保存成功")),await g())},have_auth_edit:i(j.oV.ai_agent_setting)})]})})]})}i.d(t,["PLATFORM_META",0,b,"RebotCard",0,v])},92350(e,t,i){i.d(t,{Q:()=>p,o:()=>x});var l=i(34843),s=i(82893),a=i(74777),n=i(96540),r=i(22022),c=i(23430),d=i(14284),o=i(74848);function p(){const[e,t]=(0,l.fp)(s.AG.prompt_card),{t:i,i18n:n}=(0,r.Bd)();return e=>{let l;e===a.jk.ffmpeg?l=(0,o.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.jk.smartmontools?l=(0,o.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?l=(0,o.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,o.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?l=(0,o.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?l=(0,o.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?l=(0,o.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?l=(0,o.jsx)("div",{children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,o.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?l=(0,o.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?l=(0,o.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?l=(0,o.jsx)("div",{children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,o.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,o.jsxs)("li",{children:[(0,o.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,o.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,o.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,o.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?l=(0,o.jsx)("div",{children:i("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(l=(0,o.jsxs)("div",{children:[(0,o.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,o.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,o.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,o.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,o.jsx)("div",{children:l})})}}let h=c.Ky;function x(){const[e,t]=(0,n.useState)([]);return(0,n.useEffect)(()=>{(async()=>{try{const e=await d.XO.get("themes");if(0===e.code){const i=e.data||[];h=[...c.Ky,...i],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1636],{88062(e,n,o){o(96540),o(32768);var s=o(74848);function t(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const i=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(t,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,o)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},o))})]}),c=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,o)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},o))})});o.d(n,["A",0,c])},81636(e,n,o){o.r(n),o.d(n,{default:()=>g});var s=o(22022),t=o(96540),i=o(34843),c=o(82893),r=o(92275),l=o(14944),d=o(70447),a=o(85997),u=o(4412),x=o(75725),f=o(47071),h=o(34289),m=o(88062),j=o(97856),v=(o(62042),o(15629),o(99214)),p=o(74848);const k=t.lazy(()=>o.e(3233).then(o.bind(o,85614)));let _,w;function g(e){const{t:n}=(0,s.Bd)(),[o,g]=(0,i.fp)(c.AG.workflow_realtime_show),[C]=(0,i.fp)(c.AG.current_mount),[y,M]=(0,t.useState)([]),[b,q]=(0,t.useState)([]),[S,F]=(0,t.useState)(!1),[A,N]=(0,t.useState)(void 0),[$,B]=(0,t.useState)([]),G=e=>{for(const n of e){if(null==n.code&&n?.extra_data?.running_type===f.rl.running)n.name=(0,p.jsxs)("div",{children:[(0,p.jsx)(d.fq,{running:!0}),n.name]});else if(0===n.code)n.name=(0,p.jsxs)("div",{children:[(0,p.jsx)(d.fq,{success:!0}),n.name]});else{if(!(n.code<1)){delete n.children;continue}n.name=(0,p.jsxs)("div",{children:[(0,p.jsx)(d.fq,{success:!1}),n.name]})}n.children&&G(n.children)}};(0,t.useEffect)(()=>(F(!1),_=void 0,w=void 0,(async()=>{const e=new f.v3;e.filename_path=`${(0,v.Zl)((0,h.GG)("file",(0,h.vX)()),C)}${o.filename}`,l.ws.addMsg(r.HK.workflow_realtime_one_rsq,e=>{if(e.context.list&&e.context.list.length>0){const n=e.context.list;G(n),B(n)}e.context.new_log&&E(e.context.new_log)}),l.ws.sendData(r.HK.workflow_realtime_one_req,e)})(),async()=>{l.ws.removeMsg(r.HK.workflow_realtime_one_rsq),w&&(w.dispose(),w=null)}),[]);const E=async e=>{w||await new Promise(e=>{_=e,F(!0),(async()=>{const e=new j.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});w=e,N(e)})()}),e&&w.write(e)};return(0,p.jsxs)("div",{children:[(0,p.jsxs)(u.aZ,{position:"right",children:[A&&(0,p.jsx)(a.rA,{icon:"print",title:"打印日志",onClick:()=>{F(!S)}}),(0,p.jsx)(a.rA,{icon:"close",title:n("关闭"),onClick:()=>{g({open:!1})}})]}),(0,p.jsx)(x.jW,{isFull:!0,more:!0,children:(0,p.jsx)(x.NN,{children:(0,p.jsx)(m.A,{list:$,click:e=>{}})})}),(0,p.jsx)("div",{style:{display:S?"":"none"},children:(0,p.jsx)(k,{show:!0,terminal:A,init:()=>{_&&(_(1),_=void 0)}})})]})}},15629(e,n,o){o.d(n,{W:()=>r});o(96540);var s=o(70447),t=o(47071),i=o(22022),c=o(74848);function r({item:e}){const{t:n}=(0,i.Bd)();let o,r;return null!=e.code?o=0===e.code:e.extra_data?.running_type===t.rl.running&&(r=!0),(0,c.jsxs)("div",{children:[(0,c.jsx)(s.fq,{success:o,running:r}),n(o?"成功":"失败")]})}const l=(e,n,o)=>{if(n)for(const o of n??[]){let n;const t=[];o["use-yml"]?(l(t,void 0,o.use_job_children_list),n=`${o["use-yml"]} ;${o.duration??-1}`):o.runs?n=JSON.stringify(o.runs):o.run?n=o.run:o["run-js"]?n=o["run-js"]:o.sleep&&(n=`sleep ${o.sleep}`),n=(0,c.jsxs)("div",{children:[(0,c.jsx)(s.fq,{success:void 0===o.code?void 0:0===o.code})," ",n+" ;"+(o.duration??"")]}),e.push({name:n,children:t,extra_data:{code:o.code,context:o.message}})}else if(o)for(const n of o??[]){const o=(0,c.jsxs)("div",{children:[(0,c.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:o,extra_data:{code:n.code,is_job:!0,job_data:n}})}};o.d(n,["Y",0,l])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2136],{47374(e,t,s){s.d(t,{e:()=>h});var n=s(96540),i=s(61973),a=s(64694),l=s(34289),o=s(61443),r=s(75725),c=s(22022),d=s(85997),_=s(74848);function h(e){let t=(0,i.zy)();const s=(0,i.Zp)(),[h,p]=(0,n.useState)([]),[m,f]=(0,n.useState)("/"),[u,x]=(0,n.useState)(void 0),{t:g,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",s=(0,l.vX)().split("/");s=s.filter(e=>e);const n=s.indexOf(e.baseRoute),i=[];if(-1!=n){t=(0,a.IO)(s.slice(0,n),e.baseRoute);const l=s.slice(n+1);for(let e=0;e<l.length;e++){const s=l[e];i.push({value:s,href:0===e?`${t}${s}/`:(0,a.IO)(i[e-1].href,s)})}f(t),p(i)}},[t]);const w=t=>{t.stopPropagation(),e.clickFun(t)},[j,y]=(0,n.useState)(0),k=(0,n.useRef)(null),b=(0,n.useRef)(null),A=()=>{const e=k.current,t=b.current;if(!e||!t)return;const s=[];for(const e of Array.from(t.children))s.push(e.getBoundingClientRect().width);const n=e.clientWidth;if(s.reduce((e,t)=>e+t,0)<=n||s.length<=2)return void y(e=>0===e?e:0);let i=s[0]+48,a=0;for(let e=s.length-1;e>=1&&!(i+s[e]>n);e--)i+=s[e],a++;const l=Math.max(s.length-1-a,0);y(e=>e===l?e:l)};(0,n.useEffect)(()=>{A();const e=new ResizeObserver(A);return k.current&&e.observe(k.current),()=>e.disconnect()},[h,m,t]),(0,n.useEffect)(()=>{const e=k.current;e&&0!==j&&e.scrollWidth>e.clientWidth&&j<h.length-1&&y(e=>e+1)});const N=j>0?1+j:1,C=j>0?h.slice(1,N):[],[G,S]=(0,n.useState)(null);return(0,n.useEffect)(()=>{S(null)},[t,j]),(0,_.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{x(void 0!==u?void 0:"")},children:[(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(i.N_,{to:m,onClick:w,children:(0,_.jsx)(d.In,{icon:"home"})})}),h.map((e,t)=>j>0&&t>=1&&t<N?1!==t?null:(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();S({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(i.N_,{to:e.href,onClick:w,children:decodeURIComponent(e.value)})]},t)),(0,_.jsxs)("div",{className:"breadcrumbs-measure",ref:b,"aria-hidden":!0,children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(i.N_,{to:m,children:(0,_.jsx)(d.In,{icon:"home"})})}),h.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(i.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,_.jsx)(r.QM,{click:()=>{x(void 0)},children:(0,_.jsx)(o.Sm,{width:"100%",placeholder:g("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),x(void 0)}})})}),G&&(0,_.jsx)(r.rY,{click:()=>S(null),children:(0,_.jsx)(r.sw,{x:G.x,y:G.y,items:C.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{S(null),s(e)}})})]})}},22136(e,t,s){s.r(t),s.d(t,{default:()=>ee});var n=s(96540),i=s(47374),a=s(34843),l=s(52035),o=s(82893),r=s(14284),c=s(61973),d=s(4412),_=s(78150),h=s(34289),p=s(53459),m=s(99214),f=s(61443),u=s(32768),x=s(62042),g=s(22022),v=s(7523),w=s(78247),j=s(88815),y=s(6960),k=s(47071),b=s(14944),A=s(92275),N=s(23430),C=s(72458),G=s(34251),S=s(60096),I=s(87361),M=s(99647),z=s(85997),E=s(23496),$=s(74848);function P(e){const{t}=(0,g.Bd)(),[s,i]=(0,n.useState)([]),[a,l]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(""),h=t=>{const s=e.base_path.endsWith("/")?e.base_path:e.base_path+"/",n=t.type===u.Iw.folder?s+t.name:t.path??s+t.name;return n.startsWith("/")?n:"/"+n};(0,n.useEffect)(()=>{(async()=>{if(a)return;l(!0);const t=await r.$M.post("file_get_page",{param_path:e.base_path,page_num:1,page_size:1e4});if(t?.code!==p.m.Success)return;const s=t.data.files??[],n=s.filter(e=>e.type===u.Iw.folder).sort((e,t)=>e.name.localeCompare(t.name)),o=s.filter(e=>e.type!==u.Iw.folder).sort((e,t)=>e.name.localeCompare(t.name));i([...n,...o])})()},[]);const m=(0,n.useMemo)(()=>{const e=o.trim().toLowerCase();return e?s.filter(t=>t.name.toLowerCase().includes(e)):s},[s,o]),x=()=>{const t=d.trim();t&&!e.ignore_names.includes(t)&&(e.on_change_names([...e.ignore_names,t]),_(""))};return(0,$.jsxs)("div",{className:"search-exclude",children:[(0,$.jsxs)("div",{className:"search-exclude__section",children:[(0,$.jsx)("div",{className:"search-exclude__title",children:t("排除当前目录下的项")}),(0,$.jsx)(f.$Z,{icon:"search",value:o,placeholder:t("过滤列表"),handleInputChange:e=>c(e),handleEnterPress:()=>{}}),(0,$.jsxs)("div",{className:"search-exclude__list",children:[0===m.length&&(0,$.jsx)("div",{className:"search-exclude__empty",children:t(a?"无匹配":"加载中")}),m.map(t=>{const s=h(t),n=e.exclude_paths.includes(s),i=t.type===u.Iw.folder;return(0,$.jsxs)("label",{className:"search-exclude__item",children:[(0,$.jsx)("input",{type:"checkbox",checked:n,onChange:()=>(t=>{const s=h(t),n=e.exclude_paths.includes(s);e.on_change_paths(n?e.exclude_paths.filter(e=>e!==s):[...e.exclude_paths,s])})(t)}),(0,$.jsx)("span",{className:"material-symbols-outlined"+(i?" search-exclude__icon--dir":""),children:i?"folder":"draft"}),(0,$.jsx)("span",{className:"search-exclude__item-name",title:t.name,children:t.name})]},s)})]}),e.exclude_paths.length>0&&(0,$.jsx)("div",{className:"search-exclude__chosen",children:e.exclude_paths.map(t=>(0,$.jsxs)("span",{className:"search-exclude__tag",children:[t.split("/").filter(Boolean).pop(),(0,$.jsx)("span",{className:"material-symbols-outlined",onClick:()=>e.on_change_paths(e.exclude_paths.filter(e=>e!==t)),children:"close"})]},t))})]}),(0,$.jsxs)("div",{className:"search-exclude__section search-exclude__section--ignore",children:[(0,$.jsx)("div",{className:"search-exclude__title",children:t("忽略名字")}),(0,$.jsx)("div",{className:"search-exclude__hint",children:t("按名字忽略")}),(0,$.jsxs)("div",{className:"search-exclude__chosen",children:[0===e.ignore_names.length&&(0,$.jsx)("span",{className:"search-exclude__hint",children:t("暂无")}),e.ignore_names.map(t=>(0,$.jsxs)("span",{className:"search-exclude__tag",children:[t,(0,$.jsx)("span",{className:"material-symbols-outlined",onClick:()=>(t=>{e.on_change_names(e.ignore_names.filter(e=>e!==t))})(t),children:"close"})]},t))]}),(0,$.jsxs)("div",{className:"search-exclude__add",children:[(0,$.jsx)(f.Sm,{value:d,placeholder:t("如 node_modules"),handleInputChange:e=>_(e),handlerEnter:x,width:"12em"}),(0,$.jsx)(z.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"div-row",children:[(0,$.jsx)(z.rA,{icon:"save",title:t("保存忽略名字"),onClick:async()=>{await r.wm.post(E.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:e.ignore_names})}}),(0,$.jsx)(z.rA,{icon:"settings",title:t("忽略名字设置"),onClick:e.on_open_setting})]})]})]})}function F(e){const{t}=(0,g.Bd)(),{initUserInfo:s}=(0,n.useContext)(v.F),[i]=(0,a.fp)(o.AG.user_base_info),l=i?.user_data?.search_exclude_names,[c,d]=(0,n.useState)(Array.isArray(l)?[...l]:[]),[_,h]=(0,n.useState)(""),[m,u]=(0,n.useState)(!1),x=()=>{const e=_.trim();e&&!c.includes(e)&&(d([...c,e]),h(""))};return(0,$.jsxs)("div",{className:"search-ignore-setting",children:[(0,$.jsx)("div",{className:"search-ignore-setting__desc",children:t("按名字忽略说明")}),(0,$.jsxs)("div",{className:"search-ignore-setting__add",children:[(0,$.jsx)(f.Sm,{value:_,placeholder:t("如 node_modules"),handleInputChange:e=>h(e),handlerEnter:x,width:"20em"}),(0,$.jsx)(z.rA,{icon:"add",title:t("添加"),onClick:x})]}),(0,$.jsxs)("div",{className:"search-ignore-setting__list",children:[0===c.length&&(0,$.jsx)("div",{className:"search-ignore-setting__empty",children:t("暂无")}),c.map(e=>(0,$.jsxs)("div",{className:"search-ignore-setting__item",children:[(0,$.jsx)("span",{className:"material-symbols-outlined",children:"block"}),(0,$.jsx)("span",{className:"search-ignore-setting__item-name",children:e}),(0,$.jsx)(z.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>d(c.filter(t=>t!==e)))(e)})]},e))]}),(0,$.jsxs)("div",{className:"div-row div-row--end search-ignore-setting__footer",children:[(0,$.jsx)(z.rA,{icon:"arrow_back",title:t("返回"),onClick:e.on_back}),(0,$.jsx)(z.rA,{icon:"save",title:t("保存"),onClick:async()=>{if(m)return;u(!0);const t=await r.wm.post(E.s.user_save_private_attr,{is_search_exclude:!0,search_exclude_names:c});u(!1),t?.code===p.m.Success&&(await s(),e.on_back())}})]})]})}const R=500;function K(e){const{t}=(0,g.Bd)(),s=(0,c.Zp)(),[,i]=(0,a.fp)(o.AG.prompt_card),[l]=(0,a.fp)(o.AG.user_base_info),{click_file:r}=(0,m.kZ)(),[d,_]=(0,n.useState)(""),[h,p]=(0,n.useState)("name"),[u,x]=(0,n.useState)(!1),[v,w]=(0,n.useState)(!1),[j,y]=(0,n.useState)(!0),[k,N]=(0,n.useState)([]),[C,G]=(0,n.useState)([]),[S,E]=(0,n.useState)(!1),[K,L]=(0,n.useState)(!1),[X,D]=(0,n.useState)(!1),[U,H]=(0,n.useState)([]),[B,Z]=(0,n.useState)(0),[Y,O]=(0,n.useState)(!1),W=(0,n.useRef)(!1),T=(0,n.useMemo)(()=>new M.I((0,b.s)(),"file_deep_search"),[]),q=(0,n.useRef)(!1),V=(0,n.useRef)(!1),J=decodeURIComponent(e.base_path),Q=()=>i({open:!1}),ee=()=>{const e=l?.user_data?.search_exclude_names;return Array.isArray(e)?e:[]};(0,n.useEffect)(()=>{G(ee())},[l?.user_data?.search_exclude_names]),(0,n.useEffect)(()=>{let e=[],t=null;const s=()=>{if(t=null,q.current||V.current||!e.length)return;const s=e;e=[],Z(e=>e+s.length),H(e=>e.length>=R?e:[...e,...s].slice(0,R))},n=()=>{q.current||D(!1)};return T.addMsg(A.HK.file_deep_search_data,n=>{q.current||V.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(s,100)))}),T.addMsg(A.HK.file_deep_search_end,()=>{q.current||V.current||(s(),D(!1))}),T.on_message("close",n),()=>{q.current=!0,clearTimeout(t),W.current&&T.sendNotify(A.HK.file_deep_search_cancel,{}).catch(()=>{}).finally(()=>T.close()),T.removeMsg(A.HK.file_deep_search_data),T.removeMsg(A.HK.file_deep_search_end),T.off_message("close",n)}},[]);const te=()=>{const t=d.trim();if(!t||X)return;V.current=!1,H([]),Z(0),O(!0),W.current=!0,D(!0);const s={param_path:e.base_path,keyword:t,search_type:h,is_regex:u,ignore_case:v};"content"===h&&(s.show_match_line=j),k.length&&(s.exclude_paths=k),C.length&&(s.exclude_names=C),T.sendData(A.HK.file_deep_search,s).catch(()=>{})},se=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),Q(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/"))},ne=async e=>{if(e.is_dir)return se(e);const t=e.path.slice(0,e.path.lastIndexOf("/")+1)||"/";Q(),s(I.o.file+t.split("/").map(encodeURIComponent).join("/")),await new Promise(e=>setTimeout(e,300)),await r({name:e.name,opt_shell:!0})},ie="content"===h;return K?(0,$.jsx)(F,{on_back:()=>{L(!1),G(ee())}}):(0,$.jsxs)("div",{className:"file-deep-search",children:[(0,$.jsxs)("div",{className:"file-deep-search__bar",children:[(0,$.jsx)(f.$Z,{icon:"search",value:d,placeholder:t(ie?"搜文件内容":"搜文件名"),handleInputChange:e=>_(e),handleEnterPress:te}),(0,$.jsx)("button",{className:"button button--flat",onClick:X?()=>{V.current=!0,T.sendNotify(A.HK.file_deep_search_cancel,{}).catch(()=>{}),D(!1)}:te,children:t(X?"取消":"搜索")}),(0,$.jsx)(z.rA,{icon:"close",title:t("关闭"),onClick:Q})]}),(0,$.jsxs)("div",{className:"file-deep-search__tabs",children:[(0,$.jsx)("button",{className:"file-deep-search__tab"+(ie?"":" file-deep-search__tab--active"),onClick:()=>p("name"),children:t("文件名")}),(0,$.jsx)("button",{className:"file-deep-search__tab"+(ie?" file-deep-search__tab--active":""),onClick:()=>p("content"),children:t("文件内容")})]}),(0,$.jsxs)("div",{className:"file-deep-search__options",children:[(0,$.jsx)(f.GL,{context:t("正则"),selected:u,onchange:()=>x(!u)}),(0,$.jsx)(f.GL,{context:t("忽略大小写"),selected:v,onchange:()=>w(!v)}),ie&&(0,$.jsx)(f.GL,{context:t("显示匹配行"),selected:j,onchange:()=>y(!j)})]}),(0,$.jsxs)("div",{className:"file-deep-search__hint",children:[(0,$.jsxs)("span",{children:[t("范围"),":",J]}),(0,$.jsxs)("span",{className:"file-deep-search__hint-right",children:[(k.length>0||C.length>0)&&(0,$.jsxs)("span",{className:"file-deep-search__excluded",children:[t("已排除")," ",k.length+C.length]}),(0,$.jsxs)("button",{className:"file-deep-search__filter"+(S?" file-deep-search__filter--active":""),onClick:()=>E(!S),children:[(0,$.jsx)("span",{className:"material-symbols-outlined",children:"filter_alt"}),t("过滤")]}),B>0&&(0,$.jsx)("span",{className:"file-deep-search__count",children:B>R?`${t("已显示")} 500 / ${B}`:`${B}`})]})]}),S&&(0,$.jsx)(P,{base_path:e.base_path,exclude_paths:k,ignore_names:C,on_change_paths:N,on_change_names:G,on_open_setting:()=>L(!0)}),(0,$.jsxs)("div",{className:"file-deep-search__body"+(ie&&j?" file-deep-search__body--line":""),children:[U.length>0&&(0,$.jsx)("div",{className:"file-deep-search__results",children:U.map(e=>{const s=e.path.slice(0,e.path.lastIndexOf("/")+1);return(0,$.jsxs)("div",{className:"file-deep-search__row",children:[(0,$.jsxs)("div",{className:"file-deep-search__name",children:[e.is_dir?(0,$.jsx)("span",{className:"file-deep-search__dir",children:e.name}):(0,$.jsx)("span",{className:"file-deep-search__file",title:e.name,children:e.name}),(0,$.jsx)("span",{className:"file-deep-search__path",children:s}),e.lines&&e.lines.length>0&&(0,$.jsx)("div",{className:"file-deep-search__lines",children:e.lines.map(t=>(0,$.jsxs)("div",{className:"file-deep-search__line",onClick:()=>ne(e),children:[(0,$.jsx)("span",{className:"file-deep-search__line-no",children:t.line}),(0,$.jsx)("span",{className:"file-deep-search__line-text",children:t.text})]},t.line))})]}),(0,$.jsxs)("div",{className:"file-deep-search__actions",children:[(0,$.jsx)(z.rA,{icon:"open_in_new",title:e.is_dir?t("打开"):t("打开文件"),onClick:()=>ne(e)}),(0,$.jsx)(z.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>se(e)})]})]},e.path)})}),X&&(0,$.jsxs)("div",{className:"file-deep-search__empty",children:[(0,$.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!X&&B>R&&(0,$.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!X&&0===U.length&&(0,$.jsx)("div",{className:"file-deep-search__empty",children:t(Y?"无匹配":ie?"输入内容后搜":"输入后搜")})]})]})}var L=s(64694),X=s(12730),D=s(75725),U=s(70447),H=s(40505);let B={};function Z(){const{t:e}=(0,g.Bd)();let t=(0,c.zy)();const s=(0,c.Zp)(),{check_user_auth:i}=(0,w.MH)(),[l,d]=(0,a.fp)(o.AG.nowFileList),[p,f]=(0,a.fp)(o.AG.uploadFiles),[j,y]=(0,a.fp)(o.AG.showPrompt),[k,C]=(0,a.fp)(o.AG.selectedFileList),[S,M]=(0,a.fp)(o.AG.copyedFileList),[E,P]=(0,a.fp)(o.AG.cutedFileList),[F,R]=(0,a.fp)(o.AG.selectedFileList),[K,H]=(0,a.fp)(o.AG.clickFileList),[Z,Y]=(0,a.fp)(o.AG.fileShellShow),O=(0,m.Cf)(),[W,T]=(0,a.fp)(o.AG.file_root_list),[q,V]=(0,a.fp)(o.AG.file_root_index),[J,Q]=(0,n.useState)(void 0),[ee,te]=(0,n.useState)(""),[se,ne]=(0,a.fp)(o.AG.workflow_show),[ie,ae]=(0,a.fp)(o.AG.workflow_realtime_show),[le,oe]=(0,a.fp)(o.AG.work_flow_show),{initUserInfo:re}=(0,n.useContext)(v.F),[ce,de]=(0,a.fp)(o.AG.user_base_info),{click_file:_e}=(0,m.kZ)(),[he,pe]=(0,a.fp)(o.AG.prompt_card),me=(0,n.useMemo)(()=>l.files.reduce((e,t)=>e+(t.type!==u.Iw.folder?1:0),0),[l]),fe=(0,n.useMemo)(()=>l.files.reduce((e,t)=>e+(t.type===u.Iw.folder?1:0),0)+(l.folders?.length??0),[l]);function ue(e){(0,x.SK)(e)}(0,n.useEffect)(()=>{B={}},[t]),(0,n.useEffect)(()=>()=>{Y({show:!1,path:""})},[]);const xe=(0,m.Vs)(),ge=t=>{pe({open:!0,title:e("信息"),context_div:(0,$.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,$.jsx)(D.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,$.jsx)(D.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,$.jsx)(D.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,$.jsx)(D.Yh,{left:`${e("文件夹数")}`,right:fe}),(0,$.jsx)(D.Yh,{left:`${e("文件数")}`,right:me}),(0,$.jsx)(D.Yh,{left:`${e("当前位置")}`,right:(0,$.jsx)(U.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{b.ws.removeMsg(A.HK.file_info)}})};return(0,$.jsxs)(n.Fragment,{children:[k.length>0&&(0,$.jsx)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{y({show:!0,type:_.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),k.length>0&&(0,$.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,m.ib)(l,k);M(e.map(e=>(0,m.Ok)(e.name))),P([]),ue("已复制")}}),k.length>0&&(0,$.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,m.ib)(l,k);P(e.map(e=>(0,m.Ok)(e.name))),M([]),ue("已剪切")}}),(S.length>0||E.length>0)&&(0,$.jsx)(z.rA,{onClick:function(){y({show:!0,type:_.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+E.length}),k.length>0&&(0,$.jsx)(z.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,m.ib)(l,k);for(let t=0;t<e.length;t++){const s=e[t];e[t]=encodeURIComponent((0,m.Ok)(s.name))}const t=r.$M.getDownloadUrl(e);window.open(t)}}),k.length>0&&(0,$.jsx)(z.rA,{icon:"compress",title:e("压缩"),onClick:function(){const t=(0,m.ib)(l,k);for(let e=0;e<t.length;e++){const s=t[e];t[e]=(0,m.Ok)(s.name)}t&&0!==t.length?y({show:!0,type:_.PromptEnum.Compress,overlay:!0,data:{files:t}}):(0,x.zN)(e("没有选中"))}}),1===k.length&&(0,$.jsx)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){y({show:!0,type:_.PromptEnum.FileRename,overlay:!0,data:{}})}}),le&&(0,$.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!se)}}),O.can_terminal&&(0,$.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){Z.show?Y({show:!1,path:""}):Y({show:!0,path:(0,h.GG)("file",(0,h.vX)())})}}),i(N.oV.share_file)&&(0,$.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{s(`${I.o.share_list_setting_page}`)}}),(0,$.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:xe}),(0,$.jsx)(z.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){y({show:!0,type:_.PromptEnum.DirNew,overlay:!0,data:{dir:(0,h.GG)("file",(0,h.vX)())}})}}),(0,$.jsx)(z.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){y({show:!0,type:_.PromptEnum.FileNew,overlay:!0,data:{dir:(0,h.GG)("file",(0,h.vX)())}})}}),(0,$.jsx)(z.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{y({show:!0,type:_.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let s=!!t[0].webkitRelativePath;const n=[],i=new Set;for(let e=0;e<t.length;e++){const a=t[e],l=s?a.webkitRelativePath:`${a.webkitRelativePath}${a.name}`;a.fullPath=l,s&&i.add((0,X.S)(l)),n.push(a)}const a=[];if(s)for(const e of i)a.push({isDir:!0,fullPath:e,name:e});a.push(...n),f(a),y({show:!0,type:_.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,$.jsx)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!B.now_absolute_path){b.ws.addMsg(A.HK.file_info,t=>{const s=t.context;e&&(B={...B,...s},b.ws.removeMsg(A.HK.file_info),ge(B))});const t=await b.ws.sendData(A.HK.file_info,{type:u.Iw.folder,path:(0,h.GG)("file",(0,h.vX)())});e=t.context,B=e,ge(B)}ge(B)}}),(0,$.jsx)(z.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new G.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory,n.items=W,n.item_pre_value=q,n.textClick=async t=>{if(t.type===G.LU.add)return s(`${I.o.setting_private_env_setting}`),y({data:void 0,overlay:!1,type:"",show:!1}),void(0,x.N9)(e("请配置 文件夹路径"));y({data:void 0,overlay:!1,type:"",show:!1}),t.type!==G.LU.child?(async e=>{V(e),await r.$M.post("base_switch",{root_index:e}),await re(),s("/file/"),R([]),H([])})(t.index):s((0,L.IO)(I.o.file,t.rel))},y({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var Y=s(32918),O=s(2543),W=s(21499);const T=n.lazy(()=>Promise.all([s.e(7856),s.e(6349),s.e(3659)]).then(s.bind(s,63659))),q=n.lazy(()=>Promise.all([s.e(7856),s.e(1636)]).then(s.bind(s,81636))),V=n.lazy(()=>Promise.all([s.e(3277),s.e(9345)]).then(s.bind(s,49345)));let J,Q="";function ee(){const[e,t]=(0,a.fp)(o.AG.editorSetting),[,s]=(0,a.fp)(o.AG.md_editor),[,x]=(0,a.fp)(o.AG.log_viewer),[,M]=(0,a.fp)(o.AG.image_editor),[,P]=(0,a.fp)(o.AG.markdown),[,F]=(0,a.fp)(o.AG.excalidraw_editor),[,R]=(0,a.fp)(o.AG.mind_editor),[,X]=(0,a.fp)(o.AG.timeline_editor),[,D]=(0,a.fp)(o.AG.excel_editor),[U,B]=(0,a.fp)(o.AG.file_preview),{t:ee}=(0,g.Bd)();let te=(0,c.zy)();const se=(0,c.Zp)(),[ne,ie]=(0,a.fp)(o.AG.nowFileList),[ae]=(0,a.fp)(o.AG.file_list_refresh),[le,oe]=(0,a.fp)(o.AG.current_mount),[re,ce]=(0,a.fp)(o.AG.showPrompt),[de,_e]=(0,a.fp)(o.AG.selectedFileList),[he,pe]=(0,a.fp)(o.AG.clickFileList),[me,fe]=(0,a.fp)(o.AG.fileShellShow),[ue,xe]=(0,n.useState)(""),[ge,ve]=(0,a.fp)(o.AG.workflow_show),[we,je]=(0,a.fp)(o.AG.workflow_realtime_show),[ye,ke]=(0,a.fp)(o.AG.work_flow_show),[be,Ae]=(0,n.useState)(!1),{initUserInfo:Ne}=(0,n.useContext)(v.F),[Ce,Ge]=(0,a.fp)(o.AG.user_base_info),{check_user_auth:Se}=(0,w.MH)(),{click_file:Ie}=(0,m.kZ)(),[Me]=(0,c.ok)(),ze=(0,m._A)(),Ee=n.useRef(null),[$e,Pe]=(0,a.fp)(o.AG.to_running_files),[Fe,Re]=(0,a.fp)(o.AG.file_page),[Ke]=(0,a.fp)(o.AG.blank_search_mode),[,Le]=(0,a.fp)(o.AG.prompt_card),[Xe,De]=(0,a.fp)(o.AG.blank_search_mode_for_temp),Ue=(0,m.oT)(),He="1"===Me.get("chat_open"),Be=Se(N.oV.ai_agent_page),Ze=(0,m.Cf)();(0,n.useEffect)(()=>{Ce?.user_data&&He&&!Be&&Ue("chat_open",null)},[He,Be,Ce]);const[Ye,Oe]=(0,a.fp)(o.AG.studio_chat_width),We=n.useRef(null),[Te,qe]=(0,n.useState)(!1),[Ve,Je]=(0,n.useState)(void 0),Qe=(0,m.dN)();(0,m.rJ)(Qe());const[et,tt]=(0,a.fp)(o.AG.ai_chat_session_by_cwd),st=function(){const e=(0,m.Cf)(),[t,s]=(0,a.fp)(o.AG.user_base_info),{t:i}=(0,g.Bd)(),{check_user_auth:l}=(0,w.MH)(),[d,p]=(0,a.fp)(o.AG.router_jump),f=(0,c.Zp)(),{initUserInfo:x}=(0,n.useContext)(v.F),[j,y]=(0,a.fp)(o.AG.nowFileList),[k,C]=(0,a.fp)(o.AG.showPrompt),[S,M]=(0,a.fp)(o.AG.fileShellShow),[z,P]=(0,a.fp)(o.AG.blank_search_mode);return s=>{s.preventDefault(),s.stopPropagation();const n=new G.ik;n.x=s.clientX,n.y=s.clientY,n.type=u.Iw.directory;const a=[{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.time_minx_max),children:i("时间逆序")}),v:N.t8.time_minx_max},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.time_max_min),children:i("时间顺序")}),v:N.t8.time_max_min}],o=[{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.size_min_max),children:i("大小顺序")}),v:N.t8.size_min_max},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.size_max_min),children:i("大小逆序")}),v:N.t8.size_max_min}],c=[{r:(0,$.jsx)("span",{style:(0,H.ok)(!t.user_data.file_list_pagination_mode||t.user_data.file_list_pagination_mode===N.yM.all),children:i("全部加载文件")}),v:N.yM.all},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.file_list_pagination_mode===N.yM.pagination),children:i("scrll_l")}),v:N.yM.pagination}],d=[{r:(0,$.jsx)("span",{style:(0,H.ok)(!t.user_data.file_time_show_type||t.user_data.file_time_show_type===N.KD.current),children:i("最近时间")}),v:N.KD.current},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.file_time_show_type===N.KD.time),children:i("准确时间")}),v:N.KD.time}],g=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,$.jsx)("span",{style:(0,H.ok)(!t.user_data.dir_show_type),children:i("系统默认")}),v:N.t8.defualt},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.name),children:i("名字")}),v:N.t8.name},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.time_minx_max||t.user_data.dir_show_type===N.t8.time_max_min),children:i("修改时间")}),v:!1,items:a},{r:(0,$.jsx)("span",{style:(0,H.ok)(t.user_data.dir_show_type===N.t8.size_min_max||t.user_data.dir_show_type===N.t8.size_max_min),children:i("文件大小")}),v:!1,items:o}]},{r:i("文件加载方式"),v:"",items:c},{r:i("时间展示"),v:"",items:d},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,$.jsx)("span",{style:(0,H.ok)(z),children:i("srchbln")}),v:"blank_search_mode"}]}];e.git_available&&j?.folders?.find(e=>".git"===e.name)&&g.push({r:i("查看Git提交"),v:"git_page"}),l(N.oV.http_proxy)&&g.push({r:i("dl_here"),v:"http_resource"}),t?.user_data?.quick_cmd&&(0,m.LL)([...t.user_data.quick_cmd],g),n.items=g,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,h.GG)("file",(0,h.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void f(`${I.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,h.GG)("file",(0,h.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void f(`${I.o.git_page}/${encodeURIComponent(e)}`)}if("http_resource"===e){const e=await b.ws.sendData(A.HK.file_info,{path:(0,h.GG)("file",(0,h.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void f("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({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",M({show:!0,path:(0,h.GG)("file",(0,h.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return P(!z),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===N.yM.all||e===N.yM.pagination)t.is_pagination_mode=!0;else if(e===N.KD.current||e===N.KD.time)t.is_file_show_type=!0;else{if(e!==N.t8.defualt&&e!==N.t8.name&&e!==N.t8.size_max_min&&e!==N.t8.size_min_max&&e!==N.t8.time_max_min&&e!==N.t8.time_minx_max)return;t.is_dir_list_type=!0}}await r.wm.post(E.s.user_save_private_attr,{type:e,...t}),await x(),C({data:void 0,overlay:!1,type:"",show:!1}),f((0,h.vX)())},C({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:n})}}(),nt=async e=>{let t=!1;for(const s of e.files??[])s.origin_size=s.size,s.size=(0,j.v7)(s.size),Ce.user_data.file_time_show_type===N.KD.time?s.show_mtime=s.mtime?(0,W.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",t||!s.name.endsWith(".workflow.yml")&&!s.name.endsWith(".act")||Ae(!0),s.name===k.SB&&(t=!0);for(const s of e.folders??[])Ce.user_data.file_time_show_type===N.KD.time?s.show_mtime=s.mtime?(0,W.Yq)(s.mtime):"":s.show_mtime=s.mtime?(0,y.s)(s.mtime):"",s.name===k.SB&&(t=!0);ke(t)},it=async e=>{oe(e??null)};(0,n.useEffect)(()=>{be&&(async()=>{const e=new k.Nd,t=(0,l.zp)().get(o.AG.current_mount);e.dir_path=(0,m.Zl)((0,h.GG)("file",(0,h.vX)()),t),b.ws.removeMsg(A.HK.workflow_realtime),b.ws.addMsg(A.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,m.Ys)(e);for(const e of t.failed_file_list)(0,m.V$)(e);Pe(new Set(t.running_file_list))}}),await b.ws.sendData(A.HK.workflow_realtime,e)})()},[ye,be,le,te]);const at=async()=>{const e=(0,h.GG)("file",(0,h.vX)());if(Ke||Xe)return;let t;if(Ce.user_data.file_list_pagination_mode===N.yM.pagination){if(Q!==e){if(Q=e,1!==Fe.page_num)return void Re({page_size:Fe.page_size,page_num:1})}else if(Fe.page_num<0)return;if(t=await r.$M.post("file_get_page",{param_path:e,page_num:Fe.page_num,page_size:Fe.page_size}),t.code!==p.m.Success)return;const s=t.data;return nt(s),it(s.mount_info),s.files?.length?(ie(e=>{const t=(0,O.cloneDeep)(1===Fe.page_num?s.files:[...e?.files??[],...s.files]),n={...e,files:t};return(0,m.yC)(n,Ce.user_data.dir_show_type),n}),void(J=t.data)):void Re({page_size:Fe.page_size,page_num:-1})}if(t=await r.$M.get(e),t.code!==p.m.Success)return;const s=t.data;(0,m.yC)(s,Ce.user_data.dir_show_type),nt(t.data),it(s.mount_info),ie(t.data),J=t.data};(0,n.useEffect)(()=>async()=>{Pe(new Set)},[]);const lt=()=>{ke(!1),(()=>{const e=Me.get("preview_file_name"),t=Me.get("preview_mode");if(!e||!t)return!1;const n=(0,h.GG)("file",(0,h.vX)());if(Ee.current===n+e)return!0;Ee.current=n+e;const i=()=>ze(null);return"md"===t?(s({url:r.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:i}),!0):"log"===t?(x({show:!0,fileName:e,encoding:Me.get("preview_log_enc")??"utf8",wrap:Me.get("preview_log_wrap")??"wrap",close:i}),!0):"image_edit"===t?(M({path:(0,L.IO)((0,h.vX)(),e),name:e,close:i}),!0):(Ie({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:i}),!0)})()||(t({open:!1}),B({open:!1}),s({}),x({show:!1}),M({}),P({}),F({}),R({}),X({}),D({}),at())};(0,n.useEffect)(()=>{lt()},[te,Fe]),(0,n.useEffect)(()=>{ae>0&&at()},[ae]);n.useRef(!1);const ot=()=>{const e=(0,h.GG)("file",(0,h.vX)());Le({open:!0,title:ee("深搜"),context_div:(0,$.jsx)(K,{base_path:e})})},rt=e=>{e.target===e.currentTarget&&(_e([]),pe([]))},ct=n.useCallback((0,O.throttle)(e=>{const t=We.current;if(!t||!t.parentElement)return;const s=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),i=n.right-e.clientX,a=Math.min(Math.max(i,320),.7*n.width);Oe(parseFloat((a/s).toFixed(2)))},32),[]),dt=()=>{qe(!1),document.removeEventListener("pointermove",ct)},_t=(0,$.jsxs)("div",{className:"file-list-main",children:[(0,$.jsx)(i.e,{baseRoute:"file",clickFun:function(){if(_e([]),pe([]),Ce.user_data.file_list_pagination_mode===N.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Re({page_size:Fe.page_size,page_num:1})}},input_path_enter:e=>{_e([]),pe([]),ie({files:[],folders:[]}),(0,C.Z1)(e)?(e=e.replace((0,Y.m)(Ce.user_data),""),se(e)):se((0,C.Jn)((0,h.vX)(),e))}}),le&&(0,$.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:le.color},children:[(0,$.jsx)("span",{className:"material-icons",style:{color:le.color},children:"cloud"}),(0,$.jsx)("span",{children:[{v:le.driver,t:ee("驱动")},{v:le.credential_note,t:ee("凭据")},{v:le.account_note,t:ee("账号")}].filter(e=>Boolean(e.v)).map(e=>`${e.v}(${e.t})`).join(" - ")}),le.readonly&&(0,$.jsx)("span",{className:"mount-readonly-tag",children:ee("只读")})]}),Ce.user_data.file_list_pagination_mode===N.yM.pagination?(0,$.jsx)(S.$J,{handleContextMenu:st,clickBlank:rt,list:ne.files}):(0,$.jsx)(S.t$,{handleContextMenu:st,file_list:ne.files,folder_list:ne.folders,clickBlank:rt})]});return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsxs)(d.aZ,{children:[(0,$.jsx)("div",{className:"mobile-deep-search-btn",children:(0,$.jsx)(z.rA,{icon:"search",title:ee("搜索"),onClick:ot})}),(0,$.jsx)(f.$Z,{handleEnterPress:async()=>{if(Ke||Xe){if(_e([]),pe([]),!ue||!ue.trim())return void ie({files:[],folders:[]});const e=(0,h.GG)("file",(0,h.vX)()),t=await r.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:ue.trim()});if(t.code!==p.m.Success)return;const s=t.data;return(0,m.yC)(s,Ce.user_data.dir_show_type),nt(s),ie(s),void(J=s)}if(!J)return;_e([]),pe([]);const e=[],t=[];for(const t of J.files??[])t.name.includes(ue)&&e.push(t);for(const e of J.folders??[])e.name.includes(ue)&&t.push(e);ie({files:e,folders:t})},placeholder:ee("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:ot,handleInputChange:e=>{xe(e)},max_width:"25em"})]}),(0,$.jsxs)(d.aZ,{position:"right",children:[Se(N.oV.ai_agent_page)&&Ze.ai_chat_available&&(0,$.jsx)(z.rA,{icon:"smart_toy",title:ee("AI 聊天"),selected:He,onClick:()=>Ue("chat_open",!He?"1":null)}),(0,$.jsx)("div",{className:"mobile-context-btn",children:(0,$.jsx)(z.rA,{icon:"more_horiz",title:ee("右键"),onClick:()=>{const e=de[de.length-1];if(void 0!==e){const t=[...ne.folders??[],...ne.files??[]][e];if(t){const s=document.querySelectorAll(".item")[e],n=s?s.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},i={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},a=new G.ik;a.path=(0,L.IO)((0,h.vX)(),t.name),a.filename=t.name,a.x=i.clientX,a.y=i.clientY,a.type=t.type===u.Iw.folder?u.Iw.folder:(0,G.uL)(t.name),a.size=t.origin_size,ce({show:!0,type:_.PromptEnum.FileMenu,overlay:!1,data:a})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};st(e)}}})}),(0,$.jsx)(Z,{})]}),(0,$.jsxs)("div",{className:"file-list-split"+(He?" file-list-split--chat":""),children:[_t,He&&(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)("div",{className:"studio__divider studio__divider--chat",ref:We,onPointerDown:e=>{e.preventDefault(),qe(!0),document.addEventListener("pointermove",ct),document.addEventListener("pointerup",dt,{once:!0})}}),(0,$.jsx)("div",{className:"studio-chat-panel",style:{width:`${Ye}em`},children:(0,$.jsx)(n.Suspense,{fallback:null,children:(0,$.jsx)(V,{inline_header:!0,sync_url:!1,file_cwd_path:Qe(),session_id:Ve??(ht=Qe(),o.AG.get_ai_chat_session(et,ht)),on_session_change:e=>{Je(e),((e,t)=>{tt({...et,[e]:t})})(Qe(),e)}})})})]})]}),Te&&(0,$.jsx)("div",{className:"shell__overlay",onPointerUp:dt}),ge&&(0,$.jsx)(T,{}),we.open&&(0,$.jsx)(q,{})]});var ht}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2502],{2502(t,e,n){n.r(e),n.d(e,{default:()=>A});var i=n(96540),o=n(92275),s=n(14944),r=n(34843),l=n(82893),c=n(57952),a=n(85997),_=n(32768),h=n(34289),p=n(62042),x=n(61443),d=n(22022),f=n(64694),g=n(70447),u=n(74848);const w=300;let v=!1,m=0,y=!0;var k,b=[],j=-1,C=[];function A(t){const[e,n]=(0,r.fp)(l.AG.log_viewer),A=(0,i.useRef)(null),[H,T]=(0,i.useState)(0),[S,z]=(0,i.useState)(100),[I,K]=(0,i.useState)(!1),[M,$]=(0,i.useState)(""),[E,L]=(0,i.useState)(0),[N,D]=(0,i.useState)(0),[q,G]=(0,i.useState)(0),{t:R}=(0,d.Bd)(),B=(t,n,i,o=!1,s)=>{const r=document.createElement("div");return-1===j?r.textContent=t:r.innerHTML=t,"wrap"===e.wrap?(r.style.whiteSpace="pre-wrap",r.style.overflowWrap="break-word"):r.style.whiteSpace="nowrap",r.setAttribute("position",`${n}`),r.setAttribute("start_position",`${i}`),o?(A.current.insertBefore(r,s),b.unshift(r)):(A.current.appendChild(r),b.push(r)),r},F=t=>{const e=(0,f.I)(b,e=>e===t);e&&A.current.removeChild(e)},W=(t,e,n,i=!1)=>{if(!t)return;const o=Array.isArray(t)?t:t.split("\n");if(i){let t;for(let i=0;i<o.length;i++)t=B(o[i],e[i],n[i],!0,0===i?A.current.firstChild:t);if(b.length>w){let t=b.length-1;for(;t>=w;)F(b[b.length-1]),t--}}else{for(let t=0;t<o.length;t++)B(o[t],e[t],n[t]);if(b.length>w){let t=b.length-w;for(;t>0;)F(b[0]),t--}}},X=async()=>{k.encoding=e.encoding,k.context="";const t=await s.ws.sendData(o.HK.log_viewer,k);if(t){const e=t.context;if(k=e,e.find_back_enter_index&&e.context_list.length>0)for(let t=0;t<e.context_list.length;t++){const n=new RegExp(e.query_text,"g");e.context_list[t]=e.context_list[t].replace(n,`<span style="color: blue;">${e.query_text}</span>`)}k.find_back_enter_index=!1,W(e.context_list,e.context_position_list,e.context_start_position_list,k.back),k.context_list.length>0&&(k.back&&b.length>0?(k.context_list.length>b.length?T(Math.floor(100*parseInt(b[k.context_list.length-b.length].getAttribute("position"))/k.max_size)):T(Math.floor(100*parseInt(b[b.length-k.context_list.length].getAttribute("position"))/k.max_size)),y=!1):T(Math.floor(100*(k.context_position_list[k.context_position_list.length-1]??0)/k.max_size)))}},Y=t=>{v||(v=!0,T(100),s.ws.addMsg(o.HK.log_viewer_watch,t=>{const e=t.context;e&&(k=e,W(e.context_list,e.context_position_list,e.context_start_position_list,!1),A.current.scrollTop=A.current.scrollHeight)}),k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.position=t,s.ws.sendData(o.HK.log_viewer_watch,k),K(!0))},Z=async()=>{A.current&&A.current.remove(),b=[]};if((0,i.useEffect)(()=>{e.show?(async()=>{A.current.addEventListener("scroll",async()=>{const t=A.current;if(t){if(v)return void(m=t.scrollTop);if(m<t.scrollTop&&b.length>0&&t.scrollTop+t.clientHeight+500>=t.scrollHeight){const t=parseInt(b[b.length-1].getAttribute("position"));if(t>=k.max_size)return void Y(t);k.line=20,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!1,k.position=t,await X()}else if(m>t.scrollTop&&b.length>0&&t.scrollTop-300<=0){const e=parseInt(b[0].getAttribute("start_position"));if(e<=0)return y||(y=!0,(0,p.N9)(R("到达顶部"))),void(m=t.scrollTop);k.line=10,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!0,k.position=e,await X()}m=t.scrollTop}}),A.current.addEventListener("wheel",t=>{const e=A.current;if(e){t.preventDefault();const n=20;t.deltaY>0?e.scrollTop+=n:e.scrollTop-=n}},{passive:!1}),K(!1),L(0),D(0),$(""),v=!1,G(0),m=0,C=[],j=-1,b=[],(k=new _.d2).line=w,k.path=`${(0,h.GG)("file",(0,h.vX)())}${e.fileName}`,k.token=localStorage.getItem("token"),await X(),s.ws.addMsg(o.HK.search_file_progress,t=>{try{L(parseInt(t.context))}catch(t){(0,p.zN)(t.message)}}),s.ws.addMsg(o.HK.search_file_index,t=>{try{C.push(...t.context),G(t.context.length)}catch(t){(0,p.zN)(t.message)}})})():Z()},[e]),(0,i.useEffect)(()=>()=>{Z()},[]),!e.show)return;return(0,u.jsxs)("div",{id:"editor-container",children:[(0,u.jsxs)(c.A,{ignore_tags:!0,left_children:[(0,u.jsx)(a.rA,{title:R("取消"),icon:"close",onClick:()=>{const t=e.close;n({show:!1}),t?.()}},1),(0,u.jsx)("div",{style:{width:"4rem"},children:(0,u.jsx)(g.WA,{context:e.fileName})},2),(0,u.jsxs)(i.Fragment,{children:[" ",(0,u.jsx)(x.$Z,{handleEnterPress:async()=>{M&&(L(.1),D(0),G(0),j=-1,C=[],k.query_text=M,k.encoding=e.encoding,s.ws.sendData(o.HK.search_file,k))},placeholder:R("回车搜索整个文件"),icon:"search",value:M,handleInputChange:t=>{$(t)},max_width:"25em"})]},3),M&&(0,u.jsx)("div",{style:{paddingLeft:"1.5rem",cursor:"pointer"},onClick:async()=>{if(0===C.length)return;k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[];const t=j+1>=C.length?0:j+1;D(t+1),j=t,k.find_back_enter_index=!0,k.back=!1,k.position=C[j],await X()},children:"↓"},5),M&&(0,u.jsx)("div",{style:{paddingLeft:"1.5rem",cursor:"pointer"},onClick:async()=>{if(0===C.length)return;k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[];const t=j-1<0?C.length-1:j-1;D(t+1),j=t,k.back=!1,k.find_back_enter_index=!0,k.position=C[j],await X()},children:"↑"},6),M&&(0,u.jsxs)("div",{style:{paddingLeft:"1.5rem"},children:[N,"/",C.length]},7),M&&(0,u.jsxs)("div",{style:{paddingLeft:"1.5rem"},children:["搜索进度$",E,"%"]},8),0!==E&&100!==E&&(0,u.jsx)(a.rA,{title:R("取消"),icon:"cancel",onClick:()=>{s.ws.sendData(o.HK.search_file_cancel,{}),$(""),L(0)}},4)],children:[(0,u.jsx)("span",{style:{paddingRight:".5rem"},children:e.encoding}),I&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{style:{color:"var(--icon-green)",whiteSpace:"pre"},children:"正在实时监听 "}),(0,u.jsx)(a.rA,{icon:"close",title:R("关闭实时"),onClick:()=>{v&&(v=!1,K(!1),s.ws.sendData(o.HK.log_viewer_watch_cancel,k))}})]}),(0,u.jsxs)("span",{children:["当前加载进度",H]}),(0,u.jsx)(x.$Z,{max_width:"10rem",placeholder:R("跳转进度"),icon:"percent",value:S,handleInputChange:t=>{z(t)}}),(0,u.jsx)(a.rA,{icon:"play_arrow",title:R("跳转进度"),onClick:async()=>{k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];let t=0;try{if(t=parseInt(S),t>100||t<0)throw(0,p.zN)(R("范围在0-100")),"超过最大范围";for(const t of b)A.current.removeChild(t);b=[]}catch(t){return void(0,p.N9)(t)}k.back=t>=100,k.position=Math.floor(k.max_size*(t/100)),await X()}}),(0,u.jsx)(a.rA,{icon:"text_rotate_vertical",title:R("滑动到文件最底部,实时输出"),onClick:async()=>{if(!v){k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[],k.back=!0,k.position=k.max_size,await X(),A.current.scrollTop=A.current.scrollHeight,Y(k.max_size)}}})]}),(0,u.jsx)("div",{style:{height:"100%"},children:(0,u.jsx)("div",{ref:A,style:{overflowY:"auto",overflowX:"auto",height:"100%"}})})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2547],{77481(e,t,n){n.d(t,{S:()=>r,X:()=>i});var s=n(96540),o=n(61443),a=n(74848);function i(e){const[t,n]=s.useState([]),i=(0,s.useRef)(-1),[r,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const m=()=>{i.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let i=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(i=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(r===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=n,l(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,n=c;m(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:m,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function r(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},52547(e,t,n){n.r(t),n.d(t,{default:()=>N});var s=n(22022),o=n(96540),a=n(85997),i=n(4412),r=n(34843),l=n(82893),c=n(75725),d=n(77481),m=n(61443),p=n(70447),h=n(64484),u=n(14284),_=n(53459),x=n(62042),j=n(7523),v=n(78247),g=n(23430),f=n(61973),y=n(14944),w=n(92275),C=n(88815),b=n(64694),k=n(45907),A=n(12721),S=n(24659),I=n(83277),K=n(74848);function N(){const{t:e}=(0,s.Bd)(),{initUserInfo:t}=(0,o.useContext)(j.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),e("默认model"),e("更多属性"),e("备注")],N=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[O,M]=(0,o.useState)([]),[P,$]=(0,o.useState)({}),[L,X]=(0,o.useState)([]),[T,D]=(0,o.useState)([]),[R,F]=(0,o.useState)(null),V=(0,o.useRef)(),Y=(0,o.useRef)(!1),q=(0,o.useRef)(!1),[E,W]=(0,o.useState)([]),[H,B]=(0,o.useState)(!1),[G,Z]=(0,o.useState)({}),[U,z]=(0,r.fp)(l.AG.prompt_card),[J,Q]=(0,r.fp)(l.AG.user_base_info),[ee,te]=(0,o.useState)(!1),ne=T.filter(e=>"http"!==(e.transport??"stdio")),se=T.filter(e=>"http"===e.transport),oe=[e("编号"),e("名称"),e("是否开启"),e("状态"),"command","args","cwd",e("tools|env"),e("备注")],ae=[e("编号"),e("名称"),e("是否开启"),e("状态"),e("endpoint"),e("tools|headers"),e("备注")],ie=[e("编号"),e("提示词"),e("LLM编辑开关"),e("llm_pmt"),e("编辑规则"),e("备注")],[re,le]=(0,o.useState)([]),[ce,de]=(0,o.useState)(!1),me=(0,h.T)(),{check_user_auth:pe}=(0,v.MH)(),[he,ue]=(0,r.fp)(l.AG.editorSetting),_e=(0,f.Zp)(),xe=(0,k.y)(),je=(0,S.K)(),ve=async()=>{const e=await u.jV.get("docs_on_get");e.code===_.m.Success&&te(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await u.XO.get("ai_agent_setting");e.code===_.m.Success&&M(e.data.models);const t=await u.XO.get("ai_agent_global_setting");t.code===_.m.Success&&$(t.data??{}),await y.ws.addMsg(w.HK.ai_load_info,e=>{F(e.context)});const n=await y.ws.sendData(w.HK.ai_load_info,{});n?.context&&F(n.context);const s=await u.XO.get("ai_docs_setting");s.code===_.m.Success&&(V.current=s.data.param,s.data.list?.length&&X(s.data.list));const o=await u.XO.get("ai_mcp_setting");o.code===_.m.Success&&D(o.data.list??[]),await ke(),ve();const a=await u.XO.get("ai_system_prompts");a.code===_.m.Success&&le(a.data??[]);const i=await u.XO.get("ai_long_term_memory_setting");i.code===_.m.Success&&de(i.data?.open??!1)})()},[]),(0,o.useEffect)(()=>{y.ws.addMsg(w.HK.mcp_status,e=>{const t=e.context??{},n={};for(const e of t.status??[])n[e.index]={state:e.state,error:e.error,tool_count:e.tool_count};Z(n),t.done&&ke()})},[]);const ge=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};D([...T,t]),Y.current=!0},fe=e=>{const t=T.indexOf(e);t<0||(T.splice(t,1),D([...T]),Y.current=!0)},ye=e=>{D([...T,{...e,open:!1}]),Y.current=!0},we=async t=>{for(let e=0;e<O.length;e++)O[e].index=e;(await u.XO.post("ai_agent_setting/save",{models:t??O})).code===_.m.Success&&(0,x.SK)(e("保存成功"))},Ce=async t=>{(await u.XO.post("ai_agent_global_setting/save",t??P)).code===_.m.Success&&(0,x.SK)(e("保存成功"))},be=async t=>{for(let e=0;e<T.length;e++)T[e].index=e;(await u.XO.post("ai_mcp_setting/save",{list:t??T})).code===_.m.Success&&((0,x.SK)(e("保存成功")),Y.current=!1,y.ws.sendData(w.HK.mcp_reload,{}))},ke=async()=>{const e=await u.XO.get("ai_mcp_tools");return e.code===_.m.Success?(W(e.data??[]),e.data??[]):[]},Ae=async t=>{B(!0);try{const n=await u.XO.post("ai_mcp_tools/reload",{index:t});if(n.code===_.m.Success)return await ke(),(0,x.SK)(e("MCP工具加载成功")),n.data??null}finally{B(!1)}return null},Se=async(t,n,s,o)=>{const a=o??E.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},i=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));z({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,K.jsx)(A.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:i,initialPageId:s,onRefresh:async()=>{const e=await Ae(n);e&&await Se(t,n,s,e)},renderPage:t=>{if(!t)return(0,K.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,K.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,K.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,K.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,K.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,K.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("strong",{children:"schema:"}),(0,K.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,K.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>z({open:!1})})},Ie=t=>{const n=G[t];let s=n?.state,o=n?.error,a=n?.tool_count;if(!s){const e=E.find(e=>e.index===t);s=e?.state,o=e?.error,a=e?.tool_count}switch(s){case"loading":return(0,K.jsx)(p.fq,{loading:!0,text:e("加载中")});case"success":return(0,K.jsx)(p.fq,{success:!0,text:`${a??0} ${e("个工具")}`});case"failed":return(0,K.jsx)("span",{title:o??e("加载失败"),children:(0,K.jsx)(p.fq,{success:!1,text:e("加载失败")})});default:return(0,K.jsx)(p.fq,{text:e("未加载")})}},Ke=async t=>{for(let e=0;e<O.length;e++)O[e].index=e;let n={list:L,docs_update_tag:q.current};null!=t&&(n={param:t}),q.current=!1;(await u.XO.post("ai_docs_setting_save",n)).code===_.m.Success&&(0,x.SK)(e("保存成功"))},Ne=async()=>{for(let e=0;e<re.length;e++)re[e].index=e;(await u.XO.post("ai_system_prompts/save",{list:re})).code===_.m.Success&&(0,x.SK)(e("保存成功"))};return(0,K.jsxs)("div",{children:[(0,K.jsx)(i.aZ,{position:"right",children:pe(g.oV.ai_agent_setting)&&(0,K.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{_e(-1)}})}),(0,K.jsx)(c.jW,{isFull:!0,more:!0,children:(0,K.jsx)(c.NN,{children:(0,K.jsxs)(c.xh,{children:[(0,K.jsx)(c.fI,{children:(0,K.jsx)(c.VP,{widthPer:100,maxWidth:"130rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("供应商设置")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. Request parameters (temperature, thinking, etc.) are now set in the YAML "Additional Parameters" editor, under the request_param section.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"short_text",title:e("全局prompt"),onClick:()=>{ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{P.sys_prompt=e,$({...P}),v.xK.set_value_temp(""),await Ce({...P,sys_prompt:e})}}),v.xK.set_value_temp(P.sys_prompt??"")}}),(0,K.jsx)(a.rA,{icon:"settings",title:e("全局")+" "+e("额外参数设置"),onClick:()=>{ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{P.yaml_env=e,$({...P}),v.xK.set_value_temp(""),await Ce({...P,yaml_env:e})}}),v.xK.set_value_temp(P.yaml_env??"")}}),(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...O,{note:"",open:!1,path:"",yaml_env:I.CP}])}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await we()}})]}),children:(0,K.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{M((0,b.TI)(O,e,t))},rows:O.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:I.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<O.length;e++)O[e].open=e===n&&t,s.push(O[e]);M(s)})(0,e,n)},options:je,no_border:!0}),(0,K.jsx)(m.Sm,{type:I.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:I.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,K.jsx)(m.Sm,{value:I.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{v.xK.set_value_temp(O[n].sys_prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{O[n].sys_prompt=e,M(O),v.xK.set_value_temp(""),we(O)}})}}),(0,K.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{v.xK.set_value_temp(O[n].yaml_env),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{O[n].yaml_env=e,M(O),v.xK.set_value_temp(""),we(O)}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),M([...O])})(n)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{M([...O,{...O[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,K.jsx)(c.fI,{children:(0,K.jsx)(c.VP,{widthPer:70,maxWidth:"100rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>ge("stdio")}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{be()}})]}),children:(0,K.jsx)(d.X,{headers:oe,onRowDrag:(e,t)=>{D((0,b.TI)(T,T.indexOf(ne[e]),T.indexOf(ne[t]))),Y.current=!0},rows:ne.map((t,n)=>{const s=T.indexOf(t);return[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,Y.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...T]),Y.current=!0},options:je,no_border:!0}),Ie(T.indexOf(t)),(0,K.jsx)(m.Sm,{value:t.command,handleInputChange:e=>{t.command=e,Y.current=!0},no_border:!0}),(0,K.jsx)(m.Sm,{value:t.args,handleInputChange:e=>{t.args=e,Y.current=!0},no_border:!0}),(0,K.jsx)(m.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,Y.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,K.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{v.xK.set_value_temp(t.env??""),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.env=e,D([...T]),v.xK.set_value_temp(""),Y.current=!0,be()}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,Y.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})})})}),(0,K.jsx)(c.fI,{children:(0,K.jsxs)(c.VP,{widthPer:70,maxWidth:"100rem",children:[(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>ge("http")}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{be()}})]}),children:(0,K.jsx)(d.X,{headers:ae,onRowDrag:(e,t)=>{D((0,b.TI)(T,T.indexOf(se[e]),T.indexOf(se[t]))),Y.current=!0},rows:se.map((t,n)=>{const s=T.indexOf(t);return[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,Y.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...T]),Y.current=!0},options:je,no_border:!0}),Ie(T.indexOf(t)),(0,K.jsx)(m.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,Y.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,K.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{v.xK.set_value_temp(t.headers??""),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.headers=e,D([...T]),v.xK.set_value_temp(""),Y.current=!0,be()}})}})]}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,Y.current=!0},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,K.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})}),(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("系统会话提示词")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{le([...re,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ne()}})]}),children:(0,K.jsx)(d.X,{headers:ie,onRowDrag:(e,t)=>{le((0,b.TI)(re,e,t))},rows:re.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{v.xK.set_value_temp(t.prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,le([...re])},title:e("LLM编辑开关")}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"edit_note",title:e("llm_pmt"),onClick:()=>{v.xK.set_value_temp(t.llm_prompt??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{v.xK.set_value_temp(t.llm_prompt_tip??""),ue({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,le([...re]),v.xK.set_value_temp(""),Ne()}})}})}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsx)("div",{children:(0,K.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{re.splice(e,1),le([...re])})(n)})})];return s}),width:"10rem"})}),(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("长期记忆")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),rightTopCom:(0,K.jsx)("div",{children:(0,K.jsx)(a.Ay,{checked:ce,onChange:async t=>{de(t),await u.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,x.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,K.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,K.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const e=await u.XO.get(`ai_long_term_memory_bucket/${t}`),n=e.code===_.m.Success?e.data??"":"";v.xK.set_value_temp(n),ue({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async e=>{await u.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:e}),v.xK.set_value_temp("")}})}},t))})})]})}),(0,K.jsxs)(c.fI,{children:[(0,K.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,K.jsx)(p.uF,{self_title:(0,K.jsxs)("span",{className:" div-row ",children:[(0,K.jsx)("h2",{children:e("本地知识库")})," ",(0,K.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),rightTopCom:(0,K.jsxs)("div",{children:[(0,K.jsx)(a.Ay,{checked:ee,onChange:async e=>{await u.jV.post("docs_on_set",{status:e}),ve(),t()},title:e("知识库开关")}),(0,K.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{v.xK.set_value_temp(V.current),ue({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{V.current=e,v.xK.set_value_temp(""),Ke(V.current)}})}}),(0,K.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...L,{note:"",auto_load:!1,dir:""}]),q.current=!0}}),(0,K.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ke()}})]}),children:(0,K.jsx)(d.X,{headers:N,onRowDrag:(e,t)=>{X((0,b.TI)(L,e,t)),q.current=!0},rows:L.map((t,n)=>{const s=[(0,K.jsx)("div",{children:n}),(0,K.jsx)(m.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,q.current=!0},no_border:!0}),(0,K.jsx)(m.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,X([...L]),q.current=!0},options:je,no_border:!0}),(0,K.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,K.jsxs)("div",{children:[(0,K.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{L.splice(e,1),X([...L]),q.current=!0})(n)}),(0,K.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{xe({sub_title:"手动加载",confirm_fun:()=>{u.jV.post("docs_load_file",{param_path:t.dir}),(0,x.SK)("ok")}})}}),(0,K.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{xe({sub_title:"从索引删除",confirm_fun:()=>{u.jV.post("docs_del",{param_path:t.dir}),(0,x.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),R&&(0,K.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,K.jsxs)(p.Zp,{title:e("知识库加载信息"),children:[(0,K.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:R?.progress}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:R?.num}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:R?.char_num}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,C.v7)(R?.size)}),(0,K.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,C.a3)(R?.consume_time_ms_len)}),(0,K.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:R?.total_num})]})})]})]})})})]})}},24659(e,t,n){var s=n(22022);n.d(t,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[259],{8694(e,t,a){a.d(t,{$K:()=>s,RB:()=>i,l5:()=>l,vo:()=>o,vr:()=>r});let n=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class s{open=!1;port;key="";async_ips=[]}class o{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=n.udp}let i=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class r{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class l{enabled;ip;port;bypass;useForLocal;type}},75007(e,t,a){a.d(t,{h:()=>o});a(96540);var n=a(85997),s=a(74848);function o(e){return(0,s.jsxs)("h2",{className:"message",children:[(0,s.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,s.jsx)("span",{children:e.context})]})}},47374(e,t,a){a.d(t,{e:()=>u});var n=a(96540),s=a(61973),o=a(64694),i=a(34289),r=a(61443),l=a(75725),c=a(22022),d=a(85997),p=a(74848);function u(e){let t=(0,s.zy)();const a=(0,s.Zp)(),[u,h]=(0,n.useState)([]),[m,f]=(0,n.useState)("/"),[y,_]=(0,n.useState)(void 0),{t:x,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",a=(0,i.vX)().split("/");a=a.filter(e=>e);const n=a.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(a.slice(0,n),e.baseRoute);const i=a.slice(n+1);for(let e=0;e<i.length;e++){const a=i[e];s.push({value:a,href:0===e?`${t}${a}/`:(0,o.IO)(s[e-1].href,a)})}f(t),h(s)}},[t]);const w=t=>{t.stopPropagation(),e.clickFun(t)},[g,j]=(0,n.useState)(0),k=(0,n.useRef)(null),b=(0,n.useRef)(null),N=()=>{const e=k.current,t=b.current;if(!e||!t)return;const a=[];for(const e of Array.from(t.children))a.push(e.getBoundingClientRect().width);const n=e.clientWidth;if(a.reduce((e,t)=>e+t,0)<=n||a.length<=2)return void j(e=>0===e?e:0);let s=a[0]+48,o=0;for(let e=a.length-1;e>=1&&!(s+a[e]>n);e--)s+=a[e],o++;const i=Math.max(a.length-1-o,0);j(e=>e===i?e:i)};(0,n.useEffect)(()=>{N();const e=new ResizeObserver(N);return k.current&&e.observe(k.current),()=>e.disconnect()},[u,m,t]),(0,n.useEffect)(()=>{const e=k.current;e&&0!==g&&e.scrollWidth>e.clientWidth&&g<u.length-1&&j(e=>e+1)});const K=g>0?1+g:1,S=g>0?u.slice(1,K):[],[C,A]=(0,n.useState)(null);return(0,n.useEffect)(()=>{A(null)},[t,g]),(0,p.jsxs)("div",{className:"breadcrumbs",ref:k,onClick:e=>{_(void 0!==y?void 0:"")},children:[(0,p.jsx)(n.Fragment,{children:void 0===y?(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:m,onClick:w,children:(0,p.jsx)(d.In,{icon:"home"})})}),u.map((e,t)=>g>0&&t>=1&&t<K?1!==t?null:(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)("span",{className:"breadcrumbs-fold-dot",onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();A({x:t.left,y:t.bottom})},children:"..."})]},"fold"):(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,onClick:w,children:decodeURIComponent(e.value)})]},t)),(0,p.jsxs)("div",{className:"breadcrumbs-measure",ref:b,"aria-hidden":!0,children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:m,children:(0,p.jsx)(d.In,{icon:"home"})})}),u.map((e,t)=>(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,children:decodeURIComponent(e.value)})]},t))]})]}):(0,p.jsx)(l.QM,{click:()=>{_(void 0)},children:(0,p.jsx)(r.Sm,{width:"100%",placeholder:x("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),_(void 0)}})})}),C&&(0,p.jsx)(l.rY,{click:()=>A(null),children:(0,p.jsx)(l.sw,{x:C.x,y:C.y,items:S.map(e=>({r:decodeURIComponent(e.value),v:e.href})),click:e=>{A(null),a(e)}})})]})}},77481(e,t,a){a.d(t,{S:()=>r,X:()=>i});var n=a(96540),s=a(61443),o=a(74848);function i(e){const[t,a]=n.useState([]),i=(0,n.useRef)(-1),[r,l]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?a(Array.isArray(e.children)?e.children:[e.children]):a(e.rows)},[e.rows,e.children]);const p=()=>{i.current=-1,l(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,a)=>{const n=!!e.filter&&(e.filter.column??0)===a;let i=t;if(n){const a=e.filter,n=a.options.find(e=>e.value===a.value);null!=a.value&&n&&(i=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},a)})})}),(0,o.jsx)("tbody",{children:t.map((t,a)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(r===a?"row-dragging":"")+(c===a?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=a,l(a),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(a))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,a=c;p(),t<0||a<0||t===a||e.onRowDrag?.(t,a)})())},onDragEnd:p,children:t.map((a,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:a},n)})},a)})})]})}function r(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},83029(e,t,a){a.d(t,{N:()=>x});var n=a(96540),s=a(34843),o=a(82893),i=a(74848);function r(e){const[t,a]=(0,s.fp)(o.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 l=a(64694),c=a(61443),d=a(85997),p=a(61973),u=a(22022);const h=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,f,y=[];const _=[];function x(e){const[t,a]=(0,n.useState)([]),[x,v]=(0,n.useState)(-1),w=(0,p.zy)(),[g,j]=(0,n.useState)(!1),[k,b]=(0,n.useState)(!1),{t:N}=(0,u.Bd)(),[K,S]=(0,n.useState)([]),[C,A]=(0,s.fp)(o.AG.nav_index_add_item_by_now_list),F=e=>{-1!==x?_[x]._children=e:y=e};(0,n.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();y=t,a(y)})()},[w]);(0,n.useEffect)(()=>{if(C){const e=[...t,{name:"",color:(0,l.Lr)(h),...C}];F(e),a(e),j(!0),A(void 0)}},[C]);const D=e=>{v(x+1),a(e._children),_.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==x&&(0,i.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{a(0===x?y:_[x-1]._children),v(x-1),_.pop()}}),t.map((s,o)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,o),onDrop:e=>((e,n)=>{e.preventDefault();const s=t[m],o=t[n];if(o&&"dir"===o._type){const e=[...t];return e.splice(m,1),o._children||(o._children=[]),o._children.push(s),F(e),void a(e)}const i=[...t],r=i[m];i.splice(m,1),i.splice(n,0,r),F(i),a(i)})(e,o),style:{cursor:g?"move":"pointer"},children:[(0,i.jsx)(r,{name:s.name,item:s,...s,div:g,target:"_blank",click_dir:D,clickItem:e.clickItem}),g&&(void 0!==K.find(e=>e===o)||k)&&(0,i.jsxs)("div",{className:k?"":" site_edit ",children:["dir"===s._type?(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(c.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:N("输入类目名"),no_border:!0}),(0,i.jsx)(c.Sm,{value:s.color,type:"color",handleInputChange:e=>{s.color=e},no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(c.Sm,{value:s[e.key],type:"color"===e.key?"color":void 0,handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!k&&(0,i.jsx)(d.C3,{text:N("折叠"),clickFun:()=>{S((0,l.P1)(K,o))}})]}),g&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(d.C3,{text:N("删除"),clickFun:()=>{(e=>{const n=[...t];n.splice(e,1),F(n),a(n)})(o)}}),(0,i.jsx)(d.C3,{text:N("编辑"),clickFun:()=>{void 0===K.find(e=>e===o)&&S([...K,o])}})]})})]},o)),g&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(d.rA,{title:N("取消"),icon:"cancel",onClick:()=>{S([]),j(!1),f&&(a(f),F(f)),b(!1)}}),(0,i.jsx)(d.rA,{title:N("添加"),icon:"add",onClick:async()=>{const n=[...t,{name:"",color:(0,l.Lr)(h),...e.get_pre_add_item&&await e.get_pre_add_item()}];F(n),a(n)}}),(0,i.jsx)(d.rA,{title:N("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];F(e),a(e)}}),(0,i.jsx)(d.rA,{title:N("全部编辑"),icon:k?"unfold_less":"unfold_more",onClick:()=>{b(!k)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(d.rA,{icon:g?"save":"edit",title:N(g?"保存":"编辑"),onClick:async()=>{g?e.save&&await e.save(y):f=t,j(!g)}})]})}},259(e,t,a){a.r(t),a.d(t,{default:()=>_e});var n=a(96540),s=a(70447),o=a(75725),i=a(61443),r=a(22022),l=a(34843),c=a(82893),d=a(85997),p=a(77481),u=a(14284),h=a(62042),m=a(40505),f=a(45907),y=a(23496),_=a(53459),x=a(78247),v=a(23430),w=a(74848);function g(){const{t:e}=(0,r.Bd)(),t=(0,f.y)(),{check_user_auth:a}=(0,x.MH)(),g=a(v.oV.browser_proxy_edit),[,j]=(0,l.fp)(c.AG.prompt_card),[k,b]=(0,n.useState)([]),[N,K]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[A,F]=(0,n.useState)(""),[D,L]=(0,n.useState)(""),[I,M]=(0,n.useState)(""),B=[e("状态"),e("备注"),e("目标"),e("端口"),e("访问地址"),e("操作")],P=async()=>{try{const e=await u.s2.get(y.s.browser_proxy_port_list);e.code===_.m.Success&&b(Array.isArray(e.data)?e.data:[])}catch(e){}};(0,n.useEffect)(()=>{P()},[]);const R=e=>{F(e?.id??""),L(e?`${e.proto}://${e.host}${e.root_path&&"/"!==e.root_path?e.root_path:""}`:""),M(e?.note??"")},E=()=>{K(!1),C(!1),R(void 0)},$=e=>`http://${window.location.hostname||"127.0.0.1"}:${e.port}/`,O=e=>{const t=localStorage.getItem("token")||"";return`${$(e)}${t?`?_t=${encodeURIComponent(t)}`:""}`};return(0,w.jsxs)(o.fI,{children:[(0,w.jsx)(o.VP,{widthPer:g?55:100,maxWidth:g?"90rem":void 0,children:(0,w.jsx)(o.xh,{children:(0,w.jsx)(s.uF,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:e("网页代理目标")}),(0,w.jsx)(d.rA,{icon:"info",title:e("信息"),onClick:()=>{j({open:!0,title:e("信息"),context_div:(0,w.jsx)("div",{children:(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:e("wbvpn_port_tip")}),(0,w.jsx)("li",{children:e("wbvpn_port_tip2")}),(0,w.jsx)("li",{children:e("wbvpn_port_tip3")})]})})})}})]}),rightTopCom:(0,w.jsx)("div",{children:g&&!S&&(0,w.jsx)(d.rA,{icon:"add",title:e("添加"),onClick:()=>{K(!0),C(!0),R(void 0)}})}),children:(0,w.jsx)(p.X,{headers:B,rows:k.map(a=>{const n=[(0,w.jsx)(d.Ay,{checked:!1!==a.enabled,disabled:!g,title:e("启用"),onChange:t=>(async(t,a)=>{try{await u.s2.post(y.s.browser_proxy_port_set_enabled,{id:t.id,enabled:a}),(0,h.SK)(e(a?"已启用":"已禁用")),await P()}catch(e){}})(a,t)}),(0,w.jsx)(s.xP,{children:a.note||"-"}),(0,w.jsx)(s.xP,{children:`${a.proto}://${a.host}`}),(0,w.jsx)(s.xP,{children:String(a.port)}),(0,w.jsx)(s.xP,{children:$(a)}),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"open_in_new",title:e("新窗口打开"),onClick:()=>(e=>{window.open(O(e),"_blank","noopener,noreferrer")})(a)}),(0,w.jsx)(d.rA,{icon:"tab",title:e("当前窗口打开"),onClick:()=>(e=>{window.location.href=O(e)})(a)}),(0,w.jsx)(d.rA,{icon:"content_copy",title:e("复制"),onClick:()=>(async t=>{const a=$(t);(0,m.lW)(a)?(0,h.SK)(e("已复制")):(0,h.zN)(e("复制失败"))})(a)}),g&&(0,w.jsx)(d.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{K(!1),C(!0),R(e)})(a)}),g&&(0,w.jsx)(d.rA,{icon:"delete",title:e("删除"),onClick:()=>(a=>{t({title:e("确认删除"),sub_title:a.host,confirm_fun:async()=>{try{await u.s2.post(y.s.browser_proxy_port_remove,{id:a.id}),(0,h.SK)(e("已删除")),await P()}catch(e){}}})})(a)})]})];return n}),width:"10rem"})})})}),g&&S&&(0,w.jsx)(o.VP,{widthPer:45,maxWidth:"40rem",children:(0,w.jsx)(o.xh,{children:(0,w.jsxs)(s.Zp,{self_title:(0,w.jsx)("span",{className:" div-row ",children:(0,w.jsx)("h2",{children:e(""+(N?"添加":"编辑"))})}),rightBottomCom:(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"cancel",title:e("取消"),onClick:E}),(0,w.jsx)(d.rA,{icon:N?"add_circle":"save",title:e(N?"添加":"保存"),onClick:async()=>{if(D.trim())try{N?(await u.s2.post(y.s.browser_proxy_port_add,{address:D.trim(),note:I}),(0,h.SK)(e("添加成功"))):(await u.s2.post(y.s.browser_proxy_port_update,{id:A,address:D.trim(),note:I}),(0,h.SK)(e("修改成功"))),E(),await P()}catch(e){}else(0,h.zN)(e("目标地址不能为空"))}})]}),children:[(0,w.jsx)("label",{children:e("目标地址")}),(0,w.jsx)(i.Sm,{value:D,placeholder:e("目标地址例如"),handleInputChange:e=>L(e)}),(0,w.jsx)("label",{children:e("备注")}),(0,w.jsx)(i.Sm,{value:I,handleInputChange:e=>M(e)})]})})})]})}function j(e){return(0,w.jsx)(g,{})}var k=a(34289),b=a(4412),N=(a(75007),a(83029)),K=a(97856),S=a(92275),C=a(14944),A=a(64405);const F=n.lazy(()=>Promise.all([a.e(2543),a.e(5614)]).then(a.bind(a,85614)));function D(e){const[t,a]=(0,n.useState)(null),[s,o]=(0,l.fp)(c.AG.remoteShellShow),[i,r]=(0,n.useState)(!1),[d,p]=(0,l.fp)(c.AG.sshInfo),[u,h]=(0,l.fp)(c.AG.shellNowDir),[m,f]=(0,l.fp)(c.AG.user_base_info),y=m.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",_=()=>{(async()=>{t&&(t.dispose(),a(null))})()};(0,n.useEffect)(()=>()=>{_()},[]),(0,n.useEffect)(()=>{s.show?t||((async()=>{const e=new K.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:y,cursor:y,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let t;const n=t=>{e.write(t)};t=a=>{e.clear(),e.write(a),t=n},C.ws.addMsg(S.HK.remote_shell_getting,e=>{t(e.context)}),e.onData(async e=>{const t=new A.x;t.key=d.key,t.cmd=e;const a=new S.hf(S.HK.remote_shell_send);a.context=t,await C.ws.send(a)}),a(e)})(),r(!0)):_()},[s]);return(0,w.jsx)(F,{show:s.show,terminal:t,init:(e,a)=>{t.writeln("[38;2;29;153;243mopen shell...[0m ");const n=new S.hf(S.HK.remote_shell_open),o=new A.x;o.key=d.key,o.init_path=s.path,o.rows=e,o.cols=a,n.context=o,C.ws.send(n)}})}var L=a(47374),I=a(61973),M=a(99214),B=a(32768),P=a(88815),R=a(6960),E=a(79240),$=a(78150),O=a(12730);function G(e){const{t}=(0,r.Bd)();(0,I.zy)();(0,I.Zp)();const{check_user_auth:a}=(0,x.MH)(),[s,o]=(0,l.fp)(c.AG.nowFileList),[i,p]=(0,l.fp)(c.AG.uploadFiles),[u,m]=(0,l.fp)(c.AG.showPrompt),[f,y]=(0,l.fp)(c.AG.selectedFileList),[_,v]=(0,l.fp)(c.AG.enterKey),[g,j]=(0,l.fp)(c.AG.copyedFileList),[b,N]=(0,l.fp)(c.AG.cutedFileList),[K,S]=(0,l.fp)(c.AG.selectedFileList),[C,A]=(0,l.fp)(c.AG.clickFileList),[F,D]=(0,l.fp)(c.AG.remoteShellShow),[L,P]=(0,l.fp)(c.AG.sshInfo),R=(0,M.Vs)();function E(e){(0,h.SK)(e)}return(0,w.jsxs)(n.Fragment,{children:[f.length>0&&(0,w.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{m({show:!0,type:$.PromptEnum.SshDelete,overlay:!0,data:{}})}}),f.length>0&&(0,w.jsx)(d.rA,{icon:"content_copy",title:t("复制"),onClick:function(){const e=(0,M.ib)(s,f);j(e.map(e=>`/${(0,k.GG)("remoteShell",(0,k.vX)())}${e.name}`)),N([]),E("已复制")}}),f.length>0&&(0,w.jsx)(d.rA,{icon:"content_cut",title:t("剪切"),onClick:function(){const e=(0,M.ib)(s,f);N(e.map(e=>`/${(0,k.GG)("remoteShell",(0,k.vX)())}${e.name}`)),j([]),E("已剪切")}}),(g.length>0||b.length>0)&&(0,w.jsx)(d.rA,{onClick:function(){m({show:!0,type:$.PromptEnum.SshPaste,overlay:!0,data:{}})},icon:"content_paste",title:t("粘贴到此处"),tip:g.length+b.length}),1===f.length&&s.files.length>=1&&(0,M.ib)(s,f)[0].type!==B.Iw.folder&&(0,w.jsx)(d.rA,{icon:"download",title:t("下载"),onClick:function(){const e=(0,M.ib)(s,f),t=`/api/ssh/download?file=${`/${(0,k.GG)("remoteShell",(0,k.vX)())}${decodeURIComponent(e[0].name)}`}&key=${L.key}&token=${localStorage.getItem("token")}`;window.open(t)}}),1===f.length&&(0,w.jsx)(d.rA,{icon:"edit_attributes",title:t("重命名"),onClick:function(){m({show:!0,type:$.PromptEnum.SshReName,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"terminal",title:"shell",onClick:function(){F.show?D({show:!1,path:""}):D({show:!0,path:`/${(0,k.GG)("remoteShell",(0,k.vX)())}`})}}),(0,w.jsx)(d.rA,{icon:"grid_view",title:t("切换样式"),onClick:R}),(0,w.jsx)(d.rA,{icon:"create_new_folder",title:t("创建文件夹"),onClick:function(){m({show:!0,type:$.PromptEnum.SshNewDir,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"note_add",title:t("创建文本文件"),onClick:function(){m({show:!0,type:$.PromptEnum.SshNewFile,overlay:!0,data:{}})}}),(0,w.jsx)(d.rA,{icon:"upload_file",title:"上传",onClick:()=>{m({show:!0,type:$.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let a=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],i=a?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=i,a&&s.add((0,O.S)(i)),n.push(o)}const o=[];if(a)for(const e of Array.from(s))o.push({isDir:!0,fullPath:e,name:e});o.push(...n),p(o),m({show:!0,type:$.PromptEnum.SshUpload,overlay:!1,data:{}})}}})}}),(0,w.jsx)(d.rA,{icon:"close",title:t("关闭"),onClick:()=>{e.close()}})]})}var H=a(60096),T=a(21499);let z;function U(e){const{t}=(0,r.Bd)(),a=(0,I.zy)(),[s,o]=(0,l.fp)(c.AG.nowFileList),[d,p]=(0,l.fp)(c.AG.selectedFileList),[m,f]=(0,l.fp)(c.AG.clickFileList),[y,x]=(0,l.fp)(c.AG.sshInfo),[g,j]=(0,n.useState)(""),N=(0,I.Zp)(),[K,S]=(0,l.fp)(c.AG.user_base_info),C=async e=>{const a=new A.x;a.key=y.key,a.dir=e||`/${(0,k.GG)("remoteShell",(0,k.vX)())}`;const n=await u.Fg.post("get/dir",a);if(n.code!==_.m.Success)return void(0,h.zN)(t("连接失败"));const{folders:s,files:i}=n.data||{};for(const e of i??[])e.origin_size=e.size,e.size=(0,P.v7)(e.size),K.user_data.file_time_show_type===v.KD.time?e.show_mtime=e.mtime?(0,T.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,R.s)(e.mtime):"";for(const e of s??[])K.user_data.file_time_show_type===v.KD.time?e.show_mtime=e.mtime?(0,T.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,R.s)(e.mtime):"";const r={folders:s||[],files:i||[]};(0,M.yC)(r,K.user_data.dir_show_type),o(r),z=r};function F(){p([]),f([])}(0,n.useEffect)(()=>{F(),(async()=>{await C()})()},[a]);return(0,w.jsxs)(n.Fragment,{children:[(0,w.jsx)(b.aZ,{children:(0,w.jsx)(i.$Z,{handleEnterPress:()=>{if(!z)return;p([]),f([]);const e=[],t=[];for(const t of z.files??[])t.name.includes(g)&&e.push(t);for(const e of z.folders??[])e.name.includes(g)&&t.push(e);o({files:e,folders:t})},placeholder:t("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{j(e)},max_width:"25em"})}),(0,w.jsx)(b.aZ,{position:"right",children:(0,w.jsx)(G,{close:e.close})}),(0,w.jsx)(L.e,{baseRoute:"remoteShell",clickFun:F,input_path_enter:e=>{(0,E.Z1)(e)?C(e):N((0,E.Jn)((0,k.vX)(),e)),p([]),f([]),o({files:[],folders:[]})}}),(0,w.jsx)(H.Ic,{handleContextMenu:()=>{},clickBlank:e=>{e.target===e.currentTarget&&p([])},file_list:s.files,folder_list:s.folders,fileHandler:C}),(0,w.jsx)(D,{})]})}function V(e){const{t}=(0,r.Bd)(),a=(0,I.Zp)(),[s,o]=(0,n.useState)(""),[p,m]=(0,n.useState)(""),[f,y]=(0,n.useState)(""),[g,j]=(0,n.useState)(""),[k,K]=(0,n.useState)(void 0),[S,C]=(0,n.useState)(""),[F,D]=(0,l.fp)(c.AG.shellNowDir),[L,M]=(0,l.fp)(c.AG.sshInfo),{check_user_auth:B}=(0,x.MH)(),P=async e=>{const t=new A.x;if(t.password=e?e.password:p,t.domain=e?e.domain:g,t.port=e?e.port:k,t.username=e?e.username:s,t.private_path=e?e.private_path:f,t.dir=e?e.dir:S,!t.dir)return void(0,h.zN)("dir not found");if(!t.username)return void(0,h.zN)("username not found");if(!t.domain)return void(0,h.zN)("domain not found");if(!t.port)return void(0,h.zN)("port not found");if(!t.private_path&&!t.password)return void(0,h.zN)("private_path password not found");const n=await u.Fg.post("start",t);n&&n.code===_.m.Success&&(a((0,E.Jn)("/proxy/remoteShell",t.dir)),D([t.dir]),M(n.data))};return(0,w.jsxs)(n.Fragment,{children:[!L.key&&(0,w.jsxs)(b.aZ,{position:"right",children:[(0,w.jsx)(i.$Z,{placeholder:t("目录"),icon:"home",value:S,handleInputChange:e=>C(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("账号"),icon:"verified_user",value:s,handleInputChange:e=>o(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{type:"password",placeholder:t("密码"),icon:"password",value:p,handleInputChange:e=>m(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("私钥路径"),icon:"private_connectivity",value:f,handleInputChange:e=>y(e),max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("连接地址"),icon:"location_on",value:g,handleInputChange:e=>{j(e)},max_width:"15rem"}),(0,w.jsx)(i.$Z,{placeholder:t("端口"),icon:"outlet",value:k,handleInputChange:e=>{if(!e)return;/^\d+$/.test(e)||(0,h.zN)(t("不是数字")),K(parseInt(e))},max_width:"7rem"}),(0,w.jsx)(d.rA,{icon:"play_arrow",title:t("连接"),onClick:()=>{P()}})]}),L.key?(0,w.jsx)(U,{close:async()=>{const e=new A.x;e.key=L.key;await u.Fg.post("close",e);M({})},data:{port:k,password:p,username:s,domain:g,dir:S}}):(0,w.jsx)(N.N,{have_auth_edit:B(v.oV.ssh_proxy_tag_update),getItems:async()=>{const e=await u.Fg.get("tag");return e.code===_.m.Success?e.data:[]},save:async e=>{await u.Fg.post("tag/save",e)},clickItem:async e=>{j(e.domain),C(e.dir),K(e.port),o(e.username),m(e.password),y(e.private_path),await P(e)},items:[{key:"name",preName:t("名字")},{key:"domain",preName:t("地址")},{key:"port",preName:t("端口")},{key:"username",preName:t("账号")},{key:"password",preName:t("密码")},{key:"private_path",preName:t("私钥路径")},{key:"dir",preName:t("访问目录")},{key:"color",preName:"color"}]})]})}function Z(e){switch(e){case 0:return 1;case 2:return 2;default:return 0}}class J{constructor(e){this.canvas=e,this.render=new ee.Canvas.create(this.canvas),this.activeSession=!1,this.install()}close(){this.activeSession=!1}install(){var e=this;return this.canvas.addEventListener("mousemove",function(t){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:0,isPressed:!1}),t.preventDefault||e.activeSession(),!1}),this.canvas.addEventListener("mousedown",function(t){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!0}),t.preventDefault(),!1}),this.canvas.addEventListener("mouseup",function(t){if(e.activeSession){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("contextmenu",function(t){if(e.activeSession){var a=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:Z(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("DOMMouseScroll",function(t){if(e.activeSession){var a=t.detail,n=Math.round(15*Math.abs(a)/8),s=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.wheel,{x:t.clientX-s.left,y:t.clientY-s.top,step:n,isNegative:a>0,isHorizontal:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("mousewheel",function(t){if(e.activeSession){var a=Math.abs(t.deltaX)>Math.abs(t.deltaY),n=a?t.deltaX:t.deltaY,s=Math.round(15*Math.abs(n)/8),o=ee.elementOffset(e.canvas);return C.ws.sendData(S.HK.wheel,{x:t.clientX-o.left,y:t.clientY-o.top,step:s,isNegative:n>0,isHorizontal:a}),t.preventDefault(),!1}}),window.addEventListener("keydown",function(t){if(e.activeSession)return C.ws.sendData(S.HK.scancode,{code:ee.scancode(t),isPressed:!0}),t.preventDefault(),!1}),window.addEventListener("keyup",function(t){if(e.activeSession)return C.ws.sendData(S.HK.scancode,{code:ee.scancode(t),isPressed:!1}),t.preventDefault(),!1}),this}connect(e,t,a,n,s,o){var i=this;C.ws.addMsg(S.HK.rdp_connect,e=>{console.log("[mstsc.js] connected"),i.activeSession=!0}),C.ws.addMsg(S.HK.rdp_bitmap,e=>{const t=e.context;t.data=e.bin_context,i.render.update(t)}),C.ws.addMsg(S.HK.rdp_close,e=>{o(null),console.log("[mstsc.js] close"),i.activeSession=!1}),C.ws.addMsg(S.HK.rdp_error,e=>{i.activeSession=!1});const r=new S.hf;r.cmdType=S.HK.infos,r.context={ip:e.indexOf(":")>-1?e.split(":")[0]:e,port:a,screen:{width:this.canvas.width,height:this.canvas.height},domain:t,username:n,password:s,locale:ee.locale()},C.ws.send(r)}}class X{constructor(e){this.canvas=e,this.ctx=e.getContext("2d")}update(e){var t=null;t=e.isCompress?function(e){var t=null;switch(e.bitsPerPixel){case 15:t="bitmap_decompress_15";break;case 16:t="bitmap_decompress_16";break;case 24:t="bitmap_decompress_24";break;case 32:t="bitmap_decompress_32";break;default:throw"invalid bitmap data format"}var a=new Uint8Array(e.data),n=Module._malloc(a.length),s=new Uint8Array(Module.HEAPU8.buffer,n,a.length);s.set(a);var o=e.destRight-e.destLeft+1,i=e.destBottom-e.destTop+1,r=o*i*4,l=Module._malloc(r),c=new Uint8Array(Module.HEAPU8.buffer,l,r),d=(Module.ccall(t,"number",["number","number","number","number","number","number","number","number"],[c.byteOffset,o,i,e.width,e.height,s.byteOffset,a.length]),new Uint8ClampedArray(c.buffer,c.byteOffset,r));return Module._free(n),Module._free(l),{width:o,height:i,data:d}}(e):function(e){return{width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)}}(e);var a=this.ctx.createImageData(t.width,t.height);a.data.set(t.data),this.ctx.putImageData(a,e.destLeft,e.destTop)}}var Y={"":0,Escape:1,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,Minus:12,Equal:13,Backspace:14,Tab:15,KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,BracketLeft:26,BracketRight:27,Enter:28,ControlLeft:29,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,Semicolon:39,Quote:40,Backquote:41,ShiftLeft:42,Backslash:43,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Comma:51,Period:52,Slash:53,ShiftRight:54,NumpadMultiply:55,AltLeft:56,Space:57,CapsLock:58,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,Pause:69,ScrollLock:70,Numpad7:71,Numpad8:72,Numpad9:73,NumpadSubtract:74,Numpad4:75,Numpad5:76,Numpad6:77,NumpadAdd:78,Numpad1:79,Numpad2:80,Numpad3:81,Numpad0:82,NumpadDecimal:83,PrintScreen:84,IntlBackslash:86,F11:87,F12:88,NumpadEqual:89,F13:100,F14:101,F15:102,F16:103,F17:104,F18:105,F19:106,F20:107,F21:108,F22:109,F23:110,KanaMode:112,Lang2:113,Lang1:114,IntlRo:115,F24:118,Convert:121,NonConvert:123,IntlYen:125,NumpadComma:126,MediaTrackPrevious:57360,MediaTrackNext:57369,NumpadEnter:57372,ControlRight:57373,VolumeMute:57376,LaunchApp2:57377,MediaPlayPause:57378,MediaStop:57380,VolumeDown:57390,VolumeUp:57392,BrowserHome:57394,NumpadDivide:57397,PrintScreen:57399,AltRight:57400,NumLock:57413,Pause:57414,Home:57415,ArrowUp:57416,PageUp:57417,ArrowLeft:57419,ArrowRight:57421,End:57423,ArrowDown:57424,PageDown:57425,Insert:57426,Delete:57427,OSLeft:57435,OSRight:57436,ContextMenu:57437,Power:57438,BrowserSearch:57445,BrowserFavorites:57446,BrowserRefresh:57447,BrowserStop:57448,BrowserForward:57449,BrowserBack:57450,LaunchApp1:57451,LaunchMail:57452,MediaSelect:57453},W={27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",192:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",173:"Minus",61:"Equal",8:"Backspace",9:"Tab",81:"KeyQ",87:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",219:"BracketLeft",221:"BracketRight",13:"Enter",20:"CapsLock",65:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",59:"Semicolon",222:"Quote",220:"Backslash",16:"ShiftLeft",220:"IntlBackslash",90:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",77:"KeyM",188:"Comma",190:"Period",191:"Slash",16:"ShiftRight",17:"ControlLeft",18:"AltLeft",91:"OSLeft",32:"Space",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",13:"NumpadEnter",96:"Numpad0",110:"NumpadDecimal",17:"ControlLeft"},q={firefox:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",169:"Minus",61:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",160:"BracketLeft",164:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",165:"Quote",170:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",59:"Comma",58:"Period",161:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:W},chrome:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",219:"Minus",187:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",221:"BracketLeft",186:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",192:"Quote",220:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",190:"Comma",191:"Period",223:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:W}};function Q(){}Q.prototype={$:function(e){return document.getElementById(e)},elementOffset:function(e){for(var t=0,a=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-e.scrollLeft,a+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:a,left:t}},browser:function(){return"undefined"!=typeof InstallTrigger?"firefox":window.chrome?"chrome":document.docuemntMode?"ie":null},locale:function(){return window.navigator.userLanguage||window.navigator.language},client:{create:function(e){return new J(e)}},Canvas:{create:function(e){return new X(e)}},scancode(e){var t=Q.prototype.locale();return t=["fr","en"].indexOf(t)>0&&t||"en",Y[e.code||q[Q.prototype.browser()||"firefox"][t][e.keyCode]]}};let ee=new Q;var te=a(38240);let ae;function ne(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(c.AG.header_min),{check_user_auth:s}=(0,x.MH)(),[p,m]=(0,n.useState)(void 0),[f,y]=(0,n.useState)(3389),[g,j]=(0,n.useState)(void 0),[k,K]=(0,n.useState)(void 0),[A,F]=(0,n.useState)(!1),[D,L]=(0,n.useState)(!1);var I=null;(0,n.useEffect)(()=>(ae||(async()=>{try{await(0,te.J)("rle.js"),ae=!0}catch(t){return void(0,h.zN)(e("加载资源失败"))}})(),()=>{I&&(I.close(),I=null)}),[]);const M=t=>{L(!0),function(n,s,o,i){if(n=n||t.address,o=o||t.username,i=i||t.password,!n||!o)return(0,h.zN)(e("ip或者账号不允许为空")),void L(!1);!function(e){I||(I=ee.client.create(ee.$(e)))}("rdpwebview");var r=ee.$("rdpwebview");r.style.display="inline",r.width=window.innerWidth,r.height=window.innerHeight,F(!0),a(!0),I.connect(n,"",s,o,i,function(e){ee.$("rdpwebview").style.display="none",a(!1),L(!1),F(!1)})}(p,f,g,k)};return(0,w.jsxs)("div",{children:[(0,w.jsxs)(b.aZ,{position:"right",children:[(0,w.jsx)(i.$Z,{placeholder:e("地址"),icon:"network_ping",value:p,max_width:"15rem",handleInputChange:e=>m(e)}),(0,w.jsx)(i.$Z,{placeholder:e("端口"),icon:"outlet",value:f,max_width:"10rem",handleInputChange:e=>{e&&y(parseInt(e))}}),(0,w.jsx)(i.$Z,{placeholder:e("账号"),icon:"manage_accounts",value:g,max_width:"15rem",handleInputChange:e=>j(e)}),(0,w.jsx)(i.$Z,{placeholder:e("密码"),icon:"password",value:k,max_width:"15rem",handleInputChange:e=>K(e)}),!D&&(0,w.jsx)(d.rA,{icon:"play_arrow",title:e("连接"),onClick:M}),D&&(0,w.jsx)(d.rA,{icon:"close",title:e("关闭"),onClick:async()=>{F(!1),await C.ws.sendData(S.HK.rdp_disconnect,"");var e=ee.$("rdpwebview");e.getContext("2d").clearRect(0,0,e.width,e.height),ee.$("rdpwebview").style.display="none",L(!1),a(!1)}})]}),(0,w.jsxs)(o.jW,{isFull:A,children:[!D&&(0,w.jsx)(N.N,{have_auth_edit:s(v.oV.rdp_proxy_tag_update),getItems:async()=>{const e=await u.J0.get("tag");return e.code===_.m.Success?e.data:[]},save:async t=>{(await u.J0.post("tag/save",t)).code!==_.m.Success&&(0,h.zN)(e("网络错误"))},clickItem:async e=>{K(e.password),j(e.username),m(e.address),y(e.port),M(e)},items:[{key:"name",preName:e("名字")},{key:"address",preName:e("地址")},{key:"port",preName:e("端口")},{key:"username",preName:e("账号")},{key:"password",preName:e("密码")},{key:"color",preName:"color"}]}),(0,w.jsx)("canvas",{id:"rdpwebview",style:{display:"none"}})]})]})}var se=a(8694),oe=a(19324);const ie=(0,n.createContext)({activeKey:"",setActiveKey:()=>{}});function re(e){const{children:t,activeKey:a,defaultActiveKey:s,onChange:o,width:i}=e,[r,l]=(0,n.useState)(()=>a??s??"");(0,n.useEffect)(()=>{void 0!==a&&l(a)},[a]);const c=e=>{void 0===a&&l(e),o&&o(e)},d=[];return n.Children.forEach(t,e=>{n.isValidElement(e)&&e.type===le&&d.push({key:e.props.itemKey,tab:e.props.tab,disabled:e.props.disabled})}),(0,n.useEffect)(()=>{!r&&d.length>0&&l(d[0].key)},[d,r]),(0,w.jsx)(ie.Provider,{value:{activeKey:r,setActiveKey:c},children:(0,w.jsxs)("div",{className:"modern-tabs-container",style:{width:i||"100%"},children:[(0,w.jsx)("div",{className:"modern-tabs-nav",children:d.map(e=>{const t=["modern-tabs-tab",r===e.key?"active":"",e.disabled?"disabled":""].filter(Boolean).join(" ");return(0,w.jsx)("div",{className:t,onClick:()=>!e.disabled&&c(e.key),children:e.tab},e.key)})}),(0,w.jsx)("div",{className:"modern-tabs-content",children:t})]})})}function le(e){const{itemKey:t,children:a}=e,{activeKey:s}=(0,n.useContext)(ie),o=s===t;return(0,w.jsx)("div",{className:"modern-tab-panel "+(o?"active":""),children:a})}const ce=n.lazy(()=>Promise.all([a.e(122),a.e(4091)]).then(a.bind(a,84091)));let de,pe,ue,he;function me(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(c.AG.confirm),[f,y]=(0,l.fp)(c.AG.showPrompt),{check_user_auth:g}=(0,x.MH)(),[j,k]=(0,n.useState)(""),[b,K]=(0,l.fp)(c.AG.router_jump),[A,F]=(0,n.useState)("get"),[D,L]=(0,n.useState)(""),[I,M]=(0,n.useState)(void 0),[B,R]=(0,n.useState)([]),[E,O]=(0,n.useState)([]),[G,H]=(0,n.useState)("headers"),[z,U]=(0,n.useState)(String(se.RB.row)),[V,Z]=(0,n.useState)("body"),[J,X]=(0,n.useState)(),[Y,W]=(0,l.fp)(c.AG.nav_index_add_item_by_now_list),[q,Q]=(0,l.fp)(c.AG.prompt_card);x.xK.set_value_temp("{}",0),x.xK.set_value_temp("",1),(0,n.useEffect)(()=>(de={},pe="",ue="",he="",x.xK.get_editor(0).session.setMode("ace/mode/json"),b.http_download_map_path&&(M(b.http_download_map_path),K({})),C.ws.sendData(S.HK.http_download_water,void 0).then(()=>{C.ws.addMsg(S.HK.http_download_water,e=>{const t=e.context;O(t)})}),()=>{C.ws&&"function"==typeof C.ws.removeMsg&&C.ws.removeMsg(S.HK.http_download_water)}),[]);const ee=e=>{const t=new se.vr;t.url=D,t.method=A,t.header_type="headers"===G?1:2,"headers"===G&&(de=JSON.parse(x.xK.get_editor_value(0))),t.headers=de;const a=Number(z);if(t.body_type=a,a===se.RB.row)pe=x.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.json)de["Content-Type"]="application/json",pe=x.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.form){de["Content-Type"]="multipart/form-data",t.form_data_list=B;for(const t of B)t.key&&t.is_file&&e&&e.append(t.fullPath,t.file_object)}return t};return(0,w.jsx)("div",{children:(0,w.jsxs)(o.xh,{children:[(0,w.jsxs)(o.fI,{children:[(0,w.jsxs)(o.VP,{children:[0!==E.length&&(0,w.jsx)(s.Zp,{title:"正在下载",children:(0,w.jsx)("div",{children:E.map((t,a)=>(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"div-row",children:[(0,w.jsx)(d.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C.ws.sendData(S.HK.http_download_cancel,t.local_download_path)}}),(0,w.jsx)(s.xP,{context:t.filename,tip_context:t.local_download_path}),(0,w.jsx)("span",{style:{paddingLeft:".3rem",color:"green"},children:`${t.progresses??0}% ${t.loaded?(0,P.v7)(t.loaded):""}MB / ${t.seep??""}MB/s `})]}),(0,w.jsx)("div",{style:{width:t.progresses?`${t.progresses}%`:"0",backgroundColor:"#40c4ff",height:"5px",transition:"0.2s ease width",borderRadius:"10px"}})]},a))})}),(0,w.jsxs)(s.Zp,{title:"",rightBottomCom:Number(z)===se.RB.form&&"body"===G&&(0,w.jsx)(d.rA,{icon:"add",title:e("添加"),onClick:()=>{R([{},...B])}}),children:[(0,w.jsxs)("div",{className:"http_url",children:[(0,w.jsx)(i.l6,{width:"10rem",value:A,onChange:e=>{F(e)},options:[{value:"get",color:"#28a745"},{value:"post",color:"#007bff"},{value:"put",color:"#fd7e14"},{value:"delete",color:"#dc3545"},{value:"head",color:"#6f42c1"},{value:"options",color:"#17a2b8"},{value:"connect",color:"#666666"},{value:"trace",color:"#666666"},{value:"custom",color:"#e83e8c"}]}),(0,w.jsx)(i.Sm,{width:"50rem",placeholder:e("http url"),value:D,handleInputChange:e=>{L(e)}}),(0,w.jsx)(d.rA,{icon:"send",title:e("发送"),onClick:async()=>{if(!u._U.have_http_method(A))return void(0,h.zN)(e("不存在的http method"));if(!D)return void(0,h.zN)("url is empty");X(void 0),k("");const t=new FormData;t.append("data",JSON.stringify(ee(t)));let a="http/send";I&&(a+=`?local_download_path=${I}`),oe.A.post(u._U.getUrl(a),t,{headers:{"Content-Type":"multipart/form-data",Authorization:localStorage.getItem("token")}}).catch(e=>{(0,h.zN)(e.message)}).then(e=>{if(!e)return;let t={};try{if(e.headers.filecat_remote_raw_headers&&(t=JSON.parse(e.headers.filecat_remote_raw_headers),he=JSON.stringify(t,null,2)),e.headers.filecat_remote_code)try{const t=JSON.parse(e.headers.filecat_remote_code);X(200===t||201===t?(0,w.jsx)("span",{style:{color:"green"},children:"200"}):t)}catch(e){console.log(e)}}catch(t){he=String(e.headers.filecat_remote_raw_headers)}const a=(t["content-type"]||t["Content-Type"]||"").toLowerCase();ue="object"==typeof e.data?JSON.stringify(e.data,null,2):e.data;const n=x.xK.get_editor(2),s="body"===V?ue:he;if(n){if(a.includes("application/json")||a.includes("+json")){n.session.setMode("ace/mode/json");try{const e=JSON.parse(ue);ue=JSON.stringify(e,null,2)}catch(e){}}else a.includes("html")?n.session.setMode("ace/mode/html"):a.includes("xml")?n.session.setMode("ace/mode/xml"):a.includes("javascript")?n.session.setMode("ace/mode/javascript"):n.session.setMode("ace/mode/text");n.setValue("body"===V?ue:he,-1)}k(s)})}}),g(v.oV.http_proxy_tag_update)&&(0,w.jsx)(d.rA,{title:e("添加"),icon:"save_as",onClick:()=>{if(!g(v.oV.http_proxy_tag_update))return void(0,h.zN)("no permission");for(const t of B)if(t.is_file)return void(0,h.zN)(e("frm_lm"));let t;Q({open:!0,title:e("信息"),context_div:(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{className:"card-content",children:(0,w.jsx)(i.Sm,{placeholderOut:e("输入标签名"),handleInputChange:e=>t=e})}),(0,w.jsx)("div",{className:"card-action",children:(0,w.jsx)("button",{className:"button button--flat",onClick:async()=>{const e=await ee();e.local_download_path=I,e.form_data_list=JSON.stringify(B),e.headers=JSON.stringify(e.headers),"object"==typeof e.data&&(e.data=JSON.stringify(e.data)),e.name=t,W(e),Q({open:!1})},children:e("确定")})})]})})}})]}),(0,w.jsxs)(re,{activeKey:G,onChange:e=>H(e),children:[(0,w.jsx)(le,{itemKey:"headers",tab:e("请求头")+"(json)",children:(0,w.jsxs)("div",{style:{marginTop:"10px"},children:[(0,w.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"},children:(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:function(){x.xK.get_editor(0)?.formatCode?.()}})}),(0,w.jsx)("div",{className:"http_ace",children:(0,w.jsx)(ce,{name:"",editor_id:0})})]})}),(0,w.jsx)(le,{itemKey:"body",tab:e("请求体"),children:(0,w.jsxs)("div",{style:{marginTop:"10px"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,w.jsxs)(re,{activeKey:z,onChange:e=>{U(e);const t=Number(e);t===se.RB.row?x.xK.get_editor(1).session.setMode("ace/mode/text"):t===se.RB.json&&x.xK.get_editor(1).session.setMode("ace/mode/json")},children:[(0,w.jsx)(le,{itemKey:String(se.RB.row),tab:e("row")}),(0,w.jsx)(le,{itemKey:String(se.RB.json),tab:e("json")}),(0,w.jsx)(le,{itemKey:String(se.RB.form),tab:e("form")})]}),Number(z)!==se.RB.form&&(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:function(){x.xK.get_editor(1)?.formatCode?.()}})]}),Number(z)===se.RB.form&&(0,w.jsx)("div",{style:{marginTop:"10px"},children:(0,w.jsx)(p.X,{headers:["key",e("值")],rows:B.map((t,a)=>[(0,w.jsx)(i.Sm,{value:t.key,handleInputChange:e=>{t.key=e,R([...B])},no_border:!0}),(0,w.jsx)(i.Sm,{value:t.value,handleInputChange:e=>{t.value=e,t.is_file=!1,R([...B])},no_border:!0}),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.rA,{icon:"file_upload",title:e("上传文件"),onClick:()=>(e=>{y({show:!0,type:$.PromptEnum.UploadFile,overlay:!0,data:{extra_data:{only_file:!0},call:t=>{let a=t.currentTarget?.files;if(!a)return;const n=a[0];n.fullPath=(0,T.hU)()+Date.now().toString(),B[e].value=`${n}(${n.name})`,B[e].is_file=!0,B[e].fileName=n.name,B[e].fullPath=n.fullPath,R([...B]),B[e].file_object=n,y({overlay:!1,type:"",show:!1,data:{}})}}})})(a)}),(0,w.jsx)(d.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{B.splice(e,1),R([...B])})(a)})]})]),width:"10rem"})}),(0,w.jsx)("div",{className:"http_ace",style:{marginTop:"10px",display:Number(z)!==se.RB.form?"block":"none"},children:(0,w.jsx)(ce,{name:"",editor_id:1})})]})})]}),(0,w.jsx)("div",{style:{paddingTop:"1rem"},children:void 0===I?(0,w.jsx)("span",{style:{cursor:"pointer",color:"#3b82f6"},onClick:()=>{M("")},children:e("下载到本地目录")}):(0,w.jsx)(i.Sm,{placeholder:e("本地地址"),value:I,handleInputChange:e=>{M(e)},handlerEnter:()=>{I||M(void 0)}})})]})]}),(0,w.jsx)(o.VP,{children:(0,w.jsxs)(s.Zp,{title:J,rightTopCom:(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,w.jsx)(d.rA,{title:e("格式化"),icon:"data_object",onClick:()=>{x.xK.get_editor(2)?.formatCode?.()}}),(0,w.jsx)(d.rA,{title:e("复制"),icon:"copy_all",onClick:()=>{const t=x.xK.get_editor_value(2);t&&((0,m.lW)(t),(0,h.SK)(e("完成")))}})]}),children:[(0,w.jsxs)(re,{activeKey:V,onChange:e=>{Z(e);const t="body"===e?ue:he;k(t);const a=x.xK.get_editor(2);if(a){try{JSON.parse(t),a.session.setMode("ace/mode/json")}catch{a.session.setMode("ace/mode/text")}a.setValue(t,-1)}},children:[(0,w.jsx)(le,{itemKey:"body",tab:e("响应体")}),(0,w.jsx)(le,{itemKey:"headers",tab:e("响应头")})]}),(0,w.jsx)("div",{className:"http_ace",style:{marginTop:"10px",height:"21rem"},children:(0,w.jsx)(ce,{name:"",editor_id:2})})]})})]}),(0,w.jsx)(o.fI,{children:(0,w.jsx)(o.VP,{children:(0,w.jsx)(N.N,{getItems:async()=>{const e=await u._U.get("http/tag");return e.code===_.m.Success?e.data:[]},save:async t=>{(await u._U.post("http/tag/save",t)).code!==_.m.Success&&(0,h.zN)(e("网络错误"))},have_auth_edit:g(v.oV.http_proxy_tag_update),clickItem:async e=>{L(e.url),F(e.method),M(e.local_download_path),e.header_type&&H(1===e.header_type?"headers":"body"),e.headers&&(de=JSON.parse(e.headers),1===e.header_type&&(x.xK.get_editor(0).setValue(e.headers,-1),x.xK.get_editor(0).session.setMode("ace/mode/json"))),e.form_data_list&&R(JSON.parse(e.form_data_list)),e.data&&(pe=e.data),e.body_type&&(U(String(e.body_type)),e.body_type===se.RB.row?x.xK.get_editor(1).session.setMode("ace/mode/text"):e.body_type===se.RB.json&&x.xK.get_editor(1).session.setMode("ace/mode/json"),x.xK.get_editor(1).setValue(e.data,-1))},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"method",preName:"method"},{key:"headers",preName:"headers"},{key:"data",preName:"data"},{key:"form_data_list",preName:"form_data_list"},{key:"local_download_path",preName:"local_download_path"},{key:"color",preName:"color"}]})})})]})})}var fe=a(87361);const ye=n.lazy(()=>Promise.all([a.e(8772),a.e(8257),a.e(7759)]).then(a.bind(a,45601)));function _e({}){const{check_user_auth:e}=(0,x.MH)(),{t}=(0,r.Bd)(),a=[];return e(v.oV.http_proxy)&&a.push({index:1,name:t("http代理"),rto:"http/",component:(0,w.jsx)(me,{})}),e(v.oV.ssh_proxy)&&a.push({index:1,name:`ssh ${t("代理")}`,tip:t("ssh_proxy_tip"),rto:"remoteShell/",component:(0,w.jsx)(V,{})}),e(v.oV.browser_proxy)&&a.push({index:1,name:`${t("浏览器")} ${t("代理")}`,rto:"browserproxy/",component:(0,w.jsx)(j,{})}),e(v.oV.rdp_proxy)&&a.push({index:1,name:`rdp ${t("代理")}`,rto:"rdp/",component:(0,w.jsx)(ne,{})}),e(v.oV.rtsp_proxy)&&a.push({index:1,name:t("rtsp播放器"),rto:"rtsp/",component:(0,w.jsx)(ye,{})}),(0,w.jsx)(o.W1,{optionList:a,father_route:fe.o.proxy})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3551],{20734(e,t,n){n.d(t,{A:()=>l});var s=n(96540),r=n(48890),a=n(74848);function l({valueA:e,valueB:t,mode:n="split",theme:l,filename:o}){const c=(0,s.useRef)(null),i=(0,s.useRef)(null),d=(0,s.useMemo)(()=>o&&r.Tt.getModeForPath(o).mode||"ace/mode/text",[o]);return(0,s.useEffect)(()=>{const s=c.current;if(!s)return;const a=r.Kw.require("ace/ext/diff"),o={valueA:e??"",valueB:t??"",diffProvider:new a.DiffProvider},h="inline"===n,u=h?new a.InlineDiffView({...o,inline:"a"},s):new a.SplitDiffView(o);h||(u.container=s,s.appendChild(u.editorA.container),s.appendChild(u.editorB.container)),l&&u.setTheme(l),u.editorA?.session.setMode(d),u.editorB?.session.setMode(d),u.onInput(),u.foldUnchanged();const x=requestAnimationFrame(()=>{u.editorA?.resize(!0),u.editorB?.resize(!0)});return i.current=u,()=>{cancelAnimationFrame(x);try{u.destroy()}catch(e){}i.current=null,s.innerHTML=""}},[e,t,n,l,d]),(0,a.jsx)("div",{className:"ace-diff",ref:c})}},77481(e,t,n){n.d(t,{S:()=>o,X:()=>l});var s=n(96540),r=n(61443),a=n(74848);function l(e){const[t,n]=s.useState([]),l=(0,s.useRef)(-1),[o,c]=(0,s.useState)(-1),[i,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{l.current=-1,c(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let l=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(l=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(o===n?"row-dragging":"")+(i===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(l.current=n,c(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=l.current,n=i;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,s)=>{const r=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},48890(e,t,n){n.d(t,{Kw:()=>s,Tt:()=>r});var s=n(80952),r=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(55208),n(34678),n(24522));const a=`https://gcore.jsdelivr.net/npm/ace-builds@${s.version}/src-min-noconflict/`;s.config.set("basePath",a),s.config.set("modePath",a),s.config.set("themePath",a),s.config.set("workerPath",a)},83029(e,t,n){n.d(t,{N:()=>j});var s=n(96540),r=n(34843),a=n(82893),l=n(74848);function o(e){const[t,n]=(0,r.fp)(a.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 c=n(64694),i=n(61443),d=n(85997),h=n(61973),u=n(22022);const x=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let p,m,f=[];const g=[];function j(e){const[t,n]=(0,s.useState)([]),[j,v]=(0,s.useState)(-1),b=(0,h.zy)(),[w,C]=(0,s.useState)(!1),[S,N]=(0,s.useState)(!1),{t:y}=(0,u.Bd)(),[_,k]=(0,s.useState)([]),[I,A]=(0,r.fp)(a.AG.nav_index_add_item_by_now_list),P=e=>{-1!==j?g[j]._children=e:f=e};(0,s.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();f=t,n(f)})()},[b]);(0,s.useEffect)(()=>{if(I){const e=[...t,{name:"",color:(0,c.Lr)(x),...I}];P(e),n(e),C(!0),A(void 0)}},[I]);const M=e=>{v(j+1),n(e._children),g.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==j&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===j?f:g[j-1]._children),v(j-1),g.pop()}}),t.map((r,a)=>(0,l.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{p=t})(0,a),onDrop:e=>((e,s)=>{e.preventDefault();const r=t[p],a=t[s];if(a&&"dir"===a._type){const e=[...t];return e.splice(p,1),a._children||(a._children=[]),a._children.push(r),P(e),void n(e)}const l=[...t],o=l[p];l.splice(p,1),l.splice(s,0,o),P(l),n(l)})(e,a),style:{cursor:w?"move":"pointer"},children:[(0,l.jsx)(o,{name:r.name,item:r,...r,div:w,target:"_blank",click_dir:M,clickItem:e.clickItem}),w&&(void 0!==_.find(e=>e===a)||S)&&(0,l.jsxs)("div",{className:S?"":" site_edit ",children:["dir"===r._type?(0,l.jsxs)(s.Fragment,{children:[(0,l.jsx)(i.Sm,{value:r.name,handleInputChange:e=>{r.name=e},placeholder:y("输入类目名"),no_border:!0}),(0,l.jsx)(i.Sm,{value:r.color,type:"color",handleInputChange:e=>{r.color=e},no_border:!0})]}):e.items.map((e,t)=>(0,l.jsx)("div",{children:(0,l.jsx)(i.Sm,{value:r[e.key],type:"color"===e.key?"color":void 0,handleInputChange:t=>{r[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!S&&(0,l.jsx)(d.C3,{text:y("折叠"),clickFun:()=>{k((0,c.P1)(_,a))}})]}),w&&(0,l.jsx)("div",{style:{display:"block"},children:(0,l.jsxs)("span",{className:"div-row ",children:[(0,l.jsx)(d.C3,{text:y("删除"),clickFun:()=>{(e=>{const s=[...t];s.splice(e,1),P(s),n(s)})(a)}}),(0,l.jsx)(d.C3,{text:y("编辑"),clickFun:()=>{void 0===_.find(e=>e===a)&&k([..._,a])}})]})})]},a)),w&&(0,l.jsxs)("div",{style:{display:"block"},children:[(0,l.jsx)(d.rA,{title:y("取消"),icon:"cancel",onClick:()=>{k([]),C(!1),m&&(n(m),P(m)),N(!1)}}),(0,l.jsx)(d.rA,{title:y("添加"),icon:"add",onClick:async()=>{const s=[...t,{name:"",color:(0,c.Lr)(x),...e.get_pre_add_item&&await e.get_pre_add_item()}];P(s),n(s)}}),(0,l.jsx)(d.rA,{title:y("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];P(e),n(e)}}),(0,l.jsx)(d.rA,{title:y("全部编辑"),icon:S?"unfold_less":"unfold_more",onClick:()=>{N(!S)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,l.jsx)(d.rA,{icon:w?"save":"edit",title:y(w?"保存":"编辑"),onClick:async()=>{w?e.save&&await e.save(f):m=t,C(!w)}})]})}},83551(e,t,n){n.r(t),n.d(t,{default:()=>be});var s=n(96540),r=n(75725),a=n(61443),l=n(70447),o=n(85997),c=n(34289),i=n(22022),d=n(62042),h=n(14284),u=n(53459),x=n(74848);function p(e){const{t}=(0,i.Bd)(),[n,p]=(0,s.useState)(t("毫秒")),[m,f]=(0,s.useState)(""),[g,j]=(0,s.useState)(""),[v,b]=(0,s.useState)(null),[w,C]=(0,s.useState)(null),[S,N]=(0,s.useState)(Date.now());return(0,s.useEffect)(()=>{(async()=>{const e=await h.Yu.get("sys_time/get");if(e.code===u.m.Success){const t=await e.data;b(t.timestamp),C(t.timezone),N(t.timestamp)}})();const e=setInterval(()=>{N(e=>e+1e3)},1e3);return()=>clearInterval(e)},[]),(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:33,maxWidth:"30rem",children:(0,x.jsxs)(l.Zp,{title:t("时间转换器"),rightBottomCom:(0,x.jsx)(o.C3,{text:t("确定"),clickFun:function(){if(!m&&!g)return void(0,d.zN)(t("不能都为空"));let e=0;const s=""!==m&&0!==m;if(s){if(!(0,c.kf)(m))return void(0,d.zN)("must be number !");e=parseInt(m),"分秒"===n&&(e*=1e3)}const r=new Date(s?e:g),a=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(r);if(j(a),!m){const e=r.getTime();f("毫秒"===n?e:e/1e3)}}}),children:[(0,x.jsx)(a.l6,{value:n,options:[{title:t("毫秒"),value:"毫秒"},{title:t("分秒"),value:"分秒"}],onChange:function(e){p(e)}}),(0,x.jsx)(a.Sm,{placeholder:n,value:m,handleInputChange:e=>{f(e)}}),(0,x.jsx)(a.Sm,{placeholder:t("格式化时间"),value:g,handleInputChange:e=>{j(e)}})]})}),(0,x.jsx)(r.VP,{maxWidth:"35rem",children:null!==v&&null!==w&&(0,x.jsxs)(l.Zp,{title:t("服务器时间"),children:[(0,x.jsxs)("h1",{children:[t("时区"),": ",w]}),(0,x.jsxs)("h1",{children:[t("时间"),": ",new Date(S).toLocaleString(navigator.language,{timeZone:w})]})]})})]})}var m=n(4412),f=n(83029),g=n(78247),j=n(23430);function v(e){const{t}=(0,i.Bd)(),{check_user_auth:n}=(0,g.MH)(),[r,l]=(0,s.useState)(""),c=async e=>{const n=e||r;if(!n)return void(0,d.zN)(t("mac地址不能为空"));(await h._U.post("wol/exec",{mac:n})).code===u.m.Success&&(0,d.SK)(t("发送唤醒命令成功"))};return(0,x.jsxs)("div",{children:[(0,x.jsxs)(m.aZ,{position:"right",children:[(0,x.jsx)(o.rA,{icon:"play_arrow",title:t("发送"),onClick:()=>{c()}}),(0,x.jsx)(a.$Z,{placeholder:t("mac_dst"),icon:"laptop_mac",value:r,handleInputChange:e=>l(e)})]}),(0,x.jsx)(f.N,{have_auth_edit:n(j.oV.wol_proxy_tag_update),getItems:async()=>{const e=await h._U.get("wol/tag");return e.code===u.m.Success?e.data:[]},save:async e=>{(await h._U.post("wol/tag/save",e)).code!==u.m.Success&&(0,d.zN)(t("网络错误"))},clickItem:async e=>{l(e.mac),c(e.mac)},items:[{key:"name",preName:t("名字")},{key:"mac",preName:"mac"+t("地址")},{key:"color",preName:"color"}]})]})}var b=n(77481),w=n(34843),C=n(82893),S=n(40505);let N;function y(){const[e,t]=(0,s.useState)("rsa"),[n,c]=(0,s.useState)("pem"),{t:p,i18n:f}=(0,i.Bd)(),[g,j]=(0,w.fp)(C.AG.confirm),[v,y]=(0,s.useState)(""),[_,k]=(0,s.useState)(""),I=async t=>{if(!_||!v)return void(0,d.zN)(p("密钥不能为空"));let n="id_"+e;"pub"===t&&(n+=".pub"),j({open:!0,title:p("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${N}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await h.cD.post("save_openssh",{name:n,context:"pub"===t?v:_})).code===u.m.Success&&((0,d.SK)(p("完成")),j({open:!1,handle:null}))}})};return(0,x.jsxs)(s.Fragment,{children:[(0,x.jsx)(m.aZ,{position:"right",children:(0,x.jsx)(b.S,{isFlex:!0,columns:[(0,x.jsx)(a.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,x.jsx)(a.l6,{tip:p("输出格式"),value:n,width:"auto",onChange:e=>{c(e)},options:[{title:p("普通PEM"),value:"pem"},{title:p("opensshPEM"),value:"openssh_pem"}]}),(0,x.jsx)(o.rA,{icon:"play_arrow",title:p("生成"),onClick:()=>{(async()=>{const t=await h.cD.post("generate",{type:e,form:n});t.code===u.m.Success&&(y(t.data.public_key),k(t.data.private_key),N=t.data.home_path)})()}})]})}),(0,x.jsx)(r.xh,{children:(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:p("公钥"),rightTopCom:(0,x.jsx)(o.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{v&&((0,S.lW)(v),(0,d.SK)(p("完成")))}}),rightBottomCom:"openssh_pem"===n&&(0,x.jsx)(o.C3,{text:p("ssh_dir"),clickFun:()=>{I("pub")}}),children:(0,x.jsx)(a.Z2,{style:{width:"100%",height:"270px"},onChange:e=>{y(e.target.value)},value:v})})}),(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:p("私钥"),rightTopCom:(0,x.jsx)(o.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{_&&((0,S.lW)(_),(0,d.SK)(p("成功")))}}),rightBottomCom:"openssh_pem"===n&&(0,x.jsx)(o.C3,{text:p("ssh_dir"),clickFun:()=>{I("pri")}}),children:(0,x.jsx)(a.Z2,{style:{width:"100%",height:"270px"},value:_,onChange:e=>{k(e.target.value)}})})})]})})]})}var _=n(14944),k=n(92275);function I(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(""),[c,h]=(0,s.useState)("1"),[u,p]=(0,s.useState)("65535"),[m,f]=(0,s.useState)("100"),[g,j]=(0,s.useState)("2000"),[v,w]=(0,s.useState)(!1),[C,S]=(0,s.useState)(null),[N,y]=(0,s.useState)([]),[I,A]=(0,s.useState)(null),P=(0,s.useRef)([]),M=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!M.current)return M.current=!0,_.ws.addMsg(k.HK.port_scan_progress,e=>{S(e.context)}),_.ws.addMsg(k.HK.port_scan_result,e=>{const t=e.context,n=[...P.current,t];P.current=n,y(n)}),_.ws.addMsg(k.HK.port_scan_end,t=>{A(t.context),w(!1),t.context.cancelled?(0,d.zN)(e("扫描已取消")):(0,d.SK)(e("扫描完成"))}),()=>{_.ws.sendData(k.HK.port_scan_cancel,{}),_.ws.removeMsg(k.HK.port_scan_progress),_.ws.removeMsg(k.HK.port_scan_result),_.ws.removeMsg(k.HK.port_scan_end),M.current=!1}},[]);return(0,x.jsx)(r.xh,{children:(0,x.jsx)(r.fI,{children:(0,x.jsx)(r.VP,{widthPer:40,maxWidth:"35rem",children:(0,x.jsxs)(l.Zp,{title:e("TCP ")+e("端口扫描"),rightTopCom:(0,x.jsxs)("span",{children:[C&&(0,x.jsxs)("span",{children:[e("已发现"),": ",C.openCount]}),I&&(0,x.jsxs)("span",{children:[e("总计扫描"),": ",I.totalScanned," | ",e("开放"),": ",I.totalOpen]})]}),rightBottomCom:v?(0,x.jsx)(o.C3,{text:e("取消"),clickFun:()=>{_.ws.sendData(k.HK.port_scan_cancel,{}).catch(()=>{})}}):(0,x.jsx)(o.C3,{text:e("扫描"),clickFun:()=>(()=>{if(!t)return void(0,d.zN)(e("hostreq"));const n=parseInt(c),s=parseInt(u);isNaN(n)||isNaN(s)||n<1||s<1||n>65535||s>65535?(0,d.zN)(e("端口范围无效")):n>s?(0,d.zN)(e("portrng")):(w(!0),S(null),y([]),P.current=[],A(null),_.ws.sendData(k.HK.port_scan_req,{host:t,startPort:n,endPort:s,concurrency:parseInt(m)||100,timeout:parseInt(g)||2e3}).catch(()=>{}))})()}),children:[(0,x.jsx)(a.Sm,{placeholder:e("目标主机"),value:t,handleInputChange:e=>n(e)}),(0,x.jsx)(a.Sm,{placeholder:e("起始端口"),value:c,handleInputChange:e=>h(e)}),(0,x.jsx)(a.Sm,{placeholder:e("结束端口"),value:u,handleInputChange:e=>p(e)}),(0,x.jsx)(a.Sm,{placeholder:e("并发数"),value:m,handleInputChange:e=>f(e)}),(0,x.jsx)(a.Sm,{placeholder:e("超时(ms)"),value:g,handleInputChange:e=>j(e)}),v&&C&&(0,x.jsxs)("div",{children:[(0,x.jsxs)("p",{children:[e("已扫描"),": ",C.scanned," / ",C.total]}),(0,x.jsx)(l.gz,{progress:C.percent})]}),N.length>0&&(0,x.jsx)(b.X,{headers:[e("端口"),e("状态")],rows:N.map(t=>[t.port,(0,x.jsx)("span",{children:e("开放")})])}),v&&0===N.length&&(0,x.jsx)("p",{children:e("正在扫描...")}),!v&&I&&0===N.length&&(0,x.jsx)("p",{children:e("未发现开放端口")}),!v&&!I&&0===N.length&&(0,x.jsx)("p",{children:e("scan_in")})]})})})})}var A=n(48890);const P=(0,s.forwardRef)(function({value:e="",mode:t="plain_text",showLineNumbers:n=!0,wrap:r=!1,readOnly:a=!1,onChange:l,onCursorChange:o,onSave:c,className:i,style:d,options:h},u){const p=(0,s.useRef)(null),m=(0,s.useRef)(null),[f]=(0,w.fp)(C.AG.user_base_info),g=f.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day",j=(0,s.useRef)({onChange:l,onCursorChange:o,onSave:c});return j.current={onChange:l,onCursorChange:o,onSave:c},(0,s.useImperativeHandle)(u,()=>({getValue:()=>m.current?.getValue()??"",setValue:(e,t=!1)=>{const n=m.current;if(n&&(n.setValue(e,-1),t)){const e=n.getSession();e.indentAll?.()}},getEditor:()=>m.current,getCursorOffset:()=>{const e=m.current;return e?e.session.doc.positionToIndex(e.getCursorPosition(),0):0},setCursorOffset:e=>{const t=m.current;if(!t)return;const n=t.session.doc.indexToPosition(Math.max(0,e),0);t.selection.moveCursorTo(n.row,n.column),t.selection.clearSelection(),t.scrollToLine(n.row,!0,!1,()=>{})},focus:()=>m.current?.focus()}),[]),(0,s.useEffect)(()=>{const s=p.current;if(!s)return;const l=A.Kw.edit(s,{value:e,mode:`ace/mode/${t}`,theme:`ace/theme/${g}`,showPrintMargin:!1,highlightActiveLine:!1,fontSize:14,readOnly:a,showLineNumbers:n,showGutter:n,wrap:r,useWorker:!1,...h});return l.on("change",()=>{j.current.onChange?.(l.getValue())}),l.selection.on("changeCursor",()=>{j.current.onCursorChange?.()}),l.commands.addCommand({name:"filecat_save",bindKey:{win:"Ctrl-S",mac:"Command-S"},exec:()=>{j.current.onSave?.()},readOnly:!0}),m.current=l,()=>{l.destroy(),m.current=null}},[]),(0,x.jsx)("div",{ref:p,className:i,style:d})});var M=n(20382),T=n(63398),$=n(55921),W=n(63963);const D={json:"json",yaml:"yaml",toml:"toml",xml:"xml",properties:"properties"},V="#text",F=new $.A({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:V,parseAttributeValue:!0,parseTagValue:!0,trimValues:!0,isArray:()=>!1}),Z=new W.A({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:V,format:!0,indentBy:" ",suppressEmptyNode:!0});function E(e){return e.replace(/\\(u[0-9a-fA-F]{4}|.)/g,(e,t)=>"u"===t[0]?String.fromCharCode(parseInt(t.slice(1),16)):"n"===t?"\n":"t"===t?"\t":"r"===t?"\r":t)}function U(e){return e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}function B(e,t){if(""===e.trim())return null;if("json"===t)return JSON.parse(e);if("yaml"===t)return M.Hh(e);if("toml"===t)return(0,T.qg)(e);if("properties"===t)return function(e){const t={},n=[];let s="";for(const t of e.split(/\r?\n/)){if(""===s&&""===t.trim())continue;const e=s+t,r=e.match(/\\+$/);null!==r&&r[0].length%2==1?s=e.slice(0,-1):(n.push(e),s="")}""!==s&&n.push(s);for(const e of n){const n=e.trimStart();if(""===n||n.startsWith("#")||n.startsWith("!"))continue;let s=-1;for(let t=0;t<e.length;t++){const n=e[t];if("\\"!==n){if("="===n||":"===n){s=t;break}}else t++}const r=-1===s?e:e.slice(0,s),a=-1===s?"":e.slice(s+1),l=E(r.trim());""!==l&&(t[l]=E(a.trim()))}return t}(e);const n=F.parse(e);return n&&"object"==typeof n&&delete n["?xml"],n}function R(e,t){if("json"===t)return JSON.stringify(e,null,2);if("yaml"===t)return M.Bh(e,{indent:2,lineWidth:-1,noRefs:!0});if("toml"===t){if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error("TOML 顶层必须是对象,无法转换标量或数组");return(0,T.As)(e)}if("properties"===t)return function(e){if(null===e||"object"!=typeof e)throw new Error("Properties 顶层必须是对象,无法转换标量");const t=[],n=(e,s)=>{if(null!=e)if(Array.isArray(e))e.forEach((e,t)=>n(e,""===s?String(t):`${s}.${t}`));else if("object"!=typeof e)""!==s&&t.push(`${U(s)}=${U(String(e))}`);else for(const[t,r]of Object.entries(e))n(r,""===s?t:`${s}.${t}`)};return n(e,""),t.join("\n")}(e);if(null===e||"object"!=typeof e)throw new Error("XML 顶层必须是对象,无法转换标量");if(Array.isArray(e))throw new Error("XML 顶层必须是对象,无法转换数组");return 1===Object.keys(e).length?Z.build(e):Z.build({root:e})}const z=[{label:"JSON",value:"json"},{label:"YAML",value:"yaml"},{label:"TOML",value:"toml"},{label:"XML",value:"xml"},{label:"Properties",value:"properties"}];let L=0;function H(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)("json"),[c,h]=(0,s.useState)("yaml"),[u,p]=(0,s.useState)(""),[m,f]=(0,s.useState)(++L),[g,j]=(0,s.useState)(++L),v=(0,s.useRef)(""),b=(0,s.useRef)(""),w=(0,s.useRef)(null),C=(0,s.useRef)(null),S=e=>{v.current=e,f(++L)},N=n=>{const s=w.current?.getValue()??"";if(""!==s.trim())try{const e=function(e,t,n){return R(B(e,t),n)}(s,t,n);b.current=e,j(++L),p("")}catch(e){p(e.message)}else(0,d.zN)(e("need_input"))};return(0,x.jsxs)(r.xh,{children:[(0,x.jsx)(r.fI,{children:(0,x.jsx)(r.VP,{widthPer:100,maxWidth:"60rem",children:(0,x.jsxs)(l.Zp,{title:e("JSON 格式转换"),children:[(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)(a.l6,{options:z,value:t,width:"9em",onChange:e=>{const t=w.current?.getValue();n(e),S(void 0!==t?t:v.current)}}),(0,x.jsx)("span",{children:e("转换成")}),(0,x.jsx)(a.l6,{options:z,value:c,width:"9em",onChange:h}),(0,x.jsx)(o.C3,{text:e("转换"),clickFun:()=>N(c)}),(0,x.jsx)(o.C3,{text:e("格式化"),clickFun:()=>N(t)}),(0,x.jsx)(o.C3,{text:e("结果转到输入"),clickFun:()=>{const t=C.current?.getValue();t?(n(c),S(t)):(0,d.zN)(e("输出为空"))}})]}),""!==u&&(0,x.jsx)("div",{className:"error_tip",children:u})]})})}),(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"50rem",children:(0,x.jsx)(l.Zp,{title:e("输入")+"("+t.toUpperCase()+")",children:(0,x.jsx)(P,{ref:w,className:"toolbox-ace",value:v.current,mode:D[t],wrap:!0,onChange:()=>p("")},m)})}),(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"50rem",children:(0,x.jsx)(l.Zp,{title:e("输出")+"("+c.toUpperCase()+")",children:(0,x.jsx)(P,{ref:C,className:"toolbox-ace",value:b.current,mode:D[c],wrap:!0},g)})})]})]})}const O="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";const K=[{label:"URL",value:"url"},{label:"Base64",value:"base64"},{label:"Base32",value:"base32"},{label:"Hex",value:"hex"},{label:"Unicode",value:"unicode"},{label:"ASCII",value:"ascii"},{label:"HTML 实体",value:"html"}];function q(e,t,n=!1,s=!1){return"base64"===t?function(e){const t=(new TextEncoder).encode(e);let n="";return t.forEach(e=>n+=String.fromCharCode(e)),btoa(n)}(e):"base32"===t?function(e){const t=(new TextEncoder).encode(e);let n=0,s=0,r="";for(const e of t)for(s=s<<8|e,n+=8;n>=5;)r+=O[s>>>n-5&31],n-=5;for(n>0&&(r+=O[s<<5-n&31]);r.length%8!=0;)r+="=";return r}(e):"hex"===t?function(e,t=!1,n=!1){const s=(new TextEncoder).encode(e),r=[];return s.forEach(e=>{const n=e.toString(16).padStart(2,"0");r.push(t?n.toUpperCase():n)}),r.join(n?" ":"")}(e,n,s):"unicode"===t?function(e){let t="";for(const n of e){const e=n.codePointAt(0);if(e<128)t+=n;else if(e>65535){const n=(e-65536)%1024+56320;t+="\\u"+(Math.floor((e-65536)/1024)+55296).toString(16).padStart(4,"0"),t+="\\u"+n.toString(16).padStart(4,"0")}else t+="\\u"+e.toString(16).padStart(4,"0")}return t}(e):"url"===t?function(e,t=!0){return t?encodeURIComponent(e):encodeURI(e)}(e):"ascii"===t?function(e,t=!0){const n=(new TextEncoder).encode(e);return Array.from(n).join(t?" ":"")}(e,s):function(e){return e.replace(/[\s\S]/g,e=>{const t=e.codePointAt(0);return t>127?`&#${t};`:e})}(e)}function G(e,t){return"base64"===t?function(e){const t=atob(e.trim()),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return(new TextDecoder).decode(n)}(e):"base32"===t?function(e){const t=e.trim().replace(/=+$/,"").toUpperCase();let n=0,s=0;const r=[];for(const e of t){const t=O.indexOf(e);if(t<0)throw new Error(`非法的 Base32 字符:${e}`);s=s<<5|t,n+=5,n>=8&&(r.push(s>>>n-8&255),n-=8)}return(new TextDecoder).decode(new Uint8Array(r))}(e):"hex"===t?function(e){const t=e.replace(/[\s,]/g,"");if(t.length%2!=0)throw new Error("十六进制长度必须是偶数");if(!/^[0-9a-fA-F]*$/.test(t))throw new Error("包含非十六进制字符");const n=new Uint8Array(t.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(t.substr(2*e,2),16);return(new TextDecoder).decode(n)}(e):"unicode"===t?function(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}(e):"url"===t?function(e){return decodeURIComponent(e)}(e):"ascii"===t?function(e){const t=e.split(/[\s,]+/).filter(e=>""!==e),n=new Uint8Array(t.length);return t.forEach((e,t)=>{const s=Number(e);if(!Number.isInteger(s)||s<0||s>255)throw new Error(`非法的 ASCII 码:${e}`);n[t]=s}),(new TextDecoder).decode(n)}(e):function(e){return e.replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t))).replace(/&#x([0-9a-fA-F]+);/g,(e,t)=>String.fromCodePoint(parseInt(t,16)))}(e)}function X(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)("url"),[c,h]=(0,s.useState)(""),[u,p]=(0,s.useState)(""),[m,f]=(0,s.useState)(""),[g,j]=(0,s.useState)(!1),[v,b]=(0,s.useState)(!1),w=e=>{try{p(e()),f("")}catch(e){f(e.message)}},C="hex"===t,N="hex"===t||"ascii"===t,y=t=>(0,x.jsx)(o.rA,{icon:"content_copy",title:e("复制"),onClick:()=>{""!==t?(0,S.lW)(t):(0,d.zN)(e("内容为空"))}});return(0,x.jsx)(r.xh,{children:(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:25,maxWidth:"20rem",children:(0,x.jsxs)(l.Zp,{title:e("编解码"),children:[(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)(a.l6,{options:K,value:t,width:"10em",onChange:n}),(0,x.jsx)(o.C3,{text:e("编码"),clickFun:()=>w(()=>q(c,t,g,v))}),(0,x.jsx)(o.C3,{text:e("解码"),clickFun:()=>w(()=>G(c,t))}),(0,x.jsx)(o.C3,{text:e("结果转到输入"),clickFun:()=>{""!==u?(h(u),p("")):(0,d.zN)(e("输出为空"))}}),C&&(0,x.jsxs)("label",{className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:g,onChange:e=>j(e.target.checked)}),(0,x.jsx)("span",{children:e("大写")})]}),N&&(0,x.jsxs)("label",{className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:v,onChange:e=>b(e.target.checked)}),(0,x.jsx)("span",{children:e("空格分隔")})]})]}),""!==m&&(0,x.jsx)("div",{className:"error_tip",children:m})]})}),(0,x.jsx)(r.VP,{widthPer:37.5,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:e("输入"),rightTopCom:y(c),children:(0,x.jsx)(a.Z2,{value:c,style:{width:"100%",height:"270px"},spellCheck:!1,handleInputChange:e=>{h(e),f("")},placeholder:e("codec_in_ph")})})}),(0,x.jsx)(r.VP,{widthPer:37.5,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:e("输出"),rightTopCom:y(u),children:(0,x.jsx)(a.Z2,{value:u,style:{width:"100%",height:"270px"},spellCheck:!1,handleInputChange:e=>p(e),placeholder:e("codec_out_ph")})})})]})})}const J=[{label:"d",value:"d",desc:"分组索引"},{label:"g",value:"g",desc:"全局"},{label:"i",value:"i",desc:"忽略大小写"},{label:"m",value:"m",desc:"多行"},{label:"s",value:"s",desc:"含换行"},{label:"u",value:"u",desc:"Unicode",raw:!0},{label:"v",value:"v",desc:"Unicode 集合"},{label:"y",value:"y",desc:"粘性"}];function Y(e,t){if(0===t.length)return e;const n=[];let s=0;return t.forEach((t,r)=>{t.index>s&&n.push(e.slice(s,t.index)),""!==t.text&&n.push((0,x.jsx)("mark",{className:"regex-mark",children:t.text},r)),s=t.index+t.text.length}),s<e.length&&n.push(e.slice(s)),n}function Q(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(""),[o,c]=(0,s.useState)(""),[d,h]=(0,s.useState)("g"),u=(0,s.useMemo)(()=>function(e,t,n){if(""===e)return{matches:[],error:""};let s;try{s=new RegExp(e,t)}catch(e){return{matches:[],error:e.message}}const r=[],a=t.includes("g")||t.includes("y");let l,o=0;for(;null!==(l=s.exec(n))&&(r.push({text:l[0],index:l.index,groups:l.slice(1)}),a)&&(""===l[0]&&s.lastIndex++,!(++o>1e4)););return{matches:r,error:""}}(t,d,o),[t,d,o]);return(0,x.jsxs)(r.xh,{children:[(0,x.jsx)(r.fI,{children:(0,x.jsx)(r.VP,{widthPer:100,maxWidth:"60rem",children:(0,x.jsxs)(l.Zp,{title:e("正则表达式"),children:[(0,x.jsxs)("div",{className:"regex-input-row",children:[(0,x.jsx)("span",{className:"regex-slash",children:"/"}),(0,x.jsx)(a.Sm,{width:"100%",value:t,placeholder:e("正则表达式"),handleInputChange:e=>n(e)}),(0,x.jsx)("span",{className:"regex-slash",children:"/"}),(0,x.jsx)("span",{className:"regex-flags",children:d})]}),(0,x.jsx)("div",{className:"regex-flag-row",children:J.map(t=>(0,x.jsxs)("label",{title:t.raw?t.desc:e(t.desc),className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:d.includes(t.value),onChange:()=>{return e=t.value,void h(t=>t.includes(e)?t.replace(e,""):t+e);var e}}),(0,x.jsx)("span",{className:"regex-flag-letter",children:t.label}),(0,x.jsx)("span",{children:t.raw?t.desc:e(t.desc)})]},t.value))}),""!==u.error&&(0,x.jsx)("div",{className:"error_tip",children:u.error}),(0,x.jsxs)("div",{style:{marginTop:"0.5em"},children:[e("匹配到")," ",(0,x.jsx)("b",{children:u.matches.length})," ",e("处")]})]})})}),(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:e("测试文本"),children:(0,x.jsx)(a.Z2,{value:o,style:{width:"100%",height:"260px"},spellCheck:!1,handleInputChange:e=>c(e),placeholder:e("regex_in_ph")})})}),(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:e("高亮结果"),children:(0,x.jsx)("div",{className:"regex-preview",children:""===o?(0,x.jsx)("span",{className:"regex-empty",children:e("regex_empty")}):Y(o,u.matches)})})})]}),u.matches.length>0&&(0,x.jsx)(r.fI,{children:(0,x.jsx)(r.VP,{widthPer:100,maxWidth:"60rem",children:(0,x.jsx)(l.Zp,{title:e("匹配详情"),children:(0,x.jsx)("div",{className:"regex-match-list",children:u.matches.map((t,n)=>(0,x.jsxs)("div",{className:"regex-match-item",children:[(0,x.jsxs)("span",{className:"regex-match-index",children:["#",n+1]}),(0,x.jsx)("span",{className:"regex-match-text",children:""===t.text?e("空"):t.text}),(0,x.jsxs)("span",{className:"regex-match-pos",children:[e("位置")," ",t.index]}),t.groups.length>0&&(0,x.jsx)("span",{className:"regex-match-groups",children:t.groups.map((t,n)=>(0,x.jsxs)("span",{className:"regex-group",children:["$",n+1,"=",t??e("未匹配")]},n))})]},n))})})})})]})}function ee(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(String(Math.floor(Date.now()/1e3))),[r,c]=(0,s.useState)(""),h=function(e){const t=Number(e.trim());return!Number.isFinite(t)||t<=0?null:new Date(t<1e11?1e3*t:t)}(t),u=new Date,p=h?function(e){const t=e=>String(e).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}(h):e("无效时间戳");return(0,x.jsxs)(l.Zp,{title:e("时间转换"),children:[(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)("span",{className:"toolbox-label",children:e("时间戳")}),(0,x.jsx)(a.Sm,{width:"14em",value:t,placeholder:e("秒或毫秒"),handleInputChange:n}),(0,x.jsx)(o.C3,{text:e("现在"),clickFun:()=>n(String(Math.floor(Date.now()/1e3)))})]}),(0,x.jsxs)("div",{className:"toolbox-kv",children:[(0,x.jsx)("span",{children:e("秒级")}),(0,x.jsx)("span",{className:"toolbox-mono",children:h?Math.floor(h.getTime()/1e3):"-"}),(0,x.jsx)("span",{children:e("毫秒级")}),(0,x.jsx)("span",{className:"toolbox-mono",children:h?h.getTime():"-"}),(0,x.jsx)("span",{children:e("本地时间")}),(0,x.jsx)("span",{className:"toolbox-mono",children:p}),(0,x.jsx)("span",{children:"ISO 8601"}),(0,x.jsx)("span",{className:"toolbox-mono",children:h?h.toISOString():"-"}),(0,x.jsx)("span",{children:e("UTC 时间")}),(0,x.jsx)("span",{className:"toolbox-mono",children:h?h.toUTCString():"-"}),(0,x.jsx)("span",{children:e("距现在")}),(0,x.jsx)("span",{className:"toolbox-mono",children:h?te(h.getTime()-u.getTime(),e):"-"})]}),(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",marginTop:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)("span",{className:"toolbox-label",children:e("日期")}),(0,x.jsx)(a.Sm,{width:"14em",value:r,placeholder:"2024-01-01 12:00:00",handleInputChange:c}),(0,x.jsx)(o.C3,{text:e("转时间戳"),clickFun:()=>{const t=new Date(r.trim().replace(" ","T"));isNaN(t.getTime())?(0,d.zN)(e("date_invalid")):n(String(Math.floor(t.getTime()/1e3)))}})]})]})}function te(e,t){const n=Math.abs(e),s=e>0,r=[[864e5,t("天")],[36e5,t("小时")],[6e4,t("分钟")],[1e3,t("秒")]];for(const[e,a]of r)if(n>=e){const r=Math.floor(n/e);return`${t(s?"还有":"已过去")} ${r} ${a}`}return t("刚刚")}function ne(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)("255"),[r,o]=(0,s.useState)("10"),c=[{label:"2 "+e("进制"),value:"2"},{label:"8 "+e("进制"),value:"8"},{label:"10 "+e("进制"),value:"10"},{label:"16 "+e("进制"),value:"16"},{label:"36 "+e("进制"),value:"36"}];let d=NaN;try{const e=t.trim().toLowerCase().replace(/^0x/,"");d="10"===r?Number(e):parseInt(e,Number(r))}catch(e){d=NaN}const h=[];return Number.isFinite(d)&&(h.push({label:"2 "+e("进制"),v:d.toString(2)}),h.push({label:"8 "+e("进制"),v:d.toString(8)}),h.push({label:"10 "+e("进制"),v:d.toString(10)}),h.push({label:"16 "+e("进制"),v:d.toString(16).toUpperCase()}),h.push({label:"36 "+e("进制"),v:d.toString(36).toUpperCase()}),h.push({label:e("字节"),v:se(d,e)})),(0,x.jsxs)(l.Zp,{title:e("进制转换"),children:[(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)(a.Sm,{width:"14em",value:t,placeholder:e("输入数值"),handleInputChange:e=>n(e)}),(0,x.jsx)(a.l6,{options:c,value:r,width:"8em",onChange:o})]}),Number.isFinite(d)?(0,x.jsx)("div",{className:"toolbox-kv",children:h.map(e=>(0,x.jsxs)(s.Fragment,{children:[(0,x.jsx)("span",{children:e.label}),(0,x.jsx)("span",{className:"toolbox-mono",children:e.v})]},e.label))}):(0,x.jsx)("div",{className:"error_tip",children:e("num_invalid")})]})}function se(e,t){if(e<0||!Number.isInteger(e))return"-";const n=Math.max(8,8*Math.ceil(e.toString(2).length/8));return`${n/8} ${t("字节")} (${n} ${t("位")})`}function re(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)("#4a90d9"),r=function(e){const t=e.trim().replace(/^#/,"");return/^[0-9a-fA-F]{3}$/.test(t)?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)}:/^[0-9a-fA-F]{6}$/.test(t)?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16)}:null}(t),c=r?function(e,t,n){const s=e/255,r=t/255,a=n/255,l=Math.max(s,r,a),o=Math.min(s,r,a),c=(l+o)/2;if(l===o)return{h:0,s:0,l:Math.round(100*c)};const i=l-o,d=c>.5?i/(2-l-o):i/(l+o);let h=0;return h=l===s?((r-a)/i+(r<a?6:0))/6:l===r?((a-s)/i+2)/6:((s-r)/i+4)/6,{h:Math.round(360*h),s:Math.round(100*d),l:Math.round(100*c)}}(r.r,r.g,r.b):null;return(0,x.jsxs)(l.Zp,{title:e("颜色转换"),children:[(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)("input",{type:"color",className:"toolbox-color-picker",value:r?ae(r.r,r.g,r.b):"#000000",onChange:e=>n(e.target.value)}),(0,x.jsx)(a.Sm,{width:"12em",value:t,placeholder:"#4a90d9",handleInputChange:n}),(0,x.jsx)(o.rA,{icon:"content_copy",title:e("复制颜色"),onClick:()=>{r?(0,S.lW)(ae(r.r,r.g,r.b)):(0,d.zN)(e("颜色格式无效"))}})]}),r&&c?(0,x.jsxs)("div",{className:"toolbox-kv",children:[(0,x.jsx)("span",{children:"HEX"}),(0,x.jsx)("span",{className:"toolbox-mono",children:ae(r.r,r.g,r.b).toUpperCase()}),(0,x.jsx)("span",{children:"RGB"}),(0,x.jsxs)("span",{className:"toolbox-mono",children:["rgb(",r.r,", ",r.g,", ",r.b,")"]}),(0,x.jsx)("span",{children:"RGBA"}),(0,x.jsxs)("span",{className:"toolbox-mono",children:["rgba(",r.r,", ",r.g,", ",r.b,", 1)"]}),(0,x.jsx)("span",{children:"HSL"}),(0,x.jsxs)("span",{className:"toolbox-mono",children:["hsl(",c.h,", ",c.s,"%, ",c.l,"%)"]})]}):(0,x.jsx)("div",{className:"error_tip",children:e("color_invalid")})]})}function ae(e,t,n){const s=e=>e.toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(n)}`}const le="0123456789abcdef";function oe(){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t="";return e.forEach(e=>t+=le[e>>4]+le[15&e]),`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}const ce="abcdefghijklmnopqrstuvwxyz",ie="ABCDEFGHIJKLMNOPQRSTUVWXYZ",de="0123456789",he="!@#$%^&*()-_=+[]{};:,.<>?";function ue(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(()=>[oe(),oe(),oe()]),[r,c]=(0,s.useState)("16"),[h,u]=(0,s.useState)(!0),[p,m]=(0,s.useState)(!0),[f,g]=(0,s.useState)(!0),[j,v]=(0,s.useState)(!1),[b,w]=(0,s.useState)("");return(0,x.jsxs)(l.Zp,{title:e("UUID / 随机密码"),children:[(0,x.jsx)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",flexWrap:"wrap"},children:(0,x.jsx)(o.C3,{text:e("生成 UUID"),clickFun:()=>n([oe(),oe(),oe()])})}),(0,x.jsx)("div",{className:"toolbox-kv",children:t.map((t,n)=>(0,x.jsxs)(s.Fragment,{children:[(0,x.jsxs)("span",{children:["UUID ",n+1]}),(0,x.jsx)("span",{className:"toolbox-mono toolbox-copyable",onClick:()=>(0,S.lW)(t),title:e("点击复制"),children:t})]},n))}),(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",marginTop:"0.75em",flexWrap:"wrap"},children:[(0,x.jsx)("span",{className:"toolbox-label",children:e("长度")}),(0,x.jsx)(a.Sm,{width:"5em",value:r,handleInputChange:c}),(0,x.jsxs)("label",{className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:h,onChange:e=>u(e.target.checked)}),(0,x.jsx)("span",{children:"a-z"})]}),(0,x.jsxs)("label",{className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:p,onChange:e=>m(e.target.checked)}),(0,x.jsx)("span",{children:"A-Z"})]}),(0,x.jsxs)("label",{className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:f,onChange:e=>g(e.target.checked)}),(0,x.jsx)("span",{children:"0-9"})]}),(0,x.jsxs)("label",{className:"toolbox-check",children:[(0,x.jsx)("input",{type:"checkbox",checked:j,onChange:e=>v(e.target.checked)}),(0,x.jsx)("span",{children:e("符号")})]}),(0,x.jsx)(o.C3,{text:e("生成密码"),clickFun:()=>{let t="";if(h&&(t+=ce),p&&(t+=ie),f&&(t+=de),j&&(t+=he),""===t)return void(0,d.zN)(e("pw_need_set"));const n=Math.max(1,Math.min(256,Number(r)||16)),s=new Uint32Array(n);crypto.getRandomValues(s);let a="";for(let e=0;e<n;e++)a+=t[s[e]%t.length];w(a)}})]}),""!==b&&(0,x.jsxs)("div",{className:"toolbox-kv",children:[(0,x.jsx)("span",{children:e("密码")}),(0,x.jsx)("span",{className:"toolbox-mono toolbox-copyable",onClick:()=>(0,S.lW)(b),title:e("点击复制"),children:b})]})]})}function xe(){return(0,x.jsx)(r.xh,{children:(0,x.jsxs)(r.fI,{children:[(0,x.jsxs)(r.VP,{widthPer:50,maxWidth:"30rem",children:[(0,x.jsx)(ee,{}),(0,x.jsx)(ue,{})]}),(0,x.jsxs)(r.VP,{widthPer:50,maxWidth:"30rem",children:[(0,x.jsx)(ne,{}),(0,x.jsx)(re,{})]})]})})}var pe=n(87583);const me=[{label:"L (7%)",value:"L"},{label:"M (15%)",value:"M"},{label:"Q (25%)",value:"Q"},{label:"H (30%)",value:"H"}];function fe(){const{t:e}=(0,i.Bd)(),t=(0,s.useRef)(null),[n,c]=(0,s.useState)(""),[h,u]=(0,s.useState)("320"),[p,m]=(0,s.useState)("M"),[f,g]=(0,s.useState)("");(0,s.useEffect)(()=>{const e=t.current;if(!e)return;if(""===n){const t=e.getContext("2d");return t?.clearRect(0,0,e.width,e.height),void g("")}const s=Math.max(80,Math.min(2048,Number(h)||320));pe.toCanvas(e,n,{width:s,margin:2,errorCorrectionLevel:p}).then(()=>g("")).catch(e=>{g(e.message)})},[n,h,p]);const j=()=>{const s=t.current;if(!s||""===n)return void(0,d.zN)(e("qr_none"));const r=s.toDataURL("image/png"),a=document.createElement("a");a.href=r,a.download="qrcode.png",a.click()};return(0,x.jsx)(r.xh,{children:(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"30rem",children:(0,x.jsxs)(l.Zp,{title:e("二维码生成"),children:[(0,x.jsx)(a.Z2,{value:n,style:{width:"100%",height:"200px"},spellCheck:!1,handleInputChange:e=>c(e),placeholder:e("qr_in_ph")}),(0,x.jsxs)("div",{className:"div-row",style:{alignItems:"center",gap:"0.5em",marginTop:"0.5em",flexWrap:"wrap"},children:[(0,x.jsx)("span",{className:"toolbox-label",children:e("尺寸")}),(0,x.jsx)(a.Sm,{width:"6em",value:h,handleInputChange:e=>u(e)}),(0,x.jsx)("span",{className:"toolbox-label",children:e("纠错级别")}),(0,x.jsx)("select",{className:"toolbox-select",value:p,onChange:e=>m(e.target.value),children:me.map(e=>(0,x.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,x.jsx)(o.C3,{text:e("下载 PNG"),clickFun:j})]}),""!==f&&(0,x.jsx)("div",{className:"error_tip",children:f})]})}),(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"30rem",children:(0,x.jsx)(l.Zp,{title:e("预览"),rightTopCom:(0,x.jsx)(o.rA,{icon:"download",title:e("下载"),onClick:j}),children:(0,x.jsxs)("div",{className:"toolbox-qr-preview",children:[(0,x.jsx)("canvas",{ref:t,style:{display:""===n?"none":"block"}}),""===n&&(0,x.jsx)("span",{className:"toolbox-empty",children:e("qr_empty")})]})})})]})})}var ge=n(20734);function je(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(""),[o,c]=(0,s.useState)(""),d=""!==t||""!==o;return(0,x.jsxs)(r.xh,{children:[(0,x.jsxs)(r.fI,{children:[(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"50rem",children:(0,x.jsx)(l.Zp,{title:e("原文本"),children:(0,x.jsx)(a.Z2,{value:t,style:{width:"100%",height:"200px"},spellCheck:!1,handleInputChange:e=>n(e),placeholder:e("粘贴原文本")})})}),(0,x.jsx)(r.VP,{widthPer:50,maxWidth:"50rem",children:(0,x.jsx)(l.Zp,{title:e("新文本"),children:(0,x.jsx)(a.Z2,{value:o,style:{width:"100%",height:"200px"},spellCheck:!1,handleInputChange:e=>c(e),placeholder:e("粘贴新文本")})})})]}),(0,x.jsx)(r.fI,{children:(0,x.jsx)(r.VP,{widthPer:100,maxWidth:"100rem",children:(0,x.jsx)(l.Zp,{title:e("差异"),children:(0,x.jsx)("div",{className:"text-diff-box",children:d?(0,x.jsx)(ge.A,{valueA:t,valueB:o,mode:"split"}):(0,x.jsx)("div",{className:"text-diff-empty",children:e("输入文本后这里显示差异")})})})})})]})}var ve=n(87361);function be(e){const{t}=(0,i.Bd)(),{check_user_auth:n}=(0,g.MH)(),s=[];return s.push({index:1,name:t("开发者工具"),rto:"developer/",component:(0,x.jsx)(xe,{})},{index:1,name:t("时间工具"),rto:"timeutil/",component:(0,x.jsx)(p,{})},{index:1,name:t("JSON 格式转换"),rto:"format/",component:(0,x.jsx)(H,{})},{index:1,name:t("编解码"),rto:"codec/",component:(0,x.jsx)(X,{})},{index:1,name:t("正则测试"),rto:"regex/",component:(0,x.jsx)(Q,{})},{index:1,name:t("文本对比"),rto:"diff/",component:(0,x.jsx)(je,{})},{index:1,name:t("二维码"),rto:"qrcode/",component:(0,x.jsx)(fe,{})},{index:1,name:t("非对称密钥"),rto:"crypto/",component:(0,x.jsx)(y,{})}),n(j.oV.port_scan)&&s.push({index:1,name:t("端口扫描"),rto:"portscan/",component:(0,x.jsx)(I,{})}),n(j.oV.wol_proxy)&&s.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,x.jsx)(v,{})}),(0,x.jsx)(r.W1,{optionList:s,father_route:ve.o.toolbox})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3659],{22081(e,n,t){var s=t(96540),r=t(16349),a=t(74848);const i=({percentage:e})=>{const n=(0,s.useRef)(null),[t,i]=(0,s.useState)(null);return(0,s.useEffect)(()=>{const t=n.current.getContext("2d"),s=new r.Ay(t,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return i(s),()=>{s.destroy()}},[]),(0,s.useEffect)(()=>{t&&(t.data.datasets[0].data=[e,100-e],t.update())},[e]),(0,a.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,a.jsx)("canvas",{ref:n})})};t.d(n,["A",0,i])},77481(e,n,t){t.d(n,{S:()=>o,X:()=>i});var s=t(96540),r=t(61443),a=t(74848);function i(e){const[n,t]=s.useState([]),i=(0,s.useRef)(-1),[o,l]=(0,s.useState)(-1),[d,c]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]);const u=()=>{i.current=-1,l(-1),c(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let i=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(i=`${n} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):n},t)})})}),(0,a.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(o===t?"row-dragging":"")+(d===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(i.current=t,l(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=i.current,t=d;u(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:u,children:n.map((t,s)=>{const r=s===n.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,a.jsx)("div",{children:e},n))})}},88062(e,n,t){t(96540),t(32768);var s=t(74848);function r(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const a=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(r,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,t)=>(0,s.jsx)(a,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})]}),i=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,t)=>(0,s.jsx)(a,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})});t.d(n,["A",0,i])},63659(e,n,t){t.r(n),t.d(n,{default:()=>N});var s=t(22022),r=t(96540),a=t(34843),i=t(82893),o=t(92275),l=t(14944),d=(t(14284),t(70447)),c=t(85997),u=t(62042),x=t(4412),h=t(75725),p=(t(22081),t(77481)),f=t(61443),j=t(47071),m=t(99214),g=t(88062),v=t(97856),w=t(88815),_=t(15629),b=t(74848);const k=r.lazy(()=>t.e(3233).then(t.bind(t,85614)));let y,C,S=-1;function N(e){const{t:n}=(0,s.Bd)(),t=(0,m.Du)(),[N,M]=(0,a.fp)(i.AG.workflow_show),[A,D]=(0,r.useState)([]),[E,F]=(0,r.useState)([]),[W,$]=(0,r.useState)(!1),[P,q]=(0,r.useState)(void 0),[z,B]=(0,r.useState)([]),[I,J]=(0,r.useState)(-1),[O,R]=(0,r.useState)(10),[T,H]=(0,r.useState)(0),[K,X]=(0,r.useState)(0),[Z,V]=(0,r.useState)(""),[Y,G]=(0,r.useState)(!1),L=[n("序号"),n("运行名称"),n("状态"),n("运行时长"),n("日期"),n("操作")],Q=[n("名称"),n("状态"),n("cwd"),n("运行时长"),n("操作")],U=async e=>{const n=new j._;n.page_num=e??I,n.page_size=O,n.dir_path=t;const s=await l.ws.sendData(o.HK.workflow_get,n);if(!s)return;const r=s.context;r&&(D(r.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),H(r.total),X((0,w.gw)(r.total,O)))};(0,r.useEffect)(()=>($(!1),y=void 0,C=void 0,S=-1,U(),async()=>{C&&(C.dispose(),C=null)}),[]);const ee=async e=>{const n=e.steps,t=[];(0,_.Y)(t,n??[]),B(t)},ne=async e=>{C||await new Promise(e=>{y=e,$(!0),(async()=>{const e=new v.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});C=e,q(e)})()}),e&&(C.reset(),C.write(e))};return(0,b.jsxs)("div",{children:[(0,b.jsxs)(x.aZ,{position:"right",children:[P&&(0,b.jsx)(c.rA,{icon:"print",title:"打印日志",onClick:()=>{$(!W)}}),(0,b.jsx)(c.rA,{icon:"close",title:n("关闭"),onClick:()=>{M(!1)}})]}),(0,b.jsx)(h.jW,{isFull:!0,more:!0,children:(0,b.jsx)(h.NN,{children:(0,b.jsx)(h.xh,{children:(0,b.jsxs)(h.fI,{children:[(0,b.jsx)(h.VP,{children:(0,b.jsx)(d.uF,{self_title:(0,b.jsx)("span",{className:" div-row ",children:(0,b.jsx)("h2",{children:n("历史记录")})}),rightTopCom:(0,b.jsx)("div",{className:" div-row ",children:(0,b.jsx)(f.Sm,{disabled:Y,value:Z,placeholder:"搜索运行名称(支持正则)",handleInputChange:e=>{V(Z)},handlerEnter:e=>{(async e=>{const n=new j._;n.search_name=e,n.dir_path=t,G(!0);const s=await l.ws.sendData(o.HK.workflow_search_by_run_name,n);if(!s)return;const r=s.context;D(r.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),H(r.total),X((0,w.gw)(r.total,O)),J(0),G(!1)})(e)}})}),rightBottomCom:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsxs)("span",{children:[Math.abs(I),"/",K]}),(0,b.jsx)(f.Sm,{placeholder:`max page ${K}`,handleInputChange:e=>{S=parseInt(e)},handlerEnter:()=>{if(S<1||S>K)return void(0,u.zN)("illegal page num");const e=0-S;J(e),U(e)}}),(0,b.jsx)(c.rA,{icon:"navigate_before",onClick:()=>{const e=I+1;e>-1?(0,u.zN)("max page num"):(J(e),U(e))},title:"上一页"}),(0,b.jsx)(c.rA,{icon:"navigate_next",onClick:()=>{const e=I-1;Math.abs(e)>K?(0,u.zN)("min page num"):(J(e),U(e))},title:"下一页"})]}),children:(0,b.jsx)(p.X,{headers:L,rows:A.map((e,s)=>{let r;r=e.is_running?(0,b.jsxs)("div",{children:[(0,b.jsx)(d.fq,{}),n("正在运行")]}):(0,b.jsxs)("div",{children:[(0,b.jsx)(d.fq,{success:e.is_success}),e.is_success?n("成功"):n("失败")]});const a=[(0,b.jsx)("p",{children:e.index}),(0,b.jsx)("p",{style:{wordWrap:"break-word"},children:e["run-name"]}),r,(0,b.jsx)("span",{children:e.duration}),(0,b.jsx)("span",{children:e.timestamp}),(0,b.jsx)("div",{children:(0,b.jsx)(c.rA,{icon:"details",title:n("详情"),onClick:()=>{(async e=>{if(e.is_running)return;B([]);const n=new j._;n.index=e.index,n.dir_path=t;const s=(await l.ws.sendData(o.HK.workflow_get,n)).context,r="string"==typeof s.one_data.data?JSON.parse(s.one_data.data):s.one_data.data;F(r.all_jobs)})(e)}})})];return a}),width:"10rem"})})}),(0,b.jsxs)(h.VP,{children:[(0,b.jsx)(d.Zp,{title:n("Job"),children:(0,b.jsx)(p.X,{headers:Q,rows:E.map((e,t)=>[(0,b.jsx)("p",{children:e.name}),(0,b.jsx)(_.W,{item:e}),(0,b.jsx)(d.xP,{children:String(e.cwd)}),(0,b.jsx)("span",{children:e.duration}),(0,b.jsxs)("div",{children:[(0,b.jsx)(c.rA,{icon:"details",title:n("详情"),onClick:()=>{ee(e)}}),!!e.message&&(0,b.jsx)(c.rA,{icon:"print",title:n("日志"),onClick:()=>{ne(e.message)}})]})]),width:"10rem"})}),(0,b.jsx)(d.Zp,{title:"Step",children:(0,b.jsx)(g.A,{list:z,click:e=>{(async e=>{if(e?.extra_data?.is_job)await ee(e.extra_data.job_data);else if(e?.extra_data?.context)ne(e.extra_data.context);else{if(!e?.extra_data.code)return;ne(e.extra_data.code??"")}})(e)}})})]})]})})})}),(0,b.jsx)("div",{style:{display:W?"":"none"},children:(0,b.jsx)(k,{show:!0,terminal:P,init:()=>{y&&(y(1),y=void 0)}})})]})}},15629(e,n,t){t.d(n,{W:()=>o});t(96540);var s=t(70447),r=t(47071),a=t(22022),i=t(74848);function o({item:e}){const{t:n}=(0,a.Bd)();let t,o;return null!=e.code?t=0===e.code:e.extra_data?.running_type===r.rl.running&&(o=!0),(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:t,running:o}),n(t?"成功":"失败")]})}const l=(e,n,t)=>{if(n)for(const t of n??[]){let n;const r=[];t["use-yml"]?(l(r,void 0,t.use_job_children_list),n=`${t["use-yml"]} ;${t.duration??-1}`):t.runs?n=JSON.stringify(t.runs):t.run?n=t.run:t["run-js"]?n=t["run-js"]:t.sleep&&(n=`sleep ${t.sleep}`),n=(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:void 0===t.code?void 0:0===t.code})," ",n+" ;"+(t.duration??"")]}),e.push({name:n,children:r,extra_data:{code:t.code,context:t.message}})}else if(t)for(const n of t??[]){const t=(0,i.jsxs)("div",{children:[(0,i.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:t,extra_data:{code:n.code,is_job:!0,job_data:n}})}};t.d(n,["Y",0,l])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6247],{77481(e,t,n){n.d(t,{S:()=>i,X:()=>s});var r=n(96540),o=n(61443),l=n(74848);function s(e){const[t,n]=r.useState([]),s=(0,r.useRef)(-1),[i,a]=(0,r.useState)(-1),[c,d]=(0,r.useState)(-1);(0,r.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{s.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>{const r=!!e.filter&&(e.filter.column??0)===n;let s=t;if(r){const n=e.filter,r=n.options.find(e=>e.value===n.value);null!=n.value&&r&&(s=`${t} (${r.label})`)}return(0,l.jsx)("th",{className:r?"table-filter-col":"",children:r?(0,l.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:s}):t},n)})})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const r=!!e.onRowDrag;return(0,l.jsx)("tr",{className:r?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:r,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{r&&(s.current=n,a(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!r||s.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{r&&(t.preventDefault(),(()=>{const t=s.current,n=c;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,r)=>{const o=r===t.length-1?"small":"";return(0,l.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},r)})},n)})})]})}function i(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},66247(e,t,n){n.r(t),n.d(t,{default:()=>C});var r=n(96540),o=n(75725),l=n(70447),s=n(85997),i=n(77481),a=n(61443),c=n(22022),d=n(14284),h=n(53459),u=n(62042),f=n(87361),x=n(40505),p=n(4412),j=n(61973),m=n(34843),_=n(82893),w=n(21469),v=n(21499),g=n(64694),b=n(74848);function C(){const{t:e,i18n:t}=(0,c.Bd)(),n=(0,j.Zp)(),C=[e("编号"),e("路径"),e("过期小时"),e("token"),e("备注"),e("剩余时间(h)"),e("下载次数")],[k,S]=(0,r.useState)([]),[y,A]=(0,m.fp)(_.AG.prompt_card),D=async()=>{const e=await d.XO.get("get_share_file_list");if(e.code===h.m.Success){const t=e.data??[],n=Date.now();for(const e of t)try{if(null!=e.left_hour&&e.left_hour>0){const t=n-e.time_stamp,r=36e5*e.left_hour-t;e.show_left_hour=parseFloat((r/36e5).toFixed(2))}else e.show_left_hour=e.left_hour}catch(e){}S(t)}};(0,r.useEffect)(()=>{D()},[]);return(0,b.jsxs)("div",{className:"common-box ",style:{overflowY:"auto"},children:[(0,b.jsx)(p.aZ,{position:"right",children:(0,b.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{n(-1)}})}),(0,b.jsx)(o.J,{widthPer:100,maxWidth:"60rem",children:(0,b.jsx)(l.uF,{self_title:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsx)("h2",{children:e("文件分享列表")}),(0,b.jsx)(s.rA,{icon:"info",title:e("提示"),onClick:()=>{let e=(0,b.jsx)("div",{children:"小时设置为-1或者不设置就没有过期时间"});A({open:!0,title:"信息",context_div:(0,b.jsx)("div",{children:e})})}})]}),rightTopCom:(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"add",title:e("添加"),onClick:()=>{S([...k,{note:"",path:""}])}}),(0,b.jsx)(s.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("set_share_file_list",k)).code===h.m.Success&&((0,u.SK)(e("保存成功")),D())}})]}),children:(0,b.jsx)(i.X,{headers:C,onRowDrag:(e,t)=>{S((0,g.TI)(k,e,t))},rows:k.map((t,n)=>{const r=[(0,b.jsx)("div",{children:n}),(0,b.jsx)(a.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.left_hour,handleInputChange:e=>{t.left_hour=parseFloat(e),t.time_stamp=Date.now()},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.token,handleInputChange:e=>{t.token=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,b.jsx)("p",{children:t.show_left_hour}),(0,b.jsx)("p",{children:t.download_num}),(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),S([...k])})(n)}),t.id&&(0,b.jsx)(s.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);(0,x.lW)(e),(0,u.SK)(e)}}),t.id&&(0,b.jsx)(s.rA,{icon:"open_in_new",title:e("打开新页面"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);window.open(e)}})]})];return r}),width:"10rem"})})})]})}}}]);
|