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