{"version":3,"file":"TypeformEnhanced.ROYiseP2.mjs","names":["useState","useRef","useCallback","useMemo","fullUrl","_Fragment"],"sources":["https:/framerusercontent.com/modules/s7NrwGDZxAZLOcNEVAMX/ALAigtXq3QQrPzS7FEOn/TypeformEnhanced.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState,useCallback,useMemo,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";const styles={container:{position:\"relative\",height:\"100%\",width:\"100%\",overflow:\"hidden\"},iframe:{border:0,width:\"100%\",height:\"100%\"},debugPanel:{position:\"absolute\",top:10,right:10,width:\"300px\",maxHeight:\"80%\",padding:\"10px\",backgroundColor:\"rgba(255, 255, 255, 0.9)\",backdropFilter:\"blur(5px)\",color:\"#000000\",fontFamily:\"Inter, Arial, sans-serif\",fontSize:\"12px\",overflowY:\"auto\",zIndex:1e4,cursor:\"move\",borderRadius:\"8px\",boxShadow:\"0 2px 10px rgba(0, 0, 0, 0.2)\"},debugTitle:{margin:\"0 0 10px 0\",color:\"#000000\",fontSize:\"14px\",fontWeight:\"bold\"},debugInfo:{marginBottom:\"8px\"},infoLabel:{color:\"#000000\",fontWeight:\"bold\",display:\"block\",marginBottom:\"3px\"},infoValue:{marginTop:\"2px\",padding:\"5px\",background:\"rgba(240, 240, 240, 0.5)\",borderRadius:\"4px\",wordBreak:\"break-all\",fontSize:\"11px\",fontFamily:\"monospace\"},loadingContainer:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"100%\",background:\"#f7f7f7\"},loadingMessage:{fontSize:\"16px\",color:\"#555555\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},loadingSpinner:{width:\"30px\",height:\"30px\",border:\"3px solid rgba(0, 0, 0, 0.1)\",borderRadius:\"50%\",borderTopColor:\"#3498db\",animation:\"typeform-spinner 1s ease-in-out infinite\",marginBottom:\"10px\"},errorContainer:{padding:\"20px\",backgroundColor:\"#ffebee\",borderRadius:\"8px\",color:\"#d32f2f\",fontFamily:\"Inter, Arial, sans-serif\",textAlign:\"center\"},\"@keyframes typeform-spinner\":{to:{transform:\"rotate(360deg)\"}}};/**\n * Enhanced Typeform Embed Component by Nelon\n * @framerDisableUnlink\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TypeformEmbed({typeformId,showDebugInfo,borderRadius,disableAutoFocus,style}){const[debugInfo,setDebugInfo]=useState({renders:0,urlParams:\"None\",typeformParams:\"None\",glcid:\"None\",fullUrl:null,loadTime:0});const[isLoading,setIsLoading]=useState(true);const[hasError,setHasError]=useState(false);const[errorMessage,setErrorMessage]=useState(\"\");const loadStartTime=useRef(Date.now());const iframeRef=useRef(null);const isCanvasRender=RenderTarget.current()===RenderTarget.canvas;// Create debug info updater\nconst updateDebugInfo=useCallback(newInfo=>{setDebugInfo(prev=>({...prev,...newInfo}));},[]);// Build the base Typeform URL with all necessary parameters\nconst baseTypeformUrl=useMemo(()=>{try{if(!typeformId){throw new Error(\"Typeform ID is required\");}const baseUrl=`https://form.typeform.com/to/${typeformId}`;const params=new URLSearchParams({\"typeform-embed\":\"embed-widget\",\"typeform-source\":\"framer\",\"typeform-medium\":\"embed-sdk\",\"typeform-medium-version\":\"next\"});// Add optional parameters\nif(disableAutoFocus)params.append(\"typeform-embed-disable-auto-focus\",\"true\");return`${baseUrl}?${params.toString()}`;}catch(error){setHasError(true);setErrorMessage(error.message);return null;}},[typeformId,disableAutoFocus]);// Handle iframe loading and parameter passing\nuseEffect(()=>{if(isCanvasRender||!baseTypeformUrl)return;const constructFullUrl=()=>{if(typeof window===\"undefined\")return null;try{const urlParams=new URLSearchParams(window.location.search);const typeformParams=new URLSearchParams(baseTypeformUrl.split(\"?\")[1]||\"\");// Forward URL parameters to Typeform\nfor(let[key,value]of urlParams){// Don't override existing Typeform params with the same name\nif(!typeformParams.has(key)){typeformParams.append(key,value);}}const fullUrl=`${baseTypeformUrl.split(\"?\")[0]}?${typeformParams.toString()}`;updateDebugInfo({urlParams:urlParams.toString()||\"None\",typeformParams:typeformParams.toString(),glcid:urlParams.get(\"glcid\")||\"Not present\",fullUrl:fullUrl});return fullUrl;}catch(error){setHasError(true);setErrorMessage(`Error constructing URL: ${error.message}`);return null;}};const fullUrl=constructFullUrl();updateDebugInfo({fullUrl});},[baseTypeformUrl,updateDebugInfo,isCanvasRender]);// Debug information update timer\nuseEffect(()=>{const timer=setInterval(()=>{updateDebugInfo(prev=>({...prev,renders:prev.renders+1}));},1e3);return()=>{clearInterval(timer);};},[updateDebugInfo]);// Handle iframe loading events\nconst handleIframeLoad=()=>{const loadTime=Date.now()-loadStartTime.current;updateDebugInfo({loadTime:`${loadTime}ms`});setIsLoading(false);};const handleIframeError=()=>{setHasError(true);setErrorMessage(\"Failed to load Typeform\");setIsLoading(false);};const DebugPanel=()=>/*#__PURE__*/_jsxs(motion.div,{drag:true,dragMomentum:false,style:{...styles.debugPanel,opacity:showDebugInfo?1:0,pointerEvents:showDebugInfo?\"auto\":\"none\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:styles.debugTitle,children:\"Debug Panel\"}),Object.entries(debugInfo).map(([key,value])=>/*#__PURE__*/_jsxs(\"div\",{style:styles.debugInfo,children:[/*#__PURE__*/_jsxs(\"span\",{style:styles.infoLabel,children:[key,\":\"]}),/*#__PURE__*/_jsx(\"div\",{style:styles.infoValue,children:value})]},key))]});// Canvas placeholder\nif(isCanvasRender){return /*#__PURE__*/_jsx(\"div\",{style:{...styles.container,backgroundColor:\"#f0f0f0\",borderRadius:`${borderRadius}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...style},children:/*#__PURE__*/_jsxs(\"div\",{style:{textAlign:\"center\",padding:\"20px\",color:\"#666\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"16px\",fontWeight:\"bold\",marginBottom:\"8px\"},children:\"Typeform Embed\"}),/*#__PURE__*/_jsxs(\"div\",{style:{fontSize:\"13px\"},children:[\"ID: \",typeformId||\"Not set\"]})]})});}// Error state\nif(hasError){return /*#__PURE__*/_jsxs(\"div\",{style:{...styles.container,...style},children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.errorContainer,children:[/*#__PURE__*/_jsx(\"h3\",{children:\"Typeform Loading Error\"}),/*#__PURE__*/_jsx(\"p\",{children:errorMessage||\"Failed to load Typeform\"})]}),showDebugInfo&&/*#__PURE__*/_jsx(DebugPanel,{})]});}return /*#__PURE__*/_jsxs(\"div\",{style:{...styles.container,...style},children:[debugInfo.fullUrl&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,src:debugInfo.fullUrl,style:{...styles.iframe,borderRadius:`${borderRadius}px`,visibility:isLoading?\"hidden\":\"visible\"},allow:\"camera; microphone; autoplay; encrypted-media;\",sandbox:\"allow-same-origin allow-scripts allow-forms allow-popups allow-top-navigation\",title:\"Typeform Embed\",onLoad:handleIframeLoad,onError:handleIframeError}),isLoading&&/*#__PURE__*/_jsx(\"div\",{style:styles.loadingContainer,children:/*#__PURE__*/_jsxs(\"div\",{style:styles.loadingMessage,children:[/*#__PURE__*/_jsx(\"div\",{style:styles.loadingSpinner}),/*#__PURE__*/_jsx(\"span\",{children:\"Loading Typeform...\"})]})})]}),showDebugInfo&&/*#__PURE__*/_jsx(DebugPanel,{}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes typeform-spinner {\n                    to { transform: rotate(360deg); }\n                }\n                `})]});}TypeformEmbed.defaultProps={typeformId:\"Pzd3V25i\",showDebugInfo:false,borderRadius:0,disableAutoFocus:false};addPropertyControls(TypeformEmbed,{borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:100,step:1},disableAutoFocus:{type:ControlType.Boolean,title:\"Disable Auto Focus\",defaultValue:false},showDebugInfo:{type:ControlType.Boolean,title:\"Show Debug Info\",defaultValue:false},typeformId:{type:ControlType.String,title:\"Typeform ID\",defaultValue:\"Pzd3V25i\"}});TypeformEmbed.displayName=\"Typeform w/ UTM Support\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypeformEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"* @framerIntrinsicWidth 600\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypeformEnhanced.map"],"mappings":"0bAOG,SAAwB,EAAc,CAAC,aAAW,gBAAc,eAAa,mBAAiB,QAAM,CAAC,CAAC,GAAK,CAAC,EAAU,EAAa,CAACA,EAAS,CAAC,QAAQ,EAAE,UAAU,OAAO,eAAe,OAAO,MAAM,OAAO,QAAQ,KAAK,SAAS,EAAE,EAAO,CAAC,EAAU,EAAa,CAACA,EAAS,IAAW,CAAC,EAAS,EAAY,CAACA,EAAS,IAAY,CAAC,EAAa,EAAgB,CAACA,EAAS,IAAU,EAAcC,EAAO,KAAK,OAAa,EAAUA,EAAO,MAAY,EAAe,EAAa,YAAY,EAAa,OAC5e,EAAgBC,EAAY,GAAS,CAAC,EAAa,IAAO,CAAC,GAAG,EAAK,GAAG,EAAQ,EAAI,EAAC,EAAE,EACrF,EAAgBC,MAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAY,MAAU,MAAM,2BAA4B,IAAM,EAAQ,gCAAgC,IAAmB,EAAO,IAAI,gBAAgB,CAAC,iBAAiB,eAAe,kBAAkB,SAAS,kBAAkB,YAAY,0BAA0B,OAAO,EAC5O,OAA3E,GAAiB,EAAO,OAAO,oCAAoC,QAAc,GAAG,EAAQ,GAAG,EAAO,YAAc,OAAM,EAAM,CAAkD,OAAjD,EAAY,IAAM,EAAgB,EAAM,SAAgB,IAAM,CAAC,EAAC,CAAC,EAAW,EAAiB,E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