@docx-editor.dev/pro 2.32.0 → 2.34.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.
Files changed (86) hide show
  1. package/README.md +17 -3
  2. package/dist/chunk-3HW2VWFW.js +1 -0
  3. package/dist/chunk-3MIZFGHH.cjs +1 -0
  4. package/dist/chunk-4TS2D6OV.js +11 -0
  5. package/dist/chunk-5HK5RAD7.cjs +11 -0
  6. package/dist/chunk-ENMURXLJ.js +1 -0
  7. package/dist/chunk-EOZ44UA7.js +1 -0
  8. package/dist/{chunk-RYF4SNKX.cjs → chunk-GOUTDQFX.cjs} +1 -1
  9. package/dist/chunk-GSBQ5AHL.cjs +1 -0
  10. package/dist/chunk-HMU7J34H.js +1 -0
  11. package/dist/chunk-IFDU5O5J.js +1 -0
  12. package/dist/chunk-IULA3QRZ.cjs +1 -0
  13. package/dist/chunk-L6ZMFFBX.cjs +1 -0
  14. package/dist/chunk-NTBGYQX4.js +1 -0
  15. package/dist/chunk-QEULTKCT.cjs +1 -0
  16. package/dist/{chunk-OT5R3IYV.cjs → chunk-QOXYHVBM.cjs} +1 -1
  17. package/dist/chunk-STTJA26X.js +1 -0
  18. package/dist/chunk-UPKBD6AH.cjs +1 -0
  19. package/dist/chunk-VQOLBCW6.js +1 -0
  20. package/dist/chunk-ZMBZ7CWZ.js +6 -0
  21. package/dist/chunk-ZZ33FL6V.cjs +6 -0
  22. package/dist/collaboration/hocuspocus.cjs +1 -1
  23. package/dist/collaboration/hocuspocus.d.cts +1 -1
  24. package/dist/collaboration/hocuspocus.d.ts +1 -1
  25. package/dist/collaboration/hocuspocus.js +1 -1
  26. package/dist/collaboration/index.cjs +2 -2
  27. package/dist/collaboration/index.d.cts +3 -2
  28. package/dist/collaboration/index.d.ts +3 -2
  29. package/dist/collaboration/index.js +2 -2
  30. package/dist/collaboration/webrtc.cjs +1 -1
  31. package/dist/collaboration/webrtc.d.cts +1 -1
  32. package/dist/collaboration/webrtc.d.ts +1 -1
  33. package/dist/collaboration/webrtc.js +1 -1
  34. package/dist/{collaboration-module-DWn2heE1.d.cts → collaboration-module-02CIP5sN.d.cts} +2 -20
  35. package/dist/{collaboration-module-DWn2heE1.d.ts → collaboration-module-COZAgqwg.d.ts} +2 -20
  36. package/dist/{define-custom-node-D0c36PpZ.d.ts → define-custom-node-CISpZvVB.d.cts} +8 -3
  37. package/dist/{define-custom-node-CNRQG1TI.d.cts → define-custom-node-DE1KjR1r.d.ts} +8 -3
  38. package/dist/{document-session-B-iH-YCU.d.ts → document-session-B6v5LZIK.d.ts} +94 -9
  39. package/dist/{document-session-B-MlORjE.d.cts → document-session-DZK2tAr4.d.cts} +94 -9
  40. package/dist/document-session-RPP3WEJ7.cjs +1 -0
  41. package/dist/document-session-S2N54WP6.js +1 -0
  42. package/dist/drawing/index.cjs +1 -0
  43. package/dist/drawing/index.d.cts +112 -0
  44. package/dist/drawing/index.d.ts +112 -0
  45. package/dist/drawing/index.js +1 -0
  46. package/dist/index.cjs +1 -1
  47. package/dist/index.d.cts +4 -3
  48. package/dist/index.d.ts +4 -3
  49. package/dist/index.js +1 -1
  50. package/dist/license-D-ds5Y7c.d.cts +20 -0
  51. package/dist/license-D-ds5Y7c.d.ts +20 -0
  52. package/dist/metafile-raster-3MCAHWYO.js +1 -0
  53. package/dist/metafile-raster-DWGCWQTU.cjs +1 -0
  54. package/dist/metafile-replay-SDHSTWYT.js +1 -0
  55. package/dist/metafile-replay-YZ2LHLBT.cjs +1 -0
  56. package/dist/react/hocuspocus.cjs +1 -1
  57. package/dist/react/hocuspocus.js +1 -1
  58. package/dist/react/index.cjs +2 -2
  59. package/dist/react/index.d.cts +81 -22
  60. package/dist/react/index.d.ts +81 -22
  61. package/dist/react/index.js +2 -2
  62. package/dist/react/webrtc.cjs +1 -1
  63. package/dist/react/webrtc.js +1 -1
  64. package/dist/vue/hocuspocus.cjs +1 -1
  65. package/dist/vue/hocuspocus.js +1 -1
  66. package/dist/vue/index.cjs +2 -2
  67. package/dist/vue/index.d.cts +61 -18
  68. package/dist/vue/index.d.ts +61 -18
  69. package/dist/vue/index.js +2 -2
  70. package/dist/vue/webrtc.cjs +1 -1
  71. package/dist/vue/webrtc.js +1 -1
  72. package/package.json +11 -5
  73. package/dist/chunk-3WTOHPAB.js +0 -1
  74. package/dist/chunk-AVZO5ZHZ.js +0 -1
  75. package/dist/chunk-DLYVBBO7.js +0 -1
  76. package/dist/chunk-GAGYRL3L.js +0 -5
  77. package/dist/chunk-HMSOWKXT.js +0 -1
  78. package/dist/chunk-I6HVINA4.cjs +0 -1
  79. package/dist/chunk-MHB6ID2P.cjs +0 -1
  80. package/dist/chunk-MWO2ZUEJ.js +0 -1
  81. package/dist/chunk-PMS3PGOE.cjs +0 -1
  82. package/dist/chunk-Q2VBO66F.js +0 -1
  83. package/dist/chunk-QLZH2Q2C.cjs +0 -1
  84. package/dist/chunk-YOWEY5F3.cjs +0 -5
  85. package/dist/document-session-B35ZX2W4.js +0 -1
  86. package/dist/document-session-V3O7XBJY.cjs +0 -1
@@ -11,7 +11,8 @@ import { C as CreateDocumentCollaborationOptions } from './document-session-opti
11
11
  * count that growth, so a long-lived room walks toward a terminal `too-many-nodes` or
12
12
  * `blob-store-full` failure. Until compaction exists (the generation reset of issue #554),
13
13
  * the honest interim is visibility: a host that can SEE the walk can archive and re-room
14
- * before the caps end the session for it.
14
+ * before the caps end the session for it. This is the probe; the push signal is
15
+ * `subscribeResourcePressure`, in `resource-pressure.ts`.
15
16
  */
16
17
 
17
18
  /**
@@ -20,7 +21,7 @@ import { C as CreateDocumentCollaborationOptions } from './document-session-opti
20
21
  * Every `max*` value is the cap whose crossing turns the session status terminal.
21
22
  * `tombstonedNodes` is included in `nodes`: a tombstone is never map-deleted, so it keeps
22
23
  * counting against `maxNodes` for the life of the room. A reading is a snapshot — take a new
23
- * one to observe growth.
24
+ * one to observe growth, or subscribe with `subscribeResourcePressure`.
24
25
  *
25
26
  * @public
26
27
  */
@@ -62,6 +63,59 @@ interface CollaborationResourceUsage {
62
63
  */
63
64
  declare function readCollaborationResourceUsage(ydoc: Y.Doc): CollaborationResourceUsage;
64
65
 
66
+ /**
67
+ * How close a room is to the caps that end it, and a push signal when it gets close.
68
+ *
69
+ * A room only grows: deletion is a tombstone, and deleted blob bytes stay in the shared blob
70
+ * map. Every record, tombstones included, counts against `maxNodes`, so a long-lived room walks
71
+ * toward a terminal `too-many-nodes`. Until compaction exists (issue #554), a host that is told
72
+ * before the cap can export the room and seed a new one.
73
+ *
74
+ * The enforcement and the push signal read the same levels, so a notification never claims
75
+ * more headroom than `limitFailure` allows.
76
+ */
77
+
78
+ /**
79
+ * A cap whose crossing ends a room.
80
+ *
81
+ * - `nodes`: document node records, deleted nodes included.
82
+ * - `parts`: package parts.
83
+ * - `relationships`: relationship records.
84
+ * - `blobBytes`: bytes in the shared blob map, including bytes no part references any more.
85
+ *
86
+ * @public
87
+ */
88
+ type CollaborationResourceLimit = 'nodes' | 'parts' | 'relationships' | 'blobBytes';
89
+ /**
90
+ * The cap a room is closest to, delivered when the room crosses a threshold.
91
+ *
92
+ * @public
93
+ */
94
+ interface CollaborationResourcePressure {
95
+ /** The cap with the highest fraction used. */
96
+ readonly limit: CollaborationResourceLimit;
97
+ /** `used / max` for that cap. A value over 1 means the cap is crossed and the room has ended. */
98
+ readonly fraction: number;
99
+ /** The highest threshold `fraction` reaches, or 0 when it is below every threshold. */
100
+ readonly threshold: number;
101
+ /** The replicated count for that cap. */
102
+ readonly used: number;
103
+ /** The cap. */
104
+ readonly max: number;
105
+ }
106
+ /**
107
+ * Options for {@link DocumentCollaborationSession.subscribeResourcePressure}.
108
+ *
109
+ * @public
110
+ */
111
+ interface CollaborationResourcePressureOptions {
112
+ /**
113
+ * Fractions of a cap that notify, each greater than 0 and at most 1. Order and duplicates do
114
+ * not matter. At most 16 values. Default: `[0.75, 0.9]`.
115
+ */
116
+ readonly thresholds?: readonly number[];
117
+ }
118
+
65
119
  /**
66
120
  * Why `beginUndoGroup` refused.
67
121
  *
@@ -136,10 +190,40 @@ interface DocumentCollaborationSession extends EditorCollaborationSession {
136
190
  *
137
191
  * A room only grows — deletion is a tombstone — and the limits that bound hostile
138
192
  * amplification turn terminal when crossed. Watch this to archive and re-room before that
139
- * happens. The tombstone count walks the node map once per call, so read it on your own
140
- * schedule rather than per keystroke.
193
+ * happens. The tombstone and formatting marker counts walk the node map once per call, so
194
+ * read it on your own schedule rather than per keystroke. To be told when growth matters, use
195
+ * {@link DocumentCollaborationSession.subscribeResourcePressure}.
141
196
  */
142
197
  resourceUsage(): CollaborationResourceUsage;
198
+ /**
199
+ * Call `listener` when the room crosses a fraction of any cap that would end it.
200
+ *
201
+ * The session checks the caps after every local or remote transaction. The node count is
202
+ * maintained, and the part, relationship and media totals are measured again only after
203
+ * they change, so typing costs no walk of the document. `listener` runs when the highest
204
+ * threshold the room reaches changes, in either direction: a lower `threshold` (0 below
205
+ * every threshold) tells the host to clear its warning. It also runs once, synchronously, at subscription when the room
206
+ * already reaches a threshold, so a participant joining a large room learns of it at once.
207
+ *
208
+ * The reading names the cap closest to its limit. Call
209
+ * {@link DocumentCollaborationSession.resourceUsage} for every count. Destroying the session
210
+ * ends every subscription. A listener that throws is reported with `console.error` and does
211
+ * not stop the edit or other listeners.
212
+ *
213
+ * @param options - `thresholds` sets the fractions that notify. Default: `[0.75, 0.9]`.
214
+ * @returns A function that ends the subscription.
215
+ * @throws RangeError when `thresholds` is empty, holds more than 16 values, or holds a value
216
+ * that is not greater than 0 and at most 1.
217
+ *
218
+ * @example
219
+ * ```ts
220
+ * const stop = session.subscribeResourcePressure(({ limit, fraction, threshold }) => {
221
+ * if (threshold === 0) hideRoomSizeWarning();
222
+ * else showRoomSizeWarning(limit, fraction); // Export the room and create a new one.
223
+ * });
224
+ * ```
225
+ */
226
+ subscribeResourcePressure(listener: (pressure: CollaborationResourcePressure) => void, options?: CollaborationResourcePressureOptions): () => void;
143
227
  /**
144
228
  * Open an explicit undo group: every local write this session publishes until `end()` is
145
229
  * one undo step. For a server or headless replica, such as an agent's.
@@ -159,9 +243,10 @@ interface DocumentCollaborationSession extends EditorCollaborationSession {
159
243
  * - A refused write does not end the group. Later writes join the same step as the
160
244
  * earlier ones. To revert the whole operation, end the group and call `undo()` once.
161
245
  * - Only local writes join the group. Other participants' edits stay out of it, and an
162
- * undo of the group keeps them. It can also remove text that others typed in a
163
- * paragraph the group inserted (#1398). When they removed everything the group wrote,
164
- * its undo changes nothing and never reverts an older step.
246
+ * undo of the group keeps them. Text that others typed in a paragraph the group
247
+ * inserted joins the paragraph before it, or the paragraph after it when none comes
248
+ * before. When they removed everything the group wrote, its undo changes nothing and
249
+ * never reverts an older step.
165
250
  * - An undo of an ungrouped step never reverts a group's step below it. Ungrouped history
166
251
  * otherwise undoes as it does without groups. If a peer removed everything that the top
167
252
  * ungrouped step wrote, that `undo()` changes nothing and returns true. Call `undo()`
@@ -238,5 +323,5 @@ type DocumentCollaborationHandle = CollaborationHandle<DocumentCollaborationSess
238
323
  */
239
324
  declare function createDocumentCollaboration(options: CreateDocumentCollaborationOptions): Promise<DocumentCollaborationHandle>;
240
325
 
241
- export { CollaborationUndoGroupError as b, createDocumentCollaboration as e, readCollaborationResourceUsage as r };
242
- export type { CollaborationResourceUsage as C, DocumentCollaborationHandle as D, CollaborationUndoGroup as a, CollaborationUndoGroupErrorCode as c, DocumentCollaborationSession as d };
326
+ export { CollaborationUndoGroupError as e, createDocumentCollaboration as h, readCollaborationResourceUsage as r };
327
+ export type { CollaborationResourceLimit as C, DocumentCollaborationHandle as D, CollaborationResourcePressure as a, CollaborationResourcePressureOptions as b, CollaborationResourceUsage as c, CollaborationUndoGroup as d, CollaborationUndoGroupErrorCode as f, DocumentCollaborationSession as g };
@@ -0,0 +1 @@
1
+ 'use strict';var chunk5HK5RAD7_cjs=require('./chunk-5HK5RAD7.cjs');Object.defineProperty(exports,"ATTACH_WATCHDOG_MS_FOR_TESTS",{enumerable:true,get:function(){return chunk5HK5RAD7_cjs.h}});Object.defineProperty(exports,"createDocumentCollaboration",{enumerable:true,get:function(){return chunk5HK5RAD7_cjs.r}});Object.defineProperty(exports,"readCollaborationDocument",{enumerable:true,get:function(){return chunk5HK5RAD7_cjs.q}});
@@ -0,0 +1 @@
1
+ export{h as ATTACH_WATCHDOG_MS_FOR_TESTS,r as createDocumentCollaboration,q as readCollaborationDocument}from'./chunk-4TS2D6OV.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkZZ33FL6V_cjs=require('../chunk-ZZ33FL6V.cjs');require('../chunk-IULA3QRZ.cjs');Object.defineProperty(exports,"drawingModule",{enumerable:true,get:function(){return chunkZZ33FL6V_cjs.b}});Object.defineProperty(exports,"installDrawing",{enumerable:true,get:function(){return chunkZZ33FL6V_cjs.a}});
@@ -0,0 +1,112 @@
1
+ /**
2
+ * `@docx-editor.dev/pro/drawing` — advanced drawing rendering.
3
+ *
4
+ * The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
5
+ * shadows, text boxes, groups, canvases, text watermarks, and every SmartArt diagram saved
6
+ * with its drawing. This module adds:
7
+ *
8
+ * - charts, drawn from the values cached in their chart parts. Treemap, sunburst and map
9
+ * charts, and charts that mix a pie or radar plot with other plot types, do not render;
10
+ * - the layout of a SmartArt diagram saved without its drawing;
11
+ * - shape and picture effects: glow, inner shadow, reflection, soft edge, and the rim of a
12
+ * dark-edged bevel;
13
+ * - WordArt: VML text paths outside a watermark, fitted to the shape, between two guides, or
14
+ * along an arch, with gradient fills, shadows and 3-D extrusion;
15
+ * - EMF and WMF pictures: a vector replay for PDF export, and a browser raster that honors a
16
+ * metafile's own drawing origin.
17
+ *
18
+ * Without it, or for a chart it does not render, a chart saved with a fallback picture or
19
+ * drawing shows that fallback. In every state a chart selects as an object: picture commands
20
+ * are refused, and deleting it removes the chart with its fallback, as one tracked deletion
21
+ * of the whole chart when change tracking is on. Copy and cut of a selection that includes a
22
+ * chart are refused. The editor shows a labeled placeholder for other visible charts with
23
+ * usable bounds, including a skipped `mc:Choice` with an empty `mc:Fallback`, and a diagram
24
+ * saved without its drawing, and inline WordArt; floating WordArt does not show. The editor still rasterizes
25
+ * EMF and WMF pictures, and a shape paints without those effects. PDF export always includes
26
+ * this module.
27
+ *
28
+ * The renderers serve every editor and export in the process. Install them before any
29
+ * document opens; a later install logs a console warning once. `reviewModule()` installs them
30
+ * too. The metafile replay and `emf-converter` load on first use, only when a document holds a
31
+ * metafile picture.
32
+ *
33
+ * @example Enable advanced drawing rendering in an editor
34
+ * ```ts
35
+ * import { createDocxEditor } from '@docx-editor.dev/core/editor';
36
+ * import { drawingModule } from '@docx-editor.dev/pro/drawing';
37
+ *
38
+ * // Next.js; with Vite, read import.meta.env.VITE_DOCX_LICENSE.
39
+ * const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_DOCX_LICENSE })];
40
+ * const editor = createDocxEditor({ document: bytes, modules });
41
+ * ```
42
+ *
43
+ * @packageDocumentation
44
+ * @public
45
+ */
46
+ import { EditorModule } from '@docx-editor.dev/core/editor';
47
+ import { P as ProLicenseOptions } from '../license-D-ds5Y7c.cjs';
48
+
49
+ /**
50
+ * `@docx-editor.dev/pro/drawing` — advanced drawing rendering.
51
+ *
52
+ * The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
53
+ * shadows, text boxes, groups, canvases, text watermarks, and every SmartArt diagram saved
54
+ * with its drawing. This module adds:
55
+ *
56
+ * - charts, drawn from the values cached in their chart parts. Treemap, sunburst and map
57
+ * charts, and charts that mix a pie or radar plot with other plot types, do not render;
58
+ * - the layout of a SmartArt diagram saved without its drawing;
59
+ * - shape and picture effects: glow, inner shadow, reflection, soft edge, and the rim of a
60
+ * dark-edged bevel;
61
+ * - WordArt: VML text paths outside a watermark, fitted to the shape, between two guides, or
62
+ * along an arch, with gradient fills, shadows and 3-D extrusion;
63
+ * - EMF and WMF pictures: a vector replay for PDF export, and a browser raster that honors a
64
+ * metafile's own drawing origin.
65
+ *
66
+ * Without it, or for a chart it does not render, a chart saved with a fallback picture or
67
+ * drawing shows that fallback. In every state a chart selects as an object: picture commands
68
+ * are refused, and deleting it removes the chart with its fallback, as one tracked deletion
69
+ * of the whole chart when change tracking is on. Copy and cut of a selection that includes a
70
+ * chart are refused. The editor shows a labeled placeholder for other visible charts with
71
+ * usable bounds, including a skipped `mc:Choice` with an empty `mc:Fallback`, and a diagram
72
+ * saved without its drawing, and inline WordArt; floating WordArt does not show. The editor still rasterizes
73
+ * EMF and WMF pictures, and a shape paints without those effects. PDF export always includes
74
+ * this module.
75
+ *
76
+ * The renderers serve every editor and export in the process. Install them before any
77
+ * document opens; a later install logs a console warning once. `reviewModule()` installs them
78
+ * too. The metafile replay and `emf-converter` load on first use, only when a document holds a
79
+ * metafile picture.
80
+ *
81
+ * @example Enable advanced drawing rendering in an editor
82
+ * ```ts
83
+ * import { createDocxEditor } from '@docx-editor.dev/core/editor';
84
+ * import { drawingModule } from '@docx-editor.dev/pro/drawing';
85
+ *
86
+ * // Next.js; with Vite, read import.meta.env.VITE_DOCX_LICENSE.
87
+ * const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_DOCX_LICENSE })];
88
+ * const editor = createDocxEditor({ document: bytes, modules });
89
+ * ```
90
+ *
91
+ * @packageDocumentation
92
+ * @public
93
+ */
94
+
95
+ /**
96
+ * Install the drawing renderers (charts, SmartArt layout, effects, WordArt, and metafiles) for
97
+ * every editor and export in this process, without an editor module: for headless
98
+ * conversion. Installing again is harmless. A host without the EigenPal Pro License leaves
99
+ * this call out; its charts then show their fallback pictures or drawings, or placeholders.
100
+ *
101
+ * @public
102
+ */
103
+ declare function installDrawing(options?: ProLicenseOptions): void;
104
+ /**
105
+ * The drawing module for `createDocxEditor({ modules })`. Creating it installs the drawing
106
+ * renderers process-wide, as {@link installDrawing} does.
107
+ *
108
+ * @public
109
+ */
110
+ declare function drawingModule(options?: ProLicenseOptions): EditorModule;
111
+
112
+ export { ProLicenseOptions, drawingModule, installDrawing };
@@ -0,0 +1,112 @@
1
+ /**
2
+ * `@docx-editor.dev/pro/drawing` — advanced drawing rendering.
3
+ *
4
+ * The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
5
+ * shadows, text boxes, groups, canvases, text watermarks, and every SmartArt diagram saved
6
+ * with its drawing. This module adds:
7
+ *
8
+ * - charts, drawn from the values cached in their chart parts. Treemap, sunburst and map
9
+ * charts, and charts that mix a pie or radar plot with other plot types, do not render;
10
+ * - the layout of a SmartArt diagram saved without its drawing;
11
+ * - shape and picture effects: glow, inner shadow, reflection, soft edge, and the rim of a
12
+ * dark-edged bevel;
13
+ * - WordArt: VML text paths outside a watermark, fitted to the shape, between two guides, or
14
+ * along an arch, with gradient fills, shadows and 3-D extrusion;
15
+ * - EMF and WMF pictures: a vector replay for PDF export, and a browser raster that honors a
16
+ * metafile's own drawing origin.
17
+ *
18
+ * Without it, or for a chart it does not render, a chart saved with a fallback picture or
19
+ * drawing shows that fallback. In every state a chart selects as an object: picture commands
20
+ * are refused, and deleting it removes the chart with its fallback, as one tracked deletion
21
+ * of the whole chart when change tracking is on. Copy and cut of a selection that includes a
22
+ * chart are refused. The editor shows a labeled placeholder for other visible charts with
23
+ * usable bounds, including a skipped `mc:Choice` with an empty `mc:Fallback`, and a diagram
24
+ * saved without its drawing, and inline WordArt; floating WordArt does not show. The editor still rasterizes
25
+ * EMF and WMF pictures, and a shape paints without those effects. PDF export always includes
26
+ * this module.
27
+ *
28
+ * The renderers serve every editor and export in the process. Install them before any
29
+ * document opens; a later install logs a console warning once. `reviewModule()` installs them
30
+ * too. The metafile replay and `emf-converter` load on first use, only when a document holds a
31
+ * metafile picture.
32
+ *
33
+ * @example Enable advanced drawing rendering in an editor
34
+ * ```ts
35
+ * import { createDocxEditor } from '@docx-editor.dev/core/editor';
36
+ * import { drawingModule } from '@docx-editor.dev/pro/drawing';
37
+ *
38
+ * // Next.js; with Vite, read import.meta.env.VITE_DOCX_LICENSE.
39
+ * const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_DOCX_LICENSE })];
40
+ * const editor = createDocxEditor({ document: bytes, modules });
41
+ * ```
42
+ *
43
+ * @packageDocumentation
44
+ * @public
45
+ */
46
+ import { EditorModule } from '@docx-editor.dev/core/editor';
47
+ import { P as ProLicenseOptions } from '../license-D-ds5Y7c.js';
48
+
49
+ /**
50
+ * `@docx-editor.dev/pro/drawing` — advanced drawing rendering.
51
+ *
52
+ * The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
53
+ * shadows, text boxes, groups, canvases, text watermarks, and every SmartArt diagram saved
54
+ * with its drawing. This module adds:
55
+ *
56
+ * - charts, drawn from the values cached in their chart parts. Treemap, sunburst and map
57
+ * charts, and charts that mix a pie or radar plot with other plot types, do not render;
58
+ * - the layout of a SmartArt diagram saved without its drawing;
59
+ * - shape and picture effects: glow, inner shadow, reflection, soft edge, and the rim of a
60
+ * dark-edged bevel;
61
+ * - WordArt: VML text paths outside a watermark, fitted to the shape, between two guides, or
62
+ * along an arch, with gradient fills, shadows and 3-D extrusion;
63
+ * - EMF and WMF pictures: a vector replay for PDF export, and a browser raster that honors a
64
+ * metafile's own drawing origin.
65
+ *
66
+ * Without it, or for a chart it does not render, a chart saved with a fallback picture or
67
+ * drawing shows that fallback. In every state a chart selects as an object: picture commands
68
+ * are refused, and deleting it removes the chart with its fallback, as one tracked deletion
69
+ * of the whole chart when change tracking is on. Copy and cut of a selection that includes a
70
+ * chart are refused. The editor shows a labeled placeholder for other visible charts with
71
+ * usable bounds, including a skipped `mc:Choice` with an empty `mc:Fallback`, and a diagram
72
+ * saved without its drawing, and inline WordArt; floating WordArt does not show. The editor still rasterizes
73
+ * EMF and WMF pictures, and a shape paints without those effects. PDF export always includes
74
+ * this module.
75
+ *
76
+ * The renderers serve every editor and export in the process. Install them before any
77
+ * document opens; a later install logs a console warning once. `reviewModule()` installs them
78
+ * too. The metafile replay and `emf-converter` load on first use, only when a document holds a
79
+ * metafile picture.
80
+ *
81
+ * @example Enable advanced drawing rendering in an editor
82
+ * ```ts
83
+ * import { createDocxEditor } from '@docx-editor.dev/core/editor';
84
+ * import { drawingModule } from '@docx-editor.dev/pro/drawing';
85
+ *
86
+ * // Next.js; with Vite, read import.meta.env.VITE_DOCX_LICENSE.
87
+ * const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_DOCX_LICENSE })];
88
+ * const editor = createDocxEditor({ document: bytes, modules });
89
+ * ```
90
+ *
91
+ * @packageDocumentation
92
+ * @public
93
+ */
94
+
95
+ /**
96
+ * Install the drawing renderers (charts, SmartArt layout, effects, WordArt, and metafiles) for
97
+ * every editor and export in this process, without an editor module: for headless
98
+ * conversion. Installing again is harmless. A host without the EigenPal Pro License leaves
99
+ * this call out; its charts then show their fallback pictures or drawings, or placeholders.
100
+ *
101
+ * @public
102
+ */
103
+ declare function installDrawing(options?: ProLicenseOptions): void;
104
+ /**
105
+ * The drawing module for `createDocxEditor({ modules })`. Creating it installs the drawing
106
+ * renderers process-wide, as {@link installDrawing} does.
107
+ *
108
+ * @public
109
+ */
110
+ declare function drawingModule(options?: ProLicenseOptions): EditorModule;
111
+
112
+ export { ProLicenseOptions, drawingModule, installDrawing };
@@ -0,0 +1 @@
1
+ export{b as drawingModule,a as installDrawing}from'../chunk-ZMBZ7CWZ.js';import'../chunk-HMU7J34H.js';
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkI6HVINA4_cjs=require('./chunk-I6HVINA4.cjs'),chunkQLZH2Q2C_cjs=require('./chunk-QLZH2Q2C.cjs'),store=require('@docx-editor.dev/core/store');function U(t,n={}){let r=L(t);if(!r)return [];let o=n.nodes??t.getCustomNodeDefinitions().filter(chunkI6HVINA4_cjs.j);if(o.length===0)return [];let s=r.session.currentPackage(),d=r.session.part().name,m=n.onDiagnostic??(e=>{t.reportCustomNodeDiagnostic(e);});return r.session.storyParts().flatMap(e=>chunkI6HVINA4_cjs.n(e,o,{payloads:store.customNodePayloadsByControl(s,e.name,d),onDiagnostic:m}))}function L(t){return t.surface??null}function E(t,n,r={}){if(r.destination==="internal")return {ok:true,bytes:t,unwrapped:0,removed:0};let o=store.readOoxmlPackage(t);if(!o.ok)return {ok:false,reason:`the document could not be read: ${o.reason}`};let s=new Map;for(let i of n)s.set(`${i.tagPrefix}:${i.name}`,i);let d=i=>{let p=chunkI6HVINA4_cjs.c(i);if(!p)return "keep";let x=s.get(`${p.prefix}:${p.name}`);return x?x.preserveOnExport==="text"?"text":x.preserveOnExport===false?"remove":"keep":"keep"},m=[...new Set(n.filter(i=>i.preserveOnExport!==void 0).filter(i=>i.preserveOnExport!==true).map(chunkI6HVINA4_cjs.h))],e=o.package,u=0,c=0,g=V(e);for(let i of g){let p=store.withExportedCustomNodes(e,{storyPartName:i,namespaces:[],decide:d});if(!p.ok)return {ok:false,reason:p.reason};e=p.pkg,u+=p.unwrapped,c+=p.removed;}let l=store.withExportedCustomNodes(e,{storyPartName:e.mainDocumentPart,namespaces:m,decide:()=>"keep"});return l.ok?(e=l.pkg,{ok:true,bytes:store.writeOoxmlPackage(e),unwrapped:u,removed:c}):{ok:false,reason:l.reason}}function V(t){let n=[];for(let[r,o]of t.parts)r!==t.mainDocumentPart&&store.isStoryPart(o)&&n.push(r);return [t.mainDocumentPart,...n]}async function G(t,n={}){let r=n.nodes??t.getCustomNodeDefinitions().filter(chunkI6HVINA4_cjs.j),o=await t.save();return E(new Uint8Array(o),r,{...n.destination===void 0?{}:{destination:n.destination}})}function a(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function K(t,n,r,o={}){if(!chunkI6HVINA4_cjs.k.test(t.tagPrefix)||!chunkI6HVINA4_cjs.k.test(t.name))return {ok:false,code:"invalidArgs",reason:"the definition identity must match defineCustomNode\u2019s charset ([A-Za-z0-9_.-])"};let s=chunkI6HVINA4_cjs.b(t.tagPrefix,t.name,n);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 shorten the attrs`};let d=o.lock===void 0?"contentLocked":o.lock,m=o.id!==void 0&&Number.isInteger(o.id)&&o.id>0?o.id:store.fnv1a32(`${s.tag}\0${r}`)&2147483647||1,e=o.data===void 0?null:Q(t,o,r);if(e&&"reason"in e)return {ok:false,code:"invalidArgs",reason:e.reason};let u=(o.alias!==void 0?`<w:alias w:val="${a(o.alias)}"/>`:"")+`<w:tag w:val="${a(s.tag)}"/><w:id w:val="${m}"/>`+(d===false?"":`<w:lock w:val="${d}"/>`)+(e?`<w:dataBinding w:prefixMappings="${a(e.binding.prefixMappings)}" w:xpath="${a(e.binding.xpath)}" w:storeItemID="${a(e.binding.storeItemId)}"/>`:""),c=`<w:r><w:t xml:space="preserve">${a(r)}</w:t></w:r>`;return {ok:true,xml:`<w:sdt><w:sdtPr>${u}</w:sdtPr><w:sdtContent>${c}</w:sdtContent></w:sdt>`,...e?{store:e.store}:{}}}function Q(t,n,r){let o=chunkI6HVINA4_cjs.i(t,n.data);if(!o.ok)return {reason:o.reason};let s=chunkI6HVINA4_cjs.h(t),d=n.storeIndex!==void 0&&Number.isInteger(n.storeIndex)&&n.storeIndex>0?n.storeIndex:1,m=n.nodeId??"cx1",e=`/customXml/item${String(d)}.xml`,u=`/customXml/itemProps${String(d)}.xml`,c=store.datastoreItemIdFor(`${s} ${e} ${m}`),g=store.customNodeBinding({partName:e,propsPartName:u,itemId:c,namespaceUri:s},chunkI6HVINA4_cjs.g,m);if(!g)return {reason:`the payload cannot be addressed by an XPath: check nodeId (${m}) and payloadNamespace`};let l=r===r.trim()?`<label>${a(r)}</label>`:`<label xml:space="preserve">${a(r)}</label>`;return {binding:g,store:{itemPartName:e,itemXml:`<${chunkI6HVINA4_cjs.g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${chunkI6HVINA4_cjs.g}>`,propsPartName:u,propsXml:`<ds:datastoreItem ds:itemID="${a(c)}" xmlns:ds="${store.DATASTORE_NAMESPACE_URI}"><ds:schemaRefs><ds:schemaRef ds:uri="${a(s)}"/></ds:schemaRefs></ds:datastoreItem>`,storeItemId:c,relationships:[{from:"/word/document.xml",type:store.CUSTOM_XML_REL,target:`../customXml/item${String(d)}.xml`},{from:e,type:store.CUSTOM_XML_PROPS_REL,target:`itemProps${String(d)}.xml`}],contentTypeOverride:{partName:u,contentType:store.CUSTOM_XML_PROPS_TYPE}}}}Object.defineProperty(exports,"CUSTOM_NODE_STORE_ROOT",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.g}});Object.defineProperty(exports,"MAX_CUSTOM_NODE_DATA_LENGTH",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.d}});Object.defineProperty(exports,"MAX_TAG_LENGTH",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.a}});Object.defineProperty(exports,"customNodeNamespace",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.h}});Object.defineProperty(exports,"customNodesModule",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.m}});Object.defineProperty(exports,"decodeCustomNodeTag",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.c}});Object.defineProperty(exports,"defineCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.l}});Object.defineProperty(exports,"encodeCustomNodeTag",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.b}});Object.defineProperty(exports,"insertCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.p}});Object.defineProperty(exports,"isCustomNodeDefinition",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.j}});Object.defineProperty(exports,"parseCustomNodeData",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.e}});Object.defineProperty(exports,"recognizeCustomNodes",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.n}});Object.defineProperty(exports,"removeCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.q}});Object.defineProperty(exports,"reviewModule",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.o}});Object.defineProperty(exports,"serializeCustomNodeData",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.f}});Object.defineProperty(exports,"updateCustomNode",{enumerable:true,get:function(){return chunkI6HVINA4_cjs.r}});Object.defineProperty(exports,"collaborationModule",{enumerable:true,get:function(){return chunkQLZH2Q2C_cjs.b}});exports.customNodeXml=K;exports.customNodesOf=U;exports.prepareForExport=E;exports.saveForExport=G;
1
+ 'use strict';var chunkL6ZMFFBX_cjs=require('./chunk-L6ZMFFBX.cjs'),chunkQEULTKCT_cjs=require('./chunk-QEULTKCT.cjs');require('./chunk-ZZ33FL6V.cjs'),require('./chunk-IULA3QRZ.cjs');var store=require('@docx-editor.dev/core/store');function U(t,n={}){let r=L(t);if(!r)return [];let o=n.nodes??t.getCustomNodeDefinitions().filter(chunkL6ZMFFBX_cjs.j);if(o.length===0)return [];let s=r.session.currentPackage(),d=r.session.part().name,m=n.onDiagnostic??(e=>{t.reportCustomNodeDiagnostic(e);});return r.session.storyParts().flatMap(e=>chunkL6ZMFFBX_cjs.n(e,o,{payloads:store.customNodePayloadsByControl(s,e.name,d),onDiagnostic:m}))}function L(t){return t.surface??null}function E(t,n,r={}){if(r.destination==="internal")return {ok:true,bytes:t,unwrapped:0,removed:0};let o=store.readOoxmlPackage(t);if(!o.ok)return {ok:false,reason:`the document could not be read: ${o.reason}`};let s=new Map;for(let i of n)s.set(`${i.tagPrefix}:${i.name}`,i);let d=i=>{let p=chunkL6ZMFFBX_cjs.c(i);if(!p)return "keep";let x=s.get(`${p.prefix}:${p.name}`);return x?x.preserveOnExport==="text"?"text":x.preserveOnExport===false?"remove":"keep":"keep"},m=[...new Set(n.filter(i=>i.preserveOnExport!==void 0).filter(i=>i.preserveOnExport!==true).map(chunkL6ZMFFBX_cjs.h))],e=o.package,u=0,c=0,g=V(e);for(let i of g){let p=store.withExportedCustomNodes(e,{storyPartName:i,namespaces:[],decide:d});if(!p.ok)return {ok:false,reason:p.reason};e=p.pkg,u+=p.unwrapped,c+=p.removed;}let l=store.withExportedCustomNodes(e,{storyPartName:e.mainDocumentPart,namespaces:m,decide:()=>"keep"});return l.ok?(e=l.pkg,{ok:true,bytes:store.writeOoxmlPackage(e),unwrapped:u,removed:c}):{ok:false,reason:l.reason}}function V(t){let n=[];for(let[r,o]of t.parts)r!==t.mainDocumentPart&&store.isStoryPart(o)&&n.push(r);return [t.mainDocumentPart,...n]}async function G(t,n={}){let r=n.nodes??t.getCustomNodeDefinitions().filter(chunkL6ZMFFBX_cjs.j),o=await t.save();return E(new Uint8Array(o),r,{...n.destination===void 0?{}:{destination:n.destination}})}function a(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function K(t,n,r,o={}){if(!chunkL6ZMFFBX_cjs.k.test(t.tagPrefix)||!chunkL6ZMFFBX_cjs.k.test(t.name))return {ok:false,code:"invalidArgs",reason:"the definition identity must match defineCustomNode\u2019s charset ([A-Za-z0-9_.-])"};let s=chunkL6ZMFFBX_cjs.b(t.tagPrefix,t.name,n);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 shorten the attrs`};let d=o.lock===void 0?"contentLocked":o.lock,m=o.id!==void 0&&Number.isInteger(o.id)&&o.id>0?o.id:store.fnv1a32(`${s.tag}\0${r}`)&2147483647||1,e=o.data===void 0?null:Q(t,o,r);if(e&&"reason"in e)return {ok:false,code:"invalidArgs",reason:e.reason};let u=(o.alias!==void 0?`<w:alias w:val="${a(o.alias)}"/>`:"")+`<w:tag w:val="${a(s.tag)}"/><w:id w:val="${m}"/>`+(d===false?"":`<w:lock w:val="${d}"/>`)+(e?`<w:dataBinding w:prefixMappings="${a(e.binding.prefixMappings)}" w:xpath="${a(e.binding.xpath)}" w:storeItemID="${a(e.binding.storeItemId)}"/>`:""),c=`<w:r><w:t xml:space="preserve">${a(r)}</w:t></w:r>`;return {ok:true,xml:`<w:sdt><w:sdtPr>${u}</w:sdtPr><w:sdtContent>${c}</w:sdtContent></w:sdt>`,...e?{store:e.store}:{}}}function Q(t,n,r){let o=chunkL6ZMFFBX_cjs.i(t,n.data);if(!o.ok)return {reason:o.reason};let s=chunkL6ZMFFBX_cjs.h(t),d=n.storeIndex!==void 0&&Number.isInteger(n.storeIndex)&&n.storeIndex>0?n.storeIndex:1,m=n.nodeId??"cx1",e=`/customXml/item${String(d)}.xml`,u=`/customXml/itemProps${String(d)}.xml`,c=store.datastoreItemIdFor(`${s} ${e} ${m}`),g=store.customNodeBinding({partName:e,propsPartName:u,itemId:c,namespaceUri:s},chunkL6ZMFFBX_cjs.g,m);if(!g)return {reason:`the payload cannot be addressed by an XPath: check nodeId (${m}) and payloadNamespace`};let l=r===r.trim()?`<label>${a(r)}</label>`:`<label xml:space="preserve">${a(r)}</label>`;return {binding:g,store:{itemPartName:e,itemXml:`<${chunkL6ZMFFBX_cjs.g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${chunkL6ZMFFBX_cjs.g}>`,propsPartName:u,propsXml:`<ds:datastoreItem ds:itemID="${a(c)}" xmlns:ds="${store.DATASTORE_NAMESPACE_URI}"><ds:schemaRefs><ds:schemaRef ds:uri="${a(s)}"/></ds:schemaRefs></ds:datastoreItem>`,storeItemId:c,relationships:[{from:"/word/document.xml",type:store.CUSTOM_XML_REL,target:`../customXml/item${String(d)}.xml`},{from:e,type:store.CUSTOM_XML_PROPS_REL,target:`itemProps${String(d)}.xml`}],contentTypeOverride:{partName:u,contentType:store.CUSTOM_XML_PROPS_TYPE}}}}Object.defineProperty(exports,"CUSTOM_NODE_STORE_ROOT",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.g}});Object.defineProperty(exports,"MAX_CUSTOM_NODE_DATA_LENGTH",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.d}});Object.defineProperty(exports,"MAX_TAG_LENGTH",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.a}});Object.defineProperty(exports,"customNodeNamespace",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.h}});Object.defineProperty(exports,"customNodesModule",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.m}});Object.defineProperty(exports,"decodeCustomNodeTag",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.c}});Object.defineProperty(exports,"defineCustomNode",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.l}});Object.defineProperty(exports,"encodeCustomNodeTag",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.b}});Object.defineProperty(exports,"insertCustomNode",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.p}});Object.defineProperty(exports,"isCustomNodeDefinition",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.j}});Object.defineProperty(exports,"parseCustomNodeData",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.e}});Object.defineProperty(exports,"recognizeCustomNodes",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.n}});Object.defineProperty(exports,"removeCustomNode",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.q}});Object.defineProperty(exports,"reviewModule",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.o}});Object.defineProperty(exports,"serializeCustomNodeData",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.f}});Object.defineProperty(exports,"updateCustomNode",{enumerable:true,get:function(){return chunkL6ZMFFBX_cjs.r}});Object.defineProperty(exports,"collaborationModule",{enumerable:true,get:function(){return chunkQEULTKCT_cjs.a}});exports.customNodeXml=K;exports.customNodesOf=U;exports.prepareForExport=E;exports.saveForExport=G;
package/dist/index.d.cts CHANGED
@@ -23,9 +23,10 @@
23
23
  * @packageDocumentation
24
24
  * @public
25
25
  */
26
- import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-CNRQG1TI.cjs';
27
- export { b as ActivatedCustomNode, c as CustomNode, d as CustomNodeDataRejection, e as CustomNodeDataResult, f as CustomNodePayloadSource, g as CustomNodesModuleOptions, h as InferSchemaOutput, M as MAX_CUSTOM_NODE_DATA_LENGTH, i as RecognizeCustomNodesOptions, j as ReviewModuleOptions, k as StandardSchemaIssue, l as StandardSchemaResult, m as customNodesModule, n as defineCustomNode, o as isCustomNodeDefinition, p as parseCustomNodeData, r as recognizeCustomNodes, q as reviewModule, s as serializeCustomNodeData } from './define-custom-node-CNRQG1TI.cjs';
28
- export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-DWn2heE1.cjs';
26
+ import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-CISpZvVB.cjs';
27
+ export { b as ActivatedCustomNode, c as CustomNode, d as CustomNodeDataRejection, e as CustomNodeDataResult, f as CustomNodePayloadSource, g as CustomNodesModuleOptions, h as InferSchemaOutput, M as MAX_CUSTOM_NODE_DATA_LENGTH, i as RecognizeCustomNodesOptions, j as ReviewModuleOptions, k as StandardSchemaIssue, l as StandardSchemaResult, m as customNodesModule, n as defineCustomNode, o as isCustomNodeDefinition, p as parseCustomNodeData, r as recognizeCustomNodes, q as reviewModule, s as serializeCustomNodeData } from './define-custom-node-CISpZvVB.cjs';
28
+ export { C as CollaborationModuleOptions, c as collaborationModule } from './collaboration-module-02CIP5sN.cjs';
29
+ export { P as ProLicenseOptions } from './license-D-ds5Y7c.cjs';
29
30
  import { Editor, ExecResult } from '@docx-editor.dev/core/contracts/editor';
30
31
  export { CommentMarkerStyle, ResolvedReviewPane, ReviewPaneOpening, ReviewPaneOptions, ReviewPaneOverflow, RevisionDisplay } from '@docx-editor.dev/core/editor';
31
32
  import '@docx-editor.dev/core/store';
package/dist/index.d.ts CHANGED
@@ -23,9 +23,10 @@
23
23
  * @packageDocumentation
24
24
  * @public
25
25
  */
26
- import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-D0c36PpZ.js';
27
- export { b as ActivatedCustomNode, c as CustomNode, d as CustomNodeDataRejection, e as CustomNodeDataResult, f as CustomNodePayloadSource, g as CustomNodesModuleOptions, h as InferSchemaOutput, M as MAX_CUSTOM_NODE_DATA_LENGTH, i as RecognizeCustomNodesOptions, j as ReviewModuleOptions, k as StandardSchemaIssue, l as StandardSchemaResult, m as customNodesModule, n as defineCustomNode, o as isCustomNodeDefinition, p as parseCustomNodeData, r as recognizeCustomNodes, q as reviewModule, s as serializeCustomNodeData } from './define-custom-node-D0c36PpZ.js';
28
- export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from './collaboration-module-DWn2heE1.js';
26
+ import { A as AnyCustomNodeDefinition, C as CustomNodeDiagnostic, R as RecognizedCustomNode, S as StandardSchemaV1, I as InferSchemaInput, a as CustomNodeDefinition } from './define-custom-node-DE1KjR1r.js';
27
+ export { b as ActivatedCustomNode, c as CustomNode, d as CustomNodeDataRejection, e as CustomNodeDataResult, f as CustomNodePayloadSource, g as CustomNodesModuleOptions, h as InferSchemaOutput, M as MAX_CUSTOM_NODE_DATA_LENGTH, i as RecognizeCustomNodesOptions, j as ReviewModuleOptions, k as StandardSchemaIssue, l as StandardSchemaResult, m as customNodesModule, n as defineCustomNode, o as isCustomNodeDefinition, p as parseCustomNodeData, r as recognizeCustomNodes, q as reviewModule, s as serializeCustomNodeData } from './define-custom-node-DE1KjR1r.js';
28
+ export { C as CollaborationModuleOptions, c as collaborationModule } from './collaboration-module-COZAgqwg.js';
29
+ export { P as ProLicenseOptions } from './license-D-ds5Y7c.js';
29
30
  import { Editor, ExecResult } from '@docx-editor.dev/core/contracts/editor';
30
31
  export { CommentMarkerStyle, ResolvedReviewPane, ReviewPaneOpening, ReviewPaneOptions, ReviewPaneOverflow, RevisionDisplay } from '@docx-editor.dev/core/editor';
31
32
  import '@docx-editor.dev/core/store';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {j,n,h,k,b,i,g,c}from'./chunk-AVZO5ZHZ.js';export{g as CUSTOM_NODE_STORE_ROOT,d as MAX_CUSTOM_NODE_DATA_LENGTH,a as MAX_TAG_LENGTH,h as customNodeNamespace,m as customNodesModule,c as decodeCustomNodeTag,l as defineCustomNode,b as encodeCustomNodeTag,p as insertCustomNode,j as isCustomNodeDefinition,e as parseCustomNodeData,n as recognizeCustomNodes,q as removeCustomNode,o as reviewModule,f as serializeCustomNodeData,r as updateCustomNode}from'./chunk-AVZO5ZHZ.js';export{b as collaborationModule}from'./chunk-Q2VBO66F.js';import {customNodePayloadsByControl,readOoxmlPackage,withExportedCustomNodes,writeOoxmlPackage,isStoryPart,fnv1a32,datastoreItemIdFor,customNodeBinding,CUSTOM_XML_PROPS_TYPE,CUSTOM_XML_REL,CUSTOM_XML_PROPS_REL,DATASTORE_NAMESPACE_URI}from'@docx-editor.dev/core/store';function U(t,n$1={}){let r=L(t);if(!r)return [];let o=n$1.nodes??t.getCustomNodeDefinitions().filter(j);if(o.length===0)return [];let s=r.session.currentPackage(),d=r.session.part().name,m=n$1.onDiagnostic??(e=>{t.reportCustomNodeDiagnostic(e);});return r.session.storyParts().flatMap(e=>n(e,o,{payloads:customNodePayloadsByControl(s,e.name,d),onDiagnostic:m}))}function L(t){return t.surface??null}function E(t,n,r={}){if(r.destination==="internal")return {ok:true,bytes:t,unwrapped:0,removed:0};let o=readOoxmlPackage(t);if(!o.ok)return {ok:false,reason:`the document could not be read: ${o.reason}`};let s=new Map;for(let i of n)s.set(`${i.tagPrefix}:${i.name}`,i);let d=i=>{let p=c(i);if(!p)return "keep";let x=s.get(`${p.prefix}:${p.name}`);return x?x.preserveOnExport==="text"?"text":x.preserveOnExport===false?"remove":"keep":"keep"},m=[...new Set(n.filter(i=>i.preserveOnExport!==void 0).filter(i=>i.preserveOnExport!==true).map(h))],e=o.package,u=0,c$1=0,g=V(e);for(let i of g){let p=withExportedCustomNodes(e,{storyPartName:i,namespaces:[],decide:d});if(!p.ok)return {ok:false,reason:p.reason};e=p.pkg,u+=p.unwrapped,c$1+=p.removed;}let l=withExportedCustomNodes(e,{storyPartName:e.mainDocumentPart,namespaces:m,decide:()=>"keep"});return l.ok?(e=l.pkg,{ok:true,bytes:writeOoxmlPackage(e),unwrapped:u,removed:c$1}):{ok:false,reason:l.reason}}function V(t){let n=[];for(let[r,o]of t.parts)r!==t.mainDocumentPart&&isStoryPart(o)&&n.push(r);return [t.mainDocumentPart,...n]}async function G(t,n={}){let r=n.nodes??t.getCustomNodeDefinitions().filter(j),o=await t.save();return E(new Uint8Array(o),r,{...n.destination===void 0?{}:{destination:n.destination}})}function a(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function K(t,n,r,o={}){if(!k.test(t.tagPrefix)||!k.test(t.name))return {ok:false,code:"invalidArgs",reason:"the definition identity must match defineCustomNode\u2019s charset ([A-Za-z0-9_.-])"};let s=b(t.tagPrefix,t.name,n);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 shorten the attrs`};let d=o.lock===void 0?"contentLocked":o.lock,m=o.id!==void 0&&Number.isInteger(o.id)&&o.id>0?o.id:fnv1a32(`${s.tag}\0${r}`)&2147483647||1,e=o.data===void 0?null:Q(t,o,r);if(e&&"reason"in e)return {ok:false,code:"invalidArgs",reason:e.reason};let u=(o.alias!==void 0?`<w:alias w:val="${a(o.alias)}"/>`:"")+`<w:tag w:val="${a(s.tag)}"/><w:id w:val="${m}"/>`+(d===false?"":`<w:lock w:val="${d}"/>`)+(e?`<w:dataBinding w:prefixMappings="${a(e.binding.prefixMappings)}" w:xpath="${a(e.binding.xpath)}" w:storeItemID="${a(e.binding.storeItemId)}"/>`:""),c=`<w:r><w:t xml:space="preserve">${a(r)}</w:t></w:r>`;return {ok:true,xml:`<w:sdt><w:sdtPr>${u}</w:sdtPr><w:sdtContent>${c}</w:sdtContent></w:sdt>`,...e?{store:e.store}:{}}}function Q(t,n,r){let o=i(t,n.data);if(!o.ok)return {reason:o.reason};let s=h(t),d=n.storeIndex!==void 0&&Number.isInteger(n.storeIndex)&&n.storeIndex>0?n.storeIndex:1,m=n.nodeId??"cx1",e=`/customXml/item${String(d)}.xml`,u=`/customXml/itemProps${String(d)}.xml`,c=datastoreItemIdFor(`${s} ${e} ${m}`),g$1=customNodeBinding({partName:e,propsPartName:u,itemId:c,namespaceUri:s},g,m);if(!g$1)return {reason:`the payload cannot be addressed by an XPath: check nodeId (${m}) and payloadNamespace`};let l=r===r.trim()?`<label>${a(r)}</label>`:`<label xml:space="preserve">${a(r)}</label>`;return {binding:g$1,store:{itemPartName:e,itemXml:`<${g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${g}>`,propsPartName:u,propsXml:`<ds:datastoreItem ds:itemID="${a(c)}" xmlns:ds="${DATASTORE_NAMESPACE_URI}"><ds:schemaRefs><ds:schemaRef ds:uri="${a(s)}"/></ds:schemaRefs></ds:datastoreItem>`,storeItemId:c,relationships:[{from:"/word/document.xml",type:CUSTOM_XML_REL,target:`../customXml/item${String(d)}.xml`},{from:e,type:CUSTOM_XML_PROPS_REL,target:`itemProps${String(d)}.xml`}],contentTypeOverride:{partName:u,contentType:CUSTOM_XML_PROPS_TYPE}}}}export{K as customNodeXml,U as customNodesOf,E as prepareForExport,G as saveForExport};
1
+ import {j,n,h,k,b,i,g,c}from'./chunk-VQOLBCW6.js';export{g as CUSTOM_NODE_STORE_ROOT,d as MAX_CUSTOM_NODE_DATA_LENGTH,a as MAX_TAG_LENGTH,h as customNodeNamespace,m as customNodesModule,c as decodeCustomNodeTag,l as defineCustomNode,b as encodeCustomNodeTag,p as insertCustomNode,j as isCustomNodeDefinition,e as parseCustomNodeData,n as recognizeCustomNodes,q as removeCustomNode,o as reviewModule,f as serializeCustomNodeData,r as updateCustomNode}from'./chunk-VQOLBCW6.js';export{a as collaborationModule}from'./chunk-EOZ44UA7.js';import'./chunk-ZMBZ7CWZ.js';import'./chunk-HMU7J34H.js';import {customNodePayloadsByControl,readOoxmlPackage,withExportedCustomNodes,writeOoxmlPackage,isStoryPart,fnv1a32,datastoreItemIdFor,customNodeBinding,CUSTOM_XML_PROPS_TYPE,CUSTOM_XML_REL,CUSTOM_XML_PROPS_REL,DATASTORE_NAMESPACE_URI}from'@docx-editor.dev/core/store';function U(t,n$1={}){let r=L(t);if(!r)return [];let o=n$1.nodes??t.getCustomNodeDefinitions().filter(j);if(o.length===0)return [];let s=r.session.currentPackage(),d=r.session.part().name,m=n$1.onDiagnostic??(e=>{t.reportCustomNodeDiagnostic(e);});return r.session.storyParts().flatMap(e=>n(e,o,{payloads:customNodePayloadsByControl(s,e.name,d),onDiagnostic:m}))}function L(t){return t.surface??null}function E(t,n,r={}){if(r.destination==="internal")return {ok:true,bytes:t,unwrapped:0,removed:0};let o=readOoxmlPackage(t);if(!o.ok)return {ok:false,reason:`the document could not be read: ${o.reason}`};let s=new Map;for(let i of n)s.set(`${i.tagPrefix}:${i.name}`,i);let d=i=>{let p=c(i);if(!p)return "keep";let x=s.get(`${p.prefix}:${p.name}`);return x?x.preserveOnExport==="text"?"text":x.preserveOnExport===false?"remove":"keep":"keep"},m=[...new Set(n.filter(i=>i.preserveOnExport!==void 0).filter(i=>i.preserveOnExport!==true).map(h))],e=o.package,u=0,c$1=0,g=V(e);for(let i of g){let p=withExportedCustomNodes(e,{storyPartName:i,namespaces:[],decide:d});if(!p.ok)return {ok:false,reason:p.reason};e=p.pkg,u+=p.unwrapped,c$1+=p.removed;}let l=withExportedCustomNodes(e,{storyPartName:e.mainDocumentPart,namespaces:m,decide:()=>"keep"});return l.ok?(e=l.pkg,{ok:true,bytes:writeOoxmlPackage(e),unwrapped:u,removed:c$1}):{ok:false,reason:l.reason}}function V(t){let n=[];for(let[r,o]of t.parts)r!==t.mainDocumentPart&&isStoryPart(o)&&n.push(r);return [t.mainDocumentPart,...n]}async function G(t,n={}){let r=n.nodes??t.getCustomNodeDefinitions().filter(j),o=await t.save();return E(new Uint8Array(o),r,{...n.destination===void 0?{}:{destination:n.destination}})}function a(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function K(t,n,r,o={}){if(!k.test(t.tagPrefix)||!k.test(t.name))return {ok:false,code:"invalidArgs",reason:"the definition identity must match defineCustomNode\u2019s charset ([A-Za-z0-9_.-])"};let s=b(t.tagPrefix,t.name,n);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 shorten the attrs`};let d=o.lock===void 0?"contentLocked":o.lock,m=o.id!==void 0&&Number.isInteger(o.id)&&o.id>0?o.id:fnv1a32(`${s.tag}\0${r}`)&2147483647||1,e=o.data===void 0?null:Q(t,o,r);if(e&&"reason"in e)return {ok:false,code:"invalidArgs",reason:e.reason};let u=(o.alias!==void 0?`<w:alias w:val="${a(o.alias)}"/>`:"")+`<w:tag w:val="${a(s.tag)}"/><w:id w:val="${m}"/>`+(d===false?"":`<w:lock w:val="${d}"/>`)+(e?`<w:dataBinding w:prefixMappings="${a(e.binding.prefixMappings)}" w:xpath="${a(e.binding.xpath)}" w:storeItemID="${a(e.binding.storeItemId)}"/>`:""),c=`<w:r><w:t xml:space="preserve">${a(r)}</w:t></w:r>`;return {ok:true,xml:`<w:sdt><w:sdtPr>${u}</w:sdtPr><w:sdtContent>${c}</w:sdtContent></w:sdt>`,...e?{store:e.store}:{}}}function Q(t,n,r){let o=i(t,n.data);if(!o.ok)return {reason:o.reason};let s=h(t),d=n.storeIndex!==void 0&&Number.isInteger(n.storeIndex)&&n.storeIndex>0?n.storeIndex:1,m=n.nodeId??"cx1",e=`/customXml/item${String(d)}.xml`,u=`/customXml/itemProps${String(d)}.xml`,c=datastoreItemIdFor(`${s} ${e} ${m}`),g$1=customNodeBinding({partName:e,propsPartName:u,itemId:c,namespaceUri:s},g,m);if(!g$1)return {reason:`the payload cannot be addressed by an XPath: check nodeId (${m}) and payloadNamespace`};let l=r===r.trim()?`<label>${a(r)}</label>`:`<label xml:space="preserve">${a(r)}</label>`;return {binding:g$1,store:{itemPartName:e,itemXml:`<${g} xmlns="${a(s)}"><node id="${a(m)}">${l}<data>${a(o.data)}</data></node></${g}>`,propsPartName:u,propsXml:`<ds:datastoreItem ds:itemID="${a(c)}" xmlns:ds="${DATASTORE_NAMESPACE_URI}"><ds:schemaRefs><ds:schemaRef ds:uri="${a(s)}"/></ds:schemaRefs></ds:datastoreItem>`,storeItemId:c,relationships:[{from:"/word/document.xml",type:CUSTOM_XML_REL,target:`../customXml/item${String(d)}.xml`},{from:e,type:CUSTOM_XML_PROPS_REL,target:`itemProps${String(d)}.xml`}],contentTypeOverride:{partName:u,contentType:CUSTOM_XML_PROPS_TYPE}}}}export{K as customNodeXml,U as customNodesOf,E as prepareForExport,G as saveForExport};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensing, v1: honor system.
3
+ *
4
+ * The key is accepted and remembered so that adding offline (Ed25519)
5
+ * verification later is not a breaking change — but nothing validates it,
6
+ * nothing warns, nothing renders differently, and NOTHING EVER LEAVES THE
7
+ * PROCESS: no network request is made for licensing, ever. That last property
8
+ * is a spec requirement (`pro-licensing`), not an implementation detail.
9
+ */
10
+ /** Accepted by every pro entry point. */
11
+ interface ProLicenseOptions {
12
+ /**
13
+ * Your license key from docx-editor.dev. Optional in v1: unlicensed use in
14
+ * development and evaluation is permitted, production use requires a
15
+ * license (see LICENSE.md) — the package trusts you either way.
16
+ */
17
+ readonly licenseKey?: string;
18
+ }
19
+
20
+ export type { ProLicenseOptions as P };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensing, v1: honor system.
3
+ *
4
+ * The key is accepted and remembered so that adding offline (Ed25519)
5
+ * verification later is not a breaking change — but nothing validates it,
6
+ * nothing warns, nothing renders differently, and NOTHING EVER LEAVES THE
7
+ * PROCESS: no network request is made for licensing, ever. That last property
8
+ * is a spec requirement (`pro-licensing`), not an implementation detail.
9
+ */
10
+ /** Accepted by every pro entry point. */
11
+ interface ProLicenseOptions {
12
+ /**
13
+ * Your license key from docx-editor.dev. Optional in v1: unlicensed use in
14
+ * development and evaluation is permitted, production use requires a
15
+ * license (see LICENSE.md) — the package trusts you either way.
16
+ */
17
+ readonly licenseKey?: string;
18
+ }
19
+
20
+ export type { ProLicenseOptions as P };
@@ -0,0 +1 @@
1
+ import {a,b as b$1,c}from'./chunk-ENMURXLJ.js';var b=Promise.resolve();function w(e,t){let n=/^(.*?\d+(?:\.\d+)?px(?:\/\S+)?)\s/.exec(e);return n?`${n[1]} "${t}", sans-serif`:e}function h(e){let t=/^(.*?\d+(?:\.\d+)?px(?:\/\S+)?)\s+(.*)$/.exec(e);return !t||!/[\x00-\x1f\x7f]/.test(t[2])?e:`${t[1]} sans-serif`}function v(e){for(let t=Object.getPrototypeOf(e);t;t=Object.getPrototypeOf(t)){let n=Object.getOwnPropertyDescriptor(t,"font");if(n)return n}}function T(e,t){let n=v(e);if(n?.get&&n.set){let{get:i,set:s}=n;Object.defineProperty(e,"font",{configurable:true,get:()=>i.call(e),set:a=>s.call(e,h(String(a)))});}let f=e.fillText.bind(e);e.fillText=(i,s,a,c)=>{let r=t(String(i));r?.face&&(e.font=w(e.font,r.face)),r&&(e.textBaseline=r.baseline,e.textAlign=r.align);let l=r?r.text:i;c===void 0?f(l,s,a):f(l,s,a,c);};}function C(e,t){let n=b$1(e);if(!n.length)return t();let f=b.then(async()=>{let i=globalThis,s=i.OffscreenCanvas;if(typeof s!="function")return t();let a=c(n),c$1=function(r,l){let o=new s(r,l),m=o.getContext.bind(o);return o.getContext=((u,y)=>{let g=m(u,y);return u==="2d"&&g&&T(g,a),g}),o};i.OffscreenCanvas=c$1;try{return await t()}finally{i.OffscreenCanvas=s;}});return b=f.catch(()=>{}),f}async function A(e,t,n){let{convertEmfToDataUrl:f,convertWmfToDataUrl:i}=await import('emf-converter'),s={maxWidth:n.maxEdge,maxHeight:n.maxEdge},a$1=new Uint8Array(t==="image/x-emf"?a(e,s):e),c=a$1.buffer.slice(a$1.byteOffset,a$1.byteOffset+a$1.byteLength),r=t==="image/x-emf"?await f(c,s):await C(a$1,()=>i(c,s));if(!r)return null;let l="data:image/png;base64,";if(!r.startsWith(l))return null;let o=atob(r.slice(l.length)),m=new Uint8Array(o.length);for(let u=0;u<o.length;u+=1)m[u]=o.charCodeAt(u);return Object.freeze({bytes:m,mime:"image/png"})}export{A as rasterizeMetafile};
@@ -0,0 +1 @@
1
+ 'use strict';var chunk3MIZFGHH_cjs=require('./chunk-3MIZFGHH.cjs');var b=Promise.resolve();function w(e,t){let n=/^(.*?\d+(?:\.\d+)?px(?:\/\S+)?)\s/.exec(e);return n?`${n[1]} "${t}", sans-serif`:e}function h(e){let t=/^(.*?\d+(?:\.\d+)?px(?:\/\S+)?)\s+(.*)$/.exec(e);return !t||!/[\x00-\x1f\x7f]/.test(t[2])?e:`${t[1]} sans-serif`}function v(e){for(let t=Object.getPrototypeOf(e);t;t=Object.getPrototypeOf(t)){let n=Object.getOwnPropertyDescriptor(t,"font");if(n)return n}}function T(e,t){let n=v(e);if(n?.get&&n.set){let{get:i,set:s}=n;Object.defineProperty(e,"font",{configurable:true,get:()=>i.call(e),set:a=>s.call(e,h(String(a)))});}let f=e.fillText.bind(e);e.fillText=(i,s,a,c)=>{let r=t(String(i));r?.face&&(e.font=w(e.font,r.face)),r&&(e.textBaseline=r.baseline,e.textAlign=r.align);let l=r?r.text:i;c===void 0?f(l,s,a):f(l,s,a,c);};}function C(e,t){let n=chunk3MIZFGHH_cjs.b(e);if(!n.length)return t();let f=b.then(async()=>{let i=globalThis,s=i.OffscreenCanvas;if(typeof s!="function")return t();let a=chunk3MIZFGHH_cjs.c(n),c=function(r,l){let o=new s(r,l),m=o.getContext.bind(o);return o.getContext=((u,y)=>{let g=m(u,y);return u==="2d"&&g&&T(g,a),g}),o};i.OffscreenCanvas=c;try{return await t()}finally{i.OffscreenCanvas=s;}});return b=f.catch(()=>{}),f}async function A(e,t,n){let{convertEmfToDataUrl:f,convertWmfToDataUrl:i}=await import('emf-converter'),s={maxWidth:n.maxEdge,maxHeight:n.maxEdge},a=new Uint8Array(t==="image/x-emf"?chunk3MIZFGHH_cjs.a(e,s):e),c=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),r=t==="image/x-emf"?await f(c,s):await C(a,()=>i(c,s));if(!r)return null;let l="data:image/png;base64,";if(!r.startsWith(l))return null;let o=atob(r.slice(l.length)),m=new Uint8Array(o.length);for(let u=0;u<o.length;u+=1)m[u]=o.charCodeAt(u);return Object.freeze({bytes:m,mime:"image/png"})}exports.rasterizeMetafile=A;
@@ -0,0 +1 @@
1
+ import {a,b,c}from'./chunk-ENMURXLJ.js';var K=[1,0,0,1,0,0],Z={r:0,g:0,b:0,alpha:1},R=Math.PI*2,u=n=>typeof n=="number"&&Number.isFinite(n)?n:0;function F(n,t){return [n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]]}function J(n){if(n instanceof B)return n.mean();if(typeof n!="string")return null;let t=n.trim().toLowerCase();if(t==="transparent")return {r:0,g:0,b:0,alpha:0};if(t==="black")return Z;if(t==="white")return {r:255,g:255,b:255,alpha:1};let e=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(t);if(e){let a=e[1].length===3?e[1].split("").map(o=>o+o).join(""):e[1],s=o=>Number.parseInt(a.slice(o,o+2),16);return {r:s(0),g:s(2),b:s(4),alpha:a.length===8?s(6)/255:1}}let r=/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+)\s*)?\)$/.exec(t);if(!r)return null;let i=(a,s)=>Math.max(0,Math.min(s,Number(a)||0));return {r:i(r[1],255),g:i(r[2],255),b:i(r[3],255),alpha:r[4]===void 0?1:i(r[4],1)}}function ut(n){if(n.length<3)return n;let t=n.charCodeAt(0),e=n.charCodeAt(1),r=t&255,i=t>>8,a=e&255,s=e>>8;return r<=10&&(i&12)===0&&a<=6&&(s&12)===0&&(s&3)<=2&&s>>4<=5&&(t>127||e>127)?n.slice(2):n}function q(n){let t=/^\s*(italic\s+)?(?:(bold|[1-9]00)\s+)?([\d.]+)px\s+(.+?)\s*$/i.exec(n);if(!t)return {family:"Arial",sizePx:10,bold:false,italic:false};let e=t[2]?.toLowerCase();return {family:ut(t[4].split(",")[0].trim().replace(/^["']|["']$/g,""))||"Arial",sizePx:Math.min(1e4,Math.max(0,Number(t[3])||0)),bold:e==="bold"||e!==void 0&&Number(e)>=600,italic:t[1]!==void 0}}var B=class{stops=[];addColorStop(t,e){let r=J(e);r&&this.stops.length<256&&this.stops.push(r);}mean(){if(!this.stops.length)return Z;let t=e=>this.stops.reduce((r,i)=>r+i[e],0)/this.stops.length;return {r:t("r"),g:t("g"),b:t("b"),alpha:t("alpha")}}},U=class{data;width;height;constructor(t,e,r){typeof t=="number"?(this.width=Math.max(0,Math.floor(t)),this.height=Math.max(0,Math.floor(e)),this.data=new Uint8ClampedArray(this.width*this.height*4)):(this.data=t,this.width=Math.max(0,Math.floor(e)),this.height=Math.max(0,Math.floor(r??t.length/4/Math.max(1,e))));}},X=class{constructor(t,e,r){this.canvas=t;this.budget=e;this.measure=r;}canvas;budget;measure;commands=[];state={matrix:K,fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,dash:[],font:"10px Arial",textAlign:"left",textBaseline:"alphabetic",globalAlpha:1};stack=[];path=[];current=null;start=null;globalCompositeOperation="source-over";lineCap="butt";lineJoin="miter";miterLimit=10;imageSmoothingEnabled=true;lineDashOffset=0;get fillStyle(){return this.state.fillStyle}set fillStyle(t){this.state.fillStyle=t;}get strokeStyle(){return this.state.strokeStyle}set strokeStyle(t){this.state.strokeStyle=t;}get lineWidth(){return this.state.lineWidth}set lineWidth(t){Number.isFinite(t)&&t>0&&(this.state.lineWidth=t);}get font(){return this.state.font}set font(t){typeof t=="string"&&t.length<512&&(this.state.font=t);}get textAlign(){return this.state.textAlign}set textAlign(t){this.state.textAlign=String(t);}get textBaseline(){return this.state.textBaseline}set textBaseline(t){this.state.textBaseline=String(t);}get globalAlpha(){return this.state.globalAlpha}set globalAlpha(t){Number.isFinite(t)&&(this.state.globalAlpha=Math.max(0,Math.min(1,t)));}admits(t){return this.budget.exhausted?false:this.budget.points+t>2e6?(this.budget.exhausted=true,false):true}extend(t){this.admits(this.path.length+1)&&this.path.push(t);}push(t,e=0){if(!this.budget.exhausted){if(this.budget.commands+=1,this.budget.points+=e,this.budget.commands>2e5||this.budget.points>2e6){this.budget.exhausted=true;return}this.commands.push(t);}}paintOf(t){let e=J(t);if(!e)return null;let r=e.alpha*this.state.globalAlpha;return r>0?{...e,alpha:r}:null}device(t,e){let r=this.state.matrix,i=u(t),a=u(e);return {x:r[0]*i+r[2]*a+r[4],y:r[1]*i+r[3]*a+r[5]}}penScale(){let t=this.state.matrix;return Math.sqrt(Math.abs(t[0]*t[3]-t[1]*t[2]))||1}save(){this.stack.length>=256||(this.stack.push({...this.state,dash:[...this.state.dash]}),this.push({kind:"save"}));}restore(){let t=this.stack.pop();t&&(this.state=t,this.push({kind:"restore"}));}setTransform(t,e,r,i,a,s){if(typeof t=="object"&&t!==null){let o=t;this.state.matrix=[o.a,o.b,o.c,o.d,o.e,o.f].map(u);return}this.state.matrix=[t,e,r,i,a,s].map(u);}resetTransform(){this.state.matrix=K;}transform(t,e,r,i,a,s){let o=[t,e,r,i,a,s].map(u);this.state.matrix=F(this.state.matrix,o);}translate(t,e){this.transform(1,0,0,1,t,e);}scale(t,e){this.transform(t,0,0,e,0,0);}rotate(t){let e=Math.cos(u(t)),r=Math.sin(u(t));this.transform(e,r,-r,e,0,0);}getTransform(){let[t,e,r,i,a,s]=this.state.matrix;return {a:t,b:e,c:r,d:i,e:a,f:s}}setLineDash(t){!Array.isArray(t)||t.length>64||(this.state.dash=t.map(u).map(e=>Math.max(0,e)));}getLineDash(){return [...this.state.dash]}beginPath(){this.path=[],this.current=null,this.start=null;}moveTo(t,e){this.extend({op:"M",...this.device(t,e)}),this.current={x:u(t),y:u(e)},this.start=this.current;}lineTo(t,e){if(!this.current)return this.moveTo(t,e);this.extend({op:"L",...this.device(t,e)}),this.current={x:u(t),y:u(e)};}bezierCurveTo(t,e,r,i,a,s){this.current||this.moveTo(t,e);let o=this.device(t,e),c=this.device(r,i),f=this.device(a,s);this.extend({op:"C",x1:o.x,y1:o.y,x2:c.x,y2:c.y,x:f.x,y:f.y}),this.current={x:u(a),y:u(s)};}quadraticCurveTo(t,e,r,i){let a=this.current??{x:u(t),y:u(e)};this.bezierCurveTo(a.x+2/3*(u(t)-a.x),a.y+2/3*(u(e)-a.y),u(r)+2/3*(u(t)-u(r)),u(i)+2/3*(u(e)-u(i)),r,i);}closePath(){this.current&&(this.extend({op:"Z"}),this.current=this.start);}rect(t,e,r,i){this.moveTo(t,e),this.lineTo(u(t)+u(r),e),this.lineTo(u(t)+u(r),u(e)+u(i)),this.lineTo(t,u(e)+u(i)),this.closePath();}arc(t,e,r,i,a,s=false){this.ellipse(t,e,r,r,0,i,a,s);}ellipse(t,e,r,i,a,s,o,c=false){let[f,h,m,A,C,M]=[t,e,r,i,a,s].map(u);if(m<0||A<0)return;let T=u(o)-M;c?T=-T>=R?-R:-((-T%R+R)%R):T=T>=R?R:(T%R+R)%R;let p=Math.cos(C),d=Math.sin(C),l=b=>{let g=m*Math.cos(b),k=A*Math.sin(b);return {x:f+g*p-k*d,y:h+g*d+k*p}},x=l(M);this.current?this.lineTo(x.x,x.y):this.moveTo(x.x,x.y);let w=Math.max(1,Math.ceil(Math.abs(T)/(Math.PI/2))),y=T/w,E=4/3*Math.tan(y/4);for(let b=0;b<w;b+=1){let g=M+y*b,k=g+y,v=l(g),I=l(k),W={x:-m*Math.sin(g),y:A*Math.cos(g)},O={x:-m*Math.sin(k),y:A*Math.cos(k)},P=S=>({x:S.x*p-S.y*d,y:S.x*d+S.y*p}),_=P(W),D=P(O);this.bezierCurveTo(v.x+E*_.x,v.y+E*_.y,I.x-E*D.x,I.y-E*D.y,I.x,I.y);}}arcTo(t,e,r,i,a){let s=u(a);this.current||this.moveTo(t,e);let o=this.current,c={x:u(t),y:u(e)},f={x:u(r),y:u(i)},h={x:o.x-c.x,y:o.y-c.y},m={x:f.x-c.x,y:f.y-c.y},A=Math.hypot(h.x,h.y),C=Math.hypot(m.x,m.y),M=h.x*m.y-h.y*m.x;if(s<=0||A===0||C===0||Math.abs(M)<1e-12*A*C){this.lineTo(c.x,c.y);return}let T=Math.acos(Math.max(-1,Math.min(1,(h.x*m.x+h.y*m.y)/(A*C)))),p=s/Math.tan(T/2),d={x:c.x+h.x/A*p,y:c.y+h.y/A*p},l={x:c.x+m.x/C*p,y:c.y+m.y/C*p},x={x:h.x/A+m.x/C,y:h.y/A+m.y/C},w=Math.hypot(x.x,x.y),y=s/Math.sin(T/2),E={x:c.x+x.x/w*y,y:c.y+x.y/w*y},b=Math.atan2(d.y-E.y,d.x-E.x),g=Math.atan2(l.y-E.y,l.x-E.x)-b;g>Math.PI&&(g-=R),g<-Math.PI&&(g+=R),this.lineTo(d.x,d.y),this.ellipse(E.x,E.y,s,s,0,b,b+g,g<0);}fill(t){let e=this.paintOf(this.state.fillStyle);!e||!this.path.length||!this.admits(this.path.length)||this.push({kind:"fill",path:[...this.path],evenOdd:t==="evenodd",paint:e},this.path.length);}stroke(){let t=this.paintOf(this.state.strokeStyle);if(!t||!this.path.length||!this.admits(this.path.length))return;let e=this.penScale();this.push({kind:"stroke",path:[...this.path],width:this.state.lineWidth*e,dash:this.state.dash.map(r=>r*e),paint:t},this.path.length);}clip(t){this.admits(this.path.length)&&this.push({kind:"clip",path:[...this.path],evenOdd:t==="evenodd"},this.path.length);}fillRect(t,e,r,i){let a={path:this.path,current:this.current,start:this.start};this.beginPath(),this.rect(t,e,r,i),this.fill(),Object.assign(this,a);}strokeRect(t,e,r,i){let a={path:this.path,current:this.current,start:this.start};this.beginPath(),this.rect(t,e,r,i),this.stroke(),Object.assign(this,a);}clearRect(){}measureText(t){return {width:this.measure(String(t),q(this.state.font))}}fillText(t,e,r){let i=this.paintOf(this.state.fillStyle),a=String(t);if(!i||!a||a.length>1e4)return;let s=this.state.textAlign,o=this.state.textBaseline;this.push({kind:"text",text:a,font:q(this.state.font),x:u(e),y:u(r),align:s==="center"?"center":s==="right"||s==="end"?"right":"left",baseline:o==="top"||o==="hanging"?"top":o==="bottom"||o==="ideographic"?"bottom":o==="middle"?"middle":"alphabetic",matrix:this.state.matrix,paint:i},a.length);}putImageData(t,e,r){let i=Math.floor(u(t?.width)),a=Math.floor(u(t?.height));if(!(!(i>0&&a>0)||!t.data||t.data.length<i*a*4)){if(this.budget.pixels+=i*a,this.budget.pixels>16e6){this.budget.exhausted=true;return}this.push({kind:"image",raster:{kind:"rgba",width:i,height:a,data:Uint8Array.from(t.data)},matrix:[i,0,0,a,u(e),u(r)]});}}getImageData(t,e,r,i){return new U(Math.min(4096,Math.max(0,u(r))),Math.min(4096,u(i)))}createImageData(t,e){return new U(Math.min(4096,Math.max(0,u(t))),Math.min(4096,u(e)))}createLinearGradient(){return new B}createRadialGradient(){return new B}createPattern(){return null}drawImage(t,...e){let r=ct(t);if(!r)return;let[i,a,s,o]=[e[0],e[1],r.width,r.height].map(u);e.length===4&&([i,a,s,o]=e.map(u));let c=null;if(e.length>=8&&(c=e.slice(0,4).map(u),[i,a,s,o]=e.slice(4,8).map(u)),s===0||o===0)return;let f=F(this.state.matrix,[s,0,0,o,i,a]);if(c){let[h,m,A,C]=c;if(!(A>0&&C>0))return;this.save(),this.beginPath(),this.rect(i,a,s,o),this.clip(),f=F(this.state.matrix,[s*r.width/A,0,0,o*r.height/C,i-h*s/A,a-m*o/C]);}r.raster?this.push({kind:"image",raster:r.raster,matrix:f}):r.drawing&&this.push({kind:"drawing",drawing:r.drawing,matrix:F(f,[1/r.width,0,0,1/r.height,0,0])}),c&&this.restore();}};function ct(n){if(n instanceof L){let t=n.drawing();if(!(t.width>0&&t.height>0))return null;let[e]=t.commands;return t.commands.length===1&&e.kind==="image"&&e.raster.width===t.width&&e.raster.height===t.height&&e.matrix[0]===t.width&&e.matrix[3]===t.height&&e.matrix[4]===0&&e.matrix[5]===0?{width:t.width,height:t.height,raster:e.raster}:{width:t.width,height:t.height,drawing:t}}if(n&&typeof n=="object"&&"width"in n&&"height"in n){let t=n;if(!(t.width>0&&t.height>0))return null;if(t.raster)return {width:t.width,height:t.height,raster:t.raster};if(t.drawing)return {width:t.width,height:t.height,drawing:t.drawing}}return null}var L=class{constructor(t,e,r,i,a){this.width=t;this.height=e;this.budget=r;this.measure=i;this.onExport=a;}width;height;budget;measure;onExport;context=null;getContext(t){return t!=="2d"?null:(this.context??=new X(this,this.budget,this.measure),this.context)}drawing(){return {width:Math.max(0,u(this.width)),height:Math.max(0,u(this.height)),commands:this.context?.commands??[]}}async convertToBlob(){return new Blob([this.onExport(this)],{type:N})}},N="application/x-docx-metafile-recording";function Q(n,t){for(let e=t;e<n.byteLength;e+=1)if(n.getUint8(e)!==0)return "malformed-record";return "intact"}function mt(n,t){if(n.byteLength<88)return "malformed-record";let e=n.getUint32(4,true);if(e<88||e>n.byteLength)return "malformed-record";let r=1;for(let i=e;i+8<=n.byteLength;r+=1){if(r>=t)return "record-limit";let a=n.getUint32(i,true),s=n.getUint32(i+4,true);if(a===14)return "intact";if(s<8||s>n.byteLength-i)return Q(n,i);i+=s;}return "intact"}function dt(n,t){let e=n.byteLength>=22&&n.getUint32(0,true)===2596720087?22:0;if(e+18>n.byteLength)return "malformed-record";e+=n.getUint16(e+2,true)*2;for(let r=0;e+6<=n.byteLength;r+=1){if(r>=t)return "record-limit";let i=n.getUint32(e,true)*2;if(n.getUint16(e+4,true)===0)return "intact";if(i<6||i>n.byteLength-e)return Q(n,e);e+=i;}return "intact"}function tt(n,t,e){let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return t==="image/x-emf"?mt(r,e):dt(r,e)}var ft=2596720087,gt=523,pt=524,bt=3907,xt=2881,Mt=2368,yt=1313,z="\x7F",et=13369376,nt=8913094,wt=15597702,At=2e5;function Ct(n,t,e){if(t+12>e)return null;let r=n.getUint32(t,true),i,a,s,o=0,c=0,f=4;if(r===12)i=n.getUint16(t+4,true),a=n.getUint16(t+6,true),s=n.getUint16(t+10,true),f=3;else if(r>=40&&t+r<=e)i=n.getInt32(t+4,true),a=n.getInt32(t+8,true),s=n.getUint16(t+14,true),o=n.getUint32(t+16,true),c=n.getUint32(t+32,true);else return null;let h=a<0,m=Math.abs(a);if(!(i>0&&m>0)||i*m>16e6||o!==0||![1,4,8,16,24,32].includes(s))return null;let A=s<=8?c||1<<s:0,C=t+r,M=C+A*f,T=Math.floor((i*s+31)/32)*4;if(A>256||M+T*m>e)return null;let p=l=>{if(l>=A)return [0,0,0];let x=C+l*f;return [n.getUint8(x+2),n.getUint8(x+1),n.getUint8(x)]},d=new Uint8Array(i*m*4);for(let l=0;l<m;l+=1){let x=M+(h?l:m-1-l)*T;for(let w=0;w<i;w+=1){let y;if(s===24){let b=x+w*3;y=[n.getUint8(b+2),n.getUint8(b+1),n.getUint8(b)];}else if(s===32){let b=x+w*4;y=[n.getUint8(b+2),n.getUint8(b+1),n.getUint8(b)];}else if(s===16){let b=n.getUint16(x+w*2,true),g=k=>(b>>k&31)*255/31;y=[g(10),g(5),g(0)];}else {let b=w*s,k=n.getUint8(x+(b>>3))>>8-s-(b&7)&(1<<s)-1;y=p(k);}let E=(l*i+w)*4;d[E]=y[0],d[E+1]=y[1],d[E+2]=y[2],d[E+3]=255;}}return {width:i,height:m,topDown:h,data:d}}function rt(n){if(!n.startsWith(z))return null;let t=n.slice(z.length);return /^\d{1,6}$/.test(t)?Number(t):null}function it(n){let t=new DataView(n.buffer,n.byteOffset,n.byteLength);if(n.length<22)return null;let e=0,r={x:0,y:0,width:0,height:0};if(t.getUint32(0,true)===ft){let o=t.getInt16(6,true),c=t.getInt16(8,true);r={x:o,y:c,width:t.getInt16(10,true)-o,height:t.getInt16(12,true)-c},e=22;}if(e+18>n.length)return null;e+=t.getUint16(e+2,true)*2;let i=[];for(let o=0;o<At&&e+6<=n.length;o+=1){let c=t.getUint32(e,true)*2,f=t.getUint16(e+4,true);if(f===0||c<6||e+c>n.length)break;let h=m=>t.getInt16(e+6+m*2,true);if(f===gt&&c>=10)r={...r,y:h(0),x:h(1)};else if(f===pt&&c>=10)r={...r,height:h(0),width:h(1)};else if(f===bt&&c>=28)i.push({rop:t.getUint32(e+6,true),source:{height:h(3),width:h(4),y:h(5),x:h(6)},target:{height:h(7),width:h(8),y:h(9),x:h(10)},window:r,record:e,dib:e+28,end:e+c});else if(f===xt&&c>=26)i.push({rop:t.getUint32(e+6,true),source:{height:h(2),width:h(3),y:h(4),x:h(5)},target:{height:h(6),width:h(7),y:h(8),x:h(9)},window:r,record:e,dib:e+26,end:e+c});else if(f===Mt&&c>=22){let m={height:h(4),width:h(5),y:h(6),x:h(7)};i.push({rop:t.getUint32(e+6,true),source:{height:m.height,width:m.width,y:h(2),x:h(3)},target:m,window:r,record:e,dib:e+22,end:e+c});}e+=c;}if(!i.length)return null;let a=n.slice(),s=new DataView(a.buffer);return i.forEach(({record:o},c)=>{let f=`${z}${c}`;s.setUint16(o+4,yt,true),s.setInt16(o+6,f.length,true);for(let m=0;m<f.length;m+=1)s.setUint8(o+8+m,f.charCodeAt(m));let h=o+8+f.length+f.length%2;s.setInt16(h,0,true),s.setInt16(h+2,0,true);}),{marked:a,placed:i}}function at(n,t,e,r,i){let a=new DataView(n.buffer,n.byteOffset,n.byteLength),s=t.map(()=>[]);for(let[o,{rop:c,source:f,target:h,window:m,dib:A,end:C}]of t.entries()){if(c!==et&&c!==nt&&c!==wt||m.width===0||m.height===0)continue;let M=Ct(a,A,C);if(!M)continue;let T=e/m.width,p=r/m.height,d=s[o];if(c!==et){let g=c===nt?255:0;for(let k=0;k<M.data.length;k+=4){let v=M.data;v[k]===g&&v[k+1]===g&&v[k+2]===g&&(v[k+3]=0);}}if(i.pixels+=M.width*M.height,i.pixels>16e6){i.exhausted=true;break}let l=f.width||M.width,x=f.height||M.height,w=h.width/l*T,y=h.height/x*p,E=M.topDown?f.y:M.height-f.y-x,b=f.x!==0||E!==0||l!==M.width||x!==M.height;if(b){let g=(h.x-m.x)*T,k=(h.y-m.y)*p,v=g+h.width*T,I=k+h.height*p;d.push({kind:"save"},{kind:"clip",evenOdd:false,path:[{op:"M",x:g,y:k},{op:"L",x:v,y:k},{op:"L",x:v,y:I},{op:"L",x:g,y:I},{op:"Z"}]});}d.push({kind:"image",raster:{kind:"rgba",width:M.width,height:M.height,data:M.data},matrix:[M.width*w,0,0,M.height*y,(h.x-m.x)*T-f.x*w,(h.y-m.y)*p-E*y]}),b&&d.push({kind:"restore"});}return s}function st(n,t,e){let r=[],i=0;for(t.forEach((a,s)=>{let o=e(s);if(!(o<0||!a.length)){for(;i<Math.min(o,n.length);)r.push(n[i++]);for(let c of a)r.push(c);}});i<n.length;)r.push(n[i++]);return r}function ot(n,t){if(!t.length)return n;let e=c(t),r=false,i=n.map(a=>{if(a.kind!=="text")return a;let s=e(a.text);if(!s)return a;let o=s.face||a.font.family;return s.text===a.text&&o===a.font.family&&s.baseline===a.baseline&&s.align===a.align?a:(r=true,{...a,text:s.text,font:{...a.font,family:o},baseline:s.baseline,align:s.align})});return r?i:n}var ht=2e5,$=4096,j=["OffscreenCanvas","ImageData","createImageBitmap","FileReader"],lt=Promise.resolve();function Et(n){if(n.length>=24&&n[0]===137&&n[1]===80&&n[2]===78&&n[3]===71){let t=new DataView(n.buffer,n.byteOffset,n.byteLength);return {mime:"image/png",width:t.getUint32(16),height:t.getUint32(20)}}if(n.length>=4&&n[0]===255&&n[1]===216){let t=2;for(;t+9<n.length;){if(n[t]!==255)return null;let e=n[t+1],r=n[t+2]<<8|n[t+3];if(e>=192&&e<=207&&e!==196&&e!==200&&e!==204)return {mime:"image/jpeg",height:n[t+5]<<8|n[t+6],width:n[t+7]<<8|n[t+8]};if(r<2)return null;t+=2+r;}}return null}function kt(n){let t="";for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode(...n.subarray(e,e+32768));return btoa(t)}async function Tt(n,t,e){let r={commands:0,points:0,pixels:0,exhausted:false},i=new Map,a$1=p=>{let d=`recording-${i.size}`;return i.set(d,p),d},s=(p,d)=>{let l=e.textAdvance(p,d);return Number.isFinite(l)&&l>=0?l:0},o=t==="image/x-wmf"?it(n):null,c=new Map,f=new WeakSet;class h extends L{constructor(d,l){super(d,l,r,s,a$1);}getContext(d){let l=super.getContext(d);if(!o||!l||f.has(l))return l;f.add(l);let x=l.fillText.bind(l);return l.fillText=(w,y,E)=>{let b=rt(String(w));if(b===null||b>=o.placed.length)return x(w,y,E);c.set(b,{commands:l.commands,at:l.commands.length});},l}}class m{result=null;error=null;onload=null;onerror=null;readAsDataURL(d){d.arrayBuffer().then(l=>{this.result=`data:${d.type||"application/octet-stream"};base64,${kt(new Uint8Array(l))}`,this.onload?.();}).catch(l=>{this.error=l,this.onerror?.();});}}let A=async p=>{let d=new Uint8Array(await p.arrayBuffer());if(p.type===N){let w=i.get(new TextDecoder().decode(d));if(!w)throw new Error("Unknown recording");let y=w.drawing();return {width:y.width,height:y.height,drawing:y,close(){}}}let l=Et(d);if(!l||!(l.width>0&&l.height>0))throw new Error("Unsupported bitmap");if(r.pixels+=l.width*l.height,r.pixels>16e6)throw r.exhausted=true,new Error("Bitmap past the pixel bound");let x={kind:"encoded",...l,bytes:d};return {width:l.width,height:l.height,raster:x,close(){}}},C=globalThis,M=j.map(p=>Object.getOwnPropertyDescriptor(C,p)),T={OffscreenCanvas:h,ImageData:U,createImageBitmap:A,FileReader:m};for(let p of j)Object.defineProperty(C,p,{value:T[p],configurable:true,writable:true});try{let{convertEmfToDataUrl:p,convertWmfToDataUrl:d}=await import('emf-converter'),l={dpiScale:1,maxWidth:$,maxHeight:$,maxCanvasDimension:$,maxRecords:ht},x=t==="image/x-emf"?a(n,l):o?.marked??n,w=x.slice().buffer,y=t==="image/x-emf"?await p(w,l):await d(w,l),E=y?.startsWith(`data:${N};base64,`)?y.slice(y.indexOf(",")+1):null,b$1=E?i.get(atob(E)):void 0;if(!b$1)return null;let g=b$1.drawing(),v=t==="image/x-wmf"?ot(g.commands,b(n)):g.commands,I=o?at(n,o.placed,g.width,g.height,r):[],W=D=>{let S=c.get(D);return S&&S.commands===g.commands?S.at:-1},O=I.some(D=>D.length)?st(v,I,W):v,P=r.exhausted?"record-limit":tt(x,t,ht),_=O===g.commands?g:{...g,commands:O};return P==="intact"?{drawing:_,complete:!0}:{drawing:_,complete:!1,stop:P==="malformed-record"?"malformed-record":"resource-bound"}}catch{return null}finally{j.forEach((p,d)=>{let l=M[d];l?Object.defineProperty(C,p,l):delete C[p];});}}function Ft(n,t,e){let r=lt.then(()=>Tt(n,t,e));return lt=r.catch(()=>{}),r}export{Ft as replayMetafile};