import{P as a,p as e,l as t,ah as s,$ as l,b as r}from"./utils-lib.js?v=1761009159";import{_ as i}from"./index105.js?v=1761009159";import{c as o,r as n,V as p,o as c,e as m,C as d,q as h,H as f,v as u,x as y,B as b,y as _,I as g,G as w}from"./base-lib.js?v=1761009159";import{_ as v}from"./index103.js?v=1761009159";import{bc as j,bd as x,be as C}from"./firewall.js?v=1761009159";import{a as k,c as q}from"./column.js?v=1761009159";import{f as T}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const V={class:"p-[2rem]"},A=o({__name:"index",setup(o){const A=r(),H=n(),I=p([]),P=[{content:'注意：添加白名单目录要以"/"结尾'}],B=[{label:"删除",value:"delete",event:async(a,e,t,s)=>{const{label:l,value:r}=s,i=async(a,e)=>{const{path:t,type:s}=a;if("delete"===r)return await x({path:t,type:s})};await a({title:"批量".concat(l,"白名单目录"),content:"批量".concat(l,"已选的白名单目录，是否继续操作！"),column:[{label:"路径",prop:"path"},q()],onConfirm:async()=>(await e(i),L(),!1)})}}],G=c({path:"",type:"dir"}),L=async()=>{a({request:j(),success:a=>{Array.isArray(a.data)||(I.value=[...a.data.dir.map(a=>({path:a,type:"dir",typeTitle:"目录"})),...a.data.file.map(a=>({path:a,type:"file",typeTitle:"文件"}))])}})},O=async()=>{try{if(!G.path)return void A.error("请输入白名单目录");await a({request:C({path:G.path}),message:!0,loading:"正在添加白名单目录，请稍后...",success:L}),G.path=""}catch(e){}},U=[k(),{label:"路径",prop:"path",showOverflowTooltip:!0},{label:"类型",prop:"typeTitle"},{label:"操作",align:"right",fixed:"right",render:t=>m("span",{class:"bt-link",onClick:()=>(async t=>{await e({icon:"warning-filled",title:"删除白名单目录",width:"34rem",content:"删除白名单目录【"+t.path+"】，是否继续操作？"}),a({request:x({path:t.path,type:t.type}),message:!0,loading:"正在删除白名单目录，请稍后...",success:L})})(t)},[d("删除")])}];return h(()=>{L()}),(a,e)=>{const r=v,o=w,n=t,p=s,c=i,h=l,j=f("bt-loading");return u(),y("div",V,[m(c,null,{"header-left":b(()=>[m(r,{modelValue:_(G).path,"onUpdate:modelValue":e[0]||(e[0]=a=>_(G).path=a),name:"path",placeholder:"选择目录/文件全路径",icon:"icon-file_mode",onIconClick:e[1]||(e[1]=a=>{T({type:"all",change(a,e){G.path=a,G.type=e,"dir"!==e||a.endsWith("/")||(G.path+="/")}})}),onChangePassive:e[2]||(e[2]=a=>{var e;G[e="path"]=G[e].replace(/\s+/g,"")}),width:"32rem"},null,8,["modelValue"]),m(o,{class:"!ml-[.8rem]",type:"primary",onClick:O},{default:b(()=>e[3]||(e[3]=[d(" 添加 ",-1)])),_:1,__:[3]})]),content:b(()=>[g(m(n,{ref_key:"whiteList",ref:H,column:U,data:_(I),description:"白名单列表为空"},null,8,["data"]),[[j,"正在加载白名单列表，请稍后...","title"]])]),"footer-left":b(()=>[m(p,{"table-ref":_(H),options:B},null,8,["table-ref"])]),_:1}),m(h,{options:P,class:"mx-[1.6rem] my-[0.6rem]"})])}}});export{A as default};
