@stll/docx-core 0.39.0 → 0.39.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.
@@ -1,8 +1,8 @@
1
- import { M as PARAGRAPH_ALIGNMENTS, et as isNumberingLevel, gt as finalizeParagraphFormatting, o as INSERTION_SEAM_POLICIES, rt as isNumberingReference, s as MAX_REVISION_ID, st as paragraphNumberingReference, t as COMMENT_PART_RELATIONSHIPS, vt as setDocumentBodyComments, yt as getSingularRunPropertyChange } from "../document-oU-dz9zs.js";
2
- import { a as hasIllegalXmlCharacters, t as sanitizeExternalUrl } from "../href-2XSCK-T8.js";
1
+ import { M as PARAGRAPH_ALIGNMENTS, et as isNumberingLevel, gt as finalizeParagraphFormatting, o as INSERTION_SEAM_POLICIES, rt as isNumberingReference, s as MAX_REVISION_ID, st as paragraphNumberingReference, t as COMMENT_PART_RELATIONSHIPS, vt as setDocumentBodyComments, yt as getSingularRunPropertyChange } from "../document-NtScxyHH.js";
2
+ import { a as hasIllegalXmlCharacters, t as sanitizeExternalUrl } from "../href-ogmJmncc.js";
3
3
  import { Result, TaggedError, panic } from "better-result";
4
4
  import { encodeUtf8 } from "@stll/utf8-boundaries";
5
- //#region src/ops/equality.ts
5
+ // src/ops/equality.ts
6
6
  const NOTHING = /* @__PURE__ */ new Set();
7
7
  const equal = (left, right, skipped) => {
8
8
  if (Object.is(left, right)) return true;
@@ -36,8 +36,8 @@ const derivedFields = (entries) => entries.some(([key, value]) => key === "type"
36
36
  * numbering or pagination was recomputed since.
37
37
  */
38
38
  const equalForStaleness = (left, right) => equal(left, right, derivedFields);
39
- //#endregion
40
- //#region src/ops/refusal.ts
39
+ // src/ops/refusal.ts
40
+ const DocumentOpRefusalBase = TaggedError("DocumentOpRefusal");
41
41
  /**
42
42
  * Why an operation was not applied. A refused operation changes nothing: the
43
43
  * document it was applied to is returned as it was.
@@ -137,9 +137,8 @@ const DOCUMENT_OP_REFUSAL_REASONS = Object.freeze({
137
137
  EMPTY_RECORD: "emptyRecord"
138
138
  });
139
139
  /** An operation the document cannot take as stated. */
140
- var DocumentOpRefusal = class extends TaggedError("DocumentOpRefusal") {};
141
- //#endregion
142
- //#region src/ops/paragraphPropertySnapshot.ts
140
+ var DocumentOpRefusal = class extends DocumentOpRefusalBase {};
141
+ // src/ops/paragraphPropertySnapshot.ts
143
142
  const snapshots = /* @__PURE__ */ new WeakMap();
144
143
  /** Bind effective formatting to the authored properties a review must record. */
145
144
  const registerParagraphPropertySnapshot = ({ paragraph, snapshot }) => {
@@ -160,8 +159,7 @@ const getParagraphPropertySnapshot = (paragraph) => {
160
159
  const registered = snapshots.get(paragraph);
161
160
  return registered !== void 0 && structurallyEqual(paragraph.formatting, registered.effective) ? registered.snapshot : paragraph.formatting;
162
161
  };
163
- //#endregion
164
- //#region src/ops/modelClone.ts
162
+ // src/ops/modelClone.ts
165
163
  const copyPrivateBindings = ({ source, target, seen }) => {
166
164
  if (typeof source !== "object" || source === null || typeof target !== "object" || target === null || seen.has(source)) return;
167
165
  seen.add(source);
@@ -224,8 +222,7 @@ const cloneModel = (value) => {
224
222
  });
225
223
  return cloned;
226
224
  };
227
- //#endregion
228
- //#region src/ops/wire.ts
225
+ // src/ops/wire.ts
229
226
  const PRESENCE_FIELD = "undefinedFields";
230
227
  const RESERVED_SEGMENTS = /* @__PURE__ */ new Set([
231
228
  "__proto__",
@@ -296,8 +293,7 @@ const restoreDocumentOp = (op) => {
296
293
  delete restored.undefinedFields;
297
294
  return Result.ok(restored);
298
295
  };
299
- //#endregion
300
- //#region src/ops/types.ts
296
+ // src/ops/types.ts
301
297
  /**
302
298
  * The operation schema this module reads and writes.
303
299
  *
@@ -419,8 +415,7 @@ const toOpEnvelope = (op) => ({
419
415
  schema: 10,
420
416
  op: captureDocumentOp(op)
421
417
  });
422
- //#endregion
423
- //#region src/ops/stories.ts
418
+ // src/ops/stories.ts
424
419
  /** Stable package-story addressing, shared by operations and editor projections. */
425
420
  const sameStory = (left, right) => {
426
421
  if (left === OP_STORIES.MAIN || right === OP_STORIES.MAIN) return left === right;
@@ -552,8 +547,7 @@ const replaceStoryBody = ({ document, story, body }) => {
552
547
  default: return story;
553
548
  }
554
549
  };
555
- //#endregion
556
- //#region src/ops/blocks.ts
550
+ // src/ops/blocks.ts
557
551
  /**
558
552
  * Finding and replacing paragraphs in a story.
559
553
  *
@@ -562,6 +556,7 @@ const replaceStoryBody = ({ document, story, body }) => {
562
556
  * wherever it sits in that tree, and a replacement rebuilds only the records
563
557
  * on the path to it, so every other block is `===` to its input.
564
558
  */
559
+ const SectionViewErrorBase = TaggedError("SectionViewError");
565
560
  const collectParagraphs = (blocks, list, out) => {
566
561
  for (const [index, block] of blocks.entries()) switch (block.type) {
567
562
  case "paragraph":
@@ -749,7 +744,7 @@ const deriveSections = (content, previous) => {
749
744
  return changed ? out : previous;
750
745
  };
751
746
  /** A section edit that cannot preserve the canonical section contract. */
752
- var SectionViewError = class extends TaggedError("SectionViewError") {};
747
+ var SectionViewError = class extends SectionViewErrorBase {};
753
748
  const sectionFailure = (message) => Result.err(new SectionViewError({
754
749
  reason: DOCUMENT_OP_REFUSAL_REASONS.SECTION_BOUNDARY,
755
750
  message
@@ -964,8 +959,7 @@ const replaceParagraphs = ({ document, story, at, count, replacement, restoreSec
964
959
  body: nextBody
965
960
  }));
966
961
  };
967
- //#endregion
968
- //#region src/ops/offsets.ts
962
+ // src/ops/offsets.ts
969
963
  /**
970
964
  * A paragraph's logical offset space.
971
965
  *
@@ -1228,8 +1222,7 @@ const withChildren = (container, items) => {
1228
1222
  default: return container;
1229
1223
  }
1230
1224
  };
1231
- //#endregion
1232
- //#region src/ops/ids.ts
1225
+ // src/ops/ids.ts
1233
1226
  const isPlainRecord = (value) => {
1234
1227
  const prototype = Object.getPrototypeOf(value);
1235
1228
  return prototype === Object.prototype || prototype === null;
@@ -1458,8 +1451,7 @@ const reservedIdentityKeysIn = (value) => {
1458
1451
  };
1459
1452
  /** Every revision and content-control id of a package, each story walked once. */
1460
1453
  const packageIdentityKeys = (pkg) => identityKeysIn(storiesOf(pkg));
1461
- //#endregion
1462
- //#region src/ops/slots.ts
1454
+ // src/ops/slots.ts
1463
1455
  const revision$1 = (id) => ({
1464
1456
  space: IDENTITY_SPACES.REVISION,
1465
1457
  id
@@ -1555,8 +1547,7 @@ const maskIdentity = (node) => {
1555
1547
  const slots = identitySlots(node);
1556
1548
  return slots.length === 0 ? node : withInlineIdentity(node, slots.map(() => 0));
1557
1549
  };
1558
- //#endregion
1559
- //#region src/ops/leaves.ts
1550
+ // src/ops/leaves.ts
1560
1551
  /**
1561
1552
  * A paragraph's content as a sequence of leaves, and the three moves every
1562
1553
  * edit is made of: partition the leaves between gaps, find the records that
@@ -2348,8 +2339,7 @@ const rejectCopyOriginAncestorsInNodes = (nodes, removedAddedAncestors) => {
2348
2339
  };
2349
2340
  return visit(nodes, removedAddedAncestors);
2350
2341
  };
2351
- //#endregion
2352
- //#region src/ops/noteMarks.ts
2342
+ // src/ops/noteMarks.ts
2353
2343
  const noteContentWithAutomaticMark = ({ note, customMark }) => {
2354
2344
  if (customMark || note.noteType !== void 0 && note.noteType !== "normal") return note.content;
2355
2345
  const paragraphs = storyParagraphs({ content: note.content });
@@ -2387,8 +2377,7 @@ const removedNoteStories = (before, after) => {
2387
2377
  };
2388
2378
  });
2389
2379
  };
2390
- //#endregion
2391
- //#region src/ops/contract.ts
2380
+ // src/ops/contract.ts
2392
2381
  /**
2393
2382
  * The seed contract: what a document must be for operations to apply to it.
2394
2383
  *
@@ -2412,8 +2401,9 @@ const removedNoteStories = (before, after) => {
2412
2401
  * so a document an operation produced is not checked again: documents are
2413
2402
  * values, never modified in place.
2414
2403
  */
2404
+ const DocumentOpsContractErrorBase = TaggedError("DocumentOpsContractError");
2415
2405
  /** A document that does not meet the seed contract. */
2416
- var DocumentOpsContractError = class extends TaggedError("DocumentOpsContractError") {};
2406
+ var DocumentOpsContractError = class extends DocumentOpsContractErrorBase {};
2417
2407
  const holdsEmptyRecord$1 = (nodes) => nodes.some((node) => isEmptyRecord(node) || holdsEmptyRecord$1(childNodes(node) ?? []));
2418
2408
  const MULTIPLE_PROPERTY_CHANGES = /* @__PURE__ */ new WeakMap();
2419
2409
  const blocksHaveMultiplePropertyChanges = (blocks) => {
@@ -2598,8 +2588,7 @@ const normalizeForOps = (document) => {
2598
2588
  }
2599
2589
  return current;
2600
2590
  };
2601
- //#endregion
2602
- //#region src/ops/patch.ts
2591
+ // src/ops/patch.ts
2603
2592
  /**
2604
2593
  * A property set with a patch applied: a value (including explicit undefined)
2605
2594
  * sets its key, null removes it, and an absent key is untouched. The input is
@@ -2620,8 +2609,7 @@ const priorValues = (base, patch) => {
2620
2609
  for (const key of Object.keys(patch)) Reflect.set(restore, key, base !== void 0 && Object.hasOwn(base, key) ? Reflect.get(base, key) : null);
2621
2610
  return restore;
2622
2611
  };
2623
- //#endregion
2624
- //#region src/ops/comments.ts
2612
+ // src/ops/comments.ts
2625
2613
  /** Semantic comment definitions and anchors, with narrow exact-state inverses. */
2626
2614
  const fail = (op, message, reason = DOCUMENT_OP_REFUSAL_REASONS.STRUCTURE_MISMATCH) => Result.err(new DocumentOpRefusal({
2627
2615
  opType: op.type,
@@ -3359,8 +3347,7 @@ const applyCommentOp = (document, op, applyOps) => {
3359
3347
  }
3360
3348
  return edited(document, withComments(current, comments.filter(({ id }) => !ids.has(id)), comments.every(({ id }) => ids.has(id)) ? "absent" : "present"), op, ids);
3361
3349
  };
3362
- //#endregion
3363
- //#region src/ops/storyLifecycle.ts
3350
+ // src/ops/storyLifecycle.ts
3364
3351
  /** Explicit story lifecycle and section property edits, with exact JSON-safe inverses. */
3365
3352
  const refuse$5 = (op, message) => Result.err(new DocumentOpRefusal({
3366
3353
  opType: op.type,
@@ -3808,8 +3795,7 @@ const applyStoryLifecycle = (document, op) => {
3808
3795
  }
3809
3796
  return storyLifecycleEdit(document, next, op);
3810
3797
  };
3811
- //#endregion
3812
- //#region src/ops/review.ts
3798
+ // src/ops/review.ts
3813
3799
  /**
3814
3800
  * Tracked changes: how an operation carrying a {@link RevisionStamp} records
3815
3801
  * its edit instead of making it, and the pieces resolution shares with it.
@@ -4228,8 +4214,7 @@ const wrapTracked = ({ items, from, to, kind, stamp, resolutionJoin, acceptance,
4228
4214
  content: out
4229
4215
  };
4230
4216
  };
4231
- //#endregion
4232
- //#region src/ops/identity.ts
4217
+ // src/ops/identity.ts
4233
4218
  /**
4234
4219
  * How an edit keeps the ids of identified records unique (see `slots.ts`).
4235
4220
  *
@@ -4671,8 +4656,7 @@ const freshenIdentities = ({ before, after, newIds, usedElsewhere, inserted = /*
4671
4656
  id: invalid
4672
4657
  };
4673
4658
  };
4674
- //#endregion
4675
- //#region src/ops/rangeBoundaries.ts
4659
+ // src/ops/rangeBoundaries.ts
4676
4660
  /**
4677
4661
  * Range boundaries in content a resolution removes.
4678
4662
  *
@@ -5157,8 +5141,7 @@ const wellFormedRanges = ({ contents, order, relocated }) => {
5157
5141
  }
5158
5142
  return changed;
5159
5143
  };
5160
- //#endregion
5161
- //#region src/ops/blockDeletion.ts
5144
+ // src/ops/blockDeletion.ts
5162
5145
  /** Whole-paragraph deletion within one block list, including its final paragraph. */
5163
5146
  /**
5164
5147
  * One paragraph's content as its tracked deletion leaves it: every leaf
@@ -5411,8 +5394,7 @@ const deleteBlocks = ({ document, op, applyOps }) => {
5411
5394
  default: return fresh;
5412
5395
  }
5413
5396
  };
5414
- //#endregion
5415
- //#region src/ops/blockInsertion.ts
5397
+ // src/ops/blockInsertion.ts
5416
5398
  /** Paragraph insertion, isolated from the inline and table operation implementations. */
5417
5399
  const insertBlocks = ({ document, op, applyOps }) => {
5418
5400
  const refuse = (reason, message) => Result.err(new DocumentOpRefusal({
@@ -5508,8 +5490,7 @@ const insertBlocks = ({ document, op, applyOps }) => {
5508
5490
  default: return fresh;
5509
5491
  }
5510
5492
  };
5511
- //#endregion
5512
- //#region src/ops/edits.ts
5493
+ // src/ops/edits.ts
5513
5494
  const TOUCHED_STATES = [
5514
5495
  "modified",
5515
5496
  "inserted",
@@ -5553,8 +5534,7 @@ const combineEdits = (document, edits) => {
5553
5534
  }
5554
5535
  };
5555
5536
  };
5556
- //#endregion
5557
- //#region src/ops/gaps.ts
5537
+ // src/ops/gaps.ts
5558
5538
  const isHighSurrogate = (code) => code >= 55296 && code <= 56319;
5559
5539
  const isLowSurrogate = (code) => code >= 56320 && code <= 57343;
5560
5540
  const resolveGap = ({ paragraph, position, fallback }) => {
@@ -5580,8 +5560,7 @@ const resolveGap = ({ paragraph, position, fallback }) => {
5580
5560
  default: return fallback;
5581
5561
  }
5582
5562
  };
5583
- //#endregion
5584
- //#region src/ops/runMerge.ts
5563
+ // src/ops/runMerge.ts
5585
5564
  /**
5586
5565
  * Check if two TextFormatting objects are equivalent
5587
5566
  *
@@ -5755,8 +5734,7 @@ function mergeRunContent(content1, content2) {
5755
5734
  } else for (const c of content2) result.push(c);
5756
5735
  return result;
5757
5736
  }
5758
- //#endregion
5759
- //#region src/ops/inline.ts
5737
+ // src/ops/inline.ts
5760
5738
  /**
5761
5739
  * Edits over a paragraph's content in its logical offset space.
5762
5740
  *
@@ -6222,8 +6200,7 @@ const patchRunsBetween = (items, from, to, patch, whenEmpty, decorate) => {
6222
6200
  }))
6223
6201
  };
6224
6202
  };
6225
- //#endregion
6226
- //#region src/ops/numberingSections.ts
6203
+ // src/ops/numberingSections.ts
6227
6204
  const failed = (op, reason, message) => Result.err(new DocumentOpRefusal({
6228
6205
  message,
6229
6206
  reason,
@@ -6478,8 +6455,7 @@ const applyNumberingSectionOp = (document, op) => {
6478
6455
  default: return op;
6479
6456
  }
6480
6457
  };
6481
- //#endregion
6482
- //#region src/ops/packageResources.ts
6458
+ // src/ops/packageResources.ts
6483
6459
  const partOf = (present, value) => {
6484
6460
  if (!present) return { type: "omitted" };
6485
6461
  return value === void 0 ? { type: "undefined" } : {
@@ -6769,16 +6745,14 @@ const applyPackageResourcesOp = (document, op) => {
6769
6745
  }
6770
6746
  });
6771
6747
  };
6772
- //#endregion
6773
- //#region src/model/tableCellVerticalMerge.ts
6748
+ // src/model/tableCellVerticalMerge.ts
6774
6749
  const TABLE_CELL_VERTICAL_MERGES = {
6775
6750
  NONE: "none",
6776
6751
  RESTART: "restart",
6777
6752
  CONTINUE: "continue"
6778
6753
  };
6779
6754
  const tableCellVerticalMerge = (value) => value ?? TABLE_CELL_VERTICAL_MERGES.NONE;
6780
- //#endregion
6781
- //#region src/ops/tableGrid.ts
6755
+ // src/ops/tableGrid.ts
6782
6756
  /** Logical slots, including omitted cells and vertical continuation ownership. */
6783
6757
  const nonnegative = (value) => Number.isSafeInteger(value) && value >= 0;
6784
6758
  /** Each row covers one common grid; continuations exactly match the preceding span. */
@@ -6836,8 +6810,7 @@ const tableGrid = (table, opType) => {
6836
6810
  rows
6837
6811
  });
6838
6812
  };
6839
- //#endregion
6840
- //#region src/ops/tableLocation.ts
6813
+ // src/ops/tableLocation.ts
6841
6814
  /** Shared addressing for row and whole-table operations. */
6842
6815
  /** A paragraph selects its innermost table, even through block wrappers. */
6843
6816
  const locateTableRow = (document, op) => {
@@ -6871,8 +6844,7 @@ const tableRowAnchor = (rows) => storyParagraphs({ content: [{
6871
6844
  type: "table",
6872
6845
  rows: [...rows]
6873
6846
  }] }).find(({ list }) => list.filter((step) => step.kind === "tableCell").length === 1)?.paragraph.paraId;
6874
- //#endregion
6875
- //#region src/ops/resolveTableRows.ts
6847
+ // src/ops/resolveTableRows.ts
6876
6848
  /** Table-level review after inline changes, before paragraph-mark joins. */
6877
6849
  const collectTables = (blocks, out) => {
6878
6850
  for (const block of blocks) switch (block.type) {
@@ -7339,8 +7311,7 @@ const reachableOnTable = (table) => /* @__PURE__ */ new Set([
7339
7311
  ...row.cells.flatMap((cell) => [...propertyIds(cell.propertyChanges), ...cellStructuralIds(cell)])
7340
7312
  ])
7341
7313
  ]);
7342
- //#endregion
7343
- //#region src/ops/resolve.ts
7314
+ // src/ops/resolve.ts
7344
7315
  /**
7345
7316
  * `resolveRevision`: accepting or rejecting tracked changes, expanded to the
7346
7317
  * primitive operations that carry it out.
@@ -8777,8 +8748,7 @@ const resolveRevision = (document, op, applyOps) => planRevisionResolution({
8777
8748
  op,
8778
8749
  applyOps
8779
8750
  }).map(({ edit }) => edit);
8780
- //#endregion
8781
- //#region src/ops/tableEditBoundary.ts
8751
+ // src/ops/tableEditBoundary.ts
8782
8752
  /** Validate untyped table edits before reading fields or revision stamps. */
8783
8753
  const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8784
8754
  const tableSnapshot = (value) => {
@@ -8840,8 +8810,7 @@ const tableEditBoundaryRefusal = (op) => {
8840
8810
  if (ids.some((id) => !Number.isInteger(id) || id < 0 || id > 2147483647)) return fail(DOCUMENT_OP_REFUSAL_REASONS.INVALID_NEW_ID, "Revision ids must be nonnegative 31-bit integers.");
8841
8811
  if (new Set(ids).size !== ids.length) return fail(DOCUMENT_OP_REFUSAL_REASONS.ID_COLLISION, "Revision ids must be distinct within the operation.");
8842
8812
  };
8843
- //#endregion
8844
- //#region src/ops/tableEditDependencies.ts
8813
+ // src/ops/tableEditDependencies.ts
8845
8814
  /** Content removed with a cell may own records outside that cell. */
8846
8815
  const DEPENDENT_TYPES = /* @__PURE__ */ new Set([
8847
8816
  "commentRangeStart",
@@ -8875,8 +8844,7 @@ const hasTableCellDependencies = (value) => {
8875
8844
  }
8876
8845
  return false;
8877
8846
  };
8878
- //#endregion
8879
- //#region src/ops/tableTracking.ts
8847
+ // src/ops/tableTracking.ts
8880
8848
  /** Shared tracked construction for table rows and whole tables. */
8881
8849
  const refused$1 = ({ op, reason, message }) => Result.err(new DocumentOpRefusal({
8882
8850
  opType: op.type,
@@ -9174,8 +9142,7 @@ const stampedTableRevisionIds = ({ blocks, stamp, known }) => {
9174
9142
  visit(blocks);
9175
9143
  return out;
9176
9144
  };
9177
- //#endregion
9178
- //#region src/ops/tables.ts
9145
+ // src/ops/tables.ts
9179
9146
  /** Whole-table edits and their exact structural inverse. */
9180
9147
  const refuse$4 = ({ op, reason, message }) => Result.err(new DocumentOpRefusal({
9181
9148
  opType: op.type,
@@ -9563,8 +9530,7 @@ const applyTableOp = (document, op) => {
9563
9530
  default: return op;
9564
9531
  }
9565
9532
  };
9566
- //#endregion
9567
- //#region src/ops/tableEdits.ts
9533
+ // src/ops/tableEdits.ts
9568
9534
  /** Semantic grid/cell/property edits; one exact, stale-checked table inverse. */
9569
9535
  const CELL_VERTICAL_MERGES = {
9570
9536
  RESTART: "restart",
@@ -10433,8 +10399,7 @@ const applyTableEdit = (document, op) => {
10433
10399
  table: changed.value
10434
10400
  });
10435
10401
  };
10436
- //#endregion
10437
- //#region src/ops/tableRows.ts
10402
+ // src/ops/tableRows.ts
10438
10403
  /** Row edits and their exact inverse, addressed through a paragraph in the row. */
10439
10404
  const refused = ({ op, reason, message }) => Result.err(new DocumentOpRefusal({
10440
10405
  opType: op.type,
@@ -10670,8 +10635,7 @@ const applyRowOp = (document, op) => {
10670
10635
  default: return op;
10671
10636
  }
10672
10637
  };
10673
- //#endregion
10674
- //#region src/ops/apply.ts
10638
+ // src/ops/apply.ts
10675
10639
  /**
10676
10640
  * Apply a document operation and record its exact inverse.
10677
10641
  *
@@ -12216,8 +12180,7 @@ const applyDocumentOps = (document, ops) => {
12216
12180
  revisions
12217
12181
  });
12218
12182
  };
12219
- //#endregion
12220
- //#region src/ops/tocIntent.ts
12183
+ // src/ops/tocIntent.ts
12221
12184
  const refuse$1 = (message, reason = DOCUMENT_OP_REFUSAL_REASONS.UNTRACKABLE) => Result.err(new DocumentOpRefusal({
12222
12185
  message,
12223
12186
  reason,
@@ -12528,8 +12491,7 @@ const compileGenerateTOCIntent = (document, intent, mode) => {
12528
12491
  }
12529
12492
  });
12530
12493
  };
12531
- //#endregion
12532
- //#region src/ops/editorIntentCensus.ts
12494
+ // src/ops/editorIntentCensus.ts
12533
12495
  const sameFieldsExcept = (before, after, excluded) => {
12534
12496
  const beforeFields = Object.entries(before).filter(([key]) => !excluded.has(key));
12535
12497
  const afterFields = new Map(Object.entries(after).filter(([key]) => !excluded.has(key)));
@@ -12616,8 +12578,7 @@ const createCensusReader = () => {
12616
12578
  return version.census;
12617
12579
  };
12618
12580
  };
12619
- //#endregion
12620
- //#region src/ops/plan.ts
12581
+ // src/ops/plan.ts
12621
12582
  /**
12622
12583
  * Pure planning around tracked operations: how many new revision ids an
12623
12584
  * operation takes, and the operations a tracked deletion of a range is made
@@ -13152,8 +13113,7 @@ const planTrackedDeletion = (document, options) => {
13152
13113
  });
13153
13114
  return appended.isErr() ? Result.err(appended.error) : Result.ok(plan.ops);
13154
13115
  };
13155
- //#endregion
13156
- //#region src/ops/hyperlinkIntent.ts
13116
+ // src/ops/hyperlinkIntent.ts
13157
13117
  const refuse = (message, reason = DOCUMENT_OP_REFUSAL_REASONS.UNTRACKABLE) => Result.err(new DocumentOpRefusal({
13158
13118
  message,
13159
13119
  reason,
@@ -13347,8 +13307,7 @@ const compileHyperlinkIntent = (document, { intent: sourceIntent, mode, compileE
13347
13307
  selection: intent.to
13348
13308
  });
13349
13309
  };
13350
- //#endregion
13351
- //#region src/ops/rangeReplacement.ts
13310
+ // src/ops/rangeReplacement.ts
13352
13311
  /** Tracked replacement fragments share deletion's validation and physical-id pool. */
13353
13312
  /** Own inserted marks can be cancelled, moving the prefix to its next live paragraph. */
13354
13313
  const rangeStartAfterDeletion = ({ before, after, from, to }) => {
@@ -13481,8 +13440,7 @@ const planTrackedReplace = (document, options) => {
13481
13440
  }
13482
13441
  return Result.ok(plan.ops);
13483
13442
  };
13484
- //#endregion
13485
- //#region src/ops/editorIntent.ts
13443
+ // src/ops/editorIntent.ts
13486
13444
  /** One editor intent, compiled to direct or tracked document operations. */
13487
13445
  const intentEndpoints = (intent) => {
13488
13446
  switch (intent.type) {
@@ -15188,15 +15146,13 @@ const compileEditorIntent = (document, { intent, mode, firstBlockId }) => {
15188
15146
  selection
15189
15147
  });
15190
15148
  };
15191
- //#endregion
15192
- //#region src/ops/sequencing/address.ts
15149
+ // src/ops/sequencing/address.ts
15193
15150
  const DECLARED_STORIES = Object.values(OP_STORIES);
15194
15151
  /** Compare story identities without depending on their representation. */
15195
15152
  const sameStory$1 = (left, right) => structurallyEqual(left, right);
15196
15153
  /** The wire decoder accepts only stories declared by the operation contract. */
15197
15154
  const isOpStory = (value) => DECLARED_STORIES.some((story) => structurallyEqual(story, value));
15198
- //#endregion
15199
- //#region src/ops/sequencing/envelope.ts
15155
+ // src/ops/sequencing/envelope.ts
15200
15156
  /** An operation with no position or structural effect. */
15201
15157
  const NO_SEQUENCED_EFFECT = "none";
15202
15158
  const BATCH_REJECTION_REASONS = {
@@ -15208,7 +15164,8 @@ const BATCH_REJECTION_REASONS = {
15208
15164
  INVALID_OPERATION: "invalidOperation",
15209
15165
  TABLE_REQUIRES_EXCLUSIVE_EDIT: "tableRequiresExclusiveEdit"
15210
15166
  };
15211
- var BatchRejection = class extends TaggedError("BatchRejection") {};
15167
+ const BatchRejectionBase = TaggedError("BatchRejection");
15168
+ var BatchRejection = class extends BatchRejectionBase {};
15212
15169
  /** Table edits and their structural inverses require exclusive editing until transforms exist. */
15213
15170
  const TABLE_EXCLUSIVE_OP_TYPES = {
15214
15171
  insertTable: true,
@@ -15685,8 +15642,7 @@ const parseDocumentBatch = (json) => {
15685
15642
  }));
15686
15643
  return validateDocumentBatch(parsed.value);
15687
15644
  };
15688
- //#endregion
15689
- //#region src/ops/sequencing/transform.ts
15645
+ // src/ops/sequencing/transform.ts
15690
15646
  const operationStory = (op) => {
15691
15647
  switch (op.type) {
15692
15648
  case DOCUMENT_OP_TYPES.INSERT_TEXT:
@@ -16040,8 +15996,7 @@ const transformBatch = (batch, over, options = {}) => {
16040
15996
  ops: captured
16041
15997
  });
16042
15998
  };
16043
- //#endregion
16044
- //#region src/ops/sequencing/applyBatch.ts
15999
+ // src/ops/sequencing/applyBatch.ts
16045
16000
  const TOUCHED_BLOCKS_EFFECT = "touchedBlocks";
16046
16001
  /** Capture position facts before each operation, including within an atomic batch. */
16047
16002
  const applyBatch = (document, ops) => {
@@ -16087,8 +16042,7 @@ const applyBatch = (document, ops) => {
16087
16042
  effects
16088
16043
  });
16089
16044
  };
16090
- //#endregion
16091
- //#region src/ops/sequencing/sequencer.ts
16045
+ // src/ops/sequencing/sequencer.ts
16092
16046
  const SUBMISSION_TYPES = {
16093
16047
  ACK: "ack",
16094
16048
  REJECT: "reject"
@@ -16176,8 +16130,7 @@ const createSequencer = (document) => {
16176
16130
  }
16177
16131
  };
16178
16132
  };
16179
- //#endregion
16180
- //#region src/ops/sequencing/client.ts
16133
+ // src/ops/sequencing/client.ts
16181
16134
  const PENDING_STATUSES = {
16182
16135
  QUEUED: "queued",
16183
16136
  SUBMITTED: "submitted",
@@ -16460,8 +16413,7 @@ const createClient = (document) => {
16460
16413
  }
16461
16414
  };
16462
16415
  };
16463
- //#endregion
16464
- //#region src/ops/batchOrder.ts
16416
+ // src/ops/batchOrder.ts
16465
16417
  const PHASE = {
16466
16418
  annotation: 0,
16467
16419
  content: 1,
@@ -16528,5 +16480,4 @@ const groupInsertionRuns = (operations, insertionPositionOf, keepsGap = () => fa
16528
16480
  }
16529
16481
  return groups;
16530
16482
  };
16531
- //#endregion
16532
16483
  export { BATCH_REJECTION_REASONS, BATCH_WIRE_OP_TYPES, BatchRejection, DOCUMENT_OP_REFUSAL_REASONS, DOCUMENT_OP_SCHEMA_VERSION, DOCUMENT_OP_TYPES, DocumentOpRefusal, DocumentOpsContractError, EMPTY_PROPERTY_SETS, INHERIT_RUN_PROPS, MAX_BATCH_WIRE_BYTES, OBJECT_REPLACEMENT_CHARACTER, OP_STORIES, PARAGRAPH_MARK_FORMATTING_KEYS, PROPERTY_REVIEW_POLICIES, REVISION_DECISIONS, SPLIT_HALVES, acceptCopyOriginAncestors, addCopyOriginAncestor, allocateCommentAnchorIds, applyDocumentOp, applyDocumentOpEnvelope, applyDocumentOps, captureDocumentOp, combineEdits, commentDocumentIssue, compareBatchOrder, compareGaps, compileEditorIntent, contentRank, createClient, createEditorIntentIdAllocator, createSequencer, defaultInsertionGap, documentStories, editorParagraphGroups, editorPositionAtPhysicalPosition, findStoryBody, formattingEquals, freshCommentId, groupInsertionRuns, idKey, inlineLeafSpans, isCommentAnchorCarrierType, isCommentExhausted, isCopyOriginAncestors, isTextOnlyRun, mapTocBookmarkPosition, mergeRunContent, normalizeForOps, noteUsesCustomMark, orderBatchOperations, packageParagraphIds, packageResourcesOpOf, paragraphContentVerdict, paragraphIdsIn, paragraphLength, paragraphLogicalText, paragraphMarkOutcome, paragraphRemains, paragraphVisibleText, parseDocumentBatch, physicalOffsetAtVisibleOffset, physicalPositionAtEditorOffset, planTrackedDeletion, planTrackedReplace, planWellFormedRanges, reconcileDocumentPartRelationships, registerParagraphPropertySnapshot, rejectCopyOriginAncestors, revisionIdDemand, runsMergeable, sameStory, sectionPropertiesAt, shiftCopyOriginAncestors, storyBody, survivingComments, toOpEnvelope, transformBatch, validateDocumentBatch, validateOpsDocument, validateSequencedBatch, withBodyContent, withoutCommentThreads, zeroWidthLeavesAt };
@@ -1,4 +1,3 @@
1
- //#region src/model/preservedMarkup.d.ts
2
1
  /**
3
2
  * The ordered verbatim sink: where a container's unmodelled markup goes.
4
3
  *
@@ -64,5 +63,4 @@ type PreservedAttribute = {
64
63
  name: string;
65
64
  value: string;
66
65
  };
67
- //#endregion
68
66
  export { PreservedChild as n, PreservedMarkup as r, PreservedAttribute as t };
@@ -1,4 +1,4 @@
1
- //#region src/generated/docx_kernel.d.ts
1
+ import { TaggedErrorClass } from "better-result";
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
4
  type DocxProjectionFormattingSpan = readonly [startUtf16: number, endUtf16: number, style: "bold" | "highlight" | "superscript"];
@@ -43,15 +43,13 @@ type DocxReviewFactsWire = readonly [schemaVersion: 2, revisions: DocxReviewFact
43
43
  /** Fused package wire schema. A new tuple layout requires a schema-version bump. */
44
44
  type DocxPackageProjectionWire = readonly [schemaVersion: 2, document: DocxProjectionWire, reviewFacts: DocxReviewFactsWire];
45
45
  type DocxProjectionContainer = "body" | "tableCell";
46
- //#endregion
47
- //#region src/projection.d.ts
48
- declare const DocxProjectionInitializationError_base: import("better-result").TaggedErrorClass<"DocxProjectionInitializationError">;
49
- export declare class DocxProjectionInitializationError extends DocxProjectionInitializationError_base<{
46
+ declare const DocxProjectionInitializationErrorBase: TaggedErrorClass<"DocxProjectionInitializationError">;
47
+ export declare class DocxProjectionInitializationError extends DocxProjectionInitializationErrorBase<{
50
48
  message: string;
51
49
  cause: unknown;
52
50
  }> {}
53
- declare const DocxProjectionError_base: import("better-result").TaggedErrorClass<"DocxProjectionError">;
54
- export declare class DocxProjectionError extends DocxProjectionError_base<{
51
+ declare const DocxProjectionErrorBase: TaggedErrorClass<"DocxProjectionError">;
52
+ export declare class DocxProjectionError extends DocxProjectionErrorBase<{
55
53
  message: string;
56
54
  cause: unknown;
57
55
  }> {}
@@ -83,5 +81,4 @@ export declare const projectParagraphFragment: (bytes: Uint8Array) => Promise<Do
83
81
  * fact families rather than invalidating the document snapshot.
84
82
  */
85
83
  export declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array, { textMaterialization }?: ProjectCompressedDocxWithReviewFactsOptions) => Promise<DocxPackageProjectionWire>;
86
- //#endregion
87
84
  export type { DocxAttributedComment, DocxAttributedRevision, DocxPackageProjectionWire, DocxParagraphFragmentWire, DocxProjectionAlignment, DocxProjectionAlignmentSource, DocxProjectionAlignmentValue, DocxProjectionBookmarkFact, DocxProjectionContainer, DocxProjectionFactSet, DocxProjectionFormattingCompleteness, DocxProjectionFormattingFamily, DocxProjectionFormattingFamilyStatus, DocxProjectionFormattingSpan, DocxProjectionFormattingUnknownReason, DocxProjectionIndentationFact, DocxProjectionNumberingFact, DocxProjectionOutlineLevelFact, DocxProjectionParagraph, DocxProjectionReferenceFact, DocxProjectionRevisionStatus, DocxProjectionRevisionUnsupportedReason, DocxProjectionStructuralFacts, DocxProjectionStructuralSpan, DocxProjectionStructure, DocxProjectionUnknownReason, DocxProjectionWire, DocxReviewFactSet, DocxReviewFactsWire, DocxReviewUnknownReason, DocxRevisionKind };
@@ -1,5 +1,5 @@
1
1
  import { TaggedError } from "better-result";
2
- //#region src/generated/docx_kernel.js
2
+ // src/generated/docx_kernel.js
3
3
  /**
4
4
  * The version used by the document projection serializer.
5
5
  * @returns {number}
@@ -289,10 +289,11 @@ async function __wbg_init(module_or_path) {
289
289
  const { instance, module } = await __wbg_load(await module_or_path, imports);
290
290
  return __wbg_finalize_init(instance, module);
291
291
  }
292
- //#endregion
293
- //#region src/projection.ts
294
- var DocxProjectionInitializationError = class extends TaggedError("DocxProjectionInitializationError") {};
295
- var DocxProjectionError = class extends TaggedError("DocxProjectionError") {};
292
+ // src/projection.ts
293
+ const DocxProjectionInitializationErrorBase = TaggedError("DocxProjectionInitializationError");
294
+ var DocxProjectionInitializationError = class extends DocxProjectionInitializationErrorBase {};
295
+ const DocxProjectionErrorBase = TaggedError("DocxProjectionError");
296
+ var DocxProjectionError = class extends DocxProjectionErrorBase {};
296
297
  let initialization;
297
298
  const DOCUMENT_PROJECTION_FAILURE_MESSAGE = "Could not project the DOCX document";
298
299
  const PACKAGE_PROJECTION_FAILURE_MESSAGE = "Could not project the DOCX package with review facts";
@@ -355,5 +356,4 @@ const projectCompressedDocxWithReviewFacts = (bytes, { textMaterialization = "wo
355
356
  project: textMaterialization === "word-host" ? projectCompressedDocxWithReviewFacts$1 : projectCompressedDocxWithReadableReviewFacts,
356
357
  message: PACKAGE_PROJECTION_FAILURE_MESSAGE
357
358
  });
358
- //#endregion
359
359
  export { DocxProjectionError, DocxProjectionInitializationError, docxProjectionSchemaVersion, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts, projectMainDocumentXml, projectParagraphFragment };
@@ -1,5 +1,4 @@
1
- import { r as PreservedMarkup } from "../preservedMarkup-G8XjWhs2.js";
2
- //#region src/schema/sequenceChildren.gen.d.ts
1
+ import { r as PreservedMarkup } from "../preservedMarkup-9L4lbGnE.js";
3
2
  /**
4
3
  * GENERATED FILE — do not edit.
5
4
  *
@@ -37,8 +36,6 @@ export declare const SETTINGS_CHILDREN: readonly ["writeProtection", "view", "zo
37
36
  type SequenceContainer = keyof typeof SEQUENCE_CHILDREN;
38
37
  /** Every child the schema declares for `Container`, in declaration order. */
39
38
  type SequenceChild<Container extends SequenceContainer> = (typeof SEQUENCE_CHILDREN)[Container][number];
40
- //#endregion
41
- //#region src/schema/sequenceChildren.d.ts
42
39
  type SerializeSequenceChildrenOptions<Container extends SequenceContainer> = {
43
40
  container: Container;
44
41
  /**
@@ -70,5 +67,4 @@ export declare const assertSafePreservedMarkup: (preserved: PreservedMarkup | un
70
67
  * it. The sort is stable and the modelled child leads.
71
68
  */
72
69
  export declare const serializeSequenceChildren: <Container extends SequenceContainer>({ container, modelled, preserved }: SerializeSequenceChildrenOptions<Container>) => string[];
73
- //#endregion
74
70
  export type { SequenceChild, SequenceContainer };
@@ -1 +1 @@
1
- export { a as SEQUENCE_CHILDREN, o as SETTINGS_CHILDREN, t as assertSafePreservedMarkup, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, i as serializeSequenceChildren } from "../sequenceChildren-ByDxvF4j.js";
1
+ export { a as SEQUENCE_CHILDREN, o as SETTINGS_CHILDREN, t as assertSafePreservedMarkup, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, i as serializeSequenceChildren } from "../sequenceChildren-CrMcryEF.js";