PageSourceSearch

https://heyfixit.ai/build-assets/DemoForm-C354HARR.js

js heyfixit.ai collected 2026-10-05 14:33:39 UTC 13,404 bytes, 1 lines download raw bytes

1import{r,aP as fe,j as e,aQ as S,aR as te,S as pe,aS as he,aT as xe,aU as c,aV as be,aW as O,aX as ye,aY as ge,aZ as ve,a9 as je,a_ as we,a$ as Se}from"./index-D44oEX45.js";const Z="https://app.cal.com/embed/embed.js",ke="https://cal.com",se=15e3;function Ne(a){const t=a.querySelector("cal-inline");if(!t)return()=>{};const d=Object.getOwnPropertyDescriptor(t,"scrollIntoView"),n=i=>{a.scrollTo({top:0,behavior:typeof i=="object"?i.behavior:void 0})};return Object.defineProperty(t,"scrollIntoView",{configurable:!0,writable:!0,value:n}),()=>{t.scrollIntoView===n&&(d?Object.defineProperty(t,"scrollIntoView",d):Reflect.deleteProperty(t,"scrollIntoView"))}}const Q=()=>window;function ae(){let a=Q().Cal;return a||(a=(...t)=>{a?.q?.push(t)},a.q=[],Q().Cal=a),a.q??=[],a.ns??={},a}function Ce(a){let t=document.querySelector(`script[src="${Z}"]`);if(t?.dataset.hfCalLoaded==="true"||a.instance)return Promise.resolve();let d=!1;t||(t=document.createElement("script"),t.src=Z,t.async=!0,d=!0);const n=t;return new Promise((i,o)=>{let x=!1;const l=u=>{x||(x=!0,window.clearTimeout(b),n.removeEventListener("load",p),n.removeEventListener("error",m),u())},p=()=>l(()=>{n.dataset.hfCalLoaded="true",i()}),m=()=>l(()=>o(new Error("Cal.com embed script failed to load."))),b=window.setTimeout(()=>l(()=>o(new Error("Cal.com embed script timed out."))),se);n.addEventListener("load",p,{once:!0}),n.addEventListener("error",m,{once:!0}),d&&(a.loaded=!0,document.head.appendChild(n))})}function Ee(a){let t=()=>{};return{promise:new Promise((n,i)=>{let o=!1,x;const l=()=>u(n),p=()=>u(()=>i(new Error("Cal.com embed failed to become ready."))),m=()=>{a("off",{action:"linkReady",callback:l}),a("off",{action:"linkFailed",callback:p})},b=()=>{x!==void 0&&window.clearTimeout(x),m()};function u(j){o||(o=!0,b(),j())}t=()=>{o||(o=!0,b())},x=window.setTimeout(()=>u(()=>i(new Error("Cal.com embed timed out."))),se),a("on",{action:"linkReady",callback:l}),a("on",{action:"linkFailed",callback:p})}),dispose:()=>t()}}const Le=a=>{if(typeof window>"u")return()=>{};const t=ae();let d=!1;const n=()=>{d||(d=!0,a())};return t("on",{action:"bookingSuccessfulV2",callback:n}),t("on",{action:"bookingSuccessful",callback:n}),()=>{t("off",{action:"bookingSuccessfulV2",callback:n}),t("off",{action:"bookingSuccessful",callback:n})}},Te=({element:a,calLink:t,name:d,email:n})=>{if(typeof document>"u")return Promise.reject(new Error("Cal.com embed requires a document."));const i=ae();i("init",{origin:ke});const o=Ee(i);return i("inline",{elementOrSelector:a,calLink:t,config:{name:d,email:n}}),Promise.all([Ce(i),o.promise]).then(()=>{}).finally(o.dispose)};function Re({name:a,email:t,heading:d=S.heading,loadEmbed:n=Te,getCalLink:i=fe,onBooked:o,subscribeBooked:x=Le}){const l=r.useRef(null),[p,m]=r.useState("loading"),[b]=r.useState(i),u=r.useMemo(()=>{const f=new URL(`https://cal.com/${b}`);return f.searchParams.set("name",a),f.searchParams.set("email",t),f.toString()},[b,t,a]);r.useEffect(()=>{const f=l.current;if(!f)return;let k=!0,N;return m("loading"),n({element:f,calLink:b,name:a,email:t}).then(()=>{k&&(N=Ne(f),m("ready"))}).catch(()=>{k&&m("failed")}),()=>{k=!1,N?.()}},[b,t,n,a]);const j=r.useRef(o);return j.current=o,r.useEffect(()=>x(()=>j.current?.()),[x]),e.jsxs("div",{className:"ph-no-capture",children:[e.jsx("h2",{className:"text-[26px] text-white leading-[1.15] md:text-[30px]",style:{fontFamily:"PT Serif, serif",fontWeight:400},children:d}),p==="failed"?e.jsxs("div",{className:"mt-6 flex flex-col items-start gap-4",children:[e.jsx(te,{asChild:!0,className:"min-h-11 rounded-[10px] bg-[#8aeaa8] px-6 py-3 text-[#02041A] hover:bg-[#8aeaa8]/90 focus-visible:ring-[#8aeaa8]/60",children:e.jsx(pe,{href:u,target:"_blank",rel:"noreferrer noopener",style:{fontFamily:"Sometype Mono, monospace"},children:S.fallbackLabel})}),e.jsx("p",{className:"text-[#c3c5db] text-[15px] leading-[1.55]",style:{fontFamily:"Cabin, sans-serif"},children:S.fallbackReassurance})]}):e.jsxs(e.Fragment,{children:[p==="loading"?e.jsx("p",{className:"mt-3 text-[#8a8ca6] text-[13px]",style:{fontFamily:"Sometype Mono, monospace"},children:S.loading}):null,e.jsx("section",{ref:l,"data-testid":"cal-inline-embed",className:"mt-5 h-[68vh
1] max-h-[680px] min-h-[460px] overflow-y-auto rounded-[12px] bg-transparent md:h-[680px] md:min-h-[520px]","aria-label":S.calendarLabel,"aria-describedby":p==="ready"?"demo-booking-scroll-hint":void 0}),p==="ready"?e.jsx("p",{id:"demo-booking-scroll-hint",className:"mt-3 text-center text-[#c3c5db] text-[13px] leading-[1.45]",style:{fontFamily:"Sometype Mono, monospace"},children:S.scrollHint}):null]})]})}const z="https://challenges.cloudflare.com/turnstile/v0/api.js",X="0x4AAAAAADyFZC70lq7lMZPo",R=()=>window,ne="relative isolate overflow-hidden bg-[#02041A] p-5 text-white shadow-[0px_24px_60px_-24px_rgba(2,4,26,0.7)] md:p-8",Ie=`${ne} w-full rounded-[18px] border border-white/10`,_e=`${ne} -mx-6 w-[calc(100%+3rem)] rounded-none border-y border-white/10 sm:mx-0 sm:w-full sm:rounded-[18px] sm:border`,J=a=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a);function I(a){return`min-h-11 w-full rounded-[10px] border bg-white/[0.06] px-4 py-3 text-[15px] text-white outline-none backdrop-blur-sm transition-colors placeholder:text-[#8a8ca6] focus:bg-white/[0.09] focus-visible:ring-2 focus-visible:ring-[#8aeaa8]/50 focus-visible:ring-offset-2 focus-visible:ring-offset-[#02041A] ${a?"border-[#ff9d94] focus:border-[#ff9d94]":"border-white/10 focus:border-[#8aeaa8]/70"}`}function F(){return e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-3 right-3 text-[#ff9d94] text-[16px] leading-none",children:"*"})}function ee(){return e.jsx("div",{"aria-hidden":"true",className:"-right-16 -top-20 pointer-events-none absolute h-56 w-56 rounded-full bg-[#8aeaa8] opacity-[0.14] blur-[70px]"})}function Me({text:a=c.kicker}){return e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"inline-block h-2 w-2 rotate-45 rounded-sm bg-[#8aeaa8]"}),e.jsx("p",{className:"text-[#8aeaa8] text-[12px] tracking-[0.18em]",style:{fontFamily:"Sometype Mono, monospace"},children:a})]})}function Fe({sourceValue:a,managedFm:t,submit:d=we}){const[n,i]=r.useState({state:"form"}),[o,x]=r.useState(""),[l,p]=r.useState(""),[m,b]=r.useState(""),[u,j]=r.useState(""),[f,k]=r.useState(""),[N,re]=r.useState(""),[D,ie]=r.useState(!1),[C,oe]=r.useState(!1),[le,V]=r.useState(!1),[$,ce]=r.useState({name:"",email:""}),U=r.useRef(null),g=r.useRef(null),E=r.useRef(""),q=r.useRef(!1),W=t?"managed_fm":"demo",v=he(W,a),H=[o,m,l,t?f:u].filter(s=>s.trim()!=="").length;r.useEffect(()=>{v.progress(H,4)},[v,H]),r.useEffect(()=>{if(typeof document>"u")return;let s=null;const y=()=>{const h=R().turnstile,L=U.current;!h||!L||g.current||!X||(g.current=h.render(L,{sitekey:X,appearance:"interaction-only","refresh-expired":"auto",callback:B=>{E.current=B},"error-callback":()=>{E.current=""},"expired-callback":()=>{E.current=""}}))};return R().turnstile?y():(s=document.querySelector(`script[src="${z}"]`),s||(s=document.createElement("script"),s.src=z,s.async=!0,s.defer=!0,document.head.appendChild(s)),s.addEventListener("load",y,{once:!0})),()=>{s?.removeEventListener("load",y);const h=R().turnstile;h&&g.current&&(h.remove(g.current),g.current=null)}},[]);const de=()=>{R().turnstile?.reset?.(g.current??void 0),E.current=""},me=async s=>{if(s.preventDefault(),q.current)return;const y=o.trim(),h=l.trim(),L=m.trim(),B=J(h);if(oe(!0),V(!0),!y||!h||!L||(t?!f:!u)||!B)return;q.current=!0,i({state:"submitting"}),v.submitted();const Y=Se(),ue=E.current||R().turnstile?.getResponse?.(g.current??void 0)||"";let T;try{T=await d({fullName:y,email:h,company:L,...t?{managedFm:{siteCount:f,changePrompt:N.trim()}}:{teamType:u},newsletterOptIn:D,sourceId:a,turnstileToken:ue,...Y?{analyticsId:Y}:{}})}catch{T={ok:!1,reason:"network"}}if(T.ok){v.accepted(),ce({name:y,email:h}),i({state:"book"});return}v.failed(T.reason),de(),i({state:"error",reason:T.reason}),q.current=!1};if(n.state==="book")return e.jsxs("div",{className:t?"mf-booking-card":_e,"data-testid":"demo-booking-shell",children:[e.jsx(ee,{}),e.jsx(Re,{name:$.name,email:$.email,heading:t?"Choose a time to speak to an FM expert":void 0,onBo
1oked:()=>xe("demo_booked",{form:W,source_id:a})})]});const G=n.state==="submitting",_=C&&!o.trim(),M=C&&!l.trim(),P=C&&!m.trim(),w=C&&(t?!f:!u),A=(le||C)&&!!l.trim()&&!J(l.trim()),K=_||M||P||w?c.requiredError:A?c.emailSyntaxError:n.state==="error"?be[n.reason]:null;return e.jsxs("div",{ref:v.ref,className:t?"close-card mf-contact-card":Ie,children:[!t&&e.jsx(ee,{}),t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cc-corners","aria-hidden":"true"}),e.jsxs("div",{className:"cc-hud",children:[e.jsx("span",{children:t.kicker}),e.jsx("span",{className:"r",children:"FM specialists"})]})]}):e.jsx(Me,{}),e.jsx("h2",{className:"mt-4 text-[26px] text-white leading-[1.15] md:text-[30px]",style:{fontFamily:"PT Serif, serif",fontWeight:400},children:t?.heading??c.heading}),e.jsxs("form",{"data-testid":"demo-form",onSubmit:me,onInput:v.onInput,className:"ph-no-capture mt-6 flex flex-col gap-3",noValidate:!0,children:[e.jsxs("div",{"data-testid":"demo-field-grid",className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))"},children:[e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"demo-full-name",className:"sr-only",children:c.fullNameLabel}),e.jsx("input",{id:"demo-full-name",name:"fullName",type:"text",required:!0,maxLength:O.userField,autoComplete:"name",placeholder:c.fullNamePlaceholder,value:o,onChange:s=>x(s.target.value),"aria-invalid":_||void 0,className:I(_),style:{fontFamily:"Cabin, sans-serif"}}),_&&e.jsx(F,{})]}),e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"demo-company",className:"sr-only",children:c.companyLabel}),e.jsx("input",{id:"demo-company",name:"company",type:"text",required:!0,maxLength:O.userField,autoComplete:"organization",placeholder:c.companyPlaceholder,value:m,onChange:s=>b(s.target.value),"aria-invalid":P||void 0,className:I(P),style:{fontFamily:"Cabin, sans-serif"}}),P&&e.jsx(F,{})]}),e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"demo-work-email",className:"sr-only",children:c.workEmailLabel}),e.jsx("input",{id:"demo-work-email",name:"email",type:"email",required:!0,maxLength:O.email,autoComplete:"email",placeholder:c.workEmailPlaceholder,value:l,onChange:s=>p(s.target.value),onBlur:()=>V(!0),"aria-invalid":M||A||void 0,"aria-describedby":A?"demo-form-message":void 0,className:I(M||A),style:{fontFamily:"Cabin, sans-serif"}}),M&&e.jsx(F,{})]}),t?e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"mf-sites",className:"sr-only",children:t.sitesLabel}),e.jsxs("select",{id:"mf-sites",name:"siteCount",required:!0,value:f,onChange:s=>k(s.target.value),"aria-invalid":w||void 0,className:I(w),children:[e.jsx("option",{value:"",disabled:!0,children:t.sitesLabel}),ye.map(s=>e.jsx("option",{value:s,children:s},s))]})]}):e.jsxs(e.Fragment,{children:[" ",e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"demo-team-type",className:"sr-only",children:c.teamTypeLabel}),e.jsxs("select",{id:"demo-team-type",name:"teamType",required:!0,value:u,onChange:s=>j(s.target.value),"aria-invalid":w||void 0,className:I(w),style:{fontFamily:"Cabin, sans-serif"},children:[e.jsx("option",{value:"",disabled:!0,className:"bg-[#02041A]",children:c.teamTypeLabel}),ge.map(s=>e.jsx("option",{value:s,className:"bg-[#02041A]",children:ve[s]},s))]}),w&&e.jsx(F,{})]})]})]}),t&&e.jsxs("div",{className:"mf-change",children:[e.jsx("p",{className:"cc-lbl",id:"mf-reasons-label",children:t.promptLabel}),e.jsx("fieldset",{className:"mf-reasons","aria-labelledby":"mf-reasons-label",children:t.reasons.map(s=>e.jsx("button",{type:"button","aria-pressed":N.split("; ").includes(s),onClick:()=>re(y=>y.split("; ").includes(s)?y.split("; ").filter(h=>h!==s).join("; "):[y,s].filter(Boolean).join("; ")),children:s},s))})]}),e.jsxs("label",{htmlFor:"demo-newsletter",className:"flex cursor-pointer items-start gap-3 rounded-[10px] border border-white/10 bg-white/[0.03] p-3 text-[#c3c5db] text-[14px] leading-[1.45]",style:{fontFamily:"Cabin, sans-serif"},children:[e.jsx("input",{id:"demo-newsletter",name:"newsletterOptIn",type:"checkbox",checked:D,onChange:s=>ie(s.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 accent-[#8aeaa8] focus-visible:outline-2 focus-visible:outline-[#8aeaa8] focus-visible:outline-offset-2"}),e.jsx("span",{children:c.newsletterLabel})]}),e.jsx("div",{ref:U}),e.jsx(te,{...t?je("managed_fm_contact_submit"):{},type:"submit",disabled:G,className:"mt-1 min-h-11 rounded-[10px] bg-[#8aeaa8] px-6 py-3 text-[#02041A] tracking-[0.02em] hover:bg-[#8aeaa8]/90 focus-visible:ring-[#8aeaa8]/60 disabled:cursor-not-allowed",style:{fontFamily:"Sometype Mono, monospace"},children:G?c.submittingLabel:t?.submitLabel??c.submitLabel}),e.jsx("p",{className:"text-[#8a8ca6] text-[12px] leading-[1.45]",style:{fontFamily:"Cabin, sans-serif"},children:t?"By requesting a call, you agree we’ll contact you to arrange it.":c.contactConsent}),t&&e.jsx("p",{className:"cc-fine",children:t.fine}),e.jsx("p",{id:"demo-form-message","aria-live":"polite",className:K?"min-h-[1.2rem] text-[#ff9d94] text-[13px]":"sr-only",style:{fontFamily:"Cabin, sans-serif"},children:K})]})]})}export{Fe as D};

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.