`,!e.getElementById("vf-anti-zoom-style")){const t=e.createElement("style");t.id="vf-anti-zoom-style",t.textContent="@media(max-width:1024px){.vf-anti-zoom input,.vf-anti-zoom textarea,.vf-anti-zoom select{font-size:16px!important;-webkit-text-size-adjust:100%}}",e.head.appendChild(t)}return r},_={name:"ext_location_picker",type:"response",match:({trace:e})=>"ext_location_picker"===e?.type||"ext_location_picker"===e?.payload?.name,render:({element:i})=>{o.hide(),n.enable();const r=C({label:"Where do you need the work done?",description:"Please enter your street number, name and suburb below then select from the list.",submitText:"Confirm Location",errorText:"Please select a location before continuing.",htmlField:'
Type at least 3 characters to see suggestions
Selected Location:
Getting your location...
'});i.appendChild(r),L(i,r),a.hideFor(r);const s=r.querySelector(".vf-location-input"),l=r.querySelector(".vf-input-icon"),d=r.querySelector(".vf-dropdown-container"),c=r.querySelector(".vf-input-helper"),p=r.querySelector(".vf-selected-location"),f=r.querySelector(".vf-selected-address"),v=r.querySelector(".vf-location-loading"),h=r.querySelector(".vf-error"),u=r.querySelector(".vf-submit"),m=r.querySelector(".vf-autocomplete-wrapper"),g=r.querySelector("label"),x=r.querySelector(".vf-desc"),b=e.createElement("div");b.className="vf-location-fallback",b.innerHTML='Issues providing your location? Click here...',u.insertAdjacentElement("afterend",b);const y=b.querySelector("a");let w=null,_=null,z=null,E=null,M=[];function T(){v.style.display="none"}function j(e){h.textContent=e,h.style.display="block",T()}function q(){h.style.display="none"}function A(e){const t=["sublocality_level_1","locality","administrative_area_level_3"];for(const n of t){const t=e.find(e=>e.types.includes(n));if(t)return t.long_name}return""}function B(t){if(d.innerHTML="",!t||0===t.length)return void d.classList.remove("show");const n=t.slice(0,2);M=n,n.forEach((t,o)=>{const a=e.createElement("div");a.className="vf-prediction-item",a.style.cssText="padding:16px;cursor:pointer;border-bottom:1px solid #e5e7eb;display:flex;align-items:center;gap:12px;-webkit-tap-highlight-color:transparent;transition:background 0.15s ease";const i=e.createElement("div");i.style.cssText="width:20px;height:20px;flex-shrink:0;color:#6b7280",i.innerHTML="📍",a.appendChild(i);const r=e.createElement("div");r.style.cssText="flex:1;min-width:0";const h=e.createElement("div");h.style.cssText="font-weight:600;color:#111827;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis",h.textContent=t.structured_formatting.main_text;const g=e.createElement("div");g.style.cssText="color:#6b7280;font-size:13px;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis",g.textContent=t.structured_formatting.secondary_text,r.appendChild(h),r.appendChild(g),a.appendChild(r),o===n.length-1&&(a.style.borderBottom="none"),a.addEventListener("mouseenter",()=>{a.style.background="#eff6ff"}),a.addEventListener("mouseleave",()=>{a.style.background="white"}),a.addEventListener("click",()=>{!function(t){z&&(v.querySelector("span").textContent="Getting location details...",v.style.display="flex",d.classList.remove("show"),z.getDetails({placeId:t.place_id,fields:["address_components","formatted_address","geometry","name"],sessionToken:E},(t,n)=>{if(T(),n===google.maps.places.PlacesServiceStatus.OK&&t){const n={formattedAddress:t.formatted_address,suburb:A(t.address_components||[]),lat:t.geometry.location.lat(),lng:t.geometry.location.lng()};s.value=t.formatted_address,function(t){w=t,f.textContent=t.formattedAddress,p.classList.add("show"),c.classList.remove("show"),d.classList.remove("show"),u.disabled=!1,u.style.background="#0551fb",u.style.cursor="pointer",q(),T(),window.innerWidth<=768&&(s.style.display="none",l&&(l.style.display="none"),m.style.marginBottom="0"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{try{const t=e=>e.parentElement||e.getRootNode&&e.getRootNode().host||null,n=e=>{try{const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflowY)&&e.scrollHeight>e.clientHeight+4}catch(e){return!1}};let o=t(u);for(let a=0;a<30&&o&&o!==e.documentElement&&o!==e.body;a++){try{!n(o)&&o.scrollTop&&(o.scrollTop=0)}catch(e){}o=t(o)}let a=null,i=u;for(let e=0;e<30&&i;e++){if(i.classList&&i.classList.contains("vfrc-chat--dialog")){a=i;break}i=t(i)}if(!a||!n(a)){let o=t(u);for(let i=0;i<30&&o&&o!==e.documentElement&&o!==e.body;i++){if(n(o)){a=o;break}o=t(o)}}if(!a||!n(a))return;const r=a.getBoundingClientRect(),s=u.getBoundingClientRect().bottom-r.bottom+24;s>0&&a.scrollTo({top:a.scrollTop+s,behavior:"smooth"})}catch(e){}})})}(n),E=new google.maps.places.AutocompleteSessionToken}else j("Could not get location details. Please try another address.")}))}(t)}),a.addEventListener("touchstart",()=>{a.style.background="#dbeafe"},{passive:!0}),a.addEventListener("touchend",()=>{a.style.background="#eff6ff"},{passive:!0}),d.appendChild(a)}),d.classList.add("show")}return u.disabled=!0,u.style.background="#9ca3af",u.style.cursor="not-allowed",y.addEventListener("click",e=>{e.preventDefault(),t.interact({type:"captured",payload:{locationFallback:!0}}),n.blurActive(),o.show(),n.disable()}),u.onclick=()=>{w?(q(),k.celebrate(u),setTimeout(()=>{g&&(g.style.display="none"),x&&(x.style.display="none"),m&&(m.style.display="none"),v&&(v.style.display="none"),h&&(h.style.display="none"),u&&(u.style.display="none"),b&&(b.style.display="none"),c&&(c.style.display="none")},1e3),S("formattedAddress",w.formattedAddress),S("suburb",w.suburb),S("googleLat",w.lat.toString()),S("googleLong",w.lng.toString()),n.blurActive(),o.show(),n.disable(),t.interact({type:"captured",payload:{formattedAddress:w.formattedAddress,suburb:w.suburb,latitude:w.lat,longitude:w.lng,locationConfirmed:!0}})):j("Please select a location before continuing.")},async function(){try{await new Promise((t,n)=>{if(window.google&&window.google.maps)return void t();const o=e.createElement("script");o.src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC51PJx9faiS3ptAxYuMfkYKKtTU00Tz-Q&libraries=places",o.onload=()=>t(),o.onerror=()=>n(new Error("Failed to load Google Maps")),e.head.appendChild(o)}),_=new google.maps.places.AutocompleteService;const t=e.createElement("div");t.style.display="none",e.body.appendChild(t),z=new google.maps.places.PlacesService(t),E=new google.maps.places.AutocompleteSessionToken,function(){let t;s.addEventListener("input",()=>{const e=s.value.trim();return clearTimeout(t),e.length>0&&e.length<3?(c.textContent=`Type ${3-e.length} more character${3-e.length==1?"":"s"}`,c.classList.add("show"),void d.classList.remove("show")):0===e.length?(c.classList.remove("show"),void d.classList.remove("show")):(c.textContent="Select an address from the suggestions below",c.classList.add("show"),void(t=setTimeout(()=>{var t;e.length>=3&&(t=e,_&&_.getPlacePredictions({input:t,componentRestrictions:{country:"za"},types:["address"],sessionToken:E},(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&e?B(e):t===google.maps.places.PlacesServiceStatus.ZERO_RESULTS?(d.innerHTML='
No addresses found. Try a different search.
',d.classList.add("show")):d.classList.remove("show")}))},300)))}),s.addEventListener("keydown",e=>{" "!==e.key&&32!==e.keyCode||e.stopPropagation()}),e.addEventListener("click",e=>{m.contains(e.target)||d.classList.remove("show")})}()}catch(e){j("Failed to load location services. Please refresh and try again.")}}(),()=>{o.show(),n.disable()}}},z={name:"calendar-picker",type:"response",match:({trace:e})=>"calendar"===e?.type||"calendar-picker"===e?.payload?.name,render:({element:i})=>{o.hide(),n.enable();const r=C({label:"When would you like the work to be done?",description:"",submitText:"Confirm date",errorText:"Please pick a date before confirming.",htmlField:'\n
`,t.appendChild(s),L(t,s),a.hideFor(s);const l=s.querySelector(".vf-progress-pct"),d=s.querySelector(".vf-progress-fill");[...s.querySelectorAll(".vf-step-dot")].forEach((e,t)=>{const o=t+1;e.classList.remove("complete","current"),o1-Math.pow(1-e,3))(n));d.style.width=o+"%",l.textContent=o+"%",n<1&&requestAnimationFrame(e)}(c)}}}const q=j({name:"ext_progress_step1",step:1,title:"Problem diagnosis",subtitle:"We are understanding your issue."}),A=j({name:"ext_progress_step2",step:2,title:"Location",subtitle:"Where do you need help?"});t=window.voiceflow.chat,t.load({verify:{projectID:"6a1d7b09a2bdb2f81d8077cd"},url:"https://general-runtime.sanlamstudios.voiceflow.com",versionID:"production",assistant:{persistence:"memory",extensions:[y,w,q,A,_,z,E,M,T,v,h,u,m,g,x,b]}}).then(()=>{e.querySelectorAll(".launch_jess").forEach(e=>e.addEventListener("click",()=>t.open()))})},e.body.appendChild(o)}()}(document);