import { _objectWithoutPropertiesLoose, _extends } from './chunk-FD4M6EBV.mjs';
import { require_markdown } from './chunk-MUPK3MH6.mjs';
import { require_yaml } from './chunk-ISRAU5IP.mjs';
import { require_tsx } from './chunk-YU6L2YXV.mjs';
import { require_typescript } from './chunk-VSDH24NK.mjs';
import { require_core } from './chunk-BNQCH2A2.mjs';
import { require_jsx } from './chunk-HNGDCMHD.mjs';
import { require_bash } from './chunk-4Y2S2TEP.mjs';
import { require_css } from './chunk-CW4JFC2I.mjs';
import { require_js_extras } from './chunk-7PYIL73X.mjs';
import { require_json } from './chunk-SWV57YYC.mjs';
import { require_graphql } from './chunk-MNLJ4LIX.mjs';
import { require_markup } from './chunk-DHRX2IL7.mjs';
import { __toESM } from './chunk-JRLSWQMA.mjs';
import React2, { lazy, Suspense, useState, useCallback } from 'react';
import { logger } from '@storybook/client-logger';
import { styled } from '@storybook/theming';
import { global } from '@storybook/global';
import memoize from 'memoizerific';

var import_jsx=__toESM(require_jsx()),jsx_default=import_jsx.default;var import_bash=__toESM(require_bash()),bash_default=import_bash.default;var import_css=__toESM(require_css()),css_default=import_css.default;var import_js_extras=__toESM(require_js_extras()),js_extras_default=import_js_extras.default;var import_json=__toESM(require_json()),json_default=import_json.default;var import_graphql=__toESM(require_graphql()),graphql_default=import_graphql.default;var import_markup=__toESM(require_markup()),markup_default=import_markup.default;var import_markdown=__toESM(require_markdown()),markdown_default=import_markdown.default;var import_yaml=__toESM(require_yaml()),yaml_default=import_yaml.default;var import_tsx=__toESM(require_tsx()),tsx_default=import_tsx.default;var import_typescript=__toESM(require_typescript()),typescript_default=import_typescript.default;function _objectWithoutProperties(source,excluded){if(source==null)return {};var target=_objectWithoutPropertiesLoose(source,excluded),key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key]);}return target}function _arrayLikeToArray(arr,len){(len==null||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if(typeof Symbol<"u"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(o){if(typeof o=="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _typeof(o){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},_typeof(o)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return (hint==="string"?String:Number)(input)}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols);}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}function powerSetPermutations(arr){var arrLength=arr.length;if(arrLength===0||arrLength===1)return arr;if(arrLength===2)return [arr[0],arr[1],"".concat(arr[0],".").concat(arr[1]),"".concat(arr[1],".").concat(arr[0])];if(arrLength===3)return [arr[0],arr[1],arr[2],"".concat(arr[0],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[0]),"".concat(arr[1],".").concat(arr[2]),"".concat(arr[2],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[1],".").concat(arr[2]),"".concat(arr[0],".").concat(arr[2],".").concat(arr[1]),"".concat(arr[1],".").concat(arr[0],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[2],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[0],".").concat(arr[1]),"".concat(arr[2],".").concat(arr[1],".").concat(arr[0])];if(arrLength>=4)return [arr[0],arr[1],arr[2],arr[3],"".concat(arr[0],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[2]),"".concat(arr[0],".").concat(arr[3]),"".concat(arr[1],".").concat(arr[0]),"".concat(arr[1],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[3]),"".concat(arr[2],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[1]),"".concat(arr[2],".").concat(arr[3]),"".concat(arr[3],".").concat(arr[0]),"".concat(arr[3],".").concat(arr[1]),"".concat(arr[3],".").concat(arr[2]),"".concat(arr[0],".").concat(arr[1],".").concat(arr[2]),"".concat(arr[0],".").concat(arr[1],".").concat(arr[3]),"".concat(arr[0],".").concat(arr[2],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[2],".").concat(arr[3]),"".concat(arr[0],".").concat(arr[3],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[3],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[0],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[0],".").concat(arr[3]),"".concat(arr[1],".").concat(arr[2],".").concat(arr[0]),"".concat(arr[1],".").concat(arr[2],".").concat(arr[3]),"".concat(arr[1],".").concat(arr[3],".").concat(arr[0]),"".concat(arr[1],".").concat(arr[3],".").concat(arr[2]),"".concat(arr[2],".").concat(arr[0],".").concat(arr[1]),"".concat(arr[2],".").concat(arr[0],".").concat(arr[3]),"".concat(arr[2],".").concat(arr[1],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[1],".").concat(arr[3]),"".concat(arr[2],".").concat(arr[3],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[3],".").concat(arr[1]),"".concat(arr[3],".").concat(arr[0],".").concat(arr[1]),"".concat(arr[3],".").concat(arr[0],".").concat(arr[2]),"".concat(arr[3],".").concat(arr[1],".").concat(arr[0]),"".concat(arr[3],".").concat(arr[1],".").concat(arr[2]),"".concat(arr[3],".").concat(arr[2],".").concat(arr[0]),"".concat(arr[3],".").concat(arr[2],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[1],".").concat(arr[2],".").concat(arr[3]),"".concat(arr[0],".").concat(arr[1],".").concat(arr[3],".").concat(arr[2]),"".concat(arr[0],".").concat(arr[2],".").concat(arr[1],".").concat(arr[3]),"".concat(arr[0],".").concat(arr[2],".").concat(arr[3],".").concat(arr[1]),"".concat(arr[0],".").concat(arr[3],".").concat(arr[1],".").concat(arr[2]),"".concat(arr[0],".").concat(arr[3],".").concat(arr[2],".").concat(arr[1]),"".concat(arr[1],".").concat(arr[0],".").concat(arr[2],".").concat(arr[3]),"".concat(arr[1],".").concat(arr[0],".").concat(arr[3],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[2],".").concat(arr[0],".").concat(arr[3]),"".concat(arr[1],".").concat(arr[2],".").concat(arr[3],".").concat(arr[0]),"".concat(arr[1],".").concat(arr[3],".").concat(arr[0],".").concat(arr[2]),"".concat(arr[1],".").concat(arr[3],".").concat(arr[2],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[0],".").concat(arr[1],".").concat(arr[3]),"".concat(arr[2],".").concat(arr[0],".").concat(arr[3],".").concat(arr[1]),"".concat(arr[2],".").concat(arr[1],".").concat(arr[0],".").concat(arr[3]),"".concat(arr[2],".").concat(arr[1],".").concat(arr[3],".").concat(arr[0]),"".concat(arr[2],".").concat(arr[3],".").concat(arr[0],".").concat(arr[1]),"".concat(arr[2],".").concat(arr[3],".").concat(arr[1],".").concat(arr[0]),"".concat(arr[3],".").concat(arr[0],".").concat(arr[1],".").concat(arr[2]),"".concat(arr[3],".").concat(arr[0],".").concat(arr[2],".").concat(arr[1]),"".concat(arr[3],".").concat(arr[1],".").concat(arr[0],".").concat(arr[2]),"".concat(arr[3],".").concat(arr[1],".").concat(arr[2],".").concat(arr[0]),"".concat(arr[3],".").concat(arr[2],".").concat(arr[0],".").concat(arr[1]),"".concat(arr[3],".").concat(arr[2],".").concat(arr[1],".").concat(arr[0])]}var classNameCombinations={};function getClassNameCombinations(classNames){if(classNames.length===0||classNames.length===1)return classNames;var key=classNames.join(".");return classNameCombinations[key]||(classNameCombinations[key]=powerSetPermutations(classNames)),classNameCombinations[key]}function createStyleObject(classNames){var elementStyle=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},stylesheet=arguments.length>2?arguments[2]:void 0,nonTokenClassNames=classNames.filter(function(className){return className!=="token"}),classNamesCombinations=getClassNameCombinations(nonTokenClassNames);return classNamesCombinations.reduce(function(styleObject,className){return _objectSpread(_objectSpread({},styleObject),stylesheet[className])},elementStyle)}function createClassNameString(classNames){return classNames.join(" ")}function createChildren(stylesheet,useInlineStyles){var childrenCount=0;return function(children){return childrenCount+=1,children.map(function(child,i){return createElement({node:child,stylesheet,useInlineStyles,key:"code-segment-".concat(childrenCount,"-").concat(i)})})}}function createElement(_ref){var node=_ref.node,stylesheet=_ref.stylesheet,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style,useInlineStyles=_ref.useInlineStyles,key=_ref.key,properties=node.properties,type=node.type,TagName=node.tagName,value=node.value;if(type==="text")return value;if(TagName){var childrenCreator=createChildren(stylesheet,useInlineStyles),props;if(!useInlineStyles)props=_objectSpread(_objectSpread({},properties),{},{className:createClassNameString(properties.className)});else {var allStylesheetSelectors=Object.keys(stylesheet).reduce(function(classes,selector){return selector.split(".").forEach(function(className2){classes.includes(className2)||classes.push(className2);}),classes},[]),startingClassName=properties.className&&properties.className.includes("token")?["token"]:[],className=properties.className&&startingClassName.concat(properties.className.filter(function(className2){return !allStylesheetSelectors.includes(className2)}));props=_objectSpread(_objectSpread({},properties),{},{className:createClassNameString(className)||void 0,style:createStyleObject(properties.className,Object.assign({},properties.style,style),stylesheet)});}var children=childrenCreator(node.children);return React2.createElement(TagName,_extends({key},props),children)}}var checkForListedLanguage_default=function(astGenerator,language){var langs=astGenerator.listLanguages();return langs.indexOf(language)!==-1};var _excluded=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function ownKeys2(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols);}return keys}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};i%2?ownKeys2(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys2(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}var newLineRegex=/\n/g;function getNewLines(str){return str.match(newLineRegex)}function getAllLineNumbers(_ref){var lines=_ref.lines,startingLineNumber=_ref.startingLineNumber,style=_ref.style;return lines.map(function(_,i){var number=i+startingLineNumber;return React2.createElement("span",{key:"line-".concat(i),className:"react-syntax-highlighter-line-number",style:typeof style=="function"?style(number):style},"".concat(number,`
`))})}function AllLineNumbers(_ref2){var codeString=_ref2.codeString,codeStyle=_ref2.codeStyle,_ref2$containerStyle=_ref2.containerStyle,containerStyle=_ref2$containerStyle===void 0?{float:"left",paddingRight:"10px"}:_ref2$containerStyle,_ref2$numberStyle=_ref2.numberStyle,numberStyle=_ref2$numberStyle===void 0?{}:_ref2$numberStyle,startingLineNumber=_ref2.startingLineNumber;return React2.createElement("code",{style:Object.assign({},codeStyle,containerStyle)},getAllLineNumbers({lines:codeString.replace(/\n$/,"").split(`
`),style:numberStyle,startingLineNumber}))}function getEmWidthOfNumber(num){return "".concat(num.toString().length,".25em")}function getInlineLineNumber(lineNumber,inlineLineNumberStyle){return {type:"element",tagName:"span",properties:{key:"line-number--".concat(lineNumber),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:inlineLineNumberStyle},children:[{type:"text",value:lineNumber}]}}function assembleLineNumberStyles(lineNumberStyle,lineNumber,largestLineNumber){var defaultLineNumberStyle={display:"inline-block",minWidth:getEmWidthOfNumber(largestLineNumber),paddingRight:"1em",textAlign:"right",userSelect:"none"},customLineNumberStyle=typeof lineNumberStyle=="function"?lineNumberStyle(lineNumber):lineNumberStyle,assembledStyle=_objectSpread2(_objectSpread2({},defaultLineNumberStyle),customLineNumberStyle);return assembledStyle}function createLineElement(_ref3){var children=_ref3.children,lineNumber=_ref3.lineNumber,lineNumberStyle=_ref3.lineNumberStyle,largestLineNumber=_ref3.largestLineNumber,showInlineLineNumbers=_ref3.showInlineLineNumbers,_ref3$lineProps=_ref3.lineProps,lineProps=_ref3$lineProps===void 0?{}:_ref3$lineProps,_ref3$className=_ref3.className,className=_ref3$className===void 0?[]:_ref3$className,showLineNumbers=_ref3.showLineNumbers,wrapLongLines=_ref3.wrapLongLines,properties=typeof lineProps=="function"?lineProps(lineNumber):lineProps;if(properties.className=className,lineNumber&&showInlineLineNumbers){var inlineLineNumberStyle=assembleLineNumberStyles(lineNumberStyle,lineNumber,largestLineNumber);children.unshift(getInlineLineNumber(lineNumber,inlineLineNumberStyle));}return wrapLongLines&showLineNumbers&&(properties.style=_objectSpread2(_objectSpread2({},properties.style),{},{display:"flex"})),{type:"element",tagName:"span",properties,children}}function flattenCodeTree(tree){for(var className=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],newTree=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=0;i<tree.length;i++){var node=tree[i];if(node.type==="text")newTree.push(createLineElement({children:[node],className:_toConsumableArray(new Set(className))}));else if(node.children){var classNames=className.concat(node.properties.className);flattenCodeTree(node.children,classNames).forEach(function(i2){return newTree.push(i2)});}}return newTree}function processLines(codeTree,wrapLines,lineProps,showLineNumbers,showInlineLineNumbers,startingLineNumber,largestLineNumber,lineNumberStyle,wrapLongLines){var _ref4,tree=flattenCodeTree(codeTree.value),newTree=[],lastLineBreakIndex=-1,index=0;function createWrappedLine(children2,lineNumber2){var className=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return createLineElement({children:children2,lineNumber:lineNumber2,lineNumberStyle,largestLineNumber,showInlineLineNumbers,lineProps,className,showLineNumbers,wrapLongLines})}function createUnwrappedLine(children2,lineNumber2){if(showLineNumbers&&lineNumber2&&showInlineLineNumbers){var inlineLineNumberStyle=assembleLineNumberStyles(lineNumberStyle,lineNumber2,largestLineNumber);children2.unshift(getInlineLineNumber(lineNumber2,inlineLineNumberStyle));}return children2}function createLine(children2,lineNumber2){var className=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return wrapLines||className.length>0?createWrappedLine(children2,lineNumber2,className):createUnwrappedLine(children2,lineNumber2)}for(var _loop=function(){var node=tree[index],value=node.children[0].value,newLines=getNewLines(value);if(newLines){var splitValue=value.split(`
`);splitValue.forEach(function(text,i){var lineNumber2=showLineNumbers&&newTree.length+startingLineNumber,newChild={type:"text",value:"".concat(text,`
`)};if(i===0){var _children=tree.slice(lastLineBreakIndex+1,index).concat(createLineElement({children:[newChild],className:node.properties.className})),_line=createLine(_children,lineNumber2);newTree.push(_line);}else if(i===splitValue.length-1){var stringChild=tree[index+1]&&tree[index+1].children&&tree[index+1].children[0],lastLineInPreviousSpan={type:"text",value:"".concat(text)};if(stringChild){var newElem=createLineElement({children:[lastLineInPreviousSpan],className:node.properties.className});tree.splice(index+1,0,newElem);}else {var _children2=[lastLineInPreviousSpan],_line2=createLine(_children2,lineNumber2,node.properties.className);newTree.push(_line2);}}else {var _children3=[newChild],_line3=createLine(_children3,lineNumber2,node.properties.className);newTree.push(_line3);}}),lastLineBreakIndex=index;}index++;};index<tree.length;)_loop();if(lastLineBreakIndex!==tree.length-1){var children=tree.slice(lastLineBreakIndex+1,tree.length);if(children&&children.length){var lineNumber=showLineNumbers&&newTree.length+startingLineNumber,line=createLine(children,lineNumber);newTree.push(line);}}return wrapLines?newTree:(_ref4=[]).concat.apply(_ref4,newTree)}function defaultRenderer(_ref5){var rows=_ref5.rows,stylesheet=_ref5.stylesheet,useInlineStyles=_ref5.useInlineStyles;return rows.map(function(node,i){return createElement({node,stylesheet,useInlineStyles,key:"code-segement".concat(i)})})}function isHighlightJs(astGenerator){return astGenerator&&typeof astGenerator.highlightAuto<"u"}function getCodeTree(_ref6){var astGenerator=_ref6.astGenerator,language=_ref6.language,code=_ref6.code,defaultCodeValue=_ref6.defaultCodeValue;if(isHighlightJs(astGenerator)){var hasLanguage=checkForListedLanguage_default(astGenerator,language);return language==="text"?{value:defaultCodeValue,language:"text"}:hasLanguage?astGenerator.highlight(language,code):astGenerator.highlightAuto(code)}try{return language&&language!=="text"?{value:astGenerator.highlight(code,language)}:{value:defaultCodeValue}}catch{return {value:defaultCodeValue}}}function highlight_default(defaultAstGenerator,defaultStyle){return function(_ref7){var language=_ref7.language,children=_ref7.children,_ref7$style=_ref7.style,style=_ref7$style===void 0?defaultStyle:_ref7$style,_ref7$customStyle=_ref7.customStyle,customStyle=_ref7$customStyle===void 0?{}:_ref7$customStyle,_ref7$codeTagProps=_ref7.codeTagProps,codeTagProps=_ref7$codeTagProps===void 0?{className:language?"language-".concat(language):void 0,style:_objectSpread2(_objectSpread2({},style['code[class*="language-"]']),style['code[class*="language-'.concat(language,'"]')])}:_ref7$codeTagProps,_ref7$useInlineStyles=_ref7.useInlineStyles,useInlineStyles=_ref7$useInlineStyles===void 0?!0:_ref7$useInlineStyles,_ref7$showLineNumbers=_ref7.showLineNumbers,showLineNumbers=_ref7$showLineNumbers===void 0?!1:_ref7$showLineNumbers,_ref7$showInlineLineN=_ref7.showInlineLineNumbers,showInlineLineNumbers=_ref7$showInlineLineN===void 0?!0:_ref7$showInlineLineN,_ref7$startingLineNum=_ref7.startingLineNumber,startingLineNumber=_ref7$startingLineNum===void 0?1:_ref7$startingLineNum,lineNumberContainerStyle=_ref7.lineNumberContainerStyle,_ref7$lineNumberStyle=_ref7.lineNumberStyle,lineNumberStyle=_ref7$lineNumberStyle===void 0?{}:_ref7$lineNumberStyle,wrapLines=_ref7.wrapLines,_ref7$wrapLongLines=_ref7.wrapLongLines,wrapLongLines=_ref7$wrapLongLines===void 0?!1:_ref7$wrapLongLines,_ref7$lineProps=_ref7.lineProps,lineProps=_ref7$lineProps===void 0?{}:_ref7$lineProps,renderer=_ref7.renderer,_ref7$PreTag=_ref7.PreTag,PreTag=_ref7$PreTag===void 0?"pre":_ref7$PreTag,_ref7$CodeTag=_ref7.CodeTag,CodeTag=_ref7$CodeTag===void 0?"code":_ref7$CodeTag,_ref7$code=_ref7.code,code=_ref7$code===void 0?(Array.isArray(children)?children[0]:children)||"":_ref7$code,astGenerator=_ref7.astGenerator,rest=_objectWithoutProperties(_ref7,_excluded);astGenerator=astGenerator||defaultAstGenerator;var allLineNumbers=showLineNumbers?React2.createElement(AllLineNumbers,{containerStyle:lineNumberContainerStyle,codeStyle:codeTagProps.style||{},numberStyle:lineNumberStyle,startingLineNumber,codeString:code}):null,defaultPreStyle=style.hljs||style['pre[class*="language-"]']||{backgroundColor:"#fff"},generatorClassName=isHighlightJs(astGenerator)?"hljs":"prismjs",preProps=useInlineStyles?Object.assign({},rest,{style:Object.assign({},defaultPreStyle,customStyle)}):Object.assign({},rest,{className:rest.className?"".concat(generatorClassName," ").concat(rest.className):generatorClassName,style:Object.assign({},customStyle)});if(wrapLongLines?codeTagProps.style=_objectSpread2(_objectSpread2({},codeTagProps.style),{},{whiteSpace:"pre-wrap"}):codeTagProps.style=_objectSpread2(_objectSpread2({},codeTagProps.style),{},{whiteSpace:"pre"}),!astGenerator)return React2.createElement(PreTag,preProps,allLineNumbers,React2.createElement(CodeTag,codeTagProps,code));(wrapLines===void 0&&renderer||wrapLongLines)&&(wrapLines=!0),renderer=renderer||defaultRenderer;var defaultCodeValue=[{type:"text",value:code}],codeTree=getCodeTree({astGenerator,language,code,defaultCodeValue});codeTree.language===null&&(codeTree.value=defaultCodeValue);var largestLineNumber=codeTree.value.length+startingLineNumber,rows=processLines(codeTree,wrapLines,lineProps,showLineNumbers,showInlineLineNumbers,startingLineNumber,largestLineNumber,lineNumberStyle,wrapLongLines);return React2.createElement(PreTag,preProps,React2.createElement(CodeTag,codeTagProps,!showInlineLineNumbers&&allLineNumbers,renderer({rows,stylesheet:style,useInlineStyles})))}}var import_core=__toESM(require_core()),SyntaxHighlighter=highlight_default(import_core.default,{});SyntaxHighlighter.registerLanguage=function(_,language){return import_core.default.register(language)};SyntaxHighlighter.alias=function(name,aliases){return import_core.default.alias(name,aliases)};var prism_light_default=SyntaxHighlighter;var Container=styled.div(({theme})=>({position:"absolute",bottom:0,right:0,maxWidth:"100%",display:"flex",background:theme.background.content,zIndex:1})),ActionButton=styled.button(({theme})=>({margin:0,border:"0 none",padding:"4px 10px",cursor:"pointer",display:"flex",alignItems:"center",color:theme.color.defaultText,background:theme.background.content,fontSize:12,lineHeight:"16px",fontFamily:theme.typography.fonts.base,fontWeight:theme.typography.weight.bold,borderTop:`1px solid ${theme.appBorderColor}`,borderLeft:`1px solid ${theme.appBorderColor}`,marginLeft:-1,borderRadius:"4px 0 0 0","&:not(:last-child)":{borderRight:`1px solid ${theme.appBorderColor}`},"& + *":{borderLeft:`1px solid ${theme.appBorderColor}`,borderRadius:0},"&:focus":{boxShadow:`${theme.color.secondary} 0 -3px 0 0 inset`,outline:"0 none"}}),({disabled})=>disabled&&{cursor:"not-allowed",opacity:.5});ActionButton.displayName="ActionButton";var ActionBar=({actionItems,...props})=>React2.createElement(Container,{...props},actionItems.map(({title,className,onClick,disabled},index)=>React2.createElement(ActionButton,{key:index,className,onClick,disabled},title)));var GlobalScrollAreaStyles=lazy(()=>import('./GlobalScrollAreaStyles-UY5SB7EJ.mjs')),OverlayScrollbars=lazy(()=>import('./OverlayScrollbars-5S34UOFH.mjs')),Scroller=({horizontal,vertical,...props})=>React2.createElement(Suspense,{fallback:React2.createElement("div",{...props})},React2.createElement(GlobalScrollAreaStyles,null),React2.createElement(OverlayScrollbars,{defer:!0,options:{scrollbars:{autoHide:"leave",visibility:"auto"}},...props})),ScrollArea=styled(Scroller)(({vertical})=>vertical?{overflowY:"auto",height:"100%"}:{overflowY:"hidden"},({horizontal})=>horizontal?{overflowX:"auto",width:"100%"}:{overflowX:"hidden"});ScrollArea.defaultProps={horizontal:!1,vertical:!1};var{navigator,document,window:globalWindow}=global;prism_light_default.registerLanguage("jsextra",js_extras_default);prism_light_default.registerLanguage("jsx",jsx_default);prism_light_default.registerLanguage("json",json_default);prism_light_default.registerLanguage("yml",yaml_default);prism_light_default.registerLanguage("md",markdown_default);prism_light_default.registerLanguage("bash",bash_default);prism_light_default.registerLanguage("css",css_default);prism_light_default.registerLanguage("html",markup_default);prism_light_default.registerLanguage("tsx",tsx_default);prism_light_default.registerLanguage("typescript",typescript_default);prism_light_default.registerLanguage("graphql",graphql_default);var themedSyntax=memoize(2)(theme=>Object.entries(theme.code||{}).reduce((acc,[key,val])=>({...acc,[`* .${key}`]:val}),{})),copyToClipboard=createCopyToClipboardFunction();function createCopyToClipboardFunction(){return navigator?.clipboard?text=>navigator.clipboard.writeText(text):async text=>{let tmp=document.createElement("TEXTAREA"),focus=document.activeElement;tmp.value=text,document.body.appendChild(tmp),tmp.select(),document.execCommand("copy"),document.body.removeChild(tmp),focus.focus();}}var Wrapper=styled.div(({theme})=>({position:"relative",overflow:"hidden",color:theme.color.defaultText}),({theme,bordered})=>bordered?{border:`1px solid ${theme.appBorderColor}`,borderRadius:theme.borderRadius,background:theme.background.content}:{},({showLineNumbers})=>showLineNumbers?{".react-syntax-highlighter-line-number::before":{content:"attr(data-line-number)"}}:{}),UnstyledScroller=({children,className})=>React2.createElement(ScrollArea,{horizontal:!0,vertical:!0,className},children),Scroller2=styled(UnstyledScroller)({position:"relative"},({theme})=>themedSyntax(theme)),Pre=styled.pre(({theme,padded})=>({display:"flex",justifyContent:"flex-start",margin:0,padding:padded?theme.layoutMargin:0})),Code=styled.div(({theme})=>({flex:1,paddingLeft:2,paddingRight:theme.layoutMargin,opacity:1})),processLineNumber=row=>{let children=[...row.children],lineNumberNode=children[0],lineNumber=lineNumberNode.children[0].value,processedLineNumberNode={...lineNumberNode,children:[],properties:{...lineNumberNode.properties,"data-line-number":lineNumber,style:{...lineNumberNode.properties.style,userSelect:"auto"}}};return children[0]=processedLineNumberNode,{...row,children}},defaultRenderer2=({rows,stylesheet,useInlineStyles})=>rows.map((node,i)=>createElement({node:processLineNumber(node),stylesheet,useInlineStyles,key:`code-segement${i}`})),wrapRenderer=(renderer,showLineNumbers)=>showLineNumbers?renderer?({rows,...rest})=>renderer({rows:rows.map(row=>processLineNumber(row)),...rest}):defaultRenderer2:renderer,SyntaxHighlighter2=({children,language="jsx",copyable=!1,bordered=!1,padded=!1,format=!0,formatter=null,className=null,showLineNumbers=!1,...rest})=>{if(typeof children!="string"||!children.trim())return null;let highlightableCode=formatter?formatter(format,children):children.trim(),[copied,setCopied]=useState(!1),onClick=useCallback(e=>{e.preventDefault(),copyToClipboard(highlightableCode).then(()=>{setCopied(!0),globalWindow.setTimeout(()=>setCopied(!1),1500);}).catch(logger.error);},[highlightableCode]),renderer=wrapRenderer(rest.renderer,showLineNumbers);return React2.createElement(Wrapper,{bordered,padded,showLineNumbers,className},React2.createElement(Scroller2,null,React2.createElement(prism_light_default,{padded:padded||bordered,language,showLineNumbers,showInlineLineNumbers:showLineNumbers,useInlineStyles:!1,PreTag:Pre,CodeTag:Code,lineNumberContainerStyle:{},...rest,renderer},highlightableCode)),copyable?React2.createElement(ActionBar,{actionItems:[{title:copied?"Copied":"Copy",onClick}]}):null)};SyntaxHighlighter2.registerLanguage=(...args)=>prism_light_default.registerLanguage(...args);var syntaxhighlighter_default=SyntaxHighlighter2;

export { ActionBar, ScrollArea, SyntaxHighlighter2 as SyntaxHighlighter, createCopyToClipboardFunction, syntaxhighlighter_default };
