import{d as Q,h as E,r as g,u as M,H as F,U,X as q,o as k,c as G,b as C,a as r,w as l,f as A,V as u,e as P,n as W,M as $,j as J,I as K,A as X,C as Y,aG as Z,q as ee,aH as x,a2 as oe,_ as ae}from"./index-207e8178.js";import{l as te,o as se,c as d,q as re}from"./checkTypingFunction-087f80ba.js";import{_ as ne,D as m,g as p,d as V}from"./DialogueQuestionClass-96c27afa.js";import{_ as le}from"./ProgramHeader.vue_vue_type_script_setup_true_lang-6add29ec.js";import{a as ie}from"./queryParametersUtils-573565cc.js";import{u as ce}from"./programStore-a9779e15.js";import{u as ue}from"./vue.f36acd1f-7e533c43.js";import"./axios-9b9683dd.js";import"./Speechbubble-5374d34d.js";import"./Searchbar-7510e744.js";import"./VTextField-b712f4db.js";import"./index-d2df2ce1.js";import"./VMenu-a5999549.js";import"./lazy-37150cc6.js";import"./string-79822fd4.js";import"./VForm-0fd17bdf.js";import"./VChip-0d63d8ef.js";import"./PageHeader.vue_vue_type_style_index_0_lang-d0253047.js";const de={class:"no-padding background-secondary color-primary"},me={class:"app-container py-5"},pe=Q({__name:"ProgramDialogue",setup(fe){const{updateColorValues:S}=E();S("secondary"),ue({title:"Leeroverzicht - Leren - Opleidingen",meta:[{name:"description",content:"Hulpdialoog voor het zoeken van een opleiding."}],link:[{rel:"canonical",href:document.location.origin+"/leren"}]});const a=(()=>[new m({question:"Waarover gaat de cursus of opleiding die je zoekt?",property:"zoekargument",possibleAnswers:[],placeholder:"Kinderopvang, installatietechniek, hovenier, etc."}),new m({question:"Op welk niveau wil je de opleiding doen?",possibleAnswers:te.map(e=>({label:e.text,value:e.children?e.children.map(o=>o.value).concat(e.value):[e.value]})),property:"niveau",skipText:"Maakt me niet uit"}),new m({question:"Wil je een wettelijk erkend diploma?",possibleAnswers:[{label:"Ja",value:["mbo-diploma","Ad-diploma","bachelordiploma","masterdiploma","mbo-certificaat","mbo-verklaring","middelbareschoolcertificaat","middelbareschooldiploma","PhD","propedeuse"]},{label:"Nee",value:["diploma","certificaat of bewijs van deelname","geen diploma"]}],property:"soort_diploma",skipText:"Maakt me niet uit"}),new m({question:"In de buurt van welke plaats of postcode zoek je een opleiding?",possibleAnswers:se.map(e=>({label:e.text,value:{search_term:"",distance:Number(e.value)}})),property:"location",buttonText:{submit:"Resultaten voor deze locatie",skip:"Opleidingen overal"},inputLabel:"Plaats of Postcode"})])(),T=g(M()),v=ce(),{query:i}=F(v),z=()=>v.programClearSearch(),h=U(),_=g(null),f=g(!0);q(()=>{z()});const B=()=>{f.value=a[0].answers.length<1},j=e=>{f.value=e===0},w=e=>{const o=e??p(a[a.length-1],a,i.value);re(o)&&(i.value=o);const t=ie(x(i.value));h.push({name:"leren-zoeken",query:t.query})},y=(e,o)=>{o&&e.resultCount>0&&(o.show=!0),L()&&w(e.query)},D=e=>{w(N(a.indexOf(x(e))))},R=async(e,o,t=!1)=>{const s=p(e,a,i.value);if(s){try{const n=await d.getProgramCount(s);if(e.setResultCount(n),n===0&&t){const c=await d.getAlternative(s);e.setAlternative(c)}e.query=V(s),y(e,o),B()}catch{e.answers.pop()}b()}},O=async(e,o)=>{const t=p(e,a,i.value);if(!t)return;const s=e.getLastAnswer();s&&(await I(e,t,s),y(e,o))},H=async e=>{const o=p(e,a,i.value);if(!o)return;const t=[...e.possibleAnswers];for(const[s,n]of t.entries()){o[e.property]=n.value;try{const c=await d.getProgramCount(o);t[s].resultCount=c}catch{continue}}e.possibleAnswers=t},I=async(e,o,t)=>{for(const s of e.possibleAnswers){o.location.search_term=t.value.search_term,o.location.distance=s.value?s.value.distance:1;try{const n=await d.getProgramCount(o);if(n===0)continue;e.setResultCount(n),e.answers[e.answers.length-1]={label:"",value:o.location},i.value.location=o.location,e.query=V(o);break}catch{continue}}},L=()=>!a.some(e=>!e.isAnswered()),N=e=>{if(e===0)return a[0].query;if(e>0&&a[e-1])return a[e-1].query},b=()=>{oe(()=>{var o;const e=(((o=_.value)==null?void 0:o.offsetTop)??0)-window.innerHeight;window.scrollTo({top:e>0?e:0,behavior:"smooth"})})};return(e,o)=>(k(),G("main",de,[C("div",me,[r(ee,{fluid:""},{default:l(()=>[r(A,null,{default:l(()=>[r(u,{sm:"12",md:"10","offset-md":"1",class:"text-primary"},{default:l(()=>[r(le)]),_:1})]),_:1}),r(A,null,{default:l(()=>[r(u,{cols:"12",md:"7","order-sm":"1","order-md":"2"},{default:l(()=>[r(ne,{questions:P(a),onChange:R,onSearch:D,onGetCounts:H,onLocation:O,onScrollToBottom:b,onShowAllResultsButtonUpdate:j},null,8,["questions"])]),_:1}),f.value?(k(),W(u,{key:0,cols:"12",md:"11","order-sm":"2","order-md":"3",class:"d-flex align-end justify-end"},{default:l(()=>[r($,{key:"pass-dialogue",id:"pass-dialogue",class:"ma-1 py-6 dialogue-button",onClick:o[0]||(o[0]=()=>{P(h).push({name:"leren-zoeken"})})},{default:l(()=>[J(" Of bekijk alle opleidingen "),r(K,{icon:"caret-right"})]),_:1})]),_:1})):X("",!0),r(u,{xs:"0",md:"3","order-sm":"2","order-md":"1","offset-md":"1"},{default:l(()=>[r(Y,{contain:"",class:"mascot",src:Z,alt:"leeroverzicht mascotte",hidden:T.value.xs},null,8,["hidden"])]),_:1})]),_:1})]),_:1})]),C("div",{ref_key:"scrollElement",ref:_},null,512)]))}});const Re=ae(pe,[["__scopeId","data-v-10a4ea5f"]]);export{Re as default};