@openpresentation/opf 0.34.0 → 0.34.2

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 (83) hide show
  1. package/dist/browser.js +18 -18
  2. package/dist/{catalog-refs-CoIrOdAw.d.ts → catalog-refs-wtuudZTe.d.ts} +12 -3
  3. package/dist/{catalog-schemas-FjLRPtjB.d.ts → catalog-schemas-CSxuFtsu.d.ts} +1 -1
  4. package/dist/{chunk-HHVQ2SDT.js → chunk-6MSH3KCZ.js} +1 -1
  5. package/dist/{chunk-QGJVOPLG.js → chunk-AQ3WR3H7.js} +2 -2
  6. package/dist/{chunk-2HX4BGAS.js → chunk-EQCZ2SFD.js} +6 -6
  7. package/dist/chunk-HSXWDXKM.js +1 -0
  8. package/dist/{chunk-RUV7CCE6.js → chunk-HX4HEJB4.js} +201 -21
  9. package/dist/{chunk-QGTJF7HV.js → chunk-IDYYLJCQ.js} +6 -6
  10. package/dist/{chunk-CJVKOJ6B.js → chunk-IGT4523S.js} +406 -58
  11. package/dist/{chunk-U7TYSPYM.js → chunk-KJFCHCWV.js} +2 -2
  12. package/dist/{chunk-WMFT5R7I.js → chunk-MDAXXFAY.js} +2 -2
  13. package/dist/{chunk-HUGVYHZ2.js → chunk-NMZCPZ3R.js} +3 -3
  14. package/dist/{chunk-F6BXO4AI.js → chunk-P2X4BBW2.js} +1 -1
  15. package/dist/{chunk-3THGTDL2.js → chunk-PHOSM2RA.js} +1 -1
  16. package/dist/{chunk-FIQMAIZV.js → chunk-RM4Z7ZSW.js} +4 -4
  17. package/dist/{chunk-244OPLAV.js → chunk-UKI43JE6.js} +1 -1
  18. package/dist/{chunk-DQ7QYOUV.js → chunk-V4G3BYPY.js} +2 -2
  19. package/dist/{chunk-LCT5ZV3Q.js → chunk-VI7VWDTN.js} +17 -1
  20. package/dist/{chunk-36DLVJGW.js → chunk-VVPPMHP6.js} +5 -5
  21. package/dist/{chunk-FAXO3SUE.js → chunk-WBPXRUZT.js} +463 -271
  22. package/dist/{chunk-42JBXJKW.js → chunk-XLXCXEVF.js} +2 -2
  23. package/dist/{composition-CvtvgBDE.d.ts → composition-DF07Ha4R.d.ts} +154 -135
  24. package/dist/composition.d.ts +2 -2
  25. package/dist/composition.js +1 -1
  26. package/dist/{conversion-B_5AKTYQ.d.ts → conversion-52ki0lfZ.d.ts} +9 -7
  27. package/dist/conversion-F3HSCFOV.js +25 -0
  28. package/dist/convert.d.ts +2 -2
  29. package/dist/convert.js +7 -7
  30. package/dist/data.d.ts +1 -1
  31. package/dist/data.js +2 -2
  32. package/dist/{deck-report-BVlQZ42f.d.ts → deck-report-C3EsoHC3.d.ts} +3 -3
  33. package/dist/deck.d.ts +5 -5
  34. package/dist/deck.js +11 -11
  35. package/dist/diff.js +4 -4
  36. package/dist/docs.js +18 -18
  37. package/dist/example-files/technical/assets/alice.png +0 -0
  38. package/dist/example-files/technical/assets/context-photo.png +0 -0
  39. package/dist/example-files/technical/assets/cover-image.png +0 -0
  40. package/dist/example-files/technical/assets/cover.png +0 -0
  41. package/dist/example-files/technical/assets/diagram.svg +1 -0
  42. package/dist/example-files/technical/assets/icon.svg +1 -0
  43. package/dist/example-files/technical/assets/logo-dark.svg +1 -0
  44. package/dist/example-files/technical/assets/logo-light.svg +1 -0
  45. package/dist/example-files/technical/assets/logo.svg +1 -0
  46. package/dist/example-files/technical/assets/primary-logo.svg +1 -0
  47. package/dist/example-files/technical/assets/product-shot.png +0 -0
  48. package/dist/example-files/technical/assets/watermark.png +0 -0
  49. package/dist/example-files/technical/assets/wordmark.svg +1 -0
  50. package/dist/examples.js +49 -1
  51. package/dist/format.js +2 -2
  52. package/dist/ids.js +4 -4
  53. package/dist/index.d.ts +12 -12
  54. package/dist/index.js +21 -21
  55. package/dist/markdown.d.ts +1 -1
  56. package/dist/markdown.js +8 -8
  57. package/dist/node-engine.d.ts +21 -7
  58. package/dist/node-engine.js +37 -21
  59. package/dist/{pagination-CZQQYk7L.d.ts → pagination-Do7vNgU-.d.ts} +2 -2
  60. package/dist/pagination.d.ts +3 -3
  61. package/dist/pagination.js +4 -4
  62. package/dist/patch.js +3 -3
  63. package/dist/precompiled.js +2 -2
  64. package/dist/{presentation-s9262acV.d.ts → presentation-ANs2WkaS.d.ts} +8 -0
  65. package/dist/schema-engine-ajv.js +1 -1
  66. package/dist/schema-engine-precompiled.js +2 -2
  67. package/dist/schema.d.ts +2 -2
  68. package/dist/schema.js +3 -3
  69. package/dist/schemas.js +1 -1
  70. package/dist/source.d.ts +5 -0
  71. package/dist/source.js +10 -10
  72. package/dist/spec/schemas/icon-set.schema.json +5 -0
  73. package/dist/spec/schemas/opf.schema.json +9 -1
  74. package/dist/symbol-font-encodings.js +12695 -12736
  75. package/dist/types.d.ts +2 -2
  76. package/dist/{validation-types-CYbsUuZ9.d.ts → validation-types-BNS41nzb.d.ts} +2 -2
  77. package/dist/validator.d.ts +4 -4
  78. package/dist/validator.js +3 -3
  79. package/dist/yaml.d.ts +1 -1
  80. package/dist/yaml.js +7 -7
  81. package/package.json +7 -7
  82. package/dist/chunk-UJZN2ZH6.js +0 -1
  83. package/dist/conversion-CMBGOTAC.js +0 -25
@@ -1,6 +1,6 @@
1
1
  import { original } from './chunk-JBARNYFR.js';
2
- import { schemas, schemaEntries } from './chunk-LCT5ZV3Q.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, intrinsicImageSize, resolveReference, layoutTable, colorTransform, applyColorTransform, resolveColorRef, readingRows, visualReadingOrder, numberingSystemExtension, isSupportedNumberingSystem, plainLanguageTag, supportedNumberingSystems, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, composeSlide, resolveColorRoles, layoutVariantApplies, resolveCanvasDimensions, resolveSlideVariables, layoutVariantKind, deckBackgroundIsChosen, LONE_DISPLAY_SIZES, normalizeColorVariant, layoutColorVariant, inlineDatasets, hasBuiltinDependency, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, deckBackgroundIsFixed, resolveScriptFonts, lonePayload, annotationText, isLayoutTemplate, layoutTemplate, statementMessage, messageWords, SHORT_MESSAGE_WORDS, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, documentIcons, iconIssue, walkCitationRuns, HALF_STEPPED, MAX_COMPOSITION_DEPTH, isOverlayConnector, connectorAdjustPreset, shapeIssues, pathFor, overlayIssues, datasetDiagnostics, defaultSlideBackground, catalogRecords, collectCitations, resolveSlideDirection, numberingFindings, chartDrawDiagnostics, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, representablePositionBox, PositionRangeError, isShapeBlock, OPFCompositionError } from './chunk-CJVKOJ6B.js';
2
+ import { schemas, schemaEntries } from './chunk-VI7VWDTN.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, intrinsicImageSize, resolveReference, layoutTable, colorTransform, applyColorTransform, resolveColorRef, readingRows, visualReadingOrder, numberingSystemExtension, isSupportedNumberingSystem, plainLanguageTag, supportedNumberingSystems, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, composeSlide, resolveColorRoles, layoutVariantApplies, resolveCanvasDimensions, resolveSlideVariables, layoutVariantKind, deckBackgroundIsChosen, LONE_DISPLAY_SIZES, normalizeColorVariant, layoutColorVariant, inlineDatasets, hasBuiltinDependency, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, deckBackgroundIsFixed, resolveScriptFonts, lonePayload, annotationText, isLayoutTemplate, layoutTemplate, statementMessage, messageWords, SHORT_MESSAGE_WORDS, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, documentIcons, iconIssue, walkCitationRuns, HALF_STEPPED, MAX_COMPOSITION_DEPTH, isOverlayConnector, connectorAdjustPreset, shapeIssues, pathFor, overlayIssues, datasetDiagnostics, defaultSlideBackground, catalogRecords, collectCitations, resolveSlideDirection, numberingFindings, chartDrawDiagnostics, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, relatedName, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, representablePositionBox, PositionRangeError, isShapeBlock, OPFCompositionError } from './chunk-IGT4523S.js';
4
4
  import { schemaEngine } from '#schema-engine';
5
5
  import { parseTree, printParseErrorCode, getNodePath } from 'jsonc-parser';
6
6
 
@@ -89,7 +89,113 @@ function unusedReferenceWarnings(value) {
89
89
  return value.references.flatMap((reference, index) => isRecord(reference) && typeof reference.id === "string" && unused.includes(reference.id) ? [issue(`/references/${index}`, `reference '${reference.id}' is never cited; cite it with a run's cite field or remove it`, { code: "unused-reference", id: reference.id })] : []);
90
90
  }
91
91
 
92
+ // src/finding-text-util.ts
93
+ var WORDS = { object: "an object", array: "a list", string: "text", number: "a number", integer: "a whole number", boolean: "true or false", null: "null" };
94
+ var KIND_WORDS = { layouts: "layout", themes: "theme", colorSchemes: "color scheme", fontSchemes: "font scheme", narratives: "narrative", audiences: "audience", purposes: "purpose", tones: "tone", languages: "language" };
95
+ var KIND_EXAMPLES = { layouts: "`pillars` or `acme:hero`", themes: "`minimal` or `acme:bold`", colorSchemes: "`boost` or `acme:night`", fontSchemes: "`aptos` or `acme:brand`", narratives: "`classic-story`", audiences: "`board`", purposes: "`inform`", tones: "`formal`" };
96
+ var ALIASES = { middle: "center", centre: "center", centered: "center", centred: "center", justify: "start", left: "start", right: "end", col: "column", cols: "column", pic: "image", picture: "image", photo: "image", paragraph: "text", bullets: "list", bullet: "list" };
97
+ function segmentsOf(path) {
98
+ if (Array.isArray(path)) return path.map(String);
99
+ if (typeof path !== "string" || path === "" || path === "/") return [];
100
+ return path.replace(/^\//, "").split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
101
+ }
102
+ function pointerOf(segments) {
103
+ return segments.map((part) => `/${String(part).replaceAll("~", "~0").replaceAll("/", "~1")}`).join("");
104
+ }
105
+ var code = (value) => `\`${String(value)}\``;
106
+ var isIndex = (segment) => /^\d+$/.test(String(segment));
107
+ function cap(text2) {
108
+ return text2.startsWith("`") ? text2 : text2.charAt(0).toUpperCase() + text2.slice(1);
109
+ }
110
+ function fieldLabel(segments) {
111
+ if (!segments.length) return "the deck";
112
+ const last = segments[segments.length - 1];
113
+ if (isIndex(last)) {
114
+ const owner = [...segments].reverse().find((segment) => !isIndex(segment));
115
+ return owner === "slides" ? `slide ${Number(last) + 1}` : owner ? `${owner} entry ${Number(last) + 1}` : `entry ${Number(last) + 1}`;
116
+ }
117
+ return code(last);
118
+ }
119
+ function placeWords(segments) {
120
+ if (!segments.length) return "at the top level";
121
+ const slide = segments[0] === "slides" && segments.length >= 2 && isIndex(segments[1]) ? Number(segments[1]) + 1 : void 0;
122
+ if (slide !== void 0 && segments.length === 2) return `in slide ${slide}`;
123
+ const last = segments[segments.length - 1];
124
+ const inner = isIndex(last) ? fieldLabel(segments) : code(last);
125
+ return slide !== void 0 ? `in ${inner} of slide ${slide}` : `in ${inner}`;
126
+ }
127
+ function containerName(segments) {
128
+ if (!segments.length) return "the deck";
129
+ if (segments.length === 2 && segments[0] === "slides" && isIndex(segments[1])) return "a slide";
130
+ const last = segments[segments.length - 1];
131
+ return isIndex(last) ? fieldLabel(segments) : code(last);
132
+ }
133
+ function describeValue(value) {
134
+ if (value === void 0) return "missing";
135
+ if (value === null) return "null";
136
+ if (Array.isArray(value)) return value.length ? `a list of ${value.length}` : "an empty list";
137
+ if (typeof value === "object") return "an object";
138
+ if (typeof value === "string") return value === "" ? "empty" : code(value.length > 30 ? `${value.slice(0, 29)}\u2026` : value);
139
+ return `${typeof value === "number" ? "a number" : "true or false"} (${code(String(value))})`;
140
+ }
141
+ function describeKind(value) {
142
+ if (typeof value === "string") return value === "" ? "empty text" : `text (${describeValue(value)})`;
143
+ return describeValue(value);
144
+ }
145
+ function typeWords(type) {
146
+ const list = (Array.isArray(type) ? type : [type]).filter(Boolean).map((entry2) => WORDS[String(entry2)] ?? String(entry2));
147
+ return [...new Set(list)].join(" or ") || "a different kind of value";
148
+ }
149
+ function distance(a, b) {
150
+ const x = a.toLowerCase();
151
+ const y = b.toLowerCase();
152
+ if (x === y) return 0;
153
+ const row = Array.from({ length: y.length + 1 }, (_, index) => index);
154
+ for (let i = 1; i <= x.length; i++) {
155
+ let previous = row[0];
156
+ row[0] = i;
157
+ for (let j = 1; j <= y.length; j++) {
158
+ const keep3 = row[j];
159
+ row[j] = Math.min(row[j] + 1, row[j - 1] + 1, previous + (x[i - 1] === y[j - 1] ? 0 : 1));
160
+ previous = keep3;
161
+ }
162
+ }
163
+ return row[y.length];
164
+ }
165
+ function nearest(value, candidates, limit = 5) {
166
+ const text2 = String(value ?? "");
167
+ const alias = ALIASES[text2.toLowerCase()];
168
+ const ranked = candidates.map((candidate) => ({ candidate, score: String(candidate).toLowerCase() === alias ? 0 : distance(text2, String(candidate)) }));
169
+ ranked.sort((a, b) => a.score - b.score);
170
+ const close = ranked.filter((entry2) => entry2.score <= Math.max(2, Math.floor(text2.length / 4))).map((entry2) => entry2.candidate);
171
+ return { close: close.slice(0, limit), all: ranked.map((entry2) => entry2.candidate) };
172
+ }
173
+ function valueList(values, max = 5) {
174
+ const list = values.map((value) => typeof value === "string" ? value : JSON.stringify(value));
175
+ if (list.length <= max) return list.length > 1 ? `${list.slice(0, -1).join(", ")} or ${list.at(-1)}` : list.join("");
176
+ return `one of ${list.length} values (${list.slice(0, 3).join(", ")}, \u2026)`;
177
+ }
178
+ var firstSentence = (text2) => /^.*?[.!?](?=\s|$)/.exec(String(text2 ?? "").replace(/\s+/g, " ").trim())?.[0] ?? "";
179
+ function asNext(text2) {
180
+ const trimmed = text2.trim();
181
+ return /^[A-Z][a-z]/.test(trimmed) ? trimmed.charAt(0).toLowerCase() + trimmed.slice(1) : trimmed;
182
+ }
183
+ var isRecord2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
184
+ function readAt(document, segments) {
185
+ let value = document;
186
+ for (const segment of segments) {
187
+ if (Array.isArray(value)) value = value[Number(segment)];
188
+ else if (isRecord2(value)) value = value[segment];
189
+ else return void 0;
190
+ }
191
+ return value;
192
+ }
193
+
92
194
  // src/union-errors.ts
195
+ function respellings(typed, declared) {
196
+ const limit = typed.length <= 3 ? 1 : 2;
197
+ return declared.map((name) => ({ name, away: distance(typed, name) })).filter(({ name, away }) => name !== typed && away <= limit && relatedName(typed, name)).sort((a, b) => a.away - b.away || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)).map(({ name }) => name);
198
+ }
93
199
  var isUnion = (error) => (error.keyword === "oneOf" || error.keyword === "anyOf") && Array.isArray(error.schema);
94
200
  var key = (error) => `${error.instancePath}\0${error.keyword}\0${error.message}\0${JSON.stringify(error.params)}`;
95
201
  var depth = (pointer4) => pointer4 ? pointer4.split("/").length - 1 : 0;
@@ -139,10 +245,10 @@ function analyze(engine, rootId, union) {
139
245
  if (!validate2) return void 0;
140
246
  if (validate2(union.data) === true) return void 0;
141
247
  const raw = (validate2.errors ?? []).map((error) => ({ ...error, instancePath: union.instancePath + error.instancePath }));
142
- results.push({ label: branchLabel(branch, index), errors: raw });
248
+ results.push({ label: branchLabel(branch, index), errors: raw, branch });
143
249
  }
144
250
  const span = /* @__PURE__ */ new Set([key(union), ...results.flatMap((result) => result.errors.map(key))]);
145
- const reduced = results.map((result) => ({ label: result.label, errors: bestMatchErrors(engine, rootId, result.errors) }));
251
+ const reduced = results.map((result) => ({ label: result.label, branch: result.branch, errors: bestMatchErrors(engine, rootId, result.errors) }));
146
252
  const mismatch = (error) => {
147
253
  const level = depth(error.instancePath) - base;
148
254
  return level === 0 && (error.keyword === "type" || isUnion(error)) || level === 1 && error.keyword === "const";
@@ -159,7 +265,22 @@ function analyze(engine, rootId, union) {
159
265
  const types = [...new Set(rootTypes.flatMap((list) => list.flatMap((error) => [error.params.type].flat())))].map(String);
160
266
  return { union, span, replacement: [{ ...union, message: plain ? `must be ${named(types)}` : union.message, alternatives: summary(reduced) }] };
161
267
  }
162
- const top = ranked.filter((result) => reach(result.errors) === reach(lead.errors));
268
+ let top = ranked.filter((result) => reach(result.errors) === reach(lead.errors));
269
+ const keys = isObject(union.data) ? Object.keys(union.data) : [];
270
+ const rejected = (errors) => new Set(errors.filter((error) => error.keyword === "additionalProperties" && error.instancePath === union.instancePath).map((error) => String(error.params.additionalProperty)));
271
+ const accepted = (errors) => {
272
+ const unknown = rejected(errors);
273
+ return keys.filter((name) => !unknown.has(name)).length;
274
+ };
275
+ const most = Math.max(...top.map((result) => accepted(result.errors)));
276
+ if (keys.length && most > 0) top = top.filter((result) => accepted(result.errors) === most);
277
+ const declared = (errors) => errors.flatMap((error) => error.keyword === "additionalProperties" && error.instancePath === union.instancePath && isObject(error.parentSchema) && isObject(error.parentSchema.properties) ? Object.keys(error.parentSchema.properties) : []);
278
+ if (keys.length && most === 0 && top.every((result) => !keys.some((name) => respellings(name, declared(result.errors)).length))) {
279
+ const belongsTo = homesOf(rootId, keys);
280
+ const params2 = { properties: keys, ...belongsTo.length ? { belongsTo } : {} };
281
+ const alternatives = reduced.map((result) => formOf(result.label, result.branch, rootId));
282
+ return { union, span, replacement: [{ ...union, params: { ...union.params, ...params2 }, message: foreignMessage(params2), alternatives }] };
283
+ }
163
284
  const others = reduced.filter((result) => !top.includes(result));
164
285
  const single = (result) => {
165
286
  const only = result.errors[0];
@@ -179,6 +300,86 @@ function analyze(engine, rootId, union) {
179
300
  });
180
301
  return { union, span, replacement: chosen };
181
302
  }
303
+ var isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
304
+ var quoted = (names2, joiner) => {
305
+ const list = names2.map((name) => JSON.stringify(name));
306
+ return list.length > 1 ? `${list.slice(0, -1).join(", ")} ${joiner} ${list.at(-1)}` : list[0] ?? "";
307
+ };
308
+ function resolved(node, rootId) {
309
+ if (!isObject(node)) return void 0;
310
+ if (typeof node.$ref !== "string") return node;
311
+ const [base, fragment = ""] = node.$ref.split("#");
312
+ const root = schemaEntries.find((entry2) => entry2.schema.$id === (base || rootId))?.schema;
313
+ let target = root;
314
+ for (const token of fragment.split("/").slice(1)) target = isObject(target) ? target[token.replaceAll("~1", "/").replaceAll("~0", "~")] : void 0;
315
+ return isObject(target) ? resolved(target, rootId) : void 0;
316
+ }
317
+ function fieldsOf(schema) {
318
+ if (!isObject(schema.properties)) return void 0;
319
+ const required = Array.isArray(schema.required) ? schema.required.map(String) : [];
320
+ const names2 = [.../* @__PURE__ */ new Set([...required, ...Object.keys(schema.properties)])];
321
+ return `{ ${names2.slice(0, 4).join(", ")}${names2.length > 4 ? ", \u2026" : ""} }`;
322
+ }
323
+ function formOf(label, branch, rootId) {
324
+ const schema = resolved(branch, rootId);
325
+ const fields2 = schema ? fieldsOf(schema) : void 0;
326
+ if (fields2) return `${label}: ${fields2}`;
327
+ const items = schema?.type === "array" ? resolved(schema.items, rootId) : void 0;
328
+ const item = isObject(schema?.items) && typeof schema.items.$ref === "string" ? branchLabel(schema.items, 0) : typeof items?.type === "string" ? items.type : void 0;
329
+ return item ? `${label}: a list of ${item}` : label;
330
+ }
331
+ var homes = /* @__PURE__ */ new Map();
332
+ function homesOf(rootId, keys) {
333
+ let forms = homes.get(rootId);
334
+ if (!forms) {
335
+ forms = [];
336
+ const payload = resolved({ $ref: "#/$defs/ContentPayload" }, rootId);
337
+ const properties = isObject(payload?.properties) ? payload.properties : {};
338
+ const kinds = isObject(properties.type) && Array.isArray(properties.type.enum) ? properties.type.enum.map(String) : [];
339
+ for (const kind of kinds) {
340
+ const field = resolved(properties[kind], rootId);
341
+ const branches = [field, ...Array.isArray(field?.oneOf) ? field.oneOf : [], ...Array.isArray(field?.anyOf) ? field.anyOf : []];
342
+ for (const branch of branches) {
343
+ const schema = resolved(branch, rootId);
344
+ if (schema && isObject(schema.properties)) forms.push({ kind, properties: Object.keys(schema.properties), required: Array.isArray(schema.required) ? schema.required.map(String) : [] });
345
+ }
346
+ }
347
+ homes.set(rootId, forms);
348
+ }
349
+ return [...new Set(forms.filter((form) => keys.every((name) => form.properties.includes(name)) && form.required.every((name) => keys.includes(name))).map((form) => form.kind))];
350
+ }
351
+ function foreignMessage(params2) {
352
+ const home = params2.belongsTo?.length ? ` (${params2.properties.length > 1 ? "those are fields" : "that is a field"} of ${quoted(params2.belongsTo, "or")})` : "";
353
+ const indexes = (params2.alsoAt ?? []).map((path) => path.slice(path.lastIndexOf("/") + 1));
354
+ const also = indexes.length ? `; the same at index${indexes.length > 1 ? "es" : ""} ${indexes.length > 1 ? `${indexes.slice(0, -1).join(", ")} and ${indexes.at(-1)}` : indexes[0]} of this list` : "";
355
+ return `none of the forms accepted here has ${quoted(params2.properties, "or")}${home}${also}`;
356
+ }
357
+ var isForeign = (error) => isUnion(error) && Array.isArray(error.params.properties);
358
+ function collapseRepeats(errors) {
359
+ const first = /* @__PURE__ */ new Map();
360
+ const result = [];
361
+ for (const error of errors) {
362
+ const entry2 = isForeign(error) ? /^(.*)\/\d+$/.exec(error.instancePath) : null;
363
+ if (!entry2) {
364
+ result.push(error);
365
+ continue;
366
+ }
367
+ const params2 = error.params;
368
+ const group = `${entry2[1]}\0${error.schemaPath}\0${JSON.stringify(params2.belongsTo ?? [])}`;
369
+ const lead = first.get(group);
370
+ if (!lead) {
371
+ const copy = { ...error, params: { ...error.params } };
372
+ first.set(group, copy);
373
+ result.push(copy);
374
+ continue;
375
+ }
376
+ const merged = lead.params;
377
+ merged.properties = [.../* @__PURE__ */ new Set([...merged.properties, ...params2.properties])];
378
+ merged.alsoAt = [...merged.alsoAt ?? [], error.instancePath];
379
+ lead.message = foreignMessage(merged);
380
+ }
381
+ return result;
382
+ }
182
383
 
183
384
  // src/validation-definitions.ts
184
385
  var schemaLocations;
@@ -785,9 +986,9 @@ function dataIssues(value) {
785
986
  add(datasetDiagnostics(value));
786
987
  const payload = (node, path) => {
787
988
  if (isRecord(node.chart)) {
788
- const resolved = resolveChartData(node.chart, value, { path: pathFor(path, "chart") });
789
- add(resolved.diagnostics);
790
- add(chartDrawDiagnostics(node.chart, resolved, pathFor(path, "chart"), { language: typeof value.language === "string" ? value.language : void 0 }));
989
+ const resolved2 = resolveChartData(node.chart, value, { path: pathFor(path, "chart") });
990
+ add(resolved2.diagnostics);
991
+ add(chartDrawDiagnostics(node.chart, resolved2, pathFor(path, "chart"), { language: typeof value.language === "string" ? value.language : void 0 }));
791
992
  }
792
993
  if (isRecord(node.table)) add(resolveTableData(node.table, value, { path: pathFor(path, "table") }).diagnostics);
793
994
  };
@@ -1085,17 +1286,17 @@ function dataUnionErrors(errors, value) {
1085
1286
  });
1086
1287
  }
1087
1288
  function validateAgainstSchema(value, schemaOrKind = "presentation", options2 = {}) {
1088
- const resolved = resolveValidator(schemaOrKind);
1089
- if (resolved.schemaName === "presentation") {
1289
+ const resolved2 = resolveValidator(schemaOrKind);
1290
+ if (resolved2.schemaName === "presentation") {
1090
1291
  const errors2 = contentDepthIssues(value);
1091
- if (errors2.length) return { valid: false, errors: errors2, warnings: [], unfilled: [], schemaName: resolved.schemaName };
1292
+ if (errors2.length) return { valid: false, errors: errors2, warnings: [], unfilled: [], schemaName: resolved2.schemaName };
1092
1293
  }
1093
1294
  const variableIssues = { errors: [], warnings: [] };
1094
1295
  const unfilled = [];
1095
1296
  let subject = value;
1096
1297
  let template;
1097
1298
  let unfilledVariables;
1098
- if (resolved.schemaName === "presentation" && isRecord(value) && (hasContentVariables(value) || options2.values !== void 0 || options2.template !== void 0)) {
1299
+ if (resolved2.schemaName === "presentation" && isRecord(value) && (hasContentVariables(value) || options2.values !== void 0 || options2.template !== void 0)) {
1099
1300
  template = options2.template ?? isTemplate(value);
1100
1301
  const view = instantiateForValidation(value, options2.values ?? {}, template);
1101
1302
  subject = view.presentation;
@@ -1113,14 +1314,14 @@ function validateAgainstSchema(value, schemaOrKind = "presentation", options2 =
1113
1314
  }
1114
1315
  }
1115
1316
  }
1116
- const valid = resolved.validate(subject) === true;
1117
- const ajvErrors = valid ? [] : typedVariableErrors(resolved.validate.errors ?? [], subject);
1118
- const specific = resolved.schemaName === "presentation" ? dataUnionErrors(ajvErrors, subject) : ajvErrors;
1119
- const mapped = bestMatchErrors(schemaEngine(), schemas[resolved.schemaName].$id, specific).map(toIssue);
1317
+ const valid = resolved2.validate(subject) === true;
1318
+ const ajvErrors = valid ? [] : typedVariableErrors(resolved2.validate.errors ?? [], subject);
1319
+ const specific = resolved2.schemaName === "presentation" ? dataUnionErrors(ajvErrors, subject) : ajvErrors;
1320
+ const mapped = collapseRepeats(bestMatchErrors(schemaEngine(), schemas[resolved2.schemaName].$id, specific)).map(toIssue);
1120
1321
  const errors = mapped;
1121
- if (resolved.schemaName === "layout" && valid) for (const issue2 of layoutTemplateIssues(subject)) errors.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code }));
1322
+ if (resolved2.schemaName === "layout" && valid) for (const issue2 of layoutTemplateIssues(subject)) errors.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code }));
1122
1323
  const warnings = [];
1123
- if (resolved.schemaName === "presentation") {
1324
+ if (resolved2.schemaName === "presentation") {
1124
1325
  errors.push(...presentationSemanticIssues(subject, options2.catalogs));
1125
1326
  errors.push(...variableIssues.errors);
1126
1327
  const data = dataIssues(subject);
@@ -1129,7 +1330,7 @@ function validateAgainstSchema(value, schemaOrKind = "presentation", options2 =
1129
1330
  warnings.push(...data.warnings);
1130
1331
  warnings.push(...overlayAnchorSizeWarnings(subject));
1131
1332
  warnings.push(...variableIssues.warnings);
1132
- } else if (resolved.schemaName === "language") {
1333
+ } else if (resolved2.schemaName === "language") {
1133
1334
  errors.push(...validateLanguageSemantics(value));
1134
1335
  }
1135
1336
  return {
@@ -1137,8 +1338,8 @@ function validateAgainstSchema(value, schemaOrKind = "presentation", options2 =
1137
1338
  errors,
1138
1339
  warnings,
1139
1340
  unfilled,
1140
- schemaName: resolved.schemaName,
1141
- catalogKind: resolved.catalogKind,
1341
+ schemaName: resolved2.schemaName,
1342
+ catalogKind: resolved2.catalogKind,
1142
1343
  ...template !== void 0 ? { template, unfilledVariables } : {}
1143
1344
  };
1144
1345
  }
@@ -1405,13 +1606,13 @@ function colorLevels(slideDesign, layout, deckDesign, theme, scheme, variables =
1405
1606
  }
1406
1607
  function resolveDesign(document, index, context) {
1407
1608
  const deck = rec(document.design), own4 = rec(rec(Array.isArray(document.slides) ? document.slides[index] : void 0).design);
1408
- const { options: options2, diagnostics, resolved } = context;
1409
- const { theme, colorScheme, fontScheme, fontSchemePath } = resolved;
1609
+ const { options: options2, diagnostics, resolved: resolved2 } = context;
1610
+ const { theme, colorScheme, fontScheme, fontSchemePath } = resolved2;
1410
1611
  const fontPath = `/${fontSchemePath.split(".").join("/")}`;
1411
1612
  const fontDiagnostic = diagnostics.find((diagnostic) => diagnostic.kind === "fontSchemes");
1412
1613
  const dimensions = { width: options2.width, height: options2.height };
1413
1614
  const variables = rec(document.variables);
1414
- const choice = colorChoice(colorLevels(own4, resolved.layout, deck, theme, colorScheme, variables, resolved.messageSurface?.variant), colorScheme, variables);
1615
+ const choice = colorChoice(colorLevels(own4, resolved2.layout, deck, theme, colorScheme, variables, resolved2.messageSurface?.variant), colorScheme, variables);
1415
1616
  const roles = resolveColorRoles(colorScheme, { background: choice.background, variant: choice.variant });
1416
1617
  const dark = roles.dark;
1417
1618
  const text2 = roles.text;
@@ -1616,8 +1817,8 @@ function runsOf(tv) {
1616
1817
  function altOf(value, assets, variables, template) {
1617
1818
  if (typeof value === "string" && value.startsWith("var:")) {
1618
1819
  const variable = rec(rec(variables)[value.slice(4)]);
1619
- const resolved = variable.type === "image" ? variable.value ?? (template === true ? variable.example : void 0) : void 0;
1620
- return resolved === void 0 || typeof resolved === "string" && resolved.startsWith("var:") ? void 0 : altOf(resolved, assets);
1820
+ const resolved2 = variable.type === "image" ? variable.value ?? (template === true ? variable.example : void 0) : void 0;
1821
+ return resolved2 === void 0 || typeof resolved2 === "string" && resolved2.startsWith("var:") ? void 0 : altOf(resolved2, assets);
1621
1822
  }
1622
1823
  const own4 = typeof value === "object" && value !== null ? value.alt : void 0;
1623
1824
  if (typeof own4 === "string") return own4;
@@ -2743,9 +2944,9 @@ var chartRules = [
2743
2944
  for (const slide of context.slides)
2744
2945
  for (const payload of slidePayloads(slide.slide, slide.path)) {
2745
2946
  const chart = rec(payload.node.chart);
2746
- const resolved = resolveChartData(chart, context.document);
2747
- if (!resolved.ok) continue;
2748
- const data = { columns: resolved.columns.filter((_, index) => !(resolved.hasX && index === 1)), rows: resolved.rows };
2947
+ const resolved2 = resolveChartData(chart, context.document);
2948
+ if (!resolved2.ok) continue;
2949
+ const data = { columns: resolved2.columns.filter((_, index) => !(resolved2.hasX && index === 1)), rows: resolved2.rows };
2749
2950
  const type = String(chart.type ?? "").toLowerCase();
2750
2951
  if (chartSkip.test(type)) continue;
2751
2952
  const slices = perCategory.test(type);
@@ -2795,8 +2996,8 @@ var chartRules = [
2795
2996
  const chart = rec(payload.node.chart);
2796
2997
  if (!Array.isArray(chart.colors)) continue;
2797
2998
  const surface = normalizeHexColor(slide.design.colors.background);
2798
- const resolved = resolveChartColors(chart.colors, slide.design.colorScheme, chartColorContext(slide.design));
2799
- resolved.forEach((color, index) => {
2999
+ const resolved2 = resolveChartColors(chart.colors, slide.design.colorScheme, chartColorContext(slide.design));
3000
+ resolved2.forEach((color, index) => {
2800
3001
  const path = `${payload.path === slide.path ? slide.path : payload.path}/chart/colors/${index}`;
2801
3002
  const entry2 = chart.colors[index];
2802
3003
  if (color === void 0) {
@@ -3014,7 +3215,7 @@ var layoutRules = [
3014
3215
  else if (diagnostic.code === "shape-anchor-missing") context.report(pointAnchorRule, { path, slide, message: diagnostic.message, help: "Choose a plotted point in a qualified classic chart, or use a whole-block anchor." });
3015
3216
  else if (diagnostic.code === "small-cell") continue;
3016
3217
  else if (diagnostic.code === "icon-dropped")
3017
- 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." });
3218
+ context.report(iconDroppedRule, { path, slide, message: diagnostic.message, help: "Give the block more room where the message says what bounds it (a larger share in `composition.weights`, a larger region, fewer blocks beside it), use fewer or shorter entries, or remove the icon: chips are drawn only where the text keeps its size. An icon draws on the first-level entries of an unnumbered list, on a metric and on a group." });
3018
3219
  else if (diagnostic.code === "arrangement-adapted")
3019
3220
  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." });
3020
3221
  else if (diagnostic.code === "shape-off-slide")
@@ -3500,9 +3701,9 @@ var chartDualAxis = {
3500
3701
  for (const payload of slidePayloads(slide.slide, slide.path)) {
3501
3702
  const chart = rec(payload.node.chart);
3502
3703
  if (String(chart.type ?? "").trim().toLowerCase() !== "combo") continue;
3503
- const resolved = resolveChartData(chart, context.document);
3504
- if (!resolved.ok || !resolved.combo) continue;
3505
- const secondary = resolved.combo.flatMap((entry2, index) => entry2.axis === "secondary" ? [String(resolved.columns[index + 1] ?? "")] : []);
3704
+ const resolved2 = resolveChartData(chart, context.document);
3705
+ if (!resolved2.ok || !resolved2.combo) continue;
3706
+ const secondary = resolved2.combo.flatMap((entry2, index) => entry2.axis === "secondary" ? [String(resolved2.columns[index + 1] ?? "")] : []);
3506
3707
  if (!secondary.length) continue;
3507
3708
  context.report(chartDualAxisRule, {
3508
3709
  path: `${chartPath(payload.path, slide.path)}/secondaryAxis`,
@@ -3522,14 +3723,14 @@ var chartPieManySlices = {
3522
3723
  const chart = rec(payload.node.chart);
3523
3724
  const type = String(chart.type ?? "").trim().toLowerCase();
3524
3725
  if (type !== "pie" && type !== "doughnut") continue;
3525
- const resolved = resolveChartData(chart, context.document);
3526
- if (!resolved.ok || resolved.rows.length <= PIE_MAX_SLICES) continue;
3726
+ const resolved2 = resolveChartData(chart, context.document);
3727
+ if (!resolved2.ok || resolved2.rows.length <= PIE_MAX_SLICES) continue;
3527
3728
  context.report(chartPieManySlicesRule, {
3528
3729
  path: chartPath(payload.path, slide.path),
3529
3730
  slide,
3530
- message: `The ${type} chart has ${resolved.rows.length} slices, more than ${PIE_MAX_SLICES}; the small ones are hard to compare and to label.`,
3731
+ message: `The ${type} chart has ${resolved2.rows.length} slices, more than ${PIE_MAX_SLICES}; the small ones are hard to compare and to label.`,
3531
3732
  help: 'Compare the parts with a bar chart (`type: "bar"`, sorted if the order carries no meaning), or group the smallest categories into one "Other" slice.',
3532
- measured: { slices: resolved.rows.length, limit: PIE_MAX_SLICES }
3733
+ measured: { slices: resolved2.rows.length, limit: PIE_MAX_SLICES }
3533
3734
  });
3534
3735
  }
3535
3736
  }
@@ -3542,10 +3743,10 @@ var ruleImplementations = [...accessibilityRules, ...layoutContentRules, ...lang
3542
3743
  // src/chart-shape.ts
3543
3744
  var FOREIGN_CHART_KEYS = ["categories", "series", "labels", "datasets"];
3544
3745
  var CHART_DEFINITION = "https://openpresentation.org/schema/opf/v1#/$defs/Chart";
3545
- var isRecord2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
3746
+ var isRecord3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
3546
3747
  var isCell = (value) => value === null || ["string", "number", "boolean"].includes(typeof value);
3547
3748
  function foreignChartKeys(chart) {
3548
- if (!isRecord2(chart) || Object.hasOwn(chart, "data")) return [];
3749
+ if (!isRecord3(chart) || Object.hasOwn(chart, "data")) return [];
3549
3750
  return FOREIGN_CHART_KEYS.filter((key3) => Object.hasOwn(chart, key3));
3550
3751
  }
3551
3752
  function convertChartData(chart) {
@@ -3555,7 +3756,7 @@ function convertChartData(chart) {
3555
3756
  const columns = ["Category"];
3556
3757
  const values = [];
3557
3758
  for (const [index, entry2] of series.entries()) {
3558
- if (!isRecord2(entry2)) return void 0;
3759
+ if (!isRecord3(entry2)) return void 0;
3559
3760
  const list = entry2.values ?? entry2.data;
3560
3761
  const name = entry2.name ?? entry2.label;
3561
3762
  if (!Array.isArray(list) || list.length !== labels.length || !list.every(isCell)) return void 0;
@@ -3566,7 +3767,7 @@ function convertChartData(chart) {
3566
3767
  return { columns, rows: labels.map((label, row) => [label, ...values.map((list) => list[row])]) };
3567
3768
  }
3568
3769
  function chartShapePatch(chart, path) {
3569
- if (!isRecord2(chart)) return void 0;
3770
+ if (!isRecord3(chart)) return void 0;
3570
3771
  const data = convertChartData(chart);
3571
3772
  const keys = foreignChartKeys(chart);
3572
3773
  if (!data || !keys.length) return void 0;
@@ -3582,7 +3783,7 @@ function dataExample(chart) {
3582
3783
  }
3583
3784
  function chartShapeHelp(chart) {
3584
3785
  const keys = foreignChartKeys(chart);
3585
- if (!keys.length || !isRecord2(chart)) return void 0;
3786
+ if (!keys.length || !isRecord3(chart)) return void 0;
3586
3787
  const names2 = keys.map((key3) => `"${key3}"`).join(" and ");
3587
3788
  const example = dataExample(chart);
3588
3789
  const next = `replace ${names2} with ${example}. The first column holds the category labels and each further column is one series.`;
@@ -3648,7 +3849,9 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3648
3849
  precise?.pointer ?? (issue2.keyword !== "opf" && issue2.schemaPath.startsWith("#") ? issue2.schemaPath.slice(1) : "")
3649
3850
  ];
3650
3851
  let help = "Inspect this schema constraint and preserve unrelated content. Errors inside oneOf/anyOf branches may describe alternatives; retain the intended form.";
3651
- if (issue2.keyword === "required")
3852
+ if (issue2.keyword === "required" && issue2.params.missingProperty === "id" && /^\/(organization|speaker)(\/\d+)?$/.test(issue2.path))
3853
+ help = `Add an "id" next to "name": organizations and speakers are found by id (speaker.organizationId, {{organization.<id>.name}}, the editor and the PPTX round trip), for example "id": "acme" (letters, digits, "-" and "_", unique in the deck).`;
3854
+ else if (issue2.keyword === "required")
3652
3855
  help = `Add the required ${JSON.stringify(issue2.params.missingProperty)} field in this object, using the intended schema form.`;
3653
3856
  else if (issue2.keyword === "additionalProperties")
3654
3857
  help = `Review ${JSON.stringify(issue2.params.additionalProperty)} against this object's schema. Preserve custom metadata in document.extensions where appropriate; do not delete authored content to clear this error.`;
@@ -3658,6 +3861,7 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3658
3861
  } else if (issue2.keyword === "dependentRequired")
3659
3862
  help = `${JSON.stringify(issue2.params.property)} only applies together with ${JSON.stringify(issue2.params.missingProperty)}: add ${JSON.stringify(issue2.params.missingProperty)}, or remove ${JSON.stringify(issue2.params.property)}.`;
3660
3863
  else if (issue2.keyword === "opf") help = semanticHelp(issue2);
3864
+ else if ((issue2.keyword === "oneOf" || issue2.keyword === "anyOf") && Array.isArray(issue2.params.properties)) help = foreignObjectHelp(issue2);
3661
3865
  const allowed = Array.isArray(issue2.params.allowedValues) ? issue2.params.allowedValues.filter(primitive) : [];
3662
3866
  const nearest2 = issue2.keyword === "additionalProperties" ? nearestProperties(issue2, entry2.schema, precise?.pointer, precise?.schemaName) : [];
3663
3867
  const typedName = issue2.keyword === "additionalProperties" && typeof issue2.params.additionalProperty === "string" ? issue2.params.additionalProperty : void 0;
@@ -3665,6 +3869,14 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3665
3869
  help = `Write ${JSON.stringify(nearest2[0].value)}: layout words follow the deck's direction, so the sides are "start" and "end", not "left" and "right".`;
3666
3870
  else if (typedName !== void 0 && typeof nearest2[0]?.value === "string" && nearest2[0].value.startsWith(typedName))
3667
3871
  help = `Write ${JSON.stringify(nearest2[0].value)} instead; ${JSON.stringify(typedName)} is not a field of this object.`;
3872
+ else if (typedName !== void 0 && typeof nearest2[0]?.value === "string")
3873
+ help = `Did you mean ${JSON.stringify(nearest2[0].value)}? ${JSON.stringify(typedName)} is not a field of this object. To keep custom metadata, put it in extensions; do not delete authored content to clear this error.`;
3874
+ const regionKey = typedName !== void 0 && nearest2[0]?.value !== logicalName(typedName) && /^\/slides\/\d+$/.test(issue2.path) ? regionKeyHelp(typedName) : void 0;
3875
+ if (regionKey) {
3876
+ help = regionKey.help;
3877
+ if (regionKey.suggestion && !nearest2.some((entry3) => entry3.value === regionKey.suggestion))
3878
+ nearest2.unshift({ value: regionKey.suggestion, label: regionKey.suggestion, origin: "schema", definition: `${String(entry2.schema.$id)}#/$defs/Slide/properties/${regionKey.suggestion}` });
3879
+ }
3668
3880
  return finding(ruleId, {
3669
3881
  ...severity ? { severity } : {},
3670
3882
  path,
@@ -3684,7 +3896,41 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3684
3896
  } : nearest2.length ? { suggestions: nearest2 } : {}
3685
3897
  });
3686
3898
  }
3899
+ function foreignObjectHelp(issue2) {
3900
+ const params2 = issue2.params;
3901
+ const many = params2.alsoAt?.length ? "each entry" : "it";
3902
+ if (params2.belongsTo?.length) {
3903
+ const kinds = params2.belongsTo.map((kind) => `"${kind}"`).join(" or ");
3904
+ return `To show these as ${kinds}, give each its own block whose ${kinds} holds these fields; to keep ${many} here, rewrite ${many} in one of the forms this place takes. Keep the authored content.`;
3905
+ }
3906
+ return `Rewrite ${many} in one of the forms this place takes, moving the authored content into the fields that form has; do not delete it to clear this error.`;
3907
+ }
3687
3908
  var NEAREST_PROPERTIES = 3;
3909
+ var REGION_ROWS = ["top", "middle", "bottom"];
3910
+ var REGION_COLUMNS = ["start", "center", "end"];
3911
+ function regionKeyHelp(typed) {
3912
+ const halves = logicalName(typed).split(":");
3913
+ if (halves.length > 2 || halves.some((half) => half === "")) return void 0;
3914
+ const words = halves.map((half) => half.split("+"));
3915
+ if (!words.every((list) => list.every((word) => REGION_ROWS.includes(word) || REGION_COLUMNS.includes(word)))) return void 0;
3916
+ const isRows = (list) => list.every((word) => REGION_ROWS.includes(word)), isColumns = (list) => list.every((word) => REGION_COLUMNS.includes(word));
3917
+ if (words.some((list) => !isRows(list) && !isColumns(list))) return { help: `A region key does not mix rows (top, middle, bottom) and columns (start, center, end) in one half: write rows, a colon, then columns, such as "top:start" or "middle+bottom:center+end".` };
3918
+ if (words.length === 2 && isColumns(words[0]) && isRows(words[1])) {
3919
+ const swapped = `${halves[1]}:${halves[0]}`;
3920
+ return { help: `Rows come before the colon and columns after it: write "${swapped}".`, ...promotedRegionKeys.includes(swapped) ? { suggestion: swapped } : {} };
3921
+ }
3922
+ if (words.length === 2 && (!isRows(words[0]) || !isColumns(words[1]))) return { help: 'A region key with a colon names rows before it and columns after it, such as "top:start" or "middle+bottom:center+end".' };
3923
+ const order2 = (list, vocabulary) => [...new Set(list)].map((word) => vocabulary.indexOf(word)).sort((a, b) => a - b);
3924
+ const rows = words.length === 2 || isRows(words[0]) ? order2(words[0], REGION_ROWS) : [], columns = order2(words[words.length - 1], REGION_COLUMNS);
3925
+ const hasRows = words.length === 2 || isRows(words[0]), hasColumns = words.length === 2 || isColumns(words[0]);
3926
+ const adjacent = (indexes) => indexes.every((index, at2) => at2 === 0 || index === indexes[at2 - 1] + 1);
3927
+ if (hasRows && !adjacent(rows) || hasColumns && !adjacent(columns))
3928
+ return { help: `A span covers adjacent rows or columns: "top+bottom" and "start+end" skip the middle one. Write "top+middle+bottom" or "start+center+end", or use one region for each part.` };
3929
+ const canonical2 = (indexes, vocabulary) => indexes.map((index) => vocabulary[index]).join("+");
3930
+ const key3 = words.length === 2 ? `${canonical2(rows, REGION_ROWS)}:${canonical2(columns, REGION_COLUMNS)}` : hasRows ? canonical2(rows, REGION_ROWS) : canonical2(columns, REGION_COLUMNS);
3931
+ if (key3 === typed) return void 0;
3932
+ return promotedRegionKeys.includes(key3) ? { help: `Write "${key3}": the names of a span go in reading order (top, middle, bottom; start, center, end), rows before the colon and columns after it.`, suggestion: key3 } : void 0;
3933
+ }
3688
3934
  var logicalName = (name) => name.split(":").map((part) => part.split("+").map((word) => word === "left" ? "start" : word === "right" ? "end" : word).join("+")).join(":");
3689
3935
  function nearestProperties(issue2, fallbackRoot, pointerToKeyword, schemaName) {
3690
3936
  const typed = issue2.params.additionalProperty;
@@ -3698,9 +3944,9 @@ function nearestProperties(issue2, fallbackRoot, pointerToKeyword, schemaName) {
3698
3944
  else return [];
3699
3945
  }
3700
3946
  if (!isRecord(node) || !isRecord(node.properties)) return [];
3701
- const root = rootEntry?.schema ?? fallbackRoot, limit = typed.length <= 3 ? 1 : 2, lower = typed.toLowerCase();
3947
+ const root = rootEntry?.schema ?? fallbackRoot, lower = typed.toLowerCase();
3702
3948
  const declared = Object.keys(node.properties), logical = logicalName(typed), longer = typed.length >= 3 ? declared.filter((name) => name !== typed && name.toLowerCase().startsWith(lower)) : [], exact = logical !== typed && declared.includes(logical) ? [logical] : longer.length === 1 ? longer : [];
3703
- const near = declared.map((name) => ({ name, away: distance(lower, name.toLowerCase()) })).filter(({ name, away }) => name !== typed && away <= limit && !exact.includes(name)).sort((a, b) => a.away - b.away || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)).map(({ name }) => name);
3949
+ const near = respellings(typed, declared).filter((name) => !exact.includes(name));
3704
3950
  return [...exact, ...near].slice(0, NEAREST_PROPERTIES).map((name) => ({
3705
3951
  value: name,
3706
3952
  label: name,
@@ -3718,12 +3964,12 @@ function resolve(cursor, seen = /* @__PURE__ */ new Set()) {
3718
3964
  if (!root) return { ...cursor, schema: {} };
3719
3965
  const target = at(root, fragment);
3720
3966
  if (!object(target)) return { ...cursor, schema: {} };
3721
- const resolved = resolve(
3967
+ const resolved2 = resolve(
3722
3968
  { schema: target, root, path: fragment },
3723
3969
  seen
3724
3970
  );
3725
3971
  const { $ref, ...rest } = cursor.schema;
3726
- return { ...resolved, schema: { ...resolved.schema, ...rest } };
3972
+ return { ...resolved2, schema: { ...resolved2.schema, ...rest } };
3727
3973
  }
3728
3974
  function score(schema, value) {
3729
3975
  const type = schema.type;
@@ -3744,21 +3990,21 @@ function score(schema, value) {
3744
3990
  return result;
3745
3991
  }
3746
3992
  function active(cursor, value) {
3747
- const resolved = resolve(cursor), alternatives = resolved.schema.oneOf ?? resolved.schema.anyOf;
3748
- if (!Array.isArray(alternatives)) return resolved;
3749
- const keyword = resolved.schema.oneOf ? "oneOf" : "anyOf";
3993
+ const resolved2 = resolve(cursor), alternatives = resolved2.schema.oneOf ?? resolved2.schema.anyOf;
3994
+ if (!Array.isArray(alternatives)) return resolved2;
3995
+ const keyword = resolved2.schema.oneOf ? "oneOf" : "anyOf";
3750
3996
  const candidates = alternatives.filter(object).map(
3751
3997
  (schema, index) => active(
3752
3998
  {
3753
3999
  schema,
3754
- root: resolved.root,
3755
- path: `${resolved.path}/${keyword}/${index}`
4000
+ root: resolved2.root,
4001
+ path: `${resolved2.path}/${keyword}/${index}`
3756
4002
  },
3757
4003
  value
3758
4004
  )
3759
4005
  );
3760
4006
  const selected = candidates.sort((a, b) => score(b.schema, value) - score(a.schema, value))[0];
3761
- return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved] } : resolved;
4007
+ return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved2] } : resolved2;
3762
4008
  }
3763
4009
  function childCursor(cursors, key3) {
3764
4010
  for (const keyword of [
@@ -3800,8 +4046,8 @@ function fields(document) {
3800
4046
  const entry2 = stack.pop();
3801
4047
  if (!entry2) break;
3802
4048
  if (entry2.ancestors.includes(entry2.value)) continue;
3803
- const resolved = resolve(entry2.cursor), selected = active(entry2.cursor, entry2.value);
3804
- const assetReference2 = [resolved, selected].some(
4049
+ const resolved2 = resolve(entry2.cursor), selected = active(entry2.cursor, entry2.value);
4050
+ const assetReference2 = [resolved2, selected].some(
3805
4051
  (cursor) => cursor.root.$id === schemas.presentation.$id && (cursor.path === "/$defs/Asset" || cursor.path === "/$defs/Asset/oneOf/0" || cursor.path === "/$defs/Watermark/properties/src") || String(cursor.schema.description ?? "").includes("asset:") || Array.isArray(cursor.schema.examples) && cursor.schema.examples.some(
3806
4052
  (example) => typeof example === "string" && example.startsWith("asset:")
3807
4053
  )
@@ -3809,11 +4055,11 @@ function fields(document) {
3809
4055
  result.push({
3810
4056
  path: pointer3(entry2.path),
3811
4057
  value: entry2.value,
3812
- cursor: resolved,
4058
+ cursor: resolved2,
3813
4059
  assetReference: assetReference2
3814
4060
  });
3815
4061
  const ancestors = [...entry2.ancestors, entry2.value];
3816
- const cursors = [selected, ...selected.baseSchemas ?? [], resolved];
4062
+ const cursors = [selected, ...selected.baseSchemas ?? [], resolved2];
3817
4063
  const arrayCursor = cursors.find((cursor) => object(cursor.schema.items));
3818
4064
  if (Array.isArray(entry2.value) && arrayCursor)
3819
4065
  entry2.value.forEach((value, index) => {
@@ -3883,7 +4129,7 @@ function embeddedRecordFindings(document, options2, findings) {
3883
4129
  }
3884
4130
  return invalid;
3885
4131
  }
3886
- function distance(a, b) {
4132
+ function distance2(a, b) {
3887
4133
  a = a.slice(0, 128);
3888
4134
  b = b.slice(0, 128);
3889
4135
  let row = Array.from({ length: b.length + 1 }, (_, i) => i);
@@ -3934,10 +4180,11 @@ var HELP = {
3934
4180
  "slide-size-out-of-range": "Use a custom widthInches and heightInches between 1 and 56, or a preset. PowerPoint stores the slide size in 914400 to 51206400 EMU per side."
3935
4181
  };
3936
4182
  function semanticHelp(issue2) {
3937
- const params2 = issue2.params ?? {}, field = typeof params2.field === "string" ? params2.field : void 0, quoted2 = JSON.stringify(field);
3938
- if (params2.code === "image-option-unsupported-payload" && field) return `Remove ${quoted2}, or put it on an image block ({ "image": ... }); it has no meaning on another kind of content.`;
4183
+ const params2 = issue2.params ?? {}, field = typeof params2.field === "string" ? params2.field : void 0, quoted3 = JSON.stringify(field);
4184
+ if (params2.code === "image-option-unsupported-payload" && field) return `Remove ${quoted3}, or put it on an image block ({ "image": ... }); it has no meaning on another kind of content.`;
3939
4185
  if (params2.code === "shape-option-unsupported-payload" && field === "alt" && params2.type === "image") return `A picture's alt text goes inside its image object: { "image": { "src": "...", "alt": "..." } }.`;
3940
- if (params2.code === "shape-option-unsupported-payload" && field) return `Remove ${quoted2}, or draw this as a shape: a shape block ({ "shape": ... } with no "image") or an overlay shape in the slide's "shapes".`;
4186
+ if (params2.code === "shape-option-unsupported-payload" && field) return `Remove ${quoted3}, or draw this as a shape: a shape block ({ "shape": ... } with no "image") or an overlay shape in the slide's "shapes".`;
4187
+ if (params2.code === "number-format-invalid") return 'Write a pattern with a numeric part, such as "0%", "0.0", "#,##0" or "$#,##0.00", optionally followed by a negative and a zero section after ";" ("+0%;-0%", "0;(0);0"; at most three, each with a numeric part). A negative section prints no minus of its own. There is no text section, color or condition.';
3941
4188
  if (params2.code === "caption-unsupported-payload") return "Put the caption on the image, chart, table, video or diagram it describes, or write it as a text block of its own.";
3942
4189
  if (Array.isArray(params2.incompatible) && params2.incompatible.includes("bullets") && params2.type === "list") return 'For a list, write the entries under "items". To keep "bullets" (talking points, which belong to a text payload), remove "type" or write "type": "text".';
3943
4190
  return "Resolve the reported structural conflict while preserving every content field. Preview the result after editing.";
@@ -4043,6 +4290,31 @@ function collapseAuthoringShapes(document, findings) {
4043
4290
  const prefix = `${entry2.path}/`;
4044
4291
  if (findings.some((other) => other !== entry2 && other.path.startsWith(prefix) && !other.path.slice(prefix.length).includes("/") && OPTION_RULES.includes(other.ruleId))) findings.splice(index, 1);
4045
4292
  }
4293
+ const payloadSlots = /* @__PURE__ */ new Map();
4294
+ for (const entry2 of findings) {
4295
+ if (!schema(entry2) || payloadSlots.has(entry2.path)) continue;
4296
+ const key3 = /^\/slides\/\d+\/([^/]+)$/.exec(entry2.path)?.[1], inBlocks = /^\/slides\/\d+\/blocks\/\d+$/.test(entry2.path);
4297
+ if (!inBlocks && !(key3 !== void 0 && promotedRegionKeys.includes(key3))) continue;
4298
+ const value = valueAt(entry2.path);
4299
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || Array.isArray(value)) payloadSlots.set(entry2.path, value);
4300
+ }
4301
+ for (const [at2, value] of payloadSlots) {
4302
+ const first = findings.findIndex((entry2) => schema(entry2) && entry2.path === at2);
4303
+ const text2 = typeof value === "string";
4304
+ const write = text2 ? `{ "text": ${JSON.stringify(value)} }` : Array.isArray(value) ? '{ "items": [ ... ] } for a list, or { "blocks": [ ... ] } for several blocks' : '{ "text": "..." }';
4305
+ const { fixes: _fixes, suggestions: _suggestions, ...kept } = findings[first];
4306
+ const one = {
4307
+ ...kept,
4308
+ message: `A region holds a content payload (an object), not ${text2 ? "a bare string" : Array.isArray(value) ? "a list" : "a " + typeof value}.`,
4309
+ help: `Write ${write}. A payload names its kind by its key: "text", "items" (a list), "image", "chart", "table", or "blocks" to stack several; see docs/dynamic-composition.md.`,
4310
+ ...text2 ? { fixes: [{ id: "wrap-text", title: 'Write the string as { "text": ... }', kind: "patch", safe: false, patch: [{ op: "replace", path: at2, value: { text: value } }] }] } : {}
4311
+ };
4312
+ for (let index = findings.length - 1; index >= 0; index--) {
4313
+ const entry2 = findings[index];
4314
+ if (schema(entry2) && entry2.path === at2) findings.splice(index, 1);
4315
+ }
4316
+ findings.splice(first, 0, one);
4317
+ }
4046
4318
  }
4047
4319
  function collapseChartShape(document, findings) {
4048
4320
  const chartAt = (path) => {
@@ -4189,11 +4461,17 @@ function undeclaredCatalogFindings(document) {
4189
4461
  return findings;
4190
4462
  }
4191
4463
  var KIND_PLURAL = { layouts: "layouts", themes: "themes", colorSchemes: "color schemes", fontSchemes: "font schemes", narratives: "narratives", audiences: "audiences", purposes: "purposes", tones: "tones" };
4192
- function nearestRecords(kind, reference, candidates) {
4193
- if (!candidates.length) return "";
4194
- const close = candidates.filter((value) => distance(reference, value) <= Math.max(2, Math.floor(reference.length / 4))).slice(0, 3);
4464
+ var KIND_SINGULAR = { layouts: "layout", themes: "theme", colorSchemes: "color scheme", fontSchemes: "font scheme", narratives: "narrative", audiences: "audience", purposes: "purpose", tones: "tone" };
4465
+ function nearMisses(reference, candidates) {
4466
+ return candidates.filter((value) => distance2(reference, value) <= Math.max(2, Math.floor(reference.length / 4)) && relatedName(reference, value));
4467
+ }
4468
+ function nearestRecords(kind, reference, candidates, registered) {
4469
+ if (!registered) return "";
4470
+ const close = nearMisses(reference, candidates).slice(0, 3);
4195
4471
  const quote = (values) => values.map((value) => `'${value}'`).join(", ");
4196
- return close.length ? `Did you mean ${quote(close)}? ` : `The nearest ${KIND_PLURAL[kind]} that exist: ${quote(candidates.slice(0, 3))}. `;
4472
+ if (close.length) return `Did you mean ${quote(close)}? `;
4473
+ const listed = `search_catalog (the OPF MCP server), opf catalog ${kind} and pptx.gallery list the ${KIND_PLURAL[kind]} that exist.`;
4474
+ return kind === "layouts" ? `No layout is named like '${reference}'. Without the layout key the slide composes automatically from its content; ${listed} ` : `No ${KIND_SINGULAR[kind]} is named like '${reference}'; ${listed} `;
4197
4475
  }
4198
4476
  function contentReferenceFindings(document, options2, findings) {
4199
4477
  const invalid = embeddedRecordFindings(document, options2, findings);
@@ -4210,12 +4488,15 @@ function contentReferenceFindings(document, options2, findings) {
4210
4488
  }
4211
4489
  if (found && !(found.origin === "document" && invalid.has(recordKey(found.group, site.kind, found.id)))) continue;
4212
4490
  const diagnostic = unresolvedReference(document, site.kind, site.reference, path, options2);
4213
- const suggestions = catalogRecords(document, site.kind, options2).map((entry2) => ({ value: entry2.reference, label: typeof entry2.record.name === "string" ? entry2.record.name : entry2.reference, origin: entry2.origin === "host" ? "registered" : "document", definition: entry2.origin === "document" ? `document#${pointer3(["catalogs", entry2.group, site.kind, entry2.id])}` : `${entry2.source ?? "context"}#/${site.kind}/${entry2.id}` })).sort((a, b) => distance(site.reference, a.value) - distance(site.reference, b.value) || (a.value < b.value ? -1 : a.value > b.value ? 1 : 0)).slice(0, 5);
4491
+ const records = catalogRecords(document, site.kind, options2);
4492
+ const near = new Set(nearMisses(site.reference, records.map((entry2) => entry2.reference)));
4493
+ const suggestions = records.filter((entry2) => near.has(entry2.reference)).map((entry2) => ({ value: entry2.reference, label: typeof entry2.record.name === "string" ? entry2.record.name : entry2.reference, origin: entry2.origin === "host" ? "registered" : "document", definition: entry2.origin === "document" ? `document#${pointer3(["catalogs", entry2.group, site.kind, entry2.id])}` : `${entry2.source ?? "context"}#/${site.kind}/${entry2.id}` })).sort((a, b) => distance2(site.reference, a.value) - distance2(site.reference, b.value) || (a.value < b.value ? -1 : a.value > b.value ? 1 : 0)).slice(0, 5);
4494
+ const suggested = suggestions.length > 0;
4214
4495
  findings.push(
4215
4496
  finding("opf/unresolved-reference", {
4216
4497
  path,
4217
4498
  message: diagnostic.message,
4218
- help: `${nearestRecords(site.kind, site.reference, suggestions.map((entry2) => entry2.value))}${site.kind === "layouts" ? "Embed the layout record (embed(), or opf embed), register the catalog that defines it, choose one of the suggested layouts, or remove the reference to compose the slide automatically." : "Embed the record (embed(), or opf embed), register the catalog that defines it, or choose one of the suggested records."}`,
4499
+ help: `${nearestRecords(site.kind, site.reference, suggestions.map((entry2) => entry2.value), records.length > 0)}${!suggested && records.length ? `To keep this id, embed the ${site.kind === "layouts" ? "layout " : ""}record (embed(), or opf embed) or register the catalog that defines it.` : site.kind === "layouts" ? "Embed the layout record (embed(), or opf embed), register the catalog that defines it, choose one of the suggested layouts, or remove the reference to compose the slide automatically." : "Embed the record (embed(), or opf embed), register the catalog that defines it, or choose one of the suggested records."}`,
4219
4500
  definition: `${schemas.presentation.$id}#/$defs/Catalogs`,
4220
4501
  lookup: ["opf", "catalog", site.kind],
4221
4502
  suggestions
@@ -4240,7 +4521,7 @@ function referenceFindings(document, engine, options2) {
4240
4521
  definition: schemas.presentation.$id + "#/$defs/Assets",
4241
4522
  lookup: ["opf", "schema", "presentation", "/$defs/Assets"],
4242
4523
  suggestions: Object.keys(assetValues).sort(
4243
- (a, b) => distance(id, a) - distance(id, b) || (a < b ? -1 : a > b ? 1 : 0)
4524
+ (a, b) => distance2(id, a) - distance2(id, b) || (a < b ? -1 : a > b ? 1 : 0)
4244
4525
  ).slice(0, 5).map((id2) => ({
4245
4526
  value: `asset:${id2}`,
4246
4527
  label: id2,
@@ -4309,7 +4590,8 @@ function referenceFindings(document, engine, options2) {
4309
4590
  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.",
4310
4591
  definition: `${schemas.presentation.$id}#/$defs/IconReference`,
4311
4592
  lookup: ["opf", "schema", "presentation", "/$defs/IconReference"],
4312
- ...issue2.suggestions?.length ? { suggestions: issue2.suggestions.map((value2) => ({ value: value2, label: value2, origin: "registered", definition: `${schemas.presentation.$id}#/$defs/IconReference` })) } : {}
4593
+ ...issue2.suggestions?.length ? { suggestions: issue2.suggestions.map((value2) => ({ value: value2, label: value2, origin: "registered", definition: `${schemas.presentation.$id}#/$defs/IconReference` })) } : {},
4594
+ ...issue2.renamed ? { fixes: [{ id: "icon-renamed", title: "Use the new name", kind: "patch", safe: true, patch: [{ op: "replace", path: pointerPath(path.split(".")), value: issue2.renamed }] }] } : {}
4313
4595
  })
4314
4596
  );
4315
4597
  }
@@ -4321,7 +4603,7 @@ function narrativeFindings(document, options2) {
4321
4603
  const narrative = resolveNarrative(document, options2);
4322
4604
  if (narrative) {
4323
4605
  const id = String(document.narrative);
4324
- const beatSuggestions = (beat) => narrative.beats.slice().sort((a, b) => distance(beat, a) - distance(beat, b) || (a < b ? -1 : a > b ? 1 : 0)).slice(0, 5).map((value) => ({ value, label: value, origin: narrative.origin, definition: `narratives/${id}#/beats` }));
4606
+ const beatSuggestions = (beat) => narrative.beats.slice().sort((a, b) => distance2(beat, a) - distance2(beat, b) || (a < b ? -1 : a > b ? 1 : 0)).slice(0, 5).map((value) => ({ value, label: value, origin: narrative.origin, definition: `narratives/${id}#/beats` }));
4325
4607
  for (const reference of unknownBeatReferences(document, narrative))
4326
4608
  findings.push(
4327
4609
  finding("opf/unknown-beat", {
@@ -4600,7 +4882,7 @@ var OPFPatchHashError = class extends OPFPatchError {
4600
4882
  }
4601
4883
  };
4602
4884
  var own2 = (value, key3) => Object.prototype.hasOwnProperty.call(value, key3);
4603
- var isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
4885
+ var isObject2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
4604
4886
  var clone = (value) => structuredClone(value);
4605
4887
  function jsonEqual(a, b) {
4606
4888
  if (a === b) return true;
@@ -4651,7 +4933,7 @@ function indexOfId(array, id) {
4651
4933
  let found = -1;
4652
4934
  for (let i = 0; i < array.length; i += 1) {
4653
4935
  const item = array[i];
4654
- if (isObject(item) && own2(item, "id") && item.id === id) {
4936
+ if (isObject2(item) && own2(item, "id") && item.id === id) {
4655
4937
  if (found !== -1) return -2;
4656
4938
  found = i;
4657
4939
  }
@@ -4660,23 +4942,23 @@ function indexOfId(array, id) {
4660
4942
  }
4661
4943
  function uniqueIdAt(array, at2) {
4662
4944
  const item = array[at2];
4663
- if (!isObject(item) || !own2(item, "id") || typeof item.id !== "string" || item.id === "") return void 0;
4945
+ if (!isObject2(item) || !own2(item, "id") || typeof item.id !== "string" || item.id === "") return void 0;
4664
4946
  return indexOfId(array, item.id) === at2 ? item.id : void 0;
4665
4947
  }
4666
4948
  function resolveTokens(document, tokens, pointer4) {
4667
4949
  const out = [];
4668
4950
  let cursor = document, walking = true;
4669
4951
  for (const token of tokens) {
4670
- let resolved = token;
4952
+ let resolved2 = token;
4671
4953
  if (walking && Array.isArray(cursor) && isIdToken(token)) {
4672
4954
  const at2 = indexOfId(cursor, token.slice(1));
4673
4955
  if (at2 === -1) throw new OPFPatchError("patch-id-not-found", `No element of ${formatPointer(out) || "/"} has the id '${token.slice(1)}'.`, { path: pointer4 });
4674
4956
  if (at2 === -2) throw new OPFPatchError("patch-id-ambiguous", `More than one element of ${formatPointer(out) || "/"} has the id '${token.slice(1)}'.`, { path: pointer4 });
4675
- resolved = String(at2);
4957
+ resolved2 = String(at2);
4676
4958
  }
4677
- out.push(resolved);
4959
+ out.push(resolved2);
4678
4960
  if (walking) {
4679
- const next = readPointer(cursor, [resolved]);
4961
+ const next = readPointer(cursor, [resolved2]);
4680
4962
  if (next.found) cursor = next.value;
4681
4963
  else walking = false;
4682
4964
  }
@@ -4750,7 +5032,7 @@ function normalizePatch(patch2) {
4750
5032
  }
4751
5033
  function normalizeOperation(operation, index) {
4752
5034
  const fail = (code2, message, path) => new OPFPatchError(code2, index === void 0 ? message : `Operation ${index}: ${message}`, { index, operation, path });
4753
- if (!isObject(operation)) throw fail("invalid-patch-operation", "Expected an operation object.");
5035
+ if (!isObject2(operation)) throw fail("invalid-patch-operation", "Expected an operation object.");
4754
5036
  const op = operation.op;
4755
5037
  if (typeof op !== "string" || !["add", "remove", "replace", "move", "copy", "test"].includes(op)) {
4756
5038
  throw fail("unsupported-patch-operation", `Unknown operation: ${String(op)}`);
@@ -4927,11 +5209,11 @@ function invertPatch(document, patch2) {
4927
5209
  return applyPatchWithInverse(document, patch2).inverse;
4928
5210
  }
4929
5211
  function resolveIdPatch(document, patch2) {
4930
- const resolved = [];
5212
+ const resolved2 = [];
4931
5213
  walkPatch(document, patch2, { after: (step) => {
4932
- resolved.push(step.resolved);
5214
+ resolved2.push(step.resolved);
4933
5215
  } });
4934
- return resolved;
5216
+ return resolved2;
4935
5217
  }
4936
5218
  function toIdPatch(document, patch2) {
4937
5219
  const out = [];
@@ -5035,20 +5317,20 @@ function mergeAllOf(schema, root, seen) {
5035
5317
  const { allOf, ...base } = schema;
5036
5318
  let merged = base;
5037
5319
  for (const member of allOf) {
5038
- const resolved = resolveSchema(member, root, new Set(seen));
5039
- if (!resolved.properties && !resolved.type && !resolved.oneOf && !resolved.anyOf) continue;
5320
+ const resolved2 = resolveSchema(member, root, new Set(seen));
5321
+ if (!resolved2.properties && !resolved2.type && !resolved2.oneOf && !resolved2.anyOf) continue;
5040
5322
  merged = {
5041
- ...resolved,
5323
+ ...resolved2,
5042
5324
  ...merged,
5043
- ...resolved.properties || merged.properties ? { properties: { ...resolved.properties, ...merged.properties } } : {}
5325
+ ...resolved2.properties || merged.properties ? { properties: { ...resolved2.properties, ...merged.properties } } : {}
5044
5326
  };
5045
5327
  }
5046
5328
  return merged;
5047
5329
  }
5048
5330
  function resolveSchema(schema, root = presentationSchema, seen = /* @__PURE__ */ new Set()) {
5049
- const resolved = resolveNode(schema, root, seen);
5331
+ const resolved2 = resolveNode(schema, root, seen);
5050
5332
  const kind = schema && typeof schema === "object" ? kindOfNode(schema) : void 0;
5051
- return kind === void 0 ? resolved : { ...resolved, [CATALOG_KIND]: kind };
5333
+ return kind === void 0 ? resolved2 : { ...resolved2, [CATALOG_KIND]: kind };
5052
5334
  }
5053
5335
  function resolveNode(schema, root, seen) {
5054
5336
  if (!schema || typeof schema !== "object") return {};
@@ -5059,18 +5341,18 @@ function resolveNode(schema, root, seen) {
5059
5341
  const [id = "", fragment = ""] = ref.split("#");
5060
5342
  const target = id ? documents.get(id) : root;
5061
5343
  if (!target) throw new Error(`Unresolved OPF schema: ${ref}`);
5062
- let resolved = fragment ? readSchemaPointer(target, fragment) : target;
5063
- if (!resolved) throw new Error(`Unresolved OPF schema: ${ref}`);
5064
- if (id && target !== root) resolved = absolutize(resolved, id);
5344
+ let resolved2 = fragment ? readSchemaPointer(target, fragment) : target;
5345
+ if (!resolved2) throw new Error(`Unresolved OPF schema: ${ref}`);
5346
+ if (id && target !== root) resolved2 = absolutize(resolved2, id);
5065
5347
  const { $ref: _ref, ...rest } = schema;
5066
- return mergeAllOf({ ...resolveSchema(resolved, target, seen), ...rest }, target, seen);
5348
+ return mergeAllOf({ ...resolveSchema(resolved2, target, seen), ...rest }, target, seen);
5067
5349
  }
5068
5350
  function schemaVariants(schema, root = presentationSchema) {
5069
- const resolved = resolveSchema(schema, root);
5070
- if (Array.isArray(resolved.type)) return resolved.type.flatMap((type) => schemaVariants({ ...resolved, type }, root));
5071
- const variants = resolved.oneOf ?? resolved.anyOf;
5072
- if (!variants) return [resolved];
5073
- const { $ref: _ref, oneOf: _oneOf, anyOf: _anyOf, ...base } = resolved;
5351
+ const resolved2 = resolveSchema(schema, root);
5352
+ if (Array.isArray(resolved2.type)) return resolved2.type.flatMap((type) => schemaVariants({ ...resolved2, type }, root));
5353
+ const variants = resolved2.oneOf ?? resolved2.anyOf;
5354
+ if (!variants) return [resolved2];
5355
+ const { $ref: _ref, oneOf: _oneOf, anyOf: _anyOf, ...base } = resolved2;
5074
5356
  return variants.flatMap(
5075
5357
  (child) => schemaVariants(child, root).map((variant) => {
5076
5358
  const requiredOnly = !variant.type && !variant.properties && !variant.$ref && Array.isArray(variant.required);
@@ -5133,14 +5415,14 @@ function walk(presentation, parts2, rootSchema) {
5133
5415
  let known = true;
5134
5416
  for (let index = 0; index < parts2.length; index++) {
5135
5417
  const key3 = parts2[index];
5136
- const resolved = stepSchema(current, value, key3, root);
5137
- parent = resolved;
5418
+ const resolved2 = stepSchema(current, value, key3, root);
5419
+ parent = resolved2;
5138
5420
  let next;
5139
5421
  const recordSchema = parts2[0] === "catalogs" && index === 3 ? catalogSchemaNames[parts2[2]] : void 0;
5140
5422
  if (recordSchema) {
5141
5423
  next = schemas[recordSchema] ?? {};
5142
5424
  root = next;
5143
- } else next = childSchema(resolved, key3, value);
5425
+ } else next = childSchema(resolved2, key3, value);
5144
5426
  if (next === void 0) {
5145
5427
  known = false;
5146
5428
  next = {};
@@ -5301,10 +5583,10 @@ function objectForm(variants, value) {
5301
5583
  function childrenOf(form, list, isSlide, root) {
5302
5584
  const children = [];
5303
5585
  for (const [key3, raw] of form.properties) {
5304
- const resolved = resolveSchema(raw, root);
5586
+ const resolved2 = resolveSchema(raw, root);
5305
5587
  const variants = schemaVariants(raw, root);
5306
- const description = firstParagraph(resolved.description);
5307
- const catalogKind = catalogKindOf(resolved, variants);
5588
+ const description = firstParagraph(resolved2.description);
5589
+ const catalogKind = catalogKindOf(resolved2, variants);
5308
5590
  children.push({
5309
5591
  key: key3,
5310
5592
  types: uniq(variants.map(variantType)),
@@ -5314,7 +5596,7 @@ function childrenOf(form, list, isSlide, root) {
5314
5596
  priority: priorityOf(list, key3),
5315
5597
  ...description ? { description } : {},
5316
5598
  ...catalogKind ? { catalogKind } : {},
5317
- ...resolved.deprecated === true ? { deprecated: true } : {},
5599
+ ...resolved2.deprecated === true ? { deprecated: true } : {},
5318
5600
  hasEnum: variants.some((variant) => Array.isArray(variant.enum) || variant.const !== void 0)
5319
5601
  });
5320
5602
  }
@@ -5637,8 +5919,9 @@ var YAML_START = /^[A-Za-z_][\w.-]*\s*:(?:\s|$)/;
5637
5919
  var MINIMAL_DECK = '{\n "slides": [\n { "title": "" }\n ]\n}\n';
5638
5920
  var HINT_FORMS_LIMIT = 2;
5639
5921
  var Analyzer = class {
5640
- constructor(text2) {
5922
+ constructor(text2, editor = false) {
5641
5923
  this.text = text2;
5924
+ this.editor = editor;
5642
5925
  const lexed = tokenize(text2);
5643
5926
  this.comments = lexed.tokens.filter((token) => token.kind === "comment");
5644
5927
  this.tokens = lexed.tokens.filter((token) => token.kind !== "comment");
@@ -5646,6 +5929,7 @@ var Analyzer = class {
5646
5929
  this.locate = createLocator(text2);
5647
5930
  }
5648
5931
  text;
5932
+ editor;
5649
5933
  problems = [];
5650
5934
  tokens;
5651
5935
  comments;
@@ -6259,7 +6543,7 @@ var Analyzer = class {
6259
6543
  range: this.range(keyToken.start, colon.end),
6260
6544
  path,
6261
6545
  message: `\`${key3}\` needs a value.`,
6262
- next: `${hint.next} Press Ctrl+Space after the colon for options.`,
6546
+ next: this.editor ? `${hint.next} Press Ctrl+Space after the colon for options.` : hint.next,
6263
6547
  fixes
6264
6548
  });
6265
6549
  }
@@ -6471,7 +6755,7 @@ function valueHint(path) {
6471
6755
  }
6472
6756
  function analyzeJsonSyntax(text2, options2 = {}) {
6473
6757
  const limit = Math.max(0, options2.limit ?? 5);
6474
- const analyzer = new Analyzer(String(text2 ?? ""));
6758
+ const analyzer = new Analyzer(String(text2 ?? ""), options2.editor === true);
6475
6759
  try {
6476
6760
  analyzer.run();
6477
6761
  } catch {
@@ -6569,108 +6853,6 @@ function parseSource(source) {
6569
6853
  };
6570
6854
  }
6571
6855
 
6572
- // src/finding-text-util.ts
6573
- var WORDS = { object: "an object", array: "a list", string: "text", number: "a number", integer: "a whole number", boolean: "true or false", null: "null" };
6574
- var KIND_WORDS = { layouts: "layout", themes: "theme", colorSchemes: "color scheme", fontSchemes: "font scheme", narratives: "narrative", audiences: "audience", purposes: "purpose", tones: "tone", languages: "language" };
6575
- var KIND_EXAMPLES = { layouts: "`pillars` or `acme:hero`", themes: "`minimal` or `acme:bold`", colorSchemes: "`boost` or `acme:night`", fontSchemes: "`aptos` or `acme:brand`", narratives: "`classic-story`", audiences: "`board`", purposes: "`inform`", tones: "`formal`" };
6576
- var ALIASES = { middle: "center", centre: "center", centered: "center", centred: "center", justify: "start", left: "start", right: "end", col: "column", cols: "column", pic: "image", picture: "image", photo: "image", paragraph: "text", bullets: "list", bullet: "list" };
6577
- function segmentsOf(path) {
6578
- if (Array.isArray(path)) return path.map(String);
6579
- if (typeof path !== "string" || path === "" || path === "/") return [];
6580
- return path.replace(/^\//, "").split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
6581
- }
6582
- function pointerOf(segments) {
6583
- return segments.map((part) => `/${String(part).replaceAll("~", "~0").replaceAll("/", "~1")}`).join("");
6584
- }
6585
- var code = (value) => `\`${String(value)}\``;
6586
- var isIndex = (segment) => /^\d+$/.test(String(segment));
6587
- function cap(text2) {
6588
- return text2.startsWith("`") ? text2 : text2.charAt(0).toUpperCase() + text2.slice(1);
6589
- }
6590
- function fieldLabel(segments) {
6591
- if (!segments.length) return "the deck";
6592
- const last = segments[segments.length - 1];
6593
- if (isIndex(last)) {
6594
- const owner = [...segments].reverse().find((segment) => !isIndex(segment));
6595
- return owner === "slides" ? `slide ${Number(last) + 1}` : owner ? `${owner} entry ${Number(last) + 1}` : `entry ${Number(last) + 1}`;
6596
- }
6597
- return code(last);
6598
- }
6599
- function placeWords(segments) {
6600
- if (!segments.length) return "at the top level";
6601
- const slide = segments[0] === "slides" && segments.length >= 2 && isIndex(segments[1]) ? Number(segments[1]) + 1 : void 0;
6602
- if (slide !== void 0 && segments.length === 2) return `in slide ${slide}`;
6603
- const last = segments[segments.length - 1];
6604
- const inner = isIndex(last) ? fieldLabel(segments) : code(last);
6605
- return slide !== void 0 ? `in ${inner} of slide ${slide}` : `in ${inner}`;
6606
- }
6607
- function containerName(segments) {
6608
- if (!segments.length) return "the deck";
6609
- if (segments.length === 2 && segments[0] === "slides" && isIndex(segments[1])) return "a slide";
6610
- const last = segments[segments.length - 1];
6611
- return isIndex(last) ? fieldLabel(segments) : code(last);
6612
- }
6613
- function describeValue(value) {
6614
- if (value === void 0) return "missing";
6615
- if (value === null) return "null";
6616
- if (Array.isArray(value)) return value.length ? `a list of ${value.length}` : "an empty list";
6617
- if (typeof value === "object") return "an object";
6618
- if (typeof value === "string") return value === "" ? "empty" : code(value.length > 30 ? `${value.slice(0, 29)}\u2026` : value);
6619
- return `${typeof value === "number" ? "a number" : "true or false"} (${code(String(value))})`;
6620
- }
6621
- function describeKind(value) {
6622
- if (typeof value === "string") return value === "" ? "empty text" : `text (${describeValue(value)})`;
6623
- return describeValue(value);
6624
- }
6625
- function typeWords(type) {
6626
- const list = (Array.isArray(type) ? type : [type]).filter(Boolean).map((entry2) => WORDS[String(entry2)] ?? String(entry2));
6627
- return [...new Set(list)].join(" or ") || "a different kind of value";
6628
- }
6629
- function distance2(a, b) {
6630
- const x = a.toLowerCase();
6631
- const y = b.toLowerCase();
6632
- if (x === y) return 0;
6633
- const row = Array.from({ length: y.length + 1 }, (_, index) => index);
6634
- for (let i = 1; i <= x.length; i++) {
6635
- let previous = row[0];
6636
- row[0] = i;
6637
- for (let j = 1; j <= y.length; j++) {
6638
- const keep3 = row[j];
6639
- row[j] = Math.min(row[j] + 1, row[j - 1] + 1, previous + (x[i - 1] === y[j - 1] ? 0 : 1));
6640
- previous = keep3;
6641
- }
6642
- }
6643
- return row[y.length];
6644
- }
6645
- function nearest(value, candidates, limit = 5) {
6646
- const text2 = String(value ?? "");
6647
- const alias = ALIASES[text2.toLowerCase()];
6648
- const ranked = candidates.map((candidate) => ({ candidate, score: String(candidate).toLowerCase() === alias ? 0 : distance2(text2, String(candidate)) }));
6649
- ranked.sort((a, b) => a.score - b.score);
6650
- const close = ranked.filter((entry2) => entry2.score <= Math.max(2, Math.floor(text2.length / 4))).map((entry2) => entry2.candidate);
6651
- return { close: close.slice(0, limit), all: ranked.map((entry2) => entry2.candidate) };
6652
- }
6653
- function valueList(values, max = 5) {
6654
- const list = values.map((value) => typeof value === "string" ? value : JSON.stringify(value));
6655
- if (list.length <= max) return list.length > 1 ? `${list.slice(0, -1).join(", ")} or ${list.at(-1)}` : list.join("");
6656
- return `one of ${list.length} values (${list.slice(0, 3).join(", ")}, \u2026)`;
6657
- }
6658
- var firstSentence = (text2) => /^.*?[.!?](?=\s|$)/.exec(String(text2 ?? "").replace(/\s+/g, " ").trim())?.[0] ?? "";
6659
- function asNext(text2) {
6660
- const trimmed = text2.trim();
6661
- return /^[A-Z][a-z]/.test(trimmed) ? trimmed.charAt(0).toLowerCase() + trimmed.slice(1) : trimmed;
6662
- }
6663
- var isRecord3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
6664
- function readAt(document, segments) {
6665
- let value = document;
6666
- for (const segment of segments) {
6667
- if (Array.isArray(value)) value = value[Number(segment)];
6668
- else if (isRecord3(value)) value = value[segment];
6669
- else return void 0;
6670
- }
6671
- return value;
6672
- }
6673
-
6674
6856
  // src/finding-text-helpers.ts
6675
6857
  var ENDS = /[.?!]$/;
6676
6858
  function sentence(text2) {
@@ -6730,11 +6912,11 @@ function dotted(segments) {
6730
6912
  }
6731
6913
  function keysAt(helpers, path) {
6732
6914
  const value = helpers.valueAt(path);
6733
- return isRecord3(value) ? Object.keys(value) : [];
6915
+ return isRecord2(value) ? Object.keys(value) : [];
6734
6916
  }
6735
6917
  function idsAt(helpers, path) {
6736
6918
  const value = helpers.valueAt(path);
6737
- return Array.isArray(value) ? value.flatMap((entry2) => isRecord3(entry2) && typeof entry2.id === "string" ? [entry2.id] : []) : [];
6919
+ return Array.isArray(value) ? value.flatMap((entry2) => isRecord2(entry2) && typeof entry2.id === "string" ? [entry2.id] : []) : [];
6738
6920
  }
6739
6921
  function codeList(names2, max = 5, joiner = "and") {
6740
6922
  const shown = names2.slice(0, max).map(code);
@@ -6775,7 +6957,7 @@ function freshName(base, taken = []) {
6775
6957
  }
6776
6958
  var BLOCK_KINDS = ["chart", "image", "video", "table", "code", "metric", "quote", "timeline", "diagram", "items", "bullets", "text"];
6777
6959
  function blockKind(node) {
6778
- if (!isRecord3(node)) return void 0;
6960
+ if (!isRecord2(node)) return void 0;
6779
6961
  if (typeof node.type === "string" && node.type !== "group") return node.type;
6780
6962
  const found = BLOCK_KINDS.find((key3) => node[key3] !== void 0);
6781
6963
  if (found === "items" || found === "bullets") return "list";
@@ -6996,13 +7178,13 @@ function regionNamesOf(slideLayout, helpers) {
6996
7178
  const colon = slideLayout.indexOf(":");
6997
7179
  const group = colon > 0 ? slideLayout.slice(0, colon) : void 0;
6998
7180
  const id = colon > 0 ? slideLayout.slice(colon + 1) : slideLayout;
6999
- const record = (group ? [group] : ["custom", "default"]).map((name) => helpers.valueAt(["catalogs", name, "layouts", id])).find(isRecord3);
7181
+ const record = (group ? [group] : ["custom", "default"]).map((name) => helpers.valueAt(["catalogs", name, "layouts", id])).find(isRecord2);
7000
7182
  if (!record) return void 0;
7001
7183
  const names2 = [];
7002
7184
  const walk2 = (list) => {
7003
7185
  if (!Array.isArray(list)) return;
7004
7186
  for (const entry2 of list) {
7005
- if (!isRecord3(entry2)) continue;
7187
+ if (!isRecord2(entry2)) continue;
7006
7188
  if (typeof entry2.name === "string" && !["title", "subtitle", "tag"].includes(entry2.name)) names2.push(entry2.name);
7007
7189
  walk2(entry2.regions);
7008
7190
  }
@@ -7228,7 +7410,7 @@ var codeHighlightRangeReversed = (finding2) => {
7228
7410
  };
7229
7411
  var variableGroupOmitted = (finding2) => {
7230
7412
  const ids = [...finding2.message.matchAll(/'([a-z][a-z0-9-]*)'/g)].map((found) => found[1]);
7231
- const idParam = isRecord3(finding2.validation?.params) ? finding2.validation.params.id : void 0;
7413
+ const idParam = isRecord2(finding2.validation?.params) ? finding2.validation.params.id : void 0;
7232
7414
  const names2 = [...new Set(ids.length ? ids : typeof idParam === "string" ? [idParam] : [])];
7233
7415
  if (!names2.length) return void 0;
7234
7416
  const list = names2.length === 1 ? code(names2[0]) : `${names2.slice(0, -1).map((id) => code(id)).join(", ")} and ${code(names2.at(-1))}`;
@@ -7238,7 +7420,7 @@ var variableGroupOmitted = (finding2) => {
7238
7420
  };
7239
7421
  };
7240
7422
  var variableBuiltinMissing = (finding2, _context, helpers) => {
7241
- const idParam = isRecord3(finding2.validation?.params) ? finding2.validation.params.id : void 0;
7423
+ const idParam = isRecord2(finding2.validation?.params) ? finding2.validation.params.id : void 0;
7242
7424
  const id = (typeof idParam === "string" ? idParam : void 0) ?? match(finding2.message, /^Built-in '(.+?)' has no value/)?.[1] ?? match(finding2.message, /'\{\{(.+?)\}\}'/)?.[1];
7243
7425
  if (!id) return void 0;
7244
7426
  const root = id.split(".")[0];
@@ -7260,7 +7442,7 @@ var durationOutsideNarrative2 = (finding2) => {
7260
7442
  };
7261
7443
  var narrativeDurationRange = (_finding, _context, helpers) => {
7262
7444
  const range = helpers.valueAt(helpers.segments);
7263
- if (isRecord3(range) && typeof range.min === "number" && typeof range.max === "number") {
7445
+ if (isRecord2(range) && typeof range.min === "number" && typeof range.max === "number") {
7264
7446
  return {
7265
7447
  message: `The duration range has min ${range.min} greater than max ${range.max}.`,
7266
7448
  next: `swap them: ${code(`min: ${range.max}`)} and ${code(`max: ${range.min}`)}.`
@@ -7367,7 +7549,7 @@ var AUDIT_TEXT = {
7367
7549
  };
7368
7550
 
7369
7551
  // src/finding-text-format.ts
7370
- var params = (finding2) => isRecord3(finding2.validation?.params) ? finding2.validation.params : {};
7552
+ var params = (finding2) => isRecord2(finding2.validation?.params) ? finding2.validation.params : {};
7371
7553
  var text = (value) => typeof value === "string" ? value : void 0;
7372
7554
  var jsonSyntax = (finding2) => ({
7373
7555
  message: keep(finding2.message),
@@ -7544,7 +7726,7 @@ var dataColumnDuplicate = (finding2, _context, helpers) => {
7544
7726
  const name = unquote(match(finding2.message, /^column name ("(?:[^"\\]|\\.)*") is used by an earlier column/)?.[1]);
7545
7727
  if (!name) return void 0;
7546
7728
  const columns = helpers.valueAt(helpers.segments.slice(0, -1));
7547
- const taken = Array.isArray(columns) ? columns.map((entry2) => isRecord3(entry2) ? String(entry2.name) : String(entry2)) : [];
7729
+ const taken = Array.isArray(columns) ? columns.map((entry2) => isRecord2(entry2) ? String(entry2.name) : String(entry2)) : [];
7548
7730
  return {
7549
7731
  message: `Two columns are named ${code(name)}. Series and mappings address columns by name.`,
7550
7732
  next: `rename the second one (for example ${code(freshName(name, taken))}).`
@@ -7774,13 +7956,13 @@ var assetCycle = (finding2) => {
7774
7956
  next: "give one link a real source (an https:// address or embedded data) instead of an `asset:` reference."
7775
7957
  };
7776
7958
  };
7777
- var KIND_SINGULAR = (kind) => KIND_WORDS[kind] ?? kind.replace(/s$/, "");
7959
+ var KIND_SINGULAR2 = (kind) => KIND_WORDS[kind] ?? kind.replace(/s$/, "");
7778
7960
  var catalogRecord = (finding2, context) => {
7779
7961
  const [root, group, kind, id] = finding2.path.split("/").slice(1).map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
7780
7962
  if (root !== "catalogs" || !kind || !id) return void 0;
7781
7963
  const inner = describeFinding({ ...finding2, ruleId: "opf/schema" }, context);
7782
7964
  const registered = finding2.scope === "context";
7783
- const record = `${registered ? "The registered" : "The embedded"} ${KIND_SINGULAR(kind)} ${code(id)}`;
7965
+ const record = `${registered ? "The registered" : "The embedded"} ${KIND_SINGULAR2(kind)} ${code(id)}`;
7784
7966
  return {
7785
7967
  message: `${record} is invalid: ${inner.message.charAt(0).toLowerCase()}${inner.message.slice(1)}`,
7786
7968
  next: inner.next ?? `fix the record; references to it are reported too.`
@@ -7838,12 +8020,12 @@ var unresolvedReference2 = (finding2, _context, helpers) => {
7838
8020
  return typeof value === "string" ? value : void 0;
7839
8021
  })();
7840
8022
  if (!reference) return void 0;
7841
- const noun = cap(KIND_SINGULAR(kind || (found?.[1] ?? "catalog record").toLowerCase()));
8023
+ const noun = cap(KIND_SINGULAR2(kind || (found?.[1] ?? "catalog record").toLowerCase()));
7842
8024
  const colon = reference.indexOf(":");
7843
8025
  const group = colon > 0 ? reference.slice(0, colon) : void 0;
7844
8026
  const bare = colon > 0 ? reference.slice(colon + 1) : reference;
7845
8027
  const embeddedIn = group ? [group] : ["custom", "default"];
7846
- const embedded = kind && embeddedIn.some((name) => isRecord3(helpers.valueAt(["catalogs", name, kind, bare])));
8028
+ const embedded = kind && embeddedIn.some((name) => isRecord2(helpers.valueAt(["catalogs", name, kind, bare])));
7847
8029
  const suggestions = (finding2.suggestions ?? []).slice(0, 5).map((entry2) => String(entry2.value));
7848
8030
  if (embedded) {
7849
8031
  return {
@@ -7854,9 +8036,10 @@ var unresolvedReference2 = (finding2, _context, helpers) => {
7854
8036
  const message = group && /declares no catalogs\./.test(finding2.message) ? `${noun} ${code(reference)} uses catalog group ${code(group)}, which the deck does not declare, so ${FALLBACK(kind)}.` : `${noun} ${code(reference)} is not embedded or in a registered catalog, so ${FALLBACK(kind)}.`;
7855
8037
  const { close } = nearest(reference, suggestions);
7856
8038
  const remove = kind === "layouts" ? "remove the reference to let OPF pick" : "remove the reference";
8039
+ const listed = kind ? `${code("search_catalog")} and ${code(`opf catalog ${kind}`)} list the ${KIND_SINGULAR2(kind)} ids` : "";
7857
8040
  return {
7858
8041
  message,
7859
- next: close.length ? `did you mean ${code(close[0])}?` : suggestions.length ? `choose one of ${codeList(suggestions, 5, "or")}, embed the record under ${code("catalogs.custom")}, or ${remove}.` : `embed the record under ${code("catalogs.custom")}, register the catalog that defines it, or ${remove}.`
8042
+ next: close.length ? `did you mean ${code(close[0])}?` : suggestions.length ? `choose one of ${codeList(suggestions, 5, "or")}, embed the record under ${code("catalogs.custom")}, or ${remove}.` : kind === "layouts" ? `remove ${code("layout")} and the slide composes automatically from its content, or use a layout that exists (${listed}); a record of your own goes under ${code("catalogs.custom")}.` : listed ? `use a ${KIND_SINGULAR2(kind)} that exists (${listed}), embed the record under ${code("catalogs.custom")}, or ${remove}.` : `embed the record under ${code("catalogs.custom")}, register the catalog that defines it, or ${remove}.`
7860
8043
  };
7861
8044
  };
7862
8045
  var catalogRecordNotInSource = (finding2) => {
@@ -8027,12 +8210,12 @@ var LINE_KEYWORDS = ["Note:", "Notes:"];
8027
8210
  var keep2 = (finding2, next) => next ? { message: finding2.message, next } : { message: finding2.message };
8028
8211
  var wholeHelp = (finding2) => keep2(finding2, finding2.help ? asNext(finding2.help) : void 0);
8029
8212
  var line = (finding2) => finding2.location?.line ?? 1;
8030
- var quoted = (text2, pattern) => pattern.exec(text2)?.[1];
8213
+ var quoted2 = (text2, pattern) => pattern.exec(text2)?.[1];
8031
8214
  var optionKeys = (kind) => kind === "block" ? BLOCK_OPTION_KEYS : SLIDE_OPTION_KEYS;
8032
8215
  var options = {
8033
8216
  "markdown/options-unknown-key": (finding2) => {
8034
- const kind = quoted(finding2.message, /^Unknown (slide|block) option/) ?? "slide";
8035
- const key3 = quoted(finding2.message, /option "(.*)"\.$/) ?? "";
8217
+ const kind = quoted2(finding2.message, /^Unknown (slide|block) option/) ?? "slide";
8218
+ const key3 = quoted2(finding2.message, /option "(.*)"\.$/) ?? "";
8036
8219
  const guess = finding2.suggestions?.[0]?.value;
8037
8220
  const keys = optionKeys(kind).join(", ");
8038
8221
  return {
@@ -8042,14 +8225,14 @@ var options = {
8042
8225
  },
8043
8226
  "markdown/options-value": (finding2) => {
8044
8227
  if (/^hidden takes/.test(finding2.message)) return keep2(finding2, "write `hidden=true`, `hidden=false` or just `hidden`.");
8045
- const key3 = quoted(finding2.message, /^Option (\w+) needs a value/);
8228
+ const key3 = quoted2(finding2.message, /^Option (\w+) needs a value/);
8046
8229
  if (key3) return keep2(finding2, `write ${code(`${key3}=value`)}, for example ${code(key3 === "layout" ? "layout=title" : key3 === "id" ? "id=cover" : `${key3}=name`)}.`);
8047
8230
  if (/^as takes/.test(finding2.message)) return keep2(finding2, "write `as=bullets` before a list or `as=video` before an image line.");
8048
8231
  return keep2(finding2, "put `as=bullets` before a list and `as=video` before an image line, or remove `as`.");
8049
8232
  },
8050
8233
  "markdown/options-syntax": (finding2) => keep2(finding2, `write options as ${code("key=value")} pairs, with text in double quotes: ${code('<!-- slide: layout=title section="Part 1" -->')}.`),
8051
8234
  "markdown/options-duplicate": (finding2) => {
8052
- const key3 = quoted(finding2.message, /^Option (\w+) is given twice/);
8235
+ const key3 = quoted2(finding2.message, /^Option (\w+) is given twice/);
8053
8236
  if (key3) return keep2(finding2, `keep one ${code(`${key3}=`)} in the comment.`);
8054
8237
  return keep2(finding2, "merge them into one.");
8055
8238
  },
@@ -8082,7 +8265,7 @@ var markdown = {
8082
8265
  "markdown/timeline-description": (finding2) => keep2(finding2, "put the event first, then its description indented below it."),
8083
8266
  "markdown/timeline-events": (finding2) => keep2(finding2, "write one event per line, for example `2024 Q1 \u2014 Pilot`."),
8084
8267
  "markdown/slide-property-conflict": (finding2) => {
8085
- const field = quoted(finding2.message, /property "(.*)" is set twice/) ?? finding2.path.split("/").at(-1) ?? "field";
8268
+ const field = quoted2(finding2.message, /property "(.*)" is set twice/) ?? finding2.path.split("/").at(-1) ?? "field";
8086
8269
  return { message: `${code(field)} is set both in the Markdown and in the \`opf-slide\` fence.`, next: "keep it in one of the two places." };
8087
8270
  },
8088
8271
  "markdown/duplicate-title": (finding2) => keep2(finding2, "use `---` to start a new slide, or `##` for the subtitle."),
@@ -8264,6 +8447,14 @@ function describeSchema(finding2, context, helpers) {
8264
8447
  }
8265
8448
  case "oneOf":
8266
8449
  case "anyOf": {
8450
+ if (Array.isArray(params2.properties)) {
8451
+ const fields2 = params2.properties.map((name) => code(name)).join(", ");
8452
+ const kinds = Array.isArray(params2.belongsTo) ? params2.belongsTo.map((kind) => code(kind)).join(" or ") : "";
8453
+ return {
8454
+ message: `${cap(label)} has ${fields2}, which none of its forms has${kinds ? `; those are fields of ${kinds}` : ""}.`,
8455
+ next: kinds ? `put them in their own block's ${kinds}, or rewrite this value in one of its forms.` : `rewrite it as one of: ${(alternatives ?? []).join("; ")}.`
8456
+ };
8457
+ }
8267
8458
  const forms = (alternatives ?? []).map((entry2) => String(entry2).split(":")[0]?.trim() ?? "");
8268
8459
  const words = forms.length ? [...new Set(forms.map((form) => WORDS[form] ?? form))].slice(0, 3).join(" or ") : "a different kind of value";
8269
8460
  return { message: `${cap(label)} should be ${words}, but it is ${describeKind(actual)}.`, next: forms.length ? `write ${words}.` : "check the schema reference for this field." };
@@ -8308,7 +8499,8 @@ function describeSchema(finding2, context, helpers) {
8308
8499
  const name = String(params2.additionalProperty ?? segments.at(-1) ?? "");
8309
8500
  const parent = segments.slice(0, -1);
8310
8501
  const allowed = schemaKeys(parent, context);
8311
- const hint = nearest(name, allowed).close[0];
8502
+ const suggested = finding2.suggestions?.[0]?.value;
8503
+ const hint = typeof suggested === "string" && allowed.includes(suggested) ? suggested : nearest(name, allowed).close[0];
8312
8504
  return {
8313
8505
  message: `${code(name)} is not a property of ${containerName(parent)}.`,
8314
8506
  next: `${hint ? `did you mean ${code(hint)}? ` : ""}To keep custom data, put it under ${code("extensions")}.`.trim()
@@ -8392,7 +8584,7 @@ function schemaFixes(finding2, document) {
8392
8584
  switch (validation.keyword) {
8393
8585
  case "required": {
8394
8586
  const property = String(params2.missingProperty ?? "");
8395
- if (!property || !isRecord3(readAt(document, segments)) || Object.hasOwn(readAt(document, segments), property)) return [];
8587
+ if (!property || !isRecord2(readAt(document, segments)) || Object.hasOwn(readAt(document, segments), property)) return [];
8396
8588
  const value = starterValue(document, segments, property);
8397
8589
  if (value === void 0) return [];
8398
8590
  return [patch(`add:${property}`, `Add \`${property}\``, [{ op: "add", path: pointerOf([...segments, property]), value }])];
@@ -8408,7 +8600,7 @@ function schemaFixes(finding2, document) {
8408
8600
  const name = String(params2.additionalProperty ?? segments.at(-1) ?? "");
8409
8601
  const parent = segments.slice(0, -1);
8410
8602
  const owner = readAt(document, parent);
8411
- if (!name || !isRecord3(owner) || !Object.hasOwn(owner, name)) return [];
8603
+ if (!name || !isRecord2(owner) || !Object.hasOwn(owner, name)) return [];
8412
8604
  const fixes = [];
8413
8605
  for (const suggestion of finding2.suggestions ?? []) {
8414
8606
  const target = String(suggestion.value);
@@ -8417,14 +8609,14 @@ function schemaFixes(finding2, document) {
8417
8609
  if (allowsKey(document, parent, "extensions") && name !== "extensions") {
8418
8610
  const existing = owner.extensions;
8419
8611
  if (existing === void 0) fixes.push(patch("move-to-extensions", "Move into extensions", [{ op: "add", path: pointerOf([...parent, "extensions"]), value: {} }, { op: "move", from: finding2.path, path: pointerOf([...parent, "extensions", name]) }]));
8420
- else if (isRecord3(existing) && !Object.hasOwn(existing, name)) fixes.push(patch("move-to-extensions", "Move into extensions", [{ op: "move", from: finding2.path, path: pointerOf([...parent, "extensions", name]) }]));
8612
+ else if (isRecord2(existing) && !Object.hasOwn(existing, name)) fixes.push(patch("move-to-extensions", "Move into extensions", [{ op: "move", from: finding2.path, path: pointerOf([...parent, "extensions", name]) }]));
8421
8613
  }
8422
8614
  return fixes;
8423
8615
  }
8424
8616
  case "type": {
8425
8617
  const current = readAt(document, segments);
8426
8618
  if (current === void 0) return [];
8427
- if (params2.type === "array" && (typeof current === "string" || isRecord3(current))) return [patch("wrap-in-list", "Wrap in a list", [{ op: "replace", path: finding2.path, value: [current] }], typeof current === "string")];
8619
+ if (params2.type === "array" && (typeof current === "string" || isRecord2(current))) return [patch("wrap-in-list", "Wrap in a list", [{ op: "replace", path: finding2.path, value: [current] }], typeof current === "string")];
8428
8620
  if (params2.type === "string" && (typeof current === "number" || typeof current === "boolean")) return [patch("convert-to-string", "Convert to string", [{ op: "replace", path: finding2.path, value: String(current) }], true)];
8429
8621
  return [];
8430
8622
  }
@@ -8452,15 +8644,15 @@ function resolveDrawnFontFamilies(families, measurement, keepsName) {
8452
8644
  const named = families[role];
8453
8645
  if (typeof named !== "string" || !named) continue;
8454
8646
  try {
8455
- const resolved = resolve2.call(measurement, { fontFamily: named, fontWeight: role === "heading" ? 700 : 400 });
8647
+ const resolved2 = resolve2.call(measurement, { fontFamily: named, fontWeight: role === "heading" ? 700 : 400 });
8456
8648
  let keep3;
8457
- if (keepsName) keep3 = keepsName(named, resolved.fontFamily);
8649
+ if (keepsName) keep3 = keepsName(named, resolved2.fontFamily);
8458
8650
  else {
8459
- const regular = role === "heading" ? resolve2.call(measurement, { fontFamily: named, fontWeight: 400 }) : resolved;
8460
- const encoded = resolved.symbolEncoding != null;
8461
- keep3 = encoded || regular.fontWeight !== void 0 && regular.fontWeight !== 400 && resolved.fontFamily.toLowerCase() !== named.toLowerCase();
8651
+ const regular = role === "heading" ? resolve2.call(measurement, { fontFamily: named, fontWeight: 400 }) : resolved2;
8652
+ const encoded = resolved2.symbolEncoding != null;
8653
+ keep3 = encoded || regular.fontWeight !== void 0 && regular.fontWeight !== 400 && resolved2.fontFamily.toLowerCase() !== named.toLowerCase();
8462
8654
  }
8463
- if (!keep3) drawn[role] = resolved.fontFamily;
8655
+ if (!keep3) drawn[role] = resolved2.fontFamily;
8464
8656
  } catch {
8465
8657
  }
8466
8658
  }
@@ -8469,24 +8661,24 @@ function resolveDrawnFontFamilies(families, measurement, keepsName) {
8469
8661
 
8470
8662
  // src/script-measurement.ts
8471
8663
  function scriptProfile(presentation, slideIndex, options2, language) {
8472
- let resolved;
8664
+ let resolved2;
8473
8665
  try {
8474
- resolved = resolveScriptFonts(presentation, { slideIndex, ...options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {}, ...language === void 0 ? {} : { language } });
8666
+ resolved2 = resolveScriptFonts(presentation, { slideIndex, ...options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {}, ...language === void 0 ? {} : { language } });
8475
8667
  } catch {
8476
- resolved = void 0;
8668
+ resolved2 = void 0;
8477
8669
  }
8478
8670
  const slots = (role) => {
8479
8671
  const latin = options2.fontFamilies[role];
8480
- const slot = (key3) => !resolved || resolved.sources[key3] === "latin" || resolved.sources[key3] === "schemeFamily" ? latin : resolved[role][key3] ?? latin;
8672
+ const slot = (key3) => !resolved2 || resolved2.sources[key3] === "latin" || resolved2.sources[key3] === "schemeFamily" ? latin : resolved2[role][key3] ?? latin;
8481
8673
  return { latin, eastAsian: slot("eastAsian"), complexScript: slot("complexScript") };
8482
8674
  };
8483
8675
  return {
8484
8676
  heading: slots("heading"),
8485
8677
  body: slots("body"),
8486
- ...resolved?.supplement ? { supplement: resolved.supplement } : {},
8487
- script: resolved?.script ?? "Zzzz",
8488
- ...resolved ? { scriptRole: resolved.scriptRole, bcp47: resolved.bcp47, lang: resolved.lang, languageSource: resolved.languageSource, direction: resolved.direction } : {},
8489
- rtl: resolved?.rtl === true,
8678
+ ...resolved2?.supplement ? { supplement: resolved2.supplement } : {},
8679
+ script: resolved2?.script ?? "Zzzz",
8680
+ ...resolved2 ? { scriptRole: resolved2.scriptRole, bcp47: resolved2.bcp47, lang: resolved2.lang, languageSource: resolved2.languageSource, direction: resolved2.direction } : {},
8681
+ rtl: resolved2?.rtl === true,
8490
8682
  serif: options2.serif
8491
8683
  };
8492
8684
  }
@@ -8523,8 +8715,8 @@ function slideScriptMeasurement(presentation, slideIndex, measurement, options2)
8523
8715
  function resolveSlideScriptMeasurement(presentation, slideIndex, measurement, options2 = {}) {
8524
8716
  if (typeof measurement.forScripts !== "function") return measurement;
8525
8717
  const { fontScheme } = resolveDesignRecords(presentation, slideIndex, options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {});
8526
- const resolved = resolveFontFamilies(fontScheme);
8527
- const fontFamilies = { heading: options2.fontFamilies?.heading ?? resolved.heading, body: options2.fontFamilies?.body ?? resolved.body };
8718
+ const resolved2 = resolveFontFamilies(fontScheme);
8719
+ const fontFamilies = { heading: options2.fontFamilies?.heading ?? resolved2.heading, body: options2.fontFamilies?.body ?? resolved2.body };
8528
8720
  return slideScriptMeasurement(presentation, slideIndex, measurement, { ...options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {}, fontFamilies, serif: fontScheme.type === "serif" });
8529
8721
  }
8530
8722
 
@@ -8705,33 +8897,33 @@ function buildSlides(document, options2, memo) {
8705
8897
  const measurement = lazy(() => {
8706
8898
  const host = measurementFor(options2, index);
8707
8899
  if (!host) return void 0;
8708
- const { resolved: resolved2 } = baseContext();
8709
- return slideScriptMeasurement(document, index, host, { catalogs: options2.catalogs, fontFamilies: resolveFontFamilies(resolved2.fontScheme), serif: resolved2.fontScheme.type === "serif" });
8900
+ const { resolved: resolved3 } = baseContext();
8901
+ return slideScriptMeasurement(document, index, host, { catalogs: options2.catalogs, fontFamilies: resolveFontFamilies(resolved3.fontScheme), serif: resolved3.fontScheme.type === "serif" });
8710
8902
  });
8711
- const resolved = lazy(() => {
8903
+ const resolved2 = lazy(() => {
8712
8904
  const textMeasurement = measurement();
8713
8905
  const slideContext = baseContext();
8714
8906
  return textMeasurement ? { ...slideContext, options: { ...slideContext.options, textMeasurement } } : slideContext;
8715
8907
  });
8716
- const design = lazy(() => resolveDesign(document, index, resolved()));
8717
- const layout = lazy(() => resolved().options.layout);
8908
+ const design = lazy(() => resolveDesign(document, index, resolved2()));
8909
+ const layout = lazy(() => resolved2().options.layout);
8718
8910
  const compute = () => {
8719
8911
  const result = { layoutDiagnostics: [] };
8720
8912
  let fontFamilies;
8721
8913
  const compose = (input, withLayout) => {
8722
- const options3 = resolved().options;
8914
+ const options3 = resolved2().options;
8723
8915
  fontFamilies ??= options3.fontFamilies && resolveDrawnFontFamilies(options3.fontFamilies, options3.textMeasurement);
8724
8916
  return composeSlide(input, { ...options3, ...fontFamilies ? { fontFamilies } : {}, layout: withLayout });
8725
8917
  };
8726
8918
  try {
8727
- result.composition = compose(resolved().slide, layout());
8919
+ result.composition = compose(resolved2().slide, layout());
8728
8920
  result.layoutDiagnostics.push(...result.composition.diagnostics.map((diagnostic) => ({ diagnostic, strict: false })));
8729
8921
  } catch (error) {
8730
8922
  if (error instanceof OPFCompositionError) {
8731
8923
  result.layoutDiagnostics.push(...error.diagnostics.map((diagnostic) => ({ diagnostic, strict: true })));
8732
8924
  try {
8733
8925
  const relaxedLayout = layout();
8734
- result.composition = compose(relax(resolved().slide), relaxedLayout ? relax(relaxedLayout) : void 0);
8926
+ result.composition = compose(relax(resolved2().slide), relaxedLayout ? relax(relaxedLayout) : void 0);
8735
8927
  } catch (second) {
8736
8928
  result.layoutError = second instanceof Error ? second.message : String(second);
8737
8929
  }
@@ -8975,7 +9167,7 @@ var ValidationCompositionCache = class {
8975
9167
  // src/validator.ts
8976
9168
  var SEVERITIES = ["error", "warning", "info"];
8977
9169
  var OPTION_KEYS = ["only", "ignore", "severity", "ignorePaths", "catalogs", "contracts", "thresholds", "fonts", "chartPalette", "template", "values"];
8978
- var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
9170
+ var isObject3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8979
9171
  var OPFValidationError = class extends Error {
8980
9172
  /** The full report that failed. */
8981
9173
  report;
@@ -9008,14 +9200,14 @@ function names(list, what) {
9008
9200
  return result;
9009
9201
  }
9010
9202
  function resolveOptions(options2) {
9011
- if (!isObject2(options2)) throw new TypeError("Validate options must be an object.");
9203
+ if (!isObject3(options2)) throw new TypeError("Validate options must be an object.");
9012
9204
  for (const key3 of Object.keys(options2)) if (!OPTION_KEYS.includes(key3)) throw new TypeError(`Unknown validate option ${JSON.stringify(key3)}. Options: ${OPTION_KEYS.join(", ")}.`);
9013
9205
  checkDocumentOptions(options2);
9014
9206
  const only = names(options2.only, "only");
9015
9207
  const ignore = names(options2.ignore, "ignore");
9016
9208
  const severity = /* @__PURE__ */ new Map();
9017
9209
  if (options2.severity !== void 0) {
9018
- if (!isObject2(options2.severity)) throw new TypeError('Validate severity must map rule ids or category names to a severity or "off".');
9210
+ if (!isObject3(options2.severity)) throw new TypeError('Validate severity must map rule ids or category names to a severity or "off".');
9019
9211
  for (const [name, value] of Object.entries(options2.severity)) {
9020
9212
  if (typeof value !== "string" || value !== "off" && !SEVERITIES.includes(value)) throw new TypeError(`Validate severity for ${JSON.stringify(name)} must be error, warning, info or off.`);
9021
9213
  const found = ruleFor(name, "severity");
@@ -9026,7 +9218,7 @@ function resolveOptions(options2) {
9026
9218
  if (options2.ignorePaths !== void 0) {
9027
9219
  if (!Array.isArray(options2.ignorePaths)) throw new TypeError("Validate ignorePaths must be an array of {rule, path}.");
9028
9220
  for (const entry2 of options2.ignorePaths) {
9029
- if (!isObject2(entry2) || typeof entry2.rule !== "string" || typeof entry2.path !== "string" || entry2.path !== "" && !entry2.path.startsWith("/"))
9221
+ if (!isObject3(entry2) || typeof entry2.rule !== "string" || typeof entry2.path !== "string" || entry2.path !== "" && !entry2.path.startsWith("/"))
9030
9222
  throw new TypeError('Each validate ignorePaths entry needs a rule id, category name or "*", and a JSON Pointer path.');
9031
9223
  const found = entry2.rule === "*" ? "*" : ruleFor(entry2.rule, "ignorePaths");
9032
9224
  ignorePaths.push({
@@ -9037,7 +9229,7 @@ function resolveOptions(options2) {
9037
9229
  }
9038
9230
  const thresholds = { ...DEFAULT_VALIDATION_THRESHOLDS };
9039
9231
  if (options2.thresholds !== void 0) {
9040
- if (!isObject2(options2.thresholds)) throw new TypeError("Validate thresholds must be an object.");
9232
+ if (!isObject3(options2.thresholds)) throw new TypeError("Validate thresholds must be an object.");
9041
9233
  for (const [key3, value] of Object.entries(options2.thresholds)) {
9042
9234
  if (!(key3 in DEFAULT_VALIDATION_THRESHOLDS)) throw new TypeError(`Unknown validate threshold ${JSON.stringify(key3)}. Thresholds: ${Object.keys(DEFAULT_VALIDATION_THRESHOLDS).join(", ")}.`);
9043
9235
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new TypeError(`Validate threshold ${key3} must be a positive number.`);
@@ -9045,14 +9237,14 @@ function resolveOptions(options2) {
9045
9237
  }
9046
9238
  }
9047
9239
  if (options2.fonts !== void 0) {
9048
- if (!isObject2(options2.fonts)) throw new TypeError("Validate fonts must be a fonts object with a textMeasurement.");
9240
+ if (!isObject3(options2.fonts)) throw new TypeError("Validate fonts must be a fonts object with a textMeasurement.");
9049
9241
  const measurement = options2.fonts.textMeasurement;
9050
- if (measurement !== void 0 && typeof measurement !== "function" && !isObject2(measurement)) throw new TypeError("Validate fonts.textMeasurement must be a text measurement, or a function of the slide index.");
9242
+ if (measurement !== void 0 && typeof measurement !== "function" && !isObject3(measurement)) throw new TypeError("Validate fonts.textMeasurement must be a text measurement, or a function of the slide index.");
9051
9243
  }
9052
9244
  if (options2.chartPalette !== void 0 && (!Array.isArray(options2.chartPalette) || !options2.chartPalette.every((color) => typeof color === "string" && /^#[0-9a-fA-F]{6}$/.test(color))))
9053
9245
  throw new TypeError("Validate chartPalette must be an array of #RRGGBB colours.");
9054
9246
  if (options2.template !== void 0 && typeof options2.template !== "boolean") throw new TypeError("Validate template must be true or false.");
9055
- if (options2.values !== void 0 && !isObject2(options2.values)) throw new TypeError("Validate values must be an object keyed by variable id.");
9247
+ if (options2.values !== void 0 && !isObject3(options2.values)) throw new TypeError("Validate values must be an object keyed by variable id.");
9056
9248
  const level = (info) => severity.get(info.id) ?? severity.get(info.category);
9057
9249
  const off = (info) => level(info) === "off" || !!ignore?.rules.has(info.id) || !!ignore?.categories.has(info.category);
9058
9250
  return {
@@ -9109,7 +9301,7 @@ function syntaxReport(parsed, run) {
9109
9301
  function validateDocument(document, run, parsed, cache) {
9110
9302
  const engine = validateAgainstSchema(document, "presentation", { template: run.options.template, values: run.options.values, ...run.options.catalogs ? { catalogs: run.options.catalogs } : {} });
9111
9303
  const schemaValid = engine.errors.length === 0;
9112
- const slides = isObject2(document) && Array.isArray(document.slides) ? document.slides : [];
9304
+ const slides = isObject3(document) && Array.isArray(document.slides) ? document.slides : [];
9113
9305
  const auditWanted = auditInfos.some((info) => run.enabled(info));
9114
9306
  const explainFormat = !schemaValid && auditWanted;
9115
9307
  const enabledRule = (info) => info ? run.enabled(info) || explainFormat && info.category === "format" && !run.off(info) : true;
@@ -9174,7 +9366,7 @@ function validateDocument(document, run, parsed, cache) {
9174
9366
  if (info && run.ignored(info, splitPointer(next.path))) continue;
9175
9367
  const index = slideOf(next.path);
9176
9368
  if (next.slide === void 0 && index !== void 0 && next.scope !== "context") {
9177
- const id = isObject2(slides[index]) ? slides[index].id : void 0;
9369
+ const id = isObject3(slides[index]) ? slides[index].id : void 0;
9178
9370
  next.slide = index;
9179
9371
  if (typeof id === "string") next.slideId = id;
9180
9372
  }
@@ -9271,4 +9463,4 @@ function assertValidCatalogRecord(kind, value) {
9271
9463
  if (!report2.valid) throw new OPFValidationError(report2);
9272
9464
  }
9273
9465
 
9274
- 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, createValidator, 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 };
9466
+ 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, createValidator, describeField, describeFinding, 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 };