filecat 6.66.0 → 6.67.0

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.
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1458],{91458(e,t,r){r.r(t),r.d(t,{default:()=>Oe});var n=r(96540),s=r(34843),o=r(82893),a=r(85997),c=r(57952),l=r(62042),i=r(53459),u=r(14284),d=r(57889),h=r(86149),m=r(42845),f=r(1575),p=r(89781),g=r(61396),v=r(46762),b=r(73337),k=r(89552),_=r(86059),w=r(58903);const y=(0,_.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),x={align:{default:null}},M={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:x,parseDOM:[{tag:"p"}],toDOM:e=>["p",e.attrs.align?{style:`text-align:${e.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...x},defining:!0,parseDOM:[1,2,3,4,5,6].map(e=>({tag:`h${e}`,attrs:{level:e}})),toDOM(e){const t=e.attrs.align?{style:`text-align:${e.attrs.align}`}:{};return[`h${e.attrs.level}`,t,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:e=>({order:Number(e.getAttribute("start")??1)})}],toDOM:e=>1===e.attrs.order?["ol",0]:["ol",{start:e.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:e=>{const t=e,r=t.querySelector("input[type=checkbox]");if(r)return{checked:r.checked};const n=t.getAttribute("data-checked");return{checked:null===n?null:"true"===n}}}],toDOM:e=>null!==e.attrs.checked?["li",{"data-checked":String(e.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{const t=e.querySelector("code"),r=/language-([\w-]+)/.exec(t?.className??"");return{language:r?r[1]:""}}}],toDOM:e=>["pre",{"data-language":e.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:e=>{const t=e;return{src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title")}}}],toDOM(e){const{src:t,alt:r,title:n}=e.attrs,s={src:t};return r&&(s.alt=r),n&&(s.title=n),["img",s]}},text:{group:"inline"},...y},$={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:e=>"PRE"!==e.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{const t=e;return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(e){const{href:t,title:r}=e.attrs;return["a",{href:t,title:r,rel:"noopener noreferrer",target:"_blank"},0]}}},S=new w.Sj({nodes:M,marks:$});const j=new(r(22091).A)({html:!0,linkify:!0,breaks:!1,typographer:!1});function E(e){const t=j.render(e??""),r=document.createElement("div");return r.innerHTML=t,w.S4.fromSchema(S).parse(r)}function D(e){let t="";return e.forEach(e=>{if(e.isText){let r=e.marks.some(e=>"code"===e.type.name)?e.text??"":function(e){return e.replace(/([\\`*_[\]<>])/g,"\\$1")}(e.text??"");for(const t of e.marks)switch(t.type.name){case"code":r=`\`${e.text??""}\``;break;case"strong":r=`**${r}**`;break;case"em":r=`*${r}*`;break;case"strike":r=`~~${r}~~`;break;case"link":r=`[${r}](${t.attrs.href}${t.attrs.title?` "${t.attrs.title}"`:""})`}t+=r}else if("image"===e.type.name){const{src:r,alt:n,title:s}=e.attrs;t+=`![${n??""}](${r}${s?` "${s}"`:""})`}else"hard_break"===e.type.name&&(t+=" \n")}),t}function A(e){const t=[];if(e.forEach(e=>{const r=[],n=[];e.forEach(e=>{var t;r.push((t=e.textContent,t.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),n.push("table_header"===e.type.name)}),t.push({cells:r,header_flags:n})}),0===t.length)return"";const r=Math.max(...t.map(e=>e.cells.length)),n=t[0].header_flags.some(e=>e),s=Array.from({length:r},(e,r)=>Math.max(3,...t.map(e=>O(e.cells[r]??"")))),o=e=>`| ${Array.from({length:r},(t,r)=>{return n=e[r]??"",o=s[r],n+" ".repeat(Math.max(0,o-O(n)));var n,o}).join(" | ")} |`,a=[];if(n){a.push(o(t[0].cells)),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(let e=1;e<t.length;e++)a.push(o(t[e].cells))}else{a.push(o(new Array(r).fill(""))),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(const e of t)a.push(o(e.cells))}return a.join("\n")}function O(e){let t=0;for(const r of e){const e=r.codePointAt(0)??0;t+=e>=4352&&e<=4447||e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510?2:1}return t}function C(e,t=""){switch(e.type.name){case"paragraph":default:return t+D(e);case"heading":return`${t}${"#".repeat(e.attrs.level)} ${D(e)}`;case"blockquote":return L(e,"").split("\n").map(e=>`${t}> ${e}`).join("\n");case"code_block":{const r=e.attrs.language??"";return`${t}\`\`\`${r}\n${e.textContent}\n${t}\`\`\``}case"horizontal_rule":return`${t}---`;case"bullet_list":{const r=[];return e.forEach((e,n,s)=>{r.push(N(e,t,`${t}- `,`${t} `,s))}),r.join("\n")}case"ordered_list":{const r=[],n=e.attrs.order??1;return e.forEach((e,s,o)=>{r.push(N(e,t,`${t}${n+o}. `,`${t} `,o))}),r.join("\n")}case"table":return A(e).split("\n").map(e=>t+e).join("\n")}}function N(e,t,r,n,s){const o=e.attrs.checked,a=null===o?"":o?"[x] ":"[ ] ",c=[];e.forEach((e,t,r)=>{c.push(C(e,0===r?"":n))});const l=c.join("\n").split("\n");return r+a+l[0]+(l.length>1?"\n"+l.slice(1).join("\n"):"")}function L(e,t=""){const r=[];return e.forEach(e=>{r.push(C(e,t))}),r.join("\n\n")}function R(e){return L(e).trim()+"\n"}var z=r(74848);function q(e){const{t}=(0,h.B)(),[r,s]=(0,n.useState)(new Set),o=(0,n.useMemo)(()=>function(e){const t=[],r=[];for(const n of e){const e={...n,children:[]};for(;r.length>0&&r[r.length-1].level>=e.level;)r.pop();0===r.length?t.push(e):r[r.length-1].children.push(e),r.push(e)}return t}(e.items),[e.items]),a=(n,o)=>n.map(n=>{const c=n.children.length>0,l=r.has(n.pos),i=n.pos===e.active_pos;return(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:`md-outline-item md-outline-item--h${n.level}${i?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:n.text,onClick:()=>e.on_click(n),children:[(0,z.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?e=>{return t=n.pos,e.stopPropagation(),void s(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r});var t}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,z.jsx)("span",{className:"md-outline-text",children:n.text||t("未命名标题")})]}),c&&!l&&a(n.children,o+1)]},n.pos)});return 0===e.items.length?(0,z.jsxs)("div",{className:"md-outline md-outline--empty",children:[(0,z.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,z.jsx)("div",{className:"md-outline-tip",children:t("正文里还没有标题")})]}):(0,z.jsxs)("div",{className:"md-outline",children:[(0,z.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,z.jsx)("div",{className:"md-outline-list",children:a(o,0)})]})}var I=r(38341),T=r(3772);function B(){const e=S;return(0,I.sM)({rules:[(0,I.JJ)(/^(#{1,6})\s$/,e.nodes.heading,e=>({level:e[1].length})),(0,I.JJ)(/^```([\w-]*)\s$/,e.nodes.code_block,e=>({language:e[1]??""})),(0,I.tG)(/^\s*>\s$/,e.nodes.blockquote),(0,I.tG)(/^\s*([-+*])\s$/,e.nodes.bullet_list),(0,I.tG)(/^(\d+)\.\s$/,e.nodes.ordered_list,e=>({order:Number(e[1])})),...I.Fr,I.gO]})}function P(e){return(t,r)=>{const n=t.schema.marks[e];return!!n&&(0,v.wh)(n)(t,r)}}function W(e,t={}){return(r,n)=>{const s=r.schema.nodes[e];if(!s)return!1;const{$from:o,$to:a}=r.selection,c=o.blockRange(a);if(!c)return!1;const l=o.parent,i=l.type===s&&Object.entries(t).every(([e,t])=>l.attrs[e]===t),u=i?r.schema.nodes.paragraph:s,d=i?{}:t;return n&&n(r.tr.setBlockType(c.start,c.end,u,d)),!0}}const F=(e,t)=>(0,T.Sd)(e.schema.nodes.bullet_list)(e,t),G=(e,t)=>(0,T.Sd)(e.schema.nodes.ordered_list)(e,t),H=(e,t)=>{const{blockquote:r}=e.schema.nodes,{$from:n,$to:s}=e.selection,o=n.blockRange(s);if(!o)return!1;if(o.parent.type===r&&o.depth>0){const r=n.before(o.depth),s=e.tr.doc.nodeAt(r);if(s&&1===s.childCount)return t&&t(e.tr.replaceWith(r,r+s.nodeSize,s.child(0)).scrollIntoView()),!0;if(t){const r=e.tr,s=n.parent,a=n.after(o.depth);r.delete(o.start,o.end),r.insert(a,s),t(r.scrollIntoView())}return!0}return t&&t(e.tr.wrap(o,[{type:r}]).scrollIntoView()),!0},U={sink:(0,T.$B)(S.nodes.list_item),lift:(0,T.T2)(S.nodes.list_item),split:(0,T.wn)(S.nodes.list_item),wrap_bullet:F,wrap_ordered:G};r(41631),r(50576),r(70432);function V(e){return 0===e?W("paragraph"):W("heading",{level:e})}function J(e){return!(!e.ctrlKey&&!e.metaKey)}function K(e,t){return(0,_.D8)(1)(e,t)}const X=n.forwardRef(function(e,t){const r=(0,n.useRef)(null),s=(0,n.useRef)(null),o=(0,n.useRef)(e.on_change),a=(0,n.useRef)(e.on_save),c=(0,n.useRef)(e.on_selection_change);return(0,n.useEffect)(()=>{o.current=e.on_change,a.current=e.on_save,c.current=e.on_selection_change}),(0,n.useEffect)(()=>{if(!r.current)return;const n=m.$t.create({doc:E(e.value??""),plugins:[B(),(0,g.w)({"Mod-b":P("strong"),"Mod-i":P("em"),"Mod-Shift-x":P("strike"),"Mod-`":P("code"),"Mod-1":(e,t)=>V(1)(e,t),"Mod-2":(e,t)=>V(2)(e,t),"Mod-3":(e,t)=>V(3)(e,t),"Mod-0":(e,t)=>V(0)(e,t),"Mod-Shift-8":F,"Mod-Shift-9":G,"Mod-Shift-.":H,Tab:U.sink,"Shift-Tab":U.lift,"Mod-Enter":K,"Mod-s":()=>(a.current?.(),!0)}),(0,_.LF)({allowTableNodeSelection:!0}),(0,_.AL)(),(0,b.A)({color:"var(--primary, #1a73e8)",width:2}),(0,k.z)(),(0,p.b6)(),(0,g.w)({Enter:(0,v.st)(v.pC,U.split,v.Z1,v.iz,v.aw),"Shift-Enter":(e,t)=>{const{hard_break:r}=e.schema.nodes;return t&&t(e.tr.replaceSelectionWith(r.create()).scrollIntoView()),!0},"Mod-Enter":v.I$}),(0,g.w)(v.RV)]}),l=new f.Lz(r.current,{state:n,editable:()=>!1!==e.editable,handleClickOn(e,t,r,n,s){if(!J(s))return!1;const o=function(e){if(!(e instanceof Element))return null;const t=e.closest("a[href]"),r=t?.getAttribute("href");return r||null}(s.target)??function(e,t){const r=e.doc.content.size,n=Math.max(0,Math.min(t,r));let s;try{s=e.doc.resolve(n)}catch{return null}for(const t of[1,-1]){const s=1===t?n:n-1;if(!(s<0||s>=r))try{const t=e.doc.resolve(s).marks().find(e=>"link"===e.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}}try{const e=s.parent.marks.find(e=>"link"===e.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}return null}(e.state,t);return!!o&&(window.open(o,"_blank","noopener,noreferrer"),!0)},handleDOMEvents:{keydown:(e,t)=>(J(t)&&e.dom.classList.add("md-ctrl-down"),!1),keyup:(e,t)=>(J(t)||e.dom.classList.remove("md-ctrl-down"),!1),blur:e=>(e.dom.classList.remove("md-ctrl-down"),!1)},dispatchTransaction(e){const t=l.state.apply(e);l.updateState(t),e.docChanged&&o.current?.(R(t.doc)),(e.selectionSet||e.docChanged)&&c.current?.()},attributes:{class:"md-wysiwyg-content",spellcheck:"false"}});s.current=l;const i={get_markdown:()=>R(l.state.doc),set_markdown:e=>{const t=E(e);l.dispatch(l.state.tr.replaceWith(0,l.state.doc.content.size,t.content))},focus:()=>l.focus(),get_view:()=>s.current,in_table:()=>function(e){const{$from:t}=e.selection;for(let e=t.depth;e>0;e--){if("table"===t.node(e).type.name)return!0}return!1}(l.state),active_marks:()=>(l.state.storedMarks??l.state.selection.$from.marks()).map(e=>e.type.name),active_block:()=>{const{$from:e}=l.state.selection;for(let t=e.depth;t>0;t--){const r=e.node(t);if("heading"===r.type.name)return{name:"heading",level:r.attrs.level};if("paragraph"===r.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(e=3,t=3)=>{const r=function(e,t,r){const n=(0,_.e)(e),s=n.table,o=n.row,a=n.cell,c=n.header_cell??n.cell;if(!s||!o||!a)return null;const l=e=>o.create(null,Array.from({length:t},()=>e.createAndFill())),i=l(c),u=Array.from({length:r},()=>l(a));return s.create(null,[i,...u])}(l.state.schema,e,t);if(!r)return;const{from:n}=l.state.selection,s=l.state.doc.resolve(n);let o=n;for(let e=s.depth;e>0;e--)if("table"===s.node(e).type.name){o=s.after(e);break}const a=l.state.tr;o===n?a.replaceSelectionWith(r):a.insert(o,r),l.dispatch(a.scrollIntoView());const c=l.state.doc.resolve(Math.min(o+3,l.state.doc.content.size));try{l.dispatch(l.state.tr.setSelection(l.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(e){const t=[];return e.doc.descendants((e,r)=>("heading"!==e.type.name||t.push({level:e.attrs.level,text:e.textContent,pos:r}),!0)),t}(l.state),scroll_to_pos:e=>{const t=l.state.doc.content.size,r=Math.max(0,Math.min(e,t)),n=l.state.doc.nodeAt(r);let s;try{s=n?m.U3.near(l.state.doc.resolve(r+1),1):m.U3.near(l.state.doc.resolve(r),1)}catch{s=m.U3.near(l.state.doc.resolve(0),1)}l.dispatch(l.state.tr.setSelection(s).scrollIntoView()),l.focus()}};return"function"==typeof t?t(i):t&&(t.current=i),e.on_ready?.(i),()=>{l.destroy(),s.current=null}},[]),(0,z.jsx)("div",{className:"md-wysiwyg",ref:r})});function Y(e){const{t}=(0,h.B)(),r=(0,n.useRef)(null),[s,o]=(0,n.useState)({marks:[],block:{name:"paragraph"}}),[a,c]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{const t=e.get_view();if(!t)return;const r=t.state.selection,n=t.state.storedMarks??r.$from.marks();if(o({marks:n.map(e=>e.type.name),block:Z(r.$from)}),r.empty)return void c(null);const s=t.coordsAtPos(r.from),a=t.coordsAtPos(r.to),l=(Math.min(s.left,a.left)+Math.max(s.right,a.right))/2,i=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom);c({top:i,bottom:u,left:l})},[e.get_view]);(0,n.useEffect)(()=>{l();const t=e.get_view();if(!t)return;const r=()=>l();t.dom.addEventListener("keyup",r),t.dom.addEventListener("mouseup",r),document.addEventListener("selectionchange",r);const n=t.dom.closest(".md-editor-context");return n?.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{t.dom.removeEventListener("keyup",r),t.dom.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",r),n?.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[l,e.get_view,e.refresh_key]);const i=t=>{const r=e.get_view();r&&(t(r.state,r.dispatch),r.focus(),l())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,n.useState)({w:0,h:36});if((0,n.useLayoutEffect)(()=>{if(!a||!r.current)return;const e=r.current.offsetWidth,t=r.current.offsetHeight;f(r=>r.w===e&&r.h===t?r:{w:e,h:t})},[a,e.refresh_key]),!a)return null;const p=(e,r,n,s,o=!1)=>(0,z.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(n),onMouseDown:e=>e.preventDefault(),onClick:s,children:r},e),g=m.w/2,v=g+4,b=Math.max(v,window.innerWidth-g-4),k=document.querySelector(".header")?.getBoundingClientRect().bottom??0,_=a.top-m.h-8,w=_<k+4,y={top:w?Math.min(a.bottom+8,window.innerHeight-m.h-4):_,left:Math.min(b,Math.max(v,a.left))};return(0,z.jsxs)("div",{className:"mdtb mdtb--floating"+(w?" mdtb--below":""),ref:r,style:y,children:[p("h1","H1","一级标题",()=>i(W("heading",{level:1})),d(1)),p("h2","H2","二级标题",()=>i(W("heading",{level:2})),d(2)),p("h3","H3","三级标题",()=>i(W("heading",{level:3})),d(3)),(0,z.jsx)("span",{className:"mdtb__sep"}),p("b","B","加粗",()=>i(P("strong")),u("strong")),p("i","I","斜体",()=>i(P("em")),u("em")),p("s","S","删除线",()=>i(P("strike")),u("strike")),p("code","</>","行内代码",()=>i(P("code")),u("code")),(0,z.jsx)("span",{className:"mdtb__sep"}),p("ul","≔","无序列表",()=>i(F)),p("ol","1.","有序列表",()=>i(G)),p("quote","❝","引用",()=>i(H))]})}function Z(e){for(let t=e.depth;t>0;t--){const r=e.node(t).type.name;if("heading"===r)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===r)return{name:"paragraph"}}return{name:"paragraph"}}var Q=r(75725);const ee="cut",te="copy",re="paste",ne="strong",se="em",oe="strike",ae="code",ce="h1",le="h2",ie="h3",ue="paragraph",de="bullet",he="ordered",me="quote",fe="code_block",pe="clean",ge="row_before",ve="row_after",be="row_delete",ke="col_before",_e="col_after",we="col_delete",ye="header_toggle",xe="cell_merge",Me="cell_split",$e="table_delete",Se="table_insert",je="select_all";function Ee(e){const{t}=(0,h.B)(),[r,s]=(0,n.useState)(null),o=(0,n.useRef)(e.get_view);o.current=e.get_view,(0,n.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const r=e.target;if(!r||!r.closest(".md-wysiwyg-content"))return;e.preventDefault();const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n){const e=t.state.selection;if(n.pos<e.from||n.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(n.pos))))}catch{}}}const a=!!r.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:a||(0,_.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const a=()=>s(null),c=(0,n.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),a())},[]),l=e=>{const t=o.current();t?.focus(),document.execCommand(e),a()};if(!r)return null;const i=r.in_table?[{r:t("上方插入行"),v:ge},{r:t("下方插入行"),v:ve},{r:t("左侧插入列"),v:ke},{r:t("右侧插入列"),v:_e},{r:t("删除行"),v:be},{r:t("删除列"),v:we},{r:t("切换表头行"),v:ye},{r:t("合并单元格"),v:xe},{r:t("拆分单元格"),v:Me},{r:t("删除表格"),v:$e}]:[],u=[{r:t("剪切"),v:ee},{r:t("复制"),v:te},{r:t("粘贴"),v:re},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:ne},{r:t("斜体"),v:se},{r:t("删除线"),v:oe},{r:t("行内代码"),v:ae}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:ce},{r:t("二级标题"),v:le},{r:t("三级标题"),v:ie},{r:t("正文"),v:ue}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:de},{r:t("有序列表"),v:he},{r:t("引用"),v:me},{r:t("代码块"),v:fe},{r:t("插入表格"),v:Se}]},...i.length?[{r:t("表格"),v:"table",items:i}]:[],{r:t("清除格式"),v:pe},{r:t("全选"),v:je}];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Q.rY,{click:a}),(0,z.jsx)(Q.Pu,{x:r.x,y:r.y,items:u,click:t=>{switch(t){case ee:return l("cut");case te:return l("copy");case re:return l("paste");case ne:return c(P("strong"));case se:return c(P("em"));case oe:return c(P("strike"));case ae:return c(P("code"));case ce:return c(W("heading",{level:1}));case le:return c(W("heading",{level:2}));case ie:return c(W("heading",{level:3}));case ue:return c(W("paragraph"));case de:return c(F);case he:return c(G);case me:return c(H);case fe:return c(W("code_block"));case Se:return a(),void e.on_insert_table?.();case ge:return c(_.JD);case ve:return c(_.gC);case ke:return c(_.RC);case _e:return c(_.GU);case be:return c(_.aR);case we:return c(_.gR);case ye:return c(_.uC);case xe:return c(_.w7);case Me:return c(_.L0);case $e:return c(_.kG);case pe:return c((e,t)=>{const{from:r,to:n}=e.selection;let s=e.tr;return e.doc.nodesBetween(r,n,(e,t)=>{if(e.isText)for(const r of e.marks)s=s.removeMark(t,t+e.nodeSize,r.type)}),t?.(s),!0});case je:return c((e,t)=>{const{TextSelection:r}=e.selection.constructor;return t?.(e.tr.setSelection(r.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var De=r(2543);const Ae="md_editor_show_outline";function Oe(){const{t:e}=(0,h.B)(),[t,r]=(0,s.fp)(o.AG.md_editor),[m,f]=(0,n.useState)(null),[p,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(!1),[k,_]=(0,n.useState)(0),w=(0,n.useRef)(null),[y,x]=(0,n.useState)([]),[M,$]=(0,n.useState)(-1),[S,j]=(0,n.useState)(15),[E,D]=(0,n.useState)(!1),A=(0,n.useRef)(null),O=(0,n.useRef)(null),[C,N]=(0,n.useState)(()=>{try{return"1"===localStorage.getItem(Ae)}catch(e){return!1}}),L=(0,n.useRef)([]),R=(0,n.useCallback)(()=>{const e=w.current;if(!e)return;const t=e.get_headings();L.current=t,x(t)},[]),I=(0,n.useCallback)(()=>{const e=w.current?.get_view();if(!e)return;const t=e.state.selection.from;let r=-1;for(const e of L.current){if(!(e.pos<=t))break;r=e.pos}$(r)},[]);(0,n.useEffect)(()=>{let r=!1;if(t?.url)return b(!1),g(!0),d.l.get(t.url).then(e=>{r||f(e??"")}).catch(()=>{r||((0,l.zN)(e("打开失败")),f(""))}).finally(()=>{r||g(!1)}),()=>{r=!0};f(null)},[t?.url]),(0,n.useEffect)(()=>{const e=()=>_(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]),(0,n.useEffect)(()=>{R(),I()},[k,R,I]);const T=(0,n.useCallback)(De.throttle(e=>{if(!A.current||!O.current)return;const t=parseFloat(getComputedStyle(A.current).fontSize),r=e.clientX/t,n=window.innerWidth/t-4,s=2.25+O.current.offsetWidth/t;r<=n&&r>=s&&j(parseFloat(r.toFixed(2)))},32),[]),B=()=>{D(!1),A.current?.removeEventListener("pointermove",T)},P=async()=>{if(!t?.name||!t?.path||!w.current)return;const r=w.current.get_markdown(),n=t.path.slice(0,t.path.length-t.name.length),s=`${encodeURIComponent(n)}${t.name}`;(await u.$M.post(`save/${s}`,{context:r})).code===i.m.Success?(b(!1),(0,l.SK)(e("保存成功"))):(0,l.zN)(e("保存失败"))},W=(0,n.useRef)(P);W.current=P;const F=(0,n.useMemo)(()=>t?.url??"md_editor",[t?.url]);return t?.name?(0,z.jsxs)("div",{id:"md-editor-container",children:[(0,z.jsx)(c.A,{ignore_tags:!0,left_children:[(0,z.jsx)(a.rA,{title:e("关闭"),icon:"close",onClick:()=>{r({}),b(!1),f(null),w.current=null,t?.close?.()}},1),...v?[(0,z.jsx)(a.rA,{title:e("保存"),icon:"save",onClick:P},2)]:[],(0,z.jsx)(a.rA,{title:e("大纲"),icon:"list",onClick:()=>{N(e=>{const t=!e;try{localStorage.setItem(Ae,t?"1":"0")}catch(e){}return t})},selected:C},4),(0,z.jsx)("title",{children:t.name},3)]}),(0,z.jsxs)("div",{className:"md-editor-context",ref:A,children:[p&&(0,z.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!p&&null!==m&&(0,z.jsxs)(n.Fragment,{children:[C&&(0,z.jsx)("div",{className:"md-outline-panel",style:{width:`${S}em`},children:(0,z.jsx)(q,{items:y,active_pos:M,on_click:e=>{w.current?.scroll_to_pos(e.pos),$(e.pos)}})}),C&&(0,z.jsx)("div",{className:"md-editor-divider",ref:O,onPointerDown:()=>{D(!0),A.current?.addEventListener("pointermove",T)},onPointerUp:B}),E&&(0,z.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:B}),(0,z.jsx)("div",{className:"md-editor-scroll",children:(0,z.jsxs)("div",{className:"md-editor-sheet",children:[(0,z.jsx)(Y,{get_view:()=>w.current?.get_view()??null,refresh_key:k}),(0,z.jsx)(X,{value:m,ref:w,on_ready:e=>{const t=e.get_headings();L.current=t,x(t),$(-1)},on_change:()=>{v||b(!0)},on_save:()=>W.current(),on_selection_change:()=>_(e=>e+1)},F),(0,z.jsx)(Ee,{get_view:()=>w.current?.get_view()??null,on_insert_table:()=>{w.current?.insert_table(3,3),b(!0)}})]})})]})]})]}):null}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1472],{77481(e,t,s){s.d(t,{S:()=>a,X:()=>o});var n=s(96540),i=s(61443),l=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[a,r]=(0,n.useState)(-1),[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=()=>{o.current=-1,r(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let o=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(o=`${t} (${n.label})`)}return(0,l.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:o}):t},s)})})}),(0,l.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,l.jsx)("tr",{className:n?(a===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||o.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=o.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,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function a(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},61472(e,t,s){s.r(t),s.d(t,{default:()=>D});var n=s(96540),i=s(75725),l=s(23430),o=s(70447),a=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),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.B)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,f.jsx)(a.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const o=[];for(let t=0;t<e.headers.length;t++)o.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return o.push((0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,f.jsx)(a.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,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)(a.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)}})]})),o}),width:"10rem",onRowDrag:(e,t)=>{l((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),C=s(24659);function y(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),l=(0,C.K)(),g=[e("路由"),e("auth"),e("备注")],[y,k]=(0,w.fp)(p.AG.editorSetting),[b,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自定义api路由")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:(0,f.jsx)(h.X,{headers:g,rows:b.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...b])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...b])},options:l,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...b])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(a.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)}`);k({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&&(S.xK.set_value_temp(""),k({open:!1,model:"",fileName:"",save:null}),(0,x.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(a.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)(b,e,t))}})})})}var k=s(23496),b=s(4412);function A(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[l,o]=(0,w.fp)(p.AG.router_jump),a=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(b.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:a,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],o({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.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("workflow触发路由"),headers:r,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(k.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,{children:(0,f.jsx)(y,{})})]})]})}var I=s(74777),V=s(6960),X=s(7523);function N(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.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),[C,y]=(0,n.useState)(!1),[k,b]=(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(l.oV.sys_setting_page)?(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,x.zN)(e("版本检测地址不能为空"));if(s&&(!v||v<10))return void(0,x.zN)(e("检测间隔不能小于10秒"));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("系统版本检测地址")}),(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("默认180秒(3分钟)"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(a.C3,{text:e(C?"升级检测中...":"立即升级"),clickFun:async()=>{y(!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{y(!1)}}})})]})]}):null}function O(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(""),[_,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,C]=(0,n.useState)(!1),[y,A]=(0,n.useState)(""),[O,F]=(0,w.fp)(p.AG.prompt_card),[K,z]=(0,n.useState)(!1),[P,B]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[$,D]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[H,R]=(0,n.useState)(void 0),{t:q,i18n:U}=(0,u.B)(),[Z,W]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(X.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){C(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(z(n.open),B(n.cert_path||""),M(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&&R(e.length),e.mode&&D(e.mode),void 0!==e.persist&&G(e.persist)}})()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(b.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[q("系统运行于"),": ",(0,V.s)(Z.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:6.66.0",null!=Z.latest_version&&"6.66.0"!==Z.latest_version?` -> ${Z.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:q("官网地址"),target:"_blank",children:`filecat ${q("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[q("安装方式")," :",Z.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:q("通用设置")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:q("信息"),context_div:(0,f.jsx)("div",{children:q("HTTP 代理说明")})})},title:q("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{(await c.XO.post(k.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)("修改成功"),Q())}}),children:[q("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),q("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:q("本地文件路径或 http(s) 图片地址"),value:s,handleInputChange:e=>{l(e)}}),(0,f.jsx)("div",{children:q("HTTP 代理地址")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),q("登陆展示用户信息"),(0,f.jsx)("input",{type:"checkbox",checked:_,onChange:()=>{m(!_)}})]}),(0,f.jsxs)(o.Zp,{title:q("HTTPS 设置"),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{if(K){if(!P)return void(0,x.zN)("证书路径不能为空");if(!T)return void(0,x.zN)("私钥路径不能为空")}const e=new I.CH;e.open=K,e.cert_path=P,e.key_path=T;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:K})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:K,onChange:e=>{z(e)},options:[{title:q("开启"),value:!0},{title:q("关闭"),value:!1}]}),K&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:q("SSL 证书路径")}),(0,f.jsx)(r.Sm,{placeholder:q("证书文件路径(cert.pem/fullchain.pem)"),value:P,handleInputChange:e=>{B(e)}}),(0,f.jsx)("div",{children:q("SSL 私钥路径")}),(0,f.jsx)(r.Sm,{placeholder:q("私钥文件路径(privkey.pem)"),value:T,handleInputChange:e=>{M(e)}})]})]}),(0,f.jsx)(N,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:q("文件回收站")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:q("信息"),context_div:(0,f.jsx)("div",{children:q("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:q("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{if(g&&!y)return void(0,x.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:y,open:g})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:q("目录"),value:y,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{C(e)},options:[{title:q("开启"),value:!0},{title:q("关闭"),value:!1}]})]}),(0,f.jsxs)(o.Zp,{title:q("token过期时间"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(a.C3,{text:q("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,f.jsx)(a.C3,{text:q("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=$,e.persist=E,I.aM.length!==e.mode||H||(0,x.zN)("秒数不能为空"),e.length=parseInt(H);(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:q("关闭"),selected:$===I.aM.close,onchange:()=>{D(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:q("指定时间"),selected:$===I.aM.length,onchange:()=>{D(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:q("永不过期"),selected:$===I.aM.forver,onchange:()=>{D(I.aM.forver)}})]}),$===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:q("秒"),value:H,handleInputChange:e=>{R(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:E,onChange:()=>G(!E)}),q("持久化")]})]})]})]})})]})}var F=s(92350);function K(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)(X.F),[_,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[y,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,K]=(0,n.useState)([]),[z,P]=(0,n.useState)([]),[B,T]=(0,n.useState)(""),[M,$]=(0,n.useState)([]),D=(0,C.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],H=[e("编号"),e("路径"),e("是否开启"),e("备注")],R=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],q=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("是否开启大文件断点"),e("大文件判断大小MB"),e("大文件并发数量"),e("大文件分块大小MB"),e("备注")],U=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:Z}=(0,S.MH)(),W=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&K(e.data)},L=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(t.data),W(),L();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&&N(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&$(i.data??[])})()},[]);const Q=(0,F.Q)(),J=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,children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件上传最大并发限制")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...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)(a.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)("保存成功"),l())}})]}),children:(0,f.jsx)(h.X,{headers:q,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,N([...V])},options:D,no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?k({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)(a.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(S.xK.set_value_temp(t.data??""),b({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("保存失败")),S.xK.set_value_temp("")}})):(0,x.zN)(e("获取失败"))}}),(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...O,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:O})).code===d.m.Success&&((0,x.SK)("保存成功"),W(),s())}})]}),children:(0,f.jsx)(h.X,{headers:H,rows:O.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,K([...O])},options:D,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),K([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(O,e,t))}})}),(0,f.jsx)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:B})).code===d.m.Success&&((0,x.SK)("保存成功"),l())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:B,handleInputChange:e=>{T(e)}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...z,{open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",z)).code===d.m.Success&&((0,x.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:R,rows:z.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...z])},options:D,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...z])},options:D,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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z.splice(e,1),P([...z])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(z,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...M,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:U,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,$([...M])},options:D,no_border:!0}),(0,f.jsx)(a.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{M.splice(e,1),$([...M])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{$((0,v.TI)(M,e,t))}})})]})}),(0,f.jsx)(i.VP,{children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(a.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)(o.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("默认使用环境变量")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function z(e){const{t,i18n:s}=(0,u.B)(),[i,o]=(0,w.fp)(p.AG.user_base_info),a=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("docker容器停止、删除"),permission:l.oV.docker_container_update},{title:t("docker镜像删除"),permission:l.oV.docker_images_delete},{title:t("systemd管理"),permission:l.oV.systemd},{title:t("防火墙管理"),permission:l.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("Ai Chat Page"),permission:l.oV.ai_agent_page},{title:t("允许切换 AI 模型"),permission:l.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("文件删除、剪切、重命名"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("文件创建、上传、内容更新、解压缩"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("token时间修改"),permission:l.oV.token_update},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key}]},{title:t("系统环境设置"),list:[{title:t("系统环境设置页面"),permission:l.oV.sys_env_page},{title:t("目录文件上传数量限制修改"),permission:l.oV.dir_upload_max_num},{title:t("PATH路径修改"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("系统保护路径更新"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("workflow触发api 修改"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("自定义api路由"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("http代理下载关闭"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("workflow 执行"),permission:l.oV.workflow_exe},{title:t("workflow 执行用户"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("端口扫描"),permission:l.oV.port_scan},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh密钥保存到磁盘"),permission:l.oV.crypto_ssh_file},{title:t("filecat-restart重启命令"),permission:l.oV.shell_cmd_filecat_restart},{title:t("filecat-upgrade升级命令"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("filecat-down关闭主进程命令"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("ai 命令(Ai 聊天)"),permission:l.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:a.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const P=new Map;function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(X.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,C]=(0,n.useState)([]),[y,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[N,O]=(0,w.fp)(p.AG.confirm),[K,B]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[$,D]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[H,R]=(0,n.useState)([]),[q,U]=(0,n.useState)([]),[Z,W]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[oe,ae]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),_e=(0,F.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);C(e)}else C(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),P.clear();for(const e of t.data)P.set(e.role_id,e)}},we=e=>{B(e?.username??""),M(e?.password??""),D(e?.cwd??""),G(e?.access_dirs??[]),R(e?.not_access_dirs??[]),U(e?.only_read_dirs??[]),W(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),ae(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?Se(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const Se=(e,t=[])=>{if(!e)return he(""),void pe({});const s=P.get(e);if(s){if(s.cwd&&D(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&R(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&U(s.only_read_dirs),s.access_cmd&&W(s.access_cmd),s.not_access_cmd&&Q(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)}},Ce=()=>{if(!K)return void(0,x.zN)("username not empty");if((0,m.CB)(K))return void(0,x.zN)("username not empty char");if(!$)return void(0,x.zN)("cwd not empty");const e=new l.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=K,e.password=T,e.not_access_dirs=H,e.only_read_dirs=q,e.cwd=$,e.note=ie,e.access_cmd=Z,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=de,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),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)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:S.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(o.xP,{children:t.username}),(0,f.jsx)(o.xP,{children:t.cwd}),(0,f.jsx)(o.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{O({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ge(),O({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!T)return void(0,x.zN)("password not empty");if((0,m.CB)(T))return void(0,x.zN)("username not empty char");const e=Ce(),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)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=Ce();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:K,handleInputChange:e=>B(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:T,handleInputChange:e=>M(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:$,handleInputChange:e=>D(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)(a.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)(a.rA,{icon:"add",onClick:()=>{R([...H,""])},title:e("添加")}),e("禁止目录范围")]}),(H??[]).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=>{H[s]=e,R([...H])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{H.splice(s,1),R([...H])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{U([...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?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,U([...q])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{q.splice(s,1),U([...q])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:Z,placeholder:"use blank split",handleInputChange:e=>W(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>Q(e)}),!oe&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{Se(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:J,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)(z,{is_disable:e=>{if(!0===oe)return!0;if(de){const t=P.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===oe||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function T(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(X.F),[_,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,C]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[N,O]=(0,n.useState)(""),[K,P]=(0,n.useState)([]),[B,T]=(0,n.useState)([]),[M,$]=(0,n.useState)([]),[D,E]=(0,n.useState)(""),[G,H]=(0,n.useState)(""),[R,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[W,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,F.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??""),O(e?.cwd??""),P(e?.access_dirs??[]),T(e?.not_access_dirs??[]),$(e?.only_read_dirs??[]),E(e?.access_cmd??""),H(e?.not_access_cmd??""),q(e?.language??""),Z(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!I)return void(0,x.zN)("role_name not empty");const e=new l.E0;return e.language=R,e.theme=U,e.access_dirs=K,e.role_name=I,e.not_access_dirs=B,e.only_read_dirs=M,e.cwd=N,e.access_cmd=D,e.not_access_cmd=G,e.auth_list=W,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{C(!0),k(!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)(o.xP,{children:t.role_name}),(0,f.jsx)(o.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{C(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await 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,children:(S||y)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),C(!1),k(!1),ie(void 0))}}),y&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=Q;(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)(a.rA,{icon:"add",onClick:()=>{P([...K,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:N,handleInputChange:e=>O(e)}),(K??[]).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=>{K[t]=e,P([...K])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{K.splice(t,1),P([...K])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{T([...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,T([...B])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{B.splice(s,1),T([...B])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{$([...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,$([...M])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{M.splice(t,1),$([...M])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:D,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=>H(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{q(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:U,onChange:e=>{Z(e)},options:te}),(0,f.jsx)(z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==W?.find(t=>t===e),select_auth:e=>{W?(W.find(t=>t==e)?(0,v.I)(W,t=>t===e):W.push(e),L([...W])):L([e])}})]})})})]})}function M(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(X.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[y,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[N,O]=(0,n.useState)([]),[K,z]=(0,w.fp)(p.AG.user_base_info),P=(0,C.K)(),B=(0,F.o)(),T=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],$=[e("编号"),e("命令"),e("父编号"),e("备注")],D=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[q,U]=(0,n.useState)(""),[Z,W]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,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),O(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(K?.user_data?.language),Y(K?.user_data?.theme),te(K?.user_data?.upload_file_ignore)},[]);const se=(0,F.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!H)return void(0,x.zN)("账号密码不能为空");if(H!==q)return void(0,x.zN)("两次密码不一样");const e=new l.tl;e.username=E,e.password=H,e.confirm_password=q,e.user_id=K.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=>{R(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{U(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:ee}})).code===d.m.Success&&((0,x.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:L,onChange:e=>{Q(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,f.jsx)(r.l6,{value:J,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.jsx)(a.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:T,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)(a.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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...y,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",y)).code===d.m.Success&&((0,x.SK)("保存成功"),_())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:y.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{y.splice(e,1),b([...y])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(y,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(a.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:$,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...N,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:N})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:N.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),O([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{O((0,v.TI)(N,e,t))}})})]})]})]})})}var $=s(87361);function D(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(M,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(O,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(K,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(B,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(T,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:$.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),l=s(74777),o=s(96540),a=s(86149),r=s(23430),c=s(14284),d=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:o}=(0,a.B)();return e=>{let n;e===l.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.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,o.useState)([]);return(0,o.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:()=>o});var n=s(72635);const i=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1472],{77481(e,t,s){s.d(t,{S:()=>a,X:()=>o});var n=s(96540),i=s(61443),l=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[a,r]=(0,n.useState)(-1),[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=()=>{o.current=-1,r(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let o=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(o=`${t} (${n.label})`)}return(0,l.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:o}):t},s)})})}),(0,l.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,l.jsx)("tr",{className:n?(a===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||o.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=o.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,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function a(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},61472(e,t,s){s.r(t),s.d(t,{default:()=>D});var n=s(96540),i=s(75725),l=s(23430),o=s(70447),a=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),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.B)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,f.jsx)(a.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const o=[];for(let t=0;t<e.headers.length;t++)o.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return o.push((0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,f.jsx)(a.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,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)(a.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)}})]})),o}),width:"10rem",onRowDrag:(e,t)=>{l((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),C=s(24659);function y(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),l=(0,C.K)(),g=[e("路由"),e("auth"),e("备注")],[y,k]=(0,w.fp)(p.AG.editorSetting),[b,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自定义api路由")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:(0,f.jsx)(h.X,{headers:g,rows:b.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...b])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...b])},options:l,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...b])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(a.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)}`);k({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&&(S.xK.set_value_temp(""),k({open:!1,model:"",fileName:"",save:null}),(0,x.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(a.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)(b,e,t))}})})})}var k=s(23496),b=s(4412);function A(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[l,o]=(0,w.fp)(p.AG.router_jump),a=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(b.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:a,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],o({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.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("workflow触发路由"),headers:r,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(k.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,{children:(0,f.jsx)(y,{})})]})]})}var I=s(74777),V=s(6960),X=s(7523);function N(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.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),[C,y]=(0,n.useState)(!1),[k,b]=(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(l.oV.sys_setting_page)?(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,x.zN)(e("版本检测地址不能为空"));if(s&&(!v||v<10))return void(0,x.zN)(e("检测间隔不能小于10秒"));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("系统版本检测地址")}),(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("默认180秒(3分钟)"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(a.C3,{text:e(C?"升级检测中...":"立即升级"),clickFun:async()=>{y(!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{y(!1)}}})})]})]}):null}function O(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(""),[_,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,C]=(0,n.useState)(!1),[y,A]=(0,n.useState)(""),[O,F]=(0,w.fp)(p.AG.prompt_card),[K,z]=(0,n.useState)(!1),[P,B]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[$,D]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[H,R]=(0,n.useState)(void 0),{t:q,i18n:U}=(0,u.B)(),[Z,W]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(X.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){C(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(z(n.open),B(n.cert_path||""),M(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&&R(e.length),e.mode&&D(e.mode),void 0!==e.persist&&G(e.persist)}})()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(b.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[q("系统运行于"),": ",(0,V.s)(Z.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:6.67.0",null!=Z.latest_version&&"6.67.0"!==Z.latest_version?` -> ${Z.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:q("官网地址"),target:"_blank",children:`filecat ${q("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[q("安装方式")," :",Z.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:q("通用设置")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:q("信息"),context_div:(0,f.jsx)("div",{children:q("HTTP 代理说明")})})},title:q("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{(await c.XO.post(k.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)("修改成功"),Q())}}),children:[q("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),q("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:q("本地文件路径或 http(s) 图片地址"),value:s,handleInputChange:e=>{l(e)}}),(0,f.jsx)("div",{children:q("HTTP 代理地址")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),q("登陆展示用户信息"),(0,f.jsx)("input",{type:"checkbox",checked:_,onChange:()=>{m(!_)}})]}),(0,f.jsxs)(o.Zp,{title:q("HTTPS 设置"),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{if(K){if(!P)return void(0,x.zN)("证书路径不能为空");if(!T)return void(0,x.zN)("私钥路径不能为空")}const e=new I.CH;e.open=K,e.cert_path=P,e.key_path=T;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:K})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:K,onChange:e=>{z(e)},options:[{title:q("开启"),value:!0},{title:q("关闭"),value:!1}]}),K&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:q("SSL 证书路径")}),(0,f.jsx)(r.Sm,{placeholder:q("证书文件路径(cert.pem/fullchain.pem)"),value:P,handleInputChange:e=>{B(e)}}),(0,f.jsx)("div",{children:q("SSL 私钥路径")}),(0,f.jsx)(r.Sm,{placeholder:q("私钥文件路径(privkey.pem)"),value:T,handleInputChange:e=>{M(e)}})]})]}),(0,f.jsx)(N,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:q("文件回收站")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:q("信息"),context_div:(0,f.jsx)("div",{children:q("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:q("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{if(g&&!y)return void(0,x.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:y,open:g})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:q("目录"),value:y,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{C(e)},options:[{title:q("开启"),value:!0},{title:q("关闭"),value:!1}]})]}),(0,f.jsxs)(o.Zp,{title:q("token过期时间"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(a.C3,{text:q("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,f.jsx)(a.C3,{text:q("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=$,e.persist=E,I.aM.length!==e.mode||H||(0,x.zN)("秒数不能为空"),e.length=parseInt(H);(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:q("关闭"),selected:$===I.aM.close,onchange:()=>{D(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:q("指定时间"),selected:$===I.aM.length,onchange:()=>{D(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:q("永不过期"),selected:$===I.aM.forver,onchange:()=>{D(I.aM.forver)}})]}),$===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:q("秒"),value:H,handleInputChange:e=>{R(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:E,onChange:()=>G(!E)}),q("持久化")]})]})]})]})})]})}var F=s(92350);function K(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)(X.F),[_,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[y,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,K]=(0,n.useState)([]),[z,P]=(0,n.useState)([]),[B,T]=(0,n.useState)(""),[M,$]=(0,n.useState)([]),D=(0,C.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],H=[e("编号"),e("路径"),e("是否开启"),e("备注")],R=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],q=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("是否开启大文件断点"),e("大文件判断大小MB"),e("大文件并发数量"),e("大文件分块大小MB"),e("备注")],U=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:Z}=(0,S.MH)(),W=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&K(e.data)},L=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(t.data),W(),L();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&&N(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&$(i.data??[])})()},[]);const Q=(0,F.Q)(),J=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,children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件上传最大并发限制")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...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)(a.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)("保存成功"),l())}})]}),children:(0,f.jsx)(h.X,{headers:q,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,N([...V])},options:D,no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?k({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)(a.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(S.xK.set_value_temp(t.data??""),b({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("保存失败")),S.xK.set_value_temp("")}})):(0,x.zN)(e("获取失败"))}}),(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...O,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:O})).code===d.m.Success&&((0,x.SK)("保存成功"),W(),s())}})]}),children:(0,f.jsx)(h.X,{headers:H,rows:O.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,K([...O])},options:D,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),K([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(O,e,t))}})}),(0,f.jsx)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:B})).code===d.m.Success&&((0,x.SK)("保存成功"),l())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:B,handleInputChange:e=>{T(e)}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...z,{open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",z)).code===d.m.Success&&((0,x.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:R,rows:z.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...z])},options:D,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...z])},options:D,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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z.splice(e,1),P([...z])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(z,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...M,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:U,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,$([...M])},options:D,no_border:!0}),(0,f.jsx)(a.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{M.splice(e,1),$([...M])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{$((0,v.TI)(M,e,t))}})})]})}),(0,f.jsx)(i.VP,{children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(a.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)(o.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("默认使用环境变量")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function z(e){const{t,i18n:s}=(0,u.B)(),[i,o]=(0,w.fp)(p.AG.user_base_info),a=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("docker容器停止、删除"),permission:l.oV.docker_container_update},{title:t("docker镜像删除"),permission:l.oV.docker_images_delete},{title:t("systemd管理"),permission:l.oV.systemd},{title:t("防火墙管理"),permission:l.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("Ai Chat Page"),permission:l.oV.ai_agent_page},{title:t("允许切换 AI 模型"),permission:l.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("文件删除、剪切、重命名"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("文件创建、上传、内容更新、解压缩"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("token时间修改"),permission:l.oV.token_update},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key}]},{title:t("系统环境设置"),list:[{title:t("系统环境设置页面"),permission:l.oV.sys_env_page},{title:t("目录文件上传数量限制修改"),permission:l.oV.dir_upload_max_num},{title:t("PATH路径修改"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("系统保护路径更新"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("workflow触发api 修改"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("自定义api路由"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("http代理下载关闭"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("workflow 执行"),permission:l.oV.workflow_exe},{title:t("workflow 执行用户"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("端口扫描"),permission:l.oV.port_scan},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh密钥保存到磁盘"),permission:l.oV.crypto_ssh_file},{title:t("filecat-restart重启命令"),permission:l.oV.shell_cmd_filecat_restart},{title:t("filecat-upgrade升级命令"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("filecat-down关闭主进程命令"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("ai 命令(Ai 聊天)"),permission:l.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:a.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const P=new Map;function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(X.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,C]=(0,n.useState)([]),[y,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[N,O]=(0,w.fp)(p.AG.confirm),[K,B]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[$,D]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[H,R]=(0,n.useState)([]),[q,U]=(0,n.useState)([]),[Z,W]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[oe,ae]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),_e=(0,F.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);C(e)}else C(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),P.clear();for(const e of t.data)P.set(e.role_id,e)}},we=e=>{B(e?.username??""),M(e?.password??""),D(e?.cwd??""),G(e?.access_dirs??[]),R(e?.not_access_dirs??[]),U(e?.only_read_dirs??[]),W(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),ae(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?Se(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const Se=(e,t=[])=>{if(!e)return he(""),void pe({});const s=P.get(e);if(s){if(s.cwd&&D(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&R(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&U(s.only_read_dirs),s.access_cmd&&W(s.access_cmd),s.not_access_cmd&&Q(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)}},Ce=()=>{if(!K)return void(0,x.zN)("username not empty");if((0,m.CB)(K))return void(0,x.zN)("username not empty char");if(!$)return void(0,x.zN)("cwd not empty");const e=new l.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=K,e.password=T,e.not_access_dirs=H,e.only_read_dirs=q,e.cwd=$,e.note=ie,e.access_cmd=Z,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=de,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),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)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:S.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(o.xP,{children:t.username}),(0,f.jsx)(o.xP,{children:t.cwd}),(0,f.jsx)(o.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{O({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ge(),O({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!T)return void(0,x.zN)("password not empty");if((0,m.CB)(T))return void(0,x.zN)("username not empty char");const e=Ce(),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)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=Ce();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:K,handleInputChange:e=>B(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:T,handleInputChange:e=>M(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:$,handleInputChange:e=>D(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)(a.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)(a.rA,{icon:"add",onClick:()=>{R([...H,""])},title:e("添加")}),e("禁止目录范围")]}),(H??[]).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=>{H[s]=e,R([...H])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{H.splice(s,1),R([...H])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{U([...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?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,U([...q])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{q.splice(s,1),U([...q])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:Z,placeholder:"use blank split",handleInputChange:e=>W(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>Q(e)}),!oe&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{Se(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:J,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)(z,{is_disable:e=>{if(!0===oe)return!0;if(de){const t=P.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===oe||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function T(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(X.F),[_,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,C]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[N,O]=(0,n.useState)(""),[K,P]=(0,n.useState)([]),[B,T]=(0,n.useState)([]),[M,$]=(0,n.useState)([]),[D,E]=(0,n.useState)(""),[G,H]=(0,n.useState)(""),[R,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[W,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,F.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??""),O(e?.cwd??""),P(e?.access_dirs??[]),T(e?.not_access_dirs??[]),$(e?.only_read_dirs??[]),E(e?.access_cmd??""),H(e?.not_access_cmd??""),q(e?.language??""),Z(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!I)return void(0,x.zN)("role_name not empty");const e=new l.E0;return e.language=R,e.theme=U,e.access_dirs=K,e.role_name=I,e.not_access_dirs=B,e.only_read_dirs=M,e.cwd=N,e.access_cmd=D,e.not_access_cmd=G,e.auth_list=W,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{C(!0),k(!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)(o.xP,{children:t.role_name}),(0,f.jsx)(o.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{C(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await 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,children:(S||y)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),C(!1),k(!1),ie(void 0))}}),y&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=Q;(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)(a.rA,{icon:"add",onClick:()=>{P([...K,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:N,handleInputChange:e=>O(e)}),(K??[]).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=>{K[t]=e,P([...K])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{K.splice(t,1),P([...K])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{T([...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,T([...B])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{B.splice(s,1),T([...B])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{$([...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,$([...M])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{M.splice(t,1),$([...M])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:D,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=>H(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{q(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:U,onChange:e=>{Z(e)},options:te}),(0,f.jsx)(z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==W?.find(t=>t===e),select_auth:e=>{W?(W.find(t=>t==e)?(0,v.I)(W,t=>t===e):W.push(e),L([...W])):L([e])}})]})})})]})}function M(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(X.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[y,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[N,O]=(0,n.useState)([]),[K,z]=(0,w.fp)(p.AG.user_base_info),P=(0,C.K)(),B=(0,F.o)(),T=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],$=[e("编号"),e("命令"),e("父编号"),e("备注")],D=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[q,U]=(0,n.useState)(""),[Z,W]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,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),O(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(K?.user_data?.language),Y(K?.user_data?.theme),te(K?.user_data?.upload_file_ignore)},[]);const se=(0,F.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!H)return void(0,x.zN)("账号密码不能为空");if(H!==q)return void(0,x.zN)("两次密码不一样");const e=new l.tl;e.username=E,e.password=H,e.confirm_password=q,e.user_id=K.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=>{R(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{U(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:ee}})).code===d.m.Success&&((0,x.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:L,onChange:e=>{Q(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,f.jsx)(r.l6,{value:J,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.jsx)(a.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:T,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)(a.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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...y,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",y)).code===d.m.Success&&((0,x.SK)("保存成功"),_())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:y.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{y.splice(e,1),b([...y])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(y,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(a.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:$,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...N,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:N})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:N.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),O([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{O((0,v.TI)(N,e,t))}})})]})]})]})})}var $=s(87361);function D(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(M,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(O,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(K,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(B,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(T,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:$.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),l=s(74777),o=s(96540),a=s(86149),r=s(23430),c=s(14284),d=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:o}=(0,a.B)();return e=>{let n;e===l.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.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,o.useState)([]);return(0,o.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:()=>o});var n=s(72635);const i=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6247],{77481(e,t,n){n.d(t,{S:()=>i,X:()=>s});var r=n(96540),o=n(61443),l=n(74848);function s(e){const[t,n]=r.useState([]),s=(0,r.useRef)(-1),[i,a]=(0,r.useState)(-1),[c,d]=(0,r.useState)(-1);(0,r.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{s.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>{const r=!!e.filter&&(e.filter.column??0)===n;let s=t;if(r){const n=e.filter,r=n.options.find(e=>e.value===n.value);null!=n.value&&r&&(s=`${t} (${r.label})`)}return(0,l.jsx)("th",{className:r?"table-filter-col":"",children:r?(0,l.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:s}):t},n)})})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const r=!!e.onRowDrag;return(0,l.jsx)("tr",{className:r?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:r,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{r&&(s.current=n,a(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!r||s.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{r&&(t.preventDefault(),(()=>{const t=s.current,n=c;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,r)=>{const o=r===t.length-1?"small":"";return(0,l.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},r)})},n)})})]})}function i(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},66247(e,t,n){n.r(t),n.d(t,{default:()=>C});var r=n(96540),o=n(75725),l=n(70447),s=n(85997),i=n(77481),a=n(61443),c=n(86149),d=n(14284),h=n(53459),u=n(62042),f=n(87361),x=n(40505),p=n(4412),j=n(86090),_=n(34843),m=n(82893),w=n(21469),v=n(21499),g=n(64694),b=n(74848);function C(){const{t:e,i18n:t}=(0,c.B)(),n=(0,j.Zp)(),C=[e("编号"),e("路径"),e("过期小时"),e("token"),e("备注"),e("剩余时间(h)"),e("下载次数")],[k,S]=(0,r.useState)([]),[y,A]=(0,_.fp)(m.AG.prompt_card),D=async()=>{const e=await d.XO.get("get_share_file_list");if(e.code===h.m.Success){const t=e.data??[],n=Date.now();for(const e of t)try{if(null!=e.left_hour&&e.left_hour>0){const t=n-e.time_stamp,r=36e5*e.left_hour-t;e.show_left_hour=parseFloat((r/36e5).toFixed(2))}else e.show_left_hour=e.left_hour}catch(e){}S(t)}};(0,r.useEffect)(()=>{D()},[]);return(0,b.jsxs)("div",{className:"common-box ",style:{overflowY:"auto"},children:[(0,b.jsx)(p.aZ,{position:"right",children:(0,b.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{n(-1)}})}),(0,b.jsx)(o.J,{widthPer:100,children:(0,b.jsx)(l.uF,{self_title:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsx)("h2",{children:e("文件分享列表")}),(0,b.jsx)(s.rA,{icon:"info",title:e("提示"),onClick:()=>{let e=(0,b.jsx)("div",{children:"小时设置为-1或者不设置就没有过期时间"});A({open:!0,title:"信息",context_div:(0,b.jsx)("div",{children:e})})}})]}),titleCom:(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"add",title:e("添加"),onClick:()=>{S([...k,{note:"",path:""}])}}),(0,b.jsx)(s.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("set_share_file_list",k)).code===h.m.Success&&((0,u.SK)("保存成功"),D())}})]}),children:(0,b.jsx)(i.X,{headers:C,onRowDrag:(e,t)=>{S((0,g.TI)(k,e,t))},rows:k.map((t,n)=>{const r=[(0,b.jsx)("div",{children:n}),(0,b.jsx)(a.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.left_hour,handleInputChange:e=>{t.left_hour=parseFloat(e),t.time_stamp=Date.now()},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.token,handleInputChange:e=>{t.token=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,b.jsx)("p",{children:t.show_left_hour}),(0,b.jsx)("p",{children:t.download_num}),(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),S([...k])})(n)}),t.id&&(0,b.jsx)(s.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);(0,x.lW)(e),(0,u.SK)(e)}}),t.id&&(0,b.jsx)(s.rA,{icon:"open_in_new",title:e("打开新页面"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);window.open(e)}})]})];return r}),width:"10rem"})})})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>a,Lv:()=>o});class o{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const s=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function a(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,'\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',"cL",0,s])},77481(e,t,n){n.d(t,{S:()=>l,X:()=>i});var o=n(96540),s=n(61443),a=n(74848);function i(e){const[t,n]=o.useState([]),i=(0,o.useRef)(-1),[l,r]=(0,o.useState)(-1),[c,d]=(0,o.useState)(-1);(0,o.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const p=()=>{i.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,n)=>{const o=!!e.filter&&(e.filter.column??0)===n;let i=t;if(o){const n=e.filter,o=n.options.find(e=>e.value===n.value);null!=n.value&&o&&(i=`${t} (${o.label})`)}return(0,a.jsx)("th",{className:o?"table-filter-col":"",children:o?(0,a.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const o=!!e.onRowDrag;return(0,a.jsx)("tr",{className:o?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:o,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{o&&(i.current=n,r(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!o||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{o&&(t.preventDefault(),(()=>{const t=i.current,n=c;p(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:p,children:t.map((n,o)=>{const s=o===t.length-1?"small":"";return(0,a.jsx)("td",{className:s,style:{width:e.width??"auto"},children:n},o)})},n)})})]})}function l(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))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>L});var o=n(86149),s=n(96540),a=n(85997),i=n(4412),l=n(34843),r=n(82893),c=n(75725),d=n(77481),p=n(61443),m=n(70447),u=n(34299),h=n(74848);var _=n(14284),x=n(53459),g=n(62042),v=n(7523),j=n(78247),f=n(23430),y=n(86090),w=n(14944),b=n(92275),C=n(88815),k=n(64694),A=n(45907),S=n(12721),I=n(24659),$=n(83277);function L(){const{t:e}=(0,o.B)(),{initUserInfo:t}=(0,s.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),"model",e("更多属性"),e("备注")],L=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[K,N]=(0,s.useState)([]),[O,M]=(0,s.useState)([]),[P,X]=(0,s.useState)([]),[D,T]=(0,s.useState)(null),R=(0,s.useRef)(),F=(0,s.useRef)(!1),V=(0,s.useRef)(!1),[H,Y]=(0,s.useState)([]),[q,E]=(0,s.useState)(!1),[G,B]=(0,l.fp)(r.AG.prompt_card),[J,z]=(0,l.fp)(r.AG.user_base_info),[W,Z]=(0,s.useState)(!1),U=P.filter(e=>"http"!==(e.transport??"stdio")),Q=P.filter(e=>"http"===e.transport),ee=[e("编号"),e("名称"),e("是否开启"),"command","args","cwd",e("tools|env"),e("备注")],te=[e("编号"),e("名称"),e("是否开启"),e("endpoint"),e("tools|headers"),e("备注")],ne=[e("编号"),e("提示词"),e("LLM编辑开关"),e("LLM编辑提示词"),e("编辑规则"),e("备注")],[oe,se]=(0,s.useState)([]),[ae,ie]=(0,s.useState)(!1),le=function(){const[e,t]=(0,l.fp)(r.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,h.jsx)("div",{children:(0,h.jsx)(u.default,{context:e})})})}}(),{check_user_auth:re}=(0,j.MH)(),[ce,de]=(0,l.fp)(r.AG.editorSetting),pe=(0,y.Zp)(),me=(0,A.y)(),ue=(0,I.K)(),he=async()=>{const e=await _.jV.get("docs_on_get");e.code===x.m.Success&&Z(e.data)};(0,s.useEffect)(()=>{(async()=>{const e=await _.XO.get("ai_agent_setting");e.code===x.m.Success&&N(e.data.models),await w.ws.addMsg(b.HK.ai_load_info,e=>{T(e.context)});const t=await w.ws.sendData(b.HK.ai_load_info,{});t?.context&&T(t.context);const n=await _.XO.get("ai_docs_setting");n.code===x.m.Success&&(R.current=n.data.param,n.data.list?.length&&M(n.data.list));const o=await _.XO.get("ai_mcp_setting");o.code===x.m.Success&&X(o.data.list??[]),await fe(),he();const s=await _.XO.get("ai_system_prompts");s.code===x.m.Success&&se(s.data??[]);const a=await _.XO.get("ai_long_term_memory_setting");a.code===x.m.Success&&ie(a.data?.open??!1)})()},[]);const _e=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};X([...P,t]),F.current=!0},xe=e=>{const t=P.indexOf(e);t<0||(P.splice(t,1),X([...P]),F.current=!0)},ge=e=>{X([...P,{...e,open:!1}]),F.current=!0},ve=async e=>{for(let e=0;e<K.length;e++)K[e].index=e;(await _.XO.post("ai_agent_setting/save",{models:e??K})).code===x.m.Success&&(0,g.SK)("保存成功")},je=async e=>{for(let e=0;e<P.length;e++)P[e].index=e;(await _.XO.post("ai_mcp_setting/save",{list:e??P})).code===x.m.Success&&((0,g.SK)("保存成功"),F.current=!1,await fe())},fe=async()=>{const e=await _.XO.get("ai_mcp_tools");return e.code===x.m.Success?(Y(e.data??[]),e.data??[]):[]},ye=async e=>{E(!0);try{const t=await _.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await fe(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{E(!1)}return null},we=async(t,n,o,s)=>{const a=s??H.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},i=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));B({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,h.jsx)(S.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:i,initialPageId:o,onRefresh:async()=>{const e=await ye(n);e&&await we(t,n,o,e)},renderPage:t=>{if(!t)return(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,h.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,h.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,h.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,h.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,h.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:"schema:"}),(0,h.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>B({open:!1})})},be=async e=>{for(let e=0;e<K.length;e++)K[e].index=e;let t={list:O,docs_update_tag:V.current};null!=e&&(t={param:e}),V.current=!1;(await _.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},Ce=async()=>{for(let e=0;e<oe.length;e++)oe[e].index=e;(await _.XO.post("ai_system_prompts/save",{list:oe})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,h.jsxs)("div",{children:[(0,h.jsx)(i.aZ,{position:"right",children:re(f.oV.ai_agent_setting)&&(0,h.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{pe(-1)}})}),(0,h.jsx)(c.jW,{isFull:!0,more:!0,children:(0,h.jsx)(c.NN,{children:(0,h.jsxs)(c.xh,{children:[(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:100,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("Model")+" "+e("设置")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{le('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...K,{note:"",open:!1,path:"",dotenv:$.CP,json_params:$.cL}])}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await ve()}})]}),children:(0,h.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{N((0,k.TI)(K,e,t))},rows:K.map((t,n)=>{const o=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:$.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const o=[];for(let e=0;e<K.length;e++)K[e].open=e===n&&t,o.push(K[e]);N(o)})(0,e,n)},options:ue,no_border:!0}),(0,h.jsx)(p.Sm,{type:$.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:$.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,h.jsx)(p.Sm,{value:$.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{j.xK.set_value_temp(K[n].sys_prompt??""),de({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{K[n].sys_prompt=e,N(K),j.xK.set_value_temp(""),ve(K)}})}}),(0,h.jsx)(a.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{j.xK.set_value_temp(K[n].json_params),de({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{K[n].json_params=e,N(K),j.xK.set_value_temp(""),ve(K)},can_format:!0})}}),(0,h.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(K[n].dotenv),de({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{K[n].dotenv=e,N(K),j.xK.set_value_temp(""),ve(K)}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),N([...K])})(n)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{N([...K,{...K[e],open:!1}])})(n)})]})];return o}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:70,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{le("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>_e("stdio")}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{je()}})]}),children:(0,h.jsx)(d.X,{headers:ee,onRowDrag:(e,t)=>{X((0,k.TI)(P,P.indexOf(U[e]),P.indexOf(U[t]))),F.current=!0},rows:U.map((t,n)=>{const o=P.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,F.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,X([...P]),F.current=!0},options:ue,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.command,handleInputChange:e=>{t.command=e,F.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.args,handleInputChange:e=>{t.args=e,F.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,F.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{we(t,o)}}),(0,h.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{j.xK.set_value_temp(t.env??""),de({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.env=e,X([...P]),j.xK.set_value_temp(""),F.current=!0,je()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,F.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>xe(t)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ge(t)})]})]}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsxs)(c.VP,{widthPer:70,children:[(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>_e("http")}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{je()}})]}),children:(0,h.jsx)(d.X,{headers:te,onRowDrag:(e,t)=>{X((0,k.TI)(P,P.indexOf(Q[e]),P.indexOf(Q[t]))),F.current=!0},rows:Q.map((t,n)=>{const o=P.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,F.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,X([...P]),F.current=!0},options:ue,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,F.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{we(t,o)}}),(0,h.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{j.xK.set_value_temp(t.headers??""),de({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.headers=e,X([...P]),j.xK.set_value_temp(""),F.current=!0,je()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,F.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>xe(t)}),(0,h.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ge(t)})]})]}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("系统会话提示词")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{le('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{se([...oe,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,h.jsx)(d.X,{headers:ne,onRowDrag:(e,t)=>{se((0,k.TI)(oe,e,t))},rows:oe.map((t,n)=>{const o=[(0,h.jsx)("div",{children:n}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{j.xK.set_value_temp(t.prompt??""),de({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,se([...oe]),j.xK.set_value_temp(""),Ce()}})}})}),(0,h.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,se([...oe])},title:e("LLM编辑开关")}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"edit_note",title:e("LLM编辑提示词"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt??""),de({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,se([...oe]),j.xK.set_value_temp(""),Ce()}})}})}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt_tip??""),de({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,se([...oe]),j.xK.set_value_temp(""),Ce()}})}})}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsx)("div",{children:(0,h.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{oe.splice(e,1),se([...oe])})(n)})})];return o}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("长期记忆")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{le(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),titleCom:(0,h.jsx)("div",{children:(0,h.jsx)(a.Ay,{checked:ae,onChange:async t=>{ie(t),await _.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,h.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:o})=>(0,h.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${o})`,onClick:async()=>{const o=await _.XO.get(`ai_long_term_memory_bucket/${t}`),s=o.code===x.m.Success?o.data??"":"";j.xK.set_value_temp(s),de({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async o=>{await _.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:o}),j.xK.set_value_temp(""),(0,g.SK)(`${n} ${e("已保存")}`)}})}},t))})})]})}),(0,h.jsxs)(c.fI,{children:[(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("本地知识库")})," ",(0,h.jsx)(a.rA,{icon:"info",onClick:()=>{le("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(a.Ay,{checked:W,onChange:async e=>{await _.jV.post("docs_on_set",{status:e}),he(),t()},title:e("知识库开关")}),(0,h.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(R.current),de({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{R.current=e,j.xK.set_value_temp(""),be(R.current)}})}}),(0,h.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...O,{note:"",auto_load:!1,dir:""}]),V.current=!0}}),(0,h.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{be()}})]}),children:(0,h.jsx)(d.X,{headers:L,onRowDrag:(e,t)=>{M((0,k.TI)(O,e,t)),V.current=!0},rows:O.map((t,n)=>{const o=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,M([...O]),V.current=!0},options:ue,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{O.splice(e,1),M([...O]),V.current=!0})(n)}),(0,h.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{me({sub_title:"手动加载",confirm_fun:()=>{_.jV.post("ai_load_one_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,h.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{me({sub_title:"从索引删除",confirm_fun:()=>{_.jV.post("ai_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return o}),width:"10rem"})})}),D&&(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsxs)(m.Zp,{title:e("知识库加载信息"),children:[(0,h.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:D?.progress}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:D?.num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:D?.char_num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,C.v7)(D?.size)}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,C.a3)(D?.consume_time_ms_len)}),(0,h.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:D?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>_});n(96540);var o=n(22091),s=n(53995),a=n(18569),i=n(77979),l=n(8263),r=n(69428),c=n.n(r),d=(n(3775),n(21499)),p=n(99214),m=n(19878),u=(n(72411),n(74848));const h=new o.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${h.utils.escapeHtml(e)}</code></pre>`}});function _(e){return(0,p.VD)(),(0,u.jsx)("div",{dangerouslySetInnerHTML:{__html:h.render(e.context)}})}h.use(s.A).use(a.A).use(i.A).use(l.A).use(c()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,o,s,a)=>{const i=t[n],l=i.content.trim(),r=i.info.trim();let c="";if(r&&m.A.getLanguage(r))try{c=m.A.highlight(l,{language:r}).value}catch(t){c=e.utils.escapeHtml(l)}else try{c=m.A.highlightAuto(l).value}catch(t){c=e.utils.escapeHtml(l)}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(l)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,o,s){return s.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,o,s,a)=>{const i=e[n],l=i.attrIndex("href");if(l>=0){const e=i.attrs[l][1];i.attrs[l][1]=(0,d.bi)(window.location.href,e)}return t(e,n,o,s,a)}})},45907(e,t,n){n.d(t,{y:()=>a});var o=n(34843),s=n(82893);function a(){const[e,t]=(0,o.fp)(s.AG.confirm);return({sub_title:e,confirm_fun:n,title:o,context_div:s})=>{t({open:!0,sub_title:e,handle:()=>{n(),t({open:!1,handle:null})},title:o,context_div:s})}}},24659(e,t,n){var o=n(86149);n.d(t,["K",0,()=>{const{t:e}=(0,o.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.b35123cf5b85762e093f.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.0e7ed35ca4d77c86e560.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>