@docx-editor.dev/core 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.cjs +1 -1
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +7 -7
- package/dist/binding.d.ts +7 -7
- package/dist/binding.js +1 -1
- package/dist/chunk-6JWP2H7K.js +2 -0
- package/dist/chunk-6KNLLEUW.cjs +18 -0
- package/dist/chunk-7ADTI533.cjs +10 -0
- package/dist/chunk-7ETDCPF6.cjs +2 -0
- package/dist/chunk-7I3BSGGS.js +1 -0
- package/dist/{chunk-XMHWBL3K.cjs → chunk-7UU5YFCD.cjs} +1 -1
- package/dist/chunk-CKDAK3MV.js +10 -0
- package/dist/chunk-DIMEYVNS.js +2 -0
- package/dist/{chunk-IEXDXWTA.cjs → chunk-H2656QDI.cjs} +1 -1
- package/dist/chunk-KQGENNL5.cjs +15 -0
- package/dist/chunk-LIXPSV4T.js +18 -0
- package/dist/{chunk-DKMKH77K.cjs → chunk-O4UULRAQ.cjs} +5 -5
- package/dist/chunk-SIIFNE6U.js +15 -0
- package/dist/chunk-VXYECPKA.js +5 -0
- package/dist/contracts/editor.d.cts +6 -6
- package/dist/contracts/editor.d.ts +6 -6
- package/dist/contracts/interaction.d.cts +6 -6
- package/dist/contracts/interaction.d.ts +6 -6
- package/dist/contracts/modules.d.cts +3 -3
- package/dist/contracts/modules.d.ts +3 -3
- package/dist/{custom-node-writes-QyVZdTUA.d.ts → custom-node-writes-D6SGwebL.d.ts} +20 -4
- package/dist/{custom-node-writes-7ERv0f_X.d.cts → custom-node-writes-Dy3b20PS.d.cts} +20 -4
- package/dist/{editor-PUlv5Pp7.d.ts → editor-Cvd7Geoc.d.ts} +4 -4
- package/dist/{editor-CojjwMmF.d.cts → editor-cAEf1uXW.d.cts} +4 -4
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +9 -5
- package/dist/editor.d.cts +18 -18
- package/dist/editor.d.ts +18 -18
- package/dist/editor.js +1 -1
- package/dist/{image-resources-eZqD_-vC.d.ts → image-resources-BgA9EQxY.d.ts} +1 -1
- package/dist/{image-resources-DQOiwOuE.d.cts → image-resources-BiA-IXgo.d.cts} +1 -1
- package/dist/{index-oN-v8DQ5.d.ts → index-DRqY5JVF.d.ts} +58 -12
- package/dist/{index-DGPSeLI0.d.cts → index-wb-iOxfh.d.cts} +58 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +334 -306
- package/dist/layout.d.ts +334 -306
- package/dist/layout.js +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +5 -5
- package/dist/output.d.ts +5 -5
- package/dist/output.js +1 -1
- package/dist/{review-items-DpsqTHio.d.cts → review-items-B8tffIXj.d.cts} +1 -1
- package/dist/{review-items-D5SPFtsO.d.ts → review-items-bdGxFWNA.d.ts} +1 -1
- package/dist/{review-reads-CP106AHp.d.cts → review-reads-Bxz03tHG.d.cts} +1 -1
- package/dist/{review-reads-B2Ji3fVU.d.ts → review-reads-CHODU0LI.d.ts} +1 -1
- package/dist/{semantic-cell-selection-DJPjBWzf.d.cts → semantic-cell-selection-BPzx6DdT.d.cts} +2 -2
- package/dist/{semantic-cell-selection-BWhVAk5B.d.ts → semantic-cell-selection-CsHcr-yk.d.ts} +2 -2
- package/dist/{semantic-interaction-BjOcDB06.d.cts → semantic-interaction-BfWDD_0V.d.cts} +1 -1
- package/dist/{semantic-interaction-Cca1-X_a.d.ts → semantic-interaction-D-RZ9Ust.d.ts} +1 -1
- package/dist/{semantic-paint-Ur7pAINj.d.cts → semantic-paint-Bd7EqzXV.d.cts} +2 -2
- package/dist/{semantic-paint-CufpIQFw.d.ts → semantic-paint-WhVtSDJK.d.ts} +2 -2
- package/dist/{semantic-records-Cc1MJrhM.d.ts → semantic-records-DCt-ZwKU.d.ts} +22 -4
- package/dist/{semantic-records-C3Z76KeN.d.cts → semantic-records-DadVT_E1.d.cts} +22 -4
- package/dist/{shaped-measurer-CwlTPDJO.d.ts → shaped-measurer-B9f4A7QA.d.ts} +1 -1
- package/dist/{shaped-measurer-CYSK20E2.d.cts → shaped-measurer-CninrHr_.d.cts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +131 -131
- package/dist/store.d.ts +131 -131
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-XMVsJSpe.d.ts → tree-op-types-CnRb7AYo.d.ts} +22 -1
- package/dist/{tree-op-types-B0-sCtw-.d.cts → tree-op-types-D1vNJ7XC.d.cts} +22 -1
- package/dist/{tree-session-D945D43B.d.cts → tree-session-Df02ajqc.d.cts} +5 -5
- package/dist/{tree-session-DBJgmdmc.d.ts → tree-session-ZuBFOhIh.d.ts} +5 -5
- package/dist/{tree-store-C6vc8E_2.d.cts → tree-store-B_sJBMIS.d.cts} +1 -1
- package/dist/{tree-store-ClA-qng4.d.ts → tree-store-DgETo6Mf.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-5VC5HGJA.js +0 -2
- package/dist/chunk-A2JIBG75.js +0 -1
- package/dist/chunk-FWUI7EXG.cjs +0 -15
- package/dist/chunk-GZWMLQJO.js +0 -18
- package/dist/chunk-IMMAG4QP.cjs +0 -10
- package/dist/chunk-JTSNJQFO.js +0 -15
- package/dist/chunk-KBCC66CI.js +0 -5
- package/dist/chunk-LJ6BY6IU.cjs +0 -18
- package/dist/chunk-QDBAXFIK.js +0 -2
- package/dist/chunk-RD266XSK.cjs +0 -2
- package/dist/chunk-VUJGPCPU.js +0 -10
package/dist/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{j as Budget,i as BudgetError,z as COMPARATORS,l as CancellationController,k as CancellationError,P as DEFAULT_VIEW_SETTINGS,o as DeterministicClock,v as DeterministicMemoryMeter,a as ID_KINDS,t as LIMIT_KEYS,s as LIMIT_SPECS,N as NO_TRACKING_SETTINGS,n as PortRegistry,m as PortResolutionError,g as RegistryError,p as SequentialIdentity,w as assertLimitInvariants,c as assertValidId,q as beginOperation,x as canonicalize,A as compareArtifacts,e as compareSemVer,F as deobfuscateFont,K as diffSemanticDigests,I as digestPart,r as endOperation,L as ensureListDefinition,M as ensureNumberingLevel,B as fingerprint,E as hashAuthored,b as isValidId,u as makeLimitCounter,d as parseSemVer,G as readEmbeddedFonts,O as readTrackingSettings,Q as readViewSettings,D as replayFixture,h as resolve,H as resolveTocRowHeadings,f as satisfies,J as semanticDigest,y as stableHash,C as validateFixture,T as withExportedCustomNodes}from'./chunk-5VC5HGJA.js';export{Hf as ACCEPTED_PARAGRAPH_PROPERTIES,Gf as ACCEPTED_RUN_PROPERTIES,h as ALL_FROZEN_IDS,dg as AUTHORABLE_PARAGRAPH_PROPERTIES,eg as AUTHORABLE_RUN_PROPERTIES,p as BoundedCounter,c as CANONICAL_MUTATION_ORIGINS,je as CONTENT_CONTROL_ID_MAX,Be as CONTENT_CONTROL_PROPERTY_ORDER,if as CUSTOM_NODE_XPATH_PREFIX,Ve as CUSTOM_XML_PROPS_REL,We as CUSTOM_XML_PROPS_TYPE,Ue as CUSTOM_XML_REL,G as DANGEROUS_KEYS,Xe as DATASTORE_NAMESPACE_URI,Ed as DEFAULT_ENDNOTE_PROPERTIES,Dd as DEFAULT_FOOTNOTE_PROPERTIES,m as DEFAULT_IMAGE_RESOURCE_LIMITS,j as DEFAULT_LIMITS,Nf as DEFAULT_MAX_EDITABLE_STORY_PARTS,Bb as DEFAULT_OMML_LIMITS,nb as DEFAULT_OOXML_PACKAGE_LIMITS,Ca as DEFAULT_ZIP_LIMITS,g as DEPENDENCY_KEY_IDS,H as DangerousKeyError,Zb as FIELD_ATOM_CHAR,i as HARD_CEILINGS,Ga as HYPERLINK_RELATIONSHIP_TYPE,C as IMAGE_RELATIONSHIP_TYPE,l as IMAGE_RESOURCE_HARD_CEILINGS,Na as IMAGE_WRAP_TARGETS,Q as INERT_EXECUTABLE_KINDS,o as LimitExceededError,ie as MAX_CONTENT_CONTROLS_PER_PART,he as MAX_CONTENT_CONTROL_NESTING,Zf as MAX_CUSTOM_NODE_LABEL_LENGTH,Yf as MAX_CUSTOM_NODE_PAYLOAD_LENGTH,zd as MAX_NOTES_PER_PART,Yd as MAX_NOTE_REFERENCE_PARTS,Xd as MAX_NOTE_REFERENCE_SCAN,Ee as MAX_STORY_SDT_NESTING,_a as MAX_SVG_SNIFF_BYTES,d as NON_CANONICAL_ORIGINS,ad as NOTE_ATOM_CHAR,ed as NOTE_CONTINUATION_SEPARATOR_ID,cd as NOTE_ID_MAX,bd as NOTE_ID_MIN,dd as NOTE_SEPARATOR_ID,Ab as OFFICE_MATH_NAMESPACE_URI,Fa as OFFICE_RELATIONSHIP_NAMESPACE_URI,qa as OOXML_NODE_IDENTITY_RULES,b as ORIGIN_IDS,Ub as PAGE_BREAK_CHAR,aa as PrefixAllocator,e as RESULT_IDS,f as RUNTIME_PORT_IDS,Jg as SEARCH_MATCH_LIMIT,Ig as SEARCH_QUERY_MAX,uf as TABLE_BORDER_STYLES,Fc as TOC_LEVEL_INDENT_TWIPS,tc as TOC_MAX_BOOKMARKS_PER_REFRESH,sc as TOC_MAX_ENTRIES,uc as TOC_MAX_FIELD_NESTING,rc as TOC_MAX_INSTRUCTION_CHARS,vc as TOC_MAX_PAGE_PASSES,If as TREE_DOC_OP_KINDS,Ac as TWIPS_PER_POINT,Mf as TreeDocumentStore,Of as TreePackageStore,Le as W15_NAMESPACE_URI,ca as WML_NAMESPACE_URI,ea as XMLNS_NAMESPACE_URI,da as XML_NAMESPACE_URI,Tf as addComment,De as allocateContentControlId,jb as allocateDrawingPropertyId,Ad as allocateNoteId,Ba as applyEdits,$c as applyHeaderFooterLifecycleOp,fe as applyNoteLifecycleOp,Kf as applyTreeOp,t as asciiFold,$ as assertValidQName,pc as atomicFieldSpansOf,yd as atomicNoteSpansOf,Xc as authorableHyperlinkTarget,Kd as authoredDocumentEndnoteProperties,Jd as authoredDocumentFootnoteProperties,Hd as authoredEndnotePropertiesFromSectPr,Gd as authoredFootnotePropertiesFromSectPr,hg as authoredProperties,He as bodyStoryRoot,Lc as bookmarkPairNodes,mf as boundCustomXmlNodeIdOf,kf as boundCustomXmlNodeIds,lf as boundCustomXmlNodeIdsInPackage,zc as buildBookmarkIndex,A as buildContentTypeIndex,D as buildRelationshipSet,Ic as buildTocContentControl,Hc as buildTocEntryParagraph,na as canonicalOoxmlFingerprint,ge as cascadeDeletedNoteReferences,Te as cascadeEmptiedComments,X as childElements,Lb as collectFlowBlocks,sa as collectNodeIds,$d as collectNoteReferences,ae as collectPackageNoteReferences,Eg as collectReviewItems,nf as collectRevisionSites,Pb as collectSectionPropertyNodes,Je as collectStoryParagraphs,Me as commentAnchorsOfStory,Ag as commentBodyText,Bg as commentInitials,Dg as commentItemsOf,Wf as commentPartNameOf,Xf as commentsExtendedPartNameOf,Ne as commentsOfPart,P as containsCssFetch,ne as contentControlContentChildren,re as contentControlContentNodeOf,Jb as contentControlContentOf,qe as contentControlEndPropertiesNodeOf,ue as contentControlLevelOf,pe as contentControlPropertiesNodeOf,te as contentControlPropertiesOf,xe as contentControlTextOf,ve as contentControlsIn,rb as contentTypesPartBytes,ib as createImageResourceCache,ta as createNodeIdAllocator,Zd as createNoteReferenceScanBudget,vd as customMarkFollows,jf as customNodeBinding,bg as customNodePayloadsByControl,cg as customNodePayloadsOf,Ze as customXmlDataParts,gf as customXmlLabelXPath,bf as customXmlNodes,hf as customXmlPrefixMappings,Ye as datastoreItemIdFor,Hg as deepParagraphOrderOfPart,Qe as deleteCommentThread,Oc as deriveOoxmlIndexes,xc as detectBodyTocs,v as detectDuplicateNames,be as diagnoseNoteReferences,jg as directParagraphMarkProperties,ig as directParagraphProperties,Cf as drawingOpImpact,Yc as ensureHyperlinkRelationship,Eb as equationExpressionToLinearMath,O as escapeCssString,M as escapeXml,z as extensionKey,jc as fieldAtomText,ic as fieldOnOffAttribute,we as findContentControl,_e as findCustomXmlDataPart,yc as findDetectedToc,W as findElement,va as findNode,Cd as findNoteById,Ng as findOccurrences,vg as firstReviewRange,oe as flattenContentControls,_b as fldCharType,hc as fldSimpleInstr,Rc as fnv1a32,Kg as foldCase,gd as formatNoteScopeId,ng as formatOwnedRunIds,Yb as hardBreakAttributes,Vb as hardBreakKind,Xb as hardBreakText,Pe as hasAnyComment,$a as hasBoundedSvgRoot,Vf as hasCommentPart,lc as hasLegacyFormFieldData,ua as hasNode,Ia as hyperlinkAnchorOf,Ja as hyperlinkRelationshipIdOf,Ka as hyperlinkTargetOf,hb as imageResourceLookupFor,Mc as indexStyles,Vd as inlineControlEndingAt,Wd as inlineControlStartingAt,ya as insertChildren,_f as insertCustomNodeWrite,gc as instrTextValue,fg as isAuthorableRunProperty,Hb as isContentControl,Ib as isContentControlContent,le as isContentControlContentNode,ke as isContentControlNode,me as isContentControlWrapper,ha as isContentRevisionKind,od as isContinuationSeparatorNode,I as isDangerousKey,Ff as isDrawingTreeDocOp,jd as isEndnotesNode,S as isEvaluableField,kc as isFieldChrome,cc as isFldChar,$b as isFldCharNode,fc as isFldSimple,bc as isFldSimpleNode,id as isFootnotesNode,_c as isHeaderFooterLifecycleOp,Ha as isHyperlinkNode,R as isInertExecutable,dc as isInstrText,ac as isInstrTextNode,Nd as isLegalEndnotePosition,qc as isLegalFldCharType,Od as isLegalFootnotePosition,Pd as isLegalNumRestart,sd as isNormalNote,xd as isNoteAtomNode,ee as isNoteLifecycleOp,kd as isNoteNode,md as isNoteRefNode,ld as isNoteReferenceNode,Wb as isPageBreakNode,ia as isRangeMarkerKind,Mg as isSearchableQuery,nd as isSeparatorNode,Ge as isStoryPart,y as isValidMime,Z as isValidNCName,Pc as isValidParaId,_ as isValidQName,Lg as isWholeWord,Fb as linearMathToOmml,Fg as linkRevisionReplies,gb as liveDrawingReferenceCount,sg as locateSites,ze as lockForbidsEdit,Ae as lockForbidsRemoval,lg as mergedFontProperty,og as mergedMultiSettingProperty,pg as mergedParagraphMarkProperties,kg as mergedProperties,Sc as mintParaId,Vc as mintedParagraphIdentityAttributes,de as normalNoteIds,Wc as normalizeParagraphIdentity,r as normalizePartName,wd as noteAtomText,qd as noteIdOf,pd as noteKindOf,ud as noteRefKindOf,td as noteReferenceKindOf,rd as noteTypeOf,Bd as notesOf,ce as notesPartHasId,J as nullRecord,oa as ooxmlTreesEqual,Ce as orderedContentControlProperties,Qc as paraIdOf,Ud as paragraphOffsetIndex,Gg as paragraphOrderOfPart,Lf as paragraphTextOf,wa as parentNodeOf,Fd as parseAuthoredNoteProperties,se as parseContentControlId,Db as parseLinearMath,fd as parseNoteId,hd as parseNoteScopeId,wc as parseTocInstruction,u as partNameKey,Kc as planTocEntries,Cc as points,Ec as pointsToTwips,Ua as projectDrawing,Cb as projectOmmlEquation,gg as propertyContainer,cf as readCustomXmlNode,ja as readOnOffChild,ob as readOoxmlPackage,ra as readOoxmlPart,V as readXml,Da as readZip,Zc as relationshipTargetIn,sb as relationshipsOf,ub as relsPartNameFor,$f as removeCustomNodeWrite,Aa as removeNode,xa as replaceChildren,za as replaceNode,ye as resolveContentControlLock,B as resolveContentType,tb as resolveContentTypeOf,Md as resolveEndnoteProperties,Ld as resolveFootnoteProperties,Tb as resolveHeaderFooterParts,Sb as resolveHeaderFooterPartsBySection,Rb as resolveHeaderFooterResolutionBySection,F as resolveImageRelationship,n as resolveImageResourceLimits,w as resolveInternalTarget,k as resolveLimits,_d as resolveNotesPart,E as resolveRelationship,tg as reviewItemKey,ug as reviewItemRanges,Cg as revisionItemsOf,mg as runAddressRanges,qg as runPropertyEdits,rg as runsCovering,L as sanitizeHref,T as scrubExport,Td as segmentsOf,ka as serializeOoxmlPart,Uf as setCommentResolved,Id as settingsPartOf,ab as sniffImageMime,Ie as storyParagraphs,Fe as storyRootsOf,Nc as stylesPartOf,ag as sweepCustomNodePayloads,Y as textContent,Oe as threadStateOfPart,K as toSafeRecord,Jc as tocEntryText,Gc as tocLeftIndentTwips,Bc as twips,Dc as twipsToPoints,Tc as usedParaIds,Df as validateDrawingOp,x as validateExternalTarget,cb as validateGifHeader,db as validateJpegHeader,pa as validateOoxmlPart,zb as validatePackageInvariants,bb as validatePngHeader,fb as validateRasterHeader,Jf as validateTreeOp,Uc as w14RootPrefix,Nb as walkAllStoryParagraphs,Ob as walkParagraphInline,Mb as walkStoryBlocks,kb as withBinaryPart,vb as withContentTypeOverride,$e as withCustomXmlDataPart,df as withCustomXmlNode,lb as withEmbeddedImage,yb as withNewPart,qb as withPart,xb as withRelationship,af as withoutCustomXmlDataPart,ef as withoutCustomXmlNode,ff as withoutOrphanCustomXmlNodes,mb as withoutUnreferencedImagePart,Ef as wrapTargetToAnchorSpec,pb as writeOoxmlPackage,Ea as writeZip}from'./chunk-VUJGPCPU.js';
|
|
1
|
+
export{j as Budget,i as BudgetError,z as COMPARATORS,l as CancellationController,k as CancellationError,P as DEFAULT_VIEW_SETTINGS,o as DeterministicClock,v as DeterministicMemoryMeter,a as ID_KINDS,t as LIMIT_KEYS,s as LIMIT_SPECS,N as NO_TRACKING_SETTINGS,n as PortRegistry,m as PortResolutionError,g as RegistryError,p as SequentialIdentity,w as assertLimitInvariants,c as assertValidId,q as beginOperation,x as canonicalize,A as compareArtifacts,e as compareSemVer,F as deobfuscateFont,K as diffSemanticDigests,I as digestPart,r as endOperation,L as ensureListDefinition,M as ensureNumberingLevel,B as fingerprint,E as hashAuthored,b as isValidId,u as makeLimitCounter,d as parseSemVer,G as readEmbeddedFonts,O as readTrackingSettings,Q as readViewSettings,D as replayFixture,h as resolve,H as resolveTocRowHeadings,f as satisfies,J as semanticDigest,y as stableHash,C as validateFixture,T as withExportedCustomNodes}from'./chunk-DIMEYVNS.js';export{he as ACCEPTED_PARAGRAPH_PROPERTIES,ge as ACCEPTED_RUN_PROPERTIES,h as ALL_FROZEN_IDS,gg as AUTHORABLE_PARAGRAPH_PROPERTIES,hg as AUTHORABLE_RUN_PROPERTIES,p as BoundedCounter,c as CANONICAL_MUTATION_ORIGINS,oe as CONTENT_CONTROL_ID_MAX,Ge as CONTENT_CONTROL_PROPERTY_ORDER,nf as CUSTOM_NODE_XPATH_PREFIX,_e as CUSTOM_XML_PROPS_REL,$e as CUSTOM_XML_PROPS_TYPE,Ze as CUSTOM_XML_REL,G as DANGEROUS_KEYS,af as DATASTORE_NAMESPACE_URI,Ed as DEFAULT_ENDNOTE_PROPERTIES,Dd as DEFAULT_FOOTNOTE_PROPERTIES,m as DEFAULT_IMAGE_RESOURCE_LIMITS,j as DEFAULT_LIMITS,Qf as DEFAULT_MAX_EDITABLE_STORY_PARTS,Bb as DEFAULT_OMML_LIMITS,nb as DEFAULT_OOXML_PACKAGE_LIMITS,Ca as DEFAULT_ZIP_LIMITS,g as DEPENDENCY_KEY_IDS,H as DangerousKeyError,Zb as FIELD_ATOM_CHAR,i as HARD_CEILINGS,Ga as HYPERLINK_RELATIONSHIP_TYPE,C as IMAGE_RELATIONSHIP_TYPE,l as IMAGE_RESOURCE_HARD_CEILINGS,Na as IMAGE_WRAP_TARGETS,Q as INERT_EXECUTABLE_KINDS,o as LimitExceededError,ne as MAX_CONTENT_CONTROLS_PER_PART,me as MAX_CONTENT_CONTROL_NESTING,ag as MAX_CUSTOM_NODE_LABEL_LENGTH,$f as MAX_CUSTOM_NODE_PAYLOAD_LENGTH,zd as MAX_NOTES_PER_PART,Yd as MAX_NOTE_REFERENCE_PARTS,Xd as MAX_NOTE_REFERENCE_SCAN,Je as MAX_STORY_SDT_NESTING,_a as MAX_SVG_SNIFF_BYTES,d as NON_CANONICAL_ORIGINS,ad as NOTE_ATOM_CHAR,ed as NOTE_CONTINUATION_SEPARATOR_ID,cd as NOTE_ID_MAX,bd as NOTE_ID_MIN,dd as NOTE_SEPARATOR_ID,Ab as OFFICE_MATH_NAMESPACE_URI,Fa as OFFICE_RELATIONSHIP_NAMESPACE_URI,qa as OOXML_NODE_IDENTITY_RULES,b as ORIGIN_IDS,Ub as PAGE_BREAK_CHAR,aa as PrefixAllocator,e as RESULT_IDS,f as RUNTIME_PORT_IDS,Mg as SEARCH_MATCH_LIMIT,Lg as SEARCH_QUERY_MAX,yf as TABLE_BORDER_STYLES,Fc as TOC_LEVEL_INDENT_TWIPS,tc as TOC_MAX_BOOKMARKS_PER_REFRESH,sc as TOC_MAX_ENTRIES,uc as TOC_MAX_FIELD_NESTING,rc as TOC_MAX_INSTRUCTION_CHARS,vc as TOC_MAX_PAGE_PASSES,ie as TREE_DOC_OP_KINDS,Ac as TWIPS_PER_POINT,Pf as TreeDocumentStore,Rf as TreePackageStore,Qe as W15_NAMESPACE_URI,ca as WML_NAMESPACE_URI,ea as XMLNS_NAMESPACE_URI,da as XML_NAMESPACE_URI,Wf as addComment,Ie as allocateContentControlId,jb as allocateDrawingPropertyId,Ad as allocateNoteId,Ba as applyEdits,$c as applyHeaderFooterLifecycleOp,ke as applyNoteLifecycleOp,Nf as applyTreeOp,t as asciiFold,$ as assertValidQName,pc as atomicFieldSpansOf,yd as atomicNoteSpansOf,Xc as authorableHyperlinkTarget,Kd as authoredDocumentEndnoteProperties,Jd as authoredDocumentFootnoteProperties,Hd as authoredEndnotePropertiesFromSectPr,Gd as authoredFootnotePropertiesFromSectPr,kg as authoredProperties,Me as bodyStoryRoot,Lc as bookmarkPairNodes,rf as boundCustomXmlNodeIdOf,pf as boundCustomXmlNodeIds,qf as boundCustomXmlNodeIdsInPackage,zc as buildBookmarkIndex,A as buildContentTypeIndex,D as buildRelationshipSet,Ic as buildTocContentControl,Hc as buildTocEntryParagraph,na as canonicalOoxmlFingerprint,le as cascadeDeletedNoteReferences,Ye as cascadeEmptiedComments,X as childElements,Lb as collectFlowBlocks,sa as collectNodeIds,$d as collectNoteReferences,ae as collectPackageNoteReferences,Hg as collectReviewItems,sf as collectRevisionSites,Pb as collectSectionPropertyNodes,Oe as collectStoryParagraphs,Re as commentAnchorsOfStory,Dg as commentBodyText,Eg as commentInitials,Gg as commentItemsOf,Zf as commentPartNameOf,_f as commentsExtendedPartNameOf,Se as commentsOfPart,P as containsCssFetch,se as contentControlContentChildren,we as contentControlContentNodeOf,Jb as contentControlContentOf,ve as contentControlEndPropertiesNodeOf,ze as contentControlLevelOf,ue as contentControlPropertiesNodeOf,ye as contentControlPropertiesOf,Ce as contentControlTextOf,Ae as contentControlsIn,rb as contentTypesPartBytes,ib as createImageResourceCache,ta as createNodeIdAllocator,Zd as createNoteReferenceScanBudget,vd as customMarkFollows,of as customNodeBinding,eg as customNodePayloadsByControl,fg as customNodePayloadsOf,cf as customXmlDataParts,lf as customXmlLabelXPath,gf as customXmlNodes,mf as customXmlPrefixMappings,bf as datastoreItemIdFor,Kg as deepParagraphOrderOfPart,Ve as deleteCommentThread,Oc as deriveOoxmlIndexes,xc as detectBodyTocs,v as detectDuplicateNames,be as diagnoseNoteReferences,mg as directParagraphMarkProperties,lg as directParagraphProperties,Hf as drawingOpImpact,Yc as ensureHyperlinkRelationship,Eb as equationExpressionToLinearMath,O as escapeCssString,M as escapeXml,z as extensionKey,jc as fieldAtomText,ic as fieldOnOffAttribute,Be as findContentControl,df as findCustomXmlDataPart,yc as findDetectedToc,W as findElement,va as findNode,Cd as findNoteById,Qg as findOccurrences,yg as firstReviewRange,te as flattenContentControls,_b as fldCharType,hc as fldSimpleInstr,Rc as fnv1a32,Ng as foldCase,gd as formatNoteScopeId,qg as formatOwnedRunIds,Yb as hardBreakAttributes,Vb as hardBreakKind,Xb as hardBreakText,Ue as hasAnyComment,$a as hasBoundedSvgRoot,Yf as hasCommentPart,lc as hasLegacyFormFieldData,ua as hasNode,Ia as hyperlinkAnchorOf,Ja as hyperlinkRelationshipIdOf,Ka as hyperlinkTargetOf,hb as imageResourceLookupFor,Mc as indexStyles,Vd as inlineControlEndingAt,Wd as inlineControlStartingAt,ya as insertChildren,bg as insertCustomNodeWrite,gc as instrTextValue,ig as isAuthorableRunProperty,Hb as isContentControl,Ib as isContentControlContent,qe as isContentControlContentNode,pe as isContentControlNode,re as isContentControlWrapper,ha as isContentRevisionKind,od as isContinuationSeparatorNode,I as isDangerousKey,Kf as isDrawingTreeDocOp,jd as isEndnotesNode,S as isEvaluableField,kc as isFieldChrome,cc as isFldChar,$b as isFldCharNode,fc as isFldSimple,bc as isFldSimpleNode,id as isFootnotesNode,_c as isHeaderFooterLifecycleOp,Ha as isHyperlinkNode,R as isInertExecutable,dc as isInstrText,ac as isInstrTextNode,Nd as isLegalEndnotePosition,qc as isLegalFldCharType,Od as isLegalFootnotePosition,Pd as isLegalNumRestart,sd as isNormalNote,xd as isNoteAtomNode,je as isNoteLifecycleOp,kd as isNoteNode,md as isNoteRefNode,ld as isNoteReferenceNode,Wb as isPageBreakNode,ia as isRangeMarkerKind,Pg as isSearchableQuery,nd as isSeparatorNode,Le as isStoryPart,y as isValidMime,Z as isValidNCName,Pc as isValidParaId,_ as isValidQName,Og as isWholeWord,Fb as linearMathToOmml,Ig as linkRevisionReplies,gb as liveDrawingReferenceCount,vg as locateSites,Ee as lockForbidsEdit,Fe as lockForbidsRemoval,og as mergedFontProperty,rg as mergedMultiSettingProperty,sg as mergedParagraphMarkProperties,ng as mergedProperties,Sc as mintParaId,Vc as mintedParagraphIdentityAttributes,de as normalNoteIds,Wc as normalizeParagraphIdentity,r as normalizePartName,wd as noteAtomText,qd as noteIdOf,pd as noteKindOf,ud as noteRefKindOf,td as noteReferenceKindOf,rd as noteTypeOf,Bd as notesOf,ce as notesPartHasId,J as nullRecord,oa as ooxmlTreesEqual,He as orderedContentControlProperties,Qc as paraIdOf,Ud as paragraphOffsetIndex,Jg as paragraphOrderOfPart,Of as paragraphTextOf,wa as parentNodeOf,Fd as parseAuthoredNoteProperties,xe as parseContentControlId,Db as parseLinearMath,fd as parseNoteId,hd as parseNoteScopeId,wc as parseTocInstruction,u as partNameKey,Kc as planTocEntries,Cc as points,Ec as pointsToTwips,Ua as projectDrawing,Cb as projectOmmlEquation,jg as propertyContainer,hf as readCustomXmlNode,ja as readOnOffChild,ob as readOoxmlPackage,ra as readOoxmlPart,V as readXml,Da as readZip,Zc as relationshipTargetIn,sb as relationshipsOf,ub as relsPartNameFor,cg as removeCustomNodeWrite,Aa as removeNode,xa as replaceChildren,za as replaceNode,De as resolveContentControlLock,B as resolveContentType,tb as resolveContentTypeOf,Md as resolveEndnoteProperties,Ld as resolveFootnoteProperties,Tb as resolveHeaderFooterParts,Sb as resolveHeaderFooterPartsBySection,Rb as resolveHeaderFooterResolutionBySection,F as resolveImageRelationship,n as resolveImageResourceLimits,w as resolveInternalTarget,k as resolveLimits,_d as resolveNotesPart,E as resolveRelationship,wg as reviewItemKey,xg as reviewItemRanges,Fg as revisionItemsOf,pg as runAddressRanges,tg as runPropertyEdits,ug as runsCovering,L as sanitizeHref,T as scrubExport,Td as segmentsOf,ka as serializeOoxmlPart,Xf as setCommentResolved,Id as settingsPartOf,ab as sniffImageMime,Ne as storyParagraphs,Ke as storyRootsOf,Nc as stylesPartOf,dg as sweepCustomNodePayloads,Y as textContent,Te as threadStateOfPart,K as toSafeRecord,Jc as tocEntryText,Gc as tocLeftIndentTwips,Bc as twips,Dc as twipsToPoints,Tc as usedParaIds,If as validateDrawingOp,x as validateExternalTarget,cb as validateGifHeader,db as validateJpegHeader,pa as validateOoxmlPart,zb as validatePackageInvariants,bb as validatePngHeader,fb as validateRasterHeader,Lf as validateTreeOp,Uc as w14RootPrefix,Nb as walkAllStoryParagraphs,Ob as walkParagraphInline,Mb as walkStoryBlocks,kb as withBinaryPart,vb as withContentTypeOverride,ef as withCustomXmlDataPart,if as withCustomXmlNode,lb as withEmbeddedImage,yb as withNewPart,qb as withPart,xb as withRelationship,ff as withoutCustomXmlDataPart,jf as withoutCustomXmlNode,kf as withoutOrphanCustomXmlNodes,mb as withoutUnreferencedImagePart,Jf as wrapTargetToAnchorSpec,pb as writeOoxmlPackage,Ea as writeZip}from'./chunk-CKDAK3MV.js';
|
|
@@ -815,14 +815,20 @@ type TreeDocOp = {
|
|
|
815
815
|
readonly op: 'insertTab';
|
|
816
816
|
readonly paragraphId: string;
|
|
817
817
|
readonly offset: number;
|
|
818
|
+
/** Write this as a TRACKED insertion, on the same terms as `insertText`. */
|
|
819
|
+
readonly revision?: RevisionAttributionInput;
|
|
818
820
|
} | {
|
|
819
821
|
readonly op: 'insertHardBreak';
|
|
820
822
|
readonly paragraphId: string;
|
|
821
823
|
readonly offset: number;
|
|
824
|
+
/** Write this as a TRACKED insertion, on the same terms as `insertText`. */
|
|
825
|
+
readonly revision?: RevisionAttributionInput;
|
|
822
826
|
} | {
|
|
823
827
|
readonly op: 'insertPageBreak';
|
|
824
828
|
readonly paragraphId: string;
|
|
825
829
|
readonly offset: number;
|
|
830
|
+
/** Write this as a TRACKED insertion, on the same terms as `insertText`. */
|
|
831
|
+
readonly revision?: RevisionAttributionInput;
|
|
826
832
|
} | {
|
|
827
833
|
/**
|
|
828
834
|
* Insert an allowlisted page-number complex field at a UTF-16 offset.
|
|
@@ -834,6 +840,14 @@ type TreeDocOp = {
|
|
|
834
840
|
readonly paragraphId: string;
|
|
835
841
|
readonly offset: number;
|
|
836
842
|
readonly field: 'PAGE' | 'NUMPAGES' | 'SECTIONPAGES' | 'PAGE_X_OF_Y';
|
|
843
|
+
/**
|
|
844
|
+
* Write this as a TRACKED insertion, on the same terms as `insertText`.
|
|
845
|
+
*
|
|
846
|
+
* The whole field — every `w:fldChar`, the instruction, the `PAGE_X_OF_Y` literal —
|
|
847
|
+
* goes into ONE `w:ins`, because the field is one proposal: rejecting it must take
|
|
848
|
+
* the complete atom back, never leave a `begin` standing without its `end`.
|
|
849
|
+
*/
|
|
850
|
+
readonly revision?: RevisionAttributionInput;
|
|
837
851
|
} | {
|
|
838
852
|
/**
|
|
839
853
|
* Move a numbered paragraph to another `w:numPr/w:ilvl`.
|
|
@@ -1255,6 +1269,13 @@ type TreeDocOp = {
|
|
|
1255
1269
|
readonly noteKind: 'footnote' | 'endnote';
|
|
1256
1270
|
readonly paragraphId: string;
|
|
1257
1271
|
readonly offset: number;
|
|
1272
|
+
/**
|
|
1273
|
+
* Write the citing REFERENCE as a tracked insertion (`w:ins` around the reference
|
|
1274
|
+
* run), on the same terms as `insertText`. The note body itself is not revision
|
|
1275
|
+
* markup: rejecting the reference removes it, and the body cascade sweeps the
|
|
1276
|
+
* orphaned note exactly as an untracked reference deletion does.
|
|
1277
|
+
*/
|
|
1278
|
+
readonly revision?: RevisionAttributionInput;
|
|
1258
1279
|
} | {
|
|
1259
1280
|
/**
|
|
1260
1281
|
* Delete a note body and every matching reference (body, HF, other notes).
|
|
@@ -1565,4 +1586,4 @@ type TreeOpResult = {
|
|
|
1565
1586
|
readonly detail?: string;
|
|
1566
1587
|
};
|
|
1567
1588
|
|
|
1568
|
-
export {
|
|
1589
|
+
export { contentControlPropertiesNodeOf as $, ACCEPTED_PARAGRAPH_PROPERTIES as A, type ContentControlProperties as B, type ContentControlKind as C, type DrawingProjection as D, type HyperlinkKind as E, type HyperlinkTarget as F, MAX_CONTENT_CONTROL_NESTING as G, HYPERLINK_RELATIONSHIP_TYPE as H, type ImpactClass as I, OFFICE_RELATIONSHIP_NAMESPACE_URI as J, type RelationshipTargetResolver as K, TABLE_BORDER_STYLES as L, MAX_CONTENT_CONTROLS_PER_PART as M, TREE_DOC_OP_KINDS as N, type OoxmlProperty as O, type TabStopWrite as P, type TreeDocOpKind as Q, type RevisionAddress as R, type SourceCrop as S, type TreeDocOp as T, type TreeOpEffect as U, type VectorShapeProjection as V, allocateContentControlId as W, contentControlContentChildren as X, contentControlContentNodeOf as Y, contentControlEndPropertiesNodeOf as Z, contentControlLevelOf as _, type TreeOpRejection as a, contentControlPropertiesOf as a0, contentControlTextOf as a1, contentControlsIn as a2, findContentControl as a3, flattenContentControls as a4, hyperlinkAnchorOf as a5, hyperlinkRelationshipIdOf as a6, hyperlinkTargetOf as a7, isContentControlContentNode as a8, isContentControlNode as a9, isContentControlWrapper as aa, isHyperlinkNode as ab, lockForbidsEdit as ac, lockForbidsRemoval as ad, orderedContentControlProperties as ae, parseContentControlId as af, projectDrawing as ag, resolveContentControlLock as ah, 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 RevisionAttributionInput as h, type DrawingTreeDocOp as i, type TreeDocColorValue as j, IMAGE_WRAP_TARGETS as k, type DrawingAccessibility as l, type DrawingTransform as m, type TableBorderStyle as n, type ContentControlLevel as o, type ContentControlLock as p, type ContentControlDataBinding as q, type TreeOpResult as r, ACCEPTED_RUN_PROPERTIES as s, CONTENT_CONTROL_ID_MAX as t, CONTENT_CONTROL_PROPERTY_ORDER as u, type ContentControlCheckbox as v, type ContentControlCheckboxState as w, type ContentControlDateFormat as x, type ContentControlEntry as y, type ContentControlListItem as z };
|
|
@@ -815,14 +815,20 @@ type TreeDocOp = {
|
|
|
815
815
|
readonly op: 'insertTab';
|
|
816
816
|
readonly paragraphId: string;
|
|
817
817
|
readonly offset: number;
|
|
818
|
+
/** Write this as a TRACKED insertion, on the same terms as `insertText`. */
|
|
819
|
+
readonly revision?: RevisionAttributionInput;
|
|
818
820
|
} | {
|
|
819
821
|
readonly op: 'insertHardBreak';
|
|
820
822
|
readonly paragraphId: string;
|
|
821
823
|
readonly offset: number;
|
|
824
|
+
/** Write this as a TRACKED insertion, on the same terms as `insertText`. */
|
|
825
|
+
readonly revision?: RevisionAttributionInput;
|
|
822
826
|
} | {
|
|
823
827
|
readonly op: 'insertPageBreak';
|
|
824
828
|
readonly paragraphId: string;
|
|
825
829
|
readonly offset: number;
|
|
830
|
+
/** Write this as a TRACKED insertion, on the same terms as `insertText`. */
|
|
831
|
+
readonly revision?: RevisionAttributionInput;
|
|
826
832
|
} | {
|
|
827
833
|
/**
|
|
828
834
|
* Insert an allowlisted page-number complex field at a UTF-16 offset.
|
|
@@ -834,6 +840,14 @@ type TreeDocOp = {
|
|
|
834
840
|
readonly paragraphId: string;
|
|
835
841
|
readonly offset: number;
|
|
836
842
|
readonly field: 'PAGE' | 'NUMPAGES' | 'SECTIONPAGES' | 'PAGE_X_OF_Y';
|
|
843
|
+
/**
|
|
844
|
+
* Write this as a TRACKED insertion, on the same terms as `insertText`.
|
|
845
|
+
*
|
|
846
|
+
* The whole field — every `w:fldChar`, the instruction, the `PAGE_X_OF_Y` literal —
|
|
847
|
+
* goes into ONE `w:ins`, because the field is one proposal: rejecting it must take
|
|
848
|
+
* the complete atom back, never leave a `begin` standing without its `end`.
|
|
849
|
+
*/
|
|
850
|
+
readonly revision?: RevisionAttributionInput;
|
|
837
851
|
} | {
|
|
838
852
|
/**
|
|
839
853
|
* Move a numbered paragraph to another `w:numPr/w:ilvl`.
|
|
@@ -1255,6 +1269,13 @@ type TreeDocOp = {
|
|
|
1255
1269
|
readonly noteKind: 'footnote' | 'endnote';
|
|
1256
1270
|
readonly paragraphId: string;
|
|
1257
1271
|
readonly offset: number;
|
|
1272
|
+
/**
|
|
1273
|
+
* Write the citing REFERENCE as a tracked insertion (`w:ins` around the reference
|
|
1274
|
+
* run), on the same terms as `insertText`. The note body itself is not revision
|
|
1275
|
+
* markup: rejecting the reference removes it, and the body cascade sweeps the
|
|
1276
|
+
* orphaned note exactly as an untracked reference deletion does.
|
|
1277
|
+
*/
|
|
1278
|
+
readonly revision?: RevisionAttributionInput;
|
|
1258
1279
|
} | {
|
|
1259
1280
|
/**
|
|
1260
1281
|
* Delete a note body and every matching reference (body, HF, other notes).
|
|
@@ -1565,4 +1586,4 @@ type TreeOpResult = {
|
|
|
1565
1586
|
readonly detail?: string;
|
|
1566
1587
|
};
|
|
1567
1588
|
|
|
1568
|
-
export {
|
|
1589
|
+
export { contentControlPropertiesNodeOf as $, ACCEPTED_PARAGRAPH_PROPERTIES as A, type ContentControlProperties as B, type ContentControlKind as C, type DrawingProjection as D, type HyperlinkKind as E, type HyperlinkTarget as F, MAX_CONTENT_CONTROL_NESTING as G, HYPERLINK_RELATIONSHIP_TYPE as H, type ImpactClass as I, OFFICE_RELATIONSHIP_NAMESPACE_URI as J, type RelationshipTargetResolver as K, TABLE_BORDER_STYLES as L, MAX_CONTENT_CONTROLS_PER_PART as M, TREE_DOC_OP_KINDS as N, type OoxmlProperty as O, type TabStopWrite as P, type TreeDocOpKind as Q, type RevisionAddress as R, type SourceCrop as S, type TreeDocOp as T, type TreeOpEffect as U, type VectorShapeProjection as V, allocateContentControlId as W, contentControlContentChildren as X, contentControlContentNodeOf as Y, contentControlEndPropertiesNodeOf as Z, contentControlLevelOf as _, type TreeOpRejection as a, contentControlPropertiesOf as a0, contentControlTextOf as a1, contentControlsIn as a2, findContentControl as a3, flattenContentControls as a4, hyperlinkAnchorOf as a5, hyperlinkRelationshipIdOf as a6, hyperlinkTargetOf as a7, isContentControlContentNode as a8, isContentControlNode as a9, isContentControlWrapper as aa, isHyperlinkNode as ab, lockForbidsEdit as ac, lockForbidsRemoval as ad, orderedContentControlProperties as ae, parseContentControlId as af, projectDrawing as ag, resolveContentControlLock as ah, 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 RevisionAttributionInput as h, type DrawingTreeDocOp as i, type TreeDocColorValue as j, IMAGE_WRAP_TARGETS as k, type DrawingAccessibility as l, type DrawingTransform as m, type TableBorderStyle as n, type ContentControlLevel as o, type ContentControlLock as p, type ContentControlDataBinding as q, type TreeOpResult as r, ACCEPTED_RUN_PROPERTIES as s, CONTENT_CONTROL_ID_MAX as t, CONTENT_CONTROL_PROPERTY_ORDER as u, type ContentControlCheckbox as v, type ContentControlCheckboxState as w, type ContentControlDateFormat as x, type ContentControlEntry as y, type ContentControlListItem as z };
|
|
@@ -1,11 +1,11 @@
|
|
|
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-BiA-IXgo.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-Dy3b20PS.cjs';
|
|
3
3
|
import { Node } from 'prosemirror-model';
|
|
4
4
|
import { O as OoxmlPart, a as OoxmlNode, c as OoxmlPackage, b as OoxmlElement, o as OoxmlPackageRejection } from './ooxml-package-CdEy9ufK.cjs';
|
|
5
5
|
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-Dvk6De4Q.cjs';
|
|
6
|
-
import {
|
|
7
|
-
import { T as
|
|
8
|
-
import { a as ReviewItem } from './review-items-
|
|
6
|
+
import { T as TreeDocOp } from './tree-op-types-D1vNJ7XC.cjs';
|
|
7
|
+
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-B_sJBMIS.cjs';
|
|
8
|
+
import { a as ReviewItem } from './review-items-B8tffIXj.cjs';
|
|
9
9
|
import { ReviewModuleContribution } from './contracts/modules.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
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-BgA9EQxY.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-D6SGwebL.js';
|
|
3
3
|
import { Node } from 'prosemirror-model';
|
|
4
4
|
import { O as OoxmlPart, a as OoxmlNode, c as OoxmlPackage, b as OoxmlElement, o as OoxmlPackageRejection } from './ooxml-package-CdEy9ufK.js';
|
|
5
5
|
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-z5Y4N1ab.js';
|
|
6
|
-
import {
|
|
7
|
-
import { T as
|
|
8
|
-
import { a as ReviewItem } from './review-items-
|
|
6
|
+
import { T as TreeDocOp } from './tree-op-types-CnRb7AYo.js';
|
|
7
|
+
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-DgETo6Mf.js';
|
|
8
|
+
import { a as ReviewItem } from './review-items-bdGxFWNA.js';
|
|
9
9
|
import { ReviewModuleContribution } from './contracts/modules.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as OoxmlPart, c as OoxmlPackage } from './ooxml-package-CdEy9ufK.cjs';
|
|
2
|
-
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-
|
|
2
|
+
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-D1vNJ7XC.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The document metadata Word's document-property fields render.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as OoxmlPart, c as OoxmlPackage } from './ooxml-package-CdEy9ufK.js';
|
|
2
|
-
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-
|
|
2
|
+
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-CnRb7AYo.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The document metadata Word's document-property fields render.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/core",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.2",
|
|
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.9.
|
|
89
|
+
"@docx-editor.dev/i18n": "^2.9.2",
|
|
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-5VC5HGJA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {c,d,p,f,k as k$1,j as j$1,i,zc,Jc,va,ta,ya,ra,u,V as V$1,ve,te as te$1,wa,Aa,re as re$1,xa,qb,lf,ff,bf,Ze,wb,Ia,U as U$1,Qc,ca,w,la,na,Xb,jc,Hb,Jb,ma,ba,ga,fa}from'./chunk-VUJGPCPU.js';import {strFromU8,strToU8}from'fflate';var Ft=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],Bt=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Ut=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function it(e){return Bt.test(e)||Ut.test(e)}function J(e,t){if(!it(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var Ht=/^(\d+)\.(\d+)\.(\d+)$/;function S(e){let t=Ht.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function q(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function Q(e,t){let n=S(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=S(r.slice(1));return q(n,o)<0?false:o.major>0?n.major===o.major:o.minor>0?n.major===0&&n.minor===o.minor:n.major===0&&n.minor===0}if(r.includes(" ")){let o=r.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let s=true;for(let a of o){let i=a.startsWith(">=")?">=":a.startsWith("<")?"<":null;if(!i)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let d=S(a.slice(i.length)),l=q(n,d);i===">="?s=s&&l>=0:s=s&&l<0;}return s}return q(n,S(r))===0}var h=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},Me=(e,t)=>`${e}:${t}`;function Vt(e,t={}){let n=new Map;for(let l of e){if(J(l.id,"extension"),at(l.version,l.id),n.has(l.id))throw new h("duplicate-extension",`duplicate extension id ${l.id}`,[l.id]);n.set(l.id,l);for(let c of l.contributions)J(c.id,c.kind),at(c.version,`${l.id} \u2192 ${c.id}`),c.replaces&&Kt(c.replaces.targetRange,`${l.id} \u2192 replaces ${c.replaces.targetId}`);}for(let l of e){for(let c of l.dependencies??[])if(!n.has(c))throw new h("missing-dependency",`${l.id} requires missing extension ${c}`,[l.id,c]);for(let c of l.conflicts??[])if(n.has(c)){let p=[l.id,c].sort();throw new h("conflict",`extensions ${p[0]} and ${p[1]} conflict`,p)}}Xt(n);let r=new Set(t.availablePorts??[]);for(let l of e)for(let c of l.contributions)c.kind==="runtimePort"&&r.add(c.id);for(let l of e)for(let c of l.requiredPorts??[])if(!r.has(c))throw new h("missing-port",`${l.id} requires unavailable port ${c}`,[l.id,c]);let o=new Map,s=new Map,a=new Map;for(let l of e)for(let c of l.contributions){let p=Me(c.kind,c.id);if(c.replaces){let u=Me(c.kind,c.replaces.targetId),m=a.get(u)??[];m.push({ext:l.id,c}),a.set(u,m);continue}if(s.has(p)){let u=[o.get(p),l.id].sort();throw new h("id-collision",`${c.kind} id ${c.id} registered by both ${u[0]} and ${u[1]}`,u)}s.set(p,c),o.set(p,l.id);}let i=new Map(s);for(let[l,c]of a){let p=s.get(l);if(!p){let f=c[0];throw new h("replacement-target-missing",`${f.ext} replaces missing target ${f.c.replaces.targetId}`,[f.ext,f.c.replaces.targetId])}let u=p.replaceable??{kind:"none"};for(let{ext:f,c:y}of c){if(!Q(p.version,y.replaces.targetRange))throw new h("replacement-version-mismatch",`${f} replaces ${y.replaces.targetId}@${p.version} outside range ${y.replaces.targetRange}`,[f,y.replaces.targetId]);if(u.kind==="none")throw new h("unauthorized-replacement",`${y.replaces.targetId} does not authorize replacement (attempted by ${f})`,[f,y.replaces.targetId])}let m=jt(p,c);i.set(l,m);}return {extensions:n,contributions:i,get:(l,c)=>i.get(Me(l,c))}}function jt(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let o=[...t].sort((i,d)=>(d.c.replaces.priority??0)-(i.c.replaces.priority??0)),s=o[0].c.replaces.priority??0,a=o.filter(i=>(i.c.replaces.priority??0)===s);if(a.length>1){let i=a.map(d=>d.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${s}: ${i.join(", ")}`,i)}return o[0].c}let r=t.map(o=>o.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function Xt(e){let o=new Map,s=[],a=i=>{o.set(i,1),s.push(i);let d=[...e.get(i)?.dependencies??[]].sort();for(let l of d){let c=o.get(l)??0;if(c===1){let p=s.indexOf(l),u=[...s.slice(p),l];throw new h("dependency-cycle",`dependency cycle: ${u.join(" -> ")}`,u)}c===0&&a(l);}s.pop(),o.set(i,2);};for(let i of [...e.keys()].sort())(o.get(i)??0)===0&&a(i);}function at(e,t){try{S(e);}catch{throw new h("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Kt(e,t){try{Q("0.0.0",e);}catch{throw new h("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var T=class extends Error{constructor(t){super(t),this.name="BudgetError";}},U=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new p(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,r=this;return {amount:t,get released(){return n},release(){n||(n=true,r.used.release(t),r.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let r=new e(t,n);return r.parent=this,r.carveAmount=n,this.children.add(r),r}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new T(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new T(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(r){t.push(r);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new T(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new T(`${this.label}: budget already released`)}};var Z=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},H=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new Z(t.derivedOnly,t._reason)}}}};var ee=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},Le=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new ee(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(f.clock)}identity(){return this.resolve(f.identity)}},Fe=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},Be=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function Gt(e){let t=k$1(e.limits),n=Object.freeze({...e.config??{}}),r=e.capacity??t.maxDecompressedBytes,o=e.id??"op",s={id:o,limits:t,config:n,ports:e.ports,budget:new U(`op:${o}`,r),cancellation:new H};return Object.freeze(s)}function zt(e){e.budget.dispose();}var He=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),st=Object.keys(He);function Wt(e,t){return new p(`${He[t].phase}:${t}`,e[t])}var Ue=class{counter;current=0;peak=0;constructor(t){this.counter=new p("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function Yt(){for(let e of st){let t=j$1[e],n=i[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}function V(e,t=new Set){let n=new WeakSet,r=o=>{if(o===null)return "null";let s=typeof o;if(s==="boolean")return o?"true":"false";if(s==="number"){let a=o;if(!Number.isFinite(a))throw new Error(`non-finite number is not comparable: ${a}`);return Object.is(a,-0)?"0":String(a)}if(s==="string")return JSON.stringify(o);if(s==="bigint")return `${o.toString()}n`;if(Array.isArray(o))return `[${o.map(r).join(",")}]`;if(s==="object"){let a=o;if(n.has(a))throw new Error("cannot canonicalize a cyclic structure");n.add(a);let d=Object.keys(a).filter(l=>!t.has(l)).sort().map(l=>`${JSON.stringify(l)}:${r(a[l])}`).join(",");return n.delete(a),`{${d}}`}throw new Error(`unsupported value type in comparator input: ${s}`)};return r(e)}function Ve(e,t){let n=V(e,t),r=0xcbf29ce484222325n,o=0x100000001b3n,s=0xffffffffffffffffn;for(let a=0;a<n.length;a++)r^=BigInt(n.charCodeAt(a)),r=r*o&s;return r.toString(16).padStart(16,"0")}var R="dev.docx-editor.core.comparator",je={authoredState:{id:`${R}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${R}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${R}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${R}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${R}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${R}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${R}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${R}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${R}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${R}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Xe(e,t,n,r={}){let o=je[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(r.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:lt(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let s=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,a=V(t,s),i=V(n,s);return a===i?{equal:true}:{equal:false,left:a,right:i}}}}function Ke(e,t){let n=je[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let r=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return Ve(t,r)}function lt(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,o)=>lt(r,t[o],n)):false}var dt=new Set([...c,...d]),ct=/^[0-9a-f]{16}$/,Jt=/^[0-9a-f]*$/;function Ge(e){let t=[],n=o=>t.push(o);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let r=-1;e.steps.forEach((o,s)=>{let a=`step[${s}]`;dt.has(o.origin)||n(`${a}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&n(`${a}: baseRevision must be a non-negative integer`),o.baseRevision<r&&n(`${a}: baseRevision regressed below ${r}`);let i=o.expect;i.outcome==="applied"?(i.committedRevision===void 0?n(`${a}: applied step needs committedRevision`):i.committedRevision<=o.baseRevision?n(`${a}: committedRevision ${i.committedRevision} must exceed baseRevision ${o.baseRevision}`):r=i.committedRevision,i.modelChange&&qt(i.modelChange,a,n)):(i.committedRevision!==void 0&&n(`${a}: ${i.outcome} step must not commit a revision`),i.authoredStateHash!==void 0&&n(`${a}: ${i.outcome} step must not change authored state`)),i.authoredStateHash!==void 0&&!ct.test(i.authoredStateHash)&&n(`${a}: authoredStateHash must be 16-hex`),i.outputHash!==void 0&&!ct.test(i.outputHash)&&n(`${a}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&n(`envelope documentId ${o.documentId} != ${e.documentId}`),Jt.test(o.bytesHex)||n("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&n(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function qt(e,t,n){dt.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function Qt(e,t){let n=Ge(e);if(!n.valid)return {ok:false,mismatches:n.errors};let r=[];return t.init(e),e.steps.forEach((o,s)=>{let a=`step[${s}]`,i=t.applyStep(o),d=o.expect;if(i.outcome!==d.outcome){r.push(`${a}: outcome ${i.outcome} != expected ${d.outcome}`);return}if(d.outcome==="applied"&&(i.committedRevision!==d.committedRevision&&r.push(`${a}: revision ${i.committedRevision} != expected ${d.committedRevision}`),d.authoredStateHash!==void 0))if(i.authoredState===void 0)r.push(`${a}: store returned no authored state to hash`);else {Xe("authoredState",i.authoredState,i.authoredState).equal||r.push(`${a}: authored state is not self-consistent`);let c=pt(i.authoredState);c!==d.authoredStateHash&&r.push(`${a}: authoredStateHash ${c} != expected ${d.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function pt(e){return Ke("authoredState",e)}var Zt=new Map([["embedRegular","regular"],["embedBold","bold"],["embedItalic","italic"],["embedBoldItalic","boldItalic"]]),en=32;function ft(e,t){let n=t.replace(/[^0-9a-fA-F]/g,"");if(n.length!==32)return null;let r=new Uint8Array(16);for(let a=0;a<16;a+=1){let i=Number.parseInt(n.slice(a*2,a*2+2),16);if(Number.isNaN(i))return null;r[15-a]=i;}let o=new Uint8Array(e),s=Math.min(en,o.length);for(let a=0;a<s;a+=1)o[a]=o[a]^r[a%16];return o}var ze=(e,t)=>{if(!(e.kind==="textValue"||!("attributes"in e))){for(let n of e.attributes??[])if(n.localName===t)return n.value}},ut=e=>e.kind==="textValue"?[]:e.children??[],mt=e=>e.kind==="textValue"||!("localName"in e)?"":e.localName;function tn(e,t,n){for(let r of e.relationships.get(t)??[]){if(r.id!==n)continue;if(r.targetMode==="External")return null;let o=w(t,r.rawTarget);return o.ok?o.partName:null}return null}function nn(e,t,n={}){if(!t)return [];let r=n.maxFontBytes??16*1024*1024,o=n.maxFonts??64,s=[],a=new Map,i=d=>{if(!(s.length>=o)){if(mt(d)==="font"){let l=ze(d,"name");if(l&&l.length<=128)for(let c of ut(d)){if(s.length>=o)return;let p=Zt.get(mt(c));if(!p)continue;let u=ze(c,"id"),m=ze(c,"fontKey");if(!u||!m)continue;let f=tn(e,t.name,u);if(!f)continue;let y=e.partBytes.get(f);if(!y||y.length===0||y.length>r)continue;let g=a.get(f);if(g){s.push({family:l,style:p,bytes:g,partName:f});continue}let v=ft(y,m);v&&(a.set(f,v),s.push({family:l,style:p,bytes:v,partName:f}));}}for(let l of ut(d))i(l);}};return i(t.root),s}function yt(e){if(e.kind!=="textValue")for(let t of e.children){if(t.kind==="textValue")continue;if(t.kind==="hyperlink"){let r=Ia(t);if(r!==void 0&&r.length>0)return r}let n=yt(t);if(n!==void 0)return n}}function rn(e){let t="",n=false,r=o=>{if(!(n||o.kind==="textValue")){if(o.kind==="tab"||o.localName==="ptab"||o.localName==="tab"){n=true;return}if(o.kind==="text"||o.localName==="t"){for(let s of o.children)s.kind==="textValue"&&(t+=s.value);return}for(let s of o.children)r(s);}};return r(e),Jc(t)}function on(e,t,n,r){let o=n.filter(d=>{if(r.has(d.blockId))return false;let l=d.level+1;return l>=t.instruction.outlineStart&&l<=t.instruction.outlineEnd}),s=new Set(o.map(d=>d.blockId)),a=zc(e),i=new Map;for(let d of o){let l=Jc(d.text),c=i.get(l);c?c.push(d.blockId):i.set(l,[d.blockId]);}return t.resultParagraphIds.map(d=>{let l=va(e,d);if(!l||l.kind==="textValue")return null;let c=yt(l),p=c===void 0?void 0:a.get(c);if(p&&s.has(p.paragraphId)){let f=i.get(Jc(o.find(g=>g.blockId===p.paragraphId)?.text??"")),y=f?.indexOf(p.paragraphId)??-1;return f&&y>=0&&f.splice(y,1),p.paragraphId}let u=rn(l);if(u.length===0)return null;let m=i.get(u);return !m||m.length===0?null:m.shift()??null})}function C(e){return e.namespaceUri===ca?e.localName:`{${e.namespaceUri}}${e.localName}`}function I(e){let t=[];for(let n of e.attributes)t.push(n.namespaceUri===""||n.namespaceUri===ca?`${n.localName}=${n.value}`:`{${n.namespaceUri}}${n.localName}=${n.value}`);return t.sort(),t}function ht(e,t){let n=I(e),r=n.length>0?`${C(e)}(${n.join(",")})`:C(e);if(t>=U$1)return r;let o=[];for(let s of e.children){if(s.kind==="textValue"){s.value!==""&&o.push(`#${s.value}`);continue}o.push(ht(s,t+1));}return o.sort(),o.length>0?`${r}[${o.join(",")}]`:r}function gt(e){if(!e)return [];let t=[];for(let n of e.children)n.namespaceUri===ca&&t.push(ht(n,1));return t.sort(),t}function We(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return Xb(e);if(e.kind==="drawing")return jc();if(e.kind==="runProperties"||e.kind==="paragraphProperties"||e.kind==="generic")return "";if(e.kind==="hyperlink"||Hb(e)){let n="",r=e.kind==="hyperlink"?e.children:Jb(e)??[];for(let o of r)n+=We(o);return n}let t="";for(let n of e.children)t+=We(n);return t}function x(e,t){let n=new Map(e);for(let r of t.namespaceBindings)n.set(r.prefix,r.namespaceUri);return n}function j(e,t){try{return ma(e,t)}catch(n){if(n instanceof ga&&n.reason==="undeclared-prefix")return `generic-refusal:undeclared-prefix:{${e.namespaceUri}}${e.localName}`;throw n}}function Ye(e,t,n=la){if(e.kind==="textValue")return;if(e.kind==="runProperties"||e.kind==="paragraphProperties"){let o=x(n,e),s=[];for(let a of e.children)a.namespaceUri!==ca&&s.push(j(a,o));s.sort(),t.push(...s);return}if(e.kind==="generic"){t.push(j(e,n));return}if(Hb(e)){t.push(na(e));return}if(e.kind==="bookmarkStart"||e.kind==="bookmarkEnd"){t.push(ma(e,n));return}if(e.kind==="drawing"){t.push(xt(e));return}if(ba(e.kind))return;let r=x(n,e);for(let o of e.children)Ye(o,t,r);}function an(e){return `hyperlink(${e.attributes.map(n=>`${n.namespaceUri}|${n.localName}=${n.value}`).sort().join(",")})`}function sn(e){for(let t of e.children)if(t.kind==="pictureBlipFill")for(let n of t.children){if(n.kind!=="pictureBlip")continue;let r=n.attributes.find(s=>s.localName==="embed"&&s.namespaceUri===fa)?.value,o=n.attributes.find(s=>s.localName==="link"&&s.namespaceUri===fa)?.value;if(r!==void 0)return `embed=${r}`;if(o!==void 0)return `link=${o}`}}function te(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=U$1)return C(e);let r=x(n,e);if(e.kind==="generic")return j(e,r);let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children)i.kind!=="textValue"&&a.push(te(i,t+1,r));return a.sort(),a.length>0?`${s}[${a.join(",")}]`:s}function ln(e,t,n){let r=x(n,e),o=[];for(let s of e.children)if(s.kind!=="textValue"){if(s.kind==="pictureBlipFill"){let a=s.children,i=a.find(l=>l.kind==="pictureBlip"),d=a.filter(l=>l.kind!=="pictureBlip").map(l=>te(l,t+1,r));if(d.sort(),i&&i.kind==="pictureBlip"){let l=I(i),c=l.length>0?`pictureBlip(${l.join(",")})`:"pictureBlip";o.push(d.length>0?`${c}[${d.join(",")}]`:c);}else for(let l of a)o.push(te(l,t+1,r));continue}o.push(te(s,t+1,r));}return o.sort(),o}function Je(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=U$1)return C(e);let r=x(n,e);if(e.kind==="drawingDocPr"){let i=I(e);return i.length>0?`docPr(${i.join(",")})`:"docPr"}if(e.kind==="picture"){let i=sn(e),d=ln(e,t+1,r),l=i===void 0?"picture":`picture(${i})`;return d.length>0?`${l}[${d.join(",")}]`:l}let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children){if(i.kind==="picture"){a.push(Je(i,t+1,r));continue}if(i.kind==="generic"){a.push(j(i,r));continue}i.kind!=="textValue"&&a.push(Je(i,t+1,r));}return a.length>0?`${s}[${a.join(",")}]`:s}function xt(e){let t=x(la,e),n=e.children.find(i=>i.kind==="inlineDrawing"||i.kind==="anchoredDrawing");if(!n||n.kind==="textValue")return `drawing(${I(e).join(",")})`;let r=x(t,n),o=I(n),s=o.length>0?`${n.kind}(${o.join(",")})`:n.kind,a=[];for(let i of n.children){if(i.kind==="generic"){a.push(j(i,r));continue}i.kind!=="textValue"&&a.push(Je(i,1,r));}return a.length>0?`drawing[${s};${a.join(";")}]`:`drawing[${s}]`}function cn(e,t,n){let r=e.children.find(c=>c.kind==="paragraphProperties"),o=[],s="",a=[],i=x(la,e),d=(c,p)=>{if(c.kind==="run"){let u=x(p,c),m=c.children.find(f=>f.kind==="runProperties");o.push(gt(m)),s+=We(c);for(let f of c.children)Ye(f,a,u);return}if(c.kind==="drawing"){a.push(xt(c));return}if(c.kind==="hyperlink"){a.push(an(c));let u=x(p,c);for(let m of c.children)d(m,u);return}if(c.kind==="contentControl"){a.push(na({...c,children:c.children.filter(m=>m.kind!=="contentControlContent")}));let u=x(p,c);for(let m of c.children){if(m.kind!=="contentControlContent")continue;let f=x(u,m);for(let y of m.children)d(y,f);}return}Ye(c,a,p);};for(let c of e.children)d(c,i);let l=Qc(e);return {ordinal:t,path:n,paraId:l===null?null:l.toUpperCase(),text:s,paragraphProperties:gt(r),runProperties:o,genericStructure:a}}function dn(e){if(e.localName==="hdr"||e.localName==="ftr"||e.kind==="body")return e;for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="body"||t.localName==="hdr"||t.localName==="ftr"))return t;return e}function Nt(e,t,n,r,o,s){if(s>U$1)return;let a=0;for(let i of e.children){if(i.kind==="textValue"){i.value.trim()!==""&&o.push(`${t}/#text ${i.value}`);continue}let d=t===""?String(a):`${t}/${a}`;if(a+=1,i.kind==="paragraph"){n.push(i),r.push(d),o.push(`${d} p`);continue}let l=I(i);o.push(l.length>0?`${d} ${C(i)}(${l.join(",")})`:`${d} ${C(i)}`),Nt(i,d,n,r,o,s+1);}}function Ot(e){let t=dn(e.root),n=[],r=[],o=[];Nt(t,"",n,r,o,0);let s=n.map((a,i)=>cn(a,i,r[i]));return {partName:e.name,paragraphs:s,structure:o}}function pn(e){let t=[];for(let n of e){let r=Ot(n);r&&t.push(r);}return {stories:t}}function un(e,t){let n=[],r=(s,a,i)=>{n.push({path:s,before:JSON.stringify(a)??"undefined",after:JSON.stringify(i)??"undefined"});};e.stories.length!==t.stories.length&&r("stories.length",e.stories.length,t.stories.length);let o=Math.min(e.stories.length,t.stories.length);for(let s=0;s<o;s+=1){let a=e.stories[s],i=t.stories[s],d=p=>`${a.partName}${p}`;a.paragraphs.length!==i.paragraphs.length&&r(d(".paragraphs.length"),a.paragraphs.length,i.paragraphs.length);let l=Math.min(a.paragraphs.length,i.paragraphs.length);for(let p=0;p<l;p+=1){let u=a.paragraphs[p],m=i.paragraphs[p];u.text!==m.text&&r(d(`.p[${p}].text`),u.text,m.text),u.path!==m.path&&r(d(`.p[${p}].path`),u.path,m.path),u.paraId!==m.paraId&&r(d(`.p[${p}].paraId`),u.paraId,m.paraId),JSON.stringify(u.paragraphProperties)!==JSON.stringify(m.paragraphProperties)&&r(d(`.p[${p}].paragraphProperties`),u.paragraphProperties,m.paragraphProperties),JSON.stringify(u.runProperties)!==JSON.stringify(m.runProperties)&&r(d(`.p[${p}].runProperties`),u.runProperties,m.runProperties),JSON.stringify(u.genericStructure)!==JSON.stringify(m.genericStructure)&&r(d(`.p[${p}].genericStructure`),u.genericStructure,m.genericStructure);}a.structure.length!==i.structure.length&&r(d(".structure.length"),a.structure.length,i.structure.length);let c=Math.min(a.structure.length,i.structure.length);for(let p=0;p<c;p+=1)a.structure[p]!==i.structure[p]&&r(d(`.structure[${p}]`),a.structure[p],i.structure[p]);}return n}var X="http://schemas.openxmlformats.org/wordprocessingml/2006/main",yn="http://schemas.openxmlformats.org/package/2006/relationships",Rt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",A="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",gn="application/vnd.openxmlformats-package.relationships+xml",hn="http://schemas.openxmlformats.org/package/2006/content-types",Ct="/[Content_Types].xml",b="/word/numbering.xml",bt=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}],Et=["decimal","lowerLetter","lowerRoman"],qe=9;function Tt(e,t){let n=720*(t+1),r='<w:start w:val="1"/>';if(e==="bullet"){let a=bt[t%bt.length];return `<w:lvl w:ilvl="${t}">${r}<w:numFmt w:val="bullet"/><w:lvlText w:val="${a.text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${n}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${a.font}" w:hAnsi="${a.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=Et[t%Et.length],s=o==="lowerRoman";return `<w:lvl w:ilvl="${t}">${r}<w:numFmt w:val="${o}"/><w:lvlText w:val="%${t+1}."/><w:lvlJc w:val="${s?"right":"left"}"/><w:pPr><w:ind w:left="${n}" w:hanging="${s?180:360}"/></w:pPr></w:lvl>`}function xn(e,t){let n=Array.from({length:qe},(r,o)=>Tt(e,o)).join("");return `<w:abstractNum w:abstractNumId="${t}"><w:multiLevelType w:val="${e==="bullet"?"hybridMultilevel":"multilevel"}"/>${n}</w:abstractNum>`}function Nn(){let e=ra(`<w:numbering xmlns:w="${X}"></w:numbering>`,{name:b,contentType:A});return e.ok?e.part:null}var P=(e,t)=>{let n=[];for(let r of e.children)r.kind==="textValue"||r.localName!==t||r.namespaceUri===X&&n.push(r);return n},N=(e,t)=>e.attributes.find(n=>n.localName===t)?.value;function vt(e,t){let n=ra(`<w:numbering xmlns:w="${X}">${e}</w:numbering>`,{name:b,contentType:A});if(!n.ok)return null;let r=[];for(let o of n.part.root.children)o.kind!=="textValue"&&r.push(o);if(r.length!==t.length)return null;for(let o=0;o<t.length;o+=1){let s=r[o],a=t[o];if(s.namespaceUri!==X||s.localName!==a.localName||a.attribute&&N(s,a.attribute.localName)!==a.attribute.value)return null}return r}var Pt=["numPicBullet","abstractNum","num","numIdMacAtCleanup"];function It(e,t,n){let r=t.indexOf(n);if(r===-1)return e.length;let o=0;return e.forEach((s,a)=>{if(s.kind==="textValue")return;let i=t.indexOf(s.localName);i!==-1&&i<=r&&(o=a+1);}),o}function kt(e,t){let n=0;for(let r of e){let o=N(r,t);!o||!/^\d{1,9}$/.test(o)||(n=Math.max(n,Number(o)));}return n+1}function On(e,t){let n=e.parts.get(b),r=n??Nn();if(!r)return null;let o=r.root,s=P(o,"abstractNum"),a=P(o,"num"),i=t==="bullet"?"bullet":"decimal",d=s.find(O=>{let D=N(O,"abstractNumId");if(!D||!/^\d{1,9}$/.test(D))return false;let et=P(O,"lvl").find(nt=>N(nt,"ilvl")==="0"||N(nt,"ilvl")===void 0),tt=et?P(et,"numFmt")[0]:void 0;return tt!==void 0&&N(tt,"val")===i}),c=(d?Number(N(d,"abstractNumId")):null)??kt(s,"abstractNumId"),p=kt(a,"numId"),u=d===void 0,m=vt((u?xn(t,c):"")+`<w:num w:numId="${p}"><w:abstractNumId w:val="${c}"/></w:num>`,u?[{localName:"abstractNum",attribute:{localName:"abstractNumId",value:String(c)}},{localName:"num",attribute:{localName:"numId",value:String(p)}}]:[{localName:"num",attribute:{localName:"numId",value:String(p)}}]);if(!m)return null;let f=ta(r),y=m.map(O=>ne(O,f)),g=u?y[0]:void 0,v=y[u?1:0];if(u&&!g||!v)return null;let ae=r;if(g){let O=ya(r,o.id,It(o.children,Pt,"abstractNum"),[g]);if(!O.ok)return null;ae=O.part;}let Ze=ya(ae,o.id,It(ae.root.children,Pt,"num"),[v]);if(!Ze.ok)return null;let se=Object.freeze({...e,parts:new Map([...e.parts,[b,Ze.part]])});if(!n){let O=En(se);if(!O)return null;let D=Sn(O);if(!D)return null;se=D;}return {pkg:se,numId:String(p)}}var Rn=["nsid","multiLevelType","tmpl","name","styleLink","numStyleLink","lvl"];function wt(e){let t=N(e,"ilvl");return t===void 0||!/^\d{1,9}$/.test(t)?null:Number(t)}function Cn(e,t){let n=0;return e.forEach((r,o)=>{if(r.kind!=="textValue"){if(r.localName==="lvl"&&r.namespaceUri===X){(wt(r)??0)<t&&(n=o+1);return}Rn.includes(r.localName)&&(n=o+1);}}),n}function bn(e,t,n,r){if(!Number.isInteger(n)||n<0||n>=qe||t.length===0||t.length>64)return null;let o=e.parts.get(b);if(!o)return null;let s=o.root,a=P(s,"num").find(f=>N(f,"numId")===t),i=a?P(a,"abstractNumId")[0]:void 0,d=i?N(i,"val"):void 0;if(!d)return null;let l=P(s,"abstractNum").find(f=>N(f,"abstractNumId")===d);if(!l||P(l,"numStyleLink").length>0)return null;let c=P(l,"lvl");if(c.some(f=>wt(f)===n))return e;if(c.length>=qe)return null;let p=vt(Tt(r,n),[{localName:"lvl",attribute:{localName:"ilvl",value:String(n)}}]);if(!p)return null;let u=ta(o),m=ya(o,l.id,Cn(l.children,n),[ne(p[0],u)]);return m.ok?Object.freeze({...e,parts:new Map([...e.parts,[b,m.part]])}):null}function ne(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>ne(n,t))}}function En(e){let t=e.mainDocumentPart,n=Pn(t),r=e.parts.get(n),o=In(e),s=ra(`<Relationships xmlns="${yn}"><Relationship Id="${o}" Type="${Rt}" Target="numbering.xml"/></Relationships>`,{name:n,contentType:gn});if(!s.ok)return null;let a=e.relationships.get(t)??[],i={ownerPart:t,id:o,type:Rt,rawTarget:"numbering.xml",targetMode:"Internal",order:a.reduce((u,m)=>Math.max(u,m.order),-1)+1},d=new Map([...e.relationships,[t,[...a,i]]]);if(!r)return Object.freeze({...e,parts:new Map([...e.parts,[n,s.part]]),relationships:d});let l=ta(r),c=s.part.root.children[0];if(!c)return null;let p=ya(r,r.root.id,r.root.children.length,[ne(c,l)]);return p.ok?Object.freeze({...e,parts:new Map([...e.parts,[n,p.part]]),relationships:d}):null}function Pn(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function In(e){let t=0;for(let n of e.relationships.values())for(let r of n){let o=/^rId(\d{1,9})$/.exec(r.id);o&&(t=Math.max(t,Number(o[1])));}for(let n of e.externalTargets){let r=/^rId(\d{1,9})$/.exec(n.id);r&&(t=Math.max(t,Number(r[1])));}return `rId${t+1}`}var kn=`<Override PartName="${b}" ContentType="${A}"/>`;function Sn(e){let t=e.contentTypes.overrides.get(u(b));if(t===A)return e;if(t!==void 0)return null;let n=e.partBytes.get(Ct);if(!n)return null;let r=strFromU8(n),o=St(r);if(!o)return null;let s=r.lastIndexOf(`</${o.rootName}>`);if(s===-1)return null;let a=r.slice(0,s)+kn+r.slice(s),i=St(a);if(!i||i.rootName!==o.rootName)return null;let d=[...o.children,_t("Override",{PartName:b,ContentType:A})];return i.children.length!==d.length||i.children.some((l,c)=>l!==d[c])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[Ct,strToU8(a)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[u(b),A]])})})}function St(e){let t=V$1(e);if(!t.ok)return null;let n=t.nodes.filter(i=>i.type==="element");if(n.length!==1)return null;let r=n[0],o=r.name.indexOf(":"),s=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[s?`xmlns:${s}`:"xmlns"]!==hn)return null;let a=[];for(let i of r.children)i.type==="element"&&a.push(_t(i.name,i.attributes));return {rootName:r.name,children:a}}function _t(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}function re(e){return e!=null&&e.kind!=="textValue"}function Qe(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===ca&&n.localName===t)return n;return null}function oe(e,t){for(let n of e.attributes)if(n.namespaceUri===ca&&n.localName===t)return n.value}function $(e,t){let n=Qe(e,t);if(!n)return false;let r=oe(n,"val");return r===void 0?true:r!=="0"&&r!=="false"&&r!=="off"}var At=Object.freeze({trackRevisions:false,restrictedToTrackedChanges:false,doNotTrackMoves:false,doNotTrackFormatting:false});function Tn(e){if(!re(e))return At;let t=Qe(e,"documentProtection"),n=t===null?void 0:oe(t,"enforcement"),r=n!==void 0&&n!=="0"&&n!=="false"&&n!=="off";return {trackRevisions:$(e,"trackRevisions"),restrictedToTrackedChanges:r&&t!==null&&oe(t,"edit")==="trackedChanges",doNotTrackMoves:$(e,"doNotTrackMoves"),doNotTrackFormatting:$(e,"doNotTrackFormatting")}}var $t=Object.freeze({doNotShadeFormData:false});function vn(e){return re(e)?{doNotShadeFormData:$(e,"doNotShadeFormData")}:$t}function wn(e,t){let n=e.parts.get(t.storyPartName);if(!n)return {ok:false,reason:`no story part named ${t.storyPartName}`};let r=[];for(let d of ve(n.root)){let l=te$1(d.node).tag;if(l===void 0||l.length===0)continue;let c=t.decide(l);c!=="keep"&&r.push({nodeId:d.node.id,policy:c});}let o=n,s=0,a=0;for(let{nodeId:d,policy:l}of r){let c=wa(o,d);if(!c)continue;if(l==="remove"){let g=Aa(o,d,{deferValidation:true});if(!g.ok)return {ok:false,reason:`a node could not be removed: ${Dt(g)}`};o=g.part,a+=1;continue}let p=c.children.find(g=>g.id===d);if(!p)continue;let u=re$1(p),m=u?u.children:[],f=c.children.flatMap(g=>g.id===d?m:[g]),y=xa(o,c.id,f,{deferValidation:true});if(!y.ok)return {ok:false,reason:`a node could not be unwrapped: ${Dt(y)}`};o=y.part,s+=1;}let i=o===n?e:qb(e,o);if(!i.parts.has(t.storyPartName))return {ok:false,reason:"the story went missing during the export"};for(let d of t.namespaces)for(let l of An(i,t.storyPartName,d)){let c=lf(i,l.itemId),p=ff(i,l.partName,c);if(p.pkg===i&&p.removed.length===0&&!_n(i,l.partName,c))return {ok:false,reason:`the payloads in ${d} could not be removed`};if(i=p.pkg,c.size>0)continue;let u=$n(i,l);if(!u.ok)return {ok:false,reason:`the payload store for ${d} could not be removed`};i=u.pkg;}return {ok:true,pkg:i,unwrapped:s,removed:a}}function _n(e,t,n){return bf(e,t).every(r=>n.has(r.id))}function Dt(e){return e.issues.map(t=>t.code).join(", ")||"the edit was refused"}function An(e,t,n){return Ze(e,t).filter(r=>r.namespaceUri===n)}function $n(e,t){let n=wb(e,t.partName);if(!n.ok)return {pkg:e,ok:false};let r=wb(n.pkg,t.propsPartName);return r.ok?{pkg:r.pkg,ok:true}:{pkg:e,ok:false}}var ie="http://purl.org/dc/elements/1.1/",Mt="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",Lt="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";var Ip=Object.freeze({});function k(e,t,n){if(e.kind!=="textValue")for(let r of e.children){if(r.kind==="textValue"||r.namespaceUri!==t||r.localName!==n)continue;let o=r.children.find(a=>a.kind==="textValue");if(!o||o.kind!=="textValue")return;let s=o.value.trim();return s.length===0?void 0:s.length>4096?s.slice(0,4096):s}}function kp(e,t){let n={};if(e&&e.kind!=="textValue"){let r=k(e,ie,"title");r!==void 0&&(n.title=r);let o=k(e,ie,"creator");o!==void 0&&(n.creator=o);let s=k(e,ie,"subject");s!==void 0&&(n.subject=s);let a=k(e,ie,"description");a!==void 0&&(n.description=a);let i=k(e,Mt,"keywords");i!==void 0&&(n.keywords=i);let d=k(e,Mt,"lastModifiedBy");d!==void 0&&(n.lastModifiedBy=d);}if(t&&t.kind!=="textValue"){let r=k(t,Lt,"Company");r!==void 0&&(n.company=r);let o=k(t,Lt,"Manager");o!==void 0&&(n.manager=o);}return n}
|
|
2
|
-
export{Xe as A,Ke as B,Ge as C,Qt as D,pt as E,ft as F,nn as G,on as H,Ot as I,pn as J,un as K,On as L,bn as M,At as N,Tn as O,$t as P,vn as Q,Ip as R,kp as S,wn as T,Ft as a,it as b,J as c,S as d,q as e,Q as f,h as g,Vt as h,T as i,U as j,Z as k,H as l,ee as m,Le as n,Fe as o,Be as p,Gt as q,zt as r,He as s,st as t,Wt as u,Ue as v,Yt as w,V as x,Ve as y,je as z};
|
package/dist/chunk-A2JIBG75.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {te as te$1,va,_d,pd,sd,qd,zd,Rb,Pb,Zf,Yf,Ud,xe,re as re$1,ve,Pf,Qf,Sf,Rf,Xc,Ka,Zc,Ia,Qd,Sd,kg,ig,qg,pg,rg,Rd,N,Mg,Nc,Mc,He,Cd,vf,Je,of,Cg,ca,wa,Wf,Xf,Ne,Oe,Me,Dg,Ag,Dc,Bc,Ng,Ie,Qc,Ha,Ec,Cc,Lf}from'./chunk-VUJGPCPU.js';var Bt=Object.freeze(["default","first","even"]),ct=Object.freeze({kind:"body"});function B(n){switch(n.kind){case "body":return "body";case "note":return `note:${n.noteKind}:${String(n.noteId)}`;default:return `${n.kind}:${String(n.sectionIndex)}:${n.variant}`}}function rn(n){if(typeof n!="object"||n===null)return false;let e=n;return e.kind==="body"?true:e.kind==="note"?(e.noteKind==="footnote"||e.noteKind==="endnote")&&Number.isInteger(e.noteId):e.kind!=="header"&&e.kind!=="footer"?false:Number.isInteger(e.sectionIndex)&&e.sectionIndex>=0&&Bt.includes(e.variant)}var mr=["getDocument","getBody","getParagraphs","getSpanParagraphs","getText","getSpanText","getParagraphId","search","getFont","getParagraphFormat","getStyle","getSections","getPageSetup","getFurniture","getNotes","getNoteBody","getNoteText","getNoteKind","getLists","getListId","getListById","getListParagraphs","getParagraphList","getListLevel","getHyperlink","getBookmarks","getBookmarkName","getBookmarkRange","getComments","getCommentReplies","getCommentId","getCommentAuthor","getCommentDate","getCommentText","getCommentRange","getCommentResolved","getRevisions","getRevisionType","getRevisionAuthor","getRevisionDate","getRevisionRange","getContentControls","getContentControlById","getContentControlsByTag","getContentControlsByTitle","getContentControlTag","getContentControlTitle","getContentControlFileId","getContentControlSubtype","getContentControlLock","getContentControlIsBound","getContentControlPlaceholderShown","getContentControlTemporary","getContentControlText","getContentControlParagraphs","getContentControlRange"],io=["insertText","replaceSpan","replaceStoryBlocks","insertParagraph","splitParagraph","deleteParagraph","selectSpan","selectBookmark","setFont","setParagraphFormat","setStyle","setPageSetup","deleteNote","setListLevel","insertListParagraph","setHyperlink","insertComment","setCommentResolved","replyToComment","deleteComment","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","setContentControlValue","setContentControlProperties","deleteContentControl","insertContentControlText","insertContentControl","insertCustomNode"],lo=["deleteNote","insertComment","setCommentResolved","replyToComment","insertCustomNode"],uo=new Set(lo);function Zt(n){return uo.has(n.op)}var co=new Set(io);function qt(n){return co.has(n.op)}function po(){let n=globalThis.crypto,e=n?.getRandomValues;if(typeof e!="function")throw new Error("automation: no secure random source. globalThis.crypto.getRandomValues is required to scope document handles to one host.");let s=e.call(n,new Uint8Array(16)),a="";for(let i of s)a+=i.toString(16).padStart(2,"0");return a}function mo(n){return typeof n=="object"&&n!==null&&"kind"in n&&"ref"in n}function an(){let n=new Map,e=new Map,s=new Map,a=new Map,i=po(),u=null,c=(m,y)=>{let v=(a.get(m)??0)+1;a.set(m,v);let k=`${m}:${i}:${String(v)}`;return n.set(k,y),Object.freeze({kind:m,ref:k})},g=(m,y,v)=>{let k=`${m}\0${y}`,I=s.get(k);if(I)return Object.freeze({kind:m,ref:I});let A=c(m,v);return s.set(k,A.ref),A};return {document(){return u??=c("document",{kind:"document"}),u},body(m){return g("body",B(m),{kind:"body",story:m})},paragraph(m,y){let v=e.get(m);if(v)return Object.freeze({kind:"paragraph",ref:v});let k=c("paragraph",{kind:"paragraph",paragraphId:m,story:y});return e.set(m,k.ref),k},section(m){return g("section",String(m),{kind:"section",index:m})},note(m,y){return g("note",`${m}:${String(y)}`,{kind:"note",noteKind:m,noteId:y})},comment(m,y){return g("comment",`${B(y)}\0${m}`,{kind:"comment",commentId:m,story:y})},revision(m,y){return g("revision",`${B(y)}\0${m}`,{kind:"revision",revisionId:m,story:y})},bookmark(m,y){return g("bookmark",`${B(y)}\0${m}`,{kind:"bookmark",name:m,story:y})},list(m,y){return g("list",`${B(y)}\0${m}`,{kind:"list",numId:m,story:y})},contentControl(m,y){return g("contentControl",`${B(y)}\0${m}`,{kind:"contentControl",nodeId:m,story:y})},retarget(m,y){let v=e.get(m);if(!v||m===y)return;let k=n.get(v);!k||k.kind!=="paragraph"||(e.delete(m),n.set(v,{kind:"paragraph",paragraphId:y,story:k.story}),e.has(y)||e.set(y,v));},resolve(m,y){if(!mo(m)||m.kind!==y||typeof m.ref!="string")return null;let v=n.get(m.ref);return !v||v.kind!==y?null:v}}}var fo=255,yo=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false});function sn(n){let e=Nc(n);if(!e)return yo;let s=new Map,a=new Map,i=null;for(let u of Mc(e).values())if(u.type==="paragraph"){if(s.set(u.styleId,u.name),u.name!==null){let c=u.name.trim().toLowerCase();a.has(c)||a.set(c,u.styleId);}u.isDefault&&i===null&&(i=u.styleId);}return Object.freeze({nameOf:u=>s.get(u)??null,idOf:u=>a.get(u.trim().toLowerCase())??null,defaultId:i,present:true})}function _t(n,e,s){let a=va(n,e);if(!a||a.kind!=="paragraph")return null;let i=go(Sd(Qd(a),"pStyle"));return i!==null?s.nameOf(i):s.defaultId===null?null:s.nameOf(s.defaultId)}function go(n){if(!n)return null;for(let e of n.attributes)if(e.localName==="val")return e.value;return null}function Ft(n,e){if(typeof n!="string"||n.trim().length===0)return {ok:false,detail:"style: not a name"};if(n.length>fo)return {ok:false,detail:"style: name too long"};if(!N(n))return {ok:false,detail:"style: not valid XML text"};if(!e.present)return {ok:false,detail:"style: this document defines no styles"};let s=e.idOf(n);return s===null?{ok:false,detail:"style: this document defines no paragraph style with that name"}:{ok:true,styleId:s}}var ho=31680,ko=1999,Ao=Object.freeze({bold:null,italic:null,name:null,size:null,color:null});function Y(n,e){if(!n)return null;for(let s of n.attributes)if(s.localName===e)return s.value;return null}function te(n){if(!n)return null;let e=Y(n,"val");if(e===null)return true;let s=e.trim().toLowerCase();return !(s==="0"||s==="false"||s==="off"||s==="none")}function vo(n){if(n===null)return null;let e=n.trim();return /^[0-9a-fA-F]{6}$/.test(e)?`#${e.toUpperCase()}`:null}function bo(n){if(n===null)return null;let e=Number(n.trim());return !Number.isFinite(e)||e<=0?null:e/2}function ft(n){if(n===null)return null;let e=Number(n.trim());return Number.isFinite(e)?Dc(Bc(e)):null}function Rt(n){if(n.length===0)return null;let e=n[0];if(e===null)return null;for(let s of n)if(s!==e)return null;return e}function ln(n,e){let s=[];for(let a of e)for(let i of rg(n,a.paragraphId,a.start,a.end))s.push(Rd(i));return s.length===0?Ao:{bold:Rt(s.map(a=>te(Sd(a,"b")))),italic:Rt(s.map(a=>te(Sd(a,"i")))),name:Rt(s.map(a=>{let i=Sd(a,"rFonts"),u=Y(i,"ascii");return u===null||u.length===0?null:u})),size:Rt(s.map(a=>bo(Y(Sd(a,"sz"),"val")))),color:Rt(s.map(a=>vo(Y(Sd(a,"color"),"val"))))}}var xo=Object.freeze({left:"Left",start:"Left",center:"Centered",right:"Right",end:"Right",both:"Justified",distribute:"Justified"}),So=Object.freeze({Left:"left",Centered:"center",Right:"right",Justified:"both"});function Io(n){let e=Y(Sd(n,"jc"),"val");return e===null?"Unknown":xo[e.trim().toLowerCase()]??"Unknown"}function un(n,e,s){let a=va(n,e);if(!a||a.kind!=="paragraph")return null;let i=Qd(a),u=Sd(i,"spacing"),c=Sd(i,"ind");return {alignment:Io(i),style:_t(n,e,s),firstLineIndent:Ro(c),leftIndent:ft(Y(c,"left")??Y(c,"start")),rightIndent:ft(Y(c,"right")??Y(c,"end")),lineSpacing:ft(Y(u,"line")),spaceBefore:ft(Y(u,"before")),spaceAfter:ft(Y(u,"after")),widowControl:te(Sd(i,"widowControl"))}}function Ro(n){let e=ft(Y(n,"hanging"));if(e!==null&&e>0)return -e;let s=ft(Y(n,"firstLine"));return s!==null?s:e===null?null:-e}function Dt(n,e){if(typeof n!="number"||!Number.isFinite(n))return {ok:false,detail:`${e}: not a measurement`};let s=Ec(Cc(n));return Math.abs(s)>ho?{ok:false,detail:`${e}: out of range`}:{ok:true,value:s}}function cn(n){let e=[];if(n.bold!==void 0){if(typeof n.bold!="boolean")return {ok:false,detail:"bold: not a boolean"};e.push({localName:"b",...n.bold?{}:{attributes:{val:"0"}}});}if(n.italic!==void 0){if(typeof n.italic!="boolean")return {ok:false,detail:"italic: not a boolean"};e.push({localName:"i",...n.italic?{}:{attributes:{val:"0"}}});}if(n.name!==void 0){let s=n.name;if(typeof s!="string"||s.length===0||s.length>128)return {ok:false,detail:"name: not a font name"};if(!N(s))return {ok:false,detail:"name: not valid XML text"};e.push({localName:"rFonts",attributes:{ascii:s,hAnsi:s}});}if(n.size!==void 0){let s=n.size;if(typeof s!="number"||!Number.isFinite(s)||s<=0)return {ok:false,detail:"size: not a positive number of points"};let a=Math.round(s*2);if(a<1||a>ko)return {ok:false,detail:"size: out of range"};e.push({localName:"sz",attributes:{val:String(a)}}),e.push({localName:"szCs",attributes:{val:String(a)}});}if(n.color!==void 0){let s=n.color;if(typeof s!="string"||!/^#[0-9a-fA-F]{6}$/.test(s.trim()))return {ok:false,detail:"color: not a #RRGGBB triplet"};e.push({localName:"color",attributes:{val:s.trim().slice(1).toUpperCase()}});}return e.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:e}}function pn(n,e,s,a){let i=va(n,e);if(!i||i.kind!=="paragraph")return {ok:false,detail:"not a paragraph"};let u=Qd(i),c=[];if(s.style!==void 0){let A=Ft(s.style,a);if(!A.ok)return {ok:false,detail:A.detail};c.push({localName:"pStyle",attributes:{val:A.styleId}});}if(s.alignment!==void 0){let A=So[s.alignment];if(A===void 0)return {ok:false,detail:`alignment: ${String(s.alignment)}`};c.push({localName:"jc",attributes:{val:A}});}let g=Sd(u,"ind"),m=dn(g),y=false;if(s.firstLineIndent!==void 0){let A=Dt(s.firstLineIndent,"firstLineIndent");if(!A.ok)return A;delete m.firstLine,delete m.hanging,A.value<0?m.hanging=String(-A.value):m.firstLine=String(A.value),y=true;}for(let[A,b,C]of [["leftIndent","left","start"],["rightIndent","right","end"]]){let O=s[A];if(O===void 0)continue;let T=Dt(O,A);if(!T.ok)return T;delete m[C],m[b]=String(T.value),y=true;}y&&c.push({localName:"ind",attributes:m});let v=Sd(u,"spacing"),k=dn(v),I=false;for(let[A,b]of [["spaceBefore","before"],["spaceAfter","after"]]){let C=s[A];if(C===void 0)continue;let O=Dt(C,A);if(!O.ok)return O;if(O.value<0)return {ok:false,detail:`${A}: out of range`};k[b]=String(O.value),I=true;}if(s.lineSpacing!==void 0){let A=Dt(s.lineSpacing,"lineSpacing");if(!A.ok)return A;if(A.value<=0)return {ok:false,detail:"lineSpacing: out of range"};k.line=String(A.value),k.lineRule??="auto",I=true;}if(I&&c.push({localName:"spacing",attributes:k}),s.widowControl!==void 0){if(typeof s.widowControl!="boolean")return {ok:false,detail:"widowControl: not a boolean"};c.push({localName:"widowControl",...s.widowControl?{}:{attributes:{val:"0"}}});}return c.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:kg(ig(n,e),c)}}function dn(n){let e=Object.create(null);if(!n)return e;for(let s of n.attributes)e[s.localName]=s.value;return e}function mn(){let n=false,e=false,s=false;return {conflict(a){let i=qt(a),u=Zt(a),c=a.op==="deleteComment";return u&&n||e&&i?{message:"that command commits on its own and cannot share a batch",detail:a.op}:c&&n&&!s||s&&i&&!c?{message:"comment deletions may share a batch only with other comment deletions",detail:a.op}:null},note(a){qt(a)&&(n=true,Zt(a)&&(e=true),a.op==="deleteComment"&&(s=true));},get hasCommands(){return n}}}var Co=63360;function lt(n){return Math.round(Dc(Bc(n))*100)/100}function Po(n,e){if(typeof n!="number"||!Number.isFinite(n))return null;let s=Ec(Cc(n));return s>Co||s<0||s===0&&!e?null:s}var Oo=[["pageWidth","pageWidthTwips",false],["pageHeight","pageHeightTwips",false],["topMargin","marginTopTwips",true],["rightMargin","marginRightTwips",true],["bottomMargin","marginBottomTwips",true],["leftMargin","marginLeftTwips",true]];function fn(n){if(typeof n!="object"||n===null)return {ok:false,reason:"that is not a page setup",detail:"not-an-object"};let e=n,s={},a=0;for(let[u,c,g]of Oo){let m=e[u];if(m===void 0)continue;let y=Po(m,g);if(y===null)return {ok:false,reason:`that is not a value for ${u}`,detail:String(m)};s[c]=y,a+=1;}let i=e.orientation;if(i!==void 0){if(i!=="portrait"&&i!=="landscape")return {ok:false,reason:"that is not an orientation",detail:String(i)};s.orientation=i,a+=1;}return a===0?{ok:false,reason:"that page setup names nothing to write",detail:"empty"}:{ok:true,value:s}}function wo(n){let e=vf(n),s=e.widthTwips>e.heightTwips?"landscape":"portrait";return Object.freeze({pageWidth:lt(e.widthTwips),pageHeight:lt(e.heightTwips),orientation:s,topMargin:lt(e.topTwips),rightMargin:lt(e.rightTwips),bottomMargin:lt(e.bottomTwips),leftMargin:lt(e.leftTwips),headerDistance:lt(e.headerTwips),footerDistance:lt(e.footerTwips),gutter:lt(e.gutterTwips)})}function To(n,e){if(!e)return null;let s=null,a=(i,u,c)=>{if(s!==null||i.kind==="textValue"||c>64)return;let g=i.kind==="paragraph"?i.id:u;if(i.id===e.id){s=g;return}for(let m of i.children)a(m,g,c+1);};return a(n.root,null,0),s}function yn(n,e,s){let a=Pb(e.root);return Object.freeze(a.map((i,u)=>{let c=s[u];return Object.freeze({index:u,markParagraphId:To(e,i),pageSetup:wo(i),titlePage:c?.titlePage??false,evenAndOddHeaders:c?.evenAndOddHeaders??false})}))}function hn(n,e,s){if(s==="allMarkup")return gn(e);let a=No(n);if(a.length===0)return gn(e);let i=[],u=[],c=0,g=0;for(let m of a){if(c<m.start){let y=e.slice(c,m.start);i.push({projectedStart:g,projectedEnd:g+y.length,rawStart:c,rawEnd:m.start}),u.push(y),g+=y.length;}c=Math.max(c,m.end);}if(c<e.length){let m=e.slice(c);i.push({projectedStart:g,projectedEnd:g+m.length,rawStart:c,rawEnd:e.length}),u.push(m);}return kn(u.join(""),i)}function gn(n){return kn(n,n.length===0?[]:[{projectedStart:0,projectedEnd:n.length,rawStart:0,rawEnd:n.length}])}function kn(n,e){return {text:n,projectedOffset(s){let a=0;for(let i of e)if(s<=i.rawStart||(a+=Math.max(0,Math.min(s,i.rawEnd)-i.rawStart),s<=i.rawEnd))return a;return a},rawRange(s,a){let i=e.find(c=>s>=c.projectedStart&&s<c.projectedEnd),u=e.find(c=>a>c.projectedStart&&a<=c.projectedEnd);return !i||!u||s>=a?null:{start:i.rawStart+s-i.projectedStart,end:u.rawStart+a-u.projectedStart}},sliceRaw(s,a){return s>=a?"":e.map(i=>{let u=Math.max(s,i.rawStart),c=Math.min(a,i.rawEnd);return u<c?n.slice(i.projectedStart+u-i.rawStart,i.projectedStart+c-i.rawStart):""}).join("")}}}function No(n){let e=Ud(n),s=[],a=(u,c)=>{if(!(c>64||u.kind==="textValue")){if(u.kind==="revisionInsert"||u.kind==="revisionMoveTo"){let g=e.spanOf(u);g&&g.end>g.start&&s.push({start:g.start,end:g.end});return}for(let g of u.children)a(g,c+1);}};a(n,0),s.sort((u,c)=>u.start-c.start||c.end-u.end);let i=[];for(let u of s){let c=i[i.length-1];c&&u.start<=c.end?c.end=Math.max(c.end,u.end):i.push({...u});}return i}var ne="\r",Ho=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false}),jo=Object.freeze([]),Lo=Object.freeze([]),An=Object.freeze([]),Mo=Object.freeze({package:null,body:null,story:()=>null,storyOf:()=>null,sections:()=>Lo,furniture:()=>An,noteIds:()=>({ok:true,ids:bn}),styles:()=>Ho});function Eo(n){return n.kind==="textValue"?jo:Object.freeze(n.children.filter(e=>e.kind!=="textValue").map(e=>{let s=[];Je([e],s,0);let a=e.kind==="paragraph"?"paragraph":e.kind==="table"?"table":"other",i=e.kind==="paragraph"&&Sd(Qd(e),"sectPr")!==void 0;return Object.freeze({id:e.id,kind:a,paragraphIds:Object.freeze(s.map(u=>u.id)),removable:a!=="other"&&!i})}))}function ee(n,e,s,a,i){let u=Ie(a),c=Object.freeze(u.map(A=>A.id)),g=new Map,m=new Map;u.forEach((A,b)=>{g.set(A.id,b),m.set(A.id,A);});let y=new Map,v=A=>{if(!g.has(A))return null;let b=y.get(A);if(b!==void 0)return b;let C=Lf(e,A)??"";return y.set(A,C),C},k=new Map,I=(A,b="allMarkup")=>{let C=m.get(A);if(!C||C.kind!=="paragraph")return null;let O=`${A}:${b}`,T=k.get(O);if(T)return T;let M=hn(C,v(A)??"",b);return k.set(O,M),M};return {story:n,part:e,root:a,scope:s,paragraphIds:c,blocks:Eo(a),has:A=>g.has(A),indexOf:A=>g.get(A)??-1,paragraph(A){let b=m.get(A);return b?{nodeId:A,paraId:Qc(b),text:v(A)??""}:null},node:A=>m.get(A)??null,paragraphText:(A,b)=>I(A,b)?.text??null,projectedText:I,text:A=>c.map(b=>I(b,A)?.text??"").join(ne),styles:i}}function vn(n){let e=n.parts.get(n.mainDocumentPart);if(!e)return Mo;let s,a=()=>s??=sn(n),i,u=()=>i??=Rb(n),c,g=new Map,m=new Map,y=b=>{let C=m.get(b);if(C)return C;let O=_d(n,b);if(!O){let V={ok:true,ids:bn};return m.set(b,V),V}let T=[],M=new Set,_=new Set,J=0,X=false;for(let V of O.root.children){if(pd(V)!==b)continue;if(J+=1,V.kind!=="note"){X=true;continue}if(!sd(V))continue;let nt=qd(V);if(nt===null){X=true;continue}M.has(nt)?_.add(nt):(M.add(nt),T.push(nt));}let L=J>zd?{ok:false,reason:"truncated"}:X?{ok:false,reason:"malformed"}:_.size>0?{ok:false,reason:"duplicates",duplicateIds:Object.freeze([..._])}:{ok:true,ids:Object.freeze(T)};return m.set(b,L),L},v=b=>{let C=u()[b.sectionIndex];return C?(b.kind==="header"?C.headers:C.footers).get(b.variant)??null:null},k=b=>{if(b.kind==="body"){let O=He(e);return O?ee(b,e,{kind:"body"},O,a):null}if(b.kind==="note"){let O=y(b.noteKind);if(!O.ok||!O.ids.includes(b.noteId))return null;let T=_d(n,b.noteKind);if(!T)return null;let M=Cd(T.root,b.noteId);return !M||!sd(M)?null:ee(b,T,{kind:"notesPart",noteKind:b.noteKind},M,a)}let C=v(b);return C?ee(b,C.part,{kind:"headerFooter",rId:C.rId},C.part.root,a):null},I=b=>{let C=B(b);if(g.has(C))return g.get(C)??null;let O=k(b);return g.set(C,O),O};return {package:n,get body(){return I(ct)},story:I,storyOf:b=>{if(I(ct)?.has(b))return ct;for(let[O]of u().entries())for(let T of ["header","footer"])for(let M of Bt){let _={kind:T,sectionIndex:O,variant:M};if(I(_)?.has(b))return _}for(let O of ["footnote","endnote"]){let T=y(O);if(T.ok)for(let M of T.ids){let _={kind:"note",noteKind:O,noteId:M};if(I(_)?.has(b))return _}}return null},sections:()=>c??=yn(n,e,u()),furniture(b){let C=u()[b];if(!C)return An;let O=[];for(let T of ["header","footer"]){let M=T==="header"?C.headers:C.footers;for(let _ of Bt){let J=M.get(_);J&&O.push(Object.freeze({kind:T,variant:_,declared:!J.inherited}));}}return Object.freeze(O)},noteIds:y,styles:a}}var bn=Object.freeze([]);function rt(n,e){return {ok:false,code:n,detail:e}}function at(n){return {ok:true,value:n}}function K(n,e,s,a){let i=s.resolve(n,e);if(!i||i.kind!=="body"&&i.kind!=="paragraph")return rt("invalid-handle",`not-a-${e}-handle`);let u=a.story(i.story);return u?at(u):rt("invalid-handle",`no-such-story:${B(i.story)}`)}function Z(n,e,s){let a=e.resolve(n,"paragraph");if(!a||a.kind!=="paragraph")return rt("invalid-handle","not-a-paragraph-handle");let i=s.story(a.story);if(!i)return rt("invalid-handle",`no-such-story:${B(a.story)}`);let u=i.indexOf(a.paragraphId);return u<0?rt("invalid-handle","paragraph-not-in-body"):at({story:a.story,paragraphId:a.paragraphId,index:u,offset:0})}function Bo(n,e,s){let a=Z(n.paragraph,e,s);if(!a.ok)return a;let u=(s.story(a.value.story)?.paragraphText(a.value.paragraphId)??"").length,{offset:c}=n;return !Number.isInteger(c)||c<0||c>u?rt("invalid-offset",`offset ${String(c)} outside 0..${String(u)}`):at({...a.value,offset:c})}function kt(n,e,s){if("paragraph"in n){if(!("at"in n))return Bo(n,e,s);let g=Z(n.paragraph,e,s);if(!g.ok||n.at==="start")return g;let y=(s.story(g.value.story)?.paragraphText(g.value.paragraphId)??"").length;return at({...g.value,offset:y})}let a=K(n.body,"body",e,s);if(!a.ok)return a;let i=a.value.paragraphIds;if(i.length===0)return rt("invalid-offset","empty-story");if(n.at==="start")return at({story:a.value.story,paragraphId:i[0],index:0,offset:0});let u=i.length-1,c=i[u];return at({story:a.value.story,paragraphId:c,index:u,offset:(a.value.paragraphText(c)??"").length})}function _o(n,e){return n.index<e.index||n.index===e.index&&n.offset<=e.offset}function Fo(n){let e=n.paragraphIds;if(e.length===0)return null;let s=e.length-1,a=e[s];return {start:{story:n.story,paragraphId:e[0],index:0,offset:0},end:{story:n.story,paragraphId:a,index:s,offset:(n.paragraphText(a)??"").length}}}function W(n,e,s){if("body"in n){let u=K(n.body,"body",e,s);return u.ok?at(Fo(u.value)):u}if("paragraph"in n){let u=Z(n.paragraph,e,s);if(!u.ok)return u;let g=(s.story(u.value.story)?.paragraphText(u.value.paragraphId)??"").length;return at({start:u.value,end:{...u.value,offset:g}})}let a=kt(n.start,e,s);if(!a.ok)return a;let i=kt(n.end,e,s);return i.ok?B(a.value.story)!==B(i.value.story)?rt("invalid-handle","span-crosses-stories"):_o(a.value,i.value)?at({start:a.value,end:i.value}):rt("invalid-offset","span-start-after-end"):i}function q(n,e,s){if("body"in n)return K(n.body,"body",e,s);if("paragraph"in n)return K(n.paragraph,"paragraph",e,s);let a=n.start;return "paragraph"in a?K(a.paragraph,"paragraph",e,s):K(a.body,"body",e,s)}function Wt(n,e,s){if("paragraph"in n)return Z(n.paragraph,e,s);let a=K(n.body,"body",e,s);if(!a.ok)return a;let i=a.value.paragraphIds;if(i.length===0)return rt("invalid-offset","empty-story");let u=n.at==="first"?0:i.length-1;return at({story:a.value.story,paragraphId:i[u],index:u,offset:0})}function tt(n,e){return n?e.paragraphIds.slice(n.start.index,n.end.index+1):[]}function oe(n,e){if(!n)return [];let s=tt(n,e),a=s.length-1;return s.map((i,u)=>{let c=(e.paragraphText(i)??"").length,g=u===0?n.start.offset:0,m=u===a?n.end.offset:c;return {paragraphId:i,start:g,end:m,whole:g===0&&m===c}})}function xn(n,e,s,a="allMarkup"){if(!n)return "";let i=tt(n,e);return i.length===1?e.projectedText(n.start.paragraphId,a)?.sliceRaw(n.start.offset,n.end.offset)??"":i.map((u,c)=>{let g=e.projectedText(u,a);if(!g)return "";let m=(e.paragraphText(u)??"").length;return c===0?g.sliceRaw(n.start.offset,m):c===i.length-1?g.sliceRaw(0,n.end.offset):g.text}).join(s)}function re(n,e){return {start:{paragraph:e.paragraph(n.start.paragraphId,n.start.story),offset:n.start.offset},end:{paragraph:e.paragraph(n.end.paragraphId,n.end.story),offset:n.end.offset}}}var Do=256,Sn=1e4;function ae(n,e){if(n.kind!=="textValue"){for(let s of n.attributes)if(s.namespaceUri===ca&&s.localName===e)return s.value}}function Wo(n){return n.startsWith("_")}function se(n){let e=new Map,s=[],a=new Set;for(let i of n.paragraphIds){let u=n.node(i);if(u?.kind!=="paragraph")continue;let c=Ud(u),g=m=>{if(m.kind!=="textValue"){if(m.kind==="bookmarkStart"){if(s.length>=Sn||e.size>=Sn)return;let y=ae(m,"id"),v=ae(m,"name");if(y===void 0||v===void 0||v.length===0||v.length>Do||Wo(v)||a.has(v)||e.has(y))return;let k=c.spanOf(m)?.start??0;e.set(y,{name:v,start:{paragraphId:i,offset:k}});return}if(m.kind==="bookmarkEnd"){let y=ae(m,"id");if(y===void 0)return;let v=e.get(y);if(!v)return;e.delete(y),a.add(v.name);let k=c.spanOf(m)?.start??0;s.push(Object.freeze({name:v.name,start:v.start,end:{paragraphId:i,offset:k}}));return}for(let y of m.children)g(y);}};for(let m of u.children)g(m);}return Object.freeze(s)}function ie(n,e){return se(n).find(s=>s.name===e)??null}function In(n,e){let s=n.node(e);if(s?.kind!=="paragraph")return Object.freeze([]);let a=Ud(s),i=[],u=(c,g)=>{if(!(c.kind==="textValue"||g>32)){if(Ha(c)){let m=a.spanOf(c);m&&i.push(Object.freeze({id:c.id,paragraphId:e,start:m.start,end:m.end}));return}for(let m of c.children)u(m,g+1);}};for(let c of s.children)u(c,0);return Object.freeze(i)}function Rn(n,e,s){let a=Ka(s,i=>Zc(n,e,i));if(a.kind==="external")return a.href;if(a.kind==="internal"){let i=Ia(s);return i===void 0||i.length===0?null:`#${i}`}return null}var At=8;function Cn(n){if(!n||n.kind==="textValue")return null;for(let e of n.attributes)if(e.namespaceUri===ca&&e.localName==="val")return e.value;return null}function Pn(n){let e=Sd(Qd(n),"numPr");if(!e)return null;let s=Cn(Sd(e,"numId"));if(s===null||!/^\d{1,10}$/.test(s)||s==="0")return null;let a=Cn(Sd(e,"ilvl")),i=a===null?0:Number(a);return !Number.isInteger(i)||i<0||i>At?null:{numId:s,level:i}}function zt(n){let e=new Map;for(let s of n.paragraphIds){let a=n.node(s);if(!a)continue;let i=Pn(a);if(!i)continue;let u=e.get(i.numId);u?u.push(s):e.set(i.numId,[s]);}return Object.freeze([...e].map(([s,a])=>Object.freeze({numId:s,paragraphIds:Object.freeze(a)})))}function Ct(n,e){let s=n.node(e);return s?Pn(s):null}function On(n,e,s,a,i){let u=Math.min(i?.limit??2e3,2e3),c=[],g=tt(e,n),m=g.length-1;for(let[y,v]of g.entries()){if(u<=0)break;let k=n.projectedText(v,i?.projection??"allMarkup");if(!k)continue;let I=Ng(k.text,a,u,{matchCase:i?.matchCase===true,wholeWord:i?.matchWholeWord===true,...y===0&&e?{from:k.projectedOffset(e.start.offset)}:{},...y===m&&e?{to:k.projectedOffset(e.end.offset)}:{}});for(let A of I.matches){let b=k.rawRange(A.start,A.start+A.length);if(!b)return {ok:false,paragraphId:v};if(y===0&&e&&b.start<e.start.offset||y===m&&e&&b.end>e.end.offset)continue;let C=s.paragraph(v,n.story);c.push({start:{paragraph:C,offset:b.start},end:{paragraph:C,offset:b.end}}),u-=1;}}return {ok:true,spans:c}}var zo={insert:"Insert",delete:"Delete",replace:"Replace",moveFrom:"MovedFrom",moveTo:"MovedTo",format:"Property",paragraphMark:"ParagraphProperty"};function Ko(n){return n.kind==="note"}function Vo(n,e){return e.length===0?!Ko(n.story):e.every(s=>n.has(s.start.paragraphId))}function $o(n){return Object.freeze(Cg(n.part).filter(e=>Vo(n,e.ranges)))}function de(n){let e=[];for(let s of $o(n)){if(s.readOnly||s.revisionKind==="structural")continue;let a=zo[s.revisionKind];a!==void 0&&e.push(Object.freeze({id:s.id,type:a,author:s.author,date:s.date??"",item:s}));}return Object.freeze(e)}function Uo(n,e){let s=n;for(let a=0;s!==void 0&&a<=64;a+=1){if(s.parentId===void 0)return s.range!==null;s=e.get(s.parentId);}return false}var Xo=Object.freeze({items:Object.freeze([]),roots:Object.freeze([]),byId:()=>null,textOf:()=>""});function wn(n,e){let s=n.parts.get(Wf(n,e.part.name));if(!s)return Xo;let a=n.parts.get(Xf(n,e.part.name)),i=Ne(s),u=a?Oe(a):new Map,c=Me(e.part).filter(k=>e.has(k.start.paragraphId)),g=Dg(i,c,u),m=new Map(g.map(k=>[k.id,k])),y=g.filter(k=>Uo(k,m)),v=new Map(y.map(k=>[k.id,k]));return Object.freeze({items:Object.freeze(y),roots:Object.freeze(y.filter(k=>k.parentId===void 0)),byId:k=>v.get(k)??null,textOf:k=>{let I=v.get(k);return I?Ag(I.comment):""}})}function Tn(n,e,s){if("body"in n){let a=K(n.body,"body",e,s);return a.ok?{ok:true,reads:a.value}:{ok:false,code:a.code,message:"that handle does not name a body",detail:a.detail}}return e.resolve(n.document,"document")?s.body?{ok:true,reads:s.body}:{ok:false,code:"document-unavailable",message:"this host holds no document"}:{ok:false,code:"invalid-handle",message:"that handle does not name a document",detail:"document"}}function Nn(n,e){let s=n.op==="acceptAllRevisions",a=e.story.kind==="note"?{scopeRootId:e.root.id}:{};return [s?{op:"acceptAllRevisions",...a}:{op:"rejectAllRevisions",...a}]}var Yo=/[\r\n\u2028\u2029]/u,jn=Object.freeze({kind:"applied"});function vt(n,e,s){return {ok:false,error:Object.freeze(s===void 0?{code:n,message:e}:{code:n,message:e,detail:s})}}function le(n,e){return vt("unsupported-content",n==="author"?"a comment records who wrote it":n==="date"?"a comment date must be a valid ISO-8601 instant":e==="reply"?"a reply says something":"a comment says something",n)}function ue(n){return Pf(n.author)?le("author",n.kind):Qf(n.text)?le("text",n.kind):typeof n.text=="string"&&Yo.test(n.text)?vt("unsupported-content",n.kind==="reply"?"a reply is one paragraph in this slice":"a comment is one paragraph in this slice","text"):Sf(n.date)?le("date",n.kind):null}function ce(n){if(n===void 0)return;let e=Rf(n);return e.ok?e.value:void 0}function Hn(n,e){let s=va(n.part,e);for(;s;){if(s.kind==="tableCell"||s.kind!=="textValue"&&s.namespaceUri===ca&&s.localName==="tc")return s.id;s=wa(n.part,s.id);}return null}function Ln(n,e,s,a){let i=ue({author:n.author,text:n.text,date:n.date,kind:"comment"});if(i)return i;let u=W(n.span,e,s);if(!u.ok)return vt(u.code,"that span is not a place",u.detail);if(u.value===null)return vt("invalid-handle","an empty story has no comment anchor");let c=q(n.span,e,s);if(!c.ok)return vt(c.code,"that span is not a place",c.detail);let g=u.value;if(Hn(c.value,g.start.paragraphId)!==Hn(c.value,g.end.paragraphId))return vt("unsupported-content","a comment range cannot cross a table-cell boundary");let m=a(c.value);if(m)return m;let y=ce(n.date);return {ok:true,kind:"commentWrite",write:{kind:"create",anchor:{paragraphId:g.start.paragraphId,start:g.start.offset,end:g.end.offset,...g.end.paragraphId===g.start.paragraphId?{}:{endParagraphId:g.end.paragraphId}},text:n.text,author:n.author,...y===void 0?{}:{date:y}},story:c.value.story,answer:(k,I)=>I===void 0?jn:{kind:"handle",handle:e.comment(I,c.value.story)}}}function Mn(n,e,s){let a=s(e);if(a)return a;let i=e.story;return {ok:true,kind:"commentWrite",write:{kind:"delete",commentId:n.id,...n.parentId===void 0?{}:{parentCommentId:n.parentId},...i.kind==="note"?{noteId:i.noteId}:{}},story:i,answer:()=>jn}}var Go=1e4;function En(n,e){let s=[],a=e.kind==="contentControl"?re$1(e):e;if(!a)return s;for(let i of ve(a))if(!(i.ancestors.length>0)){if(s.length>=Go)break;s.push(Dn(n,i.node));}return s}function Bn(n,e){for(let s of ve(n.root))if(s.node.id===e)return Dn(n,s.node);return null}function _n(n,e){for(let s of ve(n.root))if(s.node.id===e)return s.node;return null}function Kt(n,e){let s=Wn(e);if(s.length>0){let a=s[0],i=s[s.length-1],u=n.paragraphText(i);return u===null||!n.has(a)?null:{start:{paragraphId:a,offset:0},end:{paragraphId:i,offset:u.length}}}for(let a of n.paragraphIds){let i=n.node(a);if(!i||i.kind!=="paragraph"||!i.children.some(c=>c.id===e.id))continue;let u=Ud(i).spanOf(e);return u?{start:{paragraphId:a,offset:u.start},end:{paragraphId:a,offset:u.end}}:null}return null}function Fn(n,e,s="allMarkup"){if(s==="allMarkup")return xe(e);let a=Kt(n,e);if(!a)return "";let i=n.indexOf(a.start.paragraphId),u=n.indexOf(a.end.paragraphId);if(i<0||u<i)return "";let c=[];for(let g=i;g<=u;g+=1){let m=n.paragraphIds[g],y=n.projectedText(m,s),v=n.paragraphText(m);if(!y||v===null)return "";c.push(y.sliceRaw(g===i?a.start.offset:0,g===u?a.end.offset:v.length));}return c.join("\r")}function Dn(n,e){return {nodeId:e.id,properties:te$1(e),lock:of(n.part,e.id),paragraphIds:Wn(e)}}function Wn(n){let e=re$1(n);if(!e)return [];let s=[];return Je(e.children,s,0),s.map(a=>a.id)}var Jo=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),Qo=4096,zn=64;function Kn(n){if(n===void 0)return {ok:true,value:null};if(typeof n!="object"||n===null)return {ok:false,field:"payload"};let e=n;for(let s of ["namespaceUri","rootLocalName","nodeId"]){let a=e[s];if(typeof a!="string"||a.length===0||a.length>Qo)return {ok:false,field:s}}return typeof e.label!="string"||e.label.length>Zf?{ok:false,field:"label"}:typeof e.data!="string"||e.data.length===0||e.data.length>Yf?{ok:false,field:"data"}:{ok:true,value:{namespaceUri:e.namespaceUri,rootLocalName:e.rootLocalName,nodeId:e.nodeId,label:e.label,data:e.data}}}function Vn(n){let e=n.at!==void 0,s=n.span!==void 0;return e===s?{message:"a custom node goes at a position or over a span, not both",detail:e?"at+span":"no-place"}:typeof n.tag!="string"||n.tag.length===0?{message:"a custom node carries its identity in its tag",detail:"tag"}:n.tag.length>zn?{message:`w:tag caps at ${String(zn)} characters; a longer payload belongs in the store`,detail:"tag"}:typeof n.text!="string"||n.text.length===0?{message:"a custom node shows some text",detail:"text"}:n.lock!==void 0&&!Jo.has(n.lock)?{message:"that is not a lock",detail:String(n.lock)}:null}function $n(n,e,s,a){return {paragraphId:e.paragraphId,offset:e.offset,...s.offset>e.offset?{replaceUntil:s.offset}:{},tag:n.tag,text:n.text,...n.title===void 0?{}:{alias:n.title},...n.lock===void 0||n.lock==="unlocked"?{}:{lock:n.lock},...a===null?{}:{payload:a}}}function Un(n,e,s){if(n.span){let i=W(n.span,e,s);return i.ok?i.value?i.value.start.paragraphId!==i.value.end.paragraphId?{code:"unsupported-content",message:"a custom node wraps text inside one paragraph",detail:"multi-paragraph"}:{range:i.value}:{code:"invalid-offset",message:"that story holds nothing to wrap",detail:"empty-story"}:{code:i.code,message:"that span is not a place",detail:i.detail}}let a=kt(n.at,e,s);return a.ok?{range:{start:a.value,end:a.value}}:{code:a.code,message:"that is not a place",detail:a.detail}}var Pt=/[\r\n\v\f\u2028\u2029]/,Zo=16,qo=64,Xn=/\s/;function tr(n,e,s){return Object.freeze(s===void 0?{code:n,message:e}:{code:n,message:e,detail:s})}function l(n,e,s){return {ok:false,error:tr(n,e,s)}}var E=Object.freeze({kind:"applied"});function S(n){return {ok:true,kind:"query",value:n}}function Yn(n){let e=n.kind==="contentControl"?re$1(n):n;return e?ve(e).map(s=>s.node):[]}var er=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),nr=new Set(["whole","content","start","end","before","after"]),or=new Set(["richText","plainText","dropDownList","comboBox","date"]),rr=4096;function ar(n){let e=(i,u)=>({ok:false,code:"unsupported-content",message:i,detail:u});if(typeof n!="object"||n===null||!("kind"in n))return e("a control value states its kind","value");let s=n,a=s.kind;if(a==="text"||a==="listItem"){let i=a==="text"?s.text:s.value;return typeof i!="string"?e("that value is not a string",String(a)):i.length>rr?e("that value is too long",String(i.length)):{ok:true,value:a==="text"?{kind:"text",text:i}:{kind:"listItem",value:i}}}if(a==="checkbox"){let i=s.checked;return typeof i!="boolean"?e("a checkbox is checked or not","checked"):{ok:true,value:{kind:"checkbox",checked:i}}}if(a==="date"){let i=s.iso;return typeof i!="string"?e("a date is an ISO-8601 string","iso"):i.length>64?e("that is not a date",String(i.length)):{ok:true,value:{kind:"date",iso:i}}}return e("that is not a value any control accepts",String(a))}function sr(n,e){let s=[],a=0;for(;a<n.length;){let i=null;for(let u of e){let c=n.indexOf(u,a);c<0||(!i||c<i.start||c===i.start&&u.length>i.length)&&(i={start:c,length:u.length});}if(!i)break;s.push(i),a=i.start+i.length;}return s}function ir(n,e,s){let a=e[s]?.markParagraphId??null;if(a!==null)return a;let i=n.paragraphIds,u=i[i.length-1];return u===void 0||new Set(e.map(g=>g.markParagraphId).filter(g=>g!==null)).has(u)?null:u}function dr(n,e){for(let s of [n.start,n.end]){let a=e.paragraphText(s.paragraphId);if(a===null||s.offset>a.length)return false}return true}function lr(n,e,s){let a=e,i=s;for(;a<i&&Xn.test(n[a]);)a+=1;for(;i>a&&Xn.test(n[i-1]);)i-=1;return [a,i]}function Gn(n){let{handles:e,capabilities:s}=n,a=n.reads,i=new Map,u=o=>{let t=B(o.story),r=i.get(t);if(r)return r;let d=new Map,p=o.paragraphIds.map(h=>{let x={id:h};return d.set(h,x),x}),f={reads:o,order:p,slotById:d,created:[],restructured:new Set,touched:new Set,formatted:new Set,selected:new Set,retargets:[]};return i.set(t,f),f},c=[],g=mn(),m=null,y=o=>m===null?(m=o,null):m===o?null:l("conflicting-operations","one batch writes into one story",`${B(m.reads.story)} then ${B(o.reads.story)}`),v=o=>y(u(o)),k=o=>{let t=a.package;return t===null?null:wn(t,o)},I=o=>{let t=e.resolve(o,"comment");if(!t||t.kind!=="comment")return {ok:false,planned:l("invalid-handle","that handle does not name a comment","comment")};let r=a.story(t.story);if(!r)return {ok:false,planned:l("invalid-handle","that story is not in this document")};let p=k(r)?.byId(t.commentId)??null;return p?{ok:true,reads:r,item:p}:{ok:false,planned:l("invalid-handle","this document no longer holds that comment",t.commentId)}},A=o=>{let t=e.resolve(o,"revision");if(!t||t.kind!=="revision")return {ok:false,planned:l("invalid-handle","that handle does not name a tracked change","revision")};let r=a.story(t.story);if(!r)return {ok:false,planned:l("invalid-handle","that story is not in this document")};let d=de(r).find(p=>p.id===t.revisionId)??null;return d?{ok:true,reads:r,item:d}:{ok:false,planned:l("invalid-handle","this document no longer holds that tracked change",t.revisionId)}},b=(o,t)=>{let r=o.paragraphText(t.start.paragraphId),d=o.paragraphText(t.end.paragraphId);if(r===null||d===null)return null;let p={story:o.story,paragraphId:t.start.paragraphId,index:o.indexOf(t.start.paragraphId),offset:Math.min(t.start.offset,r.length)},f={story:o.story,paragraphId:t.end.paragraphId,index:o.indexOf(t.end.paragraphId),offset:Math.min(t.end.offset,d.length)};return X({start:p,end:f})},C=(o,t)=>o.order.indexOf(t),O=(o,t)=>o.selected.has(t)?l("conflicting-operations","this batch selects a paragraph it also edits",t):null,T=(o,t)=>{let r=O(o,t);return r||(o.restructured.has(t)||o.touched.has(t)?l("conflicting-operations","another operation in this batch already changes that paragraph",t):(o.restructured.add(t),o.touched.add(t),null))},M=(o,t)=>{let r=O(o,t);return r||(o.restructured.has(t)?l("conflicting-operations","another operation in this batch restructures that paragraph",t):(o.touched.add(t),null))},_=(o,t,r)=>{let d=`${r}:${t}`;if(o.formatted.has(d))return l("conflicting-operations","another operation in this batch already writes that formatting",t);let p=M(o,t);return p||(o.formatted.add(d),null)},J=(o,t)=>{let r={id:null};return o.order.splice(t,0,r),o.created.push(r),r},X=o=>re(o,e),L=o=>o===null?null:a.story(o.start.story),V=o=>o===void 0||o==="allMarkup"||o==="original",nt=(o,t,r,d)=>{if(!V(d?.projection))return l("unsupported-content","unknown text projection","projection");if(d?.matchWildcards===true)return l("unsupported-capability","wildcard search is not implemented","matchWildcards");if(d?.ignorePunct===true)return l("unsupported-capability","ignoring punctuation is not implemented","ignorePunct");if(d?.ignoreSpace===true)return l("unsupported-capability","ignoring whitespace is not implemented","ignoreSpace");if(!Mg(r))return l("unsupported-content","that is not a query this host will scan for","text");let p=d?.limit;if(p!==void 0&&(!Number.isInteger(p)||p<0))return l("invalid-offset","limit must be a non-negative integer",String(p));let f=On(o,t,e,r,d);return f.ok?S({kind:"spans",spans:f.spans}):l("invalid-offset","projection mapping failed",f.paragraphId)},bt=(o,t,r)=>{if(typeof r!="string")return l("unsupported-content","insertText needs text","text");if(Pt.test(r))return l("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let d=y(o);if(d)return d;let p=M(o,t.paragraphId);if(p)return p;let f=r.length===0?[]:[{op:"insertText",paragraphId:t.paragraphId,offset:t.offset,text:r}],h=()=>({kind:"span",span:X({start:t,end:{...t,offset:t.offset+r.length}})});return {ok:true,kind:"command",ops:f,story:o.reads.story,answer:h}},Ot=(o,t,r)=>{let d=o.reads;if(typeof r!="string")return l("unsupported-content","replaceSpan needs text","text");if(Pt.test(r))return l("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let p=tt(t,d),f=t.start.paragraphId,h=[],x=y(o);if(x)return x;if(p.length===1){let j=M(o,f);if(j)return j;t.end.offset>t.start.offset&&h.push({op:"deleteText",paragraphId:f,start:t.start.offset,end:t.end.offset});}else {for(let w of p){let P=T(o,w);if(P)return P}let j=t.end.paragraphId,D=(d.paragraphText(f)??"").length;t.start.offset<D&&h.push({op:"deleteText",paragraphId:f,start:t.start.offset,end:D}),t.end.offset>0&&h.push({op:"deleteText",paragraphId:j,start:0,end:t.end.offset});for(let w of p.slice(1,-1))h.push({op:"deleteBlock",blockId:w});h.push({op:"joinParagraphs",firstId:f,secondId:j});for(let w of p.slice(1)){let P=o.slotById.get(w);P&&o.order.splice(C(o,P),1);}}r.length>0&&h.push({op:"insertText",paragraphId:f,offset:t.start.offset,text:r});let R={...t.start,paragraphId:f},H=()=>({kind:"span",span:X({start:R,end:{...R,offset:R.offset+r.length}})});return {ok:true,kind:"command",ops:h,story:o.reads.story,answer:H}},pe=(o,t)=>{let r=o.reads;if(typeof t!="string")return l("unsupported-content","replaceSpan needs text","text");if(Pt.test(t))return l("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let d=r.blocks,p=d.filter(P=>P.removable),f=d.filter(P=>!P.removable).flatMap(P=>P.paragraphIds),h=f.length===0?p.find(P=>P.kind==="paragraph"):void 0;if(!h&&f.length===0)return l("invalid-offset","that story holds no paragraph this host can write into","no-top-level-paragraph");let x=y(o);if(x)return x;for(let P of r.paragraphIds){let Q=T(o,P);if(Q)return Q}let R=[],H=(h?[h.id]:[...f]).sort((P,Q)=>r.indexOf(P)-r.indexOf(Q)),j=H[0];for(let P of H){let Q=(r.paragraphText(P)??"").length;Q>0&&R.push({op:"deleteText",paragraphId:P,start:0,end:Q});}for(let P of p)P.id!==h?.id&&R.push({op:"deleteBlock",blockId:P.id});t.length>0&&R.push({op:"insertText",paragraphId:j,offset:0,text:t});for(let P of p)if(P.id!==h?.id)for(let Q of P.paragraphIds){let wt=o.slotById.get(Q);wt&&o.order.splice(C(o,wt),1);}let D={story:r.story,paragraphId:j,index:r.indexOf(j),offset:0},w=()=>({kind:"span",span:X({start:D,end:{...D,offset:t.length}})});return {ok:true,kind:"command",ops:R,story:r.story,answer:w}},N$1=(o,t)=>{if(!Array.isArray(t)||t.length<1||t.length>1e4||t.some(d=>typeof d!="string"||Pt.test(d)||!N(d)))return l("unsupported-content","replaceStoryBlocks needs 1-10000 valid XML text strings without paragraph marks","paragraphs");let r=y(o);if(r)return r;for(let d of o.reads.paragraphIds){let p=T(o,d);if(p)return p}o.order.splice(0,o.order.length);for(let d=0;d<t.length;d+=1)J(o,d);return {ok:true,kind:"command",ops:[{op:"replaceStoryBlocks",storyRootId:o.reads.root.id,paragraphs:t}],story:o.reads.story,answer:()=>E}},z=(o,t,r,d)=>{let p=o.reads;if(typeof d!="string")return l("unsupported-content","insertParagraph needs text","text");if(Pt.test(d))return l("unsupported-content","a paragraph mark inside a paragraph\u2019s text is not written by this host","paragraph-mark-in-text");let f=y(o);if(f)return f;let h=T(o,t.paragraphId);if(h)return h;let x=o.slotById.get(t.paragraphId);if(!x)return l("invalid-handle","that paragraph is not in the body");let R=(p.paragraphText(t.paragraphId)??"").length,H=[];r==="after"?(d.length>0&&H.push({op:"insertText",paragraphId:t.paragraphId,offset:R,text:d}),H.push({op:"splitParagraph",paragraphId:t.paragraphId,offset:R})):(d.length>0&&H.push({op:"insertText",paragraphId:t.paragraphId,offset:0,text:d}),H.push({op:"splitParagraph",paragraphId:t.paragraphId,offset:d.length}));let j=J(o,C(o,x)+1);r==="before"&&o.retargets.push({from:t.paragraphId,slot:j});let D=()=>{let w=r==="after"?j.id:t.paragraphId;return w===null?E:{kind:"handle",handle:e.paragraph(w,p.story)}};return {ok:true,kind:"command",ops:H,story:p.story,answer:D}},st=(o,t,r,d,p)=>{let f=o.reads;if(!Array.isArray(r)||r.length===0)return l("unsupported-content","split needs at least one delimiter","delimiters");if(r.length>Zo)return l("unsupported-content","too many delimiters",String(r.length));for(let $ of r){if(typeof $!="string"||$.length===0)return l("unsupported-content","a delimiter must be a non-empty string","delimiters");if($.length>qo)return l("unsupported-content","that delimiter is too long","delimiters")}let h=y(o);if(h)return h;let x=T(o,t.paragraphId);if(x)return x;let R=o.slotById.get(t.paragraphId);if(!R)return l("invalid-handle","that paragraph is not in the body");let H=f.paragraphText(t.paragraphId)??"",j=sr(H,r),D=[],w=[],P=[];if(j.length===0)P.push(H);else if(d){for(let U of [...j].reverse())D.push({op:"deleteText",paragraphId:t.paragraphId,start:U.start,end:U.start+U.length});let $=0,ut=0;for(let U of j){let Ut=U.start-$;w.push(Ut),P.push(H.slice(ut,U.start)),ut=U.start+U.length,$+=U.length;}P.push(H.slice(ut));}else {let $=0;for(let ut of j){let U=ut.start+ut.length;w.push(U),P.push(H.slice($,U)),$=U;}P.push(H.slice($));}w.length>0&&D.push({op:"splitParagraphMany",paragraphId:t.paragraphId,offsets:w});let Q=[R];for(let $=0;$<w.length;$+=1)Q.push(J(o,C(o,R)+1+$));let wt=$=>{let ut=$.story(f.story),U=[];return Q.forEach((Ut,ro)=>{let Xt=Ut.id;if(Xt===null)return;let Yt=ut?.paragraphText(Xt)??P[ro]??"",[ao,so]=p?lr(Yt,0,Yt.length):[0,Yt.length],ge=e.paragraph(Xt,f.story);U.push({start:{paragraph:ge,offset:ao},end:{paragraph:ge,offset:so}});}),{kind:"spans",spans:U}};return {ok:true,kind:"command",ops:D,story:f.story,answer:wt}},xt=(o,t)=>{let r=y(o);if(r)return r;let d=T(o,t.paragraphId);if(d)return d;let p=o.slotById.get(t.paragraphId);return p&&o.order.splice(C(o,p),1),{ok:true,kind:"command",ops:[{op:"deleteBlock",blockId:t.paragraphId}],story:o.reads.story,answer:()=>E}},pt=(o,t,r)=>{let d=o.reads,p=d.part,f=y(o);if(f)return f;let h=cn(r??{});if(!h.ok)return l("unsupported-content","that is not formatting this host writes",h.detail);let x=[];for(let R of oe(t,d)){if(R.end<=R.start&&!R.whole)continue;let H=_(o,R.paragraphId,"runs");if(H)return H;for(let j of qg(p,R.paragraphId,R.start,R.end,h.value))x.push({op:"setRunProperties",paragraphId:R.paragraphId,start:j.start,end:j.end,properties:j.properties,...j.targetRunIds?{targetRunIds:j.targetRunIds}:{}});R.whole&&x.push({op:"setParagraphMarkProperties",paragraphId:R.paragraphId,properties:pg(p,R.paragraphId,h.value)});}return x.length===0?l("invalid-offset","that range covers no characters to format","collapsed-range"):{ok:true,kind:"command",ops:x,story:d.story,answer:()=>E}},Jn=(o,t,r)=>{let d=o.reads,p=d.part,f=y(o);if(f)return f;let h=Ft(r,d.styles());if(!h.ok)return l("unsupported-content","that is not a style this document has",h.detail);let x={localName:"pStyle",attributes:{val:h.styleId}},R=[];for(let H of tt(t,d)){let j=_(o,H,"paragraph");if(j)return j;R.push({op:"setParagraphProperties",paragraphId:H,properties:kg(ig(p,H),x)});}return R.length===0?l("invalid-offset","that story holds no paragraph to style","empty-story"):{ok:true,kind:"command",ops:R,story:d.story,answer:()=>E}},Qn=(o,t,r)=>{let d=o.reads,p=d.part,f=y(o);if(f)return f;let h=pn(p,t.paragraphId,r??{},d.styles());if(!h.ok)return l("unsupported-content","that is not paragraph formatting this host writes",h.detail);let x=_(o,t.paragraphId,"paragraph");return x||{ok:true,kind:"command",ops:[{op:"setParagraphProperties",paragraphId:t.paragraphId,properties:h.value}],story:d.story,answer:()=>E}},Zn=(o,t)=>{let r=a.body;if(!r)return l("document-unavailable","this host holds no document right now");let d=a.sections();if(!d[o])return l("invalid-handle","that section is not in this document");let f=fn(t);if(!f.ok)return l("unsupported-content",f.reason,f.detail);let h=ir(r,d,o);if(h===null)return l("unsupported-content","that section holds no paragraph to address it by","no-anchor");let x=u(r),R=y(x);return R||{ok:true,kind:"command",ops:[{op:"setSectionProperties",...f.value,anchorParagraphId:h}],story:ct,answer:()=>E}},qn=(o,t)=>({ok:true,kind:"command",ops:[{op:"deleteNote",noteKind:o,noteId:t}],story:ct,lifecycle:true,answer:()=>E}),Vt=o=>{let t=e.resolve(o,"list");if(!t||t.kind!=="list")return l("invalid-handle","that handle does not name a list","list");let r=a.story(t.story);if(!r)return l("invalid-handle","that story is not in this document");let d=zt(r).find(p=>p.numId===t.numId);return d?{ok:true,plan:u(r),list:d}:l("invalid-handle","this story numbers nothing with that list",t.numId)},$t=o=>{if(typeof o!="object"||o===null)return l("invalid-handle","that is not a scope a control lives in","scope");let t=o;if("body"in o){let r=K(t.body,"body",e,a);return r.ok?{reads:r.value,node:r.value.root}:l(r.code,"that handle does not name a body",r.detail)}if("contentControl"in o){let r=ot(t.contentControl);return "control"in r?{reads:r.reads,node:r.node}:r}return l("invalid-handle","that is not a scope a control lives in","scope")},ot=o=>{let t=e.resolve(o,"contentControl");if(!t||t.kind!=="contentControl")return l("invalid-handle","that handle does not name a content control","contentControl");let r=a.story(t.story);if(!r)return l("invalid-handle","that story is not in this document");let d=Bn(r,t.nodeId),p=_n(r,t.nodeId);return !d||!p?l("invalid-handle","this document no longer holds that content control"):{reads:r,control:d,node:p}},to=(o,t,r)=>{if(!Number.isInteger(r)||r<0||r>At)return l("invalid-offset",`a list level is 0 to ${String(At)}`,String(r));if(!Ct(o.reads,t))return l("unsupported-content","that paragraph is not in a list",t);let d=y(o);if(d)return d;let p=_(o,t,"paragraph");return p||{ok:true,kind:"command",ops:[{op:"setListLevel",paragraphId:t,level:r}],story:o.reads.story,answer:()=>E}},eo=(o,t,r,d)=>{if(r!=="start"&&r!=="end")return l("unknown-operation","a list takes an item at its start or its end",String(r));let p=o.reads,f=r==="start"?t.paragraphIds[0]:t.paragraphIds[t.paragraphIds.length-1];if(f===void 0)return l("invalid-handle","that list holds no paragraph");let h={story:p.story,paragraphId:f,index:p.indexOf(f)};return z(o,h,r==="start"?"before":"after",d)},me=(o,t)=>{if(t.start.paragraphId!==t.end.paragraphId)return null;for(let r of In(o,t.start.paragraphId))if(r.start<=t.start.offset&&r.end>=t.end.offset)return r;return null},no=(o,t,r)=>{if(typeof r!="string")return l("unsupported-content","a hyperlink target is a string","target");let d=o.reads,p=me(d,t),f=t.start.paragraphId===t.end.paragraphId&&t.start.offset===t.end.offset;if(r.length===0){if(!p)return l("unsupported-content","that text is not a link","no-link");let w=y(o);if(w)return w;let P=M(o,p.paragraphId);return P||{ok:true,kind:"command",ops:[{op:"removeHyperlink",linkId:p.id}],story:d.story,answer:()=>E}}let h={},x=null;if(r.startsWith("#")){let w=r.slice(1);if(w.length===0||!ie(d,w))return l("unsupported-content","this document declares no such bookmark",r);h={anchor:w};}else {if(Xc(r)===null)return l("unsupported-content","this engine will not author that target","target");x=r;}let R=y(o);if(R)return R;let H=w=>x===null?{ok:true,kind:"command",ops:[w(h)],story:d.story,answer:()=>E}:{ok:true,kind:"command",ops:[],relate:{url:x,ops:P=>[w({relationshipId:P})]},story:d.story,answer:()=>E};if(p){let w=M(o,p.paragraphId);return w||H(P=>({op:"setHyperlinkTarget",linkId:p.id,...P}))}if(f)return l("unsupported-content","a link with no text has nothing to click","collapsed");if(t.start.paragraphId!==t.end.paragraphId)return l("unsupported-content","a link lives inside one paragraph","crosses-paragraph-mark");let j=M(o,t.start.paragraphId);if(j)return j;let D=d.styles().idOf("hyperlink");return H(w=>({op:"insertHyperlink",paragraphId:t.start.paragraphId,start:t.start.offset,end:t.end.offset,...w,...D===null?{}:{styleId:D}}))},fe=(o,t,r)=>{let d=o.reads;if(!s.selection||!n.select)return l("unsupported-capability","this host has no reader to move","selection");if(r!=="select"&&r!=="start"&&r!=="end")return l("unknown-operation","that is not a selection mode",String(r));let p=tt(t,d);for(let f of p)if(o.touched.has(f))return l("conflicting-operations","this batch edits a paragraph the selection covers",f);for(let f of p)o.selected.add(f);return c.push({range:t,mode:r}),{ok:true,kind:"command",ops:[],story:d.story,answer:()=>E}},ye=o=>{let t=e.resolve(o,"bookmark");if(!t||t.kind!=="bookmark")return l("invalid-handle","that handle does not name a bookmark","bookmark");let r=a.story(t.story);if(!r)return l("invalid-handle","that story is not in this document");let d=ie(r,t.name);if(!d)return l("invalid-handle","this document no longer declares that bookmark",t.name);let p=f=>({story:r.story,paragraphId:f.paragraphId,index:r.indexOf(f.paragraphId),offset:f.offset});return {reads:r,range:{start:p(d.start),end:p(d.end)}}},oo=o=>{switch(o.op){case "getDocument":return S({kind:"handle",handle:e.document()});case "getBody":return e.resolve(o.document,"document")?a.body?S({kind:"handle",handle:e.body(ct)}):l("document-unavailable","this host holds no document right now"):l("invalid-handle","that handle does not name a document","document");case "getParagraphs":{let t=K(o.body,"body",e,a);return t.ok?S({kind:"handles",handles:t.value.paragraphIds.map(r=>e.paragraph(r,t.value.story))}):l(t.code,"that handle does not name a body",t.detail)}case "getSpanParagraphs":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);let r=q(o.span,e,a);return r.ok?S({kind:"handles",handles:tt(t.value,r.value).map(d=>e.paragraph(d,r.value.story))}):l(r.code,"that span is not a place",r.detail)}case "getText":{if(!V(o.projection))return l("unsupported-content","unknown text projection","projection");if(e.resolve(o.target,"body")){let p=K(o.target,"body",e,a);return p.ok?S({kind:"text",text:p.value.text(o.projection??"allMarkup")}):l(p.code,"that handle does not name a body",p.detail)}let r=Z(o.target,e,a);if(!r.ok)return l(r.code,"that handle does not name a body or a paragraph",r.detail);let d=a.story(r.value.story);return S({kind:"text",text:d?.paragraphText(r.value.paragraphId,o.projection??"allMarkup")??""})}case "getSpanText":{if(!V(o.projection))return l("unsupported-content","unknown text projection","projection");let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);let r=q(o.span,e,a);return r.ok?S({kind:"text",text:xn(t.value,r.value,ne,o.projection??"allMarkup")}):l(r.code,"that span is not a place",r.detail)}case "getParagraphId":{let t=Z(o.paragraph,e,a);if(!t.ok)return l(t.code,"that handle does not name a paragraph",t.detail);let d=a.story(t.value.story)?.paragraph(t.value.paragraphId);return S({kind:"text",text:d?.paraId??""})}case "search":{let t=W(o.scope,e,a);if(!t.ok)return l(t.code,"that is not a scope to search",t.detail);let r=q(o.scope,e,a);return r.ok?nt(r.value,t.value,o.text,o.options):l(r.code,"that is not a scope to search",r.detail)}case "insertText":{let t=kt(o.at,e,a);if(!t.ok)return l(t.code,"that is not a place to insert at",t.detail);let r=a.story(t.value.story);return r?bt(u(r),t.value,o.text):l("invalid-handle","that story is not in this document")}case "replaceSpan":{if("body"in o.span){let d=K(o.span.body,"body",e,a);return d.ok?pe(u(d.value),o.text):l(d.code,"that handle does not name a body",d.detail)}let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);if(!t.value)return l("invalid-offset","that story holds no paragraph to write into","empty-story");let r=L(t.value);return r?Ot(u(r),t.value,o.text):l("invalid-handle","that story is not in this document")}case "replaceStoryBlocks":{let t=K(o.body,"body",e,a);return t.ok?N$1(u(t.value),o.paragraphs):l(t.code,"that handle does not name a body",t.detail)}case "insertParagraph":{let t=Wt(o.anchor,e,a);if(!t.ok)return l(t.code,"that is not a paragraph to insert beside",t.detail);if(o.where!=="before"&&o.where!=="after")return l("unknown-operation","that is not a place to insert",String(o.where));let r=a.story(t.value.story);return r?z(u(r),t.value,o.where,o.text):l("invalid-handle","that story is not in this document")}case "splitParagraph":{let t=Z(o.paragraph,e,a);if(!t.ok)return l(t.code,"that handle does not name a paragraph",t.detail);let r=a.story(t.value.story);return r?st(u(r),t.value,o.delimiters,o.trimDelimiters===true,o.trimSpacing===true):l("invalid-handle","that story is not in this document")}case "getFont":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);let r=q(o.span,e,a);return r.ok?S({kind:"font",font:ln(r.value.part,oe(t.value,r.value))}):l(r.code,"that span is not a place",r.detail)}case "setFont":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);if(!t.value)return l("invalid-offset","that story holds no paragraph to format","empty-story");let r=L(t.value);return r?pt(u(r),t.value,o.font):l("invalid-handle","that story is not in this document")}case "getStyle":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);let r=q(o.span,e,a);if(!r.ok)return l(r.code,"that span is not a place",r.detail);let d=r.value.part,p=r.value.styles(),f=tt(t.value,r.value).map(x=>_t(d,x,p)),h=f.length>0&&f.every(x=>x!==null&&x===f[0])?f[0]:null;return S({kind:"style",name:h})}case "setStyle":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);if(!t.value)return l("invalid-offset","that story holds no paragraph to style","empty-story");let r=L(t.value);return r?Jn(u(r),t.value,o.name):l("invalid-handle","that story is not in this document")}case "getParagraphFormat":{let t=Wt(o.paragraph,e,a);if(!t.ok)return l(t.code,"that is not a paragraph",t.detail);let r=a.story(t.value.story);if(!r)return l("document-unavailable","this host holds no document right now");let d=un(r.part,t.value.paragraphId,r.styles());return d?S({kind:"paragraphFormat",format:d}):l("invalid-handle","that handle does not name a paragraph")}case "setParagraphFormat":{let t=Wt(o.paragraph,e,a);if(!t.ok)return l(t.code,"that is not a paragraph",t.detail);let r=a.story(t.value.story);return r?Qn(u(r),t.value,o.format):l("invalid-handle","that story is not in this document")}case "deleteParagraph":{let t=Z(o.paragraph,e,a);if(!t.ok)return l(t.code,"that handle does not name a paragraph",t.detail);let r=a.story(t.value.story);return r?xt(u(r),t.value):l("invalid-handle","that story is not in this document")}case "getSections":return e.resolve(o.document,"document")?S({kind:"handles",handles:a.sections().map(t=>e.section(t.index))}):l("invalid-handle","that handle does not name a document","document");case "getPageSetup":{let t=e.resolve(o.section,"section");if(!t||t.kind!=="section")return l("invalid-handle","that handle does not name a section","section");let r=a.sections()[t.index];return r?S({kind:"pageSetup",setup:r.pageSetup}):l("invalid-handle","that section is not in this document")}case "setPageSetup":{let t=e.resolve(o.section,"section");return !t||t.kind!=="section"?l("invalid-handle","that handle does not name a section","section"):Zn(t.index,o.setup)}case "getFurniture":{let t=e.resolve(o.section,"section");if(!t||t.kind!=="section")return l("invalid-handle","that handle does not name a section","section");if(o.kind!=="header"&&o.kind!=="footer")return l("unknown-operation","that is not furniture",String(o.kind));let r={kind:o.kind,sectionIndex:t.index,variant:o.variant};return rn(r)?a.story(r)?S({kind:"handle",handle:e.body(r)}):l("invalid-handle","this document declares no such header or footer",B(r)):l("unknown-operation","that is not a furniture variant",String(o.variant))}case "getNotes":{if(!e.resolve(o.document,"document"))return l("invalid-handle","that handle does not name a document","document");if(o.noteKind!=="footnote"&&o.noteKind!=="endnote")return l("unknown-operation","that is not a kind of note",String(o.noteKind));let t=o.noteKind,r=a.noteIds(t);return r.ok?S({kind:"handles",handles:r.ids.map(d=>e.note(t,d))}):l("ambiguous-document",`${t} identities are not completely and unambiguously enumerable`,r.reason==="duplicates"?r.duplicateIds.join(","):r.reason)}case "getNoteBody":case "getNoteText":{let t=e.resolve(o.note,"note");if(!t||t.kind!=="note")return l("invalid-handle","that handle does not name a note","note");let r=t,d=a.story(r);return d?o.op==="getNoteText"?S({kind:"text",text:d.text(o.projection)}):S({kind:"handle",handle:e.body(r)}):l("invalid-handle","that note is not in this document",B(r))}case "getNoteKind":{let t=e.resolve(o.note,"note");return !t||t.kind!=="note"?l("invalid-handle","that handle does not name a note","note"):S({kind:"text",text:t.noteKind})}case "deleteNote":{let t=e.resolve(o.note,"note");if(!t||t.kind!=="note")return l("invalid-handle","that handle does not name a note","note");let r=a.noteIds(t.noteKind);return r.ok?r.ids.includes(t.noteId)?qn(t.noteKind,t.noteId):l("invalid-handle","that note is not in this document"):l("ambiguous-document",`${t.noteKind} identities are not completely and unambiguously enumerable`,r.reason==="duplicates"?r.duplicateIds.join(","):r.reason)}case "getLists":{let t=K(o.body,"body",e,a);return t.ok?S({kind:"handles",handles:zt(t.value).map(r=>e.list(r.numId,t.value.story))}):l(t.code,"that handle does not name a body",t.detail)}case "getListId":{let t=Vt(o.list);return "list"in t?S({kind:"number",value:Number(t.list.numId)}):t}case "getListById":{let t=K(o.body,"body",e,a);if(!t.ok)return l(t.code,"that handle does not name a body",t.detail);if(!Number.isInteger(o.id)||o.id<=0)return l("unsupported-content","a list is numbered from one",String(o.id));let r=String(o.id),d=zt(t.value).find(p=>p.numId===r);return d?S({kind:"handle",handle:e.list(d.numId,t.value.story)}):l("invalid-handle","no list in that story carries that number",r)}case "getListParagraphs":{let t=Vt(o.list);if(!("list"in t))return t;let r=o.level;if(r!==void 0&&(!Number.isInteger(r)||r<0||r>At))return l("invalid-offset",`a list level is 0 to ${String(At)}`,String(r));let d=t.plan.reads,p=r===void 0?t.list.paragraphIds:t.list.paragraphIds.filter(f=>Ct(d,f)?.level===r);return S({kind:"handles",handles:p.map(f=>e.paragraph(f,d.story))})}case "getParagraphList":{let t=Z(o.paragraph,e,a);if(!t.ok)return l(t.code,"that handle does not name a paragraph",t.detail);let r=a.story(t.value.story);if(!r)return l("invalid-handle","that story is not in this document");let d=Ct(r,t.value.paragraphId);return d?S({kind:"handle",handle:e.list(d.numId,r.story)}):l("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "getListLevel":{let t=Z(o.paragraph,e,a);if(!t.ok)return l(t.code,"that handle does not name a paragraph",t.detail);let r=a.story(t.value.story);if(!r)return l("invalid-handle","that story is not in this document");let d=Ct(r,t.value.paragraphId);return d?S({kind:"number",value:d.level}):l("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "setListLevel":{let t=Z(o.paragraph,e,a);if(!t.ok)return l(t.code,"that handle does not name a paragraph",t.detail);let r=a.story(t.value.story);return r?to(u(r),t.value.paragraphId,o.level):l("invalid-handle","that story is not in this document")}case "insertListParagraph":{let t=Vt(o.list);return "list"in t?eo(t.plan,t.list,o.where,o.text):t}case "getHyperlink":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);let r=q(o.span,e,a);if(!r.ok)return l(r.code,"that span is not a place",r.detail);let d=a.package;if(!d||!t.value)return S({kind:"text",text:""});let p=me(r.value,t.value);if(!p)return S({kind:"text",text:""});let f=va(r.value.part,p.id),h=f?Rn(d,r.value.part.name,f):null;return S({kind:"text",text:h??""})}case "setHyperlink":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);if(!t.value)return l("invalid-offset","that story holds no text to link","empty-story");let r=L(t.value);return r?no(u(r),t.value,o.target):l("invalid-handle","that story is not in this document")}case "getBookmarks":{let t=W(o.scope,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);let r=q(o.scope,e,a);if(!r.ok)return l(r.code,"that span is not a place",r.detail);let d=r.value,p=t.value,f=p===null?null:new Set(tt(p,d)),h=se(d).filter(x=>{if(!f||!f.has(x.start.paragraphId)&&!f.has(x.end.paragraphId)||p===null)return false;let R=x.start.paragraphId===p.end.paragraphId&&x.start.offset>p.end.offset,H=x.end.paragraphId===p.start.paragraphId&&x.end.offset<p.start.offset;return !R&&!H});return S({kind:"handles",handles:h.map(x=>e.bookmark(x.name,d.story))})}case "getBookmarkName":{let t=e.resolve(o.bookmark,"bookmark");return !t||t.kind!=="bookmark"?l("invalid-handle","that handle does not name a bookmark","bookmark"):S({kind:"text",text:t.name})}case "getBookmarkRange":{let t=ye(o.bookmark);return "reads"in t?S({kind:"span",span:X(t.range)}):t}case "getComments":{let t=W(o.scope,e,a);if(!t.ok)return l(t.code,"that scope is not a place",t.detail);let r=q(o.scope,e,a);if(!r.ok)return l(r.code,"that scope names no story",r.detail);let d=r.value,p=k(d);if(!p)return l("document-unavailable","this host holds no document");let f=t.value,h=p.roots.filter(x=>{if(!f)return true;let R=x.range;if(!R)return false;let H=d.indexOf(R.start.paragraphId),j=d.indexOf(R.end.paragraphId),D=d.indexOf(f.start.paragraphId),w=d.indexOf(f.end.paragraphId);return j<D||H>w?false:j===D&&H===D&&w===D?R.end.offset>f.start.offset&&R.start.offset<f.end.offset:true});return S({kind:"handles",handles:h.map(x=>e.comment(x.id,d.story))})}case "getCommentReplies":{let t=I(o.comment);return t.ok?S({kind:"handles",handles:t.item.replyIds.map(r=>e.comment(r,t.reads.story))}):t.planned}case "getCommentId":{let t=I(o.comment);return t.ok?S({kind:"text",text:t.item.id}):t.planned}case "getCommentAuthor":{let t=I(o.comment);return t.ok?S({kind:"text",text:t.item.comment.author}):t.planned}case "getCommentDate":{let t=I(o.comment);return t.ok?S({kind:"text",text:t.item.comment.date??""}):t.planned}case "getCommentText":{let t=I(o.comment);if(!t.ok)return t.planned;let r=k(t.reads);return S({kind:"text",text:r?.textOf(t.item.id)??""})}case "getCommentRange":{let t=I(o.comment);if(!t.ok)return t.planned;let r=t.item.range;if(!r||t.item.orphaned)return l("invalid-handle","that comment has no range in this document");let d=b(t.reads,r);return d?S({kind:"span",span:d}):l("invalid-handle","that comment\u2019s range is no longer in the story")}case "getCommentResolved":{let t=I(o.comment);return t.ok?S({kind:"flag",value:t.item.resolved}):t.planned}case "insertComment":return Ln(o,e,a,v);case "setCommentResolved":{let t=I(o.comment);if(!t.ok)return t.planned;if(typeof o.resolved!="boolean")return l("unsupported-content","resolved is a yes or a no",String(o.resolved));let r=y(u(t.reads));return r||{ok:true,kind:"commentWrite",write:{kind:"resolve",commentId:t.item.id,resolved:o.resolved},story:t.reads.story,answer:()=>E}}case "replyToComment":{let t=I(o.comment);if(!t.ok)return t.planned;let r=ue({author:o.author,text:o.text,date:o.date,kind:"reply"});if(r)return r;let d=t.item.range;if(!d||t.item.orphaned)return l("invalid-handle","that comment has no range to reply over");let p=y(u(t.reads));if(p)return p;let f=t.reads.story,h=ce(o.date);return {ok:true,kind:"commentWrite",write:{kind:"reply",parentCommentId:t.item.id,anchor:{paragraphId:d.start.paragraphId,start:d.start.offset,end:d.end.offset,...d.end.paragraphId===d.start.paragraphId?{}:{endParagraphId:d.end.paragraphId}},text:o.text,author:o.author,...h===void 0?{}:{date:h}},story:t.reads.story,answer:(x,R)=>R===void 0?E:{kind:"handle",handle:e.comment(R,f)}}}case "deleteComment":{let t=I(o.comment);return t.ok?Mn(t.item,t.reads,r=>y(u(r))):t.planned}case "getRevisions":{let t=K(o.body,"body",e,a);if(!t.ok)return l(t.code,"that handle does not name a body",t.detail);let r=t.value;return S({kind:"handles",handles:de(r).map(d=>e.revision(d.id,r.story))})}case "getRevisionType":{let t=A(o.revision);return t.ok?S({kind:"text",text:t.item.type}):t.planned}case "getRevisionAuthor":{let t=A(o.revision);return t.ok?S({kind:"text",text:t.item.author}):t.planned}case "getRevisionDate":{let t=A(o.revision);return t.ok?S({kind:"text",text:t.item.date}):t.planned}case "getRevisionRange":{let t=A(o.revision);if(!t.ok)return t.planned;let[r]=t.item.item.ranges;if(!r)return l("invalid-handle","that change covers no characters");let d=b(t.reads,r);return d?S({kind:"span",span:d}):l("invalid-handle","that change\u2019s range is no longer in the story")}case "acceptRevision":case "rejectRevision":{let t=A(o.revision);if(!t.ok)return t.planned;let r=u(t.reads),d=y(r);if(d)return d;let p=o.op==="acceptRevision";return {ok:true,kind:"command",story:t.reads.story,ops:t.item.item.addresses.map(f=>p?{op:"acceptRevision",revision:f}:{op:"rejectRevision",revision:f}),answer:()=>E}}case "acceptAllRevisions":case "rejectAllRevisions":{let t=Tn(o,e,a);if(!t.ok)return l(t.code,t.message,t.detail);let r=u(t.reads),d=y(r);if(d)return d;let p=Nn(o,t.reads);return {ok:true,kind:"command",story:t.reads.story,ops:p,answer:()=>E}}case "selectSpan":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);if(!t.value)return l("invalid-offset","that story holds no paragraph to select","empty-story");let r=L(t.value);return r?fe(u(r),t.value,o.mode):l("invalid-handle","that story is not in this document")}case "selectBookmark":{let t=ye(o.bookmark);return "reads"in t?fe(u(t.reads),t.range,o.mode):t}case "getContentControls":{let t=$t(o.scope);return "reads"in t?S({kind:"handles",handles:En(t.reads,t.node).map(r=>e.contentControl(r.nodeId,t.reads.story))}):t}case "getContentControlById":{let t=$t(o.scope);if(!("reads"in t))return t;if(!Number.isInteger(o.id))return l("unsupported-content","a control id is a whole number",String(o.id));let r=Yn(t.node).find(d=>te$1(d).id===o.id);return r?S({kind:"handle",handle:e.contentControl(r.id,t.reads.story)}):l("invalid-handle","no control in that scope carries that id",String(o.id))}case "getContentControlsByTag":case "getContentControlsByTitle":{let t=$t(o.scope);if(!("reads"in t))return t;let r=o.op==="getContentControlsByTag"?o.tag:o.title;if(typeof r!="string"||r.length===0)return l("unsupported-content","a tag or title to match is required",o.op);let d=Yn(t.node).filter(p=>{let f=te$1(p);return o.op==="getContentControlsByTag"?f.tag===r:f.alias===r});return S({kind:"handles",handles:d.map(p=>e.contentControl(p.id,t.reads.story))})}case "getContentControlTag":case "getContentControlTitle":case "getContentControlFileId":case "getContentControlSubtype":case "getContentControlLock":{let t=ot(o.contentControl);if(!("control"in t))return t;let r=t.control.properties;if(o.op==="getContentControlLock")return S({kind:"text",text:t.control.lock});if(o.op==="getContentControlSubtype")return S({kind:"text",text:r.type});if(o.op==="getContentControlFileId")return S({kind:"text",text:r.id===void 0?"":String(r.id)});let d=o.op==="getContentControlTag"?r.tag:r.alias;return S({kind:"text",text:d??""})}case "getContentControlIsBound":case "getContentControlPlaceholderShown":case "getContentControlTemporary":{let t=ot(o.contentControl);if(!("control"in t))return t;let r=o.op==="getContentControlIsBound"?t.control.properties.dataBinding!==void 0:o.op==="getContentControlPlaceholderShown"?t.control.properties.showingPlaceholder:t.control.properties.temporary;return S({kind:"flag",value:r})}case "getContentControlText":{let t=ot(o.contentControl);return "control"in t?S({kind:"text",text:Fn(t.reads,t.node,o.projection)}):t}case "getContentControlParagraphs":{let t=ot(o.contentControl);return "control"in t?S({kind:"handles",handles:t.control.paragraphIds.map(r=>e.paragraph(r,t.reads.story))}):t}case "getContentControlRange":{let t=ot(o.contentControl);if(!("control"in t))return t;let r=o.location??"whole";if(!nr.has(r))return l("unsupported-content","that is not a place in a control",r);let d=Kt(t.reads,t.node);if(!d)return l("unsupported-content","that control holds nothing addressable","empty");let p=r==="start"||r==="before"?d.start:d.end,f=r!=="whole"&&r!=="content",h=x=>({story:t.reads.story,paragraphId:x.paragraphId,index:t.reads.indexOf(x.paragraphId),offset:x.offset});return S({kind:"span",span:re(f?{start:h(p),end:h(p)}:{start:h(d.start),end:h(d.end)},e)})}case "setContentControlValue":{let t=ot(o.contentControl);if(!("control"in t))return t;let r=ar(o.value);if(!r.ok)return l(r.code,r.message,r.detail);let d=u(t.reads),p=y(d);return p||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:r.value}],answer:()=>E}}case "setContentControlProperties":{let t=ot(o.contentControl);if(!("control"in t))return t;if(o.tag===void 0&&o.title===void 0&&o.lock===void 0)return l("unsupported-content","nothing to write","no-properties");if(o.lock!==void 0&&!er.has(o.lock))return l("unsupported-content","that is not a lock this schema declares",o.lock);let r=u(t.reads),d=y(r);return d||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlProperties",controlId:t.control.nodeId,...o.tag===void 0?{}:{tag:o.tag},...o.title===void 0?{}:{alias:o.title},...o.lock===void 0?{}:{lock:o.lock}}],answer:()=>E}}case "insertContentControlText":{let t=ot(o.contentControl);if(!("control"in t))return t;if(typeof o.text!="string")return l("unsupported-content","text is required","text");if(o.at!=="replace"&&o.at!=="start"&&o.at!=="end")return l("unsupported-content","that is not a place to insert at",String(o.at));let r=u(t.reads),d=y(r);if(d)return d;let p=Kt(t.reads,t.node);if(!p)return l("unsupported-content","that control holds nothing addressable","empty");let f=o.at==="end"?p.end:p.start,h=()=>({kind:"span",span:X({start:{story:t.reads.story,paragraphId:f.paragraphId,index:t.reads.indexOf(f.paragraphId),offset:f.offset},end:{story:t.reads.story,paragraphId:f.paragraphId,index:t.reads.indexOf(f.paragraphId),offset:f.offset+o.text.length}})});return o.at==="replace"?{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:{kind:"text",text:o.text}}],answer:h}:{ok:true,kind:"command",story:t.reads.story,ops:o.text.length===0?[]:[{op:"insertText",paragraphId:f.paragraphId,offset:f.offset,text:o.text,inside:t.node.id}],answer:h}}case "deleteContentControl":{let t=ot(o.contentControl);if(!("control"in t))return t;if(typeof o.keepContent!="boolean")return l("unsupported-content","keepContent is required","keepContent");let r=u(t.reads),d=y(r);return d||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"removeContentControl",controlId:t.control.nodeId,keepContent:o.keepContent}],answer:()=>E}}case "insertContentControl":{let t=W(o.span,e,a);if(!t.ok)return l(t.code,"that span is not a place",t.detail);if(!t.value)return l("invalid-offset","that story holds nothing to wrap","empty-story");let r=L(t.value);if(!r)return l("invalid-handle","that story is not in this document");let d=t.value;if(d.start.paragraphId!==d.end.paragraphId)return l("unsupported-content","wrapping several paragraphs in one control is not supported here","multi-paragraph");if(!or.has(o.subtype))return l("unsupported-content","that control type cannot be inserted",o.subtype);let p=u(r),f=y(p);return f||{ok:true,kind:"command",story:r.story,ops:[{op:"insertContentControl",paragraphId:d.start.paragraphId,start:d.start.offset,end:d.end.offset,type:o.subtype,...o.tag===void 0?{}:{tag:o.tag},...o.title===void 0?{}:{alias:o.title}}],answer:()=>E}}case "insertCustomNode":{let t=Vn(o);if(t)return l("unsupported-content",t.message,t.detail);let r=Kn(o.payload);if(!r.ok)return l("unsupported-content","that payload cannot be written",r.field);let d=Un(o,e,a);if("code"in d)return l(d.code,d.message,d.detail);let{start:p,end:f}=d.range,h=L(d.range);if(!h)return l("invalid-handle","that story is not in this document");let x=y(u(h));return x||{ok:true,kind:"customNodeWrite",story:h.story,write:$n(o,p,f,r.value),answer:()=>E}}default:return l("unknown-operation","this host does not implement that operation",String(o.op))}};return {plan(o){let t=g.conflict(o);if(t)return l("conflicting-operations",t.message,t.detail);let r=oo(o);return r.ok&&g.note(o),r},get hasCommands(){return g.hasCommands},get writeScope(){return m?.reads.scope??null},settle(o){let t=m;if(t){let r=o.story(t.reads.story);if(!r)return {ok:false,detail:`the story this batch wrote is gone: ${B(t.reads.story)}`};let d=new Set(t.reads.paragraphIds),p=r.paragraphIds.filter(h=>!d.has(h));if(p.length!==t.created.length)return {ok:false,detail:`planned ${String(t.created.length)} new paragraphs, the transaction made ${String(p.length)}`};t.order.filter(h=>h.id===null).forEach((h,x)=>{h.id=p[x]??null;});for(let h of t.retargets)h.slot.id&&e.retarget(h.from,h.slot.id);}for(let r of c){let d=o.story(r.range.start.story);!d||!dr(r.range,d)||n.select?.(r.range,r.mode);}return {ok:true}}}}var ur=Object.freeze({status:"skipped"});function G(n,e,s){return Object.freeze(s===void 0?{code:n,message:e}:{code:n,message:e,detail:s})}function cr(n){let e=n==="unsupported-revision"||n.startsWith("unsupported-revision:");return G(e?"unsupported-revision":"transaction-refused",e?"that story contains a tracked change this engine cannot resolve":"the document store refused the transaction",n)}function et(n,e,s,a){return {ok:false,results:n.map((i,u)=>u===e?{status:"error",error:s}:ur),revision:a,changed:false}}function ts(n){let{port:e}=n,s=Object.freeze({...n.capabilities}),a=an(),i=new Set,u=false,c=null,g=s.events?e.subscribe(()=>{if(u)return;let v=Object.freeze({revision:e.revision()});for(let k of [...i])k(v);}):()=>{},m=v=>{if(c&&c.pkg===v)return c.value;let k=vn(v);return c={pkg:v,value:k},k};return {capabilities:s,revision:()=>e.revision(),execute:v=>{let k=Array.isArray(v?.operations)?v.operations:[],I=e.revision();if(u)return et(k,0,G("disposed","this host was disposed"),I);if(!s.document)return et(k,0,G("unsupported-capability","this host has no document","document"),I);let A=e.currentPackage();if(!A)return et(k,0,G("document-unavailable","this host holds no document right now"),I);if(v.expectedRevision!==void 0&&v.expectedRevision!==I)return et(k,0,G("stale-revision","the document moved since that revision",`expected ${String(v.expectedRevision)}, at ${I}`),I);let b=Gn({handles:a,reads:m(A),capabilities:s,...e.select?{select:e.select.bind(e)}:{}}),C=[],O=[],T=null,M=[],_=null,J,X=null,L=-1;for(let N=0;N<k.length;N+=1){let z=b.plan(k[N]);if(!z.ok)return et(k,N,z.error,I);if(C.push(z),z.kind==="command")if(L<0&&(L=N),z.lifecycle)T=z.ops[0]??null;else if(z.relate){let st=z.relate;O.push(xt=>{let pt=xt(st.url);return pt===null?null:st.ops(pt)});}else {let{ops:st}=z;O.push(()=>st);}else z.kind==="commentWrite"?(L<0&&(L=N),M.push(z.write),_=b.writeScope??{kind:"body"}):z.kind==="customNodeWrite"&&(L<0&&(L=N),X={write:z.write,scope:b.writeScope??{kind:"body"}});}let V=false;if(M.length>0){let N=e.applyCommentWrites(M,_??{kind:"body"});if(!N.ok)return et(k,L<0?0:L,G("transaction-refused","the document store refused the comment write",N.reason),I);V=N.changed,J=N.commentId;}if(X){let N=e.applyCustomNodeWrite(X.write,X.scope);if(!N.ok)return et(k,L<0?0:L,G("transaction-refused","the document store refused the custom-node write",N.reason),I);V=N.changed;}if(T){let N=e.applyLifecycle(T);if(!N.ok)return et(k,L<0?0:L,G("transaction-refused","the document store refused the transaction",N.reason),I);V=N.changed;}if(O.length>0){let N=e.apply(z=>{let st=[];for(let xt of O){let pt=xt(z);if(pt===null)return null;st.push(...pt);}return st},b.writeScope??{kind:"body"});if(!N.ok)return et(k,L<0?0:L,cr(N.reason),I);V=N.changed;}let nt=e.currentPackage();if(!nt)return et(k,0,G("document-unavailable","this host holds no document right now"),I);let bt=m(nt),Ot=b.settle(bt);return Ot.ok?{ok:true,results:C.map(N=>({status:"ok",value:N.kind==="query"?N.value:N.kind==="customNodeWrite"?N.answer(bt):N.answer(bt,J)})),revision:e.revision(),changed:V}:et(k,L<0?0:L,G("transaction-refused","the transaction did not produce the document the batch planned",Ot.detail),e.revision())},save(){if(u)return {ok:false,error:G("disposed","this host was disposed")};if(!s.save)return {ok:false,error:G("unsupported-capability","this host cannot save","save")};let v=e.save();return v?{ok:true,bytes:v}:{ok:false,error:G("document-unavailable","this host holds no document right now")}},subscribe(v){return u||!s.events?()=>{}:(i.add(v),()=>{i.delete(v);})},dispose(){u||(u=true,i.clear(),g(),e.dispose(),c=null);}}}export{Bt as a,mr as b,io as c,lo as d,Zt as e,qt as f,ts as g};
|