@embedpdf/plugin-redaction 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +748 -105
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +25 -1
  6. package/dist/lib/index.d.ts +1 -0
  7. package/dist/lib/redaction-plugin.d.ts +98 -2
  8. package/dist/lib/tools.d.ts +28 -0
  9. package/dist/lib/types.d.ts +38 -11
  10. package/dist/preact/adapter.d.ts +4 -4
  11. package/dist/preact/annotation.d.ts +1 -0
  12. package/dist/preact/index.cjs +1 -1
  13. package/dist/preact/index.cjs.map +1 -1
  14. package/dist/preact/index.js +187 -11
  15. package/dist/preact/index.js.map +1 -1
  16. package/dist/react/annotation.d.ts +1 -0
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.cjs.map +1 -1
  19. package/dist/react/index.js +187 -11
  20. package/dist/react/index.js.map +1 -1
  21. package/dist/shared/components/annotations/index.d.ts +2 -0
  22. package/dist/shared/components/annotations/redact-area.d.ts +18 -0
  23. package/dist/shared/components/annotations/redact-highlight.d.ts +18 -0
  24. package/dist/shared/components/index.d.ts +3 -0
  25. package/dist/shared/components/redact-renderer-registration.d.ts +5 -0
  26. package/dist/shared/components/redact-renderers.d.ts +7 -0
  27. package/dist/shared/index.d.ts +1 -0
  28. package/dist/shared-preact/components/annotations/index.d.ts +2 -0
  29. package/dist/shared-preact/components/annotations/redact-area.d.ts +18 -0
  30. package/dist/shared-preact/components/annotations/redact-highlight.d.ts +18 -0
  31. package/dist/shared-preact/components/index.d.ts +3 -0
  32. package/dist/shared-preact/components/redact-renderer-registration.d.ts +5 -0
  33. package/dist/shared-preact/components/redact-renderers.d.ts +7 -0
  34. package/dist/shared-preact/index.d.ts +1 -0
  35. package/dist/shared-react/components/annotations/index.d.ts +2 -0
  36. package/dist/shared-react/components/annotations/redact-area.d.ts +18 -0
  37. package/dist/shared-react/components/annotations/redact-highlight.d.ts +18 -0
  38. package/dist/shared-react/components/index.d.ts +3 -0
  39. package/dist/shared-react/components/redact-renderer-registration.d.ts +5 -0
  40. package/dist/shared-react/components/redact-renderers.d.ts +7 -0
  41. package/dist/shared-react/index.d.ts +1 -0
  42. package/dist/svelte/components/RedactRendererRegistration.svelte.d.ts +7 -0
  43. package/dist/svelte/components/annotations/RedactArea.svelte.d.ts +5 -0
  44. package/dist/svelte/components/annotations/RedactHighlight.svelte.d.ts +5 -0
  45. package/dist/svelte/components/annotations/index.d.ts +2 -0
  46. package/dist/svelte/components/index.d.ts +3 -0
  47. package/dist/svelte/components/redact-renderers.d.ts +7 -0
  48. package/dist/svelte/index.cjs +1 -1
  49. package/dist/svelte/index.cjs.map +1 -1
  50. package/dist/svelte/index.d.ts +1 -0
  51. package/dist/svelte/index.js +270 -22
  52. package/dist/svelte/index.js.map +1 -1
  53. package/dist/vue/components/annotations/index.d.ts +2 -0
  54. package/dist/vue/components/annotations/redact-area.vue.d.ts +6 -0
  55. package/dist/vue/components/annotations/redact-highlight.vue.d.ts +6 -0
  56. package/dist/vue/components/index.d.ts +3 -0
  57. package/dist/vue/components/redact-renderer-registration.vue.d.ts +13 -0
  58. package/dist/vue/components/redact-renderers.d.ts +7 -0
  59. package/dist/vue/components/types.d.ts +1 -1
  60. package/dist/vue/hooks/use-redaction.d.ts +2 -2
  61. package/dist/vue/index.cjs +1 -1
  62. package/dist/vue/index.cjs.map +1 -1
  63. package/dist/vue/index.d.ts +2 -1
  64. package/dist/vue/index.js +264 -59
  65. package/dist/vue/index.js.map +1 -1
  66. package/package.json +13 -9
package/dist/vue/index.js CHANGED
@@ -1,45 +1,12 @@
1
- import { ref, watch, toValue, computed, defineComponent, createElementBlock, openBlock, Fragment, renderList, mergeProps, unref, createCommentVNode, normalizeClass, normalizeStyle, createVNode, useSlots, createElementVNode, createBlock, withCtx, renderSlot, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
2
- import { useCapability, usePlugin, useDocumentState } from "@embedpdf/core/vue";
3
- import { RedactionPlugin, initialDocumentState } from "@embedpdf/plugin-redaction";
1
+ import { createPluginPackage } from "@embedpdf/core";
2
+ import { RedactionPlugin, initialDocumentState, RedactionPluginPackage as RedactionPluginPackage$1 } from "@embedpdf/plugin-redaction";
4
3
  export * from "@embedpdf/plugin-redaction";
5
- import { Rotation } from "@embedpdf/models";
4
+ import { defineComponent, createElementBlock, openBlock, Fragment, renderList, mergeProps, unref, ref, watch, toValue, computed, createCommentVNode, normalizeClass, normalizeStyle, createVNode, useSlots, createElementVNode, createBlock, withCtx, renderSlot, resolveDynamicComponent, normalizeProps, guardReactiveProps, toDisplayString } from "vue";
5
+ import { useCapability, usePlugin, useDocumentState } from "@embedpdf/core/vue";
6
+ import { Rotation, PdfStandardFont, PdfTextAlignment, textAlignmentToCss, standardFontCss, PdfAnnotationSubtype } from "@embedpdf/models";
6
7
  import { CounterRotate } from "@embedpdf/utils/vue";
7
- const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
8
- const useRedactionCapability = () => useCapability(RedactionPlugin.id);
9
- const useRedaction = (documentId) => {
10
- const { provides } = useRedactionCapability();
11
- const state = ref(initialDocumentState);
12
- watch(
13
- [provides, () => toValue(documentId)],
14
- ([providesValue, docId], _, onCleanup) => {
15
- if (!providesValue) {
16
- state.value = initialDocumentState;
17
- return;
18
- }
19
- const scope = providesValue.forDocument(docId);
20
- try {
21
- state.value = scope.getState();
22
- } catch (e) {
23
- state.value = initialDocumentState;
24
- }
25
- const unsubscribe = scope.onStateChange((newState) => {
26
- state.value = newState;
27
- });
28
- onCleanup(unsubscribe);
29
- },
30
- { immediate: true }
31
- );
32
- const scopedProvides = computed(() => {
33
- var _a;
34
- const docId = toValue(documentId);
35
- return ((_a = provides.value) == null ? void 0 : _a.forDocument(docId)) ?? null;
36
- });
37
- return {
38
- state,
39
- provides: scopedProvides
40
- };
41
- };
42
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
8
+ import { createRenderer, useRegisterRenderers } from "@embedpdf/plugin-annotation/vue";
9
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
43
10
  __name: "highlight",
44
11
  props: {
45
12
  color: { default: "#FFFF00" },
@@ -79,7 +46,42 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
79
46
  };
80
47
  }
81
48
  });
82
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
49
+ const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
50
+ const useRedactionCapability = () => useCapability(RedactionPlugin.id);
51
+ const useRedaction = (documentId) => {
52
+ const { provides } = useRedactionCapability();
53
+ const state = ref(initialDocumentState);
54
+ watch(
55
+ [provides, () => toValue(documentId)],
56
+ ([providesValue, docId], _, onCleanup) => {
57
+ if (!providesValue) {
58
+ state.value = initialDocumentState;
59
+ return;
60
+ }
61
+ const scope = providesValue.forDocument(docId);
62
+ try {
63
+ state.value = scope.getState();
64
+ } catch (e) {
65
+ state.value = initialDocumentState;
66
+ }
67
+ const unsubscribe = scope.onStateChange((newState) => {
68
+ state.value = newState;
69
+ });
70
+ onCleanup(unsubscribe);
71
+ },
72
+ { immediate: true }
73
+ );
74
+ const scopedProvides = computed(() => {
75
+ var _a;
76
+ const docId = toValue(documentId);
77
+ return ((_a = provides.value) == null ? void 0 : _a.forDocument(docId)) ?? null;
78
+ });
79
+ return {
80
+ state,
81
+ provides: scopedProvides
82
+ };
83
+ };
84
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
83
85
  __name: "marquee-redact",
84
86
  props: {
85
87
  documentId: {},
@@ -99,6 +101,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
99
101
  if (props.scale !== void 0) return props.scale;
100
102
  return ((_a = documentState.value) == null ? void 0 : _a.scale) ?? 1;
101
103
  });
104
+ const strokeColor = computed(
105
+ () => {
106
+ var _a;
107
+ return props.stroke ?? ((_a = redactionPlugin.value) == null ? void 0 : _a.getPreviewStrokeColor()) ?? "red";
108
+ }
109
+ );
102
110
  watch(
103
111
  [redactionPlugin, () => props.documentId, () => props.pageIndex, actualScale],
104
112
  ([plugin, docId, pageIdx, scale], _, onCleanup) => {
@@ -127,7 +135,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
127
135
  top: `${rect.value.origin.y * actualScale.value}px`,
128
136
  width: `${rect.value.size.width * actualScale.value}px`,
129
137
  height: `${rect.value.size.height * actualScale.value}px`,
130
- border: `1px solid ${__props.stroke}`,
138
+ border: `1px solid ${strokeColor.value}`,
131
139
  background: __props.fill,
132
140
  boxSizing: "border-box"
133
141
  }),
@@ -145,7 +153,7 @@ const _hoisted_1$1 = {
145
153
  inset: 0
146
154
  }
147
155
  };
148
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
156
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
149
157
  __name: "selection-redact",
150
158
  props: {
151
159
  documentId: {},
@@ -157,6 +165,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
157
165
  const { plugin: redactionPlugin } = useRedactionPlugin();
158
166
  const rects = ref([]);
159
167
  const boundingRect = ref(null);
168
+ const strokeColor = computed(() => {
169
+ var _a;
170
+ return ((_a = redactionPlugin.value) == null ? void 0 : _a.getPreviewStrokeColor()) ?? "red";
171
+ });
160
172
  watch(
161
173
  [redactionPlugin, () => props.documentId, () => props.pageIndex],
162
174
  ([plugin, docId, pageIdx], _, onCleanup) => {
@@ -176,13 +188,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
176
188
  );
177
189
  return (_ctx, _cache) => {
178
190
  return boundingRect.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
179
- createVNode(_sfc_main$4, {
191
+ createVNode(_sfc_main$7, {
180
192
  color: "transparent",
181
193
  opacity: 1,
182
194
  rects: rects.value,
183
195
  scale: __props.scale,
184
- border: "1px solid red"
185
- }, null, 8, ["rects", "scale"])
196
+ border: `1px solid ${strokeColor.value}`
197
+ }, null, 8, ["rects", "scale", "border"])
186
198
  ])) : createCommentVNode("", true);
187
199
  };
188
200
  }
@@ -192,7 +204,7 @@ const _hoisted_1 = {
192
204
  style: { position: "absolute", inset: 0, pointerEvents: "none" }
193
205
  };
194
206
  const _hoisted_2 = ["onPointerdown", "onTouchstart"];
195
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
207
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
196
208
  __name: "pending-redactions",
197
209
  props: {
198
210
  documentId: {},
@@ -218,10 +230,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
218
230
  }
219
231
  const scoped = redactionValue.forDocument(docId);
220
232
  const currentState = scoped.getState();
221
- items.value = currentState.pending[pageIdx] ?? [];
233
+ items.value = (currentState.pending[pageIdx] ?? []).filter((it) => it.source === "legacy");
222
234
  selectedId.value = currentState.selected && currentState.selected.page === pageIdx ? currentState.selected.id : null;
223
235
  const off1 = scoped.onPendingChange((map) => {
224
- items.value = map[pageIdx] ?? [];
236
+ items.value = (map[pageIdx] ?? []).filter((it) => it.source === "legacy");
225
237
  });
226
238
  const off2 = scoped.onSelectedChange((sel) => {
227
239
  selectedId.value = sel && sel.page === pageIdx ? sel.id : null;
@@ -322,7 +334,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
322
334
  cursor: selectedId.value === item.id ? "pointer" : "default"
323
335
  })
324
336
  }, [
325
- createVNode(_sfc_main$4, {
337
+ createVNode(_sfc_main$7, {
326
338
  rect: item.rect,
327
339
  rects: item.rects,
328
340
  color: "transparent",
@@ -364,7 +376,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
364
376
  };
365
377
  }
366
378
  });
367
- const _sfc_main = /* @__PURE__ */ defineComponent({
379
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
368
380
  __name: "redaction-layer",
369
381
  props: {
370
382
  documentId: {},
@@ -389,7 +401,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
389
401
  });
390
402
  return (_ctx, _cache) => {
391
403
  return openBlock(), createElementBlock(Fragment, null, [
392
- createVNode(_sfc_main$1, {
404
+ createVNode(_sfc_main$4, {
393
405
  "document-id": __props.documentId,
394
406
  "page-index": __props.pageIndex,
395
407
  scale: actualScale.value,
@@ -402,12 +414,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
402
414
  ]),
403
415
  _: 3
404
416
  }, 8, ["document-id", "page-index", "scale", "rotation", "bbox-stroke", "selection-menu"]),
405
- createVNode(_sfc_main$3, {
417
+ createVNode(_sfc_main$6, {
406
418
  "document-id": __props.documentId,
407
419
  "page-index": __props.pageIndex,
408
420
  scale: actualScale.value
409
421
  }, null, 8, ["document-id", "page-index", "scale"]),
410
- createVNode(_sfc_main$2, {
422
+ createVNode(_sfc_main$5, {
411
423
  "document-id": __props.documentId,
412
424
  "page-index": __props.pageIndex,
413
425
  scale: actualScale.value
@@ -416,12 +428,205 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
416
428
  };
417
429
  }
418
430
  });
431
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
432
+ __name: "redact-highlight",
433
+ props: {
434
+ annotation: {},
435
+ isSelected: { type: Boolean },
436
+ scale: {},
437
+ pageIndex: {},
438
+ onClick: { type: Function }
439
+ },
440
+ setup(__props) {
441
+ const props = __props;
442
+ const isHovered = ref(false);
443
+ const segmentRects = computed(() => props.annotation.object.segmentRects ?? []);
444
+ const rect = computed(() => props.annotation.object.rect);
445
+ const strokeColor = computed(() => props.annotation.object.strokeColor ?? "#FF0000");
446
+ const color = computed(() => props.annotation.object.color ?? "#000000");
447
+ const opacity = computed(() => props.annotation.object.opacity ?? 1);
448
+ const textColor = computed(
449
+ () => props.annotation.object.fontColor ?? props.annotation.object.overlayColor ?? "#FFFFFF"
450
+ );
451
+ const overlayText = computed(() => props.annotation.object.overlayText);
452
+ const overlayTextRepeat = computed(() => props.annotation.object.overlayTextRepeat ?? false);
453
+ const fontSize = computed(() => props.annotation.object.fontSize ?? 12);
454
+ const fontFamily = computed(() => props.annotation.object.fontFamily ?? PdfStandardFont.Helvetica);
455
+ const textAlign = computed(() => props.annotation.object.textAlign ?? PdfTextAlignment.Center);
456
+ const renderedOverlayText = computed(() => {
457
+ if (!overlayText.value) return "";
458
+ if (!overlayTextRepeat.value) return overlayText.value;
459
+ const reps = 10;
460
+ return Array(reps).fill(overlayText.value).join(" ");
461
+ });
462
+ const getSegmentStyle = (b) => ({
463
+ position: "absolute",
464
+ left: `${(rect.value ? b.origin.x - rect.value.origin.x : b.origin.x) * props.scale}px`,
465
+ top: `${(rect.value ? b.origin.y - rect.value.origin.y : b.origin.y) * props.scale}px`,
466
+ width: `${b.size.width * props.scale}px`,
467
+ height: `${b.size.height * props.scale}px`,
468
+ // Default: transparent background with strokeColor (C) border
469
+ // Hovered: color (IC) background fill, no border
470
+ background: isHovered.value ? color.value : "transparent",
471
+ border: !isHovered.value ? `2px solid ${strokeColor.value}` : "none",
472
+ opacity: isHovered.value ? opacity.value : 1,
473
+ boxSizing: "border-box",
474
+ pointerEvents: "auto",
475
+ cursor: "pointer",
476
+ display: "flex",
477
+ alignItems: "center",
478
+ justifyContent: textAlign.value === PdfTextAlignment.Left ? "flex-start" : textAlign.value === PdfTextAlignment.Right ? "flex-end" : "center",
479
+ overflow: "hidden"
480
+ });
481
+ const getTextStyle = (b) => ({
482
+ color: textColor.value,
483
+ fontSize: `${Math.min(fontSize.value * props.scale, b.size.height * props.scale * 0.8)}px`,
484
+ fontFamily: standardFontCss(fontFamily.value),
485
+ textAlign: textAlignmentToCss(textAlign.value),
486
+ whiteSpace: overlayTextRepeat.value ? "normal" : "nowrap",
487
+ overflow: "hidden",
488
+ textOverflow: "ellipsis",
489
+ lineHeight: 1
490
+ });
491
+ return (_ctx, _cache) => {
492
+ return openBlock(), createElementBlock("div", {
493
+ onMouseenter: _cache[2] || (_cache[2] = ($event) => isHovered.value = true),
494
+ onMouseleave: _cache[3] || (_cache[3] = ($event) => isHovered.value = false),
495
+ style: { position: "absolute", inset: 0 }
496
+ }, [
497
+ (openBlock(true), createElementBlock(Fragment, null, renderList(segmentRects.value, (b, i) => {
498
+ return openBlock(), createElementBlock("div", {
499
+ key: i,
500
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
501
+ (...args) => __props.onClick && __props.onClick(...args)),
502
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
503
+ (...args) => __props.onClick && __props.onClick(...args)),
504
+ style: normalizeStyle(getSegmentStyle(b))
505
+ }, [
506
+ isHovered.value && overlayText.value ? (openBlock(), createElementBlock("span", {
507
+ key: 0,
508
+ style: normalizeStyle(getTextStyle(b))
509
+ }, toDisplayString(renderedOverlayText.value), 5)) : createCommentVNode("", true)
510
+ ], 36);
511
+ }), 128))
512
+ ], 32);
513
+ };
514
+ }
515
+ });
516
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
517
+ __name: "redact-area",
518
+ props: {
519
+ annotation: {},
520
+ isSelected: { type: Boolean },
521
+ scale: {},
522
+ pageIndex: {},
523
+ onClick: { type: Function }
524
+ },
525
+ setup(__props) {
526
+ const props = __props;
527
+ const isHovered = ref(false);
528
+ const strokeColor = computed(() => props.annotation.object.strokeColor ?? "#FF0000");
529
+ const color = computed(() => props.annotation.object.color ?? "#000000");
530
+ const opacity = computed(() => props.annotation.object.opacity ?? 1);
531
+ const textColor = computed(
532
+ () => props.annotation.object.fontColor ?? props.annotation.object.overlayColor ?? "#FFFFFF"
533
+ );
534
+ const overlayText = computed(() => props.annotation.object.overlayText);
535
+ const overlayTextRepeat = computed(() => props.annotation.object.overlayTextRepeat ?? false);
536
+ const fontSize = computed(() => props.annotation.object.fontSize ?? 12);
537
+ const fontFamily = computed(() => props.annotation.object.fontFamily ?? PdfStandardFont.Helvetica);
538
+ const textAlign = computed(() => props.annotation.object.textAlign ?? PdfTextAlignment.Center);
539
+ const renderedOverlayText = computed(() => {
540
+ if (!overlayText.value) return "";
541
+ if (!overlayTextRepeat.value) return overlayText.value;
542
+ const reps = 10;
543
+ return Array(reps).fill(overlayText.value).join(" ");
544
+ });
545
+ const containerStyle = computed(() => ({
546
+ position: "absolute",
547
+ inset: 0,
548
+ // Default: transparent background with strokeColor (C) border
549
+ // Hovered: color (IC) background fill, no border
550
+ background: isHovered.value ? color.value : "transparent",
551
+ border: !isHovered.value ? `2px solid ${strokeColor.value}` : "none",
552
+ opacity: isHovered.value ? opacity.value : 1,
553
+ boxSizing: "border-box",
554
+ pointerEvents: "auto",
555
+ cursor: props.isSelected ? "move" : "pointer",
556
+ display: "flex",
557
+ alignItems: "center",
558
+ justifyContent: textAlign.value === PdfTextAlignment.Left ? "flex-start" : textAlign.value === PdfTextAlignment.Right ? "flex-end" : "center",
559
+ overflow: "hidden"
560
+ }));
561
+ const textStyle = computed(() => ({
562
+ color: textColor.value,
563
+ fontSize: `${fontSize.value * props.scale}px`,
564
+ fontFamily: standardFontCss(fontFamily.value),
565
+ textAlign: textAlignmentToCss(textAlign.value),
566
+ whiteSpace: overlayTextRepeat.value ? "normal" : "nowrap",
567
+ overflow: "hidden",
568
+ textOverflow: "ellipsis",
569
+ padding: "4px"
570
+ }));
571
+ return (_ctx, _cache) => {
572
+ return openBlock(), createElementBlock("div", {
573
+ onPointerdown: _cache[0] || (_cache[0] = (e) => {
574
+ if (!__props.isSelected) __props.onClick(e);
575
+ }),
576
+ onTouchstart: _cache[1] || (_cache[1] = (e) => {
577
+ if (!__props.isSelected) __props.onClick(e);
578
+ }),
579
+ onMouseenter: _cache[2] || (_cache[2] = ($event) => isHovered.value = true),
580
+ onMouseleave: _cache[3] || (_cache[3] = ($event) => isHovered.value = false),
581
+ style: normalizeStyle(containerStyle.value)
582
+ }, [
583
+ isHovered.value && overlayText.value ? (openBlock(), createElementBlock("span", {
584
+ key: 0,
585
+ style: normalizeStyle(textStyle.value)
586
+ }, toDisplayString(renderedOverlayText.value), 5)) : createCommentVNode("", true)
587
+ ], 36);
588
+ };
589
+ }
590
+ });
591
+ const redactRenderers = [
592
+ createRenderer({
593
+ id: "redactHighlight",
594
+ matches: (a) => {
595
+ var _a;
596
+ return a.type === PdfAnnotationSubtype.REDACT && "segmentRects" in a && (((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0) > 0;
597
+ },
598
+ component: _sfc_main$2
599
+ }),
600
+ createRenderer({
601
+ id: "redactArea",
602
+ matches: (a) => {
603
+ var _a;
604
+ return a.type === PdfAnnotationSubtype.REDACT && (!("segmentRects" in a) || !(((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0));
605
+ },
606
+ component: _sfc_main$1
607
+ })
608
+ ];
609
+ const _sfc_main = /* @__PURE__ */ defineComponent({
610
+ __name: "redact-renderer-registration",
611
+ setup(__props) {
612
+ useRegisterRenderers(redactRenderers);
613
+ return (_ctx, _cache) => {
614
+ return renderSlot(_ctx.$slots, "default");
615
+ };
616
+ }
617
+ });
618
+ const RedactionPluginPackage = createPluginPackage(RedactionPluginPackage$1).addUtility(_sfc_main).build();
419
619
  export {
420
- _sfc_main$4 as Highlight,
421
- _sfc_main$3 as MarqueeRedact,
422
- _sfc_main$1 as PendingRedactions,
423
- _sfc_main as RedactionLayer,
424
- _sfc_main$2 as SelectionRedact,
620
+ _sfc_main$7 as Highlight,
621
+ _sfc_main$6 as MarqueeRedact,
622
+ _sfc_main$4 as PendingRedactions,
623
+ _sfc_main$1 as RedactArea,
624
+ _sfc_main$2 as RedactHighlight,
625
+ _sfc_main as RedactRendererRegistration,
626
+ _sfc_main$3 as RedactionLayer,
627
+ RedactionPluginPackage,
628
+ _sfc_main$5 as SelectionRedact,
629
+ redactRenderers,
425
630
  useRedaction,
426
631
  useRedactionCapability,
427
632
  useRedactionPlugin
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-redaction.ts","../../src/vue/components/highlight.vue","../../src/vue/components/marquee-redact.vue","../../src/vue/components/selection-redact.vue","../../src/vue/components/pending-redactions.vue","../../src/vue/components/redaction-layer.vue"],"sourcesContent":["import { ref, watch, computed, toValue, type MaybeRefOrGetter, ComputedRef, Ref } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport {\n RedactionPlugin,\n initialDocumentState,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\n/**\n * Hook for redaction state for a specific document\n * @param documentId Document ID (can be ref, computed, getter, or plain value)\n */\nexport const useRedaction = (\n documentId: MaybeRefOrGetter<string>,\n): {\n state: Readonly<Ref<RedactionDocumentState>>;\n provides: ComputedRef<RedactionScope | null>;\n} => {\n const { provides } = useRedactionCapability();\n const state = ref<RedactionDocumentState>(initialDocumentState);\n\n watch(\n [provides, () => toValue(documentId)],\n ([providesValue, docId], _, onCleanup) => {\n if (!providesValue) {\n state.value = initialDocumentState;\n return;\n }\n\n const scope = providesValue.forDocument(docId);\n\n // Set initial state\n try {\n state.value = scope.getState();\n } catch (e) {\n // Handle case where state might not be ready\n state.value = initialDocumentState;\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n state.value = newState;\n });\n\n onCleanup(unsubscribe);\n },\n { immediate: true },\n );\n\n const scopedProvides = computed(() => {\n const docId = toValue(documentId);\n return provides.value?.forDocument(docId) ?? null;\n });\n\n return {\n state,\n provides: scopedProvides,\n };\n};\n","<template>\n <div\n v-for=\"(rect, i) in rects\"\n :key=\"i\"\n @pointerdown=\"onClick\"\n @touchstart=\"onClick\"\n :style=\"{\n position: 'absolute',\n border,\n left: `${(boundingRect ? rect.origin.x - boundingRect.origin.x : rect.origin.x) * scale}px`,\n top: `${(boundingRect ? rect.origin.y - boundingRect.origin.y : rect.origin.y) * scale}px`,\n width: `${rect.size.width * scale}px`,\n height: `${rect.size.height * scale}px`,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n }\"\n v-bind=\"$attrs\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport type { Rect } from '@embedpdf/models';\n\ninterface HighlightProps {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: PointerEvent | TouchEvent) => void;\n}\n\nconst props = withDefaults(defineProps<HighlightProps>(), {\n color: '#FFFF00',\n opacity: 1,\n border: '1px solid red',\n});\n\n// Rename rect to boundingRect for clarity in template\nconst boundingRect = props.rect;\n</script>\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * actualScale}px`,\n top: `${rect.origin.y * actualScale}px`,\n width: `${rect.size.width * actualScale}px`,\n height: `${rect.size.height * actualScale}px`,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, computed } from 'vue';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeRedactProps>(), {\n stroke: 'red',\n fill: 'transparent',\n});\n\nconst { plugin: redactionPlugin } = useRedactionPlugin();\nconst documentState = useDocumentState(() => props.documentId);\nconst rect = ref<Rect | null>(null);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nwatch(\n [redactionPlugin, () => props.documentId, () => props.pageIndex, actualScale],\n ([plugin, docId, pageIdx, scale], _, onCleanup) => {\n if (!plugin || !docId) return;\n\n const unregister = plugin.registerMarqueeOnPage({\n documentId: docId,\n pageIndex: pageIdx,\n scale,\n callback: {\n onPreview: (newRect) => {\n rect.value = newRect;\n },\n },\n });\n\n onCleanup(unregister);\n },\n { immediate: true },\n);\n</script>\n","<template>\n <div\n v-if=\"boundingRect\"\n :style=\"{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }\"\n >\n <Highlight\n :color=\"'transparent'\"\n :opacity=\"1\"\n :rects=\"rects\"\n :scale=\"scale\"\n border=\"1px solid red\"\n />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useRedactionPlugin } from '../hooks/use-redaction';\nimport Highlight from './highlight.vue';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nconst props = defineProps<SelectionRedactProps>();\n\nconst { plugin: redactionPlugin } = useRedactionPlugin();\nconst rects = ref<Rect[]>([]);\nconst boundingRect = ref<Rect | null>(null);\n\nwatch(\n [redactionPlugin, () => props.documentId, () => props.pageIndex],\n ([plugin, docId, pageIdx], _, onCleanup) => {\n if (!plugin) {\n rects.value = [];\n boundingRect.value = null;\n return;\n }\n\n const unsubscribe = plugin.onRedactionSelectionChange(docId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIdx);\n rects.value = selection?.segmentRects ?? [];\n boundingRect.value = selection?.rect ?? null;\n });\n\n onCleanup(unsubscribe);\n },\n { immediate: true },\n);\n</script>\n","<template>\n <div v-if=\"items.length\" :style=\"{ position: 'absolute', inset: 0, pointerEvents: 'none' }\">\n <template v-for=\"item in items\" :key=\"item.id\">\n <!-- Area redaction -->\n <template v-if=\"item.kind === 'area'\">\n <div\n :style=\"{\n position: 'absolute',\n left: `${item.rect.origin.x * scale}px`,\n top: `${item.rect.origin.y * scale}px`,\n width: `${item.rect.size.width * scale}px`,\n height: `${item.rect.size.height * scale}px`,\n background: 'transparent',\n outline: selectedId === item.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid red`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }\"\n @pointerdown=\"(e: PointerEvent) => select(e, item.id)\"\n @touchstart=\"(e: TouchEvent) => select(e, item.id)\"\n />\n\n <!-- Selection Menu: Supports BOTH render function and slot -->\n <CounterRotate\n v-if=\"shouldShowMenu(item.id)\"\n :rect=\"{\n origin: { x: item.rect.origin.x * scale, y: item.rect.origin.y * scale },\n size: { width: item.rect.size.width * scale, height: item.rect.size.height * scale },\n }\"\n :rotation=\"rotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <!-- Priority 1: Render function prop (schema-driven) -->\n <component\n v-if=\"selectionMenu\"\n :is=\"renderSelectionMenu(item, rect, menuWrapperProps)\"\n />\n\n <!-- Priority 2: Slot (manual customization) -->\n <slot\n v-else\n name=\"selection-menu\"\n :context=\"buildContext(item)\"\n :selected=\"selectedId === item.id\"\n :rect=\"rect\"\n :placement=\"menuPlacement\"\n :menuWrapperProps=\"menuWrapperProps\"\n />\n </template>\n </CounterRotate>\n </template>\n\n <!-- Text redaction -->\n <template v-else>\n <div\n :style=\"{\n position: 'absolute',\n left: `${item.rect.origin.x * scale}px`,\n top: `${item.rect.origin.y * scale}px`,\n width: `${item.rect.size.width * scale}px`,\n height: `${item.rect.size.height * scale}px`,\n background: 'transparent',\n outline: selectedId === item.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === item.id ? 'pointer' : 'default',\n }\"\n >\n <Highlight\n :rect=\"item.rect\"\n :rects=\"item.rects\"\n color=\"transparent\"\n border=\"1px solid red\"\n :scale=\"scale\"\n :on-click=\"(e: PointerEvent | TouchEvent) => select(e, item.id)\"\n />\n </div>\n\n <!-- Selection Menu: Supports BOTH render function and slot -->\n <CounterRotate\n v-if=\"shouldShowMenu(item.id)\"\n :rect=\"{\n origin: {\n x: item.rect.origin.x * scale,\n y: item.rect.origin.y * scale,\n },\n size: {\n width: item.rect.size.width * scale,\n height: item.rect.size.height * scale,\n },\n }\"\n :rotation=\"rotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <!-- Priority 1: Render function prop (schema-driven) -->\n <component\n v-if=\"selectionMenu\"\n :is=\"renderSelectionMenu(item, rect, menuWrapperProps)\"\n />\n\n <!-- Priority 2: Slot (manual customization) -->\n <slot\n v-else\n name=\"selection-menu\"\n :context=\"buildContext(item)\"\n :selected=\"selectedId === item.id\"\n :rect=\"rect\"\n :placement=\"menuPlacement\"\n :menuWrapperProps=\"menuWrapperProps\"\n />\n </template>\n </CounterRotate>\n </template>\n </template>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, useSlots, type VNode } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { Rotation } from '@embedpdf/models';\nimport { CounterRotate } from '@embedpdf/utils/vue';\nimport type { MenuWrapperProps, SelectionMenuPlacement } from '@embedpdf/utils/vue';\nimport type { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { useRedactionCapability } from '../hooks/use-redaction';\nimport Highlight from './highlight.vue';\nimport type { RedactionSelectionContext, RedactionSelectionMenuRenderFn } from './types';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<PendingRedactionsProps>(), {\n rotation: Rotation.Degree0,\n bboxStroke: 'rgba(0,0,0,0.8)',\n});\n\nconst slots = useSlots();\nconst { provides: redaction } = useRedactionCapability();\nconst items = ref<RedactionItem[]>([]);\nconst selectedId = ref<string | null>(null);\n\nwatch(\n [redaction, () => props.documentId, () => props.pageIndex],\n ([redactionValue, docId, pageIdx], _, onCleanup) => {\n if (!redactionValue) {\n items.value = [];\n selectedId.value = null;\n return;\n }\n\n const scoped = redactionValue.forDocument(docId);\n\n // Initialize with current state\n const currentState = scoped.getState();\n items.value = currentState.pending[pageIdx] ?? [];\n selectedId.value =\n currentState.selected && currentState.selected.page === pageIdx\n ? currentState.selected.id\n : null;\n\n // Subscribe to future changes\n const off1 = scoped.onPendingChange((map) => {\n items.value = map[pageIdx] ?? [];\n });\n\n const off2 = scoped.onSelectedChange((sel) => {\n selectedId.value = sel && sel.page === pageIdx ? sel.id : null;\n });\n\n onCleanup(() => {\n off1?.();\n off2?.();\n });\n },\n { immediate: true },\n);\n\nconst select = (e: PointerEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n const redactionValue = redaction.value;\n if (!redactionValue) return;\n redactionValue.forDocument(props.documentId).selectPending(props.pageIndex, id);\n};\n\n// --- Selection Menu Logic ---\n\n// Check if we should show menu for this item\nconst shouldShowMenu = (itemId: string): boolean => {\n const isSelected = selectedId.value === itemId;\n return isSelected && (!!props.selectionMenu || !!slots['selection-menu']);\n};\n\n// Build context object for selection menu\nconst buildContext = (item: RedactionItem): RedactionSelectionContext => ({\n type: 'redaction',\n item,\n pageIndex: props.pageIndex,\n});\n\n// Placement hints (could be computed based on position)\nconst menuPlacement: SelectionMenuPlacement = {\n suggestTop: false,\n spaceAbove: 0,\n spaceBelow: 0,\n};\n\n// Render via function (for schema-driven approach)\nconst renderSelectionMenu = (\n item: RedactionItem,\n rect: Rect,\n menuWrapperProps: MenuWrapperProps,\n): VNode | null => {\n if (!props.selectionMenu) return null;\n\n return props.selectionMenu({\n rect,\n menuWrapperProps,\n selected: selectedId.value === item.id,\n placement: menuPlacement,\n context: buildContext(item),\n });\n};\n</script>\n","<template>\n <PendingRedactions\n :document-id=\"documentId\"\n :page-index=\"pageIndex\"\n :scale=\"actualScale\"\n :rotation=\"actualRotation\"\n :bbox-stroke=\"bboxStroke\"\n :selection-menu=\"selectionMenu\"\n >\n <template #selection-menu=\"slotProps\">\n <slot name=\"selection-menu\" v-bind=\"slotProps\" />\n </template>\n </PendingRedactions>\n <MarqueeRedact :document-id=\"documentId\" :page-index=\"pageIndex\" :scale=\"actualScale\" />\n <SelectionRedact :document-id=\"documentId\" :page-index=\"pageIndex\" :scale=\"actualScale\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { Rotation } from '@embedpdf/models';\nimport PendingRedactions from './pending-redactions.vue';\nimport MarqueeRedact from './marquee-redact.vue';\nimport SelectionRedact from './selection-redact.vue';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional bbox stroke color */\n bboxStroke?: string;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<RedactionLayerProps>(), {\n bboxStroke: 'rgba(0,0,0,0.8)',\n});\n\nconst documentState = useDocumentState(() => props.documentId);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nconst actualRotation = computed(() => {\n if (props.rotation !== undefined) return props.rotation;\n return documentState.value?.rotation ?? Rotation.Degree0;\n});\n</script>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_unref","$attrs","_normalizeStyle","_hoisted_1","_createVNode","Highlight","_createElementVNode","_createBlock","_withCtx","_resolveDynamicComponent","_renderSlot","PendingRedactions","MarqueeRedact","SelectionRedact"],"mappings":";;;;;;AASO,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;AAC9E,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;AAMtF,MAAM,eAAe,CAC1B,eAIG;AACH,QAAM,EAAE,SAAA,IAAa,uBAAA;AACrB,QAAM,QAAQ,IAA4B,oBAAoB;AAE9D;AAAA,IACE,C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AcH,QACvB,CAAiD,cADf;AAAA,YAClCE,WAAiD,iEAAb,SAAS,CAAA,CAAA;AAAA,UAAA;;;QAGjDN,YAAwFQ,aAAA;AAAA,UAAxE,eAAa,QAAA;AAAA,UAAa,cAAY,QAAA;AAAA,UAAY,OAAO,YAAA;AAAA,QAAA;QACzER,YAA0FS,aAAA;AAAA,UAAxE,eAAa,QAAA;AAAA,UAAa,cAAY,QAAA;AAAA,UAAY,OAAO,YAAA;AAAA,QAAA;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/vue/components/highlight.vue","../../src/vue/hooks/use-redaction.ts","../../src/vue/components/marquee-redact.vue","../../src/vue/components/selection-redact.vue","../../src/vue/components/pending-redactions.vue","../../src/vue/components/redaction-layer.vue","../../src/vue/components/annotations/redact-highlight.vue","../../src/vue/components/annotations/redact-area.vue","../../src/vue/components/redact-renderers.ts","../../src/vue/components/redact-renderer-registration.vue","../../src/vue/index.ts"],"sourcesContent":["<template>\n <div\n v-for=\"(rect, i) in rects\"\n :key=\"i\"\n @pointerdown=\"onClick\"\n @touchstart=\"onClick\"\n :style=\"{\n position: 'absolute',\n border,\n left: `${(boundingRect ? rect.origin.x - boundingRect.origin.x : rect.origin.x) * scale}px`,\n top: `${(boundingRect ? rect.origin.y - boundingRect.origin.y : rect.origin.y) * scale}px`,\n width: `${rect.size.width * scale}px`,\n height: `${rect.size.height * scale}px`,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n }\"\n v-bind=\"$attrs\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport type { Rect } from '@embedpdf/models';\n\ninterface HighlightProps {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: PointerEvent | TouchEvent) => void;\n}\n\nconst props = withDefaults(defineProps<HighlightProps>(), {\n color: '#FFFF00',\n opacity: 1,\n border: '1px solid red',\n});\n\n// Rename rect to boundingRect for clarity in template\nconst boundingRect = props.rect;\n</script>\n","import { ref, watch, computed, toValue, type MaybeRefOrGetter, ComputedRef, Ref } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport {\n RedactionPlugin,\n initialDocumentState,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\n/**\n * Hook for redaction state for a specific document\n * @param documentId Document ID (can be ref, computed, getter, or plain value)\n */\nexport const useRedaction = (\n documentId: MaybeRefOrGetter<string>,\n): {\n state: Readonly<Ref<RedactionDocumentState>>;\n provides: ComputedRef<RedactionScope | null>;\n} => {\n const { provides } = useRedactionCapability();\n const state = ref<RedactionDocumentState>(initialDocumentState);\n\n watch(\n [provides, () => toValue(documentId)],\n ([providesValue, docId], _, onCleanup) => {\n if (!providesValue) {\n state.value = initialDocumentState;\n return;\n }\n\n const scope = providesValue.forDocument(docId);\n\n // Set initial state\n try {\n state.value = scope.getState();\n } catch (e) {\n // Handle case where state might not be ready\n state.value = initialDocumentState;\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n state.value = newState;\n });\n\n onCleanup(unsubscribe);\n },\n { immediate: true },\n );\n\n const scopedProvides = computed(() => {\n const docId = toValue(documentId);\n return provides.value?.forDocument(docId) ?? null;\n });\n\n return {\n state,\n provides: scopedProvides,\n };\n};\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * actualScale}px`,\n top: `${rect.origin.y * actualScale}px`,\n width: `${rect.size.width * actualScale}px`,\n height: `${rect.size.height * actualScale}px`,\n border: `1px solid ${strokeColor}`,\n background: fill,\n boxSizing: 'border-box',\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, computed } from 'vue';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeRedactProps>(), {\n stroke: 'red',\n fill: 'transparent',\n});\n\nconst { plugin: redactionPlugin } = useRedactionPlugin();\nconst documentState = useDocumentState(() => props.documentId);\nconst rect = ref<Rect | null>(null);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\n// Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n// Allow prop override for backwards compatibility\nconst strokeColor = computed(\n () => props.stroke ?? redactionPlugin.value?.getPreviewStrokeColor() ?? 'red',\n);\n\nwatch(\n [redactionPlugin, () => props.documentId, () => props.pageIndex, actualScale],\n ([plugin, docId, pageIdx, scale], _, onCleanup) => {\n if (!plugin || !docId) return;\n\n const unregister = plugin.registerMarqueeOnPage({\n documentId: docId,\n pageIndex: pageIdx,\n scale,\n callback: {\n onPreview: (newRect) => {\n rect.value = newRect;\n },\n },\n });\n\n onCleanup(unregister);\n },\n { immediate: true },\n);\n</script>\n","<template>\n <div\n v-if=\"boundingRect\"\n :style=\"{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }\"\n >\n <Highlight\n :color=\"'transparent'\"\n :opacity=\"1\"\n :rects=\"rects\"\n :scale=\"scale\"\n :border=\"`1px solid ${strokeColor}`\"\n />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, computed } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useRedactionPlugin } from '../hooks/use-redaction';\nimport Highlight from './highlight.vue';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nconst props = defineProps<SelectionRedactProps>();\n\nconst { plugin: redactionPlugin } = useRedactionPlugin();\nconst rects = ref<Rect[]>([]);\nconst boundingRect = ref<Rect | null>(null);\n\n// Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\nconst strokeColor = computed(() => redactionPlugin.value?.getPreviewStrokeColor() ?? 'red');\n\nwatch(\n [redactionPlugin, () => props.documentId, () => props.pageIndex],\n ([plugin, docId, pageIdx], _, onCleanup) => {\n if (!plugin) {\n rects.value = [];\n boundingRect.value = null;\n return;\n }\n\n const unsubscribe = plugin.onRedactionSelectionChange(docId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIdx);\n rects.value = selection?.segmentRects ?? [];\n boundingRect.value = selection?.rect ?? null;\n });\n\n onCleanup(unsubscribe);\n },\n { immediate: true },\n);\n</script>\n","<template>\n <div v-if=\"items.length\" :style=\"{ position: 'absolute', inset: 0, pointerEvents: 'none' }\">\n <template v-for=\"item in items\" :key=\"item.id\">\n <!-- Area redaction -->\n <template v-if=\"item.kind === 'area'\">\n <div\n :style=\"{\n position: 'absolute',\n left: `${item.rect.origin.x * scale}px`,\n top: `${item.rect.origin.y * scale}px`,\n width: `${item.rect.size.width * scale}px`,\n height: `${item.rect.size.height * scale}px`,\n background: 'transparent',\n outline: selectedId === item.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid red`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }\"\n @pointerdown=\"(e: PointerEvent) => select(e, item.id)\"\n @touchstart=\"(e: TouchEvent) => select(e, item.id)\"\n />\n\n <!-- Selection Menu: Supports BOTH render function and slot -->\n <CounterRotate\n v-if=\"shouldShowMenu(item.id)\"\n :rect=\"{\n origin: { x: item.rect.origin.x * scale, y: item.rect.origin.y * scale },\n size: { width: item.rect.size.width * scale, height: item.rect.size.height * scale },\n }\"\n :rotation=\"rotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <!-- Priority 1: Render function prop (schema-driven) -->\n <component\n v-if=\"selectionMenu\"\n :is=\"renderSelectionMenu(item, rect, menuWrapperProps)\"\n />\n\n <!-- Priority 2: Slot (manual customization) -->\n <slot\n v-else\n name=\"selection-menu\"\n :context=\"buildContext(item)\"\n :selected=\"selectedId === item.id\"\n :rect=\"rect\"\n :placement=\"menuPlacement\"\n :menuWrapperProps=\"menuWrapperProps\"\n />\n </template>\n </CounterRotate>\n </template>\n\n <!-- Text redaction -->\n <template v-else>\n <div\n :style=\"{\n position: 'absolute',\n left: `${item.rect.origin.x * scale}px`,\n top: `${item.rect.origin.y * scale}px`,\n width: `${item.rect.size.width * scale}px`,\n height: `${item.rect.size.height * scale}px`,\n background: 'transparent',\n outline: selectedId === item.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === item.id ? 'pointer' : 'default',\n }\"\n >\n <Highlight\n :rect=\"item.rect\"\n :rects=\"item.rects\"\n color=\"transparent\"\n border=\"1px solid red\"\n :scale=\"scale\"\n :on-click=\"(e: PointerEvent | TouchEvent) => select(e, item.id)\"\n />\n </div>\n\n <!-- Selection Menu: Supports BOTH render function and slot -->\n <CounterRotate\n v-if=\"shouldShowMenu(item.id)\"\n :rect=\"{\n origin: {\n x: item.rect.origin.x * scale,\n y: item.rect.origin.y * scale,\n },\n size: {\n width: item.rect.size.width * scale,\n height: item.rect.size.height * scale,\n },\n }\"\n :rotation=\"rotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <!-- Priority 1: Render function prop (schema-driven) -->\n <component\n v-if=\"selectionMenu\"\n :is=\"renderSelectionMenu(item, rect, menuWrapperProps)\"\n />\n\n <!-- Priority 2: Slot (manual customization) -->\n <slot\n v-else\n name=\"selection-menu\"\n :context=\"buildContext(item)\"\n :selected=\"selectedId === item.id\"\n :rect=\"rect\"\n :placement=\"menuPlacement\"\n :menuWrapperProps=\"menuWrapperProps\"\n />\n </template>\n </CounterRotate>\n </template>\n </template>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, useSlots, type VNode } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { Rotation } from '@embedpdf/models';\nimport { CounterRotate } from '@embedpdf/utils/vue';\nimport type { MenuWrapperProps, SelectionMenuPlacement } from '@embedpdf/utils/vue';\nimport type { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { useRedactionCapability } from '../hooks/use-redaction';\nimport Highlight from './highlight.vue';\nimport type { RedactionSelectionContext, RedactionSelectionMenuRenderFn } from './types';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<PendingRedactionsProps>(), {\n rotation: Rotation.Degree0,\n bboxStroke: 'rgba(0,0,0,0.8)',\n});\n\nconst slots = useSlots();\nconst { provides: redaction } = useRedactionCapability();\nconst items = ref<RedactionItem[]>([]);\nconst selectedId = ref<string | null>(null);\n\nwatch(\n [redaction, () => props.documentId, () => props.pageIndex],\n ([redactionValue, docId, pageIdx], _, onCleanup) => {\n if (!redactionValue) {\n items.value = [];\n selectedId.value = null;\n return;\n }\n\n const scoped = redactionValue.forDocument(docId);\n\n // Initialize with current state - only show legacy mode items\n const currentState = scoped.getState();\n items.value = (currentState.pending[pageIdx] ?? []).filter((it) => it.source === 'legacy');\n selectedId.value =\n currentState.selected && currentState.selected.page === pageIdx\n ? currentState.selected.id\n : null;\n\n // Subscribe to future changes - only show legacy mode items\n const off1 = scoped.onPendingChange((map) => {\n items.value = (map[pageIdx] ?? []).filter((it) => it.source === 'legacy');\n });\n\n const off2 = scoped.onSelectedChange((sel) => {\n selectedId.value = sel && sel.page === pageIdx ? sel.id : null;\n });\n\n onCleanup(() => {\n off1?.();\n off2?.();\n });\n },\n { immediate: true },\n);\n\nconst select = (e: PointerEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n const redactionValue = redaction.value;\n if (!redactionValue) return;\n redactionValue.forDocument(props.documentId).selectPending(props.pageIndex, id);\n};\n\n// --- Selection Menu Logic ---\n\n// Check if we should show menu for this item\nconst shouldShowMenu = (itemId: string): boolean => {\n const isSelected = selectedId.value === itemId;\n return isSelected && (!!props.selectionMenu || !!slots['selection-menu']);\n};\n\n// Build context object for selection menu\nconst buildContext = (item: RedactionItem): RedactionSelectionContext => ({\n type: 'redaction',\n item,\n pageIndex: props.pageIndex,\n});\n\n// Placement hints (could be computed based on position)\nconst menuPlacement: SelectionMenuPlacement = {\n suggestTop: false,\n spaceAbove: 0,\n spaceBelow: 0,\n};\n\n// Render via function (for schema-driven approach)\nconst renderSelectionMenu = (\n item: RedactionItem,\n rect: Rect,\n menuWrapperProps: MenuWrapperProps,\n): VNode | null => {\n if (!props.selectionMenu) return null;\n\n return props.selectionMenu({\n rect,\n menuWrapperProps,\n selected: selectedId.value === item.id,\n placement: menuPlacement,\n context: buildContext(item),\n });\n};\n</script>\n","<template>\n <PendingRedactions\n :document-id=\"documentId\"\n :page-index=\"pageIndex\"\n :scale=\"actualScale\"\n :rotation=\"actualRotation\"\n :bbox-stroke=\"bboxStroke\"\n :selection-menu=\"selectionMenu\"\n >\n <template #selection-menu=\"slotProps\">\n <slot name=\"selection-menu\" v-bind=\"slotProps\" />\n </template>\n </PendingRedactions>\n <MarqueeRedact :document-id=\"documentId\" :page-index=\"pageIndex\" :scale=\"actualScale\" />\n <SelectionRedact :document-id=\"documentId\" :page-index=\"pageIndex\" :scale=\"actualScale\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { Rotation } from '@embedpdf/models';\nimport PendingRedactions from './pending-redactions.vue';\nimport MarqueeRedact from './marquee-redact.vue';\nimport SelectionRedact from './selection-redact.vue';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional bbox stroke color */\n bboxStroke?: string;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<RedactionLayerProps>(), {\n bboxStroke: 'rgba(0,0,0,0.8)',\n});\n\nconst documentState = useDocumentState(() => props.documentId);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nconst actualRotation = computed(() => {\n if (props.rotation !== undefined) return props.rotation;\n return documentState.value?.rotation ?? Rotation.Degree0;\n});\n</script>\n","<template>\n <div\n @mouseenter=\"isHovered = true\"\n @mouseleave=\"isHovered = false\"\n :style=\"{ position: 'absolute', inset: 0 }\"\n >\n <div\n v-for=\"(b, i) in segmentRects\"\n :key=\"i\"\n @pointerdown=\"onClick\"\n @touchstart=\"onClick\"\n :style=\"getSegmentStyle(b)\"\n >\n <span v-if=\"isHovered && overlayText\" :style=\"getTextStyle(b)\">\n {{ renderedOverlayText }}\n </span>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, type CSSProperties } from 'vue';\nimport type { AnnotationRendererProps } from '@embedpdf/plugin-annotation/vue';\nimport type { PdfRedactAnnoObject, Rect } from '@embedpdf/models';\nimport {\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCss,\n textAlignmentToCss,\n} from '@embedpdf/models';\n\nconst props = defineProps<AnnotationRendererProps<PdfRedactAnnoObject>>();\nconst isHovered = ref(false);\n\n// Access props.annotation.object directly in computed to maintain reactivity\nconst segmentRects = computed(() => props.annotation.object.segmentRects ?? []);\nconst rect = computed(() => props.annotation.object.rect);\n\n// C - Border/stroke color\nconst strokeColor = computed(() => props.annotation.object.strokeColor ?? '#FF0000');\n// IC - Interior color (background fill when redaction is applied)\nconst color = computed(() => props.annotation.object.color ?? '#000000');\n// CA - Opacity (0-1)\nconst opacity = computed(() => props.annotation.object.opacity ?? 1);\n// OC - Overlay text color (Adobe extension), fallback to fontColor\nconst textColor = computed(\n () => props.annotation.object.fontColor ?? props.annotation.object.overlayColor ?? '#FFFFFF',\n);\n// Overlay text properties\nconst overlayText = computed(() => props.annotation.object.overlayText);\nconst overlayTextRepeat = computed(() => props.annotation.object.overlayTextRepeat ?? false);\nconst fontSize = computed(() => props.annotation.object.fontSize ?? 12);\nconst fontFamily = computed(() => props.annotation.object.fontFamily ?? PdfStandardFont.Helvetica);\nconst textAlign = computed(() => props.annotation.object.textAlign ?? PdfTextAlignment.Center);\n\n// Calculate how many times to repeat text (approximate)\nconst renderedOverlayText = computed(() => {\n if (!overlayText.value) return '';\n if (!overlayTextRepeat.value) return overlayText.value;\n // Repeat text multiple times to fill the space\n const reps = 10;\n return Array(reps).fill(overlayText.value).join(' ');\n});\n\nconst getSegmentStyle = (b: Rect): CSSProperties => ({\n position: 'absolute',\n left: `${(rect.value ? b.origin.x - rect.value.origin.x : b.origin.x) * props.scale}px`,\n top: `${(rect.value ? b.origin.y - rect.value.origin.y : b.origin.y) * props.scale}px`,\n width: `${b.size.width * props.scale}px`,\n height: `${b.size.height * props.scale}px`,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n background: isHovered.value ? color.value : 'transparent',\n border: !isHovered.value ? `2px solid ${strokeColor.value}` : 'none',\n opacity: isHovered.value ? opacity.value : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign.value === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign.value === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n});\n\nconst getTextStyle = (b: Rect): CSSProperties => ({\n color: textColor.value,\n fontSize: `${Math.min(fontSize.value * props.scale, b.size.height * props.scale * 0.8)}px`,\n fontFamily: standardFontCss(fontFamily.value),\n textAlign: textAlignmentToCss(textAlign.value),\n whiteSpace: overlayTextRepeat.value ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n lineHeight: 1,\n});\n</script>\n","<template>\n <div\n @pointerdown=\"\n (e) => {\n if (!isSelected) onClick(e);\n }\n \"\n @touchstart=\"\n (e) => {\n if (!isSelected) onClick(e);\n }\n \"\n @mouseenter=\"isHovered = true\"\n @mouseleave=\"isHovered = false\"\n :style=\"containerStyle\"\n >\n <span v-if=\"isHovered && overlayText\" :style=\"textStyle\">\n {{ renderedOverlayText }}\n </span>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, type CSSProperties } from 'vue';\nimport type { AnnotationRendererProps } from '@embedpdf/plugin-annotation/vue';\nimport type { PdfRedactAnnoObject } from '@embedpdf/models';\nimport {\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCss,\n textAlignmentToCss,\n} from '@embedpdf/models';\n\nconst props = defineProps<AnnotationRendererProps<PdfRedactAnnoObject>>();\nconst isHovered = ref(false);\n\n// Access props.annotation.object directly in computed to maintain reactivity\n// C - Border/stroke color\nconst strokeColor = computed(() => props.annotation.object.strokeColor ?? '#FF0000');\n// IC - Interior color (background fill when redaction is applied)\nconst color = computed(() => props.annotation.object.color ?? '#000000');\n// CA - Opacity (0-1)\nconst opacity = computed(() => props.annotation.object.opacity ?? 1);\n// OC - Overlay text color (Adobe extension), fallback to fontColor\nconst textColor = computed(\n () => props.annotation.object.fontColor ?? props.annotation.object.overlayColor ?? '#FFFFFF',\n);\n// Overlay text properties\nconst overlayText = computed(() => props.annotation.object.overlayText);\nconst overlayTextRepeat = computed(() => props.annotation.object.overlayTextRepeat ?? false);\nconst fontSize = computed(() => props.annotation.object.fontSize ?? 12);\nconst fontFamily = computed(() => props.annotation.object.fontFamily ?? PdfStandardFont.Helvetica);\nconst textAlign = computed(() => props.annotation.object.textAlign ?? PdfTextAlignment.Center);\n\n// Calculate how many times to repeat text (approximate)\nconst renderedOverlayText = computed(() => {\n if (!overlayText.value) return '';\n if (!overlayTextRepeat.value) return overlayText.value;\n // Repeat text multiple times to fill the space\n const reps = 10;\n return Array(reps).fill(overlayText.value).join(' ');\n});\n\nconst containerStyle = computed<CSSProperties>(() => ({\n position: 'absolute',\n inset: 0,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n background: isHovered.value ? color.value : 'transparent',\n border: !isHovered.value ? `2px solid ${strokeColor.value}` : 'none',\n opacity: isHovered.value ? opacity.value : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: props.isSelected ? 'move' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign.value === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign.value === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n}));\n\nconst textStyle = computed<CSSProperties>(() => ({\n color: textColor.value,\n fontSize: `${fontSize.value * props.scale}px`,\n fontFamily: standardFontCss(fontFamily.value),\n textAlign: textAlignmentToCss(textAlign.value),\n whiteSpace: overlayTextRepeat.value ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n padding: '4px',\n}));\n</script>\n","import { createRenderer, type BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/vue';\nimport { PdfAnnotationSubtype, type PdfRedactAnnoObject } from '@embedpdf/models';\nimport RedactHighlight from './annotations/redact-highlight.vue';\nimport RedactArea from './annotations/redact-area.vue';\n\n/**\n * Boxed annotation renderers for Redact annotations.\n * Type safety is enforced at definition time via createRenderer.\n * These are automatically registered with the annotation plugin via context.\n */\nexport const redactRenderers: BoxedAnnotationRenderer[] = [\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactHighlight',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n 'segmentRects' in a &&\n (a.segmentRects?.length ?? 0) > 0,\n component: RedactHighlight,\n }),\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactArea',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n (!('segmentRects' in a) || !(a.segmentRects?.length ?? 0)),\n component: RedactArea,\n }),\n];\n","<script setup lang=\"ts\">\nimport { useRegisterRenderers } from '@embedpdf/plugin-annotation/vue';\nimport { redactRenderers } from './redact-renderers';\n\n/**\n * Utility component that registers redact renderers once at app level.\n * Added via addUtility() so it mounts once, not per-page.\n */\nuseRegisterRenderers(redactRenderers);\n</script>\n\n<template>\n <slot />\n</template>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport { RedactRendererRegistration } from './components';\n\nexport * from './hooks';\nexport * from './components';\nexport * from './components/types';\nexport * from '@embedpdf/plugin-redaction';\n\n// Automatically register redact renderers when plugin is loaded\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_unref","$attrs","_normalizeStyle","_hoisted_1","_createVNode","Highlight","_createElementVNode","_createBlock","_withCtx","_resolveDynamicComponent","_renderSlot","PendingRedactions","MarqueeRedact","SelectionRedact","RedactHighlight","RedactArea","BaseRedactionPackage","RedactRendererRegistration"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCA,UAAM,QAAQ;AAOd,UAAM,eAAe,MAAM;;AA1CzB,aAAAA,UAAA,IAAA,GAAAC,mBAmBEC,UAAA,MAAAC,WAlBoB,QAAA,OAAK,CAAjB,MAAM,MAAC;AADjB,eAAAH,UAAA,GAAAC,mBAmBE,OAnBFG,WAmBE;AAAA,UAjBC,KAAK;AAAA,UACL,eAAW,OAAA,CAAA,MAAA,OAAA,CAAA;AAAA,uBAAE,QAAA,WAAA,QAAA,QAAA,GAAA,IAAA;AAAA,UAC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OAAA,CAAA,KAAU,MAAC;eAAoB,QAAA,WAAY,SAAA,QAAQ,CAAC;AAAA;QAK/D,cAAU,OAAA,CAAA,MAAA,OAAA,CAAA,KAAU,MAAC;eAAoB,QAAA,WAAY,SAAA,QAAQ,CAAC;AAAA;QAK9D,oDAAY,UAAA,QAAS;AAAA,QACrB,oDAAY,UAAA,QAAS;AAAA,QACrB,sBAAO,eAAA,KAAc;AAAA,MAAA;QAEV,UAAA,SAAa,YAAA,sBAAzBA,mBAEO,QAAA;AAAA;UAFgC,sBAAO,UAAA,KAAS;AAAA,QAAA,mBAClD,oBAAA,KAAmB,GAAA,CAAA;;;;;ACPrB,MAAM,kBAA6C;AAAA,EACxD,eAAoC;AAAA,IAClC,IAAI;AAAA,IACJ,SAAS,CAAC,MAAA;;AACR,eAAE,SAAS,qBAAqB,UAChC,kBAAkB,QACjB,OAAE,iBAAF,mBAAgB,WAAU,KAAK;AAAA;AAAA,IAClC,WAAWkB;AAAAA,EAAA,CACZ;AAAA,EACD,eAAoC;AAAA,IAClC,IAAI;AAAA,IACJ,SAAS,CAAC,MAAA;;AACR,eAAE,SAAS,qBAAqB,WAC/B,EAAE,kBAAkB,MAAM,IAAE,OAAE,iBAAF,mBAAgB,WAAU;AAAA;AAAA,IACzD,WAAWC;AAAAA,EAAA,CACZ;AACH;;;;AClBA,yBAAqB,eAAe;;aAIlCL,WAAQ,KAAA,QAAA,SAAA;AAAA;;;ACFH,MAAM,yBAAyB,oBAAoBM,wBAAoB,EAC3E,WAAWC,SAA0B,EACrC,MAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-redaction",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",
@@ -35,16 +35,18 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@embedpdf/models": "2.3.0",
39
- "@embedpdf/utils": "2.3.0"
38
+ "@embedpdf/models": "2.4.0",
39
+ "@embedpdf/utils": "2.4.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/react": "^18.2.0",
43
43
  "typescript": "^5.0.0",
44
44
  "@embedpdf/build": "1.1.0",
45
- "@embedpdf/core": "2.3.0",
46
- "@embedpdf/plugin-selection": "2.3.0",
47
- "@embedpdf/plugin-interaction-manager": "2.3.0"
45
+ "@embedpdf/core": "2.4.0",
46
+ "@embedpdf/plugin-annotation": "2.4.0",
47
+ "@embedpdf/plugin-selection": "2.4.0",
48
+ "@embedpdf/plugin-interaction-manager": "2.4.0",
49
+ "@embedpdf/plugin-history": "2.4.0"
48
50
  },
49
51
  "peerDependencies": {
50
52
  "preact": "^10.26.4",
@@ -52,9 +54,11 @@
52
54
  "react-dom": ">=16.8.0",
53
55
  "vue": ">=3.2.0",
54
56
  "svelte": ">=5 <6",
55
- "@embedpdf/core": "2.3.0",
56
- "@embedpdf/plugin-selection": "2.3.0",
57
- "@embedpdf/plugin-interaction-manager": "2.3.0"
57
+ "@embedpdf/core": "2.4.0",
58
+ "@embedpdf/plugin-selection": "2.4.0",
59
+ "@embedpdf/plugin-annotation": "2.4.0",
60
+ "@embedpdf/plugin-interaction-manager": "2.4.0",
61
+ "@embedpdf/plugin-history": "2.4.0"
58
62
  },
59
63
  "files": [
60
64
  "dist",