elseware-ui 2.37.2 → 2.38.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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var bs = require('react-icons/bs');
7
7
  var fa = require('react-icons/fa');
8
8
  var recharts = require('recharts');
9
- var classNames17 = require('classnames');
9
+ var classNames66 = require('classnames');
10
10
  var fa6 = require('react-icons/fa6');
11
11
  var ReactWorldFlags = require('react-world-flags');
12
12
  var emojiFlags = require('emoji-flags');
@@ -18,9 +18,40 @@ var framerMotion = require('framer-motion');
18
18
  var ai = require('react-icons/ai');
19
19
  var reactBeautifulDnd = require('react-beautiful-dnd');
20
20
  var md = require('react-icons/md');
21
- require('@mdxeditor/editor/style.css');
22
- var editor = require('@mdxeditor/editor');
23
21
  var bi = require('react-icons/bi');
22
+ var ReactMarkdown = require('react-markdown');
23
+ var remarkGfm = require('remark-gfm');
24
+ var rehypeRaw = require('rehype-raw');
25
+ var rehypeSanitize = require('rehype-sanitize');
26
+ var reactSyntaxHighlighter = require('react-syntax-highlighter');
27
+ var prism = require('react-syntax-highlighter/dist/esm/styles/prism');
28
+ var bash = require('react-syntax-highlighter/dist/esm/languages/prism/bash');
29
+ var c = require('react-syntax-highlighter/dist/esm/languages/prism/c');
30
+ var cpp = require('react-syntax-highlighter/dist/esm/languages/prism/cpp');
31
+ var css = require('react-syntax-highlighter/dist/esm/languages/prism/css');
32
+ var go = require('react-syntax-highlighter/dist/esm/languages/prism/go');
33
+ var java = require('react-syntax-highlighter/dist/esm/languages/prism/java');
34
+ var javascript = require('react-syntax-highlighter/dist/esm/languages/prism/javascript');
35
+ var json = require('react-syntax-highlighter/dist/esm/languages/prism/json');
36
+ var jsx210 = require('react-syntax-highlighter/dist/esm/languages/prism/jsx');
37
+ var markup = require('react-syntax-highlighter/dist/esm/languages/prism/markup');
38
+ var python = require('react-syntax-highlighter/dist/esm/languages/prism/python');
39
+ var rust = require('react-syntax-highlighter/dist/esm/languages/prism/rust');
40
+ var scss = require('react-syntax-highlighter/dist/esm/languages/prism/scss');
41
+ var sql = require('react-syntax-highlighter/dist/esm/languages/prism/sql');
42
+ var tsx = require('react-syntax-highlighter/dist/esm/languages/prism/tsx');
43
+ var typescript = require('react-syntax-highlighter/dist/esm/languages/prism/typescript');
44
+ var yaml = require('react-syntax-highlighter/dist/esm/languages/prism/yaml');
45
+ var CodeMirror = require('@uiw/react-codemirror');
46
+ var langMarkdown = require('@codemirror/lang-markdown');
47
+ var themeOneDark = require('@codemirror/theme-one-dark');
48
+ var editor = require('@mdxeditor/editor');
49
+ require('@mdxeditor/editor/style.css');
50
+ var react = require('@milkdown/react');
51
+ var core = require('@milkdown/kit/core');
52
+ var commonmark = require('@milkdown/kit/preset/commonmark');
53
+ var gfm = require('@milkdown/kit/preset/gfm');
54
+ var listener = require('@milkdown/kit/plugin/listener');
24
55
 
25
56
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
26
57
 
@@ -43,10 +74,32 @@ function _interopNamespace(e) {
43
74
  }
44
75
 
45
76
  var React2__default = /*#__PURE__*/_interopDefault(React2);
46
- var classNames17__default = /*#__PURE__*/_interopDefault(classNames17);
77
+ var classNames66__default = /*#__PURE__*/_interopDefault(classNames66);
47
78
  var ReactWorldFlags__default = /*#__PURE__*/_interopDefault(ReactWorldFlags);
48
79
  var emojiFlags__default = /*#__PURE__*/_interopDefault(emojiFlags);
49
80
  var d3__namespace = /*#__PURE__*/_interopNamespace(d3);
81
+ var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
82
+ var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
83
+ var rehypeRaw__default = /*#__PURE__*/_interopDefault(rehypeRaw);
84
+ var rehypeSanitize__default = /*#__PURE__*/_interopDefault(rehypeSanitize);
85
+ var bash__default = /*#__PURE__*/_interopDefault(bash);
86
+ var c__default = /*#__PURE__*/_interopDefault(c);
87
+ var cpp__default = /*#__PURE__*/_interopDefault(cpp);
88
+ var css__default = /*#__PURE__*/_interopDefault(css);
89
+ var go__default = /*#__PURE__*/_interopDefault(go);
90
+ var java__default = /*#__PURE__*/_interopDefault(java);
91
+ var javascript__default = /*#__PURE__*/_interopDefault(javascript);
92
+ var json__default = /*#__PURE__*/_interopDefault(json);
93
+ var jsx210__default = /*#__PURE__*/_interopDefault(jsx210);
94
+ var markup__default = /*#__PURE__*/_interopDefault(markup);
95
+ var python__default = /*#__PURE__*/_interopDefault(python);
96
+ var rust__default = /*#__PURE__*/_interopDefault(rust);
97
+ var scss__default = /*#__PURE__*/_interopDefault(scss);
98
+ var sql__default = /*#__PURE__*/_interopDefault(sql);
99
+ var tsx__default = /*#__PURE__*/_interopDefault(tsx);
100
+ var typescript__default = /*#__PURE__*/_interopDefault(typescript);
101
+ var yaml__default = /*#__PURE__*/_interopDefault(yaml);
102
+ var CodeMirror__default = /*#__PURE__*/_interopDefault(CodeMirror);
50
103
 
51
104
  // node_modules/clsx/dist/clsx.mjs
52
105
  function r(e) {
@@ -166,7 +219,7 @@ var CURRENCIES = [
166
219
 
167
220
  // src/utils/currency.ts
168
221
  var getCurrencySymbol = (code) => {
169
- const currency = CURRENCIES.find((c) => c.code === code);
222
+ const currency = CURRENCIES.find((c2) => c2.code === code);
170
223
  return currency ? currency.symbol : null;
171
224
  };
172
225
 
@@ -3760,7 +3813,7 @@ function renderTransitionChild(children, className) {
3760
3813
  }
3761
3814
  const element = child;
3762
3815
  return React2__default.default.cloneElement(element, {
3763
- className: classNames17__default.default(element.props.className, className)
3816
+ className: classNames66__default.default(element.props.className, className)
3764
3817
  });
3765
3818
  }
3766
3819
  function TransitionBase({
@@ -3780,7 +3833,7 @@ function TransitionBase({
3780
3833
  if (!mounted && unmountOnExit) {
3781
3834
  return null;
3782
3835
  }
3783
- const transitionClassName = classNames17__default.default(
3836
+ const transitionClassName = classNames66__default.default(
3784
3837
  visibility ? enterClassName : leaveClassName,
3785
3838
  active ? visibleClassName : hiddenClassName
3786
3839
  );
@@ -3955,7 +4008,7 @@ function Accordion({
3955
4008
  /* @__PURE__ */ jsxRuntime.jsxs(
3956
4009
  "div",
3957
4010
  {
3958
- className: classNames17__default.default(
4011
+ className: classNames66__default.default(
3959
4012
  "inline-flex gap-3 items-center px-3 py-2 w-full eui-gradient-to-r-general-xs",
3960
4013
  {
3961
4014
  "hover:cursor-pointer": toggleOnSummaryClick
@@ -3976,7 +4029,7 @@ function Accordion({
3976
4029
  children: /* @__PURE__ */ jsxRuntime.jsx(
3977
4030
  fa6.FaCircleChevronDown,
3978
4031
  {
3979
- className: classNames17__default.default("text-xl transition-transform duration-300", {
4032
+ className: classNames66__default.default("text-xl transition-transform duration-300", {
3980
4033
  "rotate-180": collapse
3981
4034
  })
3982
4035
  }
@@ -3990,7 +4043,7 @@ function Accordion({
3990
4043
  /* @__PURE__ */ jsxRuntime.jsx(TransitionAccordion_default, { visibility: collapse, children: /* @__PURE__ */ jsxRuntime.jsx(
3991
4044
  "div",
3992
4045
  {
3993
- className: classNames17__default.default(
4046
+ className: classNames66__default.default(
3994
4047
  "border-t border-t-eui-dark-400/40 eui-text-sm",
3995
4048
  {
3996
4049
  "p-5": enableChildrenPadding
@@ -4074,7 +4127,7 @@ function CardHeader({ icon, title, description, className }) {
4074
4127
  return /* @__PURE__ */ jsxRuntime.jsxs(
4075
4128
  "div",
4076
4129
  {
4077
- className: classNames17__default.default(
4130
+ className: classNames66__default.default(
4078
4131
  "flex items-start gap-4 p-6 border-b border-white/10",
4079
4132
  className
4080
4133
  ),
@@ -4090,14 +4143,14 @@ function CardHeader({ icon, title, description, className }) {
4090
4143
  }
4091
4144
  var CardHeader_default = CardHeader;
4092
4145
  function CardContent({ children, className }) {
4093
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames17__default.default("p-6 text-gray-300 text-sm", className), children });
4146
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default("p-6 text-gray-300 text-sm", className), children });
4094
4147
  }
4095
4148
  var CardContent_default = CardContent;
4096
4149
  function CardFooter({ children, className }) {
4097
4150
  return /* @__PURE__ */ jsxRuntime.jsx(
4098
4151
  "div",
4099
4152
  {
4100
- className: classNames17__default.default(
4153
+ className: classNames66__default.default(
4101
4154
  "flex items-center gap-3 p-5 border-t border-white/10 text-sm text-gray-400",
4102
4155
  className
4103
4156
  ),
@@ -4139,7 +4192,7 @@ function GradientAnimation({
4139
4192
  return /* @__PURE__ */ jsxRuntime.jsx(
4140
4193
  "div",
4141
4194
  {
4142
- className: classNames17__default.default("absolute inset-0"),
4195
+ className: classNames66__default.default("absolute inset-0"),
4143
4196
  style: {
4144
4197
  background: `linear-gradient(${cfg.angle}deg, ${cfg.colors?.join(",")})`,
4145
4198
  backgroundSize: cfg.backgroundSize,
@@ -4285,7 +4338,7 @@ function MotionSurface({
4285
4338
  }) {
4286
4339
  const AnimationComponent = animationVariant === "custom" ? CustomAnimation : animationRegistry[animationVariant];
4287
4340
  const OverlayComponent = overlay === "custom" ? CustomOverlay : overlayRegistry[overlay];
4288
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames17__default.default("relative overflow-hidden", className), children: [
4341
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames66__default.default("relative overflow-hidden", className), children: [
4289
4342
  AnimationComponent && /* @__PURE__ */ jsxRuntime.jsx(AnimationComponent, { config: animationConfig, animated }),
4290
4343
  OverlayComponent && /* @__PURE__ */ jsxRuntime.jsx(OverlayComponent, { config: overlayConfig }),
4291
4344
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-10", children })
@@ -5689,7 +5742,7 @@ var Backdrop = ({ children, styles }) => {
5689
5742
  return /* @__PURE__ */ jsxRuntime.jsx(
5690
5743
  "div",
5691
5744
  {
5692
- className: classNames17__default.default({
5745
+ className: classNames66__default.default({
5693
5746
  "bg-black/75 top-0 bottom-0 left-0 right-0 z-50 fixed inset-0 flex items-center justify-center overflow-hidden": true,
5694
5747
  [`${styles}`]: styles
5695
5748
  }),
@@ -6213,7 +6266,7 @@ var Form = ({
6213
6266
  /* @__PURE__ */ jsxRuntime.jsx(UnsavedChangesGuard_default, { formik: formik$1, enabled: warnOnUnsavedChanges }),
6214
6267
  /* @__PURE__ */ jsxRuntime.jsx(DirtyObserver_default, { formik: formik$1, onDirtyChange }),
6215
6268
  /* @__PURE__ */ jsxRuntime.jsx(FormObserver_default, { formik: formik$1, onChange }),
6216
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames17__default.default(styles), children })
6269
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default(styles), children })
6217
6270
  ] })
6218
6271
  }
6219
6272
  );
@@ -6255,16 +6308,16 @@ function normalizeToastStatus(status = "default" /* default */) {
6255
6308
  }
6256
6309
  function emit() {
6257
6310
  const snapshot = [...toasts];
6258
- listeners.forEach((listener) => {
6259
- listener(snapshot);
6311
+ listeners.forEach((listener2) => {
6312
+ listener2(snapshot);
6260
6313
  });
6261
6314
  }
6262
6315
  var toastStore = {
6263
- subscribe(listener) {
6264
- listeners.add(listener);
6265
- listener([...toasts]);
6316
+ subscribe(listener2) {
6317
+ listeners.add(listener2);
6318
+ listener2([...toasts]);
6266
6319
  return () => {
6267
- listeners.delete(listener);
6320
+ listeners.delete(listener2);
6268
6321
  };
6269
6322
  },
6270
6323
  getSnapshot() {
@@ -6730,7 +6783,7 @@ function FormResponse({
6730
6783
  return /* @__PURE__ */ jsxRuntime.jsx(Transition.TransitionDropdown, { visibility: text ? true : false, children: /* @__PURE__ */ jsxRuntime.jsx(
6731
6784
  "div",
6732
6785
  {
6733
- className: classNames17__default.default({
6786
+ className: classNames66__default.default({
6734
6787
  "font-poppins font-light text-sm": true,
6735
6788
  [`${variantsLite[variant]}`]: variant,
6736
6789
  [`${shapes[shape]}`]: shape,
@@ -6847,7 +6900,7 @@ var ThemeSwitch = () => {
6847
6900
  /* @__PURE__ */ jsxRuntime.jsx(
6848
6901
  "div",
6849
6902
  {
6850
- className: classNames17__default.default(
6903
+ className: classNames66__default.default(
6851
6904
  "w-6 h-6 bg-white dark:bg-gray-600 rounded-full shadow-md transition-transform duration-300",
6852
6905
  theme === "dark" ? "translate-x-8" : "translate-x-0"
6853
6906
  )
@@ -18228,12 +18281,12 @@ function WorldMap({
18228
18281
  const mode = isDarkMode ? mapStyles.dark : mapStyles.light;
18229
18282
  const resolvedData = React2.useMemo(() => {
18230
18283
  return data.map((item) => {
18231
- const c = COUNTRIES.find((x) => x.code === item.code);
18232
- if (!c) return null;
18284
+ const c2 = COUNTRIES.find((x) => x.code === item.code);
18285
+ if (!c2) return null;
18233
18286
  return {
18234
18287
  ...item,
18235
- name: c.name,
18236
- coordinates: c.coordinates
18288
+ name: c2.name,
18289
+ coordinates: c2.coordinates
18237
18290
  };
18238
18291
  }).filter(Boolean);
18239
18292
  }, [data]);
@@ -18395,7 +18448,7 @@ function InputResponse({
18395
18448
  return /* @__PURE__ */ jsxRuntime.jsx(Transition.TransitionDropdown, { visibility, children: /* @__PURE__ */ jsxRuntime.jsx(
18396
18449
  "div",
18397
18450
  {
18398
- className: classNames17__default.default({
18451
+ className: classNames66__default.default({
18399
18452
  "font-medium text-sm py-1 px-2": true,
18400
18453
  [`${textVariants[variant]}`]: variant,
18401
18454
  "transition-all ease-in-out": true,
@@ -18410,7 +18463,7 @@ function InputLabel({ text, children, styles }) {
18410
18463
  return /* @__PURE__ */ jsxRuntime.jsx(
18411
18464
  "label",
18412
18465
  {
18413
- className: classNames17__default.default({
18466
+ className: classNames66__default.default({
18414
18467
  "px-0 eui-text-sm text-[13.5px] pointer-events-none select-none": true,
18415
18468
  "transition-all ease-in-out": true,
18416
18469
  [`${styles}`]: styles
@@ -18462,7 +18515,7 @@ var Input = ({
18462
18515
  ...field,
18463
18516
  ...props,
18464
18517
  placeholder,
18465
- className: classNames17__default.default({
18518
+ className: classNames66__default.default({
18466
18519
  "border peer w-full bg-eui-primary-300/10 pt-5 px-3 pb-2 text-md eui-text-md placeholder-transparent placeholder-shown:p-3 focus:outline-none h-[50px]": true,
18467
18520
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
18468
18521
  "border-eui-danger-500": meta.touched && meta.error,
@@ -18507,7 +18560,7 @@ var InputFile = ({
18507
18560
  /* @__PURE__ */ jsxRuntime.jsx(
18508
18561
  "div",
18509
18562
  {
18510
- className: classNames17__default.default(
18563
+ className: classNames66__default.default(
18511
18564
  "border rounded-sm bg-eui-primary-300/10 px-3 pt-3 text-md text-eui-dark-100 cursor-pointer h-[50px] flex items-center",
18512
18565
  {
18513
18566
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
@@ -18533,7 +18586,7 @@ var InputFile = ({
18533
18586
  InputLabel_default,
18534
18587
  {
18535
18588
  text: placeholder,
18536
- styles: classNames17__default.default({
18589
+ styles: classNames66__default.default({
18537
18590
  "absolute left-2 eui-text-sm peer-placeholder-shown:text-base peer-placeholder-shown:top-3 pointer-events-none": true,
18538
18591
  "top-[0.7px]": showFloatingLabel,
18539
18592
  "top-[13px] text-base": !showFloatingLabel
@@ -18586,7 +18639,7 @@ var InputList = ({ name, placeholder, shape }) => {
18586
18639
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(formik.FieldArray, { name, children: ({ push, remove, move }) => /* @__PURE__ */ jsxRuntime.jsxs(
18587
18640
  "div",
18588
18641
  {
18589
- className: classNames17__default.default(
18642
+ className: classNames66__default.default(
18590
18643
  "flex w-full flex-col space-y-2 bg-eui-primary-300/10",
18591
18644
  shapes[resolvedShape]
18592
18645
  ),
@@ -18615,7 +18668,7 @@ var InputList = ({ name, placeholder, shape }) => {
18615
18668
  ref: provided2.innerRef,
18616
18669
  ...draggableProps,
18617
18670
  style: draggableStyle,
18618
- className: classNames17__default.default(
18671
+ className: classNames66__default.default(
18619
18672
  "flex items-center space-x-2 bg-eui-primary-300/10 p-2",
18620
18673
  shapes[resolvedShape]
18621
18674
  ),
@@ -18626,7 +18679,7 @@ var InputList = ({ name, placeholder, shape }) => {
18626
18679
  {
18627
18680
  name: `${name}[${index}]`,
18628
18681
  placeholder: `Item ${index + 1}`,
18629
- className: classNames17__default.default(
18682
+ className: classNames66__default.default(
18630
18683
  "peer h-[50px] w-full border bg-eui-primary-300/10 px-3 pb-2 pt-5 text-md placeholder-transparent placeholder-shown:p-3 focus:outline-none eui-text-md",
18631
18684
  shapes[resolvedShape],
18632
18685
  hasItemError ? "border-eui-danger-500" : "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18722,7 +18775,7 @@ var InputListGroup = ({
18722
18775
  return /* @__PURE__ */ jsxRuntime.jsxs(
18723
18776
  "div",
18724
18777
  {
18725
- className: classNames17__default.default(
18778
+ className: classNames66__default.default(
18726
18779
  "flex flex-col gap-2 bg-eui-primary-300/10 p-3",
18727
18780
  shapes[resolvedShape]
18728
18781
  ),
@@ -18734,7 +18787,7 @@ var InputListGroup = ({
18734
18787
  {
18735
18788
  name: `${name}[${groupIndex}].name`,
18736
18789
  placeholder: `Group ${groupIndex + 1}`,
18737
- className: classNames17__default.default(
18790
+ className: classNames66__default.default(
18738
18791
  "h-[40px] w-full border bg-eui-primary-300/10 px-3 py-2 text-md focus:outline-none",
18739
18792
  shapes[resolvedShape],
18740
18793
  "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18765,7 +18818,7 @@ var InputListGroup = ({
18765
18818
  {
18766
18819
  ref: provided.innerRef,
18767
18820
  ...provided.droppableProps,
18768
- className: classNames17__default.default(
18821
+ className: classNames66__default.default(
18769
18822
  "space-y-2 bg-eui-primary-300/10 p-2",
18770
18823
  shapes[resolvedShape]
18771
18824
  ),
@@ -18785,7 +18838,7 @@ var InputListGroup = ({
18785
18838
  ref: provided2.innerRef,
18786
18839
  ...draggableProps,
18787
18840
  style: draggableStyle,
18788
- className: classNames17__default.default(
18841
+ className: classNames66__default.default(
18789
18842
  "flex items-center gap-2 bg-eui-primary-300/10 p-2",
18790
18843
  shapes[resolvedShape]
18791
18844
  ),
@@ -18796,7 +18849,7 @@ var InputListGroup = ({
18796
18849
  {
18797
18850
  name: `${itemsFieldName}[${itemIndex}]`,
18798
18851
  placeholder: `Item ${itemIndex + 1}`,
18799
- className: classNames17__default.default(
18852
+ className: classNames66__default.default(
18800
18853
  "h-[40px] w-full border bg-eui-primary-300/10 px-3 py-2 text-md focus:outline-none",
18801
18854
  shapes[resolvedShape],
18802
18855
  "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -19010,7 +19063,7 @@ var DateSelector = ({
19010
19063
  ...field,
19011
19064
  ...props,
19012
19065
  placeholder,
19013
- className: classNames17__default.default({
19066
+ className: classNames66__default.default({
19014
19067
  "border border-eui-primary-400 peer w-full bg-eui-primary-300/10 pt-5 px-3 pb-2 text-md eui-text-md placeholder-transparent placeholder-shown:p-3 focus:border-eui-secondary-500 focus:outline-none h-[50px]": true,
19015
19068
  "border-eui-danger-500": meta.touched && meta.error,
19016
19069
  "transition-all ease-in-out": true,
@@ -19119,7 +19172,7 @@ var ImageInput = React2.forwardRef(
19119
19172
  /* @__PURE__ */ jsxRuntime.jsxs(
19120
19173
  "label",
19121
19174
  {
19122
- className: classNames17__default.default({
19175
+ className: classNames66__default.default({
19123
19176
  "border-2 border-dashed border-gray-700 bg-gray-900 h-[200px] w-[300px] flex flex-col gap-2 items-center justify-center group": true,
19124
19177
  "hover:cursor-pointer hover:border-solid hover:border-gray-600 hover:bg-gray-900/80": true,
19125
19178
  "transition-all ease-in-out duration-150": true
@@ -19236,7 +19289,7 @@ function Radio({
19236
19289
  return /* @__PURE__ */ jsxRuntime.jsxs(
19237
19290
  "div",
19238
19291
  {
19239
- className: classNames17__default.default({
19292
+ className: classNames66__default.default({
19240
19293
  "flex flex-row gap-2 items-center mx-1 my-2": true
19241
19294
  }),
19242
19295
  children: [
@@ -19249,7 +19302,7 @@ function Radio({
19249
19302
  ...props,
19250
19303
  value: option.value,
19251
19304
  checked: field2.value === option.value,
19252
- className: classNames17__default.default({
19305
+ className: classNames66__default.default({
19253
19306
  "appearance-none w-4 h-4 border-2 border-eui-primary-400 rounded-full cursor-pointer transition-all duration-300": true,
19254
19307
  // base radio button styles
19255
19308
  "checked:bg-eui-secondary-700 checked:border-eui-primary-400": field2.value === option.value
@@ -19261,7 +19314,7 @@ function Radio({
19261
19314
  "label",
19262
19315
  {
19263
19316
  htmlFor: option.value,
19264
- className: classNames17__default.default({
19317
+ className: classNames66__default.default({
19265
19318
  "eui-text-md text-sm": true
19266
19319
  }),
19267
19320
  children: option.label
@@ -19304,7 +19357,7 @@ function StarRatingInput({
19304
19357
  return /* @__PURE__ */ jsxRuntime.jsxs(
19305
19358
  "div",
19306
19359
  {
19307
- className: classNames17__default.default({
19360
+ className: classNames66__default.default({
19308
19361
  "inline-flex gap-[4px] text-[20px]": true,
19309
19362
  [`${styles}`]: styles
19310
19363
  }),
@@ -19317,7 +19370,7 @@ function StarRatingInput({
19317
19370
  onClick: () => handleOnClick(index),
19318
19371
  onMouseEnter: () => setHover(index),
19319
19372
  onMouseLeave: () => setHover(null),
19320
- className: classNames17__default.default({
19373
+ className: classNames66__default.default({
19321
19374
  "text-yellow-600": index <= (hover ?? rating - 1),
19322
19375
  "text-gray-400": index > (hover ?? rating - 1)
19323
19376
  }),
@@ -19361,7 +19414,7 @@ function Select({
19361
19414
  {
19362
19415
  as: "select",
19363
19416
  ...props,
19364
- className: classNames17__default.default({
19417
+ className: classNames66__default.default({
19365
19418
  "border peer w-full bg-eui-primary-300/10 pt-5 px-3 pb-2 text-md eui-text-md placeholder-transparent placeholder-shown:p-3 focus:border-eui-secondary-500 focus:outline-none h-[50px]": true,
19366
19419
  "border-eui-primary-400": !(meta.touched && meta.error),
19367
19420
  "border-red-500": meta.touched && meta.error,
@@ -19413,7 +19466,7 @@ function Switch({
19413
19466
  "div",
19414
19467
  {
19415
19468
  onClick: () => helpers.setValue(!field.value),
19416
- className: classNames17__default.default(
19469
+ className: classNames66__default.default(
19417
19470
  "w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer dark:bg-eui-dark-100",
19418
19471
  "peer-checked:after:translate-x-full peer-checked:after:border-white",
19419
19472
  "after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white",
@@ -19470,7 +19523,7 @@ function Tags({
19470
19523
  /* @__PURE__ */ jsxRuntime.jsxs(
19471
19524
  "div",
19472
19525
  {
19473
- className: classNames17__default.default(
19526
+ className: classNames66__default.default(
19474
19527
  "border rounded-sm flex flex-wrap items-center gap-2 px-2 pt-2 pb-6 min-h-[3rem]",
19475
19528
  {
19476
19529
  "bg-eui-primary-300/10 eui-text-md": true,
@@ -19518,7 +19571,7 @@ function Tags({
19518
19571
  InputLabel_default,
19519
19572
  {
19520
19573
  text: placeholder,
19521
- styles: classNames17__default.default(
19574
+ styles: classNames66__default.default(
19522
19575
  "absolute left-2 transition-all pointer-events-none text-eui-dark-200",
19523
19576
  input.length > 0 || field.value.length > 0 ? "top-[2px] text-[13.5px]" : "top-3 text-base"
19524
19577
  )
@@ -19559,7 +19612,7 @@ function TextArea({
19559
19612
  as: "textarea",
19560
19613
  ...field,
19561
19614
  ...props,
19562
- className: classNames17__default.default({
19615
+ className: classNames66__default.default({
19563
19616
  "border peer w-full bg-eui-primary-300/10 eui-text-md outline-none px-3 py-5 resize-none focus:resize-none focus:outline-none": true,
19564
19617
  "transition-all ease-in-out": true,
19565
19618
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
@@ -19573,7 +19626,7 @@ function TextArea({
19573
19626
  InputLabel_default,
19574
19627
  {
19575
19628
  text: placeholder,
19576
- styles: classNames17__default.default(
19629
+ styles: classNames66__default.default(
19577
19630
  "absolute left-2 transition-all pointer-events-none text-eui-dark-200",
19578
19631
  field.value ? "top-[2px] text-[13.5px]" : "top-3 text-base"
19579
19632
  )
@@ -19602,7 +19655,7 @@ var ContentArea = React2.forwardRef(
19602
19655
  "div",
19603
19656
  {
19604
19657
  ref,
19605
- className: classNames17__default.default({
19658
+ className: classNames66__default.default({
19606
19659
  "min-h-screen h-full w-full transition-all duration-[200ms]": true,
19607
19660
  "py-3 px-5": !enablePadding,
19608
19661
  "py-3 px-5 lg:px-[150px]": enablePadding,
@@ -19619,7 +19672,7 @@ function FlexCol({ children, gap = 3, styles }) {
19619
19672
  return /* @__PURE__ */ jsxRuntime.jsx(
19620
19673
  "div",
19621
19674
  {
19622
- className: classNames17__default.default({
19675
+ className: classNames66__default.default({
19623
19676
  [`flex flex-col gap-${gap}`]: true,
19624
19677
  [`${styles}`]: styles
19625
19678
  }),
@@ -19632,7 +19685,7 @@ function FlexRow({ children, gap = 3, styles }) {
19632
19685
  return /* @__PURE__ */ jsxRuntime.jsx(
19633
19686
  "div",
19634
19687
  {
19635
- className: classNames17__default.default({
19688
+ className: classNames66__default.default({
19636
19689
  [`flex flex-row gap-${gap}`]: true,
19637
19690
  [`${styles}`]: styles
19638
19691
  }),
@@ -19651,7 +19704,7 @@ function Grid({ children, styles }) {
19651
19704
  return /* @__PURE__ */ jsxRuntime.jsx(
19652
19705
  "div",
19653
19706
  {
19654
- className: classNames17__default.default({
19707
+ className: classNames66__default.default({
19655
19708
  [`grid`]: true,
19656
19709
  [`${styles}`]: styles
19657
19710
  }),
@@ -19668,7 +19721,7 @@ var Layout = ({
19668
19721
  return /* @__PURE__ */ jsxRuntime.jsx(
19669
19722
  "div",
19670
19723
  {
19671
- className: classNames17__default.default({
19724
+ className: classNames66__default.default({
19672
19725
  // "flex h-full w-screen bg-gray-100 overflow-auto": true,
19673
19726
  "flex bg-eui-light-600": true,
19674
19727
  "flex-col": flexDirection === "vertical",
@@ -19687,7 +19740,7 @@ var Header = ({
19687
19740
  return /* @__PURE__ */ jsxRuntime.jsx(
19688
19741
  "div",
19689
19742
  {
19690
- className: classNames17__default.default({
19743
+ className: classNames66__default.default({
19691
19744
  static: position === "static",
19692
19745
  fixed: position === "fixed",
19693
19746
  sticky: position === "sticky",
@@ -19727,7 +19780,7 @@ var Content = ({
19727
19780
  return /* @__PURE__ */ jsxRuntime.jsx(
19728
19781
  "div",
19729
19782
  {
19730
- className: classNames17__default.default({
19783
+ className: classNames66__default.default({
19731
19784
  "w-full min-h-screen transition-all duration-200 eui-bg-sm": true,
19732
19785
  "md:pl-[300px]": !overlayedSidebar && sidebarVisible && !isMobile,
19733
19786
  // Shift when sidebar is open (desktop)
@@ -19743,7 +19796,7 @@ var Footer = ({ children, styles }) => {
19743
19796
  return /* @__PURE__ */ jsxRuntime.jsx(
19744
19797
  "div",
19745
19798
  {
19746
- className: classNames17__default.default({
19799
+ className: classNames66__default.default({
19747
19800
  "bottom-0 w-full h-fit": true,
19748
19801
  "border-t border-eui-dark-500/40 dark:border-eui-secondary-800 eui-bg-md": !styles,
19749
19802
  [`${styles}`]: styles
@@ -19816,269 +19869,6 @@ function BlockGroup({
19816
19869
  ] });
19817
19870
  }
19818
19871
  var BlockGroup_default = BlockGroup;
19819
- var useTheme = () => {
19820
- const context = React2.useContext(ThemeContext);
19821
- if (!context) {
19822
- throw new Error("useTheme must be used within a ThemeProvider");
19823
- }
19824
- return context;
19825
- };
19826
- var useTheme_default = useTheme;
19827
- function MarkdownEditor({
19828
- styles,
19829
- ...props
19830
- }) {
19831
- const [field, meta, helpers] = formik.useField(props);
19832
- const { theme } = useTheme_default();
19833
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
19834
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames17__default.default(theme === "dark" ? "dark" : "", styles), children: /* @__PURE__ */ jsxRuntime.jsx(
19835
- editor.MDXEditor,
19836
- {
19837
- markdown: field.value,
19838
- onChange: (val) => helpers.setValue(val),
19839
- className: "rounded border border-gray-300 dark:border-gray-700",
19840
- plugins: [
19841
- editor.headingsPlugin(),
19842
- editor.linkPlugin(),
19843
- editor.listsPlugin(),
19844
- editor.imagePlugin(),
19845
- editor.tablePlugin(),
19846
- editor.linkDialogPlugin({}),
19847
- editor.thematicBreakPlugin(),
19848
- editor.quotePlugin(),
19849
- editor.toolbarPlugin({
19850
- toolbarContents: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19851
- /* @__PURE__ */ jsxRuntime.jsx(editor.UndoRedo, {}),
19852
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19853
- /* @__PURE__ */ jsxRuntime.jsx(editor.BlockTypeSelect, {}),
19854
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19855
- /* @__PURE__ */ jsxRuntime.jsx(editor.BoldItalicUnderlineToggles, {}),
19856
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19857
- /* @__PURE__ */ jsxRuntime.jsx(editor.StrikeThroughSupSubToggles, {}),
19858
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19859
- /* @__PURE__ */ jsxRuntime.jsx(editor.ListsToggle, {}),
19860
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19861
- /* @__PURE__ */ jsxRuntime.jsx(editor.CreateLink, {}),
19862
- /* @__PURE__ */ jsxRuntime.jsx(editor.InsertImage, {}),
19863
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19864
- /* @__PURE__ */ jsxRuntime.jsx(editor.InsertTable, {}),
19865
- /* @__PURE__ */ jsxRuntime.jsx(editor.InsertThematicBreak, {})
19866
- ] })
19867
- })
19868
- ]
19869
- }
19870
- ) }),
19871
- /* @__PURE__ */ jsxRuntime.jsx(
19872
- InputResponse_default,
19873
- {
19874
- name: field.name,
19875
- visibility: meta.touched && meta.error ? true : false,
19876
- variant: "danger"
19877
- }
19878
- )
19879
- ] });
19880
- }
19881
- var MarkdownEditor_default = MarkdownEditor;
19882
- var MarkdownContext = React2.createContext(null);
19883
-
19884
- // src/components/markdown/hooks/useMarkdown.tsx
19885
- function useMarkdown() {
19886
- return React2.useContext(MarkdownContext);
19887
- }
19888
-
19889
- // src/components/markdown/utils/generateHeadingNumbers.ts
19890
- function generateHeadingNumbers(headings) {
19891
- const counters = [0, 0, 0, 0, 0, 0];
19892
- return headings.map((heading) => {
19893
- const level = heading.level;
19894
- counters[level - 1]++;
19895
- for (let i = level; i < counters.length; i++) {
19896
- counters[i] = 0;
19897
- }
19898
- const numbering = counters.slice(0, level).filter((n) => n > 0).join(".");
19899
- return {
19900
- ...heading,
19901
- numbering
19902
- };
19903
- });
19904
- }
19905
-
19906
- // src/components/markdown/utils/sanitizeHeading.ts
19907
- function sanitizeHeading(text) {
19908
- return text.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu, "").replace(/\s+/g, " ").trim();
19909
- }
19910
- function MarkdownTOC({ title = "Table of Contents" }) {
19911
- const context = useMarkdown();
19912
- if (!context) {
19913
- return null;
19914
- }
19915
- const { headings, activeHeading } = context;
19916
- const numberedHeadings = generateHeadingNumbers(headings);
19917
- const scrollToHeading = (id) => {
19918
- const element = document.getElementById(id);
19919
- if (!element) return;
19920
- element.scrollIntoView({
19921
- behavior: "smooth",
19922
- block: "start"
19923
- });
19924
- };
19925
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
19926
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
19927
- "h2",
19928
- {
19929
- className: "\n text-sm\n font-semibold\n uppercase\n tracking-wide\n text-gray-900\n dark:text-gray-100\n ",
19930
- children: title
19931
- }
19932
- ) }),
19933
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: numberedHeadings.map((heading) => /* @__PURE__ */ jsxRuntime.jsxs(
19934
- "button",
19935
- {
19936
- onClick: () => scrollToHeading(heading.id),
19937
- className: classNames17__default.default(
19938
- "block w-full text-left text-sm transition-all ease-in-out duration-150",
19939
- "hover:text-primary",
19940
- activeHeading === heading.id ? "text-primary font-semibold underline" : "text-gray-500 dark:text-gray-400"
19941
- ),
19942
- style: {
19943
- paddingLeft: `${(heading.level - 1) * 12}px`
19944
- },
19945
- children: [
19946
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 opacity-70", children: heading.numbering }),
19947
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: sanitizeHeading(heading.text) })
19948
- ]
19949
- },
19950
- heading.id
19951
- )) })
19952
- ] });
19953
- }
19954
- var MarkdownTOC_default = MarkdownTOC;
19955
- function MarkdownViewer({ value }) {
19956
- const { theme } = useTheme_default();
19957
- const context = useMarkdown();
19958
- const markdown = value ?? context?.markdown ?? "";
19959
- const headings = context?.headings ?? [];
19960
- const setActiveHeading = context?.setActiveHeading;
19961
- React2.useEffect(() => {
19962
- const timeout = setTimeout(() => {
19963
- headings.forEach((heading) => {
19964
- const headingEls = document.querySelectorAll("h1,h2,h3,h4,h5,h6");
19965
- headingEls.forEach((el) => {
19966
- if (el.textContent?.trim() === heading.text.trim()) {
19967
- el.id = heading.id;
19968
- }
19969
- });
19970
- });
19971
- if (!setActiveHeading) return;
19972
- const observer = new IntersectionObserver(
19973
- (entries) => {
19974
- entries.forEach((entry) => {
19975
- if (entry.isIntersecting) {
19976
- setActiveHeading(entry.target.id);
19977
- }
19978
- });
19979
- },
19980
- {
19981
- rootMargin: "-20% 0px -70% 0px"
19982
- }
19983
- );
19984
- headings.forEach((heading) => {
19985
- const el = document.getElementById(heading.id);
19986
- if (el) {
19987
- observer.observe(el);
19988
- }
19989
- });
19990
- return () => observer.disconnect();
19991
- }, 0);
19992
- return () => clearTimeout(timeout);
19993
- }, [headings, setActiveHeading]);
19994
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme === "dark" ? "dark" : "", children: /* @__PURE__ */ jsxRuntime.jsx(
19995
- editor.MDXEditor,
19996
- {
19997
- markdown,
19998
- readOnly: true,
19999
- className: "markdown-body max-w-none",
20000
- plugins: [
20001
- editor.headingsPlugin(),
20002
- editor.linkPlugin(),
20003
- editor.listsPlugin(),
20004
- editor.imagePlugin(),
20005
- editor.tablePlugin(),
20006
- editor.quotePlugin(),
20007
- editor.thematicBreakPlugin(),
20008
- editor.linkDialogPlugin({}),
20009
- editor.markdownShortcutPlugin(),
20010
- editor.frontmatterPlugin(),
20011
- editor.codeBlockPlugin({
20012
- defaultCodeBlockLanguage: "txt",
20013
- codeBlockEditorDescriptors: []
20014
- }),
20015
- editor.codeMirrorPlugin({
20016
- codeBlockLanguages: {
20017
- js: "JavaScript",
20018
- ts: "TypeScript",
20019
- jsx: "React JSX",
20020
- tsx: "React TSX",
20021
- html: "HTML",
20022
- css: "CSS",
20023
- scss: "SCSS",
20024
- json: "JSON",
20025
- bash: "Bash",
20026
- shell: "Shell",
20027
- zsh: "ZSH",
20028
- yaml: "YAML",
20029
- yml: "YAML",
20030
- md: "Markdown",
20031
- py: "Python",
20032
- java: "Java",
20033
- cpp: "C++",
20034
- c: "C",
20035
- go: "Go",
20036
- rust: "Rust",
20037
- php: "PHP",
20038
- sql: "SQL"
20039
- }
20040
- })
20041
- ]
20042
- },
20043
- markdown
20044
- ) });
20045
- }
20046
- var MarkdownViewer_default = MarkdownViewer;
20047
-
20048
- // src/components/markdown/utils/slugify.ts
20049
- function slugify(text) {
20050
- return text.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-");
20051
- }
20052
-
20053
- // src/components/markdown/utils/extractHeadings.ts
20054
- function extractHeadings(markdown) {
20055
- return markdown.split("\n").filter((line) => /^#{1,6}\s/.test(line)).map((line) => {
20056
- const level = line.match(/^#+/)?.[0].length || 1;
20057
- const text = line.replace(/^#{1,6}\s/, "");
20058
- return {
20059
- id: slugify(text),
20060
- text,
20061
- level
20062
- };
20063
- });
20064
- }
20065
- function MarkdownProvider({ markdown, children }) {
20066
- const [activeHeading, setActiveHeading] = React2.useState("");
20067
- const headings = React2.useMemo(() => extractHeadings(markdown), [markdown]);
20068
- return /* @__PURE__ */ jsxRuntime.jsx(
20069
- MarkdownContext.Provider,
20070
- {
20071
- value: {
20072
- markdown,
20073
- headings,
20074
- activeHeading,
20075
- setActiveHeading
20076
- },
20077
- children
20078
- }
20079
- );
20080
- }
20081
- var MarkdownProvider_default = MarkdownProvider;
20082
19872
  function BreadcrumbItem({
20083
19873
  title,
20084
19874
  href = "#",
@@ -20090,7 +19880,7 @@ function BreadcrumbItem({
20090
19880
  {
20091
19881
  href,
20092
19882
  onClick,
20093
- className: classNames17__default.default({
19883
+ className: classNames66__default.default({
20094
19884
  "text-lg font-semibold": true,
20095
19885
  "text-gray-400 hover:text-gray-600 cursor-pointer": !active,
20096
19886
  "text-eui-light-800": active,
@@ -20167,7 +19957,7 @@ var Breadcrumb = ({
20167
19957
  index < resolvedData.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
20168
19958
  "span",
20169
19959
  {
20170
- className: classNames17__default.default({
19960
+ className: classNames66__default.default({
20171
19961
  "text-lg font-semibold text-gray-500": true,
20172
19962
  [`px-${gap}`]: gap
20173
19963
  }),
@@ -20181,7 +19971,7 @@ var Breadcrumb = ({
20181
19971
  return /* @__PURE__ */ jsxRuntime.jsx(
20182
19972
  "div",
20183
19973
  {
20184
- className: classNames17__default.default({
19974
+ className: classNames66__default.default({
20185
19975
  "inline-flex": true,
20186
19976
  [`${styles}`]: styles
20187
19977
  }),
@@ -20213,7 +20003,7 @@ var Drawer = ({
20213
20003
  isMobile && showBackdrop && /* @__PURE__ */ jsxRuntime.jsx(TransitionFade_default, { visibility, leaveDuration: 200, children: /* @__PURE__ */ jsxRuntime.jsx(
20214
20004
  "div",
20215
20005
  {
20216
- className: classNames17__default.default(
20006
+ className: classNames66__default.default(
20217
20007
  "fixed inset-0 bg-black/50 z-40",
20218
20008
  backdropStyles
20219
20009
  ),
@@ -20224,7 +20014,7 @@ var Drawer = ({
20224
20014
  "div",
20225
20015
  {
20226
20016
  style: drawerStyle,
20227
- className: classNames17__default.default(
20017
+ className: classNames66__default.default(
20228
20018
  "fixed shadow-lg z-50",
20229
20019
  {
20230
20020
  "h-full w-[300px] top-0": isHorizontal && !hasOffset,
@@ -20253,7 +20043,7 @@ function DrawerToggler({
20253
20043
  return /* @__PURE__ */ jsxRuntime.jsx(
20254
20044
  "div",
20255
20045
  {
20256
- className: classNames17__default.default({
20046
+ className: classNames66__default.default({
20257
20047
  "text-xl p-3 cursor-pointer": true,
20258
20048
  "transition-all ease-in-out": true,
20259
20049
  "text-eui-dark-500 dark:text-eui-secondary-600": !styles,
@@ -20301,7 +20091,7 @@ function FooterNav({ data = [], styles }) {
20301
20091
  childrenContent = /* @__PURE__ */ jsxRuntime.jsx(
20302
20092
  "div",
20303
20093
  {
20304
- className: classNames17__default.default({
20094
+ className: classNames66__default.default({
20305
20095
  "grid w-full": true,
20306
20096
  "grid-cols-1": isMobile,
20307
20097
  "grid-cols-3": !isMobile,
@@ -20314,7 +20104,7 @@ function FooterNav({ data = [], styles }) {
20314
20104
  return /* @__PURE__ */ jsxRuntime.jsx(
20315
20105
  "div",
20316
20106
  {
20317
- className: classNames17__default.default({
20107
+ className: classNames66__default.default({
20318
20108
  [`${styles}`]: styles
20319
20109
  }),
20320
20110
  children: childrenContent
@@ -20355,7 +20145,7 @@ var FooterNavGroup = ({
20355
20145
  /* @__PURE__ */ jsxRuntime.jsx(
20356
20146
  "div",
20357
20147
  {
20358
- className: classNames17__default.default({
20148
+ className: classNames66__default.default({
20359
20149
  "": true,
20360
20150
  "py-2 font-semibold eui-text-lg": !styles,
20361
20151
  [`${styles}`]: styles
@@ -20400,7 +20190,7 @@ var FooterNavItem = ({
20400
20190
  "div",
20401
20191
  {
20402
20192
  onClick: handleNavigation,
20403
- className: classNames17__default.default({
20193
+ className: classNames66__default.default({
20404
20194
  "flex flex-row items-center gap-3 cursor-pointer p-1 w-full": true,
20405
20195
  "transition-all duration-200 ease-in-out": true,
20406
20196
  "text-sm eui-text-sm": !styles,
@@ -20429,7 +20219,7 @@ var FooterNavItemTitle = ({
20429
20219
  return /* @__PURE__ */ jsxRuntime.jsx(
20430
20220
  "div",
20431
20221
  {
20432
- className: classNames17__default.default({
20222
+ className: classNames66__default.default({
20433
20223
  "": true,
20434
20224
  "py-2 font-thin eui-text-md": !styles,
20435
20225
  [`${styles}`]: styles
@@ -20482,7 +20272,7 @@ function HeaderNav({ data = [], styles }) {
20482
20272
  return /* @__PURE__ */ jsxRuntime.jsx(
20483
20273
  "div",
20484
20274
  {
20485
- className: classNames17__default.default({
20275
+ className: classNames66__default.default({
20486
20276
  [`${styles}`]: styles
20487
20277
  }),
20488
20278
  children: childrenContent
@@ -20492,7 +20282,7 @@ function HeaderNav({ data = [], styles }) {
20492
20282
  var HeaderNav_default = HeaderNav;
20493
20283
  function useClickOutside(ref, fun) {
20494
20284
  React2.useEffect(() => {
20495
- const listener = (e) => {
20285
+ const listener2 = (e) => {
20496
20286
  if (!ref.current || ref.current.contains(e.target)) {
20497
20287
  return;
20498
20288
  }
@@ -20500,11 +20290,11 @@ function useClickOutside(ref, fun) {
20500
20290
  fun();
20501
20291
  }
20502
20292
  };
20503
- document.addEventListener("mousedown", listener);
20504
- document.addEventListener("touchstart", listener);
20293
+ document.addEventListener("mousedown", listener2);
20294
+ document.addEventListener("touchstart", listener2);
20505
20295
  return () => {
20506
- document.removeEventListener("mousedown", listener);
20507
- document.removeEventListener("touchstart", listener);
20296
+ document.removeEventListener("mousedown", listener2);
20297
+ document.removeEventListener("touchstart", listener2);
20508
20298
  };
20509
20299
  }, [ref, fun]);
20510
20300
  }
@@ -20544,7 +20334,7 @@ var HeaderNavGroup = ({
20544
20334
  /* @__PURE__ */ jsxRuntime.jsxs(
20545
20335
  "div",
20546
20336
  {
20547
- className: classNames17__default.default({
20337
+ className: classNames66__default.default({
20548
20338
  "flex flex-row gap-2 items-center justify-between cursor-pointer p-3 w-full": true,
20549
20339
  "transition-all duration-300 ease-in-out": true,
20550
20340
  "eui-text-md bg-gradient-to-t from-eui-dark-500/10 dark:from-green-700/10": !styles,
@@ -20572,7 +20362,7 @@ var HeaderNavGroup = ({
20572
20362
  children && /* @__PURE__ */ jsxRuntime.jsx(
20573
20363
  bs.BsChevronDown,
20574
20364
  {
20575
- className: classNames17__default.default({
20365
+ className: classNames66__default.default({
20576
20366
  "text-md": true,
20577
20367
  "transition-all ease-in-out duration-300": true,
20578
20368
  "rotate-180": !collapsed
@@ -20585,7 +20375,7 @@ var HeaderNavGroup = ({
20585
20375
  !collapsed && children && /* @__PURE__ */ jsxRuntime.jsx(
20586
20376
  "div",
20587
20377
  {
20588
- className: classNames17__default.default({
20378
+ className: classNames66__default.default({
20589
20379
  "absolute min-w-80 left-0 top-full mt-1 border border-eui-dark-300/10 dark:border-eui-dark-300/50 shadow-lg eui-shadow-lg z-50 w-full eui-bg-md": true,
20590
20380
  "transition-all duration-300 ease-in-out": true
20591
20381
  }),
@@ -20615,7 +20405,7 @@ var HeaderNavItem = ({
20615
20405
  "div",
20616
20406
  {
20617
20407
  onClick: handleNavigation,
20618
- className: classNames17__default.default({
20408
+ className: classNames66__default.default({
20619
20409
  "flex flex-row items-center gap-3 cursor-pointer p-3 w-full": true,
20620
20410
  "transition-all duration-200 ease-in-out": true,
20621
20411
  "eui-text-md border-b border-eui-dark-500/20 dark:border-eui-secondary-900/20 bg-gradient-to-r from-eui-dark-500/10 dark:from-eui-secondary-900/10": !styles,
@@ -20644,7 +20434,7 @@ var HeaderNavItemTitle = ({
20644
20434
  return /* @__PURE__ */ jsxRuntime.jsx(
20645
20435
  "div",
20646
20436
  {
20647
- className: classNames17__default.default({
20437
+ className: classNames66__default.default({
20648
20438
  "p-3 font-thin": true,
20649
20439
  "eui-text-md": !styles,
20650
20440
  [`${styles}`]: styles
@@ -20684,7 +20474,7 @@ var Link = ({
20684
20474
  href: href || "#",
20685
20475
  target: targets[target],
20686
20476
  onClick: handleClick,
20687
- className: classNames17__default.default({
20477
+ className: classNames66__default.default({
20688
20478
  [`${textVariants[variant]}`]: variant,
20689
20479
  [`${decorations[decoration]}`]: decoration,
20690
20480
  "font-bold": bold,
@@ -21334,7 +21124,7 @@ function Modal({
21334
21124
  "div",
21335
21125
  {
21336
21126
  ref: modalRef,
21337
- className: classNames17__default.default(
21127
+ className: classNames66__default.default(
21338
21128
  "eui-bg-md eui-shadow-lg border border-gray-700/80 w-fit h-fit",
21339
21129
  shapes[resolvedShape],
21340
21130
  styles
@@ -21346,7 +21136,7 @@ function Modal({
21346
21136
  "button",
21347
21137
  {
21348
21138
  type: "button",
21349
- className: classNames17__default.default(
21139
+ className: classNames66__default.default(
21350
21140
  "w-[60px] h-[60px] flex items-center justify-center transition-standard-fast",
21351
21141
  "hover:cursor-pointer hover:bg-eui-dark-500"
21352
21142
  ),
@@ -21480,7 +21270,7 @@ function ShowMore({ text, limit }) {
21480
21270
  /* @__PURE__ */ jsxRuntime.jsx(
21481
21271
  "div",
21482
21272
  {
21483
- className: classNames17__default.default({
21273
+ className: classNames66__default.default({
21484
21274
  "text-blue-300 px-1 pb-1 mt-1": true,
21485
21275
  "bg-slate-900/70": !showMore,
21486
21276
  "bg-gradient-to-t from-slate-900/50 to-transparent": showMore
@@ -21796,6 +21586,14 @@ var useModal = () => {
21796
21586
  };
21797
21587
  };
21798
21588
  var useModal_default = useModal;
21589
+ var useTheme = () => {
21590
+ const context = React2.useContext(ThemeContext);
21591
+ if (!context) {
21592
+ throw new Error("useTheme must be used within a ThemeProvider");
21593
+ }
21594
+ return context;
21595
+ };
21596
+ var useTheme_default = useTheme;
21799
21597
  function CommentMenuItem({
21800
21598
  icon,
21801
21599
  name,
@@ -22371,11 +22169,78 @@ function DataViewTable({
22371
22169
  );
22372
22170
  }
22373
22171
  var DataViewTable_default = DataViewTable;
22374
- function DocumentationPanel({ value, toc = true }) {
22375
- return /* @__PURE__ */ jsxRuntime.jsx(MarkdownProvider_default, { markdown: value, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-screen overflow-hidden grid grid-cols-[minmax(0,1fr)_280px] gap-10", children: [
22376
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "documentation_scrollbar min-w-0 h-screen overflow-y-auto scroll-smooth", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-4xl mx-auto px-6", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownViewer_default, {}) }) }),
22377
- toc && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden lg:block h-screen border-l border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "documentation_scrollbar h-full overflow-y-auto px-6 pt-0 pb-10", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownTOC_default, {}) }) })
22378
- ] }) });
22172
+ function toCssSize(value) {
22173
+ if (typeof value === "number") return `${value}px`;
22174
+ return value;
22175
+ }
22176
+ function DocumentationPanel({
22177
+ value,
22178
+ toc = true,
22179
+ height = "100vh",
22180
+ viewerClassName,
22181
+ contentClassName,
22182
+ tocClassName,
22183
+ className,
22184
+ contentMaxWidthClassName = "max-w-4xl"
22185
+ }) {
22186
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownProvider_default, { markdown: value, children: /* @__PURE__ */ jsxRuntime.jsxs(
22187
+ "section",
22188
+ {
22189
+ className: classNames66__default.default(
22190
+ "eui-documentation-panel",
22191
+ "min-h-0 overflow-hidden bg-white text-gray-900",
22192
+ "dark:bg-gray-950 dark:text-gray-100",
22193
+ toc ? "grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]" : "grid grid-cols-1",
22194
+ className
22195
+ ),
22196
+ style: {
22197
+ height: toCssSize(height)
22198
+ },
22199
+ children: [
22200
+ /* @__PURE__ */ jsxRuntime.jsx(
22201
+ "main",
22202
+ {
22203
+ className: classNames66__default.default(
22204
+ "eui-documentation-panel-viewer",
22205
+ "documentation-panel-scrollbar min-w-0 overflow-y-auto scroll-smooth",
22206
+ viewerClassName
22207
+ ),
22208
+ children: /* @__PURE__ */ jsxRuntime.jsx(
22209
+ "div",
22210
+ {
22211
+ className: classNames66__default.default(
22212
+ "mx-auto px-5 py-8 sm:px-6 lg:px-8",
22213
+ contentMaxWidthClassName,
22214
+ contentClassName
22215
+ ),
22216
+ children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownViewer_default, {})
22217
+ }
22218
+ )
22219
+ }
22220
+ ),
22221
+ toc ? /* @__PURE__ */ jsxRuntime.jsx(
22222
+ "aside",
22223
+ {
22224
+ className: classNames66__default.default(
22225
+ "eui-documentation-panel-toc",
22226
+ "hidden min-w-0 border-l border-gray-200 bg-white lg:block",
22227
+ "dark:border-gray-800 dark:bg-gray-950",
22228
+ tocClassName
22229
+ ),
22230
+ children: /* @__PURE__ */ jsxRuntime.jsx(
22231
+ "div",
22232
+ {
22233
+ className: classNames66__default.default(
22234
+ "documentation-panel-scrollbar h-full overflow-y-auto px-5 py-8"
22235
+ ),
22236
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownTOC_default, {}) })
22237
+ }
22238
+ )
22239
+ }
22240
+ ) : null
22241
+ ]
22242
+ }
22243
+ ) });
22379
22244
  }
22380
22245
  var DocumentationPanel_default = DocumentationPanel;
22381
22246
  function SliderItem({
@@ -22551,7 +22416,7 @@ function WorldMapCountryTable({
22551
22416
  }) {
22552
22417
  const enrichedData = React2.useMemo(() => {
22553
22418
  const mapped = data.map((item) => {
22554
- const countryMeta = COUNTRIES.find((c) => c.code === item.code);
22419
+ const countryMeta = COUNTRIES.find((c2) => c2.code === item.code);
22555
22420
  return {
22556
22421
  code: item.code,
22557
22422
  value: item.value,
@@ -22641,7 +22506,7 @@ function BoxNavItem({ icon, name, to, selected, onClick }) {
22641
22506
  type: "button",
22642
22507
  onClick: handleClick,
22643
22508
  "aria-current": selected ? "page" : void 0,
22644
- className: classNames17__default.default(
22509
+ className: classNames66__default.default(
22645
22510
  "w-full min-w-[80px] flex flex-col items-center justify-center py-3 text-center",
22646
22511
  "hover:text-secondary-700 hover:bg-gray-300/10 hover:cursor-pointer",
22647
22512
  selected ? "text-eui-secondary-700 bg-gray-300/10" : "text-gray-400",
@@ -24550,6 +24415,2531 @@ function ReviewThread({
24550
24415
  ] });
24551
24416
  }
24552
24417
  var ReviewThread_default = ReviewThread;
24418
+ var MarkdownContext = React2.createContext(null);
24419
+
24420
+ // src/compositions/markdown/utils/sanitizeHeading.ts
24421
+ function sanitizeHeading(text, options = {}) {
24422
+ const {
24423
+ removeMarkdownSyntax = true,
24424
+ removeHtmlTags = true,
24425
+ collapseWhitespace = true
24426
+ } = options;
24427
+ let value = String(text || "");
24428
+ if (removeHtmlTags) {
24429
+ value = value.replace(/<[^>]*>/g, "");
24430
+ }
24431
+ if (removeMarkdownSyntax) {
24432
+ value = value.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\[[^\]]+\]/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/[*_~]+/g, "").replace(/\\([\\`*{}\[\]()#+\-.!_>])/g, "$1");
24433
+ }
24434
+ value = value.replace(/[\u0000-\u001F\u007F]/g, "");
24435
+ if (collapseWhitespace) {
24436
+ value = value.replace(/\s+/g, " ");
24437
+ }
24438
+ return value.trim();
24439
+ }
24440
+
24441
+ // src/compositions/markdown/utils/createHeadingSlug.ts
24442
+ function escapeRegExp(value) {
24443
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24444
+ }
24445
+ function createHeadingSlug(text, options = {}) {
24446
+ const {
24447
+ separator = "-",
24448
+ fallback = "heading",
24449
+ slugCounts,
24450
+ existingSlugs
24451
+ } = options;
24452
+ const escapedSeparator = escapeRegExp(separator);
24453
+ const sanitized = sanitizeHeading(text);
24454
+ const baseSlug = sanitized.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}\s-]/gu, "").replace(/\s+/g, separator).replace(new RegExp(`${escapedSeparator}+`, "g"), separator).replace(new RegExp(`^${escapedSeparator}|${escapedSeparator}$`, "g"), "").trim() || fallback;
24455
+ if (slugCounts) {
24456
+ const count = slugCounts.get(baseSlug) ?? 0;
24457
+ slugCounts.set(baseSlug, count + 1);
24458
+ return count === 0 ? baseSlug : `${baseSlug}${separator}${count}`;
24459
+ }
24460
+ if (existingSlugs) {
24461
+ let slug = baseSlug;
24462
+ let count = 1;
24463
+ while (existingSlugs.has(slug)) {
24464
+ slug = `${baseSlug}${separator}${count}`;
24465
+ count++;
24466
+ }
24467
+ existingSlugs.add(slug);
24468
+ return slug;
24469
+ }
24470
+ return baseSlug;
24471
+ }
24472
+ function slugify(text) {
24473
+ return createHeadingSlug(text);
24474
+ }
24475
+
24476
+ // src/compositions/markdown/utils/normalizeMarkdown.ts
24477
+ function normalizeMarkdown(markdown, options = {}) {
24478
+ const {
24479
+ removeBom = true,
24480
+ normalizeLineEndings = true,
24481
+ trimStart = false,
24482
+ trimEnd = false,
24483
+ collapseBlankLines = false,
24484
+ finalNewline = false
24485
+ } = options;
24486
+ let value = String(markdown ?? "");
24487
+ if (removeBom) {
24488
+ value = value.replace(/^\uFEFF/, "");
24489
+ }
24490
+ if (normalizeLineEndings) {
24491
+ value = value.replace(/\r\n?/g, "\n");
24492
+ }
24493
+ if (trimStart) {
24494
+ value = value.trimStart();
24495
+ }
24496
+ if (trimEnd) {
24497
+ value = value.trimEnd();
24498
+ }
24499
+ if (collapseBlankLines) {
24500
+ value = value.replace(/\n{3,}/g, "\n\n");
24501
+ }
24502
+ if (finalNewline && value && !value.endsWith("\n")) {
24503
+ value += "\n";
24504
+ }
24505
+ return value;
24506
+ }
24507
+
24508
+ // src/compositions/markdown/utils/extractHeadings.ts
24509
+ function getFenceState(line) {
24510
+ const match = line.match(/^\s{0,3}(`{3,}|~{3,})/);
24511
+ if (!match) return null;
24512
+ const fence = match[1];
24513
+ return {
24514
+ marker: fence[0],
24515
+ length: fence.length
24516
+ };
24517
+ }
24518
+ function closesFence(line, fence) {
24519
+ const match = line.match(/^\s{0,3}(`{3,}|~{3,})\s*$/);
24520
+ if (!match) return false;
24521
+ const closingFence = match[1];
24522
+ return closingFence[0] === fence.marker && closingFence.length >= fence.length;
24523
+ }
24524
+ function isSetextUnderline(line) {
24525
+ if (/^\s{0,3}=+\s*$/.test(line)) {
24526
+ return 1;
24527
+ }
24528
+ if (/^\s{0,3}-+\s*$/.test(line)) {
24529
+ return 2;
24530
+ }
24531
+ return null;
24532
+ }
24533
+ function extractAtxHeading(line) {
24534
+ const match = line.match(/^\s{0,3}(#{1,6})(?:\s+|$)(.*)$/);
24535
+ if (!match) return null;
24536
+ const level = match[1].length;
24537
+ const rawText = match[2].replace(/\s+#+\s*$/, "").trim();
24538
+ return {
24539
+ level,
24540
+ text: sanitizeHeading(rawText)
24541
+ };
24542
+ }
24543
+ function extractHeadings(markdown, options = {}) {
24544
+ const {
24545
+ minDepth = 1,
24546
+ maxDepth = 6,
24547
+ includeSetextHeadings = true,
24548
+ idPrefix = ""
24549
+ } = options;
24550
+ const normalizedMarkdown = normalizeMarkdown(markdown);
24551
+ const lines = normalizedMarkdown.split("\n");
24552
+ const headings = [];
24553
+ const slugCounts = /* @__PURE__ */ new Map();
24554
+ let activeFence = null;
24555
+ for (let index = 0; index < lines.length; index++) {
24556
+ const line = lines[index];
24557
+ const fence = getFenceState(line);
24558
+ if (activeFence) {
24559
+ if (closesFence(line, activeFence)) {
24560
+ activeFence = null;
24561
+ }
24562
+ continue;
24563
+ }
24564
+ if (fence) {
24565
+ activeFence = fence;
24566
+ continue;
24567
+ }
24568
+ const atxHeading = extractAtxHeading(line);
24569
+ if (atxHeading) {
24570
+ const { level, text: text2 } = atxHeading;
24571
+ if (level >= minDepth && level <= maxDepth && text2) {
24572
+ const id = createHeadingSlug(text2, { slugCounts });
24573
+ headings.push({
24574
+ id: `${idPrefix}${id}`,
24575
+ text: text2,
24576
+ level
24577
+ });
24578
+ }
24579
+ continue;
24580
+ }
24581
+ if (!includeSetextHeadings) {
24582
+ continue;
24583
+ }
24584
+ const nextLine = lines[index + 1];
24585
+ if (!nextLine) {
24586
+ continue;
24587
+ }
24588
+ const setextLevel = isSetextUnderline(nextLine);
24589
+ if (!setextLevel) {
24590
+ continue;
24591
+ }
24592
+ const text = sanitizeHeading(line);
24593
+ if (!text) {
24594
+ continue;
24595
+ }
24596
+ if (setextLevel >= minDepth && setextLevel <= maxDepth) {
24597
+ const id = createHeadingSlug(text, { slugCounts });
24598
+ headings.push({
24599
+ id: `${idPrefix}${id}`,
24600
+ text,
24601
+ level: setextLevel
24602
+ });
24603
+ }
24604
+ index++;
24605
+ }
24606
+ return headings;
24607
+ }
24608
+
24609
+ // src/compositions/markdown/utils/generateHeadingNumbers.ts
24610
+ function generateHeadingNumbers(headings, options = {}) {
24611
+ const { minDepth = 1, maxDepth = 6, separator = "." } = options;
24612
+ const counters = [0, 0, 0, 0, 0, 0];
24613
+ return headings.filter((heading) => {
24614
+ return heading.level >= minDepth && heading.level <= maxDepth;
24615
+ }).map((heading) => {
24616
+ const level = Math.min(Math.max(heading.level, 1), 6);
24617
+ counters[level - 1]++;
24618
+ for (let index = level; index < counters.length; index++) {
24619
+ counters[index] = 0;
24620
+ }
24621
+ const numbering = counters.slice(0, level).filter((count) => count > 0).join(separator);
24622
+ return {
24623
+ ...heading,
24624
+ numbering
24625
+ };
24626
+ });
24627
+ }
24628
+ function MarkdownProvider({
24629
+ children,
24630
+ markdown,
24631
+ value,
24632
+ headings: externalHeadings,
24633
+ meta,
24634
+ activeHeading: controlledActiveHeading,
24635
+ defaultActiveHeading = "",
24636
+ onActiveHeadingChange
24637
+ }) {
24638
+ const resolvedMarkdown = value ?? markdown ?? "";
24639
+ const [internalActiveHeading, setInternalActiveHeading] = React2.useState(defaultActiveHeading);
24640
+ const headings = React2.useMemo(() => {
24641
+ if (externalHeadings) {
24642
+ return externalHeadings;
24643
+ }
24644
+ return extractHeadings(resolvedMarkdown);
24645
+ }, [externalHeadings, resolvedMarkdown]);
24646
+ const numberedHeadings = React2.useMemo(() => {
24647
+ return generateHeadingNumbers(headings);
24648
+ }, [headings]);
24649
+ const headingMap = React2.useMemo(() => {
24650
+ return headings.reduce((acc, heading) => {
24651
+ acc[heading.id] = heading;
24652
+ return acc;
24653
+ }, {});
24654
+ }, [headings]);
24655
+ const activeHeading = controlledActiveHeading ?? internalActiveHeading;
24656
+ const getHeadingById = React2.useCallback(
24657
+ (id) => {
24658
+ return headingMap[id];
24659
+ },
24660
+ [headingMap]
24661
+ );
24662
+ const setActiveHeading = React2.useCallback(
24663
+ (id) => {
24664
+ if (controlledActiveHeading === void 0) {
24665
+ setInternalActiveHeading(id);
24666
+ }
24667
+ onActiveHeadingChange?.(id, headingMap[id]);
24668
+ },
24669
+ [controlledActiveHeading, headingMap, onActiveHeadingChange]
24670
+ );
24671
+ const contextValue = React2.useMemo(
24672
+ () => ({
24673
+ markdown: resolvedMarkdown,
24674
+ headings,
24675
+ numberedHeadings,
24676
+ activeHeading,
24677
+ setActiveHeading,
24678
+ meta,
24679
+ getHeadingById
24680
+ }),
24681
+ [
24682
+ resolvedMarkdown,
24683
+ headings,
24684
+ numberedHeadings,
24685
+ activeHeading,
24686
+ setActiveHeading,
24687
+ meta,
24688
+ getHeadingById
24689
+ ]
24690
+ );
24691
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownContext.Provider, { value: contextValue, children });
24692
+ }
24693
+ var MarkdownProvider_default = MarkdownProvider;
24694
+ function useMarkdown(options = {}) {
24695
+ const { required = false, errorMessage } = options;
24696
+ const context = React2.useContext(MarkdownContext);
24697
+ if (!context && required) {
24698
+ throw new Error(
24699
+ errorMessage || "useMarkdown must be used inside a MarkdownProvider."
24700
+ );
24701
+ }
24702
+ return context;
24703
+ }
24704
+ function useActiveHeading(options = {}) {
24705
+ const context = useMarkdown();
24706
+ const {
24707
+ headings: externalHeadings,
24708
+ activeHeading: controlledActiveHeading,
24709
+ defaultActiveHeading = "",
24710
+ enabled = true,
24711
+ root = null,
24712
+ rootMargin = "-20% 0px -70% 0px",
24713
+ threshold = 0,
24714
+ scrollBehavior = "smooth",
24715
+ scrollBlock = "start",
24716
+ onActiveHeadingChange
24717
+ } = options;
24718
+ const headings = externalHeadings ?? context?.headings ?? [];
24719
+ const [internalActiveHeading, setInternalActiveHeading] = React2.useState(defaultActiveHeading);
24720
+ const activeHeading = controlledActiveHeading ?? context?.activeHeading ?? internalActiveHeading;
24721
+ const headingMap = React2.useMemo(() => {
24722
+ return headings.reduce((acc, heading) => {
24723
+ acc[heading.id] = heading;
24724
+ return acc;
24725
+ }, {});
24726
+ }, [headings]);
24727
+ const setActiveHeading = React2.useCallback(
24728
+ (id) => {
24729
+ if (controlledActiveHeading === void 0 && !context) {
24730
+ setInternalActiveHeading(id);
24731
+ }
24732
+ context?.setActiveHeading(id);
24733
+ onActiveHeadingChange?.(id, headingMap[id]);
24734
+ },
24735
+ [context, controlledActiveHeading, headingMap, onActiveHeadingChange]
24736
+ );
24737
+ const scrollToHeading = React2.useCallback(
24738
+ (id) => {
24739
+ if (typeof document === "undefined") return;
24740
+ const element = document.getElementById(id);
24741
+ if (!element) return;
24742
+ element.scrollIntoView({
24743
+ behavior: scrollBehavior,
24744
+ block: scrollBlock
24745
+ });
24746
+ setActiveHeading(id);
24747
+ },
24748
+ [scrollBehavior, scrollBlock, setActiveHeading]
24749
+ );
24750
+ const observedHeadingIds = React2.useMemo(() => {
24751
+ return headings.map((heading) => heading.id).join("|");
24752
+ }, [headings]);
24753
+ React2.useEffect(() => {
24754
+ if (!enabled) return;
24755
+ if (typeof window === "undefined") return;
24756
+ if (!("IntersectionObserver" in window)) return;
24757
+ if (headings.length === 0) return;
24758
+ const elements = headings.map((heading) => document.getElementById(heading.id)).filter((element) => Boolean(element));
24759
+ if (elements.length === 0) return;
24760
+ const observer = new IntersectionObserver(
24761
+ (entries) => {
24762
+ const visibleEntries = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
24763
+ const nextActiveId = visibleEntries[0]?.target.id;
24764
+ if (!nextActiveId) return;
24765
+ setActiveHeading(nextActiveId);
24766
+ },
24767
+ {
24768
+ root,
24769
+ rootMargin,
24770
+ threshold
24771
+ }
24772
+ );
24773
+ elements.forEach((element) => {
24774
+ observer.observe(element);
24775
+ });
24776
+ return () => {
24777
+ observer.disconnect();
24778
+ };
24779
+ }, [
24780
+ enabled,
24781
+ root,
24782
+ rootMargin,
24783
+ threshold,
24784
+ observedHeadingIds,
24785
+ headings,
24786
+ setActiveHeading
24787
+ ]);
24788
+ return {
24789
+ activeHeading,
24790
+ setActiveHeading,
24791
+ scrollToHeading
24792
+ };
24793
+ }
24794
+ function useMarkdownHeadings(options = {}) {
24795
+ const context = useMarkdown();
24796
+ const {
24797
+ markdown,
24798
+ headings: externalHeadings,
24799
+ minDepth = 1,
24800
+ maxDepth = 6
24801
+ } = options;
24802
+ const baseHeadings = React2.useMemo(() => {
24803
+ if (externalHeadings) {
24804
+ return externalHeadings;
24805
+ }
24806
+ if (markdown !== void 0) {
24807
+ return extractHeadings(markdown);
24808
+ }
24809
+ return context?.headings ?? [];
24810
+ }, [context?.headings, externalHeadings, markdown]);
24811
+ const headings = React2.useMemo(() => {
24812
+ return baseHeadings.filter((heading) => {
24813
+ return heading.level >= minDepth && heading.level <= maxDepth;
24814
+ });
24815
+ }, [baseHeadings, minDepth, maxDepth]);
24816
+ const numberedHeadings = React2.useMemo(() => {
24817
+ return generateHeadingNumbers(headings);
24818
+ }, [headings]);
24819
+ const headingMap = React2.useMemo(() => {
24820
+ return headings.reduce((acc, heading) => {
24821
+ acc[heading.id] = heading;
24822
+ return acc;
24823
+ }, {});
24824
+ }, [headings]);
24825
+ const getHeadingById = (id) => {
24826
+ return headingMap[id];
24827
+ };
24828
+ return {
24829
+ headings,
24830
+ numberedHeadings,
24831
+ hasHeadings: headings.length > 0,
24832
+ getHeadingById
24833
+ };
24834
+ }
24835
+ function MarkdownHeading({
24836
+ id,
24837
+ level,
24838
+ children,
24839
+ className,
24840
+ showAnchor = true,
24841
+ ...props
24842
+ }) {
24843
+ const tag = `h${Math.min(Math.max(level, 1), 6)}`;
24844
+ return React2__default.default.createElement(
24845
+ tag,
24846
+ {
24847
+ ...props,
24848
+ id,
24849
+ className: classNames66__default.default("eui-markdown-heading", className)
24850
+ },
24851
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24852
+ children,
24853
+ showAnchor && id ? /* @__PURE__ */ jsxRuntime.jsx(
24854
+ "a",
24855
+ {
24856
+ href: `#${id}`,
24857
+ className: "eui-markdown-heading-anchor",
24858
+ "aria-label": "Link to heading",
24859
+ children: "#"
24860
+ }
24861
+ ) : null
24862
+ ] })
24863
+ );
24864
+ }
24865
+ var MarkdownHeading_default = MarkdownHeading;
24866
+ reactSyntaxHighlighter.PrismLight.registerLanguage("bash", bash__default.default);
24867
+ reactSyntaxHighlighter.PrismLight.registerLanguage("shell", bash__default.default);
24868
+ reactSyntaxHighlighter.PrismLight.registerLanguage("sh", bash__default.default);
24869
+ reactSyntaxHighlighter.PrismLight.registerLanguage("zsh", bash__default.default);
24870
+ reactSyntaxHighlighter.PrismLight.registerLanguage("c", c__default.default);
24871
+ reactSyntaxHighlighter.PrismLight.registerLanguage("cpp", cpp__default.default);
24872
+ reactSyntaxHighlighter.PrismLight.registerLanguage("c++", cpp__default.default);
24873
+ reactSyntaxHighlighter.PrismLight.registerLanguage("css", css__default.default);
24874
+ reactSyntaxHighlighter.PrismLight.registerLanguage("scss", scss__default.default);
24875
+ reactSyntaxHighlighter.PrismLight.registerLanguage("go", go__default.default);
24876
+ reactSyntaxHighlighter.PrismLight.registerLanguage("java", java__default.default);
24877
+ reactSyntaxHighlighter.PrismLight.registerLanguage("js", javascript__default.default);
24878
+ reactSyntaxHighlighter.PrismLight.registerLanguage("javascript", javascript__default.default);
24879
+ reactSyntaxHighlighter.PrismLight.registerLanguage("jsx", jsx210__default.default);
24880
+ reactSyntaxHighlighter.PrismLight.registerLanguage("json", json__default.default);
24881
+ reactSyntaxHighlighter.PrismLight.registerLanguage("html", markup__default.default);
24882
+ reactSyntaxHighlighter.PrismLight.registerLanguage("xml", markup__default.default);
24883
+ reactSyntaxHighlighter.PrismLight.registerLanguage("markup", markup__default.default);
24884
+ reactSyntaxHighlighter.PrismLight.registerLanguage("py", python__default.default);
24885
+ reactSyntaxHighlighter.PrismLight.registerLanguage("python", python__default.default);
24886
+ reactSyntaxHighlighter.PrismLight.registerLanguage("rs", rust__default.default);
24887
+ reactSyntaxHighlighter.PrismLight.registerLanguage("rust", rust__default.default);
24888
+ reactSyntaxHighlighter.PrismLight.registerLanguage("sql", sql__default.default);
24889
+ reactSyntaxHighlighter.PrismLight.registerLanguage("ts", typescript__default.default);
24890
+ reactSyntaxHighlighter.PrismLight.registerLanguage("typescript", typescript__default.default);
24891
+ reactSyntaxHighlighter.PrismLight.registerLanguage("tsx", tsx__default.default);
24892
+ reactSyntaxHighlighter.PrismLight.registerLanguage("yaml", yaml__default.default);
24893
+ reactSyntaxHighlighter.PrismLight.registerLanguage("yml", yaml__default.default);
24894
+ var LANGUAGE_ALIASES = {
24895
+ js: "javascript",
24896
+ ts: "typescript",
24897
+ py: "python",
24898
+ sh: "bash",
24899
+ shell: "bash",
24900
+ zsh: "bash",
24901
+ yml: "yaml",
24902
+ html: "markup",
24903
+ xml: "markup",
24904
+ "c++": "cpp",
24905
+ text: "text",
24906
+ txt: "text",
24907
+ plain: "text",
24908
+ plaintext: "text"
24909
+ };
24910
+ function normalizeLanguage(language) {
24911
+ if (!language) return "text";
24912
+ const normalized = language.toLowerCase().trim();
24913
+ return LANGUAGE_ALIASES[normalized] ?? normalized;
24914
+ }
24915
+ function MarkdownCodeBlock({
24916
+ code,
24917
+ language,
24918
+ meta,
24919
+ className,
24920
+ showCopy = true,
24921
+ wrapLongLines = false,
24922
+ ...props
24923
+ }) {
24924
+ const [copied, setCopied] = React2.useState(false);
24925
+ const timeoutRef = React2.useRef(null);
24926
+ const title = meta?.title ?? meta?.filename;
24927
+ const resolvedLanguage = React2.useMemo(() => {
24928
+ return normalizeLanguage(language);
24929
+ }, [language]);
24930
+ const languageLabel = language || resolvedLanguage;
24931
+ const showHeader = Boolean(title || languageLabel || showCopy);
24932
+ const highlightLines = React2.useMemo(() => {
24933
+ return new Set(meta?.highlightLines ?? []);
24934
+ }, [meta?.highlightLines]);
24935
+ const showLineNumbers = Boolean(meta?.showLineNumbers);
24936
+ React2.useEffect(() => {
24937
+ return () => {
24938
+ if (timeoutRef.current) {
24939
+ window.clearTimeout(timeoutRef.current);
24940
+ }
24941
+ };
24942
+ }, []);
24943
+ const copyCode = async () => {
24944
+ if (typeof navigator === "undefined") return;
24945
+ if (!navigator.clipboard) return;
24946
+ await navigator.clipboard.writeText(code);
24947
+ setCopied(true);
24948
+ if (timeoutRef.current) {
24949
+ window.clearTimeout(timeoutRef.current);
24950
+ }
24951
+ timeoutRef.current = window.setTimeout(() => {
24952
+ setCopied(false);
24953
+ }, 1500);
24954
+ };
24955
+ const lineNumberStyle = {
24956
+ minWidth: "3rem",
24957
+ paddingRight: "1rem",
24958
+ color: "rgb(100 116 139)",
24959
+ textAlign: "right",
24960
+ userSelect: "none"
24961
+ };
24962
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props, className: classNames66__default.default("eui-markdown-code", className), children: [
24963
+ showHeader ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "eui-markdown-code-header", children: [
24964
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "eui-markdown-code-header-main", children: [
24965
+ title ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-code-title", children: title }) : null,
24966
+ languageLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-code-language", children: languageLabel }) : null
24967
+ ] }),
24968
+ showCopy ? /* @__PURE__ */ jsxRuntime.jsx(
24969
+ "button",
24970
+ {
24971
+ type: "button",
24972
+ className: "eui-markdown-copy-button",
24973
+ onClick: copyCode,
24974
+ children: copied ? "Copied" : "Copy"
24975
+ }
24976
+ ) : null
24977
+ ] }) : null,
24978
+ /* @__PURE__ */ jsxRuntime.jsx(
24979
+ reactSyntaxHighlighter.PrismLight,
24980
+ {
24981
+ className: "eui-markdown-code-highlighter",
24982
+ language: resolvedLanguage,
24983
+ style: prism.vscDarkPlus,
24984
+ showLineNumbers,
24985
+ wrapLines: highlightLines.size > 0,
24986
+ wrapLongLines,
24987
+ PreTag: "pre",
24988
+ CodeTag: "code",
24989
+ customStyle: {
24990
+ margin: 0,
24991
+ padding: "1rem",
24992
+ background: "transparent",
24993
+ fontSize: "0.875rem",
24994
+ lineHeight: 1.7
24995
+ },
24996
+ codeTagProps: {
24997
+ style: {
24998
+ fontFamily: '"JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'
24999
+ }
25000
+ },
25001
+ lineNumberStyle,
25002
+ lineProps: (lineNumber) => {
25003
+ const highlighted = highlightLines.has(lineNumber);
25004
+ return {
25005
+ className: highlighted ? "eui-markdown-code-line-highlighted" : void 0,
25006
+ style: {
25007
+ display: "block",
25008
+ background: highlighted ? "rgba(250, 204, 21, 0.12)" : void 0
25009
+ }
25010
+ };
25011
+ },
25012
+ children: code
25013
+ }
25014
+ )
25015
+ ] });
25016
+ }
25017
+ var MarkdownCodeBlock_default = MarkdownCodeBlock;
25018
+ function MarkdownInlineCode({
25019
+ children,
25020
+ className,
25021
+ ...props
25022
+ }) {
25023
+ return /* @__PURE__ */ jsxRuntime.jsx(
25024
+ "code",
25025
+ {
25026
+ ...props,
25027
+ className: classNames66__default.default("eui-markdown-inline-code", className),
25028
+ children
25029
+ }
25030
+ );
25031
+ }
25032
+ var MarkdownInlineCode_default = MarkdownInlineCode;
25033
+ function isExternalHref(href) {
25034
+ if (!href) return false;
25035
+ return /^https?:\/\//i.test(href);
25036
+ }
25037
+ function getSafeHref(href) {
25038
+ if (!href) return void 0;
25039
+ const trimmed = href.trim();
25040
+ const isSafe = trimmed.startsWith("#") || trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || /^https?:\/\//i.test(trimmed) || /^mailto:/i.test(trimmed) || /^tel:/i.test(trimmed);
25041
+ return isSafe ? trimmed : void 0;
25042
+ }
25043
+ function MarkdownLink({
25044
+ href,
25045
+ target,
25046
+ children,
25047
+ className,
25048
+ openLinksInNewTab = true,
25049
+ ...props
25050
+ }) {
25051
+ const safeHref = getSafeHref(href);
25052
+ if (!safeHref) {
25053
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children });
25054
+ }
25055
+ const external = isExternalHref(safeHref);
25056
+ const resolvedTarget = target ?? (openLinksInNewTab && external ? "_blank" : void 0);
25057
+ const rel = resolvedTarget === "_blank" ? "noopener noreferrer" : props.rel;
25058
+ return /* @__PURE__ */ jsxRuntime.jsx(
25059
+ "a",
25060
+ {
25061
+ ...props,
25062
+ href: safeHref,
25063
+ target: resolvedTarget,
25064
+ rel,
25065
+ className: classNames66__default.default("eui-markdown-link", className),
25066
+ children
25067
+ }
25068
+ );
25069
+ }
25070
+ var MarkdownLink_default = MarkdownLink;
25071
+ function getSafeImageSrc(src) {
25072
+ if (!src) return void 0;
25073
+ const trimmed = src.trim();
25074
+ const isSafe = trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || /^https?:\/\//i.test(trimmed) || /^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,/i.test(trimmed);
25075
+ return isSafe ? trimmed : void 0;
25076
+ }
25077
+ function MarkdownImage({
25078
+ src,
25079
+ alt,
25080
+ title,
25081
+ className,
25082
+ ...props
25083
+ }) {
25084
+ const safeSrc = getSafeImageSrc(src);
25085
+ if (!safeSrc) {
25086
+ return null;
25087
+ }
25088
+ return /* @__PURE__ */ jsxRuntime.jsx(
25089
+ "img",
25090
+ {
25091
+ ...props,
25092
+ src: safeSrc,
25093
+ alt: alt ?? "",
25094
+ title,
25095
+ loading: "lazy",
25096
+ decoding: "async",
25097
+ className: classNames66__default.default("eui-markdown-image", className)
25098
+ }
25099
+ );
25100
+ }
25101
+ var MarkdownImage_default = MarkdownImage;
25102
+ function MarkdownTable({
25103
+ children,
25104
+ className,
25105
+ ...props
25106
+ }) {
25107
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-table-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, className: classNames66__default.default("eui-markdown-table", className), children }) });
25108
+ }
25109
+ function MarkdownTableCell({
25110
+ children,
25111
+ className,
25112
+ ...props
25113
+ }) {
25114
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props, className: classNames66__default.default("eui-markdown-table-cell", className), children });
25115
+ }
25116
+ function MarkdownTableHeaderCell({
25117
+ children,
25118
+ className,
25119
+ ...props
25120
+ }) {
25121
+ return /* @__PURE__ */ jsxRuntime.jsx(
25122
+ "th",
25123
+ {
25124
+ ...props,
25125
+ className: classNames66__default.default("eui-markdown-table-header-cell", className),
25126
+ children
25127
+ }
25128
+ );
25129
+ }
25130
+ var MarkdownTable_default = MarkdownTable;
25131
+ function MarkdownBlockquote({
25132
+ children,
25133
+ className,
25134
+ ...props
25135
+ }) {
25136
+ return /* @__PURE__ */ jsxRuntime.jsx(
25137
+ "blockquote",
25138
+ {
25139
+ ...props,
25140
+ className: classNames66__default.default("eui-markdown-blockquote", className),
25141
+ children
25142
+ }
25143
+ );
25144
+ }
25145
+ var MarkdownBlockquote_default = MarkdownBlockquote;
25146
+ function getTextContent(node) {
25147
+ if (typeof node === "string" || typeof node === "number") {
25148
+ return String(node);
25149
+ }
25150
+ if (Array.isArray(node)) {
25151
+ return node.map(getTextContent).join("");
25152
+ }
25153
+ if (React2.isValidElement(node)) {
25154
+ return getTextContent(node.props.children);
25155
+ }
25156
+ return "";
25157
+ }
25158
+ function createHeadingKey(level, text) {
25159
+ return `${level}:${sanitizeHeading(text)}`;
25160
+ }
25161
+ function parseNumberRanges(value) {
25162
+ if (!value) return [];
25163
+ const normalized = value.replace(/[{}[\]\s]/g, "");
25164
+ if (!normalized) return [];
25165
+ const values = /* @__PURE__ */ new Set();
25166
+ normalized.split(",").forEach((part) => {
25167
+ if (!part) return;
25168
+ const rangeMatch = part.match(/^(\d+)-(\d+)$/);
25169
+ if (rangeMatch) {
25170
+ const start = Number(rangeMatch[1]);
25171
+ const end = Number(rangeMatch[2]);
25172
+ for (let line2 = start; line2 <= end; line2++) {
25173
+ values.add(line2);
25174
+ }
25175
+ return;
25176
+ }
25177
+ const line = Number(part);
25178
+ if (!Number.isNaN(line)) {
25179
+ values.add(line);
25180
+ }
25181
+ });
25182
+ return Array.from(values).sort((a, b) => a - b);
25183
+ }
25184
+ function parseCodeMeta(metaString) {
25185
+ if (!metaString) return void 0;
25186
+ const filenameMatch = metaString.match(
25187
+ /(?:filename|file)=["']?([^"'\s]+)["']?/
25188
+ );
25189
+ const titleMatch = metaString.match(/(?:title)=["']?([^"']+)["']?/);
25190
+ const highlightMatch = metaString.match(/(?:highlight|lines)=["']?([^"'\s]+)["']?/) || metaString.match(/{([^}]+)}/);
25191
+ return {
25192
+ filename: filenameMatch?.[1],
25193
+ title: titleMatch?.[1],
25194
+ showLineNumbers: /\b(showLineNumbers|lineNumbers|line-numbers)\b/.test(
25195
+ metaString
25196
+ ),
25197
+ highlightLines: parseNumberRanges(highlightMatch?.[1])
25198
+ };
25199
+ }
25200
+ function getCodeMetaString(node) {
25201
+ const value = node;
25202
+ return value?.data?.meta || value?.data?.hProperties?.meta || value?.properties?.meta || value?.properties?.dataMeta || value?.meta;
25203
+ }
25204
+ function getLanguageFromClassName(className) {
25205
+ if (!className) return void 0;
25206
+ const match = className.match(/language-([^\s]+)/);
25207
+ return match?.[1];
25208
+ }
25209
+ function getCodeInfoFromPreChildren(children) {
25210
+ const childArray = React2__default.default.Children.toArray(children);
25211
+ const codeElement = childArray.find((child) => {
25212
+ if (!React2.isValidElement(child)) return false;
25213
+ return child.type === "code";
25214
+ });
25215
+ const codeProps = codeElement?.props;
25216
+ const code = getTextContent(codeProps?.children ?? children).replace(
25217
+ /\n$/,
25218
+ ""
25219
+ );
25220
+ const language = getLanguageFromClassName(codeProps?.className);
25221
+ const meta = parseCodeMeta(codeProps?.["data-meta"]);
25222
+ return {
25223
+ code,
25224
+ language,
25225
+ meta
25226
+ };
25227
+ }
25228
+ function MarkdownRenderer({
25229
+ markdown,
25230
+ headings = [],
25231
+ headingIdPrefix = "",
25232
+ components,
25233
+ className,
25234
+ contentClassName,
25235
+ openLinksInNewTab = true,
25236
+ linkTarget,
25237
+ enableGfm = true,
25238
+ allowHtml = false,
25239
+ sanitizeHtml = true,
25240
+ showCopyCode = true,
25241
+ showHeadingAnchors = true
25242
+ }) {
25243
+ const headingQueues = /* @__PURE__ */ new Map();
25244
+ headings.forEach((heading) => {
25245
+ const key = createHeadingKey(heading.level, heading.text);
25246
+ const queue = headingQueues.get(key) ?? [];
25247
+ queue.push(heading.id);
25248
+ headingQueues.set(key, queue);
25249
+ });
25250
+ const headingUsage = /* @__PURE__ */ new Map();
25251
+ const fallbackSlugCounts = /* @__PURE__ */ new Map();
25252
+ const resolveHeadingId = (level, children) => {
25253
+ const text = getTextContent(children);
25254
+ const key = createHeadingKey(level, text);
25255
+ const queue = headingQueues.get(key);
25256
+ if (queue?.length) {
25257
+ const usedCount = headingUsage.get(key) ?? 0;
25258
+ headingUsage.set(key, usedCount + 1);
25259
+ const existingId = queue[usedCount];
25260
+ if (existingId) {
25261
+ return existingId;
25262
+ }
25263
+ }
25264
+ return `${headingIdPrefix}${createHeadingSlug(text, {
25265
+ slugCounts: fallbackSlugCounts
25266
+ })}`;
25267
+ };
25268
+ const remarkPlugins = [];
25269
+ if (enableGfm) {
25270
+ remarkPlugins.push(remarkGfm__default.default);
25271
+ }
25272
+ const rehypePlugins = [];
25273
+ if (allowHtml) {
25274
+ rehypePlugins.push(rehypeRaw__default.default);
25275
+ if (sanitizeHtml) {
25276
+ rehypePlugins.push(rehypeSanitize__default.default);
25277
+ }
25278
+ }
25279
+ const rendererComponents = {
25280
+ h1: ({ node: _node, children, ...rest }) => {
25281
+ const Component = components?.h1 ?? MarkdownHeading_default;
25282
+ return /* @__PURE__ */ jsxRuntime.jsx(
25283
+ Component,
25284
+ {
25285
+ ...rest,
25286
+ id: resolveHeadingId(1, children),
25287
+ level: 1,
25288
+ showAnchor: showHeadingAnchors,
25289
+ children
25290
+ }
25291
+ );
25292
+ },
25293
+ h2: ({ node: _node, children, ...rest }) => {
25294
+ const Component = components?.h2 ?? MarkdownHeading_default;
25295
+ return /* @__PURE__ */ jsxRuntime.jsx(
25296
+ Component,
25297
+ {
25298
+ ...rest,
25299
+ id: resolveHeadingId(2, children),
25300
+ level: 2,
25301
+ showAnchor: showHeadingAnchors,
25302
+ children
25303
+ }
25304
+ );
25305
+ },
25306
+ h3: ({ node: _node, children, ...rest }) => {
25307
+ const Component = components?.h3 ?? MarkdownHeading_default;
25308
+ return /* @__PURE__ */ jsxRuntime.jsx(
25309
+ Component,
25310
+ {
25311
+ ...rest,
25312
+ id: resolveHeadingId(3, children),
25313
+ level: 3,
25314
+ showAnchor: showHeadingAnchors,
25315
+ children
25316
+ }
25317
+ );
25318
+ },
25319
+ h4: ({ node: _node, children, ...rest }) => {
25320
+ const Component = components?.h4 ?? MarkdownHeading_default;
25321
+ return /* @__PURE__ */ jsxRuntime.jsx(
25322
+ Component,
25323
+ {
25324
+ ...rest,
25325
+ id: resolveHeadingId(4, children),
25326
+ level: 4,
25327
+ showAnchor: showHeadingAnchors,
25328
+ children
25329
+ }
25330
+ );
25331
+ },
25332
+ h5: ({ node: _node, children, ...rest }) => {
25333
+ const Component = components?.h5 ?? MarkdownHeading_default;
25334
+ return /* @__PURE__ */ jsxRuntime.jsx(
25335
+ Component,
25336
+ {
25337
+ ...rest,
25338
+ id: resolveHeadingId(5, children),
25339
+ level: 5,
25340
+ showAnchor: showHeadingAnchors,
25341
+ children
25342
+ }
25343
+ );
25344
+ },
25345
+ h6: ({ node: _node, children, ...rest }) => {
25346
+ const Component = components?.h6 ?? MarkdownHeading_default;
25347
+ return /* @__PURE__ */ jsxRuntime.jsx(
25348
+ Component,
25349
+ {
25350
+ ...rest,
25351
+ id: resolveHeadingId(6, children),
25352
+ level: 6,
25353
+ showAnchor: showHeadingAnchors,
25354
+ children
25355
+ }
25356
+ );
25357
+ },
25358
+ /**
25359
+ * Important:
25360
+ * For block code, return a native <code> with className="language-*".
25361
+ * Then the pre renderer can reliably extract language + meta.
25362
+ */
25363
+ code: ({ node, className: className2, children, ...rest }) => {
25364
+ const language = getLanguageFromClassName(className2);
25365
+ if (language) {
25366
+ return /* @__PURE__ */ jsxRuntime.jsx(
25367
+ "code",
25368
+ {
25369
+ ...rest,
25370
+ className: className2,
25371
+ "data-meta": getCodeMetaString(node),
25372
+ children
25373
+ }
25374
+ );
25375
+ }
25376
+ const Component = components?.code ?? MarkdownInlineCode_default;
25377
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, className: className2, children });
25378
+ },
25379
+ /**
25380
+ * Do not spread rest here.
25381
+ * React-markdown's pre props are HTMLPreElement props.
25382
+ * MarkdownCodeBlock root is a div.
25383
+ */
25384
+ pre: ({ node: _node, children }) => {
25385
+ const Component = components?.pre ?? MarkdownCodeBlock_default;
25386
+ const { code, language, meta } = getCodeInfoFromPreChildren(children);
25387
+ return /* @__PURE__ */ jsxRuntime.jsx(
25388
+ Component,
25389
+ {
25390
+ code,
25391
+ language,
25392
+ meta,
25393
+ showCopy: showCopyCode
25394
+ }
25395
+ );
25396
+ },
25397
+ a: ({ node: _node, children, href, target, ...rest }) => {
25398
+ const Component = components?.a ?? MarkdownLink_default;
25399
+ return /* @__PURE__ */ jsxRuntime.jsx(
25400
+ Component,
25401
+ {
25402
+ ...rest,
25403
+ href,
25404
+ target: linkTarget ?? target,
25405
+ openLinksInNewTab,
25406
+ children
25407
+ }
25408
+ );
25409
+ },
25410
+ img: ({ node: _node, src, alt, title, ...rest }) => {
25411
+ const Component = components?.img ?? MarkdownImage_default;
25412
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, src, alt, title });
25413
+ },
25414
+ table: ({ node: _node, children, ...rest }) => {
25415
+ const Component = components?.table ?? MarkdownTable_default;
25416
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25417
+ },
25418
+ td: ({ node: _node, children, ...rest }) => {
25419
+ const Component = components?.td ?? MarkdownTableCell;
25420
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25421
+ },
25422
+ th: ({ node: _node, children, ...rest }) => {
25423
+ const Component = components?.th ?? MarkdownTableHeaderCell;
25424
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25425
+ },
25426
+ blockquote: ({ node: _node, children, ...rest }) => {
25427
+ const Component = components?.blockquote ?? MarkdownBlockquote_default;
25428
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25429
+ },
25430
+ ...components
25431
+ };
25432
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default("eui-markdown markdown-body", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
25433
+ ReactMarkdown__default.default,
25434
+ {
25435
+ remarkPlugins,
25436
+ rehypePlugins,
25437
+ skipHtml: !allowHtml,
25438
+ components: rendererComponents,
25439
+ children: markdown
25440
+ }
25441
+ ) }) });
25442
+ }
25443
+ var MarkdownRenderer_default = MarkdownRenderer;
25444
+ function MarkdownViewer({
25445
+ value,
25446
+ headings: externalHeadings,
25447
+ headingIdPrefix = "",
25448
+ enableActiveHeading = true,
25449
+ ...props
25450
+ }) {
25451
+ const context = useMarkdown();
25452
+ const markdown = value ?? context?.markdown ?? "";
25453
+ const headings = React2.useMemo(() => {
25454
+ if (externalHeadings) {
25455
+ return externalHeadings;
25456
+ }
25457
+ if (context?.headings?.length) {
25458
+ return context.headings;
25459
+ }
25460
+ return extractHeadings(markdown, {
25461
+ idPrefix: headingIdPrefix
25462
+ });
25463
+ }, [context?.headings, externalHeadings, headingIdPrefix, markdown]);
25464
+ useActiveHeading({
25465
+ headings,
25466
+ enabled: enableActiveHeading && headings.length > 0
25467
+ });
25468
+ return /* @__PURE__ */ jsxRuntime.jsx(
25469
+ MarkdownRenderer_default,
25470
+ {
25471
+ markdown,
25472
+ headings,
25473
+ headingIdPrefix,
25474
+ ...props
25475
+ }
25476
+ );
25477
+ }
25478
+ var MarkdownViewer_default = MarkdownViewer;
25479
+ function hasNumbering(heading) {
25480
+ return "numbering" in heading;
25481
+ }
25482
+ function MarkdownTOCItem({
25483
+ heading,
25484
+ active = false,
25485
+ numbered = true,
25486
+ sanitizeLabel = true,
25487
+ indentSize = 12,
25488
+ className,
25489
+ activeClassName,
25490
+ inactiveClassName,
25491
+ onSelect
25492
+ }) {
25493
+ const label = sanitizeLabel ? sanitizeHeading(heading.text) : heading.text;
25494
+ const numbering = hasNumbering(heading) ? heading.numbering : void 0;
25495
+ return /* @__PURE__ */ jsxRuntime.jsxs(
25496
+ "button",
25497
+ {
25498
+ type: "button",
25499
+ onClick: () => onSelect?.(heading),
25500
+ "aria-current": active ? "location" : void 0,
25501
+ title: label,
25502
+ className: classNames66__default.default(
25503
+ "eui-markdown-toc-item",
25504
+ "block w-full text-left text-sm transition-all ease-in-out duration-150",
25505
+ "hover:text-primary",
25506
+ active ? classNames66__default.default("text-primary font-semibold underline", activeClassName) : classNames66__default.default("text-gray-500 dark:text-gray-400", inactiveClassName),
25507
+ className
25508
+ ),
25509
+ style: {
25510
+ paddingLeft: `${Math.max(heading.level - 1, 0) * indentSize}px`
25511
+ },
25512
+ children: [
25513
+ numbered && numbering ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eui-markdown-toc-item-number mr-2 opacity-70", children: numbering }) : null,
25514
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eui-markdown-toc-item-label", children: label })
25515
+ ]
25516
+ }
25517
+ );
25518
+ }
25519
+ var MarkdownTOCItem_default = MarkdownTOCItem;
25520
+ function MarkdownTOC({
25521
+ title = "Table of Contents",
25522
+ markdown,
25523
+ headings: externalHeadings,
25524
+ minDepth = 1,
25525
+ maxDepth = 6,
25526
+ numbered = true,
25527
+ sanitizeLabels = true,
25528
+ collapsible = false,
25529
+ defaultCollapsed = false,
25530
+ emptyState = null,
25531
+ smoothScroll = true,
25532
+ scrollBlock = "start",
25533
+ indentSize = 12,
25534
+ className,
25535
+ titleClassName,
25536
+ listClassName,
25537
+ itemClassName,
25538
+ activeItemClassName,
25539
+ inactiveItemClassName,
25540
+ activeHeading: controlledActiveHeading,
25541
+ onActiveHeadingChange,
25542
+ onHeadingClick
25543
+ }) {
25544
+ const context = useMarkdown();
25545
+ const [collapsed, setCollapsed] = React2.useState(defaultCollapsed);
25546
+ const { headings, numberedHeadings, hasHeadings } = useMarkdownHeadings({
25547
+ markdown,
25548
+ headings: externalHeadings,
25549
+ minDepth,
25550
+ maxDepth
25551
+ });
25552
+ const tocHeadings = React2.useMemo(() => {
25553
+ return numbered ? numberedHeadings : headings;
25554
+ }, [headings, numbered, numberedHeadings]);
25555
+ const { activeHeading, scrollToHeading, setActiveHeading } = useActiveHeading(
25556
+ {
25557
+ headings,
25558
+ enabled: false,
25559
+ activeHeading: controlledActiveHeading,
25560
+ scrollBehavior: smoothScroll ? "smooth" : "auto",
25561
+ scrollBlock,
25562
+ onActiveHeadingChange
25563
+ }
25564
+ );
25565
+ if (!context && !markdown && !externalHeadings) {
25566
+ return null;
25567
+ }
25568
+ if (!hasHeadings) {
25569
+ return emptyState ? /* @__PURE__ */ jsxRuntime.jsx(
25570
+ "div",
25571
+ {
25572
+ className: classNames66__default.default(
25573
+ "eui-markdown-toc",
25574
+ "text-sm text-gray-500 dark:text-gray-400",
25575
+ className
25576
+ ),
25577
+ children: emptyState
25578
+ }
25579
+ ) : null;
25580
+ }
25581
+ const handleSelect = (heading) => {
25582
+ scrollToHeading(heading.id);
25583
+ setActiveHeading(heading.id);
25584
+ onHeadingClick?.(heading);
25585
+ };
25586
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
25587
+ title ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-toc-header", children: collapsible ? /* @__PURE__ */ jsxRuntime.jsxs(
25588
+ "button",
25589
+ {
25590
+ type: "button",
25591
+ onClick: () => setCollapsed((value) => !value),
25592
+ className: classNames66__default.default(
25593
+ "eui-markdown-toc-title",
25594
+ "flex w-full items-center justify-between gap-2 text-left",
25595
+ "text-sm font-semibold uppercase tracking-wide",
25596
+ "text-gray-900 dark:text-gray-100",
25597
+ titleClassName
25598
+ ),
25599
+ "aria-expanded": !collapsed,
25600
+ children: [
25601
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
25602
+ /* @__PURE__ */ jsxRuntime.jsx(
25603
+ "span",
25604
+ {
25605
+ className: classNames66__default.default(
25606
+ "text-xs opacity-60 transition-transform duration-150",
25607
+ !collapsed && "rotate-90"
25608
+ ),
25609
+ "aria-hidden": "true",
25610
+ children: "\u203A"
25611
+ }
25612
+ )
25613
+ ]
25614
+ }
25615
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
25616
+ "h2",
25617
+ {
25618
+ className: classNames66__default.default(
25619
+ "eui-markdown-toc-title",
25620
+ "text-sm font-semibold uppercase tracking-wide",
25621
+ "text-gray-900 dark:text-gray-100",
25622
+ titleClassName
25623
+ ),
25624
+ children: title
25625
+ }
25626
+ ) }) : null,
25627
+ !collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
25628
+ "nav",
25629
+ {
25630
+ className: classNames66__default.default(
25631
+ "eui-markdown-toc-list",
25632
+ "space-y-1",
25633
+ listClassName
25634
+ ),
25635
+ "aria-label": title || "Markdown table of contents",
25636
+ children: tocHeadings.map((heading) => /* @__PURE__ */ jsxRuntime.jsx(
25637
+ MarkdownTOCItem_default,
25638
+ {
25639
+ heading,
25640
+ active: activeHeading === heading.id,
25641
+ numbered,
25642
+ sanitizeLabel: sanitizeLabels,
25643
+ indentSize,
25644
+ className: itemClassName,
25645
+ activeClassName: activeItemClassName,
25646
+ inactiveClassName: inactiveItemClassName,
25647
+ onSelect: handleSelect
25648
+ },
25649
+ heading.id
25650
+ ))
25651
+ }
25652
+ ) : null
25653
+ ] });
25654
+ return /* @__PURE__ */ jsxRuntime.jsx("aside", { className: classNames66__default.default("eui-markdown-toc", "space-y-4", className), children: content });
25655
+ }
25656
+ var MarkdownTOC_default = MarkdownTOC;
25657
+ var DEFAULT_MARKDOWN_TOOLBAR_ACTIONS = [
25658
+ {
25659
+ id: "heading-1",
25660
+ label: "H1",
25661
+ title: "Heading 1"
25662
+ },
25663
+ {
25664
+ id: "heading-2",
25665
+ label: "H2",
25666
+ title: "Heading 2"
25667
+ },
25668
+ {
25669
+ id: "heading-3",
25670
+ label: "H3",
25671
+ title: "Heading 3"
25672
+ },
25673
+ {
25674
+ id: "bold",
25675
+ label: "B",
25676
+ title: "Bold",
25677
+ shortcut: "Ctrl+B"
25678
+ },
25679
+ {
25680
+ id: "italic",
25681
+ label: "I",
25682
+ title: "Italic",
25683
+ shortcut: "Ctrl+I"
25684
+ },
25685
+ {
25686
+ id: "strike",
25687
+ label: "S",
25688
+ title: "Strikethrough"
25689
+ },
25690
+ {
25691
+ id: "inline-code",
25692
+ label: "`",
25693
+ title: "Inline code"
25694
+ },
25695
+ {
25696
+ id: "code-block",
25697
+ label: "{}",
25698
+ title: "Code block"
25699
+ },
25700
+ {
25701
+ id: "link",
25702
+ label: "Link",
25703
+ title: "Link"
25704
+ },
25705
+ {
25706
+ id: "image",
25707
+ label: "Img",
25708
+ title: "Image"
25709
+ },
25710
+ {
25711
+ id: "unordered-list",
25712
+ label: "\u2022 List",
25713
+ title: "Bullet list"
25714
+ },
25715
+ {
25716
+ id: "ordered-list",
25717
+ label: "1. List",
25718
+ title: "Numbered list"
25719
+ },
25720
+ {
25721
+ id: "quote",
25722
+ label: "Quote",
25723
+ title: "Blockquote"
25724
+ },
25725
+ {
25726
+ id: "table",
25727
+ label: "Table",
25728
+ title: "Table"
25729
+ },
25730
+ {
25731
+ id: "hr",
25732
+ label: "\u2014",
25733
+ title: "Horizontal rule"
25734
+ }
25735
+ ];
25736
+ function MarkdownToolbar({
25737
+ actions = DEFAULT_MARKDOWN_TOOLBAR_ACTIONS,
25738
+ disabled = false,
25739
+ actionsDisabled = false,
25740
+ compact = false,
25741
+ viewMode = "preview",
25742
+ showViewModeToggle = true,
25743
+ onViewModeToggle,
25744
+ className,
25745
+ buttonClassName,
25746
+ toggleButtonClassName,
25747
+ onAction
25748
+ }) {
25749
+ const isPreviewMode = viewMode === "preview";
25750
+ return /* @__PURE__ */ jsxRuntime.jsxs(
25751
+ "div",
25752
+ {
25753
+ className: classNames66__default.default(
25754
+ "eui-markdown-toolbar",
25755
+ "flex flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 p-2",
25756
+ "dark:border-gray-700 dark:bg-gray-900",
25757
+ className
25758
+ ),
25759
+ children: [
25760
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1", children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
25761
+ "button",
25762
+ {
25763
+ type: "button",
25764
+ disabled: disabled || actionsDisabled,
25765
+ title: action.shortcut ? `${action.title || action.label} (${action.shortcut})` : action.title || action.label,
25766
+ onClick: () => onAction?.(action.id),
25767
+ className: classNames66__default.default(
25768
+ "eui-markdown-toolbar-button",
25769
+ "inline-flex items-center justify-center rounded border border-transparent",
25770
+ "text-gray-700 transition-colors hover:border-gray-300 hover:bg-white",
25771
+ "dark:text-gray-200 dark:hover:border-gray-600 dark:hover:bg-gray-800",
25772
+ "disabled:cursor-not-allowed disabled:opacity-50",
25773
+ compact ? "h-7 px-2 text-xs" : "h-8 px-2.5 text-sm",
25774
+ buttonClassName
25775
+ ),
25776
+ children: action.label
25777
+ },
25778
+ action.id
25779
+ )) }),
25780
+ showViewModeToggle ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
25781
+ "button",
25782
+ {
25783
+ type: "button",
25784
+ disabled,
25785
+ onClick: onViewModeToggle,
25786
+ title: isPreviewMode ? "Switch to Markdown syntax" : "Switch to preview",
25787
+ className: classNames66__default.default(
25788
+ "eui-markdown-view-toggle",
25789
+ "inline-flex items-center justify-center rounded border font-medium transition-colors",
25790
+ "border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
25791
+ "dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700",
25792
+ "disabled:cursor-not-allowed disabled:opacity-50",
25793
+ compact ? "h-7 px-2 text-xs" : "h-8 px-3 text-sm",
25794
+ toggleButtonClassName
25795
+ ),
25796
+ children: isPreviewMode ? "Syntax" : "Preview"
25797
+ }
25798
+ ) }) : null
25799
+ ]
25800
+ }
25801
+ );
25802
+ }
25803
+ var MarkdownToolbar_default = MarkdownToolbar;
25804
+ function getLineRange(value, start, end) {
25805
+ const lineStart = value.lastIndexOf("\n", start - 1) + 1;
25806
+ const lineEndIndex = value.indexOf("\n", end);
25807
+ return {
25808
+ lineStart,
25809
+ lineEnd: lineEndIndex === -1 ? value.length : lineEndIndex
25810
+ };
25811
+ }
25812
+ function replaceRange(value, start, end, replacement) {
25813
+ return value.slice(0, start) + replacement + value.slice(end);
25814
+ }
25815
+ function wrapSelection(value, start, end, before, after = before, placeholder = "text") {
25816
+ const selected = value.slice(start, end);
25817
+ const content = selected || placeholder;
25818
+ const replacement = `${before}${content}${after}`;
25819
+ const nextValue = replaceRange(value, start, end, replacement);
25820
+ const selectionStart = start + before.length;
25821
+ const selectionEnd = selectionStart + content.length;
25822
+ return {
25823
+ value: nextValue,
25824
+ selectionStart,
25825
+ selectionEnd
25826
+ };
25827
+ }
25828
+ function prefixSelectedLines(value, start, end, getPrefix) {
25829
+ const { lineStart, lineEnd } = getLineRange(value, start, end);
25830
+ const selectedBlock = value.slice(lineStart, lineEnd);
25831
+ const lines = selectedBlock.split("\n");
25832
+ const replacement = lines.map((line, index) => {
25833
+ const prefix = getPrefix(index);
25834
+ if (line.startsWith(prefix)) {
25835
+ return line;
25836
+ }
25837
+ return `${prefix}${line}`;
25838
+ }).join("\n");
25839
+ const nextValue = replaceRange(value, lineStart, lineEnd, replacement);
25840
+ const delta = replacement.length - selectedBlock.length;
25841
+ return {
25842
+ value: nextValue,
25843
+ selectionStart: start + getPrefix(0).length,
25844
+ selectionEnd: end + delta
25845
+ };
25846
+ }
25847
+ function prefixCurrentLine(value, start, end, prefix) {
25848
+ const { lineStart, lineEnd } = getLineRange(value, start, end);
25849
+ const line = value.slice(lineStart, lineEnd);
25850
+ const cleanedLine = line.replace(/^#{1,6}\s+/, "");
25851
+ const replacement = `${prefix}${cleanedLine}`;
25852
+ const nextValue = replaceRange(value, lineStart, lineEnd, replacement);
25853
+ return {
25854
+ value: nextValue,
25855
+ selectionStart: lineStart + prefix.length,
25856
+ selectionEnd: lineStart + replacement.length
25857
+ };
25858
+ }
25859
+ function insertBlock(value, start, end, block) {
25860
+ const before = value.slice(0, start);
25861
+ const after = value.slice(end);
25862
+ const needsLeadingNewline = before.length > 0 && !before.endsWith("\n");
25863
+ const needsTrailingNewline = after.length > 0 && !after.startsWith("\n");
25864
+ const replacement = `${needsLeadingNewline ? "\n" : ""}${block}${needsTrailingNewline ? "\n" : ""}`;
25865
+ const nextValue = replaceRange(value, start, end, replacement);
25866
+ const selectionStart = start + (needsLeadingNewline ? 1 : 0);
25867
+ const selectionEnd = selectionStart + block.length;
25868
+ return {
25869
+ value: nextValue,
25870
+ selectionStart,
25871
+ selectionEnd
25872
+ };
25873
+ }
25874
+ function applyMarkdownAction(value, start, end, action) {
25875
+ switch (action) {
25876
+ case "heading-1":
25877
+ return prefixCurrentLine(value, start, end, "# ");
25878
+ case "heading-2":
25879
+ return prefixCurrentLine(value, start, end, "## ");
25880
+ case "heading-3":
25881
+ return prefixCurrentLine(value, start, end, "### ");
25882
+ case "bold":
25883
+ return wrapSelection(value, start, end, "**", "**", "bold text");
25884
+ case "italic":
25885
+ return wrapSelection(value, start, end, "_", "_", "italic text");
25886
+ case "strike":
25887
+ return wrapSelection(value, start, end, "~~", "~~", "strikethrough text");
25888
+ case "inline-code":
25889
+ return wrapSelection(value, start, end, "`", "`", "code");
25890
+ case "code-block": {
25891
+ const selected = value.slice(start, end) || "code";
25892
+ return insertBlock(value, start, end, `\`\`\`ts
25893
+ ${selected}
25894
+ \`\`\``);
25895
+ }
25896
+ case "link": {
25897
+ const selected = value.slice(start, end) || "link text";
25898
+ const replacement = `[${selected}](https://example.com)`;
25899
+ const nextValue = replaceRange(value, start, end, replacement);
25900
+ return {
25901
+ value: nextValue,
25902
+ selectionStart: start + 1,
25903
+ selectionEnd: start + 1 + selected.length
25904
+ };
25905
+ }
25906
+ case "image": {
25907
+ const selected = value.slice(start, end) || "image alt";
25908
+ const replacement = `![${selected}](https://example.com/image.png)`;
25909
+ const nextValue = replaceRange(value, start, end, replacement);
25910
+ return {
25911
+ value: nextValue,
25912
+ selectionStart: start + 2,
25913
+ selectionEnd: start + 2 + selected.length
25914
+ };
25915
+ }
25916
+ case "unordered-list":
25917
+ return prefixSelectedLines(value, start, end, () => "- ");
25918
+ case "ordered-list":
25919
+ return prefixSelectedLines(
25920
+ value,
25921
+ start,
25922
+ end,
25923
+ (index) => `${index + 1}. `
25924
+ );
25925
+ case "quote":
25926
+ return prefixSelectedLines(value, start, end, () => "> ");
25927
+ case "table":
25928
+ return insertBlock(
25929
+ value,
25930
+ start,
25931
+ end,
25932
+ [
25933
+ "| Column 1 | Column 2 | Column 3 |",
25934
+ "| --- | --- | --- |",
25935
+ "| Value 1 | Value 2 | Value 3 |"
25936
+ ].join("\n")
25937
+ );
25938
+ case "hr":
25939
+ return insertBlock(value, start, end, "---");
25940
+ default:
25941
+ return {
25942
+ value,
25943
+ selectionStart: start,
25944
+ selectionEnd: end
25945
+ };
25946
+ }
25947
+ }
25948
+ function MarkdownSourceEditor({
25949
+ value,
25950
+ defaultValue = "",
25951
+ onChange,
25952
+ onBlur,
25953
+ viewMode,
25954
+ defaultViewMode = "preview",
25955
+ onViewModeChange,
25956
+ showToolbar = true,
25957
+ showViewModeToggle = true,
25958
+ toolbarProps,
25959
+ previewProps,
25960
+ minHeight = 260,
25961
+ maxHeight,
25962
+ disabled = false,
25963
+ readOnly = false,
25964
+ placeholder = "Write markdown...",
25965
+ containerClassName,
25966
+ toolbarClassName,
25967
+ textareaClassName,
25968
+ previewClassName,
25969
+ className,
25970
+ onKeyDown,
25971
+ ...props
25972
+ }) {
25973
+ const textareaRef = React2.useRef(null);
25974
+ const isControlled = value !== void 0;
25975
+ const isViewModeControlled = viewMode !== void 0;
25976
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
25977
+ const [internalViewMode, setInternalViewMode] = React2.useState(defaultViewMode);
25978
+ const currentValue = isControlled ? value : internalValue;
25979
+ const currentViewMode = isViewModeControlled ? viewMode : internalViewMode;
25980
+ const resolvedValue = currentValue ?? "";
25981
+ React2.useEffect(() => {
25982
+ if (!isControlled) {
25983
+ setInternalValue(defaultValue);
25984
+ }
25985
+ }, [defaultValue, isControlled]);
25986
+ React2.useEffect(() => {
25987
+ if (!isViewModeControlled) {
25988
+ setInternalViewMode(defaultViewMode);
25989
+ }
25990
+ }, [defaultViewMode, isViewModeControlled]);
25991
+ const updateValue = (nextValue) => {
25992
+ if (!isControlled) {
25993
+ setInternalValue(nextValue);
25994
+ }
25995
+ onChange?.(nextValue);
25996
+ };
25997
+ const updateViewMode = (nextViewMode) => {
25998
+ if (!isViewModeControlled) {
25999
+ setInternalViewMode(nextViewMode);
26000
+ }
26001
+ onViewModeChange?.(nextViewMode);
26002
+ };
26003
+ const toggleViewMode = () => {
26004
+ updateViewMode(currentViewMode === "preview" ? "source" : "preview");
26005
+ };
26006
+ const runAction = (action) => {
26007
+ const textarea = textareaRef.current;
26008
+ if (!textarea || disabled || readOnly) return;
26009
+ const start = textarea.selectionStart;
26010
+ const end = textarea.selectionEnd;
26011
+ const result = applyMarkdownAction(resolvedValue, start, end, action);
26012
+ updateValue(result.value);
26013
+ window.setTimeout(() => {
26014
+ textarea.focus();
26015
+ textarea.setSelectionRange(result.selectionStart, result.selectionEnd);
26016
+ }, 0);
26017
+ };
26018
+ const handleToolbarAction = (action) => {
26019
+ if (currentViewMode === "preview") {
26020
+ updateViewMode("source");
26021
+ window.setTimeout(() => {
26022
+ runAction(action);
26023
+ }, 0);
26024
+ return;
26025
+ }
26026
+ runAction(action);
26027
+ };
26028
+ const handleKeyDown = (event) => {
26029
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "b") {
26030
+ event.preventDefault();
26031
+ runAction("bold");
26032
+ return;
26033
+ }
26034
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "i") {
26035
+ event.preventDefault();
26036
+ runAction("italic");
26037
+ return;
26038
+ }
26039
+ onKeyDown?.(event);
26040
+ };
26041
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26042
+ "div",
26043
+ {
26044
+ className: classNames66__default.default(
26045
+ "eui-markdown-editor",
26046
+ "overflow-hidden rounded border border-gray-300 bg-white",
26047
+ "dark:border-gray-700 dark:bg-gray-950",
26048
+ containerClassName,
26049
+ className
26050
+ ),
26051
+ children: [
26052
+ showToolbar ? /* @__PURE__ */ jsxRuntime.jsx(
26053
+ MarkdownToolbar_default,
26054
+ {
26055
+ ...toolbarProps,
26056
+ disabled,
26057
+ actionsDisabled: readOnly,
26058
+ viewMode: currentViewMode,
26059
+ showViewModeToggle,
26060
+ className: classNames66__default.default(toolbarClassName, toolbarProps?.className),
26061
+ onViewModeToggle: toggleViewMode,
26062
+ onAction: handleToolbarAction
26063
+ }
26064
+ ) : null,
26065
+ currentViewMode === "preview" ? /* @__PURE__ */ jsxRuntime.jsx(
26066
+ "div",
26067
+ {
26068
+ className: classNames66__default.default(
26069
+ "eui-markdown-editor-preview",
26070
+ "min-h-[260px] p-4",
26071
+ previewClassName
26072
+ ),
26073
+ style: {
26074
+ minHeight,
26075
+ maxHeight
26076
+ },
26077
+ children: resolvedValue.trim() ? /* @__PURE__ */ jsxRuntime.jsx(MarkdownViewer_default, { ...previewProps, value: resolvedValue }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: placeholder })
26078
+ }
26079
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
26080
+ "textarea",
26081
+ {
26082
+ ...props,
26083
+ ref: textareaRef,
26084
+ value: resolvedValue,
26085
+ disabled,
26086
+ readOnly,
26087
+ placeholder,
26088
+ onChange: (event) => updateValue(event.target.value),
26089
+ onBlur,
26090
+ onKeyDown: handleKeyDown,
26091
+ className: classNames66__default.default(
26092
+ "eui-markdown-source-textarea",
26093
+ "block w-full resize-y border-0 bg-transparent p-4 font-mono text-sm leading-7",
26094
+ "text-gray-900 outline-none placeholder:text-gray-400",
26095
+ "dark:text-gray-100 dark:placeholder:text-gray-500",
26096
+ "disabled:cursor-not-allowed disabled:opacity-60",
26097
+ textareaClassName
26098
+ ),
26099
+ style: {
26100
+ minHeight,
26101
+ maxHeight,
26102
+ ...props.style
26103
+ }
26104
+ }
26105
+ )
26106
+ ]
26107
+ }
26108
+ );
26109
+ }
26110
+ var MarkdownSourceEditor_default = MarkdownSourceEditor;
26111
+ function MarkdownPreviewPane({
26112
+ value = "",
26113
+ emptyState = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Nothing to preview yet." }),
26114
+ className,
26115
+ contentClassName,
26116
+ ...viewerProps
26117
+ }) {
26118
+ return /* @__PURE__ */ jsxRuntime.jsx(
26119
+ "div",
26120
+ {
26121
+ className: classNames66__default.default(
26122
+ "eui-markdown-preview-pane",
26123
+ "rounded border border-gray-300 bg-white p-4",
26124
+ "dark:border-gray-700 dark:bg-gray-950",
26125
+ className
26126
+ ),
26127
+ children: value.trim() ? /* @__PURE__ */ jsxRuntime.jsx(
26128
+ MarkdownViewer_default,
26129
+ {
26130
+ ...viewerProps,
26131
+ value,
26132
+ className: contentClassName
26133
+ }
26134
+ ) : emptyState
26135
+ }
26136
+ );
26137
+ }
26138
+ var MarkdownPreviewPane_default = MarkdownPreviewPane;
26139
+ function MarkdownSplitEditor({
26140
+ value,
26141
+ defaultValue = "",
26142
+ onChange,
26143
+ onBlur,
26144
+ previewProps,
26145
+ previewPlacement = "right",
26146
+ sourceLabel = "Editor",
26147
+ previewLabel = "Preview",
26148
+ wrapperClassName,
26149
+ sourceWrapperClassName,
26150
+ previewWrapperClassName,
26151
+ ...sourceEditorProps
26152
+ }) {
26153
+ const isControlled = value !== void 0;
26154
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26155
+ const currentValue = isControlled ? value : internalValue;
26156
+ React2.useEffect(() => {
26157
+ if (!isControlled) {
26158
+ setInternalValue(defaultValue);
26159
+ }
26160
+ }, [defaultValue, isControlled]);
26161
+ const updateValue = (nextValue) => {
26162
+ if (!isControlled) {
26163
+ setInternalValue(nextValue);
26164
+ }
26165
+ onChange?.(nextValue);
26166
+ };
26167
+ const isHorizontal = previewPlacement === "right";
26168
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26169
+ "div",
26170
+ {
26171
+ className: classNames66__default.default(
26172
+ "eui-markdown-split-editor",
26173
+ "grid gap-4",
26174
+ isHorizontal ? "grid-cols-1 lg:grid-cols-2" : "grid-cols-1",
26175
+ wrapperClassName
26176
+ ),
26177
+ children: [
26178
+ /* @__PURE__ */ jsxRuntime.jsxs(
26179
+ "div",
26180
+ {
26181
+ className: classNames66__default.default(
26182
+ "eui-markdown-split-source",
26183
+ "min-w-0 space-y-2",
26184
+ sourceWrapperClassName
26185
+ ),
26186
+ children: [
26187
+ sourceLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200", children: sourceLabel }) : null,
26188
+ /* @__PURE__ */ jsxRuntime.jsx(
26189
+ MarkdownSourceEditor_default,
26190
+ {
26191
+ ...sourceEditorProps,
26192
+ value: currentValue,
26193
+ onChange: updateValue,
26194
+ onBlur,
26195
+ defaultViewMode: "source",
26196
+ showViewModeToggle: false
26197
+ }
26198
+ )
26199
+ ]
26200
+ }
26201
+ ),
26202
+ /* @__PURE__ */ jsxRuntime.jsxs(
26203
+ "div",
26204
+ {
26205
+ className: classNames66__default.default(
26206
+ "eui-markdown-split-preview",
26207
+ "min-w-0 space-y-2",
26208
+ previewWrapperClassName
26209
+ ),
26210
+ children: [
26211
+ previewLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200", children: previewLabel }) : null,
26212
+ /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreviewPane_default, { ...previewProps, value: currentValue })
26213
+ ]
26214
+ }
26215
+ )
26216
+ ]
26217
+ }
26218
+ );
26219
+ }
26220
+ var MarkdownSplitEditor_default = MarkdownSplitEditor;
26221
+ function MarkdownEditor({
26222
+ value,
26223
+ defaultValue = "",
26224
+ onChange,
26225
+ onBlur,
26226
+ mode = "source",
26227
+ viewMode,
26228
+ defaultViewMode = "preview",
26229
+ onViewModeChange,
26230
+ splitProps,
26231
+ richEditor,
26232
+ ...sourceEditorProps
26233
+ }) {
26234
+ const isControlled = value !== void 0;
26235
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26236
+ const currentValue = isControlled ? value : internalValue;
26237
+ React2.useEffect(() => {
26238
+ if (!isControlled) {
26239
+ setInternalValue(defaultValue);
26240
+ }
26241
+ }, [defaultValue, isControlled]);
26242
+ const updateValue = (nextValue) => {
26243
+ if (!isControlled) {
26244
+ setInternalValue(nextValue);
26245
+ }
26246
+ onChange?.(nextValue);
26247
+ };
26248
+ if (mode === "rich" && richEditor) {
26249
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: richEditor });
26250
+ }
26251
+ if (mode === "split") {
26252
+ return /* @__PURE__ */ jsxRuntime.jsx(
26253
+ MarkdownSplitEditor_default,
26254
+ {
26255
+ ...sourceEditorProps,
26256
+ ...splitProps,
26257
+ value: currentValue,
26258
+ onChange: updateValue,
26259
+ onBlur
26260
+ }
26261
+ );
26262
+ }
26263
+ return /* @__PURE__ */ jsxRuntime.jsx(
26264
+ MarkdownSourceEditor_default,
26265
+ {
26266
+ ...sourceEditorProps,
26267
+ value: currentValue,
26268
+ onChange: updateValue,
26269
+ onBlur,
26270
+ viewMode,
26271
+ defaultViewMode,
26272
+ onViewModeChange
26273
+ }
26274
+ );
26275
+ }
26276
+ var MarkdownEditor_default = MarkdownEditor;
26277
+ function MarkdownField({
26278
+ name,
26279
+ validate,
26280
+ label,
26281
+ helperText,
26282
+ wrapperClassName,
26283
+ labelClassName,
26284
+ helperTextClassName,
26285
+ ...editorProps
26286
+ }) {
26287
+ const [field, meta, helpers] = formik.useField({
26288
+ name,
26289
+ validate
26290
+ });
26291
+ const hasError = Boolean(meta.touched && meta.error);
26292
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26293
+ "div",
26294
+ {
26295
+ className: classNames66__default.default(
26296
+ "eui-markdown-field",
26297
+ "relative space-y-2",
26298
+ wrapperClassName
26299
+ ),
26300
+ children: [
26301
+ label ? /* @__PURE__ */ jsxRuntime.jsx(
26302
+ "label",
26303
+ {
26304
+ htmlFor: editorProps.id || field.name,
26305
+ className: classNames66__default.default(
26306
+ "block text-sm font-medium text-gray-700 dark:text-gray-200",
26307
+ labelClassName
26308
+ ),
26309
+ children: label
26310
+ }
26311
+ ) : null,
26312
+ /* @__PURE__ */ jsxRuntime.jsx(
26313
+ MarkdownEditor_default,
26314
+ {
26315
+ ...editorProps,
26316
+ id: editorProps.id || field.name,
26317
+ name: field.name,
26318
+ value: field.value || "",
26319
+ onChange: (nextValue) => {
26320
+ helpers.setValue(nextValue);
26321
+ },
26322
+ onBlur: () => {
26323
+ helpers.setTouched(true);
26324
+ }
26325
+ }
26326
+ ),
26327
+ helperText && !hasError ? /* @__PURE__ */ jsxRuntime.jsx(
26328
+ "p",
26329
+ {
26330
+ className: classNames66__default.default(
26331
+ "text-sm text-gray-500 dark:text-gray-400",
26332
+ helperTextClassName
26333
+ ),
26334
+ children: helperText
26335
+ }
26336
+ ) : null,
26337
+ /* @__PURE__ */ jsxRuntime.jsx(InputResponse_default, { name: field.name, visibility: hasError, variant: "danger" })
26338
+ ]
26339
+ }
26340
+ );
26341
+ }
26342
+ var MarkdownField_default = MarkdownField;
26343
+ function resolveSize(value) {
26344
+ if (value === void 0) return void 0;
26345
+ return typeof value === "number" ? `${value}px` : value;
26346
+ }
26347
+ function MarkdownLayout({
26348
+ children,
26349
+ content,
26350
+ toc,
26351
+ sidebar,
26352
+ aside,
26353
+ header,
26354
+ footer,
26355
+ tocPosition = "right",
26356
+ showToc = true,
26357
+ showSidebar = true,
26358
+ showAside = true,
26359
+ stickyToc = true,
26360
+ stickySidebar = true,
26361
+ stickyAside = true,
26362
+ stickyOffset = "6rem",
26363
+ maxWidth = "1440px",
26364
+ className,
26365
+ containerClassName,
26366
+ gridClassName,
26367
+ contentClassName,
26368
+ tocClassName,
26369
+ sidebarClassName,
26370
+ asideClassName,
26371
+ headerClassName,
26372
+ footerClassName
26373
+ }) {
26374
+ const resolvedContent = children ?? content;
26375
+ const hasToc = showToc && Boolean(toc);
26376
+ const hasSidebar = showSidebar && Boolean(sidebar);
26377
+ const hasAside = showAside && Boolean(aside);
26378
+ const stickyStyle = {
26379
+ top: resolveSize(stickyOffset)
26380
+ };
26381
+ const hasLeftToc = hasToc && tocPosition === "left";
26382
+ const hasRightToc = hasToc && tocPosition === "right";
26383
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default("eui-markdown-layout", "w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
26384
+ "div",
26385
+ {
26386
+ className: classNames66__default.default(
26387
+ "eui-markdown-layout-container",
26388
+ "mx-auto w-full px-4 sm:px-6 lg:px-8",
26389
+ containerClassName
26390
+ ),
26391
+ style: {
26392
+ maxWidth: resolveSize(maxWidth)
26393
+ },
26394
+ children: [
26395
+ header ? /* @__PURE__ */ jsxRuntime.jsx(
26396
+ "header",
26397
+ {
26398
+ className: classNames66__default.default(
26399
+ "eui-markdown-layout-header",
26400
+ "mb-8",
26401
+ headerClassName
26402
+ ),
26403
+ children: header
26404
+ }
26405
+ ) : null,
26406
+ /* @__PURE__ */ jsxRuntime.jsxs(
26407
+ "div",
26408
+ {
26409
+ className: classNames66__default.default(
26410
+ "eui-markdown-layout-grid",
26411
+ "grid grid-cols-1 gap-8",
26412
+ hasSidebar && hasToc && "xl:grid-cols-[16rem_minmax(0,1fr)_18rem]",
26413
+ hasSidebar && !hasToc && "lg:grid-cols-[16rem_minmax(0,1fr)]",
26414
+ !hasSidebar && hasToc && "lg:grid-cols-[minmax(0,1fr)_18rem]",
26415
+ hasAside && "2xl:grid-cols-[16rem_minmax(0,1fr)_18rem_16rem]",
26416
+ gridClassName
26417
+ ),
26418
+ children: [
26419
+ hasSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
26420
+ "aside",
26421
+ {
26422
+ className: classNames66__default.default(
26423
+ "eui-markdown-layout-sidebar",
26424
+ "min-w-0",
26425
+ stickySidebar && "lg:sticky lg:self-start",
26426
+ sidebarClassName
26427
+ ),
26428
+ style: stickySidebar ? stickyStyle : void 0,
26429
+ children: sidebar
26430
+ }
26431
+ ) : null,
26432
+ hasLeftToc ? /* @__PURE__ */ jsxRuntime.jsx(
26433
+ "aside",
26434
+ {
26435
+ className: classNames66__default.default(
26436
+ "eui-markdown-layout-toc",
26437
+ "min-w-0",
26438
+ stickyToc && "lg:sticky lg:self-start",
26439
+ tocClassName
26440
+ ),
26441
+ style: stickyToc ? stickyStyle : void 0,
26442
+ children: toc
26443
+ }
26444
+ ) : null,
26445
+ /* @__PURE__ */ jsxRuntime.jsx(
26446
+ "main",
26447
+ {
26448
+ className: classNames66__default.default(
26449
+ "eui-markdown-layout-content",
26450
+ "min-w-0",
26451
+ contentClassName
26452
+ ),
26453
+ children: resolvedContent
26454
+ }
26455
+ ),
26456
+ hasRightToc ? /* @__PURE__ */ jsxRuntime.jsx(
26457
+ "aside",
26458
+ {
26459
+ className: classNames66__default.default(
26460
+ "eui-markdown-layout-toc",
26461
+ "min-w-0",
26462
+ stickyToc && "lg:sticky lg:self-start",
26463
+ tocClassName
26464
+ ),
26465
+ style: stickyToc ? stickyStyle : void 0,
26466
+ children: toc
26467
+ }
26468
+ ) : null,
26469
+ hasAside ? /* @__PURE__ */ jsxRuntime.jsx(
26470
+ "aside",
26471
+ {
26472
+ className: classNames66__default.default(
26473
+ "eui-markdown-layout-aside",
26474
+ "min-w-0",
26475
+ stickyAside && "2xl:sticky 2xl:self-start",
26476
+ asideClassName
26477
+ ),
26478
+ style: stickyAside ? stickyStyle : void 0,
26479
+ children: aside
26480
+ }
26481
+ ) : null
26482
+ ]
26483
+ }
26484
+ ),
26485
+ footer ? /* @__PURE__ */ jsxRuntime.jsx(
26486
+ "footer",
26487
+ {
26488
+ className: classNames66__default.default(
26489
+ "eui-markdown-layout-footer",
26490
+ "mt-10",
26491
+ footerClassName
26492
+ ),
26493
+ children: footer
26494
+ }
26495
+ ) : null
26496
+ ]
26497
+ }
26498
+ ) });
26499
+ }
26500
+ var MarkdownLayout_default = MarkdownLayout;
26501
+ function MarkdownDocsLayoutContent({
26502
+ children,
26503
+ markdown,
26504
+ value,
26505
+ headings,
26506
+ title,
26507
+ description,
26508
+ header,
26509
+ headerActions,
26510
+ content,
26511
+ toc,
26512
+ viewerProps,
26513
+ tocProps,
26514
+ enableDefaultViewer = true,
26515
+ enableDefaultToc = true,
26516
+ docsHeaderClassName,
26517
+ docsTitleClassName,
26518
+ docsDescriptionClassName,
26519
+ ...layoutProps
26520
+ }) {
26521
+ const resolvedMarkdown = value ?? markdown ?? "";
26522
+ const resolvedHeader = header ?? (title || description || headerActions ? /* @__PURE__ */ jsxRuntime.jsx(
26523
+ "div",
26524
+ {
26525
+ className: classNames66__default.default(
26526
+ "eui-markdown-docs-header",
26527
+ "flex flex-col gap-4 border-b border-gray-200 pb-6",
26528
+ "dark:border-gray-700",
26529
+ docsHeaderClassName
26530
+ ),
26531
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
26532
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-2", children: [
26533
+ title ? /* @__PURE__ */ jsxRuntime.jsx(
26534
+ "h1",
26535
+ {
26536
+ className: classNames66__default.default(
26537
+ "eui-markdown-docs-title",
26538
+ "text-3xl font-bold tracking-tight text-gray-950",
26539
+ "dark:text-gray-50",
26540
+ docsTitleClassName
26541
+ ),
26542
+ children: title
26543
+ }
26544
+ ) : null,
26545
+ description ? /* @__PURE__ */ jsxRuntime.jsx(
26546
+ "div",
26547
+ {
26548
+ className: classNames66__default.default(
26549
+ "eui-markdown-docs-description",
26550
+ "max-w-3xl text-base leading-7 text-gray-600",
26551
+ "dark:text-gray-400",
26552
+ docsDescriptionClassName
26553
+ ),
26554
+ children: description
26555
+ }
26556
+ ) : null
26557
+ ] }),
26558
+ headerActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: headerActions }) : null
26559
+ ] })
26560
+ }
26561
+ ) : null);
26562
+ const resolvedContent = children ?? content ?? (enableDefaultViewer ? /* @__PURE__ */ jsxRuntime.jsx(
26563
+ MarkdownViewer_default,
26564
+ {
26565
+ ...viewerProps,
26566
+ value: resolvedMarkdown,
26567
+ headings
26568
+ }
26569
+ ) : null);
26570
+ const resolvedToc = toc ?? (enableDefaultToc ? /* @__PURE__ */ jsxRuntime.jsx(
26571
+ MarkdownTOC_default,
26572
+ {
26573
+ ...tocProps,
26574
+ markdown: resolvedMarkdown,
26575
+ headings
26576
+ }
26577
+ ) : null);
26578
+ return /* @__PURE__ */ jsxRuntime.jsx(
26579
+ MarkdownLayout_default,
26580
+ {
26581
+ ...layoutProps,
26582
+ header: resolvedHeader,
26583
+ toc: resolvedToc,
26584
+ content: resolvedContent
26585
+ }
26586
+ );
26587
+ }
26588
+ function MarkdownDocsLayout({
26589
+ markdown,
26590
+ value,
26591
+ headings,
26592
+ meta,
26593
+ providerProps,
26594
+ enableProvider = true,
26595
+ ...props
26596
+ }) {
26597
+ const resolvedMarkdown = value ?? markdown ?? "";
26598
+ if (!enableProvider) {
26599
+ return /* @__PURE__ */ jsxRuntime.jsx(
26600
+ MarkdownDocsLayoutContent,
26601
+ {
26602
+ ...props,
26603
+ markdown,
26604
+ value,
26605
+ headings
26606
+ }
26607
+ );
26608
+ }
26609
+ return /* @__PURE__ */ jsxRuntime.jsx(
26610
+ MarkdownProvider_default,
26611
+ {
26612
+ ...providerProps,
26613
+ markdown: resolvedMarkdown,
26614
+ headings,
26615
+ meta,
26616
+ children: /* @__PURE__ */ jsxRuntime.jsx(
26617
+ MarkdownDocsLayoutContent,
26618
+ {
26619
+ ...props,
26620
+ markdown: resolvedMarkdown,
26621
+ headings
26622
+ }
26623
+ )
26624
+ }
26625
+ );
26626
+ }
26627
+ var MarkdownDocsLayout_default = MarkdownDocsLayout;
26628
+ function toCssSize2(value) {
26629
+ if (typeof value === "number") return `${value}px`;
26630
+ return value;
26631
+ }
26632
+ function CodeMirrorMarkdownEditor({
26633
+ value,
26634
+ defaultValue = "",
26635
+ onChange,
26636
+ onBlur,
26637
+ id,
26638
+ name,
26639
+ placeholder = "Write markdown...",
26640
+ disabled = false,
26641
+ readOnly = false,
26642
+ autoFocus = false,
26643
+ minHeight = 320,
26644
+ maxHeight,
26645
+ height,
26646
+ dark = false,
26647
+ className,
26648
+ editorClassName,
26649
+ extensions
26650
+ }) {
26651
+ const isControlled = value !== void 0;
26652
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26653
+ const currentValue = isControlled ? value : internalValue;
26654
+ React2.useEffect(() => {
26655
+ if (!isControlled) {
26656
+ setInternalValue(defaultValue);
26657
+ }
26658
+ }, [defaultValue, isControlled]);
26659
+ const updateValue = (nextValue) => {
26660
+ if (!isControlled) {
26661
+ setInternalValue(nextValue);
26662
+ }
26663
+ onChange?.(nextValue);
26664
+ };
26665
+ return /* @__PURE__ */ jsxRuntime.jsx(
26666
+ "div",
26667
+ {
26668
+ id,
26669
+ "data-name": name,
26670
+ className: classNames66__default.default(
26671
+ "eui-markdown-adapter",
26672
+ "eui-markdown-codemirror-adapter",
26673
+ "overflow-hidden rounded border border-gray-300 bg-white",
26674
+ "dark:border-gray-700 dark:bg-gray-950",
26675
+ disabled && "cursor-not-allowed opacity-60",
26676
+ className
26677
+ ),
26678
+ style: {
26679
+ minHeight: toCssSize2(minHeight),
26680
+ maxHeight: toCssSize2(maxHeight)
26681
+ },
26682
+ children: /* @__PURE__ */ jsxRuntime.jsx(
26683
+ CodeMirror__default.default,
26684
+ {
26685
+ value: currentValue,
26686
+ height,
26687
+ minHeight: toCssSize2(minHeight),
26688
+ maxHeight: toCssSize2(maxHeight),
26689
+ placeholder,
26690
+ autoFocus,
26691
+ editable: !disabled && !readOnly,
26692
+ readOnly,
26693
+ theme: dark ? themeOneDark.oneDark : void 0,
26694
+ extensions: [langMarkdown.markdown(), ...extensions ?? []],
26695
+ basicSetup: {
26696
+ lineNumbers: true,
26697
+ foldGutter: true,
26698
+ highlightActiveLine: true,
26699
+ highlightSelectionMatches: true,
26700
+ autocompletion: true,
26701
+ closeBrackets: true,
26702
+ bracketMatching: true
26703
+ },
26704
+ className: classNames66__default.default("eui-markdown-codemirror", editorClassName),
26705
+ onChange: updateValue,
26706
+ onBlur
26707
+ }
26708
+ )
26709
+ }
26710
+ );
26711
+ }
26712
+ var CodeMirrorMarkdownEditor_default = CodeMirrorMarkdownEditor;
26713
+ function toCssSize3(value) {
26714
+ if (typeof value === "number") return `${value}px`;
26715
+ return value;
26716
+ }
26717
+ function createDefaultPlugins(showToolbar) {
26718
+ return [
26719
+ editor.headingsPlugin(),
26720
+ editor.listsPlugin(),
26721
+ editor.quotePlugin(),
26722
+ editor.thematicBreakPlugin(),
26723
+ editor.markdownShortcutPlugin(),
26724
+ editor.linkPlugin(),
26725
+ editor.imagePlugin(),
26726
+ editor.tablePlugin(),
26727
+ editor.codeBlockPlugin({
26728
+ defaultCodeBlockLanguage: "tsx"
26729
+ }),
26730
+ editor.codeMirrorPlugin({
26731
+ codeBlockLanguages: {
26732
+ js: "JavaScript",
26733
+ jsx: "JSX",
26734
+ ts: "TypeScript",
26735
+ tsx: "TSX",
26736
+ css: "CSS",
26737
+ scss: "SCSS",
26738
+ json: "JSON",
26739
+ bash: "Bash",
26740
+ sh: "Shell",
26741
+ html: "HTML",
26742
+ xml: "XML",
26743
+ md: "Markdown"
26744
+ }
26745
+ }),
26746
+ ...showToolbar ? [
26747
+ editor.toolbarPlugin({
26748
+ toolbarContents: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
26749
+ /* @__PURE__ */ jsxRuntime.jsx(editor.UndoRedo, {}),
26750
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
26751
+ /* @__PURE__ */ jsxRuntime.jsx(editor.BoldItalicUnderlineToggles, {}),
26752
+ /* @__PURE__ */ jsxRuntime.jsx(editor.CodeToggle, {}),
26753
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
26754
+ /* @__PURE__ */ jsxRuntime.jsx(editor.ListsToggle, {}),
26755
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
26756
+ /* @__PURE__ */ jsxRuntime.jsx(editor.CreateLink, {}),
26757
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertImage, {}),
26758
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertTable, {}),
26759
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertCodeBlock, {})
26760
+ ] })
26761
+ })
26762
+ ] : []
26763
+ ];
26764
+ }
26765
+ function MDXMarkdownEditor({
26766
+ value,
26767
+ defaultValue = "",
26768
+ onChange,
26769
+ onBlur,
26770
+ id,
26771
+ name,
26772
+ disabled = false,
26773
+ readOnly = false,
26774
+ minHeight = 360,
26775
+ maxHeight,
26776
+ dark = false,
26777
+ className,
26778
+ editorClassName,
26779
+ plugins,
26780
+ showToolbar = true,
26781
+ ...props
26782
+ }) {
26783
+ const editorRef = React2.useRef(null);
26784
+ const isControlled = value !== void 0;
26785
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26786
+ const currentValue = isControlled ? value : internalValue;
26787
+ React2.useEffect(() => {
26788
+ if (!isControlled) {
26789
+ setInternalValue(defaultValue);
26790
+ }
26791
+ }, [defaultValue, isControlled]);
26792
+ React2.useEffect(() => {
26793
+ if (!isControlled) return;
26794
+ editorRef.current?.setMarkdown(value ?? "");
26795
+ }, [value, isControlled]);
26796
+ const updateValue = (nextValue) => {
26797
+ if (!isControlled) {
26798
+ setInternalValue(nextValue);
26799
+ }
26800
+ onChange?.(nextValue);
26801
+ };
26802
+ return /* @__PURE__ */ jsxRuntime.jsx(
26803
+ "div",
26804
+ {
26805
+ id,
26806
+ "data-name": name,
26807
+ onBlur,
26808
+ className: classNames66__default.default(
26809
+ "eui-markdown-adapter",
26810
+ "eui-markdown-mdx-adapter",
26811
+ dark && "dark",
26812
+ disabled && "is-disabled",
26813
+ className
26814
+ ),
26815
+ style: {
26816
+ minHeight: toCssSize3(minHeight),
26817
+ maxHeight: toCssSize3(maxHeight)
26818
+ },
26819
+ children: /* @__PURE__ */ jsxRuntime.jsx(
26820
+ editor.MDXEditor,
26821
+ {
26822
+ ...props,
26823
+ ref: editorRef,
26824
+ markdown: currentValue ?? "",
26825
+ readOnly: disabled || readOnly,
26826
+ plugins: plugins ?? createDefaultPlugins(showToolbar),
26827
+ className: classNames66__default.default("eui-markdown-mdx-editor", editorClassName),
26828
+ contentEditableClassName: "eui-markdown-mdx-content",
26829
+ onChange: updateValue
26830
+ }
26831
+ )
26832
+ }
26833
+ );
26834
+ }
26835
+ var MDXMarkdownEditor_default = MDXMarkdownEditor;
26836
+ function toCssSize4(value) {
26837
+ if (typeof value === "number") return `${value}px`;
26838
+ return value;
26839
+ }
26840
+ function MilkdownInnerEditor({
26841
+ currentValue,
26842
+ updateValue,
26843
+ onBlur,
26844
+ disabled = false,
26845
+ readOnly = false,
26846
+ editorClassName,
26847
+ useGfm = true
26848
+ }) {
26849
+ react.useEditor(
26850
+ (root) => {
26851
+ let editor = core.Editor.make().config((ctx) => {
26852
+ ctx.set(core.rootCtx, root);
26853
+ ctx.set(core.defaultValueCtx, currentValue);
26854
+ ctx.update(core.editorViewOptionsCtx, (prev) => ({
26855
+ ...prev,
26856
+ editable: () => !disabled && !readOnly,
26857
+ attributes: {
26858
+ class: classNames66__default.default("eui-markdown-milkdown-content", editorClassName),
26859
+ spellcheck: "true"
26860
+ },
26861
+ handleDOMEvents: {
26862
+ blur: () => {
26863
+ onBlur?.();
26864
+ return false;
26865
+ }
26866
+ }
26867
+ }));
26868
+ ctx.get(listener.listenerCtx).markdownUpdated((_ctx, markdown) => {
26869
+ updateValue(markdown);
26870
+ });
26871
+ });
26872
+ editor = editor.use(commonmark.commonmark);
26873
+ if (useGfm) {
26874
+ editor = editor.use(gfm.gfm);
26875
+ }
26876
+ editor = editor.use(listener.listener);
26877
+ return editor;
26878
+ },
26879
+ [disabled, readOnly, editorClassName, onBlur, updateValue, useGfm]
26880
+ );
26881
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Milkdown, {});
26882
+ }
26883
+ function MilkdownMarkdownEditor({
26884
+ value,
26885
+ defaultValue = "",
26886
+ onChange,
26887
+ onBlur,
26888
+ id,
26889
+ name,
26890
+ disabled = false,
26891
+ readOnly = false,
26892
+ minHeight = 360,
26893
+ maxHeight,
26894
+ className,
26895
+ editorClassName,
26896
+ useGfm = true
26897
+ }) {
26898
+ const isControlled = value !== void 0;
26899
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26900
+ const currentValue = isControlled ? value : internalValue;
26901
+ React2.useEffect(() => {
26902
+ if (!isControlled) {
26903
+ setInternalValue(defaultValue);
26904
+ }
26905
+ }, [defaultValue, isControlled]);
26906
+ const updateValue = (nextValue) => {
26907
+ if (!isControlled) {
26908
+ setInternalValue(nextValue);
26909
+ }
26910
+ onChange?.(nextValue);
26911
+ };
26912
+ return /* @__PURE__ */ jsxRuntime.jsx(
26913
+ "div",
26914
+ {
26915
+ id,
26916
+ "data-name": name,
26917
+ className: classNames66__default.default(
26918
+ "eui-markdown-adapter",
26919
+ "eui-markdown-milkdown-adapter",
26920
+ disabled && "is-disabled",
26921
+ className
26922
+ ),
26923
+ style: {
26924
+ minHeight: toCssSize4(minHeight),
26925
+ maxHeight: toCssSize4(maxHeight)
26926
+ },
26927
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.MilkdownProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
26928
+ MilkdownInnerEditor,
26929
+ {
26930
+ currentValue: currentValue ?? "",
26931
+ updateValue,
26932
+ onBlur,
26933
+ disabled,
26934
+ readOnly,
26935
+ editorClassName,
26936
+ useGfm
26937
+ }
26938
+ ) })
26939
+ }
26940
+ );
26941
+ }
26942
+ var MilkdownMarkdownEditor_default = MilkdownMarkdownEditor;
24553
26943
  function GenericLayout({
24554
26944
  children,
24555
26945
  styles,
@@ -24558,7 +26948,7 @@ function GenericLayout({
24558
26948
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { defaultTheme, children: /* @__PURE__ */ jsxRuntime.jsx(
24559
26949
  "div",
24560
26950
  {
24561
- className: classNames17__default.default({
26951
+ className: classNames66__default.default({
24562
26952
  [`${styles}`]: styles
24563
26953
  }),
24564
26954
  children
@@ -24607,7 +26997,7 @@ function SidemenuLayout({ data, children }) {
24607
26997
  return /* @__PURE__ */ jsxRuntime.jsx(DefaultLayout_default, { children: /* @__PURE__ */ jsxRuntime.jsxs(
24608
26998
  "div",
24609
26999
  {
24610
- className: classNames17__default.default({
27000
+ className: classNames66__default.default({
24611
27001
  grid: true,
24612
27002
  "grid-cols-7 gap-10": !isMobile,
24613
27003
  "grid-cols-1 gap-": isMobile
@@ -24725,6 +27115,7 @@ exports.CloudinaryImage = CloudinaryImage_default;
24725
27115
  exports.CloudinaryProvider = CloudinaryProvider;
24726
27116
  exports.CloudinaryVideo = CloudinaryVideo_default;
24727
27117
  exports.Code = Code;
27118
+ exports.CodeMirrorMarkdownEditor = CodeMirrorMarkdownEditor_default;
24728
27119
  exports.CommentThread = CommentThread_default;
24729
27120
  exports.ConfigBootstrap = ConfigBootstrap_default;
24730
27121
  exports.Configurator = Configurator;
@@ -24788,14 +27179,35 @@ exports.LinePlot = LinePlot;
24788
27179
  exports.Link = Link;
24789
27180
  exports.List = List_default;
24790
27181
  exports.ListItem = ListItem_default;
27182
+ exports.MDXMarkdownEditor = MDXMarkdownEditor_default;
27183
+ exports.MarkdownBlockquote = MarkdownBlockquote_default;
27184
+ exports.MarkdownCodeBlock = MarkdownCodeBlock_default;
27185
+ exports.MarkdownContext = MarkdownContext;
27186
+ exports.MarkdownDocsLayout = MarkdownDocsLayout_default;
24791
27187
  exports.MarkdownEditor = MarkdownEditor_default;
27188
+ exports.MarkdownField = MarkdownField_default;
27189
+ exports.MarkdownHeadingComponent = MarkdownHeading_default;
27190
+ exports.MarkdownImage = MarkdownImage_default;
27191
+ exports.MarkdownInlineCode = MarkdownInlineCode_default;
27192
+ exports.MarkdownLayout = MarkdownLayout_default;
27193
+ exports.MarkdownLink = MarkdownLink_default;
27194
+ exports.MarkdownPreviewPane = MarkdownPreviewPane_default;
24792
27195
  exports.MarkdownProvider = MarkdownProvider_default;
27196
+ exports.MarkdownRenderer = MarkdownRenderer_default;
27197
+ exports.MarkdownSourceEditor = MarkdownSourceEditor_default;
27198
+ exports.MarkdownSplitEditor = MarkdownSplitEditor_default;
24793
27199
  exports.MarkdownTOC = MarkdownTOC_default;
27200
+ exports.MarkdownTOCItem = MarkdownTOCItem_default;
27201
+ exports.MarkdownTable = MarkdownTable_default;
27202
+ exports.MarkdownTableCell = MarkdownTableCell;
27203
+ exports.MarkdownTableHeaderCell = MarkdownTableHeaderCell;
27204
+ exports.MarkdownToolbar = MarkdownToolbar_default;
24794
27205
  exports.MarkdownViewer = MarkdownViewer_default;
24795
27206
  exports.Menu = Menu;
24796
27207
  exports.MenuGroup = MenuGroup;
24797
27208
  exports.MenuItem = MenuItem;
24798
27209
  exports.MenuItemTitle = MenuItemTitle;
27210
+ exports.MilkdownMarkdownEditor = MilkdownMarkdownEditor_default;
24799
27211
  exports.Modal = Modal_default;
24800
27212
  exports.MotionSurface = MotionSurface_default;
24801
27213
  exports.MultiImageInput = MultiImageInput_default;
@@ -24878,17 +27290,20 @@ exports.cn = cn;
24878
27290
  exports.createConfigurator = createConfigurator;
24879
27291
  exports.createForceLayout = createForceLayout;
24880
27292
  exports.createGridLayout = createGridLayout;
27293
+ exports.createHeadingSlug = createHeadingSlug;
24881
27294
  exports.createInitialChartState = createInitialChartState;
24882
27295
  exports.createTreeLayout = createTreeLayout;
24883
27296
  exports.createURLResolver = createURLResolver;
24884
27297
  exports.decrementReplyCount = decrementReplyCount;
24885
27298
  exports.enumValues = enumValues;
24886
27299
  exports.euiToast = euiToast;
27300
+ exports.extractHeadings = extractHeadings;
24887
27301
  exports.findReview = findReview;
24888
27302
  exports.formatChartValue = formatChartValue;
24889
27303
  exports.formatCommentDate = formatCommentDate;
24890
27304
  exports.formatConfigError = formatConfigError;
24891
27305
  exports.formatReviewDate = formatReviewDate;
27306
+ exports.generateHeadingNumbers = generateHeadingNumbers;
24892
27307
  exports.getAllowedOrigins = getAllowedOrigins;
24893
27308
  exports.getBrowserHref = getBrowserHref;
24894
27309
  exports.getBrowserOrigin = getBrowserOrigin;
@@ -24906,6 +27321,7 @@ exports.limitRealtimePoints = limitRealtimePoints;
24906
27321
  exports.normalize = normalize;
24907
27322
  exports.normalizeChartData = normalizeChartData;
24908
27323
  exports.normalizeChartDataPoint = normalizeChartDataPoint;
27324
+ exports.normalizeMarkdown = normalizeMarkdown;
24909
27325
  exports.normalizeReview = normalizeReview;
24910
27326
  exports.normalizeReviewAuthor = normalizeReviewAuthor;
24911
27327
  exports.normalizeReviewReply = normalizeReviewReply;
@@ -24925,13 +27341,16 @@ exports.resolveAppearanceStyles = resolveAppearanceStyles;
24925
27341
  exports.resolveChartColor = resolveChartColor;
24926
27342
  exports.resolveChartColors = resolveChartColors;
24927
27343
  exports.resolveWithGlobal = resolveWithGlobal;
27344
+ exports.sanitizeHeading = sanitizeHeading;
24928
27345
  exports.sendToast = sendToast;
27346
+ exports.slugify = slugify;
24929
27347
  exports.toConfiguratorError = toConfiguratorError;
24930
27348
  exports.updateComment = updateComment;
24931
27349
  exports.updateReplyCacheComment = updateReplyCacheComment;
24932
27350
  exports.updateReview = updateReview;
24933
27351
  exports.updateReviewReply = updateReviewReply;
24934
27352
  exports.upsertReview = upsertReview;
27353
+ exports.useActiveHeading = useActiveHeading;
24935
27354
  exports.useChartContext = useChartContext;
24936
27355
  exports.useChartData = useChartData;
24937
27356
  exports.useChartPolling = useChartPolling;
@@ -24944,6 +27363,8 @@ exports.useCurrentTheme = useCurrentTheme_default;
24944
27363
  exports.useDrawer = useDrawer_default;
24945
27364
  exports.useEUIConfig = useEUIConfig;
24946
27365
  exports.useIsMobile = useIsMobile_default;
27366
+ exports.useMarkdown = useMarkdown;
27367
+ exports.useMarkdownHeadings = useMarkdownHeadings;
24947
27368
  exports.useModal = useModal_default;
24948
27369
  exports.useReviewThreadState = useReviewThreadState;
24949
27370
  exports.useTheme = useTheme_default;