{"version":3,"file":"Embed.DhrI_7sS.mjs","names":["useState","useRef"],"sources":["https:/framer.com/m/framer/default-utils.js","https:/framerusercontent.com/modules/o1PI5S8YtkA5bP5g4dFz/Mn69eMnaMcqJ65TjxwR1/Embed.js"],"sourcesContent":["import{defaultEvents,localeOptions,fontControls,fontSizeOptions,emptyStateStyle,containerStyles,fontStack}from\"https://framerusercontent.com/modules/VTUDdizacRHpwbkOamr7/AykinQJbgwl92LvMGZwu/constants.js\";import{useOnEnter,useOnExit}from\"https://framerusercontent.com/modules/D4TWeLfcxT6Tysr2BlYg/iZjmqdxVx1EOiM3k1FaW/useOnNavigationTargetChange.js\";import{useConstant}from\"https://framerusercontent.com/modules/ExNgrA7EJTKUPpH6vIlN/eiOrSJ2Ab5M9jPCvVwUz/useConstant.js\";import{colorTokentoValue,colorFromToken}from\"https://framerusercontent.com/modules/D2Lz5CmnNVPZFFiZXalt/QaCzPbriZBfXWZIIycFI/colorFromToken.js\";import{isMotionValue}from\"https://framerusercontent.com/modules/3mKFSGQqKHV82uOV1eBc/5fbRLvOpxZC0JOXugvwm/isMotionValue.js\";import{useUniqueClassName,randomID}from\"https://framerusercontent.com/modules/xDiQsqBGXzmMsv7AlEVy/uhunpMiNsbXxzjlXsg1y/useUniqueClassName.js\";import{getVariantControls}from\"https://framerusercontent.com/modules/ETACN5BJyFTSo0VVDJfu/NHRqowOiXkF9UwOzczF7/variantUtils.js\";import{useIsBrowserSafari}from\"https://framerusercontent.com/modules/eMBrwoqQK7h6mEeGQUH8/GuplvPJVjmxpk9zqOTcb/isBrowser.js\";import{useMultiOnChange,useOnChange}from\"https://framerusercontent.com/modules/v9AWX2URmiYsHf7GbctE/XxKAZ9KlhWqf5x1JMyyF/useOnChange.js\";import{mstoMinAndSec,secondsToMinutes}from\"https://framerusercontent.com/modules/4zHZnO5JojN1PrIbu2jm/revv9QCWpkh8lPzi2jje/time.js\";import{useAutoMotionValue}from\"https://framerusercontent.com/modules/kNDwabfjDEb3vUxkQlZS/fSIr3AOAYbGlfSPgXpYu/useAutoMotionValue.js\";import{useFontControls}from\"https://framerusercontent.com/modules/cuQH4dmpDnV8YK1mSgQX/KqRXqunFjE6ufhpc7ZRu/useFontControls.js\";import{useRenderTarget,useIsInPreview,useIsOnCanvas}from\"https://framerusercontent.com/modules/afBE9Yx1W6bY5q32qPxe/m3q7puE2tbo1S2C0s0CT/useRenderTarget.js\";import{useControlledState}from\"https://framerusercontent.com/modules/zGkoP8tPDCkoBzMdt5uq/0zFSjxIYliHxrQQnryFX/useControlledState.js\";import{usePadding,useRadius,paddingControl,borderRadiusControl}from\"https://framerusercontent.com/modules/5SM58HxZHxjjv7aLMOgQ/WXz9i6mVki0bBCrKdqB3/propUtils.js\";import{detectAutoSizingAxis}from\"https://framerusercontent.com/modules/8CkHAZatUz1UR8jNTcfD/HwbnIAZlUmQ2oTpcLkaH/detectAutoSizingAxis.js\";export{useOnEnter,useOnExit,defaultEvents,isMotionValue,colorFromToken,colorTokentoValue,localeOptions,fontControls,fontSizeOptions,emptyStateStyle,containerStyles,fontStack,useUniqueClassName,getVariantControls,useIsBrowserSafari,randomID,useConstant,useMultiOnChange,useOnChange,usePadding,useRadius,paddingControl,borderRadiusControl,mstoMinAndSec,useFontControls,secondsToMinutes,useAutoMotionValue,useRenderTarget,useIsInPreview,useControlledState,detectAutoSizingAxis,useIsOnCanvas,};\nexport const __FramerMetadata__ = {\"exports\":{\"useConstant\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isMotionValue\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fontControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultEvents\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useUniqueClassName\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useMultiOnChange\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useOnChange\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useIsOnCanvas\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useOnExit\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fontSizeOptions\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"colorTokentoValue\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useRadius\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getVariantControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"colorFromToken\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"usePadding\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fontStack\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useControlledState\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFontControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useAutoMotionValue\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"emptyStateStyle\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useIsInPreview\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useIsBrowserSafari\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"detectAutoSizingAxis\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"borderRadiusControl\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"mstoMinAndSec\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomID\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"localeOptions\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useOnEnter\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"secondsToMinutes\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useRenderTarget\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"paddingControl\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useIsOnCanvas,emptyStateStyle,containerStyles}from\"https://framer.com/m/framer/default-utils.js\";/**\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n *\n * @framerDisableUnlink\n */export default function Embed({type,url,html,style={}}){if(type===\"url\"&&url){return /*#__PURE__*/_jsx(EmbedURL,{url:url,style:style});}if(type===\"html\"&&html){return /*#__PURE__*/_jsx(EmbedHTML,{html:html,style:style});}return /*#__PURE__*/_jsx(Instructions,{style:style});}addPropertyControls(Embed,{type:{type:ControlType.Enum,defaultValue:\"url\",displaySegmentedControl:true,options:[\"url\",\"html\"],optionTitles:[\"URL\",\"HTML\"]},url:{title:\"URL\",type:ControlType.String,description:\"Some websites don’t support embedding.\",hidden(props){return props.type!==\"url\";}},html:{title:\"HTML\",type:ControlType.String,displayTextArea:true,hidden(props){return props.type!==\"html\";}}});function Instructions({style}){return /*#__PURE__*/_jsx(\"div\",{style:{minHeight:getMinHeight(style),...emptyStateStyle,overflow:\"hidden\",...style},children:/*#__PURE__*/_jsx(\"div\",{style:centerTextStyle,children:\"To embed a website or widget, add it to the properties\\xa0panel.\"})});}function EmbedURL({url,style}){const hasAutoHeight=!style.height;// Add https:// if the URL does not have a protocol.\nif(!/[a-z]+:\\/\\//.test(url)){url=\"https://\"+url;}const onCanvas=useIsOnCanvas();// We need to check if the url is blocked inside an iframe by the X-Frame-Options\n// or Content-Security-Policy headers on the backend.\nconst[state,setState]=useState(onCanvas?undefined:false);useEffect(()=>{// We only want to check on the canvas.\n// On the website we want to avoid the additional delay.\nif(!onCanvas)return;// TODO: We could also use AbortController here.\nlet isLastEffect=true;setState(undefined);async function load(){const response=await fetch(\"https://api.framer.com/functions/check-iframe-url?url=\"+encodeURIComponent(url));if(response.status==200){const{isBlocked}=await response.json();if(isLastEffect){setState(isBlocked);}}else{const message=await response.text();console.error(message);const error=new Error(\"This site can’t be reached.\");setState(error);}}load().catch(error=>{console.error(error);setState(error);});return()=>{isLastEffect=false;};},[url]);if(onCanvas&&hasAutoHeight){return /*#__PURE__*/_jsx(ErrorMessage,{message:\"URL embeds do not support auto height.\",style:style});}if(!url.startsWith(\"https://\")){return /*#__PURE__*/_jsx(ErrorMessage,{message:\"Unsupported protocol.\",style:style});}if(state===undefined){return /*#__PURE__*/_jsx(LoadingIndicator,{});}if(state instanceof Error){return /*#__PURE__*/_jsx(ErrorMessage,{message:state.message,style:style});}if(state===true){const message=`Can’t embed ${url} due to its content security policy.`;return /*#__PURE__*/_jsx(ErrorMessage,{message:message,style:style});}return /*#__PURE__*/_jsx(\"iframe\",{src:url,style:{...iframeStyle,...style},loading:\"lazy\",// @ts-ignore\nfetchPriority:onCanvas?\"low\":\"auto\",referrerPolicy:\"no-referrer\",sandbox:getSandbox(onCanvas)});}const iframeStyle={width:\"100%\",height:\"100%\",border:\"none\"};function getSandbox(onCanvas){const result=[\"allow-same-origin\",\"allow-scripts\"];if(!onCanvas){result.push(\"allow-downloads\",\"allow-forms\",\"allow-modals\",\"allow-orientation-lock\",\"allow-pointer-lock\",\"allow-popups\",\"allow-popups-to-escape-sandbox\",\"allow-presentation\",\"allow-storage-access-by-user-activation\",\"allow-top-navigation-by-user-activation\");}return result.join(\" \");}function EmbedHTML({html,style}){const ref=useRef();const onCanvas=useIsOnCanvas();const[iframeHeight,setIframeHeight]=useState(0);const hasAutoHeight=!style.height;const hasScript=html.includes(\"</script>\");useEffect(()=>{var _ref_current;const iframeWindow=(_ref_current=ref.current)===null||_ref_current===void 0?void 0:_ref_current.contentWindow;function handleMessage(event){if(event.source!==iframeWindow)return;const data=event.data;if(typeof data!==\"object\"||data===null)return;const height=data.embedHeight;if(typeof height!==\"number\")return;setIframeHeight(height);}window.addEventListener(\"message\",handleMessage);// After SSG the iframe loads before we attach the event handler,\n// therefore we need to request the latest height from the iframe.\niframeWindow===null||iframeWindow===void 0?void 0:iframeWindow.postMessage(\"getEmbedHeight\",\"*\");return()=>{window.removeEventListener(\"message\",handleMessage);};},[]);if(hasScript){const srcDoc=`<html>\n    <head>\n        <style>body { margin: 0; }</style>\n    </head>\n    <body>\n        ${html}\n        <script type=\"module\">\n            let height = 0\n\n            function sendEmbedHeight() {\n                window.parent.postMessage({\n                    embedHeight: height\n                }, \"*\")\n            }\n\n            const observer = new ResizeObserver((entries) => {\n                if (entries.length !== 1) return\n                const entry = entries[0]\n                if (entry.target !== document.body) return\n\n                height = entry.contentRect.height\n                sendEmbedHeight()\n            })\n\n            observer.observe(document.body)\n\n            window.addEventListener(\"message\", (event) => {\n                if (event.source !== window.parent) return\n                if (event.data !== \"getEmbedHeight\") return\n                sendEmbedHeight()\n            })\n        </script>\n    <body>\n</html>`;const currentStyle={...iframeStyle,...style};if(hasAutoHeight){currentStyle.height=iframeHeight+\"px\";}return /*#__PURE__*/_jsx(\"iframe\",{ref:ref,style:currentStyle,srcDoc:srcDoc});}return /*#__PURE__*/_jsx(\"div\",{style:{...htmlStyle,...style},dangerouslySetInnerHTML:{__html:html}});}const htmlStyle={width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\"};// Generic components\nfunction LoadingIndicator(){return /*#__PURE__*/_jsx(\"div\",{className:\"framerInternalUI-componentPlaceholder\",style:{...containerStyles,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{style:centerTextStyle,children:\"Loading…\"})});}function ErrorMessage({message,style}){return /*#__PURE__*/_jsx(\"div\",{className:\"framerInternalUI-errorPlaceholder\",style:{minHeight:getMinHeight(style),...containerStyles,overflow:\"hidden\",...style},children:/*#__PURE__*/_jsx(\"div\",{style:centerTextStyle,children:message})});}const centerTextStyle={textAlign:\"center\",minWidth:140};// Returns a min-height if the component is using auto-height.\nfunction getMinHeight(style){const hasAutoHeight=!style.height;if(hasAutoHeight)return 200;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Embed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"400\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Embed.map"],"mappings":"u0BCQG,SAAwB,EAAM,CAAC,OAAK,MAAI,OAAK,QAAM,EAAE,CAAC,CAAC,CAAsK,OAAlK,IAAO,OAAO,EAAyB,EAAK,EAAS,CAAK,MAAU,QAAM,EAAM,IAAO,QAAQ,EAA0B,EAAK,EAAU,CAAM,OAAW,QAAM,EAAuB,EAAK,EAAa,CAAO,QAAM,CAAG,CAAkZ,SAAS,EAAa,CAAC,QAAM,CAAC,CAAC,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,UAAU,EAAa,GAAO,GAAG,EAAgB,SAAS,SAAS,GAAG,EAAM,CAAC,SAAsB,EAAK,MAAM,CAAC,MAAM,EAAgB,SAAS,mEAAmE,EAAE,CAAG,UAAS,EAAS,CAAC,MAAI,QAAM,CAAC,CAAC,IAAM,EAAc,CAAC,EAAM,OAC1/B,cAAc,KAAK,KAAM,EAAI,WAAW,GAAK,IAAM,EAAS,IAE3D,CAAC,EAAM,EAAS,CAACA,EAAS,EAAS,IAAA,GAAU,IAG+c,GAHxc,MAAc,CAEvE,GAAG,CAAC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