filecat 7.9.0 → 7.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +173 -182
- package/build/dist/{4967.3fd3bd40a2b5a3b52428.js → 1060.198d91e2dfc174317c3a.js} +1 -1
- package/build/dist/1075.05eed88707339ca32044.js +1 -0
- package/build/dist/{1142.121454b1de53689b7367.js → 1142.bc43fae2e5e38d9359df.js} +1 -1
- package/build/dist/1384.edbad9c24d883a59724d.js +1 -0
- package/build/dist/1417.d390b18dd58ff5c28160.js +1 -0
- package/build/dist/1448.4db495e1389c0c8445b3.js +1 -0
- package/build/dist/{3324.22efcb1c431177b1cf5f.js → 1455.26a021eb94e5bdd5bec2.js} +1 -1
- package/build/dist/{1636.b6a17252dfd0d22f09a7.js → 1636.b80b1883358e132d3424.js} +1 -1
- package/build/dist/{1832.8ea5c3e8288df0b7fd5c.js → 1832.a01933ba5df99576ecc2.js} +1 -1
- package/build/dist/2300.c99b1dd4e752cdfd5e32.js +2 -0
- package/build/dist/{2300.9e1baa1c0368abe53d96.js.LICENSE.txt → 2300.c99b1dd4e752cdfd5e32.js.LICENSE.txt} +1 -1
- package/build/dist/239.f570f06d4b9c020f1013.js +1 -0
- package/build/dist/{2479.dcc88b3370f0f1d66e02.js → 2479.294792ef5d360ad64abc.js} +1 -1
- package/build/dist/2542.26cb302b60de23166227.js +1 -0
- package/build/dist/{259.81bb9e049e5ef587a96f.js → 259.3c0eb22e9b43ffb63c9c.js} +1 -1
- package/build/dist/2626.3bcfe1f26d9cb796a925.js +1 -0
- package/build/dist/2674.d1bf937289c51ddeceac.js +1 -0
- package/build/dist/3233.43bdd7c12ca829d56116.js +1 -0
- package/build/dist/3299.de79d172b41af93a8716.js +1 -0
- package/build/dist/{6992.f6a07311a638794c24f7.js → 3471.ef3b5dcfe37963034187.js} +1 -1
- package/build/dist/{3528.56eeefab6fca5884e2a6.js → 3528.0f8f34028d92fa87c518.js} +1 -1
- package/build/dist/{3659.8a31495bb8f38c0ffa7c.js → 3659.dd03dc2ac52a3ff19105.js} +1 -1
- package/build/dist/4004.f4c06b50348214eb2962.js +1 -0
- package/build/dist/{4560.8ef2e4b60cc86d019dd6.js → 4560.fd9f8cf2d6022b1d3a94.js} +1 -1
- package/build/dist/{4903.b5451ed0802b3f7c07b2.js → 4903.070aaa53a243baf05133.js} +1 -1
- package/build/dist/{4946.c95d4f426146e0180172.js → 4946.d578f6ba367a742d80bf.js} +2 -2
- package/build/dist/4986.f244efce9cf6be21f846.js +1 -0
- package/build/dist/5272.1f0dfac07ba202e7d323.js +1 -0
- package/build/dist/{5308.052f45c15785487b3766.js → 5308.d1e5ccb49396fc1b026d.js} +1 -1
- package/build/dist/{5516.645e4a900df9bdc1806c.js → 5516.88521f3a3c7101c46df3.js} +1 -1
- package/build/dist/5614.43bdd7c12ca829d56116.js +1 -0
- package/build/dist/{5139.adf9574d9b54a216e041.js → 5709.81f43e3c021fafdfe36f.js} +1 -1
- package/build/dist/{5744.e9f1efb88a617b05b709.js → 5744.0f8a0432b73b2eb0a7ff.js} +1 -1
- package/build/dist/{5877.ca081c4798194230243c.js → 5877.98d0475aaf4058b9a715.js} +1 -1
- package/build/dist/{6247.917e3fbef5dc5fbaf937.js → 6247.525b0b68872036ac2fa6.js} +1 -1
- package/build/dist/{7520.fbb0bc2a05cf94e15418.js → 6322.552511b5cb12cd0c821c.js} +1 -1
- package/build/dist/6492.17ecd8515fa512ce9306.js +1 -0
- package/build/dist/{676.a75318a8b598d8daadf0.js → 676.356039ef6f28f96b8c8b.js} +1 -1
- package/build/dist/{6805.bf0c964ab84f0fcc78be.js → 6805.373ac0e7d6555e4a6459.js} +1 -1
- package/build/dist/{6919.8cf13c01184b7148b28e.js → 6919.c7cc8617b658198d4924.js} +1 -1
- package/build/dist/{7038.4e4fc8e405c56d3080e2.js → 7038.166f915547d27e4dc5e4.js} +1 -1
- package/build/dist/{7759.0b68912ff9ef10869f59.js → 7759.7cd3fe8e5d37df25804c.js} +1 -1
- package/build/dist/7873.e3098bc6f510e5bea55f.js +1 -0
- package/build/dist/7923.d44556578af4d3d7cea3.js +2 -0
- package/build/dist/{7943.19d2de387eeb7f513d8e.js → 7943.acf25a5e98dd13290985.js} +1 -1
- package/build/dist/8090.8977224618a14ae42159.js +2 -0
- package/build/dist/8302.ce97557b7cf7c8387942.js +1 -0
- package/build/dist/8319.6a6b9651c87a1bb4cbb9.js +1 -0
- package/build/dist/{8603.4142ce42c1635f493eca.js → 8603.f1cbcfd64cde885f9809.js} +1 -1
- package/build/dist/8649.d6055ad75975b803bbc1.js +1 -0
- package/build/dist/{8727.3628c746061aed7a4077.js → 8727.8658835acb7e0b6e5acc.js} +1 -1
- package/build/dist/{8765.a5633d054abb67142fc3.js → 8765.8758c290a6b132f2ce7f.js} +1 -1
- package/build/dist/8772.2c35012c25ac9eb5f74d.js +2 -0
- package/build/dist/{8772.e8f9731c1c061f1cdf56.js.LICENSE.txt → 8772.2c35012c25ac9eb5f74d.js.LICENSE.txt} +1 -1
- package/build/dist/8781.6bd14487d172e004e3d3.js +1 -0
- package/build/dist/9299.76095cb6629c36ca3343.js +1 -0
- package/build/dist/9334.a25983aafdcbde63ae5e.js +1 -0
- package/build/dist/{9546.e7206c968e92371ae2b1.js → 9546.2cecad04cf676a6616cd.js} +1 -1
- package/build/dist/dark.css +839 -839
- package/build/dist/filerobot-image-editor.min.js +42445 -42445
- package/build/dist/google-dark.css +2032 -2032
- package/build/dist/google.css +1719 -1719
- package/build/dist/index.html +1 -1
- package/build/dist/main.26c2c54f6ab534513ebd.js +2 -0
- package/build/dist/{main.3a12152528aff6ae213a.js.LICENSE.txt → main.26c2c54f6ab534513ebd.js.LICENSE.txt} +1 -1
- package/build/dist/rle.js +17867 -17867
- package/build/main.js +1 -1
- package/build/plugin/core.type.d.ts +62 -0
- package/build/threads.work.filecat.js +1 -1
- package/env +26 -26
- package/package.json +211 -211
- package/shell/build.js +161 -161
- package/shell/config/.babelrc +14 -14
- package/shell/config/base.webpack.config.js +78 -78
- package/shell/config/common-bin.config.js +44 -44
- package/shell/config/env.js +10 -10
- package/shell/config/prebuild-file-path.js +17 -17
- package/shell/config/webpack.exe.config.js +36 -36
- package/shell/config/webpack.npm.config.js +44 -44
- package/shell/config/webpack.web.config.js +152 -152
- package/shell/dev.js +51 -51
- package/shell/docker-build.sh +2 -2
- package/shell/filecat +1 -1
- package/shell/filecat-watch +1 -1
- package/shell/install.js +48 -48
- package/shell/net-agent/git-clone.bat +23 -23
- package/shell/net-agent/git-pull.bat +17 -17
- package/shell/net-agent/git-push.bat +17 -17
- package/shell/pkg.ts +50 -50
- package/shell/postinstall-optional.js +29 -29
- package/shell/start/filecat-install.sh +22 -22
- package/shell/start/filecat-run.sh +2 -2
- package/shell/start/windows-install.js +178 -178
- package/shell/start/windows-uninstall.js +131 -131
- package/shell/util/file.js +46 -46
- package/build/dist/1075.40103ec059c6b23b056e.js +0 -1
- package/build/dist/1384.0d0fc5faa899c9eddcbe.js +0 -1
- package/build/dist/1417.7e511043474084a2a65b.js +0 -1
- package/build/dist/1448.0710f04bed1c52e6a5db.js +0 -1
- package/build/dist/2300.9e1baa1c0368abe53d96.js +0 -2
- package/build/dist/2542.23fb13b1623c9f7c3fc1.js +0 -1
- package/build/dist/2626.05d1faa293e0a3318b9b.js +0 -1
- package/build/dist/2674.7fd28dae86ccdb247851.js +0 -1
- package/build/dist/2851.2195b5906b2c224c7bf7.js +0 -1
- package/build/dist/3140.794a212da633caf38b3a.js +0 -2
- package/build/dist/3233.fb6bffd5e097e4ac9423.js +0 -1
- package/build/dist/3299.f37767d30b6999df4014.js +0 -1
- package/build/dist/4004.5d68418ad5c2321cb11f.js +0 -1
- package/build/dist/4986.78047106f3a0d2d71199.js +0 -1
- package/build/dist/5272.0b70ee8ec5f083fb9f5b.js +0 -1
- package/build/dist/5614.fb6bffd5e097e4ac9423.js +0 -1
- package/build/dist/6492.3ee4060598de873d8e8f.js +0 -1
- package/build/dist/7756.2f851693ba030c42dde8.js +0 -1
- package/build/dist/7873.11d04b741d2b499d9cb9.js +0 -1
- package/build/dist/7923.861345fd55941e8089a1.js +0 -2
- package/build/dist/8014.28b5cf8c3787dc829aa4.js +0 -1
- package/build/dist/8302.5ae5bfe8baa0084204bb.js +0 -1
- package/build/dist/8319.c15a3674ec7abc493595.js +0 -1
- package/build/dist/8772.e8f9731c1c061f1cdf56.js +0 -2
- package/build/dist/8781.58f0c51870d3dd2689d7.js +0 -1
- package/build/dist/9299.6c06dad1abe098b61766.js +0 -1
- package/build/dist/main.3a12152528aff6ae213a.js +0 -2
- /package/build/dist/{4946.c95d4f426146e0180172.js.LICENSE.txt → 4946.d578f6ba367a742d80bf.js.LICENSE.txt} +0 -0
- /package/build/dist/{7923.861345fd55941e8089a1.js.LICENSE.txt → 7923.d44556578af4d3d7cea3.js.LICENSE.txt} +0 -0
- /package/build/dist/{3140.794a212da633caf38b3a.js.LICENSE.txt → 8090.8977224618a14ae42159.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3299],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[c,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 h=()=>{l.current=-1,r(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=c;h(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:h,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},53299(e,t,s){s.r(t),s.d(t,{default:()=>J});var n=s(96540),i=s(75725),a=s(23430),l=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(22022),p=s(82893),_=s(40505),x=s(62042),m=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,u.Bd)(),[s,a]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();a(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");a([t,...s])}}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const l=[];for(let t=0;t<e.headers.length;t++)l.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return l.push((0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,_.lW)(e),(0,x.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(o.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),l}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var w=s(34843),y=s(78247),S=s(24659);function C(){const{t:e}=(0,u.Bd)(),[t,s]=(0,w.fp)(p.AG.prompt_card),a=(0,S.K)(),g=[e("路由"),e("auth"),e("备注")],[C,b]=(0,w.fp)(p.AG.editorSetting),[k,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(o.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:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...k])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",k)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:(0,f.jsx)(h.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:a,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)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),A([...k])})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,x.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);b({model:"ace/mode/javascript",open:!0,fileName:e.router,save:async t=>{const s={context:t,router:e.router};(await c.XO.post("jscode/save",s)).code===d.m.Success&&(y.xK.set_value_temp(""),b({open:!1,model:"",fileName:"",save:null}),(0,x.SK)("成功"))}}),y.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,_.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,x.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(k,e,t))}})})})}var b=s(23496),k=s(4412);function A(){const{t:e}=(0,u.Bd)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[a,l]=(0,w.fp)(p.AG.router_jump),o=[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:o,getItems:async()=>{const e=await c.XO.get(b.s.setting_customer_router);if(e.code===d.m.Success){if(a?.page_self_router_api_data){for(const t of e.data)t[1]===a?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,a?.page_self_router_api_data),e.data=[t,...e.data],l({})}return e.data}return[]},save:async e=>{(await c.XO.post(b.s.setting_customer_router_save,e)).code===d.m.Success&&(0,x.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 c.XO.get(b.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(b.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,x.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)(C,{})})]})]})}var I=s(74777),V=s(6960),N=s(7523);function X(){const{t:e}=(0,u.Bd)(),{check_user_auth:t}=(0,y.MH)(),[s,i]=(0,n.useState)(!1),[h,_]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[S,C]=(0,n.useState)(!1),[b,k]=(0,w.fp)(p.AG.prompt_card);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("auto_upgrade_setting");if(e.code===d.m.Success){const t=e.data;i(t.open||!1),_(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(a.oV.sys_setting_page)?(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{k({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,x.zN)(e("ver_req"));if(s&&(!v||v<10))return void(0,x.zN)(e("chk_10s"));const t=new I.Mm;t.open=s,t.version_check_url=h,t.exe_download_url=m,t.check_interval_seconds=v;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,x.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("ver_url")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{_(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)(o.C3,{text:e(S?"升级检测中...":"立即升级"),clickFun:async()=>{C(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,x.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,x.zN)(e("触发升级失败"))}finally{C(!1)}}})})]})]}):null}function z(){const{t:e}=(0,u.Bd)(),[,t]=(0,w.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)(""),[a,_]=(0,n.useState)(5610),[m,j]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){const t=e.data?.sys_env;i((t?.browser_proxy_allow||[]).join("\n")),_(t?.browser_proxy_port_start||5610),j(t?.browser_proxy_port_end||5710)}})()},[]);return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("网页代理")}),(0,f.jsx)(o.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)(o.C3,{text:e("确定修改"),clickFun:async()=>{const t=s.split("\n").map(e=>e.trim()).filter(e=>!!e);(await c.XO.post(b.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{browser_proxy_allow:t,browser_proxy_port_start:Number(a)||5610,browser_proxy_port_end:Number(m)||5710}})).code===d.m.Success&&(0,x.SK)(e("修改成功"))}}),children:[(0,f.jsx)("div",{children:e("wbvpn_allow")}),(0,f.jsx)("textarea",{className:"input input--block",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)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.Sm,{placeholder:"5610",value:a,handleInputChange:e=>_(e)}),(0,f.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,f.jsx)(r.Sm,{placeholder:"5710",value:m,handleInputChange:e=>j(e)})]})]})}function F(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[_,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,S]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[F,K]=(0,w.fp)(p.AG.prompt_card),[O,P]=(0,n.useState)(!1),[B,$]=(0,n.useState)(""),[M,D]=(0,n.useState)(""),[T,E]=(0,n.useState)(I.aM.close),[G,q]=(0,n.useState)(!1),[W,Z]=(0,n.useState)(void 0),{t:R,i18n:H}=(0,u.Bd)(),[U,Q]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:J}=(0,y.MH)(),{initUserInfo:L}=(0,n.useContext)(N.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){S(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(P(n.open),$(n.cert_path||""),D(n.key_path||""))}const s=await c.XO.get("token");if(s.code===d.m.Success){const e=s.data;if(!e)return;e.length&&Z(e.length),e.mode&&E(e.mode),void 0!==e.persist&&q(e.persist)}})()},[]);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)(U.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.10.2",null!=U.latest_version&&"7.10.2"!==U.latest_version?` -> ${U.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("安装方式")," :",U.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)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:R("通用设置")})," ",(0,f.jsx)(o.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)(o.C3,{text:R("确定修改"),clickFun:async()=>{(await c.XO.post(b.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:_,http_proxy:j,logo:s}})).code===d.m.Success&&((0,x.SK)("修改成功"),L())}}),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=>{a(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:_,onChange:()=>{m(!_)}})]}),(0,f.jsxs)(l.Zp,{title:R("https_s"),rightBottomCom:(0,f.jsx)(o.C3,{text:R("确定修改"),clickFun:async()=>{if(O){if(!B)return void(0,x.zN)("证书路径不能为空");if(!M)return void(0,x.zN)("私钥路径不能为空")}const e=new I.CH;e.open=O,e.cert_path=B,e.key_path=M;(await c.XO.post(b.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:O})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:O,onChange:e=>{P(e)},options:[{title:R("开启"),value:!0},{title:R("关闭"),value:!1}]}),O&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:R("ssl_crt")}),(0,f.jsx)(r.Sm,{placeholder:R("crt_pth"),value:B,handleInputChange:e=>{$(e)}}),(0,f.jsx)("div",{children:R("ssl_key")}),(0,f.jsx)(r.Sm,{placeholder:R("ky_pth"),value:M,handleInputChange:e=>{D(e)}})]})]}),(0,f.jsx)(X,{}),(0,f.jsx)(z,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:R("文件回收站")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{K({open:!0,title:R("信息"),context_div:(0,f.jsx)("div",{children:R("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:R("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:R("确定修改"),clickFun:async()=>{if(g&&!C)return void(0,x.zN)("目录不能为空");(await c.XO.post(b.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:C,open:g})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:R("目录"),value:C,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{S(e)},options:[{title:R("开启"),value:!0},{title:R("关闭"),value:!1}]})]}),(0,f.jsxs)(l.Zp,{title:R("tk_exp"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(o.C3,{text:R("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,f.jsx)(o.C3,{text:R("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=T,e.persist=G,I.aM.length!==e.mode||W||(0,x.zN)("秒数不能为空"),e.length=parseInt(W);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:[(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:R("关闭"),selected:T===I.aM.close,onchange:()=>{E(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:R("指定时间"),selected:T===I.aM.length,onchange:()=>{E(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:R("永不过期"),selected:T===I.aM.forver,onchange:()=>{E(I.aM.forver)}})]}),T===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:R("秒"),value:W,handleInputChange:e=>{Z(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:G,onChange:()=>q(!G)}),R("持久化")]})]})]})]})})]})}var K=s(92350);function O(){const{t:e,i18n:t}=(0,u.Bd)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(N.F),[_,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[C,b]=(0,w.fp)(p.AG.prompt_card),[,k]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,X]=(0,n.useState)([]),[z,F]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[B,$]=(0,n.useState)(""),[M,D]=(0,n.useState)([]),T=(0,S.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],W=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],R=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:H}=(0,y.MH)(),U=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&F(e.data)},Q=async()=>{const e=await c.XO.get("workflow_setting_get");e.code===d.m.Success&&P(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("outside/software/get");e.code===d.m.Success&&g(e.data);const t=await c.XO.get("pty_cmd");t.code===d.m.Success&&$(t.data),U(),Q();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&I(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&X(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&D(i.data??[])})()},[]);const J=(0,K.Q)(),L=async()=>{(await c.XO.post("plugin/list/save",M)).code===d.m.Success&&(0,x.SK)(e("保存成功"))};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{J("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...V,{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)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of V)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,x.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,x.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,x.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(V,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",V)).code===d.m.Success&&((0,x.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:Z,rows:V.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,X([...V])},options:T,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)(o.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))}})})}),(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)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{J("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?b({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,x.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(y.xK.set_value_temp(t.data??""),k({model:"ace/mode/ini",open:!0,fileName:"",save:async t=>{(await c.XO.post("env/process/save",{text:t})).code===d.m.Success?(0,x.SK)(e("保存成功")):(0,x.zN)(e("保存失败")),y.xK.set_value_temp("")}})):(0,x.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...z,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:z})).code===d.m.Success&&((0,x.SK)("保存成功"),U(),s())}})]}),children:(0,f.jsx)(h.X,{headers:q,rows:z.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([...z])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z.splice(e,1),F([...z])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)(z,e,t))}})}),(0,f.jsx)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{J("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:B})).code===d.m.Success&&((0,x.SK)("保存成功"),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:B,handleInputChange:e=>{$(e)}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{J("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,x.SK)("ok"),Q())}})]}),children:(0,f.jsx)(h.X,{headers:W,rows:O.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,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},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)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(O,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{J("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{D([...M,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:L})]}),children:(0,f.jsx)(h.X,{headers:R,rows:M.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,D([...M])},options:T,no_border:!0}),(0,f.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await L()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{M.splice(e,1),D([...M])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{D((0,v.TI)(M,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{J("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,x.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.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)(o.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)(l.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,x.SK)("保存成功"),s())}}),children:(0,f.jsx)(h.X,{headers:E,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(l.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)(o.rA,{icon:"info",onClick:()=>{J(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function P(e){const{t,i18n:s}=(0,u.Bd)(),[i,l]=(0,w.fp)(p.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("htts"),permission:a.oV.https_file},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:a.oV.auth_router_page},{title:t("wf_api"),permission:a.oV.workflow_api},{title:t("自定义资源路由"),permission:a.oV.code_resource},{title:t("api_rt"),permission:a.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("浏览器代理编辑"),permission:a.oV.browser_proxy_edit},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:o.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 B=new Map;function $(){const{t:e,i18n:t}=(0,u.Bd)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(N.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[y,S]=(0,n.useState)([]),[C,b]=(0,w.fp)(p.AG.prompt_card),[k,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[X,z]=(0,w.fp)(p.AG.confirm),[F,O]=(0,n.useState)(""),[$,M]=(0,n.useState)(""),[D,T]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[q,W]=(0,n.useState)([]),[Z,R]=(0,n.useState)([]),[H,U]=(0,n.useState)(""),[Q,J]=(0,n.useState)(""),[L,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),_e=(0,K.o)(),[xe,me]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await c.wm.get("all_users");if(e.code===d.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);S(e)}else S(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),B.clear();for(const e of t.data)B.set(e.role_id,e)}},we=e=>{O(e?.username??""),M(e?.password??""),T(e?.cwd??""),G(e?.access_dirs??[]),W(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),U(e?.access_cmd??""),J(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?ye(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const ye=(e,t=[])=>{if(!e)return he(""),void pe({});const s=B.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&W(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&U(s.access_cmd),s.not_access_cmd&&J(s.not_access_cmd),s.language&&Y(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))}he(e),pe(s)}},Se=()=>{if(!F)return void(0,x.zN)("username not empty");if((0,m.CB)(F))return void(0,x.zN)("username not empty char");if(!D)return void(0,x.zN)("cwd not empty");const e=new a.E0;return e.language=L,e.theme=ee,e.access_dirs=E,e.username=F,e.password=$,e.not_access_dirs=q,e.only_read_dirs=Z,e.cwd=D,e.note=ie,e.access_cmd=H,e.not_access_cmd=Q,e.auth_list=se,e.bind_role_id=de,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)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),titleCom:(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)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:y.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(l.xP,{children:t.username}),(0,f.jsx)(l.xP,{children:t.cwd}),(0,f.jsx)(l.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{z({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ge(),z({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)(l.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)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),k&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!$)return void(0,x.zN)("password not empty");if((0,m.CB)($))return void(0,x.zN)("username not empty char");const e=Se(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ge(),A(!1),V(!1),we(void 0))}}),I&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=Se();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>O(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:$,handleInputChange:e=>M(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:D,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!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,G([...E])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),G([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{W([...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!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,W([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),W([...q])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{R([...Z,""])},title:e("添加")}),e("只读目录范围")]}),(Z??[]).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!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{Z[s]=e,R([...Z])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{Z.splice(s,1),R([...Z])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:H,placeholder:"use blank split",handleInputChange:e=>U(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:Q,placeholder:"use blank split",handleInputChange:e=>J(e)}),!le&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{ye(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of xe)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:L,onChange:e=>{Y(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:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:_e}),(0,f.jsx)(P,{is_disable:e=>{if(!0===le)return!0;if(de){const t=B.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===le||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=>ae(e)})]})})})]})}function M(){const{t:e,i18n:t}=(0,u.Bd)(),{initUserInfo:s}=(0,n.useContext)(N.F),[_,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[y,S]=(0,n.useState)(!1),[C,b]=(0,n.useState)(!1),[k,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[X,z]=(0,n.useState)(""),[F,O]=(0,n.useState)([]),[B,$]=(0,n.useState)([]),[M,D]=(0,n.useState)([]),[T,E]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[R,H]=(0,n.useState)(""),[U,Q]=(0,n.useState)([]),[J,L]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,K.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await c.wm.get("all_roles");e.code===d.m.Success&&m(e.data)},ie=e=>{V(e?.role_name??""),z(e?.cwd??""),O(e?.access_dirs??[]),$(e?.not_access_dirs??[]),D(e?.only_read_dirs??[]),E(e?.access_cmd??""),q(e?.not_access_cmd??""),Z(e?.language??""),H(e?.theme??""),Q(e?.auth_list??[]),L(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!I)return void(0,x.zN)("role_name not empty");const e=new a.E0;return e.language=W,e.theme=R,e.access_dirs=F,e.role_name=I,e.not_access_dirs=B,e.only_read_dirs=M,e.cwd=X,e.access_cmd=T,e.not_access_cmd=G,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)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{S(!0),b(!1),ie(void 0)}})}),children:(0,f.jsx)(h.X,{headers:se,rows:_.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(l.xP,{children:t.role_name}),(0,f.jsx)(l.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{S(!1),b(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(y||C)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(y?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{S(!1),b(!1),ie(void 0)}}),y&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=ae();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),S(!1),b(!1),ie(void 0))}}),C&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ae();if(!e)return;e.role_id=J;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>V(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)(o.rA,{icon:"add",onClick:()=>{O([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:X,handleInputChange:e=>z(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,O([...F])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{F.splice(t,1),O([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{$([...B,""])},title:"添加"}),e("禁止目录范围")]}),(B??[]).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=>{B[s]=e,$([...B])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{B.splice(s,1),$([...B])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{D([...M,""])},title:e("添加")}),e("只读目录范围")]}),(M??[]).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=>{M[t]=e,D([...M])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{M.splice(t,1),D([...M])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:G,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:W,onChange:e=>{Z(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:R,onChange:e=>{H(e)},options:te}),(0,f.jsx)(P,{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),Q([...U])):Q([e])}})]})})})]})}function D(){const{t:e,i18n:t}=(0,u.Bd)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(N.F),[m,j]=(0,n.useState)([]),[g,y]=(0,w.fp)(p.AG.prompt_card),[C,k]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[X,z]=(0,n.useState)([]),[F,O]=(0,w.fp)(p.AG.user_base_info),P=(0,S.K)(),B=(0,K.o)(),$=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],D=[e("编号"),e("命令"),e("父编号"),e("备注")],T=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[q,W]=(0,n.useState)(""),[Z,R]=(0,n.useState)(""),[H,U]=(0,n.useState)(!1),[Q,J]=(0,n.useState)(""),[L,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),V(e.data.quick_cmd),z(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&k(t.data??[])})(),J(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore)},[]);const se=(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)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!q)return void(0,x.zN)("账号密码不能为空");if(q!==Z)return void(0,x.zN)("两次密码不一样");const e=new a.tl;e.username=E,e.password=q,e.confirm_password=Z,e.user_id=F.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{R(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(b.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:Q,theme:L,upload_file_ignore:ee}})).code===d.m.Success&&((0,x.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:Q,onChange:e=>{J(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.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<m.length;e++)m[e].index=e;(await c.XO.post("filesSetting/save",{dirs:m})).code===d.m.Success&&((0,x.SK)("保存成功"),_(),s())}})]}),children:(0,f.jsx)(h.X,{headers:$,rows:m.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<m.length;e++)m[e].default=e===s&&t,n.push(m[e]);j(n)})(0,e,s)},options:P,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(m,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...C,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",C)).code===d.m.Success&&((0,x.SK)("保存成功"),_())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:C.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)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),k([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{k((0,v.TI)(C,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:D,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)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{z([...X,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:X})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:T,rows:X.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)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),z([...X])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{z((0,v.TI)(X,e,t))}})})]})]})]})})}var T=s(45907),E=s(17903);const G=["password","private_key","secret_key"],q="webdav",W="@authorize",Z={smb:[{keys:["server","username","password"],on_next:"load_shares"},{keys:["share"]}],baidu:[{keys:["app_id","app_key","secret_key"],on_next:"save_app"},{keys:[W]}]};function R(){const{t:e}=(0,u.Bd)(),t=(0,T.y)(),[,s]=(0,w.fp)(p.AG.prompt_card),[i,a]=(0,n.useState)([]),[d,_]=(0,n.useState)([]),[m,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[y,S]=(0,n.useState)(q),[C,b]=(0,n.useState)(""),[k,A]=(0,n.useState)({}),[I,V]=(0,n.useState)(1),[N,X]=(0,n.useState)([]),[z,F]=(0,n.useState)("oob"),[K,O]=(0,n.useState)(""),[P,B]=(0,n.useState)(!0),$=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);a(Array.isArray(e?.data)?e.data:[]),_(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{$()},[]);const M=d.find(e=>e.type===y)?.fields??[],D=Z[y],R=D?.length??1,H=()=>{j(!1),g(""),S(q),b(""),A({}),V(1),X([]),O(""),B(!0)},U=t=>{if(!C.trim())return e("请填写备注");for(const s of M){if(!1===t.includes(s.key))continue;const n=String(k[s.key]??"").trim()||v&&G.includes(s.key);if(s.required&&!n)return e(s.label)}},Q=async()=>{try{const e=await c.I2.post("baidu/authorize_url",{id:v,mode:z});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},J=async()=>{if(K.trim())try{const t=await c.I2.post("baidu/exchange",{id:v,code:K.trim(),mode:z});(0,x.SK)(`${e("授权成功")}:${t?.data?.baidu_name??""}`),O(""),await $()}catch(e){}else(0,x.zN)(e("请填写授权码"))},L=D?.[I-1]?.keys??M.map(e=>e.key),Y=L.includes(W),ee=I===R,te=R>1;return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("凭证管理")}),(0,f.jsx)(o.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:[!m&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{H(),j(!0)}}),m&&(0,f.jsxs)(f.Fragment,{children:[te&&I>1&&(0,f.jsx)(o.rA,{icon:"arrow_back",title:e("上一步"),onClick:()=>V(I-1)}),te&&!ee&&(0,f.jsx)(o.rA,{icon:"arrow_forward",title:e("下一步"),onClick:async()=>{const t=U(D?.[I-1]?.keys??[]);if(t)return void(0,x.zN)(`${e("请填写")}${t}`);const s=D?.[I-1]?.on_next;try{if("load_shares"===s&&!await(async()=>{const t=await c.I2.post("share/list",{driver:y,id:v||void 0,config:{server:k.server,username:k.username,password:k.password}}),s=t?.data??[];return s.length?(X(s.map(e=>({label:e.name,value:e.name}))),!0):((0,x.zN)(e("没有找到共享")),!1)})())return;if("save_app"===s&&!await(async()=>{try{const e=await c.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:y,note:C,config:k,enabled:P});return!v&&e?.data?.id&&g(e.data.id),!0}catch(e){return!1}})())return;V(I+1)}catch(e){}}}),(!te||ee)&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=U(M.map(e=>e.key));if(t)(0,x.zN)(`${e("请填写")}${t}`);else try{await c.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:y,note:C,config:k,enabled:P}),(0,x.SK)(e("保存成功")),H(),await $()}catch(e){}}}),(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:H})]})]}),children:[m&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("备注"),value:C,handleInputChange:b}),(0,f.jsx)(r.l6,{value:y,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{S(e),A({}),X([]),V(1),O("")}}),Y?(()=>{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"===z,onchange:()=>F("one_click")}),(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===z,onchange:()=>F("oob")})]})}),"oob"===z&&(0,f.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:K,handleInputChange:O})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(o.rA,{icon:"open_in_new",title:e("去授权"),onClick:Q}),"oob"===z&&(0,f.jsx)(o.rA,{icon:"check",title:e("完成授权"),onClick:J})]}),s.length>0&&(0,f.jsx)(h.X,{headers:[e("账号名"),e("百度账号"),e("授权状态"),e("使用"),e("授权时间"),e("操作")],rows:s.map(s=>[(0,f.jsx)(l.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(l.xP,{context:s.account_name||s.id}),(0,f.jsx)(l.xP,{context:s.authorized?e("已授权"):e("未授权")}),(0,f.jsx)(l.xP,{context:!1===s.enabled?e("停用"):e("启用")}),(0,f.jsx)("p",{children:s.obtained_at?(0,E.eK)(s.obtained_at):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"network_check",title:e("授权检测"),onClick:()=>(async(t,s)=>{try{const n=await c.I2.post("baidu/verify",{id:t,account_id:s}),i=n?.data??{};i.valid?(0,x.SK)(e("账号可用")):(0,x.zN)(`${e("账号不可用")}:${i.error??""}`),await $()}catch(e){}})(v,s.id)}),(0,f.jsx)(o.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 c.I2.post("baidu/deauthorize",{id:s,account_id:n.id}),(0,x.SK)(e("已删除")),await $()}catch(e){}}})})(v,s)})]})])})]},W)})():M.filter(e=>L.includes(e.key)).map(t=>{if("share"===t.key&&"smb"===y)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:N,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)})]}),!m&&(0,f.jsx)(h.X,{headers:[e("备注"),e("类型"),e("操作")],rows:i.map(s=>{return[(0,f.jsx)(l.xP,{context:s.note}),(0,f.jsx)(l.xP,{context:(n=s.type,d.find(e=>e.type===n)?.name??n)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),S(e.type),b(e.note??""),A({...e.config??{}}),O(""),B(!1!==e.enabled),V(Z[e.type]?.length??1),"smb"===e.type&&c.I2.post("share/list",{driver:"smb",id:e.id,config:e.config??{}}).then(e=>{X((e?.data??[]).map(e=>({label:e.name,value:e.name})))}).catch(()=>{})})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.note,confirm_fun:async()=>{try{await c.I2.post("credential/delete",{id:s.id}),(0,x.SK)(e("已删除")),await $()}catch(e){}}})})(s)})]})];var n})})]})}function H(){const{t:e}=(0,u.Bd)(),t=(0,T.y)(),[s,i]=(0,n.useState)([]),[a,d]=(0,n.useState)([]),[p,_]=(0,n.useState)([]),[m,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[w,y]=(0,n.useState)("webdav"),[S,C]=(0,n.useState)(""),[b,k]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[V,N]=(0,n.useState)(""),[X,z]=(0,n.useState)(""),F=async()=>{try{const[e,t,s]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[]),_(Array.isArray(s?.data)?s.data:[])}catch(e){}};(0,n.useEffect)(()=>{F()},[]);const K=(0,E.p_)(b,a),O=K.length>0,P=()=>{j(!1),g(""),y("webdav"),C(""),k(""),I(""),N(""),z("")};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!m&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P(),j(!0)}}),m&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(b)try{const t=await c.I2.post("test",{id:v||void 0,driver:w,credential_id:b,account_id:A,root_dir:V}),s=t?.data;s?.ok?(0,x.SK)(`${e("连接成功")}(${s.count??0})`):(0,x.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,x.zN)(e("请选择凭据"))}}),m&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(b)if(!O||A)if(S.trim())try{await c.I2.post(v?"update":"add",{id:v||void 0,driver:w,mount_path:S,credential_id:b,account_id:O?A:void 0,root_dir:V,note:X,color:E.OT,readonly:!1,enabled:!0}),(0,x.SK)(e("保存成功")),P(),await F()}catch(e){}else(0,x.zN)(e("munt_rq"));else(0,x.zN)(e("请选择账号"));else(0,x.zN)(e("请选择凭据"))}}),m&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:P})]}),children:[m&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:w,options:p.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),k(""),I("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:b,options:(B=w,(0,E.XT)(B,a)),onChange:e=>{k(e),I("")}})}),O&&(0,f.jsx)(r.BC,{label:e("账号"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:A,options:K,onChange:I})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:S,handleInputChange:C})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:V,handleInputChange:N})}),(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:X,handleInputChange:z})})]}),!m&&(0,f.jsx)(h.X,{headers:[e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:s.map(s=>{const n=a.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:(l=s.driver,p.find(e=>e.type===l)?.name??l)}),(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)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),y(e.driver),C(e.mount_path??""),k(e.credential_id??""),I(e.account_id??""),N(e.root_dir??""),z(e.note??"")})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.mount_path,confirm_fun:async()=>{try{await c.I2.post("delete",{id:s.id}),(0,x.SK)(e("已删除")),await F()}catch(e){}}})})(s)})]})];var l})})]});var B}function U(){const{t:e}=(0,u.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=t(a.oV.file_mount),[r,d]=(0,w.fp)(p.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await c.I2.post("enabled/get",{});d(!0===e?.data)}catch(e){d(!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)(o.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 c.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;d(n),(0,x.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)(R,{})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(H,{})})]})})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var Q=s(87361);function J(){const{t:e}=(0,u.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(D,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(F,{})}),t(a.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(O,{})}),t(a.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)($,{})}),t(a.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(M,{})}),t(a.oV.file_mount)&&s.push({index:1,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(U,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:Q.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=s(22022),r=s(23430),c=s(14284),d=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:l}=(0,o.Bd)();return e=>{let n;e===a.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let u=r.Ky;function p(){const[e,t]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];u=[...r.Ky,...s],t(u)}else console.warn("获取主题列表失败,使用默认列表"),t(u)}catch(e){t(u)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>l});var n=s(72635);const i=1440,a=525600;function l(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<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).toFixed(0)} ${n.Ay.t("年前")}`}},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 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3471],{73471(e,t,c){c.r(t),c.d(t,{default:()=>a});const i=async e=>{const t=await e.getFile();return t.handle=e,t};var a=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((e,c)=>{t[c]={description:e.description||"",accept:{}},e.mimeTypes?e.mimeTypes.map(i=>{t[c].accept[i]=e.extensions||[]}):t[c].accept["*/*"]=e.extensions||[]});const c=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),a=await Promise.all(c.map(i));return e[0].multiple?a:a[0]}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3528],{48890(e,t,s){s.d(t,{Kw:()=>a,Tt:()=>i});var a=s(80952),i=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(34678),s(24522));const n=`https://gcore.jsdelivr.net/npm/ace-builds@${a.version}/src-min-noconflict/`;a.config.set("basePath",n),a.config.set("modePath",n),a.config.set("themePath",n),a.config.set("workerPath",n)},53528(e,t,s){s.r(t),s.d(t,{default:()=>G});var a=s(96540),i=s(14284),n=s(62042),c=s(22022),l=s(85997),o=s(57952),r=s(52671),d=s(34289),h=s(87361),m=s(2543),_=s(34251),g=s(47022),p=s(74848);const u={M:{label:"M",cls:"mod"},A:{label:"A",cls:"add"},D:{label:"D",cls:"del"},R:{label:"R",cls:"ren"},C:{label:"C",cls:"ren"},U:{label:"U",cls:"conf"},"?":{label:"?",cls:"untracked"}};function f(e){const t=e.lastIndexOf("/");return-1===t?e:e.substring(t+1)}function x(e){const t={type:"folder",name:"",full_path:"",children:[]};for(const s of e){const e=s.path.split("/").filter(Boolean);let a=t;for(let t=0;t<e.length;t++){const i=e[t],n=t===e.length-1;let c=a.children.find(e=>e.name===i);c||(c={type:n?"file":"folder",name:i,full_path:a.full_path?`${a.full_path}/${i}`:i,children:[]},a.children.push(c)),n&&(c.data=s.data),a=c}}const s=e=>{e.sort((e,t)=>e.type!==t.type?"folder"===e.type?-1:1:e.name.localeCompare(t.name));for(const t of e)t.children.length&&s(t.children)};return s(t.children),t.children}function j(e){const{t}=(0,c.Bd)(),{file:s,staged:a,status:i,selected:n,active:o,leaf:r}=e,d=u[i]??{label:i,cls:"mod"},h=r?s.path.substring(0,s.path.lastIndexOf("/")):"";return(0,p.jsxs)("div",{className:"git-file"+(o?" git-file--active":""),children:[(0,p.jsx)("input",{type:"checkbox",checked:n.has(s.path),onChange:()=>e.on_toggle(s.path),onClick:e=>e.stopPropagation()}),(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":(0,_.uL)(s.path),"data-dir":!1,"aria-label":s.path,children:(0,p.jsx)(l.In,{icon:"",aria_label:s.path})})}),(0,p.jsx)("span",{className:"git-file__name",title:s.oldPath?`${s.oldPath} → ${s.path}`:s.path,onClick:()=>e.on_view_diff(s,a),children:r?f(s.path):s.path}),(0,p.jsx)("span",{className:`git-file__badge git-file__badge--${d.cls}`,children:d.label}),h&&(0,p.jsx)("span",{className:"git-file__dir",title:h,children:h}),(0,p.jsxs)("span",{className:"git-file__ops",children:[(0,p.jsx)(l.rA,{icon:"format_list_numbered",title:t("逐行归属"),onClick:()=>e.on_view_blame(s)}),(0,p.jsx)(l.rA,{icon:a?"remove":"add",title:t(a?"取消暂存":"暂存"),onClick:()=>e.on_stage_one(s,a)})]})]})}function N(e){const{node:t,staged:s,file_map:i,prefix:n}=e,[c,o]=(0,a.useState)(!0),r=n?`${n}/${t.name}`:t.name;if("file"===t.type){const t=i.get(r);if(!t)return null;const a=s?t.conflicted?"U":t.index:t.untracked?"?":t.conflicted?"U":t.worktree;return(0,p.jsx)(j,{file:t,staged:s,status:a,selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame})}return(0,p.jsxs)("div",{className:"git-tree__folder",children:[(0,p.jsxs)("div",{className:"git-tree__dir",onClick:()=>o(!c),children:[(0,p.jsx)("i",{className:"material-icons git-tree__arrow","data-icon":c?"arrow_drop_down":"arrow_right",children:c?"arrow_drop_down":"arrow_right"}),(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":g.Iw.folder,"data-dir":!0,"aria-label":t.name,children:(0,p.jsx)(l.In,{icon:"",aria_label:t.name})})}),(0,p.jsx)("span",{className:"git-tree__dir-name",children:t.name})]}),c&&(0,p.jsx)("div",{className:"git-tree__children",children:t.children?.map((t,a)=>(0,p.jsx)(N,{node:t,staged:s,file_map:i,prefix:r,selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame},a))})]})}function v(e){const{t}=(0,c.Bd)(),{title:s,files:i,staged:n,selected:l}=e,o=(0,a.useMemo)(()=>i.map(e=>e.path),[i]),r=o.filter(e=>l.has(e)).length,d=i.length>0&&r===i.length,h=r>0&&!d,m=(0,a.useMemo)(()=>{const e=new Map;for(const t of i)e.set(t.path,t);return e},[i]),_=(0,a.useMemo)(()=>e.tree_mode?function(e){const t=x(e.map(e=>({path:e.path,data:e}))),s=e=>({type:e.type,name:e.name,size:0,children:e.children.length?e.children.map(s):void 0});return t.map(s)}(i):[],[i,e.tree_mode]);return 0===i.length?null:(0,p.jsxs)("div",{className:"git-section",children:[(0,p.jsxs)("div",{className:"git-section__header",children:[(0,p.jsx)("input",{type:"checkbox",checked:d,ref:e=>{e&&(e.indeterminate=h)},onChange:()=>e.on_toggle_all(o,!d)}),(0,p.jsxs)("span",{className:"git-section__title",children:[s," (",i.length,")"]}),(0,p.jsx)("span",{className:"git-section__action",onClick:()=>e.on_stage_section(i,n),children:t(n?"全部取消暂存":"全部暂存")})]}),e.tree_mode?(0,p.jsx)("div",{className:"git-tree",children:_.map((t,s)=>(0,p.jsx)(N,{node:t,staged:n,file_map:m,prefix:"",selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame},s))}):i.map(t=>(0,p.jsx)(j,{file:t,staged:n,status:e.status_of(t),selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame},t.path+(n?"_s":"_w")))]})}function y(e){const{t}=(0,c.Bd)(),{files:s}=e,[i,n]=(0,a.useState)(!1),o=s.filter(e=>e.staged),r=s.filter(e=>e.untracked||" "!==e.worktree),d={selected:e.selected,on_toggle:e.on_toggle,on_toggle_all:e.on_toggle_all,active_path:e.active_path,tree_mode:i,on_view_diff:e.on_view_diff,on_stage_section:e.on_stage_section,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame};return(0,p.jsxs)("div",{className:"git-change-list",children:[(0,p.jsx)("div",{className:"git-change-toolbar",children:(0,p.jsx)(l.rA,{icon:"account_tree",title:t("树形展示"),selected:i,onClick:()=>n(!i)})}),(0,p.jsx)(v,{title:t("已暂存的更改"),files:o,staged:!0,status_of:e=>e.conflicted?"U":e.index,...d}),(0,p.jsx)(v,{title:t("更改"),files:r,staged:!1,status_of:e=>e.untracked?"?":e.conflicted?"U":e.worktree,...d}),0===s.length&&(0,p.jsx)("div",{className:"git-change-empty",children:t("没有已更改的文件")})]})}var b=s(48890);function w({valueA:e,valueB:t,mode:s="split",theme:i,filename:n}){const c=(0,a.useRef)(null),l=(0,a.useRef)(null),o=(0,a.useMemo)(()=>n&&b.Tt.getModeForPath(n).mode||"ace/mode/text",[n]);return(0,a.useEffect)(()=>{const a=c.current;if(!a)return;const n=b.Kw.require("ace/ext/diff"),r={valueA:e??"",valueB:t??"",diffProvider:new n.DiffProvider},d="inline"===s,h=d?new n.InlineDiffView({...r,inline:"a"},a):new n.SplitDiffView(r);d||(h.container=a,a.appendChild(h.editorA.container),a.appendChild(h.editorB.container)),i&&h.setTheme(i),h.editorA?.session.setMode(o),h.editorB?.session.setMode(o),h.onInput(),h.foldUnchanged();const m=requestAnimationFrame(()=>{h.editorA?.resize(!0),h.editorB?.resize(!0)});return l.current=h,()=>{cancelAnimationFrame(m);try{h.destroy()}catch(e){}l.current=null,a.innerHTML=""}},[e,t,s,i,o]),(0,p.jsx)("div",{className:"ace-diff",ref:c})}const k={text:"",binary:!1,exists:!1};function S({dir_path:e,file:t,left_ref:s,right_ref:n,mode:l="unified"}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(k),[h,m]=(0,a.useState)(k),[_,g]=(0,a.useState)(!1),[u,f]=(0,a.useState)(""),x=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const a=++x.current;g(!0),f("");const c=s=>i.TU.post("file_content",{path:e,file:t,ref:s});Promise.all([c(s),c(n)]).then(([e,t])=>{a===x.current&&(d(0===e.code?e.data:k),m(0===t.code?t.data:k))}).catch(e=>{a===x.current&&(f("string"==typeof e?e:e?.message||""),d(k),m(k))}).finally(()=>{a===x.current&&g(!1)})},[e,t,s,n]),_?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:o("加载中")})}):u?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:u})}):r.binary||h.binary?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:o("二进制文件无法比较")})}):r.text===h.text?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:o("无差异")})}):(0,p.jsx)(w,{valueA:r.text??"",valueB:h.text??"",mode:"split"===l?"split":"inline",filename:t})}function C({dir_path:e,entries:t,is_search:s,has_more:o,loading_more:r,active_hash:d,on_select:h,on_scroll_bottom:m,on_search_result:_}){const{t:g}=(0,c.Bd)(),[u,f]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1),{rows:w,width:k}=function(e){const t=[],s=[];let a=1;for(const i of e){let e=t.indexOf(i.hash);e<0&&(e=t.indexOf(null),e<0&&(e=t.length,t.push(null)));const n=i.parents||[],c=[];for(const s of n)s&&t.forEach((a,i)=>{i!==e&&a===s&&(c.push(i),t[i]=null)});const l=[];t.forEach((t,s)=>{null===t||s===e||c.includes(s)||l.push(s)}),t[e]=n[0]??null;const o=[e];for(const e of n.slice(1)){let s=t.indexOf(e);s<0&&(s=t.indexOf(null),s<0&&(s=t.length,t.push(null)),t[s]=e),o.push(s)}for(;t.length&&null===t[t.length-1];)t.pop();s.push({column:e,pass_through:l,out_edges:o,merge_in:c}),a=Math.max(a,t.length,e+1,...o.map(e=>e+1))}return{rows:s,width:a}}(s?[]:t),S=async()=>{if(x.trim()||N.trim()){b(!0);try{const t=await i.TU.post("search_commit",{path:e,keyword:x.trim(),author:N.trim(),maxCount:100});0===t.code?_(t.data||[]):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(g("请输入搜索条件"))},C=(e,t,s)=>{const a=39,i=12,n=s?i:-2,c=e=>16*e+8,l=c(e.column),o=[];for(const t of e.pass_through)o.push((0,p.jsx)("line",{x1:c(t),y1:n,x2:c(t),y2:41,className:"git-log__graph-edge"},`p${t}`));for(const[t,a]of e.merge_in.entries()){const e=c(a);s||o.push((0,p.jsx)("path",{fill:"none",d:`M ${e} -2 C ${e} 19.5 ${l} 19.5 ${l} 12`,className:"git-log__graph-edge"},`m${t}`))}for(const[t,s]of e.out_edges.entries())if(s===e.column)o.push((0,p.jsx)("line",{x1:l,y1:n,x2:l,y2:41,className:"git-log__graph-edge"},`o${t}`));else{const e=c(s);o.push((0,p.jsx)("path",{fill:"none",d:`M ${l} 12 C ${l} 25.5 ${e} 25.5 ${e} 39`,className:"git-log__graph-edge"},`o${t}`))}return(0,p.jsx)("div",{className:"git-log__graph",children:(0,p.jsxs)("svg",{width:16*k,height:a,overflow:"visible",children:[o,(0,p.jsx)("circle",{cx:l,cy:i,r:3.5,className:"git-log__graph-dot"+(t?" git-log__graph-dot--unpushed":"")})]})})};return(0,p.jsxs)("div",{className:"git-log-wrap",children:[(0,p.jsxs)("div",{className:"git-log-search",children:[(0,p.jsx)(l.rA,{icon:"search",title:g("搜索提交"),onClick:()=>{u?(j(""),v(""),_(null),f(!1)):f(!0)}}),u&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:g("提交信息关键词"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,p.jsx)("input",{className:"input input--block",value:N,placeholder:g("作者"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,p.jsx)(l.rA,{icon:"check",title:g("搜索"),onClick:S})]})]}),(0,p.jsxs)("div",{className:"git-log",onScroll:m,children:[y&&(0,p.jsx)("div",{className:"git-change-empty",children:g("加载中")}),!y&&0===t.length&&(0,p.jsx)("div",{className:"git-change-empty",children:g("暂无提交记录")}),!y&&t.map((e,t)=>(0,p.jsxs)("div",{className:`git-log__entry${d===e.hash?" git-log__entry--active":""}${e.unpushed?" git-log__entry--unpushed":""}`,onClick:()=>h(e.hash),children:[!s&&C(w[t],!!e.unpushed,0===t),(0,p.jsxs)("div",{className:"git-log__main",children:[(0,p.jsxs)("div",{className:"git-log__row",children:[e.unpushed&&(0,p.jsx)("span",{className:"git-log__unpushed",title:g("未推送")}),(0,p.jsx)("span",{className:"git-log__hash",children:e.hash}),(e.refs||[]).map(e=>(0,p.jsx)("span",{className:"git-log__ref"+(e.includes("HEAD")?" git-log__ref--head":""),children:e.replace("HEAD -> ","")},e)),(0,p.jsx)("span",{className:"git-log__msg",title:e.message,children:e.message})]}),(0,p.jsxs)("div",{className:"git-log__meta",children:[e.author," · ",e.date]})]})]},e.hash)),!y&&!s&&r&&(0,p.jsx)("div",{className:"git-log__more",children:g("加载中")}),!y&&!s&&!r&&!o&&t.length>0&&(0,p.jsx)("div",{className:"git-log__more",children:g("已到底部")})]})]})}var z=s(45907);function A({nodes:e,selected:t,on_select:s}){const[i,n]=(0,a.useState)(new Set),c=e=>e.map(e=>{if("folder"===e.type){const t=!i.has(e.full_path);return(0,p.jsxs)("div",{children:[(0,p.jsxs)("div",{className:"git-commit-tree__dir",onClick:()=>{return t=e.full_path,void n(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},children:[(0,p.jsx)("i",{className:"material-icons git-tree__arrow",children:t?"arrow_drop_down":"arrow_right"}),(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":g.Iw.folder,"data-dir":!0,"aria-label":e.name,children:(0,p.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,p.jsx)("span",{className:"git-commit-tree__dir-name",children:e.name})]}),t&&(0,p.jsx)("div",{className:"git-commit-tree__children",children:c(e.children)})]},e.full_path)}const a=e.data;return(0,p.jsxs)("div",{className:"git-commit-file git-commit-file--leaf"+(t===e.full_path?" git-commit-file--active":""),onClick:()=>s(e.full_path),title:e.full_path,children:[(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":(0,_.uL)(e.name),"aria-label":e.name,children:(0,p.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,p.jsx)("span",{className:"git-commit-file__name",children:e.name}),a&&null!==a.additions&&(0,p.jsxs)("span",{className:"git-commit-file__stat",children:[(0,p.jsxs)("span",{className:"git-stat--add",children:["+",a.additions]}),(0,p.jsxs)("span",{className:"git-stat--del",children:["-",a.deletions]})]})]},e.full_path)});return(0,p.jsx)(p.Fragment,{children:c(e)})}function $({dir_path:e,hash:t,on_close:s,on_changed:o}){const{t:r}=(0,c.Bd)(),d=(0,z.y)(),[h,m]=(0,a.useState)(null),[_,g]=(0,a.useState)(null),[u,f]=(0,a.useState)("unified"),[j,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(g(null),y(!1),w())},[t,e]);const b=(0,a.useMemo)(()=>x((h?.files??[]).map(e=>({path:e.path,data:e}))),[h]),w=async()=>{try{const s=await i.TU.post("commit_detail",{path:e,hash:t});0===s.code?m(s.data):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}};if(!h)return(0,p.jsx)("div",{className:"git-card git-card--diff",children:(0,p.jsx)("div",{className:"git-change-empty",children:r("加载中")})});return(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-commit-meta",children:[(0,p.jsxs)("div",{className:"git-commit-meta__row",children:[(0,p.jsx)("span",{className:"git-commit-meta__hash",children:h.short_hash}),(0,p.jsx)("span",{className:"git-commit-meta__subject",title:h.subject,children:h.subject}),_&&(0,p.jsx)(l.rA,{icon:"compare_arrows",title:r("与工作区对比"),onClick:()=>{_?y(!0):(0,n.zN)(r("请先选择文件"))}}),(0,p.jsx)(l.rA,{icon:"undo",title:r("撤销提交"),onClick:()=>{d({title:r("撤销提交"),sub_title:`${r("将生成一个反向提交来撤销")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("revert",{path:e,hash:t});0===s.code?((0,n.SK)(r("已撤销")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,p.jsx)(l.rA,{icon:"content_cut",title:r("摘取提交"),onClick:()=>{d({title:r("摘取提交"),sub_title:`${r("将该提交应用到当前分支")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("cherry_pick",{path:e,hash:t});0===s.code?((0,n.SK)(r("摘取成功")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,p.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:s})]}),(0,p.jsxs)("div",{className:"git-commit-meta__sub",children:[h.author," <",h.email,"> · ",h.date]})]}),(0,p.jsxs)("div",{className:"git-commit-body",children:[(0,p.jsxs)("div",{className:"git-commit-files",children:[(0,p.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",h.files.length,")"]}),(0,p.jsx)(A,{nodes:b,selected:_,on_select:e=>{g(e),y(!1)}})]}),(0,p.jsxs)("div",{className:"git-commit-diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:v?r("与工作区对比"):`${r("提交")} ${h.short_hash}`}),(0,p.jsx)("span",{className:"git-diff-header__path",title:_??"",children:_??`${r("全部文件")} (${h.files.length})`}),(0,p.jsxs)("div",{className:"git-diff-header__modes",children:[(0,p.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===u,onClick:()=>f("unified")}),(0,p.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===u,onClick:()=>f("split")})]})]}),_?v?(0,p.jsx)(S,{dir_path:e,file:_,left_ref:t,right_ref:"worktree",mode:u}):(0,p.jsx)(S,{dir_path:e,file:_,left_ref:`${t}^`,right_ref:t,mode:u}):(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:r("请选择文件查看改动")})})]})]})]})}function U(e){let t=0;for(let s=0;s<e.length;s++)t+=e.charCodeAt(s);return`hsl(${t%360}, 55%, 45%)`}function T({dir_path:e,file:t,on_close:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&_()},[t,e]);const _=async()=>{m(!0);try{const s=await i.TU.post("blame",{path:e,file:t});0===s.code?d(s.data||[]):((0,n.zN)(s.message),d([]))}catch(e){(0,n.zN)(e?.message),d([])}finally{m(!1)}};return(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:o("逐行归属")}),(0,p.jsx)("span",{className:"git-diff-header__path",title:t,children:t}),(0,p.jsx)("div",{className:"git-diff-header__modes",children:(0,p.jsx)(l.rA,{icon:"close",title:o("关闭"),onClick:s})})]}),h&&(0,p.jsx)("div",{className:"git-change-empty",children:o("加载中")}),!h&&0===r.length&&(0,p.jsx)("div",{className:"git-change-empty",children:o("无法读取该文件的归属信息")}),!h&&r.length>0&&(0,p.jsx)("div",{className:"git-blame",children:r.map((e,t)=>(0,p.jsxs)("div",{className:"git-blame__row",children:[(0,p.jsx)("span",{className:"git-blame__hash",title:e.hash,children:e.hash}),(0,p.jsx)("span",{className:"git-blame__author",style:{color:U(e.author)},title:`${e.author} · ${e.date}`,children:e.author}),(0,p.jsx)("span",{className:"git-blame__date",children:e.date}),(0,p.jsx)("span",{className:"git-blame__num",children:e.line_num}),(0,p.jsx)("span",{className:"git-blame__code",children:e.text||" "})]},t))})]})}function K({current:e,branches:t,on_checkout:s,on_create:i,on_delete:n,on_merge:o,ahead:r,behind:d}){const{t:h}=(0,c.Bd)(),m=(0,z.y)(),[_,g]=(0,a.useState)(!1),[u,f]=(0,a.useState)(""),x=()=>{const e=u.trim();e&&(i(e),f(""),g(!1))};return(0,p.jsxs)("div",{className:"git-branch-row",children:[(0,p.jsxs)("span",{className:"git-branch__name",children:[h("分支"),": ",e]}),(r>0||d>0)&&(0,p.jsxs)("span",{className:"git-branch__counts",children:[r>0&&(0,p.jsxs)("span",{className:"git-ahead",title:h("领先上游"),children:["↑",r]}),d>0&&(0,p.jsxs)("span",{className:"git-behind",title:h("落后上游"),children:["↓",d]})]}),(0,p.jsx)("div",{className:"git-branch__list",children:t.map(t=>{const a=t===e;return(0,p.jsxs)("div",{className:"git-branch-chip"+(a?" git-branch-chip--current":""),onClick:()=>!a&&s(t),title:a?h("当前分支"):`${h("切换到")} ${t}`,children:[t,!a&&(0,p.jsxs)("span",{className:"git-branch-chip__ops",children:[(0,p.jsx)("span",{className:"git-branch-chip__op",title:h("合并到此分支"),onClick:e=>{e.stopPropagation(),o(t)},children:"⇥"}),(0,p.jsx)("span",{className:"git-branch-chip__op",title:h("删除分支"),onClick:e=>{var s;e.stopPropagation(),s=t,m({title:h("删除分支"),sub_title:`${h("确认删除分支")} ${s} ?`,confirm_fun:()=>n(s,!1)})},children:"×"})]})]},t)})}),_?(0,p.jsxs)("span",{className:"git-branch-new",children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:u,placeholder:h("新分支名"),onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x(),"Escape"===e.key&&(g(!1),f(""))}}),(0,p.jsx)(l.rA,{icon:"check",title:h("确定"),onClick:x}),(0,p.jsx)(l.rA,{icon:"close",title:h("取消"),onClick:()=>{g(!1),f("")}})]}):(0,p.jsx)(l.rA,{icon:"add",title:h("新建分支"),onClick:()=>g(!0)})]})}var E=s(61443);function B(e){const{t}=(0,c.Bd)(),{dir_path:s,user_config:o,proxy_config:r}=e,[d,h]=(0,a.useState)(!1),[m,_]=(0,a.useState)(o.name),[g,u]=(0,a.useState)(o.email),[f,x]=(0,a.useState)(!1),[j,N]=(0,a.useState)(r?.global.http||""),[v,y]=(0,a.useState)(r?.global.https||""),[b,w]=(0,a.useState)(r?.local.http||""),[k,S]=(0,a.useState)(r?.local.https||"");return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:t("用户配置")}),d?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:m,placeholder:"user.name",handleInputChange:e=>_(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:g,placeholder:"user.email",handleInputChange:e=>u(e)}),(0,p.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{try{const a=await i.TU.post("set_user_config",{path:s,name:m,email:g});0===a.code?((0,n.SK)(t("用户配置已保存")),h(!1),e.on_user_config_saved({name:m,email:g})):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>h(!1)})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("span",{className:"git-config__value",children:[o.name," / ",o.email]}),(0,p.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{_(o.name),u(o.email),h(!0)}})]})]}),(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:t("代理配置")}),f?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:j,placeholder:"global http",handleInputChange:e=>N(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:v,placeholder:"global https",handleInputChange:e=>y(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:b,placeholder:"local http",handleInputChange:e=>w(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:k,placeholder:"local https",handleInputChange:e=>S(e)}),(0,p.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{const a=[{scope:"global",type:"http",value:j},{scope:"global",type:"https",value:v},{scope:"local",type:"http",value:b},{scope:"local",type:"https",value:k}];try{for(const e of a)await i.TU.post("set_proxy",{path:s,...e});(0,n.SK)(t("代理配置已保存")),x(!1),e.on_proxy_saved({global:{http:j,https:v},local:{http:b,https:k}})}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>x(!1)})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"git-config__value",children:(()=>{if(!r)return"-";const e=r.global;if(e.http||e.https)return`global ${e.http||e.https}`;const t=r.local;return t.http||t.https?`local ${t.http||t.https}`:"-"})()}),(0,p.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{N(r?.global.http||""),y(r?.global.https||""),w(r?.local.http||""),S(r?.local.https||""),x(!0)}})]})]})]})}function F({dir_path:e,target_hash:t,on_changed:s}){const{t:o}=(0,c.Bd)(),r=(0,z.y)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(!1),[g,u]=(0,a.useState)(""),[f,x]=(0,a.useState)(""),[j,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{v()},[e]);const v=async()=>{try{const t=await i.TU.post("tags",{path:e});0===t.code&&h(t.data||[])}catch(e){}};return(0,p.jsxs)("div",{className:"git-sub-panel",children:[(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",children:[o("标签")," (",d.length,")"]}),(0,p.jsx)(l.rA,{icon:"add",title:o("新建标签"),onClick:()=>_(!m)})]}),m&&(0,p.jsxs)("div",{className:"git-sub-panel__form",children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:g,placeholder:o("标签名"),onChange:e=>u(e.target.value)}),(0,p.jsx)("input",{className:"input input--block",value:f,placeholder:o("备注"),onChange:e=>x(e.target.value)}),(0,p.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,p.jsx)("span",{className:"git-sub-panel__hint",children:t?`${o("基于提交")} ${t}`:o("基于当前提交")}),(0,p.jsx)(l.rA,{icon:"check",title:o("保存"),onClick:async()=>{const a=g.trim();if(a){N(!0);try{const c=await i.TU.post("tag_create",{path:e,name:a,message:f.trim(),hash:t});0===c.code?((0,n.SK)(o("标签创建成功")),u(""),x(""),_(!1),await v(),s()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}}else(0,n.zN)(o("请输入标签名"))}}),(0,p.jsx)(l.rA,{icon:"close",title:o("取消"),onClick:()=>{_(!1),u(""),x("")}})]})]}),(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===d.length&&(0,p.jsx)("div",{className:"git-change-empty",children:o("暂无标签")}),d.map(t=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,p.jsx)("span",{className:"git-sub-item__desc",title:t.message,children:t.message}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"upload",title:o("推送到远程"),onClick:()=>(async t=>{try{const s=await i.TU.post("tag_push",{path:e,name:t});0===s.code?(0,n.SK)(o("标签推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}})(t.name)}),(0,p.jsx)(l.rA,{icon:"delete",title:o("删除标签"),onClick:()=>{return s=t.name,void r({title:o("删除标签"),sub_title:`${o("确认删除标签")} ${s} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("tag_delete",{path:e,name:s});0===t.code?((0,n.SK)(o("标签删除成功")),await v()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var s}})]})]},t.name))]})]})}function I({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("stash_list",{path:e});0===t.code&&d(t.data||[])}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("stash_apply",{path:e,ref:a,pop:c});0===l.code?((0,n.SK)(s(c?"已恢复并删除记录":"已应用")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return(0,p.jsxs)("div",{className:"git-stash",children:[(0,p.jsx)("div",{className:"git-sub-panel__header",children:(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("暂存工作区记录")," ",h?"▾":"▸"]})}),h&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,p.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(t=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:t.message,children:t.message}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"play_arrow",title:s("应用"),onClick:()=>g(t.ref,!1)}),(0,p.jsx)(l.rA,{icon:"unarchive",title:s("恢复并删除"),onClick:()=>g(t.ref,!0)}),(0,p.jsx)(l.rA,{icon:"delete",title:s("删除"),onClick:()=>{return a=t.ref,void o({title:s("删除记录"),sub_title:`${s("确认删除")} ${a} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("stash_drop",{path:e,ref:a});0===t.code?((0,n.SK)(s("已删除")),await _()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var a}})]})]},t.ref))]})]})}function M({dir_path:e,current_branch:t,on_checkout:s,on_compare:o}){const{t:r}=(0,c.Bd)(),d=(0,z.y)(),[h,m]=(0,a.useState)([]),[_,g]=(0,a.useState)([]),[u,f]=(0,a.useState)(!1),[x,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(null),[y,b]=(0,a.useState)("");(0,a.useEffect)(()=>{u&&w()},[e,u]);const w=async()=>{try{const t=await i.TU.post("remote_branches",{path:e});0===t.code&&(m(t.data?.branches||[]),g(t.data?.remotes||[]))}catch(e){}},k=async t=>{j(!0);try{const s=await i.TU.post("fetch",{path:e,prune:t});0===s.code?((0,n.SK)(r("拉取完成")),await w()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}},S=async()=>{const t=N;if(t&&y.trim()){j(!0);try{const a=await i.TU.post("remote_branch_rename",{path:e,branch:t,new_name:y.trim()});0===a.code?((0,n.SK)(r("重命名成功")),v(null),await w(),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}}};return(0,p.jsxs)("div",{className:"git-remote",children:[(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>f(!u),children:[r("远程分支")," (",h.length,") ",u?"▾":"▸"]}),(0,p.jsx)(l.rA,{icon:"cloud_download",title:r("拉取远程信息"),onClick:()=>k(!1)}),(0,p.jsx)(l.rA,{icon:"cleaning_services",title:r("拉取并清理已删除分支"),onClick:()=>k(!0)})]}),u&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===_.length&&(0,p.jsx)("div",{className:"git-change-empty",children:r("未配置远程仓库")}),h.map(c=>(0,p.jsxs)(a.Fragment,{children:[(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:c.name,children:c.name}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:c.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"call_split",title:r("签出到本地"),onClick:()=>(async t=>{j(!0);try{const a=await i.TU.post("checkout_remote",{path:e,branch:t});0===a.code?((0,n.SK)(r("切换分支成功")),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}})(c.name)}),(0,p.jsx)(l.rA,{icon:"compare_arrows",title:r("与当前分支比较"),onClick:()=>o(c.name)}),(0,p.jsx)(l.rA,{icon:"merge",title:r("合并到当前分支"),onClick:()=>(async a=>{d({title:r("合并到当前分支"),sub_title:`${r("将")} ${a} ${r("合并到")} ${t} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("merge",{path:e,branch:a});0===t.code?((0,n.SK)(r("合并成功")),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})})(c.name)}),(0,p.jsx)(l.rA,{icon:"drive_file_rename_outline",title:r("重命名"),onClick:()=>(e=>{const t=e.indexOf("/"),s=t>=0?e.substring(t+1):e;b(s),v(e)})(c.name)}),(0,p.jsx)(l.rA,{icon:"delete",title:r("删除"),onClick:()=>{return t=c.name,void d({title:r("删除远程分支"),sub_title:`${r("确认删除远程分支")} ${t} ? ${r("该分支会从远程仓库删除")}`,confirm_fun:async()=>{try{const s=await i.TU.post("remote_branch_delete",{path:e,branch:t});0===s.code?((0,n.SK)(r("删除成功")),await w()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}});var t}})]})]}),N===c.name&&(0,p.jsxs)("div",{className:"git-remote__rename",children:[(0,p.jsx)(E.Sm,{value:y,width:"12rem",handleInputChange:e=>b(e)}),(0,p.jsx)(l.rA,{icon:"check",title:r("确定"),onClick:S}),(0,p.jsx)(l.rA,{icon:"close",title:r("取消"),onClick:()=>v(null)})]})]},c.name))]})]})}function P({dir_path:e,branch:t,current_branch:s,on_close:o}){const{t:r}=(0,c.Bd)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(null),[g,u]=(0,a.useState)("unified"),[f,j]=(0,a.useState)(!0);(0,a.useEffect)(()=>{_(null),N()},[e,t,s]);const N=async()=>{j(!0);try{const a=await i.TU.post("diff_files",{path:e,from:s,to:t});0===a.code?h(a.data||[]):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}},v=(0,a.useMemo)(()=>x(d.map(e=>({path:e.path,data:e}))),[d]);return(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:r("分支比较")}),(0,p.jsxs)("span",{className:"git-diff-header__path",title:`${s} ↔ ${t}`,children:[s," ↔ ",t]}),m&&(0,p.jsxs)("div",{className:"git-diff-header__modes",children:[(0,p.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===g,onClick:()=>u("unified")}),(0,p.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===g,onClick:()=>u("split")})]}),(0,p.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:o})]}),(0,p.jsxs)("div",{className:"git-commit-body",children:[(0,p.jsxs)("div",{className:"git-commit-files",children:[(0,p.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",d.length,")"]}),(0,p.jsx)(A,{nodes:v,selected:m,on_select:_})]}),(0,p.jsx)("div",{className:"git-commit-diff",children:f?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:r("加载中")})}):m?(0,p.jsx)(S,{dir_path:e,file:m,left_ref:s,right_ref:t,mode:g}):(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:r("请选择文件查看改动")})})})]})]})}function D({dir_path:e,on_resolved:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)("");(0,a.useEffect)(()=>{_()},[e]);const _=async()=>{try{const t=await i.TU.post("conflicts",{path:e});0===t.code&&(d(t.data?.files||[]),m(t.data?.state||""))}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("resolve",{path:e,file:a,side:c});0===l.code?((0,n.SK)(s("已解决冲突")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return 0===r.length?null:(0,p.jsxs)("div",{className:"git-card git-conflict",children:[(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",children:[s("冲突")," (",r.length,")",h&&(0,p.jsx)("span",{className:"git-conflict__state",children:h})]}),(0,p.jsx)(l.rA,{icon:"done_all",title:s("标记全部已解决"),onClick:async()=>{try{const a=await i.TU.post("conflict_action",{path:e,action:"merge_continue"});0===a.code?((0,n.SK)(s("合并已完成")),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"undo",title:s("放弃合并"),onClick:()=>{const a="rebase"===h?"rebase_abort":"cherry-pick"===h?"cherry_pick_abort":"revert"===h?"revert_abort":"merge_abort";o({title:s("放弃合并"),sub_title:s("确认放弃当前合并并恢复到操作前状态"),confirm_fun:async()=>{try{const c=await i.TU.post("conflict_action",{path:e,action:a});0===c.code?((0,n.SK)(s("已放弃合并")),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}}})}})]}),r.map(e=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:e,children:e}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"person",title:s("采用我方版本"),onClick:()=>g(e,"ours")}),(0,p.jsx)(l.rA,{icon:"group",title:s("采用对方版本"),onClick:()=>g(e,"theirs")}),(0,p.jsx)(l.rA,{icon:"check",title:s("标记已解决"),onClick:()=>g(e,"resolved")})]})]},e))]})}function R({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("reflog",{path:e,maxCount:100});0===t.code&&d(t.data||[])}catch(e){}};return(0,p.jsxs)("div",{className:"git-reflog",children:[(0,p.jsx)("div",{className:"git-sub-panel__header",children:(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("操作历史")," (",r.length,") ",h?"▾":"▸"]})}),h&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,p.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(a=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:a.message,children:a.selector}),(0,p.jsx)("span",{className:"git-sub-item__desc",title:a.message,children:a.message}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:a.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"undo",title:s("回退到此处"),onClick:()=>{return c=a,void o({title:s("回退到此处"),sub_title:`${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"mixed"});0===a.code?((0,n.SK)(s("已回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}}),(0,p.jsx)(l.rA,{icon:"delete_forever",title:s("强制回退(丢弃改动)"),onClick:()=>{return c=a,void o({title:s("强制回退(丢弃改动)"),sub_title:`${s("此操作将永久丢弃未提交的改动")}:${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"hard"});0===a.code?((0,n.SK)(s("已强制回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}})]})]},a.selector))]})]})}function W({items:e,on_read:t,on_save:s,on_delete:i}){const{t:n}=(0,c.Bd)(),[o,r]=(0,a.useState)(null),[d,h]=(0,a.useState)(""),[m,_]=(0,a.useState)(!1);(0,a.useEffect)(()=>{o&&!e.some(e=>e.name===o)&&r(null)},[e,o]);const g=async()=>{if(o){_(!0);try{await s(o,d)}finally{_(!1)}}};return(0,p.jsx)("div",{className:"hook-editor",children:(0,p.jsxs)("div",{className:"hook-editor__list",children:[e.map(e=>(0,p.jsxs)(a.Fragment,{children:[(0,p.jsxs)("div",{className:"hook-item"+(o===e.name?" hook-item--editing":""),children:[(0,p.jsx)("span",{className:"hook-item__dot"+(e.enabled?" hook-item__dot--on":"")}),(0,p.jsx)("span",{className:"hook-item__name",children:e.name}),(0,p.jsxs)("span",{className:"hook-item__ops",children:[(0,p.jsx)(l.rA,{icon:o===e.name?"expand_less":"edit",title:n("编辑"),onClick:()=>(async e=>{if(o!==e){_(!0);try{h(await t(e)),r(e)}finally{_(!1)}}else r(null)})(e.name)}),e.enabled&&(0,p.jsx)(l.rA,{icon:"block",title:n("停用钩子"),onClick:()=>(async e=>{_(!0);try{await i(e)}finally{_(!1)}})(e.name)})]})]}),o===e.name&&(0,p.jsxs)("div",{className:"hook-item__editor",children:[(0,p.jsxs)("div",{className:"hook-item__editor-bar",children:[(0,p.jsx)("span",{className:"hook-item__editor-name",children:e.name}),(0,p.jsx)(l.rA,{icon:"check",title:n("保存并启用"),onClick:g}),(0,p.jsx)(l.rA,{icon:"close",title:n("取消"),onClick:()=>r(null)})]}),(0,p.jsx)("textarea",{className:"hook-item__text",value:d,spellCheck:!1,disabled:m,onChange:e=>h(e.target.value)})]})]},e.name)),0===e.length&&(0,p.jsx)("div",{className:"git-change-empty",children:n("暂无记录")})]})})}function H({dir_path:e}){const{t}=(0,c.Bd)(),s=(0,z.y)(),[l,o]=(0,a.useState)([]),[r,d]=(0,a.useState)(!1);(0,a.useEffect)(()=>{r&&h()},[e,r]);const h=async()=>{try{const t=await i.TU.post("hooks",{path:e});0===t.code&&o(t.data||[])}catch(e){}};return(0,p.jsxs)("div",{className:"git-hook",children:[(0,p.jsx)("div",{className:"git-sub-panel__header",children:(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>d(!r),children:[t("钩子")," ",r?"▾":"▸"]})}),r&&(0,p.jsx)(W,{items:l,on_read:async t=>{try{const s=await i.TU.post("hook_read",{path:e,name:t});if(0===s.code)return s.data?.content||"";(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}return""},on_save:async(s,a)=>{try{const c=await i.TU.post("hook_save",{path:e,name:s,content:a});0===c.code?((0,n.SK)(t("已保存并启用")),await h()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}},on_delete:async a=>{s({title:t("停用钩子"),sub_title:`${t("确认删除并停用")} ${a} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("hook_delete",{path:e,name:a});0===s.code?((0,n.SK)(t("已停用")),await h()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}})]})}function O({dir_path:e,on_info_loaded:t,on_changed:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(null),[h,m]=(0,a.useState)([]),[_,g]=(0,a.useState)(!1),[u,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{x(),j()},[e]);const x=async()=>{try{const s=await i.TU.post("repo_info",{path:e});0===s.code&&(d(s.data),t(s.data))}catch(e){}},j=async()=>{try{const t=await i.TU.post("submodules",{path:e});0===t.code&&m(t.data||[])}catch(e){}},N=e=>o("uninitialized"===e?"未初始化":"modified"===e?"与记录不一致":"正常");return(0,p.jsxs)("div",{className:"git-repo-panel",children:[(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:o("远程地址")}),(0,p.jsx)("span",{className:"git-config__value",title:r?.remote_url,children:r?.remote_url||o("未配置")})]}),(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:o("当前提交")}),(0,p.jsxs)("span",{className:"git-config__value",children:[r?.head_hash||"",r&&(r.ahead>0||r.behind>0)&&(0,p.jsxs)("span",{className:"git-repo-panel__counts",children:[r.ahead>0&&(0,p.jsxs)("span",{className:"git-ahead",children:["↑",r.ahead]}),r.behind>0&&(0,p.jsxs)("span",{className:"git-behind",children:["↓",r.behind]})]})]})]}),(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>g(!_),style:{cursor:"pointer"},children:[o("子模块")," (",h.length,") ",_?"▾":"▸"]}),h.length>0&&(0,p.jsx)(l.rA,{icon:"sync",title:o("初始化并更新子模块"),onClick:async()=>{f(!0);try{const t=await i.TU.post("submodule_update",{path:e});0===t.code?((0,n.SK)(o("子模块更新完成")),await j(),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{f(!1)}}})]}),_&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===h.length&&(0,p.jsx)("div",{className:"git-change-empty",children:o("无子模块")}),h.map(e=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:e.path,children:e.path}),(0,p.jsx)("span",{className:"git-sub-item__desc",title:e.desc,children:e.desc}),(0,p.jsx)("span",{className:`git-sub-item__meta git-sub-status--${e.status}`,children:N(e.status)})]},e.path))]})]})}function L({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,r.Zp)(),[d,m]=(0,a.useState)([]),[_,g]=(0,a.useState)([]),[u,f]=(0,a.useState)("none"),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{w(),k()},[e]);const w=async()=>{try{const t=await i.TU.post("repos",{path:e});0===t.code&&m(t.data||[])}catch(e){}},k=async()=>{try{const t=await i.TU.post("dirs",{path:e});0===t.code&&g(t.data?.dirs||[])}catch(e){}},S=async()=>{const a=x.trim();if(a){b(!0);try{const c=await i.TU.post("init",{path:`${e}/${a}`.replace(/\/+/g,"/")});0===c.code?((0,n.SK)(s("仓库初始化成功")),f("none"),j(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入目录名"))},C=async()=>{const a=x.trim();if(a)if(N.trim()){b(!0);try{const c=await i.TU.post("clone",{target:`${e}/${a}`.replace(/\/+/g,"/"),url:N.trim()});0===c.code?((0,n.SK)(s("克隆成功")),f("none"),j(""),v(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入仓库地址"));else(0,n.zN)(s("请输入目录名"))};return(0,p.jsxs)("div",{className:"git-repo-manager",children:[(0,p.jsxs)("div",{className:"git-repo-manager__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",children:[s("仓库")," (",d.length,")"]}),(0,p.jsx)(l.rA,{icon:"add",title:s("初始化仓库"),selected:"init"===u,onClick:()=>{f("init"===u?"none":"init"),j("")}}),(0,p.jsx)(l.rA,{icon:"cloud_download",title:s("克隆仓库"),selected:"clone"===u,onClick:()=>{f("clone"===u?"none":"clone"),j("")}})]}),"none"!==u&&(0,p.jsxs)("div",{className:"git-sub-panel__form",children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:s("目录名"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&("init"===u?S():C())}),"clone"===u&&(0,p.jsx)("input",{className:"input input--block",value:N,placeholder:s("仓库地址"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&C()}),(0,p.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,p.jsx)("span",{className:"git-sub-panel__hint",children:`${e}/${x||"..."}`.replace(/\/+/g,"/")}),(0,p.jsx)(l.rA,{icon:"check",title:s("保存"),onClick:"init"===u?S:C}),(0,p.jsx)(l.rA,{icon:"close",title:s("取消"),onClick:()=>{f("none"),j(""),v("")}})]}),_.length>0&&(0,p.jsx)("div",{className:"git-repo-manager__dirs",children:_.map(e=>(0,p.jsx)("span",{className:"git-repo-manager__dir",onClick:()=>j(e),children:e},e))})]}),(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===d.length&&(0,p.jsx)("div",{className:"git-change-empty",children:s("当前目录下没有仓库")}),d.map(t=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:t.branch}),(0,p.jsx)("span",{className:"git-sub-item__ops",children:(0,p.jsx)(l.rA,{icon:"login",title:s("进入"),onClick:()=>{return s=t,void o(`${h.o.git_page}/${e}/${s.name}/`.replace(/\/+/g,"/"));var s}})})]},t.path))]})]})}const q=100;function G(){const{t:e}=(0,c.Bd)(),t=(0,z.y)(),s=(0,r.Zp)();let _=decodeURIComponent((0,d.GG)(h.o.git_page,(0,d.vX)()));_=_.replace(/\/+$/,"");const[g,u]=(0,a.useState)([]),[f,x]=(0,a.useState)([]),[j,N]=(0,a.useState)(!1),[v,b]=(0,a.useState)(!1),w=(0,a.useRef)(!1),[k,A]=(0,a.useState)({current:"",branches:[]}),[U,E]=(0,a.useState)(""),[W,G]=(0,a.useState)(new Set),[V,X]=(0,a.useState)("status"),[Z,J]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(20),[ee,te]=(0,a.useState)(!1),se=(0,a.useRef)(null),ae=(0,a.useRef)(null),[ie,ne]=(0,a.useState)(null),[ce,le]=(0,a.useState)("unified"),[oe,re]=(0,a.useState)({name:"",email:""}),[de,he]=(0,a.useState)(null),[me,_e]=(0,a.useState)(0),[ge,pe]=(0,a.useState)(null),[ue,fe]=(0,a.useState)(null),[xe,je]=(0,a.useState)(!1);(0,a.useEffect)(()=>{_&&ve().then(e=>{e&&(ye(),be(),we(),ke(),Ne())})},[_]);const Ne=async()=>{try{const e=await i.TU.post("conflicts",{path:_});0===e.code&&_e((e.data?.files||[]).length)}catch(e){}},ve=async()=>{try{J(!0);const e=await i.TU.post("status",{path:_});return 0===e.code&&(u(e.data||[]),je(!1),!0)}catch(e){const t="string"==typeof e?e:e?.message;return t&&t.includes("not a git repository")&&je(!0),!1}finally{J(!1)}},ye=async()=>{try{const e=await i.TU.post("log",{path:_,maxCount:q,skip:0});if(0===e.code){const t=e.data||[];x(t),N(t.length>=q)}}catch(e){}},be=async()=>{try{const e=await i.TU.post("branches",{path:_});0===e.code&&A(e.data||{current:"",branches:[]})}catch(e){}},we=async()=>{try{const e=await i.TU.post("get_user_config",{path:_});0===e.code&&re(e.data)}catch(e){}},ke=async()=>{try{const e=await i.TU.post("get_proxy",{path:_});0===e.code&&he(e.data)}catch(e){}},Se=async(t,s)=>{t.untracked?(0,n.zN)(e("未跟踪文件无差异")):ne({kind:"working",path:t.path,staged:s})},Ce=async()=>{const e=g.filter(e=>!e.staged);try{J(!0);const t=await i.TU.post("add",{path:_,files:e.map(e=>e.path)});if(0!==t.code)return void(0,n.zN)(t.message)}catch(e){return void(0,n.zN)(e?.message)}finally{J(!1)}await ze(!1)},ze=async t=>{try{J(!0);const s=await i.TU.post("commit",{path:_,message:U.trim(),allChanged:t});0===s.code?((0,n.SK)(e("提交成功")),E(""),ne(null),await ve(),ye()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},Ae=async(t=!1)=>{try{J(!0);const s=await i.TU.post("push",{path:_,force:t});0===s.code?(0,n.SK)(e("推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},$e=async()=>{ne(null),await ve(),ye(),be()},Ue=(0,a.useCallback)(m.throttle(e=>{const t=parseFloat(getComputedStyle(ae.current).fontSize),s=window.innerWidth/t-4,a=e.clientX/t,i=2.25+se.current.offsetWidth/t;a<=s&&a>=i&&Y(parseFloat(a.toFixed(2)))},32),[]),Te=()=>{te(!1),ae.current.removeEventListener("pointermove",Ue)},Ke=_.split("/").filter(Boolean).pop()||_;return(0,p.jsxs)("div",{className:"studio",children:[(0,p.jsx)(o.A,{ignore_tags:!0,left_children:[(0,p.jsx)(l.rA,{title:e("取消"),icon:"close",onClick:()=>s(-1)},"close"),(0,p.jsx)("span",{children:Ke},"title")],children:(0,p.jsx)(l.rA,{icon:"refresh",title:e("刷新"),onClick:()=>{ve(),ye(),be(),we(),ke()}})}),xe?(0,p.jsx)("div",{className:"studio-body",children:(0,p.jsx)("div",{className:"studio-editor",children:(0,p.jsx)("div",{className:"git-main",children:(0,p.jsx)("div",{className:"git-card",children:(0,p.jsx)(L,{dir_path:_,on_changed:()=>{je(!1),ve(),ye(),be()}})})})})}):(0,p.jsxs)("div",{className:"studio-body",ref:ae,children:[(0,p.jsxs)("div",{className:"studio-nav studio-nav--git",style:{width:Q-1+"em"},children:[(0,p.jsx)("div",{className:"menu git-menu not-select-div",children:(0,p.jsx)("div",{className:"wrapper",children:(0,p.jsxs)("ul",{children:[(0,p.jsxs)("li",{className:"status"===V?"active":"",onClick:()=>X("status"),children:[e("变更")," (",g.length,")"]}),(0,p.jsxs)("li",{className:"log"===V?"active":"",onClick:()=>X("log"),children:[e("提交记录")," (",f.length,")"]})]})})}),"status"===V&&(0,p.jsx)("div",{className:"git-scroll",children:(0,p.jsx)(y,{files:g,selected:W,on_toggle:e=>{const t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(t)},on_toggle_all:(e,t)=>{const s=new Set(W);for(const a of e)t?s.add(a):s.delete(a);G(s)},active_path:"working"===ie?.kind?ie.path:null,on_view_diff:Se,on_stage_section:async(t,s)=>{if(0===t.length)return;const a=t.map(e=>e.path);try{const t=s?await i.TU.post("reset",{path:_,files:a}):await i.TU.post("add",{path:_,files:a});0===t.code?((0,n.SK)(e(s?"已取消暂存":"已暂存")),await ve()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},on_stage_one:async(e,t)=>{try{const s=t?await i.TU.post("reset",{path:_,files:[e.path]}):await i.TU.post("add",{path:_,files:[e.path]});0===s.code?(await ve(),"working"===ie?.kind&&ie.path===e.path&&Se(e,!t)):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}},on_view_blame:e=>{ne({kind:"blame",file:e.path})}})}),"log"===V&&(0,p.jsx)("div",{className:"git-scroll",children:(0,p.jsx)(C,{dir_path:_,entries:ge??f,is_search:null!==ge,has_more:j,loading_more:v,active_hash:"commit"===ie?.kind?ie.hash:null,on_select:e=>{ne({kind:"commit",hash:e})},on_scroll_bottom:e=>{if(null!==ge)return;const t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&(async()=>{if(!w.current&&j){w.current=!0,b(!0);try{const e=await i.TU.post("log",{path:_,maxCount:q,skip:f.length});if(0===e.code){const t=e.data||[];x(e=>[...e,...t]),N(t.length>=q)}}catch(e){}finally{w.current=!1,b(!1)}}})()},on_search_result:e=>{pe(e),null===e&&ye()}})})]}),(0,p.jsx)("div",{className:"studio__divider",ref:se,onPointerDown:()=>{te(!0),ae.current.addEventListener("pointermove",Ue)},onPointerUp:Te}),ee&&(0,p.jsx)("div",{className:"shell__overlay",onPointerUp:Te}),(0,p.jsx)("div",{className:"studio-editor",children:(0,p.jsxs)("div",{className:"git-main",children:[(0,p.jsx)(D,{dir_path:_,on_resolved:$e}),(0,p.jsxs)("div",{className:"git-card",children:[(0,p.jsx)(K,{current:k.current,branches:k.branches,on_checkout:async t=>{try{J(!0);const s=await i.TU.post("checkout",{path:_,branch:t});0===s.code?((0,n.SK)(e("切换分支成功")),await $e()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},on_create:async t=>{try{J(!0);const s=await i.TU.post("branch_create",{path:_,name:t});0===s.code?((0,n.SK)(e("分支创建成功")),await $e()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},on_delete:async(t,s)=>{try{J(!0);const a=await i.TU.post("branch_delete",{path:_,name:t,force:s});0===a.code?((0,n.SK)(e("分支删除成功")),await $e()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},on_merge:async t=>{try{J(!0);const s=await i.TU.post("merge",{path:_,branch:t});0===s.code?((0,n.SK)(e("合并成功")),await $e()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},ahead:ue?.ahead,behind:ue?.behind}),(0,p.jsx)(M,{dir_path:_,current_branch:k.current,on_checkout:$e,on_compare:e=>ne({kind:"remote",branch:e})}),(0,p.jsx)("textarea",{className:"git-commit-input",placeholder:e("git_msg"),value:U,onChange:e=>E(e.target.value),rows:3}),(0,p.jsxs)("div",{className:"git-btn-row",children:[(0,p.jsx)(l.rA,{icon:"check",title:e("提交"),onClick:async()=>{if(!U.trim())return void(0,n.zN)(e("请输入提交信息"));if(0===g.filter(e=>e.staged).length){return 0===g.filter(e=>!e.staged).length?void(0,n.zN)(e("没有可提交的更改")):void t({title:e("提交"),sub_title:e("存在未暂存的改动,是否一并暂存并提交?"),confirm_fun:Ce})}await ze(!1)}}),(0,p.jsx)(l.rA,{icon:"edit_note",title:e("修改最后一次提交"),onClick:async()=>{try{J(!0);const t=await i.TU.post("commit_amend",{path:_,message:U});0===t.code?((0,n.SK)(e("已修改最后一次提交")),E(""),ne(null),await ve(),ye()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}}}),(0,p.jsx)(l.rA,{icon:"download",title:e("拉取"),onClick:async()=>{try{J(!0);const t=await i.TU.post("pull",{path:_});0===t.code?((0,n.SK)(e("拉取成功")),await ve(),ye()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}}}),(0,p.jsx)(l.rA,{icon:"upload",title:e("推送"),onClick:()=>Ae(!1)}),(0,p.jsx)(l.rA,{icon:"keyboard_double_arrow_up",title:e("强制推送"),onClick:()=>Ae(!0)}),(0,p.jsx)("span",{className:"git-btn-gap"}),(0,p.jsx)(l.rA,{icon:"inventory_2",title:e("暂存工作区"),onClick:async()=>{try{const t=await i.TU.post("stash",{path:_});0===t.code?((0,n.SK)(e("暂存工作区成功")),ne(null),await ve()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"unarchive",title:e("恢复工作区"),onClick:async()=>{try{const t=await i.TU.post("stash_pop",{path:_});0===t.code?((0,n.SK)(e("恢复工作区成功")),await ve()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})]}),(0,p.jsx)(I,{dir_path:_,on_changed:$e}),(0,p.jsx)(F,{dir_path:_,target_hash:"commit"===ie?.kind?ie.hash:void 0,on_changed:$e}),(0,p.jsx)(R,{dir_path:_,on_changed:$e})]}),ie?"commit"===ie.kind?(0,p.jsx)($,{dir_path:_,hash:ie.hash,on_close:()=>ne(null),on_changed:$e}):"blame"===ie.kind?(0,p.jsx)(T,{dir_path:_,file:ie.file,on_close:()=>ne(null)}):"remote"===ie.kind?(0,p.jsx)(P,{dir_path:_,branch:ie.branch,current_branch:k.current,on_close:()=>ne(null)}):(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:ie.staged?e("已暂存"):e("未暂存")}),(0,p.jsx)("span",{className:"git-diff-header__path",title:ie.path,children:ie.path}),(0,p.jsxs)("div",{className:"git-diff-header__modes",children:[(0,p.jsx)(l.rA,{icon:"view_agenda",title:e("单栏"),selected:"unified"===ce,onClick:()=>le("unified")}),(0,p.jsx)(l.rA,{icon:"view_column",title:e("并排"),selected:"split"===ce,onClick:()=>le("split")}),(0,p.jsx)(l.rA,{icon:"close",title:e("关闭"),onClick:()=>ne(null)})]})]}),ie.staged?(0,p.jsx)(S,{dir_path:_,file:ie.path,left_ref:"HEAD",right_ref:"staged",mode:ce}):(0,p.jsx)(S,{dir_path:_,file:ie.path,left_ref:"HEAD",right_ref:"worktree",mode:ce})]}):(0,p.jsx)("div",{className:"git-card git-card--placeholder",children:e("点击左侧文件查看差异")}),(0,p.jsxs)("div",{className:"git-card",children:[(0,p.jsx)(B,{dir_path:_,user_config:oe,proxy_config:de,on_user_config_saved:re,on_proxy_saved:he}),(0,p.jsx)(O,{dir_path:_,on_info_loaded:fe,on_changed:$e}),(0,p.jsx)(H,{dir_path:_})]})]})})]})]})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3528],{48890(e,t,s){s.d(t,{Kw:()=>a,Tt:()=>i});var a=s(80952),i=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(34678),s(24522));const n=`https://gcore.jsdelivr.net/npm/ace-builds@${a.version}/src-min-noconflict/`;a.config.set("basePath",n),a.config.set("modePath",n),a.config.set("themePath",n),a.config.set("workerPath",n)},53528(e,t,s){s.r(t),s.d(t,{default:()=>G});var a=s(96540),i=s(14284),n=s(62042),c=s(22022),l=s(85997),o=s(57952),r=s(61973),d=s(34289),h=s(87361),m=s(2543),_=s(34251),g=s(47022),p=s(74848);const u={M:{label:"M",cls:"mod"},A:{label:"A",cls:"add"},D:{label:"D",cls:"del"},R:{label:"R",cls:"ren"},C:{label:"C",cls:"ren"},U:{label:"U",cls:"conf"},"?":{label:"?",cls:"untracked"}};function f(e){const t=e.lastIndexOf("/");return-1===t?e:e.substring(t+1)}function x(e){const t={type:"folder",name:"",full_path:"",children:[]};for(const s of e){const e=s.path.split("/").filter(Boolean);let a=t;for(let t=0;t<e.length;t++){const i=e[t],n=t===e.length-1;let c=a.children.find(e=>e.name===i);c||(c={type:n?"file":"folder",name:i,full_path:a.full_path?`${a.full_path}/${i}`:i,children:[]},a.children.push(c)),n&&(c.data=s.data),a=c}}const s=e=>{e.sort((e,t)=>e.type!==t.type?"folder"===e.type?-1:1:e.name.localeCompare(t.name));for(const t of e)t.children.length&&s(t.children)};return s(t.children),t.children}function j(e){const{t}=(0,c.Bd)(),{file:s,staged:a,status:i,selected:n,active:o,leaf:r}=e,d=u[i]??{label:i,cls:"mod"},h=r?s.path.substring(0,s.path.lastIndexOf("/")):"";return(0,p.jsxs)("div",{className:"git-file"+(o?" git-file--active":""),children:[(0,p.jsx)("input",{type:"checkbox",checked:n.has(s.path),onChange:()=>e.on_toggle(s.path),onClick:e=>e.stopPropagation()}),(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":(0,_.uL)(s.path),"data-dir":!1,"aria-label":s.path,children:(0,p.jsx)(l.In,{icon:"",aria_label:s.path})})}),(0,p.jsx)("span",{className:"git-file__name",title:s.oldPath?`${s.oldPath} → ${s.path}`:s.path,onClick:()=>e.on_view_diff(s,a),children:r?f(s.path):s.path}),(0,p.jsx)("span",{className:`git-file__badge git-file__badge--${d.cls}`,children:d.label}),h&&(0,p.jsx)("span",{className:"git-file__dir",title:h,children:h}),(0,p.jsxs)("span",{className:"git-file__ops",children:[(0,p.jsx)(l.rA,{icon:"format_list_numbered",title:t("逐行归属"),onClick:()=>e.on_view_blame(s)}),(0,p.jsx)(l.rA,{icon:a?"remove":"add",title:t(a?"取消暂存":"暂存"),onClick:()=>e.on_stage_one(s,a)})]})]})}function N(e){const{node:t,staged:s,file_map:i,prefix:n}=e,[c,o]=(0,a.useState)(!0),r=n?`${n}/${t.name}`:t.name;if("file"===t.type){const t=i.get(r);if(!t)return null;const a=s?t.conflicted?"U":t.index:t.untracked?"?":t.conflicted?"U":t.worktree;return(0,p.jsx)(j,{file:t,staged:s,status:a,selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame})}return(0,p.jsxs)("div",{className:"git-tree__folder",children:[(0,p.jsxs)("div",{className:"git-tree__dir",onClick:()=>o(!c),children:[(0,p.jsx)("i",{className:"material-icons git-tree__arrow","data-icon":c?"arrow_drop_down":"arrow_right",children:c?"arrow_drop_down":"arrow_right"}),(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":g.Iw.folder,"data-dir":!0,"aria-label":t.name,children:(0,p.jsx)(l.In,{icon:"",aria_label:t.name})})}),(0,p.jsx)("span",{className:"git-tree__dir-name",children:t.name})]}),c&&(0,p.jsx)("div",{className:"git-tree__children",children:t.children?.map((t,a)=>(0,p.jsx)(N,{node:t,staged:s,file_map:i,prefix:r,selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame},a))})]})}function v(e){const{t}=(0,c.Bd)(),{title:s,files:i,staged:n,selected:l}=e,o=(0,a.useMemo)(()=>i.map(e=>e.path),[i]),r=o.filter(e=>l.has(e)).length,d=i.length>0&&r===i.length,h=r>0&&!d,m=(0,a.useMemo)(()=>{const e=new Map;for(const t of i)e.set(t.path,t);return e},[i]),_=(0,a.useMemo)(()=>e.tree_mode?function(e){const t=x(e.map(e=>({path:e.path,data:e}))),s=e=>({type:e.type,name:e.name,size:0,children:e.children.length?e.children.map(s):void 0});return t.map(s)}(i):[],[i,e.tree_mode]);return 0===i.length?null:(0,p.jsxs)("div",{className:"git-section",children:[(0,p.jsxs)("div",{className:"git-section__header",children:[(0,p.jsx)("input",{type:"checkbox",checked:d,ref:e=>{e&&(e.indeterminate=h)},onChange:()=>e.on_toggle_all(o,!d)}),(0,p.jsxs)("span",{className:"git-section__title",children:[s," (",i.length,")"]}),(0,p.jsx)("span",{className:"git-section__action",onClick:()=>e.on_stage_section(i,n),children:t(n?"全部取消暂存":"全部暂存")})]}),e.tree_mode?(0,p.jsx)("div",{className:"git-tree",children:_.map((t,s)=>(0,p.jsx)(N,{node:t,staged:n,file_map:m,prefix:"",selected:e.selected,active_path:e.active_path,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame},s))}):i.map(t=>(0,p.jsx)(j,{file:t,staged:n,status:e.status_of(t),selected:e.selected,active:e.active_path===t.path,leaf:!0,on_toggle:e.on_toggle,on_view_diff:e.on_view_diff,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame},t.path+(n?"_s":"_w")))]})}function y(e){const{t}=(0,c.Bd)(),{files:s}=e,[i,n]=(0,a.useState)(!1),o=s.filter(e=>e.staged),r=s.filter(e=>e.untracked||" "!==e.worktree),d={selected:e.selected,on_toggle:e.on_toggle,on_toggle_all:e.on_toggle_all,active_path:e.active_path,tree_mode:i,on_view_diff:e.on_view_diff,on_stage_section:e.on_stage_section,on_stage_one:e.on_stage_one,on_view_blame:e.on_view_blame};return(0,p.jsxs)("div",{className:"git-change-list",children:[(0,p.jsx)("div",{className:"git-change-toolbar",children:(0,p.jsx)(l.rA,{icon:"account_tree",title:t("树形展示"),selected:i,onClick:()=>n(!i)})}),(0,p.jsx)(v,{title:t("已暂存的更改"),files:o,staged:!0,status_of:e=>e.conflicted?"U":e.index,...d}),(0,p.jsx)(v,{title:t("更改"),files:r,staged:!1,status_of:e=>e.untracked?"?":e.conflicted?"U":e.worktree,...d}),0===s.length&&(0,p.jsx)("div",{className:"git-change-empty",children:t("没有已更改的文件")})]})}var b=s(48890);function w({valueA:e,valueB:t,mode:s="split",theme:i,filename:n}){const c=(0,a.useRef)(null),l=(0,a.useRef)(null),o=(0,a.useMemo)(()=>n&&b.Tt.getModeForPath(n).mode||"ace/mode/text",[n]);return(0,a.useEffect)(()=>{const a=c.current;if(!a)return;const n=b.Kw.require("ace/ext/diff"),r={valueA:e??"",valueB:t??"",diffProvider:new n.DiffProvider},d="inline"===s,h=d?new n.InlineDiffView({...r,inline:"a"},a):new n.SplitDiffView(r);d||(h.container=a,a.appendChild(h.editorA.container),a.appendChild(h.editorB.container)),i&&h.setTheme(i),h.editorA?.session.setMode(o),h.editorB?.session.setMode(o),h.onInput(),h.foldUnchanged();const m=requestAnimationFrame(()=>{h.editorA?.resize(!0),h.editorB?.resize(!0)});return l.current=h,()=>{cancelAnimationFrame(m);try{h.destroy()}catch(e){}l.current=null,a.innerHTML=""}},[e,t,s,i,o]),(0,p.jsx)("div",{className:"ace-diff",ref:c})}const k={text:"",binary:!1,exists:!1};function S({dir_path:e,file:t,left_ref:s,right_ref:n,mode:l="unified"}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(k),[h,m]=(0,a.useState)(k),[_,g]=(0,a.useState)(!1),[u,f]=(0,a.useState)(""),x=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const a=++x.current;g(!0),f("");const c=s=>i.TU.post("file_content",{path:e,file:t,ref:s});Promise.all([c(s),c(n)]).then(([e,t])=>{a===x.current&&(d(0===e.code?e.data:k),m(0===t.code?t.data:k))}).catch(e=>{a===x.current&&(f("string"==typeof e?e:e?.message||""),d(k),m(k))}).finally(()=>{a===x.current&&g(!1)})},[e,t,s,n]),_?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:o("加载中")})}):u?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:u})}):r.binary||h.binary?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:o("二进制文件无法比较")})}):r.text===h.text?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:o("无差异")})}):(0,p.jsx)(w,{valueA:r.text??"",valueB:h.text??"",mode:"split"===l?"split":"inline",filename:t})}function C({dir_path:e,entries:t,is_search:s,has_more:o,loading_more:r,active_hash:d,on_select:h,on_scroll_bottom:m,on_search_result:_}){const{t:g}=(0,c.Bd)(),[u,f]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1),{rows:w,width:k}=function(e){const t=[],s=[];let a=1;for(const i of e){let e=t.indexOf(i.hash);e<0&&(e=t.indexOf(null),e<0&&(e=t.length,t.push(null)));const n=i.parents||[],c=[];for(const s of n)s&&t.forEach((a,i)=>{i!==e&&a===s&&(c.push(i),t[i]=null)});const l=[];t.forEach((t,s)=>{null===t||s===e||c.includes(s)||l.push(s)}),t[e]=n[0]??null;const o=[e];for(const e of n.slice(1)){let s=t.indexOf(e);s<0&&(s=t.indexOf(null),s<0&&(s=t.length,t.push(null)),t[s]=e),o.push(s)}for(;t.length&&null===t[t.length-1];)t.pop();s.push({column:e,pass_through:l,out_edges:o,merge_in:c}),a=Math.max(a,t.length,e+1,...o.map(e=>e+1))}return{rows:s,width:a}}(s?[]:t),S=async()=>{if(x.trim()||N.trim()){b(!0);try{const t=await i.TU.post("search_commit",{path:e,keyword:x.trim(),author:N.trim(),maxCount:100});0===t.code?_(t.data||[]):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(g("请输入搜索条件"))},C=(e,t,s)=>{const a=39,i=12,n=s?i:-2,c=e=>16*e+8,l=c(e.column),o=[];for(const t of e.pass_through)o.push((0,p.jsx)("line",{x1:c(t),y1:n,x2:c(t),y2:41,className:"git-log__graph-edge"},`p${t}`));for(const[t,a]of e.merge_in.entries()){const e=c(a);s||o.push((0,p.jsx)("path",{fill:"none",d:`M ${e} -2 C ${e} 19.5 ${l} 19.5 ${l} 12`,className:"git-log__graph-edge"},`m${t}`))}for(const[t,s]of e.out_edges.entries())if(s===e.column)o.push((0,p.jsx)("line",{x1:l,y1:n,x2:l,y2:41,className:"git-log__graph-edge"},`o${t}`));else{const e=c(s);o.push((0,p.jsx)("path",{fill:"none",d:`M ${l} 12 C ${l} 25.5 ${e} 25.5 ${e} 39`,className:"git-log__graph-edge"},`o${t}`))}return(0,p.jsx)("div",{className:"git-log__graph",children:(0,p.jsxs)("svg",{width:16*k,height:a,overflow:"visible",children:[o,(0,p.jsx)("circle",{cx:l,cy:i,r:3.5,className:"git-log__graph-dot"+(t?" git-log__graph-dot--unpushed":"")})]})})};return(0,p.jsxs)("div",{className:"git-log-wrap",children:[(0,p.jsxs)("div",{className:"git-log-search",children:[(0,p.jsx)(l.rA,{icon:"search",title:g("搜索提交"),onClick:()=>{u?(j(""),v(""),_(null),f(!1)):f(!0)}}),u&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:g("提交信息关键词"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,p.jsx)("input",{className:"input input--block",value:N,placeholder:g("作者"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&S()}),(0,p.jsx)(l.rA,{icon:"check",title:g("搜索"),onClick:S})]})]}),(0,p.jsxs)("div",{className:"git-log",onScroll:m,children:[y&&(0,p.jsx)("div",{className:"git-change-empty",children:g("加载中")}),!y&&0===t.length&&(0,p.jsx)("div",{className:"git-change-empty",children:g("暂无提交记录")}),!y&&t.map((e,t)=>(0,p.jsxs)("div",{className:`git-log__entry${d===e.hash?" git-log__entry--active":""}${e.unpushed?" git-log__entry--unpushed":""}`,onClick:()=>h(e.hash),children:[!s&&C(w[t],!!e.unpushed,0===t),(0,p.jsxs)("div",{className:"git-log__main",children:[(0,p.jsxs)("div",{className:"git-log__row",children:[e.unpushed&&(0,p.jsx)("span",{className:"git-log__unpushed",title:g("未推送")}),(0,p.jsx)("span",{className:"git-log__hash",children:e.hash}),(e.refs||[]).map(e=>(0,p.jsx)("span",{className:"git-log__ref"+(e.includes("HEAD")?" git-log__ref--head":""),children:e.replace("HEAD -> ","")},e)),(0,p.jsx)("span",{className:"git-log__msg",title:e.message,children:e.message})]}),(0,p.jsxs)("div",{className:"git-log__meta",children:[e.author," · ",e.date]})]})]},e.hash)),!y&&!s&&r&&(0,p.jsx)("div",{className:"git-log__more",children:g("加载中")}),!y&&!s&&!r&&!o&&t.length>0&&(0,p.jsx)("div",{className:"git-log__more",children:g("已到底部")})]})]})}var z=s(45907);function A({nodes:e,selected:t,on_select:s}){const[i,n]=(0,a.useState)(new Set),c=e=>e.map(e=>{if("folder"===e.type){const t=!i.has(e.full_path);return(0,p.jsxs)("div",{children:[(0,p.jsxs)("div",{className:"git-commit-tree__dir",onClick:()=>{return t=e.full_path,void n(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},children:[(0,p.jsx)("i",{className:"material-icons git-tree__arrow",children:t?"arrow_drop_down":"arrow_right"}),(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":g.Iw.folder,"data-dir":!0,"aria-label":e.name,children:(0,p.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,p.jsx)("span",{className:"git-commit-tree__dir-name",children:e.name})]}),t&&(0,p.jsx)("div",{className:"git-commit-tree__children",children:c(e.children)})]},e.full_path)}const a=e.data;return(0,p.jsxs)("div",{className:"git-commit-file git-commit-file--leaf"+(t===e.full_path?" git-commit-file--active":""),onClick:()=>s(e.full_path),title:e.full_path,children:[(0,p.jsx)("span",{className:"file-icons",children:(0,p.jsx)("span",{"data-type":(0,_.uL)(e.name),"aria-label":e.name,children:(0,p.jsx)(l.In,{icon:"",aria_label:e.name})})}),(0,p.jsx)("span",{className:"git-commit-file__name",children:e.name}),a&&null!==a.additions&&(0,p.jsxs)("span",{className:"git-commit-file__stat",children:[(0,p.jsxs)("span",{className:"git-stat--add",children:["+",a.additions]}),(0,p.jsxs)("span",{className:"git-stat--del",children:["-",a.deletions]})]})]},e.full_path)});return(0,p.jsx)(p.Fragment,{children:c(e)})}function $({dir_path:e,hash:t,on_close:s,on_changed:o}){const{t:r}=(0,c.Bd)(),d=(0,z.y)(),[h,m]=(0,a.useState)(null),[_,g]=(0,a.useState)(null),[u,f]=(0,a.useState)("unified"),[j,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(g(null),y(!1),w())},[t,e]);const b=(0,a.useMemo)(()=>x((h?.files??[]).map(e=>({path:e.path,data:e}))),[h]),w=async()=>{try{const s=await i.TU.post("commit_detail",{path:e,hash:t});0===s.code?m(s.data):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}};if(!h)return(0,p.jsx)("div",{className:"git-card git-card--diff",children:(0,p.jsx)("div",{className:"git-change-empty",children:r("加载中")})});return(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-commit-meta",children:[(0,p.jsxs)("div",{className:"git-commit-meta__row",children:[(0,p.jsx)("span",{className:"git-commit-meta__hash",children:h.short_hash}),(0,p.jsx)("span",{className:"git-commit-meta__subject",title:h.subject,children:h.subject}),_&&(0,p.jsx)(l.rA,{icon:"compare_arrows",title:r("与工作区对比"),onClick:()=>{_?y(!0):(0,n.zN)(r("请先选择文件"))}}),(0,p.jsx)(l.rA,{icon:"undo",title:r("撤销提交"),onClick:()=>{d({title:r("撤销提交"),sub_title:`${r("将生成一个反向提交来撤销")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("revert",{path:e,hash:t});0===s.code?((0,n.SK)(r("已撤销")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,p.jsx)(l.rA,{icon:"content_cut",title:r("摘取提交"),onClick:()=>{d({title:r("摘取提交"),sub_title:`${r("将该提交应用到当前分支")} ${h.short_hash} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("cherry_pick",{path:e,hash:t});0===s.code?((0,n.SK)(r("摘取成功")),o?.()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}}),(0,p.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:s})]}),(0,p.jsxs)("div",{className:"git-commit-meta__sub",children:[h.author," <",h.email,"> · ",h.date]})]}),(0,p.jsxs)("div",{className:"git-commit-body",children:[(0,p.jsxs)("div",{className:"git-commit-files",children:[(0,p.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",h.files.length,")"]}),(0,p.jsx)(A,{nodes:b,selected:_,on_select:e=>{g(e),y(!1)}})]}),(0,p.jsxs)("div",{className:"git-commit-diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:v?r("与工作区对比"):`${r("提交")} ${h.short_hash}`}),(0,p.jsx)("span",{className:"git-diff-header__path",title:_??"",children:_??`${r("全部文件")} (${h.files.length})`}),(0,p.jsxs)("div",{className:"git-diff-header__modes",children:[(0,p.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===u,onClick:()=>f("unified")}),(0,p.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===u,onClick:()=>f("split")})]})]}),_?v?(0,p.jsx)(S,{dir_path:e,file:_,left_ref:t,right_ref:"worktree",mode:u}):(0,p.jsx)(S,{dir_path:e,file:_,left_ref:`${t}^`,right_ref:t,mode:u}):(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:r("请选择文件查看改动")})})]})]})]})}function U(e){let t=0;for(let s=0;s<e.length;s++)t+=e.charCodeAt(s);return`hsl(${t%360}, 55%, 45%)`}function T({dir_path:e,file:t,on_close:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&_()},[t,e]);const _=async()=>{m(!0);try{const s=await i.TU.post("blame",{path:e,file:t});0===s.code?d(s.data||[]):((0,n.zN)(s.message),d([]))}catch(e){(0,n.zN)(e?.message),d([])}finally{m(!1)}};return(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:o("逐行归属")}),(0,p.jsx)("span",{className:"git-diff-header__path",title:t,children:t}),(0,p.jsx)("div",{className:"git-diff-header__modes",children:(0,p.jsx)(l.rA,{icon:"close",title:o("关闭"),onClick:s})})]}),h&&(0,p.jsx)("div",{className:"git-change-empty",children:o("加载中")}),!h&&0===r.length&&(0,p.jsx)("div",{className:"git-change-empty",children:o("无法读取该文件的归属信息")}),!h&&r.length>0&&(0,p.jsx)("div",{className:"git-blame",children:r.map((e,t)=>(0,p.jsxs)("div",{className:"git-blame__row",children:[(0,p.jsx)("span",{className:"git-blame__hash",title:e.hash,children:e.hash}),(0,p.jsx)("span",{className:"git-blame__author",style:{color:U(e.author)},title:`${e.author} · ${e.date}`,children:e.author}),(0,p.jsx)("span",{className:"git-blame__date",children:e.date}),(0,p.jsx)("span",{className:"git-blame__num",children:e.line_num}),(0,p.jsx)("span",{className:"git-blame__code",children:e.text||" "})]},t))})]})}function K({current:e,branches:t,on_checkout:s,on_create:i,on_delete:n,on_merge:o,ahead:r,behind:d}){const{t:h}=(0,c.Bd)(),m=(0,z.y)(),[_,g]=(0,a.useState)(!1),[u,f]=(0,a.useState)(""),x=()=>{const e=u.trim();e&&(i(e),f(""),g(!1))};return(0,p.jsxs)("div",{className:"git-branch-row",children:[(0,p.jsxs)("span",{className:"git-branch__name",children:[h("分支"),": ",e]}),(r>0||d>0)&&(0,p.jsxs)("span",{className:"git-branch__counts",children:[r>0&&(0,p.jsxs)("span",{className:"git-ahead",title:h("领先上游"),children:["↑",r]}),d>0&&(0,p.jsxs)("span",{className:"git-behind",title:h("落后上游"),children:["↓",d]})]}),(0,p.jsx)("div",{className:"git-branch__list",children:t.map(t=>{const a=t===e;return(0,p.jsxs)("div",{className:"git-branch-chip"+(a?" git-branch-chip--current":""),onClick:()=>!a&&s(t),title:a?h("当前分支"):`${h("切换到")} ${t}`,children:[t,!a&&(0,p.jsxs)("span",{className:"git-branch-chip__ops",children:[(0,p.jsx)("span",{className:"git-branch-chip__op",title:h("合并到此分支"),onClick:e=>{e.stopPropagation(),o(t)},children:"⇥"}),(0,p.jsx)("span",{className:"git-branch-chip__op",title:h("删除分支"),onClick:e=>{var s;e.stopPropagation(),s=t,m({title:h("删除分支"),sub_title:`${h("确认删除分支")} ${s} ?`,confirm_fun:()=>n(s,!1)})},children:"×"})]})]},t)})}),_?(0,p.jsxs)("span",{className:"git-branch-new",children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:u,placeholder:h("新分支名"),onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x(),"Escape"===e.key&&(g(!1),f(""))}}),(0,p.jsx)(l.rA,{icon:"check",title:h("确定"),onClick:x}),(0,p.jsx)(l.rA,{icon:"close",title:h("取消"),onClick:()=>{g(!1),f("")}})]}):(0,p.jsx)(l.rA,{icon:"add",title:h("新建分支"),onClick:()=>g(!0)})]})}var E=s(61443);function B(e){const{t}=(0,c.Bd)(),{dir_path:s,user_config:o,proxy_config:r}=e,[d,h]=(0,a.useState)(!1),[m,_]=(0,a.useState)(o.name),[g,u]=(0,a.useState)(o.email),[f,x]=(0,a.useState)(!1),[j,N]=(0,a.useState)(r?.global.http||""),[v,y]=(0,a.useState)(r?.global.https||""),[b,w]=(0,a.useState)(r?.local.http||""),[k,S]=(0,a.useState)(r?.local.https||"");return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:t("用户配置")}),d?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:m,placeholder:"user.name",handleInputChange:e=>_(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:g,placeholder:"user.email",handleInputChange:e=>u(e)}),(0,p.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{try{const a=await i.TU.post("set_user_config",{path:s,name:m,email:g});0===a.code?((0,n.SK)(t("用户配置已保存")),h(!1),e.on_user_config_saved({name:m,email:g})):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>h(!1)})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("span",{className:"git-config__value",children:[o.name," / ",o.email]}),(0,p.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{_(o.name),u(o.email),h(!0)}})]})]}),(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:t("代理配置")}),f?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:j,placeholder:"global http",handleInputChange:e=>N(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:v,placeholder:"global https",handleInputChange:e=>y(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:b,placeholder:"local http",handleInputChange:e=>w(e)}),(0,p.jsx)(E.Sm,{maxWidth:"15rem",value:k,placeholder:"local https",handleInputChange:e=>S(e)}),(0,p.jsx)(l.rA,{icon:"check",title:t("保存"),onClick:async()=>{const a=[{scope:"global",type:"http",value:j},{scope:"global",type:"https",value:v},{scope:"local",type:"http",value:b},{scope:"local",type:"https",value:k}];try{for(const e of a)await i.TU.post("set_proxy",{path:s,...e});(0,n.SK)(t("代理配置已保存")),x(!1),e.on_proxy_saved({global:{http:j,https:v},local:{http:b,https:k}})}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:()=>x(!1)})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"git-config__value",children:(()=>{if(!r)return"-";const e=r.global;if(e.http||e.https)return`global ${e.http||e.https}`;const t=r.local;return t.http||t.https?`local ${t.http||t.https}`:"-"})()}),(0,p.jsx)(l.rA,{icon:"edit",title:t("编辑"),onClick:()=>{N(r?.global.http||""),y(r?.global.https||""),w(r?.local.http||""),S(r?.local.https||""),x(!0)}})]})]})]})}function F({dir_path:e,target_hash:t,on_changed:s}){const{t:o}=(0,c.Bd)(),r=(0,z.y)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(!1),[g,u]=(0,a.useState)(""),[f,x]=(0,a.useState)(""),[j,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{v()},[e]);const v=async()=>{try{const t=await i.TU.post("tags",{path:e});0===t.code&&h(t.data||[])}catch(e){}};return(0,p.jsxs)("div",{className:"git-sub-panel",children:[(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",children:[o("标签")," (",d.length,")"]}),(0,p.jsx)(l.rA,{icon:"add",title:o("新建标签"),onClick:()=>_(!m)})]}),m&&(0,p.jsxs)("div",{className:"git-sub-panel__form",children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:g,placeholder:o("标签名"),onChange:e=>u(e.target.value)}),(0,p.jsx)("input",{className:"input input--block",value:f,placeholder:o("备注"),onChange:e=>x(e.target.value)}),(0,p.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,p.jsx)("span",{className:"git-sub-panel__hint",children:t?`${o("基于提交")} ${t}`:o("基于当前提交")}),(0,p.jsx)(l.rA,{icon:"check",title:o("保存"),onClick:async()=>{const a=g.trim();if(a){N(!0);try{const c=await i.TU.post("tag_create",{path:e,name:a,message:f.trim(),hash:t});0===c.code?((0,n.SK)(o("标签创建成功")),u(""),x(""),_(!1),await v(),s()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{N(!1)}}else(0,n.zN)(o("请输入标签名"))}}),(0,p.jsx)(l.rA,{icon:"close",title:o("取消"),onClick:()=>{_(!1),u(""),x("")}})]})]}),(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===d.length&&(0,p.jsx)("div",{className:"git-change-empty",children:o("暂无标签")}),d.map(t=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,p.jsx)("span",{className:"git-sub-item__desc",title:t.message,children:t.message}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"upload",title:o("推送到远程"),onClick:()=>(async t=>{try{const s=await i.TU.post("tag_push",{path:e,name:t});0===s.code?(0,n.SK)(o("标签推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}})(t.name)}),(0,p.jsx)(l.rA,{icon:"delete",title:o("删除标签"),onClick:()=>{return s=t.name,void r({title:o("删除标签"),sub_title:`${o("确认删除标签")} ${s} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("tag_delete",{path:e,name:s});0===t.code?((0,n.SK)(o("标签删除成功")),await v()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var s}})]})]},t.name))]})]})}function I({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("stash_list",{path:e});0===t.code&&d(t.data||[])}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("stash_apply",{path:e,ref:a,pop:c});0===l.code?((0,n.SK)(s(c?"已恢复并删除记录":"已应用")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return(0,p.jsxs)("div",{className:"git-stash",children:[(0,p.jsx)("div",{className:"git-sub-panel__header",children:(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("暂存工作区记录")," ",h?"▾":"▸"]})}),h&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,p.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(t=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:t.message,children:t.message}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:t.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"play_arrow",title:s("应用"),onClick:()=>g(t.ref,!1)}),(0,p.jsx)(l.rA,{icon:"unarchive",title:s("恢复并删除"),onClick:()=>g(t.ref,!0)}),(0,p.jsx)(l.rA,{icon:"delete",title:s("删除"),onClick:()=>{return a=t.ref,void o({title:s("删除记录"),sub_title:`${s("确认删除")} ${a} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("stash_drop",{path:e,ref:a});0===t.code?((0,n.SK)(s("已删除")),await _()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}});var a}})]})]},t.ref))]})]})}function M({dir_path:e,current_branch:t,on_checkout:s,on_compare:o}){const{t:r}=(0,c.Bd)(),d=(0,z.y)(),[h,m]=(0,a.useState)([]),[_,g]=(0,a.useState)([]),[u,f]=(0,a.useState)(!1),[x,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(null),[y,b]=(0,a.useState)("");(0,a.useEffect)(()=>{u&&w()},[e,u]);const w=async()=>{try{const t=await i.TU.post("remote_branches",{path:e});0===t.code&&(m(t.data?.branches||[]),g(t.data?.remotes||[]))}catch(e){}},k=async t=>{j(!0);try{const s=await i.TU.post("fetch",{path:e,prune:t});0===s.code?((0,n.SK)(r("拉取完成")),await w()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}},S=async()=>{const t=N;if(t&&y.trim()){j(!0);try{const a=await i.TU.post("remote_branch_rename",{path:e,branch:t,new_name:y.trim()});0===a.code?((0,n.SK)(r("重命名成功")),v(null),await w(),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}}};return(0,p.jsxs)("div",{className:"git-remote",children:[(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>f(!u),children:[r("远程分支")," (",h.length,") ",u?"▾":"▸"]}),(0,p.jsx)(l.rA,{icon:"cloud_download",title:r("拉取远程信息"),onClick:()=>k(!1)}),(0,p.jsx)(l.rA,{icon:"cleaning_services",title:r("拉取并清理已删除分支"),onClick:()=>k(!0)})]}),u&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===_.length&&(0,p.jsx)("div",{className:"git-change-empty",children:r("未配置远程仓库")}),h.map(c=>(0,p.jsxs)(a.Fragment,{children:[(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:c.name,children:c.name}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:c.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"call_split",title:r("签出到本地"),onClick:()=>(async t=>{j(!0);try{const a=await i.TU.post("checkout_remote",{path:e,branch:t});0===a.code?((0,n.SK)(r("切换分支成功")),s()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}})(c.name)}),(0,p.jsx)(l.rA,{icon:"compare_arrows",title:r("与当前分支比较"),onClick:()=>o(c.name)}),(0,p.jsx)(l.rA,{icon:"merge",title:r("合并到当前分支"),onClick:()=>(async a=>{d({title:r("合并到当前分支"),sub_title:`${r("将")} ${a} ${r("合并到")} ${t} ?`,confirm_fun:async()=>{try{const t=await i.TU.post("merge",{path:e,branch:a});0===t.code?((0,n.SK)(r("合并成功")),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})})(c.name)}),(0,p.jsx)(l.rA,{icon:"drive_file_rename_outline",title:r("重命名"),onClick:()=>(e=>{const t=e.indexOf("/"),s=t>=0?e.substring(t+1):e;b(s),v(e)})(c.name)}),(0,p.jsx)(l.rA,{icon:"delete",title:r("删除"),onClick:()=>{return t=c.name,void d({title:r("删除远程分支"),sub_title:`${r("确认删除远程分支")} ${t} ? ${r("该分支会从远程仓库删除")}`,confirm_fun:async()=>{try{const s=await i.TU.post("remote_branch_delete",{path:e,branch:t});0===s.code?((0,n.SK)(r("删除成功")),await w()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}});var t}})]})]}),N===c.name&&(0,p.jsxs)("div",{className:"git-remote__rename",children:[(0,p.jsx)(E.Sm,{value:y,width:"12rem",handleInputChange:e=>b(e)}),(0,p.jsx)(l.rA,{icon:"check",title:r("确定"),onClick:S}),(0,p.jsx)(l.rA,{icon:"close",title:r("取消"),onClick:()=>v(null)})]})]},c.name))]})]})}function P({dir_path:e,branch:t,current_branch:s,on_close:o}){const{t:r}=(0,c.Bd)(),[d,h]=(0,a.useState)([]),[m,_]=(0,a.useState)(null),[g,u]=(0,a.useState)("unified"),[f,j]=(0,a.useState)(!0);(0,a.useEffect)(()=>{_(null),N()},[e,t,s]);const N=async()=>{j(!0);try{const a=await i.TU.post("diff_files",{path:e,from:s,to:t});0===a.code?h(a.data||[]):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{j(!1)}},v=(0,a.useMemo)(()=>x(d.map(e=>({path:e.path,data:e}))),[d]);return(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:r("分支比较")}),(0,p.jsxs)("span",{className:"git-diff-header__path",title:`${s} ↔ ${t}`,children:[s," ↔ ",t]}),m&&(0,p.jsxs)("div",{className:"git-diff-header__modes",children:[(0,p.jsx)(l.rA,{icon:"view_agenda",title:r("单栏"),selected:"unified"===g,onClick:()=>u("unified")}),(0,p.jsx)(l.rA,{icon:"view_column",title:r("并排"),selected:"split"===g,onClick:()=>u("split")})]}),(0,p.jsx)(l.rA,{icon:"close",title:r("关闭"),onClick:o})]}),(0,p.jsxs)("div",{className:"git-commit-body",children:[(0,p.jsxs)("div",{className:"git-commit-files",children:[(0,p.jsxs)("div",{className:"git-commit-file__count",children:[r("全部文件")," (",d.length,")"]}),(0,p.jsx)(A,{nodes:v,selected:m,on_select:_})]}),(0,p.jsx)("div",{className:"git-commit-diff",children:f?(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:r("加载中")})}):m?(0,p.jsx)(S,{dir_path:e,file:m,left_ref:s,right_ref:t,mode:g}):(0,p.jsx)("div",{className:"git-diff-empty",children:(0,p.jsx)("span",{children:r("请选择文件查看改动")})})})]})]})}function D({dir_path:e,on_resolved:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)("");(0,a.useEffect)(()=>{_()},[e]);const _=async()=>{try{const t=await i.TU.post("conflicts",{path:e});0===t.code&&(d(t.data?.files||[]),m(t.data?.state||""))}catch(e){}},g=async(a,c)=>{try{const l=await i.TU.post("resolve",{path:e,file:a,side:c});0===l.code?((0,n.SK)(s("已解决冲突")),await _(),t()):(0,n.zN)(l.message)}catch(e){(0,n.zN)(e?.message)}};return 0===r.length?null:(0,p.jsxs)("div",{className:"git-card git-conflict",children:[(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",children:[s("冲突")," (",r.length,")",h&&(0,p.jsx)("span",{className:"git-conflict__state",children:h})]}),(0,p.jsx)(l.rA,{icon:"done_all",title:s("标记全部已解决"),onClick:async()=>{try{const a=await i.TU.post("conflict_action",{path:e,action:"merge_continue"});0===a.code?((0,n.SK)(s("合并已完成")),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"undo",title:s("放弃合并"),onClick:()=>{const a="rebase"===h?"rebase_abort":"cherry-pick"===h?"cherry_pick_abort":"revert"===h?"revert_abort":"merge_abort";o({title:s("放弃合并"),sub_title:s("确认放弃当前合并并恢复到操作前状态"),confirm_fun:async()=>{try{const c=await i.TU.post("conflict_action",{path:e,action:a});0===c.code?((0,n.SK)(s("已放弃合并")),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}}})}})]}),r.map(e=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:e,children:e}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"person",title:s("采用我方版本"),onClick:()=>g(e,"ours")}),(0,p.jsx)(l.rA,{icon:"group",title:s("采用对方版本"),onClick:()=>g(e,"theirs")}),(0,p.jsx)(l.rA,{icon:"check",title:s("标记已解决"),onClick:()=>g(e,"resolved")})]})]},e))]})}function R({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,z.y)(),[r,d]=(0,a.useState)([]),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h&&_()},[e,h]);const _=async()=>{try{const t=await i.TU.post("reflog",{path:e,maxCount:100});0===t.code&&d(t.data||[])}catch(e){}};return(0,p.jsxs)("div",{className:"git-reflog",children:[(0,p.jsx)("div",{className:"git-sub-panel__header",children:(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>m(!h),style:{cursor:"pointer"},children:[s("操作历史")," (",r.length,") ",h?"▾":"▸"]})}),h&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===r.length&&(0,p.jsx)("div",{className:"git-change-empty",children:s("暂无记录")}),r.map(a=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:a.message,children:a.selector}),(0,p.jsx)("span",{className:"git-sub-item__desc",title:a.message,children:a.message}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:a.date}),(0,p.jsxs)("span",{className:"git-sub-item__ops",children:[(0,p.jsx)(l.rA,{icon:"undo",title:s("回退到此处"),onClick:()=>{return c=a,void o({title:s("回退到此处"),sub_title:`${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"mixed"});0===a.code?((0,n.SK)(s("已回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}}),(0,p.jsx)(l.rA,{icon:"delete_forever",title:s("强制回退(丢弃改动)"),onClick:()=>{return c=a,void o({title:s("强制回退(丢弃改动)"),sub_title:`${s("此操作将永久丢弃未提交的改动")}:${c.selector} · ${c.message}`,confirm_fun:async()=>{try{const a=await i.TU.post("reset_commit",{path:e,hash:c.selector,mode:"hard"});0===a.code?((0,n.SK)(s("已强制回退")),await _(),t()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}}});var c}})]})]},a.selector))]})]})}function W({items:e,on_read:t,on_save:s,on_delete:i}){const{t:n}=(0,c.Bd)(),[o,r]=(0,a.useState)(null),[d,h]=(0,a.useState)(""),[m,_]=(0,a.useState)(!1);(0,a.useEffect)(()=>{o&&!e.some(e=>e.name===o)&&r(null)},[e,o]);const g=async()=>{if(o){_(!0);try{await s(o,d)}finally{_(!1)}}};return(0,p.jsx)("div",{className:"hook-editor",children:(0,p.jsxs)("div",{className:"hook-editor__list",children:[e.map(e=>(0,p.jsxs)(a.Fragment,{children:[(0,p.jsxs)("div",{className:"hook-item"+(o===e.name?" hook-item--editing":""),children:[(0,p.jsx)("span",{className:"hook-item__dot"+(e.enabled?" hook-item__dot--on":"")}),(0,p.jsx)("span",{className:"hook-item__name",children:e.name}),(0,p.jsxs)("span",{className:"hook-item__ops",children:[(0,p.jsx)(l.rA,{icon:o===e.name?"expand_less":"edit",title:n("编辑"),onClick:()=>(async e=>{if(o!==e){_(!0);try{h(await t(e)),r(e)}finally{_(!1)}}else r(null)})(e.name)}),e.enabled&&(0,p.jsx)(l.rA,{icon:"block",title:n("停用钩子"),onClick:()=>(async e=>{_(!0);try{await i(e)}finally{_(!1)}})(e.name)})]})]}),o===e.name&&(0,p.jsxs)("div",{className:"hook-item__editor",children:[(0,p.jsxs)("div",{className:"hook-item__editor-bar",children:[(0,p.jsx)("span",{className:"hook-item__editor-name",children:e.name}),(0,p.jsx)(l.rA,{icon:"check",title:n("保存并启用"),onClick:g}),(0,p.jsx)(l.rA,{icon:"close",title:n("取消"),onClick:()=>r(null)})]}),(0,p.jsx)("textarea",{className:"hook-item__text",value:d,spellCheck:!1,disabled:m,onChange:e=>h(e.target.value)})]})]},e.name)),0===e.length&&(0,p.jsx)("div",{className:"git-change-empty",children:n("暂无记录")})]})})}function H({dir_path:e}){const{t}=(0,c.Bd)(),s=(0,z.y)(),[l,o]=(0,a.useState)([]),[r,d]=(0,a.useState)(!1);(0,a.useEffect)(()=>{r&&h()},[e,r]);const h=async()=>{try{const t=await i.TU.post("hooks",{path:e});0===t.code&&o(t.data||[])}catch(e){}};return(0,p.jsxs)("div",{className:"git-hook",children:[(0,p.jsx)("div",{className:"git-sub-panel__header",children:(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>d(!r),children:[t("钩子")," ",r?"▾":"▸"]})}),r&&(0,p.jsx)(W,{items:l,on_read:async t=>{try{const s=await i.TU.post("hook_read",{path:e,name:t});if(0===s.code)return s.data?.content||"";(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}return""},on_save:async(s,a)=>{try{const c=await i.TU.post("hook_save",{path:e,name:s,content:a});0===c.code?((0,n.SK)(t("已保存并启用")),await h()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}},on_delete:async a=>{s({title:t("停用钩子"),sub_title:`${t("确认删除并停用")} ${a} ?`,confirm_fun:async()=>{try{const s=await i.TU.post("hook_delete",{path:e,name:a});0===s.code?((0,n.SK)(t("已停用")),await h()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}}})}})]})}function O({dir_path:e,on_info_loaded:t,on_changed:s}){const{t:o}=(0,c.Bd)(),[r,d]=(0,a.useState)(null),[h,m]=(0,a.useState)([]),[_,g]=(0,a.useState)(!1),[u,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{x(),j()},[e]);const x=async()=>{try{const s=await i.TU.post("repo_info",{path:e});0===s.code&&(d(s.data),t(s.data))}catch(e){}},j=async()=>{try{const t=await i.TU.post("submodules",{path:e});0===t.code&&m(t.data||[])}catch(e){}},N=e=>o("uninitialized"===e?"未初始化":"modified"===e?"与记录不一致":"正常");return(0,p.jsxs)("div",{className:"git-repo-panel",children:[(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:o("远程地址")}),(0,p.jsx)("span",{className:"git-config__value",title:r?.remote_url,children:r?.remote_url||o("未配置")})]}),(0,p.jsxs)("div",{className:"git-config-row",children:[(0,p.jsx)("span",{className:"git-config__label",children:o("当前提交")}),(0,p.jsxs)("span",{className:"git-config__value",children:[r?.head_hash||"",r&&(r.ahead>0||r.behind>0)&&(0,p.jsxs)("span",{className:"git-repo-panel__counts",children:[r.ahead>0&&(0,p.jsxs)("span",{className:"git-ahead",children:["↑",r.ahead]}),r.behind>0&&(0,p.jsxs)("span",{className:"git-behind",children:["↓",r.behind]})]})]})]}),(0,p.jsxs)("div",{className:"git-sub-panel__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",onClick:()=>g(!_),style:{cursor:"pointer"},children:[o("子模块")," (",h.length,") ",_?"▾":"▸"]}),h.length>0&&(0,p.jsx)(l.rA,{icon:"sync",title:o("初始化并更新子模块"),onClick:async()=>{f(!0);try{const t=await i.TU.post("submodule_update",{path:e});0===t.code?((0,n.SK)(o("子模块更新完成")),await j(),s()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{f(!1)}}})]}),_&&(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===h.length&&(0,p.jsx)("div",{className:"git-change-empty",children:o("无子模块")}),h.map(e=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:e.path,children:e.path}),(0,p.jsx)("span",{className:"git-sub-item__desc",title:e.desc,children:e.desc}),(0,p.jsx)("span",{className:`git-sub-item__meta git-sub-status--${e.status}`,children:N(e.status)})]},e.path))]})]})}function L({dir_path:e,on_changed:t}){const{t:s}=(0,c.Bd)(),o=(0,r.Zp)(),[d,m]=(0,a.useState)([]),[_,g]=(0,a.useState)([]),[u,f]=(0,a.useState)("none"),[x,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{w(),k()},[e]);const w=async()=>{try{const t=await i.TU.post("repos",{path:e});0===t.code&&m(t.data||[])}catch(e){}},k=async()=>{try{const t=await i.TU.post("dirs",{path:e});0===t.code&&g(t.data?.dirs||[])}catch(e){}},S=async()=>{const a=x.trim();if(a){b(!0);try{const c=await i.TU.post("init",{path:`${e}/${a}`.replace(/\/+/g,"/")});0===c.code?((0,n.SK)(s("仓库初始化成功")),f("none"),j(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入目录名"))},C=async()=>{const a=x.trim();if(a)if(N.trim()){b(!0);try{const c=await i.TU.post("clone",{target:`${e}/${a}`.replace(/\/+/g,"/"),url:N.trim()});0===c.code?((0,n.SK)(s("克隆成功")),f("none"),j(""),v(""),await w(),await k(),t()):(0,n.zN)(c.message)}catch(e){(0,n.zN)(e?.message)}finally{b(!1)}}else(0,n.zN)(s("请输入仓库地址"));else(0,n.zN)(s("请输入目录名"))};return(0,p.jsxs)("div",{className:"git-repo-manager",children:[(0,p.jsxs)("div",{className:"git-repo-manager__header",children:[(0,p.jsxs)("span",{className:"git-sub-panel__title",children:[s("仓库")," (",d.length,")"]}),(0,p.jsx)(l.rA,{icon:"add",title:s("初始化仓库"),selected:"init"===u,onClick:()=>{f("init"===u?"none":"init"),j("")}}),(0,p.jsx)(l.rA,{icon:"cloud_download",title:s("克隆仓库"),selected:"clone"===u,onClick:()=>{f("clone"===u?"none":"clone"),j("")}})]}),"none"!==u&&(0,p.jsxs)("div",{className:"git-sub-panel__form",children:[(0,p.jsx)("input",{className:"input input--block",autoFocus:!0,value:x,placeholder:s("目录名"),onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&("init"===u?S():C())}),"clone"===u&&(0,p.jsx)("input",{className:"input input--block",value:N,placeholder:s("仓库地址"),onChange:e=>v(e.target.value),onKeyDown:e=>"Enter"===e.key&&C()}),(0,p.jsxs)("div",{className:"git-sub-panel__form-actions",children:[(0,p.jsx)("span",{className:"git-sub-panel__hint",children:`${e}/${x||"..."}`.replace(/\/+/g,"/")}),(0,p.jsx)(l.rA,{icon:"check",title:s("保存"),onClick:"init"===u?S:C}),(0,p.jsx)(l.rA,{icon:"close",title:s("取消"),onClick:()=>{f("none"),j(""),v("")}})]}),_.length>0&&(0,p.jsx)("div",{className:"git-repo-manager__dirs",children:_.map(e=>(0,p.jsx)("span",{className:"git-repo-manager__dir",onClick:()=>j(e),children:e},e))})]}),(0,p.jsxs)("div",{className:"git-sub-panel__list",children:[0===d.length&&(0,p.jsx)("div",{className:"git-change-empty",children:s("当前目录下没有仓库")}),d.map(t=>(0,p.jsxs)("div",{className:"git-sub-item",children:[(0,p.jsx)("span",{className:"git-sub-item__name",title:t.name,children:t.name}),(0,p.jsx)("span",{className:"git-sub-item__meta",children:t.branch}),(0,p.jsx)("span",{className:"git-sub-item__ops",children:(0,p.jsx)(l.rA,{icon:"login",title:s("进入"),onClick:()=>{return s=t,void o(`${h.o.git_page}/${e}/${s.name}/`.replace(/\/+/g,"/"));var s}})})]},t.path))]})]})}const q=100;function G(){const{t:e}=(0,c.Bd)(),t=(0,z.y)(),s=(0,r.Zp)();let _=decodeURIComponent((0,d.GG)(h.o.git_page,(0,d.vX)()));_=_.replace(/\/+$/,"");const[g,u]=(0,a.useState)([]),[f,x]=(0,a.useState)([]),[j,N]=(0,a.useState)(!1),[v,b]=(0,a.useState)(!1),w=(0,a.useRef)(!1),[k,A]=(0,a.useState)({current:"",branches:[]}),[U,E]=(0,a.useState)(""),[W,G]=(0,a.useState)(new Set),[V,X]=(0,a.useState)("status"),[Z,J]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(20),[ee,te]=(0,a.useState)(!1),se=(0,a.useRef)(null),ae=(0,a.useRef)(null),[ie,ne]=(0,a.useState)(null),[ce,le]=(0,a.useState)("unified"),[oe,re]=(0,a.useState)({name:"",email:""}),[de,he]=(0,a.useState)(null),[me,_e]=(0,a.useState)(0),[ge,pe]=(0,a.useState)(null),[ue,fe]=(0,a.useState)(null),[xe,je]=(0,a.useState)(!1);(0,a.useEffect)(()=>{_&&ve().then(e=>{e&&(ye(),be(),we(),ke(),Ne())})},[_]);const Ne=async()=>{try{const e=await i.TU.post("conflicts",{path:_});0===e.code&&_e((e.data?.files||[]).length)}catch(e){}},ve=async()=>{try{J(!0);const e=await i.TU.post("status",{path:_});return 0===e.code&&(u(e.data||[]),je(!1),!0)}catch(e){const t="string"==typeof e?e:e?.message;return t&&t.includes("not a git repository")&&je(!0),!1}finally{J(!1)}},ye=async()=>{try{const e=await i.TU.post("log",{path:_,maxCount:q,skip:0});if(0===e.code){const t=e.data||[];x(t),N(t.length>=q)}}catch(e){}},be=async()=>{try{const e=await i.TU.post("branches",{path:_});0===e.code&&A(e.data||{current:"",branches:[]})}catch(e){}},we=async()=>{try{const e=await i.TU.post("get_user_config",{path:_});0===e.code&&re(e.data)}catch(e){}},ke=async()=>{try{const e=await i.TU.post("get_proxy",{path:_});0===e.code&&he(e.data)}catch(e){}},Se=async(t,s)=>{t.untracked?(0,n.zN)(e("未跟踪文件无差异")):ne({kind:"working",path:t.path,staged:s})},Ce=async()=>{const e=g.filter(e=>!e.staged);try{J(!0);const t=await i.TU.post("add",{path:_,files:e.map(e=>e.path)});if(0!==t.code)return void(0,n.zN)(t.message)}catch(e){return void(0,n.zN)(e?.message)}finally{J(!1)}await ze(!1)},ze=async t=>{try{J(!0);const s=await i.TU.post("commit",{path:_,message:U.trim(),allChanged:t});0===s.code?((0,n.SK)(e("提交成功")),E(""),ne(null),await ve(),ye()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},Ae=async(t=!1)=>{try{J(!0);const s=await i.TU.post("push",{path:_,force:t});0===s.code?(0,n.SK)(e("推送成功")):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},$e=async()=>{ne(null),await ve(),ye(),be()},Ue=(0,a.useCallback)(m.throttle(e=>{const t=parseFloat(getComputedStyle(ae.current).fontSize),s=window.innerWidth/t-4,a=e.clientX/t,i=2.25+se.current.offsetWidth/t;a<=s&&a>=i&&Y(parseFloat(a.toFixed(2)))},32),[]),Te=()=>{te(!1),ae.current.removeEventListener("pointermove",Ue)},Ke=_.split("/").filter(Boolean).pop()||_;return(0,p.jsxs)("div",{className:"studio",children:[(0,p.jsx)(o.A,{ignore_tags:!0,left_children:[(0,p.jsx)(l.rA,{title:e("取消"),icon:"close",onClick:()=>s(-1)},"close"),(0,p.jsx)("span",{children:Ke},"title")],children:(0,p.jsx)(l.rA,{icon:"refresh",title:e("刷新"),onClick:()=>{ve(),ye(),be(),we(),ke()}})}),xe?(0,p.jsx)("div",{className:"studio-body",children:(0,p.jsx)("div",{className:"studio-editor",children:(0,p.jsx)("div",{className:"git-main",children:(0,p.jsx)("div",{className:"git-card",children:(0,p.jsx)(L,{dir_path:_,on_changed:()=>{je(!1),ve(),ye(),be()}})})})})}):(0,p.jsxs)("div",{className:"studio-body",ref:ae,children:[(0,p.jsxs)("div",{className:"studio-nav studio-nav--git",style:{width:Q-1+"em"},children:[(0,p.jsx)("div",{className:"menu git-menu not-select-div",children:(0,p.jsx)("div",{className:"wrapper",children:(0,p.jsxs)("ul",{children:[(0,p.jsxs)("li",{className:"status"===V?"active":"",onClick:()=>X("status"),children:[e("变更")," (",g.length,")"]}),(0,p.jsxs)("li",{className:"log"===V?"active":"",onClick:()=>X("log"),children:[e("提交记录")," (",f.length,")"]})]})})}),"status"===V&&(0,p.jsx)("div",{className:"git-scroll",children:(0,p.jsx)(y,{files:g,selected:W,on_toggle:e=>{const t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(t)},on_toggle_all:(e,t)=>{const s=new Set(W);for(const a of e)t?s.add(a):s.delete(a);G(s)},active_path:"working"===ie?.kind?ie.path:null,on_view_diff:Se,on_stage_section:async(t,s)=>{if(0===t.length)return;const a=t.map(e=>e.path);try{const t=s?await i.TU.post("reset",{path:_,files:a}):await i.TU.post("add",{path:_,files:a});0===t.code?((0,n.SK)(e(s?"已取消暂存":"已暂存")),await ve()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},on_stage_one:async(e,t)=>{try{const s=t?await i.TU.post("reset",{path:_,files:[e.path]}):await i.TU.post("add",{path:_,files:[e.path]});0===s.code?(await ve(),"working"===ie?.kind&&ie.path===e.path&&Se(e,!t)):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}},on_view_blame:e=>{ne({kind:"blame",file:e.path})}})}),"log"===V&&(0,p.jsx)("div",{className:"git-scroll",children:(0,p.jsx)(C,{dir_path:_,entries:ge??f,is_search:null!==ge,has_more:j,loading_more:v,active_hash:"commit"===ie?.kind?ie.hash:null,on_select:e=>{ne({kind:"commit",hash:e})},on_scroll_bottom:e=>{if(null!==ge)return;const t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&(async()=>{if(!w.current&&j){w.current=!0,b(!0);try{const e=await i.TU.post("log",{path:_,maxCount:q,skip:f.length});if(0===e.code){const t=e.data||[];x(e=>[...e,...t]),N(t.length>=q)}}catch(e){}finally{w.current=!1,b(!1)}}})()},on_search_result:e=>{pe(e),null===e&&ye()}})})]}),(0,p.jsx)("div",{className:"studio__divider",ref:se,onPointerDown:()=>{te(!0),ae.current.addEventListener("pointermove",Ue)},onPointerUp:Te}),ee&&(0,p.jsx)("div",{className:"shell__overlay",onPointerUp:Te}),(0,p.jsx)("div",{className:"studio-editor",children:(0,p.jsxs)("div",{className:"git-main",children:[(0,p.jsx)(D,{dir_path:_,on_resolved:$e}),(0,p.jsxs)("div",{className:"git-card",children:[(0,p.jsx)(K,{current:k.current,branches:k.branches,on_checkout:async t=>{try{J(!0);const s=await i.TU.post("checkout",{path:_,branch:t});0===s.code?((0,n.SK)(e("切换分支成功")),await $e()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},on_create:async t=>{try{J(!0);const s=await i.TU.post("branch_create",{path:_,name:t});0===s.code?((0,n.SK)(e("分支创建成功")),await $e()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},on_delete:async(t,s)=>{try{J(!0);const a=await i.TU.post("branch_delete",{path:_,name:t,force:s});0===a.code?((0,n.SK)(e("分支删除成功")),await $e()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},on_merge:async t=>{try{J(!0);const s=await i.TU.post("merge",{path:_,branch:t});0===s.code?((0,n.SK)(e("合并成功")),await $e()):(0,n.zN)(s.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}},ahead:ue?.ahead,behind:ue?.behind}),(0,p.jsx)(M,{dir_path:_,current_branch:k.current,on_checkout:$e,on_compare:e=>ne({kind:"remote",branch:e})}),(0,p.jsx)("textarea",{className:"git-commit-input",placeholder:e("git_msg"),value:U,onChange:e=>E(e.target.value),rows:3}),(0,p.jsxs)("div",{className:"git-btn-row",children:[(0,p.jsx)(l.rA,{icon:"check",title:e("提交"),onClick:async()=>{if(!U.trim())return void(0,n.zN)(e("请输入提交信息"));if(0===g.filter(e=>e.staged).length){return 0===g.filter(e=>!e.staged).length?void(0,n.zN)(e("没有可提交的更改")):void t({title:e("提交"),sub_title:e("存在未暂存的改动,是否一并暂存并提交?"),confirm_fun:Ce})}await ze(!1)}}),(0,p.jsx)(l.rA,{icon:"edit_note",title:e("修改最后一次提交"),onClick:async()=>{try{J(!0);const t=await i.TU.post("commit_amend",{path:_,message:U});0===t.code?((0,n.SK)(e("已修改最后一次提交")),E(""),ne(null),await ve(),ye()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}}}),(0,p.jsx)(l.rA,{icon:"download",title:e("拉取"),onClick:async()=>{try{J(!0);const t=await i.TU.post("pull",{path:_});0===t.code?((0,n.SK)(e("拉取成功")),await ve(),ye()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{J(!1)}}}),(0,p.jsx)(l.rA,{icon:"upload",title:e("推送"),onClick:()=>Ae(!1)}),(0,p.jsx)(l.rA,{icon:"keyboard_double_arrow_up",title:e("强制推送"),onClick:()=>Ae(!0)}),(0,p.jsx)("span",{className:"git-btn-gap"}),(0,p.jsx)(l.rA,{icon:"inventory_2",title:e("暂存工作区"),onClick:async()=>{try{const t=await i.TU.post("stash",{path:_});0===t.code?((0,n.SK)(e("暂存工作区成功")),ne(null),await ve()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}}),(0,p.jsx)(l.rA,{icon:"unarchive",title:e("恢复工作区"),onClick:async()=>{try{const t=await i.TU.post("stash_pop",{path:_});0===t.code?((0,n.SK)(e("恢复工作区成功")),await ve()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}}})]}),(0,p.jsx)(I,{dir_path:_,on_changed:$e}),(0,p.jsx)(F,{dir_path:_,target_hash:"commit"===ie?.kind?ie.hash:void 0,on_changed:$e}),(0,p.jsx)(R,{dir_path:_,on_changed:$e})]}),ie?"commit"===ie.kind?(0,p.jsx)($,{dir_path:_,hash:ie.hash,on_close:()=>ne(null),on_changed:$e}):"blame"===ie.kind?(0,p.jsx)(T,{dir_path:_,file:ie.file,on_close:()=>ne(null)}):"remote"===ie.kind?(0,p.jsx)(P,{dir_path:_,branch:ie.branch,current_branch:k.current,on_close:()=>ne(null)}):(0,p.jsxs)("div",{className:"git-card git-card--diff",children:[(0,p.jsxs)("div",{className:"git-diff-header",children:[(0,p.jsx)("span",{className:"git-diff-header__badge",children:ie.staged?e("已暂存"):e("未暂存")}),(0,p.jsx)("span",{className:"git-diff-header__path",title:ie.path,children:ie.path}),(0,p.jsxs)("div",{className:"git-diff-header__modes",children:[(0,p.jsx)(l.rA,{icon:"view_agenda",title:e("单栏"),selected:"unified"===ce,onClick:()=>le("unified")}),(0,p.jsx)(l.rA,{icon:"view_column",title:e("并排"),selected:"split"===ce,onClick:()=>le("split")}),(0,p.jsx)(l.rA,{icon:"close",title:e("关闭"),onClick:()=>ne(null)})]})]}),ie.staged?(0,p.jsx)(S,{dir_path:_,file:ie.path,left_ref:"HEAD",right_ref:"staged",mode:ce}):(0,p.jsx)(S,{dir_path:_,file:ie.path,left_ref:"HEAD",right_ref:"worktree",mode:ce})]}):(0,p.jsx)("div",{className:"git-card git-card--placeholder",children:e("点击左侧文件查看差异")}),(0,p.jsxs)("div",{className:"git-card",children:[(0,p.jsx)(B,{dir_path:_,user_config:oe,proxy_config:de,on_user_config_saved:re,on_proxy_saved:he}),(0,p.jsx)(O,{dir_path:_,on_info_loaded:fe,on_changed:$e}),(0,p.jsx)(H,{dir_path:_})]})]})})]})]})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3659],{22081(e,n,t){
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3659],{22081(e,n,t){var s=t(96540),a=t(16349),i=t(74848);const r=({percentage:e})=>{const n=(0,s.useRef)(null),[t,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{const t=n.current.getContext("2d"),s=new a.Ay(t,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return r(s),()=>{s.destroy()}},[]),(0,s.useEffect)(()=>{t&&(t.data.datasets[0].data=[e,100-e],t.update())},[e]),(0,i.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,i.jsx)("canvas",{ref:n})})};t.d(n,["A",0,r])},88062(e,n,t){t(96540),t(47022);var s=t(74848);function a(e){return(0,s.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(n,e)},children:e.name})}const i=e=>(0,s.jsxs)("li",{children:[e.click?(0,s.jsx)(a,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,s.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,s.jsx)("ul",{children:e.node.children.map((n,t)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})]}),r=e=>(0,s.jsx)("div",{className:"card-tree-view",children:(0,s.jsx)("ul",{children:e.list&&e.list.map((n,t)=>(0,s.jsx)(i,{node:n,click:e.click,onContextMenu:e.onContextMenu,render:e.render},t))})});t.d(n,["A",0,r])},63659(e,n,t){t.r(n),t.d(n,{default:()=>N});var s=t(22022),a=t(96540),i=t(34843),r=t(82893),o=t(92275),d=t(14944),c=(t(14284),t(70447)),l=t(85997),u=t(62042),x=t(4412),h=t(75725),j=(t(22081),t(77481)),p=t(61443),m=t(47071),f=t(34289),v=t(88062),w=t(97856),_=t(88815),g=t(15629),k=t(74848);const y=a.lazy(()=>t.e(3233).then(t.bind(t,85614)));let b,C,S=-1;function N(e){const{t:n}=(0,s.Bd)(),[t,N]=(0,i.fp)(r.AG.workflow_show),[M,A]=(0,a.useState)([]),[F,$]=(0,a.useState)([]),[E,G]=(0,a.useState)(!1),[W,P]=(0,a.useState)(void 0),[q,z]=(0,a.useState)([]),[B,I]=(0,a.useState)(-1),[J,X]=(0,a.useState)(10),[O,D]=(0,a.useState)(0),[H,K]=(0,a.useState)(0),[Z,V]=(0,a.useState)(""),[Y,R]=(0,a.useState)(!1),T=[n("序号"),n("运行名称"),n("状态"),n("运行时长"),n("日期"),n("操作")],L=[n("名称"),n("状态"),n("cwd"),n("运行时长"),n("操作")],Q=async e=>{const n=new m._;n.page_num=e??B,n.page_size=J,n.dir_path=`${(0,f.GG)("file",(0,f.vX)())}`;const t=await d.ws.sendData(o.HK.workflow_get,n);if(!t)return;const s=t.context;s&&(A(s.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),D(s.total),K((0,_.gw)(s.total,J)))};(0,a.useEffect)(()=>(G(!1),b=void 0,C=void 0,S=-1,Q(),async()=>{C&&(C.dispose(),C=null)}),[]);const U=async e=>{const n=e.steps,t=[];(0,g.Y)(t,n??[]),z(t)},ee=async e=>{C||await new Promise(e=>{b=e,G(!0),(async()=>{const e=new w.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:"#000000",cursor:"#000000",selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});C=e,P(e)})()}),e&&(C.reset(),C.write(e))};return(0,k.jsxs)("div",{children:[(0,k.jsxs)(x.aZ,{position:"right",children:[W&&(0,k.jsx)(l.rA,{icon:"print",title:"打印日志",onClick:()=>{G(!E)}}),(0,k.jsx)(l.rA,{icon:"close",title:n("关闭"),onClick:()=>{N(!1)}})]}),(0,k.jsx)(h.jW,{isFull:!0,more:!0,children:(0,k.jsx)(h.NN,{children:(0,k.jsx)(h.xh,{children:(0,k.jsxs)(h.fI,{children:[(0,k.jsx)(h.VP,{children:(0,k.jsx)(c.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:n("历史记录")})}),titleCom:(0,k.jsx)("div",{className:" div-row ",children:(0,k.jsx)(p.Sm,{disabled:Y,value:Z,placeholder:"搜索运行名称(支持正则)",handleInputChange:e=>{V(Z)},handlerEnter:e=>{(async e=>{const n=new m._;n.search_name=e,n.dir_path=`${(0,f.GG)("file",(0,f.vX)())}`,R(!0);const t=await d.ws.sendData(o.HK.workflow_search_by_run_name,n);if(!t)return;const s=t.context;A(s.list.map(e=>{const n="string"==typeof e.meta?JSON.parse(e.meta):e.meta;return n.index=e.index,n})),D(s.total),K((0,_.gw)(s.total,J)),I(0),R(!1)})(e)}})}),rightBottomCom:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsxs)("span",{children:[Math.abs(B),"/",H]}),(0,k.jsx)(p.Sm,{placeholder:`max page ${H}`,handleInputChange:e=>{S=parseInt(e)},handlerEnter:()=>{if(S<1||S>H)return void(0,u.zN)("illegal page num");const e=0-S;I(e),Q(e)}}),(0,k.jsx)(l.rA,{icon:"navigate_before",onClick:()=>{const e=B+1;e>-1?(0,u.zN)("max page num"):(I(e),Q(e))},title:"上一页"}),(0,k.jsx)(l.rA,{icon:"navigate_next",onClick:()=>{const e=B-1;Math.abs(e)>H?(0,u.zN)("min page num"):(I(e),Q(e))},title:"下一页"})]}),children:(0,k.jsx)(j.X,{headers:T,rows:M.map((e,t)=>{let s;s=e.is_running?(0,k.jsxs)("div",{children:[(0,k.jsx)(c.fq,{}),n("正在运行")]}):(0,k.jsxs)("div",{children:[(0,k.jsx)(c.fq,{success:e.is_success}),e.is_success?n("成功"):n("失败")]});const a=[(0,k.jsx)("p",{children:e.index}),(0,k.jsx)("p",{style:{wordWrap:"break-word"},children:e["run-name"]}),s,(0,k.jsx)("span",{children:e.duration}),(0,k.jsx)("span",{children:e.timestamp}),(0,k.jsx)("div",{children:(0,k.jsx)(l.rA,{icon:"details",title:n("详情"),onClick:()=>{(async e=>{if(e.is_running)return;z([]);const n=new m._;n.index=e.index,n.dir_path=`${(0,f.GG)("file",(0,f.vX)())}`;const t=(await d.ws.sendData(o.HK.workflow_get,n)).context,s="string"==typeof t.one_data.data?JSON.parse(t.one_data.data):t.one_data.data;$(s.all_jobs)})(e)}})})];return a}),width:"10rem"})})}),(0,k.jsxs)(h.VP,{children:[(0,k.jsx)(c.Zp,{title:n("Job"),children:(0,k.jsx)(j.X,{headers:L,rows:F.map((e,t)=>[(0,k.jsx)("p",{children:e.name}),(0,k.jsx)(g.W,{item:e}),(0,k.jsx)(c.xP,{children:String(e.cwd)}),(0,k.jsx)("span",{children:e.duration}),(0,k.jsxs)("div",{children:[(0,k.jsx)(l.rA,{icon:"details",title:n("详情"),onClick:()=>{U(e)}}),!!e.message&&(0,k.jsx)(l.rA,{icon:"print",title:n("日志"),onClick:()=>{ee(e.message)}})]})]),width:"10rem"})}),(0,k.jsx)(c.Zp,{title:"Step",children:(0,k.jsx)(v.A,{list:q,click:e=>{(async e=>{if(e?.extra_data?.is_job)await U(e.extra_data.job_data);else if(e?.extra_data?.context)ee(e.extra_data.context);else{if(!e?.extra_data.code)return;ee(e.extra_data.code??"")}})(e)}})})]})]})})})}),(0,k.jsx)("div",{style:{display:E?"":"none"},children:(0,k.jsx)(y,{show:!0,terminal:W,init:()=>{b&&(b(1),b=void 0)}})})]})}},15629(e,n,t){t.d(n,{W:()=>o});t(96540);var s=t(70447),a=t(47071),i=t(22022),r=t(74848);function o({item:e}){const{t:n}=(0,i.Bd)();let t,o;return null!=e.code?t=0===e.code:e.extra_data?.running_type===a.rl.running&&(o=!0),(0,r.jsxs)("div",{children:[(0,r.jsx)(s.fq,{success:t,running:o}),n(t?"成功":"失败")]})}const d=(e,n,t)=>{if(n)for(const t of n??[]){let n;const a=[];t["use-yml"]?(d(a,void 0,t.use_job_children_list),n=`${t["use-yml"]} ;${t.duration??-1}`):t.runs?n=JSON.stringify(t.runs):t.run?n=t.run:t["run-js"]?n=t["run-js"]:t.sleep&&(n=`sleep ${t.sleep}`),n=(0,r.jsxs)("div",{children:[(0,r.jsx)(s.fq,{success:void 0===t.code?void 0:0===t.code})," ",n+" ;"+(t.duration??"")]}),e.push({name:n,children:a,extra_data:{code:t.code,context:t.message}})}else if(t)for(const n of t??[]){const t=(0,r.jsxs)("div",{children:[(0,r.jsx)(s.fq,{success:void 0===n.code?void 0:0===n.code}),"$",n.name]});e.push({name:t,extra_data:{code:n.code,is_job:!0,job_data:n}})}};t.d(n,["Y",0,d])}}]);
|