"use strict";function a(b){"@babel/helpers - typeof";return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var b=j(require("prop-types")),c=i(require("react")),d=require("marked"),e=j(require("classnames")),f=require("./../utils/MarkupTypes.js"),g=["data","className","markupType"];function h(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(h=function(a){return a?c:b})(a)}function i(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!==a(b)&&"function"!=typeof b)return{default:b};var d=h(c);if(d&&d.has(b))return d.get(b);var e={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in b)if("default"!=g&&Object.prototype.hasOwnProperty.call(b,g)){var i=f?Object.getOwnPropertyDescriptor(b,g):null;i&&(i.get||i.set)?Object.defineProperty(e,g,i):e[g]=b[g]}return e["default"]=b,d&&d.set(b,e),e}function j(a){return a&&a.__esModule?a:{default:a}}function k(){return k=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},k.apply(this,arguments)}function l(a,b){return r(a)||q(a,b)||n(a,b)||m()}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(a,b){if(a){if("string"==typeof a)return p(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?p(a,b):void 0}}function p(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function q(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function r(a){if(Array.isArray(a))return a}function s(a,b){if(null==a)return{};var c,d,e=t(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function t(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}var u=function(a){var b=a.data,h=a.className,i=a.markupType,j=s(a,g),m=function(a,b){if(a){if(b===f.MarkupTypes.markdown)return(0,d.parse)(a);var c=require("markdown-it")("commonmark");return c.render(a)}},n=(0,c.useState)(function(){return m(b,i)}),o=l(n,2),p=o[0],q=o[1];return(0,c.useEffect)(function(){q(m(b,i))},[b,i]),c["default"].createElement("div",k({className:(0,e["default"])("markdown",h),"data-testid":"markdown",dangerouslySetInnerHTML:{__html:p}},j))};u.propTypes={data:b["default"].string,className:b["default"].string,markupType:b["default"].oneOf(Object.values(f.MarkupTypes))};var v=u;exports["default"]=v;