@openpresentation/opf 0.32.1 → 0.33.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 (95) hide show
  1. package/README.md +9 -0
  2. package/dist/browser.js +20 -20
  3. package/dist/{catalog-refs-kAefsZWT.d.ts → catalog-refs-B_0_vZg0.d.ts} +5 -0
  4. package/dist/{catalog-schemas-LdqOPebq.d.ts → catalog-schemas-CQTM-G8p.d.ts} +10 -4
  5. package/dist/{chunk-CLRYHWQN.js → chunk-ABWEUXLV.js} +72 -6
  6. package/dist/{chunk-XFHXQCXL.js → chunk-BI4ERFAA.js} +52 -1
  7. package/dist/{chunk-SZFO3MAJ.js → chunk-DAS75LGR.js} +3 -3
  8. package/dist/{chunk-F7DN33UL.js → chunk-E7WQHMCL.js} +6 -6
  9. package/dist/chunk-IJXKVM4W.js +221 -0
  10. package/dist/{chunk-AQEAZDL2.js → chunk-INIMUBSE.js} +2 -1
  11. package/dist/{chunk-NEJ32O7X.js → chunk-KVHNDHVS.js} +1 -1
  12. package/dist/{chunk-NVAJASOD.js → chunk-OPVJLL7H.js} +6867 -1862
  13. package/dist/{chunk-GM7WFPGG.js → chunk-PRXZD2II.js} +6 -1
  14. package/dist/{chunk-BBVW5ZC2.js → chunk-QD6DPS7X.js} +2 -2
  15. package/dist/{chunk-LEF4X4KI.js → chunk-QF5RSRXU.js} +1797 -170
  16. package/dist/{chunk-HKUV7NEN.js → chunk-R6C6BQOG.js} +1 -1
  17. package/dist/{chunk-IT7FQKED.js → chunk-S5QRGMUQ.js} +6 -6
  18. package/dist/{chunk-OXLA4HXQ.js → chunk-UK3J6FSU.js} +346 -53
  19. package/dist/{chunk-XQO2CT6Q.js → chunk-VKEYV3ZK.js} +1 -1
  20. package/dist/{chunk-ONVFUVQ5.js → chunk-VMBLNCX2.js} +31 -13
  21. package/dist/{chunk-YFJIIIOL.js → chunk-VSBZC2PR.js} +2 -2
  22. package/dist/{chunk-UJSAR6GF.js → chunk-W4DYDRV2.js} +21 -0
  23. package/dist/{chunk-J63CIRIV.js → chunk-XANW7MB7.js} +4 -4
  24. package/dist/{chunk-PB7ME64J.js → chunk-XIOC6N5P.js} +1 -1
  25. package/dist/{chunk-2E6CDYL2.js → chunk-Y557TYML.js} +5 -5
  26. package/dist/{chunk-SW676APJ.js → chunk-YS333HLA.js} +2 -2
  27. package/dist/chunk-YYT6N7AI.js +642 -0
  28. package/dist/chunk-ZXOIGUHX.js +1 -0
  29. package/dist/{composition-Ds6WHyO7.d.ts → composition-zMiIgzip.d.ts} +2353 -272
  30. package/dist/composition.d.ts +3 -2
  31. package/dist/composition.js +2 -2
  32. package/dist/conversion-POHRAMSN.js +24 -0
  33. package/dist/{conversion-CdzrTxib.d.ts → conversion-mNth9XKm.d.ts} +20 -9
  34. package/dist/convert.d.ts +3 -2
  35. package/dist/convert.js +9 -9
  36. package/dist/data.d.ts +1 -1
  37. package/dist/data.js +3 -3
  38. package/dist/{deck-report-CKDNQ2t4.d.ts → deck-report-BSlRiR0_.d.ts} +3 -3
  39. package/dist/deck.d.ts +6 -5
  40. package/dist/deck.js +12 -12
  41. package/dist/diagram-engine-eager.js +1 -1
  42. package/dist/diagram-engine-lazy.js +1 -1
  43. package/dist/diff.js +5 -5
  44. package/dist/docs.js +48 -24
  45. package/dist/examples.js +7507 -142
  46. package/dist/font-policy.js +1 -1
  47. package/dist/format.js +3 -3
  48. package/dist/ids.js +5 -5
  49. package/dist/index.d.ts +13 -12
  50. package/dist/index.js +24 -24
  51. package/dist/markdown.d.ts +2 -1
  52. package/dist/markdown.js +9 -9
  53. package/dist/node-engine.d.ts +7 -6
  54. package/dist/node-engine.js +24 -24
  55. package/dist/{pagination-DRZ_JNFY.d.ts → pagination-CYzNMazO.d.ts} +20 -3
  56. package/dist/pagination.d.ts +4 -3
  57. package/dist/pagination.js +5 -5
  58. package/dist/patch.js +4 -4
  59. package/dist/precompiled.js +3 -3
  60. package/dist/{presentation-DnD7mfmf.d.ts → presentation-CXhfpB_z.d.ts} +876 -39
  61. package/dist/repo-readme.js +2 -2
  62. package/dist/schema-engine-ajv.js +2 -2
  63. package/dist/schema-engine-precompiled.js +3 -3
  64. package/dist/schema.d.ts +2 -2
  65. package/dist/schema.js +4 -4
  66. package/dist/schemas.d.ts +40 -4
  67. package/dist/schemas.js +2 -2
  68. package/dist/shape-catalog.d.ts +98 -0
  69. package/dist/shape-catalog.js +302 -0
  70. package/dist/shape-engine-eager.js +9 -0
  71. package/dist/shape-engine-lazy.js +12 -0
  72. package/dist/shape-engine-module-BK7JNEUV.js +3 -0
  73. package/dist/shape-geometry.d.ts +126 -0
  74. package/dist/shape-geometry.js +2 -0
  75. package/dist/source.js +11 -11
  76. package/dist/spec/README.md +1 -1
  77. package/dist/spec/reference/preset-geometry.json +10699 -0
  78. package/dist/spec/reference/preset-geometry.schema.json +126 -0
  79. package/dist/spec/schemas/catalog-index.schema.json +1 -0
  80. package/dist/spec/schemas/chart-type.schema.json +4 -4
  81. package/dist/spec/schemas/icon-set.schema.json +75 -0
  82. package/dist/spec/schemas/layout.schema.json +14 -1
  83. package/dist/spec/schemas/opf.schema.json +1144 -196
  84. package/dist/spec-files.d.ts +1 -1
  85. package/dist/spec-files.js +2 -2
  86. package/dist/symbol-font-encodings.js +1 -1
  87. package/dist/types.d.ts +10 -6
  88. package/dist/{validation-types-DxyYPebs.d.ts → validation-types-COwTel3H.d.ts} +2 -2
  89. package/dist/validator.d.ts +5 -4
  90. package/dist/validator.js +4 -4
  91. package/dist/yaml.d.ts +2 -1
  92. package/dist/yaml.js +8 -8
  93. package/package.json +21 -5
  94. package/dist/chunk-DGS47ONG.js +0 -1
  95. package/dist/conversion-5FUDQPED.js +0 -24
@@ -1,12 +1,13 @@
1
1
  import { original } from './chunk-JBARNYFR.js';
2
- import { schemas, schemaEntries } from './chunk-LEF4X4KI.js';
3
- import { promotedRegionKeys, VARIABLE_KINDS, resolveChartData, chartPaletteForFill, chartSeriesPalette, chartSchemeSeries, CHART_SERIES_MIN_LIGHTNESS_STEP, normalizeHexColor, resolveChartColors, colorContrast, imageBackground, CODE_NOMINAL_SIZE, QUOTE_NOMINAL_SIZE, TABLE_NOMINAL_SIZE, LIST_NOMINAL_SIZE, PROSE_NOMINAL_SIZE, quoteMarksFor, quoteLanguage, emphasisSurface, textInkBox, tableGrid, metricValueColor, timelineTextColor, LOGO_SHAPES, visitContentPayloads, readingRows, visualReadingOrder, intrinsicImageSize, resolveReference, layoutTable, resolveColorRef, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, resolveColorRoles, layoutVariantApplies, resolveCanvasDimensions, resolveSlideVariables, layoutColorVariant, deckBackgroundIsFixed, normalizeColorVariant, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, resolveScriptFonts, defaultSlideBackground, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, MAX_COMPOSITION_DEPTH, datasetDiagnostics, pathFor, catalogRecords, collectCitations, numberingFindings, walkCitationRuns, chartDrawDiagnostics, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, OPFCompositionError, composeSlide } from './chunk-NVAJASOD.js';
2
+ import { schemas, schemaEntries } from './chunk-QF5RSRXU.js';
3
+ import { promotedRegionKeys, SHAPE_BLOCK_KEYS, VARIABLE_KINDS, resolveChartData, chartPaletteForFill, chartSeriesPalette, chartSchemeSeries, chartSlicePlan, CHART_SERIES_MIN_LIGHTNESS_STEP, normalizeHexColor, resolveChartColors, colorContrast, imageBackground, CODE_NOMINAL_SIZE, QUOTE_NOMINAL_SIZE, TABLE_NOMINAL_SIZE, LIST_NOMINAL_SIZE, PROSE_NOMINAL_SIZE, quoteMarksFor, quoteLanguage, emphasisSurface, textInkBox, tableGrid, metricValueColor, timelineTextColor, LOGO_SHAPES, visitContentPayloads, readingRows, visualReadingOrder, intrinsicImageSize, resolveReference, layoutTable, colorTransform, applyColorTransform, resolveColorRef, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, composeSlide, resolveColorRoles, layoutVariantApplies, resolveCanvasDimensions, resolveSlideVariables, layoutVariantKind, deckBackgroundIsChosen, LONE_DISPLAY_SIZES, normalizeColorVariant, layoutColorVariant, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, deckBackgroundIsFixed, resolveScriptFonts, lonePayload, annotationText, isLayoutTemplate, layoutTemplate, statementMessage, messageWords, SHORT_MESSAGE_WORDS, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, documentIcons, iconIssue, MAX_COMPOSITION_DEPTH, isOverlayConnector, connectorAdjustPreset, shapeIssues, pathFor, overlayIssues, datasetDiagnostics, defaultSlideBackground, catalogRecords, collectCitations, numberingFindings, walkCitationRuns, chartDrawDiagnostics, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, isShapeBlock, OPFCompositionError } from './chunk-OPVJLL7H.js';
4
4
  import { schemaEngine } from '#schema-engine';
5
5
  import { parseTree, printParseErrorCode, getNodePath } from 'jsonc-parser';
6
6
 
7
7
  // src/catalog-schemas.ts
8
8
  var CATALOG_SCHEMA = 4;
9
9
  var catalogDisplayKinds = ["chartTypes", "languages", "socialPlatforms"];
10
+ var catalogIconKinds = ["iconSets"];
10
11
  var catalogSchemaNames = {
11
12
  layouts: "layout",
12
13
  themes: "theme",
@@ -18,7 +19,8 @@ var catalogSchemaNames = {
18
19
  tones: "tone",
19
20
  chartTypes: "chartType",
20
21
  languages: "language",
21
- socialPlatforms: "socialPlatform"
22
+ socialPlatforms: "socialPlatform",
23
+ iconSets: "iconSet"
22
24
  };
23
25
 
24
26
  // src/annotation-validation.ts
@@ -234,6 +236,8 @@ var rootPayloadFields = [
234
236
  "metric",
235
237
  "quote",
236
238
  "timeline",
239
+ "shape",
240
+ "path",
237
241
  "blocks"
238
242
  ];
239
243
  var contentKindSpecs = {
@@ -247,7 +251,8 @@ var contentKindSpecs = {
247
251
  required: ["items"]
248
252
  },
249
253
  image: {
250
- fields: ["image"],
254
+ // SH-02: an image block's `shape` is its frame's mask.
255
+ fields: ["image", "shape"],
251
256
  required: ["image"]
252
257
  },
253
258
  chart: {
@@ -281,10 +286,18 @@ var contentKindSpecs = {
281
286
  diagram: {
282
287
  fields: ["diagram"],
283
288
  required: ["diagram"]
289
+ },
290
+ // SH-02: a preset (`shape` without `image`) or a custom `path`, with its `text` inside.
291
+ shape: {
292
+ fields: ["shape", "path", "text"],
293
+ required: [],
294
+ requireAny: ["shape", "path"]
284
295
  }
285
296
  };
286
297
  var captionableKinds = /* @__PURE__ */ new Set(["image", "chart", "table", "video", "diagram"]);
287
- var imageOptionFields = ["fit", "focus", "aspectRatio", "shape", "cornerRadius", "border", "opacity", "recolor", "overlay", "placement"];
298
+ var imageOptionFields = ["fit", "focus", "aspectRatio", "shape", "adjust", "stroke", "opacity", "recolor", "overlay", "placement", "portrait"];
299
+ var shapeImageFields = /* @__PURE__ */ new Set(["aspectRatio", "shape", "adjust", "stroke", "opacity"]);
300
+ var shapeOptionFields = SHAPE_BLOCK_KEYS.filter((field) => field !== "path");
288
301
  var columnSpans = {
289
302
  left: [0],
290
303
  center: [1],
@@ -355,7 +368,9 @@ function isContentKind(value) {
355
368
  }
356
369
  function inferredKinds(value) {
357
370
  const kinds = [];
358
- if (presentFields(value, contentKindSpecs.text.fields).length > 0) kinds.push("text");
371
+ const shape = isShapeBlock(value);
372
+ if (shape) kinds.push("shape");
373
+ if (presentFields(value, shape ? ["bullets"] : contentKindSpecs.text.fields).length > 0) kinds.push("text");
359
374
  if (hasOwn(value, "items")) kinds.push("list");
360
375
  if (hasOwn(value, "image")) kinds.push("image");
361
376
  if (hasOwn(value, "video")) kinds.push("video");
@@ -380,8 +395,11 @@ function validateContentPayload(value, path, options2 = {}) {
380
395
  const payloadFields = presentFields(value, rootPayloadFields);
381
396
  const hasBlocks = hasOwn(value, "blocks");
382
397
  const captionIssue = (reason, params2 = {}) => semanticIssue(pathFor(path, "caption"), `caption is only valid on an image, chart, table or video payload; ${reason}`, { code: "caption-unsupported-payload", ...params2 });
383
- const imageOptionIssues = (reason, params2 = {}) => {
384
- for (const field of imageOptionFields) if (hasOwn(value, field)) issues.push(semanticIssue(pathFor(path, field), `${field} is only valid on an image payload; ${reason}`, { code: "image-option-unsupported-payload", field, ...params2 }));
398
+ const imageOptionIssues = (reason, params2 = {}, except = /* @__PURE__ */ new Set()) => {
399
+ for (const field of imageOptionFields) if (hasOwn(value, field) && !except.has(field)) issues.push(semanticIssue(pathFor(path, field), `${field} is only valid on an image payload; ${reason}`, { code: "image-option-unsupported-payload", field, ...params2 }));
400
+ };
401
+ const shapeOptionIssues = (reason, params2 = {}) => {
402
+ for (const field of shapeOptionFields) if (hasOwn(value, field) && !(field === "hidden" && options2.slideRoot)) issues.push(semanticIssue(pathFor(path, field), `${field} is only valid on a shape block; ${reason}`, { code: "shape-option-unsupported-payload", field, ...params2 }));
385
403
  };
386
404
  if (hasOwn(value, "placement") && !options2.topLevel && !hasBlocks && explicitType !== "group" && inferredKinds(value).includes("image")) {
387
405
  issues.push(semanticIssue(pathFor(path, "placement"), "placement is only valid on a top-level block (slides.N.blocks.I); a block inside a group or a promoted region cannot bleed to a slide edge", { code: "image-placement-invalid" }));
@@ -389,8 +407,9 @@ function validateContentPayload(value, path, options2 = {}) {
389
407
  if (hasBlocks || explicitType === "group") {
390
408
  if (hasOwn(value, "caption")) issues.push(captionIssue("a group cannot carry one"));
391
409
  imageOptionIssues("a group cannot carry them");
410
+ shapeOptionIssues("a group cannot carry them");
392
411
  if (explicitType !== void 0 && explicitType !== "group") issues.push(semanticIssue(path, "a group must use type 'group' or omit type"));
393
- const incompatible2 = payloadFields.filter((field) => field !== "blocks" && field !== "type");
412
+ const incompatible2 = payloadFields.filter((field) => field !== "blocks" && field !== "type" && field !== "shape");
394
413
  if (incompatible2.length) issues.push(semanticIssue(path, "blocks cannot be mixed with leaf payload fields", { fields: incompatible2 }));
395
414
  if (!Array.isArray(value.blocks) || value.blocks.length === 0 && !options2.slideRoot) issues.push(semanticIssue(pathFor(path, "blocks"), "a group requires at least one block"));
396
415
  if (Array.isArray(value.blocks)) value.blocks.forEach((block, index) => {
@@ -437,7 +456,10 @@ function validateContentPayload(value, path, options2 = {}) {
437
456
  }
438
457
  const spec = contentKindSpecs[resolvedKind];
439
458
  if (hasOwn(value, "caption") && !captionableKinds.has(resolvedKind)) issues.push(captionIssue(`this payload is '${resolvedKind}'`, { type: resolvedKind }));
440
- if (resolvedKind !== "image") imageOptionIssues(`this payload is '${resolvedKind}'`, { type: resolvedKind });
459
+ if (resolvedKind !== "image") imageOptionIssues(`this payload is '${resolvedKind}'`, { type: resolvedKind }, resolvedKind === "shape" ? shapeImageFields : void 0);
460
+ if (resolvedKind !== "shape") shapeOptionIssues(`this payload is '${resolvedKind}'`, { type: resolvedKind });
461
+ if (resolvedKind === "shape" || resolvedKind === "image")
462
+ for (const issue2 of shapeIssues(value, (...keys) => keys.reduce((at2, key2) => pathFor(at2, key2), path))) issues.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code, ...issue2.params }));
441
463
  const allowedFields = /* @__PURE__ */ new Set([
442
464
  "type",
443
465
  ...spec.fields
@@ -585,6 +607,17 @@ function presentationSemanticIssues(value) {
585
607
  else documentIds.set(payload.id, "payload");
586
608
  }
587
609
  });
610
+ if (Array.isArray(slide.shapes)) slide.shapes.forEach((entry2, shapeIndex) => {
611
+ if (!isRecord(entry2)) return;
612
+ const entryPath = `${slidePath}/shapes/${shapeIndex}`;
613
+ if (typeof entry2.id === "string") {
614
+ if (documentIds.has(entry2.id)) issues.push(semanticIssue(`${entryPath}/id`, "overlay ids must be unique among slide, payload and overlay ids within a presentation", { id: entry2.id }));
615
+ else documentIds.set(entry2.id, "payload");
616
+ }
617
+ const checked = isOverlayConnector(entry2) ? isRecord(entry2.adjust) ? { shape: connectorAdjustPreset(entry2), adjust: entry2.adjust } : void 0 : entry2;
618
+ if (checked) for (const issue2 of shapeIssues(checked, (...keys) => keys.reduce((at2, key2) => pathFor(at2, key2), entryPath))) issues.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code, ...issue2.params }));
619
+ });
620
+ for (const issue2 of overlayIssues(slide, slidePath)) issues.push(semanticIssue(issue2.path, issue2.message, { ...issue2.code ? { code: issue2.code } : {}, ...issue2.params }));
588
621
  issues.push(...validateSlideRegions(slide, slidePath));
589
622
  const payloadTableIssues = (payload, path) => {
590
623
  if (isRecord(payload.table)) for (const issue2 of tableGrid(payload.table).issues) issues.push(semanticIssue(pathFor(path, "table") + issue2.path.slice(5).replaceAll(".", "/"), issue2.message));
@@ -749,12 +782,20 @@ function variableReferenceWarnings(value) {
749
782
  const variables = isRecord(value.variables) ? value.variables : {};
750
783
  const issues = [];
751
784
  const colorRef = (entry2, path) => {
785
+ if (isRecord(entry2) && entry2.color !== void 0) {
786
+ colorRef(entry2.color, pathFor(path, "color"));
787
+ return;
788
+ }
752
789
  if (typeof entry2 !== "string" || !entry2.startsWith("var:")) return;
753
790
  const id = entry2.slice("var:".length);
754
791
  if (!variableIdPattern.test(id) || hasOwn(variables, id)) return;
755
792
  issues.push(semanticIssue(path, `unknown variable '${id}'; declare it in the top-level variables map`, { id, code: "variable-reference-unknown" }));
756
793
  };
757
794
  const runColor = (entry2, path) => {
795
+ if (isRecord(entry2)) {
796
+ colorRef(entry2, path);
797
+ return;
798
+ }
758
799
  if (typeof entry2 !== "string") return;
759
800
  if (hexColorPattern.test(entry2) || schemeColorNames.has(entry2)) return;
760
801
  if (entry2.startsWith("var:") && variableIdPattern.test(entry2.slice("var:".length))) {
@@ -1226,6 +1267,8 @@ function backdropOf(definition, scheme, text2, variables, canvasColor) {
1226
1267
  }
1227
1268
  }
1228
1269
  function backgroundColorRef(value, scheme, variables, fallback) {
1270
+ const transform = colorTransform(value);
1271
+ if (transform) return applyColorTransform(backgroundColorRef(transform.color, scheme, variables, fallback), transform);
1229
1272
  if (typeof value !== "string") return fallback;
1230
1273
  const literal = normalizeHexColor(value);
1231
1274
  if (literal) return literal;
@@ -1283,11 +1326,11 @@ function colorChoice(levels, scheme, variables = {}) {
1283
1326
  }
1284
1327
  return {};
1285
1328
  }
1286
- function colorLevels(slideDesign, layout, deckDesign, theme, scheme, variables = {}) {
1287
- if (!layoutColorVariant(layout) || deckBackgroundIsFixed(deckDesign, theme.background)) return [slideDesign, deckDesign, theme];
1329
+ function colorLevels(slideDesign, layout, deckDesign, theme, scheme, variables = {}, surface) {
1330
+ if (!(surface ?? layoutColorVariant(layout)) || deckBackgroundIsFixed(deckDesign, theme.background) || surface && !layoutColorVariant(layout) && deckBackgroundIsChosen(deckDesign, theme.background)) return [slideDesign, deckDesign, theme];
1288
1331
  const below = colorChoice([deckDesign, theme], scheme, variables);
1289
1332
  const deck = resolveColorRoles(scheme, { background: below.background, variant: below.variant });
1290
- const variant = layoutColorVariant(layout, { background: deck.map.bg1, dark: deck.dark });
1333
+ const variant = surface ?? layoutColorVariant(layout, { background: deck.map.bg1, dark: deck.dark });
1291
1334
  const accents = variant.accents ?? below.variant?.accents;
1292
1335
  return [slideDesign, { variant: accents ? { ...variant, accents } : variant }, deckDesign, theme];
1293
1336
  }
@@ -1299,7 +1342,7 @@ function resolveDesign(document, index, context) {
1299
1342
  const fontDiagnostic = diagnostics.find((diagnostic) => diagnostic.kind === "fontSchemes");
1300
1343
  const dimensions = { width: options2.width, height: options2.height };
1301
1344
  const variables = rec(document.variables);
1302
- const choice = colorChoice(colorLevels(own4, resolved.layout, deck, theme, colorScheme, variables), colorScheme, variables);
1345
+ const choice = colorChoice(colorLevels(own4, resolved.layout, deck, theme, colorScheme, variables, resolved.messageSurface?.variant), colorScheme, variables);
1303
1346
  const roles = resolveColorRoles(colorScheme, { background: choice.background, variant: choice.variant });
1304
1347
  const dark = roles.dark;
1305
1348
  const text2 = roles.text;
@@ -1334,6 +1377,11 @@ function resolveDesign(document, index, context) {
1334
1377
  };
1335
1378
  }
1336
1379
  function resolveTextColor(reference, design, fallback) {
1380
+ const transform = colorTransform(reference);
1381
+ if (transform) {
1382
+ const base = resolveTextColor(transform.color, design, fallback);
1383
+ return base === void 0 ? void 0 : applyColorTransform(base, transform);
1384
+ }
1337
1385
  if (typeof reference !== "string" || !reference.trim()) return void 0;
1338
1386
  const literal = normalizeHexColor(reference);
1339
1387
  if (literal) return literal;
@@ -1599,7 +1647,13 @@ var formatRules = [
1599
1647
  rule("cite-unknown-reference", "format", "error", "A citation names a reference that does not exist.", "A cited id with no entry in `references` has nothing to show in the footnote area.", { standard: SCHEMA }),
1600
1648
  rule("cite-unsupported-location", "format", "error", "A citation or footnote sits where no engine draws it.", "`cite` and `footnote` apply to runs in text, bullets and list items; table cells, captions, and reference and footnote texts have no marker.", { standard: SCHEMA }),
1601
1649
  rule("caption-unsupported-payload", "format", "error", "A caption is on a payload that cannot carry one.", "A caption belongs to exactly one image, chart, table or video; a group, text or code block has no place to draw it.", { standard: SCHEMA }),
1602
- rule("image-option-unsupported-payload", "format", "error", "An image option is on a payload that is not an image.", "`fit`, `focus`, the image treatments (`shape`, `cornerRadius`, `border`, `opacity`, `recolor`, `overlay`, `aspectRatio`) and `placement` describe how a picture is drawn; a group, text or chart block has no picture for them to apply to.", { standard: SCHEMA }),
1650
+ rule("image-option-unsupported-payload", "format", "error", "An image option is on a payload that is not an image.", "`fit`, `focus`, the image treatments (`shape`, `adjust`, `stroke`, `opacity`, `recolor`, `overlay`, `aspectRatio`), `placement` and `portrait` describe how a picture is drawn; a group, text or chart block has no picture for them to apply to. A shape block takes `shape`, `adjust`, `stroke`, `opacity` and `aspectRatio` too.", { standard: SCHEMA }),
1651
+ rule("shape-option-unsupported-payload", "format", "error", "A shape option is on a payload that is not a shape block.", "`fill`, `style`, `rotate`, `flip`, `anchor`, `padding`, `textDirection`, `alt`, `decorative`, `hidden`, `link` and the effects (`shadow`, `innerShadow`, `glow`, `softEdge`, `reflection`, `blur`) describe how a shape block is drawn; a text, chart or image block, or a group, has no shape for them to apply to.", { standard: SCHEMA }),
1652
+ rule("shape-adjust-unknown", "format", "warning", "An adjust value names a guide the preset does not have.", "Each preset has its own adjust handles (DrawingML's avLst guides: `adj`, `adj1`, `adj2`, ...); a name the preset does not have changes nothing, and a custom `path` has none. The preset's default is drawn.", { standard: "ECMA-376 Part 1, 20.1.10.56 (ST_ShapeType) and presetShapeDefinitions.xml" }),
1653
+ rule("shape-adjust-range", "format", "warning", "An adjust value is outside the range of the preset's handle.", "An adjust value outside the range its handle allows is pinned by the preset's own formulas, so the shape is not drawn as the value says; core draws the preset's default instead and both engines agree.", { standard: "ECMA-376 Part 1, 20.1.10.56 (ST_ShapeType) and presetShapeDefinitions.xml", approximations: "Ranges are checked at a square shape of the default size; a handle whose range depends on the shape's proportions is checked at those proportions when the shape is drawn." }),
1654
+ rule("shape-link-hidden", "format", "warning", "A hidden shape carries a link.", "A hidden shape (`hidden: true`) is not drawn, so its `link` can never be clicked in a slide show.", { standard: SCHEMA }),
1655
+ rule("shape-anchor-missing", "format", "error", "An overlay shape is attached to a block that is not on the slide.", "An overlay shape placed with `at` sits against a composed block of its slide, named by the block's `id`. With no block of that id on the slide there is nowhere to put it, so it is not drawn.", { standard: SCHEMA }),
1656
+ rule("connector-end-missing", "format", "error", "A connector end names no block or overlay shape on the slide.", "A connector joins two shapes of its slide, each named by the `id` of a block or an overlay shape. With an end that names nothing (or names a connector) there is nothing to glue it to, so it is not drawn.", { standard: SCHEMA }),
1603
1657
  rule("image-placement-invalid", "format", "error", "An image placement cannot be honoured.", "A placed image bleeds to a slide edge and the rest of the slide composes beside it. Only a top-level block (slides.N.blocks.I) can do that, and a slide edge holds one placed image; a block in a group or a promoted region, or a second block on the same edge, has nowhere to go.", { standard: SCHEMA }),
1604
1658
  rule("layout-placeholder-group", "format", "error", "A layout record's placeholder group breaks a nesting rule.", "A placeholder group arranges body regions inside one cell of its layout record. Groups nest at most three levels inside a record, and a group holds body regions and groups only: the headings (title, subtitle, tag) stay at the record's top level, where the engine places them. Composition cannot use a record that breaks either rule.", { standard: SCHEMA }),
1605
1659
  rule("dataset-unknown", "format", "error", "A chart or table names a dataset that does not exist.", "The data cannot be drawn without the dataset it refers to.", { standard: SCHEMA }),
@@ -1689,6 +1743,8 @@ var referenceRules = [
1689
1743
  rule("undeclared-catalog", "format", "error", "A reference names a catalog group the document does not declare.", "The prefix of a `name:id` reference names the group of `catalogs` it resolves in. A prefix with no group can never resolve, whatever the host registers, so it is a format error: engines reject the document at their format check instead of drawing a fallback.", { standard: SCHEMA }),
1690
1744
  rule("unused-reference", "references", "warning", "A reference is never cited.", "A listed reference that no run cites is not drawn anywhere.", { standard: SCHEMA }),
1691
1745
  rule("unused-dataset", "references", "warning", "A dataset is never used.", "A dataset no chart or table references is not drawn anywhere.", { standard: SCHEMA }),
1746
+ rule("icon-unknown", "references", "warning", "An icon names a set or an icon that does not exist.", 'An `icon` is "<set>:<name>" (a set the document embeds or a registered catalog defines, such as lucide and tabler of the gallery), a name of the `icons` of the deck, or an SVG source. One that resolves nowhere is not drawn: the entry, metric or group keeps its text and has no chip.', { standard: SCHEMA, approximations: "A set a host registers as a loader is checked once it is loaded (ensureIcons): the CLI, the MCP and the Node file API load the sets a deck names before they validate it; the synchronous validate alone checks only the set ids and the sets the document embeds. Suggestions are the nearest names of the set (or of the icons of the deck)." }),
1747
+ rule("icon-invalid", "references", "warning", "The SVG of an icon cannot be drawn as an icon.", "The SVG of an icon is read, never run: a script, an event handler, an external reference (an href or url() that is not a fragment) or a raster image makes it unusable, as does SVG text that is not well formed or has no size. It is not drawn.", { standard: SCHEMA }),
1692
1748
  rule("unknown-beat", "references", "warning", "A slide names a beat its narrative does not define.", "`slides[].beat` links a slide to a step of the narrative plan. A beat id the narrative does not have links to nothing; nothing is drawn from a beat.", { standard: SCHEMA, approximations: "The narrative resolves like every content reference: the document's catalogs groups, then the registered catalogs. A narrative that resolves nowhere is not checked." }),
1693
1749
  rule("slide-theme-dimensions", "references", "warning", "A slide theme sets a slide size that differs from the deck.", "A PPTX has one slide size. The size a slide-level theme carries is never used: design.dimensions of the deck (or of its theme) wins in every engine, and without them the exporter stops with mixed slide sizes.", { standard: SCHEMA }),
1694
1750
  rule("variable-unknown", "references", "warning", "A `{{token}}` names a variable that is not declared.", "An undeclared token is shown literally.", { standard: SCHEMA }),
@@ -1718,7 +1774,7 @@ var dataRules = [
1718
1774
  ),
1719
1775
  rule("chart-mapping-adapted", "content", "warning", "A chart mapping entry is ignored.", "A mapping that names a column the chart type cannot use is left out of the chart.", { standard: SCHEMA }),
1720
1776
  rule("chart-highlight-adapted", "content", "warning", "A chart highlight is adapted by the chart type.", "A highlight the chart type cannot show as authored (a category highlight on a chart without categories, for example) is adapted by every engine, so the emphasis is not exactly what was written.", { standard: SCHEMA }),
1721
- rule("chart-series-dropped", "content", "warning", "A chart series is not drawn by the chart type.", "A treemap, histogram, Pareto, waterfall, funnel, map or single-series pie plots one value series, and a scatter plots no X column without numbers. Every engine leaves the same columns out (LH-60), so the warning names them instead of losing them silently.", { standard: SCHEMA, approximations: "Read from the drawn chart (chartDrawPlan): a world chart over categories that are mostly not places is drawn as columns, a box-and-whisker chart with one value per category as one box per series and a pie or doughnut of several series as nested rings, and none of those drops a series." }),
1777
+ rule("chart-series-dropped", "content", "warning", "A chart series is not drawn by the chart type.", "A treemap, histogram, one-series Pareto, waterfall, funnel, map or single-series pie plots one value series, and a scatter plots no X column without numbers. Every engine leaves the same columns out (LH-60), so the warning names them instead of losing them silently.", { standard: SCHEMA, approximations: "Read from the drawn chart (chartDrawPlan): a world chart over categories that are mostly not places and a Pareto chart of several series are drawn as columns, a box-and-whisker chart with one value per category as one box per series and a pie or doughnut of several series as nested rings, and none of those drops a series." }),
1722
1778
  rule("code-highlight-out-of-range", "content", "warning", "A code highlight marks a line the code does not have.", "Marked lines count from 1 by line break in code.source; an entry past the last line marks nothing.", { standard: SCHEMA }),
1723
1779
  rule("code-highlight-range-reversed", "content", "warning", "A code highlight range ends before it starts.", "A range written end before start marks nothing; write the smaller line number first.", { standard: SCHEMA }),
1724
1780
  rule("variable-builtin-missing", "content", "warning", "A built-in variable has no value in this document.", "A `{{deck.*}}`, `{{speaker.*}}` or `{{organization.*}}` token whose field the document does not set resolves to nothing, so the text shows a gap; a `var:organization.logo` reference to an organization without a logo draws no image. `{{slide.section}}` is checked per slide: a slide without a `section` that uses it, in its own text or in the header or footer it inherits, is reported at that slide.", { standard: SCHEMA }),
@@ -1815,7 +1871,7 @@ var chartColorRule = rule(
1815
1871
  {
1816
1872
  standard: "WCAG 2.2 SC 1.4.1 Use of Color, level A",
1817
1873
  thresholds: ["minSeriesColorDifference"],
1818
- approximations: "Uses the engine's series palette (ValidateOptions.chartPalette; default chartSeriesPalette of each slide color scheme (accent1 to accent6, then their tints), adjusted for the slide background and softened like the engines draw them, LH-105) in series order: series i takes colour i, pie/doughnut/treemap/funnel slices take colours per category. Pairs are compared by CIE76 distance after simulating protanopia, deuteranopia, tritanopia (Machado 2009, severity 1) and greyscale. Neighbouring series (and neighbouring slices, the last beside the first) must also differ by at least 11 in CIE L* (the lightness step the engines keep when they adjust a palette), since lightness is the cue left without hue (LH-35); a pair under it is reported as a lightness pair. Single-series charts and chart types without a series legend are skipped."
1874
+ approximations: "Uses the engine's series palette (ValidateOptions.chartPalette; default chartSeriesPalette of each slide color scheme (accent1 to accent6, then their tints), adjusted for the slide background and softened like the engines draw them, LH-105) in series order: series i takes color i, pie/doughnut/treemap/funnel slices take colours per category. Pairs are compared by CIE76 distance after simulating protanopia, deuteranopia, tritanopia (Machado 2009, severity 1) and greyscale. Neighbouring series (and neighbouring slices, on a pie or doughnut the last beside the first, which the engines move off the first by at most 20 L* or, where that is not enough, separate with a surface-colored slice border that this rule accepts, LH-161) must also differ by at least 11 in CIE L* (the lightness step the engines keep when they adjust a palette), since lightness is the cue left without hue (LH-35); a pair under it is reported as a lightness pair. Single-series charts and chart types without a series legend are skipped."
1819
1875
  }
1820
1876
  );
1821
1877
  var chartAltRule = rule(
@@ -1851,7 +1907,7 @@ var overflowRule = rule(
1851
1907
  "layout",
1852
1908
  "warning",
1853
1909
  "Text or a table does not fit its space at the smallest allowed size.",
1854
- "Core composition shrinks text to the readable minimum and then reports what still does not fit. Overflowing text is clipped or runs over other content in the preview and in PowerPoint.",
1910
+ "Core composition changes the arrangement (columns, the automatic grid, another design) before it sets text smaller, fits dense content that no arrangement holds down the type scale to the readable minimum, never below it, and then reports what still does not fit. Overflowing text is clipped or runs over other content in the preview and in PowerPoint.",
1855
1911
  {
1856
1912
  cost: "composition",
1857
1913
  approximations: "Uses composeSlide at the deck's slide size with the fonts of the resolved font scheme. Without a host-supplied text measurement (ValidateOptions.fonts.textMeasurement) widths are core's portable estimate, which can differ from the real font by a few percent; pass the renderer's measurement for font-exact results. A composition that sets overflow: \"error\" is reported as a warning here, so that `valid` never depends on font metrics; rendering and export still refuse such a slide when it does not fit."
@@ -1910,6 +1966,22 @@ var regionFullRule = rule(
1910
1966
  "A region holds at most `max` blocks on one slide. A pin to a full region is ignored and the block is placed by its kind.",
1911
1967
  { cost: "composition" }
1912
1968
  );
1969
+ var iconDroppedRule = rule(
1970
+ "icon-dropped",
1971
+ "layout",
1972
+ "warning",
1973
+ "An icon is not drawn.",
1974
+ "An icon is decoration: it never costs text its size. When the chips would set any block smaller than the slide sets it without them, the slide is drawn without its icons, and an icon on something icons do not mark (a nested or numbered list entry) is not drawn either. The text is always drawn.",
1975
+ { cost: "composition" }
1976
+ );
1977
+ var arrangementAdaptedRule = rule(
1978
+ "arrangement-adapted",
1979
+ "layout",
1980
+ "info",
1981
+ "A pyramid, matrix, cycle, row of chevrons or flow is drawn another way.",
1982
+ "A `pyramid`, `matrix`, `cycle`, `chevrons`, `flow` or `vertical-flow` region draws a list of one level of short entries as that diagram (docs/smartart.md). A matrix needs exactly four entries for its quadrants; with another count its entries are drawn as a grid of cards. A list the arrangement does not draw (nested entries, descriptions, icons, numbering, too many entries), or whose entries fit neither PowerPoint's design nor OPF's at the list's size, is drawn as a list.",
1983
+ { cost: "composition" }
1984
+ );
1913
1985
  var unplacedRule = rule(
1914
1986
  "layout-unplaced",
1915
1987
  "layout",
@@ -2101,6 +2173,8 @@ var implementedRules = [
2101
2173
  regionKindRule,
2102
2174
  regionFullRule,
2103
2175
  unplacedRule,
2176
+ iconDroppedRule,
2177
+ arrangementAdaptedRule,
2104
2178
  furnitureWrapsRule,
2105
2179
  outsideRule,
2106
2180
  resolutionRule,
@@ -2192,7 +2266,7 @@ function collectSamples(context) {
2192
2266
  if (Array.isArray(cell.value))
2193
2267
  cell.value.forEach((run, index) => {
2194
2268
  const colorRef = rec(run).color;
2195
- if (typeof colorRef !== "string") return;
2269
+ if (colorRef == null || colorRef === "") return;
2196
2270
  const color = resolveTextColor(colorRef, itemDesign, itemDesign.colors.text);
2197
2271
  if (color) samples.push({ path: `${cellPath}/${index}/color`, color, sizePx: rec(run).fontSize ? Number(rec(run).fontSize) / PX_TO_PT : 15, bold: Boolean(rec(run).bold) || cell.header, backdrop: cellBackdrop, source: "override", colorPath: `${cellPath}/${index}/color`, label: "Table cell text" });
2198
2272
  });
@@ -2222,7 +2296,7 @@ function collectSamples(context) {
2222
2296
  const relative = splitPointer(owner.path).slice(1);
2223
2297
  const base = pointer2(...splitPointer(itemPath), ...relative);
2224
2298
  for (const run of runsOf({ ...owner, path: base })) {
2225
- if (typeof run.style.color !== "string") continue;
2299
+ if (run.style.color == null || run.style.color === "") continue;
2226
2300
  const color = resolveTextColor(run.style.color, itemDesign, itemDesign.colors.text);
2227
2301
  if (!color) continue;
2228
2302
  const size = typeof run.style.fontSize === "number" ? run.style.fontSize / PX_TO_PT : baseSize;
@@ -2513,6 +2587,7 @@ var chartColorContext = (design) => ({
2513
2587
  });
2514
2588
  var chartSkip = /(histogram|box|pareto|waterfall|world|map)/;
2515
2589
  var perCategory = /(pie|doughnut|treemap|funnel)/;
2590
+ var circular = /(pie|doughnut)/;
2516
2591
  var chartRules = [
2517
2592
  {
2518
2593
  info: chartColorRule,
@@ -2532,7 +2607,9 @@ var chartRules = [
2532
2607
  const paletteContext = chartColorContext(slide.design);
2533
2608
  const palette = chartPaletteForFill(surface, context.chartPalette ?? chartSeriesPalette(slide.design.colorScheme, chart.colors, paletteContext), { legible: context.chartPalette === void 0 ? chartSchemeSeries(chart.colors, slide.design.colorScheme, paletteContext) : void 0, soften: context.chartPalette === void 0 });
2534
2609
  if (!palette.length) continue;
2535
- const used = Array.from({ length: Math.min(count, 24) }, (_, i) => palette[i % palette.length]);
2610
+ const slicePlan = circular.test(type) && context.chartPalette === void 0 ? chartSlicePlan(surface, palette, count, { legible: chartSchemeSeries(chart.colors, slide.design.colorScheme, paletteContext) }) : void 0;
2611
+ const drawn = slicePlan?.colors ?? palette;
2612
+ const used = Array.from({ length: Math.min(count, 24) }, (_, i) => drawn[i % drawn.length]);
2536
2613
  const pairs = [];
2537
2614
  for (let a = 0; a < used.length; a++)
2538
2615
  for (let b = a + 1; b < used.length; b++) {
@@ -2542,7 +2619,7 @@ var chartRules = [
2542
2619
  if (difference < worst.difference) worst = { model, difference };
2543
2620
  }
2544
2621
  if (worst.difference < context.thresholds.minSeriesColorDifference) pairs.push({ a, b, ...worst });
2545
- else if (b === a + 1 || slices && a === 0 && b === used.length - 1 && used.length > 2) {
2622
+ else if (b === a + 1 || circular.test(type) && !slicePlan?.bordered && a === 0 && b === used.length - 1 && used.length > 2) {
2546
2623
  const lightness = lightnessDifference(used[a], used[b]);
2547
2624
  if (lightness < CHART_SERIES_MIN_LIGHTNESS_STEP) pairs.push({ a, b, model: "lightness", difference: lightness });
2548
2625
  }
@@ -2754,7 +2831,7 @@ var REGION_RULES = { "region-unknown": regionUnknownRule, "region-kind": regionK
2754
2831
  var layoutRules = [
2755
2832
  {
2756
2833
  info: overflowRule,
2757
- also: [unresolvedRule, layoutFailedRule, minFontRule, regionUnknownRule, regionKindRule, regionFullRule, unplacedRule],
2834
+ also: [unresolvedRule, layoutFailedRule, minFontRule, regionUnknownRule, regionKindRule, regionFullRule, unplacedRule, iconDroppedRule, arrangementAdaptedRule],
2758
2835
  run(context) {
2759
2836
  const deckLevel = /* @__PURE__ */ new Set();
2760
2837
  for (const slide of context.slides) {
@@ -2770,6 +2847,10 @@ var layoutRules = [
2770
2847
  if (diagnostic.code === "text-overflow")
2771
2848
  context.report(overflowRule, { path, slide, message: diagnostic.message, help: "Shorten the text, give it more space (fewer blocks, a different composition) or split the slide (paginate); raising the readable minimum makes it worse." });
2772
2849
  else if (diagnostic.code === "small-cell") continue;
2850
+ else if (diagnostic.code === "icon-dropped")
2851
+ context.report(iconDroppedRule, { path, slide, message: diagnostic.message, help: "Shorten the text or give the slide more room so the chips fit at the same text size, or remove the icon. An icon draws on the first-level entries of an unnumbered list, on a metric and on a group." });
2852
+ else if (diagnostic.code === "arrangement-adapted")
2853
+ context.report(arrangementAdaptedRule, { path, slide, message: diagnostic.message, help: /four entries/.test(diagnostic.message) ? "Write four entries for the quadrants, or choose another layout for this many." : "Shorten the entries, write one level without descriptions, or choose another layout." });
2773
2854
  else if (Object.hasOwn(REGION_RULES, diagnostic.code))
2774
2855
  context.report(REGION_RULES[diagnostic.code], { path, slide, message: diagnostic.message, help: diagnostic.code === "layout-unplaced" ? "Paginate the slide, choose a layout with more room, pin the block to a region with room, or remove a block." : "Pin the block to a region of the layout that accepts it and has room, or remove the pin." });
2775
2856
  else context.report(unresolvedRule, { path, slide: path.startsWith("/slides/") ? slide : void 0, message: diagnostic.message, help: "Supply what the message asks for, or remove the setting that cannot be honoured." });
@@ -3588,6 +3669,11 @@ function embeddedRecordFindings(document, options2, findings) {
3588
3669
  if (!object(document) || !object(document.catalogs)) return invalid;
3589
3670
  for (const [group, value] of Object.entries(document.catalogs)) {
3590
3671
  if (!object(value)) continue;
3672
+ for (const [id, record] of Object.entries(object(value.iconSets) ? value.iconSets : {})) {
3673
+ if (object(record) && (Object.hasOwn(record, "$schema") || Object.hasOwn(record, "id"))) continue;
3674
+ const validation = validateAgainstSchema(object(record) ? { $schema: schemas.iconSet.$id, id, ...record } : record, "iconSets");
3675
+ for (const issue2 of validation.errors) findings.push(issueFinding(issue2, "opf/catalog-record", "iconSet", pointer3(["catalogs", group, "iconSets", id]), "document"));
3676
+ }
3591
3677
  for (const kind of catalogKinds)
3592
3678
  for (const [id, record] of Object.entries(object(value[kind]) ? value[kind] : {})) {
3593
3679
  const path = pointer3(["catalogs", group, kind, id]);
@@ -3908,6 +3994,21 @@ function referenceFindings(document, engine, options2) {
3908
3994
  lookup: ["opf", "schema", "presentation", "/$defs/Dataset"]
3909
3995
  })
3910
3996
  );
3997
+ for (const { path, value } of documentIcons(document)) {
3998
+ const issue2 = iconIssue(document, value, catalogs);
3999
+ if (!issue2) continue;
4000
+ const unknown = issue2.code === "icon-unknown";
4001
+ findings.push(
4002
+ finding(unknown ? "opf/icon-unknown" : "opf/icon-invalid", {
4003
+ path: pointerPath(path.split(".")),
4004
+ message: issue2.message,
4005
+ help: unknown ? `${issue2.suggestions?.length ? `Did you mean ${issue2.suggestions.slice(0, 3).map((name) => `'${name}'`).join(", ")}? ` : ""}Use an icon the set has (the MCP's search_icons finds names by keyword), add the name to the deck's icons, or remove the icon. Nothing else changes: the text is drawn without the chip.` : "Give the icon SVG text with only shapes (path, circle, rect, line, polyline, polygon and groups), no script, event handler, external reference or raster, or remove the icon.",
4006
+ definition: `${schemas.presentation.$id}#/$defs/IconReference`,
4007
+ lookup: ["opf", "schema", "presentation", "/$defs/IconReference"],
4008
+ ...issue2.suggestions?.length ? { suggestions: issue2.suggestions.map((value2) => ({ value: value2, label: value2, origin: "registered", definition: `${schemas.presentation.$id}#/$defs/IconReference` })) } : {}
4009
+ })
4010
+ );
4011
+ }
3911
4012
  return findings;
3912
4013
  }
3913
4014
  function narrativeFindings(document, options2) {
@@ -6357,7 +6458,7 @@ function chooseNext(value, candidates, alternative = "", max = 3) {
6357
6458
  return alternative ? sentence(alternative) : "choose a different value.";
6358
6459
  }
6359
6460
  function kindPhrase(kind) {
6360
- const phrases = { text: "text", code: "code", list: "a list", chart: "a chart", table: "a table", image: "an image", video: "a video", metric: "a metric", quote: "a quote", timeline: "a timeline", group: "a group" };
6461
+ const phrases = { text: "text", code: "code", list: "a list", chart: "a chart", table: "a table", image: "an image", video: "a video", metric: "a metric", quote: "a quote", timeline: "a timeline", shape: "a shape", group: "a group" };
6361
6462
  return phrases[kind] ?? `${/^[aeiou]/i.test(kind) ? "an" : "a"} ${kind}`;
6362
6463
  }
6363
6464
  function freshName(base, taken = []) {
@@ -6618,6 +6719,20 @@ var regionKind = (finding2) => {
6618
6719
  next: `remove ${code("region")} so OPF places the block by its kind, or pin it to a region that takes ${found[2]}.`
6619
6720
  };
6620
6721
  };
6722
+ var iconDropped = (finding2) => {
6723
+ const room = /no room for its chip/.test(finding2.message);
6724
+ return {
6725
+ message: room ? "An icon is not drawn: its chip would set the slide's text smaller." : "An icon is not drawn: icons mark first-level entries of an unnumbered list, metrics and groups.",
6726
+ next: room ? "shorten the text or give the slide more room, or remove the icon." : "move the icon to an entry, metric or group it can mark, or remove it."
6727
+ };
6728
+ };
6729
+ var arrangementAdapted = (finding2) => {
6730
+ const cards = /needs four entries/.test(finding2.message);
6731
+ return {
6732
+ message: cards ? "A matrix needs four entries, so this one is drawn as a grid of cards." : "This arrangement (a pyramid, matrix, cycle, row of chevrons or flow) is drawn as a list.",
6733
+ next: cards ? "write four entries for the quadrants, or choose another layout." : "shorten the entries, keep one level without descriptions, or choose another layout."
6734
+ };
6735
+ };
6621
6736
  var regionFull = (finding2) => {
6622
6737
  const found = match(finding2.message, /^Region '(.+?)' already holds its (\d+) block/);
6623
6738
  if (!found) return void 0;
@@ -6885,6 +7000,8 @@ var AUDIT_TEXT = {
6885
7000
  "opf/region-unknown": regionUnknown,
6886
7001
  "opf/region-kind": regionKind,
6887
7002
  "opf/region-full": regionFull,
7003
+ "opf/icon-dropped": iconDropped,
7004
+ "opf/arrangement-adapted": arrangementAdapted,
6888
7005
  "opf/layout-unplaced": layoutUnplaced,
6889
7006
  "opf/furniture-wraps": furnitureWraps,
6890
7007
  "opf/font-outside-scheme": fontOutsideScheme,
@@ -6980,6 +7097,58 @@ var imageOptionUnsupportedPayload = (finding2) => {
6980
7097
  next: `remove ${code(field)}, or move it onto an image.`
6981
7098
  };
6982
7099
  };
7100
+ var shapeOptionUnsupportedPayload = (finding2) => {
7101
+ const field = text(params(finding2).field) ?? match(finding2.message, /^(\w+) is only valid on a shape block/)?.[1];
7102
+ const type = text(params(finding2).type) ?? match(finding2.message, /; this payload is '(.+?)'/)?.[1];
7103
+ const kind = type ?? (/a group cannot carry them/.test(finding2.message) ? "group" : void 0);
7104
+ if (!field) return void 0;
7105
+ return {
7106
+ message: `${code(field)} only applies to shapes; this block is ${kind ? kindPhrase(kind) : "not a shape"}.`,
7107
+ next: `remove ${code(field)}, or make the block a shape with \`shape\` (a preset such as roundRect) or \`path\`.`
7108
+ };
7109
+ };
7110
+ var shapeAdjustUnknown = (finding2) => {
7111
+ const { name, shape, known } = params(finding2);
7112
+ if (typeof name !== "string") return void 0;
7113
+ const names2 = Array.isArray(known) ? known.filter((entry2) => typeof entry2 === "string") : [];
7114
+ if (shape === "path") return { message: `${code(`adjust.${name}`)} has no effect on a custom \`path\`: adjust values belong to presets.`, next: `remove ${code(`adjust.${name}`)}.` };
7115
+ return {
7116
+ message: `${text(shape) ?? "This preset"} has no adjust value ${code(name)}${names2.length ? `; it has ${names2.map(code).join(", ")}` : "; it has none"}.`,
7117
+ next: names2.length ? `use ${names2.map(code).join(" or ")}, or remove ${code(name)}.` : `remove ${code(`adjust.${name}`)}.`
7118
+ };
7119
+ };
7120
+ var shapeAdjustRange = (finding2) => {
7121
+ const { name, shape, value, min, max, unit } = params(finding2);
7122
+ if (typeof name !== "string" || typeof value !== "number") return void 0;
7123
+ const range = `${typeof min === "number" ? min : "no minimum"} to ${typeof max === "number" ? max : "no maximum"}`;
7124
+ return {
7125
+ message: `${code(`adjust.${name}`)} of ${text(shape) ?? "this preset"} is ${value}, outside ${range}${unit === "degrees" ? " degrees" : ""}, so the preset's default is drawn.`,
7126
+ next: `set it between ${range}.`
7127
+ };
7128
+ };
7129
+ var shapeLinkHidden = () => ({
7130
+ message: "This shape is hidden, so its `link` can never be clicked.",
7131
+ next: "remove `hidden`, or remove the `link`."
7132
+ });
7133
+ var shapeAnchorMissing = (finding2) => {
7134
+ const { id, known } = params(finding2);
7135
+ if (typeof id !== "string") return void 0;
7136
+ const ids = Array.isArray(known) ? known.filter((entry2) => typeof entry2 === "string") : [];
7137
+ return {
7138
+ message: `${code(`at.block: "${id}"`)} names no block on this slide, so the shape is not drawn.${ids.length ? ` Block ids on this slide: ${plainList(ids)}.` : " No block on this slide has an id."}`,
7139
+ next: chooseNext(id, ids, `give the block the shape belongs to ${code(`id: "${id}"`)}`)
7140
+ };
7141
+ };
7142
+ var connectorEndMissing = (finding2) => {
7143
+ const { id, side, known } = params(finding2);
7144
+ if (typeof id !== "string" || side !== "from" && side !== "to") return void 0;
7145
+ const ids = Array.isArray(known) ? known.filter((entry2) => typeof entry2 === "string") : [];
7146
+ if (/names a connector/.test(finding2.message)) return { message: `The connector's ${code(side)} names the connector ${code(id)}; a connector joins blocks and overlay shapes.`, next: `name a block or an overlay shape in ${code(side)}.` };
7147
+ return {
7148
+ message: `The connector's ${code(`${side}: "${id}"`)} names no block or overlay shape on this slide, so the connector is not drawn.${ids.length ? ` Ids on this slide: ${plainList(ids)}.` : " Nothing on this slide has an id."}`,
7149
+ next: chooseNext(id, ids, `give the block or shape it should join ${code(`id: "${id}"`)}`)
7150
+ };
7151
+ };
6983
7152
  var imagePlacementInvalid = (finding2) => {
6984
7153
  const { edge, blocks } = params(finding2);
6985
7154
  if (typeof edge === "string" && Array.isArray(blocks) && blocks.length === 2) {
@@ -7270,7 +7439,7 @@ function layoutSpot(finding2) {
7270
7439
  if (parts2[0] === "catalogs" && parts2[2] === "layouts") return { id: parts2[3], spot: dotted(parts2.slice(4)) };
7271
7440
  return { spot: dotted(parts2) };
7272
7441
  }
7273
- var layoutTemplate = (finding2) => {
7442
+ var layoutTemplate2 = (finding2) => {
7274
7443
  const { id, spot } = layoutSpot(finding2);
7275
7444
  const detail = finding2.message.trim().replace(/\.$/, "");
7276
7445
  return {
@@ -7356,6 +7525,25 @@ var unusedReference = (finding2, _context, helpers) => {
7356
7525
  next: `cite it from a text, bullet or list item (${code(`cite: "${id}"`)}), or remove it.`
7357
7526
  };
7358
7527
  };
7528
+ var iconUnknown = (finding2, _context, helpers) => {
7529
+ const value = helpers.valueAt(helpers.segments);
7530
+ if (typeof value !== "string") return void 0;
7531
+ const near = (finding2.suggestions ?? []).slice(0, 3).map((entry2) => String(entry2.value));
7532
+ const set = /^No icon set ([a-z][a-z0-9-]*) /.exec(finding2.message)?.[1];
7533
+ return {
7534
+ message: set ? `Icon set ${code(set)} is not embedded or registered, so ${code(value)} is not drawn.` : `${code(value)} is not an icon of its set or of the deck's ${code("icons")}, so it is not drawn.`,
7535
+ next: near.length ? `did you mean ${near.map((name) => code(name)).join(" or ")}?` : `pick a name the set has (search_icons finds them by keyword), add it to the deck's ${code("icons")}, or remove the icon.`
7536
+ };
7537
+ };
7538
+ var iconInvalid = (finding2, _context, helpers) => {
7539
+ const value = helpers.valueAt(helpers.segments);
7540
+ if (typeof value !== "string") return void 0;
7541
+ const why = /has (.+?); an icon draws only/.exec(finding2.message)?.[1];
7542
+ return {
7543
+ message: why ? `The SVG of ${code(value)} has ${why}, so it is not drawn.` : `${code(value)} cannot be drawn as an icon.`,
7544
+ next: "keep only shapes in its SVG (paths, circles, rectangles, lines, polygons), with no script, link or raster, or remove the icon."
7545
+ };
7546
+ };
7359
7547
  var unusedDataset = (finding2, _context, helpers) => {
7360
7548
  const id = helpers.segments.at(-1) ?? unquote(match(finding2.message, /^Dataset ("(?:[^"\\]|\\.)*") is never referenced/)?.[1]);
7361
7549
  if (!id) return void 0;
@@ -7411,6 +7599,12 @@ var FORMAT_TEXT = {
7411
7599
  "opf/caption-unsupported-payload": captionUnsupportedPayload,
7412
7600
  "opf/image-option-unsupported-payload": imageOptionUnsupportedPayload,
7413
7601
  "opf/image-placement-invalid": imagePlacementInvalid,
7602
+ "opf/shape-option-unsupported-payload": shapeOptionUnsupportedPayload,
7603
+ "opf/shape-adjust-unknown": shapeAdjustUnknown,
7604
+ "opf/shape-adjust-range": shapeAdjustRange,
7605
+ "opf/shape-link-hidden": shapeLinkHidden,
7606
+ "opf/shape-anchor-missing": shapeAnchorMissing,
7607
+ "opf/connector-end-missing": connectorEndMissing,
7414
7608
  "opf/layout-placeholder-group": layoutPlaceholderGroup,
7415
7609
  "opf/dataset-unknown": datasetUnknown,
7416
7610
  "opf/dataset-field-unknown": datasetFieldUnknown,
@@ -7430,12 +7624,14 @@ var FORMAT_TEXT = {
7430
7624
  "opf/asset-reference": assetReference,
7431
7625
  "opf/asset-cycle": assetCycle,
7432
7626
  "opf/catalog-record": catalogRecord,
7433
- "opf/layout-template": layoutTemplate,
7627
+ "opf/layout-template": layoutTemplate2,
7434
7628
  "opf/layout-region": layoutRegion,
7435
7629
  "opf/unresolved-reference": unresolvedReference2,
7436
7630
  "opf/catalog-record-not-in-source": catalogRecordNotInSource,
7437
7631
  "opf/unused-reference": unusedReference,
7438
7632
  "opf/unused-dataset": unusedDataset,
7633
+ "opf/icon-unknown": iconUnknown,
7634
+ "opf/icon-invalid": iconInvalid,
7439
7635
  "opf/unknown-beat": unknownBeat,
7440
7636
  "opf/slide-theme-dimensions": slideThemeDimensions,
7441
7637
  "opf/variable-unknown": variableUnknown,
@@ -7635,9 +7831,12 @@ var PATTERN_PHRASES = Object.freeze({
7635
7831
  "^[a-zA-Z0-9_-]+$": { what: "an id of letters, digits, hyphens and underscores, like `hero_1`", next: "remove spaces and other punctuation." },
7636
7832
  "^var:[a-z][a-z0-9-]*$": { what: "a variable reference like `var:brand`", next: "write `var:` and the id of a variable under `variables`." },
7637
7833
  "^var:organization(\\.[A-Za-z0-9_-]+)?\\.logo(\\.(full|stacked|icon|wordmark))?$": { what: "an organization logo reference like `var:organization.logo.full`", next: "write `var:organization.logo` and, if you want, `.full`, `.stacked`, `.icon` or `.wordmark`." },
7834
+ "^\\s*-?[0-9.]+([ ,]+-?[0-9.]+){3}\\s*$": { what: "a viewBox of four numbers, `minX minY width height`, like `0 0 24 24`", next: "write four numbers separated by spaces." },
7835
+ "^[a-z][A-Za-z0-9]*$": { what: "an adjust value name like `adj` or `adj1` (a letter, then letters and digits)", next: "use the name of one of the preset's adjust values (docs/shapes.md lists them)." },
7638
7836
  "^\\d{4}-\\d{2}-\\d{2}$": { what: "a date written year-month-day, like `2026-10-24`", next: "write the date as YYYY-MM-DD." },
7639
7837
  "^(?:https?://|mailto:|tel:)\\S+$": { what: "a web, email or phone address (`https://\u2026`, `mailto:\u2026` or `tel:\u2026`)", next: "start with https://, mailto: or tel:, and leave out spaces." },
7640
7838
  "^(https?://|mailto:|tel:)\\S+$": { what: "a web, email or phone address (`https://\u2026`, `mailto:\u2026` or `tel:\u2026`)", next: "start with https://, mailto: or tel:, and leave out spaces." },
7839
+ "^(?:[a-z][a-z0-9-]*:[a-z0-9][a-z0-9-]*|[a-z][a-z0-9-]*|(?:asset:|https://|data:|\\./|\\.\\./)\\S+)$": { what: "an icon like `lucide:truck` (a set and a name), the name of one of the deck's `icons`, or an SVG source (`asset:`, `https://`, `data:`, `./`)", next: "write the set and the icon name, such as lucide:truck (search_icons finds names), or the name of one of the deck's icons." },
7641
7840
  "^(asset:|https://|data:|\\./|\\.\\./)": { what: "a source that starts with `asset:`, `https://`, `data:`, `./` or `../`", next: "register the file under `assets` and write `asset:` and its id, or give an https:// address." },
7642
7841
  "^(?:https://[^\\s]+|pkg:[^\\s]+)$": { what: "an `https://` address or a `pkg:` reference", next: "write an address that starts with https:// or pkg:, without spaces." },
7643
7842
  "^(?:[A-Za-z]{2,3}|[iIxX])(?:-[A-Za-z0-9]{1,8})*$": { what: LANGUAGE, next: "write a language and, if needed, a region: `en-US`, `pt-BR`, `de`." },
@@ -7970,18 +8169,85 @@ function resolveSlideScriptMeasurement(presentation, slideIndex, measurement, op
7970
8169
  return slideScriptMeasurement(presentation, slideIndex, measurement, { ...options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {}, fontFamilies, serif: fontScheme.type === "serif" });
7971
8170
  }
7972
8171
 
7973
- // src/slide-context.ts
8172
+ // src/message-surface.ts
7974
8173
  var rec2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
8174
+ var MESSAGE_SURFACE_SLOT = "accent1";
8175
+ var MESSAGE_SURFACE_CONTRAST = 4.5;
8176
+ function messageKind(slide, layout) {
8177
+ const lone = lonePayload(slide);
8178
+ if (lone?.field !== "text" || annotationText(slide.subtitle).trim()) return void 0;
8179
+ let plan;
8180
+ try {
8181
+ plan = isLayoutTemplate(layout) ? layoutTemplate(layout) : void 0;
8182
+ } catch {
8183
+ return void 0;
8184
+ }
8185
+ if (plan?.stack !== void 0 && statementMessage(slide, plan) !== void 0) return "statement-message";
8186
+ if (plan && (plan.regions.length > 1 || plan.regions.some((region) => region.role === "media" || region.flow === "grid"))) return void 0;
8187
+ const value = lone.host.text;
8188
+ const cited = Array.isArray(value) && value.some((run) => run && typeof run === "object" && (run.cite !== void 0 || run.footnote !== void 0));
8189
+ return !cited && messageWords(value) > 0 && messageWords(value) <= SHORT_MESSAGE_WORDS ? "display-message" : void 0;
8190
+ }
8191
+ function lchOf(hex) {
8192
+ const lin = (at2) => {
8193
+ const value = Number.parseInt(hex.slice(at2, at2 + 2), 16) / 255;
8194
+ return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
8195
+ };
8196
+ const [r, g, b] = [lin(1), lin(3), lin(5)];
8197
+ const x = (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047, y = 0.2126729 * r + 0.7151522 * g + 0.072175 * b, z = (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883;
8198
+ const f = (t) => t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116;
8199
+ const [fx, fy, fz] = [f(x), f(y), f(z)];
8200
+ return { L: 116 * fy - 16, C: Math.hypot(500 * (fx - fy), 200 * (fy - fz)) };
8201
+ }
8202
+ var MESSAGE_SURFACE_MAX_LIGHTNESS = 60;
8203
+ var MESSAGE_SURFACE_MAX_CHROMA = 80;
8204
+ function resolveMessageSurface(presentation, slide, layout, context) {
8205
+ const deckDesign = rec2(rec2(presentation).design);
8206
+ const kind = messageKind(slide, layout), named = layoutVariantKind(layout);
8207
+ if (kind === void 0 || !(named === void 0 || named === "surface") || deckBackgroundIsChosen(deckDesign, context.theme.background) || !layoutVariantApplies(slide.design, layout, deckDesign, context.theme.background, true)) return void 0;
8208
+ const below = colorChoice([deckDesign, context.theme], context.colorScheme, context.variables);
8209
+ const variant = { background: MESSAGE_SURFACE_SLOT, ...below.variant?.accents ? { accents: below.variant.accents } : {} };
8210
+ const plain = resolveColorRoles(context.colorScheme, { background: below.background, variant: below.variant });
8211
+ const deliberate = [deckDesign, ...context.themeChosen ? [context.theme] : []].some((level) => level.background !== void 0 || level.variant !== void 0);
8212
+ if (plain.dark && deliberate) return void 0;
8213
+ const accent = resolveColorRoles(context.colorScheme, { variant }), shade = lchOf(accent.background.slice(0, 7).toUpperCase());
8214
+ if (accent.background.toUpperCase() === plain.background.toUpperCase() || (colorContrast(accent.text, accent.background) ?? 0) < MESSAGE_SURFACE_CONTRAST || shade.L > MESSAGE_SURFACE_MAX_LIGHTNESS || shade.C > MESSAGE_SURFACE_MAX_CHROMA) return void 0;
8215
+ return { kind, variant };
8216
+ }
8217
+ function drawsAccentByDesign(presentation, host, record, theme) {
8218
+ const deckDesign = rec2(rec2(presentation).design), own4 = normalizeColorVariant(rec2(host.design).variant), named = layoutColorVariant(record);
8219
+ if (own4) return own4.background.startsWith("accent");
8220
+ return named !== void 0 && layoutVariantApplies(host.design, record, deckDesign, theme.background) && named.background.startsWith("accent");
8221
+ }
8222
+ function messageDisplayed(result, kind) {
8223
+ const scale = Math.min(result.width, result.height) / 720, size = (field) => result.items.find((item) => item.field === field)?.text?.fontSize;
8224
+ const text2 = size("text"), title = size("title");
8225
+ if (kind === "statement-message") return text2 !== void 0 && text2 / scale >= LONE_DISPLAY_SIZES.text - 1e-6 || title !== void 0 && title / scale > 54 + 1e-6;
8226
+ return text2 !== void 0 && text2 / scale > LONE_DISPLAY_SIZES.text + 1e-6;
8227
+ }
8228
+
8229
+ // src/slide-context.ts
8230
+ var rec3 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
8231
+ function unpathed(measurement) {
8232
+ const bare = (style) => ({ ...style, path: void 0 });
8233
+ return {
8234
+ ...measurement,
8235
+ measure: (text2, size, style) => measurement.measure(text2, size, bare(style)),
8236
+ ...measurement.resolveStyle ? { resolveStyle: (style) => measurement.resolveStyle(bare(style)) } : {},
8237
+ ...measurement.outlineBounds ? { outlineBounds: (text2, size, style) => measurement.outlineBounds(text2, size, bare(style)) } : {},
8238
+ ...measurement.forScripts ? { forScripts: (profile) => unpathed(measurement.forScripts(profile)) } : {}
8239
+ };
8240
+ }
7975
8241
  function resolveSlideContext(presentation, index, options2 = {}) {
7976
- const deck = rec2(presentation);
8242
+ const deck = rec3(presentation);
7977
8243
  const slides = Array.isArray(deck.slides) ? deck.slides : [];
7978
8244
  if (!Number.isInteger(index) || index < 0 || index >= slides.length) throw new RangeError(`Slide index ${String(index)} is outside the presentation's ${slides.length} slides.`);
7979
- const slide = rec2(slides[index]);
8245
+ const slide = rec3(slides[index]);
7980
8246
  const catalogs = { catalogs: checkCatalogsOption(options2.catalogs, "resolveSlideContext") };
7981
8247
  const records = resolveDesignRecords(presentation, index, catalogs);
7982
8248
  const diagnostics = [...records.diagnostics];
7983
8249
  const { theme, colorScheme, fontScheme } = records;
7984
- const design = { ...rec2(deck.design), ...rec2(slide.design) };
8250
+ const design = { ...rec3(deck.design), ...rec3(slide.design) };
7985
8251
  let layout;
7986
8252
  let layoutProvenance;
7987
8253
  if (typeof slide.layout === "string" && slide.layout !== "auto") {
@@ -7992,28 +8258,55 @@ function resolveSlideContext(presentation, index, options2 = {}) {
7992
8258
  } else diagnostics.push(unresolvedReference(presentation, "layouts", slide.layout, `slides.${index}.layout`, catalogs));
7993
8259
  }
7994
8260
  if (options2.strictReferences && diagnostics.length) throw new OPFUnresolvedReferenceError(diagnostics);
7995
- const levels = colorLevels(rec2(slide.design), layout, rec2(deck.design), theme, colorScheme, rec2(deck.variables));
7996
- const roles = resolveColorRoles(colorScheme, colorChoice(levels, colorScheme, rec2(deck.variables)));
7997
- const layoutVariant = levels.length > 3 && layoutVariantApplies(slide.design, layout, deck.design, theme.background) ? levels[1].variant : void 0;
7998
- const composeOptions = {
7999
- ...resolveCanvasDimensions(design.dimensions ?? theme.dimensions),
8000
- ...layout ? { layout } : {},
8001
- presentation,
8002
- slideIndex: index,
8003
- slideNumber: options2.slideNumber ?? index + 1,
8004
- slideCount: options2.slideCount ?? slides.length,
8005
- fontFamilies: resolveFontFamilies(fontScheme),
8006
- darkBackground: roles.dark,
8007
- // LH-02: the colors the automatic scrim of a picture background is sized for.
8008
- roles: { text: roles.text, textSecondary: roles.textSecondary, primary: roles.primary, background: roles.background },
8009
- ...theme.background !== void 0 ? { themeBackground: theme.background } : {},
8010
- // OPF 0.19: a theme may carry the shared design keys (between the deck's design and the layout record's).
8011
- ...theme.design !== void 0 && rec2(theme.design) === theme.design ? { themeDesign: theme.design } : {},
8012
- ...options2.fonts?.textMeasurement ? { textMeasurement: options2.fonts.textMeasurement } : {},
8013
- ...options2.date !== void 0 ? { date: options2.date } : {}
8014
- };
8015
- const resolvedSlide = resolveSlideVariables(slide, { slideNumber: composeOptions.slideNumber, slideCount: composeOptions.slideCount, presentation, darkBackground: composeOptions.darkBackground === true });
8016
- return { slide: resolvedSlide, options: composeOptions, diagnostics, resolved: { theme, colorScheme, roles, fontScheme, fontSchemePath: records.fontSchemePath, ...layout ? { layout } : {}, ...layoutVariant ? { layoutVariant } : {}, provenance: { ...layoutProvenance ? { layout: layoutProvenance } : {}, ...records.provenance } } };
8261
+ const candidate = resolveMessageSurface(presentation, slide, layout, { theme, colorScheme, variables: rec3(deck.variables), themeChosen: records.provenance.theme !== void 0 });
8262
+ const build = (surface) => {
8263
+ const levels = colorLevels(rec3(slide.design), layout, rec3(deck.design), theme, colorScheme, rec3(deck.variables), surface?.variant);
8264
+ const roles2 = resolveColorRoles(colorScheme, colorChoice(levels, colorScheme, rec3(deck.variables)));
8265
+ const layoutVariant2 = levels.length > 3 && layoutVariantApplies(slide.design, layout, deck.design, theme.background, surface) ? levels[1].variant : void 0;
8266
+ const composeOptions2 = {
8267
+ ...resolveCanvasDimensions(design.dimensions ?? theme.dimensions),
8268
+ ...layout ? { layout } : {},
8269
+ presentation,
8270
+ slideIndex: index,
8271
+ slideNumber: options2.slideNumber ?? index + 1,
8272
+ slideCount: options2.slideCount ?? slides.length,
8273
+ fontFamilies: resolveFontFamilies(fontScheme),
8274
+ darkBackground: roles2.dark,
8275
+ ...surface ? { messageSurface: surface, resolveRunColor: (reference) => resolveColorRef(reference, { colorScheme, roles: roles2, variables: rec3(deck.variables), fallback: "" }) || void 0 } : {},
8276
+ // LH-02: the colors the automatic scrim of a picture background is sized for.
8277
+ roles: { text: roles2.text, textSecondary: roles2.textSecondary, primary: roles2.primary, background: roles2.background },
8278
+ ...theme.background !== void 0 ? { themeBackground: theme.background } : {},
8279
+ // OPF 0.19: a theme may carry the shared design keys (between the deck's design and the layout record's).
8280
+ ...theme.design !== void 0 && rec3(theme.design) === theme.design ? { themeDesign: theme.design } : {},
8281
+ ...options2.fonts?.textMeasurement ? { textMeasurement: options2.fonts.textMeasurement } : {},
8282
+ ...options2.date !== void 0 ? { date: options2.date } : {}
8283
+ };
8284
+ return { levels, roles: roles2, layoutVariant: layoutVariant2, composeOptions: composeOptions2 };
8285
+ };
8286
+ const variablesOf = (made) => resolveSlideVariables(slide, { slideNumber: made.composeOptions.slideNumber, slideCount: made.composeOptions.slideCount, presentation, darkBackground: made.composeOptions.darkBackground === true });
8287
+ let messageSurface = candidate, built = build(candidate);
8288
+ if (candidate) {
8289
+ const plain = build(void 0);
8290
+ const host = plain.composeOptions.textMeasurement;
8291
+ const measurement = host ? unpathed(slideScriptMeasurement(presentation, index, host, { ...catalogs, fontFamilies: resolveFontFamilies(fontScheme), serif: fontScheme.type === "serif" })) : host;
8292
+ let displayed = false;
8293
+ try {
8294
+ displayed = messageDisplayed(composeSlide(variablesOf(plain), { ...plain.composeOptions, ...measurement ? { textMeasurement: measurement } : {} }), candidate.kind);
8295
+ } catch {
8296
+ displayed = false;
8297
+ }
8298
+ if (displayed && index > 0) {
8299
+ const before = rec3(slides[index - 1]), record = typeof before.layout === "string" && before.layout !== "auto" ? resolveReference(presentation, "layouts", before.layout, catalogs)?.record : void 0;
8300
+ if (drawsAccentByDesign(presentation, before, record, theme) || resolveSlideContext(presentation, index - 1, { ...options2, slideNumber: void 0 }).resolved.messageSurface !== void 0) displayed = false;
8301
+ }
8302
+ if (!displayed) {
8303
+ messageSurface = void 0;
8304
+ built = plain;
8305
+ }
8306
+ }
8307
+ const { roles, layoutVariant, composeOptions } = built;
8308
+ const resolvedSlide = variablesOf(built);
8309
+ return { slide: resolvedSlide, options: composeOptions, diagnostics, resolved: { theme, colorScheme, roles, fontScheme, fontSchemePath: records.fontSchemePath, ...layout ? { layout } : {}, ...layoutVariant ? { layoutVariant } : {}, ...messageSurface ? { messageSurface } : {}, provenance: { ...layoutProvenance ? { layout: layoutProvenance } : {}, ...records.provenance } } };
8017
8310
  }
8018
8311
 
8019
8312
  // src/rule-slides.ts
@@ -8388,4 +8681,4 @@ function assertValidCatalogRecord(kind, value) {
8388
8681
  if (!report2.valid) throw new OPFValidationError(report2);
8389
8682
  }
8390
8683
 
8391
- export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, CATALOG_SCHEMA, COMMON_KEYS, DEFAULT_VALIDATION_THRESHOLDS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SOURCE_EXPLAIN, SPAN_FLAGS, SPAN_VALUES, UNRANKED_PRIORITY, activeSchema, analyzeJsonSyntax, applyPatch, applyPatchWithInverse, applyTextEdits, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogKindAt, catalogSchemaNames, createLocator, createSchemaValue, describeField, describeFinding, distance2 as distance, documentHash, escapePointerToken, findValidationRule, formatPointer, getAtPointer, hasPointer, idToken, invertPatch, isIdToken, isPromotedRegionKey, jsonEqual, listSchemaFields, nearest, normalizePatch, parsePointer, parseSource, pointerFromPath, readPointer, rememberByText, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSchema, resolveSlideContext, resolveSlideScriptMeasurement, ruleDocumentation, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, segmentsOf, splitOpfPath, splitPointer2 as splitPointer, starterValue, toIdPatch, toIdPointer, unescapePointerToken, us, validate, validateCatalogRecord, validationCategories, validationRules, walkPatch };
8684
+ export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, CATALOG_SCHEMA, COMMON_KEYS, DEFAULT_VALIDATION_THRESHOLDS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SOURCE_EXPLAIN, SPAN_FLAGS, SPAN_VALUES, UNRANKED_PRIORITY, activeSchema, analyzeJsonSyntax, applyPatch, applyPatchWithInverse, applyTextEdits, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogIconKinds, catalogKindAt, catalogSchemaNames, createLocator, createSchemaValue, describeField, describeFinding, distance2 as distance, documentHash, escapePointerToken, findValidationRule, formatPointer, getAtPointer, hasPointer, idToken, invertPatch, isIdToken, isPromotedRegionKey, jsonEqual, listSchemaFields, nearest, normalizePatch, parsePointer, parseSource, pointerFromPath, readPointer, rememberByText, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSchema, resolveSlideContext, resolveSlideScriptMeasurement, ruleDocumentation, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, segmentsOf, splitOpfPath, splitPointer2 as splitPointer, starterValue, toIdPatch, toIdPointer, unescapePointerToken, us, validate, validateCatalogRecord, validationCategories, validationRules, walkPatch };