@vue-pdf-viewer/annotation 0.0.0-experimental.5 → 0.0.0-experimental.7

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 I, computed as g, openBlock as s, createBlock as p, resolveDynamicComponent as f, normalizeProps as b, mergeProps as A, createSlots as B, withCtx as l, renderSlot as v, renderList as te, createElementBlock as w, defineAsyncComponent as ne, unref as h, ref as x, createTextVNode as L, toDisplayString as E, createVNode as d, normalizeClass as V, createCommentVNode as P, mergeModels as oe, useModel as j, watchEffect as ae, createElementVNode as q, reactive as le, Transition as ie, h as se } from "vue";
3
- var S;
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
- })(S || (S = {}));
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 re = {
10
+ })(z || (z = {}));
11
+ const ce = {
12
12
  ANNOTATIONS: "annotations"
13
- }, O = Symbol("VPV Shared UIs"), R = Symbol("VPV Current Localization"), ce = (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 = I(O), e = g(() => o?.AppTooltip);
17
- return (t, a) => e.value ? (s(), p(f(e.value), b(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
- te(t.$slots, (c, r) => ({
24
- name: r,
23
+ ne(t.$slots, (u, p) => ({
24
+ name: p,
25
25
  fn: l(() => [
26
- v(t.$slots, r)
26
+ v(t.$slots, p)
27
27
  ])
28
28
  }))
29
- ]), 1040)) : (s(), w("div", b(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 = I(O), e = g(() => o?.AppButton);
37
- return (t, a) => e.value ? (s(), p(f(e.value), b(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(), w("button", b(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
- }), ue = (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
- }, pe = /* @__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 = ne({
58
- loader: () => ue(/* @__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(), p(f(h(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(pe, [["__scopeId", "data-v-c6e40782"]]), z = () => {
69
- const n = I(
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
- }, ve = /* @__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 = x(!1), c = () => {
84
+ const { t: e } = H(), t = o, a = x(!1), u = () => {
85
85
  a.value = !a.value, t("toggle", a.value);
86
86
  };
87
- return (r, u) => r.$slots.default ? v(r.$slots, "default", {
87
+ return (p, c) => p.$slots.default ? v(p.$slots, "default", {
88
88
  key: 0,
89
- onClick: c
90
- }, void 0, !0) : (s(), p(F, { key: 1 }, {
89
+ onClick: u
90
+ }, void 0, !0) : (i(), r(L, { key: 1 }, {
91
91
  content: l(() => [
92
- L(E(a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip")), 1)
92
+ B(O(a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip")), 1)
93
93
  ]),
94
94
  default: l(() => [
95
- d(H, {
95
+ g(V, {
96
96
  "aria-label": a.value ? h(e)("annotationToggleHideTooltip") : h(e)("annotationToggleShowTooltip"),
97
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": a.value }]),
98
- onClick: c
97
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": a.value }]),
98
+ onClick: u
99
99
  }, {
100
100
  default: l(() => [
101
- d(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 ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__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 = I(O), e = g(() => o?.AppPopover);
117
- return (t, a) => e.value ? (s(), p(f(e.value), b(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 ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
122
122
  v(t.$slots, "default")
123
123
  ]),
124
124
  _: 3
125
- }, 16)) : (s(), w("button", b(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 = I(O), e = g(() => o?.AppHighlightColorPicker);
133
- return (t, a) => e.value ? (s(), p(f(e.value), b(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__ */ oe(["change"], ["update:active"]),
141
+ emits: /* @__PURE__ */ ae(["change"], ["update:active"]),
142
142
  setup(n, { emit: o }) {
143
- const e = j(n, "active"), t = x(!1), a = o, { t: c } = z(), r = x(M.Purple), u = () => {
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 ae(() => {
149
- !e.value || a("change", r.value);
150
- }), (y, $) => y.$slots.default ? v(y.$slots, "default", {
148
+ return le(() => {
149
+ !e.value || a("change", p.value);
150
+ }), (m, A) => m.$slots.default ? v(m.$slots, "default", {
151
151
  key: 0,
152
- onClick: u
153
- }) : (s(), p(Y, {
152
+ onClick: c
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
- d(F, null, {
161
+ g(L, null, {
162
162
  content: l(() => [
163
- L(E(h(c)("annotationHighlightTooltip")), 1)
163
+ B(O(h(u)("annotationHighlightTooltip")), 1)
164
164
  ]),
165
165
  default: l(() => [
166
- d(H, {
167
- "aria-label": h(c)("annotationHighlightLabel"),
168
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": e.value }]),
169
- onClick: u
166
+ g(V, {
167
+ "aria-label": h(u)("annotationHighlightLabel"),
168
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": e.value }]),
169
+ onClick: c
170
170
  }, {
171
171
  default: l(() => [
172
- v(y.$slots, "icon", {}, () => [
173
- d(U, { name: "tool-highlight" })
172
+ v(m.$slots, "icon", {}, () => [
173
+ g(F, { name: "tool-highlight" })
174
174
  ])
175
175
  ]),
176
176
  _: 3
@@ -180,24 +180,24 @@ const ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
180
180
  })
181
181
  ]),
182
182
  default: l(() => [
183
- q("div", fe, [
184
- q("p", null, E(h(c)("annotationHighlightColorPickerLabel")), 1),
185
- d(de, {
186
- color: r.value,
187
- "onUpdate:color": $[0] || ($[0] = (C) => r.value = C)
183
+ q("div", he, [
184
+ q("p", null, O(h(u)("annotationHighlightColorPickerLabel")), 1),
185
+ g(de, {
186
+ color: p.value,
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
195
  __name: "AppSignatures",
196
196
  setup(n) {
197
- const o = I(O), e = g(() => o?.AppSignatures);
198
- return (t, a) => e.value ? (s(), p(f(e.value), b(A({ key: 0 }, t.$attrs)), null, 16)) : P("", !0);
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
199
  }
200
- }), me = /* @__PURE__ */ m({
200
+ }), Te = /* @__PURE__ */ T({
201
201
  __name: "ToolAnnotationSignature",
202
202
  props: {
203
203
  active: { type: Boolean, required: !0 },
@@ -205,36 +205,36 @@ const ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
205
205
  },
206
206
  emits: ["update:active"],
207
207
  setup(n) {
208
- const o = j(n, "active"), { t: e } = z(), t = x(!1), a = () => {
208
+ const o = M(n, "active"), { t: e } = H(), t = x(!1), a = () => {
209
209
  !o.value && !t.value && (t.value = !0), o.value = !o.value;
210
- }, c = (r) => {
210
+ }, u = (p) => {
211
211
  t.value = !1;
212
212
  };
213
- return (r, u) => r.$slots.default ? v(r.$slots, "default", {
213
+ return (p, c) => p.$slots.default ? v(p.$slots, "default", {
214
214
  key: 0,
215
215
  onClick: a
216
- }) : (s(), p(Y, {
216
+ }) : (i(), r(Y, {
217
217
  key: 1,
218
218
  open: t.value,
219
219
  side: "right",
220
220
  sideOffset: 10,
221
221
  class: "vpv-annotation-signatures__popover",
222
- onInteractOutside: c
222
+ onInteractOutside: u
223
223
  }, {
224
224
  trigger: l(() => [
225
- d(F, null, {
225
+ g(L, null, {
226
226
  content: l(() => [
227
- L(E(h(e)("annotationSignatureTooltip")), 1)
227
+ B(O(h(e)("annotationSignatureTooltip")), 1)
228
228
  ]),
229
229
  default: l(() => [
230
- d(H, {
230
+ g(V, {
231
231
  "aria-label": h(e)("annotationSignatureLabel"),
232
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
232
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
233
233
  onClick: a
234
234
  }, {
235
235
  default: l(() => [
236
- v(r.$slots, "icon", {}, () => [
237
- d(U, { name: "tool-signature" })
236
+ v(p.$slots, "icon", {}, () => [
237
+ g(F, { name: "tool-signature" })
238
238
  ])
239
239
  ]),
240
240
  _: 3
@@ -244,12 +244,12 @@ const ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
244
244
  })
245
245
  ]),
246
246
  default: l(() => [
247
- d(_e)
247
+ g(me)
248
248
  ]),
249
249
  _: 3
250
250
  }, 8, ["open"]));
251
251
  }
252
- }), Te = /* @__PURE__ */ m({
252
+ }), ke = /* @__PURE__ */ T({
253
253
  __name: "ToolAnnotationFreeText",
254
254
  props: {
255
255
  active: { type: Boolean, required: !0 },
@@ -257,25 +257,25 @@ const ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
257
257
  },
258
258
  emits: ["update:active"],
259
259
  setup(n) {
260
- const o = j(n, "active"), { t: e } = z(), t = () => {
260
+ const o = M(n, "active"), { t: e } = H(), t = () => {
261
261
  o.value = !o.value;
262
262
  };
263
- return (a, c) => a.$slots.default ? v(a.$slots, "default", {
263
+ return (a, u) => a.$slots.default ? v(a.$slots, "default", {
264
264
  key: 0,
265
265
  onClick: t
266
- }) : (s(), p(F, { key: 1 }, {
266
+ }) : (i(), r(L, { key: 1 }, {
267
267
  content: l(() => [
268
- L(E(h(e)("annotationFreeTextTooltip")), 1)
268
+ B(O(h(e)("annotationFreeTextTooltip")), 1)
269
269
  ]),
270
270
  default: l(() => [
271
- d(H, {
271
+ g(V, {
272
272
  "aria-label": h(e)("annotationFreeTextLabel"),
273
- class: V(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
273
+ class: j(["vpv-toolbar-btn", { "vpv-toolbar-btn-active": o.value }]),
274
274
  onClick: t
275
275
  }, {
276
276
  default: l(() => [
277
277
  v(a.$slots, "icon", {}, () => [
278
- d(U, { name: "tool-free-text" })
278
+ g(F, { name: "tool-free-text" })
279
279
  ])
280
280
  ]),
281
281
  _: 3
@@ -284,10 +284,43 @@ const ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
284
284
  _: 3
285
285
  }));
286
286
  }
287
- }), ye = { class: "vpv-annotation-tools-container" }, ke = {
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 = {
288
321
  key: 0,
289
322
  class: "vpv-annotation-tools"
290
- }, be = {
323
+ }, Ae = {
291
324
  highlight: {
292
325
  type: [Object, Boolean],
293
326
  default: () => !0
@@ -300,165 +333,188 @@ const ge = /* @__PURE__ */ D(ve, [["__scopeId", "data-v-52907777"]]), Y = /* @__
300
333
  type: [Object, Boolean],
301
334
  default: () => !0
302
335
  },
336
+ image: {
337
+ type: [Object, Boolean],
338
+ default: () => !0
339
+ },
303
340
  instanceId: {
304
341
  type: Number,
305
342
  required: !0
306
343
  }
307
- }, Ae = /* @__PURE__ */ m({
344
+ }, Ce = /* @__PURE__ */ T({
308
345
  __name: "VPdfAnnotationTools",
309
- props: be,
346
+ props: Ae,
310
347
  emits: ["highlight", "freeText", "signature"],
311
348
  setup(n, { emit: o }) {
312
- const e = n, t = o, a = (i) => ce(e.instanceId, i), c = {
349
+ const e = n, t = o, a = (s) => ue(e.instanceId, s), u = {
313
350
  highlight: new CustomEvent(
314
- a(S.highlight),
351
+ a(P.highlight),
315
352
  {
316
353
  detail: { active: !1, color: null }
317
354
  }
318
355
  ),
319
356
  freeText: new CustomEvent(
320
- a(S.freeText),
357
+ a(P.freeText),
321
358
  {
322
359
  detail: { active: !1 }
323
360
  }
324
361
  ),
325
362
  signature: new CustomEvent(
326
- a(S.signature),
363
+ a(P.signature),
327
364
  {
328
365
  detail: { active: !1 }
329
366
  }
330
- )
331
- }, r = x(!1), u = le({
367
+ ),
368
+ image: new CustomEvent(a(P.image), {
369
+ detail: { active: !1 }
370
+ })
371
+ }, p = x(!1), c = ie({
332
372
  highlight: !1,
333
373
  freeText: !1,
334
374
  signature: !1
335
- }), T = x(null), y = g({
336
- get: () => u.highlight,
337
- set: (i) => {
338
- u.highlight = i, i ? (u.freeText = !1, u.signature = !1) : (T.value = null, N());
375
+ }), k = x(null), m = f({
376
+ get: () => c.highlight,
377
+ set: (s) => {
378
+ c.highlight = s, s ? (c.freeText = !1, c.signature = !1) : (k.value = null, U());
339
379
  }
340
- }), $ = g({
341
- get: () => u.freeText,
342
- set: (i) => {
343
- i && (u.highlight = !1, u.signature = !1), u.freeText = i, N();
380
+ }), A = f({
381
+ get: () => c.freeText,
382
+ set: (s) => {
383
+ s && (c.highlight = !1, c.signature = !1), c.freeText = s, U();
344
384
  }
345
- }), C = g({
346
- get: () => u.signature,
347
- set: (i) => {
348
- i && (u.highlight = !1, u.freeText = !1), u.signature = i, N();
385
+ }), I = f({
386
+ get: () => c.signature,
387
+ set: (s) => {
388
+ s && (c.highlight = !1, c.freeText = !1), c.signature = s, U();
349
389
  }
350
- }), G = g(() => e.highlight), K = g(() => e.freeText), Z = g(() => e.signature), J = (i) => {
351
- r.value = i, i || (y.value = !1, $.value = !1, C.value = !1, T.value = null);
352
- }, Q = (i) => {
353
- T.value = i, N();
354
- }, W = (i, k) => {
355
- t("highlight", i), c.highlight.detail.active = i, c.highlight.detail.color = k, window.dispatchEvent(c.highlight);
356
- }, X = (i) => {
357
- t("freeText", i), c.freeText.detail.active = i, window.dispatchEvent(c.freeText);
358
- }, ee = (i) => {
359
- t("signature", i), c.signature.detail.active = i, window.dispatchEvent(c.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);
360
400
  };
361
- function N() {
362
- W(y.value, T.value), X($.value), ee(C.value);
401
+ function U() {
402
+ X(m.value, k.value), ee(A.value), te(I.value);
363
403
  }
364
- return (i, k) => (s(), w("div", ye, [
365
- d(ge, { onToggle: J }),
366
- d(ie, { name: "slide" }, {
404
+ return (s, y) => (i(), N("div", be, [
405
+ g(fe, { onToggle: Q }),
406
+ g(se, { name: "slide" }, {
367
407
  default: l(() => [
368
- r.value ? (s(), w("div", ke, [
369
- G.value ? (s(), p(he, {
408
+ p.value ? (i(), N("div", $e, [
409
+ G.value ? (i(), r(_e, {
370
410
  key: 0,
371
- active: y.value,
372
- "onUpdate:active": k[0] || (k[0] = (_) => y.value = _),
373
- onChange: Q
374
- }, B({ _: 2 }, [
411
+ active: m.value,
412
+ "onUpdate:active": y[0] || (y[0] = (_) => m.value = _),
413
+ onChange: W
414
+ }, E({ _: 2 }, [
375
415
  e.highlight?.props?.icon ? {
376
416
  name: "icon",
377
417
  fn: l(() => [
378
- (s(), p(f(e.highlight.props.icon)))
418
+ (i(), r(d(e.highlight.props.icon)))
379
419
  ]),
380
420
  key: "0"
381
421
  } : typeof e.highlight == "object" ? {
382
422
  name: "default",
383
423
  fn: l(({ onClick: _ }) => [
384
- (s(), p(f(e.highlight), { onClick: _ }, null, 8, ["onClick"]))
424
+ (i(), r(d(e.highlight), { onClick: _ }, null, 8, ["onClick"]))
385
425
  ]),
386
426
  key: "1"
387
427
  } : void 0
388
- ]), 1032, ["active"])) : P("", !0),
389
- K.value ? (s(), p(Te, {
428
+ ]), 1032, ["active"])) : C("", !0),
429
+ K.value ? (i(), r(ke, {
390
430
  key: 1,
391
- active: $.value,
392
- "onUpdate:active": k[1] || (k[1] = (_) => $.value = _)
393
- }, B({ _: 2 }, [
431
+ active: A.value,
432
+ "onUpdate:active": y[1] || (y[1] = (_) => A.value = _)
433
+ }, E({ _: 2 }, [
394
434
  e.freeText?.props?.icon ? {
395
435
  name: "icon",
396
436
  fn: l(() => [
397
- (s(), p(f(e.freeText.props.icon)))
437
+ (i(), r(d(e.freeText.props.icon)))
398
438
  ]),
399
439
  key: "0"
400
440
  } : typeof e.freeText == "object" ? {
401
441
  name: "default",
402
442
  fn: l(({ onClick: _ }) => [
403
- (s(), p(f(e.freeText), { onClick: _ }, null, 8, ["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"]))
404
459
  ]),
405
460
  key: "1"
406
461
  } : void 0
407
- ]), 1032, ["active"])) : P("", !0),
408
- Z.value ? (s(), p(me, {
409
- key: 2,
410
- active: C.value,
411
- "onUpdate:active": k[2] || (k[2] = (_) => C.value = _)
412
- }, 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 }, [
413
468
  e.signature?.props?.icon ? {
414
469
  name: "icon",
415
470
  fn: l(() => [
416
- (s(), p(f(e.signature.props.icon)))
471
+ (i(), r(d(e.signature.props.icon)))
417
472
  ]),
418
473
  key: "0"
419
474
  } : typeof e.signature == "object" ? {
420
475
  name: "default",
421
476
  fn: l(({ onClick: _ }) => [
422
- (s(), p(f(e.signature), { onClick: _ }, null, 8, ["onClick"]))
477
+ (i(), r(d(e.signature), { onClick: _ }, null, 8, ["onClick"]))
423
478
  ]),
424
479
  key: "1"
425
480
  } : void 0
426
- ]), 1032, ["active"])) : P("", !0)
427
- ])) : P("", !0)
481
+ ]), 1032, ["active"])) : C("", !0)
482
+ ])) : C("", !0)
428
483
  ]),
429
484
  _: 1
430
485
  })
431
486
  ]));
432
487
  }
433
488
  });
434
- const $e = /* @__PURE__ */ D(Ae, [["__scopeId", "data-v-61a608d5"]]), Pe = (n = {}) => {
435
- 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;
436
491
  return {
437
492
  name: "annotation",
438
- setup(a) {
439
- const { componentInstance: c, shared: r } = a, u = c?.uid ?? 0;
440
- a.toolbar.addItem({
441
- id: re.ANNOTATIONS,
493
+ setup(u) {
494
+ const { componentInstance: p, shared: c } = u, k = p?.uid ?? 0;
495
+ u.toolbar.addItem({
496
+ id: ce.ANNOTATIONS,
442
497
  toolbarDirection: "left",
443
- component: se($e, {
498
+ component: re(Ie, {
444
499
  highlight: o,
445
500
  freeText: !1,
446
- signature: t,
447
- instanceId: u
501
+ signature: !1,
502
+ image: a,
503
+ instanceId: k
448
504
  })
449
505
  });
450
- const T = c?.appContext.app;
451
- r.ui ? (T.provide(O, r.ui), console.log(
506
+ const m = p?.appContext.app;
507
+ c.ui ? (m.provide(S, c.ui), console.log(
452
508
  "VPdfAnnotationPlugin - Provided UI context at plugin level"
453
509
  )) : console.warn(
454
510
  "VPdfAnnotationPlugin - No UI context found in plugin context"
455
- ), r.localization?.value ? T.provide(R, r.localization) : console.warn(
511
+ ), c.localization?.value ? m.provide(R, c.localization) : console.warn(
456
512
  "VPdfAnnotationPlugin - No localization found in plugin context"
457
513
  );
458
514
  }
459
515
  };
460
516
  };
461
517
  export {
462
- $e as VPdfAnnotationTools,
463
- Pe as default
518
+ Ie as VPdfAnnotationTools,
519
+ xe as default
464
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 k;(function(l){l.highlight="vpv:annotation:highlight",l.freeText="vpv:annotation:freeText",l.signature="vpv:annotation:signature"})(k||(k={}));var B;(function(l){l.Purple="#7862FF",l.Cyan="#3FE9E3",l.Red="#F87777",l.Orange="#FE9639",l.Yellow="#FBDA15",l.Green="#88F526"})(B||(B={}));const z={ANNOTATIONS:"annotations"},_=Symbol("VPV Shared UIs"),S=Symbol("VPV Current Localization"),M=(l,o)=>`${l}-${o}`,C=e.defineComponent({__name:"AppTooltip",setup(l){const o=e.inject(_),t=e.computed(()=>o?.AppTooltip);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),e.createSlots({default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:2},[e.renderList(n.$slots,(s,i)=>({name:i,fn:e.withCtx(()=>[e.renderSlot(n.$slots,i)])}))]),1040)):(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),w=e.defineComponent({__name:"AppButton",setup(l){const o=e.inject(_),t=e.computed(()=>o?.AppButton);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),j=(l,o)=>{const t=l[o];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((n,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+o)))})},I=e.defineComponent({__name:"Icon",props:{name:{}},setup(l){const o=l,t=e.defineAsyncComponent({loader:()=>j(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>W),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>ee),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>oe),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>le),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>re)}),`../assets/icons/${o.name}.svg`)});return(n,a)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),{class:"vp-text-xl"}))}}),ge="",b=(l,o)=>{const t=l.__vccOpts||l;for(const[n,a]of o)t[n]=a;return t},T=b(I,[["__scopeId","data-v-c6e40782"]]),y=()=>{const l=e.inject(S,e.computed(()=>({})));return{t:e.computed(()=>t=>{const n=t.split(".").pop()||t;return l.value&&n in l.value?l.value[n]:(console.warn(`useLocalization - Translation not found for key: ${t}`),t)}).value,currentLocale:e.computed(()=>l.value)}},D=e.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(l,{emit:o}){const{t}=y(),n=o,a=e.ref(!1),s=()=>{a.value=!a.value,n("toggle",a.value)};return(i,c)=>i.$slots.default?e.renderSlot(i.$slots,"default",{key:0,onClick:s},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:s},{default:e.withCtx(()=>[e.createVNode(T,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),_e="",H=b(D,[["__scopeId","data-v-52907777"]]),P=e.defineComponent({__name:"AppPopover",setup(l){const o=e.inject(_),t=e.computed(()=>o?.AppPopover);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{trigger:e.withCtx(()=>[e.renderSlot(n.$slots,"trigger")]),default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),L=e.defineComponent({__name:"AppHighlightColorPicker",setup(l){const o=e.inject(_),t=e.computed(()=>o?.AppHighlightColorPicker);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$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(l,{emit:o}){const t=e.useModel(l,"active"),n=e.ref(!1),a=o,{t:s}=y(),i=e.ref(B.Purple),c=()=>{!t.value&&!n.value&&(n.value=!0),t.value=!t.value},d=f=>{n.value=!1};return e.watchEffect(()=>{!t.value||a("change",i.value)}),(f,g)=>f.$slots.default?e.renderSlot(f.$slots,"default",{key:0,onClick:c}):(e.openBlock(),e.createBlock(P,{key:1,open:n.value,side:"right",sideOffset:10,onInteractOutside:d},{trigger:e.withCtx(()=>[e.createVNode(C,null,{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("annotationHighlightTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(s)("annotationHighlightLabel"),class:e.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]),onClick:c},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"icon",{},()=>[e.createVNode(T,{name:"tool-highlight"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createElementVNode("p",null,e.toDisplayString(e.unref(s)("annotationHighlightColorPickerLabel")),1),e.createVNode(L,{color:i.value,"onUpdate:color":g[0]||(g[0]=u=>i.value=u)},null,8,["color"])])]),_:3},8,["open"]))}}),q=e.defineComponent({__name:"AppSignatures",setup(l){const o=e.inject(_),t=e.computed(()=>o?.AppSignatures);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),null,16)):e.createCommentVNode("",!0)}}),v=e.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=y(),n=e.ref(!1),a=()=>{!o.value&&!n.value&&(n.value=!0),o.value=!o.value},s=i=>{n.value=!1};return(i,c)=>i.$slots.default?e.renderSlot(i.$slots,"default",{key:0,onClick:a}):(e.openBlock(),e.createBlock(P,{key:1,open:n.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:s},{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":o.value}]),onClick:a},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"icon",{},()=>[e.createVNode(T,{name:"tool-signature"})])]),_:3},8,["aria-label","class"])]),_:3})]),default:e.withCtx(()=>[e.createVNode(q)]),_:3},8,["open"]))}}),R=e.defineComponent({__name:"ToolAnnotationFreeText",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=y(),n=()=>{o.value=!o.value};return(a,s)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:n}):(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":o.value}]),onClick:n},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[e.createVNode(T,{name:"tool-free-text"})])]),_:3},8,["aria-label","class"])]),_:3}))}}),Y={class:"vpv-annotation-tools-container"},G={key:0,class:"vpv-annotation-tools"},K={highlight:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0}},Z=e.defineComponent({__name:"VPdfAnnotationTools",props:K,emits:["highlight","freeText","signature"],setup(l,{emit:o}){const t=l,n=o,a=r=>M(t.instanceId,r),s={highlight:new CustomEvent(a(k.highlight),{detail:{active:!1,color:null}}),freeText:new CustomEvent(a(k.freeText),{detail:{active:!1}}),signature:new CustomEvent(a(k.signature),{detail:{active:!1}})},i=e.ref(!1),c=e.reactive({highlight:!1,freeText:!1,signature:!1}),d=e.ref(null),f=e.computed({get:()=>c.highlight,set:r=>{c.highlight=r,r?(c.freeText=!1,c.signature=!1):(d.value=null,x())}}),g=e.computed({get:()=>c.freeText,set:r=>{r&&(c.highlight=!1,c.signature=!1),c.freeText=r,x()}}),u=e.computed({get:()=>c.signature,set:r=>{r&&(c.highlight=!1,c.freeText=!1),c.signature=r,x()}}),ie=e.computed(()=>t.highlight),se=e.computed(()=>t.freeText),ce=e.computed(()=>t.signature),pe=r=>{i.value=r,r||(f.value=!1,g.value=!1,u.value=!1,d.value=null)},de=r=>{d.value=r,x()},fe=(r,m)=>{n("highlight",r),s.highlight.detail.active=r,s.highlight.detail.color=m,window.dispatchEvent(s.highlight)},he=r=>{n("freeText",r),s.freeText.detail.active=r,window.dispatchEvent(s.freeText)},me=r=>{n("signature",r),s.signature.detail.active=r,window.dispatchEvent(s.signature)};function x(){fe(f.value,d.value),he(g.value),me(u.value)}return(r,m)=>(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(H,{onToggle:pe}),e.createVNode(e.Transition,{name:"slide"},{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",G,[ie.value?(e.openBlock(),e.createBlock(U,{key:0,active:f.value,"onUpdate:active":m[0]||(m[0]=p=>f.value=p),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:p})=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.highlight),{onClick:p},null,8,["onClick"]))]),key:"1"}:void 0]),1032,["active"])):e.createCommentVNode("",!0),se.value?(e.openBlock(),e.createBlock(R,{key:1,active:g.value,"onUpdate:active":m[1]||(m[1]=p=>g.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),ce.value?(e.openBlock(),e.createBlock(v,{key:2,active:u.value,"onUpdate:active":m[2]||(m[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})]))}}),ue="",$=b(Z,[["__scopeId","data-v-61a608d5"]]),J=(l={})=>{const{highlight:o,freeText:t,signature:n}=l;return{name:"annotation",setup(a){const{componentInstance:s,shared:i}=a,c=s?.uid??0;a.toolbar.addItem({id:z.ANNOTATIONS,toolbarDirection:"left",component:e.h($,{highlight:o,freeText:!1,signature:n,instanceId:c})});const d=s?.appContext.app;i.ui?(d.provide(_,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")}}},Q={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function V(l,o){return e.openBlock(),e.createElementBlock("svg",Q,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 W=Object.freeze(Object.defineProperty({__proto__:null,render:V,default:{render:V}},Symbol.toStringTag,{value:"Module"})),X={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function N(l,o){return e.openBlock(),e.createElementBlock("svg",X,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 ee=Object.freeze(Object.defineProperty({__proto__:null,render:N,default:{render:N}},Symbol.toStringTag,{value:"Module"})),te={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function A(l,o){return e.openBlock(),e.createElementBlock("svg",te,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 oe=Object.freeze(Object.defineProperty({__proto__:null,render:A,default:{render:A}},Symbol.toStringTag,{value:"Module"})),ne={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function E(l,o){return e.openBlock(),e.createElementBlock("svg",ne,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 le=Object.freeze(Object.defineProperty({__proto__:null,render:E,default:{render:E}},Symbol.toStringTag,{value:"Module"})),ae={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function O(l,o){return e.openBlock(),e.createElementBlock("svg",ae,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 re=Object.freeze(Object.defineProperty({__proto__:null,render:O,default:{render:O}},Symbol.toStringTag,{value:"Module"}));h.VPdfAnnotationTools=$,h.default=J,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,o)=>`${l}-${o}`,C=e.defineComponent({__name:"AppTooltip",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppTooltip);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),e.createSlots({default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:2},[e.renderList(n.$slots,(c,s)=>({name:s,fn:e.withCtx(()=>[e.renderSlot(n.$slots,s)])}))]),1040)):(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),w=e.defineComponent({__name:"AppButton",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppButton);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),j=(l,o)=>{const t=l[o];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((n,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+o)))})},D=e.defineComponent({__name:"Icon",props:{name:{}},setup(l){const o=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/${o.name}.svg`)});return(n,a)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),{class:"vp-text-xl"}))}}),we="",b=(l,o)=>{const t=l.__vccOpts||l;for(const[n,a]of o)t[n]=a;return t},y=b(D,[["__scopeId","data-v-c6e40782"]]),B=()=>{const l=e.inject(S,e.computed(()=>({})));return{t:e.computed(()=>t=>{const n=t.split(".").pop()||t;return l.value&&n in l.value?l.value[n]:(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:o}){const{t}=B(),n=o,a=e.ref(!1),c=()=>{a.value=!a.value,n("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 o=e.inject(k),t=e.computed(()=>o?.AppPopover);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),{trigger:e.withCtx(()=>[e.renderSlot(n.$slots,"trigger")]),default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.normalizeProps(e.mergeProps({key:1},n.$attrs)),[e.renderSlot(n.$slots,"default")],16))}}),F=e.defineComponent({__name:"AppHighlightColorPicker",setup(l){const o=e.inject(k),t=e.computed(()=>o?.AppHighlightColorPicker);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$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:o}){const t=e.useModel(l,"active"),n=e.ref(!1),a=o,{t:c}=B(),s=e.ref(x.Purple),i=()=>{!t.value&&!n.value&&(n.value=!0),t.value=!t.value},f=d=>{n.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:n.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 o=e.inject(k),t=e.computed(()=>o?.AppSignatures);return(n,a)=>t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.normalizeProps(e.mergeProps({key:0},n.$attrs)),null,16)):e.createCommentVNode("",!0)}}),Y=e.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(l){const o=e.useModel(l,"active"),{t}=B(),n=e.ref(!1),a=()=>{!o.value&&!n.value&&(n.value=!0),o.value=!o.value},c=s=>{n.value=!1};return(s,i)=>s.$slots.default?e.renderSlot(s.$slots,"default",{key:0,onClick:a}):(e.openBlock(),e.createBlock($,{key:1,open:n.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":o.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 o=e.useModel(l,"active"),{t}=B(),n=()=>{o.value=!o.value};return(a,c)=>a.$slots.default?e.renderSlot(a.$slots,"default",{key:0,onClick:n}):(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":o.value}]),onClick:n},{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:o}=B(),t=()=>{const n=document.createElement("input");n.type="file",n.accept="image/*",n.onchange=a=>{a.target.files?.[0]},n.click()};return(n,a)=>n.$slots.default?e.renderSlot(n.$slots,"default",{key:0,onClick:t}):(e.openBlock(),e.createBlock(C,{key:1},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("annotationImageTooltip")),1)]),default:e.withCtx(()=>[e.createVNode(w,{"aria-label":e.unref(o)("annotationImageLabel"),class:"vpv-toolbar-btn",onClick:t},{default:e.withCtx(()=>[e.renderSlot(n.$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:o}){const t=l,n=o,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)=>{n("highlight",r),c.highlight.detail.active=r,c.highlight.detail.color=g,window.dispatchEvent(c.highlight)},ue=r=>{n("freeText",r),c.freeText.detail.active=r,window.dispatchEvent(c.freeText)},Ce=r=>{n("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:o,freeText:t,signature:n,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:o,freeText:!1,signature:!1,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,o){return e.openBlock(),e.createElementBlock("svg",v,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 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,o){return e.openBlock(),e.createElementBlock("svg",te,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 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,o){return e.openBlock(),e.createElementBlock("svg",ne,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 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,o){return e.openBlock(),e.createElementBlock("svg",ae,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 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,o){return e.openBlock(),e.createElementBlock("svg",ie,o[0]||(o[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,o){return e.openBlock(),e.createElementBlock("svg",se,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 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.5",
4
+ "version": "0.0.0-experimental.7",
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.13",
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
  },