{"version":3,"file":"static/js/8025.d6b876bd.chunk.js","mappings":"mHAAO,SAASA,EAAeC,GAEPC,SAASC,iBAAiB,sDAGhCC,SAAQ,SAACC,GACvBA,EAAOC,QACT,IAEA,IAAIC,EAAKL,SAASM,cAAc,UAChCD,EAAGE,aAAa,OAAQ,mBACxBF,EAAGE,aAAa,MAAO,wCACvBF,EAAGG,OAAQ,EAEXH,EAAGI,iBAAiB,QAAQ,WAC1B,IAAIC,EAAIC,aAAY,WAClB,GAAIC,OAAOC,SACT,IACED,OAAOC,SAASC,KAAKf,GACrBgB,cAAcL,EAChB,CAAE,MAAOM,GACPC,QAAQC,MAAM,yBAA0BF,EAC1C,CAEJ,GAAG,GACL,IAEAhB,SAASmB,qBAAqB,QAAQ,GAAGC,YAAYf,EACvD,C,+JCvBe,SAASgB,EAAQC,GAA8E,IAA3EC,EAAUD,EAAVC,WAAYC,EAAcF,EAAdE,eAAgBC,EAAeH,EAAfG,gBAAiBC,EAAaJ,EAAbI,cAAeC,EAAUL,EAAVK,YAC7FC,EAAAA,EAAAA,YAAU,YACR9B,EAAAA,EAAAA,GAAeyB,EACjB,GAAG,IAEH,IAAMM,EAAUC,EAAAA,EAA+CL,GAAiB,SAAUM,EACpFC,EAAWF,EAAAA,EAA+CJ,GAAe,SAAUK,EACnFE,EAAWH,EAAAA,EAA+CH,GAAY,SAAUI,EAEtF,OACEG,EAAAA,EAAAA,KAAA,OAAKC,UAAS,GAAAC,OAAKP,EAAO,KAAAO,OAAIJ,EAAQ,KAAAI,OAAIH,GAAWI,UACnDH,EAAAA,EAAAA,KAAA,OAAKC,UAAS,WAAaE,SAAEb,GAAiBc,EAAAA,EAAAA,IAAyBd,GAAkB,MAG/F,C","sources":["helpers/mopinionHelpers.js","shared/mopinion/mopinion.jsx"],"sourcesContent":["export function handleMopinion(id) {\n // Select all scripts with the given src attribute\n var existingScripts = document.querySelectorAll('script[src=\"//deploy.mopinion.com/js/pastease.js\"]')\n\n // Remove all selected scripts\n existingScripts.forEach((script) => {\n script.remove()\n })\n\n var js = document.createElement(\"script\")\n js.setAttribute(\"type\", \"text/javascript\")\n js.setAttribute(\"src\", \"//deploy.mopinion.com/js/pastease.js\")\n js.async = true\n\n js.addEventListener(\"load\", function () {\n var t = setInterval(function () {\n if (window.Pastease) {\n try {\n window.Pastease.load(id)\n clearInterval(t)\n } catch (e) {\n console.error(\"Error loading Mopinion\", e)\n }\n }\n }, 50)\n })\n\n document.getElementsByTagName(\"head\")[0].appendChild(js)\n}\n","import React, { useEffect } from \"react\"\nimport { htmlStringToReactElement } from \"../../helpers/html\"\nimport { handleMopinion } from \"../../helpers/mopinionHelpers\"\nimport * as SelectionFactoryHelper from \"../helpers/SelectionFactoryHelper\"\n\nexport default function Mopinion({ mopinionId, mopinionScript, backgroundColor, bottomPadding, topPadding }) {\n useEffect(() => {\n handleMopinion(mopinionId)\n }, [])\n\n const bgColor = SelectionFactoryHelper.getFromSelectionFactory(backgroundColor, false) || undefined\n const tPadding = SelectionFactoryHelper.getFromSelectionFactory(bottomPadding, false) || undefined\n const bPadding = SelectionFactoryHelper.getFromSelectionFactory(topPadding, false) || undefined\n\n return (\n <div className={`${bgColor} ${tPadding} ${bPadding}`}>\n <div className={`w--wider`}>{mopinionScript ? htmlStringToReactElement(mopinionScript) : \"\"}</div>\n </div>\n )\n}\n"],"names":["handleMopinion","id","document","querySelectorAll","forEach","script","remove","js","createElement","setAttribute","async","addEventListener","t","setInterval","window","Pastease","load","clearInterval","e","console","error","getElementsByTagName","appendChild","Mopinion","_ref","mopinionId","mopinionScript","backgroundColor","bottomPadding","topPadding","useEffect","bgColor","SelectionFactoryHelper","undefined","tPadding","bPadding","_jsx","className","concat","children","htmlStringToReactElement"],"sourceRoot":""}