{"version":3,"file":"JoinHtmlContent.BZCQFPoy.mjs","names":["React.useRef","React.useState","React.useMemo","__esmMin","window","pe","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","c","init_jsx_runtime","ce","addPropertyControls","init_framer_Bf4_tcb2","ControlType","JoinHtmlContent","props","iframeRef","contentHeight","setContentHeight","height","autoHeight","frame","observer","measure","root","setup","html","resolvedHeight","hasHtml","bridgeNavigateMessageType","bridgeScrollMessageType","htmlWithBridge","bridgeScript","bodyCloseTagPattern","handleMessage","iframeWindow","event","data","iframeRect","calculatedY","destination","navigateUrl","init_JoinHtmlContent"],"sources":["https:/framerusercontent.com/modules/tOWh5psixLrg8uRgAGyP/cHPYUoykDxNLxhzOjOoV/JoinHtmlContent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function JoinHtmlContent(props){const{html,height=1600,autoHeight=false}=props;const iframeRef=React.useRef(null);const[contentHeight,setContentHeight]=React.useState(height);React.useEffect(()=>{if(!autoHeight)return;const frame=iframeRef.current;let observer;const measure=()=>{const root=frame?.contentDocument?.getElementById(\"mws-root\");if(root)setContentHeight(Math.ceil(root.getBoundingClientRect().height));};const setup=()=>{observer?.disconnect();const root=frame?.contentDocument?.getElementById(\"mws-root\");if(root){observer=new ResizeObserver(measure);observer.observe(root);measure();}};frame?.addEventListener(\"load\",setup);setup();return()=>{observer?.disconnect();frame?.removeEventListener(\"load\",setup);};},[autoHeight,html]);const resolvedHeight=autoHeight?contentHeight:height;const hasHtml=React.useMemo(()=>html.trim().length>0,[html]);const bridgeNavigateMessageType=\"MYWALLST_IFRAME_NAVIGATE\";const bridgeScrollMessageType=\"MYWALLST_IFRAME_SCROLL_TO\";const htmlWithBridge=React.useMemo(()=>{if(!hasHtml)return html;const bridgeScript=`<script>(function(){if(window.__mywallstNavBridgeInstalled)return;window.__mywallstNavBridgeInstalled=true;var navType=\"${bridgeNavigateMessageType}\";var scrollType=\"${bridgeScrollMessageType}\";var bridgeFlag=\"__mywallstNavBridge\";var getStartElement=function(target){var node=target;if(node&&node.nodeType===3)node=node.parentElement;while(node&&node.nodeType!==1){node=node.parentNode}return node&&node.nodeType===1?node:null};var findHashTarget=function(rawHash){if(!rawHash)return null;var decodedHash=rawHash;try{decodedHash=decodeURIComponent(rawHash)}catch(_error){}var byId=document.getElementById(decodedHash);if(byId)return byId;var escapedHash=window.CSS&&typeof window.CSS.escape===\"function\"?window.CSS.escape(decodedHash):decodedHash.replace(/[^a-zA-Z0-9_-]/g,\"\\\\\\\\$&\");try{return document.querySelector(\"#\"+escapedHash)}catch(_error){return null}};document.addEventListener(\"click\",function(e){var startElement=getStartElement(e.target);var anchor=startElement&&startElement.closest?startElement.closest(\"a[href]\"):null;if(!anchor)return;var href=(anchor.getAttribute(\"href\")||\"\").trim();if(!href||href.indexOf(\"javascript:\")===0)return;if(href.charAt(0)===\"#\"){e.preventDefault();var hashId=href.slice(1);var hashTarget=findHashTarget(hashId);if(!hashTarget)return;var offsetTop=hashTarget.getBoundingClientRect().top+window.scrollY;window.parent&&window.parent.postMessage((function(){var payload={};payload[bridgeFlag]=true;payload.type=scrollType;payload.offsetTop=offsetTop;payload.hash=hashId;return payload})(),\"*\");return}try{var resolved=new URL(href,window.location.href);var sameOrigin=resolved.origin===window.location.origin;var isRootRelative=href.charAt(0)===\"/\";if(!(sameOrigin||isRootRelative))return;e.preventDefault();resolved.hash=\"\";var navigateUrl=resolved.toString();try{if(window.parent&&window.parent.location&&typeof window.parent.location.assign===\"function\"){window.parent.location.assign(navigateUrl);return}}catch(_error){}window.parent&&window.parent.postMessage((function(){var payload={};payload[bridgeFlag]=true;payload.type=navType;payload.url=navigateUrl;return payload})(),\"*\")}catch(_error){}},true);})();</script>`;const bodyCloseTagPattern=/<\\/body>/i;if(bodyCloseTagPattern.test(html)){return html.replace(bodyCloseTagPattern,`${bridgeScript}</body>`);}return`${html}${bridgeScript}`;},[bridgeNavigateMessageType,bridgeScrollMessageType,hasHtml,html]);React.useEffect(()=>{if(!hasHtml||typeof window===\"undefined\")return;const handleMessage=event=>{const iframeWindow=iframeRef.current?.contentWindow;if(!iframeWindow||event.source!==iframeWindow)return;const data=event.data;if(!data||data.__mywallstNavBridge!==true)return;if(data.type===bridgeScrollMessageType&&typeof data.offsetTop===\"number\"&&Number.isFinite(data.offsetTop)){const iframeRect=iframeRef.current.getBoundingClientRect();const calculatedY=window.scrollY+iframeRect.top+data.offsetTop;window.scrollTo({top:Math.max(0,calculatedY),behavior:\"smooth\"});return;}if(data.type!==bridgeNavigateMessageType||typeof data.url!==\"string\"){return;}try{const destination=new URL(data.url,window.location.href);if(destination.origin!==window.location.origin)return;const navigateUrl=destination.toString();try{if(window.top&&window.top!==window){window.top.location.assign(navigateUrl);}else{window.location.assign(navigateUrl);}}catch(_error){window.location.assign(navigateUrl);}}catch(_error){// Ignore malformed message URLs.\n}};window.addEventListener(\"message\",handleMessage);return()=>{window.removeEventListener(\"message\",handleMessage);};},[bridgeNavigateMessageType,bridgeScrollMessageType,hasHtml]);return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",height:resolvedHeight,minWidth:0,minHeight:autoHeight?0:height,overflow:\"hidden\"},children:hasHtml?/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,title:\"Join page HTML content preview\",srcDoc:htmlWithBridge,sandbox:\"allow-scripts allow-forms allow-same-origin allow-top-navigation-by-user-activation\",style:{width:\"100%\",height:resolvedHeight,border:\"none\",display:\"block\",background:\"transparent\"}}):/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:resolvedHeight,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:16,fontSize:14,lineHeight:1.4,color:\"#666666\",background:\"#F5F5F5\",textAlign:\"center\"},children:\"Paste HTML into the HTML property.\"})});}addPropertyControls(JoinHtmlContent,{autoHeight:{type:ControlType.Boolean,title:\"Fit content\",defaultValue:false},html:{type:ControlType.String,title:\"HTML\",defaultValue:\"\",placeholder:\"<p>...</p>\",displayTextArea:true},height:{type:ControlType.Number,title:\"Height\",defaultValue:1600,min:200,max:4e4,step:10,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"JoinHtmlContent\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./JoinHtmlContent.map"],"mappings":"A,6MAGG,SAAwBgB,EAAgB,EAAM,CAAC,GAAK,CAAC,OAAK,SAAO,KAAK,aAAW,IAAOC,EAAYC,EAAUlB,EAAa,IAAI,EAAO,CAACmB,EAAcC,GAAkBnB,EAAeoB,CAAM,EAAET,MAAoB,CAAC,GAAG,CAACU,EAAW,OAAO,IAAMC,EAAML,EAAU,QAAYM,EAAeC,MAAY,CAAC,IAAMC,EAAKH,GAAO,iBAAiB,eAAe,UAAU,EAAKG,GAAKN,EAAiB,KAAK,KAAKM,EAAK,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAE,EAAQC,MAAU,CAACH,GAAU,WAAW,EAAE,IAAME,EAAKH,GAAO,iBAAiB,eAAe,UAAU,EAAKG,IAAM,EAAS,IAAI,eAAeD,CAAO,EAAED,EAAS,QAAQE,CAAI,EAAED,EAAQ,EAAG,EAAgD,OAA9CF,GAAO,iBAAiB,OAAOI,CAAK,EAAEA,EAAM,MAAY,CAACH,GAAU,WAAW,EAAED,GAAO,oBAAoB,OAAOI,CAAK,CAAE,CAAE,EAAE,CAACL,EAAWM,CAAI,CAAC,EAAE,IAAMC,EAAeP,EAAWH,EAAcE,EAAaS,EAAQ5B,MAAkB0B,EAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAACA,CAAI,CAAC,E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