@vue-pdf-viewer/annotation 0.0.0-experimental.4 → 0.0.0-experimental.6

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.
package/dist/index.js CHANGED
@@ -1,63 +1,63 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-61a608d5]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-61a608d5] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-61a608d5],.slide-leave-active[data-v-61a608d5]{transition:all .3s ease-out}.slide-enter-from[data-v-61a608d5],.slide-leave-to[data-v-61a608d5]{opacity:0}.slide-enter-from[data-v-61a608d5],.slide-leave-to[data-v-61a608d5]{transform:translateY(-20px)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- import { defineComponent as m, inject as S, computed as g, openBlock as s, createBlock as u, resolveDynamicComponent as _, normalizeProps as A, mergeProps as $, createSlots as B, withCtx as l, renderSlot as v, renderList as ee, createElementBlock as I, defineAsyncComponent as te, unref as d, ref as w, createTextVNode as L, toDisplayString as O, createVNode as f, normalizeClass as V, createCommentVNode as P, mergeModels as ne, useModel as j, watchEffect as oe, createElementVNode as q, reactive as ae, Transition as le, h as ie } from "vue";
3
- var x;
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-a94f1d40]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-a94f1d40] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-a94f1d40],.slide-leave-active[data-v-a94f1d40]{transition:all .3s ease-out}.slide-enter-from[data-v-a94f1d40],.slide-leave-to[data-v-a94f1d40]{opacity:0}.slide-enter-from[data-v-a94f1d40],.slide-leave-to[data-v-a94f1d40]{transform:translateY(-20px)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
+ import { defineComponent as T, inject as w, computed as f, openBlock as i, createBlock as r, resolveDynamicComponent as d, normalizeProps as b, mergeProps as $, createSlots as E, withCtx as l, renderSlot as v, renderList as ne, createElementBlock as N, defineAsyncComponent as oe, unref as h, ref as x, createTextVNode as B, toDisplayString as O, createVNode as g, normalizeClass as j, createCommentVNode as C, mergeModels as ae, useModel as M, watchEffect as le, createElementVNode as q, reactive as ie, Transition as se, h as re } from "vue";
3
+ var P;
4
4
  (function(n) {
5
- n.highlight = "vpv:annotation:highlight", n.freeText = "vpv:annotation:freeText", n.signature = "vpv:annotation:signature";
6
- })(x || (x = {}));
7
- var M;
5
+ n.highlight = "vpv:annotation:highlight", n.freeText = "vpv:annotation:freeText", n.signature = "vpv:annotation:signature", n.image = "vpv:annotation:image";
6
+ })(P || (P = {}));
7
+ var z;
8
8
  (function(n) {
9
9
  n.Purple = "#7862FF", n.Cyan = "#3FE9E3", n.Red = "#F87777", n.Orange = "#FE9639", n.Yellow = "#FBDA15", n.Green = "#88F526";
10
- })(M || (M = {}));
11
- const se = {
10
+ })(z || (z = {}));
11
+ const ce = {
12
12
  ANNOTATIONS: "annotations"
13
- }, E = Symbol("VPV Shared UIs"), R = Symbol("VPV Current Localization"), re = (n, o) => `${n}-${o}`, F = /* @__PURE__ */ m({
13
+ }, S = Symbol("VPV Shared UIs"), R = Symbol("VPV Current Localization"), ue = (n, o) => `${n}-${o}`, L = /* @__PURE__ */ T({
14
14
  __name: "AppTooltip",
15
15
  setup(n) {
16
- const o = S(E), e = g(() => o?.AppTooltip);
17
- return (t, a) => e.value ? (s(), u(_(e.value), A($({ key: 0 }, t.$attrs)), B({
16
+ const o = w(S), e = f(() => o?.AppTooltip);
17
+ return (t, a) => e.value ? (i(), r(d(e.value), b($({ key: 0 }, t.$attrs)), E({
18
18
  default: l(() => [
19
19
  v(t.$slots, "default")
20
20
  ]),
21
21
  _: 2
22
22
  }, [
23
- ee(t.$slots, (r, p) => ({
23
+ ne(t.$slots, (u, p) => ({
24
24
  name: p,
25
25
  fn: l(() => [
26
26
  v(t.$slots, p)
27
27
  ])
28
28
  }))
29
- ]), 1040)) : (s(), I("div", A($({ key: 1 }, t.$attrs)), [
29
+ ]), 1040)) : (i(), N("div", b($({ key: 1 }, t.$attrs)), [
30
30
  v(t.$slots, "default")
31
31
  ], 16));
32
32
  }
33
- }), H = /* @__PURE__ */ m({
33
+ }), V = /* @__PURE__ */ T({
34
34
  __name: "AppButton",
35
35
  setup(n) {
36
- const o = S(E), e = g(() => o?.AppButton);
37
- return (t, a) => e.value ? (s(), u(_(e.value), A($({ key: 0 }, t.$attrs)), {
36
+ const o = w(S), e = f(() => o?.AppButton);
37
+ return (t, a) => e.value ? (i(), r(d(e.value), b($({ key: 0 }, t.$attrs)), {
38
38
  default: l(() => [
39
39
  v(t.$slots, "default")
40
40
  ]),
41
41
  _: 3
42
- }, 16)) : (s(), I("button", A($({ key: 1 }, t.$attrs)), [
42
+ }, 16)) : (i(), N("button", b($({ key: 1 }, t.$attrs)), [
43
43
  v(t.$slots, "default")
44
44
  ], 16));
45
45
  }
46
- }), ce = (n, o) => {
46
+ }), pe = (n, o) => {
47
47
  const e = n[o];
48
48
  return e ? typeof e == "function" ? e() : Promise.resolve(e) : new Promise((t, a) => {
49
49
  (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(a.bind(null, new Error("Unknown variable dynamic import: " + o)));
50
50
  });
51
- }, ue = /* @__PURE__ */ m({
51
+ }, ve = /* @__PURE__ */ T({
52
52
  __name: "Icon",
53
53
  props: {
54
54
  name: {}
55
55
  },
56
56
  setup(n) {
57
- const o = n, e = te({
58
- loader: () => ce(/* @__PURE__ */ Object.assign({ "../assets/icons/annotations.svg": () => import("./annotations.1313e99f.js"), "../assets/icons/tool-comment.svg": () => import("./tool-comment.d0e017dc.js"), "../assets/icons/tool-free-text.svg": () => import("./tool-free-text.bcc03e9a.js"), "../assets/icons/tool-highlight.svg": () => import("./tool-highlight.d3ea6f0b.js"), "../assets/icons/tool-signature.svg": () => import("./tool-signature.85da0b98.js") }), `../assets/icons/${o.name}.svg`)
57
+ const o = n, e = oe({
58
+ loader: () => pe(/* @__PURE__ */ Object.assign({ "../assets/icons/annotations.svg": () => import("./annotations.1313e99f.js"), "../assets/icons/tool-comment.svg": () => import("./tool-comment.d0e017dc.js"), "../assets/icons/tool-free-text.svg": () => import("./tool-free-text.bcc03e9a.js"), "../assets/icons/tool-highlight.svg": () => import("./tool-highlight.d3ea6f0b.js"), "../assets/icons/tool-image.svg": () => import("./tool-image.72fd3197.js"), "../assets/icons/tool-signature.svg": () => import("./tool-signature.85da0b98.js") }), `../assets/icons/${o.name}.svg`)
59
59
  });
60
- return (t, a) => (s(), u(_(d(e)), { class: "vp-text-xl" }));
60
+ return (t, a) => (i(), r(d(h(e)), { class: "vp-text-xl" }));
61
61
  }
62
62
  });
63
63
  const D = (n, o) => {
@@ -65,40 +65,40 @@ const D = (n, o) => {
65
65
  for (const [t, a] of o)
66
66
  e[t] = a;
67
67
  return e;
68
- }, U = /* @__PURE__ */ D(ue, [["__scopeId", "data-v-c6e40782"]]), z = () => {
69
- const n = S(
68
+ }, F = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-c6e40782"]]), H = () => {
69
+ const n = w(
70
70
  R,
71
- g(() => ({}))
71
+ f(() => ({}))
72
72
  );
73
73
  return {
74
- t: g(() => (e) => {
74
+ t: f(() => (e) => {
75
75
  const t = e.split(".").pop() || e;
76
76
  return n.value && t in n.value ? n.value[t] : (console.warn(`useLocalization - Translation not found for key: ${e}`), e);
77
77
  }).value,
78
- currentLocale: g(() => n.value)
78
+ currentLocale: f(() => n.value)
79
79
  };
80
- }, pe = /* @__PURE__ */ m({
80
+ }, ge = /* @__PURE__ */ T({
81
81
  __name: "ToolAnnotation",
82
82
  emits: ["toggle"],
83
83
  setup(n, { emit: o }) {
84
- const { t: e } = z(), t = o, a = w(!1), r = () => {
84
+ const { t: e } = H(), t = o, a = x(!1), u = () => {
85
85
  a.value = !a.value, t("toggle", a.value);
86
86
  };
87
87
  return (p, c) => p.$slots.default ? v(p.$slots, "default", {
88
88
  key: 0,
89
- onClick: r
90
- }, void 0, !0) : (s(), u(F, { key: 1 }, {
89
+ onClick: u
90
+ }, void 0, !0) : (i(), r(L, { key: 1 }, {
91
91
  content: l(() => [
92
- L(O(a.value ? d(e)("annotationToggleHideTooltip") : d(e)("annotationToggleShowTooltip")), 1)
92
+ B(O(a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip")), 1)
93
93
  ]),
94
94
  default: l(() => [
95
- f(H, {
96
- "aria-label": a.value ? d(e)("annotationToggleHideTooltip") : d(e)("annotationToggleShowTooltip"),
97
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": a.value }]),
98
- onClick: r
95
+ g(V, {
96
+ "aria-label": a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip"),
97
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": a.value }]),
98
+ onClick: u
99
99
  }, {
100
100
  default: l(() => [
101
- f(U, {
101
+ g(F, {
102
102
  name: "annotations",
103
103
  class: "vp-text-xl"
104
104
  })
@@ -110,11 +110,11 @@ const D = (n, o) => {
110
110
  }));
111
111
  }
112
112
  });
113
- const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @__PURE__ */ m({
113
+ const fe = /* @__PURE__ */ D(ge, [["__scopeId", "data-v-52907777"]]), Y = /* @__PURE__ */ T({
114
114
  __name: "AppPopover",
115
115
  setup(n) {
116
- const o = S(E), e = g(() => o?.AppPopover);
117
- return (t, a) => e.value ? (s(), u(_(e.value), A($({ key: 0 }, t.$attrs)), {
116
+ const o = w(S), e = f(() => o?.AppPopover);
117
+ return (t, a) => e.value ? (i(), r(d(e.value), b($({ key: 0 }, t.$attrs)), {
118
118
  trigger: l(() => [
119
119
  v(t.$slots, "trigger")
120
120
  ]),
@@ -122,55 +122,55 @@ const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @_
122
122
  v(t.$slots, "default")
123
123
  ]),
124
124
  _: 3
125
- }, 16)) : (s(), I("button", A($({ key: 1 }, t.$attrs)), [
125
+ }, 16)) : (i(), N("button", b($({ key: 1 }, t.$attrs)), [
126
126
  v(t.$slots, "default")
127
127
  ], 16));
128
128
  }
129
- }), de = /* @__PURE__ */ m({
129
+ }), de = /* @__PURE__ */ T({
130
130
  __name: "AppHighlightColorPicker",
131
131
  setup(n) {
132
- const o = S(E), e = g(() => o?.AppHighlightColorPicker);
133
- return (t, a) => e.value ? (s(), u(_(e.value), A($({ key: 0 }, t.$attrs)), null, 16)) : P("", !0);
132
+ const o = w(S), e = f(() => o?.AppHighlightColorPicker);
133
+ return (t, a) => e.value ? (i(), r(d(e.value), b($({ key: 0 }, t.$attrs)), null, 16)) : C("", !0);
134
134
  }
135
- }), fe = { class: "vpv-annotation-highlight__color-picker-wrapper" }, he = /* @__PURE__ */ m({
135
+ }), he = { class: "vpv-annotation-highlight__color-picker-wrapper" }, _e = /* @__PURE__ */ T({
136
136
  __name: "ToolAnnotationHighlight",
137
137
  props: {
138
138
  active: { type: Boolean, required: !0 },
139
139
  activeModifiers: {}
140
140
  },
141
- emits: /* @__PURE__ */ ne(["change"], ["update:active"]),
141
+ emits: /* @__PURE__ */ ae(["change"], ["update:active"]),
142
142
  setup(n, { emit: o }) {
143
- const e = j(n, "active"), t = w(!1), a = o, { t: r } = z(), p = w(M.Purple), c = () => {
143
+ const e = M(n, "active"), t = x(!1), a = o, { t: u } = H(), p = x(z.Purple), c = () => {
144
144
  !e.value && !t.value && (t.value = !0), e.value = !e.value;
145
- }, T = (y) => {
145
+ }, k = (m) => {
146
146
  t.value = !1;
147
147
  };
148
- return oe(() => {
148
+ return le(() => {
149
149
  !e.value || a("change", p.value);
150
- }), (y, b) => y.$slots.default ? v(y.$slots, "default", {
150
+ }), (m, A) => m.$slots.default ? v(m.$slots, "default", {
151
151
  key: 0,
152
152
  onClick: c
153
- }) : (s(), u(ge, {
153
+ }) : (i(), r(Y, {
154
154
  key: 1,
155
155
  open: t.value,
156
156
  side: "right",
157
157
  sideOffset: 10,
158
- onInteractOutside: T
158
+ onInteractOutside: k
159
159
  }, {
160
160
  trigger: l(() => [
161
- f(F, null, {
161
+ g(L, null, {
162
162
  content: l(() => [
163
- L(O(d(r)("annotationHighlightTooltip")), 1)
163
+ B(O(h(u)("annotationHighlightTooltip")), 1)
164
164
  ]),
165
165
  default: l(() => [
166
- f(H, {
167
- "aria-label": d(r)("annotationHighlightLabel"),
168
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": e.value }]),
166
+ g(V, {
167
+ "aria-label": h(u)("annotationHighlightLabel"),
168
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": e.value }]),
169
169
  onClick: c
170
170
  }, {
171
171
  default: l(() => [
172
- v(y.$slots, "icon", {}, () => [
173
- f(U, { name: "tool-highlight" })
172
+ v(m.$slots, "icon", {}, () => [
173
+ g(F, { name: "tool-highlight" })
174
174
  ])
175
175
  ]),
176
176
  _: 3
@@ -180,18 +180,24 @@ const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @_
180
180
  })
181
181
  ]),
182
182
  default: l(() => [
183
- q("div", fe, [
184
- q("p", null, O(d(r)("annotationHighlightColorPickerLabel")), 1),
185
- f(de, {
183
+ q("div", he, [
184
+ q("p", null, O(h(u)("annotationHighlightColorPickerLabel")), 1),
185
+ g(de, {
186
186
  color: p.value,
187
- "onUpdate:color": b[0] || (b[0] = (C) => p.value = C)
187
+ "onUpdate:color": A[0] || (A[0] = (I) => p.value = I)
188
188
  }, null, 8, ["color"])
189
189
  ])
190
190
  ]),
191
191
  _: 3
192
192
  }, 8, ["open"]));
193
193
  }
194
- }), _e = /* @__PURE__ */ m({
194
+ }), me = /* @__PURE__ */ T({
195
+ __name: "AppSignatures",
196
+ setup(n) {
197
+ const o = w(S), e = f(() => o?.AppSignatures);
198
+ return (t, a) => e.value ? (i(), r(d(e.value), b($({ key: 0 }, t.$attrs)), null, 16)) : C("", !0);
199
+ }
200
+ }), Te = /* @__PURE__ */ T({
195
201
  __name: "ToolAnnotationSignature",
196
202
  props: {
197
203
  active: { type: Boolean, required: !0 },
@@ -199,34 +205,51 @@ const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @_
199
205
  },
200
206
  emits: ["update:active"],
201
207
  setup(n) {
202
- const o = j(n, "active"), { t: e } = z(), t = () => {
203
- o.value = !o.value;
208
+ const o = M(n, "active"), { t: e } = H(), t = x(!1), a = () => {
209
+ !o.value && !t.value && (t.value = !0), o.value = !o.value;
210
+ }, u = (p) => {
211
+ t.value = !1;
204
212
  };
205
- return (a, r) => a.$slots.default ? v(a.$slots, "default", {
213
+ return (p, c) => p.$slots.default ? v(p.$slots, "default", {
206
214
  key: 0,
207
- onClick: t
208
- }) : (s(), u(F, { key: 1 }, {
209
- content: l(() => [
210
- L(O(d(e)("annotationSignatureTooltip")), 1)
211
- ]),
212
- default: l(() => [
213
- f(H, {
214
- "aria-label": d(e)("annotationSignatureLabel"),
215
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
216
- onClick: t
217
- }, {
215
+ onClick: a
216
+ }) : (i(), r(Y, {
217
+ key: 1,
218
+ open: t.value,
219
+ side: "right",
220
+ sideOffset: 10,
221
+ class: "vpv-annotation-signatures__popover",
222
+ onInteractOutside: u
223
+ }, {
224
+ trigger: l(() => [
225
+ g(L, null, {
226
+ content: l(() => [
227
+ B(O(h(e)("annotationSignatureTooltip")), 1)
228
+ ]),
218
229
  default: l(() => [
219
- v(a.$slots, "icon", {}, () => [
220
- f(U, { name: "tool-signature" })
221
- ])
230
+ g(V, {
231
+ "aria-label": h(e)("annotationSignatureLabel"),
232
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
233
+ onClick: a
234
+ }, {
235
+ default: l(() => [
236
+ v(p.$slots, "icon", {}, () => [
237
+ g(F, { name: "tool-signature" })
238
+ ])
239
+ ]),
240
+ _: 3
241
+ }, 8, ["aria-label", "class"])
222
242
  ]),
223
243
  _: 3
224
- }, 8, ["aria-label", "class"])
244
+ })
245
+ ]),
246
+ default: l(() => [
247
+ g(me)
225
248
  ]),
226
249
  _: 3
227
- }));
250
+ }, 8, ["open"]));
228
251
  }
229
- }), me = /* @__PURE__ */ m({
252
+ }), ke = /* @__PURE__ */ T({
230
253
  __name: "ToolAnnotationFreeText",
231
254
  props: {
232
255
  active: { type: Boolean, required: !0 },
@@ -234,25 +257,25 @@ const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @_
234
257
  },
235
258
  emits: ["update:active"],
236
259
  setup(n) {
237
- const o = j(n, "active"), { t: e } = z(), t = () => {
260
+ const o = M(n, "active"), { t: e } = H(), t = () => {
238
261
  o.value = !o.value;
239
262
  };
240
- return (a, r) => a.$slots.default ? v(a.$slots, "default", {
263
+ return (a, u) => a.$slots.default ? v(a.$slots, "default", {
241
264
  key: 0,
242
265
  onClick: t
243
- }) : (s(), u(F, { key: 1 }, {
266
+ }) : (i(), r(L, { key: 1 }, {
244
267
  content: l(() => [
245
- L(O(d(e)("annotationFreeTextTooltip")), 1)
268
+ B(O(h(e)("annotationFreeTextTooltip")), 1)
246
269
  ]),
247
270
  default: l(() => [
248
- f(H, {
249
- "aria-label": d(e)("annotationFreeTextLabel"),
250
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
271
+ g(V, {
272
+ "aria-label": h(e)("annotationFreeTextLabel"),
273
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
251
274
  onClick: t
252
275
  }, {
253
276
  default: l(() => [
254
277
  v(a.$slots, "icon", {}, () => [
255
- f(U, { name: "tool-free-text" })
278
+ g(F, { name: "tool-free-text" })
256
279
  ])
257
280
  ]),
258
281
  _: 3
@@ -261,10 +284,43 @@ const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @_
261
284
  _: 3
262
285
  }));
263
286
  }
264
- }), Te = { class: "vpv-annotation-tools-container" }, ye = {
287
+ }), ye = /* @__PURE__ */ T({
288
+ __name: "ToolAnnotationImage",
289
+ setup(n) {
290
+ const { t: o } = H(), e = () => {
291
+ const t = document.createElement("input");
292
+ t.type = "file", t.accept = "image/*", t.onchange = (a) => {
293
+ a.target.files?.[0];
294
+ }, t.click();
295
+ };
296
+ return (t, a) => t.$slots.default ? v(t.$slots, "default", {
297
+ key: 0,
298
+ onClick: e
299
+ }) : (i(), r(L, { key: 1 }, {
300
+ content: l(() => [
301
+ B(O(h(o)("annotationImageTooltip")), 1)
302
+ ]),
303
+ default: l(() => [
304
+ g(V, {
305
+ "aria-label": h(o)("annotationImageLabel"),
306
+ class: "vpv-toolbar-btn",
307
+ onClick: e
308
+ }, {
309
+ default: l(() => [
310
+ v(t.$slots, "icon", {}, () => [
311
+ g(F, { name: "tool-image" })
312
+ ])
313
+ ]),
314
+ _: 3
315
+ }, 8, ["aria-label"])
316
+ ]),
317
+ _: 3
318
+ }));
319
+ }
320
+ }), be = { class: "vpv-annotation-tools-container" }, $e = {
265
321
  key: 0,
266
322
  class: "vpv-annotation-tools"
267
- }, ke = {
323
+ }, Ae = {
268
324
  highlight: {
269
325
  type: [Object, Boolean],
270
326
  default: () => !0
@@ -277,165 +333,188 @@ const ve = /* @__PURE__ */ D(pe, [["__scopeId", "data-v-52907777"]]), ge = /* @_
277
333
  type: [Object, Boolean],
278
334
  default: () => !0
279
335
  },
336
+ image: {
337
+ type: [Object, Boolean],
338
+ default: () => !0
339
+ },
280
340
  instanceId: {
281
341
  type: Number,
282
342
  required: !0
283
343
  }
284
- }, be = /* @__PURE__ */ m({
344
+ }, Ce = /* @__PURE__ */ T({
285
345
  __name: "VPdfAnnotationTools",
286
- props: ke,
346
+ props: Ae,
287
347
  emits: ["highlight", "freeText", "signature"],
288
348
  setup(n, { emit: o }) {
289
- const e = n, t = o, a = (i) => re(e.instanceId, i), r = {
349
+ const e = n, t = o, a = (s) => ue(e.instanceId, s), u = {
290
350
  highlight: new CustomEvent(
291
- a(x.highlight),
351
+ a(P.highlight),
292
352
  {
293
353
  detail: { active: !1, color: null }
294
354
  }
295
355
  ),
296
356
  freeText: new CustomEvent(
297
- a(x.freeText),
357
+ a(P.freeText),
298
358
  {
299
359
  detail: { active: !1 }
300
360
  }
301
361
  ),
302
362
  signature: new CustomEvent(
303
- a(x.signature),
363
+ a(P.signature),
304
364
  {
305
365
  detail: { active: !1 }
306
366
  }
307
- )
308
- }, p = w(!1), c = ae({
367
+ ),
368
+ image: new CustomEvent(a(P.image), {
369
+ detail: { active: !1 }
370
+ })
371
+ }, p = x(!1), c = ie({
309
372
  highlight: !1,
310
373
  freeText: !1,
311
374
  signature: !1
312
- }), T = w(null), y = g({
375
+ }), k = x(null), m = f({
313
376
  get: () => c.highlight,
314
- set: (i) => {
315
- c.highlight = i, i ? (c.freeText = !1, c.signature = !1) : (T.value = null, N());
377
+ set: (s) => {
378
+ c.highlight = s, s ? (c.freeText = !1, c.signature = !1) : (k.value = null, U());
316
379
  }
317
- }), b = g({
380
+ }), A = f({
318
381
  get: () => c.freeText,
319
- set: (i) => {
320
- i && (c.highlight = !1, c.signature = !1), c.freeText = i, N();
382
+ set: (s) => {
383
+ s && (c.highlight = !1, c.signature = !1), c.freeText = s, U();
321
384
  }
322
- }), C = g({
385
+ }), I = f({
323
386
  get: () => c.signature,
324
- set: (i) => {
325
- i && (c.highlight = !1, c.freeText = !1), c.signature = i, N();
387
+ set: (s) => {
388
+ s && (c.highlight = !1, c.freeText = !1), c.signature = s, U();
326
389
  }
327
- }), Y = g(() => e.highlight), G = g(() => e.freeText), K = g(() => e.signature), Z = (i) => {
328
- p.value = i, i || (y.value = !1, b.value = !1, C.value = !1, T.value = null);
329
- }, J = (i) => {
330
- T.value = i, N();
331
- }, Q = (i, k) => {
332
- t("highlight", i), r.highlight.detail.active = i, r.highlight.detail.color = k, window.dispatchEvent(r.highlight);
333
- }, W = (i) => {
334
- t("freeText", i), r.freeText.detail.active = i, window.dispatchEvent(r.freeText);
335
- }, X = (i) => {
336
- t("signature", i), r.signature.detail.active = i, window.dispatchEvent(r.signature);
390
+ }), G = f(() => e.highlight), K = f(() => e.freeText), Z = f(() => e.signature), J = f(() => e.image), Q = (s) => {
391
+ p.value = s, s || (m.value = !1, A.value = !1, I.value = !1, k.value = null);
392
+ }, W = (s) => {
393
+ k.value = s, U();
394
+ }, X = (s, y) => {
395
+ t("highlight", s), u.highlight.detail.active = s, u.highlight.detail.color = y, window.dispatchEvent(u.highlight);
396
+ }, ee = (s) => {
397
+ t("freeText", s), u.freeText.detail.active = s, window.dispatchEvent(u.freeText);
398
+ }, te = (s) => {
399
+ t("signature", s), u.signature.detail.active = s, window.dispatchEvent(u.signature);
337
400
  };
338
- function N() {
339
- Q(y.value, T.value), W(b.value), X(C.value);
401
+ function U() {
402
+ X(m.value, k.value), ee(A.value), te(I.value);
340
403
  }
341
- return (i, k) => (s(), I("div", Te, [
342
- f(ve, { onToggle: Z }),
343
- f(le, { name: "slide" }, {
404
+ return (s, y) => (i(), N("div", be, [
405
+ g(fe, { onToggle: Q }),
406
+ g(se, { name: "slide" }, {
344
407
  default: l(() => [
345
- p.value ? (s(), I("div", ye, [
346
- Y.value ? (s(), u(he, {
408
+ p.value ? (i(), N("div", $e, [
409
+ G.value ? (i(), r(_e, {
347
410
  key: 0,
348
- active: y.value,
349
- "onUpdate:active": k[0] || (k[0] = (h) => y.value = h),
350
- onChange: J
351
- }, B({ _: 2 }, [
411
+ active: m.value,
412
+ "onUpdate:active": y[0] || (y[0] = (_) => m.value = _),
413
+ onChange: W
414
+ }, E({ _: 2 }, [
352
415
  e.highlight?.props?.icon ? {
353
416
  name: "icon",
354
417
  fn: l(() => [
355
- (s(), u(_(e.highlight.props.icon)))
418
+ (i(), r(d(e.highlight.props.icon)))
356
419
  ]),
357
420
  key: "0"
358
421
  } : typeof e.highlight == "object" ? {
359
422
  name: "default",
360
- fn: l(({ onClick: h }) => [
361
- (s(), u(_(e.highlight), { onClick: h }, null, 8, ["onClick"]))
423
+ fn: l(({ onClick: _ }) => [
424
+ (i(), r(d(e.highlight), { onClick: _ }, null, 8, ["onClick"]))
362
425
  ]),
363
426
  key: "1"
364
427
  } : void 0
365
- ]), 1032, ["active"])) : P("", !0),
366
- G.value ? (s(), u(me, {
428
+ ]), 1032, ["active"])) : C("", !0),
429
+ K.value ? (i(), r(ke, {
367
430
  key: 1,
368
- active: b.value,
369
- "onUpdate:active": k[1] || (k[1] = (h) => b.value = h)
370
- }, B({ _: 2 }, [
431
+ active: A.value,
432
+ "onUpdate:active": y[1] || (y[1] = (_) => A.value = _)
433
+ }, E({ _: 2 }, [
371
434
  e.freeText?.props?.icon ? {
372
435
  name: "icon",
373
436
  fn: l(() => [
374
- (s(), u(_(e.freeText.props.icon)))
437
+ (i(), r(d(e.freeText.props.icon)))
375
438
  ]),
376
439
  key: "0"
377
440
  } : typeof e.freeText == "object" ? {
378
441
  name: "default",
379
- fn: l(({ onClick: h }) => [
380
- (s(), u(_(e.freeText), { onClick: h }, null, 8, ["onClick"]))
442
+ fn: l(({ onClick: _ }) => [
443
+ (i(), r(d(e.freeText), { onClick: _ }, null, 8, ["onClick"]))
444
+ ]),
445
+ key: "1"
446
+ } : void 0
447
+ ]), 1032, ["active"])) : C("", !0),
448
+ J.value ? (i(), r(ye, { key: 2 }, E({ _: 2 }, [
449
+ e.image?.props?.icon ? {
450
+ name: "icon",
451
+ fn: l(() => [
452
+ (i(), r(d(e.image.props.icon)))
453
+ ]),
454
+ key: "0"
455
+ } : typeof e.image == "object" ? {
456
+ name: "default",
457
+ fn: l(({ onClick: _ }) => [
458
+ (i(), r(d(e.image), { onClick: _ }, null, 8, ["onClick"]))
381
459
  ]),
382
460
  key: "1"
383
461
  } : void 0
384
- ]), 1032, ["active"])) : P("", !0),
385
- K.value ? (s(), u(_e, {
386
- key: 2,
387
- active: C.value,
388
- "onUpdate:active": k[2] || (k[2] = (h) => C.value = h)
389
- }, B({ _: 2 }, [
462
+ ]), 1024)) : C("", !0),
463
+ Z.value ? (i(), r(Te, {
464
+ key: 3,
465
+ active: I.value,
466
+ "onUpdate:active": y[2] || (y[2] = (_) => I.value = _)
467
+ }, E({ _: 2 }, [
390
468
  e.signature?.props?.icon ? {
391
469
  name: "icon",
392
470
  fn: l(() => [
393
- (s(), u(_(e.signature.props.icon)))
471
+ (i(), r(d(e.signature.props.icon)))
394
472
  ]),
395
473
  key: "0"
396
474
  } : typeof e.signature == "object" ? {
397
475
  name: "default",
398
- fn: l(({ onClick: h }) => [
399
- (s(), u(_(e.signature), { onClick: h }, null, 8, ["onClick"]))
476
+ fn: l(({ onClick: _ }) => [
477
+ (i(), r(d(e.signature), { onClick: _ }, null, 8, ["onClick"]))
400
478
  ]),
401
479
  key: "1"
402
480
  } : void 0
403
- ]), 1032, ["active"])) : P("", !0)
404
- ])) : P("", !0)
481
+ ]), 1032, ["active"])) : C("", !0)
482
+ ])) : C("", !0)
405
483
  ]),
406
484
  _: 1
407
485
  })
408
486
  ]));
409
487
  }
410
488
  });
411
- const Ae = /* @__PURE__ */ D(be, [["__scopeId", "data-v-61a608d5"]]), Ce = (n = {}) => {
412
- const { highlight: o, freeText: e, signature: t } = n;
489
+ const Ie = /* @__PURE__ */ D(Ce, [["__scopeId", "data-v-a94f1d40"]]), xe = (n = {}) => {
490
+ const { highlight: o, freeText: e, signature: t, image: a } = n;
413
491
  return {
414
492
  name: "annotation",
415
- setup(a) {
416
- const { componentInstance: r, shared: p } = a, c = r?.uid ?? 0;
417
- a.toolbar.addItem({
418
- id: se.ANNOTATIONS,
493
+ setup(u) {
494
+ const { componentInstance: p, shared: c } = u, k = p?.uid ?? 0;
495
+ u.toolbar.addItem({
496
+ id: ce.ANNOTATIONS,
419
497
  toolbarDirection: "left",
420
- component: ie(Ae, {
498
+ component: re(Ie, {
421
499
  highlight: o,
422
500
  freeText: !1,
423
- signature: !1,
424
- instanceId: c
501
+ signature: t,
502
+ image: a,
503
+ instanceId: k
425
504
  })
426
505
  });
427
- const T = r?.appContext.app;
428
- p.ui ? (T.provide(E, p.ui), console.log(
506
+ const m = p?.appContext.app;
507
+ c.ui ? (m.provide(S, c.ui), console.log(
429
508
  "VPdfAnnotationPlugin - Provided UI context at plugin level"
430
509
  )) : console.warn(
431
510
  "VPdfAnnotationPlugin - No UI context found in plugin context"
432
- ), p.localization?.value ? T.provide(R, p.localization) : console.warn(
511
+ ), c.localization?.value ? m.provide(R, c.localization) : console.warn(
433
512
  "VPdfAnnotationPlugin - No localization found in plugin context"
434
513
  );
435
514
  }
436
515
  };
437
516
  };
438
517
  export {
439
- Ae as VPdfAnnotationTools,
440
- Ce as default
518
+ Ie as VPdfAnnotationTools,
519
+ xe as default
441
520
  };
@@ -1,2 +1,2 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-61a608d5]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-61a608d5] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-61a608d5],.slide-leave-active[data-v-61a608d5]{transition:all .3s ease-out}.slide-enter-from[data-v-61a608d5],.slide-leave-to[data-v-61a608d5]{opacity:0}.slide-enter-from[data-v-61a608d5],.slide-leave-to[data-v-61a608d5]{transform:translateY(-20px)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h["@vue-pdf-viewer/annotation"]={},h.Vue))})(this,function(h,e){"use strict";var u;(function(n){n.highlight="vpv:annotation:highlight",n.freeText="vpv:annotation:freeText",n.signature="vpv:annotation:signature"})(u||(u={}));var B;(function(n){n.Purple="#7862FF",n.Cyan="#3FE9E3",n.Red="#F87777",n.Orange="#FE9639",n.Yellow="#FBDA15",n.Green="#88F526"})(B||(B={}));const z={ANNOTATIONS:"annotations"},k=Symbol("VPV Shared UIs"),P=Symbol("VPV Current Localization"),M=(n,o)=>`${n}-${o}`,C=e.defineComponent({__name:"AppTooltip",setup(n){const o=e.inject(k),t=e.computed(()=>o?.AppTooltip);return(l,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},l.$attrs)),e.createSlots({default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:2},[e.renderList(l.$slots,(i,c)=>({name:c,fn:e.withCtx(()=>[e.renderSlot(l.$slots,c)])}))]),1040)):(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.mergeProps({key:1},l.$attrs)),[e.renderSlot(l.$slots,"default")],16))}}),T=e.defineComponent({__name:"AppButton",setup(n){const o=e.inject(k),t=e.computed(()=>o?.AppButton);return(l,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},l.$attrs)),{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},l.$attrs)),[e.renderSlot(l.$slots,"default")],16))}}),O=(n,o)=>{const t=n[o];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((l,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+o)))})},j=e.defineComponent({__name:"Icon",props:{name:{}},setup(n){const o=n,t=e.defineAsyncComponent({loader:()=>O(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>Q),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>X),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>te),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>ne),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>ae)}),`../assets/icons/${o.name}.svg`)});return(l,a)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),{class:"vp-text-xl"}))}}),me="",b=(n,o)=>{const t=n.__vccOpts||n;for(const[l,a]of o)t[l]=a;return t},w=b(j,[["__scopeId","data-v-c6e40782"]]),y=()=>{const n=e.inject(P,e.computed(()=>({})));return{t:e.computed(()=>t=>{const l=t.split(".").pop()||t;return n.value&&l in n.value?n.value[l]:(console.warn(`useLocalization - Translation not found for key: ${t}`),t)}).value,currentLocale:e.computed(()=>n.value)}},I=e.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(n,{emit:o}){const{t}=y(),l=o,a=e.ref(!1),i=()=>{a.value=!a.value,l("toggle",a.value)};return(c,s)=>c.$slots.default?e.renderSlot(c.$slots,"default",{key:0,onClick:i},void 0,!0):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(T,{"aria-label":a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":a.value}]),onClick:i},{default:e.withCtx(()=>[e.createVNode(w,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),ge="",D=b(I,[["__scopeId","data-v-52907777"]]),H=e.defineComponent({__name:"AppPopover",setup(n){const o=e.inject(k),t=e.computed(()=>o?.AppPopover);return(l,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},l.$attrs)),{trigger:e.withCtx(()=>[e.renderSlot(l.$slots,"trigger")]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},l.$attrs)),[e.renderSlot(l.$slots,"default")],16))}}),L=e.defineComponent({__name:"AppHighlightColorPicker",setup(n){const o=e.inject(k),t=e.computed(()=>o?.AppHighlightColorPicker);return(l,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},l.$attrs)),null,16)):e.createCommentVNode("",!0)}}),F={class:"vpv-annotation-highlight__color-picker-wrapper"},U=e.defineComponent({__name:"ToolAnnotationHighlight",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:e.mergeModels(["change"],["update:active"]),setup(n,{emit:o}){const t=e.useModel(n,"active"),l=e.ref(!1),a=o,{t:i}=y(),c=e.ref(B.Purple),s=()=>{!t.value&&!l.value&&(l.value=!0),t.value=!t.value},p=f=>{l.value=!1};return e.watchEffect(()=>{!t.value||a("change",c.value)}),(f,g)=>f.$slots.default?e.renderSlot(f.$slots,"default",{key:0,onClick:s}):(e.openBlock(),e.createBlock(H,{key:1,open:l.value,side:"right",sideOffset:10,onInteractOutside:p},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("annotationHighlightTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(T,{"aria-label":e.unref(i)("annotationHighlightLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]),onClick:s},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"icon",{},()=>[e.createVNode(w,{name:"tool-highlight"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createElementVNode("p",null,e.toDisplayString(e.unref(i)("annotationHighlightColorPickerLabel")),1),e.createVNode(L,{color:c.value,"onUpdate:color":g[0]||(g[0]=_=>c.value=_)},null,8,["color"])])]),_:3},8,["open"]))}}),q=e.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(n){const o=e.useModel(n,"active"),{t}=y(),l=()=>{o.value=!o.value};return(a,i)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:l}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationSignatureTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(T,{"aria-label":e.unref(t)("annotationSignatureLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":o.value}]),onClick:l},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[e.createVNode(w,{name:"tool-signature"})])]),_:3},8,["aria-label","class"])]),_:3}))}}),v=e.defineComponent({__name:"ToolAnnotationFreeText",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(n){const o=e.useModel(n,"active"),{t}=y(),l=()=>{o.value=!o.value};return(a,i)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:l}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationFreeTextTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(T,{"aria-label":e.unref(t)("annotationFreeTextLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":o.value}]),onClick:l},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[e.createVNode(w,{name:"tool-free-text"})])]),_:3},8,["aria-label","class"])]),_:3}))}}),R={class:"vpv-annotation-tools-container"},Y={key:0,class:"vpv-annotation-tools"},G={highlight:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0}},K=e.defineComponent({__name:"VPdfAnnotationTools",props:G,emits:["highlight","freeText","signature"],setup(n,{emit:o}){const t=n,l=o,a=r=>M(t.instanceId,r),i={highlight:new CustomEvent(a(u.highlight),{detail:{active:!1,color:null}}),freeText:new CustomEvent(a(u.freeText),{detail:{active:!1}}),signature:new CustomEvent(a(u.signature),{detail:{active:!1}})},c=e.ref(!1),s=e.reactive({highlight:!1,freeText:!1,signature:!1}),p=e.ref(null),f=e.computed({get:()=>s.highlight,set:r=>{s.highlight=r,r?(s.freeText=!1,s.signature=!1):(p.value=null,x())}}),g=e.computed({get:()=>s.freeText,set:r=>{r&&(s.highlight=!1,s.signature=!1),s.freeText=r,x()}}),_=e.computed({get:()=>s.signature,set:r=>{r&&(s.highlight=!1,s.freeText=!1),s.signature=r,x()}}),re=e.computed(()=>t.highlight),ie=e.computed(()=>t.freeText),se=e.computed(()=>t.signature),ce=r=>{c.value=r,r||(f.value=!1,g.value=!1,_.value=!1,p.value=null)},de=r=>{p.value=r,x()},pe=(r,m)=>{l("highlight",r),i.highlight.detail.active=r,i.highlight.detail.color=m,window.dispatchEvent(i.highlight)},fe=r=>{l("freeText",r),i.freeText.detail.active=r,window.dispatchEvent(i.freeText)},he=r=>{l("signature",r),i.signature.detail.active=r,window.dispatchEvent(i.signature)};function x(){pe(f.value,p.value),fe(g.value),he(_.value)}return(r,m)=>(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(D,{onToggle:ce}),e.createVNode(e.Transition,{name:"slide"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",Y,[re.value?(e.openBlock(),e.createBlock(U,{key:0,active:f.value,"onUpdate:active":m[0]||(m[0]=d=>f.value=d),onChange:de},e.createSlots({_:2},[t.highlight?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight.props.icon)))]),key:"0"}:typeof t.highlight=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),ie.value?(e.openBlock(),e.createBlock(v,{key:1,active:g.value,"onUpdate:active":m[1]||(m[1]=d=>g.value=d)},e.createSlots({_:2},[t.freeText?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText.props.icon)))]),key:"0"}:typeof t.freeText=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),se.value?(e.openBlock(),e.createBlock(q,{key:2,active:_.value,"onUpdate:active":m[2]||(m[2]=d=>_.value=d)},e.createSlots({_:2},[t.signature?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature.props.icon)))]),key:"0"}:typeof t.signature=="object"?{name:"default",fn:e.withCtx(({onClick:d})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature),{onClick:d},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})]))}}),_e="",S=b(K,[["__scopeId","data-v-61a608d5"]]),Z=(n={})=>{const{highlight:o,freeText:t,signature:l}=n;return{name:"annotation",setup(a){const{componentInstance:i,shared:c}=a,s=i?.uid??0;a.toolbar.addItem({id:z.ANNOTATIONS,toolbarDirection:"left",component:e.h(S,{highlight:o,freeText:!1,signature:!1,instanceId:s})});const p=i?.appContext.app;c.ui?(p.provide(k,c.ui),console.log("VPdfAnnotationPlugin - Provided UI context at plugin level")):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),c.localization?.value?p.provide(P,c.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context")}}},J={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function $(n,o){return e.openBlock(),e.createElementBlock("svg",J,o[0]||(o[0]=[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)]))}const Q=Object.freeze(Object.defineProperty({__proto__:null,render:$,default:{render:$}},Symbol.toStringTag,{value:"Module"})),W={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function V(n,o){return e.openBlock(),e.createElementBlock("svg",W,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),e.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)]))}const X=Object.freeze(Object.defineProperty({__proto__:null,render:V,default:{render:V}},Symbol.toStringTag,{value:"Module"})),ee={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function N(n,o){return e.openBlock(),e.createElementBlock("svg",ee,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)]))}const te=Object.freeze(Object.defineProperty({__proto__:null,render:N,default:{render:N}},Symbol.toStringTag,{value:"Module"})),oe={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function A(n,o){return e.openBlock(),e.createElementBlock("svg",oe,o[0]||(o[0]=[e.createElementVNode("g",{"clip-path":"url(#a)"},[e.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"a"},[e.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)]))}const ne=Object.freeze(Object.defineProperty({__proto__:null,render:A,default:{render:A}},Symbol.toStringTag,{value:"Module"})),le={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function E(n,o){return e.openBlock(),e.createElementBlock("svg",le,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)]))}const ae=Object.freeze(Object.defineProperty({__proto__:null,render:E,default:{render:E}},Symbol.toStringTag,{value:"Module"}));h.VPdfAnnotationTools=S,h.default=Z,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".vp-text-xl[data-v-c6e40782]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-52907777],.vpv-toolbar-btn[data-v-52907777]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-tools-container[data-v-a94f1d40]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-a94f1d40] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-a94f1d40],.slide-leave-active[data-v-a94f1d40]{transition:all .3s ease-out}.slide-enter-from[data-v-a94f1d40],.slide-leave-to[data-v-a94f1d40]{opacity:0}.slide-enter-from[data-v-a94f1d40],.slide-leave-to[data-v-a94f1d40]{transform:translateY(-20px)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
+ (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m["@vue-pdf-viewer/annotation"]={},m.Vue))})(this,function(m,e){"use strict";var _;(function(l){l.highlight="vpv:annotation:highlight",l.freeText="vpv:annotation:freeText",l.signature="vpv:annotation:signature",l.image="vpv:annotation:image"})(_||(_={}));var x;(function(l){l.Purple="#7862FF",l.Cyan="#3FE9E3",l.Red="#F87777",l.Orange="#FE9639",l.Yellow="#FBDA15",l.Green="#88F526"})(x||(x={}));const I={ANNOTATIONS:"annotations"},k=Symbol("VPV Shared UIs"),S=Symbol("VPV Current Localization"),M=(l,n)=>`${l}-${n}`,C=e.defineComponent({__name:"AppTooltip",setup(l){const n=e.inject(k),t=e.computed(()=>n?.AppTooltip);return(o,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},o.$attrs)),e.createSlots({default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:2},[e.renderList(o.$slots,(c,s)=>({name:s,fn:e.withCtx(()=>[e.renderSlot(o.$slots,s)])}))]),1040)):(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.mergeProps({key:1},o.$attrs)),[e.renderSlot(o.$slots,"default")],16))}}),w=e.defineComponent({__name:"AppButton",setup(l){const n=e.inject(k),t=e.computed(()=>n?.AppButton);return(o,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},o.$attrs)),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},o.$attrs)),[e.renderSlot(o.$slots,"default")],16))}}),j=(l,n)=>{const t=l[n];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((o,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+n)))})},D=e.defineComponent({__name:"Icon",props:{name:{}},setup(l){const n=l,t=e.defineAsyncComponent({loader:()=>j(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>ee),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>oe),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>le),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>re),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>ce),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>pe)}),`../assets/icons/${n.name}.svg`)});return(o,a)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),{class:"vp-text-xl"}))}}),we="",b=(l,n)=>{const t=l.__vccOpts||l;for(const[o,a]of n)t[o]=a;return t},y=b(D,[["__scopeId","data-v-c6e40782"]]),B=()=>{const l=e.inject(S,e.computed(()=>({})));return{t:e.computed(()=>t=>{const o=t.split(".").pop()||t;return l.value&&o in l.value?l.value[o]:(console.warn(`useLocalization - Translation not found for key: ${t}`),t)}).value,currentLocale:e.computed(()=>l.value)}},L=e.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(l,{emit:n}){const{t}=B(),o=n,a=e.ref(!1),c=()=>{a.value=!a.value,o("toggle",a.value)};return(s,i)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:c},void 0,!0):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":a.value?e.unref(t)("annotationToggleHideTooltip"):e.unref(t)("annotationToggleShowTooltip"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":a.value}]),onClick:c},{default:e.withCtx(()=>[e.createVNode(y,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),ye="",H=b(L,[["__scopeId","data-v-52907777"]]),$=e.defineComponent({__name:"AppPopover",setup(l){const n=e.inject(k),t=e.computed(()=>n?.AppPopover);return(o,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},o.$attrs)),{trigger:e.withCtx(()=>[e.renderSlot(o.$slots,"trigger")]),default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},o.$attrs)),[e.renderSlot(o.$slots,"default")],16))}}),F=e.defineComponent({__name:"AppHighlightColorPicker",setup(l){const n=e.inject(k),t=e.computed(()=>n?.AppHighlightColorPicker);return(o,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},o.$attrs)),null,16)):e.createCommentVNode("",!0)}}),U={class:"vpv-annotation-highlight__color-picker-wrapper"},q=e.defineComponent({__name:"ToolAnnotationHighlight",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:e.mergeModels(["change"],["update:active"]),setup(l,{emit:n}){const t=e.useModel(l,"active"),o=e.ref(!1),a=n,{t:c}=B(),s=e.ref(x.Purple),i=()=>{!t.value&&!o.value&&(o.value=!0),t.value=!t.value},f=d=>{o.value=!1};return e.watchEffect(()=>{!t.value||a("change",s.value)}),(d,h)=>d.$slots.default?e.renderSlot(d.$slots,"default",{key:0,onClick:i}):(e.openBlock(),e.createBlock($,{key:1,open:o.value,side:"right",sideOffset:10,onInteractOutside:f},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("annotationHighlightTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(c)("annotationHighlightLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]),onClick:i},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-highlight"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createElementVNode("p",null,e.toDisplayString(e.unref(c)("annotationHighlightColorPickerLabel")),1),e.createVNode(F,{color:s.value,"onUpdate:color":h[0]||(h[0]=u=>s.value=u)},null,8,["color"])])]),_:3},8,["open"]))}}),R=e.defineComponent({__name:"AppSignatures",setup(l){const n=e.inject(k),t=e.computed(()=>n?.AppSignatures);return(o,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},o.$attrs)),null,16)):e.createCommentVNode("",!0)}}),Y=e.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const n=e.useModel(l,"active"),{t}=B(),o=e.ref(!1),a=()=>{!n.value&&!o.value&&(o.value=!0),n.value=!n.value},c=s=>{o.value=!1};return(s,i)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:a}):(e.openBlock(),e.createBlock($,{key:1,open:o.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationSignatureTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationSignatureLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]),onClick:a},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-signature"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createVNode(R)]),_:3},8,["open"]))}}),G=e.defineComponent({__name:"ToolAnnotationFreeText",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const n=e.useModel(l,"active"),{t}=B(),o=()=>{n.value=!n.value};return(a,c)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:o}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("annotationFreeTextTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(t)("annotationFreeTextLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]),onClick:o},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-free-text"})])]),_:3},8,["aria-label","class"])]),_:3}))}}),K=e.defineComponent({__name:"ToolAnnotationImage",setup(l){const{t:n}=B(),t=()=>{const o=document.createElement("input");o.type="file",o.accept="image/*",o.onchange=a=>{a.target.files?.[0]},o.click()};return(o,a)=>o.$slots.default?e.renderSlot(o.$slots,"default",{key:0,onClick:t}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("annotationImageTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(n)("annotationImageLabel"),class:"vpv-toolbar-btn",onClick:t},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"icon",{},()=>[e.createVNode(y,{name:"tool-image"})])]),_:3},8,["aria-label"])]),_:3}))}}),Z={class:"vpv-annotation-tools-container"},J={key:0,class:"vpv-annotation-tools"},Q={highlight:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!0},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0}},W=e.defineComponent({__name:"VPdfAnnotationTools",props:Q,emits:["highlight","freeText","signature"],setup(l,{emit:n}){const t=l,o=n,a=r=>M(t.instanceId,r),c={highlight:new CustomEvent(a(_.highlight),{detail:{active:!1,color:null}}),freeText:new CustomEvent(a(_.freeText),{detail:{active:!1}}),signature:new CustomEvent(a(_.signature),{detail:{active:!1}}),image:new CustomEvent(a(_.image),{detail:{active:!1}})},s=e.ref(!1),i=e.reactive({highlight:!1,freeText:!1,signature:!1}),f=e.ref(null),d=e.computed({get:()=>i.highlight,set:r=>{i.highlight=r,r?(i.freeText=!1,i.signature=!1):(f.value=null,T())}}),h=e.computed({get:()=>i.freeText,set:r=>{r&&(i.highlight=!1,i.signature=!1),i.freeText=r,T()}}),u=e.computed({get:()=>i.signature,set:r=>{r&&(i.highlight=!1,i.freeText=!1),i.signature=r,T()}}),de=e.computed(()=>t.highlight),me=e.computed(()=>t.freeText),fe=e.computed(()=>t.signature),ge=e.computed(()=>t.image),he=r=>{s.value=r,r||(d.value=!1,h.value=!1,u.value=!1,f.value=null)},_e=r=>{f.value=r,T()},ke=(r,g)=>{o("highlight",r),c.highlight.detail.active=r,c.highlight.detail.color=g,window.dispatchEvent(c.highlight)},ue=r=>{o("freeText",r),c.freeText.detail.active=r,window.dispatchEvent(c.freeText)},Ce=r=>{o("signature",r),c.signature.detail.active=r,window.dispatchEvent(c.signature)};function T(){ke(d.value,f.value),ue(h.value),Ce(u.value)}return(r,g)=>(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(H,{onToggle:he}),e.createVNode(e.Transition,{name:"slide"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",J,[de.value?(e.openBlock(),e.createBlock(q,{key:0,active:d.value,"onUpdate:active":g[0]||(g[0]=p=>d.value=p),onChange:_e},e.createSlots({_:2},[t.highlight?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight.props.icon)))]),key:"0"}:typeof t.highlight=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),me.value?(e.openBlock(),e.createBlock(G,{key:1,active:h.value,"onUpdate:active":g[1]||(g[1]=p=>h.value=p)},e.createSlots({_:2},[t.freeText?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText.props.icon)))]),key:"0"}:typeof t.freeText=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.freeText),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),ge.value?(e.openBlock(),e.createBlock(K,{key:2},e.createSlots({_:2},[t.image?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.image.props.icon)))]),key:"0"}:typeof t.image=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.image),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1024)):e.createCommentVNode("",!0),fe.value?(e.openBlock(),e.createBlock(Y,{key:3,active:u.value,"onUpdate:active":g[2]||(g[2]=p=>u.value=p)},e.createSlots({_:2},[t.signature?.props?.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature.props.icon)))]),key:"0"}:typeof t.signature=="object"?{name:"default",fn:e.withCtx(({onClick:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.signature),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})]))}}),Be="",V=b(W,[["__scopeId","data-v-a94f1d40"]]),X=(l={})=>{const{highlight:n,freeText:t,signature:o,image:a}=l;return{name:"annotation",setup(c){const{componentInstance:s,shared:i}=c,f=s?.uid??0;c.toolbar.addItem({id:I.ANNOTATIONS,toolbarDirection:"left",component:e.h(V,{highlight:n,freeText:!1,signature:o,image:a,instanceId:f})});const d=s?.appContext.app;i.ui?(d.provide(k,i.ui),console.log("VPdfAnnotationPlugin - Provided UI context at plugin level")):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),i.localization?.value?d.provide(S,i.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context")}}},v={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function P(l,n){return e.openBlock(),e.createElementBlock("svg",v,n[0]||(n[0]=[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)]))}const ee=Object.freeze(Object.defineProperty({__proto__:null,render:P,default:{render:P}},Symbol.toStringTag,{value:"Module"})),te={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function N(l,n){return e.openBlock(),e.createElementBlock("svg",te,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),e.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)]))}const oe=Object.freeze(Object.defineProperty({__proto__:null,render:N,default:{render:N}},Symbol.toStringTag,{value:"Module"})),ne={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function A(l,n){return e.openBlock(),e.createElementBlock("svg",ne,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)]))}const le=Object.freeze(Object.defineProperty({__proto__:null,render:A,default:{render:A}},Symbol.toStringTag,{value:"Module"})),ae={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function E(l,n){return e.openBlock(),e.createElementBlock("svg",ae,n[0]||(n[0]=[e.createElementVNode("g",{"clip-path":"url(#a)"},[e.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"a"},[e.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)]))}const re=Object.freeze(Object.defineProperty({__proto__:null,render:E,default:{render:E}},Symbol.toStringTag,{value:"Module"})),ie={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function O(l,n){return e.openBlock(),e.createElementBlock("svg",ie,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)]))}const ce=Object.freeze(Object.defineProperty({__proto__:null,render:O,default:{render:O}},Symbol.toStringTag,{value:"Module"})),se={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function z(l,n){return e.openBlock(),e.createElementBlock("svg",se,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)]))}const pe=Object.freeze(Object.defineProperty({__proto__:null,render:z,default:{render:z}},Symbol.toStringTag,{value:"Module"}));m.VPdfAnnotationTools=V,m.default=X,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,21 @@
1
+ import { openBlock as t, createElementBlock as o, createElementVNode as l } from "vue";
2
+ const n = {
3
+ xmlns: "http://www.w3.org/2000/svg",
4
+ width: "1em",
5
+ height: "1em",
6
+ fill: "none",
7
+ viewBox: "0 0 20 20"
8
+ };
9
+ function r(a, e) {
10
+ return t(), o("svg", n, e[0] || (e[0] = [
11
+ l("path", {
12
+ fill: "currentColor",
13
+ d: "M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"
14
+ }, null, -1)
15
+ ]));
16
+ }
17
+ const i = { render: r };
18
+ export {
19
+ i as default,
20
+ r as render
21
+ };
package/dist/types.d.ts CHANGED
@@ -3,4 +3,5 @@ export interface VPdfAnnotationPluginOptions {
3
3
  highlight?: Component | boolean;
4
4
  freeText?: Component | boolean;
5
5
  signature?: Component | boolean;
6
+ image?: Component | boolean;
6
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/annotation",
3
3
  "private": false,
4
- "version": "0.0.0-experimental.4",
4
+ "version": "0.0.0-experimental.6",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
7
7
  "module": "./dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "vue": "^3.2.37"
30
30
  },
31
31
  "dependencies": {
32
- "@vue-pdf-viewer/shared": "^0.0.0-experimental.12",
32
+ "@vue-pdf-viewer/shared": "0.0.0-experimental.15",
33
33
  "vite-plugin-css-injected-by-js": "^3.5.2",
34
34
  "vue": "^3.2.37"
35
35
  },