import{d as I,ab as P,e as l,i as z,E as A,q as m,f as y,r as c,k as d,o as u,an as F,bA as H,bB as M,bC as R,_ as U}from"./index-D92x6h1h.js";import{I as G}from"./IdnodeConfigForm-BL6DOswR.js";import{W as T}from"./WizardFooter-BPmWxkFy.js";import"./sliders-horizontal-Am8f4Xsv.js";const j={class:"wizard-step"},q={class:"wizard-step__scroll"},D=["src"],J=["innerHTML"],K={class:"wizard-step__form"},O=I({__name:"WizardStepGeneric",props:{step:{},beforeNext:{type:Function}},emits:["loaded"],setup(h,{expose:x,emit:S}){const t=h,b=S,p=F(),v=P(),a=c(null),o=c(!1),r=c(""),i=c(""),w=d(()=>v.prevStepBefore(t.step)),g=d(()=>v.nextStepAfter(t.step)),k=d(()=>`wizard/${t.step}/load`),C=d(()=>`wizard/${t.step}/save`);function N(e){const n=e.find(_=>_.id==="icon"),s=e.find(_=>_.id==="description"),f=typeof n?.value=="string"?n.value:"";r.value=V(f);const $=typeof s?.value=="string"?s.value:"";i.value=H(M(R($))),b("loaded",e)}function V(e){return e?e.startsWith("/")||/^https?:\/\//i.test(e)?e:`/${e}`:""}async function W(){if(!(!a.value||o.value)){o.value=!0;try{await a.value.save()}finally{o.value=!1}}}async function B(){const e=a.value?.currentValues,n=e&&typeof e=="object"?{...e}:{};if(t.beforeNext)try{await t.beforeNext(n)}catch(f){console.error("[wizard] beforeNext hook failed:",f)}const s=g.value;s!==null&&await p.push({name:`wizard-${s}`})}async function E(){const e=w.value;e!==null&&await p.push({name:`wizard-${e}`})}async function L(){await v.cancel(),await p.push({name:"epg"})}return x({formRef:a}),(e,n)=>(u(),l("div",j,[z("div",q,[r.value||i.value?(u(),l("header",{key:0,class:A(["wizard-step__header",{"wizard-step__header--logo-right":h.step==="hello"}])},[r.value?(u(),l("img",{key:0,src:r.value,alt:"",class:"wizard-step__icon"},null,8,D)):m("",!0),i.value?(u(),l("div",{key:1,class:"wizard-step__description",innerHTML:i.value},null,8,J)):m("",!0)],2)):m("",!0),z("div",K,[y(G,{ref_key:"formRef",ref:a,"load-endpoint":k.value,"save-endpoint":C.value,"always-dirty":!0,"hide-toolbar":!0,onLoaded:N,onSaved:B},null,8,["load-endpoint","save-endpoint"])])]),y(T,{"prev-step":w.value,saving:o.value,onPrevious:E,onCancel:L,onSave:W},null,8,["prev-step","saving"])]))}}),ee=U(O,[["__scopeId","data-v-47d55935"]]);export{ee as default};
