@docx-editor.dev/core 2.36.0 → 2.37.0-canary.20261110032710.sha-525df6f
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.d.ts +6 -6
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +11 -11
- package/dist/binding.js +1 -1
- package/dist/{chrome-print-B9U_PiqL.d.ts → chrome-print-BSsqYQtt.d.ts} +51 -19
- package/dist/chunk-36NJQDWI.cjs +31 -0
- package/dist/chunk-3OKDY5TX.cjs +3 -0
- package/dist/{chunk-I34OVDHO.cjs → chunk-4QLFADOG.cjs} +1 -1
- package/dist/chunk-6EGRB3J4.js +6 -0
- package/dist/chunk-6I6V2JDF.cjs +7 -0
- package/dist/chunk-77L2HX42.js +1 -0
- package/dist/chunk-ATU65CUF.cjs +32 -0
- package/dist/chunk-EB5XLX3A.js +4 -0
- package/dist/chunk-G7GO4CNK.cjs +2 -0
- package/dist/chunk-JK4HBRVP.js +7 -0
- package/dist/{chunk-D75AXVLG.cjs → chunk-JZXMWGF4.cjs} +1 -1
- package/dist/{chunk-HLMY6NFI.js → chunk-MLJJL4QG.js} +1 -1
- package/dist/chunk-MYNOUTWY.js +1 -0
- package/dist/{chunk-QTRRXJXQ.cjs → chunk-NPPHSBFT.cjs} +3 -3
- package/dist/{chunk-7ZSPY7WH.cjs → chunk-OTZNA6FP.cjs} +1 -1
- package/dist/chunk-Q3FUAUL4.js +31 -0
- package/dist/chunk-RFMMFHWX.cjs +6 -0
- package/dist/chunk-T6MYXF6V.js +32 -0
- package/dist/chunk-TTPQZXYS.js +3 -0
- package/dist/{chunk-4RDU6QVH.cjs → chunk-UMDB6PEV.cjs} +1 -1
- package/dist/{chunk-NTDLU6W6.cjs → chunk-UP5TM6T6.cjs} +1 -1
- package/dist/{chunk-2BVJFI6B.js → chunk-WMM772MS.js} +1 -1
- package/dist/chunk-XI5HK3TZ.js +282 -0
- package/dist/chunk-XMJFDVE2.js +4 -0
- package/dist/chunk-XPBKJQTG.cjs +282 -0
- package/dist/{chunk-VS2MXS62.js → chunk-YCOHPEF2.js} +1 -1
- package/dist/{chunk-IMTQS6N5.cjs → chunk-YVK3NMR6.cjs} +1 -1
- package/dist/{chunk-K3UKJU4K.js → chunk-YVLF7HBD.js} +1 -1
- package/dist/chunk-Z6NPBOE6.js +2 -0
- package/dist/chunk-ZY7HJR3R.cjs +4 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +2 -2
- package/dist/collaboration/replication.js +1 -1
- package/dist/contracts/document.d.ts +2 -2
- package/dist/contracts/editor.d.ts +8 -8
- package/dist/contracts/modules.d.ts +9 -9
- package/dist/contracts/types.d.ts +3 -3
- package/dist/{custom-node-writes-DqzeiTpY.d.ts → custom-node-writes-Buryuzow.d.ts} +2 -2
- package/dist/{document-protection-CGnc6WX7.d.ts → document-protection-Denp0lhl.d.ts} +1 -1
- package/dist/{drawing-graphic-kind-Dw4Qu9VA.d.ts → drawing-graphic-kind-DjGMFeSM.d.ts} +2 -2
- package/dist/{drawing-preview-package-BuFluWSg.d.ts → drawing-preview-package-LHyHuTVq.d.ts} +1 -1
- package/dist/{editor-CoU0Ipa9.d.ts → editor-B0xPJSXd.d.ts} +233 -9
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +2 -2
- package/dist/editor.d.ts +309 -26
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +2 -2
- package/dist/export.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-B7ifvgm-.d.ts → layout-shaping-CFTk9pWQ.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +16 -14
- package/dist/layout.js +1 -1
- package/dist/{note-properties-CrO9A0Ju.d.ts → note-properties-C8_cURo1.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +9 -9
- package/dist/output.js +1 -1
- package/dist/{protocol-C-LfGgrt.d.ts → protocol-CG_ybtKt.d.ts} +2 -2
- package/dist/{review-paragraph-order-gZ8-oIWd.d.ts → review-paragraph-order-3oV2aI2q.d.ts} +1 -1
- package/dist/{revision-projection-BAUauksK.d.ts → revision-projection-C9oujZwA.d.ts} +1 -1
- package/dist/{semantic-cell-selection--xgumqWx.d.ts → semantic-cell-selection-BiYMYlbf.d.ts} +2 -2
- package/dist/{semantic-interaction-B_AAT9S2.d.ts → semantic-interaction-BTba0_1e.d.ts} +1 -1
- package/dist/{semantic-paint-Cl4VyItm.d.ts → semantic-paint-B_xi9H5m.d.ts} +4 -4
- package/dist/{semantic-record-queries-BKX8sDqa.d.ts → semantic-record-queries-TdjLU-AU.d.ts} +1 -1
- package/dist/{semantic-records-DkDc4E1z.d.ts → semantic-records-C5qbT1sK.d.ts} +29 -5
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +12 -12
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-BJTz6t_O.d.ts → tree-op-types-DzstjXTb.d.ts} +12 -2
- package/dist/{tree-package-fragment-DDV5xjSI.d.ts → tree-package-fragment-DLbxcboK.d.ts} +67 -65
- package/dist/{tree-session-contract-CAsZn-VN.d.ts → tree-session-contract-BiKgucBu.d.ts} +92 -11
- package/dist/{unsupported-elements-1Tj829Bk.d.ts → unsupported-elements-KboafN7A.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-3DLIAAXE.js +0 -2
- package/dist/chunk-3KSO2I22.js +0 -4
- package/dist/chunk-4K5QXGVN.js +0 -31
- package/dist/chunk-5JHQHJRH.js +0 -3
- package/dist/chunk-5W6DLXVG.cjs +0 -3
- package/dist/chunk-6VTHQTM3.js +0 -1
- package/dist/chunk-7MOZVKCN.js +0 -282
- package/dist/chunk-BR7AQCGM.cjs +0 -31
- package/dist/chunk-DZO5K26E.js +0 -1
- package/dist/chunk-K5FZYV6Z.cjs +0 -32
- package/dist/chunk-MK4MO7RT.cjs +0 -7
- package/dist/chunk-N5RYSQN5.js +0 -4
- package/dist/chunk-O2AEJ5T4.js +0 -5
- package/dist/chunk-PSVIEQUU.js +0 -32
- package/dist/chunk-PXF5BBEK.cjs +0 -2
- package/dist/chunk-R42NW5FO.js +0 -7
- package/dist/chunk-TCWCSTAF.cjs +0 -282
- package/dist/chunk-XFDDD65J.cjs +0 -4
- package/dist/chunk-XTNY4DBY.cjs +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as OoxmlPackage, aG as SupportedImageMime, O as OoxmlPart,
|
|
1
|
+
import { r as OoxmlPackage, aG as SupportedImageMime, O as OoxmlPart, b0 as OoxmlInvariantIssue, am as OoxmlNode, aU as OoxmlElement, b1 as PackageWatermarkWrite, b2 as OoxmlParagraphNode, b3 as OoxmlNoteNode, b4 as OoxmlContinuationSeparatorNode, b5 as OoxmlEndnotesNode, b6 as OoxmlFootnotesNode, b7 as OoxmlNoteRefNode, b8 as OoxmlNoteReferenceNode, b9 as OoxmlSeparatorNode, aY as RevisionAttributionInput, ba as ImpactClass, aO as TreeDocOp, aZ as TreeOpRejection, aw as ImageDecodePort, bb as DrawingTreeDocOp } from './tree-op-types-DzstjXTb.js';
|
|
2
2
|
|
|
3
3
|
/** A freshly allocated drawing property id, or the reason one could not be minted. */
|
|
4
4
|
type DrawingPropertyIdResult = {
|
|
@@ -676,51 +676,24 @@ interface CascadeDeletedNoteReferencesOptions {
|
|
|
676
676
|
*/
|
|
677
677
|
declare function cascadeDeletedNoteReferences(before: OoxmlPackage, after: OoxmlPackage, options?: CascadeDeletedNoteReferencesOptions): OoxmlPackage | null;
|
|
678
678
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
*
|
|
698
|
-
* EXPLICIT, and not the ambient `runWithTransactionActor` binding, because this entry is
|
|
699
|
-
* async: the mint runs after `await validateEmbeddedImageForCommit` and the ambient actor
|
|
700
|
-
* is synchronous-only. A wrap around the call would compile, read as correct, and be gone
|
|
701
|
-
* by the time the id is taken. Omitted (solo) keeps Word's dense `highest + 1` sequence.
|
|
702
|
-
*/
|
|
703
|
-
readonly actorId?: string;
|
|
704
|
-
}
|
|
705
|
-
interface ReplaceImageOptions {
|
|
706
|
-
readonly expectedPackageRevision: number;
|
|
707
|
-
readonly commitGuard?: () => boolean;
|
|
708
|
-
/** Collaboration actor for the replacement's minted ids. See {@link InsertImageInput.actorId}. */
|
|
709
|
-
readonly actorId?: string;
|
|
710
|
-
}
|
|
711
|
-
type ImageIntentResult = (Extract<PackageTransactResult, {
|
|
712
|
-
ok: true;
|
|
713
|
-
}> & {
|
|
714
|
-
readonly drawingNodeId?: string;
|
|
715
|
-
readonly mediaPartName?: string;
|
|
716
|
-
}) | Extract<PackageTransactResult, {
|
|
717
|
-
ok: false;
|
|
718
|
-
}>;
|
|
719
|
-
interface ApplyImagePropertiesInput {
|
|
720
|
-
readonly drawingNodeId: string;
|
|
721
|
-
readonly ops: readonly DrawingTreeDocOp[];
|
|
722
|
-
readonly hyperlink: string | null;
|
|
723
|
-
}
|
|
679
|
+
/**
|
|
680
|
+
* The identity of one continuous user gesture, for history grouping.
|
|
681
|
+
*
|
|
682
|
+
* A live color picker, a font-size stepper or a spacing slider applies every intermediate
|
|
683
|
+
* value so the document updates under the pointer, and each of those writes is a
|
|
684
|
+
* transaction in its own right — it must render, and a collaborator must receive it. What
|
|
685
|
+
* they are NOT is separate undo steps. The caller mints one token when the gesture starts
|
|
686
|
+
* (`Symbol('color-drag')`) and passes it with every write until the gesture ends.
|
|
687
|
+
*
|
|
688
|
+
* A symbol rather than a string, so two unrelated callers cannot collide by naming their
|
|
689
|
+
* gesture the same way, and so a token cannot outlive its gesture by accident through
|
|
690
|
+
* serialization.
|
|
691
|
+
*/
|
|
692
|
+
type HistoryGroup = symbol;
|
|
693
|
+
type HistoryCaptureKind = 'started' | 'extended' | 'split';
|
|
694
|
+
type HistoryCaptureReason = 'package-unit' | 'composition';
|
|
695
|
+
declare function observeHistoryGroup<T>(group: HistoryGroup, report: (kind: HistoryCaptureKind, reason?: HistoryCaptureReason) => void, run: () => T): T;
|
|
696
|
+
declare function reportHistoryGroup(group: HistoryGroup | undefined, kind: HistoryCaptureKind, reason?: HistoryCaptureReason): void;
|
|
724
697
|
|
|
725
698
|
/** How one transaction behaves: its story scope, its attribution, and its selection marks. */
|
|
726
699
|
interface TransactOptions {
|
|
@@ -1077,24 +1050,53 @@ declare class TreeDocumentStore {
|
|
|
1077
1050
|
private publish;
|
|
1078
1051
|
}
|
|
1079
1052
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1053
|
+
interface InsertImageInput {
|
|
1054
|
+
/** Explicit left bias inserts before a leading prompt. */
|
|
1055
|
+
readonly bias?: 'left' | 'right';
|
|
1056
|
+
readonly paragraphId: string;
|
|
1057
|
+
readonly offset: number;
|
|
1058
|
+
readonly bytes: Uint8Array;
|
|
1059
|
+
readonly mime: SupportedImageMime;
|
|
1060
|
+
readonly widthPoints: number;
|
|
1061
|
+
readonly heightPoints: number;
|
|
1062
|
+
readonly decodePort: ImageDecodePort;
|
|
1063
|
+
readonly expectedPackageRevision: number;
|
|
1064
|
+
readonly commitGuard?: () => boolean;
|
|
1065
|
+
readonly title?: string;
|
|
1066
|
+
readonly description?: string;
|
|
1067
|
+
readonly hyperlink?: string;
|
|
1068
|
+
/** Present in suggesting mode: the inserted drawing's run goes into a `w:ins`. */
|
|
1069
|
+
readonly revision?: RevisionAttributionInput;
|
|
1070
|
+
/**
|
|
1071
|
+
* Collaboration actor for the ids this insert mints — `wp:docPr/@id`, the image
|
|
1072
|
+
* relationship, and a hyperlink relationship when one is asked for.
|
|
1073
|
+
*
|
|
1074
|
+
* EXPLICIT, and not the ambient `runWithTransactionActor` binding, because this entry is
|
|
1075
|
+
* async: the mint runs after `await validateEmbeddedImageForCommit` and the ambient actor
|
|
1076
|
+
* is synchronous-only. A wrap around the call would compile, read as correct, and be gone
|
|
1077
|
+
* by the time the id is taken. Omitted (solo) keeps Word's dense `highest + 1` sequence.
|
|
1078
|
+
*/
|
|
1079
|
+
readonly actorId?: string;
|
|
1080
|
+
}
|
|
1081
|
+
interface ReplaceImageOptions {
|
|
1082
|
+
readonly expectedPackageRevision: number;
|
|
1083
|
+
readonly commitGuard?: () => boolean;
|
|
1084
|
+
/** Collaboration actor for the replacement's minted ids. See {@link InsertImageInput.actorId}. */
|
|
1085
|
+
readonly actorId?: string;
|
|
1086
|
+
}
|
|
1087
|
+
type ImageIntentResult = (Extract<PackageTransactResult, {
|
|
1088
|
+
ok: true;
|
|
1089
|
+
}> & {
|
|
1090
|
+
readonly drawingNodeId?: string;
|
|
1091
|
+
readonly mediaPartName?: string;
|
|
1092
|
+
}) | Extract<PackageTransactResult, {
|
|
1093
|
+
ok: false;
|
|
1094
|
+
}>;
|
|
1095
|
+
interface ApplyImagePropertiesInput {
|
|
1096
|
+
readonly drawingNodeId: string;
|
|
1097
|
+
readonly ops: readonly DrawingTreeDocOp[];
|
|
1098
|
+
readonly hyperlink: string | null;
|
|
1099
|
+
}
|
|
1098
1100
|
|
|
1099
1101
|
/** Attribution stamped on one remote canonical publication. */
|
|
1100
1102
|
interface RemotePackageAttribution {
|
|
@@ -1398,4 +1400,4 @@ type FragmentPasteResult = (Extract<PackageTransactResult, {
|
|
|
1398
1400
|
declare function applyFragmentPaste(store: TreePackageStore, scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
1399
1401
|
|
|
1400
1402
|
export { NOTE_CONTINUATION_SEPARATOR_ID as B, DEFAULT_MAX_EDITABLE_STORY_PARTS as D, NOTE_ID_MAX as G, NOTE_ID_MIN as J, NOTE_SEPARATOR_ID as K, MAX_FRAGMENT_DECODED_BYTES as M, TreePackageStore as T, allocateDrawingPropertyId as a8, allocateNoteId as a9, isNoteNode as aA, isNoteRefNode as aB, isNoteReferenceNode as aC, isSeparatorNode as aD, normalNoteIds as aE, noteAtomText as aF, noteIdOf as aG, noteKindOf as aH, noteRefKindOf as aI, noteReferenceKindOf as aJ, noteTypeOf as aK, notesOf as aL, notesPartHasId as aM, observeHistoryGroup as aN, parentNodeOf as aO, parseNoteId as aP, parseNoteScopeId as aQ, removeNode as aR, replaceChildren as aS, replaceNode as aT, resolveHeaderFooterParts as aU, resolveHeaderFooterPartsBySection as aV, resolveHeaderFooterResolutionBySection as aW, resolveNotesPart as aX, withBinaryPart as aY, withEmbeddedImage as aZ, withoutUnreferencedImagePart as a_, applyEdits as aa, applyFragmentPaste as ab, applyHeaderFooterLifecycleOp as ac, applyNoteLifecycleOp as ad, atomicNoteSpansOf as ae, cascadeDeletedNoteReferences as af, collectNodeIds as ag, collectNoteReferences as ah, collectPackageNoteReferences as ai, collectSectionPropertyNodes as aj, createNodeIdAllocator as ak, createNoteReferenceScanBudget as al, customMarkFollows as am, diagnoseNoteReferences as an, findNode as ao, findNoteById as ap, formatNoteScopeId as aq, hasNode as ar, insertChildren as as, isContinuationSeparatorNode as at, isEndnotesNode as au, isFootnotesNode as av, isHeaderFooterLifecycleOp as aw, isNormalNote as ax, isNoteAtomNode as ay, isNoteLifecycleOp as az, TreeDocumentStore as d, reportHistoryGroup as r, MAX_NOTES_PER_PART as w, MAX_NOTE_REFERENCE_PARTS as x, MAX_NOTE_REFERENCE_SCAN as y, NOTE_ATOM_CHAR as z };
|
|
1401
|
-
export type { PackageTransactResult as $, ApplyImagePropertiesInput as A, ContentLockPolicy as C, EditOptions as E, FieldResultsMode as F, HeaderFooterVariant as H,
|
|
1403
|
+
export type { PackageTransactResult as $, ApplyImagePropertiesInput as A, ContentLockPolicy as C, EditOptions as E, FieldResultsMode as F, HeaderFooterVariant as H, ImageIntentResult as I, NoteDiagnostic as L, NoteKind as N, NoteDiagnosticCode as O, NoteLifecycleImpact as P, NoteLifecycleOp as Q, ReplaceImageOptions as R, StoryScope as S, NoteLifecycleOptions as U, NoteLifecycleRejection as V, NoteLifecycleResult as W, NoteReferenceHit as X, NoteReferenceScanBudget as Y, NoteType as Z, OoxmlEditResult as _, StoryTargetRejection as a, RemotePackageAttribution as a0, StoryResolveResult as a1, TransactionRevisionIds as a2, TreeDocumentStoreOptions as a3, TreePackageStoreOptions as a4, TreeStoryRef as a5, TransactResult as a6, TransactionContext as a7, HistoryGroup as b, TreeModelChange as c, HeaderFooterParts as e, HeaderFooterSectionResolution as f, SelectionMark as g, TransactOptions as h, InsertImageInput as i, FragmentPasteInput as j, FragmentPasteResult as k, AtomicNoteSpan as l, CascadeDeletedNoteReferencesOptions as m, DrawingPropertyIdResult as n, HeaderFooterKind as o, HeaderFooterLifecycleImpact as p, HeaderFooterLifecycleOp as q, HeaderFooterLifecycleRejection as s, HeaderFooterLifecycleResult as t, HeaderFooterSlotMeta as u, HistoryCaptureKind as v };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { c as TreeModelChange, S as StoryScope, g as SelectionMark, h as TransactOptions, b as HistoryGroup, a as StoryTargetRejection, e as HeaderFooterParts, f as HeaderFooterSectionResolution,
|
|
2
|
-
import { aO as TreeDocOp, O as OoxmlPart, am as OoxmlNode, r as OoxmlPackage, aU as OoxmlElement, c as ReviewItem, aG as SupportedImageMime, aw as ImageDecodePort, aY as RevisionAttributionInput } from './tree-op-types-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { c as TreeModelChange, S as StoryScope, I as ImageIntentResult, g as SelectionMark, h as TransactOptions, b as HistoryGroup, a as StoryTargetRejection, e as HeaderFooterParts, f as HeaderFooterSectionResolution, i as InsertImageInput, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, j as FragmentPasteInput, k as FragmentPasteResult } from './tree-package-fragment-DLbxcboK.js';
|
|
2
|
+
import { aO as TreeDocOp, O as OoxmlPart, am as OoxmlNode, aW as OoxmlGenericElementNode, a$ as OoxmlTextNode, r as OoxmlPackage, aU as OoxmlElement, c as ReviewItem, aG as SupportedImageMime, aw as ImageDecodePort, aY as RevisionAttributionInput } from './tree-op-types-DzstjXTb.js';
|
|
3
|
+
import { s as ChartType, as as NewChartData } from './editor-B0xPJSXd.js';
|
|
4
|
+
import { D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, a as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, b as ListDefinitionGeometry } from './custom-node-writes-Buryuzow.js';
|
|
5
|
+
import { H as HeadlessDocumentView, c as DocumentProperties } from './drawing-graphic-kind-DjGMFeSM.js';
|
|
6
|
+
import { Node as Node$1 } from 'prosemirror-model';
|
|
6
7
|
import { CollaborationDocumentPort } from './collaboration/replication.js';
|
|
7
8
|
import { V as ViewScope } from './editor-scope-CA6egMaK.js';
|
|
8
9
|
|
|
@@ -33,7 +34,7 @@ type MapResult = {
|
|
|
33
34
|
/** Body paragraphs of a part, in document order. */
|
|
34
35
|
declare function bodyParagraphs(part: OoxmlPart): OoxmlNode[];
|
|
35
36
|
/** Project one tree revision into a ProseMirror doc (task 6.1). */
|
|
36
|
-
declare function treeToDoc(part: OoxmlPart): Node;
|
|
37
|
+
declare function treeToDoc(part: OoxmlPart): Node$1;
|
|
37
38
|
/**
|
|
38
39
|
* Map an edited ProseMirror doc back into typed tree ops (task 6.2), or refuse (6.3).
|
|
39
40
|
*
|
|
@@ -42,7 +43,7 @@ declare function treeToDoc(part: OoxmlPart): Node;
|
|
|
42
43
|
* with an edit elsewhere — is refused rather than approximated, because the approximation
|
|
43
44
|
* is what silently loses content.
|
|
44
45
|
*/
|
|
45
|
-
declare function docToTreeOps(part: OoxmlPart, doc: Node): MapResult;
|
|
46
|
+
declare function docToTreeOps(part: OoxmlPart, doc: Node$1): MapResult;
|
|
46
47
|
/** Whether a tree node id is still present, for reconciliation checks. */
|
|
47
48
|
declare function partHasNode(part: OoxmlPart, nodeId: string): boolean;
|
|
48
49
|
/**
|
|
@@ -57,12 +58,12 @@ declare function partHasNode(part: OoxmlPart, nodeId: string): boolean;
|
|
|
57
58
|
* Passing `null` means "no evidence available", which also takes the full path. Reconciling
|
|
58
59
|
* on partial evidence is how a projection silently diverges from the model.
|
|
59
60
|
*/
|
|
60
|
-
declare function reconcileDoc(previousDoc: Node, part: OoxmlPart, change: {
|
|
61
|
+
declare function reconcileDoc(previousDoc: Node$1, part: OoxmlPart, change: {
|
|
61
62
|
readonly dirty: readonly string[];
|
|
62
63
|
readonly created: readonly string[];
|
|
63
64
|
readonly deleted: readonly string[];
|
|
64
65
|
readonly splitJoin: readonly unknown[];
|
|
65
|
-
} | null): Node;
|
|
66
|
+
} | null): Node$1;
|
|
66
67
|
|
|
67
68
|
/** Why a whole-package replacement was refused. */
|
|
68
69
|
type PackageReplacementRefusal = 'missing-main-part' | 'different-main-part';
|
|
@@ -74,6 +75,84 @@ type PackageReplacementResult = {
|
|
|
74
75
|
readonly reason: PackageReplacementRefusal;
|
|
75
76
|
};
|
|
76
77
|
|
|
78
|
+
/**
|
|
79
|
+
* An element of a chart or workbook part. The reader types only WordprocessingML and the
|
|
80
|
+
* drawing anchor, so every element of these parts is a generic node.
|
|
81
|
+
*/
|
|
82
|
+
interface Element extends Omit<OoxmlGenericElementNode, 'children'> {
|
|
83
|
+
readonly children: readonly Node[];
|
|
84
|
+
}
|
|
85
|
+
/** A node of a chart or workbook part. */
|
|
86
|
+
type Node = Element | OoxmlTextNode;
|
|
87
|
+
|
|
88
|
+
/** The chart part behind one chart drawing. */
|
|
89
|
+
interface ChartTarget {
|
|
90
|
+
/** The story part that holds the drawing. */
|
|
91
|
+
readonly ownerPart: string;
|
|
92
|
+
/** The chart part. */
|
|
93
|
+
readonly part: string;
|
|
94
|
+
readonly chartSpace: Element;
|
|
95
|
+
}
|
|
96
|
+
/** A chart edit: the new chart part, and the new bytes of its embedded workbook. */
|
|
97
|
+
interface ChartEdit {
|
|
98
|
+
readonly chartSpace: Element;
|
|
99
|
+
readonly workbook?: {
|
|
100
|
+
readonly part: string;
|
|
101
|
+
readonly bytes: Uint8Array;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The result of a chart lane: the store's result, or a chart refusal key. */
|
|
106
|
+
type ChartIntentResult = ImageIntentResult | {
|
|
107
|
+
readonly ok: false;
|
|
108
|
+
readonly reason: 'chart';
|
|
109
|
+
readonly detail: string;
|
|
110
|
+
};
|
|
111
|
+
/** A chart insert at one place in a story. */
|
|
112
|
+
interface InsertChartInput {
|
|
113
|
+
/** Explicit left bias inserts before a leading prompt. */
|
|
114
|
+
readonly bias?: 'left' | 'right';
|
|
115
|
+
readonly paragraphId: string;
|
|
116
|
+
readonly offset: number;
|
|
117
|
+
readonly chartType: ChartType;
|
|
118
|
+
readonly data?: NewChartData;
|
|
119
|
+
readonly widthPoints: number;
|
|
120
|
+
readonly heightPoints: number;
|
|
121
|
+
/** The `wp:docPr` name, such as `Chart 1`. */
|
|
122
|
+
readonly name: string;
|
|
123
|
+
readonly expectedPackageRevision?: number;
|
|
124
|
+
readonly actorId?: string;
|
|
125
|
+
}
|
|
126
|
+
/** A chart copied out of a package: the package as it was, and the chart drawing in it. */
|
|
127
|
+
interface ChartCopySource {
|
|
128
|
+
readonly pkg: OoxmlPackage;
|
|
129
|
+
/** The story part that holds the drawing. */
|
|
130
|
+
readonly ownerPart: string;
|
|
131
|
+
/** The chart's `w:drawing`, as the source package holds it. */
|
|
132
|
+
readonly drawing: OoxmlElement;
|
|
133
|
+
}
|
|
134
|
+
/** A paste of a copied chart at one place in a story. */
|
|
135
|
+
interface DuplicateChartInput {
|
|
136
|
+
/** Explicit left bias inserts before a leading prompt. */
|
|
137
|
+
readonly bias?: 'left' | 'right';
|
|
138
|
+
readonly source: ChartCopySource;
|
|
139
|
+
readonly paragraphId: string;
|
|
140
|
+
readonly offset: number;
|
|
141
|
+
/** Ops that run first in the same unit, such as the removal of the selected text. */
|
|
142
|
+
readonly priorOps?: readonly TreeDocOp[];
|
|
143
|
+
readonly expectedPackageRevision?: number;
|
|
144
|
+
readonly actorId?: string;
|
|
145
|
+
}
|
|
146
|
+
/** The chart lanes of one package store, as the editor session hands them on. */
|
|
147
|
+
interface ChartLanes {
|
|
148
|
+
insert(scope: StoryScope, input: InsertChartInput): ChartIntentResult;
|
|
149
|
+
/** Insert a copy of a copied chart, as {@link duplicateChart} does. */
|
|
150
|
+
duplicate(scope: StoryScope, input: DuplicateChartInput): ChartIntentResult;
|
|
151
|
+
edit(scope: StoryScope, drawingNodeId: string, edit: (pkg: OoxmlPackage, target: ChartTarget) => ChartEdit, options?: {
|
|
152
|
+
readonly actorId?: string;
|
|
153
|
+
}): ChartIntentResult;
|
|
154
|
+
}
|
|
155
|
+
|
|
77
156
|
/**
|
|
78
157
|
* The faces a theme's font scheme offers, per script slot.
|
|
79
158
|
*
|
|
@@ -688,6 +767,8 @@ interface TreeDocxSessionView extends HeadlessDocumentView {
|
|
|
688
767
|
deleteImageTracked(scope: StoryScope, drawingNodeId: string, revision: RevisionAttributionInput): ImageIntentResult;
|
|
689
768
|
/** Apply image property tree ops plus hyperlink relationship wiring atomically. */
|
|
690
769
|
applyImageProperties(scope: StoryScope, input: ApplyImagePropertiesInput): ImageIntentResult;
|
|
770
|
+
/** Insert a chart, or edit the chart part behind a chart drawing, as one package undo unit. */
|
|
771
|
+
charts(): ChartLanes;
|
|
691
772
|
/** Land a clipboard fragment (resource merge + blocks) as one package undo unit. */
|
|
692
773
|
applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
693
774
|
/**
|
|
@@ -697,5 +778,5 @@ interface TreeDocxSessionView extends HeadlessDocumentView {
|
|
|
697
778
|
replacePackage(pkg: OoxmlPackage): PackageReplacementResult;
|
|
698
779
|
}
|
|
699
780
|
|
|
700
|
-
export { bodyParagraphs as
|
|
701
|
-
export type { DocumentStyleEntry as D, MapResult as M, PackageWriteOptions as P, TreeDocxSessionView as T, TreeApplyResult as a,
|
|
781
|
+
export { bodyParagraphs as f, docToTreeOps as g, partHasNode as p, reconcileDoc as r, treeToDoc as t };
|
|
782
|
+
export type { ChartCopySource as C, DocumentStyleEntry as D, InsertChartInput as I, MapResult as M, PackageWriteOptions as P, TreeDocxSessionView as T, TreeApplyResult as a, ChartLanes as b, DuplicateChartInput as c, TreeApplyOptions as d, TreeBindingRejection as e, ChartIntentResult as h, ChartTarget as i, ChartEdit as j, DocumentThemeColorEntry as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.0-canary.20261110032710.sha-525df6f",
|
|
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
|
"engines": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"directory": "packages/core"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@docx-editor.dev/i18n": "
|
|
108
|
+
"@docx-editor.dev/i18n": "2.37.0-canary.20261110032710.sha-525df6f",
|
|
109
109
|
"bidi-js": "1.1.0",
|
|
110
110
|
"emf-converter": "4.28.0",
|
|
111
111
|
"fast-xml-parser": "^5.10.1",
|
package/dist/chunk-3DLIAAXE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {R,Q as Q$1,T,S}from'./chunk-5JHQHJRH.js';import {h,a,b,e,c,f,te,Pc,Sc,Uc,Vc,Tc,ke,Qc,Rc,pd,mf,Od,Nf,Mf,d,F,zd,na,Dc,nf,md,qf}from'./chunk-PSVIEQUU.js';import {b as b$1}from'./chunk-6VTHQTM3.js';import {c as c$1,a as a$1,b as b$2}from'./chunk-2BVJFI6B.js';import {we as we$1,Ke,rb,Aa,pa,Ba,pd as pd$1,me as me$1,f as f$1,N,va,oa,a as a$2}from'./chunk-7MOZVKCN.js';var At=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function G(e){let t=new Map;for(let n of e)if(Array.isArray(n)){for(let o of n.slice(0,2048)){if(typeof o!="string"||!At.test(o))continue;let r=o.toLowerCase();if(t.has(r)||t.set(r,o),t.size===2048)break}if(t.size===2048)break}return Object.freeze([...t.values()])}function yn(e){let t=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(t===void 0||Array.isArray(t)&&t.length===0)?void 0:e}var it=64,de=Object.freeze({family:"Calibri",sizeHalfPoints:22}),Fn=de;function oe(e,...t){let n=[e,...t],o=[],r=new Set;for(let l of n)for(let u of l.sources??[]){let c=h(u.request);r.has(c)||(r.add(c),o.push(u));}let i=[],s=new Set;for(let l of n)for(let u of l.substitutions??[]){let c=h(u.from);r.has(c)||s.has(c)||(s.add(c),i.push(u));}let a$1=G(n.map(l=>l.supportedFamilies));return Object.freeze({...a$1.length?{supportedFamilies:a$1}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(o),...i.length>0?{substitutions:Object.freeze(i)}:{},defaultFont:e.defaultFont??de,...e.language!==void 0?{language:e.language}:{}})}var Rt=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function re(e){let t=e?.defaultFont?.family;return t!==void 0&&Rt.test(t)?t:de.family}function J(e){let t="deferred"in e?e.deferred:void 0;if(t===void 0)return {now:e};let{deferred:n,...o}=e;if(typeof t?.then!="function")return {now:o};let r=Promise.resolve(t);return r.catch(()=>{}),{now:o,later:r}}var at=new WeakSet;function kt(e){return e&&at.add(e),e}function lt(e,t){if(!t)return e;let n=e?me(e):void 0,o=t.deferred?{deferred:t.deferred}:{},r=at.has(t),i=r?t.supportedFamilies??[]:[...t.supportedFamilies??[],...n?.supportedFamilies??[]];return {...n,sources:r?t.sources??[]:[...t.sources??[],...n?.sources??[]],substitutions:r?t.substitutions??[]:[...t.substitutions??[],...n?.substitutions??[]],supportedFamilies:i.length>0?[...new Set(i)]:void 0,...o}}function Tt(e){return !!e&&((e.sources?.length??0)>0||(e.substitutions?.length??0)>0||e.deferred!==void 0)}function ut(e){let t=e&&"failures"in e?e.failures:void 0;return Array.isArray(t)?t.slice(0,256):[]}function ct(e,t){return t?t.aborted?Promise.reject(t.reason):new Promise((n,o)=>{let r=()=>o(t.reason);t.addEventListener("abort",r,{once:true}),Promise.resolve(e).then(i=>{t.removeEventListener("abort",r),n(i);},i=>{t.removeEventListener("abort",r),o(i);});}):Promise.resolve(e)}async function ft(e,t,n){let o="failures"in e?e.failures:void 0,r=s=>o===void 0?s:{...s,failures:o},i=e;for(let s=0;s<st;s+=1){let{now:a,later:l}=J(i);if(!l)return r(a);let u;try{u=await ct(l,n);}catch(c){if(n?.aborted)throw n.reason;return t(c),r(a)}for(let c of ut(u))t(c);i=lt(a,u)??a;}return t(new RangeError(`Font loading stopped after ${st} deferred steps`)),r(J(i).now)}var st=256;function me(e){if(!("failures"in e))return e;let{failures:t,...n}=e;return n}async function ge(e,t,n,o){let r=t.flatMap((a,l)=>a?[a.then(u=>({originIndex:l,ok:true,value:u??void 0}),u=>({originIndex:l,ok:false,cause:u}))]:[]);if(r.length===0)return;let i=await ct(Promise.race(r),n).catch(()=>{});if(!i||n?.aborted)return;if(i.ok)for(let a of ut(i.value))o.report(i.originIndex,a);else o.report(i.originIndex,i.cause);if(!i.ok||!Tt(i.value)){let a=t.map((l,u)=>u===i.originIndex?void 0:l);return ge(e,a,n,o)}let s=[];for(let a=0;a<Math.max(e.length,t.length);a+=1){let l=e[a],u=t[a];s.push(a===i.originIndex?lt(l,i.value):u?{...l??{sources:[]},deferred:u}:l);}try{return kt(await o.compose(s))}catch(a){n?.aborted||o.report(i.originIndex,a);return}}var Mt="docx-editor.dev/font-resolver",gt=Symbol.for("docx-editor.dev/font-resolver");function On(e){let t={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,gt,t),Object.defineProperty(e,Mt,t);}catch(n){throw new TypeError("defineFontResolver cannot mark a frozen or sealed function; mark it before freezing, or wrap it in a fresh function and mark that.",{cause:n})}return e}function An(e){return typeof e=="function"&&e[gt]===true}var ye=class extends RangeError{constructor(n,o,r){super(`Font source ${n.family} (${o} bytes) exceeds the shaping byte ceiling (${r} bytes)`);this.request=n;}request},Fe=class extends AggregateError{causes;constructor(t){let n=Object.freeze(t.slice(0,b*2));super(n,`Font origin rejected all ${n.length} face and substitution candidates`),this.causes=n;}},ie=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function vt(e,t,n){let o=new Map(e.map(r=>[ie(r),r]));for(let[r,i]of t)o.set(r,i);for(let r of n)o.has(ie(r.to))&&o.set(ie(r.from),r.from);return [...o.values()]}async function Rn(e,t,n={}){return he(e,t,n)}async function kn(e,t,n={}){return he(e,t,n)}async function he(e,t,n){let o=n.maxExecutionFontBytes??a;if(!Number.isSafeInteger(o)||o<=0||o>a)throw new RangeError("Font execution byte ceiling is outside the supported range");let r=e.map(_t),i,s=[],a$1=[],l=new Map,u=new Set,c=0,f=[],d=new Set,b$1=[],v=t.resolvedFaces??[],T=t.defaultFamily,C=[],P=[],g=new Set(n.placeholderOrigins??[]),x;for(let F=0;F<e.length;F+=1){pt(t.signal);let k=e[F],X=vt(v,l,f),q,B;try{let w=r[F],p;if(w){let m=await mt(w,t.signal);if(!m.ok)throw m.cause;p=m.value;}else if(typeof k=="function"){let m=await mt(Promise.resolve(k(Pt(t,T,X,c))).then(_=>({ok:!0,value:_}),_=>({ok:!1,cause:_})),t.signal);if(!m.ok)throw m.cause;p=m.value;}else p=k;if(p==null)continue;if(typeof p=="function"){K(n,k,F,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}if(n.awaitDeferred){let m=J(p);m.later&&dt(m.now,m.now)&&g.add(F),p=await ft(p,_=>K(n,k,F,_),t.signal);}else {let m=J(p);p=m.now,B=m.later;}let S="failures"in p?p.failures:void 0,O=[];if(Array.isArray(S)){let m=Math.min(S.length,b);for(let _=0;_<m;_++)O.push(S[_]);S.length>m&&O.push(new Error("Additional font-origin failures were omitted"));}else S!==void 0&&O.push(S);let A;try{A=Lt(p,u,c,d,i?"maxFontBytes"in i&&i.maxFontBytes!==void 0?i.maxFontBytes:a:void 0,n.reserveOwnedBytes,n.instrumentation,o);}catch(m){for(let _ of new Set(O))K(n,k,F,_);throw m}q=A;for(let m of new Set([...A.dropped,...O]))K(n,k,F,m);let E=A.fragment;E.supportedFamilies&&s.push(E.supportedFamilies),b$1.push(...O);let U=(E.sources??[]).map(m=>(h(m.request),[ie(m.request),m.request])),Y=[...E.substitutions??[]];B!==void 0&&dt(E,p)&&g.add(F);let $=g.has(F);!i&&!$&&"defaultFont"in E&&(T=re(E)),!i&&!$&&(i=E),$&&(x??=E);let z=new Set(A.sourceKeys);if(z.size>0){f=f.filter(m=>!z.has(h(m.from)));for(let m of z)d.delete(m);}a$1.push(...E.sources??[]);for(let m of A.sourceKeys)u.add(m);c+=A.ownedBytes;for(let[m,_]of U)l.set(m,_);for(let m of Y)f.push(m),d.add(h(m.from));C[F]=me(E),B&&(P[F]=B);}catch(w){if(q?.releaseOwnedBytes?.(),t.signal?.aborted)throw t.signal.reason??w;if(w instanceof se)throw w.cause;if(K(n,k,F,w),B){let p=new Error("Font origin skipped, so its background faces were not loaded");K(n,k,F,p);}continue}}let y=P.some(Boolean)?ge(C,P,t.signal,{compose:F=>he(F,t,{...n,placeholderOrigins:g}),report:(F,k)=>K(n,e[F],F,k)}):void 0;if(i??=x,!i)return y?{sources:[],deferred:y}:void 0;let{epoch:M,...R}=oe({...i,supportedFamilies:G(s),sources:a$1,substitutions:f}),D=y?{...R,deferred:y}:R;return b$1.length===0?D:{...D,failures:Object.freeze(b$1)}}function dt(e,t){return (e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&!("defaultFont"in t)&&!("maxFontBytes"in t)}var se=class extends Error{constructor(n){super("Unable to reserve owned font bytes");this.cause=n;this.name="FontOwnershipReservationError";}cause},ae=class extends RangeError{};async function mt(e,t){if(!t)return e;pt(t);let n,o=new Promise((i,s)=>{n=s;}),r=()=>n?.(t.reason);t.addEventListener("abort",r,{once:true});try{return await Promise.race([e,o])}finally{t.removeEventListener("abort",r);}}function _t(e){if(e===null||typeof e!="object")return;let t;try{t=e.then;}catch(n){return Promise.resolve({ok:false,cause:n})}if(typeof t=="function")return Promise.resolve(e).then(n=>({ok:true,value:n}),n=>({ok:false,cause:n}))}function Lt(e$1,t,n,o,r,i,s,a$1=a){let l=e$1.sources??[],u=e$1.substitutions??[],c$1="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,f$1="defaultFont"in e$1?e$1.defaultFont:void 0,d="epoch"in e$1?e$1.epoch:void 0,b$1="language"in e$1?e$1.language:void 0;if(!Array.isArray(l)||!Array.isArray(u))throw new TypeError("Font origin sources and substitutions must be arrays");let v=l.length,T=u.length;if(v>b)throw new RangeError(`Font source count must not exceed ${b}`);if(T>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let C=c$1??a;if(!Number.isSafeInteger(C)||C<=0||C>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let P=Math.min(r??C,a$1),g=0,x=[],y=new Set,M=[],R=[];for(let w=0;w<v;w+=1){let p=l[w];try{let S=pe(p.request),O=h(S);if(t.has(O)||y.has(O))continue;let A=p.availability,E=p.faceIndex,U=p.hash,Y=p.id;if(A!==void 0&&A!=="available"&&A!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(E)||E<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof U!="string"||U.length===0)throw new TypeError("Font source hash must be a non-empty string");let $;if(A!=="forbidden"){if(typeof Y!="string"||Y.length===0)throw new TypeError("Font source id must be a non-empty string");$=p.bytes;let z=e($);if(z>P)throw z<=(r??C)?new ye(S,z,a$1):new RangeError(`Font source ${S.family} (${z} bytes) exceeds the effective base byte ceiling (${P} bytes)`);if(t.has(O)||y.has(O))continue;if(n+g+z>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);g+=z;}else $=new Uint8Array(0);if(t.has(O)||y.has(O))continue;if(t.size+y.size>=b)throw new ae(`Font source count must not exceed ${b}`);y.add(O),x.push(O),M.push(Object.freeze({request:S,id:Y,bytes:$,hash:U,faceIndex:E,...A?{availability:A}:{}}));}catch(S){if(S instanceof ae)throw S;R.push(S);}}let D=new Set,F=[];for(let w=0;w<T;w+=1){let p=u[w];try{let S=pe(p.from),O=pe(p.to);h(S),h(O);let A=p.lineMetrics,E=A?Object.freeze({heightEm:A.heightEm,baselineEm:A.baselineEm}):void 0;if(E&&(!Number.isFinite(E.heightEm)||!Number.isFinite(E.baselineEm)||E.heightEm<=0||E.heightEm>4||E.baselineEm<0||E.baselineEm>E.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let U=h(S);if(t.has(U)||y.has(U)||o.has(U)||D.has(U))continue;D.add(U),F.push(Object.freeze({from:S,to:O,...E?{lineMetrics:E}:{}}));}catch(S){R.push(S);}}if((v>0||T>0)&&M.length===0&&F.length===0&&R.length>0)throw R.length===1?R[0]:new Fe(R);let k=o.size;for(let w of y)o.has(w)&&(k-=1);if(k+D.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let X;if(f$1!==void 0){let w=f$1.family,p=f$1.sizeHalfPoints;if(h({family:w,weight:400,style:"normal"}),!Number.isSafeInteger(p)||p<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");X=Object.freeze({family:w,sizeHalfPoints:p});}if(d!==void 0&&(!Number.isSafeInteger(d)||d<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(b$1!==void 0&&typeof b$1!="string")throw new TypeError("Font shaping language must be a string");let q;if(g>0&&i)try{q=i(g);}catch(w){throw new se(w)}let B;try{B=M.map(w=>f(w,s));}catch(w){throw q?.(),w}return {fragment:Object.freeze({supportedFamilies:G([e$1.supportedFamilies]),sources:Object.freeze(B),substitutions:Object.freeze(F),...d!==void 0?{epoch:d}:{},...c$1!==void 0?{maxFontBytes:c$1}:{},...X?{defaultFont:X}:{},...b$1!==void 0?{language:b$1}:{}}),sourceKeys:Object.freeze(x),ownedBytes:g,dropped:Object.freeze(R),releaseOwnedBytes:q}}function Nt(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function Pt(e,t,n,o){let{committedSourceBytes:r,...i}=e,s=Nt(o);return {...i,defaultFamily:t,...n.length>0?{resolvedFaces:n}:{},...s>0?{committedSourceBytes:s}:{}}}function pe(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function pt(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function K(e,t,n,o){let r;try{typeof t=="function"&&t.name.length>0&&(r=t.name);}catch{}try{o instanceof Error&&o.stack;}catch{}let i=Object.freeze({originIndex:n,...r!==void 0?{originName:r}:{},cause:o});if(e.onOriginFailure)try{let a=e.onOriginFailure(i);Promise.resolve(a).catch(l=>{console.warn("[fonts] font-origin diagnostic callback failed",l);});return}catch(a){console.warn("[fonts] font-origin diagnostic callback failed",a);}let s="";try{o instanceof Error&&o.message.length>0&&(s=`: ${o.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${s}`,o);}var It="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",be=256,Dt=31;function W(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===pa}function Z(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===pa)?.value}function we(e){let t=(e.relationships.get(e.mainDocumentPart)??[]).find(i=>i.type===It),n=t?N(t):void 0,r=((n?.mode==="Internal"&&n.target.ok?e.parts.get(n.target.partName):void 0)??e.parts.get("/word/fontTable.xml"))?.root;return r&&W(r,"fonts")?r:void 0}function Q(e,t){let n=e.children.find(o=>W(o,t));return n&&n.kind!=="textValue"?Z(n,"val"):void 0}function ht(e){let t=we(e),n=new Map;if(!t)return n;let o=0;for(let r of t.children){if(!W(r,"font"))continue;if(++o>be)break;let i=c$1(Z(r,"name"));if(!i)continue;let s=R(Q(r,"family"),Q(r,"pitch")),a=i.trim().toLowerCase();s&&!n.has(a)&&n.set(a,s);}return n}var Bt=new Set(["81","82"]),yt=new WeakMap,Ft=()=>false;function Nn(e){let t=we(e);if(!t)return Ft;let n=yt.get(t);if(n)return n;let o=new Set,r=0;for(let s of t.children){if(!W(s,"font"))continue;if(++r>be)break;let a=c$1(Z(s,"name")),l=Q(s,"charset")?.toLowerCase();!a||!l||!Bt.has(l)||R(Q(s,"family"),Q(s,"pitch"))==="serif"&&o.add(a.trim().toLowerCase());}let i=o.size===0?Ft:s=>o.has(s.trim().toLowerCase());return yt.set(t,i),i}function bt(e){let t=we(e),n=new Map;if(!t)return n;let o=0;for(let r of t.children){if(!W(r,"font"))continue;if(++o>be)break;let i=c$1(Z(r,"name"));if(!i)continue;let s=r.children.find(c=>W(c,"altName")),a=s&&s.kind!=="textValue"?Z(s,"val"):void 0,l=a!==void 0&&a.length<=Dt?a$1(a):null,u=i.trim().toLowerCase();l&&!n.has(u)&&n.set(u,l);}return n}function Ut(e,t,n){let o="";for(let r=t;r+1<t+n&&r+1<e.length;r+=2){let i=e[r]|e[r+1]<<8;if(i===0)break;o+=String.fromCharCode(i);}return o}function zt(e,t,n){let o="";for(let r=t;r<t+n&&r<e.length&&e[r]!==0;r++)o+=String.fromCharCode(e[r]);return o}function qt(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<8||n.getUint32(0,true)!==1)return;let o=0;for(let r=0;r<1e5&&o+8<=e.length;r++){let i=n.getUint32(o,true),s=n.getUint32(o+4,true);if(s<8||s%4!==0||o+s>e.length||(i===82&&s>=104&&t(Ut(e,o+40,64)),i===14))return;o+=s;}}function jt(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=e.length>=22&&n.getUint32(0,true)===2596720087?22:0;if(!(o+18>e.length||n.getUint16(o+2,true)!==9)){o+=18;for(let i=0;i<1e5&&o+6<=e.length;i++){let s=n.getUint32(o,true),a=n.getUint16(o+4,true);if(s<3||o+s*2>e.length||(a===763&&s*2>=25&&t(zt(e,o+6+18,Math.min(32,s*2-6-18))),a===0))return;o+=s*2;}}}function wt(e,t){let n=new Map,o=i=>{if(i.trim().toLowerCase()==="system")return;let s=t(i.trim());if(s===null||n.size>=16)return;let a=s.toLowerCase();n.has(a)||n.set(a,s);},r=0;for(let[i,s]of e.partBytes){let a=i.toLowerCase();if(!a.startsWith("/word/")||a.startsWith("/word/glossary/"))continue;let l=a.endsWith(".emf"),u=a.endsWith(".wmf");if(!(!l&&!u)){if(++r>64||n.size>=16)break;l?qt(s,o):jt(s,o);}}return [...n.values()]}var Xt=2e5,xt=32,$t=new Set(["latin","ea","cs"]);function Ht(e,t){let n=/^\+(mn|mj)-(lt|ea|cs)$/.exec(e);if(!n)return;let o=n[1]==="mj";return n[2]==="ea"?o?t.majorEastAsia:t.minorEastAsia:n[2]==="cs"?o?t.majorBidi:t.minorBidi:o?t.major:t.minor}var Et=new WeakMap;function Vt(e){let t=Et.get(e);if(t)return t;let n=[],o=new Set,r=[e],i=0;for(;r.length>0&&++i<=Xt&&n.length<xt;){let s=r.pop();if(s.namespaceUri===va&&$t.has(s.localName)){let a=oa(s.attributes,"typeface");a&&!o.has(a)&&(o.add(a),n.push(a));continue}for(let a=s.children.length-1;a>=0;a-=1){let l=s.children[a];l.kind!=="textValue"&&r.push(l);}}return Et.set(e,n),n}function Xn(e,t={}){let n=new Map,o=r=>{let i=r?b$1(r):null;if(i===null||n.size>=xt)return;let s=i.toLowerCase();n.has(s)||n.set(s,i);};for(let r of e.parts.values()){let i=r.root;if(!(i.namespaceUri!==we$1&&i.namespaceUri!==Ke)){o(t.minor);for(let s of Vt(i))s.startsWith("+")?o(Ht(s,t)):o(s);}}for(let r of wt(e,b$1))o(r);return [...n.values()]}var Kt=256,Wt=Object.freeze([]);function le(e){let t=new WeakMap;return (n,o)=>{let r=new Set;for(let i of n){let s=[{node:i,context:o,next:0}],a=l=>{s.pop();let u=s.at(-1)?.found??r;for(let c of l)u.add(c);};for(;s.length;){let l=s[s.length-1],u=t.get(l.node);if(u?.key===l.context.key){a(u.families);continue}if(!l.children){let d=e(l.node,l.context);l.children=d.children,l.found=new Set(d.families);}let c=l.children[l.next++];if(c){s.push({...c,next:0});continue}let f=l.found.size===0?Wt:[...l.found];f.length<=Kt&&rb(l.node)?t.set(l.node,{key:l.context.key,families:f}):t.delete(l.node),a(f);}}return [...r]}}function ue(e,t){return e.children.flatMap(n=>n.kind==="textValue"?[]:[{node:n,context:t}])}var St=new WeakMap,Yt=4096;function Ct(e,t){let n=`${e.baseKey}|${e.depth+1}|${JSON.stringify(t)}`,o=St.get(e);o||St.set(e,o=new Map);let r=o.get(n);if(r)return r;let i={...e,depth:e.depth+1,cellStyle:t,key:n};return o.size<Yt&&o.set(n,i),i}function Gt(e,t){let{styles:n,theme:o,supplementalFamilies:r,depth:i}=t;if(e.kind==="table"){let l=te(e,468,i,n),u=[];for(let c of l?.rows??[])for(let f of c.cells){let d=Ct(t,f.styleFormatting);for(let b of f.blocks)u.push({node:b,context:d});}return {children:u.reverse()}}let s=new Set;if(e.kind==="paragraph"){let l=e.children.find(c=>c.kind==="paragraphProperties"),u=nf(n,l,t.cellStyle).runProperties;for(let c of md(e,u,void 0,(f,d)=>qf(f,d,n),void 0,void 0,"all-markup",void 0,void 0,o)){if(!c.text||c.fontSlot!=="eastAsia"&&!r.has(c.style.fontFamily??""))continue;let f=b$1((c.fontSlot==="eastAsia"?c.style.fontFamilyEastAsia:c.style.fontFamily)??void 0);f&&s.add(f);}}let a=e.localName==="txbxContent"?{...t,cellStyle:void 0,key:`${t.baseKey}|${i}|undefined`}:t;return {families:[...s],children:ue(e,a).reverse()}}function Jt(){let e=le(Gt),t,n,o=(i,s)=>{if(!t||n!==i||t.theme!==s){let a=mf(i,s);n=i,t={key:`${a.cacheToken}|0|undefined`,baseKey:a.cacheToken,styles:a,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return t};return Object.assign((i,s,a)=>e([...i].reverse(),o(s,a)),{warmTableRows(i,s,a,l,u){let c=o(l,u),f=te(i,468,c.depth,c.styles)?.rows??[];for(let d of f.slice(s,a))for(let b of d.cells)e(b.blocks,Ct(c,b.styleFormatting));return f.length}})}function Qn(e,t,n){return Jt()(e,t,n)}function Ee(e,t){return e.attributes.find(n=>n.localName===t)?.value}var Qt=le((e,t)=>{let n=[];if(e.namespaceUri===pa){if(e.localName==="fldSimple"){let o=ke(Ee(e,"instr")??"")?.font;o&&n.push(o);}if(e.localName==="p")for(let o of Zt(e))n.push(o);}return {families:n,children:ue(e,t)}});function co(e){let t=new Map;for(let n of Qt(e,{key:""})){let o=b$1(n);o!==null&&!t.has(o.toLowerCase())&&t.set(o.toLowerCase(),o);}return [...t.values()]}function Zt(e){let t=[],n=Pc(),o=[];for(let r=e.children.length-1;r>=0;r-=1){let i=e.children[r];i.kind!=="textValue"&&o.push({node:i,containerDepth:0});}for(;o.length>0;){let{node:r,containerDepth:i}=o.pop();if(i>=Aa||r.namespaceUri===pa&&r.localName==="p")continue;if(r.namespaceUri===pa&&r.localName==="fldChar"){let a=Ee(r,"fldCharType");a==="begin"?Sc(n):a==="separate"?(n.nesting===1&&Ot(n,t),Uc(n)):a==="end"&&(n.nesting===1&&Ot(n,t),Vc(n));continue}if(r.namespaceUri===pa&&(r.localName==="instrText"||r.localName==="delInstrText")){Tc(n,en(r),r.localName==="delInstrText");continue}if(r.namespaceUri===pa&&r.localName==="fldSimple"){let a=ke(Ee(r,"instr")??"");a?.font&&t.push(a.font);}let s=Ba(r,i);for(let a=r.children.length-1;a>=0;a-=1){let l=r.children[a];l.kind!=="textValue"&&o.push({node:l,containerDepth:s});}}return Qc(n),t}function Ot(e,t){let n=Rc(e);if(n.overflow)return;let o=ke(n.instruction);o?.font&&t.push(o.font);}function en(e){let t="",n=[...e.children].reverse();for(;n.length>0&&t.length<=256;){let o=n.pop();if(o.kind==="textValue")t+=o.value;else for(let r=o.children.length-1;r>=0;r-=1)n.push(o.children[r]);}return t}var tn=()=>true,nn=/[ᄀ-ᇿ⺀-鿿ꥠ-가-豈-︰-﹏-]/u;function fo(e,t,n,o){if(!t)return [];let r=pd(t),i=mf(n,o),s=new Map;for(let a of e)for(let l of on(a)){let u=pd$1(l.children),c=f=>{if(f)for(let d of f.values()){let b=d.markerText===void 0||nn.test(d.markerText);for(let v of [d.markerStyle.fontFamily,b?d.markerStyle.fontFamilyEastAsia:null]){let T=b$1(v??void 0);if(T===null)continue;let C=T.toLowerCase();s.has(C)||s.set(C,T);}}};c(Od(u,r,i,tn));for(let f of u){let d=Nf(f);for(let b of d.contents)c(Mf(b,r,i));}}return [...s.values()].sort((a,l)=>a.localeCompare(l))}function on(e){if(e.localName==="document"){for(let t of e.children)if(t.kind!=="textValue"&&t.localName==="body")return [t];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let t=[];for(let n of e.children)n.kind!=="textValue"&&(n.localName==="footnote"||n.localName==="endnote")&&t.push(n);return t}return [e]}function Ro(e,t,n,o=[]){let r=new Set,i=new Set((o??[]).map(a=>a.from.family.trim().toLowerCase())),s=new Map;for(let a of e.substitutions??[]){let l=a.from.family.trim().toLowerCase();s.has(l)||s.set(l,a.to.family.trim().toLowerCase());}for(let a of e.substitutions??[]){let l=a.from.family.trim().toLowerCase(),u=a.to.family.trim().toLowerCase(),c=[t.alternates.get(l),t.fallbacks.get(l)].some(f=>{let d=f?.trim().toLowerCase();return d!==void 0&&d!==l&&(d===u||s.get(d)===u)});u!==l&&!i.has(l)&&c&&!(n.resolve(a.from)instanceof d)&&r.add(a.from.family.toLowerCase());}return r}function rn(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===pa)?.value}var sn=new Set(["document","hdr","ftr","footnotes","endnotes","comments","styles","numbering","glossaryDocument"]),an=new Set(["t","delText","instrText","delInstrText"]),ln=2e6;function un(e,t){let n=e.stylesRoot(),o=e.documentThemeFonts(),r=[...F(n),...n?zd(n).run:[]],i=na(r,o),s=a$1(i.fontFamily??void 0)??t,a=a$1(Dc([{text:"\xE9",props:r,style:i,start:0,end:1}],o)[0]?.style.fontFamily??void 0)??s,l=a$1(i.fontFamilyEastAsia??void 0),u=a$1(i.complexLane?.fontFamily??void 0)??o.minorBidi??t,c=ht(e.currentPackage()),f=g=>c.get(g.trim().toLowerCase())??S(g),d=(g,x)=>{let y=f(g);if(!y)return x;let M=f(x);return M===void 0||M===y?x:T[y]},b=new Map,v=new Map,T$1=0;for(let g of e.currentPackage().parts.values()){if(g.root.namespaceUri!==pa||!sn.has(g.root.localName))continue;let x=[g.root];for(;x.length>0&&T$1<ln;){T$1++;let y=x.pop();if(y.kind!=="textValue"){if(y.namespaceUri===pa){if(an.has(y.localName))continue;if(y.localName==="rFonts"){for(let[M,R]of [["ascii",s],["hAnsi",a],["eastAsia",l],["cs",u]]){let D=a$1(b$2(rn(y,M))??void 0);if(!D||!R)continue;let F=D.trim().toLowerCase(),k=b.get(F)??new Set,X=M==="ascii"||M==="hAnsi",q=X?d(D,R):R;if(k.add(q),b.set(F,k),X&&f(D)){let B=v.get(F)??new Set;B.add(q),v.set(F,B);}}continue}}for(let M of y.children)x.push(M);}}}for(let g of a$2)b.delete(g);let C=new Map,P=[];for(let[g,x]of b){let y=v.get(g);x.size===1?C.set(g,[...x][0]):y?.size===1?C.set(g,[...y][0]):P.push(g);}return {fallbacks:C,ambiguousFamilies:P,defaults:new Map([...b].map(([g,x])=>[g,[...x]]))}}function cn(e,t,n=[],o="Calibri"){let r=bt(e.currentPackage()),i=un(e,o),s=t.flatMap(u=>{let c=r.get(u.trim().toLowerCase());return c?[c]:[]}),a=new Map,l=t.flatMap(u=>i.defaults.get(u.trim().toLowerCase())??[]).filter(u=>u.trim().toLowerCase()!==o.trim().toLowerCase());for(let u of [...t,...s,...n,...l]){let c=a$1(u);if(c&&!a.has(c.trim().toLowerCase())&&a.set(c.trim().toLowerCase(),c),a.size===it)break}return {families:[...a.values()],alternates:r,fallbacks:i.fallbacks,ambiguousFamilies:i.ambiguousFamilies}}function ko(e,t,n){let o=re(n),r=cn(e,t,[],o);return {plan:r,request:{families:r.families,defaultFamily:o}}}function To(e,t,n=t.fallbacks){let o=new Map(e.sources.map(u=>[h(u.request),u.request])),r=[],i=new Set((e.substitutions??[]).map(u=>h(u.from))),s=new Map((e.substitutions??[]).map(u=>[h(u.from),u])),a=u=>{let c=o.get(h(u));if(c)return {to:c};let f=s.get(h(u)),d=f&&o.get(h(f.to));if(!(!f||!d))return f.lineMetrics?{to:d,lineMetrics:f.lineMetrics}:{to:d}},l=Math.max(0,b-i.size);for(let u of t.families){let c=u.trim().toLowerCase(),f=t.alternates.get(c),d=n.get(c),b=me$1(u);for(let v of [400,700])for(let T of ["normal","italic"]){let C={family:u,weight:v,style:T};if(o.has(h(C)))continue;let P=s.has(h(C));for(let g of P?[b,f]:[b,f,d]){if(!g||g.trim().toLowerCase()===c)continue;let x={family:g,weight:v,style:T},y=o.get(h(x)),M=P?y?{to:y}:void 0:a(x);if(!M)continue;if(!i.has(h(C))){if(l===0)break;l--;}let R=Q$1(u)?.em;r.push({from:C,...M,...R?{lineMetrics:R}:{}});break}}}return oe({...e,substitutions:[...r,...e.substitutions??[]]})}function Mo(e,t,n){let o=new Set((e.substitutions??[]).map(i=>h(i.from))),r=new Set;for(let i of t.substitutions??[]){if(o.has(h(i.from)))continue;let s=i.from.family.trim().toLowerCase(),a=i.to.family.trim().toLowerCase();[n.alternates.get(s),n.fallbacks.get(s)].some(u=>u?.trim().toLowerCase()===a)||r.add(s);}return r}function vo(e,t){let n=new Map;for(let[o,r]of e)t(o)||n.set(o,r);return n}var fn={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function No(e,t){let n=[],o=[],r=0;for(let i of e){let s=i.bytes.byteLength;if(!Number.isSafeInteger(s)||s>t||s>a||s>c-r){o.push(i);continue}r+=s,n.push(i);}return {sources:n,dropped:o}}function Po(e,t,n){let o=t.reduce((i,s)=>i+s.bytes.byteLength,0),r=new Set(t.filter(i=>i.request.family.trim().length>0).map(i=>h(i.request)));return dn(e,{maxFontBytes:n,aggregateBudget:Math.max(0,c-o),shadowedRequests:r})}function dn(e,t){let n=[],o=[],r=t.aggregateBudget,i=new Set;for(let s of e){let a=fn[s.style],l=Object.freeze({family:s.family,weight:a.weight,style:a.style});if(s.family.trim().length===0){o.push({request:l,partName:s.partName,reason:"malformed"});continue}let u=h(l);if(!(t.shadowedRequests?.has(u)||i.has(u))){if(i.add(u),s.bytes.byteLength>t.maxFontBytes||s.bytes.byteLength>r){o.push({request:l,partName:s.partName,reason:"overLimit"});continue}r-=s.bytes.byteLength,n.push({request:l,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:f$1(s.bytes),faceIndex:0});}}return {sources:n,dropped:o}}
|
|
2
|
-
export{co as A,Zt as B,fo as C,Ro as D,cn as E,ko as F,To as G,Mo as H,vo as I,No as J,Po as K,dn as L,G as a,yn as b,it as c,de as d,Fn as e,oe as f,re as g,J as h,lt as i,Tt as j,ut as k,me as l,Mt as m,gt as n,On as o,An as p,ye as q,Fe as r,Rn as s,kn as t,Nn as u,Xn as v,le as w,ue as x,Jt as y,Qn as z};
|