@embedpdf/plugin-redaction 2.14.4 → 3.0.0-next.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.
- package/LICENSE +192 -21
- package/README.md +109 -0
- package/dist/index.cjs +227 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -0
- package/dist/index.d.ts +89 -1
- package/dist/index.js +220 -1532
- package/dist/index.js.map +1 -1
- package/package.json +22 -67
- package/dist/lib/actions.d.ts +0 -113
- package/dist/lib/handlers/index.d.ts +0 -0
- package/dist/lib/index.d.ts +0 -11
- package/dist/lib/manifest.d.ts +0 -4
- package/dist/lib/redaction-plugin.d.ts +0 -153
- package/dist/lib/reducer.d.ts +0 -6
- package/dist/lib/selectors.d.ts +0 -5
- package/dist/lib/tools.d.ts +0 -64
- package/dist/lib/types.d.ts +0 -142
- package/dist/preact/adapter.d.ts +0 -10
- package/dist/preact/annotation.d.ts +0 -1
- package/dist/preact/core.d.ts +0 -1
- package/dist/preact/index.cjs +0 -2
- package/dist/preact/index.cjs.map +0 -1
- package/dist/preact/index.d.ts +0 -1
- package/dist/preact/index.js +0 -520
- package/dist/preact/index.js.map +0 -1
- package/dist/preact/utils.d.ts +0 -1
- package/dist/react/adapter.d.ts +0 -2
- package/dist/react/annotation.d.ts +0 -1
- package/dist/react/core.d.ts +0 -1
- package/dist/react/index.cjs +0 -2
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -519
- package/dist/react/index.js.map +0 -1
- package/dist/react/utils.d.ts +0 -1
- package/dist/shared/components/annotations/index.d.ts +0 -2
- package/dist/shared/components/annotations/redact-area.d.ts +0 -18
- package/dist/shared/components/annotations/redact-highlight.d.ts +0 -18
- package/dist/shared/components/highlight.d.ts +0 -14
- package/dist/shared/components/index.d.ts +0 -5
- package/dist/shared/components/marquee-redact.d.ts +0 -15
- package/dist/shared/components/pending-redactions.d.ts +0 -12
- package/dist/shared/components/redact-renderer-registration.d.ts +0 -5
- package/dist/shared/components/redact-renderers.d.ts +0 -7
- package/dist/shared/components/redaction-layer.d.ts +0 -16
- package/dist/shared/components/selection-redact.d.ts +0 -7
- package/dist/shared/components/types.d.ts +0 -9
- package/dist/shared/hooks/index.d.ts +0 -1
- package/dist/shared/hooks/use-redaction.d.ts +0 -15
- package/dist/shared/index.d.ts +0 -4
- package/dist/shared-preact/components/annotations/index.d.ts +0 -2
- package/dist/shared-preact/components/annotations/redact-area.d.ts +0 -18
- package/dist/shared-preact/components/annotations/redact-highlight.d.ts +0 -18
- package/dist/shared-preact/components/highlight.d.ts +0 -14
- package/dist/shared-preact/components/index.d.ts +0 -5
- package/dist/shared-preact/components/marquee-redact.d.ts +0 -15
- package/dist/shared-preact/components/pending-redactions.d.ts +0 -12
- package/dist/shared-preact/components/redact-renderer-registration.d.ts +0 -5
- package/dist/shared-preact/components/redact-renderers.d.ts +0 -7
- package/dist/shared-preact/components/redaction-layer.d.ts +0 -16
- package/dist/shared-preact/components/selection-redact.d.ts +0 -7
- package/dist/shared-preact/components/types.d.ts +0 -9
- package/dist/shared-preact/hooks/index.d.ts +0 -1
- package/dist/shared-preact/hooks/use-redaction.d.ts +0 -15
- package/dist/shared-preact/index.d.ts +0 -4
- package/dist/shared-react/components/annotations/index.d.ts +0 -2
- package/dist/shared-react/components/annotations/redact-area.d.ts +0 -18
- package/dist/shared-react/components/annotations/redact-highlight.d.ts +0 -18
- package/dist/shared-react/components/highlight.d.ts +0 -14
- package/dist/shared-react/components/index.d.ts +0 -5
- package/dist/shared-react/components/marquee-redact.d.ts +0 -15
- package/dist/shared-react/components/pending-redactions.d.ts +0 -12
- package/dist/shared-react/components/redact-renderer-registration.d.ts +0 -5
- package/dist/shared-react/components/redact-renderers.d.ts +0 -7
- package/dist/shared-react/components/redaction-layer.d.ts +0 -16
- package/dist/shared-react/components/selection-redact.d.ts +0 -7
- package/dist/shared-react/components/types.d.ts +0 -9
- package/dist/shared-react/hooks/index.d.ts +0 -1
- package/dist/shared-react/hooks/use-redaction.d.ts +0 -15
- package/dist/shared-react/index.d.ts +0 -4
- package/dist/svelte/components/RedactRendererRegistration.svelte.d.ts +0 -7
- package/dist/svelte/components/annotations/RedactArea.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/RedactHighlight.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/index.d.ts +0 -2
- package/dist/svelte/components/highlight.svelte.d.ts +0 -14
- package/dist/svelte/components/index.d.ts +0 -8
- package/dist/svelte/components/marquee-redact.svelte.d.ts +0 -16
- package/dist/svelte/components/pending-redactions.svelte.d.ts +0 -15
- package/dist/svelte/components/redact-renderers.d.ts +0 -7
- package/dist/svelte/components/redaction-layer.svelte.d.ts +0 -20
- package/dist/svelte/components/selection-redact.svelte.d.ts +0 -8
- package/dist/svelte/hooks/index.d.ts +0 -1
- package/dist/svelte/hooks/use-redaction.svelte.d.ts +0 -21
- package/dist/svelte/index.cjs +0 -2
- package/dist/svelte/index.cjs.map +0 -1
- package/dist/svelte/index.d.ts +0 -5
- package/dist/svelte/index.js +0 -801
- package/dist/svelte/index.js.map +0 -1
- package/dist/svelte/types.d.ts +0 -10
- package/dist/vue/components/annotations/index.d.ts +0 -2
- package/dist/vue/components/annotations/redact-area.vue.d.ts +0 -6
- package/dist/vue/components/annotations/redact-highlight.vue.d.ts +0 -6
- package/dist/vue/components/highlight.vue.d.ts +0 -17
- package/dist/vue/components/index.d.ts +0 -8
- package/dist/vue/components/marquee-redact.vue.d.ts +0 -19
- package/dist/vue/components/pending-redactions.vue.d.ts +0 -68
- package/dist/vue/components/redact-renderer-registration.vue.d.ts +0 -13
- package/dist/vue/components/redact-renderers.d.ts +0 -7
- package/dist/vue/components/redaction-layer.vue.d.ts +0 -50
- package/dist/vue/components/selection-redact.vue.d.ts +0 -8
- package/dist/vue/components/types.d.ts +0 -9
- package/dist/vue/hooks/index.d.ts +0 -1
- package/dist/vue/hooks/use-redaction.d.ts +0 -12
- package/dist/vue/index.cjs +0 -2
- package/dist/vue/index.cjs.map +0 -1
- package/dist/vue/index.d.ts +0 -5
- package/dist/vue/index.js +0 -638
- package/dist/vue/index.js.map +0 -1
package/dist/svelte/index.js
DELETED
|
@@ -1,801 +0,0 @@
|
|
|
1
|
-
import { createPluginPackage } from "@embedpdf/core";
|
|
2
|
-
import { RedactionPlugin, initialDocumentState, RedactionPluginPackage as RedactionPluginPackage$1 } from "@embedpdf/plugin-redaction";
|
|
3
|
-
export * from "@embedpdf/plugin-redaction";
|
|
4
|
-
import "svelte/internal/disclose-version";
|
|
5
|
-
import * as $ from "svelte/internal/client";
|
|
6
|
-
import { onMount } from "svelte";
|
|
7
|
-
import { createRenderer, getRendererRegistry } from "@embedpdf/plugin-annotation/svelte";
|
|
8
|
-
import { PdfStandardFont, standardFontCssProperties, PdfTextAlignment, textAlignmentToCss, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
|
|
9
|
-
import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/svelte";
|
|
10
|
-
import { CounterRotate } from "@embedpdf/utils/svelte";
|
|
11
|
-
var root_2 = $.from_html(`<span> </span>`);
|
|
12
|
-
var root_1$5 = $.from_html(`<div role="button" tabindex="0"><!></div>`);
|
|
13
|
-
var root$2 = $.from_html(`<div role="group"></div>`);
|
|
14
|
-
function RedactHighlight($$anchor, $$props) {
|
|
15
|
-
$.push($$props, true);
|
|
16
|
-
let isHovered = $.state(false);
|
|
17
|
-
const object = $.derived(() => $$props.annotation.object);
|
|
18
|
-
const segmentRects = $.derived(() => $.get(object).segmentRects ?? []);
|
|
19
|
-
const rect = $.derived(() => $.get(object).rect);
|
|
20
|
-
const strokeColor = $.derived(() => $.get(object).strokeColor ?? "#FF0000");
|
|
21
|
-
const color = $.derived(() => $.get(object).color ?? "#000000");
|
|
22
|
-
const opacity = $.derived(() => $.get(object).opacity ?? 1);
|
|
23
|
-
const textColor = $.derived(() => $.get(object).fontColor ?? $.get(object).overlayColor ?? "#FFFFFF");
|
|
24
|
-
const overlayText = $.derived(() => $.get(object).overlayText);
|
|
25
|
-
const overlayTextRepeat = $.derived(() => $.get(object).overlayTextRepeat ?? false);
|
|
26
|
-
const fontSize = $.derived(() => $.get(object).fontSize ?? 12);
|
|
27
|
-
const fontFamily = $.derived(() => $.get(object).fontFamily ?? PdfStandardFont.Helvetica);
|
|
28
|
-
const fontCss = $.derived(() => standardFontCssProperties($.get(fontFamily)));
|
|
29
|
-
const textAlign = $.derived(() => $.get(object).textAlign ?? PdfTextAlignment.Center);
|
|
30
|
-
function renderOverlayText() {
|
|
31
|
-
if (!$.get(overlayText)) return null;
|
|
32
|
-
if (!$.get(overlayTextRepeat)) return $.get(overlayText);
|
|
33
|
-
const reps = 10;
|
|
34
|
-
return Array(reps).fill($.get(overlayText)).join(" ");
|
|
35
|
-
}
|
|
36
|
-
const justifyContent = $.derived(() => $.get(textAlign) === PdfTextAlignment.Left ? "flex-start" : $.get(textAlign) === PdfTextAlignment.Right ? "flex-end" : "center");
|
|
37
|
-
var div = root$2();
|
|
38
|
-
$.set_style(div, "", {}, { position: "absolute", inset: "0" });
|
|
39
|
-
$.each(div, 21, () => $.get(segmentRects), $.index, ($$anchor2, b) => {
|
|
40
|
-
const left = $.derived(() => ($.get(rect) ? $.get(b).origin.x - $.get(rect).origin.x : $.get(b).origin.x) * $$props.scale);
|
|
41
|
-
const top = $.derived(() => ($.get(rect) ? $.get(b).origin.y - $.get(rect).origin.y : $.get(b).origin.y) * $$props.scale);
|
|
42
|
-
const width = $.derived(() => $.get(b).size.width * $$props.scale);
|
|
43
|
-
const height = $.derived(() => $.get(b).size.height * $$props.scale);
|
|
44
|
-
const scaledFontSize = $.derived(() => Math.min($.get(fontSize) * $$props.scale, $.get(height) * 0.8));
|
|
45
|
-
var div_1 = root_1$5();
|
|
46
|
-
div_1.__pointerdown = function(...$$args) {
|
|
47
|
-
var _a;
|
|
48
|
-
(_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
|
|
49
|
-
};
|
|
50
|
-
let styles;
|
|
51
|
-
var node = $.child(div_1);
|
|
52
|
-
{
|
|
53
|
-
var consequent = ($$anchor3) => {
|
|
54
|
-
var span = root_2();
|
|
55
|
-
let styles_1;
|
|
56
|
-
var text = $.child(span, true);
|
|
57
|
-
$.reset(span);
|
|
58
|
-
$.template_effect(
|
|
59
|
-
($0, $1) => {
|
|
60
|
-
styles_1 = $.set_style(span, "", styles_1, $0);
|
|
61
|
-
$.set_text(text, $1);
|
|
62
|
-
},
|
|
63
|
-
[
|
|
64
|
-
() => ({
|
|
65
|
-
color: $.get(textColor),
|
|
66
|
-
"font-size": `${$.get(scaledFontSize) ?? ""}px`,
|
|
67
|
-
"font-family": $.get(fontCss).fontFamily,
|
|
68
|
-
"font-weight": $.get(fontCss).fontWeight,
|
|
69
|
-
"font-style": $.get(fontCss).fontStyle,
|
|
70
|
-
"text-align": textAlignmentToCss($.get(textAlign)),
|
|
71
|
-
"white-space": $.get(overlayTextRepeat) ? "normal" : "nowrap",
|
|
72
|
-
overflow: "hidden",
|
|
73
|
-
"text-overflow": "ellipsis",
|
|
74
|
-
"line-height": "1"
|
|
75
|
-
}),
|
|
76
|
-
renderOverlayText
|
|
77
|
-
]
|
|
78
|
-
);
|
|
79
|
-
$.append($$anchor3, span);
|
|
80
|
-
};
|
|
81
|
-
$.if(node, ($$render) => {
|
|
82
|
-
if ($.get(isHovered) && $.get(overlayText)) $$render(consequent);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
$.reset(div_1);
|
|
86
|
-
$.template_effect(() => styles = $.set_style(div_1, "", styles, {
|
|
87
|
-
position: "absolute",
|
|
88
|
-
left: `${$.get(left) ?? ""}px`,
|
|
89
|
-
top: `${$.get(top) ?? ""}px`,
|
|
90
|
-
width: `${$.get(width) ?? ""}px`,
|
|
91
|
-
height: `${$.get(height) ?? ""}px`,
|
|
92
|
-
background: $.get(isHovered) ? $.get(color) : "transparent",
|
|
93
|
-
border: !$.get(isHovered) ? `2px solid ${$.get(strokeColor)}` : "none",
|
|
94
|
-
opacity: $.get(isHovered) ? $.get(opacity) : 1,
|
|
95
|
-
"box-sizing": "border-box",
|
|
96
|
-
"pointer-events": "auto",
|
|
97
|
-
cursor: "pointer",
|
|
98
|
-
display: "flex",
|
|
99
|
-
"align-items": "center",
|
|
100
|
-
"justify-content": $.get(justifyContent),
|
|
101
|
-
overflow: "hidden"
|
|
102
|
-
}));
|
|
103
|
-
$.append($$anchor2, div_1);
|
|
104
|
-
});
|
|
105
|
-
$.reset(div);
|
|
106
|
-
$.event("mouseenter", div, () => $.set(isHovered, true));
|
|
107
|
-
$.event("mouseleave", div, () => $.set(isHovered, false));
|
|
108
|
-
$.append($$anchor, div);
|
|
109
|
-
$.pop();
|
|
110
|
-
}
|
|
111
|
-
$.delegate(["pointerdown"]);
|
|
112
|
-
var root_1$4 = $.from_html(`<span> </span>`);
|
|
113
|
-
var root$1 = $.from_html(`<div role="button" tabindex="0"><!></div>`);
|
|
114
|
-
function RedactArea($$anchor, $$props) {
|
|
115
|
-
$.push($$props, true);
|
|
116
|
-
let isHovered = $.state(false);
|
|
117
|
-
const object = $.derived(() => $$props.annotation.object);
|
|
118
|
-
const strokeColor = $.derived(() => $.get(object).strokeColor ?? "#FF0000");
|
|
119
|
-
const color = $.derived(() => $.get(object).color ?? "#000000");
|
|
120
|
-
const opacity = $.derived(() => $.get(object).opacity ?? 1);
|
|
121
|
-
const textColor = $.derived(() => $.get(object).fontColor ?? $.get(object).overlayColor ?? "#FFFFFF");
|
|
122
|
-
const overlayText = $.derived(() => $.get(object).overlayText);
|
|
123
|
-
const overlayTextRepeat = $.derived(() => $.get(object).overlayTextRepeat ?? false);
|
|
124
|
-
const fontSize = $.derived(() => $.get(object).fontSize ?? 12);
|
|
125
|
-
const fontFamily = $.derived(() => $.get(object).fontFamily ?? PdfStandardFont.Helvetica);
|
|
126
|
-
const fontCss = $.derived(() => standardFontCssProperties($.get(fontFamily)));
|
|
127
|
-
const textAlign = $.derived(() => $.get(object).textAlign ?? PdfTextAlignment.Center);
|
|
128
|
-
function renderOverlayText() {
|
|
129
|
-
if (!$.get(overlayText)) return null;
|
|
130
|
-
if (!$.get(overlayTextRepeat)) return $.get(overlayText);
|
|
131
|
-
const reps = 10;
|
|
132
|
-
return Array(reps).fill($.get(overlayText)).join(" ");
|
|
133
|
-
}
|
|
134
|
-
const justifyContent = $.derived(() => $.get(textAlign) === PdfTextAlignment.Left ? "flex-start" : $.get(textAlign) === PdfTextAlignment.Right ? "flex-end" : "center");
|
|
135
|
-
var div = root$1();
|
|
136
|
-
div.__pointerdown = (e) => {
|
|
137
|
-
var _a;
|
|
138
|
-
if (!$$props.isSelected) (_a = $$props.onClick) == null ? void 0 : _a.call($$props, e);
|
|
139
|
-
};
|
|
140
|
-
let styles;
|
|
141
|
-
var node = $.child(div);
|
|
142
|
-
{
|
|
143
|
-
var consequent = ($$anchor2) => {
|
|
144
|
-
var span = root_1$4();
|
|
145
|
-
let styles_1;
|
|
146
|
-
var text = $.child(span, true);
|
|
147
|
-
$.reset(span);
|
|
148
|
-
$.template_effect(
|
|
149
|
-
($0, $1) => {
|
|
150
|
-
styles_1 = $.set_style(span, "", styles_1, $0);
|
|
151
|
-
$.set_text(text, $1);
|
|
152
|
-
},
|
|
153
|
-
[
|
|
154
|
-
() => ({
|
|
155
|
-
color: $.get(textColor),
|
|
156
|
-
"font-size": `${$.get(fontSize) * $$props.scale}px`,
|
|
157
|
-
"font-family": $.get(fontCss).fontFamily,
|
|
158
|
-
"font-weight": $.get(fontCss).fontWeight,
|
|
159
|
-
"font-style": $.get(fontCss).fontStyle,
|
|
160
|
-
"text-align": textAlignmentToCss($.get(textAlign)),
|
|
161
|
-
"white-space": $.get(overlayTextRepeat) ? "normal" : "nowrap",
|
|
162
|
-
overflow: "hidden",
|
|
163
|
-
"text-overflow": "ellipsis",
|
|
164
|
-
padding: "4px"
|
|
165
|
-
}),
|
|
166
|
-
renderOverlayText
|
|
167
|
-
]
|
|
168
|
-
);
|
|
169
|
-
$.append($$anchor2, span);
|
|
170
|
-
};
|
|
171
|
-
$.if(node, ($$render) => {
|
|
172
|
-
if ($.get(isHovered) && $.get(overlayText)) $$render(consequent);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
$.reset(div);
|
|
176
|
-
$.template_effect(() => styles = $.set_style(div, "", styles, {
|
|
177
|
-
position: "absolute",
|
|
178
|
-
inset: "0",
|
|
179
|
-
background: $.get(isHovered) ? $.get(color) : "transparent",
|
|
180
|
-
border: !$.get(isHovered) ? `2px solid ${$.get(strokeColor)}` : "none",
|
|
181
|
-
opacity: $.get(isHovered) ? $.get(opacity) : 1,
|
|
182
|
-
"box-sizing": "border-box",
|
|
183
|
-
"pointer-events": "auto",
|
|
184
|
-
cursor: $$props.isSelected ? "move" : "pointer",
|
|
185
|
-
display: "flex",
|
|
186
|
-
"align-items": "center",
|
|
187
|
-
"justify-content": $.get(justifyContent),
|
|
188
|
-
overflow: "hidden"
|
|
189
|
-
}));
|
|
190
|
-
$.event("mouseenter", div, () => $.set(isHovered, true));
|
|
191
|
-
$.event("mouseleave", div, () => $.set(isHovered, false));
|
|
192
|
-
$.append($$anchor, div);
|
|
193
|
-
$.pop();
|
|
194
|
-
}
|
|
195
|
-
$.delegate(["pointerdown"]);
|
|
196
|
-
const redactRenderers = [
|
|
197
|
-
createRenderer({
|
|
198
|
-
id: "redactHighlight",
|
|
199
|
-
matches: (a) => {
|
|
200
|
-
var _a;
|
|
201
|
-
return a.type === PdfAnnotationSubtype.REDACT && "segmentRects" in a && (((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
202
|
-
},
|
|
203
|
-
component: RedactHighlight,
|
|
204
|
-
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
|
|
205
|
-
useAppearanceStream: false
|
|
206
|
-
}),
|
|
207
|
-
createRenderer({
|
|
208
|
-
id: "redactArea",
|
|
209
|
-
matches: (a) => {
|
|
210
|
-
var _a;
|
|
211
|
-
return a.type === PdfAnnotationSubtype.REDACT && (!("segmentRects" in a) || !(((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0));
|
|
212
|
-
},
|
|
213
|
-
component: RedactArea,
|
|
214
|
-
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
|
|
215
|
-
useAppearanceStream: false
|
|
216
|
-
})
|
|
217
|
-
];
|
|
218
|
-
function RedactRendererRegistration($$anchor, $$props) {
|
|
219
|
-
$.push($$props, true);
|
|
220
|
-
const registry = getRendererRegistry();
|
|
221
|
-
onMount(() => {
|
|
222
|
-
if (!registry) return;
|
|
223
|
-
return registry.register(redactRenderers);
|
|
224
|
-
});
|
|
225
|
-
var fragment = $.comment();
|
|
226
|
-
var node = $.first_child(fragment);
|
|
227
|
-
{
|
|
228
|
-
var consequent = ($$anchor2) => {
|
|
229
|
-
var fragment_1 = $.comment();
|
|
230
|
-
var node_1 = $.first_child(fragment_1);
|
|
231
|
-
$.snippet(node_1, () => $$props.children);
|
|
232
|
-
$.append($$anchor2, fragment_1);
|
|
233
|
-
};
|
|
234
|
-
$.if(node, ($$render) => {
|
|
235
|
-
if ($$props.children) $$render(consequent);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
$.append($$anchor, fragment);
|
|
239
|
-
$.pop();
|
|
240
|
-
}
|
|
241
|
-
const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
|
|
242
|
-
const useRedactionCapability = () => useCapability(RedactionPlugin.id);
|
|
243
|
-
const useRedaction = (getDocumentId) => {
|
|
244
|
-
const capability = useRedactionCapability();
|
|
245
|
-
let state = $.state($.proxy(initialDocumentState));
|
|
246
|
-
const documentId = $.derived(getDocumentId);
|
|
247
|
-
const scopedProvides = $.derived(() => capability.provides && $.get(documentId) ? capability.provides.forDocument($.get(documentId)) : null);
|
|
248
|
-
$.user_effect(() => {
|
|
249
|
-
const provides = capability.provides;
|
|
250
|
-
const docId = $.get(documentId);
|
|
251
|
-
if (!provides || !docId) {
|
|
252
|
-
$.set(state, initialDocumentState, true);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
const scope = provides.forDocument(docId);
|
|
256
|
-
try {
|
|
257
|
-
$.set(state, scope.getState(), true);
|
|
258
|
-
} catch (e) {
|
|
259
|
-
$.set(state, initialDocumentState, true);
|
|
260
|
-
}
|
|
261
|
-
return scope.onStateChange((newState) => {
|
|
262
|
-
$.set(state, newState, true);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
return {
|
|
266
|
-
get provides() {
|
|
267
|
-
return $.get(scopedProvides);
|
|
268
|
-
},
|
|
269
|
-
get state() {
|
|
270
|
-
return $.get(state);
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
};
|
|
274
|
-
var root_1$3 = $.from_html(`<div></div>`);
|
|
275
|
-
function Highlight($$anchor, $$props) {
|
|
276
|
-
let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 1), border = $.prop($$props, "border", 3, "1px solid red"), style = $.prop($$props, "style", 3, "");
|
|
277
|
-
const boundingRect = $.derived(() => $$props.rect);
|
|
278
|
-
var fragment = $.comment();
|
|
279
|
-
var node = $.first_child(fragment);
|
|
280
|
-
$.each(node, 17, () => $$props.rects, $.index, ($$anchor2, b) => {
|
|
281
|
-
var div = root_1$3();
|
|
282
|
-
div.__pointerdown = function(...$$args) {
|
|
283
|
-
var _a;
|
|
284
|
-
(_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
|
|
285
|
-
};
|
|
286
|
-
let styles;
|
|
287
|
-
$.template_effect(() => styles = $.set_style(div, style(), styles, {
|
|
288
|
-
position: "absolute",
|
|
289
|
-
border: border(),
|
|
290
|
-
left: `${($.get(boundingRect) ? $.get(b).origin.x - $.get(boundingRect).origin.x : $.get(b).origin.x) * $$props.scale}px`,
|
|
291
|
-
top: `${($.get(boundingRect) ? $.get(b).origin.y - $.get(boundingRect).origin.y : $.get(b).origin.y) * $$props.scale}px`,
|
|
292
|
-
width: `${$.get(b).size.width * $$props.scale}px`,
|
|
293
|
-
height: `${$.get(b).size.height * $$props.scale}px`,
|
|
294
|
-
background: color(),
|
|
295
|
-
opacity: opacity(),
|
|
296
|
-
"pointer-events": $$props.onClick ? "auto" : "none",
|
|
297
|
-
cursor: $$props.onClick ? "pointer" : "default",
|
|
298
|
-
"z-index": $$props.onClick ? "1" : void 0
|
|
299
|
-
}));
|
|
300
|
-
$.append($$anchor2, div);
|
|
301
|
-
});
|
|
302
|
-
$.append($$anchor, fragment);
|
|
303
|
-
}
|
|
304
|
-
$.delegate(["pointerdown"]);
|
|
305
|
-
var root_1$2 = $.from_html(`<div></div>`);
|
|
306
|
-
function Marquee_redact($$anchor, $$props) {
|
|
307
|
-
$.push($$props, true);
|
|
308
|
-
let className = $.prop($$props, "className", 3, ""), fill = $.prop($$props, "fill", 3, "transparent");
|
|
309
|
-
const redactionPlugin = useRedactionPlugin();
|
|
310
|
-
const documentState = useDocumentState(() => $$props.documentId);
|
|
311
|
-
let rect = $.state(null);
|
|
312
|
-
const actualScale = $.derived(() => {
|
|
313
|
-
var _a;
|
|
314
|
-
return $$props.scale !== void 0 ? $$props.scale : ((_a = documentState.current) == null ? void 0 : _a.scale) ?? 1;
|
|
315
|
-
});
|
|
316
|
-
const strokeColor = $.derived(() => {
|
|
317
|
-
var _a;
|
|
318
|
-
return $$props.stroke ?? ((_a = redactionPlugin.plugin) == null ? void 0 : _a.getPreviewStrokeColor()) ?? "red";
|
|
319
|
-
});
|
|
320
|
-
$.user_effect(() => {
|
|
321
|
-
if (!redactionPlugin.plugin || !$$props.documentId) {
|
|
322
|
-
$.set(rect, null);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
return redactionPlugin.plugin.onRedactionMarqueeChange($$props.documentId, (data) => {
|
|
326
|
-
$.set(rect, data.pageIndex === $$props.pageIndex ? data.rect : null, true);
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
var fragment = $.comment();
|
|
330
|
-
var node = $.first_child(fragment);
|
|
331
|
-
{
|
|
332
|
-
var consequent = ($$anchor2) => {
|
|
333
|
-
var div = root_1$2();
|
|
334
|
-
let styles;
|
|
335
|
-
$.template_effect(() => {
|
|
336
|
-
$.set_class(div, 1, $.clsx(className()));
|
|
337
|
-
styles = $.set_style(div, "", styles, {
|
|
338
|
-
position: "absolute",
|
|
339
|
-
"pointer-events": "none",
|
|
340
|
-
left: `${$.get(rect).origin.x * $.get(actualScale)}px`,
|
|
341
|
-
top: `${$.get(rect).origin.y * $.get(actualScale)}px`,
|
|
342
|
-
width: `${$.get(rect).size.width * $.get(actualScale)}px`,
|
|
343
|
-
height: `${$.get(rect).size.height * $.get(actualScale)}px`,
|
|
344
|
-
border: `1px solid ${$.get(strokeColor)}`,
|
|
345
|
-
background: fill(),
|
|
346
|
-
"box-sizing": "border-box"
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
$.append($$anchor2, div);
|
|
350
|
-
};
|
|
351
|
-
$.if(node, ($$render) => {
|
|
352
|
-
if ($.get(rect)) $$render(consequent);
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
$.append($$anchor, fragment);
|
|
356
|
-
$.pop();
|
|
357
|
-
}
|
|
358
|
-
var root_3 = $.from_html(`<div></div> <!>`, 1);
|
|
359
|
-
var root_10 = $.from_html(`<div><!></div> <!>`, 1);
|
|
360
|
-
var root_1$1 = $.from_html(`<div style="position: absolute; inset: 0; pointer-events: none;"></div>`);
|
|
361
|
-
function Pending_redactions($$anchor, $$props) {
|
|
362
|
-
$.push($$props, true);
|
|
363
|
-
let rotation = $.prop($$props, "rotation", 19, () => Rotation.Degree0), bboxStroke = $.prop($$props, "bboxStroke", 3, "rgba(0,0,0,0.8)");
|
|
364
|
-
const redactionCapability = useRedactionCapability();
|
|
365
|
-
let items = $.state($.proxy([]));
|
|
366
|
-
let selectedId = $.state(null);
|
|
367
|
-
$.user_effect(() => {
|
|
368
|
-
var _a;
|
|
369
|
-
const redactionValue = redactionCapability.provides;
|
|
370
|
-
if (!redactionValue) {
|
|
371
|
-
$.set(items, [], true);
|
|
372
|
-
$.set(selectedId, null);
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
const scoped = redactionValue.forDocument($$props.documentId);
|
|
376
|
-
const currentState = scoped.getState();
|
|
377
|
-
$.set(items, (currentState.pending[$$props.pageIndex] ?? []).filter((it) => it.source === "legacy"), true);
|
|
378
|
-
$.set(selectedId, ((_a = currentState.selected) == null ? void 0 : _a.page) === $$props.pageIndex ? currentState.selected.id : null, true);
|
|
379
|
-
const off1 = scoped.onPendingChange((map) => {
|
|
380
|
-
$.set(items, (map[$$props.pageIndex] ?? []).filter((it) => it.source === "legacy"), true);
|
|
381
|
-
});
|
|
382
|
-
const off2 = scoped.onSelectedChange((sel) => {
|
|
383
|
-
$.set(selectedId, (sel == null ? void 0 : sel.page) === $$props.pageIndex ? sel.id : null, true);
|
|
384
|
-
});
|
|
385
|
-
return () => {
|
|
386
|
-
off1 == null ? void 0 : off1();
|
|
387
|
-
off2 == null ? void 0 : off2();
|
|
388
|
-
};
|
|
389
|
-
});
|
|
390
|
-
function select(e, id) {
|
|
391
|
-
e.stopPropagation();
|
|
392
|
-
if (!redactionCapability.provides) return;
|
|
393
|
-
redactionCapability.provides.forDocument($$props.documentId).selectPending($$props.pageIndex, id);
|
|
394
|
-
}
|
|
395
|
-
function shouldShowMenu(itemId) {
|
|
396
|
-
const isSelected = $.get(selectedId) === itemId;
|
|
397
|
-
return isSelected && (!!$$props.selectionMenu || !!$$props.selectionMenuSnippet);
|
|
398
|
-
}
|
|
399
|
-
function buildContext(item) {
|
|
400
|
-
return { type: "redaction", item, pageIndex: $$props.pageIndex };
|
|
401
|
-
}
|
|
402
|
-
const menuPlacement = { suggestTop: false, spaceAbove: 0, spaceBelow: 0 };
|
|
403
|
-
function buildMenuProps(item, rect, menuWrapperProps) {
|
|
404
|
-
return {
|
|
405
|
-
context: buildContext(item),
|
|
406
|
-
selected: $.get(selectedId) === item.id,
|
|
407
|
-
rect,
|
|
408
|
-
placement: menuPlacement,
|
|
409
|
-
menuWrapperProps
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
var fragment = $.comment();
|
|
413
|
-
var node = $.first_child(fragment);
|
|
414
|
-
{
|
|
415
|
-
var consequent_9 = ($$anchor2) => {
|
|
416
|
-
var div = root_1$1();
|
|
417
|
-
$.each(div, 21, () => $.get(items), (item) => item.id, ($$anchor3, item) => {
|
|
418
|
-
var fragment_1 = $.comment();
|
|
419
|
-
var node_1 = $.first_child(fragment_1);
|
|
420
|
-
{
|
|
421
|
-
var consequent_4 = ($$anchor4) => {
|
|
422
|
-
var fragment_2 = root_3();
|
|
423
|
-
var div_1 = $.first_child(fragment_2);
|
|
424
|
-
div_1.__pointerdown = (e) => select(e, $.get(item).id);
|
|
425
|
-
var node_2 = $.sibling(div_1, 2);
|
|
426
|
-
{
|
|
427
|
-
var consequent_3 = ($$anchor5) => {
|
|
428
|
-
{
|
|
429
|
-
const children = ($$anchor6, $$arg0) => {
|
|
430
|
-
let rect = () => $$arg0 == null ? void 0 : $$arg0().rect;
|
|
431
|
-
let menuWrapperProps = () => $$arg0 == null ? void 0 : $$arg0().menuWrapperProps;
|
|
432
|
-
const menuProps = $.derived(() => buildMenuProps($.get(item), rect(), menuWrapperProps()));
|
|
433
|
-
var fragment_4 = $.comment();
|
|
434
|
-
var node_3 = $.first_child(fragment_4);
|
|
435
|
-
{
|
|
436
|
-
var consequent_1 = ($$anchor7) => {
|
|
437
|
-
const result = $.derived(() => $$props.selectionMenu($.get(menuProps)));
|
|
438
|
-
var fragment_5 = $.comment();
|
|
439
|
-
var node_4 = $.first_child(fragment_5);
|
|
440
|
-
{
|
|
441
|
-
var consequent = ($$anchor8) => {
|
|
442
|
-
var fragment_6 = $.comment();
|
|
443
|
-
var node_5 = $.first_child(fragment_6);
|
|
444
|
-
$.component(node_5, () => $.get(result).component, ($$anchor9, result_component) => {
|
|
445
|
-
result_component($$anchor9, $.spread_props(() => $.get(result).props));
|
|
446
|
-
});
|
|
447
|
-
$.append($$anchor8, fragment_6);
|
|
448
|
-
};
|
|
449
|
-
$.if(node_4, ($$render) => {
|
|
450
|
-
if ($.get(result)) $$render(consequent);
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
$.append($$anchor7, fragment_5);
|
|
454
|
-
};
|
|
455
|
-
var alternate = ($$anchor7) => {
|
|
456
|
-
var fragment_7 = $.comment();
|
|
457
|
-
var node_6 = $.first_child(fragment_7);
|
|
458
|
-
{
|
|
459
|
-
var consequent_2 = ($$anchor8) => {
|
|
460
|
-
var fragment_8 = $.comment();
|
|
461
|
-
var node_7 = $.first_child(fragment_8);
|
|
462
|
-
$.snippet(node_7, () => $$props.selectionMenuSnippet, () => $.get(menuProps));
|
|
463
|
-
$.append($$anchor8, fragment_8);
|
|
464
|
-
};
|
|
465
|
-
$.if(
|
|
466
|
-
node_6,
|
|
467
|
-
($$render) => {
|
|
468
|
-
if ($$props.selectionMenuSnippet) $$render(consequent_2);
|
|
469
|
-
},
|
|
470
|
-
true
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
$.append($$anchor7, fragment_7);
|
|
474
|
-
};
|
|
475
|
-
$.if(node_3, ($$render) => {
|
|
476
|
-
if ($$props.selectionMenu) $$render(consequent_1);
|
|
477
|
-
else $$render(alternate, false);
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
$.append($$anchor6, fragment_4);
|
|
481
|
-
};
|
|
482
|
-
let $0 = $.derived(() => ({
|
|
483
|
-
origin: {
|
|
484
|
-
x: $.get(item).rect.origin.x * $$props.scale,
|
|
485
|
-
y: $.get(item).rect.origin.y * $$props.scale
|
|
486
|
-
},
|
|
487
|
-
size: {
|
|
488
|
-
width: $.get(item).rect.size.width * $$props.scale,
|
|
489
|
-
height: $.get(item).rect.size.height * $$props.scale
|
|
490
|
-
}
|
|
491
|
-
}));
|
|
492
|
-
CounterRotate($$anchor5, {
|
|
493
|
-
get rect() {
|
|
494
|
-
return $.get($0);
|
|
495
|
-
},
|
|
496
|
-
get rotation() {
|
|
497
|
-
return rotation();
|
|
498
|
-
},
|
|
499
|
-
children,
|
|
500
|
-
$$slots: { default: true }
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
$.if(node_2, ($$render) => {
|
|
505
|
-
if (shouldShowMenu($.get(item).id)) $$render(consequent_3);
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
$.template_effect(() => $.set_style(div_1, `
|
|
509
|
-
position: absolute;
|
|
510
|
-
left: ${$.get(item).rect.origin.x * $$props.scale}px;
|
|
511
|
-
top: ${$.get(item).rect.origin.y * $$props.scale}px;
|
|
512
|
-
width: ${$.get(item).rect.size.width * $$props.scale}px;
|
|
513
|
-
height: ${$.get(item).rect.size.height * $$props.scale}px;
|
|
514
|
-
background: transparent;
|
|
515
|
-
outline: ${$.get(selectedId) === $.get(item).id ? `1px solid ${bboxStroke()}` : "none"};
|
|
516
|
-
outline-offset: 2px;
|
|
517
|
-
border: 1px solid red;
|
|
518
|
-
pointer-events: auto;
|
|
519
|
-
cursor: pointer;
|
|
520
|
-
`));
|
|
521
|
-
$.append($$anchor4, fragment_2);
|
|
522
|
-
};
|
|
523
|
-
var alternate_2 = ($$anchor4) => {
|
|
524
|
-
var fragment_9 = root_10();
|
|
525
|
-
var div_2 = $.first_child(fragment_9);
|
|
526
|
-
var node_8 = $.child(div_2);
|
|
527
|
-
Highlight(node_8, {
|
|
528
|
-
get rect() {
|
|
529
|
-
return $.get(item).rect;
|
|
530
|
-
},
|
|
531
|
-
get rects() {
|
|
532
|
-
return $.get(item).rects;
|
|
533
|
-
},
|
|
534
|
-
color: "transparent",
|
|
535
|
-
border: "1px solid red",
|
|
536
|
-
get scale() {
|
|
537
|
-
return $$props.scale;
|
|
538
|
-
},
|
|
539
|
-
onClick: (e) => select(e, $.get(item).id)
|
|
540
|
-
});
|
|
541
|
-
$.reset(div_2);
|
|
542
|
-
var node_9 = $.sibling(div_2, 2);
|
|
543
|
-
{
|
|
544
|
-
var consequent_8 = ($$anchor5) => {
|
|
545
|
-
{
|
|
546
|
-
const children = ($$anchor6, $$arg0) => {
|
|
547
|
-
let rect = () => $$arg0 == null ? void 0 : $$arg0().rect;
|
|
548
|
-
let menuWrapperProps = () => $$arg0 == null ? void 0 : $$arg0().menuWrapperProps;
|
|
549
|
-
const menuProps = $.derived(() => buildMenuProps($.get(item), rect(), menuWrapperProps()));
|
|
550
|
-
var fragment_11 = $.comment();
|
|
551
|
-
var node_10 = $.first_child(fragment_11);
|
|
552
|
-
{
|
|
553
|
-
var consequent_6 = ($$anchor7) => {
|
|
554
|
-
const result = $.derived(() => $$props.selectionMenu($.get(menuProps)));
|
|
555
|
-
var fragment_12 = $.comment();
|
|
556
|
-
var node_11 = $.first_child(fragment_12);
|
|
557
|
-
{
|
|
558
|
-
var consequent_5 = ($$anchor8) => {
|
|
559
|
-
var fragment_13 = $.comment();
|
|
560
|
-
var node_12 = $.first_child(fragment_13);
|
|
561
|
-
$.component(node_12, () => $.get(result).component, ($$anchor9, result_component_1) => {
|
|
562
|
-
result_component_1($$anchor9, $.spread_props(() => $.get(result).props));
|
|
563
|
-
});
|
|
564
|
-
$.append($$anchor8, fragment_13);
|
|
565
|
-
};
|
|
566
|
-
$.if(node_11, ($$render) => {
|
|
567
|
-
if ($.get(result)) $$render(consequent_5);
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
$.append($$anchor7, fragment_12);
|
|
571
|
-
};
|
|
572
|
-
var alternate_1 = ($$anchor7) => {
|
|
573
|
-
var fragment_14 = $.comment();
|
|
574
|
-
var node_13 = $.first_child(fragment_14);
|
|
575
|
-
{
|
|
576
|
-
var consequent_7 = ($$anchor8) => {
|
|
577
|
-
var fragment_15 = $.comment();
|
|
578
|
-
var node_14 = $.first_child(fragment_15);
|
|
579
|
-
$.snippet(node_14, () => $$props.selectionMenuSnippet, () => $.get(menuProps));
|
|
580
|
-
$.append($$anchor8, fragment_15);
|
|
581
|
-
};
|
|
582
|
-
$.if(
|
|
583
|
-
node_13,
|
|
584
|
-
($$render) => {
|
|
585
|
-
if ($$props.selectionMenuSnippet) $$render(consequent_7);
|
|
586
|
-
},
|
|
587
|
-
true
|
|
588
|
-
);
|
|
589
|
-
}
|
|
590
|
-
$.append($$anchor7, fragment_14);
|
|
591
|
-
};
|
|
592
|
-
$.if(node_10, ($$render) => {
|
|
593
|
-
if ($$props.selectionMenu) $$render(consequent_6);
|
|
594
|
-
else $$render(alternate_1, false);
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
$.append($$anchor6, fragment_11);
|
|
598
|
-
};
|
|
599
|
-
let $0 = $.derived(() => ({
|
|
600
|
-
origin: {
|
|
601
|
-
x: $.get(item).rect.origin.x * $$props.scale,
|
|
602
|
-
y: $.get(item).rect.origin.y * $$props.scale
|
|
603
|
-
},
|
|
604
|
-
size: {
|
|
605
|
-
width: $.get(item).rect.size.width * $$props.scale,
|
|
606
|
-
height: $.get(item).rect.size.height * $$props.scale
|
|
607
|
-
}
|
|
608
|
-
}));
|
|
609
|
-
CounterRotate($$anchor5, {
|
|
610
|
-
get rect() {
|
|
611
|
-
return $.get($0);
|
|
612
|
-
},
|
|
613
|
-
get rotation() {
|
|
614
|
-
return rotation();
|
|
615
|
-
},
|
|
616
|
-
children,
|
|
617
|
-
$$slots: { default: true }
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
$.if(node_9, ($$render) => {
|
|
622
|
-
if (shouldShowMenu($.get(item).id)) $$render(consequent_8);
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
$.template_effect(() => $.set_style(div_2, `
|
|
626
|
-
position: absolute;
|
|
627
|
-
left: ${$.get(item).rect.origin.x * $$props.scale}px;
|
|
628
|
-
top: ${$.get(item).rect.origin.y * $$props.scale}px;
|
|
629
|
-
width: ${$.get(item).rect.size.width * $$props.scale}px;
|
|
630
|
-
height: ${$.get(item).rect.size.height * $$props.scale}px;
|
|
631
|
-
background: transparent;
|
|
632
|
-
outline: ${$.get(selectedId) === $.get(item).id ? `1px solid ${bboxStroke()}` : "none"};
|
|
633
|
-
outline-offset: 2px;
|
|
634
|
-
pointer-events: auto;
|
|
635
|
-
cursor: ${$.get(selectedId) === $.get(item).id ? "pointer" : "default"};
|
|
636
|
-
`));
|
|
637
|
-
$.append($$anchor4, fragment_9);
|
|
638
|
-
};
|
|
639
|
-
$.if(node_1, ($$render) => {
|
|
640
|
-
if ($.get(item).kind === "area") $$render(consequent_4);
|
|
641
|
-
else $$render(alternate_2, false);
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
$.append($$anchor3, fragment_1);
|
|
645
|
-
});
|
|
646
|
-
$.reset(div);
|
|
647
|
-
$.append($$anchor2, div);
|
|
648
|
-
};
|
|
649
|
-
$.if(node, ($$render) => {
|
|
650
|
-
if ($.get(items).length) $$render(consequent_9);
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
$.append($$anchor, fragment);
|
|
654
|
-
$.pop();
|
|
655
|
-
}
|
|
656
|
-
$.delegate(["pointerdown"]);
|
|
657
|
-
var root_1 = $.from_html(`<div><!></div>`);
|
|
658
|
-
function Selection_redact($$anchor, $$props) {
|
|
659
|
-
$.push($$props, true);
|
|
660
|
-
const redactionPlugin = useRedactionPlugin();
|
|
661
|
-
let rects = $.state($.proxy([]));
|
|
662
|
-
let boundingRect = $.state(null);
|
|
663
|
-
const strokeColor = $.derived(() => {
|
|
664
|
-
var _a;
|
|
665
|
-
return ((_a = redactionPlugin.plugin) == null ? void 0 : _a.getPreviewStrokeColor()) ?? "red";
|
|
666
|
-
});
|
|
667
|
-
$.user_effect(() => {
|
|
668
|
-
if (!redactionPlugin.plugin) {
|
|
669
|
-
$.set(rects, [], true);
|
|
670
|
-
$.set(boundingRect, null);
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
return redactionPlugin.plugin.onRedactionSelectionChange($$props.documentId, (formattedSelection) => {
|
|
674
|
-
const selection = formattedSelection.find((s) => s.pageIndex === $$props.pageIndex);
|
|
675
|
-
$.set(rects, (selection == null ? void 0 : selection.segmentRects) ?? [], true);
|
|
676
|
-
$.set(boundingRect, (selection == null ? void 0 : selection.rect) ?? null, true);
|
|
677
|
-
});
|
|
678
|
-
});
|
|
679
|
-
var fragment = $.comment();
|
|
680
|
-
var node = $.first_child(fragment);
|
|
681
|
-
{
|
|
682
|
-
var consequent = ($$anchor2) => {
|
|
683
|
-
var div = root_1();
|
|
684
|
-
$.set_style(div, "", {}, {
|
|
685
|
-
"mix-blend-mode": "normal",
|
|
686
|
-
"pointer-events": "none",
|
|
687
|
-
position: "absolute",
|
|
688
|
-
inset: "0"
|
|
689
|
-
});
|
|
690
|
-
var node_1 = $.child(div);
|
|
691
|
-
{
|
|
692
|
-
let $0 = $.derived(() => `1px solid ${$.get(strokeColor)}`);
|
|
693
|
-
Highlight(node_1, {
|
|
694
|
-
color: "transparent",
|
|
695
|
-
opacity: 1,
|
|
696
|
-
get rects() {
|
|
697
|
-
return $.get(rects);
|
|
698
|
-
},
|
|
699
|
-
get scale() {
|
|
700
|
-
return $$props.scale;
|
|
701
|
-
},
|
|
702
|
-
get border() {
|
|
703
|
-
return $.get($0);
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
$.reset(div);
|
|
708
|
-
$.append($$anchor2, div);
|
|
709
|
-
};
|
|
710
|
-
$.if(node, ($$render) => {
|
|
711
|
-
if ($.get(boundingRect)) $$render(consequent);
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
$.append($$anchor, fragment);
|
|
715
|
-
$.pop();
|
|
716
|
-
}
|
|
717
|
-
var root = $.from_html(`<!> <!> <!>`, 1);
|
|
718
|
-
function Redaction_layer($$anchor, $$props) {
|
|
719
|
-
$.push($$props, true);
|
|
720
|
-
const documentState = useDocumentState(() => $$props.documentId);
|
|
721
|
-
const page = $.derived(() => {
|
|
722
|
-
var _a, _b, _c;
|
|
723
|
-
return (_c = (_b = (_a = documentState.current) == null ? void 0 : _a.document) == null ? void 0 : _b.pages) == null ? void 0 : _c[$$props.pageIndex];
|
|
724
|
-
});
|
|
725
|
-
const actualScale = $.derived(() => {
|
|
726
|
-
var _a;
|
|
727
|
-
return $$props.scale !== void 0 ? $$props.scale : ((_a = documentState.current) == null ? void 0 : _a.scale) ?? 1;
|
|
728
|
-
});
|
|
729
|
-
const actualRotation = $.derived(() => {
|
|
730
|
-
var _a, _b;
|
|
731
|
-
if ($$props.rotation !== void 0) return $$props.rotation;
|
|
732
|
-
const pageRotation = ((_a = $.get(page)) == null ? void 0 : _a.rotation) ?? 0;
|
|
733
|
-
const docRotation = ((_b = documentState.current) == null ? void 0 : _b.rotation) ?? 0;
|
|
734
|
-
return (pageRotation + docRotation) % 4;
|
|
735
|
-
});
|
|
736
|
-
var fragment = root();
|
|
737
|
-
var node = $.first_child(fragment);
|
|
738
|
-
Pending_redactions(node, {
|
|
739
|
-
get documentId() {
|
|
740
|
-
return $$props.documentId;
|
|
741
|
-
},
|
|
742
|
-
get pageIndex() {
|
|
743
|
-
return $$props.pageIndex;
|
|
744
|
-
},
|
|
745
|
-
get scale() {
|
|
746
|
-
return $.get(actualScale);
|
|
747
|
-
},
|
|
748
|
-
get rotation() {
|
|
749
|
-
return $.get(actualRotation);
|
|
750
|
-
},
|
|
751
|
-
get selectionMenu() {
|
|
752
|
-
return $$props.selectionMenu;
|
|
753
|
-
},
|
|
754
|
-
get selectionMenuSnippet() {
|
|
755
|
-
return $$props.selectionMenuSnippet;
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
var node_1 = $.sibling(node, 2);
|
|
759
|
-
Marquee_redact(node_1, {
|
|
760
|
-
get documentId() {
|
|
761
|
-
return $$props.documentId;
|
|
762
|
-
},
|
|
763
|
-
get pageIndex() {
|
|
764
|
-
return $$props.pageIndex;
|
|
765
|
-
},
|
|
766
|
-
get scale() {
|
|
767
|
-
return $.get(actualScale);
|
|
768
|
-
}
|
|
769
|
-
});
|
|
770
|
-
var node_2 = $.sibling(node_1, 2);
|
|
771
|
-
Selection_redact(node_2, {
|
|
772
|
-
get documentId() {
|
|
773
|
-
return $$props.documentId;
|
|
774
|
-
},
|
|
775
|
-
get pageIndex() {
|
|
776
|
-
return $$props.pageIndex;
|
|
777
|
-
},
|
|
778
|
-
get scale() {
|
|
779
|
-
return $.get(actualScale);
|
|
780
|
-
}
|
|
781
|
-
});
|
|
782
|
-
$.append($$anchor, fragment);
|
|
783
|
-
$.pop();
|
|
784
|
-
}
|
|
785
|
-
const RedactionPluginPackage = createPluginPackage(RedactionPluginPackage$1).addUtility(RedactRendererRegistration).build();
|
|
786
|
-
export {
|
|
787
|
-
Highlight,
|
|
788
|
-
Marquee_redact as MarqueeRedact,
|
|
789
|
-
Pending_redactions as PendingRedactions,
|
|
790
|
-
RedactArea,
|
|
791
|
-
RedactHighlight,
|
|
792
|
-
RedactRendererRegistration,
|
|
793
|
-
Redaction_layer as RedactionLayer,
|
|
794
|
-
RedactionPluginPackage,
|
|
795
|
-
Selection_redact as SelectionRedact,
|
|
796
|
-
redactRenderers,
|
|
797
|
-
useRedaction,
|
|
798
|
-
useRedactionCapability,
|
|
799
|
-
useRedactionPlugin
|
|
800
|
-
};
|
|
801
|
-
//# sourceMappingURL=index.js.map
|