import{_ as e}from"./index105.js?v=1761009159";import{b as a,P as s,l,k as t,j as o}from"./utils-lib.js?v=1761009159";import{c as r,r as n,o as u,v as i,x as d,e as c,B as p,I as m,y as f,G as _,b3 as y,J as g,q as k,H as h,N as w,C as b,z as v,Q as x,ab as j,a9 as q}from"./base-lib.js?v=1761009159";import{outThesaurus as C,delThesaurus as V,clearThesaurus as z,getThesaurus as R,addThesaurus as U}from"./site.js?v=1761009159";import{u as H}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const I=r({__name:"upload-thesaurus",emits:["upload-success"],setup(e,{expose:s,emit:l}){const t=a(),o=n(),r=n(),k=l,h=window.location.protocol+"//"+window.location.host+"/project/content/in_thesaurus",w=u({f_size:0,f_path:"/tmp/",f_name:"inthesaurus.txt",f_start:0}),b=n([]),v=[".txt"].join(","),x=()=>{k("upload-success"),t.success("导入成功")},j=()=>{t.error("导入失败")},q={"x-http-token":window.vite_public_request_token},C=e=>{e.value=e,w.f_size=e.size,w.f_start=0},V=(e,a)=>{b.value=a},z=(e,a,s)=>{w.f_start=e.percent,b.value=s.map(s=>(s.uid===a.uid&&(s.percentage=e.percent),s))};return s({onConfirm:()=>{r.value.submit()},open:()=>{o.value.$el.click()},fileData:w}),(e,a)=>{const s=_,l=y;return i(),d("div",null,[c(l,{class:"upload-demo",ref_key:"uploadRef",ref:r,name:"blob",data:f(w),action:h,headers:q,accept:f(v),"on-error":j,multiple:!1,"show-file-list":!1,"auto-upload":!0,"on-success":x,"on-progress":z,"file-list":f(b),"on-change":V,"before-upload":C},{default:p(()=>[m(c(s,{ref_key:"openRef",ref:o,size:"small",type:"primary"},null,512),[[g,!1]])]),_:1},8,["data","accept","file-list"])])}}}),S=r({__name:"own-thesaurus",setup(a){const r=n(null),d=n([]),y=n(!1),g=n(),S=n(!1),A=u({key:""}),B=u({key:[{trigger:["blur","change"],required:!0,message:"请输入关键词"}]}),D=async()=>{r.value.open()},F=()=>{s({loading:"正在导出关键词文件，请稍后...",request:C(),data:{msg:String},success:e=>{e.msg&&window.open("/download?filename="+e.msg,"_blank","noopener,noreferrer")}})},G=async e=>{P()},J=[{label:"关键词\t",render:e=>c("span",null,[e])},H([{onClick:async e=>{await s({loading:"正在删除关键词，请稍后...",request:V({key:e}),message:!0}),P()},title:"删除"}])],N=async()=>{await s({loading:"正在清空自定义词库，请稍后...",request:z(),message:!0}),P()},P=async()=>{y.value=!0,await s({loading:"正在加载词库列表，请稍后...",request:R(),data:[Array,d]}),y.value=!1},Q=async e=>{await g.value.validate(),await s({loading:"正在添加关键词，请稍候...",request:U(A),message:!0,success:e=>{e.status&&(A.key="",S.value=!1,P())}})};return k(()=>P()),(a,s)=>{const n=_,u=l,k=t,C=j,V=q,z=o,R=e,U=h("bt-loading");return i(),w(R,{class:"px-[1.6rem] py-[1.6rem]"},{"header-left":p(()=>[c(n,{onClick:s[0]||(s[0]=e=>S.value=!0),type:"primary"},{default:p(()=>s[3]||(s[3]=[b("添加",-1)])),_:1,__:[3]}),c(n,{onClick:D},{default:p(()=>s[4]||(s[4]=[b("导入",-1)])),_:1,__:[4]}),c(n,{onClick:F},{default:p(()=>s[5]||(s[5]=[b("导出",-1)])),_:1,__:[5]}),c(n,{onClick:N},{default:p(()=>s[6]||(s[6]=[b("清空",-1)])),_:1,__:[6]}),c(I,{ref_key:"fileIpRef",ref:r,onUploadSuccess:G},null,512)]),content:p(()=>[m(c(u,{"max-height":"260",column:J,data:f(d),description:"词库列表为空"},null,8,["data"]),[[U,f(y)],[U,"正在加载词库列表，请稍后...","title"]])]),popup:p(()=>[c(z,{title:"添加自定义词库",modelValue:f(S),"onUpdate:modelValue":s[2]||(s[2]=e=>x(S)?S.value=e:null),area:42,onConfirm:Q,showFooter:""},{default:p(()=>[c(V,{ref_key:"addThesaurusRef",ref:g,rules:f(B),model:f(A),class:"p-[2rem]","label-width":"5rem"},{default:p(()=>[c(C,{label:"关键词",prop:"key"},{default:p(()=>[c(k,{modelValue:f(A).key,"onUpdate:modelValue":s[1]||(s[1]=e=>f(A).key=e),width:"20rem",placeholder:"请输入你需要扫描的关键词"},null,8,["modelValue"])]),_:1}),s[7]||(s[7]=v("ul",{class:"leading-8 text-small list-disc ml-20px"},[v("li",null,"关键字小于2时会引起大量误报，请设置大于等于2个关键字！")],-1))]),_:1,__:[7]},8,["rules","model"])]),_:1},8,["modelValue"])]),_:1})}}});export{S as default};
