markstream-react 0.0.1

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 ADDED
@@ -0,0 +1,4810 @@
1
+ import jt, { useMemo as W, useState as B, createContext as Ur, useContext as Kr, useRef as S, useEffect as F, useCallback as D, useLayoutEffect as Yr, useSyncExternalStore as qr } from "react";
2
+ import { getMarkdown as Jt, parseMarkdownToStructure as Gr } from "stream-markdown-parser";
3
+ import { autoUpdate as Mr, computePosition as Er, offset as Tr, flip as Rr, shift as Sr } from "@floating-ui/dom";
4
+ import { createPortal as ir } from "react-dom";
5
+ var At = { exports: {} }, Rt = {};
6
+ var dr;
7
+ function Jr() {
8
+ if (dr) return Rt;
9
+ dr = 1;
10
+ var t = jt, e = /* @__PURE__ */ Symbol.for("react.element"), r = /* @__PURE__ */ Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, a = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
11
+ function c(d, s, g) {
12
+ var f, h = {}, C = null, w = null;
13
+ g !== void 0 && (C = "" + g), s.key !== void 0 && (C = "" + s.key), s.ref !== void 0 && (w = s.ref);
14
+ for (f in s) o.call(s, f) && !l.hasOwnProperty(f) && (h[f] = s[f]);
15
+ if (d && d.defaultProps) for (f in s = d.defaultProps, s) h[f] === void 0 && (h[f] = s[f]);
16
+ return { $$typeof: e, type: d, key: C, ref: w, props: h, _owner: a.current };
17
+ }
18
+ return Rt.Fragment = r, Rt.jsx = c, Rt.jsxs = c, Rt;
19
+ }
20
+ var St = {};
21
+ var mr;
22
+ function Zr() {
23
+ return mr || (mr = 1, process.env.NODE_ENV !== "production" && (function() {
24
+ var t = jt, e = /* @__PURE__ */ Symbol.for("react.element"), r = /* @__PURE__ */ Symbol.for("react.portal"), o = /* @__PURE__ */ Symbol.for("react.fragment"), a = /* @__PURE__ */ Symbol.for("react.strict_mode"), l = /* @__PURE__ */ Symbol.for("react.profiler"), c = /* @__PURE__ */ Symbol.for("react.provider"), d = /* @__PURE__ */ Symbol.for("react.context"), s = /* @__PURE__ */ Symbol.for("react.forward_ref"), g = /* @__PURE__ */ Symbol.for("react.suspense"), f = /* @__PURE__ */ Symbol.for("react.suspense_list"), h = /* @__PURE__ */ Symbol.for("react.memo"), C = /* @__PURE__ */ Symbol.for("react.lazy"), w = /* @__PURE__ */ Symbol.for("react.offscreen"), y = Symbol.iterator, N = "@@iterator";
25
+ function A(i) {
26
+ if (i === null || typeof i != "object")
27
+ return null;
28
+ var p = y && i[y] || i[N];
29
+ return typeof p == "function" ? p : null;
30
+ }
31
+ var L = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
32
+ function M(i) {
33
+ {
34
+ for (var p = arguments.length, k = new Array(p > 1 ? p - 1 : 0), R = 1; R < p; R++)
35
+ k[R - 1] = arguments[R];
36
+ I("error", i, k);
37
+ }
38
+ }
39
+ function I(i, p, k) {
40
+ {
41
+ var R = L.ReactDebugCurrentFrame, se = R.getStackAddendum();
42
+ se !== "" && (p += "%s", k = k.concat([se]));
43
+ var ge = k.map(function(Q) {
44
+ return String(Q);
45
+ });
46
+ ge.unshift("Warning: " + p), Function.prototype.apply.call(console[i], console, ge);
47
+ }
48
+ }
49
+ var O = !1, re = !1, ue = !1, de = !1, me = !1, oe;
50
+ oe = /* @__PURE__ */ Symbol.for("react.module.reference");
51
+ function Se(i) {
52
+ return !!(typeof i == "string" || typeof i == "function" || i === o || i === l || me || i === a || i === g || i === f || de || i === w || O || re || ue || typeof i == "object" && i !== null && (i.$$typeof === C || i.$$typeof === h || i.$$typeof === c || i.$$typeof === d || i.$$typeof === s || // This needs to include all possible module reference object
53
+ // types supported by any Flight configuration anywhere since
54
+ // we don't know which Flight build this will end up being used
55
+ // with.
56
+ i.$$typeof === oe || i.getModuleId !== void 0));
57
+ }
58
+ function U(i, p, k) {
59
+ var R = i.displayName;
60
+ if (R)
61
+ return R;
62
+ var se = p.displayName || p.name || "";
63
+ return se !== "" ? k + "(" + se + ")" : k;
64
+ }
65
+ function ce(i) {
66
+ return i.displayName || "Context";
67
+ }
68
+ function we(i) {
69
+ if (i == null)
70
+ return null;
71
+ if (typeof i.tag == "number" && M("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
72
+ return i.displayName || i.name || null;
73
+ if (typeof i == "string")
74
+ return i;
75
+ switch (i) {
76
+ case o:
77
+ return "Fragment";
78
+ case r:
79
+ return "Portal";
80
+ case l:
81
+ return "Profiler";
82
+ case a:
83
+ return "StrictMode";
84
+ case g:
85
+ return "Suspense";
86
+ case f:
87
+ return "SuspenseList";
88
+ }
89
+ if (typeof i == "object")
90
+ switch (i.$$typeof) {
91
+ case d:
92
+ var p = i;
93
+ return ce(p) + ".Consumer";
94
+ case c:
95
+ var k = i;
96
+ return ce(k._context) + ".Provider";
97
+ case s:
98
+ return U(i, i.render, "ForwardRef");
99
+ case h:
100
+ var R = i.displayName || null;
101
+ return R !== null ? R : we(i.type) || "Memo";
102
+ case C: {
103
+ var se = i, ge = se._payload, Q = se._init;
104
+ try {
105
+ return we(Q(ge));
106
+ } catch {
107
+ return null;
108
+ }
109
+ }
110
+ }
111
+ return null;
112
+ }
113
+ var J = Object.assign, K = 0, Ne, ye, Ae, ee, ne, xe, He;
114
+ function ie() {
115
+ }
116
+ ie.__reactDisabledLog = !0;
117
+ function st() {
118
+ {
119
+ if (K === 0) {
120
+ Ne = console.log, ye = console.info, Ae = console.warn, ee = console.error, ne = console.group, xe = console.groupCollapsed, He = console.groupEnd;
121
+ var i = {
122
+ configurable: !0,
123
+ enumerable: !0,
124
+ value: ie,
125
+ writable: !0
126
+ };
127
+ Object.defineProperties(console, {
128
+ info: i,
129
+ log: i,
130
+ warn: i,
131
+ error: i,
132
+ group: i,
133
+ groupCollapsed: i,
134
+ groupEnd: i
135
+ });
136
+ }
137
+ K++;
138
+ }
139
+ }
140
+ function Ze() {
141
+ {
142
+ if (K--, K === 0) {
143
+ var i = {
144
+ configurable: !0,
145
+ enumerable: !0,
146
+ writable: !0
147
+ };
148
+ Object.defineProperties(console, {
149
+ log: J({}, i, {
150
+ value: Ne
151
+ }),
152
+ info: J({}, i, {
153
+ value: ye
154
+ }),
155
+ warn: J({}, i, {
156
+ value: Ae
157
+ }),
158
+ error: J({}, i, {
159
+ value: ee
160
+ }),
161
+ group: J({}, i, {
162
+ value: ne
163
+ }),
164
+ groupCollapsed: J({}, i, {
165
+ value: xe
166
+ }),
167
+ groupEnd: J({}, i, {
168
+ value: He
169
+ })
170
+ });
171
+ }
172
+ K < 0 && M("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
173
+ }
174
+ }
175
+ var Ue = L.ReactCurrentDispatcher, x;
176
+ function _e(i, p, k) {
177
+ {
178
+ if (x === void 0)
179
+ try {
180
+ throw Error();
181
+ } catch (se) {
182
+ var R = se.stack.trim().match(/\n( *(at )?)/);
183
+ x = R && R[1] || "";
184
+ }
185
+ return `
186
+ ` + x + i;
187
+ }
188
+ }
189
+ var be = !1, Le;
190
+ {
191
+ var fe = typeof WeakMap == "function" ? WeakMap : Map;
192
+ Le = new fe();
193
+ }
194
+ function gt(i, p) {
195
+ if (!i || be)
196
+ return "";
197
+ {
198
+ var k = Le.get(i);
199
+ if (k !== void 0)
200
+ return k;
201
+ }
202
+ var R;
203
+ be = !0;
204
+ var se = Error.prepareStackTrace;
205
+ Error.prepareStackTrace = void 0;
206
+ var ge;
207
+ ge = Ue.current, Ue.current = null, st();
208
+ try {
209
+ if (p) {
210
+ var Q = function() {
211
+ throw Error();
212
+ };
213
+ if (Object.defineProperty(Q.prototype, "props", {
214
+ set: function() {
215
+ throw Error();
216
+ }
217
+ }), typeof Reflect == "object" && Reflect.construct) {
218
+ try {
219
+ Reflect.construct(Q, []);
220
+ } catch (Je) {
221
+ R = Je;
222
+ }
223
+ Reflect.construct(i, [], Q);
224
+ } else {
225
+ try {
226
+ Q.call();
227
+ } catch (Je) {
228
+ R = Je;
229
+ }
230
+ i.call(Q.prototype);
231
+ }
232
+ } else {
233
+ try {
234
+ throw Error();
235
+ } catch (Je) {
236
+ R = Je;
237
+ }
238
+ i();
239
+ }
240
+ } catch (Je) {
241
+ if (Je && R && typeof Je.stack == "string") {
242
+ for (var G = Je.stack.split(`
243
+ `), Ye = R.stack.split(`
244
+ `), Te = G.length - 1, Be = Ye.length - 1; Te >= 1 && Be >= 0 && G[Te] !== Ye[Be]; )
245
+ Be--;
246
+ for (; Te >= 1 && Be >= 0; Te--, Be--)
247
+ if (G[Te] !== Ye[Be]) {
248
+ if (Te !== 1 || Be !== 1)
249
+ do
250
+ if (Te--, Be--, Be < 0 || G[Te] !== Ye[Be]) {
251
+ var ot = `
252
+ ` + G[Te].replace(" at new ", " at ");
253
+ return i.displayName && ot.includes("<anonymous>") && (ot = ot.replace("<anonymous>", i.displayName)), typeof i == "function" && Le.set(i, ot), ot;
254
+ }
255
+ while (Te >= 1 && Be >= 0);
256
+ break;
257
+ }
258
+ }
259
+ } finally {
260
+ be = !1, Ue.current = ge, Ze(), Error.prepareStackTrace = se;
261
+ }
262
+ var Ct = i ? i.displayName || i.name : "", bt = Ct ? _e(Ct) : "";
263
+ return typeof i == "function" && Le.set(i, bt), bt;
264
+ }
265
+ function ve(i, p, k) {
266
+ return gt(i, !1);
267
+ }
268
+ function pt(i) {
269
+ var p = i.prototype;
270
+ return !!(p && p.isReactComponent);
271
+ }
272
+ function qe(i, p, k) {
273
+ if (i == null)
274
+ return "";
275
+ if (typeof i == "function")
276
+ return gt(i, pt(i));
277
+ if (typeof i == "string")
278
+ return _e(i);
279
+ switch (i) {
280
+ case g:
281
+ return _e("Suspense");
282
+ case f:
283
+ return _e("SuspenseList");
284
+ }
285
+ if (typeof i == "object")
286
+ switch (i.$$typeof) {
287
+ case s:
288
+ return ve(i.render);
289
+ case h:
290
+ return qe(i.type, p, k);
291
+ case C: {
292
+ var R = i, se = R._payload, ge = R._init;
293
+ try {
294
+ return qe(ge(se), p, k);
295
+ } catch {
296
+ }
297
+ }
298
+ }
299
+ return "";
300
+ }
301
+ var ze = Object.prototype.hasOwnProperty, $ = {}, De = L.ReactDebugCurrentFrame;
302
+ function Qe(i) {
303
+ if (i) {
304
+ var p = i._owner, k = qe(i.type, i._source, p ? p.type : null);
305
+ De.setExtraStackFrame(k);
306
+ } else
307
+ De.setExtraStackFrame(null);
308
+ }
309
+ function Oe(i, p, k, R, se) {
310
+ {
311
+ var ge = Function.call.bind(ze);
312
+ for (var Q in i)
313
+ if (ge(i, Q)) {
314
+ var G = void 0;
315
+ try {
316
+ if (typeof i[Q] != "function") {
317
+ var Ye = Error((R || "React class") + ": " + k + " type `" + Q + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[Q] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
318
+ throw Ye.name = "Invariant Violation", Ye;
319
+ }
320
+ G = i[Q](p, Q, R, k, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
321
+ } catch (Te) {
322
+ G = Te;
323
+ }
324
+ G && !(G instanceof Error) && (Qe(se), M("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", R || "React class", k, Q, typeof G), Qe(null)), G instanceof Error && !(G.message in $) && ($[G.message] = !0, Qe(se), M("Failed %s type: %s", k, G.message), Qe(null));
325
+ }
326
+ }
327
+ }
328
+ var ct = Array.isArray;
329
+ function rt(i) {
330
+ return ct(i);
331
+ }
332
+ function $e(i) {
333
+ {
334
+ var p = typeof Symbol == "function" && Symbol.toStringTag, k = p && i[Symbol.toStringTag] || i.constructor.name || "Object";
335
+ return k;
336
+ }
337
+ }
338
+ function je(i) {
339
+ try {
340
+ return et(i), !1;
341
+ } catch {
342
+ return !0;
343
+ }
344
+ }
345
+ function et(i) {
346
+ return "" + i;
347
+ }
348
+ function ut(i) {
349
+ if (je(i))
350
+ return M("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", $e(i)), et(i);
351
+ }
352
+ var he = L.ReactCurrentOwner, tt = {
353
+ key: !0,
354
+ ref: !0,
355
+ __self: !0,
356
+ __source: !0
357
+ }, wt, Ke;
358
+ function nt(i) {
359
+ if (ze.call(i, "ref")) {
360
+ var p = Object.getOwnPropertyDescriptor(i, "ref").get;
361
+ if (p && p.isReactWarning)
362
+ return !1;
363
+ }
364
+ return i.ref !== void 0;
365
+ }
366
+ function b(i) {
367
+ if (ze.call(i, "key")) {
368
+ var p = Object.getOwnPropertyDescriptor(i, "key").get;
369
+ if (p && p.isReactWarning)
370
+ return !1;
371
+ }
372
+ return i.key !== void 0;
373
+ }
374
+ function j(i, p) {
375
+ typeof i.ref == "string" && he.current;
376
+ }
377
+ function T(i, p) {
378
+ {
379
+ var k = function() {
380
+ wt || (wt = !0, M("%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://reactjs.org/link/special-props)", p));
381
+ };
382
+ k.isReactWarning = !0, Object.defineProperty(i, "key", {
383
+ get: k,
384
+ configurable: !0
385
+ });
386
+ }
387
+ }
388
+ function V(i, p) {
389
+ {
390
+ var k = function() {
391
+ Ke || (Ke = !0, M("%s: `ref` 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://reactjs.org/link/special-props)", p));
392
+ };
393
+ k.isReactWarning = !0, Object.defineProperty(i, "ref", {
394
+ get: k,
395
+ configurable: !0
396
+ });
397
+ }
398
+ }
399
+ var Y = function(i, p, k, R, se, ge, Q) {
400
+ var G = {
401
+ // This tag allows us to uniquely identify this as a React Element
402
+ $$typeof: e,
403
+ // Built-in properties that belong on the element
404
+ type: i,
405
+ key: p,
406
+ ref: k,
407
+ props: Q,
408
+ // Record the component responsible for creating this element.
409
+ _owner: ge
410
+ };
411
+ return G._store = {}, Object.defineProperty(G._store, "validated", {
412
+ configurable: !1,
413
+ enumerable: !1,
414
+ writable: !0,
415
+ value: !1
416
+ }), Object.defineProperty(G, "_self", {
417
+ configurable: !1,
418
+ enumerable: !1,
419
+ writable: !1,
420
+ value: R
421
+ }), Object.defineProperty(G, "_source", {
422
+ configurable: !1,
423
+ enumerable: !1,
424
+ writable: !1,
425
+ value: se
426
+ }), Object.freeze && (Object.freeze(G.props), Object.freeze(G)), G;
427
+ };
428
+ function le(i, p, k, R, se) {
429
+ {
430
+ var ge, Q = {}, G = null, Ye = null;
431
+ k !== void 0 && (ut(k), G = "" + k), b(p) && (ut(p.key), G = "" + p.key), nt(p) && (Ye = p.ref, j(p, se));
432
+ for (ge in p)
433
+ ze.call(p, ge) && !tt.hasOwnProperty(ge) && (Q[ge] = p[ge]);
434
+ if (i && i.defaultProps) {
435
+ var Te = i.defaultProps;
436
+ for (ge in Te)
437
+ Q[ge] === void 0 && (Q[ge] = Te[ge]);
438
+ }
439
+ if (G || Ye) {
440
+ var Be = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
441
+ G && T(Q, Be), Ye && V(Q, Be);
442
+ }
443
+ return Y(i, G, Ye, se, R, he.current, Q);
444
+ }
445
+ }
446
+ var Z = L.ReactCurrentOwner, ae = L.ReactDebugCurrentFrame;
447
+ function Fe(i) {
448
+ if (i) {
449
+ var p = i._owner, k = qe(i.type, i._source, p ? p.type : null);
450
+ ae.setExtraStackFrame(k);
451
+ } else
452
+ ae.setExtraStackFrame(null);
453
+ }
454
+ var Ge;
455
+ Ge = !1;
456
+ function ke(i) {
457
+ return typeof i == "object" && i !== null && i.$$typeof === e;
458
+ }
459
+ function u() {
460
+ {
461
+ if (Z.current) {
462
+ var i = we(Z.current.type);
463
+ if (i)
464
+ return `
465
+
466
+ Check the render method of \`` + i + "`.";
467
+ }
468
+ return "";
469
+ }
470
+ }
471
+ function E(i) {
472
+ return "";
473
+ }
474
+ var _ = {};
475
+ function H(i) {
476
+ {
477
+ var p = u();
478
+ if (!p) {
479
+ var k = typeof i == "string" ? i : i.displayName || i.name;
480
+ k && (p = `
481
+
482
+ Check the top-level render call using <` + k + ">.");
483
+ }
484
+ return p;
485
+ }
486
+ }
487
+ function q(i, p) {
488
+ {
489
+ if (!i._store || i._store.validated || i.key != null)
490
+ return;
491
+ i._store.validated = !0;
492
+ var k = H(p);
493
+ if (_[k])
494
+ return;
495
+ _[k] = !0;
496
+ var R = "";
497
+ i && i._owner && i._owner !== Z.current && (R = " It was passed a child from " + we(i._owner.type) + "."), Fe(i), M('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', k, R), Fe(null);
498
+ }
499
+ }
500
+ function Ce(i, p) {
501
+ {
502
+ if (typeof i != "object")
503
+ return;
504
+ if (rt(i))
505
+ for (var k = 0; k < i.length; k++) {
506
+ var R = i[k];
507
+ ke(R) && q(R, p);
508
+ }
509
+ else if (ke(i))
510
+ i._store && (i._store.validated = !0);
511
+ else if (i) {
512
+ var se = A(i);
513
+ if (typeof se == "function" && se !== i.entries)
514
+ for (var ge = se.call(i), Q; !(Q = ge.next()).done; )
515
+ ke(Q.value) && q(Q.value, p);
516
+ }
517
+ }
518
+ }
519
+ function m(i) {
520
+ {
521
+ var p = i.type;
522
+ if (p == null || typeof p == "string")
523
+ return;
524
+ var k;
525
+ if (typeof p == "function")
526
+ k = p.propTypes;
527
+ else if (typeof p == "object" && (p.$$typeof === s || // Note: Memo only checks outer props here.
528
+ // Inner props are checked in the reconciler.
529
+ p.$$typeof === h))
530
+ k = p.propTypes;
531
+ else
532
+ return;
533
+ if (k) {
534
+ var R = we(p);
535
+ Oe(k, i.props, "prop", R, i);
536
+ } else if (p.PropTypes !== void 0 && !Ge) {
537
+ Ge = !0;
538
+ var se = we(p);
539
+ M("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", se || "Unknown");
540
+ }
541
+ typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && M("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
542
+ }
543
+ }
544
+ function v(i) {
545
+ {
546
+ for (var p = Object.keys(i.props), k = 0; k < p.length; k++) {
547
+ var R = p[k];
548
+ if (R !== "children" && R !== "key") {
549
+ Fe(i), M("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", R), Fe(null);
550
+ break;
551
+ }
552
+ }
553
+ i.ref !== null && (Fe(i), M("Invalid attribute `ref` supplied to `React.Fragment`."), Fe(null));
554
+ }
555
+ }
556
+ var X = {};
557
+ function z(i, p, k, R, se, ge) {
558
+ {
559
+ var Q = Se(i);
560
+ if (!Q) {
561
+ var G = "";
562
+ (i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (G += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
563
+ var Ye = E();
564
+ Ye ? G += Ye : G += u();
565
+ var Te;
566
+ i === null ? Te = "null" : rt(i) ? Te = "array" : i !== void 0 && i.$$typeof === e ? (Te = "<" + (we(i.type) || "Unknown") + " />", G = " Did you accidentally export a JSX literal instead of a component?") : Te = typeof i, M("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Te, G);
567
+ }
568
+ var Be = le(i, p, k, se, ge);
569
+ if (Be == null)
570
+ return Be;
571
+ if (Q) {
572
+ var ot = p.children;
573
+ if (ot !== void 0)
574
+ if (R)
575
+ if (rt(ot)) {
576
+ for (var Ct = 0; Ct < ot.length; Ct++)
577
+ Ce(ot[Ct], i);
578
+ Object.freeze && Object.freeze(ot);
579
+ } else
580
+ M("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
581
+ else
582
+ Ce(ot, i);
583
+ }
584
+ if (ze.call(p, "key")) {
585
+ var bt = we(i), Je = Object.keys(p).filter(function(Xr) {
586
+ return Xr !== "key";
587
+ }), Yt = Je.length > 0 ? "{key: someKey, " + Je.join(": ..., ") + ": ...}" : "{key: someKey}";
588
+ if (!X[bt + Yt]) {
589
+ var Vr = Je.length > 0 ? "{" + Je.join(": ..., ") + ": ...}" : "{}";
590
+ M(`A props object containing a "key" prop is being spread into JSX:
591
+ let props = %s;
592
+ <%s {...props} />
593
+ React keys must be passed directly to JSX without using spread:
594
+ let props = %s;
595
+ <%s key={someKey} {...props} />`, Yt, bt, Vr, bt), X[bt + Yt] = !0;
596
+ }
597
+ }
598
+ return i === o ? v(Be) : m(Be), Be;
599
+ }
600
+ }
601
+ function P(i, p, k) {
602
+ return z(i, p, k, !0);
603
+ }
604
+ function te(i, p, k) {
605
+ return z(i, p, k, !1);
606
+ }
607
+ var Ee = te, Ie = P;
608
+ St.Fragment = o, St.jsx = Ee, St.jsxs = Ie;
609
+ })()), St;
610
+ }
611
+ var fr;
612
+ function Qr() {
613
+ return fr || (fr = 1, process.env.NODE_ENV === "production" ? At.exports = Jr() : At.exports = Zr()), At.exports;
614
+ }
615
+ var n = Qr();
616
+ const en = /* @__PURE__ */ new Set([
617
+ "image",
618
+ "table",
619
+ "code_block",
620
+ "html_block",
621
+ "blockquote",
622
+ "list",
623
+ "list_item",
624
+ "definition_list",
625
+ "footnote",
626
+ "footnote_reference",
627
+ "footnote_anchor",
628
+ "admonition",
629
+ "thematic_break",
630
+ "math_block",
631
+ "thinking",
632
+ "vmr_container"
633
+ ]);
634
+ function ar(t) {
635
+ if (!(!Array.isArray(t) || t.length === 0))
636
+ return t.reduce((e, [r, o]) => {
637
+ if (!r)
638
+ return e;
639
+ const a = r === "for" ? "htmlFor" : r === "class" ? "className" : r;
640
+ return e[a] = o != null ? o : !0, e;
641
+ }, {});
642
+ }
643
+ function Xe(t, e, r, o) {
644
+ if (!Array.isArray(t) || t.length === 0)
645
+ return null;
646
+ const a = [];
647
+ for (let l = 0; l < t.length; l++) {
648
+ const c = t[l];
649
+ if (c) {
650
+ if (c.type === "label_open") {
651
+ const d = [];
652
+ for (l++; l < t.length; ) {
653
+ const g = t[l];
654
+ if ((g == null ? void 0 : g.type) === "label_close")
655
+ break;
656
+ g && d.push(g), l++;
657
+ }
658
+ const s = `${r}-label-${l}`;
659
+ a.push(
660
+ /* @__PURE__ */ n.jsx("label", { ...ar(c.attrs), children: Xe(d, e, `${s}-child`, o) }, s)
661
+ );
662
+ continue;
663
+ }
664
+ c.type !== "label_close" && a.push(o(c, `${r}-${l}`, e));
665
+ }
666
+ }
667
+ return a;
668
+ }
669
+ function Ht(t, e, r, o) {
670
+ return /* @__PURE__ */ n.jsx(n.Fragment, { children: Xe(t, e, `${r}-inline`, o) });
671
+ }
672
+ const hr = {
673
+ note: "ℹ️",
674
+ info: "ℹ️",
675
+ tip: "💡",
676
+ warning: "⚠️",
677
+ danger: "❗",
678
+ error: "⛔",
679
+ caution: "⚠️"
680
+ };
681
+ function tn(t) {
682
+ const { node: e, ctx: r, renderNode: o, indexKey: a, isDark: l } = t, c = String(e.kind || "note"), d = W(() => e.title && String(e.title).trim().length ? String(e.title) : c.charAt(0).toUpperCase() + c.slice(1), [c, e.title]), [s, g] = B(() => {
683
+ var h;
684
+ return e.collapsible ? !((h = e.open) == null || h) : !1;
685
+ }), f = W(() => `admonition-${Math.random().toString(36).slice(2, 9)}`, []);
686
+ return /* @__PURE__ */ n.jsxs("div", { className: `admonition admonition-${c}${l ? " is-dark" : ""}`, "data-index-key": a, children: [
687
+ /* @__PURE__ */ n.jsxs("div", { id: f, className: "admonition-header", children: [
688
+ hr[c] && /* @__PURE__ */ n.jsx("span", { className: "admonition-icon", children: hr[c] }),
689
+ /* @__PURE__ */ n.jsx("span", { className: "admonition-title", children: d }),
690
+ e.collapsible && /* @__PURE__ */ n.jsx(
691
+ "button",
692
+ {
693
+ type: "button",
694
+ className: "admonition-toggle",
695
+ "aria-expanded": !s,
696
+ "aria-controls": `${f}-content`,
697
+ title: s ? "Expand" : "Collapse",
698
+ onClick: () => g((h) => !h),
699
+ children: /* @__PURE__ */ n.jsx("span", { children: s ? "▶" : "▼" })
700
+ }
701
+ )
702
+ ] }),
703
+ !s && /* @__PURE__ */ n.jsx("div", { id: `${f}-content`, className: "admonition-content", "aria-labelledby": f, children: r && o ? Xe(e.children, r, String(a != null ? a : f), o) : null })
704
+ ] });
705
+ }
706
+ const Nr = Ur(null);
707
+ function _r(t, e) {
708
+ const r = typeof window != "undefined" && typeof document != "undefined", o = /* @__PURE__ */ new Map(), a = (c, d) => {
709
+ var y, N;
710
+ if (!r || typeof IntersectionObserver == "undefined")
711
+ return null;
712
+ const s = (y = t()) != null ? y : null, g = `${c}::${d}`, f = o.get(g);
713
+ if (f && f.root === s)
714
+ return f;
715
+ if (f) {
716
+ try {
717
+ f.observer.disconnect();
718
+ } catch {
719
+ }
720
+ o.delete(g);
721
+ }
722
+ const h = (N = f == null ? void 0 : f.targets) != null ? N : /* @__PURE__ */ new Map(), C = new IntersectionObserver((A) => {
723
+ for (const L of A) {
724
+ const M = h.get(L.target);
725
+ if (!(!M || !(L.isIntersecting || L.intersectionRatio > 0))) {
726
+ M.state.current = !0;
727
+ try {
728
+ M.resolve();
729
+ } catch {
730
+ }
731
+ try {
732
+ C.unobserve(L.target);
733
+ } catch {
734
+ }
735
+ h.delete(L.target);
736
+ }
737
+ }
738
+ }, {
739
+ root: s,
740
+ rootMargin: c,
741
+ threshold: d
742
+ }), w = { observer: C, root: s, rootMargin: c, threshold: d, targets: h };
743
+ o.set(g, w);
744
+ for (const A of h.keys())
745
+ C.observe(A);
746
+ return w;
747
+ };
748
+ return (c, d) => {
749
+ var A, L;
750
+ const s = { current: !1 };
751
+ let g = !1, f;
752
+ const h = new Promise((M) => {
753
+ f = () => {
754
+ g || (g = !0, M());
755
+ };
756
+ }), C = () => {
757
+ for (const M of o.values())
758
+ if (M.targets.has(c)) {
759
+ M.targets.delete(c);
760
+ try {
761
+ M.observer.unobserve(c);
762
+ } catch {
763
+ }
764
+ }
765
+ };
766
+ if (!r || !e())
767
+ return s.current = !0, f(), {
768
+ isVisible: () => !0,
769
+ whenVisible: h,
770
+ destroy: C
771
+ };
772
+ const w = (A = d == null ? void 0 : d.rootMargin) != null ? A : "300px", y = (L = d == null ? void 0 : d.threshold) != null ? L : 0, N = a(w, y);
773
+ return N ? (N.targets.set(c, { resolve: f, state: s }), N.observer.observe(c), {
774
+ isVisible: () => s.current,
775
+ whenVisible: h,
776
+ destroy: C
777
+ }) : (s.current = !0, f(), {
778
+ isVisible: () => !0,
779
+ whenVisible: h,
780
+ destroy: C
781
+ });
782
+ };
783
+ }
784
+ const rn = _r(() => null, () => !0);
785
+ function nn({ getRoot: t, enabled: e = !0, children: r }) {
786
+ const o = S(e);
787
+ o.current = e;
788
+ const a = S(t);
789
+ a.current = t;
790
+ const l = W(() => _r(() => {
791
+ var c, d;
792
+ return (d = (c = a.current) == null ? void 0 : c.call(a)) != null ? d : null;
793
+ }, () => o.current), []);
794
+ return /* @__PURE__ */ n.jsx(Nr.Provider, { value: l, children: r });
795
+ }
796
+ function It() {
797
+ var t;
798
+ return (t = Kr(Nr)) != null ? t : rn;
799
+ }
800
+ const Xt = "__global__", qt = "__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__", lt = (() => {
801
+ const t = globalThis;
802
+ if (t[qt])
803
+ return t[qt];
804
+ const e = {
805
+ scopedComponents: {},
806
+ revision: 0,
807
+ listeners: /* @__PURE__ */ new Set()
808
+ };
809
+ return t[qt] = e, e;
810
+ })();
811
+ function sr() {
812
+ lt.revision++;
813
+ for (const t of Array.from(lt.listeners))
814
+ try {
815
+ t();
816
+ } catch {
817
+ }
818
+ }
819
+ function on(t) {
820
+ return lt.listeners.add(t), () => {
821
+ lt.listeners.delete(t);
822
+ };
823
+ }
824
+ function gr() {
825
+ return lt.revision;
826
+ }
827
+ function Qo(t, e) {
828
+ typeof t == "string" ? lt.scopedComponents[t] = { ...e || {} } : lt.scopedComponents[Xt] = { ...t }, sr();
829
+ }
830
+ function cr(t) {
831
+ const e = lt.scopedComponents[Xt] || {};
832
+ if (!t)
833
+ return e;
834
+ const r = lt.scopedComponents[t] || {};
835
+ return !e || Object.keys(e).length === 0 ? r : !r || Object.keys(r).length === 0 ? e : {
836
+ ...e,
837
+ ...r
838
+ };
839
+ }
840
+ function ei(t) {
841
+ if (t === Xt)
842
+ throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");
843
+ delete lt.scopedComponents[t], sr();
844
+ }
845
+ function ti() {
846
+ delete lt.scopedComponents[Xt], sr();
847
+ }
848
+ function an(t) {
849
+ const { node: e } = t;
850
+ return /* @__PURE__ */ n.jsx("span", { className: "checkbox-node", children: /* @__PURE__ */ n.jsx(
851
+ "input",
852
+ {
853
+ type: "checkbox",
854
+ checked: !!e.checked,
855
+ disabled: !0,
856
+ className: "checkbox-input",
857
+ readOnly: !0
858
+ }
859
+ ) });
860
+ }
861
+ function sn(t) {
862
+ return (t.split(".").pop() || t).replace(/[_-]/g, " ").replace(/([A-Z])/g, " $1").replace(/\s+/g, " ").replace(/\b\w/g, (r) => r.toUpperCase()).trim();
863
+ }
864
+ const Lr = {
865
+ "common.copy": "Copy",
866
+ "common.copySuccess": "Copied",
867
+ "common.decrease": "Decrease",
868
+ "common.reset": "Reset",
869
+ "common.increase": "Increase",
870
+ "common.expand": "Expand",
871
+ "common.collapse": "Collapse",
872
+ "common.preview": "Preview",
873
+ "common.source": "Source",
874
+ "common.export": "Export",
875
+ "common.open": "Open",
876
+ "common.zoomIn": "Zoom in",
877
+ "common.zoomOut": "Zoom out",
878
+ "common.resetZoom": "Reset zoom",
879
+ "image.loadError": "Image failed to load",
880
+ "image.loading": "Loading image..."
881
+ };
882
+ function ri(t) {
883
+ Object.assign(Lr, t);
884
+ }
885
+ function lr() {
886
+ return { t: (e) => {
887
+ var r;
888
+ return (r = Lr[e]) != null ? r : sn(e);
889
+ } };
890
+ }
891
+ let pe = null, Mt = null, kt = null, Ft = null, Wt = null, Bt = null;
892
+ function Br() {
893
+ Ft && (clearTimeout(Ft), Ft = null), Wt && (clearTimeout(Wt), Wt = null);
894
+ }
895
+ function cn() {
896
+ return pe || typeof document == "undefined" || (pe = document.createElement("div"), pe.className = "ms-tooltip", pe.setAttribute("role", "tooltip"), pe.dataset.visible = "false", pe.style.position = "fixed", pe.style.left = "0px", pe.style.top = "0px", pe.style.transform = "translate3d(0,0,0)", document.body.appendChild(pe)), pe;
897
+ }
898
+ function ln(t) {
899
+ if (typeof t == "boolean")
900
+ return t;
901
+ if (typeof document != "undefined")
902
+ try {
903
+ if (document.documentElement.classList.contains("dark"))
904
+ return !0;
905
+ } catch {
906
+ }
907
+ if (typeof window != "undefined" && typeof window.matchMedia == "function")
908
+ try {
909
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
910
+ } catch {
911
+ }
912
+ return !1;
913
+ }
914
+ async function pr(t) {
915
+ if (!pe || !Mt)
916
+ return;
917
+ const { x: e, y: r } = await Er(Mt, pe, {
918
+ placement: t,
919
+ middleware: [Tr(8), Rr(), Sr({ padding: 8 })],
920
+ strategy: "fixed"
921
+ });
922
+ pe.style.transform = `translate3d(${Math.round(e)}px, ${Math.round(r)}px, 0)`;
923
+ }
924
+ function Ut(t, e, r = "top", o = !1, a, l) {
925
+ if (!t || typeof document == "undefined" || (cn(), !pe))
926
+ return;
927
+ Br();
928
+ const c = async () => {
929
+ if (pe) {
930
+ Mt = t, pe.textContent = e, pe.dataset.placement = r, pe.dataset.dark = ln(l) ? "true" : "false", pe.dataset.visible = "false", Bt = `tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`, pe.id = Bt;
931
+ try {
932
+ t.setAttribute("aria-describedby", Bt);
933
+ } catch {
934
+ }
935
+ await pr(r), pe.dataset.visible = "true", kt == null || kt(), kt = Mr(t, pe, () => {
936
+ pr(r);
937
+ });
938
+ }
939
+ };
940
+ o ? c() : Ft = setTimeout(c, 80);
941
+ }
942
+ function We(t = !1) {
943
+ if (!pe)
944
+ return;
945
+ Br();
946
+ const e = () => {
947
+ if (pe) {
948
+ if (pe.dataset.visible = "false", Mt && Bt)
949
+ try {
950
+ Mt.removeAttribute("aria-describedby");
951
+ } catch {
952
+ }
953
+ Mt = null, Bt = null, kt && (kt(), kt = null);
954
+ }
955
+ };
956
+ t ? e() : Wt = setTimeout(e, 120);
957
+ }
958
+ const un = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
959
+ <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />
960
+ <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />
961
+ </svg>
962
+
963
+ `, dn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
964
+ <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">
965
+ <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />
966
+ <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />
967
+ </g>
968
+ </svg>
969
+
970
+ `, mn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
971
+ <g fill="none" stroke-linecap="round" stroke-linejoin="round">
972
+ <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />
973
+ <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />
974
+ </g>
975
+ </svg>
976
+
977
+ `, fn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
978
+ <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">
979
+ <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />
980
+ <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />
981
+ <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />
982
+ <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />
983
+ </g>
984
+ </svg>
985
+
986
+ `, hn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
987
+ <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">
988
+ <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />
989
+ <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />
990
+ </g>
991
+ </svg>
992
+
993
+ `, gn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
994
+ <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />
995
+ </svg>
996
+
997
+ `, pn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
998
+ <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />
999
+ </svg>
1000
+
1001
+ `, wn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1002
+ <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />
1003
+ </svg>
1004
+
1005
+ `, vn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1006
+ <g fill="none" stroke-linecap="round" stroke-linejoin="round">
1007
+ <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />
1008
+ <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />
1009
+ <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />
1010
+ <path stroke="#e5c890" d="m 8.5,12.5 v 0" />
1011
+ </g>
1012
+ </svg>
1013
+
1014
+ `, xn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1015
+ <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">
1016
+ <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />
1017
+ <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />
1018
+ </g>
1019
+ </svg>
1020
+
1021
+ `, yn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>
1022
+
1023
+ `, bn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1024
+ <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="m4.54 10 6.92-4m-6.92 4a1.5 1.5 0 10-2.6 1.5 1.5 1.5 0 002.6-1.5M8 4v8m0-8a1.5 1.5 0 100-3 1.5 1.5 0 000 3M4.54 6l6.92 4M4.54 6a1.5 1.5 0 10-2.6-1.5A1.5 1.5 0 004.54 6M8 12a1.5 1.5 0 100 3 1.5 1.5 0 000-3m3.46-2a1.5 1.5 0 102.6 1.5 1.5 1.5 0 00-2.6-1.5m0-4a1.5 1.5 0 102.6-1.5 1.5 1.5 0 00-2.6 1.5" />
1025
+ </svg>
1026
+
1027
+ `, kn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1028
+ <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">
1029
+ <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />
1030
+ <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />
1031
+ </g>
1032
+ </svg>
1033
+
1034
+ `, jn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1035
+ <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">
1036
+ <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />
1037
+ <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />
1038
+ <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />
1039
+ <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />
1040
+ </g>
1041
+ </svg>
1042
+
1043
+ `, Cn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1044
+ <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">
1045
+ <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />
1046
+ <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />
1047
+ </g>
1048
+ </svg>
1049
+
1050
+ `, Mn = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
1051
+ <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">
1052
+ <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />
1053
+ <path d="M12.05 1.73 8 9.28 3.95 1.73" />
1054
+ </g>
1055
+ </svg>
1056
+
1057
+ `;
1058
+ let Zt = null;
1059
+ function ni(t) {
1060
+ Zt = t != null ? t : null;
1061
+ }
1062
+ const En = {
1063
+ "": "",
1064
+ javascript: "javascript",
1065
+ js: "javascript",
1066
+ mjs: "javascript",
1067
+ cjs: "javascript",
1068
+ typescript: "typescript",
1069
+ ts: "typescript",
1070
+ jsx: "jsx",
1071
+ tsx: "tsx",
1072
+ py: "python",
1073
+ rb: "ruby",
1074
+ sh: "shell",
1075
+ bash: "shell",
1076
+ zsh: "shell",
1077
+ shellscript: "shell",
1078
+ plaintext: "plain",
1079
+ text: "plain",
1080
+ "c++": "cpp",
1081
+ md: "markdown"
1082
+ };
1083
+ function Tn(t) {
1084
+ if (!t)
1085
+ return "";
1086
+ const e = t.trim();
1087
+ if (!e)
1088
+ return "";
1089
+ const [r] = e.split(/\s+/), [o] = r.split(":");
1090
+ return o.toLowerCase();
1091
+ }
1092
+ function ft(t) {
1093
+ var r;
1094
+ const e = Tn(t);
1095
+ return (r = En[e]) != null ? r : e;
1096
+ }
1097
+ function wr(t) {
1098
+ const e = ft(t);
1099
+ if (!e)
1100
+ return "plaintext";
1101
+ switch (e) {
1102
+ case "plain":
1103
+ return "plaintext";
1104
+ case "jsx":
1105
+ return "javascript";
1106
+ case "tsx":
1107
+ return "typescript";
1108
+ default:
1109
+ return e;
1110
+ }
1111
+ }
1112
+ function ur(t) {
1113
+ if (Zt) {
1114
+ const r = Zt(t);
1115
+ if (r != null && r !== "")
1116
+ return r;
1117
+ }
1118
+ switch (ft(t)) {
1119
+ case "javascript":
1120
+ return hn;
1121
+ case "typescript":
1122
+ return Cn;
1123
+ case "jsx":
1124
+ return fn;
1125
+ case "tsx":
1126
+ return jn;
1127
+ case "html":
1128
+ return mn;
1129
+ case "css":
1130
+ return dn;
1131
+ case "json":
1132
+ return gn;
1133
+ case "python":
1134
+ return vn;
1135
+ case "shell":
1136
+ return xn;
1137
+ case "markdown":
1138
+ return pn;
1139
+ case "mermaid":
1140
+ return wn;
1141
+ case "svg":
1142
+ return bn;
1143
+ case "vue":
1144
+ return Mn;
1145
+ case "cpp":
1146
+ return un;
1147
+ case "plain":
1148
+ return kn;
1149
+ default:
1150
+ return yn;
1151
+ }
1152
+ }
1153
+ const Qt = {
1154
+ javascript: "JavaScript",
1155
+ typescript: "TypeScript",
1156
+ jsx: "JSX",
1157
+ tsx: "TSX",
1158
+ shell: "Shell",
1159
+ plain: "Text",
1160
+ text: "Text",
1161
+ markdown: "Markdown",
1162
+ json: "JSON",
1163
+ python: "Python",
1164
+ cpp: "C++",
1165
+ vue: "Vue",
1166
+ html: "HTML",
1167
+ css: "CSS",
1168
+ svg: "SVG",
1169
+ mermaid: "Mermaid"
1170
+ };
1171
+ function Rn(t) {
1172
+ const e = W(() => {
1173
+ const r = t.code || "", o = r.trim().toLowerCase();
1174
+ if (o.startsWith("<!doctype") || o.startsWith("<html") || o.startsWith("<body"))
1175
+ return r;
1176
+ const a = t.isDark ? "#020617" : "#ffffff", l = t.isDark ? "#e5e7eb" : "#020617";
1177
+ return `<!doctype html>
1178
+ <html lang="en">
1179
+ <head>
1180
+ <meta charset="utf-8" />
1181
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
1182
+ <style>
1183
+ html, body {
1184
+ margin: 0;
1185
+ padding: 0;
1186
+ height: 100%;
1187
+ background-color: ${a};
1188
+ color: ${l};
1189
+ }
1190
+ body {
1191
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;
1192
+ }
1193
+ </style>
1194
+ </head>
1195
+ <body>
1196
+ ${r}
1197
+ </body>
1198
+ </html>`;
1199
+ }, [t.code, t.isDark]);
1200
+ return F(() => {
1201
+ const r = (o) => {
1202
+ var a;
1203
+ (o.key === "Escape" || o.key === "Esc") && ((a = t.onClose) == null || a.call(t));
1204
+ };
1205
+ return typeof window != "undefined" && window.addEventListener("keydown", r), () => {
1206
+ typeof window != "undefined" && window.removeEventListener("keydown", r);
1207
+ };
1208
+ }, [t]), typeof document == "undefined" ? null : ir(
1209
+ /* @__PURE__ */ n.jsx("div", { className: `html-preview-frame__backdrop${t.isDark ? " html-preview-frame__backdrop--dark" : ""}`, onClick: () => {
1210
+ var r;
1211
+ return (r = t.onClose) == null ? void 0 : r.call(t);
1212
+ }, children: /* @__PURE__ */ n.jsxs("div", { className: `html-preview-frame${t.isDark ? " html-preview-frame--dark" : ""}`, onClick: (r) => r.stopPropagation(), children: [
1213
+ /* @__PURE__ */ n.jsxs("div", { className: "html-preview-frame__header", children: [
1214
+ /* @__PURE__ */ n.jsxs("div", { className: "html-preview-frame__title", children: [
1215
+ /* @__PURE__ */ n.jsx("span", { className: "html-preview-frame__dot" }),
1216
+ /* @__PURE__ */ n.jsx("span", { className: "html-preview-frame__label", children: t.title || "Preview" })
1217
+ ] }),
1218
+ /* @__PURE__ */ n.jsx(
1219
+ "button",
1220
+ {
1221
+ type: "button",
1222
+ className: `html-preview-frame__close${t.isDark ? " html-preview-frame__close--dark" : ""}`,
1223
+ onClick: () => {
1224
+ var r;
1225
+ return (r = t.onClose) == null ? void 0 : r.call(t);
1226
+ },
1227
+ children: "×"
1228
+ }
1229
+ )
1230
+ ] }),
1231
+ /* @__PURE__ */ n.jsx(
1232
+ "iframe",
1233
+ {
1234
+ className: "html-preview-frame__iframe",
1235
+ sandbox: "allow-scripts allow-same-origin",
1236
+ srcDoc: e,
1237
+ title: t.title || "Preview"
1238
+ }
1239
+ )
1240
+ ] }) }),
1241
+ document.body
1242
+ );
1243
+ }
1244
+ let vr = !1;
1245
+ async function Sn(t) {
1246
+ vr || (vr = !0, t != null && t.preloadMonacoWorkers && await t.preloadMonacoWorkers());
1247
+ }
1248
+ let Nt = null, xr = !1;
1249
+ async function Pr() {
1250
+ if (Nt)
1251
+ return Nt;
1252
+ if (xr)
1253
+ return null;
1254
+ try {
1255
+ return Nt = await import("stream-monaco"), await Sn(Nt), Nt;
1256
+ } catch {
1257
+ return xr = !0, null;
1258
+ }
1259
+ }
1260
+ function Nn(t) {
1261
+ var o;
1262
+ return String((o = String(t != null ? t : "").split(/\s+/g)[0]) != null ? o : "").toLowerCase().replace(/[^\w-]/g, "") || "plaintext";
1263
+ }
1264
+ function er({ node: t }) {
1265
+ var a;
1266
+ const e = W(() => Nn(t == null ? void 0 : t.language), [t]), r = `language-${e}`, o = e ? `Code block: ${e}` : "Code block";
1267
+ return /* @__PURE__ */ n.jsx(
1268
+ "pre",
1269
+ {
1270
+ className: r,
1271
+ "aria-busy": (t == null ? void 0 : t.loading) === !0,
1272
+ "aria-label": o,
1273
+ "data-language": e,
1274
+ tabIndex: 0,
1275
+ children: /* @__PURE__ */ n.jsx("code", { translate: "no", children: String((a = t == null ? void 0 : t.code) != null ? a : "") })
1276
+ }
1277
+ );
1278
+ }
1279
+ const _n = [
1280
+ "jsx",
1281
+ "tsx",
1282
+ "vue",
1283
+ "csharp",
1284
+ "python",
1285
+ "java",
1286
+ "c",
1287
+ "cpp",
1288
+ "rust",
1289
+ "go",
1290
+ "powershell",
1291
+ "sql",
1292
+ "json",
1293
+ "html",
1294
+ "javascript",
1295
+ "typescript",
1296
+ "css",
1297
+ "markdown",
1298
+ "xml",
1299
+ "yaml",
1300
+ "toml",
1301
+ "dockerfile",
1302
+ "kotlin",
1303
+ "objective-c",
1304
+ "objective-cpp",
1305
+ "php",
1306
+ "ruby",
1307
+ "scala",
1308
+ "svelte",
1309
+ "swift",
1310
+ "erlang",
1311
+ "angular-html",
1312
+ "angular-ts",
1313
+ "dart",
1314
+ "lua",
1315
+ "mermaid",
1316
+ "cmake",
1317
+ "nginx"
1318
+ ], Ln = {
1319
+ isShowPreview: !0,
1320
+ loading: !0,
1321
+ stream: !0,
1322
+ enableFontSizeControl: !0,
1323
+ showHeader: !0,
1324
+ showCopyButton: !0,
1325
+ showExpandButton: !0,
1326
+ showPreviewButton: !0,
1327
+ showFontSizeButtons: !0
1328
+ };
1329
+ function Bn(t) {
1330
+ var ke;
1331
+ const e = { ...Ln, ...t }, {
1332
+ node: r,
1333
+ isDark: o,
1334
+ loading: a,
1335
+ stream: l,
1336
+ isShowPreview: c,
1337
+ enableFontSizeControl: d,
1338
+ darkTheme: s,
1339
+ lightTheme: g,
1340
+ monacoOptions: f,
1341
+ themes: h,
1342
+ minWidth: C,
1343
+ maxWidth: w,
1344
+ showHeader: y,
1345
+ showCopyButton: N,
1346
+ showExpandButton: A,
1347
+ showPreviewButton: L,
1348
+ showFontSizeButtons: M
1349
+ } = e, I = S(null), O = S(null), re = S(null), ue = S(null), de = S(null), me = S(null), oe = S(null), Se = S(null), U = It(), ce = S(f), we = S(h), J = S(f), [K, Ne] = B(!1), [ye, Ae] = B(() => typeof window == "undefined"), [ee, ne] = B(!1), [xe, He] = B(!1), [ie, st] = B(!1), [Ze, Ue] = B(() => r.language || "plaintext"), [x, _e] = B(() => ft(r.language)), [be, Le] = B(!1), [fe, gt] = B(!1), [ve, pt] = B(!1), [qe, ze] = B(!1), { t: $ } = lr(), [De, Qe] = B(() => {
1350
+ const u = Number(f == null ? void 0 : f.fontSize);
1351
+ return Number.isFinite(u) && u > 0 ? u : 14;
1352
+ }), [Oe, ct] = B(De), rt = D(() => {
1353
+ var H, q;
1354
+ const u = (q = (H = ce.current) == null ? void 0 : H.MAX_HEIGHT) != null ? q : 500;
1355
+ if (typeof u == "number" && Number.isFinite(u))
1356
+ return Math.max(80, u);
1357
+ const E = String(u).match(/^(\d+(?:\.\d+)?)/), _ = E ? Number.parseFloat(E[1]) : 500;
1358
+ return Number.isFinite(_) ? Math.max(80, _) : 500;
1359
+ }, []), $e = D((u) => {
1360
+ var Ce, m, v, X;
1361
+ if (K)
1362
+ return;
1363
+ const E = I.current, _ = re.current;
1364
+ if (!E || !_)
1365
+ return;
1366
+ const H = me.current === "diff" ? (Ce = _.getDiffEditorView) == null ? void 0 : Ce.call(_) : (m = _.getEditorView) == null ? void 0 : m.call(_);
1367
+ if (!H)
1368
+ return;
1369
+ const q = rt();
1370
+ try {
1371
+ (v = H.updateOptions) == null || v.call(H, { automaticLayout: u });
1372
+ } catch {
1373
+ }
1374
+ u ? (E.style.maxHeight = "none", E.style.overflow = "visible") : (E.style.maxHeight = `${Math.ceil(q)}px`, E.style.overflow = "auto");
1375
+ try {
1376
+ const P = Number((() => {
1377
+ if (typeof H.getContentHeight == "function")
1378
+ return H.getContentHeight();
1379
+ if (me.current === "diff" && typeof H.getModifiedEditor == "function") {
1380
+ const te = H.getModifiedEditor();
1381
+ if (te && typeof te.getContentHeight == "function")
1382
+ return te.getContentHeight();
1383
+ }
1384
+ })());
1385
+ if (Number.isFinite(P) && P > 0) {
1386
+ const te = u ? P : Math.min(P, q);
1387
+ E.style.height = `${Math.ceil(Math.max(120, te))}px`, (X = H.layout) == null || X.call(H);
1388
+ }
1389
+ } catch {
1390
+ }
1391
+ }, [rt, K]);
1392
+ F(() => {
1393
+ ce.current = f;
1394
+ }, [f]), F(() => {
1395
+ _e(ft(r.language));
1396
+ }, [r.language]);
1397
+ const je = S(r);
1398
+ je.current = r;
1399
+ const et = D(() => {
1400
+ var H, q, Ce, m;
1401
+ const u = I.current, E = O.current;
1402
+ if (!u || !E)
1403
+ return;
1404
+ const _ = (H = u.querySelector(".monaco-editor")) != null ? H : u;
1405
+ try {
1406
+ const v = typeof window != "undefined" && window.getComputedStyle ? window.getComputedStyle(_) : null, X = String((q = v == null ? void 0 : v.getPropertyValue("--vscode-editor-foreground")) != null ? q : "").trim(), z = String((Ce = v == null ? void 0 : v.getPropertyValue("--vscode-editor-background")) != null ? Ce : "").trim(), P = String((m = v == null ? void 0 : v.getPropertyValue("--vscode-editor-selectionBackground")) != null ? m : "").trim();
1407
+ X && E.style.setProperty("--vscode-editor-foreground", X), z && E.style.setProperty("--vscode-editor-background", z), P && E.style.setProperty("--vscode-editor-selectionBackground", P);
1408
+ } catch {
1409
+ }
1410
+ }, []);
1411
+ F(() => () => {
1412
+ var u, E, _;
1413
+ (u = ue.current) == null || u.call(ue), ue.current = null, de.current = null, me.current = null, oe.current = null, (_ = (E = Se.current) == null ? void 0 : E.destroy) == null || _.call(E), Se.current = null;
1414
+ }, []), F(() => {
1415
+ var _, H;
1416
+ if (typeof window == "undefined" || ye)
1417
+ return;
1418
+ const u = O.current;
1419
+ if (!u)
1420
+ return;
1421
+ (H = (_ = Se.current) == null ? void 0 : _.destroy) == null || H.call(_);
1422
+ const E = U(u, { rootMargin: "400px" });
1423
+ return Se.current = E, E.isVisible() && Ae(!0), E.whenVisible.then(() => Ae(!0)), () => {
1424
+ E.destroy(), Se.current === E && (Se.current = null);
1425
+ };
1426
+ }, [U, ye]), F(() => {
1427
+ let u = !0;
1428
+ return typeof window == "undefined" ? () => {
1429
+ u = !1;
1430
+ } : ((async () => {
1431
+ try {
1432
+ const E = await Pr();
1433
+ if (!u)
1434
+ return;
1435
+ if (!E) {
1436
+ Ne(!0);
1437
+ return;
1438
+ }
1439
+ const _ = E.useMonaco, H = E.detectLanguage;
1440
+ if (typeof H == "function" && (oe.current = H), typeof _ != "function") {
1441
+ Ne(!0);
1442
+ return;
1443
+ }
1444
+ const q = o ? s : g, Ce = { ...J.current || {} };
1445
+ if (ft(r == null ? void 0 : r.language) === "shell") {
1446
+ const X = Array.isArray(Ce.languages) ? Ce.languages.map(String) : null, z = X != null ? X : _n;
1447
+ Ce.languages = Array.from(/* @__PURE__ */ new Set([...z, "shell"]));
1448
+ }
1449
+ const v = _({
1450
+ wordWrap: "on",
1451
+ wrappingIndent: "same",
1452
+ themes: we.current,
1453
+ theme: q,
1454
+ ...Ce,
1455
+ onThemeChange() {
1456
+ et();
1457
+ }
1458
+ });
1459
+ re.current = v, ue.current = typeof v.safeClean == "function" ? () => v.safeClean() : typeof v.cleanupEditor == "function" ? () => v.cleanupEditor() : null, ne(!0);
1460
+ } catch {
1461
+ u && Ne(!0);
1462
+ }
1463
+ })(), () => {
1464
+ u = !1;
1465
+ });
1466
+ }, []), F(() => {
1467
+ var u;
1468
+ if (!r.language && !x && oe.current)
1469
+ try {
1470
+ const E = oe.current(String((u = r.code) != null ? u : ""));
1471
+ E && Ue(E);
1472
+ } catch {
1473
+ }
1474
+ }, [x, r.code, r.language]);
1475
+ const ut = W(() => String(r.language || x || Ze || "plaintext"), [x, Ze, r.language]), he = W(() => ft(ut), [ut]), tt = W(() => wr(he), [he]), wt = W(() => ur(he), [he]), Ke = W(() => c ? he === "html" || he === "svg" : !1, [he, c]), nt = W(() => {
1476
+ const u = he;
1477
+ return u ? Qt[u] || u.charAt(0).toUpperCase() + u.slice(1) : Qt[""] || "Plain Text";
1478
+ }, [he]), b = W(() => {
1479
+ var u, E, _;
1480
+ return r.diff ? (E = (u = r.updatedCode) != null ? u : r.code) != null ? E : "" : (_ = r.code) != null ? _ : "";
1481
+ }, [r.code, r.diff, r.updatedCode]), j = W(() => {
1482
+ const u = (q) => {
1483
+ if (q != null)
1484
+ return typeof q == "number" ? `${q}px` : String(q);
1485
+ }, E = {}, _ = u(C), H = u(w);
1486
+ return _ && (E.minWidth = _), H && (E.maxWidth = H), E;
1487
+ }, [C, w]), T = l === !1 && a, V = W(() => o ? s : g, [s, o, g]);
1488
+ F(() => {
1489
+ if (K || !xe || !ye)
1490
+ return;
1491
+ const u = re.current;
1492
+ u != null && u.setTheme && V && Promise.resolve(u.setTheme(V)).then(() => et()).catch(() => {
1493
+ });
1494
+ }, [xe, V, et, K, ye]);
1495
+ const Y = D(async () => {
1496
+ if (K || ve || T)
1497
+ return null;
1498
+ const u = re.current, E = I.current;
1499
+ if (!u || !E || !u.createEditor)
1500
+ return null;
1501
+ const _ = je.current, H = _.diff ? "diff" : "single";
1502
+ if (me.current === H)
1503
+ return null;
1504
+ if (de.current)
1505
+ return de.current;
1506
+ He(!0);
1507
+ const q = (async () => {
1508
+ var Ce, m, v, X, z, P, te, Ee, Ie, i;
1509
+ try {
1510
+ (Ce = ue.current) == null || Ce.call(ue), me.current = null, st(!1);
1511
+ const p = tt;
1512
+ _.diff ? typeof u.createDiffEditor == "function" ? (me.current = "diff", await u.createDiffEditor(
1513
+ E,
1514
+ String((m = _.originalCode) != null ? m : ""),
1515
+ String((v = _.updatedCode) != null ? v : ""),
1516
+ p
1517
+ )) : (me.current = "single", await u.createEditor(E, String((z = (X = _.updatedCode) != null ? X : _.code) != null ? z : ""), p)) : (me.current = "single", await u.createEditor(E, String((P = _.code) != null ? P : ""), p));
1518
+ const k = Number((te = ce.current) == null ? void 0 : te.fontSize);
1519
+ if (Number.isFinite(k) && k > 0) {
1520
+ Qe(k), ct(k);
1521
+ try {
1522
+ const R = me.current === "diff" ? (Ee = u.getDiffEditorView) == null ? void 0 : Ee.call(u) : (Ie = u.getEditorView) == null ? void 0 : Ie.call(u);
1523
+ (i = R == null ? void 0 : R.updateOptions) == null || i.call(R, { fontSize: k, automaticLayout: !1 });
1524
+ } catch {
1525
+ }
1526
+ }
1527
+ et(), !fe && !ve && $e(!1), st(!0);
1528
+ } catch {
1529
+ Ne(!0);
1530
+ }
1531
+ })();
1532
+ return de.current = q.finally(() => {
1533
+ de.current = null;
1534
+ }), de.current;
1535
+ }, [$e, ve, fe, tt, T, et, K]), le = he === "mermaid";
1536
+ F(() => {
1537
+ var u;
1538
+ if (!K && ee && ye && !ve && !T) {
1539
+ if (le) {
1540
+ (u = ue.current) == null || u.call(ue);
1541
+ return;
1542
+ }
1543
+ Y();
1544
+ }
1545
+ }, [ve, Y, le, ee, T, K, ye]), F(() => {
1546
+ var H;
1547
+ if (e.stream === !1 || K || !ee || ve || le)
1548
+ return;
1549
+ const u = re.current;
1550
+ if (!u)
1551
+ return;
1552
+ const E = String((H = r.code) != null ? H : "");
1553
+ (async () => {
1554
+ var m, v;
1555
+ let q = x;
1556
+ if (!q && oe.current)
1557
+ try {
1558
+ q = ft(oe.current(E)), q && _e(q);
1559
+ } catch {
1560
+ }
1561
+ const Ce = wr(q || he);
1562
+ if (u.createEditor && !xe && I.current)
1563
+ try {
1564
+ await Y();
1565
+ } catch {
1566
+ }
1567
+ try {
1568
+ r.diff && u.updateDiff ? await Promise.resolve(u.updateDiff(String((m = r.originalCode) != null ? m : ""), String((v = r.updatedCode) != null ? v : ""), Ce)) : u.updateCode && await Promise.resolve(u.updateCode(E, Ce));
1569
+ } catch {
1570
+ }
1571
+ fe && $e(!0);
1572
+ })();
1573
+ }, [
1574
+ $e,
1575
+ he,
1576
+ x,
1577
+ ve,
1578
+ xe,
1579
+ Y,
1580
+ fe,
1581
+ le,
1582
+ ee,
1583
+ r.code,
1584
+ r.diff,
1585
+ r.originalCode,
1586
+ r.updatedCode,
1587
+ e.stream,
1588
+ K
1589
+ ]), F(() => {
1590
+ if (K || !ee || !ye || ve || T || !fe && a)
1591
+ return;
1592
+ const u = typeof window != "undefined" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => $e(fe)) : null;
1593
+ return u == null && $e(fe), () => {
1594
+ u != null && typeof window != "undefined" && typeof window.cancelAnimationFrame == "function" && window.cancelAnimationFrame(u);
1595
+ };
1596
+ }, [$e, ve, fe, a, ee, T, K, ye]), F(() => {
1597
+ var E, _, H;
1598
+ if (!d || K)
1599
+ return;
1600
+ const u = re.current;
1601
+ if (u) {
1602
+ try {
1603
+ const q = me.current === "diff" ? (E = u.getDiffEditorView) == null ? void 0 : E.call(u) : (_ = u.getEditorView) == null ? void 0 : _.call(u);
1604
+ (H = q == null ? void 0 : q.updateOptions) == null || H.call(q, { fontSize: Oe });
1605
+ } catch {
1606
+ }
1607
+ $e(fe);
1608
+ }
1609
+ }, [$e, d, fe, Oe, r.diff, K]);
1610
+ const Z = D((u, E) => {
1611
+ const _ = u.currentTarget;
1612
+ Ut(_, E, "top", !1, { x: u.clientX, y: u.clientY }, o);
1613
+ }, [o]), ae = D(() => {
1614
+ We();
1615
+ }, []), Fe = D(async () => {
1616
+ var u;
1617
+ try {
1618
+ typeof navigator != "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText == "function" && await navigator.clipboard.writeText(String(b)), Le(!0), (u = e.onCopy) == null || u.call(e, String(b)), setTimeout(() => Le(!1), 1e3);
1619
+ } catch {
1620
+ }
1621
+ }, [e, b]), Ge = D(() => {
1622
+ if (!Ke)
1623
+ return;
1624
+ const u = he === "html" ? "text/html" : "image/svg+xml", E = he === "html" ? $("artifacts.htmlPreviewTitle") || "HTML Preview" : $("artifacts.svgPreviewTitle") || "SVG Preview";
1625
+ if (typeof e.onPreviewCode == "function") {
1626
+ e.onPreviewCode({
1627
+ node: r,
1628
+ artifactType: u,
1629
+ artifactTitle: E,
1630
+ id: `temp-${he}-${Date.now()}`
1631
+ });
1632
+ return;
1633
+ }
1634
+ he === "html" && ze((_) => !_);
1635
+ }, [he, Ke, r, e, $]);
1636
+ return K ? /* @__PURE__ */ n.jsx(er, { node: r }) : /* @__PURE__ */ n.jsxs(
1637
+ "div",
1638
+ {
1639
+ ref: O,
1640
+ className: [
1641
+ "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",
1642
+ o ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
1643
+ a ? "is-rendering" : "",
1644
+ o ? "is-dark" : ""
1645
+ ].join(" "),
1646
+ style: j,
1647
+ children: [
1648
+ y && /* @__PURE__ */ n.jsxs(
1649
+ "div",
1650
+ {
1651
+ className: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",
1652
+ style: { color: "var(--vscode-editor-foreground)", backgroundColor: "var(--vscode-editor-background)" },
1653
+ children: [
1654
+ /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-2 flex-1 overflow-hidden", children: [
1655
+ /* @__PURE__ */ n.jsx(
1656
+ "span",
1657
+ {
1658
+ className: "icon-slot h-4 w-4 flex-shrink-0",
1659
+ dangerouslySetInnerHTML: { __html: wt }
1660
+ }
1661
+ ),
1662
+ /* @__PURE__ */ n.jsx("span", { className: "text-sm font-medium font-mono truncate", children: nt })
1663
+ ] }),
1664
+ /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-2", children: [
1665
+ /* @__PURE__ */ n.jsx(
1666
+ "button",
1667
+ {
1668
+ type: "button",
1669
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1670
+ "aria-pressed": ve,
1671
+ onClick: () => pt((u) => !u),
1672
+ onMouseEnter: (u) => Z(u, ve ? $("common.expand") || "Expand" : $("common.collapse") || "Collapse"),
1673
+ onFocus: (u) => Z(u, ve ? $("common.expand") || "Expand" : $("common.collapse") || "Collapse"),
1674
+ onMouseLeave: ae,
1675
+ onBlur: ae,
1676
+ children: /* @__PURE__ */ n.jsx(
1677
+ "svg",
1678
+ {
1679
+ style: { rotate: ve ? "0deg" : "90deg" },
1680
+ xmlns: "http://www.w3.org/2000/svg",
1681
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1682
+ "aria-hidden": "true",
1683
+ role: "img",
1684
+ width: "1em",
1685
+ height: "1em",
1686
+ viewBox: "0 0 24 24",
1687
+ className: "w-3 h-3",
1688
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m9 18l6-6l-6-6" })
1689
+ }
1690
+ )
1691
+ }
1692
+ ),
1693
+ M && d && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1694
+ /* @__PURE__ */ n.jsx(
1695
+ "button",
1696
+ {
1697
+ type: "button",
1698
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1699
+ disabled: Oe <= 10,
1700
+ onClick: () => ct((u) => Math.max(10, u - 1)),
1701
+ onMouseEnter: (u) => Z(u, $("common.decrease") || "Decrease"),
1702
+ onFocus: (u) => Z(u, $("common.decrease") || "Decrease"),
1703
+ onMouseLeave: ae,
1704
+ onBlur: ae,
1705
+ children: /* @__PURE__ */ n.jsx(
1706
+ "svg",
1707
+ {
1708
+ xmlns: "http://www.w3.org/2000/svg",
1709
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1710
+ "aria-hidden": "true",
1711
+ role: "img",
1712
+ width: "1em",
1713
+ height: "1em",
1714
+ viewBox: "0 0 24 24",
1715
+ className: "w-3 h-3",
1716
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M5 12h14" })
1717
+ }
1718
+ )
1719
+ }
1720
+ ),
1721
+ /* @__PURE__ */ n.jsx(
1722
+ "button",
1723
+ {
1724
+ type: "button",
1725
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1726
+ disabled: Oe === De,
1727
+ onClick: () => ct(De),
1728
+ onMouseEnter: (u) => Z(u, $("common.reset") || "Reset"),
1729
+ onFocus: (u) => Z(u, $("common.reset") || "Reset"),
1730
+ onMouseLeave: ae,
1731
+ onBlur: ae,
1732
+ children: /* @__PURE__ */ n.jsx(
1733
+ "svg",
1734
+ {
1735
+ xmlns: "http://www.w3.org/2000/svg",
1736
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1737
+ "aria-hidden": "true",
1738
+ role: "img",
1739
+ width: "1em",
1740
+ height: "1em",
1741
+ viewBox: "0 0 24 24",
1742
+ className: "w-3 h-3",
1743
+ children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
1744
+ /* @__PURE__ */ n.jsx("path", { d: "M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8" }),
1745
+ /* @__PURE__ */ n.jsx("path", { d: "M3 3v5h5" })
1746
+ ] })
1747
+ }
1748
+ )
1749
+ }
1750
+ ),
1751
+ /* @__PURE__ */ n.jsx(
1752
+ "button",
1753
+ {
1754
+ type: "button",
1755
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1756
+ disabled: Oe >= 36,
1757
+ onClick: () => ct((u) => Math.min(36, u + 1)),
1758
+ onMouseEnter: (u) => Z(u, $("common.increase") || "Increase"),
1759
+ onFocus: (u) => Z(u, $("common.increase") || "Increase"),
1760
+ onMouseLeave: ae,
1761
+ onBlur: ae,
1762
+ children: /* @__PURE__ */ n.jsx(
1763
+ "svg",
1764
+ {
1765
+ xmlns: "http://www.w3.org/2000/svg",
1766
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1767
+ "aria-hidden": "true",
1768
+ role: "img",
1769
+ width: "1em",
1770
+ height: "1em",
1771
+ viewBox: "0 0 24 24",
1772
+ className: "w-3 h-3",
1773
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M5 12h14m-7-7v14" })
1774
+ }
1775
+ )
1776
+ }
1777
+ )
1778
+ ] }),
1779
+ N && /* @__PURE__ */ n.jsx(
1780
+ "button",
1781
+ {
1782
+ type: "button",
1783
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1784
+ "aria-label": be ? $("common.copied") || "Copied" : $("common.copy") || "Copy",
1785
+ onClick: Fe,
1786
+ onMouseEnter: (u) => Z(u, be ? $("common.copied") || "Copied" : $("common.copy") || "Copy"),
1787
+ onFocus: (u) => Z(u, be ? $("common.copied") || "Copied" : $("common.copy") || "Copy"),
1788
+ onMouseLeave: ae,
1789
+ onBlur: ae,
1790
+ children: be ? /* @__PURE__ */ n.jsx(
1791
+ "svg",
1792
+ {
1793
+ xmlns: "http://www.w3.org/2000/svg",
1794
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1795
+ "aria-hidden": "true",
1796
+ role: "img",
1797
+ width: "1em",
1798
+ height: "1em",
1799
+ viewBox: "0 0 24 24",
1800
+ className: "w-3 h-3",
1801
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M20 6L9 17l-5-5" })
1802
+ }
1803
+ ) : /* @__PURE__ */ n.jsx(
1804
+ "svg",
1805
+ {
1806
+ xmlns: "http://www.w3.org/2000/svg",
1807
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1808
+ "aria-hidden": "true",
1809
+ role: "img",
1810
+ width: "1em",
1811
+ height: "1em",
1812
+ viewBox: "0 0 24 24",
1813
+ className: "w-3 h-3",
1814
+ children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
1815
+ /* @__PURE__ */ n.jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
1816
+ /* @__PURE__ */ n.jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
1817
+ ] })
1818
+ }
1819
+ )
1820
+ }
1821
+ ),
1822
+ A && /* @__PURE__ */ n.jsx(
1823
+ "button",
1824
+ {
1825
+ type: "button",
1826
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1827
+ "aria-pressed": fe,
1828
+ onClick: () => gt((u) => !u),
1829
+ onMouseEnter: (u) => Z(u, fe ? $("common.collapse") || "Collapse" : $("common.expand") || "Expand"),
1830
+ onFocus: (u) => Z(u, fe ? $("common.collapse") || "Collapse" : $("common.expand") || "Expand"),
1831
+ onMouseLeave: ae,
1832
+ onBlur: ae,
1833
+ children: fe ? /* @__PURE__ */ n.jsx(
1834
+ "svg",
1835
+ {
1836
+ xmlns: "http://www.w3.org/2000/svg",
1837
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1838
+ "aria-hidden": "true",
1839
+ role: "img",
1840
+ width: "1em",
1841
+ height: "1em",
1842
+ viewBox: "0 0 24 24",
1843
+ className: "w-3 h-3",
1844
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" })
1845
+ }
1846
+ ) : /* @__PURE__ */ n.jsx(
1847
+ "svg",
1848
+ {
1849
+ xmlns: "http://www.w3.org/2000/svg",
1850
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1851
+ "aria-hidden": "true",
1852
+ role: "img",
1853
+ width: "1em",
1854
+ height: "1em",
1855
+ viewBox: "0 0 24 24",
1856
+ className: "w-3 h-3",
1857
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" })
1858
+ }
1859
+ )
1860
+ }
1861
+ ),
1862
+ Ke && L && /* @__PURE__ */ n.jsx(
1863
+ "button",
1864
+ {
1865
+ type: "button",
1866
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
1867
+ "aria-label": $("common.preview") || "Preview",
1868
+ onClick: Ge,
1869
+ onMouseEnter: (u) => Z(u, $("common.preview") || "Preview"),
1870
+ onFocus: (u) => Z(u, $("common.preview") || "Preview"),
1871
+ onMouseLeave: ae,
1872
+ onBlur: ae,
1873
+ children: /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", children: /* @__PURE__ */ n.jsxs("g", { fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd", children: [
1874
+ /* @__PURE__ */ n.jsx("path", { d: "M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496" }),
1875
+ /* @__PURE__ */ n.jsx("path", { d: "M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23" })
1876
+ ] }) })
1877
+ }
1878
+ )
1879
+ ] })
1880
+ ]
1881
+ }
1882
+ ),
1883
+ /* @__PURE__ */ n.jsxs("div", { className: `code-block-body${fe ? " code-block-body--expanded" : ""}`, children: [
1884
+ !ve && (l ? !0 : !a) && (K ? /* @__PURE__ */ n.jsx(er, { node: r }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1885
+ /* @__PURE__ */ n.jsx(
1886
+ "div",
1887
+ {
1888
+ ref: I,
1889
+ className: `code-editor-container${l ? "" : " code-height-placeholder"}`,
1890
+ style: { visibility: ie ? "visible" : "hidden" },
1891
+ "aria-hidden": !ie
1892
+ }
1893
+ ),
1894
+ !ie && /* @__PURE__ */ n.jsx(
1895
+ "div",
1896
+ {
1897
+ style: {
1898
+ position: "absolute",
1899
+ inset: 0,
1900
+ overflow: "auto",
1901
+ padding: "1rem"
1902
+ },
1903
+ children: /* @__PURE__ */ n.jsx(
1904
+ "pre",
1905
+ {
1906
+ className: "code-fallback-plain m-0",
1907
+ "aria-busy": a,
1908
+ "aria-label": `Code block: ${nt}`,
1909
+ tabIndex: 0,
1910
+ children: /* @__PURE__ */ n.jsx("code", { translate: "no", children: String(b) })
1911
+ }
1912
+ )
1913
+ }
1914
+ )
1915
+ ] })),
1916
+ !l && a && /* @__PURE__ */ n.jsx("div", { className: "code-loading-placeholder", children: /* @__PURE__ */ n.jsxs("div", { className: "loading-skeleton", children: [
1917
+ /* @__PURE__ */ n.jsx("div", { className: "skeleton-line" }),
1918
+ /* @__PURE__ */ n.jsx("div", { className: "skeleton-line" }),
1919
+ /* @__PURE__ */ n.jsx("div", { className: "skeleton-line short" })
1920
+ ] }) })
1921
+ ] }),
1922
+ qe && !e.onPreviewCode && Ke && he === "html" && /* @__PURE__ */ n.jsx(
1923
+ Rn,
1924
+ {
1925
+ code: String((ke = r.code) != null ? ke : ""),
1926
+ isDark: o,
1927
+ onClose: () => ze(!1)
1928
+ }
1929
+ ),
1930
+ /* @__PURE__ */ n.jsx("span", { className: "sr-only", "aria-live": "polite", role: "status", children: be ? $("common.copied") || "Copied" : "" })
1931
+ ]
1932
+ }
1933
+ );
1934
+ }
1935
+ function Pn(t) {
1936
+ const { node: e, ctx: r, renderNode: o, indexKey: a } = t, l = Array.isArray(e.items) ? e.items : [];
1937
+ return /* @__PURE__ */ n.jsx("dl", { className: "definition-list", "data-index-key": a, children: l.map((c, d) => /* @__PURE__ */ n.jsxs("div", { className: "mb-4", children: [
1938
+ /* @__PURE__ */ n.jsx("dt", { className: "definition-term font-semibold", children: r && o ? Ht(c.term, r, `${String(a != null ? a : "definition")}-term-${d}`, o) : null }),
1939
+ /* @__PURE__ */ n.jsx("dd", { className: "definition-desc ml-4", children: r && o ? Ht(c.definition, r, `${String(a != null ? a : "definition")}-desc-${d}`, o) : null })
1940
+ ] }, `${String(a != null ? a : "definition")}-${d}`)) });
1941
+ }
1942
+ function Dn(t) {
1943
+ var r;
1944
+ const { node: e } = t;
1945
+ return /* @__PURE__ */ n.jsx("span", { className: "emoji-node", children: (r = e.name) != null ? r : e.markup });
1946
+ }
1947
+ function In(t) {
1948
+ return /* @__PURE__ */ n.jsx("em", { className: "emphasis-node", children: t.children });
1949
+ }
1950
+ function An(t) {
1951
+ const { node: e } = t, r = D((o) => {
1952
+ var l;
1953
+ if (o.preventDefault(), typeof document == "undefined")
1954
+ return;
1955
+ const a = document.getElementById(`fnref-${String((l = e.id) != null ? l : "")}`);
1956
+ a && a.scrollIntoView({ behavior: "smooth" });
1957
+ }, [e.id]);
1958
+ return /* @__PURE__ */ n.jsx(
1959
+ "a",
1960
+ {
1961
+ className: "footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",
1962
+ href: `#fnref-${e.id}`,
1963
+ title: `Back to reference ${e.id}`,
1964
+ onClick: r,
1965
+ children: "↩︎"
1966
+ }
1967
+ );
1968
+ }
1969
+ function On(t) {
1970
+ const { node: e, ctx: r, renderNode: o, indexKey: a } = t;
1971
+ return /* @__PURE__ */ n.jsx("div", { id: `footnote-${e.id}`, className: "footnote-node flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2", children: /* @__PURE__ */ n.jsx("div", { className: "flex-1", children: r && o ? Xe(e.children, r, String(a != null ? a : `footnote-${e.id}`), o) : null }) });
1972
+ }
1973
+ function $n(t) {
1974
+ const { node: e } = t, r = W(() => `#footnote-${e.id}`, [e.id]), o = D((a) => {
1975
+ if (a.preventDefault(), typeof document == "undefined")
1976
+ return;
1977
+ const l = document.querySelector(r);
1978
+ l && l.scrollIntoView({ behavior: "smooth" });
1979
+ }, [r]);
1980
+ return /* @__PURE__ */ n.jsx("sup", { id: `fnref-${e.id}`, className: "footnote-reference", onClick: o, children: /* @__PURE__ */ n.jsxs("a", { href: r, title: `View footnote ${e.id}`, className: "footnote-link cursor-pointer", children: [
1981
+ "[",
1982
+ e.id,
1983
+ "]"
1984
+ ] }) });
1985
+ }
1986
+ function Fn(t) {
1987
+ return /* @__PURE__ */ n.jsx("br", { className: "hard-break" });
1988
+ }
1989
+ function Dr(t) {
1990
+ var e, r, o = "";
1991
+ if (typeof t == "string" || typeof t == "number") o += t;
1992
+ else if (typeof t == "object") if (Array.isArray(t)) {
1993
+ var a = t.length;
1994
+ for (e = 0; e < a; e++) t[e] && (r = Dr(t[e])) && (o && (o += " "), o += r);
1995
+ } else for (r in t) t[r] && (o && (o += " "), o += r);
1996
+ return o;
1997
+ }
1998
+ function Me() {
1999
+ for (var t, e, r = 0, o = "", a = arguments.length; r < a; r++) (t = arguments[r]) && (e = Dr(t)) && (o && (o += " "), o += e);
2000
+ return o;
2001
+ }
2002
+ function Wn(t) {
2003
+ const { node: e, ctx: r, renderNode: o, indexKey: a, children: l } = t, c = Math.min(6, Math.max(1, Number(e.level) || 1)), d = `h${c}`;
2004
+ return /* @__PURE__ */ n.jsx(
2005
+ d,
2006
+ {
2007
+ dir: "auto",
2008
+ className: Me("heading-node font-semibold", `heading-${c}`),
2009
+ children: l != null ? l : r && o ? Xe(e.children, r, String(a != null ? a : `heading-${c}`), o) : null
2010
+ }
2011
+ );
2012
+ }
2013
+ function Hn(t) {
2014
+ return /* @__PURE__ */ n.jsx("mark", { className: "highlight-node", children: t.children });
2015
+ }
2016
+ function zn(t) {
2017
+ const { node: e, placeholder: r } = t, o = It(), [a, l] = B(null), c = S(null), [d, s] = B(() => typeof window == "undefined"), [g, f] = B(e.content), h = !!e.loading;
2018
+ F(() => {
2019
+ var y;
2020
+ if (typeof window == "undefined") {
2021
+ s(!0);
2022
+ return;
2023
+ }
2024
+ if ((y = c.current) == null || y.destroy(), c.current = null, !h) {
2025
+ s(!0), f(e.content);
2026
+ return;
2027
+ }
2028
+ if (!a) {
2029
+ s(!1);
2030
+ return;
2031
+ }
2032
+ const w = o(a, { rootMargin: "400px" });
2033
+ return c.current = w, w.isVisible() && s(!0), w.whenVisible.then(() => s(!0)).catch(() => {
2034
+ }), () => {
2035
+ w.destroy(), c.current = null;
2036
+ };
2037
+ }, [a, h, e.content, o]), F(() => () => {
2038
+ var w;
2039
+ (w = c.current) == null || w.destroy(), c.current = null;
2040
+ }, []), F(() => {
2041
+ (!h || d) && f(e.content);
2042
+ }, [h, e.content, d]);
2043
+ const C = W(() => {
2044
+ var w;
2045
+ return ar((w = e.attrs) != null ? w : void 0);
2046
+ }, [e.attrs]);
2047
+ return /* @__PURE__ */ n.jsx("div", { ref: l, className: "html-block-node", ...C, children: d ? /* @__PURE__ */ n.jsx("div", { dangerouslySetInnerHTML: { __html: g != null ? g : "" } }) : /* @__PURE__ */ n.jsx("div", { className: "html-block-node__placeholder", children: r != null ? r : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2048
+ /* @__PURE__ */ n.jsx("span", { className: "html-block-node__placeholder-bar" }),
2049
+ /* @__PURE__ */ n.jsx("span", { className: "html-block-node__placeholder-bar w-4/5" }),
2050
+ /* @__PURE__ */ n.jsx("span", { className: "html-block-node__placeholder-bar w-2/3" })
2051
+ ] }) }) });
2052
+ }
2053
+ function Vn(t) {
2054
+ var o;
2055
+ const { node: e } = t;
2056
+ return e.loading && !e.autoClosed ? /* @__PURE__ */ n.jsx("span", { className: "html-inline-node html-inline-node--loading", children: e.content }) : /* @__PURE__ */ n.jsx(
2057
+ "span",
2058
+ {
2059
+ className: "html-inline-node",
2060
+ dangerouslySetInnerHTML: { __html: (o = e.content) != null ? o : "" }
2061
+ }
2062
+ );
2063
+ }
2064
+ const Xn = {
2065
+ fallbackSrc: "",
2066
+ showCaption: !1,
2067
+ lazy: !0,
2068
+ svgMinHeight: "12rem",
2069
+ usePlaceholder: !0
2070
+ };
2071
+ function Un(t) {
2072
+ var re, ue, de, me, oe, Se;
2073
+ const e = { ...Xn, ...t }, r = It(), [o, a] = B(null), l = S(null), [c, d] = B(() => typeof window == "undefined" || e.lazy === !1), [s, g] = B(!1), [f, h] = B(!1), [C, w] = B(!1);
2074
+ F(() => {
2075
+ var J;
2076
+ if (!e.lazy)
2077
+ return;
2078
+ const U = o;
2079
+ if ((J = l.current) == null || J.destroy(), l.current = null, !U) {
2080
+ d(!1);
2081
+ return;
2082
+ }
2083
+ const ce = r(U, { rootMargin: "400px" });
2084
+ return l.current = ce, ce.isVisible() && d(!0), ce.whenVisible.then(() => d(!0)).catch(() => {
2085
+ }), () => {
2086
+ ce.destroy(), l.current = null;
2087
+ };
2088
+ }, [o, r, e.lazy]), F(() => () => {
2089
+ var U;
2090
+ (U = l.current) == null || U.destroy(), l.current = null;
2091
+ }, []);
2092
+ const y = W(() => f && e.fallbackSrc ? e.fallbackSrc : e.node.src, [f, e.fallbackSrc, e.node.src]);
2093
+ F(() => {
2094
+ g(!1), h(!1);
2095
+ }, [y]), F(() => {
2096
+ w(!1);
2097
+ }, [e.node.src]);
2098
+ const N = W(() => /\.svg(?:\?|$)/i.test(String(y)), [y]), A = !e.lazy || c, L = () => {
2099
+ var U;
2100
+ e.fallbackSrc && !C ? (w(!0), h(!0)) : (h(!0), (U = e.onError) == null || U.call(e, e.node.src));
2101
+ }, M = () => {
2102
+ var U;
2103
+ g(!0), h(!1), (U = e.onLoad) == null || U.call(e, y);
2104
+ }, I = (U) => {
2105
+ var ce;
2106
+ U.preventDefault(), !(!s || f) && ((ce = e.onClick) == null || ce.call(e, [U, y]));
2107
+ }, O = N ? { minHeight: e.svgMinHeight, width: "100%" } : { minHeight: "6rem" };
2108
+ return /* @__PURE__ */ n.jsxs("figure", { ref: a, className: "image-node", children: [
2109
+ /* @__PURE__ */ n.jsx("div", { className: "image-node__inner", children: !e.node.loading && !f && A ? /* @__PURE__ */ n.jsx(
2110
+ "img",
2111
+ {
2112
+ src: y,
2113
+ alt: String((ue = (re = e.node.alt) != null ? re : e.node.title) != null ? ue : ""),
2114
+ title: String((me = (de = e.node.title) != null ? de : e.node.alt) != null ? me : ""),
2115
+ className: `image-node__img${s ? " is-loaded" : ""}`,
2116
+ style: N ? { minHeight: e.svgMinHeight, width: "100%", height: "auto", objectFit: "contain" } : void 0,
2117
+ loading: e.lazy ? "lazy" : "eager",
2118
+ decoding: "async",
2119
+ tabIndex: s ? 0 : -1,
2120
+ "aria-label": (oe = e.node.alt) != null ? oe : "Preview image",
2121
+ onError: L,
2122
+ onLoad: M,
2123
+ onClick: I
2124
+ },
2125
+ "image"
2126
+ ) : f ? /* @__PURE__ */ n.jsxs("div", { className: "image-node__error", children: [
2127
+ /* @__PURE__ */ n.jsx(
2128
+ "svg",
2129
+ {
2130
+ xmlns: "http://www.w3.org/2000/svg",
2131
+ width: "16",
2132
+ height: "16",
2133
+ viewBox: "0 0 24 24",
2134
+ "aria-hidden": "true",
2135
+ children: /* @__PURE__ */ n.jsx(
2136
+ "path",
2137
+ {
2138
+ fill: "currentColor",
2139
+ d: "M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"
2140
+ }
2141
+ )
2142
+ }
2143
+ ),
2144
+ /* @__PURE__ */ n.jsx("span", { className: "image-node__placeholder-text", children: "Image failed to load" })
2145
+ ] }) : /* @__PURE__ */ n.jsx(
2146
+ "div",
2147
+ {
2148
+ className: "image-node__placeholder",
2149
+ style: O,
2150
+ children: e.usePlaceholder ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2151
+ /* @__PURE__ */ n.jsx("span", { className: "image-node__spinner", "aria-hidden": "true" }),
2152
+ /* @__PURE__ */ n.jsx("span", { className: "image-node__placeholder-text", children: "Loading image..." })
2153
+ ] }) : /* @__PURE__ */ n.jsx("span", { className: "image-node__placeholder-text", children: (Se = e.node.raw) != null ? Se : "Loading image…" })
2154
+ },
2155
+ "placeholder"
2156
+ ) }),
2157
+ e.showCaption && e.node.alt && /* @__PURE__ */ n.jsx("figcaption", { className: "image-node__caption", children: e.node.alt })
2158
+ ] });
2159
+ }
2160
+ function Kn(t) {
2161
+ const { node: e } = t;
2162
+ return /* @__PURE__ */ n.jsx("code", { className: "inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-secondary whitespace-normal break-words max-w-full", children: e.code });
2163
+ }
2164
+ function Yn(t) {
2165
+ return /* @__PURE__ */ n.jsx("ins", { className: "insert-node", children: t.children });
2166
+ }
2167
+ function qn(t) {
2168
+ var h, C, w, y, N;
2169
+ const { node: e, ctx: r, renderNode: o, indexKey: a } = t, l = t.showTooltip !== !1, c = (h = t.isDark) != null ? h : r == null ? void 0 : r.isDark, d = W(() => {
2170
+ var L, M, I, O, re, ue;
2171
+ const A = t.underlineBottom !== void 0 ? typeof t.underlineBottom == "number" ? `${t.underlineBottom}px` : String(t.underlineBottom) : "-3px";
2172
+ return {
2173
+ "--link-color": (L = t.color) != null ? L : "#0366d6",
2174
+ "--underline-height": `${(M = t.underlineHeight) != null ? M : 2}px`,
2175
+ "--underline-bottom": A,
2176
+ "--underline-opacity": String((I = t.animationOpacity) != null ? I : 0.9),
2177
+ "--underline-duration": `${(O = t.animationDuration) != null ? O : 0.8}s`,
2178
+ "--underline-timing": (re = t.animationTiming) != null ? re : "linear",
2179
+ "--underline-iteration": typeof t.animationIteration == "number" ? String(t.animationIteration) : (ue = t.animationIteration) != null ? ue : "infinite"
2180
+ };
2181
+ }, [
2182
+ t.animationDuration,
2183
+ t.animationIteration,
2184
+ t.animationOpacity,
2185
+ t.animationTiming,
2186
+ t.color,
2187
+ t.underlineBottom,
2188
+ t.underlineHeight
2189
+ ]), s = String((w = (C = e.title) != null ? C : e.href) != null ? w : ""), g = D((A) => {
2190
+ if (!l)
2191
+ return;
2192
+ const L = A.currentTarget, M = String(e.title || e.href || e.text || "");
2193
+ Ut(L, M, "top", !1, { x: A.clientX, y: A.clientY }, c);
2194
+ }, [c, e.href, e.text, e.title, l]), f = D(() => {
2195
+ l && We();
2196
+ }, [l]);
2197
+ return e.loading ? /* @__PURE__ */ n.jsx(
2198
+ "span",
2199
+ {
2200
+ className: "link-loading inline-flex items-baseline gap-1.5",
2201
+ "aria-hidden": "false",
2202
+ style: d,
2203
+ children: /* @__PURE__ */ n.jsxs("span", { className: "link-text-wrapper relative inline-flex", children: [
2204
+ /* @__PURE__ */ n.jsx("span", { className: "leading-[normal] link-text", children: /* @__PURE__ */ n.jsx("span", { className: "leading-[normal] link-text", children: (y = e.text) != null ? y : "" }) }),
2205
+ /* @__PURE__ */ n.jsx("span", { className: "underline-anim", "aria-hidden": "true" })
2206
+ ] })
2207
+ }
2208
+ ) : /* @__PURE__ */ n.jsx(
2209
+ "a",
2210
+ {
2211
+ className: "link-node",
2212
+ href: e.href,
2213
+ title: l ? "" : s,
2214
+ "aria-label": `Link: ${s}`,
2215
+ target: "_blank",
2216
+ rel: "noopener noreferrer",
2217
+ style: d,
2218
+ onMouseEnter: g,
2219
+ onMouseLeave: f,
2220
+ children: r && o ? Xe(e.children, r, String(a != null ? a : "link"), o) : (N = e.text) != null ? N : null
2221
+ }
2222
+ );
2223
+ }
2224
+ function Ir(t) {
2225
+ const { node: e, ctx: r, renderNode: o, value: a, indexKey: l, children: c } = t, d = a == null ? void 0 : a;
2226
+ return /* @__PURE__ */ n.jsx("li", { className: "list-item pl-1.5 my-2", dir: "auto", value: d, children: c != null ? c : r && o ? Xe(e.children, r, String(l != null ? l : "list-item"), o) : null });
2227
+ }
2228
+ function Gn(t) {
2229
+ var d;
2230
+ const { node: e, ctx: r, renderNode: o, indexKey: a } = t, l = e.ordered ? "ol" : "ul", c = e.ordered && e.start ? e.start : void 0;
2231
+ return /* @__PURE__ */ n.jsx(
2232
+ l,
2233
+ {
2234
+ className: Me(
2235
+ "list-node my-5 pl-[calc(13/8*1em)]",
2236
+ e.ordered ? "list-decimal" : "list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"
2237
+ ),
2238
+ start: c,
2239
+ children: (d = e.items) == null ? void 0 : d.map((s, g) => {
2240
+ var f;
2241
+ return /* @__PURE__ */ n.jsx(
2242
+ Ir,
2243
+ {
2244
+ node: s,
2245
+ value: e.ordered ? ((f = e.start) != null ? f : 1) + g : void 0,
2246
+ ctx: r,
2247
+ renderNode: o,
2248
+ indexKey: `${String(a != null ? a : "list")}-${g}`
2249
+ },
2250
+ `${String(a != null ? a : "list")}-${g}`
2251
+ );
2252
+ })
2253
+ }
2254
+ );
2255
+ }
2256
+ let at = null, yt = null, tr = !1;
2257
+ const it = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Map(), Ar = 200;
2258
+ let Dt = 5;
2259
+ const Et = /* @__PURE__ */ new Set();
2260
+ function Tt() {
2261
+ if (it.size < Dt && Et.size) {
2262
+ const t = Array.from(Et);
2263
+ Et.clear();
2264
+ for (const e of t)
2265
+ try {
2266
+ e();
2267
+ } catch {
2268
+ }
2269
+ }
2270
+ }
2271
+ let dt = null;
2272
+ function oi(t) {
2273
+ at = t, yt = null, at.onmessage = (e) => {
2274
+ const { id: r, html: o, error: a } = e.data, l = it.get(r);
2275
+ if (l)
2276
+ if (it.delete(r), clearTimeout(l.timeoutId), Tt(), a)
2277
+ l.reject(new Error(a));
2278
+ else {
2279
+ const { content: c, displayMode: d } = e.data;
2280
+ if (c) {
2281
+ const s = `${d ? "d" : "i"}:${c}`;
2282
+ if (ht.set(s, o), ht.size > Ar) {
2283
+ const g = ht.keys().next().value;
2284
+ ht.delete(g);
2285
+ }
2286
+ }
2287
+ l.resolve(o);
2288
+ }
2289
+ }, at.onerror = (e) => {
2290
+ console.error("[katexWorkerClient] Worker error:", e);
2291
+ for (const [r, o] of it.entries())
2292
+ clearTimeout(o.timeoutId), o.reject(new Error(`Worker error: ${e.message}`));
2293
+ it.clear(), Tt();
2294
+ };
2295
+ }
2296
+ function ii() {
2297
+ var t;
2298
+ at && ((t = at.terminate) == null || t.call(at)), at = null, yt = null;
2299
+ }
2300
+ function Jn() {
2301
+ return at || (yt = new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."), yt.name = "WORKER_INIT_ERROR", yt.code = "WORKER_INIT_ERROR", null);
2302
+ }
2303
+ function ai(t) {
2304
+ tr = !!t, at && at.postMessage({ type: "init", debug: tr });
2305
+ }
2306
+ const Kt = "WORKER_BUSY";
2307
+ async function Zn(t, e = !0, r = 2e3, o) {
2308
+ const a = performance.now();
2309
+ if (yt)
2310
+ return Promise.reject(yt);
2311
+ const l = `${e ? "d" : "i"}:${t}`, c = ht.get(l);
2312
+ if (c)
2313
+ return dt && dt.recordRender({
2314
+ type: "cache-hit",
2315
+ duration: performance.now() - a,
2316
+ formulaLength: t.length,
2317
+ timestamp: Date.now(),
2318
+ success: !0
2319
+ }), Promise.resolve(c);
2320
+ const d = Jn();
2321
+ if (!d)
2322
+ return Promise.reject(yt);
2323
+ if (it.size >= Dt) {
2324
+ const s = new Error("Worker busy");
2325
+ return s.name = "WorkerBusy", s.code = Kt, s.busy = !0, s.inFlight = it.size, s.max = Dt, dt && dt.recordRender({
2326
+ type: "worker",
2327
+ duration: performance.now() - a,
2328
+ formulaLength: t.length,
2329
+ timestamp: Date.now(),
2330
+ success: !1,
2331
+ error: "busy"
2332
+ }), Promise.reject(s);
2333
+ }
2334
+ return new Promise((s, g) => {
2335
+ if (o != null && o.aborted) {
2336
+ const y = new Error("Aborted");
2337
+ y.name = "AbortError", g(y);
2338
+ return;
2339
+ }
2340
+ const f = Math.random().toString(36).slice(2), h = setTimeout(() => {
2341
+ it.delete(f);
2342
+ const y = new Error("Worker render timed out");
2343
+ y.name = "WorkerTimeout", y.code = "WORKER_TIMEOUT", dt && dt.recordRender({
2344
+ type: "worker",
2345
+ duration: performance.now() - a,
2346
+ formulaLength: t.length,
2347
+ timestamp: Date.now(),
2348
+ success: !1,
2349
+ error: "timeout"
2350
+ }), g(y), Tt();
2351
+ }, r), C = () => {
2352
+ }, w = () => {
2353
+ it.delete(f), clearTimeout(h), Et.delete(C);
2354
+ const y = new Error("Aborted");
2355
+ y.name = "AbortError", g(y), Tt();
2356
+ };
2357
+ o && o.addEventListener("abort", w, { once: !0 }), it.set(f, {
2358
+ resolve: (y) => {
2359
+ o && o.removeEventListener("abort", w), dt && dt.recordRender({
2360
+ type: "worker",
2361
+ duration: performance.now() - a,
2362
+ formulaLength: t.length,
2363
+ timestamp: Date.now(),
2364
+ success: !0
2365
+ }), s(y);
2366
+ },
2367
+ reject: (y) => {
2368
+ o && o.removeEventListener("abort", w), dt && dt.recordRender({
2369
+ type: "worker",
2370
+ duration: performance.now() - a,
2371
+ formulaLength: t.length,
2372
+ timestamp: Date.now(),
2373
+ success: !1,
2374
+ error: (y == null ? void 0 : y.code) || (y == null ? void 0 : y.message)
2375
+ }), g(y);
2376
+ },
2377
+ timeoutId: h
2378
+ });
2379
+ try {
2380
+ d.postMessage({ id: f, content: t, displayMode: e, debug: tr });
2381
+ } catch (y) {
2382
+ it.delete(f), clearTimeout(h), o && o.removeEventListener("abort", w), g(y), Tt();
2383
+ }
2384
+ });
2385
+ }
2386
+ function Or(t, e, r) {
2387
+ const o = `${e ? "d" : "i"}:${t}`;
2388
+ if (ht.set(o, r), ht.size > Ar) {
2389
+ const a = ht.keys().next().value;
2390
+ ht.delete(a);
2391
+ }
2392
+ }
2393
+ function si() {
2394
+ ht.clear();
2395
+ }
2396
+ function ci(t) {
2397
+ Dt = Math.max(1, Math.floor(t)), Tt();
2398
+ }
2399
+ function Qn(t = 1500, e) {
2400
+ return it.size < Dt ? Promise.resolve() : new Promise((r, o) => {
2401
+ if (e != null && e.aborted) {
2402
+ const s = new Error("Aborted");
2403
+ s.name = "AbortError", o(s);
2404
+ return;
2405
+ }
2406
+ let a = null;
2407
+ function l() {
2408
+ Et.delete(c), a != null && clearTimeout(a), e && e.removeEventListener("abort", d);
2409
+ }
2410
+ function c() {
2411
+ l(), r();
2412
+ }
2413
+ function d() {
2414
+ l();
2415
+ const s = new Error("Aborted");
2416
+ s.name = "AbortError", o(s);
2417
+ }
2418
+ a = t > 0 ? setTimeout(() => {
2419
+ l(), o(new Error("Timeout waiting for worker slot"));
2420
+ }, t) : null, e && e.addEventListener("abort", d, { once: !0 }), Et.add(c);
2421
+ });
2422
+ }
2423
+ const vt = {
2424
+ timeout: 2e3,
2425
+ waitTimeout: 1500,
2426
+ backoffMs: 30,
2427
+ maxRetries: 1
2428
+ };
2429
+ function li(t) {
2430
+ t.timeout != null && (vt.timeout = Math.max(0, Math.floor(t.timeout))), t.waitTimeout != null && (vt.waitTimeout = Math.max(0, Math.floor(t.waitTimeout))), t.backoffMs != null && (vt.backoffMs = Math.max(0, Math.floor(t.backoffMs))), t.maxRetries != null && (vt.maxRetries = Math.max(0, Math.floor(t.maxRetries)));
2431
+ }
2432
+ function ui() {
2433
+ return { ...vt };
2434
+ }
2435
+ async function $r(t, e = !0, r = {}) {
2436
+ var g, f, h, C;
2437
+ const o = (g = r.timeout) != null ? g : vt.timeout, a = (f = r.waitTimeout) != null ? f : vt.waitTimeout, l = (h = r.backoffMs) != null ? h : vt.backoffMs, c = (C = r.maxRetries) != null ? C : vt.maxRetries, d = r.signal;
2438
+ let s = 0;
2439
+ for (; ; ) {
2440
+ if (d != null && d.aborted) {
2441
+ const w = new Error("Aborted");
2442
+ throw w.name = "AbortError", w;
2443
+ }
2444
+ try {
2445
+ return await Zn(t, e, o, d);
2446
+ } catch (w) {
2447
+ if ((w == null ? void 0 : w.code) !== Kt || s >= c)
2448
+ throw w;
2449
+ if (s++, await Qn(a, d).catch(() => {
2450
+ }), d != null && d.aborted) {
2451
+ const y = new Error("Aborted");
2452
+ throw y.name = "AbortError", y;
2453
+ }
2454
+ l > 0 && await new Promise((y) => setTimeout(y, l * s));
2455
+ }
2456
+ }
2457
+ }
2458
+ let Ot = null, yr = !1;
2459
+ async function Fr() {
2460
+ if (Ot)
2461
+ return Ot;
2462
+ if (yr)
2463
+ return null;
2464
+ try {
2465
+ return Ot = await import("katex"), await import("katex/contrib/mhchem"), Ot;
2466
+ } catch {
2467
+ return yr = !0, null;
2468
+ }
2469
+ }
2470
+ function eo({ node: t }) {
2471
+ const e = S(null), [r, o] = B(!0), a = S(0);
2472
+ return F(() => {
2473
+ var g;
2474
+ let l = !1;
2475
+ const c = new AbortController(), d = ++a.current, s = (g = t.content) != null ? g : "";
2476
+ return s ? ($r(s, !0, {
2477
+ timeout: 3e3,
2478
+ waitTimeout: 2e3,
2479
+ maxRetries: 1,
2480
+ signal: c.signal
2481
+ }).then((f) => {
2482
+ l || d !== a.current || (e.current && (e.current.innerHTML = f), o(!1));
2483
+ }).catch(async (f) => {
2484
+ if (l || d !== a.current || !e.current)
2485
+ return;
2486
+ const h = (f == null ? void 0 : f.code) || (f == null ? void 0 : f.name);
2487
+ if (h === "WORKER_INIT_ERROR" || (f == null ? void 0 : f.fallbackToRenderer) || (h === Kt || h === "WORKER_TIMEOUT")) {
2488
+ const y = await Fr();
2489
+ if (y)
2490
+ try {
2491
+ const N = y.renderToString(s, {
2492
+ throwOnError: t.loading,
2493
+ displayMode: !0
2494
+ });
2495
+ !l && d === a.current && e.current && (e.current.innerHTML = N, o(!1), Or(s, !0, N));
2496
+ return;
2497
+ } catch {
2498
+ }
2499
+ }
2500
+ t.loading || (e.current.textContent = t.raw, o(!1));
2501
+ }), () => {
2502
+ l = !0, c.abort();
2503
+ }) : (o(!1), () => c.abort());
2504
+ }, [t.content, t.loading, t.raw]), /* @__PURE__ */ n.jsx("div", { className: "math-block text-center overflow-x-auto relative min-h-[40px]", children: /* @__PURE__ */ n.jsx("div", { ref: e, className: r ? "math-rendering" : void 0 }) });
2505
+ }
2506
+ function to({ node: t }) {
2507
+ const e = S(null), r = S(null), [o, a] = B(!0), l = S(0);
2508
+ return F(() => {
2509
+ var f;
2510
+ let c = !1;
2511
+ const d = new AbortController(), s = ++l.current, g = (f = t.content) != null ? f : "";
2512
+ return g ? ($r(g, !1, {
2513
+ timeout: 1500,
2514
+ waitTimeout: 0,
2515
+ maxRetries: 0,
2516
+ signal: d.signal
2517
+ }).then((h) => {
2518
+ c || s !== l.current || r.current && (r.current.innerHTML = h, a(!1));
2519
+ }).catch(async (h) => {
2520
+ if (c || s !== l.current || !r.current)
2521
+ return;
2522
+ const C = (h == null ? void 0 : h.code) || (h == null ? void 0 : h.name);
2523
+ if (C === "WORKER_INIT_ERROR" || (h == null ? void 0 : h.fallbackToRenderer) || (C === Kt || C === "WORKER_TIMEOUT")) {
2524
+ const N = await Fr();
2525
+ if (N)
2526
+ try {
2527
+ const A = N.renderToString(g, {
2528
+ throwOnError: t.loading,
2529
+ displayMode: !1
2530
+ });
2531
+ !c && s === l.current && r.current && (r.current.innerHTML = A, a(!1), Or(g, !1, A));
2532
+ return;
2533
+ } catch {
2534
+ }
2535
+ }
2536
+ t.loading || (r.current.textContent = t.raw, a(!1));
2537
+ }), () => {
2538
+ c = !0, d.abort();
2539
+ }) : (a(!1), () => d.abort());
2540
+ }, [t.content, t.loading, t.raw]), /* @__PURE__ */ n.jsxs("span", { ref: e, className: "math-inline-wrapper", children: [
2541
+ /* @__PURE__ */ n.jsx("span", { ref: r, className: `math-inline${o ? " math-inline--hidden" : ""}` }),
2542
+ o && /* @__PURE__ */ n.jsxs("span", { className: "math-inline__loading", role: "status", "aria-live": "polite", children: [
2543
+ /* @__PURE__ */ n.jsx("span", { className: "math-inline__spinner", "aria-hidden": "true" }),
2544
+ /* @__PURE__ */ n.jsx("span", { className: "sr-only", children: "Loading" })
2545
+ ] })
2546
+ ] });
2547
+ }
2548
+ function ro(t) {
2549
+ try {
2550
+ if (typeof globalThis != "undefined" && typeof globalThis.requestAnimationFrame == "function")
2551
+ return globalThis.requestAnimationFrame(t);
2552
+ } catch {
2553
+ }
2554
+ return globalThis.setTimeout(t, 0);
2555
+ }
2556
+ let Pe = null, xt = null;
2557
+ const Ve = /* @__PURE__ */ new Map(), no = 5;
2558
+ let zt = no, rr = !1;
2559
+ function di(t) {
2560
+ rr = !!t;
2561
+ }
2562
+ function mi(t) {
2563
+ Number.isFinite(t) && t > 0 && (zt = Math.floor(t));
2564
+ }
2565
+ function fi() {
2566
+ return { inFlight: Ve.size, max: zt };
2567
+ }
2568
+ const oo = "WORKER_BUSY";
2569
+ function hi(t) {
2570
+ Pe = t, xt = null;
2571
+ const e = t;
2572
+ Pe.onmessage = (r) => {
2573
+ if (Pe !== e)
2574
+ return;
2575
+ const { id: o, ok: a, result: l, error: c } = r.data, d = Ve.get(o);
2576
+ d && (a === !1 || c ? d.reject(new Error(c || "Unknown error")) : d.resolve(l));
2577
+ }, Pe.onerror = (r) => {
2578
+ var o, a;
2579
+ if (Pe === e) {
2580
+ if (Ve.size === 0) {
2581
+ (o = console.debug) == null || o.call(console, "[mermaidWorkerClient] Worker error (no pending):", (r == null ? void 0 : r.message) || r);
2582
+ return;
2583
+ }
2584
+ try {
2585
+ rr ? console.error("[mermaidWorkerClient] Worker error:", (r == null ? void 0 : r.message) || r) : (a = console.debug) == null || a.call(console, "[mermaidWorkerClient] Worker error:", (r == null ? void 0 : r.message) || r);
2586
+ } catch {
2587
+ }
2588
+ for (const [l, c] of Ve.entries())
2589
+ c.reject(new Error(`Worker error: ${r.message}`));
2590
+ Ve.clear();
2591
+ }
2592
+ }, Pe.onmessageerror = (r) => {
2593
+ var o, a;
2594
+ if (Pe === e) {
2595
+ if (Ve.size === 0) {
2596
+ (o = console.debug) == null || o.call(console, "[mermaidWorkerClient] Worker messageerror (no pending):", r);
2597
+ return;
2598
+ }
2599
+ try {
2600
+ rr ? console.error("[mermaidWorkerClient] Worker messageerror:", r) : (a = console.debug) == null || a.call(console, "[mermaidWorkerClient] Worker messageerror:", r);
2601
+ } catch {
2602
+ }
2603
+ for (const [l, c] of Ve.entries())
2604
+ c.reject(new Error("Worker messageerror"));
2605
+ Ve.clear();
2606
+ }
2607
+ };
2608
+ }
2609
+ function gi() {
2610
+ var t;
2611
+ if (Pe)
2612
+ try {
2613
+ for (const [e, r] of Ve.entries())
2614
+ r.reject(new Error("Worker cleared"));
2615
+ Ve.clear(), (t = Pe.terminate) == null || t.call(Pe);
2616
+ } catch {
2617
+ }
2618
+ Pe = null, xt = null;
2619
+ }
2620
+ function io() {
2621
+ return Pe || (xt = new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."), xt.name = "WORKER_INIT_ERROR", xt.code = "WORKER_INIT_ERROR", null);
2622
+ }
2623
+ function Wr(t, e, r = 1400) {
2624
+ if (xt)
2625
+ return Promise.reject(xt);
2626
+ const o = io();
2627
+ if (!o)
2628
+ return Promise.reject(xt);
2629
+ if (Ve.size >= zt) {
2630
+ const a = new Error("Worker busy");
2631
+ return a.name = "WorkerBusy", a.code = oo, a.inFlight = Ve.size, a.max = zt, Promise.reject(a);
2632
+ }
2633
+ return new Promise((a, l) => {
2634
+ const c = Math.random().toString(36).slice(2);
2635
+ let d = !1, s = null;
2636
+ const g = () => {
2637
+ d || (d = !0, s != null && clearTimeout(s), Ve.delete(c));
2638
+ }, f = {
2639
+ resolve: (h) => {
2640
+ g(), a(h);
2641
+ },
2642
+ reject: (h) => {
2643
+ g(), l(h);
2644
+ }
2645
+ };
2646
+ Ve.set(c, f);
2647
+ try {
2648
+ o.postMessage({ id: c, action: t, payload: e });
2649
+ } catch (h) {
2650
+ Ve.delete(c), l(h);
2651
+ return;
2652
+ }
2653
+ s = setTimeout(() => {
2654
+ const h = new Error("Worker call timed out");
2655
+ h.name = "WorkerTimeout", h.code = "WORKER_TIMEOUT";
2656
+ const C = Ve.get(c);
2657
+ C == null || C.reject(h);
2658
+ }, r);
2659
+ });
2660
+ }
2661
+ async function ao(t, e, r = 1400) {
2662
+ return Wr("canParse", { code: t, theme: e }, r);
2663
+ }
2664
+ async function so(t, e, r = 2400) {
2665
+ return Wr("findPrefix", { code: t, theme: e }, r);
2666
+ }
2667
+ function co() {
2668
+ var t;
2669
+ (t = Pe == null ? void 0 : Pe.terminate) == null || t.call(Pe), Pe = null, xt = null, Ve.clear();
2670
+ }
2671
+ let mt = null, br = !1, kr = null, _t = null;
2672
+ function lo(t) {
2673
+ var o, a;
2674
+ const e = String((o = t == null ? void 0 : t.securityLevel) != null ? o : "loose"), r = (a = t == null ? void 0 : t.flowchart) == null ? void 0 : a.htmlLabels;
2675
+ return `${e}|htmlLabels:${r === !1 ? "0" : "1"}`;
2676
+ }
2677
+ function $t(t, e) {
2678
+ var o;
2679
+ if (!t || !e)
2680
+ return;
2681
+ const r = lo(e);
2682
+ if (kr !== r)
2683
+ try {
2684
+ typeof t.initialize == "function" ? t.initialize(e) : (o = t.mermaidAPI) != null && o.initialize && t.mermaidAPI.initialize(e), kr = r;
2685
+ } catch {
2686
+ }
2687
+ }
2688
+ async function uo(t) {
2689
+ if (mt)
2690
+ return $t(mt, t), mt;
2691
+ if (_t) {
2692
+ const e = await _t;
2693
+ return e && $t(e, t), e;
2694
+ }
2695
+ if (br)
2696
+ return null;
2697
+ try {
2698
+ br = !0, _t = (async () => {
2699
+ try {
2700
+ const r = await import("mermaid"), o = (r == null ? void 0 : r.default) || r;
2701
+ if (o != null && o.default ? mt = o.default : o != null && o.mermaidAPI ? mt = o : o != null && o.mermaid ? mt = o.mermaid : mt = o, !mt)
2702
+ throw new Error("Mermaid module did not export expected API");
2703
+ return $t(mt, t != null ? t : { startOnLoad: !1, securityLevel: "loose" }), mt;
2704
+ } catch (r) {
2705
+ return console.warn("[markstream-react] Failed to load mermaid:", r), null;
2706
+ } finally {
2707
+ _t = null;
2708
+ }
2709
+ })();
2710
+ const e = await _t;
2711
+ return e && $t(e, t), e;
2712
+ } catch {
2713
+ return null;
2714
+ }
2715
+ }
2716
+ const mo = typeof window != "undefined" ? Yr : F, fo = {
2717
+ USE_PROFILES: { svg: !0 },
2718
+ FORBID_TAGS: ["script"],
2719
+ FORBID_ATTR: [/^on/i],
2720
+ ADD_TAGS: ["style"],
2721
+ ADD_ATTR: ["style"],
2722
+ SAFE_FOR_TEMPLATES: !0
2723
+ };
2724
+ function ho(t) {
2725
+ return t.replace(/["']\s*javascript:/gi, "#").replace(/\bjavascript:/gi, "#").replace(/["']\s*vbscript:/gi, "#").replace(/\bvbscript:/gi, "#").replace(/\bdata:text\/html/gi, "#");
2726
+ }
2727
+ const go = [/javascript:/i, /expression\s*\(/i, /url\s*\(\s*javascript:/i, /@import/i], po = /^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;
2728
+ function wo(t) {
2729
+ if (!t)
2730
+ return "";
2731
+ const e = t.trim();
2732
+ return po.test(e) ? e : "";
2733
+ }
2734
+ function vo(t) {
2735
+ const e = /* @__PURE__ */ new Set(["script"]), r = [t, ...Array.from(t.querySelectorAll("*"))];
2736
+ for (const o of r) {
2737
+ if (e.has(o.tagName.toLowerCase())) {
2738
+ o.remove();
2739
+ continue;
2740
+ }
2741
+ const a = Array.from(o.attributes);
2742
+ for (const l of a) {
2743
+ const c = l.name;
2744
+ if (/^on/i.test(c)) {
2745
+ o.removeAttribute(c);
2746
+ continue;
2747
+ }
2748
+ if (c === "style" && l.value) {
2749
+ const d = l.value;
2750
+ if (go.some((s) => s.test(d))) {
2751
+ o.removeAttribute(c);
2752
+ continue;
2753
+ }
2754
+ }
2755
+ if ((c === "href" || c === "xlink:href") && l.value) {
2756
+ const d = wo(l.value);
2757
+ if (!d) {
2758
+ o.removeAttribute(c);
2759
+ continue;
2760
+ }
2761
+ d !== l.value && o.setAttribute(c, d);
2762
+ }
2763
+ }
2764
+ }
2765
+ }
2766
+ function xo(t) {
2767
+ if (typeof window == "undefined" || typeof DOMParser == "undefined" || !t)
2768
+ return null;
2769
+ const e = ho(t), o = new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
2770
+ if (!o || o.nodeName.toLowerCase() !== "svg")
2771
+ return null;
2772
+ const a = o;
2773
+ return vo(a), a;
2774
+ }
2775
+ function Pt(t) {
2776
+ if (t)
2777
+ try {
2778
+ t.replaceChildren();
2779
+ } catch {
2780
+ t.innerHTML = "";
2781
+ }
2782
+ }
2783
+ function yo(t, e) {
2784
+ if (!t)
2785
+ return "";
2786
+ Pt(t);
2787
+ const r = xo(e);
2788
+ return r ? (t.appendChild(r), t.innerHTML) : "";
2789
+ }
2790
+ function jr(t, e, r) {
2791
+ if (!t)
2792
+ return "";
2793
+ if (r)
2794
+ return yo(t, e);
2795
+ if (Pt(t), e)
2796
+ try {
2797
+ t.insertAdjacentHTML("afterbegin", e);
2798
+ } catch {
2799
+ t.innerHTML = e;
2800
+ }
2801
+ return t.innerHTML;
2802
+ }
2803
+ const Lt = {
2804
+ maxHeight: "500px",
2805
+ loading: !0,
2806
+ workerTimeoutMs: 1400,
2807
+ parseTimeoutMs: 1800,
2808
+ renderTimeoutMs: 2500,
2809
+ fullRenderTimeoutMs: 4e3,
2810
+ showHeader: !0,
2811
+ showModeToggle: !0,
2812
+ showCopyButton: !0,
2813
+ showExportButton: !0,
2814
+ showFullscreenButton: !0,
2815
+ showCollapseButton: !0,
2816
+ showZoomControls: !0,
2817
+ enableWheelZoom: !1,
2818
+ isStrict: !1
2819
+ };
2820
+ function Hr(t) {
2821
+ var Fe, Ge, ke, u, E, _, H, q, Ce;
2822
+ const e = { ...Lt, ...t }, { t: r } = lr(), o = W(() => ur("mermaid"), []), a = (Ge = (Fe = e.node) == null ? void 0 : Fe.code) != null ? Ge : "", l = W(() => a.replace(/\]::([^:])/g, "]:::$1").replace(/:::subgraphNode$/gm, "::subgraphNode"), [a]), c = (ke = e.workerTimeoutMs) != null ? ke : Lt.workerTimeoutMs, d = (u = e.parseTimeoutMs) != null ? u : Lt.parseTimeoutMs, s = (E = e.renderTimeoutMs) != null ? E : Lt.renderTimeoutMs, g = (_ = e.fullRenderTimeoutMs) != null ? _ : Lt.fullRenderTimeoutMs, [f, h] = B(!1), [C, w] = B(!1), [y, N] = B(!1), [A, L] = B(!1), [M, I] = B(1), [O, re] = B({ x: 0, y: 0 }), [ue, de] = B(!1), [me, oe] = B(!1), [Se, U] = B(!1), [ce, we] = B(null), [J, K] = B(!1), [Ne, ye] = B(() => e.maxHeight == null ? "360px" : e.maxHeight), [Ae, ee] = B(typeof window == "undefined"), ne = S(null), xe = S(null), He = S(null), ie = S(null), st = S(null), Ze = S(null), Ue = S(null), x = S({ x: 0, y: 0 }), _e = S(0), be = S({}), Le = S(""), fe = S(!1), gt = S(null), ve = S(!1), pt = S({
2823
+ zoom: 1,
2824
+ translateX: 0,
2825
+ translateY: 0,
2826
+ containerHeight: Ne || "360px"
2827
+ }), qe = It(), ze = !!((q = (H = e.node) == null ? void 0 : H.loading) != null ? q : e.loading), $ = e.isDark ? "dark" : "light", De = !!e.isStrict, Qe = W(() => De ? {
2828
+ startOnLoad: !1,
2829
+ securityLevel: "strict",
2830
+ dompurifyConfig: fo,
2831
+ flowchart: { htmlLabels: !1 }
2832
+ } : {
2833
+ startOnLoad: !1,
2834
+ securityLevel: "loose"
2835
+ }, [De]);
2836
+ F(() => {
2837
+ ve.current = Se;
2838
+ }, [Se]), F(() => {
2839
+ be.current = {};
2840
+ }, [$, l, De]), F(() => {
2841
+ let m = !1;
2842
+ return (async () => {
2843
+ const v = await uo(Qe);
2844
+ m || (ne.current = v, h(!!v), fe.current || w(!v));
2845
+ })(), () => {
2846
+ m = !0;
2847
+ };
2848
+ }, [Qe]), F(() => {
2849
+ const m = xe.current;
2850
+ if (!m)
2851
+ return;
2852
+ const v = qe(m, { rootMargin: "400px" });
2853
+ return gt.current = v, v.isVisible() && ee(!0), v.whenVisible.then(() => ee(!0)), () => {
2854
+ v.destroy(), gt.current = null;
2855
+ };
2856
+ }, [qe]), F(() => {
2857
+ if (typeof document == "undefined" || !J)
2858
+ return;
2859
+ const m = document.body.style.overflow;
2860
+ return document.body.style.overflow = "hidden", () => {
2861
+ document.body.style.overflow = m;
2862
+ };
2863
+ }, [J]);
2864
+ const Oe = D((m) => {
2865
+ const v = xe.current, X = ie.current;
2866
+ if (!v || !X)
2867
+ return;
2868
+ const z = X.querySelector("svg");
2869
+ if (!z)
2870
+ return;
2871
+ let P = 0, te = 0;
2872
+ const Ee = z.getAttribute("viewBox");
2873
+ if (Ee) {
2874
+ const R = Ee.split(" ");
2875
+ R.length === 4 && (P = Number.parseFloat(R[2]), te = Number.parseFloat(R[3]));
2876
+ }
2877
+ if ((!P || !te) && z.hasAttribute("width") && z.hasAttribute("height") && (P = Number.parseFloat(z.getAttribute("width") || "0"), te = Number.parseFloat(z.getAttribute("height") || "0")), !P || !te || Number.isNaN(P) || Number.isNaN(te))
2878
+ try {
2879
+ const R = z.getBBox();
2880
+ P = R.width, te = R.height;
2881
+ } catch {
2882
+ return;
2883
+ }
2884
+ if (!(P > 0 && te > 0))
2885
+ return;
2886
+ const Ie = m != null ? m : v.clientWidth, i = te / P, p = Ie * i, k = Number.isFinite(p) && p > 0 ? p : te;
2887
+ ye(`${Math.min(k, te)}px`);
2888
+ }, []);
2889
+ F(() => {
2890
+ if (!xe.current || typeof ResizeObserver == "undefined")
2891
+ return;
2892
+ const m = new ResizeObserver((v) => {
2893
+ if (!v.length)
2894
+ return;
2895
+ const X = v[0].contentRect.width;
2896
+ ro(() => Oe(X));
2897
+ });
2898
+ return m.observe(xe.current), () => m.disconnect();
2899
+ }, [Oe]), F(() => () => {
2900
+ co();
2901
+ }, []);
2902
+ const ct = D(async (m, v, X) => {
2903
+ var z;
2904
+ if (!ne.current || !ie.current)
2905
+ return !1;
2906
+ oe(!0);
2907
+ try {
2908
+ const P = `mermaid-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, te = nr(m, v), Ee = await Vt(
2909
+ () => ne.current.render(P, te),
2910
+ { timeoutMs: g, signal: X }
2911
+ );
2912
+ if (!(Ee != null && Ee.svg))
2913
+ return !1;
2914
+ const Ie = jr(ie.current, Ee.svg, De);
2915
+ return (z = Ee.bindFunctions) == null || z.call(Ee, ie.current), Oe(), be.current[v] = Ie, U(!0), we(null), !0;
2916
+ } catch (P) {
2917
+ return ze || we(P instanceof Error ? P.message : String(P)), !1;
2918
+ } finally {
2919
+ oe(!1);
2920
+ }
2921
+ }, [g, ze, De, Oe]), rt = D(async (m, v, X) => {
2922
+ var z;
2923
+ if (!(!ne.current || !ie.current)) {
2924
+ oe(!0);
2925
+ try {
2926
+ const P = `mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, te = zr(m), Ee = nr(te || m, v), Ie = await Vt(
2927
+ () => ne.current.render(P, Ee),
2928
+ { timeoutMs: s, signal: X }
2929
+ );
2930
+ Ie != null && Ie.svg && (jr(ie.current, Ie.svg, De), (z = Ie.bindFunctions) == null || z.call(Ie, ie.current), Oe());
2931
+ } catch {
2932
+ } finally {
2933
+ oe(!1);
2934
+ }
2935
+ }
2936
+ }, [s, ze, De, Oe]), $e = D(async (m, v) => {
2937
+ if (!m.trim()) {
2938
+ Pt(ie.current), U(!1), Le.current = "";
2939
+ return;
2940
+ }
2941
+ const X = m.replace(/\s+/g, "");
2942
+ if (X === Le.current && ve.current)
2943
+ return;
2944
+ const z = ++_e.current;
2945
+ try {
2946
+ if (await bo(m, $, {
2947
+ workerTimeout: c,
2948
+ parseTimeout: d,
2949
+ mermaid: ne.current,
2950
+ signal: v
2951
+ }), v != null && v.aborted || _e.current !== z)
2952
+ return;
2953
+ await ct(m, $, v) && (Le.current = X);
2954
+ return;
2955
+ } catch (P) {
2956
+ if ((P == null ? void 0 : P.name) === "AbortError")
2957
+ return;
2958
+ }
2959
+ try {
2960
+ const P = await ko(m, $, { workerTimeout: c, signal: v });
2961
+ if (!P || v != null && v.aborted || _e.current !== z)
2962
+ return;
2963
+ await rt(P, $, v);
2964
+ } catch {
2965
+ }
2966
+ }, [d, ct, rt, $, c]);
2967
+ F(() => {
2968
+ if (!Ae || C || y)
2969
+ return;
2970
+ const m = new AbortController();
2971
+ return $e(l, m.signal), () => m.abort();
2972
+ }, [l, y, $e, C, Ae]);
2973
+ const je = D((m, v) => {
2974
+ const X = { x: m.clientX, y: m.clientY };
2975
+ Ut(m.currentTarget, v, "top", !1, X, e.isDark);
2976
+ }, [e.isDark]), et = D(async () => {
2977
+ var m, v;
2978
+ try {
2979
+ await ((m = navigator.clipboard) == null ? void 0 : m.writeText(l)), L(!0), (v = e.onCopy) == null || v.call(e, l), setTimeout(() => L(!1), 1e3);
2980
+ } catch {
2981
+ }
2982
+ }, [l, e]), ut = D(() => {
2983
+ var z, P, te;
2984
+ const m = (P = (z = ie.current) == null ? void 0 : z.querySelector("svg")) != null ? P : null;
2985
+ if (!m)
2986
+ return;
2987
+ const v = or(m), X = {
2988
+ payload: { type: "export" },
2989
+ defaultPrevented: !1,
2990
+ preventDefault() {
2991
+ this.defaultPrevented = !0;
2992
+ },
2993
+ svgElement: m,
2994
+ svgString: v
2995
+ };
2996
+ (te = e.onExport) == null || te.call(e, X), X.defaultPrevented || jo(m, v);
2997
+ }, [e]), he = D(() => {
2998
+ Ue.current = null, Pt(Ze.current);
2999
+ }, []), tt = D(() => {
3000
+ K(!1), he();
3001
+ }, [he]), wt = D(() => {
3002
+ var z, P, te;
3003
+ const m = (P = (z = ie.current) == null ? void 0 : z.querySelector("svg")) != null ? P : null, v = m ? or(m) : null, X = {
3004
+ payload: { type: "open-modal" },
3005
+ defaultPrevented: !1,
3006
+ preventDefault() {
3007
+ this.defaultPrevented = !0;
3008
+ },
3009
+ svgElement: m,
3010
+ svgString: v
3011
+ };
3012
+ (te = e.onOpenModal) == null || te.call(e, X), !X.defaultPrevented && K(!0);
3013
+ }, [e]);
3014
+ F(() => {
3015
+ if (!J || typeof window == "undefined")
3016
+ return;
3017
+ const m = (v) => {
3018
+ v.key === "Escape" && tt();
3019
+ };
3020
+ try {
3021
+ window.addEventListener("keydown", m);
3022
+ } catch {
3023
+ }
3024
+ return () => {
3025
+ try {
3026
+ window.removeEventListener("keydown", m);
3027
+ } catch {
3028
+ }
3029
+ };
3030
+ }, [tt, J]), mo(() => {
3031
+ if (!J)
3032
+ return;
3033
+ const m = Ze.current, v = xe.current;
3034
+ if (!m || !v)
3035
+ return;
3036
+ const X = `translate(${O.x}px, ${O.y}px) scale(${M})`, z = v.cloneNode(!0);
3037
+ z.classList.add("fullscreen");
3038
+ const P = z.querySelector("[data-mermaid-wrapper]");
3039
+ P && (Ue.current = P, P.style.transform = X), Pt(m), m.appendChild(z);
3040
+ }, [J]), F(() => {
3041
+ J && Ue.current && (Ue.current.style.transform = `translate(${O.x}px, ${O.y}px) scale(${M})`);
3042
+ }, [J, O.x, O.y, M]);
3043
+ const Ke = C || me || y, nt = W(() => e.isDark ? "mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200" : "mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700", [e.isDark]), b = D((m) => {
3044
+ var X;
3045
+ const v = {
3046
+ payload: { type: "toggle-mode", target: m },
3047
+ defaultPrevented: !1,
3048
+ preventDefault() {
3049
+ this.defaultPrevented = !0;
3050
+ }
3051
+ };
3052
+ if ((X = e.onToggleMode) == null || X.call(e, m, v), !v.defaultPrevented)
3053
+ if (fe.current = !0, m === "preview") {
3054
+ w(!1);
3055
+ const z = pt.current;
3056
+ I(z.zoom), re({ x: z.translateX, y: z.translateY }), ye(z.containerHeight), ve.current && be.current[$] && ie.current ? (ie.current.innerHTML = be.current[$], Oe()) : $e(l);
3057
+ } else
3058
+ pt.current = {
3059
+ zoom: M,
3060
+ translateX: O.x,
3061
+ translateY: O.y,
3062
+ containerHeight: Ne
3063
+ }, w(!0);
3064
+ }, [
3065
+ l,
3066
+ Ne,
3067
+ $e,
3068
+ e,
3069
+ $,
3070
+ O.x,
3071
+ O.y,
3072
+ Oe,
3073
+ M
3074
+ ]), j = D((m) => {
3075
+ if (e.enableWheelZoom === !1 || !m.ctrlKey && !m.metaKey)
3076
+ return;
3077
+ m.preventDefault();
3078
+ const v = xe.current;
3079
+ if (!v)
3080
+ return;
3081
+ const X = v.getBoundingClientRect(), z = m.clientX - X.left - O.x, P = m.clientY - X.top - O.y, te = -m.deltaY * 0.01, Ee = Gt(M + te, 0.5, 3);
3082
+ if (Ee === M)
3083
+ return;
3084
+ const Ie = Ee / M;
3085
+ re({
3086
+ x: O.x - z * (Ie - 1),
3087
+ y: O.y - P * (Ie - 1)
3088
+ }), I(Ee);
3089
+ }, [O, M]), T = D((m, v) => {
3090
+ de(!0), x.current = {
3091
+ x: m - O.x,
3092
+ y: v - O.y
3093
+ };
3094
+ }, [O.x, O.y]), V = D((m, v) => {
3095
+ ue && re({
3096
+ x: m - x.current.x,
3097
+ y: v - x.current.y
3098
+ });
3099
+ }, [ue]), Y = D(() => {
3100
+ de(!1);
3101
+ }, []), le = /* @__PURE__ */ n.jsxs("div", { className: "relative", children: [
3102
+ e.showZoomControls && /* @__PURE__ */ n.jsx("div", { className: "absolute top-2 right-2 z-10 rounded-lg", children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2 backdrop-blur rounded-lg", children: [
3103
+ /* @__PURE__ */ n.jsx(
3104
+ "button",
3105
+ {
3106
+ type: "button",
3107
+ className: Me(
3108
+ "p-2 text-xs rounded transition-colors",
3109
+ e.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"
3110
+ ),
3111
+ onMouseEnter: (m) => je(m, r("common.zoomIn")),
3112
+ onMouseLeave: () => We(),
3113
+ onClick: () => I(Gt(M + 0.1, 0.5, 3)),
3114
+ children: "+"
3115
+ }
3116
+ ),
3117
+ /* @__PURE__ */ n.jsx(
3118
+ "button",
3119
+ {
3120
+ type: "button",
3121
+ className: Me(
3122
+ "p-2 text-xs rounded transition-colors",
3123
+ e.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"
3124
+ ),
3125
+ onMouseEnter: (m) => je(m, r("common.zoomOut")),
3126
+ onMouseLeave: () => We(),
3127
+ onClick: () => I(Gt(M - 0.1, 0.5, 3)),
3128
+ children: "−"
3129
+ }
3130
+ ),
3131
+ /* @__PURE__ */ n.jsxs(
3132
+ "button",
3133
+ {
3134
+ type: "button",
3135
+ className: Me(
3136
+ "p-2 text-xs rounded transition-colors",
3137
+ e.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"
3138
+ ),
3139
+ onMouseEnter: (m) => je(m, r("common.resetZoom")),
3140
+ onMouseLeave: () => We(),
3141
+ onClick: () => {
3142
+ I(1), re({ x: 0, y: 0 });
3143
+ },
3144
+ children: [
3145
+ Math.round(M * 100),
3146
+ "%"
3147
+ ]
3148
+ }
3149
+ )
3150
+ ] }) }),
3151
+ /* @__PURE__ */ n.jsxs(
3152
+ "div",
3153
+ {
3154
+ ref: xe,
3155
+ className: Me(
3156
+ "min-h-[360px] relative transition-all duration-100 overflow-hidden block",
3157
+ e.isDark ? "bg-gray-900" : "bg-gray-50"
3158
+ ),
3159
+ style: { height: Ne, maxHeight: (Ce = e.maxHeight) != null ? Ce : void 0 },
3160
+ onWheel: j,
3161
+ onMouseDown: (m) => {
3162
+ m.button === 0 && (m.preventDefault(), T(m.clientX, m.clientY));
3163
+ },
3164
+ onMouseMove: (m) => V(m.clientX, m.clientY),
3165
+ onMouseUp: Y,
3166
+ onMouseLeave: Y,
3167
+ onTouchStart: (m) => {
3168
+ const v = m.touches[0];
3169
+ v && T(v.clientX, v.clientY);
3170
+ },
3171
+ onTouchMove: (m) => {
3172
+ const v = m.touches[0];
3173
+ v && V(v.clientX, v.clientY);
3174
+ },
3175
+ onTouchEnd: Y,
3176
+ children: [
3177
+ /* @__PURE__ */ n.jsx(
3178
+ "div",
3179
+ {
3180
+ ref: He,
3181
+ "data-mermaid-wrapper": !0,
3182
+ className: Me("absolute inset-0 cursor-grab", { "cursor-grabbing": ue }),
3183
+ style: { transform: `translate(${O.x}px, ${O.y}px) scale(${M})` },
3184
+ children: /* @__PURE__ */ n.jsx(
3185
+ "div",
3186
+ {
3187
+ ref: ie,
3188
+ className: "_mermaid w-full text-center flex items-center justify-center min-h-full"
3189
+ }
3190
+ )
3191
+ }
3192
+ ),
3193
+ (me || ze) && /* @__PURE__ */ n.jsxs("div", { className: "mermaid-loading", children: [
3194
+ /* @__PURE__ */ n.jsx("span", { className: "mermaid-spinner" }),
3195
+ /* @__PURE__ */ n.jsx("span", { children: "Rendering diagram…" })
3196
+ ] })
3197
+ ]
3198
+ }
3199
+ )
3200
+ ] }), Z = e.showHeader && /* @__PURE__ */ n.jsxs(
3201
+ "div",
3202
+ {
3203
+ className: Me(
3204
+ "mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",
3205
+ e.isDark ? "bg-gray-800 border-gray-700/30" : "bg-gray-50 border-gray-200"
3206
+ ),
3207
+ children: [
3208
+ /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-2 overflow-hidden", children: [
3209
+ /* @__PURE__ */ n.jsx(
3210
+ "span",
3211
+ {
3212
+ className: "icon-slot h-4 w-4 flex-shrink-0",
3213
+ dangerouslySetInnerHTML: { __html: o }
3214
+ }
3215
+ ),
3216
+ /* @__PURE__ */ n.jsx("span", { className: Me("text-sm font-medium font-mono truncate", e.isDark ? "text-gray-400" : "text-gray-600"), children: "Mermaid" })
3217
+ ] }),
3218
+ e.showModeToggle && f && /* @__PURE__ */ n.jsxs("div", { className: Me("flex items-center space-x-1 rounded-md p-0.5", e.isDark ? "bg-gray-700" : "bg-gray-100"), children: [
3219
+ /* @__PURE__ */ n.jsx(
3220
+ "button",
3221
+ {
3222
+ type: "button",
3223
+ className: Me(
3224
+ "px-2.5 py-1 text-xs rounded transition-colors",
3225
+ C ? e.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700" : e.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm"
3226
+ ),
3227
+ onClick: () => b("preview"),
3228
+ onMouseEnter: (m) => je(m, r("common.preview")),
3229
+ onFocus: (m) => je(m, r("common.preview")),
3230
+ onMouseLeave: () => We(),
3231
+ onBlur: () => We(),
3232
+ children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-1", children: [
3233
+ /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
3234
+ /* @__PURE__ */ n.jsx("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" }),
3235
+ /* @__PURE__ */ n.jsx("circle", { cx: "12", cy: "12", r: "3" })
3236
+ ] }) }),
3237
+ /* @__PURE__ */ n.jsx("span", { children: r("common.preview") })
3238
+ ] })
3239
+ }
3240
+ ),
3241
+ /* @__PURE__ */ n.jsx(
3242
+ "button",
3243
+ {
3244
+ type: "button",
3245
+ className: Me(
3246
+ "px-2.5 py-1 text-xs rounded transition-colors",
3247
+ C ? e.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm" : e.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700"
3248
+ ),
3249
+ onClick: () => b("source"),
3250
+ onMouseEnter: (m) => je(m, r("common.source")),
3251
+ onFocus: (m) => je(m, r("common.source")),
3252
+ onMouseLeave: () => We(),
3253
+ onBlur: () => We(),
3254
+ children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-1", children: [
3255
+ /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m16 18l6-6l-6-6M8 6l-6 6l6 6" }) }),
3256
+ /* @__PURE__ */ n.jsx("span", { children: r("common.source") })
3257
+ ] })
3258
+ }
3259
+ )
3260
+ ] }),
3261
+ /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-1", children: [
3262
+ e.showCollapseButton && /* @__PURE__ */ n.jsx(
3263
+ "button",
3264
+ {
3265
+ type: "button",
3266
+ className: nt,
3267
+ "aria-pressed": y,
3268
+ onClick: () => N((m) => !m),
3269
+ onMouseEnter: (m) => je(m, r(y ? "common.expand" : "common.collapse")),
3270
+ onFocus: (m) => je(m, r(y ? "common.expand" : "common.collapse")),
3271
+ onMouseLeave: () => We(),
3272
+ onBlur: () => We(),
3273
+ children: /* @__PURE__ */ n.jsx(
3274
+ "svg",
3275
+ {
3276
+ style: { rotate: y ? "0deg" : "90deg" },
3277
+ xmlns: "http://www.w3.org/2000/svg",
3278
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
3279
+ "aria-hidden": "true",
3280
+ role: "img",
3281
+ width: "1em",
3282
+ height: "1em",
3283
+ viewBox: "0 0 24 24",
3284
+ className: "w-3 h-3",
3285
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m9 18l6-6l-6-6" })
3286
+ }
3287
+ )
3288
+ }
3289
+ ),
3290
+ e.showCopyButton && /* @__PURE__ */ n.jsx(
3291
+ "button",
3292
+ {
3293
+ type: "button",
3294
+ className: nt,
3295
+ onClick: et,
3296
+ onMouseEnter: (m) => je(m, r(A ? "common.copySuccess" : "common.copy")),
3297
+ onFocus: (m) => je(m, r(A ? "common.copySuccess" : "common.copy")),
3298
+ onMouseLeave: () => We(),
3299
+ onBlur: () => We(),
3300
+ children: A ? /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M20 6L9 17l-5-5" }) }) : /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
3301
+ /* @__PURE__ */ n.jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
3302
+ /* @__PURE__ */ n.jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
3303
+ ] }) })
3304
+ }
3305
+ ),
3306
+ e.showExportButton && f && /* @__PURE__ */ n.jsx(
3307
+ "button",
3308
+ {
3309
+ type: "button",
3310
+ className: Me(nt, Ke ? "opacity-50 cursor-not-allowed" : ""),
3311
+ disabled: Ke,
3312
+ onClick: ut,
3313
+ onMouseEnter: (m) => je(m, r("common.export")),
3314
+ onFocus: (m) => je(m, r("common.export")),
3315
+ onMouseLeave: () => We(),
3316
+ onBlur: () => We(),
3317
+ children: /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
3318
+ /* @__PURE__ */ n.jsx("path", { d: "M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
3319
+ /* @__PURE__ */ n.jsx("path", { d: "m7 10l5 5l5-5" })
3320
+ ] }) })
3321
+ }
3322
+ ),
3323
+ e.showFullscreenButton && f && /* @__PURE__ */ n.jsx(
3324
+ "button",
3325
+ {
3326
+ type: "button",
3327
+ className: Me(nt, Ke ? "opacity-50 cursor-not-allowed" : ""),
3328
+ disabled: Ke,
3329
+ onClick: J ? tt : wt,
3330
+ onMouseEnter: (m) => je(m, r(J ? "common.minimize" : "common.open")),
3331
+ onFocus: (m) => je(m, r(J ? "common.minimize" : "common.open")),
3332
+ onMouseLeave: () => We(),
3333
+ onBlur: () => We(),
3334
+ children: J ? /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" }) }) : /* @__PURE__ */ n.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", className: "w-3 h-3", children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" }) })
3335
+ }
3336
+ )
3337
+ ] })
3338
+ ]
3339
+ }
3340
+ ), ae = /* @__PURE__ */ n.jsxs("div", { children: [
3341
+ C ? /* @__PURE__ */ n.jsx("div", { className: Me("p-4", e.isDark ? "bg-gray-900 text-gray-300" : "bg-gray-50 text-gray-700"), children: /* @__PURE__ */ n.jsx("pre", { className: "text-sm font-mono whitespace-pre-wrap", children: l }) }) : le,
3342
+ ce && /* @__PURE__ */ n.jsx("div", { className: "mermaid-error", children: ce })
3343
+ ] });
3344
+ return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3345
+ /* @__PURE__ */ n.jsxs(
3346
+ "div",
3347
+ {
3348
+ className: Me(
3349
+ "my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",
3350
+ e.isDark ? "border-gray-700/30" : "border-gray-200",
3351
+ { "is-rendering": ze }
3352
+ ),
3353
+ children: [
3354
+ Z,
3355
+ !y && /* @__PURE__ */ n.jsx("div", { ref: st, children: ae })
3356
+ ]
3357
+ }
3358
+ ),
3359
+ J && typeof document != "undefined" && ir(
3360
+ /* @__PURE__ */ n.jsx(
3361
+ "div",
3362
+ {
3363
+ className: "mermaid-modal-overlay",
3364
+ onClick: () => tt(),
3365
+ children: /* @__PURE__ */ n.jsxs(
3366
+ "div",
3367
+ {
3368
+ className: Me("mermaid-modal-panel", { "is-dark": e.isDark }),
3369
+ role: "dialog",
3370
+ "aria-modal": "true",
3371
+ onClick: (m) => m.stopPropagation(),
3372
+ children: [
3373
+ /* @__PURE__ */ n.jsxs("div", { className: "mermaid-modal-header", children: [
3374
+ /* @__PURE__ */ n.jsx("span", { className: "mermaid-modal-title", children: "Mermaid Preview" }),
3375
+ /* @__PURE__ */ n.jsx("button", { type: "button", className: "mermaid-modal-close", onClick: tt, children: "Close" })
3376
+ ] }),
3377
+ /* @__PURE__ */ n.jsx("div", { className: "mermaid-modal-body", children: /* @__PURE__ */ n.jsx("div", { ref: Ze, className: "mermaid-modal-content" }) })
3378
+ ]
3379
+ }
3380
+ )
3381
+ }
3382
+ ),
3383
+ document.body
3384
+ )
3385
+ ] });
3386
+ }
3387
+ function Gt(t, e, r) {
3388
+ return Math.min(Math.max(t, e), r);
3389
+ }
3390
+ async function bo(t, e, r) {
3391
+ try {
3392
+ if (await ao(t, e, r.workerTimeout))
3393
+ return !0;
3394
+ } catch (c) {
3395
+ if ((c == null ? void 0 : c.name) === "AbortError")
3396
+ throw c;
3397
+ }
3398
+ if (!r.mermaid)
3399
+ throw new Error("Mermaid not available");
3400
+ const o = nr(t, e), a = r.mermaid;
3401
+ if (typeof a.parse == "function")
3402
+ return await Vt(() => a.parse(o), { timeoutMs: r.parseTimeout, signal: r.signal }), !0;
3403
+ const l = `mermaid-parse-${Math.random().toString(36).slice(2, 9)}`;
3404
+ return await Vt(() => a.render(l, o), { timeoutMs: r.parseTimeout, signal: r.signal }), !0;
3405
+ }
3406
+ async function ko(t, e, r) {
3407
+ try {
3408
+ const o = await so(t, e, r.workerTimeout);
3409
+ if (o)
3410
+ return o;
3411
+ } catch (o) {
3412
+ if ((o == null ? void 0 : o.name) === "AbortError")
3413
+ throw o;
3414
+ }
3415
+ return zr(t);
3416
+ }
3417
+ function nr(t, e) {
3418
+ return t.trimStart().startsWith("%%{") ? t : `%%{init: {"theme": "${e === "dark" ? "dark" : "default"}"}}%%
3419
+ ${t}`;
3420
+ }
3421
+ function zr(t) {
3422
+ const e = t.split(`
3423
+ `);
3424
+ for (; e.length > 0; ) {
3425
+ const o = e[e.length - 1].trimEnd();
3426
+ if (o === "") {
3427
+ e.pop();
3428
+ continue;
3429
+ }
3430
+ if (/^[-=~>|<\s]+$/.test(o.trim()) || /(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(o) || /[-|><]$/.test(o) || /(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(o)) {
3431
+ e.pop();
3432
+ continue;
3433
+ }
3434
+ break;
3435
+ }
3436
+ return e.join(`
3437
+ `);
3438
+ }
3439
+ async function Vt(t, e = {}) {
3440
+ const { timeoutMs: r, signal: o } = e;
3441
+ return o != null && o.aborted ? Promise.reject(new DOMException("Aborted", "AbortError")) : new Promise((a, l) => {
3442
+ let c = !1, d = null;
3443
+ function s() {
3444
+ c || (c = !0, g(), l(new DOMException("Aborted", "AbortError")));
3445
+ }
3446
+ function g() {
3447
+ d != null && clearTimeout(d), o && o.removeEventListener("abort", s);
3448
+ }
3449
+ o && o.addEventListener("abort", s, { once: !0 }), r && r > 0 && (d = setTimeout(() => {
3450
+ c || (c = !0, g(), l(new Error("Operation timed out")));
3451
+ }, r)), t().then((f) => {
3452
+ c || (c = !0, g(), a(f));
3453
+ }).catch((f) => {
3454
+ c || (c = !0, g(), l(f));
3455
+ });
3456
+ });
3457
+ }
3458
+ function or(t) {
3459
+ return new XMLSerializer().serializeToString(t);
3460
+ }
3461
+ function jo(t, e) {
3462
+ const r = e != null ? e : or(t), o = new Blob([r], { type: "image/svg+xml;charset=utf-8" }), a = URL.createObjectURL(o), l = document.createElement("a");
3463
+ l.href = a, l.download = `mermaid-${Date.now()}.svg`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(a);
3464
+ }
3465
+ function Co(t) {
3466
+ const { node: e } = t;
3467
+ return /* @__PURE__ */ n.jsxs("div", { className: "unknown-node text-sm text-gray-500 italic", children: [
3468
+ "Unsupported node type:",
3469
+ " ",
3470
+ String(e == null ? void 0 : e.type)
3471
+ ] });
3472
+ }
3473
+ function Mo(t) {
3474
+ var f;
3475
+ const { node: e, ctx: r, renderNode: o, indexKey: a, children: l } = t;
3476
+ if (!r || !o)
3477
+ return /* @__PURE__ */ n.jsx("p", { dir: "auto", className: "paragraph-node", children: l });
3478
+ const c = (f = e.children) != null ? f : [], d = [], s = [], g = () => {
3479
+ if (!s.length)
3480
+ return;
3481
+ const h = d.length;
3482
+ d.push(
3483
+ /* @__PURE__ */ n.jsx("p", { dir: "auto", className: "paragraph-node", children: Xe(s.slice(), r, `${String(a != null ? a : "paragraph")}-${h}`, o) }, `${String(a != null ? a : "paragraph")}-inline-${h}`)
3484
+ ), s.length = 0;
3485
+ };
3486
+ return c.forEach((h, C) => {
3487
+ en.has(h.type) ? (g(), d.push(
3488
+ /* @__PURE__ */ n.jsx(jt.Fragment, { children: o(h, `${String(a != null ? a : "paragraph")}-block-${C}`, r) }, `${String(a != null ? a : "paragraph")}-block-${C}`)
3489
+ )) : s.push(h);
3490
+ }), g(), d.length ? /* @__PURE__ */ n.jsx(n.Fragment, { children: d }) : /* @__PURE__ */ n.jsx("p", { dir: "auto", className: "paragraph-node", children: Xe(c, r, String(a != null ? a : "paragraph"), o) });
3491
+ }
3492
+ function Eo(t) {
3493
+ const { node: e } = t, r = D((o) => {
3494
+ var a;
3495
+ (a = t.onClick) == null || a.call(t, o, e.id, t.messageId, t.threadId);
3496
+ }, [e.id, t]);
3497
+ return /* @__PURE__ */ n.jsx(
3498
+ "span",
3499
+ {
3500
+ className: "reference-node cursor-pointer bg-accent text-xs rounded-md px-1.5 mx-0.5 hover:bg-secondary",
3501
+ role: "button",
3502
+ tabIndex: 0,
3503
+ onClick: r,
3504
+ onMouseEnter: (o) => {
3505
+ var a;
3506
+ (a = t.onMouseEnter) == null || a.call(t, o, e.id, t.messageId, t.threadId);
3507
+ },
3508
+ onMouseLeave: (o) => {
3509
+ var a;
3510
+ (a = t.onMouseLeave) == null || a.call(t, o, e.id, t.messageId, t.threadId);
3511
+ },
3512
+ onKeyDown: (o) => {
3513
+ (o.key === "Enter" || o.key === " ") && r(o);
3514
+ },
3515
+ children: e.id
3516
+ }
3517
+ );
3518
+ }
3519
+ function To(t) {
3520
+ return /* @__PURE__ */ n.jsx("s", { className: "strikethrough-node", children: t.children });
3521
+ }
3522
+ function Ro(t) {
3523
+ return /* @__PURE__ */ n.jsx("strong", { className: "strong-node", children: t.children });
3524
+ }
3525
+ function So(t) {
3526
+ return /* @__PURE__ */ n.jsx("sub", { className: "subscript-node", children: t.children });
3527
+ }
3528
+ function No(t) {
3529
+ return /* @__PURE__ */ n.jsx("sup", { className: "superscript-node", children: t.children });
3530
+ }
3531
+ function _o(t) {
3532
+ var g;
3533
+ const { node: e, ctx: r, renderNode: o, indexKey: a } = t, l = Array.isArray((g = e == null ? void 0 : e.header) == null ? void 0 : g.cells) ? e.header.cells : [], c = !!(e != null && e.loading), d = Array.isArray(e == null ? void 0 : e.rows) ? e.rows : [], s = (f) => f === "right" ? "text-right" : f === "center" ? "text-center" : "text-left";
3534
+ return /* @__PURE__ */ n.jsxs("div", { className: "table-node-wrapper", "data-index-key": a, children: [
3535
+ /* @__PURE__ */ n.jsxs(
3536
+ "table",
3537
+ {
3538
+ className: Me(
3539
+ "my-8 text-sm table-node",
3540
+ c && "table-node--loading"
3541
+ ),
3542
+ "aria-busy": c,
3543
+ children: [
3544
+ /* @__PURE__ */ n.jsx("thead", { className: "border-[var(--table-border,#cbd5e1)]", children: /* @__PURE__ */ n.jsx("tr", { className: "border-b", children: l.map((f, h) => /* @__PURE__ */ n.jsx(
3545
+ "th",
3546
+ {
3547
+ className: Me("font-semibold p-[calc(4/7*1em)]", s(f.align)),
3548
+ dir: "auto",
3549
+ children: r && o ? Ht(f.children, r, `${String(a != null ? a : "table")}-th-${h}`, o) : null
3550
+ },
3551
+ `header-${h}`
3552
+ )) }) }),
3553
+ /* @__PURE__ */ n.jsx("tbody", { children: d.map((f, h) => {
3554
+ var C;
3555
+ return /* @__PURE__ */ n.jsx(
3556
+ "tr",
3557
+ {
3558
+ className: Me(
3559
+ "border-[var(--table-border,#cbd5e1)]",
3560
+ h < d.length - 1 && "border-b"
3561
+ ),
3562
+ children: (C = f.cells) == null ? void 0 : C.map((w, y) => /* @__PURE__ */ n.jsx(
3563
+ "td",
3564
+ {
3565
+ className: Me("p-[calc(4/7*1em)]", s(w.align)),
3566
+ dir: "auto",
3567
+ children: r && o ? Ht(w.children, r, `${String(a != null ? a : "table")}-row-${h}-${y}`, o) : null
3568
+ },
3569
+ `cell-${h}-${y}`
3570
+ ))
3571
+ },
3572
+ `row-${h}`
3573
+ );
3574
+ }) })
3575
+ ]
3576
+ }
3577
+ ),
3578
+ c && /* @__PURE__ */ n.jsxs("div", { className: "table-node__loading", role: "status", "aria-live": "polite", children: [
3579
+ /* @__PURE__ */ n.jsx("span", { className: "table-node__spinner", "aria-hidden": "true" }),
3580
+ /* @__PURE__ */ n.jsx("span", { className: "sr-only", children: "Loading" })
3581
+ ] })
3582
+ ] });
3583
+ }
3584
+ function Cr(t) {
3585
+ const { node: e, children: r } = t;
3586
+ return /* @__PURE__ */ n.jsx(
3587
+ "span",
3588
+ {
3589
+ className: Me(
3590
+ "text-node whitespace-pre-wrap break-words",
3591
+ e.center && "text-node-center"
3592
+ ),
3593
+ children: r != null ? r : e.content
3594
+ }
3595
+ );
3596
+ }
3597
+ function Lo() {
3598
+ return /* @__PURE__ */ n.jsx("hr", { className: "hr-node thematic-break" });
3599
+ }
3600
+ function Bo(t) {
3601
+ const { node: e, ctx: r, renderNode: o, indexKey: a } = t, l = `vmr-container vmr-container-${e.name}`, c = W(() => {
3602
+ if (e.attrs)
3603
+ return Array.isArray(e.attrs) ? ar(e.attrs) : e.attrs;
3604
+ }, [e.attrs]);
3605
+ return /* @__PURE__ */ n.jsx("div", { className: l, ...c, children: r && o && Array.isArray(e.children) ? e.children.map((d, s) => /* @__PURE__ */ n.jsx(jt.Fragment, { children: o(d, `${String(a != null ? a : "vmr-container")}-${s}`, r) }, `${String(a != null ? a : "vmr-container")}-${s}`)) : null });
3606
+ }
3607
+ function Po(t) {
3608
+ const r = String(t != null ? t : "").match(/^\s*<\s*([A-Z][\w:-]*)/i);
3609
+ return r ? r[1].toLowerCase() : "";
3610
+ }
3611
+ function Do(t, e) {
3612
+ const r = String(t != null ? t : "");
3613
+ if (!e)
3614
+ return r;
3615
+ const o = new RegExp(String.raw`^\s*<\s*${e}(?:\s[^>]*)?>\s*`, "i"), a = new RegExp(String.raw`\s*<\s*\/\s*${e}\s*>\s*$`, "i");
3616
+ return r.replace(o, "").replace(a, "");
3617
+ }
3618
+ function Io(t, e, r) {
3619
+ var a, l, c, d, s, g;
3620
+ const o = ft(String(t.language || ""));
3621
+ if (o === "mermaid") {
3622
+ const f = cr(r.customId).mermaid;
3623
+ if (f)
3624
+ return jt.createElement(f, { key: e, node: t, isDark: r.isDark });
3625
+ if (!r.renderCodeBlocksAsPre)
3626
+ return /* @__PURE__ */ n.jsx(
3627
+ Hr,
3628
+ {
3629
+ node: t,
3630
+ isDark: r.isDark,
3631
+ loading: !!t.loading
3632
+ },
3633
+ e
3634
+ );
3635
+ }
3636
+ return r.renderCodeBlocksAsPre || o === "mermaid" ? /* @__PURE__ */ n.jsx(er, { node: t }, e) : /* @__PURE__ */ n.jsx(
3637
+ Bn,
3638
+ {
3639
+ node: t,
3640
+ loading: !!t.loading,
3641
+ stream: r.codeBlockStream,
3642
+ darkTheme: (a = r.codeBlockThemes) == null ? void 0 : a.darkTheme,
3643
+ lightTheme: (l = r.codeBlockThemes) == null ? void 0 : l.lightTheme,
3644
+ monacoOptions: (c = r.codeBlockThemes) == null ? void 0 : c.monacoOptions,
3645
+ themes: (d = r.codeBlockThemes) == null ? void 0 : d.themes,
3646
+ minWidth: (s = r.codeBlockThemes) == null ? void 0 : s.minWidth,
3647
+ maxWidth: (g = r.codeBlockThemes) == null ? void 0 : g.maxWidth,
3648
+ isDark: r.isDark,
3649
+ onCopy: r.events.onCopy,
3650
+ ...r.codeBlockProps || {}
3651
+ },
3652
+ e
3653
+ );
3654
+ }
3655
+ function Re(t, e, r) {
3656
+ var l, c;
3657
+ const o = cr(r.customId), a = o[t.type];
3658
+ if (a)
3659
+ return jt.createElement(a, {
3660
+ key: e,
3661
+ node: t,
3662
+ customId: r.customId,
3663
+ isDark: r.isDark,
3664
+ ctx: r,
3665
+ renderNode: Re,
3666
+ indexKey: e,
3667
+ typewriter: r.typewriter
3668
+ });
3669
+ if (t.type === "html_block" || t.type === "html_inline") {
3670
+ const d = String((l = t.tag) != null ? l : "").trim().toLowerCase() || Po(t.content), s = d ? o[d] : null;
3671
+ if (s) {
3672
+ const g = {
3673
+ ...t,
3674
+ type: d,
3675
+ tag: d,
3676
+ content: Do(t.content, d)
3677
+ };
3678
+ return jt.createElement(s, {
3679
+ key: e,
3680
+ node: g,
3681
+ customId: r.customId,
3682
+ isDark: r.isDark,
3683
+ ctx: r,
3684
+ renderNode: Re,
3685
+ indexKey: e,
3686
+ typewriter: r.typewriter
3687
+ });
3688
+ }
3689
+ }
3690
+ switch (t.type) {
3691
+ case "text":
3692
+ return /* @__PURE__ */ n.jsx(Cr, { node: t, typewriter: r.typewriter }, e);
3693
+ case "text_special":
3694
+ return /* @__PURE__ */ n.jsx(Cr, { node: { type: "text", content: (c = t.content) != null ? c : "", center: t.center }, typewriter: r.typewriter }, e);
3695
+ case "paragraph":
3696
+ return /* @__PURE__ */ n.jsx(Mo, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3697
+ case "heading":
3698
+ return /* @__PURE__ */ n.jsx(Wn, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3699
+ case "blockquote":
3700
+ return /* @__PURE__ */ n.jsx(Xo, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3701
+ case "list":
3702
+ return /* @__PURE__ */ n.jsx(Gn, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3703
+ case "list_item":
3704
+ return /* @__PURE__ */ n.jsx(Ir, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3705
+ case "table":
3706
+ return /* @__PURE__ */ n.jsx(_o, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3707
+ case "definition_list":
3708
+ return /* @__PURE__ */ n.jsx(Pn, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3709
+ case "footnote":
3710
+ return /* @__PURE__ */ n.jsx(On, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3711
+ case "footnote_reference":
3712
+ return /* @__PURE__ */ n.jsx($n, { node: t }, e);
3713
+ case "footnote_anchor":
3714
+ return /* @__PURE__ */ n.jsx(An, { node: t }, e);
3715
+ case "admonition":
3716
+ return /* @__PURE__ */ n.jsx(tn, { node: t, ctx: r, renderNode: Re, indexKey: e, isDark: r.isDark, typewriter: r.typewriter }, e);
3717
+ case "hardbreak":
3718
+ return /* @__PURE__ */ n.jsx(Fn, { node: t, typewriter: r.typewriter }, e);
3719
+ case "link":
3720
+ return /* @__PURE__ */ n.jsx(qn, { node: t, ctx: r, renderNode: Re, indexKey: e, isDark: r.isDark, typewriter: r.typewriter }, e);
3721
+ case "image":
3722
+ return /* @__PURE__ */ n.jsx(
3723
+ Un,
3724
+ {
3725
+ node: t
3726
+ },
3727
+ e
3728
+ );
3729
+ case "inline_code":
3730
+ return /* @__PURE__ */ n.jsx(Kn, { node: t, typewriter: r.typewriter }, e);
3731
+ case "code_block":
3732
+ return Io(t, e, r);
3733
+ case "strong":
3734
+ return /* @__PURE__ */ n.jsx(
3735
+ Ro,
3736
+ {
3737
+ node: t,
3738
+ children: Xe(t.children, r, `${String(e)}-strong`, Re)
3739
+ },
3740
+ e
3741
+ );
3742
+ case "emphasis":
3743
+ return /* @__PURE__ */ n.jsx(In, { node: t, children: Xe(t.children, r, `${String(e)}-em`, Re) }, e);
3744
+ case "strikethrough":
3745
+ return /* @__PURE__ */ n.jsx(To, { node: t, children: Xe(t.children, r, `${String(e)}-strike`, Re) }, e);
3746
+ case "highlight":
3747
+ return /* @__PURE__ */ n.jsx(Hn, { node: t, children: Xe(t.children, r, `${String(e)}-highlight`, Re) }, e);
3748
+ case "insert":
3749
+ return /* @__PURE__ */ n.jsx(Yn, { node: t, children: Xe(t.children, r, `${String(e)}-insert`, Re) }, e);
3750
+ case "subscript":
3751
+ return /* @__PURE__ */ n.jsx(So, { node: t, children: Xe(t.children, r, `${String(e)}-sub`, Re) }, e);
3752
+ case "superscript":
3753
+ return /* @__PURE__ */ n.jsx(No, { node: t, children: Xe(t.children, r, `${String(e)}-sup`, Re) }, e);
3754
+ case "checkbox":
3755
+ case "checkbox_input":
3756
+ return /* @__PURE__ */ n.jsx(an, { node: t, typewriter: r.typewriter }, e);
3757
+ case "emoji":
3758
+ return /* @__PURE__ */ n.jsx(Dn, { node: t, typewriter: r.typewriter }, e);
3759
+ case "thematic_break":
3760
+ return /* @__PURE__ */ n.jsx(Lo, {}, e);
3761
+ case "math_inline":
3762
+ return /* @__PURE__ */ n.jsx(to, { node: t }, e);
3763
+ case "math_block":
3764
+ return /* @__PURE__ */ n.jsx(eo, { node: t }, e);
3765
+ case "reference":
3766
+ return /* @__PURE__ */ n.jsx(Eo, { node: t, ctx: r, typewriter: r.typewriter }, e);
3767
+ case "html_block":
3768
+ case "html_inline":
3769
+ return t.type === "html_block" ? /* @__PURE__ */ n.jsx(zn, { node: t, typewriter: r.typewriter }, e) : /* @__PURE__ */ n.jsx(Vn, { node: t, typewriter: r.typewriter }, e);
3770
+ case "vmr_container":
3771
+ return /* @__PURE__ */ n.jsx(Bo, { node: t, ctx: r, renderNode: Re, indexKey: e, typewriter: r.typewriter }, e);
3772
+ case "label_open":
3773
+ case "label_close":
3774
+ return null;
3775
+ default:
3776
+ return /* @__PURE__ */ n.jsx(Co, { node: t }, e);
3777
+ }
3778
+ }
3779
+ const Ao = {
3780
+ codeBlockStream: !0,
3781
+ typewriter: !0,
3782
+ batchRendering: !0,
3783
+ initialRenderBatchSize: 40,
3784
+ renderBatchSize: 80,
3785
+ renderBatchDelay: 16,
3786
+ renderBatchBudgetMs: 6,
3787
+ renderBatchIdleTimeoutMs: 120,
3788
+ deferNodesUntilVisible: !0,
3789
+ maxLiveNodes: 320,
3790
+ liveNodeBuffer: 60
3791
+ }, Oo = Jt();
3792
+ function $o(t) {
3793
+ const e = String(t != null ? t : "").trim();
3794
+ if (!e)
3795
+ return "";
3796
+ const r = e.match(/^[<\s/]*([A-Z][\w-]*)/i);
3797
+ return r ? r[1].toLowerCase() : "";
3798
+ }
3799
+ function Fo(t) {
3800
+ return /^[a-z][a-z0-9-]*$/.test(t);
3801
+ }
3802
+ const Wo = 32, Ho = 900, zo = ({
3803
+ props: t,
3804
+ parsedNodes: e,
3805
+ renderCtx: r,
3806
+ indexPrefix: o,
3807
+ containerRef: a
3808
+ }) => {
3809
+ var et, ut, he, tt, wt, Ke, nt;
3810
+ const l = It(), c = typeof window != "undefined", d = typeof window != "undefined" && typeof window.requestIdleCallback == "function", s = Math.max(0, Math.trunc((et = t.renderBatchSize) != null ? et : 80)), g = Math.max(
3811
+ 0,
3812
+ Math.trunc((ut = t.initialRenderBatchSize) != null ? ut : s || e.length)
3813
+ ), f = t.batchRendering !== !1 && s > 0 && c, h = Math.max(0, (he = t.liveNodeBuffer) != null ? he : 60), C = Math.max(1, (tt = t.maxLiveNodes) != null ? tt : 320), w = ((wt = t.maxLiveNodes) != null ? wt : 0) > 0 && e.length > C, y = t.viewportPriority !== !1, N = f && ((Ke = t.maxLiveNodes) != null ? Ke : 0) <= 0, A = W(() => {
3814
+ var b;
3815
+ return t.deferNodesUntilVisible === !1 || ((b = t.maxLiveNodes) != null ? b : 0) <= 0 || w || e.length > Ho ? !1 : y;
3816
+ }, [
3817
+ e.length,
3818
+ t.deferNodesUntilVisible,
3819
+ t.maxLiveNodes,
3820
+ y,
3821
+ w
3822
+ ]), [L, M] = B(() => N ? Math.min(e.length, g) : e.length), I = S(L);
3823
+ F(() => {
3824
+ I.current = L;
3825
+ }, [L]);
3826
+ const O = N ? L : e.length, [re, ue] = B(0), [de, me] = B({ start: 0, end: e.length }), oe = S(/* @__PURE__ */ new Map()), [Se, U] = B(0), ce = S({}), we = S(/* @__PURE__ */ new Map()), J = S(/* @__PURE__ */ new Map()), K = S(/* @__PURE__ */ new Set()), Ne = S(L), ye = S(null), Ae = S(null), ee = S(null), ne = S(!1), xe = S(null), He = S(Math.max(1, s || 1)), ie = S(e.length), st = S({
3827
+ key: t.indexKey,
3828
+ total: e.length
3829
+ }), Ze = S({
3830
+ batchSize: s,
3831
+ initial: g,
3832
+ delay: (nt = t.renderBatchDelay) != null ? nt : 16,
3833
+ enabled: N
3834
+ }), Ue = A || w, x = W(() => {
3835
+ const b = oe.current;
3836
+ if (!b.size)
3837
+ return Wo;
3838
+ let j = 0;
3839
+ for (const T of b.values())
3840
+ j += T;
3841
+ return Math.max(16, j / b.size);
3842
+ }, [Se]), _e = W(() => {
3843
+ if (!w)
3844
+ return e.map((V, Y) => ({ node: V, index: Y }));
3845
+ const b = e.length, j = Math.max(0, Math.min(de.start, b)), T = Math.max(j, Math.min(de.end, b));
3846
+ return e.slice(j, T).map((V, Y) => ({
3847
+ node: V,
3848
+ index: j + Y
3849
+ }));
3850
+ }, [e, de, w]), be = W(() => {
3851
+ if (!w)
3852
+ return e.length;
3853
+ const b = Math.max(de.end + h, g), j = Math.min(e.length, b);
3854
+ return Math.max(L, j);
3855
+ }, [
3856
+ e.length,
3857
+ w,
3858
+ de.end,
3859
+ h,
3860
+ g,
3861
+ L
3862
+ ]);
3863
+ ie.current = be;
3864
+ const Le = D((b, j) => {
3865
+ var Y;
3866
+ if (b >= j)
3867
+ return 0;
3868
+ const T = oe.current;
3869
+ let V = 0;
3870
+ for (let le = b; le < j; le++)
3871
+ V += (Y = T.get(le)) != null ? Y : x;
3872
+ return V;
3873
+ }, [x]), fe = w ? Le(0, Math.min(de.start, e.length)) : 0, gt = w ? Le(Math.min(de.end, e.length), e.length) : 0, ve = D(() => {
3874
+ ye.current != null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(ye.current), ye.current = null), Ae.current != null && (window.clearTimeout(Ae.current), Ae.current = null), ee.current != null && typeof window.cancelIdleCallback == "function" && (window.cancelIdleCallback(ee.current), ee.current = null), ne.current = !1, xe.current = null;
3875
+ }, []), pt = D((b) => {
3876
+ var Y;
3877
+ if (!N)
3878
+ return;
3879
+ const j = Math.max(2, (Y = t.renderBatchBudgetMs) != null ? Y : 6), T = Math.max(1, s || 1), V = Math.max(1, Math.floor(T / 4));
3880
+ b > j * 1.2 ? He.current = Math.max(V, Math.floor(He.current * 0.7)) : b < j * 0.5 && He.current < T && (He.current = Math.min(T, Math.ceil(He.current * 1.2)));
3881
+ }, [N, t.renderBatchBudgetMs, s]), qe = D((b, j = {}) => {
3882
+ var Fe, Ge;
3883
+ if (!N)
3884
+ return;
3885
+ const T = ie.current;
3886
+ if (I.current >= T)
3887
+ return;
3888
+ const V = Math.max(1, b), Y = (ke) => {
3889
+ const u = typeof performance != "undefined" ? performance.now() : Date.now();
3890
+ M((_) => {
3891
+ const H = Math.min(ie.current, _ + Math.max(1, ke));
3892
+ return I.current = H, H;
3893
+ });
3894
+ const E = typeof performance != "undefined" ? performance.now() : Date.now();
3895
+ pt(E - u);
3896
+ }, le = () => {
3897
+ const ke = Math.max(1, Math.round(He.current));
3898
+ qe(ke);
3899
+ }, Z = (ke) => {
3900
+ var H;
3901
+ ye.current = null, Ae.current = null, ee.current = null, ne.current = !1;
3902
+ const u = xe.current;
3903
+ xe.current = null;
3904
+ const E = u != null ? u : V;
3905
+ if (Y(E), I.current >= ie.current)
3906
+ return;
3907
+ if (!ke) {
3908
+ le();
3909
+ return;
3910
+ }
3911
+ const _ = Math.max(2, (H = t.renderBatchBudgetMs) != null ? H : 6);
3912
+ for (; I.current < ie.current && !((typeof ke.timeRemaining == "function" ? ke.timeRemaining() : 0) <= _ * 0.5); )
3913
+ Y(Math.max(1, Math.round(He.current)));
3914
+ I.current < ie.current && le();
3915
+ };
3916
+ if (!c || j.immediate) {
3917
+ Z();
3918
+ return;
3919
+ }
3920
+ const ae = Math.max(0, (Fe = t.renderBatchDelay) != null ? Fe : 16);
3921
+ if (xe.current = xe.current != null ? Math.max(xe.current, V) : V, !ne.current) {
3922
+ if (ne.current = !0, d) {
3923
+ const ke = Math.max(0, (Ge = t.renderBatchIdleTimeoutMs) != null ? Ge : 120);
3924
+ ee.current = window.requestIdleCallback((u) => Z(u), { timeout: ke });
3925
+ return;
3926
+ }
3927
+ if (typeof requestAnimationFrame != "function") {
3928
+ Ae.current = window.setTimeout(() => Z(), ae);
3929
+ return;
3930
+ }
3931
+ ye.current = requestAnimationFrame(() => {
3932
+ if (ae === 0) {
3933
+ Z();
3934
+ return;
3935
+ }
3936
+ Ae.current = window.setTimeout(() => Z(), ae);
3937
+ });
3938
+ }
3939
+ }, [
3940
+ pt,
3941
+ d,
3942
+ N,
3943
+ c,
3944
+ t.renderBatchDelay,
3945
+ t.renderBatchBudgetMs,
3946
+ t.renderBatchIdleTimeoutMs
3947
+ ]);
3948
+ F(() => {
3949
+ var Ge;
3950
+ const b = t.indexKey, j = e.length, T = st.current, V = b !== void 0 ? b !== T.key : j !== T.total;
3951
+ st.current = { key: b, total: j };
3952
+ const Y = Ze.current, le = (Ge = t.renderBatchDelay) != null ? Ge : 16, Z = Y.batchSize !== s || Y.initial !== g || Y.delay !== le || Y.enabled !== N;
3953
+ if (Ze.current = {
3954
+ batchSize: s,
3955
+ initial: g,
3956
+ delay: le,
3957
+ enabled: N
3958
+ }, (V || Z || !N) && ve(), (V || Z) && (He.current = Math.max(1, s || 1), K.current.clear()), !j) {
3959
+ I.current = 0, M(0);
3960
+ return;
3961
+ }
3962
+ const ae = ie.current;
3963
+ if (!N) {
3964
+ I.current = ae, M(ae);
3965
+ return;
3966
+ }
3967
+ if (V || Z) {
3968
+ const ke = Math.min(ae, g);
3969
+ I.current = ke, M(ke), ke < ae && qe(Math.max(1, g), { immediate: !c });
3970
+ return;
3971
+ }
3972
+ const Fe = Math.min(I.current, ae);
3973
+ Fe !== I.current && (I.current = Fe, M(Fe)), I.current < ae && qe(Math.max(1, s || 1));
3974
+ }, [
3975
+ ve,
3976
+ N,
3977
+ c,
3978
+ e.length,
3979
+ t.indexKey,
3980
+ t.renderBatchDelay,
3981
+ s,
3982
+ g,
3983
+ qe
3984
+ ]), F(() => {
3985
+ if (!w) {
3986
+ me({ start: 0, end: e.length });
3987
+ return;
3988
+ }
3989
+ const b = e.length;
3990
+ if (!b) {
3991
+ me({ start: 0, end: 0 });
3992
+ return;
3993
+ }
3994
+ const j = Math.max(0, Math.min(re, b - 1));
3995
+ let T = Math.max(0, j - h), V = Math.min(b, j + h + 1);
3996
+ const Y = V - T;
3997
+ if (Y > C) {
3998
+ const le = Y - C;
3999
+ T += Math.ceil(le / 2), V -= Math.floor(le / 2);
4000
+ } else if (Y < C) {
4001
+ const le = C - Y;
4002
+ T = Math.max(0, T - Math.ceil(le / 2)), V = Math.min(b, V + Math.floor(le / 2));
4003
+ }
4004
+ me({ start: T, end: V });
4005
+ }, [re, h, C, e.length, w]), F(() => () => {
4006
+ ve();
4007
+ for (const b of we.current.values())
4008
+ b.destroy();
4009
+ we.current.clear();
4010
+ }, [ve]);
4011
+ const ze = D((b) => {
4012
+ for (const [j, T] of we.current.entries())
4013
+ j >= b && (T.destroy(), we.current.delete(j), delete ce.current[j], J.current.delete(j));
4014
+ }, []);
4015
+ F(() => {
4016
+ ze(O);
4017
+ }, [ze, O]), F(() => {
4018
+ const b = e.length;
4019
+ let j = !1;
4020
+ for (const T of Array.from(oe.current.keys()))
4021
+ T >= b && (oe.current.delete(T), j = !0);
4022
+ j && U((T) => T + 1);
4023
+ for (const T of Object.keys(ce.current))
4024
+ Number(T) >= b && delete ce.current[T];
4025
+ for (const T of Array.from(K.current))
4026
+ T >= b && K.current.delete(T);
4027
+ }, [e.length]);
4028
+ const $ = D((b, j) => {
4029
+ A && j && (ce.current[b] = !0), j && w && ue((T) => b > T ? b : T);
4030
+ }, [A, w]), De = D((b) => {
4031
+ const j = we.current.get(b);
4032
+ j && (j.destroy(), we.current.delete(b));
4033
+ }, []), Qe = D((b, j) => {
4034
+ const T = J.current;
4035
+ if (j ? T.set(b, j) : T.delete(b), !Ue || !j) {
4036
+ De(b), A && !j && delete ce.current[b], j && $(b, !0);
4037
+ return;
4038
+ }
4039
+ if (b < g && !w) {
4040
+ De(b), $(b, !0);
4041
+ return;
4042
+ }
4043
+ De(b);
4044
+ const V = l(j, { rootMargin: "400px" });
4045
+ we.current.set(b, V), V.isVisible() && $(b, !0), V.whenVisible.then(() => $(b, !0)).catch(() => {
4046
+ });
4047
+ }, [
4048
+ A,
4049
+ De,
4050
+ $,
4051
+ l,
4052
+ g,
4053
+ Ue,
4054
+ w
4055
+ ]), Oe = D((b, j) => {
4056
+ if (!j) {
4057
+ oe.current.has(b) && (oe.current.delete(b), U((V) => V + 1));
4058
+ return;
4059
+ }
4060
+ const T = () => {
4061
+ const V = j.offsetHeight;
4062
+ if (!V)
4063
+ return;
4064
+ oe.current.get(b) !== V && (oe.current.set(b, V), U((le) => le + 1));
4065
+ };
4066
+ typeof queueMicrotask == "function" ? queueMicrotask(T) : Promise.resolve().then(T);
4067
+ }, []), ct = D((b) => N && b >= I.current ? !1 : !A || b < g ? !0 : ce.current[b] === !0, [A, N, g]), rt = D((b) => (j) => {
4068
+ if (!b)
4069
+ return;
4070
+ const T = j.target;
4071
+ T != null && T.closest("[data-node-index]") && b(j);
4072
+ }, []);
4073
+ F(() => {
4074
+ for (const [b, j] of J.current.entries())
4075
+ j && Qe(b, j);
4076
+ }, [Qe]), F(() => {
4077
+ w && L > Ne.current && ue(L - 1), Ne.current = L;
4078
+ }, [L, w]);
4079
+ const $e = w ? /* @__PURE__ */ n.jsx("div", { className: "node-spacer", style: { height: `${fe}px` }, "aria-hidden": "true" }) : null, je = w ? /* @__PURE__ */ n.jsx("div", { className: "node-spacer", style: { height: `${gt}px` }, "aria-hidden": "true" }) : null;
4080
+ return /* @__PURE__ */ n.jsxs(
4081
+ "div",
4082
+ {
4083
+ ref: a,
4084
+ className: `markstream-vue markdown-renderer${t.isDark ? " dark" : ""}${w ? " virtualized" : ""}`,
4085
+ onClick: t.onClick,
4086
+ onMouseOver: rt(t.onMouseOver),
4087
+ onMouseOut: rt(t.onMouseOut),
4088
+ children: [
4089
+ $e,
4090
+ _e.map(({ node: b, index: j }) => {
4091
+ var le;
4092
+ const T = ct(j), V = (le = oe.current.get(j)) != null ? le : x, Y = t.typewriter !== !1 && b.type !== "code_block" && !K.current.has(j) && T;
4093
+ return Y && K.current.add(j), /* @__PURE__ */ n.jsx(
4094
+ "div",
4095
+ {
4096
+ ref: (Z) => Qe(j, Z),
4097
+ className: "node-slot",
4098
+ "data-node-index": j,
4099
+ "data-node-type": b.type,
4100
+ children: T ? /* @__PURE__ */ n.jsx(
4101
+ "div",
4102
+ {
4103
+ ref: (Z) => Oe(j, Z),
4104
+ className: `node-content${Y ? " typewriter-node" : ""}`,
4105
+ children: Re(b, `${o}-${j}`, r)
4106
+ }
4107
+ ) : /* @__PURE__ */ n.jsx("div", { className: "node-placeholder", style: { height: `${V}px` } })
4108
+ },
4109
+ `${o}-${j}`
4110
+ );
4111
+ }),
4112
+ je
4113
+ ]
4114
+ }
4115
+ );
4116
+ }, Vo = (t) => {
4117
+ const e = { ...Ao, ...t }, r = S(null), o = qr(
4118
+ on,
4119
+ gr,
4120
+ gr
4121
+ ), a = W(() => e.customId ? `renderer-${e.customId}` : `renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`, [e.customId]), l = W(() => {
4122
+ const w = cr(e.customId);
4123
+ return Object.keys(w).map(String).map((y) => y.trim().toLowerCase()).filter(Fo);
4124
+ }, [e.customId, o]), c = W(() => {
4125
+ var A, L, M;
4126
+ const y = (L = ((A = e.parseOptions) != null ? A : {}).customHtmlTags) != null ? L : [], N = [
4127
+ ...(M = e.customHtmlTags) != null ? M : [],
4128
+ ...Array.isArray(y) ? y : [],
4129
+ ...l
4130
+ ].map($o).filter(Boolean);
4131
+ return Array.from(new Set(N));
4132
+ }, [
4133
+ e.customId,
4134
+ e.customHtmlTags,
4135
+ e.parseOptions,
4136
+ l,
4137
+ o
4138
+ ]), d = W(() => {
4139
+ const w = c;
4140
+ return !w || w.length === 0 ? Jt(a) : Jt(a, { customHtmlTags: w });
4141
+ }, [a, c]), s = W(() => {
4142
+ const w = d;
4143
+ return e.customMarkdownIt ? e.customMarkdownIt(w) : w;
4144
+ }, [d, e.customMarkdownIt]), g = W(() => {
4145
+ var A, L;
4146
+ const w = (A = e.parseOptions) != null ? A : {}, y = (L = e.final) != null ? L : w.final, N = c;
4147
+ return N.length ? {
4148
+ ...w,
4149
+ final: y,
4150
+ customHtmlTags: N
4151
+ } : y == null ? w : { ...w, final: y };
4152
+ }, [c, e.final, e.parseOptions]), f = W(() => {
4153
+ var A, L;
4154
+ const w = !!e.debugPerformance && typeof console != "undefined" && typeof performance != "undefined", y = w ? performance.now() : 0;
4155
+ let N = [];
4156
+ return Array.isArray(e.nodes) && e.nodes.length ? N = e.nodes.map((M) => ({ ...M })) : e.content && (N = Gr(e.content, s != null ? s : Oo, g)), w && console.info("[markstream-react][perf] parse(sync)", {
4157
+ ms: Math.round(performance.now() - y),
4158
+ nodes: N.length,
4159
+ contentLength: (L = (A = e.content) == null ? void 0 : A.length) != null ? L : 0
4160
+ }), N;
4161
+ }, [
4162
+ e.content,
4163
+ e.debugPerformance,
4164
+ e.nodes,
4165
+ g,
4166
+ s,
4167
+ e.customId,
4168
+ o,
4169
+ c
4170
+ ]);
4171
+ F(() => {
4172
+ var L, M;
4173
+ if (typeof window == "undefined" || e.renderCodeBlocksAsPre || !f.some((I) => {
4174
+ var re;
4175
+ return (I == null ? void 0 : I.type) !== "code_block" ? !1 : ft(String((re = I == null ? void 0 : I.language) != null ? re : "")) !== "mermaid";
4176
+ }))
4177
+ return;
4178
+ const y = (L = window.requestIdleCallback) != null ? L : ((I, O) => {
4179
+ var re;
4180
+ return window.setTimeout(() => I({ didTimeout: !0, timeRemaining: () => 0 }), (re = O == null ? void 0 : O.timeout) != null ? re : 600);
4181
+ }), N = (M = window.cancelIdleCallback) != null ? M : ((I) => window.clearTimeout(I)), A = y(() => {
4182
+ Pr();
4183
+ }, { timeout: 900 });
4184
+ return () => N(A);
4185
+ }, [f, e.renderCodeBlocksAsPre]);
4186
+ const h = W(() => e.indexKey != null ? String(e.indexKey) : "markdown-renderer", [e.indexKey]), C = W(() => ({
4187
+ customId: e.customId,
4188
+ isDark: e.isDark,
4189
+ indexKey: h,
4190
+ typewriter: e.typewriter,
4191
+ renderCodeBlocksAsPre: e.renderCodeBlocksAsPre,
4192
+ codeBlockStream: e.codeBlockStream,
4193
+ codeBlockProps: e.codeBlockProps,
4194
+ codeBlockThemes: {
4195
+ themes: e.themes,
4196
+ darkTheme: e.codeBlockDarkTheme,
4197
+ lightTheme: e.codeBlockLightTheme,
4198
+ monacoOptions: e.codeBlockMonacoOptions,
4199
+ minWidth: e.codeBlockMinWidth,
4200
+ maxWidth: e.codeBlockMaxWidth
4201
+ },
4202
+ events: {
4203
+ onCopy: e.onCopy,
4204
+ onHandleArtifactClick: e.onHandleArtifactClick
4205
+ }
4206
+ }), [
4207
+ e.customId,
4208
+ e.isDark,
4209
+ h,
4210
+ e.typewriter,
4211
+ e.renderCodeBlocksAsPre,
4212
+ e.codeBlockStream,
4213
+ e.codeBlockProps,
4214
+ e.themes,
4215
+ e.codeBlockDarkTheme,
4216
+ e.codeBlockLightTheme,
4217
+ e.codeBlockMonacoOptions,
4218
+ e.codeBlockMinWidth,
4219
+ e.codeBlockMaxWidth,
4220
+ e.onCopy,
4221
+ e.onHandleArtifactClick
4222
+ ]);
4223
+ return /* @__PURE__ */ n.jsx(
4224
+ nn,
4225
+ {
4226
+ getRoot: () => r.current,
4227
+ enabled: e.viewportPriority !== !1,
4228
+ children: /* @__PURE__ */ n.jsx(
4229
+ zo,
4230
+ {
4231
+ props: e,
4232
+ parsedNodes: f,
4233
+ renderCtx: C,
4234
+ indexPrefix: h,
4235
+ containerRef: r
4236
+ }
4237
+ )
4238
+ }
4239
+ );
4240
+ };
4241
+ function Xo(t) {
4242
+ var c, d, s, g, f, h;
4243
+ const { node: e, ctx: r, renderNode: o, indexKey: a, children: l } = t;
4244
+ return /* @__PURE__ */ n.jsx("blockquote", { className: "blockquote-node", dir: "auto", cite: e.cite, children: l != null ? l : r && o ? /* @__PURE__ */ n.jsx(
4245
+ Vo,
4246
+ {
4247
+ nodes: e.children || [],
4248
+ indexKey: `blockquote-${String(a != null ? a : "blockquote")}`,
4249
+ customId: r.customId,
4250
+ isDark: r.isDark,
4251
+ typewriter: r.typewriter,
4252
+ viewportPriority: !0,
4253
+ codeBlockStream: r.codeBlockStream,
4254
+ renderCodeBlocksAsPre: r.renderCodeBlocksAsPre,
4255
+ codeBlockProps: r.codeBlockProps,
4256
+ themes: (c = r.codeBlockThemes) == null ? void 0 : c.themes,
4257
+ codeBlockDarkTheme: (d = r.codeBlockThemes) == null ? void 0 : d.darkTheme,
4258
+ codeBlockLightTheme: (s = r.codeBlockThemes) == null ? void 0 : s.lightTheme,
4259
+ codeBlockMonacoOptions: (g = r.codeBlockThemes) == null ? void 0 : g.monacoOptions,
4260
+ codeBlockMinWidth: (f = r.codeBlockThemes) == null ? void 0 : f.minWidth,
4261
+ codeBlockMaxWidth: (h = r.codeBlockThemes) == null ? void 0 : h.maxWidth,
4262
+ onCopy: r.events.onCopy,
4263
+ onHandleArtifactClick: r.events.onHandleArtifactClick
4264
+ }
4265
+ ) : null });
4266
+ }
4267
+ function Uo(t) {
4268
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4269
+ }
4270
+ function Ko(t) {
4271
+ var o;
4272
+ const [e] = String(t != null ? t : "").split(":");
4273
+ return ((o = e == null ? void 0 : e.trim().toLowerCase()) != null ? o : "") || "plaintext";
4274
+ }
4275
+ function pi(t) {
4276
+ const e = {
4277
+ loading: !0,
4278
+ stream: !0,
4279
+ darkTheme: "vitesse-dark",
4280
+ lightTheme: "vitesse-light",
4281
+ isDark: !1,
4282
+ isShowPreview: !0,
4283
+ enableFontSizeControl: !0,
4284
+ showHeader: !0,
4285
+ showCopyButton: !0,
4286
+ showExpandButton: !0,
4287
+ showPreviewButton: !0,
4288
+ showFontSizeButtons: !0,
4289
+ ...t
4290
+ }, r = W(() => {
4291
+ var x;
4292
+ return String((x = e.node.language) != null ? x : "");
4293
+ }, [e.node.language]), o = W(() => Ko(r), [r]), a = W(() => ft(r), [r]), l = a === "mermaid", c = W(() => {
4294
+ const x = Qt[a] || a;
4295
+ return x ? x.charAt(0).toUpperCase() + x.slice(1) : "Text";
4296
+ }, [a]), d = W(() => ur(a), [a]), { t: s } = lr(), g = W(() => e.isShowPreview ? a === "html" || a === "svg" : !1, [a, e.isShowPreview]), f = W(() => {
4297
+ const x = {}, _e = (fe) => {
4298
+ if (fe != null)
4299
+ return typeof fe == "number" ? `${fe}px` : String(fe);
4300
+ }, be = _e(e.minWidth), Le = _e(e.maxWidth);
4301
+ return be && (x.minWidth = be), Le && (x.maxWidth = Le), x;
4302
+ }, [e.maxWidth, e.minWidth]), [h, C] = B(!1), [w, y] = B(!1), [N, A] = B(!1), [L, M] = B(""), [I, O] = B(!1), [re, ue] = B(14), [de, me] = B(re), oe = S(null), Se = S(null), U = S(null), ce = S(null), we = S(!1), J = D(() => e.isDark ? e.darkTheme : e.lightTheme, [e.darkTheme, e.isDark, e.lightTheme]), K = D((x) => {
4303
+ if (!x) {
4304
+ M(""), O(!1);
4305
+ return;
4306
+ }
4307
+ M(`<pre class="shiki shiki-fallback"><code>${Uo(x)}</code></pre>`), O(!1);
4308
+ }, []), Ne = D(() => {
4309
+ M(""), O(!0);
4310
+ }, []), ye = D(async () => {
4311
+ if (!(ce.current || we.current)) {
4312
+ we.current = !0;
4313
+ try {
4314
+ const x = await import("stream-markdown");
4315
+ ce.current = x.createShikiStreamRenderer;
4316
+ } catch {
4317
+ }
4318
+ }
4319
+ }, []), Ae = D(async () => {
4320
+ var x;
4321
+ if (l) {
4322
+ (x = U.current) == null || x.dispose(), U.current = null, O(!1);
4323
+ return;
4324
+ }
4325
+ if (await ye(), !oe.current || !Se.current) {
4326
+ K(e.node.code);
4327
+ return;
4328
+ }
4329
+ if (!U.current && ce.current && (U.current = ce.current(Se.current, {
4330
+ theme: J(),
4331
+ themes: e.themes
4332
+ }), O(!0)), !U.current) {
4333
+ K(e.node.code);
4334
+ return;
4335
+ }
4336
+ if (e.stream === !1 && e.loading) {
4337
+ K(e.node.code);
4338
+ return;
4339
+ }
4340
+ K(e.node.code);
4341
+ try {
4342
+ await U.current.updateCode(e.node.code, o), Ne();
4343
+ } catch {
4344
+ }
4345
+ }, [Ne, ye, J, l, o, e.loading, e.node.code, e.stream, e.themes, K]);
4346
+ F(() => (Ae(), () => {
4347
+ var x;
4348
+ (x = U.current) == null || x.dispose(), U.current = null;
4349
+ }), [Ae]), F(() => {
4350
+ U.current && U.current.setTheme(J());
4351
+ }, [J]), F(() => {
4352
+ U.current && (e.stream === !1 && e.loading || (K(e.node.code), Promise.resolve(U.current.updateCode(e.node.code, o)).then(() => Ne()).catch(() => {
4353
+ })));
4354
+ }, [Ne, o, e.loading, e.node.code, e.stream, K]);
4355
+ const ee = D((x, _e) => {
4356
+ const be = x.currentTarget;
4357
+ Ut(be, _e, "top", !1, { x: x.clientX, y: x.clientY }, e.isDark);
4358
+ }, [e.isDark]), ne = D(() => We(), []), xe = D(async () => {
4359
+ var x;
4360
+ try {
4361
+ typeof navigator != "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText == "function" && await navigator.clipboard.writeText(e.node.code), C(!0), (x = e.onCopy) == null || x.call(e, e.node.code), setTimeout(() => C(!1), 1e3);
4362
+ } catch {
4363
+ }
4364
+ }, [e]), He = D(() => {
4365
+ var Le;
4366
+ if (!g)
4367
+ return;
4368
+ const x = o, _e = x === "html" ? "text/html" : "image/svg+xml", be = x === "html" ? "HTML Preview" : "SVG Preview";
4369
+ (Le = e.onPreviewCode) == null || Le.call(e, {
4370
+ type: _e,
4371
+ content: e.node.code,
4372
+ title: be
4373
+ });
4374
+ }, [g, o, e]), ie = W(() => ({ fontSize: `${de}px` }), [de]), st = () => me((x) => Math.max(10, x - 1)), Ze = () => me((x) => Math.min(36, x + 1)), Ue = () => me(re);
4375
+ return F(() => {
4376
+ ue(14), me(14);
4377
+ }, []), l ? /* @__PURE__ */ n.jsx(
4378
+ Hr,
4379
+ {
4380
+ node: e.node,
4381
+ isDark: e.isDark,
4382
+ loading: e.loading
4383
+ }
4384
+ ) : /* @__PURE__ */ n.jsxs(
4385
+ "div",
4386
+ {
4387
+ className: [
4388
+ "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",
4389
+ e.isDark ? "border-gray-700/30 bg-gray-900 is-dark" : "border-gray-200 bg-white"
4390
+ ].join(" "),
4391
+ style: f,
4392
+ children: [
4393
+ e.showHeader && /* @__PURE__ */ n.jsxs(
4394
+ "div",
4395
+ {
4396
+ className: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",
4397
+ style: { color: "var(--vscode-editor-foreground)", backgroundColor: "var(--vscode-editor-background)" },
4398
+ children: [
4399
+ /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-2", children: [
4400
+ /* @__PURE__ */ n.jsx(
4401
+ "span",
4402
+ {
4403
+ className: "icon-slot h-4 w-4 flex-shrink-0",
4404
+ dangerouslySetInnerHTML: { __html: d }
4405
+ }
4406
+ ),
4407
+ /* @__PURE__ */ n.jsx("span", { className: "text-sm font-medium font-mono", children: c })
4408
+ ] }),
4409
+ /* @__PURE__ */ n.jsxs("div", { className: "flex items-center space-x-2", children: [
4410
+ /* @__PURE__ */ n.jsx(
4411
+ "button",
4412
+ {
4413
+ type: "button",
4414
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4415
+ "aria-pressed": N,
4416
+ onClick: () => A((x) => !x),
4417
+ onMouseEnter: (x) => ee(x, N ? s("common.expand") || "Expand" : s("common.collapse") || "Collapse"),
4418
+ onFocus: (x) => ee(x, N ? s("common.expand") || "Expand" : s("common.collapse") || "Collapse"),
4419
+ onMouseLeave: ne,
4420
+ onBlur: ne,
4421
+ children: /* @__PURE__ */ n.jsx(
4422
+ "svg",
4423
+ {
4424
+ style: { rotate: N ? "0deg" : "90deg" },
4425
+ xmlns: "http://www.w3.org/2000/svg",
4426
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4427
+ "aria-hidden": "true",
4428
+ role: "img",
4429
+ width: "1em",
4430
+ height: "1em",
4431
+ viewBox: "0 0 24 24",
4432
+ className: "w-3 h-3",
4433
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m9 18l6-6l-6-6" })
4434
+ }
4435
+ )
4436
+ }
4437
+ ),
4438
+ e.showFontSizeButtons && e.enableFontSizeControl && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
4439
+ /* @__PURE__ */ n.jsx(
4440
+ "button",
4441
+ {
4442
+ type: "button",
4443
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4444
+ disabled: de <= 10,
4445
+ onClick: st,
4446
+ onMouseEnter: (x) => ee(x, s("common.decrease") || "Decrease"),
4447
+ onFocus: (x) => ee(x, s("common.decrease") || "Decrease"),
4448
+ onMouseLeave: ne,
4449
+ onBlur: ne,
4450
+ children: /* @__PURE__ */ n.jsx(
4451
+ "svg",
4452
+ {
4453
+ xmlns: "http://www.w3.org/2000/svg",
4454
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4455
+ "aria-hidden": "true",
4456
+ role: "img",
4457
+ width: "1em",
4458
+ height: "1em",
4459
+ viewBox: "0 0 24 24",
4460
+ className: "w-3 h-3",
4461
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M5 12h14" })
4462
+ }
4463
+ )
4464
+ }
4465
+ ),
4466
+ /* @__PURE__ */ n.jsx(
4467
+ "button",
4468
+ {
4469
+ type: "button",
4470
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4471
+ disabled: de === re,
4472
+ onClick: Ue,
4473
+ onMouseEnter: (x) => ee(x, s("common.reset") || "Reset"),
4474
+ onFocus: (x) => ee(x, s("common.reset") || "Reset"),
4475
+ onMouseLeave: ne,
4476
+ onBlur: ne,
4477
+ children: /* @__PURE__ */ n.jsx(
4478
+ "svg",
4479
+ {
4480
+ xmlns: "http://www.w3.org/2000/svg",
4481
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4482
+ "aria-hidden": "true",
4483
+ role: "img",
4484
+ width: "1em",
4485
+ height: "1em",
4486
+ viewBox: "0 0 24 24",
4487
+ className: "w-3 h-3",
4488
+ children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
4489
+ /* @__PURE__ */ n.jsx("path", { d: "M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8" }),
4490
+ /* @__PURE__ */ n.jsx("path", { d: "M3 3v5h5" })
4491
+ ] })
4492
+ }
4493
+ )
4494
+ }
4495
+ ),
4496
+ /* @__PURE__ */ n.jsx(
4497
+ "button",
4498
+ {
4499
+ type: "button",
4500
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4501
+ disabled: de >= 36,
4502
+ onClick: Ze,
4503
+ onMouseEnter: (x) => ee(x, s("common.increase") || "Increase"),
4504
+ onFocus: (x) => ee(x, s("common.increase") || "Increase"),
4505
+ onMouseLeave: ne,
4506
+ onBlur: ne,
4507
+ children: /* @__PURE__ */ n.jsx(
4508
+ "svg",
4509
+ {
4510
+ xmlns: "http://www.w3.org/2000/svg",
4511
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4512
+ "aria-hidden": "true",
4513
+ role: "img",
4514
+ width: "1em",
4515
+ height: "1em",
4516
+ viewBox: "0 0 24 24",
4517
+ className: "w-3 h-3",
4518
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M5 12h14m-7-7v14" })
4519
+ }
4520
+ )
4521
+ }
4522
+ )
4523
+ ] }),
4524
+ e.showCopyButton && /* @__PURE__ */ n.jsx(
4525
+ "button",
4526
+ {
4527
+ type: "button",
4528
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4529
+ "aria-label": h ? s("common.copied") || "Copied" : s("common.copy") || "Copy",
4530
+ onClick: xe,
4531
+ onMouseEnter: (x) => ee(x, h ? s("common.copied") || "Copied" : s("common.copy") || "Copy"),
4532
+ onFocus: (x) => ee(x, h ? s("common.copied") || "Copied" : s("common.copy") || "Copy"),
4533
+ onMouseLeave: ne,
4534
+ onBlur: ne,
4535
+ children: h ? /* @__PURE__ */ n.jsx(
4536
+ "svg",
4537
+ {
4538
+ xmlns: "http://www.w3.org/2000/svg",
4539
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4540
+ "aria-hidden": "true",
4541
+ role: "img",
4542
+ width: "1em",
4543
+ height: "1em",
4544
+ viewBox: "0 0 24 24",
4545
+ className: "w-3 h-3",
4546
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M20 6L9 17l-5-5" })
4547
+ }
4548
+ ) : /* @__PURE__ */ n.jsx(
4549
+ "svg",
4550
+ {
4551
+ xmlns: "http://www.w3.org/2000/svg",
4552
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4553
+ "aria-hidden": "true",
4554
+ role: "img",
4555
+ width: "1em",
4556
+ height: "1em",
4557
+ viewBox: "0 0 24 24",
4558
+ className: "w-3 h-3",
4559
+ children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
4560
+ /* @__PURE__ */ n.jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
4561
+ /* @__PURE__ */ n.jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
4562
+ ] })
4563
+ }
4564
+ )
4565
+ }
4566
+ ),
4567
+ e.showExpandButton && /* @__PURE__ */ n.jsx(
4568
+ "button",
4569
+ {
4570
+ type: "button",
4571
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4572
+ "aria-pressed": w,
4573
+ onClick: () => y((x) => !x),
4574
+ onMouseEnter: (x) => ee(x, w ? s("common.collapse") || "Collapse" : s("common.expand") || "Expand"),
4575
+ onFocus: (x) => ee(x, w ? s("common.collapse") || "Collapse" : s("common.expand") || "Expand"),
4576
+ onMouseLeave: ne,
4577
+ onBlur: ne,
4578
+ children: w ? /* @__PURE__ */ n.jsx(
4579
+ "svg",
4580
+ {
4581
+ xmlns: "http://www.w3.org/2000/svg",
4582
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4583
+ "aria-hidden": "true",
4584
+ role: "img",
4585
+ width: "1em",
4586
+ height: "1em",
4587
+ viewBox: "0 0 24 24",
4588
+ className: "w-3 h-3",
4589
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" })
4590
+ }
4591
+ ) : /* @__PURE__ */ n.jsx(
4592
+ "svg",
4593
+ {
4594
+ xmlns: "http://www.w3.org/2000/svg",
4595
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4596
+ "aria-hidden": "true",
4597
+ role: "img",
4598
+ width: "1em",
4599
+ height: "1em",
4600
+ viewBox: "0 0 24 24",
4601
+ className: "w-3 h-3",
4602
+ children: /* @__PURE__ */ n.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" })
4603
+ }
4604
+ )
4605
+ }
4606
+ ),
4607
+ g && e.showPreviewButton && /* @__PURE__ */ n.jsx(
4608
+ "button",
4609
+ {
4610
+ type: "button",
4611
+ className: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
4612
+ "aria-label": s("common.preview") || "Preview",
4613
+ onClick: He,
4614
+ onMouseEnter: (x) => ee(x, s("common.preview") || "Preview"),
4615
+ onFocus: (x) => ee(x, s("common.preview") || "Preview"),
4616
+ onMouseLeave: ne,
4617
+ onBlur: ne,
4618
+ children: /* @__PURE__ */ n.jsx(
4619
+ "svg",
4620
+ {
4621
+ xmlns: "http://www.w3.org/2000/svg",
4622
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
4623
+ "aria-hidden": "true",
4624
+ role: "img",
4625
+ width: "1em",
4626
+ height: "1em",
4627
+ viewBox: "0 0 24 24",
4628
+ className: "w-3 h-3",
4629
+ children: /* @__PURE__ */ n.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", children: [
4630
+ /* @__PURE__ */ n.jsx("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" }),
4631
+ /* @__PURE__ */ n.jsx("circle", { cx: "12", cy: "12", r: "3" })
4632
+ ] })
4633
+ }
4634
+ )
4635
+ }
4636
+ )
4637
+ ] })
4638
+ ]
4639
+ }
4640
+ ),
4641
+ !N && (e.stream ? !0 : !e.loading) && /* @__PURE__ */ n.jsxs(
4642
+ "div",
4643
+ {
4644
+ ref: oe,
4645
+ className: "code-block-content",
4646
+ style: {
4647
+ ...ie,
4648
+ maxHeight: w ? "none" : "500px",
4649
+ overflow: w ? "visible" : "auto"
4650
+ },
4651
+ children: [
4652
+ /* @__PURE__ */ n.jsx("div", { ref: Se, className: "code-block-render" }),
4653
+ !I && L && /* @__PURE__ */ n.jsx("div", { className: "code-fallback-plain", dangerouslySetInnerHTML: { __html: L } })
4654
+ ]
4655
+ }
4656
+ ),
4657
+ !e.stream && e.loading && /* @__PURE__ */ n.jsx("div", { className: "code-loading-placeholder", children: /* @__PURE__ */ n.jsxs("div", { className: "loading-skeleton", children: [
4658
+ /* @__PURE__ */ n.jsx("div", { className: "skeleton-line" }),
4659
+ /* @__PURE__ */ n.jsx("div", { className: "skeleton-line" }),
4660
+ /* @__PURE__ */ n.jsx("div", { className: "skeleton-line short" })
4661
+ ] }) }),
4662
+ /* @__PURE__ */ n.jsx("span", { className: "sr-only", "aria-live": "polite", role: "status", children: h ? s("common.copied") || "Copied" : "" })
4663
+ ]
4664
+ }
4665
+ );
4666
+ }
4667
+ function Yo(t) {
4668
+ if (typeof t == "boolean")
4669
+ return t;
4670
+ if (typeof document != "undefined")
4671
+ try {
4672
+ if (document.documentElement.classList.contains("dark"))
4673
+ return !0;
4674
+ } catch {
4675
+ }
4676
+ if (typeof window != "undefined" && typeof window.matchMedia == "function")
4677
+ try {
4678
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
4679
+ } catch {
4680
+ }
4681
+ return !1;
4682
+ }
4683
+ function wi(t) {
4684
+ var d;
4685
+ const e = S(null), [r, o] = B(!1), [a, l] = B({ transform: "translate3d(0px, 0px, 0px)", left: "0px", top: "0px" }), c = W(() => Yo(t.isDark), [t.isDark]);
4686
+ return F(() => {
4687
+ if (!t.visible) {
4688
+ o(!1);
4689
+ return;
4690
+ }
4691
+ if (!t.anchorEl || !e.current) {
4692
+ o(!0);
4693
+ return;
4694
+ }
4695
+ let s = null, g = !1;
4696
+ const f = async () => {
4697
+ var w, y;
4698
+ if (!t.anchorEl || !e.current)
4699
+ return;
4700
+ const { x: h, y: C } = await Er(t.anchorEl, e.current, {
4701
+ placement: (w = t.placement) != null ? w : "top",
4702
+ middleware: [Tr((y = t.offset) != null ? y : 8), Rr(), Sr({ padding: 8 })],
4703
+ strategy: "fixed"
4704
+ });
4705
+ g || l({
4706
+ position: "fixed",
4707
+ left: "0px",
4708
+ top: "0px",
4709
+ transform: `translate3d(${Math.round(h)}px, ${Math.round(C)}px, 0)`
4710
+ });
4711
+ };
4712
+ return f().then(() => {
4713
+ g || o(!0);
4714
+ }), s = Mr(t.anchorEl, e.current, f), () => {
4715
+ g = !0, s == null || s();
4716
+ };
4717
+ }, [t.anchorEl, t.offset, t.placement, t.visible]), typeof document == "undefined" || !t.visible || !r ? null : ir(
4718
+ /* @__PURE__ */ n.jsx(
4719
+ "div",
4720
+ {
4721
+ id: (d = t.id) != null ? d : void 0,
4722
+ ref: e,
4723
+ style: a,
4724
+ className: [
4725
+ "ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",
4726
+ c ? "bg-gray-900 text-white border-gray-700 is-dark" : "bg-white text-gray-900 border-gray-200"
4727
+ ].join(" "),
4728
+ role: "tooltip",
4729
+ children: t.content
4730
+ }
4731
+ ),
4732
+ document.body
4733
+ );
4734
+ }
4735
+ export {
4736
+ tn as AdmonitionNode,
4737
+ Xo as BlockquoteNode,
4738
+ an as CheckboxNode,
4739
+ Bn as CodeBlockNode,
4740
+ Pn as DefinitionListNode,
4741
+ Dn as EmojiNode,
4742
+ In as EmphasisNode,
4743
+ Co as FallbackComponent,
4744
+ An as FootnoteAnchorNode,
4745
+ On as FootnoteNode,
4746
+ $n as FootnoteReferenceNode,
4747
+ Fn as HardBreakNode,
4748
+ Wn as HeadingNode,
4749
+ Hn as HighlightNode,
4750
+ zn as HtmlBlockNode,
4751
+ Vn as HtmlInlineNode,
4752
+ Rn as HtmlPreviewFrame,
4753
+ Un as ImageNode,
4754
+ Kn as InlineCodeNode,
4755
+ Yn as InsertNode,
4756
+ qn as LinkNode,
4757
+ Ir as ListItemNode,
4758
+ Gn as ListNode,
4759
+ oo as MERMAID_WORKER_BUSY_CODE,
4760
+ pi as MarkdownCodeBlockNode,
4761
+ eo as MathBlockNode,
4762
+ to as MathInlineNode,
4763
+ Hr as MermaidBlockNode,
4764
+ Vo as NodeRenderer,
4765
+ Mo as ParagraphNode,
4766
+ er as PreCodeNode,
4767
+ Bn as ReactCodeBlockNode,
4768
+ Eo as ReferenceNode,
4769
+ To as StrikethroughNode,
4770
+ Ro as StrongNode,
4771
+ So as SubscriptNode,
4772
+ No as SuperscriptNode,
4773
+ _o as TableNode,
4774
+ Cr as TextNode,
4775
+ Lo as ThematicBreakNode,
4776
+ wi as Tooltip,
4777
+ Bo as VmrContainerNode,
4778
+ Kt as WORKER_BUSY_CODE,
4779
+ ao as canParseOffthread,
4780
+ ti as clearGlobalCustomComponents,
4781
+ si as clearKaTeXCache,
4782
+ ii as clearKaTeXWorker,
4783
+ gi as clearMermaidWorker,
4784
+ so as findPrefixOffthread,
4785
+ cr as getCustomNodeComponents,
4786
+ ui as getKaTeXBackpressureDefaults,
4787
+ ur as getLanguageIcon,
4788
+ fi as getMermaidWorkerLoad,
4789
+ Qt as languageMap,
4790
+ ft as normalizeLanguageIdentifier,
4791
+ ei as removeCustomComponents,
4792
+ Zn as renderKaTeXInWorker,
4793
+ $r as renderKaTeXWithBackpressure,
4794
+ Re as renderNode,
4795
+ wr as resolveMonacoLanguageId,
4796
+ Qo as setCustomComponents,
4797
+ ri as setDefaultI18nMap,
4798
+ li as setKaTeXBackpressureDefaults,
4799
+ Or as setKaTeXCache,
4800
+ ci as setKaTeXConcurrencyLimit,
4801
+ oi as setKaTeXWorker,
4802
+ ai as setKaTeXWorkerDebug,
4803
+ ni as setLanguageIconResolver,
4804
+ hi as setMermaidWorker,
4805
+ di as setMermaidWorkerClientDebug,
4806
+ mi as setMermaidWorkerMaxConcurrency,
4807
+ co as terminateWorker,
4808
+ lr as useSafeI18n,
4809
+ Qn as waitForKaTeXWorkerSlot
4810
+ };