@eigenpal/docx-editor-core 1.0.2 → 1.1.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/LICENSE +13 -16
- package/README.md +1 -1
- package/dist/agent/index.d.mts +4 -5
- package/dist/agent/index.d.ts +4 -5
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/{chunk-NLTX7XVR.js → chunk-25KY5HLN.js} +1 -1
- package/dist/chunk-44FHVKSI.js +1 -0
- package/dist/{chunk-4S5VOHQK.mjs → chunk-5CDBSK2R.mjs} +1 -1
- package/dist/chunk-6Y6LON6Y.mjs +1 -0
- package/dist/chunk-6ZXL3EIP.mjs +2 -0
- package/dist/chunk-73AZQWIE.js +1 -0
- package/dist/chunk-7HANRHHL.js +1 -0
- package/dist/chunk-7LRR7RKE.mjs +15 -0
- package/dist/{chunk-AGNZEOVL.mjs → chunk-7Z2AGPNQ.mjs} +1 -1
- package/dist/chunk-BGE57OES.js +1 -0
- package/dist/chunk-BOOHU5EW.mjs +1 -0
- package/dist/chunk-CA2EYL6T.mjs +1 -0
- package/dist/chunk-CTHHUJAB.mjs +2 -0
- package/dist/chunk-DLCDDB66.mjs +3 -0
- package/dist/chunk-DV6GWBUJ.js +2 -0
- package/dist/chunk-E4JMCA5X.js +2 -0
- package/dist/chunk-F44ZLDZS.js +4 -0
- package/dist/chunk-FCJWLEKT.mjs +1 -0
- package/dist/chunk-FDEDN2RC.mjs +0 -0
- package/dist/chunk-FEWCI2E5.mjs +1 -0
- package/dist/chunk-GFDIPDJ6.mjs +1 -0
- package/dist/chunk-GM4USWKO.js +2 -0
- package/dist/chunk-GWBVJZVT.js +3 -0
- package/dist/chunk-GY5BWVM7.js +1 -0
- package/dist/{chunk-7SGC3CXJ.js → chunk-H42RXHT4.js} +1 -1
- package/dist/chunk-HMBVSDCH.mjs +1 -0
- package/dist/chunk-HQPWFUP5.js +2 -0
- package/dist/chunk-HV6HE6YR.js +59 -0
- package/dist/chunk-IF4C25FN.mjs +1 -0
- package/dist/chunk-IMKU4O3P.js +1 -0
- package/dist/chunk-IQG3KLWY.mjs +2 -0
- package/dist/{chunk-AFMMYLPX.js → chunk-J4J2Y6EU.js} +2 -2
- package/dist/chunk-KGDXHUYC.js +1 -0
- package/dist/chunk-KHF4JU7D.mjs +1 -0
- package/dist/chunk-LCICADWM.js +2 -0
- package/dist/{chunk-GFQM7PKY.js → chunk-LOCW6MR2.js} +1 -1
- package/dist/chunk-LTHT4A4S.js +1 -0
- package/dist/chunk-MJ6XZFVD.mjs +1 -0
- package/dist/chunk-MNOHUTKE.js +15 -0
- package/dist/chunk-MP4QSEO2.mjs +1 -0
- package/dist/chunk-MZ2XCZAN.mjs +1 -0
- package/dist/chunk-OAWTQ3IY.js +1 -0
- package/dist/chunk-OEXVWIHW.mjs +2 -0
- package/dist/chunk-ONRBRDIC.mjs +59 -0
- package/dist/{chunk-6PR4XHQ3.mjs → chunk-ONWOHAFW.mjs} +1 -1
- package/dist/{chunk-EXOP727C.mjs → chunk-OUEKNYX5.mjs} +1 -1
- package/dist/chunk-OX75Q5ZG.mjs +1 -0
- package/dist/chunk-QEACB5VG.js +1 -0
- package/dist/chunk-RFC2SXZ6.mjs +4 -0
- package/dist/chunk-RFVFX5WK.mjs +1 -0
- package/dist/chunk-SORYYVJ7.js +1 -0
- package/dist/chunk-TUIEV7Q7.js +1 -0
- package/dist/chunk-U74VPTIU.js +1 -0
- package/dist/chunk-UOQT6A7P.js +1 -0
- package/dist/chunk-V5VDCQDN.mjs +1 -0
- package/dist/chunk-VHUVPHPI.mjs +1 -0
- package/dist/{chunk-XCMA7AY7.js → chunk-W7GLQ6DV.js} +1 -1
- package/dist/chunk-WLHNIXWC.mjs +2 -0
- package/dist/chunk-X6HFDXKB.js +1 -0
- package/dist/chunk-XPV6VILW.mjs +1 -0
- package/dist/chunk-Y3ZQQI4D.js +1 -0
- package/dist/chunk-YTDWMXNS.js +1 -0
- package/dist/chunk-ZUGNF5KU.js +1 -0
- package/dist/chunk-ZX26QZJ5.mjs +1 -0
- package/dist/{colorResolver-CVsPLsw1.d.ts → colorResolver-BZ_yScf4.d.ts} +1 -1
- package/dist/{colorResolver-C3q7MLLD.d.mts → colorResolver-C6DtsoFI.d.mts} +1 -1
- package/dist/content-5Mrz6w_b.d.mts +1360 -0
- package/dist/content-CmqAwdFL.d.ts +1360 -0
- package/dist/core-plugins.d.mts +3 -4
- package/dist/core-plugins.d.ts +3 -4
- package/dist/core-plugins.js +1 -1
- package/dist/core-plugins.mjs +1 -1
- package/dist/core.d.mts +10 -11
- package/dist/core.d.ts +10 -11
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{documentSerializer-Chn7J1WG.d.ts → documentSerializer-BRaaXIHm.d.ts} +1 -1
- package/dist/{documentSerializer-C1ueey5d.d.mts → documentSerializer-DgO3A9av.d.mts} +1 -1
- package/dist/docx/index.d.mts +3 -4
- package/dist/docx/index.d.ts +3 -4
- package/dist/docx/index.js +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/parser.d.mts +3 -4
- package/dist/docx/parser.d.ts +3 -4
- package/dist/docx/parser.js +1 -1
- package/dist/docx/parser.mjs +1 -1
- package/dist/docx/rezip.d.mts +3 -4
- package/dist/docx/rezip.d.ts +3 -4
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/rezip.mjs +1 -1
- package/dist/docx/serializer/index.d.mts +4 -5
- package/dist/docx/serializer/index.d.ts +4 -5
- package/dist/docx/serializer/index.js +1 -1
- package/dist/docx/serializer/index.mjs +1 -1
- package/dist/{fontLoader-BOt95Jtf.d.mts → fontLoader-8b4X-AIh.d.mts} +63 -3
- package/dist/{fontLoader-QPwbcX5j.d.ts → fontLoader-CK2QLq68.d.ts} +63 -3
- package/dist/{formatting-D9I-lFS4.d.mts → formatting-BH4hcZiq.d.mts} +1 -1
- package/dist/{formatting-BwpZWdGi.d.ts → formatting-_OXU8gLB.d.ts} +1 -1
- package/dist/{headerFooterLayout-DkclHZ0Z.d.mts → headerFooterLayout-72Vz7yp3.d.mts} +94 -3
- package/dist/{headerFooterLayout-B3QVg556.d.ts → headerFooterLayout-Ca4ESDHF.d.ts} +94 -3
- package/dist/headless.d.mts +9 -9
- package/dist/headless.d.ts +9 -9
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +7 -7
- package/dist/layout-bridge/index.d.ts +7 -7
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +43 -2
- package/dist/layout-bridge/measuring/index.d.ts +43 -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 +11 -3
- package/dist/layout-bridge/toFlowBlocks.d.ts +11 -3
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.d.mts +33 -3
- package/dist/layout-engine/index.d.ts +33 -3
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-engine/types.d.mts +53 -0
- package/dist/layout-engine/types.d.ts +53 -0
- package/dist/layout-painter/index.d.mts +4 -5
- package/dist/layout-painter/index.d.ts +4 -5
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +4 -5
- package/dist/layout-painter/renderPage.d.ts +4 -5
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/managers/AutoSaveManager.d.mts +3 -4
- package/dist/managers/AutoSaveManager.d.ts +3 -4
- package/dist/managers/TableSelectionManager.d.mts +3 -4
- package/dist/managers/TableSelectionManager.d.ts +3 -4
- package/dist/managers/types.d.mts +3 -4
- package/dist/managers/types.d.ts +3 -4
- package/dist/{marks-CCPVlQzL.d.mts → marks-BY573yZn.d.mts} +1 -1
- package/dist/{marks-BujVxYP4.d.ts → marks-CjC9tF5k.d.ts} +1 -1
- package/dist/mcp-cli.mjs +24 -23
- package/dist/mcp.d.mts +3 -4
- package/dist/mcp.d.ts +3 -4
- package/dist/mcp.js +3 -3
- package/dist/mcp.mjs +1 -1
- package/dist/{nodes-BXi1Uu3e.d.mts → nodes-7753Bgi_.d.mts} +66 -3
- package/dist/{nodes-DfKj9kUA.d.ts → nodes-CC_nwkT_.d.ts} +66 -3
- package/dist/prosemirror/commands/formatting.d.mts +2 -2
- package/dist/prosemirror/commands/formatting.d.ts +2 -2
- package/dist/prosemirror/commands/formatting.js +1 -1
- package/dist/prosemirror/commands/formatting.mjs +1 -1
- package/dist/prosemirror/commands/index.d.mts +82 -8
- package/dist/prosemirror/commands/index.d.ts +82 -8
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/index.mjs +1 -1
- package/dist/prosemirror/commands/paragraph.d.mts +1 -1
- package/dist/prosemirror/commands/paragraph.d.ts +1 -1
- package/dist/prosemirror/commands/paragraph.js +1 -1
- package/dist/prosemirror/commands/paragraph.mjs +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
- package/dist/prosemirror/conversion/index.d.mts +11 -4
- package/dist/prosemirror/conversion/index.d.ts +11 -4
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/editor.css +155 -95
- package/dist/prosemirror/extensions/index.d.mts +1 -1
- package/dist/prosemirror/extensions/index.d.ts +1 -1
- package/dist/prosemirror/extensions/index.js +1 -1
- package/dist/prosemirror/extensions/index.mjs +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -1
- package/dist/prosemirror/index.d.mts +5 -6
- package/dist/prosemirror/index.d.ts +5 -6
- package/dist/prosemirror/index.js +1 -1
- package/dist/prosemirror/index.mjs +1 -1
- package/dist/prosemirror/plugins/index.d.mts +122 -18
- package/dist/prosemirror/plugins/index.d.ts +122 -18
- package/dist/prosemirror/plugins/index.js +1 -1
- package/dist/prosemirror/plugins/index.mjs +1 -1
- package/dist/prosemirror/plugins/selectionTracker.d.mts +1 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +1 -1
- package/dist/prosemirror/schema/index.d.mts +4 -5
- package/dist/prosemirror/schema/index.d.ts +4 -5
- package/dist/prosemirror/schema/index.js +1 -1
- package/dist/prosemirror/schema/index.mjs +1 -1
- package/dist/prosemirror/styles/index.d.mts +2 -2
- package/dist/prosemirror/styles/index.d.ts +2 -2
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +45 -23
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +45 -23
- package/dist/prosemirror/utils/extractTrackedChanges.js +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -1
- package/dist/{selectionContext-85CE0f7a.d.ts → selectionContext-BPAqgNgk.d.ts} +1 -1
- package/dist/{selectionContext-Xq3AY7pn.d.mts → selectionContext-CoZat7QZ.d.mts} +1 -1
- package/dist/{styles-jqO45PSq.d.ts → styles-BBv7doYK.d.ts} +1 -1
- package/dist/{styles-BBoqh07F.d.mts → styles-EI2lxeEN.d.mts} +1 -1
- package/dist/types/agentApi.d.mts +1 -1
- package/dist/types/agentApi.d.ts +1 -1
- package/dist/types/content.d.mts +4 -1167
- package/dist/types/content.d.ts +4 -1167
- package/dist/types/document.d.mts +25 -8
- package/dist/types/document.d.ts +25 -8
- package/dist/utils/comments.d.mts +79 -6
- package/dist/utils/comments.d.ts +79 -6
- package/dist/utils/comments.js +1 -1
- package/dist/utils/comments.mjs +1 -1
- package/dist/utils/highlightColors.js +1 -1
- package/dist/utils/highlightColors.mjs +1 -1
- package/dist/utils/index.d.mts +5 -6
- package/dist/utils/index.d.ts +5 -6
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/{variableDetector-CAdt8yOr.d.mts → variableDetector-DF3-nxUC.d.mts} +1 -1
- package/dist/{variableDetector-W4XEN9YC.d.ts → variableDetector-sBkgVh3f.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-2D3UPAMA.mjs +0 -1
- package/dist/chunk-2RCMY2GE.mjs +0 -1
- package/dist/chunk-3GNIP6IX.mjs +0 -4
- package/dist/chunk-44RUAQA2.js +0 -1
- package/dist/chunk-5N5DBQJV.mjs +0 -1
- package/dist/chunk-5TNMVXDS.mjs +0 -1
- package/dist/chunk-6DK4UBGM.js +0 -1
- package/dist/chunk-6LOYA7G5.mjs +0 -2
- package/dist/chunk-7VCMJCBY.js +0 -2
- package/dist/chunk-APFTVA4F.mjs +0 -1
- package/dist/chunk-BKHQA6JJ.js +0 -1
- package/dist/chunk-BOYVCOLZ.mjs +0 -1
- package/dist/chunk-BS35CXMN.js +0 -1
- package/dist/chunk-BTOBVF4I.mjs +0 -1
- package/dist/chunk-C6GSFUV2.js +0 -2
- package/dist/chunk-CP5OSG5Z.mjs +0 -1
- package/dist/chunk-CP767TWV.js +0 -1
- package/dist/chunk-DV6IEOP5.js +0 -4
- package/dist/chunk-IBNUQL57.mjs +0 -2
- package/dist/chunk-KBU6QQFU.js +0 -9
- package/dist/chunk-LDKESXXK.mjs +0 -3
- package/dist/chunk-LTYW3NLX.js +0 -59
- package/dist/chunk-NERY274X.js +0 -1
- package/dist/chunk-NMSU4MWP.mjs +0 -1
- package/dist/chunk-NNQWQOC5.mjs +0 -1
- package/dist/chunk-OLKDLRJ4.js +0 -1
- package/dist/chunk-P3AXSRLG.mjs +0 -1
- package/dist/chunk-P6RNOYAG.mjs +0 -2
- package/dist/chunk-R7RR6M4A.mjs +0 -2
- package/dist/chunk-RCS6UNIJ.mjs +0 -1
- package/dist/chunk-T5RYEG2V.js +0 -1
- package/dist/chunk-TRJWRZZD.js +0 -1
- package/dist/chunk-TYYOBPNK.js +0 -1
- package/dist/chunk-UCZVMHB5.mjs +0 -59
- package/dist/chunk-V435QKZB.js +0 -3
- package/dist/chunk-VQ2QGHYS.js +0 -2
- package/dist/chunk-WZP6ZHBR.js +0 -1
- package/dist/chunk-XDH55WXX.mjs +0 -1
- package/dist/chunk-Y5HZAMND.mjs +0 -9
- package/dist/chunk-YE357WVA.js +0 -1
- package/dist/chunk-YGHHSCPR.js +0 -2
- package/dist/lists-CdiIk_c1.d.ts +0 -142
- package/dist/lists-JDB80qyP.d.mts +0 -142
package/LICENSE
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
to the Licensor or its representatives, including but not limited to
|
|
56
56
|
communication on electronic mailing lists, source code control systems,
|
|
57
57
|
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
59
|
excluding communication that is conspicuously marked or otherwise
|
|
60
60
|
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
61
|
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
|
|
138
138
|
6. Trademarks. This License does not grant permission to use the trade
|
|
139
139
|
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for
|
|
141
|
-
reproducing the content of the NOTICE file.
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
142
|
|
|
143
143
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
144
|
agreed to in writing, Licensor provides the Work (and each
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
other commercial damages or losses), even if such Contributor
|
|
163
163
|
has been advised of the possibility of such damages.
|
|
164
164
|
|
|
165
|
-
9. Accepting Warranty or
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
166
|
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
167
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
168
|
or other liability obligations and/or rights consistent with this
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
of any other Contributor, and only if You agree to indemnify,
|
|
172
172
|
defend, and hold each Contributor harmless for any liability
|
|
173
173
|
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
175
|
|
|
176
176
|
END OF TERMS AND CONDITIONS
|
|
177
177
|
|
|
@@ -181,13 +181,12 @@
|
|
|
181
181
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
182
|
replaced with your own identifying information. (Don't include
|
|
183
183
|
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
to be reproduced in any Derivative Works.
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
189
188
|
|
|
190
|
-
Copyright
|
|
189
|
+
Copyright 2026 EigenPal Inc.
|
|
191
190
|
|
|
192
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
192
|
you may not use this file except in compliance with the License.
|
|
@@ -197,8 +196,6 @@
|
|
|
197
196
|
|
|
198
197
|
Unless required by applicable law or agreed to in writing, software
|
|
199
198
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
PARTICULAR PURPOSE. See the License for the specific language governing
|
|
204
|
-
permissions and limitations under the License.
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.docx-editor.dev/">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/assets/header.png" alt="DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side." width="500" />
|
|
3
|
+
<img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/header.png" alt="DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side." width="500" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
package/dist/agent/index.d.mts
CHANGED
|
@@ -7,15 +7,14 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export { A as AgentContextOptions, S as ContextSelectionOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, e as SelectionContextOptions, f as buildExtendedSelectionContext, g as buildSelectionContext, h as buildSelectionContextFromContext, i as createAgent, j as createAgentFromDocument, k as executeCommand, l as executeCommands, m as getAgentContext, n as getDocumentSummary, o as getSelectionFormattingSummary } from '../selectionContext-
|
|
11
|
-
import { T as TextFormatting } from '../formatting-
|
|
12
|
-
import { DocumentBody, Paragraph, Hyperlink, Run, Table } from '../
|
|
10
|
+
export { A as AgentContextOptions, S as ContextSelectionOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, e as SelectionContextOptions, f as buildExtendedSelectionContext, g as buildSelectionContext, h as buildSelectionContextFromContext, i as createAgent, j as createAgentFromDocument, k as executeCommand, l as executeCommands, m as getAgentContext, n as getDocumentSummary, o as getSelectionFormattingSummary } from '../selectionContext-CoZat7QZ.mjs';
|
|
11
|
+
import { T as TextFormatting } from '../formatting-BH4hcZiq.mjs';
|
|
12
|
+
import { c as DocumentBody, P as Paragraph, H as Hyperlink, R as Run, T as Table } from '../content-5Mrz6w_b.mjs';
|
|
13
13
|
import { Position } from '../types/agentApi.mjs';
|
|
14
14
|
export { AIAction, AIActionRequest, AgentCommand, AgentContext, AgentResponse, SelectionContext as AgentSelectionContext, ApplyStyleCommand, ApplyVariablesCommand, DEFAULT_AI_ACTIONS, DeleteTextCommand, FormatParagraphCommand, FormatTextCommand, InsertHyperlinkCommand, InsertImageCommand, InsertParagraphBreakCommand, InsertTableCommand, InsertTextCommand, MergeParagraphsCommand, ParagraphContext, ParagraphOutline, Range, RemoveHyperlinkCommand, ReplaceTextCommand, SectionInfo, SetVariableCommand, SplitParagraphCommand, StyleInfo, SuggestedAction, comparePositions, createCollapsedRange, createCommand, createRange, getActionDescription, getActionLabel, isPositionInRange } from '../types/agentApi.mjs';
|
|
15
15
|
import '../types/document.mjs';
|
|
16
16
|
import '../colors-C3vA7HUU.mjs';
|
|
17
|
-
import '../
|
|
18
|
-
import '../styles-BBoqh07F.mjs';
|
|
17
|
+
import '../styles-EI2lxeEN.mjs';
|
|
19
18
|
import '../docx/wrapTypes.mjs';
|
|
20
19
|
import '../selectiveSave-jinP_4xa.mjs';
|
|
21
20
|
import '../docxInput-DTbCa48g.mjs';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -7,15 +7,14 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export { A as AgentContextOptions, S as ContextSelectionOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, e as SelectionContextOptions, f as buildExtendedSelectionContext, g as buildSelectionContext, h as buildSelectionContextFromContext, i as createAgent, j as createAgentFromDocument, k as executeCommand, l as executeCommands, m as getAgentContext, n as getDocumentSummary, o as getSelectionFormattingSummary } from '../selectionContext-
|
|
11
|
-
import { T as TextFormatting } from '../formatting-
|
|
12
|
-
import { DocumentBody, Paragraph, Hyperlink, Run, Table } from '../
|
|
10
|
+
export { A as AgentContextOptions, S as ContextSelectionOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, e as SelectionContextOptions, f as buildExtendedSelectionContext, g as buildSelectionContext, h as buildSelectionContextFromContext, i as createAgent, j as createAgentFromDocument, k as executeCommand, l as executeCommands, m as getAgentContext, n as getDocumentSummary, o as getSelectionFormattingSummary } from '../selectionContext-BPAqgNgk.js';
|
|
11
|
+
import { T as TextFormatting } from '../formatting-_OXU8gLB.js';
|
|
12
|
+
import { c as DocumentBody, P as Paragraph, H as Hyperlink, R as Run, T as Table } from '../content-CmqAwdFL.js';
|
|
13
13
|
import { Position } from '../types/agentApi.js';
|
|
14
14
|
export { AIAction, AIActionRequest, AgentCommand, AgentContext, AgentResponse, SelectionContext as AgentSelectionContext, ApplyStyleCommand, ApplyVariablesCommand, DEFAULT_AI_ACTIONS, DeleteTextCommand, FormatParagraphCommand, FormatTextCommand, InsertHyperlinkCommand, InsertImageCommand, InsertParagraphBreakCommand, InsertTableCommand, InsertTextCommand, MergeParagraphsCommand, ParagraphContext, ParagraphOutline, Range, RemoveHyperlinkCommand, ReplaceTextCommand, SectionInfo, SetVariableCommand, SplitParagraphCommand, StyleInfo, SuggestedAction, comparePositions, createCollapsedRange, createCommand, createRange, getActionDescription, getActionLabel, isPositionInRange } from '../types/agentApi.js';
|
|
15
15
|
import '../types/document.js';
|
|
16
16
|
import '../colors-C3vA7HUU.js';
|
|
17
|
-
import '../
|
|
18
|
-
import '../styles-jqO45PSq.js';
|
|
17
|
+
import '../styles-BBv7doYK.js';
|
|
19
18
|
import '../docx/wrapTypes.js';
|
|
20
19
|
import '../selectiveSave-CWaPEv0B.js';
|
|
21
20
|
import '../docxInput-DTbCa48g.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkOCAX2KJQ_js=require('../chunk-OCAX2KJQ.js'),chunkXXU7YQVV_js=require('../chunk-XXU7YQVV.js'),
|
|
1
|
+
'use strict';var chunkOCAX2KJQ_js=require('../chunk-OCAX2KJQ.js'),chunkXXU7YQVV_js=require('../chunk-XXU7YQVV.js'),chunk25KY5HLN_js=require('../chunk-25KY5HLN.js');require('../chunk-UOQT6A7P.js'),require('../chunk-U4UCHBZ7.js');var chunkTE2AF7FM_js=require('../chunk-TE2AF7FM.js');require('../chunk-HV6HE6YR.js'),require('../chunk-GWBVJZVT.js'),require('../chunk-4BFNWPKW.js'),require('../chunk-LCICADWM.js'),require('../chunk-F44ZLDZS.js'),require('../chunk-44FHVKSI.js'),require('../chunk-MNOHUTKE.js'),require('../chunk-MZOVDLYL.js'),require('../chunk-E4JMCA5X.js'),require('../chunk-HQPWFUP5.js'),require('../chunk-DV6GWBUJ.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-Q4CKLXWA.js'),require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.g}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.f}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.v}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.i}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.e}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.h}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.l}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.n}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.c}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.u}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.a}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.t}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.b}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.d}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.k}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.j}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.r}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.q}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.s}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.o}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.m}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkOCAX2KJQ_js.p}});Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkXXU7YQVV_js.g}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkXXU7YQVV_js.d}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkXXU7YQVV_js.a}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkXXU7YQVV_js.h}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkXXU7YQVV_js.b}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkXXU7YQVV_js.f}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkXXU7YQVV_js.e}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkXXU7YQVV_js.c}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunk25KY5HLN_js.a}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunk25KY5HLN_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunk25KY5HLN_js.g}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunk25KY5HLN_js.e}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunk25KY5HLN_js.b}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunk25KY5HLN_js.c}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunk25KY5HLN_js.d}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunk25KY5HLN_js.f}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunk25KY5HLN_js.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkTE2AF7FM_js.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkTE2AF7FM_js.b}});
|
package/dist/agent/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as countCharacters,f as countWords,v as getBlockIndexForParagraph,i as getBodyCharacterCount,e as getBodyText,h as getBodyWordCount,l as getFormattingAtPosition,n as getHyperlinkAtPosition,c as getHyperlinkText,u as getParagraphAtIndex,a as getParagraphText,t as getParagraphs,b as getRunText,d as getTableText,k as getTextAfter,j as getTextBefore,r as hasHyperlinks,q as hasImages,s as hasTables,o as isHeadingStyle,m as isPositionInHyperlink,p as parseHeadingLevel}from'../chunk-FWTP7BN7.mjs';export{g as DEFAULT_AI_ACTIONS,d as comparePositions,a as createCollapsedRange,h as createCommand,b as createRange,f as getActionDescription,e as getActionLabel,c as isPositionInRange}from'../chunk-MVZOTKNL.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,e as buildSelectionContextFromContext,b as createAgent,c as createAgentFromDocument,d as getAgentContext,f as getDocumentSummary,i as getSelectionFormattingSummary}from'../chunk-
|
|
1
|
+
export{g as countCharacters,f as countWords,v as getBlockIndexForParagraph,i as getBodyCharacterCount,e as getBodyText,h as getBodyWordCount,l as getFormattingAtPosition,n as getHyperlinkAtPosition,c as getHyperlinkText,u as getParagraphAtIndex,a as getParagraphText,t as getParagraphs,b as getRunText,d as getTableText,k as getTextAfter,j as getTextBefore,r as hasHyperlinks,q as hasImages,s as hasTables,o as isHeadingStyle,m as isPositionInHyperlink,p as parseHeadingLevel}from'../chunk-FWTP7BN7.mjs';export{g as DEFAULT_AI_ACTIONS,d as comparePositions,a as createCollapsedRange,h as createCommand,b as createRange,f as getActionDescription,e as getActionLabel,c as isPositionInRange}from'../chunk-MVZOTKNL.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,e as buildSelectionContextFromContext,b as createAgent,c as createAgentFromDocument,d as getAgentContext,f as getDocumentSummary,i as getSelectionFormattingSummary}from'../chunk-OUEKNYX5.mjs';import'../chunk-IF4C25FN.mjs';import'../chunk-ARHPXIBJ.mjs';export{a as executeCommand,b as executeCommands}from'../chunk-CUY2THAO.mjs';import'../chunk-ONRBRDIC.mjs';import'../chunk-DLCDDB66.mjs';import'../chunk-3NRMSZX2.mjs';import'../chunk-CTHHUJAB.mjs';import'../chunk-RFC2SXZ6.mjs';import'../chunk-BOOHU5EW.mjs';import'../chunk-7LRR7RKE.mjs';import'../chunk-ILJUDEZ5.mjs';import'../chunk-6ZXL3EIP.mjs';import'../chunk-OEXVWIHW.mjs';import'../chunk-WLHNIXWC.mjs';import'../chunk-LE67NTCN.mjs';import'../chunk-VW22RZ6C.mjs';import'../chunk-VQWZHPWI.mjs';import'../chunk-QYUPLKLP.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkUOQT6A7P_js=require('./chunk-UOQT6A7P.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkHV6HE6YR_js=require('./chunk-HV6HE6YR.js'),chunkLCICADWM_js=require('./chunk-LCICADWM.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var P=class o{constructor(t){chunkDC7S76ZX_js.a(this,"_document");chunkDC7S76ZX_js.a(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let e=await chunkLCICADWM_js.f(t);return new o(e)}static fromDocument(t){return new o(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],e=this._document.package.document;for(let n of e.content)n.type==="paragraph"&&this._extractParagraphSegments(n,t);return t}getVariables(){return chunkU4UCHBZ7_js.a(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let a=r;e.push({id:n,name:a.name||n,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return e}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(n=>n.length>0).length}getCharacterCount(t=true){let e=this.getText();return t?e.length:e.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let e=this._document.package.document,n=e.content.filter(i=>i.type==="paragraph"),r=n.map((i,s)=>{let c=this._getParagraphText(i),p=i.formatting?.styleId;return {index:s,preview:c.slice(0,t),style:p,isHeading:p?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(p),isListItem:!!i.listRendering,isEmpty:c.trim().length===0}}),a=(e.sections||[]).map((i,s)=>({index:s,paragraphCount:i.content?.length||0,pageSize:i.properties?.pageWidth&&i.properties?.pageHeight?{width:i.properties.pageWidth,height:i.properties.pageHeight}:void 0,isLandscape:i.properties?.orientation==="landscape",hasHeader:!!i.properties?.headerReferences?.length,hasFooter:!!i.properties?.footerReferences?.length}));return {paragraphCount:n.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:r,sections:a,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,n={}){let r={type:"insertText",position:t,text:e,formatting:n.formatting};return this._executeCommand(r)}replaceRange(t,e,n={}){let r={type:"replaceText",range:t,text:e,formatting:n.formatting};return this._executeCommand(r)}deleteRange(t){let e={type:"deleteText",range:t};return this._executeCommand(e)}applyFormatting(t,e){let n={type:"formatText",range:t,formatting:e};return this._executeCommand(n)}applyStyle(t,e){let n={type:"applyStyle",paragraphIndex:t,styleId:e};return this._executeCommand(n)}applyParagraphFormatting(t,e){let n={type:"formatParagraph",paragraphIndex:t,formatting:e};return this._executeCommand(n)}insertTable(t,e,n,r={}){let a={type:"insertTable",position:t,rows:e,columns:n,data:r.data,hasHeader:r.hasHeader};return this._executeCommand(a)}insertImage(t,e,n={}){let r={type:"insertImage",position:t,src:e,width:n.width,height:n.height,alt:n.alt};return this._executeCommand(r)}insertHyperlink(t,e,n={}){let r={type:"insertHyperlink",range:t,url:e,displayText:n.displayText,tooltip:n.tooltip};return this._executeCommand(r)}removeHyperlink(t){let e={type:"removeHyperlink",range:t};return this._executeCommand(e)}insertParagraphBreak(t){let e={type:"insertParagraphBreak",position:t};return this._executeCommand(e)}mergeParagraphs(t,e){let n={type:"mergeParagraphs",paragraphIndex:t,count:e};return this._executeCommand(n)}setVariable(t,e){return this._pendingVariables[t]=e,this}setVariables(t){for(let[e,n]of Object.entries(t))this._pendingVariables[e]=n;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let e={...this._pendingVariables,...t};if(Object.keys(e).length===0)return this;let n=this._document.originalBuffer;if(!n)throw new Error("Cannot apply variables: no original buffer for processing");let{processTemplate:r}=await import('./processTemplate-HH2E3HBO.js'),a=r(n,e),i=await chunkLCICADWM_js.f(a),s=new o(i);return s._pendingVariables={},s}async toBuffer(t){if(this._document.originalBuffer){if(t?.selective){let n=await chunkUOQT6A7P_js.c(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await chunkHV6HE6YR_js.h(this._document);return this._document.originalBuffer=e,e}return chunkHV6HE6YR_js.s(this._document)}async toBlob(t="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let e=await this.toBuffer();return new Blob([e],{type:t})}executeCommands(t){return new o(chunkTE2AF7FM_js.b(this._document,t))}_executeCommand(t){let e=new o(chunkTE2AF7FM_js.a(this._document,t));return e._pendingVariables={...this._pendingVariables},e}_getBodyText(t){let e=[];for(let n of t.content)n.type==="paragraph"?e.push(this._getParagraphText(n)):n.type==="table"&&e.push(this._getTableText(n));return e.join(`
|
|
2
2
|
`)}_getParagraphText(t){let e=[];for(let n of t.content)n.type==="run"?e.push(this._getRunText(n)):n.type==="hyperlink"&&e.push(this._getHyperlinkText(n));return e.join("")}_getRunText(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("")}_getHyperlinkText(t){let e=[];for(let n of t.children)n.type==="run"&&e.push(this._getRunText(n));return e.join("")}_getTableText(t){let e=[];for(let n of t.rows)for(let r of n.cells)for(let a of r.content)a.type==="paragraph"&&e.push(this._getParagraphText(a));return e.join(" ")}_extractParagraphSegments(t,e){for(let n of t.content)if(n.type==="run"){let r=this._getRunText(n);r&&e.push({text:r,formatting:n.formatting});}else if(n.type==="hyperlink"){let r=n.href||"";for(let a of n.children)if(a.type==="run"){let i=this._getRunText(a);i&&e.push({text:i,formatting:a.formatting,isHyperlink:true,hyperlinkUrl:r});}}}_parseHeadingLevel(t){if(!t)return;let e=t.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}_hasImages(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="run"){for(let r of n.content)if(r.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="hyperlink")return true}return false}};async function Ct(o){return P.fromBuffer(o)}function kt(o){return P.fromDocument(o)}function M(o,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:n=50}=t,r=o.package.document,a=r.content.filter(y=>y.type==="paragraph"),i=z(a,e,n),s=chunkU4UCHBZ7_js.a(o),c=W(o),p=$(r),u=U(r),d=G(r),f=r.content.some(y=>y.type==="table"),x=K(r),l=N(r);return {paragraphCount:a.length,wordCount:u,characterCount:d,variables:s,variableCount:s.length,availableStyles:c,outline:i,sections:p,hasTables:f,hasImages:x,hasHyperlinks:l}}function At(o,t,e={}){let{contextChars:n=200,includeSuggestions:r=true}=e,i=o.package.document.content.filter(m=>m.type==="paragraph"),s=i[t.start.paragraphIndex];if(!s)throw new Error(`Paragraph not found at index ${t.start.paragraphIndex}`);let c=g(s),p="";if(t.start.paragraphIndex===t.end.paragraphIndex)p=c.slice(t.start.offset,t.end.offset);else {let m=[];for(let b=t.start.paragraphIndex;b<=t.end.paragraphIndex;b++){let H=i[b];if(!H)continue;let _=g(H);b===t.start.paragraphIndex?m.push(_.slice(t.start.offset)):b===t.end.paragraphIndex?m.push(_.slice(0,t.end.offset)):m.push(_);}p=m.join(`
|
|
3
3
|
`);}let u=Y(i,t.start.paragraphIndex,t.start.offset,n),d=Z(i,t.end.paragraphIndex,t.end.offset,n),f=tt(s,t.start.offset),x=s.formatting||{},l={index:t.start.paragraphIndex,fullText:c,style:s.formatting?.styleId,wordCount:v(c)},y=false,A=et(s,t.start.offset),S=r?nt(p):[];return {selectedText:p,range:t,formatting:f,paragraphFormatting:x,textBefore:u,textAfter:d,paragraph:l,inTable:y,inHyperlink:A,suggestedActions:S}}function L(o){let t=M(o,{outlineMaxChars:50,maxOutlineParagraphs:10}),e=[`Document with ${t.paragraphCount} paragraphs, ${t.wordCount} words.`];t.hasTables&&e.push("Contains tables."),t.hasImages&&e.push("Contains images."),t.hasHyperlinks&&e.push("Contains hyperlinks."),t.variableCount>0&&e.push(`Has ${t.variableCount} template variables: ${t.variables.join(", ")}`);let n=t.outline.filter(r=>r.isHeading);if(n.length>0){e.push(`
|
|
4
4
|
Headings:`);for(let r of n.slice(0,5)){let a=r.headingLevel||1;e.push(`${" ".repeat(a-1)}- ${r.preview}`);}n.length>5&&e.push(` ... and ${n.length-5} more headings`);}return e.join(" ")}function z(o,t,e){let n=[];for(let r=0;r<Math.min(o.length,e);r++){let a=o[r],i=g(a),s=a.formatting?.styleId;n.push({index:r,preview:i.slice(0,t),style:s,isHeading:Q(s),headingLevel:X(s),isListItem:!!a.listRendering,isEmpty:i.trim().length===0});}return n}function W(o){let t=o.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let a=r;e.push({id:n,name:a.name||n,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return e}function $(o){return o.sections?o.sections.map((t,e)=>({index:e,paragraphCount:t.content?.length||0,pageSize:t.properties?.pageWidth&&t.properties?.pageHeight?{width:t.properties.pageWidth,height:t.properties.pageHeight}:void 0,isLandscape:t.properties?.orientation==="landscape",hasHeader:!!t.properties?.headerReferences?.length,hasFooter:!!t.properties?.footerReferences?.length})):[]}function U(o){let t=0;for(let e of o.content)if(e.type==="paragraph"){let n=g(e);t+=v(n);}else e.type==="table"&&(t+=q(e));return t}function v(o){return o.split(/\s+/).filter(e=>e.length>0).length}function G(o){let t=0;for(let e of o.content)if(e.type==="paragraph"){let n=g(e);t+=n.length;}else e.type==="table"&&(t+=J(e));return t}function q(o){let t=0;for(let e of o.rows)for(let n of e.cells)for(let r of n.content)if(r.type==="paragraph"){let a=g(r);t+=v(a);}return t}function J(o){let t=0;for(let e of o.rows)for(let n of e.cells)for(let r of n.content)if(r.type==="paragraph"){let a=g(r);t+=a.length;}return t}function g(o){let t=[];for(let e of o.content)e.type==="run"?t.push(T(e)):e.type==="hyperlink"&&t.push(F(e));return t.join("")}function T(o){return o.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function F(o){let t=[];for(let e of o.children)e.type==="run"&&t.push(T(e));return t.join("")}function K(o){for(let t of o.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let n of e.content)if(n.type==="drawing")return true}}return false}function N(o){for(let t of o.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="hyperlink")return true}return false}function Q(o){return o?o.toLowerCase().includes("heading"):false}function X(o){if(!o)return;let t=o.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}function Y(o,t,e,n){let r=[],a=0,i=o[t];if(i){let p=g(i).slice(0,e);r.unshift(p),a+=p.length;}for(let c=t-1;c>=0&&a<n;c--){let p=o[c];if(!p)continue;let u=g(p);r.unshift(u),a+=u.length;}let s=r.join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkDV6GWBUJ_js=require('./chunk-DV6GWBUJ.js');var l=720,s=31680;function p(e){let n=e?chunkDV6GWBUJ_js.c(e):null,o=n?chunkDV6GWBUJ_js.e(n,"w","defaultTabStop"):null,t=o?parseInt(chunkDV6GWBUJ_js.j(o,"w","val")??"",10):NaN;return {defaultTabStop:Number.isFinite(t)&&t>0&&t<=s?t:l}}exports.a=l;exports.b=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-CA2EYL6T.mjs';var e=a.getCommands();function g(t){return e.setAlignment(t)}var l=e.alignLeft(),u=e.alignCenter(),x=e.alignRight(),C=e.alignJustify();function f(t,n="auto"){return e.setLineSpacing(t,n)}var S=e.singleSpacing(),L=e.oneAndHalfSpacing(),b=e.doubleSpacing();function y(t=720){return e.increaseIndent(t)}function v(t=720){return e.decreaseIndent(t)}function A(t){return e.setIndentLeft(t)}function I(t){return e.setIndentRight(t)}function h(t,n){return e.setIndentFirstLine(t,n)}var R=e.toggleBulletList(),T=e.toggleNumberedList(),P=e.increaseListLevel(),B=e.decreaseListLevel(),k=e.removeList();function E(t){return e.setSpaceBefore(t)}function F(t){return e.setSpaceAfter(t)}function H(t,n){return e.applyStyle(t,n)}var J=e.clearStyle();function N(t){return e.insertSectionBreak(t)}var O=e.removeSectionBreak();function M(t,n="left",r="none"){return e.addTabStop(t,n,r)}function j(t){return e.removeTabStop(t)}var q=e.setRtl(),w=e.setLtr(),z=e.generateTOC();export{j as A,q as B,w as C,z as D,g as a,l as b,u as c,x as d,C as e,f,S as g,L as h,b as i,y as j,v as k,A as l,I as m,h as n,R as o,T as p,P as q,B as r,k as s,E as t,F as u,H as v,J as w,N as x,O as y,M as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-FCJWLEKT.mjs';import {c as c$1}from'./chunk-7E5VBRDL.mjs';import {a as a$2}from'./chunk-BOOHU5EW.mjs';import {a,b,c}from'./chunk-QPFJJPIC.mjs';import {a as a$3}from'./chunk-AMENZY5F.mjs';function $(e,t,n,i){let a=e-t-n,r=(i.count-1)*i.gap;return (a-r)/i.count}function ce(e){let t={...e.pageSize},n={...e.margins},i=e.columns??{count:1,gap:0},a=false,r,o,s=[],l=[];function c(){return t.h-n.bottom}function m(){return c()-n.top}function f(){return t.w-n.left-n.right}if(m()<=0)throw new Error("Paginator: page size and margins yield no content area");let S=$(t.w,n.left,n.right,i),T=n.top;function M(h){return n.left+h*(S+i.gap)}function x(){(r||o)&&(r&&(t=r),o&&(n=o),r=void 0,o=void 0,S=$(t.w,n.left,n.right,i));let h=s.length+1,P=n.top,E=c(),g=e.footnoteReservedHeights?.get(h)??0,p=E-g,b={number:h,fragments:[],margins:{...n},size:{...t},footnoteReservedHeight:g>0?g:void 0,columns:i.count>1?{...i}:void 0},d={page:b,cursorY:P,columnIndex:0,topMargin:P,contentBottom:p,trailingSpacing:0};return s.push(b),l.push(d),T=P,e.onNewPage&&e.onNewPage(d),d}function B(){return l.length===0?x():l[l.length-1]}function F(h){return h.contentBottom-h.cursorY}function w(h,P){let E=P||B();return F(E)>=h}function R(h){return h.columnIndex<i.count-1?(h.columnIndex+=1,h.cursorY=T,h.trailingSpacing=0,h):x()}function C(h){let P=B(),E=Number.isFinite(h)&&h>0?h:0;for(;!w(E,P);){let g=P.contentBottom-P.topMargin;if(E>g)return a||(a=true,console.warn(`Paginator: fragment height ${E.toFixed(0)}px exceeds page content height ${g.toFixed(0)}px; placing with overflow.`)),P.cursorY!==P.topMargin&&(P=R(P)),P;P=R(P);}return P}function L(h,P,E=0,g=0){let p=Math.max(E,B().trailingSpacing),b=p+P,d=C(b),y=p,z=M(d.columnIndex),I=d.cursorY+y;return h.x=z,h.y=I,d.page.fragments.push(h),d.cursorY=I+P,d.trailingSpacing=g,{state:d,x:z,y:I}}function u(){if(l.length>0){let h=l[l.length-1];if(h.page.fragments.length===0&&h.cursorY===h.topMargin)return h}return x()}function v(){let h=B();return R(h)}function Z(h){i=h,S=$(t.w,n.left,n.right,i);let P=B();P.page.columns=i.count>1?{...i}:void 0,T=P.cursorY,P.columnIndex=0;}function W(h,P,E=true){if(!E){r=h?{...h}:r,o=P?{...P}:o;return}if(h&&(t={...h}),P&&(n={...P}),m()<=0)throw new Error("Paginator: section page size and margins yield no content area");S=$(t.w,n.left,n.right,i),r=void 0,o=void 0;}return {pages:s,states:l,get columnWidth(){return S},get columns(){return {...i}},getCurrentState:B,getAvailableHeight:()=>F(B()),getContentWidth:f,fits:h=>w(h),ensureFits:C,addFragment:L,forcePageBreak:u,forceColumnBreak:v,getColumnX:M,updateColumns:Z,updatePageLayout:W}}function ge(e){let t=new Map,n=new Set;for(let i=0;i<e.length;i++){if(n.has(i))continue;let a=e[i];if(a.kind!=="paragraph"||!a.attrs?.keepNext)continue;let o=[i],s=i;for(let m=i+1;m<e.length;m++){let f=e[m];if(f.kind==="sectionBreak"||f.kind==="pageBreak"||f.kind==="columnBreak"||f.kind!=="paragraph")break;if(f.attrs?.keepNext)o.push(m),s=m,n.add(m);else break}let l=s+1,c=-1;if(l<e.length){let m=e[l];m.kind!=="sectionBreak"&&m.kind!=="pageBreak"&&m.kind!=="columnBreak"&&(c=l);}t.set(i,{startIndex:i,endIndex:s,memberIndices:o,anchorIndex:c});}return t}function fe(e,t,n){let i=0;for(let a of e.memberIndices){let r=t[a],o=n[a];if(r.kind!=="paragraph"||o.kind!=="paragraph")continue;let s=r,l=o,c=s.attrs?.spacing?.before??0;i+=c,i+=l.totalHeight;let m=s.attrs?.spacing?.after??0;i+=m;}if(e.anchorIndex!==-1){let a=n[e.anchorIndex];if(a?.kind==="paragraph"){let r=a;r.lines.length>0&&(i+=r.lines[0].lineHeight);}}return i}function me(e){let t=new Set;for(let n of e.values())for(let i=1;i<n.memberIndices.length;i++)t.add(n.memberIndices[i]);return t}function $e(e){return e.kind!=="paragraph"?false:e.attrs?.keepLines===true}function pe(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}function q(e){return e.displayMode==="float"||a(e.wrapType)}function qe(e){return q(e)&&!b(e.wrapType)&&e.wrapType!=="topAndBottom"}var Je=1440,de=96,Ce=Je/de,we=11,Le="Calibri",Qe=1,et=.8,tt=.2,j=null;function he(){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 Yt(){j=null;}var Be=new Map;function Re(e){let t=Be.get(e);if(t===void 0){let n=a$3(e);t={cssFallback:n.cssFallback,singleLineRatio:n.singleLineRatio},Be.set(e,t);}return t}function nt(e){return Re(e).cssFallback}function be(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let n=e.fontSize??we,i=N(n);t.push(`${i}px`);let a=e.fontFamily??Le;return t.push(nt(a)),t.join(" ")}function K(e){let t=e.fontSize??we,n=e.fontFamily??Le,i=N(t),a=i*et,r=i*tt,o=i*Qe;try{let l=he();l.font=be(e);let c=l.measureText("Hg");typeof c.actualBoundingBoxAscent=="number"&&typeof c.actualBoundingBoxDescent=="number"&&(a=c.actualBoundingBoxAscent,r=c.actualBoundingBoxDescent);}catch{}o=Math.max(o,a+r);let s=Re(n).singleLineRatio;return {fontSize:t,ascent:a,descent:r,lineHeight:o,fontFamily:n,singleLineRatio:s}}function _(e,t){if(!e)return 0;let n=he();n.font=be(t);let a=n.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function Zt(e,t){let n=_(e,t),i=K(t);return {width:n,height:i.ascent+i.descent,ascent:i.ascent,descent:i.descent}}function ve(e,t){let n=K(t);if(!e)return {width:0,charWidths:[],metrics:n};let i=he();i.font=be(t);let a=t.letterSpacing??0,r=[],o=0;for(let s=0;s<e.length;s++){let l=e[s],m=i.measureText(l).width;a&&s<e.length-1&&(m+=a),r.push(m),o+=m;}return {width:o,charWidths:r,metrics:n}}function Ut(e,t){if(t.length===0||e<=0)return 0;let n=0;for(let i=0;i<t.length;i++){let a=t[i],r=n+a/2;if(e<=r)return i;n+=a;}return t.length}function Xt(e,t){if(e<=0||t.length===0)return 0;let n=Math.min(e,t.length),i=0;for(let a=0;a<n;a++)i+=t[a];return i}function Gt(e){return e/Ce}function jt(e){return Math.round(e*Ce)}function N(e){return e*de/72}function it(e){return e*72/de}function Kt(e){return N(e/2)}function Vt(e){return it(e)*2}function xe(e){return e/1440*96}function Se(e){return e/96*1440}function at(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:i=0}=e,a=t.filter(f=>f.val!=="clear").filter(f=>f.pos>=i),r=t.filter(f=>f.val==="clear").map(f=>f.pos),o=a.reduce((f,S)=>Math.max(f,S.pos),0),s=[...a];i>0&&!a.some(f=>f.pos<=i)&&(r.some(S=>Math.abs(S-i)<20)||s.push({val:"start",pos:i,leader:"none"}));let c=o>0?Math.max(o,i):i,m=i+14400;for(;c<m;){c+=n;let f=a.some(M=>Math.abs(M.pos-c)<20),S=r.some(M=>Math.abs(M-c)<20),T=i>0&&Math.abs(c-i)<20;!f&&!S&&!T&&s.push({val:"start",pos:c,leader:"none"});}return s.sort((f,S)=>f.pos-S.pos)}function Ie(e,t,n={}){let{defaultTabInterval:i=720}=t,a=Se(e),o=at(t).find(c=>c.pos>a);if(!o){let c=xe(i),m=c-e%c;return m<=0&&(m=c),{width:m,alignment:"default"}}let l=xe(o.pos)-e;if(o.val==="center")l-=(n.followingWidth??0)/2;else if(o.val==="end")l-=n.followingWidth??0;else if(o.val==="decimal")l-=n.decimalPrefixWidth??0;else if(o.val==="bar")return {width:0,leader:o.leader,alignment:"bar"};if(l<1){let c=xe(i),m=c-e%c;return m<=0&&(m=c),{width:m,alignment:"default"}}return {width:l,leader:o.leader,alignment:o.val}}var rt="Calibri",ot=11;function st(e){let t=e.attrs,n=e.runs?.find(r=>r.kind==="text"),i=t?.listMarkerFontFamily??n?.fontFamily??t?.defaultFontFamily??rt,a=t?.listMarkerFontSize??n?.fontSize??t?.defaultFontSize??ot;return {fontFamily:i,fontSize:a}}function ke(e){let t=e.attrs;if(!t?.listMarker||t.listMarkerHidden)return 0;let n=t.indent,i=n?.hanging??0;if(i>0)return i;let{fontFamily:a,fontSize:r}=st(e),o={fontFamily:a,fontSize:r},s=_(t.listMarker,o),l=t.listMarkerSuffix??"tab";if(l==="nothing")return s;if(l==="space")return s+_(" ",o);let c=n?.left??0,m=n?.firstLine??0,f=c+m,S=f+s,T=(t.tabs??[]).filter(F=>F.val!=="clear"&&F.val!=="bar").map(F=>a$1(F.pos)).filter(F=>F>=S).sort((F,w)=>F-w)[0],M=a$1(t.defaultTabStopTwips??a$2),x=M>0?(Math.floor(S/M)+1)*M:void 0,B;return T!==void 0&&x!==void 0?B=Math.min(T,x):B=T??x,B===void 0?s+N(r)*.5:B-f}var D=11,X="Calibri",ut=1.15,te=1,Y=.5;function Ee(e,t,n,i=false){let a=1,r=e.length,o=0;for(;a<=r;){let s=a+r>>>1;_(e.slice(0,s),t)<=n?(o=s,a=s+1):r=s-1;}return i&&o===0?1:o}function V(e){return {fontFamily:e.fontFamily??X,fontSize:e.fontSize??D,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Ae(e,t,n){let i=N(e),a=n?.ascent??i*.8,r=n?.descent??i*.2,o=n?.singleLineRatio??1.15,s=i*o,l;if(t?.lineRule==="exact"&&t.line!==void 0)l=t.line;else if(t?.lineRule==="atLeast"&&t.line!==void 0){let c=s*te;l=Math.max(t.line,c);}else t?.line!==void 0&&t?.lineUnit==="multiplier"?l=s*t.line:t?.line!==void 0&&t?.lineUnit==="px"?l=t.line:l=s*te;return {ascent:a,descent:r,lineHeight:l}}function We(e,t,n){let i=K({fontSize:e,fontFamily:n??X}),a=Ae(e,t,i),r=t?.lineRule??"auto";if(r==="auto"||r==="atLeast"){let o=N(e),s=Math.max(a.lineHeight,o*ut);if(s!==a.lineHeight)return {...a,lineHeight:s}}return a}function J(e){return e.kind==="text"}function _e(e){return e.kind==="tab"}function Oe(e){return e.kind==="image"}function ze(e){return e.kind==="lineBreak"}function Ne(e){return e.kind==="field"}function lt(e){return !e.text||e.text.replace(/\u00a0/g," ").trim().length===0}function ct(e,t){let n=0;for(let i=t+1;i<e.length;i++){let a=e[i];if(_e(a)||ze(a))break;if(J(a))n+=_(a.text||"",V(a));else if(Ne(a)){let r={fontFamily:a.fontFamily??X,fontSize:a.fontSize??D,bold:a.bold,italic:a.italic};n+=_(a.fallback||"1",r);}else Oe(a)&&(n+=a.width||0);}return n}function gt(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];(i===" "||i==="-"||i===" ")&&t.push(n+1);}return t}function De(e,t,n){let i=Math.max(1,n),a=Math.max(0,e),r=Math.max(0,t);return a>=i||r>=i||a+r>=i?{leftMargin:0,rightMargin:0}:{leftMargin:a,rightMargin:r}}function ft(e,t,n){let i=e.runs,a=e.attrs,r=a?.spacing,o=n?.floatingZones,s=n?.paragraphYOffset??0,l=a?.indent,c$1=l?.left??0,m=l?.right??0,f=(l?.firstLine??0)-(l?.hanging??0),S=Math.max(1,t-c$1-m),T=(l?.hanging??0)===0?ke(e):0,M=Math.max(1,S-f-T),x=0,B=0,F=N(D)*te,w=(g,p)=>{if(!o||o.length===0)return;let b=s+x,d=He(b,g,o,p,U)-b;d>0&&(x+=d,B+=d);};w(F,M);let R=ee(x,F,o,s),C=Math.max(1,Q(R,M)),L=[];if(i.length===0){if(a?.suppressEmptyParagraphHeight)return L.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,ascent:0,descent:0,lineHeight:0}),{kind:"paragraph",lines:L,totalHeight:0};let g=a?.defaultFontSize??D,p=a?.defaultFontFamily??X,b=We(g,r,p);L.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...b});let d=b.lineHeight;return r?.before&&(d+=r.before),r?.after&&(d+=r.after),{kind:"paragraph",lines:L,totalHeight:d}}if(i.length===1&&J(i[0])&<(i[0])){let g=i[0],p=g.fontSize??a?.defaultFontSize??D,b=g.fontFamily??a?.defaultFontFamily??X,d=We(p,r,b);L.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...d});let y=d.lineHeight;return r?.before&&(y+=r.before),r?.after&&(y+=r.after),{kind:"paragraph",lines:L,totalHeight:y}}let u={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:D,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:C,leftOffset:R.leftMargin,rightOffset:R.rightMargin,segmentZones:R.segments},v=()=>{let g=Ae(u.maxFontSize,r,u.maxFontMetrics),p={...g};if(u.maxImageHeightPx>p.lineHeight){let d=u.maxImageHeightPx,y=p.descent;u.fromRun===u.toRun?(p.lineHeight=d+y*2,p.ascent=d+y):(p.lineHeight=d+y,p.ascent=d);}let b={fromRun:u.fromRun,fromChar:u.fromChar,toRun:u.toRun,toChar:u.toChar,width:u.width,...p};u.leftOffset>0&&(b.leftOffset=u.leftOffset),u.rightOffset>0&&(b.rightOffset=u.rightOffset),u.segmentZones?.length&&(b.segments=Z(b,u.segmentZones)),B>0&&(b.floatSkipBefore=B,B=0),L.push(b),x+=g.lineHeight;},Z=(g,p)=>{let b=p[0],d=p[1];if(!b)return;if(!d||g.width<=b.availableWidth+Y)return [{fromRun:g.fromRun,fromChar:g.fromChar,toRun:g.toRun,toChar:g.toChar,width:g.width,leftOffset:b.leftOffset,availableWidth:b.availableWidth}];if(g.fromRun!==g.toRun)return;let y=i[g.fromRun];if(!y||!J(y))return;let z=y,I=z.text.slice(g.fromChar,g.toChar),H=V(z),k=Ee(I,H,b.availableWidth);if(k<=0||k>=I.length)return;let O=g.fromChar+k,A=I.slice(0,k),ie=I.slice(k);return [{fromRun:g.fromRun,fromChar:g.fromChar,toRun:g.toRun,toChar:O,width:_(A,H),leftOffset:b.leftOffset,availableWidth:b.availableWidth},{fromRun:g.fromRun,fromChar:O,toRun:g.toRun,toChar:g.toChar,width:_(ie,H),leftOffset:d.leftOffset,availableWidth:d.availableWidth}]},W=(g,p)=>{v();let b=N(D)*te;w(b,S);let d=ee(x,b,o,s),y=Math.max(1,Q(d,S));u={fromRun:g,fromChar:p,toRun:g,toChar:p,width:0,maxFontSize:D,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:y,leftOffset:d.leftMargin,rightOffset:d.rightMargin,segmentZones:d.segments};},h=g=>{let p=g.fontSize??D;(!u.maxFontMetrics||p>u.maxFontSize)&&(u.maxFontSize=p,u.maxFontMetrics=K(g));};for(let g=0;g<i.length;g++){let p=i[g];if(ze(p)){u.toRun=g,u.toChar=0,W(g+1,0);continue}if(_e(p)){let b=V(p);h(b);let d=ct(i,g),y=u.width+(u.leftOffset??0),z=L.length===0,I=c$1+(z?f:0)+y,H={explicitStops:a?.tabs,leftIndent:Se(c$1)},k=Ie(I,H,{followingWidth:d}).width;if(y+k>u.availableWidth+Y){let O=u.availableWidth-y-d;O>1&&(k=O);}u.width+k>u.availableWidth+Y&&(W(g,0),h(b)),u.width+=k,u.toRun=g,u.toChar=1;continue}if(Oe(p)){let b=p.wrapType,d=p.displayMode==="float"||c(b);if(p.position&&d){u.toRun=g,u.toChar=1;continue}if(b==="topAndBottom"||p.displayMode==="block"){u.width>0&&W(g,0);let H=p.height,k=p.distTop??6,O=p.distBottom??6;u.toRun=g,u.toChar=1,u.maxImageHeightPx=H+k+O,W(g+1,0);continue}let y=p.width,I=p.height+(p.distTop??0)+(p.distBottom??0);I>u.maxImageHeightPx&&(u.maxImageHeightPx=I),u.width+y>u.availableWidth+Y&&W(g,0),u.width+=y,u.toRun=g,u.toChar=1;continue}if(Ne(p)){let b=p.fallback||"1",d={fontFamily:p.fontFamily??X,fontSize:p.fontSize??D,bold:p.bold,italic:p.italic};h(d);let y=_(b,d);u.width>0&&u.width+y>u.availableWidth+Y&&(W(g,0),h(d)),u.width+=y,u.toRun=g,u.toChar=1;continue}if(J(p)){let b=p,d=b.text,y=V(b);if(h(y),!d||d.length===0){u.toRun=g,u.toChar=0;continue}let z=gt(d),I=0;for(;I<d.length;){let H=d.length;for(let A of z)if(A>I){H=A;break}let k=d.slice(I,H),O=_(k,y);if(O>u.availableWidth+Y){let A=0;for(;A<k.length;){let ie=u.availableWidth-u.width+Y,je=k.slice(A),ae=Ee(je,y,ie);if(ae===0){if(u.width>0){W(g,I+A),h(y);continue}ae=1;}let re=A+ae,Ke=k.slice(A,re),Ve=_(Ke,y);u.width+=Ve,u.toRun=g,u.toChar=I+re,A=re,A<k.length&&(W(g,I+A),h(y));}I=H;continue}u.width>0&&u.width+O>u.availableWidth+Y&&(W(g,I),h(y)),u.width+=O,u.toRun=g,u.toChar=H,I=H;}}}v();let E=L.reduce((g,p)=>g+p.lineHeight+(p.floatSkipBefore??0),0);return r?.before&&(E+=r.before),r?.after&&(E+=r.after),{kind:"paragraph",lines:L,totalHeight:E}}function ln(e,t){return e.map(n=>ft(n,t))}function cn(e){let t=V(e);return ve(e.text,t).charWidths}function mn(e,t){return e.map(n=>{let i=n.x-n.distLeft,a=n.x+n.width+n.distRight,r=n.y-n.distTop,o=n.y+n.height+n.distBottom,s=0,l=0,c,m=n.wrapText??"bothSides";m==="right"?s=Me(a):m==="left"?l=Te(i,t):m==="largest"?{leftMargin:s,rightMargin:l}=ht(i,a,t):pt(i,a,t)?c=dt(i,a,t):n.side==="left"?s=Me(a):l=Te(i,t);let f=De(s,l,t);return {leftMargin:f.leftMargin,rightMargin:f.rightMargin,topY:r,bottomY:o,segments:c}})}function Q(e,t){return e.segments?.reduce((i,a)=>i+a.availableWidth,0)??t-e.leftMargin-e.rightMargin}function ee(e,t,n,i){if(!n||n.length===0)return {leftMargin:0,rightMargin:0};let a=0,r=0,o,s=i+e,l=s+t;for(let c of n)if(!(l<=c.topY||s>=c.bottomY)){if(c.segments?.length){o=o?mt(o,c.segments):c.segments;continue}a=Math.max(a,c.leftMargin),r=Math.max(r,c.rightMargin);}return {leftMargin:a,rightMargin:r,segments:o}}function He(e,t,n,i,a){if(!n||n.length===0)return e;let r=e;for(let o=0;o<n.length+2;o++){let s=ee(r,t,n,0);if(Q(s,i)>=a)return r;let c=r+t,m=1/0;for(let f of n)c<=f.topY||r>=f.bottomY||f.bottomY>r&&f.bottomY<m&&(m=f.bottomY);if(!Number.isFinite(m)||m<=r)return r;r=m;}return r}function mt(e,t){let n=[];for(let i of e)for(let a of t){let r=Math.max(i.leftOffset,a.leftOffset),o=Math.min(i.leftOffset+i.availableWidth,a.leftOffset+a.availableWidth);o>r&&n.push({leftOffset:r,availableWidth:o-r});}return n}var U=24;function pt(e,t,n){return e>U&&t+U<n}function dt(e,t,n){return [{leftOffset:0,availableWidth:Math.max(0,e)},{leftOffset:Math.max(0,t),availableWidth:Math.max(0,n-t)}].filter(i=>i.availableWidth>1)}function ht(e,t,n){let i=Math.max(0,e);return Math.max(0,n-t)>=i?{leftMargin:Me(t),rightMargin:0}:{leftMargin:0,rightMargin:Te(e,n)}}function Me(e){return Math.max(0,e)}function Te(e,t){return Math.max(0,t-e)}var Ye={count:1,gap:0};function bt(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}:{...Ye},pendingColumns:null,activeOrientation:null,pendingOrientation:null,hasAnyPages:false}}function xt(e,t){return t.count>1}function ne(e){return e?{count:e.count,gap:e.gap}:{...Ye}}function St(e,t,n){let i={...t},a=e.type??"continuous",r=e.margins,o=e.pageSize,s=e.orientation;r&&(typeof r.top=="number"&&(i.pendingTopMargin=Math.max(0,r.top)),typeof r.bottom=="number"&&(i.pendingBottomMargin=Math.max(0,r.bottom)),typeof r.left=="number"&&(i.pendingLeftMargin=Math.max(0,r.left)),typeof r.right=="number"&&(i.pendingRightMargin=Math.max(0,r.right))),o&&(i.pendingPageSize={w:o.w,h:o.h}),s&&(i.pendingOrientation=s);let l=xt((e.margins,void 0),i.activeColumns);switch(a){case "nextPage":return i.pendingColumns=ne(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false},state:i};case "evenPage":return i.pendingColumns=ne(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false,requiredParity:"even"},state:i};case "oddPage":return i.pendingColumns=ne(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false,requiredParity:"odd"},state:i};default:return l?(i.pendingColumns=ne(void 0),{decision:{forcePageBreak:false,forceMidPageRegion:true},state:i}):{decision:{forcePageBreak:false,forceMidPageRegion:false},state:i}}}function Mt(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 Tt(e){return {top:e.pendingTopMargin??e.activeTopMargin,bottom:e.pendingBottomMargin??e.activeBottomMargin,left:e.pendingLeftMargin??e.activeLeftMargin,right:e.pendingRightMargin??e.activeRightMargin}}function yt(e){return e.pendingPageSize??e.activePageSize}function Pt(e){return e.pendingColumns??e.activeColumns}function Ft(e,t){for(let n=0;n<e.pages.length;n++)for(let i of e.pages[n].fragments){if(i.pmStart==null)continue;let a=i.pmStart,r=i.pmEnd??a+1;if(t>=a&&t<r)return n}return null}var Bt={w:816,h:1056},G={top:96,right:96,bottom:96,left:96},Xe={count:1,gap:0};function Ct(e,t,n){let i=[],a=[],r=t;for(let o=0;o<e.length;o++){if(e[o].kind!=="sectionBreak")continue;let s=e[o],l={pageSize:s.pageSize??r.pageSize,margins:s.margins??r.margins,columns:s.columns};i.push(l),a.push(o),r=l;}return i.push(n),{configs:i,breakIndices:a}}function Ge(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 Ze(e){let t=e.attrs?.spacing?.before??0;return Ge(e)&&!e.attrs?.spacingExplicit?.before?0:t}function Ue(e){let t=e.attrs?.spacing?.after??0;return Ge(e)&&!e.attrs?.spacingExplicit?.after?0:t}function wt(e){for(let t=0;t<e.length-1;t++){let n=e[t],i=e[t+1];if(n.kind!=="paragraph"||i.kind!=="paragraph")continue;let a=n.attrs,r=i.attrs;a?.contextualSpacing&&r?.contextualSpacing&&a.styleId&&a.styleId===r.styleId&&(a.spacing&&(a.spacing={...a.spacing,after:0}),r.spacing&&(r.spacing={...r.spacing,before:0}));}}function yn(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let i=n.pageSize??Bt,a={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 r={...a},o=n.finalPageSize??i,s=n.finalMargins??r;if(i.w-r.left-r.right<=0)throw new Error("layoutDocument: page size and margins yield no content area");let c={pageSize:i,margins:r,columns:n.columns},m={pageSize:o,margins:s,columns:n.columns},{configs:f,breakIndices:S}=Ct(e,c,m),T=[...S.map(R=>e[R].type),n.bodyBreakType],M=f[0]??c,x=ce({pageSize:M.pageSize,margins:M.margins,columns:M.columns??Xe,footnoteReservedHeights:n.footnoteReservedHeights});wt(e);let B=ge(e),F=me(B),w=0;for(let R=0;R<e.length;R++){let C=e[R],L=t[R];pe(C)&&x.forcePageBreak();let u=B.get(R);if(u&&!F.has(R)){let v=fe(u,e,t),Z=x.getCurrentState(),W=x.getAvailableHeight(),h=Z.contentBottom-Z.topMargin;v<=h&&v>W&&Z.page.fragments.length>0&&x.forcePageBreak();}switch(C.kind){case "paragraph":Lt(C,L,x,x.getContentWidth());break;case "table":C.floating?kt(C,L,x,x.getContentWidth()):It(C,L,x);break;case "image":Et(C,L,x);break;case "textBox":Ht(C,L,x);break;case "pageBreak":x.forcePageBreak();break;case "columnBreak":x.forceColumnBreak();break;case "sectionBreak":{let v=T[w+1]??T[w];At(C,x,f[w+1]??M,v),w++;break}default:c$1(C,"runLayoutPipeline");}}return x.pages.length===0&&x.getCurrentState(),{pageSize:i,pages:x.pages,columns:n.columns,pageGap:n.pageGap}}function Lt(e,t,n,i){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let a=t.lines;if(a.length===0){let l=Ze(e),c=Ue(e),m=n.getCurrentState(),f={kind:"paragraph",blockId:e.id,x:n.getColumnX(m.columnIndex),y:m.cursorY+l,width:i,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(f,0,l,c);return}let r=Ze(e),o=Ue(e),s=0;for(;s<a.length;){let l=n.getCurrentState(),c=n.getAvailableHeight(),m=0,f=0;for(let w=s;w<a.length;w++){let R=a[w].lineHeight+(a[w].floatSkipBefore??0),C=m+R;if((s===0&&w===s?C+r:C)<=c||f===0)m=C,f++;else break}let S=s===0,T=s+f>=a.length,M=S?r:0,x=T?o:0,B={kind:"paragraph",blockId:e.id,x:n.getColumnX(l.columnIndex),y:0,width:i,height:m,fromLine:s,toLine:s+f,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!S,continuesOnNext:!T},F=n.addFragment(B,m,M,x);B.y=F.y,s+=f,s<a.length&&n.ensureFits(a[s].lineHeight);}}function Rt(e){let t=0;for(let n of e.rows)if(n.isHeader)t++;else break;return t}function vt(e,t){let n=0;for(let i=0;i<t&&i<e.rows.length;i++)n+=e.rows[i].height;return n}function It(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let i=t.rows;if(i.length===0)return;let a=Rt(e),r=vt(t,a),o=0;for(;o<i.length;){let s=n.getCurrentState(),l=n.getAvailableHeight(),c=o===0,m=c?s.trailingSpacing:0,f=l-m,S=!c&&a>0?r:0,T=0,M=0;for(let C=o;C<i.length;C++){let L=i[C].height;if(T+L+S<=f||M===0)T+=L,M++;else break}let x=T+S,B=o+M>=i.length,F=n.getColumnX(s.columnIndex);e.justification==="center"?F=F+(n.columnWidth-t.totalWidth)/2:e.justification==="right"?F=F+n.columnWidth-t.totalWidth:e.indent&&(F+=e.indent);let w={kind:"table",blockId:e.id,x:F,y:0,width:t.totalWidth,height:x,fromRow:o,toRow:o+M,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!c,continuesOnNext:!B,headerRowCount:!c&&a>0?a:void 0},R=n.addFragment(w,x,0,0);if(w.y=R.y,w.x=F,o+=M,o<i.length){let C=i[o].height+(a>0?r:0);n.ensureFits(C);}}}function kt(e,t,n,i){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let a=n.getCurrentState(),r=e.floating,o=a.page,s=o.margins,l=t.totalWidth,c=t.totalHeight,m=o.size.h-s.top-s.bottom,f=s.left,S=s.top;r?.horzAnchor==="page"&&(f=0),r?.vertAnchor==="page"&&(S=0),r?.vertAnchor==="text"&&(S=a.cursorY);let T=n.getColumnX(a.columnIndex);if(r?.tblpX!==void 0)T=f+r.tblpX;else if(r?.tblpXSpec){let v=r.tblpXSpec;v==="left"||v==="inside"?T=f:v==="right"||v==="outside"?T=f+i-l:v==="center"&&(T=f+(i-l)/2);}else e.justification==="center"?T=f+(i-l)/2:e.justification==="right"&&(T=f+i-l);let M=a.cursorY,x=false;if(r?.tblpY!==void 0)M=S+r.tblpY,x=true;else if(r?.tblpYSpec){x=true;let v=r.tblpYSpec;v==="top"?M=S:v==="bottom"?M=S+m-c:v==="center"&&(M=S+(m-c)/2);}x||(M=n.ensureFits(c).cursorY);let B=s.left,F=s.left+i-l;Number.isFinite(F)&&(T=Math.max(B,Math.min(T,F)));let w={kind:"table",blockId:e.id,x:T,y:M,width:l,height:c,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};a.page.fragments.push(w);let R=r?.leftFromText??0,C=r?.rightFromText??0,L=T-s.left-R,u=s.left+i-(T+l)-C;if(L<U&&u<U){let v=M+c+(r?.bottomFromText??0);v>a.cursorY&&(a.cursorY=v);}}function Et(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Wt(e,t,n);return}let i=n.ensureFits(t.height),a={kind:"image",blockId:e.id,x:n.getColumnX(i.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},r=n.addFragment(a,t.height,0,0);a.y=r.y;}function Wt(e,t,n){let i=n.getCurrentState(),a=e.anchor,r=a.offsetH??n.getColumnX(i.columnIndex),o=a.offsetV??i.cursorY,s={kind:"image",blockId:e.id,x:r,y:o,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:a.behindDoc?-1:1};i.page.fragments.push(s);}function Ht(e,t,n){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");if(q(e)){let o=n.getCurrentState(),s={kind:"textBox",blockId:e.id,x:n.getColumnX(o.columnIndex),y:o.cursorY,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true,zIndex:e.wrapType==="behind"?-1:1};o.page.fragments.push(s);return}let i=n.ensureFits(t.height),a={kind:"textBox",blockId:e.id,x:n.getColumnX(i.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},r=n.addFragment(a,t.height,0,0);a.y=r.y;}function At(e,t,n,i){switch(i??"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??Xe);}export{fe as A,me as B,$e as C,pe as D,q as E,qe as F,bt as G,St as H,Mt as I,Tt as J,yt as K,Pt as L,Ft as M,Ct as N,yn as O,vt as P,he as a,Yt as b,be as c,K as d,_ as e,Zt as f,ve as g,Ut as h,Xt as i,Gt as j,jt as k,N as l,it as m,Kt as n,Vt as o,mn as p,ee as q,Ie as r,st as s,ke as t,De as u,ft as v,ln as w,cn as x,ce as y,ge as z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {d}from'./chunk-OEXVWIHW.mjs';import {i,j,h,l,g,k as k$1,e as e$1}from'./chunk-WLHNIXWC.mjs';import {e}from'./chunk-VW22RZ6C.mjs';var pe={accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",tx1:"text1",tx2:"text2",bg1:"background1",bg2:"background2",hlink:"hlink",folHlink:"folHlink"},G={black:"000000",white:"FFFFFF",red:"FF0000",green:"00FF00",blue:"0000FF",yellow:"FFFF00",cyan:"00FFFF",magenta:"FF00FF"};function J(e,n){let t=i(n),i$1=t.find(r=>r.name==="a:shade");if(i$1){let r=j(i$1,null,"val");r&&(e.themeShade=Math.round(parseInt(r,10)/1e5*255).toString(16).padStart(2,"0").toUpperCase());}let o=t.find(r=>r.name==="a:tint");if(o){let r=j(o,null,"val");r&&(e.themeTint=Math.round(parseInt(r,10)/1e5*255).toString(16).padStart(2,"0").toUpperCase());}return e}function K(e){if(!e)return;let n=i(e),t=n.find(l=>l.name==="a:srgbClr");if(t){let l=j(t,null,"val");if(l)return J({rgb:l},t)}let i$1=n.find(l=>l.name==="a:schemeClr");if(i$1){let l=j(i$1,null,"val");if(l){let u={themeColor:pe[l]??"dk1"};return J(u,i$1)}}let o=n.find(l=>l.name==="a:sysClr");if(o)return {rgb:j(o,null,"lastClr")??"000000"};let r=n.find(l=>l.name==="a:prstClr");if(r){let l=j(r,null,"val");if(l&&G[l])return {rgb:G[l]}}}function N(e){if(!e)return;let n=i(e);if(n.find(i=>i.name==="a:noFill"))return {type:"none"};let t=n.find(i=>i.name==="a:solidFill");if(t)return {type:"solid",color:K(t)};if(n.find(i=>i.name==="a:gradFill"))return {type:"gradient"}}function S(e){let n=e?h(e,"a:ln"):null;if(!n)return;let t=i(n);if(t.find(u=>u.name==="a:noFill"))return;let i$1={},o=j(n,null,"w");o&&(i$1.width=parseInt(o,10));let r=t.find(u=>u.name==="a:solidFill");r&&(i$1.color=K(r));let l=t.find(u=>u.name==="a:prstDash");if(l){let u=j(l,null,"val");u&&(i$1.style=u);}return i$1}function L(e){if(!e)return;let n=j(e,null,"relativeFrom")??"column",t=h(e,"wp:align");if(t){let o=k$1(t);return {relativeTo:n,alignment:o}}let i=h(e,"wp:posOffset");if(i){let o=k$1(i),r=parseInt(o,10);return {relativeTo:n,posOffset:isNaN(r)?0:r}}return {relativeTo:n}}function z(e){if(!e)return;let n=j(e,null,"relativeFrom")??"paragraph",t=h(e,"wp:align");if(t){let o=k$1(t);return {relativeTo:n,alignment:o}}let i=h(e,"wp:posOffset");if(i){let o=k$1(i),r=parseInt(o,10);return {relativeTo:n,posOffset:isNaN(r)?0:r}}return {relativeTo:n}}function Q(e){let n=h(e,"wp:positionH"),t=h(e,"wp:positionV");if(!(!n&&!t))return {horizontal:L(n)??{relativeTo:"column"},vertical:z(t)??{relativeTo:"paragraph"}}}var W=["wp:wrapNone","wp:wrapSquare","wp:wrapTight","wp:wrapThrough","wp:wrapTopAndBottom"];function D(e,n,t){if(!e){let p={type:n?"behind":"inFront"};return t?.distT!==void 0&&(p.distT=t.distT),t?.distB!==void 0&&(p.distB=t.distB),t?.distL!==void 0&&(p.distL=t.distL),t?.distR!==void 0&&(p.distR=t.distR),p}let o=(e.name||"").replace("wp:",""),r;switch(o){case "wrapNone":r=n?"behind":"inFront";break;case "wrapSquare":r="square";break;case "wrapTight":r="tight";break;case "wrapThrough":r="through";break;case "wrapTopAndBottom":r="topAndBottom";break;default:r="square";}let l$1={type:r},u=j(e,null,"wrapText");u&&(l$1.wrapText=u);let s=l(e,null,"distT")??t?.distT,c=l(e,null,"distB")??t?.distB,m=l(e,null,"distL")??t?.distL,g=l(e,null,"distR")??t?.distR;return s!==void 0&&(l$1.distT=s),c!==void 0&&(l$1.distB=c),m!==void 0&&(l$1.distL=m),g!==void 0&&(l$1.distR=g),l$1}function Y(e){let n=i(e),t=j(e,null,"behindDoc")==="1",i$1=n.find(r=>W.includes(r.name??"")),o={distT:l(e,null,"distT")??void 0,distB:l(e,null,"distB")??void 0,distL:l(e,null,"distL")??void 0,distR:l(e,null,"distR")??void 0};return D(i$1??null,t,o)}var ce={accent1:"5B9BD5",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"4472C4",accent6:"70AD47",dk1:"000000",lt1:"FFFFFF",dk2:"1F497D",lt2:"EEECE1",text1:"000000",text2:"1F497D",background1:"FFFFFF",background2:"EEECE1",hlink:"0563C1",folHlink:"954F72"};function H(e){if(e){if(e.rgb)return `#${e.rgb}`;if(e.themeColor)return `#${ce[e.themeColor]??"000000"}`}}var k=91440;function Z(e){if(!e)return {};let n={},t=l(e,null,"lIns"),i=l(e,null,"rIns"),o=l(e,null,"tIns"),r=l(e,null,"bIns");return (t!==void 0||i!==void 0||o!==void 0||r!==void 0)&&(n.margins={left:t,right:i,top:o,bottom:r}),n}function ve(e){if(!e)return {paragraphElements:[],tableElements:[]};let n=g(e,"p"),t=g(e,"tbl");return {paragraphElements:n,tableElements:t}}function Be(e,n,t,i$1,o,r,l,u){if(!e)return [];let s=[],c=i(e);for(let m of c){let g=m.name||"",p=g.indexOf(":"),T=p>=0?g.substring(p+1):g;if(T==="p"){let b=n(m,i$1,o,r,l);s.push(b);}}return s}function ee(e){let t=i(e).find(u=>u.name==="wp:inline"||u.name==="wp:anchor");if(!t)return false;let i$1=h(t,"a:graphic");if(!i$1)return false;let o=h(i$1,"a:graphicData");if(!o)return false;let r=h(o,"wps:wsp");return r?h(r,"wps:txbx")!==null:false}function Ce(e){return h(e,"wps:txbx")!==null}function Me(e){let t=i(e).find(x=>x.name==="wp:inline"||x.name==="wp:anchor");if(!t)return null;let i$1=t.name==="wp:anchor",o=h(t,"a:graphic");if(!o)return null;let r=h(o,"a:graphicData");if(!r)return null;let l$1=h(r,"wps:wsp");if(!l$1||!h(l$1,"wps:txbx"))return null;let s=i(l$1),c=s.find(x=>x.name==="wps:spPr"),m=s.find(x=>x.name==="wps:bodyPr"),g=h(t,"wp:extent"),p=l(g,null,"cx")??0,T=l(g,null,"cy")??0,b={width:p,height:T},C=h(t,"wp:docPr"),P=C?j(C,null,"id")??void 0:void 0,v=N(c??null),B=S(c??null),E=Z(m??null),y={type:"textBox",size:b,content:[]};if(P&&(y.id=P),v&&(y.fill=v),B&&(y.outline=B),E.margins&&(y.margins=E.margins),i$1){let x=Q(t);x&&(y.position=x);let h=Y(t);h&&(y.wrap=h);}return y}function Re(e){let n=h(e,"wps:txbx");return n?h(n,"w:txbxContent"):null}function Xe(e,n,t,i$1){if(!h(e,"wps:txbx"))return null;let r=i(e),l=r.find(b=>b.name==="wps:spPr"),u=r.find(b=>b.name==="wps:bodyPr"),s=r.find(b=>b.name==="wps:cNvPr"),c=s?j(s,null,"id")??void 0:void 0,m=N(l??null),g=S(l??null),p=Z(u??null),T={type:"textBox",size:n,content:[]};return c&&(T.id=c),m&&(T.fill=m),g&&(T.outline=g),p.margins&&(T.margins=p.margins),t&&(T.position=t),i$1&&(T.wrap=i$1),T}function ke(e$1){return e(e$1.size.width)}function Ae(e$1){return e(e$1.size.height)}function Oe(e$1){return {width:e(e$1.size.width),height:e(e$1.size.height)}}function Ne(e$1){let n=e$1.margins;return {top:e(n?.top??k),bottom:e(n?.bottom??k),left:e(n?.left??k),right:e(n?.right??k)}}function Se(e){return e.position!==void 0||e.wrap!==void 0}function Le(e){return e.fill!==void 0&&e.fill.type!=="none"}function ze(e){return e.outline!==void 0}function We(e){return e.content.length>0}function De(e){let n=[];for(let t of e.content){let i=[];for(let o of t.content)if(o.type==="run")for(let r of o.content)r.type==="text"&&i.push(r.text);n.push(i.join(""));}return n.join(`
|
|
2
|
+
`)}function He(e){if(!(!e.fill||e.fill.type!=="solid"))return H(e.fill.color)}function Ve(e){if(e.outline?.color)return H(e.outline.color)}function _e(e$1){return e$1.outline?.width?e(e$1.outline.width):0}function me(e){if(!e)return;let n=parseInt(e,10);if(!isNaN(n))return n/6e4}function ge(e,n){let t=i(e);for(let i of t)if(n.includes(i.name||""))return i;return null}function ne(e){if(!e)return {width:0,height:0};let n=l(e,null,"cx")??0,t=l(e,null,"cy")??0;return {width:n,height:t}}function te(e){if(!e)return;let n=l(e,null,"l")??0,t=l(e,null,"t")??0,i=l(e,null,"r")??0,o=l(e,null,"b")??0;if(!(n===0&&t===0&&i===0&&o===0))return {left:n,top:t,right:i,bottom:o}}function ie(e){if(!e)return {};let n=j(e,null,"id")??void 0,t=j(e,null,"name")??void 0,i=j(e,null,"descr")??void 0,o=j(e,null,"title")??void 0,r=j(e,null,"decorative")==="1",l=e$1(e,"a","hlinkClick"),u=l?j(l,"r","id")??void 0:void 0;return {id:n,name:t,alt:i,title:o,decorative:r||void 0,hlinkRId:u}}function re(e){if(!e)return;let n=j(e,null,"rot"),t=j(e,null,"flipH")==="1",i=j(e,null,"flipV")==="1",o=me(n);if(o===void 0&&!t&&!i)return;let r={};return o!==void 0&&(r.rotation=o),t&&(r.flipH=true),i&&(r.flipV=true),r}function oe(e){let n=h(e,"a:graphic");if(!n)return {blipFill:null,blip:null};let t=h(n,"a:graphicData");if(!t)return {blipFill:null,blip:null};let i=h(t,"pic:pic");if(!i)return {blipFill:null,blip:null};let o=h(i,"pic:blipFill");return o?{blipFill:o,blip:h(o,"a:blip")}:{blipFill:null,blip:null}}function le(e){if(!e)return;let n=h(e,"a:srcRect");if(!n)return;let t=s=>{let c=l(n,null,s);if(!(c===void 0||c===0))return c/1e5},i=t("l"),o=t("t"),r=t("r"),l$1=t("b");if(i===void 0&&o===void 0&&r===void 0&&l$1===void 0)return;let u={};return i!==void 0&&(u.left=i),o!==void 0&&(u.top=o),r!==void 0&&(u.right=r),l$1!==void 0&&(u.bottom=l$1),u}function ae(e){if(!e)return;let n=h(e,"a:alphaModFix");if(!n)return;let t=l(n,null,"amt");if(!(t===void 0||t>=1e5))return Math.max(0,Math.min(1,t/1e5))}function se(e){if(!e)return "";let n=j(e,"r","embed");if(n)return n;let t=j(e,null,"embed");if(t)return t;let i=j(e,"r","link");return i||""}function ue(e){let n=h(e,"a:graphic");if(!n)return null;let t=h(n,"a:graphicData");if(!t)return null;let i=h(t,"pic:pic");if(!i)return null;let o=h(i,"pic:spPr");return o?h(o,"a:xfrm"):null}function xe(e){if(!e)return e;let n=e.replace(/^\/+/,"");return n.startsWith("media/")?n=`word/${n}`:n.startsWith("word/")||(n=`word/${n}`),n}function he(e){let n=e.split(".").pop()?.toLowerCase()??"";return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"}[n]??"application/octet-stream"}function de(e,n,t){if(!e||!n)return {};let i=n.get(e);if(!i)return {};let o=i.target;if(!o)return {};let r=xe(o),l=o.split("/").pop(),u=(s,c)=>{let m=c.toLowerCase();for(let[g,p]of s.entries())if(g.toLowerCase()===m)return p};if(t){let s=u(t,r);if(s)return {src:s.dataUrl||s.base64,mimeType:s.mimeType,filename:l};let c=o.replace(/^\/+/,""),m=u(t,c);if(m)return {src:m.dataUrl||m.base64,mimeType:m.mimeType,filename:l};let g=`word/${c}`,p=u(t,g);if(p)return {src:p.dataUrl||p.base64,mimeType:p.mimeType,filename:l}}return {mimeType:he(o),filename:l}}function Te(e,n,t){let i=h(e,"wp:extent"),o=ne(i),r=h(e,"wp:effectExtent"),l$1=te(r),u=h(e,"wp:docPr"),s=ie(u),{blip:c,blipFill:m}=oe(e),g=se(c),p=le(m),T=ae(c),b=de(g,n,t),C=ue(e),P=re(C),v=l(e,null,"distT")??void 0,B=l(e,null,"distB")??void 0,E=l(e,null,"distL")??void 0,y=l(e,null,"distR")??void 0,x={type:"inline"};v!==void 0&&(x.distT=v),B!==void 0&&(x.distB=B),E!==void 0&&(x.distL=E),y!==void 0&&(x.distR=y);let h$1={type:"image",rId:g,size:o,wrap:x};if(s.id&&(h$1.id=s.id),s.alt&&(h$1.alt=s.alt),s.title&&(h$1.title=s.title),s.decorative&&(h$1.decorative=true),b.src&&(h$1.src=b.src),b.mimeType&&(h$1.mimeType=b.mimeType),b.filename&&(h$1.filename=b.filename),l$1&&(h$1.padding=l$1),P&&(h$1.transform=P),p&&(h$1.crop=p),T!==void 0&&(h$1.opacity=T),s.hlinkRId&&n){let X=d(n,s.hlinkRId);X&&(h$1.hlinkHref=X);}return h$1}function be(e,n,t){let i=h(e,"wp:extent"),o=ne(i),r=h(e,"wp:effectExtent"),l$1=te(r),u=h(e,"wp:docPr"),s=ie(u),c=j(e,null,"behindDoc")==="1",m=j(e,null,"layoutInCell"),g=m===null?void 0:m==="1",p=j(e,null,"allowOverlap"),T=p===null?void 0:p==="1",b={distT:l(e,null,"distT")??void 0,distB:l(e,null,"distB")??void 0,distL:l(e,null,"distL")??void 0,distR:l(e,null,"distR")??void 0},C=ge(e,W),P=D(C,c,b),v=h(e,"wp:positionH"),B=h(e,"wp:positionV"),E=L(v),y=z(B),x;(E||y)&&(x={horizontal:E??{relativeTo:"column"},vertical:y??{relativeTo:"paragraph"}});let{blip:h$1,blipFill:X}=oe(e),V=se(h$1),_=le(X),U=ae(h$1),M=de(V,n,t),fe=ue(e),j$1=re(fe),I={type:"image",rId:V,size:o,wrap:P};if(s.id&&(I.id=s.id),s.alt&&(I.alt=s.alt),s.title&&(I.title=s.title),s.decorative&&(I.decorative=true),M.src&&(I.src=M.src),M.mimeType&&(I.mimeType=M.mimeType),M.filename&&(I.filename=M.filename),x&&(I.position=x),l$1&&(I.padding=l$1),j$1&&(I.transform=j$1),_&&(I.crop=_),U!==void 0&&(I.opacity=U),g!==void 0&&(I.layoutInCell=g),T!==void 0&&(I.allowOverlap=T),s.hlinkRId&&n){let q=d(n,s.hlinkRId);q&&(I.hlinkHref=q);}return I}function we(e,n,t){if(ee(e))return null;let i$1=i(e);for(let o of i$1){let r=o.name||"";if(r==="wp:inline"||r==="wp:anchor")return r==="wp:inline"?Te(o,n,t):be(o,n,t)}return null}function Qe(e,n,t){return we(e,n,t)}function Ye(e){return e.wrap.type==="inline"}function Ze(e){return e.wrap.type!=="inline"}function en(e){return e.wrap.type==="behind"}function nn(e){return e.wrap.type==="inFront"}function tn(e$1){return e(e$1.size.width)}function rn(e$1){return e(e$1.size.height)}function on(e){return e.decorative===true}function ln(e$1){return {top:e(e$1.wrap.distT),bottom:e(e$1.wrap.distB),left:e(e$1.wrap.distL),right:e(e$1.wrap.distR)}}export{Ye as A,Ze as B,en as C,nn as D,tn as E,rn as F,on as G,ln as H,K as a,N as b,Q as c,Y as d,H as e,ve as f,Be as g,ee as h,Ce as i,Me as j,Re as k,Xe as l,ke as m,Ae as n,Oe as o,Ne as p,Se as q,Le as r,ze as s,We as t,De as u,He as v,Ve as w,_e as x,we as y,Qe as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkYTDWMXNS_js=require('./chunk-YTDWMXNS.js'),chunk7HANRHHL_js=require('./chunk-7HANRHHL.js'),prosemirrorHistory=require('prosemirror-history'),prosemirrorState=require('prosemirror-state');function z(t,u){let r=chunk7HANRHHL_js.e.getState(t);if(!r)return false;if(u){let e=t.tr.setMeta(chunk7HANRHHL_js.e,{active:!r.active});u(e);}return true}function U(t,u,r,e){if(r){let a={active:t};e!==void 0&&(a.author=e);let n=u.tr.setMeta(chunk7HANRHHL_js.e,a);r(n);}return true}function C(t){return chunk7HANRHHL_js.e.getState(t)?.active??false}function k(t,u){return {revisionId:chunk7HANRHHL_js.h(),author:t.author,date:u??new Date().toISOString()}}function T(t){return {revisionId:t.revisionId,author:t.author,date:t.date}}function I(t,u,r){let e=null;return t.descendants(a=>{if(e)return false;if(!a.isText)return true;let n=a.marks.find(o=>o.type.name===u&&o.attrs.author===r);return n?(e=T(n.attrs),false):true}),e}function b(t,u,r,e){let a=n=>{if(!n?.isText)return null;let o=n.marks.find(c=>c.type.name===r&&c.attrs.author===e);return o?T(o.attrs):null};try{let n=t.resolve(u);for(let o of [n.nodeBefore,n.nodeAfter]){let c=a(o);if(c)return c}if(n.parentOffset===0&&n.depth>0){let o=n.before(n.depth);if(o>0){let c=t.resolve(o).nodeBefore;if(c){let i=I(c,r,e);if(i)return i}}}if(n.parentOffset===n.parent.content.size&&n.depth>0){let o=n.after(n.depth),c=t.resolve(o).nodeAfter;if(c){let i=I(c,r,e);if(i)return i}}if(r==="insertion"||r==="deletion"){let o=r==="insertion"?"ins":"del";for(let c=n.depth;c>0;c--){let i=n.node(c);if(!(i.type.name==="tableCell"||i.type.name==="tableHeader"))continue;let s=i.attrs.cellMarker;if(s&&s.kind===o&&s.info&&s.info.author===e)return T(s.info);break}}}catch{}return null}function y(t,u,r,e,a){return b(t,u,e,a)??b(t,r,e,a)}function v(t,u,r,e){let a=r==="pPrIns"?"insertion":"deletion";try{let n=t.resolve(u);for(let i of [n.nodeBefore,n.nodeAfter]){if(i?.type.name!=="paragraph")continue;let f=i.attrs[r];if(f&&f.author===e)return f}let o=n.nodeBefore;if(o?.type.name==="paragraph"){let i=I(o,a,e);if(i)return i}let c=n.nodeAfter;if(c?.type.name==="paragraph"){let i=I(c,a,e);if(i)return i}}catch{}return null}function A(t,u,r,e,a,n,o,c){let i=[];if(u.nodesBetween(r,e,(s,l)=>{if(!s.isText&&!(s.isInline&&s.type.allowsMarkType(n)))return;let d=Math.max(l,r),g=Math.min(l+s.nodeSize,e);if(d>=g)return;let p=s.marks.some(h=>h.type===a&&h.attrs.author===o.author);i.push({from:d,to:g,isOwnInsert:p});}),i.length===0)return;let f=y(u,r,e,"deletion",o.author)??k(o,c);for(let s=i.length-1;s>=0;s--){let l=i[s];l.isOwnInsert?t.delete(l.from,l.to):t.addMark(l.from,l.to,n.create(f));}}function N(t,u,r){let e=chunk7HANRHHL_js.e.getState(t);if(!e?.active)return false;let{$from:a,$to:n,empty:o}=t.selection,c=t.schema.marks.insertion,i=t.schema.marks.deletion;if(!c||!i)return false;if(!u)return true;let f=t.tr;if(f.setMeta(chunk7HANRHHL_js.f,true),!o){A(f,t.doc,a.pos,n.pos,c,i,e);let M=f.mapping.map(n.pos);return f.setSelection(prosemirrorState.TextSelection.near(f.doc.resolve(M))),u(f.scrollIntoView()),true}let s=r==="backward",l=s?a.pos-1:a.pos,d=s?a.pos:a.pos+1;if(l<0||d>t.doc.content.size)return true;let p=t.doc.resolve(l).nodeAfter;if(!p||!(p.isText||p.isInline&&p.type.allowsMarkType(i)))return false;let h=p.marks.some(M=>M.type===c&&M.attrs.author===e.author);if(p.marks.some(M=>M.type===i)){let M=s?l:d;f.setSelection(prosemirrorState.TextSelection.near(f.doc.resolve(M)));}else if(h)f.delete(l,d);else {let M=y(t.doc,l,d,"deletion",e.author)||k(e);f.addMark(l,d,i.create(M));let P=s?l:d;f.setSelection(prosemirrorState.TextSelection.near(f.doc.resolve(P)));}return u(f.scrollIntoView()),true}function O(t,u,r,e,a){let n=t.state.schema.marks.insertion;if(!n)return false;let o=t.state.tr;o.setMeta(chunk7HANRHHL_js.f,true);let c=b(t.state.doc,u,"insertion",a.author)||k(a);if(u!==r){let s=t.state.schema.marks.deletion;s&&A(o,t.state.doc,u,r,n,s,a,c.date);}let i=o.mapping.map(r);o.insertText(e,i,i);let f=t.state.schema.marks.deletion;return f&&o.removeMark(i,i+e.length,f),o.addMark(i,i+e.length,n.create(c)),t.dispatch(o.scrollIntoView()),true}function w(t,u){let r=chunk7HANRHHL_js.e.getState(t);if(!r?.active)return false;let{$from:e,$to:a}=t.selection;if(e.parent.type.name!=="paragraph"||a.parent.type.name!=="paragraph")return false;if(!u)return true;let n=t.schema.marks.insertion,o=t.schema.marks.deletion;if(!n||!o)return false;let c=e.parent,f=(t.storedMarks??e.marks()).filter(p=>chunkYTDWMXNS_js.i.has(p.type.name)),s=t.tr;if(s.setMeta(chunk7HANRHHL_js.f,true),!t.selection.empty){A(s,t.doc,e.pos,a.pos,n,o,r);let p=s.mapping.map(e.pos);s.setSelection(prosemirrorState.TextSelection.near(s.doc.resolve(p)));}let l=s.selection.$from,d=l.before(l.depth);s.split(s.selection.from,1);let g=s.doc.nodeAt(d);if(g&&g.type.name==="paragraph"){let p=v(s.doc,d,"pPrIns",r.author)??k(r);s.setNodeMarkup(d,void 0,{...g.attrs,pPrIns:p});}return chunkYTDWMXNS_js.j(s,c,f,t.schema),u(s.scrollIntoView()),true}function G(t,u){let r=chunk7HANRHHL_js.e.getState(t);if(!r?.active)return false;let{$from:e,empty:a}=t.selection;if(!a||e.parentOffset!==0||e.parent.type.name!=="paragraph")return false;let n=e.before(e.depth);if(n<=0)return false;let o=t.doc.resolve(n).nodeBefore;if(!o||o.type.name!=="paragraph")return false;let c=o.attrs.pPrIns;if(c&&c.author===r.author){if(!u)return true;let d=n-o.nodeSize,g=e.parent,p=t.tr.setNodeMarkup(d,void 0,g.attrs);return p.join(n),p.setMeta(chunk7HANRHHL_js.f,true),u(p.scrollIntoView()),true}if(o.attrs.pPrDel){if(u){let d=n-1,g=t.tr.setSelection(prosemirrorState.TextSelection.near(t.doc.resolve(d)));u(g);}return true}if(!u)return true;let i=n-o.nodeSize,f=v(t.doc,i,"pPrDel",r.author)??k(r),s=t.tr.setNodeMarkup(i,void 0,{...o.attrs,pPrDel:f});s.setMeta(chunk7HANRHHL_js.f,true);let l=n-1;return s.setSelection(prosemirrorState.TextSelection.near(s.doc.resolve(l))),u(s.scrollIntoView()),true}function j(t,u){let r=chunk7HANRHHL_js.e.getState(t);if(!r?.active)return false;let{$from:e,empty:a}=t.selection;if(!a||e.parent.type.name!=="paragraph"||e.parentOffset!==e.parent.content.size)return false;let n=e.parent,o=e.before(e.depth),c=o+n.nodeSize;if(c>=t.doc.content.size)return false;let f=t.doc.resolve(c).nodeAfter;if(!f||f.type.name!=="paragraph")return false;let s=n.attrs.pPrIns;if(s&&s.author===r.author){if(!u)return true;let g=t.tr.setNodeMarkup(o,void 0,f.attrs);return g.join(c),g.setMeta(chunk7HANRHHL_js.f,true),u(g.scrollIntoView()),true}if(n.attrs.pPrDel||!u)return true;let l=v(t.doc,o,"pPrDel",r.author)??k(r),d=t.tr.setNodeMarkup(o,void 0,{...n.attrs,pPrDel:l});return d.setMeta(chunk7HANRHHL_js.f,true),u(d.scrollIntoView()),true}function Tt(t=false,u="User"){return new prosemirrorState.Plugin({key:chunk7HANRHHL_js.e,state:{init(){return {active:t,author:u}},apply(r,e){let a=r.getMeta(chunk7HANRHHL_js.e);return a?{...e,...a}:e}},props:{handleDOMEvents:{beforeinput(r,e){let a=chunk7HANRHHL_js.e.getState(r.state);if(!a?.active)return false;if(e.inputType==="insertText"&&e.data){e.preventDefault();let{from:n,to:o}=r.state.selection;return O(r,n,o,e.data,a)}return false}},handleKeyDown(r,e){return chunk7HANRHHL_js.e.getState(r.state)?.active?e.key==="Enter"&&!e.shiftKey?w(r.state,r.dispatch):e.key==="Backspace"?G(r.state,r.dispatch)?true:N(r.state,r.dispatch,"backward"):e.key==="Delete"?j(r.state,r.dispatch)?true:N(r.state,r.dispatch,"forward"):false:false},handleTextInput(r,e,a,n){let o=chunk7HANRHHL_js.e.getState(r.state);return o?.active?O(r,e,a,n,o):false}},appendTransaction(r,e,a){let n=chunk7HANRHHL_js.e.getState(a);if(!n?.active)return null;let o=r.find(s=>s.docChanged&&!s.getMeta(chunk7HANRHHL_js.f)&&!s.getMeta(chunk7HANRHHL_js.g)&&!prosemirrorHistory.isHistoryTransaction(s));if(!o)return null;let c=a.schema.marks.insertion;if(!c)return null;let i=a.tr;i.setMeta(chunk7HANRHHL_js.f,true);let f=a.schema.marks.deletion;return o.steps.forEach(s=>{s.getMap().forEach((d,g,p,h)=>{if(h>p){let R=y(a.doc,p,h,"insertion",n.author)??k(n);a.doc.nodesBetween(p,h,(M,P)=>{if(!M.isText&&!(M.isInline&&M.type.allowsMarkType(c)))return;if(!M.marks.some(E=>E.type===c||f&&E.type===f)){let E=Math.max(P,p),K=Math.min(P+M.nodeSize,h);i.addMark(E,K,c.create(R));}});}});}),i.steps.length>0?i:null}})}exports.a=z;exports.b=U;exports.c=C;exports.d=Tt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var prosemirrorState=require('prosemirror-state');var i={Highest:0,High:50,Default:100,Low:150,Lowest:200};function u(n){return e=>{let t={...n.defaultOptions,...e};return {type:"extension",config:{name:n.name,priority:n.priority??i.Default,options:t},onSchemaReady(o){return n.onSchemaReady(o,t)}}}}function d(n){return e=>{let t={...n.defaultOptions,...e},o=typeof n.nodeSpec=="function"?n.nodeSpec(t):n.nodeSpec;return {type:"node",config:{name:n.name,priority:n.priority??i.Default,options:t,schemaNodeName:n.schemaNodeName,nodeSpec:o},onSchemaReady(r){return n.onSchemaReady?.(r,t)??{}}}}}function g(n){return e=>{let t={...n.defaultOptions,...e},o=typeof n.markSpec=="function"?n.markSpec(t):n.markSpec;return {type:"mark",config:{name:n.name,priority:n.priority??i.Default,options:t,schemaMarkName:n.schemaMarkName,markSpec:o},onSchemaReady(r){return n.onSchemaReady?.(r,t)??{}}}}}var s=new prosemirrorState.PluginKey("suggestionMode"),S="suggestionModeApplied",f="suggestionModeBypass";var p=Date.now();function x(){return p++}function M(n){let e=s.getState(n);return e?.active?{revisionId:x(),author:e.author,date:new Date().toISOString()}:null}exports.a=i;exports.b=u;exports.c=d;exports.d=g;exports.e=s;exports.f=S;exports.g=f;exports.h=x;exports.i=M;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var l=new Set,d=new Map,y=new Set,f=new Map,w=new Set,p=new Set,u=false;function m(t,n){let e=t instanceof Error?t.message:String(t),o=new Error(`[font] ${n}: ${e}`,{cause:t});if(p.size>0)for(let i of p)try{i(o);}catch(a){console.error("Font error subscriber threw:",a);}else console.warn(o.message);}function x(t,n="normal"){return `${t.trim()}|${n}`}function P(t,n=[400,700],e=["normal","italic"]){let o=encodeURIComponent(t),i=[];for(let s of e){let r=s==="italic"?1:0;for(let c of n)i.push(`${r},${c}`);}i.sort();let a=i.join(";");return `https://fonts.googleapis.com/css2?family=${o}:ital,wght@${a}&display=swap`}async function h(t,n){if(typeof document>"u")return false;let e=t.trim();if(l.has(e))return true;let o=d.get(e);if(o)return o;let i=(async()=>{u=true;try{let a=P(e,n?.weights,n?.styles),s=document.createElement("link");return s.rel="stylesheet",s.href=a,await new Promise(c=>{s.onload=()=>c(!0),s.onerror=()=>c(!1),document.head.appendChild(s),setTimeout(()=>c(!1),5e3);})?(await b(e,3e3),l.add(e),F([e]),!0):!1}catch(a){return m(a,`failed to load "${e}"`),false}finally{d.delete(e),d.size===0&&f.size===0&&(u=false);}})();return d.set(e,i),i}async function A(t,n){let e=t.filter(o=>!l.has(o.trim()));e.length!==0&&await Promise.all(e.map(o=>h(o,n)));}function T(t){return l.has(t.trim())}function z(){return u}function G(){return Array.from(l)}function U(t){return w.add(t),()=>{w.delete(t);}}function F(t){for(let n of w)try{n(t);}catch(e){m(e,"load callback threw");}}function I(t){return p.add(t),()=>{p.delete(t);}}async function b(t,n){if("fonts"in document)try{let e=`400 16px "${t}"`;return await Promise.race([document.fonts.load(e),new Promise(o=>setTimeout(o,n))]),document.fonts.check(e)}catch{}return await new Promise(e=>setTimeout(e,100)),true}function M(t,n="sans-serif"){if(typeof document>"u")return false;let e=(i,a)=>{let r=document.createElement("canvas").getContext("2d");if(!r)return false;r.textBaseline="top";let c="abcdefghijklmnopqrstuvwxyz0123456789";r.font=`72px ${a}`;let g=r.measureText(c).width;return r.font=`72px "${i}", ${a}`,r.measureText(c).width!==g};return e(t,n)?true:e(t,n==="sans-serif"?"serif":"sans-serif")}async function R(t,n,e){if(typeof document>"u")return false;let o=t.trim(),i=x(o,e?.weight);if(y.has(i))return true;let a=f.get(i);if(a)return a;let s=(async()=>{u=true;try{let r=new Blob([n],{type:"font/ttf"}),c=URL.createObjectURL(r),g=document.createElement("style");return g.textContent=`
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: "${o}";
|
|
4
|
+
src: url(${c}) format('truetype');
|
|
5
|
+
font-weight: ${e?.weight??"normal"};
|
|
6
|
+
font-display: swap;
|
|
7
|
+
}
|
|
8
|
+
`,document.head.appendChild(g),await b(o,3e3),y.add(i),l.add(o),F([o]),!0}catch(r){return m(r,`failed to load "${o}" from buffer`),false}finally{f.delete(i),d.size===0&&f.size===0&&(u=false);}})();return f.set(i,s),s}function C(t){let n=t.split("?")[0].split("#")[0].toLowerCase();return n.endsWith(".woff2")?"woff2":n.endsWith(".woff")?"woff":n.endsWith(".otf")?"opentype":"truetype"}async function $(t,n,e){if(typeof document>"u")return false;if(/[<>]/.test(n))return m(new Error(`invalid src URL for "${t}": contains '<' or '>'`),"rejected src"),false;let o=t.trim(),i=x(o,e?.weight);if(y.has(i))return true;let a=f.get(i);if(a)return a;let s=(async()=>{u=true;try{let r=document.createElement("style");return r.textContent=`
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: "${o}";
|
|
11
|
+
src: url(${JSON.stringify(n)}) format('${C(n)}');
|
|
12
|
+
font-weight: ${e?.weight??"normal"};
|
|
13
|
+
font-display: swap;
|
|
14
|
+
}
|
|
15
|
+
`,document.head.appendChild(r),await b(o,3e3),y.add(i),l.add(o),F([o]),!0}catch(r){return m(r,`failed to load "${o}" from ${n}`),false}finally{f.delete(i),d.size===0&&f.size===0&&(u=false);}})();return f.set(i,s),s}async function D(t){!t||t.length===0||await Promise.all(t.map(n=>$(n.family,n.src,{weight:n.weight})));}var k={Calibri:"Carlito",Cambria:"Caladea",Arial:"Arimo","Times New Roman":"Tinos","Courier New":"Cousine",Garamond:"EB Garamond","Book Antiqua":"EB Garamond",Georgia:"Tinos",Verdana:"Open Sans",Tahoma:"Open Sans","Trebuchet MS":"Source Sans Pro","Century Gothic":"Poppins","Franklin Gothic":"Libre Franklin",Palatino:"EB Garamond","Palatino Linotype":"EB Garamond","Lucida Sans":"Open Sans","Segoe UI":"Open Sans",Impact:"Anton","Comic Sans MS":"Comic Neue",Consolas:"Inconsolata","Lucida Console":"Inconsolata",Monaco:"Fira Code"};function S(t){let n=t.trim();return k[n]||n}async function E(t){let n=t.trim(),e=S(n);if(e!==n){let o=await h(e);return o&&l.add(n),o}return h(e)}async function v(t){let n=[...new Set(t.map(e=>e.trim()))];await Promise.all(n.map(e=>E(e)));}async function W(){await A(["Carlito","Caladea","Arimo","Tinos","Cousine","EB Garamond"]);}function B(t){let n=new Set,e=t;if(!e?.package)return n;let o=e.package?.document?.content;if(Array.isArray(o)){for(let a of o)if(a?.type==="paragraph"&&Array.isArray(a.content)){for(let s of a.content)if(s?.type==="run"&&s.formatting?.fontFamily){let{ascii:r,hAnsi:c}=s.formatting.fontFamily;r&&n.add(r),c&&c!==r&&n.add(c);}}}let i=e.package?.styles?.styles;if(Array.isArray(i)){for(let a of i)if(a?.runProperties?.fontFamily){let{ascii:s,hAnsi:r}=a.runProperties.fontFamily;s&&n.add(s),r&&r!==s&&n.add(r);}}return n}async function O(t){let n=B(t);n.size!==0&&await v(Array.from(n));}async function j(t){if(t instanceof ArrayBuffer)return t;if(t instanceof Uint8Array){let n=new ArrayBuffer(t.byteLength);return new Uint8Array(n).set(t),n}if(t instanceof Blob)return t.arrayBuffer();throw new TypeError(`Unsupported DocxInput type: ${typeof t}`)}export{h as a,A as b,T as c,z as d,G as e,U as f,I as g,M as h,R as i,$ as j,D as k,k as l,S as m,E as n,v as o,W as p,B as q,O as r,j as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b}from'./chunk-ARHPXIBJ.mjs';import {b as b$1,f as f$1}from'./chunk-CGJ6S3AH.mjs';import {f}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-ARHPXIBJ.mjs';import {b as b$1,f as f$1}from'./chunk-CGJ6S3AH.mjs';import {f}from'./chunk-CTHHUJAB.mjs';function M(o){return typeof o=="object"&&o!==null&&("_def"in o||"parse"in o||"safeParse"in o)}function v(o,i){let s=i,{position:n,variableName:t}=s,e=JSON.parse(JSON.stringify(o)),a=e.package.document.content.filter(m=>m.type==="paragraph");if(n.paragraphIndex>=a.length)throw new Error(`Paragraph index ${n.paragraphIndex} out of bounds`);let l=a[n.paragraphIndex],p=`{${t}}`;return C(l,n.offset,p),e.templateVariables||(e.templateVariables=[]),e.templateVariables.includes(t)||e.templateVariables.push(t),e}function w(o,i){let s=i,{range:n,variableName:t}=s,e=JSON.parse(JSON.stringify(o)),a=e.package.document.content.filter(m=>m.type==="paragraph");if(n.start.paragraphIndex!==n.end.paragraphIndex)throw new Error("Template variable replacement cannot span multiple paragraphs");if(n.start.paragraphIndex>=a.length)throw new Error(`Paragraph index ${n.start.paragraphIndex} out of bounds`);let l=a[n.start.paragraphIndex];I(l,n.start.offset,n.end.offset);let p=`{${t}}`;return C(l,n.start.offset,p),e.templateVariables||(e.templateVariables=[]),e.templateVariables.includes(t)||e.templateVariables.push(t),e}function C(o,i,s){let n=0,t=false;for(let e=0;e<o.content.length;e++){let r=o.content[e];if(r.type==="run"){let a=g(r),l=n,p=n+a.length;if(!t&&i>=l&&i<=p){let m=i-l,f=a.slice(0,m),x=a.slice(m),d=[];for(let c=0;c<e;c++)d.push(o.content[c]);f&&d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:f}]}),d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:s}]}),x&&d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:x}]});for(let c=e+1;c<o.content.length;c++)d.push(o.content[c]);o.content=d,t=true;break}n=p;}else if(r.type==="hyperlink")for(let a of r.children)a.type==="run"&&(n+=g(a).length);}t||o.content.push({type:"run",content:[{type:"text",text:s}]});}function I(o,i,s){let n=[],t=0;for(let e of o.content)if(e.type==="run"){let r=g(e),a=t,l=t+r.length;if(l<=i||a>=s)n.push(e);else {let p="";a<i&&(p+=r.slice(0,i-a)),l>s&&(p+=r.slice(s-a)),p.length>0&&n.push({type:"run",formatting:e.formatting,content:[{type:"text",text:p}]});}t=l;}else n.push(e);o.content=n;}function g(o){return o.content.filter(i=>i.type==="text").map(i=>i.text).join("")}var u={type:"string",description:"Document ID from a previous docx_load call"},D={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)"},offset:{type:"number",description:"Character offset within the paragraph"}},required:["paragraphIndex","offset"]},V={name:"docx_get_variables",description:`List all template variables ({name} format) found in the document.
|
|
2
2
|
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
3
|
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(o,i)=>{let{documentId:s}=o,n=i.session.documents.get(s);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};try{let t=b(n.document);return {content:[{type:"text",text:JSON.stringify({variables:t.variables,count:t.variables.length,totalOccurrences:t.totalOccurrences,byLocation:t.byLocation},null,2)}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to detect variables: ${t.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low",examples:[{description:"Get all variables from a loaded document",input:{documentId:"doc_123"},output:'{"variables": ["customer_name", "invoice_date"], "count": 2}'}]}},R={name:"docx_insert_variable",description:`Insert a template variable placeholder ({name}) at a specific position in the document.
|
|
4
4
|
The variable can later be substituted with actual values using docx_apply_template.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkGY5BWVM7_js=require('./chunk-GY5BWVM7.js'),chunkLTHT4A4S_js=require('./chunk-LTHT4A4S.js'),chunkX6HFDXKB_js=require('./chunk-X6HFDXKB.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function j(e,t){if(e.pages.length===0)return null;let a=e.pageGap??0,o=0,n=null,r=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,u=o,f=u+l;if(t.y>=u&&t.y<f)return {pageIndex:s,page:i,pageY:t.y-u};let c=u+l/2,h=Math.abs(t.y-c);h<r&&(r=h,n=s),o=f+a;}if(n!==null){let s=e.pages[n],i=A(e,n);return {pageIndex:n,page:s,pageY:Math.max(0,Math.min(t.y-i,s.size?.h??e.pageSize.h))}}return null}function A(e,t){let a=e.pageGap??0,o=0;for(let n=0;n<t&&n<e.pages.length;n++){let s=e.pages[n].size?.h??e.pageSize.h;o+=s+a;}return o}function Me(e,t){return j(e,{y:t})?.pageIndex??null}function $(e,t){return e.findIndex(a=>a.id===t)}function ye(e,t){let a=0;for(let o=e.fromLine;o<e.toLine&&o<t.lines.length;o++)a+=t.lines[o].lineHeight;return a}function ae(e,t,a,o){let n=[...e.page.fragments].sort((r,s)=>{let i=r.y-s.y;return Math.abs(i)>.5?i:r.x-s.x});for(let r of n){let s=$(t,r.blockId);if(s===-1)continue;let i=t[s],l=a[s];if(!i||!l)continue;let u;if(r.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;u=ye(r,l);}else if(r.kind==="table")u=r.height;else if(r.kind==="image")u=r.height;else continue;let f=o.x>=r.x&&o.x<=r.x+r.width,c=o.y>=r.y&&o.y<=r.y+u;if(f&&c)return {fragment:r,block:i,measure:l,pageIndex:e.pageIndex,localX:o.x-r.x,localY:o.y-r.y}}return null}function He(e,t,a,o){for(let n of e.page.fragments){if(n.kind!=="image")continue;let r=$(t,n.blockId);if(r===-1)continue;let s=t[r],i=a[r];if(!s||!i)continue;let l=o.x>=n.x&&o.x<=n.x+n.width,u=o.y>=n.y&&o.y<=n.y+n.height;if(l&&u)return {fragment:n,block:s,measure:i,pageIndex:e.pageIndex,localX:o.x-n.x,localY:o.y-n.y}}return null}function se(e,t,a,o){for(let n of e.page.fragments){if(n.kind!=="table")continue;let r=n,s=o.x>=r.x&&o.x<=r.x+r.width,i=o.y>=r.y&&o.y<=r.y+r.height;if(!s||!i)continue;let l=$(t,r.blockId);if(l===-1)continue;let u=t[l],f=a[l];if(!u||u.kind!=="table"||!f||f.kind!=="table")continue;let c=u,h=f,p=o.x-r.x,m=o.y-r.y,g=r.headerRowCount??0,d=g>0&&r.continuesFromPrev?chunkLTHT4A4S_js.P(h,g):0,b=0,x=-1;if(h.rows.length===0||c.rows.length===0)continue;if(d>0&&m<d){let T=0;for(let M=0;M<g&&M<h.rows.length;M++){let L=h.rows[M];if(m>=T&&m<T+L.height){x=M;break}T+=L.height;}x===-1&&(x=0);}else {let T=m-d;for(let M=r.fromRow;M<r.toRow&&M<h.rows.length;M++){let L=h.rows[M];if(T>=b&&T<b+L.height){x=M;break}b+=L.height;}}if(x===-1&&(x=Math.min(r.toRow-1,h.rows.length-1),x<r.fromRow))continue;let k=h.rows[x],F=c.rows[x];if(!k||!F)continue;let P=0,y=-1;if(k.cells.length===0||F.cells.length===0)continue;for(let T=0;T<k.cells.length;T++){let M=k.cells[T];if(p>=P&&p<P+M.width){y=T;break}P+=M.width;}if(y===-1&&(y=k.cells.length-1,y<0))continue;let H=k.cells[y],w=F.cells[y];if(!H||!w)continue;let R=0;if(d>0&&x<g)for(let T=0;T<x;T++)R+=h.rows[T]?.height??0;else {R=d;for(let T=r.fromRow;T<x;T++)R+=h.rows[T]?.height??0;}let B=0;for(let T=0;T<y;T++)B+=k.cells[T]?.width??0;let C,S;if(w.blocks&&w.blocks.length>0){let T=w.blocks[0],M=H.blocks[0];T.kind==="paragraph"&&M?.kind==="paragraph"&&(C=T,S=M);}let D=p-B,E=m-R;return {fragment:r,block:c,measure:h,pageIndex:e.pageIndex,rowIndex:x,colIndex:y,cellBlock:C,cellMeasure:S,cellLocalX:Math.max(0,D),cellLocalY:Math.max(0,E)}}return null}function we(e,t,a,o){let n={pageHit:null,fragmentHit:null,tableCellHit:null};if(n.pageHit=j(e,o),!n.pageHit)return n;let r=A(e,n.pageHit.pageIndex),s={x:o.x,y:o.y-r};return n.fragmentHit=ae(n.pageHit,t,a,s),n.fragmentHit?.fragment.kind==="table"&&(n.tableCellHit=se(n.pageHit,t,a,s)),n}function Re(e){if(e.pages.length===0)return 0;let t=e.pageGap??0,a=0;for(let o=0;o<e.pages.length;o++){let n=e.pages[o];a+=n.size?.h??e.pageSize.h,o<e.pages.length-1&&(a+=t);}return a}function Be(e,t){return A(e,t)}function Ie(e,t){if(t<0||t>=e.pages.length)return null;let a=A(e,t),n=e.pages[t].size?.h??e.pageSize.h;return {top:a,bottom:a+n}}function J(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function le(e,t){let a=[];for(let o=t.fromRun;o<=t.toRun&&o<e.runs.length;o++){let n=e.runs[o];if(n){if(n.kind==="tab"||n.kind==="image"||n.kind==="lineBreak"){a.push(n);continue}if(n.kind==="text"){let r=n.text??"",s=o===t.fromRun,i=o===t.toRun;if(s||i){let l=s?t.fromChar:0,u=i?t.toChar:r.length,f=r.slice(l,u);f.length>0&&a.push({...n,text:f});}else a.push(n);}}}return a}function ce(e,t){let a,o,n=e.pmStart??0,r=0;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let i=e.runs[s];i&&(s<t.fromRun?i.kind==="text"?r+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(r+=1):s===t.fromRun&&(r+=t.fromChar,a=n+r,i.kind==="text"&&(r=t.fromChar)));}if(a!==void 0){let s=0;for(let i=t.fromRun;i<=t.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let u=l.text??"",f=i===t.fromRun?t.fromChar:0,c=i===t.toRun?t.toChar:u.length;s+=c-f;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}o=a+s;}return {pmStart:a,pmEnd:o}}function Se(e,t,a,o){let n=0;for(let r=a;r<o&&r<e.lines.length;r++){let i=e.lines[r].lineHeight;if(t>=n&&t<n+i)return r;n+=i;}return o>a?Math.min(o-1,e.lines.length-1):null}function Ee(e,t,a,o){let{pmStart:n,pmEnd:r}=ce(e,t);if(n===void 0||r===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(o-t.width)/2):s==="right"&&(i=Math.max(0,o-t.width));let l=Math.max(0,a-i);if(l<=0)return {charOffset:0,pmPosition:n};let u=le(e,t);if(u.length===0)return {charOffset:0,pmPosition:n};let f=0,c=0;for(let p of u){if(p.kind==="tab"){let m=p.width??48,g=f+m;if(l<=g){let d=f+m/2;return l<d?{charOffset:c,pmPosition:n+c}:{charOffset:c+1,pmPosition:n+c+1}}f=g,c+=1;continue}if(p.kind==="image"){let m=p.width,g=f+m;if(l<=g){let d=f+m/2;return l<d?{charOffset:c,pmPosition:n+c}:{charOffset:c+1,pmPosition:n+c+1}}f=g,c+=1;continue}if(p.kind==="lineBreak"){if(l>=f)return {charOffset:c,pmPosition:n+c};c+=1;continue}if(p.kind==="text"){let m=p.text??"";if(m.length===0)continue;let g=J(p),d=chunkLTHT4A4S_js.g(m,g),b=f+d.width;if(l<=b){let x=l-f,k=chunkLTHT4A4S_js.h(x,d.charWidths),F=c+k;return {charOffset:F,pmPosition:n+F}}f=b,c+=m.length;}}return {charOffset:r-n,pmPosition:r}}function K(e){let{fragment:t,block:a,measure:o,localX:n,localY:r}=e;if(t.kind!=="paragraph"||a.kind!=="paragraph"||o.kind!=="paragraph")return null;let s=t,i=a,l=o,u=Se(l,r,s.fromLine,s.toLine);if(u===null)return null;let f=l.lines[u];if(!f)return null;let c=0;for(let k=s.fromLine;k<u;k++)c+=l.lines[k]?.lineHeight??0;let h=i.attrs?.indent,p=h?.left??0,m=h?.right??0,g=Math.max(0,t.width-p-m),d=n-p,{charOffset:b,pmPosition:x}=Ee(i,f,d,g);return {pmPosition:x,charOffset:b,lineIndex:u}}function ue(e){let{cellBlock:t,cellMeasure:a,cellLocalX:o,cellLocalY:n}=e;if(!t||!a)return null;let r={fragment:{kind:"paragraph",blockId:t.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:t,measure:a,pageIndex:e.pageIndex,localX:o,localY:n};return K(r)?.pmPosition??null}function Le(e,t){if(t)return ue(t);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?K(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function fe(e,t,a,o){let n=e.pmStart??0,r=e.pmEnd??n;if(a<n||a>r)return null;let s=a-n;for(let i=0;i<t.lines.length;i++){let l=t.lines[i],{pmStart:u,pmEnd:f}=ce(e,l);if(u===void 0||f===void 0)continue;let c=u-n,h=f-n;if(s>=c&&s<=h){let p=s-c,m=le(e,l),g=0,d=0;for(let b of m)if(b.kind==="tab"){if(p<=d+1)return p<=d?{x:g,lineIndex:i}:{x:g+(b.width??48),lineIndex:i};g+=b.width??48,d+=1;}else if(b.kind==="image"){if(p<=d+1)return p<=d?{x:g,lineIndex:i}:{x:g+b.width,lineIndex:i};g+=b.width,d+=1;}else if(b.kind==="lineBreak"){if(p<=d)return {x:g,lineIndex:i};d+=1;}else if(b.kind==="text"){let x=b.text??"";if(p<=d+x.length){let P=p-d,y=J(b),H=chunkLTHT4A4S_js.g(x.slice(0,P),y);return {x:g+H.width,lineIndex:i}}let k=J(b),F=chunkLTHT4A4S_js.g(x,k);g+=F.width,d+=x.length;}return {x:g,lineIndex:i}}}return null}function Ce(e,t,a,o,n,r,s){let i=fe(e,t,a);if(!i)return null;let l=e.attrs?.alignment??"left",u=e.attrs?.indent,f=u?.left??0,c=u?.right??0,h=Math.max(0,r-f-c),p=t.lines[i.lineIndex];if(!p)return null;let m=0;l==="center"?m=Math.max(0,(h-p.width)/2):l==="right"&&(m=Math.max(0,h-p.width));let g=0;for(let d=s;d<i.lineIndex;d++)g+=t.lines[d]?.lineHeight??0;return {x:o+f+m+i.x,y:n+g,height:p.lineHeight}}function ge(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Q(e,t){return e.findIndex(a=>a.id===t)}function W(e,t){let o=(e.pmStart??0)+1,n=0,r;for(let l=0;l<e.runs.length&&l<=t.toRun;l++){let u=e.runs[l];if(u){if(l<t.fromRun)u.kind==="text"?n+=(u.text??"").length:n+=1;else if(l===t.fromRun){n+=t.fromChar,r=o+n;break}}}r===void 0&&(r=o);let s=0;for(let l=t.fromRun;l<=t.toRun&&l<e.runs.length;l++){let u=e.runs[l];if(u)if(u.kind==="text"){let f=u.text??"",c=l===t.fromRun?t.fromChar:0,h=l===t.toRun?t.toChar:f.length;s+=h-c;}else s+=1;}let i=r+s;return {pmStart:r,pmEnd:i}}function me(e,t,a,o){let n=[];for(let r=0;r<t.lines.length;r++){let s=t.lines[r],i=W(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<o&&n.push({line:s,index:r});}return n}function N(e,t,a){let o=W(e,t);return o.pmStart===void 0?0:Math.max(0,a-o.pmStart)}function z(e,t,a,o){let n=0,r=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(r+1>=a)return a<=r?n:n+l;n+=l,r+=1;continue}if(i.kind==="image"){let l=i.width;if(r+1>=a)return a<=r?n:n+l;n+=l,r+=1;continue}if(i.kind==="lineBreak"){if(a<=r)return n;r+=1;continue}if(i.kind==="text"){let l=i.text??"",u=s===t.fromRun,f=s===t.toRun,c=u?t.fromChar:0,h=f?t.toChar:l.length,p=l.slice(c,h);if(r+p.length>=a){let d=a-r,b=ge(i),x=chunkLTHT4A4S_js.g(p.slice(0,d),b);return n+x.width}let m=ge(i),g=chunkLTHT4A4S_js.g(p,m);n+=g.width,r+=p.length;}}}return n}function G(e,t){let a=0;for(let o=0;o<t&&o<e.lines.length;o++)a+=e.lines[o].lineHeight;return a}function De(e,t,a,o,n){if(o===n)return [];let r=Math.min(o,n),s=Math.max(o,n),i=[];for(let l=0;l<e.pages.length;l++){let u=e.pages[l],f=A(e,l);for(let c of u.fragments){if(c.kind==="paragraph"){let h=Q(t,c.blockId);if(h===-1)continue;let p=t[h],m=a[h];if(!p||p.kind!=="paragraph"||!m||m.kind!=="paragraph")continue;let g=p,d=m,b=c,x=me(g,d,r,s);for(let{line:k,index:F}of x){if(F<b.fromLine||F>=b.toLine)continue;let P=W(g,k);if(P.pmStart===void 0||P.pmEnd===void 0)continue;let y=Math.max(P.pmStart,r),H=Math.min(P.pmEnd,s);if(y>=H)continue;let w=N(g,k,y),R=N(g,k,H),I=g.attrs?.indent,B=I?.left??0,C=I?.right??0,S=Math.max(0,c.width-B-C),D=z(g,k,w),E=z(g,k,R),T=g.attrs?.alignment??"left",M=0;T==="center"?M=Math.max(0,(S-k.width)/2):T==="right"&&(M=Math.max(0,S-k.width));let L=G(d,F)-G(d,b.fromLine),_=c.x+B+M+Math.min(D,E),V=Math.max(1,Math.abs(E-D)),v=c.y+L;i.push({x:_,y:v+f,width:V,height:k.lineHeight,pageIndex:l});}}if(c.kind==="table"){let h=Q(t,c.blockId);if(h===-1)continue;let p=t[h],m=a[h];if(!p||p.kind!=="table"||!m||m.kind!=="table")continue;let g=p,d=m,b=c,x=b.headerRowCount??0,F=x>0&&b.continuesFromPrev?chunkLTHT4A4S_js.P(d,x):0;for(let P=b.fromRow;P<b.toRow&&P<g.rows.length;P++){let y=g.rows[P],H=d.rows[P];if(!y||!H)continue;let w=0;for(let R=0;R<y.cells.length;R++){let I=y.cells[R],B=H.cells[R];if(!(!I||!B)){for(let C=0;C<I.blocks.length;C++){let S=I.blocks[C],D=B.blocks[C];if(!S||S.kind!=="paragraph"||!D||D.kind!=="paragraph")continue;let E=S,T=D,M=me(E,T,r,s),L=0;for(let{line:_,index:V}of M){let v=W(E,_);if(v.pmStart===void 0||v.pmEnd===void 0)continue;let Z=Math.max(v.pmStart,r),ee=Math.min(v.pmEnd,s);if(Z>=ee)continue;let ke=N(E,_,Z),Fe=N(E,_,ee),te=z(E,_,ke,B.width),ne=z(E,_,Fe,B.width),Pe=G(T,V);i.push({x:b.x+w+Math.min(te,ne),y:b.y+F+L+Pe+f,width:Math.max(1,Math.abs(ne-te)),height:_.lineHeight,pageIndex:l});}L+=T.totalHeight;}w+=B.width;}}F+=H.height;}}if(c.kind==="image"){let h=c.pmStart??0;(c.pmEnd??h+1)>r&&h<s&&i.push({x:c.x,y:c.y+f,width:c.width,height:c.height,pageIndex:l});}}}return i}function _e(e,t,a,o){for(let n=0;n<e.pages.length;n++){let r=e.pages[n],s=A(e,n);for(let i of r.fragments){if(i.kind==="paragraph"){let l=Q(t,i.blockId);if(l===-1)continue;let u=t[l],f=a[l];if(!u||u.kind!=="paragraph"||!f||f.kind!=="paragraph")continue;let c=u,h=f,p=i,m=c.pmStart??0,g=c.pmEnd??m;if(o<m||o>g)continue;for(let d=p.fromLine;d<p.toLine;d++){let b=h.lines[d];if(!b)continue;let x=W(c,b);if(!(x.pmStart===void 0||x.pmEnd===void 0)&&o>=x.pmStart&&o<=x.pmEnd){let k=N(c,b,o),F=c.attrs?.indent,P=F?.left??0,y=F?.right??0,H=Math.max(0,i.width-P-y),w=z(c,b,k),R=c.attrs?.alignment??"left",I=0;R==="center"?I=Math.max(0,(H-b.width)/2):R==="right"&&(I=Math.max(0,H-b.width));let B=G(h,d)-G(h,p.fromLine);return {x:i.x+P+I+w,y:i.y+B+s,height:b.lineHeight,pageIndex:n}}}}if(i.kind==="image"){let l=i.pmStart??0,u=i.pmEnd??l+1;if(o>=l&&o<=u){let f=o===l?0:i.width;return {x:i.x+f,y:i.y+s,height:i.height,pageIndex:n}}}}}return null}function Ae(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function Oe(e){let t=new Map;for(let a of e){let o=t.get(a.pageIndex)??[];o.push(a),t.set(a.pageIndex,o);}return t}function Xe(e){if(e.kind!=="paragraph")return false;let t=e.attrs;return t?!!(t.borders?.top||t.borders?.bottom||t.spacingExplicit?.before||t.spacingExplicit?.after):false}function de(e){return he(e)}function he(e){let t=new Set;for(let a=1;a<e.length;a++){let o=e[a-1],n=e[a];o.kind==="table"&&n.kind==="paragraph"&&(n.runs.length>0||Xe(n)||t.add(a));}return e.map((a,o)=>{if(a.kind==="table")return ve(a);if(a.kind!=="paragraph")return a;let n=t.has(o),r=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!r?.before,u=i&&!r?.after,f=l||u;if(!f&&!n)return a;let c=a.attrs;return f&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:r?.before?c.spacing.before:void 0,after:r?.after?c.spacing.after:void 0}}),n&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function ve(e){let t=false,a=e.rows.map(o=>{let n=false,r=o.cells.map(s=>{let i=he(s.blocks);return i.some((u,f)=>u!==s.blocks[f])?(n=true,{...s,blocks:i}):s});return n?(t=true,{...o,cells:r}):o});return t?{...e,rows:a}:e}function Ye(e){return e?.align??e?.alignment}function pe(e,t,a,o){let n=o.section==="header"?o.margins.header??48:o.pageSize.h-(o.margins.footer??48)-a,r=e.position?.vertical;if(!r)return t;let s=Ye(r),i=r.posOffset!==void 0?chunk4Q2IP5FW_js.e(r.posOffset):void 0;if(r.relativeTo==="page"){if(i!==void 0)return i-n;if(s==="top")return -n;if(s==="bottom")return o.pageSize.h-e.height-n;if(s==="center")return (o.pageSize.h-e.height)/2-n}if(r.relativeTo==="margin"){let l=o.margins.top,u=o.pageSize.h-o.margins.top-o.margins.bottom;if(i!==void 0)return l+i-n;if(s==="top")return l-n;if(s==="bottom")return l+u-e.height-n;if(s==="center")return l+(u-e.height)/2-n}return i!==void 0?t+i:t}function be(e,t,a,o){let n=0,r=a,s=0;for(let i=0;i<e.length;i++){let l=e[i],u=t[i];if(!(!l||!u)){if(l.kind==="paragraph"&&u.kind==="paragraph"){let f=s,c=f+u.totalHeight;n=Math.min(n,f),r=Math.max(r,c);for(let h of l.runs){if(h.kind!=="image"||!h.position)continue;let p=pe(h,f,a,o);n=Math.min(n,p),r=Math.max(r,p+h.height);}s=c;}else if(l.kind==="table"&&u.kind==="table"){let f=s+u.totalHeight;n=Math.min(n,s),r=Math.max(r,f),s=f;}else if(l.kind==="image"&&u.kind==="image"){let f=s+u.height;n=Math.min(n,s),r=Math.max(r,f),s=f;}else if(l.kind==="textBox"&&u.kind==="textBox"){let f=s+u.height;n=Math.min(n,s),r=Math.max(r,f),s=f;}}}return {visualTop:n,visualBottom:r}}function Ne(e,t,a,o){if(!e||!e.content||e.content.length===0)return;let n=chunkX6HFDXKB_js.b(e.content,{styles:o.styles??void 0,theme:o.theme??null,defaultTabStopTwips:o.defaultTabStopTwips??null});return xe(n,t,a,o)}function xe(e,t,a,o){let n=chunkGY5BWVM7_js.c(e,{theme:o.theme??void 0});if(n.length===0)return;let r=de(n),s=o.measureBlocks(r,t),i=s.reduce((f,c)=>c.kind==="paragraph"||c.kind==="table"?f+c.totalHeight:c.kind==="image"||c.kind==="textBox"?f+c.height:f,0),{visualTop:l,visualBottom:u}=be(n,s,i,a);return {blocks:r,measures:s,height:i,visualTop:l,visualBottom:u}}var Y=null;function ze(){Y=null;}function Te(e){if(Y&&Y.host.isConnected)return Y;let t=e.querySelector(".layout-page-header, .layout-page-footer");if(!t)return null;let a=Array.from(t.querySelectorAll("span[data-pm-start][data-pm-end]")),o=Array.from(t.querySelectorAll("[data-pm-start][data-pm-end]"));return Y={host:t,spans:a,ranged:o},Y}function Ge(e,t=globalThis.document){let a=e.state.selection;if(!a.empty)return null;let o=a.head,n=Te(t);if(!n)return null;let{host:r,spans:s}=n;for(let m of s){let g=Number(m.dataset.pmStart),d=Number(m.dataset.pmEnd);if(!(!Number.isFinite(g)||!Number.isFinite(d))&&o>=g&&o<=d){let b=r.ownerDocument.createRange(),x=r.ownerDocument.createTreeWalker(m,NodeFilter.SHOW_TEXT),k=o-g,F=x.nextNode();for(;F;){let H=F.data.length;if(k<=H){try{b.setStart(F,k),b.setEnd(F,k);let w=b.getClientRects()[0]??b.getBoundingClientRect();if(w&&w.height>0)return {top:w.top,left:w.left,height:w.height}}catch{}break}k-=H,F=x.nextNode();}let P=m.getBoundingClientRect(),y=(o-g)/Math.max(1,d-g);return {top:P.top,left:P.left+P.width*y,height:P.height}}}let i=r.querySelector(`[data-pm-start="${o}"]`);if(i){let m=i.getBoundingClientRect();return {top:m.top,left:m.left+1,height:m.height||16}}let l=n.ranged,u=null,f=1/0;for(let m of l){let g=Number(m.dataset.pmStart),d=Number(m.dataset.pmEnd);if(!Number.isFinite(g)||!Number.isFinite(d)||o<g||o>d)continue;let b=d-g;b<f&&(f=b,u=m);}if(u){let m=u.getBoundingClientRect(),g=Number(u.dataset.pmEnd),d=o>=g;return {top:m.top,left:d?m.right:m.left+1,height:m.height||16}}let c=null,h=-1/0;for(let m of l){let g=Number(m.dataset.pmStart);Number.isFinite(g)&&(g>o||g>h&&(h=g,c=m));}if(c){let m=c.getBoundingClientRect();return {top:m.top,left:m.right,height:m.height||16}}let p=r.getBoundingClientRect();return {top:p.top+2,left:p.left+2,height:16}}function We(e,t=globalThis.document){let a=e.state.selection;if(a.empty)return [];let o=a.from,n=a.to,r=[],s=Te(t);if(!s)return r;let{host:i,spans:l}=s;for(let u of l){let f=Number(u.dataset.pmStart),c=Number(u.dataset.pmEnd);if(!Number.isFinite(f)||!Number.isFinite(c)||c<=o||f>=n)continue;if(u.classList.contains("layout-run-tab")){let d=u.getBoundingClientRect();r.push({top:d.top,left:d.left,width:d.width,height:d.height});continue}let h=null;if(u.firstChild?.nodeType===Node.TEXT_NODE?h=u.firstChild:u.firstChild?.nodeType===Node.ELEMENT_NODE&&u.firstChild.tagName==="A"&&u.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(h=u.firstChild.firstChild),!h)continue;let p=Math.max(0,o-f),m=Math.min(h.length,n-f);if(p>=m)continue;let g=i.ownerDocument.createRange();g.setStart(h,p),g.setEnd(h,m);for(let d of Array.from(g.getClientRects()))r.push({top:d.top,left:d.left,width:d.width,height:d.height});}return r}var Ue=816,Ve=1056,qe=96,je=48;function O(e){return Math.round(e/1440*96)}function $e(e){return {w:e?.pageWidth?O(e.pageWidth):816,h:e?.pageHeight?O(e.pageHeight):1056}}function Je(e){return {top:e?.marginTop?O(e.marginTop):96,right:e?.marginRight?O(e.marginRight):96,bottom:e?.marginBottom?O(e.marginBottom):96,left:e?.marginLeft?O(e.marginLeft):96,header:e?.headerDistance?O(e.headerDistance):48,footer:e?.footerDistance?O(e.footerDistance):48}}function Ke(e,t){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let o=e.package.headers,n=e.package.footers,r=null,s=null,i=null,l=null;if(o&&t?.headerReferences){let u=t.headerReferences.find(c=>c.type==="default");u?.rId&&(r=o.get(u.rId)??null);let f=t.headerReferences.find(c=>c.type==="first");f?.rId&&(i=o.get(f.rId)??null);}if(n&&t?.footerReferences){let u=t.footerReferences.find(c=>c.type==="default");u?.rId&&(s=n.get(u.rId)??null);let f=t.footerReferences.find(c=>c.type==="first");f?.rId&&(l=n.get(f.rId)??null);}return t?.titlePg||(!r&&i&&(r=i),!s&&l&&(s=l)),{header:r,footer:s,firstHeader:i,firstFooter:l}}exports.A=We;exports.B=Ue;exports.C=Ve;exports.D=qe;exports.E=je;exports.F=$e;exports.G=Je;exports.H=Ke;exports.a=j;exports.b=A;exports.c=Me;exports.d=ae;exports.e=He;exports.f=se;exports.g=we;exports.h=Re;exports.i=Be;exports.j=Ie;exports.k=K;exports.l=ue;exports.m=Le;exports.n=fe;exports.o=Ce;exports.p=De;exports.q=_e;exports.r=Ae;exports.s=Oe;exports.t=de;exports.u=pe;exports.v=be;exports.w=Ne;exports.x=xe;exports.y=ze;exports.z=Ge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c,e,j}from'./chunk-WLHNIXWC.mjs';var l=720,s=31680;function p(e$1){let n=e$1?c(e$1):null,o=n?e(n,"w","defaultTabStop"):null,t=o?parseInt(j(o,"w","val")??"",10):NaN;return {defaultTabStop:Number.isFinite(t)&&t>0&&t<=s?t:l}}export{l as a,p as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {q,p}from'./chunk-IQG3KLWY.mjs';var t=new q(p());t.buildSchema();t.initializeRuntime();var s=t,n=t.getSchema();export{s as a,n as b};
|