import{m as w,j as T,h as m,o as t,r as y,k as _,f as G,w as r,c as i,b as S,a as u,n as C,u as n,A as $,F as x,G as h,O as U,a0 as P}from"./index-DRopsKkO.js";import{c as A,a as B,_ as M}from"./BasePage-C3DiNX0e.js";import{u as N,O as z}from"./index-_-ijfL1Q.js";import{_ as E}from"./UCheckbox.vue_vue_type_script_setup_true_lang-DU8e2C49.js";import"./ULabel.vue_vue_type_script_setup_true_lang-B9XE8rwf.js";const O={__name:"TldCheckbox",props:w({label:{type:String,default:""},value:{type:String,default:""}},{modelValue:{type:Array,default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(d){const e=T(d,"modelValue"),l={checkboxLabel:{base:"gap-1 border border-brand-200 p-2 items-center flex rounded bg-white",label:"items-center flex !font-normal !p-0"},checkbox:"rounded-sm !size-3",iconWrapper:"rounded-sm !size-3",checkedIcon:{defaults:{size:"4xs"}}};return(s,o)=>{const c=E;return t(),m(c,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=p=>e.value=p),value:d.value,label:d.label,config:l},null,8,["modelValue","value","label"])}}},R={key:0,class:"relative"},j={key:0,class:"absolute inset-0 flex justify-center items-center"},F={class:"text-sm text-center"},K={__name:"Page",setup(d){const e=N(),l=y([]),s=y([]),o=_(()=>[...new Set(l.value.flatMap(a=>[...a.tlds]))]),c=_(()=>e.isDomainsLoading),p=_(()=>e.payments.mailin.isActive?{name:"GettingStarted/Payments/Step4"}:e.payments.banktransfer.isActive?{name:"GettingStarted/Payments/Step3"}:{name:"GettingStarted/Payments/Step1"});G(async()=>{e.setDomainsLoading(!0),await e.getDomainSalesTlds(),e.setDomainsLoading(!1),l.value=e.domains.tlds.availableGroupedTlds,s.value=e.domains.tlds.selectedTlds.length?e.domains.tlds.selectedTlds:o.value});async function k(a){s.value.length&&(e.setDomainsLoading(!0),await e.updateDomainSalesTlds({tlds:s.value}),e.setDomainsLoading(!1)),a()}return(a,b)=>{const D=B,g=A,L=P;return t(),m(M,{group:a.$t("group.domains"),"group-step":n(z)*5,title:a.$t("title.domains"),description:a.$t("description.tlds"),"prevent-next":c.value,prev:p.value,next:{name:"GettingStarted/Domains/Step2"},skip:{name:"GettingStarted/Domains/Step2"},loading:n(e).isDomainsLoading,onContinue:k},{default:r(()=>[l.value.length?(t(),i("div",R,[S("div",{class:C(["grid w-full grid-cols-2 gap-8 lg:w-[840px] mb-8",{"opacity-70":n(e).isDomainsLoading}])},[(t(!0),i(x,null,h(l.value,f=>(t(),i("div",{key:f.title,class:"space-y-3 col-span-1"},[u(g,{wrap:"",gap:"sm"},{default:r(()=>[u(D,{html:f.groupName,class:"mb-0 text-left text-sm"},null,8,["html"])]),_:2},1024),u(g,{wrap:"","no-mobile":"",gap:"sm",class:"sm:flex-row"},{default:r(()=>[(t(!0),i(x,null,h(f.tlds,v=>(t(),m(O,{key:v,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=V=>s.value=V),disabled:n(e).isDomainsLoading,value:v,label:v},null,8,["modelValue","disabled","value","label"]))),128))]),_:2},1024)]))),128)),n(e).isDomainsLoading?(t(),i("div",j)):$("",!0)],2),u(g,{class:"justify-center"},{default:r(()=>[S("div",F,U(a.$t("label.selectedTld",{selected:s.value.length,totalTlds:o.value.length})),1)]),_:1})])):(t(),m(L,{key:1,loading:n(e).isDomainsLoading,color:"gray"},null,8,["loading"]))]),_:1},8,["group","group-step","title","description","prevent-next","prev","loading"])}}};export{K as default};
