"use strict";
// The require scope
var __webpack_require__ = {};
/************************************************************************/ // webpack/runtime/compat_get_default_export
(()=>{
    // getDefaultExport function for compatibility with non-ESM modules
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
// webpack/runtime/define_property_getters
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
// webpack/runtime/has_own_property
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
// webpack/runtime/make_namespace_object
(()=>{
    // define __esModule on exports
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
/************************************************************************/ var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
    default: ()=>/* binding */ CodeBlock_rslib_entry_
});
const external_react_namespaceObject = require("react");
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
const react_namespaceObject = require("@chakra-ui/react");
const CopyButton_js_namespaceObject = require("../CopyButton/CopyButton.js");
var CopyButton_js_default = /*#__PURE__*/ __webpack_require__.n(CopyButton_js_namespaceObject);
const external_react_syntax_highlighter_namespaceObject = require("react-syntax-highlighter");
const nightOwl_js_namespaceObject = require("./theme/nightOwl.js");
var nightOwl_js_default = /*#__PURE__*/ __webpack_require__.n(nightOwl_js_namespaceObject);
const prism_namespaceObject = require("react-syntax-highlighter/dist/cjs/styles/prism/prism");
var prism_default = /*#__PURE__*/ __webpack_require__.n(prism_namespaceObject);
// Need to reexport due to conflicting dist build
function CodeBlock({ codeString, language, removeLineBreaksFromCopy = false, showLineNumbers = false, showCopyButton = true, highlightLines, theme = 'dark', ...otherProps }) {
    const shouldHighlightLine = (index)=>{
        if (!highlightLines) return false;
        const lineNumber = index + 1;
        const inRange = lineNumber >= highlightLines[0] && lineNumber <= highlightLines[1];
        return inRange;
    };
    const backgroundColor = 'dark' === theme ? '#011627' : '#F5F2F0';
    return /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        position: "relative",
        zIndex: "0"
    }, /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        px: 0,
        rounded: "md",
        bg: backgroundColor,
        color: "white",
        overflow: "hidden",
        __css: {
            '&::-webkit-scrollbar': {
                overflow: 'visible',
                width: '4px',
                borderRadius: 'full'
            },
            '&::-webkit-scrollbar-thumb': {
                background: backgroundColor,
                borderRadius: 'full'
            },
            '&::-webkit-scrollbar-track': {
                background: backgroundColor,
                borderRadius: 'full'
            },
            '&::-webkit-scrollbar-corner': {
                background: backgroundColor
            }
        }
    }, /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, null, /*#__PURE__*/ external_react_default().createElement(external_react_syntax_highlighter_namespaceObject.Prism, {
        ...otherProps,
        PreTag: "div",
        language: language,
        style: 'dark' === theme ? nightOwl_js_default() : prism_default(),
        showLineNumbers: showLineNumbers,
        wrapLines: true,
        customStyle: {
            margin: 0,
            padding: '10px',
            lineHeight: '1.3rem'
        },
        codeTagProps: {
            className: 'break-all'
        },
        lineNumberStyle: {
            opacity: '0.4',
            userSelect: 'none',
            paddingRight: '20px'
        },
        lineProps: (lineNumber)=>{
            const highlight = shouldHighlightLine(lineNumber - 1);
            return {
                style: {
                    backgroundColor: highlight ? 'whiteAlpha.200' : 'initial',
                    opacity: highlightLines ? highlight ? 1 : 0.5 : 1
                }
            };
        }
    }, removeLineBreaksFromCopy ? codeString.replace(/[\n\r]/g, '') : codeString))), showCopyButton && /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        position: "absolute",
        top: 1,
        right: 1
    }, /*#__PURE__*/ external_react_default().createElement(CopyButton_js_default(), {
        content: removeLineBreaksFromCopy ? codeString.replace(/[\n\r]/g, '') : codeString,
        background: backgroundColor,
        color: 'dark' === theme ? 'whiteAlpha.900' : 'black.900',
        _hover: {
            background: backgroundColor,
            color: 'brand.400'
        },
        borderRadius: "base",
        padding: "0.4rem"
    })));
}
/* ESM default export */ const CodeBlock_rslib_entry_ = CodeBlock;
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
