markstream-angular 0.0.1-alpha.0 → 0.0.1-alpha.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.
Files changed (36) hide show
  1. package/dist/index.js +459 -459
  2. package/dist/types/components/AdmonitionNode/AdmonitionNode.component.d.ts +1 -1
  3. package/dist/types/components/BlockquoteNode/BlockquoteNode.component.d.ts +1 -1
  4. package/dist/types/components/CodeBlockNode/CodeBlockNode.component.d.ts +1 -1
  5. package/dist/types/components/D2BlockNode/D2BlockNode.component.d.ts +1 -1
  6. package/dist/types/components/DefinitionListNode/DefinitionListNode.component.d.ts +1 -1
  7. package/dist/types/components/DynamicNodeHost/DynamicNodeHost.component.d.ts +2 -2
  8. package/dist/types/components/EmphasisNode/EmphasisNode.component.d.ts +1 -1
  9. package/dist/types/components/FallbackComponent/FallbackComponent.component.d.ts +1 -1
  10. package/dist/types/components/FootnoteNode/FootnoteNode.component.d.ts +1 -1
  11. package/dist/types/components/HeadingNode/HeadingNode.component.d.ts +1 -1
  12. package/dist/types/components/HighlightNode/HighlightNode.component.d.ts +1 -1
  13. package/dist/types/components/HtmlBlockNode/HtmlBlockNode.component.d.ts +1 -1
  14. package/dist/types/components/HtmlInlineNode/HtmlInlineNode.component.d.ts +1 -1
  15. package/dist/types/components/InfographicBlockNode/InfographicBlockNode.component.d.ts +1 -1
  16. package/dist/types/components/InsertNode/InsertNode.component.d.ts +1 -1
  17. package/dist/types/components/LinkNode/LinkNode.component.d.ts +1 -1
  18. package/dist/types/components/ListItemNode/ListItemNode.component.d.ts +1 -1
  19. package/dist/types/components/ListNode/ListNode.component.d.ts +1 -1
  20. package/dist/types/components/MermaidBlockNode/MermaidBlockNode.component.d.ts +1 -1
  21. package/dist/types/components/NestedRenderer/NestedRenderer.component.d.ts +1 -1
  22. package/dist/types/components/NodeOutlet/NodeOutlet.component.d.ts +1 -1
  23. package/dist/types/components/NodeRenderer/NodeRenderer.component.d.ts +1 -1
  24. package/dist/types/components/ParagraphNode/ParagraphNode.component.d.ts +1 -1
  25. package/dist/types/components/StrikethroughNode/StrikethroughNode.component.d.ts +1 -1
  26. package/dist/types/components/StrongNode/StrongNode.component.d.ts +1 -1
  27. package/dist/types/components/SubscriptNode/SubscriptNode.component.d.ts +1 -1
  28. package/dist/types/components/SuperscriptNode/SuperscriptNode.component.d.ts +1 -1
  29. package/dist/types/components/TableNode/TableNode.component.d.ts +1 -1
  30. package/dist/types/components/VmrContainerNode/VmrContainerNode.component.d.ts +1 -1
  31. package/dist/types/components/shared/node-helpers.d.ts +1 -1
  32. package/dist/types/components/shared/node-outlet-helpers.d.ts +1 -1
  33. package/dist/types/index.d.ts +12 -12
  34. package/dist/types/renderMarkdownHtml.d.ts +1 -1
  35. package/dist/types/workers/katexWorkerClient.d.ts +1 -1
  36. package/package.json +8 -7
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CommonModule as S } from "@angular/common";
2
- import { inject as Q, ElementRef as so, Renderer2 as mi, Input as l, Directive as fi, Component as b, ChangeDetectionStrategy as k, forwardRef as p, ChangeDetectorRef as Oe, ViewChild as j, ViewContainerRef as pi, HostListener as ao, EventEmitter as ct, Output as kt } from "@angular/core";
2
+ import { Input as l, Component as b, ChangeDetectionStrategy as k, forwardRef as p, inject as Q, ChangeDetectorRef as Oe, ViewChild as j, ViewContainerRef as mi, ElementRef as so, Renderer2 as fi, Directive as pi, HostListener as ao, EventEmitter as ct, Output as kt } from "@angular/core";
3
3
  import { parseMarkdownToStructure as Xr, getMarkdown as Gr } from "stream-markdown-parser";
4
- const Et = /<\/?([A-Z][\w:-]*)(?:\s[^<>]*?)?>/gi;
4
+ const Et = /<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;
5
5
  function Zr(e, t, r) {
6
6
  const o = bi(r), n = new Set(o);
7
7
  if (!t || n.size === 0 || !Array.isArray(e) || e.length === 0)
@@ -173,7 +173,55 @@ function Si(e) {
173
173
  function Mi(e) {
174
174
  return Array.isArray(e) ? e : [];
175
175
  }
176
- const On = /* @__PURE__ */ new Map(), Oi = /* @__PURE__ */ new Set([
176
+ const er = "__global__", Dr = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__", X = (() => {
177
+ const e = globalThis;
178
+ if (e[Dr])
179
+ return e[Dr];
180
+ const t = {
181
+ scopedComponents: {},
182
+ revision: 0,
183
+ listeners: /* @__PURE__ */ new Set()
184
+ };
185
+ return e[Dr] = t, t;
186
+ })();
187
+ function Jr() {
188
+ X.revision += 1;
189
+ for (const e of Array.from(X.listeners))
190
+ try {
191
+ e();
192
+ } catch {
193
+ }
194
+ }
195
+ function Oi(e) {
196
+ return X.listeners.add(e), () => {
197
+ X.listeners.delete(e);
198
+ };
199
+ }
200
+ function nd() {
201
+ return X.revision;
202
+ }
203
+ function od(e, t) {
204
+ typeof e == "string" ? X.scopedComponents[e] = { ...t || {} } : X.scopedComponents[er] = { ...e }, Jr();
205
+ }
206
+ function lo(e) {
207
+ const t = X.scopedComponents[er] || {};
208
+ if (!e)
209
+ return t;
210
+ const r = X.scopedComponents[e] || {};
211
+ return !t || Object.keys(t).length === 0 ? r : !r || Object.keys(r).length === 0 ? t : {
212
+ ...t,
213
+ ...r
214
+ };
215
+ }
216
+ function id(e) {
217
+ if (e === er)
218
+ throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");
219
+ delete X.scopedComponents[e], Jr();
220
+ }
221
+ function sd() {
222
+ delete X.scopedComponents[er], Jr();
223
+ }
224
+ const On = /* @__PURE__ */ new Map(), Ei = /* @__PURE__ */ new Set([
177
225
  "image",
178
226
  "table",
179
227
  "code_block",
@@ -192,8 +240,8 @@ const On = /* @__PURE__ */ new Map(), Oi = /* @__PURE__ */ new Set([
192
240
  "thinking",
193
241
  "vmr_container"
194
242
  ]);
195
- function Ei(e, t = {}) {
196
- const r = lo([
243
+ function Di(e, t = {}) {
244
+ const r = co([
197
245
  ...e.customHtmlTags || [],
198
246
  ...e.parseOptions?.customHtmlTags || []
199
247
  ]);
@@ -226,13 +274,13 @@ function Ei(e, t = {}) {
226
274
  events: t
227
275
  };
228
276
  }
229
- function Di(e) {
277
+ function Ri(e) {
230
278
  if (Array.isArray(e.nodes))
231
279
  return e.nodes;
232
280
  const t = C(e.content);
233
281
  if (!t)
234
282
  return [];
235
- const r = lo([
283
+ const r = co([
236
284
  ...e.customHtmlTags || [],
237
285
  ...e.parseOptions?.customHtmlTags || []
238
286
  ]), o = `${e.customId || "markstream-angular"}::${r.join(",")}`;
@@ -253,174 +301,74 @@ function I(e) {
253
301
  function C(e) {
254
302
  return typeof e == "string" ? e : e == null ? "" : String(e);
255
303
  }
256
- function lo(e) {
304
+ function co(e) {
257
305
  if (!e || e.length === 0)
258
306
  return [];
259
307
  const t = /* @__PURE__ */ new Set(), r = [];
260
308
  for (const o of e) {
261
- const n = Ri(o);
309
+ const n = Ii(o);
262
310
  !n || t.has(n) || (t.add(n), r.push(n));
263
311
  }
264
312
  return r;
265
313
  }
266
- function Ri(e) {
314
+ function Ii(e) {
267
315
  const t = C(e).trim();
268
316
  if (!t)
269
317
  return "";
270
318
  const r = t.match(/^[<\s/]*([A-Z][\w:-]*)/i);
271
319
  return r ? r[1].toLowerCase() : "";
272
320
  }
273
- function Jr(e) {
321
+ function Qr(e) {
274
322
  return /^[^\s"'<>`=]+$/.test(e) && !/^on/i.test(e);
275
323
  }
276
- function Qr(e) {
324
+ function en(e) {
277
325
  return C(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
278
326
  }
279
- function Ii(e) {
280
- return Qr(e).replace(/`/g, "&#96;");
327
+ function $i(e) {
328
+ return en(e).replace(/`/g, "&#96;");
281
329
  }
282
- function co(e) {
330
+ function uo(e) {
283
331
  return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
284
332
  }
285
- function $i(e) {
333
+ function Ai(e) {
286
334
  const t = Math.trunc(Number(e) || 1);
287
335
  return Math.min(6, Math.max(1, t));
288
336
  }
289
- function Ai(e) {
337
+ function Ni(e) {
290
338
  return e ? `${e[0].toUpperCase()}${e.slice(1)}` : "";
291
339
  }
292
- function Ni(e) {
340
+ function Li(e) {
293
341
  const r = String(e ?? "").match(/^\s*<\s*([A-Z][\w:-]*)/i);
294
342
  return r ? r[1].toLowerCase() : "";
295
343
  }
296
- function Li(e, t) {
344
+ function Bi(e, t) {
297
345
  const r = String(e ?? "");
298
346
  if (!t)
299
347
  return r;
300
348
  const o = new RegExp(String.raw`^\s*<\s*${t}(?:\s[^>]*)?>\s*`, "i"), n = new RegExp(String.raw`\s*<\s*\/\s*${t}\s*>\s*$`, "i");
301
349
  return r.replace(o, "").replace(n, "");
302
350
  }
303
- function uo(e) {
351
+ function ho(e) {
304
352
  return String(String(e ?? "").split(/\s+/g)[0] ?? "").toLowerCase().replace(/[^\w-]/g, "") || "plaintext";
305
353
  }
306
- function Bi(e) {
307
- return uo(e?.language);
308
- }
309
354
  function Hi(e) {
310
- return !Array.isArray(e) || e.length === 0 ? null : e.reduce((t, [r, o]) => (!r || !Jr(r) || (t[r] = o ?? !0), t), {});
355
+ return ho(e?.language);
311
356
  }
312
357
  function Fi(e) {
358
+ return !Array.isArray(e) || e.length === 0 ? null : e.reduce((t, [r, o]) => (!r || !Qr(r) || (t[r] = o ?? !0), t), {});
359
+ }
360
+ function Ki(e) {
313
361
  const t = [], r = [], o = () => {
314
362
  r.length && (t.push({ kind: "inline", nodes: r.slice() }), r.length = 0);
315
363
  };
316
364
  for (const n of e)
317
- Oi.has(String(n?.type || "")) ? (o(), t.push({ kind: "block", node: n })) : r.push(n);
365
+ Ei.has(String(n?.type || "")) ? (o(), t.push({ kind: "block", node: n })) : r.push(n);
318
366
  return o(), t;
319
367
  }
320
- var Ki = Object.defineProperty, ji = Object.getOwnPropertyDescriptor, ho = (e, t, r, o) => {
321
- for (var n = o > 1 ? void 0 : o ? ji(t, r) : t, i = e.length - 1, s; i >= 0; i--)
322
- (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
323
- return o && n && Ki(t, r, n), n;
324
- };
325
- let pt = class {
326
- constructor() {
327
- this.elementRef = Q(so), this.renderer = Q(mi), this.appliedAttrs = /* @__PURE__ */ new Set(), this.appliedClasses = /* @__PURE__ */ new Set(), this.appliedStyles = /* @__PURE__ */ new Set();
328
- }
329
- ngOnChanges() {
330
- this.clearAppliedState();
331
- const e = this.markstreamSafeAttrs;
332
- if (e) {
333
- for (const [t, r] of Object.entries(e))
334
- if (Jr(t)) {
335
- if (t === "class" || t === "className") {
336
- for (const o of String(r || "").split(/\s+/g).map((n) => n.trim()).filter(Boolean))
337
- this.renderer.addClass(this.elementRef.nativeElement, o), this.appliedClasses.add(o);
338
- continue;
339
- }
340
- if (t === "style" && r && typeof r == "object") {
341
- for (const [o, n] of Object.entries(r))
342
- this.renderer.setStyle(this.elementRef.nativeElement, o, n), this.appliedStyles.add(o);
343
- continue;
344
- }
345
- r === !1 || r == null || (this.renderer.setAttribute(
346
- this.elementRef.nativeElement,
347
- t,
348
- r === !0 ? "" : String(r)
349
- ), this.appliedAttrs.add(t));
350
- }
351
- }
352
- }
353
- clearAppliedState() {
354
- for (const e of this.appliedAttrs)
355
- this.renderer.removeAttribute(this.elementRef.nativeElement, e);
356
- for (const e of this.appliedClasses)
357
- this.renderer.removeClass(this.elementRef.nativeElement, e);
358
- for (const e of this.appliedStyles)
359
- this.renderer.removeStyle(this.elementRef.nativeElement, e);
360
- this.appliedAttrs.clear(), this.appliedClasses.clear(), this.appliedStyles.clear();
361
- }
362
- };
363
- ho([
364
- l()
365
- ], pt.prototype, "markstreamSafeAttrs", 2);
366
- pt = ho([
367
- fi({
368
- selector: "[markstreamSafeAttrs]",
369
- standalone: !0
370
- })
371
- ], pt);
372
- const er = "__global__", Dr = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__", X = (() => {
373
- const e = globalThis;
374
- if (e[Dr])
375
- return e[Dr];
376
- const t = {
377
- scopedComponents: {},
378
- revision: 0,
379
- listeners: /* @__PURE__ */ new Set()
380
- };
381
- return e[Dr] = t, t;
382
- })();
383
- function en() {
384
- X.revision += 1;
385
- for (const e of Array.from(X.listeners))
386
- try {
387
- e();
388
- } catch {
389
- }
390
- }
391
- function zi(e) {
392
- return X.listeners.add(e), () => {
393
- X.listeners.delete(e);
394
- };
395
- }
396
- function nd() {
397
- return X.revision;
398
- }
399
- function od(e, t) {
400
- typeof e == "string" ? X.scopedComponents[e] = { ...t || {} } : X.scopedComponents[er] = { ...e }, en();
401
- }
402
- function mo(e) {
403
- const t = X.scopedComponents[er] || {};
404
- if (!e)
405
- return t;
406
- const r = X.scopedComponents[e] || {};
407
- return !t || Object.keys(t).length === 0 ? r : !r || Object.keys(r).length === 0 ? t : {
408
- ...t,
409
- ...r
410
- };
411
- }
412
- function id(e) {
413
- if (e === er)
414
- throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");
415
- delete X.scopedComponents[e], en();
416
- }
417
- function sd() {
418
- delete X.scopedComponents[er], en();
419
- }
420
- var Wi = Object.defineProperty, qi = Object.getOwnPropertyDescriptor, tr = (e, t, r, o) => {
421
- for (var n = o > 1 ? void 0 : o ? qi(t, r) : t, i = e.length - 1, s; i >= 0; i--)
368
+ var ji = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, tr = (e, t, r, o) => {
369
+ for (var n = o > 1 ? void 0 : o ? zi(t, r) : t, i = e.length - 1, s; i >= 0; i--)
422
370
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
423
- return o && n && Wi(t, r, n), n;
371
+ return o && n && ji(t, r, n), n;
424
372
  };
425
373
  let Ke = class {
426
374
  get children() {
@@ -467,20 +415,20 @@ Ke = tr([
467
415
  changeDetection: k.OnPush
468
416
  })
469
417
  ], Ke);
470
- var Vi = Object.defineProperty, Ui = Object.getOwnPropertyDescriptor, fo = (e, t, r, o) => {
471
- for (var n = o > 1 ? void 0 : o ? Ui(t, r) : t, i = e.length - 1, s; i >= 0; i--)
418
+ var Wi = Object.defineProperty, qi = Object.getOwnPropertyDescriptor, mo = (e, t, r, o) => {
419
+ for (var n = o > 1 ? void 0 : o ? qi(t, r) : t, i = e.length - 1, s; i >= 0; i--)
472
420
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
473
- return o && n && Vi(t, r, n), n;
421
+ return o && n && Wi(t, r, n), n;
474
422
  };
475
423
  let Ft = class {
476
424
  get checked() {
477
425
  return !!this.node?.checked;
478
426
  }
479
427
  };
480
- fo([
428
+ mo([
481
429
  l({ required: !0 })
482
430
  ], Ft.prototype, "node", 2);
483
- Ft = fo([
431
+ Ft = mo([
484
432
  b({
485
433
  selector: "markstream-angular-checkbox-node",
486
434
  standalone: !0,
@@ -488,43 +436,10 @@ Ft = fo([
488
436
  changeDetection: k.OnPush
489
437
  })
490
438
  ], Ft);
491
- var Xi = Object.defineProperty, Gi = Object.getOwnPropertyDescriptor, po = (e, t, r, o) => {
492
- for (var n = o > 1 ? void 0 : o ? Gi(t, r) : t, i = e.length - 1, s; i >= 0; i--)
493
- (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
494
- return o && n && Xi(t, r, n), n;
495
- };
496
- let gt = class {
497
- get language() {
498
- return uo(this.node?.language);
499
- }
500
- get languageClass() {
501
- return `language-${this.language}`;
502
- }
503
- get ariaLabel() {
504
- return this.language ? `Code block: ${this.language}` : "Code block";
505
- }
506
- get code() {
507
- return C(this.node?.code);
508
- }
509
- get loading() {
510
- return this.node?.loading === !0;
511
- }
512
- };
513
- po([
514
- l({ required: !0 })
515
- ], gt.prototype, "node", 2);
516
- gt = po([
517
- b({
518
- selector: "markstream-angular-pre-code-node",
519
- standalone: !0,
520
- template: '<pre [class]="languageClass" [attr.aria-busy]="loading" [attr.aria-label]="ariaLabel" [attr.data-language]="language" tabindex="0"><code translate="no" [textContent]="code"></code></pre>',
521
- changeDetection: k.OnPush
522
- })
523
- ], gt);
524
- function Zi(e) {
439
+ function Vi(e) {
525
440
  return (e.split(".").pop() || e).replace(/[_-]/g, " ").replace(/([A-Z])/g, " $1").replace(/\s+/g, " ").replace(/\b\w/g, (r) => r.toUpperCase()).trim();
526
441
  }
527
- const go = {
442
+ const fo = {
528
443
  "common.copy": "Copy",
529
444
  "common.copied": "Copied",
530
445
  "common.decrease": "Decrease",
@@ -544,119 +459,24 @@ const go = {
544
459
  "artifacts.svgPreviewTitle": "SVG Preview"
545
460
  };
546
461
  function ad(e) {
547
- Object.assign(go, e);
548
- }
549
- function yo() {
550
- return {
551
- t(e) {
552
- return go[e] ?? Zi(e);
553
- }
554
- };
555
- }
556
- var Yi = Object.defineProperty, Ji = Object.getOwnPropertyDescriptor, xt = (e, t, r, o) => {
557
- for (var n = o > 1 ? void 0 : o ? Ji(t, r) : t, i = e.length - 1, s; i >= 0; i--)
558
- (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
559
- return o && n && Yi(t, r, n), n;
560
- };
561
- let xe = class {
562
- constructor() {
563
- this.code = "", this.isDark = !1, this.i18n = yo();
564
- }
565
- get resolvedTitle() {
566
- return this.title || `HTML ${this.i18n.t("common.preview")}`;
567
- }
568
- get srcdoc() {
569
- const e = this.code || "", t = e.trim().toLowerCase();
570
- if (t.startsWith("<!doctype") || t.startsWith("<html") || t.startsWith("<body"))
571
- return e;
572
- const r = this.isDark ? "#020617" : "#ffffff", o = this.isDark ? "#e5e7eb" : "#020617";
573
- return `<!doctype html>
574
- <html lang="en">
575
- <head>
576
- <meta charset="utf-8" />
577
- <meta name="viewport" content="width=device-width, initial-scale=1" />
578
- <style>
579
- html, body {
580
- margin: 0;
581
- padding: 0;
582
- height: 100%;
583
- background-color: ${r};
584
- color: ${o};
585
- }
586
- body {
587
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;
588
- }
589
- </style>
590
- </head>
591
- <body>
592
- ${e}
593
- </body>
594
- </html>`;
595
- }
596
- };
597
- xt([
598
- l()
599
- ], xe.prototype, "code", 2);
600
- xt([
601
- l()
602
- ], xe.prototype, "isDark", 2);
603
- xt([
604
- l()
605
- ], xe.prototype, "title", 2);
606
- xt([
607
- l()
608
- ], xe.prototype, "onClose", 2);
609
- xe = xt([
610
- b({
611
- selector: "markstream-angular-html-preview-frame",
612
- standalone: !0,
613
- imports: [S],
614
- template: `
615
- <div
616
- class="html-preview-frame__backdrop"
617
- [class.html-preview-frame__backdrop--dark]="isDark"
618
- (click)="onClose?.()"
619
- >
620
- <div
621
- class="html-preview-frame"
622
- [class.html-preview-frame--dark]="isDark"
623
- (click)="$event.stopPropagation()"
624
- >
625
- <div class="html-preview-frame__header">
626
- <div class="html-preview-frame__title">
627
- <span class="html-preview-frame__dot"></span>
628
- <span class="html-preview-frame__label">{{ resolvedTitle }}</span>
629
- </div>
630
- <button
631
- type="button"
632
- class="html-preview-frame__close"
633
- [class.html-preview-frame__close--dark]="isDark"
634
- (click)="onClose?.()"
635
- >
636
- ×
637
- </button>
638
- </div>
639
- <iframe
640
- class="html-preview-frame__iframe"
641
- sandbox="allow-scripts allow-same-origin"
642
- [srcdoc]="srcdoc"
643
- [title]="resolvedTitle"
644
- ></iframe>
645
- </div>
646
- </div>
647
- `,
648
- changeDetection: k.OnPush
649
- })
650
- ], xe);
462
+ Object.assign(fo, e);
463
+ }
464
+ function po() {
465
+ return {
466
+ t(e) {
467
+ return fo[e] ?? Vi(e);
468
+ }
469
+ };
470
+ }
651
471
  let fe = null, Rr = !1, dt = null, En = !1;
652
- async function Qi(e) {
472
+ async function Ui(e) {
653
473
  if (En)
654
474
  return;
655
475
  En = !0;
656
476
  const t = globalThis?.MonacoEnvironment;
657
477
  t && (typeof t.getWorker == "function" || typeof t.getWorkerUrl == "function") || typeof e?.preloadMonacoWorkers == "function" && await e.preloadMonacoWorkers();
658
478
  }
659
- async function es(e) {
479
+ async function Xi(e) {
660
480
  const t = e?.getOrCreateHighlighter;
661
481
  if (typeof t != "function")
662
482
  return !0;
@@ -670,7 +490,7 @@ async function es(e) {
670
490
  return console.warn("[markstream-angular] Failed to warm up stream-monaco tokenizer; falling back to plain code rendering.", r), !1;
671
491
  }
672
492
  }
673
- async function vo() {
493
+ async function go() {
674
494
  if (fe)
675
495
  return fe;
676
496
  if (dt)
@@ -680,7 +500,7 @@ async function vo() {
680
500
  dt = (async () => {
681
501
  try {
682
502
  const e = await import("stream-monaco");
683
- return fe = e?.default ?? e, await Qi(fe), await es(fe) ? fe : (fe = null, Rr = !0, null);
503
+ return fe = e?.default ?? e, await Ui(fe), await Xi(fe) ? fe : (fe = null, Rr = !0, null);
684
504
  } catch {
685
505
  return Rr = !0, null;
686
506
  }
@@ -697,7 +517,7 @@ const ge = `
697
517
  <path d="M8 11l-3 3l3 3" />
698
518
  <path d="M16 11l3 3l-3 3" />
699
519
  <path d="M13 9l-2 10" />
700
- </svg>`, ts = `
520
+ </svg>`, Gi = `
701
521
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
702
522
  <rect x="3" y="4" width="7" height="5" rx="1.5" />
703
523
  <rect x="14" y="4" width="7" height="5" rx="1.5" />
@@ -711,13 +531,13 @@ const ge = `
711
531
  <path d="M8 7l-4 5l4 5" />
712
532
  <path d="M16 7l4 5l-4 5" />
713
533
  <path d="M14 4l-4 16" />
714
- </svg>`, rs = `
534
+ </svg>`, Zi = `
715
535
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
716
536
  <rect x="3" y="4" width="18" height="16" rx="2" />
717
537
  <path d="M7 15V9l3 3l3-3v6" />
718
538
  <path d="M16 9v6" />
719
539
  <path d="M14 13l2 2l2-2" />
720
- </svg>`, ns = `
540
+ </svg>`, Yi = `
721
541
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
722
542
  <path d="M9 4c-2 0-3 1.5-3 3.5v2c0 1.1-.4 1.8-1.5 2.5C5.6 12.7 6 13.4 6 14.5v2C6 18.5 7 20 9 20" />
723
543
  <path d="M15 4c2 0 3 1.5 3 3.5v2c0 1.1.4 1.8 1.5 2.5c-1.1.7-1.5 1.4-1.5 2.5v2c0 2-1 3.5-3 3.5" />
@@ -726,7 +546,7 @@ const ge = `
726
546
  <path d="M5 6h14" />
727
547
  <path d="M12 6v12" />
728
548
  <path d="M8 18h8" />
729
- </svg>`, os = {
549
+ </svg>`, Ji = {
730
550
  "": "",
731
551
  cjs: "javascript",
732
552
  d2lang: "d2",
@@ -741,7 +561,7 @@ const ge = `
741
561
  text: "plain",
742
562
  ts: "typescript",
743
563
  tsx: "tsx"
744
- }, is = {
564
+ }, Qi = {
745
565
  "": "Text",
746
566
  css: "CSS",
747
567
  d2: "D2",
@@ -759,14 +579,14 @@ const ge = `
759
579
  tsx: "TSX",
760
580
  typescript: "TypeScript",
761
581
  vue: "Vue"
762
- }, ss = {
582
+ }, es = {
763
583
  "": Rn,
764
584
  html: Dn,
765
585
  javascript: ge,
766
- json: ns,
586
+ json: Yi,
767
587
  jsx: ge,
768
- markdown: rs,
769
- mermaid: ts,
588
+ markdown: Zi,
589
+ mermaid: Gi,
770
590
  plain: Rn,
771
591
  python: ge,
772
592
  shell: ge,
@@ -775,7 +595,7 @@ const ge = `
775
595
  typescript: ge
776
596
  };
777
597
  let Br = null;
778
- function as(e) {
598
+ function ts(e) {
779
599
  if (!e)
780
600
  return "";
781
601
  const t = e.trim();
@@ -785,34 +605,162 @@ function as(e) {
785
605
  return o.toLowerCase();
786
606
  }
787
607
  function tn(e) {
788
- const t = as(e);
789
- return os[t] ?? t;
608
+ const t = ts(e);
609
+ return Ji[t] ?? t;
790
610
  }
791
- function ls(e) {
611
+ function rs(e) {
792
612
  const t = tn(e);
793
613
  return !t || t === "plain" ? "plaintext" : t === "jsx" ? "javascript" : t === "tsx" ? "typescript" : t;
794
614
  }
795
615
  function ld(e) {
796
616
  Br = e ?? null;
797
617
  }
798
- function cs(e) {
618
+ function ns(e) {
799
619
  if (Br) {
800
620
  const r = Br(e);
801
621
  if (r != null && r !== "")
802
622
  return r;
803
623
  }
804
624
  const t = tn(e);
805
- return ss[t] || ge;
625
+ return es[t] || ge;
806
626
  }
807
- const ds = is;
808
- var us = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, Ct = (e, t, r, o) => {
809
- for (var n = o > 1 ? void 0 : o ? hs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
627
+ const os = Qi;
628
+ var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, yo = (e, t, r, o) => {
629
+ for (var n = o > 1 ? void 0 : o ? ss(t, r) : t, i = e.length - 1, s; i >= 0; i--)
630
+ (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
631
+ return o && n && is(t, r, n), n;
632
+ };
633
+ let pt = class {
634
+ get language() {
635
+ return ho(this.node?.language);
636
+ }
637
+ get languageClass() {
638
+ return `language-${this.language}`;
639
+ }
640
+ get ariaLabel() {
641
+ return this.language ? `Code block: ${this.language}` : "Code block";
642
+ }
643
+ get code() {
644
+ return C(this.node?.code);
645
+ }
646
+ get loading() {
647
+ return this.node?.loading === !0;
648
+ }
649
+ };
650
+ yo([
651
+ l({ required: !0 })
652
+ ], pt.prototype, "node", 2);
653
+ pt = yo([
654
+ b({
655
+ selector: "markstream-angular-pre-code-node",
656
+ standalone: !0,
657
+ template: '<pre [class]="languageClass" [attr.aria-busy]="loading" [attr.aria-label]="ariaLabel" [attr.data-language]="language" tabindex="0"><code translate="no" [textContent]="code"></code></pre>',
658
+ changeDetection: k.OnPush
659
+ })
660
+ ], pt);
661
+ var as = Object.defineProperty, ls = Object.getOwnPropertyDescriptor, xt = (e, t, r, o) => {
662
+ for (var n = o > 1 ? void 0 : o ? ls(t, r) : t, i = e.length - 1, s; i >= 0; i--)
663
+ (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
664
+ return o && n && as(t, r, n), n;
665
+ };
666
+ let xe = class {
667
+ constructor() {
668
+ this.code = "", this.isDark = !1, this.i18n = po();
669
+ }
670
+ get resolvedTitle() {
671
+ return this.title || `HTML ${this.i18n.t("common.preview")}`;
672
+ }
673
+ get srcdoc() {
674
+ const e = this.code || "", t = e.trim().toLowerCase();
675
+ if (t.startsWith("<!doctype") || t.startsWith("<html") || t.startsWith("<body"))
676
+ return e;
677
+ const r = this.isDark ? "#020617" : "#ffffff", o = this.isDark ? "#e5e7eb" : "#020617";
678
+ return `<!doctype html>
679
+ <html lang="en">
680
+ <head>
681
+ <meta charset="utf-8" />
682
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
683
+ <style>
684
+ html, body {
685
+ margin: 0;
686
+ padding: 0;
687
+ height: 100%;
688
+ background-color: ${r};
689
+ color: ${o};
690
+ }
691
+ body {
692
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;
693
+ }
694
+ </style>
695
+ </head>
696
+ <body>
697
+ ${e}
698
+ </body>
699
+ </html>`;
700
+ }
701
+ };
702
+ xt([
703
+ l()
704
+ ], xe.prototype, "code", 2);
705
+ xt([
706
+ l()
707
+ ], xe.prototype, "isDark", 2);
708
+ xt([
709
+ l()
710
+ ], xe.prototype, "title", 2);
711
+ xt([
712
+ l()
713
+ ], xe.prototype, "onClose", 2);
714
+ xe = xt([
715
+ b({
716
+ selector: "markstream-angular-html-preview-frame",
717
+ standalone: !0,
718
+ imports: [S],
719
+ template: `
720
+ <div
721
+ class="html-preview-frame__backdrop"
722
+ [class.html-preview-frame__backdrop--dark]="isDark"
723
+ (click)="onClose?.()"
724
+ >
725
+ <div
726
+ class="html-preview-frame"
727
+ [class.html-preview-frame--dark]="isDark"
728
+ (click)="$event.stopPropagation()"
729
+ >
730
+ <div class="html-preview-frame__header">
731
+ <div class="html-preview-frame__title">
732
+ <span class="html-preview-frame__dot"></span>
733
+ <span class="html-preview-frame__label">{{ resolvedTitle }}</span>
734
+ </div>
735
+ <button
736
+ type="button"
737
+ class="html-preview-frame__close"
738
+ [class.html-preview-frame__close--dark]="isDark"
739
+ (click)="onClose?.()"
740
+ >
741
+ ×
742
+ </button>
743
+ </div>
744
+ <iframe
745
+ class="html-preview-frame__iframe"
746
+ sandbox="allow-scripts allow-same-origin"
747
+ [srcdoc]="srcdoc"
748
+ [title]="resolvedTitle"
749
+ ></iframe>
750
+ </div>
751
+ </div>
752
+ `,
753
+ changeDetection: k.OnPush
754
+ })
755
+ ], xe);
756
+ var cs = Object.defineProperty, ds = Object.getOwnPropertyDescriptor, Ct = (e, t, r, o) => {
757
+ for (var n = o > 1 ? void 0 : o ? ds(t, r) : t, i = e.length - 1, s; i >= 0; i--)
810
758
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
811
- return o && n && us(t, r, n), n;
759
+ return o && n && cs(t, r, n), n;
812
760
  };
813
761
  let Ce = class {
814
762
  constructor() {
815
- this.cdr = Q(Oe), this.i18n = yo(), this.useFallback = !1, this.copied = !1, this.collapsed = !1, this.expanded = !1, this.inlinePreviewOpen = !1, this.editorReady = !1, this.defaultFontSize = 14, this.fontSize = 14, this.helpers = null, this.createPromise = null, this.syncPromise = null, this.editorKind = null, this.viewReady = !1, this.destroyed = !1, this.copyTimer = null, this.closeInlinePreview = () => {
763
+ this.cdr = Q(Oe), this.i18n = po(), this.useFallback = !1, this.copied = !1, this.collapsed = !1, this.expanded = !1, this.inlinePreviewOpen = !1, this.editorReady = !1, this.defaultFontSize = 14, this.fontSize = 14, this.helpers = null, this.createPromise = null, this.syncPromise = null, this.editorKind = null, this.viewReady = !1, this.destroyed = !1, this.copyTimer = null, this.closeInlinePreview = () => {
816
764
  this.inlinePreviewOpen = !1, this.cdr.markForCheck();
817
765
  };
818
766
  }
@@ -886,14 +834,14 @@ let Ce = class {
886
834
  return tn(this.rawLanguage) || "plain";
887
835
  }
888
836
  get monacoLanguage() {
889
- return ls(this.rawLanguage);
837
+ return rs(this.rawLanguage);
890
838
  }
891
839
  get displayLanguage() {
892
- const e = ds[this.canonicalLanguage] || this.canonicalLanguage;
840
+ const e = os[this.canonicalLanguage] || this.canonicalLanguage;
893
841
  return e ? e.charAt(0).toUpperCase() + e.slice(1) : "Text";
894
842
  }
895
843
  get languageIconDataUrl() {
896
- const e = cs(this.rawLanguage).trim(), t = e.includes("xmlns=") ? e : e.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"');
844
+ const e = ns(this.rawLanguage).trim(), t = e.includes("xmlns=") ? e : e.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"');
897
845
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`;
898
846
  }
899
847
  get resolvedCode() {
@@ -1017,7 +965,7 @@ let Ce = class {
1017
965
  if (this.createPromise)
1018
966
  return this.createPromise;
1019
967
  this.createPromise = (async () => {
1020
- const e = await vo();
968
+ const e = await go();
1021
969
  if (!e || typeof e.useMonaco != "function") {
1022
970
  this.useFallback = !0;
1023
971
  return;
@@ -1163,7 +1111,7 @@ Ce = Ct([
1163
1111
  b({
1164
1112
  selector: "markstream-angular-code-block-node",
1165
1113
  standalone: !0,
1166
- imports: [S, gt, xe],
1114
+ imports: [S, pt, xe],
1167
1115
  template: `
1168
1116
  <div
1169
1117
  class="code-block-container"
@@ -1342,10 +1290,10 @@ Ce = Ct([
1342
1290
  ], Ce);
1343
1291
  const rn = () => import("@terrastruct/d2");
1344
1292
  let ut = null, nn = rn, Ae = null;
1345
- function ms() {
1293
+ function us() {
1346
1294
  ut = null, Ae = null;
1347
1295
  }
1348
- function fs(e) {
1296
+ function hs(e) {
1349
1297
  if (!e)
1350
1298
  return e;
1351
1299
  if (e.D2 && typeof e.D2 == "function")
@@ -1355,19 +1303,19 @@ function fs(e) {
1355
1303
  const t = e.default ?? e;
1356
1304
  return typeof t == "function" ? t : t?.D2 && typeof t.D2 == "function" ? t.D2 : t;
1357
1305
  }
1358
- function wo(e) {
1359
- nn = e, ms();
1306
+ function vo(e) {
1307
+ nn = e, us();
1360
1308
  }
1361
1309
  function cd(e) {
1362
- wo(e ?? rn);
1310
+ vo(e ?? rn);
1363
1311
  }
1364
1312
  function dd() {
1365
- wo(null);
1313
+ vo(null);
1366
1314
  }
1367
1315
  function ud() {
1368
1316
  return typeof nn == "function";
1369
1317
  }
1370
- async function bo() {
1318
+ async function wo() {
1371
1319
  if (ut)
1372
1320
  return ut;
1373
1321
  if (Ae)
@@ -1382,7 +1330,7 @@ async function bo() {
1382
1330
  } catch (r) {
1383
1331
  throw e === rn ? new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.') : r;
1384
1332
  }
1385
- return t ? (ut = fs(t), ut) : null;
1333
+ return t ? (ut = hs(t), ut) : null;
1386
1334
  })();
1387
1335
  try {
1388
1336
  return await Ae;
@@ -1390,17 +1338,17 @@ async function bo() {
1390
1338
  Ae = null;
1391
1339
  }
1392
1340
  }
1393
- const ps = [/javascript:/i, /expression\s*\(/i, /url\s*\(\s*javascript:/i, /@import/i], gs = /^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;
1394
- function ys(e) {
1341
+ const ms = [/javascript:/i, /expression\s*\(/i, /url\s*\(\s*javascript:/i, /@import/i], fs = /^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;
1342
+ function ps(e) {
1395
1343
  return e.replace(/["']\s*javascript:/gi, "#").replace(/\bjavascript:/gi, "#").replace(/["']\s*vbscript:/gi, "#").replace(/\bvbscript:/gi, "#").replace(/\bdata:text\/html/gi, "#");
1396
1344
  }
1397
- function vs(e) {
1345
+ function gs(e) {
1398
1346
  if (!e)
1399
1347
  return "";
1400
1348
  const t = e.trim();
1401
- return gs.test(t) ? t : "";
1349
+ return fs.test(t) ? t : "";
1402
1350
  }
1403
- function ws(e) {
1351
+ function ys(e) {
1404
1352
  const t = /* @__PURE__ */ new Set(["script"]), r = [e, ...Array.from(e.querySelectorAll("*"))];
1405
1353
  for (const o of r) {
1406
1354
  if (t.has(o.tagName.toLowerCase())) {
@@ -1414,12 +1362,12 @@ function ws(e) {
1414
1362
  o.removeAttribute(s);
1415
1363
  continue;
1416
1364
  }
1417
- if (s === "style" && i.value && ps.some((a) => a.test(i.value))) {
1365
+ if (s === "style" && i.value && ms.some((a) => a.test(i.value))) {
1418
1366
  o.removeAttribute(s);
1419
1367
  continue;
1420
1368
  }
1421
1369
  if ((s === "href" || s === "xlink:href") && i.value) {
1422
- const a = vs(i.value);
1370
+ const a = gs(i.value);
1423
1371
  if (!a) {
1424
1372
  o.removeAttribute(s);
1425
1373
  continue;
@@ -1432,13 +1380,13 @@ function ws(e) {
1432
1380
  function on(e) {
1433
1381
  if (typeof DOMParser > "u" || !e)
1434
1382
  return "";
1435
- const t = ys(e), o = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
1383
+ const t = ps(e), o = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
1436
1384
  if (!o || o.nodeName.toLowerCase() !== "svg")
1437
1385
  return "";
1438
1386
  const n = o;
1439
- return ws(n), n.outerHTML;
1387
+ return ys(n), n.outerHTML;
1440
1388
  }
1441
- function ko(e) {
1389
+ function bo(e) {
1442
1390
  return e ? typeof e == "string" ? e : typeof e.svg == "string" ? e.svg : typeof e.data == "string" ? e.data : "" : "";
1443
1391
  }
1444
1392
  async function sn(e) {
@@ -1487,12 +1435,12 @@ function ln(e, t) {
1487
1435
  function Ne(e, t, r) {
1488
1436
  return Math.min(r, Math.max(t, e));
1489
1437
  }
1490
- var bs = Object.defineProperty, ks = Object.getOwnPropertyDescriptor, Pt = (e, t, r, o) => {
1491
- for (var n = o > 1 ? void 0 : o ? ks(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1438
+ var vs = Object.defineProperty, ws = Object.getOwnPropertyDescriptor, Pt = (e, t, r, o) => {
1439
+ for (var n = o > 1 ? void 0 : o ? ws(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1492
1440
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1493
- return o && n && bs(t, r, n), n;
1441
+ return o && n && vs(t, r, n), n;
1494
1442
  };
1495
- const xs = {
1443
+ const bs = {
1496
1444
  N1: "#E5E7EB",
1497
1445
  N2: "#CBD5E1",
1498
1446
  N3: "#94A3B8",
@@ -1602,10 +1550,10 @@ let Pe = class {
1602
1550
  const t = ++this.renderToken;
1603
1551
  this.rendering = !0, this.error = "", this.cdr.markForCheck();
1604
1552
  try {
1605
- const r = await bo();
1553
+ const r = await wo();
1606
1554
  if (!r)
1607
1555
  throw new Error("D2 renderer is not available.");
1608
- const o = Cs(r);
1556
+ const o = ks(r);
1609
1557
  if (!o || typeof o.compile != "function" || typeof o.render != "function")
1610
1558
  throw new TypeError("D2 instance is missing compile/render methods.");
1611
1559
  const n = await o.compile(e), i = n?.diagram ?? n, s = n?.renderOptions ?? n?.options ?? {}, a = {
@@ -1616,12 +1564,12 @@ let Pe = class {
1616
1564
  };
1617
1565
  this.resolvedIsDark && (a.themeOverrides = {
1618
1566
  ...s.themeOverrides || {},
1619
- ...xs
1567
+ ...bs
1620
1568
  });
1621
1569
  const c = await o.render(i, a);
1622
1570
  if (this.destroyed || t !== this.renderToken)
1623
1571
  return;
1624
- const d = on(ko(c));
1572
+ const d = on(bo(c));
1625
1573
  if (!d)
1626
1574
  throw new Error("D2 render returned empty output.");
1627
1575
  this.svgMarkup = d, this.syncSvgHost();
@@ -1748,7 +1696,7 @@ Pe = Pt([
1748
1696
  changeDetection: k.OnPush
1749
1697
  })
1750
1698
  ], Pe);
1751
- function Cs(e) {
1699
+ function ks(e) {
1752
1700
  if (typeof e == "function") {
1753
1701
  const t = new e();
1754
1702
  if (t && typeof t.compile == "function")
@@ -1758,10 +1706,10 @@ function Cs(e) {
1758
1706
  }
1759
1707
  return e?.D2 && typeof e.D2 == "function" ? new e.D2() : typeof e?.compile == "function" ? e : null;
1760
1708
  }
1761
- var Ps = Object.defineProperty, Ts = Object.getOwnPropertyDescriptor, rr = (e, t, r, o) => {
1762
- for (var n = o > 1 ? void 0 : o ? Ts(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1709
+ var xs = Object.defineProperty, Cs = Object.getOwnPropertyDescriptor, rr = (e, t, r, o) => {
1710
+ for (var n = o > 1 ? void 0 : o ? Cs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1763
1711
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1764
- return o && n && Ps(t, r, n), n;
1712
+ return o && n && xs(t, r, n), n;
1765
1713
  };
1766
1714
  let je = class {
1767
1715
  constructor() {
@@ -1817,10 +1765,10 @@ je = rr([
1817
1765
  changeDetection: k.OnPush
1818
1766
  })
1819
1767
  ], je);
1820
- var _s = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, Ee = (e, t, r, o) => {
1821
- for (var n = o > 1 ? void 0 : o ? Ss(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1768
+ var Ps = Object.defineProperty, Ts = Object.getOwnPropertyDescriptor, Ee = (e, t, r, o) => {
1769
+ for (var n = o > 1 ? void 0 : o ? Ts(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1822
1770
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1823
- return o && n && _s(t, r, n), n;
1771
+ return o && n && Ps(t, r, n), n;
1824
1772
  };
1825
1773
  let te = class {
1826
1774
  constructor() {
@@ -1873,7 +1821,7 @@ Ee([
1873
1821
  l()
1874
1822
  ], te.prototype, "inputs", 2);
1875
1823
  Ee([
1876
- j("container", { read: pi, static: !0 })
1824
+ j("container", { read: mi, static: !0 })
1877
1825
  ], te.prototype, "containerRef", 2);
1878
1826
  te = Ee([
1879
1827
  b({
@@ -1883,20 +1831,20 @@ te = Ee([
1883
1831
  changeDetection: k.OnPush
1884
1832
  })
1885
1833
  ], te);
1886
- var Ms = Object.defineProperty, Os = Object.getOwnPropertyDescriptor, xo = (e, t, r, o) => {
1887
- for (var n = o > 1 ? void 0 : o ? Os(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1834
+ var _s = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, ko = (e, t, r, o) => {
1835
+ for (var n = o > 1 ? void 0 : o ? Ss(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1888
1836
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1889
- return o && n && Ms(t, r, n), n;
1837
+ return o && n && _s(t, r, n), n;
1890
1838
  };
1891
1839
  let Kt = class {
1892
1840
  get text() {
1893
1841
  return C(this.node?.raw || this.node?.markup || this.node?.content || this.node?.name);
1894
1842
  }
1895
1843
  };
1896
- xo([
1844
+ ko([
1897
1845
  l({ required: !0 })
1898
1846
  ], Kt.prototype, "node", 2);
1899
- Kt = xo([
1847
+ Kt = ko([
1900
1848
  b({
1901
1849
  selector: "markstream-angular-emoji-node",
1902
1850
  standalone: !0,
@@ -1904,10 +1852,10 @@ Kt = xo([
1904
1852
  changeDetection: k.OnPush
1905
1853
  })
1906
1854
  ], Kt);
1907
- var Es = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, nr = (e, t, r, o) => {
1908
- for (var n = o > 1 ? void 0 : o ? Ds(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1855
+ var Ms = Object.defineProperty, Os = Object.getOwnPropertyDescriptor, nr = (e, t, r, o) => {
1856
+ for (var n = o > 1 ? void 0 : o ? Os(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1909
1857
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1910
- return o && n && Es(t, r, n), n;
1858
+ return o && n && Ms(t, r, n), n;
1911
1859
  };
1912
1860
  let ze = class {
1913
1861
  get children() {
@@ -1943,10 +1891,10 @@ ze = nr([
1943
1891
  changeDetection: k.OnPush
1944
1892
  })
1945
1893
  ], ze);
1946
- var Rs = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, or = (e, t, r, o) => {
1947
- for (var n = o > 1 ? void 0 : o ? Is(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1894
+ var Es = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, or = (e, t, r, o) => {
1895
+ for (var n = o > 1 ? void 0 : o ? Ds(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1948
1896
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1949
- return o && n && Rs(t, r, n), n;
1897
+ return o && n && Es(t, r, n), n;
1950
1898
  };
1951
1899
  let We = class {
1952
1900
  get children() {
@@ -1962,10 +1910,10 @@ let We = class {
1962
1910
  return C(this.node?.tag || this.node?.type);
1963
1911
  }
1964
1912
  get customClassName() {
1965
- return `markstream-nested-custom--${co(this.customTag) || "node"}`;
1913
+ return `markstream-nested-custom--${uo(this.customTag) || "node"}`;
1966
1914
  }
1967
1915
  get rawBodyHtml() {
1968
- return Qr(C(this.node?.raw));
1916
+ return en(C(this.node?.raw));
1969
1917
  }
1970
1918
  get nestedPrefix() {
1971
1919
  return `${this.indexKey || "fallback"}-children`;
@@ -2013,10 +1961,10 @@ We = or([
2013
1961
  changeDetection: k.OnPush
2014
1962
  })
2015
1963
  ], We);
2016
- var $s = Object.defineProperty, As = Object.getOwnPropertyDescriptor, Co = (e, t, r, o) => {
2017
- for (var n = o > 1 ? void 0 : o ? As(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1964
+ var Rs = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, xo = (e, t, r, o) => {
1965
+ for (var n = o > 1 ? void 0 : o ? Is(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2018
1966
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2019
- return o && n && $s(t, r, n), n;
1967
+ return o && n && Rs(t, r, n), n;
2020
1968
  };
2021
1969
  let jt = class {
2022
1970
  get id() {
@@ -2029,10 +1977,10 @@ let jt = class {
2029
1977
  return `Back to reference ${this.id}`;
2030
1978
  }
2031
1979
  };
2032
- Co([
1980
+ xo([
2033
1981
  l({ required: !0 })
2034
1982
  ], jt.prototype, "node", 2);
2035
- jt = Co([
1983
+ jt = xo([
2036
1984
  b({
2037
1985
  selector: "markstream-angular-footnote-anchor-node",
2038
1986
  standalone: !0,
@@ -2048,10 +1996,10 @@ jt = Co([
2048
1996
  changeDetection: k.OnPush
2049
1997
  })
2050
1998
  ], jt);
2051
- var Ns = Object.defineProperty, Ls = Object.getOwnPropertyDescriptor, ir = (e, t, r, o) => {
2052
- for (var n = o > 1 ? void 0 : o ? Ls(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1999
+ var $s = Object.defineProperty, As = Object.getOwnPropertyDescriptor, ir = (e, t, r, o) => {
2000
+ for (var n = o > 1 ? void 0 : o ? As(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2053
2001
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2054
- return o && n && Ns(t, r, n), n;
2002
+ return o && n && $s(t, r, n), n;
2055
2003
  };
2056
2004
  let qe = class {
2057
2005
  get footnoteId() {
@@ -2090,10 +2038,10 @@ qe = ir([
2090
2038
  changeDetection: k.OnPush
2091
2039
  })
2092
2040
  ], qe);
2093
- var Bs = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, Po = (e, t, r, o) => {
2094
- for (var n = o > 1 ? void 0 : o ? Hs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2041
+ var Ns = Object.defineProperty, Ls = Object.getOwnPropertyDescriptor, Co = (e, t, r, o) => {
2042
+ for (var n = o > 1 ? void 0 : o ? Ls(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2095
2043
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2096
- return o && n && Bs(t, r, n), n;
2044
+ return o && n && Ns(t, r, n), n;
2097
2045
  };
2098
2046
  let zt = class {
2099
2047
  get id() {
@@ -2103,10 +2051,10 @@ let zt = class {
2103
2051
  return `#fnref--${this.id}`;
2104
2052
  }
2105
2053
  };
2106
- Po([
2054
+ Co([
2107
2055
  l({ required: !0 })
2108
2056
  ], zt.prototype, "node", 2);
2109
- zt = Po([
2057
+ zt = Co([
2110
2058
  b({
2111
2059
  selector: "markstream-angular-footnote-reference-node",
2112
2060
  standalone: !0,
@@ -2118,14 +2066,14 @@ zt = Po([
2118
2066
  changeDetection: k.OnPush
2119
2067
  })
2120
2068
  ], zt);
2121
- var Fs = Object.getOwnPropertyDescriptor, Ks = (e, t, r, o) => {
2122
- for (var n = o > 1 ? void 0 : o ? Fs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2069
+ var Bs = Object.getOwnPropertyDescriptor, Hs = (e, t, r, o) => {
2070
+ for (var n = o > 1 ? void 0 : o ? Bs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2123
2071
  (s = e[i]) && (n = s(n) || n);
2124
2072
  return n;
2125
2073
  };
2126
2074
  let Hr = class {
2127
2075
  };
2128
- Hr = Ks([
2076
+ Hr = Hs([
2129
2077
  b({
2130
2078
  selector: "markstream-angular-hardbreak-node",
2131
2079
  standalone: !0,
@@ -2133,6 +2081,58 @@ Hr = Ks([
2133
2081
  changeDetection: k.OnPush
2134
2082
  })
2135
2083
  ], Hr);
2084
+ var Fs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, Po = (e, t, r, o) => {
2085
+ for (var n = o > 1 ? void 0 : o ? Ks(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2086
+ (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2087
+ return o && n && Fs(t, r, n), n;
2088
+ };
2089
+ let gt = class {
2090
+ constructor() {
2091
+ this.elementRef = Q(so), this.renderer = Q(fi), this.appliedAttrs = /* @__PURE__ */ new Set(), this.appliedClasses = /* @__PURE__ */ new Set(), this.appliedStyles = /* @__PURE__ */ new Set();
2092
+ }
2093
+ ngOnChanges() {
2094
+ this.clearAppliedState();
2095
+ const e = this.markstreamSafeAttrs;
2096
+ if (e) {
2097
+ for (const [t, r] of Object.entries(e))
2098
+ if (Qr(t)) {
2099
+ if (t === "class" || t === "className") {
2100
+ for (const o of String(r || "").split(/\s+/g).map((n) => n.trim()).filter(Boolean))
2101
+ this.renderer.addClass(this.elementRef.nativeElement, o), this.appliedClasses.add(o);
2102
+ continue;
2103
+ }
2104
+ if (t === "style" && r && typeof r == "object") {
2105
+ for (const [o, n] of Object.entries(r))
2106
+ this.renderer.setStyle(this.elementRef.nativeElement, o, n), this.appliedStyles.add(o);
2107
+ continue;
2108
+ }
2109
+ r === !1 || r == null || (this.renderer.setAttribute(
2110
+ this.elementRef.nativeElement,
2111
+ t,
2112
+ r === !0 ? "" : String(r)
2113
+ ), this.appliedAttrs.add(t));
2114
+ }
2115
+ }
2116
+ }
2117
+ clearAppliedState() {
2118
+ for (const e of this.appliedAttrs)
2119
+ this.renderer.removeAttribute(this.elementRef.nativeElement, e);
2120
+ for (const e of this.appliedClasses)
2121
+ this.renderer.removeClass(this.elementRef.nativeElement, e);
2122
+ for (const e of this.appliedStyles)
2123
+ this.renderer.removeStyle(this.elementRef.nativeElement, e);
2124
+ this.appliedAttrs.clear(), this.appliedClasses.clear(), this.appliedStyles.clear();
2125
+ }
2126
+ };
2127
+ Po([
2128
+ l()
2129
+ ], gt.prototype, "markstreamSafeAttrs", 2);
2130
+ gt = Po([
2131
+ pi({
2132
+ selector: "[markstreamSafeAttrs]",
2133
+ standalone: !0
2134
+ })
2135
+ ], gt);
2136
2136
  var js = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, sr = (e, t, r, o) => {
2137
2137
  for (var n = o > 1 ? void 0 : o ? zs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2138
2138
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
@@ -2140,7 +2140,7 @@ var js = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, sr = (e, t
2140
2140
  };
2141
2141
  let Ve = class {
2142
2142
  get level() {
2143
- return $i(this.node?.level);
2143
+ return Ai(this.node?.level);
2144
2144
  }
2145
2145
  get attrs() {
2146
2146
  const e = this.node?.attrs;
@@ -2166,7 +2166,7 @@ Ve = sr([
2166
2166
  b({
2167
2167
  selector: "markstream-angular-heading-node",
2168
2168
  standalone: !0,
2169
- imports: [S, pt, p(() => _)],
2169
+ imports: [S, gt, p(() => _)],
2170
2170
  template: `
2171
2171
  <h1 *ngIf="level === 1" dir="auto" class="heading-node heading-1" [markstreamSafeAttrs]="attrs">
2172
2172
  <markstream-angular-nested-renderer [nodes]="children" [context]="context" [indexPrefix]="nestedPrefix" />
@@ -2296,7 +2296,7 @@ function In(e) {
2296
2296
  const t = {};
2297
2297
  for (const [r, o] of Object.entries(e)) {
2298
2298
  const n = r.trim(), i = n.toLowerCase();
2299
- !n || !Jr(n) || Vs.has(i) || Xs.has(i) && o && Zs(o) || (t[n] = o);
2299
+ !n || !Qr(n) || Vs.has(i) || Xs.has(i) && o && Zs(o) || (t[n] = o);
2300
2300
  }
2301
2301
  return t;
2302
2302
  }
@@ -2372,7 +2372,7 @@ function Js(e) {
2372
2372
  }
2373
2373
  function $n(e) {
2374
2374
  const t = Object.entries(e);
2375
- return t.length === 0 ? "" : t.map(([r, o]) => o === "" ? ` ${r}` : ` ${r}="${Ii(o)}"`).join("");
2375
+ return t.length === 0 ? "" : t.map(([r, o]) => o === "" ? ` ${r}` : ` ${r}="${$i(o)}"`).join("");
2376
2376
  }
2377
2377
  function cn(e) {
2378
2378
  if (!e)
@@ -2381,7 +2381,7 @@ function cn(e) {
2381
2381
  let n = 0;
2382
2382
  for (const i of t) {
2383
2383
  if (i.type === "text") {
2384
- n === 0 && o.push(Qr(i.content ?? ""));
2384
+ n === 0 && o.push(en(i.content ?? ""));
2385
2385
  continue;
2386
2386
  }
2387
2387
  const s = Js(i.tagName);
@@ -4260,6 +4260,7 @@ async function pn() {
4260
4260
  Le = null;
4261
4261
  }
4262
4262
  }
4263
+ const Mt = "WORKER_BUSY";
4263
4264
  let U = null, ae = null, jr = !1;
4264
4265
  const F = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Map(), al = 200, we = /* @__PURE__ */ new Set();
4265
4266
  let Me = 5;
@@ -4365,7 +4366,6 @@ function yd() {
4365
4366
  function vd(e) {
4366
4367
  Number.isFinite(e) && e > 0 && (Me = Math.floor(e));
4367
4368
  }
4368
- const Mt = "WORKER_BUSY";
4369
4369
  function wd() {
4370
4370
  return F.size >= Me;
4371
4371
  }
@@ -5268,7 +5268,7 @@ let Qe = class {
5268
5268
  return I(this.node?.children);
5269
5269
  }
5270
5270
  ngOnChanges() {
5271
- this.segments = Fi(this.children);
5271
+ this.segments = Ki(this.children);
5272
5272
  }
5273
5273
  segmentPrefix(e) {
5274
5274
  return `${this.indexKey || "paragraph"}-${e}`;
@@ -5347,10 +5347,42 @@ Jt = ei([
5347
5347
  changeDetection: k.OnPush
5348
5348
  })
5349
5349
  ], Jt);
5350
- var El = Object.defineProperty, Dl = Object.getOwnPropertyDescriptor, wr = (e, t, r, o) => {
5351
- for (var n = o > 1 ? void 0 : o ? Dl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5350
+ function ti(e, t) {
5351
+ if (t?.renderCodeBlocksAsPre)
5352
+ return "pre";
5353
+ const r = Hi(e);
5354
+ return r === "d2" || r === "d2lang" ? "d2" : r === "infographic" ? "infographic" : r === "mermaid" ? "mermaid" : "code";
5355
+ }
5356
+ function xn(e) {
5357
+ return String(e?.tag || "").trim().toLowerCase() || Li(e?.content);
5358
+ }
5359
+ function El(e) {
5360
+ const t = xn(e);
5361
+ return t ? {
5362
+ ...e,
5363
+ type: t,
5364
+ tag: t,
5365
+ content: Bi(e?.content, t)
5366
+ } : e;
5367
+ }
5368
+ function Dl(e, t) {
5369
+ const r = xn(e);
5370
+ return r ? {
5371
+ ...e,
5372
+ type: t,
5373
+ tag: r
5374
+ } : e;
5375
+ }
5376
+ function Rl(e, t) {
5377
+ if (String(e?.type || "") !== "code_block")
5378
+ return null;
5379
+ const r = ti(e, t);
5380
+ return r === "mermaid" ? t?.mermaidProps ?? null : r === "d2" ? t?.d2Props ?? null : r === "infographic" ? t?.infographicProps ?? null : t?.codeBlockProps ?? null;
5381
+ }
5382
+ var Il = Object.defineProperty, $l = Object.getOwnPropertyDescriptor, wr = (e, t, r, o) => {
5383
+ for (var n = o > 1 ? void 0 : o ? $l(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5352
5384
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5353
- return o && n && El(t, r, n), n;
5385
+ return o && n && Il(t, r, n), n;
5354
5386
  };
5355
5387
  let et = class {
5356
5388
  get children() {
@@ -5386,10 +5418,10 @@ et = wr([
5386
5418
  changeDetection: k.OnPush
5387
5419
  })
5388
5420
  ], et);
5389
- var Rl = Object.defineProperty, Il = Object.getOwnPropertyDescriptor, br = (e, t, r, o) => {
5390
- for (var n = o > 1 ? void 0 : o ? Il(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5421
+ var Al = Object.defineProperty, Nl = Object.getOwnPropertyDescriptor, br = (e, t, r, o) => {
5422
+ for (var n = o > 1 ? void 0 : o ? Nl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5391
5423
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5392
- return o && n && Rl(t, r, n), n;
5424
+ return o && n && Al(t, r, n), n;
5393
5425
  };
5394
5426
  let tt = class {
5395
5427
  get children() {
@@ -5425,10 +5457,10 @@ tt = br([
5425
5457
  changeDetection: k.OnPush
5426
5458
  })
5427
5459
  ], tt);
5428
- var $l = Object.defineProperty, Al = Object.getOwnPropertyDescriptor, kr = (e, t, r, o) => {
5429
- for (var n = o > 1 ? void 0 : o ? Al(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5460
+ var Ll = Object.defineProperty, Bl = Object.getOwnPropertyDescriptor, kr = (e, t, r, o) => {
5461
+ for (var n = o > 1 ? void 0 : o ? Bl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5430
5462
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5431
- return o && n && $l(t, r, n), n;
5463
+ return o && n && Ll(t, r, n), n;
5432
5464
  };
5433
5465
  let rt = class {
5434
5466
  get children() {
@@ -5464,10 +5496,10 @@ rt = kr([
5464
5496
  changeDetection: k.OnPush
5465
5497
  })
5466
5498
  ], rt);
5467
- var Nl = Object.defineProperty, Ll = Object.getOwnPropertyDescriptor, xr = (e, t, r, o) => {
5468
- for (var n = o > 1 ? void 0 : o ? Ll(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5499
+ var Hl = Object.defineProperty, Fl = Object.getOwnPropertyDescriptor, xr = (e, t, r, o) => {
5500
+ for (var n = o > 1 ? void 0 : o ? Fl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5469
5501
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5470
- return o && n && Nl(t, r, n), n;
5502
+ return o && n && Hl(t, r, n), n;
5471
5503
  };
5472
5504
  let nt = class {
5473
5505
  get children() {
@@ -5503,10 +5535,10 @@ nt = xr([
5503
5535
  changeDetection: k.OnPush
5504
5536
  })
5505
5537
  ], nt);
5506
- var Bl = Object.defineProperty, Hl = Object.getOwnPropertyDescriptor, Cr = (e, t, r, o) => {
5507
- for (var n = o > 1 ? void 0 : o ? Hl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5538
+ var Kl = Object.defineProperty, jl = Object.getOwnPropertyDescriptor, Cr = (e, t, r, o) => {
5539
+ for (var n = o > 1 ? void 0 : o ? jl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5508
5540
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5509
- return o && n && Bl(t, r, n), n;
5541
+ return o && n && Kl(t, r, n), n;
5510
5542
  };
5511
5543
  let ot = class {
5512
5544
  constructor() {
@@ -5579,10 +5611,10 @@ ot = Cr([
5579
5611
  changeDetection: k.OnPush
5580
5612
  })
5581
5613
  ], ot);
5582
- var Fl = Object.defineProperty, Kl = Object.getOwnPropertyDescriptor, ti = (e, t, r, o) => {
5583
- for (var n = o > 1 ? void 0 : o ? Kl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5614
+ var zl = Object.defineProperty, Wl = Object.getOwnPropertyDescriptor, ri = (e, t, r, o) => {
5615
+ for (var n = o > 1 ? void 0 : o ? Wl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5584
5616
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5585
- return o && n && Fl(t, r, n), n;
5617
+ return o && n && zl(t, r, n), n;
5586
5618
  };
5587
5619
  let Qt = class {
5588
5620
  get text() {
@@ -5592,10 +5624,10 @@ let Qt = class {
5592
5624
  return !!this.node?.center;
5593
5625
  }
5594
5626
  };
5595
- ti([
5627
+ ri([
5596
5628
  l({ required: !0 })
5597
5629
  ], Qt.prototype, "node", 2);
5598
- Qt = ti([
5630
+ Qt = ri([
5599
5631
  b({
5600
5632
  selector: "markstream-angular-text-node",
5601
5633
  standalone: !0,
@@ -5609,14 +5641,14 @@ Qt = ti([
5609
5641
  changeDetection: k.OnPush
5610
5642
  })
5611
5643
  ], Qt);
5612
- var jl = Object.getOwnPropertyDescriptor, zl = (e, t, r, o) => {
5613
- for (var n = o > 1 ? void 0 : o ? jl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5644
+ var ql = Object.getOwnPropertyDescriptor, Vl = (e, t, r, o) => {
5645
+ for (var n = o > 1 ? void 0 : o ? ql(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5614
5646
  (s = e[i]) && (n = s(n) || n);
5615
5647
  return n;
5616
5648
  };
5617
5649
  let Wr = class {
5618
5650
  };
5619
- Wr = zl([
5651
+ Wr = Vl([
5620
5652
  b({
5621
5653
  selector: "markstream-angular-thematic-break-node",
5622
5654
  standalone: !0,
@@ -5624,10 +5656,10 @@ Wr = zl([
5624
5656
  changeDetection: k.OnPush
5625
5657
  })
5626
5658
  ], Wr);
5627
- var Wl = Object.defineProperty, ql = Object.getOwnPropertyDescriptor, Pr = (e, t, r, o) => {
5628
- for (var n = o > 1 ? void 0 : o ? ql(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5659
+ var Ul = Object.defineProperty, Xl = Object.getOwnPropertyDescriptor, Pr = (e, t, r, o) => {
5660
+ for (var n = o > 1 ? void 0 : o ? Xl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5629
5661
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5630
- return o && n && Wl(t, r, n), n;
5662
+ return o && n && Ul(t, r, n), n;
5631
5663
  };
5632
5664
  let it = class {
5633
5665
  get children() {
@@ -5663,38 +5695,6 @@ it = Pr([
5663
5695
  changeDetection: k.OnPush
5664
5696
  })
5665
5697
  ], it);
5666
- function ri(e, t) {
5667
- if (t?.renderCodeBlocksAsPre)
5668
- return "pre";
5669
- const r = Bi(e);
5670
- return r === "d2" || r === "d2lang" ? "d2" : r === "infographic" ? "infographic" : r === "mermaid" ? "mermaid" : "code";
5671
- }
5672
- function xn(e) {
5673
- return String(e?.tag || "").trim().toLowerCase() || Ni(e?.content);
5674
- }
5675
- function Vl(e) {
5676
- const t = xn(e);
5677
- return t ? {
5678
- ...e,
5679
- type: t,
5680
- tag: t,
5681
- content: Li(e?.content, t)
5682
- } : e;
5683
- }
5684
- function Ul(e, t) {
5685
- const r = xn(e);
5686
- return r ? {
5687
- ...e,
5688
- type: t,
5689
- tag: r
5690
- } : e;
5691
- }
5692
- function Xl(e, t) {
5693
- if (String(e?.type || "") !== "code_block")
5694
- return null;
5695
- const r = ri(e, t);
5696
- return r === "mermaid" ? t?.mermaidProps ?? null : r === "d2" ? t?.d2Props ?? null : r === "infographic" ? t?.infographicProps ?? null : t?.codeBlockProps ?? null;
5697
- }
5698
5698
  var Gl = Object.defineProperty, Zl = Object.getOwnPropertyDescriptor, Tr = (e, t, r, o) => {
5699
5699
  for (var n = o > 1 ? void 0 : o ? Zl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5700
5700
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
@@ -5705,7 +5705,7 @@ let ue = class {
5705
5705
  return String(this.node?.type || "");
5706
5706
  }
5707
5707
  get customComponentMap() {
5708
- return this.context?.customComponents || mo(this.context?.customId);
5708
+ return this.context?.customComponents || lo(this.context?.customId);
5709
5709
  }
5710
5710
  get resolvedCustomComponent() {
5711
5711
  const e = this.customComponentMap, t = e?.[this.resolvedType];
@@ -5723,22 +5723,22 @@ let ue = class {
5723
5723
  return r ? e?.[r] ?? null : null;
5724
5724
  }
5725
5725
  get customNode() {
5726
- return Vl(this.node);
5726
+ return El(this.node);
5727
5727
  }
5728
5728
  get codeMode() {
5729
- return ri(this.node, this.context);
5729
+ return ti(this.node, this.context);
5730
5730
  }
5731
5731
  get htmlTag() {
5732
5732
  return xn(this.node);
5733
5733
  }
5734
5734
  get htmlRenderNode() {
5735
- return Ul(this.node, this.resolvedType);
5735
+ return Dl(this.node, this.resolvedType);
5736
5736
  }
5737
5737
  get fallbackNode() {
5738
5738
  return this.node;
5739
5739
  }
5740
5740
  get resolvedComponentInputs() {
5741
- return Xl(this.node, this.context);
5741
+ return Rl(this.node, this.context);
5742
5742
  }
5743
5743
  };
5744
5744
  Tr([
@@ -5785,7 +5785,7 @@ ue = Tr([
5785
5785
  p(() => bt),
5786
5786
  p(() => ne),
5787
5787
  p(() => Qe),
5788
- p(() => gt),
5788
+ p(() => pt),
5789
5789
  p(() => Jt),
5790
5790
  p(() => et),
5791
5791
  p(() => tt),
@@ -5929,7 +5929,7 @@ let _ = class {
5929
5929
  }
5930
5930
  r.push({
5931
5931
  kind: "label",
5932
- attrs: Hi(n?.attrs),
5932
+ attrs: Fi(n?.attrs),
5933
5933
  children: i
5934
5934
  }), o = s;
5935
5935
  continue;
@@ -5991,7 +5991,7 @@ _ = W([
5991
5991
  standalone: !0,
5992
5992
  imports: [
5993
5993
  S,
5994
- pt,
5994
+ gt,
5995
5995
  p(() => _),
5996
5996
  p(() => ue)
5997
5997
  ],
@@ -6024,13 +6024,13 @@ var Ql = Object.defineProperty, ec = Object.getOwnPropertyDescriptor, _r = (e, t
6024
6024
  };
6025
6025
  let st = class {
6026
6026
  get kind() {
6027
- return co(C(this.node?.kind || "note")) || "note";
6027
+ return uo(C(this.node?.kind || "note")) || "note";
6028
6028
  }
6029
6029
  get kindClass() {
6030
6030
  return `markstream-nested-admonition--${this.kind}`;
6031
6031
  }
6032
6032
  get resolvedTitle() {
6033
- return C(this.node?.title) || Ai(this.kind);
6033
+ return C(this.node?.title) || Ni(this.kind);
6034
6034
  }
6035
6035
  get children() {
6036
6036
  return I(this.node?.children);
@@ -6372,7 +6372,7 @@ async function cc(e, t, r, o) {
6372
6372
  }
6373
6373
  }
6374
6374
  async function dc(e, t, r, o) {
6375
- const n = await bo();
6375
+ const n = await wo();
6376
6376
  if (!n || !o())
6377
6377
  return;
6378
6378
  const i = Array.from(e.querySelectorAll('pre[data-markstream-code-block="1"] > code.language-d2, pre[data-markstream-code-block="1"] > code.language-d2lang'));
@@ -6401,7 +6401,7 @@ async function dc(e, t, r, o) {
6401
6401
  const M = await h.render(f, v);
6402
6402
  if (!o())
6403
6403
  return;
6404
- const E = on(ko(M));
6404
+ const E = on(bo(M));
6405
6405
  if (!E)
6406
6406
  throw new Error("D2 render returned empty output.");
6407
6407
  u.body.innerHTML = E, u.wrapper.dataset.markstreamD2 = "1", t.push(() => {
@@ -6413,7 +6413,7 @@ async function dc(e, t, r, o) {
6413
6413
  }
6414
6414
  }
6415
6415
  async function uc(e, t, r, o) {
6416
- const n = await vo();
6416
+ const n = await go();
6417
6417
  if (!n || typeof n.useMonaco != "function" || !o())
6418
6418
  return;
6419
6419
  const i = Array.from(e.querySelectorAll('pre[data-markstream-code-block="1"]'));
@@ -6503,7 +6503,7 @@ function pc(e, t) {
6503
6503
  function gc(e) {
6504
6504
  if (!e)
6505
6505
  return "";
6506
- const t = globalThis?.Buffer;
6506
+ const t = globalThis?.require?.("buffer")?.Buffer;
6507
6507
  if (t?.from)
6508
6508
  return t.from(e, "base64").toString("utf8");
6509
6509
  if (typeof globalThis.atob == "function" && typeof TextDecoder < "u") {
@@ -6662,7 +6662,7 @@ let w = class {
6662
6662
  this.rebuild();
6663
6663
  }
6664
6664
  ngOnInit() {
6665
- this.unsubscribeCustomComponents = zi(() => {
6665
+ this.unsubscribeCustomComponents = Oi(() => {
6666
6666
  this.rebuild();
6667
6667
  });
6668
6668
  }
@@ -6683,20 +6683,20 @@ let w = class {
6683
6683
  }
6684
6684
  rebuild() {
6685
6685
  this.stopBatching(), this.disposeEnhancements(), this.cleanupTransientState();
6686
- const e = mo(this.customId), t = this.customComponents ? {
6686
+ const e = lo(this.customId), t = this.customComponents ? {
6687
6687
  ...e,
6688
6688
  ...this.customComponents
6689
6689
  } : e, r = {
6690
6690
  onCopy: (n) => this.copy.emit(n),
6691
6691
  onHandleArtifactClick: (n) => this.handleArtifactClick.emit(n)
6692
6692
  };
6693
- this.renderContext = Ei(
6693
+ this.renderContext = Di(
6694
6694
  {
6695
6695
  ...this,
6696
6696
  customComponents: t
6697
6697
  },
6698
6698
  r
6699
- ), this.parsedNodes = Di(this), this.trimMeasuredState();
6699
+ ), this.parsedNodes = Ri(this), this.trimMeasuredState();
6700
6700
  const o = this.parsedNodes.length;
6701
6701
  this.focusIndex = Math.max(0, Math.min(this.focusIndex, Math.max(0, o - 1))), this.virtualizationEnabled ? (this.renderedCount = o, this.liveRange = to(o, this.focusIndex, this.resolvedMaxLiveNodes, this.resolvedLiveNodeBuffer)) : (this.liveRange = { start: 0, end: o }, this.renderedCount = this.incrementalRenderingActive ? Math.min(o, this.resolvedInitialBatchSize) : o), this.deferNodesActive || this.nodeVisibility.clear(), this.refreshVisibleEntries(), this.cdr.markForCheck(), this.schedulePostRenderWork(), this.incrementalRenderingActive && this.renderedCount < o && this.scheduleBatchStep();
6702
6702
  }
@@ -7452,7 +7452,7 @@ function Yc(e) {
7452
7452
  function oo(e) {
7453
7453
  if (!e)
7454
7454
  return "";
7455
- const t = globalThis?.Buffer;
7455
+ const t = globalThis?.require?.("buffer")?.Buffer;
7456
7456
  if (t?.from)
7457
7457
  return t.from(e, "utf8").toString("base64");
7458
7458
  if (typeof TextEncoder < "u" && typeof globalThis.btoa == "function") {
@@ -7890,9 +7890,9 @@ export {
7890
7890
  _ as NestedRenderer,
7891
7891
  w as NodeRenderer,
7892
7892
  Qe as ParagraphNode,
7893
- gt as PreCodeNode,
7893
+ pt as PreCodeNode,
7894
7894
  Jt as ReferenceNode,
7895
- pt as SafeAttrsDirective,
7895
+ gt as SafeAttrsDirective,
7896
7896
  et as StrikethroughNode,
7897
7897
  tt as StrongNode,
7898
7898
  rt as SubscriptNode,
@@ -7904,7 +7904,7 @@ export {
7904
7904
  Mt as WORKER_BUSY_CODE,
7905
7905
  Jc as buildKaTeXCDNWorkerSource,
7906
7906
  Qc as buildMermaidCDNWorkerSource,
7907
- Ei as buildRenderContext,
7907
+ Di as buildRenderContext,
7908
7908
  Jo as canParseOffthread,
7909
7909
  sd as clearGlobalCustomComponents,
7910
7910
  pd as clearKaTeXWorker,
@@ -7922,18 +7922,18 @@ export {
7922
7922
  nc as enhanceRenderedHtml,
7923
7923
  Qo as findPrefixOffthread,
7924
7924
  nd as getCustomComponentsRevision,
7925
- mo as getCustomNodeComponents,
7925
+ lo as getCustomNodeComponents,
7926
7926
  kd as getKaTeXBackpressureDefaults,
7927
7927
  yd as getKaTeXWorkerLoad,
7928
7928
  pn as getKatex,
7929
- cs as getLanguageIcon,
7929
+ ns as getLanguageIcon,
7930
7930
  Go as getMermaid,
7931
7931
  _d as getMermaidWorkerLoad,
7932
7932
  ud as isD2Enabled,
7933
7933
  wd as isKaTeXWorkerBusy,
7934
7934
  Wo as isKatexEnabled,
7935
7935
  wl as isMermaidEnabled,
7936
- ds as languageMap,
7936
+ os as languageMap,
7937
7937
  tn as normalizeLanguageIdentifier,
7938
7938
  xi as parseNestedMarkdownToNodes,
7939
7939
  id as removeCustomComponents,
@@ -7943,11 +7943,11 @@ export {
7943
7943
  Rd as renderMarkdownNodesToHtml,
7944
7944
  Ed as renderMarkdownToHtml,
7945
7945
  Dd as renderNestedMarkdownToHtml,
7946
- ls as resolveMonacoLanguageId,
7947
- Di as resolveParsedNodes,
7946
+ rs as resolveMonacoLanguageId,
7947
+ Ri as resolveParsedNodes,
7948
7948
  cn as sanitizeHtmlContent,
7949
7949
  od as setCustomComponents,
7950
- wo as setD2Loader,
7950
+ vo as setD2Loader,
7951
7951
  ad as setDefaultI18nMap,
7952
7952
  bd as setKaTeXBackpressureDefaults,
7953
7953
  gn as setKaTeXCache,
@@ -7960,8 +7960,8 @@ export {
7960
7960
  Sd as setMermaidWorker,
7961
7961
  Pd as setMermaidWorkerClientDebug,
7962
7962
  Td as setMermaidWorkerMaxConcurrency,
7963
- zi as subscribeCustomComponents,
7963
+ Oi as subscribeCustomComponents,
7964
7964
  Od as terminateWorker,
7965
- yo as useSafeI18n,
7965
+ po as useSafeI18n,
7966
7966
  dl as waitForKaTeXWorkerSlot
7967
7967
  };