@embedpdf/plugin-annotation 2.2.0 → 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 +1196 -92
  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 +857 -403
  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 +857 -403
  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 +905 -255
  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 +946 -406
  95. package/dist/vue/index.js.map +1 -1
  96. package/dist/vue/types.d.ts +7 -0
  97. package/package.json +10 -10
package/dist/vue/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { ref, toValue, watch, computed, defineComponent, shallowRef, toRaw, useSlots, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, mergeProps, unref, renderSlot, Fragment, renderList, withCtx, resolveDynamicComponent, normalizeStyle, onMounted, toDisplayString, onUnmounted, createVNode, watchEffect, normalizeProps, guardReactiveProps } from "vue";
1
+ import { ref, toValue, watch, computed, defineComponent, shallowRef, toRaw, useSlots, watchEffect, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, mergeProps, unref, renderSlot, Fragment, renderList, withCtx, resolveDynamicComponent, normalizeStyle, onMounted, toDisplayString, onUnmounted, createVNode, createSlots, normalizeProps, guardReactiveProps } from "vue";
2
2
  import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
3
- import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight } from "@embedpdf/plugin-annotation";
3
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight, isLink } from "@embedpdf/plugin-annotation";
4
4
  export * from "@embedpdf/plugin-annotation";
5
5
  import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
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/vue";
8
8
  import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
9
9
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
@@ -36,14 +36,14 @@ const useAnnotation = (documentId) => {
36
36
  })
37
37
  };
38
38
  };
39
- const _hoisted_1$8 = {
39
+ const _hoisted_1$a = {
40
40
  "data-no-interaction": "",
41
41
  style: { display: "contents" }
42
42
  };
43
43
  const __default__ = {
44
44
  inheritAttrs: false
45
45
  };
46
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
46
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
47
47
  ...__default__,
48
48
  __name: "annotation-container",
49
49
  props: {
@@ -55,6 +55,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
55
55
  pageHeight: {},
56
56
  trackedAnnotation: {},
57
57
  isSelected: { type: Boolean },
58
+ isMultiSelected: { type: Boolean, default: false },
58
59
  isDraggable: { type: Boolean },
59
60
  isResizable: { type: Boolean },
60
61
  lockAspectRatio: { type: Boolean, default: false },
@@ -75,13 +76,15 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
75
76
  const VERTEX_SIZE = 12;
76
77
  const preview = shallowRef(toRaw(props.trackedAnnotation.object));
77
78
  const { provides: annotationCapability } = useAnnotationCapability();
79
+ const { plugin: annotationPlugin } = useAnnotationPlugin();
78
80
  const permissions = useDocumentPermissions(props.documentId);
79
81
  const gestureBaseRef = ref(null);
82
+ const gestureBaseRectRef = shallowRef(null);
80
83
  const effectiveIsDraggable = computed(
81
- () => permissions.value.canModifyAnnotations && props.isDraggable
84
+ () => permissions.value.canModifyAnnotations && props.isDraggable && !props.isMultiSelected
82
85
  );
83
86
  const effectiveIsResizable = computed(
84
- () => permissions.value.canModifyAnnotations && props.isResizable
87
+ () => permissions.value.canModifyAnnotations && props.isResizable && !props.isMultiSelected
85
88
  );
86
89
  const guardedOnDoubleClick = props.onDoubleClick ? (e) => {
87
90
  var _a;
@@ -95,8 +98,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
95
98
  const currentObject = computed(
96
99
  () => ({ ...toRaw(props.trackedAnnotation.object), ...toRaw(preview.value) })
97
100
  );
101
+ const showOutline = computed(() => props.isSelected && !props.isMultiSelected);
98
102
  const shouldShowMenu = computed(() => {
99
- return props.isSelected && (props.selectionMenu || slots["selection-menu"]);
103
+ return props.isSelected && !props.isMultiSelected && (props.selectionMenu || slots["selection-menu"]);
100
104
  });
101
105
  const menuRect = computed(() => ({
102
106
  origin: {
@@ -154,30 +158,60 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
154
158
  maintainAspectRatio: computed(() => props.lockAspectRatio),
155
159
  pageRotation: computed(() => props.rotation),
156
160
  scale: computed(() => props.scale),
157
- enabled: computed(() => props.isSelected),
161
+ // Disable interaction handles when multi-selected
162
+ enabled: computed(() => props.isSelected && !props.isMultiSelected),
158
163
  onUpdate: (event) => {
159
- var _a, _b, _c, _d;
160
- if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
164
+ var _a, _b, _c;
165
+ if (!((_a = event.transformData) == null ? void 0 : _a.type) || props.isMultiSelected) return;
166
+ const plugin = annotationPlugin.value;
167
+ if (!plugin) return;
168
+ const { type, changes, metadata } = event.transformData;
169
+ const id = props.trackedAnnotation.object.id;
170
+ const pageSize = { width: props.pageWidth, height: props.pageHeight };
161
171
  if (event.state === "start") {
172
+ gestureBaseRectRef.value = props.trackedAnnotation.object.rect;
162
173
  gestureBaseRef.value = currentObject.value;
174
+ if (type === "move") {
175
+ plugin.startDrag(props.documentId, { annotationIds: [id], pageSize });
176
+ } else if (type === "resize") {
177
+ plugin.startResize(props.documentId, {
178
+ annotationIds: [id],
179
+ pageSize,
180
+ resizeHandle: (metadata == null ? void 0 : metadata.handle) ?? "se"
181
+ });
182
+ }
163
183
  }
164
- const base = gestureBaseRef.value ?? currentObject.value;
165
- const changes = event.transformData.changes.vertices ? (_b = props.vertexConfig) == null ? void 0 : _b.transformAnnotation(toRaw(base), event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
166
- const patched = (_c = annotationCapability.value) == null ? void 0 : _c.transformAnnotation(base, {
167
- type: event.transformData.type,
168
- changes,
169
- metadata: event.transformData.metadata
170
- });
171
- if (patched) {
172
- preview.value = { ...toRaw(preview.value), ...patched };
184
+ if (changes.rect && gestureBaseRectRef.value) {
185
+ if (type === "move") {
186
+ const delta = {
187
+ x: changes.rect.origin.x - gestureBaseRectRef.value.origin.x,
188
+ y: changes.rect.origin.y - gestureBaseRectRef.value.origin.y
189
+ };
190
+ plugin.updateDrag(props.documentId, delta);
191
+ } else if (type === "resize") {
192
+ plugin.updateResize(props.documentId, changes.rect);
193
+ }
173
194
  }
174
- if (event.state === "end" && patched) {
195
+ if (type === "vertex-edit" && changes.vertices && props.vertexConfig) {
196
+ const base = gestureBaseRef.value ?? currentObject.value;
197
+ const vertexChanges = props.vertexConfig.transformAnnotation(toRaw(base), changes.vertices);
198
+ const patched = (_b = annotationCapability.value) == null ? void 0 : _b.transformAnnotation(base, {
199
+ type,
200
+ changes: vertexChanges,
201
+ metadata
202
+ });
203
+ if (patched) {
204
+ preview.value = { ...toRaw(preview.value), ...patched };
205
+ if (event.state === "end") {
206
+ (_c = annotationProvides.value) == null ? void 0 : _c.updateAnnotation(props.pageIndex, id, patched);
207
+ }
208
+ }
209
+ }
210
+ if (event.state === "end") {
211
+ gestureBaseRectRef.value = null;
175
212
  gestureBaseRef.value = null;
176
- (_d = annotationProvides.value) == null ? void 0 : _d.updateAnnotation(
177
- props.pageIndex,
178
- props.trackedAnnotation.object.id,
179
- patched
180
- );
213
+ if (type === "move") plugin.commitDrag(props.documentId);
214
+ else if (type === "resize") plugin.commitResize(props.documentId);
181
215
  }
182
216
  }
183
217
  },
@@ -202,15 +236,32 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
202
236
  },
203
237
  { deep: true }
204
238
  );
239
+ watchEffect((onCleanup) => {
240
+ const plugin = annotationPlugin.value;
241
+ if (!plugin) return;
242
+ const id = props.trackedAnnotation.object.id;
243
+ const handleEvent = (event) => {
244
+ var _a;
245
+ if (event.documentId !== props.documentId) return;
246
+ const patch = (_a = event.previewPatches) == null ? void 0 : _a[id];
247
+ if (event.type === "update" && patch) {
248
+ preview.value = { ...toRaw(preview.value), ...patch };
249
+ } else if (event.type === "cancel") {
250
+ preview.value = props.trackedAnnotation.object;
251
+ }
252
+ };
253
+ const unsubs = [plugin.onDragChange(handleEvent), plugin.onResizeChange(handleEvent)];
254
+ onCleanup(() => unsubs.forEach((u) => u()));
255
+ });
205
256
  const containerStyle = computed(() => ({
206
257
  position: "absolute",
207
258
  left: `${currentObject.value.rect.origin.x * props.scale}px`,
208
259
  top: `${currentObject.value.rect.origin.y * props.scale}px`,
209
260
  width: `${currentObject.value.rect.size.width * props.scale}px`,
210
261
  height: `${currentObject.value.rect.size.height * props.scale}px`,
211
- outline: props.isSelected ? `1px solid ${props.selectionOutlineColor}` : "none",
212
- outlineOffset: props.isSelected ? `${props.outlineOffset}px` : "0px",
213
- pointerEvents: props.isSelected ? "auto" : "none",
262
+ outline: showOutline.value ? `1px solid ${props.selectionOutlineColor}` : "none",
263
+ outlineOffset: showOutline.value ? `${props.outlineOffset}px` : "0px",
264
+ pointerEvents: props.isSelected && !props.isMultiSelected ? "auto" : "none",
214
265
  touchAction: "none",
215
266
  cursor: props.isSelected && effectiveIsDraggable.value ? "move" : "default",
216
267
  zIndex: props.zIndex
@@ -221,7 +272,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
221
272
  }));
222
273
  const slots = useSlots();
223
274
  return (_ctx, _cache) => {
224
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
275
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
225
276
  createElementVNode("div", mergeProps({ ...effectiveIsDraggable.value && __props.isSelected ? unref(dragProps) : {}, ...unref(doubleProps) }, { style: mergedContainerStyle.value }), [
226
277
  renderSlot(_ctx.$slots, "default", { annotation: currentObject.value }),
227
278
  __props.isSelected && effectiveIsResizable.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
@@ -241,7 +292,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
241
292
  }), null, 16))
242
293
  ], 64);
243
294
  }), 128)) : createCommentVNode("", true),
244
- __props.isSelected && unref(permissions).canModifyAnnotations && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
295
+ __props.isSelected && unref(permissions).canModifyAnnotations && !__props.isMultiSelected && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
245
296
  return openBlock(), createElementBlock(Fragment, { key }, [
246
297
  unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
247
298
  key: 0,
@@ -280,9 +331,238 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
280
331
  };
281
332
  }
282
333
  });
283
- const _hoisted_1$7 = ["width", "height", "viewBox"];
284
- const _hoisted_2$5 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
285
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
334
+ const _hoisted_1$9 = {
335
+ key: 0,
336
+ "data-group-selection-box": "",
337
+ "data-no-interaction": ""
338
+ };
339
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
340
+ __name: "group-selection-box",
341
+ props: {
342
+ documentId: {},
343
+ pageIndex: {},
344
+ scale: {},
345
+ rotation: {},
346
+ pageWidth: {},
347
+ pageHeight: {},
348
+ selectedAnnotations: {},
349
+ isDraggable: { type: Boolean },
350
+ isResizable: { type: Boolean },
351
+ resizeUI: {},
352
+ selectionOutlineColor: { default: "#007ACC" },
353
+ outlineOffset: { default: 2 },
354
+ zIndex: { default: 100 },
355
+ groupSelectionMenu: {}
356
+ },
357
+ setup(__props) {
358
+ const props = __props;
359
+ const slots = useSlots();
360
+ const { plugin: annotationPlugin } = useAnnotationPlugin();
361
+ const gestureBase = shallowRef(null);
362
+ const isDraggingRef = ref(false);
363
+ const isResizingRef = ref(false);
364
+ const HANDLE_COLOR = computed(() => {
365
+ var _a;
366
+ return ((_a = props.resizeUI) == null ? void 0 : _a.color) ?? "#007ACC";
367
+ });
368
+ const HANDLE_SIZE = computed(() => {
369
+ var _a;
370
+ return ((_a = props.resizeUI) == null ? void 0 : _a.size) ?? 12;
371
+ });
372
+ const groupBox = computed(() => {
373
+ const rects = props.selectedAnnotations.map((ta) => ta.object.rect);
374
+ return boundingRectOrEmpty(rects);
375
+ });
376
+ const previewGroupBox = shallowRef(groupBox.value);
377
+ watch(
378
+ () => groupBox.value,
379
+ (newGroupBox) => {
380
+ if (!isDraggingRef.value && !isResizingRef.value) {
381
+ previewGroupBox.value = newGroupBox;
382
+ }
383
+ },
384
+ { immediate: true }
385
+ );
386
+ const boxStyle = computed(() => ({
387
+ position: "absolute",
388
+ left: `${previewGroupBox.value.origin.x * props.scale}px`,
389
+ top: `${previewGroupBox.value.origin.y * props.scale}px`,
390
+ width: `${previewGroupBox.value.size.width * props.scale}px`,
391
+ height: `${previewGroupBox.value.size.height * props.scale}px`,
392
+ outline: `2px dashed ${props.selectionOutlineColor}`,
393
+ outlineOffset: `${props.outlineOffset - 1}px`,
394
+ cursor: props.isDraggable ? "move" : "default",
395
+ touchAction: "none",
396
+ zIndex: props.zIndex
397
+ }));
398
+ const menuRect = computed(() => ({
399
+ origin: {
400
+ x: previewGroupBox.value.origin.x * props.scale,
401
+ y: previewGroupBox.value.origin.y * props.scale
402
+ },
403
+ size: {
404
+ width: previewGroupBox.value.size.width * props.scale,
405
+ height: previewGroupBox.value.size.height * props.scale
406
+ }
407
+ }));
408
+ const menuContext = computed(() => ({
409
+ type: "group",
410
+ annotations: props.selectedAnnotations,
411
+ pageIndex: props.pageIndex
412
+ }));
413
+ const menuPlacement = computed(() => ({
414
+ suggestTop: false
415
+ }));
416
+ const shouldShowMenu = computed(() => {
417
+ return props.groupSelectionMenu || slots["group-selection-menu"];
418
+ });
419
+ const renderGroupMenu = (rect, menuWrapperProps) => {
420
+ if (!props.groupSelectionMenu) return null;
421
+ return props.groupSelectionMenu({
422
+ rect,
423
+ menuWrapperProps,
424
+ selected: true,
425
+ placement: menuPlacement.value,
426
+ context: menuContext.value
427
+ });
428
+ };
429
+ const elementSnapshot = computed(() => previewGroupBox.value);
430
+ const constraintsSnapshot = computed(() => ({
431
+ minWidth: 20,
432
+ minHeight: 20,
433
+ boundingBox: {
434
+ width: props.pageWidth,
435
+ height: props.pageHeight
436
+ }
437
+ }));
438
+ const { dragProps, resize } = useInteractionHandles({
439
+ controller: {
440
+ element: elementSnapshot,
441
+ vertices: computed(() => []),
442
+ constraints: constraintsSnapshot,
443
+ maintainAspectRatio: computed(() => false),
444
+ pageRotation: computed(() => props.rotation),
445
+ scale: computed(() => props.scale),
446
+ enabled: computed(() => true),
447
+ onUpdate: (event) => {
448
+ var _a, _b;
449
+ if (!((_a = event.transformData) == null ? void 0 : _a.type)) return;
450
+ if (!annotationPlugin.value) return;
451
+ const plugin = annotationPlugin.value;
452
+ const transformType = event.transformData.type;
453
+ const isMove = transformType === "move";
454
+ const isResize = transformType === "resize";
455
+ if (isMove && !props.isDraggable) return;
456
+ if (event.state === "start") {
457
+ gestureBase.value = groupBox.value;
458
+ if (isMove) {
459
+ isDraggingRef.value = true;
460
+ plugin.startDrag(props.documentId, {
461
+ annotationIds: props.selectedAnnotations.map((ta) => ta.object.id),
462
+ pageSize: { width: props.pageWidth, height: props.pageHeight }
463
+ });
464
+ } else if (isResize) {
465
+ isResizingRef.value = true;
466
+ plugin.startResize(props.documentId, {
467
+ annotationIds: props.selectedAnnotations.map((ta) => ta.object.id),
468
+ pageSize: { width: props.pageWidth, height: props.pageHeight },
469
+ resizeHandle: ((_b = event.transformData.metadata) == null ? void 0 : _b.handle) ?? "se"
470
+ });
471
+ }
472
+ }
473
+ const base = gestureBase.value ?? groupBox.value;
474
+ if (isMove && event.transformData.changes.rect) {
475
+ const newRect = event.transformData.changes.rect;
476
+ const rawDelta = {
477
+ x: newRect.origin.x - base.origin.x,
478
+ y: newRect.origin.y - base.origin.y
479
+ };
480
+ const clampedDelta = plugin.updateDrag(props.documentId, rawDelta);
481
+ previewGroupBox.value = {
482
+ ...base,
483
+ origin: {
484
+ x: base.origin.x + clampedDelta.x,
485
+ y: base.origin.y + clampedDelta.y
486
+ }
487
+ };
488
+ } else if (isResize && event.transformData.changes.rect) {
489
+ const newGroupBox = event.transformData.changes.rect;
490
+ plugin.updateResize(props.documentId, newGroupBox);
491
+ previewGroupBox.value = newGroupBox;
492
+ }
493
+ if (event.state === "end") {
494
+ gestureBase.value = null;
495
+ if (isMove && isDraggingRef.value) {
496
+ isDraggingRef.value = false;
497
+ plugin.commitDrag(props.documentId);
498
+ } else if (isResize && isResizingRef.value) {
499
+ isResizingRef.value = false;
500
+ plugin.commitResize(props.documentId);
501
+ }
502
+ }
503
+ }
504
+ },
505
+ resizeUI: {
506
+ handleSize: HANDLE_SIZE.value,
507
+ spacing: props.outlineOffset,
508
+ offsetMode: "outside",
509
+ includeSides: true,
510
+ zIndex: props.zIndex + 1
511
+ },
512
+ vertexUI: {
513
+ vertexSize: 0,
514
+ zIndex: props.zIndex
515
+ },
516
+ includeVertices: false
517
+ });
518
+ return (_ctx, _cache) => {
519
+ return __props.selectedAnnotations.length >= 2 ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
520
+ createElementVNode("div", mergeProps(__props.isDraggable ? unref(dragProps) : {}, {
521
+ style: boxStyle.value,
522
+ onPointerdown: _cache[0] || (_cache[0] = ($event) => !__props.isDraggable ? $event.stopPropagation() : void 0)
523
+ }), [
524
+ __props.isResizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
525
+ return openBlock(), createElementBlock(Fragment, { key }, [
526
+ unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
527
+ key: 0,
528
+ ref_for: true
529
+ }, { key, style, ...handle, backgroundColor: HANDLE_COLOR.value }), () => [
530
+ createElementVNode("div", mergeProps({ ref_for: true }, handle, {
531
+ style: [style, { backgroundColor: HANDLE_COLOR.value }]
532
+ }), null, 16)
533
+ ]) : (openBlock(), createElementBlock("div", mergeProps({
534
+ key: 1,
535
+ ref_for: true
536
+ }, handle, {
537
+ style: [style, { backgroundColor: HANDLE_COLOR.value }]
538
+ }), null, 16))
539
+ ], 64);
540
+ }), 128)) : createCommentVNode("", true)
541
+ ], 16),
542
+ shouldShowMenu.value ? (openBlock(), createBlock(unref(CounterRotate), {
543
+ key: 0,
544
+ rect: menuRect.value,
545
+ rotation: __props.rotation
546
+ }, {
547
+ default: withCtx(({ rect, menuWrapperProps }) => [
548
+ __props.groupSelectionMenu ? (openBlock(), createBlock(resolveDynamicComponent(renderGroupMenu(rect, menuWrapperProps)), { key: 0 })) : renderSlot(_ctx.$slots, "group-selection-menu", {
549
+ key: 1,
550
+ context: menuContext.value,
551
+ selected: true,
552
+ rect,
553
+ placement: menuPlacement.value,
554
+ menuWrapperProps
555
+ })
556
+ ]),
557
+ _: 3
558
+ }, 8, ["rect", "rotation"])) : createCommentVNode("", true)
559
+ ])) : createCommentVNode("", true);
560
+ };
561
+ }
562
+ });
563
+ const _hoisted_1$8 = ["width", "height", "viewBox"];
564
+ const _hoisted_2$6 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
565
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
286
566
  __name: "circle",
287
567
  props: {
288
568
  isSelected: { type: Boolean },
@@ -348,13 +628,13 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
348
628
  strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
349
629
  }
350
630
  })
351
- }, null, 44, _hoisted_2$5)
352
- ], 12, _hoisted_1$7);
631
+ }, null, 44, _hoisted_2$6)
632
+ ], 12, _hoisted_1$8);
353
633
  };
354
634
  }
355
635
  });
356
- const _hoisted_1$6 = ["contenteditable"];
357
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
636
+ const _hoisted_1$7 = ["contenteditable"];
637
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
358
638
  __name: "free-text",
359
639
  props: {
360
640
  isSelected: { type: Boolean },
@@ -416,7 +696,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
416
696
  flexDirection: "column",
417
697
  justifyContent: anno.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : anno.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
418
698
  display: "flex",
419
- backgroundColor: anno.backgroundColor,
699
+ backgroundColor: anno.color ?? anno.backgroundColor,
420
700
  opacity: anno.opacity,
421
701
  width: needsComp ? `${invScalePercent}%` : "100%",
422
702
  height: needsComp ? `${invScalePercent}%` : "100%",
@@ -450,18 +730,18 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
450
730
  tabindex: "0",
451
731
  style: normalizeStyle(editorStyle.value),
452
732
  contenteditable: __props.isEditing
453
- }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$6)
733
+ }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$7)
454
734
  ], 36);
455
735
  };
456
736
  }
457
737
  });
458
- const _hoisted_1$5 = ["width", "height", "viewBox"];
459
- const _hoisted_2$4 = ["d", "opacity"];
460
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
738
+ const _hoisted_1$6 = ["width", "height", "viewBox"];
739
+ const _hoisted_2$5 = ["d", "opacity"];
740
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
461
741
  __name: "ink",
462
742
  props: {
463
743
  isSelected: { type: Boolean },
464
- color: { default: "#000000" },
744
+ strokeColor: {},
465
745
  opacity: { default: 1 },
466
746
  strokeWidth: {},
467
747
  inkList: {},
@@ -471,6 +751,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
471
751
  },
472
752
  setup(__props) {
473
753
  const props = __props;
754
+ const resolvedColor = computed(() => props.strokeColor ?? "#000000");
474
755
  const paths = computed(() => {
475
756
  return props.inkList.map(({ points }) => {
476
757
  let d = "";
@@ -511,22 +792,22 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
511
792
  style: normalizeStyle({
512
793
  cursor: __props.isSelected ? "move" : "pointer",
513
794
  pointerEvents: __props.isSelected ? "none" : "visibleStroke",
514
- stroke: __props.color,
795
+ stroke: resolvedColor.value,
515
796
  strokeWidth: __props.strokeWidth,
516
797
  strokeLinecap: "round",
517
798
  strokeLinejoin: "round"
518
799
  })
519
- }, null, 44, _hoisted_2$4);
800
+ }, null, 44, _hoisted_2$5);
520
801
  }), 128))
521
- ], 12, _hoisted_1$5);
802
+ ], 12, _hoisted_1$6);
522
803
  };
523
804
  }
524
805
  });
525
- const _hoisted_1$4 = ["width", "height", "viewBox"];
526
- const _hoisted_2$3 = ["x1", "y1", "x2", "y2", "opacity"];
527
- const _hoisted_3$2 = ["d", "transform", "stroke", "fill"];
528
- const _hoisted_4$2 = ["d", "transform", "stroke", "fill"];
529
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
806
+ const _hoisted_1$5 = ["width", "height", "viewBox"];
807
+ const _hoisted_2$4 = ["x1", "y1", "x2", "y2", "opacity"];
808
+ const _hoisted_3$3 = ["d", "transform", "stroke", "fill"];
809
+ const _hoisted_4$3 = ["d", "transform", "stroke", "fill"];
810
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
530
811
  __name: "line",
531
812
  props: {
532
813
  color: { default: "transparent" },
@@ -614,7 +895,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
614
895
  strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
615
896
  }
616
897
  })
617
- }, null, 44, _hoisted_2$3),
898
+ }, null, 44, _hoisted_2$4),
618
899
  endings.value.start ? (openBlock(), createElementBlock("path", {
619
900
  key: 0,
620
901
  d: endings.value.start.d,
@@ -626,7 +907,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
626
907
  stroke: __props.strokeColor,
627
908
  style: normalizeStyle(getEndingStyle(endings.value.start)),
628
909
  fill: endings.value.start.filled ? __props.color : "none"
629
- }, null, 44, _hoisted_3$2)) : createCommentVNode("", true),
910
+ }, null, 44, _hoisted_3$3)) : createCommentVNode("", true),
630
911
  endings.value.end ? (openBlock(), createElementBlock("path", {
631
912
  key: 1,
632
913
  d: endings.value.end.d,
@@ -638,7 +919,96 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
638
919
  stroke: __props.strokeColor,
639
920
  style: normalizeStyle(getEndingStyle(endings.value.end)),
640
921
  fill: endings.value.end.filled ? __props.color : "none"
641
- }, null, 44, _hoisted_4$2)) : createCommentVNode("", true)
922
+ }, null, 44, _hoisted_4$3)) : createCommentVNode("", true)
923
+ ], 12, _hoisted_1$5);
924
+ };
925
+ }
926
+ });
927
+ const _hoisted_1$4 = ["width", "height", "viewBox"];
928
+ const _hoisted_2$3 = ["width", "height"];
929
+ const _hoisted_3$2 = ["y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"];
930
+ const _hoisted_4$2 = ["x", "y", "width", "height", "stroke", "stroke-width", "stroke-dasharray"];
931
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
932
+ __name: "link",
933
+ props: {
934
+ isSelected: { type: Boolean },
935
+ strokeColor: { default: "#0000FF" },
936
+ strokeWidth: { default: 2 },
937
+ strokeStyle: { default: PdfAnnotationBorderStyle.UNDERLINE },
938
+ strokeDashArray: {},
939
+ rect: {},
940
+ scale: {},
941
+ onClick: {},
942
+ hasIRT: { type: Boolean, default: false }
943
+ },
944
+ setup(__props) {
945
+ const props = __props;
946
+ const width = computed(() => props.rect.size.width);
947
+ const height = computed(() => props.rect.size.height);
948
+ const svgWidth = computed(() => width.value * props.scale);
949
+ const svgHeight = computed(() => height.value * props.scale);
950
+ const dashArray = computed(() => {
951
+ var _a;
952
+ if (props.strokeStyle === PdfAnnotationBorderStyle.DASHED) {
953
+ return ((_a = props.strokeDashArray) == null ? void 0 : _a.join(",")) ?? `${props.strokeWidth * 3},${props.strokeWidth}`;
954
+ }
955
+ return void 0;
956
+ });
957
+ const isUnderline2 = computed(() => props.strokeStyle === PdfAnnotationBorderStyle.UNDERLINE);
958
+ const hitAreaCursor = computed(
959
+ () => props.hasIRT ? "default" : props.isSelected ? "move" : "pointer"
960
+ );
961
+ const hitAreaPointerEvents = computed(
962
+ () => props.hasIRT ? "none" : props.isSelected ? "none" : "visible"
963
+ );
964
+ return (_ctx, _cache) => {
965
+ return openBlock(), createElementBlock("svg", {
966
+ style: normalizeStyle({
967
+ position: "absolute",
968
+ width: `${svgWidth.value}px`,
969
+ height: `${svgHeight.value}px`,
970
+ pointerEvents: "none",
971
+ zIndex: 2
972
+ }),
973
+ width: svgWidth.value,
974
+ height: svgHeight.value,
975
+ viewBox: `0 0 ${width.value} ${height.value}`
976
+ }, [
977
+ createElementVNode("rect", {
978
+ x: 0,
979
+ y: 0,
980
+ width: width.value,
981
+ height: height.value,
982
+ fill: "transparent",
983
+ onPointerdown: _cache[0] || (_cache[0] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
984
+ onTouchstart: _cache[1] || (_cache[1] = ($event) => __props.hasIRT ? void 0 : __props.onClick),
985
+ style: normalizeStyle({
986
+ cursor: hitAreaCursor.value,
987
+ pointerEvents: hitAreaPointerEvents.value
988
+ })
989
+ }, null, 44, _hoisted_2$3),
990
+ isUnderline2.value ? (openBlock(), createElementBlock("line", {
991
+ key: 0,
992
+ x1: 1,
993
+ y1: height.value - 1,
994
+ x2: width.value - 1,
995
+ y2: height.value - 1,
996
+ stroke: __props.strokeColor,
997
+ "stroke-width": __props.strokeWidth,
998
+ "stroke-dasharray": dashArray.value,
999
+ style: { "pointer-events": "none" }
1000
+ }, null, 8, _hoisted_3$2)) : (openBlock(), createElementBlock("rect", {
1001
+ key: 1,
1002
+ x: __props.strokeWidth / 2,
1003
+ y: __props.strokeWidth / 2,
1004
+ width: Math.max(width.value - __props.strokeWidth, 0),
1005
+ height: Math.max(height.value - __props.strokeWidth, 0),
1006
+ fill: "transparent",
1007
+ stroke: __props.strokeColor,
1008
+ "stroke-width": __props.strokeWidth,
1009
+ "stroke-dasharray": dashArray.value,
1010
+ style: { "pointer-events": "none" }
1011
+ }, null, 8, _hoisted_4$2))
642
1012
  ], 12, _hoisted_1$4);
643
1013
  };
644
1014
  }
@@ -1076,7 +1446,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1076
1446
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1077
1447
  __name: "highlight",
1078
1448
  props: {
1079
- color: { default: "#FFFF00" },
1449
+ strokeColor: {},
1080
1450
  opacity: { default: 0.5 },
1081
1451
  segmentRects: {},
1082
1452
  rect: {},
@@ -1084,6 +1454,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1084
1454
  onClick: {}
1085
1455
  },
1086
1456
  setup(__props) {
1457
+ const props = __props;
1458
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1087
1459
  return (_ctx, _cache) => {
1088
1460
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (b, i) => {
1089
1461
  return openBlock(), createElementBlock("div", {
@@ -1098,7 +1470,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1098
1470
  top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
1099
1471
  width: `${b.size.width * __props.scale}px`,
1100
1472
  height: `${b.size.height * __props.scale}px`,
1101
- background: __props.color,
1473
+ background: resolvedColor.value,
1102
1474
  opacity: __props.opacity,
1103
1475
  pointerEvents: __props.onClick ? "auto" : "none",
1104
1476
  cursor: __props.onClick ? "pointer" : "default",
@@ -1112,7 +1484,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1112
1484
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1113
1485
  __name: "squiggly",
1114
1486
  props: {
1115
- color: { default: "#FFFF00" },
1487
+ strokeColor: {},
1116
1488
  opacity: { default: 0.5 },
1117
1489
  segmentRects: {},
1118
1490
  rect: {},
@@ -1121,6 +1493,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1121
1493
  },
1122
1494
  setup(__props) {
1123
1495
  const props = __props;
1496
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1124
1497
  const amplitude = computed(() => 2 * props.scale);
1125
1498
  const period = computed(() => 6 * props.scale);
1126
1499
  const svgDataUri = computed(() => {
@@ -1128,7 +1501,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1128
1501
  const per = period.value;
1129
1502
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${per}" height="${amp * 2}" viewBox="0 0 ${per} ${amp * 2}">
1130
1503
  <path d="M0 ${amp} Q ${per / 4} 0 ${per / 2} ${amp} T ${per} ${amp}"
1131
- fill="none" stroke="${props.color}" stroke-width="${amp}" stroke-linecap="round"/>
1504
+ fill="none" stroke="${resolvedColor.value}" stroke-width="${amp}" stroke-linecap="round"/>
1132
1505
  </svg>`;
1133
1506
  return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
1134
1507
  });
@@ -1174,7 +1547,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1174
1547
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1175
1548
  __name: "strikeout",
1176
1549
  props: {
1177
- color: { default: "#FFFF00" },
1550
+ strokeColor: {},
1178
1551
  opacity: { default: 0.5 },
1179
1552
  segmentRects: {},
1180
1553
  rect: {},
@@ -1183,6 +1556,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1183
1556
  },
1184
1557
  setup(__props) {
1185
1558
  const props = __props;
1559
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1186
1560
  const thickness = computed(() => 2 * props.scale);
1187
1561
  return (_ctx, _cache) => {
1188
1562
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
@@ -1211,7 +1585,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1211
1585
  top: "50%",
1212
1586
  width: "100%",
1213
1587
  height: `${thickness.value}px`,
1214
- background: __props.color,
1588
+ background: resolvedColor.value,
1215
1589
  opacity: __props.opacity,
1216
1590
  transform: "translateY(-50%)",
1217
1591
  pointerEvents: "none"
@@ -1225,7 +1599,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1225
1599
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1226
1600
  __name: "underline",
1227
1601
  props: {
1228
- color: { default: "#FFFF00" },
1602
+ strokeColor: {},
1229
1603
  opacity: { default: 0.5 },
1230
1604
  segmentRects: {},
1231
1605
  rect: {},
@@ -1234,6 +1608,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1234
1608
  },
1235
1609
  setup(__props) {
1236
1610
  const props = __props;
1611
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1237
1612
  const thickness = computed(() => 2 * props.scale);
1238
1613
  return (_ctx, _cache) => {
1239
1614
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
@@ -1262,7 +1637,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1262
1637
  bottom: 0,
1263
1638
  width: "100%",
1264
1639
  height: `${thickness.value}px`,
1265
- background: __props.color,
1640
+ background: resolvedColor.value,
1266
1641
  opacity: __props.opacity,
1267
1642
  pointerEvents: "none"
1268
1643
  })
@@ -1284,30 +1659,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1284
1659
  resizeUI: {},
1285
1660
  vertexUI: {},
1286
1661
  selectionOutlineColor: {},
1287
- selectionMenu: { type: Function }
1662
+ selectionMenu: { type: Function },
1663
+ groupSelectionMenu: { type: Function }
1288
1664
  },
1289
1665
  setup(__props) {
1290
1666
  const props = __props;
1291
1667
  const { provides: annotationCapability } = useAnnotationCapability();
1292
1668
  const { provides: selectionProvides } = useSelectionCapability();
1293
1669
  const annotations = ref([]);
1670
+ const allSelectedIds = ref([]);
1294
1671
  const { register } = usePointerHandlers({
1295
1672
  documentId: () => props.documentId,
1296
1673
  pageIndex: props.pageIndex
1297
1674
  });
1298
- const selectionState = ref(null);
1299
1675
  const editingId = ref(null);
1300
1676
  const annotationProvides = computed(
1301
1677
  () => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
1302
1678
  );
1679
+ const isMultiSelected = computed(() => allSelectedIds.value.length > 1);
1303
1680
  watchEffect((onCleanup) => {
1304
1681
  if (annotationProvides.value) {
1305
1682
  const currentState = annotationProvides.value.getState();
1306
1683
  annotations.value = getAnnotationsByPageIndex(currentState, props.pageIndex);
1307
- selectionState.value = getSelectedAnnotationByPageIndex(currentState, props.pageIndex);
1684
+ allSelectedIds.value = getSelectedAnnotationIds(currentState);
1308
1685
  const off = annotationProvides.value.onStateChange((state) => {
1309
1686
  annotations.value = getAnnotationsByPageIndex(state, props.pageIndex);
1310
- selectionState.value = getSelectedAnnotationByPageIndex(state, props.pageIndex);
1687
+ allSelectedIds.value = getSelectedAnnotationIds(state);
1311
1688
  });
1312
1689
  onCleanup(off);
1313
1690
  }
@@ -1321,13 +1698,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1321
1698
  const handleClick = (e, annotation) => {
1322
1699
  e.stopPropagation();
1323
1700
  if (annotationProvides.value && selectionProvides.value) {
1324
- annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
1325
1701
  selectionProvides.value.clear();
1702
+ const isModifierPressed = "metaKey" in e ? e.metaKey || e.ctrlKey : false;
1703
+ if (isModifierPressed) {
1704
+ annotationProvides.value.toggleSelection(props.pageIndex, annotation.object.id);
1705
+ } else {
1706
+ annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
1707
+ }
1326
1708
  if (annotation.object.id !== editingId.value) {
1327
1709
  editingId.value = null;
1328
1710
  }
1329
1711
  }
1330
1712
  };
1713
+ const handleLinkClick = (e, annotation) => {
1714
+ e.stopPropagation();
1715
+ if (!annotationProvides.value || !selectionProvides.value) return;
1716
+ selectionProvides.value.clear();
1717
+ if (annotation.object.inReplyToId) {
1718
+ const parentId = annotation.object.inReplyToId;
1719
+ const parent = annotations.value.find((a) => a.object.id === parentId);
1720
+ if (parent) {
1721
+ annotationProvides.value.selectAnnotation(parent.object.pageIndex, parentId);
1722
+ return;
1723
+ }
1724
+ }
1725
+ annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
1726
+ };
1331
1727
  const handleDoubleClick = (_e, id) => {
1332
1728
  if (isFreeText(annotations.value.find((a) => a.object.id === id))) {
1333
1729
  editingId.value = id;
@@ -1341,6 +1737,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1341
1737
  }
1342
1738
  }
1343
1739
  });
1740
+ const isSelected = (annotation) => allSelectedIds.value.includes(annotation.object.id);
1741
+ const selectedAnnotationsOnPage = computed(
1742
+ () => annotations.value.filter((anno) => allSelectedIds.value.includes(anno.object.id))
1743
+ );
1744
+ const areAllSelectedDraggable = computed(() => {
1745
+ if (selectedAnnotationsOnPage.value.length < 2) return false;
1746
+ return selectedAnnotationsOnPage.value.every((ta) => {
1747
+ var _a;
1748
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1749
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) ?? (tool == null ? void 0 : tool.interaction.isDraggable) ?? true;
1750
+ });
1751
+ });
1752
+ const areAllSelectedResizable = computed(() => {
1753
+ if (selectedAnnotationsOnPage.value.length < 2) return false;
1754
+ return selectedAnnotationsOnPage.value.every((ta) => {
1755
+ var _a;
1756
+ const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1757
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) ?? (tool == null ? void 0 : tool.interaction.isResizable) ?? true;
1758
+ });
1759
+ });
1760
+ const allSelectedOnSamePage = computed(() => {
1761
+ if (!annotationProvides.value) return false;
1762
+ if (allSelectedIds.value.length < 2) return false;
1763
+ const allSelected = annotationProvides.value.getSelectedAnnotations();
1764
+ return allSelected.every((ta) => ta.object.pageIndex === props.pageIndex);
1765
+ });
1344
1766
  const getTool = (annotation) => {
1345
1767
  var _a;
1346
1768
  return (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
@@ -1348,16 +1770,23 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1348
1770
  const isDraggable = (anno) => {
1349
1771
  var _a;
1350
1772
  if (isFreeText(anno) && editingId.value === anno.object.id) return false;
1773
+ if (isMultiSelected.value) return false;
1351
1774
  return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1352
1775
  };
1353
1776
  const isResizable = (anno) => {
1354
1777
  var _a;
1778
+ if (isMultiSelected.value) return false;
1355
1779
  return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isResizable) ?? false;
1356
1780
  };
1357
1781
  const lockAspectRatio = (anno) => {
1358
1782
  var _a;
1359
1783
  return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1360
1784
  };
1785
+ const showIndividualSelection = (anno) => isSelected(anno) && !isMultiSelected.value;
1786
+ const containerProps = computed(() => {
1787
+ const { selectionMenu: _sm, groupSelectionMenu: _gsm, ...rest } = props;
1788
+ return rest;
1789
+ });
1361
1790
  const getVertexConfig = (annotation) => {
1362
1791
  if (isLine(annotation)) {
1363
1792
  return {
@@ -1377,359 +1806,463 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1377
1806
  return void 0;
1378
1807
  };
1379
1808
  return (_ctx, _cache) => {
1380
- return openBlock(true), createElementBlock(Fragment, null, renderList(annotations.value, (annotation) => {
1381
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1382
- return openBlock(), createElementBlock(Fragment, {
1383
- key: annotation.object.id
1384
- }, [
1385
- unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1386
- key: 0,
1387
- trackedAnnotation: annotation,
1388
- isSelected: ((_a = selectionState.value) == null ? void 0 : _a.object.id) === annotation.object.id,
1389
- isDraggable: isDraggable(annotation),
1390
- isResizable: isResizable(annotation),
1391
- lockAspectRatio: lockAspectRatio(annotation),
1392
- onSelect: (e) => handleClick(e, annotation),
1393
- vertexConfig: getVertexConfig(annotation),
1394
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1395
- }, { ref_for: true }, props), {
1396
- default: withCtx(({ annotation: currentObject }) => {
1397
- var _a2;
1398
- return [
1399
- createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
1400
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1809
+ return openBlock(), createElementBlock(Fragment, null, [
1810
+ (openBlock(true), createElementBlock(Fragment, null, renderList(annotations.value, (annotation) => {
1811
+ return openBlock(), createElementBlock(Fragment, {
1812
+ key: annotation.object.id
1813
+ }, [
1814
+ unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1815
+ key: 0,
1816
+ trackedAnnotation: annotation,
1817
+ isSelected: showIndividualSelection(annotation),
1818
+ isDraggable: isDraggable(annotation),
1819
+ isResizable: isResizable(annotation),
1820
+ lockAspectRatio: lockAspectRatio(annotation),
1821
+ onSelect: (e) => handleClick(e, annotation),
1822
+ vertexConfig: getVertexConfig(annotation),
1823
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1824
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1825
+ }, { ref_for: true }, containerProps.value), createSlots({
1826
+ default: withCtx(({ annotation: currentObject }) => [
1827
+ createVNode(_sfc_main$g, mergeProps({ ref_for: true }, currentObject, {
1828
+ isSelected: isSelected(annotation),
1401
1829
  scale: __props.scale,
1402
1830
  onClick: (e) => handleClick(e, annotation)
1403
1831
  }), null, 16, ["isSelected", "scale", "onClick"])
1404
- ];
1405
- }),
1406
- "selection-menu": withCtx((slotProps) => [
1407
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1408
- ]),
1409
- "resize-handle": withCtx((slotProps) => [
1410
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1411
- ]),
1412
- "vertex-handle": withCtx((slotProps) => [
1413
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1414
- ]),
1415
- _: 2
1416
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1417
- key: 1,
1418
- trackedAnnotation: annotation,
1419
- isSelected: ((_b = selectionState.value) == null ? void 0 : _b.object.id) === annotation.object.id,
1420
- isDraggable: isDraggable(annotation),
1421
- isResizable: isResizable(annotation),
1422
- lockAspectRatio: lockAspectRatio(annotation),
1423
- onSelect: (e) => handleClick(e, annotation),
1424
- vertexConfig: getVertexConfig(annotation),
1425
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1426
- }, { ref_for: true }, props), {
1427
- default: withCtx(({ annotation: currentObject }) => {
1428
- var _a2;
1429
- return [
1832
+ ]),
1833
+ "resize-handle": withCtx((slotProps) => [
1834
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1835
+ ]),
1836
+ "vertex-handle": withCtx((slotProps) => [
1837
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1838
+ ]),
1839
+ _: 2
1840
+ }, [
1841
+ !isMultiSelected.value ? {
1842
+ name: "selection-menu",
1843
+ fn: withCtx((slotProps) => [
1844
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1845
+ ]),
1846
+ key: "0"
1847
+ } : void 0
1848
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1849
+ key: 1,
1850
+ trackedAnnotation: annotation,
1851
+ isSelected: showIndividualSelection(annotation),
1852
+ isDraggable: isDraggable(annotation),
1853
+ isResizable: isResizable(annotation),
1854
+ lockAspectRatio: lockAspectRatio(annotation),
1855
+ onSelect: (e) => handleClick(e, annotation),
1856
+ vertexConfig: getVertexConfig(annotation),
1857
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1858
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1859
+ }, { ref_for: true }, containerProps.value), createSlots({
1860
+ default: withCtx(({ annotation: currentObject }) => [
1430
1861
  createVNode(_sfc_main$b, mergeProps({ ref_for: true }, currentObject, {
1431
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1862
+ isSelected: isSelected(annotation),
1432
1863
  scale: __props.scale,
1433
1864
  onClick: (e) => handleClick(e, annotation)
1434
1865
  }), null, 16, ["isSelected", "scale", "onClick"])
1435
- ];
1436
- }),
1437
- "selection-menu": withCtx((slotProps) => [
1438
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1439
- ]),
1440
- "resize-handle": withCtx((slotProps) => [
1441
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1442
- ]),
1443
- "vertex-handle": withCtx((slotProps) => [
1444
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1445
- ]),
1446
- _: 2
1447
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1448
- key: 2,
1449
- trackedAnnotation: annotation,
1450
- isSelected: ((_c = selectionState.value) == null ? void 0 : _c.object.id) === annotation.object.id,
1451
- isDraggable: isDraggable(annotation),
1452
- isResizable: isResizable(annotation),
1453
- lockAspectRatio: lockAspectRatio(annotation),
1454
- onSelect: (e) => handleClick(e, annotation),
1455
- vertexConfig: getVertexConfig(annotation),
1456
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1457
- }, { ref_for: true }, props), {
1458
- default: withCtx(({ annotation: currentObject }) => {
1459
- var _a2;
1460
- return [
1461
- createVNode(_sfc_main$h, mergeProps({ ref_for: true }, currentObject, {
1462
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1866
+ ]),
1867
+ "resize-handle": withCtx((slotProps) => [
1868
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1869
+ ]),
1870
+ "vertex-handle": withCtx((slotProps) => [
1871
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1872
+ ]),
1873
+ _: 2
1874
+ }, [
1875
+ !isMultiSelected.value ? {
1876
+ name: "selection-menu",
1877
+ fn: withCtx((slotProps) => [
1878
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1879
+ ]),
1880
+ key: "0"
1881
+ } : void 0
1882
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1883
+ key: 2,
1884
+ trackedAnnotation: annotation,
1885
+ isSelected: showIndividualSelection(annotation),
1886
+ isDraggable: isDraggable(annotation),
1887
+ isResizable: isResizable(annotation),
1888
+ lockAspectRatio: lockAspectRatio(annotation),
1889
+ onSelect: (e) => handleClick(e, annotation),
1890
+ vertexConfig: getVertexConfig(annotation),
1891
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1892
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1893
+ }, { ref_for: true }, containerProps.value), createSlots({
1894
+ default: withCtx(({ annotation: currentObject }) => [
1895
+ createVNode(_sfc_main$i, mergeProps({ ref_for: true }, currentObject, {
1896
+ isSelected: isSelected(annotation),
1463
1897
  scale: __props.scale,
1464
1898
  onClick: (e) => handleClick(e, annotation)
1465
1899
  }), null, 16, ["isSelected", "scale", "onClick"])
1466
- ];
1467
- }),
1468
- "selection-menu": withCtx((slotProps) => [
1469
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1470
- ]),
1471
- "resize-handle": withCtx((slotProps) => [
1472
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1473
- ]),
1474
- "vertex-handle": withCtx((slotProps) => [
1475
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1476
- ]),
1477
- _: 2
1478
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1479
- key: 3,
1480
- trackedAnnotation: annotation,
1481
- isSelected: ((_d = selectionState.value) == null ? void 0 : _d.object.id) === annotation.object.id,
1482
- isDraggable: isDraggable(annotation),
1483
- isResizable: isResizable(annotation),
1484
- lockAspectRatio: lockAspectRatio(annotation),
1485
- onSelect: (e) => handleClick(e, annotation),
1486
- vertexConfig: getVertexConfig(annotation),
1487
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1488
- }, { ref_for: true }, props), {
1489
- default: withCtx(({ annotation: currentObject }) => {
1490
- var _a2;
1491
- return [
1492
- createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
1493
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1900
+ ]),
1901
+ "resize-handle": withCtx((slotProps) => [
1902
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1903
+ ]),
1904
+ "vertex-handle": withCtx((slotProps) => [
1905
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1906
+ ]),
1907
+ _: 2
1908
+ }, [
1909
+ !isMultiSelected.value ? {
1910
+ name: "selection-menu",
1911
+ fn: withCtx((slotProps) => [
1912
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1913
+ ]),
1914
+ key: "0"
1915
+ } : void 0
1916
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1917
+ key: 3,
1918
+ trackedAnnotation: annotation,
1919
+ isSelected: showIndividualSelection(annotation),
1920
+ isDraggable: isDraggable(annotation),
1921
+ isResizable: isResizable(annotation),
1922
+ lockAspectRatio: lockAspectRatio(annotation),
1923
+ onSelect: (e) => handleClick(e, annotation),
1924
+ vertexConfig: getVertexConfig(annotation),
1925
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1926
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1927
+ }, { ref_for: true }, containerProps.value), createSlots({
1928
+ default: withCtx(({ annotation: currentObject }) => [
1929
+ createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
1930
+ isSelected: isSelected(annotation),
1494
1931
  scale: __props.scale,
1495
1932
  onClick: (e) => handleClick(e, annotation)
1496
1933
  }), null, 16, ["isSelected", "scale", "onClick"])
1497
- ];
1498
- }),
1499
- "selection-menu": withCtx((slotProps) => [
1500
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1501
- ]),
1502
- "resize-handle": withCtx((slotProps) => [
1503
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1504
- ]),
1505
- "vertex-handle": withCtx((slotProps) => [
1506
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1507
- ]),
1508
- _: 2
1509
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1510
- key: 4,
1511
- trackedAnnotation: annotation,
1512
- isSelected: ((_e = selectionState.value) == null ? void 0 : _e.object.id) === annotation.object.id,
1513
- isDraggable: isDraggable(annotation),
1514
- isResizable: isResizable(annotation),
1515
- lockAspectRatio: lockAspectRatio(annotation),
1516
- onSelect: (e) => handleClick(e, annotation),
1517
- vertexConfig: getVertexConfig(annotation),
1518
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1519
- }, { ref_for: true }, props), {
1520
- default: withCtx(({ annotation: currentObject }) => {
1521
- var _a2;
1522
- return [
1934
+ ]),
1935
+ "resize-handle": withCtx((slotProps) => [
1936
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1937
+ ]),
1938
+ "vertex-handle": withCtx((slotProps) => [
1939
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1940
+ ]),
1941
+ _: 2
1942
+ }, [
1943
+ !isMultiSelected.value ? {
1944
+ name: "selection-menu",
1945
+ fn: withCtx((slotProps) => [
1946
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1947
+ ]),
1948
+ key: "0"
1949
+ } : void 0
1950
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1951
+ key: 4,
1952
+ trackedAnnotation: annotation,
1953
+ isSelected: showIndividualSelection(annotation),
1954
+ isDraggable: isDraggable(annotation),
1955
+ isResizable: isResizable(annotation),
1956
+ lockAspectRatio: lockAspectRatio(annotation),
1957
+ onSelect: (e) => handleClick(e, annotation),
1958
+ vertexConfig: getVertexConfig(annotation),
1959
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1960
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1961
+ }, { ref_for: true }, containerProps.value), createSlots({
1962
+ default: withCtx(({ annotation: currentObject }) => [
1523
1963
  createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
1524
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1964
+ isSelected: isSelected(annotation),
1525
1965
  scale: __props.scale,
1526
1966
  onClick: (e) => handleClick(e, annotation)
1527
1967
  }), null, 16, ["isSelected", "scale", "onClick"])
1528
- ];
1529
- }),
1530
- "selection-menu": withCtx((slotProps) => [
1531
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1532
- ]),
1533
- "resize-handle": withCtx((slotProps) => [
1534
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1535
- ]),
1536
- "vertex-handle": withCtx((slotProps) => [
1537
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1538
- ]),
1539
- _: 2
1540
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1541
- key: 5,
1542
- trackedAnnotation: annotation,
1543
- isSelected: ((_f = selectionState.value) == null ? void 0 : _f.object.id) === annotation.object.id,
1544
- isDraggable: isDraggable(annotation),
1545
- isResizable: isResizable(annotation),
1546
- lockAspectRatio: lockAspectRatio(annotation),
1547
- onSelect: (e) => handleClick(e, annotation),
1548
- vertexConfig: getVertexConfig(annotation),
1549
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1550
- }, { ref_for: true }, props), {
1551
- default: withCtx(({ annotation: currentObject }) => {
1552
- var _a2;
1553
- return [
1968
+ ]),
1969
+ "resize-handle": withCtx((slotProps) => [
1970
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1971
+ ]),
1972
+ "vertex-handle": withCtx((slotProps) => [
1973
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1974
+ ]),
1975
+ _: 2
1976
+ }, [
1977
+ !isMultiSelected.value ? {
1978
+ name: "selection-menu",
1979
+ fn: withCtx((slotProps) => [
1980
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1981
+ ]),
1982
+ key: "0"
1983
+ } : void 0
1984
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1985
+ key: 5,
1986
+ trackedAnnotation: annotation,
1987
+ isSelected: showIndividualSelection(annotation),
1988
+ isDraggable: isDraggable(annotation),
1989
+ isResizable: isResizable(annotation),
1990
+ lockAspectRatio: lockAspectRatio(annotation),
1991
+ onSelect: (e) => handleClick(e, annotation),
1992
+ vertexConfig: getVertexConfig(annotation),
1993
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1994
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1995
+ }, { ref_for: true }, containerProps.value), createSlots({
1996
+ default: withCtx(({ annotation: currentObject }) => [
1554
1997
  createVNode(_sfc_main$d, mergeProps({ ref_for: true }, currentObject, {
1555
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1998
+ isSelected: isSelected(annotation),
1556
1999
  scale: __props.scale,
1557
2000
  onClick: (e) => handleClick(e, annotation)
1558
2001
  }), null, 16, ["isSelected", "scale", "onClick"])
1559
- ];
1560
- }),
1561
- "selection-menu": withCtx((slotProps) => [
1562
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1563
- ]),
1564
- "resize-handle": withCtx((slotProps) => [
1565
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1566
- ]),
1567
- "vertex-handle": withCtx((slotProps) => [
1568
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1569
- ]),
1570
- _: 2
1571
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1572
- key: 6,
1573
- trackedAnnotation: annotation,
1574
- isSelected: ((_g = selectionState.value) == null ? void 0 : _g.object.id) === annotation.object.id,
1575
- isDraggable: isDraggable(annotation),
1576
- isResizable: isResizable(annotation),
1577
- lockAspectRatio: lockAspectRatio(annotation),
1578
- onSelect: (e) => handleClick(e, annotation),
1579
- onDoubleClick: (e) => handleDoubleClick(e, annotation.object.id),
1580
- vertexConfig: getVertexConfig(annotation),
1581
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1582
- }, { ref_for: true }, props), {
1583
- default: withCtx(({ annotation: currentObject }) => {
1584
- var _a2;
1585
- return [
1586
- createVNode(_sfc_main$g, {
1587
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
2002
+ ]),
2003
+ "resize-handle": withCtx((slotProps) => [
2004
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2005
+ ]),
2006
+ "vertex-handle": withCtx((slotProps) => [
2007
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2008
+ ]),
2009
+ _: 2
2010
+ }, [
2011
+ !isMultiSelected.value ? {
2012
+ name: "selection-menu",
2013
+ fn: withCtx((slotProps) => [
2014
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2015
+ ]),
2016
+ key: "0"
2017
+ } : void 0
2018
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2019
+ key: 6,
2020
+ trackedAnnotation: annotation,
2021
+ isSelected: showIndividualSelection(annotation),
2022
+ isDraggable: isDraggable(annotation),
2023
+ isResizable: isResizable(annotation),
2024
+ lockAspectRatio: lockAspectRatio(annotation),
2025
+ onSelect: (e) => handleClick(e, annotation),
2026
+ onDoubleClick: (e) => handleDoubleClick(e, annotation.object.id),
2027
+ vertexConfig: getVertexConfig(annotation),
2028
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2029
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2030
+ }, { ref_for: true }, containerProps.value), createSlots({
2031
+ default: withCtx(({ annotation: currentObject }) => [
2032
+ createVNode(_sfc_main$h, {
2033
+ isSelected: isSelected(annotation),
1588
2034
  isEditing: editingId.value === annotation.object.id,
1589
2035
  annotation: { ...annotation, object: currentObject },
1590
2036
  pageIndex: __props.pageIndex,
1591
2037
  scale: __props.scale,
1592
2038
  onClick: (e) => handleClick(e, annotation)
1593
2039
  }, null, 8, ["isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick"])
1594
- ];
1595
- }),
1596
- "selection-menu": withCtx((slotProps) => [
1597
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1598
- ]),
1599
- "resize-handle": withCtx((slotProps) => [
1600
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1601
- ]),
1602
- "vertex-handle": withCtx((slotProps) => [
1603
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1604
- ]),
1605
- _: 2
1606
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1607
- key: 7,
1608
- trackedAnnotation: annotation,
1609
- isSelected: ((_h = selectionState.value) == null ? void 0 : _h.object.id) === annotation.object.id,
1610
- isDraggable: isDraggable(annotation),
1611
- isResizable: isResizable(annotation),
1612
- lockAspectRatio: lockAspectRatio(annotation),
1613
- onSelect: (e) => handleClick(e, annotation),
1614
- vertexConfig: getVertexConfig(annotation),
1615
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1616
- }, { ref_for: true }, props), {
1617
- default: withCtx(() => {
1618
- var _a2;
1619
- return [
2040
+ ]),
2041
+ "resize-handle": withCtx((slotProps) => [
2042
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2043
+ ]),
2044
+ "vertex-handle": withCtx((slotProps) => [
2045
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2046
+ ]),
2047
+ _: 2
2048
+ }, [
2049
+ !isMultiSelected.value ? {
2050
+ name: "selection-menu",
2051
+ fn: withCtx((slotProps) => [
2052
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2053
+ ]),
2054
+ key: "0"
2055
+ } : void 0
2056
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "selectionMenu", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2057
+ key: 7,
2058
+ trackedAnnotation: annotation,
2059
+ isSelected: showIndividualSelection(annotation),
2060
+ isDraggable: isDraggable(annotation),
2061
+ isResizable: isResizable(annotation),
2062
+ lockAspectRatio: lockAspectRatio(annotation),
2063
+ onSelect: (e) => handleClick(e, annotation),
2064
+ vertexConfig: getVertexConfig(annotation),
2065
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2066
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2067
+ }, { ref_for: true }, containerProps.value), createSlots({
2068
+ default: withCtx(() => [
1620
2069
  createVNode(_sfc_main$9, {
1621
2070
  documentId: __props.documentId,
1622
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
2071
+ isSelected: isSelected(annotation),
1623
2072
  annotation,
1624
2073
  pageIndex: __props.pageIndex,
1625
2074
  scale: __props.scale,
1626
2075
  onClick: (e) => handleClick(e, annotation)
1627
2076
  }, null, 8, ["documentId", "isSelected", "annotation", "pageIndex", "scale", "onClick"])
1628
- ];
1629
- }),
1630
- "selection-menu": withCtx((slotProps) => [
1631
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1632
- ]),
1633
- "resize-handle": withCtx((slotProps) => [
1634
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1635
- ]),
1636
- "vertex-handle": withCtx((slotProps) => [
1637
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1638
- ]),
1639
- _: 2
1640
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1641
- key: 8,
1642
- trackedAnnotation: annotation,
1643
- isSelected: ((_i = selectionState.value) == null ? void 0 : _i.object.id) === annotation.object.id,
1644
- isDraggable: isDraggable(annotation),
1645
- isResizable: isResizable(annotation),
1646
- lockAspectRatio: lockAspectRatio(annotation),
1647
- onSelect: (e) => handleClick(e, annotation),
1648
- vertexConfig: getVertexConfig(annotation),
1649
- zIndex: 0,
1650
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1651
- }, { ref_for: true }, props), {
1652
- default: withCtx(({ annotation: currentObject }) => [
1653
- createVNode(_sfc_main$5, mergeProps({ ref_for: true }, currentObject, {
1654
- scale: __props.scale,
1655
- onClick: (e) => handleClick(e, annotation)
1656
- }), null, 16, ["scale", "onClick"])
1657
- ]),
1658
- "selection-menu": withCtx((slotProps) => [
1659
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1660
- ]),
1661
- _: 2
1662
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1663
- key: 9,
1664
- trackedAnnotation: annotation,
1665
- isSelected: ((_j = selectionState.value) == null ? void 0 : _j.object.id) === annotation.object.id,
1666
- isDraggable: isDraggable(annotation),
1667
- isResizable: isResizable(annotation),
1668
- lockAspectRatio: lockAspectRatio(annotation),
1669
- onSelect: (e) => handleClick(e, annotation),
1670
- vertexConfig: getVertexConfig(annotation),
1671
- zIndex: 0,
1672
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1673
- }, { ref_for: true }, props), {
1674
- default: withCtx(({ annotation: currentObject }) => [
1675
- createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
1676
- scale: __props.scale,
1677
- onClick: (e) => handleClick(e, annotation)
1678
- }), null, 16, ["scale", "onClick"])
1679
- ]),
1680
- "selection-menu": withCtx((slotProps) => [
1681
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1682
- ]),
1683
- _: 2
1684
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1685
- key: 10,
1686
- trackedAnnotation: annotation,
1687
- isSelected: ((_k = selectionState.value) == null ? void 0 : _k.object.id) === annotation.object.id,
1688
- isDraggable: isDraggable(annotation),
1689
- isResizable: isResizable(annotation),
1690
- lockAspectRatio: lockAspectRatio(annotation),
1691
- onSelect: (e) => handleClick(e, annotation),
1692
- vertexConfig: getVertexConfig(annotation),
1693
- zIndex: 0,
1694
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1695
- }, { ref_for: true }, props), {
1696
- default: withCtx(({ annotation: currentObject }) => [
1697
- createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
1698
- scale: __props.scale,
1699
- onClick: (e) => handleClick(e, annotation)
1700
- }), null, 16, ["scale", "onClick"])
1701
- ]),
1702
- "selection-menu": withCtx((slotProps) => [
1703
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1704
- ]),
1705
- _: 2
1706
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1707
- key: 11,
1708
- trackedAnnotation: annotation,
1709
- isSelected: ((_l = selectionState.value) == null ? void 0 : _l.object.id) === annotation.object.id,
1710
- isDraggable: isDraggable(annotation),
1711
- isResizable: isResizable(annotation),
1712
- lockAspectRatio: lockAspectRatio(annotation),
1713
- onSelect: (e) => handleClick(e, annotation),
1714
- vertexConfig: getVertexConfig(annotation),
1715
- zIndex: 0,
1716
- style: {
1717
- mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Multiply)
1718
- }
1719
- }, { ref_for: true }, props), {
1720
- default: withCtx(({ annotation: currentObject }) => [
1721
- createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
1722
- scale: __props.scale,
1723
- onClick: (e) => handleClick(e, annotation)
1724
- }), null, 16, ["scale", "onClick"])
1725
- ]),
1726
- "selection-menu": withCtx((slotProps) => [
1727
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1728
- ]),
1729
- _: 2
1730
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : createCommentVNode("", true)
1731
- ], 64);
1732
- }), 128);
2077
+ ]),
2078
+ "resize-handle": withCtx((slotProps) => [
2079
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2080
+ ]),
2081
+ "vertex-handle": withCtx((slotProps) => [
2082
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2083
+ ]),
2084
+ _: 2
2085
+ }, [
2086
+ !isMultiSelected.value ? {
2087
+ name: "selection-menu",
2088
+ fn: withCtx((slotProps) => [
2089
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2090
+ ]),
2091
+ key: "0"
2092
+ } : void 0
2093
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2094
+ key: 8,
2095
+ trackedAnnotation: annotation,
2096
+ isSelected: showIndividualSelection(annotation),
2097
+ isDraggable: isDraggable(annotation),
2098
+ isResizable: isResizable(annotation),
2099
+ lockAspectRatio: lockAspectRatio(annotation),
2100
+ onSelect: (e) => handleClick(e, annotation),
2101
+ vertexConfig: getVertexConfig(annotation),
2102
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2103
+ zIndex: 0,
2104
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2105
+ }, { ref_for: true }, containerProps.value), createSlots({
2106
+ default: withCtx(({ annotation: currentObject }) => [
2107
+ createVNode(_sfc_main$5, mergeProps({ ref_for: true }, currentObject, {
2108
+ scale: __props.scale,
2109
+ onClick: (e) => handleClick(e, annotation)
2110
+ }), null, 16, ["scale", "onClick"])
2111
+ ]),
2112
+ _: 2
2113
+ }, [
2114
+ !isMultiSelected.value ? {
2115
+ name: "selection-menu",
2116
+ fn: withCtx((slotProps) => [
2117
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2118
+ ]),
2119
+ key: "0"
2120
+ } : void 0
2121
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2122
+ key: 9,
2123
+ trackedAnnotation: annotation,
2124
+ isSelected: showIndividualSelection(annotation),
2125
+ isDraggable: isDraggable(annotation),
2126
+ isResizable: isResizable(annotation),
2127
+ lockAspectRatio: lockAspectRatio(annotation),
2128
+ onSelect: (e) => handleClick(e, annotation),
2129
+ vertexConfig: getVertexConfig(annotation),
2130
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2131
+ zIndex: 0,
2132
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2133
+ }, { ref_for: true }, containerProps.value), createSlots({
2134
+ default: withCtx(({ annotation: currentObject }) => [
2135
+ createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
2136
+ scale: __props.scale,
2137
+ onClick: (e) => handleClick(e, annotation)
2138
+ }), null, 16, ["scale", "onClick"])
2139
+ ]),
2140
+ _: 2
2141
+ }, [
2142
+ !isMultiSelected.value ? {
2143
+ name: "selection-menu",
2144
+ fn: withCtx((slotProps) => [
2145
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2146
+ ]),
2147
+ key: "0"
2148
+ } : void 0
2149
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2150
+ key: 10,
2151
+ trackedAnnotation: annotation,
2152
+ isSelected: showIndividualSelection(annotation),
2153
+ isDraggable: isDraggable(annotation),
2154
+ isResizable: isResizable(annotation),
2155
+ lockAspectRatio: lockAspectRatio(annotation),
2156
+ onSelect: (e) => handleClick(e, annotation),
2157
+ vertexConfig: getVertexConfig(annotation),
2158
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2159
+ zIndex: 0,
2160
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2161
+ }, { ref_for: true }, containerProps.value), createSlots({
2162
+ default: withCtx(({ annotation: currentObject }) => [
2163
+ createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
2164
+ scale: __props.scale,
2165
+ onClick: (e) => handleClick(e, annotation)
2166
+ }), null, 16, ["scale", "onClick"])
2167
+ ]),
2168
+ _: 2
2169
+ }, [
2170
+ !isMultiSelected.value ? {
2171
+ name: "selection-menu",
2172
+ fn: withCtx((slotProps) => [
2173
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2174
+ ]),
2175
+ key: "0"
2176
+ } : void 0
2177
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2178
+ key: 11,
2179
+ trackedAnnotation: annotation,
2180
+ isSelected: showIndividualSelection(annotation),
2181
+ isDraggable: isDraggable(annotation),
2182
+ isResizable: isResizable(annotation),
2183
+ lockAspectRatio: lockAspectRatio(annotation),
2184
+ onSelect: (e) => handleClick(e, annotation),
2185
+ vertexConfig: getVertexConfig(annotation),
2186
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2187
+ zIndex: 0,
2188
+ style: {
2189
+ mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Multiply)
2190
+ }
2191
+ }, { ref_for: true }, containerProps.value), createSlots({
2192
+ default: withCtx(({ annotation: currentObject }) => [
2193
+ createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
2194
+ scale: __props.scale,
2195
+ onClick: (e) => handleClick(e, annotation)
2196
+ }), null, 16, ["scale", "onClick"])
2197
+ ]),
2198
+ _: 2
2199
+ }, [
2200
+ !isMultiSelected.value ? {
2201
+ name: "selection-menu",
2202
+ fn: withCtx((slotProps) => [
2203
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2204
+ ]),
2205
+ key: "0"
2206
+ } : void 0
2207
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLink)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2208
+ key: 12,
2209
+ trackedAnnotation: annotation,
2210
+ isSelected: showIndividualSelection(annotation),
2211
+ isMultiSelected: isMultiSelected.value,
2212
+ isDraggable: false,
2213
+ isResizable: false,
2214
+ lockAspectRatio: false,
2215
+ onSelect: (e) => handleLinkClick(e, annotation),
2216
+ selectionMenu: annotation.object.inReplyToId ? void 0 : isMultiSelected.value ? void 0 : __props.selectionMenu,
2217
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2218
+ }, { ref_for: true }, containerProps.value), createSlots({
2219
+ default: withCtx(({ annotation: currentObject }) => [
2220
+ createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
2221
+ isSelected: isSelected(annotation),
2222
+ scale: __props.scale,
2223
+ onClick: (e) => handleLinkClick(e, annotation),
2224
+ hasIRT: !!annotation.object.inReplyToId
2225
+ }), null, 16, ["isSelected", "scale", "onClick", "hasIRT"])
2226
+ ]),
2227
+ "resize-handle": withCtx((slotProps) => [
2228
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2229
+ ]),
2230
+ _: 2
2231
+ }, [
2232
+ !isMultiSelected.value && !annotation.object.inReplyToId ? {
2233
+ name: "selection-menu",
2234
+ fn: withCtx((slotProps) => [
2235
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2236
+ ]),
2237
+ key: "0"
2238
+ } : void 0
2239
+ ]), 1040, ["trackedAnnotation", "isSelected", "isMultiSelected", "onSelect", "selectionMenu", "style"])) : createCommentVNode("", true)
2240
+ ], 64);
2241
+ }), 128)),
2242
+ allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$j, {
2243
+ key: 0,
2244
+ documentId: __props.documentId,
2245
+ pageIndex: __props.pageIndex,
2246
+ scale: __props.scale,
2247
+ rotation: __props.rotation,
2248
+ pageWidth: __props.pageWidth,
2249
+ pageHeight: __props.pageHeight,
2250
+ selectedAnnotations: selectedAnnotationsOnPage.value,
2251
+ isDraggable: areAllSelectedDraggable.value,
2252
+ isResizable: areAllSelectedResizable.value,
2253
+ resizeUI: __props.resizeUI,
2254
+ selectionOutlineColor: __props.selectionOutlineColor,
2255
+ groupSelectionMenu: __props.groupSelectionMenu
2256
+ }, {
2257
+ "group-selection-menu": withCtx((slotProps) => [
2258
+ renderSlot(_ctx.$slots, "group-selection-menu", normalizeProps(guardReactiveProps(slotProps)))
2259
+ ]),
2260
+ "resize-handle": withCtx((slotProps) => [
2261
+ renderSlot(_ctx.$slots, "resize-handle", normalizeProps(guardReactiveProps(slotProps)))
2262
+ ]),
2263
+ _: 3
2264
+ }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "selectedAnnotations", "isDraggable", "isResizable", "resizeUI", "selectionOutlineColor", "groupSelectionMenu"])) : createCommentVNode("", true)
2265
+ ], 64);
1733
2266
  };
1734
2267
  }
1735
2268
  });
@@ -1784,29 +2317,29 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1784
2317
  }, [
1785
2318
  activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$8, {
1786
2319
  key: 0,
1787
- color: activeTool.value.defaults.color,
2320
+ strokeColor: activeTool.value.defaults.strokeColor,
1788
2321
  opacity: activeTool.value.defaults.opacity,
1789
2322
  segmentRects: rects.value,
1790
2323
  scale: __props.scale
1791
- }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$5, {
2324
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$5, {
1792
2325
  key: 1,
1793
- color: activeTool.value.defaults.color,
2326
+ strokeColor: activeTool.value.defaults.strokeColor,
1794
2327
  opacity: activeTool.value.defaults.opacity,
1795
2328
  segmentRects: rects.value,
1796
2329
  scale: __props.scale
1797
- }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$6, {
2330
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$6, {
1798
2331
  key: 2,
1799
- color: activeTool.value.defaults.color,
2332
+ strokeColor: activeTool.value.defaults.strokeColor,
1800
2333
  opacity: activeTool.value.defaults.opacity,
1801
2334
  segmentRects: rects.value,
1802
2335
  scale: __props.scale
1803
- }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$7, {
2336
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$7, {
1804
2337
  key: 3,
1805
- color: activeTool.value.defaults.color,
2338
+ strokeColor: activeTool.value.defaults.strokeColor,
1806
2339
  opacity: activeTool.value.defaults.opacity,
1807
2340
  segmentRects: rects.value,
1808
2341
  scale: __props.scale
1809
- }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : createCommentVNode("", true)
2342
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : createCommentVNode("", true)
1810
2343
  ], 4)) : createCommentVNode("", true);
1811
2344
  };
1812
2345
  }
@@ -1832,7 +2365,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1832
2365
  return openBlock(), createElementBlock("div", {
1833
2366
  style: normalizeStyle(style.value)
1834
2367
  }, [
1835
- __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$h), mergeProps({
2368
+ __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$i), mergeProps({
1836
2369
  key: 0,
1837
2370
  isSelected: false,
1838
2371
  scale: __props.scale
@@ -1848,11 +2381,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1848
2381
  key: 3,
1849
2382
  isSelected: false,
1850
2383
  scale: __props.scale
1851
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$e), mergeProps({
2384
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$f), mergeProps({
1852
2385
  key: 4,
1853
2386
  isSelected: false,
1854
2387
  scale: __props.scale
1855
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$f), mergeProps({
2388
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$g), mergeProps({
1856
2389
  key: 5,
1857
2390
  isSelected: false,
1858
2391
  scale: __props.scale
@@ -1980,7 +2513,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1980
2513
  resizeUI: {},
1981
2514
  vertexUI: {},
1982
2515
  selectionOutlineColor: {},
1983
- selectionMenu: { type: Function }
2516
+ selectionMenu: { type: Function },
2517
+ groupSelectionMenu: { type: Function }
1984
2518
  },
1985
2519
  setup(__props) {
1986
2520
  const props = __props;
@@ -2019,11 +2553,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2019
2553
  resizeUI: __props.resizeUI,
2020
2554
  vertexUI: __props.vertexUI,
2021
2555
  selectionOutlineColor: __props.selectionOutlineColor,
2022
- selectionMenu: __props.selectionMenu
2556
+ selectionMenu: __props.selectionMenu,
2557
+ groupSelectionMenu: __props.groupSelectionMenu
2023
2558
  }, {
2024
2559
  "selection-menu": withCtx((slotProps) => [
2025
2560
  renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(slotProps)))
2026
2561
  ]),
2562
+ "group-selection-menu": withCtx((slotProps) => [
2563
+ renderSlot(_ctx.$slots, "group-selection-menu", normalizeProps(guardReactiveProps(slotProps)))
2564
+ ]),
2027
2565
  "resize-handle": withCtx((slotProps) => [
2028
2566
  renderSlot(_ctx.$slots, "resize-handle", normalizeProps(guardReactiveProps(slotProps)))
2029
2567
  ]),
@@ -2031,7 +2569,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2031
2569
  renderSlot(_ctx.$slots, "vertex-handle", normalizeProps(guardReactiveProps(slotProps)))
2032
2570
  ]),
2033
2571
  _: 3
2034
- }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu"]),
2572
+ }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu", "groupSelectionMenu"]),
2035
2573
  createVNode(_sfc_main$3, {
2036
2574
  documentId: __props.documentId,
2037
2575
  pageIndex: __props.pageIndex,
@@ -2047,15 +2585,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2047
2585
  }
2048
2586
  });
2049
2587
  export {
2050
- _sfc_main$i as AnnotationContainer,
2588
+ _sfc_main$k as AnnotationContainer,
2051
2589
  _sfc_main as AnnotationLayer,
2052
2590
  _sfc_main$1 as AnnotationPaintLayer,
2053
2591
  _sfc_main$4 as Annotations,
2054
- _sfc_main$h as Circle,
2055
- _sfc_main$g as FreeText,
2592
+ _sfc_main$i as Circle,
2593
+ _sfc_main$h as FreeText,
2594
+ _sfc_main$j as GroupSelectionBox,
2056
2595
  _sfc_main$8 as Highlight,
2057
- _sfc_main$f as Ink,
2058
- _sfc_main$e as Line,
2596
+ _sfc_main$g as Ink,
2597
+ _sfc_main$f as Line,
2598
+ _sfc_main$e as Link,
2059
2599
  _sfc_main$d as Polygon,
2060
2600
  _sfc_main$c as Polyline,
2061
2601
  _sfc_main$2 as PreviewRenderer,