@embedpdf/plugin-annotation 2.1.2 → 2.3.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 (97) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1232 -93
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +31 -2
  6. package/dist/lib/annotation-plugin.d.ts +177 -2
  7. package/dist/lib/handlers/types.d.ts +1 -1
  8. package/dist/lib/helpers.d.ts +6 -1
  9. package/dist/lib/selectors.d.ts +97 -8
  10. package/dist/lib/tools/default-tools.d.ts +39 -11
  11. package/dist/lib/tools/types.d.ts +7 -1
  12. package/dist/lib/types.d.ts +265 -1
  13. package/dist/preact/adapter.d.ts +3 -3
  14. package/dist/preact/index.cjs +1 -1
  15. package/dist/preact/index.cjs.map +1 -1
  16. package/dist/preact/index.js +867 -406
  17. package/dist/preact/index.js.map +1 -1
  18. package/dist/react/adapter.d.ts +1 -1
  19. package/dist/react/index.cjs +1 -1
  20. package/dist/react/index.cjs.map +1 -1
  21. package/dist/react/index.js +867 -406
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +8 -1
  24. package/dist/shared/components/annotation-layer.d.ts +4 -2
  25. package/dist/shared/components/annotations/ink.d.ts +3 -3
  26. package/dist/shared/components/annotations/link.d.ts +28 -0
  27. package/dist/shared/components/annotations.d.ts +2 -1
  28. package/dist/shared/components/group-selection-box.d.ts +32 -0
  29. package/dist/shared/components/index.d.ts +1 -0
  30. package/dist/shared/components/text-markup/highlight.d.ts +3 -2
  31. package/dist/shared/components/text-markup/squiggly.d.ts +3 -2
  32. package/dist/shared/components/text-markup/strikeout.d.ts +3 -2
  33. package/dist/shared/components/text-markup/underline.d.ts +3 -2
  34. package/dist/shared/components/types.d.ts +7 -0
  35. package/dist/shared-preact/components/annotation-container.d.ts +8 -1
  36. package/dist/shared-preact/components/annotation-layer.d.ts +4 -2
  37. package/dist/shared-preact/components/annotations/ink.d.ts +3 -3
  38. package/dist/shared-preact/components/annotations/link.d.ts +28 -0
  39. package/dist/shared-preact/components/annotations.d.ts +2 -1
  40. package/dist/shared-preact/components/group-selection-box.d.ts +32 -0
  41. package/dist/shared-preact/components/index.d.ts +1 -0
  42. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -2
  43. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -2
  44. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -2
  45. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -2
  46. package/dist/shared-preact/components/types.d.ts +7 -0
  47. package/dist/shared-react/components/annotation-container.d.ts +8 -1
  48. package/dist/shared-react/components/annotation-layer.d.ts +4 -2
  49. package/dist/shared-react/components/annotations/ink.d.ts +3 -3
  50. package/dist/shared-react/components/annotations/link.d.ts +28 -0
  51. package/dist/shared-react/components/annotations.d.ts +2 -1
  52. package/dist/shared-react/components/group-selection-box.d.ts +32 -0
  53. package/dist/shared-react/components/index.d.ts +1 -0
  54. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -2
  55. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -2
  56. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -2
  57. package/dist/shared-react/components/text-markup/underline.d.ts +3 -2
  58. package/dist/shared-react/components/types.d.ts +7 -0
  59. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +5 -1
  60. package/dist/svelte/components/Annotations.svelte.d.ts +5 -1
  61. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +32 -0
  62. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -1
  63. package/dist/svelte/components/annotations/Link.svelte.d.ts +24 -0
  64. package/dist/svelte/components/annotations/index.d.ts +1 -0
  65. package/dist/svelte/components/index.d.ts +1 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -1
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -1
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -1
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -1
  70. package/dist/svelte/components/types.d.ts +2 -0
  71. package/dist/svelte/index.cjs +1 -1
  72. package/dist/svelte/index.cjs.map +1 -1
  73. package/dist/svelte/index.js +912 -258
  74. package/dist/svelte/index.js.map +1 -1
  75. package/dist/svelte/types.d.ts +7 -0
  76. package/dist/vue/components/annotation-container.vue.d.ts +2 -0
  77. package/dist/vue/components/annotation-layer.vue.d.ts +28 -5
  78. package/dist/vue/components/annotations/index.d.ts +1 -0
  79. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  80. package/dist/vue/components/annotations/line.vue.d.ts +1 -1
  81. package/dist/vue/components/annotations/link.vue.d.ts +29 -0
  82. package/dist/vue/components/annotations/polygon.vue.d.ts +1 -1
  83. package/dist/vue/components/annotations/polyline.vue.d.ts +1 -1
  84. package/dist/vue/components/annotations.vue.d.ts +65 -1
  85. package/dist/vue/components/group-selection-box.vue.d.ts +73 -0
  86. package/dist/vue/components/index.d.ts +1 -0
  87. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  88. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  89. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  90. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  91. package/dist/vue/hooks/use-annotation.d.ts +2 -0
  92. package/dist/vue/index.cjs +1 -1
  93. package/dist/vue/index.cjs.map +1 -1
  94. package/dist/vue/index.js +962 -409
  95. package/dist/vue/index.js.map +1 -1
  96. package/dist/vue/types.d.ts +7 -0
  97. package/package.json +10 -10
@@ -1,9 +1,9 @@
1
- import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/react";
2
- import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
1
+ import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/react";
2
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp, isLink } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
- import { useState, useEffect, useRef, useMemo, useLayoutEffect, Fragment as Fragment$1, useCallback } from "react";
4
+ import { useState, useEffect, useRef, useMemo, useCallback, useLayoutEffect, Fragment as Fragment$1 } from "react";
5
5
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
6
- import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
6
+ import { boundingRectOrEmpty, PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
7
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/react";
8
8
  import { useSelectionCapability } from "@embedpdf/plugin-selection/react";
9
9
  import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/react";
@@ -41,6 +41,7 @@ function AnnotationContainer({
41
41
  trackedAnnotation,
42
42
  children,
43
43
  isSelected,
44
+ isMultiSelected = false,
44
45
  isDraggable,
45
46
  isResizable,
46
47
  lockAspectRatio = false,
@@ -59,7 +60,11 @@ function AnnotationContainer({
59
60
  }) {
60
61
  const [preview, setPreview] = useState(trackedAnnotation.object);
61
62
  const { provides: annotationCapability } = useAnnotationCapability();
63
+ const { plugin } = useAnnotationPlugin();
64
+ const { canModifyAnnotations } = useDocumentPermissions(documentId);
62
65
  const gestureBaseRef = useRef(null);
66
+ const effectiveIsDraggable = canModifyAnnotations && isDraggable && !isMultiSelected;
67
+ const effectiveIsResizable = canModifyAnnotations && isResizable && !isMultiSelected;
63
68
  const annotationProvides = useMemo(
64
69
  () => annotationCapability ? annotationCapability.forDocument(documentId) : null,
65
70
  [annotationCapability, documentId]
@@ -69,6 +74,73 @@ function AnnotationContainer({
69
74
  const VERTEX_COLOR = (vertexUI == null ? void 0 : vertexUI.color) ?? "#007ACC";
70
75
  const HANDLE_SIZE = (resizeUI == null ? void 0 : resizeUI.size) ?? 12;
71
76
  const VERTEX_SIZE = (vertexUI == null ? void 0 : vertexUI.size) ?? 12;
77
+ const gestureBaseRectRef = useRef(null);
78
+ const handleUpdate = useCallback(
79
+ (event) => {
80
+ var _a;
81
+ if (!((_a = event.transformData) == null ? void 0 : _a.type) || isMultiSelected || !plugin) return;
82
+ const { type, changes, metadata } = event.transformData;
83
+ const id = trackedAnnotation.object.id;
84
+ const pageSize = { width: pageWidth, height: pageHeight };
85
+ if (event.state === "start") {
86
+ gestureBaseRectRef.current = trackedAnnotation.object.rect;
87
+ gestureBaseRef.current = trackedAnnotation.object;
88
+ if (type === "move") {
89
+ plugin.startDrag(documentId, { annotationIds: [id], pageSize });
90
+ } else if (type === "resize") {
91
+ plugin.startResize(documentId, {
92
+ annotationIds: [id],
93
+ pageSize,
94
+ resizeHandle: (metadata == null ? void 0 : metadata.handle) ?? "se"
95
+ });
96
+ }
97
+ }
98
+ if (changes.rect && gestureBaseRectRef.current) {
99
+ if (type === "move") {
100
+ const delta = {
101
+ x: changes.rect.origin.x - gestureBaseRectRef.current.origin.x,
102
+ y: changes.rect.origin.y - gestureBaseRectRef.current.origin.y
103
+ };
104
+ plugin.updateDrag(documentId, delta);
105
+ } else if (type === "resize") {
106
+ plugin.updateResize(documentId, changes.rect);
107
+ }
108
+ }
109
+ if (type === "vertex-edit" && changes.vertices && vertexConfig) {
110
+ const base = gestureBaseRef.current ?? trackedAnnotation.object;
111
+ const vertexChanges = vertexConfig.transformAnnotation(base, changes.vertices);
112
+ const patched = annotationCapability == null ? void 0 : annotationCapability.transformAnnotation(base, {
113
+ type,
114
+ changes: vertexChanges,
115
+ metadata
116
+ });
117
+ if (patched) {
118
+ setPreview((prev) => ({ ...prev, ...patched }));
119
+ if (event.state === "end") {
120
+ annotationProvides == null ? void 0 : annotationProvides.updateAnnotation(pageIndex, id, patched);
121
+ }
122
+ }
123
+ }
124
+ if (event.state === "end") {
125
+ gestureBaseRectRef.current = null;
126
+ gestureBaseRef.current = null;
127
+ if (type === "move") plugin.commitDrag(documentId);
128
+ else if (type === "resize") plugin.commitResize(documentId);
129
+ }
130
+ },
131
+ [
132
+ plugin,
133
+ documentId,
134
+ trackedAnnotation.object,
135
+ pageWidth,
136
+ pageHeight,
137
+ pageIndex,
138
+ isMultiSelected,
139
+ vertexConfig,
140
+ annotationCapability,
141
+ annotationProvides
142
+ ]
143
+ );
72
144
  const { dragProps, vertices, resize } = useInteractionHandles({
73
145
  controller: {
74
146
  element: currentObject.rect,
@@ -81,32 +153,9 @@ function AnnotationContainer({
81
153
  maintainAspectRatio: lockAspectRatio,
82
154
  pageRotation: rotation,
83
155
  scale,
84
- enabled: isSelected,
85
- onUpdate: (event) => {
86
- var _a;
87
- if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
88
- if (event.state === "start") {
89
- gestureBaseRef.current = currentObject;
90
- }
91
- const transformType = event.transformData.type;
92
- const base = gestureBaseRef.current ?? currentObject;
93
- const changes = event.transformData.changes.vertices ? vertexConfig == null ? void 0 : vertexConfig.transformAnnotation(base, event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
94
- const patched = annotationCapability == null ? void 0 : annotationCapability.transformAnnotation(base, {
95
- type: transformType,
96
- changes,
97
- metadata: event.transformData.metadata
98
- });
99
- if (patched) {
100
- setPreview((prev) => ({
101
- ...prev,
102
- ...patched
103
- }));
104
- }
105
- if (event.state === "end" && patched) {
106
- gestureBaseRef.current = null;
107
- annotationProvides == null ? void 0 : annotationProvides.updateAnnotation(pageIndex, trackedAnnotation.object.id, patched);
108
- }
109
- }
156
+ // Disable interaction handles when multi-selected
157
+ enabled: isSelected && !isMultiSelected,
158
+ onUpdate: handleUpdate
110
159
  },
111
160
  resizeUI: {
112
161
  handleSize: HANDLE_SIZE,
@@ -121,15 +170,33 @@ function AnnotationContainer({
121
170
  },
122
171
  includeVertices: vertexConfig ? true : false
123
172
  });
124
- const doubleProps = useDoublePressProps(onDoubleClick);
173
+ const guardedOnDoubleClick = useMemo(() => {
174
+ if (!canModifyAnnotations || !onDoubleClick) return void 0;
175
+ return onDoubleClick;
176
+ }, [canModifyAnnotations, onDoubleClick]);
177
+ const doubleProps = useDoublePressProps(guardedOnDoubleClick);
125
178
  useEffect(() => {
126
179
  setPreview(trackedAnnotation.object);
127
180
  }, [trackedAnnotation.object]);
181
+ useEffect(() => {
182
+ if (!plugin) return;
183
+ const id = trackedAnnotation.object.id;
184
+ const handleEvent = (event) => {
185
+ var _a;
186
+ if (event.documentId !== documentId) return;
187
+ const patch = (_a = event.previewPatches) == null ? void 0 : _a[id];
188
+ if (event.type === "update" && patch) setPreview((prev) => ({ ...prev, ...patch }));
189
+ else if (event.type === "cancel") setPreview(trackedAnnotation.object);
190
+ };
191
+ const unsubs = [plugin.onDragChange(handleEvent), plugin.onResizeChange(handleEvent)];
192
+ return () => unsubs.forEach((u) => u());
193
+ }, [plugin, documentId, trackedAnnotation.object]);
194
+ const showOutline = isSelected && !isMultiSelected;
128
195
  return /* @__PURE__ */ jsxs("div", { "data-no-interaction": true, children: [
129
196
  /* @__PURE__ */ jsxs(
130
197
  "div",
131
198
  {
132
- ...isDraggable && isSelected ? dragProps : {},
199
+ ...effectiveIsDraggable && isSelected ? dragProps : {},
133
200
  ...doubleProps,
134
201
  style: {
135
202
  position: "absolute",
@@ -137,11 +204,11 @@ function AnnotationContainer({
137
204
  top: currentObject.rect.origin.y * scale,
138
205
  width: currentObject.rect.size.width * scale,
139
206
  height: currentObject.rect.size.height * scale,
140
- outline: isSelected ? `1px solid ${selectionOutlineColor}` : "none",
141
- outlineOffset: isSelected ? `${outlineOffset}px` : "0px",
142
- pointerEvents: isSelected ? "auto" : "none",
207
+ outline: showOutline ? `1px solid ${selectionOutlineColor}` : "none",
208
+ outlineOffset: showOutline ? `${outlineOffset}px` : "0px",
209
+ pointerEvents: isSelected && !isMultiSelected ? "auto" : "none",
143
210
  touchAction: "none",
144
- cursor: isSelected && isDraggable ? "move" : "default",
211
+ cursor: isSelected && effectiveIsDraggable ? "move" : "default",
145
212
  zIndex,
146
213
  ...style
147
214
  },
@@ -165,7 +232,7 @@ function AnnotationContainer({
165
232
  }
166
233
  return childrenRender;
167
234
  })(),
168
- isSelected && isResizable && resize.map(
235
+ isSelected && effectiveIsResizable && resize.map(
169
236
  ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
170
237
  key,
171
238
  ...hProps,
@@ -179,7 +246,7 @@ function AnnotationContainer({
179
246
  key
180
247
  )
181
248
  ),
182
- isSelected && vertices.map(
249
+ isSelected && canModifyAnnotations && !isMultiSelected && vertices.map(
183
250
  ({ key, ...vProps }) => (vertexUI == null ? void 0 : vertexUI.component) ? vertexUI.component({
184
251
  key,
185
252
  ...vProps,
@@ -196,7 +263,7 @@ function AnnotationContainer({
196
263
  ]
197
264
  }
198
265
  ),
199
- selectionMenu && /* @__PURE__ */ jsx(
266
+ selectionMenu && !isMultiSelected && /* @__PURE__ */ jsx(
200
267
  CounterRotate,
201
268
  {
202
269
  rect: {
@@ -210,8 +277,8 @@ function AnnotationContainer({
210
277
  }
211
278
  },
212
279
  rotation,
213
- children: (props2) => selectionMenu({
214
- ...props2,
280
+ children: (counterRotateProps) => selectionMenu({
281
+ ...counterRotateProps,
215
282
  context: {
216
283
  type: "annotation",
217
284
  annotation: trackedAnnotation,
@@ -226,8 +293,194 @@ function AnnotationContainer({
226
293
  )
227
294
  ] });
228
295
  }
296
+ function GroupSelectionBox({
297
+ documentId,
298
+ pageIndex,
299
+ scale,
300
+ rotation,
301
+ pageWidth,
302
+ pageHeight,
303
+ selectedAnnotations,
304
+ isDraggable,
305
+ isResizable,
306
+ resizeUI,
307
+ selectionOutlineColor = "#007ACC",
308
+ outlineOffset = 2,
309
+ zIndex = 100,
310
+ groupSelectionMenu
311
+ }) {
312
+ const { plugin } = useAnnotationPlugin();
313
+ const gestureBaseRef = useRef(null);
314
+ const isDraggingRef = useRef(false);
315
+ const isResizingRef = useRef(false);
316
+ const groupBox = useMemo(() => {
317
+ const rects = selectedAnnotations.map((ta) => ta.object.rect);
318
+ return boundingRectOrEmpty(rects);
319
+ }, [selectedAnnotations]);
320
+ const [previewGroupBox, setPreviewGroupBox] = useState(groupBox);
321
+ useEffect(() => {
322
+ if (!isDraggingRef.current && !isResizingRef.current) {
323
+ setPreviewGroupBox(groupBox);
324
+ }
325
+ }, [groupBox]);
326
+ const handleUpdate = useCallback(
327
+ (event) => {
328
+ var _a, _b;
329
+ if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
330
+ if (!plugin) return;
331
+ const transformType = event.transformData.type;
332
+ const isMove = transformType === "move";
333
+ const isResize = transformType === "resize";
334
+ if (isMove && !isDraggable) return;
335
+ if (event.state === "start") {
336
+ gestureBaseRef.current = groupBox;
337
+ if (isMove) {
338
+ isDraggingRef.current = true;
339
+ plugin.startDrag(documentId, {
340
+ annotationIds: selectedAnnotations.map((ta) => ta.object.id),
341
+ pageSize: { width: pageWidth, height: pageHeight }
342
+ });
343
+ } else if (isResize) {
344
+ isResizingRef.current = true;
345
+ plugin.startResize(documentId, {
346
+ annotationIds: selectedAnnotations.map((ta) => ta.object.id),
347
+ pageSize: { width: pageWidth, height: pageHeight },
348
+ resizeHandle: ((_b = event.transformData.metadata) == null ? void 0 : _b.handle) ?? "se"
349
+ });
350
+ }
351
+ }
352
+ const base = gestureBaseRef.current ?? groupBox;
353
+ if (isMove && event.transformData.changes.rect) {
354
+ const newRect = event.transformData.changes.rect;
355
+ const rawDelta = {
356
+ x: newRect.origin.x - base.origin.x,
357
+ y: newRect.origin.y - base.origin.y
358
+ };
359
+ const clampedDelta = plugin.updateDrag(documentId, rawDelta);
360
+ setPreviewGroupBox({
361
+ ...base,
362
+ origin: {
363
+ x: base.origin.x + clampedDelta.x,
364
+ y: base.origin.y + clampedDelta.y
365
+ }
366
+ });
367
+ } else if (isResize && event.transformData.changes.rect) {
368
+ const newGroupBox = event.transformData.changes.rect;
369
+ plugin.updateResize(documentId, newGroupBox);
370
+ setPreviewGroupBox(newGroupBox);
371
+ }
372
+ if (event.state === "end") {
373
+ gestureBaseRef.current = null;
374
+ if (isMove && isDraggingRef.current) {
375
+ isDraggingRef.current = false;
376
+ plugin.commitDrag(documentId);
377
+ } else if (isResize && isResizingRef.current) {
378
+ isResizingRef.current = false;
379
+ plugin.commitResize(documentId);
380
+ }
381
+ }
382
+ },
383
+ [plugin, documentId, pageWidth, pageHeight, groupBox, isDraggable, selectedAnnotations]
384
+ );
385
+ const HANDLE_COLOR = (resizeUI == null ? void 0 : resizeUI.color) ?? "#007ACC";
386
+ const HANDLE_SIZE = (resizeUI == null ? void 0 : resizeUI.size) ?? 12;
387
+ const { dragProps, resize } = useInteractionHandles({
388
+ controller: {
389
+ element: previewGroupBox,
390
+ constraints: {
391
+ minWidth: 20,
392
+ minHeight: 20,
393
+ boundingBox: { width: pageWidth, height: pageHeight }
394
+ },
395
+ maintainAspectRatio: false,
396
+ pageRotation: rotation,
397
+ scale,
398
+ enabled: true,
399
+ onUpdate: handleUpdate
400
+ },
401
+ resizeUI: {
402
+ handleSize: HANDLE_SIZE,
403
+ spacing: outlineOffset,
404
+ offsetMode: "outside",
405
+ includeSides: true,
406
+ zIndex: zIndex + 1
407
+ },
408
+ vertexUI: {
409
+ vertexSize: 0,
410
+ zIndex
411
+ },
412
+ includeVertices: false
413
+ });
414
+ if (selectedAnnotations.length < 2) {
415
+ return null;
416
+ }
417
+ return /* @__PURE__ */ jsxs("div", { "data-group-selection-box": true, "data-no-interaction": true, children: [
418
+ /* @__PURE__ */ jsx(
419
+ "div",
420
+ {
421
+ ...isDraggable ? dragProps : {
422
+ onPointerDown: (e) => e.stopPropagation()
423
+ },
424
+ style: {
425
+ position: "absolute",
426
+ left: previewGroupBox.origin.x * scale,
427
+ top: previewGroupBox.origin.y * scale,
428
+ width: previewGroupBox.size.width * scale,
429
+ height: previewGroupBox.size.height * scale,
430
+ outline: `2px dashed ${selectionOutlineColor}`,
431
+ outlineOffset: outlineOffset - 1,
432
+ cursor: isDraggable ? "move" : "default",
433
+ touchAction: "none",
434
+ zIndex
435
+ },
436
+ children: isResizable && resize.map(
437
+ ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
438
+ key,
439
+ ...hProps,
440
+ backgroundColor: HANDLE_COLOR
441
+ }) : /* @__PURE__ */ jsx(
442
+ "div",
443
+ {
444
+ ...hProps,
445
+ style: { ...hProps.style, backgroundColor: HANDLE_COLOR }
446
+ },
447
+ key
448
+ )
449
+ )
450
+ }
451
+ ),
452
+ groupSelectionMenu && /* @__PURE__ */ jsx(
453
+ CounterRotate,
454
+ {
455
+ rect: {
456
+ origin: {
457
+ x: previewGroupBox.origin.x * scale,
458
+ y: previewGroupBox.origin.y * scale
459
+ },
460
+ size: {
461
+ width: previewGroupBox.size.width * scale,
462
+ height: previewGroupBox.size.height * scale
463
+ }
464
+ },
465
+ rotation,
466
+ children: (counterRotateProps) => groupSelectionMenu({
467
+ ...counterRotateProps,
468
+ context: {
469
+ type: "group",
470
+ annotations: selectedAnnotations,
471
+ pageIndex
472
+ },
473
+ selected: true,
474
+ placement: {
475
+ suggestTop: false
476
+ }
477
+ })
478
+ }
479
+ )
480
+ ] });
481
+ }
229
482
  function Highlight({
230
- color = "#FFFF00",
483
+ strokeColor,
231
484
  opacity = 0.5,
232
485
  segmentRects,
233
486
  rect,
@@ -235,6 +488,7 @@ function Highlight({
235
488
  onClick,
236
489
  style
237
490
  }) {
491
+ const resolvedColor = strokeColor ?? "#FFFF00";
238
492
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((b, i) => /* @__PURE__ */ jsx(
239
493
  "div",
240
494
  {
@@ -246,7 +500,7 @@ function Highlight({
246
500
  top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,
247
501
  width: b.size.width * scale,
248
502
  height: b.size.height * scale,
249
- background: color,
503
+ background: resolvedColor,
250
504
  opacity,
251
505
  pointerEvents: onClick ? "auto" : "none",
252
506
  cursor: onClick ? "pointer" : "default",
@@ -258,7 +512,7 @@ function Highlight({
258
512
  )) });
259
513
  }
260
514
  function Underline({
261
- color = "#FFFF00",
515
+ strokeColor,
262
516
  opacity = 0.5,
263
517
  segmentRects,
264
518
  rect,
@@ -266,6 +520,7 @@ function Underline({
266
520
  onClick,
267
521
  style
268
522
  }) {
523
+ const resolvedColor = strokeColor ?? "#FFFF00";
269
524
  const thickness = 2 * scale;
270
525
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((r, i) => /* @__PURE__ */ jsx(
271
526
  "div",
@@ -293,7 +548,7 @@ function Underline({
293
548
  bottom: 0,
294
549
  width: "100%",
295
550
  height: thickness,
296
- background: color,
551
+ background: resolvedColor,
297
552
  opacity,
298
553
  pointerEvents: "none"
299
554
  }
@@ -304,7 +559,7 @@ function Underline({
304
559
  )) });
305
560
  }
306
561
  function Strikeout({
307
- color = "#FFFF00",
562
+ strokeColor,
308
563
  opacity = 0.5,
309
564
  segmentRects,
310
565
  rect,
@@ -312,6 +567,7 @@ function Strikeout({
312
567
  onClick,
313
568
  style
314
569
  }) {
570
+ const resolvedColor = strokeColor ?? "#FFFF00";
315
571
  const thickness = 2 * scale;
316
572
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((r, i) => /* @__PURE__ */ jsx(
317
573
  "div",
@@ -339,7 +595,7 @@ function Strikeout({
339
595
  top: "50%",
340
596
  width: "100%",
341
597
  height: thickness,
342
- background: color,
598
+ background: resolvedColor,
343
599
  opacity,
344
600
  transform: "translateY(-50%)",
345
601
  pointerEvents: "none"
@@ -351,7 +607,7 @@ function Strikeout({
351
607
  )) });
352
608
  }
353
609
  function Squiggly({
354
- color = "#FFFF00",
610
+ strokeColor,
355
611
  opacity = 0.5,
356
612
  segmentRects,
357
613
  rect,
@@ -359,11 +615,12 @@ function Squiggly({
359
615
  onClick,
360
616
  style
361
617
  }) {
618
+ const resolvedColor = strokeColor ?? "#FFFF00";
362
619
  const amplitude = 2 * scale;
363
620
  const period = 6 * scale;
364
621
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${period}" height="${amplitude * 2}" viewBox="0 0 ${period} ${amplitude * 2}">
365
622
  <path d="M0 ${amplitude} Q ${period / 4} 0 ${period / 2} ${amplitude} T ${period} ${amplitude}"
366
- fill="none" stroke="${color}" stroke-width="${amplitude}" stroke-linecap="round"/>
623
+ fill="none" stroke="${resolvedColor}" stroke-width="${amplitude}" stroke-linecap="round"/>
367
624
  </svg>`;
368
625
  const svgDataUri = `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
369
626
  return /* @__PURE__ */ jsx(Fragment, { children: segmentRects.map((r, i) => /* @__PURE__ */ jsx(
@@ -406,7 +663,7 @@ function Squiggly({
406
663
  }
407
664
  function Ink({
408
665
  isSelected,
409
- color = "#000000",
666
+ strokeColor,
410
667
  opacity = 1,
411
668
  strokeWidth,
412
669
  inkList,
@@ -414,6 +671,7 @@ function Ink({
414
671
  scale,
415
672
  onClick
416
673
  }) {
674
+ const resolvedColor = strokeColor ?? "#000000";
417
675
  const paths = useMemo(() => {
418
676
  return inkList.map(({ points }) => {
419
677
  let d = "";
@@ -452,7 +710,7 @@ function Ink({
452
710
  style: {
453
711
  cursor: isSelected ? "move" : "pointer",
454
712
  pointerEvents: isSelected ? "none" : "visibleStroke",
455
- stroke: color,
713
+ stroke: resolvedColor,
456
714
  strokeWidth,
457
715
  strokeLinecap: "round",
458
716
  strokeLinejoin: "round"
@@ -990,7 +1248,7 @@ function FreeText({
990
1248
  flexDirection: "column",
991
1249
  justifyContent: annotation.object.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : annotation.object.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
992
1250
  display: "flex",
993
- backgroundColor: annotation.object.backgroundColor,
1251
+ backgroundColor: annotation.object.color ?? annotation.object.backgroundColor,
994
1252
  opacity: annotation.object.opacity,
995
1253
  width: needsComp ? `${invScalePercent}%` : "100%",
996
1254
  height: needsComp ? `${invScalePercent}%` : "100%",
@@ -1103,26 +1361,123 @@ function Stamp({
1103
1361
  }
1104
1362
  );
1105
1363
  }
1364
+ function Link({
1365
+ isSelected,
1366
+ strokeColor = "#0000FF",
1367
+ strokeWidth = 2,
1368
+ strokeStyle = PdfAnnotationBorderStyle.UNDERLINE,
1369
+ strokeDashArray,
1370
+ rect,
1371
+ scale,
1372
+ onClick,
1373
+ hasIRT = false
1374
+ }) {
1375
+ const { width, height } = useMemo(() => {
1376
+ return {
1377
+ width: rect.size.width,
1378
+ height: rect.size.height
1379
+ };
1380
+ }, [rect]);
1381
+ const svgWidth = width * scale;
1382
+ const svgHeight = height * scale;
1383
+ const dashArray = useMemo(() => {
1384
+ if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
1385
+ return (strokeDashArray == null ? void 0 : strokeDashArray.join(",")) ?? `${strokeWidth * 3},${strokeWidth}`;
1386
+ }
1387
+ return void 0;
1388
+ }, [strokeStyle, strokeDashArray, strokeWidth]);
1389
+ const isUnderline2 = strokeStyle === PdfAnnotationBorderStyle.UNDERLINE;
1390
+ return /* @__PURE__ */ jsxs(
1391
+ "svg",
1392
+ {
1393
+ style: {
1394
+ position: "absolute",
1395
+ width: svgWidth,
1396
+ height: svgHeight,
1397
+ pointerEvents: "none",
1398
+ zIndex: 2
1399
+ },
1400
+ width: svgWidth,
1401
+ height: svgHeight,
1402
+ viewBox: `0 0 ${width} ${height}`,
1403
+ children: [
1404
+ /* @__PURE__ */ jsx(
1405
+ "rect",
1406
+ {
1407
+ x: 0,
1408
+ y: 0,
1409
+ width,
1410
+ height,
1411
+ fill: "transparent",
1412
+ onPointerDown: hasIRT ? void 0 : onClick,
1413
+ onTouchStart: hasIRT ? void 0 : onClick,
1414
+ style: {
1415
+ cursor: hasIRT ? "default" : isSelected ? "move" : "pointer",
1416
+ pointerEvents: hasIRT ? "none" : isSelected ? "none" : "visible"
1417
+ }
1418
+ }
1419
+ ),
1420
+ isUnderline2 ? (
1421
+ // Underline style: line at bottom of rect
1422
+ /* @__PURE__ */ jsx(
1423
+ "line",
1424
+ {
1425
+ x1: 1,
1426
+ y1: height - 1,
1427
+ x2: width - 1,
1428
+ y2: height - 1,
1429
+ stroke: strokeColor,
1430
+ strokeWidth,
1431
+ strokeDasharray: dashArray,
1432
+ style: {
1433
+ pointerEvents: "none"
1434
+ }
1435
+ }
1436
+ )
1437
+ ) : (
1438
+ // Solid/Dashed style: rectangle border
1439
+ /* @__PURE__ */ jsx(
1440
+ "rect",
1441
+ {
1442
+ x: strokeWidth / 2,
1443
+ y: strokeWidth / 2,
1444
+ width: Math.max(width - strokeWidth, 0),
1445
+ height: Math.max(height - strokeWidth, 0),
1446
+ fill: "transparent",
1447
+ stroke: strokeColor,
1448
+ strokeWidth,
1449
+ strokeDasharray: dashArray,
1450
+ style: {
1451
+ pointerEvents: "none"
1452
+ }
1453
+ }
1454
+ )
1455
+ )
1456
+ ]
1457
+ }
1458
+ );
1459
+ }
1106
1460
  function Annotations(annotationsProps) {
1107
- const { documentId, pageIndex, scale, selectionMenu } = annotationsProps;
1461
+ const { documentId, pageIndex, scale, pageWidth, pageHeight, selectionMenu } = annotationsProps;
1108
1462
  const { provides: annotationCapability } = useAnnotationCapability();
1109
1463
  const { provides: selectionProvides } = useSelectionCapability();
1110
1464
  const [annotations, setAnnotations] = useState([]);
1111
1465
  const { register } = usePointerHandlers({ documentId, pageIndex });
1112
- const [selectionState, setSelectionState] = useState(null);
1466
+ const [allSelectedIds, setAllSelectedIds] = useState([]);
1113
1467
  const [editingId, setEditingId] = useState(null);
1114
1468
  const annotationProvides = useMemo(
1115
1469
  () => annotationCapability ? annotationCapability.forDocument(documentId) : null,
1116
1470
  [annotationCapability, documentId]
1117
1471
  );
1472
+ const isMultiSelected = allSelectedIds.length > 1;
1118
1473
  useEffect(() => {
1119
1474
  if (annotationProvides) {
1120
1475
  const currentState = annotationProvides.getState();
1121
1476
  setAnnotations(getAnnotationsByPageIndex(currentState, pageIndex));
1122
- setSelectionState(getSelectedAnnotationByPageIndex(currentState, pageIndex));
1477
+ setAllSelectedIds(getSelectedAnnotationIds(currentState));
1123
1478
  return annotationProvides.onStateChange((state) => {
1124
1479
  setAnnotations(getAnnotationsByPageIndex(state, pageIndex));
1125
- setSelectionState(getSelectedAnnotationByPageIndex(state, pageIndex));
1480
+ setAllSelectedIds(getSelectedAnnotationIds(state));
1126
1481
  });
1127
1482
  }
1128
1483
  }, [annotationProvides, pageIndex]);
@@ -1141,8 +1496,13 @@ function Annotations(annotationsProps) {
1141
1496
  (e, annotation) => {
1142
1497
  e.stopPropagation();
1143
1498
  if (annotationProvides && selectionProvides) {
1144
- annotationProvides.selectAnnotation(pageIndex, annotation.object.id);
1145
1499
  selectionProvides.clear();
1500
+ const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
1501
+ if (isModifierPressed) {
1502
+ annotationProvides.toggleSelection(pageIndex, annotation.object.id);
1503
+ } else {
1504
+ annotationProvides.selectAnnotation(pageIndex, annotation.object.id);
1505
+ }
1146
1506
  if (annotation.object.id !== editingId) {
1147
1507
  setEditingId(null);
1148
1508
  }
@@ -1150,369 +1510,467 @@ function Annotations(annotationsProps) {
1150
1510
  },
1151
1511
  [annotationProvides, selectionProvides, editingId, pageIndex]
1152
1512
  );
1513
+ const handleLinkClick = useCallback(
1514
+ (e, annotation) => {
1515
+ e.stopPropagation();
1516
+ if (!annotationProvides || !selectionProvides) return;
1517
+ selectionProvides.clear();
1518
+ if (annotation.object.inReplyToId) {
1519
+ const parentId = annotation.object.inReplyToId;
1520
+ const parent = annotations.find((a) => a.object.id === parentId);
1521
+ if (parent) {
1522
+ annotationProvides.selectAnnotation(parent.object.pageIndex, parentId);
1523
+ return;
1524
+ }
1525
+ }
1526
+ annotationProvides.selectAnnotation(pageIndex, annotation.object.id);
1527
+ },
1528
+ [annotationProvides, selectionProvides, annotations, pageIndex]
1529
+ );
1153
1530
  useEffect(() => {
1154
1531
  return register(handlers, {
1155
1532
  documentId
1156
1533
  });
1157
1534
  }, [register, handlers]);
1158
- return /* @__PURE__ */ jsx(Fragment, { children: annotations.map((annotation) => {
1159
- const isSelected = (selectionState == null ? void 0 : selectionState.object.id) === annotation.object.id;
1160
- const isEditing = editingId === annotation.object.id;
1161
- const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(annotation.object);
1162
- if (isInk(annotation)) {
1163
- return /* @__PURE__ */ jsx(
1164
- AnnotationContainer,
1165
- {
1166
- trackedAnnotation: annotation,
1167
- isSelected,
1168
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1169
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1170
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1171
- selectionMenu,
1172
- onSelect: (e) => handleClick(e, annotation),
1173
- style: {
1174
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1175
- },
1176
- ...annotationsProps,
1177
- children: (obj) => /* @__PURE__ */ jsx(
1178
- Ink,
1179
- {
1180
- ...obj,
1181
- isSelected,
1182
- scale,
1183
- onClick: (e) => handleClick(e, annotation)
1184
- }
1185
- )
1186
- },
1187
- annotation.object.id
1188
- );
1189
- }
1190
- if (isSquare(annotation)) {
1191
- return /* @__PURE__ */ jsx(
1192
- AnnotationContainer,
1193
- {
1194
- trackedAnnotation: annotation,
1195
- isSelected,
1196
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1197
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1198
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1199
- selectionMenu,
1200
- onSelect: (e) => handleClick(e, annotation),
1201
- style: {
1202
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1203
- },
1204
- ...annotationsProps,
1205
- children: (obj) => /* @__PURE__ */ jsx(
1206
- Square,
1207
- {
1208
- ...obj,
1209
- isSelected,
1210
- scale,
1211
- onClick: (e) => handleClick(e, annotation)
1212
- }
1213
- )
1214
- },
1215
- annotation.object.id
1216
- );
1217
- }
1218
- if (isCircle(annotation)) {
1219
- return /* @__PURE__ */ jsx(
1220
- AnnotationContainer,
1221
- {
1222
- trackedAnnotation: annotation,
1223
- isSelected,
1224
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1225
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1226
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1227
- selectionMenu,
1228
- onSelect: (e) => handleClick(e, annotation),
1229
- style: {
1230
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1231
- },
1232
- ...annotationsProps,
1233
- children: (obj) => /* @__PURE__ */ jsx(
1234
- Circle,
1235
- {
1236
- ...obj,
1237
- isSelected,
1238
- scale,
1239
- onClick: (e) => handleClick(e, annotation)
1240
- }
1241
- )
1242
- },
1243
- annotation.object.id
1244
- );
1245
- }
1246
- if (isUnderline(annotation)) {
1247
- return /* @__PURE__ */ jsx(
1248
- AnnotationContainer,
1249
- {
1250
- trackedAnnotation: annotation,
1251
- isSelected,
1252
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1253
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1254
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1255
- selectionMenu,
1256
- onSelect: (e) => handleClick(e, annotation),
1257
- zIndex: 0,
1258
- style: {
1259
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1535
+ const selectedAnnotationsOnPage = useMemo(() => {
1536
+ return annotations.filter((anno) => allSelectedIds.includes(anno.object.id));
1537
+ }, [annotations, allSelectedIds]);
1538
+ const areAllSelectedDraggable = useMemo(() => {
1539
+ if (selectedAnnotationsOnPage.length < 2) return false;
1540
+ return selectedAnnotationsOnPage.every((ta) => {
1541
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(ta.object);
1542
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) ?? (tool == null ? void 0 : tool.interaction.isDraggable) ?? true;
1543
+ });
1544
+ }, [selectedAnnotationsOnPage, annotationProvides]);
1545
+ const areAllSelectedResizable = useMemo(() => {
1546
+ if (selectedAnnotationsOnPage.length < 2) return false;
1547
+ return selectedAnnotationsOnPage.every((ta) => {
1548
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(ta.object);
1549
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) ?? (tool == null ? void 0 : tool.interaction.isResizable) ?? true;
1550
+ });
1551
+ }, [selectedAnnotationsOnPage, annotationProvides]);
1552
+ const allSelectedOnSamePage = useMemo(() => {
1553
+ if (!annotationProvides) return false;
1554
+ const allSelected = annotationProvides.getSelectedAnnotations();
1555
+ return allSelected.length > 1 && allSelected.every((ta) => ta.object.pageIndex === pageIndex);
1556
+ }, [annotationProvides, pageIndex, allSelectedIds]);
1557
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1558
+ annotations.map((annotation) => {
1559
+ const isSelected = allSelectedIds.includes(annotation.object.id);
1560
+ const isEditing = editingId === annotation.object.id;
1561
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(annotation.object);
1562
+ if (isInk(annotation)) {
1563
+ return /* @__PURE__ */ jsx(
1564
+ AnnotationContainer,
1565
+ {
1566
+ trackedAnnotation: annotation,
1567
+ isSelected,
1568
+ isMultiSelected,
1569
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1570
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1571
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1572
+ selectionMenu,
1573
+ onSelect: (e) => handleClick(e, annotation),
1574
+ style: {
1575
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1576
+ },
1577
+ ...annotationsProps,
1578
+ children: (obj) => /* @__PURE__ */ jsx(
1579
+ Ink,
1580
+ {
1581
+ ...obj,
1582
+ isSelected,
1583
+ scale,
1584
+ onClick: (e) => handleClick(e, annotation)
1585
+ }
1586
+ )
1260
1587
  },
1261
- ...annotationsProps,
1262
- children: (obj) => /* @__PURE__ */ jsx(Underline, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1263
- },
1264
- annotation.object.id
1265
- );
1266
- }
1267
- if (isStrikeout(annotation)) {
1268
- return /* @__PURE__ */ jsx(
1269
- AnnotationContainer,
1270
- {
1271
- trackedAnnotation: annotation,
1272
- isSelected,
1273
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1274
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1275
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1276
- selectionMenu,
1277
- onSelect: (e) => handleClick(e, annotation),
1278
- zIndex: 0,
1279
- style: {
1280
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1588
+ annotation.object.id
1589
+ );
1590
+ }
1591
+ if (isSquare(annotation)) {
1592
+ return /* @__PURE__ */ jsx(
1593
+ AnnotationContainer,
1594
+ {
1595
+ trackedAnnotation: annotation,
1596
+ isSelected,
1597
+ isMultiSelected,
1598
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1599
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1600
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1601
+ selectionMenu,
1602
+ onSelect: (e) => handleClick(e, annotation),
1603
+ style: {
1604
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1605
+ },
1606
+ ...annotationsProps,
1607
+ children: (obj) => /* @__PURE__ */ jsx(
1608
+ Square,
1609
+ {
1610
+ ...obj,
1611
+ isSelected,
1612
+ scale,
1613
+ onClick: (e) => handleClick(e, annotation)
1614
+ }
1615
+ )
1281
1616
  },
1282
- ...annotationsProps,
1283
- children: (obj) => /* @__PURE__ */ jsx(Strikeout, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1284
- },
1285
- annotation.object.id
1286
- );
1287
- }
1288
- if (isSquiggly(annotation)) {
1289
- return /* @__PURE__ */ jsx(
1290
- AnnotationContainer,
1291
- {
1292
- trackedAnnotation: annotation,
1293
- isSelected,
1294
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1295
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1296
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1297
- selectionMenu,
1298
- onSelect: (e) => handleClick(e, annotation),
1299
- zIndex: 0,
1300
- style: {
1301
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1617
+ annotation.object.id
1618
+ );
1619
+ }
1620
+ if (isCircle(annotation)) {
1621
+ return /* @__PURE__ */ jsx(
1622
+ AnnotationContainer,
1623
+ {
1624
+ trackedAnnotation: annotation,
1625
+ isSelected,
1626
+ isMultiSelected,
1627
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1628
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1629
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1630
+ selectionMenu,
1631
+ onSelect: (e) => handleClick(e, annotation),
1632
+ style: {
1633
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1634
+ },
1635
+ ...annotationsProps,
1636
+ children: (obj) => /* @__PURE__ */ jsx(
1637
+ Circle,
1638
+ {
1639
+ ...obj,
1640
+ isSelected,
1641
+ scale,
1642
+ onClick: (e) => handleClick(e, annotation)
1643
+ }
1644
+ )
1302
1645
  },
1303
- ...annotationsProps,
1304
- children: (obj) => /* @__PURE__ */ jsx(Squiggly, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1305
- },
1306
- annotation.object.id
1307
- );
1308
- }
1309
- if (isHighlight(annotation)) {
1310
- return /* @__PURE__ */ jsx(
1311
- AnnotationContainer,
1312
- {
1313
- trackedAnnotation: annotation,
1314
- isSelected,
1315
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1316
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1317
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1318
- selectionMenu,
1319
- onSelect: (e) => handleClick(e, annotation),
1320
- zIndex: 0,
1321
- style: {
1322
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Multiply)
1646
+ annotation.object.id
1647
+ );
1648
+ }
1649
+ if (isUnderline(annotation)) {
1650
+ return /* @__PURE__ */ jsx(
1651
+ AnnotationContainer,
1652
+ {
1653
+ trackedAnnotation: annotation,
1654
+ isSelected,
1655
+ isMultiSelected,
1656
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1657
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1658
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1659
+ selectionMenu,
1660
+ onSelect: (e) => handleClick(e, annotation),
1661
+ zIndex: 0,
1662
+ style: {
1663
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1664
+ },
1665
+ ...annotationsProps,
1666
+ children: (obj) => /* @__PURE__ */ jsx(Underline, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1323
1667
  },
1324
- ...annotationsProps,
1325
- children: (obj) => /* @__PURE__ */ jsx(Highlight, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1326
- },
1327
- annotation.object.id
1328
- );
1329
- }
1330
- if (isLine(annotation)) {
1331
- return /* @__PURE__ */ jsx(
1332
- AnnotationContainer,
1333
- {
1334
- trackedAnnotation: annotation,
1335
- isSelected,
1336
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1337
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1338
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1339
- selectionMenu,
1340
- onSelect: (e) => handleClick(e, annotation),
1341
- vertexConfig: {
1342
- extractVertices: (annotation2) => [
1343
- annotation2.linePoints.start,
1344
- annotation2.linePoints.end
1345
- ],
1346
- transformAnnotation: (annotation2, vertices) => {
1347
- return {
1348
- ...annotation2,
1349
- linePoints: {
1350
- start: vertices[0],
1351
- end: vertices[1]
1352
- }
1353
- };
1354
- }
1668
+ annotation.object.id
1669
+ );
1670
+ }
1671
+ if (isStrikeout(annotation)) {
1672
+ return /* @__PURE__ */ jsx(
1673
+ AnnotationContainer,
1674
+ {
1675
+ trackedAnnotation: annotation,
1676
+ isSelected,
1677
+ isMultiSelected,
1678
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1679
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1680
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1681
+ selectionMenu,
1682
+ onSelect: (e) => handleClick(e, annotation),
1683
+ zIndex: 0,
1684
+ style: {
1685
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1686
+ },
1687
+ ...annotationsProps,
1688
+ children: (obj) => /* @__PURE__ */ jsx(Strikeout, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1355
1689
  },
1356
- style: {
1357
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1690
+ annotation.object.id
1691
+ );
1692
+ }
1693
+ if (isSquiggly(annotation)) {
1694
+ return /* @__PURE__ */ jsx(
1695
+ AnnotationContainer,
1696
+ {
1697
+ trackedAnnotation: annotation,
1698
+ isSelected,
1699
+ isMultiSelected,
1700
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1701
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1702
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1703
+ selectionMenu,
1704
+ onSelect: (e) => handleClick(e, annotation),
1705
+ zIndex: 0,
1706
+ style: {
1707
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1708
+ },
1709
+ ...annotationsProps,
1710
+ children: (obj) => /* @__PURE__ */ jsx(Squiggly, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1358
1711
  },
1359
- ...annotationsProps,
1360
- children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1361
- Line,
1362
- {
1363
- ...obj,
1364
- isSelected,
1365
- scale,
1366
- onClick: (e) => handleClick(e, annotation)
1367
- }
1368
- ) })
1369
- },
1370
- annotation.object.id
1371
- );
1372
- }
1373
- if (isPolyline(annotation)) {
1374
- return /* @__PURE__ */ jsx(
1375
- AnnotationContainer,
1376
- {
1377
- trackedAnnotation: annotation,
1378
- isSelected,
1379
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1380
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1381
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1382
- selectionMenu,
1383
- onSelect: (e) => handleClick(e, annotation),
1384
- vertexConfig: {
1385
- extractVertices: (annotation2) => annotation2.vertices,
1386
- transformAnnotation: (annotation2, vertices) => {
1387
- return {
1388
- ...annotation2,
1389
- vertices
1390
- };
1391
- }
1712
+ annotation.object.id
1713
+ );
1714
+ }
1715
+ if (isHighlight(annotation)) {
1716
+ return /* @__PURE__ */ jsx(
1717
+ AnnotationContainer,
1718
+ {
1719
+ trackedAnnotation: annotation,
1720
+ isSelected,
1721
+ isMultiSelected,
1722
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? false,
1723
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1724
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1725
+ selectionMenu,
1726
+ onSelect: (e) => handleClick(e, annotation),
1727
+ zIndex: 0,
1728
+ style: {
1729
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Multiply)
1730
+ },
1731
+ ...annotationsProps,
1732
+ children: (obj) => /* @__PURE__ */ jsx(Highlight, { ...obj, scale, onClick: (e) => handleClick(e, annotation) })
1392
1733
  },
1393
- style: {
1394
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1734
+ annotation.object.id
1735
+ );
1736
+ }
1737
+ if (isLine(annotation)) {
1738
+ return /* @__PURE__ */ jsx(
1739
+ AnnotationContainer,
1740
+ {
1741
+ trackedAnnotation: annotation,
1742
+ isSelected,
1743
+ isMultiSelected,
1744
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1745
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1746
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1747
+ selectionMenu,
1748
+ onSelect: (e) => handleClick(e, annotation),
1749
+ vertexConfig: {
1750
+ extractVertices: (annotation2) => [
1751
+ annotation2.linePoints.start,
1752
+ annotation2.linePoints.end
1753
+ ],
1754
+ transformAnnotation: (annotation2, vertices) => {
1755
+ return {
1756
+ ...annotation2,
1757
+ linePoints: {
1758
+ start: vertices[0],
1759
+ end: vertices[1]
1760
+ }
1761
+ };
1762
+ }
1763
+ },
1764
+ style: {
1765
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1766
+ },
1767
+ ...annotationsProps,
1768
+ children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1769
+ Line,
1770
+ {
1771
+ ...obj,
1772
+ isSelected,
1773
+ scale,
1774
+ onClick: (e) => handleClick(e, annotation)
1775
+ }
1776
+ ) })
1395
1777
  },
1396
- ...annotationsProps,
1397
- children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1398
- Polyline,
1399
- {
1400
- ...obj,
1401
- isSelected,
1402
- scale,
1403
- onClick: (e) => handleClick(e, annotation)
1404
- }
1405
- ) })
1406
- },
1407
- annotation.object.id
1408
- );
1409
- }
1410
- if (isPolygon(annotation)) {
1411
- return /* @__PURE__ */ jsx(
1412
- AnnotationContainer,
1413
- {
1414
- trackedAnnotation: annotation,
1415
- isSelected,
1416
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1417
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1418
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1419
- selectionMenu,
1420
- onSelect: (e) => handleClick(e, annotation),
1421
- vertexConfig: {
1422
- extractVertices: (annotation2) => annotation2.vertices,
1423
- transformAnnotation: (annotation2, vertices) => {
1424
- return {
1425
- ...annotation2,
1426
- vertices
1427
- };
1428
- }
1778
+ annotation.object.id
1779
+ );
1780
+ }
1781
+ if (isPolyline(annotation)) {
1782
+ return /* @__PURE__ */ jsx(
1783
+ AnnotationContainer,
1784
+ {
1785
+ trackedAnnotation: annotation,
1786
+ isSelected,
1787
+ isMultiSelected,
1788
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1789
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1790
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1791
+ selectionMenu,
1792
+ onSelect: (e) => handleClick(e, annotation),
1793
+ vertexConfig: {
1794
+ extractVertices: (annotation2) => annotation2.vertices,
1795
+ transformAnnotation: (annotation2, vertices) => {
1796
+ return {
1797
+ ...annotation2,
1798
+ vertices
1799
+ };
1800
+ }
1801
+ },
1802
+ style: {
1803
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1804
+ },
1805
+ ...annotationsProps,
1806
+ children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1807
+ Polyline,
1808
+ {
1809
+ ...obj,
1810
+ isSelected,
1811
+ scale,
1812
+ onClick: (e) => handleClick(e, annotation)
1813
+ }
1814
+ ) })
1429
1815
  },
1430
- style: {
1431
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1816
+ annotation.object.id
1817
+ );
1818
+ }
1819
+ if (isPolygon(annotation)) {
1820
+ return /* @__PURE__ */ jsx(
1821
+ AnnotationContainer,
1822
+ {
1823
+ trackedAnnotation: annotation,
1824
+ isSelected,
1825
+ isMultiSelected,
1826
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1827
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? false,
1828
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1829
+ selectionMenu,
1830
+ onSelect: (e) => handleClick(e, annotation),
1831
+ vertexConfig: {
1832
+ extractVertices: (annotation2) => annotation2.vertices,
1833
+ transformAnnotation: (annotation2, vertices) => {
1834
+ return {
1835
+ ...annotation2,
1836
+ vertices
1837
+ };
1838
+ }
1839
+ },
1840
+ style: {
1841
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1842
+ },
1843
+ ...annotationsProps,
1844
+ children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1845
+ Polygon,
1846
+ {
1847
+ ...obj,
1848
+ isSelected,
1849
+ scale,
1850
+ onClick: (e) => handleClick(e, annotation)
1851
+ }
1852
+ ) })
1432
1853
  },
1433
- ...annotationsProps,
1434
- children: (obj) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
1435
- Polygon,
1436
- {
1437
- ...obj,
1438
- isSelected,
1439
- scale,
1440
- onClick: (e) => handleClick(e, annotation)
1441
- }
1442
- ) })
1443
- },
1444
- annotation.object.id
1445
- );
1446
- }
1447
- if (isFreeText(annotation)) {
1448
- return /* @__PURE__ */ jsx(
1449
- AnnotationContainer,
1450
- {
1451
- trackedAnnotation: annotation,
1452
- isSelected,
1453
- isDraggable: ((tool == null ? void 0 : tool.interaction.isDraggable) ?? true) && !isEditing,
1454
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1455
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1456
- selectionMenu,
1457
- onSelect: (e) => handleClick(e, annotation),
1458
- style: {
1459
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1854
+ annotation.object.id
1855
+ );
1856
+ }
1857
+ if (isFreeText(annotation)) {
1858
+ return /* @__PURE__ */ jsx(
1859
+ AnnotationContainer,
1860
+ {
1861
+ trackedAnnotation: annotation,
1862
+ isSelected,
1863
+ isMultiSelected,
1864
+ isDraggable: ((tool == null ? void 0 : tool.interaction.isDraggable) ?? true) && !isEditing,
1865
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1866
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1867
+ selectionMenu,
1868
+ onSelect: (e) => handleClick(e, annotation),
1869
+ style: {
1870
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1871
+ },
1872
+ onDoubleClick: (e) => {
1873
+ e.stopPropagation();
1874
+ setEditingId(annotation.object.id);
1875
+ },
1876
+ ...annotationsProps,
1877
+ children: (object) => /* @__PURE__ */ jsx(
1878
+ FreeText,
1879
+ {
1880
+ isSelected,
1881
+ isEditing,
1882
+ annotation: {
1883
+ ...annotation,
1884
+ object
1885
+ },
1886
+ pageIndex,
1887
+ scale,
1888
+ onClick: (e) => handleClick(e, annotation)
1889
+ }
1890
+ )
1460
1891
  },
1461
- onDoubleClick: (e) => {
1462
- e.stopPropagation();
1463
- setEditingId(annotation.object.id);
1892
+ annotation.object.id
1893
+ );
1894
+ }
1895
+ if (isStamp(annotation)) {
1896
+ return /* @__PURE__ */ jsx(
1897
+ AnnotationContainer,
1898
+ {
1899
+ trackedAnnotation: annotation,
1900
+ isSelected,
1901
+ isMultiSelected,
1902
+ isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1903
+ isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1904
+ lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1905
+ selectionMenu,
1906
+ onSelect: (e) => handleClick(e, annotation),
1907
+ style: {
1908
+ mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1909
+ },
1910
+ ...annotationsProps,
1911
+ children: (_object) => /* @__PURE__ */ jsx(
1912
+ Stamp,
1913
+ {
1914
+ isSelected,
1915
+ annotation,
1916
+ documentId,
1917
+ pageIndex,
1918
+ scale,
1919
+ onClick: (e) => handleClick(e, annotation)
1920
+ }
1921
+ )
1464
1922
  },
1465
- ...annotationsProps,
1466
- children: (object) => /* @__PURE__ */ jsx(
1467
- FreeText,
1468
- {
1469
- isSelected,
1470
- isEditing,
1471
- annotation: {
1472
- ...annotation,
1473
- object
1474
- },
1475
- pageIndex,
1476
- scale,
1477
- onClick: (e) => handleClick(e, annotation)
1478
- }
1479
- )
1480
- },
1481
- annotation.object.id
1482
- );
1483
- }
1484
- if (isStamp(annotation)) {
1485
- return /* @__PURE__ */ jsx(
1486
- AnnotationContainer,
1487
- {
1488
- trackedAnnotation: annotation,
1489
- isSelected,
1490
- isDraggable: (tool == null ? void 0 : tool.interaction.isDraggable) ?? true,
1491
- isResizable: (tool == null ? void 0 : tool.interaction.isResizable) ?? true,
1492
- lockAspectRatio: (tool == null ? void 0 : tool.interaction.lockAspectRatio) ?? false,
1493
- selectionMenu,
1494
- onSelect: (e) => handleClick(e, annotation),
1495
- style: {
1496
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
1923
+ annotation.object.id
1924
+ );
1925
+ }
1926
+ if (isLink(annotation)) {
1927
+ const hasIRT = !!annotation.object.inReplyToId;
1928
+ return /* @__PURE__ */ jsx(
1929
+ AnnotationContainer,
1930
+ {
1931
+ trackedAnnotation: annotation,
1932
+ isSelected,
1933
+ isMultiSelected,
1934
+ isDraggable: false,
1935
+ isResizable: false,
1936
+ lockAspectRatio: false,
1937
+ selectionMenu: hasIRT ? void 0 : selectionMenu,
1938
+ onSelect: (e) => handleLinkClick(e, annotation),
1939
+ ...annotationsProps,
1940
+ children: (obj) => /* @__PURE__ */ jsx(
1941
+ Link,
1942
+ {
1943
+ ...obj,
1944
+ isSelected,
1945
+ scale,
1946
+ onClick: (e) => handleLinkClick(e, annotation),
1947
+ hasIRT
1948
+ }
1949
+ )
1497
1950
  },
1498
- ...annotationsProps,
1499
- children: (_object) => /* @__PURE__ */ jsx(
1500
- Stamp,
1501
- {
1502
- isSelected,
1503
- annotation,
1504
- documentId,
1505
- pageIndex,
1506
- scale,
1507
- onClick: (e) => handleClick(e, annotation)
1508
- }
1509
- )
1510
- },
1511
- annotation.object.id
1512
- );
1513
- }
1514
- return null;
1515
- }) });
1951
+ annotation.object.id
1952
+ );
1953
+ }
1954
+ return null;
1955
+ }),
1956
+ allSelectedOnSamePage && selectedAnnotationsOnPage.length >= 2 && /* @__PURE__ */ jsx(
1957
+ GroupSelectionBox,
1958
+ {
1959
+ documentId,
1960
+ pageIndex,
1961
+ scale,
1962
+ rotation: annotationsProps.rotation,
1963
+ pageWidth,
1964
+ pageHeight,
1965
+ selectedAnnotations: selectedAnnotationsOnPage,
1966
+ isDraggable: areAllSelectedDraggable,
1967
+ isResizable: areAllSelectedResizable,
1968
+ resizeUI: annotationsProps.resizeUI,
1969
+ selectionOutlineColor: annotationsProps.selectionOutlineColor,
1970
+ groupSelectionMenu: annotationsProps.groupSelectionMenu
1971
+ }
1972
+ )
1973
+ ] });
1516
1974
  }
1517
1975
  function TextMarkup({ documentId, pageIndex, scale }) {
1518
1976
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
@@ -1549,7 +2007,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1549
2007
  children: /* @__PURE__ */ jsx(
1550
2008
  Underline,
1551
2009
  {
1552
- color: (_b = activeTool.defaults) == null ? void 0 : _b.color,
2010
+ strokeColor: (_b = activeTool.defaults) == null ? void 0 : _b.strokeColor,
1553
2011
  opacity: (_c = activeTool.defaults) == null ? void 0 : _c.opacity,
1554
2012
  segmentRects: rects,
1555
2013
  scale
@@ -1570,7 +2028,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1570
2028
  children: /* @__PURE__ */ jsx(
1571
2029
  Highlight,
1572
2030
  {
1573
- color: (_e = activeTool.defaults) == null ? void 0 : _e.color,
2031
+ strokeColor: (_e = activeTool.defaults) == null ? void 0 : _e.strokeColor,
1574
2032
  opacity: (_f = activeTool.defaults) == null ? void 0 : _f.opacity,
1575
2033
  segmentRects: rects,
1576
2034
  scale
@@ -1591,7 +2049,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1591
2049
  children: /* @__PURE__ */ jsx(
1592
2050
  Strikeout,
1593
2051
  {
1594
- color: (_h = activeTool.defaults) == null ? void 0 : _h.color,
2052
+ strokeColor: (_h = activeTool.defaults) == null ? void 0 : _h.strokeColor,
1595
2053
  opacity: (_i = activeTool.defaults) == null ? void 0 : _i.opacity,
1596
2054
  segmentRects: rects,
1597
2055
  scale
@@ -1612,7 +2070,7 @@ function TextMarkup({ documentId, pageIndex, scale }) {
1612
2070
  children: /* @__PURE__ */ jsx(
1613
2071
  Squiggly,
1614
2072
  {
1615
- color: (_k = activeTool.defaults) == null ? void 0 : _k.color,
2073
+ strokeColor: (_k = activeTool.defaults) == null ? void 0 : _k.strokeColor,
1616
2074
  opacity: (_l = activeTool.defaults) == null ? void 0 : _l.opacity,
1617
2075
  segmentRects: rects,
1618
2076
  scale
@@ -1745,6 +2203,7 @@ function AnnotationLayer({
1745
2203
  scale: overrideScale,
1746
2204
  rotation: overrideRotation,
1747
2205
  selectionMenu,
2206
+ groupSelectionMenu,
1748
2207
  resizeUI,
1749
2208
  vertexUI,
1750
2209
  selectionOutlineColor,
@@ -1777,6 +2236,7 @@ function AnnotationLayer({
1777
2236
  {
1778
2237
  documentId,
1779
2238
  selectionMenu,
2239
+ groupSelectionMenu,
1780
2240
  pageIndex,
1781
2241
  scale: actualScale,
1782
2242
  rotation: actualRotation,
@@ -1796,6 +2256,7 @@ function AnnotationLayer({
1796
2256
  }
1797
2257
  export {
1798
2258
  AnnotationLayer,
2259
+ GroupSelectionBox,
1799
2260
  useAnnotation,
1800
2261
  useAnnotationCapability,
1801
2262
  useAnnotationPlugin