"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CodeViewer=void 0;var a=g(require("highlight.js")),b=g(require("react")),c=g(require("classnames")),d=g(require("prop-types")),e=require("./../utils/CodeViewerLanguageMapper.js"),f=["children","codeLanguage","className","highlight"];function g(a){return a&&a.__esModule?a:{default:a}}function h(){return h=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},h.apply(this,arguments)}function i(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function j(a,b){if(null==a)return{};var c,d,e=k(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 k(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 l=function(d){var g,k=d.children,l=void 0===k?"":k,m=d.codeLanguage,n=void 0===m?"":m,o=d.className,p=d.highlight,q=!(void 0!==p)||p,r=j(d,f),s=(0,e.getHighlightClassForCodeLanguage)(n),t=l;if(q){t=a["default"].highlightAuto(l,s?[s]:void 0).value,g=s.toLowerCase();var u=(t.match(/hljs/g)||[]).length;1500<=u&&(q=!1)}return b["default"].createElement("pre",null,q?b["default"].createElement("code",h({"data-testid":"highlight",className:(0,c["default"])(o,i({},g,s),"hljs"),dangerouslySetInnerHTML:{__html:t},tabIndex:0},r)):b["default"].createElement("code",h({"data-testid":"highlight",className:(0,c["default"])(o),tabIndex:0},r),l))};exports.CodeViewer=l,l.propTypes={codeLanguage:d["default"].string,className:d["default"].string,children:d["default"].node};