{"version":3,"file":"CaseStudyEmbed.ThPhNTRb.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/mDFYBOugLDQmKHZR01iq/ujIIJeHF2XRznCprFlFq/CaseStudyEmbed.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Case Study Embed\n *\n * Pulls a self-contained case-study document in at runtime and injects it into\n * the page, so it scrolls with the rest of the site instead of sitting in its\n * own iframe. The source is fetched rather than inlined, which keeps this file\n * small and means redeploying the case study updates the site with no edit here.\n *\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 2400\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function CaseStudyEmbed(props){const{source,minHeight}=props;const hostRef=useRef(null);const[state,setState]=useState(\"idle\");const target=RenderTarget.current();const isStatic=target===RenderTarget.canvas||target===RenderTarget.thumbnail;useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;if(isStatic||!source)return;let cancelled=false;startTransition(function(){setState(\"loading\");});fetch(source).then(function(r){if(!r.ok)throw new Error(String(r.status));return r.text();}).then(function(html){const node=hostRef.current;if(cancelled||!node)return;// The hosted document may still carry relative asset paths.\n// Those would resolve against this page's URL rather than the\n// asset host, so rebase them off the source URL. Paths that are\n// already absolute are preceded by \"/\" and left untouched, which\n// makes this safe to run either way.\nconst base=source.replace(/[^/]*$/,\"\");const rebased=html.replace(/([\"'(=,\\s])case-study-assets\\//g,\"$1\"+base+\"case-study-assets/\");node.innerHTML=rebased;startTransition(function(){setState(\"ready\");});// innerHTML never executes <script>, so each one has to be\n// re-created. Deferring that until after two frames matters:\n// the document's scroll-reveal decides what to hide by reading\n// getBoundingClientRect against the fold, and running it while\n// this container is still collapsing makes every section look\n// above the fold, leaving nothing to reveal.\nconst runScripts=function(){const current=hostRef.current;if(cancelled||!current)return;const found=current.querySelectorAll(\"script\");for(let i=0;i<found.length;i++){const old=found[i];const fresh=document.createElement(\"script\");for(let a=0;a<old.attributes.length;a++){const attr=old.attributes[a];fresh.setAttribute(attr.name,attr.value);}fresh.textContent=old.textContent;if(old.parentNode)old.parentNode.replaceChild(fresh,old);}};// A timer rather than requestAnimationFrame on purpose: rAF is\n// suspended in a hidden or backgrounded tab, which would leave\n// the document's own scripts unexecuted until the tab regained\n// focus. A timeout still fires there.\nwindow.setTimeout(runScripts,150);}).catch(function(){if(!cancelled){startTransition(function(){setState(\"error\");});}});return function(){cancelled=true;};},[source,isStatic]);const shell={position:\"relative\",width:\"100%\",minHeight:state===\"ready\"?undefined:minHeight};const note={position:\"relative\",width:\"100%\",minHeight:minHeight,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",textAlign:\"center\",padding:32,boxSizing:\"border-box\",color:\"rgba(255,255,255,0.55)\",font:'500 14px/1.5 -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif',letterSpacing:\"0.02em\",background:\"linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(200,247,81,0.03) 100%)\",border:\"1px solid rgba(255,255,255,0.08)\",borderRadius:20};if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:note,children:/*#__PURE__*/_jsxs(\"span\",{children:[\"Case study loads on the published site\",/*#__PURE__*/_jsx(\"br\",{}),source]})});}if(state===\"error\"){return /*#__PURE__*/_jsx(\"div\",{style:note,children:/*#__PURE__*/_jsxs(\"span\",{children:[\"Could not load the case study from \",source]})});}return /*#__PURE__*/_jsx(\"div\",{ref:hostRef,style:shell,\"aria-live\":\"polite\"});}addPropertyControls(CaseStudyEmbed,{source:{type:ControlType.String,title:\"Source\",defaultValue:\"https://auto-grading-case-study-export.vercel.app/framer-embed.html\",placeholder:\"https://…/framer-embed.html\"},minHeight:{type:ControlType.Number,title:\"Min Height\",defaultValue:800,min:200,max:4e3,step:50,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CaseStudyEmbed\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"1200\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicHeight\":\"2400\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseStudyEmbed.map"],"mappings":"iNAaG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,SAAO,aAAW,EAAY,EAAQA,EAAO,IAAI,EAAO,CAAC,EAAM,GAAUC,EAAS,MAAM,EAAQ,EAAO,EAAa,QAAQ,EAAQ,EAAS,IAAS,EAAa,QAAQ,IAAS,EAAa,UAAU,MAAc,CAAsE,GAA3D,IAAS,QAAa,OAAO,SAAW,KAAsB,GAAU,CAAC,EAAO,OAAO,IAAI,EAAU,GAevQ,OAf6Q,EAAgB,UAAU,CAAC,EAAS,SAAS,CAAE,CAAC,EAAE,MAAM,CAAM,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,MAAU,MAAM,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,CAAE,CAAC,CAAC,CAAC,KAAK,SAAS,EAAK,CAAC,IAAM,EAAK,EAAQ,QAAQ,GAAG,GAAW,CAAC,EAAK,OAKxlB,IAAM,EAAK,EAAO,QAAQ,SAAS,EAAE,EAA+F,EAAK,UAApF,EAAK,QAAQ,kCAAkC,KAAK,EAAK,oBAA2C,EAAE,EAAgB,UAAU,CAAC,EAAS,OAAO,CAAE,CAAC,EAUzM,EAAO,WAAW,UAJS,CAAC,IAAM,EAAQ,EAAQ,QAAQ,GAAG,GAAW,CAAC,EAAQ,OAAO,IAAM,EAAM,EAAQ,iBAAiB,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,EAAM,OAAO,IAAI,CAAC,IAAM,EAAI,EAAM,GAAS,EAAM,SAAS,cAAc,QAAQ,EAAE,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