react-markdown-table-ts 1.3.1 → 1.3.2

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.mjs ADDED
@@ -0,0 +1,940 @@
1
+ import oe, { useRef as ie, useId as se, useDeferredValue as le, useTransition as ue, useMemo as ce, useEffect as D } from "react";
2
+ import de from "prismjs";
3
+ var j = { exports: {} }, A = {};
4
+ /**
5
+ * @license React
6
+ * react-jsx-runtime.production.js
7
+ *
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ var U;
14
+ function fe() {
15
+ if (U) return A;
16
+ U = 1;
17
+ var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
18
+ function s(m, i, d) {
19
+ var a = null;
20
+ if (d !== void 0 && (a = "" + d), i.key !== void 0 && (a = "" + i.key), "key" in i) {
21
+ d = {};
22
+ for (var u in i)
23
+ u !== "key" && (d[u] = i[u]);
24
+ } else d = i;
25
+ return i = d.ref, {
26
+ $$typeof: n,
27
+ type: m,
28
+ key: a,
29
+ ref: i !== void 0 ? i : null,
30
+ props: d
31
+ };
32
+ }
33
+ return A.Fragment = t, A.jsx = s, A.jsxs = s, A;
34
+ }
35
+ var T = {};
36
+ /**
37
+ * @license React
38
+ * react-jsx-runtime.development.js
39
+ *
40
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE file in the root directory of this source tree.
44
+ */
45
+ var V;
46
+ function pe() {
47
+ return V || (V = 1, process.env.NODE_ENV !== "production" && (function() {
48
+ function n(e) {
49
+ if (e == null) return null;
50
+ if (typeof e == "function")
51
+ return e.$$typeof === te ? null : e.displayName || e.name || null;
52
+ if (typeof e == "string") return e;
53
+ switch (e) {
54
+ case k:
55
+ return "Fragment";
56
+ case _:
57
+ return "Profiler";
58
+ case E:
59
+ return "StrictMode";
60
+ case Q:
61
+ return "Suspense";
62
+ case K:
63
+ return "SuspenseList";
64
+ case ne:
65
+ return "Activity";
66
+ }
67
+ if (typeof e == "object")
68
+ switch (typeof e.tag == "number" && console.error(
69
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
+ ), e.$$typeof) {
71
+ case y:
72
+ return "Portal";
73
+ case $:
74
+ return e.displayName || "Context";
75
+ case R:
76
+ return (e._context.displayName || "Context") + ".Consumer";
77
+ case Z:
78
+ var c = e.render;
79
+ return e = e.displayName, e || (e = c.displayName || c.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
80
+ case ee:
81
+ return c = e.displayName || null, c !== null ? c : n(e.type) || "Memo";
82
+ case O:
83
+ c = e._payload, e = e._init;
84
+ try {
85
+ return n(e(c));
86
+ } catch {
87
+ }
88
+ }
89
+ return null;
90
+ }
91
+ function t(e) {
92
+ return "" + e;
93
+ }
94
+ function s(e) {
95
+ try {
96
+ t(e);
97
+ var c = !1;
98
+ } catch {
99
+ c = !0;
100
+ }
101
+ if (c) {
102
+ c = console;
103
+ var h = c.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
104
+ return h.call(
105
+ c,
106
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
107
+ b
108
+ ), t(e);
109
+ }
110
+ }
111
+ function m(e) {
112
+ if (e === k) return "<>";
113
+ if (typeof e == "object" && e !== null && e.$$typeof === O)
114
+ return "<...>";
115
+ try {
116
+ var c = n(e);
117
+ return c ? "<" + c + ">" : "<...>";
118
+ } catch {
119
+ return "<...>";
120
+ }
121
+ }
122
+ function i() {
123
+ var e = z.A;
124
+ return e === null ? null : e.getOwner();
125
+ }
126
+ function d() {
127
+ return Error("react-stack-top-frame");
128
+ }
129
+ function a(e) {
130
+ if (L.call(e, "key")) {
131
+ var c = Object.getOwnPropertyDescriptor(e, "key").get;
132
+ if (c && c.isReactWarning) return !1;
133
+ }
134
+ return e.key !== void 0;
135
+ }
136
+ function u(e, c) {
137
+ function h() {
138
+ H || (H = !0, console.error(
139
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
140
+ c
141
+ ));
142
+ }
143
+ h.isReactWarning = !0, Object.defineProperty(e, "key", {
144
+ get: h,
145
+ configurable: !0
146
+ });
147
+ }
148
+ function l() {
149
+ var e = n(this.type);
150
+ return W[e] || (W[e] = !0, console.error(
151
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
152
+ )), e = this.props.ref, e !== void 0 ? e : null;
153
+ }
154
+ function f(e, c, h, b, N, M) {
155
+ var w = h.ref;
156
+ return e = {
157
+ $$typeof: v,
158
+ type: e,
159
+ key: c,
160
+ props: h,
161
+ _owner: b
162
+ }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(e, "ref", {
163
+ enumerable: !1,
164
+ get: l
165
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
166
+ configurable: !1,
167
+ enumerable: !1,
168
+ writable: !0,
169
+ value: 0
170
+ }), Object.defineProperty(e, "_debugInfo", {
171
+ configurable: !1,
172
+ enumerable: !1,
173
+ writable: !0,
174
+ value: null
175
+ }), Object.defineProperty(e, "_debugStack", {
176
+ configurable: !1,
177
+ enumerable: !1,
178
+ writable: !0,
179
+ value: N
180
+ }), Object.defineProperty(e, "_debugTask", {
181
+ configurable: !1,
182
+ enumerable: !1,
183
+ writable: !0,
184
+ value: M
185
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
186
+ }
187
+ function o(e, c, h, b, N, M) {
188
+ var w = c.children;
189
+ if (w !== void 0)
190
+ if (b)
191
+ if (re(w)) {
192
+ for (b = 0; b < w.length; b++)
193
+ r(w[b]);
194
+ Object.freeze && Object.freeze(w);
195
+ } else
196
+ console.error(
197
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
+ );
199
+ else r(w);
200
+ if (L.call(c, "key")) {
201
+ w = n(e);
202
+ var x = Object.keys(c).filter(function(ae) {
203
+ return ae !== "key";
204
+ });
205
+ b = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", Y[w + b] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ `A props object containing a "key" prop is being spread into JSX:
207
+ let props = %s;
208
+ <%s {...props} />
209
+ React keys must be passed directly to JSX without using spread:
210
+ let props = %s;
211
+ <%s key={someKey} {...props} />`,
212
+ b,
213
+ w,
214
+ x,
215
+ w
216
+ ), Y[w + b] = !0);
217
+ }
218
+ if (w = null, h !== void 0 && (s(h), w = "" + h), a(c) && (s(c.key), w = "" + c.key), "key" in c) {
219
+ h = {};
220
+ for (var I in c)
221
+ I !== "key" && (h[I] = c[I]);
222
+ } else h = c;
223
+ return w && u(
224
+ h,
225
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
226
+ ), f(
227
+ e,
228
+ w,
229
+ h,
230
+ i(),
231
+ N,
232
+ M
233
+ );
234
+ }
235
+ function r(e) {
236
+ p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
237
+ }
238
+ function p(e) {
239
+ return typeof e == "object" && e !== null && e.$$typeof === v;
240
+ }
241
+ var g = oe, v = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), R = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), Z = Symbol.for("react.forward_ref"), Q = Symbol.for("react.suspense"), K = Symbol.for("react.suspense_list"), ee = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), te = Symbol.for("react.client.reference"), z = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, re = Array.isArray, P = console.createTask ? console.createTask : function() {
242
+ return null;
243
+ };
244
+ g = {
245
+ react_stack_bottom_frame: function(e) {
246
+ return e();
247
+ }
248
+ };
249
+ var H, W = {}, F = g.react_stack_bottom_frame.bind(
250
+ g,
251
+ d
252
+ )(), q = P(m(d)), Y = {};
253
+ T.Fragment = k, T.jsx = function(e, c, h) {
254
+ var b = 1e4 > z.recentlyCreatedOwnerStacks++;
255
+ return o(
256
+ e,
257
+ c,
258
+ h,
259
+ !1,
260
+ b ? Error("react-stack-top-frame") : F,
261
+ b ? P(m(e)) : q
262
+ );
263
+ }, T.jsxs = function(e, c, h) {
264
+ var b = 1e4 > z.recentlyCreatedOwnerStacks++;
265
+ return o(
266
+ e,
267
+ c,
268
+ h,
269
+ !0,
270
+ b ? Error("react-stack-top-frame") : F,
271
+ b ? P(m(e)) : q
272
+ );
273
+ };
274
+ })()), T;
275
+ }
276
+ var J;
277
+ function ge() {
278
+ return J || (J = 1, process.env.NODE_ENV === "production" ? j.exports = fe() : j.exports = pe()), j.exports;
279
+ }
280
+ var S = ge();
281
+ (function(n) {
282
+ var t = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
283
+ function s(o) {
284
+ return o = o.replace(/<inner>/g, function() {
285
+ return t;
286
+ }), RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + o + ")");
287
+ }
288
+ var m = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source, i = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function() {
289
+ return m;
290
+ }), d = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
291
+ n.languages.markdown = n.languages.extend("markup", {}), n.languages.insertBefore("markdown", "prolog", {
292
+ "front-matter-block": {
293
+ pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
294
+ lookbehind: !0,
295
+ greedy: !0,
296
+ inside: {
297
+ punctuation: /^---|---$/,
298
+ "front-matter": {
299
+ pattern: /\S+(?:\s+\S+)*/,
300
+ alias: ["yaml", "language-yaml"],
301
+ inside: n.languages.yaml
302
+ }
303
+ }
304
+ },
305
+ blockquote: {
306
+ // > ...
307
+ pattern: /^>(?:[\t ]*>)*/m,
308
+ alias: "punctuation"
309
+ },
310
+ table: {
311
+ pattern: RegExp("^" + i + d + "(?:" + i + ")*", "m"),
312
+ inside: {
313
+ "table-data-rows": {
314
+ pattern: RegExp("^(" + i + d + ")(?:" + i + ")*$"),
315
+ lookbehind: !0,
316
+ inside: {
317
+ "table-data": {
318
+ pattern: RegExp(m),
319
+ inside: n.languages.markdown
320
+ },
321
+ punctuation: /\|/
322
+ }
323
+ },
324
+ "table-line": {
325
+ pattern: RegExp("^(" + i + ")" + d + "$"),
326
+ lookbehind: !0,
327
+ inside: {
328
+ punctuation: /\||:?-{3,}:?/
329
+ }
330
+ },
331
+ "table-header-row": {
332
+ pattern: RegExp("^" + i + "$"),
333
+ inside: {
334
+ "table-header": {
335
+ pattern: RegExp(m),
336
+ alias: "important",
337
+ inside: n.languages.markdown
338
+ },
339
+ punctuation: /\|/
340
+ }
341
+ }
342
+ }
343
+ },
344
+ code: [
345
+ {
346
+ // Prefixed by 4 spaces or 1 tab and preceded by an empty line
347
+ pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
348
+ lookbehind: !0,
349
+ alias: "keyword"
350
+ },
351
+ {
352
+ // ```optional language
353
+ // code block
354
+ // ```
355
+ pattern: /^```[\s\S]*?^```$/m,
356
+ greedy: !0,
357
+ inside: {
358
+ "code-block": {
359
+ pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
360
+ lookbehind: !0
361
+ },
362
+ "code-language": {
363
+ pattern: /^(```).+/,
364
+ lookbehind: !0
365
+ },
366
+ punctuation: /```/
367
+ }
368
+ }
369
+ ],
370
+ title: [
371
+ {
372
+ // title 1
373
+ // =======
374
+ // title 2
375
+ // -------
376
+ pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
377
+ alias: "important",
378
+ inside: {
379
+ punctuation: /==+$|--+$/
380
+ }
381
+ },
382
+ {
383
+ // # title 1
384
+ // ###### title 6
385
+ pattern: /(^\s*)#.+/m,
386
+ lookbehind: !0,
387
+ alias: "important",
388
+ inside: {
389
+ punctuation: /^#+|#+$/
390
+ }
391
+ }
392
+ ],
393
+ hr: {
394
+ // ***
395
+ // ---
396
+ // * * *
397
+ // -----------
398
+ pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
399
+ lookbehind: !0,
400
+ alias: "punctuation"
401
+ },
402
+ list: {
403
+ // * item
404
+ // + item
405
+ // - item
406
+ // 1. item
407
+ pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
408
+ lookbehind: !0,
409
+ alias: "punctuation"
410
+ },
411
+ "url-reference": {
412
+ // [id]: http://example.com "Optional title"
413
+ // [id]: http://example.com 'Optional title'
414
+ // [id]: http://example.com (Optional title)
415
+ // [id]: <http://example.com> "Optional title"
416
+ pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
417
+ inside: {
418
+ variable: {
419
+ pattern: /^(!?\[)[^\]]+/,
420
+ lookbehind: !0
421
+ },
422
+ string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
423
+ punctuation: /^[\[\]!:]|[<>]/
424
+ },
425
+ alias: "url"
426
+ },
427
+ bold: {
428
+ // **strong**
429
+ // __strong__
430
+ // allow one nested instance of italic text using the same delimiter
431
+ pattern: s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
432
+ lookbehind: !0,
433
+ greedy: !0,
434
+ inside: {
435
+ content: {
436
+ pattern: /(^..)[\s\S]+(?=..$)/,
437
+ lookbehind: !0,
438
+ inside: {}
439
+ // see below
440
+ },
441
+ punctuation: /\*\*|__/
442
+ }
443
+ },
444
+ italic: {
445
+ // *em*
446
+ // _em_
447
+ // allow one nested instance of bold text using the same delimiter
448
+ pattern: s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
449
+ lookbehind: !0,
450
+ greedy: !0,
451
+ inside: {
452
+ content: {
453
+ pattern: /(^.)[\s\S]+(?=.$)/,
454
+ lookbehind: !0,
455
+ inside: {}
456
+ // see below
457
+ },
458
+ punctuation: /[*_]/
459
+ }
460
+ },
461
+ strike: {
462
+ // ~~strike through~~
463
+ // ~strike~
464
+ // eslint-disable-next-line regexp/strict
465
+ pattern: s(/(~~?)(?:(?!~)<inner>)+\2/.source),
466
+ lookbehind: !0,
467
+ greedy: !0,
468
+ inside: {
469
+ content: {
470
+ pattern: /(^~~?)[\s\S]+(?=\1$)/,
471
+ lookbehind: !0,
472
+ inside: {}
473
+ // see below
474
+ },
475
+ punctuation: /~~?/
476
+ }
477
+ },
478
+ "code-snippet": {
479
+ // `code`
480
+ // ``code``
481
+ pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
482
+ lookbehind: !0,
483
+ greedy: !0,
484
+ alias: ["code", "keyword"]
485
+ },
486
+ url: {
487
+ // [example](http://example.com "Optional title")
488
+ // [example][id]
489
+ // [example] [id]
490
+ pattern: s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
491
+ lookbehind: !0,
492
+ greedy: !0,
493
+ inside: {
494
+ operator: /^!/,
495
+ content: {
496
+ pattern: /(^\[)[^\]]+(?=\])/,
497
+ lookbehind: !0,
498
+ inside: {}
499
+ // see below
500
+ },
501
+ variable: {
502
+ pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
503
+ lookbehind: !0
504
+ },
505
+ url: {
506
+ pattern: /(^\]\()[^\s)]+/,
507
+ lookbehind: !0
508
+ },
509
+ string: {
510
+ pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
511
+ lookbehind: !0
512
+ }
513
+ }
514
+ }
515
+ }), ["url", "bold", "italic", "strike"].forEach(function(o) {
516
+ ["url", "bold", "italic", "strike", "code-snippet"].forEach(function(r) {
517
+ o !== r && (n.languages.markdown[o].inside.content.inside[r] = n.languages.markdown[r]);
518
+ });
519
+ }), n.hooks.add("after-tokenize", function(o) {
520
+ if (o.language !== "markdown" && o.language !== "md")
521
+ return;
522
+ function r(p) {
523
+ if (!(!p || typeof p == "string"))
524
+ for (var g = 0, v = p.length; g < v; g++) {
525
+ var y = p[g];
526
+ if (y.type !== "code") {
527
+ r(y.content);
528
+ continue;
529
+ }
530
+ var k = y.content[1], E = y.content[3];
531
+ if (k && E && k.type === "code-language" && E.type === "code-block" && typeof k.content == "string") {
532
+ var _ = k.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
533
+ _ = (/[a-z][\w-]*/i.exec(_) || [""])[0].toLowerCase();
534
+ var R = "language-" + _;
535
+ E.alias ? typeof E.alias == "string" ? E.alias = [E.alias, R] : E.alias.push(R) : E.alias = [R];
536
+ }
537
+ }
538
+ }
539
+ r(o.tokens);
540
+ }), n.hooks.add("wrap", function(o) {
541
+ if (o.type === "code-block") {
542
+ for (var r = "", p = 0, g = o.classes.length; p < g; p++) {
543
+ var v = o.classes[p], y = /language-(.+)/.exec(v);
544
+ if (y) {
545
+ r = y[1];
546
+ break;
547
+ }
548
+ }
549
+ var k = n.languages[r];
550
+ if (k)
551
+ o.content = n.highlight(f(o.content), k, r);
552
+ else if (r && r !== "none" && n.plugins.autoloader) {
553
+ var E = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
554
+ o.attributes.id = E, n.plugins.autoloader.loadLanguages(r, function() {
555
+ var _ = document.getElementById(E);
556
+ _ && (_.innerHTML = n.highlight(_.textContent, n.languages[r], r));
557
+ });
558
+ }
559
+ }
560
+ });
561
+ var a = RegExp(n.languages.markup.tag.pattern.source, "gi"), u = {
562
+ amp: "&",
563
+ lt: "<",
564
+ gt: ">",
565
+ quot: '"'
566
+ }, l = String.fromCodePoint || String.fromCharCode;
567
+ function f(o) {
568
+ var r = o.replace(a, "");
569
+ return r = r.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(p, g) {
570
+ if (g = g.toLowerCase(), g[0] === "#") {
571
+ var v;
572
+ return g[1] === "x" ? v = parseInt(g.slice(2), 16) : v = Number(g.slice(1)), l(v);
573
+ } else {
574
+ var y = u[g];
575
+ return y || p;
576
+ }
577
+ }), r;
578
+ }
579
+ n.languages.md = n.languages.markdown;
580
+ })(Prism);
581
+ var G = {}, X;
582
+ function me() {
583
+ return X || (X = 1, (function() {
584
+ if (typeof Prism > "u" || typeof document > "u")
585
+ return;
586
+ var n = "line-numbers", t = /\n(?!$)/g, s = Prism.plugins.lineNumbers = {
587
+ /**
588
+ * Get node for provided line number
589
+ *
590
+ * @param {Element} element pre element
591
+ * @param {number} number line number
592
+ * @returns {Element|undefined}
593
+ */
594
+ getLine: function(a, u) {
595
+ if (!(a.tagName !== "PRE" || !a.classList.contains(n))) {
596
+ var l = a.querySelector(".line-numbers-rows");
597
+ if (l) {
598
+ var f = parseInt(a.getAttribute("data-start"), 10) || 1, o = f + (l.children.length - 1);
599
+ u < f && (u = f), u > o && (u = o);
600
+ var r = u - f;
601
+ return l.children[r];
602
+ }
603
+ }
604
+ },
605
+ /**
606
+ * Resizes the line numbers of the given element.
607
+ *
608
+ * This function will not add line numbers. It will only resize existing ones.
609
+ *
610
+ * @param {HTMLElement} element A `<pre>` element with line numbers.
611
+ * @returns {void}
612
+ */
613
+ resize: function(a) {
614
+ m([a]);
615
+ },
616
+ /**
617
+ * Whether the plugin can assume that the units font sizes and margins are not depended on the size of
618
+ * the current viewport.
619
+ *
620
+ * Setting this to `true` will allow the plugin to do certain optimizations for better performance.
621
+ *
622
+ * Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
623
+ *
624
+ * @type {boolean}
625
+ */
626
+ assumeViewportIndependence: !0
627
+ };
628
+ function m(a) {
629
+ if (a = a.filter(function(l) {
630
+ var f = i(l), o = f["white-space"];
631
+ return o === "pre-wrap" || o === "pre-line";
632
+ }), a.length != 0) {
633
+ var u = a.map(function(l) {
634
+ var f = l.querySelector("code"), o = l.querySelector(".line-numbers-rows");
635
+ if (!(!f || !o)) {
636
+ var r = l.querySelector(".line-numbers-sizer"), p = f.textContent.split(t);
637
+ r || (r = document.createElement("span"), r.className = "line-numbers-sizer", f.appendChild(r)), r.innerHTML = "0", r.style.display = "block";
638
+ var g = r.getBoundingClientRect().height;
639
+ return r.innerHTML = "", {
640
+ element: l,
641
+ lines: p,
642
+ lineHeights: [],
643
+ oneLinerHeight: g,
644
+ sizer: r
645
+ };
646
+ }
647
+ }).filter(Boolean);
648
+ u.forEach(function(l) {
649
+ var f = l.sizer, o = l.lines, r = l.lineHeights, p = l.oneLinerHeight;
650
+ r[o.length - 1] = void 0, o.forEach(function(g, v) {
651
+ if (g && g.length > 1) {
652
+ var y = f.appendChild(document.createElement("span"));
653
+ y.style.display = "block", y.textContent = g;
654
+ } else
655
+ r[v] = p;
656
+ });
657
+ }), u.forEach(function(l) {
658
+ for (var f = l.sizer, o = l.lineHeights, r = 0, p = 0; p < o.length; p++)
659
+ o[p] === void 0 && (o[p] = f.children[r++].getBoundingClientRect().height);
660
+ }), u.forEach(function(l) {
661
+ var f = l.sizer, o = l.element.querySelector(".line-numbers-rows");
662
+ f.style.display = "none", f.innerHTML = "", l.lineHeights.forEach(function(r, p) {
663
+ o.children[p].style.height = r + "px";
664
+ });
665
+ });
666
+ }
667
+ }
668
+ function i(a) {
669
+ return a ? window.getComputedStyle ? getComputedStyle(a) : a.currentStyle || null : null;
670
+ }
671
+ var d = void 0;
672
+ window.addEventListener("resize", function() {
673
+ s.assumeViewportIndependence && d === window.innerWidth || (d = window.innerWidth, m(Array.prototype.slice.call(document.querySelectorAll("pre." + n))));
674
+ }), Prism.hooks.add("complete", function(a) {
675
+ if (a.code) {
676
+ var u = (
677
+ /** @type {Element} */
678
+ a.element
679
+ ), l = (
680
+ /** @type {HTMLElement} */
681
+ u.parentNode
682
+ );
683
+ if (!(!l || !/pre/i.test(l.nodeName)) && !u.querySelector(".line-numbers-rows") && Prism.util.isActive(u, n)) {
684
+ u.classList.remove(n), l.classList.add(n);
685
+ var f = a.code.match(t), o = f ? f.length + 1 : 1, r, p = new Array(o + 1).join("<span></span>");
686
+ r = document.createElement("span"), r.setAttribute("aria-hidden", "true"), r.className = "line-numbers-rows", r.innerHTML = p, l.hasAttribute("data-start") && (l.style.counterReset = "linenumber " + (parseInt(l.getAttribute("data-start"), 10) - 1)), a.element.appendChild(r), m([l]), Prism.hooks.run("line-numbers", a);
687
+ }
688
+ }
689
+ }), Prism.hooks.add("line-numbers", function(a) {
690
+ a.plugins = a.plugins || {}, a.plugins.lineNumbers = !0;
691
+ });
692
+ })()), G;
693
+ }
694
+ me();
695
+ function B(n) {
696
+ return n.useTabs ? " " : n.hasPadding ? " " : "";
697
+ }
698
+ class he {
699
+ padding;
700
+ constructor(t) {
701
+ this.padding = B(t);
702
+ }
703
+ formatCell(t, s, m) {
704
+ const i = m;
705
+ switch (s) {
706
+ case "right":
707
+ return `${this.padding}${t.padStart(i)}${this.padding}`;
708
+ case "center": {
709
+ const d = i - t.length, a = Math.floor(d / 2), u = d - a;
710
+ return `${this.padding}${" ".repeat(a)}${t}${" ".repeat(u)}${this.padding}`;
711
+ }
712
+ default:
713
+ return `${this.padding}${t.padEnd(i)}${this.padding}`;
714
+ }
715
+ }
716
+ }
717
+ class be {
718
+ static indicators = {
719
+ left: (t) => `:${"-".repeat(t - 1)}`,
720
+ right: (t) => `${"-".repeat(t - 1)}:`,
721
+ center: (t) => `:${"-".repeat(t - 2)}:`,
722
+ none: (t) => "-".repeat(t)
723
+ };
724
+ static formatIndicator(t, s) {
725
+ return this.indicators[t](s);
726
+ }
727
+ }
728
+ class we {
729
+ config;
730
+ cellFormatter;
731
+ adjustedAlignments;
732
+ constructor(t) {
733
+ this.config = t, this.cellFormatter = new he(t), this.adjustedAlignments = this.getAdjustedAlignments();
734
+ }
735
+ getAdjustedAlignments() {
736
+ return this.config.columnAlignments.length < this.config.columnCount ? [
737
+ ...Array.from(this.config.columnAlignments),
738
+ ...Array(this.config.columnCount - this.config.columnAlignments.length).fill("none")
739
+ ] : Array.from(this.config.columnAlignments);
740
+ }
741
+ formatRow(t) {
742
+ return `|${Array.from({ length: this.config.columnCount }, (m, i) => {
743
+ let d = t[i] ?? "";
744
+ this.config.replaceNewlines && (d = d.replace(/\n/g, "<br>"));
745
+ const a = this.adjustedAlignments[i], u = this.config.columnWidths ? this.config.columnWidths[i] : d.length;
746
+ return this.cellFormatter.formatCell(d, a, u);
747
+ }).join("|")}|`;
748
+ }
749
+ formatAlignmentRow() {
750
+ const t = B(this.config);
751
+ return `|${Array.from({ length: this.config.columnCount }, (m, i) => {
752
+ const d = this.adjustedAlignments[i], a = this.config.columnWidths ? this.config.columnWidths[i] : 3, u = be.formatIndicator(d, a);
753
+ return `${t}${u}${t}`;
754
+ }).join("|")}|`;
755
+ }
756
+ }
757
+ function ve(n, t) {
758
+ const s = new Array(t).fill(3);
759
+ return n.forEach((m) => {
760
+ for (let i = 0; i < t; i++) {
761
+ const d = m[i] ?? "";
762
+ s[i] = Math.max(s[i], d.length);
763
+ }
764
+ }), s;
765
+ }
766
+ function ye(n) {
767
+ const t = n.inputDataHeader.length, s = n.inputDataBody.map((m) => m.length);
768
+ return Math.max(t, ...s);
769
+ }
770
+ function Ee(n, t, s) {
771
+ return s ? ve(
772
+ [n.inputDataHeader, ...n.inputDataBody],
773
+ t
774
+ ) : void 0;
775
+ }
776
+ function _e(n, t, s = !0, m = !1, i = !1, d = !0) {
777
+ const a = ye(n), u = Ee(n, a, s), l = {
778
+ columnCount: a,
779
+ columnAlignments: t,
780
+ columnWidths: u,
781
+ useTabs: m,
782
+ replaceNewlines: i,
783
+ hasPadding: d
784
+ }, f = new we(l), o = f.formatRow(n.inputDataHeader), r = f.formatAlignmentRow(), p = n.inputDataBody.map((g) => f.formatRow(g)).join(`
785
+ `);
786
+ return `${o}
787
+ ${r}
788
+ ${p}`.trimEnd();
789
+ }
790
+ function ke(n) {
791
+ let t = "", s = n;
792
+ for (; s >= 0; )
793
+ t = String.fromCharCode(s % 26 + 65) + t, s = Math.floor(s / 26) - 1;
794
+ return t;
795
+ }
796
+ function Re(n) {
797
+ return Array.from({ length: n }, (t, s) => ke(s));
798
+ }
799
+ class C extends Error {
800
+ constructor(t, s) {
801
+ super(t, s), this.name = "MarkdownTableError", Object.setPrototypeOf(this, C.prototype);
802
+ }
803
+ }
804
+ function xe(n) {
805
+ if (n === null || !Array.isArray(n))
806
+ throw new C("The 'data' prop must be a two-dimensional array.");
807
+ if (n.length === 0)
808
+ throw new C("The 'data' array must contain at least one row.");
809
+ }
810
+ const Se = `
811
+ code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}
812
+ `, Ae = `
813
+ code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}
814
+ `;
815
+ function Te(n, t) {
816
+ return t ? { inputDataHeader: n[0], inputDataBody: n.slice(1) } : { inputDataHeader: Re(n[0].length), inputDataBody: n };
817
+ }
818
+ function Ce(n, t, s, m, i, d, a) {
819
+ try {
820
+ xe(n);
821
+ const { inputDataHeader: u, inputDataBody: l } = Te(n, t);
822
+ return _e(
823
+ { inputDataHeader: u, inputDataBody: l },
824
+ s,
825
+ m,
826
+ i,
827
+ d,
828
+ a
829
+ );
830
+ } catch (u) {
831
+ if (u instanceof C)
832
+ return `Error: ${u.message}`;
833
+ throw u;
834
+ }
835
+ }
836
+ function je({
837
+ inputData: n = null,
838
+ hasHeader: t = !0,
839
+ columnAlignments: s = [],
840
+ isCompact: m = !1,
841
+ hasTabs: i = !1,
842
+ hasPadding: d = !0,
843
+ convertLineBreaks: a = !1,
844
+ className: u,
845
+ onGenerate: l,
846
+ theme: f = "light",
847
+ preStyle: o,
848
+ topPadding: r = 16,
849
+ minWidth: p,
850
+ showLineNumbers: g = !0
851
+ }) {
852
+ const v = ie(null), y = se(), k = le(n), [, E] = ue(), _ = ce(() => Ce(
853
+ k,
854
+ t,
855
+ s,
856
+ !m,
857
+ i,
858
+ a,
859
+ d
860
+ ), [
861
+ k,
862
+ t,
863
+ s,
864
+ m,
865
+ i,
866
+ a,
867
+ d
868
+ ]);
869
+ return D(() => {
870
+ l && l(_);
871
+ }, [_, l]), D(() => {
872
+ const R = v.current?.querySelector("code");
873
+ R && _ && E(() => {
874
+ requestAnimationFrame(() => {
875
+ if (de.highlightElement(R), !g && v.current) {
876
+ const $ = v.current.querySelector(".line-numbers-rows");
877
+ $ && $.remove();
878
+ }
879
+ });
880
+ });
881
+ }, [_, E, g]), /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
882
+ /* @__PURE__ */ S.jsxs("style", { children: [
883
+ f === "light" ? Se : Ae,
884
+ `
885
+ pre {
886
+ position: relative;
887
+ padding-top: ${r}px !important;
888
+ }
889
+ pre::before {
890
+ position: absolute;
891
+ top: 8px;
892
+ left: 12px;
893
+ color: ${f === "light" ? "#666" : "#999"};
894
+ letter-spacing: 2px;
895
+ font-size: 12px;
896
+ }
897
+ /* Hide line numbers when showLineNumbers is false */
898
+ pre:not(.line-numbers) .line-numbers-rows {
899
+ display: none !important;
900
+ }
901
+ /* Remove left padding when line numbers are hidden */
902
+ pre:not(.line-numbers) {
903
+ padding-left: 1em !important;
904
+ }
905
+ pre:not(.line-numbers) > code {
906
+ padding-left: 0 !important;
907
+ }
908
+ `
909
+ ] }),
910
+ /* @__PURE__ */ S.jsx(
911
+ "div",
912
+ {
913
+ id: y,
914
+ style: {
915
+ position: "relative",
916
+ isolation: "isolate",
917
+ display: "inline-block"
918
+ },
919
+ children: /* @__PURE__ */ S.jsx(
920
+ "pre",
921
+ {
922
+ ref: v,
923
+ className: `${u} language-markdown ${g ? "line-numbers" : ""} ${f === "dark" ? "dark-theme" : ""}`,
924
+ style: {
925
+ width: "fit-content",
926
+ minWidth: p ? `${p}px` : "min-content",
927
+ margin: 0,
928
+ ...o
929
+ },
930
+ children: /* @__PURE__ */ S.jsx("code", { className: "language-markdown", role: "code", children: _ })
931
+ }
932
+ )
933
+ }
934
+ )
935
+ ] });
936
+ }
937
+ export {
938
+ je as MarkdownTable,
939
+ C as MarkdownTableError
940
+ };