@openpresentation/opf 0.35.0 → 0.36.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 (52) hide show
  1. package/dist/browser.js +16 -16
  2. package/dist/{chunk-4UMZDDJG.js → chunk-2NIID3QD.js} +6 -6
  3. package/dist/{chunk-KNMMEE67.js → chunk-4FA4AZXY.js} +67 -46
  4. package/dist/{chunk-3ZTKRX7F.js → chunk-6WVPFWPD.js} +2 -2
  5. package/dist/{chunk-VMPOCXTE.js → chunk-7JE3XTL7.js} +4 -4
  6. package/dist/{chunk-ZZWX4W2G.js → chunk-APCNAAA7.js} +2 -2
  7. package/dist/{chunk-ARPMSD7V.js → chunk-AZELWKG2.js} +1 -1
  8. package/dist/{chunk-GKUAVSXU.js → chunk-BPSZ7OWD.js} +2 -2
  9. package/dist/{chunk-NPRNWPP4.js → chunk-F5SY7MSA.js} +1 -1
  10. package/dist/{chunk-2GCTKQDD.js → chunk-GNKOQ6NA.js} +4 -4
  11. package/dist/{chunk-LDLLZQPP.js → chunk-HHQROUYC.js} +1096 -261
  12. package/dist/{chunk-P2ACZJUL.js → chunk-J7FUSZZ5.js} +4 -4
  13. package/dist/{chunk-MVPQEMCP.js → chunk-O65COLKF.js} +3 -3
  14. package/dist/{chunk-JQNT37IO.js → chunk-OFL3WY6F.js} +2 -2
  15. package/dist/{chunk-HORPH6O7.js → chunk-SER6GJTT.js} +9 -7
  16. package/dist/{chunk-7KUUIL7W.js → chunk-TJMESSBQ.js} +6 -1
  17. package/dist/{chunk-GGN3NQDK.js → chunk-XRMYP4JD.js} +1 -1
  18. package/dist/{composition-BmJfljJl.d.ts → composition-CSM7YfBl.d.ts} +142 -14
  19. package/dist/composition.d.ts +1 -1
  20. package/dist/composition.js +1 -1
  21. package/dist/{conversion-BbXhlurO.d.ts → conversion-CL7ipVGO.d.ts} +6 -4
  22. package/dist/conversion-FTGQLJK7.js +25 -0
  23. package/dist/convert.d.ts +1 -1
  24. package/dist/convert.js +6 -6
  25. package/dist/data.js +2 -2
  26. package/dist/{deck-report-BYkbL7uT.d.ts → deck-report-DhsB0SUz.d.ts} +1 -1
  27. package/dist/deck.d.ts +4 -4
  28. package/dist/deck.js +9 -9
  29. package/dist/diff.js +3 -3
  30. package/dist/docs.js +25 -13
  31. package/dist/examples.js +3013 -2599
  32. package/dist/ids.js +3 -3
  33. package/dist/index.d.ts +8 -8
  34. package/dist/index.js +19 -19
  35. package/dist/markdown.d.ts +1 -1
  36. package/dist/markdown.js +7 -7
  37. package/dist/node-engine.d.ts +4 -4
  38. package/dist/node-engine.js +18 -18
  39. package/dist/{pagination-C0FPjO29.d.ts → pagination-BSqq32xt.d.ts} +1 -1
  40. package/dist/pagination.d.ts +2 -2
  41. package/dist/pagination.js +3 -3
  42. package/dist/patch.js +2 -2
  43. package/dist/repo-readme.js +1 -1
  44. package/dist/schema.js +2 -2
  45. package/dist/source.js +9 -9
  46. package/dist/{validation-types-DKIe1RQW.d.ts → validation-types-bnrso0JL.d.ts} +1 -1
  47. package/dist/validator.d.ts +3 -3
  48. package/dist/validator.js +2 -2
  49. package/dist/yaml.d.ts +1 -1
  50. package/dist/yaml.js +5 -5
  51. package/package.json +5 -5
  52. package/dist/conversion-VWCH3NKR.js +0 -25
@@ -31,6 +31,32 @@ function arrangementTree(entries) {
31
31
 
32
32
  // src/native-tree-arrangement.ts
33
33
  function nativeTreeGeometry(kind2, frame, entries) {
34
+ const model = treeModel(kind2, frame, entries);
35
+ if (!model.ok) return model;
36
+ const { root, org, span, stride, height, frontY } = model;
37
+ const width = Math.max(...root.nodes.map((node) => node.x + span)), tall = Math.max(...root.nodes.map((node) => node.row * stride + height + frontY));
38
+ let low = 0, high = (org ? 1.25 : 0.9) * frame.width;
39
+ for (let step = 0; step < 40 && high - low > 2e-3 * (low + high) / 2; step++) {
40
+ const mid = (low + high) / 2;
41
+ if (width * mid <= frame.width + 1e-8 && tall * mid <= frame.height + 1e-8) low = mid;
42
+ else high = mid;
43
+ }
44
+ return placeTree(model, frame.x + (frame.width - width * low) / 2, frame.y + (frame.height - tall * low) / 2, low, low, (row) => row * stride * low, height * low);
45
+ }
46
+ function opfTreeGeometry(kind2, frame, entries, share2 = OPF_TREE_SHARE, aspect = OPF_TREE_ASPECT) {
47
+ const model = treeModel(kind2, frame, entries);
48
+ if (!model.ok) return model;
49
+ const { root, org, span, height, frontY } = model;
50
+ const units = Math.max(...root.nodes.map((node) => node.x + span)), rows3 = Math.max(...root.nodes.map((node) => node.row)) + 1;
51
+ const sx = frame.width / units, boxWidth = (org ? 2 : 1) * sx;
52
+ const least = height * sx, most = aspect * boxWidth, fit = frame.height / ((rows3 - 1) / share2 + 1 + frontY / height);
53
+ const h = Math.min(fit, Math.max(least, most)), step = h / share2, sy = h / height, tall = (rows3 - 1) * step + h + frontY * sy;
54
+ if (!(sx > 0) || !(h > 0)) return { ok: false, reason: "The region is too small for the tree." };
55
+ return placeTree(model, frame.x, frame.y + (frame.height - tall) / 2, sx, sy, (row) => row * step, h);
56
+ }
57
+ var OPF_TREE_SHARE = 0.6;
58
+ var OPF_TREE_ASPECT = 0.75;
59
+ function treeModel(kind2, frame, entries) {
34
60
  if (kind2 !== "org-chart" && kind2 !== "hierarchy") return { ok: false, reason: "Unsupported native tree kind." };
35
61
  if (![frame.x, frame.y, frame.width, frame.height].every(Number.isFinite) || frame.width <= 0 || frame.height <= 0) return { ok: false, reason: "A native tree frame needs finite coordinates and positive dimensions." };
36
62
  const tree = arrangementTree(entries);
@@ -84,19 +110,15 @@ function nativeTreeGeometry(kind2, frame, entries) {
84
110
  }
85
111
  const root = models[0];
86
112
  if (!root) return { ok: false, reason: "A native tree needs its root geometry." };
87
- const width = Math.max(...root.nodes.map((node) => node.x + span)), tall = Math.max(...root.nodes.map((node) => node.row * stride + height + frontY));
88
- let low = 0, high = (org ? 1.25 : 0.9) * frame.width;
89
- for (let step = 0; step < 40 && high - low > 2e-3 * (low + high) / 2; step++) {
90
- const mid = (low + high) / 2;
91
- if (width * mid <= frame.width + 1e-8 && tall * mid <= frame.height + 1e-8) low = mid;
92
- else high = mid;
93
- }
94
- const x0 = frame.x + (frame.width - width * low) / 2, y0 = frame.y + (frame.height - tall * low) / 2;
113
+ return { ok: true, tree, root, org, span, gap, stride, height, frontX, frontY };
114
+ }
115
+ function placeTree(model, x0, y0, low, sy, rowY, h) {
116
+ const { tree, root, org, frontX, frontY } = model, assistant = (index) => tree.nodes[index]?.assistant === true;
95
117
  const nodes = root.nodes.map((node) => {
96
118
  const semantic = tree.nodes[node.index];
97
119
  if (!semantic) throw new Error("Native tree model lost its semantic node.");
98
- const back = { x: x0 + node.x * low, y: y0 + node.row * stride * low, width: (org ? 2 : 1) * low, height: height * low };
99
- return { index: node.index, level: semantic.level, ...semantic.parent === void 0 ? {} : { parent: semantic.parent }, box: org ? back : { ...back, x: back.x + frontX * low, y: back.y + frontY * low }, ...org ? {} : { background: back } };
120
+ const back = { x: x0 + node.x * low, y: y0 + rowY(node.row), width: (org ? 2 : 1) * low, height: h };
121
+ return { index: node.index, level: semantic.level, ...semantic.parent === void 0 ? {} : { parent: semantic.parent }, box: org ? back : { ...back, x: back.x + frontX * low, y: back.y + frontY * sy }, ...org ? {} : { background: back } };
100
122
  }).sort((a, b) => a.index - b.index);
101
123
  const connectors = [];
102
124
  for (const child of nodes) {
@@ -113,8 +135,8 @@ function nativeTreeGeometry(kind2, frame, entries) {
113
135
  const hanging = org && parent.index !== 0 && reports.length > 0 && reports.every((index) => tree.nodes[index]?.children.length === 0);
114
136
  const from = hanging ? [p.x + 0.2 * low, p.y + p.height] : [p.x + p.width / 2, p.y + p.height];
115
137
  const to = hanging ? [c.x, c.y + c.height / 2] : [c.x + c.width / 2, c.y];
116
- const width2 = Math.abs(to[0] - from[0]), straight = width2 < 1e-6;
117
- const box = { x: straight ? from[0] - 4.8 : Math.min(from[0], to[0]), y: from[1], width: straight ? 9.6 : width2, height: to[1] - from[1] };
138
+ const width = Math.abs(to[0] - from[0]), straight = width < 1e-6;
139
+ const box = { x: straight ? from[0] - 4.8 : Math.min(from[0], to[0]), y: from[1], width: straight ? 9.6 : width, height: to[1] - from[1] };
118
140
  const above = Math.max(parent.box.y + parent.box.height, ...semantic.children.filter(assistant).map((index) => {
119
141
  const node = nodes[index];
120
142
  return node.box.y + node.box.height;
@@ -190,7 +212,7 @@ var extent = (boxes) => {
190
212
  };
191
213
  var overlap = (a, b, gap = 0) => a.x < b.x + b.width + gap && b.x < a.x + a.width + gap && a.y < b.y + b.height + gap && b.y < a.y + a.height + gap;
192
214
  function fitVennShapes(frame, native, labels, gap) {
193
- if (native.length < 5 || native.length > 7 || labels.length !== native.length || !Number.isFinite(gap) || gap < 0) return void 0;
215
+ if (native.length < 4 || native.length > 7 || labels.length !== native.length || !Number.isFinite(gap) || gap < 0) return void 0;
194
216
  if (![frame.x, frame.y, frame.width, frame.height, ...native.flatMap((n) => Object.values(n.box)), ...labels.flatMap((n) => [n.width, n.height])].every(Number.isFinite)) return void 0;
195
217
  if (frame.width <= 2 * gap || frame.height <= 2 * gap || native.some((n) => n.box.width <= 0 || n.box.height <= 0) || labels.some((n) => n.width <= 0 || n.height <= 0)) return void 0;
196
218
  const cx = frame.x + frame.width / 2, cy = frame.y + frame.height / 2;
@@ -234,12 +256,12 @@ function fitVennShapes(frame, native, labels, gap) {
234
256
  if (fits(make(mid))) low = mid;
235
257
  else high = mid;
236
258
  }
237
- if (low <= 1 + 1e-6) return void 0;
259
+ if (low <= 1 + 1e-6 && native.length >= 5) return void 0;
238
260
  const result = make(low);
239
261
  for (let i = 0; i < result.slots.length; i++) for (let j = i + 1; j < result.slots.length; j++) if (overlap(result.slots[i], result.slots[j], gap / 2)) return void 0;
240
262
  const tx = cx - result.bounds.x - result.bounds.width / 2, ty = cy - result.bounds.y - result.bounds.height / 2;
241
263
  const move = (box) => ({ ...box, x: box.x + tx, y: box.y + ty });
242
- return { nodes: result.circles.map((node, index) => ({ ...node, box: move(node.box), textBox: move(result.slots[index]) })), scale: low, circleHeight: measured.height * low };
264
+ return { nodes: result.circles.map((node, index) => ({ ...node, box: move(node.box), textBox: move(result.slots[index]), beside: true })), scale: low, circleHeight: measured.height * low };
243
265
  }
244
266
 
245
267
  // src/arrangements.ts
@@ -358,12 +380,14 @@ function roundNode(index, box, radius) {
358
380
  }
359
381
  var PYRAMID_STEPS_SHARE = 0.4;
360
382
  var PYRAMID_STEPS_ASPECT = 1.6;
361
- function pyramidSteps(area2, count, gap, radius, direction = "up") {
362
- if (direction === "down") return invertedPyramid(pyramidSteps(area2, count, gap, radius), area2);
363
- const n = Math.max(1, Math.floor(count)), width = Math.min(area2.width * PYRAMID_STEPS_SHARE, area2.height * PYRAMID_STEPS_ASPECT);
364
- const height = (area2.height - (n - 1) * gap) / n, axis2 = area2.x + width / 2, column = area2.x + width + 2 * gap;
383
+ var PYRAMID_STEP_HEIGHT = 0.3;
384
+ function pyramidSteps(area2, count, gap, radius, direction = "up", inset = 0, barWidth) {
385
+ if (direction === "down") return invertedPyramid(pyramidSteps(area2, count, gap, radius, "up", inset, barWidth), area2);
386
+ const n = Math.max(1, Math.floor(count)), width = barWidth !== void 0 && barWidth > 0 ? Math.min(barWidth, area2.height * PYRAMID_STEPS_ASPECT) : Math.min(area2.width * PYRAMID_STEPS_SHARE, area2.height * PYRAMID_STEPS_ASPECT);
387
+ const height = Math.min((area2.height - (n - 1) * gap) / n, PYRAMID_STEP_HEIGHT * width), x0 = area2.x + inset, axis2 = x0 + width / 2, column = x0 + width + 2 * gap;
388
+ const top = area2.y + (area2.height - n * height - (n - 1) * gap) / 2;
365
389
  return Array.from({ length: n }, (_, index) => {
366
- const w = width * (index + 1) / n, y = area2.y + index * (height + gap);
390
+ const w = width * (index + 1) / n, y = top + index * (height + gap);
367
391
  return { ...roundNode(index, { x: axis2 - w / 2, y, width: w, height }, radius), textBox: roundBox({ x: column, y, width: area2.x + area2.width - column, height }), beside: true };
368
392
  });
369
393
  }
@@ -636,6 +660,7 @@ var SMART_ART_SCALES = Object.freeze({
636
660
  process: Object.freeze([1024, 426.5, 269, 196.75, 155, 128, 108.875, 94.75, 83.875, 75.25].map((value) => value / 1024)),
637
661
  "vertical-process": Object.freeze([1024, 409.5, 256, 186, 146.25, 120.375, 102.375, 89, 78.75, 70.5].map((value) => value / 1024))
638
662
  });
663
+ var VERTICAL_SINGLE_SHARE = 0.6;
639
664
  var SQUEEZED = 1023 / 1024;
640
665
  var CHEVRON_HEIGHT = 0.4;
641
666
  var CHEVRON_STEP = 0.9;
@@ -743,7 +768,7 @@ function linearDesign(kind2, area2, count, gap, rtl = false, lines = 1, need, co
743
768
  const nodes = [], arrows = [];
744
769
  const place2 = (box) => rtl ? mirrorBox(box, area2) : box, turn = (rotation) => rtl ? rotation === 0 ? 180 : rotation === 180 ? 0 : rotation : rotation;
745
770
  if (kind2 === "vertical-process") {
746
- const between = 2 * gap, width = (area2.width - (wrap - 1) * between) / wrap;
771
+ const between = 2 * gap, width = n === 1 ? Math.min(area2.width, VERTICAL_SINGLE_SHARE * area2.width, VERTICAL_FLOW_WIDTH * area2.height) : (area2.width - (wrap - 1) * between) / wrap;
747
772
  if (width <= 0) return void 0;
748
773
  const fixed2 = compact ? COMPACT_COLUMN_ROOM * gap : 0;
749
774
  const tallest2 = Math.min(compact ? (area2.height - (most - 1) * fixed2) / most : area2.height / (most + OPF_COLUMN_ROOM * (most - 1)), OPF_MOST["vertical-process"] * width);
@@ -754,7 +779,7 @@ function linearDesign(kind2, area2, count, gap, rtl = false, lines = 1, need, co
754
779
  const length2 = compact ? COMPACT_ARROW_LENGTH * room2 : OPF_COLUMN_ARROW_LENGTH * h2, thick2 = compact ? COMPACT_ARROW_THICKNESS * room2 : OPF_COLUMN_ARROW_THICKNESS * h2;
755
780
  let entry2 = 0;
756
781
  counts.forEach((k, column) => {
757
- const own3 = (span - (k - 1) * room2) / k, x = area2.x + column * (width + between), up = column % 2 === 1;
782
+ const own3 = (span - (k - 1) * room2) / k, x = (n === 1 ? area2.x + (area2.width - width) / 2 : area2.x) + column * (width + between), up = column % 2 === 1;
758
783
  for (let j = 0; j < k; j++) {
759
784
  const slot = up ? k - 1 - j : j, y = y02 + slot * (own3 + room2);
760
785
  nodes.push(boxNode(entry2 + j, place2({ x, y, width, height: own3 }), FLOW_ROUND_ADJUST));
@@ -784,7 +809,7 @@ function linearDesign(kind2, area2, count, gap, rtl = false, lines = 1, need, co
784
809
  let entry = 0;
785
810
  counts.forEach((k, row) => {
786
811
  const y = y0 + row * (h + rowGap), back = !chevrons && row % 2 === 1;
787
- const w = chevrons ? widthOf(k) : (area2.width - (k - 1) * room) / k;
812
+ const w = chevrons ? full : (area2.width - (k - 1) * room) / k;
788
813
  const left = (slot) => area2.x + slot * (chevrons ? compact ? w - COMPACT_CHEVRON_DEPTH * w + fixed : CHEVRON_STEP * w : w + room);
789
814
  for (let j = 0; j < k; j++) {
790
815
  const slot = back ? k - 1 - j : j, box = { x: left(slot), y, width: w, height: h };
@@ -1085,7 +1110,7 @@ function opfLayoutGeometry(recipe, count) {
1085
1110
  case "cycle-loop-3":
1086
1111
  return cycleLoop(area2, count, gap, rtl, recipe.design === "cycle-loop-3" ? 3 : 2) ?? cycleRing(area2, count, gap, rtl);
1087
1112
  case "pyramid-steps":
1088
- return { nodes: pyramidSteps(area2, count, gap, radius) };
1113
+ return { nodes: pyramidSteps(area2, count, gap, radius, "up", recipe.inset ?? 0, recipe.barWidth) };
1089
1114
  case "matrix-quadrants":
1090
1115
  return count === 4 ? { nodes: matrixQuadrants(area2, gap) } : grid(count, Math.ceil(Math.sqrt(count)));
1091
1116
  case "card-grid":
@@ -5587,6 +5612,7 @@ function chartValueAxis(chart, resolved2, geometry) {
5587
5612
  const titleBand = options.axisTitles.category ? lineHeight : 0;
5588
5613
  const length = spec.horizontal ? width * 0.7 - 2 * pad - fontPx : height - 2 * pad - lineHeight * 1.5 - legendBand - titleBand;
5589
5614
  const fitted = niceScale(dataMin, dataMax, chartIntervalsFor(Math.max(1, length), spec.horizontal ? 4 * fontPx : lineHeight * 1.2, scale2), { percent, labeled: geometry.labeled === true && spec.kind === "line" });
5615
+ if (geometry.labeled === true && spec.kind === "bar" && !spec.horizontal && !percent && dataMin >= 0 && dataMax > 0 && fitted.max > dataMax) return { min: fitted.min, max: dataMax, majorUnit: fitted.step };
5590
5616
  return { min: fitted.min, max: fitted.max, majorUnit: fitted.step, ...percent ? { percent: true } : {} };
5591
5617
  }
5592
5618
  function chartComboAxes(chart, resolved2, geometry) {
@@ -5737,8 +5763,9 @@ function chartValueList(chart, data, geometry, options = {}) {
5737
5763
  if (radius < alone * (crowded ? 0.8 : 1) - 0.5) return void 0;
5738
5764
  const rtl = geometry.direction === "rtl";
5739
5765
  const mirror = (part) => rtl ? { ...part, x: box.x + box.width - (part.x - box.x) - part.width } : part;
5740
- const pie = mirror({ x: area2.x + pieWidth / 2 - radius, y: area2.y + area2.height / 2 - radius, width: 2 * radius, height: 2 * radius });
5741
- const listX = area2.x + pieWidth + between, listHeight = headerHeight + entries.length * pitch, top = area2.y + (area2.height - listHeight) / 2;
5766
+ const offset = Math.max(0, (pieWidth - 2 * radius) / 2);
5767
+ const pie = mirror({ x: area2.x + offset, y: area2.y + area2.height / 2 - radius, width: 2 * radius, height: 2 * radius });
5768
+ const listX = area2.x + offset + 2 * radius + between, listHeight = headerHeight + entries.length * pitch, top = area2.y + (area2.height - listHeight) / 2;
5742
5769
  const hole = type === "doughnut" ? doughnutHole(pie, entries, options.focus?.categories ?? [], { fontPx, textHeight: metrics(box, scale2, geometry.minFontSize).textHeight, measure: geometry.measure }) : void 0;
5743
5770
  return {
5744
5771
  pie,
@@ -5805,7 +5832,7 @@ function doughnutLabelFit(chart, data, geometry, pie) {
5805
5832
  if (without.length && without.length < authored.length && fits(without)) return { content: without, from: [...authored] };
5806
5833
  return { content: null, from: [...authored] };
5807
5834
  }
5808
- function chartCircleSquare(chart, data, geometry, layer) {
5835
+ function chartCircleSquare(chart, data, geometry, layer, { labels = false } = {}) {
5809
5836
  if (!record7(chart) || !data.ok || data.columns.length < 2 || !data.rows.length) return void 0;
5810
5837
  const { box, scale: scale2 } = geometry;
5811
5838
  if (!usable2(box, scale2)) return void 0;
@@ -5816,8 +5843,9 @@ function chartCircleSquare(chart, data, geometry, layer) {
5816
5843
  return { x: cx - radius, y: cy - radius, width: 2 * radius, height: 2 * radius };
5817
5844
  };
5818
5845
  const pie = typeOf(chart) === "pie";
5819
- if (pie && options.dataLabels && (options.dataLabels.position ?? "outside-end") === "outside-end") return void 0;
5820
- const outside = pie && !options.dataLabels && layer?.slices ? layer.slices.labels.filter((entry) => entry.position === "outside").map((entry) => label3(data.rows[entry.row]?.[0])) : [];
5846
+ const outsideLabels = pie && options.dataLabels && (options.dataLabels.position ?? "outside-end") === "outside-end";
5847
+ if (outsideLabels && !labels) return void 0;
5848
+ const outside = outsideLabels ? pieLabelTexts(data, options.dataLabels, geometry.language) : pie && !options.dataLabels && layer?.slices ? layer.slices.labels.filter((entry) => entry.position === "outside").map((entry) => label3(data.rows[entry.row]?.[0])) : [];
5821
5849
  const radiusIn = (area3) => outside.length ? Math.max(1, Math.min(area3.width / 2 - (Math.max(0, ...outside.map((text2) => geometry.measure(text2, fontPx, 400) + fontPx * 0.5)) + fontPx * 0.25), area3.height / 2 - (lineHeight + fontPx * 0.25))) : Math.max(1, Math.min(area3.width, area3.height) / 2 * 0.9);
5822
5850
  if (options.active || layer?.header) {
5823
5851
  let outer = layer?.header ? { ...box, y: box.y + layer.header.height, height: Math.max(1, box.height - layer.header.height) } : box;
@@ -5852,6 +5880,17 @@ function chartCircleSquare(chart, data, geometry, layer) {
5852
5880
  const area2 = { x: box.x + pad, y: box.y + pad, width: Math.max(1, box.width - 2 * pad - legend), height: Math.max(1, box.height - 2 * pad) };
5853
5881
  return square(area2, radiusIn(area2));
5854
5882
  }
5883
+ function pieLabelTexts(data, dataLabels, language) {
5884
+ if (!data.ok) return [];
5885
+ const values = data.rows.map((row) => chartNumber(row[1]) ?? 0), total = values.reduce((sum, value) => sum + Math.abs(value), 0);
5886
+ const format = typeof data.formats[1] === "string" && data.formats[1] !== "" && !numberFormatError(data.formats[1]) ? data.formats[1] : void 0;
5887
+ const group = format === void 0 && columnGroups(data, 1) ? { language } : void 0;
5888
+ return data.rows.map((row, index) => chartLabelText({
5889
+ category: row[0] === null || row[0] === void 0 ? "" : String(row[0]),
5890
+ value: valueLabel(values[index], format, group, language),
5891
+ percent: formatChartLabelPercent(total ? Math.abs(values[index]) / total : 0, language)
5892
+ }, dataLabels.content ?? [], dataLabels.separator));
5893
+ }
5855
5894
  function doughnutHole(pie, entries, focus, m) {
5856
5895
  if (focus.length !== 1) return void 0;
5857
5896
  const entry = entries.find((candidate) => candidate.row === focus[0]);
@@ -6426,6 +6465,7 @@ function sameKeys(a, b, language = "en") {
6426
6465
  }
6427
6466
  return a.every((key, index) => key.trim() !== "" && collator.compare(key.trim(), b[index].trim()) === 0);
6428
6467
  }
6468
+ var UNBREAKABLE_SPLIT = /[^\S  ]+/u;
6429
6469
  function tableRowKeys(rows3) {
6430
6470
  return rows3.map((row) => tableKeyText(row[0]));
6431
6471
  }
@@ -6441,7 +6481,8 @@ function alignBarRows(data, box, rows3, centers, options) {
6441
6481
  const top = rows3[0].y, bottom = rows3[rows3.length - 1].y + rows3[rows3.length - 1].height;
6442
6482
  if (top < box.y + header - 0.5 || bottom > box.y + box.height - (options.hiddenAxis ? 0 : lineHeight) + 0.5 || bottom - top < rows3.length * scale2) return void 0;
6443
6483
  const labels = data.rows.map((row) => row[0] === null || row[0] === void 0 ? "" : String(row[0]).replace(/[\r\n]+/g, " "));
6444
- const gutter = Math.min(box.width * 0.3, Math.max(0, ...labels.map((label6) => options.measure(label6, fontPx))) + fontPx * 0.5);
6484
+ const longestWord = Math.max(0, ...labels.flatMap((label6) => label6.split(UNBREAKABLE_SPLIT).map((word) => options.measure(word, fontPx)))) + fontPx * 0.5;
6485
+ const gutter = Math.min(Math.max(box.width * 0.3, Math.min(box.width * 0.4, longestWord)), Math.max(0, ...labels.map((label6) => options.measure(label6, fontPx))) + fontPx * 0.5);
6445
6486
  const values = data.rows.flatMap((row) => row.slice(1).filter((value) => typeof value === "number").map(String));
6446
6487
  const labelRoom = options.hiddenAxis && options.labels ? Math.max(0, ...values.map((value) => options.measure(value, fontPx) + fontPx * 0.5)) : 0;
6447
6488
  const left = pad + gutter + pad / 2, right = pad + fontPx + labelRoom;
@@ -7934,6 +7975,43 @@ function validAdjust(preset, adjust, width = 100, height = 100) {
7934
7975
  }
7935
7976
  return out;
7936
7977
  }
7978
+ var PATH_UNITS_EXTENT = 3;
7979
+ var PATH_ARITY = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
7980
+ function pathExtent(data) {
7981
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity, x = 0, y = 0, startX = 0, startY = 0;
7982
+ const point = (px, py) => {
7983
+ minX = Math.min(minX, px);
7984
+ maxX = Math.max(maxX, px);
7985
+ minY = Math.min(minY, py);
7986
+ maxY = Math.max(maxY, py);
7987
+ };
7988
+ for (const [, command, rest] of data.matchAll(/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g)) {
7989
+ const upper = command.toUpperCase(), relative = command !== upper, arity = PATH_ARITY[upper];
7990
+ if (arity === 0) {
7991
+ x = startX;
7992
+ y = startY;
7993
+ continue;
7994
+ }
7995
+ const numbers = (rest.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g) ?? []).map(Number);
7996
+ if (numbers.length === 0 || numbers.length % arity !== 0 || !numbers.every(Number.isFinite)) return void 0;
7997
+ for (let index = 0; index < numbers.length; index += arity) {
7998
+ const n = numbers.slice(index, index + arity), ox = relative ? x : 0, oy = relative ? y : 0;
7999
+ if (upper === "H") x = n[0] + ox;
8000
+ else if (upper === "V") y = n[0] + oy;
8001
+ else {
8002
+ for (let k = 0; k + 1 < arity && upper !== "A"; k += 2) point(n[k] + ox, n[k + 1] + oy);
8003
+ x = n[arity - 2] + ox;
8004
+ y = n[arity - 1] + oy;
8005
+ }
8006
+ if (upper === "M") {
8007
+ startX = x;
8008
+ startY = y;
8009
+ }
8010
+ point(x, y);
8011
+ }
8012
+ }
8013
+ return Number.isFinite(minX) ? { width: maxX - minX, height: maxY - minY } : void 0;
8014
+ }
7937
8015
  function shapeIssues(host, at3) {
7938
8016
  const value = record13(host), issues = [];
7939
8017
  const preset = typeof value.shape === "string" ? value.shape : value.image !== void 0 ? "rect" : void 0;
@@ -7955,6 +8033,12 @@ function shapeIssues(host, at3) {
7955
8033
  }
7956
8034
  }
7957
8035
  }
8036
+ if (value.path !== void 0 && value.shape === void 0 && (typeof value.path === "string" || typeof value.path === "object" && value.path !== null && record13(value.path).viewBox === void 0)) {
8037
+ const extent2 = pathExtent(typeof value.path === "string" ? value.path : String(record13(value.path).d));
8038
+ const width = extent2?.width ?? 0, height = extent2?.height ?? 0;
8039
+ if (extent2 && Math.max(width, height) > PATH_UNITS_EXTENT)
8040
+ issues.push({ path: at3("path"), code: "shape-path-units", message: `the path spans ${Number(width.toPrecision(3))} by ${Number(height.toPrecision(3))} units, but a path without a viewBox is drawn in a 0 to 1 box`, params: { width, height, limit: PATH_UNITS_EXTENT } });
8041
+ }
7958
8042
  if (value.hidden === true && typeof value.link === "string") issues.push({ path: at3("link"), code: "shape-link-hidden", message: "a hidden shape is not drawn, so its link cannot be clicked", params: {} });
7959
8043
  return issues;
7960
8044
  }
@@ -8513,8 +8597,9 @@ function listGridShape(count, maxColumns = 4) {
8513
8597
  if (!Number.isInteger(count) || count < 1) return { columns: 1, rows: 0, perRow: [] };
8514
8598
  const wanted = count <= 4 ? count : count % 3 === 0 ? 3 : 4, limit = Math.max(1, Math.floor(maxColumns));
8515
8599
  const columns2 = wanted <= limit ? wanted : Math.ceil(count / Math.ceil(count / limit));
8516
- const rows3 = Math.ceil(count / columns2);
8517
- return { columns: columns2, rows: rows3, perRow: Array.from({ length: rows3 }, (_, row) => Math.min(columns2, count - row * columns2)) };
8600
+ const rows3 = Math.ceil(count / columns2), base = Math.floor(count / rows3), extra = count % rows3;
8601
+ const perRow = Array.from({ length: rows3 }, (_, row) => base + (row < extra ? 1 : 0));
8602
+ return { columns: perRow[0], rows: rows3, perRow };
8518
8603
  }
8519
8604
  function flowShape(arrangement, count, landscape) {
8520
8605
  if (count < 1) return { columns: 1, rows: 0, perRow: [] };
@@ -8639,7 +8724,7 @@ function listColumnBreaks(heights, levels, count) {
8639
8724
  if (!allowed[next]) continue;
8640
8725
  const rest = solve(next, columns2 - 1);
8641
8726
  const cost = Math.max(span(start, next), rest.cost);
8642
- if (cost < best.cost - 1e-9) best = { cost, breaks: [next, ...rest.breaks] };
8727
+ if (cost < best.cost - 1e-9 || best.breaks.length && cost <= best.cost + 1e-9) best = { cost, breaks: [next, ...rest.breaks] };
8643
8728
  }
8644
8729
  memo.set(key, best);
8645
8730
  return best;
@@ -8732,6 +8817,7 @@ function eyebrowLabel(label6, text2) {
8732
8817
  return !!name && !!body && isLabelText(name) && !isLabelText(body) && [...body].length >= PAIR_LENGTH_RATIO * [...name].length;
8733
8818
  }
8734
8819
  function groupingNode(node) {
8820
+ if (node.kind === "text" && node.value.text === void 0 && node.value.bullets !== void 0) return { kind: "list" };
8735
8821
  return { kind: node.kind, ...node.kind === "group" ? { group: true } : {}, ...node.kind === "text" ? { length: textLength(node.value.text ?? node.value.bullets) } : {} };
8736
8822
  }
8737
8823
  function groupBinding(binding, template, nodes, options = {}) {
@@ -8895,6 +8981,115 @@ function metricPillFill(backdrop, text2) {
8895
8981
  return surfaceAltColor(backdrop, text2);
8896
8982
  }
8897
8983
 
8984
+ // src/svg-stop-colors.ts
8985
+ var NUMBER = "[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?";
8986
+ var LEGACY_HSL = new RegExp(`^hsla?\\(\\s*(${NUMBER})(deg|grad|rad|turn)?\\s*,\\s*(${NUMBER})%\\s*,\\s*(${NUMBER})%\\s*(?:,\\s*(${NUMBER})(%?)\\s*)?\\)$`, "i");
8987
+ var MODERN_HSL = new RegExp(`^hsla?\\(\\s*(${NUMBER})(deg|grad|rad|turn)?\\s+(${NUMBER})%?\\s+(${NUMBER})%?\\s*(?:\\/\\s*(${NUMBER})(%?)\\s*)?\\)$`, "i");
8988
+ var OPACITY = new RegExp(`^\\s*(${NUMBER})(%?)\\s*$`, "i");
8989
+ var UNITS = { deg: 1, grad: 0.9, rad: 180 / Math.PI, turn: 360 };
8990
+ var DECLARATION = /(^|;)(\s*)([-\w]+)(\s*:\s*)([^;]*?)(\s*(?:!important)?\s*)(?=;|$)/gi;
8991
+ function hslStopColor(value) {
8992
+ const match = LEGACY_HSL.exec(value.trim()) ?? MODERN_HSL.exec(value.trim());
8993
+ if (!match) return void 0;
8994
+ const degrees = Number(match[1]) * (UNITS[(match[2] ?? "deg").toLowerCase()] ?? 1);
8995
+ if (!Number.isFinite(degrees)) return void 0;
8996
+ const hue = (degrees % 360 + 360) % 360;
8997
+ const saturation = Math.min(100, Math.max(0, Number(match[3]))) / 100;
8998
+ const lightness = Math.min(100, Math.max(0, Number(match[4]))) / 100;
8999
+ const amplitude = saturation * Math.min(lightness, 1 - lightness);
9000
+ const channel = (offset) => {
9001
+ const k = (offset + hue / 30) % 12;
9002
+ const level = lightness - amplitude * Math.max(-1, Math.min(k - 3, 9 - k, 1));
9003
+ return Math.round(level * 255).toString(16).padStart(2, "0");
9004
+ };
9005
+ const alpha = match[5] === void 0 ? 1 : Math.min(1, Math.max(0, Number(match[5]) / (match[6] ? 100 : 1)));
9006
+ if (!Number.isFinite(alpha)) return void 0;
9007
+ return { color: "#" + channel(0) + channel(8) + channel(4), alpha };
9008
+ }
9009
+ function stopOpacityValue(value) {
9010
+ const match = OPACITY.exec(value ?? "");
9011
+ return match ? Math.min(1, Math.max(0, Number(match[1]) / (match[2] ? 100 : 1))) : void 0;
9012
+ }
9013
+ var opacityText = (value) => String(Number(value.toFixed(4)));
9014
+ var scaleOpacities = (css, factor) => css.replace(DECLARATION, (whole, lead, space, property, colon, value, tail) => {
9015
+ const own3 = String(property).toLowerCase() === "stop-opacity" ? stopOpacityValue(value) : void 0;
9016
+ return own3 === void 0 ? whole : `${lead}${space}${property}${colon}${opacityText(own3 * factor)}${tail}`;
9017
+ });
9018
+ function stopDeclarationList(css, converted, inherited = 1, color = hslStopColor) {
9019
+ let alpha = 1;
9020
+ const next = css.replace(DECLARATION, (whole, lead, space, property, colon, value, tail) => {
9021
+ if (String(property).toLowerCase() !== "stop-color") return whole;
9022
+ const stop = color(value);
9023
+ if (!stop) return whole;
9024
+ converted();
9025
+ alpha = stop.alpha;
9026
+ return `${lead}${space}${property}${colon}${stop.color}${tail}`;
9027
+ });
9028
+ if (alpha >= 1) return next;
9029
+ let scaled = false;
9030
+ const withOpacity = next.replace(DECLARATION, (whole, lead, space, property, colon, value, tail) => {
9031
+ const own3 = String(property).toLowerCase() === "stop-opacity" ? stopOpacityValue(value) : void 0;
9032
+ if (own3 === void 0) return whole;
9033
+ scaled = true;
9034
+ return `${lead}${space}${property}${colon}${opacityText(own3 * alpha)}${tail}`;
9035
+ });
9036
+ if (scaled) return withOpacity;
9037
+ const trimmed = next.replace(/\s*;?\s*$/, "");
9038
+ return `${trimmed}${trimmed ? ";" : ""}stop-opacity:${opacityText(inherited * alpha)}`;
9039
+ }
9040
+ function stopStylesheet(css, converted, color = hslStopColor) {
9041
+ return /stop-color/i.test(css) ? css.replace(/\{([^{}]*)\}/g, (_, body) => `{${stopDeclarationList(body, converted, 1, color)}}`) : css;
9042
+ }
9043
+ function stopElementAttributes(pairs, converted, color = hslStopColor) {
9044
+ const at3 = (key) => pairs.findIndex(([name]) => name === key);
9045
+ const styleIndex = at3("style"), opacityIndex = at3("stop-opacity");
9046
+ const attributeOpacity = opacityIndex < 0 ? 1 : stopOpacityValue(pairs[opacityIndex][1]) ?? 1;
9047
+ const style = styleIndex < 0 ? "" : pairs[styleIndex][1];
9048
+ const styleSetsColor = /(?:^|;)\s*stop-color\s*:/i.test(style), styleSetsOpacity = /(?:^|;)\s*stop-opacity\s*:/i.test(style);
9049
+ if (styleIndex >= 0) pairs[styleIndex][1] = stopDeclarationList(style, converted, attributeOpacity, color);
9050
+ const colorIndex = at3("stop-color");
9051
+ const stop = colorIndex < 0 ? void 0 : color(pairs[colorIndex][1]);
9052
+ if (!stop) return pairs;
9053
+ converted();
9054
+ pairs[colorIndex][1] = stop.color;
9055
+ if (stop.alpha >= 1 || styleSetsColor) return pairs;
9056
+ if (styleSetsOpacity) pairs[styleIndex][1] = scaleOpacities(pairs[styleIndex][1], stop.alpha);
9057
+ else if (opacityIndex >= 0) pairs[opacityIndex][1] = opacityText(attributeOpacity * stop.alpha);
9058
+ else pairs.push(["stop-opacity", opacityText(stop.alpha)]);
9059
+ return pairs;
9060
+ }
9061
+ var ATTRIBUTE = /(\s+)([^\s=/>]+)(\s*=\s*)(?:"([^"]*)"|'([^']*)')/g;
9062
+ var decode = (value) => value.replace(/&(?:#(\d+)|#x([0-9a-f]+)|(amp|lt|gt|quot|apos));/gi, (_, decimal, hex, name) => decimal ? String.fromCodePoint(Number(decimal)) : hex ? String.fromCodePoint(parseInt(hex, 16)) : { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" }[String(name).toLowerCase()]);
9063
+ var encode = (value, quote) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(quote === '"' ? /"/g : /'/g, quote === '"' ? "&quot;" : "&apos;");
9064
+ function svgHslStopsToSrgb(text2, { keep } = {}) {
9065
+ if (!/hsl/i.test(text2)) return text2;
9066
+ let changed = false;
9067
+ const converted = () => {
9068
+ changed = true;
9069
+ };
9070
+ const color = keep ? (value) => keep(value.trim()) ? void 0 : hslStopColor(value) : hslStopColor;
9071
+ const tag = (whole, name, rest) => {
9072
+ const attributes = [];
9073
+ for (const match of rest.matchAll(ATTRIBUTE)) attributes.push({ space: match[1], key: match[2], equals: match[3], quote: match[4] !== void 0 ? '"' : "'", value: decode(match[4] ?? match[5] ?? "") });
9074
+ if (!attributes.some(({ key }) => key === "style" || key === "stop-color")) return whole;
9075
+ const local = name.slice(name.indexOf(":") + 1);
9076
+ const pairs = attributes.map(({ key, value }) => [key, value]);
9077
+ const written = local === "stop" ? stopElementAttributes(pairs, converted, color) : pairs.map(([key, value]) => [key, key === "style" ? stopDeclarationList(value, converted, 1, color) : value]);
9078
+ let index = 0;
9079
+ const body = rest.replace(ATTRIBUTE, (match, space, key, equals, double) => {
9080
+ const quote = double !== void 0 ? '"' : "'";
9081
+ const value = written[index++][1];
9082
+ return value === decode(double ?? /=\s*'([^']*)'/.exec(match)?.[1] ?? "") ? match : `${space}${key}${equals}${quote}${encode(value, quote)}${quote}`;
9083
+ });
9084
+ const added = written.slice(attributes.length).map(([key, value]) => ` ${key}="${encode(value, '"')}"`).join("");
9085
+ const close2 = /\s*\/?>$/.exec(body)?.[0] ?? "";
9086
+ return `<${name}${body.slice(0, body.length - close2.length)}${added}${close2}`;
9087
+ };
9088
+ let out = text2.replace(/<([A-Za-z_][\w.:-]*)(\s(?:"[^"]*"|'[^']*'|[^'">])*\/?>)/g, tag);
9089
+ out = out.replace(/(<(?:[A-Za-z_][\w.-]*:)?style\b[^>]*>)([\s\S]*?)(<\/(?:[A-Za-z_][\w.-]*:)?style>)/g, (_, open, css, close2) => open + css.replace(/(<!\[CDATA\[)([\s\S]*?)(\]\]>)|([^<]+)/g, (part, cdataOpen, cdata, cdataClose, plain3) => cdataOpen ? cdataOpen + stopStylesheet(cdata, converted, color) + cdataClose : plain3 !== void 0 ? stopStylesheet(plain3, converted, color) : part) + close2);
9090
+ return changed ? out : text2;
9091
+ }
9092
+
8898
9093
  // src/direction.ts
8899
9094
  var strongRtl = /[\u200F\u061C]|(?=\p{L})[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Hanifi_Rohingya}\p{Script=Mandaic}\p{Script=Samaritan}\p{Script=Mende_Kikakui}\p{Script=Imperial_Aramaic}\p{Script=Phoenician}\p{Script=Kharoshthi}\p{Script=Old_South_Arabian}\p{Script=Old_North_Arabian}\p{Script=Avestan}\p{Script=Inscriptional_Parthian}\p{Script=Inscriptional_Pahlavi}\p{Script=Psalter_Pahlavi}\p{Script=Old_Turkic}\p{Script=Old_Hungarian}\p{Script=Nabataean}\p{Script=Palmyrene}\p{Script=Hatran}\p{Script=Manichaean}\p{Script=Sogdian}\p{Script=Old_Sogdian}\p{Script=Elymaic}\p{Script=Chorasmian}\p{Script=Yezidi}\p{Script=Cypriot}\p{Script=Lydian}\p{Script=Meroitic_Cursive}\p{Script=Meroitic_Hieroglyphs}\u{10F70}-\u{10FAF}\u{10D40}-\u{10D8F}]/u;
8900
9095
  var strongLtr = /[\u200E\p{L}\p{Nl}]/u;
@@ -9627,7 +9822,7 @@ function unwrapQuoteMarks(text2) {
9627
9822
  var GLUE_SPACE = /^[ \u2009]$/;
9628
9823
  var BREAKING_SPACE = /^[^\S\u00a0\u202f\ufeff]/u;
9629
9824
  var SYMBOL_UNITS = "%\u2030\u066A\xB0\u2032\u2033\u2103\u2109\xD7\u2116";
9630
- var UNITS = /* @__PURE__ */ new Set([
9825
+ var UNITS2 = /* @__PURE__ */ new Set([
9631
9826
  "x",
9632
9827
  "X",
9633
9828
  "k",
@@ -9774,7 +9969,7 @@ var endsNumber = (word) => isDigit(Array.from(word).at(-1));
9774
9969
  function isUnitWord(word) {
9775
9970
  const bare = word.replace(TRAILING, "");
9776
9971
  if (bare === "") return false;
9777
- if (UNITS.has(bare) || UNITS.has(word)) return true;
9972
+ if (UNITS2.has(bare) || UNITS2.has(word)) return true;
9778
9973
  return SYMBOL_UNITS.includes(bare[0]) && bare.length <= 3;
9779
9974
  }
9780
9975
  var onlyClosing = (word) => [...word].every((character) => CLOSING_MARKS.includes(character) || character === '"' || character === "'");
@@ -9835,7 +10030,7 @@ function lineMayStartAt(text2, index) {
9835
10030
  if (RATIO_SLASHES.has(at3) && isDigit(before) || RATIO_SLASHES.has(before) && isDigit(at3) && isDigit(beforeThat)) return false;
9836
10031
  if (isDigit(before) && /^\p{L}$/u.test(at3)) {
9837
10032
  const unit2 = LETTERS2.exec(text2.slice(index, index + 16))?.[0].replace(TRAILING, "");
9838
- if (unit2 && UNITS.has(unit2)) return false;
10033
+ if (unit2 && UNITS2.has(unit2)) return false;
9839
10034
  }
9840
10035
  return true;
9841
10036
  }
@@ -11238,7 +11433,7 @@ function resolveCodeLanguage(language) {
11238
11433
  return Object.hasOwn(ALIASES, key) ? ALIASES[key] : void 0;
11239
11434
  }
11240
11435
  var IDENT = /[\p{L}_$][\p{L}\p{N}_$]*/uy;
11241
- var NUMBER = /(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)[a-zA-Z]{0,4}/y;
11436
+ var NUMBER2 = /(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)[a-zA-Z]{0,4}/y;
11242
11437
  var isIdentChar = (character) => character !== void 0 && /[\p{L}\p{N}_$]/u.test(character);
11243
11438
  function endOfLine(source, from) {
11244
11439
  const index = source.slice(from).search(/\r\n|\r|\n/);
@@ -11379,8 +11574,8 @@ function scanGeneric(source, def) {
11379
11574
  continue;
11380
11575
  }
11381
11576
  if (/\d/.test(character) && !isIdentChar(source[index - 1])) {
11382
- NUMBER.lastIndex = index;
11383
- const found = NUMBER.exec(source);
11577
+ NUMBER2.lastIndex = index;
11578
+ const found = NUMBER2.exec(source);
11384
11579
  if (found) {
11385
11580
  pushToken(tokens, index, index + found[0].length, "number");
11386
11581
  index += found[0].length;
@@ -14147,9 +14342,12 @@ function placeTextLines(lines, box, alignment = "left", rasterPadding = 0, direc
14147
14342
  for (const [lineIndex, line2] of lines.entries()) {
14148
14343
  const lineAlignment = physicalAlignment(alignment, directions?.[lineIndex]), factor = lineAlignment === "right" ? 1 : lineAlignment === "center" ? 0.5 : 0;
14149
14344
  if (!line2 || ![line2.width, line2.y, line2.baseline, line2.height].every(Number.isFinite) || line2.width < 0 || line2.height <= 0 || line2.y < 0 || line2.baseline < line2.y) throw new RangeError("Text lines require finite coordinates, nonnegative advances and a baseline at or below their top.");
14150
- const ink = line2.outline;
14151
- if (ink !== null && (!ink || ![ink.x, ink.y, ink.width, ink.height].every(Number.isFinite) || ink.width < 0 || ink.height < 0)) throw new RangeError("Text outlines must be null or finite coordinates with nonnegative dimensions.");
14152
- let x = box.x + (box.width - line2.width) * factor;
14345
+ if (line2.outline !== null && (!line2.outline || ![line2.outline.x, line2.outline.y, line2.outline.width, line2.outline.height].every(Number.isFinite) || line2.outline.width < 0 || line2.outline.height < 0)) throw new RangeError("Text outlines must be null or finite coordinates with nonnegative dimensions.");
14346
+ const hung = line2.hang !== void 0 && line2.advance !== void 0 && Number.isFinite(line2.hang) && Number.isFinite(line2.advance) && line2.hang > 0 && line2.advance >= line2.hang;
14347
+ const rtl = directions?.[lineIndex] === "rtl", lead = hung && rtl ? line2.hang : 0;
14348
+ const advance = hung ? line2.advance : line2.width;
14349
+ const ink = line2.outline && lead ? { ...line2.outline, x: line2.outline.x + lead } : line2.outline;
14350
+ let x = box.x + (box.width - (hung ? advance - line2.hang : line2.width)) * factor - lead;
14153
14351
  if (ink) {
14154
14352
  const low = box.x + rasterPadding - ink.x, high = box.x + box.width - rasterPadding - ink.x - ink.width;
14155
14353
  if (low > high + 0.01) overflow = true;
@@ -14161,7 +14359,7 @@ function placeTextLines(lines, box, alignment = "left", rasterPadding = 0, direc
14161
14359
  if (outline) bottom = outline.y + outline.height + rasterPadding;
14162
14360
  height = Math.max(height, y + line2.height - box.y, outline ? bottom - box.y : 0);
14163
14361
  if (line2.width > box.width + 0.01 || height > box.height + 0.01) overflow = true;
14164
- placed.push({ x, y, baseline, height: line2.height, width: line2.width, outline, ...directions ? { alignment: lineAlignment } : {} });
14362
+ placed.push({ x, y, baseline, height: line2.height, width: advance, outline, ...directions ? { alignment: lineAlignment } : {}, ...hung ? { hang: line2.hang } : {} });
14165
14363
  }
14166
14364
  return { alignment, rasterPadding, lines: placed, height, overflow };
14167
14365
  }
@@ -14180,6 +14378,16 @@ function translateTextFit(fit, dy) {
14180
14378
  }
14181
14379
  };
14182
14380
  }
14381
+ function listEntryPitches(fit) {
14382
+ const entries = fit.listEntries, first = entries[0].textBox.y;
14383
+ const pitches = entries.map((entry, index) => (entries[index + 1]?.textBox.y ?? first + fit.height) - entry.textBox.y);
14384
+ if (entries.length > 1) {
14385
+ const before = entries[entries.length - 2], bottom = Math.max(before.textBox.y + before.textBox.height, before.descriptionBox ? before.descriptionBox.y + before.descriptionBox.height : -Infinity);
14386
+ const between = pitches[entries.length - 2] - (bottom - before.textBox.y);
14387
+ if (between > 0) pitches[entries.length - 1] += between;
14388
+ }
14389
+ return pitches;
14390
+ }
14183
14391
  function translateListFit(fit, dy) {
14184
14392
  if (!dy) return fit;
14185
14393
  const down = (box) => ({ ...box, y: box.y + dy });
@@ -14617,7 +14825,7 @@ function layoutFurniture(input, options = {}) {
14617
14825
  let outline = null;
14618
14826
  if (outlines) {
14619
14827
  for (const segment2 of line2.segments) if (segment2.kind === "text") {
14620
- const bounds = measureTextOutline(part.text.slice(segment2.start, segment2.end), size, part.style, options.textMeasurement);
14828
+ const bounds = measureTextOutline(inkText(part.text.slice(segment2.start, segment2.end), line2), size, part.style, options.textMeasurement);
14621
14829
  if (bounds) {
14622
14830
  const next = { ...bounds, x: bounds.x + segment2.x };
14623
14831
  if (!outline) outline = next;
@@ -14631,7 +14839,7 @@ function layoutFurniture(input, options = {}) {
14631
14839
  }
14632
14840
  }
14633
14841
  }
14634
- return { width: line2.width, y: index2 * fit.lineHeight, baseline: size + index2 * fit.lineHeight, height: fit.lineHeight, outline };
14842
+ return { width: line2.width, ...hangOf(line2), y: index2 * fit.lineHeight, baseline: size + index2 * fit.lineHeight, height: fit.lineHeight, outline };
14635
14843
  });
14636
14844
  const natural = outlines ? placeTextLines(ink, { x: 0, y: 0, width: boxWidth, height: Number.MAX_VALUE }, side, padding) : void 0;
14637
14845
  const partHeight = natural?.height ?? fit.sourceLines.length * fit.lineHeight;
@@ -14778,6 +14986,29 @@ function balancedBreaks(text2, lines, widthOf, boxWidth) {
14778
14986
  return forced.size ? forced : void 0;
14779
14987
  }
14780
14988
  var HANGING_SPACE = /[^\S\r\n\u00a0\u202f\ufeff]/u;
14989
+ var TRAILING_HANGING_SPACE = /[^\S\r\n\u00a0\u202f\ufeff]+$/u;
14990
+ function hangingAdvance(pieces, kept) {
14991
+ let hang = 0;
14992
+ for (let index = pieces.length - 1; index >= 0; index--) {
14993
+ const piece = pieces[index];
14994
+ if (piece.kind === "marker") return hang;
14995
+ if (piece.kind === "tab") {
14996
+ hang += piece.width;
14997
+ continue;
14998
+ }
14999
+ const trailing = TRAILING_HANGING_SPACE.exec(piece.text);
15000
+ if (!trailing) return hang;
15001
+ if (trailing[0].length === piece.text.length) {
15002
+ hang += piece.width;
15003
+ continue;
15004
+ }
15005
+ const rest = kept(piece.text.slice(0, -trailing[0].length), index);
15006
+ return Number.isFinite(rest) ? hang + Math.max(0, piece.width - rest) : 0;
15007
+ }
15008
+ return 0;
15009
+ }
15010
+ var inkText = (text2, line2) => line2.hang !== void 0 && line2.hang > 0 ? text2.replace(TRAILING_HANGING_SPACE, "") : text2;
15011
+ var hangOf = (line2) => line2.hang !== void 0 && line2.advance !== void 0 ? { hang: line2.hang, advance: line2.advance } : {};
14781
15012
  var SCRIPT_WIDTH_FACTORS = [
14782
15013
  [/\p{Script=Tamil}/u, 1.53],
14783
15014
  [/\p{Script=Malayalam}/u, 1.76],
@@ -14860,7 +15091,7 @@ var LONE_TARGET = 0.6;
14860
15091
  var LONE_METRIC_TARGET = 0.8;
14861
15092
  var MESSAGE_CEILINGS = {
14862
15093
  statement: [[30, 115], [60, 80], [120, 54]],
14863
- quote: [[30, 86], [60, 72], [120, 56]]
15094
+ quote: [[12, 115], [30, 86], [60, 72], [120, 56]]
14864
15095
  };
14865
15096
  var FIGURE_CEILING = { characters: 6, size: 252 };
14866
15097
  var WIDE_CHARACTER = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul} -〿!-⦆]/u;
@@ -14874,6 +15105,13 @@ function messageCeiling(kind2, value) {
14874
15105
  const length = messageCharacters(value);
14875
15106
  return length ? MESSAGE_CEILINGS[kind2].find(([most]) => length <= most)?.[1] : void 0;
14876
15107
  }
15108
+ function loneQuote(slide) {
15109
+ const found = bodyPayloads(slide);
15110
+ if (annotationText(slide.subtitle).trim() || found?.length !== 1 || found[0].field !== "quote") return false;
15111
+ const quote = found[0].host.quote, text2 = typeof quote === "string" || Array.isArray(quote) ? quote : record19(quote).text;
15112
+ const length = messageCharacters(text2);
15113
+ return length > 0 && length <= MESSAGE_CEILINGS.quote[MESSAGE_CEILINGS.quote.length - 1][0];
15114
+ }
14877
15115
  function oneMessageField(slide) {
14878
15116
  if (annotationText(slide.subtitle).trim()) return void 0;
14879
15117
  const found = bodyPayloads(slide);
@@ -15061,7 +15299,8 @@ function layoutQuote(value, box, options = {}) {
15061
15299
  const footerRequested = attribution?.requestedFontSize ?? gridFontSize(footerSize * scale2, minimum);
15062
15300
  const usable3 = (area2) => [area2.x, area2.y, area2.width, area2.height].every(Number.isFinite) && area2.width > 0 && area2.height > 0;
15063
15301
  const from = options.message && displayTracks(quoteText) ? displayFrom(scale2) : Infinity, tight = options[TIGHT_DISPLAY] === true;
15064
- const fitAs = (part, area2, size, floor, pitchFrom, trackFrom) => part.runs ? fitRichText(part.runs, area2, size, floor, { style: part.style, textMeasurement: options.textMeasurement, ...options.citationMarker ? { citationMarker: options.citationMarker } : {}, ...options.direction ? { direction: options.direction } : {}, ...Number.isFinite(trackFrom) ? { displayFrom: trackFrom, displayPitch: Number.isFinite(pitchFrom) } : {} }) : fitText(part.text, area2, size, floor, displayMeasure(textWidthMeasurer(part.style, options.textMeasurement), part.text, trackFrom), options.direction, false, pitchFrom);
15302
+ const balance = (part) => options.message === true && part.role === "body";
15303
+ const fitAs = (part, area2, size, floor, pitchFrom, trackFrom) => part.runs ? fitRichText(part.runs, area2, size, floor, { style: part.style, textMeasurement: options.textMeasurement, ...options.citationMarker ? { citationMarker: options.citationMarker } : {}, ...options.direction ? { direction: options.direction } : {}, ...Number.isFinite(trackFrom) ? { displayFrom: trackFrom, displayPitch: Number.isFinite(pitchFrom) } : {}, ...balance(part) ? { balance: true } : {} }) : fitText(part.text, area2, size, floor, displayMeasure(textWidthMeasurer(part.style, options.textMeasurement), part.text, trackFrom), options.direction, balance(part), pitchFrom);
15065
15304
  const fit = (part, area2, size = part.requestedFontSize, floor = minimum) => {
15066
15305
  if (!usable3(area2)) return void 0;
15067
15306
  if (part.role !== "body" || !Number.isFinite(from)) return fitAs(part, area2, size, floor, Infinity, Infinity);
@@ -15239,7 +15478,7 @@ function typeScaleStep(size, floorPx, scale2, half = false) {
15239
15478
  var oneFigure = (text2) => proseWords(text2.trim()).length === 1;
15240
15479
  var FIGURE_LINES = /* @__PURE__ */ new WeakSet();
15241
15480
  var FIGURE_FITS = /* @__PURE__ */ new WeakSet();
15242
- var METRIC_TILE_VALUE_SHARE = 0.25;
15481
+ var METRIC_TILE_VALUE_SHARE = 0.4;
15243
15482
  var METRIC_DISPLAY_WIDTH = 0.9;
15244
15483
  var METRIC_DISPLAY_HEIGHT = 0.4;
15245
15484
  var METRIC_ROLE_VALUE_SIZE = 76;
@@ -15320,7 +15559,7 @@ function layoutMetric(value, box, options = {}) {
15320
15559
  const sourceValue = metric[role];
15321
15560
  if (sourceValue === void 0) continue;
15322
15561
  const text2 = (role === "value" || role === "delta") && typeof sourceValue === "number" ? formatNumber(sourceValue, options.language, { group: Math.abs(sourceValue) >= NUMBER_GROUPING_MIN }) : String(sourceValue), path = scalar ? sourcePath : `${sourcePath}.${role}`;
15323
- const valueSize = options.tile ? Math.min(152, Math.max(76, box.height * METRIC_TILE_VALUE_SHARE / scale2)) : 76;
15562
+ const valueSize = options.tile ? Math.min(228, Math.max(76, box.height * METRIC_TILE_VALUE_SHARE / scale2)) : 76;
15324
15563
  const least = snapFontSizeUp(Math.max(minimum, options.minimumSizes?.[role] ?? 0));
15325
15564
  const eyebrow = options.eyebrow === true && role === "label" && !options.tile, caps = eyebrow && eyebrowCaps(text2);
15326
15565
  const display = options.proportional ? Infinity : role === "value" && options.message && messageCharacters(text2) <= FIGURE_CEILING.characters ? FIGURE_CEILING.size : LONE_DISPLAY_SIZES[role];
@@ -15370,7 +15609,7 @@ function layoutMetric(value, box, options = {}) {
15370
15609
  outline.height = bottom2 - outline.y;
15371
15610
  }
15372
15611
  }
15373
- return { width: line2.width, y: index * fit.lineHeight, baseline: fit.fontSize + index * fit.lineHeight, height: fit.lineHeight, outline };
15612
+ return { width: line2.width, ...hangOf(line2), y: index * fit.lineHeight, baseline: fit.fontSize + index * fit.lineHeight, height: fit.lineHeight, outline };
15374
15613
  });
15375
15614
  const place2 = (part, fit, width) => {
15376
15615
  if (!hasOutlines) return fit;
@@ -15477,7 +15716,22 @@ function layoutMetric(value, box, options = {}) {
15477
15716
  if (!Number.isFinite(tailHeight) || !Number.isFinite(leadHeight)) throw new RangeError("Metric metadata exceeds finite coordinates.");
15478
15717
  const pillFit = pillBeside ? measured.get(pillBeside) : void 0, pillRoom = pillBeside && pillFit ? pillWidth(pillBeside, pillFit) + Math.max(gap, METRIC_UNIT_GAP * primary.requestedFontSize) : 0;
15479
15718
  const area2 = { ...box, y: top, width: Math.max(Number.MIN_VALUE, (arrangement === "inline-unit" ? box.width - unitWidth - gap : box.width) - pillRoom), height: box.height - leadHeight - tailHeight - (tail.length ? primaryGap : 0) };
15480
- const valueFit = fitValue(area2, arrangement === "inline-unit"), valueHeight = valueFit ? occupied(valueFit) : 0;
15719
+ let valueFit = fitValue(area2, arrangement === "inline-unit"), valueAsk = primary.requestedFontSize;
15720
+ if (options.tile && arrangement === "inline-unit" && unit2 && unitFit && valueFit && valueFit.lines.length === 1) {
15721
+ const shareWidth = (size2) => {
15722
+ const natural = measure(unit2, gridFontSize(Math.round(METRIC_UNIT_SHARE * size2 / scale2 * 0.75) / 0.75 * scale2, unit2.minFontSize), box.width);
15723
+ return natural.lines.length === 1 ? naturalWidth(unit2, natural) : Infinity;
15724
+ };
15725
+ const lineWidth = (size2) => naturalWidth(primary, measure(primary, size2, box.width));
15726
+ let size = valueFit.fontSize;
15727
+ while (size > primary.minFontSize + 1e-9 && lineWidth(size) + gap + shareWidth(size) > box.width + 0.01) size = Math.max(primary.minFontSize, snapFontSizeDown(size - 0.5 * scale2));
15728
+ if (size < valueFit.fontSize - 1e-9 && lineWidth(size) + gap + shareWidth(size) <= box.width + 0.01) {
15729
+ const natural = measure(primary, size, area2.width);
15730
+ valueFit = { ...natural, overflow: !!natural.placement?.overflow || natural.lines.length !== 1 || occupied(natural) > area2.height + 0.01 || natural.sourceLines.some((line2) => line2.width > area2.width + 0.01) };
15731
+ valueAsk = size;
15732
+ }
15733
+ }
15734
+ const valueHeight = valueFit ? occupied(valueFit) : 0;
15481
15735
  const allocations = [];
15482
15736
  let leadY = box.y;
15483
15737
  for (const part of lead) {
@@ -15522,8 +15776,19 @@ function layoutMetric(value, box, options = {}) {
15522
15776
  const foot = options.tile ? allocations.filter((entry) => tail.includes(entry.part) && entry.part !== unit2) : [];
15523
15777
  const drop = foot.length ? box.y + box.height - Math.max(...foot.map((entry) => entry.box.y + entry.box.height)) : 0;
15524
15778
  if (drop > 0) for (const entry of foot) entry.box = { ...entry.box, y: entry.box.y + drop };
15779
+ if (options.tile) {
15780
+ const leadBottom = Math.max(box.y, ...allocations.filter((entry) => lead.includes(entry.part)).map((entry) => entry.box.y + entry.box.height));
15781
+ const ownFoot = foot.length ? box.y + box.height - Math.min(...foot.map((entry) => entry.box.y)) : 0;
15782
+ const footTop = box.y + box.height - Math.max(ownFoot, options.tileFoot ?? 0) - (foot.length || options.tileFoot ? primaryGap : 0);
15783
+ const middle = allocations.filter((entry) => entry.part === primary || unit2 !== void 0 && entry.part === unit2);
15784
+ if (middle.length) {
15785
+ const value2 = middle.find((entry) => entry.part === primary) ?? middle[0], bottom2 = Math.max(...middle.map((entry) => entry.box.y + entry.box.height));
15786
+ const shift = Math.min((leadBottom + footTop) / 2 - (value2.box.y + value2.box.height / 2), footTop - bottom2);
15787
+ if (shift > 0) for (const entry of middle) entry.box = { ...entry.box, y: entry.box.y + shift };
15788
+ }
15789
+ }
15525
15790
  const overflow = !valueFit || valueFit.overflow || arrangement === "inline-unit" && valueFit.lines.length !== 1 || primaryHeight > area2.height + 0.01 || allocations.some(({ box: area3, fit }) => !fit || fit.overflow || !usable3(area3) || area3.y + area3.height > box.y + box.height + 0.01);
15526
- const score = allocations.reduce((sum, { part, fit }) => sum + Math.max(0, part.requestedFontSize - (fit?.fontSize ?? minimum)) / scale2, 0);
15791
+ const score = allocations.reduce((sum, { part, fit }) => sum + Math.max(0, (part === primary ? Math.min(part.requestedFontSize, valueAsk) : part.requestedFontSize) - (fit?.fontSize ?? minimum)) / scale2, 0);
15527
15792
  const candidate = { arrangement, allocations, score, overflow, ...pillFit ? { pillFit } : {} };
15528
15793
  if (!selected || !overflow && (selected.overflow || score < selected.score - 1) || overflow && selected.overflow) selected = candidate;
15529
15794
  }
@@ -15646,6 +15911,14 @@ function timelineStatusWordsFor(language) {
15646
15911
  var EUROPEAN_PORTUGUESE_STATUS_WORDS;
15647
15912
  var TIMELINE_GROWTH = 4;
15648
15913
  var TIMELINE_STEP_GROWTH = [10, 6];
15914
+ var TIMELINE_DISPLAY_SIZE = 56;
15915
+ var TIMELINE_WHAT_LINES = 2;
15916
+ var TIMELINE_STEP_MIN = 1.5;
15917
+ var LINEAR_STRIP_COVER = 0.5;
15918
+ var MATRIX_CARD_ASPECT = 1.25;
15919
+ var VENN_FOUR_LABEL = 24;
15920
+ var PYRAMID_GROUP_SHARE = 0.9;
15921
+ var LINEAR_COVER_MARGIN = 0.1;
15649
15922
  var TIMELINE_BAND_MIN_HEIGHT = 56;
15650
15923
  function layoutTimeline(value, box, options = {}) {
15651
15924
  const shorthand = Array.isArray(value), timeline = shorthand ? { events: value } : value;
@@ -15660,12 +15933,12 @@ function layoutTimeline(value, box, options = {}) {
15660
15933
  const outlines = options.textMeasurement?.outlineBounds !== void 0, rtl = options.direction === "rtl";
15661
15934
  if (outlines && typeof options.textMeasurement?.outlineBounds !== "function") throw new TypeError("Text outline provider must be a function.");
15662
15935
  const path = options.path ?? "timeline", eventPath = (index) => shorthand ? `${path}.${index}` : `${path}.events.${index}`;
15663
- const fonts = resolveFontFamilies(options.fontFamilies), source = [], roles = options.compact ? TIMELINE_COMPACT_SIZES : TIMELINE_ROLE_SIZES;
15936
+ const fonts = resolveFontFamilies(options.fontFamilies), source = [], roles = options.compact ? TIMELINE_COMPACT_SIZES : TIMELINE_ROLE_SIZES, sizeScale = Math.max(1, Number.isFinite(options.sizeScale) ? options.sizeScale : 1);
15664
15937
  const add = (role, text2, partPath, weight, eventIndex) => {
15665
15938
  if (text2 === void 0) return;
15666
15939
  const status = eventIndex === void 0 ? void 0 : timeline.events[eventIndex].status;
15667
15940
  const requestedStyle = { fontFamily: fonts.body, fontWeight: status === "current" && role === "what" ? 700 : weight, italic: false, path: partPath };
15668
- source.push({ role, eventIndex, ...status ? { status } : {}, path: partPath, text: text2, sources: [{ path: partPath, start: 0, end: text2.length }], box: { ...box }, alignment: "center", requestedFontSize: gridFontSize(roles[role] * scale2, minimum), minFontSize: minimum, requestedStyle, style: resolveTextStyle({ ...requestedStyle }, options.textMeasurement) });
15941
+ source.push({ role, eventIndex, ...status ? { status } : {}, path: partPath, text: text2, sources: [{ path: partPath, start: 0, end: text2.length }], box: { ...box }, alignment: "center", requestedFontSize: gridFontSize(roles[role] * scale2 * sizeScale, minimum), minFontSize: minimum, requestedStyle, style: resolveTextStyle({ ...requestedStyle }, options.textMeasurement) });
15669
15942
  };
15670
15943
  add("name", timeline.name, `${path}.name`, 700);
15671
15944
  add("description", timeline.description, `${path}.description`, 400);
@@ -15693,7 +15966,7 @@ function layoutTimeline(value, box, options = {}) {
15693
15966
  let left2 = Infinity, top2 = Infinity, right2 = -Infinity, bottom2 = -Infinity, hasInk = false;
15694
15967
  if (outlines) {
15695
15968
  for (const segment2 of line2.segments) if (segment2.kind === "text") {
15696
- const outline = measureTextOutline(part.text.slice(segment2.start, segment2.end), size, part.style, options.textMeasurement);
15969
+ const outline = measureTextOutline(inkText(part.text.slice(segment2.start, segment2.end), line2), size, part.style, options.textMeasurement);
15697
15970
  if (outline) {
15698
15971
  hasInk = true;
15699
15972
  left2 = Math.min(left2, outline.x + segment2.x);
@@ -15703,7 +15976,7 @@ function layoutTimeline(value, box, options = {}) {
15703
15976
  }
15704
15977
  }
15705
15978
  }
15706
- return { width: line2.width, y: index * fit.lineHeight, baseline: size + index * fit.lineHeight, height: fit.lineHeight, outline: hasInk ? { x: left2, y: top2, width: right2 - left2, height: bottom2 - top2 } : null };
15979
+ return { width: line2.width, ...hangOf(line2), y: index * fit.lineHeight, baseline: size + index * fit.lineHeight, height: fit.lineHeight, outline: hasInk ? { x: left2, y: top2, width: right2 - left2, height: bottom2 - top2 } : null };
15707
15980
  });
15708
15981
  const placement = outlines ? placeTextLines(ink, { x: 0, y: 0, width, height: Number.MAX_VALUE }, alignment, padding, fit.directions) : void 0;
15709
15982
  const height = placement?.height ?? fit.sourceLines.length * fit.lineHeight;
@@ -15712,13 +15985,13 @@ function layoutTimeline(value, box, options = {}) {
15712
15985
  cache4.set(key, measured);
15713
15986
  return measured;
15714
15987
  };
15715
- let selected, attempts = 0;
15988
+ let selected, attempts = 0, connectorWidth;
15716
15989
  const effectiveOffset = durations ? Math.max(0, offset) : offset;
15717
15990
  const sizeAt = (part, reduction) => gridFontSize(part.requestedFontSize + (effectiveOffset - reduction) * scale2, minimum);
15718
15991
  let reductionLimit = 0;
15719
15992
  for (const part of source) reductionLimit = Math.max(reductionLimit, (part.requestedFontSize + offset * scale2 - minimum) / scale2);
15720
15993
  const reductions = durations ? 0 : Math.min(24 + Math.max(0, Math.ceil(offset)), Math.ceil(reductionLimit));
15721
- const count = events.length, labelSize = source.find((part) => part.role === "what")?.requestedFontSize ?? gridFontSize(roles.what * scale2, minimum);
15994
+ const count = events.length, labelSize = gridFontSize(roles.what * scale2, minimum);
15722
15995
  const bandStep = box.width / count;
15723
15996
  const narrow = !options.horizontal && count > 1 && (box.width / Math.max(2, count) < TIMELINE_NARROW_EM * labelSize || !!durations && !options.intrinsic && box.height > box.width * 1.15);
15724
15997
  const bandWidth = count > 1 ? Math.max(scale2, bandStep - Math.min(16 * scale2, bandStep / 4)) : box.width;
@@ -15729,9 +16002,18 @@ function layoutTimeline(value, box, options = {}) {
15729
16002
  const measured = measure(part, sizeAt(part, reduction), 1e6, "left");
15730
16003
  return measured.fit.sourceLines.length === 1 ? measured.fit.sourceLines[0].width + (outlines ? 2 * padding : 0) : Infinity;
15731
16004
  };
15732
- const wideAt = (reduction) => count > 1 && events.some((fields2, index) => fields2.some((part) => (part.role === "when" || part.role === "what") && lineWidth(part, reduction) > bandWidthAt() + 0.01));
16005
+ const growthAt = (reduction) => {
16006
+ const what = source.find((part) => part.role === "what");
16007
+ return (effectiveOffset > 0 || sizeScale > 1) && what ? sizeScale * Math.max(1, sizeAt(what, reduction) / what.requestedFontSize) : 1;
16008
+ };
16009
+ const wrapsWell = (part, reduction, index) => {
16010
+ const fit = measure(part, sizeAt(part, reduction), bandWidthAt(), "center").fit;
16011
+ return fit.sourceLines.length <= TIMELINE_WHAT_LINES && !breaksInsideWord(part.text, fit);
16012
+ };
16013
+ const wideAt = (reduction) => count > 1 && events.some((fields2, index) => fields2.some((part) => (part.role === "when" || part.role === "what") && lineWidth(part, reduction) > bandWidthAt() + 0.01 && !(sizeScale > 1 && part.role === "what" && wrapsWell(part, reduction))));
15733
16014
  const tryArrangement = (arrangement, reduction) => {
15734
16015
  attempts++;
16016
+ connectorWidth = void 0;
15735
16017
  const parts2 = [], markers = [], ranges = [], rangeLinks = [], diagnostics = [];
15736
16018
  let score2 = 0;
15737
16019
  const report = (part, reason, message, excess = 1) => {
@@ -15780,8 +16062,10 @@ function layoutTimeline(value, box, options = {}) {
15780
16062
  return { path: eventPath(index), eventIndex: index, x, y, radius, ...timeline.events[index].duration !== void 0 ? { duration: timeline.events[index].duration } : {}, ...status ? { status } : {}, ...status === "current" ? { ring: { radius: ringRadius } } : {}, ...status === "current" || status === "planned" ? { strokeWidth } : {} };
15781
16063
  };
15782
16064
  if (arrangement === "band") {
15783
- setRadius(Math.min((options.compact ? 7 : 9) * scale2, bandStep / 5));
15784
- const lift = (options.compact ? 5 : 6) * scale2, fieldGap = (options.compact ? 2 : 4) * scale2, pairGap = 6 * scale2, extent2 = hasRing ? ringRadius + strokeWidth / 2 : radius + (outlined ? strokeWidth / 2 : 0);
16065
+ source.find((part) => part.role === "what"); const grown = growthAt(reduction);
16066
+ if (grown > 1) connectorWidth = 3 * scale2 * grown;
16067
+ setRadius(Math.min((options.compact ? 7 : 9) * scale2 * grown, bandStep / 5));
16068
+ const lift = (options.compact ? 5 : 6) * scale2 * grown, fieldGap = (options.compact ? 2 : 4) * scale2, pairGap = 6 * scale2, extent2 = hasRing ? ringRadius + strokeWidth / 2 : radius + (outlined ? strokeWidth / 2 : 0);
15785
16069
  const whenOf = (fields2) => fields2.find((part) => part.role === "when"), whatOf = (fields2) => fields2.find((part) => part.role === "what");
15786
16070
  const pair = (fields2) => {
15787
16071
  const when = whenOf(fields2);
@@ -15828,8 +16112,10 @@ function layoutTimeline(value, box, options = {}) {
15828
16112
  } else if (arrangement === "alternating") {
15829
16113
  const gutter = count > 1 ? Math.min(16 * scale2, box.width / (count + 1) / 4) : 0, step = count > 1 ? (box.width + gutter) / (count + 1) : 0, width = count > 1 ? 2 * step - gutter : box.width;
15830
16114
  const start = count === 1 ? box.x + box.width / 2 : box.x + width / 2;
15831
- setRadius(Math.min(9 * scale2, box.width / Math.max(2, count) / 5, Math.max(scale2, box.height - headerHeight) * 0.04));
15832
- const fieldGap = 4 * scale2, clearance = 24 * scale2;
16115
+ const grown = growthAt(reduction);
16116
+ if (grown > 1) connectorWidth = 3 * scale2 * grown;
16117
+ setRadius(Math.min(9 * scale2 * grown, box.width / Math.max(2, count) / 5, Math.max(scale2, box.height - headerHeight) * 0.04 * grown));
16118
+ const fieldGap = 4 * scale2 * grown, clearance = 24 * scale2 * grown;
15833
16119
  const alternatingWidth = (_index) => width;
15834
16120
  const heights = events.map((fields2, index) => fields2.reduce((height, part) => height + heightOf(part, alternatingWidth(), "center"), 0) + Math.max(0, fields2.length - 1) * fieldGap);
15835
16121
  const markerExtent = hasRing ? ringRadius + strokeWidth / 2 : radius;
@@ -15903,7 +16189,7 @@ function layoutTimeline(value, box, options = {}) {
15903
16189
  const firstMarker = markers[0], last = markers.at(-1), connector = rtl ? { x1: Math.min(firstMarker.x, last.x), y1: firstMarker.y, x2: Math.max(firstMarker.x, last.x), y2: last.y } : { x1: firstMarker.x, y1: firstMarker.y, x2: last.x, y2: last.y };
15904
16190
  const current = markers.findIndex((entry) => entry.status === "current"), reached = current >= 0 ? current : markers.map((entry) => entry.status).lastIndexOf("done");
15905
16191
  const end = reached > 0 ? markers[reached] : void 0, progress = end ? rtl ? { x1: Math.min(firstMarker.x, end.x), y1: firstMarker.y, x2: Math.max(firstMarker.x, end.x), y2: end.y } : { x1: firstMarker.x, y1: firstMarker.y, x2: end.x, y2: end.y } : void 0;
15906
- const candidate = { arrangement, parts: parts2, markers, ...durations ? { ranges, rangeLinks } : {}, connector, ...progress ? { progress } : {}, diagnostics, score: score2 };
16192
+ const candidate = { arrangement, parts: parts2, markers, ...durations ? { ranges, rangeLinks } : {}, connector, ...progress ? { progress } : {}, ...arrangement !== "vertical" && connectorWidth !== void 0 ? { lineWidth: connectorWidth } : {}, diagnostics, score: score2 };
15907
16193
  if (!selected || score2 < selected.score) selected = candidate;
15908
16194
  return diagnostics;
15909
16195
  };
@@ -15994,10 +16280,11 @@ function fitSourceText(text2, box, size, minimum, step, measure, prose = false,
15994
16280
  const sourceLines = [];
15995
16281
  let start = 0, end = 0, hangFrom = -1;
15996
16282
  const push = (last, nextStart, boundary) => {
15997
- const measured = measureLine(start, last, true);
16283
+ const measured = measureLine(start, last, true), advance = measured.width;
16284
+ const hang = prose && boundary === "soft" ? hangingAdvance(measured.segments.map((segment2) => ({ kind: segment2.kind, text: text2.slice(segment2.start, segment2.end), width: segment2.width })), (kept) => measure(kept, fontSize)) : 0;
15998
16285
  if (hangFrom >= 0 && hangFrom < last) measured.width = measureLine(start, hangFrom).width;
15999
16286
  hangFrom = -1;
16000
- sourceLines.push({ start, end: last, nextStart, boundary, ...measured });
16287
+ sourceLines.push({ start, end: last, nextStart, boundary, ...measured, ...hang > 0 ? { hang, advance } : {} });
16001
16288
  start = nextStart;
16002
16289
  end = nextStart;
16003
16290
  };
@@ -16298,7 +16585,9 @@ function richTextLayouter(input, box, requestedSize, options, minimum = 0) {
16298
16585
  const richLines = ranges.map((range, rangeIndex) => {
16299
16586
  const lead = tight ? DISPLAY_LINE_PITCH - 1 : 0.22;
16300
16587
  const parts = fragments(range.start, range.end), shown = hung.get(rangeIndex) ?? range.end, ascent = Math.max(fontSize, ...parts.map((part) => part.fontSize - part.baselineShift)), descent = Math.max(fontSize * lead, ...parts.map((part) => part.fontSize * lead + part.baselineShift));
16301
- const height = ascent + descent, line2 = { fragments: parts, width: shown === range.end ? parts.reduce((sum, p) => sum + p.width, 0) : width(range.start, shown), y, baseline: y + ascent, height };
16588
+ const advance = parts.reduce((sum, p) => sum + p.width, 0), soft = rangeIndex < ranges.length - 1 && !/[\r\n]/.test(whole[range.end] ?? "\n");
16589
+ const hang = soft ? hangingAdvance(parts, (kept, index) => textWidthMeasurer(parts[index].style, options.textMeasurement)(kept, parts[index].fontSize)) : 0;
16590
+ const height = ascent + descent, line2 = { fragments: parts, width: shown === range.end ? advance : width(range.start, shown), y, baseline: y + ascent, height, ...hang > 0 ? { hang, advance } : {} };
16302
16591
  y += height;
16303
16592
  return line2;
16304
16593
  });
@@ -16365,6 +16654,10 @@ var STEP_BADGE_GAP = 0.4;
16365
16654
  var STEP_PROCESS_MIN = 2;
16366
16655
  var STEP_PROCESS_MAX = 8;
16367
16656
  var STEP_PROCESS_CHARACTERS = 24;
16657
+ var STEP_ROW_MAX = 5;
16658
+ var STEP_ROW_MIN_EMS = 6;
16659
+ var STEP_ROW_DISPLAY = 56;
16660
+ var STEP_ROW_LINES = 3;
16368
16661
  var LIST_MARKERS = ["\u2022", "\u2013"];
16369
16662
  function contentNominalSize(field) {
16370
16663
  return field === "items" || field === "bullets" ? LIST_NOMINAL_SIZE : field === "table" ? TABLE_NOMINAL_SIZE : PROSE_NOMINAL_SIZE;
@@ -16384,7 +16677,7 @@ function fitList(input, box, requestedSize = contentNominalSize("items"), minFon
16384
16677
  });
16385
16678
  const numbers = options.numbering === void 0 ? void 0 : listNumbers(input, options.numbering);
16386
16679
  const listPlain = (value) => typeof value === "string" ? value : value.map((run) => typeof run === "string" ? run : run.text).join("");
16387
- const heading = options.heading === true && !numbers && source.length === 1 && source[0].descriptionRuns !== void 0 && !(options.rows === true && options.rowLabels);
16680
+ const heading = options.heading === true && !numbers && source.length === 1 && (source[0].descriptionRuns !== void 0 || options.display === true || options.headingAlone === true) && !(options.rows === true && options.rowLabels);
16388
16681
  const badged = options.badges === true && numbers !== void 0 && source.every((item) => item.level === 0);
16389
16682
  const hasIcon = (index) => {
16390
16683
  const value = input[index];
@@ -16452,7 +16745,7 @@ function fitList(input, box, requestedSize = contentNominalSize("items"), minFon
16452
16745
  textBox.height = text2.height;
16453
16746
  let description, descriptionBox, bottom = y + text2.height;
16454
16747
  if (item.descriptionRuns !== void 0) {
16455
- const ratio2 = options.rowLabels ? 1 : 0.82, dx = side ? rtl ? box.x : box.x + column + between : x, dWidth = side ? Math.max(1, box.width - column - between) : width;
16748
+ const ratio2 = options.rowLabels || options.pairs === "question" && side ? 1 : 0.82, dx = side ? rtl ? box.x : box.x + column + between : x, dWidth = side ? Math.max(1, box.width - column - between) : width;
16456
16749
  descriptionBox = { x: dx, y: side ? y : bottom + fontSize * 0.12, width: dWidth, height: box.height };
16457
16750
  description = richTextLayouter(item.descriptionRuns, descriptionBox, requestedSize * ratio2, { ...options, style: { ...options.style, path: item.descriptionPath } }, minFontSize)(fontSize * ratio2);
16458
16751
  if (side) descriptionBox.y += Math.max(0, (text2.richLines[0]?.baseline ?? fontSize) - (description.richLines[0]?.baseline ?? fontSize * ratio2));
@@ -16792,11 +17085,24 @@ function regionParts(key) {
16792
17085
  }
16793
17086
  return void 0;
16794
17087
  }
16795
- function regionBox(parts, area2, requestedGap) {
17088
+ var ALL_CELL_TRACKS = { rows: [false, false, false], columns: [false, false, false] };
17089
+ function cellTracks(cells, fullRowsGive = true) {
17090
+ const between = (spans) => [0, 1, 2].map((index) => spans.every((span) => !span.includes(index) || span.includes(index - 1) && span.includes(index + 1)) && spans.some((span) => span.every((at3) => at3 < index)) && spans.some((span) => span.every((at3) => at3 > index)));
17091
+ const columns2 = between(cells.map((cell) => cell[1])), rowsBetween = between(cells.map((cell) => cell[0]));
17092
+ const named = (row) => cells.some((cell) => cell[0].includes(row));
17093
+ const full = (row) => [0, 1, 2].every((column) => columns2[column] || cells.some((cell) => cell[0].includes(row) && cell[1].includes(column)));
17094
+ const fullRows = fullRowsGive && cells.length >= 2 && [0, 1, 2].filter(named).every(full);
17095
+ return { rows: rowsBetween.map((dropped, row) => dropped || fullRows && !named(row)), columns: columns2 };
17096
+ }
17097
+ function regionBox(parts, area2, requestedGap, tracks = ALL_CELL_TRACKS) {
16796
17098
  const gap = Math.min(requestedGap, area2.width / 6, area2.height / 6);
16797
- const cw = (area2.width - gap * 2) / 3, ch = (area2.height - gap * 2) / 3;
16798
- const [r, c] = parts;
16799
- return { x: area2.x + Math.min(...c) * (cw + gap), y: area2.y + Math.min(...r) * (ch + gap), width: (Math.max(...c) - Math.min(...c) + 1) * (cw + gap) - gap, height: (Math.max(...r) - Math.min(...r) + 1) * (ch + gap) - gap };
17099
+ const span = (start, length, named, dropped) => {
17100
+ const kept = [0, 1, 2].filter((index) => !dropped[index]), size = (length - gap * (kept.length - 1)) / kept.length;
17101
+ const first = Math.min(...named), last = Math.max(...named), before = kept.filter((index) => index < first).length, inside2 = kept.filter((index) => index >= first && index <= last).length;
17102
+ return [start + before * (size + gap), inside2 * (size + gap) - gap];
17103
+ };
17104
+ const [y, height] = span(area2.y, area2.height, parts[0], tracks.rows), [x, width] = span(area2.x, area2.width, parts[1], tracks.columns);
17105
+ return { x, y, width, height };
16800
17106
  }
16801
17107
  function gridGeometry(count, area2, cols, gap, weights, vertical) {
16802
17108
  const rowCount = Math.ceil(count / cols);
@@ -16865,6 +17171,8 @@ var PAIR_ARROW_WIDTH = 40;
16865
17171
  var PAIR_ARROW_HEIGHT = 28;
16866
17172
  var PAIR_ARROW_MARGIN = 0.75;
16867
17173
  var PILL_AT_FOOT = /* @__PURE__ */ Symbol("opf.pillAtFoot");
17174
+ var PULL_DROP = /* @__PURE__ */ Symbol("opf.pullDrop");
17175
+ var PULL_GROWN_TARGET = 0.75;
16868
17176
  var TILE_FLOORS = /* @__PURE__ */ Symbol("opf.tileFloors");
16869
17177
  var EMPHASIS_BAND_MAX_CHARACTERS = 60;
16870
17178
  var EMPHASIS_PILL_MAX_CHARACTERS = 30;
@@ -16977,6 +17285,7 @@ var GRID_GROW = /* @__PURE__ */ Symbol("opf.gridGrow");
16977
17285
  var NO_COMPACT_GRID = /* @__PURE__ */ Symbol("opf.noCompactGrid");
16978
17286
  var COMPACT_GRID_STEPS = 8;
16979
17287
  var COMPACT_GRID_DISPLAY = 56;
17288
+ var SPARSE_LIST_DISPLAY = [[3, 56], [5, 49]];
16980
17289
  var FIGURE_ROW_ITEMS = /* @__PURE__ */ new WeakSet();
16981
17290
  var CARD_GRIDS = /* @__PURE__ */ new WeakSet();
16982
17291
  var PLACED_TILES = /* @__PURE__ */ new WeakSet();
@@ -17011,9 +17320,10 @@ function bodyFill(result, options = {}) {
17011
17320
  const inBody = (item) => !item.caption && (!result.regions || item.region !== void 0);
17012
17321
  const prose = body.every((item) => (item.field === "text" || item.field === "items" || item.field === "bullets") && item.text && (!item.listColumns || FIGURE_ROW_ITEMS.has(item)) && inBody(item));
17013
17322
  const metrics3 = result.items.every((item) => headings.has(item.field) || item.eyebrow || item.field === "metric") && body.every((item) => item.field === "metric" && item.metricLayout && !item.frameBox && !item.metricTile && !item.emphasis && inBody(item));
17014
- const tableItem = body.find((item) => item.field === "table"), noteItem = body.find((item) => item.field === "text");
17015
- const tableNote2 = !!result.regions && body.length === 2 && !!tableItem && !!noteItem?.text && !noteItem.frameBox && body.every((item) => !item.emphasis && inBody(item)) && noteItem.box.y >= tableItem.box.y + 1 && noteItem.box.x < tableItem.box.x + tableItem.box.width - 1 && noteItem.box.x + noteItem.box.width > tableItem.box.x + 1;
17016
- if (body.length < 2 || !(prose || metrics3 || tableNote2)) return void 0;
17323
+ const tableItem = body.find((item) => item.field === "table"), asides = body.filter((item) => item !== tableItem);
17324
+ const tableNote2 = !!result.regions && !!tableItem && asides.length >= 1 && body.every((item) => !item.emphasis && inBody(item)) && !result.items.some((item) => item.quoteLayout?.rule) && asides.every((noteItem) => (TABLE_ASIDE_FIELDS.has(noteItem.field) && !!noteItem.text || noteItem.field === "table" && asides.length === 1) && (!noteItem.frameBox || noteItem.field === "quote" || !!tableItem.frameBox) && (noteItem.box.y >= tableItem.box.y + 1 && noteItem.box.x < tableItem.box.x + tableItem.box.width - 1 && noteItem.box.x + noteItem.box.width > tableItem.box.x + 1 || noteItem.box.x >= tableItem.box.x + tableItem.box.width - 1 || noteItem.box.x + noteItem.box.width <= tableItem.box.x + 1 || noteItem.field === "metric")) && (asides.length === 1 || asides.every((item) => !!item.frameBox) || asides.every((item) => item.field === "metric"));
17325
+ const codeAside = !!result.regions && body.length === 2 && body.some((item) => item.field === "code" && item.codeLayout) && body.some((item) => (item.field === "text" || item.field === "items" || item.field === "bullets") && item.text) && body.every((item) => !item.emphasis && !item.frameBox && inBody(item));
17326
+ if (body.length < 2 || !(prose || metrics3 || tableNote2 || codeAside)) return void 0;
17017
17327
  const height = (fit) => "height" in fit && typeof fit.height === "number" ? fit.height : Math.max(fit.lines.length * fit.lineHeight, fit.placement?.height ?? 0);
17018
17328
  const scale2 = Math.min(result.width, result.height) / 720, metricRows = metrics3 ? new Set(body.map((item) => Math.round(item.box.y))).size : 0;
17019
17329
  const extentOf = (item) => {
@@ -17030,6 +17340,7 @@ function bodyFill(result, options = {}) {
17030
17340
  }
17031
17341
  return [item.box.y, item.box.y + Math.min(item.box.height, table?.height ?? item.box.height)];
17032
17342
  }
17343
+ if (item.field === "code") return [item.box.y, item.box.y + item.box.height];
17033
17344
  return [item.box.y, item.box.y + height(item.text)];
17034
17345
  };
17035
17346
  const top = Math.min(...body.map((item) => extentOf(item)[0])), bottom = Math.max(...body.map((item) => extentOf(item)[1]));
@@ -17046,7 +17357,8 @@ function bodyFill(result, options = {}) {
17046
17357
  reach = to;
17047
17358
  }
17048
17359
  }
17049
- return { fill: covered / (bodyBottom - bodyTop), spare: Math.max(0, bodyBottom - bottom) };
17360
+ if (codeAside) covered = Math.max(...extents.map(([from, to]) => to - from));
17361
+ return { fill: covered / (bodyBottom - bodyTop), spare: Math.max(0, bodyBottom - bottom), ...tableNote2 ? { target: TABLE_NOTE_GROWN_TARGET } : {} };
17050
17362
  }
17051
17363
  var NON_BODY_FIELDS = /* @__PURE__ */ new Set(["id", "language", "type", "beat", "layout", "design", "shapes", "notes", "section", "hidden", "composition", "extensions"]);
17052
17364
  function bodyIcons(input) {
@@ -17057,7 +17369,7 @@ function growBody(input, options, result) {
17057
17369
  if (options.fill === false || options[LAYOUT_MASTER] === true || overflowCount(result) > 0) return void 0;
17058
17370
  const start = bodyFill(result, options);
17059
17371
  if (!start) return void 0;
17060
- if (start.fill >= LONE_FILL) {
17372
+ if (start.fill >= (start.target ?? LONE_FILL)) {
17061
17373
  if (!result.steps?.some((entry) => entry.form === "row") || bodyReadability(result, options).sizes.some((entry) => entry.atFloor)) return void 0;
17062
17374
  const before2 = trackQuality(result, options), floor2 = snapFontSizeUp((result.composition.minFontSize ?? 16) * Math.min(result.width, result.height) / 720);
17063
17375
  const centered = composeVariant(input, { ...options, [GROW]: 0, [CENTER]: true }, before2, floor2);
@@ -17070,16 +17382,17 @@ function growBody(input, options, result) {
17070
17382
  const avatar = portraitQuotes(result) ? { [AVATAR_QUOTES]: true } : {};
17071
17383
  const attempt = (extra) => composeVariant(input, { ...options, ...avatar, ...extra }, before, floor);
17072
17384
  const pulled = result.items.some((item) => item.quoteLayout?.rule);
17385
+ const past = start.fill >= LONE_FILL;
17073
17386
  const stepsOf = /* @__PURE__ */ new WeakMap();
17074
17387
  const climb = (from, extra, limit, accept) => {
17075
17388
  let best = from, steps = 0;
17076
17389
  for (let next = 1; next <= limit; next++) {
17077
17390
  const grown = attempt({ [GROW]: next, ...extra }), fill2 = grown && bodyFill(grown, options);
17078
- if (!grown || !fill2 || overflowCount(grown) > 0 || fill2.fill > LONE_TARGET || smallest(grown) <= smallest(best) + FONT_GRID_EPSILON || shrinks(grown, best, options) || !accept(grown) || bodyReadability(grown, options).splitWords + listSplitWords(grown) > bodyReadability(best, options).splitWords + listSplitWords(best)) break;
17391
+ if (!grown || !fill2 || overflowCount(grown) > 0 || fill2.fill > (fill2.target ?? LONE_TARGET) || smallest(grown) <= smallest(best) + FONT_GRID_EPSILON || shrinks(grown, best, options) || !accept(grown) || bodyReadability(grown, options).splitWords + listSplitWords(grown) > bodyReadability(best, options).splitWords + listSplitWords(best)) break;
17079
17392
  best = grown;
17080
17393
  steps = next;
17081
17394
  }
17082
- const centered = pulled ? void 0 : attempt({ [GROW]: steps, [CENTER]: true, ...extra }), fill = centered && bodyFill(centered, options);
17395
+ const centered = pulled || past && !steps ? void 0 : attempt({ [GROW]: steps, [CENTER]: true, ...extra }), fill = centered && bodyFill(centered, options);
17083
17396
  if (centered && fill && overflowCount(centered) === 0 && !shrinks(centered, best, options)) {
17084
17397
  stepsOf.set(centered, { [GROW]: steps, [CENTER]: true, ...extra });
17085
17398
  return centered;
@@ -17091,13 +17404,17 @@ function growBody(input, options, result) {
17091
17404
  if (!COMPACT_GRIDS.has(result)) {
17092
17405
  const grown = climb(result, {}, 3, () => true), reached = bodyFill(grown, options);
17093
17406
  const blocks = record19(input).blocks, drawn = bodyIcons(input) || result.steps !== void 0 && !PLACED_TILES.has(result) || Array.isArray(blocks) && (blocks.some((block) => Array.isArray(record19(block).blocks)) || blocks.length >= TEXT_TILE_MIN && blocks.length <= TEXT_TILE_MAX && permitsTextTiles(result.composition));
17094
- if (result.regions || !reached || reached.fill >= LONE_FILL || drawn || options[NO_STEPS] === true) return done(grown);
17407
+ const arranged = isLayoutTemplate(options.layout) && layoutTemplate(options.layout).regions.some((region) => region.arrangement !== void 0);
17408
+ if (!reached || reached.fill >= LONE_FILL || drawn || arranged || options[NO_STEPS] === true || options[GROW_ON_HELD] === true) return done(grown);
17095
17409
  const shapeOf = (composed) => {
17096
17410
  const body = composed.items.filter((item) => !headings.has(item.field) && !item.eyebrow);
17097
17411
  return `${new Set(body.map((item) => Math.round(item.box.x / 4))).size}:${new Set(body.map((item) => Math.round(item.box.y / 4))).size}`;
17098
17412
  };
17099
- const shape = shapeOf(grown), further = climb(result, { [GRID_GROW]: true }, COMPACT_GRID_STEPS, (next) => shapeOf(next) === shape);
17100
- return done(smallest(further) > smallest(grown) + FONT_GRID_EPSILON ? further : grown);
17413
+ const proseSizes = (composed) => Math.max(0, ...[["text"], ["items", "bullets"]].map((kinds) => new Set(composed.items.filter((item) => !headings.has(item.field) && !item.eyebrow && kinds.includes(item.field) && item.text).map((item) => item.text.fontSize)).size));
17414
+ const entrySizes = (composed) => new Map(composed.items.flatMap((item) => item.text && "listEntries" in item.text ? item.text.listEntries.flatMap((entry, index) => [[`${item.path}#${index}`, entry.text.fontSize], ...entry.description ? [[`${item.path}#${index}d`, entry.description.fontSize]] : []]) : []));
17415
+ const kept = entrySizes(grown), keeps = (next) => [...entrySizes(next)].every(([key, size]) => size >= (kept.get(key) ?? 0) - FONT_GRID_EPSILON);
17416
+ const shape = shapeOf(grown), shared = result.regions !== void 0 && proseSizes(grown) <= 1, further = climb(result, { [GRID_GROW]: true }, COMPACT_GRID_STEPS, (next) => shapeOf(next) === shape && (!shared || proseSizes(next) <= 1));
17417
+ return done(smallest(further) > smallest(grown) + FONT_GRID_EPSILON && keeps(further) ? further : grown);
17101
17418
  }
17102
17419
  const lines = (item) => item.text ? "richLines" in item.text ? item.text.richLines.length : item.text.lines.length : 0;
17103
17420
  const spread = attempt({ [NO_COMPACT_GRID]: true }), plain3 = spread ? climb(spread, { [NO_COMPACT_GRID]: true }, 3, () => true) : void 0, reference = plain3 ?? result;
@@ -17288,7 +17605,34 @@ function composeGrid(input, options) {
17288
17605
  return result;
17289
17606
  }
17290
17607
  function composeSlideOnce(input, options) {
17291
- return growMixedCode(input, options, readableProse(input, options, readableTimelineNotes(input, options, composeSlideBody(input, options))));
17608
+ const result = growMixedCode(input, options, readableProse(input, options, readableTimelineNotes(input, options, composeSlideBody(input, options))));
17609
+ if (options[ROWS_ON_OVERFLOW] !== void 0 || !rowOnlyLayout(options.layout)) return result;
17610
+ const rows3 = composeSlideOnce(input, { ...options, [ROWS_ON_OVERFLOW]: true });
17611
+ const before = overflowCount(result), after = overflowCount(rows3);
17612
+ const smallest = (composed) => Math.min(...bodyReadability(composed, options).sizes.map((entry) => entry.size));
17613
+ if (after < before) return rows3;
17614
+ if (after > before || smallest(rows3) <= smallest(result) + FONT_GRID_EPSILON) return result;
17615
+ const held = { ...options, [GROW_ON_HELD]: true };
17616
+ const heldRows = composeSlideOnce(input, { ...held, [ROWS_ON_OVERFLOW]: true }), heldColumns = composeSlideOnce(input, { ...held, [ROWS_ON_OVERFLOW]: false });
17617
+ return overflowCount(heldRows) === overflowCount(heldColumns) && smallest(heldRows) > smallest(heldColumns) + FONT_GRID_EPSILON ? rows3 : result;
17618
+ }
17619
+ var GROW_ON_HELD = /* @__PURE__ */ Symbol("opf.growOnHeld");
17620
+ var WORDMARK_ASPECT = 2.5;
17621
+ var WORDMARK_SIZE = 40;
17622
+ var ROWS_ON_OVERFLOW = /* @__PURE__ */ Symbol("opf.rowsOnOverflow");
17623
+ function rowOnlyLayout(layout) {
17624
+ if (!isLayoutTemplate(layout)) return false;
17625
+ let plan2;
17626
+ try {
17627
+ plan2 = layoutTemplate(layout);
17628
+ } catch {
17629
+ return false;
17630
+ }
17631
+ const rects = areaRects(plan2.grid), rows3 = new Set(plan2.regions.map((region) => {
17632
+ const rect = rects.get(region.name);
17633
+ return rect ? `${rect.row}:${rect.rowSpan}` : void 0;
17634
+ }));
17635
+ return plan2.regions.length > 1 && rows3.size === 1 && !rows3.has(void 0);
17292
17636
  }
17293
17637
  function drawnSizes(result) {
17294
17638
  const sizes = /* @__PURE__ */ new Map();
@@ -17685,7 +18029,7 @@ function growTemplate(input, options, result) {
17685
18029
  for (let steps = 1; steps <= 3 && step({ [GROW]: steps }); steps++) body = steps;
17686
18030
  for (let steps = 1; steps <= 3 && step({ [GROW]: body, [HEADING_STEPS]: steps }); steps++) ;
17687
18031
  } else {
17688
- const most = stacked && oneMessageField(record19(input)) === "quote" ? 6 : 3;
18032
+ const most = stacked && (oneMessageField(record19(input)) === "quote" || result.width >= result.height && loneQuote(record19(input))) ? 8 : 3;
17689
18033
  for (let steps = 1; steps <= most && step(grownBy(steps)); steps++) ;
17690
18034
  }
17691
18035
  return best === result ? void 0 : portraitQuotes(result) ? withPortraits(input, options, best, bestExtra, before, floor) : best;
@@ -17695,6 +18039,11 @@ function settle(input, options, result) {
17695
18039
  if (PLACED_TILES.has(result)) options = { ...options, [WITH_PLACED_TILES]: true };
17696
18040
  const filled = growTemplate(input, options, result);
17697
18041
  if (filled) return filled;
18042
+ const early = bodyFill(result, options);
18043
+ if (early?.target !== void 0 && early.fill >= LONE_FILL) {
18044
+ const noted2 = tableNote(input, options, result);
18045
+ if (noted2) return noted2;
18046
+ }
17698
18047
  const grown = growBody(input, options, result);
17699
18048
  if (grown) return grown;
17700
18049
  if (REGION_MEASURED.has(result) && bodyFill(result, options)) {
@@ -17956,6 +18305,7 @@ var TABLE_NOTE_SHORT = 0.5;
17956
18305
  var TABLE_NOTE_LINES = 2;
17957
18306
  var TABLE_NOTE_GROWN_SHARES = [0.7, 0.65, 0.6, 0.55, 0.5];
17958
18307
  var TABLE_NOTE_CELL_LINES = 2;
18308
+ var TABLE_ASIDE_FIELDS = /* @__PURE__ */ new Set(["text", "items", "bullets", "metric", "quote"]);
17959
18309
  var TABLE_NOTE_GROWN_CELL_LINES = 3;
17960
18310
  var TABLE_NOTE_GROWN_TARGET = 0.75;
17961
18311
  function tableCellLines(item, options, scale2) {
@@ -18164,6 +18514,8 @@ function automaticTracks(input, options, base) {
18164
18514
  return { ...best.result, items, track: { kind: "picture", edge: physical(edge2), size: best.size, path: blockPath } };
18165
18515
  }
18166
18516
  if (pictures.length || leaf("video").length || charts.length !== 1) return base;
18517
+ if (own3.mode === (landscape ? "column" : "row")) return base;
18518
+ if (own3.mode === "grid") return base;
18167
18519
  const chartOf = (result) => result.items.find((item) => item.field === "chart");
18168
18520
  const chart = chartOf(base);
18169
18521
  if (!chart || !shortPlot(chart, bodyHeight(base), scale2)) return base;
@@ -18197,7 +18549,7 @@ function composeLayout(input, options = {}) {
18197
18549
  const hints = resolveDesignHints({ slide, layout, theme: { design: options.themeDesign }, presentation: options.presentation, slideIndex: options.slideIndex, deck: { titleAlignment: options.titleAlignment, contentAlignment: options.contentAlignment, contentBox: options.contentBox } });
18198
18550
  const titleStart = hints.titlePosition === "start" && width >= height && !recomposing;
18199
18551
  const template = statementPlan && titleStart ? titleBesideTemplate(statementPlan) ?? statementPlan : statementPlan;
18200
- const messageField = options.fill !== false ? oneMessageField(slide) : void 0;
18552
+ const messageField = options.fill !== false ? oneMessageField(slide) ?? (recordTemplate?.stack !== void 0 && width >= height && loneQuote(slide) ? "quote" : void 0) : void 0;
18201
18553
  const messageNode = (node) => messageField !== void 0 && node.field === messageField && !node.children && node.caption === void 0;
18202
18554
  const hasCards = hints.contentBox ?? false;
18203
18555
  const composition = { ...record19(layout.composition), ...record19(slide.composition) };
@@ -18317,7 +18669,7 @@ function composeLayout(input, options = {}) {
18317
18669
  let outline = null;
18318
18670
  for (const fragment of line2.fragments) {
18319
18671
  if (fragment.kind === "tab") continue;
18320
- const bounds = measureTextOutline(fragment.text, fragment.fontSize, fragment.style, options.textMeasurement);
18672
+ const bounds = measureTextOutline(inkText(fragment.text, line2), fragment.fontSize, fragment.style, options.textMeasurement);
18321
18673
  if (!bounds) continue;
18322
18674
  const next = { ...bounds, x: fragment.x + bounds.x, y: fragment.baselineShift + bounds.y };
18323
18675
  if (!outline) outline = next;
@@ -18329,12 +18681,12 @@ function composeLayout(input, options = {}) {
18329
18681
  outline.height = bottom - outline.y;
18330
18682
  }
18331
18683
  }
18332
- return { width: line2.width, y: line2.y, baseline: line2.baseline, height: line2.height, outline };
18684
+ return { width: line2.width, ...hangOf(line2), y: line2.y, baseline: line2.baseline, height: line2.height, outline };
18333
18685
  }) : fit.sourceLines.map((line2, index) => {
18334
18686
  let outline = null;
18335
18687
  for (const segment2 of line2.segments) {
18336
18688
  if (segment2.kind === "tab") continue;
18337
- const bounds = measureTextOutline(text2.slice(segment2.start, segment2.end), fontSize, inkStyle, options.textMeasurement);
18689
+ const bounds = measureTextOutline(inkText(text2.slice(segment2.start, segment2.end), line2), fontSize, inkStyle, options.textMeasurement);
18338
18690
  if (!bounds) continue;
18339
18691
  const next = { ...bounds, x: segment2.x + bounds.x };
18340
18692
  if (!outline) outline = next;
@@ -18346,7 +18698,7 @@ function composeLayout(input, options = {}) {
18346
18698
  outline.height = bottom - outline.y;
18347
18699
  }
18348
18700
  }
18349
- return { width: line2.width, y: index * fit.lineHeight, baseline: fontSize + index * fit.lineHeight, height: fit.lineHeight, outline };
18701
+ return { width: line2.width, ...hangOf(line2), y: index * fit.lineHeight, baseline: fontSize + index * fit.lineHeight, height: fit.lineHeight, outline };
18350
18702
  });
18351
18703
  const placement = placeTextLines(lines, box, alignment, rasterPadding, fit.directions), result = { ...fit, placement, overflow: fit.overflow || placement.overflow };
18352
18704
  if (!result.overflow || last) return result;
@@ -18444,6 +18796,7 @@ function composeLayout(input, options = {}) {
18444
18796
  };
18445
18797
  const pendingIcons2 = [];
18446
18798
  const badgeLists = /* @__PURE__ */ new Set(), stepHeadings = /* @__PURE__ */ new Set(), badgeStarts = /* @__PURE__ */ new Map();
18799
+ const aloneHeadings = /* @__PURE__ */ new Set();
18447
18800
  const iconAgendas = new Map(options[AGENDA_STARTS] ?? []);
18448
18801
  const badgeNumbering = (path2, numbering) => {
18449
18802
  if (numbering !== void 0) return numbering;
@@ -18455,12 +18808,14 @@ function composeLayout(input, options = {}) {
18455
18808
  const loneLabels = /* @__PURE__ */ new Set();
18456
18809
  const numeralLists = /* @__PURE__ */ new Map(), pairRowLabels = /* @__PURE__ */ new Map(), pairGrid = /* @__PURE__ */ new Set(), spreadLists = /* @__PURE__ */ new Set();
18457
18810
  const chiplessLists = /* @__PURE__ */ new Set();
18811
+ const drawnLoneLists = /* @__PURE__ */ new Set();
18812
+ const checkTileSlide = () => options.darkBackground === true && (record19(slide.design).variant !== void 0 || record19(slide.design).background !== void 0);
18458
18813
  const listOptionsFor = (field, path2, numbering, value) => {
18459
18814
  const listed = { ...listOptionsOf(field, path2, numbering, value), ...numberLanguage(options) };
18460
18815
  const own3 = field === "items" && !badgeLists.has(path2) && !stepHeadings.has(path2) && !numeralLists.has(path2) && !chiplessLists.has(path2) && iconList(value, numbering) ? { ...listed, icons: true, iconScale: chipScale } : listed;
18461
18816
  return own3.rows && spreadLists.has(path2) ? { ...own3, spread: true } : own3;
18462
18817
  };
18463
- const listOptionsOf = (field, path2, numbering, value) => stepHeadings.has(path2) ? { ...richOptions(styleFor(field, path2)), heading: true, bullet: "none", ...headingCaps.has(path2) ? { headingMax: headingCaps.get(path2) } : {} } : numeralLists.has(path2) ? { ...richOptions(styleFor(field, path2)), numbering: badgeNumbering(path2, numbering), rows: true, numerals: numeralLists.get(path2), ...pairsOf(value, path2) } : badgeLists.has(path2) ? { ...richOptions(styleFor(field, path2)), numbering: badgeNumbering(path2, numbering), badges: true } : pairRowLabels.has(path2) ? { ...richOptions(styleFor(field, path2)), rows: true, pairs: "question", rowLabels: pairRowLabels.get(path2), bullet: "none" } : { ...richOptions(styleFor(field, path2)), heading: true, ...headingCaps.has(path2) ? { headingMax: headingCaps.get(path2) } : {}, ...pillarWords.has(path2) ? { display: true, ...wordCaps.has(path2) ? { displayMax: wordCaps.get(path2) } : {}, ...loneLabels.has(path2) ? { displayRule: "short" } : {} } : {}, ...value !== void 0 ? listRows(value, path2) : {}, ...numbering !== void 0 ? { numbering } : bulletImage ? { bulletImage } : noListBullet ? { bullet: "none" } : {} };
18818
+ const listOptionsOf = (field, path2, numbering, value) => stepHeadings.has(path2) ? { ...richOptions(styleFor(field, path2)), heading: true, ...aloneHeadings.has(path2) ? { headingAlone: true } : {}, bullet: "none", ...headingCaps.has(path2) ? { headingMax: headingCaps.get(path2) } : {} } : numeralLists.has(path2) ? { ...richOptions(styleFor(field, path2)), numbering: badgeNumbering(path2, numbering), rows: true, numerals: numeralLists.get(path2), ...pairsOf(value, path2) } : badgeLists.has(path2) ? { ...richOptions(styleFor(field, path2)), numbering: badgeNumbering(path2, numbering), badges: true } : pairRowLabels.has(path2) ? { ...richOptions(styleFor(field, path2)), rows: true, pairs: "question", rowLabels: pairRowLabels.get(path2), bullet: "none" } : { ...richOptions(styleFor(field, path2)), heading: true, ...headingCaps.has(path2) ? { headingMax: headingCaps.get(path2) } : {}, ...pillarWords.has(path2) ? { display: true, ...wordCaps.has(path2) ? { displayMax: wordCaps.get(path2) } : {}, ...loneLabels.has(path2) ? { displayRule: "short" } : {} } : {}, ...value !== void 0 ? listRows(value, path2) : {}, ...numbering !== void 0 ? { numbering } : bulletImage ? { bulletImage } : noListBullet ? { bullet: "none" } : {} };
18464
18819
  const runIns = /* @__PURE__ */ new Map();
18465
18820
  const runInOf = (value) => {
18466
18821
  if (typeof value !== "string" || !ruleOn("run-in")) return void 0;
@@ -18572,6 +18927,7 @@ function composeLayout(input, options = {}) {
18572
18927
  const backgroundImage = resolveBackgroundImage(slide, options.presentation, options.themeBackground, options.layout, width, height, path, mirrorSide, imageDiagnostics);
18573
18928
  measuredPicture = backgroundImage !== void 0 && typeof options.pictureLuminance === "function";
18574
18929
  const regions = Object.keys(slide).filter((key) => regionParts(key)).sort();
18930
+ const regionTracks = cellTracks(regions.map((key) => regionParts(key)), backgroundImage === void 0);
18575
18931
  const assets = record19(options.presentation).assets;
18576
18932
  const fitImageCallout = (text2, box, calloutPath, settings) => {
18577
18933
  if (outsideCanvas(box, { width, height })) imageCalloutDiagnostics.push({ code: "shape-off-slide", path: calloutPath, message: "This image callout lies wholly outside the slide, so nothing of it is drawn. x and y are fractions of the picture's frame: 0.2 is 20% of its width." });
@@ -18640,7 +18996,9 @@ function composeLayout(input, options = {}) {
18640
18996
  const measuredFurniture = layoutFurniture(slide, options);
18641
18997
  const furniture = measuredFurniture.configured || measuredFurniture.diagnostics.length ? measuredFurniture : void 0;
18642
18998
  if (furniture) diagnostics.push(...furniture.diagnostics);
18643
- let bodyBottom = Math.min(area2.bottom - padding, furniture && furniture.footerTop < height ? furniture.footerTop - gap * 0.5 : height - padding);
18999
+ const anchoredLow = (value, depth = 0) => depth <= MAX_COMPOSITION_DEPTH && (record19(value).anchor === "bottom" || Array.isArray(record19(value).regions) && record19(value).regions.some((region) => anchoredLow(region, depth + 1)));
19000
+ const footerGap = !recomposing && options.layout !== null && typeof options.layout === "object" && anchoredLow(options.layout) ? gap : gap * 0.5;
19001
+ let bodyBottom = Math.min(area2.bottom - padding, furniture && furniture.footerTop < height ? furniture.footerTop - footerGap : height - padding);
18644
19002
  const headingTop = Math.max(area2.top + padding, furniture?.headerBottom ? furniture.headerBottom + gap * 0.5 : padding);
18645
19003
  let footnotes;
18646
19004
  if (citations) {
@@ -18890,11 +19248,17 @@ function composeLayout(input, options = {}) {
18890
19248
  const data = (other) => !Array.isArray(other.blocks) && (other.table !== void 0 || entries(other) >= 3);
18891
19249
  return others.length >= 2 || data(others[0].host) ? { block: entry.index, position } : void 0;
18892
19250
  })();
18893
- let pullItem, placePull;
19251
+ let pullItem, placePull, pullSpan;
19252
+ let layPull;
18894
19253
  if (pullQuote) {
19254
+ pullSpan = { top: y, bottom: bodyBottom };
19255
+ const pullDrop = useTemplate ? void 0 : options[PULL_DROP];
19256
+ const drop = pullDrop?.drop ?? 0, pullSize = pullDrop?.size ?? LEAD_NOMINAL_SIZE;
19257
+ y += drop;
19258
+ bodyBottom += drop;
18895
19259
  const blockPath = `${path}.blocks.${pullQuote.block}`, quotePath = `${blockPath}.quote`, value = record19(slide.blocks[pullQuote.block]).quote;
18896
19260
  const x = area2.left + padding, width2 = area2.right - area2.left - padding * 2, language = quoteLanguage(options.presentation, options.slideIndex);
18897
- const lay = (top, room) => layoutQuote(value, { x, y: top, width: width2, height: room }, {
19261
+ const lay = (top, room, size = pullSize) => layoutQuote(value, { x, y: top, width: width2, height: room }, {
18898
19262
  fontFamilies: options.fontFamilies,
18899
19263
  textMeasurement: options.textMeasurement,
18900
19264
  scale: scale2,
@@ -18904,9 +19268,10 @@ function composeLayout(input, options = {}) {
18904
19268
  ...citationMarker ? { citationMarker } : {},
18905
19269
  ...language !== void 0 ? { language } : {},
18906
19270
  pull: true,
18907
- bodySize: LEAD_NOMINAL_SIZE,
19271
+ bodySize: size,
18908
19272
  bodyLines: QUOTE_PULL_LINES
18909
19273
  });
19274
+ layPull = lay;
18910
19275
  const measured = lay(y, Math.max(scale2, bodyBottom - y)), bodyPart = measured.parts.find((part) => part.role === "body");
18911
19276
  const lines = bodyPart?.fit ? "richLines" in bodyPart.fit ? bodyPart.fit.richLines.length : bodyPart.fit.lines.length : Infinity;
18912
19277
  const height2 = round9(measured.bounds.height);
@@ -18986,6 +19351,7 @@ function composeLayout(input, options = {}) {
18986
19351
  }
18987
19352
  }
18988
19353
  const metricDisplay = /* @__PURE__ */ new Map();
19354
+ const kpiRow = template?.regions.some((region) => region.accepts.length === 1 && region.accepts[0] === "metric") === true;
18989
19355
  {
18990
19356
  const leaves = [], walk2 = (nodes) => {
18991
19357
  for (const node of nodes) if (node.children) walk2(node.children);
@@ -19012,7 +19378,7 @@ function composeLayout(input, options = {}) {
19012
19378
  }
19013
19379
  const wordPillar = (node) => {
19014
19380
  const entries = node.value, entry = Array.isArray(entries) && entries.length === 1 ? record19(entries[0]) : void 0;
19015
- return !node.children && node.caption === void 0 && (node.field === "items" || node.field === "bullets") && node.payload.numbering === void 0 && entry !== void 0 && typeof entry.text === "string" && entry.text.trim() !== "" && !/\s/u.test(entry.text.trim()) && [...entry.text.trim()].length <= PILLAR_WORD_MAX && entry.description !== void 0 && (entry.level ?? 0) === 0;
19381
+ return !node.children && node.caption === void 0 && (node.field === "items" || node.field === "bullets") && node.payload.numbering === void 0 && entry !== void 0 && typeof entry.text === "string" && entry.text.trim() !== "" && !/\s/u.test(entry.text.trim()) && [...entry.text.trim()].length <= PILLAR_WORD_MAX && (entry.level ?? 0) === 0;
19016
19382
  };
19017
19383
  if (ruleOn("pillar-words") && pending.length >= 2 && pending.length <= PILLAR_MAX && pending.every(wordPillar)) {
19018
19384
  for (const node of pending) pillarWords.add(node.path);
@@ -19140,10 +19506,11 @@ function composeLayout(input, options = {}) {
19140
19506
  const growth = growthOf.get(node);
19141
19507
  return growth !== void 0 && growth > 1 ? { growth, ...bodyGrown.has(node) ? { proportional: true } : {} } : {};
19142
19508
  };
19143
- const growsAsBody = (units) => units.every((unit2) => !unit2.children && unit2.caption === void 0 && unit2.emphasis === void 0 && !unit2.eyebrow) && (units.length >= 2 && units.every((unit2) => unit2.field === "metric") || units.length === 2 && units.filter((unit2) => unit2.field === "table").length === 1 && units.filter((unit2) => unit2.field === "text").length === 1);
19509
+ const growsAsBody = (units) => units.every((unit2) => !unit2.children && unit2.caption === void 0 && unit2.emphasis === void 0 && !unit2.eyebrow) && (units.length >= 2 && units.every((unit2) => unit2.field === "metric") || units.length === 2 && units.every((unit2) => unit2.field === "table") || units.length >= 2 && units.filter((unit2) => unit2.field === "table").length === 1 && units.filter((unit2) => TABLE_ASIDE_FIELDS.has(unit2.field)).length === units.length - 1 || units.length === 2 && units.filter((unit2) => unit2.field === "code").length === 1 && units.some((unit2) => unit2.field === "text" || unit2.field === "items" || unit2.field === "bullets"));
19144
19510
  const growBodyUnits = (units) => {
19145
19511
  if (!bodySteps || !growsAsBody(units) || options[TABLE_NOTE] !== void 0) return;
19146
- for (const unit2 of units) if ((unit2.field === "metric" || unit2.field === "table") && !growthOf.has(unit2)) {
19512
+ const besideTable = units.some((unit2) => unit2.field === "table");
19513
+ for (const unit2 of units) if ((unit2.field === "table" || unit2.field === "code" || unit2.field === "metric" && !besideTable) && !growthOf.has(unit2)) {
19147
19514
  growthOf.set(unit2, TYPE_SCALE_RATIO ** Math.min(3, bodySteps));
19148
19515
  bodyGrown.add(unit2);
19149
19516
  }
@@ -19178,6 +19545,7 @@ function composeLayout(input, options = {}) {
19178
19545
  return avatar;
19179
19546
  };
19180
19547
  const avatarQuotes = /* @__PURE__ */ new WeakSet();
19548
+ const columnTexts = /* @__PURE__ */ new WeakSet();
19181
19549
  const quotePortrait = (node, box) => {
19182
19550
  const value = record19(node.value);
19183
19551
  if (value.photo === void 0 || value.portrait === "avatar") return void 0;
@@ -19195,7 +19563,7 @@ function composeLayout(input, options = {}) {
19195
19563
  ...grownOptions(node),
19196
19564
  ...fullPanels.has(node) && !hug ? { fill: true } : {}
19197
19565
  });
19198
- const metricStarts = (node) => tierMetricPaths.has(node.path) || metricDisplay.has(node.path) && (hints.contentAlignment === void 0 || hints.sources.contentAlignment === "layout" || hints.sources.contentAlignment === "theme") && (ruleOn("metric-start") || ruleOn("metric-display"));
19566
+ const metricStarts = (node) => tierMetricPaths.has(node.path) || metricDisplay.has(node.path) && !kpiRow && (hints.contentAlignment === void 0 || hints.sources.contentAlignment === "layout" || hints.sources.contentAlignment === "theme") && (ruleOn("metric-start") || ruleOn("metric-display"));
19199
19567
  const measureMetric = (node, box, settings, floorFallback = false, roleSizes, tile = false, pill) => {
19200
19568
  const tier = tile ? void 0 : tierMetricPaths.get(node.path);
19201
19569
  const starts = !tile && metricStarts(node), display = tile ? void 0 : tier ?? (ruleOn("metric-display") ? metricDisplay.get(node.path) : void 0);
@@ -19215,7 +19583,7 @@ function composeLayout(input, options = {}) {
19215
19583
  ...messageNode(node) && !tile && record19(node.value).icon === void 0 ? { message: true } : {},
19216
19584
  align: tile || starts ? "left" : alignmentFor("metric"),
19217
19585
  direction: textDirection,
19218
- ...tile ? { tile, ...tileFloors?.get(node.path) ? { minimumSizes: tileFloors.get(node.path) } : {} } : {},
19586
+ ...tile ? { tile, ...tileFloors?.get(node.path) ? { minimumSizes: tileFloors.get(node.path) } : {}, ...tileFoots.has(node) ? { tileFoot: tileFoots.get(node) } : {} } : {},
19219
19587
  ...display ? { display: { ...display, height: contentBox.height } } : {},
19220
19588
  ...tier ? { eyebrow: true } : {},
19221
19589
  // LH-135: a tier's price is a figure whatever the guard's other rules do (LH-127): "$1,200/mo" never splits.
@@ -19234,9 +19602,10 @@ function composeLayout(input, options = {}) {
19234
19602
  const stepUnits = /* @__PURE__ */ new WeakSet(), stepPaths = /* @__PURE__ */ new Set(), stepProcesses = /* @__PURE__ */ new Map(), stepProcessCells = /* @__PURE__ */ new Map();
19235
19603
  const isStepProcess = (path2) => [...stepProcesses.values()].includes(path2);
19236
19604
  const stepBand = (size) => STEP_BADGE * size * (1 + STEP_BADGE_GAP);
19605
+ const tileFoots = /* @__PURE__ */ new WeakMap();
19237
19606
  const metricTiles = /* @__PURE__ */ new WeakSet(), tileFloors = options[TILE_FLOORS];
19238
19607
  const timelineHints = /* @__PURE__ */ new WeakMap();
19239
- const measureTimeline = (node, box, settings, sizes = "role", sizeOffset, intrinsic = false) => {
19608
+ const measureTimeline = (node, box, settings, sizes = "role", sizeOffset, intrinsic = false, sizeScale) => {
19240
19609
  const retained = options[TIMELINE_NOTE_REFLOW]?.get(node.path);
19241
19610
  const hint = retained === void 0 ? timelineHints.get(node) : { horizontal: true, sizeOffset: retained };
19242
19611
  const events = Array.isArray(node.value) ? node.value : record19(node.value).events, statusWords = ruleOn("timeline-status") && Array.isArray(events) && events.some((event) => record19(event).status !== void 0) && timelineStatusWordsFor(deckLanguage()) !== void 0;
@@ -19255,6 +19624,7 @@ function composeLayout(input, options = {}) {
19255
19624
  ...hint?.horizontal ? { horizontal: true } : {},
19256
19625
  ...hint?.compact ? { compact: true } : {},
19257
19626
  ...hint?.inlineHeader ? { inlineHeader: true } : {},
19627
+ ...sizeScale !== void 0 && sizeScale > 1 ? { sizeScale } : {},
19258
19628
  sizeOffset: sizeOffset ?? (retained !== void 0 ? retained : sizes === "floor" ? -1e3 : sizes === "placed" ? hint?.sizeOffset ?? 0 : 0)
19259
19629
  });
19260
19630
  };
@@ -19275,15 +19645,35 @@ function composeLayout(input, options = {}) {
19275
19645
  })) return grown;
19276
19646
  }
19277
19647
  }
19278
- for (const growth of TIMELINE_STEP_GROWTH) {
19279
- const grown = measureTimeline(node, box, settings, "placed", growth);
19280
- if (!grown.overflow && (ranged || grown.arrangement === placed2.arrangement) && lines(grown) === lines(placed2) && capped(grown)) return grown;
19281
- }
19282
- for (let growth = TIMELINE_GROWTH; growth > 0; growth--) {
19283
- const grown = measureTimeline(node, box, settings, "placed", growth);
19284
- if (!grown.overflow && (ranged || grown.arrangement === placed2.arrangement) && capped(grown)) return grown;
19648
+ const stepped = () => {
19649
+ for (const growth of TIMELINE_STEP_GROWTH) {
19650
+ const grown = measureTimeline(node, box, settings, "placed", growth);
19651
+ if (!grown.overflow && (ranged || grown.arrangement === placed2.arrangement) && lines(grown) === lines(placed2) && capped(grown)) return grown;
19652
+ }
19653
+ for (let growth = TIMELINE_GROWTH; growth > 0; growth--) {
19654
+ const grown = measureTimeline(node, box, settings, "placed", growth);
19655
+ if (!grown.overflow && (ranged || grown.arrangement === placed2.arrangement) && capped(grown)) return grown;
19656
+ }
19657
+ return placed2;
19658
+ };
19659
+ if (!ranged && placed2.arrangement !== "vertical") {
19660
+ let floor;
19661
+ const start = TIMELINE_ROLE_SIZES.what * scale2, display = Math.max(start, Math.min(TIMELINE_DISPLAY_SIZE * scale2, capOf(settings)));
19662
+ const fixed = (layout2) => layout2.parts.map((part) => part.role === "when" || part.role === "name" ? part.fit?.lines.length ?? 0 : 0).join();
19663
+ const whatLines = (layout2) => Math.max(0, ...layout2.parts.filter((part) => part.role === "what").map((part) => part.fit?.lines.length ?? 0));
19664
+ const candidates = [...new Set(Array.from({ length: 8 }, (_, index) => typeScaleStepsUp(start, index + 1, display, settings.minFontSize ?? 16, scale2)))].sort((a, b) => b - a);
19665
+ for (const size of candidates) {
19666
+ if (size <= start * TIMELINE_STEP_MIN + FONT_GRID_EPSILON) continue;
19667
+ const grown = measureTimeline(node, box, settings, "placed", 0, false, size / start);
19668
+ floor ??= stepped();
19669
+ const kept = grown.parts.every((part, index) => {
19670
+ const before = floor.parts[index]?.fit;
19671
+ return !before || !!part.fit && part.fit.fontSize >= before.fontSize - FONT_GRID_EPSILON;
19672
+ });
19673
+ if (!grown.overflow && kept && grown.arrangement === placed2.arrangement && fixed(grown) === fixed(placed2) && whatLines(grown) <= Math.max(TIMELINE_WHAT_LINES, whatLines(placed2)) && capped(grown)) return grown;
19674
+ }
19285
19675
  }
19286
- return placed2;
19676
+ return stepped();
19287
19677
  };
19288
19678
  const captionOf = (node, box) => node.caption !== void 0 && node.captionPath ? layoutCaption(node.caption, box, node.captionPath, node.field === "image" ? { ...annotationOptions, nameDetail: true } : annotationOptions) : void 0;
19289
19679
  const wholePictureAspect = (node) => {
@@ -19665,13 +20055,39 @@ function composeLayout(input, options = {}) {
19665
20055
  const item = items[first];
19666
20056
  if (item && hasCards) item.frameBox = acceptedBox(cell);
19667
20057
  };
20058
+ const cellOfItem = /* @__PURE__ */ new WeakMap();
20059
+ const fullHeight = (cellRows) => rows2.every((_, index) => regionTracks.rows[index] || cellRows.includes(index));
20060
+ const columnsOnly = regions.every((key) => fullHeight(regionParts(key)[0]));
20061
+ const cellAnchor = ([cellRows, cellColumns]) => !hasCards && columnsOnly && fullHeight(cellRows) ? "middle" : !hasCards && regionTracks.rows[1] && cellRows.includes(2) && !regions.some((key) => {
20062
+ const [above, under] = regionParts(key);
20063
+ return above.includes(0) && under.some((column) => cellColumns.includes(column));
20064
+ }) ? "bottom" : "top";
20065
+ const placeInCell = (node, cell, settings, anchor) => {
20066
+ const lone = node.fills ? fillLone(node, cell, settings, false) : void 0;
20067
+ if (lone) {
20068
+ contentSized.add(node);
20069
+ placeNode(node, { ...lone, y: cell.y + anchoredOffset(cell.height - lone.height, anchor) }, settings, void 0, void 0, void 0, anchor);
20070
+ return;
20071
+ }
20072
+ if (MEASURED_FIELDS.has(node.field)) {
20073
+ const carded = anchor === "middle" && !hasCards && besideQuote(node);
20074
+ const need = naturalHeight(node, cell.width, carded, void 0, settings) + 2 * rasterPadding + scale2;
20075
+ if (need < cell.height) {
20076
+ contentSized.add(node);
20077
+ placeNode(node, { ...cell, y: cell.y + anchoredOffset(cell.height - need, anchor), height: need }, settings, void 0, void 0, void 0, anchor);
20078
+ return;
20079
+ }
20080
+ }
20081
+ placeNode(node, cell, settings, void 0, void 0, void 0, anchor);
20082
+ };
20083
+ const centeredColumns = /* @__PURE__ */ new WeakSet();
19668
20084
  const arrange = (nodes, area3, settings, reserved2 = 0, gapOverride, containerPath = path, recorded = true) => {
19669
20085
  const count = Math.max(nodes.length, reserved2);
19670
20086
  if (!count) return;
19671
20087
  const mode = modeFor(settings), localGap = groupGap(settings, area3);
19672
20088
  const actualGap = gapOverride ?? (settings === rootSettings ? gap : localGap);
19673
20089
  let cols = defaultColumns(count, area3, settings);
19674
- const hasRegions = nodes.some((node) => node.region);
20090
+ const hasRegions = nodes.some((node) => node.region), centerColumn = centeredColumns.has(nodes);
19675
20091
  if (mode === "grid" && settings.columns === void 0 && !hasRegions && count === nodes.length && count > 1) cols = measuredGridColumns(nodes, area3, cols, actualGap, settings);
19676
20092
  if (!hasRegions && (mode === "auto" || nodes.length === 1)) for (const node of nodes) {
19677
20093
  node.auto = true;
@@ -19715,6 +20131,7 @@ function composeLayout(input, options = {}) {
19715
20131
  spannedContainer = false;
19716
20132
  if (paragraphs) cols = paragraphs.shape.columns;
19717
20133
  else if (lead) cols = 2;
20134
+ else if (ownFlow && !paragraphs && !team && options[RECOMPOSE] !== true && middleLead(nodes)) cols = 1;
19718
20135
  let wordWeights;
19719
20136
  if (!paragraphs && !lead && !hasRegions && !team && settings.weights?.length && cols === count && count === nodes.length && count > 1) {
19720
20137
  const whole = wordRowWeights(nodes, area3, actualGap, settings, settings.weights);
@@ -19737,18 +20154,18 @@ function composeLayout(input, options = {}) {
19737
20154
  candidates: candidates ?? []
19738
20155
  });
19739
20156
  const grid = gridGeometry(count, area3, cols, actualGap, wordWeights ?? (mode === "auto" && !hasRegions ? autoRowWeights(nodes, count, cols, area3, actualGap, settings) : mode === "row" && !hasRegions ? tableRowWeights(nodes, count, cols, area3, actualGap, settings) : void 0) ?? settings.weights ?? [], mode === "column");
19740
- if (!paragraphs && !lead && mode === "auto" && !hasRegions && count === nodes.length && cols > 1 && count % cols !== 0 && !settings.weights?.length && ruleOn("short-row") && !nodes.every((node) => !node.children && (node.field === "image" || node.field === "video")) && !team) {
20157
+ if (!paragraphs && !lead && (mode === "auto" || mode === "grid" && settings.columns === void 0) && !hasRegions && count === nodes.length && cols > 1 && count % cols !== 0 && !settings.weights?.length && ruleOn("short-row") && !nodes.every((node) => !node.children && (node.field === "image" || node.field === "video")) && !team) {
19741
20158
  const first = count - count % cols, short = count - first, cell = (area3.width - grid.gap * (short - 1)) / short;
19742
20159
  for (let k = 0; k < short; k++) grid.boxes[first + k] = { ...grid.boxes[first + k], x: area3.x + k * (cell + grid.gap), width: cell };
19743
20160
  fire("short-row");
19744
20161
  }
19745
20162
  if (paragraphs) {
19746
20163
  for (const node of nodes) paragraphStarts.set(node, paragraphs.size);
19747
- const cells = flowCells(paragraphs.shape, area3, actualGap, true), rowOf = paragraphs.shape.perRow.flatMap((width2, row) => Array.from({ length: width2 }, () => row));
20164
+ const cells = flowCells(paragraphs.shape, area3, actualGap, true), rowOf = paragraphs.shape.perRow.flatMap((width2, row2) => Array.from({ length: width2 }, () => row2));
19748
20165
  grid.boxes = jointRowBoxes(nodes, cells.cells, rowOf, area3, cells.gap, settings, hasCards, "top", true);
19749
20166
  grid.columns = grid.boxes.slice(0, paragraphs.shape.columns).map((box) => ({ offset: box.x - area3.x, size: box.width }));
19750
- grid.rows = paragraphs.shape.perRow.map((_, row) => {
19751
- const box = grid.boxes[rowOf.indexOf(row)];
20167
+ grid.rows = paragraphs.shape.perRow.map((_, row2) => {
20168
+ const box = grid.boxes[rowOf.indexOf(row2)];
19752
20169
  return { offset: box.y - area3.y, size: box.height };
19753
20170
  });
19754
20171
  grid.gap = cells.gap;
@@ -19760,14 +20177,15 @@ function composeLayout(input, options = {}) {
19760
20177
  grid.rows = [{ offset: 0, size: area3.height }];
19761
20178
  grid.gap = actualGap;
19762
20179
  } else if (cols === 1 && stacks) {
19763
- const centeredProse = options[CENTER] === true && !pullItem && area3 === contentBox && nodes.every(proseLeaf);
20180
+ const centeredProse = (options[CENTER] === true || autoTrack !== void 0) && !pullItem && area3 === contentBox && nodes.every(proseLeaf);
19764
20181
  grid.boxes = stackedBoxes(nodes, area3, actualGap, settings, void 0, centeredProse ? "middle" : "top");
19765
- if (!centeredProse && !pullItem && area3 === contentBox && splitBlocks(nodes) && !nodes.every(proseLeaf) && splitFill(nodes, grid.boxes, area3, settings) < SPLIT_FILL) grid.boxes = centeredSplitStack(nodes, grid.boxes, area3, settings);
20182
+ if (centerColumn) grid.boxes = centeredSplitStack(nodes, grid.boxes, area3, settings);
20183
+ else if (!centeredProse && !pullItem && area3 === contentBox && splitBlocks(nodes) && !nodes.every(proseLeaf) && splitFill(nodes, grid.boxes, area3, settings) < SPLIT_FILL) grid.boxes = centeredSplitStack(nodes, grid.boxes, area3, settings);
19766
20184
  grid.rows = grid.boxes.map((box) => ({ offset: box.y - area3.y, size: box.height }));
19767
20185
  } else if (stacks && cols > 1 && count > cols && nodes.every(proseLeaf)) {
19768
20186
  grid.boxes = jointRowBoxes(nodes, grid.boxes, nodes.map((_, index) => Math.floor(index / cols)), area3, grid.gap, settings, hasCards, "top", true, area3 === contentBox && !pullItem);
19769
- grid.rows = grid.rows.map((_, row) => {
19770
- const box = grid.boxes[row * cols];
20187
+ grid.rows = grid.rows.map((_, row2) => {
20188
+ const box = grid.boxes[row2 * cols];
19771
20189
  return { offset: box.y - area3.y, size: box.height };
19772
20190
  });
19773
20191
  }
@@ -19776,14 +20194,21 @@ function composeLayout(input, options = {}) {
19776
20194
  if (recorded && !hasRegions) flows.push({ path: containerPath, box: { ...area3 }, composition: { ...settings }, columns: rtl ? grid.columns.map((track) => ({ offset: area3.width - track.offset - track.size, size: track.size })) : grid.columns, rows: grid.rows, gap: grid.gap, itemCount: nodes.length, slotCount: count });
19777
20195
  const stack = [];
19778
20196
  const filled = !hasRegions && !paragraphs && !lead && count === nodes.length && fillsSplit(nodes, grid.boxes, area3, settings, cols);
19779
- const regionBand = options[CENTER] === true && hasRegions && !pullItem && area3 === contentBox && nodes.every((node) => node.region?.[0].length === rows2.length && proseLeaf(node)) ? Math.max(...nodes.map((node) => naturalHeight(node, regionBox(node.region, area3, actualGap).width, hasCards && !insideTier, void 0, settings) + 2 * rasterPadding + scale2)) : void 0;
20197
+ const gridCells2 = !filled && !hasRegions && !paragraphs && !lead && !team && !hasCards && !pullItem && area3 === contentBox && settings === rootSettings && (mode === "grid" || settings.columns !== void 0) && cols > 1 && count > cols && count === nodes.length;
20198
+ const proseColumns = hasRegions && nodes.every((node) => node.region?.[0].length === rows2.length && proseLeaf(node));
20199
+ const regionBand = options[CENTER] === true && proseColumns && !pullItem && area3 === contentBox ? Math.max(...nodes.map((node) => naturalHeight(node, regionBox(node.region, area3, actualGap, regionTracks).width, hasCards && !insideTier, void 0, settings) + 2 * rasterPadding + scale2)) : void 0;
19780
20200
  nodes.forEach((node, index) => {
19781
- const placed2 = node.region ? mirrored(regionBox(node.region, area3, actualGap)) : boxes[index];
20201
+ const placed2 = node.region ? mirrored(regionBox(node.region, area3, actualGap, regionTracks)) : boxes[index];
19782
20202
  const box = regionBand !== void 0 && regionBand < placed2.height ? { ...placed2, y: placed2.y + (placed2.height - regionBand) / 2, height: regionBand } : placed2;
19783
20203
  const first = items.length;
19784
20204
  if (options[TIMELINE_NOTE_REFLOW] !== void 0 && !node.children && node.field === "text" && retainedProse?.has(node.path) && box.height >= naturalHeight(node, box.width, hasCards && !insideTier, void 0, settings) - 1e-6) contentSized.add(node);
20205
+ const cellAt = node.region && box === placed2 && !filled && !node.children ? cellAnchor(node.region) : "top", anchor = cellAt === "middle" && proseColumns ? "top" : cellAt;
19785
20206
  if (filled) placeSplitBlock(node, box, settings);
19786
- else placeNode(node, box, settings);
20207
+ else if ((centerColumn || gridCells2) && !node.children && !node.region) placeInCell(node, box, settings, "middle");
20208
+ else if (anchor !== "top") {
20209
+ placeInCell(node, box, settings, anchor);
20210
+ for (const item of items.slice(first)) cellOfItem.set(item, box);
20211
+ } else placeNode(node, box, settings);
19787
20212
  if (!hasRegions && (cols > 1 || stacks) && !node.children) stack.push(...range(first, items.length));
19788
20213
  });
19789
20214
  if (stack.length > 1) peerSets.push(stack);
@@ -19791,7 +20216,7 @@ function composeLayout(input, options = {}) {
19791
20216
  let regionTag, templateCell = false;
19792
20217
  const directionName = (direction) => ({ LR: "left to right", RL: "right to left", TB: "top to bottom", TD: "top to bottom", BT: "bottom to top" })[direction] ?? direction;
19793
20218
  const composeDiagram = (node, box, settings, anchor) => {
19794
- const floor = snapFontSizeUp((settings.minFontSize ?? 16) * scale2), nominal = Math.max(floor, DIAGRAM_NOMINAL_SIZE * scale2);
20219
+ const floor = snapFontSizeUp((settings.minFontSize ?? 16) * scale2), nominal = Math.max(floor, Math.min(capOf(settings), snapFontSizeDown(DIAGRAM_NOMINAL_SIZE * scale2 * ARRANGEMENT_GROWTH)));
19795
20220
  const measure = diagramMeasure(options.textMeasurement, options.fontFamilies?.body ?? "sans-serif", options.fontFamilies?.code ?? FALLBACK_CODE_FAMILY);
19796
20221
  try {
19797
20222
  const laid = layoutDiagram(node.value, { width: box.width, height: box.height, nominal, floor, measure, idPrefix: `opf-${node.path.replace(/[^\w-]+/g, "-")}`, grid: { down: snapFontSizeDown, up: snapFontSizeUp } });
@@ -19994,6 +20419,29 @@ function composeLayout(input, options = {}) {
19994
20419
  shapeTexts.set(node.path, { value: host.text, textPath });
19995
20420
  items.push({ path: node.path, field: "shape", type: "shape", value: node.value, payload: node.payload, box: { ...shape.box }, shape, ...text2 ? { text: text2 } : {}, textStyle: { ...styleFor("text", textPath), ...shape.textBold ? { fontWeight: 700 } : {} }, composition: settings, alignment: "center" });
19996
20421
  };
20422
+ const captionReserve = /* @__PURE__ */ new WeakMap(), wholePictures = /* @__PURE__ */ new WeakSet();
20423
+ const wordmarks = /* @__PURE__ */ new WeakSet();
20424
+ const reserveCaptions = (units, boxes, cards) => {
20425
+ const media = (unit2) => !unit2.children && (unit2.field === "image" || unit2.field === "video");
20426
+ const rows3 = /* @__PURE__ */ new Map();
20427
+ units.forEach((unit2, index) => {
20428
+ const box = boxes[index];
20429
+ if (media(unit2) && box) {
20430
+ const key = `${Math.round(box.y)}:${Math.round(box.height)}`;
20431
+ rows3.set(key, [...rows3.get(key) ?? [], index]);
20432
+ }
20433
+ });
20434
+ for (const row2 of rows3.values()) {
20435
+ const bands = row2.map((index) => {
20436
+ const inner = payloadBox(boxes[index], cards), captioned = captionOf(units[index], inner);
20437
+ return captioned ? inner.height - captioned.mediaBox.height : 0;
20438
+ });
20439
+ const band = Math.max(...bands);
20440
+ if (band > 0) row2.forEach((index, at3) => {
20441
+ if (!bands[at3]) captionReserve.set(units[index], band);
20442
+ });
20443
+ }
20444
+ };
19997
20445
  const placeNode = (node, box, settings, cards = hasCards, listColumns, metricReferenceHeight, anchor = "top", frame) => {
19998
20446
  const emphasized = !insideEmphasis && node.emphasis !== void 0 && node.emphasis === chosenEmphasis;
19999
20447
  const ownCard = !insideEmphasis && !insideCard && node.cardCell === true;
@@ -20072,8 +20520,10 @@ function composeLayout(input, options = {}) {
20072
20520
  let metricHeight = metricReferenceHeight === void 0 ? void 0 : payloadBox({ ...box, height: metricReferenceHeight }, cards).height;
20073
20521
  const cell = box;
20074
20522
  box = payloadBox(box, cards);
20523
+ const captionArea = box;
20075
20524
  let caption = captionOf(node, box);
20076
20525
  if (caption) box = caption.mediaBox;
20526
+ else if (captionReserve.has(node)) box = { ...box, height: Math.max(scale2, box.height - captionReserve.get(node)) };
20077
20527
  const brow = node.eyebrow ? eyebrowBand(node.eyebrow, box.width, proseMeasure(node, box.width).size) : 0;
20078
20528
  if (brow) box = { ...box, y: box.y + brow, height: Math.max(scale2, box.height - brow) };
20079
20529
  if (stepUnits.has(node)) {
@@ -20110,22 +20560,26 @@ function composeLayout(input, options = {}) {
20110
20560
  if (caption) diagnostics.push(...caption.diagnostics);
20111
20561
  const timelineLayout = node.field === "timeline" ? placeTimeline(node, box, settings) : void 0;
20112
20562
  const internal = quoteLayout ?? codeLayout ?? metricLayout ?? timelineLayout, body = internal?.parts.find((part) => part.role === "body" || part.role === "value");
20113
- const columns2 = textValue !== void 0 && !internal ? listColumnsFor(node, box, settings, listColumns) : void 0;
20563
+ let columns2 = textValue !== void 0 && !internal ? listColumnsFor(node, box, settings, listColumns) : void 0;
20564
+ if (columns2 && columns2.length > 1 && anchor !== "top") {
20565
+ const dy = anchoredOffset(box.height - Math.max(...columns2.map((column) => column.text.height)), anchor);
20566
+ if (dy > scale2) columns2 = columns2.map((column) => ({ ...column, text: translateListFit(column.text, dy) }));
20567
+ }
20114
20568
  const floorSize = snapFontSizeUp((settings.minFontSize ?? 16) * scale2);
20115
20569
  const prose = textValue !== void 0 && !internal ? proseMeasure(node, box.width) : void 0, wholeBox = box;
20116
20570
  if (prose && prose.width < box.width - 0.5) {
20117
20571
  const side = alignmentFor(node.field), atEnd = rtl ? side === "left" : side === "right";
20118
20572
  box = { ...box, x: side === "center" ? box.x + (box.width - prose.width) / 2 : atEnd ? box.x + box.width - prose.width : box.x, width: prose.width };
20119
20573
  }
20120
- let text2 = internal ? body?.fit : columns2 ? columns2.length > 1 ? mergeListColumns(columns2) : columns2[0].text : textValue !== void 0 ? fitContent(node.field, node.value, textValue, box, prose?.size ?? contentNominalSize(node.field) * scale2, floorSize, node.path, node.payload.numbering) : void 0;
20574
+ let text2 = internal ? body?.fit : columns2 ? columns2.length > 1 ? mergeListColumns(columns2) : columns2[0].text : textValue !== void 0 ? fitContent(node.field, node.value, textValue, box, wordmarks.has(node) ? snapFontSizeDown(WORDMARK_SIZE * scale2) : prose?.size ?? contentNominalSize(node.field) * scale2, floorSize, node.path, node.payload.numbering, wordmarks.has(node) ? "center" : void 0) : void 0;
20121
20575
  if (prose && box !== wholeBox && text2 && textValue !== void 0 && retainedProse?.get(node.path)?.limit === void 0) {
20122
- const wide = fitContent(node.field, node.value, textValue, wholeBox, prose.size, floorSize, node.path, node.payload.numbering);
20576
+ const wide = fitContent(node.field, node.value, textValue, wholeBox, prose.size, floorSize, node.path, node.payload.numbering, wordmarks.has(node) ? "center" : void 0);
20123
20577
  if (wide.fontSize > text2.fontSize + 1e-9 || text2.overflow && !wide.overflow) {
20124
20578
  text2 = wide;
20125
20579
  box = wholeBox;
20126
20580
  }
20127
20581
  }
20128
- let alignment = alignmentFor(node.field);
20582
+ let alignment = wordmarks.has(node) ? "center" : alignmentFor(node.field);
20129
20583
  const centered = text2 && textValue !== void 0 && !internal && !columns2 ? startAlignedCenter(node, text2, textValue, box) : void 0;
20130
20584
  if (centered) {
20131
20585
  alignment = "left";
@@ -20136,7 +20590,7 @@ function composeLayout(input, options = {}) {
20136
20590
  if (node.field === "video") box = roundBox5(containedBox(box, VIDEO_ASPECT, anchor));
20137
20591
  else if (node.field === "chart" && !templateCell && modeFor(settings) === "auto" && box.height > chartMaxHeight(node, box.width)) {
20138
20592
  const height2 = chartMaxHeight(node, box.width);
20139
- box = roundBox5({ ...box, ...node.lone ? { y: box.y + (box.height - height2) / 2 } : {}, height: height2 });
20593
+ box = roundBox5({ ...box, ...node.lone ? { y: box.y + (box.height - height2) / 2 } : anchor !== "top" ? { y: box.y + anchoredOffset(box.height - height2, anchor) } : {}, height: height2 });
20140
20594
  }
20141
20595
  let imageHost = portraitHosts.get(node.path) ?? node.host ?? {};
20142
20596
  if (node.field === "image" && !portraitHosts.has(node.path) && !personPictures.has(node.path) && cards && frameBox && !onSurface && !caption && !imageHost.aspectRatio && imageHost.adjust === void 0 && (imageHost.shape === void 0 || imageHost.shape === "rect") && (imageHost.stroke === void 0 || imageHost.stroke === "none" || record19(imageHost.stroke).width === 0)) {
@@ -20149,7 +20603,8 @@ function composeLayout(input, options = {}) {
20149
20603
  }
20150
20604
  }
20151
20605
  const image = node.field === "image" ? composeImage(imageHost, node.hostPath ?? node.path, box, box, { ...imageContext(void 0, anchor, settings), ...coverPictures.has(node) ? { fit: "cover" } : {} }) : void 0;
20152
- if (caption) settleCaption(caption, image?.box ?? box, anchor);
20606
+ if (caption && image && wholePictures.has(node) && caption.position !== "above" && image.box.width < captionArea.width - 1) caption = captionOf(node, { ...captionArea, x: image.box.x, width: image.box.width }) ?? caption;
20607
+ if (caption) settleCaption(caption, image?.box ?? box, wholePictures.has(node) ? "top" : anchor);
20153
20608
  const chart = node.field === "chart" ? composeChart(node, box, settings) : void 0;
20154
20609
  const diagram = node.field === "diagram" ? composeDiagram(node, box, settings, anchor) : void 0;
20155
20610
  if (caption && diagram && !diagram.issue) settleCaption(caption, diagram.box, anchor);
@@ -20234,9 +20689,7 @@ function composeLayout(input, options = {}) {
20234
20689
  const renumber = (fit, from) => ({ ...fit, listEntries: fit.listEntries.map((entry) => ({ ...entry, index: entry.index + from, ...sourcePaths(entry.index + from) })) });
20235
20690
  const breaksAt = (count2, boxes, at4) => {
20236
20691
  const whole = fitList(values, { ...boxes[0], height: 1e6 }, at4, at4, listOptions);
20237
- const first = whole.listEntries[0].textBox.y;
20238
- const heights = whole.listEntries.map((entry, index) => (whole.listEntries[index + 1]?.textBox.y ?? first + whole.height) - entry.textBox.y);
20239
- return [0, ...listColumnBreaks(heights, whole.listEntries.map((entry) => entry.level), count2), values.length];
20692
+ return [0, ...listColumnBreaks(listEntryPitches(whole), whole.listEntries.map((entry) => entry.level), count2), values.length];
20240
20693
  };
20241
20694
  const place2 = (boxes, breaks, size, minimum) => boxes.slice(0, breaks.length - 1).map((cell, index) => ({ box: cell, start: breaks[index], end: breaks[index + 1], text: renumber(fitList(chunk(breaks[index], breaks[index + 1]), cell, size, minimum, listOptions), breaks[index]) }));
20242
20695
  const split2 = (count2, size, minimum) => {
@@ -20362,6 +20815,11 @@ function composeLayout(input, options = {}) {
20362
20815
  const bodySteps = Math.max(0, Math.floor(Number(options[GROW] ?? 0)) || 0);
20363
20816
  const retainedProse = options[PROSE_REFLOW];
20364
20817
  const retainedWidths = /* @__PURE__ */ new WeakMap();
20818
+ let shortTexts;
20819
+ const shortTextBody = () => shortTexts ??= recordTemplate !== void 0 && (() => {
20820
+ const found = bodyPayloads(slide);
20821
+ return !!found && found.length >= 2 && found.every((entry) => entry.field === "text" && entry.host.caption === void 0 && messageWords(entry.host.text) <= SHORT_TEXT_WORDS);
20822
+ })();
20365
20823
  const proseMeasure = (node, cellWidth) => {
20366
20824
  const retained = retainedProse?.get(node.path);
20367
20825
  if (retained && node.field === "text" && !node.children) {
@@ -20387,7 +20845,7 @@ function composeLayout(input, options = {}) {
20387
20845
  if (set2 !== void 0) return { size: set2, width: Math.min(cellWidth, PARAGRAPH_MEASURE_MAX * AVERAGE_CHARACTER_EM * set2) };
20388
20846
  const base = baseProseMeasure(node, cellWidth);
20389
20847
  if (!bodySteps || node.children || proseGrowth.has(node) || node.field !== "text" && node.field !== "items" && node.field !== "bullets") return base;
20390
- const display = (options[GRID_GROW] === true ? COMPACT_GRID_DISPLAY : LONE_DISPLAY_SIZES.list) * scale2;
20848
+ const display = (options[GRID_GROW] === true ? shortTextBody() ? HEADING_DISPLAY_SIZES.title : COMPACT_GRID_DISPLAY : LONE_DISPLAY_SIZES.list) * scale2;
20391
20849
  let size = base.size;
20392
20850
  for (let step = 0; step < bodySteps; step++) {
20393
20851
  const next = scaleAbove(size, composition.minFontSize ?? 16);
@@ -20426,10 +20884,10 @@ function composeLayout(input, options = {}) {
20426
20884
  if (node.children && node.synthetic && !node.orient && node.children.length > 1 && (node.composition?.mode ?? "auto") === "auto") {
20427
20885
  const between = node.gap ?? gap, perRow = gridFlowShape(node.children.length, true).perRow;
20428
20886
  let from = 0;
20429
- return perRow.reduce((sum, count, row) => {
20887
+ return perRow.reduce((sum, count, row2) => {
20430
20888
  const share2 = Math.max(scale2, (cellWidth - between * (count - 1)) / count), members = node.children.slice(from, from + count);
20431
20889
  from += count;
20432
- return sum + (row ? between : 0) + Math.max(0, ...members.map((child) => naturalHeight(child, share2, cards, void 0, naturalSettings, atFloor)));
20890
+ return sum + (row2 ? between : 0) + Math.max(0, ...members.map((child) => naturalHeight(child, share2, cards, void 0, naturalSettings, atFloor)));
20433
20891
  }, 0);
20434
20892
  }
20435
20893
  if (node.children) {
@@ -20469,7 +20927,7 @@ function composeLayout(input, options = {}) {
20469
20927
  const textBesideChart = (node) => {
20470
20928
  const plain3 = (entry) => entry.emphasis === void 0 && !entry.eyebrow && !entry.cardCell;
20471
20929
  const leaf = node.children?.length === 1 && !node.synthetic && plain3(node) && record19(node.payload).icon === void 0 ? node.children[0] : node;
20472
- return !leaf.children && leaf.field === "text" && leaf.caption === void 0 && plain3(leaf) ? leaf : void 0;
20930
+ return !leaf.children && (leaf.field === "text" || leaf.field === "items" || leaf.field === "bullets") && leaf.caption === void 0 && plain3(leaf) ? leaf : void 0;
20473
20931
  };
20474
20932
  const fillLone = (node, cell, settings, cards) => {
20475
20933
  if (!node.fills || node.field !== "quote" || quotePortrait(node, payloadBox(cell, cards)) === void 0) return fillLoneBlock(node, cell, settings, cards);
@@ -20536,7 +20994,9 @@ function composeLayout(input, options = {}) {
20536
20994
  growPanel();
20537
20995
  return wholePanel();
20538
20996
  }
20539
- return ruled ? spreadCell() : void 0;
20997
+ if (ruled) return spreadCell();
20998
+ if (prose && !cards && best <= LONE_TARGET * inner.height) return { ...cell, y: pullItem ? cell.y : cell.y + (cell.height - best) / 2, height: best };
20999
+ return void 0;
20540
21000
  }
20541
21001
  const floor = snapFontSizeUp((settings.minFontSize ?? 16) * scale2);
20542
21002
  if (prose) {
@@ -20558,6 +21018,26 @@ function composeLayout(input, options = {}) {
20558
21018
  proseGrowth.set(node, chosen);
20559
21019
  loneGrowth = true;
20560
21020
  }
21021
+ if (node.field !== "text" && !ruled && !(Array.isArray(node.value) && node.value.some((entry) => node.payload.numbering === void 0 && resolvedIcon(record19(entry).icon) !== void 0 || record19(entry).description !== void 0)) && !badgeLists.has(node.path) && !drawnLoneLists.has(node.path) && !checkTileSlide() && chosen !== void 0 && best < LONE_FILL * inner.height) {
21022
+ const lines = (size2) => fitLines(fitContent(node.field, node.value, contentText(node.field, node.value) ?? "", { ...inner, width: proseMeasure(node, inner.width).width }, size2, floor, node.path, node.payload.numbering));
21023
+ const entries = Array.isArray(node.value) ? node.value.filter((entry) => (record19(entry).level ?? 0) === 0).length : 0;
21024
+ const sparseCap = SPARSE_LIST_DISPLAY.find(([most]) => entries <= most)?.[1] ?? 0;
21025
+ const oneLine2 = Array.isArray(node.value) ? node.value.length : 0;
21026
+ let size = chosen, further;
21027
+ for (; ; ) {
21028
+ if (lines(size) > oneLine2) break;
21029
+ const step = scaleAbove(size, settings.minFontSize ?? 16);
21030
+ if (step <= display + 1e-9 || step > sparseCap * scale2 + 1e-9 || step > capOf(settings) + FONT_GRID_EPSILON) break;
21031
+ proseGrowth.set(node, step);
21032
+ const height3 = plainNeed(), measure = proseMeasure(node, inner.width);
21033
+ const fit = fitContent(node.field, node.value, contentText(node.field, node.value) ?? "", { ...inner, width: measure.width }, step, floor, node.path, node.payload.numbering);
21034
+ if (height3 > LONE_TARGET * inner.height || fit.overflow || fit.fontSize < step - 1e-9 || fitLines(fit) > oneLine2) break;
21035
+ further = step;
21036
+ best = height3;
21037
+ size = step;
21038
+ }
21039
+ proseGrowth.set(node, further ?? chosen);
21040
+ }
20561
21041
  const cited = Array.isArray(node.value) && node.value.some((run) => run && typeof run === "object" && (run.cite !== void 0 || run.footnote !== void 0));
20562
21042
  const words2 = node.field === "text" && !cited ? messageWords(node.value) : Infinity;
20563
21043
  if (words2 <= SHORT_MESSAGE_WORDS && ruleOn("display-message")) {
@@ -20608,7 +21088,7 @@ function composeLayout(input, options = {}) {
20608
21088
  let fits;
20609
21089
  if (node.field === "table") {
20610
21090
  const table = measureTable(node, inner.width, settings), size = gridFontSize(grownRoleSize(TABLE_NOMINAL_SIZE, growth, LONE_DISPLAY_SIZES.table) * scale2, floor);
20611
- fits = !!table && !table.overflow && !table.splitsWords && table.rows.every((row) => row.cells.every((cell2) => cell2.fit.fontSize >= size - 1e-9 || Array.isArray(cell2.value)));
21091
+ fits = !!table && !table.overflow && !table.splitsWords && table.rows.every((row2) => row2.cells.every((cell2) => cell2.fit.fontSize >= size - 1e-9 || Array.isArray(cell2.value)));
20612
21092
  } else {
20613
21093
  const layout2 = node.field === "quote" ? measureQuote(node, inner, settings) : node.field === "code" ? measureCode(node, inner, settings) : measureMetric(node, inner, settings);
20614
21094
  fits = !layout2.overflow && layout2.parts.every((part) => part.visible === false || part.fit !== void 0 && part.fit.fontSize >= part.requestedFontSize - 1e-9);
@@ -20630,6 +21110,7 @@ function composeLayout(input, options = {}) {
20630
21110
  }
20631
21111
  if (fillsPanel()) return wholePanel();
20632
21112
  if (ruled) return spreadCell();
21113
+ if (columnTexts.has(node)) return cards ? { ...cell, y: cell.y + gap * CARD_FILL_SPACE, height: Math.max(scale2, cell.height - gap * CARD_FILL_SPACE) } : cell;
20633
21114
  let height2 = best;
20634
21115
  if (cards) for (let pass = 0; pass < 3; pass++) {
20635
21116
  const frame = acceptedBox({ ...cell, height: Math.min(cell.height, height2) }), room = payloadBox(frame, true).height;
@@ -20660,7 +21141,7 @@ function composeLayout(input, options = {}) {
20660
21141
  if (useTemplate || regions.length || !Array.isArray(slide.blocks) || chartSplit || modeFor(rootSettings) !== "auto" || rootSettings.columns !== void 0 || rootSettings.weights?.length) return void 0;
20661
21142
  const blockOf = (node) => node.children ? node.path : node.path.slice(0, node.path.lastIndexOf("."));
20662
21143
  if (new Set(nodes.map(blockOf)).size !== nodes.length || slide.blocks.some((block) => record19(block).region !== void 0)) return void 0;
20663
- const grouping = nodes.map((node) => node.children ? { kind: "group", group: true } : node.eyebrow ? { kind: EYEBROW_TEXT_KIND } : { kind: kind(node.field), ...node.field === "text" ? { length: textLength(node.value) } : {} });
21144
+ const grouping = nodes.map((node) => node.children ? { kind: "group", group: true } : node.eyebrow ? { kind: EYEBROW_TEXT_KIND } : { kind: node.field === "bullets" ? "list" : kind(node.field), ...node.field === "text" ? { length: textLength(node.value) } : {} });
20664
21145
  const pairs = repeatedPairs(grouping);
20665
21146
  if (pairs) return { nodes: Array.from({ length: pairs.count }, (_, pair) => pairUnit([nodes[2 * pair], nodes[2 * pair + 1]])) };
20666
21147
  const split2 = majorityKind(grouping);
@@ -20682,8 +21163,8 @@ function composeLayout(input, options = {}) {
20682
21163
  for (const trial of scaleSizes(Math.max(...starts), settings.minFontSize ?? 16)) {
20683
21164
  needs = Array.from({ length: rows3 }, () => 0);
20684
21165
  units.forEach((unit2, index) => {
20685
- const width2 = cells[index].width, pad = inset2(width2), row = rowOf[index];
20686
- needs[row] = Math.max(needs[row], naturalHeight(unit2, width2 - 2 * pad, false, void 0, settings, false, Math.min(trial, starts[index])) + 2 * pad + slack);
21166
+ const width2 = cells[index].width, pad = inset2(width2), row2 = rowOf[index];
21167
+ needs[row2] = Math.max(needs[row2], naturalHeight(unit2, width2 - 2 * pad, false, void 0, settings, false, Math.min(trial, starts[index])) + 2 * pad + slack);
20687
21168
  });
20688
21169
  if (needs.reduce((sum, need) => sum + need, 0) <= space + 1e-6) {
20689
21170
  halfTrial(trial, settings.minFontSize ?? 16);
@@ -20735,7 +21216,7 @@ function composeLayout(input, options = {}) {
20735
21216
  const paragraphShapes = (count) => {
20736
21217
  const shapes = /* @__PURE__ */ new Map();
20737
21218
  for (let columns2 = 2; columns2 <= Math.min(count, PARAGRAPH_GRID_COLUMNS); columns2++) {
20738
- const rows3 = Math.ceil(count / columns2), perRow = Array.from({ length: rows3 }, (_, row) => Math.min(columns2, count - row * columns2));
21219
+ const rows3 = Math.ceil(count / columns2), perRow = Array.from({ length: rows3 }, (_, row2) => Math.min(columns2, count - row2 * columns2));
20739
21220
  shapes.set(perRow.join(), { columns: columns2, rows: rows3, perRow });
20740
21221
  }
20741
21222
  return [...shapes.values()];
@@ -20743,10 +21224,10 @@ function composeLayout(input, options = {}) {
20743
21224
  const paragraphRowNeeds = (units, shape, cells, cards, size, settings) => {
20744
21225
  const slack = 2 * rasterPadding + scale2 + (cards ? gap * CARD_FILL_SPACE : 0), needs = shape.perRow.map(() => 0);
20745
21226
  let index = 0;
20746
- shape.perRow.forEach((count, row) => {
21227
+ shape.perRow.forEach((count, row2) => {
20747
21228
  for (let k = 0; k < count; k++, index++) {
20748
21229
  const pad = cardInsetOf(cells[index].width, cards), width2 = Math.min(cells[index].width - 2 * pad, PARAGRAPH_MEASURE_MAX * AVERAGE_CHARACTER_EM * size);
20749
- needs[row] = Math.max(needs[row], naturalHeight(units[index], width2, false, void 0, settings, false, size) + 2 * pad + slack);
21230
+ needs[row2] = Math.max(needs[row2], naturalHeight(units[index], width2, false, void 0, settings, false, size) + 2 * pad + slack);
20750
21231
  }
20751
21232
  });
20752
21233
  return needs;
@@ -20780,7 +21261,7 @@ function composeLayout(input, options = {}) {
20780
21261
  const LEAD_STACK_MIN = 3, LEAD_STACK_MAX = 5, LEAD_MEDIAN_RATIO = 2.5, LEAD_SHARE = 0.55, FIGURE_LEAD_SHARE = 0.58, COMPACT_CHARS = CENTERED_MAX_CHARS;
20781
21262
  const stackLeads = /* @__PURE__ */ new WeakSet();
20782
21263
  const leadLength = (node) => textLength(node.field === "quote" ? typeof node.value === "string" ? node.value : record19(node.value).text : node.value);
20783
- const leadStackPlan = (units) => {
21264
+ const leadStackShape = (units) => {
20784
21265
  if (!ruleOn("lead-stack") || units.length < LEAD_STACK_MIN || units.length > LEAD_STACK_MAX || units.some((unit2) => unit2.children)) return void 0;
20785
21266
  let plan2;
20786
21267
  if (units.every((unit2) => unit2.caption === void 0 && (unit2.field === "text" || unit2.field === "quote"))) {
@@ -20795,6 +21276,14 @@ function composeLayout(input, options = {}) {
20795
21276
  }
20796
21277
  return plan2;
20797
21278
  };
21279
+ const leadStackPlan = (units) => {
21280
+ const plan2 = leadStackShape(units);
21281
+ return plan2 && (plan2.lead === 0 || plan2.lead === units.length - 1) ? plan2 : void 0;
21282
+ };
21283
+ const middleLead = (units) => {
21284
+ const plan2 = leadStackShape(units);
21285
+ return plan2 !== void 0 && plan2.lead !== 0 && plan2.lead !== units.length - 1;
21286
+ };
20798
21287
  const leadStack = (units) => {
20799
21288
  const plan2 = leadStackPlan(units);
20800
21289
  if (plan2) {
@@ -20848,15 +21337,16 @@ function composeLayout(input, options = {}) {
20848
21337
  const filled = plan2.regions.filter((region) => grouped.units.get(region.name)?.length);
20849
21338
  const key = filled.length ? band(filled[0].name) : void 0;
20850
21339
  if (key === void 0 || filled.some((region) => band(region.name) !== key)) return { binding: grouped };
20851
- const row = plan2.regions.filter((region) => band(region.name) === key).sort((a, b) => rects.get(a.name).column - rects.get(b.name).column);
20852
- const units = row.flatMap((region) => grouped.units.get(region.name) ?? []);
21340
+ const row2 = plan2.regions.filter((region) => band(region.name) === key).sort((a, b) => rects.get(a.name).column - rects.get(b.name).column);
21341
+ if (row2.length > 1 && row2.length === plan2.regions.length && options[ROWS_ON_OVERFLOW] !== true) return { binding: grouped };
21342
+ const units = row2.flatMap((region) => grouped.units.get(region.name) ?? []);
20853
21343
  const side = filled.length > 1 || filled[0].flow !== "column";
20854
21344
  if (!side || units.length < 2 || units.length > LONG_TEXT_ROWS || !units.every(longBlock)) return { binding: grouped };
20855
- if (row.some((region) => region.bleed || region !== row[0] && region.empty === "keep" || grouped.regions.find((entry) => entry.name === region.name)?.overflow.length)) return { binding: grouped };
20856
- const target = row[0].name, names2 = new Set(row.map((region) => region.name));
21345
+ if (row2.some((region) => region.bleed || region !== row2[0] && region.empty === "keep" || grouped.regions.find((entry) => entry.name === region.name)?.overflow.length)) return { binding: grouped };
21346
+ const target = row2[0].name, names2 = new Set(row2.map((region) => region.name));
20857
21347
  fire("long-text-rows");
20858
21348
  const moved = new Map(grouped.units);
20859
- for (const region of row) moved.set(region.name, region.name === target ? units : []);
21349
+ for (const region of row2) moved.set(region.name, region.name === target ? units : []);
20860
21350
  return { binding: { ...grouped, units: moved, regions: grouped.regions.map((entry) => entry.name === target ? { ...entry, blocks: units.flat() } : names2.has(entry.name) ? { ...entry, blocks: [] } : entry) }, region: target };
20861
21351
  };
20862
21352
  const centeredCardText = [];
@@ -20944,6 +21434,10 @@ function composeLayout(input, options = {}) {
20944
21434
  stepPaths.add(unit2.path);
20945
21435
  if (isList(unit2) && numbered(unit2) && entries(unit2).length === 1) stepHeadings.add(unit2.path);
20946
21436
  }
21437
+ const described = (unit2) => stepHeadings.has(unit2.path) && record19(entries(unit2)[0]).description !== void 0;
21438
+ if (units.some(described)) {
21439
+ for (const unit2 of units) if (stepHeadings.has(unit2.path) && !described(unit2)) aloneHeadings.add(unit2.path);
21440
+ }
20947
21441
  fire("step-badges");
20948
21442
  };
20949
21443
  const markPairs = (units) => {
@@ -21022,7 +21516,9 @@ function composeLayout(input, options = {}) {
21022
21516
  if (body.length === 1 && !binding.belowUnits.length) {
21023
21517
  const { unit: unit2, region } = body[0], values = Array.isArray(unit2.value) ? unit2.value : [];
21024
21518
  const list = !unit2.children && unit2.caption === void 0 && (unit2.field === "items" || unit2.field === "bullets") && !badgeLists.has(unit2.path);
21025
- if (list && !region.arrangement && ruleOn("numerals") && unit2.payload.numbering !== void 0 && values.length >= 2 && values.length <= NUMERAL_TAKEAWAYS && values.every((entry) => (record19(entry).level ?? 0) === 0)) {
21519
+ const takeaways = list && !region.arrangement && unit2.payload.numbering !== void 0 && values.length >= 2 && values.length <= NUMERAL_TAKEAWAYS && values.every((entry) => (record19(entry).level ?? 0) === 0);
21520
+ if (list && (takeaways || region.arrangement)) drawnLoneLists.add(unit2.path);
21521
+ if (takeaways && ruleOn("numerals")) {
21026
21522
  badgeLists.add(unit2.path);
21027
21523
  numeralLists.set(unit2.path, "display");
21028
21524
  fire("numerals");
@@ -21037,11 +21533,18 @@ function composeLayout(input, options = {}) {
21037
21533
  const bodyUnits = [...contents.values()].flat().concat(belowUnits);
21038
21534
  const loneUnit = options.fill !== false && plan2.stack === void 0 && bodyUnits.length === 1 && !bodyUnits[0].children ? bodyUnits[0] : void 0;
21039
21535
  if (loneUnit) loneUnit.fills = true;
21040
- else if (options.fill !== false && plan2.stack === void 0 && bodyUnits.length === 2 && !belowUnits.length) {
21041
- const chart = bodyUnits.findIndex((unit2) => !unit2.children && unit2.field === "chart"), other = chart >= 0 ? bodyUnits[1 - chart] : void 0;
21042
- const region = other && plan2.regions.find((entry) => (contents.get(entry.name) ?? []).includes(other));
21043
- const text2 = region && singleBlockRegion(region) && !region.arrangement ? textBesideChart(other) : void 0;
21044
- if (text2) text2.fills = true;
21536
+ else if (options.fill !== false && plan2.stack === void 0 && bodyUnits.length >= 2 && !belowUnits.length) {
21537
+ const mediaRegion = (unit2) => plan2.regions.find((entry) => (contents.get(entry.name) ?? []).includes(unit2))?.role === "media";
21538
+ const figures = bodyUnits.filter((unit2) => !unit2.children && (unit2.field === "chart" || unit2.field === "image" && mediaRegion(unit2)));
21539
+ const others = figures.length === 1 ? bodyUnits.filter((unit2) => unit2 !== figures[0]) : [];
21540
+ const texts = others.map((other) => {
21541
+ const region = plan2.regions.find((entry) => (contents.get(entry.name) ?? []).includes(other));
21542
+ return region && (others.length === 1 ? (contents.get(region.name) ?? []).length === 1 : singleBlockRegion(region)) && !region.arrangement ? textBesideChart(other) : void 0;
21543
+ });
21544
+ if (texts.length && texts.every((text2) => text2 !== void 0)) for (const text2 of texts) {
21545
+ text2.fills = true;
21546
+ if (texts.length > 1) columnTexts.add(text2);
21547
+ }
21045
21548
  }
21046
21549
  if (plan2.stack !== void 0 && bodySteps) {
21047
21550
  for (const unit2 of bodyUnits) if (!unit2.children && unit2.field === "quote") growthOf.set(unit2, TYPE_SCALE_RATIO ** bodySteps);
@@ -21057,8 +21560,8 @@ function composeLayout(input, options = {}) {
21057
21560
  const bandRows = (units, width2, columns2, cards, atFloor) => {
21058
21561
  const rows3 = [];
21059
21562
  units.forEach((unit2, index) => {
21060
- const row = Math.floor(index / columns2);
21061
- rows3[row] = Math.max(rows3[row] ?? 0, naturalHeight(unit2, bandWidthOf(index, units.length, columns2, width2), cards, void 0, composition, atFloor));
21563
+ const row2 = Math.floor(index / columns2);
21564
+ rows3[row2] = Math.max(rows3[row2] ?? 0, naturalHeight(unit2, bandWidthOf(index, units.length, columns2, width2), cards, void 0, composition, atFloor));
21062
21565
  });
21063
21566
  return rows3;
21064
21567
  };
@@ -21089,8 +21592,8 @@ function composeLayout(input, options = {}) {
21089
21592
  return top;
21090
21593
  });
21091
21594
  const boxes = units.map((_, index) => {
21092
- const row = Math.floor(index / columns2), width2 = bandWidthOf(index, units.length, columns2, cell.width);
21093
- return { x: bandSpans(index, units.length, columns2) ? cell.x : cell.x + index % columns2 * (width2 + gap2), y: tops[row], width: width2, height: heights2[row] };
21595
+ const row2 = Math.floor(index / columns2), width2 = bandWidthOf(index, units.length, columns2, cell.width);
21596
+ return { x: bandSpans(index, units.length, columns2) ? cell.x : cell.x + index % columns2 * (width2 + gap2), y: tops[row2], width: width2, height: heights2[row2] };
21094
21597
  });
21095
21598
  const reduction = Math.max(0, ...units.map((unit2, index) => {
21096
21599
  const layout2 = measureTimeline(unit2, payloadBox(boxes[index], cards), composition);
@@ -21106,7 +21609,7 @@ function composeLayout(input, options = {}) {
21106
21609
  const titleFields = ["tag", "title", ...plan2.subtitle ? [] : ["subtitle"]].filter(shown);
21107
21610
  const subtitleFields = plan2.subtitle && shown("subtitle") ? ["subtitle"] : [];
21108
21611
  const columnCount = plan2.columns.length;
21109
- const cells = plan2.grid.map((row) => [...row]);
21612
+ const cells = plan2.grid.map((row2) => [...row2]);
21110
21613
  const rowSizes = [...plan2.rows];
21111
21614
  const implicitTitle = !plan2.title && titleFields.length > 0;
21112
21615
  if (implicitTitle) {
@@ -21117,12 +21620,13 @@ function composeLayout(input, options = {}) {
21117
21620
  cells.push(Array.from({ length: columnCount }, () => BELOW));
21118
21621
  rowSizes.push("auto");
21119
21622
  }
21120
- if (options[CENTER] === true && bodySteps > 0 && plan2.stack === void 0 && growsAsBody(bodyUnits) && bodyUnits.every((unit2) => unit2.field === "metric")) {
21121
- cells.forEach((row, index) => {
21122
- const names2 = row.filter((name) => name !== ".");
21623
+ const huggedField = (unit2) => unit2.field === "metric" || unit2.field === "table";
21624
+ if (options[CENTER] === true && bodySteps > 0 && plan2.stack === void 0 && growsAsBody(bodyUnits) && (bodyUnits.every((unit2) => unit2.field === "metric") || bodyUnits.every(huggedField) && bodyUnits.some((unit2) => unit2.field === "metric"))) {
21625
+ cells.forEach((row2, index) => {
21626
+ const names2 = row2.filter((name) => name !== ".");
21123
21627
  if (rowSizes[index] !== "auto" && names2.length && names2.every((name) => {
21124
21628
  const units = unitsOf(name);
21125
- return units.length > 0 && units.every((unit2) => unit2.field === "metric");
21629
+ return units.length > 0 && units.every(huggedField) && (units.every((unit2) => unit2.field === "metric") || units.every((unit2) => unit2.field === "table"));
21126
21630
  })) rowSizes[index] = "auto";
21127
21631
  });
21128
21632
  }
@@ -21135,24 +21639,64 @@ function composeLayout(input, options = {}) {
21135
21639
  const ownRows = areaRects(cells), bodyName = (name) => regionOf.has(name);
21136
21640
  const stays = (name) => {
21137
21641
  const rect = ownRows.get(name);
21138
- return !!rect && rect.rowSpan === 1 && rowSizes[rect.row] === "auto" && cells[rect.row].every((cell) => cell === name || cell === ".") && cells.slice(rect.row + 1).some((row) => row.some(bodyName));
21642
+ return !!rect && rect.rowSpan === 1 && rowSizes[rect.row] === "auto" && cells[rect.row].every((cell) => cell === name || cell === ".") && cells.slice(rect.row + 1).some((row2) => row2.some(bodyName));
21139
21643
  };
21140
21644
  const collapsed = collapseAreas(cells, new Set([...empty2].filter((name) => !bodyName(name) || !stays(name))), (name) => name === "title" || name === "subtitle", (name) => name !== BELOW);
21141
21645
  const rects = areaRects(collapsed.grid), ownRects = areaRects(cells);
21142
- const spansOthers = (name, column) => cells.some((row) => row.some((cell, other) => other !== column && cell === name));
21646
+ const spansOthers = (name, column) => cells.some((row2) => row2.some((cell, other) => other !== column && cell === name));
21143
21647
  const headingOrBelow = (name) => name === "title" || name === "subtitle" || name === BELOW;
21144
- const vacated = plan2.columns.map((_, column) => cells.every((row) => {
21145
- const name = row[column];
21648
+ const vacated = plan2.columns.map((_, column) => cells.every((row2) => {
21649
+ const name = row2[column];
21146
21650
  return name === "." || empty2.has(name) && !headingOrBelow(name) || headingOrBelow(name) && spansOthers(name, column);
21147
21651
  }));
21148
- const filledColumns = plan2.columns.filter((_, column) => !vacated[column] && cells.some((row) => plan2.regions.some((region) => row[column] === region.name && unitsOf(region.name).length > 0))).length;
21652
+ const filledColumns = plan2.columns.filter((_, column) => !vacated[column] && cells.some((row2) => plan2.regions.some((region) => row2[column] === region.name && unitsOf(region.name).length > 0))).length;
21149
21653
  if (!ruleOn("empty-columns") || !filledColumns) vacated.fill(false);
21150
21654
  else if (filledColumns < 2) vacated.forEach((gone, column) => {
21151
- if (gone && cells.every((row) => row[column] === "." || !empty2.has(row[column]) || collapsed.joined.has(row[column]))) vacated[column] = false;
21655
+ if (gone && cells.every((row2) => row2[column] === "." || !empty2.has(row2[column]) || collapsed.joined.has(row2[column]))) vacated[column] = false;
21152
21656
  });
21153
21657
  if (vacated.some(Boolean)) fire("empty-columns");
21154
- const gaveWay = new Set(plan2.regions.filter((region) => cells.some((row) => row.includes(region.name)) && cells.every((row) => row.every((name, column) => name !== region.name || vacated[column]))).map((region) => region.name));
21155
- const keptWidths = columnWidths(plan2.columns.filter((_, column) => !vacated[column]), frame.width, gap2);
21658
+ const gaveWay = new Set(plan2.regions.filter((region) => cells.some((row2) => row2.includes(region.name)) && cells.every((row2) => row2.every((name, column) => name !== region.name || vacated[column]))).map((region) => region.name));
21659
+ const optionWeights = (() => {
21660
+ const kept = plan2.columns.filter((_, column) => !vacated[column]);
21661
+ if (hasCards || kept.length !== 2 || kept[0] !== kept[1] || !ruleOn("lead-stack")) return void 0;
21662
+ const columns2 = plan2.columns.flatMap((_, column) => vacated[column] ? [] : [column]);
21663
+ const row2 = cells.find((names2) => columns2.every((column) => plan2.regions.some((region) => region.name === names2[column] && region.role === "primary" && singleBlockRegion(region))) && names2[columns2[0]] !== names2[columns2[1]]);
21664
+ if (!row2) return void 0;
21665
+ const lengths = columns2.map((column) => {
21666
+ const units = unitsOf(row2[column]), unit2 = units[0];
21667
+ return units.length === 1 && unit2 && !unit2.children && unit2.caption === void 0 && ["text", "items", "bullets"].includes(unit2.field) ? [...contentText(unit2.field, unit2.value) ?? ""].length : 0;
21668
+ });
21669
+ if (lengths.some((length) => !length)) return void 0;
21670
+ const ratio2 = Math.max(...lengths) / Math.min(...lengths);
21671
+ if (ratio2 < LEAD_MEDIAN_RATIO) return void 0;
21672
+ const wide = Math.min(3, Math.sqrt(ratio2));
21673
+ return lengths.map((length) => length === Math.max(...lengths) ? wide : 1);
21674
+ })();
21675
+ let keptWidths = columnWidths(optionWeights ?? plan2.columns.filter((_, column) => !vacated[column]), frame.width, gap2);
21676
+ {
21677
+ const kept = plan2.columns.flatMap((_, column) => vacated[column] ? [] : [column]);
21678
+ const own3 = (name) => bodyName(name) && cells.every((row2) => row2.every((cell, column) => cell !== name || column === cells.find((other) => other.includes(name)).indexOf(name)));
21679
+ const columnUnits = kept.map((column) => {
21680
+ const names2 = [...new Set(cells.map((row2) => row2[column]))].filter((name) => name !== "." && !headingOrBelow(name) && !collapsed.joined.has(name));
21681
+ return names2.every(own3) ? names2.flatMap(unitsOf) : void 0;
21682
+ });
21683
+ const tables = columnUnits.flatMap((units, index) => units?.length === 1 && units[0].field === "table" && !units[0].children ? [index] : []);
21684
+ if (kept.length >= 2 && columnUnits.every(Boolean) && tables.length === 1 && columnUnits.every((units, index) => index === tables[0] || units.every((unit2) => !unit2.children && ["text", "items", "bullets"].includes(unit2.field)))) {
21685
+ const index = tables[0], table = columnUnits[index][0], total = keptWidths.reduce((sum, width2) => sum + width2, 0), inset2 = tableCardInset();
21686
+ const measured = measureTable(table, total, composition);
21687
+ if (measured && keptWidths[index] - inset2 < measured.minimumWidth - 0.5) {
21688
+ const want = Math.min(TABLE_MAX_SHARE * total, measured.naturalWidth + inset2), least = Math.min(want, measured.minimumWidth + inset2);
21689
+ const others = keptWidths.flatMap((_, other) => other === index ? [] : [other]);
21690
+ const widthsAt = (width2) => keptWidths.map((_, other) => other === index ? width2 : (total - width2) / others.length);
21691
+ const neighbors = (width2) => others.reduce((sum, other) => sum + columnUnits[other].reduce((cost, unit2) => cost + scoreNode(unit2, { x: 0, y: 0, width: widthsAt(width2)[other], height: frame.height }, composition), 0), 0);
21692
+ const baseline = neighbors(keptWidths[index]), step = (want - least) / 4;
21693
+ for (let width2 = want; width2 >= least - 0.5; width2 -= Math.max(step, scale2)) if (neighbors(width2) <= baseline + TABLE_NEIGHBOR_REDUCTION) {
21694
+ keptWidths = widthsAt(width2);
21695
+ break;
21696
+ }
21697
+ }
21698
+ }
21699
+ }
21156
21700
  const widths = plan2.columns.map((_, column) => vacated[column] ? 0 : keptWidths[vacated.slice(0, column).filter((gone) => !gone).length]);
21157
21701
  const columnX = [];
21158
21702
  widths.reduce((x, size, column) => {
@@ -21191,7 +21735,7 @@ function composeLayout(input, options = {}) {
21191
21735
  };
21192
21736
  const gridRowBoxes = (units, shape, cell, settings2, cards, anchor, lists, stretch = false) => {
21193
21737
  const { cells: cells2, gap: between } = flowCells(shape, cell, gap2, stretch);
21194
- return jointRowBoxes(units, cells2, shape.perRow.flatMap((count, row) => Array.from({ length: count }, () => row)), cell, between, settings2, cards, anchor, cards || !lists);
21738
+ return jointRowBoxes(units, cells2, shape.perRow.flatMap((count, row2) => Array.from({ length: count }, () => row2)), cell, between, settings2, cards, anchor, cards || !lists);
21195
21739
  };
21196
21740
  const stretchesLastRow = (units) => !units.every((unit2) => !unit2.children && (unit2.field === "image" || unit2.field === "video")) && !units.every((unit2) => personParts.has(unit2.path));
21197
21741
  const MOVED_SHARE = 0.3;
@@ -21215,8 +21759,8 @@ function composeLayout(input, options = {}) {
21215
21759
  const leadRows = (count, landscape) => [1, ...gridFlowShape(count - 1, landscape).perRow];
21216
21760
  const leadNeeds = (units, width2, cards, atFloor = false) => {
21217
21761
  const rows3 = leadRows(units.length, true);
21218
- return rows3.map((count, row) => {
21219
- const cellWidth = (width2 - gap2 * (count - 1)) / count, from = rows3.slice(0, row).reduce((sum, size) => sum + size, 0);
21762
+ return rows3.map((count, row2) => {
21763
+ const cellWidth = (width2 - gap2 * (count - 1)) / count, from = rows3.slice(0, row2).reduce((sum, size) => sum + size, 0);
21220
21764
  return Math.max(...units.slice(from, from + count).map((unit2) => naturalHeight(unit2, cellWidth, cards, void 0, composition, atFloor)));
21221
21765
  });
21222
21766
  };
@@ -21255,9 +21799,9 @@ function composeLayout(input, options = {}) {
21255
21799
  const heights2 = shareHeights(needs, floors, cell.height - between * (rows3.length - 1));
21256
21800
  const spare = Math.max(0, cell.height - heights2.reduce((sum, size) => sum + size, 0) - between * (rows3.length - 1));
21257
21801
  let y2 = cell.y + (region.anchor === "middle" ? spare / 2 : region.anchor === "bottom" ? spare : 0);
21258
- const boxes = rows3.flatMap((count, row) => {
21259
- const line2 = flowCells({ columns: count, rows: 1, perRow: [count] }, { x: cell.x, y: y2, width: cell.width, height: heights2[row] }, gap2).cells;
21260
- y2 += heights2[row] + between;
21802
+ const boxes = rows3.flatMap((count, row2) => {
21803
+ const line2 = flowCells({ columns: count, rows: 1, perRow: [count] }, { x: cell.x, y: y2, width: cell.width, height: heights2[row2] }, gap2).cells;
21804
+ y2 += heights2[row2] + between;
21261
21805
  return line2;
21262
21806
  });
21263
21807
  return { shape: { columns: Math.max(...rows3), rows: rows3.length, perRow: rows3 }, boxes };
@@ -21284,21 +21828,21 @@ function composeLayout(input, options = {}) {
21284
21828
  const cellWidth = (areaWidth - gap2 * (shape.columns - 1)) / shape.columns, cards = hasCards && !region.bleed;
21285
21829
  let total = 0, index = 0;
21286
21830
  for (const count of shape.perRow) {
21287
- let row = 0;
21831
+ let row2 = 0;
21288
21832
  for (let k = 0; k < count; k++) {
21289
21833
  const unit2 = units[index++];
21290
- row = Math.max(row, naturalHeight(unit2, cellWidth, cards, void 0, composition, atFloor, size === void 0 ? void 0 : Math.min(size, proseMeasure(unit2, cellWidth).size)));
21834
+ row2 = Math.max(row2, naturalHeight(unit2, cellWidth, cards, void 0, composition, atFloor, size === void 0 ? void 0 : Math.min(size, proseMeasure(unit2, cellWidth).size)));
21291
21835
  }
21292
- total += row;
21836
+ total += row2;
21293
21837
  }
21294
21838
  return total + gap2 * Math.max(0, shape.rows - 1);
21295
21839
  };
21296
21840
  const areaNeed = (name, rect, size) => name === "title" ? groupHeight(headingItemsAt(titleFields, 0, 0, spanWidth(rect))) : name === "subtitle" ? groupHeight(headingItemsAt(subtitleFields, 0, 0, spanWidth(rect))) : regionNeed(name, spanWidth(rect), false, size);
21297
- const demandsAt = (joint2, trial) => rowSizes.map((size, row) => {
21841
+ const demandsAt = (joint2, trial) => rowSizes.map((size, row2) => {
21298
21842
  let need = 0, floor = 0, heading = false, below = false;
21299
21843
  for (const [name, rect] of rects) {
21300
- const autoSpan = size === "auto" && rect.rowSpan > 1 && rect.row === row && rowSizes.slice(rect.row, rect.row + rect.rowSpan).every((entry) => entry === "auto");
21301
- if (size === "auto" ? rect.row !== row || rect.rowSpan !== 1 && !autoSpan : row < rect.row || row >= rect.row + rect.rowSpan) continue;
21844
+ const autoSpan = size === "auto" && rect.rowSpan > 1 && rect.row === row2 && rowSizes.slice(rect.row, rect.row + rect.rowSpan).every((entry) => entry === "auto");
21845
+ if (size === "auto" ? rect.row !== row2 || rect.rowSpan !== 1 && !autoSpan : row2 < rect.row || row2 >= rect.row + rect.rowSpan) continue;
21302
21846
  if (size !== "auto" && rect.rowSpan > 1 && rowSizes.slice(rect.row, rect.row + rect.rowSpan).some((entry) => entry === "auto")) continue;
21303
21847
  const value = areaNeed(name, rect, joint2?.has(name) ? trial : void 0) / (autoSpan ? 1 : rect.rowSpan);
21304
21848
  if (size === "auto" && name !== "title" && name !== "subtitle") floor = Math.max(floor, regionNeed(name, spanWidth(rect), true));
@@ -21331,8 +21875,8 @@ function composeLayout(input, options = {}) {
21331
21875
  }
21332
21876
  }
21333
21877
  const rowY = [];
21334
- heights.reduce((y2, size, row) => {
21335
- rowY.push(size > 0 || !heights.slice(0, row).some((above) => above > 0) ? y2 : y2 - gap2);
21878
+ heights.reduce((y2, size, row2) => {
21879
+ rowY.push(size > 0 || !heights.slice(0, row2).some((above) => above > 0) ? y2 : y2 - gap2);
21336
21880
  return size > 0 ? y2 + size + gap2 : y2;
21337
21881
  }, 0);
21338
21882
  const stackUsed = heights.reduce((sum, size) => sum + size, 0) + gap2 * Math.max(0, heights.filter((size) => size > 0).length - 1);
@@ -21502,10 +22046,11 @@ function composeLayout(input, options = {}) {
21502
22046
  if (overridden !== void 0) regionDirections.set(overridden, slideComposition.mode ?? "auto");
21503
22047
  const settings = { ...composition };
21504
22048
  const HUG_FILL = 0.45, UNEQUAL_PAYLOADS = 1.5, fillSpace = requestedTemplateGap * CARD_FILL_SPACE, underFilled = bodySteps > 0 || options[CENTER] === true;
21505
- const hugHeight = (units, cells2, estimate) => Math.min(estimate, Math.max(...units.map((unit2, index) => {
22049
+ const hugHeights = (units, cells2, estimate) => units.map((unit2, index) => {
21506
22050
  const frame2 = acceptedBox({ ...cells2[index], height: estimate }), inner = payloadBox(frame2, true);
21507
- return naturalHeight(unit2, inner.width, false, void 0, settings) + 2 * rasterPadding + scale2 + 2 * (inner.y - frame2.y);
21508
- })));
22051
+ return Math.min(estimate, naturalHeight(unit2, inner.width, false, void 0, settings) + 2 * rasterPadding + scale2 + 2 * (inner.y - frame2.y));
22052
+ });
22053
+ const hugHeight = (units, cells2, estimate) => Math.min(estimate, Math.max(...hugHeights(units, cells2, estimate)));
21509
22054
  const hugsContent = (unit2) => !unit2.children && unit2.caption === void 0 && ["text", "items", "bullets", "quote", "metric"].includes(unit2.field) && !metricTiles.has(unit2);
21510
22055
  const bodyOnly = (unit2) => !unit2.children && unit2.caption === void 0 && (unit2.field === "text" || (unit2.field === "items" || unit2.field === "bullets") && Array.isArray(unit2.value) && !unit2.value.some((entry) => !!entry && typeof entry === "object" && !Array.isArray(entry) && entry.description !== void 0));
21511
22056
  const cardRowRule = (units, cells2, anchor, references) => {
@@ -21515,27 +22060,44 @@ function composeLayout(input, options = {}) {
21515
22060
  const cellHeight2 = Math.min(...cells2.map((cell) => cell.height)), tallest2 = Math.max(...units.map((unit2, index) => naturalHeight(unit2, cells2[index].width, true, void 0, settings) + 2 * rasterPadding + scale2));
21516
22061
  return underFilled ? { mode: "hug", height: hugHeight(units, cells2, Math.min(cellHeight2, tallest2)) } : { mode: "top", height: Math.min(cellHeight2 - fillSpace, tallest2) };
21517
22062
  }
22063
+ const tileUnits = units.filter((unit2) => metricTiles.has(unit2));
22064
+ if (tileUnits.length > 1) {
22065
+ const feet = units.flatMap((unit2, index) => {
22066
+ if (!metricTiles.has(unit2)) return [];
22067
+ const full = acceptedBox({ ...cells2[index], y: cells2[index].y + fillSpace, height: Math.max(scale2, cells2[index].height - fillSpace) }), inner = payloadBox(full, true);
22068
+ const laid = measureMetric(unit2, inner, settings, false, void 0, true), tail = laid.parts.filter((part) => part.visible && part.fit && part.role !== "value" && part.role !== "label" && part.role !== "unit");
22069
+ return tail.length ? [inner.y + inner.height - Math.min(...tail.map((part) => part.box.y))] : [];
22070
+ });
22071
+ if (feet.length) for (const unit2 of tileUnits) tileFoots.set(unit2, Math.max(...feet));
22072
+ }
21518
22073
  if (!units.length || !units.every(hugsContent)) return void 0;
21519
22074
  const cellHeight = Math.min(...cells2.map((cell) => cell.height));
21520
22075
  const naturals = units.map((unit2, index) => naturalHeight(unit2, cells2[index].width, true, anchor === "top" ? void 0 : references?.[index], settings) + 2 * rasterPadding + scale2);
21521
22076
  const tallest = Math.max(...naturals);
21522
22077
  if (anchor === "top") return { mode: "hug", height: hugHeight(units, cells2, Math.min(cellHeight, tallest)) };
21523
- if (!units.every(bodyOnly)) return void 0;
22078
+ const labeled = (unit2) => !unit2.children && unit2.caption === void 0 && (unit2.field === "items" || unit2.field === "bullets");
22079
+ if (!units.every(bodyOnly)) return anchor === "middle" && units.every((unit2) => bodyOnly(unit2) || labeled(unit2)) ? { mode: "hug", height: hugHeight(units, cells2, Math.min(cellHeight, tallest)) } : void 0;
21524
22080
  const card = cellHeight - fillSpace;
21525
22081
  const text2 = Math.max(...units.map((unit2, index) => naturalHeight(unit2, cells2[index].width - 2 * Math.min(CARD_INSET * scale2, cells2[index].width / 4), false, void 0, settings)));
21526
- if (text2 < HUG_FILL * card || underFilled) return { mode: "hug", height: hugHeight(units, cells2, Math.min(cellHeight, tallest)) };
21527
- return tallest > UNEQUAL_PAYLOADS * Math.min(...naturals) ? { mode: "top", height: Math.min(card, tallest) } : void 0;
22082
+ if (text2 < HUG_FILL * card || underFilled) {
22083
+ const own3 = hugHeights(units, cells2, Math.min(cellHeight, tallest));
22084
+ return { mode: "hug", height: Math.min(cellHeight, tallest, Math.max(...own3)), own: own3 };
22085
+ }
22086
+ return anchor === "bottom" && tallest > UNEQUAL_PAYLOADS * Math.min(...naturals) ? { mode: "top", height: Math.min(card, tallest) } : void 0;
21528
22087
  };
21529
22088
  const placeCardRows = (rows3, area3, anchor) => {
21530
- const stack = rows3.length > 1 && rows3.every((row) => row.rule?.mode === "hug");
21531
- const total = rows3.reduce((sum, row) => sum + (row.rule?.height ?? 0), 0) + gap2 * (rows3.length - 1);
22089
+ const stack = rows3.length > 1 && rows3.every((row2) => row2.rule?.mode === "hug");
22090
+ const total = rows3.reduce((sum, row2) => sum + (row2.rule?.height ?? 0), 0) + gap2 * (rows3.length - 1);
21532
22091
  let y2 = area3.y + (anchor === "top" ? Math.max(0, Math.min(fillSpace, area3.height - total)) : Math.max(0, (area3.height - total) / 2));
21533
22092
  return rows3.map(({ cells: cells2, rule }) => {
21534
22093
  if (!rule) return void 0;
21535
22094
  const cell = cells2[0], height2 = rule.height;
21536
22095
  const top = stack ? y2 : rule.mode === "top" ? cell.y + fillSpace : cell.y + (anchor === "top" ? Math.max(0, Math.min(fillSpace, cell.height - height2)) : Math.max(0, (cell.height - height2) / 2));
21537
22096
  y2 += height2 + gap2;
21538
- return cells2.map((entry) => ({ box: { x: entry.x, y: top, width: entry.width, height: height2 }, ...rule.mode === "top" ? { frame: entry } : {} }));
22097
+ return cells2.map((entry, index) => {
22098
+ const own3 = rule.own?.[index], shift = own3 !== void 0 && own3 < height2 - scale2 ? (height2 - own3) / 2 : 0;
22099
+ return { box: { x: entry.x, y: top, width: entry.width, height: height2 }, ...rule.mode === "top" ? { frame: entry } : {}, ...shift ? { shift } : {} };
22100
+ });
21539
22101
  });
21540
22102
  };
21541
22103
  const placeRegion = (region, units, area3, lone) => {
@@ -21553,6 +22115,7 @@ function composeLayout(input, options = {}) {
21553
22115
  const first = items.length;
21554
22116
  placeNode(units[0], filled, settings, cards, listColumnsOf(region), void 0, region.anchor);
21555
22117
  leafItems.push(...range(first, items.length));
22118
+ if (columnTexts.has(units[0])) centeredCardText.push(...range(first, items.length));
21556
22119
  return arrangementOf(region, units, cell);
21557
22120
  }
21558
22121
  const bands2 = timelineBands(units), bandColumnCount = bands2 ? bandColumns(units, cell, cards) : 1;
@@ -21571,7 +22134,7 @@ function composeLayout(input, options = {}) {
21571
22134
  let cellBoxes = boxes;
21572
22135
  const stacked = !bands2 && arrangement === "column" && !(units.length === 1 && region.anchor === "top");
21573
22136
  const longRows = stacked && cards && units.length > 1 && units.every(longTextUnit);
21574
- if (stacked) boxes = longRows ? longTextRowBoxes(units, cell, settings, gap2) : stackedBoxes(units, cell, gap2, settings, cards, region.anchor);
22137
+ if (stacked) boxes = longRows ? longTextRowBoxes(units, cell, settings, gap2) : stackedBoxes(units, cell, gap2, settings, cards || units.length === 1 && besideQuote(units[0]), region.anchor);
21575
22138
  if (!bands2 && !lead && (arrangement === "grid" || arrangement === "row") && region.anchor !== "top") {
21576
22139
  const naturals = boxes.map((box, index) => {
21577
22140
  const unit2 = units[index];
@@ -21587,13 +22150,13 @@ function composeLayout(input, options = {}) {
21587
22150
  }
21588
22151
  const planned = lone ? [lone] : [];
21589
22152
  if (!lone && cards && !bands2 && !lead && (arrangement === "grid" || arrangement === "row")) {
21590
- const rows3 = shape.perRow.map((count, row) => range(0, count).map((offset) => shape.perRow.slice(0, row).reduce((sum, size) => sum + size, 0) + offset));
22153
+ const rows3 = shape.perRow.map((count, row2) => range(0, count).map((offset) => shape.perRow.slice(0, row2).reduce((sum, size) => sum + size, 0) + offset));
21591
22154
  const placed2 = placeCardRows(rows3.map((indexes) => {
21592
22155
  const cells2 = indexes.map((index) => cellBoxes[index]);
21593
22156
  return { cells: cells2, rule: cardRowRule(indexes.map((index) => units[index]), cells2, region.anchor, indexes.map((index) => referenceHeights[index])) };
21594
22157
  }), cell, region.anchor);
21595
- rows3.forEach((indexes, row) => {
21596
- placed2[row]?.forEach((placement, offset) => {
22158
+ rows3.forEach((indexes, row2) => {
22159
+ placed2[row2]?.forEach((placement, offset) => {
21597
22160
  planned[indexes[offset]] = placement;
21598
22161
  });
21599
22162
  });
@@ -21607,14 +22170,35 @@ function composeLayout(input, options = {}) {
21607
22170
  frames = frames.map((frame2) => frame2 && mirrored([frame2])[0]);
21608
22171
  }
21609
22172
  const stack = [];
22173
+ reserveCaptions(units, boxes, cards);
22174
+ const wordmark = region.role === "media" && region.accepts.includes("image") && options[LAYOUT_MASTER] !== true && options.fill !== false ? (() => {
22175
+ const aspect = units.flatMap((unit2) => !unit2.children && unit2.field === "image" ? [intrinsicImageAspect(unit2.host?.image, assets)] : []).find((value) => value !== void 0) ?? WORDMARK_ASPECT;
22176
+ return (unit2, box) => {
22177
+ if (unit2.children || unit2.field !== "text" || unit2.caption !== void 0) return void 0;
22178
+ const height2 = Math.min(box.height, box.width / aspect);
22179
+ return roundBox5({ ...box, y: box.y + anchoredOffset(box.height - height2, region.anchor), height: height2 });
22180
+ };
22181
+ })() : void 0;
21610
22182
  units.forEach((unit2, index) => {
21611
22183
  const first = items.length;
21612
- placeNode(unit2, boxes[index], settings, cards, listGrid ? 1 : listColumnsOf(region), region.anchor === "top" || stacked || planned[index] ? void 0 : referenceHeights[index], region.anchor, !cards || bands2 ? void 0 : planned[index] ? frames[index] : !stacked ? cellBoxes[index] : units.length === 1 ? cell : void 0);
22184
+ const tile = wordmark?.(unit2, cellBoxes[index] ?? boxes[index]);
22185
+ const drop = gap2 * CARD_FILL_SPACE;
22186
+ if (tile) {
22187
+ wordmarks.add(unit2);
22188
+ placeNode(unit2, tile, settings, true, void 0, void 0, "middle", { ...tile, y: tile.y - drop, height: tile.height + drop });
22189
+ } else placeNode(unit2, boxes[index], settings, cards, listGrid ? 1 : listColumnsOf(region), region.anchor === "top" || stacked || planned[index] ? void 0 : referenceHeights[index], region.anchor, !cards || bands2 ? void 0 : planned[index] ? frames[index] : !stacked ? cellBoxes[index] : units.length === 1 ? cell : void 0);
22190
+ const shift = tile ? void 0 : planned[index]?.shift;
22191
+ if (shift) {
22192
+ for (const item of items.slice(first)) if (item.text && (item.field === "text" || item.field === "items" || item.field === "bullets")) {
22193
+ item.box = { ...item.box, y: item.box.y + shift, height: Math.max(scale2, item.box.height - shift) };
22194
+ item.text = "listEntries" in item.text ? translateListFit(item.text, shift) : translateTextFit(item.text, shift);
22195
+ }
22196
+ }
21613
22197
  if (!unit2.children) {
21614
22198
  leafItems.push(...range(first, items.length));
21615
22199
  stack.push(...range(first, items.length));
21616
22200
  }
21617
- if (longRows) centeredCardText.push(...range(first, items.length));
22201
+ if (longRows || tile) centeredCardText.push(...range(first, items.length));
21618
22202
  });
21619
22203
  if (stack.length > 1) peerSets.push(stack);
21620
22204
  return arrangement;
@@ -21629,6 +22213,10 @@ function composeLayout(input, options = {}) {
21629
22213
  if (options[CENTER] === true && plan2.stack === void 0) for (const region of plan2.regions) {
21630
22214
  const units = unitsOf(region.name), rect = rects.get(region.name);
21631
22215
  if (!units.length || !rect || region.bleed) continue;
22216
+ if (ruleOn("metric-tiles") && region.metrics === "tile" && units.some((unit2) => metricTiles.has(unit2))) {
22217
+ centerNeeds.set(`${rect.row}:${rect.rowSpan}`, Infinity);
22218
+ continue;
22219
+ }
21632
22220
  const key = `${rect.row}:${rect.rowSpan}`, need = regionNeed(region.name, spanWidth(rect)) + units.length * (2 * rasterPadding + scale2 + (hasCards ? gap2 * CARD_FILL_SPACE : 0));
21633
22221
  centerNeeds.set(key, Math.max(centerNeeds.get(key) ?? 0, need));
21634
22222
  }
@@ -21645,10 +22233,10 @@ function composeLayout(input, options = {}) {
21645
22233
  const key = `${rect.row}:${rect.rowSpan}:${region.anchor}`, area3 = regionCell(rect);
21646
22234
  loneRows.set(key, [...loneRows.get(key) ?? [], { name: region.name, unit: units[0], cell: { ...area3, width: Math.max(scale2, area3.width), height: Math.max(scale2, area3.height) }, anchor: region.anchor }]);
21647
22235
  }
21648
- for (const row of loneRows.values()) {
21649
- const cells2 = row.map((entry) => entry.cell), anchor = row[0].anchor;
21650
- placeCardRows([{ cells: cells2, rule: cardRowRule(row.map((entry) => entry.unit), cells2, anchor) }], cells2[0], anchor)[0]?.forEach((placement, index) => {
21651
- loneCards.set(row[index].name, placement);
22236
+ for (const row2 of loneRows.values()) {
22237
+ const cells2 = row2.map((entry) => entry.cell), anchor = row2[0].anchor;
22238
+ placeCardRows([{ cells: cells2, rule: cardRowRule(row2.map((entry) => entry.unit), cells2, anchor) }], cells2[0], anchor)[0]?.forEach((placement, index) => {
22239
+ loneCards.set(row2[index].name, placement);
21652
22240
  });
21653
22241
  }
21654
22242
  }
@@ -21658,10 +22246,13 @@ function composeLayout(input, options = {}) {
21658
22246
  let cell = rect && !region.bleed ? regionDiagram(region) ? physical(logical(rect)) : regionCell(rect) : physical(logical(rect ?? ownRects.get(region.name)));
21659
22247
  if (rect && !region.bleed && stepProcesses.has(region.name)) stepProcessCells.set(region.name, roundBox5(physical(logical(rect))));
21660
22248
  const areaBox = region.bleed && rect ? roundBox5(cell) : void 0;
21661
- if (region.bleed && rect && cell.width > 0) cell = bleed(cell);
22249
+ const lone = units.length === 1 && !units[0].children && units[0].field === "image" ? units[0] : void 0;
22250
+ const whole = !!(region.bleed && rect && cell.width > 0 && lone && (lone.caption !== void 0 || intrinsicImageAspect(lone.host?.image, assets) !== void 0 && composeImage(lone.host ?? {}, lone.hostPath ?? lone.path, bleed(cell), bleed(cell), { ...imageContext(void 0, "middle"), diagnostics: [], callout: void 0 }).fit !== "cover"));
22251
+ if (region.bleed && rect && cell.width > 0 && !whole) cell = bleed(cell);
22252
+ if (whole) wholePictures.add(lone);
21662
22253
  else if (rect && loneUnit && units[0] === loneUnit && plan2.regions.every((other) => other === region || empty2.has(other.name))) cell = { ...cell, height: Math.max(cell.height, frame.y + frame.height - cell.y) };
21663
22254
  leafItems = [];
21664
- const arrangement = units.length && rect ? placeRegion(region, units, cell, loneCards.get(region.name)) : void 0;
22255
+ const arrangement = units.length && rect ? placeRegion(whole ? { ...region, anchor: "middle" } : region, units, cell, loneCards.get(region.name)) : void 0;
21665
22256
  if (arrangement && rect) {
21666
22257
  const band = `${rect.row}:${rect.rowSpan}:${region.role}`;
21667
22258
  bands.set(band, [...bands.get(band) ?? [], leafItems]);
@@ -21715,8 +22306,8 @@ function composeLayout(input, options = {}) {
21715
22306
  return [band ? Math.min(top, (drawn.length ? Math.min(...drawn) : item.box.y) - band) : top, Math.max(...boxes.map((box) => box.y + box.height))];
21716
22307
  };
21717
22308
  const rowOf = (item) => rows3.indexOf(round9(item.box.y));
21718
- const spans = rows3.map((_, row) => body.filter(({ item }) => rowOf(item) === row).map(({ item }) => extent2(item, item.metricLayout)));
21719
- const tops = spans.map((span) => Math.min(...span.map(([top]) => top))), heights = spans.map((span, row) => Math.max(...span.map(([, bottom]) => bottom)) - tops[row]);
22309
+ const spans = rows3.map((_, row2) => body.filter(({ item }) => rowOf(item) === row2).map(({ item }) => extent2(item, item.metricLayout)));
22310
+ const tops = spans.map((span) => Math.min(...span.map(([top]) => top))), heights = spans.map((span, row2) => Math.max(...span.map(([, bottom]) => bottom)) - tops[row2]);
21720
22311
  const areaTop = Math.min(rows3[0], tops[0]), areaBottom = Math.max(...body.map(({ item }) => item.box.y + item.box.height));
21721
22312
  const free = areaBottom - areaTop - heights.reduce((sum, height2) => sum + height2, 0);
21722
22313
  if (free <= 0) return;
@@ -21728,7 +22319,7 @@ function composeLayout(input, options = {}) {
21728
22319
  const moved = body.map(({ item, index }) => {
21729
22320
  const layout2 = item.metricLayout, dy = targets[rowOf(item)] - tops[rowOf(item)];
21730
22321
  if (Math.abs(dy) < 0.5 && rowOf(item) + 1 === rows3.length) return { item, layout: layout2, box: item.box };
21731
- const row = rowOf(item), bottom = row + 1 < rows3.length ? targets[row + 1] - space / 2 : areaBottom;
22322
+ const row2 = rowOf(item), bottom = row2 + 1 < rows3.length ? targets[row2 + 1] - space / 2 : areaBottom;
21732
22323
  const box = acceptedBox({ ...item.box, y: item.box.y + dy, height: Math.min(item.box.height, bottom - item.box.y - dy) });
21733
22324
  const roleSizes = Object.fromEntries(layout2.parts.filter((part) => part.fit).map((part) => [part.role, part.fit.fontSize]));
21734
22325
  return { item, layout: metricMoves.get(index)(box, roleSizes, layout2.deltaPill?.placement === "above" ? "above" : void 0), box };
@@ -21879,17 +22470,17 @@ function composeLayout(input, options = {}) {
21879
22470
  const cellOf2 = (index) => items[index].frameBox ?? items[index].box;
21880
22471
  const rows3 = [];
21881
22472
  for (const index of members) {
21882
- const cell = cellOf2(index), row = rows3.find((list) => list.some((other) => {
22473
+ const cell = cellOf2(index), row2 = rows3.find((list) => list.some((other) => {
21883
22474
  const peer = cellOf2(other);
21884
22475
  return Math.max(cell.y, peer.y) < Math.min(cell.y + cell.height, peer.y + peer.height) - 1e-6;
21885
22476
  }));
21886
- if (row) row.push(index);
22477
+ if (row2) row2.push(index);
21887
22478
  else rows3.push([index]);
21888
22479
  }
21889
- for (const row of rows3) {
21890
- if (row.length < 2) continue;
21891
- const size2 = Math.min(...row.map((index) => bodyOf(items[index].quoteLayout)?.fontSize ?? Infinity));
21892
- for (const index of row) {
22480
+ for (const row2 of rows3) {
22481
+ if (row2.length < 2) continue;
22482
+ const size2 = Math.min(...row2.map((index) => bodyOf(items[index].quoteLayout)?.fontSize ?? Infinity));
22483
+ for (const index of row2) {
21893
22484
  const item = items[index];
21894
22485
  if ((bodyOf(item.quoteLayout)?.fontSize ?? 0) <= size2 + 1e-9) continue;
21895
22486
  const refit = quoteRefits.get(index)(size2), body = bodyOf(refit);
@@ -21973,15 +22564,15 @@ function composeLayout(input, options = {}) {
21973
22564
  for (let from = 0; from < heads.length; ) {
21974
22565
  let to = from + 1;
21975
22566
  while (to < heads.length && Math.abs(entryOf(heads[to]).textBox.y - entryOf(heads[from]).textBox.y) <= 1) to++;
21976
- const row = heads.slice(from, to).sort((a, b) => a.box.x - b.box.x);
22567
+ const row2 = heads.slice(from, to).sort((a, b) => a.box.x - b.box.x);
21977
22568
  from = to;
21978
- const one = (pick2) => Math.max(...row.map((item) => pick2(entryOf(item)))) - Math.min(...row.map((item) => pick2(entryOf(item)))) <= 0.5;
21979
- if (row.length < 2 || !one((entry) => entry.text.fontSize) || !one((entry) => entry.description.fontSize) || row.some((item, index) => index && item.box.x < row[index - 1].box.x + row[index - 1].box.width - 1e-6)) continue;
21980
- const track = Math.max(...row.map((item) => entryOf(item).textBox.height)), moves = row.map((item) => track - entryOf(item).textBox.height);
22569
+ const one = (pick2) => Math.max(...row2.map((item) => pick2(entryOf(item)))) - Math.min(...row2.map((item) => pick2(entryOf(item)))) <= 0.5;
22570
+ if (row2.length < 2 || !one((entry) => entry.text.fontSize) || !one((entry) => entry.description.fontSize) || row2.some((item, index) => index && item.box.x < row2[index - 1].box.x + row2[index - 1].box.width - 1e-6)) continue;
22571
+ const track = Math.max(...row2.map((item) => entryOf(item).textBox.height)), moves = row2.map((item) => track - entryOf(item).textBox.height);
21981
22572
  if (!moves.some((move) => move > 0.5)) continue;
21982
22573
  const room = (item) => Math.max(item.box.y + item.box.height, item.frameBox ? item.frameBox.y + item.frameBox.height - cardInsetOf(item.frameBox.width, true) : -Infinity);
21983
- if (row.some((item, index) => entryOf(item).textBox.y + item.text.height + moves[index] > room(item) + 0.01)) continue;
21984
- row.forEach((item, index) => {
22574
+ if (row2.some((item, index) => entryOf(item).textBox.y + item.text.height + moves[index] > room(item) + 0.01)) continue;
22575
+ row2.forEach((item, index) => {
21985
22576
  const fit = item.text, entry = entryOf(item), move = moves[index];
21986
22577
  if (move <= 0.01) return;
21987
22578
  item.text = { ...fit, height: fit.height + move, listEntries: [{ ...entry, descriptionBox: { ...entry.descriptionBox, y: entry.descriptionBox.y + move } }] };
@@ -22011,20 +22602,20 @@ function composeLayout(input, options = {}) {
22011
22602
  }
22012
22603
  const rows3 = /* @__PURE__ */ new Map();
22013
22604
  for (const pair of pairs) rows3.set(pair.container, [...rows3.get(pair.container) ?? [], pair]);
22014
- for (const row of rows3.values()) {
22015
- if (row.length < 2 || row.length > 6) continue;
22016
- row.sort((a, b) => outer(a.head).x - outer(b.head).x);
22605
+ for (const row2 of rows3.values()) {
22606
+ if (row2.length < 2 || row2.length > 6) continue;
22607
+ row2.sort((a, b) => outer(a.head).x - outer(b.head).x);
22017
22608
  const span = (pair) => ({ x: Math.min(outer(pair.head).x, outer(pair.body).x), right: Math.max(outer(pair.head).x + outer(pair.head).width, outer(pair.body).x + outer(pair.body).width), top: outer(pair.head).y, bottom: outer(pair.body).y + outer(pair.body).height });
22018
- if (row.some((pair, index) => index && span(pair).x < span(row[index - 1]).right - 1e-6) || row.some((pair) => span(pair).top > span(row[0]).bottom || span(pair).bottom < span(row[0]).top)) continue;
22019
- const top = Math.min(...row.map((pair) => outer(pair.head).y)), track = Math.max(...row.map((pair) => outer(pair.head).height));
22020
- const between = Math.max(...row.map((pair) => outer(pair.body).y - outer(pair.head).y - outer(pair.head).height)), bodyTop = top + track + between;
22609
+ if (row2.some((pair, index) => index && span(pair).x < span(row2[index - 1]).right - 1e-6) || row2.some((pair) => span(pair).top > span(row2[0]).bottom || span(pair).bottom < span(row2[0]).top)) continue;
22610
+ const top = Math.min(...row2.map((pair) => outer(pair.head).y)), track = Math.max(...row2.map((pair) => outer(pair.head).height));
22611
+ const between = Math.max(...row2.map((pair) => outer(pair.body).y - outer(pair.head).y - outer(pair.head).height)), bodyTop = top + track + between;
22021
22612
  const need = (pair) => {
22022
22613
  const card = outer(pair.body), inset2 = pair.body.box.y - card.y, below = card.y + card.height - pair.body.box.y - pair.body.box.height;
22023
22614
  return bodyTop + inset2 + textHeight(pair.body) + below;
22024
22615
  };
22025
- const bottom = Math.max(...row.map((pair) => Math.max(outer(pair.body).y + outer(pair.body).height, need(pair))));
22616
+ const bottom = Math.max(...row2.map((pair) => Math.max(outer(pair.body).y + outer(pair.body).height, need(pair))));
22026
22617
  if (bottom > contentBox.y + contentBox.height + 0.5 || top < contentBox.y - 0.5) continue;
22027
- const settledRow = row.every((pair) => Math.abs(outer(pair.head).y - top) <= 0.5 && Math.abs(outer(pair.head).height - track) <= 0.5 && Math.abs(outer(pair.body).y - bodyTop) <= 0.5 && Math.abs(outer(pair.body).y + outer(pair.body).height - bottom) <= 0.5);
22618
+ const settledRow = row2.every((pair) => Math.abs(outer(pair.head).y - top) <= 0.5 && Math.abs(outer(pair.head).height - track) <= 0.5 && Math.abs(outer(pair.body).y - bodyTop) <= 0.5 && Math.abs(outer(pair.body).y + outer(pair.body).height - bottom) <= 0.5);
22028
22619
  if (settledRow) continue;
22029
22620
  const move = (item, dy, height2) => {
22030
22621
  const card = outer(item), grow = height2 - card.height;
@@ -22033,7 +22624,7 @@ function composeLayout(input, options = {}) {
22033
22624
  const fit = item.text;
22034
22625
  item.text = "listEntries" in fit ? translateListFit(fit, dy) : translateTextFit(fit, dy);
22035
22626
  };
22036
- for (const pair of row) {
22627
+ for (const pair of row2) {
22037
22628
  move(pair.head, top - outer(pair.head).y, track);
22038
22629
  move(pair.body, bodyTop - outer(pair.body).y, bottom - bodyTop);
22039
22630
  }
@@ -22077,6 +22668,7 @@ function composeLayout(input, options = {}) {
22077
22668
  } else if (chartSplit) {
22078
22669
  const primary = pending[chartIndex], rest = pending.filter((_, index) => index !== chartIndex);
22079
22670
  const support = { field: "blocks", type: "group", value: rest.map((node) => node.payload), path, payload: {}, children: rest, composition: chartTrack.mode ? { mode: chartTrack.mode } : ownMode ? { mode: ownMode } : {}, synthetic: true };
22671
+ if (!chartTrack.mode) centeredColumns.add(rest);
22080
22672
  arrange(firstChart ? [primary, support] : [support, primary], contentBox, rootSettings, 0);
22081
22673
  } else {
22082
22674
  const grouped = groupRoot(pending), roots = grouped?.nodes ?? pending;
@@ -22086,6 +22678,10 @@ function composeLayout(input, options = {}) {
22086
22678
  const chart = roots.findIndex((node) => !node.children && node.field === "chart"), text2 = chart >= 0 ? textBesideChart(roots[1 - chart]) : void 0;
22087
22679
  if (text2) text2.fills = true;
22088
22680
  }
22681
+ if (!regions.length && roots.length === 2 && (rootSettings.mode === "row" || rootSettings.mode === "column")) {
22682
+ const chart = roots.findIndex((node) => !node.children && node.field === "chart"), other = chart >= 0 ? roots[1 - chart] : void 0;
22683
+ if (other?.children && !other.synthetic && other.children.every((child) => !child.children && child.field !== "chart")) centeredColumns.add(other.children);
22684
+ }
22089
22685
  if (grouped?.settings) arrange(grouped.nodes, contentBox, grouped.settings, 0, gap);
22090
22686
  else arrange(grouped?.nodes ?? pending, contentBox, rootSettings, 0);
22091
22687
  }
@@ -22113,6 +22709,19 @@ function composeLayout(input, options = {}) {
22113
22709
  item.box = box;
22114
22710
  item.text = fitPlacedText("text", item.value, contentText("text", item.value), box, item.text.fontSize, item.text.fontSize, item.path, "center");
22115
22711
  }
22712
+ if (autoSurface && !noteBand && autoSurface.emphasis.shape === "band" && autoSurface.emphasis.source === "foot-band") {
22713
+ const body = items.filter((item) => !headings.has(item.field) && !item.eyebrow);
22714
+ const bottom = Math.max(...body.map((item) => item.frameBox ? item.frameBox.y + item.frameBox.height : item.box.y + item.box.height));
22715
+ const surfaceBox = autoSurface.emphasis.box, dy = round9(bottom + gap) - surfaceBox.y;
22716
+ if (body.length && body.some((item) => item.field === "code") && Number.isFinite(bottom) && dy < -gap) {
22717
+ const item = autoSurface.item;
22718
+ autoSurface.emphasis.box = { ...surfaceBox, y: surfaceBox.y + dy };
22719
+ item.box = { ...item.box, y: item.box.y + dy };
22720
+ if (item.text) item.text = translateTextFit(item.text, dy);
22721
+ const limit = surfaceBox.y + dy - gap / 2;
22722
+ for (const region of templateRegions) if (region.box.y < limit && region.box.y + region.box.height > limit) region.box = roundBox5({ ...region.box, height: limit - region.box.y });
22723
+ }
22724
+ }
22116
22725
  if (autoSurface) items.push(autoSurface.item);
22117
22726
  if (pullItem && placePull) {
22118
22727
  const pulled = pullItem, own3 = /* @__PURE__ */ new Set([pulled.path, autoSurface?.item.path]), placedPaths = new Set(placed.map((entry) => `${entry.hostPath}.image`));
@@ -22124,7 +22733,7 @@ function composeLayout(input, options = {}) {
22124
22733
  if (internal?.bounds) return [internal.bounds.y, internal.bounds.y + internal.bounds.height];
22125
22734
  if (item.field === "table") {
22126
22735
  try {
22127
- const rows3 = layoutTable(item.value, item.box, { scale: scale2, minFontSize: item.composition.minFontSize, fontFamily: options.fontFamilies?.body, ...options.fontFamilies?.code ? { codeFontFamily: options.fontFamilies.code } : {}, textMeasurement: options.textMeasurement, presentation: options.presentation, ...numberLanguage(options), ...item.tableGrowth ? { growth: item.tableGrowth } : {} }).rows.flatMap((row) => row.cells.map((cell) => cell.box));
22736
+ const rows3 = layoutTable(item.value, item.box, { scale: scale2, minFontSize: item.composition.minFontSize, fontFamily: options.fontFamilies?.body, ...options.fontFamilies?.code ? { codeFontFamily: options.fontFamilies.code } : {}, textMeasurement: options.textMeasurement, presentation: options.presentation, ...numberLanguage(options), ...item.tableGrowth ? { growth: item.tableGrowth } : {} }).rows.flatMap((row2) => row2.cells.map((cell) => cell.box));
22128
22737
  if (rows3.length) return [Math.min(...rows3.map((box2) => box2.y)), Math.max(...rows3.map((box2) => box2.y + box2.height))];
22129
22738
  } catch {
22130
22739
  }
@@ -22144,6 +22753,31 @@ function composeLayout(input, options = {}) {
22144
22753
  if (items.includes(pulled)) items[items.indexOf(pulled)] = moved;
22145
22754
  pullItem = moved;
22146
22755
  }
22756
+ if (!useTemplate && pullSpan && layPull && options[PULL_DROP] === void 0) {
22757
+ const span = pullSpan.bottom - pullSpan.top, data = bottom - top, sizeOf = (laid) => laid.parts.find((part) => part.role === "body")?.fit?.fontSize ?? 0;
22758
+ const linesOf = (laid) => {
22759
+ const fit = laid.parts.find((part) => part.role === "body")?.fit;
22760
+ return fit ? "richLines" in fit ? fit.richLines.length : fit.lines.length : Infinity;
22761
+ };
22762
+ let size = LEAD_NOMINAL_SIZE, height2 = pullItem.box.height, drawn = pullItem.text?.fontSize ?? 0;
22763
+ for (let step = 1; LEAD_NOMINAL_SIZE * TYPE_SCALE_RATIO ** step <= LONE_DISPLAY_SIZES.quote + 1e-6; step++) {
22764
+ const start = LEAD_NOMINAL_SIZE * TYPE_SCALE_RATIO ** step, laid = layPull(0, span, start), need = round9(laid.bounds.height);
22765
+ if (laid.overflow || linesOf(laid) > QUOTE_PULL_LINES || sizeOf(laid) < drawn + FONT_GRID_EPSILON || data + gap + need > PULL_GROWN_TARGET * span) continue;
22766
+ size = start;
22767
+ height2 = need;
22768
+ drawn = sizeOf(laid);
22769
+ }
22770
+ const stackTop = Math.min(top, pullItem.box.y), drop = pullSpan.top + (span - (data + gap + height2)) / 2 - stackTop;
22771
+ if (drop > scale2 || size !== LEAD_NOMINAL_SIZE) return composeLayout(input, { ...options, [PULL_DROP]: { drop: round9(Math.max(0, drop)), size } });
22772
+ }
22773
+ if (pullSpan && options[PULL_DROP] !== void 0) {
22774
+ const foot = pullSpan.bottom, clip = (box) => box.y + box.height > foot ? { ...box, height: Math.max(scale2, foot - box.y) } : box;
22775
+ for (const item of body) {
22776
+ item.box = clip(item.box);
22777
+ if (item.frameBox) item.frameBox = clip(item.frameBox);
22778
+ }
22779
+ contentBox.height = clip(contentBox).height;
22780
+ }
22147
22781
  }
22148
22782
  }
22149
22783
  if (pullItem && pullQuote?.position === "foot") items.push(pullItem);
@@ -22167,19 +22801,20 @@ function composeLayout(input, options = {}) {
22167
22801
  const highlight = table.highlight !== void 0 ? tableHighlightRows(table.highlight, resolved2.rows) : tableSlideFocus(
22168
22802
  item.value,
22169
22803
  resolved2.rows,
22170
- resolved2.rows.map((row) => row.map((cell, column) => tableKeyText(tableCellDisplayValue(cell, resolved2.formats[column])))),
22804
+ resolved2.rows.map((row2) => row2.map((cell, column) => tableKeyText(tableCellDisplayValue(cell, resolved2.formats[column])))),
22171
22805
  { sources: focusSources(), ...language !== void 0 ? { language } : {} }
22172
22806
  );
22173
22807
  if (highlight?.length) item.tableHighlight = highlight;
22174
22808
  }
22175
22809
  const rounded = (box) => ({ x: round9(box.x), y: round9(box.y), width: round9(box.width), height: round9(box.height) });
22810
+ const rowAligned = [];
22176
22811
  for (const chart of items) {
22177
22812
  if (chart.field !== "chart" || !chart.chart?.layer || chart.chart.layer.rows) continue;
22178
22813
  const data = resolveChartData(chart.value, options.presentation);
22179
22814
  if (!data.ok || data.combo || data.hasX) continue;
22180
22815
  const plan2 = chartDrawPlan(chart.value, data, { language: deckLanguage() });
22181
22816
  if (plan2.fallback || !horizontalBarType(plan2.type)) continue;
22182
- const categories = data.rows.map((row) => row[0] === null || row[0] === void 0 ? "" : String(row[0]));
22817
+ const categories = data.rows.map((row2) => row2[0] === null || row2[0] === void 0 ? "" : String(row2[0]));
22183
22818
  for (const table of items) {
22184
22819
  if (table.field !== "table" || !besideEachOther(chart.box, table.box)) continue;
22185
22820
  const resolved2 = resolveTableData(table.value, options.presentation);
@@ -22190,21 +22825,125 @@ function composeLayout(input, options = {}) {
22190
22825
  } catch {
22191
22826
  continue;
22192
22827
  }
22193
- const body = layout2.rows.filter((row) => !row.cells.some((cell) => cell.header));
22194
- if (body.some((row) => row.cells.some((cell) => cell.rowSpan > 1))) continue;
22828
+ const body = layout2.rows.filter((row2) => !row2.cells.some((cell) => cell.header));
22829
+ if (body.some((row2) => row2.cells.some((cell) => cell.rowSpan > 1))) continue;
22195
22830
  const layer = chart.chart.layer, authored = record19(chart.value);
22196
- const centers = body.map((row) => {
22197
- const key = row.cells.find((cell) => cell.column === 0) ?? row.cells[0];
22831
+ const centers = body.map((row2) => {
22832
+ const key = row2.cells.find((cell) => cell.column === 0) ?? row2.cells[0];
22198
22833
  const fit = key.fit;
22199
22834
  return key.textBox.y + ("height" in fit ? fit.height : fit.lines.length * fit.lineHeight) / 2;
22200
22835
  });
22201
- const rows3 = alignBarRows(data, rounded(chart.box), body.map((row) => row.box), centers, { scale: scale2, minFontSize: chart.composition.minFontSize, header: (layer.stack?.legend ?? layer.header)?.height ?? 0, hiddenAxis: layer.small?.valueAxis === false, labels: Boolean(layer.small?.labels || authored.dataLabels !== void 0 && authored.dataLabels !== false), measure: chartMeasure });
22836
+ const rows3 = alignBarRows(data, rounded(chart.box), body.map((row2) => row2.box), centers, { scale: scale2, minFontSize: chart.composition.minFontSize, header: (layer.stack?.legend ?? layer.header)?.height ?? 0, hiddenAxis: layer.small?.valueAxis === false, labels: Boolean(layer.small?.labels || authored.dataLabels !== void 0 && authored.dataLabels !== false), measure: chartMeasure });
22202
22837
  if (rows3) {
22203
22838
  chart.chart.layer = restackForRows(chart.value, data, layer, rows3, chart.box, chart.chart.valueAxis, plotGeometry(chart));
22839
+ const edges = layout2.rows.map((row2) => row2.box);
22840
+ rowAligned.push({ chart, table, top: Math.min(...edges.map((box) => box.y)), bottom: Math.max(...edges.map((box) => box.y + box.height)) });
22204
22841
  break;
22205
22842
  }
22206
22843
  }
22207
22844
  }
22845
+ const tableAt = (table, at3, growth) => {
22846
+ try {
22847
+ return layoutTable(table.value, at3, { scale: scale2, minFontSize: table.composition.minFontSize, fontFamily: options.fontFamilies?.body, ...options.fontFamilies?.code ? { codeFontFamily: options.fontFamilies.code } : {}, textMeasurement: options.textMeasurement, presentation: options.presentation, ...numberLanguage(options), ...rtl ? { direction: "rtl" } : {}, growth });
22848
+ } catch {
22849
+ return void 0;
22850
+ }
22851
+ };
22852
+ const grownTable = (table, at3, fits) => {
22853
+ const floor = snapFontSizeUp((table.composition.minFontSize ?? 16) * scale2), start = table.tableGrowth ?? 1;
22854
+ let chosen, size = gridFontSize(grownRoleSize(TABLE_NOMINAL_SIZE, start, LONE_DISPLAY_SIZES.table) * scale2, floor);
22855
+ for (let power = 1; power <= 5; power++) {
22856
+ const growth = start * TYPE_SCALE_RATIO ** power, grown = gridFontSize(grownRoleSize(TABLE_NOMINAL_SIZE, growth, LONE_DISPLAY_SIZES.table) * scale2, floor);
22857
+ if (grown <= size + 1e-9) break;
22858
+ const laid = tableAt(table, at3, growth);
22859
+ if (!laid || laid.overflow || laid.splitsWords || !laid.rows.every((row2) => row2.cells.every((cell) => cell.fit.fontSize >= grown - 1e-9 || Array.isArray(cell.value))) || !fits(laid)) break;
22860
+ chosen = { growth, height: Math.max(...laid.rows.map((row2) => row2.box.y + row2.box.height)) - Math.min(...laid.rows.map((row2) => row2.box.y)) };
22861
+ size = grown;
22862
+ }
22863
+ return chosen;
22864
+ };
22865
+ for (const entry of rowAligned) {
22866
+ const { chart, table } = entry, layer = chart.chart?.layer;
22867
+ if (!layer?.rows || layer.stack || layer.references || layer.plot || record19(chart.value).legend !== void 0 || chart.frameBox || chart.caption || table.frameBox || table.caption) continue;
22868
+ const box = rounded(chart.box);
22869
+ if (Math.abs(box.y + box.height / 2 - (table.box.y + table.box.height / 2)) > 1) continue;
22870
+ const data = resolveChartData(chart.value, options.presentation);
22871
+ if (!data.ok) continue;
22872
+ const inset2 = chartPlotInset(chart.value, data, chart.chart, { ...plotGeometry(chart), box });
22873
+ if (!inset2) continue;
22874
+ const headerHeight = layer.header?.height ?? 0;
22875
+ const chosen = grownTable(table, { ...rounded(table.box), height: box.height }, (laid2) => {
22876
+ const body2 = laid2.rows.filter((row2) => !row2.cells.some((cell) => cell.header));
22877
+ if (!body2.length) return false;
22878
+ const top = Math.min(...laid2.rows.map((row2) => row2.box.y)), bottom = Math.max(...laid2.rows.map((row2) => row2.box.y + row2.box.height));
22879
+ const rowsTop = body2[0].box.y, rowsBottom = body2.at(-1).box.y + body2.at(-1).box.height;
22880
+ return Math.max(bottom, rowsBottom + inset2.bottom) - Math.min(top, rowsTop - headerHeight) <= box.height;
22881
+ });
22882
+ if (!chosen) continue;
22883
+ const before = { box: table.box, growth: table.tableGrowth};
22884
+ table.tableGrowth = chosen.growth;
22885
+ table.box = { ...table.box, y: round9(box.y + box.height / 2 - chosen.height / 2), height: round9(chosen.height) };
22886
+ const laid = tableAt(table, rounded(table.box), chosen.growth);
22887
+ const body = laid?.rows.filter((row2) => !row2.cells.some((cell) => cell.header)) ?? [];
22888
+ const centers = body.map((row2) => {
22889
+ const key = row2.cells.find((cell) => cell.column === 0) ?? row2.cells[0];
22890
+ const fit = key.fit;
22891
+ return key.textBox.y + ("height" in fit ? fit.height : fit.lines.length * fit.lineHeight) / 2;
22892
+ });
22893
+ const authored = record19(chart.value);
22894
+ const rows3 = laid && alignBarRows(data, box, body.map((row2) => row2.box), centers, { scale: scale2, minFontSize: chart.composition.minFontSize, header: headerHeight, hiddenAxis: layer.small?.valueAxis === false, labels: Boolean(layer.small?.labels || authored.dataLabels !== void 0 && authored.dataLabels !== false), measure: chartMeasure });
22895
+ if (!laid || !rows3) {
22896
+ table.box = before.box;
22897
+ if (before.growth === void 0) delete table.tableGrowth;
22898
+ else table.tableGrowth = before.growth;
22899
+ continue;
22900
+ }
22901
+ chart.chart.layer = restackForRows(chart.value, data, layer, rows3, chart.box, chart.chart.valueAxis, plotGeometry(chart));
22902
+ entry.top = Math.min(...laid.rows.map((row2) => row2.box.y));
22903
+ entry.bottom = Math.max(...laid.rows.map((row2) => row2.box.y + row2.box.height));
22904
+ }
22905
+ const sharedPlots = new Set(siblingCharts.flat());
22906
+ for (const { chart, table, top: tableTop, bottom: tableBottom } of rowAligned) {
22907
+ const layer = chart.chart?.layer, rows3 = layer?.rows, authored = record19(chart.value);
22908
+ if (!layer || !rows3 || layer.stack || layer.references || layer.plot || authored.legend !== void 0 || sharedPlots.has(chart) || chart.frameBox || chart.caption || table.frameBox || table.caption) continue;
22909
+ const data = resolveChartData(chart.value, options.presentation);
22910
+ if (!data.ok) continue;
22911
+ const box = rounded(chart.box);
22912
+ const inset2 = chartPlotInset(chart.value, data, chart.chart, { ...plotGeometry(chart), box });
22913
+ if (!inset2) continue;
22914
+ const rowsTop = box.y + rows3.top, rowsBottom = box.y + rows3.bottom;
22915
+ const top = Math.max(box.y, Math.min(tableTop, rowsTop - (layer.header?.height ?? 0)));
22916
+ const bottom = Math.min(box.y + box.height, rowsBottom + inset2.bottom);
22917
+ let dy = 0;
22918
+ if (Math.abs(box.y + box.height / 2 - (table.box.y + table.box.height / 2)) <= 1) {
22919
+ const groupTop = Math.min(top, tableTop), groupBottom = Math.max(bottom, tableBottom);
22920
+ dy = round9(Math.min(box.y + box.height - groupBottom, Math.max(box.y - groupTop, box.y + box.height / 2 - (groupTop + groupBottom) / 2)));
22921
+ }
22922
+ const down = top - box.y + dy, lower = (part) => ({ ...part, y: part.y + down });
22923
+ const header = layer.header && {
22924
+ ...layer.header,
22925
+ ...layer.header.caption ? { caption: { ...layer.header.caption, box: lower(layer.header.caption.box) } } : {},
22926
+ ...layer.header.legend ? { legend: { box: lower(layer.header.legend.box), entries: layer.header.legend.entries.map((entry) => ({ ...entry, box: lower(entry.box) })) } } : {}
22927
+ };
22928
+ chart.chart.layer = { ...layer, ...header ? { header } : {}, rows: { ...rows3, top: rows3.top + dy, bottom: rows3.bottom + dy, centers: rows3.centers.map((center2) => center2 + dy) } };
22929
+ if (dy) table.box = { ...table.box, y: table.box.y + dy };
22930
+ }
22931
+ const onRows = new Set(rowAligned.map((entry) => entry.table));
22932
+ for (const chart of items) {
22933
+ if (chart.field !== "chart" || !chart.chart || chart.chart.layer?.rows || chart.frameBox || chart.caption) continue;
22934
+ const box = rounded(chart.box), beside = items.filter((item) => item.field === "table" && besideEachOther(chart.box, item.box));
22935
+ const table = beside.length === 1 ? beside[0] : void 0;
22936
+ if (!table || onRows.has(table) || table.frameBox || table.caption || Math.abs(box.y + box.height / 2 - (table.box.y + table.box.height / 2)) > 1) continue;
22937
+ const chosen = grownTable(table, { ...rounded(table.box), height: box.height }, (laid) => Math.max(...laid.rows.map((row2) => row2.box.y + row2.box.height)) - Math.min(...laid.rows.map((row2) => row2.box.y)) <= box.height);
22938
+ const height2 = chosen?.height ?? table.box.height;
22939
+ if (height2 >= box.height - 1) continue;
22940
+ if (chosen) table.tableGrowth = chosen.growth;
22941
+ const resolved2 = resolveChartData(chart.value, options.presentation), plan2 = resolved2.ok ? chartDrawPlan(chart.value, resolved2, { language: deckLanguage() }) : void 0;
22942
+ const circular = plan2 !== void 0 && (plan2.type === "pie" || plan2.type === "doughnut");
22943
+ const topLine = !circular && !cellOfItem.has(table);
22944
+ table.box = { ...table.box, y: topLine ? box.y : round9(box.y + box.height / 2 - height2 / 2), height: round9(height2) };
22945
+ onRows.add(table);
22946
+ }
22208
22947
  for (const item of items) {
22209
22948
  const sources = chartReferenceSources(item.value);
22210
22949
  for (const finding of item.chart?.layer?.references?.diagnostics ?? []) diagnostics.push({ code: finding.code === "chart-reference-label-collision" ? "chart-label-collision" : "text-overflow", path: item.path + ".referenceLines." + (sources[finding.index] ?? finding.index) + ".label", message: finding.message });
@@ -22248,15 +22987,15 @@ function composeLayout(input, options = {}) {
22248
22987
  if (stepped.length >= 2 && stepped.length === members.length) {
22249
22988
  const rows3 = [];
22250
22989
  for (const item of [...stepped].sort((a, b) => a.box.y - b.box.y)) {
22251
- const row = rows3.find((entry) => entry.some((other) => item.box.y < other.box.y + other.box.height && other.box.y < item.box.y + item.box.height));
22252
- if (row) row.push(item);
22990
+ const row2 = rows3.find((entry) => entry.some((other) => item.box.y < other.box.y + other.box.height && other.box.y < item.box.y + item.box.height));
22991
+ if (row2) row2.push(item);
22253
22992
  else rows3.push([item]);
22254
22993
  }
22255
22994
  const position = new Map(stepped.map((item, index) => [item, index]));
22256
22995
  const top = (item) => item.text.listEntries?.[0]?.textBox.y ?? item.text.placement?.lines[0]?.y ?? item.box.y;
22257
- for (const row of rows3) {
22258
- const size = Math.max(...row.map((item) => item.text.fontSize)), diameter = STEP_BADGE * size, cy = Math.min(...row.map(top)) - diameter * STEP_BADGE_GAP - diameter / 2;
22259
- const badges = row.map((item) => {
22996
+ for (const row2 of rows3) {
22997
+ const size = Math.max(...row2.map((item) => item.text.fontSize)), diameter = STEP_BADGE * size, cy = Math.min(...row2.map(top)) - diameter * STEP_BADGE_GAP - diameter / 2;
22998
+ const badges = row2.map((item) => {
22260
22999
  const side = item.alignment === "center" ? "center" : rtl ? item.alignment === "left" ? "right" : "left" : item.alignment;
22261
23000
  const cx = side === "center" ? item.box.x + item.box.width / 2 : side === "right" ? item.box.x + item.box.width - diameter / 2 : item.box.x + diameter / 2;
22262
23001
  const own3 = stepHeadings.has(item.path) ? listNumbers(item.value, item.payload.numbering)[0] : void 0;
@@ -22358,11 +23097,13 @@ function composeLayout(input, options = {}) {
22358
23097
  diagnostics.push({ code: "arrangement-adapted", path: item.path, message: geometry.reason + " The complete authored list is retained." });
22359
23098
  return void 0;
22360
23099
  }
22361
- const nodes = geometry.nodes.map((node) => {
23100
+ const treeNodes = (shapes) => shapes.nodes.map((node) => {
22362
23101
  const preset = kind2 === "hierarchy" ? "roundRect" : "rect", adjust = kind2 === "hierarchy" ? 1e4 : 0;
22363
23102
  return { index: node.index, box: node.box, preset, adjust, textBox: presetTextRect(preset, node.box, adjust), ...kind2 === "hierarchy" ? { radius: 0.1 * Math.min(node.box.width, node.box.height), background: node.background } : {} };
22364
23103
  });
22365
- designs.push({ design: "smartart", frame: area3, nodes, connectors: geometry.connectors, margin: ARRANGEMENT_TEXT_MARGIN[kind2], align: "center", paint: "primary", text: kind2 === "hierarchy" ? "slide" : "node", lineWidth: primaryLine });
23104
+ designs.push({ design: "smartart", frame: area3, nodes: treeNodes(geometry), connectors: geometry.connectors, margin: ARRANGEMENT_TEXT_MARGIN[kind2], align: "center", paint: "primary", text: kind2 === "hierarchy" ? "slide" : "node", lineWidth: primaryLine });
23105
+ const own3 = opfTreeGeometry(kind2, area3, values);
23106
+ if (own3.ok) designs.push({ design: "opf", frame: area3, nodes: treeNodes(own3), connectors: own3.connectors, margin: ARRANGEMENT_TEXT_MARGIN[kind2], align: "center", paint: "primary", text: kind2 === "hierarchy" ? "slide" : "node", lineWidth: primaryLine });
22366
23107
  } else if (kind2 === "venn") {
22367
23108
  const nativeNodes = vennNodes(area3, sets);
22368
23109
  const withOverlap = (circles, size2) => {
@@ -22397,7 +23138,7 @@ function composeLayout(input, options = {}) {
22397
23138
  };
22398
23139
  const measuredDesign = { design: "smartart", frame: area3, nodes: nativeNodes, margin: ARRANGEMENT_TEXT_MARGIN.venn, align: "center", paint: "primary", text: "slide", lineWidth: primaryLine, ...overlapAt < 0 ? {} : { fitNodes: (size2) => withOverlap(nativeNodes, size2) } };
22399
23140
  if (sets <= 4) designs.push(measuredDesign);
22400
- else {
23141
+ if (sets >= 5 || sets === 4 && values.slice(0, sets).every((value) => [...flatten(typeof value === "object" && value !== null && !Array.isArray(value) ? record19(value).text : value).trim()].length <= VENN_FOUR_LABEL)) {
22401
23142
  const previous = sized(measuredDesign), previousList = { ...item };
22402
23143
  if (!previous) fillRegionWithList(previousList, area3, top);
22403
23144
  const minimumSize = previous?.size ?? Math.max(base, previousList.text.fontSize);
@@ -22438,6 +23179,7 @@ function composeLayout(input, options = {}) {
22438
23179
  const own3 = linearNodes(kind2, area3, count, rtl), margins = linearMargins(kind2, rtl);
22439
23180
  designs.push({ design: "smartart", frame: area3, nodes: own3.nodes, ...own3.arrows.length ? { arrows: own3.arrows } : {}, margin: ARRANGEMENT_TEXT_MARGIN[kind2], margins, align: "center", paint: "primary", text: "node", lineWidth: primaryLine });
22440
23181
  for (const compact of [false, true]) for (let lines = 1; lines <= Math.min(OPF_LINES_MAX, count); lines++) {
23182
+ if (kind2 === "chevrons" && lines > 1 && Math.floor(count / lines) === 1) continue;
22441
23183
  const opf = linearDesign(kind2, area3, count, gap, rtl, lines, void 0, compact);
22442
23184
  if (opf) designs.push({
22443
23185
  design: "opf",
@@ -22460,12 +23202,26 @@ function composeLayout(input, options = {}) {
22460
23202
  designs.push({ design: "smartart", frame: area3, nodes: matrixNodes(area3), margin: ARRANGEMENT_TEXT_MARGIN.matrix, align: "center", paint: "primary", text: "node", background: matrixSquare(area3), lineWidth: primaryLine });
22461
23203
  designs.push({ design: "opf", frame: area3, nodes: matrixQuadrants(area3, gap), margin: ARRANGEMENT_TEXT_MARGIN.matrix, align: "center", paint: "primary", text: "node", lineWidth: primaryLine, layout: { design: "matrix-quadrants", area: area3, gap, radius } });
22462
23204
  } else {
22463
- const columns2 = [.../* @__PURE__ */ new Set([1, ...count > 1 ? cardGridColumns(count) : [], Math.min(count, 2)])].filter((column) => column <= count);
22464
- for (const column of columns2) designs.push({ design: "cards", frame: area3, nodes: cardNodes(area3, count, column, gap, radius), margin: CARD_TEXT_MARGIN, align: "start", paint: "card", text: "slide", lineWidth: scale2, layout: { design: "card-grid", area: area3, gap, radius, columns: column } });
23205
+ const shapeOf = (column) => {
23206
+ const rows3 = Math.ceil(count / column), width2 = (area3.width - (column - 1) * gap) / column, height2 = (area3.height - (rows3 - 1) * gap) / rows3;
23207
+ return Math.abs(Math.log(width2 / Math.max(1e-6, height2) / MATRIX_CARD_ASPECT));
23208
+ };
23209
+ const columns2 = [.../* @__PURE__ */ new Set([1, ...count > 1 ? cardGridColumns(count) : [], Math.min(count, 2)])].filter((column) => column <= count).sort((a, b) => shapeOf(a) - shapeOf(b));
23210
+ for (const column of columns2) designs.push({ design: "cards", frame: area3, nodes: cardNodes(area3, count, column, gap, radius), margin: CARD_TEXT_MARGIN, align: "center", paint: "primary", text: "node", lineWidth: primaryLine, layout: { design: "card-grid", area: area3, gap, radius, columns: column } });
22465
23211
  diagnostics.push({ code: "arrangement-adapted", path: item.path, message: `A matrix needs four entries; its ${count} ${count === 1 ? "entry is" : "entries are"} drawn as ${count === 1 ? "a card" : "a grid of cards"}.` });
22466
23212
  }
22467
23213
  const script = smartArtScript(values.map((value) => flatten(typeof value === "object" && value !== null && !Array.isArray(value) ? record19(value).text : value)));
22468
- let chosen, outside, skipped;
23214
+ let chosen, outside, skipped, strip;
23215
+ const covers = (nodes) => {
23216
+ if (!nodes.length || area3.width <= 0 || area3.height <= 0) return 0;
23217
+ const left = Math.min(...nodes.map((node) => node.box.x)), right = Math.max(...nodes.map((node) => node.box.x + node.box.width)), top2 = Math.min(...nodes.map((node) => node.box.y)), bottom = Math.max(...nodes.map((node) => node.box.y + node.box.height));
23218
+ return (right - left) * (bottom - top2) / (area3.width * area3.height);
23219
+ };
23220
+ const refitCover = (result) => {
23221
+ if (!result.design.refit) return covers(result.design.nodes);
23222
+ const shapes = result.design.refit(Math.max(...result.placed.columns.map((column) => column.box.height)) + result.placed.margins[1] + result.placed.margins[3]);
23223
+ return covers(shapes?.nodes ?? result.design.nodes);
23224
+ };
22469
23225
  for (const design2 of designs) {
22470
23226
  if (design2.last && chosen) break;
22471
23227
  const result = sized(design2);
@@ -22488,11 +23244,23 @@ function composeLayout(input, options = {}) {
22488
23244
  skipped = unavailable;
22489
23245
  continue;
22490
23246
  }
23247
+ if (design2.design === "smartart" && (kind2 === "chevrons" || kind2 === "vertical-process" || tree) && !candidate && (covers(design2.nodes) < LINEAR_STRIP_COVER || kind2 === "vertical-process" && count === 1)) {
23248
+ strip = result;
23249
+ continue;
23250
+ }
22491
23251
  const largest = design2.design === "cards" || kind2 === "cycle" || design2.largest === true;
22492
- if (largest && chosen && chosen.design.design === design2.design && chosen.size >= result.size) continue;
23252
+ if (largest && chosen && chosen.design.design === design2.design && chosen.size >= result.size && !(strip && isLinearArrangement(kind2) && chosen.size <= result.size + FONT_GRID_EPSILON && refitCover(result) > refitCover(chosen) + LINEAR_COVER_MARGIN)) continue;
22493
23253
  chosen = result;
22494
23254
  if (design2.design === "smartart" || !largest) break;
22495
23255
  }
23256
+ if (strip && (!chosen || chosen.size < strip.size - FONT_GRID_EPSILON)) {
23257
+ chosen = strip;
23258
+ skipped = void 0;
23259
+ } else if (strip) skipped = `PowerPoint's ${SMART_ART_NAMES[kind2].layout} covers under half of the region${tree ? "" : " at this count"}; OPF's own design fills it`;
23260
+ if (tree && outside && chosen?.design.design === "opf" && (covers(outside.design.nodes) >= LINEAR_STRIP_COVER || outside.size > chosen.size + FONT_GRID_EPSILON)) {
23261
+ chosen = outside;
23262
+ skipped = void 0;
23263
+ }
22496
23264
  if (!chosen && outside) {
22497
23265
  chosen = outside;
22498
23266
  skipped = void 0;
@@ -22514,6 +23282,18 @@ function composeLayout(input, options = {}) {
22514
23282
  placed2 = again;
22515
23283
  }
22516
23284
  }
23285
+ if (design.layout?.design === "pyramid-steps") {
23286
+ const widest = Math.max(0, ...placed2.columns.flatMap((column) => column.text.listEntries.flatMap((entry) => entry.text.richLines.map((line2) => line2.width))));
23287
+ const frame = design.frame, bars = Math.max(...design.nodes.map((node) => node.box.width)), room = PYRAMID_GROUP_SHARE * frame.width - 2 * design.layout.gap - widest;
23288
+ const barWidth = room > bars + 1 ? Math.min(room, frame.height * PYRAMID_STEPS_ASPECT) : bars;
23289
+ const inset2 = Math.max(0, (frame.width - barWidth - 2 * design.layout.gap - widest) / 2);
23290
+ const nodes = inset2 > 1 || barWidth > bars + 1 ? pyramidSteps(design.layout.area, count, design.layout.gap, design.layout.radius ?? 0, pyramidDirection, inset2, barWidth) : void 0;
23291
+ const next = nodes ? { ...design, nodes, layout: { ...design.layout, inset: inset2, ...barWidth > bars + 1 ? { barWidth } : {} } } : void 0, again = next ? place2(next, size, true) : void 0;
23292
+ if (next && again) {
23293
+ design = next;
23294
+ placed2 = again;
23295
+ }
23296
+ }
22517
23297
  if (design.layout) placed2 = place2(design, size, true) ?? placed2;
22518
23298
  if (design.adaptation) diagnostics.push({ code: "arrangement-adapted", path: item.path, message: design.adaptation });
22519
23299
  item.listColumns = placed2.columns;
@@ -22784,9 +23564,9 @@ function composeLayout(input, options = {}) {
22784
23564
  const chips2 = [], badges2 = [], fits2 = [];
22785
23565
  let lines = 0;
22786
23566
  for (let index = 0; index < count; index++) {
22787
- const row = Math.floor(index / columns2), column = index % columns2, inRow = Math.min(columns2, count - row * columns2);
23567
+ const row2 = Math.floor(index / columns2), column = index % columns2, inRow = Math.min(columns2, count - row2 * columns2);
22788
23568
  const offset = (columns2 - inRow) * (tileWidth + gap) / 2, logicalX = area3.x + offset + column * (tileWidth + gap);
22789
- const x = rtl ? area3.x + area3.width - (logicalX - area3.x) - tileWidth : logicalX, y2 = area3.y + row * (tileHeight + gap);
23569
+ const x = rtl ? area3.x + area3.width - (logicalX - area3.x) - tileWidth : logicalX, y2 = area3.y + row2 * (tileHeight + gap);
22790
23570
  const object2 = typeof values[index] === "object" && !Array.isArray(values[index]), textPath = `${item.path}.${index}${object2 ? ".text" : ""}`;
22791
23571
  const own0 = `${item.path}.0`, ownPath = `${item.path}.${index}`, marker = listOptions.citationMarker;
22792
23572
  const entryOptions = marker ? { ...listOptions, citationMarker: (run) => marker(run === own0 || run.startsWith(`${own0}.`) ? ownPath + run.slice(own0.length) : run) } : listOptions;
@@ -22821,6 +23601,62 @@ function composeLayout(input, options = {}) {
22821
23601
  };
22822
23602
  const tiles = checkTiles();
22823
23603
  if (tiles) steps.push(tiles);
23604
+ const stepRow = () => {
23605
+ if (!useTemplate || !ruleOn("step-badges")) return void 0;
23606
+ const body = items.filter((item2) => !headings.has(item2.field) && !item2.eyebrow);
23607
+ const item = body.length === 1 ? body[0] : void 0;
23608
+ const region = item?.region === void 0 ? void 0 : template.regions.find((entry) => entry.name === item.region);
23609
+ if (!item || !region || regionSequence(region) !== "steps" || !badgeLists.has(item.path) || item.listColumns || item.caption || item.frameBox || !item.text || !("listEntries" in item.text) || item.text.overflow) return void 0;
23610
+ const values = Array.isArray(item.value) ? item.value : [], count = values.length;
23611
+ if (count < 2 || count > STEP_ROW_MAX || values.some((value) => (record19(value).level ?? 0) !== 0 || record19(value).icon !== void 0)) return void 0;
23612
+ const area3 = templateRegions.find((entry) => entry.name === region.name)?.box;
23613
+ if (!area3) return void 0;
23614
+ const base = item.text.fontSize, columnWidth = (area3.width - gap * (count - 1)) / count;
23615
+ const listOptions = { ...richOptions(styleFor(item.field, item.path)), bullet: "none" };
23616
+ const tryAt = (size2) => {
23617
+ if (columnWidth < STEP_ROW_MIN_EMS * size2) return void 0;
23618
+ const diameter2 = STEP_BADGE * size2, band2 = diameter2 * (1 + STEP_BADGE_GAP), fits2 = [];
23619
+ let height3 = 0;
23620
+ for (let index = 0; index < count; index++) {
23621
+ const own0 = `${item.path}.0`, ownPath = `${item.path}.${index}`, marker = listOptions.citationMarker;
23622
+ const entryOptions = marker ? { ...listOptions, citationMarker: (run) => marker(run === own0 || run.startsWith(`${own0}.`) ? ownPath + run.slice(own0.length) : run) } : listOptions;
23623
+ const probe = fitList([values[index]], { x: 0, y: 0, width: columnWidth, height: 1e5 }, size2, size2, entryOptions);
23624
+ if (probe.overflow || probe.fontSize < size2 - FONT_GRID_EPSILON || probe.listEntries.some((entry) => blockCutsWord(entry) || size2 > base + FONT_GRID_EPSILON && entry.text.richLines.length > STEP_ROW_LINES)) return void 0;
23625
+ height3 = Math.max(height3, probe.height);
23626
+ fits2.push({ box: { x: 0, y: 0, width: columnWidth, height: probe.height }, start: index, end: index + 1, text: probe });
23627
+ }
23628
+ return band2 + height3 <= area3.height + 1e-6 ? { size: size2, diameter: diameter2, band: band2, height: height3, fits: fits2, entryOptions: (index) => {
23629
+ const own0 = `${item.path}.0`, ownPath = `${item.path}.${index}`, marker = listOptions.citationMarker;
23630
+ return marker ? { ...listOptions, citationMarker: (run) => marker(run === own0 || run.startsWith(`${own0}.`) ? ownPath + run.slice(own0.length) : run) } : listOptions;
23631
+ } } : void 0;
23632
+ };
23633
+ let chosen;
23634
+ const top = Math.max(base, Math.min(capOf(item.composition), snapFontSizeDown(STEP_ROW_DISPLAY * scale2)));
23635
+ for (let size2 = top; size2 >= base - FONT_GRID_EPSILON && !chosen; size2 = snapFontSizeDown(size2 - 4 / 3 * scale2)) chosen = tryAt(Math.max(size2, base));
23636
+ if (!chosen) return void 0;
23637
+ const { size, diameter, band, height: height2 } = chosen, y2 = area3.y + (area3.height - band - height2) / 2, badges = [], fits = [];
23638
+ for (let index = 0; index < count; index++) {
23639
+ const logicalX = area3.x + index * (columnWidth + gap), x = rtl ? area3.x + area3.width - (logicalX - area3.x) - columnWidth : logicalX;
23640
+ const object2 = typeof values[index] === "object" && !Array.isArray(values[index]), textPath = `${item.path}.${index}${object2 ? ".text" : ""}`;
23641
+ const box = { x, y: y2 + band, width: columnWidth, height: chosen.fits[index].box.height };
23642
+ const own3 = fitList([values[index]], box, size, size, chosen.entryOptions(index));
23643
+ if (own3.overflow) return void 0;
23644
+ fits.push({ box, start: index, end: index + 1, text: { ...own3, listEntries: own3.listEntries.map((entry) => ({ ...entry, index, textPath, ...entry.description ? { descriptionPath: `${item.path}.${index}.description` } : {} })) } });
23645
+ const cx = rtl ? x + columnWidth - diameter / 2 : x + diameter / 2, cy = y2 + diameter / 2;
23646
+ badges.push({ path: textPath, cx, cy, radius: diameter / 2, label: localizeDigits(String(index + 1), languageInEffect(options.presentation, options.slideIndex)), fontSize: size, baseline: cy + size * 0.35 });
23647
+ }
23648
+ item.listColumns = fits;
23649
+ item.text = mergeListColumns(fits);
23650
+ item.box = { x: area3.x, y: y2, width: area3.width, height: band + height2 };
23651
+ item.alignment = rtl ? "right" : "left";
23652
+ const ordered = [...badges].sort((a, b) => rtl ? b.cx - a.cx : a.cx - b.cx);
23653
+ return { form: "row", region: region.name, path: badges[0].path, badges: ordered, connector: { x1: ordered[0].cx, y1: ordered[0].cy, x2: ordered.at(-1).cx, y2: ordered.at(-1).cy }, lineWidth: 2 * scale2 * Math.max(1, size / (LIST_NOMINAL_SIZE * scale2)) };
23654
+ };
23655
+ const row = stepRow();
23656
+ if (row) {
23657
+ for (let index = steps.length - 1; index >= 0; index--) if (steps[index].region === row.region) steps.splice(index, 1);
23658
+ steps.push(row);
23659
+ }
22824
23660
  const figureRows = () => {
22825
23661
  const body = items.filter((item) => !headings.has(item.field) && !item.eyebrow && !(item.emphasis && surface && surface.shape !== "card"));
22826
23662
  for (const item of items) {
@@ -22867,9 +23703,9 @@ function composeLayout(input, options = {}) {
22867
23703
  const cardGridCells = (count, columns2, area3) => {
22868
23704
  const rows3 = Math.ceil(count / columns2), width2 = (area3.width - gap * (columns2 - 1)) / columns2, height2 = (area3.height - gap * (rows3 - 1)) / rows3;
22869
23705
  return Array.from({ length: count }, (_, index) => {
22870
- const row = Math.floor(index / columns2), column = index % columns2, inRow = Math.min(columns2, count - row * columns2);
23706
+ const row2 = Math.floor(index / columns2), column = index % columns2, inRow = Math.min(columns2, count - row2 * columns2);
22871
23707
  const logical = area3.x + (columns2 - inRow) * (width2 + gap) / 2 + column * (width2 + gap);
22872
- return { x: rtl ? area3.x + area3.width - (logical - area3.x) - width2 : logical, y: area3.y + row * (height2 + gap), width: width2, height: height2 };
23708
+ return { x: rtl ? area3.x + area3.width - (logical - area3.x) - width2 : logical, y: area3.y + row2 * (height2 + gap), width: width2, height: height2 };
22873
23709
  });
22874
23710
  };
22875
23711
  const cardInner = (cell) => {
@@ -22883,7 +23719,7 @@ function composeLayout(input, options = {}) {
22883
23719
  };
22884
23720
  const gridFill = (heights, columns2, area3) => {
22885
23721
  let covered = 0;
22886
- for (let row = 0; row * columns2 < heights.length; row++) covered += Math.max(...heights.slice(row * columns2, (row + 1) * columns2));
23722
+ for (let row2 = 0; row2 * columns2 < heights.length; row2++) covered += Math.max(...heights.slice(row2 * columns2, (row2 + 1) * columns2));
22887
23723
  return covered / area3.height;
22888
23724
  };
22889
23725
  const splitsWord = (source, lines) => {
@@ -22897,7 +23733,7 @@ function composeLayout(input, options = {}) {
22897
23733
  if (!ruleOn("heading-tracks")) return laid;
22898
23734
  let moved = false;
22899
23735
  const tracked = laid.map((card, index) => {
22900
- const row = Math.floor(index / columns2), track = Math.max(...laid.slice(row * columns2, (row + 1) * columns2).map((other) => other.labelHeight));
23736
+ const row2 = Math.floor(index / columns2), track = Math.max(...laid.slice(row2 * columns2, (row2 + 1) * columns2).map((other) => other.labelHeight));
22901
23737
  if (track - card.labelHeight <= 0.5) return card;
22902
23738
  const next = again(index, track);
22903
23739
  if (!next || next.height > next.inner.height + 1e-6) return card;
@@ -23173,7 +24009,7 @@ function composeLayout(input, options = {}) {
23173
24009
  const tiled = items.filter((item) => item.field === "text" && displayFaces.has(item.path) && item.text && !item.eyebrow && !item.emphasis && item.caption === void 0 && typeof item.value === "string" && !PLACED_SENTENCE.test(item.value.trim()));
23174
24010
  if (!tiled.length) return void 0;
23175
24011
  const heightOf = (fit) => "height" in fit && typeof fit.height === "number" ? fit.height : Math.max(fit.lines.length * fit.lineHeight, fit.placement?.height ?? 0);
23176
- const cells = tiled.map((item) => item.box), texts = tiled.map((item) => flatten(item.value).trim());
24012
+ const cells = tiled.map((item) => cellOfItem.get(item) ?? item.box), texts = tiled.map((item) => flatten(item.value).trim());
23177
24013
  const fitAt = (index, box, size2) => fitPlacedText("text", tiled[index].value, texts[index], box, size2, size2, tiled[index].path, tiled[index].alignment);
23178
24014
  const reads = (index, size2) => {
23179
24015
  const inner = cardInner(cells[index]), fit = fitAt(index, inner, size2);
@@ -23368,8 +24204,7 @@ function composeLayout(input, options = {}) {
23368
24204
  const boxes = Array.from({ length: count }, (_, index) => roundBox5({ x: rtl ? left + width2 - columnWidth - index * (columnWidth + between) : left + index * (columnWidth + between), y: area3.y, width: columnWidth, height: area3.height }));
23369
24205
  const whole = fitList(values, { ...boxes[0], height: 1e6 }, size, size, listOptions);
23370
24206
  if (!readable(whole)) continue;
23371
- const first = whole.listEntries[0].textBox.y, heights = whole.listEntries.map((entry, index) => (whole.listEntries[index + 1]?.textBox.y ?? first + whole.height) - entry.textBox.y);
23372
- const breaks = [0, ...listColumnBreaks(heights, whole.listEntries.map((entry) => entry.level), count), values.length];
24207
+ const breaks = [0, ...listColumnBreaks(listEntryPitches(whole), whole.listEntries.map((entry) => entry.level), count), values.length];
23373
24208
  const place2 = (dy, height3) => boxes.slice(0, breaks.length - 1).map((box, index) => {
23374
24209
  const start = breaks[index], end = breaks[index + 1], chunk = numbering !== void 0 ? sliceNumberedItems(values, numbering, start, end) : values.slice(start, end);
23375
24210
  const text2 = fitList(chunk, { ...box, y: box.y + dy, height: height3 }, size, size, listOptions);
@@ -23542,4 +24377,4 @@ function resolveCanvasDimensions(input) {
23542
24377
  return { width, height };
23543
24378
  }
23544
24379
 
23545
- export { ARRANGEMENTS, ARRANGEMENT_CARDS_MAX, ARRANGEMENT_GROWTH, ARRANGEMENT_LINE_POINTS, ARRANGEMENT_MAX, ARRANGEMENT_TEXT_MARGIN, ARROW_ADJUST, ASCII_QUOTE_MARKS, AUTO_FIT_MIN_KEPT, BODY_LINE_PITCH, BUILT_IN_MASKS, CALM_PICTURE_SPREAD, CAPTIONABLE_FIELDS, CAPTION_FONT_RATIO, CAPTION_MAX_RATIO, CARD_BORDER_MIX, CARD_FILL_SPACE, CARD_INSET, CARD_RADIUS, CARD_SURFACE_MIN_CONTRAST, CARD_SURFACE_MIX, CARD_TEXT_MARGIN, CARD_TEXT_MIN_CONTRAST, CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CELL_CARD_INSET, CHART_AXIS_MAX_OVERSHOOT, CHART_BAR_GAP_WIDTH, CHART_CONTEXT_FOCUS_DIFFERENCE, CHART_CONTEXT_LABELED_MIN_CONTRAST, CHART_CONTEXT_MIN_CONTRAST, CHART_DARK_SERIES_MIN_CONTRAST, CHART_EMPHASIS_MIN_CONTRAST, CHART_EMPHASIS_MIN_LIGHTNESS_STEP, CHART_HEADER_LEGEND_ROWS, CHART_HEADER_MAX_LEGEND, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, CHART_HIGHLIGHT_MUTED_MIX, CHART_LABELED_ZERO_SHARE, CHART_LEAD_LIGHTNESS_STEP, CHART_LONE_MAX_HEIGHT_RATIO, CHART_MAX_HEIGHT_RATIO, CHART_MAX_INTERVALS, CHART_MAX_PLOT_ASPECT, CHART_MIN_PLOT_PX, CHART_MIN_PLOT_SHARE, CHART_MIN_TICK_SPACING_PX, CHART_RADAR_MAX_HEIGHT_RATIO, CHART_REFERENCE_TYPES, CHART_SERIES_MIN_DIFFERENCE, CHART_SERIES_MIN_LIGHTNESS_STEP, CHART_SERIES_SOFT_MIX, CHART_SERIES_TIER_SIZE, CHART_SERIES_TINT_MIX, CHART_SLICE_LABEL_MIN_RADIUS, CHART_SLICE_MAX_SHIFT, CHART_SLICE_SEPARATOR_PX, CHART_TEXT_FLOOR_PX, CHART_TEXT_PX, CHART_TYPES, CHART_VALUE_LIST_MAX_ROWS, CHART_VALUE_LIST_SMALL_SLICE, CHECK_TILE_MAX, CHECK_TILE_MAX_CHARACTERS, CHECK_TILE_MAX_LINES, CHECK_TILE_MIN, CHEVRON_ADJUST, CITATION_MARKER_RAISE, CITATION_MARKER_SCALE, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_NOMINAL_SIZE, CODE_PANEL_BACKGROUND, CODE_PANEL_DARK_SHADE, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, CONNECTOR_ROUTES, CONNECTOR_STANDOFF, CONNECTOR_STROKE_COLOR, CONNECTOR_STROKE_WIDTH, CYCLE_ARROW, CYCLE_ARROW_ADJUST, CYCLE_ARROW_LIGHTEN, CYCLE_DIAMETER, CYCLE_RADIUS, CYCLE_RING_MARGIN, CYCLE_RING_NODE, CYCLE_TWO, DARK_BACKGROUND_LUMINANCE, DEFAULT_CHART_LABEL_SEPARATOR, DEFAULT_FURNITURE_DATE_FORMAT, DEFAULT_SHAPE_STYLE, DEFAULT_VARIABLE_DATE_FORMAT, DESIGN_HINT_KEYS, DIAGRAM_BORDER_MIN_CONTRAST, DIAGRAM_LINE_MIN_CONTRAST, DIAGRAM_NOMINAL_SIZE, DIAGRAM_SECONDARY_FLOOR, DIAGRAM_SHAPE_FAMILIES, DIAGRAM_SURFACE_ALT_MIX, DIAGRAM_SURFACE_MIX, DIAGRAM_SYNTAXES, DISPLAY_LINE_PITCH, DISPLAY_SIZE_FACTOR, DISPLAY_TRACKING, DOT_LAYOUT_ENGINES, DOT_SHAPES, EMPHASIS_BAND_MAX_CHARACTERS, EMPHASIS_BAND_MAX_SHARE, EMPHASIS_NOTE_LINES, EMPHASIS_PILL_MAX_CHARACTERS, EMPHASIS_PILL_SIZE, EMPHASIS_SURFACE_MIN_CONTRAST, EMPHASIS_TAKEAWAY_MAX_CHARACTERS, EMPHASIS_TEXT_MIN_CONTRAST, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, EYEBROW_GAP, EYEBROW_LABEL_CHARS, EYEBROW_LABEL_WORDS, EYEBROW_MAX_SIZE, EYEBROW_MIN_SIZE, EYEBROW_SHARE, EYEBROW_TAG_SIZE, EYEBROW_TEXT_KIND, EYEBROW_TRACKING, FEATURED_LABEL_MAX_CHARACTERS, FEATURED_LABEL_MAX_WORDS, FEATURED_MARK_MAX_CHARACTERS, FEATURED_MAX_CELLS, FIGURE_CEILING, FIGURE_ROW_MAX, FIGURE_ROW_MIN, FIGURE_WORDS, FLOW_ROUND_ADJUST, FONT_SIZE_GRID_PER_PX, FOOTNOTE_MAX_RATIO, FURNITURE_GAP, FURNITURE_IMAGE_SHARE, FURNITURE_ZONE_GUTTER, GROUPED_LABEL_CODE, HALF_STEPPED, HEADING_AREAS, HEADING_DISPLAY_SIZES, HISTOGRAM_LABEL_SLOT, HISTOGRAM_MIN_BINS, ICON_CARD_DESCRIPTION, ICON_CARD_DESCRIPTION_CHARACTERS, ICON_CARD_FILL, ICON_CARD_LABEL_CHARACTERS, ICON_CARD_LABEL_WORDS, ICON_CARD_MAX, ICON_CARD_MIN, ICON_CHIP, ICON_CHIP_COMPACT, ICON_CHIP_GAP, ICON_CHIP_TINT, ICON_GLYPH, ICON_MIN_CONTRAST, ICON_VIEWBOX, JOINED_FIXED_MAX, LANGUAGES, LAYOUT_BODY_KINDS, LEAD_NOMINAL_SIZE, LINEAR_ARRANGEMENTS, LINEAR_TEXT_MARGINS, LIST_ACCENT_RULE_WIDTH, LIST_DISPLAY_GAP, LIST_DISPLAY_RULE, LIST_DISPLAY_SCALE, LIST_HEADING_SCALE, LIST_MARKERS, LIST_NOMINAL_SIZE, LIST_NUMERAL_GAP, LIST_NUMERAL_SCALE, LIST_QUESTION_LINES, LIST_ROWS_GAP, LIST_ROWS_LABEL_SHARE, LIST_ROWS_SPREAD, LIST_RULE_WIDTH, LIST_WHOLE_ENTRIES, LOGO_SHAPES, LONE_DISPLAY_SIZES, LONE_FILL, LONE_METRIC_TARGET, LONE_TARGET, MATRIX_BACKGROUND_LIGHTEN, MATRIX_ENTRIES, MATRIX_GAP, MATRIX_INSET, MATRIX_QUADRANT, MAX_COMPOSITION_DEPTH, MAX_NUMBERING_LEVELS, MAX_NUMBERING_VALUE, MAX_REGION_BLOCKS, MAX_REGION_DEPTH, MAX_REGION_ENTRIES, MAX_ROMAN_VALUE, MAX_TEMPLATE_TRACKS, MESSAGE_CEILINGS, MESSAGE_DISPLAY_LINES, MESSAGE_DISPLAY_SIZE, METRIC_BAND_MIN_COLUMN, METRIC_BAND_RATIO, METRIC_BAND_VALUE_SHARE, METRIC_DISPLAY_HEIGHT, METRIC_DISPLAY_SIZES, METRIC_DISPLAY_WIDTH, METRIC_ICON_TEXT, METRIC_PILL_PAD_X, METRIC_PILL_PAD_Y, METRIC_PILL_RISE, METRIC_ROLE_VALUE_SIZE, METRIC_TILE_VALUE_SHARE, METRIC_TREND_ARROW_GAP, METRIC_TREND_ARROW_SIZE, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, METRIC_UNIT_GAP, METRIC_UNIT_SHARE, METRIC_VALUE_MIN_CONTRAST, MIN_MEASURE_CHARS, MM_PER_PX, MOVED_ROW_MAX, NEUTRAL_SHARES, NOTE_PEER_RATIO, NOTE_PEER_WORDS, NUMBERING_STYLES, NUMBERING_SUFFIXES, NUMBERING_SYSTEMS, NUMBER_GROUPING_MIN, NUMBER_LOCALES, NUMBER_LOCALE_SOURCE, NUMBER_SEPARATOR_OVERRIDES, NUMERAL_SHAPES, NUMERAL_TAKEAWAYS, OPFCatalogsOptionError, OPFCompositionError, OPFLayoutTemplateError, OPFUnresolvedReferenceError, OPFVariableError, OPF_ARROW_LENGTH, OPF_ARROW_ROOM, OPF_ARROW_THICKNESS, OPF_CHEVRON_DEPTH, OPF_COLUMN_ARROW_LENGTH, OPF_COLUMN_ARROW_THICKNESS, OPF_COLUMN_ROOM, OPF_LAYOUT_DESIGNS, OPF_LAYOUT_KIND, OPF_LAYOUT_MAX, OPF_LINES_MAX, OVERLAY_ANCHOR_SHARE, OVERLAY_BODY_SHARE, OVERLAY_EDGES, OVERLAY_LAYERS, PAIR_ARROW_HEIGHT, PAIR_ARROW_MARGIN, PAIR_ARROW_WIDTH, PAIR_FIGURE_KINDS, PAIR_GRID_ANSWER, PAIR_GRID_MIN, PAIR_GRID_QUESTION, PAIR_LENGTH_RATIO, PANEL_SCRIM_LIMIT, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, PICTURE_BULLET_SCALE, PICTURE_PANEL_SHARES, PICTURE_STROKE_WIDTH, PICTURE_TEXT_COLUMNS, PICTURE_TEXT_PLACEMENTS, PILLAR_MAX, PILLAR_WORD_MAX, PLACED_TILE_LINES, PLACED_TILE_SHARE, PLANTUML_DIAGRAMS, PORTRAIT_FOCUS_Y, PORTRAIT_GAP, PORTRAIT_MIN, PORTRAIT_MODES, PORTRAIT_SIDE_CHARS, PORTRAIT_SIDE_FILL, PORTRAIT_SIDE_MAX, PORTRAIT_SIDE_SHARE, PORTRAIT_SIDE_SHARES, PORTRAIT_TALLEST, PORTRAIT_TEXT_SIZE, PORTRAIT_TOP_MAX, PORTRAIT_WIDEST, PROSE_NOMINAL_SIZE, PYRAMID_MAX_ASPECT, PYRAMID_STEPS_ASPECT, PYRAMID_STEPS_SHARE, PYRAMID_TEXT_WIDTH, PositionRangeError, QUOTE_MARK, QUOTE_MARKS, QUOTE_NOMINAL_SIZE, QUOTE_PORTRAIT_GAP, QUOTE_PORTRAIT_MIN_WIDTH, QUOTE_PORTRAIT_SHARE, QUOTE_PORTRAIT_STEP, QUOTE_PULL_LINES, QUOTE_PULL_MAX_CHARACTERS, QUOTE_PULL_PREFIX, QUOTE_PULL_ROLE_SEPARATOR, QUOTE_PULL_RULE, QUOTE_SOURCE_SEPARATOR, RADAR_BOTTOM_LEGEND_GAIN, REGION_ANCHORS, REGION_ARRANGEMENTS, REGION_FLOWS, REGION_KINDS, REGION_ROLES, REMOVED_DESIGN_KEYS, RESERVED_REGION_NAMES, ROUND_RECT_ADJUST, ROW_LABEL_CHARS, ROW_LABEL_WORDS, RUN_IN_HEADING_CHARS, SALIENT_LIMIT, SCRIM_FADE, SCRIM_MARGIN, SCRIM_TARGET_CONTRAST, SEQUENCE_ARRANGEMENTS, SHAPE_BLOCK_KEYS, SHAPE_EFFECT_KEYS, SHAPE_PADDING, SHAPE_PRESETS, SHAPE_STROKE_WIDTH, SHAPE_STYLES, SHORT_MESSAGE_WORDS, SHORT_TEXT_WORDS, SLIDE_SCOPED_BUILTINS, SMALL_CHART_MAX_POINTS, SMALL_CHART_MAX_SERIES, SMART_ART_DOMAIN, SMART_ART_LAYOUTS, SMART_ART_NAMES, SMART_ART_OPF_DOMAIN, SMART_ART_SCALES, SOCIAL_PLATFORMS, STEP_BADGE, STEP_BADGE_GAP, STEP_PROCESS_CHARACTERS, STEP_PROCESS_MAX, STEP_PROCESS_MIN, STUB_LINE_SHARE, SURFACE_ALT_MIN_CONTRAST, SURFACE_ALT_MIX, TABLE_HIGHLIGHT_MIX, TABLE_NOMINAL_SIZE, TABLE_NUMERIC_SHARE, TEAM_AVATAR, TERM_WORDS, TEXT_ONLY_LABELS, TEXT_TILE_CHARACTERS, TEXT_TILE_LINES, TEXT_TILE_MARKER, TEXT_TILE_MAX, TEXT_TILE_MIN, THEME_DESIGN_KEYS, TIER_MAX, TIER_VALUE_SIZES, TIMELINE_OUTLINE_MIN_CONTRAST, TIMELINE_STATUSES, TIMELINE_STATUS_WORDS, TIMELINE_TEXT_MIN_CONTRAST, TITLE_BESIDE_SHARE, TITLE_POSITIONS, TITLE_RULE_SIZE, VARIABLE_KINDS, alignBarRows, allocateRows, annotationText, applyColorTransform, applyHslTransforms, applyLuminance, arrangementPaint, arrangementTree, asciiDigits, autoImageFit, bindNoBreak, bindRegions, blockKind, capitalsLabel, captionSettings, cardGridColumns, cardNodes, catalogGroupDeclared, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, cellBlocks, cellsInReadingOrder, chartAxisFraction, chartAxisScale, chartBarGeometry, chartBarSeriesOffset, chartCategoriesInTime, chartColorForFill, chartComboAxes, chartContextColor, chartContextColors, chartDoughnut, chartDrawDiagnostics, chartDrawPlan, chartEmphasisColors, chartEndLabels, chartFocusContextColors, chartHeader, chartHeaderCaption, chartHighlightColors, chartHighlightMarks, chartHistogram, chartIntervalsFor, chartLabelText, chartLayer, chartLayerDataLabels, chartNumber, chartNumberFixesByCell, chartNumberLanguage, chartNumericAxes, chartOptionSupport, chartOptionTarget, chartPaletteForFill, chartPlotBox, chartPlotInset, chartRadarLayout, chartReferenceSources, chartReferences, chartRingLabels, chartSchemeSeries, chartSeriesLabelColor, chartSeriesPalette, chartSeriesStrokes, chartSliceLabels, chartSlicePlan, chartSlideFocus, chartSoftColors, chartStack, chartTextSize, chartTitleFocus, chartValueAxis, chartValueAxisHidden, chartValueList, chartWaterfall, chartWaterfallColors, checkCatalogsOption, checkDiagram, checkMarkPoints, chevronNodes, chooseConnectorSites, choosePictureText, citationMarkerText, clrMapAttributes, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeHighlightSlice, codeLineNumbers, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForRoles, codeSyntaxPaletteForScheme, coerceVariableValue, collectCitations, colorContrast, colorMapFor, colorTransform, composeLayoutAreas, composeShape, composeSlide, compositeLayoutDefinition, connectorAdjustPreset, connectorRoute, coverKept, cycleAspect, cycleFrame, cycleLoop, cycleNodes, cycleRing, datasetDiagnostics, deckBackgroundIsChosen, deckBackgroundIsFixed, defaultImageFocus, defaultSlideBackground, diagramPalette, diagramPayload, diagramsPending, displayDepth, displayFrom, displayTracks, documentIcons, dotToMermaid, dottedPath, embedIcons, embeddedCopy, emphasisSurface, endLabelText, ensureDiagrams, ensureIcons, ensureShapes, evaluateLayoutDefinition, eyebrowCaps, eyebrowLabel, eyebrowSize, featuredCells, figureList, figureText, fitImage, fitList, fitRichText, fitText, flowNodes, focusHits, formatChartLabelNumber, formatChartLabelPercent, formatDataNumber, formatFurnitureDate, formatListNumber, formatNumber, formatPercentNumber, formatVariableNumber, frameToSlide, fromExcelNumberFormat, grayOfLuminance, gridCellSpan, gridCells, gridFlowShape, groupBinding, groupNumber, groupingNode, groupsAxisTicks, groupsDataRange, groupsThousands, hasBuiltinDependency, hasContentVariables, hasOverlayShapes, histogramBins, histogramEdgeDecimals, histogramEdgeFormat, histogramEdgeText, horizontalBarPlot, iconColors, iconFromSvg, iconIssue, iconPathCommands, iconPathData, iconsPending, imageBackground, imageShape, inlineChartData, inlineDatasets, inlineTableData, instantiateForValidation, intrinsicImageAspect, intrinsicImageSize, isArrangement, isColorVariant, isDarkColor, isDatasetRef, isFixedBackground, isGridCell, isLabelText, isLayoutTemplate, isLinearArrangement, isOverlayConnector, isPlaceLabel, isPresetShape, isRecord2 as isRecord, isRegionArrangement, isSequenceArrangement, isShapeBlock, isSupportedNumberingSystem, isTemplate, isTimeFieldTitle, isWrappedInQuoteMarks, isXYChartType, isolateNumbers, itemAlignment, itemizeScripts, languageInEffect, languageOfText, layoutArrangement, layoutCaption, layoutCode, layoutColorVariant, layoutContent, layoutDiagram, layoutEntries, layoutFootnotes, layoutFurniture, layoutMetric, layoutQuote, layoutRegion, layoutStructure, layoutTable, layoutTemplate, layoutTemplateIssues, layoutTimeline, layoutVariantApplies, layoutVariantKind, layoutWatermark, lineMayStartAt, linePitch, linearDesign, linearMargins, linearNodes, listBuiltinVariables, listColumnBreaks, listGridShape, listNumberLabel, listNumbers, listVariables, localizeDigits, localizeNumberParts, localizeNumberText, localizePatternNumber, lonePayload, luminanceGrid, majorityKind, markLabelColor, markQuote, matrixNodes, matrixQuadrants, matrixSquare, maxIntervalsFor, measureMonospaceText, measureText, measureTextOutline, messageCeiling, messageCharacters, messageWords, metricPillFill, metricTrendColor, metricTrendMark, metricTrendPoints, metricValueColor, monthOf, nativeTreeGeometry, nearIconNames, nearestGridCell, niceScale, nodeWidthAt, normalizeColorVariant, normalizeHexColor, normalizeLanguageFamily, numberFormatError, numberLocale, numberRanges, numberingAtLevel, numberingFindings, numberingStyleDraws, numberingSystemExtension, numberingSystemOf, numeralScripts, numeralShapePrefix, numericText, oneMessageField, opfLayoutGeometry, opfSmartArtUnavailable, overlayIssues, overlaysDrawBody, paintDiagram, paintDiagramGroup, pairEntry, paragraphDirection, paragraphDirectionAt, paretoPlan, parseIconReference, parseReference, pathFor, patternBitmap, patternRuns, physicalAlignment, pictureOverlay, pictureScrims, placeEndLabels, placeIconCommands, placeReferences, placeStackNames, placeTextLines, placedImageBlocks, plainLanguageTag, plantumlToMermaid, pointerPath, presetAspect, presetMask, presetTextRect, provenanceOf, pyramidFrame, pyramidNodes, pyramidSteps, questionText, quoteLanguage, quoteMarksFor, readableSchemeColor, readingRows, recordReferenceSites, rectSites, referencesSlide, refreshChartMarks, refreshEndLabels, regionAccepts, regionDiagram, regionListColumns, regionRoleRank, regionSequence, registeredCatalog, relatedName, removedLayoutAuto, renamedLayout, renamedLayoutChangesDrawing, renamedLayoutTitlePosition, repeatedPairs, representablePositionBox, resolveCanvasDimensions, resolveChartColors, resolveChartData, resolveChartOptions, resolveCodeLanguage, resolveColorRef, resolveColorRoles, resolveDesignHints, resolveDesignRecords, resolveFontFamilies, resolveFontScheme, resolveIcon, resolveLogo, resolveNumbering, resolvePatternPreset, resolveReference, resolveScriptFonts, resolveSlideDirection, resolveSlideVariables, resolveSocialProfile, resolveTableData, resolveTextStyle, resolveVariables, restackForRows, rightArrowPoints, rootNodes, rowLabel, runInHeading, sampledGrays, sampledWeight, scorePictureText, scottBinCount, scrimGeometry, scrimOpacity, scriptFontRole, scriptOfCharacter, shapeIssues, shapeSites, shapeStyleLook, shapeTextColor, shapesPending, shareHeights, shareSiblingChartAxes, shareSiblingPlots, sliceNumberedItems, slideBlockIds, slideCitations, slideFocusSources, slideTokenSpans, smallChart, smartArtScript, smartArtUnavailable, snapFontSizeDown, snapFontSizeUp, softenChartPalette, stackCategoryValues, stackedText, statementMessage, stubLine, styledText, suggestChartNumberFix, supportedNumberingSystems, surfaceAltColor, tableCellDisplayValue, tableGrid, tableHighlightColor, tableHighlightRows, tableKeyText, tableRowBoundaries, tableSlideFocus, textColorForFill, textInkBox, textLength, textWidthMeasurer, timelineMarkerShapes, timelineStatusWordsFor, timelineTextColor, titleBesideTemplate, toExcelNumberFormat, tokenizeCode, trackingWidth, translatePathData, turnedShapeBox, unbindNoBreak, unresolvedReference, unusedDatasets, unwrapQuoteMarks, usesSlideBuiltin, variableDeclarations, vennNodes, verticalFlowNodes, visitContentPayloads, visualReadingOrder, walkCitationRuns, waterfallLabelText, waterfallRoles, waterfallSignedFormat, waterfallSteps, wrapText };
24380
+ export { ARRANGEMENTS, ARRANGEMENT_CARDS_MAX, ARRANGEMENT_GROWTH, ARRANGEMENT_LINE_POINTS, ARRANGEMENT_MAX, ARRANGEMENT_TEXT_MARGIN, ARROW_ADJUST, ASCII_QUOTE_MARKS, AUTO_FIT_MIN_KEPT, BODY_LINE_PITCH, BUILT_IN_MASKS, CALM_PICTURE_SPREAD, CAPTIONABLE_FIELDS, CAPTION_FONT_RATIO, CAPTION_MAX_RATIO, CARD_BORDER_MIX, CARD_FILL_SPACE, CARD_INSET, CARD_RADIUS, CARD_SURFACE_MIN_CONTRAST, CARD_SURFACE_MIX, CARD_TEXT_MARGIN, CARD_TEXT_MIN_CONTRAST, CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CELL_CARD_INSET, CHART_AXIS_MAX_OVERSHOOT, CHART_BAR_GAP_WIDTH, CHART_CONTEXT_FOCUS_DIFFERENCE, CHART_CONTEXT_LABELED_MIN_CONTRAST, CHART_CONTEXT_MIN_CONTRAST, CHART_DARK_SERIES_MIN_CONTRAST, CHART_EMPHASIS_MIN_CONTRAST, CHART_EMPHASIS_MIN_LIGHTNESS_STEP, CHART_HEADER_LEGEND_ROWS, CHART_HEADER_MAX_LEGEND, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, CHART_HIGHLIGHT_MUTED_MIX, CHART_LABELED_ZERO_SHARE, CHART_LEAD_LIGHTNESS_STEP, CHART_LONE_MAX_HEIGHT_RATIO, CHART_MAX_HEIGHT_RATIO, CHART_MAX_INTERVALS, CHART_MAX_PLOT_ASPECT, CHART_MIN_PLOT_PX, CHART_MIN_PLOT_SHARE, CHART_MIN_TICK_SPACING_PX, CHART_RADAR_MAX_HEIGHT_RATIO, CHART_REFERENCE_TYPES, CHART_SERIES_MIN_DIFFERENCE, CHART_SERIES_MIN_LIGHTNESS_STEP, CHART_SERIES_SOFT_MIX, CHART_SERIES_TIER_SIZE, CHART_SERIES_TINT_MIX, CHART_SLICE_LABEL_MIN_RADIUS, CHART_SLICE_MAX_SHIFT, CHART_SLICE_SEPARATOR_PX, CHART_TEXT_FLOOR_PX, CHART_TEXT_PX, CHART_TYPES, CHART_VALUE_LIST_MAX_ROWS, CHART_VALUE_LIST_SMALL_SLICE, CHECK_TILE_MAX, CHECK_TILE_MAX_CHARACTERS, CHECK_TILE_MAX_LINES, CHECK_TILE_MIN, CHEVRON_ADJUST, CITATION_MARKER_RAISE, CITATION_MARKER_SCALE, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_NOMINAL_SIZE, CODE_PANEL_BACKGROUND, CODE_PANEL_DARK_SHADE, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, CONNECTOR_ROUTES, CONNECTOR_STANDOFF, CONNECTOR_STROKE_COLOR, CONNECTOR_STROKE_WIDTH, CYCLE_ARROW, CYCLE_ARROW_ADJUST, CYCLE_ARROW_LIGHTEN, CYCLE_DIAMETER, CYCLE_RADIUS, CYCLE_RING_MARGIN, CYCLE_RING_NODE, CYCLE_TWO, DARK_BACKGROUND_LUMINANCE, DEFAULT_CHART_LABEL_SEPARATOR, DEFAULT_FURNITURE_DATE_FORMAT, DEFAULT_SHAPE_STYLE, DEFAULT_VARIABLE_DATE_FORMAT, DESIGN_HINT_KEYS, DIAGRAM_BORDER_MIN_CONTRAST, DIAGRAM_LINE_MIN_CONTRAST, DIAGRAM_NOMINAL_SIZE, DIAGRAM_SECONDARY_FLOOR, DIAGRAM_SHAPE_FAMILIES, DIAGRAM_SURFACE_ALT_MIX, DIAGRAM_SURFACE_MIX, DIAGRAM_SYNTAXES, DISPLAY_LINE_PITCH, DISPLAY_SIZE_FACTOR, DISPLAY_TRACKING, DOT_LAYOUT_ENGINES, DOT_SHAPES, EMPHASIS_BAND_MAX_CHARACTERS, EMPHASIS_BAND_MAX_SHARE, EMPHASIS_NOTE_LINES, EMPHASIS_PILL_MAX_CHARACTERS, EMPHASIS_PILL_SIZE, EMPHASIS_SURFACE_MIN_CONTRAST, EMPHASIS_TAKEAWAY_MAX_CHARACTERS, EMPHASIS_TEXT_MIN_CONTRAST, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, EYEBROW_GAP, EYEBROW_LABEL_CHARS, EYEBROW_LABEL_WORDS, EYEBROW_MAX_SIZE, EYEBROW_MIN_SIZE, EYEBROW_SHARE, EYEBROW_TAG_SIZE, EYEBROW_TEXT_KIND, EYEBROW_TRACKING, FEATURED_LABEL_MAX_CHARACTERS, FEATURED_LABEL_MAX_WORDS, FEATURED_MARK_MAX_CHARACTERS, FEATURED_MAX_CELLS, FIGURE_CEILING, FIGURE_ROW_MAX, FIGURE_ROW_MIN, FIGURE_WORDS, FLOW_ROUND_ADJUST, FONT_SIZE_GRID_PER_PX, FOOTNOTE_MAX_RATIO, FURNITURE_GAP, FURNITURE_IMAGE_SHARE, FURNITURE_ZONE_GUTTER, GROUPED_LABEL_CODE, HALF_STEPPED, HEADING_AREAS, HEADING_DISPLAY_SIZES, HISTOGRAM_LABEL_SLOT, HISTOGRAM_MIN_BINS, ICON_CARD_DESCRIPTION, ICON_CARD_DESCRIPTION_CHARACTERS, ICON_CARD_FILL, ICON_CARD_LABEL_CHARACTERS, ICON_CARD_LABEL_WORDS, ICON_CARD_MAX, ICON_CARD_MIN, ICON_CHIP, ICON_CHIP_COMPACT, ICON_CHIP_GAP, ICON_CHIP_TINT, ICON_GLYPH, ICON_MIN_CONTRAST, ICON_VIEWBOX, JOINED_FIXED_MAX, LANGUAGES, LAYOUT_BODY_KINDS, LEAD_NOMINAL_SIZE, LINEAR_ARRANGEMENTS, LINEAR_TEXT_MARGINS, LIST_ACCENT_RULE_WIDTH, LIST_DISPLAY_GAP, LIST_DISPLAY_RULE, LIST_DISPLAY_SCALE, LIST_HEADING_SCALE, LIST_MARKERS, LIST_NOMINAL_SIZE, LIST_NUMERAL_GAP, LIST_NUMERAL_SCALE, LIST_QUESTION_LINES, LIST_ROWS_GAP, LIST_ROWS_LABEL_SHARE, LIST_ROWS_SPREAD, LIST_RULE_WIDTH, LIST_WHOLE_ENTRIES, LOGO_SHAPES, LONE_DISPLAY_SIZES, LONE_FILL, LONE_METRIC_TARGET, LONE_TARGET, MATRIX_BACKGROUND_LIGHTEN, MATRIX_ENTRIES, MATRIX_GAP, MATRIX_INSET, MATRIX_QUADRANT, MAX_COMPOSITION_DEPTH, MAX_NUMBERING_LEVELS, MAX_NUMBERING_VALUE, MAX_REGION_BLOCKS, MAX_REGION_DEPTH, MAX_REGION_ENTRIES, MAX_ROMAN_VALUE, MAX_TEMPLATE_TRACKS, MESSAGE_CEILINGS, MESSAGE_DISPLAY_LINES, MESSAGE_DISPLAY_SIZE, METRIC_BAND_MIN_COLUMN, METRIC_BAND_RATIO, METRIC_BAND_VALUE_SHARE, METRIC_DISPLAY_HEIGHT, METRIC_DISPLAY_SIZES, METRIC_DISPLAY_WIDTH, METRIC_ICON_TEXT, METRIC_PILL_PAD_X, METRIC_PILL_PAD_Y, METRIC_PILL_RISE, METRIC_ROLE_VALUE_SIZE, METRIC_TILE_VALUE_SHARE, METRIC_TREND_ARROW_GAP, METRIC_TREND_ARROW_SIZE, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, METRIC_UNIT_GAP, METRIC_UNIT_SHARE, METRIC_VALUE_MIN_CONTRAST, MIN_MEASURE_CHARS, MM_PER_PX, MOVED_ROW_MAX, NEUTRAL_SHARES, NOTE_PEER_RATIO, NOTE_PEER_WORDS, NUMBERING_STYLES, NUMBERING_SUFFIXES, NUMBERING_SYSTEMS, NUMBER_GROUPING_MIN, NUMBER_LOCALES, NUMBER_LOCALE_SOURCE, NUMBER_SEPARATOR_OVERRIDES, NUMERAL_SHAPES, NUMERAL_TAKEAWAYS, OPFCatalogsOptionError, OPFCompositionError, OPFLayoutTemplateError, OPFUnresolvedReferenceError, OPFVariableError, OPF_ARROW_LENGTH, OPF_ARROW_ROOM, OPF_ARROW_THICKNESS, OPF_CHEVRON_DEPTH, OPF_COLUMN_ARROW_LENGTH, OPF_COLUMN_ARROW_THICKNESS, OPF_COLUMN_ROOM, OPF_LAYOUT_DESIGNS, OPF_LAYOUT_KIND, OPF_LAYOUT_MAX, OPF_LINES_MAX, OVERLAY_ANCHOR_SHARE, OVERLAY_BODY_SHARE, OVERLAY_EDGES, OVERLAY_LAYERS, PAIR_ARROW_HEIGHT, PAIR_ARROW_MARGIN, PAIR_ARROW_WIDTH, PAIR_FIGURE_KINDS, PAIR_GRID_ANSWER, PAIR_GRID_MIN, PAIR_GRID_QUESTION, PAIR_LENGTH_RATIO, PANEL_SCRIM_LIMIT, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, PICTURE_BULLET_SCALE, PICTURE_PANEL_SHARES, PICTURE_STROKE_WIDTH, PICTURE_TEXT_COLUMNS, PICTURE_TEXT_PLACEMENTS, PILLAR_MAX, PILLAR_WORD_MAX, PLACED_TILE_LINES, PLACED_TILE_SHARE, PLANTUML_DIAGRAMS, PORTRAIT_FOCUS_Y, PORTRAIT_GAP, PORTRAIT_MIN, PORTRAIT_MODES, PORTRAIT_SIDE_CHARS, PORTRAIT_SIDE_FILL, PORTRAIT_SIDE_MAX, PORTRAIT_SIDE_SHARE, PORTRAIT_SIDE_SHARES, PORTRAIT_TALLEST, PORTRAIT_TEXT_SIZE, PORTRAIT_TOP_MAX, PORTRAIT_WIDEST, PROSE_NOMINAL_SIZE, PYRAMID_MAX_ASPECT, PYRAMID_STEPS_ASPECT, PYRAMID_STEPS_SHARE, PYRAMID_STEP_HEIGHT, PYRAMID_TEXT_WIDTH, PositionRangeError, QUOTE_MARK, QUOTE_MARKS, QUOTE_NOMINAL_SIZE, QUOTE_PORTRAIT_GAP, QUOTE_PORTRAIT_MIN_WIDTH, QUOTE_PORTRAIT_SHARE, QUOTE_PORTRAIT_STEP, QUOTE_PULL_LINES, QUOTE_PULL_MAX_CHARACTERS, QUOTE_PULL_PREFIX, QUOTE_PULL_ROLE_SEPARATOR, QUOTE_PULL_RULE, QUOTE_SOURCE_SEPARATOR, RADAR_BOTTOM_LEGEND_GAIN, REGION_ANCHORS, REGION_ARRANGEMENTS, REGION_FLOWS, REGION_KINDS, REGION_ROLES, REMOVED_DESIGN_KEYS, RESERVED_REGION_NAMES, ROUND_RECT_ADJUST, ROW_LABEL_CHARS, ROW_LABEL_WORDS, RUN_IN_HEADING_CHARS, SALIENT_LIMIT, SCRIM_FADE, SCRIM_MARGIN, SCRIM_TARGET_CONTRAST, SEQUENCE_ARRANGEMENTS, SHAPE_BLOCK_KEYS, SHAPE_EFFECT_KEYS, SHAPE_PADDING, SHAPE_PRESETS, SHAPE_STROKE_WIDTH, SHAPE_STYLES, SHORT_MESSAGE_WORDS, SHORT_TEXT_WORDS, SLIDE_SCOPED_BUILTINS, SMALL_CHART_MAX_POINTS, SMALL_CHART_MAX_SERIES, SMART_ART_DOMAIN, SMART_ART_LAYOUTS, SMART_ART_NAMES, SMART_ART_OPF_DOMAIN, SMART_ART_SCALES, SOCIAL_PLATFORMS, SPARSE_LIST_DISPLAY, STEP_BADGE, STEP_BADGE_GAP, STEP_PROCESS_CHARACTERS, STEP_PROCESS_MAX, STEP_PROCESS_MIN, STEP_ROW_DISPLAY, STEP_ROW_LINES, STEP_ROW_MAX, STEP_ROW_MIN_EMS, STUB_LINE_SHARE, SURFACE_ALT_MIN_CONTRAST, SURFACE_ALT_MIX, TABLE_HIGHLIGHT_MIX, TABLE_NOMINAL_SIZE, TABLE_NUMERIC_SHARE, TEAM_AVATAR, TERM_WORDS, TEXT_ONLY_LABELS, TEXT_TILE_CHARACTERS, TEXT_TILE_LINES, TEXT_TILE_MARKER, TEXT_TILE_MAX, TEXT_TILE_MIN, THEME_DESIGN_KEYS, TIER_MAX, TIER_VALUE_SIZES, TIMELINE_OUTLINE_MIN_CONTRAST, TIMELINE_STATUSES, TIMELINE_STATUS_WORDS, TIMELINE_TEXT_MIN_CONTRAST, TITLE_BESIDE_SHARE, TITLE_POSITIONS, TITLE_RULE_SIZE, VARIABLE_KINDS, alignBarRows, allocateRows, annotationText, applyColorTransform, applyHslTransforms, applyLuminance, arrangementPaint, arrangementTree, asciiDigits, autoImageFit, bindNoBreak, bindRegions, blockKind, capitalsLabel, captionSettings, cardGridColumns, cardNodes, catalogGroupDeclared, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, cellBlocks, cellsInReadingOrder, chartAxisFraction, chartAxisScale, chartBarGeometry, chartBarSeriesOffset, chartCategoriesInTime, chartCircleSquare, chartColorForFill, chartComboAxes, chartContextColor, chartContextColors, chartDoughnut, chartDrawDiagnostics, chartDrawPlan, chartEmphasisColors, chartEndLabels, chartFocusContextColors, chartHeader, chartHeaderCaption, chartHighlightColors, chartHighlightMarks, chartHistogram, chartIntervalsFor, chartLabelText, chartLayer, chartLayerDataLabels, chartNumber, chartNumberFixesByCell, chartNumberLanguage, chartNumericAxes, chartOptionSupport, chartOptionTarget, chartPaletteForFill, chartPlotBox, chartPlotInset, chartRadarLayout, chartReferenceSources, chartReferences, chartRingLabels, chartSchemeSeries, chartSeriesLabelColor, chartSeriesPalette, chartSeriesStrokes, chartSliceLabels, chartSlicePlan, chartSlideFocus, chartSoftColors, chartStack, chartTextSize, chartTitleFocus, chartValueAxis, chartValueAxisHidden, chartValueList, chartWaterfall, chartWaterfallColors, checkCatalogsOption, checkDiagram, checkMarkPoints, chevronNodes, chooseConnectorSites, choosePictureText, citationMarkerText, clrMapAttributes, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeHighlightSlice, codeLineNumbers, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForRoles, codeSyntaxPaletteForScheme, coerceVariableValue, collectCitations, colorContrast, colorMapFor, colorTransform, composeLayoutAreas, composeShape, composeSlide, compositeLayoutDefinition, connectorAdjustPreset, connectorRoute, coverKept, cycleAspect, cycleFrame, cycleLoop, cycleNodes, cycleRing, datasetDiagnostics, deckBackgroundIsChosen, deckBackgroundIsFixed, defaultImageFocus, defaultSlideBackground, diagramPalette, diagramPayload, diagramsPending, displayDepth, displayFrom, displayTracks, documentIcons, dotToMermaid, dottedPath, embedIcons, embeddedCopy, emphasisSurface, endLabelText, ensureDiagrams, ensureIcons, ensureShapes, evaluateLayoutDefinition, eyebrowCaps, eyebrowLabel, eyebrowSize, featuredCells, figureList, figureText, fitImage, fitList, fitRichText, fitText, flowNodes, focusHits, formatChartLabelNumber, formatChartLabelPercent, formatDataNumber, formatFurnitureDate, formatListNumber, formatNumber, formatPercentNumber, formatVariableNumber, frameToSlide, fromExcelNumberFormat, grayOfLuminance, gridCellSpan, gridCells, gridFlowShape, groupBinding, groupNumber, groupingNode, groupsAxisTicks, groupsDataRange, groupsThousands, hasBuiltinDependency, hasContentVariables, hasOverlayShapes, histogramBins, histogramEdgeDecimals, histogramEdgeFormat, histogramEdgeText, horizontalBarPlot, hslStopColor, iconColors, iconFromSvg, iconIssue, iconPathCommands, iconPathData, iconsPending, imageBackground, imageShape, inlineChartData, inlineDatasets, inlineTableData, instantiateForValidation, intrinsicImageAspect, intrinsicImageSize, isArrangement, isColorVariant, isDarkColor, isDatasetRef, isFixedBackground, isGridCell, isLabelText, isLayoutTemplate, isLinearArrangement, isOverlayConnector, isPlaceLabel, isPresetShape, isRecord2 as isRecord, isRegionArrangement, isSequenceArrangement, isShapeBlock, isSupportedNumberingSystem, isTemplate, isTimeFieldTitle, isWrappedInQuoteMarks, isXYChartType, isolateNumbers, itemAlignment, itemizeScripts, languageInEffect, languageOfText, layoutArrangement, layoutCaption, layoutCode, layoutColorVariant, layoutContent, layoutDiagram, layoutEntries, layoutFootnotes, layoutFurniture, layoutMetric, layoutQuote, layoutRegion, layoutStructure, layoutTable, layoutTemplate, layoutTemplateIssues, layoutTimeline, layoutVariantApplies, layoutVariantKind, layoutWatermark, lineMayStartAt, linePitch, linearDesign, linearMargins, linearNodes, listBuiltinVariables, listColumnBreaks, listGridShape, listNumberLabel, listNumbers, listVariables, localizeDigits, localizeNumberParts, localizeNumberText, localizePatternNumber, lonePayload, loneQuote, luminanceGrid, majorityKind, markLabelColor, markQuote, matrixNodes, matrixQuadrants, matrixSquare, maxIntervalsFor, measureMonospaceText, measureText, measureTextOutline, messageCeiling, messageCharacters, messageWords, metricPillFill, metricTrendColor, metricTrendMark, metricTrendPoints, metricValueColor, monthOf, nativeTreeGeometry, nearIconNames, nearestGridCell, niceScale, nodeWidthAt, normalizeColorVariant, normalizeHexColor, normalizeLanguageFamily, numberFormatError, numberLocale, numberRanges, numberingAtLevel, numberingFindings, numberingStyleDraws, numberingSystemExtension, numberingSystemOf, numeralScripts, numeralShapePrefix, numericText, oneMessageField, opfLayoutGeometry, opfSmartArtUnavailable, opfTreeGeometry, overlayIssues, overlaysDrawBody, paintDiagram, paintDiagramGroup, pairEntry, paragraphDirection, paragraphDirectionAt, paretoPlan, parseIconReference, parseReference, pathFor, patternBitmap, patternRuns, physicalAlignment, pictureOverlay, pictureScrims, placeEndLabels, placeIconCommands, placeReferences, placeStackNames, placeTextLines, placedImageBlocks, plainLanguageTag, plantumlToMermaid, pointerPath, presetAspect, presetMask, presetTextRect, provenanceOf, pyramidFrame, pyramidNodes, pyramidSteps, questionText, quoteLanguage, quoteMarksFor, readableSchemeColor, readingRows, recordReferenceSites, rectSites, referencesSlide, refreshChartMarks, refreshEndLabels, regionAccepts, regionDiagram, regionListColumns, regionRoleRank, regionSequence, registeredCatalog, relatedName, removedLayoutAuto, renamedLayout, renamedLayoutChangesDrawing, renamedLayoutTitlePosition, repeatedPairs, representablePositionBox, resolveCanvasDimensions, resolveChartColors, resolveChartData, resolveChartOptions, resolveCodeLanguage, resolveColorRef, resolveColorRoles, resolveDesignHints, resolveDesignRecords, resolveFontFamilies, resolveFontScheme, resolveIcon, resolveLogo, resolveNumbering, resolvePatternPreset, resolveReference, resolveScriptFonts, resolveSlideDirection, resolveSlideVariables, resolveSocialProfile, resolveTableData, resolveTextStyle, resolveVariables, restackForRows, rightArrowPoints, rootNodes, rowLabel, runInHeading, sampledGrays, sampledWeight, scorePictureText, scottBinCount, scrimGeometry, scrimOpacity, scriptFontRole, scriptOfCharacter, shapeIssues, shapeSites, shapeStyleLook, shapeTextColor, shapesPending, shareHeights, shareSiblingChartAxes, shareSiblingPlots, sliceNumberedItems, slideBlockIds, slideCitations, slideFocusSources, slideTokenSpans, smallChart, smartArtScript, smartArtUnavailable, snapFontSizeDown, snapFontSizeUp, softenChartPalette, stackCategoryValues, stackedText, statementMessage, stopDeclarationList, stopElementAttributes, stopOpacityValue, stopStylesheet, stubLine, styledText, suggestChartNumberFix, supportedNumberingSystems, surfaceAltColor, svgHslStopsToSrgb, tableCellDisplayValue, tableGrid, tableHighlightColor, tableHighlightRows, tableKeyText, tableRowBoundaries, tableSlideFocus, textColorForFill, textInkBox, textLength, textWidthMeasurer, timelineMarkerShapes, timelineStatusWordsFor, timelineTextColor, titleBesideTemplate, toExcelNumberFormat, tokenizeCode, trackingWidth, translatePathData, turnedShapeBox, unbindNoBreak, unresolvedReference, unusedDatasets, unwrapQuoteMarks, usesSlideBuiltin, variableDeclarations, vennNodes, verticalFlowNodes, visitContentPayloads, visualReadingOrder, walkCitationRuns, waterfallLabelText, waterfallRoles, waterfallSignedFormat, waterfallSteps, wrapText };