{"version":3,"file":"Instagram_Reels_Embed.CMBXuAkv.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","p","c","init_jsx_runtime","ce","de","window","addPropertyControls","RenderTarget","init_framer_B1b760uK","ControlType","loadInstagramScript","scriptPromise","existing","SCRIPT_SRC","resolve","s","InstagramEmbed","props","hostRef","isCanvas","host","clean","url","captioned","maxWidth","cancelled","run","ig","align","init_Instagram_Reels_Embed"],"sources":["https:/framerusercontent.com/modules/f0tzpyiJcwbkWtgDEg5b/2XmWugutJ9fmDpy7zGSB/Instagram_Reels_Embed.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const SCRIPT_SRC=\"https://www.instagram.com/embed.js\";// Load embed.js once per page, return a promise that resolves when ready.\nlet scriptPromise=null;function loadInstagramScript(){if(typeof window===\"undefined\")return Promise.resolve();if(window.instgrm)return Promise.resolve();if(scriptPromise)return scriptPromise;scriptPromise=new Promise(resolve=>{const existing=document.querySelector(`script[src=\"${SCRIPT_SRC}\"]`);if(existing){existing.addEventListener(\"load\",()=>resolve());// If it already loaded before we attached the listener:\nif(window.instgrm)resolve();return;}const s=document.createElement(\"script\");s.src=SCRIPT_SRC;s.async=true;s.onload=()=>resolve();document.body.appendChild(s);});return scriptPromise;}export default function InstagramEmbed(props){const{url,maxWidth,align,captioned}=props;const hostRef=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{const host=hostRef.current;if(!host)return;// Clean a trailing slash / query so we always end with the permalink + \"/\"\nconst clean=(url||\"\").trim().split(\"?\")[0].replace(/\\/?$/,\"/\");if(!clean||!clean.includes(\"instagram.com\")){host.innerHTML=\"\";return;}// Instagram reads these styles when sizing the embed, so use its\n// canonical min/max width. Forcing min-width:0 makes it render squished.\nconst minW=Math.min(326,maxWidth);host.innerHTML=`\n            <blockquote\n                class=\"instagram-media\"\n                data-instgrm-permalink=\"${clean}\"\n                data-instgrm-version=\"14\"\n                ${captioned?\"data-instgrm-captioned\":\"\"}\n                style=\"background:#FFF; border:0; margin:0 auto; padding:0; width:100%; max-width:${maxWidth}px; min-width:${minW}px;\">\n            </blockquote>\n        `;let cancelled=false;const run=()=>{if(cancelled)return;const ig=window.instgrm;// Documented signature takes no argument and processes the page.\nif(ig?.Embeds?.process)ig.Embeds.process();};loadInstagramScript().then(()=>{run();// Safety retry: the first pass can race Framer's layout, leaving\n// the embed unconverted (squished + non-playable) until reprocessed.\nsetTimeout(run,400);});return()=>{cancelled=true;};},[url,maxWidth,captioned]);const justify=align===\"left\"?\"flex-start\":align===\"right\"?\"flex-end\":\"center\";// On the Framer canvas, embeds often won't render (no external scripts /\n// sandboxed). Show a clear placeholder so the layout is still legible.\nif(isCanvas){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",minHeight:360,background:\"#F2F0EA\",border:\"1px dashed #3A4C7E\",borderRadius:12,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:6,color:\"#3A4C7E\",fontFamily:\"Acumin Pro, sans-serif\",fontSize:13,textAlign:\"center\",padding:16,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontWeight:600},children:\"Instagram Embed\"}),/*#__PURE__*/_jsx(\"div\",{style:{opacity:.8,wordBreak:\"break-all\"},children:url?url:\"Bind a reel URL →\"}),/*#__PURE__*/_jsx(\"div\",{style:{opacity:.6},children:\"Renders on the published site\"})]});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",display:\"flex\",justifyContent:justify},children:/*#__PURE__*/_jsx(\"div\",{ref:hostRef,style:{width:\"100%\",maxWidth}})});}InstagramEmbed.defaultProps={url:\"\",maxWidth:540,align:\"center\",captioned:false};addPropertyControls(InstagramEmbed,{url:{type:ControlType.String,title:\"Reel URL\",placeholder:\"https://www.instagram.com/reel/…\",description:\"Bind this to your CMS Instagram URL field.\"},maxWidth:{type:ControlType.Number,title:\"Max Width\",min:280,max:800,step:10,unit:\"px\",displayStepper:true},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true},captioned:{type:ControlType.Boolean,title:\"Caption\",enabledTitle:\"Show\",disabledTitle:\"Hide\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InstagramEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Instagram_Reels_Embed.map"],"mappings":"A,8MACuB,SAASc,GAAqB,CAC6G,OADlGL,IAAS,QAAwCA,EAAO,QAAe,QAAQ,QAAQ,EAAKM,IAAmC,EAAc,IAAI,QAAQ,GAAS,CAAC,IAAMC,EAAS,SAAS,cAAc,eAAeC,EAAW,GAAG,EAAE,GAAGD,EAAS,CAACA,EAAS,iBAAiB,WAAWE,EAAQ,CAAC,EAChWT,EAAO,SAAQS,EAAQ,EAAE,MAAO,CAAC,IAAMC,EAAE,SAAS,cAAc,QAAQ,EAAE,EAAE,IAAIF,EAAW,EAAE,MAAM,GAAK,EAAE,WAAWC,EAAQ,EAAE,SAAS,KAAK,YAAYC,CAAC,CAAE,CAAC,EAASJ,EAAc,CAAC,SAAwBK,EAAe,EAAM,CAAC,GAAK,CAAC,MAAI,WAAS,QAAM,aAAWC,EAAYC,EAAQtB,EAAO,IAAI,EAAQuB,EAASZ,EAAa,QAAQ,IAAIA,EAAa,OAgB0R,OAhBnRJ,MAAc,CAAC,IAAMiB,EAAKF,EAAQ,QAAQ,GAAG,CAACE,EAAK,OAC1Z,IAAMC,GAAOC,GAAK,GAAA,CAAI,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,OAAO,GAAG,EAAE,GAAG,CAACD,GAAO,CAACA,EAAM,SAAS,eAAe,EAAE,CA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