import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1764830988434";import{u as a,cL as r,gW as l}from"./page_layout.js?v=1764830988434";import{a as o,t,e as d,h as s}from"./utils3.js?v=1764830988434";import{dR as p,au as i,dV as u,da as n,aC as c,df as _,dj as v}from"./naive.js?v=1764830988434";import{k as m,c as y,P as x,r as b,e as h,a2 as f,V as S,a3 as g,W as w,an as j,S as L,U as D,j as U}from"./vue.js?v=1764830988434";import"./common.js?v=1764830988434";import"./__commonjsHelpers__.js?v=1764830988434";import"./public.js?v=1764830988434";const $={class:"w-300px"},k=m({__name:"domain-form",props:{row:{},isEdit:{type:Boolean},onRefresh:{}},setup(m,{expose:k}){const P=a(),C=m,{isEdit:M,row:X,onRefresh:q}=C,E=y(()=>M&&X?X.provider_name.includes("CloudFlare"):o.value.includes("CloudFlare")),{t:R}=x(),T=b(null),F=h({record_type:"A",record_value:"",ttl:1,ps:"",proxy:0,priority:10,record:""}),V={record:{required:!0,trigger:"change",message:R("SSL.Domain.index_12")},record_value:{required:!0,trigger:["blur","change"],message:R("SSL.Domain.index_14")},ttl:{required:!0,trigger:"blur",type:"number",message:R("SSL.Domain.index_15")},priority:{required:!0,trigger:"blur",type:"number",message:"Please enter the priority"}},W=()=>{F.record_value=P.address},z=()=>({id:M&&X?X.id:null,pid:s.value,domain:d.value,record:F.record,record_type:F.record_type,record_value:F.record_value,ttl:F.ttl,ps:F.ps,proxy:E.value&&"MX"!==F.record_type?F.proxy:-1,priority:"MX"===F.record_type?F.priority:-1});return(()=>{const{row:e,isEdit:a}=C;a&&e&&(F.record=e.record,F.record_type=e.record_type,F.record_value=e.record_value,F.ttl=e.ttl,F.ps=e.ps,F.proxy=e.proxy,F.priority="MX"===F.record_type?e.priority:-1)})(),k({onConfirm:async()=>{var e;await(null==(e=T.value)?void 0:e.validate()),M&&X?await r(z()):await l(z()),q()}}),(a,r)=>{const l=i,o=p,d=u,s=c,m=n,y=_,x=v,b=e;return S(),f(b,{class:"p-20px",ref_key:"formRef",ref:T,model:D(F),rules:V},{default:g(()=>[w(o,{label:a.$t("SSL.Domain.index_11"),path:"record"},{default:g(()=>[L("div",$,[w(l,{value:D(F).record,"onUpdate:value":r[0]||(r[0]=e=>D(F).record=e),placeholder:a.$t("SSL.Domain.index_12"),disabled:D(M)},null,8,["value","placeholder","disabled"])])]),_:1},8,["label"]),w(o,{label:a.$t("Ftp.Table.index_3"),path:"record_type"},{default:g(()=>[w(d,{class:"w-300px",value:D(F).record_type,"onUpdate:value":r[1]||(r[1]=e=>D(F).record_type=e),options:D(t),disabled:D(M)},null,8,["value","options","disabled"])]),_:1},8,["label"]),w(o,{label:a.$t("SSL.Domain.index_13"),path:"record_value"},{default:g(()=>[w(m,{class:"flex-nowrap!",size:5},{default:g(()=>[w(l,{class:"w-300px!",value:D(F).record_value,"onUpdate:value":r[2]||(r[2]=e=>D(F).record_value=e),placeholder:a.$t("SSL.Domain.index_14")},null,8,["value","placeholder"]),w(s,{onClick:W},{default:g(()=>r[7]||(r[7]=[U(" USE IP ",-1)])),_:1,__:[7]})]),_:1})]),_:1},8,["label"]),w(o,{label:"TTL",path:"ttl"},{default:g(()=>[w(y,{"show-button":!1,class:"w-300px!",value:D(F).ttl,"onUpdate:value":r[3]||(r[3]=e=>D(F).ttl=e),placeholder:a.$t("SSL.Domain.index_15")},null,8,["value","placeholder"])]),_:1}),"MX"===D(F).record_type?(S(),f(o,{key:0,label:"Priority",path:"priority"},{default:g(()=>[w(y,{"show-button":!1,class:"w-300px!",value:D(F).priority,"onUpdate:value":r[4]||(r[4]=e=>D(F).priority=e),placeholder:"Please enter the priority",min:1,max:65535},null,8,["value"])]),_:1})):j("",!0),w(o,{label:a.$t("Public.Table.Ps"),path:"ps"},{default:g(()=>[w(l,{class:"w-300px!",value:D(F).ps,"onUpdate:value":r[5]||(r[5]=e=>D(F).ps=e),placeholder:a.$t("Crontab.arrange.index_27")},null,8,["value","placeholder"])]),_:1},8,["label"]),D(E)&&"MX"!==D(F).record_type?(S(),f(o,{key:1,label:a.$t("SSL.Domain.index_16"),path:"proxy"},{default:g(()=>[w(x,{value:D(F).proxy,"onUpdate:value":r[6]||(r[6]=e=>D(F).proxy=e),"checked-value":1,"unchecked-value":0},null,8,["value"])]),_:1},8,["label"])):j("",!0)]),_:1},8,["model"])}}});export{k as default};
