{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/CnLeDDhKGnD4ckhy3dEl/Y0LMTugYrjCJ9bqIXPmE/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": "4HAKkB,SAARA,EAA6BC,EAAM,CAAC,IAAIC,EAAU,cAAkBC,EAAKF,EAAM,KAASG,EAAGH,EAAM,UAA4F,GAAjEA,EAAM,cAAcI,EAAa,QAAQ,IAAIA,EAAa,OAAwB,OAAoBC,EAAK,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,QAAQ,OAAO,UAAU,SAAS,gBAAgB,OAAO,MAAM,MAAM,EAAE,SAAS,uDAAuD,EAAE,aAAa,EAAG,GAAGF,EAAG,CAAC,IAAMG,EAAM,yCAA+CC,EAAMJ,EAAG,MAAMG,CAAK,EAAKC,EAAM,CAAC,IAAEJ,EAAGI,EAAM,CAAC,EAAE,CAAC,IAAIC,EAAW,kCAAkCL,CAAE,eAAoB,CAACM,EAAQC,CAAU,EAAEC,EAAS,EAAI,EAA4Z,OAA1ZC,EAAkB,IAAI,CAACF,EAAW,EAAK,EAAE,WAAW,IAAIA,EAAW,EAAI,EAAE,CAAC,CAAE,EAAE,CAACV,EAAM,UAAUA,EAAM,SAAS,CAAC,EAAEa,EAAU,IAAI,CAAC,GAAG,OAAO,SAAU,IAAY,OAAO,IAAIC,EAAO,SAAS,cAAc,eAAeN,CAAU,IAAI,EAAKM,GAAQA,EAAO,OAAO,EAAGA,EAAO,SAAS,cAAc,QAAQ,EAAEA,EAAO,IAAIN,EAAWM,EAAO,MAAM,GAAKA,EAAO,KAAK,kBAAkB,SAAS,KAAK,OAAOA,CAAM,CAAE,EAAE,CAACd,CAAK,CAAC,EAAMS,EAAmEJ,EAAK,MAAM,CAAC,UAAUJ,EAAU,gBAAgBC,EAAK,YAAY,SAAS,UAAUC,CAAE,EAAE,QAAQ,EAAvIE,EAAKU,EAAU,CAAC,CAAC,CAAwH,CAACC,EAAoBjB,EAAY,CAAC,UAAU,CAAC,KAAKkB,EAAY,OAAO,MAAM,YAAY,EAAE,KAAK,CAAC,KAAKA,EAAY,QAAQ,MAAM,YAAY,aAAa,EAAI,EAAE,aAAa,CAAC,KAAKA,EAAY,QAAQ,MAAM,iBAAiB,aAAa,EAAK,CAAC,CAAC,EAAE,IAAML,EAAkB,CAACM,EAAKC,IAAO,CAAC,IAAMC,EAASC,EAAO,EAAK,EAAER,EAAU,IAAI,CAAIO,EAAS,QAAQF,EAAK,EAAOE,EAAS,QAAQ,EAAK,EAAED,CAAI,CAAE",
  "names": ["SenjaWidget", "props", "className", "lazy", "id", "RenderTarget", "p", "regex", "match", "builderUrl", "mounted", "setMounted", "ye", "useDidMountEffect", "ue", "script", "l", "addPropertyControls", "ControlType", "func", "deps", "didMount", "pe"]
}
