import{r as a,c as e,t as s,g as t,e as l,T as r,ak as i,C as o,be as u,al as n,q as p,a6 as c,I as m,y as d,v,x as g,B as y,aY as f,bu as b}from"./base-lib.js?v=1761009159";import{P as x,j9 as _,K as j,$ as w}from"./utils-lib.js?v=1761009159";import{c as h,i as I,g as P}from"./index56.js?v=1761009159";import{h as k,o as D}from"./form-item.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index105.js?v=1761009159";import"./index114.js?v=1761009159";import"./useMethod7.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./useMethod9.js?v=1761009159";import"./header-nav-tools.vue_vue_type_script_setup_true_lang.js?v=1761009159";const q=a({bind:"",status:!0,tags:[],cycle:10}),V=a(!1),C={class:"pt-[1.6rem] px-[3rem]"},H=e({__name:"index",props:{compData:{type:Object,default:()=>({})}},setup(a,{expose:e}){const H=a,{row:z}=s(H.compData),B=[{isHtml:!0,content:'<span class="text-warningDark">开启IP轮换后会定时在选择的多个IP中依次轮换，需要多IP的机器</span>'},{isHtml:!0,content:'<span class="text-warningDark">此功能为附加功能，不影响使用，普通用户可以忽略</span>'}],{BtForm:M,submit:O}=j({data:()=>q.value,options:a=>t(()=>[k("轮换周期",()=>l(r,{modelValue:a.value.cycle,"onUpdate:modelValue":e=>a.value.cycle=e,placeholder:"请输入轮换周期"},{append:()=>"分钟"}),"cycle",{rules:[{required:!0,message:"请输入轮换周期",trigger:"blur"}]}),k("IP池",()=>l(n,{class:"bt-multiple-select",modelValue:a.value.tags,"onUpdate:modelValue":e=>a.value.tags=e,placeholder:"请选择IP",multiple:!0},{default:()=>[I.value.map(a=>l(i,{key:a.value,label:a.label,value:a.value},{default:()=>[l("span",{style:"float: left; max-width: 10ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"},[a.label]),l("span",{class:"ml-[.8rem]",style:"float: right; color: var(--el-base-tertiary); font-size: var(--el-font-size-small)"},[o("IP: "),a.ip])]}))],tag:()=>{var e;return(null==(e=a.value.tags)?void 0:e.length)?l("div",{class:"flex flex-wrap gap-[5px]"},[a.value.tags.map(a=>l(u,{key:a,type:"info",closable:!0,class:"!w-auto inline-flex items-center",onClose:()=>U(a)},{default:()=>[a,o(" "),l("span",{class:"text-tertiary ml-1"},[o("IP: "),F(a)])]}))]):null}}),"tags",{rules:[{required:!0,message:"请选择IP",trigger:"blur"}]}),D("状态","status")]),submit:async(a,e)=>(await e(),await(async a=>{const e=await x({request:_({bind:a.bind,tags:a.tags.join(","),cycle:a.cycle,status:a.status?1:0}),loading:"设置中...",message:!0});return e.status&&h(),e.status})(a.value))}),U=a=>{const e=q.value.tags.indexOf(a);e>-1&&q.value.tags.splice(e,1)},F=a=>{const e=I.value.find(e=>e.value===a);return(null==e?void 0:e.ip)||""};return p(async()=>{(a=>{a.domain&&(q.value.bind=a.domain),a.ip_tag&&(q.value.tags=a.ip_tag.map(a=>a.tag)),a.ip_rotate&&(q.value.cycle=a.ip_rotate.cycle,q.value.status=a.ip_rotate.status)})(z.value),V.value=!0,await P(),V.value=!1}),c(()=>{q.value.tags=[],q.value.cycle=10,q.value.status=!0,q.value.bind=""}),e({onConfirm:async()=>{try{return await O()}catch(a){return!1}}}),(a,e)=>{const s=w,t=f,r=b;return m((v(),g("div",C,[l(t,{class:"!mb-[1.6rem]",type:"warning",closable:!1},{default:y(()=>[l(s,{options:B,listStyle:"disc",class:"!text-warningDark"})]),_:1}),l(d(M))])),[[r,d(V)]])}}});export{H as default};
