filecat 7.19.4 → 7.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/dist/{1075.5bb46386465b67572742.js → 1075.f34567d9a6631935577b.js} +1 -1
- package/build/dist/1636.2be7829caf415f5ac3ef.js +1 -0
- package/build/dist/2547.a3ebdfe9fb7f9f108b42.js +1 -0
- package/build/dist/2674.baeefe07825285fe57c2.js +1 -0
- package/build/dist/{3402.b6dc28d2f9bace7cde85.js → 3402.30e70a3fe5d2c355bae5.js} +1 -1
- package/build/dist/3528.927c03ef653c2814bb99.js +1 -0
- package/build/dist/3659.7fa7d8207206eed8369c.js +1 -0
- package/build/dist/4903.a4194ec784a0ff517e93.js +1 -0
- package/build/dist/4935.9a2e3cdca4bf73f94195.js +1 -0
- package/build/dist/{621.9b9a5312624393359a06.js → 621.cd64e24a79a49069f8db.js} +1 -1
- package/build/dist/6404.a22a232695feabc4ced4.js +1 -0
- package/build/dist/6805.0b520886329433755a49.js +1 -0
- package/build/dist/7181.99755de29517a9f425ee.js +1 -0
- package/build/dist/735.604edd65d99569268b60.js +1 -0
- package/build/dist/8358.733904ad1949e2b279d2.js +1 -0
- package/build/dist/9299.b7c5cf19d416a6a020b8.js +1 -0
- package/build/dist/9546.daf11613208aa3723c43.js +1 -0
- package/build/dist/9857.f84b299465579d7dd3ce.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.962cd9c07f68fe36c533.js +2 -0
- package/build/dist/{main.c6275d45aa40388c2a6e.js.LICENSE.txt → main.962cd9c07f68fe36c533.js.LICENSE.txt} +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1636.b80b1883358e132d3424.js +0 -1
- package/build/dist/2626.3bcfe1f26d9cb796a925.js +0 -1
- package/build/dist/2674.9825c584f48653978e35.js +0 -1
- package/build/dist/3528.55d2faabf2edbde62652.js +0 -1
- package/build/dist/3659.6295cbd36d76000c23ab.js +0 -1
- package/build/dist/4903.cac82807407e7342b5ad.js +0 -1
- package/build/dist/4935.fe24d47c4075780c9c11.js +0 -1
- package/build/dist/4946.d578f6ba367a742d80bf.js +0 -2
- package/build/dist/4946.d578f6ba367a742d80bf.js.LICENSE.txt +0 -1
- package/build/dist/6010.5400c344149450c83284.js +0 -1
- package/build/dist/6104.b286dc9e43e5b85f3181.js +0 -1
- package/build/dist/6404.288a0ac8b516b5420a33.js +0 -1
- package/build/dist/6805.08bb228068e30b062a14.js +0 -1
- package/build/dist/7181.4a2a55b9951c128ed625.js +0 -1
- package/build/dist/735.fbde74013a5afe5e8ffe.js +0 -1
- package/build/dist/8302.2abcf81d682a064d4265.js +0 -1
- package/build/dist/8358.ec38a2d61360d90c0df7.js +0 -1
- package/build/dist/892.7c2341cc1d38845fceb9.js +0 -1
- package/build/dist/9299.1106d83fb5af65fee252.js +0 -1
- package/build/dist/9334.d3102e0ed30ae564f506.js +0 -1
- package/build/dist/9546.badfa0110de4ce7e211c.js +0 -1
- package/build/dist/main.c6275d45aa40388c2a6e.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8358],{77481(e,t,s){s.d(t,{S:()=>a,X:()=>o});var n=s(96540),i=s(61443),l=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[a,r]=(0,n.useState)(-1),[d,c]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const u=()=>{o.current=-1,r(-1),c(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let o=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(o=`${t} (${n.label})`)}return(0,l.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:o}):t},s)})})}),(0,l.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,l.jsx)("tr",{className:n?(a===s?"row-dragging":"")+(d===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||o.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=o.current,s=d;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function a(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))})}},88358(e,t,s){s.r(t),s.d(t,{default:()=>_e});var n=s(96540),i=s(75725),l=s(23430),o=s(70447),a=s(85997),r=s(61443),d=s(14284),c=s(53459),u=s(77481),h=s(22022),p=s(82893),m=s(40505),_=s(62042),x=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,h.Bd)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,f.jsx)(a.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(u.X,{headers:e.headers,rows:s.map((n,i)=>{const o=[];for(let t=0;t<e.headers.length;t++)o.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return o.push((0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,f.jsx)(a.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,m.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(a.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),o}),width:"10rem",onRowDrag:(e,t)=>{l((0,v.TI)(s,e,t))}})})})}var y=s(34843),w=s(78247),b=s(24659);function S(){const{t:e}=(0,h.Bd)(),[t,s]=(0,y.fp)(p.AG.prompt_card),l=(0,b.K)(),g=[e("路由"),e("auth"),e("备注")],[S,C]=(0,y.fp)(p.AG.editorSetting),[k,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("api/customer_router");e.code===c.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...k])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("api/customer_router/save",k)).code===c.m.Success&&(0,_.SK)("保存成功")}})]}),children:(0,f.jsx)(u.X,{headers:g,rows:k.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...k])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...k])},options:l,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...k])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),A([...k])})(s)}),(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,_.zN)("路由不能为空");const t=await d.XO.get(`jscode/${encodeURIComponent(e.router)}`);C({model:"ace/mode/javascript",open:!0,fileName:e.router,save:async t=>{const s={context:t,router:e.router};(await d.XO.post("jscode/save",s)).code===c.m.Success&&(w.xK.set_value_temp(""),C({open:!1,model:"",fileName:"",save:null}),(0,_.SK)("成功"))}}),w.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(a.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,m.lW)((0,x.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(k,e,t))}})})})}var C=s(23496),k=s(4412);function A(){const{t:e}=(0,h.Bd)(),[t,s]=(0,y.fp)(p.AG.prompt_card),[l,o]=(0,y.fp)(p.AG.router_jump),a=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(k.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:a,getItems:async()=>{const e=await d.XO.get(C.s.setting_customer_router);if(e.code===c.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,_.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],o({})}return e.data}return[]},save:async e=>{(await d.XO.post(C.s.setting_customer_router_save,e)).code===c.m.Success&&(0,_.SK)("success")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})},need_copy:!0}),(0,f.jsx)(g,{title:e("wf_rt"),headers:r,getItems:async()=>{const e=await d.XO.get(C.s.setting_customer_workflow_router);return e.code===c.m.Success?e.data:[]},save:async e=>{(await d.XO.post(C.s.setting_customer_workflow_router_save,e)).code===c.m.Success&&(0,_.SK)("保存成功")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})}})]}),(0,f.jsx)(i.VP,{maxWidth:"50rem",children:(0,f.jsx)(S,{})})]})]})}var I=s(74777),N=s(18840),V=s(6960),$=s(7523);function X(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,w.MH)(),[s,i]=(0,n.useState)(!1),[u,m]=(0,n.useState)("https://registry.npmjs.org"),[x,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[b,S]=(0,n.useState)(!1),[C,k]=(0,y.fp)(p.AG.prompt_card);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("auto_upgrade_setting");if(e.code===c.m.Success){const t=e.data;i(t.open||!1),m(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(l.oV.sys_setting_page)?(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{k({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("保存"),clickFun:async()=>{if(!u)return void(0,_.zN)(e("ver_req"));if(s&&(!v||v<10))return void(0,_.zN)(e("chk_10s"));const t=new I.Mm;t.open=s,t.version_check_url=u,t.exe_download_url=x,t.check_interval_seconds=v;(await d.XO.post("auto_upgrade_setting/save",t)).code===c.m.Success&&(0,_.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("ver_url")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:u,handleInputChange:e=>{m(e)}}),(0,f.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,f.jsxs)(f.Fragment,{children:[!1,(0,f.jsx)("div",{children:e("检测频率(秒)")}),(0,f.jsx)(r.Sm,{placeholder:e("def_180"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(a.C3,{text:e(b?"升级检测中...":"立即升级"),clickFun:async()=>{S(!0);try{(await d.XO.post("auto_upgrade_setting/upgrade_now",{})).code===c.m.Success&&(0,_.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,_.zN)(e("触发升级失败"))}finally{S(!1)}}})})]})]}):null}function F(){const{t:e}=(0,h.Bd)(),[,t]=(0,y.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)(""),[l,m]=(0,n.useState)(5610),[x,j]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){const t=e.data?.sys_env;i((t?.browser_proxy_allow||[]).join("\n")),m(t?.browser_proxy_port_start||5610),j(t?.browser_proxy_port_end||5710)}})()},[]);return(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("网页代理")}),(0,f.jsx)(a.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:e("wbvpn_tip")})})})}})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{const t=s.split("\n").map(e=>e.trim()).filter(e=>!!e);(await d.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{browser_proxy_allow:t,browser_proxy_port_start:Number(l)||5610,browser_proxy_port_end:Number(x)||5710}})).code===c.m.Success&&(0,_.SK)(e("修改成功"))}}),children:[(0,f.jsx)("div",{children:e("wbvpn_allow")}),(0,f.jsx)(r.Z2,{style:{minHeight:"5rem",resize:"vertical"},placeholder:e("wbvpn_allow_ph"),value:s,onChange:e=>{i(e.target.value)}}),(0,f.jsx)("div",{children:e("wbvpn_port_range")}),(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.Sm,{placeholder:"5610",value:l,handleInputChange:e=>m(e)}),(0,f.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,f.jsx)(r.Sm,{placeholder:"5710",value:x,handleInputChange:e=>j(e)})]})]})}function z(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(""),[m,x]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1),[S,A]=(0,n.useState)(""),[z,K]=(0,y.fp)(p.AG.prompt_card),[,O]=(0,y.fp)(p.AG.editorSetting),[B,P]=(0,n.useState)(I.aM.close),[T,E]=(0,n.useState)(!1),[M,D]=(0,n.useState)(void 0),[G,q]=(0,n.useState)(""),{t:R,i18n:W}=(0,h.Bd)(),[Z,U]=(0,y.fp)(p.AG.user_base_info),{check_user_auth:H}=(0,w.MH)(),{initUserInfo:J}=(0,n.useContext)($.F),Q=async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){b(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.logo||""),x(s?.show_login_user_info),v(s?.http_proxy||""),q(s?.control_env_str||N.CU)}const s=await d.XO.get("token");if(s.code===c.m.Success){const e=s.data;if(!e)return;e.length&&D(e.length),e.mode&&P(e.mode),void 0!==e.persist&&E(e.persist)}};(0,n.useEffect)(()=>{Q()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(k.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[R("系统运行于"),": ",(0,V.s)(Z.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.19.4",null!=Z.latest_version&&"7.19.4"!==Z.latest_version?` -> ${Z.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:R("官网地址"),target:"_blank",children:`filecat ${R("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[R("安装方式")," :",Z.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:R("通用设置")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{K({open:!0,title:R("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:R("pxy_tip")})})})},title:R("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:R("确定修改"),clickFun:async()=>{(await d.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:m,http_proxy:j,logo:s}})).code===c.m.Success&&((0,_.SK)("修改成功"),J())}}),rightTopCom:(0,f.jsx)(a.rA,{icon:"tune",title:R("环境控制"),onClick:()=>{w.xK.set_value_temp(G||N.CU),O({model:"ace/mode/yaml",open:!0,fileName:"",not_auto_save:!0,save:async e=>{const t=await d.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{control_env_str:e}});t.code===c.m.Success?(q(e),(0,_.SK)(R("修改成功")),Q()):(0,_.zN)(`${t.message??R("保存失败")}`)}})}}),children:[R("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),R("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:R("lclorur"),value:s,handleInputChange:e=>{l(e)}}),(0,f.jsx)("div",{children:R("pxy_url")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),R("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:m,onChange:()=>{x(!m)}})]}),(0,f.jsx)(X,{}),(0,f.jsx)(F,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:R("文件回收站")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{K({open:!0,title:R("信息"),context_div:(0,f.jsx)("div",{children:R("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:R("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:R("确定修改"),clickFun:async()=>{if(g&&!S)return void(0,_.zN)("目录不能为空");(await d.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:S,open:g})).code===c.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:R("目录"),value:S,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{b(e)},options:[{title:R("开启"),value:!0},{title:R("关闭"),value:!1}]})]}),(0,f.jsxs)(o.Zp,{title:R("tk_exp"),rightBottomCom:(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(a.C3,{text:R("清空token"),clickFun:async()=>{(await d.XO.get("token/clear")).code===c.m.Success&&(0,_.SK)("清理完成,重新登录")}}),(0,f.jsx)(a.C3,{text:R("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=B,e.persist=T,I.aM.length!==e.mode||M||(0,_.zN)("秒数不能为空"),e.length=parseInt(M);(await d.XO.post("token/save",e)).code===c.m.Success&&(0,_.SK)("保存成功")}})]}),children:[(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:R("关闭"),selected:B===I.aM.close,onchange:()=>{P(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:R("指定时间"),selected:B===I.aM.length,onchange:()=>{P(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:R("永不过期"),selected:B===I.aM.forver,onchange:()=>{P(I.aM.forver)}})]}),B===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:R("秒"),value:M,handleInputChange:e=>{D(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:T,onChange:()=>E(!T)}),R("持久化")]})]})]})]})})]})}var K=s(92350),O=s(69675),B=s(32361);const P=[{key:"second",min:0,max:59,label:"秒"},{key:"minute",min:0,max:59,label:"分"},{key:"hour",min:0,max:23,label:"时"},{key:"day",min:1,max:31,label:"日"},{key:"month",min:1,max:12,label:"月"},{key:"week",min:0,max:7,label:"星期"}];function T(e){switch(e.mode){case"step":return`*/${e.step??1}`;case"range":return`${e.from??0}-${e.to??0}`;case"list":return(e.values??[]).join(",");default:return"*"}}function E(e){return[T(e.second),T(e.minute),T(e.hour),T(e.day),T(e.month),T(e.week)].join(" ")}function M(e,t,s){const n=(e??"").trim();if(!n)return null;if("*"===n)return{mode:"every"};if(n.startsWith("*/")){const e=Number(n.slice(2));return!Number.isInteger(e)||e<=0?null:{mode:"step",step:e}}if(n.includes("-")&&!n.includes(",")){const[e,i]=n.split("-").map(Number);return Number.isInteger(e)&&Number.isInteger(i)?e<t||i>s||e>i?null:{mode:"range",from:e,to:i}:null}const i=n.split(","),l=[];for(const e of i){const n=Number(e.trim());if(!Number.isInteger(n)||n<t||n>s)return null;l.push(n)}return 0===l.length?null:{mode:"list",values:l}}function D(e){const t=(e??"").trim().split(/\s+/);if(6!==t.length)return null;const s={};for(let e=0;e<6;e++){const n=P[e],i=M(t[e],n.min,n.max);if(!i)return null;s[n.key]=i}return s}function G(e){return e<10?`0${e}`:`${e}`}function q(e,t,s){switch(e.mode){case"step":return`每 ${e.step} ${t}`;case"range":return`${e.from} 到 ${e.to} ${t}`;case"list":return`${(e.values??[]).slice().sort((e,t)=>e-t).join("、")} ${t}`;default:return null}}function R(e){const{second:t,minute:s,hour:n,day:i,month:l,week:o}=e,a=(e,t)=>"list"===e.mode&&1===(e.values??[]).length&&e.values[0]===t,r=[];if("list"===n.mode&&"list"===s.mode&&a(t,0)){const e=(n.values??[]).slice().sort((e,t)=>e-t),t=(s.values??[]).slice().sort((e,t)=>e-t);e.length===t.length&&e.length>1&&t.length>1?r.push(e.map((e,s)=>`${G(e)}:${G(t[s])}`).join("、")):1===e.length&&1===t.length?r.push(`${G(e[0])}:${G(t[0])}`):r.push(`${e.map(G).join("、")} 时 ${t.join("、")} 分`)}else if("list"===n.mode&&"step"===s.mode&&a(t,0))r.push(`${(n.values??[]).map(G).join("、")} 时内每 ${s.step} 分钟`);else if("every"===n.mode&&"list"===s.mode&&a(t,0))r.push(`每小时的 ${(s.values??[]).join("、")} 分`);else if("every"===n.mode&&"step"===s.mode&&a(t,0))r.push(`每 ${s.step} 分钟`);else if("every"===n.mode&&"every"===s.mode&&a(t,0))r.push("每分钟");else if("every"===n.mode&&"every"===s.mode&&"step"===t.mode)r.push(`每 ${t.step} 秒`);else if("every"===n.mode&&"every"===s.mode&&"every"===t.mode)r.push("每秒");else if("every"===n.mode&&"every"===s.mode&&"list"===t.mode)r.push(`每分钟的第 ${(t.values??[]).join("、")} 秒`);else{const e=[],i=q(n,"时"),l=q(s,"分"),o=a(t,0)?null:q(t,"秒");i&&e.push(i),l&&e.push(l),o&&e.push(o),e.length>0&&r.push(e.join(" "))}const d="list"===i.mode&&1===(i.values??[]).length?i.values[0]:null,c="list"===l.mode&&1===(l.values??[]).length?l.values[0]:null,u="list"===o.mode&&1===(o.values??[]).length?o.values[0]:null;let h="";if(null!==c&&null!==d)h=`每年 ${c} 月 ${d} 号`;else if(null!==c)h=`每年 ${c} 月`;else if(null!==d)h=`每月 ${d} 号`;else if(null!==u)h=`每${["周日","周一","周二","周三","周四","周五","周六","周日"][u]??`星期 ${u}`}`;else{const e=[];"every"!==l.mode&&e.push(q(l,"月")),"every"!==i.mode&&e.push(q(i,"号")),"every"!==o.mode&&e.push(`星期 ${q(o,"")}`),e.length&&(h=e.join(" "))}h||(h="每天");const p=r.join(",");return/^(每|每天)/.test(p)?`${p}${"每天"===h?"":","+h} 执行`:`${h} ${p} 执行`}const W=[{label:"任意 (*)",value:"every"},{label:"每隔 (*/n)",value:"step"},{label:"区间 (a-b)",value:"range"},{label:"指定 (a,b)",value:"list"}];function Z(e,t,s=!1){const n=[];for(let i=e;i<=t;i++)n.push({label:s?String(i).padStart(2,"0"):String(i),value:i});return n}const U=({label:e,field:t,min:s,max:i,pad:l,week_label:o,onChange:a})=>{const d=(0,n.useMemo)(()=>Z(s,i,l),[s,i,l]),c=(0,n.useMemo)(()=>{if(!o)return d;const e=["周日","周一","周二","周三","周四","周五","周六","周日"];return d.map(t=>({value:t.value,label:`${t.value} (${e[t.value]})`}))},[d,o]);return(0,f.jsxs)("div",{className:"cron-field",children:[(0,f.jsx)("span",{className:"cron-field__label",children:e}),(0,f.jsx)(r.l6,{value:t.mode,onChange:e=>{a("every"===e?{mode:"every"}:"step"===e?{mode:"step",step:t.step??1}:"range"===e?{mode:"range",from:t.from??s,to:t.to??i}:{mode:"list",values:t.values??[s]})},options:W,no_border:!0,width:"7.5rem"}),"step"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)("span",{children:"每"}),(0,f.jsx)(r.l6,{value:t.step??1,onChange:e=>a({mode:"step",step:e}),options:Z(1,i),no_border:!0,width:"4.5rem"}),(0,f.jsx)("span",{children:e})]}),"range"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)(r.l6,{value:t.from??s,onChange:e=>a({mode:"range",from:e,to:t.to??i}),options:c,no_border:!0,width:"6.5rem"}),(0,f.jsx)("span",{children:"到"}),(0,f.jsx)(r.l6,{value:t.to??i,onChange:e=>a({mode:"range",from:t.from??s,to:e}),options:c,no_border:!0,width:"6.5rem"})]}),"list"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param cron-field__param--list",children:[(t.values??[]).map((e,s)=>(0,f.jsxs)("span",{className:"cron-tag",children:[(0,f.jsx)(r.l6,{value:e,onChange:e=>((e,s)=>{const n=[...t.values??[]];n[e]=s,a({mode:"list",values:n})})(s,e),options:c,no_border:!0,width:"6.5rem"}),(0,f.jsx)("i",{className:"material-icons cron-tag__del",onClick:()=>(e=>{const s=(t.values??[]).filter((t,s)=>s!==e);a(s.length?{mode:"list",values:s}:{mode:"every"})})(s),children:"close"})]},s)),(0,f.jsx)("i",{className:"material-icons cron-tag__add",onClick:()=>{const e=[...t.values??[]],n=new Set(e);let l=s;for(;n.has(l)&&l<i;)l++;a({mode:"list",values:[...e,l]})},children:"add"})]})]})};const H=[{label:"每分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},second:{mode:"list",values:[0]}})},{label:"每 5 分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"step",step:5},second:{mode:"list",values:[0]}})},{label:"每小时",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 8 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[8]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每周一 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},week:{mode:"list",values:[1]}})},{label:"每月 1 号 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},day:{mode:"list",values:[1]}})}],J=({value:e,onChange:t,no_border:s})=>{const[i,l]=(0,n.useState)(!1),o=(0,n.useRef)(null),a=(0,n.useRef)(null),r=(0,n.useMemo)(()=>D(e??"")??{second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"}},[e]),d=!!e&&!D(e??""),c=(0,B.r)({active:i,trigger_ref:o,floating_ref:a,width:384,max_height:26});(0,O.$)(i,[o,a],()=>l(!1));const u=e=>{t(E(e))};return(0,f.jsxs)("div",{className:"cron-input "+(i?"cron-input--open":""),children:[(0,f.jsxs)("div",{ref:o,className:"cron-input__display "+(s?"cron-input__display--no-border":""),title:d?"表达式格式不正确":`${e||""} ${R(r)}`.trim(),onClick:()=>l(!i),children:[(0,f.jsx)("span",{className:"cron-input__expr "+(d?"cron-input__expr--invalid":""),children:e||"(未设置)"}),!s&&(0,f.jsx)("span",{className:"cron-input__desc",children:d?"表达式格式不正确":R(r)}),(0,f.jsx)("i",{className:"material-icons cron-input__arrow",children:"arrow_drop_down"})]}),i&&(0,f.jsxs)("div",{ref:a,className:"cron-editor",style:{left:c.left,top:c.top,...c.css_vars,visibility:c.ready?"visible":"hidden"},children:[(0,f.jsxs)("div",{className:"cron-editor__scroll",children:[(0,f.jsxs)("div",{className:"cron-editor__row",children:[(0,f.jsx)("span",{className:"cron-editor__title",children:"常用"}),(0,f.jsx)("div",{className:"cron-editor__presets",children:H.map(e=>(0,f.jsx)("button",{className:"cron-preset",onClick:()=>u(e.make()),children:e.label},e.label))})]}),(0,f.jsx)("div",{className:"cron-editor__fields",children:P.map(e=>(0,f.jsx)(U,{label:e.label,field:r[e.key],min:e.min,max:e.max,pad:"day"!==e.key&&"month"!==e.key&&"week"!==e.key,week_label:"week"===e.key,onChange:t=>{return s=e.key,n=t,void u({...r,[s]:n});var s,n}},e.key))})]}),(0,f.jsxs)("div",{className:"cron-editor__footer",children:[(0,f.jsx)("span",{className:"cron-editor__preview",children:E(r)}),(0,f.jsx)("button",{className:"cron-editor__done",onClick:()=>l(!1),children:"完成"})]})]})]})};function Q(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)($.F),[m,x]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[S,C]=(0,y.fp)(p.AG.prompt_card),[,k]=(0,y.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[N,V]=(0,n.useState)([]),[X,F]=(0,n.useState)([]),[z,O]=(0,n.useState)([]),[B,P]=(0,n.useState)(""),[T,E]=(0,n.useState)([]),M=(0,b.K)(),D=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],R=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("cron表达式"),e("用户id"),e("备注")],W=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],Z=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,w.MH)(),H=async()=>{const e=await d.XO.get("env/path/get");e.code===c.m.Success&&F(e.data)},Q=async()=>{const e=await d.XO.get("workflow_setting_get");e.code===c.m.Success&&O(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("outside/software/get");e.code===c.m.Success&&g(e.data);const t=await d.XO.get("pty_cmd");t.code===c.m.Success&&P(t.data),H(),Q();const s=await d.XO.get("protection_dir/sys");s.code===c.m.Success&&I(s.data??[]);const n=await d.XO.get("dir_upload_max_num");n.code===c.m.Success&&V(n.data??[]);const i=await d.XO.get("plugin/list");i.code===c.m.Success&&E(i.data??[])})()},[]);const L=(0,K.Q)(),Y=async()=>{await d.XO.post("plugin/list/save",T)};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L("文件上传")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...N,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of N)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,_.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,_.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,_.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(N,e=>e.index??0);(await d.XO.post("dir_upload_max_num/save",N)).code===c.m.Success&&((0,_.SK)("保存成功"),l())}})]}),children:(0,f.jsx)(u.X,{headers:W,rows:N.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,V([...N])},options:M,no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),V([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(N,e,t))}})})}),(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L("Workflow")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...z,{open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("workflow_setting_save",z)).code===c.m.Success&&((0,_.SK)("ok"),Q())}})]}),children:(0,f.jsx)(u.X,{headers:R,rows:z.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,O([...z])},options:M,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,O([...z])},options:M,no_border:!0}),(0,f.jsx)(J,{value:t.cron_str,onChange:e=>{t.cron_str=e,O([...z])},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z.splice(e,1),O([...z])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{O((0,v.TI)(z,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L("环境路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await d.XO.get("env/process/view");t.code===c.m.Success?C({open:!0,title:e("进程环境变量"),context_div:(0,f.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:t.data})}):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await d.XO.get("env/process/get");t.code===c.m.Success?(w.xK.set_value_temp(t.data??""),k({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{await d.XO.post("env/process/save",{text:e})}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...X,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("env/path/save",{paths:X})).code===c.m.Success&&((0,_.SK)("保存成功"),H(),s())}})]}),children:(0,f.jsx)(u.X,{headers:q,rows:X.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,F([...X])},options:M,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),F([...X])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)(X,e,t))}})}),(0,f.jsx)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("更新"),clickFun:async()=>{(await d.XO.post("pty_cmd/save",{str:B})).code===c.m.Success&&((0,_.SK)("保存成功"),l())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:B,handleInputChange:e=>{P(e)}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L("插件配置")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{E([...T,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:Y})]}),children:(0,f.jsx)(u.X,{headers:Z,rows:T.map((t,s)=>{const n=[s,(0,f.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,E([...T])},options:M,no_border:!0}),(0,f.jsx)(a.mu,{icon:"edit",value:t.params,save:async e=>{t.params=e,await Y()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{T.splice(e,1),E([...T])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{E((0,v.TI)(T,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/sys/save",A)).code===c.m.Success&&((0,_.SK)("保存成功"),l())}})]}),children:(0,f.jsx)(u.X,{headers:G,rows:A.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{title:e("外部软件"),rightTopCom:(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("outside/software/save",j)).code===c.m.Success&&((0,_.SK)("保存成功"),s())}}),children:(0,f.jsx)(u.X,{headers:D,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(o.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{L(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function L(e){const{t,i18n:s}=(0,h.Bd)(),[i,o]=(0,y.fp)(p.AG.user_base_info),a=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("dc_ctdl"),permission:l.oV.docker_container_update},{title:t("dc_idl"),permission:l.oV.docker_images_delete},{title:t("systemd管理"),permission:l.oV.systemd},{title:t("防火墙管理"),permission:l.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("ai_page"),permission:l.oV.ai_agent_page},{title:t("sw_mdl"),permission:l.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("tk_time"),permission:l.oV.token_update},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key},{title:t("md_set"),permission:l.oV.md_editor_setting},{title:t("目录挂载"),permission:l.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:l.oV.sys_env_page},{title:t("up_lim"),permission:l.oV.dir_upload_max_num},{title:t("path_md"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("path_up"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("wf_api"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("api_rt"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("pxy_off"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("浏览器代理编辑"),permission:l.oV.browser_proxy_edit},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:l.oV.workflow_exe},{title:t("wf_user"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("端口扫描"),permission:l.oV.port_scan},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh_sv"),permission:l.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:l.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:l.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:a.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const Y=new Map;function ee(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)($.F),[j,g]=(0,y.fp)(p.AG.user_base_info),[w,b]=(0,n.useState)([]),[S,C]=(0,y.fp)(p.AG.prompt_card),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(!1),[V,X]=(0,y.fp)(p.AG.confirm),[F,z]=(0,n.useState)(""),[O,B]=(0,n.useState)(""),[P,T]=(0,n.useState)(""),[E,M]=(0,n.useState)([]),[D,G]=(0,n.useState)([]),[q,R]=(0,n.useState)([]),[W,Z]=(0,n.useState)(""),[U,H]=(0,n.useState)(""),[J,Q]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[oe,ae]=(0,n.useState)(!1),[re,de]=(0,n.useState)(""),[ce,ue]=(0,n.useState)(""),[he,pe]=(0,n.useState)({}),me=(0,K.o)(),[_e,xe]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await d.wm.get("all_users");if(e.code===c.m.Success){const t=e.data??[];if(je){const e=[];for(const s of t)`${s.id}${s.username}${s.cwd}${s.note}`.includes(je)&&e.push(s);b(e)}else b(t)}const t=await d.wm.get("all_roles");if(t.code===c.m.Success){xe(t.data),Y.clear();for(const e of t.data)Y.set(e.role_id,e)}},ye=e=>{z(e?.username??""),B(e?.password??""),T(e?.cwd??""),M(e?.access_dirs??[]),G(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),Z(e?.access_cmd??""),H(e?.not_access_cmd??""),Q(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),ae(e?.is_root??!1),de(e?.id??""),e?.bind_role_id?we(e.bind_role_id,e.auth_list??[]):(ue(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const we=(e,t=[])=>{if(!e)return ue(""),void pe({});const s=Y.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&M(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&G(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&Z(s.access_cmd),s.not_access_cmd&&H(s.not_access_cmd),s.language&&Q(s.language),s.theme&&te(s.theme),s.auth_list&&s.auth_list.length>0){const e=new Set(s.auth_list);for(const s of t)e.add(s);ne(Array.from(e))}ue(e),pe(s)}},be=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,x.CB)(F))return void(0,_.zN)("username not empty char");if(!P)return void(0,_.zN)("cwd not empty");const e=new l.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=F,e.password=O,e.not_access_dirs=D,e.only_read_dirs=q,e.cwd=P,e.note=ie,e.access_cmd=W,e.not_access_cmd=U,e.auth_list=se,e.bind_role_id=ce,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),rightTopCom:(0,f.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,f.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),N(!1),ye(void 0)}})]}),children:(0,f.jsx)(u.X,{headers:fe,rows:w.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(o.xP,{children:t.username}),(0,f.jsx)(o.xP,{children:t.cwd}),(0,f.jsx)(o.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),N(!0),ye(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{X({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await d.wm.post("delete_user",e)).code===c.m.Success&&((0,_.SK)("删除完成"),ge(),X({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(k||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(k?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),N(!1),ye(void 0)}}),k&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!O)return void(0,_.zN)("password not empty");if((0,x.CB)(O))return void(0,_.zN)("username not empty char");const e=be(),t=await d.wm.post("create_user",e);ge(),t.code===c.m.Success&&((0,_.SK)("创建完成"),ge(),A(!1),N(!1),ye(void 0))}}),I&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=be();if(!e)return;e.id=re;(await d.wm.post("save_user",e)).code===c.m.Success&&((0,_.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>z(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:O,handleInputChange:e=>B(e)}),(0,f.jsxs)("label",{children:[!he?.access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{M([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==he.cwd&&void 0!==he.cwd,value:P,handleInputChange:e=>T(e)}),(E??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==he?.access_dirs?.length&&void 0!==he?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,M([...E])}})}),0===he?.access_dirs?.length||void 0===he?.access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{E.splice(s,1),M([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.not_access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{G([...D,""])},title:e("添加")}),e("禁止目录范围")]}),(D??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==he?.not_access_dirs?.length&&void 0!==he?.not_access_dirs?.length,value:t,handleInputChange:e=>{D[s]=e,G([...D])}})}),0===he?.not_access_dirs?.length||void 0===he?.not_access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{D.splice(s,1),G([...D])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{R([...q,""])},title:e("添加")}),e("只读目录范围")]}),(q??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==he?.only_read_dirs?.length&&void 0!==he?.only_read_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,R([...q])}})}),0===he?.only_read_dirs?.length||void 0===he?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{q.splice(s,1),R([...q])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.access_cmd&&void 0!==he.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>Z(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.not_access_cmd&&void 0!==he.not_access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>H(e)}),!oe&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:ce,onChange:e=>{we(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==he.language&&void 0!==he.language,value:J,onChange:e=>{Q(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{disabled:""!==he.theme&&void 0!==he.theme,value:ee,onChange:e=>{te(e)},options:me}),(0,f.jsx)(L,{is_disable:e=>{if(!0===oe)return!0;if(ce){const t=Y.get(ce);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===oe||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function te(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s}=(0,n.useContext)($.F),[m,x]=(0,n.useState)([]),[j,g]=(0,y.fp)(p.AG.prompt_card),[w,b]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[k,A]=(0,y.fp)(p.AG.confirm),[I,N]=(0,n.useState)(""),[V,X]=(0,n.useState)(""),[F,z]=(0,n.useState)([]),[O,B]=(0,n.useState)([]),[P,T]=(0,n.useState)([]),[E,M]=(0,n.useState)(""),[D,G]=(0,n.useState)(""),[q,R]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[U,H]=(0,n.useState)([]),[J,Q]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,K.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await d.wm.get("all_roles");e.code===c.m.Success&&x(e.data)},ie=e=>{N(e?.role_name??""),X(e?.cwd??""),z(e?.access_dirs??[]),B(e?.not_access_dirs??[]),T(e?.only_read_dirs??[]),M(e?.access_cmd??""),G(e?.not_access_cmd??""),R(e?.language??""),Z(e?.theme??""),H(e?.auth_list??[]),Q(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new l.E0;return e.language=q,e.theme=W,e.access_dirs=F,e.role_name=I,e.not_access_dirs=O,e.only_read_dirs=P,e.cwd=V,e.access_cmd=E,e.not_access_cmd=D,e.auth_list=U,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),rightTopCom:(0,f.jsx)("div",{children:(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),C(!1),ie(void 0)}})}),children:(0,f.jsx)(u.X,{headers:se,rows:m.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(o.xP,{children:t.role_name}),(0,f.jsx)(o.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),C(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await d.wm.post("delete_role",e)).code===c.m.Success&&((0,_.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(w||S)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(w?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),C(!1),ie(void 0)}}),w&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await d.wm.post("create_role",e);ne(),t.code===c.m.Success&&((0,_.SK)("创建完成"),ne(),b(!1),C(!1),ie(void 0))}}),S&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=J;(await d.wm.post("save_role",e)).code===c.m.Success&&((0,_.SK)("保存完成"),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>N(e)}),(0,f.jsx)("label",{children:e("角色备注")}),(0,f.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{z([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:V,handleInputChange:e=>X(e)}),(F??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{F[t]=e,z([...F])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{F.splice(t,1),z([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{B([...O,""])},title:"添加"}),e("禁止目录范围")]}),(O??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:t,handleInputChange:e=>{O[s]=e,B([...O])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{O.splice(s,1),B([...O])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{T([...P,""])},title:e("添加")}),e("只读目录范围")]}),(P??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{P[t]=e,T([...P])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{P.splice(t,1),T([...P])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:E,placeholder:"use blank split",handleInputChange:e=>M(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:D,placeholder:"use blank split",handleInputChange:e=>G(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:q,onChange:e=>{R(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{value:W,onChange:e=>{Z(e)},options:te}),(0,f.jsx)(L,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==U?.find(t=>t===e),select_auth:e=>{U?(U.find(t=>t==e)?(0,v.I)(U,t=>t===e):U.push(e),H([...U])):H([e])}})]})})})]})}var se=s(93245);function ne(e){const{t}=(0,h.Bd)(),[s,i]=(0,n.useState)((e.children_list??[]).map(e=>({path:e.path,note:e.note}))),l=[t("编号"),t("目录"),t("备注")],d=()=>{i([...s,{path:"",note:""}])};(0,n.useEffect)(()=>{s?.length||d()});return(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:t("sub_dir")})}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:t("添加"),onClick:d}),(0,f.jsx)(a.rA,{icon:"save",title:t("保存"),onClick:()=>{e.on_confirm(s.filter(e=>e.path))}}),(0,f.jsx)(a.rA,{icon:"close",title:t("取消"),onClick:e.on_cancel})]}),children:(0,f.jsx)(u.X,{headers:l,rows:s.map((e,n)=>[(0,f.jsx)("span",{children:n}),(0,f.jsx)(r.Sm,{value:e.path,handleInputChange:t=>{e.path=t},no_border:!0}),(0,f.jsx)(r.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,f.jsx)("div",{children:(0,f.jsx)(a.rA,{icon:"delete",title:t("删除"),onClick:()=>{i(s.filter((e,t)=>t!==n))}})})]),width:"10rem"})})}function ie(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)($.F),[x,j]=(0,n.useState)([]),[g,w]=(0,y.fp)(p.AG.prompt_card),[S,k]=(0,n.useState)([]),[A,N]=(0,n.useState)([]),[V,X]=(0,n.useState)([]),[F,z]=(0,y.fp)(p.AG.user_base_info),O=(0,b.K)(),B=(0,K.o)(),P=[e("编号"),e("路径"),e("是否默认"),e("备注"),e("sub_dir")],T=[e("编号"),e("路径"),e("备注")],E=[e("编号"),e("命令"),e("父编号"),e("备注")],M=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[D,G]=(0,n.useState)(""),[q,R]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[U,H]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(""),[L,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)(""),[ie,le]=(0,n.useState)(!1),[oe,ae]=(0,n.useState)(""),[re,de]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("filesSetting");e.code===c.m.Success&&(j(e.data.dirs),N(e.data.quick_cmd),X(e.data.file_quick_cmd));const t=await d.XO.get("protection_dir");t.code===c.m.Success&&k(t.data??[])})(),Q(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore);const e=F?.user_data?.editor_auto_save;le(!!e?.enable),ae(null!=e?.interval?String(e.interval):""),de(e?.editors??[])},[]);const ce=(0,K.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{if(!D||!q)return void(0,_.zN)("账号密码不能为空");if(q!==W)return void(0,_.zN)("两次密码不一样");const e=new l.tl;e.username=D,e.password=q,e.confirm_password=W,e.user_id=F.user_data.id;(await d.wm.post("updatePassword",e)).code===c.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:D,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{R(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{Z(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{(await d.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:J,theme:L,upload_file_ignore:ee}})).code===c.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:J,onChange:e=>{Q(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,f.jsx)(r.l6,{value:L,onChange:e=>{Y(e)},options:B}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("编辑器自动保存"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{const t=parseInt(String(oe),10);if(isNaN(t)||t<1)return void(0,_.zN)(e("请输入不小于 1 的整数(秒)"));(await d.wm.post(C.s.user_save_private_attr,{is_editor_auto_save:!0,editor_auto_save:{enable:ie,interval:t,editors:re}})).code===c.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[(0,f.jsx)(r.BC,{label:e("开启"),children:(0,f.jsx)(r.l6,{value:ie,onChange:e=>{le(e)},options:O,no_border:!0})}),(0,f.jsx)(r.BC,{label:e("自动保存间隔(秒)"),children:(0,f.jsx)(r.Sm,{type:"number",value:oe,handleInputChange:e=>{ae(e)},placeholder:"30",no_border:!0})}),(0,f.jsx)("h3",{children:e("编辑器")}),se.d.map(t=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",checked:re.includes(t.id),onChange:e=>{const s=e.target.checked;de(s?[...re,t.id]:re.filter(e=>e!==t.id))}}),e(t.label)]},t.id))]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{ce("文件夹路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...x,{note:"",default:!1,path:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<x.length;e++)x[e].index=e;(await d.XO.post("filesSetting/save",{dirs:x})).code===c.m.Success&&((0,_.SK)("保存成功"),m(),s())}})]}),children:(0,f.jsx)(u.X,{headers:P,rows:x.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:t.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<x.length;e++)x[e].default=e===s&&t,n.push(x[e]);j(n)})(0,e,s)},options:O,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)("span",{children:t.children?.length??0}),0!==s&&(0,f.jsx)(a.rA,{icon:"folder_open",title:e("sub_dir"),onClick:()=>(e=>{w({open:!0,main_context_div:(0,f.jsx)(ne,{children_list:e.children,on_cancel:()=>{w({open:!1})},on_confirm:t=>{e.children=t,j([...x]),w({open:!1})}})})})(t)})]}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{x.splice(e,1),j([...x])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(x,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{ce("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...S,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/save",S)).code===c.m.Success&&((0,_.SK)("保存成功"),m())}})]}),children:(0,f.jsx)(u.X,{headers:T,rows:S.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{S.splice(e,1),k([...S])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{k((0,v.TI)(S,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{ce("目录快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...A,{cmd:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{quick_cmd:A})).code===c.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(u.X,{headers:E,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),N([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{ce("文件快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{file_quick_cmd:V})).code===c.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(u.X,{headers:M,rows:V.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),X([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)(V,e,t))}})})]})]})]})})}var le=s(45907),oe=s(17903);const ae=["password","private_key","secret_key"],re="webdav",de="@authorize",ce={smb:[{keys:["server","username","password"],on_next:"load_shares"},{keys:["share"]}],baidu:[{keys:["app_id","app_key","secret_key"],on_next:"save_app"},{keys:[de]}]};function ue(){const{t:e}=(0,h.Bd)(),t=(0,le.y)(),[,s]=(0,y.fp)(p.AG.prompt_card),[i,l]=(0,n.useState)([]),[c,m]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[w,b]=(0,n.useState)(re),[S,C]=(0,n.useState)(""),[k,A]=(0,n.useState)({}),[I,N]=(0,n.useState)(1),[V,$]=(0,n.useState)([]),[X,F]=(0,n.useState)("oob"),[z,K]=(0,n.useState)(""),[O,B]=(0,n.useState)(!0),P=async()=>{try{const[e,t]=await Promise.all([d.I2.post("credential/list",{}),d.I2.post("credential/meta",{})]);l(Array.isArray(e?.data)?e.data:[]),m(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{P()},[]);const T=c.find(e=>e.type===w)?.fields??[],E=ce[w],M=E?.length??1,D=()=>{j(!1),g(""),b(re),C(""),A({}),N(1),$([]),K(""),B(!0)},G=t=>{if(!S.trim())return e("请填写备注");for(const s of T){if(!1===t.includes(s.key))continue;const n=String(k[s.key]??"").trim()||v&&ae.includes(s.key);if(s.required&&!n)return e(s.label)}},q=async()=>{try{const e=await d.I2.post("baidu/authorize_url",{id:v,mode:X});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},R=async()=>{if(z.trim())try{const t=await d.I2.post("baidu/exchange",{id:v,code:z.trim(),mode:X});(0,_.SK)(`${e("授权成功")}:${t?.data?.baidu_name??""}`),K(""),await P()}catch(e){}else(0,_.zN)(e("请填写授权码"))},W=E?.[I-1]?.keys??T.map(e=>e.key),Z=W.includes(de),U=I===M,H=M>1;return(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("凭证管理")}),(0,f.jsx)(a.rA,{icon:"info",title:e("信息"),onClick:()=>{s({open:!0,title:e("信息"),context_div:(0,f.jsxs)("div",{children:[(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:e("crd_tp")}),(0,f.jsx)("li",{children:e("pwdkept")}),(0,f.jsx)("li",{children:e("tstbfrs")})]}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SMB"}),":",e("prt_smb")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"百度网盘"}),":",e("prt_bd")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:e("本地目录")}),":",e("prt_local")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{D(),j(!0)}}),x&&(0,f.jsxs)(f.Fragment,{children:[H&&I>1&&(0,f.jsx)(a.rA,{icon:"arrow_back",title:e("上一步"),onClick:()=>N(I-1)}),H&&!U&&(0,f.jsx)(a.rA,{icon:"arrow_forward",title:e("下一步"),onClick:async()=>{const t=G(E?.[I-1]?.keys??[]);if(t)return void(0,_.zN)(`${e("请填写")}${t}`);const s=E?.[I-1]?.on_next;try{if("load_shares"===s&&!await(async()=>{const t=await d.I2.post("share/list",{driver:w,id:v||void 0,config:{server:k.server,username:k.username,password:k.password}}),s=t?.data??[];return s.length?($(s.map(e=>({label:e.name,value:e.name}))),!0):((0,_.zN)(e("没有找到共享")),!1)})())return;if("save_app"===s&&!await(async()=>{try{const e=await d.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:w,note:S,config:k,enabled:O});return!v&&e?.data?.id&&g(e.data.id),!0}catch(e){return!1}})())return;N(I+1)}catch(e){}}}),(!H||U)&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=G(T.map(e=>e.key));if(t)(0,_.zN)(`${e("请填写")}${t}`);else try{await d.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:w,note:S,config:k,enabled:O}),(0,_.SK)(e("保存成功")),D(),await P()}catch(e){}}}),(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:D})]})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("备注"),value:S,handleInputChange:C}),(0,f.jsx)(r.l6,{value:w,options:c.map(e=>({title:e.name,value:e.type})),onChange:e=>{b(e),A({}),$([]),N(1),K("")}}),Z?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"one_click",context:e("一键授权"),selected:"one_click"===X,onchange:()=>F("one_click")}),(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===X,onchange:()=>F("oob")})]})}),"oob"===X&&(0,f.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:z,handleInputChange:K})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(a.rA,{icon:"open_in_new",title:e("去授权"),onClick:q}),"oob"===X&&(0,f.jsx)(a.rA,{icon:"check",title:e("完成授权"),onClick:R})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("账号名"),e("百度账号"),e("授权状态"),e("使用"),e("授权时间"),e("操作")],rows:s.map(s=>[(0,f.jsx)(o.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(o.xP,{context:s.account_name||s.id}),(0,f.jsx)(o.xP,{context:s.authorized?e("已授权"):e("未授权")}),(0,f.jsx)(o.xP,{context:!1===s.enabled?e("停用"):e("启用")}),(0,f.jsx)("p",{children:s.obtained_at?(0,oe.eK)(s.obtained_at):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"network_check",title:e("授权检测"),onClick:()=>(async(t,s)=>{try{const n=await d.I2.post("baidu/verify",{id:t,account_id:s}),i=n?.data??{};i.valid?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`),await P()}catch(e){}})(v,s.id)}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>((s,n)=>{t({title:e("确认删除"),sub_title:n.note||n.account_name||n.id,confirm_fun:async()=>{try{await d.I2.post("baidu/deauthorize",{id:s,account_id:n.id}),(0,_.SK)(e("已删除")),await P()}catch(e){}}})})(v,s)})]})])})]},de)})():T.filter(e=>W.includes(e.key)).map(t=>{if("share"===t.key&&"smb"===w)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:V,onChange:e=>A({...k,[t.key]:e})})},t.key);const s="password"===t.type;return(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:s?"password":"text",placeholder:t.label,value:k[t.key]??"",handleInputChange:e=>A({...k,[t.key]:e})})},t.key)})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("类型"),e("操作")],rows:i.map(s=>{return[(0,f.jsx)(o.xP,{context:s.note}),(0,f.jsx)(o.xP,{context:(n=s.type,c.find(e=>e.type===n)?.name??n)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),b(e.type),C(e.note??""),A({...e.config??{}}),K(""),B(!1!==e.enabled),N(ce[e.type]?.length??1),"smb"===e.type&&d.I2.post("share/list",{driver:"smb",id:e.id,config:e.config??{}}).then(e=>{$((e?.data??[]).map(e=>({label:e.name,value:e.name})))}).catch(()=>{})})(s)}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.note,confirm_fun:async()=>{try{await d.I2.post("credential/delete",{id:s.id}),(0,_.SK)(e("已删除")),await P()}catch(e){}}})})(s)})]})];var n})})]})}function he(){const{t:e}=(0,h.Bd)(),t=(0,le.y)(),[s,i]=(0,n.useState)([]),[l,c]=(0,n.useState)([]),[p,m]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[y,w]=(0,n.useState)("webdav"),[b,S]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[N,V]=(0,n.useState)(""),[$,X]=(0,n.useState)(""),F=async()=>{try{const[e,t,s]=await Promise.all([d.I2.post("list",{}),d.I2.post("credential/list",{}),d.I2.post("driver/list",{})]);i(Array.isArray(e?.data)?e.data:[]),c(Array.isArray(t?.data)?t.data:[]),m(Array.isArray(s?.data)?s.data:[])}catch(e){}};(0,n.useEffect)(()=>{F()},[]);const z=(0,oe.p_)(C,l),K=z.length>0,O=()=>{j(!1),g(""),w("webdav"),S(""),k(""),I(""),V(""),X("")};return(0,f.jsxs)(o.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O(),j(!0)}}),x&&(0,f.jsx)(a.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(C)try{const t=await d.I2.post("test",{id:v||void 0,driver:y,credential_id:C,account_id:A,root_dir:N}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(C)if(!K||A)if(b.trim())try{await d.I2.post(v?"update":"add",{id:v||void 0,driver:y,mount_path:b,credential_id:C,account_id:K?A:void 0,root_dir:N,note:$,color:oe.OT,readonly:!1,enabled:!0}),(0,_.SK)(e("保存成功")),O(),await F()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择账号"));else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:O})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:y,options:p.map(e=>({title:e.name,value:e.type})),onChange:e=>{w(e),k(""),I("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:C,options:(B=y,(0,oe.XT)(B,l)),onChange:e=>{k(e),I("")}})}),K&&(0,f.jsx)(r.BC,{label:e("账号"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:A,options:z,onChange:I})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:b,handleInputChange:S})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:N,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:$,handleInputChange:X})})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:s.map(s=>{const n=l.find(e=>e.id===s.credential_id),i=(n?.accounts??[]).find(e=>e.id===s.account_id);return[(0,f.jsx)("p",{children:s.note}),(0,f.jsx)("p",{children:(o=s.driver,p.find(e=>e.type===o)?.name??o)}),(0,f.jsx)("p",{children:n?n.note:e("凭据已丢失")}),(0,f.jsx)("p",{children:s.account_id?i?i.note||i.account_name||i.nickname||i.id:e("账号已丢失"):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),w(e.driver),S(e.mount_path??""),k(e.credential_id??""),I(e.account_id??""),V(e.root_dir??""),X(e.note??"")})(s)}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.mount_path,confirm_fun:async()=>{try{await d.I2.post("delete",{id:s.id}),(0,_.SK)(e("已删除")),await F()}catch(e){}}})})(s)})]})];var o})})]});var B}function pe(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,w.MH)(),s=t(l.oV.file_mount),[r,c]=(0,y.fp)(p.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await d.I2.post("enabled/get",{});c(!0===e?.data)}catch(e){c(!1)}})()},[s]);return s?(0,f.jsxs)(n.Fragment,{children:[(0,f.jsxs)(k.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(a.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const t=!r;try{const s=await d.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;c(n),(0,_.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(ue,{})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(he,{})})]})})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(o.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var me=s(87361);function _e(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,w.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(ie,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(z,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(Q,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(ee,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(te,{})}),t(l.oV.file_mount)&&s.push({index:1,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(pe,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:me.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>u,o:()=>p});var n=s(34843),i=s(82893),l=s(74777),o=s(96540),a=s(22022),r=s(23430),d=s(14284),c=s(74848);function u(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:o}=(0,a.Bd)();return e=>{let n;e===l.jk.ffmpeg?n=(0,c.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.jk.smartmontools?n=(0,c.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,c.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,c.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,c.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,c.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,c.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,c.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,c.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,c.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,c.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,c.jsxs)("li",{children:[(0,c.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,c.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,c.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,c.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,c.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,c.jsxs)("div",{children:[(0,c.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,c.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,c.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,c.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,c.jsx)("div",{children:n})})}}let h=r.Ky;function p(){const[e,t]=(0,o.useState)([]);return(0,o.useEffect)(()=>{(async()=>{try{const e=await d.XO.get("themes");if(0===e.code){const s=e.data||[];h=[...r.Ky,...s],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>o});var n=s(72635);const i=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},93245(e,t,s){s.d(t,{a:()=>r});var n=s(96540),i=s(34843),l=s(82893),o=s(23430);const a=[{id:o.nE.ace,label:"文本编辑器(ace)"},{id:o.nE.md,label:"md编辑器"},{id:o.nE.mind,label:"思维导图编辑器"},{id:o.nE.draw,label:"draw编辑器"},{id:o.nE.timeline,label:"时间线编辑器"},{id:o.nE.image,label:"图片编辑器"},{id:o.nE.excel,label:"excel编辑器"}];function r(e,t,s,o=!1){const[a]=(0,i.fp)(l.AG.user_base_info),r=a?.user_data?.editor_auto_save,d=(0,n.useRef)(r);d.current=r;const c=(0,n.useRef)(t);c.current=t;const u=(0,n.useRef)(s);u.current=s,(0,n.useEffect)(()=>{if(o)return;const t=d.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const s=setInterval(()=>{c.current()&&u.current(!0)},1e3*t.interval);return()=>clearInterval(s)},[r,e,o])}s.d(t,["d",0,a])},24659(e,t,s){var n=s(22022);s.d(t,["K",0,()=>{const{t:e}=(0,n.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([[892],{20892(e,t,n){n.r(t),n.d(t,{default:()=>h});var s=n(96540),i=n(57889),l=n(62042),a=n(22022),r=n(93392),c=n(61443),o=n(74848);const d=36,u=4.8;function m(e){return`timeline-node--${e}`}function h(e){const{t}=(0,a.Bd)(),[n,u]=(0,s.useState)(()=>(0,r.bw)()),[m,h]=(0,s.useState)(!0),[_,v]=(0,s.useState)(""),[x,b]=(0,s.useState)(1),[g,f]=(0,s.useState)({}),j=(0,s.useCallback)((e,t)=>{f(n=>n[e]===t?n:{...n,[e]:t})},[]),[y,N]=(0,s.useState)({}),w=(0,s.useCallback)((e,t)=>{N(n=>n[e]===t?n:{...n,[e]:t})},[]),[k,C]=(0,s.useState)(!1),[E,L]=(0,s.useState)(null),[R,$]=(0,s.useState)("event"),S=(0,s.useRef)(null),T=(0,s.useRef)(null),z=(0,s.useRef)(!1),P=(0,s.useRef)({props:e});P.current={props:e};const U=(0,s.useRef)([]),D=(0,s.useRef)([]),[O,I]=(0,s.useState)(0),M=(0,s.useRef)(null),[B,Y]=(0,s.useState)(null),[X,F]=(0,s.useState)(null),A=(0,s.useRef)(n);A.current=n;const K=(0,s.useRef)(x);K.current=x;const Z="vertical"===n.layout.direction,q=(0,s.useRef)(k);q.current=k;const G=e=>{e&&!q.current||z.current!==e&&(z.current=e,P.current.props.on_dirty?.(e))},J=(0,s.useCallback)(e=>{U.current[U.current.length-1]!==e&&(U.current.push(e),U.current.length>100&&U.current.shift()),D.current=[],I(e=>e+1)},[]),W=(0,s.useCallback)(e=>{q.current&&(J((0,r.vE)(A.current)),A.current=e,u(e),G(!0))},[J,G]),H=e=>{q.current?W(e):(A.current=e,u(e))},V=(0,s.useCallback)(()=>{if(!q.current)return;const e=U.current.pop();null!=e&&(D.current.push((0,r.vE)(A.current)),u((0,r.Tz)(JSON.parse(e))),L(null),G(!0),I(e=>e+1))},[]),Q=(0,s.useCallback)(()=>{if(!q.current)return;const e=D.current.pop();null!=e&&(U.current.push((0,r.vE)(A.current)),u((0,r.Tz)(JSON.parse(e))),L(null),G(!0),I(e=>e+1))},[]),ee=async(e=!1)=>{if(!q.current)return!1;const t=await P.current.props.on_save((0,r.vE)(A.current),e);return t&&G(!1),t};(0,s.useEffect)(()=>{e.register?.({save:ee,is_dirty:()=>z.current,is_edit_mode:()=>k})},[e.register,k]),(0,s.useEffect)(()=>{P.current.props.on_edit_mode_change?.(k)},[k]),(0,s.useEffect)(()=>{if(e.doc)return u(e.doc),b(1),h(!1),void v("");if(!e.url)return;let n=!1;return h(!0),v(""),U.current=[],D.current=[],I(e=>e+1),L(null),G(!1),(async()=>{try{const t=await i.l.get(e.url);if(n)return;const s=(0,r.dO)(t)??(0,r.bw)();u(s),b((0,r.$4)(s.layout.zoom??1,.3,3,1)),window.setTimeout(()=>{const e=T.current;e&&(e.scrollLeft=(s.layout.scroll_x??0)*(s.layout.zoom??1),e.scrollTop=(s.layout.scroll_y??0)*(s.layout.zoom??1))},60)}catch{if(n)return;v(t("加载时间线失败")),(0,l.zN)(t("加载时间线失败"))}finally{n||h(!1)}})(),()=>{n=!0}},[e.url,e.doc]);const te=e=>{return Math.max(d,(t=e.id,g[t]??d))+10;var t},ne=e=>e.collapsed?te(e):d+(e=>{const t="vertical"===n.layout.direction?96:240,s={left:0,right:0};return e.events.forEach((e,i)=>{const l=n.layout.alternate?i%2==0?"left":"right":e.side;s[l]+=(y[e.id]??t)+12}),Math.max(s.left,s.right)})(e),se=(0,s.useMemo)(()=>{const e=[];let t=0;for(const s of n.phases)e.push(t),t+=s.collapsed?Math.max(d,g[s.id]??d)+10:ne(s);return e},[n.phases,g,y]);(0,s.useEffect)(()=>{const e=e=>{const t=M.current,n=S.current;if(!t||!n)return;const s=n.getBoundingClientRect(),i=K.current,l=("vertical"===A.current.layout.direction?e.clientY-s.top:e.clientX-s.left)/i,a=A.current.phases;let r=a.length-1;for(let e=0;e<a.length;e++){if(l<=se[e]+ne(a[e])){r=e;break}}const c=r<=t.from?se[r]:se[r]+ne(a[r]);F(c),r!==t.from&&(((e,t)=>{const n=[...A.current.phases];if(e<0||e>=n.length||t<0||t>=n.length||e===t)return;const[s]=n.splice(e,1);n.splice(t,0,s);const i={...A.current,phases:n};A.current=i,u(i)})(t.from,r),t.from=r)},t=()=>{const e=M.current;e&&(M.current=null,document.body.classList.remove("timeline-phase-dragging"),Y(null),F(null),null!=e.snapshot&&e.snapshot!==(0,r.vE)(A.current)&&(J(e.snapshot),G(!0)))};return document.addEventListener("pointermove",e),document.addEventListener("pointerup",t),document.addEventListener("pointercancel",t),()=>{document.removeEventListener("pointermove",e),document.removeEventListener("pointerup",t),document.removeEventListener("pointercancel",t)}},[se,J]);const ie=(e,t,s)=>{if(!q.current)return;if(0!==e.button)return;e.target.closest("input, textarea, button, select, [data-event-width], [data-event-link]")||(e.stopPropagation(),$("event"),L(n.phases[t].events[s].id))},le=(e,t)=>{if(!q.current)return;const n=A.current.phases[t];if(!n)return;const s="vertical"===A.current.layout.direction,i=K.current;let l=n.head_width??0;if(!l){const t=e.currentTarget.closest(".timeline-phase__head");t&&(l=t.getBoundingClientRect().width/i)}const a=s?e.clientX:e.clientY,c=n.id,o=(0,r.vE)(A.current),d=e=>{let t=((s?e.clientX:e.clientY)-a)/i;s&&(t=-t);const n=Math.round((0,r.$4)(l+t,80,1200,l)),o={...A.current,phases:A.current.phases.map(e=>e.id===c?{...e,head_width:n}:e)};A.current=o,u(o)},m=()=>{document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",m),o!==(0,r.vE)(A.current)&&(J(o),G(!0))};document.addEventListener("pointermove",d),document.addEventListener("pointerup",m)},ae=(e,t,n,s)=>{if(!q.current)return;const i=A.current.phases[t]?.events[n];if(!i)return;const l="vertical"===A.current.layout.direction,a=K.current;let c=i.width??0;if(!c){const t=e.currentTarget.closest(".timeline-event");t&&(c=t.getBoundingClientRect().width/a)}const o=l?e.clientX:e.clientY,d=i.id,m=(0,r.vE)(A.current),h=e=>{let t=((l?e.clientX:e.clientY)-o)/a;"left"===s&&(t=-t);const n=Math.round((0,r.$4)(c+t,80,1200,c)),i={...A.current,phases:A.current.phases.map(e=>({...e,events:e.events.map(e=>e.id===d?{...e,width:n}:e)}))};A.current=i,u(i)},p=()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",p),m!==(0,r.vE)(A.current)&&(J(m),G(!0))};document.addEventListener("pointermove",h),document.addEventListener("pointerup",p)},re=(e,t,n,s)=>{if(!q.current)return;const i=A.current.phases[t]?.events[n];if(!i)return;const l="vertical"===A.current.layout.direction,a=K.current,c=i.link_length??42,o=l?e.clientX:e.clientY,d=i.id,m=(0,r.vE)(A.current),h=e=>{let t=((l?e.clientX:e.clientY)-o)/a;"left"===s&&(t=-t);const n=(0,r.$4)(c+t,8,800,c),i={...A.current,phases:A.current.phases.map(e=>({...e,events:e.events.map(e=>e.id===d?{...e,link_length:n}:e)}))};A.current=i,u(i)},p=()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",p),m!==(0,r.vE)(A.current)&&(J(m),G(!0))};document.addEventListener("pointermove",h),document.addEventListener("pointerup",p)};(0,s.useEffect)(()=>{const e=T.current;if(!e)return;const t=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=e.deltaY>0?-.1:.1;b(e=>(0,r.$4)(Number((e+t).toFixed(2)),.3,3,1))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);const ce=e=>{W({...A.current,layout:{...A.current.layout,...e}})},oe=e=>{const t=(0,r.$4)(Number(e.toFixed(2)),.3,3,1);b(t),q.current&&ce({zoom:t})},de=(e,t)=>{W({...A.current,phases:A.current.phases.map(n=>({...n,events:n.events.map(n=>n.id===e?{...n,...t}:n)}))})},ue=(e,t)=>{H({...A.current,phases:A.current.phases.map(n=>n.id===e?{...n,...t}:n)})},me=(e,t)=>{const n=A.current.phases,s=n.findIndex(t=>t.id===e);if(s<0)return;const i="before"===t?s:s+1,l=[...n];l.splice(i,0,(0,r.vT)(i)),H({...A.current,phases:l})},he=(e,t)=>{const n=[...A.current.phases],s=n.findIndex(t=>t.id===e),i=s+t;s<0||i<0||i>=n.length||([n[s],n[i]]=[n[i],n[s]],W({...A.current,phases:n}))},pe=(e,t)=>{W({...A.current,phases:A.current.phases.map(n=>{const s=n.events.findIndex(t=>t.id===e),i=s+t;if(s<0||i<0||i>=n.events.length)return n;const l=[...n.events];return[l[s],l[i]]=[l[i],l[s]],{...n,events:l}})})},_e=e=>{q.current&&(M.current={from:e,snapshot:(0,r.vE)(A.current)},Y(A.current.phases[e]?.id??null),document.body.classList.add("timeline-phase-dragging"))},ve=e=>{const t=A.current.phases.find(t=>t.id===e);if(!t)return;const n=t.events.filter(e=>"left"===e.side).length,s=n<=t.events.length-n?"left":"right",i=(0,r.IG)(s,.5),l=A.current.phases.map(t=>t.id===e?{...t,events:[...t.events,i]}:t);W({...A.current,phases:l}),$("event"),L(i.id)},xe=e=>{W({...A.current,phases:A.current.phases.map(t=>({...t,events:t.events.filter(t=>t.id!==e)}))}),L(t=>t===e?null:t)},be=e=>{$("phase"),L(e)},ge=e=>{W({...A.current,phases:A.current.phases.filter(t=>t.id!==e)}),L(t=>t===e?null:t)},fe=()=>{const e=P.current.props.url??"";let t=e;const n=e.indexOf("?");if(n>=0){t=new URLSearchParams(e.slice(n+1)).get("file")||""}t||(t=e.split("?")[0]);let s=t.split("/").filter(Boolean).pop()??"";for(let e=0;e<2;e++)try{const e=decodeURIComponent(s);if(e===s)break;s=e}catch{break}return s.replace(/\.timeline$/,"")||"timeline"};(0,s.useEffect)(()=>{const e=S.current,t=T.current;if(!e||!t||"vertical"!==n.layout.direction)return;e.style.setProperty("--side-scroll","0px");const s=t.clientWidth/2,i=t.getBoundingClientRect().left+s;let l=0;e.querySelectorAll(".timeline-event").forEach(e=>{const t=e.getBoundingClientRect();l=Math.max(l,i-t.left,t.right-i)}),e.style.setProperty("--side-scroll",`${Math.max(120,Math.ceil(l)+40)}px`)},[n.phases,n.layout.direction,n.layout.card_style,n.layout.node_style,x]);const je=(0,s.useRef)(0);(0,s.useEffect)(()=>{const e=e=>{const t=e.target;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))return;const n=e.ctrlKey||e.metaKey;return!n||"s"!==e.key&&"S"!==e.key?!n||"z"!==e.key&&"Z"!==e.key?!n||"y"!==e.key&&"Y"!==e.key?void(("Delete"===e.key||"Backspace"===e.key)&&E&&"event"===R&&q.current&&(e.preventDefault(),xe(E))):(e.preventDefault(),e.stopPropagation(),void Q()):(e.preventDefault(),e.stopPropagation(),void(e.shiftKey?Q():V())):(e.preventDefault(),e.stopPropagation(),void ee())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[E,R]);const ye="event"===R&&E?(e=>{for(const t of n.phases){const n=t.events.find(t=>t.id===e);if(n)return{event:n,phase:t}}return null})(E):null,Ne="phase"===R&&E?n.phases.find(e=>e.id===E)??null:null,we=n.layout,ke=n.phases.length>0&&n.phases.every(e=>e.collapsed);return(0,o.jsxs)("div",{className:`timeline-wrap${e.fullscreen?" timeline-wrap--full":""}${e.readonly?" timeline-wrap--readonly":""}`,children:[e.header,!e.readonly&&(0,o.jsxs)("div",{className:"timeline-toolbar",children:[(0,o.jsx)("button",{type:"button",className:"timeline-btn"+(k?" timeline-btn--on":""),title:t(k?"退出编辑模式":"进入编辑模式"),onClick:()=>C(e=>!e),children:(0,o.jsx)("span",{className:"material-icons",children:k?"edit":"visibility"})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t(ke?"展开全部阶段":"折叠全部阶段"),onClick:()=>{const e=A.current.phases.some(e=>!e.collapsed);H({...A.current,phases:A.current.phases.map(t=>({...t,collapsed:e}))})},children:(0,o.jsx)("span",{className:"material-icons",children:ke?"unfold_more":"unfold_less"})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("阶段倒置"),onClick:()=>{const e=[...A.current.phases].reverse();H({...A.current,phases:e})},children:(0,o.jsx)("span",{className:"material-icons",children:"swap_vert"})}),k&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("添加阶段"),onClick:()=>{const e=A.current.phases.length;W({...A.current,phases:[...A.current.phases,(0,r.vT)(e)]})},children:(0,o.jsx)("span",{className:"material-icons",children:"add_box"})})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("导出 SVG"),onClick:()=>{const e=(0,r.Ao)(A.current),t=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=fe()+".svg",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)},children:(0,o.jsx)("span",{className:"material-icons",children:"download"})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("导出图片"),onClick:()=>{const e=(0,r.Ao)(A.current),n=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),s=URL.createObjectURL(n),i=new Image;i.onload=()=>{const e=document.createElement("canvas");e.width=2*i.width||1200,e.height=2*i.height||800;const t=e.getContext("2d");t&&(t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.drawImage(i,0,0,e.width,e.height),e.toBlob(e=>{if(!e)return;const t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=fe()+".png",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},"image/png")),URL.revokeObjectURL(s)},i.onerror=()=>{(0,l.zN)(t("导出图片失败")),URL.revokeObjectURL(s)},i.src=s},children:(0,o.jsx)("span",{className:"material-icons",children:"image"})}),k&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"timeline-toolbar__divider"}),(0,o.jsxs)("div",{className:"timeline-seg",children:[(0,o.jsx)("button",{type:"button",className:"timeline-seg__btn"+(Z?" timeline-seg__btn--on":""),title:t("纵向"),onClick:()=>{Z||ce({direction:"vertical"})},children:(0,o.jsx)("span",{className:"material-icons",children:"swap_vert"})}),(0,o.jsx)("button",{type:"button",className:"timeline-seg__btn"+(Z?"":" timeline-seg__btn--on"),title:t("横向"),onClick:()=>{Z&&ce({direction:"horizontal"})},children:(0,o.jsx)("span",{className:"material-icons",children:"swap_horiz"})})]}),(0,o.jsxs)("label",{className:"timeline-toolbar__select",title:t("节点样式"),children:[(0,o.jsx)("span",{className:"material-icons",children:"radio_button_checked"}),(0,o.jsxs)("select",{value:we.node_style,onChange:e=>ce({node_style:e.target.value}),children:[(0,o.jsx)("option",{value:"dot",children:t("圆点")}),(0,o.jsx)("option",{value:"circle",children:t("圆形")}),(0,o.jsx)("option",{value:"square",children:t("方形")}),(0,o.jsx)("option",{value:"image",children:t("图片")})]})]}),(0,o.jsxs)("label",{className:"timeline-toolbar__select",title:t("卡片样式"),children:[(0,o.jsx)("span",{className:"material-icons",children:"crop_square"}),(0,o.jsxs)("select",{value:we.card_style,onChange:e=>ce({card_style:e.target.value}),children:[(0,o.jsx)("option",{value:"card",children:t("卡片")}),(0,o.jsx)("option",{value:"plain",children:t("朴素")}),(0,o.jsx)("option",{value:"bubble",children:t("气泡")})]})]}),(0,o.jsxs)("label",{className:"timeline-toolbar__select",title:t("连线风格"),children:[(0,o.jsx)("span",{className:"material-icons",children:"linear_scale"}),(0,o.jsxs)("select",{value:we.line_style,onChange:e=>ce({line_style:e.target.value}),children:[(0,o.jsx)("option",{value:"solid",children:t("实线")}),(0,o.jsx)("option",{value:"dashed",children:t("虚线")}),(0,o.jsx)("option",{value:"dotted",children:t("点线")})]})]}),(0,o.jsx)("button",{type:"button",className:"timeline-btn"+(we.show_connector?" timeline-btn--on":""),title:t("显示连线"),onClick:()=>ce({show_connector:!we.show_connector}),children:(0,o.jsx)("span",{className:"material-icons",children:"timeline"})})]}),(0,o.jsx)("span",{className:"timeline-toolbar__gap"}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("撤销")+" (Ctrl+Z)","data-tick":O,disabled:0===U.current.length,onClick:V,children:(0,o.jsx)("span",{className:"material-icons",children:"undo"})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("重做")+" (Ctrl+Y)",disabled:0===D.current.length,onClick:Q,children:(0,o.jsx)("span",{className:"material-icons",children:"redo"})}),(0,o.jsxs)("span",{className:"timeline-toolbar__zoom",children:[Math.round(100*x),"%"]}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("缩小"),onClick:()=>oe(x-.1),children:(0,o.jsx)("span",{className:"material-icons",children:"remove"})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("放大"),onClick:()=>oe(x+.1),children:(0,o.jsx)("span",{className:"material-icons",children:"add"})}),(0,o.jsx)("button",{type:"button",className:"timeline-btn",title:t("重置缩放"),onClick:()=>oe(1),children:(0,o.jsx)("span",{className:"material-icons",children:"restart_alt"})})]}),(0,o.jsxs)("div",{className:"timeline-body",children:[(0,o.jsx)("div",{className:`timeline-canvas timeline-canvas--${we.direction}`,ref:T,onScroll:()=>{q.current&&(window.clearTimeout(je.current),je.current=window.setTimeout(()=>{const e=T.current;if(!e)return;const t=Math.round(e.scrollLeft/K.current),n=Math.round(e.scrollTop/K.current),s=A.current.layout;if(s.scroll_x===t&&s.scroll_y===n)return;const i={...A.current,layout:{...s,scroll_x:t,scroll_y:n}};A.current=i,u(i),G(!0)},250))},children:(0,o.jsxs)("div",{className:"timeline-inner",ref:S,style:{"--zoom":x},children:[null!==X&&(0,o.jsx)("div",{className:"timeline-drop",style:Z?{top:`${X}px`}:{left:`${X}px`}}),n.phases.map((e,n)=>(0,o.jsx)(p,{phase:e,phase_index:n,layout:we,zoom:x,vertical:Z,selected_id:E,on_event_down:ie,on_width_down:ae,on_link_down:re,on_add_event:ve,on_delete_event:xe,on_update_phase:ue,on_delete_phase:ge,on_select_phase:be,head_height:g[e.id],on_head_height:j,on_phase_width_down:le,event_heights:y,on_event_height:w,edit_mode:k,on_phase_drag_start:_e,drag_phase_id:B,t},e.id))]})}),k&&!e.readonly&&Ne&&(0,o.jsxs)("div",{className:"timeline-panel",children:[(0,o.jsxs)("div",{className:"timeline-panel__title",children:[(0,o.jsx)("span",{className:"material-icons",children:"layers"}),(0,o.jsx)("span",{children:t("阶段")}),(0,o.jsx)("span",{className:"material-icons timeline-panel__close",title:t("关闭"),onClick:()=>L(null),children:"close"})]}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("名称")}),(0,o.jsx)(c.Z2,{width:"100%",readOnly:!k,value:Ne.name,handleInputChange:e=>ue(Ne.id,{name:e})}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("描述")}),(0,o.jsx)(c.Z2,{width:"100%",readOnly:!k,value:Ne.desc??"",handleInputChange:e=>ue(Ne.id,{desc:e})}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("颜色")}),(0,o.jsxs)("div",{className:"timeline-panel__colors",children:[r.Tw.map(e=>(0,o.jsx)("span",{className:"timeline-swatch",style:{background:e},onClick:()=>ue(Ne.id,{color:e})},e)),(0,o.jsx)("label",{className:"timeline-swatch timeline-swatch--pick",title:t("自定义颜色"),children:(0,o.jsx)("input",{type:"color",value:Ne.color||we.axis_color,onChange:e=>ue(Ne.id,{color:e.target.value})})})]}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("阶段头")}),(0,o.jsxs)("div",{className:"timeline-panel__seg",children:[(0,o.jsx)("button",{type:"button",className:"timeline-seg__btn"+(!1!==Ne.head_visible?" timeline-seg__btn--on":""),onClick:()=>ue(Ne.id,{head_visible:!0}),children:t("显示")}),(0,o.jsx)("button",{type:"button",className:"timeline-seg__btn"+(!1===Ne.head_visible?" timeline-seg__btn--on":""),onClick:()=>ue(Ne.id,{head_visible:!1}),children:t("隐藏")})]}),(0,o.jsx)("div",{className:"timeline-panel__hint",children:t("拖动阶段头可调整顺序")}),(0,o.jsxs)("div",{className:"timeline-panel__insert",children:[(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>me(Ne.id,"before"),children:[(0,o.jsx)("span",{className:"material-icons",children:"vertical_align_top"}),t("在阶段前插入")]}),(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>me(Ne.id,"after"),children:[(0,o.jsx)("span",{className:"material-icons",children:"vertical_align_bottom"}),t("在阶段后插入")]})]}),(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>ve(Ne.id),children:[(0,o.jsx)("span",{className:"material-icons",children:"add_circle"}),t("添加事件")]}),(0,o.jsxs)("div",{className:"timeline-panel__insert",children:[(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>he(Ne.id,-1),children:[(0,o.jsx)("span",{className:"material-icons",children:"arrow_upward"}),t("上移")]}),(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>he(Ne.id,1),children:[(0,o.jsx)("span",{className:"material-icons",children:"arrow_downward"}),t("下移")]})]}),(0,o.jsxs)("button",{type:"button",className:"timeline-panel__del",onClick:()=>ge(Ne.id),children:[(0,o.jsx)("span",{className:"material-icons",children:"delete"}),t("删除阶段")]})]}),k&&!e.readonly&&ye&&(0,o.jsxs)("div",{className:"timeline-panel",children:[(0,o.jsxs)("div",{className:"timeline-panel__title",children:[(0,o.jsx)("span",{className:"material-icons",children:"edit"}),(0,o.jsx)("span",{children:t("事件")}),(0,o.jsx)("span",{className:"material-icons timeline-panel__close",title:t("关闭"),onClick:()=>L(null),children:"close"})]}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("标题")}),(0,o.jsx)(c.Sm,{width:"100%",value:ye.event.title,handleInputChange:e=>de(ye.event.id,{title:e})}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("描述")}),(0,o.jsx)(c.Z2,{width:"100%",readOnly:!k,value:ye.event.desc??"",handleInputChange:e=>de(ye.event.id,{desc:e})}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("时间")}),(0,o.jsxs)("div",{className:"timeline-panel__times",children:[(0,o.jsx)(c.Sm,{width:"100%",value:ye.event.startTime??"",placeholder:t("起始时间"),handleInputChange:e=>de(ye.event.id,{startTime:e})}),(0,o.jsx)(c.Sm,{width:"100%",value:ye.event.endTime??"",placeholder:t("结束时间"),handleInputChange:e=>de(ye.event.id,{endTime:e})})]}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("图片地址")}),(0,o.jsx)(c.Sm,{width:"100%",value:ye.event.image??"",placeholder:"https://...",handleInputChange:e=>de(ye.event.id,{image:e})}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("方向")}),(0,o.jsxs)("div",{className:"timeline-panel__seg",children:[(0,o.jsx)("button",{type:"button",className:"timeline-seg__btn"+("left"===ye.event.side?" timeline-seg__btn--on":""),onClick:()=>de(ye.event.id,{side:"left"}),children:t(Z?"左侧":"上侧")}),(0,o.jsx)("button",{type:"button",className:"timeline-seg__btn"+("right"===ye.event.side?" timeline-seg__btn--on":""),onClick:()=>de(ye.event.id,{side:"right"}),children:t(Z?"右侧":"下侧")})]}),(0,o.jsx)("label",{className:"timeline-panel__label",children:t("颜色")}),(0,o.jsxs)("div",{className:"timeline-panel__colors",children:[(0,o.jsx)("span",{className:"timeline-swatch timeline-swatch--auto",title:t("跟随阶段"),onClick:()=>de(ye.event.id,{color:""})}),r.Tw.map(e=>(0,o.jsx)("span",{className:"timeline-swatch",style:{background:e},onClick:()=>de(ye.event.id,{color:e})},e)),(0,o.jsx)("label",{className:"timeline-swatch timeline-swatch--pick",title:t("自定义颜色"),children:(0,o.jsx)("input",{type:"color",value:ye.event.color||Ne?.color||we.axis_color,onChange:e=>de(ye.event.id,{color:e.target.value})})})]}),(0,o.jsx)("div",{className:"timeline-panel__hint",children:t("用上移下移调整事件顺序,用左右切换事件所在侧")}),(0,o.jsxs)("div",{className:"timeline-panel__insert",children:[(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>pe(ye.event.id,-1),children:[(0,o.jsx)("span",{className:"material-icons",children:"arrow_upward"}),t("上移")]}),(0,o.jsxs)("button",{type:"button",className:"timeline-panel__add",onClick:()=>pe(ye.event.id,1),children:[(0,o.jsx)("span",{className:"material-icons",children:"arrow_downward"}),t("下移")]})]}),(0,o.jsxs)("button",{type:"button",className:"timeline-panel__del",onClick:()=>xe(ye.event.id),children:[(0,o.jsx)("span",{className:"material-icons",children:"delete"}),t("删除事件")]})]})]}),m&&(0,o.jsx)("div",{className:"timeline-mask",children:"Loading..."}),_&&(0,o.jsx)("div",{className:"timeline-mask",children:_})]})}function p(e){const{phase:t,layout:n,zoom:i,vertical:l,selected_id:a,t:r}=e,c=t.color||n.axis_color,m=!!t.collapsed,h=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{const n=h.current;if(!n||!1===t.head_visible)return;const s=()=>e.on_head_height(t.id,n.offsetHeight);s();const i=new ResizeObserver(s);return i.observe(n),()=>i.disconnect()},[t.id,t.name,t.desc,t.head_visible]);const p=e.head_height??d,v=(()=>{const s=l?96:240,i={left:0,right:0};return t.events.forEach((t,l)=>{const a=n.alternate?l%2==0?"left":"right":t.side;i[a]+=(e.event_heights[t.id]??s)+12}),u+p+6+Math.max(i.left,i.right)})(),x=m?Math.max(d,u+p+6)+10:v,b="solid"===n.line_style?{background:c}:{borderColor:c,borderStyle:(g=n.line_style,"dashed"===g?"dashed":"dotted"===g?"dotted":"solid")};var g;return(0,o.jsxs)("div",{className:`timeline-phase${m?" timeline-phase--collapsed":""}${e.drag_phase_id===t.id?" timeline-phase--dragging":""}`,style:l?{height:`${x}px`}:{width:`${x}px`},children:[(0,o.jsx)("div",{className:"timeline-phase__band",style:b}),!1!==t.head_visible&&(0,o.jsxs)("div",{className:"timeline-phase__head",ref:h,style:{borderColor:c,...t.head_width?{width:t.head_width,maxWidth:"none"}:{}},onPointerDown:n=>{const s=n.target;s.closest(".timeline-phase__op")||s.closest(".timeline-phase__drag")||s.closest(".timeline-phase__toggle")||e.on_select_phase(t.id)},children:[(0,o.jsx)("span",{className:"material-icons timeline-phase__drag",title:r("拖动排序"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_phase_drag_start(e.phase_index)},children:"drag_indicator"}),(0,o.jsx)("span",{className:"material-icons timeline-phase__toggle",title:r(m?"展开":"折叠"),onClick:()=>e.on_update_phase(t.id,{collapsed:!m}),children:m?"expand_more":"expand_less"}),(0,o.jsx)("div",{className:"timeline-phase__name",style:{color:c},title:t.name,children:t.name}),t.desc&&(0,o.jsx)("div",{className:"timeline-phase__desc",title:t.desc,children:t.desc}),(0,o.jsx)("div",{className:"timeline-phase__width","data-phase-width":t.id,title:r("拖动调整宽度"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_phase_width_down(t,e.phase_index)}})]}),!m&&(0,o.jsxs)(o.Fragment,{children:[!1===t.head_visible&&(0,o.jsx)("span",{className:"material-icons timeline-phase__show-head",title:r("显示阶段头"),onClick:()=>e.on_update_phase(t.id,{head_visible:!0}),children:"visibility"}),(()=>{const c=e=>n.alternate?e%2==0?"left":"right":t.events[e].side,d=l?96:240,m=t=>e.event_heights[t]??d,h={left:0,right:0},v=t.events.map((e,t)=>{const n=c(t),s=h[n];return h[n]=s+m(e.id)+12,s});return t.events.map((d,h)=>{const x=c(h),b=u+p+6+v[h]+m(d.id)/2,g=n.node_style;return(0,o.jsxs)(s.Fragment,{children:[d.startTime&&(0,o.jsx)("div",{className:`timeline-event__time timeline-event__time--start timeline-event--node-${g}`,style:l?{top:b}:{left:b},children:d.startTime}),d.endTime&&(0,o.jsx)("div",{className:`timeline-event__time timeline-event__time--end timeline-event--node-${g}`,style:l?{top:b}:{left:b},children:d.endTime}),(0,o.jsx)(_,{event:d,phase:t,layout:n,vertical:l,zoom:i,side:x,along:v[h],head_size:p,on_height:t=>e.on_event_height(d.id,t),event_index:h,phase_index:e.phase_index,selected:a===d.id,on_down:e.on_event_down,on_width_down:e.on_width_down,on_link_down:e.on_link_down,on_delete:e.on_delete_event,t:r})]},d.id)})})()]})]})}function _(e){const{event:t,phase:n,layout:i,vertical:l,zoom:a,side:r,selected:c,t:h}=e,p=t.color||n.color||i.axis_color,_=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{const t=_.current;if(!t||!e.on_height)return;const n="vertical"===i.direction,s=()=>{const s=t.getBoundingClientRect(),i=Math.round((n?s.height:s.width)/a);i>0&&e.on_height(i)};s();const l=new ResizeObserver(s);l.observe(t);const r=window.setTimeout(s,300);return()=>{l.disconnect(),window.clearTimeout(r)}},[t.title,t.desc,t.image,t.width,a,i.direction,e.on_height]);const v=`${u+(e.head_size??d)+6+e.along}px`,x={"--ev-color":p};null!=t.link_length&&(x["--side-gap"]=`${t.link_length}px`);const b=l?{top:v}:{left:v};return t.width&&(b.width=`${t.width}px`),(0,o.jsxs)("div",{className:`timeline-event timeline-event--${i.card_style} timeline-event--side-${r} timeline-event--node-${i.node_style}`+(c?" timeline-event--on":"")+(i.show_connector?" timeline-event--linked":""),ref:_,style:{...b,...x,borderColor:p},onPointerDown:t=>e.on_down(t,e.phase_index,e.event_index),children:[i.show_connector&&(0,o.jsx)("div",{className:"timeline-event__link",style:{borderColor:p,borderStyle:i.line_style}}),(0,o.jsx)("div",{className:`timeline-node ${m(i.node_style)}`,style:{background:"image"===i.node_style&&t.image?"transparent":p},children:"image"===i.node_style&&t.image?(0,o.jsx)("img",{src:t.image,alt:""}):null}),(0,o.jsxs)("div",{className:"timeline-event__body",children:[(0,o.jsx)("div",{className:"timeline-event__title",style:{color:p},children:t.title||h("未命名")}),t.desc&&(0,o.jsx)("div",{className:"timeline-event__desc",children:t.desc})]}),(0,o.jsx)("div",{className:"timeline-event__width","data-event-width":t.id,title:h("拖动调整卡片宽度"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_width_down(t,e.phase_index,e.event_index,r)}}),i.show_connector&&(0,o.jsx)("div",{className:"timeline-event__link-handle","data-event-link":t.id,title:h("拖动调整连线长度"),onPointerDown:t=>{t.stopPropagation(),t.preventDefault(),e.on_link_down(t,e.phase_index,e.event_index,r)}}),(0,o.jsx)("span",{className:"material-icons timeline-event__del",title:h("删除事件"),onClick:n=>{n.stopPropagation(),e.on_delete(t.id)},children:"close"})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9299],{47374(e,t,i){i.d(t,{e:()=>p});var n=i(96540),s=i(61973),o=i(64694),a=i(34289),l=i(61443),r=i(75725),c=i(22022),d=i(85997),_=i(74848);function p(e){let t=(0,s.zy)();const[i,p]=(0,n.useState)([]),[f,h]=(0,n.useState)("/"),[u,m]=(0,n.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const n=i.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(i.slice(0,n),e.baseRoute);const a=i.slice(n+1);for(let e=0;e<a.length;e++){const i=a[e];s.push({value:i,href:0===e?`${t}${i}/`:(0,o.IO)(s[e-1].href,i)})}h(t),p(s)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:f,onClick:g,children:(0,_.jsx)(d.In,{icon:"home"})})}),i.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,i){i.d(t,{S:()=>l,X:()=>a});var n=i(96540),s=i(61443),o=i(74848);function a(e){const[t,i]=n.useState([]),a=(0,n.useRef)(-1),[l,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?i(Array.isArray(e.children)?e.children:[e.children]):i(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,i)=>{const n=!!e.filter&&(e.filter.column??0)===i;let a=t;if(n){const i=e.filter,n=i.options.find(e=>e.value===i.value);null!=i.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},i)})})}),(0,o.jsx)("tbody",{children:t.map((t,i)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===i?"row-dragging":"")+(c===i?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=i,r(i),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(i))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,i=c;_(),t<0||i<0||t===i||e.onRowDrag?.(t,i)})())},onDragEnd:_,children:t.map((i,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:i},n)})},i)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},19299(e,t,i){i.r(t),i.d(t,{default:()=>q});var n=i(96540),s=i(47374),o=i(34843),a=i(82893),l=i(14284),r=i(61973),c=i(4412),d=i(89824),_=i(34289),p=i(53459),f=i(99214),h=i(61443),u=i(47022),m=i(62042),w=i(22022),v=i(7523),g=i(78247),x=i(88815),y=i(6960),j=i(47071),k=i(14944),G=i(92275),A=i(23430);var b=i(34251),C=i(60096),S=i(87361),M=i(76559),$=i(85997),z=i(77481),D=i(70447),N=i(74848);const P=500;function E(e){const{t}=(0,w.Bd)(),i=(0,r.Zp)(),[,s]=(0,o.fp)(a.AG.prompt_card),[l,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(!1),[p,f]=(0,n.useState)([]),[u,m]=(0,n.useState)(0),[v,g]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>new M.I(window.location.host,"file_deep_search"),[]),y=(0,n.useRef)(!1),j=decodeURIComponent(e.base_path);(0,n.useEffect)(()=>{let e=[],t=null;const i=()=>{if(t=null,y.current||!e.length)return;const i=e;e=[],m(e=>e+i.length),f(e=>e.length>=P?e:[...e,...i].slice(0,P))},n=()=>{y.current||_(!1)};return x.addMsg(G.HK.file_deep_search_data,n=>{y.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(i,100)))}),x.addMsg(G.HK.file_deep_search_end,()=>{y.current||(i(),_(!1))}),x.on_message("close",n),()=>{y.current=!0,clearTimeout(t),x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",n),x.close()}},[]);const k=()=>{const t=l.trim();if(!t||d)return;f([]),m(0),g(!0),_(!0);const i={param_path:e.base_path,keyword:t};x.sendData(G.HK.file_deep_search,i).catch(()=>{})},A=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),i(S.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,N.jsxs)("div",{className:"file-deep-search",children:[(0,N.jsxs)("div",{className:"file-deep-search__bar",children:[(0,N.jsx)(h.$Z,{icon:"search",value:l,placeholder:t("搜文件名"),handleInputChange:e=>c(e),handleEnterPress:k}),(0,N.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,N.jsxs)("div",{className:"file-deep-search__hint",children:[(0,N.jsxs)("span",{children:[t("范围"),":",j]}),u>0&&(0,N.jsx)("span",{className:"file-deep-search__count",children:u>P?`${t("已显示")} 500 / ${u}`:`${u}`})]}),(0,N.jsxs)("div",{className:"file-deep-search__body",children:[p.length>0&&(0,N.jsx)(z.X,{headers:[t("名称"),t("路径"),""],rows:p.map(e=>{const i=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,N.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,N.jsx)(D.xP,{context:i}),(0,N.jsx)($.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>A(e)})]})}),d&&(0,N.jsxs)("div",{className:"file-deep-search__empty",children:[(0,N.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&u>P&&(0,N.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===p.length&&(0,N.jsx)("div",{className:"file-deep-search__empty",children:t(v?"无匹配":"输入后搜")})]})]})}var F=i(64694),I=i(23496),X=i(12730),R=i(75725),K=i(40505);let L={};function H(){const{t:e}=(0,w.Bd)();let t=(0,r.zy)();const i=(0,r.Zp)(),{check_user_auth:s}=(0,g.MH)(),[c,p]=(0,o.fp)(a.AG.nowFileList),[h,x]=(0,o.fp)(a.AG.uploadFiles),[y,j]=(0,o.fp)(a.AG.showPrompt),[C,M]=(0,o.fp)(a.AG.selectedFileList),[z,P]=(0,o.fp)(a.AG.copyedFileList),[E,I]=(0,o.fp)(a.AG.cutedFileList),[K,H]=(0,o.fp)(a.AG.selectedFileList),[U,Y]=(0,o.fp)(a.AG.clickFileList),[B,O]=(0,o.fp)(a.AG.fileShellShow),[Z]=(0,o.fp)(a.AG.current_mount),[W,T]=(0,o.fp)(a.AG.file_root_list),[V,q]=(0,o.fp)(a.AG.file_root_index),[J,Q]=(0,n.useState)(void 0),[ee,te]=(0,n.useState)(""),[ie,ne]=(0,o.fp)(a.AG.workflow_show),[se,oe]=(0,o.fp)(a.AG.workflow_realtime_show),[ae,le]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:re}=(0,n.useContext)(v.F),[ce,de]=(0,o.fp)(a.AG.user_base_info),{click_file:_e}=(0,f.kZ)(),[pe,fe]=(0,o.fp)(a.AG.prompt_card),he=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type!==u.Iw.folder?1:0),0),[c]),ue=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type===u.Iw.folder?1:0),0)+(c.folders?.length??0),[c]);function me(e){(0,m.SK)(e)}(0,n.useEffect)(()=>{L={}},[t]),(0,n.useEffect)(()=>()=>{O({show:!1,path:""})},[]);const we=(0,f.Vs)(),ve=t=>{fe({open:!0,title:e("信息"),context_div:(0,N.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,N.jsx)(R.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,N.jsx)(R.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,N.jsx)(R.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,N.jsx)(R.Yh,{left:`${e("文件夹数")}`,right:ue}),(0,N.jsx)(R.Yh,{left:`${e("文件数")}`,right:he}),(0,N.jsx)(R.Yh,{left:`${e("当前位置")}`,right:(0,N.jsx)(D.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{k.ws.removeMsg(G.HK.file_info)}})};return(0,N.jsxs)(n.Fragment,{children:[C.length>0&&(0,N.jsx)($.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:d.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),C.length>0&&(0,N.jsx)($.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,f.ib)(c,C);P(e.map(e=>(0,f.Ok)(e.name))),I([]),me("已复制")}}),C.length>0&&(0,N.jsx)($.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,f.ib)(c,C);I(e.map(e=>(0,f.Ok)(e.name))),P([]),me("已剪切")}}),(z.length>0||E.length>0)&&(0,N.jsx)($.rA,{onClick:function(){j({show:!0,type:d.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:z.length+E.length}),C.length>0&&(0,N.jsx)($.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,f.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,f.Ok)(i.name))}const t=l.$M.getDownloadUrl(e);window.open(t)}}),C.length>0&&(0,N.jsx)($.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,f.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,f.Ok)(i.name)}e&&0!==e.length?j({show:!0,type:d.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,m.zN)("没有选中")}}),1===C.length&&(0,N.jsx)($.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:d.PromptEnum.FileRename,overlay:!0,data:{}})}}),ae&&(0,N.jsx)($.rA,{icon:"api",title:"workflow",onClick:()=>{ne(!ie)}}),!Z&&(0,N.jsx)($.rA,{icon:"terminal",title:"shell",onClick:function(){B.show?O({show:!1,path:""}):O({show:!0,path:(0,_.GG)("file",(0,_.vX)())})}}),s(A.oV.share_file)&&(0,N.jsx)($.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${S.o.share_list_setting_page}`)}}),(0,N.jsx)($.rA,{icon:"grid_view",title:e("切换样式"),onClick:we}),(0,N.jsx)($.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:d.PromptEnum.DirNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,N.jsx)($.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:d.PromptEnum.FileNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,N.jsx)($.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:d.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=i?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,i&&s.add((0,X.S)(a)),n.push(o)}const o=[];if(i)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...n),x(o),j({show:!0,type:d.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,N.jsx)($.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!L.now_absolute_path){k.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(L={...L,...i},k.ws.removeMsg(G.HK.file_info),ve(L))});const t=await k.ws.sendData(G.HK.file_info,{type:u.Iw.folder,path:(0,_.GG)("file",(0,_.vX)())});e=t.context,L=e,ve(L)}ve(L)}}),(0,N.jsx)($.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory,n.items=W,n.item_pre_value=V,n.textClick=async t=>{if(t.type===b.LU.add)return i(`${S.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,m.N9)(e("请配置 文件夹路径"));j({data:void 0,overlay:!1,type:"",show:!1}),t.type!==b.LU.child?(async e=>{q(e),await l.$M.post("base_switch",{root_index:e}),await re(),i("/file/"),H([]),Y([])})(t.index):i((0,F.IO)(S.o.file,t.rel))},j({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var U=i(2543),Y=i(21499),B=i(17903);const O=n.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),Z=n.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636))),W=n.lazy(()=>Promise.all([i.e(4946),i.e(2626),i.e(892),i.e(9334),i.e(6104)]).then(i.bind(i,69857)));let T,V="";function q(){const[e,t]=(0,o.fp)(a.AG.editorSetting),[,i]=(0,o.fp)(a.AG.md_editor),[,m]=(0,o.fp)(a.AG.log_viewer),[,M]=(0,o.fp)(a.AG.image_editor),[,z]=(0,o.fp)(a.AG.markdown),[,D]=(0,o.fp)(a.AG.excalidraw_editor),[,P]=(0,o.fp)(a.AG.mind_editor),[,X]=(0,o.fp)(a.AG.timeline_editor),[,R]=(0,o.fp)(a.AG.excel_editor),[L,q]=(0,o.fp)(a.AG.file_preview),{t:J}=(0,w.Bd)();let Q=(0,r.zy)();const ee=(0,r.Zp)(),[te,ie]=(0,o.fp)(a.AG.nowFileList),[ne]=(0,o.fp)(a.AG.file_list_refresh),[se]=(0,o.fp)(a.AG.mount_enabled),[oe,ae]=(0,o.fp)(a.AG.current_mount),[le,re]=(0,o.fp)(a.AG.showPrompt),[ce,de]=(0,o.fp)(a.AG.selectedFileList),[_e,pe]=(0,o.fp)(a.AG.clickFileList),[fe,he]=(0,o.fp)(a.AG.fileShellShow),[ue,me]=(0,n.useState)(""),[we,ve]=(0,o.fp)(a.AG.workflow_show),[ge,xe]=(0,o.fp)(a.AG.workflow_realtime_show),[ye,je]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:ke}=(0,n.useContext)(v.F),[Ge,Ae]=(0,o.fp)(a.AG.user_base_info),{check_user_auth:be}=(0,g.MH)(),{click_file:Ce}=(0,f.kZ)(),[Se]=(0,r.ok)(),Me=(0,f._A)(),$e=n.useRef(null),[ze,De]=(0,o.fp)(a.AG.to_running_files),[Ne,Pe]=(0,o.fp)(a.AG.file_page),[Ee]=(0,o.fp)(a.AG.blank_search_mode),[,Fe]=(0,o.fp)(a.AG.prompt_card),[Ie,Xe]=(0,o.fp)(a.AG.blank_search_mode_for_temp),Re=(0,f.oT)(),Ke="1"===Se.get("chat_open"),Le=be(A.oV.ai_agent_page);(0,n.useEffect)(()=>{Ge?.user_data&&Ke&&!Le&&Re("chat_open",null)},[Ke,Le,Ge]);const[He,Ue]=(0,o.fp)(a.AG.studio_chat_width),Ye=n.useRef(null),[Be,Oe]=(0,n.useState)(!1),[Ze,We]=(0,n.useState)(void 0),Te=(0,f.dN)(),[Ve,qe]=(0,o.fp)(a.AG.ai_chat_session_by_cwd),Je=function(){const[e,t]=(0,o.fp)(a.AG.user_base_info),{t:i}=(0,w.Bd)(),{check_user_auth:s}=(0,g.MH)(),[c,p]=(0,o.fp)(a.AG.router_jump),h=(0,r.Zp)(),{initUserInfo:m}=(0,n.useContext)(v.F),[x,y]=(0,o.fp)(a.AG.nowFileList),[j,C]=(0,o.fp)(a.AG.showPrompt),[M,$]=(0,o.fp)(a.AG.fileShellShow),[z,D]=(0,o.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory;const o=[{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.time_minx_max),children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.time_max_min),children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.size_min_max),children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.size_max_min),children:i("大小逆序")}),v:A.t8.size_max_min}],r=[{r:(0,N.jsx)("span",{style:(0,K.ok)(!e.user_data.file_list_pagination_mode||e.user_data.file_list_pagination_mode===A.yM.all),children:i("全部加载文件")}),v:A.yM.all},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.file_list_pagination_mode===A.yM.pagination),children:i("scrll_l")}),v:A.yM.pagination}],c=[{r:(0,N.jsx)("span",{style:(0,K.ok)(!e.user_data.file_time_show_type||e.user_data.file_time_show_type===A.KD.current),children:i("最近时间")}),v:A.KD.current},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.file_time_show_type===A.KD.time),children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,N.jsx)("span",{style:(0,K.ok)(!e.user_data.dir_show_type),children:i("系统默认")}),v:A.t8.defualt},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.name),children:i("名字")}),v:A.t8.name},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min),children:i("修改时间")}),v:!1,items:o},{r:(0,N.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min),children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:r},{r:i("时间展示"),v:"",items:c},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,N.jsx)("span",{style:(0,K.ok)(z),children:i("srchbln")}),v:"blank_search_mode"}]}];x?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),s(A.oV.code_resource)&&w.push({r:i("add_rot"),v:"code_resource"}),s(A.oV.http_proxy)&&w.push({r:i("dl_here"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,f.LL)([...e.user_data.quick_cmd],w),n.items=w,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${S.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${S.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return p({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/setting/customer_router/")}if("http_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:d.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",$({show:!0,path:(0,_.GG)("file",(0,_.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return D(!z),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===A.yM.all||e===A.yM.pagination)t.is_pagination_mode=!0;else if(e===A.KD.current||e===A.KD.time)t.is_file_show_type=!0;else{if(e!==A.t8.defualt&&e!==A.t8.name&&e!==A.t8.size_max_min&&e!==A.t8.size_min_max&&e!==A.t8.time_max_min&&e!==A.t8.time_minx_max)return;t.is_dir_list_type=!0}}await l.wm.post(I.s.user_save_private_attr,{type:e,...t}),await m(),C({data:void 0,overlay:!1,type:"",show:!1}),h((0,_.vX)())},C({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}}(),Qe=async()=>{const e=new j.Nd;e.dir_path=`${(0,_.GG)("file",(0,_.vX)())}`,k.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,f.Ys)(e);for(const e of t.failed_file_list)(0,f.V$)(e);De(new Set(t.running_file_list))}}),await k.ws.sendData(G.HK.workflow_realtime,e)},et=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,x.v7)(i.size),Ge.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,Y.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{Qe()})),i.name===j.SB&&(t=!0);for(const i of e.folders??[])Ge.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,Y.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",i.name===j.SB&&(t=!0);je(t)},tt=n.useRef(null),it=async e=>{if(!0===se){if(tt.current!==e){tt.current=e;try{const t=await l.$M.post("file/mount_info",{param_path:e});ae(t?.data??null)}catch(e){ae(null)}}}else ae(null)},nt=async()=>{const e=(0,_.GG)("file",(0,_.vX)());if(Ee||Ie)return;let t;if(it(e),Ge.user_data.file_list_pagination_mode===A.yM.pagination){if(V!==e){if(V=e,1!==Ne.page_num)return void Pe({page_size:Ne.page_size,page_num:1})}else if(Ne.page_num<0)return;if(t=await l.$M.post("file_get_page",{param_path:e,page_num:Ne.page_num,page_size:Ne.page_size}),t.code!==p.m.Success)return;const i=t.data;return et(i),i.files?.length?(ie(e=>{const t=(0,U.cloneDeep)(1===Ne.page_num?i.files:[...e?.files??[],...i.files]),n={...e,files:t};return(0,f.yC)(n,Ge.user_data.dir_show_type),n}),void(T=t.data)):void Pe({page_size:Ne.page_size,page_num:-1})}if(t=await l.$M.get(e),t.code!==p.m.Success)return;const i=t.data;(0,f.yC)(i,Ge.user_data.dir_show_type),et(t.data),ie(t.data),T=t.data};(0,n.useEffect)(()=>async()=>{De(new Set)},[]);const st=()=>{je(!1),(()=>{const e=Se.get("preview_file_name"),t=Se.get("preview_mode");if(!e||!t)return!1;const n=(0,_.GG)("file",(0,_.vX)());if($e.current===n+e)return!0;$e.current=n+e;const s=()=>Me(null);return"md"===t?(i({url:l.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:s}),!0):"log"===t?(m({show:!0,fileName:e,encoding:Se.get("preview_log_enc")??"utf8",wrap:Se.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?(M({path:(0,F.IO)((0,_.vX)(),e),name:e,close:s}),!0):(Ce({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),q({open:!1}),i({}),m({show:!1}),M({}),z({}),D({}),P({}),X({}),R({}),nt())};(0,n.useEffect)(()=>{st()},[Q,Ne]),(0,n.useEffect)(()=>{ne>0&&nt()},[ne]);const ot=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==se)return ot.current?void(!0===se?it((0,_.GG)("file",(0,_.vX)())):ae(null)):(ot.current=!0,void(!0===se&&null===oe&&it((0,_.GG)("file",(0,_.vX)()))))},[se]);const at=e=>{e.target===e.currentTarget&&(de([]),pe([]))},lt=n.useCallback((0,U.throttle)(e=>{const t=Ye.current;if(!t||!t.parentElement)return;const i=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),s=n.right-e.clientX,o=Math.min(Math.max(s,320),.7*n.width);Ue(parseFloat((o/i).toFixed(2)))},32),[]),rt=()=>{Oe(!1),document.removeEventListener("pointermove",lt)},ct=(0,N.jsxs)("div",{className:"file-list-main",children:[(0,N.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(de([]),pe([]),Ge.user_data.file_list_pagination_mode===A.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Pe({page_size:Ne.page_size,page_num:1})}},input_path_enter:e=>{var t;de([]),pe([]),ie({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?ee(function(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===i)return e.substring(0,n+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}((0,_.vX)(),e)):(e=e.replace(0===(t=Ge.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),ee(e))}}),oe&&(0,N.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:oe.color},children:[(0,N.jsx)("span",{className:"material-icons",style:{color:oe.color},children:"cloud"}),(0,N.jsx)("span",{children:[oe.credential_note,oe.account_note||(B.C1.find(e=>e.value===oe.driver)?.title??oe.driver),oe.name].filter(Boolean).join(" - ")}),oe.readonly&&(0,N.jsx)("span",{className:"mount-readonly-tag",children:J("只读")})]}),Ge.user_data.file_list_pagination_mode===A.yM.pagination?(0,N.jsx)(C.$J,{handleContextMenu:Je,clickBlank:at,list:te.files}):(0,N.jsx)(C.t$,{handleContextMenu:Je,file_list:te.files,folder_list:te.folders,clickBlank:at})]});return(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)(c.aZ,{children:(0,N.jsx)(h.$Z,{handleEnterPress:async()=>{if(Ee||Ie){if(de([]),pe([]),!ue||!ue.trim())return void ie({files:[],folders:[]});const e=(0,_.GG)("file",(0,_.vX)()),t=await l.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:ue.trim()});if(t.code!==p.m.Success)return;const i=t.data;return(0,f.yC)(i,Ge.user_data.dir_show_type),et(i),ie(i),void(T=i)}if(!T)return;de([]),pe([]);const e=[],t=[];for(const t of T.files??[])t.name.includes(ue)&&e.push(t);for(const e of T.folders??[])e.name.includes(ue)&&t.push(e);ie({files:e,folders:t})},placeholder:J("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,_.GG)("file",(0,_.vX)());Fe({open:!0,title:J("深搜"),context_div:(0,N.jsx)(E,{base_path:e})})},handleInputChange:e=>{me(e)},max_width:"25em"})}),(0,N.jsxs)(c.aZ,{position:"right",children:[be(A.oV.ai_agent_page)&&(0,N.jsx)($.rA,{icon:"smart_toy",title:J("AI 聊天"),selected:Ke,onClick:()=>Re("chat_open",!Ke?"1":null)}),(0,N.jsx)("div",{className:"mobile-context-btn",children:(0,N.jsx)($.rA,{icon:"more_horiz",title:J("右键"),onClick:()=>{const e=ce[ce.length-1];if(void 0!==e){const t=[...te.folders??[],...te.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],n=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},o=new b.ik;o.path=(0,F.IO)((0,_.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===u.Iw.folder?u.Iw.folder:(0,b.uL)(t.name),o.size=t.origin_size,re({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Je(e)}}})}),(0,N.jsx)(H,{})]}),(0,N.jsxs)("div",{className:"file-list-split"+(Ke?" file-list-split--chat":""),children:[ct,Ke&&(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Ye,onPointerDown:e=>{e.preventDefault(),Oe(!0),document.addEventListener("pointermove",lt),document.addEventListener("pointerup",rt,{once:!0})}}),(0,N.jsx)("div",{className:"studio-chat-panel",style:{width:`${He}em`},children:(0,N.jsx)(n.Suspense,{fallback:null,children:(0,N.jsx)(W,{inline_header:!0,sync_url:!1,file_cwd_path:Te(),session_id:Ze??(dt=Te(),a.AG.get_ai_chat_session(Ve,dt)),on_session_change:e=>{We(e),((e,t)=>{qe({...Ve,[e]:t})})(Te(),e)}})})})]})]}),Be&&(0,N.jsx)("div",{className:"shell__overlay",onPointerUp:rt}),we&&(0,N.jsx)(O,{}),ge.open&&(0,N.jsx)(Z,{})]});var dt}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9334],{89117(t,e,n){n.d(e,{Hm:()=>s,U6:()=>c});const r=["mermaid","svg"];function s(t){return r.includes(t)}let o=null;let i=0;async function a(t){const e=t.trim();if(!e)return{svg:"",error:null};const r=await(o||(o=Promise.all([n.e(8725),n.e(2300)]).then(n.bind(n,62300)).then(t=>{const e=t.default;return e.initialize({startOnLoad:!1,securityLevel:"loose",theme:"default",fontFamily:"inherit",suppressErrorRendering:!0}),e})),o),s="md-mermaid-"+ ++i;try{const{svg:t}=await r.render(s,e);return{svg:t,error:null}}catch(t){return document.getElementById(s)?.remove(),document.getElementById(`d${s}`)?.remove(),{svg:"",error:t?.message??String(t)}}}async function c(t,e){return"svg"===t?function(t){const e=t.trim();if(!e)return{svg:"",error:null};const n=(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("parsererror");return n?{svg:"",error:n.textContent?.trim()||"SVG 解析失败"}:{svg:e,error:null}}(e):a(e)}},41105(t,e,n){n.d(e,{KR:()=>f,Ne:()=>h,op:()=>E,pC:()=>u,sL:()=>p});var r=n(5338),s=n(96540),o=n(14284),i=n(19878),a=n(89117),c=n(86063),l=n(93392),d=n(20892);function u(t){return btoa(unescape(encodeURIComponent(t)))}function h(t){return decodeURIComponent(escape(atob(t)))}let m="";function p(t){m=t||""}function f(t){if(/^(https?:|data:|blob:|\/\/|\/)/i.test(t))return t;const e=t.replace(/^\.\//,"");return o.$M.getDownloadUrl(m+e)}const g=new Set(["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","small","span","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","var","wbr"]),_=new Set(["align","alt","border","cellpadding","cellspacing","class","colspan","height","href","id","rowspan","src","style","target","title","valign","width"]);function v(t){const e=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild,n=document.createDocumentFragment();if(!e)return n;const r=(t,e)=>{t.childNodes.forEach(t=>{if(t.nodeType===Node.TEXT_NODE)return void e.appendChild(document.createTextNode(t.textContent??""));if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(!g.has(n.tagName.toLowerCase()))return void r(n,e);const s=document.createElement(n.tagName.toLowerCase());for(const t of Array.from(n.attributes)){const e=t.name.toLowerCase();e.startsWith("on")||(_.has(e)||e.startsWith("data-"))&&("href"!==e&&"src"!==e||!/^\s*javascript:/i.test(t.value))&&("src"!==e?s.setAttribute(e,t.value):s.setAttribute(e,f(t.value)))}r(n,s),e.appendChild(s)})};return r(e,n),n}class b{dom;node;view;get_pos;render_box;source_box;source_input;source_hl;source_hl_code;mode="preview";draft=null;constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n,this.dom=document.createElement("div"),this.dom.className="md-html-block",this.dom.setAttribute("data-mode","preview"),this.render_box=document.createElement("div"),this.render_box.className="md-html-block__render",this.source_box=document.createElement("div"),this.source_box.className="md-html-block__source",this.source_input=document.createElement("textarea"),this.source_input.className="md-html-block__input",this.source_input.setAttribute("spellcheck","false"),this.source_input.setAttribute("wrap","off"),this.source_hl=document.createElement("pre"),this.source_hl.className="md-html-block__highlight",this.source_hl.setAttribute("aria-hidden","true");const r=document.createElement("code");this.source_hl.appendChild(r),this.source_hl_code=r,this.source_box.append(this.source_hl,this.source_input);const s=document.createElement("span");s.className="md-html-block__toggle",s.setAttribute("contenteditable","false"),s.textContent="HTML",s.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),this.toggle_mode()}),this.source_input.addEventListener("blur",()=>this.commit()),this.source_input.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),this.draft=null,this.toggle_mode()),t.stopPropagation()}),this.source_input.addEventListener("input",()=>{this.draft=this.source_input.value,this.paint_highlight(),this.source_hl.scrollLeft=this.source_input.scrollLeft}),this.source_hl.addEventListener("scroll",()=>{this.source_input.scrollLeft=this.source_hl.scrollLeft});for(const t of["beforeinput","paste","input","keyup","keypress"])this.source_input.addEventListener(t,t=>t.stopPropagation());this.dom.append(this.render_box,this.source_box,s),this.render_box.replaceChildren(v(t.attrs.value)),this.set_source_value(t.attrs.value)}set_source_value(t){this.source_input.value=t,this.paint_highlight()}paint_highlight(){const t=this.source_input.value;this.source_hl_code.innerHTML=i.A.highlight(t+"\n",{language:"xml",ignoreIllegals:!0}).value}toggle_mode(){if("source"===this.mode)return this.commit(),this.mode="preview",void this.dom.setAttribute("data-mode","preview");this.mode="source",this.dom.setAttribute("data-mode","source"),this.set_source_value(this.node.attrs.value),this.draft=null,this.source_input.focus()}commit(){if(null===this.draft)return;const t=this.draft;if(this.draft=null,t===this.node.attrs.value)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);n&&this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,value:t}))}update(t){return t.type===this.node.type&&(this.node=t,null===this.draft&&(this.render_box.replaceChildren(v(t.attrs.value)),"preview"===this.mode&&this.set_source_value(t.attrs.value)),!0)}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}}class w{dom;node;view;get_pos;constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n,this.dom=document.createElement("span"),this.dom.className="md-html-inline",this.dom.setAttribute("contenteditable","true"),this.dom.textContent=t.attrs.value,this.dom.addEventListener("blur",()=>this.commit());for(const t of["beforeinput","paste","input"])this.dom.addEventListener(t,t=>t.stopPropagation())}commit(){const t=this.dom.textContent??"";if(t===this.node.attrs.value)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);n&&this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,value:t}))}update(t){return t.type===this.node.type&&(this.node=t,!0)}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}}function y(t){const e=t.split(/[?#]/)[0].toLowerCase();return e.endsWith(".mermaid")?"mermaid":e.endsWith(".mind")?"mind":e.endsWith(".timeline")?"timeline":null}class k{dom;node;kind;src;mind_unmount=null;timeline_root=null;constructor(t){this.node=t,this.src=t.attrs.src,this.kind=y(this.src),this.dom=this.kind?this.build_graph():this.build_image()}build_image(){const t=document.createElement("img");t.src=f(this.src),t.alt=this.node.attrs.alt??"";const e=this.node.attrs.title;return e&&(t.title=e),t}build_graph(){const t=document.createElement("span");t.className="md-graph md-graph--file",t.setAttribute("contenteditable","false");const e=document.createElement("span");return e.className="md-graph__body",t.append(e),this.render_graph_body(e),t}render_graph_body(t){const e=f(this.src);t.textContent="loading",fetch(e).then(t=>t.text()).then(async e=>{if(!this.dom.isConnected)return;if("mermaid"===this.kind){const n=await(0,a.U6)("mermaid",e);if(!t.isConnected)return;return n.error?(this.dom.classList.add("md-graph--error"),void(t.textContent=n.error)):void(t.innerHTML=n.svg)}if("timeline"===this.kind){const n=(0,l.dO)(e);if(!t.isConnected)return;if(!n)return this.dom.classList.add("md-graph--error"),void(t.textContent="invalid timeline");this.dom.classList.add("md-graph--timeline"),t.remove(),this.dom.textContent="";const o=document.createElement("div");o.className="md-timeline-embed",this.dom.append(o);const i=(0,r.createRoot)(o);return i.render((0,s.createElement)(d.default,{doc:n,readonly:!0})),void(this.timeline_root=i)}const n=await(0,c.Hn)(e);if(!this.dom.isConnected)return;this.dom.classList.add("md-graph--mind"),t.remove(),this.dom.textContent="";const o=await n.mount(this.dom);this.mind_unmount=()=>o.destroy()}).catch(()=>{t.isConnected&&(this.dom.classList.add("md-graph--error"),t.textContent="load failed")})}update(t){if(t.type!==this.node.type)return!1;this.node=t;const e=t.attrs.src;if(e!==this.src){this.destroy_instance(),this.src=e,this.kind=y(e);const t=this.kind?this.build_graph():this.build_image();this.dom.replaceWith(t),this.dom=t}else if(!this.kind){const e=this.dom;e.alt=t.attrs.alt??"";const n=t.attrs.title;n&&(e.title=n)}return!0}destroy_instance(){this.mind_unmount?.(),this.mind_unmount=null,this.timeline_root?.unmount(),this.timeline_root=null}destroy(){this.destroy_instance()}stopEvent(t){return!!this.kind&&this.dom.contains(t.target)}ignoreMutation(){return!0}}function E(){return{html_block:(t,e,n)=>new b(t,e,n),html_inline:(t,e,n)=>new w(t,e,n),image:t=>new k(t)}}},89334(t,e,n){n.d(e,{Rh:()=>p,V:()=>a,lG:()=>o,rg:()=>f,z$:()=>u});var r=n(41105);n(6704);const s=["math","latex","katex"];function o(t){return s.includes(t.toLowerCase())}const i=[{open:"$$",close:"$$",mode:"block"},{open:"\\[",close:"\\]",mode:"block"},{open:"\\(",close:"\\)",mode:"inline"},{open:"$",close:"$",mode:"inline"}];function a(t){const e=t.trim();if(!e)return null;for(const t of i){if(e.length<=t.open.length+t.close.length)continue;if(!e.startsWith(t.open)||!e.endsWith(t.close))continue;const n=e.slice(t.open.length,e.length-t.close.length);if(("$"!==t.open||!e.startsWith("$$"))&&n.trim())return{tex:n,mode:t.mode,raw:e}}return null}let c=null;const l=new Map;async function d(t,e){const r=t.trim();if(!r)return{html:"",error:null};const s=`${e}\0${r}`,o=l.get(s);if(o)return o;let i;try{const{renderToString:t}=await(c||(c=n.e(2130).then(n.bind(n,99749))),c);i={html:t(r,{displayMode:"block"===e,throwOnError:!1,strict:!1,trust:!1,output:"html"}),error:null}}catch(t){i={html:"",error:t?.message??String(t)}}return l.size>=500&&l.clear(),l.set(s,i),i}async function u(t,e,n,r){const s=await d(e,n);if(t.isConnected){if(t.classList.remove("md-math--loading","md-math--error"),s.error)return t.classList.add("md-math--error"),t.textContent=r,void(t.title=s.error);t.innerHTML=s.html}}function h(t,e){const n=t.pos,r=t.src;if(r.startsWith("$$",n))return!1;const s=[{open:"\\(",close:"\\)"},{open:"$",close:"$"}];for(const o of s){if(!r.startsWith(o.open,n))continue;const s=n+o.open.length,i=r.indexOf(o.close,s);if(i<0)continue;const a=r.slice(s,i);if(a.trim()){if("$"===o.open){const t=r[i+1];if(void 0!==t&&/\d/.test(t))continue}if(!e){const e=t.push("math_inline","span",0);e.content=a,e.markup=o.open,e.meta={raw:r.slice(n,i+o.close.length)}}return t.pos=i+o.close.length,!0}}return!1}function m(t,e,n,r){const s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e],i=t.src.slice(s,o).trim(),a=[{open:"\\[",close:"\\]"},{open:"$$",close:"$$"}];for(const o of a){if(!i.startsWith(o.open))continue;if(i.endsWith(o.close)&&i.length>o.open.length+o.close.length){if(r)return!0;const n=t.push("math_block","div",0);return n.content=i.slice(o.open.length,i.length-o.close.length),n.markup=o.open,n.meta={raw:i},n.map=[e,e+1],t.line=e+1,!0}const a=i.slice(o.open.length);for(let i=e+1;i<n;i++){const n=t.bMarks[i]+t.tShift[i],c=t.eMarks[i],l=t.src.slice(n,c);if(!l.trimEnd().endsWith(o.close))continue;if(r)return!0;const d=[];a.trim()&&d.push(a),t.getLines(e+1,i,t.tShift[e],!1).split("\n").forEach(t=>d.push(t)),d.push(l.trimEnd().slice(0,-o.close.length));const u=t.push("math_block","div",0);return u.content=d.join("\n").trim(),u.markup=o.open,u.meta={raw:t.src.slice(s,t.eMarks[i]).trimEnd()},u.map=[e,i+1],t.line=i+1,!0}}return!1}function p(t,e){t.inline.ruler.before("escape","math_inline",h),t.block.ruler.before("fence","math_block",m,{alt:["paragraph","reference","blockquote","list"]}),t.renderer.rules.math_inline=(t,n)=>`<span data-math-inline="${e(t[n].meta.raw)}"></span>`,t.renderer.rules.math_block=(t,n)=>`<div data-math-block="${e(t[n].meta.raw)}"></div>`;const n=t.renderer.rules.fence||function(t,e,n,r,s){return s.renderToken(t,e,n)};t.renderer.rules.fence=(t,r,s,i,a)=>o(t[r].info.trim())?`<div data-math-block="${e(`$$\n${t[r].content.trim()}\n$$`)}"></div>`:n(t,r,s,i,a)}async function f(t){const e=t.querySelectorAll("[data-math-inline], [data-math-block]");for(const t of Array.from(e)){const e=t.getAttribute("data-math-inline"),n=t.getAttribute("data-math-block"),s=e??n;if(null===s)continue;const o=a((0,r.Ne)(s));if(!o)continue;const i=null!==e?"inline":"block";t.classList.add("md-math","block"===i?"md-math--block":"md-math--inline"),await u(t,o.tex,i,o.raw)}}},86063(t,e,n){function r(t){return"smm-mind"===t}n.d(e,{Hn:()=>d,hj:()=>r,tW:()=>i});const s={mousewheelMoveStep:35,scaleRatio:.08};let o=null;function i(t){return t&&"object"==typeof t?t.data?.nodeData?a(t.data.nodeData):t.root&&"object"==typeof t.root?t.root.data?t:{...t,root:c(t.root)}:t.data&&"object"==typeof t.data?t:c(t):null}function a(t){return{data:{text:"string"==typeof t?.topic?t.topic:"string"==typeof t?.data?.text?t.data.text:""},children:Array.isArray(t?.children)?t.children.map(a):[]}}function c(t){return{data:{text:"string"==typeof t?.text?t.text:"",...t?.note?{note:t.note}:{}},children:Array.isArray(t?.children)?t.children.map(c):[]}}function l(t){t.stopPropagation()}async function d(t){const e=function(t){const e=t.trim();if(!e)return null;let n=null;try{n=JSON.parse(e)}catch{return null}return i(n)}(t),r=await(o||(o=Promise.all([Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8277)]).then(n.bind(n,45602)),n.e(8781).then(n.bind(n,88781))]).then(([t])=>t.default)),o);return{data:e,async mount(t,n){let o=!1;const i=await function(t,e){return new Promise(n=>{const r=()=>{e()?n(!1):t.isConnected&&t.clientWidth&&t.clientHeight?n(!0):window.setTimeout(r,16)};r()})}(t,()=>o);if(!i)return{destroy:()=>{},get_data:()=>null};const a=document.createElement("div");a.className="md-graph__mind-host",!1!==n?.release_wheel&&t.addEventListener("wheel",l,{capture:!0,passive:!0}),t.append(a);const c=new r({el:a,data:e?.root??e??{data:{text:""}},readonly:!n?.editable,fit:!0,...s});return e?.root&&c.setFullData(e),{destroy:()=>{o=!0,t.removeEventListener("wheel",l,{capture:!0}),c?.destroy?.()},get_data:()=>c?.getData?.(!1)}}}}n.d(e,["k$",0,s])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9546],{75007(e,t,s){s.d(t,{h:()=>o});s(96540);var n=s(85997),i=s(74848);function o(e){return(0,i.jsxs)("h2",{className:"message",children:[(0,i.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,i.jsx)("span",{children:e.context})]})}},22081(e,t,s){var n=s(96540),i=s(16349),o=s(74848);const r=({percentage:e})=>{const t=(0,n.useRef)(null),[s,r]=(0,n.useState)(null);return(0,n.useEffect)(()=>{const s=t.current.getContext("2d"),n=new i.Ay(s,{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 r(n),()=>{n.destroy()}},[]),(0,n.useEffect)(()=>{s&&(s.data.datasets[0].data=[e,100-e],s.update())},[e]),(0,o.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,o.jsx)("canvas",{ref:t})})};s.d(t,["A",0,r])},77481(e,t,s){s.d(t,{S:()=>c,X:()=>r});var n=s(96540),i=s(61443),o=s(74848);function r(e){const[t,s]=n.useState([]),r=(0,n.useRef)(-1),[c,l]=(0,n.useState)(-1),[a,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const u=()=>{r.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,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let r=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(r=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):t},s)})})}),(0,o.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(c===s?"row-dragging":"")+(a===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(r.current=s,l(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=r.current,s=a;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function c(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))})}},88062(e,t,s){s(96540),s(47022);var n=s(74848);function i(e){return(0,n.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(t,e)},children:e.name})}const o=e=>(0,n.jsxs)("li",{children:[e.click?(0,n.jsx)(i,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,n.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,n.jsx)("ul",{children:e.node.children.map((t,s)=>(0,n.jsx)(o,{node:t,click:e.click,onContextMenu:e.onContextMenu,render:e.render},s))})]}),r=e=>(0,n.jsx)("div",{className:"card-tree-view",children:(0,n.jsx)("ul",{children:e.list&&e.list.map((t,s)=>(0,n.jsx)(o,{node:t,click:e.click,onContextMenu:e.onContextMenu,render:e.render},s))})});s.d(t,["A",0,r])},59546(e,t,s){s.r(t),s.d(t,{default:()=>le});var n=s(96540),i=s(75725),o=s(70447),r=s(22081),c=s(92275),l=s(14944),a=s(14284),d=s(4412),u=s(85997),h=s(77481),x=s(53459),p=s(22022),m=s(34843),f=s(82893),j=s(74777),g=s(62042),_=s(61443),y=s(74848);function w(e){const{t}=(0,p.Bd)(),[s,r]=(0,m.fp)(f.AG.disk),[c,l]=(0,n.useState)({}),[j,g]=(0,n.useState)([]),_=[t("名字"),t("当前值"),t("历史最低"),t("临界值")];return(0,n.useEffect)(()=>{(async()=>{const s=await a.Yu.post("sys/disk/info",{name:e.name});if(s.code===x.m.Success){const e=[];for(const n of s.data.ata_smart_attributes??[]){let s;n[1]>=n[2]?s="var(--icon-green)":n[1]<=n[3]&&(s="var(--icon-red)"),n[0]=(0,y.jsx)("span",{style:{color:s},children:t(n[0])}),e.push(n)}g(s.data.ata_smart_attributes),l(s.data)}})()},[]),(0,y.jsxs)("div",{children:[(0,y.jsx)(d.aZ,{position:"right",children:(0,y.jsx)(u.rA,{icon:"close",title:t("关闭"),onClick:()=>{r({})}})}),(0,y.jsx)(i.jW,{isFull:!0,more:!0,children:(0,y.jsx)(i.NN,{children:(0,y.jsxs)(i.fI,{children:[(0,y.jsxs)(i.VP,{widthPer:30,children:[(0,y.jsx)(i.xh,{children:(0,y.jsxs)(o.Zp,{title:t("基本信息"),children:[(0,y.jsx)(i.Yh,{left:t("名字"),right:e.name}),(0,y.jsx)(i.Yh,{left:t("厂商名称"),right:e.typeName}),(0,y.jsx)(i.Yh,{left:t("类型"),right:e.type}),(0,y.jsx)(i.Yh,{left:t("容量"),right:e.total})]})}),(0,y.jsx)(i.xh,{children:(0,y.jsxs)(o.Zp,{title:t("物理信息"),children:[(0,y.jsx)(i.Yh,{left:t("是否健康"),right:!0===c.smart_status?"是":"否"}),(0,y.jsx)(i.Yh,{left:t("设备型号"),right:c.model_name}),(0,y.jsx)(i.Yh,{left:t("序列号"),right:c.serial_number}),(0,y.jsx)(i.Yh,{left:t("固件版本"),right:c.firmware_version}),(0,y.jsx)(i.Yh,{left:t("转速(每分钟)"),right:c.rotation_rate}),(0,y.jsx)(i.Yh,{left:t("通电时长(小时)"),right:c.power_on_time_hours}),(0,y.jsx)(i.Yh,{left:t("通电次数"),right:c.power_cycle_count}),(0,y.jsx)(i.Yh,{left:t("温度(°C)"),right:c.temperature}),(0,y.jsx)(i.Yh,{left:t("通信协议"),right:c.device_protocol})]})})]}),(0,y.jsx)(i.VP,{widthPer:50,children:(0,y.jsxs)(i.xh,{children:[j?.length?(0,y.jsx)(o.uF,{title:t("ATA/SATA详细信息"),children:(0,y.jsx)(h.X,{headers:_,rows:j,width:"10rem"})}):(0,y.jsx)(y.Fragment,{}),c.nvme_smart?(0,y.jsxs)(o.Zp,{title:t("NVME详细信息"),children:[(0,y.jsx)(i.Yh,{left:t("NVMe 可用备用块(%)"),right:c.nvme_smart.available_spare}),(0,y.jsx)(i.Yh,{left:t("NVMe 已使用寿命(%)"),right:c.nvme_smart.percentage_used}),(0,y.jsx)(i.Yh,{left:t("NVMe 读取量"),right:c.nvme_smart.data_units_read}),(0,y.jsx)(i.Yh,{left:t("NVMe 写入量"),right:c.nvme_smart.data_units_written}),(0,y.jsx)(i.Yh,{left:t("NVMe 通电次数"),right:c.nvme_smart.power_cycles}),(0,y.jsx)(i.Yh,{left:t("NVMe 通电时长(小时)"),right:c.nvme_smart.power_on_hours}),(0,y.jsx)(i.Yh,{left:t("NVMe 非正常关机"),right:c.nvme_smart.unsafe_shutdowns}),(0,y.jsx)(i.Yh,{left:t("NVMe 媒体错误"),right:c.nvme_smart.media_errors}),(0,y.jsx)(i.Yh,{left:t("NVMe 错误日志数"),right:c.nvme_smart.num_err_log_entries})]}):(0,y.jsx)(y.Fragment,{})]})})]})})})]})}let v=function(e){return e[e.mount=0]="mount",e}({});var k=s(88062),S=s(78247),b=s(23430),C=s(99214);const A=e=>(0,y.jsxs)("div",{style:{border:"2px solid black",padding:"10px",width:"300px",height:"300px",position:"relative"},children:[e.name,e.lvms.map((e,t)=>(0,y.jsx)("div",{style:{margin:"5px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid "},children:e.name},t))]});function V(){return(0,y.jsx)("div",{style:{position:"relative",height:"300px",margin:"10px",width:"30px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.jsx)("div",{style:{width:0,height:0,borderTop:"10px solid transparent",borderBottom:"10px solid transparent",borderLeft:"10px solid black"}})})}function P(){const{t:e}=(0,p.Bd)(),[t,s]=(0,m.fp)(f.AG.disk),[r,c]=(0,n.useState)({}),[l,j]=(0,n.useState)([]),[_,w]=(0,n.useState)([]),[P,$]=(0,m.fp)(f.AG.showPrompt),{check_user_auth:Y}=(0,S.MH)(),[F,I]=(0,n.useState)([]),{click_file:N}=(0,C.kZ)(),[E,K]=(0,m.fp)(f.AG.prompt_card),M=[e("挂载点"),"uuid",e("类型"),e("文件系统类型"),e("文件系统容量"),e("卷容量"),e("设备路径"),e("分区表类型")],B=async()=>{const e=await a.Yu.get("disk/blk");return e.code===x.m.Success&&j(e.data),e.code};(0,n.useEffect)(()=>{(async()=>{B()})()},[]);const H=[(0,y.jsx)(u.rA,{icon:"info",title:e("提示"),onClick:async()=>{K({open:!0,title:"信息",context_div:(0,y.jsx)("div",{children:(0,y.jsxs)("ul",{children:[(0,y.jsxs)("li",{children:["通用格式:","<文件系统> <挂载点> <类型> <挂载选项> <dump> <fsck> "]}),(0,y.jsxs)("li",{children:["文件系统,有多种格式",(0,y.jsxs)("ul",{children:[(0,y.jsx)("li",{children:"1(usb口默认名称)./dev/sda1"}),(0,y.jsx)("li",{children:"2(唯一Id).UUID=123e4567-e89b-12d3-a456-426614174000"}),(0,y.jsx)("li",{children:"3.LABEL=DATA"})]})]}),(0,y.jsx)("li",{children:"挂载点,就是文件路径,例如 /mnt/data ,这个目录要提前创建,且为空"}),(0,y.jsx)("li",{children:"类型,就是文件系统类型,对于系统不支持的类型,例如ntfs需要额外前提安装ntfs-3g(linux 5.15内核以后自带 ntfs)"}),(0,y.jsxs)("li",{children:['挂载选项的值只能是以下这些,可以用 "," 同时使用多个选项',(0,y.jsxs)("ul",{children:[(0,y.jsx)("li",{children:"defaults:使用默认挂载选项"}),(0,y.jsx)("li",{children:"noatime:不更新访问时间,提高性能"}),(0,y.jsx)("li",{children:"auto:系统启动时自动挂载"}),(0,y.jsx)("li",{children:"rw:以读写方式挂载"}),(0,y.jsx)("li",{children:"nofail:防止启动阻塞,挂载失败系统继续执行"}),(0,y.jsx)("li",{children:"...等"})]})]}),(0,y.jsx)("li",{children:"dump 0是需要备份 1是不需要备份"}),(0,y.jsx)("li",{children:"Fsck 整数值0是不检查,文件系统检查顺序越小越先检查"}),(0,y.jsx)("li",{children:"提示:只有含有文件系统的逻辑卷,或者分区才可以进行挂载。"})]})})})}}),(0,y.jsx)(u.rA,{icon:"update",title:e("更新挂载"),onClick:async()=>{(await a.Yu.post("cmd/exe",{type:v.mount})).code===x.m.Success&&(0,g.SK)("挂载文件已生效")}},1)],Z=async()=>(await a.Yu.get("get_fstab")).data,G=async e=>{await a.Yu.post("save_fstab",{content:e})};return(0,y.jsxs)("div",{children:[(0,y.jsx)(d.aZ,{position:"right",children:(0,y.jsx)(u.rA,{icon:"close",title:e("关闭"),onClick:()=>{s({})}})}),(0,y.jsx)(i.jW,{isFull:!0,more:!0,children:(0,y.jsx)(i.NN,{children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:40,children:(0,y.jsxs)(o.Zp,{title:e("物理块(硬盘)设备、逻辑卷、物理卷"),rightTopCom:(0,y.jsxs)("div",{children:[Y(b.oV.sys_disk_mount)&&(0,y.jsx)(u.rA,{icon:"file_open",title:e("打开挂载文件"),onClick:async()=>{N({name:"fstab(谨慎修改,内容错误会导致系统无法启动)",model:"text",get_file_fun:Z,save_file_fun:G,menu_list:H})}}),(0,y.jsx)(u.rA,{icon:"update",title:e("刷新"),onClick:async()=>{await B()===x.m.Success&&(0,g.SK)("刷新成功")}})]}),children:[(0,y.jsx)(h.X,{headers:M,rows:_,width:"10rem"}),(0,y.jsx)(k.A,{list:l,render:e=>{let t=e.name;return e.label&&(t+=`(${e.label})`),e.mountpoint?(0,y.jsxs)("span",{children:[t,(0,y.jsx)("span",{style:{color:"green"},children:"(已挂载)"})]}):t},onContextMenu:(e,t)=>{e.preventDefault()},click:t=>{let s="";if(t.mountpoint)for(let e=0;e<t.mountpoints.length;e++)s+=t.mountpoints[e]+";";w([[(0,y.jsx)(o.xP,{children:s}),(0,y.jsx)(o.xP,{children:t.uuid}),e(t.type),e(t.fstype),t.fssize,t.size,(0,y.jsx)(o.xP,{children:t.path}),t.pttype]])}})]})}),(0,y.jsx)(i.VP,{widthPer:60,children:F.map((t,s)=>{const n=[];for(const e of t.pv_list)n.push({name:`${e.name}---(${e.size})---(${e.free_size})`});const r=[];for(const e of t.lv_list)r.push({name:`${e.name}---(${e.size})`});return(0,y.jsx)(o.Zp,{children:(0,y.jsxs)(i.n5,{children:[(0,y.jsx)(A,{name:e("物理卷"),lvms:n}),(0,y.jsx)(V,{}),(0,y.jsx)(A,{name:`${e("逻辑卷")}---(${t.name})---size(${t.size})`,lvms:[]}),(0,y.jsx)(V,{}),(0,y.jsx)(A,{name:e("逻辑卷"),lvms:r})]})},s)})})]})})})]})}var $=s(88815);let Y=!0;function F(e){const{t}=(0,p.Bd)(),s=[t("名字"),t("厂商名称"),t("类型"),t("容量")],_=[t("名字"),t("物理硬盘"),t("文件系统类型"),t("挂载位置"),t("总容量"),t("剩余容量")],[v,k]=(0,m.fp)(f.AG.user_base_info),[S,C]=(0,n.useState)(0),[A,V]=(0,n.useState)(0),[F,I]=(0,n.useState)(0),[N,E]=(0,n.useState)(0),[K,M]=(0,n.useState)(0),[B,H]=(0,n.useState)({}),[Z,G]=(0,n.useState)(!1),[D,z]=(0,n.useState)(!1),[T,W]=(0,n.useState)(!1),[X,q]=(0,n.useState)(Y),[U,L]=(0,n.useState)(null),[R,O]=(0,n.useState)([]),[J,Q]=(0,n.useState)([]),[ee,te]=(0,m.fp)(f.AG.user_base_info),[se,ne]=(0,m.fp)(f.AG.disk),ie=async()=>{if(!Y)return;const e=new c.hf(c.HK.sys_get);await l.ws.send(e),l.ws.addMsg(c.HK.sys_getting,e=>{E(e.context?.cpu_currentLoad);const t=e.context?.memLeft,s=e.context?.memTotal;V(t),I(s),C((s-t)/s*100),L(e.context?.node_memory_usage),M(e.context?.node_cpu_usage)})};return(0,n.useEffect)(()=>((async()=>{await ie()})(),()=>{l.ws.sendData(c.HK.sys_cancel,{})}),[]),(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.aZ,{position:"right",children:[v.sys===b.XM.linux&&(0,y.jsx)(u.rA,{icon:"sd_card",title:"硬盘挂载",onClick:()=>{ne({type:"mount"})}}),(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("基本信息"),clickFun:e=>{G(e),e&&(async()=>{const e=await a.Yu.get("base");if(e.code===x.m.Success){const t=e.data;H(t)}})()}}),(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("物理硬盘"),clickFun:e=>{z(e),e&&(async()=>{const e=await a.Yu.get("disk");if(e.code===x.m.Success){const s=e.data,n=[];let i=!0;ee.sysSoftWare&&ee.sysSoftWare[j.jk.smartmontools]&&ee.sysSoftWare[j.jk.smartmontools].installed||(i=!1);for(const e of s??[])n.push([(0,y.jsx)(o.xP,{context:e.name}),e.typeName,e.type,e.total,(0,y.jsx)(u.rA,{icon:"health_and_safety",title:t("查看健康信息"),onClick:()=>{i?ne({type:"check",data:e}):(0,g.zN)("没有安装smartmontools")}})]);O(n)}})()}}),(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("文件硬盘"),clickFun:e=>{W(e),e&&(async()=>{const e=await a.Yu.get("filedisk");if(e.code===x.m.Success){const t=e.data,s=[];for(const e of t??[])s.push([(0,y.jsx)(o.xP,{context:e.name}),(0,y.jsx)(o.xP,{context:e.device_name}),e.fsType,(0,y.jsx)(o.xP,{context:e.mount}),e.total,e.available]);Q(s)}})()}}),(0,y.jsx)(u.Z$,{defaultStatus:X,text:t("实时信息"),clickFun:e=>{q(e),Y=e,ie()}})]}),(0,y.jsxs)(i.xh,{children:[X&&(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,y.jsx)(o.Zp,{title:"Sys "+t("内存"),children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{children:(0,y.jsx)(r.A,{percentage:S})}),(0,y.jsx)(i.VP,{children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:100,children:(0,y.jsx)("div",{children:(0,y.jsx)(i.Yh,{left:t("总容量"),center:`${F}G`})})}),(0,y.jsx)(i.VP,{widthPer:100,children:(0,y.jsx)(i.Yh,{left:t("剩余"),center:`${A}G`})})]})})]})})}),(0,y.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,y.jsx)(o.Zp,{title:"Sys cpu",children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{children:(0,y.jsx)(r.A,{percentage:N})}),(0,y.jsx)(i.VP,{children:(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.Yh,{left:t("使用率"),center:N})})})]})})}),(0,y.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,y.jsx)(o.Zp,{title:"FileCat",children:(0,y.jsxs)(i.fI,{children:[(0,y.jsxs)(i.VP,{children:[(0,y.jsx)(i.qV,{content:t("内存")}),(0,y.jsx)(i.qV,{content:"total: "+(0,$.v7)(U?.rss)}),(0,y.jsx)(i.qV,{content:"object: "+(0,$.v7)(U?.heapTotal)}),(0,y.jsx)(i.qV,{content:"obj-use: "+(0,$.v7)(U?.heapUsed)}),(0,y.jsx)(i.qV,{content:"external: "+(0,$.v7)(U?.external)}),(0,y.jsx)(i.qV,{content:"buffer: "+(0,$.v7)(U?.arrayBuffers)})]}),(0,y.jsx)(i.VP,{children:(0,y.jsx)(i.qV,{content:"cpu growth rate: "+K})})]})})})]}),(0,y.jsxs)(i.fI,{children:[Z&&(0,y.jsx)(i.VP,{children:(0,y.jsxs)(o.Zp,{title:t("基本信息"),children:[(0,y.jsx)(i.Yh,{left:t("总内存"),right:B.mem_total}),(0,y.jsx)(i.Yh,{left:`cpu ${t("制造商")}`,right:B.cpu_manufacturer}),(0,y.jsx)(i.Yh,{left:`cpu ${t("品牌")}`,right:B.cpu_brand}),(0,y.jsx)(i.Yh,{left:`cpu ${t("逻辑核心")}`,right:B.cpu_core_num}),(0,y.jsx)(i.Yh,{left:`cpu ${t("物理核心")}`,right:B.cpu_phy_core_num}),(0,y.jsx)(i.Yh,{left:`cpu ${t("最大")}hz`,right:B.cpu_speed_hz}),(0,y.jsx)(i.Yh,{left:`${t("当前系统")}:pid;ppid`,right:B.pid_ppid}),(0,y.jsx)(i.Yh,{left:t("运行用户"),right:B.user})]})}),D&&(0,y.jsx)(i.VP,{children:(0,y.jsx)(o.uF,{title:t("物理硬盘"),children:(0,y.jsx)(h.X,{headers:s,rows:R,width:"10rem"})})}),T&&(0,y.jsx)(i.VP,{children:(0,y.jsx)(o.uF,{title:t("文件硬盘"),children:(0,y.jsx)(h.X,{headers:_,rows:J,width:"10rem"})})})]})]}),se&&"check"===se.type&&(0,y.jsx)(w,{...se.data}),se&&"mount"===se.type&&(0,y.jsx)(P,{})]})}var I=s(75007),N=s(97856),E=s(64405);const K=n.lazy(()=>Promise.all([s.e(4924),s.e(5614)]).then(s.bind(s,85614)));function M(e){const[t,s]=(0,n.useState)(null),[i,o]=(0,m.fp)(f.AG.dockerShellShow),[r,a]=(0,m.fp)(f.AG.user_base_info),d=r.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",u=()=>{(async()=>{t&&(t.writeln("[38;2;29;153;243mclose![0m "),t.dispose(),s(null))})()};(0,n.useEffect)(()=>{i.show?(async()=>{const e=new N.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:d,cursor:d,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});let t;l.ws.subscribeUnconnect(u);const n=t=>{e.write(t)};t=s=>{e.clear(),e.write(s),t=n},l.ws.addMsg("logs"===i.type?c.HK.docker_shell_logs_getting:c.HK.docker_shell_exec_getting,e=>{"error"===e.context&&u(),t(e.context)}),"exec"===i.type&&e.onData(async e=>{const t=new c.hf(c.HK.docker_shell_exec);t.context=e,await l.ws.send(t)}),s(e)})():u()},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,y.jsx)(K,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n=new E.n;let o;n.rows=e,n.cols=s,n.dockerId=i.dockerId,o="logs"===i.type?new c.hf(c.HK.docker_shell_logs):new c.hf(c.HK.docker_shell_exec_open),o.context=n,l.ws.send(o)}})}var B=s(89824),H=s(61973),Z=s(87361);let G="",D=[],z=!1;function T(e){const{t}=(0,p.Bd)(),s=(0,H.Zp)(),[r]=(0,m.fp)(f.AG.user_base_info),[j,w]=(0,n.useState)({}),[v,k]=(0,n.useState)([]),[C,A]=(0,n.useState)([]),{check_user_auth:V}=(0,S.MH)(),[P,$]=(0,m.fp)(f.AG.dockerShellShow),[Y,F]=(0,m.fp)(f.AG.showPrompt),[N,E]=(0,m.fp)(f.AG.confirm),[K,T]=(0,n.useState)(G),[W,X]=(0,n.useState)(["id",t("名字"),t("镜像"),t("命令"),t("状态"),t("内存"),"cpu%",t("选择")]),[q,U]=(0,n.useState)([]),[L,R]=(0,n.useState)(void 0),[O,J]=(0,n.useState)(!1),Q=["id",t("name"),t("create时间"),t("大小"),(0,y.jsxs)("span",{children:["选中",(0,y.jsx)(u.rA,{icon:"check_box",title:"全选",onClick:()=>{z=!z;const e={};for(let t=0;t<C.length&&z;t++)e[C[t][0].props.context]=1;w(e)}})]})],ee=(0,n.useRef)(()=>{}),te=async()=>{k([]),U([]),l.ws.off_message(`message_${c.HK.docker_getting}`,ee.current);const e=e=>{k((e=>{const t=[];if(G){for(const s of e)for(const e of s)if(`${e}`.includes(G)){t.push(s);break}}else t.push(...e);return t.map(e=>{const t=e.map(e=>(0,y.jsx)(o.xP,{context:e}));return t.push((0,y.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{U(t)}})),t})})(e.context??[]))};ee.current=e,l.ws.addMsg(c.HK.docker_getting,e);const t=new c.hf(c.HK.docker_get);await l.ws.send(t)};(0,n.useEffect)(()=>(T(G),te(),()=>{(async()=>{l.ws.off_message(`message_${c.HK.docker_getting}`,ee.current),$({show:!1,type:"",dockerId:""})})()}),[]),(0,n.useEffect)(()=>{G=K},[K]);const se=()=>{const e=new c.hf("logs"===P.type?c.HK.docker_shell_logs_cancel:c.HK.docker_shell_exec_cancel);e.context="",l.ws.send(e)},ne=e=>{const t=new c.hf(c.HK.docker_switch);t.context={type:e,dockerId:q[0].props.context},U([]),l.ws.send(t)},ie=async()=>{const e=await a.Yu.get("docker/images");if(e.code===x.m.Success){const t=e.data??[],s=[];for(let e=0;e<t.length;e++){const n=t[e],i=[(0,y.jsx)(o.xP,{context:n[0]}),(0,y.jsx)(o.xP,{context:n[1]}),n[2],n[3],""];s.push(i)}D=s,A(s)}};return(0,y.jsxs)("div",{children:[(0,y.jsx)(d.aZ,{children:(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("doc_img"),clickFun:e=>{J(e),e?(ie(),U([])):(te(),A([]),w({}))}})}),(0,y.jsxs)(d.aZ,{position:"right",children:[r.sys===b.XM.linux&&(0,y.jsx)(u.rA,{icon:"settings",title:t("doc_cfg"),onClick:()=>s(Z.o.docker_setting_page)}),Object.keys(j).length>0&&(0,y.jsx)(u.rA,{icon:"delete",title:t("删除镜像"),onClick:async()=>{E({open:!0,title:t("doc_icf"),handle:async()=>{const e=Object.keys(j),t=await a.Yu.post("docker/check/delete",{ids:e});if(t.code===x.m.Success)if(0===t.data.length){(await a.Yu.post("docker/delete",{ids:e})).code===x.m.Success&&((0,g.SK)("删除完成"),ie(),E({open:!1,handle:null}))}else(0,g.N9)(`有镜像正在运行${JSON.stringify(t.data)}`)}})}}),q.length>0&&(0,y.jsx)("div",{children:q[1].props.context}),q.length>0&&(0,y.jsxs)("div",{children:[V(b.oV.docker_container_update)&&(0,y.jsx)(u.rA,{icon:"delete",title:t("删除容器"),onClick:()=>{F({show:!0,overlay:!0,type:B.PromptEnum.DockerDel,data:{dockerId:q[0].props.context,name:q[1].props.context}})}}),(0,y.jsx)(u.rA,{icon:"print",title:t("打印日志"),onClick:()=>{P.show?($({show:!1,type:"",dockerId:""}),se()):$({show:!0,dockerId:q[0].props.context,type:"logs"})}}),V(b.oV.docker_container_update)&&(0,y.jsx)(u.rA,{icon:"personal_video",title:t("执行命令"),onClick:()=>{P.show?($({show:!1,type:"",dockerId:""}),se()):$({show:!0,dockerId:q[0].props.context,type:"exec"})}}),V(b.oV.docker_container_update)&&q[4].props.context.includes("Up")&&(0,y.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>ne("stop")}),V(b.oV.docker_container_update)&&!q[4].props.context.includes("Up")&&(0,y.jsx)(u.rA,{icon:"play_arrow",title:t("开启"),onClick:()=>{ne("start")}})]}),(0!==v.length||K)&&!O&&(0,y.jsx)(u.rA,{icon:"refresh",title:t("列表更新"),onClick:async()=>{const e=new c.hf(c.HK.docker_get);await l.ws.send(e)}})]}),(0,y.jsxs)(i.xh,{children:[O&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(o.uF,{title:`${t("镜像")} (${C.length})`,rightTopCom:(0,y.jsx)(_.Sm,{placeholder:t("过滤镜像"),value:L,handleInputChange:e=>{R(e)},handlerEnter:()=>{const e=[];if(L){for(const t of C)(t[0].props.context.includes(L)||t[1].props.context.includes(L))&&e.push(t);A(e)}else A(D)}}),children:(0,y.jsx)(h.X,{headers:Q,rows:C.map((e,s)=>(e[4]=(0,y.jsx)(_.GL,{context:t(""),selected:j[e[0].props.context],onchange:()=>{(e=>{const t={};Object.assign(t,j),t[e]?delete t[e]:t[e]=1,w(t)})(e[0].props.context)}}),e)),width:"10rem"})})})}),0===v.length&&!K&&!O&&(0,y.jsx)(I.h,{context:t("dc_nne")}),(0!==v.length||K)&&!O&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(o.uF,{title:`${t("容器")} (${v.length})`,rightTopCom:(0,y.jsx)(_.Sm,{placeholder:t("过滤"),value:K,handleInputChange:e=>{T(e)}}),children:(0,y.jsx)(h.X,{headers:W,rows:v,width:"10rem"})})})})]}),(0,y.jsx)(M,{})]})}var W=s(64694);let X="",q=!1,U=!1;function L(e){const{t}=(0,p.Bd)(),[s,r]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[m,f]=(0,n.useState)(0),[j,g]=(0,n.useState)(""),[w,v]=(0,n.useState)(["pid",t("名字"),t("创建用户"),(0,y.jsxs)("span",{children:[t("内存"),(0,y.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{q=!q}})]}),(0,y.jsxs)("span",{children:["cpu%",(0,y.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{U=!U}})]}),t("选择")]),{check_user_auth:k}=(0,S.MH)();(0,n.useEffect)(()=>{g(X),(async()=>{r([]),f(0),x([]);const e=new c.hf(c.HK.process_get);await l.ws.send(e),l.ws.addMsg(c.HK.process_getting,e=>{const s=[];if(X){for(const t of e.context)for(const e of t)if(`${e}`.includes(X)){s.push(t);break}}else s.push(...e.context);q&&(0,W.di)(s,e=>e[3],!1),U&&(0,W.di)(s,e=>e[4],!1);const n=s.map(e=>{const s=e.map((e,t)=>(0,y.jsx)(o.xP,{context:3===t?(0,$.v7)(e):e}));return s.push((0,y.jsx)(u.rA,{icon:"place",title:t("选中"),onClick:()=>{x(s)}})),s});f(s.length),r(n)})})()},[]),(0,n.useEffect)(()=>{X=j},[j]);return(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.aZ,{position:"right",children:[a.length>0&&(0,y.jsx)("div",{children:a[1].props.context}),a.length>0&&k(b.oV.sys_process_close)&&(0,y.jsx)("div",{children:(0,y.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>{const e=new c.hf(c.HK.process_close);e.context={pid:a[0].props.context},x([]),l.ws.send(e)}})})]}),(0,y.jsx)(i.xh,{children:0!==s.length||X?(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(o.uF,{title:`${t("进程")} (${m})`,rightTopCom:(0,y.jsx)(_.Sm,{placeholder:t("过滤"),value:j,handleInputChange:e=>{g(e)}}),children:(0,y.jsx)(h.X,{headers:w,rows:s,width:"10rem"})})})}):(0,y.jsx)(I.h,{context:t("ld_wait")})})]})}const R=n.lazy(()=>Promise.all([s.e(4924),s.e(5614)]).then(s.bind(s,85614)));function O(e){const[t,s]=(0,n.useState)(null),[i,o]=(0,m.fp)(f.AG.systemd_shell_show),[r,a]=(0,m.fp)(f.AG.user_base_info),d=r.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",u=()=>{(async()=>{t&&(t.writeln("[38;2;29;153;243mclose![0m "),t.dispose(),s(null))})()};(0,n.useEffect)(()=>{if(!i.show)return void u();(async()=>{const e=new N.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:d,cursor:d,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});l.ws.subscribeUnconnect(u),l.ws.addMsg(c.HK.systemd_logs_getting,t=>{"error"===t.context&&u(),e.write(t.context)}),s(e)})();const e=e=>{};return document.addEventListener("cancel_systemd_logs",e),()=>{document.removeEventListener("cancel_systemd_logs",e)}},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,y.jsx)(R,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n={unit_name:i.unit_name},o=new c.hf(c.HK.systemd_logs_get);o.context=n,l.ws.send(o)}})}const J=[{title:"no(不自动重启)",value:"no"},{title:"always(总是重启)",value:"always"},{title:"on-failure(失败才重启)",value:"on-failure"},{title:"on-abnormal(异常才重启)",value:"on-abnormal"}],Q=[{title:"simple",value:"simple"},{title:"forking",value:"forking"},{title:"oneshot",value:"oneshot"},{title:"notify",value:"notify"}],ee=[{title:"multi-user.target",value:"multi-user.target"},{title:"network.target",value:"network.target"}];function te(e,t){const s=[];s.push("[Unit]"),t.description.trim()?s.push(`Description=${t.description.trim()}`):s.push(`Description=${e}`),s.push(""),s.push("[Service]"),s.push(`Type=${t.type.trim()||"simple"}`),t.exec_start.trim()&&s.push(`ExecStart=${t.exec_start.trim()}`),t.working_dir.trim()&&s.push(`WorkingDirectory=${t.working_dir.trim()}`),t.user_.trim()&&s.push(`User=${t.user_.trim()}`);for(const e of t.env){const t=e.key.trim();if(!t)continue;const n=e.value??"",i=`${t}=${n}`,o=/[\s"'\\]/.test(n);s.push(`Environment=${o?`"${i.replace(/"/g,'\\"')}"`:i}`)}return t.restart&&"no"!==t.restart&&s.push(`Restart=${t.restart.trim()}`),s.push(""),s.push("[Install]"),s.push(`WantedBy=${t.wanted.trim()||"multi-user.target"}`),s.push(""),s.join("\n")}function se(e){const t={description:"",type:"simple",exec_start:"",working_dir:"",user_:"root",restart:"no",wanted:"multi-user.target",env:[]},s=(t,s)=>{const n=e.split(/\r?\n/);let i=!1;for(const e of n){const n=e.trim(),o=n.match(/^\[(.*)\]$/);if(o){i=(o[1]||"").trim()===t;continue}if(!i)continue;const r=n.match(new RegExp(`^${s}\\s*=\\s*(.*)$`,"i"));if(r)return r[1].trim()}return""};t.description=s("Unit","Description"),t.type=s("Service","Type")||"simple",t.exec_start=s("Service","ExecStart"),t.working_dir=s("Service","WorkingDirectory"),t.user_=s("Service","User"),t.restart=s("Service","Restart")||"no",t.wanted=s("Install","WantedBy")||"multi-user.target";let n=!1;for(const s of e.split(/\r?\n/)){const e=s.trim(),i=e.match(/^\[(.*)\]$/);if(i){n="Service"===(i[1]||"").trim();continue}if(!n)continue;const o=e.match(/^Environment\s*=\s*(.*)$/i);if(!o)continue;const r=o[1].trim();if(!r)continue;const c=[];let l=0;for(;l<r.length;){const e=r[l];if(/\s/.test(e))l++;else if('"'===e||"'"===e){const t=e;l++;const s=l;for(;l<r.length&&r[l]!==t;)l++;c.push({text:r.slice(s,l),quoted:!0}),l++}else{const e=l;for(;l<r.length&&!/\s/.test(r[l]);)l++;c.push({text:r.slice(e,l),quoted:!1})}}for(const e of c){const s=e.text,n=s.indexOf("=");n>0?t.env.push({key:s.slice(0,n).trim(),value:s.slice(n+1)}):t.env.length&&(t.env[t.env.length-1].value+=" "+s)}}return t}function ne(e){const{t}=(0,p.Bd)(),[s,i]=(0,n.useState)("form"),[o,r]=(0,n.useState)(()=>(e.unit_name||"").replace(/\.service$/i,"")),[c,l]=(0,n.useState)({description:"",type:"simple",exec_start:"",working_dir:"",user_:"root",restart:"no",wanted:"multi-user.target",env:[]}),[d,u]=(0,n.useState)(""),[h,j]=(0,n.useState)(""),[w,v]=(0,n.useState)(!1),[k,S]=(0,m.fp)(f.AG.confirm);(0,n.useEffect)(()=>{"edit"===e.mode&&e.unit_name&&(async()=>{v(!0);try{const t=await a.Yu.post("systemd/get/context",{unit_name:e.unit_name});if(t.code!==x.m.Success)return;const s=t.data.context??"",n=t.data.path??"";j(n),u(s),l(se(s))}finally{v(!1)}})()},[e.mode,e.unit_name]);const b=e=>{e!==s&&("text"===e?u(te(o,c)):l(se(d)),i(e))},C=e=>t=>{l(s=>({...s,[e]:t}))},A=(e,t,s)=>{l(n=>{const i=[...n.env];return i[e]={...i[e],[t]:s},{...n,env:i}})};return(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{style:{display:"flex",gap:"0.4rem",marginBottom:"0.6rem"},children:[(0,y.jsx)("button",{className:"button button--flat "+("form"===s?"":"button--grey"),onClick:()=>b("form"),children:t("表单")}),(0,y.jsx)("button",{className:"button button--flat "+("text"===s?"":"button--grey"),onClick:()=>b("text"),children:t("文本")})]}),w?(0,y.jsx)("div",{children:t("加载中...")}):"form"===s?(0,y.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.6rem"},children:[(0,y.jsx)(_.BC,{label:t("服务名称"),children:(0,y.jsx)(_.Sm,{placeholder:t("服务名称"),value:o,disabled:"edit"===e.mode,handleInputChange:e=>r(e),width:"100%"})}),(0,y.jsx)(_.BC,{label:t("服务描述"),children:(0,y.jsx)(_.Sm,{placeholder:t("服务描述"),value:c.description,handleInputChange:C("description"),width:"100%"})}),(0,y.jsx)(_.BC,{label:t("启动命令"),required:!0,children:(0,y.jsx)(_.Sm,{placeholder:t("ExecStart 启动命令,必填"),value:c.exec_start,handleInputChange:C("exec_start"),width:"100%"})}),(0,y.jsx)(_.BC,{label:t("运行类型"),children:(0,y.jsx)(_.l6,{options:Q,value:c.type,onChange:C("type")})}),(0,y.jsx)(_.BC,{label:t("工作目录"),children:(0,y.jsx)(_.Sm,{placeholder:t("工作目录(可选)"),value:c.working_dir,handleInputChange:C("working_dir"),width:"100%"})}),(0,y.jsx)(_.BC,{label:t("运行用户"),children:(0,y.jsx)(_.Sm,{placeholder:t("运行用户(可选)"),value:c.user_,handleInputChange:C("user_"),width:"100%"})}),(0,y.jsx)(_.BC,{label:t("重启策略"),children:(0,y.jsx)(_.l6,{options:J,value:c.restart,onChange:C("restart")})}),(0,y.jsx)(_.BC,{label:t("安装目标"),children:(0,y.jsx)(_.l6,{options:ee,value:c.wanted,onChange:C("wanted")})}),(0,y.jsxs)("div",{className:"div-row",style:{justifyContent:"space-between"},children:[(0,y.jsx)("span",{children:t("环境变量")}),(0,y.jsx)("button",{className:"button button--flat button--grey",onClick:()=>l(e=>({...e,env:[...e.env,{key:"",value:""}]})),children:t("添加")})]}),0===c.env.length&&(0,y.jsx)("div",{className:"text-secondary",style:{fontSize:"0.85rem"},children:t("暂无环境变量")}),c.env.map((e,s)=>(0,y.jsxs)("div",{className:"div-row",style:{gap:"0.4rem"},children:[(0,y.jsx)(_.Sm,{placeholder:"KEY",value:e.key,width:"35%",handleInputChange:e=>A(s,"key",e)}),(0,y.jsx)(_.Sm,{placeholder:"value",value:e.value,width:"50%",handleInputChange:e=>A(s,"value",e)}),(0,y.jsx)("button",{className:"button button--flat button--grey",onClick:()=>(e=>{l(t=>({...t,env:t.env.filter((t,s)=>s!==e)}))})(s),children:t("删除")})]},s))]}):(0,y.jsx)(_.Z2,{style:{width:"100%",minHeight:"16rem",fontFamily:"monospace",fontSize:"0.85rem",boxSizing:"border-box"},value:d,onChange:e=>u(e.target.value),spellCheck:!1}),(0,y.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.4rem",marginTop:"0.6rem"},children:[(0,y.jsx)("button",{className:"button button--flat button--grey",disabled:w,onClick:e.onClose,children:t("取消")}),(0,y.jsx)("button",{className:"button button--flat",disabled:w,onClick:async()=>{if(!o.trim())return void(0,g.zN)(t("请填写服务名称"));const n=(i=o).trim().endsWith(".service")?i.trim():`${i.trim()}.service`;var i;const r="text"===s?d:te(n,c);if(r.includes("ExecStart=")){if("form"===s){if(c.env.find(e=>!e.key.trim()&&""!==(e.value??"").trim()))return void(0,g.zN)(t("环境变量的 KEY 不能为空"))}v(!0);try{if("create"===e.mode){const s=`/etc/systemd/system/${n}`;await a.Yu.post("systemd/sys/save",{unit_name:n,path:s,context:r}),await a.Yu.post("systemd/sys/enable",{unit_name:n}),await a.Yu.post("systemd/add",{unit_name:n}),(0,g.SK)(t("添加成功")),e.onClose(),e.onDone?.()}else await a.Yu.post("systemd/sys/save",{unit_name:n,path:h,context:r}),(0,g.SK)(t("保存成功")),e.onClose(),e.onDone?.(),S({open:!0,title:t("配置已保存,是否立即重启该服务让新配置生效?"),handle:async()=>{(await a.Yu.post("systemd/sys/restart",{unit_name:n})).code===x.m.Success&&((0,g.SK)(t("重启成功")),S({open:!1,handle:null}))}})}catch(e){console.error("systemd 保存失败",e)}finally{v(!1)}}else(0,g.zN)(t("请至少填写 ExecStart 启动命令"))},children:t("保存")})]})]})}let ie,oe="";function re(e){const{t}=(0,p.Bd)(),{check_user_auth:s}=(0,S.MH)(),[r,j]=(0,m.fp)(f.AG.systemd_shell_show),[w,v]=(0,m.fp)(f.AG.confirm),[k,C]=(0,n.useState)(["pid","name","process",t("创建用户"),t("内存"),t("cpu%"),t("active状态"),t("选择")]),[A,V]=(0,n.useState)(["单元名字","加载状态",t("active(sub)状态"),t("描述"),t("选择")]),[P,Y]=(0,n.useState)([]),[F,N]=(0,n.useState)([]),[E,K]=(0,n.useState)([]),[M,B]=(0,n.useState)(!1),[H,Z]=(0,n.useState)([]),[G,D]=(0,n.useState)(""),[z,T]=(0,n.useState)(""),[W,X]=(0,n.useState)(new Set),[q,U]=(0,m.fp)(f.AG.editorSetting),[L,R]=(0,m.fp)(f.AG.prompt_card);(0,n.useEffect)(()=>{T(oe),(async()=>{Y([]),K([]);const e=new c.hf(c.HK.systemd_inside_get);await l.ws.send(e),l.ws.addMsg(c.HK.systemd_inside_getting,e=>{const t=[];if(oe){for(const s of e.context)for(const e of s)if(`${e}`.includes(oe)){t.push(s);break}}else t.push(...e.context);Y(t.map(e=>{const t=e.map((e,t)=>(0,y.jsx)(o.xP,{context:4===t?(0,$.v7)(e):e}));return t.push((0,y.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{K(t)}})),t}))})})()},[]),(0,n.useEffect)(()=>{oe=z},[z]);const J=e=>{if(r.show){j({show:!1,unit_name:""});const e=new CustomEvent("cancel_systemd_logs",{detail:{}});document.dispatchEvent(e)}else j({show:!0,unit_name:e})},Q=async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/sys/restart",{unit_name:e})).code===x.m.Success&&((0,g.SK)(t("重启成功")),v({open:!1,handle:null}))}})},ee=async()=>{N([]),Z([]);const e=await a.Yu.get("systemd/inside/all");if(e.code!==x.m.Success)return;X(new Set(e.data));const t=await a.Yu.get("systemd/allget");if(t.code===x.m.Success){const e=t.data,s=[];for(const t of e??[]){const e=[(0,y.jsx)(o.xP,{context:t.unit}),t.load,`${t.active}(${t.sub})`,(0,y.jsx)(o.xP,{context:t.description})];s.push([...e,(0,y.jsx)(u.rA,{icon:"place",title:"添加",onClick:()=>{Z([...e])}})])}ie=s,N(s)}},te=(e,s)=>{R({open:!0,title:t("create"===e?"新建 systemd 服务":"编辑 systemd 服务"),context_div:(0,y.jsx)(ne,{mode:e,unit_name:s,onClose:()=>R({open:!1}),onDone:()=>{R({open:!1}),l.ws.send(new c.hf(c.HK.systemd_inside_get)),M&&ee(),K([]),Z([])}})})};return(0,y.jsxs)("div",{children:[(0,y.jsx)(d.aZ,{children:(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("系统systemd单元"),clickFun:e=>{B(e),e?(ee(),K([])):Z([])}})}),(0,y.jsxs)(d.aZ,{position:"right",children:[s(b.oV.systemd)&&(0,y.jsx)("div",{children:(0,y.jsx)(u.rA,{icon:"add_circle",title:t("添加 systemd"),onClick:()=>{te("create")}})}),E.length>0&&(0,y.jsx)("div",{children:E[1].props.context}),H.length>0&&(0,y.jsx)("div",{children:H[0].props.context}),E.length>0&&(0,y.jsxs)("div",{children:[s(b.oV.systemd)&&(0,y.jsx)(u.rA,{icon:"remove",title:"从实时监控删除",onClick:()=>{(async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/delete",{unit_name:e})).code===x.m.Success&&((0,g.SK)("删除成功"),v({open:!1,handle:null}))}})})(E[1].props.context)}}),s(b.oV.systemd)&&(0,y.jsx)(u.rA,{icon:"edit",title:"可视化编辑",onClick:()=>{te("edit",E[1].props.context)}}),s(b.oV.systemd)&&W.has(E[1].props.context)&&(0,y.jsx)(u.rA,{icon:"restart_alt",title:t("重启服务"),onClick:()=>{Q(E[1].props.context)}}),(0,y.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(E[1].props.context)}})]}),H.length>0&&(0,y.jsxs)("div",{children:[s(b.oV.systemd)&&(0,y.jsx)(u.rA,{icon:"delete",title:"删除系统上的sytemd",onClick:()=>{(async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/sys/delete",{unit_name:e})).code===x.m.Success&&((0,g.SK)("删除成功"),v({open:!1,handle:null}))}})})(H[0].props.context)}}),(0,y.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(H[0].props.context)}}),s(b.oV.systemd)&&(0,y.jsx)(u.rA,{icon:"restart_alt",title:t("重启服务"),onClick:()=>{Q(H[0].props.context)}}),s(b.oV.systemd)&&(0,y.jsx)(u.rA,{icon:"text_fields",title:"sytemd文件内容",onClick:()=>{(async t=>{const s=await a.Yu.post("systemd/get/context",{unit_name:t});s.code===x.m.Success&&(U({model:"text",open:!0,fileName:e.name,save:async e=>{const n={unit_name:t,path:s.data.path,context:e};(await a.Yu.post("systemd/sys/save",n)).code===x.m.Success&&S.xK.set_value_temp("")}}),S.xK.set_value_temp(s.data.context))})(H[0].props.context)}}),s(b.oV.systemd)&&!W.has(H[0].props.context)&&(0,y.jsx)(u.rA,{icon:"plus_one",title:"添加到管理",onClick:()=>(async e=>{const t=await a.Yu.post("systemd/add",{unit_name:e});t.code===x.m.Success&&(X(new Set(t.data)),(0,g.SK)("添加成功"))})(H[0].props.context)})]})]}),(0,y.jsxs)(i.xh,{children:[M&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(o.uF,{title:`systemd系统单元(${F.length})`,rightTopCom:(0,y.jsx)(_.Sm,{placeholder:"过滤单元",value:G,handleInputChange:e=>{D(e)},handlerEnter:()=>{const e=[];if(G){for(const t of ie)(t[0].props.context.includes(G)||t[3].props.context.includes(G))&&e.push(t);N(e)}else N(ie)}}),children:(0,y.jsx)(h.X,{headers:A,rows:F,width:"10rem"})})})}),0===P.length&&!M&&(0,y.jsx)(I.h,{context:"没有管理的单元 or 加载中请等待..."}),0!==P.length&&!M&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(o.uF,{title:`filecat监控单元(${P.length})`,rightTopCom:(0,y.jsx)(_.Sm,{placeholder:"过滤单元",value:z,handleInputChange:e=>{T(e)}}),children:(0,y.jsx)(h.X,{headers:k,rows:P,width:"10rem"})})})})]}),(0,y.jsx)(O,{})]})}function ce(){const{t:e}=(0,p.Bd)(),t=[{title:e("放行"),value:"allow"},{title:e("拒绝"),value:"deny"},{title:e("限速"),value:"limit"},{title:e("拒绝响应"),value:"reject"}],s=[{title:e("入站"),value:"in"},{title:e("出站"),value:"out"}],[r,c]=(0,n.useState)(null),[l,j]=(0,n.useState)("allow"),[w,v]=(0,n.useState)("in"),[k,S]=(0,n.useState)("tcp"),[b,C]=(0,n.useState)(""),[A,V]=(0,n.useState)(""),[P,$]=(0,n.useState)("list"),[Y,F]=(0,n.useState)([]),[N,E]=(0,n.useState)(""),[K,M]=(0,n.useState)(!1),[B,H]=(0,m.fp)(f.AG.confirm),Z=async()=>{try{const e=await a.V_.get("status");e.code===x.m.Success&&c(e.data)}catch(e){}},G=async()=>{M(!0);try{const e=await a.V_.get("rules");if(e.code===x.m.Success){const t=e.data;F(t?.rules??[]),E(t?.raw??"")}}catch(e){F([]),E("")}finally{M(!1)}};(0,n.useEffect)(()=>{Z(),G()},[]);const D=!0===r?.installed,z=!0===r?.active;return(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.aZ,{position:"right",children:[(0,y.jsxs)("div",{children:[e("已安装"),": ",D?(0,y.jsx)("span",{style:{color:"green"},children:"✓"}):(0,y.jsx)("span",{style:{color:"red"},children:"✗"})]}),(0,y.jsxs)("div",{children:[e("已启用"),": ",z?(0,y.jsx)("span",{style:{color:"green"},children:"✓"}):(0,y.jsx)("span",{style:{color:"gray"},children:"✗"})]}),D&&(0,y.jsx)(u.rA,{icon:"power_settings_new",title:e(z?"停用":"启用"),onClick:()=>(async t=>{try{const s=await a.V_.post("enable",{enabled:t});if(s.code!==x.m.Success)return void(0,g.zN)(s.message||e("操作失败"));(0,g.SK)(s.data||e(t?"已启用":"已停用")),Z(),G()}catch(e){}})(!z)}),(0,y.jsx)(u.rA,{icon:"refresh",title:e("刷新规则"),onClick:G})]}),(0,y.jsxs)(i.xh,{children:[(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:35,children:(0,y.jsxs)(o.uF,{title:e("添加ufw规则"),rightTopCom:(0,y.jsx)(u.rA,{icon:"add",title:e("添加"),onClick:async()=>{if(b.trim())try{const t=await a.V_.post("rule/add",{action:l,direction:w,proto:k,port:b.trim(),from:"in"===w&&A.trim()||void 0});if(t.code!==x.m.Success)return void(0,g.zN)(t.message||e("操作失败"));(0,g.SK)(t.data||e("已添加")),G()}catch(e){}else(0,g.zN)(e("请填写端口号"))}}),children:[(0,y.jsx)(_.BC,{label:e("动作"),label_width:"4rem",input_max_width:"8rem",children:(0,y.jsx)(_.l6,{options:t,value:l,onChange:e=>j(e),defaultValue:"allow"})}),(0,y.jsx)(_.BC,{label:e("方向"),label_width:"4rem",input_max_width:"8rem",children:(0,y.jsx)(_.l6,{options:s,value:w,onChange:e=>v(e),defaultValue:"in"})}),(0,y.jsx)(_.BC,{label:e("协议"),label_width:"4rem",input_max_width:"8rem",children:(0,y.jsx)(_.l6,{options:[{title:"tcp",value:"tcp"},{title:"udp",value:"udp"}],value:k,onChange:e=>S(e),defaultValue:"tcp"})}),(0,y.jsx)(_.BC,{label:e("端口"),label_width:"4rem",required:!0,children:(0,y.jsx)(_.Sm,{maxWidth:"20rem",placeholder:e("可填范围如 1000:2000"),value:b,handleInputChange:e=>C(e)})}),"in"===w&&(0,y.jsx)(_.BC,{label:e("来源"),label_width:"4rem",children:(0,y.jsx)(_.Sm,{maxWidth:"20rem",placeholder:e("IP/网段,可选"),value:A,handleInputChange:e=>V(e)})})]})})}),(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsxs)(o.uF,{title:e("规则列表"),rightTopCom:(0,y.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,y.jsx)(u.C3,{text:e("名单视图"),clickFun:()=>$("list")}),(0,y.jsx)(u.C3,{text:e("文本视图"),clickFun:()=>$("text")})]}),children:[K&&(0,y.jsx)(I.h,{context:e("加载中...")}),!K&&"list"===P&&(0===Y.length?(0,y.jsx)(I.h,{context:e("暂无规则")}):(0,y.jsx)(h.X,{headers:[e("编号"),e("目标(To)"),e("动作"),e("fw_from"),e("备注"),e("操作")],rows:Y.map(t=>[t.number,(0,y.jsx)(o.xP,{context:t.to,tip_context:t.to}),t.action,t.from?(0,y.jsx)(o.xP,{context:t.from,tip_context:t.from}):"",t.description||"",(0,y.jsx)(u.rA,{icon:"delete",title:e("删除规则"),onClick:()=>(async(t,s,n)=>{H({open:!0,title:e("确定删除吗?"),sub_title:e(`${s} ${n}`),handle:async()=>{try{const s=await a.V_.post("ufw/rule/del",{number:t});if(s.code!==x.m.Success)return void(0,g.zN)(s.message||e("操作失败"));(0,g.SK)(s.data||e("规则已删除")),H({open:!1,handle:null}),G()}catch(e){}}})})(t.number,t.to,t.from)})]),width:"8rem"})),!K&&"text"===P&&(N?(0,y.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.85rem",margin:0},children:N}):(0,y.jsx)(I.h,{context:e("暂无规则")}))]})})})]})]})}function le(e){const{t}=(0,p.Bd)(),[s,n]=(0,m.fp)(f.AG.user_base_info),o=[{index:1,name:t("系统性能"),rto:"sys/",component:(0,y.jsx)(F,{})},{index:2,name:t("系统进程"),rto:"process/",component:(0,y.jsx)(L,{})},{index:3,name:t("doc_ct"),rto:"docker/",component:(0,y.jsx)(T,{})}];if(s.sys===b.XM.linux){(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.systemd))&&o.push({index:4,name:t("systemd"),rto:"systemd/",component:(0,y.jsx)(re,{})});(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.firewall))&&s.sysSoftWare?.[j.jk.ufw]?.installed&&o.push({index:5,name:t("防火墙"),rto:"firewall/",component:(0,y.jsx)(ce,{})})}return(0,y.jsx)(i.W1,{optionList:o,father_route:Z.o.info})}}}]);
|