@thehammer/template-verification 0.2.1 → 0.2.3

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.
@@ -1,8 +1,8 @@
1
- import { ref as U, watch as ce, defineComponent as K, computed as u, openBlock as l, createElementBlock as i, normalizeClass as A, createElementVNode as n, toDisplayString as y, createCommentVNode as _, createBlock as N, unref as r, withCtx as I, createTextVNode as T, createVNode as V, Fragment as L, renderList as M, withKeys as Te, withModifiers as Ue, renderSlot as Ne, withDirectives as Ae, isRef as ge, vModelCheckbox as Re } from "vue";
2
- import { DanxChip as J, CodeViewer as xe, useToast as _e, DanxDialog as re, DanxProgressBar as we, DanxAlert as ye, DanxTabs as Le, MarkdownEditor as je, DanxFileViewer as be, DanxButton as se, DanxInput as Ee, DanxSkeleton as ze, DanxTooltip as Pe, DanxIcon as Me, gearIcon as Be, DanxBadge as Fe, DanxToastContainer as qe } from "@thehammer/danx-ui";
3
- const P = "tv-chrome", ke = "template-verification:enabled";
1
+ import { ref as U, watch as ce, defineComponent as H, computed as d, openBlock as l, createElementBlock as o, normalizeClass as R, createElementVNode as i, toDisplayString as m, createCommentVNode as b, createBlock as N, unref as r, withCtx as I, createTextVNode as T, createVNode as D, Fragment as L, renderList as P, withKeys as Ue, withModifiers as Ne, renderSlot as Re, withDirectives as Ae, isRef as ge, vModelCheckbox as Le } from "vue";
2
+ import { DanxChip as J, CodeViewer as xe, useToast as _e, DanxDialog as re, DanxProgressBar as we, DanxAlert as ye, DanxTabs as je, MarkdownEditor as Ee, DanxFileViewer as be, DanxButton as se, DanxInput as ze, DanxSkeleton as Pe, DanxTooltip as Me, DanxIcon as Be, gearIcon as Fe, DanxBadge as qe, DanxToastContainer as Ye } from "@thehammer/danx-ui";
3
+ const z = "tv-chrome", ke = "template-verification:enabled";
4
4
  let te = null;
5
- function Ye(e) {
5
+ function Je(e) {
6
6
  var t;
7
7
  try {
8
8
  return ((t = globalThis.localStorage) == null ? void 0 : t.getItem(e)) ?? null;
@@ -10,22 +10,22 @@ function Ye(e) {
10
10
  return null;
11
11
  }
12
12
  }
13
- function Je(e, t) {
13
+ function Ke(e, t) {
14
14
  var a;
15
15
  try {
16
16
  (a = globalThis.localStorage) == null || a.setItem(e, t);
17
17
  } catch {
18
18
  }
19
19
  }
20
- function Ke(e) {
21
- const t = Ye(ke);
20
+ function He(e) {
21
+ const t = Je(ke);
22
22
  return t === null ? e : t === "true";
23
23
  }
24
24
  function $e(e) {
25
- const t = U(Ke((e == null ? void 0 : e.defaultEnabled) ?? !1));
25
+ const t = U(He((e == null ? void 0 : e.defaultEnabled) ?? !1));
26
26
  return ce(
27
27
  t,
28
- (a) => Je(ke, a ? "true" : "false")
28
+ (a) => Ke(ke, a ? "true" : "false")
29
29
  ), {
30
30
  enabled: t,
31
31
  data: (e == null ? void 0 : e.data) ?? {},
@@ -54,13 +54,13 @@ function le() {
54
54
  }
55
55
  };
56
56
  }
57
- function He() {
57
+ function Ge() {
58
58
  return Se().comparisonOpen;
59
59
  }
60
60
  function ve(e) {
61
61
  return typeof e != "number" || Number.isNaN(e) ? "unverifiable" : e <= 2 ? "low" : e === 3 ? "medium" : "high";
62
62
  }
63
- const Ge = {
63
+ const Qe = {
64
64
  high: "bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20",
65
65
  medium: "bg-yellow-50 text-yellow-700 ring-1 ring-inset ring-yellow-600/20",
66
66
  low: "bg-red-50 text-red-700 ring-1 ring-inset ring-red-600/20",
@@ -72,9 +72,9 @@ const Ge = {
72
72
  unverifiable: "Unverifiable"
73
73
  }, Ce = ["override", "extracted", "claim"];
74
74
  function fe(e) {
75
- return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : Qe(e.candidates) : { value: null, source: "none" };
75
+ return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : We(e.candidates) : { value: null, source: "none" };
76
76
  }
77
- function Qe(e) {
77
+ function We(e) {
78
78
  if (e)
79
79
  for (const t of Ce) {
80
80
  const a = e[t];
@@ -84,54 +84,111 @@ function Qe(e) {
84
84
  return { value: null, source: "none" };
85
85
  }
86
86
  function ie(e) {
87
- var g, d;
88
- const t = (d = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : d.reasoning;
87
+ var g, p;
88
+ const t = (p = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : p.reasoning;
89
89
  if (t == null) return null;
90
90
  const a = String(t).trim();
91
91
  return a === "" ? null : a;
92
92
  }
93
93
  function oe(e) {
94
- var g, d;
95
- const t = (d = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : d.cited_text;
94
+ var g, p;
95
+ const t = (p = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : p.cited_text;
96
96
  if (t == null) return null;
97
97
  const a = String(t).trim();
98
98
  return a === "" ? null : a;
99
99
  }
100
100
  function Ve(e) {
101
- return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : We(e.candidates) : !1;
101
+ return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : Xe(e.candidates) : !1;
102
102
  }
103
- function We(e) {
103
+ function Xe(e) {
104
104
  if (!e) return !1;
105
- const t = Ce.map((a) => e[a]).filter((a) => a != null).map((a) => Xe(a.value));
105
+ const t = Ce.map((a) => e[a]).filter((a) => a != null).map((a) => Ze(a.value));
106
106
  return t.length < 2 ? !1 : new Set(t).size > 1;
107
107
  }
108
- function Xe(e) {
108
+ function Ze(e) {
109
109
  return JSON.stringify(e ?? null);
110
110
  }
111
- function Ze(e, t, a) {
112
- var c;
113
- const g = (c = t.value) == null ? void 0 : c.anchor;
111
+ const et = /* @__PURE__ */ new Set(["name", "type"]);
112
+ function De(e, t = "") {
113
+ const a = [];
114
+ return ue(e, t, a), a;
115
+ }
116
+ function ue(e, t, a) {
117
+ if (Array.isArray(e)) {
118
+ e.forEach((n, y) => ue(n, `${t}[${y}]`, a));
119
+ return;
120
+ }
121
+ if (!he(e)) return;
122
+ const p = e.__meta ?? {};
123
+ for (const [n, y] of Object.entries(e)) {
124
+ if (n === "__meta") continue;
125
+ const s = t ? `${t}.${n}` : n;
126
+ if (Array.isArray(y) || he(y)) {
127
+ ue(y, s, a);
128
+ continue;
129
+ }
130
+ const h = p[n];
131
+ !h && et.has(n) || a.push({
132
+ path: s,
133
+ label: n,
134
+ meta: h ?? null,
135
+ value: y,
136
+ unanchored: !h
137
+ });
138
+ }
139
+ }
140
+ function he(e) {
141
+ return typeof e == "object" && e !== null && !Array.isArray(e);
142
+ }
143
+ function Oe(e) {
144
+ var a;
145
+ if (e.candidates.override) return !1;
146
+ const t = (a = e.candidates.extracted) == null ? void 0 : a.confidence;
147
+ return e.discrepancy || t == null || t <= 2;
148
+ }
149
+ function tt(e) {
150
+ const t = De(e).filter(
151
+ (n) => n.meta !== null
152
+ ), a = t.length;
153
+ let g = 0, p = 0;
154
+ for (const n of t) {
155
+ if (n.meta.candidates.override) {
156
+ g++;
157
+ continue;
158
+ }
159
+ Oe(n.meta) && p++;
160
+ }
161
+ return {
162
+ total: a,
163
+ verified: g,
164
+ needsReview: p,
165
+ percent: a === 0 ? 100 : Math.round(g / a * 100)
166
+ };
167
+ }
168
+ function at(e, t, a) {
169
+ var n;
170
+ const g = (n = t.value) == null ? void 0 : n.anchor;
114
171
  if (!e.saveOverride || !g) return null;
115
- const d = e.saveOverride;
116
- return async (m, s) => {
117
- const b = await d({
172
+ const p = e.saveOverride;
173
+ return async (y, s) => {
174
+ const h = await p({
118
175
  workflow_input_id: e.workflowInputId,
119
176
  object_ids: g.object_ids,
120
177
  field: g.field,
121
178
  field_path: g.field_path,
122
- value: m,
179
+ value: y,
123
180
  source_choice: s
124
181
  });
125
- return a(b), b;
182
+ return a(h), h;
126
183
  };
127
184
  }
128
- const et = ["data-status", "title"], tt = {
185
+ const lt = ["data-status", "title"], nt = {
129
186
  class: "tv-confidence-glyph",
130
187
  "aria-hidden": "true"
131
- }, at = {
188
+ }, st = {
132
189
  key: 0,
133
190
  class: "tv-confidence-label"
134
- }, ue = /* @__PURE__ */ K({
191
+ }, de = /* @__PURE__ */ H({
135
192
  __name: "ConfidenceIcon",
136
193
  props: {
137
194
  confidence: {},
@@ -139,7 +196,7 @@ const et = ["data-status", "title"], tt = {
139
196
  showLabel: { type: Boolean }
140
197
  },
141
198
  setup(e) {
142
- const t = e, a = u(
199
+ const t = e, a = d(
143
200
  () => t.status ?? ve(t.confidence)
144
201
  ), g = {
145
202
  high: "✔",
@@ -149,137 +206,150 @@ const et = ["data-status", "title"], tt = {
149
206
  low: "✕",
150
207
  // x
151
208
  unverifiable: "?"
152
- }, d = u(() => g[a.value]), c = u(() => Ge[a.value]), m = u(() => ae[a.value]);
153
- return (s, b) => (l(), i("span", {
154
- class: A(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", c.value]),
209
+ }, p = d(() => g[a.value]), n = d(() => Qe[a.value]), y = d(() => ae[a.value]);
210
+ return (s, h) => (l(), o("span", {
211
+ class: R(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", n.value]),
155
212
  "data-status": a.value,
156
- title: m.value
213
+ title: y.value
157
214
  }, [
158
- n("span", tt, y(d.value), 1),
159
- e.showLabel ? (l(), i("span", at, y(m.value), 1)) : _("", !0)
160
- ], 10, et));
215
+ i("span", nt, m(p.value), 1),
216
+ e.showLabel ? (l(), o("span", st, m(y.value), 1)) : b("", !0)
217
+ ], 10, lt));
161
218
  }
162
219
  });
163
- async function lt(e, t) {
220
+ async function rt(e, t) {
164
221
  const a = t.object_ids.at(-1), g = new URLSearchParams({
165
222
  object_id: String(a),
166
223
  field: t.field
167
- }), d = e.includes("?") ? "&" : "?", c = await fetch(`${e}${d}${g}`);
168
- if (!c.ok)
224
+ }), p = e.includes("?") ? "&" : "?", n = await fetch(`${e}${p}${g}`);
225
+ if (!n.ok)
169
226
  throw new Error(
170
- `data-point-audit ${c.status}: ${await c.text()}`
227
+ `data-point-audit ${n.status}: ${await n.text()}`
171
228
  );
172
- return (await c.json()).data ?? [];
229
+ return (await n.json()).data ?? [];
173
230
  }
174
- function De(e) {
231
+ function Ie(e) {
232
+ var a, g, p;
175
233
  if (!e || e.length === 0) return [];
176
234
  const t = /* @__PURE__ */ new Map();
177
- for (const a of e) {
178
- const g = nt(a);
179
- let d = t.get(g);
180
- d || (d = {
181
- fileLabel: st(a),
182
- fileUrl: a.file_url,
183
- file: a.file,
235
+ for (const n of e) {
236
+ const y = it(n);
237
+ let s = t.get(y);
238
+ s || (s = {
239
+ fileLabel: ot(n),
240
+ fileUrl: n.file_url ?? ((a = n.file) == null ? void 0 : a.url),
241
+ file: n.file,
184
242
  sources: []
185
- }, t.set(g, d)), !d.fileUrl && a.file_url && (d.fileUrl = a.file_url), !d.file && a.file && (d.file = a.file), d.sources.push(a);
243
+ }, t.set(y, s)), !s.fileUrl && (n.file_url ?? ((g = n.file) == null ? void 0 : g.url)) && (s.fileUrl = n.file_url ?? ((p = n.file) == null ? void 0 : p.url)), !s.file && n.file && (s.file = n.file), s.sources.push(n);
186
244
  }
187
245
  return [...t.values()];
188
246
  }
189
- function nt(e) {
247
+ function it(e) {
190
248
  const t = e.file_name ?? e.file_id ?? e.stored_file_id ?? e.source_id ?? e.id;
191
249
  return t != null ? String(t) : "__unknown__";
192
250
  }
193
- function st(e) {
251
+ function ot(e) {
194
252
  var t;
195
253
  return (t = e.file) != null && t.name ? e.file.name : e.file_name ? e.file_name : e.file_id !== void 0 && e.file_id !== null ? `File ${e.file_id}` : e.stored_file_id !== void 0 && e.stored_file_id !== null ? `File ${e.stored_file_id}` : e.source_type ? e.source_type : "Source";
196
254
  }
197
- function rt(e) {
198
- return e.page !== void 0 && e.page !== null ? `Page ${e.page}` : e.explanation ? String(e.explanation) : e.source_type ? String(e.source_type) : "Citation";
255
+ function ut(e) {
256
+ const t = e.page ?? e.page_number;
257
+ return t != null ? `Page ${t}` : e.explanation ? String(e.explanation) : e.source_type ? String(e.source_type) : "Citation";
199
258
  }
200
- const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm" }, ot = { class: "tv-audit-call-header flex flex-wrap items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2" }, ut = {
201
- key: 2,
202
- class: "font-mono text-[11px] text-gray-400"
203
- }, dt = {
259
+ const dt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm" }, ct = { class: "tv-audit-call-header flex flex-wrap items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2" }, vt = {
204
260
  key: 3,
205
- class: "text-[11px] font-medium text-gray-500"
206
- }, ct = {
261
+ class: "font-mono text-[11px] text-gray-400"
262
+ }, ft = {
207
263
  key: 4,
264
+ class: "text-[11px] font-medium text-gray-500"
265
+ }, pt = {
266
+ key: 5,
208
267
  class: "text-[11px] text-gray-400"
209
- }, vt = { class: "tv-audit-call-body flex flex-col gap-2 p-3" }, ft = /* @__PURE__ */ K({
268
+ }, mt = { class: "tv-audit-call-body flex flex-col gap-2 p-3" }, gt = /* @__PURE__ */ H({
210
269
  __name: "AuditCallCard",
211
270
  props: {
212
271
  call: {}
213
272
  },
214
273
  setup(e) {
215
- const t = e, a = u(() => {
274
+ const t = e, a = d(() => {
216
275
  const s = t.call.status_code;
217
276
  return s == null ? "muted" : s >= 200 && s < 300 ? "success" : s >= 400 ? "danger" : "warning";
218
- }), g = u(() => {
277
+ }), g = d(() => {
219
278
  const s = t.call.run_time_ms;
220
279
  return s == null ? null : s >= 1e3 ? `${(s / 1e3).toFixed(1)}s` : `${s}ms`;
221
- }), d = u(() => {
280
+ }), p = d(() => {
222
281
  if (!t.call.started_at) return null;
223
282
  const s = new Date(t.call.started_at);
224
283
  return Number.isNaN(s.getTime()) ? t.call.started_at : s.toLocaleString();
225
- }), c = u(
284
+ }), n = d(
226
285
  () => JSON.stringify(t.call.request ?? null, null, 2)
227
- ), m = u(
286
+ ), y = d(
228
287
  () => JSON.stringify(t.call.response ?? null, null, 2)
229
288
  );
230
- return (s, b) => (l(), i("div", it, [
231
- n("div", ot, [
232
- e.call.model ? (l(), N(r(J), {
289
+ return (s, h) => (l(), o("div", dt, [
290
+ i("div", ct, [
291
+ e.call.stage ? (l(), N(r(J), {
233
292
  key: 0,
293
+ variant: "muted",
294
+ size: "xxs",
295
+ class: "tv-audit-stage"
296
+ }, {
297
+ default: I(() => [
298
+ T(m(e.call.stage), 1)
299
+ ]),
300
+ _: 1
301
+ })) : b("", !0),
302
+ e.call.model ? (l(), N(r(J), {
303
+ key: 1,
234
304
  variant: "info",
235
305
  size: "xs",
236
306
  class: "tv-audit-model"
237
307
  }, {
238
308
  default: I(() => [
239
- T(y(e.call.model), 1)
309
+ T(m(e.call.model), 1)
240
310
  ]),
241
311
  _: 1
242
- })) : _("", !0),
312
+ })) : b("", !0),
243
313
  e.call.service ? (l(), N(r(J), {
244
- key: 1,
314
+ key: 2,
245
315
  variant: "muted",
246
316
  size: "xxs"
247
317
  }, {
248
318
  default: I(() => [
249
- T(y(e.call.service), 1)
319
+ T(m(e.call.service), 1)
250
320
  ]),
251
321
  _: 1
252
- })) : _("", !0),
253
- e.call.endpoint ? (l(), i("span", ut, y(e.call.endpoint), 1)) : _("", !0),
254
- b[0] || (b[0] = n("span", { class: "flex-1" }, null, -1)),
255
- V(r(J), {
322
+ })) : b("", !0),
323
+ e.call.endpoint ? (l(), o("span", vt, m(e.call.endpoint), 1)) : b("", !0),
324
+ h[0] || (h[0] = i("span", { class: "flex-1" }, null, -1)),
325
+ D(r(J), {
256
326
  variant: a.value,
257
327
  size: "xxs",
258
328
  class: "tv-audit-status"
259
329
  }, {
260
330
  default: I(() => [
261
- T(y(e.call.status_code ?? "…"), 1)
331
+ T(m(e.call.status_code ?? "…"), 1)
262
332
  ]),
263
333
  _: 1
264
334
  }, 8, ["variant"]),
265
- g.value ? (l(), i("span", dt, y(g.value), 1)) : _("", !0),
266
- d.value ? (l(), i("span", ct, y(d.value), 1)) : _("", !0)
335
+ g.value ? (l(), o("span", ft, m(g.value), 1)) : b("", !0),
336
+ p.value ? (l(), o("span", pt, m(p.value), 1)) : b("", !0)
267
337
  ]),
268
- n("div", vt, [
269
- n("div", null, [
270
- b[1] || (b[1] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Request ", -1)),
271
- V(r(xe), {
272
- "model-value": c.value,
338
+ i("div", mt, [
339
+ i("div", null, [
340
+ h[1] || (h[1] = i("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Request ", -1)),
341
+ D(r(xe), {
342
+ "model-value": n.value,
273
343
  format: "json",
274
344
  collapsible: "",
275
345
  "default-collapsed": "",
276
346
  class: "tv-audit-request"
277
347
  }, null, 8, ["model-value"])
278
348
  ]),
279
- n("div", null, [
280
- b[2] || (b[2] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Response ", -1)),
281
- V(r(xe), {
282
- "model-value": m.value,
349
+ i("div", null, [
350
+ h[2] || (h[2] = i("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Response ", -1)),
351
+ D(r(xe), {
352
+ "model-value": y.value,
283
353
  format: "json",
284
354
  collapsible: "",
285
355
  "default-collapsed": "",
@@ -289,46 +359,46 @@ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
289
359
  ])
290
360
  ]));
291
361
  }
292
- }), pt = { class: "tv-modal flex h-full flex-col gap-4 overflow-y-auto p-1" }, mt = { class: "tv-modal-resolved flex flex-col gap-3 rounded-xl border border-gray-200 bg-gradient-to-br from-gray-50 to-white p-4 shadow-sm" }, gt = { class: "flex flex-wrap items-start justify-between gap-4" }, xt = { class: "min-w-0 flex-1" }, yt = { class: "tv-resolved-value mt-1 break-words font-mono text-xl font-semibold leading-snug text-gray-900" }, bt = { class: "mt-1 text-[11px] text-gray-400" }, ht = { class: "tv-resolved-source font-medium text-gray-500" }, _t = { class: "tv-confidence-meter w-56 shrink-0" }, wt = { class: "mt-2" }, kt = {
362
+ }), xt = { class: "tv-modal flex h-full flex-col gap-4 overflow-y-auto p-1" }, yt = { class: "tv-modal-resolved flex flex-col gap-3 rounded-xl border border-gray-200 bg-gradient-to-br from-gray-50 to-white p-4 shadow-sm" }, bt = { class: "flex flex-wrap items-start justify-between gap-4" }, ht = { class: "min-w-0 flex-1" }, _t = { class: "tv-resolved-value mt-1 break-words font-mono text-xl font-semibold leading-snug text-gray-900" }, wt = { class: "mt-1 text-[11px] text-gray-400" }, kt = { class: "tv-resolved-source font-medium text-gray-500" }, $t = { class: "tv-confidence-meter w-56 shrink-0" }, St = { class: "mt-2" }, Ct = {
293
363
  key: 1,
294
364
  class: "tv-confidence-value text-sm text-gray-400"
295
- }, $t = {
365
+ }, Vt = {
296
366
  key: 0,
297
367
  class: "tv-tab-evidence flex min-h-0 flex-1 flex-col gap-4"
298
- }, St = {
368
+ }, Dt = {
299
369
  key: 0,
300
370
  class: "tv-reasoning-card rounded-lg border border-gray-200 p-3"
301
- }, Ct = {
371
+ }, Ot = {
302
372
  key: 1,
303
373
  class: "tv-cited-text rounded-lg border-l-4 border-blue-200 bg-blue-50/50 px-4 py-3 text-sm italic leading-relaxed text-gray-700"
304
- }, Vt = {
374
+ }, It = {
305
375
  key: 2,
306
376
  class: "tv-evidence-viewer flex min-h-[24rem] flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
307
- }, Dt = {
377
+ }, Tt = {
308
378
  key: 0,
309
379
  class: "tv-page-context border-t border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-500"
310
- }, Ot = {
380
+ }, Ut = {
311
381
  key: 3,
312
382
  class: "tv-no-source rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
313
- }, It = {
383
+ }, Nt = {
314
384
  key: 4,
315
385
  class: "tv-full-documents flex flex-wrap items-center gap-2"
316
- }, Tt = {
386
+ }, Rt = {
317
387
  key: 1,
318
388
  class: "tv-tab-candidates flex flex-col gap-3"
319
- }, Ut = { class: "flex flex-wrap items-center justify-between gap-3" }, Nt = { class: "min-w-0 flex-1" }, At = { class: "flex items-center gap-2" }, Rt = { class: "mt-2 break-words font-mono text-base text-gray-900" }, Lt = { class: "mt-1 text-xs text-gray-400" }, jt = {
389
+ }, At = { class: "flex flex-wrap items-center justify-between gap-3" }, Lt = { class: "min-w-0 flex-1" }, jt = { class: "flex items-center gap-2" }, Et = { class: "mt-2 break-words font-mono text-base text-gray-900" }, zt = { class: "mt-1 text-xs text-gray-400" }, Pt = {
320
390
  key: 0,
321
391
  class: "tv-custom-entry flex items-center gap-2 rounded-lg border border-dashed border-gray-300 p-4"
322
- }, Et = {
392
+ }, Mt = {
323
393
  key: 1,
324
394
  class: "tv-read-only text-center text-xs text-gray-400"
325
- }, zt = {
395
+ }, Bt = {
326
396
  key: 2,
327
397
  class: "tv-tab-audit flex flex-col gap-3"
328
- }, Pt = {
398
+ }, Ft = {
329
399
  key: 2,
330
400
  class: "tv-audit-empty rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
331
- }, Mt = /* @__PURE__ */ K({
401
+ }, qt = /* @__PURE__ */ H({
332
402
  __name: "VerificationModal",
333
403
  props: {
334
404
  modelValue: { type: Boolean },
@@ -338,130 +408,130 @@ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
338
408
  },
339
409
  emits: ["update:modelValue", "saved"],
340
410
  setup(e, { emit: t }) {
341
- const a = e, g = t, d = le(), c = _e(), m = u({
411
+ const a = e, g = t, p = le(), n = _e(), y = d({
342
412
  get: () => a.modelValue,
343
- set: (f) => g("update:modelValue", f)
344
- }), s = u(() => fe(a.meta)), b = u(() => a.meta.candidates.extracted), $ = u(() => a.meta.candidates.claim), h = u(() => a.meta.candidates.override), x = u(() => {
345
- var f;
346
- return ((f = b.value) == null ? void 0 : f.confidence) ?? null;
347
- }), k = u(() => ve(x.value)), S = u(() => ie(a.meta)), R = u(() => oe(a.meta)), O = u(() => {
348
- var f;
349
- return De((f = b.value) == null ? void 0 : f.sources);
350
- }), j = u(() => (a.meta.anchor.field_path || a.label || "Data point").split(".").map(
351
- (o) => o.replace(/\[\d+\]/g, "").replace(/_/g, " ").replace(/^\w/, (C) => C.toUpperCase())
352
- ).join(" › ")), H = {
413
+ set: (v) => g("update:modelValue", v)
414
+ }), s = d(() => fe(a.meta)), h = d(() => a.meta.candidates.extracted), $ = d(() => a.meta.candidates.claim), _ = d(() => a.meta.candidates.override), x = d(() => {
415
+ var v;
416
+ return ((v = h.value) == null ? void 0 : v.confidence) ?? null;
417
+ }), k = d(() => ve(x.value)), S = d(() => ie(a.meta)), A = d(() => oe(a.meta)), O = d(() => {
418
+ var v;
419
+ return Ie((v = h.value) == null ? void 0 : v.sources);
420
+ }), M = d(() => (a.meta.anchor.field_path || a.label || "Data point").split(".").map(
421
+ (u) => u.replace(/\[\d+\]/g, "").replace(/_/g, " ").replace(/^\w/, (C) => C.toUpperCase())
422
+ ).join(" › ")), B = {
353
423
  high: "success",
354
424
  medium: "warning",
355
425
  low: "danger",
356
426
  unverifiable: "muted"
357
- }, E = U("evidence"), W = u(() => !!d.auditUrl), X = u(() => {
358
- var o;
359
- const f = [
427
+ }, j = U("evidence"), G = d(() => !!p.auditUrl), X = d(() => {
428
+ var u;
429
+ const v = [
360
430
  {
361
431
  value: "evidence",
362
432
  label: "Evidence",
363
- count: O.value.reduce((C, v) => C + v.sources.length, 0)
433
+ count: O.value.reduce((C, c) => C + c.sources.length, 0)
364
434
  },
365
435
  {
366
436
  value: "candidates",
367
437
  label: "Candidates",
368
- count: Q.value.length
438
+ count: W.value.length
369
439
  }
370
440
  ];
371
- return W.value && f.push({
441
+ return G.value && v.push({
372
442
  value: "audit",
373
443
  label: "Audit trail",
374
- count: ((o = F.value) == null ? void 0 : o.length) ?? void 0
375
- }), f;
376
- }), q = u(
377
- () => O.value.map((f) => f.file).filter((f) => !!f)
378
- ), p = U(null), w = u(() => {
379
- const f = p.value ?? q.value[0];
380
- if (!f) return null;
381
- const o = O.value.find(
382
- (v) => v.file && String(v.file.id) === String(f.id)
444
+ count: ((u = Y.value) == null ? void 0 : u.length) ?? void 0
445
+ }), v;
446
+ }), F = d(
447
+ () => O.value.map((v) => v.file).filter((v) => !!v)
448
+ ), Q = U(null), f = d(() => {
449
+ const v = Q.value ?? F.value[0];
450
+ if (!v) return null;
451
+ const u = O.value.find(
452
+ (c) => c.file && String(c.file.id) === String(v.id)
383
453
  );
384
- if (!o) return null;
385
- const C = o.sources.find((v) => v.explanation);
454
+ if (!u) return null;
455
+ const C = u.sources.find((c) => c.explanation);
386
456
  return (C == null ? void 0 : C.explanation) ?? null;
387
- }), D = u(() => {
388
- const f = /* @__PURE__ */ new Map();
389
- for (const o of O.value)
390
- for (const C of o.sources) {
391
- const v = C.original_file;
392
- v && !f.has(String(v.id)) && f.set(String(v.id), v);
457
+ }), w = d(() => {
458
+ const v = /* @__PURE__ */ new Map();
459
+ for (const u of O.value)
460
+ for (const C of u.sources) {
461
+ const c = C.original_file;
462
+ c && !v.has(String(c.id)) && v.set(String(c.id), c);
393
463
  }
394
- return [...f.values()];
395
- }), z = U(null), G = u({
396
- get: () => z.value !== null,
397
- set: (f) => {
398
- f || (z.value = null);
464
+ return [...v.values()];
465
+ }), V = U(null), K = d({
466
+ get: () => V.value !== null,
467
+ set: (v) => {
468
+ v || (V.value = null);
399
469
  }
400
- }), Q = u(() => {
401
- const f = [];
402
- return h.value && f.push({
470
+ }), W = d(() => {
471
+ const v = [];
472
+ return _.value && v.push({
403
473
  key: "override",
404
474
  title: "Human override",
405
475
  variant: "success",
406
- value: h.value.value,
476
+ value: _.value.value,
407
477
  detail: [
408
- h.value.source_choice ? `basis: ${h.value.source_choice}` : null,
409
- h.value.set_at ? new Date(h.value.set_at).toLocaleString() : null
478
+ _.value.source_choice ? `basis: ${_.value.source_choice}` : null,
479
+ _.value.set_at ? new Date(_.value.set_at).toLocaleString() : null
410
480
  ].filter(Boolean).join(" · "),
411
481
  winner: s.value.source === "override"
412
- }), b.value && f.push({
482
+ }), h.value && v.push({
413
483
  key: "extracted",
414
484
  title: "Extracted",
415
- variant: H[k.value],
416
- value: b.value.value,
485
+ variant: B[k.value],
486
+ value: h.value.value,
417
487
  detail: x.value != null ? `Confidence ${x.value}/5 · ${ae[k.value]}` : "No confidence recorded",
418
488
  accept: a.save ? () => {
419
- var o;
420
- return ne(pe((o = b.value) == null ? void 0 : o.value), "extracted");
489
+ var u;
490
+ return ne(pe((u = h.value) == null ? void 0 : u.value), "extracted");
421
491
  } : void 0,
422
492
  winner: s.value.source === "extracted"
423
- }), $.value && f.push({
493
+ }), $.value && v.push({
424
494
  key: "claim",
425
495
  title: "Claim",
426
496
  variant: "info",
427
497
  value: $.value.value,
428
498
  detail: $.value.claim_set_label ?? "Reference output",
429
499
  accept: a.save ? () => {
430
- var o;
431
- return ne(pe((o = $.value) == null ? void 0 : o.value), "claim");
500
+ var u;
501
+ return ne(pe((u = $.value) == null ? void 0 : u.value), "claim");
432
502
  } : void 0,
433
503
  winner: s.value.source === "claim"
434
- }), f;
435
- }), B = U(""), Y = U(!1);
436
- async function ne(f, o) {
437
- if (!(!a.save || Y.value)) {
438
- Y.value = !0;
504
+ }), v;
505
+ }), q = U(""), E = U(!1);
506
+ async function ne(v, u) {
507
+ if (!(!a.save || E.value)) {
508
+ E.value = !0;
439
509
  try {
440
- const C = await a.save(f, o);
441
- g("saved", C), c.success(`Verified — ${j.value} locked in`);
442
- } catch {
443
- c.danger(`Could not save ${j.value} — try again`);
510
+ const C = await a.save(v, u);
511
+ g("saved", C), n.success(`Verified — ${M.value} locked in`);
512
+ } catch (C) {
513
+ console.error("template-verification: save failed", C), n.danger(`Could not save ${M.value} — try again`);
444
514
  } finally {
445
- Y.value = !1;
515
+ E.value = !1;
446
516
  }
447
517
  }
448
518
  }
449
- const Ie = () => ne(B.value, "custom");
450
- function pe(f) {
451
- return f == null ? null : String(f);
519
+ const Te = () => ne(q.value, "custom");
520
+ function pe(v) {
521
+ return v == null ? null : String(v);
452
522
  }
453
- function me(f) {
454
- return f == null ? "—" : String(f);
523
+ function me(v) {
524
+ return v == null ? "—" : String(v);
455
525
  }
456
- const F = U(null), Z = U(!1), ee = U(null);
526
+ const Y = U(null), Z = U(!1), ee = U(null);
457
527
  return ce(
458
- [E, m],
459
- async ([f, o]) => {
460
- if (!(f !== "audit" || !o || F.value !== null || Z.value) && d.auditUrl) {
528
+ [j, y],
529
+ async ([v, u]) => {
530
+ if (!(v !== "audit" || !u || Y.value !== null || Z.value) && p.auditUrl) {
461
531
  Z.value = !0, ee.value = null;
462
532
  try {
463
- F.value = await lt(
464
- d.auditUrl,
533
+ Y.value = await rt(
534
+ p.auditUrl,
465
535
  a.meta.anchor
466
536
  );
467
537
  } catch (C) {
@@ -472,54 +542,54 @@ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
472
542
  }
473
543
  },
474
544
  { immediate: !0 }
475
- ), (f, o) => (l(), i(L, null, [
476
- V(r(re), {
477
- modelValue: m.value,
478
- "onUpdate:modelValue": o[3] || (o[3] = (C) => m.value = C),
479
- title: j.value,
545
+ ), (v, u) => (l(), o(L, null, [
546
+ D(r(re), {
547
+ modelValue: y.value,
548
+ "onUpdate:modelValue": u[3] || (u[3] = (C) => y.value = C),
549
+ title: M.value,
480
550
  width: 90,
481
551
  height: 90,
482
552
  "close-x": "",
483
- class: A(r(P))
553
+ class: R(r(z))
484
554
  }, {
485
555
  default: I(() => {
486
556
  var C;
487
557
  return [
488
- n("div", pt, [
489
- n("section", mt, [
490
- n("div", gt, [
491
- n("div", xt, [
492
- o[6] || (o[6] = n("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
493
- n("div", yt, y(me(s.value.value)), 1),
494
- n("div", bt, [
495
- o[5] || (o[5] = T(" source of truth: ", -1)),
496
- n("span", ht, y(s.value.source), 1)
558
+ i("div", xt, [
559
+ i("section", yt, [
560
+ i("div", bt, [
561
+ i("div", ht, [
562
+ u[6] || (u[6] = i("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
563
+ i("div", _t, m(me(s.value.value)), 1),
564
+ i("div", wt, [
565
+ u[5] || (u[5] = T(" source of truth: ", -1)),
566
+ i("span", kt, m(s.value.source), 1)
497
567
  ])
498
568
  ]),
499
- n("div", _t, [
500
- o[7] || (o[7] = n("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Extraction confidence ", -1)),
501
- n("div", wt, [
569
+ i("div", $t, [
570
+ u[7] || (u[7] = i("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Extraction confidence ", -1)),
571
+ i("div", St, [
502
572
  x.value != null ? (l(), N(r(we), {
503
573
  key: 0,
504
574
  value: x.value,
505
575
  max: 5,
506
576
  size: "md",
507
- variant: H[k.value],
577
+ variant: B[k.value],
508
578
  gradient: "",
509
579
  shimmer: "",
510
580
  "show-text": "",
511
581
  "text-position": "beside",
512
582
  label: `${x.value}/5`
513
- }, null, 8, ["value", "variant", "label"])) : (l(), i("div", kt, " No confidence recorded "))
583
+ }, null, 8, ["value", "variant", "label"])) : (l(), o("div", Ct, " No confidence recorded "))
514
584
  ]),
515
- n("div", {
516
- class: A(["tv-confidence-label mt-1 text-right text-xs font-medium", {
585
+ i("div", {
586
+ class: R(["tv-confidence-label mt-1 text-right text-xs font-medium", {
517
587
  "text-green-600": k.value === "high",
518
588
  "text-yellow-600": k.value === "medium",
519
589
  "text-red-600": k.value === "low",
520
590
  "text-gray-400": k.value === "unverifiable"
521
591
  }])
522
- }, y(r(ae)[k.value]), 3)
592
+ }, m(r(ae)[k.value]), 3)
523
593
  ])
524
594
  ]),
525
595
  e.meta.discrepancy ? (l(), N(r(ye), {
@@ -527,150 +597,150 @@ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
527
597
  variant: "warning",
528
598
  class: "tv-discrepancy"
529
599
  }, {
530
- default: I(() => [...o[8] || (o[8] = [
600
+ default: I(() => [...u[8] || (u[8] = [
531
601
  T(" Sources disagree on this value — review the candidates and pick a winner. ", -1)
532
602
  ])]),
533
603
  _: 1
534
- })) : _("", !0)
604
+ })) : b("", !0)
535
605
  ]),
536
- V(r(Le), {
537
- modelValue: E.value,
538
- "onUpdate:modelValue": o[0] || (o[0] = (v) => E.value = v),
606
+ D(r(je), {
607
+ modelValue: j.value,
608
+ "onUpdate:modelValue": u[0] || (u[0] = (c) => j.value = c),
539
609
  tabs: X.value,
540
610
  class: "tv-modal-tabs"
541
611
  }, null, 8, ["modelValue", "tabs"]),
542
- E.value === "evidence" ? (l(), i("section", $t, [
543
- S.value ? (l(), i("div", St, [
544
- o[9] || (o[9] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Reasoning ", -1)),
545
- V(r(je), {
612
+ j.value === "evidence" ? (l(), o("section", Vt, [
613
+ S.value ? (l(), o("div", Dt, [
614
+ u[9] || (u[9] = i("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Reasoning ", -1)),
615
+ D(r(Ee), {
546
616
  "model-value": S.value,
547
617
  readonly: "",
548
618
  class: "tv-reasoning"
549
619
  }, null, 8, ["model-value"])
550
- ])) : _("", !0),
551
- R.value ? (l(), i("blockquote", Ct, [
552
- T(" “" + y(R.value) + "” ", 1),
553
- V(r(J), {
554
- variant: (C = b.value) != null && C.cited_text_verified ? "success" : "muted",
620
+ ])) : b("", !0),
621
+ A.value ? (l(), o("blockquote", Ot, [
622
+ T(" “" + m(A.value) + "” ", 1),
623
+ D(r(J), {
624
+ variant: (C = h.value) != null && C.cited_text_verified ? "success" : "muted",
555
625
  size: "xxs",
556
626
  class: "tv-cited-verified ml-2 not-italic"
557
627
  }, {
558
628
  default: I(() => {
559
- var v;
629
+ var c;
560
630
  return [
561
- T(y((v = b.value) != null && v.cited_text_verified ? "✔ verified in source" : "unverified"), 1)
631
+ T(m((c = h.value) != null && c.cited_text_verified ? "✔ verified in source" : "unverified"), 1)
562
632
  ];
563
633
  }),
564
634
  _: 1
565
635
  }, 8, ["variant"])
566
- ])) : _("", !0),
567
- q.value.length ? (l(), i("div", Vt, [
568
- V(r(be), {
569
- file: q.value[0],
570
- "file-in-preview": p.value,
571
- "onUpdate:fileInPreview": o[1] || (o[1] = (v) => p.value = v),
572
- "related-files": q.value,
636
+ ])) : b("", !0),
637
+ F.value.length ? (l(), o("div", It, [
638
+ D(r(be), {
639
+ file: F.value[0],
640
+ "file-in-preview": Q.value,
641
+ "onUpdate:fileInPreview": u[1] || (u[1] = (c) => Q.value = c),
642
+ "related-files": F.value,
573
643
  "layout-toggles": ["sidebar", "continuous"],
574
644
  "default-sidebar": "",
575
645
  zoomable: "",
576
646
  "storage-key": "tv-evidence-viewer",
577
647
  class: "h-full min-h-0 flex-1"
578
648
  }, null, 8, ["file", "file-in-preview", "related-files"]),
579
- w.value ? (l(), i("div", Dt, y(w.value), 1)) : _("", !0)
580
- ])) : (l(), i("div", Ot, " No source pages recorded for this data point ")),
581
- D.value.length ? (l(), i("div", It, [
582
- o[10] || (o[10] = n("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Full documents:", -1)),
583
- (l(!0), i(L, null, M(D.value, (v) => (l(), N(r(se), {
584
- key: String(v.id),
649
+ f.value ? (l(), o("div", Tt, m(f.value), 1)) : b("", !0)
650
+ ])) : (l(), o("div", Ut, " No source pages recorded for this data point ")),
651
+ w.value.length ? (l(), o("div", Nt, [
652
+ u[10] || (u[10] = i("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Full documents:", -1)),
653
+ (l(!0), o(L, null, P(w.value, (c) => (l(), N(r(se), {
654
+ key: String(c.id),
585
655
  size: "sm",
586
656
  variant: "info",
587
657
  class: "tv-open-document",
588
- onClick: (xa) => z.value = v
658
+ onClick: (xa) => V.value = c
589
659
  }, {
590
660
  default: I(() => [
591
- T(y(v.name), 1)
661
+ T(m(c.name), 1)
592
662
  ]),
593
663
  _: 2
594
664
  }, 1032, ["onClick"]))), 128))
595
- ])) : _("", !0)
596
- ])) : _("", !0),
597
- E.value === "candidates" ? (l(), i("section", Tt, [
598
- (l(!0), i(L, null, M(Q.value, (v) => (l(), i("div", {
599
- key: v.key,
600
- class: A(["tv-candidate-row rounded-lg border p-4 transition-shadow", [
601
- v.winner ? "border-gray-300 bg-gray-50 shadow-sm" : "border-gray-200",
602
- e.meta.discrepancy && !v.winner ? "tv-candidate-disagrees border-amber-200" : ""
665
+ ])) : b("", !0)
666
+ ])) : b("", !0),
667
+ j.value === "candidates" ? (l(), o("section", Rt, [
668
+ (l(!0), o(L, null, P(W.value, (c) => (l(), o("div", {
669
+ key: c.key,
670
+ class: R(["tv-candidate-row rounded-lg border p-4 transition-shadow", [
671
+ c.winner ? "border-gray-300 bg-gray-50 shadow-sm" : "border-gray-200",
672
+ e.meta.discrepancy && !c.winner ? "tv-candidate-disagrees border-amber-200" : ""
603
673
  ]])
604
674
  }, [
605
- n("div", Ut, [
606
- n("div", Nt, [
607
- n("div", At, [
608
- V(r(J), {
609
- variant: v.variant,
675
+ i("div", At, [
676
+ i("div", Lt, [
677
+ i("div", jt, [
678
+ D(r(J), {
679
+ variant: c.variant,
610
680
  size: "xs"
611
681
  }, {
612
682
  default: I(() => [
613
- T(y(v.title), 1)
683
+ T(m(c.title), 1)
614
684
  ]),
615
685
  _: 2
616
686
  }, 1032, ["variant"]),
617
- v.winner ? (l(), N(r(J), {
687
+ c.winner ? (l(), N(r(J), {
618
688
  key: 0,
619
689
  variant: "success",
620
690
  size: "xxs",
621
691
  class: "tv-winner-chip"
622
692
  }, {
623
- default: I(() => [...o[11] || (o[11] = [
693
+ default: I(() => [...u[11] || (u[11] = [
624
694
  T("current value", -1)
625
695
  ])]),
626
696
  _: 1
627
- })) : _("", !0)
697
+ })) : b("", !0)
628
698
  ]),
629
- n("div", Rt, y(me(v.value)), 1),
630
- n("div", Lt, y(v.detail), 1)
699
+ i("div", Et, m(me(c.value)), 1),
700
+ i("div", zt, m(c.detail), 1)
631
701
  ]),
632
- v.accept && !v.winner ? (l(), N(r(se), {
702
+ c.accept && !c.winner ? (l(), N(r(se), {
633
703
  key: 0,
634
704
  size: "sm",
635
- variant: v.variant,
636
- loading: Y.value,
637
- class: A(`tv-accept-${v.key}`),
638
- onClick: v.accept
705
+ variant: c.variant,
706
+ loading: E.value,
707
+ class: R(`tv-accept-${c.key}`),
708
+ onClick: c.accept
639
709
  }, {
640
- default: I(() => [...o[12] || (o[12] = [
710
+ default: I(() => [...u[12] || (u[12] = [
641
711
  T("Accept this value", -1)
642
712
  ])]),
643
713
  _: 1
644
- }, 8, ["variant", "loading", "class", "onClick"])) : _("", !0)
714
+ }, 8, ["variant", "loading", "class", "onClick"])) : b("", !0)
645
715
  ])
646
716
  ], 2))), 128)),
647
- e.save ? (l(), i("div", jt, [
648
- V(r(Ee), {
649
- modelValue: B.value,
650
- "onUpdate:modelValue": o[2] || (o[2] = (v) => B.value = v),
717
+ e.save ? (l(), o("div", Pt, [
718
+ D(r(ze), {
719
+ modelValue: q.value,
720
+ "onUpdate:modelValue": u[2] || (u[2] = (c) => q.value = c),
651
721
  size: "sm",
652
722
  class: "tv-custom-input flex-1",
653
723
  placeholder: "Type the correct value…",
654
- disabled: Y.value
724
+ disabled: E.value
655
725
  }, null, 8, ["modelValue", "disabled"]),
656
- V(r(se), {
726
+ D(r(se), {
657
727
  variant: "success",
658
728
  size: "sm",
659
729
  class: "tv-accept-custom",
660
- loading: Y.value,
661
- disabled: !B.value,
662
- onClick: Ie
730
+ loading: E.value,
731
+ disabled: !q.value,
732
+ onClick: Te
663
733
  }, {
664
- default: I(() => [...o[13] || (o[13] = [
734
+ default: I(() => [...u[13] || (u[13] = [
665
735
  T("Save custom value", -1)
666
736
  ])]),
667
737
  _: 1
668
738
  }, 8, ["loading", "disabled"])
669
- ])) : (l(), i("div", Et, " Read-only render — corrections are disabled here "))
670
- ])) : _("", !0),
671
- E.value === "audit" ? (l(), i("section", zt, [
672
- Z.value ? (l(), i(L, { key: 0 }, M(2, (v) => V(r(ze), {
673
- key: v,
739
+ ])) : (l(), o("div", Mt, " Read-only render — corrections are disabled here "))
740
+ ])) : b("", !0),
741
+ j.value === "audit" ? (l(), o("section", Bt, [
742
+ Z.value ? (l(), o(L, { key: 0 }, P(2, (c) => D(r(Pe), {
743
+ key: c,
674
744
  shape: "rounded",
675
745
  class: "tv-audit-skeleton h-24 w-full"
676
746
  })), 64)) : ee.value ? (l(), N(r(ye), {
@@ -679,50 +749,50 @@ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
679
749
  class: "tv-audit-error"
680
750
  }, {
681
751
  default: I(() => [
682
- T(" Could not load the audit trail: " + y(ee.value), 1)
752
+ T(" Could not load the audit trail: " + m(ee.value), 1)
683
753
  ]),
684
754
  _: 1
685
- })) : F.value && F.value.length === 0 ? (l(), i("div", Pt, " No LLM calls recorded for this data point ")) : F.value ? (l(!0), i(L, { key: 3 }, M(F.value, (v) => (l(), N(ft, {
686
- key: String(v.id),
687
- call: v
688
- }, null, 8, ["call"]))), 128)) : _("", !0)
689
- ])) : _("", !0)
755
+ })) : Y.value && Y.value.length === 0 ? (l(), o("div", Ft, " No LLM calls recorded for this data point ")) : Y.value ? (l(!0), o(L, { key: 3 }, P(Y.value, (c) => (l(), N(gt, {
756
+ key: String(c.id),
757
+ call: c
758
+ }, null, 8, ["call"]))), 128)) : b("", !0)
759
+ ])) : b("", !0)
690
760
  ])
691
761
  ];
692
762
  }),
693
763
  _: 1
694
764
  }, 8, ["modelValue", "title", "class"]),
695
- z.value ? (l(), N(r(re), {
765
+ V.value ? (l(), N(r(re), {
696
766
  key: 0,
697
- modelValue: G.value,
698
- "onUpdate:modelValue": o[4] || (o[4] = (C) => G.value = C),
699
- title: z.value.name,
767
+ modelValue: K.value,
768
+ "onUpdate:modelValue": u[4] || (u[4] = (C) => K.value = C),
769
+ title: V.value.name,
700
770
  width: 90,
701
771
  height: 90,
702
772
  "close-x": "",
703
- class: A(r(P))
773
+ class: R(r(z))
704
774
  }, {
705
775
  default: I(() => [
706
- V(r(be), {
707
- file: z.value,
776
+ D(r(be), {
777
+ file: V.value,
708
778
  downloadable: "",
709
779
  zoomable: "",
710
780
  class: "tv-document-viewer h-full"
711
781
  }, null, 8, ["file"])
712
782
  ]),
713
783
  _: 1
714
- }, 8, ["modelValue", "title", "class"])) : _("", !0)
784
+ }, 8, ["modelValue", "title", "class"])) : b("", !0)
715
785
  ], 64));
716
786
  }
717
- }), Bt = { class: "tv-field inline-flex items-baseline gap-1" }, Ft = ["contenteditable", "data-editable"], qt = {
787
+ }), Yt = ["contenteditable", "data-editable"], Jt = {
718
788
  key: 1,
719
789
  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",
720
790
  "data-status": "verified"
721
- }, Yt = {
791
+ }, Kt = {
722
792
  key: 2,
723
793
  class: "tv-discrepancy-indicator ml-0.5 text-amber-500",
724
794
  "aria-label": "discrepancy"
725
- }, _a = /* @__PURE__ */ K({
795
+ }, _a = /* @__PURE__ */ H({
726
796
  __name: "VerifiedField",
727
797
  props: {
728
798
  source: {},
@@ -731,158 +801,109 @@ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
731
801
  format: { type: Function }
732
802
  },
733
803
  setup(e) {
734
- const t = e, a = le(), g = u(() => a.enabled.value), d = U(null), c = u(() => {
735
- var p;
736
- return d.value ? d.value : t.source && t.field ? ((p = t.source.__meta) == null ? void 0 : p[t.field]) ?? null : null;
737
- }), m = u(() => fe(c.value)), s = u(() => {
804
+ const t = e, a = le(), g = d(() => a.enabled.value), p = U(null), n = d(() => {
805
+ var f;
806
+ return p.value ? p.value : t.source && t.field ? ((f = t.source.__meta) == null ? void 0 : f[t.field]) ?? null : null;
807
+ }), y = d(() => fe(n.value)), s = d(() => {
738
808
  if (t.original !== void 0 && t.original !== null)
739
809
  return t.original;
740
- if (c.value && m.value.value !== null && m.value.value !== void 0)
741
- return m.value.value;
810
+ if (n.value && y.value.value !== null && y.value.value !== void 0)
811
+ return y.value.value;
742
812
  if (t.source && t.field) return t.source[t.field];
743
- }), b = u(() => {
744
- const p = s.value;
745
- return p == null ? "" : t.format ? t.format(p) : String(p);
746
- }), $ = u(
813
+ }), h = d(() => {
814
+ const f = s.value;
815
+ return f == null ? "" : typeof t.format == "function" ? t.format(f) : String(f);
816
+ }), $ = d(
747
817
  () => {
748
- var p, w, D;
749
- return ve((D = (w = (p = c.value) == null ? void 0 : p.candidates) == null ? void 0 : w.extracted) == null ? void 0 : D.confidence);
818
+ var f, w, V;
819
+ return ve((V = (w = (f = n.value) == null ? void 0 : f.candidates) == null ? void 0 : w.extracted) == null ? void 0 : V.confidence);
750
820
  }
751
- ), h = u(() => Ve(c.value)), x = u(() => {
752
- var p, w;
753
- return !!((w = (p = c.value) == null ? void 0 : p.candidates) != null && w.override);
754
- }), k = u(() => {
821
+ ), _ = d(() => Ve(n.value)), x = d(() => {
822
+ var f, w;
823
+ return !!((w = (f = n.value) == null ? void 0 : f.candidates) != null && w.override);
824
+ }), k = d(() => {
755
825
  var w;
756
- const p = (w = c.value) == null ? void 0 : w.candidates;
757
- return !!(p != null && p.override || p != null && p.extracted || p != null && p.claim);
758
- }), S = u(() => g.value && !!c.value), R = u(() => {
759
- var G, Q, B;
760
- const p = (Q = (G = c.value) == null ? void 0 : G.candidates) == null ? void 0 : Q.extracted;
761
- if (!p) return "No verification data";
762
- const w = [], D = ae[$.value];
826
+ const f = (w = n.value) == null ? void 0 : w.candidates;
827
+ return !!(f != null && f.override || f != null && f.extracted || f != null && f.claim);
828
+ }), S = d(() => g.value && !!n.value), A = d(
829
+ () => S.value && !!n.value && Oe(n.value)
830
+ ), O = d(() => {
831
+ var W, q, E;
832
+ const f = (q = (W = n.value) == null ? void 0 : W.candidates) == null ? void 0 : q.extracted;
833
+ if (!f) return "No verification data";
834
+ const w = [], V = ae[$.value];
763
835
  w.push(
764
- p.confidence != null ? `${D} (${p.confidence}/5)` : D
836
+ f.confidence != null ? `${V} (${f.confidence}/5)` : V
765
837
  );
766
- const z = ((B = p.sources) == null ? void 0 : B.length) ?? 0;
767
- return z > 0 && w.push(`${z} source ${z === 1 ? "page" : "pages"}`), h.value && w.push("sources disagree"), w.join(" · ");
838
+ const K = ((E = f.sources) == null ? void 0 : E.length) ?? 0;
839
+ return K > 0 && w.push(`${K} source ${K === 1 ? "page" : "pages"}`), _.value && w.push("sources disagree"), w.join(" · ");
768
840
  });
769
- function O(p) {
841
+ function M(f) {
770
842
  var w;
771
- d.value = p, (w = t.source) != null && w.__meta && t.field && (t.source.__meta[t.field] = p);
843
+ p.value = f, (w = t.source) != null && w.__meta && t.field && (t.source.__meta[t.field] = f);
772
844
  }
773
- const j = u(() => Ze(a, c, O)), H = u(() => !!j.value), E = U(!1), W = U(!1);
774
- function X() {
775
- c.value && (E.value = !0);
845
+ const B = d(() => at(a, n, M)), j = d(() => !!B.value), G = U(!1), X = U(!1);
846
+ function F() {
847
+ n.value && (G.value = !0);
776
848
  }
777
- async function q(p) {
778
- W.value = !1;
779
- const D = (p.target.textContent ?? "").trim();
780
- !j.value || D === b.value || await j.value(D, "custom");
849
+ async function Q(f) {
850
+ X.value = !1;
851
+ const V = (f.target.textContent ?? "").trim();
852
+ !B.value || V === h.value || await B.value(V, "custom");
781
853
  }
782
- return (p, w) => (l(), i("span", Bt, [
783
- n("span", {
784
- class: A([
854
+ return (f, w) => (l(), o("span", {
855
+ class: R(["tv-field inline-flex items-baseline gap-1", A.value ? "tv-needs-review" : ""])
856
+ }, [
857
+ i("span", {
858
+ class: R([
785
859
  "tv-field-value",
786
860
  S.value && !k.value ? "tv-field-unverified cursor-pointer border-b border-dotted border-gray-300" : ""
787
861
  ]),
788
- contenteditable: H.value,
789
- "data-editable": H.value ? "true" : "false",
790
- onFocus: w[0] || (w[0] = (D) => W.value = !0),
791
- onBlur: q,
792
- onKeydown: w[1] || (w[1] = Te(Ue((D) => D.target.blur(), ["prevent"]), ["enter"])),
793
- onClick: w[2] || (w[2] = (D) => S.value && !k.value ? X() : void 0)
862
+ contenteditable: j.value,
863
+ "data-editable": j.value ? "true" : "false",
864
+ onFocus: w[0] || (w[0] = (V) => X.value = !0),
865
+ onBlur: Q,
866
+ onKeydown: w[1] || (w[1] = Ue(Ne((V) => V.target.blur(), ["prevent"]), ["enter"])),
867
+ onClick: w[2] || (w[2] = (V) => S.value && !k.value ? F() : void 0)
794
868
  }, [
795
- Ne(p.$slots, "default", {
869
+ Re(f.$slots, "default", {
796
870
  value: s.value,
797
- formatted: b.value
871
+ formatted: h.value
798
872
  }, () => [
799
- T(y(b.value), 1)
873
+ T(m(h.value), 1)
800
874
  ])
801
- ], 42, Ft),
802
- S.value && k.value ? (l(), N(r(Pe), {
875
+ ], 42, Yt),
876
+ S.value && k.value ? (l(), N(r(Me), {
803
877
  key: 0,
804
- tooltip: R.value,
878
+ tooltip: O.value,
805
879
  placement: "top"
806
880
  }, {
807
881
  trigger: I(() => [
808
- n("button", {
882
+ i("button", {
809
883
  type: "button",
810
- class: A(["tv-overlay inline-flex cursor-pointer items-center align-middle transition-transform duration-150 hover:scale-110", r(P)]),
811
- onClick: X
884
+ class: R(["tv-overlay inline-flex cursor-pointer items-center align-middle transition-transform duration-150 hover:scale-110", r(z)]),
885
+ onClick: F
812
886
  }, [
813
- x.value ? (l(), i("span", qt, "✔")) : (l(), N(ue, {
887
+ x.value ? (l(), o("span", Jt, "✔")) : (l(), N(de, {
814
888
  key: 0,
815
889
  status: $.value
816
890
  }, null, 8, ["status"])),
817
- h.value && !x.value ? (l(), i("span", Yt, "⚠")) : _("", !0)
891
+ _.value && !x.value ? (l(), o("span", Kt, "⚠")) : b("", !0)
818
892
  ], 2)
819
893
  ]),
820
894
  _: 1
821
- }, 8, ["tooltip"])) : _("", !0),
822
- c.value ? (l(), N(Mt, {
895
+ }, 8, ["tooltip"])) : b("", !0),
896
+ n.value ? (l(), N(qt, {
823
897
  key: 1,
824
- modelValue: E.value,
825
- "onUpdate:modelValue": w[3] || (w[3] = (D) => E.value = D),
826
- meta: c.value,
898
+ modelValue: G.value,
899
+ "onUpdate:modelValue": w[3] || (w[3] = (V) => G.value = V),
900
+ meta: n.value,
827
901
  label: e.field,
828
- save: j.value
829
- }, null, 8, ["modelValue", "meta", "label", "save"])) : _("", !0)
830
- ]));
831
- }
832
- }), Jt = /* @__PURE__ */ new Set(["name", "type"]);
833
- function Oe(e, t = "") {
834
- const a = [];
835
- return de(e, t, a), a;
836
- }
837
- function de(e, t, a) {
838
- if (Array.isArray(e)) {
839
- e.forEach((c, m) => de(c, `${t}[${m}]`, a));
840
- return;
841
- }
842
- if (!he(e)) return;
843
- const d = e.__meta ?? {};
844
- for (const [c, m] of Object.entries(e)) {
845
- if (c === "__meta") continue;
846
- const s = t ? `${t}.${c}` : c;
847
- if (Array.isArray(m) || he(m)) {
848
- de(m, s, a);
849
- continue;
850
- }
851
- const b = d[c];
852
- !b && Jt.has(c) || a.push({
853
- path: s,
854
- label: c,
855
- meta: b ?? null,
856
- value: m,
857
- unanchored: !b
858
- });
902
+ save: B.value
903
+ }, null, 8, ["modelValue", "meta", "label", "save"])) : b("", !0)
904
+ ], 2));
859
905
  }
860
- }
861
- function he(e) {
862
- return typeof e == "object" && e !== null && !Array.isArray(e);
863
- }
864
- function Kt(e) {
865
- var c;
866
- const t = Oe(e).filter(
867
- (m) => m.meta !== null
868
- ), a = t.length;
869
- let g = 0, d = 0;
870
- for (const m of t) {
871
- if (m.meta.candidates.override) {
872
- g++;
873
- continue;
874
- }
875
- const s = (c = m.meta.candidates.extracted) == null ? void 0 : c.confidence;
876
- (m.meta.discrepancy || s == null || s <= 2) && d++;
877
- }
878
- return {
879
- total: a,
880
- verified: g,
881
- needsReview: d,
882
- percent: a === 0 ? 100 : Math.round(g / a * 100)
883
- };
884
- }
885
- const Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
906
+ }), Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
886
907
  key: 0,
887
908
  class: "tv-comparison-empty text-gray-400"
888
909
  }, Qt = {
@@ -900,104 +921,102 @@ const Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
900
921
  }, sa = { class: "tv-datapoint-sources ml-4 text-xs text-gray-500" }, ra = ["href"], ia = { key: 1 }, oa = { class: "ml-1" }, ua = {
901
922
  key: 2,
902
923
  class: "tv-unanchored-group flex flex-col gap-1"
903
- }, da = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, ca = { class: "tv-datapoint-value" }, va = /* @__PURE__ */ K({
924
+ }, da = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, ca = { class: "tv-datapoint-value" }, va = /* @__PURE__ */ H({
904
925
  __name: "ComparisonPage",
905
926
  setup(e) {
906
- const t = le(), a = u(() => Oe(t.data)), g = u(() => a.value.filter(($) => !$.unanchored)), d = u(() => a.value.filter(($) => $.unanchored));
907
- function c($) {
908
- const h = fe($).value;
909
- return h == null ? "" : String(h);
927
+ const t = le(), a = d(() => De(t.data)), g = d(() => a.value.filter(($) => !$.unanchored)), p = d(() => a.value.filter(($) => $.unanchored));
928
+ function n($) {
929
+ const _ = fe($).value;
930
+ return _ == null ? "" : String(_);
910
931
  }
911
- function m($) {
932
+ function y($) {
912
933
  return $ == null ? "" : String($);
913
934
  }
914
935
  function s($) {
915
- var h, x, k;
916
- return (k = (x = (h = $.meta) == null ? void 0 : h.candidates) == null ? void 0 : x.extracted) == null ? void 0 : k.confidence;
936
+ var _, x, k;
937
+ return (k = (x = (_ = $.meta) == null ? void 0 : _.candidates) == null ? void 0 : x.extracted) == null ? void 0 : k.confidence;
917
938
  }
918
- function b($) {
939
+ function h($) {
919
940
  var k;
920
- const h = (k = $.meta) == null ? void 0 : k.candidates;
921
- if (!h) return [];
941
+ const _ = (k = $.meta) == null ? void 0 : k.candidates;
942
+ if (!_) return [];
922
943
  const x = [];
923
- return h.override && x.push({ source: "override", value: h.override.value }), h.extracted && x.push({ source: "extracted", value: h.extracted.value }), h.claim && x.push({ source: "claim", value: h.claim.value }), x;
944
+ return _.override && x.push({ source: "override", value: _.override.value }), _.extracted && x.push({ source: "extracted", value: _.extracted.value }), _.claim && x.push({ source: "claim", value: _.claim.value }), x;
924
945
  }
925
- return ($, h) => (l(), i("div", Ht, [
926
- h[1] || (h[1] = n("h2", { class: "tv-comparison-title text-lg font-semibold" }, "Verification comparison", -1)),
927
- a.value.length === 0 ? (l(), i("p", Gt, " No data points to compare. ")) : _("", !0),
928
- g.value.length ? (l(), i("section", Qt, [
929
- (l(!0), i(L, null, M(g.value, (x) => {
930
- var k, S, R;
931
- return l(), i("div", {
946
+ return ($, _) => (l(), o("div", Ht, [
947
+ _[1] || (_[1] = i("h2", { class: "tv-comparison-title text-lg font-semibold" }, "Verification comparison", -1)),
948
+ a.value.length === 0 ? (l(), o("p", Gt, " No data points to compare. ")) : b("", !0),
949
+ g.value.length ? (l(), o("section", Qt, [
950
+ (l(!0), o(L, null, P(g.value, (x) => {
951
+ var k, S, A;
952
+ return l(), o("div", {
932
953
  key: x.path,
933
954
  class: "tv-datapoint border-t border-gray-100 pt-2"
934
955
  }, [
935
- n("div", Wt, [
936
- n("span", Xt, y(x.path), 1),
937
- n("span", Zt, y(c(x.meta)), 1),
938
- V(ue, {
956
+ i("div", Wt, [
957
+ i("span", Xt, m(x.path), 1),
958
+ i("span", Zt, m(n(x.meta)), 1),
959
+ D(de, {
939
960
  confidence: s(x),
940
961
  "show-label": ""
941
962
  }, null, 8, ["confidence"]),
942
- r(Ve)(x.meta) ? (l(), i("span", ea, "⚠ discrepancy")) : _("", !0)
963
+ r(Ve)(x.meta) ? (l(), o("span", ea, "⚠ discrepancy")) : b("", !0)
943
964
  ]),
944
- n("ul", ta, [
945
- (l(!0), i(L, null, M(b(x), (O) => (l(), i("li", {
965
+ i("ul", ta, [
966
+ (l(!0), o(L, null, P(h(x), (O) => (l(), o("li", {
946
967
  key: O.source,
947
968
  class: "tv-candidate"
948
969
  }, [
949
- n("span", aa, y(O.source) + ":", 1),
950
- T(" " + y(m(O.value)), 1)
970
+ i("span", aa, m(O.source) + ":", 1),
971
+ T(" " + m(y(O.value)), 1)
951
972
  ]))), 128))
952
973
  ]),
953
- r(ie)(x.meta) ? (l(), i("p", la, y(r(ie)(x.meta)), 1)) : _("", !0),
954
- r(oe)(x.meta) ? (l(), i("p", na, " “" + y(r(oe)(x.meta)) + "” ", 1)) : _("", !0),
955
- n("ul", sa, [
956
- (l(!0), i(L, null, M(r(De)((R = (S = (k = x.meta) == null ? void 0 : k.candidates) == null ? void 0 : S.extracted) == null ? void 0 : R.sources), (O, j) => (l(), i("li", {
957
- key: j,
974
+ r(ie)(x.meta) ? (l(), o("p", la, m(r(ie)(x.meta)), 1)) : b("", !0),
975
+ r(oe)(x.meta) ? (l(), o("p", na, " “" + m(r(oe)(x.meta)) + "” ", 1)) : b("", !0),
976
+ i("ul", sa, [
977
+ (l(!0), o(L, null, P(r(Ie)((A = (S = (k = x.meta) == null ? void 0 : k.candidates) == null ? void 0 : S.extracted) == null ? void 0 : A.sources), (O, M) => (l(), o("li", {
978
+ key: M,
958
979
  class: "tv-source-group"
959
980
  }, [
960
- O.fileUrl ? (l(), i("a", {
981
+ O.fileUrl ? (l(), o("a", {
961
982
  key: 0,
962
983
  href: O.fileUrl,
963
984
  class: "tv-source-link text-blue-600 underline",
964
985
  target: "_blank",
965
986
  rel: "noopener"
966
- }, y(O.fileLabel), 9, ra)) : (l(), i("span", ia, y(O.fileLabel), 1)),
967
- n("span", oa, "(" + y(O.sources.map(r(rt)).join(", ")) + ")", 1)
987
+ }, m(O.fileLabel), 9, ra)) : (l(), o("span", ia, m(O.fileLabel), 1)),
988
+ i("span", oa, "(" + m(O.sources.map(r(ut)).join(", ")) + ")", 1)
968
989
  ]))), 128))
969
990
  ])
970
991
  ]);
971
992
  }), 128))
972
- ])) : _("", !0),
973
- d.value.length ? (l(), i("section", ua, [
974
- h[0] || (h[0] = n("h3", { class: "tv-unanchored-title text-sm font-semibold text-gray-500" }, " Unanchored / not from source ", -1)),
975
- (l(!0), i(L, null, M(d.value, (x) => (l(), i("div", {
993
+ ])) : b("", !0),
994
+ p.value.length ? (l(), o("section", ua, [
995
+ _[0] || (_[0] = i("h3", { class: "tv-unanchored-title text-sm font-semibold text-gray-500" }, " Unanchored / not from source ", -1)),
996
+ (l(!0), o(L, null, P(p.value, (x) => (l(), o("div", {
976
997
  key: x.path,
977
998
  class: "tv-unanchored-datapoint flex items-center gap-2 text-sm"
978
999
  }, [
979
- n("span", da, y(x.path), 1),
980
- n("span", ca, y(m(x.value)), 1),
981
- V(ue, { status: "unverifiable" })
1000
+ i("span", da, m(x.path), 1),
1001
+ i("span", ca, m(y(x.value)), 1),
1002
+ D(de, { status: "unverifiable" })
982
1003
  ]))), 128))
983
- ])) : _("", !0)
1004
+ ])) : b("", !0)
984
1005
  ]));
985
1006
  }
986
- }), fa = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, pa = { class: "tv-progress-block" }, ma = { class: "mb-1 flex items-baseline justify-between" }, ga = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, wa = /* @__PURE__ */ K({
1007
+ }), fa = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, pa = { class: "tv-progress-block" }, ma = { class: "mb-1 flex items-baseline justify-between" }, ga = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, wa = /* @__PURE__ */ H({
987
1008
  __name: "VerificationChrome",
988
1009
  setup(e) {
989
- const t = le(), { enabled: a, openComparison: g } = t, d = He(), c = _e(), m = U(!1), s = u(() => Kt(t.data)), b = U(!1);
1010
+ const t = le(), { enabled: a, openComparison: g } = t, p = Ge(), n = _e(), y = U(!1), s = d(() => tt(t.data)), h = U(!1);
990
1011
  ce(
991
1012
  () => s.value.percent,
992
1013
  (k) => {
993
- k === 100 && s.value.total > 0 && !b.value && (b.value = !0, c.success("All data points verified 🎯"));
1014
+ k === 100 && s.value.total > 0 && !h.value && (h.value = !0, n.success("All data points verified 🎯"));
994
1015
  }
995
1016
  );
996
1017
  let $ = 0;
997
- function h() {
998
- const k = document.querySelectorAll(
999
- ".tv-discrepancy-indicator, .tv-confidence-icon[data-status='low'], .tv-confidence-icon[data-status='unverifiable']"
1000
- );
1018
+ function _() {
1019
+ const k = document.querySelectorAll(".tv-needs-review");
1001
1020
  if (!k.length) return;
1002
1021
  $ = $ % k.length;
1003
1022
  const S = k[$];
@@ -1010,47 +1029,47 @@ const Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
1010
1029
  );
1011
1030
  }
1012
1031
  function x() {
1013
- g(), m.value = !1;
1032
+ g(), y.value = !1;
1014
1033
  }
1015
- return (k, S) => (l(), i(L, null, [
1016
- n("button", {
1034
+ return (k, S) => (l(), o(L, null, [
1035
+ i("button", {
1017
1036
  type: "button",
1018
- class: A(["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", r(P)]),
1037
+ class: R(["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", r(z)]),
1019
1038
  title: "Verification",
1020
- onClick: S[0] || (S[0] = (R) => m.value = !m.value)
1039
+ onClick: S[0] || (S[0] = (A) => y.value = !y.value)
1021
1040
  }, [
1022
- V(r(Me), {
1023
- icon: r(Be),
1041
+ D(r(Be), {
1042
+ icon: r(Fe),
1024
1043
  class: "h-5 w-5"
1025
1044
  }, null, 8, ["icon"]),
1026
- r(a) && s.value.needsReview > 0 ? (l(), N(r(Fe), {
1045
+ r(a) && s.value.needsReview > 0 ? (l(), N(r(qe), {
1027
1046
  key: 0,
1028
1047
  value: s.value.needsReview,
1029
1048
  variant: "warning",
1030
1049
  class: "tv-needs-review-badge absolute -right-1 -top-1"
1031
- }, null, 8, ["value"])) : _("", !0)
1050
+ }, null, 8, ["value"])) : b("", !0)
1032
1051
  ], 2),
1033
- m.value ? (l(), i("div", {
1052
+ y.value ? (l(), o("div", {
1034
1053
  key: 0,
1035
- class: A(["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", r(P)])
1054
+ class: R(["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", r(z)])
1036
1055
  }, [
1037
- n("label", fa, [
1038
- S[3] || (S[3] = n("span", null, "Verification overlay", -1)),
1039
- Ae(n("input", {
1040
- "onUpdate:modelValue": S[1] || (S[1] = (R) => ge(a) ? a.value = R : null),
1056
+ i("label", fa, [
1057
+ S[3] || (S[3] = i("span", null, "Verification overlay", -1)),
1058
+ Ae(i("input", {
1059
+ "onUpdate:modelValue": S[1] || (S[1] = (A) => ge(a) ? a.value = A : null),
1041
1060
  type: "checkbox",
1042
1061
  class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
1043
1062
  }, null, 512), [
1044
- [Re, r(a)]
1063
+ [Le, r(a)]
1045
1064
  ])
1046
1065
  ]),
1047
- r(a) && s.value.total > 0 ? (l(), i(L, { key: 0 }, [
1048
- n("div", pa, [
1049
- n("div", ma, [
1050
- S[4] || (S[4] = n("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
1051
- n("span", ga, y(s.value.verified) + " / " + y(s.value.total), 1)
1066
+ r(a) && s.value.total > 0 ? (l(), o(L, { key: 0 }, [
1067
+ i("div", pa, [
1068
+ i("div", ma, [
1069
+ S[4] || (S[4] = i("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
1070
+ i("span", ga, m(s.value.verified) + " / " + m(s.value.total), 1)
1052
1071
  ]),
1053
- V(r(we), {
1072
+ D(r(we), {
1054
1073
  value: s.value.verified,
1055
1074
  max: s.value.total,
1056
1075
  size: "md",
@@ -1061,64 +1080,64 @@ const Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
1061
1080
  gradient: ""
1062
1081
  }, null, 8, ["value", "max", "variant", "striped", "animate-stripes", "glow"])
1063
1082
  ]),
1064
- s.value.needsReview > 0 ? (l(), i("button", {
1083
+ s.value.needsReview > 0 ? (l(), o("button", {
1065
1084
  key: 0,
1066
1085
  type: "button",
1067
- class: A(["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", r(P)]),
1068
- onClick: h
1086
+ class: R(["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", r(z)]),
1087
+ onClick: _
1069
1088
  }, [
1070
- n("span", null, y(s.value.needsReview) + " need" + y(s.value.needsReview === 1 ? "s" : "") + " review", 1),
1071
- S[5] || (S[5] = n("span", { "aria-hidden": "true" }, "→", -1))
1072
- ], 2)) : _("", !0)
1073
- ], 64)) : _("", !0),
1074
- n("button", {
1089
+ i("span", null, m(s.value.needsReview) + " need" + m(s.value.needsReview === 1 ? "s" : "") + " review", 1),
1090
+ S[5] || (S[5] = i("span", { "aria-hidden": "true" }, "→", -1))
1091
+ ], 2)) : b("", !0)
1092
+ ], 64)) : b("", !0),
1093
+ i("button", {
1075
1094
  type: "button",
1076
- class: A(["tv-open-comparison rounded-lg border border-gray-200 px-3 py-2 text-sm font-medium text-gray-600 transition hover:bg-gray-50", r(P)]),
1095
+ class: R(["tv-open-comparison rounded-lg border border-gray-200 px-3 py-2 text-sm font-medium text-gray-600 transition hover:bg-gray-50", r(z)]),
1077
1096
  onClick: x
1078
1097
  }, " Open comparison page ", 2)
1079
- ], 2)) : _("", !0),
1080
- V(r(re), {
1081
- modelValue: r(d),
1082
- "onUpdate:modelValue": S[2] || (S[2] = (R) => ge(d) ? d.value = R : null),
1098
+ ], 2)) : b("", !0),
1099
+ D(r(re), {
1100
+ modelValue: r(p),
1101
+ "onUpdate:modelValue": S[2] || (S[2] = (A) => ge(p) ? p.value = A : null),
1083
1102
  title: "Verification comparison",
1084
1103
  width: 80,
1085
1104
  "close-x": "",
1086
- class: A(r(P))
1105
+ class: R(r(z))
1087
1106
  }, {
1088
1107
  default: I(() => [
1089
- V(va)
1108
+ D(va)
1090
1109
  ]),
1091
1110
  _: 1
1092
1111
  }, 8, ["modelValue", "class"]),
1093
- V(r(qe), {
1094
- class: A(r(P))
1112
+ D(r(Ye), {
1113
+ class: R(r(z))
1095
1114
  }, null, 8, ["class"])
1096
1115
  ], 64));
1097
1116
  }
1098
1117
  });
1099
1118
  export {
1100
- P as CHROME_CLASS,
1119
+ z as CHROME_CLASS,
1101
1120
  va as ComparisonPage,
1102
- ue as ConfidenceIcon,
1121
+ de as ConfidenceIcon,
1103
1122
  ke as ENABLED_STORAGE_KEY,
1104
1123
  Ce as RESOLUTION_PRIORITY,
1105
- Ge as STATUS_COLORS,
1124
+ Qe as STATUS_COLORS,
1106
1125
  ae as STATUS_LABELS,
1107
1126
  wa as VerificationChrome,
1108
- Mt as VerificationModal,
1127
+ qt as VerificationModal,
1109
1128
  _a as VerifiedField,
1110
1129
  ve as bucketConfidence,
1111
- We as candidatesDisagree,
1130
+ Xe as candidatesDisagree,
1112
1131
  oe as citedTextOf,
1113
- Kt as computeProgress,
1114
- lt as fetchDataPointAudit,
1115
- De as groupSources,
1132
+ tt as computeProgress,
1133
+ rt as fetchDataPointAudit,
1134
+ Ie as groupSources,
1116
1135
  Ve as hasDiscrepancy,
1117
1136
  ha as initVerification,
1118
1137
  ie as reasoningOf,
1119
- Qe as resolveCandidates,
1138
+ We as resolveCandidates,
1120
1139
  fe as resolveDataPoint,
1121
- rt as sourceRowLabel,
1140
+ ut as sourceRowLabel,
1122
1141
  le as useVerification,
1123
- Oe as walkDataPoints
1142
+ De as walkDataPoints
1124
1143
  };