@json-to-office/core-docx 7.6.0 → 7.7.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.
package/dist/index.js CHANGED
@@ -9,11 +9,51 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  var __esm = (fn, res) => function __init() {
10
10
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
11
  };
12
- var __export = (target, all) => {
12
+ var __export = (target2, all) => {
13
13
  for (var name in all)
14
- __defProp(target, name, { get: all[name], enumerable: true });
14
+ __defProp(target2, name, { get: all[name], enumerable: true });
15
15
  };
16
16
 
17
+ // src/utils/generationContext.ts
18
+ import { AsyncLocalStorage } from "async_hooks";
19
+ import { isAbsolute, resolve } from "path";
20
+ function runWithBaseDir(baseDir, callback) {
21
+ return baseDir === void 0 ? callback() : baseDirStorage.run(resolve(baseDir), callback);
22
+ }
23
+ function getBaseDir() {
24
+ return baseDirStorage.getStore();
25
+ }
26
+ function resolveFromBaseDir(filePath) {
27
+ const base = baseDirStorage.getStore();
28
+ if (!base || isAbsolute(filePath)) return filePath;
29
+ return resolve(base, filePath);
30
+ }
31
+ function runWithWarnings(warnings, callback) {
32
+ return warnings === void 0 ? callback() : warningsStorage.run(warnings, callback);
33
+ }
34
+ function reportWarning(component, code, message, context) {
35
+ const warnings = warningsStorage.getStore();
36
+ if (warnings) {
37
+ warnings.push({
38
+ component,
39
+ message,
40
+ severity: "warning",
41
+ context: { code, ...context }
42
+ });
43
+ return;
44
+ }
45
+ console.warn(`[json-to-docx] [${code}] ${message}`);
46
+ }
47
+ var generationDateStorage, baseDirStorage, warningsStorage;
48
+ var init_generationContext = __esm({
49
+ "src/utils/generationContext.ts"() {
50
+ "use strict";
51
+ generationDateStorage = new AsyncLocalStorage();
52
+ baseDirStorage = new AsyncLocalStorage();
53
+ warningsStorage = new AsyncLocalStorage();
54
+ }
55
+ });
56
+
17
57
  // src/themes/defaults.ts
18
58
  import { designColors } from "@json-to-office/shared";
19
59
  function ensureThemeDefaults(theme) {
@@ -2447,43 +2487,6 @@ var init_widthUtils = __esm({
2447
2487
  }
2448
2488
  });
2449
2489
 
2450
- // src/utils/generationContext.ts
2451
- import { AsyncLocalStorage } from "async_hooks";
2452
- import { isAbsolute, resolve } from "path";
2453
- function runWithBaseDir(baseDir, callback) {
2454
- return baseDir === void 0 ? callback() : baseDirStorage.run(resolve(baseDir), callback);
2455
- }
2456
- function resolveFromBaseDir(filePath) {
2457
- const base = baseDirStorage.getStore();
2458
- if (!base || isAbsolute(filePath)) return filePath;
2459
- return resolve(base, filePath);
2460
- }
2461
- function runWithWarnings(warnings, callback) {
2462
- return warnings === void 0 ? callback() : warningsStorage.run(warnings, callback);
2463
- }
2464
- function reportWarning(component, code, message, context) {
2465
- const warnings = warningsStorage.getStore();
2466
- if (warnings) {
2467
- warnings.push({
2468
- component,
2469
- message,
2470
- severity: "warning",
2471
- context: { code, ...context }
2472
- });
2473
- return;
2474
- }
2475
- console.warn(`[json-to-docx] [${code}] ${message}`);
2476
- }
2477
- var generationDateStorage, baseDirStorage, warningsStorage;
2478
- var init_generationContext = __esm({
2479
- "src/utils/generationContext.ts"() {
2480
- "use strict";
2481
- generationDateStorage = new AsyncLocalStorage();
2482
- baseDirStorage = new AsyncLocalStorage();
2483
- warningsStorage = new AsyncLocalStorage();
2484
- }
2485
- });
2486
-
2487
2490
  // src/utils/imageUtils.ts
2488
2491
  import { readFileSync } from "fs";
2489
2492
  import { availableParallelism } from "os";
@@ -4354,15 +4357,15 @@ function canonicalizeEmbeddedFontKeys(zip) {
4354
4357
  const targets = /* @__PURE__ */ new Map();
4355
4358
  for (const [relationship] of rels.matchAll(/<Relationship\b[^>]*>/g)) {
4356
4359
  const id = /\bId="([^"]+)"/.exec(relationship)?.[1];
4357
- const target = /\bTarget="([^"]+)"/.exec(relationship)?.[1];
4358
- if (id && target) targets.set(id, target);
4360
+ const target2 = /\bTarget="([^"]+)"/.exec(relationship)?.[1];
4361
+ if (id && target2) targets.set(id, target2);
4359
4362
  }
4360
4363
  const rekey = /* @__PURE__ */ new Map();
4361
4364
  const parts = [];
4362
4365
  for (const { id, key } of embeds) {
4363
- const target = targets.get(id);
4364
- if (!target) continue;
4365
- const name = target.startsWith("/") ? target.slice(1) : posix.normalize(posix.join("word", target));
4366
+ const target2 = targets.get(id);
4367
+ if (!target2) continue;
4368
+ const name = target2.startsWith("/") ? target2.slice(1) : posix.normalize(posix.join("word", target2));
4366
4369
  const part = zip.getEntry(name);
4367
4370
  if (!part) continue;
4368
4371
  const font = xorFontKey(part.getData(), key);
@@ -5383,7 +5386,7 @@ function chromeSlots(set, Part, resources) {
5383
5386
  const part = set[slot];
5384
5387
  if (part) {
5385
5388
  out[slot] = new Part({
5386
- children: emitOutsideBody(() => partChildren(part, resources))
5389
+ children: part.children.length > 0 ? emitOutsideBody(() => partChildren(part, resources)) : [new Paragraph2({ style: Part === Header ? "Header" : "Footer" })]
5387
5390
  });
5388
5391
  }
5389
5392
  }
@@ -6619,15 +6622,16 @@ function section(value, ctx, closesDocument = false) {
6619
6622
  grid: { type: "default", linePitch: 360, charSpace: 0 }
6620
6623
  },
6621
6624
  children: sectionChildren2(value, ctx, closesDocument),
6622
- ...value.headers ? { headers: headerFooterSet(value.headers, ctx) } : {},
6623
- ...value.footers ? { footers: headerFooterSet(value.footers, ctx) } : {}
6625
+ ...value.headers ? { headers: headerFooterSet(value.headers, "Header", ctx) } : {},
6626
+ ...value.footers ? { footers: headerFooterSet(value.footers, "Footer", ctx) } : {}
6624
6627
  };
6625
6628
  }
6626
- function headerFooterSet(set, ctx) {
6629
+ function headerFooterSet(set, style, ctx) {
6627
6630
  const out = {};
6628
6631
  for (const slot of ["default", "first", "even"]) {
6629
6632
  const part = set[slot];
6630
- if (part) out[slot] = part.children.map((child) => block(child, ctx));
6633
+ if (!part) continue;
6634
+ out[slot] = part.children.length > 0 ? part.children.map((child) => block(child, ctx)) : [{ paragraph: { style, children: [] } }];
6631
6635
  }
6632
6636
  return out;
6633
6637
  }
@@ -7068,6 +7072,7 @@ import {
7068
7072
  import { assertRendererSupports } from "@json-to-office/shared/rendering";
7069
7073
 
7070
7074
  // src/core/fontResolution.ts
7075
+ init_generationContext();
7071
7076
  import {
7072
7077
  collectFontNamesFromDocx,
7073
7078
  validateFontReferences,
@@ -7121,8 +7126,14 @@ async function resolveDocumentFonts(document, theme, fonts, warnings, forceMater
7121
7126
  if (!fonts?.onResolved && !forceMaterialize) return [];
7122
7127
  const registry2 = new FontRegistry({
7123
7128
  // Spread keeps baseDir/googleFonts/mode/substitution intact for
7124
- // materializeSource; extraEntries carries the merged registry.
7125
- opts: { ...fonts, extraEntries: registryEntries },
7129
+ // materializeSource; extraEntries carries the merged registry. Without a
7130
+ // `fonts.baseDir` of its own, kind:"file" sources resolve against the
7131
+ // render's baseDir, as images do — not against process.cwd().
7132
+ opts: {
7133
+ ...fonts,
7134
+ baseDir: fonts?.baseDir ?? getBaseDir(),
7135
+ extraEntries: registryEntries
7136
+ },
7126
7137
  fileLoader: loadFileFontSource,
7127
7138
  variableLoader: fetchVariableFontSource,
7128
7139
  diskCache: fonts?.googleFonts?.cacheDir ? new FontDiskCache(fonts.googleFonts.cacheDir) : void 0
@@ -7445,11 +7456,11 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
7445
7456
  );
7446
7457
  let fontsRejected = false;
7447
7458
  const requestFonts = () => fontsRejected || !options.fonts?.length ? void 0 : options.fonts;
7448
- const rasterizeOne = async (target) => {
7459
+ const rasterizeOne = async (target2) => {
7449
7460
  const fonts = requestFonts();
7450
7461
  const call = (withFonts) => rasterizeVisualSlide(
7451
- target.presentation,
7452
- target.dpi,
7462
+ target2.presentation,
7463
+ target2.dpi,
7453
7464
  void 0,
7454
7465
  serviceConfig,
7455
7466
  options.baseDir,
@@ -7473,8 +7484,8 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
7473
7484
  const rasterizeIndividually = async (chunk) => {
7474
7485
  await Promise.all(
7475
7486
  chunk.map(
7476
- (target) => limit(async () => {
7477
- map.set(target.key, await rasterizeOne(target));
7487
+ (target2) => limit(async () => {
7488
+ map.set(target2.key, await rasterizeOne(target2));
7478
7489
  })
7479
7490
  )
7480
7491
  );
@@ -7483,9 +7494,9 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
7483
7494
  for (const chunk of chunksOf(unique, MAX_RASTERIZE_BATCH_SLIDES)) {
7484
7495
  try {
7485
7496
  const response = await serviceConfig.renderBatch({
7486
- slides: chunk.map((target) => ({
7487
- presentation: target.presentation,
7488
- dpi: target.dpi
7497
+ slides: chunk.map((target2) => ({
7498
+ presentation: target2.presentation,
7499
+ dpi: target2.dpi
7489
7500
  })),
7490
7501
  ...options.baseDir !== void 0 && { baseDir: options.baseDir },
7491
7502
  ...options.fonts?.length ? { fonts: [...options.fonts] } : {}
@@ -7500,8 +7511,8 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
7500
7511
  await rasterizeIndividually(chunk);
7501
7512
  } else {
7502
7513
  const message = toErrorMessage(error);
7503
- for (const target of chunk) {
7504
- map.set(target.key, { ok: false, error: message });
7514
+ for (const target2 of chunk) {
7515
+ map.set(target2.key, { ok: false, error: message });
7505
7516
  }
7506
7517
  }
7507
7518
  }
@@ -7524,9 +7535,9 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
7524
7535
  url: serverUrl,
7525
7536
  path: "/rasterize/batch",
7526
7537
  body: {
7527
- slides: chunk.map((target) => ({
7528
- presentation: target.presentation,
7529
- dpi: target.dpi
7538
+ slides: chunk.map((target2) => ({
7539
+ presentation: target2.presentation,
7540
+ dpi: target2.dpi
7530
7541
  })),
7531
7542
  ...options.baseDir !== void 0 && { baseDir: options.baseDir },
7532
7543
  ...fonts?.length ? { fonts } : {}
@@ -7569,6 +7580,49 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
7569
7580
  return map;
7570
7581
  }
7571
7582
 
7583
+ // src/core/nodeOrigin.ts
7584
+ var NODE_ORIGIN = Symbol("json-to-office.nodeOrigin");
7585
+ function isComponentNode(value) {
7586
+ return typeof value.name === "string" && "props" in value;
7587
+ }
7588
+ function isPlainRecord(value) {
7589
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
7590
+ const proto = Object.getPrototypeOf(value);
7591
+ return proto === Object.prototype || proto === null;
7592
+ }
7593
+ function tagNodeOrigins(root) {
7594
+ const visit = (value, path4) => {
7595
+ if (Array.isArray(value)) {
7596
+ return value.map((item, index) => visit(item, join(path4, index)));
7597
+ }
7598
+ if (!isPlainRecord(value)) return value;
7599
+ const out = {};
7600
+ for (const [key, item] of Object.entries(value)) {
7601
+ out[key] = visit(item, join(path4, key));
7602
+ }
7603
+ if (path4 !== "" && isComponentNode(value)) {
7604
+ out[NODE_ORIGIN] = {
7605
+ standardPath: path4,
7606
+ kind: value.name
7607
+ };
7608
+ }
7609
+ return out;
7610
+ };
7611
+ return visit(root, "");
7612
+ }
7613
+ function join(path4, key) {
7614
+ return path4 === "" ? String(key) : `${path4}.${key}`;
7615
+ }
7616
+ function nodeOrigin(node) {
7617
+ if (!node || typeof node !== "object") return void 0;
7618
+ return node[NODE_ORIGIN];
7619
+ }
7620
+ function withNodeOrigin(original, next) {
7621
+ const origin = nodeOrigin(original);
7622
+ if (origin) next[NODE_ORIGIN] = origin;
7623
+ return next;
7624
+ }
7625
+
7572
7626
  // src/core/componentTransform.ts
7573
7627
  async function transformComponents(doc, replace) {
7574
7628
  return await walk(doc, replace);
@@ -7634,7 +7688,7 @@ function withNodeIdentity(original, replacement) {
7634
7688
  const out = { ...replacement };
7635
7689
  if (original.id !== void 0) out.id = original.id;
7636
7690
  if (original.enabled !== void 0) out.enabled = original.enabled;
7637
- return out;
7691
+ return withNodeOrigin(original, out);
7638
7692
  }
7639
7693
  function containsComponent(root, name) {
7640
7694
  const seen = /* @__PURE__ */ new WeakSet();
@@ -7708,15 +7762,7 @@ async function generateChart(config, servicesConfig, warnings, cache) {
7708
7762
  }
7709
7763
  const serverUrl = effectiveChartServerUrl(config, servicesConfig);
7710
7764
  assertExportServerAllowed(serverUrl, servicesConfig, warnings);
7711
- const requestBody = {
7712
- infile: config.options,
7713
- type: "png",
7714
- b64: true,
7715
- scale: config.scale,
7716
- // Forward resources verbatim only when present so the payload stays
7717
- // byte-identical to before for callers that omit it.
7718
- ...config.resources ? { resources: config.resources } : {}
7719
- };
7765
+ const requestBody = chartRequestBody(config);
7720
7766
  return sendChartRequest({
7721
7767
  cache,
7722
7768
  serverUrl,
@@ -7834,15 +7880,32 @@ function withChartFontFaces(config, theme, faces) {
7834
7880
  theme.fonts.heading.family
7835
7881
  ]);
7836
7882
  }
7837
- async function renderChartToImageProps(props, theme, servicesConfig, chartFonts, warnings, cache) {
7838
- const config = withChartFontFaces(
7883
+ function resolveChartConfig(props, theme, fonts) {
7884
+ return withChartFontFaces(
7839
7885
  withThemeTypography(
7840
7886
  withThemeColors(withThemePresets(props, theme), theme),
7841
7887
  theme
7842
7888
  ),
7843
7889
  theme,
7844
- chartFonts
7890
+ fonts
7845
7891
  );
7892
+ }
7893
+ function chartRequestBody(config) {
7894
+ return {
7895
+ infile: config.options,
7896
+ type: "png",
7897
+ b64: true,
7898
+ scale: config.scale,
7899
+ // Forward resources verbatim only when present so the payload stays
7900
+ // byte-identical to before for callers that omit it.
7901
+ ...config.resources ? { resources: config.resources } : {}
7902
+ };
7903
+ }
7904
+ function resolveChartRequest(props, renderTheme, fontFaces) {
7905
+ return chartRequestBody(resolveChartConfig(props, renderTheme, fontFaces));
7906
+ }
7907
+ async function renderChartToImageProps(props, theme, servicesConfig, chartFonts, warnings, cache) {
7908
+ const config = resolveChartConfig(props, theme, chartFonts);
7846
7909
  const chart = await generateChart(config, servicesConfig, warnings, cache);
7847
7910
  const hasConfigDimensions = config.width !== void 0 || config.height !== void 0;
7848
7911
  return {
@@ -10559,12 +10622,12 @@ function parseLinks(normalized, options) {
10559
10622
  continue;
10560
10623
  }
10561
10624
  const [, linkText] = match;
10562
- const target = decodeEscapes(match[2]);
10625
+ const target2 = decodeEscapes(match[2]);
10563
10626
  out.push({
10564
10627
  kind: "hyperlink",
10565
10628
  // A `#anchor` target names a bookmark in this document and needs no
10566
10629
  // relationship; anything else leaves the document.
10567
- target: target.startsWith("#") ? { kind: "bookmark", anchor: target.slice(1) } : { kind: "external", url: target },
10630
+ target: target2.startsWith("#") ? { kind: "bookmark", anchor: target2.slice(1) } : { kind: "external", url: target2 },
10568
10631
  children: parseDecorated(linkText, options)
10569
10632
  });
10570
10633
  }
@@ -10820,6 +10883,7 @@ function compileDocument(structure, layout2, warnings = [], images = /* @__PURE_
10820
10883
  numberedItems: outline.numberedItems,
10821
10884
  tocEntries: outline.entries,
10822
10885
  images,
10886
+ imageOrigins: /* @__PURE__ */ new WeakMap(),
10823
10887
  generatedAt: structure.metadata.date
10824
10888
  };
10825
10889
  ctx.features.require("paragraphs", "sections");
@@ -10873,9 +10937,19 @@ function compileDocument(structure, layout2, warnings = [], images = /* @__PURE_
10873
10937
  ir,
10874
10938
  required: ctx.features.list(),
10875
10939
  warnings: ctx.warnings,
10876
- unsupported: ctx.unsupported
10940
+ unsupported: ctx.unsupported,
10941
+ imageOrigins: ctx.imageOrigins
10877
10942
  };
10878
10943
  }
10944
+ function recordImageOrigin(ctx, component, images) {
10945
+ const origin = nodeOrigin(component);
10946
+ if (!origin) return;
10947
+ for (const image of images) {
10948
+ if (image.kind === "image" || image.kind === "picture") {
10949
+ ctx.imageOrigins.set(image, origin);
10950
+ }
10951
+ }
10952
+ }
10879
10953
  var AFTER_TABLE_TWIPS = 120;
10880
10954
  var BEFORE_TABLE_TWIPS = 240;
10881
10955
  var BODY_STYLE_IDS = /* @__PURE__ */ new Set([void 0, "Normal"]);
@@ -11203,6 +11277,7 @@ function compileChromeImage(component, scope) {
11203
11277
  heightEmu: pixelsToEmu(size.height),
11204
11278
  ...props.floating ? { floating: compileFloating(props.floating, ctx, path4) } : {}
11205
11279
  };
11280
+ recordImageOrigin(ctx, component, [image]);
11206
11281
  return [
11207
11282
  {
11208
11283
  kind: "paragraph",
@@ -12702,6 +12777,7 @@ function compileVisual(component, scope) {
12702
12777
  nativeVisualDeps(ctx, path4)
12703
12778
  );
12704
12779
  if (!group) return [];
12780
+ recordImageOrigin(ctx, component, group.children);
12705
12781
  const size = visualPlacementPixels(props, group.canvas, {
12706
12782
  widthPx: Math.round(twipsToPixels(scope.measureTwips)),
12707
12783
  heightPx: Math.round(twipsToPixels(getAvailableHeightTwips(ctx.theme)))
@@ -12828,6 +12904,7 @@ function compileImage2(component, scope) {
12828
12904
  ...typeof props.alt === "string" && props.alt ? { altText: props.alt } : {},
12829
12905
  ...props.floating ? { floating: compileFloating(props.floating, ctx, path4) } : {}
12830
12906
  };
12907
+ recordImageOrigin(ctx, component, [image]);
12831
12908
  ctx.features.require("images", path4);
12832
12909
  if (props.floating) ctx.features.require("floating-images", path4);
12833
12910
  const spacing = {};
@@ -13592,6 +13669,7 @@ function cellVisual(component, scope) {
13592
13669
  nativeVisualDeps(ctx, path4)
13593
13670
  );
13594
13671
  if (!group) return [];
13672
+ recordImageOrigin(ctx, component, group.children);
13595
13673
  const size = visualPlacementPixels(props, group.canvas, {
13596
13674
  widthPx: CELL_DRAWING_REFERENCE.width,
13597
13675
  heightPx: CELL_DRAWING_REFERENCE.height
@@ -13637,14 +13715,14 @@ function cellImage(component, base, ctx) {
13637
13715
  const mediaType = detectImageType(source, loaded.contentType);
13638
13716
  if (mediaType === "svg") ctx.features.require("svg-images", "table");
13639
13717
  ctx.features.require("images", "table");
13640
- return [
13641
- {
13642
- kind: "image",
13643
- resourceId: declareResource(loaded, mediaType, ctx),
13644
- widthEmu: pixelsToEmu(size.width),
13645
- heightEmu: pixelsToEmu(size.height)
13646
- }
13647
- ];
13718
+ const image = {
13719
+ kind: "image",
13720
+ resourceId: declareResource(loaded, mediaType, ctx),
13721
+ widthEmu: pixelsToEmu(size.width),
13722
+ heightEmu: pixelsToEmu(size.height)
13723
+ };
13724
+ recordImageOrigin(ctx, component, [image]);
13725
+ return [image];
13648
13726
  }
13649
13727
  function placeholderFormatting(base) {
13650
13728
  return {
@@ -16394,7 +16472,7 @@ async function compileDocumentScoped(document, options, warnings) {
16394
16472
  const embeddedFonts = embedding ? selectEmbeddedFonts(resolvedFonts, warnings) : [];
16395
16473
  const visualFonts = hasVisual ? toRasterizeFontFaces(resolvedFonts, warnings) : [];
16396
16474
  const chartFonts = hasHighcharts ? toChartFontFaces(resolvedFonts) : [];
16397
- const desugared = await desugarExternals(context.document, {
16475
+ const desugared = await desugarExternals(tagNodeOrigins(context.document), {
16398
16476
  theme: prepared.model.document.theme,
16399
16477
  ...options.services ? { services: options.services } : {},
16400
16478
  ...options.baseDir !== void 0 ? { baseDir: options.baseDir } : {},
@@ -16432,6 +16510,7 @@ async function compileDocumentScoped(document, options, warnings) {
16432
16510
  warnings: compiled.warnings,
16433
16511
  required: compiled.required,
16434
16512
  unsupported: compiled.unsupported,
16513
+ imageOrigins: compiled.imageOrigins,
16435
16514
  embeddedFonts
16436
16515
  };
16437
16516
  }
@@ -16459,7 +16538,12 @@ async function renderScoped(document, options, warnings) {
16459
16538
  ...compiled.embeddedFonts.length > 0 ? { embeddedFonts: compiled.embeddedFonts } : {},
16460
16539
  warnings: compiled.warnings
16461
16540
  });
16462
- return { buffer: Buffer.from(bytes), warnings: compiled.warnings };
16541
+ return {
16542
+ buffer: Buffer.from(bytes),
16543
+ warnings: compiled.warnings,
16544
+ ir: compiled.ir,
16545
+ imageOrigins: compiled.imageOrigins
16546
+ };
16463
16547
  }
16464
16548
  function toDate(value) {
16465
16549
  return value instanceof Date ? value : new Date(value);
@@ -16482,7 +16566,7 @@ import {
16482
16566
 
16483
16567
  // src/json/filesystem.ts
16484
16568
  import { promises as fs3 } from "fs";
16485
- import { join, resolve as resolve2, isAbsolute as isAbsolute2 } from "path";
16569
+ import { join as join2, resolve as resolve2, isAbsolute as isAbsolute2 } from "path";
16486
16570
  async function loadJsonDefinition(filePath) {
16487
16571
  try {
16488
16572
  const absolutePath = isAbsolute2(filePath) ? filePath : resolve2(filePath);
@@ -18053,7 +18137,7 @@ import {
18053
18137
  import { collectPlaceholders as collectPlaceholders2 } from "@json-to-office/quality";
18054
18138
  import { existsSync, readdirSync, readFileSync as readFileSync2 } from "fs";
18055
18139
  import { fileURLToPath as fileURLToPath2 } from "url";
18056
- import { dirname as dirname2, join as join2 } from "path";
18140
+ import { dirname as dirname2, join as join3 } from "path";
18057
18141
 
18058
18142
  // src/templates/blueprints/client-report.docx.blueprint.json
18059
18143
  var client_report_docx_blueprint_default = {
@@ -19248,11 +19332,11 @@ function scanned(known) {
19248
19332
  return [];
19249
19333
  }
19250
19334
  const directory = [
19251
- join2(here, "../templates/blueprints"),
19252
- join2(here, "templates/blueprints")
19335
+ join3(here, "../templates/blueprints"),
19336
+ join3(here, "templates/blueprints")
19253
19337
  ].find((path4) => existsSync(path4));
19254
19338
  if (!directory) return [];
19255
- return readdirSync(directory).filter((file) => file.endsWith(".docx.blueprint.json")).map((file) => JSON.parse(readFileSync2(join2(directory, file), "utf8"))).filter((candidate) => {
19339
+ return readdirSync(directory).filter((file) => file.endsWith(".docx.blueprint.json")).map((file) => JSON.parse(readFileSync2(join3(directory, file), "utf8"))).filter((candidate) => {
19256
19340
  const id = candidate?.id;
19257
19341
  return !(typeof id === "string" && id in known);
19258
19342
  });
@@ -19432,6 +19516,36 @@ var textSpaceAfterComponent = createComponent({
19432
19516
  }
19433
19517
  });
19434
19518
 
19519
+ // src/components/highchartsOptions.ts
19520
+ init_layoutUtils();
19521
+ function chartRenderTheme(input) {
19522
+ const document = {
19523
+ name: "docx",
19524
+ props: { ...input.documentProps },
19525
+ children: []
19526
+ };
19527
+ const context = resolveThemeContext(document, {
19528
+ ...input.fonts ? { fonts: input.fonts } : {},
19529
+ warnings: [],
19530
+ resolveNamedTheme: () => input.theme
19531
+ });
19532
+ const { theme } = resolveDocumentTree(context.document, context.theme);
19533
+ return themeForSectionPage(theme, input.page);
19534
+ }
19535
+ function resolveHighchartsRequest(input) {
19536
+ const props = {
19537
+ options: input.options,
19538
+ ...input.width !== void 0 && { width: input.width },
19539
+ ...input.height !== void 0 && { height: input.height },
19540
+ ...input.scale !== void 0 && { scale: input.scale },
19541
+ ...input.resources !== void 0 && { resources: input.resources }
19542
+ };
19543
+ return resolveChartRequest(props, chartRenderTheme(input), input.fontFaces);
19544
+ }
19545
+ function resolveHighchartsOptions(input) {
19546
+ return resolveHighchartsRequest(input).infile;
19547
+ }
19548
+
19435
19549
  // src/plugin/createDocumentGenerator.ts
19436
19550
  init_themes();
19437
19551
 
@@ -19661,7 +19775,280 @@ function mergeSchemas(customComponents, standardSchemas) {
19661
19775
  };
19662
19776
  }
19663
19777
 
19778
+ // src/core/renderManifest.ts
19779
+ init_units();
19780
+ import AdmZip6 from "adm-zip";
19781
+ import { posix as posix2 } from "path";
19782
+ var HEADER_FOOTER_TYPES = ["default", "first", "even"];
19783
+ function buildRenderManifest(buffer, ir, imageOrigins, sourceOrigins = /* @__PURE__ */ new Map()) {
19784
+ try {
19785
+ return {
19786
+ ok: true,
19787
+ manifest: collect(buffer, ir, imageOrigins, sourceOrigins)
19788
+ };
19789
+ } catch (error) {
19790
+ return {
19791
+ ok: false,
19792
+ reason: error instanceof Error ? error.message : String(error)
19793
+ };
19794
+ }
19795
+ }
19796
+ function collect(buffer, ir, imageOrigins, sourceOrigins) {
19797
+ const zip = new AdmZip6(buffer);
19798
+ const read = (entry) => zip.getEntry(entry)?.getData().toString("utf8");
19799
+ const media = /* @__PURE__ */ new Map();
19800
+ const mediaHash = (path4) => {
19801
+ let hash = media.get(path4);
19802
+ if (hash === void 0) {
19803
+ const entry = zip.getEntry(path4);
19804
+ if (!entry) throw new Error(`the package has no ${path4}`);
19805
+ hash = sha256Hex(new Uint8Array(entry.getData()));
19806
+ media.set(path4, hash);
19807
+ }
19808
+ return hash;
19809
+ };
19810
+ const resources = new Map(ir.resources.map((r) => [r.id, r]));
19811
+ const manifest = [];
19812
+ const pair = (part, partPath, xml, images) => {
19813
+ const rels = relationships(read(relsPathOf(partPath)), partPath);
19814
+ const blips = readBlips(xml);
19815
+ if (blips.length !== images.length) {
19816
+ throw new Error(
19817
+ `${partPath} embeds ${blips.length} image(s) where the IR placed ${images.length}`
19818
+ );
19819
+ }
19820
+ blips.forEach((blip, index) => {
19821
+ const image = images[index];
19822
+ const mediaPath = target(rels, blip.embed, partPath);
19823
+ const sha256 = mediaHash(mediaPath);
19824
+ const resource = resources.get(image.resourceId);
19825
+ if (!resource || !matchesResource(resource, blip, sha256, rels, partPath, mediaHash)) {
19826
+ throw new Error(
19827
+ `image ${index + 1} of ${partPath} (${mediaPath}) does not hold the bytes of IR resource ${image.resourceId}`
19828
+ );
19829
+ }
19830
+ const origin = imageOrigins.get(image);
19831
+ if (!origin) {
19832
+ throw new Error(
19833
+ `image ${index + 1} of ${partPath} has no standard-definition origin`
19834
+ );
19835
+ }
19836
+ const source = sourceOriginOf(origin.standardPath, sourceOrigins);
19837
+ manifest.push({
19838
+ part,
19839
+ partPath,
19840
+ mediaPath,
19841
+ sha256,
19842
+ standardPath: origin.standardPath,
19843
+ kind: origin.kind,
19844
+ ...source && {
19845
+ sourcePath: source.sourcePath,
19846
+ sourceKind: source.sourceKind
19847
+ }
19848
+ });
19849
+ });
19850
+ };
19851
+ const documentPath = "word/document.xml";
19852
+ const documentXml = read(documentPath);
19853
+ if (documentXml === void 0)
19854
+ throw new Error(`the package has no ${documentPath}`);
19855
+ pair(
19856
+ "body",
19857
+ documentPath,
19858
+ documentXml,
19859
+ ir.sections.flatMap((section2) => blockImages(section2.children))
19860
+ );
19861
+ const sectPrs = sectionProperties(documentXml);
19862
+ if (sectPrs.length !== ir.sections.length) {
19863
+ throw new Error(
19864
+ `${documentPath} has ${sectPrs.length} section(s) where the IR has ${ir.sections.length}`
19865
+ );
19866
+ }
19867
+ const documentRels = relationships(
19868
+ read(relsPathOf(documentPath)),
19869
+ documentPath
19870
+ );
19871
+ const seen = /* @__PURE__ */ new Set();
19872
+ ir.sections.forEach((section2, index) => {
19873
+ const references = chromeReferences(sectPrs[index]);
19874
+ for (const part of ["header", "footer"]) {
19875
+ const set = part === "header" ? section2.headers : section2.footers;
19876
+ for (const type of HEADER_FOOTER_TYPES) {
19877
+ const id = references.get(`${part}:${type}`);
19878
+ if (id === void 0) continue;
19879
+ const partPath = target(documentRels, id, documentPath);
19880
+ if (seen.has(partPath)) continue;
19881
+ seen.add(partPath);
19882
+ const xml = read(partPath);
19883
+ if (xml === void 0)
19884
+ throw new Error(`the package has no ${partPath}`);
19885
+ pair(part, partPath, xml, blockImages(set?.[type]?.children ?? []));
19886
+ }
19887
+ }
19888
+ });
19889
+ return manifest;
19890
+ }
19891
+ function sourceOriginOf(standardPath, sourceOrigins) {
19892
+ if (sourceOrigins.size === 0) return void 0;
19893
+ const segments = standardPath.split(".");
19894
+ for (let n = segments.length; n > 0; n--) {
19895
+ const hit = sourceOrigins.get(segments.slice(0, n).join("."));
19896
+ if (hit) return hit;
19897
+ }
19898
+ return void 0;
19899
+ }
19900
+ function matchesResource(resource, blip, sha256, rels, partPath, mediaHash) {
19901
+ if (sha256 === resource.sha256) return true;
19902
+ if (resource.mediaType !== "svg" || blip.svgEmbed === void 0) return false;
19903
+ return mediaHash(target(rels, blip.svgEmbed, partPath)) === resource.sha256;
19904
+ }
19905
+ function blockImages(blocks) {
19906
+ const out = [];
19907
+ const visitBlocks = (items) => {
19908
+ for (const block2 of items) {
19909
+ if (block2.kind === "paragraph") visitParagraph(block2);
19910
+ else if (block2.kind === "table") {
19911
+ for (const row of block2.rows) {
19912
+ for (const cell of row.cells) visitBlocks(cell.children);
19913
+ }
19914
+ }
19915
+ }
19916
+ };
19917
+ const visitParagraph = (paragraph2) => visitInlines(paragraph2.children);
19918
+ const visitInlines = (inlines) => {
19919
+ for (const inline of inlines) {
19920
+ switch (inline.kind) {
19921
+ case "image":
19922
+ out.push(inline);
19923
+ break;
19924
+ case "drawingGroup":
19925
+ for (const child of inline.children) {
19926
+ if (child.kind === "picture") out.push(child);
19927
+ }
19928
+ break;
19929
+ case "shape":
19930
+ inline.children.forEach(visitParagraph);
19931
+ break;
19932
+ case "hyperlink":
19933
+ case "revision":
19934
+ visitInlines(inline.children);
19935
+ break;
19936
+ default:
19937
+ break;
19938
+ }
19939
+ }
19940
+ };
19941
+ visitBlocks(blocks);
19942
+ return out;
19943
+ }
19944
+ function readBlips(xml) {
19945
+ const body = xml.replace(/<mc:Fallback\b[\s\S]*?<\/mc:Fallback>/g, "");
19946
+ const blips = [];
19947
+ const pattern = /<a:blip\b([^>]*?)(?:\/>|>([\s\S]*?)<\/a:blip>)/g;
19948
+ for (const match of body.matchAll(pattern)) {
19949
+ const embed = /\br:embed="([^"]+)"/.exec(match[1])?.[1];
19950
+ if (embed === void 0) continue;
19951
+ const svgEmbed = match[2] ? /<asvg:svgBlip\b[^>]*\br:embed="([^"]+)"/.exec(match[2])?.[1] : void 0;
19952
+ blips.push(svgEmbed === void 0 ? { embed } : { embed, svgEmbed });
19953
+ }
19954
+ return blips;
19955
+ }
19956
+ function sectionProperties(xml) {
19957
+ return [...xml.matchAll(/<w:sectPr\b(?:[^>]*\/>|[\s\S]*?<\/w:sectPr>)/g)].map(
19958
+ (m) => m[0]
19959
+ );
19960
+ }
19961
+ function chromeReferences(sectPr) {
19962
+ const out = /* @__PURE__ */ new Map();
19963
+ for (const match of sectPr.matchAll(
19964
+ /<w:(header|footer)Reference\b([^>]*)\/?>/g
19965
+ )) {
19966
+ const type = attribute(match[2], "w:type") ?? "default";
19967
+ const id = attribute(match[2], "r:id");
19968
+ if (id !== void 0) out.set(`${match[1]}:${type}`, id);
19969
+ }
19970
+ return out;
19971
+ }
19972
+ function relsPathOf(partPath) {
19973
+ return posix2.join(
19974
+ posix2.dirname(partPath),
19975
+ "_rels",
19976
+ `${posix2.basename(partPath)}.rels`
19977
+ );
19978
+ }
19979
+ function relationships(xml, partPath) {
19980
+ const out = /* @__PURE__ */ new Map();
19981
+ if (xml === void 0) return out;
19982
+ for (const match of xml.matchAll(/<Relationship\b([^>]*)\/?>/g)) {
19983
+ const id = attribute(match[1], "Id");
19984
+ const target2 = attribute(match[1], "Target");
19985
+ if (id !== void 0 && target2 !== void 0) out.set(id, target2);
19986
+ }
19987
+ if (out.size === 0 && /<Relationship\b/.test(xml)) {
19988
+ throw new Error(`the relationships of ${partPath} could not be read`);
19989
+ }
19990
+ return out;
19991
+ }
19992
+ function target(rels, id, partPath) {
19993
+ const raw = rels.get(id);
19994
+ if (raw === void 0) {
19995
+ throw new Error(`${partPath} references an unknown relationship ${id}`);
19996
+ }
19997
+ return raw.startsWith("/") ? raw.slice(1) : posix2.normalize(posix2.join(posix2.dirname(partPath), raw));
19998
+ }
19999
+ function attribute(attributes, name) {
20000
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
20001
+ return new RegExp(`(?:^|\\s)${escaped}="([^"]*)"`).exec(attributes)?.[1];
20002
+ }
20003
+
19664
20004
  // src/plugin/createDocumentGenerator.ts
20005
+ var RENDER_MANIFEST_UNAVAILABLE = "W_DOCX_RENDER_MANIFEST_UNAVAILABLE";
20006
+ var ROOT_POSITION = {
20007
+ standard: "children",
20008
+ standardBase: 0,
20009
+ preserved: "children",
20010
+ preservedBase: 0
20011
+ };
20012
+ var DETACHED_POSITION = {
20013
+ standard: null,
20014
+ standardBase: 0,
20015
+ preserved: null,
20016
+ preservedBase: 0
20017
+ };
20018
+ function joinPath(path4, key) {
20019
+ return path4 === null ? null : `${path4}.${key}`;
20020
+ }
20021
+ function blockSourceOrigins(standard, preserved, preserveSet) {
20022
+ const origins = /* @__PURE__ */ new Map();
20023
+ const visit = (std, kept, path4) => {
20024
+ if (!std || !kept || typeof std !== "object" || typeof kept !== "object")
20025
+ return;
20026
+ const keptNode = kept;
20027
+ const stdNode = std;
20028
+ if (path4 !== "" && typeof keptNode.name === "string" && preserveSet.has(keptNode.name) && stdNode.name === "group") {
20029
+ origins.set(path4, { sourcePath: path4, sourceKind: keptNode.name });
20030
+ return;
20031
+ }
20032
+ for (const [key, value] of Object.entries(keptNode)) {
20033
+ if (key in stdNode) {
20034
+ visit(stdNode[key], value, path4 === "" ? key : `${path4}.${key}`);
20035
+ }
20036
+ }
20037
+ };
20038
+ visit(standard, preserved, "");
20039
+ return origins;
20040
+ }
20041
+ function manifestOf(buffer, ir, imageOrigins, sourceOrigins, warnings) {
20042
+ const built = buildRenderManifest(buffer, ir, imageOrigins, sourceOrigins);
20043
+ if (built.ok) return built.manifest;
20044
+ warnings.push({
20045
+ component: "docx",
20046
+ severity: "warning",
20047
+ message: `No render manifest: ${built.reason}.`,
20048
+ context: { code: RENDER_MANIFEST_UNAVAILABLE, reason: built.reason }
20049
+ });
20050
+ return void 0;
20051
+ }
19665
20052
  function createBuilderImpl(state) {
19666
20053
  const componentMap = new Map(state.components.map((c) => [c.name, c]));
19667
20054
  function resolveDocumentTheme(themeName, warnings, authored) {
@@ -19690,7 +20077,7 @@ function createBuilderImpl(state) {
19690
20077
  warnings
19691
20078
  });
19692
20079
  }
19693
- async function processDocumentComponents(components, preserveSet, warningsCollector, resolvedTheme, validateEmitted, depth = 0) {
20080
+ async function processDocumentComponents(components, preserveSet, warningsCollector, resolvedTheme, validateEmitted, at, origins, depth = 0) {
19694
20081
  if (depth > 20) {
19695
20082
  throw new Error(
19696
20083
  "Maximum component nesting depth exceeded (20). Check for circular component references."
@@ -19698,6 +20085,8 @@ function createBuilderImpl(state) {
19698
20085
  }
19699
20086
  const standardOut = [];
19700
20087
  const preservedOut = [];
20088
+ const nextStandardPath = () => joinPath(at.standard, at.standardBase + standardOut.length);
20089
+ const nextPreservedPath = () => joinPath(at.preserved, at.preservedBase + preservedOut.length);
19701
20090
  for (const componentData of components) {
19702
20091
  const componentName = componentData?.name;
19703
20092
  if (!componentName) {
@@ -19731,6 +20120,8 @@ function createBuilderImpl(state) {
19731
20120
  warningsCollector,
19732
20121
  resolvedTheme,
19733
20122
  validateEmitted,
20123
+ DETACHED_POSITION,
20124
+ origins,
19734
20125
  depth + 1
19735
20126
  );
19736
20127
  nestedChildren = nested.standard;
@@ -19754,16 +20145,34 @@ function createBuilderImpl(state) {
19754
20145
  if (validateEmitted) {
19755
20146
  validateEmitted(resultComponents, versionLabel);
19756
20147
  }
20148
+ const preservedHere = preserveSet?.has(componentName) === true;
20149
+ const preservedPath = nextPreservedPath();
20150
+ const firstIndex = at.standardBase + standardOut.length;
19757
20151
  const processedResult = await processDocumentComponents(
19758
20152
  resultComponents,
19759
20153
  preserveSet,
19760
20154
  warningsCollector,
19761
20155
  resolvedTheme,
19762
20156
  validateEmitted,
20157
+ {
20158
+ standard: at.standard,
20159
+ standardBase: firstIndex,
20160
+ preserved: preservedHere ? null : at.preserved,
20161
+ preservedBase: at.preservedBase + preservedOut.length
20162
+ },
20163
+ origins,
19763
20164
  depth + 1
19764
20165
  );
20166
+ if (preservedHere && at.standard !== null && preservedPath !== null) {
20167
+ processedResult.standard.forEach((_, index) => {
20168
+ origins.set(`${at.standard}.${firstIndex + index}`, {
20169
+ sourcePath: preservedPath,
20170
+ sourceKind: componentName
20171
+ });
20172
+ });
20173
+ }
19765
20174
  standardOut.push(...processedResult.standard);
19766
- if (preserveSet && preserveSet.has(componentName)) {
20175
+ if (preservedHere) {
19767
20176
  preservedOut.push(componentData);
19768
20177
  } else {
19769
20178
  preservedOut.push(...processedResult.preserved);
@@ -19784,12 +20193,21 @@ function createBuilderImpl(state) {
19784
20193
  }
19785
20194
  } else {
19786
20195
  if ("children" in componentData && Array.isArray(componentData.children)) {
20196
+ const standardPath = nextStandardPath();
20197
+ const preservedPath = nextPreservedPath();
19787
20198
  const processedNested = await processDocumentComponents(
19788
20199
  componentData.children,
19789
20200
  preserveSet,
19790
20201
  warningsCollector,
19791
20202
  resolvedTheme,
19792
20203
  validateEmitted,
20204
+ {
20205
+ standard: joinPath(standardPath, "children"),
20206
+ standardBase: 0,
20207
+ preserved: joinPath(preservedPath, "children"),
20208
+ preservedBase: 0
20209
+ },
20210
+ origins,
19793
20211
  depth + 1
19794
20212
  );
19795
20213
  standardOut.push({
@@ -19953,6 +20371,7 @@ function createBuilderImpl(state) {
19953
20371
  );
19954
20372
  const [modedDoc2] = normalizeDocument(expanded.document);
19955
20373
  return {
20374
+ sourceOrigins: preserveSet ? blockSourceOrigins(modedDoc2, expanded.preserved, preserveSet) : /* @__PURE__ */ new Map(),
19956
20375
  modedRoot,
19957
20376
  modedTheme,
19958
20377
  themeName,
@@ -19968,12 +20387,15 @@ function createBuilderImpl(state) {
19968
20387
  }
19969
20388
  };
19970
20389
  }
20390
+ const sourceOrigins = /* @__PURE__ */ new Map();
19971
20391
  const processed = await processDocumentComponents(
19972
20392
  modedRoot.children || [],
19973
20393
  preserveSet,
19974
20394
  warnings,
19975
20395
  modedTheme,
19976
- validateEmitted
20396
+ validateEmitted,
20397
+ ROOT_POSITION,
20398
+ sourceOrigins
19977
20399
  );
19978
20400
  const processedDocument = {
19979
20401
  ...modedRoot,
@@ -19987,7 +20409,8 @@ function createBuilderImpl(state) {
19987
20409
  processed,
19988
20410
  modedDoc,
19989
20411
  warnings,
19990
- preserveSet
20412
+ preserveSet,
20413
+ sourceOrigins
19991
20414
  };
19992
20415
  }
19993
20416
  async function expandStandardDefinition(document, options) {
@@ -20044,22 +20467,33 @@ function createBuilderImpl(state) {
20044
20467
  const deterministic = options?.deterministic ?? state.deterministic;
20045
20468
  const generatedAt = options?.generatedAt ?? state.generatedAt;
20046
20469
  const renderer = options?.renderer ?? state.renderer ?? prepared.renderer;
20047
- const { buffer } = await generateBufferViaIr(context.document, {
20048
- context,
20049
- prepared,
20050
- ...state.services ? { services: state.services } : {},
20051
- ...state.fonts ? { fonts: state.fonts } : {},
20052
- ...baseDir !== void 0 ? { baseDir } : {},
20053
- ...deterministic !== void 0 ? { deterministic } : {},
20054
- ...generatedAt !== void 0 ? { generatedAt } : {},
20055
- ...renderer !== void 0 ? { renderer } : {},
20470
+ const { buffer, ir, imageOrigins } = await generateBufferViaIr(
20471
+ context.document,
20472
+ {
20473
+ context,
20474
+ prepared,
20475
+ ...state.services ? { services: state.services } : {},
20476
+ ...state.fonts ? { fonts: state.fonts } : {},
20477
+ ...baseDir !== void 0 ? { baseDir } : {},
20478
+ ...deterministic !== void 0 ? { deterministic } : {},
20479
+ ...generatedAt !== void 0 ? { generatedAt } : {},
20480
+ ...renderer !== void 0 ? { renderer } : {},
20481
+ warnings
20482
+ }
20483
+ );
20484
+ const renderManifest = manifestOf(
20485
+ buffer,
20486
+ ir,
20487
+ imageOrigins,
20488
+ /* @__PURE__ */ new Map(),
20056
20489
  warnings
20057
- });
20490
+ );
20058
20491
  return {
20059
20492
  buffer,
20060
20493
  warnings: warnings.length > 0 ? warnings : null,
20061
20494
  standardDefinition: context.document,
20062
- preservedDefinition: void 0
20495
+ preservedDefinition: void 0,
20496
+ ...renderManifest && { renderManifest }
20063
20497
  };
20064
20498
  }
20065
20499
  async function generateBuffer(document, options) {
@@ -20075,13 +20509,14 @@ function createBuilderImpl(state) {
20075
20509
  sourceMap,
20076
20510
  blockPaths,
20077
20511
  warnings,
20078
- preserveSet
20512
+ preserveSet,
20513
+ sourceOrigins
20079
20514
  } = await expandDocument(document, options);
20080
20515
  const baseDir = options?.baseDir ?? state.baseDir;
20081
20516
  const deterministic = options?.deterministic ?? state.deterministic;
20082
20517
  const generatedAt = options?.generatedAt ?? state.generatedAt;
20083
20518
  const renderer = options?.renderer ?? state.renderer ?? modedRoot.renderer;
20084
- const { buffer } = await generateBufferViaIr(modedDoc, {
20519
+ const { buffer, ir, imageOrigins } = await generateBufferViaIr(modedDoc, {
20085
20520
  // The prologue already ran: the theme had to be resolved before custom
20086
20521
  // components expanded, because each one's `render` is handed it.
20087
20522
  context: {
@@ -20103,11 +20538,19 @@ function createBuilderImpl(state) {
20103
20538
  ...modedRoot,
20104
20539
  children: processed.preserved
20105
20540
  } : void 0;
20541
+ const renderManifest = manifestOf(
20542
+ buffer,
20543
+ ir,
20544
+ imageOrigins,
20545
+ sourceOrigins,
20546
+ warnings
20547
+ );
20106
20548
  return {
20107
20549
  buffer,
20108
20550
  warnings: warnings.length > 0 ? warnings : null,
20109
20551
  standardDefinition: modedDoc,
20110
- preservedDefinition
20552
+ preservedDefinition,
20553
+ ...renderManifest && { renderManifest }
20111
20554
  };
20112
20555
  } catch (error) {
20113
20556
  if (state.debug) {
@@ -20117,7 +20560,13 @@ function createBuilderImpl(state) {
20117
20560
  }
20118
20561
  }
20119
20562
  async function generateFile(document, outputPath, options) {
20120
- const { buffer, warnings, standardDefinition, preservedDefinition } = await generateBuffer(document, options);
20563
+ const {
20564
+ buffer,
20565
+ warnings,
20566
+ standardDefinition,
20567
+ preservedDefinition,
20568
+ renderManifest
20569
+ } = await generateBuffer(document, options);
20121
20570
  const fs6 = await import("fs/promises");
20122
20571
  await fs6.writeFile(outputPath, new Uint8Array(buffer));
20123
20572
  let preservedOutputPath;
@@ -20138,7 +20587,8 @@ function createBuilderImpl(state) {
20138
20587
  warnings,
20139
20588
  standardDefinition,
20140
20589
  preservedDefinition,
20141
- preservedOutputPath
20590
+ preservedOutputPath,
20591
+ ...renderManifest && { renderManifest }
20142
20592
  };
20143
20593
  }
20144
20594
  function getComponentNames() {
@@ -20234,6 +20684,7 @@ export {
20234
20684
  DOCX_DEFAULT_QUALITY_PROFILE,
20235
20685
  DOCX_QUALITY_PROFILES,
20236
20686
  DOCX_QUALITY_RULES,
20687
+ RENDER_MANIFEST_UNAVAILABLE,
20237
20688
  ThemeFileError,
20238
20689
  ThemeParseError,
20239
20690
  ThemeValidationError,
@@ -20300,6 +20751,8 @@ export {
20300
20751
  resetChartRequestStats,
20301
20752
  resetVisualPrepassStats,
20302
20753
  resolveDocxQualityProfile,
20754
+ resolveHighchartsOptions,
20755
+ resolveHighchartsRequest,
20303
20756
  runExample,
20304
20757
  themes,
20305
20758
  toAuthoredPointer,