@embedpdf/plugin-annotation 1.5.0 → 2.0.0-next.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 (106) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1760 -1444
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +58 -19
  6. package/dist/lib/annotation-plugin.d.ts +14 -5
  7. package/dist/lib/index.d.ts +1 -1
  8. package/dist/lib/reducer.d.ts +2 -1
  9. package/dist/lib/selectors.d.ts +10 -8
  10. package/dist/lib/types.d.ts +53 -10
  11. package/dist/preact/index.cjs +1 -1
  12. package/dist/preact/index.cjs.map +1 -1
  13. package/dist/preact/index.js +96 -48
  14. package/dist/preact/index.js.map +1 -1
  15. package/dist/react/index.cjs +1 -1
  16. package/dist/react/index.cjs.map +1 -1
  17. package/dist/react/index.js +96 -48
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/shared/components/annotation-container.d.ts +4 -3
  20. package/dist/shared/components/annotation-layer.d.ts +7 -7
  21. package/dist/shared/components/annotation-paint-layer.d.ts +2 -1
  22. package/dist/shared/components/annotations/stamp.d.ts +2 -1
  23. package/dist/shared/components/annotations.d.ts +3 -2
  24. package/dist/shared/components/render-annotation.d.ts +2 -1
  25. package/dist/shared/components/text-markup.d.ts +2 -1
  26. package/dist/shared/components/types.d.ts +7 -7
  27. package/dist/shared/hooks/use-annotation.d.ts +8 -4
  28. package/dist/shared/index.d.ts +1 -0
  29. package/dist/shared-preact/components/annotation-container.d.ts +4 -3
  30. package/dist/shared-preact/components/annotation-layer.d.ts +7 -7
  31. package/dist/shared-preact/components/annotation-paint-layer.d.ts +2 -1
  32. package/dist/shared-preact/components/annotations/stamp.d.ts +2 -1
  33. package/dist/shared-preact/components/annotations.d.ts +3 -2
  34. package/dist/shared-preact/components/render-annotation.d.ts +2 -1
  35. package/dist/shared-preact/components/text-markup.d.ts +2 -1
  36. package/dist/shared-preact/components/types.d.ts +7 -7
  37. package/dist/shared-preact/hooks/use-annotation.d.ts +8 -4
  38. package/dist/shared-preact/index.d.ts +1 -0
  39. package/dist/shared-react/components/annotation-container.d.ts +4 -3
  40. package/dist/shared-react/components/annotation-layer.d.ts +7 -7
  41. package/dist/shared-react/components/annotation-paint-layer.d.ts +2 -1
  42. package/dist/shared-react/components/annotations/stamp.d.ts +2 -1
  43. package/dist/shared-react/components/annotations.d.ts +3 -2
  44. package/dist/shared-react/components/render-annotation.d.ts +2 -1
  45. package/dist/shared-react/components/text-markup.d.ts +2 -1
  46. package/dist/shared-react/components/types.d.ts +7 -7
  47. package/dist/shared-react/hooks/use-annotation.d.ts +8 -4
  48. package/dist/shared-react/index.d.ts +1 -0
  49. package/dist/svelte/components/AnnotationContainer.svelte.d.ts +26 -0
  50. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +27 -0
  51. package/dist/svelte/components/AnnotationPaintLayer.svelte.d.ts +8 -0
  52. package/dist/svelte/components/Annotations.svelte.d.ts +22 -0
  53. package/dist/svelte/components/PreviewRenderer.svelte.d.ts +8 -0
  54. package/dist/svelte/components/RenderAnnotation.svelte.d.ts +13 -0
  55. package/dist/svelte/components/TextMarkup.svelte.d.ts +8 -0
  56. package/dist/svelte/components/annotations/Circle.svelte.d.ts +26 -0
  57. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +15 -0
  58. package/dist/svelte/components/annotations/Ink.svelte.d.ts +14 -0
  59. package/dist/svelte/components/annotations/Line.svelte.d.ts +18 -0
  60. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +19 -0
  61. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +17 -0
  62. package/dist/svelte/components/annotations/Square.svelte.d.ts +16 -0
  63. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +13 -0
  64. package/dist/svelte/components/annotations/index.d.ts +8 -0
  65. package/dist/svelte/components/index.d.ts +9 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +13 -0
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +13 -0
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +13 -0
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +13 -0
  70. package/dist/svelte/components/text-markup/index.d.ts +4 -0
  71. package/dist/svelte/components/types.d.ts +32 -0
  72. package/dist/svelte/hooks/index.d.ts +1 -0
  73. package/dist/svelte/hooks/use-annotation.svelte.d.ts +21 -0
  74. package/dist/svelte/index.cjs +2 -0
  75. package/dist/svelte/index.cjs.map +1 -0
  76. package/dist/svelte/index.d.ts +4 -0
  77. package/dist/svelte/index.js +3083 -0
  78. package/dist/svelte/index.js.map +1 -0
  79. package/dist/svelte/types.d.ts +54 -0
  80. package/dist/vue/components/annotation-container.vue.d.ts +10 -5
  81. package/dist/vue/components/annotation-layer.vue.d.ts +13 -7
  82. package/dist/vue/components/annotation-paint-layer.vue.d.ts +3 -1
  83. package/dist/vue/components/annotations/circle.vue.d.ts +2 -1
  84. package/dist/vue/components/annotations/free-text.vue.d.ts +2 -1
  85. package/dist/vue/components/annotations/ink.vue.d.ts +2 -1
  86. package/dist/vue/components/annotations/line.vue.d.ts +2 -1
  87. package/dist/vue/components/annotations/polygon.vue.d.ts +2 -1
  88. package/dist/vue/components/annotations/polyline.vue.d.ts +2 -1
  89. package/dist/vue/components/annotations/square.vue.d.ts +2 -1
  90. package/dist/vue/components/annotations/stamp.vue.d.ts +3 -1
  91. package/dist/vue/components/annotations.vue.d.ts +7 -3
  92. package/dist/vue/components/preview-renderer.vue.d.ts +2 -1
  93. package/dist/vue/components/render-annotation.vue.d.ts +3 -1
  94. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -1
  95. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -1
  96. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -1
  97. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -1
  98. package/dist/vue/components/text-markup.vue.d.ts +3 -1
  99. package/dist/vue/hooks/use-annotation.d.ts +21 -2682
  100. package/dist/vue/index.cjs +1 -1
  101. package/dist/vue/index.cjs.map +1 -1
  102. package/dist/vue/index.d.ts +1 -0
  103. package/dist/vue/index.js +354 -250
  104. package/dist/vue/index.js.map +1 -1
  105. package/dist/vue/types.d.ts +23 -0
  106. package/package.json +19 -11
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("@embedpdf/core/vue"),o=require("@embedpdf/plugin-annotation"),n=require("@embedpdf/utils/vue"),l=require("@embedpdf/models"),r=require("@embedpdf/plugin-interaction-manager/vue"),i=require("@embedpdf/plugin-selection/vue"),a=()=>t.usePlugin(o.AnnotationPlugin.id),s=()=>t.useCapability(o.AnnotationPlugin.id),c={"data-no-interaction":""},d="#007ACC",u="#007ACC",p=e.defineComponent({__name:"annotation-container",props:{scale:{},pageIndex:{},rotation:{},pageWidth:{},pageHeight:{},trackedAnnotation:{},isSelected:{type:Boolean},isDraggable:{type:Boolean},isResizable:{type:Boolean},lockAspectRatio:{type:Boolean,default:!1},vertexConfig:{},outlineOffset:{default:1},onDoubleClick:{},onSelect:{},zIndex:{default:1},selectionOutlineColor:{default:"#007ACC"}},setup(t){const o=t,l=e.shallowRef(e.toRaw(o.trackedAnnotation.object)),{provides:r}=s(),i=e.ref(null),a=e.computed((()=>({...e.toRaw(o.trackedAnnotation.object),...e.toRaw(l.value)}))),p=e.computed((()=>e.toRaw(a.value).rect)),v=e.computed((()=>{var t;const n=e.toRaw(a.value);return(null==(t=o.vertexConfig)?void 0:t.extractVertices(n))??[]})),k=e.computed((()=>({minWidth:10,minHeight:10,boundingBox:{width:o.pageWidth/o.scale,height:o.pageHeight/o.scale}}))),{dragProps:g,vertices:f,resize:h}=n.useInteractionHandles({controller:{element:p,vertices:v,constraints:k,maintainAspectRatio:e.computed((()=>o.lockAspectRatio)),pageRotation:e.computed((()=>o.rotation)),scale:e.computed((()=>o.scale)),enabled:e.computed((()=>o.isSelected)),onUpdate:t=>{var n,s,c,d;if(!(null==(n=t.transformData)?void 0:n.type))return;"start"===t.state&&(i.value=a.value);const u=i.value??a.value,p=t.transformData.changes.vertices?null==(s=o.vertexConfig)?void 0:s.transformAnnotation(e.toRaw(u),t.transformData.changes.vertices):{rect:t.transformData.changes.rect},v=null==(c=r.value)?void 0:c.transformAnnotation(u,{type:t.transformData.type,changes:p,metadata:t.transformData.metadata});v&&(l.value={...e.toRaw(l.value),...v}),"end"===t.state&&v&&(i.value=null,null==(d=r.value)||d.updateAnnotation(o.pageIndex,o.trackedAnnotation.object.id,v))}},resizeUI:{handleSize:12,spacing:o.outlineOffset,offsetMode:"outside",includeSides:!o.lockAspectRatio,zIndex:o.zIndex+1},vertexUI:{vertexSize:12,zIndex:o.zIndex+2},includeVertices:!!o.vertexConfig}),m=n.useDoublePressProps(o.onDoubleClick);e.watch((()=>o.trackedAnnotation.object),(e=>{l.value=e}),{deep:!0});const y=e.computed((()=>({position:"absolute",left:a.value.rect.origin.x*o.scale+"px",top:a.value.rect.origin.y*o.scale+"px",width:a.value.rect.size.width*o.scale+"px",height:a.value.rect.size.height*o.scale+"px",outline:o.isSelected?`1px solid ${o.selectionOutlineColor}`:"none",outlineOffset:o.isSelected?`${o.outlineOffset}px`:"0px",pointerEvents:o.isSelected?"auto":"none",touchAction:"none",cursor:o.isSelected&&o.isDraggable?"move":"default",zIndex:o.zIndex}))),x=e.useSlots();return(t,o)=>(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("div",e.mergeProps({...e.unref(g),...e.unref(m)},{style:y.value}),[e.renderSlot(t.$slots,"default",{annotation:a.value}),t.isSelected&&t.isResizable?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(h),(({key:o,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(x)["resize-handle"]?e.renderSlot(t.$slots,"resize-handle",e.mergeProps({key:0,ref_for:!0},{key:o,style:n,...l,backgroundColor:d}),(()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:d}]}),null,16)])):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:d}]}),null,16))],64)))),128)):e.createCommentVNode("",!0),t.isSelected&&e.unref(f).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(f),(({key:o,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(x)["vertex-handle"]?e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({key:0,ref_for:!0},{key:o,style:n,...l,backgroundColor:u}),(()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:u}]}),null,16)])):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:u}]}),null,16))],64)))),128)):e.createCommentVNode("",!0)],16),e.createVNode(e.unref(n.CounterRotate),{rect:{origin:{x:a.value.rect.origin.x*t.scale,y:a.value.rect.origin.y*t.scale},size:{width:a.value.rect.size.width*t.scale,height:a.value.rect.size.height*t.scale}},rotation:t.rotation},{default:e.withCtx((({rect:o,menuWrapperProps:n})=>[e.renderSlot(t.$slots,"selection-menu",{annotation:t.trackedAnnotation,selected:t.isSelected,rect:o,menuWrapperProps:n})])),_:3},8,["rect","rotation"])]))}}),v=["width","height","viewBox"],k=["cx","cy","rx","ry","fill","opacity"],g=e.defineComponent({__name:"circle",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed((()=>{const e=o.rect.size.width,t=o.rect.size.height,n=Math.max(e-o.strokeWidth,0),l=Math.max(t-o.strokeWidth,0);return{width:e,height:t,cx:o.strokeWidth/2+n/2,cy:o.strokeWidth/2+l/2,rx:n/2,ry:l/2}})),r=e.computed((()=>n.value.width*o.scale)),i=e.computed((()=>n.value.height*o.scale));return(t,o)=>{var a;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:r.value,height:i.value,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value.width} ${n.value.height}`},[e.createElementVNode("ellipse",{cx:n.value.cx,cy:n.value.cy,rx:n.value.rx,ry:n.value.ry,fill:t.color,opacity:t.opacity,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(a=t.strokeDashArray)?void 0:a.join(",")}})},null,44,k)],12,v)}}}),f=["contenteditable"],h=e.defineComponent({__name:"free-text",props:{isSelected:{type:Boolean},isEditing:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(t){const o=t,n=e.ref(null),{provides:r}=s(),i=e.ref(!1);e.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}})),e.watch((()=>o.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=()=>{r.value&&n.value&&r.value.updateAnnotation(o.pageIndex,o.annotation.object.id,{contents:n.value.innerText})},c=e.computed((()=>{const{object:e}=o.annotation,t=e.fontSize*o.scale,n=i.value&&o.isEditing&&t>0&&t<16,r=n?16:t,a=n?t/16:1,s=n?100/a:100;return{color:e.fontColor,fontSize:`${r}px`,fontFamily:l.standardFontCss(e.fontFamily),textAlign:l.textAlignmentToCss(e.textAlign),flexDirection:"column",justifyContent:e.verticalAlign===l.PdfVerticalAlignment.Top?"flex-start":e.verticalAlign===l.PdfVerticalAlignment.Middle?"center":"flex-end",display:"flex",backgroundColor:e.backgroundColor,opacity:e.opacity,width:n?`${s}%`:"100%",height:n?`${s}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:o.isEditing?"text":"pointer",outline:"none",transform:n?`scale(${a})`:void 0,transformOrigin:"top left"}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({position:"absolute",width:t.annotation.object.rect.size.width*t.scale+"px",height:t.annotation.object.rect.size.height*t.scale+"px",cursor:t.isSelected&&!t.isEditing?"move":"default",pointerEvents:t.isSelected&&!t.isEditing?"none":"auto",zIndex:2}),onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e))},[e.createElementVNode("span",{ref_key:"editorRef",ref:n,onBlur:a,tabindex:"0",style:e.normalizeStyle(c.value),contenteditable:t.isEditing},e.toDisplayString(t.annotation.object.contents),45,f)],36))}}),m=["width","height","viewBox"],y=["d","opacity"],x=e.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},color:{default:"#000000"},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed((()=>o.inkList.map((({points:e})=>{let t="";return e.forEach((({x:e,y:n},l)=>{const r=e-o.rect.origin.x,i=n-o.rect.origin.y;t+=(0===l?"M":"L")+`${r} ${i} `})),t.trim()})))),l=e.computed((()=>o.rect.size.width*o.scale)),r=e.computed((()=>o.rect.size.height*o.scale));return(t,o)=>(e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:`${l.value}px`,height:`${r.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:l.value,height:r.value,viewBox:`0 0 ${t.rect.size.width} ${t.rect.size.height}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,((n,l)=>(e.openBlock(),e.createElementBlock("path",{key:l,d:n,fill:"none",opacity:t.opacity,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",stroke:t.color,strokeWidth:t.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,y)))),128))],12,m))}}),C=["width","height","viewBox"],b=["x1","y1","x2","y2","opacity"],S=["d","transform","stroke","fill"],w=["d","transform","stroke","fill"],B=e.defineComponent({__name:"line",props:{color:{default:"transparent"},opacity:{default:1},strokeWidth:{},strokeColor:{default:"#000000"},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},linePoints:{},lineEndings:{},scale:{},onClick:{},isSelected:{type:Boolean}},setup(t){const n=t,r=e.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=e.computed((()=>{var e,t;const{x1:l,y1:i,x2:a,y2:s}=r.value,c=Math.atan2(s-i,a-l);return{start:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,c+Math.PI,l,i),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.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===l.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},s=e.computed((()=>n.rect.size.width*n.scale)),c=e.computed((()=>n.rect.size.height*n.scale));return(t,o)=>{var n;return e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("line",{x1:r.value.x1,y1:r.value.y1,x2:r.value.x2,y2:r.value.y2,opacity:t.opacity,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",stroke:t.strokeColor,strokeWidth:t.strokeWidth,strokeLinecap:"butt",...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(n=t.strokeDashArray)?void 0:n.join(",")}})},null,44,b),i.value.start?(e.openBlock(),e.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,onPointerdown:o[2]||(o[2]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[3]||(o[3]=(...e)=>t.onClick&&t.onClick(...e)),stroke:t.strokeColor,style:e.normalizeStyle(a(i.value.start)),fill:i.value.start.filled?t.color:"none"},null,44,S)):e.createCommentVNode("",!0),i.value.end?(e.openBlock(),e.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,onPointerdown:o[4]||(o[4]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[5]||(o[5]=(...e)=>t.onClick&&t.onClick(...e)),stroke:t.strokeColor,style:e.normalizeStyle(a(i.value.end)),fill:i.value.end.filled?t.color:"none"},null,44,w)):e.createCommentVNode("",!0)],12,C)}}}),P=["width","height","viewBox"],z=["d","opacity"],A=["d"],E=["x","y","width","height","fill","stroke","stroke-width"],R=e.defineComponent({__name:"polygon",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},scale:{},isSelected:{type:Boolean},onClick:{},currentVertex:{},handleSize:{default:14}},setup(t){const o=t,n=e.computed((()=>o.currentVertex?[...o.vertices,o.currentVertex]:o.vertices)),r=e.computed((()=>n.value.map((({x:e,y:t})=>({x:e-o.rect.origin.x,y:t-o.rect.origin.y}))))),i=e.computed((()=>{if(!r.value.length)return"";const[e,...t]=r.value,n=!!o.currentVertex;return(`M ${e.x} ${e.y} `+t.map((e=>`L ${e.x} ${e.y}`)).join(" ")+(n?"":" Z")).trim()})),a=e.computed((()=>o.currentVertex&&o.vertices.length>0)),s=e.computed((()=>o.rect.size.width*o.scale)),c=e.computed((()=>o.rect.size.height*o.scale));return(t,o)=>{var n;return e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("path",{d:i.value,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),opacity:t.opacity,style:e.normalizeStyle({fill:t.currentVertex?"none":t.color,stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(n=t.strokeDashArray)?void 0:n.join(",")}})},null,44,z),a.value&&r.value.length>1?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${r.value[r.value.length-1].x} ${r.value[r.value.length-1].y} L ${r.value[0].x} ${r.value[0].y}`,fill:"none",style:e.normalizeStyle({stroke:t.strokeColor,strokeWidth:t.strokeWidth,strokeDasharray:"4,4",opacity:.7})},null,12,A)):e.createCommentVNode("",!0),a.value&&r.value.length>=2?(e.openBlock(),e.createElementBlock("rect",{key:1,x:r.value[0].x-t.handleSize/t.scale/2,y:r.value[0].y-t.handleSize/t.scale/2,width:t.handleSize/t.scale,height:t.handleSize/t.scale,fill:t.strokeColor,opacity:.4,stroke:t.strokeColor,"stroke-width":t.strokeWidth/2},null,8,E)):e.createCommentVNode("",!0)],12,P)}}}),_=["width","height","viewBox"],I=["d","opacity"],j=["d","transform","stroke","fill"],$=["d","transform","stroke","fill"],M=e.defineComponent({__name:"polyline",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},scale:{},isSelected:{type:Boolean},onClick:{},lineEndings:{}},setup(t){const n=t,l=e.computed((()=>n.vertices.map((({x:e,y:t})=>({x:e-n.rect.origin.x,y:t-n.rect.origin.y}))))),r=e.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=e.computed((()=>{var e,t;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:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,i+Math.PI,l.value[0].x,l.value[0].y),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.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=e.computed((()=>n.rect.size.width*n.scale)),c=e.computed((()=>n.rect.size.height*n.scale));return(t,o)=>(e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("path",{d:r.value,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),opacity:t.opacity,style:e.normalizeStyle({fill:"none",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"})},null,44,I),i.value.start?(e.openBlock(),e.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,stroke:t.strokeColor,fill:i.value.start.filled?t.color:"none",onPointerdown:o[2]||(o[2]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[3]||(o[3]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle(a(i.value.start))},null,44,j)):e.createCommentVNode("",!0),i.value.end?(e.openBlock(),e.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,stroke:t.strokeColor,fill:i.value.end.filled?t.color:"none",onPointerdown:o[4]||(o[4]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[5]||(o[5]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle(a(i.value.end))},null,44,$)):e.createCommentVNode("",!0)],12,_))}}),D=["width","height","viewBox"],N=["x","y","width","height","fill","opacity"],L=e.defineComponent({__name:"square",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed((()=>{const e=o.rect.size.width,t=o.rect.size.height;return{width:Math.max(e-o.strokeWidth,0),height:Math.max(t-o.strokeWidth,0),x:o.strokeWidth/2,y:o.strokeWidth/2}})),r=e.computed((()=>(n.value.width+o.strokeWidth)*o.scale)),i=e.computed((()=>(n.value.height+o.strokeWidth)*o.scale));return(t,o)=>{var a;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:r.value,height:i.value,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value.width+t.strokeWidth} ${n.value.height+t.strokeWidth}`},[e.createElementVNode("rect",{x:n.value.x,y:n.value.y,width:n.value.width,height:n.value.height,fill:t.color,opacity:t.opacity,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(a=t.strokeDashArray)?void 0:a.join(",")}})},null,44,N)],12,D)}}}),V=["src"],T=e.defineComponent({__name:"render-annotation",props:{pageIndex:{},annotation:{},scaleFactor:{default:1},style:{}},setup(t){const o=t,{provides:r}=s(),i=e.ref(null),a=e.ref(null),c=e.ref(null),d=e.computed((()=>o.annotation.id)),u=e.computed((()=>o.annotation.rect.size.width)),p=e.computed((()=>o.annotation.rect.size.height));e.watch((()=>[o.pageIndex,o.scaleFactor,d.value,u.value,p.value,r.value]),((e,t,s)=>{if(r.value){a.value&&(URL.revokeObjectURL(a.value),a.value=null);const e=r.value.renderAnnotation({pageIndex:o.pageIndex,annotation:n.deepToRaw(o.annotation),options:{scaleFactor:o.scaleFactor,dpr:window.devicePixelRatio}});c.value=e,e.wait((e=>{const t=URL.createObjectURL(e);i.value=t,a.value=t}),l.ignore),s((()=>{a.value?(URL.revokeObjectURL(a.value),a.value=null):e.abort({code:l.PdfErrorCode.Cancelled,message:"canceled render task"})}))}}),{immediate:!0}),e.onUnmounted((()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null),c.value&&c.value.abort({code:l.PdfErrorCode.Cancelled,message:"canceled render task on unmount"})}));const v=()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null)};return(t,o)=>i.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.value,onLoad:v,style:e.normalizeStyle({width:"100%",height:"100%",display:"block",...t.style})},null,44,V)):e.createCommentVNode("",!0)}}),F=e.defineComponent({__name:"stamp",props:{isSelected:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup:t=>(t,o)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:t.isSelected?"none":"auto",cursor:"pointer"}),onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e))},[e.createVNode(T,{pageIndex:t.pageIndex,annotation:{...t.annotation.object,id:t.annotation.object.id},scaleFactor:t.scale},null,8,["pageIndex","annotation","scaleFactor"])],36))}),W=e.defineComponent({__name:"highlight",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup:t=>(t,o)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,((n,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?n.origin.x-t.rect.origin.x:n.origin.x)*t.scale+"px",top:(t.rect?n.origin.y-t.rect.origin.y:n.origin.y)*t.scale+"px",width:n.size.width*t.scale+"px",height:n.size.height*t.scale+"px",background:t.color,opacity:t.opacity,pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:void 0})},null,36)))),128))}),O=e.defineComponent({__name:"squiggly",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed((()=>2*o.scale)),l=e.computed((()=>6*o.scale)),r=e.computed((()=>{const e=n.value,t=l.value,r=`<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="${o.color}" stroke-width="${e}" stroke-linecap="round"/>\n </svg>`;return`url("data:image/svg+xml;utf8,${encodeURIComponent(r)}")`}));return(t,o)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,((i,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?i.origin.x-t.rect.origin.x:i.origin.x)*t.scale+"px",top:(t.rect?i.origin.y-t.rect.origin.y:i.origin.y)*t.scale+"px",width:i.size.width*t.scale+"px",height:i.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:2*n.value+"px",backgroundImage:r.value,backgroundRepeat:"repeat-x",backgroundSize:`${l.value}px ${2*n.value}px`,opacity:t.opacity,pointerEvents:"none"})},null,4)],36)))),128))}}),U=e.defineComponent({__name:"strikeout",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed((()=>2*o.scale));return(t,o)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,((l,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?l.origin.x-t.rect.origin.x:l.origin.x)*t.scale+"px",top:(t.rect?l.origin.y-t.rect.origin.y:l.origin.y)*t.scale+"px",width:l.size.width*t.scale+"px",height:l.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,top:"50%",width:"100%",height:`${n.value}px`,background:t.color,opacity:t.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36)))),128))}}),H=e.defineComponent({__name:"underline",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed((()=>2*o.scale));return(t,o)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,((l,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,onPointerdown:o[0]||(o[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:o[1]||(o[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?l.origin.x-t.rect.origin.x:l.origin.x)*t.scale+"px",top:(t.rect?l.origin.y-t.rect.origin.y:l.origin.y)*t.scale+"px",width:l.size.width*t.scale+"px",height:l.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:`${n.value}px`,background:t.color,opacity:t.opacity,pointerEvents:"none"})},null,4)],36)))),128))}}),q=e.defineComponent({__name:"annotations",props:{pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{}},setup(t){const n=t,{provides:a}=s(),{provides:c}=i.useSelectionCapability(),d=e.ref([]),{register:u}=r.usePointerHandlers({pageIndex:n.pageIndex}),v=e.ref(null),k=e.ref(null);e.watchEffect((e=>{if(a.value){e(a.value.onStateChange((e=>{d.value=o.getAnnotationsByPageIndex(e,n.pageIndex),v.value=o.getSelectedAnnotationByPageIndex(e,n.pageIndex)})))}}));const f=(e,t)=>{t.target===t.currentTarget&&a.value&&(a.value.deselectAnnotation(),k.value=null)},m=(e,t)=>{e.stopPropagation(),a.value&&c.value&&(a.value.selectAnnotation(n.pageIndex,t.object.id),c.value.clear(),t.object.id!==k.value&&(k.value=null))};e.watchEffect((e=>{if(a.value){const t=u({onPointerDown:f});t&&e(t)}}));const y=e=>{var t;return null==(t=a.value)?void 0:t.findToolForAnnotation(e.object)},C=e=>{var t;return(!o.isFreeText(e)||k.value!==e.object.id)&&((null==(t=y(e))?void 0:t.interaction.isDraggable)??!1)},b=e=>{var t;return(null==(t=y(e))?void 0:t.interaction.isResizable)??!1},S=e=>{var t;return(null==(t=y(e))?void 0:t.interaction.lockAspectRatio)??!1},w=e=>o.isLine(e)?{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})}:o.isPolyline(e)||o.isPolygon(e)?{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})}:void 0;return(t,r)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(r=>{var i,a,s,c,u,f,y,P,z,A,E,_;return e.openBlock(),e.createElementBlock(e.Fragment,{key:r.object.id},[e.unref(o.isInk)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,trackedAnnotation:r,isSelected:(null==(i=v.value)?void 0:i.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(x,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,scale:t.scale,onClick:e=>m(e,r)}),null,16,["isSelected","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isSquare)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:1,trackedAnnotation:r,isSelected:(null==(a=v.value)?void 0:a.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(L,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,scale:t.scale,onClick:e=>m(e,r)}),null,16,["isSelected","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isCircle)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:2,trackedAnnotation:r,isSelected:(null==(s=v.value)?void 0:s.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(g,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,scale:t.scale,onClick:e=>m(e,r)}),null,16,["isSelected","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isLine)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:3,trackedAnnotation:r,isSelected:(null==(c=v.value)?void 0:c.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(B,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,scale:t.scale,onClick:e=>m(e,r)}),null,16,["isSelected","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isPolyline)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:4,trackedAnnotation:r,isSelected:(null==(u=v.value)?void 0:u.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(M,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,scale:t.scale,onClick:e=>m(e,r)}),null,16,["isSelected","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isPolygon)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:5,trackedAnnotation:r,isSelected:(null==(f=v.value)?void 0:f.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(R,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,scale:t.scale,onClick:e=>m(e,r)}),null,16,["isSelected","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isFreeText)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:6,trackedAnnotation:r,isSelected:(null==(y=v.value)?void 0:y.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),onDoubleClick:e=>{return t=r.object.id,void(o.isFreeText(d.value.find((e=>e.object.id===t)))&&(k.value=t));var t},vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>{var n;return[e.createVNode(h,{isSelected:(null==(n=v.value)?void 0:n.object.id)===r.object.id,isEditing:k.value===r.object.id,annotation:{...r,object:o},pageIndex:t.pageIndex,scale:t.scale,onClick:e=>m(e,r)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","style"])):e.unref(o.isStamp)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:7,trackedAnnotation:r,isSelected:(null==(P=v.value)?void 0:P.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((()=>{var o;return[e.createVNode(F,{isSelected:(null==(o=v.value)?void 0:o.object.id)===r.object.id,annotation:r,pageIndex:t.pageIndex,scale:t.scale,onClick:e=>m(e,r)},null,8,["isSelected","annotation","pageIndex","scale","onClick"])]})),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.mergeProps({ref_for:!0},o))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isUnderline)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:8,trackedAnnotation:r,isSelected:(null==(z=v.value)?void 0:z.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>[e.createVNode(H,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>m(e,r)}),null,16,["scale","onClick"])])),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isStrikeout)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:9,trackedAnnotation:r,isSelected:(null==(A=v.value)?void 0:A.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>[e.createVNode(U,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>m(e,r)}),null,16,["scale","onClick"])])),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isSquiggly)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:10,trackedAnnotation:r,isSelected:(null==(E=v.value)?void 0:E.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>[e.createVNode(O,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>m(e,r)}),null,16,["scale","onClick"])])),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isHighlight)(r)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:11,trackedAnnotation:r,isSelected:(null==(_=v.value)?void 0:_.object.id)===r.object.id,isDraggable:C(r),isResizable:b(r),lockAspectRatio:S(r),onSelect:e=>m(e,r),vertexConfig:w(r),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(r.object.blendMode??e.unref(l.PdfBlendMode).Multiply)}},{ref_for:!0},n),{default:e.withCtx((({annotation:o})=>[e.createVNode(W,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>m(e,r)}),null,16,["scale","onClick"])])),"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.mergeProps({ref_for:!0},o))])),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.createCommentVNode("",!0)],64)})),128))}}),G=e.defineComponent({__name:"text-markup",props:{pageIndex:{},scale:{}},setup(t){const o=t,{provides:n}=i.useSelectionCapability(),{provides:r}=s(),a=e.ref([]),c=e.ref(null),d=e.ref(null);e.watchEffect((e=>{const t=[];if(n.value){const e=n.value,l=e.onSelectionChange((()=>{a.value=e.getHighlightRectsForPage(o.pageIndex),c.value=e.getBoundingRectForPage(o.pageIndex)}));t.push(l)}if(r.value){const e=r.value.onActiveToolChange((e=>d.value=e));t.push(e)}e((()=>{t.forEach((e=>e()))}))}));const u=e.computed((()=>{if(!d.value)return l.blendModeToCss(l.PdfBlendMode.Normal);const e=d.value.defaults.type===l.PdfAnnotationSubtype.HIGHLIGHT?l.PdfBlendMode.Multiply:l.PdfBlendMode.Normal;return l.blendModeToCss(d.value.defaults.blendMode??e)}));return(t,o)=>c.value&&d.value?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({mixBlendMode:u.value,pointerEvents:"none",position:"absolute",inset:0})},[d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).HIGHLIGHT?(e.openBlock(),e.createBlock(W,{key:0,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).UNDERLINE?(e.openBlock(),e.createBlock(H,{key:1,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).STRIKEOUT?(e.openBlock(),e.createBlock(U,{key:2,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).SQUIGGLY?(e.openBlock(),e.createBlock(O,{key:3,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)}}),Y=e.defineComponent({__name:"preview-renderer",props:{preview:{},scale:{}},setup(t){const o=t,n=e.computed((()=>({position:"absolute",left:o.preview.bounds.origin.x*o.scale+"px",top:o.preview.bounds.origin.y*o.scale+"px",width:o.preview.bounds.size.width*o.scale+"px",height:o.preview.bounds.size.height*o.scale+"px",pointerEvents:"none",zIndex:10})));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(n.value)},[t.preview.type===e.unref(l.PdfAnnotationSubtype).CIRCLE?(e.openBlock(),e.createBlock(e.unref(g),e.mergeProps({key:0,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).SQUARE?(e.openBlock(),e.createBlock(e.unref(L),e.mergeProps({key:1,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).POLYGON?(e.openBlock(),e.createBlock(e.unref(R),e.mergeProps({key:2,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).POLYLINE?(e.openBlock(),e.createBlock(e.unref(M),e.mergeProps({key:3,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).LINE?(e.openBlock(),e.createBlock(e.unref(B),e.mergeProps({key:4,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).INK?(e.openBlock(),e.createBlock(e.unref(x),e.mergeProps({key:5,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).FREETEXT?(e.openBlock(),e.createElementBlock("div",{key:6,style:e.normalizeStyle({width:"100%",height:"100%",border:`1px dashed ${t.preview.data.fontColor||"#000000"}`,backgroundColor:"transparent"})},null,4)):e.createCommentVNode("",!0)],4))}}),Q=e.defineComponent({__name:"annotation-paint-layer",props:{pageIndex:{},scale:{}},setup(t){const o=t,{plugin:n}=a(),l=e.ref(new Map),r=e.ref(null),i=e.ref(null),s=e.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 k=r.getImageData(0,0,p,v);"string"!=typeof e&&URL.revokeObjectURL(a.src),n({imageData:k,width:p,height:v})},a.src="string"==typeof e?e:URL.createObjectURL(e)}})));let c;return e.watchEffect((e=>{n.value&&(c=n.value.registerPageHandlers(o.pageIndex,o.scale,{services:s.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,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("input",{ref_key:"fileInputRef",ref:r,type:"file",style:{display:"none"}},null,512),e.createElementVNode("canvas",{ref_key:"canvasRef",ref:i,style:{display:"none"}},null,512),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.entries(),(([o,n])=>(e.openBlock(),e.createBlock(Y,{key:o,preview:n,scale:t.scale},null,8,["preview","scale"])))),128))],64))}}),K=e.defineComponent({__name:"annotation-layer",props:{pageIndex:{},scale:{},pageWidth:{},pageHeight:{},rotation:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{}},setup(t){const o=t;return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(q,e.normalizeProps(e.guardReactiveProps(o)),{"selection-menu":e.withCtx((o=>[e.renderSlot(t.$slots,"selection-menu",e.normalizeProps(e.guardReactiveProps(o)))])),"resize-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"resize-handle",e.normalizeProps(e.guardReactiveProps(o)))])),"vertex-handle":e.withCtx((o=>[e.renderSlot(t.$slots,"vertex-handle",e.normalizeProps(e.guardReactiveProps(o)))])),_:3},16),e.createVNode(G,{pageIndex:t.pageIndex,scale:t.scale},null,8,["pageIndex","scale"]),e.createVNode(Q,{pageIndex:t.pageIndex,scale:t.scale},null,8,["pageIndex","scale"])]))}});exports.AnnotationContainer=p,exports.AnnotationLayer=K,exports.AnnotationPaintLayer=Q,exports.Annotations=q,exports.Circle=g,exports.FreeText=h,exports.Highlight=W,exports.Ink=x,exports.Line=B,exports.Polygon=R,exports.Polyline=M,exports.PreviewRenderer=Y,exports.RenderAnnotation=T,exports.Square=L,exports.Squiggly=O,exports.Stamp=F,exports.Strikeout=U,exports.TextMarkup=G,exports.Underline=H,exports.useAnnotation=()=>{const{provides:t}=s(),n=e.ref(o.initialState({enabled:!0}));return e.watchEffect((e=>{if(t.value){e(t.value.onStateChange((e=>{n.value=e})))}})),{state:e.readonly(n),provides:t}},exports.useAnnotationCapability=s,exports.useAnnotationPlugin=a,Object.keys(o).forEach((e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})}));
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("@embedpdf/core/vue"),o=require("@embedpdf/plugin-annotation"),n=require("@embedpdf/utils/vue"),l=require("@embedpdf/models"),r=require("@embedpdf/plugin-interaction-manager/vue"),i=require("@embedpdf/plugin-selection/vue"),a=()=>t.usePlugin(o.AnnotationPlugin.id),c=()=>t.useCapability(o.AnnotationPlugin.id),s={"data-no-interaction":""},d="#007ACC",u="#007ACC",p=e.defineComponent({__name:"annotation-container",props:{scale:{},documentId:{},pageIndex:{},rotation:{},pageWidth:{},pageHeight:{},trackedAnnotation:{},isSelected:{type:Boolean},isDraggable:{type:Boolean},isResizable:{type:Boolean},lockAspectRatio:{type:Boolean,default:!1},vertexConfig:{},selectionMenu:{},outlineOffset:{default:1},onDoubleClick:{},onSelect:{},zIndex:{default:1},selectionOutlineColor:{default:"#007ACC"}},setup(t){const o=t,l=e.shallowRef(e.toRaw(o.trackedAnnotation.object)),{provides:r}=c(),i=e.ref(null),a=e.computed(()=>r.value?r.value.forDocument(o.documentId):null),p=e.computed(()=>({...e.toRaw(o.trackedAnnotation.object),...e.toRaw(l.value)})),v=e.computed(()=>o.isSelected&&(o.selectionMenu||P["selection-menu"])),g=e.computed(()=>({origin:{x:p.value.rect.origin.x*o.scale,y:p.value.rect.origin.y*o.scale},size:{width:p.value.rect.size.width*o.scale,height:p.value.rect.size.height*o.scale}})),k=e.computed(()=>({type:"annotation",annotation:o.trackedAnnotation,pageIndex:o.pageIndex})),m=e.computed(()=>({suggestTop:!1,spaceAbove:0,spaceBelow:0})),f=(e,t)=>o.selectionMenu?o.selectionMenu({rect:e,menuWrapperProps:t,selected:o.isSelected,placement:m.value,context:k.value}):null,h=e.computed(()=>e.toRaw(p.value).rect),y=e.computed(()=>{var t;const n=e.toRaw(p.value);return(null==(t=o.vertexConfig)?void 0:t.extractVertices(n))??[]}),x=e.computed(()=>({minWidth:10,minHeight:10,boundingBox:{width:o.pageWidth,height:o.pageHeight}})),{dragProps:C,vertices:b,resize:S}=n.useInteractionHandles({controller:{element:h,vertices:y,constraints:x,maintainAspectRatio:e.computed(()=>o.lockAspectRatio),pageRotation:e.computed(()=>o.rotation),scale:e.computed(()=>o.scale),enabled:e.computed(()=>o.isSelected),onUpdate:t=>{var n,c,s,d;if(!(null==(n=t.transformData)?void 0:n.type))return;"start"===t.state&&(i.value=p.value);const u=i.value??p.value,v=t.transformData.changes.vertices?null==(c=o.vertexConfig)?void 0:c.transformAnnotation(e.toRaw(u),t.transformData.changes.vertices):{rect:t.transformData.changes.rect},g=null==(s=r.value)?void 0:s.transformAnnotation(u,{type:t.transformData.type,changes:v,metadata:t.transformData.metadata});g&&(l.value={...e.toRaw(l.value),...g}),"end"===t.state&&g&&(i.value=null,null==(d=a.value)||d.updateAnnotation(o.pageIndex,o.trackedAnnotation.object.id,g))}},resizeUI:{handleSize:12,spacing:o.outlineOffset,offsetMode:"outside",includeSides:!o.lockAspectRatio,zIndex:o.zIndex+1},vertexUI:{vertexSize:12,zIndex:o.zIndex+2},includeVertices:!!o.vertexConfig}),w=n.useDoublePressProps(o.onDoubleClick);e.watch(()=>o.trackedAnnotation.object,e=>{l.value=e},{deep:!0});const B=e.computed(()=>({position:"absolute",left:p.value.rect.origin.x*o.scale+"px",top:p.value.rect.origin.y*o.scale+"px",width:p.value.rect.size.width*o.scale+"px",height:p.value.rect.size.height*o.scale+"px",outline:o.isSelected?`1px solid ${o.selectionOutlineColor}`:"none",outlineOffset:o.isSelected?`${o.outlineOffset}px`:"0px",pointerEvents:o.isSelected?"auto":"none",touchAction:"none",cursor:o.isSelected&&o.isDraggable?"move":"default",zIndex:o.zIndex})),P=e.useSlots();return(o,l)=>(e.openBlock(),e.createElementBlock("div",s,[e.createElementVNode("div",e.mergeProps({...e.unref(C),...e.unref(w)},{style:B.value}),[e.renderSlot(o.$slots,"default",{annotation:p.value}),t.isSelected&&t.isResizable?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(S),({key:t,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t},[e.unref(P)["resize-handle"]?e.renderSlot(o.$slots,"resize-handle",e.mergeProps({key:0,ref_for:!0},{key:t,style:n,...l,backgroundColor:d}),()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:d}]}),null,16)]):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:d}]}),null,16))],64))),128)):e.createCommentVNode("",!0),t.isSelected&&e.unref(b).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(b),({key:t,style:n,...l})=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t},[e.unref(P)["vertex-handle"]?e.renderSlot(o.$slots,"vertex-handle",e.mergeProps({key:0,ref_for:!0},{key:t,style:n,...l,backgroundColor:u}),()=>[e.createElementVNode("div",e.mergeProps({ref_for:!0},l,{style:[n,{backgroundColor:u}]}),null,16)]):(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:1,ref_for:!0},l,{style:[n,{backgroundColor:u}]}),null,16))],64))),128)):e.createCommentVNode("",!0)],16),v.value?(e.openBlock(),e.createBlock(e.unref(n.CounterRotate),{key:0,rect:g.value,rotation:t.rotation},{default:e.withCtx(({rect:n,menuWrapperProps:l})=>[t.selectionMenu?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f(n,l)),{key:0})):e.renderSlot(o.$slots,"selection-menu",{key:1,context:k.value,selected:t.isSelected,rect:n,placement:m.value,menuWrapperProps:l})]),_:3},8,["rect","rotation"])):e.createCommentVNode("",!0)]))}}),v=["width","height","viewBox"],g=["cx","cy","rx","ry","fill","opacity"],k=e.defineComponent({__name:"circle",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>{const e=o.rect.size.width,t=o.rect.size.height,n=Math.max(e-o.strokeWidth,0),l=Math.max(t-o.strokeWidth,0);return{width:e,height:t,cx:o.strokeWidth/2+n/2,cy:o.strokeWidth/2+l/2,rx:n/2,ry:l/2}}),r=e.computed(()=>n.value.width*o.scale),i=e.computed(()=>n.value.height*o.scale);return(o,a)=>{var c;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:r.value,height:i.value,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value.width} ${n.value.height}`},[e.createElementVNode("ellipse",{cx:n.value.cx,cy:n.value.cy,rx:n.value.rx,ry:n.value.ry,fill:t.color,opacity:t.opacity,onPointerdown:a[0]||(a[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:a[1]||(a[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(c=t.strokeDashArray)?void 0:c.join(",")}})},null,44,g)],12,v)}}}),m=["contenteditable"],f=e.defineComponent({__name:"free-text",props:{isSelected:{type:Boolean},isEditing:{type:Boolean},annotation:{},pageIndex:{},scale:{},onClick:{type:Function}},setup(t){const o=t,n=e.ref(null),{provides:r}=c(),i=e.ref(!1);e.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}}),e.watch(()=>o.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=()=>{r.value&&n.value&&r.value.updateAnnotation(o.pageIndex,o.annotation.object.id,{contents:n.value.innerText})},s=e.computed(()=>{const{object:e}=o.annotation,t=e.fontSize*o.scale,n=i.value&&o.isEditing&&t>0&&t<16,r=n?16:t,a=n?t/16:1,c=n?100/a:100;return{color:e.fontColor,fontSize:`${r}px`,fontFamily:l.standardFontCss(e.fontFamily),textAlign:l.textAlignmentToCss(e.textAlign),flexDirection:"column",justifyContent:e.verticalAlign===l.PdfVerticalAlignment.Top?"flex-start":e.verticalAlign===l.PdfVerticalAlignment.Middle?"center":"flex-end",display:"flex",backgroundColor:e.backgroundColor,opacity:e.opacity,width:n?`${c}%`:"100%",height:n?`${c}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:o.isEditing?"text":"pointer",outline:"none",transform:n?`scale(${a})`:void 0,transformOrigin:"top left"}});return(o,l)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({position:"absolute",width:t.annotation.object.rect.size.width*t.scale+"px",height:t.annotation.object.rect.size.height*t.scale+"px",cursor:t.isSelected&&!t.isEditing?"move":"default",pointerEvents:t.isSelected&&!t.isEditing?"none":"auto",zIndex:2}),onPointerdown:l[0]||(l[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:l[1]||(l[1]=(...e)=>t.onClick&&t.onClick(...e))},[e.createElementVNode("span",{ref_key:"editorRef",ref:n,onBlur:a,tabindex:"0",style:e.normalizeStyle(s.value),contenteditable:t.isEditing},e.toDisplayString(t.annotation.object.contents),45,m)],36))}}),h=["width","height","viewBox"],y=["d","opacity"],x=e.defineComponent({__name:"ink",props:{isSelected:{type:Boolean},color:{default:"#000000"},opacity:{default:1},strokeWidth:{},inkList:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>o.inkList.map(({points:e})=>{let t="";return e.forEach(({x:e,y:n},l)=>{const r=e-o.rect.origin.x,i=n-o.rect.origin.y;t+=(0===l?"M":"L")+`${r} ${i} `}),t.trim()})),l=e.computed(()=>o.rect.size.width*o.scale),r=e.computed(()=>o.rect.size.height*o.scale);return(o,i)=>(e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:`${l.value}px`,height:`${r.value}px`,pointerEvents:"none",zIndex:2,overflow:"visible"}),width:l.value,height:r.value,viewBox:`0 0 ${t.rect.size.width} ${t.rect.size.height}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(o,n)=>(e.openBlock(),e.createElementBlock("path",{key:n,d:o,fill:"none",opacity:t.opacity,onPointerdown:i[0]||(i[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:i[1]||(i[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",stroke:t.color,strokeWidth:t.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round"})},null,44,y))),128))],12,h))}}),C=["width","height","viewBox"],b=["x1","y1","x2","y2","opacity"],S=["d","transform","stroke","fill"],w=["d","transform","stroke","fill"],B=e.defineComponent({__name:"line",props:{color:{default:"transparent"},opacity:{default:1},strokeWidth:{},strokeColor:{default:"#000000"},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},linePoints:{},lineEndings:{},scale:{},onClick:{},isSelected:{type:Boolean}},setup(t){const n=t,r=e.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=e.computed(()=>{var e,t;const{x1:l,y1:i,x2:a,y2:c}=r.value,s=Math.atan2(c-i,a-l);return{start:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,s+Math.PI,l,i),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.end,n.strokeWidth,s,a,c)}}),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===l.PdfAnnotationBorderStyle.DASHED&&{strokeDasharray:null==(t=n.strokeDashArray)?void 0:t.join(",")}}},c=e.computed(()=>n.rect.size.width*n.scale),s=e.computed(()=>n.rect.size.height*n.scale);return(o,n)=>{var d;return e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("line",{x1:r.value.x1,y1:r.value.y1,x2:r.value.x2,y2:r.value.y2,opacity:t.opacity,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",stroke:t.strokeColor,strokeWidth:t.strokeWidth,strokeLinecap:"butt",...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=t.strokeDashArray)?void 0:d.join(",")}})},null,44,b),i.value.start?(e.openBlock(),e.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,onPointerdown:n[2]||(n[2]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[3]||(n[3]=(...e)=>t.onClick&&t.onClick(...e)),stroke:t.strokeColor,style:e.normalizeStyle(a(i.value.start)),fill:i.value.start.filled?t.color:"none"},null,44,S)):e.createCommentVNode("",!0),i.value.end?(e.openBlock(),e.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,onPointerdown:n[4]||(n[4]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[5]||(n[5]=(...e)=>t.onClick&&t.onClick(...e)),stroke:t.strokeColor,style:e.normalizeStyle(a(i.value.end)),fill:i.value.end.filled?t.color:"none"},null,44,w)):e.createCommentVNode("",!0)],12,C)}}}),P=["width","height","viewBox"],z=["d","opacity"],I=["d"],A=["x","y","width","height","fill","stroke","stroke-width"],E=e.defineComponent({__name:"polygon",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},scale:{},isSelected:{type:Boolean},onClick:{},currentVertex:{},handleSize:{default:14}},setup(t){const o=t,n=e.computed(()=>o.currentVertex?[...o.vertices,o.currentVertex]:o.vertices),r=e.computed(()=>n.value.map(({x:e,y:t})=>({x:e-o.rect.origin.x,y:t-o.rect.origin.y}))),i=e.computed(()=>{if(!r.value.length)return"";const[e,...t]=r.value,n=!!o.currentVertex;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()}),a=e.computed(()=>o.currentVertex&&o.vertices.length>0),c=e.computed(()=>o.rect.size.width*o.scale),s=e.computed(()=>o.rect.size.height*o.scale);return(o,n)=>{var d;return e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("path",{d:i.value,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),opacity:t.opacity,style:e.normalizeStyle({fill:t.currentVertex?"none":t.color,stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(d=t.strokeDashArray)?void 0:d.join(",")}})},null,44,z),a.value&&r.value.length>1?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${r.value[r.value.length-1].x} ${r.value[r.value.length-1].y} L ${r.value[0].x} ${r.value[0].y}`,fill:"none",style:e.normalizeStyle({stroke:t.strokeColor,strokeWidth:t.strokeWidth,strokeDasharray:"4,4",opacity:.7})},null,12,I)):e.createCommentVNode("",!0),a.value&&r.value.length>=2?(e.openBlock(),e.createElementBlock("rect",{key:1,x:r.value[0].x-t.handleSize/t.scale/2,y:r.value[0].y-t.handleSize/t.scale/2,width:t.handleSize/t.scale,height:t.handleSize/t.scale,fill:t.strokeColor,opacity:.4,stroke:t.strokeColor,"stroke-width":t.strokeWidth/2},null,8,A)):e.createCommentVNode("",!0)],12,P)}}}),R=["width","height","viewBox"],_=["d","opacity"],j=["d","transform","stroke","fill"],$=["d","transform","stroke","fill"],M=e.defineComponent({__name:"polyline",props:{rect:{},vertices:{},color:{default:"transparent"},strokeColor:{default:"#000000"},opacity:{default:1},strokeWidth:{},scale:{},isSelected:{type:Boolean},onClick:{},lineEndings:{}},setup(t){const n=t,l=e.computed(()=>n.vertices.map(({x:e,y:t})=>({x:e-n.rect.origin.x,y:t-n.rect.origin.y}))),r=e.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=e.computed(()=>{var e,t;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:o.patching.createEnding(null==(e=n.lineEndings)?void 0:e.start,n.strokeWidth,i+Math.PI,l.value[0].x,l.value[0].y),end:o.patching.createEnding(null==(t=n.lineEndings)?void 0:t.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"}),c=e.computed(()=>n.rect.size.width*n.scale),s=e.computed(()=>n.rect.size.height*n.scale);return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{style:e.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 ${t.rect.size.width} ${t.rect.size.height}`},[e.createElementVNode("path",{d:r.value,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),opacity:t.opacity,style:e.normalizeStyle({fill:"none",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"})},null,44,_),i.value.start?(e.openBlock(),e.createElementBlock("path",{key:0,d:i.value.start.d,transform:i.value.start.transform,stroke:t.strokeColor,fill:i.value.start.filled?t.color:"none",onPointerdown:n[2]||(n[2]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[3]||(n[3]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle(a(i.value.start))},null,44,j)):e.createCommentVNode("",!0),i.value.end?(e.openBlock(),e.createElementBlock("path",{key:1,d:i.value.end.d,transform:i.value.end.transform,stroke:t.strokeColor,fill:i.value.end.filled?t.color:"none",onPointerdown:n[4]||(n[4]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[5]||(n[5]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle(a(i.value.end))},null,44,$)):e.createCommentVNode("",!0)],12,R))}}),D=["width","height","viewBox"],N=["x","y","width","height","fill","opacity"],V=e.defineComponent({__name:"square",props:{isSelected:{type:Boolean},color:{default:"#000000"},strokeColor:{},opacity:{default:1},strokeWidth:{},strokeStyle:{default:l.PdfAnnotationBorderStyle.SOLID},strokeDashArray:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>{const e=o.rect.size.width,t=o.rect.size.height;return{width:Math.max(e-o.strokeWidth,0),height:Math.max(t-o.strokeWidth,0),x:o.strokeWidth/2,y:o.strokeWidth/2}}),r=e.computed(()=>(n.value.width+o.strokeWidth)*o.scale),i=e.computed(()=>(n.value.height+o.strokeWidth)*o.scale);return(o,a)=>{var c;return e.openBlock(),e.createElementBlock("svg",{style:e.normalizeStyle({position:"absolute",width:r.value,height:i.value,pointerEvents:"none",zIndex:2}),width:r.value,height:i.value,viewBox:`0 0 ${n.value.width+t.strokeWidth} ${n.value.height+t.strokeWidth}`},[e.createElementVNode("rect",{x:n.value.x,y:n.value.y,width:n.value.width,height:n.value.height,fill:t.color,opacity:t.opacity,onPointerdown:a[0]||(a[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:a[1]||(a[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({cursor:t.isSelected?"move":"pointer",pointerEvents:t.isSelected?"none":"transparent"===t.color?"visibleStroke":"visible",stroke:t.strokeColor??t.color,strokeWidth:t.strokeWidth,...t.strokeStyle===e.unref(l.PdfAnnotationBorderStyle).DASHED&&{strokeDasharray:null==(c=t.strokeDashArray)?void 0:c.join(",")}})},null,44,N)],12,D)}}}),L=["src"],T=e.defineComponent({__name:"render-annotation",props:{documentId:{},pageIndex:{},annotation:{},scaleFactor:{default:1},style:{}},setup(t){const o=t,{provides:r}=c(),i=e.ref(null),a=e.ref(null),s=e.ref(null),d=e.computed(()=>o.annotation.id),u=e.computed(()=>o.annotation.rect.size.width),p=e.computed(()=>o.annotation.rect.size.height);e.watch(()=>[o.pageIndex,o.scaleFactor,o.documentId,d.value,u.value,p.value,r.value],(e,t,c)=>{if(r.value){a.value&&(URL.revokeObjectURL(a.value),a.value=null);const e=r.value.forDocument(o.documentId).renderAnnotation({pageIndex:o.pageIndex,annotation:n.deepToRaw(o.annotation),options:{scaleFactor:o.scaleFactor,dpr:window.devicePixelRatio}});s.value=e,e.wait(e=>{const t=URL.createObjectURL(e);i.value=t,a.value=t},l.ignore),c(()=>{a.value?(URL.revokeObjectURL(a.value),a.value=null):e.abort({code:l.PdfErrorCode.Cancelled,message:"canceled render task"})})}},{immediate:!0}),e.onUnmounted(()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null),s.value&&s.value.abort({code:l.PdfErrorCode.Cancelled,message:"canceled render task on unmount"})});const v=()=>{a.value&&(URL.revokeObjectURL(a.value),a.value=null)};return(o,n)=>i.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.value,onLoad:v,style:e.normalizeStyle({width:"100%",height:"100%",display:"block",...t.style})},null,44,L)):e.createCommentVNode("",!0)}}),F=e.defineComponent({__name:"stamp",props:{isSelected:{type:Boolean},annotation:{},documentId:{},pageIndex:{},scale:{},onClick:{type:Function}},setup:t=>(o,n)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:t.isSelected?"none":"auto",cursor:"pointer"}),onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e))},[e.createVNode(T,{documentId:t.documentId,pageIndex:t.pageIndex,annotation:{...t.annotation.object,id:t.annotation.object.id},scaleFactor:t.scale},null,8,["documentId","pageIndex","annotation","scaleFactor"])],36))}),W=e.defineComponent({__name:"highlight",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup:t=>(o,n)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,onPointerdown:n[0]||(n[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:n[1]||(n[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:t.color,opacity:t.opacity,pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:void 0})},null,36))),128))}),U=e.defineComponent({__name:"squiggly",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>2*o.scale),l=e.computed(()=>6*o.scale),r=e.computed(()=>{const e=n.value,t=l.value,r=`<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="${o.color}" stroke-width="${e}" stroke-linecap="round"/>\n </svg>`;return`url("data:image/svg+xml;utf8,${encodeURIComponent(r)}")`});return(o,i)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,onPointerdown:i[0]||(i[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:i[1]||(i[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:2*n.value+"px",backgroundImage:r.value,backgroundRepeat:"repeat-x",backgroundSize:`${l.value}px ${2*n.value}px`,opacity:t.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),O=e.defineComponent({__name:"strikeout",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>2*o.scale);return(o,l)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,onPointerdown:l[0]||(l[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:l[1]||(l[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,top:"50%",width:"100%",height:`${n.value}px`,background:t.color,opacity:t.opacity,transform:"translateY(-50%)",pointerEvents:"none"})},null,4)],36))),128))}}),H=e.defineComponent({__name:"underline",props:{color:{default:"#FFFF00"},opacity:{default:.5},segmentRects:{},rect:{},scale:{},onClick:{}},setup(t){const o=t,n=e.computed(()=>2*o.scale);return(o,l)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.segmentRects,(o,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,onPointerdown:l[0]||(l[0]=(...e)=>t.onClick&&t.onClick(...e)),onTouchstart:l[1]||(l[1]=(...e)=>t.onClick&&t.onClick(...e)),style:e.normalizeStyle({position:"absolute",left:(t.rect?o.origin.x-t.rect.origin.x:o.origin.x)*t.scale+"px",top:(t.rect?o.origin.y-t.rect.origin.y:o.origin.y)*t.scale+"px",width:o.size.width*t.scale+"px",height:o.size.height*t.scale+"px",background:"transparent",pointerEvents:t.onClick?"auto":"none",cursor:t.onClick?"pointer":"default",zIndex:t.onClick?1:0})},[e.createElementVNode("div",{style:e.normalizeStyle({position:"absolute",left:0,bottom:0,width:"100%",height:`${n.value}px`,background:t.color,opacity:t.opacity,pointerEvents:"none"})},null,4)],36))),128))}}),q=e.defineComponent({__name:"annotations",props:{documentId:{},pageIndex:{},scale:{},rotation:{},pageWidth:{},pageHeight:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function}},setup(t){const n=t,{provides:a}=c(),{provides:s}=i.useSelectionCapability(),d=e.ref([]),{register:u}=r.usePointerHandlers({documentId:()=>n.documentId,pageIndex:n.pageIndex}),v=e.ref(null),g=e.ref(null),m=e.computed(()=>a.value?a.value.forDocument(n.documentId):null);e.watchEffect(e=>{if(m.value){const t=m.value.getState();d.value=o.getAnnotationsByPageIndex(t,n.pageIndex),v.value=o.getSelectedAnnotationByPageIndex(t,n.pageIndex);e(m.value.onStateChange(e=>{d.value=o.getAnnotationsByPageIndex(e,n.pageIndex),v.value=o.getSelectedAnnotationByPageIndex(e,n.pageIndex)}))}});const h=(e,t)=>{t.target===t.currentTarget&&m.value&&(m.value.deselectAnnotation(),g.value=null)},y=(e,t)=>{e.stopPropagation(),m.value&&s.value&&(m.value.selectAnnotation(n.pageIndex,t.object.id),s.value.clear(),t.object.id!==g.value&&(g.value=null))};e.watchEffect(e=>{if(m.value){const t=u({onPointerDown:h});t&&e(t)}});const C=e=>{var t;return null==(t=m.value)?void 0:t.findToolForAnnotation(e.object)},b=e=>{var t;return(!o.isFreeText(e)||g.value!==e.object.id)&&((null==(t=C(e))?void 0:t.interaction.isDraggable)??!1)},S=e=>{var t;return(null==(t=C(e))?void 0:t.interaction.isResizable)??!1},w=e=>{var t;return(null==(t=C(e))?void 0:t.interaction.lockAspectRatio)??!1},P=e=>o.isLine(e)?{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})}:o.isPolyline(e)||o.isPolygon(e)?{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})}:void 0;return(r,i)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var a,c,s,u,m,h,C,z,I,A,R,_;return e.openBlock(),e.createElementBlock(e.Fragment,{key:i.object.id},[e.unref(o.isInk)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,trackedAnnotation:i,isSelected:(null==(a=v.value)?void 0:a.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(x,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>y(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isSquare)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:1,trackedAnnotation:i,isSelected:(null==(c=v.value)?void 0:c.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(V,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>y(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isCircle)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:2,trackedAnnotation:i,isSelected:(null==(s=v.value)?void 0:s.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(k,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>y(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isLine)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:3,trackedAnnotation:i,isSelected:(null==(u=v.value)?void 0:u.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(B,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>y(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isPolyline)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:4,trackedAnnotation:i,isSelected:(null==(m=v.value)?void 0:m.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(M,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>y(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isPolygon)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:5,trackedAnnotation:i,isSelected:(null==(h=v.value)?void 0:h.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(E,e.mergeProps({ref_for:!0},o,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,scale:t.scale,onClick:e=>y(e,i)}),null,16,["isSelected","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isFreeText)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:6,trackedAnnotation:i,isSelected:(null==(C=v.value)?void 0:C.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),onDoubleClick:e=>{return t=i.object.id,void(o.isFreeText(d.value.find(e=>e.object.id===t))&&(g.value=t));var t},vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>{var n;return[e.createVNode(f,{isSelected:(null==(n=v.value)?void 0:n.object.id)===i.object.id,isEditing:g.value===i.object.id,annotation:{...i,object:o},pageIndex:t.pageIndex,scale:t.scale,onClick:e=>y(e,i)},null,8,["isSelected","isEditing","annotation","pageIndex","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","onDoubleClick","vertexConfig","style"])):e.unref(o.isStamp)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:7,trackedAnnotation:i,isSelected:(null==(z=v.value)?void 0:z.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(()=>{var o;return[e.createVNode(F,{documentId:t.documentId,isSelected:(null==(o=v.value)?void 0:o.object.id)===i.object.id,annotation:i,pageIndex:t.pageIndex,scale:t.scale,onClick:e=>y(e,i)},null,8,["documentId","isSelected","annotation","pageIndex","scale","onClick"])]}),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),"resize-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"resize-handle",e.mergeProps({ref_for:!0},t))]),"vertex-handle":e.withCtx(t=>[e.renderSlot(r.$slots,"vertex-handle",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isUnderline)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:8,trackedAnnotation:i,isSelected:(null==(I=v.value)?void 0:I.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(H,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>y(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isStrikeout)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:9,trackedAnnotation:i,isSelected:(null==(A=v.value)?void 0:A.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(O,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>y(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isSquiggly)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:10,trackedAnnotation:i,isSelected:(null==(R=v.value)?void 0:R.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Normal)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(U,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>y(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.unref(o.isHighlight)(i)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:11,trackedAnnotation:i,isSelected:(null==(_=v.value)?void 0:_.object.id)===i.object.id,isDraggable:b(i),isResizable:S(i),lockAspectRatio:w(i),onSelect:e=>y(e,i),vertexConfig:P(i),zIndex:0,style:{mixBlendMode:e.unref(l.blendModeToCss)(i.object.blendMode??e.unref(l.PdfBlendMode).Multiply)}},{ref_for:!0},n),{default:e.withCtx(({annotation:o})=>[e.createVNode(W,e.mergeProps({ref_for:!0},o,{scale:t.scale,onClick:e=>y(e,i)}),null,16,["scale","onClick"])]),"selection-menu":e.withCtx(t=>[e.renderSlot(r.$slots,"selection-menu",e.mergeProps({ref_for:!0},t))]),_:2},1040,["trackedAnnotation","isSelected","isDraggable","isResizable","lockAspectRatio","onSelect","vertexConfig","style"])):e.createCommentVNode("",!0)],64)}),128))}}),G=e.defineComponent({__name:"text-markup",props:{documentId:{},pageIndex:{},scale:{}},setup(t){const o=t,{provides:n}=i.useSelectionCapability(),{provides:r}=c(),a=e.ref([]),s=e.ref(null),d=e.ref(null);e.watchEffect(e=>{const t=[];if(n.value){const e=n.value.forDocument(o.documentId),l=e.onSelectionChange(()=>{a.value=e.getHighlightRectsForPage(o.pageIndex),s.value=e.getBoundingRectForPage(o.pageIndex)});t.push(l)}if(r.value){const e=r.value.forDocument(o.documentId);d.value=e.getActiveTool();const n=e.onActiveToolChange(e=>d.value=e);t.push(n)}e(()=>{t.forEach(e=>e())})});const u=e.computed(()=>{if(!d.value)return l.blendModeToCss(l.PdfBlendMode.Normal);const e=d.value.defaults.type===l.PdfAnnotationSubtype.HIGHLIGHT?l.PdfBlendMode.Multiply:l.PdfBlendMode.Normal;return l.blendModeToCss(d.value.defaults.blendMode??e)});return(o,n)=>s.value&&d.value?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({mixBlendMode:u.value,pointerEvents:"none",position:"absolute",inset:0})},[d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).HIGHLIGHT?(e.openBlock(),e.createBlock(W,{key:0,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).UNDERLINE?(e.openBlock(),e.createBlock(H,{key:1,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).STRIKEOUT?(e.openBlock(),e.createBlock(O,{key:2,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):d.value.defaults.type===e.unref(l.PdfAnnotationSubtype).SQUIGGLY?(e.openBlock(),e.createBlock(U,{key:3,color:d.value.defaults.color,opacity:d.value.defaults.opacity,segmentRects:a.value,scale:t.scale},null,8,["color","opacity","segmentRects","scale"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)}}),Y=e.defineComponent({__name:"preview-renderer",props:{preview:{},scale:{}},setup(t){const o=t,n=e.computed(()=>({position:"absolute",left:o.preview.bounds.origin.x*o.scale+"px",top:o.preview.bounds.origin.y*o.scale+"px",width:o.preview.bounds.size.width*o.scale+"px",height:o.preview.bounds.size.height*o.scale+"px",pointerEvents:"none",zIndex:10}));return(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(n.value)},[t.preview.type===e.unref(l.PdfAnnotationSubtype).CIRCLE?(e.openBlock(),e.createBlock(e.unref(k),e.mergeProps({key:0,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).SQUARE?(e.openBlock(),e.createBlock(e.unref(V),e.mergeProps({key:1,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).POLYGON?(e.openBlock(),e.createBlock(e.unref(E),e.mergeProps({key:2,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).POLYLINE?(e.openBlock(),e.createBlock(e.unref(M),e.mergeProps({key:3,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).LINE?(e.openBlock(),e.createBlock(e.unref(B),e.mergeProps({key:4,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).INK?(e.openBlock(),e.createBlock(e.unref(x),e.mergeProps({key:5,isSelected:!1,scale:t.scale},t.preview.data),null,16,["scale"])):t.preview.type===e.unref(l.PdfAnnotationSubtype).FREETEXT?(e.openBlock(),e.createElementBlock("div",{key:6,style:e.normalizeStyle({width:"100%",height:"100%",border:`1px dashed ${t.preview.data.fontColor||"#000000"}`,backgroundColor:"transparent"})},null,4)):e.createCommentVNode("",!0)],4))}}),Q=e.defineComponent({__name:"annotation-paint-layer",props:{documentId:{},pageIndex:{},scale:{}},setup(t){const o=t,{plugin:n}=a(),l=e.ref(new Map),r=e.ref(null),i=e.ref(null),c=e.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:c}=a;const s=t?t/i:1,d=o?o/c:1,u=Math.min(s,d,1),p=i*u,v=c*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 s;return e.watchEffect(e=>{n.value&&(s=n.value.registerPageHandlers(o.documentId,o.pageIndex,o.scale,{services:c.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()})}),(o,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("input",{ref_key:"fileInputRef",ref:r,type:"file",style:{display:"none"}},null,512),e.createElementVNode("canvas",{ref_key:"canvasRef",ref:i,style:{display:"none"}},null,512),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.entries(),([o,n])=>(e.openBlock(),e.createBlock(Y,{key:o,preview:n,scale:t.scale},null,8,["preview","scale"]))),128))],64))}}),K=e.defineComponent({__name:"annotation-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},resizeUI:{},vertexUI:{},selectionOutlineColor:{},selectionMenu:{type:Function}},setup(o){const n=o,r=t.useDocumentState(()=>n.documentId),i=e.computed(()=>{var e,t,o;return null==(o=null==(t=null==(e=r.value)?void 0:e.document)?void 0:t.pages)?void 0:o[n.pageIndex]}),a=e.computed(()=>{var e,t;return(null==(t=null==(e=i.value)?void 0:e.size)?void 0:t.width)??0}),c=e.computed(()=>{var e,t;return(null==(t=null==(e=i.value)?void 0:e.size)?void 0:t.height)??0}),s=e.computed(()=>{var e;return void 0!==n.scale?n.scale:(null==(e=r.value)?void 0:e.scale)??1}),d=e.computed(()=>{var e;return void 0!==n.rotation?n.rotation:(null==(e=r.value)?void 0:e.rotation)??l.Rotation.Degree0});return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(q,{documentId:o.documentId,pageIndex:o.pageIndex,scale:s.value,rotation:d.value,pageWidth:a.value,pageHeight:c.value,resizeUI:o.resizeUI,vertexUI:o.vertexUI,selectionOutlineColor:o.selectionOutlineColor,selectionMenu:o.selectionMenu},{"selection-menu":e.withCtx(o=>[e.renderSlot(t.$slots,"selection-menu",e.normalizeProps(e.guardReactiveProps(o)))]),"resize-handle":e.withCtx(o=>[e.renderSlot(t.$slots,"resize-handle",e.normalizeProps(e.guardReactiveProps(o)))]),"vertex-handle":e.withCtx(o=>[e.renderSlot(t.$slots,"vertex-handle",e.normalizeProps(e.guardReactiveProps(o)))]),_:3},8,["documentId","pageIndex","scale","rotation","pageWidth","pageHeight","resizeUI","vertexUI","selectionOutlineColor","selectionMenu"]),e.createVNode(G,{documentId:o.documentId,pageIndex:o.pageIndex,scale:s.value},null,8,["documentId","pageIndex","scale"]),e.createVNode(Q,{documentId:o.documentId,pageIndex:o.pageIndex,scale:s.value},null,8,["documentId","pageIndex","scale"])]))}});exports.AnnotationContainer=p,exports.AnnotationLayer=K,exports.AnnotationPaintLayer=Q,exports.Annotations=q,exports.Circle=k,exports.FreeText=f,exports.Highlight=W,exports.Ink=x,exports.Line=B,exports.Polygon=E,exports.Polyline=M,exports.PreviewRenderer=Y,exports.RenderAnnotation=T,exports.Square=V,exports.Squiggly=U,exports.Stamp=F,exports.Strikeout=O,exports.TextMarkup=G,exports.Underline=H,exports.useAnnotation=t=>{var n,l;const{provides:r}=c(),i=e.ref((null==(l=null==(n=null==r?void 0:r.value)?void 0:n.forDocument(e.toValue(t)))?void 0:l.getState())??o.initialDocumentState());return e.watch([r,()=>e.toValue(t)],([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:e.computed(()=>{var o;return(null==(o=r.value)?void 0:o.forDocument(e.toValue(t)))??null})}},exports.useAnnotationCapability=c,exports.useAnnotationPlugin=a,Object.keys(o).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
2
2
  //# sourceMappingURL=index.cjs.map