{"version":3,"file":"SenjaWidget.DZri1qQ7.mjs","names":["useState","_Fragment","useRef"],"sources":["https:/framerusercontent.com/modules/ckGZj3yYY0eOgQQMpSdE/MHgEqwFhsQr65hfGIN8X/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\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SenjaWidget.map"],"mappings":"2SAKG,SAAwB,EAAY,EAAM,CAAC,IAAgC,EAAK,EAAM,KAAS,EAAG,EAAM,UAAc,EAAa,EAAM,cAAc,EAAa,YAAY,EAAa,OAAO,GAAG,EAAc,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,QAAQ,OAAO,UAAU,SAAS,gBAAgB,OAAO,MAAM,OAAO,CAAC,SAAS,wDAAwD,CAAC,eAAgB,GAAG,EAAG,CAAC,IAAM,EAAM,yCAA+C,EAAM,EAAG,MAAM,GAAU,EAAM,KAAG,EAAG,EAAM,GAAI,KAAI,EAAW,kCAAkC,EAAG,cAAmB,CAAC,EAAQ,EAAW,CAACA,EAAS,IAAmd,OAA7c,MAAsB,CAAC,EAAW,IAAO,eAAe,EAAW,IAAM,EAAI,EAAC,CAAC,EAAM,UAAU,EAAM,UAAU,EAAE,MAAc,CAAC,GAAG,OAAO,SAAU,IAAY,OAAO,IAAI,EAAO,SAAS,cAAc,eAAe,EAAW,KAAQ,GAAQ,EAAO,SAAU,EAAO,SAAS,cAAc,UAAU,EAAO,IAAI,EAAW,EAAO,MAAM,GAAK,EAAO,KAAK,kBAAkB,SAAS,KAAK,OAAO,EAAS,EAAC,CAAC,EAAM,EAAM,EAAmE,EAAK,MAAM,CAAW,wBAAU,gBAAgB,EAAK,YAAY,SAAS,UAAU,EAAG,CAAC,UAA/H,EAAKC,EAAU,EAAE,CAAyH,+BAAoB,EAAY,CAAC,UAAU,CAAC,KAAK,EAAY,OAAO,MAAM,aAAa,CAAC,KAAK,CAAC,KAAK,EAAY,QAAQ,MAAM,YAAY,aAAa,GAAK,CAAC,aAAa,CAAC,KAAK,EAAY,QAAQ,MAAM,iBAAiB,aAAa,GAAM,CAAC,EAAQ,GAAmB,EAAK,IAAO,CAAC,IAAM,EAASC,EAAO,IAAO,MAAc,CAAI,EAAS,QAAQ,IAAY,EAAS,QAAQ,EAAM,EAAC,EAAO"}