import{t as e}from"./rolldown-runtime.CSLoBULC.mjs";import{D as t,H as n,L as r,M as i,W as a,f as o,u as s,z as c}from"./react.BewV2YM6.mjs";import{R as l,at as u,s as d}from"./framer.CQ-AGaXs.mjs";import{S as f,b as p,o as m}from"./OIjZRBmWDcIE2B6qgG1j.BlekyOFb.mjs";import{t as h}from"./default-utils.DDApnBWa.mjs";function g({type:e,url:t,html:n,style:r={}}){return e===`url`&&t?o(v,{url:t,style:r}):e===`html`&&n?o(b,{html:n,style:r}):o(_,{style:r})}function _({style:e}){return o(`div`,{style:{minHeight:D(e),...f,overflow:`hidden`,...e},children:o(`div`,{style:A,children:`To embed a website or widget, add it to the properties\xA0panel.`})})}function v({url:e,style:t}){let n=!t.height;/[a-z]+:\/\//.test(e)||(e=`https://`+e);let i=m(),[a,s]=c(i?void 0:!1);return r(()=>{if(!i)return;let t=!0;s(void 0);async function n(){let n=await fetch(`https://api.framer.com/functions/check-iframe-url?url=`+encodeURIComponent(e));if(n.status==200){let{isBlocked:e}=await n.json();t&&s(e)}else{let e=await n.text();console.error(e),s(Error(`This site can’t be reached.`))}}return n().catch(e=>{console.error(e),s(e)}),()=>{t=!1}},[e]),i&&n?o(E,{message:`URL embeds do not support auto height.`,style:t}):e.startsWith(`https://`)?a===void 0?o(T,{}):a instanceof Error?o(E,{message:a.message,style:t}):a===!0?o(E,{message:`Can’t embed ${e} due to its content security policy.`,style:t}):o(`iframe`,{src:e,style:{...O,...t},loading:`lazy`,fetchPriority:i?`low`:`auto`,referrerPolicy:`no-referrer`,sandbox:y(i)}):o(E,{message:`Unsupported protocol.`,style:t})}function y(e){let t=[`allow-same-origin`,`allow-scripts`];return e||t.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`),t.join(` `)}function b({html:e,...t}){if(e.includes(`<\/script>`)){let n=e.includes(``),r=e.includes(``);return o(n||r?S:x,{html:e,...t})}return o(C,{html:e,...t})}function x({html:e,style:t}){let n=i(),[s,l]=c(0);r(()=>{let e=n.current?.contentWindow;function t(t){if(t.source!==e)return;let n=t.data;if(typeof n!=`object`||!n)return;let r=n.embedHeight;typeof r==`number`&&l(r)}return a.addEventListener(`message`,t),e?.postMessage(`getEmbedHeight`,`*`),()=>{a.removeEventListener(`message`,t)}},[]);let u=` ${e}