@redis-ui/components 51.27.0 → 51.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/CodeBlock/CodeBlock.cjs +29 -14
  2. package/dist/CodeBlock/CodeBlock.js +29 -14
  3. package/dist/CodeBlock/CodeBlock.style.d.ts +4 -3
  4. package/dist/CodeBlock/CodeBlock.types.cjs +7 -0
  5. package/dist/CodeBlock/CodeBlock.types.d.ts +4 -0
  6. package/dist/CodeBlock/CodeBlock.types.js +7 -1
  7. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.cjs +29 -0
  8. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.constants.cjs +34 -0
  9. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.constants.d.ts +25 -0
  10. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.constants.js +32 -0
  11. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.d.ts +6 -0
  12. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.js +29 -0
  13. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.types.d.ts +10 -0
  14. package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.types.js +1 -0
  15. package/dist/index.cjs +1 -0
  16. package/dist/index.js +2 -2
  17. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.cjs +8 -0
  18. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
  19. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.cjs +7 -0
  20. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
  21. package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.cjs +12 -0
  22. package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
  23. package/dist/node_modules/@babel/runtime/helpers/esm/extends.cjs +17 -0
  24. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  25. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.cjs +6 -0
  26. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
  27. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.cjs +6 -0
  28. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +6 -0
  29. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.cjs +13 -0
  30. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +13 -0
  31. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.cjs +12 -0
  32. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  33. package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.cjs +10 -0
  34. package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
  35. package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.cjs +14 -0
  36. package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
  37. package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.cjs +9 -0
  38. package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
  39. package/dist/node_modules/@babel/runtime/helpers/esm/typeof.cjs +16 -0
  40. package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
  41. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.cjs +11 -0
  42. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
  43. package/dist/node_modules/character-entities-legacy/index.cjs +116 -0
  44. package/dist/node_modules/character-entities-legacy/index.js +116 -0
  45. package/dist/node_modules/character-reference-invalid/index.cjs +38 -0
  46. package/dist/node_modules/character-reference-invalid/index.js +38 -0
  47. package/dist/node_modules/comma-separated-tokens/index.cjs +43 -0
  48. package/dist/node_modules/comma-separated-tokens/index.js +43 -0
  49. package/dist/node_modules/decode-named-character-reference/index.dom.cjs +15 -0
  50. package/dist/node_modules/decode-named-character-reference/index.dom.js +15 -0
  51. package/dist/node_modules/hast-util-parse-selector/lib/index.cjs +76 -0
  52. package/dist/node_modules/hast-util-parse-selector/lib/index.js +76 -0
  53. package/dist/node_modules/hastscript/lib/create-h.cjs +262 -0
  54. package/dist/node_modules/hastscript/lib/create-h.js +262 -0
  55. package/dist/node_modules/hastscript/lib/index.cjs +21 -0
  56. package/dist/node_modules/hastscript/lib/index.js +21 -0
  57. package/dist/node_modules/hastscript/lib/svg-case-sensitive-tag-names.cjs +49 -0
  58. package/dist/node_modules/hastscript/lib/svg-case-sensitive-tag-names.js +49 -0
  59. package/dist/node_modules/is-alphabetical/index.cjs +14 -0
  60. package/dist/node_modules/is-alphabetical/index.js +14 -0
  61. package/dist/node_modules/is-alphanumerical/index.cjs +15 -0
  62. package/dist/node_modules/is-alphanumerical/index.js +15 -0
  63. package/dist/node_modules/is-decimal/index.cjs +14 -0
  64. package/dist/node_modules/is-decimal/index.js +14 -0
  65. package/dist/node_modules/is-hexadecimal/index.cjs +14 -0
  66. package/dist/node_modules/is-hexadecimal/index.js +14 -0
  67. package/dist/node_modules/parse-entities/lib/index.cjs +232 -0
  68. package/dist/node_modules/parse-entities/lib/index.js +232 -0
  69. package/dist/node_modules/property-information/index.cjs +27 -0
  70. package/dist/node_modules/property-information/index.js +26 -0
  71. package/dist/node_modules/property-information/lib/aria.cjs +60 -0
  72. package/dist/node_modules/property-information/lib/aria.js +61 -0
  73. package/dist/node_modules/property-information/lib/find.cjs +81 -0
  74. package/dist/node_modules/property-information/lib/find.js +81 -0
  75. package/dist/node_modules/property-information/lib/html.cjs +326 -0
  76. package/dist/node_modules/property-information/lib/html.js +326 -0
  77. package/dist/node_modules/property-information/lib/normalize.cjs +15 -0
  78. package/dist/node_modules/property-information/lib/normalize.js +15 -0
  79. package/dist/node_modules/property-information/lib/svg.cjs +564 -0
  80. package/dist/node_modules/property-information/lib/svg.js +564 -0
  81. package/dist/node_modules/property-information/lib/util/case-insensitive-transform.cjs +15 -0
  82. package/dist/node_modules/property-information/lib/util/case-insensitive-transform.js +15 -0
  83. package/dist/node_modules/property-information/lib/util/case-sensitive-transform.cjs +14 -0
  84. package/dist/node_modules/property-information/lib/util/case-sensitive-transform.js +14 -0
  85. package/dist/node_modules/property-information/lib/util/create.cjs +53 -0
  86. package/dist/node_modules/property-information/lib/util/create.js +53 -0
  87. package/dist/node_modules/property-information/lib/util/defined-info.cjs +49 -0
  88. package/dist/node_modules/property-information/lib/util/defined-info.js +49 -0
  89. package/dist/node_modules/property-information/lib/util/info.cjs +33 -0
  90. package/dist/node_modules/property-information/lib/util/info.js +33 -0
  91. package/dist/node_modules/property-information/lib/util/merge.cjs +26 -0
  92. package/dist/node_modules/property-information/lib/util/merge.js +26 -0
  93. package/dist/node_modules/property-information/lib/util/schema.cjs +27 -0
  94. package/dist/node_modules/property-information/lib/util/schema.js +27 -0
  95. package/dist/node_modules/property-information/lib/util/types.cjs +35 -0
  96. package/dist/node_modules/property-information/lib/util/types.js +24 -0
  97. package/dist/node_modules/property-information/lib/xlink.cjs +18 -0
  98. package/dist/node_modules/property-information/lib/xlink.js +19 -0
  99. package/dist/node_modules/property-information/lib/xml.cjs +14 -0
  100. package/dist/node_modules/property-information/lib/xml.js +15 -0
  101. package/dist/node_modules/property-information/lib/xmlns.cjs +14 -0
  102. package/dist/node_modules/property-information/lib/xmlns.js +14 -0
  103. package/dist/node_modules/react-syntax-highlighter/dist/esm/checkForListedLanguage.cjs +6 -0
  104. package/dist/node_modules/react-syntax-highlighter/dist/esm/checkForListedLanguage.js +6 -0
  105. package/dist/node_modules/react-syntax-highlighter/dist/esm/create-element.cjs +183 -0
  106. package/dist/node_modules/react-syntax-highlighter/dist/esm/create-element.js +181 -0
  107. package/dist/node_modules/react-syntax-highlighter/dist/esm/highlight.cjs +308 -0
  108. package/dist/node_modules/react-syntax-highlighter/dist/esm/highlight.js +306 -0
  109. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/bash.cjs +4 -0
  110. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/bash.js +5 -0
  111. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/json.cjs +4 -0
  112. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/json.js +5 -0
  113. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/python.cjs +4 -0
  114. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/python.js +5 -0
  115. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/typescript.cjs +4 -0
  116. package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/typescript.js +5 -0
  117. package/dist/node_modules/react-syntax-highlighter/dist/esm/prism-light.cjs +12 -0
  118. package/dist/node_modules/react-syntax-highlighter/dist/esm/prism-light.js +12 -0
  119. package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vs.cjs +121 -0
  120. package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vs.js +121 -0
  121. package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.cjs +147 -0
  122. package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js +147 -0
  123. package/dist/node_modules/refractor/lang/bash.cjs +190 -0
  124. package/dist/node_modules/refractor/lang/bash.js +190 -0
  125. package/dist/node_modules/refractor/lang/clike.cjs +37 -0
  126. package/dist/node_modules/refractor/lang/clike.js +37 -0
  127. package/dist/node_modules/refractor/lang/javascript.cjs +122 -0
  128. package/dist/node_modules/refractor/lang/javascript.js +122 -0
  129. package/dist/node_modules/refractor/lang/json.cjs +36 -0
  130. package/dist/node_modules/refractor/lang/json.js +36 -0
  131. package/dist/node_modules/refractor/lang/python.cjs +71 -0
  132. package/dist/node_modules/refractor/lang/python.js +71 -0
  133. package/dist/node_modules/refractor/lang/typescript.cjs +55 -0
  134. package/dist/node_modules/refractor/lang/typescript.js +55 -0
  135. package/dist/node_modules/refractor/lib/core.cjs +214 -0
  136. package/dist/node_modules/refractor/lib/core.js +214 -0
  137. package/dist/node_modules/refractor/lib/prism-core.cjs +595 -0
  138. package/dist/node_modules/refractor/lib/prism-core.js +595 -0
  139. package/dist/node_modules/space-separated-tokens/index.cjs +15 -0
  140. package/dist/node_modules/space-separated-tokens/index.js +15 -0
  141. package/package.json +3 -1
  142. package/skills/redis-ui-components/references/CodeBlock.md +23 -5
@@ -0,0 +1,183 @@
1
+ const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_defineProperty = require("../../../@babel/runtime/helpers/esm/defineProperty.cjs");
3
+ const require_extends = require("../../../@babel/runtime/helpers/esm/extends.cjs");
4
+ let react = require("react");
5
+ react = require_runtime.__toESM(react);
6
+ //#region ../../node_modules/react-syntax-highlighter/dist/esm/create-element.js
7
+ function ownKeys(e, r) {
8
+ var t = Object.keys(e);
9
+ if (Object.getOwnPropertySymbols) {
10
+ var o = Object.getOwnPropertySymbols(e);
11
+ r && (o = o.filter(function(r) {
12
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
13
+ })), t.push.apply(t, o);
14
+ }
15
+ return t;
16
+ }
17
+ function _objectSpread(e) {
18
+ for (var r = 1; r < arguments.length; r++) {
19
+ var t = null != arguments[r] ? arguments[r] : {};
20
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
21
+ require_defineProperty._defineProperty(e, r, t[r]);
22
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
23
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
24
+ });
25
+ }
26
+ return e;
27
+ }
28
+ function powerSetPermutations(arr) {
29
+ var arrLength = arr.length;
30
+ if (arrLength === 0 || arrLength === 1) return arr;
31
+ if (arrLength === 2) return [
32
+ arr[0],
33
+ arr[1],
34
+ "".concat(arr[0], ".").concat(arr[1]),
35
+ "".concat(arr[1], ".").concat(arr[0])
36
+ ];
37
+ if (arrLength === 3) return [
38
+ arr[0],
39
+ arr[1],
40
+ arr[2],
41
+ "".concat(arr[0], ".").concat(arr[1]),
42
+ "".concat(arr[0], ".").concat(arr[2]),
43
+ "".concat(arr[1], ".").concat(arr[0]),
44
+ "".concat(arr[1], ".").concat(arr[2]),
45
+ "".concat(arr[2], ".").concat(arr[0]),
46
+ "".concat(arr[2], ".").concat(arr[1]),
47
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]),
48
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]),
49
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]),
50
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]),
51
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]),
52
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])
53
+ ];
54
+ if (arrLength >= 4) return [
55
+ arr[0],
56
+ arr[1],
57
+ arr[2],
58
+ arr[3],
59
+ "".concat(arr[0], ".").concat(arr[1]),
60
+ "".concat(arr[0], ".").concat(arr[2]),
61
+ "".concat(arr[0], ".").concat(arr[3]),
62
+ "".concat(arr[1], ".").concat(arr[0]),
63
+ "".concat(arr[1], ".").concat(arr[2]),
64
+ "".concat(arr[1], ".").concat(arr[3]),
65
+ "".concat(arr[2], ".").concat(arr[0]),
66
+ "".concat(arr[2], ".").concat(arr[1]),
67
+ "".concat(arr[2], ".").concat(arr[3]),
68
+ "".concat(arr[3], ".").concat(arr[0]),
69
+ "".concat(arr[3], ".").concat(arr[1]),
70
+ "".concat(arr[3], ".").concat(arr[2]),
71
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]),
72
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]),
73
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]),
74
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]),
75
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]),
76
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]),
77
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]),
78
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]),
79
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]),
80
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]),
81
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]),
82
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]),
83
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]),
84
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]),
85
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0]),
86
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]),
87
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]),
88
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]),
89
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]),
90
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]),
91
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]),
92
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]),
93
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]),
94
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]),
95
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]),
96
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]),
97
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]),
98
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]),
99
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]),
100
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]),
101
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]),
102
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]),
103
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]),
104
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]),
105
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]),
106
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]),
107
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]),
108
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]),
109
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]),
110
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]),
111
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]),
112
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]),
113
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]),
114
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]),
115
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]),
116
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]),
117
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]),
118
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])
119
+ ];
120
+ }
121
+ var classNameCombinations = {};
122
+ function getClassNameCombinations(classNames) {
123
+ if (classNames.length === 0 || classNames.length === 1) return classNames;
124
+ var key = classNames.join(".");
125
+ if (!classNameCombinations[key]) classNameCombinations[key] = powerSetPermutations(classNames);
126
+ return classNameCombinations[key];
127
+ }
128
+ function createStyleObject(classNames) {
129
+ var elementStyle = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
130
+ var stylesheet = arguments.length > 2 ? arguments[2] : void 0;
131
+ return getClassNameCombinations(classNames.filter(function(className) {
132
+ return className !== "token";
133
+ })).reduce(function(styleObject, className) {
134
+ return _objectSpread(_objectSpread({}, styleObject), stylesheet[className]);
135
+ }, elementStyle);
136
+ }
137
+ function createClassNameString(classNames) {
138
+ return classNames.join(" ");
139
+ }
140
+ function createChildren(stylesheet, useInlineStyles) {
141
+ var childrenCount = 0;
142
+ return function(children) {
143
+ childrenCount += 1;
144
+ return children.map(function(child, i) {
145
+ return createElement({
146
+ node: child,
147
+ stylesheet,
148
+ useInlineStyles,
149
+ key: "code-segment-".concat(childrenCount, "-").concat(i)
150
+ });
151
+ });
152
+ };
153
+ }
154
+ function createElement(_ref) {
155
+ var node = _ref.node, stylesheet = _ref.stylesheet, _ref$style = _ref.style, style = _ref$style === void 0 ? {} : _ref$style, useInlineStyles = _ref.useInlineStyles, key = _ref.key;
156
+ var properties = node.properties, type = node.type, TagName = node.tagName, value = node.value;
157
+ if (type === "text") return value;
158
+ else if (TagName) {
159
+ var childrenCreator = createChildren(stylesheet, useInlineStyles);
160
+ var props;
161
+ if (!useInlineStyles) props = _objectSpread(_objectSpread({}, properties), {}, { className: createClassNameString(properties.className) });
162
+ else {
163
+ var allStylesheetSelectors = Object.keys(stylesheet).reduce(function(classes, selector) {
164
+ selector.split(".").forEach(function(className) {
165
+ if (!classes.includes(className)) classes.push(className);
166
+ });
167
+ return classes;
168
+ }, []);
169
+ var startingClassName = properties.className && properties.className.includes("token") ? ["token"] : [];
170
+ var className = properties.className && startingClassName.concat(properties.className.filter(function(className) {
171
+ return !allStylesheetSelectors.includes(className);
172
+ }));
173
+ props = _objectSpread(_objectSpread({}, properties), {}, {
174
+ className: createClassNameString(className) || void 0,
175
+ style: createStyleObject(properties.className, Object.assign({}, properties.style, style), stylesheet)
176
+ });
177
+ }
178
+ var children = childrenCreator(node.children);
179
+ return /*#__PURE__*/ react.default.createElement(TagName, require_extends._extends({ key }, props), children);
180
+ }
181
+ }
182
+ //#endregion
183
+ exports.default = createElement;
@@ -0,0 +1,181 @@
1
+ import { _defineProperty } from "../../../@babel/runtime/helpers/esm/defineProperty.js";
2
+ import { _extends } from "../../../@babel/runtime/helpers/esm/extends.js";
3
+ import React from "react";
4
+ //#region ../../node_modules/react-syntax-highlighter/dist/esm/create-element.js
5
+ function ownKeys(e, r) {
6
+ var t = Object.keys(e);
7
+ if (Object.getOwnPropertySymbols) {
8
+ var o = Object.getOwnPropertySymbols(e);
9
+ r && (o = o.filter(function(r) {
10
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
11
+ })), t.push.apply(t, o);
12
+ }
13
+ return t;
14
+ }
15
+ function _objectSpread(e) {
16
+ for (var r = 1; r < arguments.length; r++) {
17
+ var t = null != arguments[r] ? arguments[r] : {};
18
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
19
+ _defineProperty(e, r, t[r]);
20
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
21
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
22
+ });
23
+ }
24
+ return e;
25
+ }
26
+ function powerSetPermutations(arr) {
27
+ var arrLength = arr.length;
28
+ if (arrLength === 0 || arrLength === 1) return arr;
29
+ if (arrLength === 2) return [
30
+ arr[0],
31
+ arr[1],
32
+ "".concat(arr[0], ".").concat(arr[1]),
33
+ "".concat(arr[1], ".").concat(arr[0])
34
+ ];
35
+ if (arrLength === 3) return [
36
+ arr[0],
37
+ arr[1],
38
+ arr[2],
39
+ "".concat(arr[0], ".").concat(arr[1]),
40
+ "".concat(arr[0], ".").concat(arr[2]),
41
+ "".concat(arr[1], ".").concat(arr[0]),
42
+ "".concat(arr[1], ".").concat(arr[2]),
43
+ "".concat(arr[2], ".").concat(arr[0]),
44
+ "".concat(arr[2], ".").concat(arr[1]),
45
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]),
46
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]),
47
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]),
48
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]),
49
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]),
50
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])
51
+ ];
52
+ if (arrLength >= 4) return [
53
+ arr[0],
54
+ arr[1],
55
+ arr[2],
56
+ arr[3],
57
+ "".concat(arr[0], ".").concat(arr[1]),
58
+ "".concat(arr[0], ".").concat(arr[2]),
59
+ "".concat(arr[0], ".").concat(arr[3]),
60
+ "".concat(arr[1], ".").concat(arr[0]),
61
+ "".concat(arr[1], ".").concat(arr[2]),
62
+ "".concat(arr[1], ".").concat(arr[3]),
63
+ "".concat(arr[2], ".").concat(arr[0]),
64
+ "".concat(arr[2], ".").concat(arr[1]),
65
+ "".concat(arr[2], ".").concat(arr[3]),
66
+ "".concat(arr[3], ".").concat(arr[0]),
67
+ "".concat(arr[3], ".").concat(arr[1]),
68
+ "".concat(arr[3], ".").concat(arr[2]),
69
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]),
70
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]),
71
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]),
72
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]),
73
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]),
74
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]),
75
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]),
76
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]),
77
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]),
78
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]),
79
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]),
80
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]),
81
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]),
82
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]),
83
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0]),
84
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]),
85
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]),
86
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]),
87
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]),
88
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]),
89
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]),
90
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]),
91
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]),
92
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]),
93
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]),
94
+ "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]),
95
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]),
96
+ "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]),
97
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]),
98
+ "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]),
99
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]),
100
+ "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]),
101
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]),
102
+ "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]),
103
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]),
104
+ "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]),
105
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]),
106
+ "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]),
107
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]),
108
+ "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]),
109
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]),
110
+ "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]),
111
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]),
112
+ "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]),
113
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]),
114
+ "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]),
115
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]),
116
+ "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])
117
+ ];
118
+ }
119
+ var classNameCombinations = {};
120
+ function getClassNameCombinations(classNames) {
121
+ if (classNames.length === 0 || classNames.length === 1) return classNames;
122
+ var key = classNames.join(".");
123
+ if (!classNameCombinations[key]) classNameCombinations[key] = powerSetPermutations(classNames);
124
+ return classNameCombinations[key];
125
+ }
126
+ function createStyleObject(classNames) {
127
+ var elementStyle = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
128
+ var stylesheet = arguments.length > 2 ? arguments[2] : void 0;
129
+ return getClassNameCombinations(classNames.filter(function(className) {
130
+ return className !== "token";
131
+ })).reduce(function(styleObject, className) {
132
+ return _objectSpread(_objectSpread({}, styleObject), stylesheet[className]);
133
+ }, elementStyle);
134
+ }
135
+ function createClassNameString(classNames) {
136
+ return classNames.join(" ");
137
+ }
138
+ function createChildren(stylesheet, useInlineStyles) {
139
+ var childrenCount = 0;
140
+ return function(children) {
141
+ childrenCount += 1;
142
+ return children.map(function(child, i) {
143
+ return createElement$1({
144
+ node: child,
145
+ stylesheet,
146
+ useInlineStyles,
147
+ key: "code-segment-".concat(childrenCount, "-").concat(i)
148
+ });
149
+ });
150
+ };
151
+ }
152
+ function createElement$1(_ref) {
153
+ var node = _ref.node, stylesheet = _ref.stylesheet, _ref$style = _ref.style, style = _ref$style === void 0 ? {} : _ref$style, useInlineStyles = _ref.useInlineStyles, key = _ref.key;
154
+ var properties = node.properties, type = node.type, TagName = node.tagName, value = node.value;
155
+ if (type === "text") return value;
156
+ else if (TagName) {
157
+ var childrenCreator = createChildren(stylesheet, useInlineStyles);
158
+ var props;
159
+ if (!useInlineStyles) props = _objectSpread(_objectSpread({}, properties), {}, { className: createClassNameString(properties.className) });
160
+ else {
161
+ var allStylesheetSelectors = Object.keys(stylesheet).reduce(function(classes, selector) {
162
+ selector.split(".").forEach(function(className) {
163
+ if (!classes.includes(className)) classes.push(className);
164
+ });
165
+ return classes;
166
+ }, []);
167
+ var startingClassName = properties.className && properties.className.includes("token") ? ["token"] : [];
168
+ var className = properties.className && startingClassName.concat(properties.className.filter(function(className) {
169
+ return !allStylesheetSelectors.includes(className);
170
+ }));
171
+ props = _objectSpread(_objectSpread({}, properties), {}, {
172
+ className: createClassNameString(className) || void 0,
173
+ style: createStyleObject(properties.className, Object.assign({}, properties.style, style), stylesheet)
174
+ });
175
+ }
176
+ var children = childrenCreator(node.children);
177
+ return /*#__PURE__*/ React.createElement(TagName, _extends({ key }, props), children);
178
+ }
179
+ }
180
+ //#endregion
181
+ export { createElement$1 as default };
@@ -0,0 +1,308 @@
1
+ const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_objectWithoutProperties = require("../../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs");
3
+ const require_toConsumableArray = require("../../../@babel/runtime/helpers/esm/toConsumableArray.cjs");
4
+ const require_defineProperty = require("../../../@babel/runtime/helpers/esm/defineProperty.cjs");
5
+ const require_create_element = require("./create-element.cjs");
6
+ const require_checkForListedLanguage = require("./checkForListedLanguage.cjs");
7
+ let react = require("react");
8
+ react = require_runtime.__toESM(react);
9
+ //#region ../../node_modules/react-syntax-highlighter/dist/esm/highlight.js
10
+ var _excluded = [
11
+ "language",
12
+ "children",
13
+ "style",
14
+ "customStyle",
15
+ "codeTagProps",
16
+ "useInlineStyles",
17
+ "showLineNumbers",
18
+ "showInlineLineNumbers",
19
+ "startingLineNumber",
20
+ "lineNumberContainerStyle",
21
+ "lineNumberStyle",
22
+ "wrapLines",
23
+ "wrapLongLines",
24
+ "lineProps",
25
+ "renderer",
26
+ "PreTag",
27
+ "CodeTag",
28
+ "code",
29
+ "astGenerator"
30
+ ];
31
+ function ownKeys(e, r) {
32
+ var t = Object.keys(e);
33
+ if (Object.getOwnPropertySymbols) {
34
+ var o = Object.getOwnPropertySymbols(e);
35
+ r && (o = o.filter(function(r) {
36
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
37
+ })), t.push.apply(t, o);
38
+ }
39
+ return t;
40
+ }
41
+ function _objectSpread(e) {
42
+ for (var r = 1; r < arguments.length; r++) {
43
+ var t = null != arguments[r] ? arguments[r] : {};
44
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
45
+ require_defineProperty._defineProperty(e, r, t[r]);
46
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
47
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
48
+ });
49
+ }
50
+ return e;
51
+ }
52
+ var newLineRegex = /\n/g;
53
+ function getNewLines(str) {
54
+ return str.match(newLineRegex);
55
+ }
56
+ function getAllLineNumbers(_ref) {
57
+ var lines = _ref.lines, startingLineNumber = _ref.startingLineNumber, style = _ref.style;
58
+ return lines.map(function(_, i) {
59
+ var number = i + startingLineNumber;
60
+ return /*#__PURE__*/ react.default.createElement("span", {
61
+ key: "line-".concat(i),
62
+ className: "react-syntax-highlighter-line-number",
63
+ style: typeof style === "function" ? style(number) : style
64
+ }, "".concat(number, "\n"));
65
+ });
66
+ }
67
+ function AllLineNumbers(_ref2) {
68
+ var codeString = _ref2.codeString, codeStyle = _ref2.codeStyle, _ref2$containerStyle = _ref2.containerStyle, containerStyle = _ref2$containerStyle === void 0 ? {
69
+ "float": "left",
70
+ paddingRight: "10px"
71
+ } : _ref2$containerStyle, _ref2$numberStyle = _ref2.numberStyle, numberStyle = _ref2$numberStyle === void 0 ? {} : _ref2$numberStyle, startingLineNumber = _ref2.startingLineNumber;
72
+ return /*#__PURE__*/ react.default.createElement("code", { style: Object.assign({}, codeStyle, containerStyle) }, getAllLineNumbers({
73
+ lines: codeString.replace(/\n$/, "").split("\n"),
74
+ style: numberStyle,
75
+ startingLineNumber
76
+ }));
77
+ }
78
+ function getEmWidthOfNumber(num) {
79
+ return "".concat(num.toString().length, ".25em");
80
+ }
81
+ function getInlineLineNumber(lineNumber, inlineLineNumberStyle) {
82
+ return {
83
+ type: "element",
84
+ tagName: "span",
85
+ properties: {
86
+ key: "line-number--".concat(lineNumber),
87
+ className: [
88
+ "comment",
89
+ "linenumber",
90
+ "react-syntax-highlighter-line-number"
91
+ ],
92
+ style: inlineLineNumberStyle
93
+ },
94
+ children: [{
95
+ type: "text",
96
+ value: lineNumber
97
+ }]
98
+ };
99
+ }
100
+ function assembleLineNumberStyles(lineNumberStyle, lineNumber, largestLineNumber) {
101
+ var defaultLineNumberStyle = {
102
+ display: "inline-block",
103
+ minWidth: getEmWidthOfNumber(largestLineNumber),
104
+ paddingRight: "1em",
105
+ textAlign: "right",
106
+ userSelect: "none"
107
+ };
108
+ var customLineNumberStyle = typeof lineNumberStyle === "function" ? lineNumberStyle(lineNumber) : lineNumberStyle;
109
+ return _objectSpread(_objectSpread({}, defaultLineNumberStyle), customLineNumberStyle);
110
+ }
111
+ function createLineElement(_ref3) {
112
+ 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, _ref3$wrapLines = _ref3.wrapLines;
113
+ var properties = (_ref3$wrapLines === void 0 ? false : _ref3$wrapLines) ? _objectSpread({}, typeof lineProps === "function" ? lineProps(lineNumber) : lineProps) : {};
114
+ properties["className"] = properties["className"] ? [].concat(require_toConsumableArray._toConsumableArray(properties["className"].trim().split(/\s+/)), require_toConsumableArray._toConsumableArray(className)) : className;
115
+ if (lineNumber && showInlineLineNumbers) {
116
+ var inlineLineNumberStyle = assembleLineNumberStyles(lineNumberStyle, lineNumber, largestLineNumber);
117
+ children.unshift(getInlineLineNumber(lineNumber, inlineLineNumberStyle));
118
+ }
119
+ if (wrapLongLines & showLineNumbers) properties.style = _objectSpread({ display: "flex" }, properties.style);
120
+ return {
121
+ type: "element",
122
+ tagName: "span",
123
+ properties,
124
+ children
125
+ };
126
+ }
127
+ function flattenCodeTree(tree) {
128
+ var className = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
129
+ var newTree = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
130
+ if (tree.length === void 0) tree = [tree];
131
+ for (var i = 0; i < tree.length; i++) {
132
+ var node = tree[i];
133
+ if (node.type === "text") newTree.push(createLineElement({
134
+ children: [node],
135
+ className: require_toConsumableArray._toConsumableArray(new Set(className))
136
+ }));
137
+ else if (node.children) {
138
+ var _node$properties;
139
+ var classNames = className.concat(((_node$properties = node.properties) === null || _node$properties === void 0 ? void 0 : _node$properties.className) || []);
140
+ flattenCodeTree(node.children, classNames).forEach(function(i) {
141
+ return newTree.push(i);
142
+ });
143
+ }
144
+ }
145
+ return newTree;
146
+ }
147
+ function processLines(codeTree, wrapLines, lineProps, showLineNumbers, showInlineLineNumbers, startingLineNumber, largestLineNumber, lineNumberStyle, wrapLongLines) {
148
+ var _ref4;
149
+ var tree = flattenCodeTree(codeTree.value);
150
+ var newTree = [];
151
+ var lastLineBreakIndex = -1;
152
+ var index = 0;
153
+ function createWrappedLine(children, lineNumber) {
154
+ return createLineElement({
155
+ children,
156
+ lineNumber,
157
+ lineNumberStyle,
158
+ largestLineNumber,
159
+ showInlineLineNumbers,
160
+ lineProps,
161
+ className: arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [],
162
+ showLineNumbers,
163
+ wrapLongLines,
164
+ wrapLines
165
+ });
166
+ }
167
+ function createUnwrappedLine(children, lineNumber) {
168
+ if (showLineNumbers && lineNumber && showInlineLineNumbers) {
169
+ var inlineLineNumberStyle = assembleLineNumberStyles(lineNumberStyle, lineNumber, largestLineNumber);
170
+ children.unshift(getInlineLineNumber(lineNumber, inlineLineNumberStyle));
171
+ }
172
+ return children;
173
+ }
174
+ function createLine(children, lineNumber) {
175
+ var className = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
176
+ return wrapLines || className.length > 0 ? createWrappedLine(children, lineNumber, className) : createUnwrappedLine(children, lineNumber);
177
+ }
178
+ var _loop = function _loop() {
179
+ var node = tree[index];
180
+ var value = node.children[0].value;
181
+ if (getNewLines(value)) {
182
+ var splitValue = value.split("\n");
183
+ splitValue.forEach(function(text, i) {
184
+ var lineNumber = showLineNumbers && newTree.length + startingLineNumber;
185
+ var newChild = {
186
+ type: "text",
187
+ value: "".concat(text, "\n")
188
+ };
189
+ if (i === 0) {
190
+ var _line = createLine(tree.slice(lastLineBreakIndex + 1, index).concat(createLineElement({
191
+ children: [newChild],
192
+ className: node.properties.className
193
+ })), lineNumber);
194
+ newTree.push(_line);
195
+ } else if (i === splitValue.length - 1) {
196
+ var stringChild = tree[index + 1] && tree[index + 1].children && tree[index + 1].children[0];
197
+ var lastLineInPreviousSpan = {
198
+ type: "text",
199
+ value: "".concat(text)
200
+ };
201
+ if (stringChild) {
202
+ var newElem = createLineElement({
203
+ children: [lastLineInPreviousSpan],
204
+ className: node.properties.className
205
+ });
206
+ tree.splice(index + 1, 0, newElem);
207
+ } else {
208
+ var _line2 = createLine([lastLineInPreviousSpan], lineNumber, node.properties.className);
209
+ newTree.push(_line2);
210
+ }
211
+ } else {
212
+ var _line3 = createLine([newChild], lineNumber, node.properties.className);
213
+ newTree.push(_line3);
214
+ }
215
+ });
216
+ lastLineBreakIndex = index;
217
+ }
218
+ index++;
219
+ };
220
+ while (index < tree.length) _loop();
221
+ if (lastLineBreakIndex !== tree.length - 1) {
222
+ var children = tree.slice(lastLineBreakIndex + 1, tree.length);
223
+ if (children && children.length) {
224
+ var line = createLine(children, showLineNumbers && newTree.length + startingLineNumber);
225
+ newTree.push(line);
226
+ }
227
+ }
228
+ return wrapLines ? newTree : (_ref4 = []).concat.apply(_ref4, newTree);
229
+ }
230
+ function defaultRenderer(_ref5) {
231
+ var rows = _ref5.rows, stylesheet = _ref5.stylesheet, useInlineStyles = _ref5.useInlineStyles;
232
+ return rows.map(function(node, i) {
233
+ return require_create_element.default({
234
+ node,
235
+ stylesheet,
236
+ useInlineStyles,
237
+ key: "code-segment-".concat(i)
238
+ });
239
+ });
240
+ }
241
+ function isHighlightJs(astGenerator) {
242
+ return astGenerator && typeof astGenerator.highlightAuto !== "undefined";
243
+ }
244
+ function getCodeTree(_ref6) {
245
+ var astGenerator = _ref6.astGenerator, language = _ref6.language, code = _ref6.code, defaultCodeValue = _ref6.defaultCodeValue;
246
+ if (isHighlightJs(astGenerator)) {
247
+ var hasLanguage = require_checkForListedLanguage.default(astGenerator, language);
248
+ if (language === "text") return {
249
+ value: defaultCodeValue,
250
+ language: "text"
251
+ };
252
+ else if (hasLanguage) return astGenerator.highlight(language, code);
253
+ else return astGenerator.highlightAuto(code);
254
+ }
255
+ try {
256
+ return language && language !== "text" ? { value: astGenerator.highlight(code, language) } : { value: defaultCodeValue };
257
+ } catch (e) {
258
+ return { value: defaultCodeValue };
259
+ }
260
+ }
261
+ function highlight_default(defaultAstGenerator, defaultStyle) {
262
+ return function SyntaxHighlighter(_ref7) {
263
+ var _code$match$length, _code$match;
264
+ 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 ? {
265
+ className: language ? "language-".concat(language) : void 0,
266
+ style: _objectSpread(_objectSpread({}, style["code[class*=\"language-\"]"]), style["code[class*=\"language-".concat(language, "\"]")])
267
+ } : _ref7$codeTagProps, _ref7$useInlineStyles = _ref7.useInlineStyles, useInlineStyles = _ref7$useInlineStyles === void 0 ? true : _ref7$useInlineStyles, _ref7$showLineNumbers = _ref7.showLineNumbers, showLineNumbers = _ref7$showLineNumbers === void 0 ? false : _ref7$showLineNumbers, _ref7$showInlineLineN = _ref7.showInlineLineNumbers, showInlineLineNumbers = _ref7$showInlineLineN === void 0 ? true : _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 ? false : _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 = require_objectWithoutProperties._objectWithoutProperties(_ref7, _excluded);
268
+ astGenerator = astGenerator || defaultAstGenerator;
269
+ var allLineNumbers = showLineNumbers ? /*#__PURE__*/ react.default.createElement(AllLineNumbers, {
270
+ containerStyle: lineNumberContainerStyle,
271
+ codeStyle: codeTagProps.style || {},
272
+ numberStyle: lineNumberStyle,
273
+ startingLineNumber,
274
+ codeString: code
275
+ }) : null;
276
+ var defaultPreStyle = style.hljs || style["pre[class*=\"language-\"]"] || { backgroundColor: "#fff" };
277
+ var generatorClassName = isHighlightJs(astGenerator) ? "hljs" : "prismjs";
278
+ var preProps = useInlineStyles ? Object.assign({}, rest, { style: Object.assign({}, defaultPreStyle, customStyle) }) : Object.assign({}, rest, {
279
+ className: rest.className ? "".concat(generatorClassName, " ").concat(rest.className) : generatorClassName,
280
+ style: Object.assign({}, customStyle)
281
+ });
282
+ if (wrapLongLines) codeTagProps.style = _objectSpread({ whiteSpace: "pre-wrap" }, codeTagProps.style);
283
+ else codeTagProps.style = _objectSpread({ whiteSpace: "pre" }, codeTagProps.style);
284
+ if (!astGenerator) return /*#__PURE__*/ react.default.createElement(PreTag, preProps, allLineNumbers, /*#__PURE__*/ react.default.createElement(CodeTag, codeTagProps, code));
285
+ if (wrapLines === void 0 && renderer || wrapLongLines) wrapLines = true;
286
+ renderer = renderer || defaultRenderer;
287
+ var defaultCodeValue = [{
288
+ type: "text",
289
+ value: code
290
+ }];
291
+ var codeTree = getCodeTree({
292
+ astGenerator,
293
+ language,
294
+ code,
295
+ defaultCodeValue
296
+ });
297
+ if (codeTree.language === null) codeTree.value = defaultCodeValue;
298
+ var largestLineNumber = startingLineNumber + ((_code$match$length = (_code$match = code.match(/\n/g)) === null || _code$match === void 0 ? void 0 : _code$match.length) !== null && _code$match$length !== void 0 ? _code$match$length : 0);
299
+ var rows = processLines(codeTree, wrapLines, lineProps, showLineNumbers, showInlineLineNumbers, startingLineNumber, largestLineNumber, lineNumberStyle, wrapLongLines);
300
+ return /*#__PURE__*/ react.default.createElement(PreTag, preProps, /*#__PURE__*/ react.default.createElement(CodeTag, codeTagProps, !showInlineLineNumbers && allLineNumbers, renderer({
301
+ rows,
302
+ stylesheet: style,
303
+ useInlineStyles
304
+ })));
305
+ };
306
+ }
307
+ //#endregion
308
+ exports.default = highlight_default;