import{i as U,c as A}from"./app-a6cKceqE.js";import{_ as S}from"./app-C7Q3X0uc.js";import{_ as $}from"./app-DwtlHtUX.js";import{_ as I}from"./app-CignoBaV.js";import{_ as B}from"./app-CQ-vNlMj.js";import{_ as D}from"./app-DY-0PadZ.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-BYcXwl4U.js";import{_ as h}from"./app-Ufpj4Ll4.js";import{a as G,_ as J}from"./app-DxbU-QrX.js";import{_ as P}from"./app-IR9dR9RM.js";import{a as z,T as E}from"./app-BmaR5UVy.js";import{P as M}from"./app-0YmIdYYs.js";import{D as j}from"./app-7GBSHA5C.js";import"./app-DCd54JMo.js";import"./app-MrAtUXr3.js";import"./app-BWSI2Z1R.js";import"./app-DPDEogA0.js";import"./app-DxjODhok.js";import"./app-CabATHnR.js";import"./app-BhzV4gWo.js";import"./app-BHl80pFw.js";import"./app-BG60hdvp.js";import"./app-CrjU8lgK.js";import"./app-ysQ8KbGS.js";import"./app-Cp3gmk2J.js";import"./app--MWyBMkA.js";import"./app-CNARLpXE.js";import"./app-SxAW7vhf.js";import"./app-D5k1HLu9.js";import"./app-BDgR0DSb.js";import"./app-D2Wz0BUQ.js";import"./app-D3zbrzdO.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};
