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