@embedpdf/plugin-annotation 2.1.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1232 -93
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +31 -2
  6. package/dist/lib/annotation-plugin.d.ts +177 -2
  7. package/dist/lib/handlers/types.d.ts +1 -1
  8. package/dist/lib/helpers.d.ts +6 -1
  9. package/dist/lib/selectors.d.ts +97 -8
  10. package/dist/lib/tools/default-tools.d.ts +39 -11
  11. package/dist/lib/tools/types.d.ts +7 -1
  12. package/dist/lib/types.d.ts +265 -1
  13. package/dist/preact/adapter.d.ts +3 -3
  14. package/dist/preact/index.cjs +1 -1
  15. package/dist/preact/index.cjs.map +1 -1
  16. package/dist/preact/index.js +867 -406
  17. package/dist/preact/index.js.map +1 -1
  18. package/dist/react/adapter.d.ts +1 -1
  19. package/dist/react/index.cjs +1 -1
  20. package/dist/react/index.cjs.map +1 -1
  21. package/dist/react/index.js +867 -406
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +8 -1
  24. package/dist/shared/components/annotation-layer.d.ts +4 -2
  25. package/dist/shared/components/annotations/ink.d.ts +3 -3
  26. package/dist/shared/components/annotations/link.d.ts +28 -0
  27. package/dist/shared/components/annotations.d.ts +2 -1
  28. package/dist/shared/components/group-selection-box.d.ts +32 -0
  29. package/dist/shared/components/index.d.ts +1 -0
  30. package/dist/shared/components/text-markup/highlight.d.ts +3 -2
  31. package/dist/shared/components/text-markup/squiggly.d.ts +3 -2
  32. package/dist/shared/components/text-markup/strikeout.d.ts +3 -2
  33. package/dist/shared/components/text-markup/underline.d.ts +3 -2
  34. package/dist/shared/components/types.d.ts +7 -0
  35. package/dist/shared-preact/components/annotation-container.d.ts +8 -1
  36. package/dist/shared-preact/components/annotation-layer.d.ts +4 -2
  37. package/dist/shared-preact/components/annotations/ink.d.ts +3 -3
  38. package/dist/shared-preact/components/annotations/link.d.ts +28 -0
  39. package/dist/shared-preact/components/annotations.d.ts +2 -1
  40. package/dist/shared-preact/components/group-selection-box.d.ts +32 -0
  41. package/dist/shared-preact/components/index.d.ts +1 -0
  42. package/dist/shared-preact/components/text-markup/highlight.d.ts +3 -2
  43. package/dist/shared-preact/components/text-markup/squiggly.d.ts +3 -2
  44. package/dist/shared-preact/components/text-markup/strikeout.d.ts +3 -2
  45. package/dist/shared-preact/components/text-markup/underline.d.ts +3 -2
  46. package/dist/shared-preact/components/types.d.ts +7 -0
  47. package/dist/shared-react/components/annotation-container.d.ts +8 -1
  48. package/dist/shared-react/components/annotation-layer.d.ts +4 -2
  49. package/dist/shared-react/components/annotations/ink.d.ts +3 -3
  50. package/dist/shared-react/components/annotations/link.d.ts +28 -0
  51. package/dist/shared-react/components/annotations.d.ts +2 -1
  52. package/dist/shared-react/components/group-selection-box.d.ts +32 -0
  53. package/dist/shared-react/components/index.d.ts +1 -0
  54. package/dist/shared-react/components/text-markup/highlight.d.ts +3 -2
  55. package/dist/shared-react/components/text-markup/squiggly.d.ts +3 -2
  56. package/dist/shared-react/components/text-markup/strikeout.d.ts +3 -2
  57. package/dist/shared-react/components/text-markup/underline.d.ts +3 -2
  58. package/dist/shared-react/components/types.d.ts +7 -0
  59. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +5 -1
  60. package/dist/svelte/components/Annotations.svelte.d.ts +5 -1
  61. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +32 -0
  62. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -1
  63. package/dist/svelte/components/annotations/Link.svelte.d.ts +24 -0
  64. package/dist/svelte/components/annotations/index.d.ts +1 -0
  65. package/dist/svelte/components/index.d.ts +1 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +2 -1
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +2 -1
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +2 -1
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +2 -1
  70. package/dist/svelte/components/types.d.ts +2 -0
  71. package/dist/svelte/index.cjs +1 -1
  72. package/dist/svelte/index.cjs.map +1 -1
  73. package/dist/svelte/index.js +912 -258
  74. package/dist/svelte/index.js.map +1 -1
  75. package/dist/svelte/types.d.ts +7 -0
  76. package/dist/vue/components/annotation-container.vue.d.ts +2 -0
  77. package/dist/vue/components/annotation-layer.vue.d.ts +28 -5
  78. package/dist/vue/components/annotations/index.d.ts +1 -0
  79. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  80. package/dist/vue/components/annotations/line.vue.d.ts +1 -1
  81. package/dist/vue/components/annotations/link.vue.d.ts +29 -0
  82. package/dist/vue/components/annotations/polygon.vue.d.ts +1 -1
  83. package/dist/vue/components/annotations/polyline.vue.d.ts +1 -1
  84. package/dist/vue/components/annotations.vue.d.ts +65 -1
  85. package/dist/vue/components/group-selection-box.vue.d.ts +73 -0
  86. package/dist/vue/components/index.d.ts +1 -0
  87. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  88. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  89. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  90. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  91. package/dist/vue/hooks/use-annotation.d.ts +2 -0
  92. package/dist/vue/index.cjs +1 -1
  93. package/dist/vue/index.cjs.map +1 -1
  94. package/dist/vue/index.js +962 -409
  95. package/dist/vue/index.js.map +1 -1
  96. package/dist/vue/types.d.ts +7 -0
  97. package/package.json +10 -10
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";
2
- import { usePlugin, useCapability, 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";
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
+ import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
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,15 +76,31 @@ 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();
80
+ const permissions = useDocumentPermissions(props.documentId);
78
81
  const gestureBaseRef = ref(null);
82
+ const gestureBaseRectRef = shallowRef(null);
83
+ const effectiveIsDraggable = computed(
84
+ () => permissions.value.canModifyAnnotations && props.isDraggable && !props.isMultiSelected
85
+ );
86
+ const effectiveIsResizable = computed(
87
+ () => permissions.value.canModifyAnnotations && props.isResizable && !props.isMultiSelected
88
+ );
89
+ const guardedOnDoubleClick = props.onDoubleClick ? (e) => {
90
+ var _a;
91
+ if (permissions.value.canModifyAnnotations) {
92
+ (_a = props.onDoubleClick) == null ? void 0 : _a.call(props, e);
93
+ }
94
+ } : void 0;
79
95
  const annotationProvides = computed(
80
96
  () => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
81
97
  );
82
98
  const currentObject = computed(
83
99
  () => ({ ...toRaw(props.trackedAnnotation.object), ...toRaw(preview.value) })
84
100
  );
101
+ const showOutline = computed(() => props.isSelected && !props.isMultiSelected);
85
102
  const shouldShowMenu = computed(() => {
86
- return props.isSelected && (props.selectionMenu || slots["selection-menu"]);
103
+ return props.isSelected && !props.isMultiSelected && (props.selectionMenu || slots["selection-menu"]);
87
104
  });
88
105
  const menuRect = computed(() => ({
89
106
  origin: {
@@ -141,30 +158,60 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
141
158
  maintainAspectRatio: computed(() => props.lockAspectRatio),
142
159
  pageRotation: computed(() => props.rotation),
143
160
  scale: computed(() => props.scale),
144
- enabled: computed(() => props.isSelected),
161
+ // Disable interaction handles when multi-selected
162
+ enabled: computed(() => props.isSelected && !props.isMultiSelected),
145
163
  onUpdate: (event) => {
146
- var _a, _b, _c, _d;
147
- 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 };
148
171
  if (event.state === "start") {
172
+ gestureBaseRectRef.value = props.trackedAnnotation.object.rect;
149
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
+ }
150
183
  }
151
- const base = gestureBaseRef.value ?? currentObject.value;
152
- 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 };
153
- const patched = (_c = annotationCapability.value) == null ? void 0 : _c.transformAnnotation(base, {
154
- type: event.transformData.type,
155
- changes,
156
- metadata: event.transformData.metadata
157
- });
158
- if (patched) {
159
- 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
+ }
160
194
  }
161
- 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;
162
212
  gestureBaseRef.value = null;
163
- (_d = annotationProvides.value) == null ? void 0 : _d.updateAnnotation(
164
- props.pageIndex,
165
- props.trackedAnnotation.object.id,
166
- patched
167
- );
213
+ if (type === "move") plugin.commitDrag(props.documentId);
214
+ else if (type === "resize") plugin.commitResize(props.documentId);
168
215
  }
169
216
  }
170
217
  },
@@ -181,7 +228,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
181
228
  },
182
229
  includeVertices: !!props.vertexConfig
183
230
  });
184
- const doubleProps = useDoublePressProps(props.onDoubleClick);
231
+ const doubleProps = useDoublePressProps(guardedOnDoubleClick);
185
232
  watch(
186
233
  () => props.trackedAnnotation.object,
187
234
  (newObject) => {
@@ -189,17 +236,34 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
189
236
  },
190
237
  { deep: true }
191
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
+ });
192
256
  const containerStyle = computed(() => ({
193
257
  position: "absolute",
194
258
  left: `${currentObject.value.rect.origin.x * props.scale}px`,
195
259
  top: `${currentObject.value.rect.origin.y * props.scale}px`,
196
260
  width: `${currentObject.value.rect.size.width * props.scale}px`,
197
261
  height: `${currentObject.value.rect.size.height * props.scale}px`,
198
- outline: props.isSelected ? `1px solid ${props.selectionOutlineColor}` : "none",
199
- outlineOffset: props.isSelected ? `${props.outlineOffset}px` : "0px",
200
- 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",
201
265
  touchAction: "none",
202
- cursor: props.isSelected && props.isDraggable ? "move" : "default",
266
+ cursor: props.isSelected && effectiveIsDraggable.value ? "move" : "default",
203
267
  zIndex: props.zIndex
204
268
  }));
205
269
  const mergedContainerStyle = computed(() => ({
@@ -208,10 +272,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
208
272
  }));
209
273
  const slots = useSlots();
210
274
  return (_ctx, _cache) => {
211
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
212
- createElementVNode("div", mergeProps({ ...unref(dragProps), ...unref(doubleProps) }, { style: mergedContainerStyle.value }), [
275
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
276
+ createElementVNode("div", mergeProps({ ...effectiveIsDraggable.value && __props.isSelected ? unref(dragProps) : {}, ...unref(doubleProps) }, { style: mergedContainerStyle.value }), [
213
277
  renderSlot(_ctx.$slots, "default", { annotation: currentObject.value }),
214
- __props.isSelected && __props.isResizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
278
+ __props.isSelected && effectiveIsResizable.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
215
279
  return openBlock(), createElementBlock(Fragment, { key }, [
216
280
  unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
217
281
  key: 0,
@@ -228,7 +292,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
228
292
  }), null, 16))
229
293
  ], 64);
230
294
  }), 128)) : createCommentVNode("", true),
231
- __props.isSelected && 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 }) => {
232
296
  return openBlock(), createElementBlock(Fragment, { key }, [
233
297
  unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
234
298
  key: 0,
@@ -267,9 +331,238 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
267
331
  };
268
332
  }
269
333
  });
270
- const _hoisted_1$7 = ["width", "height", "viewBox"];
271
- const _hoisted_2$5 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
272
- 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({
273
566
  __name: "circle",
274
567
  props: {
275
568
  isSelected: { type: Boolean },
@@ -335,13 +628,13 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
335
628
  strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
336
629
  }
337
630
  })
338
- }, null, 44, _hoisted_2$5)
339
- ], 12, _hoisted_1$7);
631
+ }, null, 44, _hoisted_2$6)
632
+ ], 12, _hoisted_1$8);
340
633
  };
341
634
  }
342
635
  });
343
- const _hoisted_1$6 = ["contenteditable"];
344
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
636
+ const _hoisted_1$7 = ["contenteditable"];
637
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
345
638
  __name: "free-text",
346
639
  props: {
347
640
  isSelected: { type: Boolean },
@@ -403,7 +696,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
403
696
  flexDirection: "column",
404
697
  justifyContent: anno.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : anno.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
405
698
  display: "flex",
406
- backgroundColor: anno.backgroundColor,
699
+ backgroundColor: anno.color ?? anno.backgroundColor,
407
700
  opacity: anno.opacity,
408
701
  width: needsComp ? `${invScalePercent}%` : "100%",
409
702
  height: needsComp ? `${invScalePercent}%` : "100%",
@@ -437,18 +730,18 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
437
730
  tabindex: "0",
438
731
  style: normalizeStyle(editorStyle.value),
439
732
  contenteditable: __props.isEditing
440
- }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$6)
733
+ }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$7)
441
734
  ], 36);
442
735
  };
443
736
  }
444
737
  });
445
- const _hoisted_1$5 = ["width", "height", "viewBox"];
446
- const _hoisted_2$4 = ["d", "opacity"];
447
- 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({
448
741
  __name: "ink",
449
742
  props: {
450
743
  isSelected: { type: Boolean },
451
- color: { default: "#000000" },
744
+ strokeColor: {},
452
745
  opacity: { default: 1 },
453
746
  strokeWidth: {},
454
747
  inkList: {},
@@ -458,6 +751,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
458
751
  },
459
752
  setup(__props) {
460
753
  const props = __props;
754
+ const resolvedColor = computed(() => props.strokeColor ?? "#000000");
461
755
  const paths = computed(() => {
462
756
  return props.inkList.map(({ points }) => {
463
757
  let d = "";
@@ -498,22 +792,22 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
498
792
  style: normalizeStyle({
499
793
  cursor: __props.isSelected ? "move" : "pointer",
500
794
  pointerEvents: __props.isSelected ? "none" : "visibleStroke",
501
- stroke: __props.color,
795
+ stroke: resolvedColor.value,
502
796
  strokeWidth: __props.strokeWidth,
503
797
  strokeLinecap: "round",
504
798
  strokeLinejoin: "round"
505
799
  })
506
- }, null, 44, _hoisted_2$4);
800
+ }, null, 44, _hoisted_2$5);
507
801
  }), 128))
508
- ], 12, _hoisted_1$5);
802
+ ], 12, _hoisted_1$6);
509
803
  };
510
804
  }
511
805
  });
512
- const _hoisted_1$4 = ["width", "height", "viewBox"];
513
- const _hoisted_2$3 = ["x1", "y1", "x2", "y2", "opacity"];
514
- const _hoisted_3$2 = ["d", "transform", "stroke", "fill"];
515
- const _hoisted_4$2 = ["d", "transform", "stroke", "fill"];
516
- 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({
517
811
  __name: "line",
518
812
  props: {
519
813
  color: { default: "transparent" },
@@ -601,7 +895,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
601
895
  strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
602
896
  }
603
897
  })
604
- }, null, 44, _hoisted_2$3),
898
+ }, null, 44, _hoisted_2$4),
605
899
  endings.value.start ? (openBlock(), createElementBlock("path", {
606
900
  key: 0,
607
901
  d: endings.value.start.d,
@@ -613,7 +907,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
613
907
  stroke: __props.strokeColor,
614
908
  style: normalizeStyle(getEndingStyle(endings.value.start)),
615
909
  fill: endings.value.start.filled ? __props.color : "none"
616
- }, null, 44, _hoisted_3$2)) : createCommentVNode("", true),
910
+ }, null, 44, _hoisted_3$3)) : createCommentVNode("", true),
617
911
  endings.value.end ? (openBlock(), createElementBlock("path", {
618
912
  key: 1,
619
913
  d: endings.value.end.d,
@@ -625,7 +919,96 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
625
919
  stroke: __props.strokeColor,
626
920
  style: normalizeStyle(getEndingStyle(endings.value.end)),
627
921
  fill: endings.value.end.filled ? __props.color : "none"
628
- }, 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))
629
1012
  ], 12, _hoisted_1$4);
630
1013
  };
631
1014
  }
@@ -1063,7 +1446,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1063
1446
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1064
1447
  __name: "highlight",
1065
1448
  props: {
1066
- color: { default: "#FFFF00" },
1449
+ strokeColor: {},
1067
1450
  opacity: { default: 0.5 },
1068
1451
  segmentRects: {},
1069
1452
  rect: {},
@@ -1071,6 +1454,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1071
1454
  onClick: {}
1072
1455
  },
1073
1456
  setup(__props) {
1457
+ const props = __props;
1458
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1074
1459
  return (_ctx, _cache) => {
1075
1460
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (b, i) => {
1076
1461
  return openBlock(), createElementBlock("div", {
@@ -1085,7 +1470,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1085
1470
  top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
1086
1471
  width: `${b.size.width * __props.scale}px`,
1087
1472
  height: `${b.size.height * __props.scale}px`,
1088
- background: __props.color,
1473
+ background: resolvedColor.value,
1089
1474
  opacity: __props.opacity,
1090
1475
  pointerEvents: __props.onClick ? "auto" : "none",
1091
1476
  cursor: __props.onClick ? "pointer" : "default",
@@ -1099,7 +1484,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1099
1484
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1100
1485
  __name: "squiggly",
1101
1486
  props: {
1102
- color: { default: "#FFFF00" },
1487
+ strokeColor: {},
1103
1488
  opacity: { default: 0.5 },
1104
1489
  segmentRects: {},
1105
1490
  rect: {},
@@ -1108,6 +1493,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1108
1493
  },
1109
1494
  setup(__props) {
1110
1495
  const props = __props;
1496
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1111
1497
  const amplitude = computed(() => 2 * props.scale);
1112
1498
  const period = computed(() => 6 * props.scale);
1113
1499
  const svgDataUri = computed(() => {
@@ -1115,7 +1501,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1115
1501
  const per = period.value;
1116
1502
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${per}" height="${amp * 2}" viewBox="0 0 ${per} ${amp * 2}">
1117
1503
  <path d="M0 ${amp} Q ${per / 4} 0 ${per / 2} ${amp} T ${per} ${amp}"
1118
- fill="none" stroke="${props.color}" stroke-width="${amp}" stroke-linecap="round"/>
1504
+ fill="none" stroke="${resolvedColor.value}" stroke-width="${amp}" stroke-linecap="round"/>
1119
1505
  </svg>`;
1120
1506
  return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
1121
1507
  });
@@ -1161,7 +1547,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1161
1547
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1162
1548
  __name: "strikeout",
1163
1549
  props: {
1164
- color: { default: "#FFFF00" },
1550
+ strokeColor: {},
1165
1551
  opacity: { default: 0.5 },
1166
1552
  segmentRects: {},
1167
1553
  rect: {},
@@ -1170,6 +1556,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1170
1556
  },
1171
1557
  setup(__props) {
1172
1558
  const props = __props;
1559
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1173
1560
  const thickness = computed(() => 2 * props.scale);
1174
1561
  return (_ctx, _cache) => {
1175
1562
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
@@ -1198,7 +1585,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1198
1585
  top: "50%",
1199
1586
  width: "100%",
1200
1587
  height: `${thickness.value}px`,
1201
- background: __props.color,
1588
+ background: resolvedColor.value,
1202
1589
  opacity: __props.opacity,
1203
1590
  transform: "translateY(-50%)",
1204
1591
  pointerEvents: "none"
@@ -1212,7 +1599,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1212
1599
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1213
1600
  __name: "underline",
1214
1601
  props: {
1215
- color: { default: "#FFFF00" },
1602
+ strokeColor: {},
1216
1603
  opacity: { default: 0.5 },
1217
1604
  segmentRects: {},
1218
1605
  rect: {},
@@ -1221,6 +1608,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1221
1608
  },
1222
1609
  setup(__props) {
1223
1610
  const props = __props;
1611
+ const resolvedColor = computed(() => props.strokeColor ?? "#FFFF00");
1224
1612
  const thickness = computed(() => 2 * props.scale);
1225
1613
  return (_ctx, _cache) => {
1226
1614
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
@@ -1249,7 +1637,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1249
1637
  bottom: 0,
1250
1638
  width: "100%",
1251
1639
  height: `${thickness.value}px`,
1252
- background: __props.color,
1640
+ background: resolvedColor.value,
1253
1641
  opacity: __props.opacity,
1254
1642
  pointerEvents: "none"
1255
1643
  })
@@ -1271,30 +1659,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1271
1659
  resizeUI: {},
1272
1660
  vertexUI: {},
1273
1661
  selectionOutlineColor: {},
1274
- selectionMenu: { type: Function }
1662
+ selectionMenu: { type: Function },
1663
+ groupSelectionMenu: { type: Function }
1275
1664
  },
1276
1665
  setup(__props) {
1277
1666
  const props = __props;
1278
1667
  const { provides: annotationCapability } = useAnnotationCapability();
1279
1668
  const { provides: selectionProvides } = useSelectionCapability();
1280
1669
  const annotations = ref([]);
1670
+ const allSelectedIds = ref([]);
1281
1671
  const { register } = usePointerHandlers({
1282
1672
  documentId: () => props.documentId,
1283
1673
  pageIndex: props.pageIndex
1284
1674
  });
1285
- const selectionState = ref(null);
1286
1675
  const editingId = ref(null);
1287
1676
  const annotationProvides = computed(
1288
1677
  () => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
1289
1678
  );
1679
+ const isMultiSelected = computed(() => allSelectedIds.value.length > 1);
1290
1680
  watchEffect((onCleanup) => {
1291
1681
  if (annotationProvides.value) {
1292
1682
  const currentState = annotationProvides.value.getState();
1293
1683
  annotations.value = getAnnotationsByPageIndex(currentState, props.pageIndex);
1294
- selectionState.value = getSelectedAnnotationByPageIndex(currentState, props.pageIndex);
1684
+ allSelectedIds.value = getSelectedAnnotationIds(currentState);
1295
1685
  const off = annotationProvides.value.onStateChange((state) => {
1296
1686
  annotations.value = getAnnotationsByPageIndex(state, props.pageIndex);
1297
- selectionState.value = getSelectedAnnotationByPageIndex(state, props.pageIndex);
1687
+ allSelectedIds.value = getSelectedAnnotationIds(state);
1298
1688
  });
1299
1689
  onCleanup(off);
1300
1690
  }
@@ -1308,13 +1698,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1308
1698
  const handleClick = (e, annotation) => {
1309
1699
  e.stopPropagation();
1310
1700
  if (annotationProvides.value && selectionProvides.value) {
1311
- annotationProvides.value.selectAnnotation(props.pageIndex, annotation.object.id);
1312
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
+ }
1313
1708
  if (annotation.object.id !== editingId.value) {
1314
1709
  editingId.value = null;
1315
1710
  }
1316
1711
  }
1317
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
+ };
1318
1727
  const handleDoubleClick = (_e, id) => {
1319
1728
  if (isFreeText(annotations.value.find((a) => a.object.id === id))) {
1320
1729
  editingId.value = id;
@@ -1328,6 +1737,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1328
1737
  }
1329
1738
  }
1330
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
+ });
1331
1766
  const getTool = (annotation) => {
1332
1767
  var _a;
1333
1768
  return (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(annotation.object);
@@ -1335,16 +1770,23 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1335
1770
  const isDraggable = (anno) => {
1336
1771
  var _a;
1337
1772
  if (isFreeText(anno) && editingId.value === anno.object.id) return false;
1773
+ if (isMultiSelected.value) return false;
1338
1774
  return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1339
1775
  };
1340
1776
  const isResizable = (anno) => {
1341
1777
  var _a;
1778
+ if (isMultiSelected.value) return false;
1342
1779
  return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isResizable) ?? false;
1343
1780
  };
1344
1781
  const lockAspectRatio = (anno) => {
1345
1782
  var _a;
1346
1783
  return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1347
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
+ });
1348
1790
  const getVertexConfig = (annotation) => {
1349
1791
  if (isLine(annotation)) {
1350
1792
  return {
@@ -1364,359 +1806,463 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1364
1806
  return void 0;
1365
1807
  };
1366
1808
  return (_ctx, _cache) => {
1367
- return openBlock(true), createElementBlock(Fragment, null, renderList(annotations.value, (annotation) => {
1368
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1369
- return openBlock(), createElementBlock(Fragment, {
1370
- key: annotation.object.id
1371
- }, [
1372
- unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1373
- key: 0,
1374
- trackedAnnotation: annotation,
1375
- isSelected: ((_a = selectionState.value) == null ? void 0 : _a.object.id) === annotation.object.id,
1376
- isDraggable: isDraggable(annotation),
1377
- isResizable: isResizable(annotation),
1378
- lockAspectRatio: lockAspectRatio(annotation),
1379
- onSelect: (e) => handleClick(e, annotation),
1380
- vertexConfig: getVertexConfig(annotation),
1381
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1382
- }, { ref_for: true }, props), {
1383
- default: withCtx(({ annotation: currentObject }) => {
1384
- var _a2;
1385
- return [
1386
- createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
1387
- 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),
1388
1829
  scale: __props.scale,
1389
1830
  onClick: (e) => handleClick(e, annotation)
1390
1831
  }), null, 16, ["isSelected", "scale", "onClick"])
1391
- ];
1392
- }),
1393
- "selection-menu": withCtx((slotProps) => [
1394
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1395
- ]),
1396
- "resize-handle": withCtx((slotProps) => [
1397
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1398
- ]),
1399
- "vertex-handle": withCtx((slotProps) => [
1400
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1401
- ]),
1402
- _: 2
1403
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1404
- key: 1,
1405
- trackedAnnotation: annotation,
1406
- isSelected: ((_b = selectionState.value) == null ? void 0 : _b.object.id) === annotation.object.id,
1407
- isDraggable: isDraggable(annotation),
1408
- isResizable: isResizable(annotation),
1409
- lockAspectRatio: lockAspectRatio(annotation),
1410
- onSelect: (e) => handleClick(e, annotation),
1411
- vertexConfig: getVertexConfig(annotation),
1412
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1413
- }, { ref_for: true }, props), {
1414
- default: withCtx(({ annotation: currentObject }) => {
1415
- var _a2;
1416
- 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 }) => [
1417
1861
  createVNode(_sfc_main$b, mergeProps({ ref_for: true }, currentObject, {
1418
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1862
+ isSelected: isSelected(annotation),
1419
1863
  scale: __props.scale,
1420
1864
  onClick: (e) => handleClick(e, annotation)
1421
1865
  }), null, 16, ["isSelected", "scale", "onClick"])
1422
- ];
1423
- }),
1424
- "selection-menu": withCtx((slotProps) => [
1425
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1426
- ]),
1427
- "resize-handle": withCtx((slotProps) => [
1428
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1429
- ]),
1430
- "vertex-handle": withCtx((slotProps) => [
1431
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1432
- ]),
1433
- _: 2
1434
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1435
- key: 2,
1436
- trackedAnnotation: annotation,
1437
- isSelected: ((_c = selectionState.value) == null ? void 0 : _c.object.id) === annotation.object.id,
1438
- isDraggable: isDraggable(annotation),
1439
- isResizable: isResizable(annotation),
1440
- lockAspectRatio: lockAspectRatio(annotation),
1441
- onSelect: (e) => handleClick(e, annotation),
1442
- vertexConfig: getVertexConfig(annotation),
1443
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1444
- }, { ref_for: true }, props), {
1445
- default: withCtx(({ annotation: currentObject }) => {
1446
- var _a2;
1447
- return [
1448
- createVNode(_sfc_main$h, mergeProps({ ref_for: true }, currentObject, {
1449
- 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),
1450
1897
  scale: __props.scale,
1451
1898
  onClick: (e) => handleClick(e, annotation)
1452
1899
  }), null, 16, ["isSelected", "scale", "onClick"])
1453
- ];
1454
- }),
1455
- "selection-menu": withCtx((slotProps) => [
1456
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1457
- ]),
1458
- "resize-handle": withCtx((slotProps) => [
1459
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1460
- ]),
1461
- "vertex-handle": withCtx((slotProps) => [
1462
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1463
- ]),
1464
- _: 2
1465
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1466
- key: 3,
1467
- trackedAnnotation: annotation,
1468
- isSelected: ((_d = selectionState.value) == null ? void 0 : _d.object.id) === annotation.object.id,
1469
- isDraggable: isDraggable(annotation),
1470
- isResizable: isResizable(annotation),
1471
- lockAspectRatio: lockAspectRatio(annotation),
1472
- onSelect: (e) => handleClick(e, annotation),
1473
- vertexConfig: getVertexConfig(annotation),
1474
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1475
- }, { ref_for: true }, props), {
1476
- default: withCtx(({ annotation: currentObject }) => {
1477
- var _a2;
1478
- return [
1479
- createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
1480
- 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),
1481
1931
  scale: __props.scale,
1482
1932
  onClick: (e) => handleClick(e, annotation)
1483
1933
  }), null, 16, ["isSelected", "scale", "onClick"])
1484
- ];
1485
- }),
1486
- "selection-menu": withCtx((slotProps) => [
1487
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1488
- ]),
1489
- "resize-handle": withCtx((slotProps) => [
1490
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1491
- ]),
1492
- "vertex-handle": withCtx((slotProps) => [
1493
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1494
- ]),
1495
- _: 2
1496
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1497
- key: 4,
1498
- trackedAnnotation: annotation,
1499
- isSelected: ((_e = selectionState.value) == null ? void 0 : _e.object.id) === annotation.object.id,
1500
- isDraggable: isDraggable(annotation),
1501
- isResizable: isResizable(annotation),
1502
- lockAspectRatio: lockAspectRatio(annotation),
1503
- onSelect: (e) => handleClick(e, annotation),
1504
- vertexConfig: getVertexConfig(annotation),
1505
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1506
- }, { ref_for: true }, props), {
1507
- default: withCtx(({ annotation: currentObject }) => {
1508
- var _a2;
1509
- 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 }) => [
1510
1963
  createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
1511
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1964
+ isSelected: isSelected(annotation),
1512
1965
  scale: __props.scale,
1513
1966
  onClick: (e) => handleClick(e, annotation)
1514
1967
  }), null, 16, ["isSelected", "scale", "onClick"])
1515
- ];
1516
- }),
1517
- "selection-menu": withCtx((slotProps) => [
1518
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1519
- ]),
1520
- "resize-handle": withCtx((slotProps) => [
1521
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1522
- ]),
1523
- "vertex-handle": withCtx((slotProps) => [
1524
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1525
- ]),
1526
- _: 2
1527
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1528
- key: 5,
1529
- trackedAnnotation: annotation,
1530
- isSelected: ((_f = selectionState.value) == null ? void 0 : _f.object.id) === annotation.object.id,
1531
- isDraggable: isDraggable(annotation),
1532
- isResizable: isResizable(annotation),
1533
- lockAspectRatio: lockAspectRatio(annotation),
1534
- onSelect: (e) => handleClick(e, annotation),
1535
- vertexConfig: getVertexConfig(annotation),
1536
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1537
- }, { ref_for: true }, props), {
1538
- default: withCtx(({ annotation: currentObject }) => {
1539
- var _a2;
1540
- 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 }) => [
1541
1997
  createVNode(_sfc_main$d, mergeProps({ ref_for: true }, currentObject, {
1542
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1998
+ isSelected: isSelected(annotation),
1543
1999
  scale: __props.scale,
1544
2000
  onClick: (e) => handleClick(e, annotation)
1545
2001
  }), null, 16, ["isSelected", "scale", "onClick"])
1546
- ];
1547
- }),
1548
- "selection-menu": withCtx((slotProps) => [
1549
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1550
- ]),
1551
- "resize-handle": withCtx((slotProps) => [
1552
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1553
- ]),
1554
- "vertex-handle": withCtx((slotProps) => [
1555
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1556
- ]),
1557
- _: 2
1558
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1559
- key: 6,
1560
- trackedAnnotation: annotation,
1561
- isSelected: ((_g = selectionState.value) == null ? void 0 : _g.object.id) === annotation.object.id,
1562
- isDraggable: isDraggable(annotation),
1563
- isResizable: isResizable(annotation),
1564
- lockAspectRatio: lockAspectRatio(annotation),
1565
- onSelect: (e) => handleClick(e, annotation),
1566
- onDoubleClick: (e) => handleDoubleClick(e, annotation.object.id),
1567
- vertexConfig: getVertexConfig(annotation),
1568
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1569
- }, { ref_for: true }, props), {
1570
- default: withCtx(({ annotation: currentObject }) => {
1571
- var _a2;
1572
- return [
1573
- createVNode(_sfc_main$g, {
1574
- 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),
1575
2034
  isEditing: editingId.value === annotation.object.id,
1576
2035
  annotation: { ...annotation, object: currentObject },
1577
2036
  pageIndex: __props.pageIndex,
1578
2037
  scale: __props.scale,
1579
2038
  onClick: (e) => handleClick(e, annotation)
1580
2039
  }, null, 8, ["isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick"])
1581
- ];
1582
- }),
1583
- "selection-menu": withCtx((slotProps) => [
1584
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1585
- ]),
1586
- "resize-handle": withCtx((slotProps) => [
1587
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1588
- ]),
1589
- "vertex-handle": withCtx((slotProps) => [
1590
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1591
- ]),
1592
- _: 2
1593
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1594
- key: 7,
1595
- trackedAnnotation: annotation,
1596
- isSelected: ((_h = selectionState.value) == null ? void 0 : _h.object.id) === annotation.object.id,
1597
- isDraggable: isDraggable(annotation),
1598
- isResizable: isResizable(annotation),
1599
- lockAspectRatio: lockAspectRatio(annotation),
1600
- onSelect: (e) => handleClick(e, annotation),
1601
- vertexConfig: getVertexConfig(annotation),
1602
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1603
- }, { ref_for: true }, props), {
1604
- default: withCtx(() => {
1605
- var _a2;
1606
- 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(() => [
1607
2069
  createVNode(_sfc_main$9, {
1608
2070
  documentId: __props.documentId,
1609
- isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
2071
+ isSelected: isSelected(annotation),
1610
2072
  annotation,
1611
2073
  pageIndex: __props.pageIndex,
1612
2074
  scale: __props.scale,
1613
2075
  onClick: (e) => handleClick(e, annotation)
1614
2076
  }, null, 8, ["documentId", "isSelected", "annotation", "pageIndex", "scale", "onClick"])
1615
- ];
1616
- }),
1617
- "selection-menu": withCtx((slotProps) => [
1618
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1619
- ]),
1620
- "resize-handle": withCtx((slotProps) => [
1621
- renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1622
- ]),
1623
- "vertex-handle": withCtx((slotProps) => [
1624
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1625
- ]),
1626
- _: 2
1627
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1628
- key: 8,
1629
- trackedAnnotation: annotation,
1630
- isSelected: ((_i = selectionState.value) == null ? void 0 : _i.object.id) === annotation.object.id,
1631
- isDraggable: isDraggable(annotation),
1632
- isResizable: isResizable(annotation),
1633
- lockAspectRatio: lockAspectRatio(annotation),
1634
- onSelect: (e) => handleClick(e, annotation),
1635
- vertexConfig: getVertexConfig(annotation),
1636
- zIndex: 0,
1637
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1638
- }, { ref_for: true }, props), {
1639
- default: withCtx(({ annotation: currentObject }) => [
1640
- createVNode(_sfc_main$5, mergeProps({ ref_for: true }, currentObject, {
1641
- scale: __props.scale,
1642
- onClick: (e) => handleClick(e, annotation)
1643
- }), null, 16, ["scale", "onClick"])
1644
- ]),
1645
- "selection-menu": withCtx((slotProps) => [
1646
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1647
- ]),
1648
- _: 2
1649
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1650
- key: 9,
1651
- trackedAnnotation: annotation,
1652
- isSelected: ((_j = selectionState.value) == null ? void 0 : _j.object.id) === annotation.object.id,
1653
- isDraggable: isDraggable(annotation),
1654
- isResizable: isResizable(annotation),
1655
- lockAspectRatio: lockAspectRatio(annotation),
1656
- onSelect: (e) => handleClick(e, annotation),
1657
- vertexConfig: getVertexConfig(annotation),
1658
- zIndex: 0,
1659
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1660
- }, { ref_for: true }, props), {
1661
- default: withCtx(({ annotation: currentObject }) => [
1662
- createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
1663
- scale: __props.scale,
1664
- onClick: (e) => handleClick(e, annotation)
1665
- }), null, 16, ["scale", "onClick"])
1666
- ]),
1667
- "selection-menu": withCtx((slotProps) => [
1668
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1669
- ]),
1670
- _: 2
1671
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1672
- key: 10,
1673
- trackedAnnotation: annotation,
1674
- isSelected: ((_k = selectionState.value) == null ? void 0 : _k.object.id) === annotation.object.id,
1675
- isDraggable: isDraggable(annotation),
1676
- isResizable: isResizable(annotation),
1677
- lockAspectRatio: lockAspectRatio(annotation),
1678
- onSelect: (e) => handleClick(e, annotation),
1679
- vertexConfig: getVertexConfig(annotation),
1680
- zIndex: 0,
1681
- style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1682
- }, { ref_for: true }, props), {
1683
- default: withCtx(({ annotation: currentObject }) => [
1684
- createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
1685
- scale: __props.scale,
1686
- onClick: (e) => handleClick(e, annotation)
1687
- }), null, 16, ["scale", "onClick"])
1688
- ]),
1689
- "selection-menu": withCtx((slotProps) => [
1690
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1691
- ]),
1692
- _: 2
1693
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$i, mergeProps({
1694
- key: 11,
1695
- trackedAnnotation: annotation,
1696
- isSelected: ((_l = selectionState.value) == null ? void 0 : _l.object.id) === annotation.object.id,
1697
- isDraggable: isDraggable(annotation),
1698
- isResizable: isResizable(annotation),
1699
- lockAspectRatio: lockAspectRatio(annotation),
1700
- onSelect: (e) => handleClick(e, annotation),
1701
- vertexConfig: getVertexConfig(annotation),
1702
- zIndex: 0,
1703
- style: {
1704
- mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Multiply)
1705
- }
1706
- }, { ref_for: true }, props), {
1707
- default: withCtx(({ annotation: currentObject }) => [
1708
- createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
1709
- scale: __props.scale,
1710
- onClick: (e) => handleClick(e, annotation)
1711
- }), null, 16, ["scale", "onClick"])
1712
- ]),
1713
- "selection-menu": withCtx((slotProps) => [
1714
- renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
1715
- ]),
1716
- _: 2
1717
- }, 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "style"])) : createCommentVNode("", true)
1718
- ], 64);
1719
- }), 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);
1720
2266
  };
1721
2267
  }
1722
2268
  });
@@ -1771,29 +2317,29 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1771
2317
  }, [
1772
2318
  activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$8, {
1773
2319
  key: 0,
1774
- color: activeTool.value.defaults.color,
2320
+ strokeColor: activeTool.value.defaults.strokeColor,
1775
2321
  opacity: activeTool.value.defaults.opacity,
1776
2322
  segmentRects: rects.value,
1777
2323
  scale: __props.scale
1778
- }, 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, {
1779
2325
  key: 1,
1780
- color: activeTool.value.defaults.color,
2326
+ strokeColor: activeTool.value.defaults.strokeColor,
1781
2327
  opacity: activeTool.value.defaults.opacity,
1782
2328
  segmentRects: rects.value,
1783
2329
  scale: __props.scale
1784
- }, 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, {
1785
2331
  key: 2,
1786
- color: activeTool.value.defaults.color,
2332
+ strokeColor: activeTool.value.defaults.strokeColor,
1787
2333
  opacity: activeTool.value.defaults.opacity,
1788
2334
  segmentRects: rects.value,
1789
2335
  scale: __props.scale
1790
- }, 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, {
1791
2337
  key: 3,
1792
- color: activeTool.value.defaults.color,
2338
+ strokeColor: activeTool.value.defaults.strokeColor,
1793
2339
  opacity: activeTool.value.defaults.opacity,
1794
2340
  segmentRects: rects.value,
1795
2341
  scale: __props.scale
1796
- }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : createCommentVNode("", true)
2342
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : createCommentVNode("", true)
1797
2343
  ], 4)) : createCommentVNode("", true);
1798
2344
  };
1799
2345
  }
@@ -1819,7 +2365,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1819
2365
  return openBlock(), createElementBlock("div", {
1820
2366
  style: normalizeStyle(style.value)
1821
2367
  }, [
1822
- __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({
1823
2369
  key: 0,
1824
2370
  isSelected: false,
1825
2371
  scale: __props.scale
@@ -1835,11 +2381,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1835
2381
  key: 3,
1836
2382
  isSelected: false,
1837
2383
  scale: __props.scale
1838
- }, __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({
1839
2385
  key: 4,
1840
2386
  isSelected: false,
1841
2387
  scale: __props.scale
1842
- }, __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({
1843
2389
  key: 5,
1844
2390
  isSelected: false,
1845
2391
  scale: __props.scale
@@ -1967,7 +2513,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1967
2513
  resizeUI: {},
1968
2514
  vertexUI: {},
1969
2515
  selectionOutlineColor: {},
1970
- selectionMenu: { type: Function }
2516
+ selectionMenu: { type: Function },
2517
+ groupSelectionMenu: { type: Function }
1971
2518
  },
1972
2519
  setup(__props) {
1973
2520
  const props = __props;
@@ -2006,11 +2553,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2006
2553
  resizeUI: __props.resizeUI,
2007
2554
  vertexUI: __props.vertexUI,
2008
2555
  selectionOutlineColor: __props.selectionOutlineColor,
2009
- selectionMenu: __props.selectionMenu
2556
+ selectionMenu: __props.selectionMenu,
2557
+ groupSelectionMenu: __props.groupSelectionMenu
2010
2558
  }, {
2011
2559
  "selection-menu": withCtx((slotProps) => [
2012
2560
  renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(slotProps)))
2013
2561
  ]),
2562
+ "group-selection-menu": withCtx((slotProps) => [
2563
+ renderSlot(_ctx.$slots, "group-selection-menu", normalizeProps(guardReactiveProps(slotProps)))
2564
+ ]),
2014
2565
  "resize-handle": withCtx((slotProps) => [
2015
2566
  renderSlot(_ctx.$slots, "resize-handle", normalizeProps(guardReactiveProps(slotProps)))
2016
2567
  ]),
@@ -2018,7 +2569,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2018
2569
  renderSlot(_ctx.$slots, "vertex-handle", normalizeProps(guardReactiveProps(slotProps)))
2019
2570
  ]),
2020
2571
  _: 3
2021
- }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu"]),
2572
+ }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu", "groupSelectionMenu"]),
2022
2573
  createVNode(_sfc_main$3, {
2023
2574
  documentId: __props.documentId,
2024
2575
  pageIndex: __props.pageIndex,
@@ -2034,15 +2585,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2034
2585
  }
2035
2586
  });
2036
2587
  export {
2037
- _sfc_main$i as AnnotationContainer,
2588
+ _sfc_main$k as AnnotationContainer,
2038
2589
  _sfc_main as AnnotationLayer,
2039
2590
  _sfc_main$1 as AnnotationPaintLayer,
2040
2591
  _sfc_main$4 as Annotations,
2041
- _sfc_main$h as Circle,
2042
- _sfc_main$g as FreeText,
2592
+ _sfc_main$i as Circle,
2593
+ _sfc_main$h as FreeText,
2594
+ _sfc_main$j as GroupSelectionBox,
2043
2595
  _sfc_main$8 as Highlight,
2044
- _sfc_main$f as Ink,
2045
- _sfc_main$e as Line,
2596
+ _sfc_main$g as Ink,
2597
+ _sfc_main$f as Line,
2598
+ _sfc_main$e as Link,
2046
2599
  _sfc_main$d as Polygon,
2047
2600
  _sfc_main$c as Polyline,
2048
2601
  _sfc_main$2 as PreviewRenderer,