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