import{c as e,s as a,r as s,q as t,v as l,x as r,e as c,B as i,y as u,F as o,b0 as m,N as p,ak as f,al as n,ab as v,a9 as d}from"./base-lib.js?v=1761009159";import{b as y}from"./utils-lib.js?v=1761009159";import{g as b}from"./useStore10.js?v=1761009159";import{J as _,K as h}from"./ssl.js?v=1761009159";import{u as V}from"./useStore11.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const j={class:"p-[2rem] flex justify-center flex-col"},g=e({__name:"index",props:{compData:{type:Object,default:()=>{}}},emits:["close"],setup(e,{expose:g,emit:D}){const w=y(),{activeTabs:x,sslIsRefresh:R,testIsRefresh:k,encryptIsRefresh:I,otherIsRefresh:L}=a(V()),{refs:{isRefreshDomainList:S,typeList:q}}=b(),J=e,N=D,O=s(),B=s({selectValue:""}),C={selectValue:[{required:!0,message:"请选择".concat("certificate"===J.compData.type?"证书分组":"域名分类"),trigger:"change"}]},F=s([]),H=s([]),K=async e=>{var a;let s;try{switch(e){case"certificate":if(H.value=J.compData.itemList.map(e=>({id:e.id,type:e.type})),s=await h({ids:JSON.stringify(H.value),group_id:B.value.selectValue}),s.status){const e={ssl:()=>R.value=!0,test:()=>k.value=!0,encrypt:()=>I.value=!0,other:()=>L.value=!0};null==(a=e[x.value])||a.call(e)}break;case"domain":H.value=J.compData.itemList.map(e=>e.id),s=await _({ids:JSON.stringify(H.value),type_id:B.value.selectValue}),s.status&&(S.value=!0)}}catch(t){}return s};return g({onConfirm:async()=>{if(O.value)try{await O.value.validate();const e=w.load("正在".concat("certificate"===J.compData.type?"设置证书分组":"设置域名分类","，请稍候..."));try{const e=await K(J.compData.type);w.request(e),e.status&&N("close")}finally{e.close()}}catch(e){return!1}}}),t(()=>{F.value=q.value.filter(e=>"all"!==e.value)}),(a,s)=>{const t=f,y=n,b=v,_=d;return l(),r("div",j,[c(_,{ref_key:"formRef",ref:O,model:u(B),rules:C},{default:i(()=>[c(b,{label:"certificate"===e.compData.type?"证书分组":"域名分类",prop:"selectValue"},{default:i(()=>[c(y,{modelValue:u(B).selectValue,"onUpdate:modelValue":s[0]||(s[0]=e=>u(B).selectValue=e),class:"!w-[31rem]"},{default:i(()=>[(l(!0),r(o,null,m(u(F),e=>(l(),p(t,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])])}}});export{g as default};
