{"version":3,"file":"SenjaWidget.CPc4NFa7.mjs","names":["_Fragment"],"sources":["https:/framerusercontent.com/modules/olO8DyMykH1biy6TtW2P/8jvcS0BNsXf38RX6obC0/SenjaWidget.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState,useRef}from\"react\";/**\n *\n * @framerSupportedLayoutWidth fill\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function SenjaWidget(props){let className=\"senja-embed\";let lazy=props.lazy;let id=props.widgetUrl;let hideInEditor=props.hideInEditor&&RenderTarget.current()===RenderTarget.canvas;if(hideInEditor){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"20px\",textAlign:\"center\",backgroundColor:\"#000\",color:\"#fff\"},children:\"This widget will show up when your site is published.\"},\"live-banner\");}if(id){const regex=/widget\\.senja\\.io\\/widget\\/([^\\s\\/?]+)/;const match=id.match(regex);if(match[1])id=match[1];}let builderUrl=`https://widget.senja.io/widget/${id}/platform.js`;const[mounted,setMounted]=useState(true);useDidMountEffect(()=>{setMounted(false);setTimeout(()=>setMounted(true),5);},[props.widgetUrl,props.embedType]);useEffect(()=>{if(typeof document==\"undefined\")return;let script=document.querySelector(`script[src=\"${builderUrl}\"]`);if(script){script.remove();}script=document.createElement(\"script\");script.src=builderUrl;script.async=true;script.type=\"text/javascript\";document.head.append(script);},[props]);if(!mounted)return /*#__PURE__*/_jsx(_Fragment,{});return /*#__PURE__*/_jsx(\"div\",{className:className,\"data-lazyload\":lazy,\"data-mode\":\"shadow\",\"data-id\":id},\"widget\");}addPropertyControls(SenjaWidget,{widgetUrl:{type:ControlType.String,title:\"Widget URL\"},lazy:{type:ControlType.Boolean,title:\"Lazy Load\",defaultValue:true},hideInEditor:{type:ControlType.Boolean,title:\"Hide in Editor\",defaultValue:false}});const useDidMountEffect=(func,deps)=>{const didMount=useRef(false);useEffect(()=>{if(didMount.current)func();else didMount.current=true;},deps);};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SenjaWidget\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SenjaWidget.map"],"mappings":"2SAKG,SAAwB,EAAY,EAAM,CAAC,IAAI,EAAU,cAAkB,EAAK,EAAM,KAAS,EAAG,EAAM,UAAc,EAAa,EAAM,cAAc,EAAa,SAAS,GAAG,EAAa,OAAO,GAAG,EAAc,MAAoB,GAAK,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,QAAQ,OAAO,UAAU,SAAS,gBAAgB,OAAO,MAAM,MAAO,EAAC,SAAS,uDAAwD,EAAC,cAAc,CAAE,GAAG,EAAG,CAAC,IAAM,EAAM,yCAA+C,EAAM,EAAG,MAAM,EAAM,CAAC,AAAG,EAAM,KAAG,EAAG,EAAM,GAAI,KAAI,GAAY,iCAAiC,EAAG,cAAmB,CAAC,EAAQ,EAAW,CAAC,GAAS,EAAK,CAA8c,MAA7c,GAAkB,IAAI,CAAmB,AAAlB,GAAW,EAAM,CAAC,WAAW,IAAI,GAAW,EAAK,CAAC,EAAE,AAAE,EAAC,CAAC,EAAM,UAAU,EAAM,SAAU,EAAC,CAAC,EAAU,IAAI,CAAC,UAAU,SAAU,IAAY,OAAO,IAAI,EAAO,SAAS,eAAe,cAAc,EAAW,IAAI,CAA2I,AAAvI,GAAQ,EAAO,QAAQ,CAAE,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,IAAI,EAAW,EAAO,OAAM,EAAK,EAAO,KAAK,kBAAkB,SAAS,KAAK,OAAO,EAAO,AAAE,EAAC,CAAC,CAAM,EAAC,CAAK,EAAmE,EAAK,MAAM,CAAW,YAAU,gBAAgB,EAAK,YAAY,SAAS,UAAU,CAAG,EAAC,SAA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