import{i as U,c as A}from"./app-Ba7ZqSpq.js";import{_ as S}from"./app-sWrdQNKf.js";import{_ as $}from"./app-FlPLZh9D.js";import{_ as I}from"./app-DWUwCFNm.js";import{_ as B}from"./app-DFulsyXy.js";import{_ as D}from"./app-T1ysvErZ.js";import{r,o as n,g as a,a as t,u as l,h as d,F as y,D as V,b as e,w as c,c as L,f as O,t as F,i as C}from"./app-SC54XQDl.js";import{_ as h}from"./app-CVQkwzlf.js";import{a as G,_ as J}from"./app-PrSv7rSt.js";import{_ as P}from"./app-BFpT2Aj_.js";import{a as z,T as E}from"./app-nyOoGAKT.js";import{P as M}from"./app-BxWqoSpr.js";import{D as j}from"./app-ZeVDYyDS.js";import"./app-CL60OiIv.js";import"./app-D9TrJBlL.js";import"./app-_Ovp2dOH.js";import"./app-BjSCO7rC.js";import"./app-Dhl-Bw0H.js";import"./app-B2C_dtYI.js";import"./app-COidJXl1.js";import"./app-DZaelcLs.js";import"./app-PPG0ZS4d.js";import"./app-CNHjdV6U.js";import"./app-DnXuoh8P.js";import"./app-BZGObKCm.js";import"./app-BPIIxVwk.js";import"./app-DgoEZtNT.js";import"./app-Ch8j4za4.js";import"./app-Dw0jKdCD.js";import"./app-CCkWSX4Q.js";import"./app-DoVkxbmA.js";import"./app-C2mBgI5Z.js";function q(){U(this),this.success=this.$NotifyReloadSuccess("保存成功")}const H=["value"],K={class:"ui table selectable celled",style:{"max-width":"60em"}},Q={class:"full-width"},W=t("th",{style:{width:"10em"}},"记录名",-1),X=t("th",{style:{width:"7em"}},"记录类型",-1),Y=t("th",null,"线路",-1),Z={key:0},tt={key:1},et={key:2,class:"one op"},ot={key:0},lt={key:1},st=t("span",null,"秒",-1),nt={key:2,class:"vertical-middle"},at=["onClick"],ut=t("i",{class:"pi pi-remove"},null,-1),it=[ut],mt={__name:"NSCreateRecordsTable",props:["v-types"],setup(v){const m=v,p=r([]),{types:x,records:_,lastIndex:k,isAddingRoutes:i}=function(){let u=m.vTypes;return u==null&&(u=[]),{types:r(u),records:r([{name:"",type:"A",value:"",routeCodes:[],ttl:600,index:0}]),lastIndex:r(0),isAddingRoutes:r(!1)}}(),w=function(){_.value.push({name:"",type:"A",value:"",routeCodes:[],ttl:600,index:++k.value}),setTimeout(function(){p.value.$last().focus()},100)},T=function(u){_.value.$remove(u)},g=function(){i.value=!0},R=function(){setTimeout(function(){i.value=!1},1e3)},b=function(u,f){f==null?u.routeCodes=[]:u.routeCodes=f.map(function(s){return s.code})};return(u,f)=>(n(),a("div",null,[t("input",{type:"hidden",name:"recordsJSON",value:JSON.stringify(l(_))},null,8,H),t("table",K,[t("thead",Q,[t("tr",null,[W,X,Y,l(i)?d("",!0):(n(),a("th",Z,"记录值")),l(i)?d("",!0):(n(),a("th",tt,"TTL")),l(i)?d("",!0):(n(),a("th",et,"操作"))])]),(n(!0),a(y,null,V(l(_),(s,N)=>(n(),a("tr",{key:s.index},[t("td",null,[e(h,{type:"text",style:{width:"10em"},modelValue:s.name,"onUpdate:modelValue":o=>s.name=o,ref_for:!0,ref_key:"nameInputs",ref:p},null,8,["modelValue","onUpdate:modelValue"])]),t("td",null,[e(J,{modelValue:s.type,"onUpdate:modelValue":o=>s.type=o},{default:c(()=>[(n(!0),a(y,null,V(l(x),o=>(n(),L(G,{value:o.type},{default:c(()=>[O(F(o.type),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),t("td",null,[e(P,{onAdd:g,onCancel:R,onChange:o=>b(s,o)},null,8,["onChange"])]),l(i)?d("",!0):(n(),a("td",ot,[e(h,{type:"text",style:{width:"10em"},maxlength:"512",modelValue:s.value,"onUpdate:modelValue":o=>s.value=o},null,8,["modelValue","onUpdate:modelValue"])])),l(i)?d("",!0):(n(),a("td",lt,[e(E,null,{default:c(()=>[e(h,{type:"text",modelValue:s.ttl,"onUpdate:modelValue":o=>s.ttl=o,style:{width:"5em"},maxlength:"8"},null,8,["modelValue","onUpdate:modelValue"]),e(z,null,{default:c(()=>[st]),_:1})]),_:2},1024)])),l(i)?d("",!0):(n(),a("td",nt,[t("a",{href:"",title:"删除",onClick:C(o=>T(N),["prevent"])},it,8,at)]))]))),128))]),e(M,{size:"small",type:"button",onClick:C(w,["prevent"])})]))}},dt=t("td",{class:"title"},"域名 *",-1),ct=t("td",null,"解析记录 *",-1),rt=t("td",null,"删除原有同名记录",-1),_t=t("p",{class:"comment"},"选中后，在导入新的记录之前，先删除域名中的同名且同类型记录。",-1),pt=t("td",null,"清空原有记录",-1),ft=t("p",{class:"comment"},"选中后，在导入新的记录之前，先清空域名中的所有记录。",-1),Kt={__name:"createRecords",setup(v){const m=A(new q);return(p,x)=>(n(),a(y,null,[e(S,{ctx:l(m)},null,8,["ctx"]),e(B,{action:"$",onSuccess:l(m).success},{default:c(()=>[e(j,null,{default:c(()=>[t("tbody",null,[t("tr",null,[dt,t("td",null,[e(D,{rows:"15",name:"names",placeholder:"每行一个域名",autofocus:"",class:"w-full"})])]),t("tr",null,[ct,t("td",null,[e(mt,{"v-types":l(m).types,"v-default-ttl":l(m).defaultTTL},null,8,["v-types","v-default-ttl"])])]),t("tr",null,[rt,t("td",null,[e($,{name:"removeOld"}),_t])]),t("tr",null,[pt,t("td",null,[e($,{name:"removeAll"}),ft])])])]),_:1}),e(I)]),_:1},8,["onSuccess"])],64))}};export{Kt as default};
