filecat 7.7.1 → 7.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/259.81bb9e049e5ef587a96f.js +1 -0
- package/build/dist/3233.fb6bffd5e097e4ac9423.js +1 -0
- package/build/dist/3299.9bd4cf5d1679479639a8.js +1 -0
- package/build/dist/4472.9e708dd3e1c9db7d7396.js +1 -0
- package/build/dist/5614.fb6bffd5e097e4ac9423.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.7a6fed9f5f814a194409.js +2 -0
- package/build/main.js +1 -1
- package/build/threads.work.filecat.js +1 -1
- package/package.json +1 -1
- package/shell/config/webpack.web.config.js +2 -2
- package/build/dist/3233.80bcbba8a50c0f85ceee.js +0 -1
- package/build/dist/4472.38816dfb835d527175d6.js +0 -1
- package/build/dist/5614.80bcbba8a50c0f85ceee.js +0 -1
- package/build/dist/5937.c3f14ccc441bfd06e13d.js +0 -1
- package/build/dist/8177.d669c6337f8814781f49.js +0 -1
- package/build/dist/main.401995af1fd441fa9164.js +0 -2
- /package/build/dist/{main.401995af1fd441fa9164.js.LICENSE.txt → main.7a6fed9f5f814a194409.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[259],{8694(e,t,a){a.d(t,{$K:()=>s,RB:()=>i,l5:()=>l,vo:()=>o,vr:()=>r});let n=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class s{open=!1;port;key="";async_ips=[]}class o{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=n.udp}let i=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class r{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class l{enabled;ip;port;bypass;useForLocal;type}},75007(e,t,a){a.d(t,{h:()=>o});a(96540);var n=a(85997),s=a(74848);function o(e){return(0,s.jsxs)("h2",{className:"message",children:[(0,s.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,s.jsx)("span",{children:e.context})]})}},47374(e,t,a){a.d(t,{e:()=>u});var n=a(96540),s=a(52671),o=a(64694),i=a(34289),r=a(61443),l=a(75725),d=a(22022),c=a(85997),p=a(74848);function u(e){let t=(0,s.zy)();const[a,u]=(0,n.useState)([]),[h,m]=(0,n.useState)("/"),[f,y]=(0,n.useState)(void 0),{t:_,i18n:x}=(0,d.Bd)();n.useEffect(()=>{let t="",a=(0,i.vX)().split("/");a=a.filter(e=>e);const n=a.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(a.slice(0,n),e.baseRoute);const i=a.slice(n+1);for(let e=0;e<i.length;e++){const a=i[e];s.push({value:a,href:0===e?`${t}${a}/`:(0,o.IO)(s[e-1].href,a)})}m(t),u(s)}},[t]);const v=t=>{t.stopPropagation(),e.clickFun(t)};return(0,p.jsx)("div",{className:"breadcrumbs",onClick:e=>{y(void 0!==f?void 0:"")},children:(0,p.jsx)(n.Fragment,{children:void 0===f?(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)("span",{className:"chevron",children:(0,p.jsx)(s.N_,{to:h,onClick:v,children:(0,p.jsx)(c.In,{icon:"home"})})}),a.map((e,t)=>(0,p.jsxs)("span",{className:"chevron",children:[(0,p.jsx)(c.In,{icon:"keyboard_arrow_right"}),(0,p.jsx)(s.N_,{to:e.href,onClick:v,children:decodeURIComponent(e.value)})]},t))]}):(0,p.jsx)(l.QM,{click:()=>{y(void 0)},children:(0,p.jsx)(r.Sm,{width:"100%",placeholder:_("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),y(void 0)}})})})})}},77481(e,t,a){a.d(t,{S:()=>r,X:()=>i});var n=a(96540),s=a(61443),o=a(74848);function i(e){const[t,a]=n.useState([]),i=(0,n.useRef)(-1),[r,l]=(0,n.useState)(-1),[d,c]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?a(Array.isArray(e.children)?e.children:[e.children]):a(e.rows)},[e.rows,e.children]);const p=()=>{i.current=-1,l(-1),c(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,a)=>{const n=!!e.filter&&(e.filter.column??0)===a;let i=t;if(n){const a=e.filter,n=a.options.find(e=>e.value===a.value);null!=a.value&&n&&(i=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},a)})})}),(0,o.jsx)("tbody",{children:t.map((t,a)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(r===a?"row-dragging":"")+(d===a?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=a,l(a),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(a))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,a=d;p(),t<0||a<0||t===a||e.onRowDrag?.(t,a)})())},onDragEnd:p,children:t.map((a,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:a},n)})},a)})})]})}function r(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},83029(e,t,a){a.d(t,{N:()=>x});var n=a(96540),s=a(34843),o=a(82893),i=a(74848);function r(e){const[t,a]=(0,s.fp)(o.AG.user_base_info);return(0,i.jsx)("div",{children:e.div?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,i.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var l=a(64694),d=a(61443),c=a(85997),p=a(52671),u=a(22022);const h=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,f,y=[];const _=[];function x(e){const[t,a]=(0,n.useState)([]),[x,v]=(0,n.useState)(-1),w=(0,p.zy)(),[g,j]=(0,n.useState)(!1),[k,b]=(0,n.useState)(!1),{t:N}=(0,u.Bd)(),[K,S]=(0,n.useState)([]),[C,A]=(0,s.fp)(o.AG.nav_index_add_item_by_now_list),F=e=>{-1!==x?_[x]._children=e:y=e};(0,n.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();y=t,a(y)})()},[w]);(0,n.useEffect)(()=>{if(C){const e=[...t,{name:"",color:(0,l.Lr)(h),...C}];F(e),a(e),j(!0),A(void 0)}},[C]);const D=e=>{v(x+1),a(e._children),_.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==x&&(0,i.jsx)(c.rA,{title:"返回",icon:"arrow_back",onClick:()=>{a(0===x?y:_[x-1]._children),v(x-1),_.pop()}}),t.map((s,o)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,o),onDrop:e=>((e,n)=>{e.preventDefault();const s=t[m],o=t[n];if(o&&"dir"===o._type){const e=[...t];return e.splice(m,1),o._children||(o._children=[]),o._children.push(s),F(e),void a(e)}const i=[...t],r=i[m];i.splice(m,1),i.splice(n,0,r),F(i),a(i)})(e,o),style:{cursor:g?"move":"pointer"},children:[(0,i.jsx)(r,{name:s.name,item:s,...s,div:g,target:"_blank",click_dir:D,clickItem:e.clickItem}),g&&(void 0!==K.find(e=>e===o)||k)&&(0,i.jsxs)("div",{className:k?"":" site_edit ",children:["dir"===s._type?(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(d.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:N("输入类目名"),no_border:!0}),(0,i.jsx)(d.Sm,{value:s.color,handleInputChange:e=>{s.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(d.Sm,{value:s[e.key],handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!k&&(0,i.jsx)(c.C3,{text:N("折叠"),clickFun:()=>{S((0,l.P1)(K,o))}})]}),g&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(c.C3,{text:N("删除"),clickFun:()=>{(e=>{const n=[...t];n.splice(e,1),F(n),a(n)})(o)}}),(0,i.jsx)(c.C3,{text:N("编辑"),clickFun:()=>{void 0===K.find(e=>e===o)&&S([...K,o])}})]})})]},o)),g&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(c.rA,{title:N("取消"),icon:"cancel",onClick:()=>{S([]),j(!1),f&&(a(f),F(f)),b(!1)}}),(0,i.jsx)(c.rA,{title:N("添加"),icon:"add",onClick:async()=>{const n=[...t,{name:"",color:(0,l.Lr)(h),...e.get_pre_add_item&&await e.get_pre_add_item()}];F(n),a(n)}}),(0,i.jsx)(c.rA,{title:N("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];F(e),a(e)}}),(0,i.jsx)(c.rA,{title:N("全部编辑"),icon:k?"unfold_less":"unfold_more",onClick:()=>{b(!k)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(c.rA,{icon:g?"save":"edit",title:N(g?"保存":"编辑"),onClick:async()=>{g?e.save&&await e.save(y):f=t,j(!g)}})]})}},259(e,t,a){a.r(t),a.d(t,{default:()=>_e});var n=a(96540),s=a(70447),o=a(75725),i=a(61443),r=a(22022),l=a(34843),d=a(82893),c=a(85997),p=a(77481),u=a(14284),h=a(62042),m=a(45907),f=a(23496),y=a(53459),_=a(78247),x=a(23430),v=a(74848);function w(){const{t:e}=(0,r.Bd)(),t=(0,m.y)(),{check_user_auth:a}=(0,_.MH)(),w=a(x.oV.browser_proxy_edit),[,g]=(0,l.fp)(d.AG.prompt_card),[j,k]=(0,n.useState)([]),[b,N]=(0,n.useState)(!1),[K,S]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[F,D]=(0,n.useState)(""),[L,M]=(0,n.useState)(""),I=[e("状态"),e("备注"),e("目标"),e("端口"),e("访问地址"),e("操作")],B=async()=>{try{const e=await u.s2.get(f.s.browser_proxy_port_list);e.code===y.m.Success&&k(Array.isArray(e.data)?e.data:[])}catch(e){}};(0,n.useEffect)(()=>{B()},[]);const P=e=>{A(e?.id??""),D(e?`${e.proto}://${e.host}${e.root_path&&"/"!==e.root_path?e.root_path:""}`:""),M(e?.note??"")},R=()=>{N(!1),S(!1),P(void 0)},E=e=>`http://${window.location.hostname||"127.0.0.1"}:${e.port}/`,$=e=>{const t=localStorage.getItem("token")||"";return`${E(e)}${t?`?_t=${encodeURIComponent(t)}`:""}`};return(0,v.jsxs)(o.fI,{children:[(0,v.jsx)(o.VP,{widthPer:w?55:100,maxWidth:w?"90rem":void 0,children:(0,v.jsx)(o.xh,{children:(0,v.jsx)(s.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("网页代理目标")}),(0,v.jsx)(c.rA,{icon:"info",title:e("信息"),onClick:()=>{g({open:!0,title:e("信息"),context_div:(0,v.jsx)("div",{children:(0,v.jsxs)("ul",{children:[(0,v.jsx)("li",{children:e("wbvpn_port_tip")}),(0,v.jsx)("li",{children:e("wbvpn_port_tip2")}),(0,v.jsx)("li",{children:e("wbvpn_port_tip3")})]})})})}})]}),titleCom:(0,v.jsx)("div",{children:w&&!K&&(0,v.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{N(!0),S(!0),P(void 0)}})}),children:(0,v.jsx)(p.X,{headers:I,rows:j.map(a=>{const n=[(0,v.jsx)(c.Ay,{checked:!1!==a.enabled,disabled:!w,title:e("启用"),onChange:t=>(async(t,a)=>{try{await u.s2.post(f.s.browser_proxy_port_set_enabled,{id:t.id,enabled:a}),(0,h.SK)(e(a?"已启用":"已禁用")),await B()}catch(e){}})(a,t)}),(0,v.jsx)(s.xP,{children:a.note||"-"}),(0,v.jsx)(s.xP,{children:`${a.proto}://${a.host}`}),(0,v.jsx)(s.xP,{children:String(a.port)}),(0,v.jsx)(s.xP,{children:E(a)}),(0,v.jsxs)("div",{children:[(0,v.jsx)(c.rA,{icon:"open_in_new",title:e("新窗口打开"),onClick:()=>(e=>{window.open($(e),"_blank","noopener,noreferrer")})(a)}),(0,v.jsx)(c.rA,{icon:"tab",title:e("当前窗口打开"),onClick:()=>(e=>{window.location.href=$(e)})(a)}),(0,v.jsx)(c.rA,{icon:"content_copy",title:e("复制"),onClick:()=>(async t=>{const a=E(t);try{await navigator.clipboard.writeText(a),(0,h.SK)(e("已复制"))}catch(e){(0,h.zN)(a)}})(a)}),w&&(0,v.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{N(!1),S(!0),P(e)})(a)}),w&&(0,v.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>(a=>{t({title:e("确认删除"),sub_title:a.host,confirm_fun:async()=>{try{await u.s2.post(f.s.browser_proxy_port_remove,{id:a.id}),(0,h.SK)(e("已删除")),await B()}catch(e){}}})})(a)})]})];return n}),width:"10rem"})})})}),w&&K&&(0,v.jsx)(o.VP,{widthPer:45,maxWidth:"40rem",children:(0,v.jsx)(o.xh,{children:(0,v.jsxs)(s.Zp,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(c.rA,{icon:"cancel",title:e("取消"),onClick:R}),(0,v.jsx)(c.rA,{icon:b?"add_circle":"save",title:e(b?"添加":"保存"),onClick:async()=>{if(F.trim())try{b?(await u.s2.post(f.s.browser_proxy_port_add,{address:F.trim(),note:L}),(0,h.SK)(e("添加成功"))):(await u.s2.post(f.s.browser_proxy_port_update,{id:C,address:F.trim(),note:L}),(0,h.SK)(e("修改成功"))),R(),await B()}catch(e){}else(0,h.zN)(e("目标地址不能为空"))}})]}),children:[(0,v.jsx)("label",{children:e("目标地址")}),(0,v.jsx)(i.Sm,{value:F,placeholder:e("目标地址例如"),handleInputChange:e=>D(e)}),(0,v.jsx)("label",{children:e("备注")}),(0,v.jsx)(i.Sm,{value:L,handleInputChange:e=>M(e)})]})})})]})}function g(e){return(0,v.jsx)(w,{})}var j=a(34289),k=a(4412),b=(a(75007),a(83029)),N=a(97856),K=a(92275),S=a(14944),C=a(64405);const A=n.lazy(()=>Promise.all([a.e(4924),a.e(5614)]).then(a.bind(a,85614)));function F(e){const[t,a]=(0,n.useState)(null),[s,o]=(0,l.fp)(d.AG.remoteShellShow),[i,r]=(0,n.useState)(!1),[c,p]=(0,l.fp)(d.AG.sshInfo),[u,h]=(0,l.fp)(d.AG.shellNowDir),[m,f]=(0,l.fp)(d.AG.user_base_info),y=m.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",_=()=>{(async()=>{t&&(t.dispose(),a(null))})()};(0,n.useEffect)(()=>()=>{_()},[]),(0,n.useEffect)(()=>{s.show?t||((async()=>{const e=new N.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:y,cursor:y,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let t;const n=t=>{e.write(t)};t=a=>{e.clear(),e.write(a),t=n},S.ws.addMsg(K.HK.remote_shell_getting,e=>{t(e.context)}),e.onData(async e=>{const t=new C.x;t.key=c.key,t.cmd=e;const a=new K.hf(K.HK.remote_shell_send);a.context=t,await S.ws.send(a)}),a(e)})(),r(!0)):_()},[s]);return(0,v.jsx)(A,{show:s.show,terminal:t,init:(e,a)=>{t.writeln("[38;2;29;153;243mopen shell...[0m ");const n=new K.hf(K.HK.remote_shell_open),o=new C.x;o.key=c.key,o.init_path=s.path,o.rows=e,o.cols=a,n.context=o,S.ws.send(n)}})}var D=a(47374),L=a(52671),M=a(99214),I=a(47022),B=a(88815),P=a(6960),R=a(79240),E=a(83529),$=a(12730);function G(e){const{t}=(0,r.Bd)();(0,L.zy)();(0,L.Zp)();const{check_user_auth:a}=(0,_.MH)(),[s,o]=(0,l.fp)(d.AG.nowFileList),[i,p]=(0,l.fp)(d.AG.uploadFiles),[u,m]=(0,l.fp)(d.AG.showPrompt),[f,y]=(0,l.fp)(d.AG.selectedFileList),[x,w]=(0,l.fp)(d.AG.enterKey),[g,k]=(0,l.fp)(d.AG.copyedFileList),[b,N]=(0,l.fp)(d.AG.cutedFileList),[K,S]=(0,l.fp)(d.AG.selectedFileList),[C,A]=(0,l.fp)(d.AG.clickFileList),[F,D]=(0,l.fp)(d.AG.remoteShellShow),[B,P]=(0,l.fp)(d.AG.sshInfo),R=(0,M.Vs)();function G(e){(0,h.SK)(e)}return(0,v.jsxs)(n.Fragment,{children:[f.length>0&&(0,v.jsx)(c.rA,{icon:"delete",title:t("删除"),onClick:()=>{m({show:!0,type:E.PromptEnum.SshDelete,overlay:!0,data:{}})}}),f.length>0&&(0,v.jsx)(c.rA,{icon:"content_copy",title:t("复制"),onClick:function(){const e=(0,M.ib)(s,f);k(e.map(e=>`/${(0,j.GG)("remoteShell",(0,j.vX)())}${e.name}`)),N([]),G("已复制")}}),f.length>0&&(0,v.jsx)(c.rA,{icon:"content_cut",title:t("剪切"),onClick:function(){const e=(0,M.ib)(s,f);N(e.map(e=>`/${(0,j.GG)("remoteShell",(0,j.vX)())}${e.name}`)),k([]),G("已剪切")}}),(g.length>0||b.length>0)&&(0,v.jsx)(c.rA,{onClick:function(){m({show:!0,type:E.PromptEnum.SshPaste,overlay:!0,data:{}})},icon:"content_paste",title:t("粘贴到此处"),tip:g.length+b.length}),1===f.length&&s.files.length>=1&&(0,M.ib)(s,f)[0].type!==I.Iw.folder&&(0,v.jsx)(c.rA,{icon:"download",title:t("下载"),onClick:function(){const e=(0,M.ib)(s,f),t=`/api/ssh/download?file=${`/${(0,j.GG)("remoteShell",(0,j.vX)())}${decodeURIComponent(e[0].name)}`}&key=${B.key}&token=${localStorage.getItem("token")}`;window.open(t)}}),1===f.length&&(0,v.jsx)(c.rA,{icon:"edit_attributes",title:t("重命名"),onClick:function(){m({show:!0,type:E.PromptEnum.SshReName,overlay:!0,data:{}})}}),(0,v.jsx)(c.rA,{icon:"terminal",title:"shell",onClick:function(){F.show?D({show:!1,path:""}):D({show:!0,path:`/${(0,j.GG)("remoteShell",(0,j.vX)())}`})}}),(0,v.jsx)(c.rA,{icon:"grid_view",title:t("切换样式"),onClick:R}),(0,v.jsx)(c.rA,{icon:"create_new_folder",title:t("创建文件夹"),onClick:function(){m({show:!0,type:E.PromptEnum.SshNewDir,overlay:!0,data:{}})}}),(0,v.jsx)(c.rA,{icon:"note_add",title:t("创建文本文件"),onClick:function(){m({show:!0,type:E.PromptEnum.SshNewFile,overlay:!0,data:{}})}}),(0,v.jsx)(c.rA,{icon:"upload_file",title:"上传",onClick:()=>{m({show:!0,type:E.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let a=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],i=a?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=i,a&&s.add((0,$.S)(i)),n.push(o)}const o=[];if(a)for(const e of Array.from(s))o.push({isDir:!0,fullPath:e,name:e});o.push(...n),p(o),m({show:!0,type:E.PromptEnum.SshUpload,overlay:!1,data:{}})}}})}}),(0,v.jsx)(c.rA,{icon:"close",title:t("关闭"),onClick:()=>{e.close()}})]})}var O=a(60096),H=a(21499);let T;function z(e){const{t}=(0,r.Bd)(),a=(0,L.zy)(),[s,o]=(0,l.fp)(d.AG.nowFileList),[c,p]=(0,l.fp)(d.AG.selectedFileList),[m,f]=(0,l.fp)(d.AG.clickFileList),[_,w]=(0,l.fp)(d.AG.sshInfo),[g,b]=(0,n.useState)(""),N=(0,L.Zp)(),[K,S]=(0,l.fp)(d.AG.user_base_info),A=async e=>{const t=new C.x;t.key=_.key,t.dir=e||`/${(0,j.GG)("remoteShell",(0,j.vX)())}`;const a=await u.Fg.post("get/dir",t);if(a.code!==y.m.Success)return void(0,h.zN)("连接失败");const{folders:n,files:s}=a.data||{};for(const e of s??[])e.origin_size=e.size,e.size=(0,B.v7)(e.size),K.user_data.file_time_show_type===x.KD.time?e.show_mtime=e.mtime?(0,H.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,P.s)(e.mtime):"";for(const e of n??[])K.user_data.file_time_show_type===x.KD.time?e.show_mtime=e.mtime?(0,H.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,P.s)(e.mtime):"";const i={folders:n||[],files:s||[]};(0,M.yC)(i,K.user_data.dir_show_type),o(i),T=i};function I(){p([]),f([])}(0,n.useEffect)(()=>{I(),(async()=>{await A()})()},[a]);return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(k.aZ,{children:(0,v.jsx)(i.$Z,{handleEnterPress:()=>{if(!T)return;p([]),f([]);const e=[],t=[];for(const t of T.files??[])t.name.includes(g)&&e.push(t);for(const e of T.folders??[])e.name.includes(g)&&t.push(e);o({files:e,folders:t})},placeholder:t("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{b(e)},max_width:"25em"})}),(0,v.jsx)(k.aZ,{position:"right",children:(0,v.jsx)(G,{close:e.close})}),(0,v.jsx)(D.e,{baseRoute:"remoteShell",clickFun:I,input_path_enter:e=>{(0,R.Z1)(e)?A(e):N((0,R.Jn)((0,j.vX)(),e)),p([]),f([]),o({files:[],folders:[]})}}),(0,v.jsx)(O.Ic,{handleContextMenu:()=>{},clickBlank:e=>{e.target===e.currentTarget&&p([])},file_list:s.files,folder_list:s.folders,fileHandler:A}),(0,v.jsx)(F,{})]})}function U(e){const{t}=(0,r.Bd)(),a=(0,L.Zp)(),[s,o]=(0,n.useState)(""),[p,m]=(0,n.useState)(""),[f,w]=(0,n.useState)(""),[g,j]=(0,n.useState)(""),[N,K]=(0,n.useState)(void 0),[S,A]=(0,n.useState)(""),[F,D]=(0,l.fp)(d.AG.shellNowDir),[M,I]=(0,l.fp)(d.AG.sshInfo),{check_user_auth:B}=(0,_.MH)(),P=async e=>{const t=new C.x;if(t.password=e?e.password:p,t.domain=e?e.domain:g,t.port=e?e.port:N,t.username=e?e.username:s,t.private_path=e?e.private_path:f,t.dir=e?e.dir:S,!t.dir)return void(0,h.zN)("dir not found");if(!t.username)return void(0,h.zN)("username not found");if(!t.domain)return void(0,h.zN)("domain not found");if(!t.port)return void(0,h.zN)("port not found");if(!t.private_path&&!t.password)return void(0,h.zN)("private_path password not found");const n=await u.Fg.post("start",t);n&&n.code===y.m.Success&&(a((0,R.Jn)("/proxy/remoteShell",t.dir)),D([t.dir]),I(n.data))};return(0,v.jsxs)(n.Fragment,{children:[!M.key&&(0,v.jsxs)(k.aZ,{position:"right",children:[(0,v.jsx)(i.$Z,{placeholder:t("目录"),icon:"home",value:S,handleInputChange:e=>A(e),max_width:"15rem"}),(0,v.jsx)(i.$Z,{placeholder:t("账号"),icon:"verified_user",value:s,handleInputChange:e=>o(e),max_width:"15rem"}),(0,v.jsx)(i.$Z,{type:"password",placeholder:t("密码"),icon:"password",value:p,handleInputChange:e=>m(e),max_width:"15rem"}),(0,v.jsx)(i.$Z,{placeholder:t("私钥路径"),icon:"private_connectivity",value:f,handleInputChange:e=>w(e),max_width:"15rem"}),(0,v.jsx)(i.$Z,{placeholder:t("连接地址"),icon:"location_on",value:g,handleInputChange:e=>{j(e)},max_width:"15rem"}),(0,v.jsx)(i.$Z,{placeholder:t("端口"),icon:"outlet",value:N,handleInputChange:e=>{if(!e)return;/^\d+$/.test(e)||(0,h.zN)("不是数字"),K(parseInt(e))},max_width:"7rem"}),(0,v.jsx)(c.rA,{icon:"play_arrow",title:t("连接"),onClick:()=>{P()}})]}),M.key?(0,v.jsx)(z,{close:async()=>{const e=new C.x;e.key=M.key;await u.Fg.post("close",e);I({})},data:{port:N,password:p,username:s,domain:g,dir:S}}):(0,v.jsx)(b.N,{have_auth_edit:B(x.oV.ssh_proxy_tag_update),getItems:async()=>{const e=await u.Fg.get("tag");return e.code===y.m.Success?e.data:[]},save:async e=>{await u.Fg.post("tag/save",e)},clickItem:async e=>{j(e.domain),A(e.dir),K(e.port),o(e.username),m(e.password),w(e.private_path),await P(e)},items:[{key:"name",preName:t("名字")},{key:"domain",preName:t("地址")},{key:"port",preName:t("端口")},{key:"username",preName:t("账号")},{key:"password",preName:t("密码")},{key:"private_path",preName:t("私钥路径")},{key:"dir",preName:t("访问目录")},{key:"color",preName:"color"}]})]})}function V(e){switch(e){case 0:return 1;case 2:return 2;default:return 0}}class Z{constructor(e){this.canvas=e,this.render=new Q.Canvas.create(this.canvas),this.activeSession=!1,this.install()}close(){this.activeSession=!1}install(){var e=this;return this.canvas.addEventListener("mousemove",function(t){var a=Q.elementOffset(e.canvas);return S.ws.sendData(K.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:0,isPressed:!1}),t.preventDefault||e.activeSession(),!1}),this.canvas.addEventListener("mousedown",function(t){var a=Q.elementOffset(e.canvas);return S.ws.sendData(K.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:V(t.button),isPressed:!0}),t.preventDefault(),!1}),this.canvas.addEventListener("mouseup",function(t){if(e.activeSession){var a=Q.elementOffset(e.canvas);return S.ws.sendData(K.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:V(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("contextmenu",function(t){if(e.activeSession){var a=Q.elementOffset(e.canvas);return S.ws.sendData(K.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:V(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("DOMMouseScroll",function(t){if(e.activeSession){var a=t.detail,n=Math.round(15*Math.abs(a)/8),s=Q.elementOffset(e.canvas);return S.ws.sendData(K.HK.wheel,{x:t.clientX-s.left,y:t.clientY-s.top,step:n,isNegative:a>0,isHorizontal:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("mousewheel",function(t){if(e.activeSession){var a=Math.abs(t.deltaX)>Math.abs(t.deltaY),n=a?t.deltaX:t.deltaY,s=Math.round(15*Math.abs(n)/8),o=Q.elementOffset(e.canvas);return S.ws.sendData(K.HK.wheel,{x:t.clientX-o.left,y:t.clientY-o.top,step:s,isNegative:n>0,isHorizontal:a}),t.preventDefault(),!1}}),window.addEventListener("keydown",function(t){if(e.activeSession)return S.ws.sendData(K.HK.scancode,{code:Q.scancode(t),isPressed:!0}),t.preventDefault(),!1}),window.addEventListener("keyup",function(t){if(e.activeSession)return S.ws.sendData(K.HK.scancode,{code:Q.scancode(t),isPressed:!1}),t.preventDefault(),!1}),this}connect(e,t,a,n,s,o){var i=this;S.ws.addMsg(K.HK.rdp_connect,e=>{console.log("[mstsc.js] connected"),i.activeSession=!0}),S.ws.addMsg(K.HK.rdp_bitmap,e=>{const t=e.context;t.data=e.bin_context,i.render.update(t)}),S.ws.addMsg(K.HK.rdp_close,e=>{o(null),console.log("[mstsc.js] close"),i.activeSession=!1}),S.ws.addMsg(K.HK.rdp_error,e=>{i.activeSession=!1});const r=new K.hf;r.cmdType=K.HK.infos,r.context={ip:e.indexOf(":")>-1?e.split(":")[0]:e,port:a,screen:{width:this.canvas.width,height:this.canvas.height},domain:t,username:n,password:s,locale:Q.locale()},S.ws.send(r)}}class J{constructor(e){this.canvas=e,this.ctx=e.getContext("2d")}update(e){var t=null;t=e.isCompress?function(e){var t=null;switch(e.bitsPerPixel){case 15:t="bitmap_decompress_15";break;case 16:t="bitmap_decompress_16";break;case 24:t="bitmap_decompress_24";break;case 32:t="bitmap_decompress_32";break;default:throw"invalid bitmap data format"}var a=new Uint8Array(e.data),n=Module._malloc(a.length),s=new Uint8Array(Module.HEAPU8.buffer,n,a.length);s.set(a);var o=e.destRight-e.destLeft+1,i=e.destBottom-e.destTop+1,r=o*i*4,l=Module._malloc(r),d=new Uint8Array(Module.HEAPU8.buffer,l,r),c=(Module.ccall(t,"number",["number","number","number","number","number","number","number","number"],[d.byteOffset,o,i,e.width,e.height,s.byteOffset,a.length]),new Uint8ClampedArray(d.buffer,d.byteOffset,r));return Module._free(n),Module._free(l),{width:o,height:i,data:c}}(e):function(e){return{width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)}}(e);var a=this.ctx.createImageData(t.width,t.height);a.data.set(t.data),this.ctx.putImageData(a,e.destLeft,e.destTop)}}var X={"":0,Escape:1,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,Minus:12,Equal:13,Backspace:14,Tab:15,KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,BracketLeft:26,BracketRight:27,Enter:28,ControlLeft:29,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,Semicolon:39,Quote:40,Backquote:41,ShiftLeft:42,Backslash:43,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Comma:51,Period:52,Slash:53,ShiftRight:54,NumpadMultiply:55,AltLeft:56,Space:57,CapsLock:58,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,Pause:69,ScrollLock:70,Numpad7:71,Numpad8:72,Numpad9:73,NumpadSubtract:74,Numpad4:75,Numpad5:76,Numpad6:77,NumpadAdd:78,Numpad1:79,Numpad2:80,Numpad3:81,Numpad0:82,NumpadDecimal:83,PrintScreen:84,IntlBackslash:86,F11:87,F12:88,NumpadEqual:89,F13:100,F14:101,F15:102,F16:103,F17:104,F18:105,F19:106,F20:107,F21:108,F22:109,F23:110,KanaMode:112,Lang2:113,Lang1:114,IntlRo:115,F24:118,Convert:121,NonConvert:123,IntlYen:125,NumpadComma:126,MediaTrackPrevious:57360,MediaTrackNext:57369,NumpadEnter:57372,ControlRight:57373,VolumeMute:57376,LaunchApp2:57377,MediaPlayPause:57378,MediaStop:57380,VolumeDown:57390,VolumeUp:57392,BrowserHome:57394,NumpadDivide:57397,PrintScreen:57399,AltRight:57400,NumLock:57413,Pause:57414,Home:57415,ArrowUp:57416,PageUp:57417,ArrowLeft:57419,ArrowRight:57421,End:57423,ArrowDown:57424,PageDown:57425,Insert:57426,Delete:57427,OSLeft:57435,OSRight:57436,ContextMenu:57437,Power:57438,BrowserSearch:57445,BrowserFavorites:57446,BrowserRefresh:57447,BrowserStop:57448,BrowserForward:57449,BrowserBack:57450,LaunchApp1:57451,LaunchMail:57452,MediaSelect:57453},Y={27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",192:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",173:"Minus",61:"Equal",8:"Backspace",9:"Tab",81:"KeyQ",87:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",219:"BracketLeft",221:"BracketRight",13:"Enter",20:"CapsLock",65:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",59:"Semicolon",222:"Quote",220:"Backslash",16:"ShiftLeft",220:"IntlBackslash",90:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",77:"KeyM",188:"Comma",190:"Period",191:"Slash",16:"ShiftRight",17:"ControlLeft",18:"AltLeft",91:"OSLeft",32:"Space",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",13:"NumpadEnter",96:"Numpad0",110:"NumpadDecimal",17:"ControlLeft"},q={firefox:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",169:"Minus",61:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",160:"BracketLeft",164:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",165:"Quote",170:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",59:"Comma",58:"Period",161:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:Y},chrome:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",219:"Minus",187:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",221:"BracketLeft",186:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",192:"Quote",220:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",190:"Comma",191:"Period",223:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:Y}};function W(){}W.prototype={$:function(e){return document.getElementById(e)},elementOffset:function(e){for(var t=0,a=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-e.scrollLeft,a+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:a,left:t}},browser:function(){return"undefined"!=typeof InstallTrigger?"firefox":window.chrome?"chrome":document.docuemntMode?"ie":null},locale:function(){return window.navigator.userLanguage||window.navigator.language},client:{create:function(e){return new Z(e)}},Canvas:{create:function(e){return new J(e)}},scancode(e){var t=W.prototype.locale();return t=["fr","en"].indexOf(t)>0&&t||"en",X[e.code||q[W.prototype.browser()||"firefox"][t][e.keyCode]]}};let Q=new W;var ee=a(38240);let te;function ae(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(d.AG.header_min),{check_user_auth:s}=(0,_.MH)(),[p,m]=(0,n.useState)(void 0),[f,w]=(0,n.useState)(3389),[g,j]=(0,n.useState)(void 0),[N,C]=(0,n.useState)(void 0),[A,F]=(0,n.useState)(!1),[D,L]=(0,n.useState)(!1);var M=null;(0,n.useEffect)(()=>(te||(async()=>{try{await(0,ee.J)("rle.js"),te=!0}catch(e){return void(0,h.zN)("加载资源失败")}})(),()=>{M&&(M.close(),M=null)}),[]);const I=t=>{L(!0),function(n,s,o,i){if(n=n||t.address,o=o||t.username,i=i||t.password,!n||!o)return(0,h.zN)(e("ip或者账号不允许为空")),void L(!1);!function(e){M||(M=Q.client.create(Q.$(e)))}("rdpwebview");var r=Q.$("rdpwebview");r.style.display="inline",r.width=window.innerWidth,r.height=window.innerHeight,F(!0),a(!0),M.connect(n,"",s,o,i,function(e){Q.$("rdpwebview").style.display="none",a(!1),L(!1),F(!1)})}(p,f,g,N)};return(0,v.jsxs)("div",{children:[(0,v.jsxs)(k.aZ,{position:"right",children:[(0,v.jsx)(i.$Z,{placeholder:e("地址"),icon:"network_ping",value:p,max_width:"15rem",handleInputChange:e=>m(e)}),(0,v.jsx)(i.$Z,{placeholder:e("端口"),icon:"outlet",value:f,max_width:"10rem",handleInputChange:e=>{e&&w(parseInt(e))}}),(0,v.jsx)(i.$Z,{placeholder:e("账号"),icon:"manage_accounts",value:g,max_width:"15rem",handleInputChange:e=>j(e)}),(0,v.jsx)(i.$Z,{placeholder:e("密码"),icon:"password",value:N,max_width:"15rem",handleInputChange:e=>C(e)}),!D&&(0,v.jsx)(c.rA,{icon:"play_arrow",title:e("连接"),onClick:I}),D&&(0,v.jsx)(c.rA,{icon:"close",title:e("关闭"),onClick:async()=>{F(!1),await S.ws.sendData(K.HK.rdp_disconnect,"");var e=Q.$("rdpwebview");e.getContext("2d").clearRect(0,0,e.width,e.height),Q.$("rdpwebview").style.display="none",L(!1),a(!1)}})]}),(0,v.jsxs)(o.jW,{isFull:A,children:[!D&&(0,v.jsx)(b.N,{have_auth_edit:s(x.oV.rdp_proxy_tag_update),getItems:async()=>{const e=await u.J0.get("tag");return e.code===y.m.Success?e.data:[]},save:async e=>{(await u.J0.post("tag/save",e)).code!==y.m.Success&&(0,h.zN)("网络错误")},clickItem:async e=>{C(e.password),j(e.username),m(e.address),w(e.port),I(e)},items:[{key:"name",preName:e("名字")},{key:"address",preName:e("地址")},{key:"port",preName:e("端口")},{key:"username",preName:e("账号")},{key:"password",preName:e("密码")},{key:"color",preName:"color"}]}),(0,v.jsx)("canvas",{id:"rdpwebview",style:{display:"none"}})]})]})}var ne=a(40505),se=a(8694),oe=a(67331);const ie=(0,n.createContext)({activeKey:"",setActiveKey:()=>{}});function re(e){const{children:t,activeKey:a,defaultActiveKey:s,onChange:o,width:i}=e,[r,l]=(0,n.useState)(()=>a??s??"");(0,n.useEffect)(()=>{void 0!==a&&l(a)},[a]);const d=e=>{void 0===a&&l(e),o&&o(e)},c=[];return n.Children.forEach(t,e=>{n.isValidElement(e)&&e.type===le&&c.push({key:e.props.itemKey,tab:e.props.tab,disabled:e.props.disabled})}),(0,n.useEffect)(()=>{!r&&c.length>0&&l(c[0].key)},[c,r]),(0,v.jsx)(ie.Provider,{value:{activeKey:r,setActiveKey:d},children:(0,v.jsxs)("div",{className:"modern-tabs-container",style:{width:i||"100%"},children:[(0,v.jsx)("div",{className:"modern-tabs-nav",children:c.map(e=>{const t=["modern-tabs-tab",r===e.key?"active":"",e.disabled?"disabled":""].filter(Boolean).join(" ");return(0,v.jsx)("div",{className:t,onClick:()=>!e.disabled&&d(e.key),children:e.tab},e.key)})}),(0,v.jsx)("div",{className:"modern-tabs-content",children:t})]})})}function le(e){const{itemKey:t,children:a}=e,{activeKey:s}=(0,n.useContext)(ie),o=s===t;return(0,v.jsx)("div",{className:"modern-tab-panel "+(o?"active":""),children:a})}const de=n.lazy(()=>Promise.all([a.e(2543),a.e(4091)]).then(a.bind(a,84091)));let ce,pe,ue,he;function me(){const{t:e}=(0,r.Bd)(),[t,a]=(0,l.fp)(d.AG.confirm),[m,f]=(0,l.fp)(d.AG.showPrompt),{check_user_auth:w}=(0,_.MH)(),[g,j]=(0,n.useState)(""),[k,N]=(0,l.fp)(d.AG.router_jump),[C,A]=(0,n.useState)("get"),[F,D]=(0,n.useState)(""),[L,M]=(0,n.useState)(void 0),[I,P]=(0,n.useState)([]),[R,$]=(0,n.useState)([]),[G,O]=(0,n.useState)("headers"),[T,z]=(0,n.useState)(String(se.RB.row)),[U,V]=(0,n.useState)("body"),[Z,J]=(0,n.useState)(),[X,Y]=(0,l.fp)(d.AG.nav_index_add_item_by_now_list),[q,W]=(0,l.fp)(d.AG.prompt_card);_.xK.set_value_temp("{}",0),_.xK.set_value_temp("",1),(0,n.useEffect)(()=>(ce={},pe="",ue="",he="",_.xK.get_editor(0).session.setMode("ace/mode/json"),k.http_download_map_path&&(M(k.http_download_map_path),N({})),S.ws.sendData(K.HK.http_download_water,void 0).then(()=>{S.ws.addMsg(K.HK.http_download_water,e=>{const t=e.context;$(t)})}),()=>{S.ws&&"function"==typeof S.ws.removeMsg&&S.ws.removeMsg(K.HK.http_download_water)}),[]);const Q=e=>{const t=new se.vr;t.url=F,t.method=C,t.header_type="headers"===G?1:2,"headers"===G&&(ce=JSON.parse(_.xK.get_editor_value(0))),t.headers=ce;const a=Number(T);if(t.body_type=a,a===se.RB.row)pe=_.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.json)ce["Content-Type"]="application/json",pe=_.xK.get_editor_value(1),t.data=pe;else if(a===se.RB.form){ce["Content-Type"]="multipart/form-data",t.form_data_list=I;for(const t of I)t.key&&t.is_file&&e&&e.append(t.fullPath,t.file_object)}return t};return(0,v.jsx)("div",{children:(0,v.jsxs)(o.xh,{children:[(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[0!==R.length&&(0,v.jsx)(s.Zp,{title:"正在下载",children:(0,v.jsx)("div",{children:R.map((t,a)=>(0,v.jsxs)("div",{children:[(0,v.jsxs)("div",{className:"div-row",children:[(0,v.jsx)(c.rA,{icon:"cancel",title:e("取消"),onClick:()=>{S.ws.sendData(K.HK.http_download_cancel,t.local_download_path)}}),(0,v.jsx)(s.xP,{context:t.filename,tip_context:t.local_download_path}),(0,v.jsx)("span",{style:{paddingLeft:".3rem",color:"green"},children:`${t.progresses??0}% ${t.loaded?(0,B.v7)(t.loaded):""}MB / ${t.seep??""}MB/s `})]}),(0,v.jsx)("div",{style:{width:t.progresses?`${t.progresses}%`:"0",backgroundColor:"#40c4ff",height:"5px",transition:"0.2s ease width",borderRadius:"10px"}})]},a))})}),(0,v.jsxs)(s.Zp,{title:"",rightBottomCom:Number(T)===se.RB.form&&"body"===G&&(0,v.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{P([{},...I])}}),children:[(0,v.jsxs)("div",{className:"http_url",children:[(0,v.jsx)(i.l6,{width:"10rem",value:C,onChange:e=>{A(e)},options:[{value:"get",color:"#28a745"},{value:"post",color:"#007bff"},{value:"put",color:"#fd7e14"},{value:"delete",color:"#dc3545"},{value:"head",color:"#6f42c1"},{value:"options",color:"#17a2b8"},{value:"connect",color:"#666666"},{value:"trace",color:"#666666"},{value:"custom",color:"#e83e8c"}]}),(0,v.jsx)(i.Sm,{width:"50rem",placeholder:e("http url"),value:F,handleInputChange:e=>{D(e)}}),(0,v.jsx)(c.rA,{icon:"send",title:e("发送"),onClick:async()=>{if(!u._U.have_http_method(C))return void(0,h.zN)("不存在的http method");if(!F)return void(0,h.zN)("url is empty");J(void 0),j("");const e=new FormData;e.append("data",JSON.stringify(Q(e)));let t="http/send";L&&(t+=`?local_download_path=${L}`),oe.A.post(u._U.getUrl(t),e,{headers:{"Content-Type":"multipart/form-data",Authorization:localStorage.getItem("token")}}).catch(e=>{(0,h.zN)(e.message)}).then(e=>{if(!e)return;let t={};try{if(e.headers.filecat_remote_raw_headers&&(t=JSON.parse(e.headers.filecat_remote_raw_headers),he=JSON.stringify(t,null,2)),e.headers.filecat_remote_code)try{const t=JSON.parse(e.headers.filecat_remote_code);J(200===t||201===t?(0,v.jsx)("span",{style:{color:"green"},children:"200"}):t)}catch(e){console.log(e)}}catch(t){he=String(e.headers.filecat_remote_raw_headers)}const a=(t["content-type"]||t["Content-Type"]||"").toLowerCase();ue="object"==typeof e.data?JSON.stringify(e.data,null,2):e.data;const n=_.xK.get_editor(2),s="body"===U?ue:he;if(n){if(a.includes("application/json")||a.includes("+json")){n.session.setMode("ace/mode/json");try{const e=JSON.parse(ue);ue=JSON.stringify(e,null,2)}catch(e){}}else a.includes("html")?n.session.setMode("ace/mode/html"):a.includes("xml")?n.session.setMode("ace/mode/xml"):a.includes("javascript")?n.session.setMode("ace/mode/javascript"):n.session.setMode("ace/mode/text");n.setValue("body"===U?ue:he,-1)}j(s)})}}),w(x.oV.http_proxy_tag_update)&&(0,v.jsx)(c.rA,{title:e("添加"),icon:"save_as",onClick:()=>{if(!w(x.oV.http_proxy_tag_update))return void(0,h.zN)("no permission");for(const t of I)if(t.is_file)return void(0,h.zN)(e("frm_lm"));let t;W({open:!0,title:e("信息"),context_div:(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"card-content",children:(0,v.jsx)(i.Sm,{placeholderOut:e("输入标签名"),handleInputChange:e=>t=e})}),(0,v.jsx)("div",{className:"card-action",children:(0,v.jsx)("button",{className:"button button--flat",onClick:async()=>{const e=await Q();e.local_download_path=L,e.form_data_list=JSON.stringify(I),e.headers=JSON.stringify(e.headers),"object"==typeof e.data&&(e.data=JSON.stringify(e.data)),e.name=t,Y(e),W({open:!1})},children:e("确定")})})]})})}})]}),(0,v.jsxs)(re,{activeKey:G,onChange:e=>O(e),children:[(0,v.jsx)(le,{itemKey:"headers",tab:e("请求头")+"(json)",children:(0,v.jsxs)("div",{style:{marginTop:"10px"},children:[(0,v.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"},children:(0,v.jsx)(c.rA,{title:e("格式化"),icon:"data_object",onClick:function(){_.xK.get_editor(0)?.formatCode?.()}})}),(0,v.jsx)("div",{className:"http_ace",children:(0,v.jsx)(de,{name:"",editor_id:0})})]})}),(0,v.jsx)(le,{itemKey:"body",tab:e("请求体"),children:(0,v.jsxs)("div",{style:{marginTop:"10px"},children:[(0,v.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,v.jsxs)(re,{activeKey:T,onChange:e=>{z(e);const t=Number(e);t===se.RB.row?_.xK.get_editor(1).session.setMode("ace/mode/text"):t===se.RB.json&&_.xK.get_editor(1).session.setMode("ace/mode/json")},children:[(0,v.jsx)(le,{itemKey:String(se.RB.row),tab:e("row")}),(0,v.jsx)(le,{itemKey:String(se.RB.json),tab:e("json")}),(0,v.jsx)(le,{itemKey:String(se.RB.form),tab:e("form")})]}),Number(T)!==se.RB.form&&(0,v.jsx)(c.rA,{title:e("格式化"),icon:"data_object",onClick:function(){_.xK.get_editor(1)?.formatCode?.()}})]}),Number(T)===se.RB.form&&(0,v.jsx)("div",{style:{marginTop:"10px"},children:(0,v.jsx)(p.X,{headers:["key",e("值")],rows:I.map((t,a)=>[(0,v.jsx)(i.Sm,{value:t.key,handleInputChange:e=>{t.key=e,P([...I])},no_border:!0}),(0,v.jsx)(i.Sm,{value:t.value,handleInputChange:e=>{t.value=e,t.is_file=!1,P([...I])},no_border:!0}),(0,v.jsxs)("div",{children:[(0,v.jsx)(c.rA,{icon:"file_upload",title:e("上传文件"),onClick:()=>(e=>{f({show:!0,type:E.PromptEnum.UploadFile,overlay:!0,data:{extra_data:{only_file:!0},call:t=>{let a=t.currentTarget?.files;if(!a)return;const n=a[0];n.fullPath=(0,H.hU)()+Date.now().toString(),I[e].value=`${n}(${n.name})`,I[e].is_file=!0,I[e].fileName=n.name,I[e].fullPath=n.fullPath,P([...I]),I[e].file_object=n,f({overlay:!1,type:"",show:!1,data:{}})}}})})(a)}),(0,v.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{I.splice(e,1),P([...I])})(a)})]})]),width:"10rem"})}),(0,v.jsx)("div",{className:"http_ace",style:{marginTop:"10px",display:Number(T)!==se.RB.form?"block":"none"},children:(0,v.jsx)(de,{name:"",editor_id:1})})]})})]}),(0,v.jsx)("div",{style:{paddingTop:"1rem"},children:void 0===L?(0,v.jsx)("span",{style:{cursor:"pointer",color:"#3b82f6"},onClick:()=>{M("")},children:e("下载到本地目录")}):(0,v.jsx)(i.Sm,{placeholder:e("本地地址"),value:L,handleInputChange:e=>{M(e)},handlerEnter:()=>{L||M(void 0)}})})]})]}),(0,v.jsx)(o.VP,{children:(0,v.jsxs)(s.Zp,{title:Z,titleCom:(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,v.jsx)(c.rA,{title:e("格式化"),icon:"data_object",onClick:()=>{_.xK.get_editor(2)?.formatCode?.()}}),(0,v.jsx)(c.rA,{title:e("复制"),icon:"copy_all",onClick:()=>{const e=_.xK.get_editor_value(2);e&&((0,ne.lW)(e),(0,h.SK)("完成"))}})]}),children:[(0,v.jsxs)(re,{activeKey:U,onChange:e=>{V(e);const t="body"===e?ue:he;j(t);const a=_.xK.get_editor(2);if(a){try{JSON.parse(t),a.session.setMode("ace/mode/json")}catch{a.session.setMode("ace/mode/text")}a.setValue(t,-1)}},children:[(0,v.jsx)(le,{itemKey:"body",tab:e("响应体")}),(0,v.jsx)(le,{itemKey:"headers",tab:e("响应头")})]}),(0,v.jsx)("div",{className:"http_ace",style:{marginTop:"10px",height:"21rem"},children:(0,v.jsx)(de,{name:"",editor_id:2})})]})})]}),(0,v.jsx)(o.fI,{children:(0,v.jsx)(o.VP,{children:(0,v.jsx)(b.N,{getItems:async()=>{const e=await u._U.get("http/tag");return e.code===y.m.Success?e.data:[]},save:async e=>{(await u._U.post("http/tag/save",e)).code!==y.m.Success&&(0,h.zN)("网络错误")},have_auth_edit:w(x.oV.http_proxy_tag_update),clickItem:async e=>{D(e.url),A(e.method),M(e.local_download_path),e.header_type&&O(1===e.header_type?"headers":"body"),e.headers&&(ce=JSON.parse(e.headers),1===e.header_type&&(_.xK.get_editor(0).setValue(e.headers,-1),_.xK.get_editor(0).session.setMode("ace/mode/json"))),e.form_data_list&&P(JSON.parse(e.form_data_list)),e.data&&(pe=e.data),e.body_type&&(z(String(e.body_type)),e.body_type===se.RB.row?_.xK.get_editor(1).session.setMode("ace/mode/text"):e.body_type===se.RB.json&&_.xK.get_editor(1).session.setMode("ace/mode/json"),_.xK.get_editor(1).setValue(e.data,-1))},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"method",preName:"method"},{key:"headers",preName:"headers"},{key:"data",preName:"data"},{key:"form_data_list",preName:"form_data_list"},{key:"local_download_path",preName:"local_download_path"},{key:"color",preName:"color"}]})})})]})})}var fe=a(87361);const ye=n.lazy(()=>Promise.all([a.e(8772),a.e(8257),a.e(7759)]).then(a.bind(a,45601)));function _e({}){const{check_user_auth:e}=(0,_.MH)(),{t}=(0,r.Bd)(),a=[];return e(x.oV.http_proxy)&&a.push({index:1,name:t("http代理"),rto:"http/",component:(0,v.jsx)(me,{})}),e(x.oV.ssh_proxy)&&a.push({index:1,name:`ssh${t("代理")}`,rto:"remoteShell/",component:(0,v.jsx)(U,{})}),e(x.oV.browser_proxy)&&a.push({index:1,name:`${t("浏览器")}${t("代理")}`,rto:"browserproxy/",component:(0,v.jsx)(g,{})}),e(x.oV.rdp_proxy)&&a.push({index:1,name:`rdp${t("代理")}`,rto:"rdp/",component:(0,v.jsx)(ae,{})}),e(x.oV.rtsp_proxy)&&a.push({index:1,name:t("rtsp播放器"),rto:"rtsp/",component:(0,v.jsx)(ye,{})}),(0,v.jsx)(o.W1,{optionList:a,father_route:fe.o.proxy})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3233,5614],{33616(e){var n;self,n=()=>(()=>{"use strict";var e,n={};return e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const n=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(n._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,n=e._renderService.dimensions;if(0===n.css.cell.width||0===n.css.cell.height)return;const t=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),l=o-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),a=i-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(a/n.css.cell.width)),rows:Math.max(1,Math.floor(l/n.css.cell.height))}}},n})(),e.exports=n()},40654(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>E});var r=t(96540),o=t(33616),i=(t(97856),t(85072)),s=t.n(i),l=t(97825),a=t.n(l),c=t(77659),d=t.n(c),u=t(55056),m=t.n(u),p=t(10540),h=t.n(p),x=t(41113),f=t.n(x),g=t(86739),v={};v.styleTagTransform=f(),v.setAttributes=m(),v.insert=d().bind(null,"head"),v.domAPI=a(),v.insertStyleElement=h();s()(g.A,v);g.A&&g.A.locals&&g.A.locals;var y=t(40505),_=t(62042),b=t(84369),w=t(74848);function E(e){const[n,t]=(0,r.useState)(25),i=(0,r.useRef)(null),s=(0,r.useCallback)(new o.FitAddon,[]),l=(0,r.useRef)(null),a=(0,r.useRef)(null),{dragging:c,on_pointer_down:d,on_pointer_up:u}=(0,b.y)({direction:"vertical",target_ref:l,get_start_size:()=>n,px_to_unit:e=>e/parseFloat(getComputedStyle(l.current).fontSize),min:()=>{const e=parseFloat(getComputedStyle(l.current).fontSize);return 2.25+i.current.offsetHeight/e},max:()=>{const e=parseFloat(getComputedStyle(l.current).fontSize);return window.innerHeight/e-4},throttle:32,on_change:e=>{s.fit(),t(parseFloat(e.toFixed(2)))}});if((0,r.useEffect)(()=>{e.terminal&&(e.terminal.options.convertEol=!0,e.terminal.open(a.current),e.terminal.loadAddon(s),s.fit(),e.init&&e.init(e.terminal.rows,e.terminal.cols),e.terminal.attachCustomKeyEventHandler(n=>{if(n.ctrlKey&&"c"===n.key){const t=e.terminal.getSelection();if(t)return(0,y.lW)(t),(0,_.SK)("已复制"),n.preventDefault(),e.terminal.focus(),!1}else if("keydown"===n.type&&"v"===n.key&&n.ctrlKey)return!1;return!0}))},[e.terminal]),(0,r.useEffect)(()=>()=>{e.terminal&&e.terminal.dispose()},[]),e.show)return e.get_simple?(0,w.jsx)("div",{className:"pty",style:{height:"100%"},ref:a}):(0,w.jsxs)("div",{className:"shell",style:{height:`${n}em`,display:""+(e.file_shell_hidden?"none":"block")},ref:l,children:[(0,w.jsx)("div",{className:"shell__divider",ref:i,onPointerDown:d,onPointerUp:u}),(0,w.jsx)("div",{className:"pty",style:{height:n-1+"em"},ref:a}),c&&(0,w.jsx)("div",{className:"shell__overlay",onPointerUp:u})]})}},85614(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>s});var r=t(96540),o=(t(40654),t(74848));const i=r.lazy(()=>Promise.resolve().then(t.bind(t,40654)));function s(e){return(0,o.jsx)(r.Fragment,{children:(0,o.jsx)(i,{...e})})}},84369(e,n,t){"use strict";t.d(n,{y:()=>s});var r=t(96540),o=t(2543);function i(e){if(void 0!==e)return"function"==typeof e?e():e}function s(e){const{direction:n="vertical",target_ref:t,get_start_size:s,px_to_unit:l,min:a,max:c,throttle:d,on_change:u,on_drag_end:m}=e,[p,h]=(0,r.useState)(!1),x=(0,r.useRef)(null),f=(0,r.useRef)(u);f.current=u;const g=e=>"vertical"===n?e.clientY:e.clientX,v=(0,r.useRef)({direction:n,get_start_size:s,px_to_unit:l,min:a,max:c,get_pos:g});v.current={direction:n,get_start_size:s,px_to_unit:l,min:a,max:c,get_pos:g};const y=(0,r.useCallback)(e=>{const n=x.current;if(!n)return;const{px_to_unit:t,min:r,max:o,get_pos:s}=v.current,l=n.pos-s(e);let a=n.size+t(l);const c=i(r),d=i(o);void 0!==c&&(a=Math.max(c,a)),void 0!==d&&(a=Math.min(d,a)),f.current(a)},[]),_=r.useMemo(()=>void 0===d?y:o.throttle(e=>y(e),d),[d,y]),b=(0,r.useCallback)(()=>{x.current=null,h(!1);const e=_;"function"==typeof e.cancel&&e.cancel(),m?.()},[_,m]),w=(0,r.useCallback)(e=>{const{get_start_size:n,get_pos:t}=v.current;x.current={pos:t(e),size:n()},h(!0)},[]);return(0,r.useEffect)(()=>{if(!p)return;const e=t?.current??window;return e.addEventListener("pointermove",_),e.addEventListener("pointerup",b),()=>{e.removeEventListener("pointermove",_),e.removeEventListener("pointerup",b)}},[p,_,b,t]),(0,r.useEffect)(()=>{const e=_;return()=>{"function"==typeof e.cancel&&e.cancel()}},[_]),{dragging:p,on_pointer_down:w,on_pointer_up:b}}},86739(e,n,t){"use strict";t.d(n,{A:()=>l});var r=t(31601),o=t.n(r),i=t(76314),s=t.n(i)()(o());s.push([e.id,'/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * https://github.com/chjj/term.js\n * @license MIT\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the "Software"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * Originally forked from (with the author\'s permission):\n * Fabrice Bellard\'s javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n */\n\n/**\n * Default styles for xterm.js\n */\n\n.xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.xterm.focus,\n.xterm:focus {\n outline: none;\n}\n\n.xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /**\n * The z-index of the helpers must be higher than the canvases in order for\n * IMEs to appear on top.\n */\n z-index: 5;\n}\n\n.xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Move textarea out of the screen to the far left, so that the cursor is not visible */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n /** Prevent wrapping so the IME appears against the textarea at the correct position */\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n}\n\n.xterm .composition-view {\n /* TODO: Composition position got messed up somewhere */\n background: #000;\n color: #FFF;\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n}\n\n.xterm .composition-view.active {\n display: block;\n}\n\n.xterm .xterm-viewport {\n /* On OS X this is required in order for the scroll bar to appear fully opaque */\n background-color: #000;\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n}\n\n.xterm .xterm-screen {\n position: relative;\n}\n\n.xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.xterm .xterm-scroll-area {\n visibility: hidden;\n}\n\n.xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n}\n\n.xterm.enable-mouse-events {\n /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */\n cursor: default;\n}\n\n.xterm.xterm-cursor-pointer,\n.xterm .xterm-cursor-pointer {\n cursor: pointer;\n}\n\n.xterm.column-select.focus {\n /* Column selection mode */\n cursor: crosshair;\n}\n\n.xterm .xterm-accessibility:not(.debug),\n.xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n}\n\n.xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n}\n\n.xterm .xterm-accessibility-tree {\n user-select: text;\n white-space: pre;\n}\n\n.xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.xterm-dim {\n /* Dim should not apply to background, so the opacity of the foreground color is applied\n * explicitly in the generated class and reset to 1 here */\n opacity: 1 !important;\n}\n\n.xterm-underline-1 { text-decoration: underline; }\n.xterm-underline-2 { text-decoration: double underline; }\n.xterm-underline-3 { text-decoration: wavy underline; }\n.xterm-underline-4 { text-decoration: dotted underline; }\n.xterm-underline-5 { text-decoration: dashed underline; }\n\n.xterm-overline {\n text-decoration: overline;\n}\n\n.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n.xterm-strikethrough {\n text-decoration: line-through;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration {\n\tz-index: 6;\n\tposition: absolute;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n\tz-index: 7;\n}\n\n.xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n}\n\n.xterm-decoration-top {\n z-index: 2;\n position: relative;\n}\n',""]);const l=s}}]);
|
|
@@ -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.7.4",null!=U.latest_version&&"7.7.4"!==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){s.d(t,{K:()=>i});var n=s(22022);const i=()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4472,6010],{83277(e,s,t){t.d(s,{$j:()=>i,CP:()=>a,Lv:()=>n,cL:()=>o});class n{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,s){if(!e||!s?.length)return e;for(const t of s)if(t.value===e)return t.label;return e}static have_label_by_v(e,s){if(!e||!s?.length)return!1;for(const t of s)if(t.value===e)return!0;return!1}}const a='\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n\n# ===== 是否支持图片(support_image)=====\n# 开启后:1) 注册 read_image 工具,让 AI 能读取本地图片;\n# 2) 工具读到的图片会以 OpenAI 多模态格式 image_url 随消息发给模型,模型就能真正"看图"。\n# 关闭后:AI 看不到图片,read_image 只会返回一句文字说明。\n# 主流模型(gpt-4o、豆包、qwen-vl、deepseek-vl 等)都支持,默认开启。\nsupport_image=true\n';const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function i(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}},47713(e,s,t){t.r(s),t.d(s,{default:()=>ae});var n=t(96540),a=t(34843),o=t(22022),i=t(52671),c=t(92275),r=t(14284),l=t(7463),d=t(64694),u=t(78247),m=t(40505),h=t(62042),g=t(45907),p=t(53459),_=t(72693),x=t(82893),f=t(61443),j=t(83277);function v(e){return null==e||e<0?"0":e.toLocaleString()}function b(e){const s=[];if(e.attachments?.length&&s.push(e.attachments.map(e=>`[附件] ${e.name}`).join("\n")),e.content_list?.length)for(const t of e.content_list){const e=(0,j.$j)(t.content);if(e&&s.push(e),t.tool_call_ends?.length){const e=t.tool_call_ends.map(e=>{const s=e.tool_display_name||e.tool_name;return e.success?`[工具] ${s} 成功`:`[工具] ${s} 失败`});s.push(e.join("\n"))}}return e.text&&!s.length&&s.push(e.text),e.images?.length&&s.push(`[生成图片 ${e.images.length} 张]`),e.audio&&s.push("[音频]"),s.join("\n\n")}function y(e){const s=(0,j.$j)(e.content);if(s)return s;const t=e.content_list??[];return t.length?t.map(e=>(0,j.$j)(e.content)).filter(Boolean).join("\n\n"):""}function w(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,s)=>({id:Date.now()+s,sender:"assistant"===e.role?"bot":"user",text:y(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings,elapsed_ms:e.elapsed_ms}))}const S=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function N(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||S.test(e.name)?"text":"binary"}function k(e){return e.text()}function C(e){return new Promise((s,t)=>{const n=new FileReader;n.onload=()=>s(n.result),n.onerror=t,n.readAsDataURL(e)})}async function A(e){const s=[];for(const t of e){const e=N(t);let n="";if("text"===e)try{const e=await k(t),s=12e4;n=e.length>s?`${e.slice(0,s)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await C(t)}catch{n=`[图片文件: ${t.name}]`}else n=`[二进制文件: ${t.name}]`;s.push({name:t.name,mime_type:t.type,size:t.size,kind:e,content:n})}return s}var $=t(14944);var I=t(85997),M=t(34299),D=t(74848);function R(e){const s=e.attachments&&e.attachments.length>0?(0,D.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,s)=>(0,D.jsxs)("div",{className:"chat-message-attachment",children:[(0,D.jsx)(I.In,{icon:"attach_file"}),(0,D.jsx)("span",{children:e.name}),(0,D.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${s}`))}):null,t=[];e.images&&"bot"===e.sender&&t.push((0,D.jsx)(n.Fragment,{children:(0,D.jsx)(K,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&t.push((0,D.jsx)(n.Fragment,{children:(0,D.jsx)(T,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&t.push((0,D.jsx)(n.Fragment,{children:(0,D.jsx)(E,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,D.jsx)(M.default,{context:e.text}):null;return(0,D.jsxs)(D.Fragment,{children:[e.content_list.map((e,s)=>{const t=[],a=(0,j.$j)(e.content);return a&&t.push((0,D.jsx)(n.Fragment,{children:(0,D.jsx)(M.default,{context:a})},`content-${s}`)),e.tool_call_ends?.length&&t.push((0,D.jsx)(n.Fragment,{children:(0,D.jsx)(H,{callList:e.tool_call_ends})},`tool-${s}`)),(0,D.jsx)(n.Fragment,{children:t},`part-${s}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,D.jsx)(M.default,{context:e.text}):null]})}(e);return 0===t.length?(0,D.jsxs)(D.Fragment,{children:[s,a]}):(0,D.jsxs)(D.Fragment,{children:[t,s,a]})}function H({callList:e}){const[s,t]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,D.jsxs)("div",{className:"chat-message-call-list",children:[(0,D.jsxs)("div",{className:"call-list-header",onClick:()=>t(!s),children:[(0,D.jsx)(I.In,{icon:s?"expand_less":"expand_more"}),(0,D.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,D.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),s&&(0,D.jsx)("div",{className:"call-list-body",children:e.map((e,s)=>(0,D.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,D.jsxs)("div",{className:"call-list-item-header",children:[(0,D.jsx)(I.In,{icon:e.success?"check_circle":"error"}),(0,D.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,D.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,D.jsxs)("details",{className:"call-list-details",children:[(0,D.jsx)("summary",{children:"参数"}),(0,D.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,D.jsxs)("details",{className:"call-list-details",children:[(0,D.jsx)("summary",{children:"错误"}),(0,D.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,D.jsxs)("details",{className:"call-list-details",children:[(0,D.jsx)("summary",{children:"结果"}),(0,D.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},s))})]})}function K({images:e,text:s}){let t=e||[];if(!t.length&&s)try{t=JSON.parse(s).data||[]}catch{}return t.length?(0,D.jsxs)("div",{className:"image-generation-result",children:[t.map((e,s)=>(0,D.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,D.jsx)("div",{className:"image-generation-image-wrapper",children:(0,D.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${s+1}`,loading:"lazy"})}),e.b64_json&&(0,D.jsx)("div",{className:"image-generation-image-wrapper",children:(0,D.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${s+1}`})}),e.revised_prompt&&(0,D.jsx)("p",{className:"image-generation-prompt",children:(0,D.jsx)("small",{children:e.revised_prompt})})]},s)),s&&!e&&(0,D.jsx)(M.default,{context:s})]}):(0,D.jsx)(M.default,{context:s||""})}function T({audio:e,text:s}){if(e){if(e.url)return(0,D.jsx)("div",{className:"audio-result",children:(0,D.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const s=e.mime_type||"audio/mpeg";return(0,D.jsx)("div",{className:"audio-result",children:(0,D.jsx)("audio",{controls:!0,src:`data:${s};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const t=s||"";if(t.startsWith("http://")||t.startsWith("https://"))return(0,D.jsx)("div",{className:"audio-result",children:(0,D.jsx)("audio",{controls:!0,src:t,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(t);if(e?.data||e?.audio_data){const s=e.data||e.audio_data;return(0,D.jsx)("div",{className:"audio-result",children:(0,D.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${s}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,D.jsx)(M.default,{context:t})}function B({content:e,label:s}){const[t,a]=n.useState(!1);return(0,D.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,m.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,D.jsx)(I.In,{icon:t?"check":"content_copy"}),t?"已复制":s||"复制"]})}function E({embeddings:e,text:s}){let t=e||null;if(!t&&s)try{t=JSON.parse(s)}catch{return(0,D.jsx)(M.default,{context:s})}if(!t)return(0,D.jsx)(M.default,{context:s||""});const n=t?.data||[],a=t?.usage,o=JSON.stringify(t,null,2);return(0,D.jsxs)("div",{className:"embeddings-result",children:[(0,D.jsxs)("div",{className:"embeddings-summary",children:[(0,D.jsx)("strong",{children:"向量嵌入结果"}),(0,D.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,D.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,D.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,D.jsxs)("div",{className:"embeddings-toolbar",children:[(0,D.jsx)(B,{content:o,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,D.jsx)(B,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,D.jsx)(B,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,D.jsx)("div",{className:"embeddings-preview",children:(0,D.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,D.jsxs)("details",{children:[(0,D.jsx)("summary",{children:"查看详细数据"}),(0,D.jsx)("pre",{className:"embeddings-raw",children:o})]})]})}async function V(e,s,t,n){try{switch(e){case"images":{const e=await async function(e,s){const t={prompt:e,session_id:s},n=await r.jV.post("images/generations",t);if(0!==n.code)throw new Error(n.message||"图片生成失败");const a=n.data||{},o=(a.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),i=o.map((e,s)=>`${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:a.session_id||s,images:o,text:i||`生成了 ${o.length} 张图片`}}(s,t);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,s){const t={input:e,session_id:s};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const s=JSON.parse(e);s.voice&&(t.voice=s.voice),s.speed&&(t.speed=parseFloat(s.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(t)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const o=a.headers.get("X-Session-Id")||s,i=await a.arrayBuffer();return{session_id:o,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(i)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(s,t);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,s){const t=await r.jV.post("embeddings",{input:e,session_id:s});if(0!==t.code)throw new Error(t.message||"Embeddings 请求失败");const n=t.data||{},a=n?.data??[],o=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||s,embeddings:n,text:`✅ Embeddings 结果 - ${o}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(s,t);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var z=t(4412),P=t(23430),L=t(87361),F=t(80389),O=t(7523),q=t(23496);const G=({currentModelName:e,setCurrentModelName:s,modelGroups:t,onModelChanged:c,sysPromptList:l,batchMode:d,selectedMsgCount:m,onToggleSessionPanel:g,onCreateSession:_,onToggleBatchMode:j,onBatchDeleteMessages:v,bgProcessVisible:b,bgProcessCount:y,onToggleBgProcess:w,selectedSysPromptId:S,setSelectedSysPromptId:N})=>{const{t:k}=(0,o.Bd)(),C=(0,i.Zp)(),{check_user_auth:A}=(0,u.MH)(),[,$]=(0,a.fp)(x.AG.ai_session_collapsed),{open:M}=function(){const{t:e}=(0,o.Bd)(),[,s]=(0,a.fp)(x.AG.prompt_card),[t,i]=(0,a.fp)(x.AG.ai_chat_zoom),{initUserInfo:c}=(0,n.useContext)(O.F);return{open:()=>{const n=t,a=()=>s({open:!1});s({open:!0,title:e("缩放调整"),context_div:(0,D.jsx)(F.p,{defaultValue:t,onChange:i,min:30,max:200}),cancel:()=>{i(n),a()},confirm:async()=>{let s=100;i(e=>(s=e<30||e>200?100:e,s)),await r.wm.post(q.s.user_save_private_attr,{is_ai_chat_zoom:!0,ai_chat_zoom:s}),(0,h.SK)(e("缩放调整成功")),c(),a()}})}}}(),R=A(P.oV.ai_model_switch)||A(P.oV.ai_agent_setting),H=[];for(const e of t)for(const s of e.models)H.push({title:s.label||s.value,value:`${e.index}::${s.value}`,group:e.note});const K=t.find(e=>e.active),T=K?`${K.index}::${e}`:"";return(0,D.jsxs)(z.aZ,{position:"right",children:[(0,D.jsx)(I.rA,{icon:"menu",title:k("会话"),onClick:g}),(0,D.jsx)(I.rA,{icon:"add",title:k("新会话"),onClick:()=>_()}),l.length>0&&(0,D.jsx)(f.l6,{value:S,options:[{title:k("选择系统提示词"),value:""},...l.map(e=>({title:e.note||e.prompt.slice(0,30),value:String(e.index)}))],onChange:e=>{N(e)},no_border:!0,width:"auto"}),R&&H.length>0&&(0,D.jsx)(f.l6,{value:T,options:[{title:k("选择模型"),value:""},...H],margin:"0 0 0 1em",onChange:e=>{const t=String(e??"");if(!t.includes("::"))return;const[n,...a]=t.split("::"),o=a.join("::");o&&(s(o),r.jV.post("set_active_model",{index:Number(n),model_name:o}).then(e=>{e?.code===p.m.Success?((0,h.SK)("success"),c()):(0,h.zN)(e?.message||"fail")}).catch(console.error))},no_border:!0,width:"auto"}),d&&m>0&&(0,D.jsx)(I.rA,{icon:"delete",title:k("删除选中消息"),onClick:v}),(0,D.jsx)(I.rA,{icon:"zoom_in",title:k("缩放调整"),onClick:M}),(0,D.jsx)(I.rA,{icon:"terminal",title:k("后台进程"),onClick:w,selected:b,tip:y||null}),A(P.oV.ai_agent_setting)&&(0,D.jsx)(I.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{C(L.o.ai_rebot_setting_page)}}),A(P.oV.ai_agent_setting)&&(0,D.jsx)(I.rA,{icon:"settings",title:"ai setting",onClick:()=>{C(L.o.ai_agent_setting_page)}})]})};var J=t(83529);function W({sessions:e,activeSessionId:s,onSelectSession:t,onReorderSessions:i,onRenameSession:c,onDeleteSession:r,onToggleCmdAuto:l,onShowUsageStats:d,batchMode:u,selectedSessionIds:m,onToggleSessionSelect:h,onToggleBatchMode:g,onBatchDeleteSessions:p,onClearAllSessions:_}){const{t:f}=(0,o.Bd)(),[j,v]=(0,a.fp)(x.AG.ai_session_collapsed),[b,y]=(0,n.useState)(""),[w,S]=(0,n.useState)(null),[N,k]=(0,n.useState)(null),C=b.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(b.toLowerCase())||(e.summary||"").toLowerCase().includes(b.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(b.toLowerCase())):e;return(0,D.jsxs)("aside",{className:`chat-session-list ${j?"active":""} ${j?"collapsed":""}`,children:[(0,D.jsx)("div",{className:"chat-session-search",children:(0,D.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:f("搜索会话"),value:b,onChange:e=>y(e.target.value)})}),(0,D.jsx)("div",{className:"chat-session-items-wrap",children:C.map((e,n)=>{return(0,D.jsx)("div",{children:(0,D.jsxs)("button",{className:`chat-session-item ${s===e.id?"active":""} ${u?"batch-mode":""} ${e.running?"is-running":""} ${w===n?"row-dragging":""} ${N===n&&null!==w&&w!==n?"row-drop-target":""}`,draggable:!!i,onDragStart:()=>S(n),onDragOver:e=>{null!==w&&(e.preventDefault(),N!==n&&k(n))},onDragEnd:()=>{S(null),k(null)},onDrop:e=>{e.preventDefault(),(e=>{const s=w;if(S(null),k(null),null===s||s===e||!i)return;const t=C[s]?.id,n=C[e]?.id;t&&n&&i(t,n)})(n)},onClick:()=>{u&&h?h(e.id):t(e.id)},title:e.summary||e.long_term_memory||e.title,children:[u&&(0,D.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:m?.has(e.id)??!1,onChange:()=>h?.(e.id),onClick:e=>e.stopPropagation()}),(0,D.jsx)("span",{children:(a=e.title,a||"新会话")}),e.running&&(0,D.jsx)("span",{className:"chat-session-running",title:f("正在执行中")}),(0,D.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,D.jsx)("em",{className:"chat-session-source",children:e.source}),!u&&(0,D.jsx)(J.MenuSelect,{list:[{name:f("重命名"),click:()=>c(e.id,e.title)},{name:f("移动到最上"),click:()=>{const s=C[0];s&&s.id!==e.id&&i?.(e.id,s.id)}},{name:f("移动到最下"),click:()=>{const s=C[C.length-1];s&&s.id!==e.id&&i?.(e.id,s.id)}},{name:e.cmd_auto_allow?f("命令检测关闭"):f("命令检测开启"),click:()=>l?.(e.id,!e.cmd_auto_allow)},{name:f("字符消耗统计"),click:()=>d(e.id)},{name:f("删除"),click:()=>r(e.id)}],children:(0,D.jsx)(I.In,{icon:"more_horiz"})})]})},e.id);var a})}),(0,D.jsxs)("div",{className:"chat-session-actions",children:[(0,D.jsx)(I.rA,{icon:u?"check_circle":"checklist",title:f(u?"取消批量选择":"批量选择"),onClick:g}),u&&(m?.size??0)>0&&(0,D.jsx)(I.rA,{icon:"delete",title:f("删除选中会话"),onClick:p}),!u&&(0,D.jsx)(I.rA,{icon:"delete_sweep",title:f("删除全部会话"),onClick:_})]})]})}var U=t(21499);function Q(e){const s=(e.text||"").split("\n").map(e=>e.trim()).find(Boolean)||"";return s.length>80?s.slice(0,80)+"…":s}const X=({messages:e,batchMode:s,selectedMsgIds:t,sending:a,chatContainerRef:o,messagesEndRef:i,onToggleMsgSelect:c,onDelete:r,onCopy:l,onCopyAll:d,onToggleBatchMode:u,onBatchCopy:m,onBatchDelete:h,showBatchBar:g,t:p})=>{const[_,x]=(0,n.useState)(new Set),f=(0,n.useMemo)(()=>e.filter(e=>!e.is_loading).map(e=>e.id),[e]),j=e=>{x(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},v=()=>{x(e=>e.size>0&&f.every(s=>e.has(s))?new Set:new Set(f))};return(0,D.jsxs)("div",{className:"chat-messages",ref:o,"data-sending":a?"true":"false",children:[g&&(0,D.jsxs)("div",{className:"chat-message-batch-bar",children:[(0,D.jsxs)("span",{className:"batch-bar-count",children:[p("已选")," ",t.size]}),(0,D.jsx)("button",{onClick:m,children:p("复制所选")}),(0,D.jsx)("button",{onClick:h,className:"danger",children:p("删除所选")}),(0,D.jsx)("button",{onClick:u,children:p("取消")})]}),e.map(e=>{const n=_.has(e.id);return(0,D.jsxs)("div",{className:`chat-message ${e.sender} ${s?"batch-mode":""} ${e.is_loading?"is-loading":""} ${n?"collapsed":""}`,children:[s&&(0,D.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:t.has(e.id),onChange:()=>c(e.id)}),e.is_loading?(0,D.jsxs)("div",{className:"ai-loading-bubble",children:[(0,D.jsxs)("div",{className:"ai-loading-dots",children:[(0,D.jsx)("span",{className:"ai-loading-dot"}),(0,D.jsx)("span",{className:"ai-loading-dot"}),(0,D.jsx)("span",{className:"ai-loading-dot"})]}),(0,D.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,D.jsxs)(D.Fragment,{children:[n?(0,D.jsxs)("div",{className:"chat-message-summary",title:e.text,onClick:()=>j(e.id),children:[(0,D.jsx)("span",{className:"chat-message-summary-icon",children:"▸"}),(0,D.jsx)("span",{className:"chat-message-summary-text",children:Q(e)||p("(无内容)")})]}):(0,D.jsx)("div",{className:"chat-message-body",children:R(e)}),(0,D.jsxs)("div",{className:"message-collapse-bar",children:[(0,D.jsx)("button",{onClick:()=>j(e.id),children:p(n?"展开":"折叠")}),(0,D.jsx)("button",{onClick:v,children:p("全部折叠")}),"bot"===e.sender&&null!=e.elapsed_ms&&(0,D.jsx)("span",{className:"message-elapsed",children:(0,U.kf)(e.elapsed_ms)})]}),(0,D.jsx)("div",{className:"message-actions",children:s?(0,D.jsx)("button",{onClick:()=>c(e.id),children:t.has(e.id)?p("取消选择"):p("选择")}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("button",{onClick:()=>r(e.id),children:p("删除")}),(0,D.jsx)("button",{onClick:()=>l(e),children:p("复制")}),(0,D.jsx)("button",{onClick:d,children:p("全部复制")}),(0,D.jsx)("button",{onClick:u,children:p("多选")})]})})]})]},e.id)}),(0,D.jsx)("div",{ref:i})]})},Z=(0,n.forwardRef)(function({placeholder:e="",disabled:s=!1,className:t,style:a,onEnter:o,onPaste:i,onChange:c},r){const l=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{const e=l.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(r,()=>({getValue:()=>g(),setValue:e=>{const s=l.current;if(!s)return;s.textContent=e,u(!e);const t=document.createRange();t.selectNodeContents(s),t.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)},clear:()=>{const e=l.current;e&&(e.textContent="",u(!0))},focus:()=>l.current?.focus()})),(0,n.useEffect)(()=>{const e=l.current;if(!e)return;const s=()=>u(!e.textContent);return e.addEventListener("input",s),()=>e.removeEventListener("input",s)},[]);return(0,D.jsx)("div",{ref:l,contentEditable:!s,suppressContentEditableWarning:!0,className:"rich-textarea"+(t?" "+t:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),o?.())},onPaste:i,onInput:()=>c?.(g()),onCompositionStart:()=>h(!0),onCompositionEnd:()=>h(!1),"data-placeholder":d?e:void 0})});var Y=t(84369);function ee({pendingAttachments:e,onRemove:s}){return 0===e.length?null:(0,D.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,t)=>(0,D.jsxs)("div",{className:"chat-attachment-chip",children:[(0,D.jsx)(I.In,{icon:"attach_file"}),(0,D.jsx)("span",{title:e.name,children:e.name}),(0,D.jsx)("button",{type:"button",onClick:()=>s(t),children:(0,D.jsx)(I.In,{icon:"close"})})]},`${e.name}_${t}`))})}const se=(0,n.forwardRef)(({onSend:e,sending:s,onAbort:t,pendingAttachments:i,onRemoveAttachment:c,onOpenFilePicker:r,onAddFiles:l,onDrop:d,onDragOver:u,fileInputRef:m},h)=>{const{t:g}=(0,o.Bd)(),p=(0,n.useRef)(null),_=(0,n.useRef)(null),[f,j]=(0,a.fp)(x.AG.ai_chat_input_height);(0,n.useImperativeHandle)(h,()=>({getValue:()=>p.current?.getValue()??"",setValue:e=>p.current?.setValue(e),clear:()=>p.current?.clear()}));const{dragging:v,on_pointer_down:b,on_pointer_up:y}=(0,Y.y)({direction:"vertical",get_start_size:()=>f,px_to_unit:e=>e/(()=>{const e=_.current;return e&&parseFloat(getComputedStyle(e).fontSize)||16})(),min:2,on_change:e=>j(e)}),w={minHeight:`${f}em`,maxHeight:`${f}em`};return(0,D.jsxs)("div",{ref:_,className:"chat-input-area",onDrop:d,onDragOver:u,children:[(0,D.jsx)("div",{className:"chat-input-resize-handle"+(v?" dragging":""),onPointerDown:b}),(0,D.jsx)("input",{ref:m,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(l(e.target.files),e.currentTarget.value="")}}),(0,D.jsxs)("div",{className:"chat-input-shell",children:[(0,D.jsx)(ee,{pendingAttachments:i,onRemove:c}),(0,D.jsx)(Z,{ref:p,placeholder:g("输入消息"),onEnter:()=>e(),onPaste:e=>{const s=e.clipboardData?.files;s&&s.length>0&&(e.preventDefault(),l(s))},className:"chat-input",style:w})]}),(0,D.jsx)(I.rA,{title:g("添加文件"),icon:"attach_file",onClick:r}),s?(0,D.jsx)(I.Vi,{color:"var( --icon-red)",text:g("暂停"),clickFun:t}):(0,D.jsx)(I.Vi,{text:g("发送"),clickFun:e}),v&&(0,D.jsx)("div",{className:"chat-input-overlay",onPointerUp:y})]})}),te={},ne=function(){const{t:e}=(0,o.Bd)(),[s,t]=(0,n.useState)([]),[i,r]=(0,n.useState)(!1),[l,d]=(0,n.useState)(null),[u,m]=(0,n.useState)(null),[g,p]=(0,n.useState)(!1),[_,f]=(0,a.fp)(x.AG.ai_bg_expanded),[,j]=(0,a.fp)(x.AG.ai_session_collapsed),v=()=>{f(!1)},b=(0,n.useCallback)(async()=>{r(!0);try{const e=new c.hf(c.HK.ai_bg_process_list_req);e.context={};const s=await $.ws.send(e);s?.context?.processes&&(t(s.context.processes),te.onCountChange?.(s.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{r(!1)}},[]);te.refresh=b;const y=(0,n.useCallback)(async e=>{p(!0),d(e);try{const s=new c.hf(c.HK.ai_bg_process_output_req);s.context={pid:e};const t=await $.ws.send(s);m(t.context)}catch(e){console.error("获取进程输出失败",e),(0,h.zN)("获取进程输出失败")}finally{p(!1)}},[]),w=(0,n.useCallback)(async e=>{try{const s=new c.hf(c.HK.ai_bg_process_kill_req);s.context={pid:e};const t=await $.ws.send(s);t?.context?.success?((0,h.SK)("进程已终止"),b(),l===e&&(d(null),m(null))):(0,h.zN)(t?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,h.zN)("终止进程失败")}},[b,l]);(0,n.useEffect)(()=>{b();const e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);const S=s.filter(e=>e.running),N=s.filter(e=>!e.running);return(0,D.jsxs)(D.Fragment,{children:[_&&(0,D.jsx)("div",{className:"chat-session-overlay",onClick:v}),(0,D.jsxs)("aside",{className:"chat-bg-process-panel "+(_?"expanded":""),children:[(0,D.jsxs)("div",{className:"chat-bg-process-header",children:[(0,D.jsx)("span",{className:"chat-bg-process-title",children:e("后台进程")}),(0,D.jsx)(I.rA,{icon:"close",title:e("关闭"),onClick:v})]}),(0,D.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,D.jsx)(I.rA,{icon:"refresh",title:e("刷新"),onClick:b}),(0,D.jsxs)("span",{className:"chat-bg-process-count",children:[S.length," ",e("个运行中"),N.length>0&&` / ${N.length} ${e("个已退出")}`]})]}),(0,D.jsxs)("div",{className:"chat-bg-process-list",children:[i&&0===s.length&&(0,D.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}),!i&&0===s.length&&(0,D.jsx)("div",{className:"chat-bg-process-empty",children:e("暂无后台进程")}),S.map(s=>(0,D.jsxs)("div",{className:`chat-bg-process-item ${l===s.pid?"active":""} running`,children:[(0,D.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(s.pid),children:[(0,D.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",s.pid]}),(0,D.jsx)("span",{className:"chat-bg-process-cmd",title:s.cmd,children:s.cmd.length>40?s.cmd.slice(0,40)+"...":s.cmd}),(0,D.jsx)("span",{className:"chat-bg-process-time",children:new Date(s.start_time).toLocaleTimeString()}),(0,D.jsx)("span",{className:"chat-bg-process-status running-dot",title:e("运行中"),children:"●"})]}),(0,D.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,D.jsx)(I.rA,{icon:"terminal",title:e("查看输出"),onClick:()=>y(s.pid)}),(0,D.jsx)(I.rA,{icon:"stop",title:e("终止进程"),onClick:()=>w(s.pid)})]})]},s.pid)),N.map(e=>(0,D.jsx)("div",{className:`chat-bg-process-item ${l===e.pid?"active":""} finished`,children:(0,D.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,D.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,D.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,D.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,D.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==l&&(0,D.jsxs)("div",{className:"chat-bg-process-output",children:[(0,D.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,D.jsxs)("span",{children:["PID: ",l," ",e("输出")]}),(0,D.jsx)(I.rA,{icon:"close",title:e("关闭"),onClick:()=>{d(null),m(null)}})]}),(0,D.jsx)("div",{className:"chat-bg-process-output-content",children:g?(0,D.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}):u?(0,D.jsx)("pre",{className:"chat-bg-process-output-pre",children:u.output||e("(无输出)")}):null})]})]})]})};function ae(){const{t:e}=(0,o.Bd)(),[s,t]=(0,i.ok)(),j=s.get("session")||"",y=(0,g.y)(),{check_user_auth:S}=(0,u.MH)();(0,_.w)();const[N,k]=(0,n.useState)([]),[C,I]=(0,n.useState)([]),[M,R]=(0,n.useState)(""),[H,K]=(0,n.useState)(null),[T,B]=(0,n.useState)(!1),E=(0,n.useRef)(null),[z,P]=(0,n.useState)([]),[L,F]=(0,a.fp)(x.AG.ai_session_collapsed),[O,q]=(0,a.fp)(x.AG.ai_bg_expanded),[J,U]=(0,a.fp)(x.AG.prompt_card),[Q]=(0,a.fp)(x.AG.ai_chat_zoom),[Z,Y]=(0,n.useState)(!1),[ee,ae]=(0,n.useState)(new Set),[oe,ie]=(0,n.useState)(new Set),[ce,re]=(0,n.useState)(""),le=(0,n.useRef)(null),de=(0,n.useRef)(null),ue=(0,n.useRef)(null),me=(0,n.useRef)(!0),he=(0,n.useRef)(null),ge=(0,n.useRef)(0),pe=(0,n.useRef)(null),_e=(0,n.useRef)(M),xe=(0,n.useRef)(H);(0,n.useEffect)(()=>{_e.current=M},[M]),(0,n.useEffect)(()=>{xe.current=H},[H]);const fe=(0,n.useRef)({}),[je,ve]=(0,n.useState)([]),[be,ye]=(0,n.useState)(""),[we,Se]=(0,n.useState)([]),Ne=async()=>{try{const e=await r.jV.get("public_models");e.code===p.m.Success&&Se(e.data?.groups??[])}catch{Se([])}},ke=e=>{ye(e?.ai_config?.model??"")},[Ce,Ae]=(0,n.useState)(0),$e=(0,n.useRef)((0,l.sg)(e=>{k(e),me.current&&Ie(!1)},50)).current,Ie=(e=!1)=>{const s=ue.current;s&&s.scrollTo({top:s.scrollHeight,behavior:e?"smooth":"auto"})},Me=async()=>{const e=await r.jV.get("sessions");e.code===p.m.Success&&I(e.data??[])},De=function(e){const{getMessages:s,setMessages:t,setMessagesDebounced:a,setSending:o,getActiveSessionId:i,setActiveSessionId:r,refreshSessions:l,scrollToBottom:d,buildRequestMessages:u,getSelectedSysPromptId:m}=e,h=(0,n.useRef)([]),g=(0,n.useRef)(null),p=(e,n,r)=>{const h=[...s(),n];t(h),o(e),g.current={abort:()=>{}};const p={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};h.push(p),t([...h]);const _=new Map;let x=!0,f=p;const j=s=>{const t=s.context||{};if(t.session_id!==e)return;const n=t.text||"",o=t.tool_call_ends,c=t.chunk_index??0;if("[DONE]"!==n)if(x)x=!1,f.text=n,o&&(f.content_list=[{tool_call_ends:o,content:f.text,role:"assistant"}]),f.is_loading=!1,f.chunk_index=c,_.set(c,f),i()===e&&a([...h]);else{const s=_.get(c);if(s)s.text+=n,o&&(s.content_list=[{tool_call_ends:o,content:s.text,role:"assistant"}]),i()===e&&a([...h]);else{const s={id:Date.now()+Math.random(),sender:"bot",text:n,chunk_index:c};o&&(s.content_list=[{tool_call_ends:o,content:s.text,role:"assistant"}]),h.push(s),_.set(c,s),i()===e&&a([...h])}}},v=s=>{const n=s.context||{};if(n.session_id===e){if(y(),g.current=null,o(s=>s===e?null:s),f.is_loading=!1,i()===e)if(n.once_messages_list?.length){const e=w(n.once_messages_list);t(s=>{const t=s[s.length-1];return"bot"===t?.sender?[...s.slice(0,-1),...e]:[...s,...e]})}else t([...h]);l(),d(!0),r()}},b=s=>{const n=s.context||{};n.session_id===e&&(y(),g.current=null,o(s=>s===e?null:s),f.text="AI请求出错: "+(n.message||"未知错误"),f.is_loading=!1,i()===e&&t([...h]),r())},y=()=>{$.ws.off_message(`message_${c.HK.ai_chat_msg}`,j),$.ws.off_message(`message_${c.HK.ai_chat_end}`,v),$.ws.off_message(`message_${c.HK.ai_chat_error}`,b)};$.ws.addMsg(c.HK.ai_chat_msg,j),$.ws.addMsg(c.HK.ai_chat_end,v),$.ws.addMsg(c.HK.ai_chat_error,b),$.ws.sendData(c.HK.ai_chat_req,{messages:u(n),session_id:e,sys_prompt_id:m()})},_=()=>{const e=h.current;if(0===e.length)return;const s=e.shift();if(!s)return;t(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:s.text,attachments:s.attachments};p(i(),n,_)};return{startChatStream:p,processPendingQueue:_,enqueueMessage:(e,s)=>{h.current.push({text:e,attachments:s})},getQueueLength:()=>h.current.length,abort:()=>{const e=i();e&&($.ws.sendData(c.HK.ai_chat_abort,{session_id:e}),g.current&&(g.current=null,o(s=>s===e?null:s)))}}}({getMessages:()=>N,setMessages:k,setMessagesDebounced:$e,setSending:K,getActiveSessionId:()=>_e.current,setActiveSessionId:R,refreshSessions:Me,scrollToBottom:Ie,buildRequestMessages:e=>{const s=(e.attachments??[]).filter(e=>"image"===e.kind);if(s.length>0){const t=[];e.text&&t.push({type:"text",text:e.text});for(const e of s)t.push({type:"image_url",image_url:{url:e.content}});return[{content:t,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>ce}),Re=async e=>{const s=await r.jV.get("sessions");if(s.code!==p.m.Success)return!1;const n=s.data??[];I(n);const a=null===e?n[0]?.id??"":e||M||n[0]?.id||"";return a?await He(a):(k([]),R(""),t(e=>{const s=new URLSearchParams(e);return s.delete("session"),s},{replace:!0}),!1)},He=async(e,s=!1)=>{const n=await r.jV.post("session/get",{session_id:e});if(n.code!==p.m.Success||!n.data)return!1;const a=n.data;R(a.id),j!==a.id&&t(e=>{const s=new URLSearchParams(e);return s.set("session",a.id),s},{replace:!0}),B(!!a.running),pe.current&&pe.current!==a.id&&$.ws.sendData(c.HK.ai_chat_subscribe,{session_id:pe.current,subscribe:!1}),pe.current=a.running?a.id:null,pe.current&&$.ws.sendData(c.HK.ai_chat_subscribe,{session_id:pe.current,subscribe:!0});const o=w(a.messages);return a.running&&a.live_messages?.length?k([...o,...w(a.live_messages)]):k(o),re(a.sys_prompt_id??""),s&&F(!1),te.refresh?.(),requestAnimationFrame(()=>Ie(!1)),!0},Ke=e=>{const s=Array.from(e??[]).filter(Boolean);s.length&&P(e=>[...e,...s])},Te=()=>{Z&&(ae(new Set),ie(new Set)),Y(e=>!e)},Be=()=>{0!==ee.size&&y({sub_title:e("cf_msgs"),confirm_fun:async()=>{const e=[];N.forEach((s,t)=>{ee.has(s.id)&&e.push(t)}),k(N.filter(e=>!ee.has(e.id))),ae(new Set),Y(!1),M&&e.length>0&&r.jV.post("session/message/delete",{session_id:M,indices:e}).catch(console.error)}})};(0,n.useEffect)(()=>((async()=>{const e=await r.XO.get("ai_agent_setting/env");e.code===p.m.Success&&(fe.current=e.data,ke(e.data)),await Ne(),j&&await Re(j)||await Re();const s=await r.jV.get("system_prompts");s.code===p.m.Success&&ve(s.data??[])})(),requestAnimationFrame(()=>Ie(!1)),te.onCountChange=Ae,te.refresh?.(),$.ws.addMsg(c.HK.ai_bg_process_count_notify,e=>{const s=e?.context?.count;"number"==typeof s&&Ae(s)}),()=>{$.ws.removeMsg(c.HK.ai_bg_process_count_notify)}),[]),(0,n.useEffect)(()=>{const e=ue.current;if(!e)return;const s=()=>{me.current=((e,s=120)=>{const{scrollTop:t,scrollHeight:n,clientHeight:a}=e;return n-(t+a)<s})(e)};return e.addEventListener("scroll",s),()=>e.removeEventListener("scroll",s)},[]),(0,n.useEffect)(()=>{const e=()=>_e.current,s=()=>xe.current,t=(t,n)=>{if(e()&&e()===t){if(he.current=null,B(!1),pe.current===t&&($.ws.sendData(c.HK.ai_chat_subscribe,{session_id:t,subscribe:!1}),pe.current=null),s()===t)return;n?.length?k(e=>{const s=w(n),t=e[e.length-1];return"bot"===t?.sender?[...e.slice(0,-1),...s]:[...e,...s]}):He(t).catch(()=>{}),Me()}},n=t=>{const n=t?.context||{};if(!n.session_id)return;var a,o,i;a=n.session_id,o=n.text||"",i=n.tool_call_ends,e()&&e()===a&&s()!==a&&k(e=>{const s=e[e.length-1];if(s&&"bot"===s.sender){const t=[...e],n={...s};return n.text+=o,i&&(n.content_list=[{tool_call_ends:i,content:n.text,role:"assistant"}]),t[t.length-1]=n,he.current=n.id,me.current&&requestAnimationFrame(()=>Ie(!1)),t}const t={id:Date.now()+Math.random(),sender:"bot",text:o};return i&&(t.content_list=[{tool_call_ends:i,content:o,role:"assistant"}]),he.current=t.id,me.current&&requestAnimationFrame(()=>Ie(!1)),[...e,t]});const c=Date.now();c-ge.current>1500&&(ge.current=c,Me())},a=e=>{const s=e?.context||{};s.session_id&&t(s.session_id,s.once_messages_list)},o=e=>{const s=e?.context||{};s.session_id&&t(s.session_id)};return $.ws.addMsg(c.HK.ai_chat_msg,n),$.ws.addMsg(c.HK.ai_chat_end,a),$.ws.addMsg(c.HK.ai_chat_error,o),()=>{$.ws.off_message(`message_${c.HK.ai_chat_msg}`,n),$.ws.off_message(`message_${c.HK.ai_chat_end}`,a),$.ws.off_message(`message_${c.HK.ai_chat_error}`,o),pe.current&&($.ws.sendData(c.HK.ai_chat_subscribe,{session_id:pe.current,subscribe:!1}),pe.current=null)}},[]),(0,n.useLayoutEffect)(()=>{me.current&&Ie(!1)},[N]);return(0,D.jsxs)(n.Fragment,{children:[(0,D.jsx)(G,{currentModelName:be,setCurrentModelName:ye,modelGroups:we,onModelChanged:async()=>{await Ne();const e=await r.XO.get("ai_agent_setting/env");e.code===p.m.Success&&(fe.current=e.data,ke(e.data))},sysPromptList:je,batchMode:Z,selectedMsgCount:ee.size,onToggleSessionPanel:()=>{F(e=>!e)},onCreateSession:async e=>{const s=e??"",t=await r.jV.post("session",{title:"新会话",sys_prompt_id:s||void 0});if(t.code!==p.m.Success)return;const n=t.data;R(n.id),k([]),re(n.sys_prompt_id??""),F(!1),await Re(n.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:Be,bgProcessVisible:O,bgProcessCount:Ce,onToggleBgProcess:()=>q(e=>!e),selectedSysPromptId:ce,setSelectedSysPromptId:e=>{re(e),M&&r.jV.post("session/sys_prompt",{session_id:M,sys_prompt_id:e||void 0}).catch(console.error)}}),(0,D.jsxs)("div",{className:"chat-page chat-page-with-sessions",style:{"--ai-chat-zoom":Q},children:[L&&(0,D.jsx)("div",{className:"chat-session-overlay",onClick:()=>F(!1)}),(0,D.jsx)(W,{sessions:C,activeSessionId:M,onSelectSession:e=>He(e,!1),onReorderSessions:(e,s)=>{const t=C.findIndex(s=>s.id===e),n=C.findIndex(e=>e.id===s);if(t<0||n<0||t===n)return;const a=(0,d.TI)(C,t,n);I(a),r.jV.post("sessions/update/sort",{session_ids:a.map(e=>e.id)}).catch(()=>{})},onRenameSession:(e,s)=>{let t=s;y({confirm_fun:async()=>{await r.jV.post("sessions/update/meta",{id:e,title:t}),await Re(M)},context_div:(0,D.jsx)("div",{className:"card-content",children:(0,D.jsx)(f.Sm,{value:t,handleInputChange:e=>{t=e}})})})},onDeleteSession:e=>{y({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await r.jV.post("session/delete",{session_id:e}),M===e?(R(""),await Re(null)):await Re(M)}})},onToggleCmdAuto:async(s,t)=>{await r.jV.post("session/cmd_auto_allow",{session_id:s,allow:t}),(0,h.SK)(e(t?"命令检测已开启":"命令检测已关闭")),await Re(M)},onShowUsageStats:async s=>{U({open:!0,title:e("Token消耗统计"),context_div:(0,D.jsx)("div",{className:"usage-stats-loading",children:e("加载中...")}),cancel:()=>U({open:!1})});try{const t=await r.jV.post("session/usage_stats",{session_id:s});if(t.code===p.m.Success&&t.data){const s=t.data;U({open:!0,title:e("Token消耗统计"),context_div:(0,D.jsxs)("div",{className:"usage-stats-panel",children:[[{l:e("对话轮次"),v:(s.turns??0).toString()},{l:e("AI输入Token"),v:v(s.input_tokens)},{l:e("AI输出Token"),v:v(s.output_tokens)},{l:e("AI输入Token(最近一轮)"),v:v(s.recent_input_tokens)},{l:e("AI输出Token(最近一轮)"),v:v(s.recent_output_tokens)}].map((e,s)=>(0,D.jsxs)("div",{className:"usage-stats-row",children:[(0,D.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,D.jsx)("span",{className:"usage-stats-value",children:e.v})]},s)),(0,D.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,D.jsx)("span",{className:"usage-stats-label",children:e("AI Token总计消耗")}),(0,D.jsx)("span",{className:"usage-stats-value",children:v((s.input_tokens||0)+(s.output_tokens||0))})]})]}),cancel:()=>U({open:!1})})}else U({open:!0,title:e("Token消耗统计"),context_div:(0,D.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>U({open:!1})})}catch{U({open:!0,title:e("Token消耗统计"),context_div:(0,D.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>U({open:!1})})}},batchMode:Z,selectedSessionIds:oe,onToggleSessionSelect:e=>{ie(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onToggleBatchMode:Te,onBatchDeleteSessions:()=>{0!==oe.size&&y({sub_title:e("cf_ses"),confirm_fun:async()=>{for(const e of oe)await r.jV.post("session/delete",{session_id:e});ie(new Set),Y(!1),oe.has(M)?(R(""),await Re(null)):await Re(M)}})},onClearAllSessions:()=>{y({sub_title:e("cf_all"),confirm_fun:async()=>{await r.jV.post("sessions/clear",{}),R(""),k([]),await Re(null)}})}}),(0,D.jsx)(ne,{}),(0,D.jsxs)("section",{className:"chat-main",children:[0===N?.length&&(0,D.jsx)("div",{className:"chat-header",children:(0,D.jsx)("div",{children:e("ai_ask")})}),(0,D.jsx)(X,{messages:N,batchMode:Z,selectedMsgIds:ee,sending:H===M||T,chatContainerRef:ue,messagesEndRef:de,onToggleMsgSelect:e=>{ae(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onDelete:s=>{y({sub_title:e("cf_one"),confirm_fun:async()=>{const e=N.findIndex(e=>e.id===s);if(e<0)return;const t=N.filter(e=>e.id!==s);k(t),M&&r.jV.post("session/message/delete",{session_id:M,indices:[e]}).catch(console.error)}})},onCopy:async e=>{(0,m.lW)(b(e)),(0,h.SK)("复制成功")},onCopyAll:async()=>{if(!C.length)return void(0,h.SK)("暂无聊天记录");const e=[];for(const s of C){const t=await r.jV.post("session/get",{session_id:s.id});if(t.code!==p.m.Success||!t.data)continue;const n=t.data,a=w([...n.messages??[],...n.live_messages??[]]).map(b).filter(Boolean).join("\n\n\n");a&&e.push(a)}e.length?((0,m.lW)(e.join("\n\n\n")),(0,h.SK)("复制成功")):(0,h.SK)("暂无聊天记录")},onToggleBatchMode:Te,onBatchCopy:()=>{const e=N.filter(e=>ee.has(e.id)).map(b).filter(Boolean).join("\n\n\n");e?((0,m.lW)(e),(0,h.SK)("复制成功")):(0,h.SK)("暂无内容")},onBatchDelete:Be,showBatchBar:Z&&ee.size>0&&0===oe.size,t:e}),(0,D.jsx)(se,{ref:E,onSend:async()=>{const e=(E.current?.getValue()??"").trim();if(!e&&0===z.length)return;if(H===M){const s=await A(z);De.enqueueMessage(e,s),E.current?.clear(),P([]);const t={id:Date.now(),sender:"user",text:e+(De.getQueueLength()>1?" ⏳(排队中...)":""),attachments:s};return void k(e=>[...e,t])}let s=M;if(!s){const t=await r.jV.post("session",{title:(e||z[0]?.name||"新会话").slice(0,28),sys_prompt_id:void 0});if(t.code!==p.m.Success)return;s=t.data.id,R(s),await Re(s)}const t=await A(z),n={id:Date.now(),sender:"user",text:e,attachments:t};E.current?.clear(),P([]);const a=fe?.current?.ai_config?.request_type||"completions";if("completions"!==a){const t={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},o=[...N,n,t];k(o),K(s);return void(await V(a,e,s,async(e,s)=>{t.text=e,t.is_loading=!1,s?.images&&(t.images=s.images),s?.audio&&(t.audio=s.audio),s?.embeddings&&(t.embeddings=s.embeddings),k([...o]),K(null),Me(),Ie(!0),De.processPendingQueue()})||(t.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,t.is_loading=!1,k([...o]),K(null),De.processPendingQueue()))}De.startChatStream(s,n,()=>De.processPendingQueue())},sending:H===M||T,onAbort:De.abort,pendingAttachments:z,onRemoveAttachment:e=>{P(s=>s.filter((s,t)=>t!==e))},onOpenFilePicker:()=>{le.current?.click()},onAddFiles:Ke,onDrop:e=>{const s=e.dataTransfer?.files;s&&s.length>0&&(e.preventDefault(),Ke(s))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:le})]})]})]})}},72693(e,s,t){t.d(s,{w:()=>h});var n=t(96540),a=t(22022),o=t(14944),i=t(92275),c=t(34843),r=t(82893),l=t(85997),d=t(14284),u=t(74848);function m(e){const{t:s}=(0,a.Bd)(),[t,o]=(0,n.useState)(!1),i=!!e.sessionId;return(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),i&&(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5em",marginBottom:"0.75em",color:t?"var(--icon-blue)":"var(--textSecondary)"},children:[(0,u.jsx)(l.Ay,{checked:t,onChange:s=>{o(s),s&&e.onAutoAllow()},title:s("此会话不再询问")}),(0,u.jsx)("span",{children:s("此会话不再询问")})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,u.jsx)(l.$n,{text:s("拒绝"),color:"var(--red)",clickFun:e.onDeny}),(0,u.jsx)(l.$n,{text:s("允许"),clickFun:e.onAllow})]})]})}function h(){const[e,s]=(0,c.fp)(r.AG.prompt_card),{t}=(0,a.Bd)(),l=(0,n.useRef)([]),h=(0,n.useRef)(!1),g=(0,n.useRef)(null),p=(0,n.useRef)(void 0),_=(0,n.useRef)(()=>{}),x=(0,n.useCallback)(e=>{s({open:!1}),h.current=!1,g.current&&(o.ws.sendData(i.HK.ai_confirm_cmd,{askId:g.current,approved:e}),g.current=null),_.current()},[s]),f=(0,n.useCallback)(()=>{if(h.current)return;if(0===l.current.length)return h.current=!1,void s({open:!1});h.current=!0;const e=l.current.shift();e?(g.current=e.askId,p.current=e.session_id,s({open:!0,title:t("命令确认"),cancel:()=>x(!1),context_div:(0,u.jsx)(m,{cmd:e.cmd,sessionId:e.session_id,onDeny:()=>x(!1),onAllow:()=>x(!0),onAutoAllow:async()=>{if(p.current)try{await d.jV.post("session/cmd_auto_allow",{session_id:p.current,allow:!0})}catch(e){console.error("设置会话命令免确认失败",e)}x(!0)}})})):h.current=!1},[t,x,s]);_.current=f;const j=(0,n.useCallback)(e=>{l.current.push(e),f()},[f]);(0,n.useEffect)(()=>(o.ws.addMsg(i.HK.ai_confirm_cmd,e=>{const t=e.context||{};if(t.dismiss&&t.askId)return l.current=l.current.filter(e=>e.askId!==t.askId),void(h.current&&g.current===t.askId&&(g.current=null,h.current=!1,s({open:!1}),f()));t.askId&&t.cmd&&j({askId:t.askId,cmd:t.cmd,session_id:t.session_id})}),()=>{o.ws.removeMsg(i.HK.ai_confirm_cmd)}),[j]),(0,n.useEffect)(()=>()=>{l.current=[],h.current=!1,g.current=null},[])}},34299(e,s,t){t.r(s),t.d(s,{default:()=>b});var n=t(96540),a=t(23802),o=t(53995),i=t(18569),c=t(77979),r=t(8263),l=t(69428),d=t.n(l),u=(t(3775),t(21499)),m=t(99214),h=t(89117),g=t(89334),p=t(41105),_=t(52388),x=t(19878),f=(t(72411),t(74848));const j=new a.A({html:!0,highlight:function(e,s){if(s&&x.A.getLanguage(s))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${s}">${x.A.highlight(e,{language:s}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${x.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${j.utils.escapeHtml(e)}</code></pre>`}});function v(e){const s=e.className.match(/language-([\w-]+)/);return s?s[1]:""}function b(e){const s=(0,n.useRef)(null);return(0,m.VD)(),(0,n.useEffect)(()=>{s.current&&(!async function(e){const s=e.querySelectorAll("pre > code[class*='language-']");for(const e of Array.from(s)){const s=v(e);if(!(0,h.Hm)(s))continue;const t=e.closest(".code-block-with-copy")??e.parentElement;if(!t)continue;const n=e.textContent??"",a=document.createElement("div");a.className="md-graph md-graph--loading",a.textContent=_.A.t("rendering"),t.replaceWith(a);const o=await(0,h.U6)(s,n);a.isConnected&&(o.error?(a.className="md-graph md-graph--error",a.textContent=o.error):(a.className="md-graph",a.innerHTML=o.svg))}}(s.current),(0,g.rg)(s.current))},[e.context]),(0,f.jsx)("div",{ref:s,dangerouslySetInnerHTML:{__html:j.render(e.context)}})}j.use(o.A).use(i.A).use(c.A).use(r.A).use(d()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(s,t,n,a,o)=>{const i=s[t],c=i.content.trim(),r=i.info.trim();let l="";if(r&&x.A.getLanguage(r))try{l=x.A.highlight(c,{language:r}).value}catch(s){l=e.utils.escapeHtml(c)}else try{l=x.A.highlightAuto(c).value}catch(s){l=e.utils.escapeHtml(c)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${r||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(c)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${l}</code></pre>\n </div>`}}).use(e=>{const s=e.renderer.rules.link_open||function(e,s,t,n,a){return a.renderToken(e,s,t)};e.renderer.rules.link_open=(e,t,n,a,o)=>{const i=e[t],c=i.attrIndex("href");if(c>=0){const e=i.attrs[c][1];i.attrs[c][1]=(0,u.bi)(window.location.href,e)}return s(e,t,n,a,o)}}),(0,g.Rh)(j,p.pC)},84369(e,s,t){t.d(s,{y:()=>i});var n=t(96540),a=t(2543);function o(e){if(void 0!==e)return"function"==typeof e?e():e}function i(e){const{direction:s="vertical",target_ref:t,get_start_size:i,px_to_unit:c,min:r,max:l,throttle:d,on_change:u,on_drag_end:m}=e,[h,g]=(0,n.useState)(!1),p=(0,n.useRef)(null),_=(0,n.useRef)(u);_.current=u;const x=e=>"vertical"===s?e.clientY:e.clientX,f=(0,n.useRef)({direction:s,get_start_size:i,px_to_unit:c,min:r,max:l,get_pos:x});f.current={direction:s,get_start_size:i,px_to_unit:c,min:r,max:l,get_pos:x};const j=(0,n.useCallback)(e=>{const s=p.current;if(!s)return;const{px_to_unit:t,min:n,max:a,get_pos:i}=f.current,c=s.pos-i(e);let r=s.size+t(c);const l=o(n),d=o(a);void 0!==l&&(r=Math.max(l,r)),void 0!==d&&(r=Math.min(d,r)),_.current(r)},[]),v=n.useMemo(()=>void 0===d?j:a.throttle(e=>j(e),d),[d,j]),b=(0,n.useCallback)(()=>{p.current=null,g(!1);const e=v;"function"==typeof e.cancel&&e.cancel(),m?.()},[v,m]),y=(0,n.useCallback)(e=>{const{get_start_size:s,get_pos:t}=f.current;p.current={pos:t(e),size:s()},g(!0)},[]);return(0,n.useEffect)(()=>{if(!h)return;const e=t?.current??window;return e.addEventListener("pointermove",v),e.addEventListener("pointerup",b),()=>{e.removeEventListener("pointermove",v),e.removeEventListener("pointerup",b)}},[h,v,b,t]),(0,n.useEffect)(()=>{const e=v;return()=>{"function"==typeof e.cancel&&e.cancel()}},[v]),{dragging:h,on_pointer_down:y,on_pointer_up:b}}},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3233,5614],{33616(e){var n;self,n=()=>(()=>{"use strict";var e,n={};return e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const n=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(n._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,n=e._renderService.dimensions;if(0===n.css.cell.width||0===n.css.cell.height)return;const t=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),l=o-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),a=i-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(a/n.css.cell.width)),rows:Math.max(1,Math.floor(l/n.css.cell.height))}}},n})(),e.exports=n()},40654(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>E});var r=t(96540),o=t(33616),i=(t(97856),t(85072)),s=t.n(i),l=t(97825),a=t.n(l),c=t(77659),d=t.n(c),u=t(55056),m=t.n(u),p=t(10540),h=t.n(p),x=t(41113),f=t.n(x),g=t(86739),v={};v.styleTagTransform=f(),v.setAttributes=m(),v.insert=d().bind(null,"head"),v.domAPI=a(),v.insertStyleElement=h();s()(g.A,v);g.A&&g.A.locals&&g.A.locals;var y=t(40505),_=t(62042),b=t(84369),w=t(74848);function E(e){const[n,t]=(0,r.useState)(25),i=(0,r.useRef)(null),s=(0,r.useCallback)(new o.FitAddon,[]),l=(0,r.useRef)(null),a=(0,r.useRef)(null),{dragging:c,on_pointer_down:d,on_pointer_up:u}=(0,b.y)({direction:"vertical",target_ref:l,get_start_size:()=>n,px_to_unit:e=>e/parseFloat(getComputedStyle(l.current).fontSize),min:()=>{const e=parseFloat(getComputedStyle(l.current).fontSize);return 2.25+i.current.offsetHeight/e},max:()=>{const e=parseFloat(getComputedStyle(l.current).fontSize);return window.innerHeight/e-4},throttle:32,on_change:e=>{s.fit(),t(parseFloat(e.toFixed(2)))}});if((0,r.useEffect)(()=>{e.terminal&&(e.terminal.options.convertEol=!0,e.terminal.open(a.current),e.terminal.loadAddon(s),s.fit(),e.init&&e.init(e.terminal.rows,e.terminal.cols),e.terminal.attachCustomKeyEventHandler(n=>{if(n.ctrlKey&&"c"===n.key){const t=e.terminal.getSelection();if(t)return(0,y.lW)(t),(0,_.SK)("已复制"),n.preventDefault(),e.terminal.focus(),!1}else if("keydown"===n.type&&"v"===n.key&&n.ctrlKey)return!1;return!0}))},[e.terminal]),(0,r.useEffect)(()=>()=>{e.terminal&&e.terminal.dispose()},[]),e.show)return e.get_simple?(0,w.jsx)("div",{className:"pty",style:{height:"100%"},ref:a}):(0,w.jsxs)("div",{className:"shell",style:{height:`${n}em`,display:""+(e.file_shell_hidden?"none":"block")},ref:l,children:[(0,w.jsx)("div",{className:"shell__divider",ref:i,onPointerDown:d,onPointerUp:u}),(0,w.jsx)("div",{className:"pty",style:{height:n-1+"em"},ref:a}),c&&(0,w.jsx)("div",{className:"shell__overlay",onPointerUp:u})]})}},85614(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>s});var r=t(96540),o=(t(40654),t(74848));const i=r.lazy(()=>Promise.resolve().then(t.bind(t,40654)));function s(e){return(0,o.jsx)(r.Fragment,{children:(0,o.jsx)(i,{...e})})}},84369(e,n,t){"use strict";t.d(n,{y:()=>s});var r=t(96540),o=t(2543);function i(e){if(void 0!==e)return"function"==typeof e?e():e}function s(e){const{direction:n="vertical",target_ref:t,get_start_size:s,px_to_unit:l,min:a,max:c,throttle:d,on_change:u,on_drag_end:m}=e,[p,h]=(0,r.useState)(!1),x=(0,r.useRef)(null),f=(0,r.useRef)(u);f.current=u;const g=e=>"vertical"===n?e.clientY:e.clientX,v=(0,r.useRef)({direction:n,get_start_size:s,px_to_unit:l,min:a,max:c,get_pos:g});v.current={direction:n,get_start_size:s,px_to_unit:l,min:a,max:c,get_pos:g};const y=(0,r.useCallback)(e=>{const n=x.current;if(!n)return;const{px_to_unit:t,min:r,max:o,get_pos:s}=v.current,l=n.pos-s(e);let a=n.size+t(l);const c=i(r),d=i(o);void 0!==c&&(a=Math.max(c,a)),void 0!==d&&(a=Math.min(d,a)),f.current(a)},[]),_=r.useMemo(()=>void 0===d?y:o.throttle(e=>y(e),d),[d,y]),b=(0,r.useCallback)(()=>{x.current=null,h(!1);const e=_;"function"==typeof e.cancel&&e.cancel(),m?.()},[_,m]),w=(0,r.useCallback)(e=>{const{get_start_size:n,get_pos:t}=v.current;x.current={pos:t(e),size:n()},h(!0)},[]);return(0,r.useEffect)(()=>{if(!p)return;const e=t?.current??window;return e.addEventListener("pointermove",_),e.addEventListener("pointerup",b),()=>{e.removeEventListener("pointermove",_),e.removeEventListener("pointerup",b)}},[p,_,b,t]),(0,r.useEffect)(()=>{const e=_;return()=>{"function"==typeof e.cancel&&e.cancel()}},[_]),{dragging:p,on_pointer_down:w,on_pointer_up:b}}},86739(e,n,t){"use strict";t.d(n,{A:()=>l});var r=t(31601),o=t.n(r),i=t(76314),s=t.n(i)()(o());s.push([e.id,'/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * https://github.com/chjj/term.js\n * @license MIT\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the "Software"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * Originally forked from (with the author\'s permission):\n * Fabrice Bellard\'s javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n */\n\n/**\n * Default styles for xterm.js\n */\n\n.xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.xterm.focus,\n.xterm:focus {\n outline: none;\n}\n\n.xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /**\n * The z-index of the helpers must be higher than the canvases in order for\n * IMEs to appear on top.\n */\n z-index: 5;\n}\n\n.xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Move textarea out of the screen to the far left, so that the cursor is not visible */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n /** Prevent wrapping so the IME appears against the textarea at the correct position */\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n}\n\n.xterm .composition-view {\n /* TODO: Composition position got messed up somewhere */\n background: #000;\n color: #FFF;\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n}\n\n.xterm .composition-view.active {\n display: block;\n}\n\n.xterm .xterm-viewport {\n /* On OS X this is required in order for the scroll bar to appear fully opaque */\n background-color: #000;\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n}\n\n.xterm .xterm-screen {\n position: relative;\n}\n\n.xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.xterm .xterm-scroll-area {\n visibility: hidden;\n}\n\n.xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n}\n\n.xterm.enable-mouse-events {\n /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */\n cursor: default;\n}\n\n.xterm.xterm-cursor-pointer,\n.xterm .xterm-cursor-pointer {\n cursor: pointer;\n}\n\n.xterm.column-select.focus {\n /* Column selection mode */\n cursor: crosshair;\n}\n\n.xterm .xterm-accessibility:not(.debug),\n.xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n}\n\n.xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n}\n\n.xterm .xterm-accessibility-tree {\n user-select: text;\n white-space: pre;\n}\n\n.xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.xterm-dim {\n /* Dim should not apply to background, so the opacity of the foreground color is applied\n * explicitly in the generated class and reset to 1 here */\n opacity: 1 !important;\n}\n\n.xterm-underline-1 { text-decoration: underline; }\n.xterm-underline-2 { text-decoration: double underline; }\n.xterm-underline-3 { text-decoration: wavy underline; }\n.xterm-underline-4 { text-decoration: dotted underline; }\n.xterm-underline-5 { text-decoration: dashed underline; }\n\n.xterm-overline {\n text-decoration: overline;\n}\n\n.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n.xterm-strikethrough {\n text-decoration: line-through;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration {\n\tz-index: 6;\n\tposition: absolute;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n\tz-index: 7;\n}\n\n.xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n}\n\n.xterm-decoration-top {\n z-index: 2;\n position: relative;\n}\n',""]);const l=s}}]);
|
package/build/dist/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><base href="/"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.
|
|
1
|
+
<!doctype html><html lang="en"><head><base href="/"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.7a6fed9f5f814a194409.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>
|