import p from"./WizardStepGeneric-Cz0VLK47.js";import{d as m,w as g,O as h,P as v,o as w,L as _,cH as s,r as i}from"./index-D92x6h1h.js";import"./IdnodeConfigForm-BL6DOswR.js";import"./sliders-horizontal-Am8f4Xsv.js";import"./WizardFooter-BPmWxkFy.js";const k=m({__name:"WizardStepHello",setup(y){const t=i(null),n=i(""),u=i(!1);function f(e){const a=e.find(l=>l.id==="ui_lang");n.value=typeof a?.value=="string"?a.value:"",u.value=!0}let r=null,o=!1;g(()=>t.value?.formRef?.currentValues?.ui_lang,e=>{!u.value||o||typeof e!="string"||!e||e!==n.value&&(r!==null&&globalThis.clearTimeout(r),r=globalThis.setTimeout(()=>{r=null,c(e)},300))});async function c(e){const a=t.value?.formRef;if(a?.currentValues){o=!0;try{await _("wizard/hello/save",{node:JSON.stringify(a.currentValues)});try{await s()}catch(l){console.warn("[wizard] /locale.js refetch failed:",l)}await a.reload(),n.value=e}catch(l){console.warn("[wizard] live-preview language refresh failed:",l)}finally{o=!1}}}h(()=>{r!==null&&globalThis.clearTimeout(r)});async function d(e){if((typeof e.ui_lang=="string"?e.ui_lang:"")!==n.value)try{await s()}catch(l){console.warn("[wizard] /locale.js refetch failed:",l)}}return(e,a)=>(w(),v(p,{ref_key:"stepRef",ref:t,step:"hello","before-next":d,onLoaded:f},null,512))}});export{k as default};
