@arbidocs/react 0.4.60 → 0.4.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotations/freeze/index.cjs +385 -15
- package/dist/annotations/freeze/index.cjs.map +1 -1
- package/dist/annotations/freeze/index.d.cts +86 -2
- package/dist/annotations/freeze/index.d.ts +86 -2
- package/dist/annotations/freeze/index.js +376 -12
- package/dist/annotations/freeze/index.js.map +1 -1
- package/dist/annotations/index.cjs +441 -39
- package/dist/annotations/index.cjs.map +1 -1
- package/dist/annotations/index.d.cts +78 -3
- package/dist/annotations/index.d.ts +78 -3
- package/dist/annotations/index.js +414 -18
- package/dist/annotations/index.js.map +1 -1
- package/dist/{chunk-JWXIRUWN.js → chunk-COWZGCL5.js} +5 -3
- package/dist/chunk-COWZGCL5.js.map +1 -0
- package/dist/{chunk-X3F5ABY2.cjs → chunk-JTNNUIXO.cjs} +3 -3
- package/dist/{chunk-X3F5ABY2.cjs.map → chunk-JTNNUIXO.cjs.map} +1 -1
- package/dist/{chunk-BGDE4DP5.cjs → chunk-SSOPIPEX.cjs} +5 -3
- package/dist/chunk-SSOPIPEX.cjs.map +1 -0
- package/dist/{chunk-CVN7MAGQ.js → chunk-YIBZJDT4.js} +3 -3
- package/dist/{chunk-CVN7MAGQ.js.map → chunk-YIBZJDT4.js.map} +1 -1
- package/dist/index.cjs +198 -198
- package/dist/index.js +4 -4
- package/dist/{model-DzQxhMMz.d.cts → model-DIwXRuGC.d.cts} +3 -0
- package/dist/{model-DzQxhMMz.d.ts → model-DIwXRuGC.d.ts} +3 -0
- package/dist/ui/index.cjs +137 -137
- package/dist/ui/index.js +2 -2
- package/package.json +4 -3
- package/dist/chunk-BGDE4DP5.cjs.map +0 -1
- package/dist/chunk-JWXIRUWN.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkXDCRWZF2_cjs = require('../chunk-XDCRWZF2.cjs');
|
|
4
4
|
var chunkS6A6FSG7_cjs = require('../chunk-S6A6FSG7.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkSSOPIPEX_cjs = require('../chunk-SSOPIPEX.cjs');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var lucideReact = require('lucide-react');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -17,7 +17,7 @@ function reduceLayer(layer, action) {
|
|
|
17
17
|
case "replaceAll":
|
|
18
18
|
return action.layer;
|
|
19
19
|
case "add": {
|
|
20
|
-
const annotation =
|
|
20
|
+
const annotation = chunkSSOPIPEX_cjs.parseAnnotation(action.annotation);
|
|
21
21
|
if (layer.annotations.some((a) => a.id === annotation.id)) {
|
|
22
22
|
throw new Error(`annotation ${annotation.id} already exists`);
|
|
23
23
|
}
|
|
@@ -36,7 +36,7 @@ function reduceLayer(layer, action) {
|
|
|
36
36
|
case "update": {
|
|
37
37
|
const found = layer.annotations.find((a) => a.id === action.id);
|
|
38
38
|
if (!found) return layer;
|
|
39
|
-
const next =
|
|
39
|
+
const next = chunkSSOPIPEX_cjs.parseAnnotation({
|
|
40
40
|
...found,
|
|
41
41
|
...action.patch,
|
|
42
42
|
id: found.id,
|
|
@@ -61,14 +61,21 @@ function reduceLayer(layer, action) {
|
|
|
61
61
|
const annotations = layer.annotations.map((a) => {
|
|
62
62
|
if (a.kind !== "redaction" || !ids.has(a.id) || a.status === action.status) return a;
|
|
63
63
|
changed = true;
|
|
64
|
-
|
|
64
|
+
const next = { ...a, status: action.status, updatedAt: action.now };
|
|
65
|
+
delete next.reviewedBy;
|
|
66
|
+
delete next.reviewedAt;
|
|
67
|
+
if (action.status !== "pending" && action.by) {
|
|
68
|
+
next.reviewedBy = action.by;
|
|
69
|
+
next.reviewedAt = action.now;
|
|
70
|
+
}
|
|
71
|
+
return next;
|
|
65
72
|
});
|
|
66
73
|
return changed ? { ...layer, annotations, updatedAt: action.now } : layer;
|
|
67
74
|
}
|
|
68
75
|
case "reply": {
|
|
69
76
|
const found = layer.annotations.find((a) => a.id === action.id);
|
|
70
77
|
if (!found || found.kind !== "comment") return layer;
|
|
71
|
-
const next =
|
|
78
|
+
const next = chunkSSOPIPEX_cjs.parseAnnotation({
|
|
72
79
|
...found,
|
|
73
80
|
replies: [...found.replies, action.reply],
|
|
74
81
|
updatedAt: action.now
|
|
@@ -132,10 +139,10 @@ function createMemoryStore(now = () => (/* @__PURE__ */ new Date()).toISOString(
|
|
|
132
139
|
return {
|
|
133
140
|
async load(documentId) {
|
|
134
141
|
const raw = layers.get(documentId);
|
|
135
|
-
return raw ?
|
|
142
|
+
return raw ? chunkSSOPIPEX_cjs.parseLayer(JSON.parse(raw)) : chunkSSOPIPEX_cjs.emptyLayer(documentId, now());
|
|
136
143
|
},
|
|
137
144
|
async save(layer) {
|
|
138
|
-
layers.set(layer.documentId, JSON.stringify(
|
|
145
|
+
layers.set(layer.documentId, JSON.stringify(chunkSSOPIPEX_cjs.parseLayer(layer)));
|
|
139
146
|
}
|
|
140
147
|
};
|
|
141
148
|
}
|
|
@@ -145,14 +152,14 @@ function createLocalStorageStore(storage = safeLocalStorage(), now = () => (/* @
|
|
|
145
152
|
async load(documentId) {
|
|
146
153
|
try {
|
|
147
154
|
const raw = storage?.getItem(STORAGE_PREFIX + documentId);
|
|
148
|
-
if (raw) return
|
|
155
|
+
if (raw) return chunkSSOPIPEX_cjs.parseLayer(JSON.parse(raw));
|
|
149
156
|
} catch {
|
|
150
157
|
}
|
|
151
|
-
return
|
|
158
|
+
return chunkSSOPIPEX_cjs.emptyLayer(documentId, now());
|
|
152
159
|
},
|
|
153
160
|
async save(layer) {
|
|
154
161
|
if (!storage) throw new Error("storage is not available");
|
|
155
|
-
storage.setItem(STORAGE_PREFIX + layer.documentId, JSON.stringify(
|
|
162
|
+
storage.setItem(STORAGE_PREFIX + layer.documentId, JSON.stringify(chunkSSOPIPEX_cjs.parseLayer(layer)));
|
|
156
163
|
}
|
|
157
164
|
};
|
|
158
165
|
}
|
|
@@ -164,6 +171,35 @@ function safeLocalStorage() {
|
|
|
164
171
|
}
|
|
165
172
|
}
|
|
166
173
|
|
|
174
|
+
// src/annotations/redaction-log.ts
|
|
175
|
+
var REDACTION_LOG_COLUMNS = ["page", "reason", "status", "approved_by", "time"];
|
|
176
|
+
var STATUS = {
|
|
177
|
+
approved: "redacted (approved)",
|
|
178
|
+
pending: "redacted (not reviewed)",
|
|
179
|
+
rejected: "not redacted (rejected)"
|
|
180
|
+
};
|
|
181
|
+
var top = (a) => Math.min(...a.rects.map((r) => r.y));
|
|
182
|
+
var left = (a) => Math.min(...a.rects.map((r) => r.x));
|
|
183
|
+
function redactionLogRows(layer) {
|
|
184
|
+
return layer.annotations.filter((a) => a.kind === "redaction").sort((a, b) => a.page - b.page || top(a) - top(b) || left(a) - left(b)).map((a) => ({
|
|
185
|
+
page: a.page,
|
|
186
|
+
reason: a.reason,
|
|
187
|
+
status: STATUS[a.status],
|
|
188
|
+
approvedBy: a.status === "approved" ? a.reviewedBy ?? "" : "",
|
|
189
|
+
time: a.reviewedAt ?? a.createdAt
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
var cell = (value) => {
|
|
193
|
+
const text = String(value);
|
|
194
|
+
return `"${(/^[=+\-@]/.test(text) ? `'${text}` : text).replace(/"/g, '""')}"`;
|
|
195
|
+
};
|
|
196
|
+
function redactionLogCsv(layer) {
|
|
197
|
+
const rows = redactionLogRows(layer).map(
|
|
198
|
+
(r) => [r.page, r.reason, r.status, r.approvedBy, r.time].map(cell).join(",")
|
|
199
|
+
);
|
|
200
|
+
return [REDACTION_LOG_COLUMNS.join(","), ...rows].join("\r\n") + "\r\n";
|
|
201
|
+
}
|
|
202
|
+
|
|
167
203
|
// src/annotations/geometry.ts
|
|
168
204
|
var MIN_MARK_FRACTION = 4e-3;
|
|
169
205
|
function toNorm(r, page) {
|
|
@@ -176,7 +212,7 @@ function toNorm(r, page) {
|
|
|
176
212
|
const cy1 = Math.min(Math.max(y1, 0), page.height);
|
|
177
213
|
const cx2 = Math.min(Math.max(x2, 0), page.width);
|
|
178
214
|
const cy2 = Math.min(Math.max(y2, 0), page.height);
|
|
179
|
-
return
|
|
215
|
+
return chunkSSOPIPEX_cjs.clampRect({
|
|
180
216
|
x: cx1 / page.width,
|
|
181
217
|
y: cy1 / page.height,
|
|
182
218
|
w: (cx2 - cx1) / page.width,
|
|
@@ -223,9 +259,9 @@ function mergeLineRects(input, gap = 2) {
|
|
|
223
259
|
for (const r of line.slice(1)) {
|
|
224
260
|
if (r.x <= cur.x + cur.width + gap) {
|
|
225
261
|
const right = Math.max(cur.x + cur.width, r.x + r.width);
|
|
226
|
-
const
|
|
262
|
+
const top2 = Math.min(cur.y, r.y);
|
|
227
263
|
const bottom = Math.max(cur.y + cur.height, r.y + r.height);
|
|
228
|
-
cur = { x: cur.x, y:
|
|
264
|
+
cur = { x: cur.x, y: top2, width: right - cur.x, height: bottom - top2 };
|
|
229
265
|
} else {
|
|
230
266
|
out.push(cur);
|
|
231
267
|
cur = { ...r };
|
|
@@ -267,7 +303,7 @@ function useAnnotationLayer({
|
|
|
267
303
|
makeId = defaultId
|
|
268
304
|
}) {
|
|
269
305
|
const [history, setHistory] = react.useState(
|
|
270
|
-
() => createHistory(
|
|
306
|
+
() => createHistory(chunkSSOPIPEX_cjs.emptyLayer(documentId, now()))
|
|
271
307
|
);
|
|
272
308
|
const [savedLayer, setSavedLayer] = react.useState(null);
|
|
273
309
|
const [status, setStatus] = react.useState("loading");
|
|
@@ -298,7 +334,7 @@ function useAnnotationLayer({
|
|
|
298
334
|
setSelectedId(null);
|
|
299
335
|
setSavedLayer(null);
|
|
300
336
|
savedRef.current = null;
|
|
301
|
-
commit(createHistory(
|
|
337
|
+
commit(createHistory(chunkSSOPIPEX_cjs.emptyLayer(documentId, nowRef.current())));
|
|
302
338
|
storeRef.current.load(documentId).then((layer) => {
|
|
303
339
|
if (cancelled) return;
|
|
304
340
|
savedRef.current = layer;
|
|
@@ -404,7 +440,13 @@ function useAnnotationLayer({
|
|
|
404
440
|
},
|
|
405
441
|
update: (id, patch) => void dispatch({ type: "update", id, patch, now: nowRef.current() }),
|
|
406
442
|
remove: (id) => void dispatch({ type: "remove", id, now: nowRef.current() }),
|
|
407
|
-
setRedactionStatus: (ids, next) => void dispatch({
|
|
443
|
+
setRedactionStatus: (ids, next) => void dispatch({
|
|
444
|
+
type: "setRedactionStatus",
|
|
445
|
+
ids,
|
|
446
|
+
status: next,
|
|
447
|
+
now: nowRef.current(),
|
|
448
|
+
by: author
|
|
449
|
+
}),
|
|
408
450
|
reply: (id, body) => {
|
|
409
451
|
const t = nowRef.current();
|
|
410
452
|
void dispatch({
|
|
@@ -613,19 +655,19 @@ function dragRect(origin, mode, dx, dy) {
|
|
|
613
655
|
y: Math.min(Math.max(origin.y + dy, 0), 1 - origin.h)
|
|
614
656
|
};
|
|
615
657
|
}
|
|
616
|
-
let
|
|
658
|
+
let left2 = origin.x;
|
|
617
659
|
let right = origin.x + origin.w;
|
|
618
|
-
let
|
|
660
|
+
let top2 = origin.y;
|
|
619
661
|
let bottom = origin.y + origin.h;
|
|
620
|
-
if (mode.includes("w"))
|
|
662
|
+
if (mode.includes("w")) left2 += dx;
|
|
621
663
|
else right += dx;
|
|
622
|
-
if (mode.includes("n"))
|
|
664
|
+
if (mode.includes("n")) top2 += dy;
|
|
623
665
|
else bottom += dy;
|
|
624
|
-
const x1 = Math.min(Math.max(Math.min(
|
|
625
|
-
const x2 = Math.min(Math.max(Math.max(
|
|
626
|
-
const y1 = Math.min(Math.max(Math.min(
|
|
627
|
-
const y2 = Math.min(Math.max(Math.max(
|
|
628
|
-
return
|
|
666
|
+
const x1 = Math.min(Math.max(Math.min(left2, right), 0), 1);
|
|
667
|
+
const x2 = Math.min(Math.max(Math.max(left2, right), 0), 1);
|
|
668
|
+
const y1 = Math.min(Math.max(Math.min(top2, bottom), 0), 1);
|
|
669
|
+
const y2 = Math.min(Math.max(Math.max(top2, bottom), 0), 1);
|
|
670
|
+
return chunkSSOPIPEX_cjs.clampRect({
|
|
629
671
|
x: x1,
|
|
630
672
|
y: y1,
|
|
631
673
|
w: Math.max(x2 - x1, MIN_MARK),
|
|
@@ -731,7 +773,7 @@ function AnnotationPageOverlay({
|
|
|
731
773
|
status: "pending"
|
|
732
774
|
});
|
|
733
775
|
} else if (tool === "stamp") {
|
|
734
|
-
const placed = isTooSmall(rect) ?
|
|
776
|
+
const placed = isTooSmall(rect) ? chunkSSOPIPEX_cjs.clampRect({
|
|
735
777
|
x: a.x / page.width - DEFAULT_STAMP.w / 2,
|
|
736
778
|
y: a.y / page.height - DEFAULT_STAMP.h / 2,
|
|
737
779
|
...DEFAULT_STAMP
|
|
@@ -744,7 +786,7 @@ function AnnotationPageOverlay({
|
|
|
744
786
|
color: settings.colors.stamp
|
|
745
787
|
});
|
|
746
788
|
} else if (tool === "comment") {
|
|
747
|
-
const anchor =
|
|
789
|
+
const anchor = chunkSSOPIPEX_cjs.clampRect({
|
|
748
790
|
x: a.x / page.width,
|
|
749
791
|
y: a.y / page.height,
|
|
750
792
|
w: COMMENT_ICON_PX / page.width,
|
|
@@ -1562,22 +1604,24 @@ function FreezeDialog({
|
|
|
1562
1604
|
const [mode, setMode] = react.useState("vector");
|
|
1563
1605
|
const [comments, setComments] = react.useState("omit");
|
|
1564
1606
|
const [burnPending, setBurnPending] = react.useState(false);
|
|
1607
|
+
const [redactionLog, setRedactionLog] = react.useState(true);
|
|
1565
1608
|
const marks = controller.layer.annotations;
|
|
1566
|
-
const redactions = marks.filter(
|
|
1609
|
+
const redactions = marks.filter(chunkSSOPIPEX_cjs.isEffectiveRedaction);
|
|
1567
1610
|
const pending = pendingRedactions(controller.layer);
|
|
1611
|
+
const hasRedactionMarks = marks.some((a) => a.kind === "redaction");
|
|
1568
1612
|
const forced = redactions.length > 0;
|
|
1569
1613
|
const effectiveMode = forced ? "image" : mode;
|
|
1570
1614
|
const blocked = pending.length > 0 && !burnPending;
|
|
1571
1615
|
const counts = Object.keys(KIND_LABELS).map(
|
|
1572
1616
|
(k) => [
|
|
1573
1617
|
k,
|
|
1574
|
-
marks.filter((a) => a.kind === k && (k !== "redaction" ||
|
|
1618
|
+
marks.filter((a) => a.kind === k && (k !== "redaction" || chunkSSOPIPEX_cjs.isEffectiveRedaction(a))).length
|
|
1575
1619
|
]
|
|
1576
1620
|
).filter(([, n]) => n > 0);
|
|
1577
1621
|
return /* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.Dialog, { open, onOpenChange: (next) => !busy && onOpenChange(next), children: /* @__PURE__ */ jsxRuntime.jsxs(chunkXDCRWZF2_cjs.DialogContent, { "data-testid": "freeze-dialog", children: [
|
|
1578
1622
|
/* @__PURE__ */ jsxRuntime.jsxs(chunkXDCRWZF2_cjs.DialogHeader, { children: [
|
|
1579
1623
|
/* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.DialogTitle, { children: "Freeze a copy" }),
|
|
1580
|
-
/* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.DialogDescription, { children: "
|
|
1624
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.DialogDescription, { children: "Saves a separate document with your annotations built in, next to the original. The original stays as it is." })
|
|
1581
1625
|
] }),
|
|
1582
1626
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": "freeze-summary", children: counts.length === 0 ? "No annotations yet." : counts.map(([k, n]) => `${n} ${KIND_LABELS[k]}`).join(", ") }),
|
|
1583
1627
|
/* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "space-y-2 text-sm", disabled: busy, children: [
|
|
@@ -1662,6 +1706,22 @@ function FreezeDialog({
|
|
|
1662
1706
|
]
|
|
1663
1707
|
}
|
|
1664
1708
|
),
|
|
1709
|
+
hasRedactionMarks && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-start gap-2 text-sm", children: [
|
|
1710
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1711
|
+
"input",
|
|
1712
|
+
{
|
|
1713
|
+
type: "checkbox",
|
|
1714
|
+
"data-testid": "freeze-redaction-log",
|
|
1715
|
+
checked: redactionLog,
|
|
1716
|
+
disabled: busy,
|
|
1717
|
+
onChange: (e) => setRedactionLog(e.target.checked)
|
|
1718
|
+
}
|
|
1719
|
+
),
|
|
1720
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1721
|
+
"Download a redaction log (CSV)",
|
|
1722
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: "Page, reason, status, who approved it and when. Never the redacted text." })
|
|
1723
|
+
] })
|
|
1724
|
+
] }),
|
|
1665
1725
|
busy && progress && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", role: "status", "data-testid": "freeze-progress", children: [
|
|
1666
1726
|
"Page ",
|
|
1667
1727
|
progress.done,
|
|
@@ -1690,7 +1750,8 @@ function FreezeDialog({
|
|
|
1690
1750
|
onClick: () => onConfirm({
|
|
1691
1751
|
mode: effectiveMode,
|
|
1692
1752
|
comments,
|
|
1693
|
-
pendingRedactions: burnPending ? "burn" : "error"
|
|
1753
|
+
pendingRedactions: burnPending ? "burn" : "error",
|
|
1754
|
+
redactionLog: hasRedactionMarks && redactionLog
|
|
1694
1755
|
}),
|
|
1695
1756
|
children: busy ? "Freezing\u2026" : "Freeze"
|
|
1696
1757
|
}
|
|
@@ -1698,38 +1759,373 @@ function FreezeDialog({
|
|
|
1698
1759
|
] })
|
|
1699
1760
|
] }) });
|
|
1700
1761
|
}
|
|
1762
|
+
var MAX_PREFIX = 24;
|
|
1763
|
+
function previewLabel(choices) {
|
|
1764
|
+
return `${choices.prefix}${String(choices.start).padStart(choices.digits, "0")}`;
|
|
1765
|
+
}
|
|
1766
|
+
function qrCornerFor(corner) {
|
|
1767
|
+
return corner.endsWith("left") ? "bottom-right" : "bottom-left";
|
|
1768
|
+
}
|
|
1769
|
+
function moveItem(items, from, to) {
|
|
1770
|
+
if (from === to || from < 0 || to < 0 || from >= items.length || to >= items.length)
|
|
1771
|
+
return [...items];
|
|
1772
|
+
const next = [...items];
|
|
1773
|
+
const [moved] = next.splice(from, 1);
|
|
1774
|
+
next.splice(to, 0, moved);
|
|
1775
|
+
return next;
|
|
1776
|
+
}
|
|
1777
|
+
function ProductionDialog({
|
|
1778
|
+
open,
|
|
1779
|
+
onOpenChange,
|
|
1780
|
+
documents,
|
|
1781
|
+
leftOut = [],
|
|
1782
|
+
onConfirm,
|
|
1783
|
+
busy,
|
|
1784
|
+
progress,
|
|
1785
|
+
error
|
|
1786
|
+
}) {
|
|
1787
|
+
const [layout, setLayout] = react.useState("merged");
|
|
1788
|
+
const [prefix, setPrefix] = react.useState("");
|
|
1789
|
+
const [start, setStart] = react.useState(1);
|
|
1790
|
+
const [digits, setDigits] = react.useState(6);
|
|
1791
|
+
const [corner, setCorner] = react.useState("bottom-right");
|
|
1792
|
+
const [qr, setQr] = react.useState(false);
|
|
1793
|
+
const [indexPage, setIndexPage] = react.useState(false);
|
|
1794
|
+
const [saveToWorkspace, setSaveToWorkspace] = react.useState(true);
|
|
1795
|
+
const documentKey = documents.map((d) => d.id).join("|");
|
|
1796
|
+
const [ordered, setOrdered] = react.useState(documents);
|
|
1797
|
+
react.useEffect(() => setOrdered(documents), [documentKey]);
|
|
1798
|
+
const listRef = react.useRef(null);
|
|
1799
|
+
const [dragFrom, setDragFrom] = react.useState(null);
|
|
1800
|
+
const focusAfterMove = react.useRef(null);
|
|
1801
|
+
react.useEffect(() => {
|
|
1802
|
+
const pending = focusAfterMove.current;
|
|
1803
|
+
focusAfterMove.current = null;
|
|
1804
|
+
if (!pending || !listRef.current) return;
|
|
1805
|
+
const button = (arrow) => listRef.current?.querySelector(
|
|
1806
|
+
`[data-testid="production-move-${arrow}-${pending.index}"]:not(:disabled)`
|
|
1807
|
+
);
|
|
1808
|
+
(button(pending.arrow) ?? button(pending.arrow === "up" ? "down" : "up"))?.focus();
|
|
1809
|
+
}, [ordered]);
|
|
1810
|
+
const move = (from, to, arrow) => {
|
|
1811
|
+
if (arrow) focusAfterMove.current = { index: to, arrow };
|
|
1812
|
+
setOrdered((items) => moveItem(items, from, to));
|
|
1813
|
+
};
|
|
1814
|
+
const onDrop = (to) => (e) => {
|
|
1815
|
+
e.preventDefault();
|
|
1816
|
+
if (dragFrom !== null) move(dragFrom, to);
|
|
1817
|
+
setDragFrom(null);
|
|
1818
|
+
};
|
|
1819
|
+
const valid = Number.isInteger(start) && start >= 0 && Number.isInteger(digits) && digits >= 1 && digits <= 12;
|
|
1820
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.Dialog, { open, onOpenChange: (next) => !busy && onOpenChange(next), children: /* @__PURE__ */ jsxRuntime.jsxs(chunkXDCRWZF2_cjs.DialogContent, { "data-testid": "production-dialog", className: "max-h-[90dvh] overflow-y-auto", children: [
|
|
1821
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkXDCRWZF2_cjs.DialogHeader, { children: [
|
|
1822
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.DialogTitle, { children: "Production set" }),
|
|
1823
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkXDCRWZF2_cjs.DialogDescription, { children: "Numbers every page with a Bates label, in the order shown. The originals are never changed; the result is downloaded and, if you choose, saved to the workspace." })
|
|
1824
|
+
] }),
|
|
1825
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", "data-testid": "production-summary", children: [
|
|
1826
|
+
documents.length,
|
|
1827
|
+
" document",
|
|
1828
|
+
documents.length === 1 ? "" : "s",
|
|
1829
|
+
", numbered in this order.",
|
|
1830
|
+
ordered.length > 1 ? " Drag a row or use its arrows to reorder." : ""
|
|
1831
|
+
] }),
|
|
1832
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1833
|
+
"ol",
|
|
1834
|
+
{
|
|
1835
|
+
ref: listRef,
|
|
1836
|
+
className: "max-h-48 space-y-1 overflow-y-auto text-sm",
|
|
1837
|
+
"data-testid": "production-order",
|
|
1838
|
+
"aria-label": "Numbering order",
|
|
1839
|
+
children: ordered.map((doc, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1840
|
+
"li",
|
|
1841
|
+
{
|
|
1842
|
+
draggable: !busy,
|
|
1843
|
+
onDragStart: () => setDragFrom(i),
|
|
1844
|
+
onDragOver: (e) => e.preventDefault(),
|
|
1845
|
+
onDrop: onDrop(i),
|
|
1846
|
+
onDragEnd: () => setDragFrom(null),
|
|
1847
|
+
className: `flex items-center gap-1 rounded-md border border-border px-2 py-1 ${dragFrom === i ? "opacity-50" : ""}`,
|
|
1848
|
+
"data-testid": `production-order-item-${i}`,
|
|
1849
|
+
"data-document-id": doc.id,
|
|
1850
|
+
children: [
|
|
1851
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1852
|
+
lucideReact.GripVertical,
|
|
1853
|
+
{
|
|
1854
|
+
className: "size-4 shrink-0 cursor-grab text-muted-foreground",
|
|
1855
|
+
"aria-hidden": true
|
|
1856
|
+
}
|
|
1857
|
+
),
|
|
1858
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "w-6 shrink-0 text-right tabular-nums text-muted-foreground", children: [
|
|
1859
|
+
i + 1,
|
|
1860
|
+
"."
|
|
1861
|
+
] }),
|
|
1862
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", title: doc.name, children: doc.name }),
|
|
1863
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1864
|
+
chunkXDCRWZF2_cjs.Button,
|
|
1865
|
+
{
|
|
1866
|
+
type: "button",
|
|
1867
|
+
variant: "ghost",
|
|
1868
|
+
size: "icon",
|
|
1869
|
+
className: "size-7 pointer-coarse:size-11",
|
|
1870
|
+
"aria-label": `Move ${doc.name} up`,
|
|
1871
|
+
"data-testid": `production-move-up-${i}`,
|
|
1872
|
+
disabled: busy || i === 0,
|
|
1873
|
+
onClick: () => move(i, i - 1, "up"),
|
|
1874
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "size-4" })
|
|
1875
|
+
}
|
|
1876
|
+
),
|
|
1877
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1878
|
+
chunkXDCRWZF2_cjs.Button,
|
|
1879
|
+
{
|
|
1880
|
+
type: "button",
|
|
1881
|
+
variant: "ghost",
|
|
1882
|
+
size: "icon",
|
|
1883
|
+
className: "size-7 pointer-coarse:size-11",
|
|
1884
|
+
"aria-label": `Move ${doc.name} down`,
|
|
1885
|
+
"data-testid": `production-move-down-${i}`,
|
|
1886
|
+
disabled: busy || i === ordered.length - 1,
|
|
1887
|
+
onClick: () => move(i, i + 1, "down"),
|
|
1888
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" })
|
|
1889
|
+
}
|
|
1890
|
+
)
|
|
1891
|
+
]
|
|
1892
|
+
},
|
|
1893
|
+
doc.id
|
|
1894
|
+
))
|
|
1895
|
+
}
|
|
1896
|
+
),
|
|
1897
|
+
leftOut.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", "data-testid": "production-left-out", children: [
|
|
1898
|
+
"Left out, with no PDF version to number: ",
|
|
1899
|
+
leftOut.join(", ")
|
|
1900
|
+
] }),
|
|
1901
|
+
/* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "space-y-2 text-sm", disabled: busy, children: [
|
|
1902
|
+
/* @__PURE__ */ jsxRuntime.jsx("legend", { className: "mb-1 font-medium", children: "Files" }),
|
|
1903
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-start gap-2", children: [
|
|
1904
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1905
|
+
"input",
|
|
1906
|
+
{
|
|
1907
|
+
type: "radio",
|
|
1908
|
+
name: "production-layout",
|
|
1909
|
+
"data-testid": "production-layout-merged",
|
|
1910
|
+
checked: layout === "merged",
|
|
1911
|
+
onChange: () => setLayout("merged")
|
|
1912
|
+
}
|
|
1913
|
+
),
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1915
|
+
"One merged file",
|
|
1916
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: "All documents joined, numbered consecutively." })
|
|
1917
|
+
] })
|
|
1918
|
+
] }),
|
|
1919
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-start gap-2", children: [
|
|
1920
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1921
|
+
"input",
|
|
1922
|
+
{
|
|
1923
|
+
type: "radio",
|
|
1924
|
+
name: "production-layout",
|
|
1925
|
+
"data-testid": "production-layout-per-document",
|
|
1926
|
+
checked: layout === "per-document",
|
|
1927
|
+
onChange: () => setLayout("per-document")
|
|
1928
|
+
}
|
|
1929
|
+
),
|
|
1930
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1931
|
+
"One file per document",
|
|
1932
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: "Numbering carries on from one file to the next." })
|
|
1933
|
+
] })
|
|
1934
|
+
] })
|
|
1935
|
+
] }),
|
|
1936
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-2 text-sm", children: [
|
|
1937
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "space-y-1", children: [
|
|
1938
|
+
"Prefix",
|
|
1939
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1940
|
+
"input",
|
|
1941
|
+
{
|
|
1942
|
+
"data-testid": "production-prefix",
|
|
1943
|
+
className: "h-8 w-full rounded-md border border-input bg-background px-2",
|
|
1944
|
+
value: prefix,
|
|
1945
|
+
maxLength: MAX_PREFIX,
|
|
1946
|
+
disabled: busy,
|
|
1947
|
+
onChange: (e) => setPrefix(e.target.value)
|
|
1948
|
+
}
|
|
1949
|
+
)
|
|
1950
|
+
] }),
|
|
1951
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "space-y-1", children: [
|
|
1952
|
+
"Start at",
|
|
1953
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1954
|
+
"input",
|
|
1955
|
+
{
|
|
1956
|
+
"data-testid": "production-start",
|
|
1957
|
+
type: "number",
|
|
1958
|
+
min: 0,
|
|
1959
|
+
className: "h-8 w-full rounded-md border border-input bg-background px-2",
|
|
1960
|
+
value: start,
|
|
1961
|
+
disabled: busy,
|
|
1962
|
+
onChange: (e) => setStart(e.target.valueAsNumber)
|
|
1963
|
+
}
|
|
1964
|
+
)
|
|
1965
|
+
] }),
|
|
1966
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "space-y-1", children: [
|
|
1967
|
+
"Digits",
|
|
1968
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1969
|
+
"input",
|
|
1970
|
+
{
|
|
1971
|
+
"data-testid": "production-digits",
|
|
1972
|
+
type: "number",
|
|
1973
|
+
min: 1,
|
|
1974
|
+
max: 12,
|
|
1975
|
+
className: "h-8 w-full rounded-md border border-input bg-background px-2",
|
|
1976
|
+
value: digits,
|
|
1977
|
+
disabled: busy,
|
|
1978
|
+
onChange: (e) => setDigits(e.target.valueAsNumber)
|
|
1979
|
+
}
|
|
1980
|
+
)
|
|
1981
|
+
] })
|
|
1982
|
+
] }),
|
|
1983
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
1984
|
+
"Label position",
|
|
1985
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1986
|
+
"select",
|
|
1987
|
+
{
|
|
1988
|
+
"data-testid": "production-corner",
|
|
1989
|
+
className: "h-8 rounded-md border border-input bg-background px-2",
|
|
1990
|
+
value: corner,
|
|
1991
|
+
disabled: busy,
|
|
1992
|
+
onChange: (e) => setCorner(e.target.value),
|
|
1993
|
+
children: [
|
|
1994
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "bottom-right", children: "Bottom right" }),
|
|
1995
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "bottom-left", children: "Bottom left" }),
|
|
1996
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "top-right", children: "Top right" }),
|
|
1997
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "top-left", children: "Top left" })
|
|
1998
|
+
]
|
|
1999
|
+
}
|
|
2000
|
+
)
|
|
2001
|
+
] }),
|
|
2002
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-start gap-2 text-sm", children: [
|
|
2003
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2004
|
+
"input",
|
|
2005
|
+
{
|
|
2006
|
+
type: "checkbox",
|
|
2007
|
+
"data-testid": "production-qr",
|
|
2008
|
+
checked: qr,
|
|
2009
|
+
disabled: busy,
|
|
2010
|
+
onChange: (e) => setQr(e.target.checked)
|
|
2011
|
+
}
|
|
2012
|
+
),
|
|
2013
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2014
|
+
"QR code on every page",
|
|
2015
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: "Opens the document in ARBI for anyone with access." })
|
|
2016
|
+
] })
|
|
2017
|
+
] }),
|
|
2018
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-start gap-2 text-sm", children: [
|
|
2019
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2020
|
+
"input",
|
|
2021
|
+
{
|
|
2022
|
+
type: "checkbox",
|
|
2023
|
+
"data-testid": "production-index",
|
|
2024
|
+
checked: indexPage,
|
|
2025
|
+
disabled: busy,
|
|
2026
|
+
onChange: (e) => setIndexPage(e.target.checked)
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2030
|
+
"Index page at the start",
|
|
2031
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: "Lists every document with its Bates range. The index itself is not numbered." })
|
|
2032
|
+
] })
|
|
2033
|
+
] }),
|
|
2034
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-start gap-2 text-sm", children: [
|
|
2035
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2036
|
+
"input",
|
|
2037
|
+
{
|
|
2038
|
+
type: "checkbox",
|
|
2039
|
+
"data-testid": "production-save",
|
|
2040
|
+
checked: saveToWorkspace,
|
|
2041
|
+
disabled: busy,
|
|
2042
|
+
onChange: (e) => setSaveToWorkspace(e.target.checked)
|
|
2043
|
+
}
|
|
2044
|
+
),
|
|
2045
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2046
|
+
"Save to workspace",
|
|
2047
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: layout === "merged" ? "Adds the merged PDF to the Productions folder, so it can be shared or emailed." : "Adds each numbered file to a folder under Productions, so they can be shared or emailed." })
|
|
2048
|
+
] })
|
|
2049
|
+
] }),
|
|
2050
|
+
valid && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", "data-testid": "production-preview", children: [
|
|
2051
|
+
"First label:",
|
|
2052
|
+
" ",
|
|
2053
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: previewLabel({ prefix, start, digits }) })
|
|
2054
|
+
] }),
|
|
2055
|
+
busy && progress && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", role: "status", "data-testid": "production-progress", children: [
|
|
2056
|
+
"Document ",
|
|
2057
|
+
progress.done,
|
|
2058
|
+
" of ",
|
|
2059
|
+
progress.total,
|
|
2060
|
+
"\u2026"
|
|
2061
|
+
] }),
|
|
2062
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", role: "alert", "data-testid": "production-error", children: error }),
|
|
2063
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkXDCRWZF2_cjs.DialogFooter, { children: [
|
|
2064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2065
|
+
chunkXDCRWZF2_cjs.Button,
|
|
2066
|
+
{
|
|
2067
|
+
type: "button",
|
|
2068
|
+
variant: "outline",
|
|
2069
|
+
disabled: busy,
|
|
2070
|
+
onClick: () => onOpenChange(false),
|
|
2071
|
+
children: "Cancel"
|
|
2072
|
+
}
|
|
2073
|
+
),
|
|
2074
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2075
|
+
chunkXDCRWZF2_cjs.Button,
|
|
2076
|
+
{
|
|
2077
|
+
type: "button",
|
|
2078
|
+
"data-testid": "production-confirm",
|
|
2079
|
+
disabled: busy || !valid || ordered.length === 0,
|
|
2080
|
+
onClick: () => onConfirm({
|
|
2081
|
+
layout,
|
|
2082
|
+
prefix,
|
|
2083
|
+
start,
|
|
2084
|
+
digits,
|
|
2085
|
+
corner,
|
|
2086
|
+
qr,
|
|
2087
|
+
indexPage,
|
|
2088
|
+
saveToWorkspace,
|
|
2089
|
+
order: ordered.map((d) => d.id)
|
|
2090
|
+
}),
|
|
2091
|
+
children: busy ? "Working\u2026" : "Create production"
|
|
2092
|
+
}
|
|
2093
|
+
)
|
|
2094
|
+
] })
|
|
2095
|
+
] }) });
|
|
2096
|
+
}
|
|
1701
2097
|
|
|
1702
2098
|
Object.defineProperty(exports, "AnnotationLayerError", {
|
|
1703
2099
|
enumerable: true,
|
|
1704
|
-
get: function () { return
|
|
2100
|
+
get: function () { return chunkSSOPIPEX_cjs.AnnotationLayerError; }
|
|
1705
2101
|
});
|
|
1706
2102
|
Object.defineProperty(exports, "LAYER_SCHEMA_VERSION", {
|
|
1707
2103
|
enumerable: true,
|
|
1708
|
-
get: function () { return
|
|
2104
|
+
get: function () { return chunkSSOPIPEX_cjs.LAYER_SCHEMA_VERSION; }
|
|
1709
2105
|
});
|
|
1710
2106
|
Object.defineProperty(exports, "annotationRects", {
|
|
1711
2107
|
enumerable: true,
|
|
1712
|
-
get: function () { return
|
|
2108
|
+
get: function () { return chunkSSOPIPEX_cjs.annotationRects; }
|
|
1713
2109
|
});
|
|
1714
2110
|
Object.defineProperty(exports, "clampRect", {
|
|
1715
2111
|
enumerable: true,
|
|
1716
|
-
get: function () { return
|
|
2112
|
+
get: function () { return chunkSSOPIPEX_cjs.clampRect; }
|
|
1717
2113
|
});
|
|
1718
2114
|
Object.defineProperty(exports, "emptyLayer", {
|
|
1719
2115
|
enumerable: true,
|
|
1720
|
-
get: function () { return
|
|
2116
|
+
get: function () { return chunkSSOPIPEX_cjs.emptyLayer; }
|
|
1721
2117
|
});
|
|
1722
2118
|
Object.defineProperty(exports, "isEffectiveRedaction", {
|
|
1723
2119
|
enumerable: true,
|
|
1724
|
-
get: function () { return
|
|
2120
|
+
get: function () { return chunkSSOPIPEX_cjs.isEffectiveRedaction; }
|
|
1725
2121
|
});
|
|
1726
2122
|
Object.defineProperty(exports, "parseAnnotation", {
|
|
1727
2123
|
enumerable: true,
|
|
1728
|
-
get: function () { return
|
|
2124
|
+
get: function () { return chunkSSOPIPEX_cjs.parseAnnotation; }
|
|
1729
2125
|
});
|
|
1730
2126
|
Object.defineProperty(exports, "parseLayer", {
|
|
1731
2127
|
enumerable: true,
|
|
1732
|
-
get: function () { return
|
|
2128
|
+
get: function () { return chunkSSOPIPEX_cjs.parseLayer; }
|
|
1733
2129
|
});
|
|
1734
2130
|
exports.AnnotationPageOverlay = AnnotationPageOverlay;
|
|
1735
2131
|
exports.AnnotationToolbar = AnnotationToolbar;
|
|
@@ -1737,6 +2133,8 @@ exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
|
|
1737
2133
|
exports.FreezeDialog = FreezeDialog;
|
|
1738
2134
|
exports.HIGHLIGHT_COLORS = HIGHLIGHT_COLORS;
|
|
1739
2135
|
exports.MARK_COLORS = MARK_COLORS;
|
|
2136
|
+
exports.ProductionDialog = ProductionDialog;
|
|
2137
|
+
exports.REDACTION_LOG_COLUMNS = REDACTION_LOG_COLUMNS;
|
|
1740
2138
|
exports.REDACTION_REASONS = REDACTION_REASONS;
|
|
1741
2139
|
exports.STAMP_PRESETS = STAMP_PRESETS;
|
|
1742
2140
|
exports.annotationsOnPage = annotationsOnPage;
|
|
@@ -1752,9 +2150,13 @@ exports.dragToNorm = dragToNorm;
|
|
|
1752
2150
|
exports.intersects = intersects;
|
|
1753
2151
|
exports.isTooSmall = isTooSmall;
|
|
1754
2152
|
exports.mergeLineRects = mergeLineRects;
|
|
2153
|
+
exports.moveItem = moveItem;
|
|
1755
2154
|
exports.patchForRect = patchForRect;
|
|
1756
2155
|
exports.pendingRedactions = pendingRedactions;
|
|
2156
|
+
exports.qrCornerFor = qrCornerFor;
|
|
1757
2157
|
exports.readSelection = readSelection;
|
|
2158
|
+
exports.redactionLogCsv = redactionLogCsv;
|
|
2159
|
+
exports.redactionLogRows = redactionLogRows;
|
|
1758
2160
|
exports.redo = redo;
|
|
1759
2161
|
exports.reduceLayer = reduceLayer;
|
|
1760
2162
|
exports.selectionToPageMarks = selectionToPageMarks;
|