{"version":3,"file":"MainForm.4dRU6ee2.mjs","names":["Children","useState","useRef"],"sources":["https:/framerusercontent.com/modules/6j3D2vUB0CnmUqbn4F7I/aSY20GbnuBswRiOYJWQW/MainForm.js"],"sourcesContent":["/**\n * MainForm — Framer-registered lead form. The form that accepts all\n * defaults from `Contract/FormDefaults.tsx` as-is. Adding/removing\n * fields, changing labels, or making fields required propagates to\n * every form via the contract; MainForm carries no per-form overrides.\n *\n * Variants:\n *  - `inline` (default) — renders `<BaseLeadForm />` directly.\n *  - `popupButton`       — renders a CTA button that opens the same\n *                          `<BaseLeadForm />` inside a portal modal.\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls}from\"framer\";import{useState,useEffect,useRef,Children,isValidElement}from\"react\";import{createPortal}from\"react-dom\";import{defaultLeadFormProps}from\"https://framerusercontent.com/modules/gy5K9RgZigUHn0rJHIFL/vUaQTtKN6arhQwWBeEpA/FormDefaults.js\";import{mergeLeadFormProps}from\"https://framerusercontent.com/modules/rtHzsN6OV6y23Tc9SaKY/bR9J1ELn6IBB4MI3zEQC/MergeFormProps.js\";import{formPropertyControls}from\"https://framerusercontent.com/modules/njCyDrIPxt18bN6mVAZI/RkaAHKMkU9flOaXbEIz2/FormPropertyControls.js\";import{BaseLeadForm}from\"https://framerusercontent.com/modules/2x0x9cfJiHDlkIQHwbee/sjLzXuSPb4z9z2Oy2m7J/BaseLeadForm.js\";import PillCtaButton from\"https://framerusercontent.com/modules/w9nD8NlP142wZ4H3p1Ab/5Qxd337z2E2Af6U6v1G2/PillCtaButton.js\";/** Window event section CTAs dispatch to open a popup-button Main Form. */export const LEAD_FORM_POPUP_OPEN_EVENT=\"openLeadFormPopup\";const POPUP_HOST_DEFAULT_PROPS={layoutVariant:\"popupButton\",popupOpenButton:{show:false}};/** Opens the nearest uncontrolled popup Main Form via window event (standalone instances). */export function dispatchOpenLeadFormPopup(sectionId){if(typeof window===\"undefined\")return;const detail={sectionId:sectionId??\"unknown\"};window.dispatchEvent(new CustomEvent(LEAD_FORM_POPUP_OPEN_EVENT,{detail}));}function resolvePopupHostProps(mainForm){const child=Children.toArray(mainForm)[0];const connected=/*#__PURE__*/isValidElement(child)?child.props:{};const{styling:_flatStyling,...defaultsForMainForm}=defaultLeadFormProps;return{...defaultsForMainForm,...POPUP_HOST_DEFAULT_PROPS,...connected,layoutVariant:\"popupButton\",popupOpenButton:{...POPUP_HOST_DEFAULT_PROPS.popupOpenButton,...connected.popupOpenButton,show:false}};}/**\n * Popup Main Form host for service sections. Use controlled `isOpen` from the\n * section — do not rely on window events (Framer + duplicate events are unreliable).\n */export function LeadFormPopupHost({mainForm,isOpen,onOpenChange}){const rawProps=resolvePopupHostProps(mainForm);return /*#__PURE__*/_jsx(LeadFormPopupButtonShell,{rawProps:rawProps,isOpen:isOpen,onOpenChange:onOpenChange});}/**\n * CTA button + portal modal around one `<BaseLeadForm />`. Shared by MainForm\n * and per-form wrappers (e.g. EventForm) for their `popupButton` variant;\n * `extraPayload` in `rawProps` rides the spread into the form.\n */export function LeadFormPopupButtonShell({rawProps,isOpen:controlledOpen,onOpenChange}){const merged=mergeLeadFormProps(rawProps);const{styling}=merged;const openButton={...defaultLeadFormProps.buttons,...rawProps.popupOpenButton};const popupOpenerWidthMode=openButton.widthMode??\"fit\";const{buttonRowAlign}=styling;const[internalOpen,setInternalOpen]=useState(false);const isControlled=controlledOpen!==undefined;const isModalOpen=isControlled?controlledOpen:internalOpen;const setModalOpen=open=>{onOpenChange?.(open);if(!isControlled)setInternalOpen(open);};const instanceIdRef=useRef(Math.random().toString(36).substring(7));useEffect(()=>{if(isControlled)return;const handleOpenLeadPopup=event=>{const detail=event.detail||{};console.log(\"Lead form popup triggered from:\",detail.sectionId||\"unknown\",\"instance:\",instanceIdRef.current);setModalOpen(true);};window.addEventListener(LEAD_FORM_POPUP_OPEN_EVENT,handleOpenLeadPopup);return()=>{window.removeEventListener(LEAD_FORM_POPUP_OPEN_EVENT,handleOpenLeadPopup);};},[isControlled]);useEffect(()=>{if(!isModalOpen)return;const onKeyDown=e=>{if(e.key===\"Escape\")setModalOpen(false);};window.addEventListener(\"keydown\",onKeyDown);return()=>window.removeEventListener(\"keydown\",onKeyDown);},[isModalOpen]);const flatStyling=merged.styling;const font=flatStyling.font??{};const popupOpenerRowJustify=buttonRowAlign===\"center\"?\"center\":\"flex-start\";return /*#__PURE__*/_jsxs(\"div\",{style:{...rawProps.style??{},width:popupOpenerWidthMode===\"fill\"?\"100%\":\"fit-content\",maxWidth:\"100%\"},children:[(openButton.show??true)&&/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",display:\"flex\",justifyContent:popupOpenerRowJustify},children:/*#__PURE__*/_jsx(PillCtaButton,{label:openButton.text,onClick:()=>setModalOpen(true),background:openButton.background,color:openButton.color,showIcon:openButton.showIcon??true,iconPosition:openButton.iconPosition,iconFill:openButton.iconFill,iconCircleColor:openButton.iconCircleColor,iconGradient:openButton.iconGradient,iconSvg:openButton.iconSvg,iconSizePercent:openButton.iconSizePercent,iconArrowSizePercent:openButton.iconArrowSizePercent,variant:openButton.variant??\"desktop\",height:openButton.height,borderWidth:openButton.borderWidth,borderColor:openButton.borderColor,fullWidth:popupOpenerWidthMode===\"fill\",style:popupOpenerWidthMode===\"fill\"?{flex:1,minWidth:0,width:\"100%\"}:{width:\"fit-content\"}})}),isModalOpen&&typeof document!==\"undefined\"&&/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{onClick:e=>{if(e.target===e.currentTarget){setModalOpen(false);}},style:{position:\"fixed\",inset:0,width:\"100vw\",height:\"100vh\",minWidth:\"100vw\",minHeight:\"100vh\",margin:0,padding:0,backgroundColor:\"rgba(0, 0, 0, 0.48)\",backdropFilter:\"blur(20px) saturate(150%)\",WebkitBackdropFilter:\"blur(20px) saturate(150%)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:2147483647,overflow:\"auto\",overscrollBehavior:\"contain\",boxSizing:\"border-box\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",maxWidth:merged.styling.containerMaxWidth,margin:\"20px\",maxHeight:\"93vh\",// Keep visible so field dropdowns (help, country, etc.)\n// are not clipped; the overlay above scrolls tall forms.\noverflow:\"visible\",boxSizing:\"border-box\",...font},children:/*#__PURE__*/_jsx(BaseLeadForm,{...rawProps,layoutVariant:\"inline\",onPopupDismiss:()=>setModalOpen(false)})})}),document.body)]});}/**\n * MainForm — lead capture form (inline / popup button).\n *\n * Inline: Fixed or Fill width (~1240). Button layout: Fit Content width.\n *\n * @framerIntrinsicWidth 1240\n * @framerIntrinsicHeight 800\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MainForm(props){const layoutVariant=props.layoutVariant??\"inline\";if(layoutVariant===\"popupButton\"){return /*#__PURE__*/_jsx(LeadFormPopupButtonShell,{rawProps:props});}return /*#__PURE__*/_jsx(BaseLeadForm,{...props});}addPropertyControls(MainForm,formPropertyControls);MainForm.displayName=\"Main Form\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MainForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"1240\",\"framerIntrinsicHeight\":\"800\",\"framerSupportedLayoutHeight\":\"auto\"}},\"Country\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LEAD_FORM_POPUP_OPEN_EVENT\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"dispatchOpenLeadFormPopup\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LeadFormPopupHost\":{\"type\":\"reactComponent\",\"name\":\"LeadFormPopupHost\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"LeadFormPopupButtonShell\":{\"type\":\"reactComponent\",\"name\":\"LeadFormPopupButtonShell\",\"slots\":[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