@thehammer/template-verification 0.2.17 → 0.2.19
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/components/VerifiedField.vue.d.ts +14 -5
- package/dist/constants.d.ts +25 -0
- package/dist/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/template-verification.js +224 -223
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as M, watch as z, defineComponent as Y, computed as i, openBlock as u, createElementBlock as v, normalizeClass as w, createElementVNode as p, toDisplayString as k, createCommentVNode as S, createBlock as B, unref as d, Fragment as F, renderSlot as oe, createVNode as L, withModifiers as W, withDirectives as se, isRef as ue, vModelCheckbox as ce } from "vue";
|
|
2
2
|
import { DanxSkeleton as de, useToast as fe, DanxIcon as ve, gearIcon as pe, DanxBadge as ge, DanxProgressBar as me, DanxToastContainer as be } from "@thehammer/danx-ui";
|
|
3
3
|
import { CodeViewer as he } from "@thehammer/danx-ui/components/code-viewer";
|
|
4
|
-
const
|
|
5
|
-
let
|
|
4
|
+
const R = "tv-chrome", we = "tv-editable", Z = "template-verification:enabled";
|
|
5
|
+
let N = null;
|
|
6
6
|
function ye(e) {
|
|
7
7
|
var t;
|
|
8
8
|
try {
|
|
@@ -11,22 +11,22 @@ function ye(e) {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
var
|
|
14
|
+
function xe(e, t) {
|
|
15
|
+
var n;
|
|
16
16
|
try {
|
|
17
|
-
(
|
|
17
|
+
(n = globalThis.localStorage) == null || n.setItem(e, t);
|
|
18
18
|
} catch {
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const t = ye(
|
|
21
|
+
function _e(e) {
|
|
22
|
+
const t = ye(Z);
|
|
23
23
|
return t === null ? e : t === "true";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const t =
|
|
25
|
+
function ee(e) {
|
|
26
|
+
const t = M(_e((e == null ? void 0 : e.defaultEnabled) ?? !1));
|
|
27
27
|
return z(
|
|
28
28
|
t,
|
|
29
|
-
(
|
|
29
|
+
(n) => xe(Z, n ? "true" : "false")
|
|
30
30
|
), {
|
|
31
31
|
enabled: t,
|
|
32
32
|
data: (e == null ? void 0 : e.data) ?? {},
|
|
@@ -34,14 +34,14 @@ function Z(e) {
|
|
|
34
34
|
loading: (e == null ? void 0 : e.loading) ?? !1
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function ke() {
|
|
38
|
+
return N || (N = ee()), N;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
40
|
+
function rt(e) {
|
|
41
|
+
N = ee(e);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const e =
|
|
43
|
+
function te() {
|
|
44
|
+
const e = ke();
|
|
45
45
|
return {
|
|
46
46
|
enabled: e.enabled,
|
|
47
47
|
data: e.data,
|
|
@@ -49,10 +49,10 @@ function ee() {
|
|
|
49
49
|
loading: e.loading
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ne(e) {
|
|
53
53
|
return typeof e != "number" || Number.isNaN(e) ? "unverifiable" : e <= 2 ? "low" : e === 3 ? "medium" : "high";
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const Se = {
|
|
56
56
|
high: "bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20",
|
|
57
57
|
medium: "bg-yellow-50 text-yellow-700 ring-1 ring-inset ring-yellow-600/20",
|
|
58
58
|
low: "bg-red-50 text-red-700 ring-1 ring-inset ring-red-600/20",
|
|
@@ -60,66 +60,66 @@ const ke = {
|
|
|
60
60
|
// Same red family as 'low' (color-family-per-status is load-bearing, see docblock
|
|
61
61
|
// above) but a visibly darker/more saturated shade so the two stay distinguishable.
|
|
62
62
|
failed: "bg-red-100 text-red-800 ring-1 ring-inset ring-red-700/30"
|
|
63
|
-
},
|
|
63
|
+
}, P = {
|
|
64
64
|
high: "High",
|
|
65
65
|
medium: "Medium",
|
|
66
66
|
low: "Low",
|
|
67
67
|
unverifiable: "Unverifiable",
|
|
68
68
|
failed: "Failed"
|
|
69
|
-
},
|
|
70
|
-
function Se(e) {
|
|
71
|
-
return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : Ie(e.candidates) : { value: null, source: "none" };
|
|
72
|
-
}
|
|
69
|
+
}, re = ["override", "extracted", "claim"];
|
|
73
70
|
function Ie(e) {
|
|
71
|
+
return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : Ce(e.candidates) : { value: null, source: "none" };
|
|
72
|
+
}
|
|
73
|
+
function Ce(e) {
|
|
74
74
|
if (e)
|
|
75
|
-
for (const t of
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
return { value:
|
|
75
|
+
for (const t of re) {
|
|
76
|
+
const n = e[t];
|
|
77
|
+
if (n != null)
|
|
78
|
+
return { value: n.value, source: t };
|
|
79
79
|
}
|
|
80
80
|
return { value: null, source: "none" };
|
|
81
81
|
}
|
|
82
82
|
function $e(e) {
|
|
83
|
-
return e ? typeof e.discrepancy == "boolean" ? e.discrepancy :
|
|
83
|
+
return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : Ae(e.candidates) : !1;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Ae(e) {
|
|
86
86
|
if (!e) return !1;
|
|
87
|
-
const t =
|
|
87
|
+
const t = re.map((n) => e[n]).filter((n) => n != null).map((n) => Ee(n.value));
|
|
88
88
|
return t.length < 2 ? !1 : new Set(t).size > 1;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Ee(e) {
|
|
91
91
|
return JSON.stringify(e ?? null);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Te(e) {
|
|
94
94
|
return !!(e != null && e.source_discrepancy);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Re(e) {
|
|
97
97
|
return !!(e != null && e.correction);
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
function
|
|
99
|
+
const Oe = "danxbot-template", Ve = 1, De = "data-point-activated";
|
|
100
|
+
function Le() {
|
|
101
101
|
if (typeof window > "u") return null;
|
|
102
102
|
const e = window.location.ancestorOrigins, t = e && e.length > 0 ? e[0] : null;
|
|
103
103
|
if (t && t !== "null") return t;
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
104
|
+
const n = typeof document > "u" ? "" : document.referrer;
|
|
105
|
+
if (!n) return null;
|
|
106
106
|
try {
|
|
107
|
-
const
|
|
108
|
-
return
|
|
107
|
+
const f = new URL(n).origin;
|
|
108
|
+
return f === "null" ? null : f;
|
|
109
109
|
} catch {
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Ne(e) {
|
|
114
114
|
if (typeof window > "u") return !1;
|
|
115
115
|
const t = window.parent;
|
|
116
116
|
if (!t || t === window) return !1;
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
119
|
-
const
|
|
120
|
-
source:
|
|
121
|
-
version:
|
|
122
|
-
type:
|
|
117
|
+
const n = Le();
|
|
118
|
+
if (!n) return !1;
|
|
119
|
+
const f = {
|
|
120
|
+
source: Oe,
|
|
121
|
+
version: Ve,
|
|
122
|
+
type: De,
|
|
123
123
|
anchor: {
|
|
124
124
|
object_ids: [...e.anchor.object_ids],
|
|
125
125
|
field: e.anchor.field,
|
|
@@ -129,72 +129,72 @@ function Le(e) {
|
|
|
129
129
|
label: e.label ?? null,
|
|
130
130
|
value: e.value ?? null
|
|
131
131
|
};
|
|
132
|
-
return t.postMessage(
|
|
132
|
+
return t.postMessage(f, n), !0;
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
return U(e, t,
|
|
134
|
+
const Pe = /* @__PURE__ */ new Set(["name", "type"]);
|
|
135
|
+
function ae(e, t = "") {
|
|
136
|
+
const n = [];
|
|
137
|
+
return U(e, t, n), n;
|
|
138
138
|
}
|
|
139
|
-
function U(e, t,
|
|
139
|
+
function U(e, t, n) {
|
|
140
140
|
if (Array.isArray(e)) {
|
|
141
|
-
e.forEach((
|
|
141
|
+
e.forEach((r, c) => U(r, `${t}[${c}]`, n));
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
if (!
|
|
144
|
+
if (!X(e)) return;
|
|
145
145
|
const m = e.__meta ?? {};
|
|
146
|
-
for (const [
|
|
147
|
-
if (
|
|
148
|
-
const h = t ? `${t}.${
|
|
149
|
-
if (Array.isArray(c) ||
|
|
150
|
-
U(c, h,
|
|
146
|
+
for (const [r, c] of Object.entries(e)) {
|
|
147
|
+
if (r === "__meta") continue;
|
|
148
|
+
const h = t ? `${t}.${r}` : r;
|
|
149
|
+
if (Array.isArray(c) || X(c)) {
|
|
150
|
+
U(c, h, n);
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
|
-
const g = m[
|
|
154
|
-
!g &&
|
|
153
|
+
const g = m[r];
|
|
154
|
+
!g && Pe.has(r) || n.push({
|
|
155
155
|
path: h,
|
|
156
|
-
label:
|
|
156
|
+
label: r,
|
|
157
157
|
meta: g ?? null,
|
|
158
158
|
value: c,
|
|
159
159
|
unanchored: !g
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function X(e) {
|
|
164
164
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
var
|
|
166
|
+
function le(e) {
|
|
167
|
+
var n;
|
|
168
168
|
if (e.candidates.override) return !1;
|
|
169
|
-
const t = (
|
|
169
|
+
const t = (n = e.candidates.extracted) == null ? void 0 : n.confidence;
|
|
170
170
|
return e.discrepancy || t == null || t <= 2;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
const t =
|
|
174
|
-
(
|
|
175
|
-
),
|
|
176
|
-
let
|
|
177
|
-
for (const
|
|
178
|
-
if (
|
|
179
|
-
|
|
172
|
+
function Me(e) {
|
|
173
|
+
const t = ae(e).filter(
|
|
174
|
+
(r) => r.meta !== null
|
|
175
|
+
), n = t.length;
|
|
176
|
+
let f = 0, m = 0;
|
|
177
|
+
for (const r of t) {
|
|
178
|
+
if (r.meta.candidates.override) {
|
|
179
|
+
f++;
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
le(r.meta) && m++;
|
|
183
183
|
}
|
|
184
184
|
return {
|
|
185
|
-
total:
|
|
186
|
-
verified:
|
|
185
|
+
total: n,
|
|
186
|
+
verified: f,
|
|
187
187
|
needsReview: m,
|
|
188
|
-
percent:
|
|
188
|
+
percent: n === 0 ? 100 : Math.round(f / n * 100)
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const je = ["data-status", "title"], Be = {
|
|
192
192
|
class: "tv-confidence-glyph",
|
|
193
193
|
"aria-hidden": "true"
|
|
194
|
-
},
|
|
194
|
+
}, Fe = {
|
|
195
195
|
key: 0,
|
|
196
196
|
class: "tv-confidence-label"
|
|
197
|
-
},
|
|
197
|
+
}, Ue = /* @__PURE__ */ Y({
|
|
198
198
|
__name: "ConfidenceIcon",
|
|
199
199
|
props: {
|
|
200
200
|
confidence: {},
|
|
@@ -202,9 +202,9 @@ const Me = ["data-status", "title"], je = {
|
|
|
202
202
|
showLabel: { type: Boolean }
|
|
203
203
|
},
|
|
204
204
|
setup(e) {
|
|
205
|
-
const t = e,
|
|
206
|
-
() => t.status ??
|
|
207
|
-
),
|
|
205
|
+
const t = e, n = i(
|
|
206
|
+
() => t.status ?? ne(t.confidence)
|
|
207
|
+
), f = {
|
|
208
208
|
high: "✔",
|
|
209
209
|
// check
|
|
210
210
|
medium: "⚠",
|
|
@@ -214,36 +214,36 @@ const Me = ["data-status", "title"], je = {
|
|
|
214
214
|
unverifiable: "?",
|
|
215
215
|
failed: "⊗"
|
|
216
216
|
// circled x — distinct from low's plain x
|
|
217
|
-
}, m = i(() =>
|
|
217
|
+
}, m = i(() => f[n.value]), r = i(() => Se[n.value]), c = i(() => P[n.value]);
|
|
218
218
|
return (h, g) => (u(), v("span", {
|
|
219
|
-
class:
|
|
220
|
-
"data-status":
|
|
219
|
+
class: w(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", r.value]),
|
|
220
|
+
"data-status": n.value,
|
|
221
221
|
title: c.value
|
|
222
222
|
}, [
|
|
223
|
-
p("span",
|
|
224
|
-
e.showLabel ? (u(), v("span",
|
|
225
|
-
], 10,
|
|
223
|
+
p("span", Be, k(m.value), 1),
|
|
224
|
+
e.showLabel ? (u(), v("span", Fe, k(c.value), 1)) : S("", !0)
|
|
225
|
+
], 10, je));
|
|
226
226
|
}
|
|
227
|
-
}),
|
|
227
|
+
}), ze = {
|
|
228
228
|
key: 0,
|
|
229
229
|
class: "tv-mark-anchor"
|
|
230
|
-
},
|
|
230
|
+
}, Ye = ["aria-label", "title"], Ge = {
|
|
231
231
|
key: 1,
|
|
232
232
|
class: "tv-verified-chip tv-audit-chip inline-flex items-center gap-1 rounded-full bg-green-600 px-2 py-0.5 text-[11px] font-semibold leading-none text-white",
|
|
233
233
|
"data-status": "audited"
|
|
234
|
-
},
|
|
234
|
+
}, He = {
|
|
235
235
|
key: 2,
|
|
236
236
|
class: "tv-verified-chip inline-flex items-center gap-1 rounded-full bg-green-600 px-2 py-0.5 text-[11px] font-semibold leading-none text-white",
|
|
237
237
|
"data-status": "verified"
|
|
238
|
-
},
|
|
238
|
+
}, qe = {
|
|
239
239
|
key: 3,
|
|
240
240
|
class: "tv-verified-chip tv-verified-chip-empty inline-flex items-center gap-1 rounded-full border-2 border-dashed border-green-600 bg-transparent px-2 py-0.5 text-[11px] font-semibold leading-none text-green-600",
|
|
241
241
|
"data-status": "verified-empty"
|
|
242
|
-
},
|
|
242
|
+
}, Ke = {
|
|
243
243
|
key: 5,
|
|
244
244
|
class: "tv-correction-indicator ml-0.5 text-blue-500",
|
|
245
245
|
"aria-hidden": !0
|
|
246
|
-
},
|
|
246
|
+
}, at = /* @__PURE__ */ Y({
|
|
247
247
|
__name: "VerifiedField",
|
|
248
248
|
props: {
|
|
249
249
|
source: {},
|
|
@@ -252,74 +252,76 @@ const Me = ["data-status", "title"], je = {
|
|
|
252
252
|
format: { type: Function }
|
|
253
253
|
},
|
|
254
254
|
setup(e) {
|
|
255
|
-
const t = e,
|
|
256
|
-
var
|
|
257
|
-
return t.source && t.field ? ((
|
|
258
|
-
}), c = i(() =>
|
|
255
|
+
const t = e, n = te(), f = i(() => n.enabled.value), m = i(() => n.loading), r = i(() => {
|
|
256
|
+
var a;
|
|
257
|
+
return t.source && t.field ? ((a = t.source.__meta) == null ? void 0 : a[t.field]) ?? null : null;
|
|
258
|
+
}), c = i(() => Ie(r.value)), h = i(() => {
|
|
259
259
|
if (t.original !== void 0 && t.original !== null)
|
|
260
260
|
return t.original;
|
|
261
|
-
if (
|
|
261
|
+
if (r.value && c.value.value !== null && c.value.value !== void 0)
|
|
262
262
|
return c.value.value;
|
|
263
263
|
if (t.source && t.field) return t.source[t.field];
|
|
264
264
|
}), g = i(() => {
|
|
265
|
-
const
|
|
266
|
-
return
|
|
267
|
-
}), R = i(() => {
|
|
268
|
-
var l, o;
|
|
269
|
-
const n = (o = (l = a.value) == null ? void 0 : l.candidates) == null ? void 0 : o.extracted;
|
|
270
|
-
return (n == null ? void 0 : n.state) === "failed" ? "failed" : te(n == null ? void 0 : n.confidence);
|
|
271
|
-
}), b = i(() => $e(a.value)), s = i(() => Ee(a.value)), w = i(() => !b.value && Te(a.value)), x = i(() => {
|
|
272
|
-
var n, l;
|
|
273
|
-
return !!((l = (n = a.value) == null ? void 0 : n.candidates) != null && l.override);
|
|
265
|
+
const a = h.value;
|
|
266
|
+
return a == null ? "" : typeof t.format == "function" ? t.format(a) : String(a);
|
|
274
267
|
}), O = i(() => {
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
268
|
+
var l, o;
|
|
269
|
+
const a = (o = (l = r.value) == null ? void 0 : l.candidates) == null ? void 0 : o.extracted;
|
|
270
|
+
return (a == null ? void 0 : a.state) === "failed" ? "failed" : ne(a == null ? void 0 : a.confidence);
|
|
271
|
+
}), b = i(() => $e(r.value)), s = i(() => Te(r.value)), y = i(() => !b.value && Re(r.value)), x = i(() => {
|
|
272
|
+
var a, l;
|
|
273
|
+
return !!((l = (a = r.value) == null ? void 0 : a.candidates) != null && l.override);
|
|
280
274
|
}), V = i(() => {
|
|
281
|
-
var l;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
275
|
+
var a, l, o;
|
|
276
|
+
return ((o = (l = (a = r.value) == null ? void 0 : a.candidates) == null ? void 0 : l.extracted) == null ? void 0 : o.source) ?? null;
|
|
277
|
+
}), $ = i(() => !x.value && V.value === "audit"), I = i(() => {
|
|
278
|
+
var a, l, o;
|
|
279
|
+
return x.value ? ((o = (l = (a = r.value) == null ? void 0 : a.candidates) == null ? void 0 : l.override) == null ? void 0 : o.value) === null ? "confirmed-empty" : "confirmed" : "unverified";
|
|
280
|
+
}), A = i(() => f.value), D = i(() => {
|
|
281
|
+
const a = r.value;
|
|
282
|
+
return A.value && !!a && le(a);
|
|
283
|
+
}), T = i(() => {
|
|
284
|
+
var a;
|
|
285
|
+
return A.value && !!((a = r.value) != null && a.anchor);
|
|
290
286
|
}), G = i(() => {
|
|
291
|
-
var
|
|
292
|
-
const
|
|
287
|
+
var K, J, Q;
|
|
288
|
+
const a = t.field ?? "This value", l = T.value ? " — open in the review panel" : " — no place to record a correction";
|
|
293
289
|
if (I.value === "confirmed-empty")
|
|
294
|
-
return `${
|
|
295
|
-
if (x.value) return `${
|
|
296
|
-
const o = (
|
|
297
|
-
let
|
|
298
|
-
E === "failed" ?
|
|
299
|
-
const j = (o == null ? void 0 : o.sources_count) ?? ((
|
|
300
|
-
return j > 0 && _.push(`${j} cited ${j === 1 ? "page" : "pages"}`), b.value ? _.push(s.value ? "source document conflict" : "sources disagree") :
|
|
290
|
+
return `${a}: a person confirmed this field is genuinely blank${l}`;
|
|
291
|
+
if (x.value) return `${a}: verified by a person${l}`;
|
|
292
|
+
const o = (J = (K = r.value) == null ? void 0 : K.candidates) == null ? void 0 : J.extracted, E = O.value, _ = [];
|
|
293
|
+
let C;
|
|
294
|
+
E === "failed" ? C = P.failed : (o == null ? void 0 : o.confidence) != null ? C = `${P[E]} (${o.confidence}/5)` : C = P[E], _.push($.value ? `Verified by audit — ${C}` : C);
|
|
295
|
+
const j = (o == null ? void 0 : o.sources_count) ?? ((Q = o == null ? void 0 : o.sources) == null ? void 0 : Q.length) ?? 0;
|
|
296
|
+
return j > 0 && _.push(`${j} cited ${j === 1 ? "page" : "pages"}`), b.value ? _.push(s.value ? "source document conflict" : "sources disagree") : y.value && _.push("value corrected"), `${a}: ${_.join(", ")}${l}`;
|
|
301
297
|
});
|
|
302
|
-
function
|
|
298
|
+
function H() {
|
|
303
299
|
var l;
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
anchor:
|
|
307
|
-
workflowInputId:
|
|
300
|
+
const a = (l = r.value) == null ? void 0 : l.anchor;
|
|
301
|
+
a && Ne({
|
|
302
|
+
anchor: a,
|
|
303
|
+
workflowInputId: n.workflowInputId,
|
|
308
304
|
label: t.field ?? null,
|
|
309
305
|
value: g.value
|
|
310
306
|
});
|
|
311
307
|
}
|
|
312
|
-
|
|
308
|
+
function ie() {
|
|
309
|
+
var l;
|
|
310
|
+
if (!T.value) return;
|
|
311
|
+
const a = typeof window > "u" ? null : (l = window.getSelection) == null ? void 0 : l.call(window);
|
|
312
|
+
a && !a.isCollapsed || H();
|
|
313
|
+
}
|
|
314
|
+
const q = M(null);
|
|
313
315
|
return z(
|
|
314
|
-
|
|
315
|
-
(
|
|
316
|
-
if (!
|
|
316
|
+
q,
|
|
317
|
+
(a, l, o) => {
|
|
318
|
+
if (!a || typeof MutationObserver > "u") return;
|
|
317
319
|
const E = () => {
|
|
318
|
-
|
|
320
|
+
a.querySelectorAll(".dx-language-badge-container").forEach((C) => C.remove());
|
|
319
321
|
};
|
|
320
322
|
E();
|
|
321
323
|
const _ = new MutationObserver(E);
|
|
322
|
-
_.observe(
|
|
324
|
+
_.observe(a, { childList: !0, subtree: !0 }), o(() => _.disconnect());
|
|
323
325
|
},
|
|
324
326
|
// `flush: "sync"` — a template ref is populated by Vue's own patch process,
|
|
325
327
|
// and the DEFAULT ("pre") flush timing runs a watcher reacting to that
|
|
@@ -329,30 +331,28 @@ const Me = ["data-status", "title"], je = {
|
|
|
329
331
|
// conceivably a synchronous export/print path) must never observe the
|
|
330
332
|
// badge even for one tick, so this cannot wait for the async scheduler.
|
|
331
333
|
{ immediate: !0, flush: "sync" }
|
|
332
|
-
), (
|
|
333
|
-
class:
|
|
334
|
+
), (a, l) => (u(), v("span", {
|
|
335
|
+
class: w(["tv-field", D.value ? "tv-needs-review" : ""])
|
|
334
336
|
}, [
|
|
335
|
-
m.value ? (u(), B(
|
|
337
|
+
m.value ? (u(), B(d(de), {
|
|
336
338
|
key: 0,
|
|
337
339
|
shape: "rounded",
|
|
338
340
|
class: "tv-field-skeleton inline-block h-[1em] w-16 align-middle"
|
|
339
341
|
})) : (u(), v(F, { key: 1 }, [
|
|
340
342
|
p("span", {
|
|
341
|
-
class:
|
|
342
|
-
|
|
343
|
-
A.value && !V.value ? "tv-field-unverified border-b border-dotted border-gray-300" : ""
|
|
344
|
-
])
|
|
343
|
+
class: w(["tv-field-value", T.value ? d(we) : ""]),
|
|
344
|
+
onClick: ie
|
|
345
345
|
}, [
|
|
346
|
-
oe(
|
|
346
|
+
oe(a.$slots, "default", {
|
|
347
347
|
value: h.value,
|
|
348
348
|
formatted: g.value
|
|
349
349
|
}, () => [
|
|
350
350
|
p("span", {
|
|
351
351
|
ref_key: "markdownFallbackRef",
|
|
352
|
-
ref:
|
|
352
|
+
ref: q,
|
|
353
353
|
class: "tv-markdown-fallback-wrap"
|
|
354
354
|
}, [
|
|
355
|
-
|
|
355
|
+
L(d(he), {
|
|
356
356
|
"model-value": g.value,
|
|
357
357
|
format: "markdown",
|
|
358
358
|
theme: "light",
|
|
@@ -364,51 +364,51 @@ const Me = ["data-status", "title"], je = {
|
|
|
364
364
|
], 512)
|
|
365
365
|
])
|
|
366
366
|
], 2),
|
|
367
|
-
A.value ? (u(), v("span",
|
|
367
|
+
A.value ? (u(), v("span", ze, [
|
|
368
368
|
p("button", {
|
|
369
369
|
type: "button",
|
|
370
|
-
class:
|
|
370
|
+
class: w(["tv-overlay", [d(R), T.value ? "cursor-pointer" : "cursor-default"]]),
|
|
371
371
|
"aria-label": G.value,
|
|
372
372
|
title: G.value,
|
|
373
|
-
onClick: l[0] || (l[0] = (o) =>
|
|
373
|
+
onClick: l[0] || (l[0] = (o) => T.value ? H() : void 0)
|
|
374
374
|
}, [
|
|
375
|
-
I.value === "unverified" &&
|
|
375
|
+
I.value === "unverified" && !$.value ? (u(), B(Ue, {
|
|
376
376
|
key: 0,
|
|
377
|
-
status:
|
|
378
|
-
}, null, 8, ["status"])) : I.value === "unverified" &&
|
|
377
|
+
status: O.value
|
|
378
|
+
}, null, 8, ["status"])) : I.value === "unverified" && $.value ? (u(), v("span", Ge, "A")) : I.value === "confirmed" ? (u(), v("span", He, "✔")) : (u(), v("span", qe, "✔")),
|
|
379
379
|
b.value && !x.value ? (u(), v("span", {
|
|
380
380
|
key: 4,
|
|
381
|
-
class:
|
|
381
|
+
class: w(["tv-discrepancy-indicator ml-0.5 text-amber-500", s.value ? "tv-source-discrepancy-indicator" : ""]),
|
|
382
382
|
"aria-hidden": !0
|
|
383
|
-
}, "⚠", 2)) :
|
|
384
|
-
], 10,
|
|
383
|
+
}, "⚠", 2)) : y.value && !x.value ? (u(), v("span", Ke, "✎")) : S("", !0)
|
|
384
|
+
], 10, Ye)
|
|
385
385
|
])) : S("", !0)
|
|
386
386
|
], 64))
|
|
387
387
|
], 2));
|
|
388
388
|
}
|
|
389
|
-
}),
|
|
389
|
+
}), Je = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, Qe = { class: "tv-progress-block" }, We = { class: "mb-1 flex items-baseline justify-between" }, Xe = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, Ze = {
|
|
390
390
|
key: 0,
|
|
391
391
|
class: "tv-attempts-recorded mt-1 text-[11px] text-gray-400"
|
|
392
|
-
},
|
|
392
|
+
}, lt = /* @__PURE__ */ Y({
|
|
393
393
|
__name: "VerificationChrome",
|
|
394
394
|
setup(e) {
|
|
395
|
-
const t =
|
|
396
|
-
() =>
|
|
395
|
+
const t = te(), { enabled: n } = t, f = fe(), m = M(!1), r = i(() => Me(t.data)), c = i(
|
|
396
|
+
() => ae(t.data).reduce(
|
|
397
397
|
(b, s) => {
|
|
398
|
-
var
|
|
399
|
-
return b + (((
|
|
398
|
+
var y, x, V, $, I, A, D;
|
|
399
|
+
return b + (((V = (x = (y = s.meta) == null ? void 0 : y.candidates) == null ? void 0 : x.extracted) == null ? void 0 : V.history_count) ?? ((D = (A = (I = ($ = s.meta) == null ? void 0 : $.candidates) == null ? void 0 : I.extracted) == null ? void 0 : A.history) == null ? void 0 : D.length) ?? 0);
|
|
400
400
|
},
|
|
401
401
|
0
|
|
402
402
|
)
|
|
403
|
-
), h =
|
|
403
|
+
), h = M(!1);
|
|
404
404
|
z(
|
|
405
|
-
() =>
|
|
405
|
+
() => r.value.percent,
|
|
406
406
|
(b) => {
|
|
407
|
-
b === 100 &&
|
|
407
|
+
b === 100 && r.value.total > 0 && !h.value && (h.value = !0, f.success("All data points verified 🎯"));
|
|
408
408
|
}
|
|
409
409
|
);
|
|
410
410
|
let g = 0;
|
|
411
|
-
function
|
|
411
|
+
function O() {
|
|
412
412
|
const b = document.querySelectorAll(".tv-needs-review");
|
|
413
413
|
if (!b.length) return;
|
|
414
414
|
g = g % b.length;
|
|
@@ -424,91 +424,92 @@ const Me = ["data-status", "title"], je = {
|
|
|
424
424
|
return (b, s) => (u(), v(F, null, [
|
|
425
425
|
p("button", {
|
|
426
426
|
type: "button",
|
|
427
|
-
class:
|
|
427
|
+
class: w(["tv-settings-button fixed bottom-4 right-4 z-50 flex h-11 w-11 items-center justify-center rounded-full bg-gray-900 text-white shadow-lg transition-transform hover:scale-105", d(R)]),
|
|
428
428
|
title: "Verification",
|
|
429
|
-
onClick: s[0] || (s[0] =
|
|
429
|
+
onClick: s[0] || (s[0] = W((y) => m.value = !m.value, ["stop"]))
|
|
430
430
|
}, [
|
|
431
|
-
|
|
432
|
-
icon:
|
|
431
|
+
L(d(ve), {
|
|
432
|
+
icon: d(pe),
|
|
433
433
|
class: "h-5 w-5"
|
|
434
434
|
}, null, 8, ["icon"]),
|
|
435
|
-
|
|
435
|
+
d(n) && r.value.needsReview > 0 ? (u(), B(d(ge), {
|
|
436
436
|
key: 0,
|
|
437
|
-
value:
|
|
437
|
+
value: r.value.needsReview,
|
|
438
438
|
variant: "warning",
|
|
439
439
|
class: "tv-needs-review-badge absolute -right-1 -top-1"
|
|
440
440
|
}, null, 8, ["value"])) : S("", !0)
|
|
441
441
|
], 2),
|
|
442
442
|
m.value ? (u(), v("div", {
|
|
443
443
|
key: 0,
|
|
444
|
-
class:
|
|
444
|
+
class: w(["tv-settings-panel fixed bottom-20 right-4 z-50 flex w-72 flex-col gap-4 rounded-xl bg-white p-4 shadow-2xl ring-1 ring-gray-200", d(R)])
|
|
445
445
|
}, [
|
|
446
|
-
p("label",
|
|
446
|
+
p("label", Je, [
|
|
447
447
|
s[2] || (s[2] = p("span", null, "Verification overlay", -1)),
|
|
448
448
|
se(p("input", {
|
|
449
|
-
"onUpdate:modelValue": s[1] || (s[1] = (
|
|
449
|
+
"onUpdate:modelValue": s[1] || (s[1] = (y) => ue(n) ? n.value = y : null),
|
|
450
450
|
type: "checkbox",
|
|
451
451
|
class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
|
|
452
452
|
}, null, 512), [
|
|
453
|
-
[ce,
|
|
453
|
+
[ce, d(n)]
|
|
454
454
|
])
|
|
455
455
|
]),
|
|
456
|
-
|
|
457
|
-
p("div",
|
|
458
|
-
p("div",
|
|
456
|
+
d(n) && r.value.total > 0 ? (u(), v(F, { key: 0 }, [
|
|
457
|
+
p("div", Qe, [
|
|
458
|
+
p("div", We, [
|
|
459
459
|
s[3] || (s[3] = p("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
|
|
460
|
-
p("span",
|
|
460
|
+
p("span", Xe, k(r.value.verified) + " / " + k(r.value.total), 1)
|
|
461
461
|
]),
|
|
462
|
-
|
|
463
|
-
value:
|
|
464
|
-
max:
|
|
462
|
+
L(d(me), {
|
|
463
|
+
value: r.value.verified,
|
|
464
|
+
max: r.value.total,
|
|
465
465
|
size: "md",
|
|
466
|
-
variant:
|
|
467
|
-
striped:
|
|
468
|
-
"animate-stripes":
|
|
469
|
-
glow:
|
|
466
|
+
variant: r.value.percent === 100 ? "success" : "info",
|
|
467
|
+
striped: r.value.percent < 100,
|
|
468
|
+
"animate-stripes": r.value.percent < 100,
|
|
469
|
+
glow: r.value.percent === 100,
|
|
470
470
|
gradient: ""
|
|
471
471
|
}, null, 8, ["value", "max", "variant", "striped", "animate-stripes", "glow"]),
|
|
472
|
-
c.value > 0 ? (u(), v("div",
|
|
472
|
+
c.value > 0 ? (u(), v("div", Ze, k(c.value) + " extraction attempt" + k(c.value === 1 ? "" : "s") + " recorded ", 1)) : S("", !0)
|
|
473
473
|
]),
|
|
474
|
-
|
|
474
|
+
r.value.needsReview > 0 ? (u(), v("button", {
|
|
475
475
|
key: 0,
|
|
476
476
|
type: "button",
|
|
477
|
-
class:
|
|
478
|
-
onClick:
|
|
477
|
+
class: w(["tv-next-flagged flex items-center justify-between rounded-lg bg-amber-50 px-3 py-2 text-left text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-600/20 transition hover:bg-amber-100", d(R)]),
|
|
478
|
+
onClick: W(O, ["stop"])
|
|
479
479
|
}, [
|
|
480
|
-
p("span", null, k(
|
|
480
|
+
p("span", null, k(r.value.needsReview) + " need" + k(r.value.needsReview === 1 ? "s" : "") + " review", 1),
|
|
481
481
|
s[4] || (s[4] = p("span", { "aria-hidden": "true" }, "→", -1))
|
|
482
482
|
], 2)) : S("", !0)
|
|
483
483
|
], 64)) : S("", !0)
|
|
484
484
|
], 2)) : S("", !0),
|
|
485
|
-
|
|
486
|
-
class:
|
|
485
|
+
L(d(be), {
|
|
486
|
+
class: w(d(R))
|
|
487
487
|
}, null, 8, ["class"])
|
|
488
488
|
], 64));
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
export {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
Oe as
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
492
|
+
R as CHROME_CLASS,
|
|
493
|
+
Ue as ConfidenceIcon,
|
|
494
|
+
De as DATA_POINT_ACTIVATED,
|
|
495
|
+
we as EDITABLE_CLASS,
|
|
496
|
+
Z as ENABLED_STORAGE_KEY,
|
|
497
|
+
re as RESOLUTION_PRIORITY,
|
|
498
|
+
Se as STATUS_COLORS,
|
|
499
|
+
P as STATUS_LABELS,
|
|
500
|
+
Oe as TEMPLATE_MESSAGE_SOURCE,
|
|
501
|
+
Ve as TEMPLATE_PROTOCOL_VERSION,
|
|
502
|
+
lt as VerificationChrome,
|
|
503
|
+
at as VerifiedField,
|
|
504
|
+
ne as bucketConfidence,
|
|
505
|
+
Ae as candidatesDisagree,
|
|
506
|
+
Me as computeProgress,
|
|
507
|
+
Le as embedderOrigin,
|
|
507
508
|
$e as hasDiscrepancy,
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
509
|
+
rt as initVerification,
|
|
510
|
+
Ne as notifyDataPointActivated,
|
|
511
|
+
Ce as resolveCandidates,
|
|
512
|
+
Ie as resolveDataPoint,
|
|
513
|
+
te as useVerification,
|
|
514
|
+
ae as walkDataPoints
|
|
514
515
|
};
|