@eigenpal/docx-editor-core 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.mts +4 -4
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/chunk-2KPOGFFR.js +1 -0
- package/dist/{chunk-NPFFCPZ6.js → chunk-2KUOYHXX.js} +1 -1
- package/dist/{chunk-WXSGCEBZ.js → chunk-2ZTKTE7P.js} +1 -1
- package/dist/{chunk-C45EFOVP.js → chunk-34DJT72K.js} +1 -1
- package/dist/chunk-3HLRRK6N.mjs +2 -0
- package/dist/{chunk-COV4LHQ7.js → chunk-4272FQ2E.js} +1 -1
- package/dist/chunk-4DCTKHS5.js +1 -0
- package/dist/chunk-4QJEMD23.mjs +4 -0
- package/dist/chunk-4QSFBX26.mjs +1 -0
- package/dist/chunk-4SZAFWLV.mjs +1 -0
- package/dist/{chunk-WYFK4QOF.mjs → chunk-5JULVEYK.mjs} +1 -1
- package/dist/chunk-6AGU57TL.mjs +1 -0
- package/dist/{chunk-T4O4PFJD.mjs → chunk-6ENZQGYR.mjs} +1 -1
- package/dist/chunk-6KYOT4E7.js +4 -0
- package/dist/chunk-77X765ZO.js +1 -0
- package/dist/chunk-7UMOUKSF.js +1 -0
- package/dist/chunk-AXVWVIIN.js +1 -0
- package/dist/chunk-B6FA4MJ5.mjs +1 -0
- package/dist/chunk-BBJMUBTD.mjs +1 -0
- package/dist/chunk-BJSG6TEG.js +1 -0
- package/dist/chunk-BKP5QMTS.js +1 -0
- package/dist/{chunk-3HENAL6V.mjs → chunk-C57BOE7B.mjs} +1 -1
- package/dist/{chunk-3SJQRYO7.js → chunk-CDGV7CLS.js} +1 -1
- package/dist/{chunk-TV6JLFY5.js → chunk-CWPIXUU2.js} +1 -1
- package/dist/chunk-DX5XU6JN.js +1 -0
- package/dist/chunk-E7UN3PVC.mjs +1 -0
- package/dist/chunk-EJ2JAYRI.js +1 -0
- package/dist/{chunk-TDYWEVAE.js → chunk-F44XU6G5.js} +1 -1
- package/dist/{chunk-TE2AF7FM.js → chunk-FETIBXTH.js} +1 -1
- package/dist/chunk-GLPOVLZD.mjs +1 -0
- package/dist/{chunk-M7KTKPGO.mjs → chunk-HEJJXAXN.mjs} +1 -1
- package/dist/{chunk-5WINQXA3.js → chunk-ILPNMG7Q.js} +1 -1
- package/dist/chunk-IM56AITE.mjs +1 -0
- package/dist/chunk-KK673XRZ.mjs +1 -0
- package/dist/chunk-KNY7SXPJ.mjs +1 -0
- package/dist/{chunk-M3UL6EUU.mjs → chunk-KSW6W2EK.mjs} +2 -2
- package/dist/chunk-LVUL7O27.js +1 -0
- package/dist/{chunk-O2643IUW.js → chunk-LW5OFHSW.js} +2 -2
- package/dist/chunk-M65C4SQJ.mjs +2 -0
- package/dist/chunk-MWOHCSZE.js +1 -0
- package/dist/chunk-NO6PIL32.mjs +1 -0
- package/dist/chunk-NTYJIOUE.js +2 -0
- package/dist/{chunk-WWVIVYX6.mjs → chunk-NY36MZ55.mjs} +1 -1
- package/dist/chunk-PJEB3ZWG.mjs +3 -0
- package/dist/chunk-Q2VALXEU.js +3 -0
- package/dist/{chunk-6KM4VW4L.js → chunk-RGHRXIIZ.js} +3 -3
- package/dist/chunk-RRJKF2XI.mjs +1 -0
- package/dist/{chunk-GB7RICH6.js → chunk-T3UP6LF5.js} +1 -1
- package/dist/chunk-UC7JW66O.mjs +1 -0
- package/dist/{chunk-P7HWOJC5.js → chunk-V3NE7Q22.js} +1 -1
- package/dist/chunk-WCB25ESG.mjs +1 -0
- package/dist/{chunk-SKBHY5MK.mjs → chunk-WEQA5PPW.mjs} +1 -1
- package/dist/{chunk-CBKJOPOW.mjs → chunk-WQJWT4RB.mjs} +1 -1
- package/dist/chunk-WWG6PUWU.js +1 -0
- package/dist/{chunk-PYDX4MOT.mjs → chunk-XTPT4TNP.mjs} +1 -1
- package/dist/{chunk-QUM4DFRE.mjs → chunk-YMXWLXVF.mjs} +1 -1
- package/dist/{content-eG_Rtl0l.d.ts → content-BebvPfXc.d.ts} +1 -1
- package/dist/{content-BlWiORm-.d.mts → content-CbBCrsr0.d.mts} +1 -1
- package/dist/{contentControlValues-CO7pUqOf.d.ts → contentControlValues-Com1GnZS.d.ts} +1 -1
- package/dist/{contentControlValues-DfYN9BZ8.d.mts → contentControlValues-DVJyudKU.d.mts} +1 -1
- package/dist/core-plugins.d.mts +2 -2
- package/dist/core-plugins.d.ts +2 -2
- package/dist/core-plugins.js +1 -1
- package/dist/core-plugins.mjs +1 -1
- package/dist/core.d.mts +7 -7
- package/dist/core.d.ts +7 -7
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/docx/index.d.mts +2 -2
- package/dist/docx/index.d.ts +2 -2
- package/dist/docx/index.js +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/parser.d.mts +2 -2
- package/dist/docx/parser.d.ts +2 -2
- package/dist/docx/parser.js +1 -1
- package/dist/docx/parser.mjs +1 -1
- package/dist/docx/rezip.d.mts +2 -2
- package/dist/docx/rezip.d.ts +2 -2
- package/dist/docx/serializer/index.d.mts +3 -3
- package/dist/docx/serializer/index.d.ts +3 -3
- package/dist/editor/index.d.mts +2 -2
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/index.mjs +1 -1
- package/dist/executor-FHL5D4CB.js +1 -0
- package/dist/executor-FL6XGVP3.mjs +1 -0
- package/dist/{fontLoader-3MFD_Hj2.d.mts → fontLoader-B4uFKpAy.d.mts} +1 -1
- package/dist/{fontLoader-C6VvBUVB.d.ts → fontLoader-D9SBYuZZ.d.ts} +1 -1
- package/dist/{headerFooterLayout-bdHWlU6g.d.ts → headerFooterLayout-CtVsfqxQ.d.ts} +1 -1
- package/dist/{headerFooterLayout-DJb-dV7X.d.mts → headerFooterLayout-D2LZLkDC.d.mts} +1 -1
- package/dist/headless.d.mts +5 -5
- package/dist/headless.d.ts +5 -5
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/layout-bridge/clickToPositionDom.js +1 -1
- package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +67 -5
- package/dist/layout-bridge/index.d.ts +67 -5
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +2 -2
- package/dist/layout-bridge/measuring/index.d.ts +2 -2
- package/dist/layout-bridge/measuring/index.js +1 -1
- package/dist/layout-bridge/measuring/index.mjs +1 -1
- package/dist/layout-bridge/tableInsertHover.js +1 -1
- package/dist/layout-bridge/tableInsertHover.mjs +1 -1
- package/dist/layout-bridge/toFlowBlocks.d.mts +2 -2
- package/dist/layout-bridge/toFlowBlocks.d.ts +2 -2
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.d.mts +2 -2
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-engine/types.d.mts +2 -2
- package/dist/layout-engine/types.d.ts +2 -2
- package/dist/layout-painter/index.d.mts +3 -3
- package/dist/layout-painter/index.d.ts +3 -3
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +3 -3
- package/dist/layout-painter/renderPage.d.ts +3 -3
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/managers/AutoSaveManager.d.mts +2 -2
- package/dist/managers/AutoSaveManager.d.ts +2 -2
- package/dist/managers/TableSelectionManager.d.mts +2 -2
- package/dist/managers/TableSelectionManager.d.ts +2 -2
- package/dist/managers/types.d.mts +2 -2
- package/dist/managers/types.d.ts +2 -2
- package/dist/mcp-cli.mjs +23 -23
- package/dist/mcp.d.mts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +7 -7
- package/dist/mcp.mjs +1 -1
- package/dist/{nodes-BJef4KFW.d.ts → nodes-Bd6tTkp0.d.ts} +1 -1
- package/dist/{nodes-RfTS-NSv.d.mts → nodes-BvO8GGD4.d.mts} +1 -1
- package/dist/prosemirror/applyFormatting.d.mts +34 -4
- package/dist/prosemirror/applyFormatting.d.ts +34 -4
- package/dist/prosemirror/applyFormatting.js +1 -1
- package/dist/prosemirror/applyFormatting.mjs +1 -1
- package/dist/prosemirror/commands/formatting.js +1 -1
- package/dist/prosemirror/commands/formatting.mjs +1 -1
- package/dist/prosemirror/commands/index.d.mts +2 -1
- package/dist/prosemirror/commands/index.d.ts +2 -1
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/index.mjs +1 -1
- package/dist/prosemirror/commands/paragraph.js +1 -1
- package/dist/prosemirror/commands/paragraph.mjs +1 -1
- package/dist/prosemirror/commands/sectionBreak.d.mts +25 -0
- package/dist/prosemirror/commands/sectionBreak.d.ts +25 -0
- package/dist/prosemirror/commands/sectionBreak.js +1 -0
- package/dist/prosemirror/commands/sectionBreak.mjs +1 -0
- package/dist/prosemirror/commentIdAllocator.d.mts +2 -2
- package/dist/prosemirror/commentIdAllocator.d.ts +2 -2
- package/dist/prosemirror/commentOps.d.mts +2 -2
- package/dist/prosemirror/commentOps.d.ts +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
- package/dist/prosemirror/conversion/index.d.mts +2 -2
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/extensions/index.js +1 -1
- package/dist/prosemirror/extensions/index.mjs +1 -1
- package/dist/prosemirror/index.d.mts +4 -4
- package/dist/prosemirror/index.d.ts +4 -4
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/index.mjs +1 -1
- package/dist/prosemirror/plugins/index.d.mts +2 -2
- package/dist/prosemirror/plugins/index.d.ts +2 -2
- package/dist/prosemirror/plugins/index.js +1 -1
- package/dist/prosemirror/plugins/index.mjs +1 -1
- package/dist/prosemirror/queries.d.mts +2 -2
- package/dist/prosemirror/queries.d.ts +2 -2
- package/dist/prosemirror/schema/index.d.mts +3 -3
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/index.js +1 -1
- package/dist/prosemirror/schema/index.mjs +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +2 -2
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +2 -2
- package/dist/{sectionPropertiesSerializer-S8J1V9mb.d.ts → sectionPropertiesSerializer-CzgskSoA.d.ts} +1 -1
- package/dist/{sectionPropertiesSerializer-C8XCmzE4.d.mts → sectionPropertiesSerializer-D3yI82iZ.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/content.js +1 -1
- package/dist/types/content.mjs +1 -1
- package/dist/types/document.d.mts +3 -3
- package/dist/types/document.d.ts +3 -3
- package/dist/types/document.js +1 -1
- package/dist/types/document.mjs +1 -1
- package/dist/utils/cardStyles.js +1 -1
- package/dist/utils/cardStyles.mjs +1 -1
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/comments.d.ts +2 -2
- package/dist/utils/index.d.mts +37 -4
- package/dist/utils/index.d.ts +37 -4
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/utils/stylePreview.d.mts +83 -0
- package/dist/utils/stylePreview.d.ts +83 -0
- package/dist/utils/stylePreview.js +1 -0
- package/dist/utils/stylePreview.mjs +1 -0
- package/dist/utils/units.d.mts +7 -1
- package/dist/utils/units.d.ts +7 -1
- package/dist/utils/units.js +1 -1
- package/dist/utils/units.mjs +1 -1
- package/dist/{variableDetector-CN9_pUR_.d.mts → variableDetector-D2-xDa2O.d.mts} +1 -1
- package/dist/{variableDetector-o4Rb2Csy.d.ts → variableDetector-d-PpDlNV.d.ts} +1 -1
- package/dist/{watermark-DAcnAs_J.d.mts → watermark-D90356ZM.d.mts} +7 -1
- package/dist/{watermark-DAcnAs_J.d.ts → watermark-D90356ZM.d.ts} +7 -1
- package/package.json +17 -1
- package/dist/chunk-4Q2IP5FW.js +0 -1
- package/dist/chunk-4RQAAKQI.mjs +0 -1
- package/dist/chunk-5HA66FH4.mjs +0 -1
- package/dist/chunk-7OW3VCZE.mjs +0 -1
- package/dist/chunk-AA6D2C6R.js +0 -4
- package/dist/chunk-AMJNIGO2.mjs +0 -2
- package/dist/chunk-BHBOAP6Z.js +0 -3
- package/dist/chunk-BTSL4AYY.js +0 -1
- package/dist/chunk-CUY2THAO.mjs +0 -1
- package/dist/chunk-DKKTY56Q.js +0 -1
- package/dist/chunk-DZ3FN3JI.js +0 -2
- package/dist/chunk-ENIWJBS7.mjs +0 -2
- package/dist/chunk-EZNVVB63.mjs +0 -1
- package/dist/chunk-GKAXYZCE.mjs +0 -1
- package/dist/chunk-IGYHDSM7.mjs +0 -1
- package/dist/chunk-L6ZRNW7Y.mjs +0 -1
- package/dist/chunk-LJ2TB6CY.js +0 -1
- package/dist/chunk-MOKKS75W.mjs +0 -3
- package/dist/chunk-ND33YQGU.js +0 -1
- package/dist/chunk-QXSDGNJ4.js +0 -1
- package/dist/chunk-RT52EYG3.mjs +0 -4
- package/dist/chunk-SHYNWAW6.mjs +0 -1
- package/dist/chunk-SNTAAXXA.mjs +0 -1
- package/dist/chunk-TAQTZAVZ.js +0 -1
- package/dist/chunk-UKMKGIME.js +0 -1
- package/dist/chunk-UXPY65AC.js +0 -1
- package/dist/chunk-VOCHZNOF.mjs +0 -1
- package/dist/chunk-VW22RZ6C.mjs +0 -1
- package/dist/chunk-WQRWRWSK.js +0 -1
- package/dist/chunk-YHXVNJK5.mjs +0 -1
- package/dist/chunk-ZETEPB7I.js +0 -1
- package/dist/executor-DZAMMQ35.js +0 -1
- package/dist/executor-ZCJRLT3Z.mjs +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paragraph-style preview + option resolution — shared between the React and
|
|
3
|
+
* Vue toolbars so the style-picker dropdown looks and behaves identically.
|
|
4
|
+
*
|
|
5
|
+
* Pure logic only: no i18n and no framework CSS types. The returned preview is
|
|
6
|
+
* a plain `{ fontSize, lineHeight, fontWeight?, fontStyle?, color? }` object,
|
|
7
|
+
* which is structurally assignable to both React's `CSSProperties` and Vue's
|
|
8
|
+
* inline-style record, so neither adapter needs a cast. Name localization stays
|
|
9
|
+
* in the adapters (they own the i18n `t()` boundary).
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
import { a as Style } from '../styles-gEujs7j6.js';
|
|
14
|
+
import '../formatting-JhqWT_XM.js';
|
|
15
|
+
import '../colors-C3vA7HUU.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Paragraph-style preview + option resolution — shared between the React and
|
|
19
|
+
* Vue toolbars so the style-picker dropdown looks and behaves identically.
|
|
20
|
+
*
|
|
21
|
+
* Pure logic only: no i18n and no framework CSS types. The returned preview is
|
|
22
|
+
* a plain `{ fontSize, lineHeight, fontWeight?, fontStyle?, color? }` object,
|
|
23
|
+
* which is structurally assignable to both React's `CSSProperties` and Vue's
|
|
24
|
+
* inline-style record, so neither adapter needs a cast. Name localization stays
|
|
25
|
+
* in the adapters (they own the i18n `t()` boundary).
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Inline preview style for a paragraph-style dropdown item.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
interface StylePreviewProps {
|
|
35
|
+
fontSize: string;
|
|
36
|
+
lineHeight: string;
|
|
37
|
+
fontWeight?: 'bold';
|
|
38
|
+
fontStyle?: 'italic';
|
|
39
|
+
color?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A resolved paragraph-style option (document order, with extracted visual
|
|
43
|
+
* fields). Adapters add their own localized label on top of `name`.
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
interface ResolvedStyleOption {
|
|
47
|
+
styleId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
priority: number;
|
|
50
|
+
fontSize?: number;
|
|
51
|
+
bold?: boolean;
|
|
52
|
+
italic?: boolean;
|
|
53
|
+
color?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Dropdown preview sizes (px) for well-known styles, matching Google Docs. @public */
|
|
56
|
+
declare const STYLE_PREVIEW_SIZES: Record<string, number>;
|
|
57
|
+
/** Styles rendered bold in the dropdown preview by default. @public */
|
|
58
|
+
declare const STYLE_DEFAULT_BOLD: ReadonlySet<string>;
|
|
59
|
+
/** Default preview text color (hex, no `#`) for styles that don't set one. @public */
|
|
60
|
+
declare const STYLE_DEFAULT_COLOR: Record<string, string>;
|
|
61
|
+
/** Google-Docs heading preview color. @public */
|
|
62
|
+
declare const HEADING_COLOR = "#4a6c8c";
|
|
63
|
+
/**
|
|
64
|
+
* Build the inline preview style for a style option. `fontSize` is in
|
|
65
|
+
* half-points (OOXML); known styles use {@link STYLE_PREVIEW_SIZES} instead.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
declare function getStylePreviewProps(input: {
|
|
69
|
+
styleId: string;
|
|
70
|
+
fontSize?: number;
|
|
71
|
+
bold?: boolean;
|
|
72
|
+
italic?: boolean;
|
|
73
|
+
color?: string;
|
|
74
|
+
}): StylePreviewProps;
|
|
75
|
+
/**
|
|
76
|
+
* Filter the document's styles to the visible paragraph styles, extract their
|
|
77
|
+
* visual fields, and sort by UI priority — the list a toolbar style picker
|
|
78
|
+
* shows. Returns `[]` when there are no styles (adapters fall back to presets).
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
declare function resolveParagraphStyleOptions(styles: Style[] | undefined): ResolvedStyleOption[];
|
|
82
|
+
|
|
83
|
+
export { HEADING_COLOR, type ResolvedStyleOption, STYLE_DEFAULT_BOLD, STYLE_DEFAULT_COLOR, STYLE_PREVIEW_SIZES, type StylePreviewProps, getStylePreviewProps, resolveParagraphStyleOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';require('../chunk-DC7S76ZX.js');var n={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},l=new Set(["Title","Heading1","Heading2","Heading3"]),a={Subtitle:"666666"},d="#4a6c8c";function c(t){let e=n[t.styleId],o={fontSize:e?`${e}px`:`${Math.min(Math.max(t.fontSize?t.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(t.bold??l.has(t.styleId))&&(o.fontWeight="bold"),t.italic&&(o.fontStyle="italic");let i=t.color??a[t.styleId];return i?o.color=`#${i}`:t.styleId.startsWith("Heading")&&(o.color=d),o}function s(t){return !t||t.length===0?[]:t.filter(e=>e.type==="paragraph").filter(e=>e.qFormat?true:!(e.hidden||e.semiHidden)).map(e=>({styleId:e.styleId,name:e.name||e.styleId,priority:e.uiPriority??99,fontSize:e.rPr?.fontSize,bold:e.rPr?.bold,italic:e.rPr?.italic,color:e.rPr?.color?.rgb})).sort((e,r)=>e.priority-r.priority)}exports.HEADING_COLOR=d;exports.STYLE_DEFAULT_BOLD=l;exports.STYLE_DEFAULT_COLOR=a;exports.STYLE_PREVIEW_SIZES=n;exports.getStylePreviewProps=c;exports.resolveParagraphStyleOptions=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../chunk-QYUPLKLP.mjs';var n={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},l=new Set(["Title","Heading1","Heading2","Heading3"]),a={Subtitle:"666666"},d="#4a6c8c";function c(t){let e=n[t.styleId],o={fontSize:e?`${e}px`:`${Math.min(Math.max(t.fontSize?t.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(t.bold??l.has(t.styleId))&&(o.fontWeight="bold"),t.italic&&(o.fontStyle="italic");let i=t.color??a[t.styleId];return i?o.color=`#${i}`:t.styleId.startsWith("Heading")&&(o.color=d),o}function s(t){return !t||t.length===0?[]:t.filter(e=>e.type==="paragraph").filter(e=>e.qFormat?true:!(e.hidden||e.semiHidden)).map(e=>({styleId:e.styleId,name:e.name||e.styleId,priority:e.uiPriority??99,fontSize:e.rPr?.fontSize,bold:e.rPr?.bold,italic:e.rPr?.italic,color:e.rPr?.color?.rgb})).sort((e,r)=>e.priority-r.priority)}export{d as HEADING_COLOR,l as STYLE_DEFAULT_BOLD,a as STYLE_DEFAULT_COLOR,n as STYLE_PREVIEW_SIZES,c as getStylePreviewProps,s as resolveParagraphStyleOptions};
|
package/dist/utils/units.d.mts
CHANGED
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
declare const TWIPS_PER_INCH = 1440;
|
|
17
17
|
/** Pixels per inch at standard DPI */
|
|
18
18
|
declare const PIXELS_PER_INCH = 96;
|
|
19
|
+
/**
|
|
20
|
+
* Automatic paragraph spacing applied for `w:beforeAutospacing` /
|
|
21
|
+
* `w:afterAutospacing` (HTML-origin "auto" spacing). Word renders these as
|
|
22
|
+
* ~14px before/after regardless of any explicit `w:before`/`w:after` value.
|
|
23
|
+
*/
|
|
24
|
+
declare const AUTO_PARAGRAPH_SPACING_PX = 14;
|
|
19
25
|
/**
|
|
20
26
|
* Convert twips to pixels (at 96 DPI)
|
|
21
27
|
*
|
|
@@ -88,4 +94,4 @@ declare function clamp(value: number, min: number, max: number): number;
|
|
|
88
94
|
*/
|
|
89
95
|
declare function formatPx(px: number): string;
|
|
90
96
|
|
|
91
|
-
export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
97
|
+
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
package/dist/utils/units.d.ts
CHANGED
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
declare const TWIPS_PER_INCH = 1440;
|
|
17
17
|
/** Pixels per inch at standard DPI */
|
|
18
18
|
declare const PIXELS_PER_INCH = 96;
|
|
19
|
+
/**
|
|
20
|
+
* Automatic paragraph spacing applied for `w:beforeAutospacing` /
|
|
21
|
+
* `w:afterAutospacing` (HTML-origin "auto" spacing). Word renders these as
|
|
22
|
+
* ~14px before/after regardless of any explicit `w:before`/`w:after` value.
|
|
23
|
+
*/
|
|
24
|
+
declare const AUTO_PARAGRAPH_SPACING_PX = 14;
|
|
19
25
|
/**
|
|
20
26
|
* Convert twips to pixels (at 96 DPI)
|
|
21
27
|
*
|
|
@@ -88,4 +94,4 @@ declare function clamp(value: number, min: number, max: number): number;
|
|
|
88
94
|
*/
|
|
89
95
|
declare function formatPx(px: number): string;
|
|
90
96
|
|
|
91
|
-
export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
97
|
+
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
package/dist/utils/units.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkBJSG6TEG_js=require('../chunk-BJSG6TEG.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"AUTO_PARAGRAPH_SPACING_PX",{enumerable:true,get:function(){return chunkBJSG6TEG_js.c}});Object.defineProperty(exports,"PIXELS_PER_INCH",{enumerable:true,get:function(){return chunkBJSG6TEG_js.b}});Object.defineProperty(exports,"TWIPS_PER_INCH",{enumerable:true,get:function(){return chunkBJSG6TEG_js.a}});Object.defineProperty(exports,"clamp",{enumerable:true,get:function(){return chunkBJSG6TEG_js.p}});Object.defineProperty(exports,"eighthsToPixels",{enumerable:true,get:function(){return chunkBJSG6TEG_js.n}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkBJSG6TEG_js.f}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkBJSG6TEG_js.h}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkBJSG6TEG_js.q}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkBJSG6TEG_js.k}});Object.defineProperty(exports,"halfPointsToPoints",{enumerable:true,get:function(){return chunkBJSG6TEG_js.l}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkBJSG6TEG_js.g}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkBJSG6TEG_js.e}});Object.defineProperty(exports,"pointsToHalfPoints",{enumerable:true,get:function(){return chunkBJSG6TEG_js.m}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkBJSG6TEG_js.j}});Object.defineProperty(exports,"roundPixels",{enumerable:true,get:function(){return chunkBJSG6TEG_js.o}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkBJSG6TEG_js.i}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkBJSG6TEG_js.d}});
|
package/dist/utils/units.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as PIXELS_PER_INCH,a as TWIPS_PER_INCH,
|
|
1
|
+
export{c as AUTO_PARAGRAPH_SPACING_PX,b as PIXELS_PER_INCH,a as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,f as emuToPixels,h as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,g as pixelsToEmu,e as pixelsToTwips,m as pointsToHalfPoints,j as pointsToPixels,o as roundPixels,i as twipsToEmu,d as twipsToPixels}from'../chunk-KNY7SXPJ.mjs';import'../chunk-QYUPLKLP.mjs';
|
|
@@ -61,6 +61,12 @@ interface PictureWatermark {
|
|
|
61
61
|
* A document watermark — text or picture.
|
|
62
62
|
*/
|
|
63
63
|
type Watermark = TextWatermark | PictureWatermark;
|
|
64
|
+
/**
|
|
65
|
+
* Default text-watermark presets shown in the watermark dialog, mirroring the
|
|
66
|
+
* canned phrases MS Word offers. Adapters expose a `watermarkPresets` prop to
|
|
67
|
+
* override this list; both React and Vue fall back to these when unset.
|
|
68
|
+
*/
|
|
69
|
+
declare const DEFAULT_WATERMARK_PRESETS: readonly string[];
|
|
64
70
|
/**
|
|
65
71
|
* Compute the display dimensions (in EMUs) for a picture watermark from the
|
|
66
72
|
* source image's natural pixel size. Bounds the larger side to a page-sized
|
|
@@ -74,4 +80,4 @@ declare function pictureWatermarkDisplayEmu(naturalWidthPx: number, naturalHeigh
|
|
|
74
80
|
heightEmu: number;
|
|
75
81
|
} | undefined;
|
|
76
82
|
|
|
77
|
-
export { type PictureWatermark as P, type TextWatermark as T, type Watermark as W, pictureWatermarkDisplayEmu as p };
|
|
83
|
+
export { DEFAULT_WATERMARK_PRESETS as D, type PictureWatermark as P, type TextWatermark as T, type Watermark as W, pictureWatermarkDisplayEmu as p };
|
|
@@ -61,6 +61,12 @@ interface PictureWatermark {
|
|
|
61
61
|
* A document watermark — text or picture.
|
|
62
62
|
*/
|
|
63
63
|
type Watermark = TextWatermark | PictureWatermark;
|
|
64
|
+
/**
|
|
65
|
+
* Default text-watermark presets shown in the watermark dialog, mirroring the
|
|
66
|
+
* canned phrases MS Word offers. Adapters expose a `watermarkPresets` prop to
|
|
67
|
+
* override this list; both React and Vue fall back to these when unset.
|
|
68
|
+
*/
|
|
69
|
+
declare const DEFAULT_WATERMARK_PRESETS: readonly string[];
|
|
64
70
|
/**
|
|
65
71
|
* Compute the display dimensions (in EMUs) for a picture watermark from the
|
|
66
72
|
* source image's natural pixel size. Bounds the larger side to a page-sized
|
|
@@ -74,4 +80,4 @@ declare function pictureWatermarkDisplayEmu(naturalWidthPx: number, naturalHeigh
|
|
|
74
80
|
heightEmu: number;
|
|
75
81
|
} | undefined;
|
|
76
82
|
|
|
77
|
-
export { type PictureWatermark as P, type TextWatermark as T, type Watermark as W, pictureWatermarkDisplayEmu as p };
|
|
83
|
+
export { DEFAULT_WATERMARK_PRESETS as D, type PictureWatermark as P, type TextWatermark as T, type Watermark as W, pictureWatermarkDisplayEmu as p };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eigenpal/docx-editor-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Framework-agnostic core for DOCX parsing, editing, and rendering",
|
|
6
6
|
"main": "./dist/core.js",
|
|
@@ -173,6 +173,11 @@
|
|
|
173
173
|
"import": "./dist/utils/comments.mjs",
|
|
174
174
|
"require": "./dist/utils/comments.js"
|
|
175
175
|
},
|
|
176
|
+
"./utils/stylePreview": {
|
|
177
|
+
"types": "./dist/utils/stylePreview.d.ts",
|
|
178
|
+
"import": "./dist/utils/stylePreview.mjs",
|
|
179
|
+
"require": "./dist/utils/stylePreview.js"
|
|
180
|
+
},
|
|
176
181
|
"./utils/findReplace": {
|
|
177
182
|
"types": "./dist/utils/findReplace.d.ts",
|
|
178
183
|
"import": "./dist/utils/findReplace.mjs",
|
|
@@ -293,6 +298,11 @@
|
|
|
293
298
|
"import": "./dist/prosemirror/commands/pageBreak.mjs",
|
|
294
299
|
"require": "./dist/prosemirror/commands/pageBreak.js"
|
|
295
300
|
},
|
|
301
|
+
"./prosemirror/commands/sectionBreak": {
|
|
302
|
+
"types": "./dist/prosemirror/commands/sectionBreak.d.ts",
|
|
303
|
+
"import": "./dist/prosemirror/commands/sectionBreak.mjs",
|
|
304
|
+
"require": "./dist/prosemirror/commands/sectionBreak.js"
|
|
305
|
+
},
|
|
296
306
|
"./prosemirror/commands/paragraph": {
|
|
297
307
|
"types": "./dist/prosemirror/commands/paragraph.d.ts",
|
|
298
308
|
"import": "./dist/prosemirror/commands/paragraph.mjs",
|
|
@@ -462,6 +472,9 @@
|
|
|
462
472
|
"utils/comments": [
|
|
463
473
|
"./dist/utils/comments.d.ts"
|
|
464
474
|
],
|
|
475
|
+
"utils/stylePreview": [
|
|
476
|
+
"./dist/utils/stylePreview.d.ts"
|
|
477
|
+
],
|
|
465
478
|
"utils/findReplace": [
|
|
466
479
|
"./dist/utils/findReplace.d.ts"
|
|
467
480
|
],
|
|
@@ -534,6 +547,9 @@
|
|
|
534
547
|
"prosemirror/commands/pageBreak": [
|
|
535
548
|
"./dist/prosemirror/commands/pageBreak.d.ts"
|
|
536
549
|
],
|
|
550
|
+
"prosemirror/commands/sectionBreak": [
|
|
551
|
+
"./dist/prosemirror/commands/sectionBreak.d.ts"
|
|
552
|
+
],
|
|
537
553
|
"prosemirror/commands/paragraph": [
|
|
538
554
|
"./dist/prosemirror/commands/paragraph.d.ts"
|
|
539
555
|
],
|
package/dist/chunk-4Q2IP5FW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var u=1440;var o=96;function P(n){return n/1440*96}function _(n){return n/96*1440}function I(n){return n==null||isNaN(n)?0:Math.round(n*96/914400)}function E(n){return Math.round(n/96*914400)}function i(n){return Math.round(n/914400*1440)}function m(n){return Math.round(n/1440*914400)}function N(n){return n/72*96}function H(n){return n/144*96}function b(n){return n/2}function s(n){return n*2}function p(n){return n/576*96}function e(n,t=2){let r=Math.pow(10,t);return Math.round(n*r)/r}function x(n,t,r){return Math.min(Math.max(n,t),r)}function R(n){return `${e(n)}px`}exports.a=u;exports.b=o;exports.c=P;exports.d=_;exports.e=I;exports.f=E;exports.g=i;exports.h=m;exports.i=N;exports.j=H;exports.k=b;exports.l=s;exports.m=p;exports.n=e;exports.o=x;exports.p=R;
|
package/dist/chunk-4RQAAKQI.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-FCJWLEKT.mjs';import {c as c$2}from'./chunk-7E5VBRDL.mjs';import {a as a$2}from'./chunk-MOCGHQ4A.mjs';import {a,b,c as c$1}from'./chunk-QPFJJPIC.mjs';import {a as a$3}from'./chunk-AMENZY5F.mjs';import {c}from'./chunk-VW22RZ6C.mjs';function J(e,t,n,r){let i=e-t-n,o=(r.count-1)*r.gap;return (i-o)/r.count}function fe(e){let t={...e.pageSize},n={...e.margins},r=e.columns??{count:1,gap:0},i=false,o,s,a=[],l=[];function u(){return t.h-n.bottom}function c(){return u()-n.top}function g(){return t.w-n.left-n.right}if(c()<=0)throw new Error(`Paginator: page size and margins yield no content area (pageSize=${Math.round(t.w)}x${Math.round(t.h)} margins top=${Math.round(n.top)} bottom=${Math.round(n.bottom)} left=${Math.round(n.left)} right=${Math.round(n.right)})`);let d=J(t.w,n.left,n.right,r),S=n.top;function P(h){return n.left+h*(d+r.gap)}function M(){(o||s)&&(o&&(t=o),s&&(n=s),o=void 0,s=void 0,d=J(t.w,n.left,n.right,r));let h=a.length+1,F=n.top,v=u(),m=e.footnoteReservedHeights?.get(h)??0,p=v-m,x={number:h,fragments:[],margins:{...n},size:{...t},footnoteReservedHeight:m>0?m:void 0,columns:r.count>1?{...r}:void 0},b={page:x,cursorY:F,columnIndex:0,topMargin:F,contentBottom:p,trailingSpacing:0};return a.push(x),l.push(b),S=F,e.onNewPage&&e.onNewPage(b),b}function B(){return l.length===0?M():l[l.length-1]}function T(h){return h.contentBottom-h.cursorY}function I(h,F){let v=F||B();return T(v)>=h}function w(h){return h.columnIndex<r.count-1?(h.columnIndex+=1,h.cursorY=S,h.trailingSpacing=0,h):M()}function C(h){let F=B(),v=Number.isFinite(h)&&h>0?h:0;for(;!I(v,F);){let m=F.contentBottom-F.topMargin;if(v>m)return i||(i=true,console.warn(`Paginator: fragment height ${v.toFixed(0)}px exceeds page content height ${m.toFixed(0)}px; placing with overflow.`)),F.cursorY!==F.topMargin&&(F=w(F)),F;F=w(F);}return F}function R(h,F,v=0,m=0){let p=Math.max(v,B().trailingSpacing),x=p+F,b=C(x),y=p,z=P(b.columnIndex),k=b.cursorY+y;return h.x=z,h.y=k,b.page.fragments.push(h),b.cursorY=k+F,b.trailingSpacing=m,{state:b,x:z,y:k}}function f(){if(l.length>0){let h=l[l.length-1];if(h.page.fragments.length===0&&h.cursorY===h.topMargin)return h}return M()}function L(){let h=B();return w(h)}function H(h){r=h,d=J(t.w,n.left,n.right,r);let F=B();F.page.columns=r.count>1?{...r}:void 0,S=F.cursorY,F.columnIndex=0;}function W(h,F,v=true){if(!v){o=h?{...h}:o,s=F?{...F}:s;return}if(h&&(t={...h}),F&&(n={...F}),c()<=0)throw new Error("Paginator: section page size and margins yield no content area");d=J(t.w,n.left,n.right,r),o=void 0,s=void 0;}return {pages:a,states:l,get columnWidth(){return d},get columns(){return {...r}},getCurrentState:B,getAvailableHeight:()=>T(B()),getContentWidth:g,fits:h=>I(h),ensureFits:C,addFragment:R,forcePageBreak:f,forceColumnBreak:L,getColumnX:P,updateColumns:H,updatePageLayout:W}}function ge(e){let t=new Map,n=new Set;for(let r=0;r<e.length;r++){if(n.has(r))continue;let i=e[r];if(i.kind!=="paragraph"||!i.attrs?.keepNext)continue;let s=[r],a=r;for(let c=r+1;c<e.length;c++){let g=e[c];if(g.kind==="sectionBreak"||g.kind==="pageBreak"||g.kind==="columnBreak"||g.kind!=="paragraph")break;if(g.attrs?.keepNext)s.push(c),a=c,n.add(c);else break}let l=a+1,u=-1;if(l<e.length){let c=e[l];c.kind!=="sectionBreak"&&c.kind!=="pageBreak"&&c.kind!=="columnBreak"&&(u=l);}t.set(r,{startIndex:r,endIndex:a,memberIndices:s,anchorIndex:u});}return t}function me(e,t,n){let r=0;for(let i of e.memberIndices){let o=t[i],s=n[i];if(o.kind!=="paragraph"||s.kind!=="paragraph")continue;let a=o,l=s,u=a.attrs?.spacing?.before??0;r+=u,r+=l.totalHeight;let c=a.attrs?.spacing?.after??0;r+=c;}if(e.anchorIndex!==-1){let i=n[e.anchorIndex];if(i?.kind==="paragraph"){let o=i;o.lines.length>0&&(r+=o.lines[0].lineHeight);}}return r}function pe(e){let t=new Set;for(let n of e.values())for(let r=1;r<n.memberIndices.length;r++)t.add(n.memberIndices[r]);return t}function it(e){return e.kind!=="paragraph"?false:e.attrs?.keepLines===true}function de(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}function $(e){return e.displayMode==="float"||a(e.wrapType)||e.wrapType==="topAndBottom"}function ot(e){return $(e)&&e.wrapType==="topAndBottom"}function at(e){return $(e)&&!b(e.wrapType)&&e.wrapType!=="topAndBottom"}function qt(e,t,n){if(!(!e||e<=0)){if(t==="pct")return n*e/5e3;if(!t||t==="dxa"||t==="auto")return c(e)}}function Ce(e){let t=new Map,n=[];for(let r=0;r<e.rows.length;r++){let i=e.rows[r]?.cells??[],o=t.get(r)??new Set,s=0;for(;o.has(s);)s++;for(let a=0;a<i.length;a++){let l=i[a];if(!l)continue;let u=l.colSpan??1,c=l.rowSpan??1;if(n.push({rowIndex:r,cellIndex:a,columnIndex:s,colSpan:u,rowSpan:c}),c>1)for(let g=r+1;g<r+c;g++){t.has(g)||t.set(g,new Set);let d=t.get(g);for(let S=0;S<u;S++)d.add(s+S);}for(s+=u;o.has(s);)s++;}}return n}function Jt(e){return Math.max(1,...e.rows.map(t=>t.cells.reduce((n,r)=>n+Math.max(1,r.colSpan??1),0)))}function Qt(e,t,n){if(t<=0)return [];let r=n>0?n/t:0;if(e.length===0)return Array(t).fill(r);let i=e.slice(0,t),o=t-i.length;if(o>0){let c=i.filter(d=>d>0),g=c.length>0?c.reduce((d,S)=>d+S,0)/c.length:r;i=i.concat(Array(o).fill(g));}let s=i.reduce((c,g)=>c+(g>0?g:0),0),a=i.filter(c=>c<=0).length;if(s<=0)return Array(t).fill(r);if(a===0)return i;let l=Math.max(0,n-s),u=l>0?l/a:s/Math.max(1,t-a);return i.map(c=>c>0?c:u)}function Re(e,t,n){let r=[],i=[],o=n,s=0,a=t?.length??0;for(let l=0;l<a;l++){let u=t[l],c=e?.[l];if(c?.kind==="paragraph"&&u?.kind==="paragraph"){let g=c.attrs?.spacing;o+=Math.max(s,g?.before??0);let d=[];for(let S of u.lines)o+=S.floatSkipBefore??0,d.push(o),o+=S.lineHeight,i.push(o);r.push(d),s=g?.after??0;}else u&&"totalHeight"in u&&typeof u.totalHeight=="number"?(o+=s+u.totalHeight,r.push([]),i.push(o),s=0):r.push([]);}return {lineTops:r,flatBottoms:i,contentHeight:o-n+s}}function Le(e,t){let n=t.rows.length,r=[],i=0;for(let a=0;a<n;a++)r.push(i),i+=t.rows[a]?.height??0;r.push(i);let o=Ce(e),s=[];for(let a=0;a<n;a++){let l=t.rows[a]?.height??0,u=new Set;u.add(l);for(let c of o){if(c.rowIndex>a||c.rowIndex+c.rowSpan-1<a)continue;let g=e.rows[c.rowIndex]?.cells?.[c.cellIndex],d=t.rows[c.rowIndex]?.cells?.[c.cellIndex];if(!g||!d)continue;let S=g.padding?.top??0,{flatBottoms:P}=Re(g.blocks,d.blocks,S),M=r[a]-r[c.rowIndex];for(let B of P){let T=B-M;T>0&&T<l&&u.add(T);}}s.push([...u].sort((c,g)=>c-g));}return {rowTops:r,breakOffsets:s}}function ke(e,t,n,r){let i=e.breakOffsets[t];if(!i||i.length===0)return 0;let o=n+r,s=0;for(let a of i)if(!(a<=n))if(a<=o)s=a-n;else break;return s}var st=1440,he=96,ve=st/he,Ee=11,We="Calibri",lt=1,ut=.8,ct=.2,j=null;function be(){if(!j){let e=typeof document<"u"?document.createElement("canvas"):null;if(!e)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(j=e.getContext("2d"),!j)throw new Error("Failed to get 2D context from canvas")}return j}function sn(){j=null;}var Ie=new Map;function He(e){let t=Ie.get(e);if(t===void 0){let n=a$3(e);t={cssFallback:n.cssFallback,singleLineRatio:n.singleLineRatio},Ie.set(e,t);}return t}function ft(e){return He(e).cssFallback}function xe(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let n=e.fontSize??Ee,r=Y(n);t.push(`${r}px`);let i=e.fontFamily??We;return t.push(ft(i)),t.join(" ")}function V(e){let t=e.fontSize??Ee,n=e.fontFamily??We,r=Y(t),i=r*ut,o=r*ct,s=r*lt;try{let l=be();l.font=xe(e);let u=l.measureText("Hg");typeof u.actualBoundingBoxAscent=="number"&&typeof u.actualBoundingBoxDescent=="number"&&(i=u.actualBoundingBoxAscent,o=u.actualBoundingBoxDescent);}catch{}s=Math.max(s,i+o);let a=He(n).singleLineRatio;return {fontSize:t,ascent:i,descent:o,lineHeight:s,fontFamily:n,singleLineRatio:a}}function O(e,t){if(!e)return 0;let n=be();n.font=xe(t);let i=n.measureText(e).width;return t.letterSpacing&&e.length>1&&(i+=t.letterSpacing*(e.length-1)),i}function ln(e,t){let n=O(e,t),r=V(t);return {width:n,height:r.ascent+r.descent,ascent:r.ascent,descent:r.descent}}function Ae(e,t){let n=V(t);if(!e)return {width:0,charWidths:[],metrics:n};let r=be();r.font=xe(t);let i=t.letterSpacing??0,o=[],s=0;for(let a=0;a<e.length;a++){let l=e[a],c=r.measureText(l).width;i&&a<e.length-1&&(c+=i),o.push(c),s+=c;}return {width:s,charWidths:o,metrics:n}}function un(e,t){if(t.length===0||e<=0)return 0;let n=0;for(let r=0;r<t.length;r++){let i=t[r],o=n+i/2;if(e<=o)return r;n+=i;}return t.length}function cn(e,t){if(e<=0||t.length===0)return 0;let n=Math.min(e,t.length),r=0;for(let i=0;i<n;i++)r+=t[i];return r}function fn(e){return e/ve}function gn(e){return Math.round(e*ve)}function Y(e){return e*he/72}function gt(e){return e*72/he}function mn(e){return Y(e/2)}function pn(e){return gt(e)*2}function Se(e){return e/1440*96}function Me(e){return e/96*1440}function mt(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:r=0}=e,i=t.filter(g=>g.val!=="clear").filter(g=>g.pos>=r),o=t.filter(g=>g.val==="clear").map(g=>g.pos),s=i.reduce((g,d)=>Math.max(g,d.pos),0),a=[...i];r>0&&!i.some(g=>g.pos<=r)&&(o.some(d=>Math.abs(d-r)<20)||a.push({val:"start",pos:r,leader:"none"}));let u=s>0?Math.max(s,r):r,c=r+14400;for(;u<c;){u+=n;let g=i.some(P=>Math.abs(P.pos-u)<20),d=o.some(P=>Math.abs(P-u)<20),S=r>0&&Math.abs(u-r)<20;!g&&!d&&!S&&a.push({val:"start",pos:u,leader:"none"});}return a.sort((g,d)=>g.pos-d.pos)}function Oe(e,t,n={}){let{defaultTabInterval:r=720}=t,i=Me(e),s=mt(t).find(u=>u.pos>i);if(!s){let u=Se(r),c=u-e%u;return c<=0&&(c=u),{width:c,alignment:"default"}}let l=Se(s.pos)-e;if(s.val==="center")l-=(n.followingWidth??0)/2;else if(s.val==="end")l-=n.followingWidth??0;else if(s.val==="decimal")l-=n.decimalPrefixWidth??0;else if(s.val==="bar")return {width:0,leader:s.leader,alignment:"bar"};if(l<1){let u=Se(r),c=u-e%u;return c<=0&&(c=u),{width:c,alignment:"default"}}return {width:l,leader:s.leader,alignment:s.val}}var pt="Calibri",dt=11;function ht(e){let t=e.attrs,n=e.runs?.find(o=>o.kind==="text"),r=t?.listMarkerFontFamily??n?.fontFamily??t?.defaultFontFamily??pt,i=t?.listMarkerFontSize??n?.fontSize??t?.defaultFontSize??dt;return {fontFamily:r,fontSize:i}}function _e(e){let t=e.attrs;if(!t?.listMarker||t.listMarkerHidden)return 0;let n=t.indent,r=n?.hanging??0;if(r>0)return r;let{fontFamily:i,fontSize:o}=ht(e),s={fontFamily:i,fontSize:o},a=O(t.listMarker,s),l=t.listMarkerSuffix??"tab";if(l==="nothing")return a;if(l==="space")return a+O(" ",s);let u=n?.left??0,c=n?.firstLine??0,g=u+c,d=g+a,S=(t.tabs??[]).filter(T=>T.val!=="clear"&&T.val!=="bar").map(T=>a$1(T.pos)).filter(T=>T>=d).sort((T,I)=>T-I)[0],P=a$1(t.defaultTabStopTwips??a$2),M=P>0?(Math.floor(d/P)+1)*P:void 0,B;return S!==void 0&&M!==void 0?B=Math.min(S,M):B=S??M,B===void 0?a+Y(o)*.5:B-g}var D=11,X="Calibri",bt=1.15,ne=1,Z=.5;function ze(e,t,n,r=false){let i=1,o=e.length,s=0;for(;i<=o;){let a=i+o>>>1;O(e.slice(0,a),t)<=n?(s=a,i=a+1):o=a-1;}return r&&s===0?1:s}function q(e){return {fontFamily:e.fontFamily??X,fontSize:e.fontSize??D,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function De(e,t,n){let r=Y(e),i=n?.ascent??r*.8,o=n?.descent??r*.2,s=n?.singleLineRatio??1.15,a=r*s,l;if(t?.lineRule==="exact"&&t.line!==void 0)l=t.line;else if(t?.lineRule==="atLeast"&&t.line!==void 0){let u=a*ne;l=Math.max(t.line,u);}else t?.line!==void 0&&t?.lineUnit==="multiplier"?l=a*t.line:t?.line!==void 0&&t?.lineUnit==="px"?l=t.line:l=a*ne;return {ascent:i,descent:o,lineHeight:l}}function Ne(e,t,n){let r=V({fontSize:e,fontFamily:n??X}),i=De(e,t,r),o=t?.lineRule??"auto";if(o==="auto"||o==="atLeast"){let s=Y(e),a=Math.max(i.lineHeight,s*bt);if(a!==i.lineHeight)return {...i,lineHeight:a}}return i}function Q(e){return e.kind==="text"}function Ze(e){return e.kind==="tab"}function Ue(e){return e.kind==="image"}function Xe(e){return e.kind==="lineBreak"}function Ge(e){return e.kind==="field"}function xt(e){return !e.text||e.text.replace(/\u00a0/g," ").trim().length===0}function St(e,t){let n=0;for(let r=t+1;r<e.length;r++){let i=e[r];if(Ze(i)||Xe(i))break;if(Q(i))n+=O(i.text||"",q(i));else if(Ge(i)){let o={fontFamily:i.fontFamily??X,fontSize:i.fontSize??D,bold:i.bold,italic:i.italic};n+=O(i.fallback||"1",o);}else Ue(i)&&(n+=i.width||0);}return n}function Mt(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];(r===" "||r==="-"||r===" ")&&t.push(n+1);}return t}function Ke(e,t,n){let r=Math.max(1,n),i=Math.max(0,e),o=Math.max(0,t);return i>=r||o>=r||i+o>=r?{leftMargin:0,rightMargin:0}:{leftMargin:i,rightMargin:o}}function Tt(e,t,n){let r=e.runs,i=e.attrs,o=i?.spacing,s=n?.floatingZones,a=n?.paragraphYOffset??0,l=i?.indent,u=l?.left??0,c=l?.right??0,g=(l?.firstLine??0)-(l?.hanging??0),d=Math.max(1,t-u-c),S=(l?.hanging??0)===0?_e(e):0,P=Math.max(1,d-g-S),M=0,B=0,T=Y(D)*ne,I=(m,p)=>{if(!s||s.length===0)return;let x=a+M,b=Ye(x,m,s,p,U)-x;b>0&&(M+=b,B+=b);};I(T,P);let w=te(M,T,s,a),C=Math.max(1,ee(w,P)),R=[];if(r.length===0){if(i?.suppressEmptyParagraphHeight)return R.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,ascent:0,descent:0,lineHeight:0}),{kind:"paragraph",lines:R,totalHeight:0};let m=i?.defaultFontSize??D,p=i?.defaultFontFamily??X,x=Ne(m,o,p);R.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...x});let b=x.lineHeight;return o?.before&&(b+=o.before),o?.after&&(b+=o.after),{kind:"paragraph",lines:R,totalHeight:b}}if(r.length===1&&Q(r[0])&&xt(r[0])){let m=r[0],p=m.fontSize??i?.defaultFontSize??D,x=m.fontFamily??i?.defaultFontFamily??X,b=Ne(p,o,x);R.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...b});let y=b.lineHeight;return o?.before&&(y+=o.before),o?.after&&(y+=o.after),{kind:"paragraph",lines:R,totalHeight:y}}let f={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:D,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:C,leftOffset:w.leftMargin,rightOffset:w.rightMargin,segmentZones:w.segments},L=()=>{let m=De(f.maxFontSize,o,f.maxFontMetrics),p={...m};if(f.maxImageHeightPx>p.lineHeight){let b=f.maxImageHeightPx,y=p.descent;f.fromRun===f.toRun?(p.lineHeight=b+y*2,p.ascent=b+y):(p.lineHeight=b+y,p.ascent=b);}let x={fromRun:f.fromRun,fromChar:f.fromChar,toRun:f.toRun,toChar:f.toChar,width:f.width,...p};f.leftOffset>0&&(x.leftOffset=f.leftOffset),f.rightOffset>0&&(x.rightOffset=f.rightOffset),f.segmentZones?.length&&(x.segments=H(x,f.segmentZones)),B>0&&(x.floatSkipBefore=B,B=0),R.push(x),M+=m.lineHeight;},H=(m,p)=>{let x=p[0],b=p[1];if(!x)return;if(!b||m.width<=x.availableWidth+Z)return [{fromRun:m.fromRun,fromChar:m.fromChar,toRun:m.toRun,toChar:m.toChar,width:m.width,leftOffset:x.leftOffset,availableWidth:x.availableWidth}];if(m.fromRun!==m.toRun)return;let y=r[m.fromRun];if(!y||!Q(y))return;let z=y,k=z.text.slice(m.fromChar,m.toChar),_=q(z),E=ze(k,_,x.availableWidth);if(E<=0||E>=k.length)return;let N=m.fromChar+E,A=k.slice(0,E),K=k.slice(E);return [{fromRun:m.fromRun,fromChar:m.fromChar,toRun:m.toRun,toChar:N,width:O(A,_),leftOffset:x.leftOffset,availableWidth:x.availableWidth},{fromRun:m.fromRun,fromChar:N,toRun:m.toRun,toChar:m.toChar,width:O(K,_),leftOffset:b.leftOffset,availableWidth:b.availableWidth}]},W=(m,p)=>{L();let x=Y(D)*ne;I(x,d);let b=te(M,x,s,a),y=Math.max(1,ee(b,d));f={fromRun:m,fromChar:p,toRun:m,toChar:p,width:0,maxFontSize:D,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:y,leftOffset:b.leftMargin,rightOffset:b.rightMargin,segmentZones:b.segments};},h=m=>{let p=m.fontSize??D;(!f.maxFontMetrics||p>f.maxFontSize)&&(f.maxFontSize=p,f.maxFontMetrics=V(m));};for(let m=0;m<r.length;m++){let p=r[m];if(Xe(p)){f.toRun=m,f.toChar=0,W(m+1,0);continue}if(Ze(p)){let x=q(p);h(x);let b=St(r,m),y=f.width+(f.leftOffset??0),z=R.length===0,k=u+(z?g:0)+y,_={explicitStops:i?.tabs,leftIndent:Me(u)},E=Oe(k,_,{followingWidth:b}).width;if(y+E>f.availableWidth+Z){let N=f.availableWidth-y-b;N>1&&(E=N);}f.width+E>f.availableWidth+Z&&(W(m,0),h(x)),f.width+=E,f.toRun=m,f.toChar=1;continue}if(Ue(p)){let x=p.wrapType,b=p.displayMode==="float"||c$1(x);if(p.position&&b){f.toRun=m,f.toChar=1;continue}if(x==="topAndBottom"||p.displayMode==="block"){f.width>0&&W(m,0);let N=p.height,A=p.distTop??6,K=p.distBottom??6;f.toRun=m,f.toChar=1,f.maxImageHeightPx=N+A+K,W(m+1,0);continue}let y=p.width,z=p.height;f.width+y>f.availableWidth+Z&&W(m,0);let k=y>0&&y>f.availableWidth?f.availableWidth/y:1,E=z*k+(p.distTop??0)+(p.distBottom??0);E>f.maxImageHeightPx&&(f.maxImageHeightPx=E),f.width+=y,f.toRun=m,f.toChar=1;continue}if(Ge(p)){let x=p.fallback||"1",b={fontFamily:p.fontFamily??X,fontSize:p.fontSize??D,bold:p.bold,italic:p.italic};h(b);let y=O(x,b);f.width>0&&f.width+y>f.availableWidth+Z&&(W(m,0),h(b)),f.width+=y,f.toRun=m,f.toChar=1;continue}if(Q(p)){let x=p,b=x.text,y=q(x);if(h(y),!b||b.length===0){f.toRun=m,f.toChar=0;continue}let z=Mt(b),k=0;for(;k<b.length;){let _=b.length;for(let A of z)if(A>k){_=A;break}let E=b.slice(k,_),N=O(E,y);if(N>f.availableWidth+Z){let A=0;for(;A<E.length;){let K=f.availableWidth-f.width+Z,tt=E.slice(A),oe=ze(tt,y,K);if(oe===0){if(f.width>0){W(m,k+A),h(y);continue}oe=1;}let ae=A+oe,nt=E.slice(A,ae),rt=O(nt,y);f.width+=rt,f.toRun=m,f.toChar=k+ae,A=ae,A<E.length&&(W(m,k+A),h(y));}k=_;continue}f.width>0&&f.width+N>f.availableWidth+Z&&(W(m,k),h(y)),f.width+=N,f.toRun=m,f.toChar=_,k=_;}}}L();let v=R.reduce((m,p)=>m+p.lineHeight+(p.floatSkipBefore??0),0);return o?.before&&(v+=o.before),o?.after&&(v+=o.after),{kind:"paragraph",lines:R,totalHeight:v}}function Cn(e,t){return e.map(n=>Tt(n,t))}function Rn(e){let t=q(e);return Ae(e.text,t).charWidths}function In(e,t){return e.map(n=>{let r=n.x-n.distLeft,i=n.x+n.width+n.distRight,o=n.y-n.distTop,s=n.y+n.height+n.distBottom;if(n.wrapType==="topAndBottom")return {leftMargin:0,rightMargin:0,topY:o,bottomY:s,fullWidthBlock:true};let a=0,l=0,u,c=n.wrapText??"bothSides";c==="right"?a=Te(i):c==="left"?l=ye(r,t):c==="largest"?{leftMargin:a,rightMargin:l}=Bt(r,i,t):Pt(r,i,t)?u=Ft(r,i,t):n.side==="left"?a=Te(i):l=ye(r,t);let g=Ke(a,l,t);return {leftMargin:g.leftMargin,rightMargin:g.rightMargin,topY:o,bottomY:s,segments:u}})}function ee(e,t){return e.segments?.reduce((r,i)=>r+i.availableWidth,0)??t-e.leftMargin-e.rightMargin}function te(e,t,n,r){if(!n||n.length===0)return {leftMargin:0,rightMargin:0};let i=0,o=0,s,a=r+e,l=a+t;for(let u of n)if(!(l<=u.topY||a>=u.bottomY)){if(u.fullWidthBlock)return {leftMargin:0,rightMargin:0,segments:[{leftOffset:0,availableWidth:0}]};if(u.segments?.length){s=s?yt(s,u.segments):u.segments;continue}i=Math.max(i,u.leftMargin),o=Math.max(o,u.rightMargin);}return {leftMargin:i,rightMargin:o,segments:s}}function Ye(e,t,n,r,i){if(!n||n.length===0)return e;let o=e;for(let s=0;s<n.length+2;s++){let a=te(o,t,n,0);if(ee(a,r)>=i)return o;let u=o+t,c=1/0;for(let g of n)u<=g.topY||o>=g.bottomY||g.bottomY>o&&g.bottomY<c&&(c=g.bottomY);if(!Number.isFinite(c)||c<=o)return o;o=c;}return o}function yt(e,t){let n=[];for(let r of e)for(let i of t){let o=Math.max(r.leftOffset,i.leftOffset),s=Math.min(r.leftOffset+r.availableWidth,i.leftOffset+i.availableWidth);s>o&&n.push({leftOffset:o,availableWidth:s-o});}return n}var U=24;function Pt(e,t,n){return e>U&&t+U<n}function Ft(e,t,n){return [{leftOffset:0,availableWidth:Math.max(0,e)},{leftOffset:Math.max(0,t),availableWidth:Math.max(0,n-t)}].filter(r=>r.availableWidth>1)}function Bt(e,t,n){let r=Math.max(0,e);return Math.max(0,n-t)>=r?{leftMargin:Te(t),rightMargin:0}:{leftMargin:0,rightMargin:ye(e,n)}}function Te(e){return Math.max(0,e)}function ye(e,t){return Math.max(0,t-e)}function wt(e,t){return e==null||!Number.isFinite(e)?0:Math.max(0,Math.min(t,e))}function re(e,t,n){if(e)return e.kind==="text"?typeof e.pmStart=="number"?e.pmStart+wt(t,e.text.length):n==="end"?e.pmEnd:void 0:n==="end"?typeof e.pmEnd=="number"?e.pmEnd:typeof e.pmStart=="number"?e.pmStart+1:void 0:e.pmStart}function $e(e,t,n,r){if(t.lines.length===0||n>=r)return {pmStart:e.pmStart,pmEnd:e.pmEnd};let i=t.lines[n],o=t.lines[r-1],s=i?e.runs[i.fromRun]:void 0,a=o?e.runs[o.toRun]:void 0,l=n===0?e.pmStart??re(s,i?.fromChar??0,"start"):re(s,i?.fromChar??0,"start"),u=r>=t.lines.length?e.pmEnd??re(a,o?.toChar??0,"end"):re(a,o?.toChar??0,"end");return l==null&&(l=e.pmStart),u==null&&(u=e.pmEnd),l!=null&&u!=null&&u<=l&&(u=l+1),{pmStart:l,pmEnd:u}}var je={count:1,gap:0};function Ct(e,t,n){return {activeTopMargin:e.top,activeBottomMargin:e.bottom,activeLeftMargin:e.left,activeRightMargin:e.right,pendingTopMargin:null,pendingBottomMargin:null,pendingLeftMargin:null,pendingRightMargin:null,activePageSize:{...t},pendingPageSize:null,activeColumns:n?{...n}:{...je},pendingColumns:null,activeOrientation:null,pendingOrientation:null,hasAnyPages:false}}function Rt(e,t){return t.count>1}function ie(e){return e?{count:e.count,gap:e.gap}:{...je}}function Lt(e,t,n){let r={...t},i=e.type??"continuous",o=e.margins,s=e.pageSize,a=e.orientation;o&&(typeof o.top=="number"&&(r.pendingTopMargin=Math.max(0,o.top)),typeof o.bottom=="number"&&(r.pendingBottomMargin=Math.max(0,o.bottom)),typeof o.left=="number"&&(r.pendingLeftMargin=Math.max(0,o.left)),typeof o.right=="number"&&(r.pendingRightMargin=Math.max(0,o.right))),s&&(r.pendingPageSize={w:s.w,h:s.h}),a&&(r.pendingOrientation=a);let l=Rt((e.margins,void 0),r.activeColumns);switch(i){case "nextPage":return r.pendingColumns=ie(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false},state:r};case "evenPage":return r.pendingColumns=ie(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false,requiredParity:"even"},state:r};case "oddPage":return r.pendingColumns=ie(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false,requiredParity:"odd"},state:r};default:return l?(r.pendingColumns=ie(void 0),{decision:{forcePageBreak:false,forceMidPageRegion:true},state:r}):{decision:{forcePageBreak:false,forceMidPageRegion:false},state:r}}}function kt(e){let t={...e};return t.pendingTopMargin!==null&&(t.activeTopMargin=t.pendingTopMargin,t.pendingTopMargin=null),t.pendingBottomMargin!==null&&(t.activeBottomMargin=t.pendingBottomMargin,t.pendingBottomMargin=null),t.pendingLeftMargin!==null&&(t.activeLeftMargin=t.pendingLeftMargin,t.pendingLeftMargin=null),t.pendingRightMargin!==null&&(t.activeRightMargin=t.pendingRightMargin,t.pendingRightMargin=null),t.pendingPageSize!==null&&(t.activePageSize=t.pendingPageSize,t.pendingPageSize=null),t.pendingColumns!==null&&(t.activeColumns=t.pendingColumns,t.pendingColumns=null),t.pendingOrientation!==null&&(t.activeOrientation=t.pendingOrientation,t.pendingOrientation=null),t}function It(e){return {top:e.pendingTopMargin??e.activeTopMargin,bottom:e.pendingBottomMargin??e.activeBottomMargin,left:e.pendingLeftMargin??e.activeLeftMargin,right:e.pendingRightMargin??e.activeRightMargin}}function vt(e){return e.pendingPageSize??e.activePageSize}function Et(e){return e.pendingColumns??e.activeColumns}function Wt(e,t){for(let n=0;n<e.pages.length;n++)for(let r of e.pages[n].fragments){if(r.pmStart==null)continue;let i=r.pmStart,o=r.pmEnd??i+1;if(t>=i&&t<o)return n}return null}var Ht={w:816,h:1056},G={top:96,right:96,bottom:96,left:96},Je={count:1,gap:0};function At(e,t,n){let r=[],i=[],o=t;for(let s=0;s<e.length;s++){if(e[s].kind!=="sectionBreak")continue;let a=e[s],l={pageSize:a.pageSize??o.pageSize,margins:a.margins??o.margins,columns:a.columns};r.push(l),i.push(s),o=l;}return r.push(n),{configs:r,breakIndices:i}}function Qe(e){if(e.runs.length===0)return true;if(e.runs.length!==1)return false;let t=e.runs[0];return t.kind==="text"&&(t.text??"")===""}function Ve(e){let t=e.attrs?.spacing?.before??0;return Qe(e)&&!e.attrs?.spacingExplicit?.before?0:t}function qe(e){let t=e.attrs?.spacing?.after??0;return Qe(e)&&!e.attrs?.spacingExplicit?.after?0:t}function et(e){for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n.kind!=="paragraph"||r.kind!=="paragraph")continue;let i=n.attrs,o=r.attrs;i?.contextualSpacing&&o?.contextualSpacing&&i.styleId&&i.styleId===o.styleId&&(i.spacing&&(i.spacing={...i.spacing,after:0}),o.spacing&&(o.spacing={...o.spacing,before:0}));}for(let t of e)if(t.kind==="table")for(let n of t.rows)for(let r of n.cells)et(r.blocks);}function Zn(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let r=n.pageSize??Ht,i={top:n.margins?.top??G.top,right:n.margins?.right??G.right,bottom:n.margins?.bottom??G.bottom,left:n.margins?.left??G.left,header:n.margins?.header??n.margins?.top??G.top,footer:n.margins?.footer??n.margins?.bottom??G.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let o={...i},s=n.finalPageSize??r,a=n.finalMargins??o;if(r.w-o.left-o.right<=0)throw new Error("layoutDocument: page size and margins yield no content area");let u={pageSize:r,margins:o,columns:n.columns},c={pageSize:s,margins:a,columns:n.columns},{configs:g,breakIndices:d}=At(e,u,c),S=[...d.map(w=>e[w].type),n.bodyBreakType],P=g[0]??u,M=fe({pageSize:P.pageSize,margins:P.margins,columns:P.columns??Je,footnoteReservedHeights:n.footnoteReservedHeights});et(e);let B=ge(e),T=pe(B),I=0;for(let w=0;w<e.length;w++){let C=e[w],R=t[w];de(C)&&M.forcePageBreak();let f=B.get(w);if(f&&!T.has(w)){let L=me(f,e,t),H=M.getCurrentState(),W=M.getAvailableHeight(),h=H.contentBottom-H.topMargin;L<=h&&L>W&&H.page.fragments.length>0&&M.forcePageBreak();}switch(C.kind){case "paragraph":Ot(C,R,M,M.getContentWidth());break;case "table":C.floating?Yt(C,R,M,M.getContentWidth()):Nt(C,R,M);break;case "image":Dt(C,R,M);break;case "textBox":Ut(C,R,M);break;case "pageBreak":M.forcePageBreak();break;case "columnBreak":M.forceColumnBreak();break;case "sectionBreak":{let L=S[I+1]??S[I];Xt(C,M,g[I+1]??P,L),I++;break}default:c$2(C,"runLayoutPipeline");}}return M.pages.length===0&&M.getCurrentState(),{pageSize:r,pages:M.pages,columns:n.columns,pageGap:n.pageGap}}function Ot(e,t,n,r){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let i=t.lines;if(i.length===0){let l=Ve(e),u=qe(e),c=n.getCurrentState(),g={kind:"paragraph",blockId:e.id,x:n.getColumnX(c.columnIndex),y:c.cursorY+l,width:r,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(g,0,l,u);return}let o=Ve(e),s=qe(e),a=0;for(;a<i.length;){let l=n.getCurrentState(),u=a===0?Math.max(o,l.trailingSpacing):0,c=n.getAvailableHeight()-u,g=0,d=0;for(let C=a;C<i.length;C++){let R=i[C].lineHeight+(i[C].floatSkipBefore??0),f=g+R;if(f<=c||d===0)g=f,d++;else break}let S=a===0,P=a+d>=i.length,M=S?o:0,B=P?s:0,T=$e(e,t,a,a+d),I={kind:"paragraph",blockId:e.id,x:n.getColumnX(l.columnIndex),y:0,width:r,height:g,fromLine:a,toLine:a+d,pmStart:T.pmStart,pmEnd:T.pmEnd,continuesFromPrev:!S,continuesOnNext:!P},w=n.addFragment(I,g,M,B);I.y=w.y,a+=d,a<i.length&&n.ensureFits(i[a].lineHeight);}}function _t(e){let t=0;for(let n of e.rows)if(n.isHeader)t++;else break;return t}function zt(e,t){let n=0;for(let r=0;r<t&&r<e.rows.length;r++)n+=e.rows[r].height;return n}function Nt(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let r=t.rows;if(r.length===0)return;let i=_t(e),o=zt(t,i),s=Le(e,t),a=0,l=0;for(;a<r.length;){let u=n.getCurrentState(),c=a===0&&l===0,g=c?u.trailingSpacing:0,d=!c&&i>0?o:0,S=n.getAvailableHeight()-g-d,P=a,M=l,B=0,T=a,I=l,w=a,C,R=false;for(;T<r.length;){let F=r[T].height,v=T===P?I:0,m=F-v;if(B+m<=S){B+=m,T+=1,w=T;continue}let p=S-B,x=e.rows[T]?.cantSplit?0:ke(s,T,v,p);x>0?(B+=x,w=T+1,C=v+x,R=true):w>P||(B+=m,w=T+1);break}let f=d+B,L=w===r.length&&!R,H=n.getColumnX(u.columnIndex);e.justification==="center"?H=H+(n.columnWidth-t.totalWidth)/2:e.justification==="right"?H=H+n.columnWidth-t.totalWidth:e.indent&&(H+=e.indent);let W={kind:"table",blockId:e.id,x:H,y:0,width:t.totalWidth,height:f,fromRow:P,toRow:w,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!c,continuesOnNext:!L,headerRowCount:!c&&i>0?i:void 0,topClip:M>0?M:void 0,bottomClip:C},h=n.addFragment(W,f,0,0);if(W.y=h.y,W.x=H,R?(a=w-1,l=C??0):(a=w,l=0),a<r.length){let F=(i>0?o:0)+(r[a].height-l);n.ensureFits(F);}}}function Yt(e,t,n,r){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let i=n.getCurrentState(),o=e.floating,s=i.page,a=s.margins,l=t.totalWidth,u=t.totalHeight,c=s.size.h-a.top-a.bottom,g=a.left,d=a.top;o?.horzAnchor==="page"&&(g=0),o?.vertAnchor==="page"&&(d=0),o?.vertAnchor==="text"&&(d=i.cursorY);let S=n.getColumnX(i.columnIndex);if(o?.tblpX!==void 0)S=g+o.tblpX;else if(o?.tblpXSpec){let L=o.tblpXSpec;L==="left"||L==="inside"?S=g:L==="right"||L==="outside"?S=g+r-l:L==="center"&&(S=g+(r-l)/2);}else e.justification==="center"?S=g+(r-l)/2:e.justification==="right"&&(S=g+r-l);let P=i.cursorY,M=false;if(o?.tblpY!==void 0)P=d+o.tblpY,M=true;else if(o?.tblpYSpec){M=true;let L=o.tblpYSpec;L==="top"?P=d:L==="bottom"?P=d+c-u:L==="center"&&(P=d+(c-u)/2);}M||(P=n.ensureFits(u).cursorY);let B=a.left,T=a.left+r-l;Number.isFinite(T)&&(S=Math.max(B,Math.min(S,T)));let I={kind:"table",blockId:e.id,x:S,y:P,width:l,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};i.page.fragments.push(I);let w=o?.leftFromText??0,C=o?.rightFromText??0,R=S-a.left-w,f=a.left+r-(S+l)-C;if(R<U&&f<U){let L=P+u+(o?.bottomFromText??0);L>i.cursorY&&(i.cursorY=L);}}function Dt(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Zt(e,t,n);return}let r=n.ensureFits(t.height),i={kind:"image",blockId:e.id,x:n.getColumnX(r.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=n.addFragment(i,t.height,0,0);i.y=o.y;}function Zt(e,t,n){let r=n.getCurrentState(),i=e.anchor,o=i.offsetH??n.getColumnX(r.columnIndex),s=i.offsetV??r.cursorY,a={kind:"image",blockId:e.id,x:o,y:s,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:i.behindDoc?-1:1};r.page.fragments.push(a);}function Ut(e,t,n){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");if($(e)){let s=n.getCurrentState(),a={kind:"textBox",blockId:e.id,x:n.getColumnX(s.columnIndex),y:s.cursorY,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true,zIndex:e.wrapType==="behind"?-1:1};s.page.fragments.push(a);return}let r=n.ensureFits(t.height),i={kind:"textBox",blockId:e.id,x:n.getColumnX(r.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=n.addFragment(i,t.height,0,0);i.y=o.y;}function Xt(e,t,n,r){switch(r??"nextPage"){case "nextPage":t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak();break;case "evenPage":{t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}case "continuous":t.updatePageLayout(n.pageSize,n.margins,false);break}t.updateColumns(n.columns??Je);}export{Cn as A,Rn as B,fe as C,ge as D,me as E,pe as F,it as G,de as H,$ as I,ot as J,at as K,Re as L,Ct as M,Lt as N,kt as O,It as P,vt as Q,Et as R,Wt as S,At as T,Zn as U,zt as V,qt as a,Ce as b,Jt as c,Qt as d,be as e,sn as f,xe as g,V as h,O as i,ln as j,Ae as k,un as l,cn as m,fn as n,gn as o,Y as p,gt as q,mn as r,pn as s,In as t,te as u,Oe as v,ht as w,_e as x,Ke as y,Tt as z};
|
package/dist/chunk-5HA66FH4.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {c}from'./chunk-L6ZRNW7Y.mjs';import {V as V$1,L,T,k,l}from'./chunk-4RQAAKQI.mjs';import {b}from'./chunk-SHYNWAW6.mjs';import {e}from'./chunk-VW22RZ6C.mjs';function ee(e,n){if(e.pages.length===0)return null;let a=e.pageGap??0,r=0,t=null,o=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,f=r,u=f+l;if(n.y>=f&&n.y<u)return {pageIndex:s,page:i,pageY:n.y-f};let c=f+l/2,m=Math.abs(n.y-c);m<o&&(o=m,t=s),r=u+a;}if(t!==null){let s=e.pages[t],i=A(e,t);return {pageIndex:t,page:s,pageY:Math.max(0,Math.min(n.y-i,s.size?.h??e.pageSize.h))}}return null}function A(e,n){let a=e.pageGap??0,r=0;for(let t=0;t<n&&t<e.pages.length;t++){let s=e.pages[t].size?.h??e.pageSize.h;r+=s+a;}return r}function Ne(e,n){return ee(e,{y:n})?.pageIndex??null}function te(e,n){return e.findIndex(a=>a.id===n)}function Ye(e,n){let a=0;for(let r=e.fromLine;r<e.toLine&&r<n.lines.length;r++)a+=n.lines[r].lineHeight;return a}function ge(e,n,a,r){let t=[...e.page.fragments].sort((o,s)=>{let i=o.y-s.y;return Math.abs(i)>.5?i:o.x-s.x});for(let o of t){let s=te(n,o.blockId);if(s===-1)continue;let i=n[s],l=a[s];if(!i||!l)continue;let f;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;f=Ye(o,l);}else if(o.kind==="table")f=o.height;else if(o.kind==="image")f=o.height;else continue;let u=r.x>=o.x&&r.x<=o.x+o.width,c=r.y>=o.y&&r.y<=o.y+f;if(u&&c)return {fragment:o,block:i,measure:l,pageIndex:e.pageIndex,localX:r.x-o.x,localY:r.y-o.y}}return null}function ze(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="image")continue;let o=te(n,t.blockId);if(o===-1)continue;let s=n[o],i=a[o];if(!s||!i)continue;let l=r.x>=t.x&&r.x<=t.x+t.width,f=r.y>=t.y&&r.y<=t.y+t.height;if(l&&f)return {fragment:t,block:s,measure:i,pageIndex:e.pageIndex,localX:r.x-t.x,localY:r.y-t.y}}return null}function pe(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="table")continue;let o=t,s=r.x>=o.x&&r.x<=o.x+o.width,i=r.y>=o.y&&r.y<=o.y+o.height;if(!s||!i)continue;let l=te(n,o.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="table"||!u||u.kind!=="table")continue;let c=f,m=u,g=r.x-o.x,x=r.y-o.y,d=o.headerRowCount??0,h=d>0&&o.continuesFromPrev?V$1(m,d):0,p=0,b=-1;if(m.rows.length===0||c.rows.length===0)continue;if(h>0&&x<h){let M=0;for(let w=0;w<d&&w<m.rows.length;w++){let L=m.rows[w];if(x>=M&&x<M+L.height){b=w;break}M+=L.height;}b===-1&&(b=0);}else {let M=x-h;for(let w=o.fromRow;w<o.toRow&&w<m.rows.length;w++){let L=m.rows[w];if(M>=p&&M<p+L.height){b=w;break}p+=L.height;}}if(b===-1&&(b=Math.min(o.toRow-1,m.rows.length-1),b<o.fromRow))continue;let T=m.rows[b],H=c.rows[b];if(!T||!H)continue;let F=0,k=-1;if(T.cells.length===0||H.cells.length===0)continue;for(let M=0;M<T.cells.length;M++){let w=T.cells[M];if(g>=F&&g<F+w.width){k=M;break}F+=w.width;}if(k===-1&&(k=T.cells.length-1,k<0))continue;let P=T.cells[k],S=H.cells[k];if(!P||!S)continue;let y=0;if(h>0&&b<d)for(let M=0;M<b;M++)y+=m.rows[M]?.height??0;else {y=h;for(let M=o.fromRow;M<b;M++)y+=m.rows[M]?.height??0;}let R=0;for(let M=0;M<k;M++)R+=T.cells[M]?.width??0;let _,I;if(S.blocks&&S.blocks.length>0){let M=S.blocks[0],w=P.blocks[0];M.kind==="paragraph"&&w?.kind==="paragraph"&&(_=M,I=w);}let E=g-R,C=x-y;return {fragment:o,block:c,measure:m,pageIndex:e.pageIndex,rowIndex:b,colIndex:k,cellBlock:_,cellMeasure:I,cellLocalX:Math.max(0,E),cellLocalY:Math.max(0,C)}}return null}function We(e,n,a,r){let t={pageHit:null,fragmentHit:null,tableCellHit:null};if(t.pageHit=ee(e,r),!t.pageHit)return t;let o=A(e,t.pageHit.pageIndex),s={x:r.x,y:r.y-o};return t.fragmentHit=ge(t.pageHit,n,a,s),t.fragmentHit?.fragment.kind==="table"&&(t.tableCellHit=pe(t.pageHit,n,a,s)),t}function Ge(e){if(e.pages.length===0)return 0;let n=e.pageGap??0,a=0;for(let r=0;r<e.pages.length;r++){let t=e.pages[r];a+=t.size?.h??e.pageSize.h,r<e.pages.length-1&&(a+=n);}return a}function Ve(e,n){return A(e,n)}function Ue(e,n){if(n<0||n>=e.pages.length)return null;let a=A(e,n),t=e.pages[n].size?.h??e.pageSize.h;return {top:a,bottom:a+t}}function ne(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function be(e,n){let a=[];for(let r=n.fromRun;r<=n.toRun&&r<e.runs.length;r++){let t=e.runs[r];if(t){if(t.kind==="tab"||t.kind==="image"||t.kind==="lineBreak"){a.push(t);continue}if(t.kind==="text"){let o=t.text??"",s=r===n.fromRun,i=r===n.toRun;if(s||i){let l=s?n.fromChar:0,f=i?n.toChar:o.length,u=o.slice(l,f);u.length>0&&a.push({...t,text:u});}else a.push(t);}}}return a}function xe(e,n){let a,r,t=e.pmStart??0,o=0;for(let s=0;s<e.runs.length&&s<=n.toRun;s++){let i=e.runs[s];i&&(s<n.fromRun?i.kind==="text"?o+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(o+=1):s===n.fromRun&&(o+=n.fromChar,a=t+o,i.kind==="text"&&(o=n.fromChar)));}if(a!==void 0){let s=0;for(let i=n.fromRun;i<=n.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let f=l.text??"",u=i===n.fromRun?n.fromChar:0,c=i===n.toRun?n.toChar:f.length;s+=c-u;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}r=a+s;}return {pmStart:a,pmEnd:r}}function $e(e,n,a,r){let t=0;for(let o=a;o<r&&o<e.lines.length;o++){let i=e.lines[o].lineHeight;if(n>=t&&n<t+i)return o;t+=i;}return r>a?Math.min(r-1,e.lines.length-1):null}function qe(e,n,a,r){let{pmStart:t,pmEnd:o}=xe(e,n);if(t===void 0||o===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(r-n.width)/2):s==="right"&&(i=Math.max(0,r-n.width));let l$1=Math.max(0,a-i);if(l$1<=0)return {charOffset:0,pmPosition:t};let f=be(e,n);if(f.length===0)return {charOffset:0,pmPosition:t};let u=0,c=0;for(let g of f){if(g.kind==="tab"){let x=g.width??48,d=u+x;if(l$1<=d){let h=u+x/2;return l$1<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="image"){let x=g.width,d=u+x;if(l$1<=d){let h=u+x/2;return l$1<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="lineBreak"){if(l$1>=u)return {charOffset:c,pmPosition:t+c};c+=1;continue}if(g.kind==="text"){let x=g.text??"";if(x.length===0)continue;let d=ne(g),h=k(x,d),p=u+h.width;if(l$1<=p){let b=l$1-u,T=l(b,h.charWidths),H=c+T;return {charOffset:H,pmPosition:t+H}}u=p,c+=x.length;}}return {charOffset:o-t,pmPosition:o}}function oe(e){let{fragment:n,block:a,measure:r,localX:t,localY:o}=e;if(n.kind!=="paragraph"||a.kind!=="paragraph"||r.kind!=="paragraph")return null;let s=n,i=a,l=r,f=$e(l,o,s.fromLine,s.toLine);if(f===null)return null;let u=l.lines[f];if(!u)return null;let c=0;for(let T=s.fromLine;T<f;T++)c+=l.lines[T]?.lineHeight??0;let m=i.attrs?.indent,g=m?.left??0,x=m?.right??0,d=Math.max(0,n.width-g-x),h=t-g,{charOffset:p,pmPosition:b}=qe(i,u,h,d);return {pmPosition:b,charOffset:p,lineIndex:f}}function ke(e){let{cellBlock:n,cellMeasure:a,cellLocalX:r,cellLocalY:t}=e;if(!n||!a)return null;let o={fragment:{kind:"paragraph",blockId:n.id,x:0,y:0,width:a.lines.reduce((i,l)=>Math.max(i,l.width),100),fromLine:0,toLine:a.lines.length,height:a.totalHeight},block:n,measure:a,pageIndex:e.pageIndex,localX:r,localY:t};return oe(o)?.pmPosition??null}function je(e,n){if(n)return ke(n);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?oe(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function Te(e,n,a,r){let t=e.pmStart??0,o=e.pmEnd??t;if(a<t||a>o)return null;let s=a-t;for(let i=0;i<n.lines.length;i++){let l=n.lines[i],{pmStart:f,pmEnd:u}=xe(e,l);if(f===void 0||u===void 0)continue;let c=f-t,m=u-t;if(s>=c&&s<=m){let g=s-c,x=be(e,l),d=0,h=0;for(let p of x)if(p.kind==="tab"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+(p.width??48),lineIndex:i};d+=p.width??48,h+=1;}else if(p.kind==="image"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+p.width,lineIndex:i};d+=p.width,h+=1;}else if(p.kind==="lineBreak"){if(g<=h)return {x:d,lineIndex:i};h+=1;}else if(p.kind==="text"){let b=p.text??"";if(g<=h+b.length){let F=g-h,k$1=ne(p),P=k(b.slice(0,F),k$1);return {x:d+P.width,lineIndex:i}}let T=ne(p),H=k(b,T);d+=H.width,h+=b.length;}return {x:d,lineIndex:i}}}return null}function Je(e,n,a,r,t,o,s){let i=Te(e,n,a);if(!i)return null;let l=e.attrs?.alignment??"left",f=e.attrs?.indent,u=f?.left??0,c=f?.right??0,m=Math.max(0,o-u-c),g=n.lines[i.lineIndex];if(!g)return null;let x=0;l==="center"?x=Math.max(0,(m-g.width)/2):l==="right"&&(x=Math.max(0,m-g.width));let d=0;for(let h=s;h<i.lineIndex;h++)d+=n.lines[h]?.lineHeight??0;return {x:r+u+x+i.x,y:t+d,height:g.lineHeight}}function Ke(e,n,a={}){let r=a.scope??"body",t=r==="body"?"layout-page-content":`layout-page-${r}`,o=`.${t} .layout-table-cell`,s=e.querySelectorAll(`.${t} .layout-table-cell-selected`);for(let c of Array.from(s))c.classList.remove("layout-table-cell-selected");let i=n.selection;if(!("$anchorCell"in i&&typeof i.forEachCell=="function")||!i.forEachCell)return;let f=[];i.forEachCell((c,m)=>{f.push([m,m+c.nodeSize]);});let u=e.querySelectorAll(o);for(let c of Array.from(u)){let m=c,g=m.dataset.pmStart;if(g===void 0)continue;let x=Number(g);for(let[d,h]of f)if(x>=d&&x<h){m.classList.add("layout-table-cell-selected");break}}}function Me(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function re(e,n){return e.findIndex(a=>a.id===n)}function V(e,n){let r=(e.pmStart??0)+1,t=0,o;for(let l=0;l<e.runs.length&&l<=n.toRun;l++){let f=e.runs[l];if(f){if(l<n.fromRun)f.kind==="text"?t+=(f.text??"").length:t+=1;else if(l===n.fromRun){t+=n.fromChar,o=r+t;break}}}o===void 0&&(o=r);let s=0;for(let l=n.fromRun;l<=n.toRun&&l<e.runs.length;l++){let f=e.runs[l];if(f)if(f.kind==="text"){let u=f.text??"",c=l===n.fromRun?n.fromChar:0,m=l===n.toRun?n.toChar:u.length;s+=m-c;}else s+=1;}let i=o+s;return {pmStart:o,pmEnd:i}}function Fe(e,n,a,r){let t=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o],i=V(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<r&&t.push({line:s,index:o});}return t}function W(e,n,a){let r=V(e,n);return r.pmStart===void 0?0:Math.max(0,a-r.pmStart)}function G(e,n,a,r){let t=0,o=0;for(let s=n.fromRun;s<=n.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="image"){let l=i.width;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="lineBreak"){if(a<=o)return t;o+=1;continue}if(i.kind==="text"){let l=i.text??"",f=s===n.fromRun,u=s===n.toRun,c=f?n.fromChar:0,m=u?n.toChar:l.length,g=l.slice(c,m);if(o+g.length>=a){let h=a-o,p=Me(i),b=k(g.slice(0,h),p);return t+b.width}let x=Me(i),d=k(g,x);t+=d.width,o+=g.length;}}}return t}function J(e,n){let a=0;for(let r=0;r<n&&r<e.lines.length;r++)a+=e.lines[r].lineHeight;return a}function Qe(e,n,a,r,t){if(r===t)return [];let o=Math.min(r,t),s=Math.max(r,t),i=[];for(let l=0;l<e.pages.length;l++){let f=e.pages[l],u=A(e,l);for(let c of f.fragments){if(c.kind==="paragraph"){let m=re(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=g,h=x,p=c,b=Fe(d,h,o,s);for(let{line:T,index:H}of b){if(H<p.fromLine||H>=p.toLine)continue;let F=V(d,T);if(F.pmStart===void 0||F.pmEnd===void 0)continue;let k=Math.max(F.pmStart,o),P=Math.min(F.pmEnd,s);if(k>=P)continue;let S=W(d,T,k),y=W(d,T,P),B=d.attrs?.indent,R=B?.left??0,_=B?.right??0,I=Math.max(0,c.width-R-_),E=G(d,T,S),C=G(d,T,y),M=d.attrs?.alignment??"left",w=0;M==="center"?w=Math.max(0,(I-T.width)/2):M==="right"&&(w=Math.max(0,I-T.width));let L=J(h,H)-J(h,p.fromLine),D=c.x+R+w+Math.min(E,C),Y=Math.max(1,Math.abs(C-E)),z=c.y+L;i.push({x:D,y:z+u,width:Y,height:T.lineHeight,pageIndex:l});}}if(c.kind==="table"){let m=re(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="table"||!x||x.kind!=="table")continue;let d=g,h=x,p=c,b=[],T=0;for(let y=0;y<h.rows.length;y++)b.push(Math.round(T)),T+=h.rows[y]?.height??0;b.push(Math.round(T));let H=p.headerRowCount??0,F=H>0&&p.continuesFromPrev?V$1(h,H):0,k=(b[p.fromRow]??0)+(p.topClip??0),P=p.bottomClip!==void 0?Math.round(p.height):F+((b[p.toRow]??0)-k),S=y=>F+(y-k);for(let y=p.fromRow;y<p.toRow&&y<d.rows.length;y++){let B=d.rows[y],R=h.rows[y];if(!B||!R)continue;let _=b[y]??0,I=0;for(let E=0;E<B.cells.length;E++){let C=B.cells[E],M=R.cells[E];if(!C||!M)continue;let w=C.padding?.top??0,L$1=L(C.blocks,M.blocks,w);for(let D=0;D<C.blocks.length;D++){let Y=C.blocks[D],z=M.blocks[D];if(!Y||Y.kind!=="paragraph"||!z||z.kind!=="paragraph")continue;let X=Y,Ae=z,De=L$1.lineTops[D]??[],ve=Fe(X,Ae,o,s);for(let{line:v,index:Oe}of ve){let q=V(X,v);if(q.pmStart===void 0||q.pmEnd===void 0)continue;let ae=Math.max(q.pmStart,o),se=Math.min(q.pmEnd,s);if(ae>=se)continue;let Q=S(_+(De[Oe]??0));if(Q+v.lineHeight<=F||Q>=P)continue;let _e=W(X,v,ae),Xe=W(X,v,se),le=G(X,v,_e,M.width),ce=G(X,v,Xe,M.width);i.push({x:p.x+I+Math.min(le,ce),y:p.y+Q+u,width:Math.max(1,Math.abs(ce-le)),height:v.lineHeight,pageIndex:l});}}I+=M.width;}}}if(c.kind==="image"){let m=c.pmStart??0;(c.pmEnd??m+1)>o&&m<s&&i.push({x:c.x,y:c.y+u,width:c.width,height:c.height,pageIndex:l});}}}return i}function Ze(e,n,a,r){for(let t=0;t<e.pages.length;t++){let o=e.pages[t],s=A(e,t);for(let i of o.fragments){if(i.kind==="paragraph"){let l=re(n,i.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let c=f,m=u,g=i,x=c.pmStart??0,d=c.pmEnd??x;if(r<x||r>d)continue;for(let h=g.fromLine;h<g.toLine;h++){let p=m.lines[h];if(!p)continue;let b=V(c,p);if(!(b.pmStart===void 0||b.pmEnd===void 0)&&r>=b.pmStart&&r<=b.pmEnd){let T=W(c,p,r),H=c.attrs?.indent,F=H?.left??0,k=H?.right??0,P=Math.max(0,i.width-F-k),S=G(c,p,T),y=c.attrs?.alignment??"left",B=0;y==="center"?B=Math.max(0,(P-p.width)/2):y==="right"&&(B=Math.max(0,P-p.width));let R=J(m,h)-J(m,g.fromLine);return {x:i.x+F+B+S,y:i.y+R+s,height:p.lineHeight,pageIndex:t}}}}if(i.kind==="image"){let l=i.pmStart??0,f=i.pmEnd??l+1;if(r>=l&&r<=f){let u=r===l?0:i.width;return {x:i.x+u,y:i.y+s,height:i.height,pageIndex:t}}}}}return null}function et(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function tt(e){let n=new Map;for(let a of e){let r=n.get(a.pageIndex)??[];r.push(a),n.set(a.pageIndex,r);}return n}function nt(e){if(e.kind!=="paragraph")return false;let n=e.attrs;return n?!!(n.borders?.top||n.borders?.bottom||n.spacingExplicit?.before||n.spacingExplicit?.after):false}function ye(e){return He(e)}function He(e){let n=new Set;for(let a=1;a<e.length;a++){let r=e[a-1],t=e[a];r.kind==="table"&&t.kind==="paragraph"&&(t.runs.length>0||nt(t)||n.add(a));}return e.map((a,r)=>{if(a.kind==="table")return ot(a);if(a.kind!=="paragraph")return a;let t=n.has(r),o=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!o?.before,f=i&&!o?.after,u=l||f;if(!u&&!t)return a;let c=a.attrs;return u&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:o?.before?c.spacing.before:void 0,after:o?.after?c.spacing.after:void 0}}),t&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function ot(e){let n=false,a=e.rows.map(r=>{let t=false,o=r.cells.map(s=>{let i=He(s.blocks);return i.some((f,u)=>f!==s.blocks[u])?(t=true,{...s,blocks:i}):s});return t?(n=true,{...r,cells:o}):r});return n?{...e,rows:a}:e}function rt(e){return e?.align??e?.alignment}function we(e$1,n,a,r){let t=r.section==="header"?r.margins.header??48:r.pageSize.h-(r.margins.footer??48)-a,o=e$1.position?.vertical;if(!o)return n;let s=rt(o),i=o.posOffset!==void 0?e(o.posOffset):void 0;if(o.relativeTo==="page"){if(i!==void 0)return i-t;if(s==="top")return -t;if(s==="bottom")return r.pageSize.h-e$1.height-t;if(s==="center")return (r.pageSize.h-e$1.height)/2-t}if(o.relativeTo==="margin"){let l=r.margins.top,f=r.pageSize.h-r.margins.top-r.margins.bottom;if(i!==void 0)return l+i-t;if(s==="top")return l-t;if(s==="bottom")return l+f-e$1.height-t;if(s==="center")return l+(f-e$1.height)/2-t}return i!==void 0?n+i:n}function Pe(e){switch(e.kind){case "paragraph":case "table":return true;case "image":return !e.anchor?.isAnchored;case "textBox":return e.displayMode===void 0||e.displayMode==="inline";default:return false}}function it(e){return e?e.kind==="paragraph"||e.kind==="table"?e.totalHeight:e.kind==="image"||e.kind==="textBox"?e.height:0:0}function Se(e,n,a,r){let t=0,o=0,s=0;for(let i=0;i<e.length;i++){let l=e[i],f=n[i];if(!(!l||!f)){if(l.kind==="paragraph"&&f.kind==="paragraph"){let u=s,c=u+f.totalHeight;t=Math.min(t,u),o=Math.max(o,c);for(let m of l.runs){if(m.kind!=="image"||!m.position)continue;let g=we(m,u,a,r);t=Math.min(t,g),o=Math.max(o,g+m.height);}s=c;}else if(l.kind==="table"&&f.kind==="table"){let u=s+f.totalHeight;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="image"&&f.kind==="image"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="textBox"&&f.kind==="textBox"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),l.displayMode!=="float"&&(s=u);}}}return {visualTop:t,visualBottom:o}}function at(e,n,a,r){if(!e||!e.content||e.content.length===0)return;let t=b(e.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null});return Be(t,n,a,r)}function Be(e,n,a,r){let t=c(e,{theme:r.theme??void 0});if(t.length===0)return;let o=ye(t),s=r.measureBlocks(o,n),i=0,l=0;for(let c=0;c<o.length;c++){let m=it(s[c]);i+=m,Pe(o[c])&&(l+=m);}let{visualTop:f,visualBottom:u}=Se(o,s,i,a);return {blocks:o,measures:s,height:i,flowHeight:l,visualTop:f,visualBottom:u}}var K={header:null,footer:null};function st(){K.header=null,K.footer=null;}function Re(e,n){let a=n.querySelectorAll(`.layout-page-${e}`);if(a.length===0)return null;let r=n.defaultView,t=r?r.innerHeight/2:0,o=a[0],s=1/0;for(let c of Array.from(a)){let m=c.getBoundingClientRect(),g=Math.abs((m.top+m.bottom)/2-t);g<s&&(s=g,o=c);}let i=K[e];if(i&&i.host===o&&i.host.isConnected)return i;let l=Array.from(o.querySelectorAll("span[data-pm-start][data-pm-end]")),f=Array.from(o.querySelectorAll("[data-pm-start][data-pm-end]")),u={host:o,spans:l,ranged:f};return K[e]=u,u}function lt(e,n,a=globalThis.document){let r=e.state.selection;if(!r.empty)return null;let t=r.head,o=Re(n,a);if(!o)return null;let{host:s,spans:i}=o;for(let d of i){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!(!Number.isFinite(h)||!Number.isFinite(p))&&t>=h&&t<=p){let b=s.ownerDocument.createRange(),T=s.ownerDocument.createTreeWalker(d,NodeFilter.SHOW_TEXT),H=t-h,F=T.nextNode();for(;F;){let S=F.data.length;if(H<=S){try{b.setStart(F,H),b.setEnd(F,H);let y=b.getClientRects()[0]??b.getBoundingClientRect();if(y&&y.height>0)return {top:y.top,left:y.left,height:y.height}}catch{}break}H-=S,F=T.nextNode();}let k=d.getBoundingClientRect(),P=(t-h)/Math.max(1,p-h);return {top:k.top,left:k.left+k.width*P,height:k.height}}}let l=s.querySelector(`[data-pm-start="${t}"]`);if(l){let d=l.getBoundingClientRect();return {top:d.top,left:d.left+1,height:d.height||16}}let f=o.ranged,u=null,c=1/0;for(let d of f){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!Number.isFinite(h)||!Number.isFinite(p)||t<h||t>p)continue;let b=p-h;b<c&&(c=b,u=d);}if(u){let d=u.getBoundingClientRect(),h=Number(u.dataset.pmEnd),p=t>=h;return {top:d.top,left:p?d.right:d.left+1,height:d.height||16}}let m=null,g=-1/0;for(let d of f){let h=Number(d.dataset.pmStart);Number.isFinite(h)&&(h>t||h>g&&(g=h,m=d));}if(m){let d=m.getBoundingClientRect();return {top:d.top,left:d.right,height:d.height||16}}let x=s.getBoundingClientRect();return {top:x.top+2,left:x.left+2,height:16}}function ct(e,n,a=globalThis.document){let r=e.state.selection;if(r.empty)return [];let t=r.from,o=r.to,s=[],i=Re(n,a);if(!i)return s;let{host:l,spans:f}=i;for(let u of f){let c=Number(u.dataset.pmStart),m=Number(u.dataset.pmEnd);if(!Number.isFinite(c)||!Number.isFinite(m)||m<=t||c>=o)continue;if(u.classList.contains("layout-run-tab")){let p=u.getBoundingClientRect();s.push({top:p.top,left:p.left,width:p.width,height:p.height});continue}let g=null;if(u.firstChild?.nodeType===Node.TEXT_NODE?g=u.firstChild:u.firstChild?.nodeType===Node.ELEMENT_NODE&&u.firstChild.tagName==="A"&&u.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(g=u.firstChild.firstChild),!g)continue;let x=Math.max(0,t-c),d=Math.min(g.length,o-c);if(x>=d)continue;let h=l.ownerDocument.createRange();h.setStart(g,x),h.setEnd(g,d);for(let p of Array.from(h.getClientRects()))s.push({top:p.top,left:p.left,width:p.width,height:p.height});}return s}function Ie(e){return e?e.flowHeight??e.height:0}function ut(e){let{pageSize:n,margins:a,finalMargins:r,bodyBlocks:t,headers:o,footers:s,warn:i}=e,l=a.header??48,f=a.footer??48,u=a.top-l,c=a.bottom-f,m=Math.max(0,...(o??[]).map(Ie)),g=Math.max(0,...(s??[]).map(Ie)),x=m>u,d=g>c;if(!x&&!d)return {margins:a,finalMargins:r};let h=Math.max(0,n.h-24),p=false,b=F=>{let k={...F};return x&&(k.top=Math.max(F.top,l+m)),d&&(k.bottom=Math.max(F.bottom,f+g)),k.top+k.bottom>h&&(p=true,k.bottom=Math.max(0,Math.min(k.bottom,h-k.top)),k.top+k.bottom>h&&(k.top=Math.max(0,h-k.bottom))),k},T=b(a),H=b(r);if(t)for(let F of t){if(F.kind!=="sectionBreak")continue;let k=F;k.margins&&(k.margins=b(k.margins));}return p&&i&&i(`[layout] header/footer content exceeds page height; clamping margins to preserve a content area. pageHeight=${Math.round(n.h)} headerBand=${Math.round(m)} footerBand=${Math.round(g)} top=${Math.round(T.top)} bottom=${Math.round(T.bottom)}`),{margins:T,finalMargins:H}}var Ce=816,Ee=1056,U=96,ie=48;function $(e){return Math.round(e/1440*96)}function N(e,n){return e!=null?$(e):n}function ft(e){return {w:e?.pageWidth?$(e.pageWidth):Ce,h:e?.pageHeight?$(e.pageHeight):Ee}}function dt(e){return {top:N(e?.marginTop,U),right:N(e?.marginRight,U),bottom:N(e?.marginBottom,U),left:N(e?.marginLeft,U),header:N(e?.headerDistance,ie),footer:N(e?.footerDistance,ie)}}function ht(e,n){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let r=e.package.headers,t=e.package.footers,o=null,s=null,i=null,l=null;if(r&&n?.headerReferences){let f=n.headerReferences.find(c=>c.type==="default");f?.rId&&(o=r.get(f.rId)??null);let u=n.headerReferences.find(c=>c.type==="first");u?.rId&&(i=r.get(u.rId)??null);}if(t&&n?.footerReferences){let f=n.footerReferences.find(c=>c.type==="default");f?.rId&&(s=t.get(f.rId)??null);let u=n.footerReferences.find(c=>c.type==="first");u?.rId&&(l=t.get(u.rId)??null);}return n?.titlePg||(!o&&i&&(o=i),!s&&l&&(s=l)),{header:o,footer:s,firstHeader:i,firstFooter:l}}function mt(e){let n=e?.columnCount??1;if(n<=1)return;let a=$(e?.columnSpace??720);return {count:n,gap:a,equalWidth:e?.equalWidth??true,separator:e?.separator}}function Le(e){let n=e.pageSize.w-e.margins.left-e.margins.right,a=e.columns;return !a||a.count<=1?n:Math.floor((n-(a.count-1)*a.gap)/a.count)}function gt(e,n,a){let{configs:r,breakIndices:t}=T(e,n,a),o=0,s=[];for(let i=0;i<e.length;i++)s.push(Le(r[o]??n)),o<t.length&&i===t[o]&&o++;return s}export{st as A,lt as B,ct as C,ut as D,Ce as E,Ee as F,U as G,ie as H,$ as I,ft as J,dt as K,ht as L,mt as M,Le as N,gt as O,ee as a,A as b,Ne as c,ge as d,ze as e,pe as f,We as g,Ge as h,Ve as i,Ue as j,oe as k,ke as l,je as m,Te as n,Je as o,Ke as p,Qe as q,Ze as r,et as s,tt as t,ye as u,we as v,Pe as w,Se as x,at as y,Be as z};
|
package/dist/chunk-7OW3VCZE.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-QPFJJPIC.mjs';import {e,f as f$1}from'./chunk-VW22RZ6C.mjs';function u(e){return {sdtType:e.sdtType,id:e.id??null,alias:e.alias??null,tag:e.tag??null,lock:e.lock??null,placeholder:e.placeholder??null,showingPlaceholder:e.showingPlaceholder??false,dateFormat:e.dateFormat??null,listItems:e.listItems?JSON.stringify(e.listItems):null,checked:e.checked??null,dataBinding:e.dataBinding?JSON.stringify(e.dataBinding):null,rawPropertiesXml:e.rawPropertiesXml??null,rawEndPropertiesXml:e.rawEndPropertiesXml??null}}function g(e){let i={sdtType:e.sdtType??"richText"};if(typeof e.id=="number"&&(i.id=e.id),e.alias!=null&&(i.alias=String(e.alias)),e.tag!=null&&(i.tag=String(e.tag)),e.lock!=null&&(i.lock=e.lock),e.placeholder!=null&&(i.placeholder=String(e.placeholder)),e.showingPlaceholder&&(i.showingPlaceholder=true),e.dateFormat!=null&&(i.dateFormat=String(e.dateFormat)),typeof e.listItems=="string"&&e.listItems)try{i.listItems=JSON.parse(e.listItems);}catch{}if(e.checked!=null&&(i.checked=e.checked),typeof e.dataBinding=="string"&&e.dataBinding)try{i.dataBinding=JSON.parse(e.dataBinding);}catch{}return e.rawPropertiesXml!=null&&(i.rawPropertiesXml=String(e.rawPropertiesXml)),e.rawEndPropertiesXml!=null&&(i.rawEndPropertiesXml=String(e.rawEndPropertiesXml)),i}function a(e){return !!e.wrap&&e.wrap.type!=="inline"}function w(e$1){let i=e$1.wrap?.type??"inline",t=e$1.wrap?.wrapText,l=e$1.position?.horizontal?.alignment;return {displayMode:d(i),cssFloat:p(i,t,l),wrapType:i,wrapText:t,anchorTarget:a(e$1)?"followingBlock":void 0,position:e$1.position?f(e$1.position):void 0,distTop:e$1.wrap?.distT!=null?e(e$1.wrap.distT):void 0,distBottom:e$1.wrap?.distB!=null?e(e$1.wrap.distB):void 0,distLeft:e$1.wrap?.distL!=null?e(e$1.wrap.distL):void 0,distRight:e$1.wrap?.distR!=null?e(e$1.wrap.distR):void 0}}function x(e){return e.anchorTarget==="followingBlock"||s(e)}function P(e){let i=e.position;if(!(!i?.horizontal&&!i?.vertical))return {horizontal:{relativeTo:i.horizontal?.relativeTo??"margin",alignment:i.horizontal?.align,posOffset:i.horizontal?.posOffset},vertical:{relativeTo:i.vertical?.relativeTo??"paragraph",alignment:i.vertical?.align,posOffset:i.vertical?.posOffset}}}function y(e){let i=e.wrapType??(e.displayMode==="float"?"square":"inline");if(!i||i==="inline")return;let t={type:i};return e.wrapText&&(t.wrapText=e.wrapText),e.distTop!=null&&(t.distT=f$1(e.distTop)),e.distBottom!=null&&(t.distB=f$1(e.distBottom)),e.distLeft!=null&&(t.distL=f$1(e.distLeft)),e.distRight!=null&&(t.distR=f$1(e.distRight)),t}function d(e){return e==="inline"?"inline":e==="topAndBottom"?"block":"float"}function s(e){return e.displayMode==="float"||a$1(e.wrapType)}function p(e,i,t){return e==="inline"||e==="topAndBottom"?"none":i==="left"?"right":i==="right"||t==="left"?"left":t==="right"?"right":"none"}function f(e){return {horizontal:e.horizontal?{relativeTo:e.horizontal.relativeTo,posOffset:e.horizontal.posOffset,align:e.horizontal.alignment}:void 0,vertical:e.vertical?{relativeTo:e.vertical.relativeTo,posOffset:e.vertical.posOffset,align:e.vertical.alignment}:void 0}}export{u as a,g as b,a as c,w as d,x as e,P as f,y as g};
|