@embedpdf/plugin-annotation 2.5.0 → 2.6.1

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 (71) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1061 -430
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/annotation-plugin.d.ts +24 -6
  6. package/dist/lib/geometry/index.d.ts +1 -0
  7. package/dist/lib/geometry/rotation.d.ts +32 -0
  8. package/dist/lib/handlers/types.d.ts +3 -1
  9. package/dist/lib/index.d.ts +1 -0
  10. package/dist/lib/patching/base-patch.d.ts +87 -0
  11. package/dist/lib/patching/index.d.ts +1 -0
  12. package/dist/lib/patching/insert-upright.d.ts +20 -0
  13. package/dist/lib/patching/patch-registry.d.ts +14 -1
  14. package/dist/lib/patching/patch-utils.d.ts +54 -1
  15. package/dist/lib/patching/patches/circle.patch.d.ts +3 -0
  16. package/dist/lib/patching/patches/freetext.patch.d.ts +3 -0
  17. package/dist/lib/patching/patches/index.d.ts +4 -0
  18. package/dist/lib/patching/patches/square.patch.d.ts +3 -0
  19. package/dist/lib/patching/patches/stamp.patch.d.ts +3 -0
  20. package/dist/lib/tools/default-tools.d.ts +32 -0
  21. package/dist/lib/tools/types.d.ts +20 -1
  22. package/dist/lib/types.d.ts +67 -3
  23. package/dist/preact/adapter.d.ts +3 -0
  24. package/dist/preact/index.cjs +1 -1
  25. package/dist/preact/index.cjs.map +1 -1
  26. package/dist/preact/index.js +793 -126
  27. package/dist/preact/index.js.map +1 -1
  28. package/dist/react/adapter.d.ts +2 -1
  29. package/dist/react/index.cjs +1 -1
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.js +793 -126
  32. package/dist/react/index.js.map +1 -1
  33. package/dist/shared/components/annotation-container.d.ts +10 -2
  34. package/dist/shared/components/annotation-layer.d.ts +9 -3
  35. package/dist/shared/components/annotations.d.ts +4 -1
  36. package/dist/shared/components/group-selection-box.d.ts +12 -4
  37. package/dist/shared/components/render-annotation.d.ts +2 -1
  38. package/dist/shared/components/types.d.ts +51 -1
  39. package/dist/shared-preact/components/annotation-container.d.ts +10 -2
  40. package/dist/shared-preact/components/annotation-layer.d.ts +9 -3
  41. package/dist/shared-preact/components/annotations.d.ts +4 -1
  42. package/dist/shared-preact/components/group-selection-box.d.ts +12 -4
  43. package/dist/shared-preact/components/render-annotation.d.ts +2 -1
  44. package/dist/shared-preact/components/types.d.ts +51 -1
  45. package/dist/shared-react/components/annotation-container.d.ts +10 -2
  46. package/dist/shared-react/components/annotation-layer.d.ts +9 -3
  47. package/dist/shared-react/components/annotations.d.ts +4 -1
  48. package/dist/shared-react/components/group-selection-box.d.ts +12 -4
  49. package/dist/shared-react/components/render-annotation.d.ts +2 -1
  50. package/dist/shared-react/components/types.d.ts +51 -1
  51. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +8 -2
  52. package/dist/svelte/components/Annotations.svelte.d.ts +7 -1
  53. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +11 -3
  54. package/dist/svelte/components/RenderAnnotation.svelte.d.ts +1 -0
  55. package/dist/svelte/components/types.d.ts +14 -1
  56. package/dist/svelte/index.cjs +1 -1
  57. package/dist/svelte/index.cjs.map +1 -1
  58. package/dist/svelte/index.js +1166 -330
  59. package/dist/svelte/index.js.map +1 -1
  60. package/dist/svelte/types.d.ts +53 -0
  61. package/dist/vue/components/annotation-container.vue.d.ts +35 -9
  62. package/dist/vue/components/annotation-layer.vue.d.ts +29 -5
  63. package/dist/vue/components/annotations.vue.d.ts +278 -134
  64. package/dist/vue/components/group-selection-box.vue.d.ts +35 -10
  65. package/dist/vue/components/render-annotation.vue.d.ts +2 -0
  66. package/dist/vue/index.cjs +1 -1
  67. package/dist/vue/index.cjs.map +1 -1
  68. package/dist/vue/index.js +945 -161
  69. package/dist/vue/index.js.map +1 -1
  70. package/dist/vue/types.d.ts +52 -0
  71. package/package.json +11 -10
@@ -1,6 +1,7 @@
1
+ import { CSSProperties } from 'vue';
1
2
  import { SelectionMenuPlacement } from '@embedpdf/utils/vue';
2
3
  import { TrackedAnnotation } from '../../lib';
3
- import { GroupSelectionContext, GroupSelectionMenuRenderFn, ResizeHandleUI } from '../types';
4
+ import { GroupSelectionContext, GroupSelectionMenuRenderFn, ResizeHandleUI, RotationHandleUI, SelectionOutline } from '../types';
4
5
  type __VLS_Props = {
5
6
  documentId: string;
6
7
  pageIndex: number;
@@ -14,26 +15,46 @@ type __VLS_Props = {
14
15
  isDraggable: boolean;
15
16
  /** Whether the group is resizable (all annotations must be group-resizable) */
16
17
  isResizable: boolean;
18
+ /** Whether the group can be rotated */
19
+ isRotatable?: boolean;
20
+ /** Whether to lock aspect ratio during group resize */
21
+ lockAspectRatio?: boolean;
17
22
  /** Resize handle UI customization */
18
- resizeUI?: ResizeHandleUI;
19
- /** Selection outline color */
23
+ resizeUi?: ResizeHandleUI;
24
+ /** Rotation handle UI customization */
25
+ rotationUi?: RotationHandleUI;
26
+ /** @deprecated Use `selectionOutline.color` instead */
20
27
  selectionOutlineColor?: string;
21
- /** Outline offset */
28
+ /** @deprecated Use `selectionOutline.offset` instead */
22
29
  outlineOffset?: number;
30
+ /** Customize the selection outline (color, style, width, offset) */
31
+ selectionOutline?: SelectionOutline;
23
32
  /** Z-index for the group box */
24
33
  zIndex?: number;
25
34
  /** Group selection menu render function */
26
35
  groupSelectionMenu?: GroupSelectionMenuRenderFn;
27
36
  };
28
37
  declare var __VLS_1: {
38
+ [key: string]: any;
39
+ key?: string | number;
40
+ style: CSSProperties;
41
+ backgroundColor: string;
42
+ iconColor: string;
43
+ connectorStyle: CSSProperties;
44
+ showConnector: boolean;
45
+ opacity: number;
46
+ border: import('..').RotationHandleBorder;
47
+ } | {
48
+ [x: string]: never;
49
+ }, __VLS_3: {
29
50
  backgroundColor: string;
30
51
  onPointerdown: (e: PointerEvent) => void;
31
52
  onPointermove: (e: PointerEvent) => void;
32
53
  onPointerup: (e: PointerEvent) => void;
33
54
  onPointercancel: (e: PointerEvent) => void;
34
- key: string | number;
35
- style: import('vue').CSSProperties;
36
- }, __VLS_15: {
55
+ key: string | number | undefined;
56
+ style: CSSProperties;
57
+ }, __VLS_17: {
37
58
  context: GroupSelectionContext;
38
59
  selected: boolean;
39
60
  rect: {
@@ -48,17 +69,21 @@ declare var __VLS_1: {
48
69
  };
49
70
  placement: SelectionMenuPlacement;
50
71
  menuWrapperProps: {
51
- style: import('vue').CSSProperties;
72
+ style: CSSProperties;
52
73
  onPointerdown: (e: PointerEvent) => void;
53
74
  onTouchstart: (e: TouchEvent) => void;
54
75
  };
55
76
  };
56
77
  type __VLS_Slots = {} & {
57
- 'resize-handle'?: (props: typeof __VLS_1) => any;
78
+ 'rotation-handle'?: (props: typeof __VLS_1) => any;
79
+ } & {
80
+ 'resize-handle'?: (props: typeof __VLS_3) => any;
58
81
  } & {
59
- 'group-selection-menu'?: (props: typeof __VLS_15) => any;
82
+ 'group-selection-menu'?: (props: typeof __VLS_17) => any;
60
83
  };
61
84
  declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
85
+ isRotatable: boolean;
86
+ lockAspectRatio: boolean;
62
87
  outlineOffset: number;
63
88
  zIndex: number;
64
89
  selectionOutlineColor: string;
@@ -5,10 +5,12 @@ type __VLS_Props = {
5
5
  pageIndex: number;
6
6
  annotation: PdfAnnotationObject;
7
7
  scaleFactor?: number;
8
+ unrotated?: boolean;
8
9
  style?: CSSProperties;
9
10
  };
10
11
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
12
  scaleFactor: number;
13
+ unrotated: boolean;
12
14
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
15
  declare const _default: typeof __VLS_export;
14
16
  export default _default;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-annotation"),o=require("vue"),n=require("@embedpdf/utils/vue"),l=require("@embedpdf/core/vue"),r=require("@embedpdf/models"),i=require("@embedpdf/plugin-interaction-manager/vue"),a=require("@embedpdf/plugin-selection/vue"),s=()=>l.usePlugin(t.AnnotationPlugin.id),c=()=>l.useCapability(t.AnnotationPlugin.id),d={"data-no-interaction":"",style:{display:"contents"}},u=o.defineComponent({inheritAttrs:!1,__name:"annotation-container",props:{scale:{},documentId:{},pageIndex:{},rotation:{},pageWidth:{},pageHeight:{},trackedAnnotation:{},isSelected:{type:Boolean},isMultiSelected:{type:Boolean,default:!1},isDraggable:{type:Boolean},isResizable:{type:Boolean},lockAspectRatio:{type:Boolean,default:!1},vertexConfig:{},selectionMenu:{},outlineOffset:{default:1},onDoubleClick:{},onSelect:{},zIndex:{default:1},selectionOutlineColor:{default:"#007ACC"},style:{}},setup(e){const t=e,r="#007ACC",i="#007ACC",a=o.shallowRef(o.toRaw(t.trackedAnnotation.object)),{provides:u}=c(),{plugin:p}=s(),v=l.useDocumentPermissions(t.documentId),g=o.ref(null),m=o.shallowRef(null),k=o.computed(()=>v.value.canModifyAnnotations&&t.isDraggable&&!t.isMultiSelected),f=o.computed(()=>v.value.canModifyAnnotations&&t.isResizable&&!t.isMultiSelected),h=t.onDoubleClick?e=>{var o;v.value.canModifyAnnotations&&(null==(o=t.onDoubleClick)||o.call(t,e))}:void 0,y=o.computed(()=>u.value?u.value.forDocument(t.documentId):null),x=o.computed(()=>({...o.toRaw(t.trackedAnnotation.object),...o.toRaw(a.value)})),C=o.computed(()=>t.isSelected&&!t.isMultiSelected),S=o.computed(()=>t.isSelected&&!t.isMultiSelected&&(t.selectionMenu||j["selection-menu"])),b=o.computed(()=>({origin:{x:x.value.rect.origin.x*t.scale,y:x.value.rect.origin.y*t.scale},size:{width:x.value.rect.size.width*t.scale,height:x.value.rect.size.height*t.scale}})),w=o.computed(()=>({type:"annotation",annotation:t.trackedAnnotation,pageIndex:t.pageIndex})),B=o.computed(()=>({suggestTop:!1,spaceAbove:0,spaceBelow:0})),z=(e,o)=>t.selectionMenu?t.selectionMenu({rect:e,menuWrapperProps:o,selected:t.isSelected,placement:B.value,context:w.value}):null,I=o.computed(()=>o.toRaw(x.value).rect),P=o.computed(()=>{var e;const n=o.toRaw(x.value);return(null==(e=t.vertexConfig)?void 0:e.extractVertices(n))??[]}),R=o.computed(()=>({minWidth:10,minHeight:10,boundingBox:{width:t.pageWidth,height:t.pageHeight}})),{dragProps:A,vertices:M,resize:E}=n.useInteractionHandles({controller:{element:I,vertices:P,constraints:R,maintainAspectRatio:o.computed(()=>t.lockAspectRatio),pageRotation:o.computed(()=>t.rotation),scale:o.computed(()=>t.scale),enabled:o.computed(()=>t.isSelected&&!t.isMultiSelected),onUpdate:e=>{var n,l,r;if(!(null==(n=e.transformData)?void 0:n.type)||t.isMultiSelected)return;const i=p.value;if(!i)return;const{type:s,changes:c,metadata:d}=e.transformData,v=t.trackedAnnotation.object.id,k={width:t.pageWidth,height:t.pageHeight};if("start"===e.state&&(m.value=t.trackedAnnotation.object.rect,g.value=x.value,"move"===s?i.startDrag(t.documentId,{annotationIds:[v],pageSize:k}):"resize"===s&&i.startResize(t.documentId,{annotationIds:[v],pageSize:k,resizeHandle:(null==d?void 0:d.handle)??"se"})),c.rect&&m.value)if("move"===s){const e={x:c.rect.origin.x-m.value.origin.x,y:c.rect.origin.y-m.value.origin.y};i.updateDrag(t.documentId,e)}else"resize"===s&&i.updateResize(t.documentId,c.rect);if("vertex-edit"===s&&c.vertices&&t.vertexConfig){const n=g.value??x.value,i=t.vertexConfig.transformAnnotation(o.toRaw(n),c.vertices),p=null==(l=u.value)?void 0:l.transformAnnotation(n,{type:s,changes:i,metadata:d});p&&(a.value={...o.toRaw(a.value),...p},"end"===e.state&&(null==(r=y.value)||r.updateAnnotation(t.pageIndex,v,p)))}"end"===e.state&&(m.value=null,g.value=null,"move"===s?i.commitDrag(t.documentId):"resize"===s&&i.commitResize(t.documentId))}},resizeUI:{handleSize:12,spacing:t.outlineOffset,offsetMode:"outside",includeSides:!t.lockAspectRatio,zIndex:t.zIndex+1},vertexUI:{vertexSize:12,zIndex:t.zIndex+2},includeVertices:!!t.vertexConfig}),_=n.useDoublePressProps(h);o.watchEffect(()=>{t.trackedAnnotation.object&&(a.value=t.trackedAnnotation.object)}),o.watchEffect(e=>{const n=p.value;if(!n)return;const l=t.trackedAnnotation.object.id,r=e=>{var n;if(e.documentId!==t.documentId)return;const r=null==(n=e.previewPatches)?void 0:n[l];"update"===e.type&&r?a.value={...o.toRaw(a.value),...r}:"cancel"===e.type&&(a.value=t.trackedAnnotation.object)},i=[n.onDragChange(r),n.onResizeChange(r)];e(()=>i.forEach(e=>e()))});const D=o.computed(()=>({position:"absolute",left:x.value.rect.origin.x*t.scale+"px",top:x.value.rect.origin.y*t.scale+"px",width:x.value.rect.size.width*t.scale+"px",height:x.value.rect.size.height*t.scale+"px",outline:C.value?`1px solid ${t.selectionOutlineColor}`:"none",outlineOffset:C.value?`${t.outlineOffset}px`:"0px",pointerEvents:t.isSelected&&!t.isMultiSelected?"auto":"none",touchAction:"none",cursor:t.isSelected&&k.value?"move":"default",zIndex:t.zIndex})),$=o.computed(()=>({...D.value,...t.style??{}})),j=o.useSlots();return(t,l)=>(o.openBlock(),o.createElementBlock("div",d,[o.createElementVNode("div",o.mergeProps({...k.value&&e.isSelected?o.unref(A):{},...o.unref(_)},{style:$.value}),[o.renderSlot(t.$slots,"default",{annotation:x.value}),e.isSelected&&f.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(E),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(j)["resize-handle"]?o.renderSlot(t.$slots,"resize-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:r}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:r}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:r}]}),null,16))],64))),128)):o.createCommentVNode("",!0),e.isSelected&&o.unref(v).canModifyAnnotations&&!e.isMultiSelected&&o.unref(M).length>0?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(o.unref(M),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(j)["vertex-handle"]?o.renderSlot(t.$slots,"vertex-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:i}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:i}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:i}]}),null,16))],64))),128)):o.createCommentVNode("",!0)],16),S.value?(o.openBlock(),o.createBlock(o.unref(n.CounterRotate),{key:0,rect:b.value,rotation:e.rotation},{default:o.withCtx(({rect:n,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(z(n,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:w.value,selected:e.isSelected,rect:n,placement:B.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):o.createCommentVNode("",!0)]))}}),p={key:0,"data-group-selection-box":"","data-no-interaction":""},v=o.defineComponent({__name:"group-selection-box",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},selectedAnnotations:{},isDraggable:{type:Boolean},isResizable:{type:Boolean},resizeUI:{},selectionOutlineColor:{default:"#007ACC"},outlineOffset:{default:2},zIndex:{default:100},groupSelectionMenu:{}},setup(e){const t=e,i=o.useSlots(),{plugin:a}=s(),c=l.useDocumentPermissions(()=>t.documentId),d=o.shallowRef(null),u=o.ref(!1),v=o.ref(!1),g=o.computed(()=>c.value.canModifyAnnotations&&t.isDraggable),m=o.computed(()=>c.value.canModifyAnnotations&&t.isResizable),k=o.computed(()=>{var e;return(null==(e=t.resizeUI)?void 0:e.color)??"#007ACC"}),f=o.computed(()=>{var e;return(null==(e=t.resizeUI)?void 0:e.size)??12}),h=o.computed(()=>{const e=t.selectedAnnotations.map(e=>e.object.rect);return r.boundingRectOrEmpty(e)}),y=o.shallowRef(h.value);o.watch(()=>h.value,e=>{u.value||v.value||(y.value=e)},{immediate:!0});const x=o.computed(()=>({position:"absolute",left:y.value.origin.x*t.scale+"px",top:y.value.origin.y*t.scale+"px",width:y.value.size.width*t.scale+"px",height:y.value.size.height*t.scale+"px",outline:`2px dashed ${t.selectionOutlineColor}`,outlineOffset:t.outlineOffset-1+"px",cursor:g.value?"move":"default",touchAction:"none",zIndex:t.zIndex})),C=o.computed(()=>({origin:{x:y.value.origin.x*t.scale,y:y.value.origin.y*t.scale},size:{width:y.value.size.width*t.scale,height:y.value.size.height*t.scale}})),S=o.computed(()=>({type:"group",annotations:t.selectedAnnotations,pageIndex:t.pageIndex})),b=o.computed(()=>({suggestTop:!1})),w=o.computed(()=>t.groupSelectionMenu||i["group-selection-menu"]),B=(e,o)=>t.groupSelectionMenu?t.groupSelectionMenu({rect:e,menuWrapperProps:o,selected:!0,placement:b.value,context:S.value}):null,z=o.computed(()=>y.value),I=o.computed(()=>({minWidth:20,minHeight:20,boundingBox:{width:t.pageWidth,height:t.pageHeight}})),{dragProps:P,resize:R}=n.useInteractionHandles({controller:{element:z,vertices:o.computed(()=>[]),constraints:I,maintainAspectRatio:o.computed(()=>!1),pageRotation:o.computed(()=>t.rotation),scale:o.computed(()=>t.scale),enabled:o.computed(()=>!0),onUpdate:e=>{var o,n;if(!(null==(o=e.transformData)?void 0:o.type))return;if(!a.value)return;const l=a.value,r=e.transformData.type,i="move"===r,s="resize"===r;if(i&&!g.value)return;"start"===e.state&&(d.value=h.value,i?(u.value=!0,l.startDrag(t.documentId,{annotationIds:t.selectedAnnotations.map(e=>e.object.id),pageSize:{width:t.pageWidth,height:t.pageHeight}})):s&&(v.value=!0,l.startResize(t.documentId,{annotationIds:t.selectedAnnotations.map(e=>e.object.id),pageSize:{width:t.pageWidth,height:t.pageHeight},resizeHandle:(null==(n=e.transformData.metadata)?void 0:n.handle)??"se"})));const c=d.value??h.value;if(i&&e.transformData.changes.rect){const o=e.transformData.changes.rect,n={x:o.origin.x-c.origin.x,y:o.origin.y-c.origin.y},r=l.updateDrag(t.documentId,n);y.value={...c,origin:{x:c.origin.x+r.x,y:c.origin.y+r.y}}}else if(s&&e.transformData.changes.rect){const o=e.transformData.changes.rect;l.updateResize(t.documentId,o),y.value=o}"end"===e.state&&(d.value=null,i&&u.value?(u.value=!1,l.commitDrag(t.documentId)):s&&v.value&&(v.value=!1,l.commitResize(t.documentId)))}},resizeUI:{handleSize:f.value,spacing:t.outlineOffset,offsetMode:"outside",includeSides:!0,zIndex:t.zIndex+1},vertexUI:{vertexSize:0,zIndex:t.zIndex},includeVertices:!1});return(t,l)=>e.selectedAnnotations.length>=2?(o.openBlock(),o.createElementBlock("div",p,[o.createElementVNode("div",o.mergeProps(g.value?o.unref(P):{},{style:x.value,onPointerdown:l[0]||(l[0]=e=>g.value?void 0:e.stopPropagation())}),[m.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(R),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(i)["resize-handle"]?o.renderSlot(t.$slots,"resize-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:k.value}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:k.value}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:k.value}]}),null,16))],64))),128)):o.createCommentVNode("",!0)],16),w.value?(o.openBlock(),o.createBlock(o.unref(n.CounterRotate),{key:0,rect:C.value,rotation:e.rotation},{default:o.withCtx(({rect:n,menuWrapperProps:l})=>[e.groupSelectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(B(n,l)),{key:0})):o.renderSlot(t.$slots,"group-selection-menu",{key:1,context:S.value,selected:!0,rect:n,placement:b.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0)}}),g=["width","height","viewBox"],m=["cx","cy","rx","ry","fill","opacity"],k=o.defineComponent({__name:"circle",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>{const e=t.rect.size.width,o=t.rect.size.height,n=Math.max(e-t.strokeWidth,0),l=Math.max(o-t.strokeWidth,0);return{width:e,height:o,cx:t.strokeWidth/2+n/2,cy:t.strokeWidth/2+l/2,rx:n/2,ry:l/2}}),l=o.computed(()=>n.value.width*t.scale),i=o.computed(()=>n.value.height*t.scale);return(t,a)=>{var s;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:l.value,height:i.value,pointerEvents:"none",zIndex:2}),width:l.value,height:i.value,viewBox:`0 0 ${n.value.width} ${n.value.height}`},[o.createElementVNode("ellipse",{cx:n.value.cx,cy:n.value.cy,rx:n.value.rx,ry:n.value.ry,fill:e.color,opacity:e.opacity,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(s=e.strokeDashArray)?void 0:s.join(",")}})},null,44,m)],12,g)}}}),f=["contenteditable"],h=o.defineComponent({__name:"free-text",props:{isSelected:{type:Boolean},isEditing:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(null),{provides:l}=c(),i=o.ref(!1);o.onMounted(()=>{try{const e=navigator;i.value=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1}catch{i.value=!1}}),o.watch(()=>t.isEditing,e=>{if(e&&n.value){const e=n.value;e.focus();const t=window.getSelection();if(t){const o=document.createRange();o.selectNodeContents(e),o.collapse(!1),t.removeAllRanges(),t.addRange(o)}}});const a=()=>{l.value&&n.value&&l.value.updateAnnotation(t.pageIndex,t.annotation.object.id,{contents:n.value.innerText})},s=o.computed(()=>{const{object:e}=t.annotation,o=e.fontSize*t.scale,n=i.value&&t.isEditing&&o>0&&o<16,l=n?16:o,a=n?o/16:1,s=n?100/a:100;return{color:e.fontColor,fontSize:`${l}px`,fontFamily:r.standardFontCss(e.fontFamily),textAlign:r.textAlignmentToCss(e.textAlign),flexDirection:"column",justifyContent:e.verticalAlign===r.PdfVerticalAlignment.Top?"flex-start":e.verticalAlign===r.PdfVerticalAlignment.Middle?"center":"flex-end",display:"flex",backgroundColor:e.color??e.backgroundColor,opacity:e.opacity,width:n?`${s}%`:"100%",height:n?`${s}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:t.isEditing?"text":"pointer",outline:"none",transform:n?`scale(${a})`:void 0,transformOrigin:"top left"}});return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle({position:"absolute",width:e.annotation.object.rect.size.width*e.scale+"px",height:e.annotation.object.rect.size.height*e.scale+"px",cursor:e.isSelected&&!e.isEditing?"move":"default",pointerEvents:e.isSelected&&!e.isEditing?"none":"auto",zIndex:2}),onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t))},[o.createElementVNode("span",{ref_key:"editorRef",ref:n,onBlur:a,tabindex:"0",style:o.normalizeStyle(s.value),contenteditable:e.isEditing},o.toDisplayString(e.annotation.object.contents),45,f)],36))}}),y=["width","height","viewBox"],x=["d","opacity"],C=o.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},strokeColor:{},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#000000"),l=o.computed(()=>t.inkList.map(({points:e})=>{let o="";return e.forEach(({x:e,y:n},l)=>{const r=e-t.rect.origin.x,i=n-t.rect.origin.y;o+=(0===l?"M":"L")+`${r} ${i} `}),o.trim()})),r=o.computed(()=>t.rect.size.width*t.scale),i=o.computed(()=>t.rect.size.height*t.scale);return(t,a)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${r.value}px`,height:`${i.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:r.value,height:i.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(t,l)=>(o.openBlock(),o.createElementBlock("path",{key:l,d:t,fill:"none",opacity:e.opacity,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",stroke:n.value,strokeWidth:e.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,x))),128))],12,y))}}),S=["width","height","viewBox"],b=["x1","y1","x2","y2","opacity"],w=["d","transform","stroke","fill"],B=["d","transform","stroke","fill"],z=o.defineComponent({__name:"line",props:{color:{default:"transparent"},opacity:{default:1},strokeWidth:{},strokeColor:{default:"#000000"},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},linePoints:{},lineEndings:{},scale:{},onClick:{},isSelected:{type:Boolean}},setup(e){const n=e,l=o.computed(()=>({x1:n.linePoints.start.x-n.rect.origin.x,y1:n.linePoints.start.y-n.rect.origin.y,x2:n.linePoints.end.x-n.rect.origin.x,y2:n.linePoints.end.y-n.rect.origin.y})),i=o.computed(()=>{var e,o;const{x1:r,y1:i,x2:a,y2:s}=l.value,c=Math.atan2(s-i,a-r);return{start:t.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,c+Math.PI,r,i),end:t.patching.createEnding(null==(o=n.lineEndings)?void 0:o.end,n.strokeWidth,c,a,s)}}),a=e=>{var t;return{cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,strokeLinecap:"butt",pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",...n.strokeStyle===r.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},s=o.computed(()=>n.rect.size.width*n.scale),c=o.computed(()=>n.rect.size.height*n.scale);return(t,n)=>{var d;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("line",{x1:l.value.x1,y1:l.value.y1,x2:l.value.x2,y2:l.value.y2,opacity:e.opacity,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",stroke:e.strokeColor,strokeWidth:e.strokeWidth,strokeLinecap:"butt",...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=e.strokeDashArray)?void 0:d.join(",")}})},null,44,b),i.value.start?(o.openBlock(),o.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,onPointerdown:n[2]||(n[2]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[3]||(n[3]=(...t)=>e.onClick&&e.onClick(...t)),stroke:e.strokeColor,style:o.normalizeStyle(a(i.value.start)),fill:i.value.start.filled?e.color:"none"},null,44,w)):o.createCommentVNode("",!0),i.value.end?(o.openBlock(),o.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,onPointerdown:n[4]||(n[4]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[5]||(n[5]=(...t)=>e.onClick&&e.onClick(...t)),stroke:e.strokeColor,style:o.normalizeStyle(a(i.value.end)),fill:i.value.end.filled?e.color:"none"},null,44,B)):o.createCommentVNode("",!0)],12,S)}}}),I=["width","height","viewBox"],P=["width","height"],R=["y1","x2","y2","stroke","stroke-width","stroke-dasharray"],A=["x","y","width","height","stroke","stroke-width","stroke-dasharray"],M=o.defineComponent({__name:"link",props:{isSelected:{type:Boolean},strokeColor:{default:"#0000FF"},strokeWidth:{default:2},strokeStyle:{default:r.PdfAnnotationBorderStyle.UNDERLINE},strokeDashArray:{},rect:{},scale:{},onClick:{},hasIRT:{type:Boolean,default:!1}},setup(e){const t=e,n=o.computed(()=>t.rect.size.width),l=o.computed(()=>t.rect.size.height),i=o.computed(()=>n.value*t.scale),a=o.computed(()=>l.value*t.scale),s=o.computed(()=>{var e;if(t.strokeStyle===r.PdfAnnotationBorderStyle.DASHED)return(null==(e=t.strokeDashArray)?void 0:e.join(","))??`${3*t.strokeWidth},${t.strokeWidth}`}),c=o.computed(()=>t.strokeStyle===r.PdfAnnotationBorderStyle.UNDERLINE),d=o.computed(()=>t.hasIRT?"default":t.isSelected?"move":"pointer"),u=o.computed(()=>t.hasIRT||t.isSelected?"none":"visible");return(t,r)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${i.value}px`,height:`${a.value}px`,pointerEvents:"none",zIndex:2}),width:i.value,height:a.value,viewBox:`0 0 ${n.value} ${l.value}`},[o.createElementVNode("rect",{x:0,y:0,width:n.value,height:l.value,fill:"transparent",onPointerdown:r[0]||(r[0]=t=>e.hasIRT?void 0:e.onClick),onTouchstart:r[1]||(r[1]=t=>e.hasIRT?void 0:e.onClick),style:o.normalizeStyle({cursor:d.value,pointerEvents:u.value})},null,44,P),c.value?(o.openBlock(),o.createElementBlock("line",{key:0,x1:1,y1:l.value-1,x2:n.value-1,y2:l.value-1,stroke:e.strokeColor,"stroke-width":e.strokeWidth,"stroke-dasharray":s.value,style:{"pointer-events":"none"}},null,8,R)):(o.openBlock(),o.createElementBlock("rect",{key:1,x:e.strokeWidth/2,y:e.strokeWidth/2,width:Math.max(n.value-e.strokeWidth,0),height:Math.max(l.value-e.strokeWidth,0),fill:"transparent",stroke:e.strokeColor,"stroke-width":e.strokeWidth,"stroke-dasharray":s.value,style:{"pointer-events":"none"}},null,8,A))],12,I))}}),E=["width","height","viewBox"],_=["d","opacity"],D=["d"],$=["x","y","width","height","fill","stroke","stroke-width"],j=o.defineComponent({__name:"polygon",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},scale:{},isSelected:{type:Boolean},onClick:{},currentVertex:{},handleSize:{default:14}},setup(e){const t=e,n=o.computed(()=>t.currentVertex?[...t.vertices,t.currentVertex]:t.vertices),l=o.computed(()=>n.value.map(({x:e,y:o})=>({x:e-t.rect.origin.x,y:o-t.rect.origin.y}))),i=o.computed(()=>{if(!l.value.length)return"";const[e,...o]=l.value,n=!!t.currentVertex;return(`M ${e.x} ${e.y} `+o.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()}),a=o.computed(()=>t.currentVertex&&t.vertices.length>0),s=o.computed(()=>t.rect.size.width*t.scale),c=o.computed(()=>t.rect.size.height*t.scale);return(t,n)=>{var d;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("path",{d:i.value,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),opacity:e.opacity,style:o.normalizeStyle({fill:e.currentVertex?"none":e.color,stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=e.strokeDashArray)?void 0:d.join(",")}})},null,44,_),a.value&&l.value.length>1?(o.openBlock(),o.createElementBlock("path",{key:0,d:`M ${l.value[l.value.length-1].x} ${l.value[l.value.length-1].y} L ${l.value[0].x} ${l.value[0].y}`,fill:"none",style:o.normalizeStyle({stroke:e.strokeColor,strokeWidth:e.strokeWidth,strokeDasharray:"4,4",opacity:.7})},null,12,D)):o.createCommentVNode("",!0),a.value&&l.value.length>=2?(o.openBlock(),o.createElementBlock("rect",{key:1,x:l.value[0].x-e.handleSize/e.scale/2,y:l.value[0].y-e.handleSize/e.scale/2,width:e.handleSize/e.scale,height:e.handleSize/e.scale,fill:e.strokeColor,opacity:.4,stroke:e.strokeColor,"stroke-width":e.strokeWidth/2},null,8,$)):o.createCommentVNode("",!0)],12,E)}}}),N=["width","height","viewBox"],W=["d","opacity"],T=["d","transform","stroke","fill"],V=["d","transform","stroke","fill"],L=o.defineComponent({__name:"polyline",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},scale:{},isSelected:{type:Boolean},onClick:{},lineEndings:{}},setup(e){const n=e,l=o.computed(()=>n.vertices.map(({x:e,y:t})=>({x:e-n.rect.origin.x,y:t-n.rect.origin.y}))),r=o.computed(()=>{if(0===l.value.length)return"";const[e,...t]=l.value;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("")).trim()}),i=o.computed(()=>{var e,o;if(l.value.length<2)return{start:null,end:null};const r=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),i=r(l.value[0],l.value[1]),a=r(l.value[l.value.length-2],l.value[l.value.length-1]);return{start:t.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,i+Math.PI,l.value[0].x,l.value[0].y),end:t.patching.createEnding(null==(o=n.lineEndings)?void 0:o.end,n.strokeWidth,a,l.value[l.value.length-1].x,l.value[l.value.length-1].y)}}),a=e=>({cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",strokeLinecap:"butt"}),s=o.computed(()=>n.rect.size.width*n.scale),c=o.computed(()=>n.rect.size.height*n.scale);return(t,n)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${s.value}px`,height:`${c.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:s.value,height:c.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("path",{d:r.value,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),opacity:e.opacity,style:o.normalizeStyle({fill:"none",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"})},null,44,W),i.value.start?(o.openBlock(),o.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,stroke:e.strokeColor,fill:i.value.start.filled?e.color:"none",onPointerdown:n[2]||(n[2]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[3]||(n[3]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(a(i.value.start))},null,44,T)):o.createCommentVNode("",!0),i.value.end?(o.openBlock(),o.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,stroke:e.strokeColor,fill:i.value.end.filled?e.color:"none",onPointerdown:n[4]||(n[4]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[5]||(n[5]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(a(i.value.end))},null,44,V)):o.createCommentVNode("",!0)],12,N))}}),F=["width","height","viewBox"],U=["x","y","width","height","fill","opacity"],O=o.defineComponent({__name:"square",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:r.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>{const e=t.rect.size.width,o=t.rect.size.height;return{width:Math.max(e-t.strokeWidth,0),height:Math.max(o-t.strokeWidth,0),x:t.strokeWidth/2,y:t.strokeWidth/2}}),l=o.computed(()=>(n.value.width+t.strokeWidth)*t.scale),i=o.computed(()=>(n.value.height+t.strokeWidth)*t.scale);return(t,a)=>{var s;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:l.value,height:i.value,pointerEvents:"none",zIndex:2}),width:l.value,height:i.value,viewBox:`0 0 ${n.value.width+e.strokeWidth} ${n.value.height+e.strokeWidth}`},[o.createElementVNode("rect",{x:n.value.x,y:n.value.y,width:n.value.width,height:n.value.height,fill:e.color,opacity:e.opacity,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,...e.strokeStyle===o.unref(r.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(s=e.strokeDashArray)?void 0:s.join(",")}})},null,44,U)],12,F)}}}),H=["src"],q=o.defineComponent({__name:"render-annotation",props:{documentId:{},pageIndex:{},annotation:{},scaleFactor:{default:1},style:{}},setup(e){const t=e,{provides:l}=c(),i=o.ref(null),a=o.ref(null),s=o.ref(null),d=o.computed(()=>t.annotation.id),u=o.computed(()=>t.annotation.rect.size.width),p=o.computed(()=>t.annotation.rect.size.height);o.watch(()=>[t.pageIndex,t.scaleFactor,t.documentId,d.value,u.value,p.value,l.value],(e,o,c)=>{if(l.value){a.value&&(URL.revokeObjectURL(a.value),a.value=null);const e=l.value.forDocument(t.documentId).renderAnnotation({pageIndex:t.pageIndex,annotation:n.deepToRaw(t.annotation),options:{scaleFactor:t.scaleFactor,dpr:window.devicePixelRatio}});s.value=e,e.wait(e=>{const t=URL.createObjectURL(e);i.value=t,a.value=t},r.ignore),c(()=>{a.value?(URL.revokeObjectURL(a.value),a.value=null):e.abort({code:r.PdfErrorCode.Cancelled,message:"canceled render task"})})}},{immediate:!0}),o.onUnmounted(()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null),s.value&&s.value.abort({code:r.PdfErrorCode.Cancelled,message:"canceled render task on unmount"})});const v=()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null)};return(t,n)=>i.value?(o.openBlock(),o.createElementBlock("img",{key:0,src:i.value,onLoad:v,style:o.normalizeStyle({width:"100%",height:"100%",display:"block",...e.style})},null,44,H)):o.createCommentVNode("",!0)}}),G=o.defineComponent({__name:"stamp",props:{isSelected:{type:Boolean},annotation:{},documentId:{},pageIndex:{},scale:{},onClick:{type:Function}},setup:e=>(t,n)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle({position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e.isSelected?"none":"auto",cursor:"pointer"}),onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t))},[o.createVNode(q,{documentId:e.documentId,pageIndex:e.pageIndex,annotation:{...e.annotation.object,id:e.annotation.object.id},scaleFactor:e.scale},null,8,["documentId","pageIndex","annotation","scaleFactor"])],36))}),K=o.defineComponent({__name:"highlight",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00");return(t,l)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,r)=>(o.openBlock(),o.createElementBlock("div",{key:r,onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:n.value,opacity:e.opacity,pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:void 0})},null,36))),128))}}),Y=o.defineComponent({__name:"squiggly",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale),r=o.computed(()=>6*t.scale),i=o.computed(()=>{const e=l.value,t=r.value,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${2*e}" viewBox="0 0 ${t} ${2*e}">\n <path d="M0 ${e} Q ${t/4} 0 ${t/2} ${e} T ${t} ${e}"\n fill="none" stroke="${n.value}" stroke-width="${e}" stroke-linecap="round"/>\n </svg>`;return`url("data:image/svg+xml;utf8,${encodeURIComponent(o)}")`});return(t,n)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,a)=>(o.openBlock(),o.createElementBlock("div",{key:a,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:2*l.value+"px",backgroundImage:i.value,backgroundRepeat:"repeat-x",backgroundSize:`${r.value}px ${2*l.value}px`,opacity:e.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),Q=o.defineComponent({__name:"strikeout",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale);return(t,r)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,i)=>(o.openBlock(),o.createElementBlock("div",{key:i,onPointerdown:r[0]||(r[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:r[1]||(r[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,top:"50%",width:"100%",height:`${l.value}px`,background:n.value,opacity:e.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36))),128))}}),X=o.defineComponent({__name:"underline",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale);return(t,r)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,i)=>(o.openBlock(),o.createElementBlock("div",{key:i,onPointerdown:r[0]||(r[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:r[1]||(r[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:`${l.value}px`,background:n.value,opacity:e.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),Z=o.defineComponent({__name:"annotations",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function},annotationRenderers:{}},setup(e){const n=e,l=e=>{var t;return null==(t=n.annotationRenderers)?void 0:t.find(t=>t.matches(e.object))},{provides:s}=c(),{provides:d}=a.useSelectionCapability(),p=o.ref([]),g=o.ref([]),{register:m}=i.usePointerHandlers({documentId:()=>n.documentId,pageIndex:n.pageIndex}),f=o.ref(null),y=o.computed(()=>s.value?s.value.forDocument(n.documentId):null),x=o.computed(()=>g.value.length>1);o.watchEffect(e=>{if(y.value){const o=y.value.getState();p.value=t.getAnnotationsByPageIndex(o,n.pageIndex),g.value=t.getSelectedAnnotationIds(o);e(y.value.onStateChange(e=>{p.value=t.getAnnotationsByPageIndex(e,n.pageIndex),g.value=t.getSelectedAnnotationIds(e)}))}});const S=(e,t)=>{t.target===t.currentTarget&&y.value&&(y.value.deselectAnnotation(),f.value=null)},b=(e,t)=>{if(e.stopPropagation(),y.value&&d.value){d.value.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?y.value.toggleSelection(n.pageIndex,t.object.id):y.value.selectAnnotation(n.pageIndex,t.object.id),t.object.id!==f.value&&(f.value=null)}},w=(e,t)=>{if(e.stopPropagation(),y.value&&d.value){if(d.value.clear(),t.object.inReplyToId){const e=t.object.inReplyToId,o=p.value.find(t=>t.object.id===e);if(o)return void y.value.selectAnnotation(o.object.pageIndex,e)}y.value.selectAnnotation(n.pageIndex,t.object.id)}};o.watchEffect(e=>{if(y.value){const t=m({onPointerDown:S});t&&e(t)}});const B=e=>g.value.includes(e.object.id),I=o.computed(()=>p.value.filter(e=>g.value.includes(e.object.id))),P=o.computed(()=>!(I.value.length<2)&&I.value.every(e=>{var o;const n=null==(o=y.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupDraggable,e.object,!0),r=t.resolveInteractionProp(null==n?void 0:n.interaction.isDraggable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupDraggable)?l:r})),R=o.computed(()=>!(I.value.length<2)&&I.value.every(e=>{var o;const n=null==(o=y.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupResizable,e.object,!0),r=t.resolveInteractionProp(null==n?void 0:n.interaction.isResizable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupResizable)?l:r})),A=o.computed(()=>{if(!y.value)return!1;if(g.value.length<2)return!1;return y.value.getSelectedAnnotations().every(e=>e.object.pageIndex===n.pageIndex)}),E=e=>{var t;return null==(t=y.value)?void 0:t.findToolForAnnotation(e.object)},_=e=>{var o;return(!t.isFreeText(e)||f.value!==e.object.id)&&(!x.value&&t.resolveInteractionProp(null==(o=E(e))?void 0:o.interaction.isDraggable,e.object,!1))},D=e=>{var o;return!x.value&&t.resolveInteractionProp(null==(o=E(e))?void 0:o.interaction.isResizable,e.object,!1)},$=e=>{var o;return t.resolveInteractionProp(null==(o=E(e))?void 0:o.interaction.lockAspectRatio,e.object,!1)},N=e=>B(e)&&!x.value,W=o.computed(()=>{const{selectionMenu:e,groupSelectionMenu:t,...o}=n;return o}),T=e=>t.isLine(e)?{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})}:t.isPolyline(e)||t.isPolygon(e)?{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})}:void 0;return(n,i)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(p.value,i=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:i.object.id},[l(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:0,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(l(i).component),{annotation:i,isSelected:B(i),scale:e.scale,pageIndex:e.pageIndex,onClick:e=>b(e,i)},null,8,["annotation","isSelected","scale","pageIndex","onClick"]))]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","selectionMenu","style"])):o.unref(t.isInk)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:1,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(C,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isSquare)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:2,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(O,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isCircle)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:3,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(k,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isLine)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:4,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(z,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isPolyline)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:5,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(L,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isPolygon)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:6,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(j,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>b(e,i)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isFreeText)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:7,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),onDoubleClick:e=>{return o=i.object.id,void(t.isFreeText(p.value.find(e=>e.object.id===o))&&(f.value=o));var o},vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(h,{isSelected:B(i),isEditing:f.value===i.object.id,annotation:{...i,object:t},pageIndex:e.pageIndex,scale:e.scale,onClick:e=>b(e,i)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","selectionMenu","style"])):o.unref(t.isStamp)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:8,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(()=>[o.createVNode(G,{documentId:e.documentId,isSelected:B(i),annotation:i,pageIndex:e.pageIndex,scale:e.scale,onClick:e=>b(e,i)},null,8,["documentId","isSelected","annotation","pageIndex","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isUnderline)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:9,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(X,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isStrikeout)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:10,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(Q,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isSquiggly)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:11,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(Y,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isHighlight)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:12,trackedAnnotation:i,isSelected:N(i),isDraggable:_(i),isResizable:D(i),lockAspectRatio:$(i),onSelect:e=>b(e,i),vertexConfig:T(i),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Multiply)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(K,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,i)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isLink)(i)?(o.openBlock(),o.createBlock(u,o.mergeProps({key:13,trackedAnnotation:i,isSelected:N(i),isMultiSelected:x.value,isDraggable:!1,isResizable:!1,lockAspectRatio:!1,onSelect:e=>w(e,i),selectionMenu:i.object.inReplyToId||x.value?void 0:e.selectionMenu,style:{mixBlendMode:o.unref(r.blendModeToCss)(i.object.blendMode??o.unref(r.PdfBlendMode).Normal)}},{ref_for:!0},W.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(M,o.mergeProps({ref_for:!0},t,{isSelected:B(i),scale:e.scale,onClick:e=>w(e,i),hasIRT:!!i.object.inReplyToId}),null,16,["isSelected","scale","onClick","hasIRT"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value||i.object.inReplyToId?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isMultiSelected","onSelect","selectionMenu","style"])):o.createCommentVNode("",!0)],64))),128)),A.value&&I.value.length>=2?(o.openBlock(),o.createBlock(v,{key:0,documentId:e.documentId,pageIndex:e.pageIndex,scale:e.scale,rotation:e.rotation,pageWidth:e.pageWidth,pageHeight:e.pageHeight,selectedAnnotations:I.value,isDraggable:P.value,isResizable:R.value,resizeUI:e.resizeUI,selectionOutlineColor:e.selectionOutlineColor,groupSelectionMenu:e.groupSelectionMenu},{"group-selection-menu":o.withCtx(e=>[o.renderSlot(n.$slots,"group-selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","selectedAnnotations","isDraggable","isResizable","resizeUI","selectionOutlineColor","groupSelectionMenu"])):o.createCommentVNode("",!0)],64))}}),J=o.defineComponent({__name:"text-markup",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{provides:n}=a.useSelectionCapability(),{provides:l}=c(),i=o.ref([]),s=o.ref(null),d=o.ref(null);o.watchEffect(e=>{const o=[];if(n.value){const e=n.value.forDocument(t.documentId),l=e.onSelectionChange(()=>{i.value=e.getHighlightRectsForPage(t.pageIndex),s.value=e.getBoundingRectForPage(t.pageIndex)});o.push(l)}if(l.value){const e=l.value.forDocument(t.documentId);d.value=e.getActiveTool();const n=e.onActiveToolChange(e=>d.value=e);o.push(n)}e(()=>{o.forEach(e=>e())})});const u=o.computed(()=>{if(!d.value)return r.blendModeToCss(r.PdfBlendMode.Normal);const e=d.value.defaults.type===r.PdfAnnotationSubtype.HIGHLIGHT?r.PdfBlendMode.Multiply:r.PdfBlendMode.Normal;return r.blendModeToCss(d.value.defaults.blendMode??e)});return(t,n)=>s.value&&d.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({mixBlendMode:u.value,pointerEvents:"none",position:"absolute",inset:0})},[d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).HIGHLIGHT?(o.openBlock(),o.createBlock(K,{key:0,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).UNDERLINE?(o.openBlock(),o.createBlock(X,{key:1,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).STRIKEOUT?(o.openBlock(),o.createBlock(Q,{key:2,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):d.value.defaults.type===o.unref(r.PdfAnnotationSubtype).SQUIGGLY?(o.openBlock(),o.createBlock(Y,{key:3,strokeColor:d.value.defaults.strokeColor,opacity:d.value.defaults.opacity,segmentRects:i.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)}}),ee=o.defineComponent({__name:"preview-renderer",props:{preview:{},scale:{}},setup(e){const t=e,n=o.computed(()=>({position:"absolute",left:t.preview.bounds.origin.x*t.scale+"px",top:t.preview.bounds.origin.y*t.scale+"px",width:t.preview.bounds.size.width*t.scale+"px",height:t.preview.bounds.size.height*t.scale+"px",pointerEvents:"none",zIndex:10}));return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle(n.value)},[e.preview.type===o.unref(r.PdfAnnotationSubtype).CIRCLE?(o.openBlock(),o.createBlock(o.unref(k),o.mergeProps({key:0,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).SQUARE?(o.openBlock(),o.createBlock(o.unref(O),o.mergeProps({key:1,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).POLYGON?(o.openBlock(),o.createBlock(o.unref(j),o.mergeProps({key:2,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).POLYLINE?(o.openBlock(),o.createBlock(o.unref(L),o.mergeProps({key:3,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).LINE?(o.openBlock(),o.createBlock(o.unref(z),o.mergeProps({key:4,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).INK?(o.openBlock(),o.createBlock(o.unref(C),o.mergeProps({key:5,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(r.PdfAnnotationSubtype).FREETEXT?(o.openBlock(),o.createElementBlock("div",{key:6,style:o.normalizeStyle({width:"100%",height:"100%",border:`1px dashed ${e.preview.data.fontColor||"#000000"}`,backgroundColor:"transparent"})},null,4)):o.createCommentVNode("",!0)],4))}}),te=o.defineComponent({__name:"annotation-paint-layer",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{plugin:n}=s(),l=o.ref(new Map),r=o.ref(null),i=o.ref(null),a=o.computed(()=>({requestFile:({accept:e,onFile:t})=>{const o=r.value;o&&(o.accept=e,o.onchange=e=>{var n;const l=null==(n=e.target.files)?void 0:n[0];l&&(t(l),o.value="")},o.click())},processImage:({source:e,maxWidth:t,maxHeight:o,onComplete:n})=>{const l=i.value;if(!l||!l.getContext)return;const r=l.getContext("2d");if(!r)return;const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{let{naturalWidth:i,naturalHeight:s}=a;const c=t?t/i:1,d=o?o/s:1,u=Math.min(c,d,1),p=i*u,v=s*u;l.width=p,l.height=v,r.drawImage(a,0,0,p,v);const g=r.getImageData(0,0,p,v);"string"!=typeof e&&URL.revokeObjectURL(a.src),n({imageData:g,width:p,height:v})},a.src="string"==typeof e?e:URL.createObjectURL(e)}}));let c;return o.watchEffect(e=>{n.value&&(c=n.value.registerPageHandlers(t.documentId,t.pageIndex,t.scale,{services:a.value,onPreview:(e,t)=>{const o=new Map(l.value);t?o.set(e,t):o.delete(e),l.value=o}})),e(()=>{null==c||c()})}),(t,n)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("input",{ref_key:"fileInputRef",ref:r,type:"file",style:{display:"none"}},null,512),o.createElementVNode("canvas",{ref_key:"canvasRef",ref:i,style:{display:"none"}},null,512),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value.entries(),([t,n])=>(o.openBlock(),o.createBlock(ee,{key:t,preview:n,scale:e.scale},null,8,["preview","scale"]))),128))],64))}}),oe=Symbol("AnnotationRendererRegistry");function ne(){const e=o.shallowRef([]);return{register(t){const o=new Set(t.map(e=>e.id));return e.value=[...e.value.filter(e=>!o.has(e.id)),...t],()=>{e.value=e.value.filter(e=>!t.some(t=>t.id===e.id))}},getAll:()=>e.value}}function le(){const e=ne();return o.provide(oe,e),e}function re(){return o.inject(oe,null)}const ie=o.defineComponent({__name:"annotation-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function},annotationRenderers:{}},setup(e){const t=e,n=re(),r=o.computed(()=>{const e=(null==n?void 0:n.getAll())??[],o=t.annotationRenderers??[],l=[...e];for(const t of o){const e=l.findIndex(e=>e.id===t.id);e>=0?l[e]=t:l.push(t)}return l}),i=l.useDocumentState(()=>t.documentId),a=o.computed(()=>{var e,o,n;return null==(n=null==(o=null==(e=i.value)?void 0:e.document)?void 0:o.pages)?void 0:n[t.pageIndex]}),s=o.computed(()=>{var e,t;return(null==(t=null==(e=a.value)?void 0:e.size)?void 0:t.width)??0}),c=o.computed(()=>{var e,t;return(null==(t=null==(e=a.value)?void 0:e.size)?void 0:t.height)??0}),d=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=i.value)?void 0:e.scale)??1}),u=o.computed(()=>{var e,o;if(void 0!==t.rotation)return t.rotation;return(((null==(e=a.value)?void 0:e.rotation)??0)+((null==(o=i.value)?void 0:o.rotation)??0))%4});return(t,n)=>(o.openBlock(),o.createElementBlock("div",null,[o.createVNode(Z,{documentId:e.documentId,pageIndex:e.pageIndex,scale:d.value,rotation:u.value,pageWidth:s.value,pageHeight:c.value,resizeUI:e.resizeUI,vertexUI:e.vertexUI,selectionOutlineColor:e.selectionOutlineColor,selectionMenu:e.selectionMenu,groupSelectionMenu:e.groupSelectionMenu,annotationRenderers:r.value},{"selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"group-selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"group-selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"resize-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"resize-handle",o.normalizeProps(o.guardReactiveProps(e)))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"vertex-handle",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","resizeUI","vertexUI","selectionOutlineColor","selectionMenu","groupSelectionMenu","annotationRenderers"]),o.createVNode(J,{documentId:e.documentId,pageIndex:e.pageIndex,scale:d.value},null,8,["documentId","pageIndex","scale"]),o.createVNode(te,{documentId:e.documentId,pageIndex:e.pageIndex,scale:d.value},null,8,["documentId","pageIndex","scale"])]))}}),ae=o.defineComponent({__name:"renderer-registry-provider",setup:e=>(le(),(e,t)=>o.renderSlot(e.$slots,"default"))}),se=e.createPluginPackage(t.AnnotationPluginPackage).addWrapper(ae).build();exports.AnnotationContainer=u,exports.AnnotationLayer=ie,exports.AnnotationPaintLayer=te,exports.AnnotationPluginPackage=se,exports.Annotations=Z,exports.Circle=k,exports.FreeText=h,exports.GroupSelectionBox=v,exports.Highlight=K,exports.Ink=C,exports.Line=z,exports.Link=M,exports.Polygon=j,exports.Polyline=L,exports.PreviewRenderer=ee,exports.RenderAnnotation=q,exports.RendererRegistryProvider=ae,exports.Square=O,exports.Squiggly=Y,exports.Stamp=G,exports.Strikeout=Q,exports.TextMarkup=J,exports.Underline=X,exports.createRenderer=function(e){return{id:e.id,matches:e.matches,component:o.markRaw(e.component)}},exports.createRendererRegistry=ne,exports.provideRendererRegistry=le,exports.useAnnotation=e=>{var n,l;const{provides:r}=c(),i=o.ref((null==(l=null==(n=null==r?void 0:r.value)?void 0:n.forDocument(o.toValue(e)))?void 0:l.getState())??t.initialDocumentState());return o.watch([r,()=>o.toValue(e)],([e,t],o,n)=>{if(e&&t){const o=e.forDocument(t);i.value=o.getState();n(o.onStateChange(e=>{i.value=e}))}},{immediate:!0}),{state:i,provides:o.computed(()=>{var t;return(null==(t=r.value)?void 0:t.forDocument(o.toValue(e)))??null})}},exports.useAnnotationCapability=c,exports.useAnnotationPlugin=s,exports.useRegisterRenderers=function(e){const t=re();if(!t)return;const n=t.register(e);o.onUnmounted(n)},exports.useRendererRegistry=re,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-annotation"),o=require("vue"),n=require("@embedpdf/utils/vue"),l=require("@embedpdf/core/vue"),a=require("@embedpdf/models"),r=require("@embedpdf/plugin-interaction-manager/vue"),i=require("@embedpdf/plugin-selection/vue"),c=()=>l.usePlugin(t.AnnotationPlugin.id),s=()=>l.useCapability(t.AnnotationPlugin.id),u=["width","height","stroke"],d=["width","height","stroke"],p=o.defineComponent({inheritAttrs:!1,__name:"annotation-container",props:{scale:{},documentId:{},pageIndex:{},rotation:{},pageWidth:{},pageHeight:{},trackedAnnotation:{},isSelected:{type:Boolean},isMultiSelected:{type:Boolean,default:!1},isDraggable:{type:Boolean},isResizable:{type:Boolean},isRotatable:{type:Boolean,default:!0},lockAspectRatio:{type:Boolean,default:!1},vertexConfig:{},selectionMenu:{},outlineOffset:{default:1},onDoubleClick:{},onSelect:{},zIndex:{default:1},selectionOutlineColor:{default:"#007ACC"},selectionOutline:{},resizeUi:{},vertexUi:{},rotationUi:{},style:{}},setup(e){const a=e,r=o.computed(()=>{var e;return(null==(e=a.resizeUi)?void 0:e.color)??"#007ACC"}),i=o.computed(()=>{var e;return(null==(e=a.vertexUi)?void 0:e.color)??"#007ACC"}),p=o.computed(()=>{var e;return(null==(e=a.resizeUi)?void 0:e.size)??12}),v=o.computed(()=>{var e;return(null==(e=a.vertexUi)?void 0:e.size)??12}),m=o.computed(()=>{var e;return(null==(e=a.rotationUi)?void 0:e.size)??32}),g=o.computed(()=>{var e;return(null==(e=a.rotationUi)?void 0:e.color)??"white"}),h=o.computed(()=>{var e;return(null==(e=a.rotationUi)?void 0:e.connectorColor)??"#007ACC"}),k=o.computed(()=>{var e;return(null==(e=a.rotationUi)?void 0:e.iconColor)??"#007ACC"}),f=o.computed(()=>{var e;return(null==(e=a.rotationUi)?void 0:e.showConnector)??!1}),y=o.computed(()=>{var e;return null==(e=a.rotationUi)?void 0:e.margin}),x=o.computed(()=>{var e,t;return(null==(t=null==(e=a.rotationUi)?void 0:e.border)?void 0:t.color)??"#007ACC"}),C=o.computed(()=>{var e,t;return(null==(t=null==(e=a.rotationUi)?void 0:e.border)?void 0:t.width)??1}),S=o.computed(()=>{var e,t;return(null==(t=null==(e=a.rotationUi)?void 0:e.border)?void 0:t.style)??"solid"}),b=o.computed(()=>{var e;return(null==(e=a.selectionOutline)?void 0:e.color)??a.selectionOutlineColor??"#007ACC"}),w=o.computed(()=>{var e;return(null==(e=a.selectionOutline)?void 0:e.style)??"solid"}),z=o.computed(()=>{var e;return(null==(e=a.selectionOutline)?void 0:e.width)??1}),B=o.computed(()=>{var e;return(null==(e=a.selectionOutline)?void 0:e.offset)??a.outlineOffset??1}),R=o.shallowRef(o.toRaw(a.trackedAnnotation.object)),P=o.ref(null),I=o.ref(null),A=o.ref(!1),{provides:E}=s(),{plugin:$}=c(),M=l.useDocumentPermissions(a.documentId),_=o.ref(null),D=o.shallowRef(null),N=o.computed(()=>M.value.canModifyAnnotations&&a.isDraggable&&!a.isMultiSelected),V=o.computed(()=>M.value.canModifyAnnotations&&a.isResizable&&!a.isMultiSelected),U=o.computed(()=>M.value.canModifyAnnotations&&a.isRotatable&&!a.isMultiSelected),j=a.onDoubleClick?e=>{var t;M.value.canModifyAnnotations&&(null==(t=a.onDoubleClick)||t.call(a,e))}:void 0,W=o.computed(()=>E.value?E.value.forDocument(a.documentId):null),F=o.computed(()=>({...o.toRaw(a.trackedAnnotation.object),...o.toRaw(R.value)})),O=o.computed(()=>P.value??F.value.rotation??0),L=o.computed(()=>P.value??F.value.rotation??0),T=o.computed(()=>{const e=L.value;return Number.isFinite(e)?Math.round(10*e)/10:0}),H=o.computed(()=>null!==P.value),G=o.computed(()=>F.value.unrotatedRect),q=o.computed(()=>G.value??F.value.rect),Y=o.computed(()=>{if(G.value&&0!==O.value)return t.inferRotationCenterFromRects(q.value,F.value.rect,O.value)}),K=o.computed(()=>q.value),X=o.computed(()=>G.value?{...F.value,rect:G.value}:F.value),Q=o.computed(()=>a.isSelected&&!a.isMultiSelected),Z=o.computed(()=>a.isSelected&&!a.isMultiSelected&&(a.selectionMenu||_e["selection-menu"])),J=o.computed(()=>({origin:{x:F.value.rect.origin.x*a.scale,y:F.value.rect.origin.y*a.scale},size:{width:F.value.rect.size.width*a.scale,height:F.value.rect.size.height*a.scale}})),ee=o.computed(()=>({type:"annotation",annotation:a.trackedAnnotation,pageIndex:a.pageIndex})),te=o.computed(()=>{const e=((O.value+90*a.rotation)%360+360)%360;return{suggestTop:U.value&&e>90&&e<270}}),oe=(e,t)=>a.selectionMenu?a.selectionMenu({rect:e,menuWrapperProps:t,selected:a.isSelected,placement:te.value,context:ee.value}):null,ne=o.computed(()=>{var e;const t=o.toRaw(F.value);return(null==(e=a.vertexConfig)?void 0:e.extractVertices(t))??[]}),le=o.computed(()=>({minWidth:10,minHeight:10,boundingBox:{width:a.pageWidth,height:a.pageHeight}})),{dragProps:ae,vertices:re,resize:ie,rotation:ce}=n.useInteractionHandles({controller:{element:K,vertices:ne,constraints:le,maintainAspectRatio:o.computed(()=>a.lockAspectRatio),pageRotation:o.computed(()=>a.rotation),annotationRotation:o.computed(()=>O.value),rotationCenter:o.computed(()=>Y.value),rotationElement:o.computed(()=>F.value.rect),scale:o.computed(()=>a.scale),enabled:o.computed(()=>a.isSelected&&!a.isMultiSelected),onUpdate:e=>{var t,n,l;if(!(null==(t=e.transformData)?void 0:t.type)||a.isMultiSelected)return;const r=$.value;if(!r)return;const{type:i,changes:c,metadata:s}=e.transformData,u=a.trackedAnnotation.object.id,d={width:a.pageWidth,height:a.pageHeight};if("start"===e.state&&(D.value=a.trackedAnnotation.object.unrotatedRect??a.trackedAnnotation.object.rect,_.value=F.value,"move"===i?r.startDrag(a.documentId,{annotationIds:[u],pageSize:d}):"resize"===i&&r.startResize(a.documentId,{annotationIds:[u],pageSize:d,resizeHandle:(null==s?void 0:s.handle)??"se"})),c.rect&&D.value)if("move"===i){const e={x:c.rect.origin.x-D.value.origin.x,y:c.rect.origin.y-D.value.origin.y};r.updateDrag(a.documentId,e)}else"resize"===i&&r.updateResize(a.documentId,c.rect);if("vertex-edit"===i&&c.vertices&&a.vertexConfig){const t=_.value??F.value,r=a.vertexConfig.transformAnnotation(o.toRaw(t),c.vertices),d=null==(n=E.value)?void 0:n.transformAnnotation(t,{type:i,changes:r,metadata:s});d&&(R.value={...o.toRaw(R.value),...d},"end"===e.state&&(null==(l=W.value)||l.updateAnnotation(a.pageIndex,u,d)))}if("rotate"===i){const t=(null==s?void 0:s.rotationAngle)??O.value,o=null==s?void 0:s.cursorPosition;return o&&(I.value={x:o.clientX,y:o.clientY}),void("start"===e.state?(P.value=t,r.startRotation(a.documentId,{annotationIds:[u],cursorAngle:t,rotationCenter:null==s?void 0:s.rotationCenter})):"move"===e.state?(P.value=t,r.updateRotation(a.documentId,t,null==s?void 0:s.rotationDelta)):"end"===e.state&&(P.value=null,I.value=null,r.commitRotation(a.documentId)))}"end"===e.state&&(D.value=null,_.value=null,"move"===i?r.commitDrag(a.documentId):"resize"===i&&r.commitResize(a.documentId))}},resizeUI:{handleSize:p.value,spacing:B.value,offsetMode:"outside",includeSides:!a.lockAspectRatio,zIndex:a.zIndex+1},vertexUI:{vertexSize:v.value,zIndex:a.zIndex+2},rotationUI:{handleSize:m.value,margin:y.value,zIndex:a.zIndex+3,showConnector:f.value},includeVertices:!!a.vertexConfig,includeRotation:U,currentRotation:O}),se=n.useDoublePressProps(j),ue=e=>{H.value||(I.value={x:e.clientX,y:e.clientY})};o.watchEffect(()=>{a.trackedAnnotation.object&&(R.value=a.trackedAnnotation.object)}),o.watchEffect(e=>{const t=$.value;if(!t)return;const n=a.trackedAnnotation.object.id,l=e=>{var t;if(e.documentId!==a.documentId)return;"end"!==e.type&&"cancel"!==e.type||(P.value=null);const l=null==(t=e.previewPatches)?void 0:t[n];"update"===e.type&&l?R.value={...o.toRaw(R.value),...l}:"cancel"===e.type&&(R.value=a.trackedAnnotation.object)},r=[t.onDragChange(l),t.onResizeChange(l),t.onRotateChange(l)];e(()=>r.forEach(e=>e()))});const de=o.computed(()=>F.value.rect.size.width*a.scale),pe=o.computed(()=>F.value.rect.size.height*a.scale),ve=o.computed(()=>q.value.size.width*a.scale),me=o.computed(()=>q.value.size.height*a.scale),ge=o.computed(()=>Boolean(G.value)&&0!==O.value),he=o.computed(()=>ge.value?(q.value.origin.x-F.value.rect.origin.x)*a.scale:(de.value-ve.value)/2),ke=o.computed(()=>ge.value?(q.value.origin.y-F.value.rect.origin.y)*a.scale:(pe.value-me.value)/2),fe=o.computed(()=>ge.value&&Y.value?`${(Y.value.x-q.value.origin.x)*a.scale}px ${(Y.value.y-q.value.origin.y)*a.scale}px`:"center center"),ye=o.computed(()=>Y.value?(Y.value.x-F.value.rect.origin.x)*a.scale:de.value/2),xe=o.computed(()=>Y.value?(Y.value.y-F.value.rect.origin.y)*a.scale:pe.value/2),Ce=o.computed(()=>Math.max(300,Math.max(de.value,pe.value)+80)),Se=o.computed(()=>Math.round(.6*m.value)),be={display:"contents"},we=o.computed(()=>({position:"absolute",left:F.value.rect.origin.x*a.scale+"px",top:F.value.rect.origin.y*a.scale+"px",width:`${de.value}px`,height:`${pe.value}px`,pointerEvents:"none",zIndex:a.zIndex,...a.style??{}})),ze=o.computed(()=>({position:"absolute",left:`${he.value}px`,top:`${ke.value}px`,width:`${ve.value}px`,height:`${me.value}px`,transform:0!==O.value?`rotate(${O.value}deg)`:void 0,transformOrigin:fe.value,outline:Q.value?`${z.value}px ${w.value} ${b.value}`:"none",outlineOffset:Q.value?`${B.value}px`:"0px",pointerEvents:a.isSelected&&!a.isMultiSelected?"auto":"none",touchAction:"none",cursor:a.isSelected&&N.value?"move":"default"})),Be=o.computed(()=>({position:"absolute",left:ye.value-Ce.value/2+"px",top:`${xe.value}px`,width:`${Ce.value}px`,height:"1px",backgroundColor:h.value,opacity:.35,pointerEvents:"none"})),Re=o.computed(()=>({position:"absolute",left:`${ye.value}px`,top:xe.value-Ce.value/2+"px",width:"1px",height:`${Ce.value}px`,backgroundColor:h.value,opacity:.35,pointerEvents:"none"})),Pe=o.computed(()=>({position:"absolute",left:ye.value-Ce.value/2+"px",top:`${xe.value}px`,width:`${Ce.value}px`,height:"1px",transformOrigin:"center center",transform:`rotate(${O.value}deg)`,backgroundColor:h.value,opacity:.8,pointerEvents:"none"})),Ie=o.computed(()=>{var e;return{...(null==(e=ce.value)?void 0:e.connector.style)??{},backgroundColor:h.value,opacity:H.value?0:1}}),Ae=o.computed(()=>{var e;return{...(null==(e=ce.value)?void 0:e.handle.style)??{},backgroundColor:g.value,border:`${C.value}px ${S.value} ${x.value}`,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",opacity:H.value?0:1}}),Ee=o.computed(()=>{if(!ce.value)return{};const{style:e,...t}=ce.value.handle;return t}),$e=o.computed(()=>ce.value?{...ce.value.handle,backgroundColor:g.value,iconColor:k.value,connectorStyle:Ie.value,showConnector:f.value,opacity:H.value?0:1,border:{color:x.value,width:C.value,style:S.value}}:{}),Me=o.computed(()=>({position:"fixed",left:I.value?`${I.value.x+16}px`:"0",top:I.value?I.value.y-16+"px":"0",background:"rgba(0,0,0,0.8)",color:"#fff",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",pointerEvents:"none",zIndex:1e4,whiteSpace:"nowrap"})),_e=o.useSlots();return(t,l)=>(o.openBlock(),o.createElementBlock("div",{"data-no-interaction":"",style:be},[o.createElementVNode("div",{style:o.normalizeStyle(we.value)},[H.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",{style:o.normalizeStyle(Be.value)},null,4),o.createElementVNode("div",{style:o.normalizeStyle(Re.value)},null,4),o.createElementVNode("div",{style:o.normalizeStyle(Pe.value)},null,4)],64)):o.createCommentVNode("",!0),e.isSelected&&U.value&&o.unref(ce)?(o.openBlock(),o.createElementBlock("div",{key:1,onPointerenter:l[0]||(l[0]=e=>A.value=!0),onPointerleave:l[1]||(l[1]=e=>{A.value=!1,I.value=null}),onPointermove:ue,style:be},[f.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle(Ie.value)},null,4)):o.createCommentVNode("",!0),o.unref(_e)["rotation-handle"]?o.renderSlot(t.$slots,"rotation-handle",o.normalizeProps(o.mergeProps({key:1},$e.value)),()=>[o.createElementVNode("div",o.mergeProps(Ee.value,{style:Ae.value}),[(o.openBlock(),o.createElementBlock("svg",{width:Se.value,height:Se.value,viewBox:"0 0 24 24",fill:"none",stroke:k.value,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...l[2]||(l[2]=[o.createElementVNode("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"},null,-1),o.createElementVNode("path",{d:"M21 3v5h-5"},null,-1)])],8,u))],16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:2},Ee.value,{style:Ae.value}),[(o.openBlock(),o.createElementBlock("svg",{width:Se.value,height:Se.value,viewBox:"0 0 24 24",fill:"none",stroke:k.value,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...l[3]||(l[3]=[o.createElementVNode("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"},null,-1),o.createElementVNode("path",{d:"M21 3v5h-5"},null,-1)])],8,d))],16))],32)):o.createCommentVNode("",!0),o.createElementVNode("div",o.mergeProps({...N.value&&e.isSelected?o.unref(ae):{},...o.unref(se)},{style:ze.value}),[o.renderSlot(t.$slots,"default",{annotation:X.value}),e.isSelected&&V.value&&!H.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(ie),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(_e)["resize-handle"]?o.renderSlot(t.$slots,"resize-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:r.value}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:r.value}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:r.value}]}),null,16))],64))),128)):o.createCommentVNode("",!0),e.isSelected&&o.unref(M).canModifyAnnotations&&!e.isMultiSelected&&!H.value&&o.unref(re).length>0?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(o.unref(re),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(_e)["vertex-handle"]?o.renderSlot(t.$slots,"vertex-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:i.value}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:i.value}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:i.value}]}),null,16))],64))),128)):o.createCommentVNode("",!0)],16)],4),Z.value&&!H.value?(o.openBlock(),o.createBlock(o.unref(n.CounterRotate),{key:0,rect:J.value,rotation:e.rotation},{default:o.withCtx(({rect:n,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(oe(n,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:ee.value,selected:e.isSelected,rect:n,placement:te.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):o.createCommentVNode("",!0),(H.value||A.value)&&I.value?(o.openBlock(),o.createBlock(o.Teleport,{key:1,to:"body"},[o.createElementVNode("div",{style:o.normalizeStyle(Me.value)},o.toDisplayString(T.value.toFixed(0))+"°",5)])):o.createCommentVNode("",!0)]))}}),v={key:0,"data-group-selection-box":"","data-no-interaction":""},m=["width","height","stroke"],g=["width","height","stroke"],h=o.defineComponent({__name:"group-selection-box",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},selectedAnnotations:{},isDraggable:{type:Boolean},isResizable:{type:Boolean},isRotatable:{type:Boolean,default:!0},lockAspectRatio:{type:Boolean,default:!1},resizeUi:{},rotationUi:{},selectionOutlineColor:{default:"#007ACC"},outlineOffset:{default:2},selectionOutline:{},zIndex:{default:100},groupSelectionMenu:{}},setup(e){const t=e,r=o.useSlots(),{plugin:i}=c(),s=l.useDocumentPermissions(()=>t.documentId),u=o.shallowRef(null),d=o.ref(!1),p=o.ref(!1),h=o.ref(null),k=o.ref(null),f=o.ref(!1),y=o.computed(()=>s.value.canModifyAnnotations&&t.isDraggable),x=o.computed(()=>s.value.canModifyAnnotations&&t.isResizable),C=o.computed(()=>s.value.canModifyAnnotations&&t.isRotatable),S=o.computed(()=>{var e;return(null==(e=t.resizeUi)?void 0:e.color)??"#007ACC"}),b=o.computed(()=>{var e;return(null==(e=t.resizeUi)?void 0:e.size)??12}),w=o.computed(()=>{var e;return(null==(e=t.rotationUi)?void 0:e.size)??32}),z=o.computed(()=>{var e;return(null==(e=t.rotationUi)?void 0:e.color)??"white"}),B=o.computed(()=>{var e;return(null==(e=t.rotationUi)?void 0:e.connectorColor)??"#007ACC"}),R=o.computed(()=>{var e;return(null==(e=t.rotationUi)?void 0:e.iconColor)??"#007ACC"}),P=o.computed(()=>{var e;return(null==(e=t.rotationUi)?void 0:e.showConnector)??!1}),I=o.computed(()=>{var e;return null==(e=t.rotationUi)?void 0:e.margin}),A=o.computed(()=>{var e,o;return(null==(o=null==(e=t.rotationUi)?void 0:e.border)?void 0:o.color)??"#007ACC"}),E=o.computed(()=>{var e,o;return(null==(o=null==(e=t.rotationUi)?void 0:e.border)?void 0:o.width)??1}),$=o.computed(()=>{var e,o;return(null==(o=null==(e=t.rotationUi)?void 0:e.border)?void 0:o.style)??"solid"}),M=o.computed(()=>{var e;return(null==(e=t.selectionOutline)?void 0:e.color)??t.selectionOutlineColor??"#007ACC"}),_=o.computed(()=>{var e;return(null==(e=t.selectionOutline)?void 0:e.style)??"dashed"}),D=o.computed(()=>{var e;return(null==(e=t.selectionOutline)?void 0:e.width)??2}),N=o.computed(()=>{var e;return(null==(e=t.selectionOutline)?void 0:e.offset)??t.outlineOffset??2}),V=o.computed(()=>h.value??0),U=o.computed(()=>null!==h.value),j=o.computed(()=>{const e=V.value;return Number.isFinite(e)?Math.round(10*e)/10:0}),W=o.computed(()=>Math.round(.6*w.value)),F=o.computed(()=>{const e=t.selectedAnnotations.map(e=>e.object.rect);return a.boundingRectOrEmpty(e)}),O=o.shallowRef(F.value);o.watch(()=>F.value,e=>{d.value||p.value||(O.value=e)},{immediate:!0}),o.watch(()=>i.value,(e,o,n)=>{if(!e)return;n(e.onRotateChange(e=>{e.documentId===t.documentId&&("end"!==e.type&&"cancel"!==e.type||(h.value=null))}))},{immediate:!0});const L=o.computed(()=>O.value.size.width*t.scale),T=o.computed(()=>O.value.size.height*t.scale),H=o.computed(()=>L.value/2),G=o.computed(()=>T.value/2),q=o.computed(()=>Math.max(300,Math.max(L.value,T.value)+80)),Y={display:"contents"},K=o.computed(()=>({position:"absolute",left:O.value.origin.x*t.scale+"px",top:O.value.origin.y*t.scale+"px",width:`${L.value}px`,height:`${T.value}px`,pointerEvents:"none",zIndex:t.zIndex})),X=o.computed(()=>({position:"absolute",left:0,top:0,width:`${L.value}px`,height:`${T.value}px`,outline:U.value?"none":`${D.value}px ${_.value} ${M.value}`,outlineOffset:N.value-1+"px",cursor:y.value?"move":"default",touchAction:"none",pointerEvents:"auto"})),Q=o.computed(()=>({position:"absolute",left:H.value-q.value/2+"px",top:`${G.value}px`,width:`${q.value}px`,height:"1px",backgroundColor:S.value,opacity:.35,pointerEvents:"none"})),Z=o.computed(()=>({position:"absolute",left:`${H.value}px`,top:G.value-q.value/2+"px",width:"1px",height:`${q.value}px`,backgroundColor:S.value,opacity:.35,pointerEvents:"none"})),J=o.computed(()=>({position:"absolute",left:H.value-q.value/2+"px",top:`${G.value}px`,width:`${q.value}px`,height:"1px",transformOrigin:"center center",transform:`rotate(${V.value}deg)`,backgroundColor:S.value,opacity:.8,pointerEvents:"none"})),ee=o.computed(()=>{var e;return{...(null==(e=ge.value)?void 0:e.connector.style)??{},backgroundColor:B.value,opacity:U.value?0:1}}),te=o.computed(()=>{var e;return{...(null==(e=ge.value)?void 0:e.handle.style)??{},backgroundColor:z.value,border:`${E.value}px ${$.value} ${A.value}`,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",opacity:U.value?0:1}}),oe=o.computed(()=>{if(!ge.value)return{};const{style:e,...t}=ge.value.handle;return t}),ne=o.computed(()=>ge.value?{...ge.value.handle,backgroundColor:z.value,iconColor:R.value,connectorStyle:ee.value,showConnector:P.value,opacity:U.value?0:1,border:{color:A.value,width:E.value,style:$.value}}:{}),le=o.computed(()=>({position:"fixed",left:k.value?`${k.value.x+16}px`:"0",top:k.value?k.value.y-16+"px":"0",background:"rgba(0,0,0,0.8)",color:"#fff",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",pointerEvents:"none",zIndex:1e4,whiteSpace:"nowrap"})),ae=o.computed(()=>({origin:{x:O.value.origin.x*t.scale,y:O.value.origin.y*t.scale},size:{width:O.value.size.width*t.scale,height:O.value.size.height*t.scale}})),re=o.computed(()=>({type:"group",annotations:t.selectedAnnotations,pageIndex:t.pageIndex})),ie=o.computed(()=>{const e=((V.value+90*t.rotation)%360+360)%360;return{suggestTop:C.value&&e>90&&e<270}}),ce=o.computed(()=>t.groupSelectionMenu||r["group-selection-menu"]),se=(e,o)=>t.groupSelectionMenu?t.groupSelectionMenu({rect:e,menuWrapperProps:o,selected:!0,placement:ie.value,context:re.value}):null,ue=e=>{U.value||(k.value={x:e.clientX,y:e.clientY})},de=o.computed(()=>O.value),pe=o.computed(()=>({minWidth:20,minHeight:20,boundingBox:{width:t.pageWidth,height:t.pageHeight}})),{dragProps:ve,resize:me,rotation:ge}=n.useInteractionHandles({controller:{element:de,vertices:o.computed(()=>[]),constraints:pe,maintainAspectRatio:o.computed(()=>t.lockAspectRatio),pageRotation:o.computed(()=>t.rotation),scale:o.computed(()=>t.scale),enabled:o.computed(()=>!0),onUpdate:e=>{var o,n,l,a,r,c;if(!(null==(o=e.transformData)?void 0:o.type))return;if(!i.value)return;const s=i.value,v=e.transformData.type,m="move"===v,g="resize"===v;if(m&&!y.value)return;if("start"===e.state&&(u.value=F.value,m?(d.value=!0,s.startDrag(t.documentId,{annotationIds:t.selectedAnnotations.map(e=>e.object.id),pageSize:{width:t.pageWidth,height:t.pageHeight}})):g&&(p.value=!0,s.startResize(t.documentId,{annotationIds:t.selectedAnnotations.map(e=>e.object.id),pageSize:{width:t.pageWidth,height:t.pageHeight},resizeHandle:(null==(n=e.transformData.metadata)?void 0:n.handle)??"se"}))),"rotate"===v){if(!t.isRotatable)return;const o=t.selectedAnnotations.map(e=>e.object.id),n=(null==(l=e.transformData.metadata)?void 0:l.rotationAngle)??0,i=null==(a=e.transformData.metadata)?void 0:a.cursorPosition;return i&&(k.value={x:i.clientX,y:i.clientY}),void("start"===e.state?(h.value=n,s.startRotation(t.documentId,{annotationIds:o,cursorAngle:n,rotationCenter:null==(r=e.transformData.metadata)?void 0:r.rotationCenter})):"move"===e.state?(h.value=n,s.updateRotation(t.documentId,n,null==(c=e.transformData.metadata)?void 0:c.rotationDelta)):"end"===e.state&&(h.value=null,k.value=null,s.commitRotation(t.documentId)))}const f=u.value??F.value;if(m&&e.transformData.changes.rect){const o=e.transformData.changes.rect,n={x:o.origin.x-f.origin.x,y:o.origin.y-f.origin.y},l=s.updateDrag(t.documentId,n);O.value={...f,origin:{x:f.origin.x+l.x,y:f.origin.y+l.y}}}else if(g&&e.transformData.changes.rect){const o=e.transformData.changes.rect;s.updateResize(t.documentId,o),O.value=o}"end"===e.state&&(u.value=null,m&&d.value?(d.value=!1,s.commitDrag(t.documentId)):g&&p.value&&(p.value=!1,s.commitResize(t.documentId)))}},resizeUI:{handleSize:b.value,spacing:N.value,offsetMode:"outside",includeSides:!t.lockAspectRatio,zIndex:t.zIndex+1},vertexUI:{vertexSize:0,zIndex:t.zIndex},rotationUI:{handleSize:w.value,margin:I.value,zIndex:t.zIndex+2,showConnector:P.value},includeVertices:!1,includeRotation:C,currentRotation:o.computed(()=>h.value??0)});return(t,l)=>e.selectedAnnotations.length>=2?(o.openBlock(),o.createElementBlock("div",v,[o.createElementVNode("div",{style:o.normalizeStyle(K.value)},[U.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",{style:o.normalizeStyle(Q.value)},null,4),o.createElementVNode("div",{style:o.normalizeStyle(Z.value)},null,4),o.createElementVNode("div",{style:o.normalizeStyle(J.value)},null,4)],64)):o.createCommentVNode("",!0),C.value&&o.unref(ge)?(o.openBlock(),o.createElementBlock("div",{key:1,onPointerenter:l[0]||(l[0]=e=>f.value=!0),onPointerleave:l[1]||(l[1]=e=>{f.value=!1,k.value=null}),onPointermove:ue,style:Y},[P.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle(ee.value)},null,4)):o.createCommentVNode("",!0),o.unref(r)["rotation-handle"]?o.renderSlot(t.$slots,"rotation-handle",o.normalizeProps(o.mergeProps({key:1},ne.value)),()=>[o.createElementVNode("div",o.mergeProps(oe.value,{style:te.value}),[(o.openBlock(),o.createElementBlock("svg",{width:W.value,height:W.value,viewBox:"0 0 24 24",fill:"none",stroke:R.value,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...l[2]||(l[2]=[o.createElementVNode("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"},null,-1),o.createElementVNode("path",{d:"M21 3v5h-5"},null,-1)])],8,m))],16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:2},oe.value,{style:te.value}),[(o.openBlock(),o.createElementBlock("svg",{width:W.value,height:W.value,viewBox:"0 0 24 24",fill:"none",stroke:R.value,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...l[3]||(l[3]=[o.createElementVNode("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"},null,-1),o.createElementVNode("path",{d:"M21 3v5h-5"},null,-1)])],8,g))],16))],32)):o.createCommentVNode("",!0),o.createElementVNode("div",o.mergeProps(y.value?o.unref(ve):{onPointerdown:e=>e.stopPropagation()},{style:X.value}),[x.value&&!U.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(me),({key:e,style:n,...l})=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:e},[o.unref(r)["resize-handle"]?o.renderSlot(t.$slots,"resize-handle",o.mergeProps({key:0,ref_for:!0},{key:e,style:n,...l,backgroundColor:S.value}),()=>[o.createElementVNode("div",o.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:S.value}]}),null,16)]):(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:S.value}]}),null,16))],64))),128)):o.createCommentVNode("",!0)],16)],4),ce.value?(o.openBlock(),o.createBlock(o.unref(n.CounterRotate),{key:0,rect:ae.value,rotation:e.rotation},{default:o.withCtx(({rect:n,menuWrapperProps:l})=>[e.groupSelectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(se(n,l)),{key:0})):o.renderSlot(t.$slots,"group-selection-menu",{key:1,context:re.value,selected:!0,rect:n,placement:ie.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):o.createCommentVNode("",!0),(U.value||f.value)&&k.value?(o.openBlock(),o.createBlock(o.Teleport,{key:1,to:"body"},[o.createElementVNode("div",{style:o.normalizeStyle(le.value)},o.toDisplayString(j.value.toFixed(0))+"°",5)])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0)}}),k=["width","height","viewBox"],f=["cx","cy","rx","ry","fill","opacity"],y=o.defineComponent({__name:"circle",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:a.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>{const e=t.rect.size.width,o=t.rect.size.height,n=Math.max(e-t.strokeWidth,0),l=Math.max(o-t.strokeWidth,0);return{width:e,height:o,cx:t.strokeWidth/2+n/2,cy:t.strokeWidth/2+l/2,rx:n/2,ry:l/2}}),l=o.computed(()=>n.value.width*t.scale),r=o.computed(()=>n.value.height*t.scale);return(t,i)=>{var c;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:l.value,height:r.value,pointerEvents:"none",zIndex:2}),width:l.value,height:r.value,viewBox:`0 0 ${n.value.width} ${n.value.height}`},[o.createElementVNode("ellipse",{cx:n.value.cx,cy:n.value.cy,rx:n.value.rx,ry:n.value.ry,fill:e.color,opacity:e.opacity,onPointerdown:i[0]||(i[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:i[1]||(i[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,...e.strokeStyle===o.unref(a.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(c=e.strokeDashArray)?void 0:c.join(",")}})},null,44,f)],12,k)}}}),x=["contenteditable"],C=o.defineComponent({__name:"free-text",props:{isSelected:{type:Boolean},isEditing:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(null),{provides:l}=s(),r=o.ref(!1);o.onMounted(()=>{try{const e=navigator;r.value=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1}catch{r.value=!1}}),o.watch(()=>t.isEditing,e=>{if(e&&n.value){const e=n.value;e.focus();const t=window.getSelection();if(t){const o=document.createRange();o.selectNodeContents(e),o.collapse(!1),t.removeAllRanges(),t.addRange(o)}}});const i=()=>{l.value&&n.value&&l.value.updateAnnotation(t.pageIndex,t.annotation.object.id,{contents:n.value.innerText})},c=o.computed(()=>{const{object:e}=t.annotation,o=e.fontSize*t.scale,n=r.value&&t.isEditing&&o>0&&o<16,l=n?16:o,i=n?o/16:1,c=n?100/i:100;return{color:e.fontColor,fontSize:`${l}px`,...a.standardFontCssProperties(e.fontFamily),textAlign:a.textAlignmentToCss(e.textAlign),flexDirection:"column",justifyContent:e.verticalAlign===a.PdfVerticalAlignment.Top?"flex-start":e.verticalAlign===a.PdfVerticalAlignment.Middle?"center":"flex-end",display:"flex",backgroundColor:e.color??e.backgroundColor,opacity:e.opacity,width:n?`${c}%`:"100%",height:n?`${c}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:t.isEditing?"text":"pointer",outline:"none",transform:n?`scale(${i})`:void 0,transformOrigin:"top left"}});return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle({position:"absolute",width:e.annotation.object.rect.size.width*e.scale+"px",height:e.annotation.object.rect.size.height*e.scale+"px",cursor:e.isSelected&&!e.isEditing?"move":"default",pointerEvents:e.isSelected&&!e.isEditing?"none":"auto",zIndex:2}),onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t))},[o.createElementVNode("span",{ref_key:"editorRef",ref:n,onBlur:i,tabindex:"0",style:o.normalizeStyle(c.value),contenteditable:e.isEditing},o.toDisplayString(e.annotation.object.contents),45,x)],36))}}),S=["width","height","viewBox"],b=["d","opacity"],w=o.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},strokeColor:{},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#000000"),l=o.computed(()=>t.inkList.map(({points:e})=>{let o="";return e.forEach(({x:e,y:n},l)=>{const a=e-t.rect.origin.x,r=n-t.rect.origin.y;o+=(0===l?"M":"L")+`${a} ${r} `}),o.trim()})),a=o.computed(()=>t.rect.size.width*t.scale),r=o.computed(()=>t.rect.size.height*t.scale);return(t,i)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${a.value}px`,height:`${r.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:a.value,height:r.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(t,l)=>(o.openBlock(),o.createElementBlock("path",{key:l,d:t,fill:"none",opacity:e.opacity,onPointerdown:i[0]||(i[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:i[1]||(i[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",stroke:n.value,strokeWidth:e.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,b))),128))],12,S))}}),z=["width","height","viewBox"],B=["x1","y1","x2","y2","opacity"],R=["d","transform","stroke","fill"],P=["d","transform","stroke","fill"],I=o.defineComponent({__name:"line",props:{color:{default:"transparent"},opacity:{default:1},strokeWidth:{},strokeColor:{default:"#000000"},strokeStyle:{default:a.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},linePoints:{},lineEndings:{},scale:{},onClick:{},isSelected:{type:Boolean}},setup(e){const n=e,l=o.computed(()=>({x1:n.linePoints.start.x-n.rect.origin.x,y1:n.linePoints.start.y-n.rect.origin.y,x2:n.linePoints.end.x-n.rect.origin.x,y2:n.linePoints.end.y-n.rect.origin.y})),r=o.computed(()=>{var e,o;const{x1:a,y1:r,x2:i,y2:c}=l.value,s=Math.atan2(c-r,i-a);return{start:t.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,s+Math.PI,a,r),end:t.patching.createEnding(null==(o=n.lineEndings)?void 0:o.end,n.strokeWidth,s,i,c)}}),i=e=>{var t;return{cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,strokeLinecap:"butt",pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",...n.strokeStyle===a.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},c=o.computed(()=>n.rect.size.width*n.scale),s=o.computed(()=>n.rect.size.height*n.scale);return(t,n)=>{var u;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${c.value}px`,height:`${s.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:c.value,height:s.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("line",{x1:l.value.x1,y1:l.value.y1,x2:l.value.x2,y2:l.value.y2,opacity:e.opacity,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",stroke:e.strokeColor,strokeWidth:e.strokeWidth,strokeLinecap:"butt",...e.strokeStyle===o.unref(a.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(u=e.strokeDashArray)?void 0:u.join(",")}})},null,44,B),r.value.start?(o.openBlock(),o.createElementBlock("path",{key:0,d:r.value.start.d,transform:r.value.start.transform,onPointerdown:n[2]||(n[2]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[3]||(n[3]=(...t)=>e.onClick&&e.onClick(...t)),stroke:e.strokeColor,style:o.normalizeStyle(i(r.value.start)),fill:r.value.start.filled?e.color:"none"},null,44,R)):o.createCommentVNode("",!0),r.value.end?(o.openBlock(),o.createElementBlock("path",{key:1,d:r.value.end.d,transform:r.value.end.transform,onPointerdown:n[4]||(n[4]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[5]||(n[5]=(...t)=>e.onClick&&e.onClick(...t)),stroke:e.strokeColor,style:o.normalizeStyle(i(r.value.end)),fill:r.value.end.filled?e.color:"none"},null,44,P)):o.createCommentVNode("",!0)],12,z)}}}),A=["width","height","viewBox"],E=["width","height"],$=["y1","x2","y2","stroke","stroke-width","stroke-dasharray"],M=["x","y","width","height","stroke","stroke-width","stroke-dasharray"],_=o.defineComponent({__name:"link",props:{isSelected:{type:Boolean},strokeColor:{default:"#0000FF"},strokeWidth:{default:2},strokeStyle:{default:a.PdfAnnotationBorderStyle.UNDERLINE},strokeDashArray:{},rect:{},scale:{},onClick:{},hasIRT:{type:Boolean,default:!1}},setup(e){const t=e,n=o.computed(()=>t.rect.size.width),l=o.computed(()=>t.rect.size.height),r=o.computed(()=>n.value*t.scale),i=o.computed(()=>l.value*t.scale),c=o.computed(()=>{var e;if(t.strokeStyle===a.PdfAnnotationBorderStyle.DASHED)return(null==(e=t.strokeDashArray)?void 0:e.join(","))??`${3*t.strokeWidth},${t.strokeWidth}`}),s=o.computed(()=>t.strokeStyle===a.PdfAnnotationBorderStyle.UNDERLINE),u=o.computed(()=>t.hasIRT?"default":t.isSelected?"move":"pointer"),d=o.computed(()=>t.hasIRT||t.isSelected?"none":"visible");return(t,a)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${r.value}px`,height:`${i.value}px`,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value} ${l.value}`},[o.createElementVNode("rect",{x:0,y:0,width:n.value,height:l.value,fill:"transparent",onPointerdown:a[0]||(a[0]=t=>e.hasIRT?void 0:e.onClick),onTouchstart:a[1]||(a[1]=t=>e.hasIRT?void 0:e.onClick),style:o.normalizeStyle({cursor:u.value,pointerEvents:d.value})},null,44,E),s.value?(o.openBlock(),o.createElementBlock("line",{key:0,x1:1,y1:l.value-1,x2:n.value-1,y2:l.value-1,stroke:e.strokeColor,"stroke-width":e.strokeWidth,"stroke-dasharray":c.value,style:{"pointer-events":"none"}},null,8,$)):(o.openBlock(),o.createElementBlock("rect",{key:1,x:e.strokeWidth/2,y:e.strokeWidth/2,width:Math.max(n.value-e.strokeWidth,0),height:Math.max(l.value-e.strokeWidth,0),fill:"transparent",stroke:e.strokeColor,"stroke-width":e.strokeWidth,"stroke-dasharray":c.value,style:{"pointer-events":"none"}},null,8,M))],12,A))}}),D=["width","height","viewBox"],N=["d","opacity"],V=["d"],U=["x","y","width","height","fill","stroke","stroke-width"],j=o.defineComponent({__name:"polygon",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},strokeStyle:{default:a.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},scale:{},isSelected:{type:Boolean},onClick:{},currentVertex:{},handleSize:{default:14}},setup(e){const t=e,n=o.computed(()=>t.currentVertex?[...t.vertices,t.currentVertex]:t.vertices),l=o.computed(()=>n.value.map(({x:e,y:o})=>({x:e-t.rect.origin.x,y:o-t.rect.origin.y}))),r=o.computed(()=>{if(!l.value.length)return"";const[e,...o]=l.value,n=!!t.currentVertex;return(`M ${e.x} ${e.y} `+o.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()}),i=o.computed(()=>t.currentVertex&&t.vertices.length>0),c=o.computed(()=>t.rect.size.width*t.scale),s=o.computed(()=>t.rect.size.height*t.scale);return(t,n)=>{var u;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${c.value}px`,height:`${s.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:c.value,height:s.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("path",{d:r.value,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),opacity:e.opacity,style:o.normalizeStyle({fill:e.currentVertex?"none":e.color,stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...e.strokeStyle===o.unref(a.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(u=e.strokeDashArray)?void 0:u.join(",")}})},null,44,N),i.value&&l.value.length>1?(o.openBlock(),o.createElementBlock("path",{key:0,d:`M ${l.value[l.value.length-1].x} ${l.value[l.value.length-1].y} L ${l.value[0].x} ${l.value[0].y}`,fill:"none",style:o.normalizeStyle({stroke:e.strokeColor,strokeWidth:e.strokeWidth,strokeDasharray:"4,4",opacity:.7})},null,12,V)):o.createCommentVNode("",!0),i.value&&l.value.length>=2?(o.openBlock(),o.createElementBlock("rect",{key:1,x:l.value[0].x-e.handleSize/e.scale/2,y:l.value[0].y-e.handleSize/e.scale/2,width:e.handleSize/e.scale,height:e.handleSize/e.scale,fill:e.strokeColor,opacity:.4,stroke:e.strokeColor,"stroke-width":e.strokeWidth/2},null,8,U)):o.createCommentVNode("",!0)],12,D)}}}),W=["width","height","viewBox"],F=["d","opacity"],O=["d","transform","stroke","fill"],L=["d","transform","stroke","fill"],T=o.defineComponent({__name:"polyline",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},scale:{},isSelected:{type:Boolean},onClick:{},lineEndings:{}},setup(e){const n=e,l=o.computed(()=>n.vertices.map(({x:e,y:t})=>({x:e-n.rect.origin.x,y:t-n.rect.origin.y}))),a=o.computed(()=>{if(0===l.value.length)return"";const[e,...t]=l.value;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("")).trim()}),r=o.computed(()=>{var e,o;if(l.value.length<2)return{start:null,end:null};const a=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),r=a(l.value[0],l.value[1]),i=a(l.value[l.value.length-2],l.value[l.value.length-1]);return{start:t.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,r+Math.PI,l.value[0].x,l.value[0].y),end:t.patching.createEnding(null==(o=n.lineEndings)?void 0:o.end,n.strokeWidth,i,l.value[l.value.length-1].x,l.value[l.value.length-1].y)}}),i=e=>({cursor:n.isSelected?"move":"pointer",strokeWidth:n.strokeWidth,pointerEvents:n.isSelected?"none":e.filled?"visible":"visibleStroke",strokeLinecap:"butt"}),c=o.computed(()=>n.rect.size.width*n.scale),s=o.computed(()=>n.rect.size.height*n.scale);return(t,n)=>(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:`${c.value}px`,height:`${s.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:c.value,height:s.value,viewBox:`0 0 ${e.rect.size.width} ${e.rect.size.height}`},[o.createElementVNode("path",{d:a.value,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),opacity:e.opacity,style:o.normalizeStyle({fill:"none",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"})},null,44,F),r.value.start?(o.openBlock(),o.createElementBlock("path",{key:0,d:r.value.start.d,transform:r.value.start.transform,stroke:e.strokeColor,fill:r.value.start.filled?e.color:"none",onPointerdown:n[2]||(n[2]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[3]||(n[3]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(i(r.value.start))},null,44,O)):o.createCommentVNode("",!0),r.value.end?(o.openBlock(),o.createElementBlock("path",{key:1,d:r.value.end.d,transform:r.value.end.transform,stroke:e.strokeColor,fill:r.value.end.filled?e.color:"none",onPointerdown:n[4]||(n[4]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[5]||(n[5]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(i(r.value.end))},null,44,L)):o.createCommentVNode("",!0)],12,W))}}),H=["width","height","viewBox"],G=["x","y","width","height","fill","opacity"],q=o.defineComponent({__name:"square",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:a.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>{const e=t.rect.size.width,o=t.rect.size.height;return{width:Math.max(e-t.strokeWidth,0),height:Math.max(o-t.strokeWidth,0),x:t.strokeWidth/2,y:t.strokeWidth/2}}),l=o.computed(()=>(n.value.width+t.strokeWidth)*t.scale),r=o.computed(()=>(n.value.height+t.strokeWidth)*t.scale);return(t,i)=>{var c;return o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({position:"absolute",width:l.value,height:r.value,pointerEvents:"none",zIndex:2}),width:l.value,height:r.value,viewBox:`0 0 ${n.value.width+e.strokeWidth} ${n.value.height+e.strokeWidth}`},[o.createElementVNode("rect",{x:n.value.x,y:n.value.y,width:n.value.width,height:n.value.height,fill:e.color,opacity:e.opacity,onPointerdown:i[0]||(i[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:i[1]||(i[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({cursor:e.isSelected?"move":"pointer",pointerEvents:e.isSelected?"none":"transparent"===e.color?"visibleStroke":"visible",stroke:e.strokeColor??e.color,strokeWidth:e.strokeWidth,...e.strokeStyle===o.unref(a.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(c=e.strokeDashArray)?void 0:c.join(",")}})},null,44,G)],12,H)}}}),Y=["src"],K=o.defineComponent({__name:"render-annotation",props:{documentId:{},pageIndex:{},annotation:{},scaleFactor:{default:1},unrotated:{type:Boolean,default:!1},style:{}},setup(e){const t=e,{provides:l}=s(),r=o.ref(null),i=o.ref(null),c=o.ref(null),u=o.computed(()=>t.annotation.id),d=o.computed(()=>t.annotation.rect.size.width),p=o.computed(()=>t.annotation.rect.size.height);o.watch(()=>[t.pageIndex,t.scaleFactor,t.unrotated,t.documentId,u.value,d.value,p.value,l.value],(e,o,s)=>{if(l.value){i.value&&(URL.revokeObjectURL(i.value),i.value=null);const e=l.value.forDocument(t.documentId).renderAnnotation({pageIndex:t.pageIndex,annotation:n.deepToRaw(t.annotation),options:{scaleFactor:t.scaleFactor,dpr:window.devicePixelRatio,unrotated:t.unrotated}});c.value=e,e.wait(e=>{const t=URL.createObjectURL(e);r.value=t,i.value=t},a.ignore),s(()=>{i.value?(URL.revokeObjectURL(i.value),i.value=null):e.abort({code:a.PdfErrorCode.Cancelled,message:"canceled render task"})})}},{immediate:!0}),o.onUnmounted(()=>{i.value&&(URL.revokeObjectURL(i.value),i.value=null),c.value&&c.value.abort({code:a.PdfErrorCode.Cancelled,message:"canceled render task on unmount"})});const v=()=>{i.value&&(URL.revokeObjectURL(i.value),i.value=null)};return(t,n)=>r.value?(o.openBlock(),o.createElementBlock("img",{key:0,src:r.value,onLoad:v,style:o.normalizeStyle({width:"100%",height:"100%",display:"block",...e.style})},null,44,Y)):o.createCommentVNode("",!0)}}),X=o.defineComponent({__name:"stamp",props:{isSelected:{type:Boolean},annotation:{},documentId:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(e){const t=e,n=o.computed(()=>!!t.annotation.object.rotation&&!!t.annotation.object.unrotatedRect);return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle({position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e.isSelected?"none":"auto",cursor:"pointer"}),onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t))},[o.createVNode(K,{documentId:e.documentId,pageIndex:e.pageIndex,annotation:{...e.annotation.object,id:e.annotation.object.id},scaleFactor:e.scale,unrotated:n.value},null,8,["documentId","pageIndex","annotation","scaleFactor","unrotated"])],36))}}),Q=o.defineComponent({__name:"highlight",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00");return(t,l)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,a)=>(o.openBlock(),o.createElementBlock("div",{key:a,onPointerdown:l[0]||(l[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:l[1]||(l[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:n.value,opacity:e.opacity,pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:void 0})},null,36))),128))}}),Z=o.defineComponent({__name:"squiggly",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale),a=o.computed(()=>6*t.scale),r=o.computed(()=>{const e=l.value,t=a.value,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${2*e}" viewBox="0 0 ${t} ${2*e}">\n <path d="M0 ${e} Q ${t/4} 0 ${t/2} ${e} T ${t} ${e}"\n fill="none" stroke="${n.value}" stroke-width="${e}" stroke-linecap="round"/>\n </svg>`;return`url("data:image/svg+xml;utf8,${encodeURIComponent(o)}")`});return(t,n)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,i)=>(o.openBlock(),o.createElementBlock("div",{key:i,onPointerdown:n[0]||(n[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:n[1]||(n[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:2*l.value+"px",backgroundImage:r.value,backgroundRepeat:"repeat-x",backgroundSize:`${a.value}px ${2*l.value}px`,opacity:e.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),J=o.defineComponent({__name:"strikeout",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale);return(t,a)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,r)=>(o.openBlock(),o.createElementBlock("div",{key:r,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,top:"50%",width:"100%",height:`${l.value}px`,background:n.value,opacity:e.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36))),128))}}),ee=o.defineComponent({__name:"underline",props:{strokeColor:{},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e,n=o.computed(()=>t.strokeColor??"#FFFF00"),l=o.computed(()=>2*t.scale);return(t,a)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.segmentRects,(t,r)=>(o.openBlock(),o.createElementBlock("div",{key:r,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle({position:"absolute",left:(e.rect?t.origin.x-e.rect.origin.x:t.origin.x)*e.scale+"px",top:(e.rect?t.origin.y-e.rect.origin.y:t.origin.y)*e.scale+"px",width:t.size.width*e.scale+"px",height:t.size.height*e.scale+"px",background:"transparent",pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:0})},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:`${l.value}px`,background:n.value,opacity:e.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),te=o.defineComponent({__name:"annotations",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUi:{},vertexUi:{},rotationUi:{},selectionOutlineColor:{},selectionOutline:{},groupSelectionOutline:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function},annotationRenderers:{}},setup(e){const n=e,l=(e,t=a.PdfBlendMode.Normal)=>({mixBlendMode:a.blendModeToCss(e.object.blendMode??t)}),c=e=>{var t;return null==(t=n.annotationRenderers)?void 0:t.find(t=>t.matches(e.object))},{provides:u}=s(),{provides:d}=i.useSelectionCapability(),v=o.ref([]),m=o.ref([]),{register:g}=r.usePointerHandlers({documentId:()=>n.documentId,pageIndex:n.pageIndex}),k=o.ref(null),f=o.computed(()=>u.value?u.value.forDocument(n.documentId):null),x=o.computed(()=>m.value.length>1);o.watchEffect(e=>{if(f.value){const o=f.value.getState();v.value=t.getAnnotationsByPageIndex(o,n.pageIndex),m.value=t.getSelectedAnnotationIds(o);e(f.value.onStateChange(e=>{v.value=t.getAnnotationsByPageIndex(e,n.pageIndex),m.value=t.getSelectedAnnotationIds(e)}))}});const S=(e,t)=>{t.target===t.currentTarget&&f.value&&(f.value.deselectAnnotation(),k.value=null)},b=(e,t)=>{if(e.stopPropagation(),f.value&&d.value){d.value.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?f.value.toggleSelection(n.pageIndex,t.object.id):f.value.selectAnnotation(n.pageIndex,t.object.id),t.object.id!==k.value&&(k.value=null)}},z=(e,t)=>{if(e.stopPropagation(),f.value&&d.value){if(d.value.clear(),t.object.inReplyToId){const e=t.object.inReplyToId,o=v.value.find(t=>t.object.id===e);if(o)return void f.value.selectAnnotation(o.object.pageIndex,e)}f.value.selectAnnotation(n.pageIndex,t.object.id)}};o.watchEffect(e=>{if(f.value){const t=g({onPointerDown:S});t&&e(t)}});const B=e=>m.value.includes(e.object.id),R=o.computed(()=>v.value.filter(e=>m.value.includes(e.object.id))),P=o.computed(()=>!(R.value.length<2)&&R.value.every(e=>{var o;const n=null==(o=f.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupDraggable,e.object,!0),a=t.resolveInteractionProp(null==n?void 0:n.interaction.isDraggable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupDraggable)?l:a})),A=o.computed(()=>!(R.value.length<2)&&R.value.every(e=>{var o;const n=null==(o=f.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupResizable,e.object,!0),a=t.resolveInteractionProp(null==n?void 0:n.interaction.isResizable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupResizable)?l:a})),E=o.computed(()=>!(R.value.length<2)&&R.value.every(e=>{var o;const n=null==(o=f.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.isGroupRotatable,e.object,!0),a=t.resolveInteractionProp(null==n?void 0:n.interaction.isRotatable,e.object,!0);return void 0!==(null==n?void 0:n.interaction.isGroupRotatable)?l:a})),$=o.computed(()=>!(R.value.length<2)&&R.value.some(e=>{var o;const n=null==(o=f.value)?void 0:o.findToolForAnnotation(e.object),l=t.resolveInteractionProp(null==n?void 0:n.interaction.lockGroupAspectRatio,e.object,!1),a=t.resolveInteractionProp(null==n?void 0:n.interaction.lockAspectRatio,e.object,!1);return void 0!==(null==n?void 0:n.interaction.lockGroupAspectRatio)?l:a})),M=o.computed(()=>{if(!f.value)return!1;if(m.value.length<2)return!1;return f.value.getSelectedAnnotations().every(e=>e.object.pageIndex===n.pageIndex)}),D=e=>{var t;return null==(t=f.value)?void 0:t.findToolForAnnotation(e.object)},N=e=>{var o;return(!t.isFreeText(e)||k.value!==e.object.id)&&(!x.value&&t.resolveInteractionProp(null==(o=D(e))?void 0:o.interaction.isDraggable,e.object,!1))},V=e=>{var o;return!x.value&&t.resolveInteractionProp(null==(o=D(e))?void 0:o.interaction.isResizable,e.object,!1)},U=e=>{var o;return t.resolveInteractionProp(null==(o=D(e))?void 0:o.interaction.lockAspectRatio,e.object,!1)},W=(e,o)=>{var n;return!x.value&&t.resolveInteractionProp(null==(n=D(e))?void 0:n.interaction.isRotatable,e.object,o)},F=e=>B(e)&&!x.value,O=o.computed(()=>{const{selectionMenu:e,groupSelectionMenu:t,groupSelectionOutline:o,...l}=n;return l}),L=e=>t.isLine(e)?{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})}:t.isPolyline(e)||t.isPolygon(e)?{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})}:void 0;return(n,r)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.value,r=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:r.object.id},[c(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:0,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!1),lockAspectRatio:U(r),onSelect:e=>b(e,r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(c(r).component),{annotation:r,isSelected:B(r),scale:e.scale,pageIndex:e.pageIndex,onClick:e=>b(e,r)},null,8,["annotation","isSelected","scale","pageIndex","onClick"]))]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","selectionMenu","style"])):o.unref(t.isInk)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:1,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(w,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>b(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isSquare)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:2,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(q,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>b(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isCircle)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:3,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(y,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>b(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isLine)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:4,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(I,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>b(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isPolyline)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:5,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(T,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>b(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isPolygon)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:6,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(j,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>b(e,r)}),null,16,["isSelected","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isFreeText)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:7,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),onDoubleClick:e=>{return o=r.object.id,void(t.isFreeText(v.value.find(e=>e.object.id===o))&&(k.value=o));var o},vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(C,{isSelected:B(r),isEditing:k.value===r.object.id,annotation:{...r,object:t},pageIndex:e.pageIndex,scale:e.scale,onClick:e=>b(e,r)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","selectionMenu","style"])):o.unref(t.isStamp)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:8,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!0),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(()=>[o.createVNode(X,{documentId:e.documentId,isSelected:B(r),annotation:r,pageIndex:e.pageIndex,scale:e.scale,onClick:e=>b(e,r)},null,8,["documentId","isSelected","annotation","pageIndex","scale","onClick"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"vertex-handle",o.mergeProps({ref_for:!0},e))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isUnderline)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:9,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!1),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(ee,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,r)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isStrikeout)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:10,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!1),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(J,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,r)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isSquiggly)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:11,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!1),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(Z,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,r)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isHighlight)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:12,trackedAnnotation:r,isSelected:F(r),isDraggable:N(r),isResizable:V(r),isRotatable:W(r,!1),lockAspectRatio:U(r),onSelect:e=>b(e,r),vertexConfig:L(r),selectionMenu:x.value?void 0:e.selectionMenu,zIndex:0,style:l(r,o.unref(a.PdfBlendMode).Multiply)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(Q,o.mergeProps({ref_for:!0},t,{scale:e.scale,onClick:e=>b(e,r)}),null,16,["scale","onClick"])]),_:2},[x.value?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isDraggable","isResizable","isRotatable","lockAspectRatio","onSelect","vertexConfig","selectionMenu","style"])):o.unref(t.isLink)(r)?(o.openBlock(),o.createBlock(p,o.mergeProps({key:13,trackedAnnotation:r,isSelected:F(r),isMultiSelected:x.value,isDraggable:!1,isResizable:!1,isRotatable:!1,lockAspectRatio:!1,onSelect:e=>z(e,r),selectionMenu:r.object.inReplyToId||x.value?void 0:e.selectionMenu,style:l(r)},{ref_for:!0},O.value),o.createSlots({default:o.withCtx(({annotation:t})=>[o.createVNode(_,o.mergeProps({ref_for:!0},t,{isSelected:B(r),scale:e.scale,onClick:e=>z(e,r),hasIRT:!!r.object.inReplyToId}),null,16,["isSelected","scale","onClick","hasIRT"])]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.mergeProps({ref_for:!0},e))]),_:2},[x.value||r.object.inReplyToId?void 0:{name:"selection-menu",fn:o.withCtx(e=>[o.renderSlot(n.$slots,"selection-menu",o.mergeProps({ref_for:!0},e))]),key:"0"}]),1040,["trackedAnnotation","isSelected","isMultiSelected","onSelect","selectionMenu","style"])):o.createCommentVNode("",!0)],64))),128)),M.value&&R.value.length>=2?(o.openBlock(),o.createBlock(h,{key:0,documentId:e.documentId,pageIndex:e.pageIndex,scale:e.scale,rotation:e.rotation,pageWidth:e.pageWidth,pageHeight:e.pageHeight,selectedAnnotations:R.value,isDraggable:P.value,isResizable:A.value,isRotatable:E.value,lockAspectRatio:$.value,resizeUi:e.resizeUi,rotationUi:e.rotationUi,selectionOutlineColor:e.selectionOutlineColor,selectionOutline:e.groupSelectionOutline??e.selectionOutline,groupSelectionMenu:e.groupSelectionMenu},{"group-selection-menu":o.withCtx(e=>[o.renderSlot(n.$slots,"group-selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"resize-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"resize-handle",o.normalizeProps(o.guardReactiveProps(e)))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(n.$slots,"rotation-handle",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","selectedAnnotations","isDraggable","isResizable","isRotatable","lockAspectRatio","resizeUi","rotationUi","selectionOutlineColor","selectionOutline","groupSelectionMenu"])):o.createCommentVNode("",!0)],64))}}),oe=o.defineComponent({__name:"text-markup",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{provides:n}=i.useSelectionCapability(),{provides:l}=s(),r=o.ref([]),c=o.ref(null),u=o.ref(null);o.watchEffect(e=>{const o=[];if(n.value){const e=n.value.forDocument(t.documentId),l=e.onSelectionChange(()=>{r.value=e.getHighlightRectsForPage(t.pageIndex),c.value=e.getBoundingRectForPage(t.pageIndex)});o.push(l)}if(l.value){const e=l.value.forDocument(t.documentId);u.value=e.getActiveTool();const n=e.onActiveToolChange(e=>u.value=e);o.push(n)}e(()=>{o.forEach(e=>e())})});const d=o.computed(()=>{if(!u.value)return a.blendModeToCss(a.PdfBlendMode.Normal);const e=u.value.defaults.type===a.PdfAnnotationSubtype.HIGHLIGHT?a.PdfBlendMode.Multiply:a.PdfBlendMode.Normal;return a.blendModeToCss(u.value.defaults.blendMode??e)});return(t,n)=>c.value&&u.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({mixBlendMode:d.value,pointerEvents:"none",position:"absolute",inset:0})},[u.value.defaults.type===o.unref(a.PdfAnnotationSubtype).HIGHLIGHT?(o.openBlock(),o.createBlock(Q,{key:0,strokeColor:u.value.defaults.strokeColor,opacity:u.value.defaults.opacity,segmentRects:r.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):u.value.defaults.type===o.unref(a.PdfAnnotationSubtype).UNDERLINE?(o.openBlock(),o.createBlock(ee,{key:1,strokeColor:u.value.defaults.strokeColor,opacity:u.value.defaults.opacity,segmentRects:r.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):u.value.defaults.type===o.unref(a.PdfAnnotationSubtype).STRIKEOUT?(o.openBlock(),o.createBlock(J,{key:2,strokeColor:u.value.defaults.strokeColor,opacity:u.value.defaults.opacity,segmentRects:r.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):u.value.defaults.type===o.unref(a.PdfAnnotationSubtype).SQUIGGLY?(o.openBlock(),o.createBlock(Z,{key:3,strokeColor:u.value.defaults.strokeColor,opacity:u.value.defaults.opacity,segmentRects:r.value,scale:e.scale},null,8,["strokeColor","opacity","segmentRects","scale"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)}}),ne=o.defineComponent({__name:"preview-renderer",props:{preview:{},scale:{}},setup(e){const t=e,n=o.computed(()=>({position:"absolute",left:t.preview.bounds.origin.x*t.scale+"px",top:t.preview.bounds.origin.y*t.scale+"px",width:t.preview.bounds.size.width*t.scale+"px",height:t.preview.bounds.size.height*t.scale+"px",pointerEvents:"none",zIndex:10}));return(t,l)=>(o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle(n.value)},[e.preview.type===o.unref(a.PdfAnnotationSubtype).CIRCLE?(o.openBlock(),o.createBlock(o.unref(y),o.mergeProps({key:0,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(a.PdfAnnotationSubtype).SQUARE?(o.openBlock(),o.createBlock(o.unref(q),o.mergeProps({key:1,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(a.PdfAnnotationSubtype).POLYGON?(o.openBlock(),o.createBlock(o.unref(j),o.mergeProps({key:2,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(a.PdfAnnotationSubtype).POLYLINE?(o.openBlock(),o.createBlock(o.unref(T),o.mergeProps({key:3,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(a.PdfAnnotationSubtype).LINE?(o.openBlock(),o.createBlock(o.unref(I),o.mergeProps({key:4,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(a.PdfAnnotationSubtype).INK?(o.openBlock(),o.createBlock(o.unref(w),o.mergeProps({key:5,isSelected:!1,scale:e.scale},e.preview.data),null,16,["scale"])):e.preview.type===o.unref(a.PdfAnnotationSubtype).FREETEXT?(o.openBlock(),o.createElementBlock("div",{key:6,style:o.normalizeStyle({width:"100%",height:"100%",border:`1px dashed ${e.preview.data.fontColor||"#000000"}`,backgroundColor:"transparent"})},null,4)):o.createCommentVNode("",!0)],4))}}),le=o.defineComponent({__name:"annotation-paint-layer",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{plugin:n}=c(),l=o.ref(new Map),a=o.ref(null),r=o.ref(null),i=o.computed(()=>({requestFile:({accept:e,onFile:t})=>{const o=a.value;o&&(o.accept=e,o.onchange=e=>{var n;const l=null==(n=e.target.files)?void 0:n[0];l&&(t(l),o.value="")},o.click())},processImage:({source:e,maxWidth:t,maxHeight:o,onComplete:n})=>{const l=r.value;if(!l||!l.getContext)return;const a=l.getContext("2d");if(!a)return;const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{let{naturalWidth:r,naturalHeight:c}=i;const s=t?t/r:1,u=o?o/c:1,d=Math.min(s,u,1),p=r*d,v=c*d;l.width=p,l.height=v,a.drawImage(i,0,0,p,v);const m=a.getImageData(0,0,p,v);"string"!=typeof e&&URL.revokeObjectURL(i.src),n({imageData:m,width:p,height:v})},i.src="string"==typeof e?e:URL.createObjectURL(e)}}));let s;return o.watchEffect(e=>{n.value&&(s=n.value.registerPageHandlers(t.documentId,t.pageIndex,t.scale,{services:i.value,onPreview:(e,t)=>{const o=new Map(l.value);t?o.set(e,t):o.delete(e),l.value=o}})),e(()=>{null==s||s()})}),(t,n)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("input",{ref_key:"fileInputRef",ref:a,type:"file",style:{display:"none"}},null,512),o.createElementVNode("canvas",{ref_key:"canvasRef",ref:r,style:{display:"none"}},null,512),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value.entries(),([t,n])=>(o.openBlock(),o.createBlock(ne,{key:t,preview:n,scale:e.scale},null,8,["preview","scale"]))),128))],64))}}),ae=Symbol("AnnotationRendererRegistry");function re(){const e=o.shallowRef([]);return{register(t){const o=new Set(t.map(e=>e.id));return e.value=[...e.value.filter(e=>!o.has(e.id)),...t],()=>{e.value=e.value.filter(e=>!t.some(t=>t.id===e.id))}},getAll:()=>e.value}}function ie(){const e=re();return o.provide(ae,e),e}function ce(){return o.inject(ae,null)}const se=o.defineComponent({__name:"annotation-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},resizeUi:{},resizeUI:{},vertexUi:{},vertexUI:{},rotationUi:{},selectionOutlineColor:{},selectionOutline:{},groupSelectionOutline:{},selectionMenu:{type:Function},groupSelectionMenu:{type:Function},annotationRenderers:{}},setup(e){const t=e,n=o.computed(()=>t.resizeUi??t.resizeUI),a=o.computed(()=>t.vertexUi??t.vertexUI);o.onMounted(()=>{t.resizeUI&&console.warn('[AnnotationLayer] The "resizeUI" prop is deprecated. Use :resize-ui in templates instead.'),t.vertexUI&&console.warn('[AnnotationLayer] The "vertexUI" prop is deprecated. Use :vertex-ui in templates instead.')});const r=ce(),i=o.computed(()=>{const e=(null==r?void 0:r.getAll())??[],o=t.annotationRenderers??[],n=[...e];for(const t of o){const e=n.findIndex(e=>e.id===t.id);e>=0?n[e]=t:n.push(t)}return n}),c=l.useDocumentState(()=>t.documentId),s=o.computed(()=>{var e,o,n;return null==(n=null==(o=null==(e=c.value)?void 0:e.document)?void 0:o.pages)?void 0:n[t.pageIndex]}),u=o.computed(()=>{var e,t;return(null==(t=null==(e=s.value)?void 0:e.size)?void 0:t.width)??0}),d=o.computed(()=>{var e,t;return(null==(t=null==(e=s.value)?void 0:e.size)?void 0:t.height)??0}),p=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=c.value)?void 0:e.scale)??1}),v=o.computed(()=>{var e,o;if(void 0!==t.rotation)return t.rotation;return(((null==(e=s.value)?void 0:e.rotation)??0)+((null==(o=c.value)?void 0:o.rotation)??0))%4});return(t,l)=>(o.openBlock(),o.createElementBlock("div",null,[o.createVNode(te,{documentId:e.documentId,pageIndex:e.pageIndex,scale:p.value,rotation:v.value,pageWidth:u.value,pageHeight:d.value,resizeUi:n.value,vertexUi:a.value,rotationUi:e.rotationUi,selectionOutlineColor:e.selectionOutlineColor,selectionOutline:e.selectionOutline,groupSelectionOutline:e.groupSelectionOutline,selectionMenu:e.selectionMenu,groupSelectionMenu:e.groupSelectionMenu,annotationRenderers:i.value},{"selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"group-selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"group-selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),"resize-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"resize-handle",o.normalizeProps(o.guardReactiveProps(e)))]),"vertex-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"vertex-handle",o.normalizeProps(o.guardReactiveProps(e)))]),"rotation-handle":o.withCtx(e=>[o.renderSlot(t.$slots,"rotation-handle",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","resizeUi","vertexUi","rotationUi","selectionOutlineColor","selectionOutline","groupSelectionOutline","selectionMenu","groupSelectionMenu","annotationRenderers"]),o.createVNode(oe,{documentId:e.documentId,pageIndex:e.pageIndex,scale:p.value},null,8,["documentId","pageIndex","scale"]),o.createVNode(le,{documentId:e.documentId,pageIndex:e.pageIndex,scale:p.value},null,8,["documentId","pageIndex","scale"])]))}}),ue=o.defineComponent({__name:"renderer-registry-provider",setup:e=>(ie(),(e,t)=>o.renderSlot(e.$slots,"default"))}),de=e.createPluginPackage(t.AnnotationPluginPackage).addWrapper(ue).build();exports.AnnotationContainer=p,exports.AnnotationLayer=se,exports.AnnotationPaintLayer=le,exports.AnnotationPluginPackage=de,exports.Annotations=te,exports.Circle=y,exports.FreeText=C,exports.GroupSelectionBox=h,exports.Highlight=Q,exports.Ink=w,exports.Line=I,exports.Link=_,exports.Polygon=j,exports.Polyline=T,exports.PreviewRenderer=ne,exports.RenderAnnotation=K,exports.RendererRegistryProvider=ue,exports.Square=q,exports.Squiggly=Z,exports.Stamp=X,exports.Strikeout=J,exports.TextMarkup=oe,exports.Underline=ee,exports.createRenderer=function(e){return{id:e.id,matches:e.matches,component:o.markRaw(e.component)}},exports.createRendererRegistry=re,exports.provideRendererRegistry=ie,exports.useAnnotation=e=>{var n,l;const{provides:a}=s(),r=o.ref((null==(l=null==(n=null==a?void 0:a.value)?void 0:n.forDocument(o.toValue(e)))?void 0:l.getState())??t.initialDocumentState());return o.watch([a,()=>o.toValue(e)],([e,t],o,n)=>{if(e&&t){const o=e.forDocument(t);r.value=o.getState();n(o.onStateChange(e=>{r.value=e}))}},{immediate:!0}),{state:r,provides:o.computed(()=>{var t;return(null==(t=a.value)?void 0:t.forDocument(o.toValue(e)))??null})}},exports.useAnnotationCapability=s,exports.useAnnotationPlugin=c,exports.useRegisterRenderers=function(e){const t=ce();if(!t)return;const n=t.register(e);o.onUnmounted(n)},exports.useRendererRegistry=ce,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
2
2
  //# sourceMappingURL=index.cjs.map