import{d as k,k as w,H as V,r as n,X as x,a2 as S,Y as I,o as P,n as C,w as v,a as d,a3 as U,e as A,N as F,Q as L,p as h,g as B,b as f,_ as N}from"./index-207e8178.js";import{u as j}from"./programStore-a9779e15.js";import{a as R,i as T,b as $,V as q}from"./VForm-0fd17bdf.js";import{j as K}from"./checkTypingFunction-087f80ba.js";import{a as M}from"./VTextField-b712f4db.js";const y=l=>(h("data-v-16256199"),l=l(),B(),l),O=y(()=>f("span",{class:"mb-1 font-weight-black"},"Plaats of Postcode",-1)),z=y(()=>f("span",{class:"mb-1 font-weight-black"},"Afstand",-1)),D=k({__name:"ProgramFilterListUserInput",props:{rules:{type:Array,required:!0}},setup(l){const _=w("$piwik"),g=j(),{query:o}=V(g),c=[{text:"minder dan 25 km",value:1},{text:"minder dan 50 km",value:2},{text:"minder dan 100 km",value:3}],i=n(),r=n(""),m=n([]),s=n(1),p=n([]);x(async()=>{try{const a=await K.getListOfCityNames();Array.isArray(a)&&(p.value=a)}catch(a){m.value.push(a)}S(()=>{r.value=o.value.location.search_term,s.value!==o.value.location.distance&&o.value.location.distance!==0&&(s.value=o.value.location.distance)})}),I(o,()=>{c.find(a=>a.value===o.value.location.distance)?s.value=o.value.location.distance:s.value=1},{deep:!0});const b=()=>{var a;(a=i.value)==null||a.resetValidation()},u=async a=>{var t;typeof a=="string"&&_("results","filter",`locatie-${a}`);let e=!1;i.value&&r.value!=""?e=(await i.value.validate()).valid:(t=i.value)==null||t.reset(),e?(o.value.location.search_term=r.value,o.value.location.distance=s.value):o.value.location.search_term=""};return(a,e)=>(P(),C(q,{class:"input-filter",onSubmit:e[6]||(e[6]=L(()=>{},["prevent"])),"fast-fail":"",ref_key:"form",ref:i},{default:v(()=>[O,d(R,{placeholder:"1234, 1234AB of Leiden",modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=t=>r.value=t),id:"input-location",autocomplete:"on",rules:l.rules,onBlur:e[1]||(e[1]=t=>u(t)),"validate-on":"blur lazy",onKeyup:e[2]||(e[2]=U(t=>t.target.blur(),["enter"])),rounded:"","custom-filter":A(T),density:"compact","onUpdate:focused":b,"auto-select-first":"",variant:"outlined",items:p.value,"error-messages":m.value},null,8,["modelValue","rules","custom-filter","items","error-messages"]),z,d($,{density:"compact",modelValue:s.value,"onUpdate:modelValue":[e[3]||(e[3]=t=>s.value=t),e[5]||(e[5]=t=>u(t))],items:c,"item-title":"text","item-value":"value",id:"dropdown-distance",color:"black",baseColor:"black",itemColor:"white",rounded:"","onUpdate:focused":e[4]||(e[4]=t=>u(t)),"aria-label":"afstandslijst"},{item:v(({props:t})=>[d(M,F({class:"select-item"},t),null,16)]),_:1},8,["modelValue"])]),_:1},512))}});const E=N(D,[["__scopeId","data-v-16256199"]]);export{E as P};