@pi-outpost/embed 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- import { _ as e, c as t, d as n, g as r, h as i, l as a, m as o, n as s, o as c, p as l, s as u, u as d, v as f, y as p } from "./conversationHistory-C7my_nR8.js";
2
- import { g as m, i as h, n as g, r as _, t as ee, u as te } from "./lib-CSMo4o20.js";
3
- import { t as ne } from "./download-DVJ5QY85.js";
4
- import { a as re, n as ie, o as ae, s as oe } from "./mermaidToImage-B2aJB9x8.js";
5
- import { n as se } from "./loadReferencedImage-2qNdVVhQ.js";
1
+ import { C as e, S as t, _ as n, b as r, d as i, f as a, h as o, m as s, n as c, o as l, p as u, v as d, x as f, y as p } from "./conversationHistory-Dh1AOfU9.js";
2
+ import { g as m, i as h, n as ee, r as g, t as te, u as ne } from "./lib-CSMo4o20.js";
3
+ import { t as re } from "./download-DVJ5QY85.js";
4
+ import { a as ie, l as ae, n as oe, o as se, s as ce, u as le } from "./mermaidToImage-knc9XzLd.js";
5
+ import { n as _ } from "./loadReferencedImage-LF2DEOPa.js";
6
6
  //#region ../node_modules/stringify-entities/lib/core.js
7
- var ce = /["&'<>`]/g, v = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, y = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, b = /[|\\{}()[\]^$+*?.]/g, x = /* @__PURE__ */ new WeakMap();
8
- function le(e, t) {
9
- return e = e.replace(t.subset ? ue(t.subset) : ce, r), t.subset || t.escapeOnly ? e : e.replace(v, n).replace(y, r);
7
+ var ue = /["&'<>`]/g, de = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, fe = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, pe = /[|\\{}()[\]^$+*?.]/g, v = /* @__PURE__ */ new WeakMap();
8
+ function me(e, t) {
9
+ return e = e.replace(t.subset ? he(t.subset) : ue, r), t.subset || t.escapeOnly ? e : e.replace(de, n).replace(fe, r);
10
10
  function n(e, n, r) {
11
11
  return t.format((e.charCodeAt(0) - 55296) * 1024 + e.charCodeAt(1) - 56320 + 65536, r.charCodeAt(n + 2), t);
12
12
  }
@@ -14,32 +14,32 @@ function le(e, t) {
14
14
  return t.format(e.charCodeAt(0), r.charCodeAt(n + 1), t);
15
15
  }
16
16
  }
17
- function ue(e) {
18
- let t = x.get(e);
19
- return t || (t = de(e), x.set(e, t)), t;
17
+ function he(e) {
18
+ let t = v.get(e);
19
+ return t || (t = ge(e), v.set(e, t)), t;
20
20
  }
21
- function de(e) {
21
+ function ge(e) {
22
22
  let t = [], n = -1;
23
- for (; ++n < e.length;) t.push(e[n].replace(b, "\\$&"));
23
+ for (; ++n < e.length;) t.push(e[n].replace(pe, "\\$&"));
24
24
  return RegExp("(?:" + t.join("|") + ")", "g");
25
25
  }
26
26
  //#endregion
27
27
  //#region ../node_modules/stringify-entities/lib/util/to-hexadecimal.js
28
- var fe = /[\dA-Fa-f]/;
29
- function pe(e, t, n) {
28
+ var _e = /[\dA-Fa-f]/;
29
+ function ve(e, t, n) {
30
30
  let r = "&#x" + e.toString(16).toUpperCase();
31
- return n && t && !fe.test(String.fromCharCode(t)) ? r : r + ";";
31
+ return n && t && !_e.test(String.fromCharCode(t)) ? r : r + ";";
32
32
  }
33
33
  //#endregion
34
34
  //#region ../node_modules/stringify-entities/lib/util/to-decimal.js
35
- var me = /\d/;
36
- function he(e, t, n) {
35
+ var y = /\d/;
36
+ function b(e, t, n) {
37
37
  let r = "&#" + String(e);
38
- return n && t && !me.test(String.fromCharCode(t)) ? r : r + ";";
38
+ return n && t && !y.test(String.fromCharCode(t)) ? r : r + ";";
39
39
  }
40
40
  //#endregion
41
41
  //#region ../node_modules/character-entities-legacy/index.js
42
- var ge = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml".split("."), S = {
42
+ var x = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml".split("."), S = {
43
43
  nbsp: "\xA0",
44
44
  iexcl: "¡",
45
45
  cent: "¢",
@@ -308,16 +308,16 @@ function O(e, t, n, r) {
308
308
  let i = String.fromCharCode(e);
309
309
  if (w.call(T, i)) {
310
310
  let e = T[i], a = "&" + e;
311
- return n && ge.includes(e) && !C.includes(e) && (!r || t && t !== 61 && D.test(String.fromCharCode(t))) ? a : a + ";";
311
+ return n && x.includes(e) && !C.includes(e) && (!r || t && t !== 61 && D.test(String.fromCharCode(t))) ? a : a + ";";
312
312
  }
313
313
  return "";
314
314
  }
315
315
  //#endregion
316
316
  //#region ../node_modules/stringify-entities/lib/util/format-smart.js
317
317
  function k(e, t, n) {
318
- let r = pe(e, t, n.omitOptionalSemicolons), i;
318
+ let r = ve(e, t, n.omitOptionalSemicolons), i;
319
319
  if ((n.useNamedReferences || n.useShortestReferences) && (i = O(e, t, n.omitOptionalSemicolons, n.attribute)), (n.useShortestReferences || !i) && n.useShortestReferences) {
320
- let i = he(e, t, n.omitOptionalSemicolons);
320
+ let i = b(e, t, n.omitOptionalSemicolons);
321
321
  i.length < r.length && (r = i);
322
322
  }
323
323
  return i && (!n.useShortestReferences || i.length < r.length) ? i : r;
@@ -325,7 +325,7 @@ function k(e, t, n) {
325
325
  //#endregion
326
326
  //#region ../node_modules/stringify-entities/lib/index.js
327
327
  function A(e, t) {
328
- return le(e, Object.assign({ format: k }, t));
328
+ return me(e, Object.assign({ format: k }, t));
329
329
  }
330
330
  //#endregion
331
331
  //#region ../node_modules/hast-util-to-html/lib/handle/comment.js
@@ -343,72 +343,72 @@ function F(e, t, n, r) {
343
343
  }
344
344
  //#endregion
345
345
  //#region ../node_modules/hast-util-to-html/lib/omission/util/siblings.js
346
- var I = R(1), L = R(-1), _e = [];
346
+ var I = R(1), L = R(-1), ye = [];
347
347
  function R(e) {
348
- return t;
349
- function t(t, n, r) {
350
- let i = t ? t.children : _e, a = (n || 0) + e, o = i[a];
351
- if (!r) for (; o && f(o);) a += e, o = i[a];
352
- return o;
348
+ return n;
349
+ function n(n, r, i) {
350
+ let a = n ? n.children : ye, o = (r || 0) + e, s = a[o];
351
+ if (!i) for (; s && t(s);) o += e, s = a[o];
352
+ return s;
353
353
  }
354
354
  }
355
355
  //#endregion
356
356
  //#region ../node_modules/hast-util-to-html/lib/omission/omission.js
357
- var ve = {}.hasOwnProperty;
357
+ var be = {}.hasOwnProperty;
358
358
  function z(e) {
359
359
  return t;
360
360
  function t(t, n, r) {
361
- return ve.call(e, t.tagName) && e[t.tagName](t, n, r);
361
+ return be.call(e, t.tagName) && e[t.tagName](t, n, r);
362
362
  }
363
363
  }
364
364
  //#endregion
365
365
  //#region ../node_modules/hast-util-to-html/lib/omission/closing.js
366
366
  var B = z({
367
- body: be,
367
+ body: Se,
368
368
  caption: V,
369
369
  colgroup: V,
370
- dd: we,
371
- dt: Ce,
370
+ dd: Ee,
371
+ dt: Te,
372
372
  head: V,
373
- html: ye,
374
- li: Se,
375
- optgroup: Te,
376
- option: Ee,
377
- p: xe,
373
+ html: xe,
374
+ li: we,
375
+ optgroup: De,
376
+ option: Oe,
377
+ p: Ce,
378
378
  rp: H,
379
379
  rt: H,
380
- tbody: Oe,
380
+ tbody: ke,
381
381
  td: W,
382
- tfoot: ke,
382
+ tfoot: Ae,
383
383
  th: W,
384
- thead: De,
385
- tr: U
384
+ thead: U,
385
+ tr: je
386
386
  });
387
- function V(e, t, n) {
388
- let r = I(n, t, !0);
389
- return !r || r.type !== "comment" && !(r.type === "text" && f(r.value.charAt(0)));
387
+ function V(e, n, r) {
388
+ let i = I(r, n, !0);
389
+ return !i || i.type !== "comment" && !(i.type === "text" && t(i.value.charAt(0)));
390
390
  }
391
- function ye(e, t, n) {
391
+ function xe(e, t, n) {
392
392
  let r = I(n, t);
393
393
  return !r || r.type !== "comment";
394
394
  }
395
- function be(e, t, n) {
395
+ function Se(e, t, n) {
396
396
  let r = I(n, t);
397
397
  return !r || r.type !== "comment";
398
398
  }
399
- function xe(e, t, n) {
399
+ function Ce(e, t, n) {
400
400
  let r = I(n, t);
401
401
  return r ? r.type === "element" && (r.tagName === "address" || r.tagName === "article" || r.tagName === "aside" || r.tagName === "blockquote" || r.tagName === "details" || r.tagName === "div" || r.tagName === "dl" || r.tagName === "fieldset" || r.tagName === "figcaption" || r.tagName === "figure" || r.tagName === "footer" || r.tagName === "form" || r.tagName === "h1" || r.tagName === "h2" || r.tagName === "h3" || r.tagName === "h4" || r.tagName === "h5" || r.tagName === "h6" || r.tagName === "header" || r.tagName === "hgroup" || r.tagName === "hr" || r.tagName === "main" || r.tagName === "menu" || r.tagName === "nav" || r.tagName === "ol" || r.tagName === "p" || r.tagName === "pre" || r.tagName === "section" || r.tagName === "table" || r.tagName === "ul") : !n || n.type !== "element" || n.tagName !== "a" && n.tagName !== "audio" && n.tagName !== "del" && n.tagName !== "ins" && n.tagName !== "map" && n.tagName !== "noscript" && n.tagName !== "video";
402
402
  }
403
- function Se(e, t, n) {
403
+ function we(e, t, n) {
404
404
  let r = I(n, t);
405
405
  return !r || r.type === "element" && r.tagName === "li";
406
406
  }
407
- function Ce(e, t, n) {
407
+ function Te(e, t, n) {
408
408
  let r = I(n, t);
409
409
  return !(!r || r.type !== "element" || r.tagName !== "dt" && r.tagName !== "dd");
410
410
  }
411
- function we(e, t, n) {
411
+ function Ee(e, t, n) {
412
412
  let r = I(n, t);
413
413
  return !r || r.type === "element" && (r.tagName === "dt" || r.tagName === "dd");
414
414
  }
@@ -416,26 +416,26 @@ function H(e, t, n) {
416
416
  let r = I(n, t);
417
417
  return !r || r.type === "element" && (r.tagName === "rp" || r.tagName === "rt");
418
418
  }
419
- function Te(e, t, n) {
419
+ function De(e, t, n) {
420
420
  let r = I(n, t);
421
421
  return !r || r.type === "element" && r.tagName === "optgroup";
422
422
  }
423
- function Ee(e, t, n) {
423
+ function Oe(e, t, n) {
424
424
  let r = I(n, t);
425
425
  return !r || r.type === "element" && (r.tagName === "option" || r.tagName === "optgroup");
426
426
  }
427
- function De(e, t, n) {
427
+ function U(e, t, n) {
428
428
  let r = I(n, t);
429
429
  return !(!r || r.type !== "element" || r.tagName !== "tbody" && r.tagName !== "tfoot");
430
430
  }
431
- function Oe(e, t, n) {
431
+ function ke(e, t, n) {
432
432
  let r = I(n, t);
433
433
  return !r || r.type === "element" && (r.tagName === "tbody" || r.tagName === "tfoot");
434
434
  }
435
- function ke(e, t, n) {
435
+ function Ae(e, t, n) {
436
436
  return !I(n, t);
437
437
  }
438
- function U(e, t, n) {
438
+ function je(e, t, n) {
439
439
  let r = I(n, t);
440
440
  return !r || r.type === "element" && r.tagName === "tr";
441
441
  }
@@ -445,18 +445,18 @@ function W(e, t, n) {
445
445
  }
446
446
  //#endregion
447
447
  //#region ../node_modules/hast-util-to-html/lib/omission/opening.js
448
- var Ae = z({
449
- body: Ne,
450
- colgroup: Pe,
451
- head: Me,
452
- html: je,
453
- tbody: Fe
448
+ var Me = z({
449
+ body: Fe,
450
+ colgroup: Ie,
451
+ head: Pe,
452
+ html: Ne,
453
+ tbody: Le
454
454
  });
455
- function je(e) {
455
+ function Ne(e) {
456
456
  let t = I(e, -1);
457
457
  return !t || t.type !== "comment";
458
458
  }
459
- function Me(e) {
459
+ function Pe(e) {
460
460
  let t = /* @__PURE__ */ new Set();
461
461
  for (let n of e.children) if (n.type === "element" && (n.tagName === "base" || n.tagName === "title")) {
462
462
  if (t.has(n.tagName)) return !1;
@@ -465,15 +465,15 @@ function Me(e) {
465
465
  let n = e.children[0];
466
466
  return !n || n.type === "element";
467
467
  }
468
- function Ne(e) {
469
- let t = I(e, -1, !0);
470
- return !t || t.type !== "comment" && !(t.type === "text" && f(t.value.charAt(0))) && (t.type !== "element" || t.tagName !== "meta" && t.tagName !== "link" && t.tagName !== "script" && t.tagName !== "style" && t.tagName !== "template");
468
+ function Fe(e) {
469
+ let n = I(e, -1, !0);
470
+ return !n || n.type !== "comment" && !(n.type === "text" && t(n.value.charAt(0))) && (n.type !== "element" || n.tagName !== "meta" && n.tagName !== "link" && n.tagName !== "script" && n.tagName !== "style" && n.tagName !== "template");
471
471
  }
472
- function Pe(e, t, n) {
472
+ function Ie(e, t, n) {
473
473
  let r = L(n, t), i = I(e, -1, !0);
474
474
  return n && r && r.type === "element" && r.tagName === "colgroup" && B(r, n.children.indexOf(r), n) ? !1 : !!(i && i.type === "element" && i.tagName === "col");
475
475
  }
476
- function Fe(e, t, n) {
476
+ function Le(e, t, n) {
477
477
  let r = L(n, t), i = I(e, -1);
478
478
  return n && r && r.type === "element" && (r.tagName === "thead" || r.tagName === "tbody") && B(r, n.children.indexOf(r), n) ? !1 : !!(i && i.type === "element" && i.tagName === "tr");
479
479
  }
@@ -485,17 +485,17 @@ var G = {
485
485
  single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]],
486
486
  double: [["\"&".split(""), "\"&'`".split("")], ["\0\"&".split(""), "\0\"&'`".split("")]]
487
487
  };
488
- function Ie(e, t, n, i) {
488
+ function Re(e, t, n, i) {
489
489
  let a = i.schema, o = a.space !== "svg" && i.settings.omitOptionalTags, s = a.space === "svg" ? i.settings.closeEmptyElements : i.settings.voids.includes(e.tagName.toLowerCase()), c = [], l;
490
490
  a.space === "html" && e.tagName === "svg" && (i.schema = r);
491
- let u = Le(i, e.properties), d = i.all(a.space === "html" && e.tagName === "template" ? e.content : e);
492
- return i.schema = a, d && (s = !1), (u || !o || !Ae(e, t, n)) && (c.push("<", e.tagName, u ? " " + u : ""), s && (a.space === "svg" || i.settings.closeSelfClosing) && (l = u.charAt(u.length - 1), (!i.settings.tightSelfClosing || l === "/" || l && l !== "\"" && l !== "'") && c.push(" "), c.push("/")), c.push(">")), c.push(d), !s && (!o || !B(e, t, n)) && c.push("</" + e.tagName + ">"), c.join("");
491
+ let u = ze(i, e.properties), d = i.all(a.space === "html" && e.tagName === "template" ? e.content : e);
492
+ return i.schema = a, d && (s = !1), (u || !o || !Me(e, t, n)) && (c.push("<", e.tagName, u ? " " + u : ""), s && (a.space === "svg" || i.settings.closeSelfClosing) && (l = u.charAt(u.length - 1), (!i.settings.tightSelfClosing || l === "/" || l && l !== "\"" && l !== "'") && c.push(" "), c.push("/")), c.push(">")), c.push(d), !s && (!o || !B(e, t, n)) && c.push("</" + e.tagName + ">"), c.join("");
493
493
  }
494
- function Le(e, t) {
494
+ function ze(e, t) {
495
495
  let n = [], r = -1, i;
496
496
  if (t) {
497
497
  for (i in t) if (t[i] !== null && t[i] !== void 0) {
498
- let r = Re(e, i, t[i]);
498
+ let r = Be(e, i, t[i]);
499
499
  r && n.push(r);
500
500
  }
501
501
  }
@@ -505,63 +505,63 @@ function Le(e, t) {
505
505
  }
506
506
  return n.join("");
507
507
  }
508
- function Re(t, n, r) {
509
- let i = e(t.schema, n), a = t.settings.allowParseErrors && t.schema.space === "html" ? 0 : 1, s = +!t.settings.allowDangerousCharacters, c = t.quote, l;
508
+ function Be(t, n, r) {
509
+ let i = f(t.schema, n), a = t.settings.allowParseErrors && t.schema.space === "html" ? 0 : 1, o = +!t.settings.allowDangerousCharacters, s = t.quote, c;
510
510
  if (i.overloadedBoolean && (r === i.attribute || r === "") ? r = !0 : (i.boolean || i.overloadedBoolean) && (typeof r != "string" || r === i.attribute || r === "") && (r = !!r), r == null || r === !1 || typeof r == "number" && Number.isNaN(r)) return "";
511
- let u = A(i.attribute, Object.assign({}, t.settings.characterReferences, { subset: G.name[a][s] }));
512
- return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ? p : o)(r, { padLeft: !t.settings.tightCommaSeparatedLists }) : String(r), t.settings.collapseEmptyAttributes && !r) ? u : (t.settings.preferUnquoted && (l = A(r, Object.assign({}, t.settings.characterReferences, {
511
+ let l = A(i.attribute, Object.assign({}, t.settings.characterReferences, { subset: G.name[a][o] }));
512
+ return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ? e : d)(r, { padLeft: !t.settings.tightCommaSeparatedLists }) : String(r), t.settings.collapseEmptyAttributes && !r) ? l : (t.settings.preferUnquoted && (c = A(r, Object.assign({}, t.settings.characterReferences, {
513
513
  attribute: !0,
514
- subset: G.unquoted[a][s]
515
- }))), l !== r && (t.settings.quoteSmart && _(r, c) > _(r, t.alternative) && (c = t.alternative), l = c + A(r, Object.assign({}, t.settings.characterReferences, {
516
- subset: (c === "'" ? G.single : G.double)[a][s],
514
+ subset: G.unquoted[a][o]
515
+ }))), c !== r && (t.settings.quoteSmart && g(r, s) > g(r, t.alternative) && (s = t.alternative), c = s + A(r, Object.assign({}, t.settings.characterReferences, {
516
+ subset: (s === "'" ? G.single : G.double)[a][o],
517
517
  attribute: !0
518
- })) + c), u + (l && "=" + l));
518
+ })) + s), l + (c && "=" + c));
519
519
  }
520
520
  //#endregion
521
521
  //#region ../node_modules/hast-util-to-html/lib/handle/text.js
522
- var ze = ["<", "&"];
522
+ var Ve = ["<", "&"];
523
523
  function K(e, t, n, r) {
524
- return n && n.type === "element" && (n.tagName === "script" || n.tagName === "style") ? e.value : A(e.value, Object.assign({}, r.settings.characterReferences, { subset: ze }));
524
+ return n && n.type === "element" && (n.tagName === "script" || n.tagName === "style") ? e.value : A(e.value, Object.assign({}, r.settings.characterReferences, { subset: Ve }));
525
525
  }
526
526
  //#endregion
527
527
  //#region ../node_modules/hast-util-to-html/lib/handle/raw.js
528
- function Be(e, t, n, r) {
528
+ function He(e, t, n, r) {
529
529
  return r.settings.allowDangerousHtml ? e.value : K(e, t, n, r);
530
530
  }
531
531
  //#endregion
532
532
  //#region ../node_modules/hast-util-to-html/lib/handle/root.js
533
- function Ve(e, t, n, r) {
533
+ function Ue(e, t, n, r) {
534
534
  return r.all(e);
535
535
  }
536
536
  //#endregion
537
537
  //#region ../node_modules/hast-util-to-html/lib/handle/index.js
538
- var He = d("type", {
539
- invalid: Ue,
540
- unknown: We,
538
+ var We = s("type", {
539
+ invalid: Ge,
540
+ unknown: Ke,
541
541
  handlers: {
542
542
  comment: P,
543
543
  doctype: F,
544
- element: Ie,
545
- raw: Be,
546
- root: Ve,
544
+ element: Re,
545
+ raw: He,
546
+ root: Ue,
547
547
  text: K
548
548
  }
549
549
  });
550
- function Ue(e) {
550
+ function Ge(e) {
551
551
  throw Error("Expected node, not `" + e + "`");
552
552
  }
553
- function We(e) {
553
+ function Ke(e) {
554
554
  throw Error("Cannot compile unknown node `" + e.type + "`");
555
555
  }
556
556
  //#endregion
557
557
  //#region ../node_modules/hast-util-to-html/lib/index.js
558
- var Ge = {}, Ke = {}, qe = [];
559
- function Je(e, t) {
560
- let n = t || Ge, o = n.quote || "\"", s = o === "\"" ? "'" : "\"";
561
- if (o !== "\"" && o !== "'") throw Error("Invalid quote `" + o + "`, expected `'` or `\"`");
558
+ var qe = {}, Je = {}, Ye = [];
559
+ function Xe(e, t) {
560
+ let n = t || qe, i = n.quote || "\"", a = i === "\"" ? "'" : "\"";
561
+ if (i !== "\"" && i !== "'") throw Error("Invalid quote `" + i + "`, expected `'` or `\"`");
562
562
  return {
563
- one: Ye,
564
- all: Xe,
563
+ one: Ze,
564
+ all: Qe,
565
565
  settings: {
566
566
  omitOptionalTags: n.omitOptionalTags || !1,
567
567
  allowParseErrors: n.allowParseErrors || !1,
@@ -576,43 +576,56 @@ function Je(e, t) {
576
576
  tightSelfClosing: n.tightSelfClosing || !1,
577
577
  collapseEmptyAttributes: n.collapseEmptyAttributes || !1,
578
578
  allowDangerousHtml: n.allowDangerousHtml || !1,
579
- voids: n.voids || a,
580
- characterReferences: n.characterReferences || Ke,
579
+ voids: n.voids || u,
580
+ characterReferences: n.characterReferences || Je,
581
581
  closeSelfClosing: n.closeSelfClosing || !1,
582
582
  closeEmptyElements: n.closeEmptyElements || !1
583
583
  },
584
- schema: n.space === "svg" ? r : i,
585
- quote: o,
586
- alternative: s
584
+ schema: n.space === "svg" ? r : p,
585
+ quote: i,
586
+ alternative: a
587
587
  }.one(Array.isArray(e) ? {
588
588
  type: "root",
589
589
  children: e
590
590
  } : e, void 0, void 0);
591
591
  }
592
- function Ye(e, t, n) {
593
- return He(e, t, n, this);
592
+ function Ze(e, t, n) {
593
+ return We(e, t, n, this);
594
594
  }
595
- function Xe(e) {
596
- let t = [], n = e && e.children || qe, r = -1;
595
+ function Qe(e) {
596
+ let t = [], n = e && e.children || Ye, r = -1;
597
597
  for (; ++r < n.length;) t[r] = this.one(n[r], r, e);
598
598
  return t.join("");
599
599
  }
600
600
  //#endregion
601
601
  //#region ../ui/src/export/conversationHtml.ts
602
- var Ze = class extends Error {
602
+ var $e = class extends Error {
603
603
  bytes;
604
604
  budgetBytes;
605
605
  constructor(e, t) {
606
606
  super(`the conversation's images come to ${Math.round(e / 1024)} kB, over the ${Math.round(t / 1024)} kB this export embeds`), this.name = "ExportBudgetError", this.bytes = e, this.budgetBytes = t;
607
607
  }
608
- }, q = h().use(te).use(g).use(ee).use(l, { allowDangerousHtml: !0 }).use(t).use(u, c).use(n, { output: "mathml" });
609
- function Qe(e) {
608
+ }, q = h().use(ne).use(ee).use(te).use(n, { allowDangerousHtml: !0 }).use(a).use(i, l).use(o, { output: "mathml" });
609
+ function et(e) {
610
610
  let t = e.properties?.className;
611
611
  return (Array.isArray(t) ? t.map(String) : typeof t == "string" ? [t] : []).find((e) => e.startsWith("language-"))?.slice(9);
612
612
  }
613
613
  async function J(e, t, n) {
614
614
  if (e.tagName === "img") {
615
- let r = typeof e.properties?.src == "string" ? e.properties.src : "", i = r ? await t.loadImage(r) : void 0;
615
+ let r = typeof e.properties?.src == "string" ? e.properties.src : "";
616
+ if (le(r)) {
617
+ let t = typeof e.properties?.alt == "string" ? e.properties.alt : "";
618
+ return {
619
+ type: "element",
620
+ tagName: "a",
621
+ properties: { href: r },
622
+ children: [{
623
+ type: "text",
624
+ value: ae(r, t)
625
+ }]
626
+ };
627
+ }
628
+ let i = r ? await t.loadImage(r) : void 0;
616
629
  if (!i) return {
617
630
  type: "element",
618
631
  tagName: "em",
@@ -624,7 +637,7 @@ async function J(e, t, n) {
624
637
  };
625
638
  n.bytes += i.bytes;
626
639
  let a = t.budgetBytes ?? 41943040;
627
- if (n.bytes > a) throw new Ze(n.bytes, a);
640
+ if (n.bytes > a) throw new $e(n.bytes, a);
628
641
  return {
629
642
  ...e,
630
643
  properties: {
@@ -636,7 +649,7 @@ async function J(e, t, n) {
636
649
  }
637
650
  if (e.tagName === "pre" && e.children?.length === 1 && e.children[0].tagName === "code") {
638
651
  let r = e.children[0];
639
- if (Qe(r) === "mermaid" && t.renderDiagram) {
652
+ if (et(r) === "mermaid" && t.renderDiagram) {
640
653
  let e = Y(r);
641
654
  n.diagrams += 1;
642
655
  let i = await t.renderDiagram(e, `pi-export-diagram-${n.diagrams}`);
@@ -663,16 +676,16 @@ function Y(e) {
663
676
  return e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Y).join("");
664
677
  }
665
678
  async function X(e, t, n) {
666
- return Je(await J(await q.run(q.parse(m(e))), t, n), { allowDangerousHtml: !0 });
679
+ return Xe(await J(await q.run(q.parse(m(e))), t, n), { allowDangerousHtml: !0 });
667
680
  }
668
681
  function Z(e) {
669
682
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
670
683
  }
671
- var $e = ":root {\n --bg: #ffffff; --fg: #18181b; --muted: #71717a; --line: #e4e4e7;\n --user-bg: #eff6ff; --tool-bg: #fafafa; --mark-bg: #fffbeb; --mark-fg: #92400e;\n}\n@media (prefers-color-scheme: dark) {\n :root {\n --bg: #18181b; --fg: #e4e4e7; --muted: #a1a1aa; --line: #3f3f46;\n --user-bg: #1e293b; --tool-bg: #27272a; --mark-bg: #292524; --mark-fg: #fcd34d;\n }\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0; padding: 2rem 1rem; background: var(--bg); color: var(--fg);\n font: 16px/1.6 -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n}\nmain { max-width: 46rem; margin: 0 auto; }\nheader.doc { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 2rem; }\nheader.doc h1 { font-size: 1.4rem; margin: 0 0 0.35rem; }\nheader.doc dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0; font-size: 0.85rem; color: var(--muted); }\nheader.doc dt { font-weight: 600; }\nheader.doc dd { margin: 0; }\narticle { margin: 1.25rem 0; }\narticle > .who { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.3rem; }\narticle.user .body { background: var(--user-bg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; }\narticle.reasoning .body { border-left: 2px solid var(--line); padding-left: 0.9rem; color: var(--muted); font-style: italic; }\ndetails.tool { background: var(--tool-bg); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.4rem 0.7rem; }\ndetails.tool > summary { cursor: pointer; font-size: 0.85rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }\ndetails.tool pre { white-space: pre-wrap; word-break: break-word; }\n.compaction { display: flex; align-items: center; gap: 0.6rem; margin: 2rem 0; color: var(--mark-fg); font-size: 0.8rem; }\n.compaction::before, .compaction::after { content: \"\"; flex: 1; height: 1px; background: currentColor; opacity: 0.4; }\n.compaction-summary { background: var(--mark-bg); color: var(--fg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; font-size: 0.9rem; }\npre { background: var(--tool-bg); border-radius: 0.5rem; padding: 0.7rem; overflow-x: auto; }\ncode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }\nimg, svg { max-width: 100%; height: auto; }\nfigure.diagram { margin: 1rem 0; overflow-x: auto; }\ntable { border-collapse: collapse; width: 100%; }\nth, td { border: 1px solid var(--line); padding: 0.3rem 0.5rem; text-align: left; }\nblockquote { margin: 0.8rem 0; padding-left: 0.9rem; border-left: 3px solid var(--line); color: var(--muted); }\nfooter.doc { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 0.8rem; font-size: 0.75rem; color: var(--muted); }", Q = {
684
+ var tt = ":root {\n --bg: #ffffff; --fg: #18181b; --muted: #71717a; --line: #e4e4e7;\n --user-bg: #eff6ff; --tool-bg: #fafafa; --mark-bg: #fffbeb; --mark-fg: #92400e;\n}\n@media (prefers-color-scheme: dark) {\n :root {\n --bg: #18181b; --fg: #e4e4e7; --muted: #a1a1aa; --line: #3f3f46;\n --user-bg: #1e293b; --tool-bg: #27272a; --mark-bg: #292524; --mark-fg: #fcd34d;\n }\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0; padding: 2rem 1rem; background: var(--bg); color: var(--fg);\n font: 16px/1.6 -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n}\nmain { max-width: 46rem; margin: 0 auto; }\nheader.doc { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 2rem; }\nheader.doc h1 { font-size: 1.4rem; margin: 0 0 0.35rem; }\nheader.doc dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0; font-size: 0.85rem; color: var(--muted); }\nheader.doc dt { font-weight: 600; }\nheader.doc dd { margin: 0; }\narticle { margin: 1.25rem 0; }\narticle > .who { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.3rem; }\narticle.user .body { background: var(--user-bg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; }\narticle.reasoning .body { border-left: 2px solid var(--line); padding-left: 0.9rem; color: var(--muted); font-style: italic; }\ndetails.tool { background: var(--tool-bg); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.4rem 0.7rem; }\ndetails.tool > summary { cursor: pointer; font-size: 0.85rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }\ndetails.tool pre { white-space: pre-wrap; word-break: break-word; }\n.compaction { display: flex; align-items: center; gap: 0.6rem; margin: 2rem 0; color: var(--mark-fg); font-size: 0.8rem; }\n.compaction::before, .compaction::after { content: \"\"; flex: 1; height: 1px; background: currentColor; opacity: 0.4; }\n.compaction-summary { background: var(--mark-bg); color: var(--fg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; font-size: 0.9rem; }\npre { background: var(--tool-bg); border-radius: 0.5rem; padding: 0.7rem; overflow-x: auto; }\ncode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }\nimg, svg { max-width: 100%; height: auto; }\nfigure.diagram { margin: 1rem 0; overflow-x: auto; }\ntable { border-collapse: collapse; width: 100%; }\nth, td { border: 1px solid var(--line); padding: 0.3rem 0.5rem; text-align: left; }\nblockquote { margin: 0.8rem 0; padding-left: 0.9rem; border-left: 3px solid var(--line); color: var(--muted); }\nfooter.doc { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 0.8rem; font-size: 0.75rem; color: var(--muted); }", Q = {
672
685
  user: "You",
673
686
  assistant: "Agent"
674
687
  };
675
- async function et(e, t, n) {
688
+ async function nt(e, t, n) {
676
689
  switch (e.kind) {
677
690
  case "user": {
678
691
  let r = (e.images ?? []).map((e) => `<img src="data:${Z(e.mimeType)};base64,${e.data}" alt="attached image" />`).join("\n"), i = await X(e.text, t, n);
@@ -704,12 +717,12 @@ async function et(e, t, n) {
704
717
  }
705
718
  }
706
719
  }
707
- async function tt(e, t) {
720
+ async function rt(e, t) {
708
721
  let n = {
709
722
  bytes: 0,
710
723
  diagrams: 0
711
724
  }, r = [];
712
- for (let [i, a] of e.entries()) r.push(await et(a, t, n)), t.onProgress?.(i + 1, e.length);
725
+ for (let [i, a] of e.entries()) r.push(await nt(a, t, n)), t.onProgress?.(i + 1, e.length);
713
726
  let { meta: i } = t, a = i.project ? `${i.session} — ${i.project}` : i.session, o = [];
714
727
  return i.project && o.push(`<dt>Project</dt><dd>${Z(i.project)}</dd>`), o.push(`<dt>Session</dt><dd>${Z(i.session)}</dd>`), i.model && o.push(`<dt>Model</dt><dd>${Z(i.model)}</dd>`), o.push(`<dt>Exported</dt><dd>${Z(i.exportedAt.toISOString().slice(0, 10))}</dd>`), o.push(`<dt>Messages</dt><dd>${e.length}</dd>`), `<!doctype html>
715
728
  <html lang="en">
@@ -718,7 +731,7 @@ async function tt(e, t) {
718
731
  <meta name="viewport" content="width=device-width, initial-scale=1" />
719
732
  <title>${Z(a)}</title>
720
733
  <style>
721
- ${$e}
734
+ ${tt}
722
735
  </style>
723
736
  </head>
724
737
  <body>
@@ -741,17 +754,17 @@ var $ = class extends Error {
741
754
  super(e), this.name = "ConversationExportError";
742
755
  }
743
756
  };
744
- async function nt(e) {
757
+ async function it(e) {
745
758
  let t = /* @__PURE__ */ new Map();
746
759
  return async (n) => {
747
760
  if (t.has(n)) return t.get(n);
748
- let r = se("", n, e.serverUrl, e.token, e.workspace), i;
761
+ let r = _("", n, e.serverUrl, e.token, e.workspace), i;
749
762
  if (r !== void 0) try {
750
763
  let e = await fetch(r);
751
764
  if (e.ok) {
752
765
  let t = new Uint8Array(await e.arrayBuffer());
753
766
  i = {
754
- dataUrl: `data:${e.headers.get("content-type") ?? "application/octet-stream"};base64,${rt(t)}`,
767
+ dataUrl: `data:${e.headers.get("content-type") ?? "application/octet-stream"};base64,${at(t)}`,
755
768
  bytes: t.byteLength
756
769
  };
757
770
  }
@@ -761,45 +774,45 @@ async function nt(e) {
761
774
  return t.set(n, i), i;
762
775
  };
763
776
  }
764
- function rt(e) {
777
+ function at(e) {
765
778
  let t = "", n = 32768;
766
779
  for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
767
780
  return btoa(t);
768
781
  }
769
- async function it(e, t) {
782
+ async function ot(e, t) {
770
783
  try {
771
- let { svg: n } = await re(e, t), { width: r, height: i } = ae(n);
772
- return ie(oe(n, r, i));
784
+ let { svg: n } = await ie(e, t), { width: r, height: i } = se(n);
785
+ return oe(ce(n, r, i));
773
786
  } catch {
774
787
  return;
775
788
  }
776
789
  }
777
- function at(e, t) {
790
+ function st(e, t) {
778
791
  let n = e.normalize("NFKD").replace(/[^\p{L}\p{N}\s-]/gu, "").trim().replace(/\s+/g, "-").slice(0, 60), r = t.toISOString().slice(0, 10);
779
792
  return `${n || "conversation"}-${r}.html`;
780
793
  }
781
- async function ot(e) {
794
+ async function ct(e) {
782
795
  if (e.items.length === 0) throw new $("there is no conversation to export yet");
783
796
  let t = [];
784
797
  if (e.olderItems > 0) {
785
798
  if (!e.fetchOlderItems) throw new $("this conversation has been compacted and the agent runtime cannot read back what it removed, so it cannot be exported in full");
786
799
  try {
787
- t = await s(e.fetchOlderItems, (t) => e.onProgress?.("collecting", t, e.olderItems));
800
+ t = await c(e.fetchOlderItems, (t) => e.onProgress?.("collecting", t, e.olderItems));
788
801
  } catch (e) {
789
802
  throw new $(`the earlier part of the conversation could not be read back, so nothing was exported: ${e instanceof Error ? e.message : String(e)}`);
790
803
  }
791
804
  }
792
- return tt([...t, ...e.items], {
805
+ return rt([...t, ...e.items], {
793
806
  meta: e.meta,
794
- loadImage: await nt(e.connection),
795
- renderDiagram: it,
807
+ loadImage: await it(e.connection),
808
+ renderDiagram: ot,
796
809
  budgetBytes: e.budgetBytes ?? 41943040,
797
810
  onProgress: (t, n) => e.onProgress?.("rendering", t, n)
798
811
  });
799
812
  }
800
- async function st(e) {
801
- let t = await ot(e);
802
- ne(new Blob([t], { type: "text/html;charset=utf-8" }), at(e.meta.session, e.meta.exportedAt));
813
+ async function lt(e) {
814
+ let t = await ct(e);
815
+ re(new Blob([t], { type: "text/html;charset=utf-8" }), st(e.meta.session, e.meta.exportedAt));
803
816
  }
804
817
  //#endregion
805
- export { st as exportConversation };
818
+ export { lt as exportConversation };