{"version":3,"file":"Blog.D5ELEEND.mjs","names":["useRef","p"],"sources":["https:/framerusercontent.com/modules/lBUL7hNof3LnxpMniEOE/KV5lgMfnslwC7rISy1vR/Blog.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function withToc(Component){return props=>{const ref=useRef(null);useEffect(()=>{if(ref.current){const images=ref.current.querySelectorAll(\".framer-image\");images.forEach(img=>{img.style.display=\"block\";img.style.marginLeft=\"auto\";img.style.marginRight=\"auto\";img.style.width=\"100%\";img.style.height=\"auto\"// Maintains aspect ratio\n;// Add a smooth transition for width, height, and opacity\nimg.style.transition=\"width 0.4s cubic-bezier(0.4,0,0.2,1), height 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.4s cubic-bezier(0.4,0,0.2,1)\";// Optional: fade in effect on mount\nimg.style.opacity=\"0\";setTimeout(()=>{img.style.opacity=\"1\";},10);});}},[]);return /*#__PURE__*/_jsx(\"div\",{className:\"sj-toc-content\",style:{width:\"100%\"},ref:ref,children:/*#__PURE__*/_jsx(Component,{...props})});};}export function withInlineCTA(Component){return props=>{const containerRef=useRef(null);useEffect(()=>{const headings=containerRef.current.querySelectorAll(\"h1, h2, h3, h4, h5, h6\");if(headings.length>0){const topLevel=Math.min(...Array.from(headings).map(h=>parseInt(h.tagName[1])));const topLevelHeadings=containerRef.current.querySelectorAll(`h${topLevel}`);if(topLevelHeadings.length>=3){const target=topLevelHeadings[2];const injectDiv=document.createElement(\"div\");injectDiv.setAttribute(\"data-getsitecontrol-inline\",\"348807\");injectDiv.style.marginTop=\"20px\";injectDiv.style.marginBottom=\"20px\";target.parentNode.insertBefore(injectDiv,target);}}},[containerRef]);return /*#__PURE__*/_jsx(\"div\",{id:\"sj-cta-target\",ref:containerRef,children:/*#__PURE__*/_jsx(Component,{...props})});};}export function withDynamicContent(Component){return props=>{useEffect(()=>{// Function to fetch the embed code from Twitter's oEmbed API\nasync function fetchEmbedCode(url){const response=await fetch(`https://twp.senja.workers.dev?url=${url}`);const data=await response.json();return data.html;}// Function to find and replace plaintext Twitter URLs with embeds\nasync function replaceTwitterUrls(){const regex=/https?:\\/\\/(www\\.)?(twitter|x)\\.com\\/[a-zA-Z0-9_]{1,15}\\/status(?:es)?\\/\\d+(?:\\?[a-zA-Z0-9_=&]+)?(?:#\\w+)?/g;const elements=document.body.getElementsByTagName(\"*\");for(const element of elements){if(element.children.length===0){const text=element.textContent;const matches=text.match(regex);if(matches){const index=Array.from(elements).indexOf(element);for(const match of matches){element.style.display=\"none\";const embedCode=await fetchEmbedCode(match);const embedWrapper=document.createElement(\"div\");embedWrapper.innerHTML=embedCode;embedWrapper.classList.add(\"tw-embed-wrapper\");embedWrapper.style.display=\"flex\";embedWrapper.style.flexDirection=\"column\";setInnerHTML(element,element.innerHTML.replace(match,embedWrapper.outerHTML));element.style.display=\"block\";}}}}}function loadTwitterScript(){const script=document.createElement(\"script\");script.src=\"https://platform.twitter.com/widgets.js\";script.async=true;document.body.appendChild(script);}replaceTwitterUrls();convertBoldItalicParagraphsToBlockquotes();styleParagraphsWithTripleBang();replaceCodeBlocksWithCode();},[]);return /*#__PURE__*/_jsx(Component,{...props});};}function setInnerHTML(elm,html){elm.innerHTML=html;Array.from(elm.querySelectorAll(\"script\")).forEach(oldScriptEl=>{const newScriptEl=document.createElement(\"script\");Array.from(oldScriptEl.attributes).forEach(attr=>{newScriptEl.setAttribute(attr.name,attr.value);});const scriptText=document.createTextNode(oldScriptEl.innerHTML);newScriptEl.appendChild(scriptText);oldScriptEl.parentNode.replaceChild(newScriptEl,oldScriptEl);});}function replaceCodeBlocksWithCode(){const codeBlocks=Array.from(document.querySelectorAll(\".framer-cb\"));console.log(codeBlocks);for(const codeBlock of codeBlocks){const code=codeBlock.textContent;const codeWrapper=document.createElement(\"div\");codeBlock.replaceWith(codeWrapper);setInnerHTML(codeWrapper,code);}}function convertBoldItalicParagraphsToBlockquotes(){// Select all paragraph elements with the specific class\nconst paragraphs=document.querySelectorAll(\"p\");// Iterate through each paragraph\nparagraphs.forEach(p=>{const excluded=[\"BLOCKQUOTE\",\"LI\"];if(excluded.find(e=>p.parentNode.nodeName==e))return;// Check if the paragraph contains an <em> tag, which in turn contains a <strong> tag\n// Create a container to hold all bold and italic text\nlet combinedText=\"\";// Find all nested <em> and <strong> elements\nconst ems=p.querySelectorAll(\"em.framer-text\");ems.forEach(em=>{const strongs=em.querySelectorAll(\"strong.framer-text\");strongs.forEach(strong=>{combinedText+=strong.textContent;});});// Ensure the combined text matches the entire content of the paragraph\nif(combinedText&&combinedText===p.textContent){// Create a blockquote element\nconst blockquote=document.createElement(\"blockquote\");// Apply the styles to the blockquote\nblockquote.style.background=\"#f8fafc\";blockquote.style.padding=\"20px\";blockquote.style.borderTopRightRadius=\"4px\";blockquote.style.borderBottomRightRadius=\"4px\";blockquote.style.marginLeft=\"0px\";blockquote.style.marginRight=\"0px\";blockquote.style.borderLeft=\"2px solid #2dd4bf\";p.style.color=\"#4b5563\";p.style.marginBottom=\"0px\";// Insert the blockquote before the paragraph in the DOM\np.parentNode.insertBefore(blockquote,p);p.querySelectorAll(\"em\").forEach(em=>em.style.fontStyle=\"normal\");p.querySelectorAll(\"strong\").forEach(strong=>{strong.style.fontWeight=\"500\";strong.style.fontStyle=\"normal\";});// Move the paragraph inside the blockquote\nblockquote.appendChild(p);}});}function styleParagraphsWithTripleBang(){// Select all elements with class 'framer-text' within 'p' tags.\nconst elements=document.querySelectorAll(\"p.framer-text\");const handleTextNodes=node=>{if(node.nodeType===Node.TEXT_NODE){// Remove the triple bank from the start of the text and trim.\nnode.textContent=node.textContent?.replace(/^\\s*\\!\\!\\!/,\"\")||\"\";}else{// Recursively check for text nodes in child nodes.\nnode.childNodes.forEach(handleTextNodes);if(node.style)node.style.fontSize=\"16px\";}};// Iterate over the selected elements.\nelements.forEach(element=>{// Check if the text content starts with a triple bank '$$$'.\nif(element.textContent?.startsWith(\"!!!\")){element.style.background=\"#f3f4f6\";element.style.padding=\"20px\";element.style.borderRadius=\"4px\";element.style.marginLeft=\"0px\";element.style.fontSize=\"16px\";element.childNodes.forEach(handleTextNodes);}});}\nexport const __FramerMetadata__ = {\"exports\":{\"withInlineCTA\":{\"type\":\"reactHoc\",\"name\":\"withInlineCTA\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDynamicContent\":{\"type\":\"reactHoc\",\"name\":\"withDynamicContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withToc\":{\"type\":\"reactHoc\",\"name\":\"withToc\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Blog.map"],"mappings":"mKAA+E,SAAgB,EAAQ,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIA,EAAO,KAAK,CAG3E,OAH4E,MAAc,CAAI,EAAI,SAAsB,EAAI,QAAQ,iBAAiB,gBAAgB,CAAQ,QAAQ,GAAK,CAAC,EAAI,MAAM,QAAQ,QAAQ,EAAI,MAAM,WAAW,OAAO,EAAI,MAAM,YAAY,OAAO,EAAI,MAAM,MAAM,OAAO,EAAI,MAAM,OAAO,OAElY,EAAI,MAAM,WAAW,sHACrB,EAAI,MAAM,QAAQ,IAAI,eAAe,CAAC,EAAI,MAAM,QAAQ,KAAM,GAAG,EAAG,EAAI,EAAE,CAAC,CAAqB,EAAK,MAAM,CAAC,UAAU,iBAAiB,MAAM,CAAC,MAAM,OAAO,CAAK,MAAI,SAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAC,CAAC,EAA6xB,SAAgB,EAAmB,EAAU,CAAC,MAAO,KAAQ,MAAc,CAC9jC,eAAe,EAAe,EAAI,CAAyG,OAAtB,MAAnE,MAAM,MAAM,qCAAqC,IAAM,EAA2B,MAAM,EAAa,KACvJ,eAAe,GAAoB,CAAC,IAAM,EAAM,8GAAoH,EAAS,SAAS,KAAK,qBAAqB,IAAI,CAAC,IAAI,IAAM,KAAW,EAAU,GAAG,EAAQ,SAA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