import{u as a,l as e,N as l,K as t,H as r,t as s,x as u,dy as i}from"./utils-lib.js?v=20260328163632";import{B as n}from"./index85.js?v=20260328163632";import{u as p}from"./index115.js?v=20260328163632";import{k as o,a9 as v,r as m,n as c,O as d,o as b,V as f,_ as y,Y as h,u as z}from"./base-lib.js?v=20260328163632";import{N as g}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index88.js?v=20260328163632";const j=o({__name:"index",props:{compData:{default:{fileItem:{}}}},setup(o,{expose:j}){const x=o,{isWin:_}=a(),{fileTabActiveData:k,refreshFilesList:A}=p(),{fileItem:w}=v(x.compData),O=m(!1),I=m(null),N=[{label:"tar.gz",value:"tar.gz"},{label:e("zip (通用格式)"),value:"zip"},{label:"tar",value:"tar"},{label:"tar.bz2",value:"tar.bz2"},{label:"tar.xz",value:"tar.xz"},{label:e("7z (压缩率极高的压缩格式)"),value:"7z"},{label:"gz",value:"gz"}],S={labelStyle:"min-width: 100px"},D=m({label:e("压缩类型"),attrs:S,children:[{type:"select",key:"type",attrs:{class:"!w-280px",options:N,consistentMenuWidth:!1,placeholder:e("请选择压缩类型"),"onUpdate:value":a=>{q.value.filename=k.value.param.path+"/"+(Array.isArray(w.value)?k.value.label:w.value.name)+"_"+l(5)+"."+a,c((()=>W()))}}}]}),U=m({label:e("压缩路径"),attrs:S,ruleKey:"filename",rules:[t({message:e("请选择压缩路径"),trigger:["blur","input"]})],children:[{type:"custom",key:"filename",render:()=>d(n,{ref:I,modelValue:q.value.filename,"onUpdate:modelValue":a=>q.value.filename=a,onIconClick:C,placeholder:e("请输入压缩路径"),width:"240px",icon:"el-folder-opened"},null)}]}),V=m({label:" ",attrs:S,children:[{type:"custom",key:"is_task",render:()=>{let a;return d(g,{checked:q.value.is_task,"onUpdate:checked":a=>q.value.is_task=a},"function"==typeof(l=a=e("是否后台压缩"))||"[object Object]"===Object.prototype.toString.call(l)&&!z(l)?a:{default:()=>[a]});var l}}]}),W=()=>{var a;return null==(a=I.value)?void 0:a.handleScrollEnd()},C=()=>{r({type:"dir",path:k.value.param.path+"/",change:a=>{q.value.filename=a+"/"+(Array.isArray(w.value)?k.value.label:w.value.name)+"_"+l(5)+"."+q.value.type,c((()=>W()))}})},H=m({formAttrs:{labelWidth:"auto"},formItems:[D.value,U.value,V.value]}),[K,q,B]=s(H);return b((()=>{O.value=Array.isArray(w.value),Object.assign(q.value,{type:_.value?"zip":"tar.gz",filename:("/"==k.value.param.path?"":k.value.param.path)+"/"+(Array.isArray(w.value)?k.value.label:w.value.name)+"_"+l(5)+(_.value?".zip":".tar.gz")||""}),c((()=>W()))})),j({onConfirm:async()=>{await B.value.validate();return 0===(await u({loading:e("正在压缩文件，请稍后..."),request:i({...q.value,path:k.value.param.path+"/",files:JSON.stringify(O.value?w.value.map((a=>a.name)):[w.value.name])}),data:{status:Number},success:a=>{A()}})).status}}),(a,e)=>(f(),y(h(K),{class:"p-20px"}))}});export{j as default};
