@pixerate/editor 0.47.0 → 0.49.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.
Files changed (91) hide show
  1. package/dist/agent/index.cjs +248 -29
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.d.cts +18 -6
  4. package/dist/agent/index.d.ts +18 -6
  5. package/dist/agent/index.js +228 -9
  6. package/dist/agent/index.js.map +1 -1
  7. package/dist/{builtins-xs7rK6ys.d.cts → builtins-1kqwLUnb.d.cts} +1 -1
  8. package/dist/{builtins-D2nMtw2W.d.ts → builtins-BKYlHH1s.d.ts} +1 -1
  9. package/dist/chart/index.cjs +216 -3541
  10. package/dist/chart/index.cjs.map +1 -1
  11. package/dist/chart/index.d.cts +4 -494
  12. package/dist/chart/index.d.ts +4 -494
  13. package/dist/chart/index.js +155 -3480
  14. package/dist/chart/index.js.map +1 -1
  15. package/dist/{chunk-5VXI5GED.js → chunk-2CJ3LPYQ.js} +3 -3
  16. package/dist/{chunk-TXXNBDQX.cjs → chunk-2Q46FKZK.cjs} +113 -34
  17. package/dist/chunk-2Q46FKZK.cjs.map +1 -0
  18. package/dist/chunk-3JNRQVTS.cjs +521 -0
  19. package/dist/chunk-3JNRQVTS.cjs.map +1 -0
  20. package/dist/chunk-5TWIN7ZJ.js +113 -0
  21. package/dist/chunk-5TWIN7ZJ.js.map +1 -0
  22. package/dist/{chunk-PQFAHT5O.js → chunk-DQPBQXKG.js} +27 -94
  23. package/dist/chunk-DQPBQXKG.js.map +1 -0
  24. package/dist/{chunk-ZFBBVGCI.js → chunk-EKYHKQPG.js} +243 -243
  25. package/dist/{chunk-ZFBBVGCI.js.map → chunk-EKYHKQPG.js.map} +1 -1
  26. package/dist/{chunk-J3R2OWOE.cjs → chunk-FEMIVHN3.cjs} +610 -15
  27. package/dist/chunk-FEMIVHN3.cjs.map +1 -0
  28. package/dist/{chunk-C3NWJE3K.js → chunk-GJBIVWB2.js} +11 -672
  29. package/dist/chunk-GJBIVWB2.js.map +1 -0
  30. package/dist/chunk-GTZXF4BI.cjs +3424 -0
  31. package/dist/chunk-GTZXF4BI.cjs.map +1 -0
  32. package/dist/chunk-JOX6MJW4.cjs +674 -0
  33. package/dist/chunk-JOX6MJW4.cjs.map +1 -0
  34. package/dist/{chunk-REAGGLXS.js → chunk-JQ3BB3E6.js} +2 -2
  35. package/dist/{chunk-H4PICYNL.cjs → chunk-LNKZPIQD.cjs} +113 -180
  36. package/dist/chunk-LNKZPIQD.cjs.map +1 -0
  37. package/dist/chunk-OV7UAKIY.js +674 -0
  38. package/dist/chunk-OV7UAKIY.js.map +1 -0
  39. package/dist/{chunk-TK2XZK6Z.js → chunk-QFTVLEVN.js} +596 -1
  40. package/dist/chunk-QFTVLEVN.js.map +1 -0
  41. package/dist/{chunk-KRGXUQ2Y.js → chunk-T6XU4B54.js} +82 -3
  42. package/dist/chunk-T6XU4B54.js.map +1 -0
  43. package/dist/chunk-TGBCBQFV.cjs +113 -0
  44. package/dist/chunk-TGBCBQFV.cjs.map +1 -0
  45. package/dist/{chunk-SQC26VQV.cjs → chunk-UN33YOXW.cjs} +191 -191
  46. package/dist/{chunk-SQC26VQV.cjs.map → chunk-UN33YOXW.cjs.map} +1 -1
  47. package/dist/chunk-WBOAXDKD.js +3424 -0
  48. package/dist/chunk-WBOAXDKD.js.map +1 -0
  49. package/dist/{chunk-LYGEEDNR.cjs → chunk-XP5IUZUO.cjs} +242 -242
  50. package/dist/chunk-XP5IUZUO.cjs.map +1 -0
  51. package/dist/{chunk-BBRK6MOI.cjs → chunk-YU4WQE5M.cjs} +100 -100
  52. package/dist/{chunk-BBRK6MOI.cjs.map → chunk-YU4WQE5M.cjs.map} +1 -1
  53. package/dist/commands/index.d.cts +1 -1
  54. package/dist/commands/index.d.ts +1 -1
  55. package/dist/controller-ChjCCMLl.d.cts +822 -0
  56. package/dist/controller-DtbEo3om.d.ts +822 -0
  57. package/dist/export/index.cjs +4 -2
  58. package/dist/export/index.cjs.map +1 -1
  59. package/dist/export/index.d.cts +5 -1
  60. package/dist/export/index.d.ts +5 -1
  61. package/dist/export/index.js +3 -1
  62. package/dist/extensions/index.cjs +33 -4
  63. package/dist/extensions/index.cjs.map +1 -1
  64. package/dist/extensions/index.d.cts +4 -2
  65. package/dist/extensions/index.d.ts +4 -2
  66. package/dist/extensions/index.js +32 -3
  67. package/dist/{index-QrqMmZ75.d.cts → index-DoHqT1mq.d.cts} +203 -7
  68. package/dist/{index-CSUCQYAH.d.ts → index-YLZ0fKqE.d.ts} +203 -7
  69. package/dist/index.cjs +39 -13
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +9 -7
  72. package/dist/index.d.ts +9 -7
  73. package/dist/index.js +33 -7
  74. package/dist/index.js.map +1 -1
  75. package/dist/spreadsheet/index.cjs +4 -4
  76. package/dist/spreadsheet/index.js +3 -3
  77. package/package.json +1 -1
  78. package/dist/chunk-C3NWJE3K.js.map +0 -1
  79. package/dist/chunk-H4PICYNL.cjs.map +0 -1
  80. package/dist/chunk-J3R2OWOE.cjs.map +0 -1
  81. package/dist/chunk-KRGXUQ2Y.js.map +0 -1
  82. package/dist/chunk-LYGEEDNR.cjs.map +0 -1
  83. package/dist/chunk-NEOO6QJD.cjs +0 -1182
  84. package/dist/chunk-NEOO6QJD.cjs.map +0 -1
  85. package/dist/chunk-PQFAHT5O.js.map +0 -1
  86. package/dist/chunk-TK2XZK6Z.js.map +0 -1
  87. package/dist/chunk-TXXNBDQX.cjs.map +0 -1
  88. package/dist/types-BVqWm3d1.d.cts +0 -320
  89. package/dist/types-BVqWm3d1.d.ts +0 -320
  90. /package/dist/{chunk-5VXI5GED.js.map → chunk-2CJ3LPYQ.js.map} +0 -0
  91. /package/dist/{chunk-REAGGLXS.js.map → chunk-JQ3BB3E6.js.map} +0 -0
@@ -9,7 +9,7 @@ import {
9
9
  parseFormula,
10
10
  searchFormulaFunctions,
11
11
  tokenizeFormula
12
- } from "./chunk-REAGGLXS.js";
12
+ } from "./chunk-JQ3BB3E6.js";
13
13
  import {
14
14
  NumberFormat,
15
15
  colNameToIndex,
@@ -27,7 +27,7 @@ import {
27
27
  sortCompareValues,
28
28
  toBoolean,
29
29
  toText
30
- } from "./chunk-ZFBBVGCI.js";
30
+ } from "./chunk-EKYHKQPG.js";
31
31
  import {
32
32
  parseCsv,
33
33
  parseTsv,
@@ -6803,4 +6803,4 @@ export {
6803
6803
  getSpreadsheetScrollToCell,
6804
6804
  sameSpreadsheetViewWindow
6805
6805
  };
6806
- //# sourceMappingURL=chunk-5VXI5GED.js.map
6806
+ //# sourceMappingURL=chunk-2CJ3LPYQ.js.map
@@ -5,6 +5,15 @@
5
5
 
6
6
  var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
7
7
 
8
+
9
+
10
+
11
+
12
+ var _chunk3JNRQVTScjs = require('./chunk-3JNRQVTS.cjs');
13
+
14
+
15
+ var _chunkJOX6MJW4cjs = require('./chunk-JOX6MJW4.cjs');
16
+
8
17
  // src/export/images.ts
9
18
  var DOCX_IMAGE_TYPES = {
10
19
  "image/png": "png",
@@ -654,7 +663,7 @@ ${external}`;
654
663
  }
655
664
  }, _class2);
656
665
  var DocxBuilder = (_class3 = class {
657
- constructor(doc, options, threads, styles) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);
666
+ constructor(doc, options, threads, styles) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);_class3.prototype.__init18.call(this);
658
667
  this.doc = doc;
659
668
  this.options = options;
660
669
  this.threads = threads;
@@ -669,23 +678,24 @@ var DocxBuilder = (_class3 = class {
669
678
 
670
679
  __init5() {this.report = {
671
680
  dropped: [],
672
- written: { paragraphs: 0, tables: 0, images: 0, comments: 0, replies: 0, trackedChanges: 0 }
681
+ written: { paragraphs: 0, tables: 0, images: 0, charts: 0, comments: 0, replies: 0, trackedChanges: 0 }
673
682
  }}
674
683
  __init6() {this.rels = new Relationships()}
675
684
  __init7() {this.media = []}
676
685
  __init8() {this.mediaTypes = /* @__PURE__ */ new Set()}
677
- __init9() {this.nums = []}
678
- __init10() {this.revisionId = 0}
679
- __init11() {this.docPrId = 0}
680
- __init12() {this.paraIdCounter = 268435456}
681
- __init13() {this.comments = /* @__PURE__ */ new Map()}
686
+ __init9() {this.charts = []}
687
+ __init10() {this.nums = []}
688
+ __init11() {this.revisionId = 0}
689
+ __init12() {this.docPrId = 0}
690
+ __init13() {this.paraIdCounter = 268435456}
691
+ __init14() {this.comments = /* @__PURE__ */ new Map()}
682
692
  /** Thread id → JSON node carrying its last comment mark. */
683
- __init14() {this.commentEnds = /* @__PURE__ */ new Map()}
693
+ __init15() {this.commentEnds = /* @__PURE__ */ new Map()}
684
694
  /** JSON node → threads whose range ends after it (so ends are found in O(1) per node). */
685
- __init15() {this.endsByNode = /* @__PURE__ */ new Map()}
686
- __init16() {this.people = /* @__PURE__ */ new Map()}
695
+ __init16() {this.endsByNode = /* @__PURE__ */ new Map()}
696
+ __init17() {this.people = /* @__PURE__ */ new Map()}
687
697
 
688
- __init17() {this.extraStyles = /* @__PURE__ */ new Set()}
698
+ __init18() {this.extraStyles = /* @__PURE__ */ new Set()}
689
699
 
690
700
 
691
701
  drop(kind, name, reason) {
@@ -815,6 +825,9 @@ var DocxBuilder = (_class3 = class {
815
825
  case "image":
816
826
  this.paragraph(w, { type: "paragraph", content: [node] }, ctx);
817
827
  return;
828
+ case "chart":
829
+ this.chartParagraph(w, node, ctx);
830
+ return;
818
831
  default:
819
832
  break;
820
833
  }
@@ -935,6 +948,12 @@ var DocxBuilder = (_class3 = class {
935
948
  case "image":
936
949
  out.push({ kind: "image", node, last: true, marks });
937
950
  break;
951
+ case "sparkline": {
952
+ const text = sparklineText(node.attrs);
953
+ this.drop("node", "sparkline", "written as text (its label, or \u2581\u2583\u2587 bars)");
954
+ out.push({ kind: "text", text, node, last: true, marks });
955
+ break;
956
+ }
938
957
  case "mention": {
939
958
  const label = _nullishCoalesce(_nullishCoalesce(_optionalChain([node, 'access', _53 => _53.attrs, 'optionalAccess', _54 => _54.label]), () => ( _optionalChain([node, 'access', _55 => _55.attrs, 'optionalAccess', _56 => _56.id]))), () => ( ""));
940
959
  out.push({ kind: "text", text: label ? `@${label}` : "", node, last: true, marks });
@@ -1149,9 +1168,57 @@ var DocxBuilder = (_class3 = class {
1149
1168
  w.close("pic:pic").close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing");
1150
1169
  return w.toString();
1151
1170
  }
1171
+ // -- Charts -----------------------------------------------------------------
1172
+ /** A `chart` node as a paragraph holding a native Word chart (`c:chart` in `wp:inline`). */
1173
+ chartParagraph(w, node, ctx) {
1174
+ const raw = _optionalChain([node, 'access', _89 => _89.attrs, 'optionalAccess', _90 => _90.spec]);
1175
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
1176
+ this.drop("node", "chart", "chart has no spec");
1177
+ return;
1178
+ }
1179
+ const spec = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, raw).spec;
1180
+ const written = _chunk3JNRQVTScjs.chartToOoxml.call(void 0, spec);
1181
+ for (const issue of written.issues) this.drop("node", "chart", issue);
1182
+ const name = `chart${this.charts.length + 1}.xml`;
1183
+ this.charts.push(written.xml);
1184
+ const relId = this.rels.add(_chunk3JNRQVTScjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
1185
+ let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
1186
+ let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
1187
+ if (width > MAX_IMAGE_WIDTH_PX) {
1188
+ height = height * MAX_IMAGE_WIDTH_PX / width;
1189
+ width = MAX_IMAGE_WIDTH_PX;
1190
+ }
1191
+ const cx = pxToEmu(width);
1192
+ const cy = pxToEmu(height);
1193
+ const id = ++this.docPrId;
1194
+ const title = spec.title || "";
1195
+ this.report.written.charts++;
1196
+ const drawing = new XmlWriter(false);
1197
+ drawing.open("w:r").open("w:drawing").open("wp:inline", { distT: 0, distB: 0, distL: 0, distR: 0 });
1198
+ drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
1199
+ drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
1200
+ drawing.empty("wp:cNvGraphicFramePr");
1201
+ drawing.open("a:graphic").open("a:graphicData", { uri: _chunk3JNRQVTScjs.CHART_OOXML_NS });
1202
+ drawing.empty("c:chart", { "xmlns:c": _chunk3JNRQVTScjs.CHART_OOXML_NS, "r:id": relId });
1203
+ drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
1204
+ this.report.written.paragraphs++;
1205
+ w.open("w:p");
1206
+ const indent = ctx.quoteLevel * INDENT_STEP;
1207
+ const jc = alignment(_optionalChain([node, 'access', _95 => _95.attrs, 'optionalAccess', _96 => _96.textAlign]));
1208
+ if (indent || jc) {
1209
+ w.open("w:pPr");
1210
+ if (indent) w.empty("w:ind", { "w:left": indent });
1211
+ if (jc) w.val("w:jc", jc);
1212
+ w.close("w:pPr");
1213
+ }
1214
+ this.commentStarts(w, _nullishCoalesce(node.marks, () => ( [])));
1215
+ w.raw(drawing.toString());
1216
+ this.commentEndsAfter(w, node);
1217
+ w.close("w:p");
1218
+ }
1152
1219
  // -- Tables -------------------------------------------------------------------
1153
1220
  table(w, node, ctx) {
1154
- const rows = (_nullishCoalesce(node.content, () => ( []))).filter((row) => row.type === "tableRow" || _optionalChain([row, 'access', _89 => _89.content, 'optionalAccess', _90 => _90.length]));
1221
+ const rows = (_nullishCoalesce(node.content, () => ( []))).filter((row) => row.type === "tableRow" || _optionalChain([row, 'access', _97 => _97.content, 'optionalAccess', _98 => _98.length]));
1155
1222
  if (!rows.length) {
1156
1223
  this.drop("node", "table", "empty table");
1157
1224
  return;
@@ -1161,8 +1228,8 @@ var DocxBuilder = (_class3 = class {
1161
1228
  let col = 0;
1162
1229
  for (const cell of _nullishCoalesce(row.content, () => ( []))) {
1163
1230
  while (grid[r][col]) col++;
1164
- const colspan = Math.max(1, Math.min(63, Number(_optionalChain([cell, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.colspan])) || 1));
1165
- const rowspan = Math.max(1, Math.min(rows.length - r, Number(_optionalChain([cell, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.rowspan])) || 1));
1231
+ const colspan = Math.max(1, Math.min(63, Number(_optionalChain([cell, 'access', _99 => _99.attrs, 'optionalAccess', _100 => _100.colspan])) || 1));
1232
+ const rowspan = Math.max(1, Math.min(rows.length - r, Number(_optionalChain([cell, 'access', _101 => _101.attrs, 'optionalAccess', _102 => _102.rowspan])) || 1));
1166
1233
  for (let i = 0; i < rowspan; i++) {
1167
1234
  for (let j = 0; j < colspan; j++) {
1168
1235
  grid[r + i][col + j] = { cell, rowOffset: i, colOffset: j, colspan, rowspan };
@@ -1175,7 +1242,7 @@ var DocxBuilder = (_class3 = class {
1175
1242
  const widths = [];
1176
1243
  for (let c = 0; c < cols; c++) {
1177
1244
  const slot = grid[0][c];
1178
- const colwidth = _optionalChain([slot, 'optionalAccess', _95 => _95.cell, 'access', _96 => _96.attrs, 'optionalAccess', _97 => _97.colwidth]);
1245
+ const colwidth = _optionalChain([slot, 'optionalAccess', _103 => _103.cell, 'access', _104 => _104.attrs, 'optionalAccess', _105 => _105.colwidth]);
1179
1246
  const px = Array.isArray(colwidth) ? Number(colwidth[slot.colOffset]) : NaN;
1180
1247
  widths.push(Number.isFinite(px) && px > 0 ? pxToTwips(px) : 0);
1181
1248
  }
@@ -1206,7 +1273,7 @@ var DocxBuilder = (_class3 = class {
1206
1273
  for (let c = 0; c < cols; c++) {
1207
1274
  const slot = grid[r][c];
1208
1275
  if (slot && slot.colOffset > 0) continue;
1209
- const span = _nullishCoalesce(_optionalChain([slot, 'optionalAccess', _98 => _98.colspan]), () => ( 1));
1276
+ const span = _nullishCoalesce(_optionalChain([slot, 'optionalAccess', _106 => _106.colspan]), () => ( 1));
1210
1277
  const width = widths.slice(c, c + span).reduce((n, v) => n + v, 0);
1211
1278
  w.open("w:tc").open("w:tcPr").empty("w:tcW", { "w:w": width, "w:type": "dxa" });
1212
1279
  if (span > 1) w.val("w:gridSpan", span);
@@ -1217,7 +1284,7 @@ var DocxBuilder = (_class3 = class {
1217
1284
  w.close("w:tcPr");
1218
1285
  const content = slot && slot.rowOffset === 0 ? _nullishCoalesce(slot.cell.content, () => ( [])) : [];
1219
1286
  if (content.length) this.blocks(w, content, cellCtx);
1220
- const lastType = _optionalChain([content, 'access', _99 => _99[content.length - 1], 'optionalAccess', _100 => _100.type]);
1287
+ const lastType = _optionalChain([content, 'access', _107 => _107[content.length - 1], 'optionalAccess', _108 => _108.type]);
1221
1288
  if (!content.length || lastType === "table") w.empty("w:p");
1222
1289
  w.close("w:tc");
1223
1290
  }
@@ -1304,14 +1371,14 @@ var DocxBuilder = (_class3 = class {
1304
1371
  w.val("w:name", fileStyleName(style.name || style.id));
1305
1372
  const base = style.basedOn && byId.has(style.basedOn) && byId.get(style.basedOn).kind === style.kind ? style.basedOn : void 0;
1306
1373
  if (base) w.val("w:basedOn", base);
1307
- if (style.kind === "paragraph" && style.next && _optionalChain([byId, 'access', _101 => _101.get, 'call', _102 => _102(style.next), 'optionalAccess', _103 => _103.kind]) === "paragraph") w.val("w:next", style.next);
1374
+ if (style.kind === "paragraph" && style.next && _optionalChain([byId, 'access', _109 => _109.get, 'call', _110 => _110(style.next), 'optionalAccess', _111 => _111.kind]) === "paragraph") w.val("w:next", style.next);
1308
1375
  if (style.linked && byId.has(style.linked)) w.val("w:link", style.linked);
1309
1376
  if (style.priority !== void 0 && Number.isFinite(style.priority)) w.val("w:uiPriority", Math.max(0, Math.round(style.priority)));
1310
1377
  if (style.hidden) w.empty("w:semiHidden").empty("w:unhideWhenUsed");
1311
1378
  if (style.quick) w.empty("w:qFormat");
1312
1379
  const block = style.kind === "paragraph" ? blockOf(style) : null;
1313
1380
  const ownBlock = style.kind === "paragraph" ? style.block : null;
1314
- const outline = _optionalChain([ownBlock, 'optionalAccess', _104 => _104.type]) === "heading" ? Math.max(0, Math.min(8, (Number(_optionalChain([ownBlock, 'access', _105 => _105.attrs, 'optionalAccess', _106 => _106.level])) || 1) - 1)) : void 0;
1381
+ const outline = _optionalChain([ownBlock, 'optionalAccess', _112 => _112.type]) === "heading" ? Math.max(0, Math.min(8, (Number(_optionalChain([ownBlock, 'access', _113 => _113.attrs, 'optionalAccess', _114 => _114.level])) || 1) - 1)) : void 0;
1315
1382
  if (style.kind === "paragraph" && (style.paragraph || outline !== void 0)) {
1316
1383
  const p = new XmlWriter(false);
1317
1384
  writeParagraphFormat(p, style.paragraph, outline);
@@ -1319,7 +1386,7 @@ var DocxBuilder = (_class3 = class {
1319
1386
  if (xml) w.open("w:pPr").raw(xml).close("w:pPr");
1320
1387
  }
1321
1388
  const run = characterFormatToRun(style.character);
1322
- if (_optionalChain([block, 'optionalAccess', _107 => _107.type]) === "codeBlock" && !run.font) run.font = "Consolas";
1389
+ if (_optionalChain([block, 'optionalAccess', _115 => _115.type]) === "codeBlock" && !run.font) run.font = "Consolas";
1323
1390
  if (hasRunProps(run)) {
1324
1391
  w.open("w:rPr");
1325
1392
  writeRunProps(w, run);
@@ -1380,7 +1447,7 @@ var DocxBuilder = (_class3 = class {
1380
1447
  return { comments: w.toString(), extended: ext.toString() };
1381
1448
  }
1382
1449
  comment(w, id, author, createdAt, body) {
1383
- const name = this.authorName(_optionalChain([author, 'optionalAccess', _108 => _108.name]), _optionalChain([author, 'optionalAccess', _109 => _109.id]));
1450
+ const name = this.authorName(_optionalChain([author, 'optionalAccess', _116 => _116.name]), _optionalChain([author, 'optionalAccess', _117 => _117.id]));
1384
1451
  w.open("w:comment", {
1385
1452
  "w:id": id,
1386
1453
  "w:author": name,
@@ -1425,7 +1492,7 @@ var DocxBuilder = (_class3 = class {
1425
1492
  "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance"
1426
1493
  });
1427
1494
  if (this.options.title) w.leaf("dc:title", void 0, this.options.title);
1428
- const creator = this.anonymous ? void 0 : _optionalChain([this, 'access', _110 => _110.defaultAuthor, 'optionalAccess', _111 => _111.name]);
1495
+ const creator = this.anonymous ? void 0 : _optionalChain([this, 'access', _118 => _118.defaultAuthor, 'optionalAccess', _119 => _119.name]);
1429
1496
  if (creator) w.leaf("dc:creator", void 0, creator).leaf("cp:lastModifiedBy", void 0, creator);
1430
1497
  const date = _nullishCoalesce(isoDate(now.getTime()), () => ( "2026-01-01T00:00:00Z"));
1431
1498
  w.leaf("dcterms:created", { "xsi:type": "dcterms:W3CDTF" }, date);
@@ -1465,6 +1532,7 @@ var DocxBuilder = (_class3 = class {
1465
1532
  if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
1466
1533
  parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
1467
1534
  for (const file of this.media) parts.push({ name: `word/media/${file.name}`, data: file.bytes });
1535
+ this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunk3JNRQVTScjs.CHART_OOXML_CONTENT_TYPE));
1468
1536
  add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
1469
1537
  const app = new XmlWriter();
1470
1538
  app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
@@ -1488,7 +1556,18 @@ var DocxBuilder = (_class3 = class {
1488
1556
  ];
1489
1557
  }
1490
1558
  }, _class3);
1491
- var isInlineType = (type) => type === "hardBreak" || type === "image" || type === "mention" || type === "text";
1559
+ var SPARK_BARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";
1560
+ function sparklineText(attrs2) {
1561
+ if (typeof _optionalChain([attrs2, 'optionalAccess', _120 => _120.label]) === "string" && attrs2.label.trim()) return attrs2.label;
1562
+ const values = (Array.isArray(_optionalChain([attrs2, 'optionalAccess', _121 => _121.values])) ? attrs2.values : []).filter(
1563
+ (v) => typeof v === "number" && Number.isFinite(v)
1564
+ );
1565
+ if (!values.length) return "";
1566
+ const min = Math.min(...values);
1567
+ const span = Math.max(...values) - min;
1568
+ return values.map((v) => SPARK_BARS[span ? Math.round((v - min) / span * (SPARK_BARS.length - 1)) : 3]).join("");
1569
+ }
1570
+ var isInlineType = (type) => type === "hardBreak" || type === "image" || type === "mention" || type === "sparkline" || type === "text";
1492
1571
  var EXTRA_STYLES = {
1493
1572
  BlockText: {
1494
1573
  id: "BlockText",
@@ -1570,8 +1649,8 @@ function resolveInput(input, options) {
1570
1649
  doc: input.getJSON(),
1571
1650
  options: {
1572
1651
  ...options,
1573
- comments: options.comments !== void 0 ? options.comments : _nullishCoalesce(_optionalChain([storage, 'access', _112 => _112.comment, 'optionalAccess', _113 => _113.store]), () => ( null)),
1574
- styles: _nullishCoalesce(_nullishCoalesce(options.styles, () => ( _optionalChain([storage, 'access', _114 => _114.paragraphStyles, 'optionalAccess', _115 => _115.registry]))), () => ( void 0))
1652
+ comments: options.comments !== void 0 ? options.comments : _nullishCoalesce(_optionalChain([storage, 'access', _122 => _122.comment, 'optionalAccess', _123 => _123.store]), () => ( null)),
1653
+ styles: _nullishCoalesce(_nullishCoalesce(options.styles, () => ( _optionalChain([storage, 'access', _124 => _124.paragraphStyles, 'optionalAccess', _125 => _125.registry]))), () => ( void 0))
1575
1654
  }
1576
1655
  };
1577
1656
  }
@@ -1583,7 +1662,7 @@ function createDocxParts(input, options = {}) {
1583
1662
  threadsOf(resolved.options.comments),
1584
1663
  stylesOf(resolved.options.styles)
1585
1664
  );
1586
- const parts = builder.parts(_nullishCoalesce(_optionalChain([resolved, 'access', _116 => _116.options, 'access', _117 => _117.now, 'optionalCall', _118 => _118()]), () => ( /* @__PURE__ */ new Date())));
1665
+ const parts = builder.parts(_nullishCoalesce(_optionalChain([resolved, 'access', _126 => _126.options, 'access', _127 => _127.now, 'optionalCall', _128 => _128()]), () => ( /* @__PURE__ */ new Date())));
1587
1666
  return { parts, report: builder.report };
1588
1667
  }
1589
1668
  async function exportDocx(input, options = {}) {
@@ -1618,20 +1697,20 @@ function docxFileName(name) {
1618
1697
  return `${base || "document"}.docx`;
1619
1698
  }
1620
1699
  var DocxExportController = (_class4 = class {
1621
- constructor(getSource, options = {}) {;_class4.prototype.__init18.call(this);_class4.prototype.__init19.call(this);_class4.prototype.__init20.call(this);_class4.prototype.__init21.call(this);_class4.prototype.__init22.call(this);
1700
+ constructor(getSource, options = {}) {;_class4.prototype.__init19.call(this);_class4.prototype.__init20.call(this);_class4.prototype.__init21.call(this);_class4.prototype.__init22.call(this);_class4.prototype.__init23.call(this);
1622
1701
  this.getSource = getSource;
1623
1702
  this.options = options;
1624
1703
  }
1625
1704
 
1626
1705
 
1627
- __init18() {this.state = { isExporting: false, error: null, lastReport: null }}
1628
- __init19() {this.listeners = /* @__PURE__ */ new Set()}
1629
- __init20() {this.pending = 0}
1706
+ __init19() {this.state = { isExporting: false, error: null, lastReport: null }}
1707
+ __init20() {this.listeners = /* @__PURE__ */ new Set()}
1708
+ __init21() {this.pending = 0}
1630
1709
  setOptions(options) {
1631
1710
  this.options = options;
1632
1711
  }
1633
- __init21() {this.getState = () => this.state}
1634
- __init22() {this.subscribe = (listener) => {
1712
+ __init22() {this.getState = () => this.state}
1713
+ __init23() {this.subscribe = (listener) => {
1635
1714
  this.listeners.add(listener);
1636
1715
  return () => {
1637
1716
  this.listeners.delete(listener);
@@ -1651,7 +1730,7 @@ var DocxExportController = (_class4 = class {
1651
1730
  const { fileName: _fileName, onExport: _onExport, onError: _onError, ...exportOptions } = this.options;
1652
1731
  const result = await exportDocxBlob(source, exportOptions);
1653
1732
  this.setState({ lastReport: result.report });
1654
- _optionalChain([this, 'access', _119 => _119.options, 'access', _120 => _120.onExport, 'optionalCall', _121 => _121(result.report, result.blob)]);
1733
+ _optionalChain([this, 'access', _129 => _129.options, 'access', _130 => _130.onExport, 'optionalCall', _131 => _131(result.report, result.blob)]);
1655
1734
  return result;
1656
1735
  } catch (error) {
1657
1736
  const err = error instanceof Error ? error : new Error(String(error));
@@ -1693,4 +1772,4 @@ function createDocxExportController(getSource, options) {
1693
1772
 
1694
1773
 
1695
1774
  exports.stripInvalidXmlChars = stripInvalidXmlChars; exports.escapeXmlText = escapeXmlText; exports.escapeXmlAttr = escapeXmlAttr; exports.XmlWriter = XmlWriter; exports.deflateRaw = deflateRaw; exports.writeZip = writeZip; exports.DOCX_EXPORT_MIME_TYPE = DOCX_EXPORT_MIME_TYPE; exports.DOCX_ANONYMOUS_AUTHOR = DOCX_ANONYMOUS_AUTHOR; exports.createDocxParts = createDocxParts; exports.exportDocx = exportDocx; exports.exportDocxBlob = exportDocxBlob; exports.downloadBlob = downloadBlob; exports.docxFileName = docxFileName; exports.DocxExportController = DocxExportController; exports.createDocxExportController = createDocxExportController;
1696
- //# sourceMappingURL=chunk-TXXNBDQX.cjs.map
1775
+ //# sourceMappingURL=chunk-2Q46FKZK.cjs.map