import{d as z,ab as y,N as g,L as _,bA as C,bB as k,bC as S,e as t,i as W,q as c,f as b,r as l,an as B,o as i,cI as N,_ as x}from"./index-D92x6h1h.js";import{W as L}from"./WizardFooter-BPmWxkFy.js";import{m as M}from"./setupGreeting-89tMXdwS.js";const P={class:"wizard-step"},H={class:"wizard-step__scroll"},T={key:0,class:"wizard-step__header"},U=["src"],V=["innerHTML"],A=z({__name:"WizardStepChannels",setup(E){const d=B(),p=y(),e=l(""),s=l(""),n=l(!1);g(async()=>{try{const r=(await _("wizard/channels/load",{meta:1})).entries?.[0]?.params??[],u=r.find(o=>o.id==="icon"),f=r.find(o=>o.id==="description");typeof u?.value=="string"&&(e.value=v(u.value)),typeof f?.value=="string"&&(s.value=C(k(S(f.value))))}catch(a){console.warn("[wizard] channels/load failed:",a)}});function v(a){return a?a.startsWith("/")||/^https?:\/\//i.test(a)?a:`/${a}`:""}async function h(){if(!n.value){n.value=!0;try{await _("wizard/channels/save",{node:JSON.stringify({})}),await p.cancel()}catch(a){console.warn("[wizard] finish flow failed:",a)}finally{n.value=!1}M(),globalThis.location.assign(N)}}async function m(){await d.push({name:"wizard-mapping"})}async function w(){await p.cancel(),await d.push({name:"epg"})}return(a,r)=>(i(),t("div",P,[W("div",H,[e.value||s.value?(i(),t("header",T,[e.value?(i(),t("img",{key:0,src:e.value,alt:"",class:"wizard-step__icon"},null,8,U)):c("",!0),s.value?(i(),t("div",{key:1,class:"wizard-step__description",innerHTML:s.value},null,8,V)):c("",!0)])):c("",!0)]),b(L,{"prev-step":"mapping","is-final":!0,saving:n.value,onPrevious:m,onCancel:w,onSave:h},null,8,["saving"])]))}}),J=x(A,[["__scopeId","data-v-70af3c87"]]);export{J as default};
