1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[327],{20327:(e,l,a)=>{a.r(l),a.d(l,{FormCustom:()=>T});var t=a(85664),n=a(17334),r=a(63276),s=a(80166),i=a(30396),o=a(97763),m=a(16172),c=a(10791),d=a(16003),u=a(61713),p=a(56978),b=a(81072),h=a(87214),x=a(17213),g=a(5359),j=a(34444),y=a(75691),f=a(20865),N=a(77832),v=a(48849),k=a(58259),w=a(74370),F=a(96777);function T(e){var l,a,T;let{centerTitles:_=!1,form:E,gtmEvent:P,labelsTextColor:S,submitClasses:C,submitVariant:L,theme:Y,title:q}=e,{pathname:J,searchParamsObj:A}=(0,k.F)(),{branch:I}=A,V=E.formJson.elements.filter(e=>"datetime"!==e.type),M=V.reduce((e,l)=>("paragraph"!==l.type&&"heading"!==l.type&&"linebreak"!==l.type&&("date"===l.type&&l.required?e.date=i.Yj().min(1,{message:"Please select a date"}):"time"===l.type&&l.required?e.time=i.Yj().min(1,{message:"Please select a time"}):"date"!==l.type||l.required?"time"!==l.type||l.required?l.required?e[l.label]=i.Yj().min(1,{message:"select"!==l.type?"Please enter your ".concat(l.label):"Please select an option"}):e[l.label]=i.Yj():e.time=i.Yj():e.date=i.Yj()),e),{}),R=i.Ik({...M}),z=V.reduce((e,l)=>("paragraph"!==l.type&&"heading"!==l.type&&"linebreak"!==l.type&&("date"===l.type?e.date="":"time"===l.type?e.time="":"checkbox"===l.type?e[l.label]="No":e[l.label]=""),e),{}),B=V.find(e=>"date"===e.type);B&&(z.date="");let D=V.find(e=>"time"===e.type);D&&(z.time="");let O=(0,p.Lk)({defaultValues:z,schema:R}),{control:H,formState:G,handleSubmit:$,register:U,setValue:K,trigger:Q}=O,[W,X]=(0,r.useState)(),[Z,ee]=(0,r.useState)(),[el,ea]=(0,r.useState)(!1),[et,en]=(0,r.useState)(!1),[er,es]=(0,r.useState)([]);async function ei(e){let l=e;ea(!0);let a={FormId:E.id,sourceUrl:"".concat(v.C).concat(J)};I&&(a.branch=I),l["Full Name"]&&(a.FullName=l["Full Name"]),l.Name&&(a.FullName=l.Name),l["Full name"]&&(a.FullName=l["Full name"]),l["Email Address"]&&(a.EmailAddress=l["Email Address"]),l["Email address"]&&(a.EmailAddress=l["Email address"]),l.Email&&(a.EmailAddress=l.Email),l["Telephone Number"]&&(a.TelephoneNumber=l["Telephone Number"]),l["Phone Number"]&&(a.TelephoneNumber=l["Phone Number"]),l.Telephone&&(a.TelephoneNumber=l.Telephone),l.Phone&&(a.TelephoneNumber=l.Phone),er.length>0&&(l={...l,Images:"[".concat(er.map(e=>'"'.concat(e,'"')).join(","),"]")}),a.StringData=Object.keys(l).reduce((e,a)=>{if("Full Name"!==a&&"Full name"!==a&&"Name"!==a&&"Email Address"!==a&&"Email address"!==a&&"Email"!==a&&"Telephone Number"!==a&&"Phone Number"!==a&&"Telephone"!==a&&"Phone"!==a){var t;return"".concat(e).concat(a,": ").concat(null!=(t=l[a])?t:"","\n\r")}return e},"");let t=await fetch("/api/forms/custom",{body:JSON.stringify({request:a,submitEndpoint:""}),method:"POST"}),{status:n}=await t.json();200===n&&(ea(!1),en(!0),(0,w.tR)(E.title,{gtmEvent:P}),E.urlRedirect&&(window.location.href=E.urlRedirect))}return(0,r.useEffect)(()=>{B&&W&&(K("date",(0,n.GP)(W,"LLL dd, y")||""),Q("date"))},[W,K,Q,B]),(0,r.useEffect)(()=>{D&&Z&&(K("time",Z||""),Q("time"))},[Z,K,Q,D]),(0,t.jsx)("div",{className:"relative",children:et?(0,t.jsxs)(o.y,{labelsTextColor:S,theme:Y,title:null!=(l=E.thankYouTitle)?l:"Thank y
1ou!",children:[!!E.thankYouMessage&&(0,t.jsx)("p",{children:E.thankYouMessage}),!!E.submissionPdfLink&&(0,t.jsx)("div",{className:"mt-30",children:(0,t.jsx)(x.z,{href:E.submissionPdfLink,openNewTab:!0,children:null!=(a=E.downloadButtonText)?a:"Download PDF"})})]}):(0,t.jsxs)(s.Op,{...O,children:[!!q&&q,(0,t.jsx)("form",{className:"mx-auto max-w-[700px]",id:"form-".concat(E.slug),onSubmit:$(ei),children:(0,t.jsxs)("div",{className:"-mx-10 flex flex-wrap justify-center",children:[V.map(e=>{var l,a;return(0,t.jsxs)("div",{className:(0,F.cn)("w-full px-10",(2===e.cols||"2"===e.cols)&&"linebreak"!==e.type?"lg:w-1/3":(3===e.cols||"3"===e.cols)&&"linebreak"!==e.type?"md:w-1/2":"","linebreak"!==e.type&&"mb-20"),children:[("input"===e.type||"number"===e.type)&&(0,t.jsxs)(t.Fragment,{children:[e.label!==e.placeholder&&(0,t.jsx)(h.J,{className:"block px-5 pb-5 leading-normal",htmlFor:e.label,children:e.label}),(0,t.jsx)(b.p,{error:null==(l=G.errors[e.label])?void 0:l.message,label:e.label,theme:Y,type:"number"===e.type?"number":"text",...U(e.label)})]}),"date"===e.type&&(0,t.jsxs)(t.Fragment,{children:[e.label!==e.placeholder&&(0,t.jsx)(h.J,{className:"block px-5 pb-5 leading-normal",htmlFor:"date",children:e.label}),(0,t.jsx)(d.l,{enableAllDates:!0,label:e.label===e.placeholder?e.label:void 0,onSelect:X,selected:W,theme:Y})]}),"time"===e.type&&(0,t.jsxs)(t.Fragment,{children:[e.label!==e.placeholder&&(0,t.jsx)(h.J,{className:"block px-5 pb-5 leading-normal",htmlFor:"time",children:e.label}),(0,t.jsx)(N.A,{label:e.label===e.placeholder?e.label:void 0,onSelect:ee,selected:Z,theme:Y})]}),"textarea"===e.type&&(0,t.jsxs)(t.Fragment,{children:[e.label!==e.placeholder&&(0,t.jsx)(h.J,{className:"block px-5 pb-5 leading-normal",htmlFor:e.label,children:e.label}),(0,t.jsx)(f.f,{error:null==(a=G.errors[e.label])?void 0:a.message,label:e.label,placeholder:e.placeholder,theme:Y,...U(e.label)})]}),"select"===e.type&&(0,t.jsx)(s.xI,{control:H,defaultValue:"",name:e.label,render:l=>{let{field:a}=l;return(0,t.jsxs)(t.Fragment,{children:[e.label!==e.placeholder&&(0,t.jsx)(h.J,{className:"block px-5 pb-5 leading-normal",htmlFor:e.label,children:e.label}),(0,t.jsx)(j.l,{error:G.errors[e.label],label:e.label,onChange:a.onChange,options:[{text:e.label!==e.placeholder?"Please select":e.label,value:""},...e.options.map(e=>({text:e,value:e}))],theme:Y,value:a.value})]})}}),"radio"===e.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"block px-5 pb-5 text-17 leading-normal",dangerouslySetInnerHTML:{__html:e.label}}),(0,t.jsx)(p.zB,{control:H,name:e.label,render:l=>{let{field:a}=l;return(0,t.jsx)(p.MJ,{children:(0,t.jsx)(g.z,{defaultValue:e.options[0],onValueChange:a.onChange,children:e.options.map(e=>(0,t.jsxs)("div",{className:"mr-15 flex items-center space-x-8",children:[(0,t.jsx)(g.C,{id:e,value:e}),(0,t.jsx)(h.J,{className:"cursor-pointer",htmlFor:e,children:e})]},e))})})}})]}),"checkbox"===e.type&&(0,t.jsx)(s.xI,{control:H,name:e.label,render:l=>{let{field:a}=l;return(0,t.jsx)(c.S,{checked:"Yes"===a.value,label:e.label,onCheckedChange:e=>{a.onChange(e?"Yes":"No")},theme:Y})}}),"paragraph"===e.type&&(0,t.jsx)("div",{className:"prose lg:prose-lg mx-auto text-center",dangerouslySetInnerHTML:{__html:e.label}}),"heading"===e.type&&(0,t.jsx)("h2",{className:(0,F.cn)("mt-20 font-bold text-20 text-primary md:text-24","beam"===Y&&"lg:text-28",_&&"text-center"),dangerouslySetInnerHTML:{__html:e.label}}),"image"===e.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"block px-5 pb-5 text-center text-17 leading-normal",children:e.label}),(0,t.jsx)(u.w,{images:er,imagesSet:es,theme:Y})]})]},e.id)}),(0,t.jsx)("div",{className:"w-full px-10",children:(0,t.jsx)("div",{className:(0,F.cn)("mt-10 w-full text-center",_&&"mx-auto",null!=C?C:"max-w-[200px]"),children:(0,t.jsxs)(m.$,{className:(0,F.cn)("duplex"!==Y&&"w-full"),"data-busy":el?"true":"false",disabled:el,icon:"beam"!==Y?"send":void 0,size:"beam"===Y?"default":"md",theme:Y,type:"submit",variant:null!=L?L:"beam"===Y?"secondary":"primary",children:[(0,t.jsx)("span",{className:(0,F.cn)(el&&"opacity-0"),children:null!=(T=E.submissionButtonText)?T:"Submit form"}),(0,t.jsx)("div",{className:(0,F.cn)("-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 flex transition-all",el?"visible opacity-1":"invisible opacity-0"),children:(0,t.jsx)(y.y,{color:"white"})})]})})})]})})]})})}},74370:(e,l,a)=>{a.d(l,{_N:()=>m,tR:()=>c});var t=a(97239),n=a(82452);let r=/[^a-z0-9]+/g,s=/^_+|_+$/g,i={arrange_viewing:"Arrange Viewing",book_valuation:"Book a Valuation Form",contact:"Contact Form",instant_valuation:"Instant Valuation Form",register:"Register Form",virtual_valuation:"Virtual Valuation Form"};function o(e,l,a){let{gtmEvent:r}=a;r&&(0,t.sendGTMEvent)({event:"generate_lead",value:l}),n.f0("Lead",{content_name:e})}function m(e,l){o(e,i[e],l)}function c(e,l){o(e.toLowerCase().replace(r,"_").replace(s,"")||"custom_form",e,l)}},82452:(e,l,a)=>{function t(){void 0!==window.fbq&&window.fbq("track","PageView")}function n(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0!==window.fbq&&window.fbq("track",e,l)}a.d(l,{JR:()=>t,f0:()=>n})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.