@docx-editor.dev/core 2.6.1 → 2.8.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.
- package/dist/automation.cjs +1 -1
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +8 -7
- package/dist/binding.d.ts +8 -7
- package/dist/binding.js +1 -1
- package/dist/chunk-2WIXJ7CW.js +10 -0
- package/dist/chunk-42PRWWVE.js +2 -0
- package/dist/chunk-5XKD3VFP.js +18 -0
- package/dist/{chunk-SFMAIFEN.cjs → chunk-HCSWWXS2.cjs} +2 -2
- package/dist/chunk-HTJLSGBH.cjs +18 -0
- package/dist/chunk-JEHWQPXS.cjs +1 -0
- package/dist/chunk-KCJLRAKT.js +5 -0
- package/dist/chunk-KTL3UMPK.js +2 -0
- package/dist/chunk-M6ZIVJUA.cjs +2 -0
- package/dist/chunk-NU57YOQE.js +15 -0
- package/dist/chunk-RUS2YBWU.cjs +10 -0
- package/dist/chunk-TJEWP7MX.cjs +15 -0
- package/dist/chunk-UGUPVZDY.cjs +5 -0
- package/dist/chunk-XJRMFS6O.js +1 -0
- package/dist/chunk-XN634HAC.js +2 -0
- package/dist/chunk-XRDTD4X3.cjs +2 -0
- package/dist/contracts/document.d.cts +25 -3
- package/dist/contracts/document.d.ts +25 -3
- package/dist/contracts/editor.d.cts +7 -7
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.cts +6 -6
- package/dist/contracts/interaction.d.ts +6 -6
- package/dist/contracts/modules.d.cts +4 -3
- package/dist/contracts/modules.d.ts +4 -3
- package/dist/contracts/types.d.cts +110 -2
- package/dist/contracts/types.d.ts +110 -2
- package/dist/{custom-node-writes-tJw8U9MO.d.ts → custom-node-writes-BdVl-LAC.d.ts} +19 -10
- package/dist/{custom-node-writes-D9G3GKQ7.d.cts → custom-node-writes-Bu8JIqfA.d.cts} +19 -10
- package/dist/{editor-BZEJL3vv.d.cts → editor-CWlj33GH.d.cts} +80 -69
- package/dist/{editor-D2zOJztO.d.ts → editor-D52SD4jG.d.ts} +80 -69
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.cts +63 -31
- package/dist/editor.d.ts +63 -31
- package/dist/editor.js +1 -1
- package/dist/{image-resources-BaHz4QAd.d.cts → image-resources-BveffuKp.d.cts} +1 -1
- package/dist/{image-resources-Cl5_cNi9.d.ts → image-resources-D63k8w5f.d.ts} +1 -1
- package/dist/{index-_xF7n_z0.d.cts → index-39yzaZO_.d.cts} +1573 -1429
- package/dist/{index-D8L8WrNF.d.ts → index-ZuqIj0b9.d.ts} +1573 -1429
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +220 -23
- package/dist/layout.d.ts +220 -23
- package/dist/layout.js +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -5
- package/dist/output.d.ts +6 -5
- package/dist/output.js +1 -1
- package/dist/{review-reads-HDvoQXK2.d.ts → review-reads-B_pXe43J.d.ts} +1 -1
- package/dist/{review-reads-Dr0CpW6u.d.cts → review-reads-Bn7aZU4u.d.cts} +1 -1
- package/dist/{review-support-D4ZBdUXa.d.ts → review-support--I4ChuzF.d.ts} +1 -1
- package/dist/{review-support-T-riLz4Y.d.cts → review-support-CG7aVSPh.d.cts} +1 -1
- package/dist/{semantic-cell-selection-BTQFpN0S.d.cts → semantic-cell-selection-C45Gn4K-.d.cts} +14 -2
- package/dist/{semantic-cell-selection-B5vfPz4Q.d.ts → semantic-cell-selection-I-uAmi0q.d.ts} +14 -2
- package/dist/{semantic-interaction-CDNEU_Tx.d.cts → semantic-interaction-Bu_3IPaV.d.ts} +14 -2
- package/dist/{semantic-interaction-lvpzZRpA.d.ts → semantic-interaction-DVUqu_47.d.cts} +14 -2
- package/dist/{semantic-paint-BBPL3u5w.d.ts → semantic-paint-BKiiDJol.d.ts} +8 -2
- package/dist/{semantic-paint-IjbL-4CT.d.cts → semantic-paint-COQY0Lnq.d.cts} +8 -2
- package/dist/{semantic-records-CdQvpUj1.d.ts → semantic-records-DHcMZM2-.d.ts} +35 -36
- package/dist/{semantic-records-DEOs3_tE.d.cts → semantic-records-rAKWaD-1.d.cts} +35 -36
- package/dist/{shaped-measurer-C2SJAjV0.d.cts → shaped-measurer-BRL__nm2.d.cts} +1 -1
- package/dist/{shaped-measurer-l4o5ITJ0.d.ts → shaped-measurer-Cw45Nu5R.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +55 -9
- package/dist/store.d.ts +55 -9
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-CUCwPWjT.d.cts → tree-op-types-A-SLSKzK.d.cts} +62 -9
- package/dist/{tree-op-types-D0fTNBVW.d.ts → tree-op-types-BbzrA-kg.d.ts} +62 -9
- package/dist/{tree-session-b7bggR-S.d.cts → tree-session-C2NsEgfW.d.cts} +41 -6
- package/dist/{tree-session-CH1oA75f.d.ts → tree-session-DeNJa86l.d.ts} +41 -6
- package/dist/{tree-store-CIKASRHk.d.ts → tree-store-CKswbQl3.d.ts} +13 -1
- package/dist/{tree-store-BqgeCa1Q.d.cts → tree-store-Dob9Us6Y.d.cts} +13 -1
- package/package.json +2 -2
- package/dist/chunk-4GQXAXTZ.js +0 -5
- package/dist/chunk-DGUHCJPF.cjs +0 -18
- package/dist/chunk-DY3QVCWC.cjs +0 -10
- package/dist/chunk-E7BXJ4BF.js +0 -1
- package/dist/chunk-F7Z6PWAZ.cjs +0 -2
- package/dist/chunk-IJ4V3LGV.cjs +0 -2
- package/dist/chunk-JEMP5YI5.cjs +0 -15
- package/dist/chunk-JZXK4DKV.cjs +0 -1
- package/dist/chunk-NIGGABAA.js +0 -15
- package/dist/chunk-OPKOTVQQ.js +0 -18
- package/dist/chunk-R75OLPL6.js +0 -10
- package/dist/chunk-SKWYEZCO.cjs +0 -5
- package/dist/chunk-SMRD66T5.js +0 -2
- package/dist/chunk-UVIUNAQ6.js +0 -2
- package/dist/chunk-WAVN7MAT.js +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ParagraphTabStop } from './contracts/types.js';
|
|
1
2
|
import { O as OoxmlNode, a as OoxmlElement, o as OoxmlDrawingNode, b as OoxmlContentControlNode, d as OoxmlContentControlContentNode, p as OoxmlContentControlEndPropertiesNode, q as OoxmlContentControlPropertiesNode, e as OoxmlPart } from './ooxml-tree-BU0e3DVi.js';
|
|
2
3
|
|
|
3
4
|
/** The relationship namespace `r:id` lives in. */
|
|
@@ -562,7 +563,14 @@ type ContentControlValueInput = {
|
|
|
562
563
|
};
|
|
563
564
|
/** The control types an insertion may author. Picture and repeating section are deferred. */
|
|
564
565
|
declare const INSERTABLE_CONTENT_CONTROL_TYPES: readonly ["richText", "plainText", "dropDownList", "comboBox", "date"];
|
|
565
|
-
|
|
566
|
+
/**
|
|
567
|
+
* The OOXML spellings the store writes.
|
|
568
|
+
*
|
|
569
|
+
* NOT the contract's `InsertableContentControlType`, which is the same set of kinds in the
|
|
570
|
+
* READ vocabulary (`dropdown`) plus this lane's spelling of it (`dropDownList`). The editor
|
|
571
|
+
* maps between the two; the names differ so a reader can tell which vocabulary a value is in.
|
|
572
|
+
*/
|
|
573
|
+
type InsertableContentControlKind = (typeof INSERTABLE_CONTENT_CONTROL_TYPES)[number];
|
|
566
574
|
|
|
567
575
|
/** Allowlisted OOXML table border line styles — store/layout authority. */
|
|
568
576
|
declare const TABLE_BORDER_STYLES: readonly ["single", "dashed", "dotted", "double", "triple", "thick"];
|
|
@@ -618,16 +626,21 @@ interface TableBorderSpecInput {
|
|
|
618
626
|
*/
|
|
619
627
|
declare const ACCEPTED_RUN_PROPERTIES: readonly ["rFonts", "sz", "szCs", "color", "b", "bCs", "i", "iCs", "u", "strike", "dstrike", "highlight", "vertAlign", "position", "caps", "smallCaps", "spacing", "w", "kern"];
|
|
620
628
|
/** The accepted PARAGRAPH property boundary (design D8). */
|
|
621
|
-
declare const ACCEPTED_PARAGRAPH_PROPERTIES: readonly ["pStyle", "jc", "spacing", "ind", "tabs", "numPr", "keepNext", "keepLines", "widowControl", "pageBreakBefore", "shd"];
|
|
629
|
+
declare const ACCEPTED_PARAGRAPH_PROPERTIES: readonly ["pStyle", "jc", "spacing", "ind", "tabs", "numPr", "keepNext", "keepLines", "widowControl", "pageBreakBefore", "contextualSpacing", "shd"];
|
|
630
|
+
/**
|
|
631
|
+
* One tab stop an op can author: where it sits, how it aligns, and what fills the gap.
|
|
632
|
+
*
|
|
633
|
+
* An alias, not a second declaration. The contract lane already names this shape, and two
|
|
634
|
+
* public names for one shape is a trap — a caller building a stop for a read and for an op
|
|
635
|
+
* would otherwise have to name it two things.
|
|
636
|
+
*/
|
|
637
|
+
type TabStopWrite = ParagraphTabStop;
|
|
622
638
|
/**
|
|
623
639
|
* One authored property: an element name plus its `w:`-namespace attributes.
|
|
624
640
|
*
|
|
625
641
|
* Modeled as name+attributes rather than a typed record per property because that is what
|
|
626
642
|
* the tree holds, so an op maps to nodes without a lossy intermediate vocabulary. Attribute
|
|
627
643
|
* VALUES are validated as XML text; their meaning is the resolver's business.
|
|
628
|
-
*/
|
|
629
|
-
/**
|
|
630
|
-
* One property an op writes, as a name plus attributes.
|
|
631
644
|
*
|
|
632
645
|
* Deliberately structural rather than a typed union: the accepted property lists bound WHICH
|
|
633
646
|
* properties may be written, so the shape itself does not need to enumerate them.
|
|
@@ -845,6 +858,29 @@ type TreeDocOp = {
|
|
|
845
858
|
readonly paragraphId: string;
|
|
846
859
|
readonly numId: string | null;
|
|
847
860
|
readonly level?: number;
|
|
861
|
+
} | {
|
|
862
|
+
/**
|
|
863
|
+
* Replace a paragraph's custom tab stops, or clear them with an empty list.
|
|
864
|
+
*
|
|
865
|
+
* Its OWN op rather than a `w:tabs` entry in `setParagraphProperties`, because
|
|
866
|
+
* `OoxmlProperty` is flat and `w:tabs` carries its meaning in `w:tab` children — the
|
|
867
|
+
* same reason `setListNumbering` exists for `w:numPr`.
|
|
868
|
+
*/
|
|
869
|
+
readonly op: 'setParagraphTabStops';
|
|
870
|
+
readonly paragraphId: string;
|
|
871
|
+
readonly stops: readonly TabStopWrite[];
|
|
872
|
+
/**
|
|
873
|
+
* Every stop position IN FORCE when the editor read the paragraph, including the
|
|
874
|
+
* ones a style supplied.
|
|
875
|
+
*
|
|
876
|
+
* Tab stops are read through the cascade and written at the paragraph level, so a
|
|
877
|
+
* replace alone cannot remove an inherited stop — the user clears a row, the style
|
|
878
|
+
* puts it straight back, and the command reports success. A position that was in
|
|
879
|
+
* force and is not in `stops` is suppressed with `w:val="clear"`, which is what the
|
|
880
|
+
* value exists for (§17.3.1.37). Omit when the caller has no cascade to speak of;
|
|
881
|
+
* the write is then a plain paragraph-level replace.
|
|
882
|
+
*/
|
|
883
|
+
readonly inForcePositionsTwips?: readonly number[];
|
|
848
884
|
} | {
|
|
849
885
|
readonly op: 'splitParagraph';
|
|
850
886
|
readonly paragraphId: string;
|
|
@@ -866,6 +902,14 @@ type TreeDocOp = {
|
|
|
866
902
|
* offset produces an empty paragraph between the two boundaries — a blank line.
|
|
867
903
|
*/
|
|
868
904
|
readonly offsets: readonly number[];
|
|
905
|
+
/**
|
|
906
|
+
* Propose the breaks rather than making them, exactly as the single split does.
|
|
907
|
+
*
|
|
908
|
+
* Every boundary is a paragraph mark this author is adding, so each paragraph that
|
|
909
|
+
* PRECEDES one carries `w:rPr/w:ins`. Without it a multi-line paste in suggesting mode
|
|
910
|
+
* tracked its text and not its breaks, and Reject left the extra paragraphs standing.
|
|
911
|
+
*/
|
|
912
|
+
readonly revision?: RevisionAttributionInput;
|
|
869
913
|
} | {
|
|
870
914
|
readonly op: 'joinParagraphs';
|
|
871
915
|
readonly firstId: string;
|
|
@@ -1253,7 +1297,7 @@ type TreeDocOp = {
|
|
|
1253
1297
|
readonly paragraphId: string;
|
|
1254
1298
|
readonly start: number;
|
|
1255
1299
|
readonly end: number;
|
|
1256
|
-
readonly type:
|
|
1300
|
+
readonly type: InsertableContentControlKind;
|
|
1257
1301
|
readonly tag?: string;
|
|
1258
1302
|
readonly alias?: string;
|
|
1259
1303
|
readonly lock?: ContentControlLock;
|
|
@@ -1362,7 +1406,7 @@ type DrawingTreeDocOp = Extract<TreeDocOp, {
|
|
|
1362
1406
|
/** Just the `op` discriminants, for dispatch tables and validation. */
|
|
1363
1407
|
type TreeDocOpKind = TreeDocOp['op'];
|
|
1364
1408
|
/** Every {@link TreeDocOpKind}, for validation and exhaustiveness checks. */
|
|
1365
|
-
declare const TREE_DOC_OP_KINDS: readonly ["insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setListLevel", "setListNumbering", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers"];
|
|
1409
|
+
declare const TREE_DOC_OP_KINDS: readonly ["insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setListLevel", "setListNumbering", "setParagraphTabStops", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers"];
|
|
1366
1410
|
/**
|
|
1367
1411
|
* How far a committed op can reach, so layout can scope its work (task 5.2).
|
|
1368
1412
|
*
|
|
@@ -1413,7 +1457,16 @@ interface TreeOpEffect {
|
|
|
1413
1457
|
* `not-adjacent-siblings` is the notable one: a join across table cells is refused rather than
|
|
1414
1458
|
* silently merging content out of the cell that owned it.
|
|
1415
1459
|
*/
|
|
1416
|
-
type TreeOpRejection = 'unknown-op' | 'unknown-paragraph' | 'not-a-paragraph' | 'offset-out-of-range' | 'invalid-range' | 'not-a-list-paragraph' | 'splits-surrogate-pair' | 'invalid-text' | 'unsupported-property' | 'invalid-property-value' | 'not-adjacent-siblings'
|
|
1460
|
+
type TreeOpRejection = 'unknown-op' | 'unknown-paragraph' | 'not-a-paragraph' | 'offset-out-of-range' | 'invalid-range' | 'not-a-list-paragraph' | 'splits-surrogate-pair' | 'invalid-text' | 'unsupported-property' | 'invalid-property-value' | 'not-adjacent-siblings'
|
|
1461
|
+
/**
|
|
1462
|
+
* The addressed position is strictly inside content nothing can divide: a hyperlink, an
|
|
1463
|
+
* inline content control, a revision wrapper, or an atomic field.
|
|
1464
|
+
*
|
|
1465
|
+
* Distinct from `invalid-range`, which is an offset the paragraph does not have. This one is
|
|
1466
|
+
* a real offset that is not a PLACE — refused rather than resolved to the nearest one, so a
|
|
1467
|
+
* caller learns the node would not have landed where they asked.
|
|
1468
|
+
*/
|
|
1469
|
+
| 'indivisible-content' | 'unknown-block' | 'not-a-block' | 'block-required' | 'carries-section-mark'
|
|
1417
1470
|
/** The transaction named a part the package does not hold. */
|
|
1418
1471
|
| 'unknown-part'
|
|
1419
1472
|
/**
|
|
@@ -1488,4 +1541,4 @@ type TreeOpResult = {
|
|
|
1488
1541
|
readonly detail?: string;
|
|
1489
1542
|
};
|
|
1490
1543
|
|
|
1491
|
-
export {
|
|
1544
|
+
export { contentControlPropertiesOf as $, ACCEPTED_PARAGRAPH_PROPERTIES as A, type HyperlinkKind as B, type ContentControlKind as C, type DrawingProjection as D, type HyperlinkTarget as E, MAX_CONTENT_CONTROL_NESTING as F, OFFICE_RELATIONSHIP_NAMESPACE_URI as G, HYPERLINK_RELATIONSHIP_TYPE as H, type ImpactClass as I, type RelationshipTargetResolver as J, TABLE_BORDER_STYLES as K, TREE_DOC_OP_KINDS as L, MAX_CONTENT_CONTROLS_PER_PART as M, type TabStopWrite as N, type OoxmlProperty as O, type TreeDocOpKind as P, type TreeOpEffect as Q, type RevisionAddress as R, type SourceCrop as S, type TreeDocOp as T, allocateContentControlId as U, type VectorShapeProjection as V, contentControlContentChildren as W, contentControlContentNodeOf as X, contentControlEndPropertiesNodeOf as Y, contentControlLevelOf as Z, contentControlPropertiesNodeOf as _, type TreeOpRejection as a, contentControlTextOf as a0, contentControlsIn as a1, findContentControl as a2, flattenContentControls as a3, hyperlinkAnchorOf as a4, hyperlinkRelationshipIdOf as a5, hyperlinkTargetOf as a6, isContentControlContentNode as a7, isContentControlNode as a8, isContentControlWrapper as a9, isHyperlinkNode as aa, lockForbidsEdit as ab, lockForbidsRemoval as ac, orderedContentControlProperties as ad, parseContentControlId as ae, projectDrawing as af, resolveContentControlLock as ag, type ImageWrapTarget as b, type DrawingKind as c, type DrawingPositionInput as d, type DrawingLocks as e, type DrawingHorizontalReferenceFrame as f, type DrawingVerticalReferenceFrame as g, type DrawingTreeDocOp as h, type DrawingAccessibility as i, type DrawingTransform as j, type TableBorderStyle as k, type TreeDocColorValue as l, IMAGE_WRAP_TARGETS as m, type ContentControlLevel as n, type ContentControlLock as o, type ContentControlDataBinding as p, type TreeOpResult as q, ACCEPTED_RUN_PROPERTIES as r, CONTENT_CONTROL_ID_MAX as s, CONTENT_CONTROL_PROPERTY_ORDER as t, type ContentControlCheckbox as u, type ContentControlCheckboxState as v, type ContentControlDateFormat as w, type ContentControlEntry as x, type ContentControlListItem as y, type ContentControlProperties as z };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as SupportedImageMime, b as ImageDecodePort } from './image-resources-
|
|
2
|
-
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput } from './custom-node-writes-
|
|
1
|
+
import { S as SupportedImageMime, b as ImageDecodePort } from './image-resources-BveffuKp.cjs';
|
|
2
|
+
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput } from './custom-node-writes-Bu8JIqfA.cjs';
|
|
3
3
|
import { Node } from 'prosemirror-model';
|
|
4
|
-
import { a as ReviewItem } from './review-support-
|
|
4
|
+
import { a as ReviewItem } from './review-support-CG7aVSPh.cjs';
|
|
5
5
|
import { ReviewModuleContribution } from './contracts/modules.cjs';
|
|
6
6
|
import { e as OoxmlPart, O as OoxmlNode, a as OoxmlElement } from './ooxml-tree-BU0e3DVi.cjs';
|
|
7
7
|
import { O as OoxmlPackage, b as OoxmlPackageRejection } from './ooxml-package-CR5us6ad.cjs';
|
|
8
8
|
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-CgEOSw3i.cjs';
|
|
9
|
-
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-
|
|
10
|
-
import { T as TreeDocOp } from './tree-op-types-
|
|
9
|
+
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-Dob9Us6Y.cjs';
|
|
10
|
+
import { T as TreeDocOp } from './tree-op-types-A-SLSKzK.cjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -178,10 +178,36 @@ interface RunPropertyLike {
|
|
|
178
178
|
interface ParagraphAnchorIndex {
|
|
179
179
|
/** nodeId → `w14:paraId`, verbatim as authored/minted. Paragraphs without one are absent. */
|
|
180
180
|
readonly paraIdByNode: ReadonlyMap<string, string>;
|
|
181
|
-
/** UPPERCASED paraId → nodeId (matching is case-insensitive).
|
|
181
|
+
/** UPPERCASED paraId → nodeId (matching is case-insensitive). The first story to claim it. */
|
|
182
182
|
readonly nodeByParaId: ReadonlyMap<string, string>;
|
|
183
183
|
/** nodeId → reading-order ordinal, for document-ordering DocRange endpoints. */
|
|
184
184
|
readonly ordinalByNode: ReadonlyMap<string, number>;
|
|
185
|
+
/**
|
|
186
|
+
* UPPERCASED paraIds more than one story claims.
|
|
187
|
+
*
|
|
188
|
+
* Minting is unique per PART and the contract's uniqueness is per DOCUMENT, so an authored
|
|
189
|
+
* file may repeat one. Resolving such an anchor to whichever story came first would be a
|
|
190
|
+
* silent wrong answer; it is refused as ambiguous instead.
|
|
191
|
+
*/
|
|
192
|
+
readonly ambiguousParaIds: ReadonlySet<string>;
|
|
193
|
+
/**
|
|
194
|
+
* nodeId → the part it was indexed from.
|
|
195
|
+
*
|
|
196
|
+
* The index spans every story, so a caller holding one part and a node id from another reads
|
|
197
|
+
* an empty paragraph and draws a false conclusion from it. Carrying the part alongside the id
|
|
198
|
+
* is what keeps the two in step.
|
|
199
|
+
*/
|
|
200
|
+
readonly partByNode: ReadonlyMap<string, OoxmlPart>;
|
|
201
|
+
/**
|
|
202
|
+
* Every node claiming an ambiguous paraId. DIAGNOSTIC, never a way to pick one.
|
|
203
|
+
*
|
|
204
|
+
* Resolution refuses a clash outright, and this is what says which paragraphs caused it, for
|
|
205
|
+
* a reader repairing the file. Preferring one claimant by the caller's part was tried and
|
|
206
|
+
* reverted: every resolver call site passes the MAIN part, so the preference could only ever
|
|
207
|
+
* land on the body twin and answer `ok` for a header paragraph the caller meant. See
|
|
208
|
+
* `resolveDocAnchor` in `editor/anchor-resolution.ts`.
|
|
209
|
+
*/
|
|
210
|
+
readonly claimantsByParaId: ReadonlyMap<string, readonly string[]>;
|
|
185
211
|
}
|
|
186
212
|
|
|
187
213
|
/**
|
|
@@ -238,6 +264,15 @@ interface TreeDocxSessionView {
|
|
|
238
264
|
* and one undo unit without swapping the body store.
|
|
239
265
|
*/
|
|
240
266
|
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
|
|
267
|
+
/**
|
|
268
|
+
* Every part that holds a story, body first, then headers, footers and note parts.
|
|
269
|
+
*
|
|
270
|
+
* A READ: parts come from the package, so this opens no story store and spends none of the
|
|
271
|
+
* 64 editable-store slots. Use it for any query that must answer about the whole document
|
|
272
|
+
* rather than about the caret — an enumeration that reads only the body reports a document
|
|
273
|
+
* the reader is not looking at.
|
|
274
|
+
*/
|
|
275
|
+
storyParts(): readonly OoxmlPart[];
|
|
241
276
|
/** Body text, paragraphs joined by newlines, read from the CANONICAL tree. */
|
|
242
277
|
bodyText(): string;
|
|
243
278
|
/** Text of a story scope, paragraphs joined by newlines. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as SupportedImageMime, b as ImageDecodePort } from './image-resources-
|
|
2
|
-
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput } from './custom-node-writes-
|
|
1
|
+
import { S as SupportedImageMime, b as ImageDecodePort } from './image-resources-D63k8w5f.js';
|
|
2
|
+
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput } from './custom-node-writes-BdVl-LAC.js';
|
|
3
3
|
import { Node } from 'prosemirror-model';
|
|
4
|
-
import { a as ReviewItem } from './review-support
|
|
4
|
+
import { a as ReviewItem } from './review-support--I4ChuzF.js';
|
|
5
5
|
import { ReviewModuleContribution } from './contracts/modules.js';
|
|
6
6
|
import { e as OoxmlPart, O as OoxmlNode, a as OoxmlElement } from './ooxml-tree-BU0e3DVi.js';
|
|
7
7
|
import { O as OoxmlPackage, b as OoxmlPackageRejection } from './ooxml-package-D_CtywTW.js';
|
|
8
8
|
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-BdjsQNE_.js';
|
|
9
|
-
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-
|
|
10
|
-
import { T as TreeDocOp } from './tree-op-types-
|
|
9
|
+
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-CKswbQl3.js';
|
|
10
|
+
import { T as TreeDocOp } from './tree-op-types-BbzrA-kg.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -178,10 +178,36 @@ interface RunPropertyLike {
|
|
|
178
178
|
interface ParagraphAnchorIndex {
|
|
179
179
|
/** nodeId → `w14:paraId`, verbatim as authored/minted. Paragraphs without one are absent. */
|
|
180
180
|
readonly paraIdByNode: ReadonlyMap<string, string>;
|
|
181
|
-
/** UPPERCASED paraId → nodeId (matching is case-insensitive).
|
|
181
|
+
/** UPPERCASED paraId → nodeId (matching is case-insensitive). The first story to claim it. */
|
|
182
182
|
readonly nodeByParaId: ReadonlyMap<string, string>;
|
|
183
183
|
/** nodeId → reading-order ordinal, for document-ordering DocRange endpoints. */
|
|
184
184
|
readonly ordinalByNode: ReadonlyMap<string, number>;
|
|
185
|
+
/**
|
|
186
|
+
* UPPERCASED paraIds more than one story claims.
|
|
187
|
+
*
|
|
188
|
+
* Minting is unique per PART and the contract's uniqueness is per DOCUMENT, so an authored
|
|
189
|
+
* file may repeat one. Resolving such an anchor to whichever story came first would be a
|
|
190
|
+
* silent wrong answer; it is refused as ambiguous instead.
|
|
191
|
+
*/
|
|
192
|
+
readonly ambiguousParaIds: ReadonlySet<string>;
|
|
193
|
+
/**
|
|
194
|
+
* nodeId → the part it was indexed from.
|
|
195
|
+
*
|
|
196
|
+
* The index spans every story, so a caller holding one part and a node id from another reads
|
|
197
|
+
* an empty paragraph and draws a false conclusion from it. Carrying the part alongside the id
|
|
198
|
+
* is what keeps the two in step.
|
|
199
|
+
*/
|
|
200
|
+
readonly partByNode: ReadonlyMap<string, OoxmlPart>;
|
|
201
|
+
/**
|
|
202
|
+
* Every node claiming an ambiguous paraId. DIAGNOSTIC, never a way to pick one.
|
|
203
|
+
*
|
|
204
|
+
* Resolution refuses a clash outright, and this is what says which paragraphs caused it, for
|
|
205
|
+
* a reader repairing the file. Preferring one claimant by the caller's part was tried and
|
|
206
|
+
* reverted: every resolver call site passes the MAIN part, so the preference could only ever
|
|
207
|
+
* land on the body twin and answer `ok` for a header paragraph the caller meant. See
|
|
208
|
+
* `resolveDocAnchor` in `editor/anchor-resolution.ts`.
|
|
209
|
+
*/
|
|
210
|
+
readonly claimantsByParaId: ReadonlyMap<string, readonly string[]>;
|
|
185
211
|
}
|
|
186
212
|
|
|
187
213
|
/**
|
|
@@ -238,6 +264,15 @@ interface TreeDocxSessionView {
|
|
|
238
264
|
* and one undo unit without swapping the body store.
|
|
239
265
|
*/
|
|
240
266
|
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
|
|
267
|
+
/**
|
|
268
|
+
* Every part that holds a story, body first, then headers, footers and note parts.
|
|
269
|
+
*
|
|
270
|
+
* A READ: parts come from the package, so this opens no story store and spends none of the
|
|
271
|
+
* 64 editable-store slots. Use it for any query that must answer about the whole document
|
|
272
|
+
* rather than about the caret — an enumeration that reads only the body reports a document
|
|
273
|
+
* the reader is not looking at.
|
|
274
|
+
*/
|
|
275
|
+
storyParts(): readonly OoxmlPart[];
|
|
241
276
|
/** Body text, paragraphs joined by newlines, read from the CANONICAL tree. */
|
|
242
277
|
bodyText(): string;
|
|
243
278
|
/** Text of a story scope, paragraphs joined by newlines. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { e as OoxmlPart } from './ooxml-tree-BU0e3DVi.js';
|
|
2
2
|
import { O as OoxmlPackage } from './ooxml-package-D_CtywTW.js';
|
|
3
|
-
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-
|
|
3
|
+
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-BbzrA-kg.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The document metadata Word's document-property fields render.
|
|
@@ -166,6 +166,16 @@ interface HistoryEntry {
|
|
|
166
166
|
interface TreeDocumentStoreOptions {
|
|
167
167
|
/** Bound on retained history entries. Oldest entries drop first. */
|
|
168
168
|
readonly historyLimit?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The document's `settings.xml`, for a store built from a PART rather than a package.
|
|
171
|
+
*
|
|
172
|
+
* Forms protection lives one part up from the op, and a store built from a part gets a
|
|
173
|
+
* synthetic one-part package that cannot see it — so `w:documentProtection w:edit="forms"`
|
|
174
|
+
* was enforced in the body and nowhere else, and a header, a footer or a note accepted every
|
|
175
|
+
* write a protected document is supposed to refuse. Read through a getter, not captured: a
|
|
176
|
+
* document can gain or lose protection while its stories stay open.
|
|
177
|
+
*/
|
|
178
|
+
readonly settingsPart?: () => OoxmlPart | null | undefined;
|
|
169
179
|
}
|
|
170
180
|
/**
|
|
171
181
|
* Opaque document+history checkpoint for package-coordinator rollback.
|
|
@@ -205,6 +215,8 @@ declare class TreeDocumentStore {
|
|
|
205
215
|
private readonly redoStack;
|
|
206
216
|
private readonly subscribers;
|
|
207
217
|
private readonly historyLimit;
|
|
218
|
+
/** See {@link TreeDocumentStoreOptions.settingsPart}. */
|
|
219
|
+
private readonly settingsPartOverride;
|
|
208
220
|
/** Package-aware story tag applied to publishes (including undo/redo). */
|
|
209
221
|
private storyRef;
|
|
210
222
|
/** Open composition, if any. While set, transactions extend one entry (task 5.5). */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { e as OoxmlPart } from './ooxml-tree-BU0e3DVi.cjs';
|
|
2
2
|
import { O as OoxmlPackage } from './ooxml-package-CR5us6ad.cjs';
|
|
3
|
-
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-
|
|
3
|
+
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-A-SLSKzK.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The document metadata Word's document-property fields render.
|
|
@@ -166,6 +166,16 @@ interface HistoryEntry {
|
|
|
166
166
|
interface TreeDocumentStoreOptions {
|
|
167
167
|
/** Bound on retained history entries. Oldest entries drop first. */
|
|
168
168
|
readonly historyLimit?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The document's `settings.xml`, for a store built from a PART rather than a package.
|
|
171
|
+
*
|
|
172
|
+
* Forms protection lives one part up from the op, and a store built from a part gets a
|
|
173
|
+
* synthetic one-part package that cannot see it — so `w:documentProtection w:edit="forms"`
|
|
174
|
+
* was enforced in the body and nowhere else, and a header, a footer or a note accepted every
|
|
175
|
+
* write a protected document is supposed to refuse. Read through a getter, not captured: a
|
|
176
|
+
* document can gain or lose protection while its stories stay open.
|
|
177
|
+
*/
|
|
178
|
+
readonly settingsPart?: () => OoxmlPart | null | undefined;
|
|
169
179
|
}
|
|
170
180
|
/**
|
|
171
181
|
* Opaque document+history checkpoint for package-coordinator rollback.
|
|
@@ -205,6 +215,8 @@ declare class TreeDocumentStore {
|
|
|
205
215
|
private readonly redoStack;
|
|
206
216
|
private readonly subscribers;
|
|
207
217
|
private readonly historyLimit;
|
|
218
|
+
/** See {@link TreeDocumentStoreOptions.settingsPart}. */
|
|
219
|
+
private readonly settingsPartOverride;
|
|
208
220
|
/** Package-aware story tag applied to publishes (including undo/redo). */
|
|
209
221
|
private storyRef;
|
|
210
222
|
/** Open composition, if any. While set, transactions extend one entry (task 5.5). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Framework-agnostic core for docx-editor.dev: OOXML parse/serialize, the canonical document tree, layout and paint, and the Editor contract the adapters render.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"directory": "packages/core"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@docx-editor.dev/i18n": "^2.
|
|
89
|
+
"@docx-editor.dev/i18n": "^2.8.0",
|
|
90
90
|
"bidi-js": "1.0.3",
|
|
91
91
|
"emf-converter": "2.0.2",
|
|
92
92
|
"fast-xml-parser": "^5.10.1",
|
package/dist/chunk-4GQXAXTZ.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {b,g}from'./chunk-UVIUNAQ6.js';import {M as M$1,L,O,R,S,G as G$1}from'./chunk-SMRD66T5.js';import {t,De,Ge as Ge$1,Fa,yb,Uc,Kf,Yf,Oe as Oe$1,Pe as Pe$1,Qf,Pf,kf,Sf,Tf,Yd,tg,Zf,Wc,Cc,Xc,Wb,zb,Ff,Yc,ce,Ub,Vb,O as O$1,Xf,Wf,Sb,Xb,Bg,Cg,ma,Oc,Nc,sg,Zb,Lb,Nb}from'./chunk-R75OLPL6.js';import {Schema}from'prosemirror-model';import {EditorState,TextSelection}from'prosemirror-state';import {EditorView}from'prosemirror-view';import {keymap}from'prosemirror-keymap';import {joinBackward,deleteSelection,joinForward,splitBlock,selectTextblockEnd,selectTextblockStart,baseKeymap}from'prosemirror-commands';function j(t){return t.attributes?.val}function H(t){let e=j(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var En=/^[0-9A-Fa-f]{6}$/,ke=/^\d{1,6}$/,Dn=/^-?\d{1,6}$/;function _e(t){return t===void 0||t==="auto"?null:En.test(t)?`#${t}`:null}var Cn={single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"},Mn={black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"};function wn(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function Y(t,e=false){return t===void 0||!(e?Dn:ke).test(t)?null:`${Number(t)/20}pt`}function Wt(t){let e=[],n=[],o=null,s=null;for(let l of t)switch(l.localName){case "b":e.push(`font-weight:${H(l)?"bold":"normal"}`);break;case "i":e.push(`font-style:${H(l)?"italic":"normal"}`);break;case "u":{let r=j(l)??"single";if(r==="none"||!H(l))break;n.push("underline"),o=Cn[r]??"solid",s=_e(l.attributes?.color);break}case "strike":H(l)&&n.push("line-through");break;case "dstrike":H(l)&&n.push("line-through");break;case "caps":H(l)&&e.push("text-transform:uppercase");break;case "smallCaps":H(l)&&e.push("font-variant:small-caps");break;case "vertAlign":{let r=j(l);r==="superscript"?e.push("vertical-align:super","font-size:0.75em"):r==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let r=_e(j(l));r&&e.push(`color:${r}`);break}case "highlight":{let r=Mn[j(l)??""];r&&e.push(`background-color:${r}`);break}case "sz":{let r=j(l);r!==void 0&&ke.test(r)&&e.push(`font-size:${Number(r)/2}pt`);break}case "rFonts":{let r=wn(l.attributes?.ascii??l.attributes?.hAnsi);r&&e.push(`font-family:${r}`);break}case "spacing":{let r=Y(j(l),true);r&&e.push(`letter-spacing:${r}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),o&&e.push(`text-decoration-style:${o}`),s&&e.push(`text-decoration-color:${s}`)),e.join(";")}var Fn={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Yt(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let o=Fn[j(n)??""];o&&e.push(`text-align:${o}`);break}case "ind":{let o=Y(n.attributes?.left??n.attributes?.start,true),s=Y(n.attributes?.right??n.attributes?.end,true),l=Y(n.attributes?.firstLine),r=Y(n.attributes?.hanging);o&&e.push(`margin-left:${o}`),s&&e.push(`margin-right:${s}`),l?e.push(`text-indent:${l}`):r&&e.push(`text-indent:-${r}`);break}case "spacing":{let o=Y(n.attributes?.before),s=Y(n.attributes?.after);o&&e.push(`margin-top:${o}`),s&&e.push(`margin-bottom:${s}`);let l=n.attributes?.line,r=n.attributes?.lineRule;l!==void 0&&ke.test(l)&&r!=="exact"&&r!=="atLeast"?e.push(`line-height:${(Number(l)/240).toFixed(3)}`):l!==void 0&&ke.test(l)&&e.push(`line-height:${Number(l)/20}pt`);break}case "shd":{let o=_e(n.attributes?.fill);o&&e.push(`background-color:${o}`);break}case "pageBreakBefore":H(n)&&e.push("break-before:page");break;}return e.join(";")}var E=new Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Yt(t.attrs.props??[]);return ["p",{"data-node-id":String(t.attrs.nodeId??""),...e?{style:e}:{}},0]},parseDOM:[{tag:"p",getAttrs:t=>typeof t=="string"?null:{nodeId:t.getAttribute("data-node-id")||null,props:[]}}]},text:{group:"inline"},tab:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"tab",class:"docx-tab"},"\u2192"],parseDOM:[{tag:'span[data-token="tab"]'}]},hardBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["br"],parseDOM:[{tag:"br"}]},pageBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"page-break",class:"docx-page-break"}],parseDOM:[{tag:'span[data-token="page-break"]'}]},unknownInline:{inline:true,group:"inline",atom:true,selectable:false,draggable:false,attrs:{nodeId:{default:null},label:{default:""}},toDOM:t=>["span",{"data-token":"unknown","data-node-id":String(t.attrs.nodeId??""),contenteditable:"false",class:"docx-unknown-inline",title:String(t.attrs.label||"Content this editor cannot edit yet. It is preserved.")}],parseDOM:[{tag:'span[data-token="unknown"]',getAttrs:t=>typeof t=="string"?false:{nodeId:t.getAttribute("data-node-id")||null,label:""}}]}},marks:{runProps:{attrs:{props:{default:[]}},excludes:"runProps",toDOM:t=>{let e=t.attrs.props??[],n=Wt(e);return ["span",{"data-run-props":Ln(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=_n(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function Ln(t){return JSON.stringify(Array.isArray(t)?t:[])}function _n(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let n=[];for(let o of e){if(typeof o!="object"||o===null)return null;let s=o;if(typeof s.localName!="string"||s.attributes!==void 0&&(typeof s.attributes!="object"||s.attributes===null))return null;n.push(s.attributes===void 0?{localName:s.localName}:{localName:s.localName,attributes:s.attributes});}return n}catch{return null}}function Be(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function xe(t,e){return JSON.stringify(be(t))===JSON.stringify(be(e))}function be(t){return [...t].map(e=>({localName:e.localName,attributes:Object.fromEntries(Object.entries(e.attributes??{}).sort(([n],[o])=>n<o?-1:1))})).sort((e,n)=>e.localName<n.localName?-1:1)}function He(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue")continue;let o={};for(let s of n.attributes)o[s.localName]=s.value;e.push(Object.keys(o).length>0?{localName:n.localName,attributes:o}:{localName:n.localName});}return e}function Gt(t){return t.kind==="textValue"?"":`${{drawing:"Picture",pict:"Picture",object:"Embedded object",fldSimple:"Field",hyperlink:"Hyperlink",sdt:"Content control",tbl:"Table"}[t.localName]??t.localName} \u2014 preserved, not editable yet`}function K(t){if(t.kind==="textValue")return [];let e=[],n=o=>{if(o.kind!=="run")return;let s=o.children.find(r=>r.kind==="runProperties"),l=He(s);for(let r of o.children)if(r.kind!=="runProperties"){if(r.kind==="tab"){e.push({kind:"tab"});continue}if(r.kind==="hardBreak"){e.push(Zb(r)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(r.kind==="text"){let p="";for(let m of r.children)m.kind==="textValue"&&(p+=m.value);p.length>0&&e.push({kind:"text",text:p,props:l});continue}e.push({kind:"unknown",nodeId:r.id,label:Gt(r)});}};return Sb(t.children,0,o=>{if(o.kind==="run"){n(o);return}e.push({kind:"unknown",nodeId:o.id,label:Gt(o)});}),e}function M(t){let e=[],n=o=>{if(o.kind!=="textValue"){if(o.kind==="body"){for(let s of o.children)s.kind==="paragraph"&&e.push(s);return}for(let s of o.children)n(s);}};return n(t.root),e}function $(t){let e=[];for(let n of De(t))n.root.kind!=="textValue"&&Ge$1(n.root.children,e,0);return e}function G(t){let e=M(t).map(n=>{let o=n.kind==="textValue"?void 0:n.children.find(l=>l.kind==="paragraphProperties"),s=K(n).map(l=>{switch(l.kind){case "text":return E.text(l.text,l.props.length>0?[E.marks.runProps.create({props:l.props})]:[]);case "tab":return E.node("tab");case "hardBreak":return E.node("hardBreak");case "pageBreak":return E.node("pageBreak");default:return E.node("unknownInline",{nodeId:l.nodeId,label:l.label})}});return E.node("paragraph",{nodeId:n.id,props:He(o)},s)});return E.node("doc",null,e.length>0?e:[E.node("paragraph")])}function V(t){let e=[];return t.forEach(n=>{if(n.isText&&n.text){e.push({kind:"text",text:n.text,props:Be(n)});return}n.type.name==="tab"?e.push({kind:"tab"}):n.type.name==="hardBreak"?e.push({kind:"hardBreak"}):n.type.name==="pageBreak"?e.push({kind:"pageBreak"}):n.type.name==="unknownInline"&&e.push({kind:"unknown",nodeId:String(n.attrs.nodeId??""),label:String(n.attrs.label??"")});}),e}function D(t){let e="";for(let n of t)n.kind==="text"?e+=n.text:n.kind==="tab"?e+=" ":n.kind==="hardBreak"?e+=`
|
|
2
|
-
`:n.kind==="pageBreak"&&(e+=Xb);return e}function Kt(t){let e=[],n=0;for(let o of t)o.kind==="text"?n+=o.text.length:o.kind==="tab"||o.kind==="hardBreak"||o.kind==="pageBreak"?n+=1:e.push(`${o.nodeId}@${n}`);return e}function Bn(t,e){if(t===e)return null;let n=0,o=Math.min(t.length,e.length);for(;n<o&&t[n]===e[n];)n+=1;let s=t.length,l=e.length;for(;s>n&&l>n&&t[s-1]===e[l-1];)s-=1,l-=1;return {start:n,endBefore:s,endAfter:l}}function Xt(t){let e=[];for(let n of t)if(n.kind==="text")for(let o=0;o<n.text.length;o+=1)e.push(n.props);else (n.kind==="tab"||n.kind==="hardBreak"||n.kind==="pageBreak")&&e.push(e[e.length-1]??[]);return e}function Hn(t,e,n,o,s){let l=[],r=Kt(e),p=Kt(n);if(JSON.stringify(r)!==JSON.stringify(p))return {ok:false,reason:"unknown-content-moved",detail:t};xe(o,s)||l.push({op:"setParagraphProperties",paragraphId:t,properties:be(s)});let m=D(e),f=D(n),h=Bn(m,f);if(h&&(h.endBefore>h.start&&l.push({op:"deleteText",paragraphId:t,start:h.start,end:h.endBefore}),h.endAfter>h.start)){let b=f.slice(h.start,h.endAfter),g=h.start,i="",y=()=>{i.length!==0&&(l.push({op:"insertText",paragraphId:t,offset:g,text:i}),g+=i.length,i="");};for(let x of b)x===" "?(y(),l.push({op:"insertTab",paragraphId:t,offset:g}),g+=1):x===`
|
|
3
|
-
`?(y(),l.push({op:"insertHardBreak",paragraphId:t,offset:g}),g+=1):x===Xb?(y(),l.push({op:"insertPageBreak",paragraphId:t,offset:g}),g+=1):i+=x;y();}if(!h){let b=Xt(e),g=Xt(n),i=0;for(;i<g.length;){if(xe(b[i]??[],g[i])){i+=1;continue}let y=i,x=g[i];for(;i<g.length&&xe(g[i],x)&&!xe(b[i]??[],g[i]);)i+=1;l.push({op:"setRunProperties",paragraphId:t,start:y,end:i,properties:be(x)});}}return {ok:true,ops:l}}function je(t,e){let n=M(t),o=[];if(e.forEach(l=>{l.type.name==="paragraph"&&o.push(l);}),o.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let s=o.length-n.length;if(s===0){let l=[];for(let[r,p]of o.entries()){let m=n[r];if(p.attrs.nodeId!==m.id)return {ok:false,reason:"paragraph-reordered",detail:String(p.attrs.nodeId)};let f=Hn(m.id,K(m),V(p),He(m.kind==="textValue"?void 0:m.children.find(h=>h.kind==="paragraphProperties")),p.attrs.props??[]);if(!f.ok)return f;l.push(...f.ops);}return {ok:true,ops:l}}return s===1?jn(n,o):s===-1?$n(n,o):{ok:false,reason:"paragraph-count-unexplained",detail:String(s)}}function jn(t,e){for(let n=0;n<t.length;n+=1){let o=t[n],s=e[n],l=e[n+1];if(!s||!l||s.attrs.nodeId!==o.id)continue;let r=l.attrs.nodeId;if(r!==null&&r!==o.id)continue;let p=D(V(s));if(p+D(V(l))===D(K(o))&&Jt(t,e,n)&&Zt(t,e,n+1,n+2))return {ok:true,ops:[{op:"splitParagraph",paragraphId:o.id,offset:p.length}]}}return {ok:false,reason:"split-not-clean"}}function $n(t,e){for(let n=0;n+1<t.length;n+=1){let o=t[n],s=t[n+1],l=e[n];if(!l||l.attrs.nodeId!==o.id)continue;let r=D(K(o))+D(K(s));if(D(V(l))===r&&Jt(t,e,n)&&Zt(t,e,n+2,n+1))return {ok:true,ops:[{op:"joinParagraphs",firstId:o.id,secondId:s.id}]}}return {ok:false,reason:"join-not-clean"}}function Jt(t,e,n){for(let o=0;o<n;o+=1){let s=e[o],l=t[o];if(!s||s.attrs.nodeId!==l.id||D(V(s))!==D(K(l)))return false}return true}function Zt(t,e,n,o){for(let s=0;n+s<t.length;s+=1){let l=t[n+s],r=e[o+s];if(!r||r.attrs.nodeId!==l.id||D(V(r))!==D(K(l)))return false}return true}function zn(t,e){return Fa(t,e)!==null}function $e(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return G(e);let o=new Map;t.forEach(m=>{let f=m.attrs.nodeId;typeof f=="string"&&o.set(f,m);});let s=new Set(n.dirty),l=M(e);if(l.length!==t.childCount)return G(e);let r=G(e),p=[];for(let[m,f]of l.entries()){let h=o.get(f.id);p.push(h&&!s.has(f.id)?h:r.child(m));}return E.node("doc",null,p)}function Un(t,e){let n=t.kind==="revision"?t.ranges[0]??null:t.range;if(!n)return null;let o=e.get(n.start.paragraphId);return o===void 0?null:o}function Vt(t,e,n){for(let s of e)if(s.ranges.length===0)return false;let o=new Set;for(let s of t)s.kind!=="revision"||s.ranges.length>0||qt(s,n)||o.add(b(s));for(let s of e)if(o.has(b(s)))return false;return true}function Qt(t,e,n,o){let s=e.get(n);if(s===void 0)return [...t];let l=[],r=null;for(let p of t){if(p.kind==="revision"&&qt(p,n)){r===null&&(r=l.length);continue}if(r===null){let m=Un(p,e);m!==null&&m>s&&(r=l.length);}l.push(p);}if(r===null&&(r=l.length),o.length>0){let p=o.length<2?[...o]:[...o].sort((m,f)=>g(m,e)-g(f,e));l.splice(r,0,...p);}return sg(l)}function qt(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function Wn(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function Yn(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function Gn(t,e){return t.ranges.length===0||!t.ranges.some(o=>o.start.paragraphId===e||o.end.paragraphId===e)?false:!t.ranges.every(o=>o.start.paragraphId===e&&o.end.paragraphId===e)}function en(t,e,n,o,s,l,r){if(t.fromRevision!==e.bodyRevision||r!==e.packageRevision+1||t.story!==void 0&&t.story.kind!=="body"||t.impact!=="text-local"||t.dirty.length!==1||t.created.length>0||t.deleted.length>0||t.splitJoin.length>0||e.commentsPart!==s||e.commentsExtendedPart!==l)return null;let p=t.dirty[0],m=Fa(o,p);if(!m||m.kind!=="paragraph")return null;for(let f of n){if(f.kind==="comment"){if(Wn(f,p))return null;continue}if(f.kind==="custom"){if(f.range?.start.paragraphId===p)return null;continue}if(Yn(f,p)||Gn(f,p))return null}return p}var nn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,Kn=["ascii","hAnsi","cs","eastAsia"],Xn=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"],Jn=128,Zn=/[\u0000-\u001F\u007F-\u009F]/;function Q(t){return t.kind!=="textValue"}function X(t,e){return t.attributes.find(n=>n.localName===e)?.value}function rn(t,e){let n=new Map,o=r=>{if(!r||!nn.test(r))return;let p=r.toLowerCase();n.has(p)||n.set(p,r);},s=[...t].reverse();for(;s.length>0;){let r=s.pop();if(Q(r)){if(r.localName==="rFonts"){for(let p of Kn)o(X(r,p));if(e)for(let p of Xn){let m=X(r,p);m!==void 0&&(m.startsWith("major")?o(e.major):m.startsWith("minor")&&o(e.minor));}}for(let p=r.children.length-1;p>=0;p-=1)s.push(r.children[p]);}}let l=[...n.values()];return l.sort((r,p)=>r<p?-1:r>p?1:0),l}function on(t){let e=[...t];for(;e.length>0;){let n=e.pop();if(Q(n)){if(n.localName==="t"&&n.namespaceUri===ma){for(let o of n.children)if(!Q(o)&&o.value.length>0)return true;continue}for(let o of n.children)e.push(o);}}return false}var Vn=new Set(["paragraph","character","table","numbering"]),Qn=/^[0-9A-Fa-f]{6}$/,qn=16,tn=new Map([["normal",0],["title",1],["subtitle",2],["heading 1",11],["heading 2",12],["heading 3",13],["heading 4",14],["heading 5",15],["heading 6",16],["heading 7",17],["heading 8",18],["heading 9",19]]);function an(t){return t.children}function ze(t,e){for(let n of an(t))if(Q(n)&&n.localName===e)return n}function er(t){return tn.get(t.name.toLowerCase())??tn.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function Ue(t){return t===void 0||t.length===0||t.length>Jn||Zn.test(t)?null:t}function ln(t,e){if(!t)return [];let n=new Map;for(let l of t.children){if(!Q(l)||l.localName!=="style")continue;let r=Ue(X(l,"styleId"));r!==null&&!n.has(r)&&n.set(r,l);}let o=l=>{let r=false,p=false,m=null,f=false,h=false,b=new Set,g=l;for(let x=0;x<qn&&g!==null&&!b.has(g);x+=1){b.add(g);let T=n.get(g);if(!T)break;let O=ze(T,"rPr");for(let I of O?an(O):[]){if(!Q(I))continue;let v=X(I,"val"),B=v!=="0"&&v!=="false"&&v!=="off";I.localName==="b"&&!f?(r=B,f=true):I.localName==="i"&&!h?(p=B,h=true):I.localName==="color"&&m===null&&v&&Qn.test(v)&&(m=v);}let S=ze(T,"basedOn");g=S?Ue(X(S,"val")):null;}let i=e?.(l),y=i?.fontFamily??null;return {fontFamily:y!==null&&nn.test(y)?y:null,fontSizePt:i?.fontSizeHalfPoints!=null&&i.fontSizeHalfPoints>0?i.fontSizeHalfPoints/2:null,bold:r,italic:p,color:m}},s=[];for(let[l,r]of n){let p=X(r,"type");if(p===void 0||!Vn.has(p))continue;let m=ze(r,"name"),f=Ue(m?X(m,"val"):void 0);s.push({styleId:l,name:f??l,type:p,preview:o(l)});}return s.map((l,r)=>({entry:l,index:r,rank:er(l)})).sort((l,r)=>l.rank-r.rank||l.index-r.index).map(l=>l.entry)}var tr=128,nr=/[\u0000-\u001F\u007F-\u009F]/,rr=/[\u0000-\u001F\u007F-\u009F]/g,or=200,ar=/^heading ([1-9])$/i;function We(t){return t.kind!=="textValue"}function le(t,e){for(let n of t.children)if(We(n)&&n.localName===e)return n}function ae(t,e){return t.attributes.find(n=>n.localName===e)?.value}function lr(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!We(n)||n.localName!=="style"||ae(n,"type")!=="paragraph")continue;let o=ae(n,"styleId");if(o===void 0||o.length===0||o.length>tr||nr.test(o))continue;let s=le(n,"name"),l=s?ae(s,"val"):void 0,r=l!==void 0?ar.exec(l):null;if(r){e.set(o,Number(r[1])-1);continue}let p=le(n,"pPr"),m=p?le(p,"outlineLvl"):void 0,f=m?ae(m,"val"):void 0;f!==void 0&&/^[0-8]$/.test(f)&&e.set(o,Number(f));}return e}function Ye(t){let e=le(t,"pPr"),n=e?le(e,"pStyle"):void 0;return n?ae(n,"val"):void 0}function sn(t,e){let n=lr(e);if(n.size===0)return [];let o=[];for(let s of M(t)){if(!We(s))continue;let l=Ye(s);if(l===void 0)continue;let r=n.get(l);if(r===void 0)continue;let m=(Ff(t,s.id)??"").replace(rr," ").trim().slice(0,or);m.length!==0&&o.push({text:m,level:r,blockId:s.id});}return o}var Pe=48,sr=/[\u0000-\u001F\u007F-\u009F]/g;function un(t){return t.kind!=="textValue"}function Oe(t){if(t.kind==="textValue")return t.value.length;if(t.kind==="tab"||t.kind==="hardBreak")return 1;if(t.kind==="runProperties"||t.kind==="generic")return 0;if(t.kind==="hyperlink"||Lb(t)){let n=0,o=t.kind==="hyperlink"?t.children:Nb(t)??[];for(let s of o)n+=Oe(s);return n}let e=0;for(let n of t.children)e+=Oe(n);return e}function ir(t){let e=[],n=0;return un(t)&&Sb(t.children,0,o=>{if(o.kind==="run"){e.push(n),n+=Oe(o);return}n+=Oe(o);}),e}function ur(t,e){if(t.length===0)return {index:0,offset:e};for(let n=t.length-1;n>=0;n-=1){let o=t[n];if(e>=o)return {index:n,offset:e-o}}return {index:0,offset:e}}function Ge(t,e){return t.replace(sr," ").slice(0,e)}function cn(t,e,n={}){let o={matches:[],truncated:false};if(!Bg(e))return o;let s=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,l={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},r=[],p=0;for(let m of M(t)){if(!un(m))continue;let f=p;p+=1;let h=Ff(t,m.id)??"";if(h.length===0)continue;let b=Cg(h,e,s-r.length,l),g=null;for(let i of b.matches){let y=i.start+i.length;g??=ir(m);let x=ur(g,i.start);r.push({blockId:m.id,start:i.start,length:i.length,paragraphIndex:f,runIndex:x.index,runOffset:x.offset,text:Ge(h.slice(i.start,y),256),contextBefore:Ge(h.slice(Math.max(0,i.start-Pe),i.start),Pe),contextAfter:Ge(h.slice(y,y+Pe),Pe)});}if(b.truncated)return {matches:r,truncated:true}}return {matches:r,truncated:false}}var cr=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"],dr=/^[0-9A-Fa-f]{6}$/,dn={windowText:"000000",window:"FFFFFF"};function mn(t){return t.kind!=="textValue"}function Se(t,e){return t.attributes.find(n=>n.localName===e)?.value}function fn(t,e){let n=[t];for(;n.length>0;){let o=n.pop();if(mn(o)){if(o.localName===e)return o;for(let s=o.children.length-1;s>=0;s-=1)n.push(o.children[s]);}}return null}function ve(t,e){for(let n of t.children)if(mn(n)&&(e===void 0||n.localName===e))return n;return null}function pr(t){let e=ve(t);if(!e)return null;let n;if(e.localName==="srgbClr")n=Se(e,"val");else if(e.localName==="sysClr"){let o=Se(e,"val")??"";n=Se(e,"lastClr")??(Object.prototype.hasOwnProperty.call(dn,o)?dn[o]:void 0);}return n===void 0||!dr.test(n)?null:n.toUpperCase()}var mr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function pn(t,e){let n=ve(t,e),o=n?ve(n,"latin"):null,s=o?Se(o,"typeface"):void 0;return s!==void 0&&mr.test(s)?s:null}function se(t){if(!t)return {major:null,minor:null};let e=fn(t,"fontScheme");return e?{major:pn(e,"majorFont"),minor:pn(e,"minorFont")}:{major:null,minor:null}}function gn(t){if(!t)return [];let e=fn(t,"clrScheme");if(!e)return [];let n=[];for(let o of cr){let s=ve(e,o),l=s?pr(s):null;if(l===null)return [];n.push({slot:o,hex:l});}return n}var fr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;var gr=/[\u0000-\u001F\u007F-\u009F]/;function kn(t){return t.kind!=="textValue"}function J(t,e){for(let n of t.children)if(kn(n)&&n.localName===e)return n}function Z(t,e){return t.attributes.find(n=>n.localName===e)?.value}function yn(t){return t===void 0||t.length===0||t.length>128||gr.test(t)?null:t}function Re(t,e){return t==="minorAscii"||t==="minorHAnsi"?e.minor:t==="majorAscii"||t==="majorHAnsi"?e.major:null}function yr(t,e){let n=Re(Z(t,"asciiTheme"),e)??Re(Z(t,"hAnsiTheme"),e);if(n!==null)return n;let o=Z(t,"ascii")??Z(t,"hAnsi");return o===void 0?null:fr.test(o)?o:null}function hn(t,e){if(!t)return {fontFamily:null,fontSizeHalfPoints:null};let n=J(t,"rFonts"),o=J(t,"sz"),s=o?Z(o,"val"):void 0,l=s!==void 0&&/^\d{1,4}$/.test(s)?Number(s):null;return {fontFamily:n?yr(n,e):null,fontSizeHalfPoints:l!==null&&l>=2&&l<=3276?l:null}}function Ke(t,e){let n=new Map,o={fontFamily:null,fontSizeHalfPoints:null};if(t){let r=J(t,"docDefaults"),p=r?J(r,"rPrDefault"):void 0;o=hn(p?J(p,"rPr"):void 0,e);for(let m of t.children){if(!kn(m)||m.localName!=="style")continue;let f=yn(Z(m,"styleId"));if(f===null||n.has(f))continue;let h=J(m,"basedOn");n.set(f,{basedOn:yn(h?Z(h,"val"):void 0),own:hn(J(m,"rPr"),e)});}}let s=new Map,l=r=>{let p=r??"",m=s.get(p);if(m)return m;let f=null,h=null,b=new Set,g=r;for(let y=0;g!==null&&y<16&&!b.has(g);y+=1){b.add(g);let x=n.get(g);if(!x)break;f??=x.own.fontFamily,h??=x.own.fontSizeHalfPoints,g=x.basedOn;}let i={fontFamily:f??o.fontFamily,fontSizeHalfPoints:h??o.fontSizeHalfPoints};return s.set(p,i),i};return (r,p)=>{let m=l(r),f=p?.find(b=>b.localName==="rFonts"),h=f?Re(f.attributes?.asciiTheme,e)??Re(f.attributes?.hAnsiTheme,e):null;return h===null?m:{...m,fontFamily:h}}}function xn(t){let e=new Map,n=new Map,o=new Map;return $(t).forEach((s,l)=>{o.set(s.id,l);let r=Oc(s);if(r===null||!Nc(r))return;e.set(s.id,r);let p=r.toUpperCase();n.has(p)||n.set(p,s.id);}),Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:o})}var hr=Object.freeze([]);function kr(t,e={}){let n=yb(t);if(!n.ok)return {ok:false,reason:n.reason,...n.detail?{detail:n.detail}:{}};let o=n.package,s=o.parts.get(o.mainDocumentPart);if(!s)return {ok:false,reason:"no-main-document-tree",detail:o.mainDocumentPart};let l=Uc(s),r=new Kf(o,l),p=null,m=null,f=null,h=null;r.subscribe(a=>{h=a;});let b=()=>r.bodyStore(),g=()=>r.currentPackage(),i=Object.freeze({kind:"body"}),y=(a,u)=>{let c=r.currentPackage(),d=a.checkpoint();a.graftPackage(()=>r.currentPackage());let k=u();return k.ok&&(a.restoreHistoryStacks(d),r.replacePackageShell(a.package),r.adoptPackageUnit(c),r.publishStoryWrite(k.change)),k},x=()=>{if(!p||p.packageRevision!==r.packageRevision){let a=Ub(g());p={packageRevision:r.packageRevision,resolution:a,parts:Vb(g())};}return p},T="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",O$2="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",S$1=false,I=null,v=()=>{if(S$1)return I;S$1=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===T),c;if(u){let d=O$1(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/styles.xml"),I=c?.root??null,I},B=false,z=null,ie=()=>{if(B)return z;B=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===O$2),c;if(u){let d=O$1(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/numbering.xml"),z=c?.root??null,z},q="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",ue=-1,Te=null,Xe=()=>{if(ue===r.packageRevision)return Te;ue=r.packageRevision;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===q),c;if(u){let d=O$1(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/settings.xml"),Te=c?.root??null,Te},Sn="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",vn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",Je=(a,u)=>{let c=g(),d=(c.relationships.get("/")??[]).find(P=>P.type===a),k;if(d){let P=O$1(d);P.mode==="Internal"&&P.target.ok&&(k=c.parts.get(P.target.partName));}return k??c.parts.get(u)},Ze=-1,Ie=R,Rn=()=>{if(Ze===r.packageRevision)return Ie;Ze=r.packageRevision;let a=Je(Sn,"/docProps/core.xml"),u=Je(vn,"/docProps/app.xml");return Ie=S(a?.root??null,u?.root??null),Ie},Tn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Ve=false,Ne=null,ee=()=>{if(Ve)return Ne;Ve=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===Tn),c;if(u){let d=O$1(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/theme/theme1.xml"),Ne=c?.root??null,Ne},In="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",ce$1=null,Nn=()=>{if(ce$1)return ce$1;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===In),c;if(u){let d=O$1(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/fontTable.xml"),ce$1=Object.freeze(G$1(a,c)),ce$1},te=null,ne=null,Qe=null,qe=null,et=null,tt=()=>{let a=[b().part.root],u=v();u&&a.push(u);let c=new Set;for(let d of x().parts)for(let k of [...d.headers.values(),...d.footers.values()])c.has(k)||(c.add(k),a.push(k.root));return a},de=null,pe=null,re=null,oe=null,me=null,fe=null,Ee=()=>{let a=b();return (!me||me.revision!==a.revision)&&(me={revision:a.revision,index:xn(a.part)}),me.index};return {ok:true,session:{editable:$(b().part).length>0,paragraphIds:()=>$(b().part).map(a=>a.id),paragraphIdsIn(a=i){let u=r.partFor(a);return u?$(u).map(c=>c.id):[]},part:()=>b().part,partFor:a=>r.partFor(a),currentPackage:g,applyTreeOps(a,u,c,d=i){if(a.length===0)return {committed:false,rejected:false,opCount:0};let k=a.filter(R=>Yc(R)||ce(R)).length;if(k>0){if(k!==a.length||a.length!==1)return {committed:false,rejected:true,opCount:a.length,reason:"invalidArgs"};let R=r.applyLifecycleOp(a[0]);return R.ok?{committed:true,rejected:false,opCount:1}:{committed:false,rejected:true,opCount:1,reason:R.detail??R.reason}}let P=r.transact(d,R=>{u!==void 0&&R.selectionBefore(u),c!==void 0&&R.selectionAfter(c);for(let N of a)R.apply(N);});return P.ok?{committed:true,rejected:false,opCount:a.length}:{committed:false,rejected:true,opCount:a.length,reason:P.reason}},projectDoc:()=>G(b().part),reconcile:a=>$e(a,b().part,h),lastCommitWasStructural:()=>h!==null&&(h.created.length>0||h.deleted.length>0||h.splitJoin.length>0||h.impact==="global"),applyPmDoc(a){let u=b(),c=je(u.part,a);if(!c.ok)return {committed:false,rejected:true,opCount:0,reason:c.reason};if(c.ops.length===0)return {committed:false,rejected:false,opCount:0};let d=r.transact(i,k=>{for(let P of c.ops)k.apply(P);});return d.ok?{committed:true,rejected:false,opCount:c.ops.length}:{committed:false,rejected:true,opCount:c.ops.length,reason:d.reason}},bodyText:()=>xr(b().part),storyText(a){let u=r.partFor(a);return u?$(u).map(c=>Ff(u,c.id)??"").join(`
|
|
4
|
-
`):null},revision:()=>b().revision,revisionFor:a=>r.revisionFor(a),packageRevision:()=>r.packageRevision,canUndo:()=>r.canUndo,canRedo:()=>r.canRedo,undo:()=>{let a=r.selectionForUndo();return r.undo()===null?null:a},redo:()=>{let a=r.selectionForRedo();return r.redo()===null?null:a},beginComposition:(a=i)=>{r.beginComposition(a);},endComposition:()=>r.endComposition(),subscribe(a){return r.subscribe(a)},save(){return zb(g())},headerFooterParts:()=>{let a=x().parts;return a[a.length-1]??Wb(g())},headerFooterPartsBySection:()=>x().parts,headerFooterResolutionBySection:()=>x().resolution,documentFonts(){return te&&te.revision===r.packageRevision||(te={revision:r.packageRevision,fonts:rn(tt(),se(ee()))}),te.fonts},rendersText(){return ne&&ne.revision===r.packageRevision||(ne={revision:r.packageRevision,rendersText:on(tt())}),ne.rendersText},documentStyles(){de??=Ke(v(),se(ee()));let a=de;return Qe??=ln(v(),u=>a(u)),Qe},stylesRoot:()=>v(),documentThemeFonts(){return et??=se(ee()),et},numberingRoot:()=>ie(),settingsRoot:()=>Xe(),documentProperties:()=>Rn(),trackingSettings:()=>O(Xe()),documentThemeColors(){return qe??=gn(ee()),qe},effectiveRunDefaults(a,u){de??=Ke(v(),se(ee()));let c=b();if(!pe||pe.revision!==c.revision){let d=new Map;for(let k of $(c.part))k.kind!=="textValue"&&d.set(k.id,Ye(k)??null);pe={revision:c.revision,byId:d};}return de(pe.byId.get(a)??null,u)},documentOutline(){let a=b();return re&&re.revision===a.revision||(re={revision:a.revision,outline:sn(a.part,v())}),re.outline},findText(a,u){let c=b(),d=`${u?.matchCase===true?"c":""}${u?.wholeWord===true?"w":""}${u?.limit??""}\0${a}`;if(oe&&oe.revision===c.revision&&oe.key===d)return oe.result;let k=cn(c.part,a,u??{});return oe={revision:c.revision,key:d,result:k},k},embeddedFonts:Nn,paragraphAnchors:Ee,paraIdOf:a=>Ee().paraIdByNode.get(a)??null,nodeIdOf:a=>Ee().nodeByParaId.get(a.toUpperCase())??null,relationshipTarget:(a,u=i)=>{let c=g(),d=r.partFor(u);return d?Xc(c,d.name,a):null},bookmarks:()=>{let a=b();return (!fe||fe.revision!==a.revision)&&(fe={revision:a.revision,index:Cc(a.part)}),fe.index},ensureHyperlinkRelationship(a,u=i){let c=r.partFor(u);if(!c)return null;let d=g(),k=Wc(d,a,c.name);return k?(k.pkg!==d&&r.replacePackageShell(k.pkg),k.relationshipId):null},reviewItems(){let a=e.reviewModel;if(!a)return hr;let u=b(),c=`${r.packageRevision}:${u.revision}`;if(m&&m.revisionKey===c)return m.items;let d=g(),k=d.parts.get(Sf(d,u.part.name)),P=d.parts.get(Tf(d,u.part.name)),R=[],N=new Set;for(let A of x().parts)for(let L of [A.headers,A.footers])for(let _ of L.values())N.has(_)||(N.add(_),R.push(_));for(let A of ["footnote","endnote"]){let L=Yd(d,A);!L||N.has(L)||(N.add(L),R.push(L));}let w=m&&h?en(h,m,m.items,u.part,k,P,r.packageRevision):null,F,C;if(w&&m){let A=a.revisionItemsOfParagraph(u.part,w);Vt(m.items,A,w)?(F=Qt(m.items,m.paragraphOrder,w,A),C=m.paragraphOrder):(C=tg(u.part),F=a.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:k,commentsExtendedPart:P,customNodePayloads:Zf(g(),u.part.name)}));}else C=tg(u.part),F=a.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:k,commentsExtendedPart:P,customNodePayloads:Zf(g(),u.part.name)});return m={revisionKey:c,bodyRevision:u.revision,packageRevision:r.packageRevision,items:F,paragraphOrder:C,commentsPart:k,commentsExtendedPart:P},m.items},hasReviewContent(){let a=b();return (!f||f.revision!==a.revision)&&(f={revision:a.revision,present:kf(a.part).length>0||Pn(a.part.root)}),f.present},replyToComment(a,u,c,d,k,P=i){let R=P.kind==="body"?null:r.resolveStory(P),N=R?.ok?R.store:b(),w=r.currentPackage(),F=N.checkpoint();N.graftPackage(()=>r.currentPackage());let C=Pf(N,{anchor:{paragraphId:u.paragraphId,start:u.start,end:u.end,...u.endParagraphId===void 0?{}:{endParagraphId:u.endParagraphId}},author:d,text:c,...k===void 0?{}:{date:k},...a===null?{}:{replyToCommentId:a}});return C.ok?(N.restoreHistoryStacks(F),r.replacePackageShell(N.package),r.adoptPackageUnit(w),r.publishStoryWrite(C.change),C.commentId):null},setCommentResolved(a,u){let c=b(),d=r.currentPackage(),k=c.checkpoint();c.graftPackage(()=>r.currentPackage());let P=Qf(c,a,u);return P.ok?(P.changed&&(c.restoreHistoryStacks(k),r.replacePackageShell(c.package),r.adoptPackageUnit(d),r.publishStoryWrite(P.change)),true):false},deleteComment(a,u=i,c){return this.deleteComments([{commentId:a}],u,c)},deleteComments(a,u=i,c){if(a.length===0)return false;let d=u.kind==="body"?b().part:r.partFor(u);if(!d)return false;let k={storyPartName:d.name,...c===void 0?{}:{noteId:c}},P=b(),R=r.currentPackage(),N=P.checkpoint();P.graftPackage(()=>r.currentPackage());let w=false,F=false,C=P.transact(A=>{A.applyPackage(L=>{let _=L;for(let ge of a){let De=ge.parentCommentId===void 0?Oe$1(_,ge.commentId,k):Pe$1(_,ge.commentId,ge.parentCommentId,k);if(De===null)return w=true,L;F||=De!==_,_=De;}return _});});return w||!C.ok||!F?false:(P.restoreHistoryStacks(N),r.installPackageSnapshot(P.package),r.adoptPackageUnit(R),r.publishStoryWrite(C.change),true)},insertCustomNode(a,u=i){let c=u.kind==="body"?null:r.resolveStory(u),d=c?.ok?c.store:b();return y(d,()=>Wf(d,a,b().part.name))},removeCustomNode(a,u=i){let c=u.kind==="body"?null:r.resolveStory(u),d=c?.ok?c.store:b();return y(d,()=>Xf(d,a))},sweepCustomNodePayloads(a){let u=b(),c=Yf(r.currentPackage(),u.part.name,a);return c.ok?c.removed.length===0?{ok:true,removed:[]}:(r.replacePackageShell(c.pkg),{ok:true,removed:c.removed}):{ok:false,reason:c.reason}},ensureListDefinition(a){let u=L(g(),a);return u?(r.replacePackageShell(u.pkg),B=false,z=null,u.numId):null},ensureNumberingLevel(a,u,c){let d=g(),k=M$1(d,a,u,c);return k?(k!==d&&(r.replacePackageShell(k),B=false,z=null),true):false},insertImage(a,u){return r.insertImage(a,u)},replaceImage(a,u,c,d,k,P){return r.replaceImage(a,u,c,d,k,P)},deleteImage(a,u){return r.deleteImage(a,u)},applyImageProperties(a,u){return r.applyImageProperties(a,u)}}}}function xr(t){return M(t).map(e=>Ff(t,e.id)??"").join(`
|
|
5
|
-
`)}var bn=new WeakMap;function Pn(t,e=0){if(e>64)return false;let n=bn.get(t);if(n!==void 0)return n;let o=false;for(let s of t.children)if(s.kind!=="textValue"&&(s.kind==="commentRangeStart"||s.kind==="commentReference"||Pn(s,e+1))){o=true;break}return bn.set(t,o),o}var br=t.projection;function Cr(t,e,n){let o=t.filter(s=>s.localName!==e);return o.length!==t.length?o:[...o,n?{localName:e,attributes:n}:{localName:e}]}function Mr(t,e,n={}){let o=null,s=false,l=()=>n.onChange?.(r()),r=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:o}),p=i=>{s=true;let y=f.state.tr.replaceWith(0,f.state.doc.content.size,i.content);y.setMeta("addToHistory",false),f.dispatch(y),s=false;},m=i=>()=>(i()&&(p(e.projectDoc()),l()),true),f=new EditorView(t,{state:EditorState.create({doc:e.projectDoc(),plugins:[keymap({...baseKeymap,Home:selectTextblockStart,End:selectTextblockEnd,"Mod-z":m(()=>e.undo()!==null),"Mod-y":m(()=>e.redo()!==null),"Shift-Mod-z":m(()=>e.redo()!==null),"Mod-b":(i,y)=>g(i,y,"b"),"Mod-i":(i,y)=>g(i,y,"i"),"Mod-u":(i,y)=>g(i,y,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:i=>(h(i),false),beforeinput:(i,y)=>{let x=y;if(i.composing)return false;h(i);let T=x.inputType;if(T==="insertText"&&x.data!=null){x.preventDefault();let{from:O,to:S}=i.state.selection;return i.dispatch(i.state.tr.insertText(x.data,O,S)),true}if(T==="deleteContentBackward"){x.preventDefault();let{from:O,empty:S}=i.state.selection;return S?O>0?i.dispatch(i.state.tr.delete(O-1,O)):joinBackward(i.state,i.dispatch):deleteSelection(i.state,i.dispatch),true}if(T==="deleteContentForward"){x.preventDefault();let{from:O,to:S,empty:I}=i.state.selection;return I?S<i.state.doc.content.size?i.dispatch(i.state.tr.delete(O,O+1)):joinForward(i.state,i.dispatch):deleteSelection(i.state,i.dispatch),true}return T==="insertParagraph"?(x.preventDefault(),splitBlock(i.state,i.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),l(),false)},dispatchTransaction(i){let y=f.state.apply(i);if(s||!i.docChanged){f.updateState(y);return}let x=e.applyPmDoc(y.doc);if(x.rejected){o=String(x.reason??"rejected"),f.updateState(y),p(e.projectDoc()),l();return}o=null,f.updateState(x.committed&&e.lastCommitWasStructural()?b(y):y),l();}});function h(i){if(i.composing||s)return;let y=i.dom.ownerDocument.getSelection(),x=y?.anchorNode,T=y?.focusNode;if(!(!y||!x||!T)&&!(!i.dom.contains(x)||!i.dom.contains(T)))try{let O=i.posAtDOM(x,y.anchorOffset),S=i.posAtDOM(T,y.focusOffset),I=i.state.selection;if(I.anchor===O&&I.head===S)return;let v=TextSelection.create(i.state.doc,O,S);i.dispatch(i.state.tr.setSelection(v).setMeta("addToHistory",!1));}catch{}}function b(i){let y=e.paragraphIds(),x=i.tr,T=false,O=0;return i.doc.forEach((S,I)=>{let v=y[O];O+=1,!(S.type.name!=="paragraph"||v===void 0)&&S.attrs.nodeId!==v&&(x=x.setNodeMarkup(I,void 0,{...S.attrs,nodeId:v}),T=true);}),T?i.apply(x.setMeta("addToHistory",false)):i}function g(i,y,x,T){let O=E.marks.runProps;if(!y)return true;let{from:S,to:I,empty:v}=i.selection;if(v)return true;let z=i.doc.resolve(S).marks().find(ue=>ue.type===O)?.attrs.props??[],ie=Cr(z,x,T),q=i.tr;return q.removeMark(S,I,O),ie.length>0&&q.addMark(S,I,O.create({props:ie})),y(q),true}return {view:f,state:r,undo:()=>m(()=>e.undo()!==null)(),redo:()=>m(()=>e.redo()!==null)(),toggleRunProperty(i,y){g(f.state,f.dispatch.bind(f),i,y);},destroy:()=>f.destroy()}}export{E as a,Be as b,M as c,$ as d,G as e,je as f,zn as g,$e as h,Ye as i,kr as j,br as k,Mr as l};
|