{"version":3,"file":"NGPFormComponent.DPTSwpF2.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/HEnySNj3rVSMQSOvsTNP/J0gpvEsQyzCu7BhTU4Kc/NGPFormComponent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";/**\n * NGP/EveryAction Form Component\n *\n * Renders an NGP form directly on the page following EveryAction's standard embed pattern.\n * Includes Montserrat font and hides form title/description via custom CSS.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function NGPFormComponent({formUrl,hideTitle=true,fastactionEndpoint=\"https://fastaction.ngpvan.com\"}){const containerRef=useRef(null);useEffect(()=>{if(!formUrl||!formUrl.trim()){return;}// Load Montserrat font\nif(!document.querySelector('link[href*=\"Montserrat\"]')){const fontLink=document.createElement(\"link\");fontLink.href=\"https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap\";fontLink.rel=\"stylesheet\";document.head.appendChild(fontLink);}// Load at.min.css\nif(!document.querySelector('link[href*=\"at.min.css\"]')){const styleLink=document.createElement(\"link\");styleLink.rel=\"stylesheet\";styleLink.href=\"https://static.everyaction.com/ea-actiontag/at.min.css\";document.head.appendChild(styleLink);}// Load custom CSS\nconst customCssUrl=\"https://nvlupin.blob.core.windows.net/designs/CustomStylesheet_59b9b6652237f4d3f99e4a4fd4ff8226a80b0c8492a2499f229bb760a7026c18.css\";if(!document.querySelector(`link[href=\"${customCssUrl}\"]`)){const customStyleLink=document.createElement(\"link\");customStyleLink.rel=\"stylesheet\";customStyleLink.href=customCssUrl;document.head.appendChild(customStyleLink);}// Add custom CSS to hide title/description and apply Montserrat font\nif(!document.querySelector(\"#ngp-form-custom-styles\")){const style=document.createElement(\"style\");style.id=\"ngp-form-custom-styles\";style.textContent=`\n                /* Hide form title and description */\n                ${hideTitle?`\n                .ngp-form h2,\n                .ngp-form .form-title,\n                .ngp-form .form-description,\n                .ngp-form .at-title,\n                .ngp-form header.at-title,\n                .ea-form h2,\n                .ea-form .form-title,\n                .ea-form .form-description,\n                .ngp-form header.at-markup,\n                .ngp-form header.HeaderHtml,\n                .ngp-form .at-markup.HeaderHtml {\n                    display: none !important;\n                }\n                `:\"\"}\n                \n                /* Apply Montserrat font to all form elements */\n                .ngp-form,\n                .ngp-form *,\n                .ngp-form input,\n                .ngp-form select,\n                .ngp-form textarea,\n                .ngp-form button,\n                .ngp-form label {\n                    font-family: Montserrat, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;\n                }\n            `;document.head.appendChild(style);}// Function to initialize the form\nlet retryCount=0;const maxRetries=5;const initializeForm=()=>{const win=window;// Check if nvtag exists and has methods\nif(win.nvtag){// Check if this specific element has already been processed AND has content\nconst alreadyProcessed=containerRef.current?.classList.contains(\"at\")&&containerRef.current?.children.length>0;if(alreadyProcessed){return;}// Force manual instantiation (don't rely on process())\nif(containerRef.current&&win.nvtag.NVTagView&&win.jQuery){try{const view=new win.nvtag.NVTagView({el:containerRef.current});// Don't add to nvtag.tags if it's already there\nif(!win.nvtag.tags.find(t=>t.el===containerRef.current)){win.nvtag.tags.push(view);}return;// Success!\n}catch(e){// Fallback to process() if manual creation failed\nif(typeof win.nvtag.process===\"function\"){try{win.nvtag.process();}catch(e){// Silent fail\n}}}}}retryCount++;if(retryCount<maxRetries){setTimeout(initializeForm,500);}};// Load at.js script - always in the current document context\nconst existingScript=document.querySelector('script[src*=\"at.js\"]');if(!existingScript){const script=document.createElement(\"script\");script.src=\"https://static.everyaction.com/ea-actiontag/at.js\";script.type=\"text/javascript\";script.crossOrigin=\"anonymous\";script.onload=()=>{setTimeout(initializeForm,1e3);};document.head.appendChild(script);}else{// Remove existing script to force fresh initialization\nexistingScript.remove();// Also remove the nvtag object to force clean reload\nconst win=window;if(win.nvtag){delete win.nvtag;}// Reload the script\nconst script=document.createElement(\"script\");script.src=\"https://static.everyaction.com/ea-actiontag/at.js\";script.type=\"text/javascript\";script.crossOrigin=\"anonymous\";script.onload=()=>{setTimeout(initializeForm,1e3);};document.head.appendChild(script);}// Cleanup function\nreturn()=>{// Clean up the form if needed\nif(containerRef.current){containerRef.current.innerHTML=\"\";}};},[formUrl,hideTitle]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,className:\"ngp-form\",\"data-form-url\":formUrl,\"data-custom-css\":\"https://nvlupin.blob.core.windows.net/designs/CustomStylesheet_59b9b6652237f4d3f99e4a4fd4ff8226a80b0c8492a2499f229bb760a7026c18.css\",\"data-fastaction-endpoint\":fastactionEndpoint,\"data-inline-errors\":\"true\",\"data-fastaction-nologin\":\"false\",\"data-mobile-autofocus\":\"false\",style:{width:\"100%\",height:\"100%\",fontFamily:\"Montserrat, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif\"}});}// Property controls for Framer\naddPropertyControls(NGPFormComponent,{formUrl:{type:ControlType.String,title:\"Form URL\",description:\"The full NGP/EveryAction form URL (starts with https://secure.ngpvan.com/v1/Forms/...)\",defaultValue:\"\",displayTextArea:true},fastactionEndpoint:{type:ControlType.String,title:\"FastAction Endpoint\",description:\"Override FastAction base URL (use a proxy if needed)\",defaultValue:\"https://fastaction.ngpvan.com\",displayTextArea:false},hideTitle:{type:ControlType.Boolean,title:\"Hide Title\",description:\"Hide the form title and description from NGP\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NGPFormComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NGPFormComponent.map"],"mappings":"2LAQG,SAAwB,EAAiB,CAAC,UAAQ,YAAU,GAAK,qBAAmB,iCAAiC,CAAC,IAAM,EAAaA,EAAO,IAAI,EA8ClE,OA9CoE,MAAc,CAAC,GAAG,CA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