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