@openpresentation/opf 0.34.1 → 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-SR6T4LKI.js → chunk-AQ3WR3H7.js} +2 -2
  6. package/dist/{chunk-X72WPTST.js → chunk-EQCZ2SFD.js} +6 -6
  7. package/dist/chunk-HSXWDXKM.js +1 -0
  8. package/dist/{chunk-6PMXVP5G.js → chunk-HX4HEJB4.js} +201 -21
  9. package/dist/{chunk-MAFJ5O2D.js → chunk-IDYYLJCQ.js} +6 -6
  10. package/dist/{chunk-CJVKOJ6B.js → chunk-IGT4523S.js} +406 -58
  11. package/dist/{chunk-XLSWZSQS.js → chunk-KJFCHCWV.js} +2 -2
  12. package/dist/{chunk-ABA2D6X5.js → chunk-MDAXXFAY.js} +2 -2
  13. package/dist/{chunk-AGYPRTEC.js → chunk-NMZCPZ3R.js} +3 -3
  14. package/dist/{chunk-2B6GLT2O.js → chunk-P2X4BBW2.js} +1 -1
  15. package/dist/{chunk-FCSYIBVR.js → chunk-PHOSM2RA.js} +1 -1
  16. package/dist/{chunk-MUILZGRY.js → chunk-RM4Z7ZSW.js} +4 -4
  17. package/dist/{chunk-244OPLAV.js → chunk-UKI43JE6.js} +1 -1
  18. package/dist/{chunk-AAWHOCXS.js → chunk-V4G3BYPY.js} +2 -2
  19. package/dist/{chunk-LCT5ZV3Q.js → chunk-VI7VWDTN.js} +17 -1
  20. package/dist/{chunk-CQXBGZQP.js → chunk-VVPPMHP6.js} +5 -5
  21. package/dist/{chunk-AEHDXNZX.js → chunk-WBPXRUZT.js} +459 -270
  22. package/dist/{chunk-L3MCLD3X.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-CyNRlWGw.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 +16 -16
  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-CSQ5EHD2.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;
@@ -3667,6 +3871,12 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3667
3871
  help = `Write ${JSON.stringify(nearest2[0].value)} instead; ${JSON.stringify(typedName)} is not a field of this object.`;
3668
3872
  else if (typedName !== void 0 && typeof nearest2[0]?.value === "string")
3669
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
+ }
3670
3880
  return finding(ruleId, {
3671
3881
  ...severity ? { severity } : {},
3672
3882
  path,
@@ -3686,7 +3896,41 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3686
3896
  } : nearest2.length ? { suggestions: nearest2 } : {}
3687
3897
  });
3688
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
+ }
3689
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
+ }
3690
3934
  var logicalName = (name) => name.split(":").map((part) => part.split("+").map((word) => word === "left" ? "start" : word === "right" ? "end" : word).join("+")).join(":");
3691
3935
  function nearestProperties(issue2, fallbackRoot, pointerToKeyword, schemaName) {
3692
3936
  const typed = issue2.params.additionalProperty;
@@ -3700,9 +3944,9 @@ function nearestProperties(issue2, fallbackRoot, pointerToKeyword, schemaName) {
3700
3944
  else return [];
3701
3945
  }
3702
3946
  if (!isRecord(node) || !isRecord(node.properties)) return [];
3703
- const root = rootEntry?.schema ?? fallbackRoot, limit = typed.length <= 3 ? 1 : 2, lower = typed.toLowerCase();
3947
+ const root = rootEntry?.schema ?? fallbackRoot, lower = typed.toLowerCase();
3704
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 : [];
3705
- 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));
3706
3950
  return [...exact, ...near].slice(0, NEAREST_PROPERTIES).map((name) => ({
3707
3951
  value: name,
3708
3952
  label: name,
@@ -3720,12 +3964,12 @@ function resolve(cursor, seen = /* @__PURE__ */ new Set()) {
3720
3964
  if (!root) return { ...cursor, schema: {} };
3721
3965
  const target = at(root, fragment);
3722
3966
  if (!object(target)) return { ...cursor, schema: {} };
3723
- const resolved = resolve(
3967
+ const resolved2 = resolve(
3724
3968
  { schema: target, root, path: fragment },
3725
3969
  seen
3726
3970
  );
3727
3971
  const { $ref, ...rest } = cursor.schema;
3728
- return { ...resolved, schema: { ...resolved.schema, ...rest } };
3972
+ return { ...resolved2, schema: { ...resolved2.schema, ...rest } };
3729
3973
  }
3730
3974
  function score(schema, value) {
3731
3975
  const type = schema.type;
@@ -3746,21 +3990,21 @@ function score(schema, value) {
3746
3990
  return result;
3747
3991
  }
3748
3992
  function active(cursor, value) {
3749
- const resolved = resolve(cursor), alternatives = resolved.schema.oneOf ?? resolved.schema.anyOf;
3750
- if (!Array.isArray(alternatives)) return resolved;
3751
- 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";
3752
3996
  const candidates = alternatives.filter(object).map(
3753
3997
  (schema, index) => active(
3754
3998
  {
3755
3999
  schema,
3756
- root: resolved.root,
3757
- path: `${resolved.path}/${keyword}/${index}`
4000
+ root: resolved2.root,
4001
+ path: `${resolved2.path}/${keyword}/${index}`
3758
4002
  },
3759
4003
  value
3760
4004
  )
3761
4005
  );
3762
4006
  const selected = candidates.sort((a, b) => score(b.schema, value) - score(a.schema, value))[0];
3763
- return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved] } : resolved;
4007
+ return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved2] } : resolved2;
3764
4008
  }
3765
4009
  function childCursor(cursors, key3) {
3766
4010
  for (const keyword of [
@@ -3802,8 +4046,8 @@ function fields(document) {
3802
4046
  const entry2 = stack.pop();
3803
4047
  if (!entry2) break;
3804
4048
  if (entry2.ancestors.includes(entry2.value)) continue;
3805
- const resolved = resolve(entry2.cursor), selected = active(entry2.cursor, entry2.value);
3806
- const assetReference2 = [resolved, selected].some(
4049
+ const resolved2 = resolve(entry2.cursor), selected = active(entry2.cursor, entry2.value);
4050
+ const assetReference2 = [resolved2, selected].some(
3807
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(
3808
4052
  (example) => typeof example === "string" && example.startsWith("asset:")
3809
4053
  )
@@ -3811,11 +4055,11 @@ function fields(document) {
3811
4055
  result.push({
3812
4056
  path: pointer3(entry2.path),
3813
4057
  value: entry2.value,
3814
- cursor: resolved,
4058
+ cursor: resolved2,
3815
4059
  assetReference: assetReference2
3816
4060
  });
3817
4061
  const ancestors = [...entry2.ancestors, entry2.value];
3818
- const cursors = [selected, ...selected.baseSchemas ?? [], resolved];
4062
+ const cursors = [selected, ...selected.baseSchemas ?? [], resolved2];
3819
4063
  const arrayCursor = cursors.find((cursor) => object(cursor.schema.items));
3820
4064
  if (Array.isArray(entry2.value) && arrayCursor)
3821
4065
  entry2.value.forEach((value, index) => {
@@ -3885,7 +4129,7 @@ function embeddedRecordFindings(document, options2, findings) {
3885
4129
  }
3886
4130
  return invalid;
3887
4131
  }
3888
- function distance(a, b) {
4132
+ function distance2(a, b) {
3889
4133
  a = a.slice(0, 128);
3890
4134
  b = b.slice(0, 128);
3891
4135
  let row = Array.from({ length: b.length + 1 }, (_, i) => i);
@@ -3936,10 +4180,11 @@ var HELP = {
3936
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."
3937
4181
  };
3938
4182
  function semanticHelp(issue2) {
3939
- const params2 = issue2.params ?? {}, field = typeof params2.field === "string" ? params2.field : void 0, quoted2 = JSON.stringify(field);
3940
- 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.`;
3941
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": "..." } }.`;
3942
- 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.';
3943
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.";
3944
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".';
3945
4190
  return "Resolve the reported structural conflict while preserving every content field. Preview the result after editing.";
@@ -4045,6 +4290,31 @@ function collapseAuthoringShapes(document, findings) {
4045
4290
  const prefix = `${entry2.path}/`;
4046
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);
4047
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
+ }
4048
4318
  }
4049
4319
  function collapseChartShape(document, findings) {
4050
4320
  const chartAt = (path) => {
@@ -4191,11 +4461,17 @@ function undeclaredCatalogFindings(document) {
4191
4461
  return findings;
4192
4462
  }
4193
4463
  var KIND_PLURAL = { layouts: "layouts", themes: "themes", colorSchemes: "color schemes", fontSchemes: "font schemes", narratives: "narratives", audiences: "audiences", purposes: "purposes", tones: "tones" };
4194
- function nearestRecords(kind, reference, candidates) {
4195
- if (!candidates.length) return "";
4196
- 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);
4197
4471
  const quote = (values) => values.map((value) => `'${value}'`).join(", ");
4198
- 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} `;
4199
4475
  }
4200
4476
  function contentReferenceFindings(document, options2, findings) {
4201
4477
  const invalid = embeddedRecordFindings(document, options2, findings);
@@ -4212,12 +4488,15 @@ function contentReferenceFindings(document, options2, findings) {
4212
4488
  }
4213
4489
  if (found && !(found.origin === "document" && invalid.has(recordKey(found.group, site.kind, found.id)))) continue;
4214
4490
  const diagnostic = unresolvedReference(document, site.kind, site.reference, path, options2);
4215
- 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;
4216
4495
  findings.push(
4217
4496
  finding("opf/unresolved-reference", {
4218
4497
  path,
4219
4498
  message: diagnostic.message,
4220
- 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."}`,
4221
4500
  definition: `${schemas.presentation.$id}#/$defs/Catalogs`,
4222
4501
  lookup: ["opf", "catalog", site.kind],
4223
4502
  suggestions
@@ -4242,7 +4521,7 @@ function referenceFindings(document, engine, options2) {
4242
4521
  definition: schemas.presentation.$id + "#/$defs/Assets",
4243
4522
  lookup: ["opf", "schema", "presentation", "/$defs/Assets"],
4244
4523
  suggestions: Object.keys(assetValues).sort(
4245
- (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)
4246
4525
  ).slice(0, 5).map((id2) => ({
4247
4526
  value: `asset:${id2}`,
4248
4527
  label: id2,
@@ -4311,7 +4590,8 @@ function referenceFindings(document, engine, options2) {
4311
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.",
4312
4591
  definition: `${schemas.presentation.$id}#/$defs/IconReference`,
4313
4592
  lookup: ["opf", "schema", "presentation", "/$defs/IconReference"],
4314
- ...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 }] }] } : {}
4315
4595
  })
4316
4596
  );
4317
4597
  }
@@ -4323,7 +4603,7 @@ function narrativeFindings(document, options2) {
4323
4603
  const narrative = resolveNarrative(document, options2);
4324
4604
  if (narrative) {
4325
4605
  const id = String(document.narrative);
4326
- 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` }));
4327
4607
  for (const reference of unknownBeatReferences(document, narrative))
4328
4608
  findings.push(
4329
4609
  finding("opf/unknown-beat", {
@@ -4602,7 +4882,7 @@ var OPFPatchHashError = class extends OPFPatchError {
4602
4882
  }
4603
4883
  };
4604
4884
  var own2 = (value, key3) => Object.prototype.hasOwnProperty.call(value, key3);
4605
- var isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
4885
+ var isObject2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
4606
4886
  var clone = (value) => structuredClone(value);
4607
4887
  function jsonEqual(a, b) {
4608
4888
  if (a === b) return true;
@@ -4653,7 +4933,7 @@ function indexOfId(array, id) {
4653
4933
  let found = -1;
4654
4934
  for (let i = 0; i < array.length; i += 1) {
4655
4935
  const item = array[i];
4656
- if (isObject(item) && own2(item, "id") && item.id === id) {
4936
+ if (isObject2(item) && own2(item, "id") && item.id === id) {
4657
4937
  if (found !== -1) return -2;
4658
4938
  found = i;
4659
4939
  }
@@ -4662,23 +4942,23 @@ function indexOfId(array, id) {
4662
4942
  }
4663
4943
  function uniqueIdAt(array, at2) {
4664
4944
  const item = array[at2];
4665
- 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;
4666
4946
  return indexOfId(array, item.id) === at2 ? item.id : void 0;
4667
4947
  }
4668
4948
  function resolveTokens(document, tokens, pointer4) {
4669
4949
  const out = [];
4670
4950
  let cursor = document, walking = true;
4671
4951
  for (const token of tokens) {
4672
- let resolved = token;
4952
+ let resolved2 = token;
4673
4953
  if (walking && Array.isArray(cursor) && isIdToken(token)) {
4674
4954
  const at2 = indexOfId(cursor, token.slice(1));
4675
4955
  if (at2 === -1) throw new OPFPatchError("patch-id-not-found", `No element of ${formatPointer(out) || "/"} has the id '${token.slice(1)}'.`, { path: pointer4 });
4676
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 });
4677
- resolved = String(at2);
4957
+ resolved2 = String(at2);
4678
4958
  }
4679
- out.push(resolved);
4959
+ out.push(resolved2);
4680
4960
  if (walking) {
4681
- const next = readPointer(cursor, [resolved]);
4961
+ const next = readPointer(cursor, [resolved2]);
4682
4962
  if (next.found) cursor = next.value;
4683
4963
  else walking = false;
4684
4964
  }
@@ -4752,7 +5032,7 @@ function normalizePatch(patch2) {
4752
5032
  }
4753
5033
  function normalizeOperation(operation, index) {
4754
5034
  const fail = (code2, message, path) => new OPFPatchError(code2, index === void 0 ? message : `Operation ${index}: ${message}`, { index, operation, path });
4755
- 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.");
4756
5036
  const op = operation.op;
4757
5037
  if (typeof op !== "string" || !["add", "remove", "replace", "move", "copy", "test"].includes(op)) {
4758
5038
  throw fail("unsupported-patch-operation", `Unknown operation: ${String(op)}`);
@@ -4929,11 +5209,11 @@ function invertPatch(document, patch2) {
4929
5209
  return applyPatchWithInverse(document, patch2).inverse;
4930
5210
  }
4931
5211
  function resolveIdPatch(document, patch2) {
4932
- const resolved = [];
5212
+ const resolved2 = [];
4933
5213
  walkPatch(document, patch2, { after: (step) => {
4934
- resolved.push(step.resolved);
5214
+ resolved2.push(step.resolved);
4935
5215
  } });
4936
- return resolved;
5216
+ return resolved2;
4937
5217
  }
4938
5218
  function toIdPatch(document, patch2) {
4939
5219
  const out = [];
@@ -5037,20 +5317,20 @@ function mergeAllOf(schema, root, seen) {
5037
5317
  const { allOf, ...base } = schema;
5038
5318
  let merged = base;
5039
5319
  for (const member of allOf) {
5040
- const resolved = resolveSchema(member, root, new Set(seen));
5041
- 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;
5042
5322
  merged = {
5043
- ...resolved,
5323
+ ...resolved2,
5044
5324
  ...merged,
5045
- ...resolved.properties || merged.properties ? { properties: { ...resolved.properties, ...merged.properties } } : {}
5325
+ ...resolved2.properties || merged.properties ? { properties: { ...resolved2.properties, ...merged.properties } } : {}
5046
5326
  };
5047
5327
  }
5048
5328
  return merged;
5049
5329
  }
5050
5330
  function resolveSchema(schema, root = presentationSchema, seen = /* @__PURE__ */ new Set()) {
5051
- const resolved = resolveNode(schema, root, seen);
5331
+ const resolved2 = resolveNode(schema, root, seen);
5052
5332
  const kind = schema && typeof schema === "object" ? kindOfNode(schema) : void 0;
5053
- return kind === void 0 ? resolved : { ...resolved, [CATALOG_KIND]: kind };
5333
+ return kind === void 0 ? resolved2 : { ...resolved2, [CATALOG_KIND]: kind };
5054
5334
  }
5055
5335
  function resolveNode(schema, root, seen) {
5056
5336
  if (!schema || typeof schema !== "object") return {};
@@ -5061,18 +5341,18 @@ function resolveNode(schema, root, seen) {
5061
5341
  const [id = "", fragment = ""] = ref.split("#");
5062
5342
  const target = id ? documents.get(id) : root;
5063
5343
  if (!target) throw new Error(`Unresolved OPF schema: ${ref}`);
5064
- let resolved = fragment ? readSchemaPointer(target, fragment) : target;
5065
- if (!resolved) throw new Error(`Unresolved OPF schema: ${ref}`);
5066
- 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);
5067
5347
  const { $ref: _ref, ...rest } = schema;
5068
- return mergeAllOf({ ...resolveSchema(resolved, target, seen), ...rest }, target, seen);
5348
+ return mergeAllOf({ ...resolveSchema(resolved2, target, seen), ...rest }, target, seen);
5069
5349
  }
5070
5350
  function schemaVariants(schema, root = presentationSchema) {
5071
- const resolved = resolveSchema(schema, root);
5072
- if (Array.isArray(resolved.type)) return resolved.type.flatMap((type) => schemaVariants({ ...resolved, type }, root));
5073
- const variants = resolved.oneOf ?? resolved.anyOf;
5074
- if (!variants) return [resolved];
5075
- 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;
5076
5356
  return variants.flatMap(
5077
5357
  (child) => schemaVariants(child, root).map((variant) => {
5078
5358
  const requiredOnly = !variant.type && !variant.properties && !variant.$ref && Array.isArray(variant.required);
@@ -5135,14 +5415,14 @@ function walk(presentation, parts2, rootSchema) {
5135
5415
  let known = true;
5136
5416
  for (let index = 0; index < parts2.length; index++) {
5137
5417
  const key3 = parts2[index];
5138
- const resolved = stepSchema(current, value, key3, root);
5139
- parent = resolved;
5418
+ const resolved2 = stepSchema(current, value, key3, root);
5419
+ parent = resolved2;
5140
5420
  let next;
5141
5421
  const recordSchema = parts2[0] === "catalogs" && index === 3 ? catalogSchemaNames[parts2[2]] : void 0;
5142
5422
  if (recordSchema) {
5143
5423
  next = schemas[recordSchema] ?? {};
5144
5424
  root = next;
5145
- } else next = childSchema(resolved, key3, value);
5425
+ } else next = childSchema(resolved2, key3, value);
5146
5426
  if (next === void 0) {
5147
5427
  known = false;
5148
5428
  next = {};
@@ -5303,10 +5583,10 @@ function objectForm(variants, value) {
5303
5583
  function childrenOf(form, list, isSlide, root) {
5304
5584
  const children = [];
5305
5585
  for (const [key3, raw] of form.properties) {
5306
- const resolved = resolveSchema(raw, root);
5586
+ const resolved2 = resolveSchema(raw, root);
5307
5587
  const variants = schemaVariants(raw, root);
5308
- const description = firstParagraph(resolved.description);
5309
- const catalogKind = catalogKindOf(resolved, variants);
5588
+ const description = firstParagraph(resolved2.description);
5589
+ const catalogKind = catalogKindOf(resolved2, variants);
5310
5590
  children.push({
5311
5591
  key: key3,
5312
5592
  types: uniq(variants.map(variantType)),
@@ -5316,7 +5596,7 @@ function childrenOf(form, list, isSlide, root) {
5316
5596
  priority: priorityOf(list, key3),
5317
5597
  ...description ? { description } : {},
5318
5598
  ...catalogKind ? { catalogKind } : {},
5319
- ...resolved.deprecated === true ? { deprecated: true } : {},
5599
+ ...resolved2.deprecated === true ? { deprecated: true } : {},
5320
5600
  hasEnum: variants.some((variant) => Array.isArray(variant.enum) || variant.const !== void 0)
5321
5601
  });
5322
5602
  }
@@ -5639,8 +5919,9 @@ var YAML_START = /^[A-Za-z_][\w.-]*\s*:(?:\s|$)/;
5639
5919
  var MINIMAL_DECK = '{\n "slides": [\n { "title": "" }\n ]\n}\n';
5640
5920
  var HINT_FORMS_LIMIT = 2;
5641
5921
  var Analyzer = class {
5642
- constructor(text2) {
5922
+ constructor(text2, editor = false) {
5643
5923
  this.text = text2;
5924
+ this.editor = editor;
5644
5925
  const lexed = tokenize(text2);
5645
5926
  this.comments = lexed.tokens.filter((token) => token.kind === "comment");
5646
5927
  this.tokens = lexed.tokens.filter((token) => token.kind !== "comment");
@@ -5648,6 +5929,7 @@ var Analyzer = class {
5648
5929
  this.locate = createLocator(text2);
5649
5930
  }
5650
5931
  text;
5932
+ editor;
5651
5933
  problems = [];
5652
5934
  tokens;
5653
5935
  comments;
@@ -6261,7 +6543,7 @@ var Analyzer = class {
6261
6543
  range: this.range(keyToken.start, colon.end),
6262
6544
  path,
6263
6545
  message: `\`${key3}\` needs a value.`,
6264
- 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,
6265
6547
  fixes
6266
6548
  });
6267
6549
  }
@@ -6473,7 +6755,7 @@ function valueHint(path) {
6473
6755
  }
6474
6756
  function analyzeJsonSyntax(text2, options2 = {}) {
6475
6757
  const limit = Math.max(0, options2.limit ?? 5);
6476
- const analyzer = new Analyzer(String(text2 ?? ""));
6758
+ const analyzer = new Analyzer(String(text2 ?? ""), options2.editor === true);
6477
6759
  try {
6478
6760
  analyzer.run();
6479
6761
  } catch {
@@ -6571,108 +6853,6 @@ function parseSource(source) {
6571
6853
  };
6572
6854
  }
6573
6855
 
6574
- // src/finding-text-util.ts
6575
- var WORDS = { object: "an object", array: "a list", string: "text", number: "a number", integer: "a whole number", boolean: "true or false", null: "null" };
6576
- var KIND_WORDS = { layouts: "layout", themes: "theme", colorSchemes: "color scheme", fontSchemes: "font scheme", narratives: "narrative", audiences: "audience", purposes: "purpose", tones: "tone", languages: "language" };
6577
- 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`" };
6578
- 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" };
6579
- function segmentsOf(path) {
6580
- if (Array.isArray(path)) return path.map(String);
6581
- if (typeof path !== "string" || path === "" || path === "/") return [];
6582
- return path.replace(/^\//, "").split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
6583
- }
6584
- function pointerOf(segments) {
6585
- return segments.map((part) => `/${String(part).replaceAll("~", "~0").replaceAll("/", "~1")}`).join("");
6586
- }
6587
- var code = (value) => `\`${String(value)}\``;
6588
- var isIndex = (segment) => /^\d+$/.test(String(segment));
6589
- function cap(text2) {
6590
- return text2.startsWith("`") ? text2 : text2.charAt(0).toUpperCase() + text2.slice(1);
6591
- }
6592
- function fieldLabel(segments) {
6593
- if (!segments.length) return "the deck";
6594
- const last = segments[segments.length - 1];
6595
- if (isIndex(last)) {
6596
- const owner = [...segments].reverse().find((segment) => !isIndex(segment));
6597
- return owner === "slides" ? `slide ${Number(last) + 1}` : owner ? `${owner} entry ${Number(last) + 1}` : `entry ${Number(last) + 1}`;
6598
- }
6599
- return code(last);
6600
- }
6601
- function placeWords(segments) {
6602
- if (!segments.length) return "at the top level";
6603
- const slide = segments[0] === "slides" && segments.length >= 2 && isIndex(segments[1]) ? Number(segments[1]) + 1 : void 0;
6604
- if (slide !== void 0 && segments.length === 2) return `in slide ${slide}`;
6605
- const last = segments[segments.length - 1];
6606
- const inner = isIndex(last) ? fieldLabel(segments) : code(last);
6607
- return slide !== void 0 ? `in ${inner} of slide ${slide}` : `in ${inner}`;
6608
- }
6609
- function containerName(segments) {
6610
- if (!segments.length) return "the deck";
6611
- if (segments.length === 2 && segments[0] === "slides" && isIndex(segments[1])) return "a slide";
6612
- const last = segments[segments.length - 1];
6613
- return isIndex(last) ? fieldLabel(segments) : code(last);
6614
- }
6615
- function describeValue(value) {
6616
- if (value === void 0) return "missing";
6617
- if (value === null) return "null";
6618
- if (Array.isArray(value)) return value.length ? `a list of ${value.length}` : "an empty list";
6619
- if (typeof value === "object") return "an object";
6620
- if (typeof value === "string") return value === "" ? "empty" : code(value.length > 30 ? `${value.slice(0, 29)}\u2026` : value);
6621
- return `${typeof value === "number" ? "a number" : "true or false"} (${code(String(value))})`;
6622
- }
6623
- function describeKind(value) {
6624
- if (typeof value === "string") return value === "" ? "empty text" : `text (${describeValue(value)})`;
6625
- return describeValue(value);
6626
- }
6627
- function typeWords(type) {
6628
- const list = (Array.isArray(type) ? type : [type]).filter(Boolean).map((entry2) => WORDS[String(entry2)] ?? String(entry2));
6629
- return [...new Set(list)].join(" or ") || "a different kind of value";
6630
- }
6631
- function distance2(a, b) {
6632
- const x = a.toLowerCase();
6633
- const y = b.toLowerCase();
6634
- if (x === y) return 0;
6635
- const row = Array.from({ length: y.length + 1 }, (_, index) => index);
6636
- for (let i = 1; i <= x.length; i++) {
6637
- let previous = row[0];
6638
- row[0] = i;
6639
- for (let j = 1; j <= y.length; j++) {
6640
- const keep3 = row[j];
6641
- row[j] = Math.min(row[j] + 1, row[j - 1] + 1, previous + (x[i - 1] === y[j - 1] ? 0 : 1));
6642
- previous = keep3;
6643
- }
6644
- }
6645
- return row[y.length];
6646
- }
6647
- function nearest(value, candidates, limit = 5) {
6648
- const text2 = String(value ?? "");
6649
- const alias = ALIASES[text2.toLowerCase()];
6650
- const ranked = candidates.map((candidate) => ({ candidate, score: String(candidate).toLowerCase() === alias ? 0 : distance2(text2, String(candidate)) }));
6651
- ranked.sort((a, b) => a.score - b.score);
6652
- const close = ranked.filter((entry2) => entry2.score <= Math.max(2, Math.floor(text2.length / 4))).map((entry2) => entry2.candidate);
6653
- return { close: close.slice(0, limit), all: ranked.map((entry2) => entry2.candidate) };
6654
- }
6655
- function valueList(values, max = 5) {
6656
- const list = values.map((value) => typeof value === "string" ? value : JSON.stringify(value));
6657
- if (list.length <= max) return list.length > 1 ? `${list.slice(0, -1).join(", ")} or ${list.at(-1)}` : list.join("");
6658
- return `one of ${list.length} values (${list.slice(0, 3).join(", ")}, \u2026)`;
6659
- }
6660
- var firstSentence = (text2) => /^.*?[.!?](?=\s|$)/.exec(String(text2 ?? "").replace(/\s+/g, " ").trim())?.[0] ?? "";
6661
- function asNext(text2) {
6662
- const trimmed = text2.trim();
6663
- return /^[A-Z][a-z]/.test(trimmed) ? trimmed.charAt(0).toLowerCase() + trimmed.slice(1) : trimmed;
6664
- }
6665
- var isRecord3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
6666
- function readAt(document, segments) {
6667
- let value = document;
6668
- for (const segment of segments) {
6669
- if (Array.isArray(value)) value = value[Number(segment)];
6670
- else if (isRecord3(value)) value = value[segment];
6671
- else return void 0;
6672
- }
6673
- return value;
6674
- }
6675
-
6676
6856
  // src/finding-text-helpers.ts
6677
6857
  var ENDS = /[.?!]$/;
6678
6858
  function sentence(text2) {
@@ -6732,11 +6912,11 @@ function dotted(segments) {
6732
6912
  }
6733
6913
  function keysAt(helpers, path) {
6734
6914
  const value = helpers.valueAt(path);
6735
- return isRecord3(value) ? Object.keys(value) : [];
6915
+ return isRecord2(value) ? Object.keys(value) : [];
6736
6916
  }
6737
6917
  function idsAt(helpers, path) {
6738
6918
  const value = helpers.valueAt(path);
6739
- 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] : []) : [];
6740
6920
  }
6741
6921
  function codeList(names2, max = 5, joiner = "and") {
6742
6922
  const shown = names2.slice(0, max).map(code);
@@ -6777,7 +6957,7 @@ function freshName(base, taken = []) {
6777
6957
  }
6778
6958
  var BLOCK_KINDS = ["chart", "image", "video", "table", "code", "metric", "quote", "timeline", "diagram", "items", "bullets", "text"];
6779
6959
  function blockKind(node) {
6780
- if (!isRecord3(node)) return void 0;
6960
+ if (!isRecord2(node)) return void 0;
6781
6961
  if (typeof node.type === "string" && node.type !== "group") return node.type;
6782
6962
  const found = BLOCK_KINDS.find((key3) => node[key3] !== void 0);
6783
6963
  if (found === "items" || found === "bullets") return "list";
@@ -6998,13 +7178,13 @@ function regionNamesOf(slideLayout, helpers) {
6998
7178
  const colon = slideLayout.indexOf(":");
6999
7179
  const group = colon > 0 ? slideLayout.slice(0, colon) : void 0;
7000
7180
  const id = colon > 0 ? slideLayout.slice(colon + 1) : slideLayout;
7001
- 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);
7002
7182
  if (!record) return void 0;
7003
7183
  const names2 = [];
7004
7184
  const walk2 = (list) => {
7005
7185
  if (!Array.isArray(list)) return;
7006
7186
  for (const entry2 of list) {
7007
- if (!isRecord3(entry2)) continue;
7187
+ if (!isRecord2(entry2)) continue;
7008
7188
  if (typeof entry2.name === "string" && !["title", "subtitle", "tag"].includes(entry2.name)) names2.push(entry2.name);
7009
7189
  walk2(entry2.regions);
7010
7190
  }
@@ -7230,7 +7410,7 @@ var codeHighlightRangeReversed = (finding2) => {
7230
7410
  };
7231
7411
  var variableGroupOmitted = (finding2) => {
7232
7412
  const ids = [...finding2.message.matchAll(/'([a-z][a-z0-9-]*)'/g)].map((found) => found[1]);
7233
- 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;
7234
7414
  const names2 = [...new Set(ids.length ? ids : typeof idParam === "string" ? [idParam] : [])];
7235
7415
  if (!names2.length) return void 0;
7236
7416
  const list = names2.length === 1 ? code(names2[0]) : `${names2.slice(0, -1).map((id) => code(id)).join(", ")} and ${code(names2.at(-1))}`;
@@ -7240,7 +7420,7 @@ var variableGroupOmitted = (finding2) => {
7240
7420
  };
7241
7421
  };
7242
7422
  var variableBuiltinMissing = (finding2, _context, helpers) => {
7243
- 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;
7244
7424
  const id = (typeof idParam === "string" ? idParam : void 0) ?? match(finding2.message, /^Built-in '(.+?)' has no value/)?.[1] ?? match(finding2.message, /'\{\{(.+?)\}\}'/)?.[1];
7245
7425
  if (!id) return void 0;
7246
7426
  const root = id.split(".")[0];
@@ -7262,7 +7442,7 @@ var durationOutsideNarrative2 = (finding2) => {
7262
7442
  };
7263
7443
  var narrativeDurationRange = (_finding, _context, helpers) => {
7264
7444
  const range = helpers.valueAt(helpers.segments);
7265
- if (isRecord3(range) && typeof range.min === "number" && typeof range.max === "number") {
7445
+ if (isRecord2(range) && typeof range.min === "number" && typeof range.max === "number") {
7266
7446
  return {
7267
7447
  message: `The duration range has min ${range.min} greater than max ${range.max}.`,
7268
7448
  next: `swap them: ${code(`min: ${range.max}`)} and ${code(`max: ${range.min}`)}.`
@@ -7369,7 +7549,7 @@ var AUDIT_TEXT = {
7369
7549
  };
7370
7550
 
7371
7551
  // src/finding-text-format.ts
7372
- var params = (finding2) => isRecord3(finding2.validation?.params) ? finding2.validation.params : {};
7552
+ var params = (finding2) => isRecord2(finding2.validation?.params) ? finding2.validation.params : {};
7373
7553
  var text = (value) => typeof value === "string" ? value : void 0;
7374
7554
  var jsonSyntax = (finding2) => ({
7375
7555
  message: keep(finding2.message),
@@ -7546,7 +7726,7 @@ var dataColumnDuplicate = (finding2, _context, helpers) => {
7546
7726
  const name = unquote(match(finding2.message, /^column name ("(?:[^"\\]|\\.)*") is used by an earlier column/)?.[1]);
7547
7727
  if (!name) return void 0;
7548
7728
  const columns = helpers.valueAt(helpers.segments.slice(0, -1));
7549
- 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)) : [];
7550
7730
  return {
7551
7731
  message: `Two columns are named ${code(name)}. Series and mappings address columns by name.`,
7552
7732
  next: `rename the second one (for example ${code(freshName(name, taken))}).`
@@ -7776,13 +7956,13 @@ var assetCycle = (finding2) => {
7776
7956
  next: "give one link a real source (an https:// address or embedded data) instead of an `asset:` reference."
7777
7957
  };
7778
7958
  };
7779
- var KIND_SINGULAR = (kind) => KIND_WORDS[kind] ?? kind.replace(/s$/, "");
7959
+ var KIND_SINGULAR2 = (kind) => KIND_WORDS[kind] ?? kind.replace(/s$/, "");
7780
7960
  var catalogRecord = (finding2, context) => {
7781
7961
  const [root, group, kind, id] = finding2.path.split("/").slice(1).map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
7782
7962
  if (root !== "catalogs" || !kind || !id) return void 0;
7783
7963
  const inner = describeFinding({ ...finding2, ruleId: "opf/schema" }, context);
7784
7964
  const registered = finding2.scope === "context";
7785
- 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)}`;
7786
7966
  return {
7787
7967
  message: `${record} is invalid: ${inner.message.charAt(0).toLowerCase()}${inner.message.slice(1)}`,
7788
7968
  next: inner.next ?? `fix the record; references to it are reported too.`
@@ -7840,12 +8020,12 @@ var unresolvedReference2 = (finding2, _context, helpers) => {
7840
8020
  return typeof value === "string" ? value : void 0;
7841
8021
  })();
7842
8022
  if (!reference) return void 0;
7843
- const noun = cap(KIND_SINGULAR(kind || (found?.[1] ?? "catalog record").toLowerCase()));
8023
+ const noun = cap(KIND_SINGULAR2(kind || (found?.[1] ?? "catalog record").toLowerCase()));
7844
8024
  const colon = reference.indexOf(":");
7845
8025
  const group = colon > 0 ? reference.slice(0, colon) : void 0;
7846
8026
  const bare = colon > 0 ? reference.slice(colon + 1) : reference;
7847
8027
  const embeddedIn = group ? [group] : ["custom", "default"];
7848
- 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])));
7849
8029
  const suggestions = (finding2.suggestions ?? []).slice(0, 5).map((entry2) => String(entry2.value));
7850
8030
  if (embedded) {
7851
8031
  return {
@@ -7856,9 +8036,10 @@ var unresolvedReference2 = (finding2, _context, helpers) => {
7856
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)}.`;
7857
8037
  const { close } = nearest(reference, suggestions);
7858
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` : "";
7859
8040
  return {
7860
8041
  message,
7861
- 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}.`
7862
8043
  };
7863
8044
  };
7864
8045
  var catalogRecordNotInSource = (finding2) => {
@@ -8029,12 +8210,12 @@ var LINE_KEYWORDS = ["Note:", "Notes:"];
8029
8210
  var keep2 = (finding2, next) => next ? { message: finding2.message, next } : { message: finding2.message };
8030
8211
  var wholeHelp = (finding2) => keep2(finding2, finding2.help ? asNext(finding2.help) : void 0);
8031
8212
  var line = (finding2) => finding2.location?.line ?? 1;
8032
- var quoted = (text2, pattern) => pattern.exec(text2)?.[1];
8213
+ var quoted2 = (text2, pattern) => pattern.exec(text2)?.[1];
8033
8214
  var optionKeys = (kind) => kind === "block" ? BLOCK_OPTION_KEYS : SLIDE_OPTION_KEYS;
8034
8215
  var options = {
8035
8216
  "markdown/options-unknown-key": (finding2) => {
8036
- const kind = quoted(finding2.message, /^Unknown (slide|block) option/) ?? "slide";
8037
- const key3 = quoted(finding2.message, /option "(.*)"\.$/) ?? "";
8217
+ const kind = quoted2(finding2.message, /^Unknown (slide|block) option/) ?? "slide";
8218
+ const key3 = quoted2(finding2.message, /option "(.*)"\.$/) ?? "";
8038
8219
  const guess = finding2.suggestions?.[0]?.value;
8039
8220
  const keys = optionKeys(kind).join(", ");
8040
8221
  return {
@@ -8044,14 +8225,14 @@ var options = {
8044
8225
  },
8045
8226
  "markdown/options-value": (finding2) => {
8046
8227
  if (/^hidden takes/.test(finding2.message)) return keep2(finding2, "write `hidden=true`, `hidden=false` or just `hidden`.");
8047
- const key3 = quoted(finding2.message, /^Option (\w+) needs a value/);
8228
+ const key3 = quoted2(finding2.message, /^Option (\w+) needs a value/);
8048
8229
  if (key3) return keep2(finding2, `write ${code(`${key3}=value`)}, for example ${code(key3 === "layout" ? "layout=title" : key3 === "id" ? "id=cover" : `${key3}=name`)}.`);
8049
8230
  if (/^as takes/.test(finding2.message)) return keep2(finding2, "write `as=bullets` before a list or `as=video` before an image line.");
8050
8231
  return keep2(finding2, "put `as=bullets` before a list and `as=video` before an image line, or remove `as`.");
8051
8232
  },
8052
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" -->')}.`),
8053
8234
  "markdown/options-duplicate": (finding2) => {
8054
- const key3 = quoted(finding2.message, /^Option (\w+) is given twice/);
8235
+ const key3 = quoted2(finding2.message, /^Option (\w+) is given twice/);
8055
8236
  if (key3) return keep2(finding2, `keep one ${code(`${key3}=`)} in the comment.`);
8056
8237
  return keep2(finding2, "merge them into one.");
8057
8238
  },
@@ -8084,7 +8265,7 @@ var markdown = {
8084
8265
  "markdown/timeline-description": (finding2) => keep2(finding2, "put the event first, then its description indented below it."),
8085
8266
  "markdown/timeline-events": (finding2) => keep2(finding2, "write one event per line, for example `2024 Q1 \u2014 Pilot`."),
8086
8267
  "markdown/slide-property-conflict": (finding2) => {
8087
- 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";
8088
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." };
8089
8270
  },
8090
8271
  "markdown/duplicate-title": (finding2) => keep2(finding2, "use `---` to start a new slide, or `##` for the subtitle."),
@@ -8266,6 +8447,14 @@ function describeSchema(finding2, context, helpers) {
8266
8447
  }
8267
8448
  case "oneOf":
8268
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
+ }
8269
8458
  const forms = (alternatives ?? []).map((entry2) => String(entry2).split(":")[0]?.trim() ?? "");
8270
8459
  const words = forms.length ? [...new Set(forms.map((form) => WORDS[form] ?? form))].slice(0, 3).join(" or ") : "a different kind of value";
8271
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." };
@@ -8395,7 +8584,7 @@ function schemaFixes(finding2, document) {
8395
8584
  switch (validation.keyword) {
8396
8585
  case "required": {
8397
8586
  const property = String(params2.missingProperty ?? "");
8398
- 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 [];
8399
8588
  const value = starterValue(document, segments, property);
8400
8589
  if (value === void 0) return [];
8401
8590
  return [patch(`add:${property}`, `Add \`${property}\``, [{ op: "add", path: pointerOf([...segments, property]), value }])];
@@ -8411,7 +8600,7 @@ function schemaFixes(finding2, document) {
8411
8600
  const name = String(params2.additionalProperty ?? segments.at(-1) ?? "");
8412
8601
  const parent = segments.slice(0, -1);
8413
8602
  const owner = readAt(document, parent);
8414
- if (!name || !isRecord3(owner) || !Object.hasOwn(owner, name)) return [];
8603
+ if (!name || !isRecord2(owner) || !Object.hasOwn(owner, name)) return [];
8415
8604
  const fixes = [];
8416
8605
  for (const suggestion of finding2.suggestions ?? []) {
8417
8606
  const target = String(suggestion.value);
@@ -8420,14 +8609,14 @@ function schemaFixes(finding2, document) {
8420
8609
  if (allowsKey(document, parent, "extensions") && name !== "extensions") {
8421
8610
  const existing = owner.extensions;
8422
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]) }]));
8423
- 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]) }]));
8424
8613
  }
8425
8614
  return fixes;
8426
8615
  }
8427
8616
  case "type": {
8428
8617
  const current = readAt(document, segments);
8429
8618
  if (current === void 0) return [];
8430
- 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")];
8431
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)];
8432
8621
  return [];
8433
8622
  }
@@ -8455,15 +8644,15 @@ function resolveDrawnFontFamilies(families, measurement, keepsName) {
8455
8644
  const named = families[role];
8456
8645
  if (typeof named !== "string" || !named) continue;
8457
8646
  try {
8458
- 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 });
8459
8648
  let keep3;
8460
- if (keepsName) keep3 = keepsName(named, resolved.fontFamily);
8649
+ if (keepsName) keep3 = keepsName(named, resolved2.fontFamily);
8461
8650
  else {
8462
- const regular = role === "heading" ? resolve2.call(measurement, { fontFamily: named, fontWeight: 400 }) : resolved;
8463
- const encoded = resolved.symbolEncoding != null;
8464
- 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();
8465
8654
  }
8466
- if (!keep3) drawn[role] = resolved.fontFamily;
8655
+ if (!keep3) drawn[role] = resolved2.fontFamily;
8467
8656
  } catch {
8468
8657
  }
8469
8658
  }
@@ -8472,24 +8661,24 @@ function resolveDrawnFontFamilies(families, measurement, keepsName) {
8472
8661
 
8473
8662
  // src/script-measurement.ts
8474
8663
  function scriptProfile(presentation, slideIndex, options2, language) {
8475
- let resolved;
8664
+ let resolved2;
8476
8665
  try {
8477
- 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 } });
8478
8667
  } catch {
8479
- resolved = void 0;
8668
+ resolved2 = void 0;
8480
8669
  }
8481
8670
  const slots = (role) => {
8482
8671
  const latin = options2.fontFamilies[role];
8483
- 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;
8484
8673
  return { latin, eastAsian: slot("eastAsian"), complexScript: slot("complexScript") };
8485
8674
  };
8486
8675
  return {
8487
8676
  heading: slots("heading"),
8488
8677
  body: slots("body"),
8489
- ...resolved?.supplement ? { supplement: resolved.supplement } : {},
8490
- script: resolved?.script ?? "Zzzz",
8491
- ...resolved ? { scriptRole: resolved.scriptRole, bcp47: resolved.bcp47, lang: resolved.lang, languageSource: resolved.languageSource, direction: resolved.direction } : {},
8492
- 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,
8493
8682
  serif: options2.serif
8494
8683
  };
8495
8684
  }
@@ -8526,8 +8715,8 @@ function slideScriptMeasurement(presentation, slideIndex, measurement, options2)
8526
8715
  function resolveSlideScriptMeasurement(presentation, slideIndex, measurement, options2 = {}) {
8527
8716
  if (typeof measurement.forScripts !== "function") return measurement;
8528
8717
  const { fontScheme } = resolveDesignRecords(presentation, slideIndex, options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {});
8529
- const resolved = resolveFontFamilies(fontScheme);
8530
- 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 };
8531
8720
  return slideScriptMeasurement(presentation, slideIndex, measurement, { ...options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {}, fontFamilies, serif: fontScheme.type === "serif" });
8532
8721
  }
8533
8722
 
@@ -8708,33 +8897,33 @@ function buildSlides(document, options2, memo) {
8708
8897
  const measurement = lazy(() => {
8709
8898
  const host = measurementFor(options2, index);
8710
8899
  if (!host) return void 0;
8711
- const { resolved: resolved2 } = baseContext();
8712
- 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" });
8713
8902
  });
8714
- const resolved = lazy(() => {
8903
+ const resolved2 = lazy(() => {
8715
8904
  const textMeasurement = measurement();
8716
8905
  const slideContext = baseContext();
8717
8906
  return textMeasurement ? { ...slideContext, options: { ...slideContext.options, textMeasurement } } : slideContext;
8718
8907
  });
8719
- const design = lazy(() => resolveDesign(document, index, resolved()));
8720
- const layout = lazy(() => resolved().options.layout);
8908
+ const design = lazy(() => resolveDesign(document, index, resolved2()));
8909
+ const layout = lazy(() => resolved2().options.layout);
8721
8910
  const compute = () => {
8722
8911
  const result = { layoutDiagnostics: [] };
8723
8912
  let fontFamilies;
8724
8913
  const compose = (input, withLayout) => {
8725
- const options3 = resolved().options;
8914
+ const options3 = resolved2().options;
8726
8915
  fontFamilies ??= options3.fontFamilies && resolveDrawnFontFamilies(options3.fontFamilies, options3.textMeasurement);
8727
8916
  return composeSlide(input, { ...options3, ...fontFamilies ? { fontFamilies } : {}, layout: withLayout });
8728
8917
  };
8729
8918
  try {
8730
- result.composition = compose(resolved().slide, layout());
8919
+ result.composition = compose(resolved2().slide, layout());
8731
8920
  result.layoutDiagnostics.push(...result.composition.diagnostics.map((diagnostic) => ({ diagnostic, strict: false })));
8732
8921
  } catch (error) {
8733
8922
  if (error instanceof OPFCompositionError) {
8734
8923
  result.layoutDiagnostics.push(...error.diagnostics.map((diagnostic) => ({ diagnostic, strict: true })));
8735
8924
  try {
8736
8925
  const relaxedLayout = layout();
8737
- result.composition = compose(relax(resolved().slide), relaxedLayout ? relax(relaxedLayout) : void 0);
8926
+ result.composition = compose(relax(resolved2().slide), relaxedLayout ? relax(relaxedLayout) : void 0);
8738
8927
  } catch (second) {
8739
8928
  result.layoutError = second instanceof Error ? second.message : String(second);
8740
8929
  }
@@ -8978,7 +9167,7 @@ var ValidationCompositionCache = class {
8978
9167
  // src/validator.ts
8979
9168
  var SEVERITIES = ["error", "warning", "info"];
8980
9169
  var OPTION_KEYS = ["only", "ignore", "severity", "ignorePaths", "catalogs", "contracts", "thresholds", "fonts", "chartPalette", "template", "values"];
8981
- var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
9170
+ var isObject3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8982
9171
  var OPFValidationError = class extends Error {
8983
9172
  /** The full report that failed. */
8984
9173
  report;
@@ -9011,14 +9200,14 @@ function names(list, what) {
9011
9200
  return result;
9012
9201
  }
9013
9202
  function resolveOptions(options2) {
9014
- 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.");
9015
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(", ")}.`);
9016
9205
  checkDocumentOptions(options2);
9017
9206
  const only = names(options2.only, "only");
9018
9207
  const ignore = names(options2.ignore, "ignore");
9019
9208
  const severity = /* @__PURE__ */ new Map();
9020
9209
  if (options2.severity !== void 0) {
9021
- 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".');
9022
9211
  for (const [name, value] of Object.entries(options2.severity)) {
9023
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.`);
9024
9213
  const found = ruleFor(name, "severity");
@@ -9029,7 +9218,7 @@ function resolveOptions(options2) {
9029
9218
  if (options2.ignorePaths !== void 0) {
9030
9219
  if (!Array.isArray(options2.ignorePaths)) throw new TypeError("Validate ignorePaths must be an array of {rule, path}.");
9031
9220
  for (const entry2 of options2.ignorePaths) {
9032
- 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("/"))
9033
9222
  throw new TypeError('Each validate ignorePaths entry needs a rule id, category name or "*", and a JSON Pointer path.');
9034
9223
  const found = entry2.rule === "*" ? "*" : ruleFor(entry2.rule, "ignorePaths");
9035
9224
  ignorePaths.push({
@@ -9040,7 +9229,7 @@ function resolveOptions(options2) {
9040
9229
  }
9041
9230
  const thresholds = { ...DEFAULT_VALIDATION_THRESHOLDS };
9042
9231
  if (options2.thresholds !== void 0) {
9043
- 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.");
9044
9233
  for (const [key3, value] of Object.entries(options2.thresholds)) {
9045
9234
  if (!(key3 in DEFAULT_VALIDATION_THRESHOLDS)) throw new TypeError(`Unknown validate threshold ${JSON.stringify(key3)}. Thresholds: ${Object.keys(DEFAULT_VALIDATION_THRESHOLDS).join(", ")}.`);
9046
9235
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new TypeError(`Validate threshold ${key3} must be a positive number.`);
@@ -9048,14 +9237,14 @@ function resolveOptions(options2) {
9048
9237
  }
9049
9238
  }
9050
9239
  if (options2.fonts !== void 0) {
9051
- 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.");
9052
9241
  const measurement = options2.fonts.textMeasurement;
9053
- 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.");
9054
9243
  }
9055
9244
  if (options2.chartPalette !== void 0 && (!Array.isArray(options2.chartPalette) || !options2.chartPalette.every((color) => typeof color === "string" && /^#[0-9a-fA-F]{6}$/.test(color))))
9056
9245
  throw new TypeError("Validate chartPalette must be an array of #RRGGBB colours.");
9057
9246
  if (options2.template !== void 0 && typeof options2.template !== "boolean") throw new TypeError("Validate template must be true or false.");
9058
- 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.");
9059
9248
  const level = (info) => severity.get(info.id) ?? severity.get(info.category);
9060
9249
  const off = (info) => level(info) === "off" || !!ignore?.rules.has(info.id) || !!ignore?.categories.has(info.category);
9061
9250
  return {
@@ -9112,7 +9301,7 @@ function syntaxReport(parsed, run) {
9112
9301
  function validateDocument(document, run, parsed, cache) {
9113
9302
  const engine = validateAgainstSchema(document, "presentation", { template: run.options.template, values: run.options.values, ...run.options.catalogs ? { catalogs: run.options.catalogs } : {} });
9114
9303
  const schemaValid = engine.errors.length === 0;
9115
- const slides = isObject2(document) && Array.isArray(document.slides) ? document.slides : [];
9304
+ const slides = isObject3(document) && Array.isArray(document.slides) ? document.slides : [];
9116
9305
  const auditWanted = auditInfos.some((info) => run.enabled(info));
9117
9306
  const explainFormat = !schemaValid && auditWanted;
9118
9307
  const enabledRule = (info) => info ? run.enabled(info) || explainFormat && info.category === "format" && !run.off(info) : true;
@@ -9177,7 +9366,7 @@ function validateDocument(document, run, parsed, cache) {
9177
9366
  if (info && run.ignored(info, splitPointer(next.path))) continue;
9178
9367
  const index = slideOf(next.path);
9179
9368
  if (next.slide === void 0 && index !== void 0 && next.scope !== "context") {
9180
- const id = isObject2(slides[index]) ? slides[index].id : void 0;
9369
+ const id = isObject3(slides[index]) ? slides[index].id : void 0;
9181
9370
  next.slide = index;
9182
9371
  if (typeof id === "string") next.slideId = id;
9183
9372
  }
@@ -9274,4 +9463,4 @@ function assertValidCatalogRecord(kind, value) {
9274
9463
  if (!report2.valid) throw new OPFValidationError(report2);
9275
9464
  }
9276
9465
 
9277
- 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 };