@openpresentation/opf 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +9 -0
  2. package/dist/browser.js +20 -20
  3. package/dist/{catalog-refs-kAefsZWT.d.ts → catalog-refs-B_0_vZg0.d.ts} +5 -0
  4. package/dist/{catalog-schemas-LdqOPebq.d.ts → catalog-schemas-CQTM-G8p.d.ts} +10 -4
  5. package/dist/{chunk-CLRYHWQN.js → chunk-ABWEUXLV.js} +72 -6
  6. package/dist/{chunk-XFHXQCXL.js → chunk-BI4ERFAA.js} +52 -1
  7. package/dist/{chunk-56J345KE.js → chunk-DAS75LGR.js} +3 -3
  8. package/dist/{chunk-F7DN33UL.js → chunk-E7WQHMCL.js} +6 -6
  9. package/dist/chunk-IJXKVM4W.js +221 -0
  10. package/dist/{chunk-AQEAZDL2.js → chunk-INIMUBSE.js} +2 -1
  11. package/dist/{chunk-NEJ32O7X.js → chunk-KVHNDHVS.js} +1 -1
  12. package/dist/{chunk-NVAJASOD.js → chunk-OPVJLL7H.js} +6867 -1862
  13. package/dist/{chunk-GM7WFPGG.js → chunk-PRXZD2II.js} +6 -1
  14. package/dist/{chunk-BBVW5ZC2.js → chunk-QD6DPS7X.js} +2 -2
  15. package/dist/{chunk-LEF4X4KI.js → chunk-QF5RSRXU.js} +1797 -170
  16. package/dist/{chunk-HKUV7NEN.js → chunk-R6C6BQOG.js} +1 -1
  17. package/dist/{chunk-IT7FQKED.js → chunk-S5QRGMUQ.js} +6 -6
  18. package/dist/{chunk-OXLA4HXQ.js → chunk-UK3J6FSU.js} +346 -53
  19. package/dist/{chunk-XQO2CT6Q.js → chunk-VKEYV3ZK.js} +1 -1
  20. package/dist/{chunk-7U3TJBXE.js → chunk-VMBLNCX2.js} +31 -13
  21. package/dist/{chunk-YFJIIIOL.js → chunk-VSBZC2PR.js} +2 -2
  22. package/dist/{chunk-UJSAR6GF.js → chunk-W4DYDRV2.js} +21 -0
  23. package/dist/{chunk-J63CIRIV.js → chunk-XANW7MB7.js} +4 -4
  24. package/dist/{chunk-PB7ME64J.js → chunk-XIOC6N5P.js} +1 -1
  25. package/dist/{chunk-2E6CDYL2.js → chunk-Y557TYML.js} +5 -5
  26. package/dist/{chunk-SW676APJ.js → chunk-YS333HLA.js} +2 -2
  27. package/dist/chunk-YYT6N7AI.js +642 -0
  28. package/dist/chunk-ZXOIGUHX.js +1 -0
  29. package/dist/{composition-DRqNGHJV.d.ts → composition-zMiIgzip.d.ts} +2353 -272
  30. package/dist/composition.d.ts +3 -2
  31. package/dist/composition.js +2 -2
  32. package/dist/conversion-POHRAMSN.js +24 -0
  33. package/dist/{conversion-Cadul8Mu.d.ts → conversion-mNth9XKm.d.ts} +20 -9
  34. package/dist/convert.d.ts +3 -2
  35. package/dist/convert.js +9 -9
  36. package/dist/data.d.ts +1 -1
  37. package/dist/data.js +3 -3
  38. package/dist/{deck-report-BA3IPJAV.d.ts → deck-report-BSlRiR0_.d.ts} +3 -3
  39. package/dist/deck.d.ts +6 -5
  40. package/dist/deck.js +12 -12
  41. package/dist/diagram-engine-eager.js +1 -1
  42. package/dist/diagram-engine-lazy.js +1 -1
  43. package/dist/diff.js +5 -5
  44. package/dist/docs.js +48 -24
  45. package/dist/examples.js +7507 -142
  46. package/dist/font-policy.js +1 -1
  47. package/dist/format.js +3 -3
  48. package/dist/ids.js +5 -5
  49. package/dist/index.d.ts +13 -12
  50. package/dist/index.js +24 -24
  51. package/dist/markdown.d.ts +2 -1
  52. package/dist/markdown.js +9 -9
  53. package/dist/node-engine.d.ts +7 -6
  54. package/dist/node-engine.js +24 -24
  55. package/dist/{pagination-DwEkdJ6s.d.ts → pagination-CYzNMazO.d.ts} +20 -3
  56. package/dist/pagination.d.ts +4 -3
  57. package/dist/pagination.js +5 -5
  58. package/dist/patch.js +4 -4
  59. package/dist/precompiled.js +3 -3
  60. package/dist/{presentation-DnD7mfmf.d.ts → presentation-CXhfpB_z.d.ts} +876 -39
  61. package/dist/repo-readme.js +2 -2
  62. package/dist/schema-engine-ajv.js +2 -2
  63. package/dist/schema-engine-precompiled.js +3 -3
  64. package/dist/schema.d.ts +2 -2
  65. package/dist/schema.js +4 -4
  66. package/dist/schemas.d.ts +40 -4
  67. package/dist/schemas.js +2 -2
  68. package/dist/shape-catalog.d.ts +98 -0
  69. package/dist/shape-catalog.js +302 -0
  70. package/dist/shape-engine-eager.js +9 -0
  71. package/dist/shape-engine-lazy.js +12 -0
  72. package/dist/shape-engine-module-BK7JNEUV.js +3 -0
  73. package/dist/shape-geometry.d.ts +126 -0
  74. package/dist/shape-geometry.js +2 -0
  75. package/dist/source.js +11 -11
  76. package/dist/spec/README.md +1 -1
  77. package/dist/spec/reference/preset-geometry.json +10699 -0
  78. package/dist/spec/reference/preset-geometry.schema.json +126 -0
  79. package/dist/spec/schemas/catalog-index.schema.json +1 -0
  80. package/dist/spec/schemas/chart-type.schema.json +4 -4
  81. package/dist/spec/schemas/icon-set.schema.json +75 -0
  82. package/dist/spec/schemas/layout.schema.json +14 -1
  83. package/dist/spec/schemas/opf.schema.json +1144 -196
  84. package/dist/spec-files.d.ts +1 -1
  85. package/dist/spec-files.js +2 -2
  86. package/dist/symbol-font-encodings.js +1 -1
  87. package/dist/types.d.ts +10 -6
  88. package/dist/{validation-types-vVah_PEv.d.ts → validation-types-COwTel3H.d.ts} +2 -2
  89. package/dist/validator.d.ts +5 -4
  90. package/dist/validator.js +4 -4
  91. package/dist/yaml.d.ts +2 -1
  92. package/dist/yaml.js +8 -8
  93. package/package.json +24 -8
  94. package/dist/chunk-DGS47ONG.js +0 -1
  95. package/dist/conversion-J3YPDS7C.js +0 -24
package/README.md CHANGED
@@ -117,6 +117,15 @@ Added in 0.12.0 (not in 0.11.4 or earlier): `@openpresentation/opf/patch` is the
117
117
 
118
118
  `@openpresentation/opf/ids` (all of it also on the package root, the pointer and hash parts also on `/patch`) makes edits addressable and checkable. `assignIds(document, { generate? })` fills the missing `id` of slides and content payloads deterministically (`{ document, patch, assigned }`; existing ids are never changed). In an array, the pointer token `@intro` names the element whose `id` is `intro`, so `/slides/@intro/blocks/@kpi/text` survives reordering: `applyPatch` and `readPointer` resolve it, `resolveIdPointer` and `toIdPointer` convert a pointer, `resolveIdPatch` and `toIdPatch` a whole patch. `documentHash(document)` is `sha256:` and a SHA-256 of the key-sorted JSON (pure JavaScript, the same in Node, browsers and edge runtimes); `applyPatch(document, patch, { expectHash })` and `edit(deck, patch, { expectHash })` apply only to the document that hash was taken from, else throw `OPFPatchHashError` and change nothing. `touches(patch, document?)` returns the pointers (index and id form), ids, slide ids and kinds a patch reads and writes, for conflict detection and permission checks. See [the guide](../../docs/patch-diff-merge-format.md#ids-id-addressed-paths-hashes-and-patch-scope).
119
119
 
120
+ ### Shapes, icons, SmartArt layouts and diagrams (0.33.0)
121
+
122
+ A slide can draw more than text, pictures and charts, with no extra package:
123
+
124
+ - **Shapes.** A `shape` block takes one of PowerPoint's 187 presets (`{ "shape": "chevron", "text": "Plan" }`) or a custom `path`, with fills, strokes and six effects; a slide's `shapes` list adds overlays and connectors between blocks. The preset table is `PRESET_SHAPES` of `@openpresentation/opf/shape-geometry`. See [shapes](https://github.com/OpenPresentation/opf/blob/main/docs/shapes.md) and [shape effects](https://github.com/OpenPresentation/opf/blob/main/docs/shape-effects.md).
125
+ - **Icons.** `icon` on a list entry, a metric or a group (`"lucide:truck"`, `"tabler:rocket"`) draws a chip, and a list of short icon entries draws icon cards. The sets live in `@openpresentation/gallery/icon-sets`: register `galleryIconSets` beside `gallery` and await `ensureIcons(deck, { catalogs })` before synchronous drawing (`@openpresentation/opf/composition`). See [icons](https://github.com/OpenPresentation/opf/blob/main/docs/icons.md).
126
+ - **SmartArt layouts.** The `pyramid`, `matrix`, `cycle`, `chevrons`, `flow` and `vertical-flow` layouts draw one diagram from a list; PowerPoint export writes live SmartArt where it holds the text, and native shapes elsewhere. See [SmartArt layouts](https://github.com/OpenPresentation/opf/blob/main/docs/smartart.md).
127
+ - **Diagrams.** A Mermaid `diagram` payload is drawn in the deck's design and exports as native PowerPoint shapes by default (`--diagrams picture` for a picture). See [diagrams](https://github.com/OpenPresentation/opf/blob/main/docs/diagrams.md).
128
+
120
129
  ### Layout previews
121
130
 
122
131
  `@openpresentation/gallery/previews` ships pre-rendered SVG thumbnails for the
package/dist/browser.js CHANGED
@@ -1,26 +1,26 @@
1
- import { OPFApiError } from './chunk-56J345KE.js';
2
- export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-56J345KE.js';
3
- export { specFileEntries, specFileKinds, specFilePaths } from './chunk-UJSAR6GF.js';
1
+ import { OPFApiError } from './chunk-DAS75LGR.js';
2
+ export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-DAS75LGR.js';
3
+ export { specFileEntries, specFileKinds, specFilePaths } from './chunk-W4DYDRV2.js';
4
4
  export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-PJSPHHRK.js';
5
- export { OPFDataImportError, ingest, parseTabularData } from './chunk-PB7ME64J.js';
6
- export { OPFPaginationError, blockUnits, continuationPages, continueOverfull, paginate, paginateSlide } from './chunk-CLRYHWQN.js';
7
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-J63CIRIV.js';
8
- export { fromMarkdown, toMarkdown } from './chunk-F7DN33UL.js';
9
- import './chunk-IT7FQKED.js';
10
- export { OPFFormatError, format } from './chunk-HKUV7NEN.js';
5
+ export { OPFDataImportError, ingest, parseTabularData } from './chunk-XIOC6N5P.js';
6
+ export { OPFPaginationError, blockUnits, continuationPages, continueOverfull, paginate, paginateSlide } from './chunk-ABWEUXLV.js';
7
+ export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-XANW7MB7.js';
8
+ export { fromMarkdown, toMarkdown } from './chunk-E7WQHMCL.js';
9
+ import './chunk-S5QRGMUQ.js';
10
+ export { OPFFormatError, format } from './chunk-R6C6BQOG.js';
11
11
  import './chunk-RYZPBJLB.js';
12
- export { explain } from './chunk-XFHXQCXL.js';
13
- import './chunk-2E6CDYL2.js';
14
- import './chunk-NEJ32O7X.js';
15
- export { OPFMarkdownError } from './chunk-BBVW5ZC2.js';
16
- import './chunk-XQO2CT6Q.js';
17
- export { OPFIdError, assignIds, touches } from './chunk-SW676APJ.js';
18
- export { diff, merge } from './chunk-YFJIIIOL.js';
19
- export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, documentHash, findValidationRule, idToken, isIdToken, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSlideContext, toIdPatch, toIdPointer, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-OXLA4HXQ.js';
12
+ export { explain } from './chunk-BI4ERFAA.js';
13
+ import './chunk-Y557TYML.js';
14
+ import './chunk-KVHNDHVS.js';
15
+ export { OPFMarkdownError } from './chunk-QD6DPS7X.js';
16
+ import './chunk-VKEYV3ZK.js';
17
+ export { OPFIdError, assignIds, touches } from './chunk-YS333HLA.js';
18
+ export { diff, merge } from './chunk-VSBZC2PR.js';
19
+ export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogIconKinds, catalogSchemaNames, documentHash, findValidationRule, idToken, isIdToken, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSlideContext, toIdPatch, toIdPointer, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-UK3J6FSU.js';
20
20
  import './chunk-JBARNYFR.js';
21
- export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-LEF4X4KI.js';
22
- export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartDrawDiagnostics, chartDrawPlan, chartNumber, coerceVariableValue, datasetDiagnostics, formatDataNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isPlaceLabel, isTemplate, isXYChartType, listBuiltinVariables, listVariables, markLabelColor, normalizeLanguageFamily, numberFormatError, parseReference, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveReference, resolveSlideVariables, resolveTableData, resolveVariables, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unresolvedReference, unusedDatasets, variableDeclarations } from './chunk-NVAJASOD.js';
23
- import './chunk-GM7WFPGG.js';
21
+ export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-QF5RSRXU.js';
22
+ export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartDrawDiagnostics, chartDrawPlan, chartNumber, coerceVariableValue, datasetDiagnostics, diagramsPending, embedIcons, ensureDiagrams, ensureIcons, ensureShapes, formatDataNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, iconsPending, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isPlaceLabel, isTemplate, isXYChartType, listBuiltinVariables, listVariables, markLabelColor, nearIconNames, normalizeLanguageFamily, numberFormatError, parseIconReference, parseReference, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveIcon, resolveReference, resolveSlideVariables, resolveTableData, resolveVariables, shapesPending, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unresolvedReference, unusedDatasets, variableDeclarations } from './chunk-OPVJLL7H.js';
23
+ import './chunk-PRXZD2II.js';
24
24
 
25
25
  // src/browser.ts
26
26
  var nodeOnly = (name, message) => new OPFApiError(`\`${name}\` ${message}`, "node-only", { details: { function: name, build: "browser" } });
@@ -25,6 +25,11 @@ type CatalogRecords = {
25
25
  interface Catalog extends CatalogRecords {
26
26
  /** The catalog's identity: an HTTPS URL or a `pkg:` reference. Never fetched. */
27
27
  readonly source: string;
28
+ /**
29
+ * LH-14: the icon sets an `icon` names as `<set>:<name>`, by set id: each the set's record (opf-icon-set/v1 without `$schema`
30
+ * and `id`), or a function that loads it (`galleryIconSets` of @openpresentation/gallery/icon-sets: each set loads on first use; `ensureIcons` calls it). See icons.ts.
31
+ */
32
+ readonly iconSets?: Readonly<Record<string, Readonly<Record<string, unknown>> | (() => Promise<unknown>)>>;
28
33
  }
29
34
  /** The one option every entry point that resolves references accepts. */
30
35
  interface CatalogOptions {
@@ -1,4 +1,4 @@
1
- import { a as CatalogKind } from './catalog-refs-kAefsZWT.js';
1
+ import { a as CatalogKind } from './catalog-refs-B_0_vZg0.js';
2
2
  import { SchemaName } from './schemas.js';
3
3
 
4
4
  /**
@@ -11,10 +11,16 @@ declare const CATALOG_SCHEMA = 4;
11
11
  /** Kinds of catalog display metadata: published by catalogs for pickers, never referenced by documents. */
12
12
  declare const catalogDisplayKinds: readonly ["chartTypes", "languages", "socialPlatforms"];
13
13
  type CatalogDisplayKind = (typeof catalogDisplayKinds)[number];
14
- /** Every kind of record a catalog publishes: the content kinds documents reference, and the display kinds. */
15
- type CatalogRecordKind = CatalogKind | CatalogDisplayKind;
14
+ /**
15
+ * LH-14: icon sets, the records an `icon` names as `<set>:<name>`. They resolve by their own rule (icons.ts), not as a content
16
+ * reference, and a registered catalog may give a set as a function that loads it.
17
+ */
18
+ declare const catalogIconKinds: readonly ["iconSets"];
19
+ type CatalogIconKind = (typeof catalogIconKinds)[number];
20
+ /** Every kind of record a catalog publishes: the content kinds documents reference, the display kinds and the icon sets. */
21
+ type CatalogRecordKind = CatalogKind | CatalogDisplayKind | CatalogIconKind;
16
22
  /** The companion schema each catalog record kind validates against. */
17
23
  declare const catalogSchemaNames: Readonly<Record<CatalogRecordKind, SchemaName>>;
18
24
 
19
- export { CATALOG_SCHEMA as a, catalogDisplayKinds as c, catalogSchemaNames as d };
25
+ export { CATALOG_SCHEMA as a, catalogDisplayKinds as c, catalogIconKinds as d, catalogSchemaNames as e };
20
26
  export type { CatalogRecordKind as C, CatalogDisplayKind as b };
@@ -1,5 +1,5 @@
1
- import { assertValid, resolveSlideScriptMeasurement, resolveDrawnFontFamilies, resolveSlideContext } from './chunk-OXLA4HXQ.js';
2
- import { composeSlide, resolveSlideVariables, OPFCompositionError, checkCatalogsOption, usesSlideBuiltin, codeHighlightSlice, tableRowBoundaries, visitContentPayloads, regionAccepts, slideTokenSpans, sliceNumberedItems } from './chunk-NVAJASOD.js';
1
+ import { assertValid, resolveSlideScriptMeasurement, resolveDrawnFontFamilies, resolveSlideContext } from './chunk-UK3J6FSU.js';
2
+ import { composeSlide, resolveSlideVariables, slideBlockIds, OPFCompositionError, checkCatalogsOption, usesSlideBuiltin, isOverlayConnector, codeHighlightSlice, tableRowBoundaries, visitContentPayloads, regionAccepts, slideTokenSpans, sliceNumberedItems, isShapeBlock } from './chunk-OPVJLL7H.js';
3
3
 
4
4
  // src/pagination.ts
5
5
  var OPFPaginationError = class extends Error {
@@ -20,6 +20,9 @@ var slideIds = (slide) => {
20
20
  visitContentPayloads(slide, "", (payload) => {
21
21
  if (typeof payload.id === "string") ids.push(payload.id);
22
22
  });
23
+ if (Array.isArray(slide.shapes)) {
24
+ for (const entry of slide.shapes) if (isRecord(entry) && typeof entry.id === "string") ids.push(entry.id);
25
+ }
23
26
  return ids;
24
27
  };
25
28
  var textOf = (value) => typeof value === "string" ? value : Array.isArray(value) ? value.map(textOf).join("") : value?.text ?? "";
@@ -202,11 +205,66 @@ function paginateSlide(input, options = {}) {
202
205
  return id;
203
206
  };
204
207
  const assignPageIds = (slide, pageIndex) => {
208
+ const renamed = /* @__PURE__ */ new Map();
205
209
  const assign = (node) => {
206
- if (typeof node.id === "string") node.id = pageId(node.id, pageIndex);
210
+ if (typeof node.id === "string") {
211
+ const id = pageId(node.id, pageIndex);
212
+ if (id !== node.id) renamed.set(node.id, id);
213
+ node.id = id;
214
+ }
207
215
  };
208
216
  assign(slide);
209
217
  visitContentPayloads(slide, "", assign);
218
+ if (!Array.isArray(slide.shapes)) return;
219
+ for (const entry of slide.shapes) if (isRecord(entry)) assign(entry);
220
+ const follow = (id) => typeof id === "string" ? renamed.get(id) ?? id : id;
221
+ for (const entry of slide.shapes) {
222
+ if (!isRecord(entry)) continue;
223
+ if (isRecord(entry.at)) entry.at = { ...entry.at, block: follow(entry.at.block) };
224
+ if (isRecord(entry.connector)) entry.connector = { ...entry.connector, from: follow(entry.connector.from), to: follow(entry.connector.to) };
225
+ }
226
+ };
227
+ const blockIds = slideBlockIds(source, sourceBase);
228
+ const pageOverlay = (mappings) => {
229
+ if (!Array.isArray(source.shapes)) return { connectors: [], starts: [] };
230
+ const onPage = (id) => {
231
+ const path = typeof id === "string" ? blockIds.get(id) : void 0;
232
+ return path !== void 0 && mappings.some((mapping) => mapping.sourcePath.startsWith(`${path}.`));
233
+ };
234
+ const kept = /* @__PURE__ */ new Set(), overlayIds = /* @__PURE__ */ new Set();
235
+ source.shapes.forEach((entry, index) => {
236
+ if (!isRecord(entry) || isOverlayConnector(entry)) return;
237
+ if (entry.at !== void 0 && !onPage(isRecord(entry.at) ? entry.at.block : void 0)) return;
238
+ kept.add(index);
239
+ if (typeof entry.id === "string") overlayIds.add(entry.id);
240
+ });
241
+ const present = (id) => onPage(id) || typeof id === "string" && overlayIds.has(id);
242
+ const connectors = [], starts = [];
243
+ source.shapes.forEach((entry, index) => {
244
+ if (!isRecord(entry) || !isOverlayConnector(entry)) return;
245
+ const connector = isRecord(entry.connector) ? entry.connector : {};
246
+ const from = present(connector.from);
247
+ if (from) starts.push(index);
248
+ if (from && present(connector.to)) {
249
+ kept.add(index);
250
+ connectors.push(index);
251
+ }
252
+ });
253
+ const shapes = source.shapes.filter((_, index) => kept.has(index)).map((entry) => clone(entry));
254
+ return { ...shapes.length ? { shapes } : {}, connectors, starts };
255
+ };
256
+ const pageConnectors = [];
257
+ const splitDiagnostics = () => {
258
+ if (!Array.isArray(source.shapes)) return;
259
+ const drawn = new Set(pageConnectors.flatMap((page) => page.connectors));
260
+ source.shapes.forEach((entry, index) => {
261
+ if (!isRecord(entry) || !isOverlayConnector(entry) || drawn.has(index)) return;
262
+ const page = pageConnectors.findIndex((entry2) => entry2.starts.includes(index));
263
+ if (page < 0) return;
264
+ const connector = isRecord(entry.connector) ? entry.connector : {};
265
+ const target = pages[page];
266
+ target.diagnostics = [...target.diagnostics ?? [], { code: "connector-split", path: `${sourceBase}.shapes.${index}`, message: `The connector from '${String(connector.from)}' to '${String(connector.to)}' is not drawn: its ends landed on different pages. Keep both of them on one page, or join shapes of one page.` }];
267
+ });
210
268
  };
211
269
  const project = (portions, pageIndex) => {
212
270
  const mappings = [];
@@ -241,13 +299,18 @@ function paginateSlide(input, options = {}) {
241
299
  result[key] = child;
242
300
  hasContent = true;
243
301
  }
302
+ } else if (key === "text" && isShapeBlock(node)) {
303
+ if (portions.has(`${path}.shape`) || portions.has(`${path}.path`)) result[key] = clone(value);
244
304
  } else if (!contentFields.has(key)) result[key] = clone(value);
245
305
  }
246
306
  return root || hasContent ? result : void 0;
247
307
  };
248
308
  const slide = visit(source, sourceBase, `slides.${sourceIndex + pageIndex}`, true);
249
309
  if (pageIndex > 0) delete slide.notes;
250
- return { slide, mappings };
310
+ const overlay = pageOverlay(mappings);
311
+ delete slide.shapes;
312
+ if (overlay.shapes) slide.shapes = overlay.shapes;
313
+ return { slide, mappings, overlay };
251
314
  };
252
315
  const diagnosticsFor = (portions) => fit(geometry(project(portions, slides.length).slide, slides.length).diagnostics);
253
316
  let firstSizes;
@@ -255,7 +318,7 @@ function paginateSlide(input, options = {}) {
255
318
  const finish = () => {
256
319
  if (!selected.size) return;
257
320
  if (slides.length >= maxSlides) throw new OPFPaginationError(`Pagination needs more than ${maxSlides} slides. No partial result was returned.`);
258
- const { slide, mappings } = project(selected, slides.length);
321
+ const { slide, mappings, overlay } = project(selected, slides.length);
259
322
  const cap = firstSizes && Math.max(0, ...[...selected.values()].map((portion) => firstSizes.get(kindOf(portion.leaf.field)) ?? 0));
260
323
  if (cap) slide.composition = { ...slide.composition, maxFontSize: Math.min(Math.max(8, cap), 200, slide.composition?.maxFontSize ?? Infinity) };
261
324
  const drawn = geometry(slide, slides.length), issues = fit(drawn.diagnostics);
@@ -265,6 +328,7 @@ function paginateSlide(input, options = {}) {
265
328
  assertValid({ ...deckContext(options.presentation), slides: [slide] }, { only: ["format"] });
266
329
  slides.push(slide);
267
330
  pages.push({ slideIndex: sourceIndex + slides.length - 1, mappings, ...initial.furniture ? { repeatedMappings: repeatedMappings(slides.length - 1) } : {} });
331
+ pageConnectors.push(overlay);
268
332
  selected = /* @__PURE__ */ new Map();
269
333
  };
270
334
  if (options.wholeBlocks) {
@@ -301,6 +365,7 @@ function paginateSlide(input, options = {}) {
301
365
  selected = portions(from, to);
302
366
  finish();
303
367
  }
368
+ splitDiagnostics();
304
369
  return { slides, pages };
305
370
  }
306
371
  for (const leaf of leaves) {
@@ -350,6 +415,7 @@ function paginateSlide(input, options = {}) {
350
415
  }
351
416
  finish();
352
417
  if (!slides.length) throw new OPFPaginationError("No body content can be paginated.", initial.diagnostics);
418
+ splitDiagnostics();
353
419
  return { slides, pages };
354
420
  }
355
421
  function paginate(input, options = {}) {
@@ -445,7 +511,7 @@ function paginateSlides(input, options, name, maxSlides, split) {
445
511
  if (result2.slides.length > 1) splits2.push({ sourceSlideIndex: index, outputStart, count: result2.slides.length });
446
512
  result2.pages.forEach((page, pageIndex) => {
447
513
  const remap = (mapping) => ({ ...mapping, outputPath: mapping.outputPath.replace(/^slides\.\d+/, `slides.${outputStart + pageIndex}`) });
448
- pages2.push({ sourceSlideIndex: index, slideIndex: outputStart + pageIndex, mappings: page.mappings.map(remap), ...page.repeatedMappings ? { repeatedMappings: page.repeatedMappings.map(remap) } : {} });
514
+ pages2.push({ sourceSlideIndex: index, slideIndex: outputStart + pageIndex, mappings: page.mappings.map(remap), ...page.repeatedMappings ? { repeatedMappings: page.repeatedMappings.map(remap) } : {}, ...page.diagnostics ? { diagnostics: page.diagnostics } : {} });
449
515
  });
450
516
  output2.push(...result2.slides);
451
517
  reservedIds.push(...result2.slides.flatMap((slide2) => slideIds(slide2)));
@@ -1,4 +1,4 @@
1
- import { SOURCE_EXPLAIN, ruleDocumentation, findValidationRule, us } from './chunk-OXLA4HXQ.js';
1
+ import { SOURCE_EXPLAIN, ruleDocumentation, findValidationRule, us } from './chunk-UK3J6FSU.js';
2
2
 
3
3
  // src/finding-text-explain-util.ts
4
4
  var ex = (fix, problem, fixed) => ({ fix, problem, fixed });
@@ -115,6 +115,16 @@ var AUDIT_EXPLAIN = {
115
115
  { catalogs: { custom: { layouts: { roadmap: ROADMAP } } }, slides: [{ layout: "roadmap", blocks: [{ region: "timeline", text: "Note" }] }] },
116
116
  { catalogs: { custom: { layouts: { roadmap: ROADMAP } } }, slides: [{ layout: "roadmap", blocks: [{ region: "notes", text: "Note" }] }] }
117
117
  ),
118
+ "opf/icon-dropped": ex(
119
+ "Put the icon on an entry, metric or group it can mark (a first-level entry of an unnumbered list), or give the slide room for its chips.",
120
+ { catalogs: { custom: { iconSets: { brand: { name: "Brand", license: "MIT", copyright: "Copyright (c) 2026 Example", viewBox: [0, 0, 24, 24], style: "stroke", icons: { star: "M12 3l3 6 6 1-4.5 4 1 6-5.5-3-5.5 3 1-6L3 10l6-1z" } } } } }, slides: [{ title: "Steps", items: [{ text: "Sign up", icon: "brand:star" }, { text: "Invite the team" }], numbering: "arabic" }] },
121
+ { catalogs: { custom: { iconSets: { brand: { name: "Brand", license: "MIT", copyright: "Copyright (c) 2026 Example", viewBox: [0, 0, 24, 24], style: "stroke", icons: { star: "M12 3l3 6 6 1-4.5 4 1 6-5.5-3-5.5 3 1-6L3 10l6-1z" } } } } }, slides: [{ title: "Steps", items: [{ text: "Sign up", icon: "brand:star" }, { text: "Invite the team" }] }] }
122
+ ),
123
+ "opf/arrangement-adapted": ex(
124
+ "Give a matrix exactly four short entries, or choose another layout for another count.",
125
+ { catalogs: { custom: { layouts: { quad: { name: "Quad", regions: [{ name: "title" }, { name: "quadrants", accepts: ["list"], flow: "none", arrangement: "matrix" }] } } } }, slides: [{ layout: "quad", title: "Markets", items: ["North", "South", "East"] }] },
126
+ { catalogs: { custom: { layouts: { quad: { name: "Quad", regions: [{ name: "title" }, { name: "quadrants", accepts: ["list"], flow: "none", arrangement: "matrix" }] } } } }, slides: [{ layout: "quad", title: "Markets", items: ["North", "South", "East", "West"] }] }
127
+ ),
118
128
  "opf/region-full": ex(
119
129
  "Pin the block to another region with room, or remove `region` so it is placed by its kind.",
120
130
  { catalogs: { custom: { layouts: { roadmap: ROADMAP } } }, slides: [{ layout: "roadmap", blocks: [{ region: "timeline", ...TIMELINE }, { region: "timeline", ...TIMELINE }] }] },
@@ -297,6 +307,36 @@ var FORMAT_EXPLAIN = {
297
307
  { title: "Revenue", chart: CHART, fit: "cover" },
298
308
  { title: "Revenue", image: IMG("team"), fit: "cover" }
299
309
  ),
310
+ "opf/shape-option-unsupported-payload": ex(
311
+ "Remove the shape option, or make the block a shape block with `shape` (a preset such as roundRect) or `path`. Options such as `fill`, `style` and `rotate` describe how a shape is drawn.",
312
+ { title: "Plan", blocks: [{ text: "Launch", fill: "accent2" }] },
313
+ { title: "Plan", blocks: [{ shape: "roundRect", text: "Launch", fill: "accent2" }] }
314
+ ),
315
+ "opf/shape-adjust-unknown": ex(
316
+ "Use an adjust name the preset has (docs/shapes.md lists them; roundRect has `adj`, rightArrow `adj1` and `adj2`), or remove it.",
317
+ { title: "Plan", blocks: [{ shape: "roundRect", adjust: { adj1: 0.3 } }] },
318
+ { title: "Plan", blocks: [{ shape: "roundRect", adjust: { adj: 0.3 } }] }
319
+ ),
320
+ "opf/shape-adjust-range": ex(
321
+ "Set the adjust value inside its handle's range: roundRect's corner `adj` runs from 0 to 0.5 of the shorter side.",
322
+ { title: "Plan", blocks: [{ shape: "roundRect", adjust: { adj: 0.8 } }] },
323
+ { title: "Plan", blocks: [{ shape: "roundRect", adjust: { adj: 0.5 } }] }
324
+ ),
325
+ "opf/shape-link-hidden": ex(
326
+ "Show the shape, or drop its link: a hidden shape cannot be clicked.",
327
+ { title: "Plan", blocks: [{ shape: "rect", text: "Pricing", link: "https://example.com/pricing", hidden: true }] },
328
+ { title: "Plan", blocks: [{ shape: "rect", text: "Pricing", link: "https://example.com/pricing" }] }
329
+ ),
330
+ "opf/shape-anchor-missing": ex(
331
+ "Name a block of the slide in `at.block` (give the block an `id`), or place the shape by `x`, `y`, `width` and `height`.",
332
+ { title: "Team", blocks: [{ id: "photo", image: IMG("team") }], shapes: [{ shape: "ellipse", text: "New", at: { block: "phot", edge: "top" } }] },
333
+ { title: "Team", blocks: [{ id: "photo", image: IMG("team") }], shapes: [{ shape: "ellipse", text: "New", at: { block: "photo", edge: "top" } }] }
334
+ ),
335
+ "opf/connector-end-missing": ex(
336
+ "Name a block or an overlay shape of the slide in `from` and `to` (give it an `id`).",
337
+ { title: "Plan", blocks: [{ id: "plan", shape: "roundRect", text: "Plan" }, { id: "ship", shape: "roundRect", text: "Ship" }], shapes: [{ connector: { from: "plan", to: "shipping", route: "elbow" } }] },
338
+ { title: "Plan", blocks: [{ id: "plan", shape: "roundRect", text: "Plan" }, { id: "ship", shape: "roundRect", text: "Ship" }], shapes: [{ connector: { from: "plan", to: "ship", route: "elbow" } }] }
339
+ ),
300
340
  "opf/image-placement-invalid": ex(
301
341
  "Use `placement` on a top-level block of the slide, with one placed image per slide edge.",
302
342
  { title: "Team", blocks: [{ image: IMG("a"), placement: { edge: "left" } }, { image: IMG("b"), placement: { edge: "left" } }] },
@@ -368,6 +408,7 @@ var FORMAT_EXPLAIN = {
368
408
  var NARRATIVE = { name: "Arc", beats: [{ id: "hook", name: "Hook" }, { id: "proof", name: "Proof" }] };
369
409
  var GALLERY_LAYOUT = { name: "Mine", regions: [{ name: "title" }] };
370
410
  var DATA = { columns: ["Quarter", "Revenue"], rows: [["Q1", 12]] };
411
+ var ICON_SET = { name: "Brand", license: "MIT", copyright: "Copyright (c) 2026 Example", viewBox: [0, 0, 24, 24], style: "stroke", icons: { star: "M12 3l3 6 6 1-4.5 4 1 6-5.5-3-5.5 3 1-6L3 10l6-1z" } };
371
412
  var REFERENCES_EXPLAIN = {
372
413
  "opf/run-color-unrecognized": ex(
373
414
  "Write a hex color (`#1F4E79`), a color scheme name (`accent1`, `text`) or a `var:` reference to a declared color variable.",
@@ -429,6 +470,16 @@ var REFERENCES_EXPLAIN = {
429
470
  { references: [{ id: "gartner", text: "Gartner, 2026" }], slides: [{ title: "Market", text: "Up 12%" }] },
430
471
  { references: [{ id: "gartner", text: "Gartner, 2026" }], slides: [{ title: "Market", text: [{ text: "Up 12%", cite: "gartner" }] }] }
431
472
  ),
473
+ "opf/icon-unknown": ex(
474
+ "Use an icon the set has (search_icons finds names by keyword), add the name to the deck's `icons`, or remove the icon.",
475
+ { catalogs: { custom: { iconSets: { brand: ICON_SET } } }, slides: [{ title: "Why us", items: [{ text: "Rated first", icon: "brand:stra" }] }] },
476
+ { catalogs: { custom: { iconSets: { brand: ICON_SET } } }, slides: [{ title: "Why us", items: [{ text: "Rated first", icon: "brand:star" }] }] }
477
+ ),
478
+ "opf/icon-invalid": ex(
479
+ "Keep only shapes in the icon's SVG, with no script, event handler, external reference or raster.",
480
+ { icons: { mark: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><image href="https://example.com/a.png" width="24" height="24"/></svg>' }, slides: [{ title: "Why us", items: [{ text: "Rated first", icon: "mark" }] }] },
481
+ { icons: { mark: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 12l5 5L20 6" fill="none" stroke="currentColor" stroke-width="2"/></svg>' }, slides: [{ title: "Why us", items: [{ text: "Rated first", icon: "mark" }] }] }
482
+ ),
432
483
  "opf/unused-dataset": ex(
433
484
  "Point a chart or table at the dataset with `dataset`, or remove it.",
434
485
  { datasets: { sales: DATA }, slides: [{ title: "Revenue", text: "Up 12%" }] },
@@ -1,6 +1,6 @@
1
- import { OPFDataImportError, parseTabularData } from './chunk-PB7ME64J.js';
2
- import { applyPatchWithInverse, validate, OPFValidationError } from './chunk-OXLA4HXQ.js';
3
- import { embeddedCopy, checkCatalogsOption, catalogReferenceSites, parseReference, catalogGroupDeclared, resolveReference, dottedPath, unresolvedReference, recordReferenceSites, catalogGroupSource, registeredCatalog, catalogKinds, CATALOG_GROUP_PATTERN, isRecord, visitContentPayloads, annotationText, listVariables, resolveVariables, LOGO_SHAPES, resolveDesignRecords, resolveFontFamilies, resolveCanvasDimensions, imageBackground } from './chunk-NVAJASOD.js';
1
+ import { OPFDataImportError, parseTabularData } from './chunk-XIOC6N5P.js';
2
+ import { applyPatchWithInverse, validate, OPFValidationError } from './chunk-UK3J6FSU.js';
3
+ import { embeddedCopy, checkCatalogsOption, catalogReferenceSites, parseReference, catalogGroupDeclared, resolveReference, dottedPath, unresolvedReference, recordReferenceSites, catalogGroupSource, registeredCatalog, catalogKinds, CATALOG_GROUP_PATTERN, isRecord, visitContentPayloads, annotationText, listVariables, resolveVariables, LOGO_SHAPES, resolveDesignRecords, resolveFontFamilies, resolveCanvasDimensions, imageBackground } from './chunk-OPVJLL7H.js';
4
4
 
5
5
  // src/api-errors.ts
6
6
  var OPFApiError = class extends Error {
@@ -1,10 +1,10 @@
1
1
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
2
- import { readMarkdown, parseSlideText, escapeInline, serializeRuns } from './chunk-2E6CDYL2.js';
3
- import { fenceCode } from './chunk-NEJ32O7X.js';
4
- import { OPFMarkdownError, writeYaml, Ctx, readYamlMapping, csvField, scalarText } from './chunk-BBVW5ZC2.js';
5
- import { same, isRecord, runText, isPlainRun, FORMATTING } from './chunk-XQO2CT6Q.js';
6
- import { validate } from './chunk-OXLA4HXQ.js';
7
- import { checkCatalogsOption } from './chunk-NVAJASOD.js';
2
+ import { readMarkdown, parseSlideText, escapeInline, serializeRuns } from './chunk-Y557TYML.js';
3
+ import { fenceCode } from './chunk-KVHNDHVS.js';
4
+ import { OPFMarkdownError, writeYaml, Ctx, readYamlMapping, csvField, scalarText } from './chunk-QD6DPS7X.js';
5
+ import { same, isRecord, runText, isPlainRun, FORMATTING } from './chunk-VKEYV3ZK.js';
6
+ import { validate } from './chunk-UK3J6FSU.js';
7
+ import { checkCatalogsOption } from './chunk-OPVJLL7H.js';
8
8
 
9
9
  // src/markdown/canon.ts
10
10
  var FORMAT_KEYS = FORMATTING;
@@ -0,0 +1,221 @@
1
+ import { presetGeometry, presetAdjustments, isPresetShape, flattenShapePath, evaluateGuideFormula, customGeometry, adjustToDrawingML, adjustFromDrawingML, PRESET_SHAPES } from './chunk-YYT6N7AI.js';
2
+ import { __export } from './chunk-PRXZD2II.js';
3
+
4
+ // src/shape-engine-module.ts
5
+ var shape_engine_module_exports = {};
6
+ __export(shape_engine_module_exports, {
7
+ PRESET_SHAPES: () => PRESET_SHAPES,
8
+ adjustFromDrawingML: () => adjustFromDrawingML,
9
+ adjustToDrawingML: () => adjustToDrawingML,
10
+ customGeometry: () => customGeometry,
11
+ evaluateGuideFormula: () => evaluateGuideFormula,
12
+ flattenShapePath: () => flattenShapePath,
13
+ isPresetShape: () => isPresetShape,
14
+ presetAdjustments: () => presetAdjustments,
15
+ presetGeometry: () => presetGeometry,
16
+ sketchPathData: () => sketchPathData,
17
+ sketchSeed: () => sketchSeed,
18
+ starOutline: () => starOutline
19
+ });
20
+
21
+ // src/shape-sketch.ts
22
+ function sketchSeed(text) {
23
+ let hash = 2166136261;
24
+ for (let index = 0; index < text.length; index++) hash = Math.imul(hash ^ text.charCodeAt(index), 16777619) >>> 0;
25
+ return hash % 2147483647;
26
+ }
27
+ function stream(seed) {
28
+ let state = seed >>> 0;
29
+ return () => {
30
+ state = state + 1831565813 >>> 0;
31
+ let t = state;
32
+ t = Math.imul(t ^ t >>> 15, t | 1);
33
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
34
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
35
+ };
36
+ }
37
+ function polylines(d) {
38
+ const tokens = d.match(/[A-Za-z]|-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/g) ?? [];
39
+ const lines = [];
40
+ let line = [], at = 0, command = "", x = 0, y = 0;
41
+ const read = () => Number(tokens[at++]);
42
+ const push = (px, py) => {
43
+ line.push([px, py]);
44
+ x = px;
45
+ y = py;
46
+ };
47
+ while (at < tokens.length) {
48
+ if (/^[A-Za-z]$/.test(tokens[at])) command = tokens[at++];
49
+ if (!/^[MLHVCQAZ]$/.test(command)) return void 0;
50
+ if (command === "Z") {
51
+ if (line.length > 1) lines.push({ points: line, closed: true });
52
+ const first = line[0];
53
+ line = [];
54
+ if (first) {
55
+ x = first[0];
56
+ y = first[1];
57
+ }
58
+ continue;
59
+ }
60
+ if (command === "M") {
61
+ if (line.length > 1) lines.push({ points: line, closed: false });
62
+ line = [];
63
+ push(read(), read());
64
+ command = "L";
65
+ continue;
66
+ }
67
+ if (command === "L") {
68
+ push(read(), read());
69
+ continue;
70
+ }
71
+ if (command === "H") {
72
+ push(read(), y);
73
+ continue;
74
+ }
75
+ if (command === "V") {
76
+ push(x, read());
77
+ continue;
78
+ }
79
+ if (command === "C" || command === "Q") {
80
+ const c = command === "C" ? [read(), read(), read(), read(), read(), read()] : [read(), read(), read(), read()];
81
+ const x0 = x, y0 = y;
82
+ for (let step = 1; step <= 16; step++) {
83
+ const t = step / 16, u = 1 - t;
84
+ if (command === "C") push(u * u * u * x0 + 3 * u * u * t * c[0] + 3 * u * t * t * c[2] + t * t * t * c[4], u * u * u * y0 + 3 * u * u * t * c[1] + 3 * u * t * t * c[3] + t * t * t * c[5]);
85
+ else push(u * u * x0 + 2 * u * t * c[0] + t * t * c[2], u * u * y0 + 2 * u * t * c[1] + t * t * c[3]);
86
+ }
87
+ continue;
88
+ }
89
+ const [rx0, ry0, rotation, large, sweep, ex, ey] = [read(), read(), read(), read(), read(), read(), read()];
90
+ let rx = Math.abs(rx0), ry = Math.abs(ry0);
91
+ if (!rx || !ry) {
92
+ push(ex, ey);
93
+ continue;
94
+ }
95
+ const phi = rotation * Math.PI / 180, cos = Math.cos(phi), sin = Math.sin(phi);
96
+ const dx = (x - ex) / 2, dy = (y - ey) / 2, x1 = cos * dx + sin * dy, y1 = -sin * dx + cos * dy;
97
+ const lambda = x1 * x1 / (rx * rx) + y1 * y1 / (ry * ry);
98
+ if (lambda > 1) {
99
+ rx *= Math.sqrt(lambda);
100
+ ry *= Math.sqrt(lambda);
101
+ }
102
+ const sign = large === sweep ? -1 : 1, num = rx * rx * ry * ry - rx * rx * y1 * y1 - ry * ry * x1 * x1;
103
+ const k = sign * Math.sqrt(Math.max(0, num / (rx * rx * y1 * y1 + ry * ry * x1 * x1)));
104
+ const cx1 = k * rx * y1 / ry, cy1 = -k * ry * x1 / rx;
105
+ const cx = cos * cx1 - sin * cy1 + (x + ex) / 2, cy = sin * cx1 + cos * cy1 + (y + ey) / 2;
106
+ const angle = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
107
+ const start = angle(1, 0, (x1 - cx1) / rx, (y1 - cy1) / ry);
108
+ let delta = angle((x1 - cx1) / rx, (y1 - cy1) / ry, (-x1 - cx1) / rx, (-y1 - cy1) / ry);
109
+ if (!sweep && delta > 0) delta -= 2 * Math.PI;
110
+ if (sweep && delta < 0) delta += 2 * Math.PI;
111
+ const steps = Math.max(4, Math.ceil(Math.abs(delta) / (Math.PI / 32)));
112
+ for (let step = 1; step <= steps; step++) {
113
+ const t = start + delta * step / steps, px = rx * Math.cos(t), py = ry * Math.sin(t);
114
+ push(step === steps ? ex : cos * px - sin * py + cx, step === steps ? ey : sin * px + cos * py + cy);
115
+ }
116
+ }
117
+ if (line.length > 1) lines.push({ points: line, closed: false });
118
+ return lines;
119
+ }
120
+ var STYLE = {
121
+ // spacing between wobble points (px), side bow (fraction of the side, capped), wave amplitude (px), jitter (px), corner overshoot (px)
122
+ curved: { spacing: 48, bow: 0.012, wave: 1.1, jitter: 0, overshoot: 0 },
123
+ freehand: { spacing: 14, bow: 6e-3, wave: 1.2, jitter: 0.45, overshoot: 0 },
124
+ scribble: { spacing: 14, bow: 0.01, wave: 1.8, jitter: 0.6, overshoot: 3 }
125
+ };
126
+ function sketchPathData(d, seed, style, scale = 1) {
127
+ const lines = polylines(d);
128
+ if (!lines?.length) return void 0;
129
+ const random = stream(seed), spec = STYLE[style];
130
+ const outline = [], extra = [];
131
+ const number = (value) => String(Math.round(value * 100) / 100);
132
+ for (const { points: raw, closed } of lines) {
133
+ const points = raw.filter((point, index) => index === 0 || Math.hypot(point[0] - raw[index - 1][0], point[1] - raw[index - 1][1]) > 1e-6);
134
+ if (closed && points.length > 2 && Math.hypot(points[0][0] - points.at(-1)[0], points[0][1] - points.at(-1)[1]) < 1e-6) points.pop();
135
+ if (points.length < 2) continue;
136
+ const count = points.length;
137
+ const turn = (index) => {
138
+ const p = points[(index - 1 + count) % count], q = points[index], r = points[(index + 1) % count];
139
+ const u = Math.atan2(q[1] - p[1], q[0] - p[0]), v = Math.atan2(r[1] - q[1], r[0] - q[0]);
140
+ return Math.abs(Math.atan2(Math.sin(v - u), Math.cos(v - u)));
141
+ };
142
+ const corners = points.map((_, index) => closed || index > 0 && index < count - 1 ? turn(index) > 35 * Math.PI / 180 : true).flatMap((corner, index) => corner ? [index] : []);
143
+ const sides = [];
144
+ if (!corners.length) sides.push([...points, points[0]]);
145
+ else {
146
+ const first = corners[0], ordered = closed ? [...points.slice(first), ...points.slice(0, first), points[first]] : points;
147
+ const marks = closed ? [...corners.map((index) => index - first), count] : corners;
148
+ for (let index = 0; index + 1 < marks.length; index++) sides.push(ordered.slice(marks[index], marks[index + 1] + 1));
149
+ }
150
+ const all = sides.map((side) => wobble(side, spec, random, scale, 0)).flatMap((side, index) => index ? side.slice(1) : side);
151
+ const smooth = closed && !corners.length;
152
+ outline.push(curveThrough(smooth ? all.slice(0, -1) : all, smooth, number) + (closed ? "Z" : ""));
153
+ if (spec.overshoot > 0) for (const side of sides) extra.push(curveThrough(wobble(side, spec, random, scale, 1), false, number));
154
+ }
155
+ if (!outline.length) return void 0;
156
+ return { outline: outline.join(""), line: outline.join("") + extra.join("") };
157
+ }
158
+ function wobble(side, spec, random, scale, pass) {
159
+ const lengths = [0];
160
+ for (let index = 1; index < side.length; index++) lengths.push(lengths[index - 1] + Math.hypot(side[index][0] - side[index - 1][0], side[index][1] - side[index - 1][1]));
161
+ const total = lengths.at(-1);
162
+ if (total < 1e-6) return side;
163
+ const samples = Math.max(2, Math.round(total / (spec.spacing * scale)));
164
+ const bow = Math.min(spec.bow * total, 4 * scale) * (random() * 2 - 1), phase = random() * Math.PI * 2, waves = Math.max(0.5, total / (90 * scale)) * (0.8 + random() * 0.4);
165
+ const over = pass ? spec.overshoot * scale : 0;
166
+ const at = (distance) => {
167
+ const clamped = Math.min(total, Math.max(0, distance));
168
+ let index = 1;
169
+ while (index < side.length - 1 && lengths[index] < clamped) index++;
170
+ const a = side[index - 1], b = side[index], span = lengths[index] - lengths[index - 1] || 1, t = (clamped - lengths[index - 1]) / span;
171
+ const tangent = [(b[0] - a[0]) / span, (b[1] - a[1]) / span];
172
+ return [[a[0] + (b[0] - a[0]) * t + tangent[0] * (distance - clamped), a[1] + (b[1] - a[1]) * t + tangent[1] * (distance - clamped)], tangent];
173
+ };
174
+ const result = [];
175
+ for (let step = 0; step <= samples; step++) {
176
+ const s = step / samples, [point, tangent] = at(-over + (total + 2 * over) * s);
177
+ const ends = pass ? 1 : Math.sin(Math.PI * s);
178
+ const offset = bow * Math.sin(Math.PI * s) + spec.wave * scale * Math.sin(phase + waves * Math.PI * 2 * s) * ends + spec.jitter * scale * (random() * 2 - 1) * (step === 0 || step === samples ? 0.5 : 1);
179
+ result.push([point[0] - tangent[1] * offset, point[1] + tangent[0] * offset]);
180
+ }
181
+ return result;
182
+ }
183
+ function curveThrough(points, closed, number) {
184
+ const count = points.length, get = (index) => closed ? points[(index + count) % count] : points[Math.min(count - 1, Math.max(0, index))];
185
+ let d = `M${number(points[0][0])} ${number(points[0][1])}`;
186
+ for (let index = 0; index < (closed ? count : count - 1); index++) {
187
+ const p0 = get(index - 1), p1 = get(index), p2 = get(index + 1), p3 = get(index + 2);
188
+ d += `C${number(p1[0] + (p2[0] - p0[0]) / 6)} ${number(p1[1] + (p2[1] - p0[1]) / 6)} ${number(p2[0] - (p3[0] - p1[0]) / 6)} ${number(p2[1] - (p3[1] - p1[1]) / 6)} ${number(p2[0])} ${number(p2[1])}`;
189
+ }
190
+ return d;
191
+ }
192
+
193
+ // src/shape-gradient.ts
194
+ function starOutline(rings, center) {
195
+ const [cx, cy] = center;
196
+ const edges = [];
197
+ for (const ring of rings) for (let at = 0; at < ring.length; at++) {
198
+ const [px, py] = ring[at], [qx, qy] = ring[(at + 1) % ring.length];
199
+ if (px !== qx || py !== qy) edges.push([px, py, qx, qy]);
200
+ }
201
+ if (rings.length === 1) {
202
+ const turns = edges.map(([px, py, qx, qy]) => (px - cx) * (qy - py) - (py - cy) * (qx - px));
203
+ if (turns.every((turn) => turn >= -1e-9) || turns.every((turn) => turn <= 1e-9)) return rings[0];
204
+ }
205
+ const angles = /* @__PURE__ */ new Set();
206
+ for (const [px, py] of edges) angles.add(Math.atan2(py - cy, px - cx));
207
+ for (let step = 0; step < 720; step++) angles.add(-Math.PI + step * Math.PI / 360);
208
+ return [...angles].sort((a, b) => a - b).map((angle) => {
209
+ const dx = Math.cos(angle), dy = Math.sin(angle);
210
+ let far = 0;
211
+ for (const [px, py, qx, qy] of edges) {
212
+ const ex = qx - px, ey = qy - py, denominator = dx * ey - dy * ex;
213
+ if (Math.abs(denominator) < 1e-12) continue;
214
+ const t = ((px - cx) * ey - (py - cy) * ex) / denominator, u = ((px - cx) * dy - (py - cy) * dx) / denominator;
215
+ if (t > far && u >= -1e-9 && u <= 1 + 1e-9) far = t;
216
+ }
217
+ return [cx + dx * far, cy + dy * far];
218
+ });
219
+ }
220
+
221
+ export { shape_engine_module_exports, sketchPathData, sketchSeed, starOutline };
@@ -1,7 +1,8 @@
1
1
  import { gallery } from '@openpresentation/gallery';
2
+ import { galleryIconSets } from '@openpresentation/gallery/icon-sets';
2
3
 
3
4
  // src/node/catalogs.ts
4
- var DEFAULTS = Object.freeze([gallery]);
5
+ var DEFAULTS = Object.freeze([gallery, galleryIconSets]);
5
6
  function defaultCatalogs() {
6
7
  return DEFAULTS;
7
8
  }
@@ -1,4 +1,4 @@
1
- import { runText } from './chunk-XQO2CT6Q.js';
1
+ import { runText } from './chunk-VKEYV3ZK.js';
2
2
 
3
3
  // src/convert/text-lines.ts
4
4
  var LIST_PREFIX = /^([ \t]*)(?:([-*•+]|\d{1,3}[.)])[ \t]+)?/;