@thehammer/template-verification 0.2.8 → 0.2.10

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,6 +1,6 @@
1
- import { ref as j, watch as ae, defineComponent as Q, computed as g, openBlock as a, createElementBlock as s, normalizeClass as A, createElementVNode as o, toDisplayString as i, createCommentVNode as p, createBlock as E, unref as u, withCtx as O, createTextVNode as I, createVNode as D, Fragment as U, renderList as F, renderSlot as me, onBeforeUnmount as Qe, withKeys as We, withModifiers as ve, withDirectives as Xe, isRef as Ie, vModelCheckbox as Ze } from "vue";
2
- import { DanxChip as K, CodeViewer as De, DanxFile as et, DanxButton as ie, DanxDialog as be, DanxFileViewer as tt, DanxAlert as ge, DanxTooltip as we, useToast as Ae, DanxProgressBar as ze, DanxTabs as at, DanxInput as nt, DanxSkeleton as je, DanxIcon as lt, gearIcon as st, DanxBadge as ot, DanxToastContainer as it } from "@thehammer/danx-ui";
3
- const W = "tv-chrome", Re = "template-verification:enabled";
1
+ import { ref as O, watch as ae, defineComponent as J, computed as g, openBlock as l, createElementBlock as c, normalizeClass as A, createElementVNode as i, toDisplayString as v, createCommentVNode as h, createBlock as V, unref as f, withCtx as S, createTextVNode as N, createVNode as I, Fragment as B, renderList as H, renderSlot as xe, onBeforeUnmount as Ge, withKeys as Qe, withModifiers as ye, withDirectives as We, isRef as Xe, vModelCheckbox as Ze } from "vue";
2
+ import { DanxChip as M, CodeViewer as qe, DanxFile as et, DanxButton as re, DanxDialog as Oe, DanxFileViewer as tt, DanxAlert as ge, DanxTooltip as be, useToast as Le, DanxProgressBar as Ae, DanxTabs as at, DanxSkeleton as ve, DanxInput as lt, DanxIcon as nt, gearIcon as st, DanxBadge as it, DanxToastContainer as ot } from "@thehammer/danx-ui";
3
+ const ee = "tv-chrome", ze = "template-verification:enabled";
4
4
  let fe = null;
5
5
  function rt(e) {
6
6
  var t;
@@ -11,54 +11,47 @@ function rt(e) {
11
11
  }
12
12
  }
13
13
  function ut(e, t) {
14
- var n;
14
+ var a;
15
15
  try {
16
- (n = globalThis.localStorage) == null || n.setItem(e, t);
16
+ (a = globalThis.localStorage) == null || a.setItem(e, t);
17
17
  } catch {
18
18
  }
19
19
  }
20
20
  function dt(e) {
21
- const t = rt(Re);
21
+ const t = rt(ze);
22
22
  return t === null ? e : t === "true";
23
23
  }
24
- function Ue(e) {
25
- const t = j(dt((e == null ? void 0 : e.defaultEnabled) ?? !1));
24
+ function Pe(e) {
25
+ const t = O(dt((e == null ? void 0 : e.defaultEnabled) ?? !1));
26
26
  return ae(
27
27
  t,
28
- (n) => ut(Re, n ? "true" : "false")
28
+ (a) => ut(ze, a ? "true" : "false")
29
29
  ), {
30
30
  enabled: t,
31
31
  data: (e == null ? void 0 : e.data) ?? {},
32
32
  saveOverride: e == null ? void 0 : e.saveOverride,
33
33
  workflowInputId: e == null ? void 0 : e.workflowInputId,
34
- auditUrl: e == null ? void 0 : e.auditUrl,
35
- loading: (e == null ? void 0 : e.loading) ?? !1,
36
- comparisonOpen: j(!1)
34
+ detailUrl: e == null ? void 0 : e.detailUrl,
35
+ loading: (e == null ? void 0 : e.loading) ?? !1
37
36
  };
38
37
  }
39
- function Be() {
40
- return fe || (fe = Ue()), fe;
38
+ function ct() {
39
+ return fe || (fe = Pe()), fe;
41
40
  }
42
- function Un(e) {
43
- fe = Ue(e);
41
+ function pl(e) {
42
+ fe = Pe(e);
44
43
  }
45
- function pe() {
46
- const e = Be();
44
+ function we() {
45
+ const e = ct();
47
46
  return {
48
47
  enabled: e.enabled,
49
48
  data: e.data,
50
49
  saveOverride: e.saveOverride,
51
50
  workflowInputId: e.workflowInputId,
52
- auditUrl: e.auditUrl,
53
- loading: e.loading,
54
- openComparison: () => {
55
- e.comparisonOpen.value = !0;
56
- }
51
+ detailUrl: e.detailUrl,
52
+ loading: e.loading
57
53
  };
58
54
  }
59
- function ct() {
60
- return Be().comparisonOpen;
61
- }
62
55
  function _e(e) {
63
56
  return typeof e != "number" || Number.isNaN(e) ? "unverifiable" : e <= 2 ? "low" : e === 3 ? "medium" : "high";
64
57
  }
@@ -70,124 +63,124 @@ const vt = {
70
63
  // Same red family as 'low' (color-family-per-status is load-bearing, see docblock
71
64
  // above) but a visibly darker/more saturated shade so the two stay distinguishable.
72
65
  failed: "bg-red-100 text-red-800 ring-1 ring-inset ring-red-700/30"
73
- }, G = {
66
+ }, K = {
74
67
  high: "High",
75
68
  medium: "Medium",
76
69
  low: "Low",
77
70
  unverifiable: "Unverifiable",
78
71
  failed: "Failed"
79
- }, Me = ["override", "extracted", "claim"];
80
- function ke(e) {
72
+ }, je = ["override", "extracted", "claim"];
73
+ function Re(e) {
81
74
  return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : ft(e.candidates) : { value: null, source: "none" };
82
75
  }
83
76
  function ft(e) {
84
77
  if (e)
85
- for (const t of Me) {
86
- const n = e[t];
87
- if (n != null)
88
- return { value: n.value, source: t };
78
+ for (const t of je) {
79
+ const a = e[t];
80
+ if (a != null)
81
+ return { value: a.value, source: t };
89
82
  }
90
83
  return { value: null, source: "none" };
91
84
  }
92
- function xe(e) {
93
- var w, b;
94
- const t = (b = (w = e == null ? void 0 : e.candidates) == null ? void 0 : w.extracted) == null ? void 0 : b.reasoning;
85
+ function ml(e) {
86
+ var b, y;
87
+ const t = (y = (b = e == null ? void 0 : e.candidates) == null ? void 0 : b.extracted) == null ? void 0 : y.reasoning;
95
88
  if (t == null) return null;
96
- const n = String(t).trim();
97
- return n === "" ? null : n;
98
- }
99
- function Fe(e) {
100
- return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : gt(e.candidates) : !1;
89
+ const a = String(t).trim();
90
+ return a === "" ? null : a;
101
91
  }
102
92
  function gt(e) {
93
+ return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : pt(e.candidates) : !1;
94
+ }
95
+ function pt(e) {
103
96
  if (!e) return !1;
104
- const t = Me.map((n) => e[n]).filter((n) => n != null).map((n) => pt(n.value));
97
+ const t = je.map((a) => e[a]).filter((a) => a != null).map((a) => mt(a.value));
105
98
  return t.length < 2 ? !1 : new Set(t).size > 1;
106
99
  }
107
- function pt(e) {
100
+ function mt(e) {
108
101
  return JSON.stringify(e ?? null);
109
102
  }
110
- const mt = /* @__PURE__ */ new Set(["name", "type"]);
111
- function $e(e, t = "") {
112
- const n = [];
113
- return he(e, t, n), n;
103
+ const xt = /* @__PURE__ */ new Set(["name", "type"]);
104
+ function Ue(e, t = "") {
105
+ const a = [];
106
+ return he(e, t, a), a;
114
107
  }
115
- function he(e, t, n) {
108
+ function he(e, t, a) {
116
109
  if (Array.isArray(e)) {
117
- e.forEach((c, r) => he(c, `${t}[${r}]`, n));
110
+ e.forEach((s, r) => he(s, `${t}[${r}]`, a));
118
111
  return;
119
112
  }
120
- if (!Te(e)) return;
121
- const b = e.__meta ?? {};
122
- for (const [c, r] of Object.entries(e)) {
123
- if (c === "__meta") continue;
124
- const l = t ? `${t}.${c}` : c;
125
- if (Array.isArray(r) || Te(r)) {
126
- he(r, l, n);
113
+ if (!Ie(e)) return;
114
+ const y = e.__meta ?? {};
115
+ for (const [s, r] of Object.entries(e)) {
116
+ if (s === "__meta") continue;
117
+ const n = t ? `${t}.${s}` : s;
118
+ if (Array.isArray(r) || Ie(r)) {
119
+ he(r, n, a);
127
120
  continue;
128
121
  }
129
- const _ = b[c];
130
- !_ && mt.has(c) || n.push({
131
- path: l,
132
- label: c,
133
- meta: _ ?? null,
122
+ const C = y[s];
123
+ !C && xt.has(s) || a.push({
124
+ path: n,
125
+ label: s,
126
+ meta: C ?? null,
134
127
  value: r,
135
- unanchored: !_
128
+ unanchored: !C
136
129
  });
137
130
  }
138
131
  }
139
- function Te(e) {
132
+ function Ie(e) {
140
133
  return typeof e == "object" && e !== null && !Array.isArray(e);
141
134
  }
142
- function Ye(e) {
143
- var n;
135
+ function Be(e) {
136
+ var a;
144
137
  if (e.candidates.override) return !1;
145
- const t = (n = e.candidates.extracted) == null ? void 0 : n.confidence;
138
+ const t = (a = e.candidates.extracted) == null ? void 0 : a.confidence;
146
139
  return e.discrepancy || t == null || t <= 2;
147
140
  }
148
- function xt(e) {
149
- const t = $e(e).filter(
150
- (c) => c.meta !== null
151
- ), n = t.length;
152
- let w = 0, b = 0;
153
- for (const c of t) {
154
- if (c.meta.candidates.override) {
155
- w++;
141
+ function yt(e) {
142
+ const t = Ue(e).filter(
143
+ (s) => s.meta !== null
144
+ ), a = t.length;
145
+ let b = 0, y = 0;
146
+ for (const s of t) {
147
+ if (s.meta.candidates.override) {
148
+ b++;
156
149
  continue;
157
150
  }
158
- Ye(c.meta) && b++;
151
+ Be(s.meta) && y++;
159
152
  }
160
153
  return {
161
- total: n,
162
- verified: w,
163
- needsReview: b,
164
- percent: n === 0 ? 100 : Math.round(w / n * 100)
154
+ total: a,
155
+ verified: b,
156
+ needsReview: y,
157
+ percent: a === 0 ? 100 : Math.round(b / a * 100)
165
158
  };
166
159
  }
167
- function ht(e, t, n) {
168
- var c;
169
- const w = (c = t.value) == null ? void 0 : c.anchor;
170
- if (!e.saveOverride || !w) return null;
171
- const b = e.saveOverride;
172
- return async (r, l) => {
173
- const _ = await b({
160
+ function ht(e, t, a) {
161
+ var s;
162
+ const b = (s = t.value) == null ? void 0 : s.anchor;
163
+ if (!e.saveOverride || !b) return null;
164
+ const y = e.saveOverride;
165
+ return async (r, n) => {
166
+ const C = await y({
174
167
  workflow_input_id: e.workflowInputId,
175
- object_ids: w.object_ids,
176
- field: w.field,
177
- field_path: w.field_path,
168
+ object_ids: b.object_ids,
169
+ field: b.field,
170
+ field_path: b.field_path,
178
171
  value: r,
179
- source_choice: l
172
+ source_choice: n
180
173
  });
181
- return n(_), _;
174
+ return a(C), C;
182
175
  };
183
176
  }
184
- const yt = ["data-status", "title"], bt = {
177
+ const bt = ["data-status", "title"], wt = {
185
178
  class: "tv-confidence-glyph",
186
179
  "aria-hidden": "true"
187
- }, wt = {
180
+ }, _t = {
188
181
  key: 0,
189
182
  class: "tv-confidence-label"
190
- }, ye = /* @__PURE__ */ Q({
183
+ }, kt = /* @__PURE__ */ J({
191
184
  __name: "ConfidenceIcon",
192
185
  props: {
193
186
  confidence: {},
@@ -195,9 +188,9 @@ const yt = ["data-status", "title"], bt = {
195
188
  showLabel: { type: Boolean }
196
189
  },
197
190
  setup(e) {
198
- const t = e, n = g(
191
+ const t = e, a = g(
199
192
  () => t.status ?? _e(t.confidence)
200
- ), w = {
193
+ ), b = {
201
194
  high: "✔",
202
195
  // check
203
196
  medium: "⚠",
@@ -207,29 +200,34 @@ const yt = ["data-status", "title"], bt = {
207
200
  unverifiable: "?",
208
201
  failed: "⊗"
209
202
  // circled x — distinct from low's plain x
210
- }, b = g(() => w[n.value]), c = g(() => vt[n.value]), r = g(() => G[n.value]);
211
- return (l, _) => (a(), s("span", {
212
- 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]),
213
- "data-status": n.value,
203
+ }, y = g(() => b[a.value]), s = g(() => vt[a.value]), r = g(() => K[a.value]);
204
+ return (n, C) => (l(), c("span", {
205
+ class: A(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", s.value]),
206
+ "data-status": a.value,
214
207
  title: r.value
215
208
  }, [
216
- o("span", bt, i(b.value), 1),
217
- e.showLabel ? (a(), s("span", wt, i(r.value), 1)) : p("", !0)
218
- ], 10, yt));
209
+ i("span", wt, v(y.value), 1),
210
+ e.showLabel ? (l(), c("span", _t, v(r.value), 1)) : h("", !0)
211
+ ], 10, bt));
219
212
  }
220
213
  });
221
- async function _t(e, t) {
222
- const n = t.object_ids.at(-1), w = new URLSearchParams({
223
- object_id: String(n),
214
+ async function $t(e, t) {
215
+ var n;
216
+ const a = t.object_ids.at(-1), b = new URLSearchParams({
217
+ object_id: String(a),
224
218
  field: t.field
225
- }), b = e.includes("?") ? "&" : "?", c = await fetch(`${e}${b}${w}`);
226
- if (!c.ok)
219
+ }), y = e.includes("?") ? "&" : "?", s = await fetch(`${e}${y}${b}`);
220
+ if (!s.ok)
227
221
  throw new Error(
228
- `data-point-audit ${c.status}: ${await c.text()}`
222
+ `data-point-detail ${s.status}: ${await s.text()}`
229
223
  );
230
- return (await c.json()).data ?? [];
224
+ const r = await s.json();
225
+ return {
226
+ extracted: r.extracted ?? null,
227
+ audit: ((n = r.audit) == null ? void 0 : n.data) ?? []
228
+ };
231
229
  }
232
- const kt = "api_log", $t = "user", Ct = "failed_file", St = {
230
+ const Ct = "api_log", St = "user", Vt = "failed_file", Nt = {
233
231
  pages: [],
234
232
  documents: [],
235
233
  apiLogIds: [],
@@ -238,21 +236,21 @@ const kt = "api_log", $t = "user", Ct = "failed_file", St = {
238
236
  quoteCount: 0,
239
237
  isEmpty: !0
240
238
  };
241
- function oe(e) {
239
+ function me(e) {
242
240
  var r;
243
- if (!e || e.length === 0) return { ...St };
244
- const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), w = [], b = [];
245
- for (const l of e) {
246
- if (l.source_type === Ct) {
247
- b.push(l);
241
+ if (!e || e.length === 0) return { ...Nt };
242
+ const t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), b = [], y = [];
243
+ for (const n of e) {
244
+ if (n.source_type === Vt) {
245
+ y.push(n);
248
246
  continue;
249
247
  }
250
- if (l.api_log_id !== void 0 && l.api_log_id !== null && (w.includes(l.api_log_id) || w.push(l.api_log_id)), l.source_type === kt || l.source_type === $t || !Vt(l)) continue;
251
- const _ = Nt(l);
252
- let f = t.get(_);
253
- f || (f = {
254
- key: _,
255
- pageNumber: re(l),
248
+ if (n.api_log_id !== void 0 && n.api_log_id !== null && (b.includes(n.api_log_id) || b.push(n.api_log_id)), n.source_type === Ct || n.source_type === St || !qt(n)) continue;
249
+ const C = It(n);
250
+ let u = t.get(C);
251
+ u || (u = {
252
+ key: C,
253
+ pageNumber: ue(n),
256
254
  label: "",
257
255
  documentName: null,
258
256
  file: null,
@@ -261,58 +259,58 @@ function oe(e) {
261
259
  quotes: [],
262
260
  explanations: [],
263
261
  sourceIds: []
264
- }, t.set(_, f)), !f.file && l.file && (f.file = Ot(l)), f.url || (f.url = ((r = l.file) == null ? void 0 : r.url) ?? l.file_url ?? null), !f.document && l.original_file && (f.document = l.original_file), f.pageNumber === null && (f.pageNumber = re(l)), l.id !== void 0 && l.id !== null && f.sourceIds.push(l.id);
265
- for (const V of l.texts ?? []) {
266
- const $ = String(V).trim();
267
- $ && !f.quotes.includes($) && f.quotes.push($);
262
+ }, t.set(C, u)), !u.file && n.file && (u.file = Dt(n)), u.url || (u.url = ((r = n.file) == null ? void 0 : r.url) ?? n.file_url ?? null), !u.document && n.original_file && (u.document = n.original_file), u.pageNumber === null && (u.pageNumber = ue(n)), n.id !== void 0 && n.id !== null && u.sourceIds.push(n.id);
263
+ for (const _ of n.texts ?? []) {
264
+ const m = String(_).trim();
265
+ m && !u.quotes.includes(m) && u.quotes.push(m);
268
266
  }
269
- if (l.explanation) {
270
- const V = String(l.explanation).trim();
271
- V && !f.explanations.includes(V) && f.explanations.push(V);
267
+ if (n.explanation) {
268
+ const _ = String(n.explanation).trim();
269
+ _ && !u.explanations.includes(_) && u.explanations.push(_);
272
270
  }
273
- f.documentName || (f.documentName = qt(l)), l.original_file && n.set(String(l.original_file.id), l.original_file);
271
+ u.documentName || (u.documentName = Et(n)), n.original_file && a.set(String(n.original_file.id), n.original_file);
274
272
  }
275
- const c = [...t.values()];
276
- for (const l of c) l.label = It(l);
277
- return c.sort(Dt), {
278
- pages: c,
279
- documents: [...n.values()],
280
- apiLogIds: w,
281
- unresolved: b,
282
- pageCount: c.length,
283
- quoteCount: c.reduce((l, _) => l + _.quotes.length, 0),
284
- isEmpty: c.length === 0 && b.length === 0
273
+ const s = [...t.values()];
274
+ for (const n of s) n.label = Tt(n);
275
+ return s.sort(Ot), {
276
+ pages: s,
277
+ documents: [...a.values()],
278
+ apiLogIds: b,
279
+ unresolved: y,
280
+ pageCount: s.length,
281
+ quoteCount: s.reduce((n, C) => n + C.quotes.length, 0),
282
+ isEmpty: s.length === 0 && y.length === 0
285
283
  };
286
284
  }
287
- function Vt(e) {
285
+ function qt(e) {
288
286
  var t;
289
- return !!(e.file || e.file_url || e.file_name || e.file_id !== void 0 || e.stored_file_id !== void 0 || re(e) !== null || (((t = e.texts) == null ? void 0 : t.length) ?? 0) > 0);
287
+ return !!(e.file || e.file_url || e.file_name || e.file_id !== void 0 || e.stored_file_id !== void 0 || ue(e) !== null || (((t = e.texts) == null ? void 0 : t.length) ?? 0) > 0);
290
288
  }
291
- function Nt(e) {
292
- var w;
293
- const t = ((w = e.file) == null ? void 0 : w.id) ?? e.stored_file_id ?? e.file_id ?? e.file_name, n = re(e);
294
- return t != null ? n === null ? String(t) : `${t}#${n}` : n !== null ? `page-${n}` : `source-${e.id ?? "unknown"}`;
289
+ function It(e) {
290
+ var b;
291
+ const t = ((b = e.file) == null ? void 0 : b.id) ?? e.stored_file_id ?? e.file_id ?? e.file_name, a = ue(e);
292
+ return t != null ? a === null ? String(t) : `${t}#${a}` : a !== null ? `page-${a}` : `source-${e.id ?? "unknown"}`;
295
293
  }
296
- function re(e) {
294
+ function ue(e) {
297
295
  const t = e.page ?? e.page_number;
298
296
  return t == null ? null : Number(t);
299
297
  }
300
- function qt(e) {
298
+ function Et(e) {
301
299
  var t;
302
300
  return ((t = e.original_file) == null ? void 0 : t.name) ?? e.file_name ?? null;
303
301
  }
304
- function Ot(e) {
305
- const t = e.file, n = re(e);
306
- return n === null || t.page_number != null ? t : { ...t, page_number: n };
302
+ function Dt(e) {
303
+ const t = e.file, a = ue(e);
304
+ return a === null || t.page_number != null ? t : { ...t, page_number: a };
307
305
  }
308
- function It(e) {
306
+ function Tt(e) {
309
307
  var t;
310
308
  return e.pageNumber !== null ? `Page ${e.pageNumber}` : (t = e.file) != null && t.name ? e.file.name : e.documentName ? e.documentName : "Cited source";
311
309
  }
312
- function Dt(e, t) {
310
+ function Ot(e, t) {
313
311
  return e.pageNumber === null && t.pageNumber === null ? 0 : e.pageNumber === null ? 1 : t.pageNumber === null ? -1 : e.pageNumber - t.pageNumber;
314
312
  }
315
- function Ce(e) {
313
+ function Me(e) {
316
314
  if (e.isEmpty) return "No citations recorded";
317
315
  const t = [
318
316
  `${e.pageCount} ${e.pageCount === 1 ? "page" : "pages"}`
@@ -327,99 +325,99 @@ function Ee(e) {
327
325
  "*"
328
326
  );
329
327
  }
330
- const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm" }, Et = { class: "tv-audit-call-header flex flex-wrap items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2" }, Lt = {
328
+ const Lt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm" }, At = { class: "tv-audit-call-header flex flex-wrap items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2" }, zt = {
331
329
  key: 3,
332
330
  class: "font-mono text-[11px] text-gray-400"
333
331
  }, Pt = {
334
332
  key: 4,
335
333
  class: "text-[11px] font-medium text-gray-500"
336
- }, At = {
334
+ }, jt = {
337
335
  key: 5,
338
336
  class: "text-[11px] text-gray-400"
339
- }, zt = { class: "tv-audit-call-body flex flex-col gap-2 p-3" }, jt = /* @__PURE__ */ Q({
337
+ }, Rt = { class: "tv-audit-call-body flex flex-col gap-2 p-3" }, Ut = /* @__PURE__ */ J({
340
338
  __name: "AuditCallCard",
341
339
  props: {
342
340
  call: {}
343
341
  },
344
342
  setup(e) {
345
- const t = e, n = g(() => {
346
- const l = t.call.status_code;
347
- return l == null ? "muted" : l >= 200 && l < 300 ? "success" : l >= 400 ? "danger" : "warning";
348
- }), w = g(() => {
349
- const l = t.call.run_time_ms;
350
- return l == null ? null : l >= 1e3 ? `${(l / 1e3).toFixed(1)}s` : `${l}ms`;
343
+ const t = e, a = g(() => {
344
+ const n = t.call.status_code;
345
+ return n == null ? "muted" : n >= 200 && n < 300 ? "success" : n >= 400 ? "danger" : "warning";
351
346
  }), b = g(() => {
347
+ const n = t.call.run_time_ms;
348
+ return n == null ? null : n >= 1e3 ? `${(n / 1e3).toFixed(1)}s` : `${n}ms`;
349
+ }), y = g(() => {
352
350
  if (!t.call.started_at) return null;
353
- const l = new Date(t.call.started_at);
354
- return Number.isNaN(l.getTime()) ? t.call.started_at : l.toLocaleString();
355
- }), c = g(
351
+ const n = new Date(t.call.started_at);
352
+ return Number.isNaN(n.getTime()) ? t.call.started_at : n.toLocaleString();
353
+ }), s = g(
356
354
  () => JSON.stringify(t.call.request ?? null, null, 2)
357
355
  ), r = g(
358
356
  () => JSON.stringify(t.call.response ?? null, null, 2)
359
357
  );
360
- return (l, _) => (a(), s("div", Tt, [
361
- o("div", Et, [
362
- e.call.stage ? (a(), E(u(K), {
358
+ return (n, C) => (l(), c("div", Lt, [
359
+ i("div", At, [
360
+ e.call.stage ? (l(), V(f(M), {
363
361
  key: 0,
364
362
  variant: "muted",
365
363
  size: "xxs",
366
364
  class: "tv-audit-stage"
367
365
  }, {
368
- default: O(() => [
369
- I(i(e.call.stage), 1)
366
+ default: S(() => [
367
+ N(v(e.call.stage), 1)
370
368
  ]),
371
369
  _: 1
372
- })) : p("", !0),
373
- e.call.model ? (a(), E(u(K), {
370
+ })) : h("", !0),
371
+ e.call.model ? (l(), V(f(M), {
374
372
  key: 1,
375
373
  variant: "info",
376
374
  size: "xs",
377
375
  class: "tv-audit-model"
378
376
  }, {
379
- default: O(() => [
380
- I(i(e.call.model), 1)
377
+ default: S(() => [
378
+ N(v(e.call.model), 1)
381
379
  ]),
382
380
  _: 1
383
- })) : p("", !0),
384
- e.call.service ? (a(), E(u(K), {
381
+ })) : h("", !0),
382
+ e.call.service ? (l(), V(f(M), {
385
383
  key: 2,
386
384
  variant: "muted",
387
385
  size: "xxs"
388
386
  }, {
389
- default: O(() => [
390
- I(i(e.call.service), 1)
387
+ default: S(() => [
388
+ N(v(e.call.service), 1)
391
389
  ]),
392
390
  _: 1
393
- })) : p("", !0),
394
- e.call.endpoint ? (a(), s("span", Lt, i(e.call.endpoint), 1)) : p("", !0),
395
- _[0] || (_[0] = o("span", { class: "flex-1" }, null, -1)),
396
- D(u(K), {
397
- variant: n.value,
391
+ })) : h("", !0),
392
+ e.call.endpoint ? (l(), c("span", zt, v(e.call.endpoint), 1)) : h("", !0),
393
+ C[0] || (C[0] = i("span", { class: "flex-1" }, null, -1)),
394
+ I(f(M), {
395
+ variant: a.value,
398
396
  size: "xxs",
399
397
  class: "tv-audit-status"
400
398
  }, {
401
- default: O(() => [
402
- I(i(e.call.status_code ?? "…"), 1)
399
+ default: S(() => [
400
+ N(v(e.call.status_code ?? "…"), 1)
403
401
  ]),
404
402
  _: 1
405
403
  }, 8, ["variant"]),
406
- w.value ? (a(), s("span", Pt, i(w.value), 1)) : p("", !0),
407
- b.value ? (a(), s("span", At, i(b.value), 1)) : p("", !0)
404
+ b.value ? (l(), c("span", Pt, v(b.value), 1)) : h("", !0),
405
+ y.value ? (l(), c("span", jt, v(y.value), 1)) : h("", !0)
408
406
  ]),
409
- o("div", zt, [
410
- o("div", null, [
411
- _[1] || (_[1] = o("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Request ", -1)),
412
- D(u(De), {
413
- "model-value": c.value,
407
+ i("div", Rt, [
408
+ i("div", null, [
409
+ C[1] || (C[1] = i("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Request ", -1)),
410
+ I(f(qe), {
411
+ "model-value": s.value,
414
412
  format: "json",
415
413
  collapsible: "",
416
414
  "default-collapsed": "",
417
415
  class: "tv-audit-request"
418
416
  }, null, 8, ["model-value"])
419
417
  ]),
420
- o("div", null, [
421
- _[2] || (_[2] = o("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Response ", -1)),
422
- D(u(De), {
418
+ i("div", null, [
419
+ C[2] || (C[2] = i("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Response ", -1)),
420
+ I(f(qe), {
423
421
  "model-value": r.value,
424
422
  format: "json",
425
423
  collapsible: "",
@@ -430,16 +428,16 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
430
428
  ])
431
429
  ]));
432
430
  }
433
- }), Rt = {
431
+ }), Bt = {
434
432
  key: 0,
435
433
  class: "tv-citation-thumb shrink-0"
436
- }, Ut = { class: "tv-citation-quotes flex min-w-0 flex-1 flex-col gap-2" }, Bt = {
434
+ }, Mt = { class: "tv-citation-quotes flex min-w-0 flex-1 flex-col gap-2" }, Ft = {
437
435
  key: 0,
438
436
  class: "tv-quote-list flex flex-col gap-2"
439
- }, Mt = { class: "tv-quote-index mr-1 not-italic text-[10px] font-semibold text-amber-600" }, Ft = {
437
+ }, Yt = { class: "tv-quote-index mr-1 not-italic text-[10px] font-semibold text-amber-600" }, Kt = {
440
438
  key: 1,
441
439
  class: "tv-quote-empty rounded-md border border-dashed border-gray-200 px-3 py-2 text-xs text-gray-400"
442
- }, Yt = { class: "tv-citation-actions mt-1 flex flex-wrap items-center gap-2" }, Le = /* @__PURE__ */ Q({
440
+ }, Ht = { class: "tv-citation-actions mt-1 flex flex-wrap items-center gap-2" }, De = /* @__PURE__ */ J({
443
441
  __name: "CitationPage",
444
442
  props: {
445
443
  page: {},
@@ -447,64 +445,64 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
447
445
  },
448
446
  emits: ["view", "document"],
449
447
  setup(e, { emit: t }) {
450
- const n = t;
451
- return (w, b) => (a(), s("div", {
448
+ const a = t;
449
+ return (b, y) => (l(), c("div", {
452
450
  class: A(["tv-citation-page flex gap-4", e.dense ? "tv-citation-page-dense" : ""])
453
451
  }, [
454
- e.page.file ? (a(), s("div", Rt, [
455
- D(u(et), {
452
+ e.page.file ? (l(), c("div", Bt, [
453
+ I(f(et), {
456
454
  file: e.page.file,
457
455
  size: e.dense ? "md" : "lg",
458
456
  fit: "cover",
459
457
  downloadable: "",
460
458
  class: "cursor-zoom-in",
461
- onClick: b[0] || (b[0] = (c) => n("view"))
459
+ onClick: y[0] || (y[0] = (s) => a("view"))
462
460
  }, null, 8, ["file", "size"])
463
- ])) : p("", !0),
464
- o("div", Ut, [
465
- e.page.quotes.length ? (a(), s("ol", Bt, [
466
- (a(!0), s(U, null, F(e.page.quotes, (c, r) => (a(), s("li", {
461
+ ])) : h("", !0),
462
+ i("div", Mt, [
463
+ e.page.quotes.length ? (l(), c("ol", Ft, [
464
+ (l(!0), c(B, null, H(e.page.quotes, (s, r) => (l(), c("li", {
467
465
  key: r,
468
466
  class: "tv-quote rounded-r-md border-l-[3px] border-amber-300 bg-amber-50/60 py-1.5 pl-3 pr-3 text-sm italic leading-relaxed text-gray-700"
469
467
  }, [
470
- o("span", Mt, i(r + 1), 1),
471
- I("“" + i(c) + "” ", 1)
468
+ i("span", Yt, v(r + 1), 1),
469
+ N("“" + v(s) + "” ", 1)
472
470
  ]))), 128))
473
- ])) : (a(), s("p", Ft, " This page was cited without a verbatim quote — the value was read from the page as a whole. ")),
474
- (a(!0), s(U, null, F(e.page.explanations, (c, r) => (a(), s("p", {
471
+ ])) : (l(), c("p", Kt, " This page was cited without a verbatim quote — the value was read from the page as a whole. ")),
472
+ (l(!0), c(B, null, H(e.page.explanations, (s, r) => (l(), c("p", {
475
473
  key: `x${r}`,
476
474
  class: "tv-citation-explanation text-xs text-gray-500"
477
- }, i(c), 1))), 128)),
478
- o("div", Yt, [
479
- e.page.file ? (a(), E(u(ie), {
475
+ }, v(s), 1))), 128)),
476
+ i("div", Ht, [
477
+ e.page.file ? (l(), V(f(re), {
480
478
  key: 0,
481
479
  size: "xs",
482
480
  variant: "info",
483
481
  class: "tv-view-page",
484
- onClick: b[1] || (b[1] = (c) => n("view"))
482
+ onClick: y[1] || (y[1] = (s) => a("view"))
485
483
  }, {
486
- default: O(() => [...b[3] || (b[3] = [
487
- I("View page full screen", -1)
484
+ default: S(() => [...y[3] || (y[3] = [
485
+ N("View page full screen", -1)
488
486
  ])]),
489
487
  _: 1
490
- })) : p("", !0),
491
- e.page.document ? (a(), E(u(ie), {
488
+ })) : h("", !0),
489
+ e.page.document ? (l(), V(f(re), {
492
490
  key: 1,
493
491
  size: "xs",
494
492
  variant: "muted",
495
493
  class: "tv-open-document",
496
- onClick: b[2] || (b[2] = (c) => n("document"))
494
+ onClick: y[2] || (y[2] = (s) => a("document"))
497
495
  }, {
498
- default: O(() => [
499
- I("Open " + i(e.page.document.name), 1)
496
+ default: S(() => [
497
+ N("Open " + v(e.page.document.name), 1)
500
498
  ]),
501
499
  _: 1
502
- })) : p("", !0)
500
+ })) : h("", !0)
503
501
  ])
504
502
  ])
505
503
  ], 2));
506
504
  }
507
- }), Kt = { class: "tv-disclosure divide-y divide-gray-200" }, Ht = ["id", "aria-expanded", "aria-controls", "onClick"], Jt = { class: "min-w-0 flex-1" }, Gt = ["id", "aria-labelledby"], Ke = /* @__PURE__ */ Q({
505
+ }), Jt = { class: "tv-disclosure divide-y divide-gray-200" }, Gt = ["id", "aria-expanded", "aria-controls", "onClick"], Qt = { class: "min-w-0 flex-1" }, Wt = ["id", "aria-labelledby"], Fe = /* @__PURE__ */ J({
508
506
  __name: "TvDisclosure",
509
507
  props: {
510
508
  items: {},
@@ -513,40 +511,40 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
513
511
  },
514
512
  emits: ["update:modelValue"],
515
513
  setup(e, { emit: t }) {
516
- const n = e, w = t, b = g(() => new Set(n.modelValue)), c = (f) => b.value.has(f);
517
- function r(f) {
518
- const V = new Set(b.value);
519
- V.has(f) ? V.delete(f) : V.add(f), w("update:modelValue", [...V]);
514
+ const a = e, b = t, y = g(() => new Set(a.modelValue)), s = (u) => y.value.has(u);
515
+ function r(u) {
516
+ const _ = new Set(y.value);
517
+ _.has(u) ? _.delete(u) : _.add(u), b("update:modelValue", [..._]);
520
518
  }
521
- const l = (f) => `${n.idPrefix}-h-${f}`, _ = (f) => `${n.idPrefix}-p-${f}`;
522
- return (f, V) => (a(), s("div", Kt, [
523
- (a(!0), s(U, null, F(e.items, ($) => (a(), s("div", {
524
- key: $.value,
525
- class: A(["tv-disclosure__item", c($.value) ? "is-open" : ""])
519
+ const n = (u) => `${a.idPrefix}-h-${u}`, C = (u) => `${a.idPrefix}-p-${u}`;
520
+ return (u, _) => (l(), c("div", Jt, [
521
+ (l(!0), c(B, null, H(e.items, (m) => (l(), c("div", {
522
+ key: m.value,
523
+ class: A(["tv-disclosure__item", s(m.value) ? "is-open" : ""])
526
524
  }, [
527
- o("button", {
528
- id: l($.value),
525
+ i("button", {
526
+ id: n(m.value),
529
527
  type: "button",
530
528
  class: "tv-disclosure__header flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-gray-50",
531
- "aria-expanded": c($.value),
532
- "aria-controls": _($.value),
533
- onClick: (L) => r($.value)
529
+ "aria-expanded": s(m.value),
530
+ "aria-controls": C(m.value),
531
+ onClick: (T) => r(m.value)
534
532
  }, [
535
- o("span", Jt, [
536
- me(f.$slots, "header", {
537
- item: $,
538
- isOpen: c($.value)
533
+ i("span", Qt, [
534
+ xe(u.$slots, "header", {
535
+ item: m,
536
+ isOpen: s(m.value)
539
537
  }, () => [
540
- I(i($.label), 1)
538
+ N(v(m.label), 1)
541
539
  ])
542
540
  ]),
543
- (a(), s("svg", {
544
- class: A(["tv-disclosure__chevron h-4 w-4 shrink-0 text-gray-400 transition-transform duration-200", c($.value) ? "rotate-180" : ""]),
541
+ (l(), c("svg", {
542
+ class: A(["tv-disclosure__chevron h-4 w-4 shrink-0 text-gray-400 transition-transform duration-200", s(m.value) ? "rotate-180" : ""]),
545
543
  viewBox: "0 0 20 20",
546
544
  fill: "none",
547
545
  "aria-hidden": "true"
548
- }, [...V[0] || (V[0] = [
549
- o("path", {
546
+ }, [..._[0] || (_[0] = [
547
+ i("path", {
550
548
  d: "M5 7.5 10 12.5 15 7.5",
551
549
  stroke: "currentColor",
552
550
  "stroke-width": "1.75",
@@ -554,38 +552,38 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
554
552
  "stroke-linejoin": "round"
555
553
  }, null, -1)
556
554
  ])], 2))
557
- ], 8, Ht),
558
- c($.value) ? (a(), s("div", {
555
+ ], 8, Gt),
556
+ s(m.value) ? (l(), c("div", {
559
557
  key: 0,
560
- id: _($.value),
558
+ id: C(m.value),
561
559
  role: "region",
562
- "aria-labelledby": l($.value),
560
+ "aria-labelledby": n(m.value),
563
561
  class: "tv-disclosure__panel border-t border-gray-100 bg-gray-50/40 px-3 py-3"
564
562
  }, [
565
- me(f.$slots, "panel", {
566
- item: $,
563
+ xe(u.$slots, "panel", {
564
+ item: m,
567
565
  isOpen: !0
568
566
  })
569
- ], 8, Gt)) : p("", !0)
567
+ ], 8, Wt)) : h("", !0)
570
568
  ], 2))), 128))
571
569
  ]));
572
570
  }
573
- }), Qt = { class: "tv-citation-list flex flex-col gap-2" }, Wt = {
571
+ }), Xt = { class: "tv-citation-list flex flex-col gap-2" }, Zt = {
574
572
  key: 0,
575
573
  class: "tv-citation-list-controls flex justify-end"
576
- }, Xt = { class: "tv-citation-header flex min-w-0 flex-1 items-center gap-3 text-left" }, Zt = ["src", "alt"], ea = { class: "flex min-w-0 flex-1 flex-col" }, ta = { class: "flex flex-wrap items-center gap-2" }, aa = { class: "tv-citation-page-label text-sm font-semibold text-gray-900" }, na = {
574
+ }, ea = { class: "tv-citation-header flex min-w-0 flex-1 items-center gap-3 text-left" }, ta = ["src", "alt"], aa = { class: "flex min-w-0 flex-1 flex-col" }, la = { class: "flex flex-wrap items-center gap-2" }, na = { class: "tv-citation-page-label text-sm font-semibold text-gray-900" }, sa = {
577
575
  key: 0,
578
576
  class: "tv-citation-document-name truncate text-xs text-gray-400"
579
- }, la = {
577
+ }, ia = {
580
578
  key: 0,
581
579
  class: "tv-citation-preview truncate text-xs italic text-gray-500"
582
- }, sa = { class: "tv-citation-header mb-2 flex flex-wrap items-center gap-2" }, oa = { class: "tv-citation-page-label text-sm font-semibold text-gray-900" }, ia = {
580
+ }, oa = { class: "tv-citation-header mb-2 flex flex-wrap items-center gap-2" }, ra = { class: "tv-citation-page-label text-sm font-semibold text-gray-900" }, ua = {
583
581
  key: 0,
584
582
  class: "tv-citation-document-name text-xs text-gray-400"
585
- }, ra = { class: "tv-page-dialog flex h-full min-h-0 flex-col gap-3 lg:flex-row" }, ua = {
583
+ }, da = { class: "tv-page-dialog flex h-full min-h-0 flex-col gap-3 lg:flex-row" }, ca = {
586
584
  key: 0,
587
585
  class: "tv-page-dialog-quotes max-h-40 shrink-0 overflow-y-auto rounded-lg border border-gray-200 bg-gray-50 p-3 lg:max-h-none lg:w-80"
588
- }, da = { class: "mb-2 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, ca = { class: "flex flex-col gap-1.5" }, va = /* @__PURE__ */ Q({
586
+ }, va = { class: "mb-2 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, fa = { class: "flex flex-col gap-1.5" }, ga = /* @__PURE__ */ J({
589
587
  __name: "CitationPageList",
590
588
  props: {
591
589
  pages: {},
@@ -593,165 +591,165 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
593
591
  dense: { type: Boolean, default: !1 }
594
592
  },
595
593
  setup(e) {
596
- const t = e, n = g(
597
- () => t.pages.map((k) => ({ value: k.key, label: k.label }))
598
- ), w = j([]);
594
+ const t = e, a = g(
595
+ () => t.pages.map((w) => ({ value: w.key, label: w.label }))
596
+ ), b = O([]);
599
597
  ae(
600
598
  () => t.pages,
601
- (k) => {
602
- w.value = k.length ? [k[0].key] : [];
599
+ (w) => {
600
+ b.value = w.length ? [w[0].key] : [];
603
601
  },
604
602
  { immediate: !0 }
605
603
  );
606
- const b = g(
607
- () => t.pages.length > 0 && w.value.length === t.pages.length
604
+ const y = g(
605
+ () => t.pages.length > 0 && b.value.length === t.pages.length
608
606
  );
609
- function c() {
610
- w.value = b.value ? [] : t.pages.map((k) => k.key);
607
+ function s() {
608
+ b.value = y.value ? [] : t.pages.map((w) => w.key);
611
609
  }
612
610
  const r = g(
613
- () => new Map(t.pages.map((k) => [k.key, k]))
611
+ () => new Map(t.pages.map((w) => [w.key, w]))
614
612
  );
615
- function l(k) {
616
- const T = k.quotes[0];
617
- return T ? T.length > 96 ? `${T.slice(0, 96)}…` : T : "";
613
+ function n(w) {
614
+ const D = w.quotes[0];
615
+ return D ? D.length > 96 ? `${D.slice(0, 96)}…` : D : "";
618
616
  }
619
- const _ = g(
620
- () => t.pages.map((k) => k.file).filter((k) => !!k)
621
- ), f = j(null), V = j(!1), $ = j(null), L = g({
622
- get: () => f.value !== null,
623
- set: (k) => {
624
- k || (f.value = null, $.value = null, V.value = !1);
617
+ const C = g(
618
+ () => t.pages.map((w) => w.file).filter((w) => !!w)
619
+ ), u = O(null), _ = O(!1), m = O(null), T = g({
620
+ get: () => u.value !== null,
621
+ set: (w) => {
622
+ w || (u.value = null, m.value = null, _.value = !1);
625
623
  }
626
- }), S = g(
627
- () => V.value ? [] : _.value
628
- ), d = g(() => {
629
- if (V.value) return null;
630
- const k = $.value ?? f.value;
631
- return k ? t.pages.find(
632
- (T) => T.file && String(T.file.id) === String(k.id)
624
+ }), z = g(
625
+ () => _.value ? [] : C.value
626
+ ), q = g(() => {
627
+ if (_.value) return null;
628
+ const w = m.value ?? u.value;
629
+ return w ? t.pages.find(
630
+ (D) => D.file && String(D.file.id) === String(w.id)
633
631
  ) ?? null : null;
634
- }), m = g(() => {
635
- if (!f.value) return "";
636
- if (V.value) return f.value.name;
637
- const k = d.value;
638
- return k ? k.documentName ? `${k.label} · ${k.documentName}` : k.label : f.value.name;
632
+ }), F = g(() => {
633
+ if (!u.value) return "";
634
+ if (_.value) return u.value.name;
635
+ const w = q.value;
636
+ return w ? w.documentName ? `${w.label} · ${w.documentName}` : w.label : u.value.name;
639
637
  });
640
- function h(k) {
641
- k.file && (V.value = !1, $.value = k.file, f.value = k.file);
638
+ function Y(w) {
639
+ w.file && (_.value = !1, m.value = w.file, u.value = w.file);
642
640
  }
643
- function B(k) {
644
- k.document && (V.value = !0, $.value = null, f.value = k.document);
641
+ function U(w) {
642
+ w.document && (_.value = !0, m.value = null, u.value = w.document);
645
643
  }
646
- return (k, T) => (a(), s("div", Qt, [
647
- e.collapsible && e.pages.length > 1 ? (a(), s("div", Wt, [
648
- D(u(ie), {
644
+ return (w, D) => (l(), c("div", Xt, [
645
+ e.collapsible && e.pages.length > 1 ? (l(), c("div", Zt, [
646
+ I(f(re), {
649
647
  size: "xxs",
650
648
  variant: "muted",
651
649
  class: "tv-toggle-all-pages",
652
- onClick: c
650
+ onClick: s
653
651
  }, {
654
- default: O(() => [
655
- I(i(b.value ? "Collapse all" : "Expand all"), 1)
652
+ default: S(() => [
653
+ N(v(y.value ? "Collapse all" : "Expand all"), 1)
656
654
  ]),
657
655
  _: 1
658
656
  })
659
- ])) : p("", !0),
660
- e.collapsible ? (a(), E(Ke, {
657
+ ])) : h("", !0),
658
+ e.collapsible ? (l(), V(Fe, {
661
659
  key: 1,
662
- modelValue: w.value,
663
- "onUpdate:modelValue": T[0] || (T[0] = (N) => w.value = N),
664
- items: n.value,
660
+ modelValue: b.value,
661
+ "onUpdate:modelValue": D[0] || (D[0] = (k) => b.value = k),
662
+ items: a.value,
665
663
  "id-prefix": "tv-citation",
666
664
  class: "tv-citation-accordion overflow-hidden rounded-lg border border-gray-200"
667
665
  }, {
668
- header: O(({ item: N, isOpen: M }) => {
669
- var H, J, Y, X, y;
666
+ header: S(({ item: k, isOpen: P }) => {
667
+ var j, Q, W, X, p;
670
668
  return [
671
- o("span", Xt, [
672
- (J = (H = r.value.get(N.value)) == null ? void 0 : H.file) != null && J.url ? (a(), s("img", {
669
+ i("span", ea, [
670
+ (Q = (j = r.value.get(k.value)) == null ? void 0 : j.file) != null && Q.url ? (l(), c("img", {
673
671
  key: 0,
674
- src: r.value.get(N.value).file.url,
675
- alt: r.value.get(N.value).label,
672
+ src: r.value.get(k.value).file.url,
673
+ alt: r.value.get(k.value).label,
676
674
  class: "tv-citation-header-thumb h-10 w-8 shrink-0 rounded border border-gray-200 object-cover",
677
675
  loading: "lazy"
678
- }, null, 8, Zt)) : p("", !0),
679
- o("span", ea, [
680
- o("span", ta, [
681
- o("span", aa, i((Y = r.value.get(N.value)) == null ? void 0 : Y.label), 1),
682
- (X = r.value.get(N.value)) != null && X.documentName ? (a(), s("span", na, i((y = r.value.get(N.value)) == null ? void 0 : y.documentName), 1)) : p("", !0),
683
- D(u(K), {
676
+ }, null, 8, ta)) : h("", !0),
677
+ i("span", aa, [
678
+ i("span", la, [
679
+ i("span", na, v((W = r.value.get(k.value)) == null ? void 0 : W.label), 1),
680
+ (X = r.value.get(k.value)) != null && X.documentName ? (l(), c("span", sa, v((p = r.value.get(k.value)) == null ? void 0 : p.documentName), 1)) : h("", !0),
681
+ I(f(M), {
684
682
  variant: "warning",
685
683
  size: "xxs",
686
684
  class: "tv-citation-quote-count"
687
685
  }, {
688
- default: O(() => {
689
- var q, P;
686
+ default: S(() => {
687
+ var $, E;
690
688
  return [
691
- I(i((q = r.value.get(N.value)) == null ? void 0 : q.quotes.length) + " " + i(((P = r.value.get(N.value)) == null ? void 0 : P.quotes.length) === 1 ? "quote" : "quotes"), 1)
689
+ N(v(($ = r.value.get(k.value)) == null ? void 0 : $.quotes.length) + " " + v(((E = r.value.get(k.value)) == null ? void 0 : E.quotes.length) === 1 ? "quote" : "quotes"), 1)
692
690
  ];
693
691
  }),
694
692
  _: 2
695
693
  }, 1024)
696
694
  ]),
697
- !M && l(r.value.get(N.value)) ? (a(), s("span", la, "“" + i(l(r.value.get(N.value))) + "”", 1)) : p("", !0)
695
+ !P && n(r.value.get(k.value)) ? (l(), c("span", ia, "“" + v(n(r.value.get(k.value))) + "”", 1)) : h("", !0)
698
696
  ])
699
697
  ])
700
698
  ];
701
699
  }),
702
- panel: O(({ item: N }) => [
703
- D(Le, {
704
- page: r.value.get(N.value),
700
+ panel: S(({ item: k }) => [
701
+ I(De, {
702
+ page: r.value.get(k.value),
705
703
  dense: e.dense,
706
- onView: (M) => h(r.value.get(N.value)),
707
- onDocument: (M) => B(r.value.get(N.value))
704
+ onView: (P) => Y(r.value.get(k.value)),
705
+ onDocument: (P) => U(r.value.get(k.value))
708
706
  }, null, 8, ["page", "dense", "onView", "onDocument"])
709
707
  ]),
710
708
  _: 1
711
- }, 8, ["modelValue", "items"])) : (a(!0), s(U, { key: 2 }, F(e.pages, (N) => (a(), s("div", {
712
- key: N.key,
709
+ }, 8, ["modelValue", "items"])) : (l(!0), c(B, { key: 2 }, H(e.pages, (k) => (l(), c("div", {
710
+ key: k.key,
713
711
  class: "tv-citation-flat rounded-lg border border-gray-200 p-3"
714
712
  }, [
715
- o("div", sa, [
716
- o("span", oa, i(N.label), 1),
717
- N.documentName ? (a(), s("span", ia, i(N.documentName), 1)) : p("", !0),
718
- D(u(K), {
713
+ i("div", oa, [
714
+ i("span", ra, v(k.label), 1),
715
+ k.documentName ? (l(), c("span", ua, v(k.documentName), 1)) : h("", !0),
716
+ I(f(M), {
719
717
  variant: "warning",
720
718
  size: "xxs",
721
719
  class: "tv-citation-quote-count"
722
720
  }, {
723
- default: O(() => [
724
- I(i(N.quotes.length) + " " + i(N.quotes.length === 1 ? "quote" : "quotes"), 1)
721
+ default: S(() => [
722
+ N(v(k.quotes.length) + " " + v(k.quotes.length === 1 ? "quote" : "quotes"), 1)
725
723
  ]),
726
724
  _: 2
727
725
  }, 1024)
728
726
  ]),
729
- D(Le, {
730
- page: N,
727
+ I(De, {
728
+ page: k,
731
729
  dense: e.dense,
732
- onView: (M) => h(N),
733
- onDocument: (M) => B(N)
730
+ onView: (P) => Y(k),
731
+ onDocument: (P) => U(k)
734
732
  }, null, 8, ["page", "dense", "onView", "onDocument"])
735
733
  ]))), 128)),
736
- f.value ? (a(), E(u(be), {
734
+ u.value ? (l(), V(f(Oe), {
737
735
  key: 3,
738
- modelValue: L.value,
739
- "onUpdate:modelValue": T[2] || (T[2] = (N) => L.value = N),
740
- title: m.value,
736
+ modelValue: T.value,
737
+ "onUpdate:modelValue": D[2] || (D[2] = (k) => T.value = k),
738
+ title: F.value,
741
739
  width: 95,
742
740
  height: 95,
743
741
  "close-x": "",
744
- class: A(u(W))
742
+ class: A(f(ee))
745
743
  }, {
746
- default: O(() => {
747
- var N;
744
+ default: S(() => {
745
+ var k;
748
746
  return [
749
- o("div", ra, [
750
- D(u(tt), {
751
- file: f.value,
752
- "file-in-preview": $.value,
753
- "onUpdate:fileInPreview": T[1] || (T[1] = (M) => $.value = M),
754
- "related-files": S.value,
747
+ i("div", da, [
748
+ I(f(tt), {
749
+ file: u.value,
750
+ "file-in-preview": m.value,
751
+ "onUpdate:fileInPreview": D[1] || (D[1] = (P) => m.value = P),
752
+ "related-files": z.value,
755
753
  "layout-toggles": ["sidebar", "continuous"],
756
754
  downloadable: "",
757
755
  zoomable: "",
@@ -759,32 +757,32 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
759
757
  "storage-key": "tv-page-viewer",
760
758
  class: "tv-page-viewer min-h-[22rem] min-w-0 flex-1"
761
759
  }, null, 8, ["file", "file-in-preview", "related-files"]),
762
- (N = d.value) != null && N.quotes.length ? (a(), s("aside", ua, [
763
- o("div", da, " Quoted from " + i(d.value.label), 1),
764
- o("ol", ca, [
765
- (a(!0), s(U, null, F(d.value.quotes, (M, H) => (a(), s("li", {
766
- key: H,
760
+ (k = q.value) != null && k.quotes.length ? (l(), c("aside", ca, [
761
+ i("div", va, " Quoted from " + v(q.value.label), 1),
762
+ i("ol", fa, [
763
+ (l(!0), c(B, null, H(q.value.quotes, (P, j) => (l(), c("li", {
764
+ key: j,
767
765
  class: "tv-quote rounded-r-md border-l-[3px] border-amber-300 bg-amber-50/70 py-1.5 pl-3 pr-2 text-sm italic leading-relaxed text-gray-700"
768
- }, " “" + i(M) + "” ", 1))), 128))
766
+ }, " “" + v(P) + "” ", 1))), 128))
769
767
  ])
770
- ])) : p("", !0)
768
+ ])) : h("", !0)
771
769
  ])
772
770
  ];
773
771
  }),
774
772
  _: 1
775
- }, 8, ["modelValue", "title", "class"])) : p("", !0)
773
+ }, 8, ["modelValue", "title", "class"])) : h("", !0)
776
774
  ]));
777
775
  }
778
- }), fa = { class: "tv-evidence flex flex-col gap-4" }, ga = {
776
+ }), pa = { class: "tv-evidence flex flex-col gap-4" }, ma = {
779
777
  key: 1,
780
778
  class: "tv-reasoning-card rounded-lg border border-gray-200 bg-white p-3"
781
- }, pa = { class: "mb-1 flex flex-wrap items-center justify-between gap-2" }, ma = { class: "tv-reasoning text-sm leading-relaxed text-gray-700" }, xa = { class: "tv-cited-sources flex min-w-0 flex-col gap-2" }, ha = { class: "flex flex-wrap items-baseline justify-between gap-2" }, ya = { class: "tv-citation-summary text-xs text-gray-500" }, ba = {
779
+ }, xa = { class: "mb-1 flex flex-wrap items-center justify-between gap-2" }, ya = { class: "tv-reasoning text-sm leading-relaxed text-gray-700" }, ha = { class: "tv-cited-sources flex min-w-0 flex-col gap-2" }, ba = { class: "flex flex-wrap items-baseline justify-between gap-2" }, wa = { class: "tv-citation-summary text-xs text-gray-500" }, _a = {
782
780
  key: 1,
783
781
  class: "tv-no-source rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
784
- }, wa = {
782
+ }, ka = {
785
783
  key: 2,
786
784
  class: "tv-llm-provenance text-xs text-gray-400"
787
- }, _a = { class: "tv-llm-call-ids font-medium text-gray-500" }, Pe = /* @__PURE__ */ Q({
785
+ }, $a = { class: "tv-llm-call-ids font-medium text-gray-500" }, Te = /* @__PURE__ */ J({
788
786
  __name: "CitationEvidence",
789
787
  props: {
790
788
  evidence: {},
@@ -795,107 +793,107 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
795
793
  dense: { type: Boolean, default: !1 }
796
794
  },
797
795
  setup(e) {
798
- return (t, n) => (a(), s("div", fa, [
799
- e.failed && e.reasoning ? (a(), E(u(ge), {
796
+ return (t, a) => (l(), c("div", pa, [
797
+ e.failed && e.reasoning ? (l(), V(f(ge), {
800
798
  key: 0,
801
799
  variant: "danger",
802
800
  class: "tv-evidence-failed"
803
801
  }, {
804
- default: O(() => [
805
- I(i(e.reasoning), 1)
802
+ default: S(() => [
803
+ N(v(e.reasoning), 1)
806
804
  ]),
807
805
  _: 1
808
- })) : e.reasoning ? (a(), s("section", ga, [
809
- o("div", pa, [
810
- n[0] || (n[0] = o("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Why this value ", -1)),
811
- e.basis ? (a(), E(u(we), {
806
+ })) : e.reasoning ? (l(), c("section", ma, [
807
+ i("div", xa, [
808
+ a[0] || (a[0] = i("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Why this value ", -1)),
809
+ e.basis ? (l(), V(f(be), {
812
810
  key: 0,
813
811
  tooltip: e.basis === "inferred" ? "The value was derived from the quotes below — computed, reformatted, or reasoned — rather than appearing as-is." : "The stored value appears word-for-word inside the quotes below, checked against the source document at store time.",
814
812
  placement: "top"
815
813
  }, {
816
- trigger: O(() => [
817
- D(u(K), {
814
+ trigger: S(() => [
815
+ I(f(M), {
818
816
  variant: e.basis === "inferred" ? "muted" : "success",
819
817
  size: "xxs",
820
818
  class: "tv-basis-chip"
821
819
  }, {
822
- default: O(() => [
823
- I(i(e.basis === "inferred" ? "inferred from quotes" : "✔ verbatim quote"), 1)
820
+ default: S(() => [
821
+ N(v(e.basis === "inferred" ? "inferred from quotes" : "✔ verbatim quote"), 1)
824
822
  ]),
825
823
  _: 1
826
824
  }, 8, ["variant"])
827
825
  ]),
828
826
  _: 1
829
- }, 8, ["tooltip"])) : p("", !0)
827
+ }, 8, ["tooltip"])) : h("", !0)
830
828
  ]),
831
- o("p", ma, i(e.reasoning), 1)
832
- ])) : p("", !0),
833
- o("section", xa, [
834
- o("div", ha, [
835
- n[1] || (n[1] = o("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Cited sources ", -1)),
836
- o("div", ya, i(u(Ce)(e.evidence)), 1)
829
+ i("p", ya, v(e.reasoning), 1)
830
+ ])) : h("", !0),
831
+ i("section", ha, [
832
+ i("div", ba, [
833
+ a[1] || (a[1] = i("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Cited sources ", -1)),
834
+ i("div", wa, v(f(Me)(e.evidence)), 1)
837
835
  ]),
838
- e.evidence.pages.length ? (a(), E(va, {
836
+ e.evidence.pages.length ? (l(), V(ga, {
839
837
  key: 0,
840
838
  pages: e.evidence.pages,
841
839
  collapsible: e.collapsible,
842
840
  dense: e.dense
843
- }, null, 8, ["pages", "collapsible", "dense"])) : e.evidence.unresolved.length ? p("", !0) : (a(), s("p", ba, " No source pages recorded for this data point ")),
844
- e.evidence.unresolved.length ? (a(), E(u(ge), {
841
+ }, null, 8, ["pages", "collapsible", "dense"])) : e.evidence.unresolved.length ? h("", !0) : (l(), c("p", _a, " No source pages recorded for this data point ")),
842
+ e.evidence.unresolved.length ? (l(), V(f(ge), {
845
843
  key: 2,
846
844
  variant: "warning",
847
845
  class: "tv-unresolved-citations"
848
846
  }, {
849
- default: O(() => [
850
- I(i(e.evidence.unresolved.length) + " " + i(e.evidence.unresolved.length === 1 ? "citation" : "citations") + " could not be matched to a page in the source documents. The value was kept, but this part of its provenance is unverified. ", 1)
847
+ default: S(() => [
848
+ N(v(e.evidence.unresolved.length) + " " + v(e.evidence.unresolved.length === 1 ? "citation" : "citations") + " could not be matched to a page in the source documents. The value was kept, but this part of its provenance is unverified. ", 1)
851
849
  ]),
852
850
  _: 1
853
- })) : p("", !0)
851
+ })) : h("", !0)
854
852
  ]),
855
- e.evidence.apiLogIds.length ? (a(), s("p", wa, [
856
- I(" Produced by " + i(e.evidence.apiLogIds.length === 1 ? "LLM call" : "LLM calls") + " ", 1),
857
- o("span", _a, "#" + i(e.evidence.apiLogIds.join(", #")), 1),
858
- n[2] || (n[2] = I(" — open the Audit trail tab for the full request and response. ", -1))
859
- ])) : p("", !0)
853
+ e.evidence.apiLogIds.length ? (l(), c("p", ka, [
854
+ N(" Produced by " + v(e.evidence.apiLogIds.length === 1 ? "LLM call" : "LLM calls") + " ", 1),
855
+ i("span", $a, "#" + v(e.evidence.apiLogIds.join(", #")), 1),
856
+ a[2] || (a[2] = N(" — open the Audit trail tab for the full request and response. ", -1))
857
+ ])) : h("", !0)
860
858
  ]));
861
859
  }
862
- }), ka = { class: "tv-modal flex h-full flex-col gap-4 overflow-y-auto p-1" }, $a = { 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" }, Ca = { class: "flex flex-wrap items-start justify-between gap-4" }, Sa = { class: "min-w-0 flex-1" }, Va = { class: "tv-resolved-value mt-1 break-words font-mono text-xl font-semibold leading-snug text-gray-900" }, Na = { class: "mt-1 text-[11px] text-gray-400" }, qa = { class: "tv-resolved-source font-medium text-gray-500" }, Oa = { class: "tv-confidence-meter w-56 shrink-0" }, Ia = { class: "mt-2" }, Da = {
860
+ }), Ca = { class: "tv-modal flex h-full flex-col gap-4 overflow-y-auto p-1" }, Sa = { 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" }, Va = { class: "flex flex-wrap items-start justify-between gap-4" }, Na = { class: "min-w-0 flex-1" }, qa = { class: "tv-resolved-value mt-1 break-words font-mono text-xl font-semibold leading-snug text-gray-900" }, Ia = { class: "mt-1 text-[11px] text-gray-400" }, Ea = { class: "tv-resolved-source font-medium text-gray-500" }, Da = { class: "tv-confidence-meter w-56 shrink-0" }, Ta = { class: "mt-2" }, Oa = {
863
861
  key: 1,
864
862
  class: "tv-confidence-value text-sm text-gray-400"
865
- }, Ta = {
863
+ }, La = {
866
864
  key: 0,
867
865
  class: "tv-tab-evidence flex min-h-0 flex-1 flex-col"
868
- }, Ea = {
866
+ }, Aa = {
869
867
  key: 1,
870
868
  class: "tv-tab-candidates flex flex-col gap-3"
871
- }, La = { class: "flex flex-wrap items-center justify-between gap-3" }, Pa = { class: "min-w-0 flex-1" }, Aa = { class: "flex items-center gap-2" }, za = { class: "mt-2 break-words font-mono text-base text-gray-900" }, ja = { class: "mt-1 text-xs text-gray-400" }, Ra = {
869
+ }, za = { class: "flex flex-wrap items-center justify-between gap-3" }, Pa = { class: "min-w-0 flex-1" }, ja = { class: "flex items-center gap-2" }, Ra = { class: "mt-2 break-words font-mono text-base text-gray-900" }, Ua = { class: "mt-1 text-xs text-gray-400" }, Ba = {
872
870
  key: 0,
873
871
  class: "tv-custom-entry flex items-center gap-2 rounded-lg border border-dashed border-gray-300 p-4"
874
- }, Ua = {
872
+ }, Ma = {
875
873
  key: 1,
876
874
  class: "tv-read-only text-center text-xs text-gray-400"
877
- }, Ba = {
875
+ }, Fa = {
878
876
  key: 2,
879
877
  class: "tv-tab-history flex flex-col gap-4"
880
- }, Ma = { class: "tv-history-current flex flex-col gap-2 rounded-xl border border-green-200 bg-green-50/40 p-4" }, Fa = { class: "flex flex-wrap items-center justify-between gap-3" }, Ya = { class: "flex flex-wrap items-center gap-2" }, Ka = { class: "tv-history-current-value break-words font-mono text-base font-semibold text-gray-900" }, Ha = {
878
+ }, Ya = { class: "tv-history-current flex flex-col gap-2 rounded-xl border border-green-200 bg-green-50/40 p-4" }, Ka = { class: "flex flex-wrap items-center justify-between gap-3" }, Ha = { class: "flex flex-wrap items-center gap-2" }, Ja = { class: "tv-history-current-value break-words font-mono text-base font-semibold text-gray-900" }, Ga = {
881
879
  key: 0,
882
880
  class: "tv-history-current-confidence text-xs font-medium text-gray-500"
883
- }, Ja = {
881
+ }, Qa = {
884
882
  key: 1,
885
883
  class: "tv-history-current-confidence text-xs text-gray-400"
886
- }, Ga = {
884
+ }, Wa = {
887
885
  key: 0,
888
886
  class: "tv-history-current-reasoning text-sm italic leading-relaxed text-gray-600"
889
- }, Qa = { class: "tv-history-value min-w-0 break-words font-mono text-sm font-semibold text-gray-900" }, Wa = {
887
+ }, Xa = { class: "tv-history-value min-w-0 break-words font-mono text-sm font-semibold text-gray-900" }, Za = {
890
888
  key: 2,
891
889
  class: "tv-history-confidence text-xs text-gray-500"
892
- }, Xa = { class: "tv-history-provenance text-xs text-gray-400" }, Za = { class: "tv-history-timestamp ml-auto text-xs text-gray-400" }, en = {
890
+ }, el = { class: "tv-history-provenance text-xs text-gray-400" }, tl = { class: "tv-history-timestamp ml-auto text-xs text-gray-400" }, al = {
893
891
  key: 3,
894
892
  class: "tv-tab-audit flex flex-col gap-3"
895
- }, tn = {
893
+ }, ll = {
896
894
  key: 2,
897
895
  class: "tv-audit-empty rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
898
- }, an = /* @__PURE__ */ Q({
896
+ }, nl = /* @__PURE__ */ J({
899
897
  __name: "VerificationModal",
900
898
  props: {
901
899
  modelValue: { type: Boolean },
@@ -905,445 +903,474 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
905
903
  },
906
904
  emits: ["update:modelValue", "saved"],
907
905
  setup(e, { emit: t }) {
908
- const n = e, w = t, b = pe(), c = Ae(), r = g({
909
- get: () => n.modelValue,
910
- set: (v) => w("update:modelValue", v)
911
- }), l = g(() => ke(n.meta)), _ = g(() => n.meta.candidates.extracted), f = g(() => n.meta.candidates.claim), V = g(() => n.meta.candidates.override), $ = g(() => {
912
- var v;
913
- return ((v = _.value) == null ? void 0 : v.confidence) ?? null;
914
- }), L = g(() => {
915
- var v;
916
- return ((v = _.value) == null ? void 0 : v.state) === "failed" ? "failed" : _e($.value);
917
- }), S = g(() => xe(n.meta)), d = g(() => {
918
- var v;
919
- return oe((v = _.value) == null ? void 0 : v.sources);
920
- }), m = g(
906
+ const a = e, b = t, y = we(), s = Le(), r = g({
907
+ get: () => a.modelValue,
908
+ set: (o) => b("update:modelValue", o)
909
+ }), n = g(() => Re(a.meta)), C = O(null), u = g(
910
+ () => C.value ?? a.meta.candidates.extracted
911
+ ), _ = g(() => a.meta.candidates.claim), m = g(
921
912
  () => {
922
- var v;
923
- return ((v = _.value) == null ? void 0 : v.history) ?? [];
913
+ var o;
914
+ return de.value && ((o = u.value) == null ? void 0 : o.sources) === void 0;
924
915
  }
925
- ), h = g(() => m.value.length > 0), B = g(() => (n.meta.anchor.field_path || n.label || "Data point").split(".").map(
926
- (x) => x.replace(/\[\d+\]/g, "").replace(/_/g, " ").replace(/^\w/, (z) => z.toUpperCase())
927
- ).join(" › ")), k = {
916
+ ), T = g(() => a.meta.candidates.override), z = g(() => {
917
+ var o;
918
+ return ((o = u.value) == null ? void 0 : o.confidence) ?? null;
919
+ }), q = g(() => {
920
+ var o;
921
+ return ((o = u.value) == null ? void 0 : o.state) === "failed" ? "failed" : _e(z.value);
922
+ }), F = g(() => {
923
+ var L;
924
+ const o = (L = u.value) == null ? void 0 : L.reasoning;
925
+ if (o == null) return null;
926
+ const d = String(o).trim();
927
+ return d === "" ? null : d;
928
+ }), Y = g(() => {
929
+ var o;
930
+ return me((o = u.value) == null ? void 0 : o.sources);
931
+ }), U = g(
932
+ () => {
933
+ var o;
934
+ return ((o = u.value) == null ? void 0 : o.history) ?? [];
935
+ }
936
+ ), w = g(
937
+ () => {
938
+ var o;
939
+ return ((o = u.value) == null ? void 0 : o.history_count) ?? U.value.length;
940
+ }
941
+ ), D = g(() => w.value > 0), k = g(() => (a.meta.anchor.field_path || a.label || "Data point").split(".").map(
942
+ (d) => d.replace(/\[\d+\]/g, "").replace(/_/g, " ").replace(/^\w/, (L) => L.toUpperCase())
943
+ ).join(" › ")), P = {
928
944
  high: "success",
929
945
  medium: "warning",
930
946
  low: "danger",
931
947
  unverifiable: "muted",
932
948
  failed: "danger"
933
- }, T = j("evidence"), N = g(() => !!b.auditUrl), M = g(() => {
934
- var x;
935
- const v = [
949
+ }, j = O("evidence"), Q = g(() => !!y.detailUrl), W = g(() => {
950
+ var d;
951
+ const o = [
936
952
  {
937
953
  value: "evidence",
938
954
  label: "Citations",
939
- count: d.value.pageCount
955
+ count: Y.value.pageCount
940
956
  },
941
957
  {
942
958
  value: "candidates",
943
959
  label: "Candidates",
944
- count: H.value.length
960
+ count: X.value.length
945
961
  }
946
962
  ];
947
- return h.value && v.push({
963
+ return D.value && o.push({
948
964
  value: "history",
949
965
  label: "History",
950
- count: m.value.length
951
- }), N.value && v.push({
966
+ count: U.value.length
967
+ }), Q.value && o.push({
952
968
  value: "audit",
953
969
  label: "Audit trail",
954
- count: ((x = ee.value) == null ? void 0 : x.length) ?? void 0
955
- }), v;
970
+ count: ((d = Z.value) == null ? void 0 : d.length) ?? void 0
971
+ }), o;
956
972
  });
957
973
  ae(
958
974
  r,
959
- (v) => Ee(v),
975
+ (o) => Ee(o),
960
976
  { immediate: !0 }
961
- ), Qe(() => Ee(!1));
962
- const H = g(() => {
963
- const v = [];
964
- return V.value && v.push({
977
+ ), Ge(() => Ee(!1));
978
+ const X = g(() => {
979
+ const o = [];
980
+ return T.value && o.push({
965
981
  key: "override",
966
982
  title: "Human override",
967
983
  variant: "success",
968
- value: V.value.value,
984
+ value: T.value.value,
969
985
  detail: [
970
- V.value.source_choice ? `basis: ${V.value.source_choice}` : null,
971
- V.value.set_at ? new Date(V.value.set_at).toLocaleString() : null
986
+ T.value.source_choice ? `basis: ${T.value.source_choice}` : null,
987
+ T.value.set_at ? new Date(T.value.set_at).toLocaleString() : null
972
988
  ].filter(Boolean).join(" · "),
973
- winner: l.value.source === "override"
974
- }), _.value && v.push({
989
+ winner: n.value.source === "override"
990
+ }), u.value && o.push({
975
991
  key: "extracted",
976
992
  title: "Extracted",
977
- variant: k[L.value],
978
- value: _.value.value,
979
- detail: L.value === "failed" ? _.value.reasoning ? `${G.failed}: ${_.value.reasoning}` : G.failed : $.value != null ? `Confidence ${$.value}/5 · ${G[L.value]}` : "No confidence recorded",
980
- accept: n.save ? () => {
981
- var x;
982
- return X(q((x = _.value) == null ? void 0 : x.value), "extracted");
993
+ variant: P[q.value],
994
+ value: u.value.value,
995
+ detail: q.value === "failed" ? u.value.reasoning ? `${K.failed}: ${u.value.reasoning}` : K.failed : z.value != null ? `Confidence ${z.value}/5 · ${K[q.value]}` : "No confidence recorded",
996
+ accept: a.save ? () => {
997
+ var d;
998
+ return E(ne((d = u.value) == null ? void 0 : d.value), "extracted");
983
999
  } : void 0,
984
- winner: l.value.source === "extracted"
985
- }), f.value && v.push({
1000
+ winner: n.value.source === "extracted"
1001
+ }), _.value && o.push({
986
1002
  key: "claim",
987
1003
  title: "Claim",
988
1004
  variant: "info",
989
- value: f.value.value,
990
- detail: f.value.claim_set_label ?? "Reference output",
991
- accept: n.save ? () => {
992
- var x;
993
- return X(q((x = f.value) == null ? void 0 : x.value), "claim");
1005
+ value: _.value.value,
1006
+ detail: _.value.claim_set_label ?? "Reference output",
1007
+ accept: a.save ? () => {
1008
+ var d;
1009
+ return E(ne((d = _.value) == null ? void 0 : d.value), "claim");
994
1010
  } : void 0,
995
- winner: l.value.source === "claim"
996
- }), v;
997
- }), J = j(""), Y = j(!1);
998
- async function X(v, x) {
999
- if (!(!n.save || Y.value)) {
1000
- Y.value = !0;
1011
+ winner: n.value.source === "claim"
1012
+ }), o;
1013
+ }), p = O(""), $ = O(!1);
1014
+ async function E(o, d) {
1015
+ if (!(!a.save || $.value)) {
1016
+ $.value = !0;
1001
1017
  try {
1002
- const z = await n.save(v, x);
1003
- w("saved", z), c.success(`Verified — ${B.value} locked in`);
1004
- } catch (z) {
1005
- console.error("template-verification: save failed", z), c.danger(`Could not save ${B.value} — try again`);
1018
+ const L = await a.save(o, d);
1019
+ b("saved", L), s.success(`Verified — ${k.value} locked in`);
1020
+ } catch (L) {
1021
+ console.error("template-verification: save failed", L), s.danger(`Could not save ${k.value} — try again`);
1006
1022
  } finally {
1007
- Y.value = !1;
1023
+ $.value = !1;
1008
1024
  }
1009
1025
  }
1010
1026
  }
1011
- const y = () => X(J.value, "custom");
1012
- function q(v) {
1013
- return v == null ? null : String(v);
1027
+ const le = () => E(p.value, "custom");
1028
+ function ne(o) {
1029
+ return o == null ? null : String(o);
1014
1030
  }
1015
- function P(v) {
1016
- return v == null ? "—" : String(v);
1031
+ function G(o) {
1032
+ return o == null ? "—" : String(o);
1017
1033
  }
1018
- const Z = (v, x) => String(v.id ?? `attempt-${x}`), ue = g(
1019
- () => m.value.map((v, x) => ({
1020
- value: Z(v, x),
1021
- label: P(v.value)
1034
+ const te = (o, d) => String(o.id ?? `attempt-${d}`), Ye = g(
1035
+ () => U.value.map((o, d) => ({
1036
+ value: te(o, d),
1037
+ label: G(o.value)
1022
1038
  }))
1023
- ), te = j([]);
1039
+ ), pe = O([]);
1024
1040
  ae(
1025
- m,
1026
- (v) => {
1027
- const x = v.findIndex((C) => C.is_chosen), z = x === -1 ? v.length - 1 : x;
1028
- te.value = z >= 0 ? [Z(v[z], z)] : [];
1041
+ U,
1042
+ (o) => {
1043
+ const d = o.findIndex((x) => x.is_chosen), L = d === -1 ? o.length - 1 : d;
1044
+ pe.value = L >= 0 ? [te(o[L], L)] : [];
1029
1045
  },
1030
1046
  { immediate: !0 }
1031
1047
  );
1032
1048
  const R = g(
1033
1049
  () => new Map(
1034
- m.value.map((v, x) => [Z(v, x), v])
1050
+ U.value.map((o, d) => [te(o, d), o])
1035
1051
  )
1036
1052
  );
1037
- function He(v) {
1038
- return v.created_at ? new Date(v.created_at).toLocaleString() : "—";
1053
+ function Ke(o) {
1054
+ return o.created_at ? new Date(o.created_at).toLocaleString() : "—";
1039
1055
  }
1040
- function Je(v) {
1041
- return Ce(oe(v.sources));
1056
+ function He(o) {
1057
+ return Me(me(o.sources));
1042
1058
  }
1043
- function Ge(v) {
1044
- return v.is_chosen ? null : v.reasoning ?? null;
1059
+ function Je(o) {
1060
+ return o.is_chosen ? null : o.reasoning ?? null;
1045
1061
  }
1046
- const ee = j(null), de = j(!1), ce = j(null);
1062
+ const Z = O(null), de = O(!1), ce = O(null), ke = O(!1);
1047
1063
  return ae(
1048
- [T, r],
1049
- async ([v, x]) => {
1050
- if (!(v !== "audit" || !x || ee.value !== null || de.value) && b.auditUrl) {
1051
- de.value = !0, ce.value = null;
1064
+ r,
1065
+ async (o) => {
1066
+ if (!(!o || ke.value || !y.detailUrl)) {
1067
+ ke.value = !0, de.value = !0, ce.value = null;
1052
1068
  try {
1053
- ee.value = await _t(
1054
- b.auditUrl,
1055
- n.meta.anchor
1069
+ const d = await $t(
1070
+ y.detailUrl,
1071
+ a.meta.anchor
1056
1072
  );
1057
- } catch (z) {
1058
- ce.value = z instanceof Error ? z.message : String(z);
1073
+ d.extracted && (C.value = d.extracted), Z.value = d.audit;
1074
+ } catch (d) {
1075
+ ce.value = d instanceof Error ? d.message : String(d);
1059
1076
  } finally {
1060
1077
  de.value = !1;
1061
1078
  }
1062
1079
  }
1063
1080
  },
1064
1081
  { immediate: !0 }
1065
- ), (v, x) => (a(), E(u(be), {
1082
+ ), (o, d) => (l(), V(f(Oe), {
1066
1083
  modelValue: r.value,
1067
- "onUpdate:modelValue": x[3] || (x[3] = (z) => r.value = z),
1068
- title: B.value,
1084
+ "onUpdate:modelValue": d[3] || (d[3] = (L) => r.value = L),
1085
+ title: k.value,
1069
1086
  width: 90,
1070
1087
  height: 90,
1071
1088
  "close-x": "",
1072
- class: A(u(W))
1089
+ class: A(f(ee))
1073
1090
  }, {
1074
- default: O(() => {
1075
- var z;
1091
+ default: S(() => {
1092
+ var L;
1076
1093
  return [
1077
- o("div", ka, [
1078
- o("section", $a, [
1079
- o("div", Ca, [
1080
- o("div", Sa, [
1081
- x[5] || (x[5] = o("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
1082
- o("div", Va, i(P(l.value.value)), 1),
1083
- o("div", Na, [
1084
- x[4] || (x[4] = I(" source of truth: ", -1)),
1085
- o("span", qa, i(l.value.source), 1)
1094
+ i("div", Ca, [
1095
+ i("section", Sa, [
1096
+ i("div", Va, [
1097
+ i("div", Na, [
1098
+ d[5] || (d[5] = i("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
1099
+ i("div", qa, v(G(n.value.value)), 1),
1100
+ i("div", Ia, [
1101
+ d[4] || (d[4] = N(" source of truth: ", -1)),
1102
+ i("span", Ea, v(n.value.source), 1)
1086
1103
  ])
1087
1104
  ]),
1088
- o("div", Oa, [
1089
- D(u(we), {
1105
+ i("div", Da, [
1106
+ I(f(be), {
1090
1107
  tooltip: "How certain the AI was when it extracted this value — not whether the quotes in the Citations tab were checked against the source (that tab's own badge says so).",
1091
1108
  placement: "top"
1092
1109
  }, {
1093
- trigger: O(() => [...x[6] || (x[6] = [
1094
- o("div", { class: "w-fit text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Extraction confidence ", -1)
1110
+ trigger: S(() => [...d[6] || (d[6] = [
1111
+ i("div", { class: "w-fit text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Extraction confidence ", -1)
1095
1112
  ])]),
1096
1113
  _: 1
1097
1114
  }),
1098
- o("div", Ia, [
1099
- $.value != null ? (a(), E(u(ze), {
1115
+ i("div", Ta, [
1116
+ z.value != null ? (l(), V(f(Ae), {
1100
1117
  key: 0,
1101
- value: $.value,
1118
+ value: z.value,
1102
1119
  max: 5,
1103
1120
  size: "md",
1104
- variant: k[L.value],
1121
+ variant: P[q.value],
1105
1122
  gradient: "",
1106
1123
  shimmer: "",
1107
1124
  "show-text": "",
1108
1125
  "text-position": "beside",
1109
- label: `${$.value}/5`
1110
- }, null, 8, ["value", "variant", "label"])) : (a(), s("div", Da, " No confidence recorded "))
1126
+ label: `${z.value}/5`
1127
+ }, null, 8, ["value", "variant", "label"])) : (l(), c("div", Oa, " No confidence recorded "))
1111
1128
  ]),
1112
- o("div", {
1129
+ i("div", {
1113
1130
  class: A(["tv-confidence-label mt-1 text-right text-xs font-medium", {
1114
- "text-green-600": L.value === "high",
1115
- "text-yellow-600": L.value === "medium",
1116
- "text-red-600": L.value === "low",
1117
- "text-gray-400": L.value === "unverifiable",
1118
- "text-red-800": L.value === "failed"
1131
+ "text-green-600": q.value === "high",
1132
+ "text-yellow-600": q.value === "medium",
1133
+ "text-red-600": q.value === "low",
1134
+ "text-gray-400": q.value === "unverifiable",
1135
+ "text-red-800": q.value === "failed"
1119
1136
  }])
1120
- }, i(u(G)[L.value]), 3)
1137
+ }, v(f(K)[q.value]), 3)
1121
1138
  ])
1122
1139
  ]),
1123
- e.meta.discrepancy ? (a(), E(u(ge), {
1140
+ e.meta.discrepancy ? (l(), V(f(ge), {
1124
1141
  key: 0,
1125
1142
  variant: "warning",
1126
1143
  class: "tv-discrepancy"
1127
1144
  }, {
1128
- default: O(() => [...x[7] || (x[7] = [
1129
- I(" Sources disagree on this value — review the candidates and pick a winner. ", -1)
1145
+ default: S(() => [...d[7] || (d[7] = [
1146
+ N(" Sources disagree on this value — review the candidates and pick a winner. ", -1)
1130
1147
  ])]),
1131
1148
  _: 1
1132
- })) : p("", !0)
1149
+ })) : h("", !0)
1133
1150
  ]),
1134
- D(u(at), {
1135
- modelValue: T.value,
1136
- "onUpdate:modelValue": x[0] || (x[0] = (C) => T.value = C),
1137
- tabs: M.value,
1151
+ I(f(at), {
1152
+ modelValue: j.value,
1153
+ "onUpdate:modelValue": d[0] || (d[0] = (x) => j.value = x),
1154
+ tabs: W.value,
1138
1155
  class: "tv-modal-tabs"
1139
1156
  }, null, 8, ["modelValue", "tabs"]),
1140
- T.value === "evidence" ? (a(), s("section", Ta, [
1141
- D(Pe, {
1142
- evidence: d.value,
1143
- reasoning: S.value,
1144
- basis: (z = _.value) == null ? void 0 : z.basis,
1145
- failed: L.value === "failed"
1146
- }, null, 8, ["evidence", "reasoning", "basis", "failed"])
1147
- ])) : p("", !0),
1148
- T.value === "candidates" ? (a(), s("section", Ea, [
1149
- (a(!0), s(U, null, F(H.value, (C) => (a(), s("div", {
1150
- key: C.key,
1157
+ j.value === "evidence" ? (l(), c("section", La, [
1158
+ m.value ? (l(), c(B, { key: 0 }, H(2, (x) => I(f(ve), {
1159
+ key: x,
1160
+ shape: "rounded",
1161
+ class: "tv-evidence-skeleton h-24 w-full"
1162
+ })), 64)) : (l(), V(Te, {
1163
+ key: 1,
1164
+ evidence: Y.value,
1165
+ reasoning: F.value,
1166
+ basis: (L = u.value) == null ? void 0 : L.basis,
1167
+ failed: q.value === "failed"
1168
+ }, null, 8, ["evidence", "reasoning", "basis", "failed"]))
1169
+ ])) : h("", !0),
1170
+ j.value === "candidates" ? (l(), c("section", Aa, [
1171
+ (l(!0), c(B, null, H(X.value, (x) => (l(), c("div", {
1172
+ key: x.key,
1151
1173
  class: A(["tv-candidate-row rounded-lg border p-4 transition-shadow", [
1152
- C.winner ? "border-gray-300 bg-gray-50 shadow-sm" : "border-gray-200",
1153
- e.meta.discrepancy && !C.winner ? "tv-candidate-disagrees border-amber-200" : ""
1174
+ x.winner ? "border-gray-300 bg-gray-50 shadow-sm" : "border-gray-200",
1175
+ e.meta.discrepancy && !x.winner ? "tv-candidate-disagrees border-amber-200" : ""
1154
1176
  ]])
1155
1177
  }, [
1156
- o("div", La, [
1157
- o("div", Pa, [
1158
- o("div", Aa, [
1159
- D(u(K), {
1160
- variant: C.variant,
1178
+ i("div", za, [
1179
+ i("div", Pa, [
1180
+ i("div", ja, [
1181
+ I(f(M), {
1182
+ variant: x.variant,
1161
1183
  size: "xs"
1162
1184
  }, {
1163
- default: O(() => [
1164
- I(i(C.title), 1)
1185
+ default: S(() => [
1186
+ N(v(x.title), 1)
1165
1187
  ]),
1166
1188
  _: 2
1167
1189
  }, 1032, ["variant"]),
1168
- C.winner ? (a(), E(u(K), {
1190
+ x.winner ? (l(), V(f(M), {
1169
1191
  key: 0,
1170
1192
  variant: "success",
1171
1193
  size: "xxs",
1172
1194
  class: "tv-winner-chip"
1173
1195
  }, {
1174
- default: O(() => [...x[8] || (x[8] = [
1175
- I("current value", -1)
1196
+ default: S(() => [...d[8] || (d[8] = [
1197
+ N("current value", -1)
1176
1198
  ])]),
1177
1199
  _: 1
1178
- })) : p("", !0)
1200
+ })) : h("", !0)
1179
1201
  ]),
1180
- o("div", za, i(P(C.value)), 1),
1181
- o("div", ja, i(C.detail), 1)
1202
+ i("div", Ra, v(G(x.value)), 1),
1203
+ i("div", Ua, v(x.detail), 1)
1182
1204
  ]),
1183
- C.accept && !C.winner ? (a(), E(u(ie), {
1205
+ x.accept && !x.winner ? (l(), V(f(re), {
1184
1206
  key: 0,
1185
1207
  size: "sm",
1186
- variant: C.variant,
1187
- loading: Y.value,
1188
- class: A(`tv-accept-${C.key}`),
1189
- onClick: C.accept
1208
+ variant: x.variant,
1209
+ loading: $.value,
1210
+ class: A(`tv-accept-${x.key}`),
1211
+ onClick: x.accept
1190
1212
  }, {
1191
- default: O(() => [...x[9] || (x[9] = [
1192
- I("Accept this value", -1)
1213
+ default: S(() => [...d[9] || (d[9] = [
1214
+ N("Accept this value", -1)
1193
1215
  ])]),
1194
1216
  _: 1
1195
- }, 8, ["variant", "loading", "class", "onClick"])) : p("", !0)
1217
+ }, 8, ["variant", "loading", "class", "onClick"])) : h("", !0)
1196
1218
  ])
1197
1219
  ], 2))), 128)),
1198
- e.save ? (a(), s("div", Ra, [
1199
- D(u(nt), {
1200
- modelValue: J.value,
1201
- "onUpdate:modelValue": x[1] || (x[1] = (C) => J.value = C),
1220
+ e.save ? (l(), c("div", Ba, [
1221
+ I(f(lt), {
1222
+ modelValue: p.value,
1223
+ "onUpdate:modelValue": d[1] || (d[1] = (x) => p.value = x),
1202
1224
  size: "sm",
1203
1225
  class: "tv-custom-input flex-1",
1204
1226
  placeholder: "Type the correct value…",
1205
- disabled: Y.value
1227
+ disabled: $.value
1206
1228
  }, null, 8, ["modelValue", "disabled"]),
1207
- D(u(ie), {
1229
+ I(f(re), {
1208
1230
  variant: "success",
1209
1231
  size: "sm",
1210
1232
  class: "tv-accept-custom",
1211
- loading: Y.value,
1212
- disabled: !J.value,
1213
- onClick: y
1233
+ loading: $.value,
1234
+ disabled: !p.value,
1235
+ onClick: le
1214
1236
  }, {
1215
- default: O(() => [...x[10] || (x[10] = [
1216
- I("Save custom value", -1)
1237
+ default: S(() => [...d[10] || (d[10] = [
1238
+ N("Save custom value", -1)
1217
1239
  ])]),
1218
1240
  _: 1
1219
1241
  }, 8, ["loading", "disabled"])
1220
- ])) : (a(), s("div", Ua, " Read-only render — corrections are disabled here "))
1221
- ])) : p("", !0),
1222
- T.value === "history" ? (a(), s("section", Ba, [
1223
- o("section", Ma, [
1224
- o("div", Fa, [
1225
- o("div", Ya, [
1226
- D(u(K), {
1242
+ ])) : (l(), c("div", Ma, " Read-only render — corrections are disabled here "))
1243
+ ])) : h("", !0),
1244
+ j.value === "history" ? (l(), c("section", Fa, [
1245
+ i("section", Ya, [
1246
+ i("div", Ka, [
1247
+ i("div", Ha, [
1248
+ I(f(M), {
1227
1249
  variant: "success",
1228
1250
  size: "xxs"
1229
1251
  }, {
1230
- default: O(() => [...x[11] || (x[11] = [
1231
- I("current value", -1)
1252
+ default: S(() => [...d[11] || (d[11] = [
1253
+ N("current value", -1)
1232
1254
  ])]),
1233
1255
  _: 1
1234
1256
  }),
1235
- o("span", Ka, i(P(l.value.value)), 1)
1257
+ i("span", Ja, v(G(n.value.value)), 1)
1236
1258
  ]),
1237
- $.value != null ? (a(), s("span", Ha, "Confidence " + i($.value) + "/5 · " + i(u(G)[L.value]), 1)) : (a(), s("span", Ja, i(u(G)[L.value]), 1))
1259
+ z.value != null ? (l(), c("span", Ga, "Confidence " + v(z.value) + "/5 · " + v(f(K)[q.value]), 1)) : (l(), c("span", Qa, v(f(K)[q.value]), 1))
1238
1260
  ]),
1239
- S.value ? (a(), s("p", Ga, i(S.value), 1)) : p("", !0)
1261
+ F.value ? (l(), c("p", Wa, v(F.value), 1)) : h("", !0)
1240
1262
  ]),
1241
- x[13] || (x[13] = o("div", { class: "flex flex-wrap items-baseline justify-between gap-2" }, [
1242
- o("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Every recorded attempt "),
1243
- o("div", { class: "text-xs text-gray-400" }, "oldest first")
1263
+ d[13] || (d[13] = i("div", { class: "flex flex-wrap items-baseline justify-between gap-2" }, [
1264
+ i("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Every recorded attempt "),
1265
+ i("div", { class: "text-xs text-gray-400" }, "oldest first")
1244
1266
  ], -1)),
1245
- D(Ke, {
1246
- modelValue: te.value,
1247
- "onUpdate:modelValue": x[2] || (x[2] = (C) => te.value = C),
1248
- items: ue.value,
1267
+ m.value ? (l(), c(B, { key: 0 }, H(2, (x) => I(f(ve), {
1268
+ key: x,
1269
+ shape: "rounded",
1270
+ class: "tv-history-skeleton h-16 w-full"
1271
+ })), 64)) : (l(), V(Fe, {
1272
+ key: 1,
1273
+ modelValue: pe.value,
1274
+ "onUpdate:modelValue": d[2] || (d[2] = (x) => pe.value = x),
1275
+ items: Ye.value,
1249
1276
  "id-prefix": "tv-attempt",
1250
1277
  class: "tv-history-accordion overflow-hidden rounded-lg border border-gray-200"
1251
1278
  }, {
1252
- header: O(({ item: C }) => {
1253
- var ne, le, se, Se, Ve, Ne, qe;
1279
+ header: S(({ item: x }) => {
1280
+ var se, ie, oe, $e, Ce, Se, Ve;
1254
1281
  return [
1255
- o("span", {
1282
+ i("span", {
1256
1283
  class: A([
1257
1284
  "tv-history-row flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",
1258
- (ne = R.value.get(C.value)) != null && ne.is_chosen ? "tv-history-chosen" : ""
1285
+ (se = R.value.get(x.value)) != null && se.is_chosen ? "tv-history-chosen" : ""
1259
1286
  ])
1260
1287
  }, [
1261
- (le = R.value.get(C.value)) != null && le.is_chosen ? (a(), E(u(K), {
1288
+ (ie = R.value.get(x.value)) != null && ie.is_chosen ? (l(), V(f(M), {
1262
1289
  key: 0,
1263
1290
  variant: "success",
1264
1291
  size: "xxs",
1265
1292
  class: "tv-history-chosen-chip"
1266
1293
  }, {
1267
- default: O(() => [...x[12] || (x[12] = [
1268
- I("chosen", -1)
1294
+ default: S(() => [...d[12] || (d[12] = [
1295
+ N("chosen", -1)
1269
1296
  ])]),
1270
1297
  _: 1
1271
- })) : p("", !0),
1272
- o("span", Qa, i(P((se = R.value.get(C.value)) == null ? void 0 : se.value)), 1),
1273
- (Se = R.value.get(C.value)) != null && Se.state ? (a(), E(u(K), {
1298
+ })) : h("", !0),
1299
+ i("span", Xa, v(G((oe = R.value.get(x.value)) == null ? void 0 : oe.value)), 1),
1300
+ ($e = R.value.get(x.value)) != null && $e.state ? (l(), V(f(M), {
1274
1301
  key: 1,
1275
- variant: ((Ve = R.value.get(C.value)) == null ? void 0 : Ve.state) === "failed" ? "danger" : "muted",
1302
+ variant: ((Ce = R.value.get(x.value)) == null ? void 0 : Ce.state) === "failed" ? "danger" : "muted",
1276
1303
  size: "xxs",
1277
1304
  class: "tv-history-state"
1278
1305
  }, {
1279
- default: O(() => {
1280
- var Oe;
1306
+ default: S(() => {
1307
+ var Ne;
1281
1308
  return [
1282
- I(i((Oe = R.value.get(C.value)) == null ? void 0 : Oe.state), 1)
1309
+ N(v((Ne = R.value.get(x.value)) == null ? void 0 : Ne.state), 1)
1283
1310
  ];
1284
1311
  }),
1285
1312
  _: 2
1286
- }, 1032, ["variant"])) : p("", !0),
1287
- ((Ne = R.value.get(C.value)) == null ? void 0 : Ne.confidence) != null ? (a(), s("span", Wa, i((qe = R.value.get(C.value)) == null ? void 0 : qe.confidence) + "/5", 1)) : p("", !0),
1288
- o("span", Xa, i(Je(
1289
- R.value.get(C.value)
1313
+ }, 1032, ["variant"])) : h("", !0),
1314
+ ((Se = R.value.get(x.value)) == null ? void 0 : Se.confidence) != null ? (l(), c("span", Za, v((Ve = R.value.get(x.value)) == null ? void 0 : Ve.confidence) + "/5", 1)) : h("", !0),
1315
+ i("span", el, v(He(
1316
+ R.value.get(x.value)
1290
1317
  )), 1),
1291
- o("span", Za, i(He(R.value.get(C.value))), 1)
1318
+ i("span", tl, v(Ke(R.value.get(x.value))), 1)
1292
1319
  ], 2)
1293
1320
  ];
1294
1321
  }),
1295
- panel: O(({ item: C }) => {
1296
- var ne, le, se;
1322
+ panel: S(({ item: x }) => {
1323
+ var se, ie, oe;
1297
1324
  return [
1298
- D(Pe, {
1299
- evidence: u(oe)(
1300
- (ne = R.value.get(C.value)) == null ? void 0 : ne.sources
1325
+ I(Te, {
1326
+ evidence: f(me)(
1327
+ (se = R.value.get(x.value)) == null ? void 0 : se.sources
1301
1328
  ),
1302
- reasoning: Ge(R.value.get(C.value)),
1303
- basis: (le = R.value.get(C.value)) == null ? void 0 : le.basis,
1304
- failed: ((se = R.value.get(C.value)) == null ? void 0 : se.state) === "failed",
1329
+ reasoning: Je(R.value.get(x.value)),
1330
+ basis: (ie = R.value.get(x.value)) == null ? void 0 : ie.basis,
1331
+ failed: ((oe = R.value.get(x.value)) == null ? void 0 : oe.state) === "failed",
1305
1332
  collapsible: !1,
1306
1333
  dense: ""
1307
1334
  }, null, 8, ["evidence", "reasoning", "basis", "failed"])
1308
1335
  ];
1309
1336
  }),
1310
1337
  _: 1
1311
- }, 8, ["modelValue", "items"])
1312
- ])) : p("", !0),
1313
- T.value === "audit" ? (a(), s("section", en, [
1314
- de.value ? (a(), s(U, { key: 0 }, F(2, (C) => D(u(je), {
1315
- key: C,
1338
+ }, 8, ["modelValue", "items"]))
1339
+ ])) : h("", !0),
1340
+ j.value === "audit" ? (l(), c("section", al, [
1341
+ de.value && Z.value === null ? (l(), c(B, { key: 0 }, H(2, (x) => I(f(ve), {
1342
+ key: x,
1316
1343
  shape: "rounded",
1317
1344
  class: "tv-audit-skeleton h-24 w-full"
1318
- })), 64)) : ce.value ? (a(), E(u(ge), {
1345
+ })), 64)) : ce.value ? (l(), V(f(ge), {
1319
1346
  key: 1,
1320
1347
  variant: "danger",
1321
1348
  class: "tv-audit-error"
1322
1349
  }, {
1323
- default: O(() => [
1324
- I(" Could not load the audit trail: " + i(ce.value), 1)
1350
+ default: S(() => [
1351
+ N(" Could not load the audit trail: " + v(ce.value), 1)
1325
1352
  ]),
1326
1353
  _: 1
1327
- })) : ee.value && ee.value.length === 0 ? (a(), s("div", tn, " No LLM calls recorded for this data point ")) : ee.value ? (a(!0), s(U, { key: 3 }, F(ee.value, (C) => (a(), E(jt, {
1328
- key: String(C.id),
1329
- call: C
1330
- }, null, 8, ["call"]))), 128)) : p("", !0)
1331
- ])) : p("", !0)
1354
+ })) : Z.value && Z.value.length === 0 ? (l(), c("div", ll, " No LLM calls recorded for this data point ")) : Z.value ? (l(!0), c(B, { key: 3 }, H(Z.value, (x) => (l(), V(Ut, {
1355
+ key: String(x.id),
1356
+ call: x
1357
+ }, null, 8, ["call"]))), 128)) : h("", !0)
1358
+ ])) : h("", !0)
1332
1359
  ])
1333
1360
  ];
1334
1361
  }),
1335
1362
  _: 1
1336
1363
  }, 8, ["modelValue", "title", "class"]));
1337
1364
  }
1338
- }), nn = ["contenteditable", "data-editable"], ln = {
1365
+ }), sl = ["contenteditable", "data-editable"], il = {
1339
1366
  key: 1,
1340
1367
  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",
1341
1368
  "data-status": "verified"
1342
- }, sn = {
1369
+ }, ol = {
1343
1370
  key: 2,
1344
1371
  class: "tv-discrepancy-indicator ml-0.5 text-amber-500",
1345
1372
  "aria-label": "discrepancy"
1346
- }, Bn = /* @__PURE__ */ Q({
1373
+ }, xl = /* @__PURE__ */ J({
1347
1374
  __name: "VerifiedField",
1348
1375
  props: {
1349
1376
  source: {},
@@ -1352,301 +1379,145 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
1352
1379
  format: { type: Function }
1353
1380
  },
1354
1381
  setup(e) {
1355
- const t = e, n = pe(), w = g(() => n.enabled.value), b = g(() => n.loading), c = j(null), r = g(() => {
1356
- var y;
1357
- return c.value ? c.value : t.source && t.field ? ((y = t.source.__meta) == null ? void 0 : y[t.field]) ?? null : null;
1358
- }), l = g(() => ke(r.value)), _ = g(() => {
1382
+ const t = e, a = we(), b = g(() => a.enabled.value), y = g(() => a.loading), s = O(null), r = g(() => {
1383
+ var p;
1384
+ return s.value ? s.value : t.source && t.field ? ((p = t.source.__meta) == null ? void 0 : p[t.field]) ?? null : null;
1385
+ }), n = g(() => Re(r.value)), C = g(() => {
1359
1386
  if (t.original !== void 0 && t.original !== null)
1360
1387
  return t.original;
1361
- if (r.value && l.value.value !== null && l.value.value !== void 0)
1362
- return l.value.value;
1388
+ if (r.value && n.value.value !== null && n.value.value !== void 0)
1389
+ return n.value.value;
1363
1390
  if (t.source && t.field) return t.source[t.field];
1364
- }), f = g(() => {
1365
- const y = _.value;
1366
- return y == null ? "" : typeof t.format == "function" ? t.format(y) : String(y);
1367
- }), V = g(() => {
1368
- var q, P;
1369
- const y = (P = (q = r.value) == null ? void 0 : q.candidates) == null ? void 0 : P.extracted;
1370
- return (y == null ? void 0 : y.state) === "failed" ? "failed" : _e(y == null ? void 0 : y.confidence);
1371
- }), $ = g(() => Fe(r.value)), L = g(() => {
1372
- var y, q;
1373
- return !!((q = (y = r.value) == null ? void 0 : y.candidates) != null && q.override);
1374
- }), S = g(() => {
1375
- var q;
1376
- const y = (q = r.value) == null ? void 0 : q.candidates;
1377
- return !!(y != null && y.override || y != null && y.extracted || y != null && y.claim);
1378
- }), d = g(() => w.value), m = g(() => !!r.value), h = g(() => {
1379
- const y = r.value;
1380
- return d.value && !!y && Ye(y);
1381
- }), B = g(() => {
1382
- var ue, te, R;
1383
- const y = (te = (ue = r.value) == null ? void 0 : ue.candidates) == null ? void 0 : te.extracted;
1384
- if (!y) return "No verification data";
1385
- if (V.value === "failed")
1386
- return y.reasoning ? `${G.failed}: ${y.reasoning}` : G.failed;
1387
- const q = [], P = G[V.value];
1388
- q.push(
1389
- y.confidence != null ? `${P} (${y.confidence}/5)` : P
1391
+ }), u = g(() => {
1392
+ const p = C.value;
1393
+ return p == null ? "" : typeof t.format == "function" ? t.format(p) : String(p);
1394
+ }), _ = g(() => {
1395
+ var $, E;
1396
+ const p = (E = ($ = r.value) == null ? void 0 : $.candidates) == null ? void 0 : E.extracted;
1397
+ return (p == null ? void 0 : p.state) === "failed" ? "failed" : _e(p == null ? void 0 : p.confidence);
1398
+ }), m = g(() => gt(r.value)), T = g(() => {
1399
+ var p, $;
1400
+ return !!(($ = (p = r.value) == null ? void 0 : p.candidates) != null && $.override);
1401
+ }), z = g(() => {
1402
+ var $;
1403
+ const p = ($ = r.value) == null ? void 0 : $.candidates;
1404
+ return !!(p != null && p.override || p != null && p.extracted || p != null && p.claim);
1405
+ }), q = g(() => b.value), F = g(() => !!r.value), Y = g(() => {
1406
+ const p = r.value;
1407
+ return q.value && !!p && Be(p);
1408
+ }), U = g(() => {
1409
+ var ne, G, te;
1410
+ const p = (G = (ne = r.value) == null ? void 0 : ne.candidates) == null ? void 0 : G.extracted;
1411
+ if (!p) return "No verification data";
1412
+ if (_.value === "failed")
1413
+ return p.reasoning ? `${K.failed}: ${p.reasoning}` : K.failed;
1414
+ const $ = [], E = K[_.value];
1415
+ $.push(
1416
+ p.confidence != null ? `${E} (${p.confidence}/5)` : E
1390
1417
  );
1391
- const Z = ((R = y.sources) == null ? void 0 : R.length) ?? 0;
1392
- return Z > 0 && q.push(`${Z} source ${Z === 1 ? "page" : "pages"}`), $.value && q.push("sources disagree"), q.join(" · ");
1418
+ const le = p.sources_count ?? ((te = p.sources) == null ? void 0 : te.length) ?? 0;
1419
+ return le > 0 && $.push(`${le} source ${le === 1 ? "page" : "pages"}`), m.value && $.push("sources disagree"), $.join(" · ");
1393
1420
  });
1394
- function k(y) {
1395
- var q;
1396
- c.value = y, (q = t.source) != null && q.__meta && t.field && (t.source.__meta[t.field] = y);
1421
+ function w(p) {
1422
+ var $;
1423
+ s.value = p, ($ = t.source) != null && $.__meta && t.field && (t.source.__meta[t.field] = p);
1397
1424
  }
1398
- const T = g(() => ht(n, r, k)), N = g(() => !!T.value), M = j(!1), H = j(!1);
1399
- function J() {
1400
- r.value && (M.value = !0);
1425
+ const D = g(() => ht(a, r, w)), k = g(() => !!D.value), P = O(!1), j = O(!1);
1426
+ function Q() {
1427
+ r.value && (P.value = !0);
1401
1428
  }
1402
- const Y = g(() => m.value);
1403
- async function X(y) {
1404
- H.value = !1;
1405
- const P = (y.target.textContent ?? "").trim();
1406
- !T.value || P === f.value || await T.value(P, "custom");
1429
+ const W = g(() => F.value);
1430
+ async function X(p) {
1431
+ j.value = !1;
1432
+ const E = (p.target.textContent ?? "").trim();
1433
+ !D.value || E === u.value || await D.value(E, "custom");
1407
1434
  }
1408
- return (y, q) => (a(), s("span", {
1409
- class: A(["tv-field inline-flex items-baseline gap-1", h.value ? "tv-needs-review" : ""])
1435
+ return (p, $) => (l(), c("span", {
1436
+ class: A(["tv-field inline-flex items-baseline gap-1", Y.value ? "tv-needs-review" : ""])
1410
1437
  }, [
1411
- b.value ? (a(), E(u(je), {
1438
+ y.value ? (l(), V(f(ve), {
1412
1439
  key: 0,
1413
1440
  shape: "rounded",
1414
1441
  class: "tv-field-skeleton inline-block h-[1em] w-16 align-middle"
1415
- })) : (a(), s(U, { key: 1 }, [
1416
- o("span", {
1442
+ })) : (l(), c(B, { key: 1 }, [
1443
+ i("span", {
1417
1444
  class: A([
1418
1445
  "tv-field-value",
1419
- d.value && !S.value ? "tv-field-unverified cursor-pointer border-b border-dotted border-gray-300" : ""
1446
+ q.value && !z.value ? "tv-field-unverified cursor-pointer border-b border-dotted border-gray-300" : ""
1420
1447
  ]),
1421
- contenteditable: N.value,
1422
- "data-editable": N.value ? "true" : "false",
1423
- onFocus: q[0] || (q[0] = (P) => H.value = !0),
1448
+ contenteditable: k.value,
1449
+ "data-editable": k.value ? "true" : "false",
1450
+ onFocus: $[0] || ($[0] = (E) => j.value = !0),
1424
1451
  onBlur: X,
1425
- onKeydown: q[1] || (q[1] = We(ve((P) => P.target.blur(), ["prevent"]), ["enter"])),
1426
- onClick: q[2] || (q[2] = (P) => d.value && !S.value ? J() : void 0)
1452
+ onKeydown: $[1] || ($[1] = Qe(ye((E) => E.target.blur(), ["prevent"]), ["enter"])),
1453
+ onClick: $[2] || ($[2] = (E) => q.value && !z.value ? Q() : void 0)
1427
1454
  }, [
1428
- me(y.$slots, "default", {
1429
- value: _.value,
1430
- formatted: f.value
1455
+ xe(p.$slots, "default", {
1456
+ value: C.value,
1457
+ formatted: u.value
1431
1458
  }, () => [
1432
- I(i(f.value), 1)
1459
+ N(v(u.value), 1)
1433
1460
  ])
1434
- ], 42, nn),
1435
- d.value ? (a(), E(u(we), {
1461
+ ], 42, sl),
1462
+ q.value ? (l(), V(f(be), {
1436
1463
  key: 0,
1437
- tooltip: B.value,
1464
+ tooltip: U.value,
1438
1465
  placement: "top"
1439
1466
  }, {
1440
- trigger: O(() => [
1441
- o("button", {
1467
+ trigger: S(() => [
1468
+ i("button", {
1442
1469
  type: "button",
1443
- class: A(["tv-overlay inline-flex items-center align-middle transition-transform duration-150", [u(W), Y.value ? "cursor-pointer hover:scale-110" : "cursor-default"]]),
1444
- onClick: q[3] || (q[3] = (P) => Y.value ? J() : void 0)
1470
+ class: A(["tv-overlay inline-flex items-center align-middle transition-transform duration-150", [f(ee), W.value ? "cursor-pointer hover:scale-110" : "cursor-default"]]),
1471
+ onClick: $[3] || ($[3] = (E) => W.value ? Q() : void 0)
1445
1472
  }, [
1446
- L.value ? (a(), s("span", ln, "✔")) : (a(), E(ye, {
1473
+ T.value ? (l(), c("span", il, "✔")) : (l(), V(kt, {
1447
1474
  key: 0,
1448
- status: V.value
1475
+ status: _.value
1449
1476
  }, null, 8, ["status"])),
1450
- $.value && !L.value ? (a(), s("span", sn, "⚠")) : p("", !0)
1477
+ m.value && !T.value ? (l(), c("span", ol, "⚠")) : h("", !0)
1451
1478
  ], 2)
1452
1479
  ]),
1453
1480
  _: 1
1454
- }, 8, ["tooltip"])) : p("", !0),
1455
- r.value ? (a(), E(an, {
1481
+ }, 8, ["tooltip"])) : h("", !0),
1482
+ r.value ? (l(), V(nl, {
1456
1483
  key: 1,
1457
- modelValue: M.value,
1458
- "onUpdate:modelValue": q[4] || (q[4] = (P) => M.value = P),
1484
+ modelValue: P.value,
1485
+ "onUpdate:modelValue": $[4] || ($[4] = (E) => P.value = E),
1459
1486
  meta: r.value,
1460
1487
  label: e.field,
1461
- save: T.value
1462
- }, null, 8, ["modelValue", "meta", "label", "save"])) : p("", !0)
1488
+ save: D.value
1489
+ }, null, 8, ["modelValue", "meta", "label", "save"])) : h("", !0)
1463
1490
  ], 64))
1464
1491
  ], 2));
1465
1492
  }
1466
- }), on = { class: "tv-comparison-page flex flex-col gap-4" }, rn = {
1467
- key: 0,
1468
- class: "tv-comparison-empty text-gray-400"
1469
- }, un = {
1470
- key: 1,
1471
- class: "tv-anchored-group flex flex-col gap-3"
1472
- }, dn = { class: "flex items-center gap-2" }, cn = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, vn = { class: "tv-datapoint-resolved font-medium" }, fn = {
1473
- key: 0,
1474
- class: "tv-datapoint-discrepancy text-xs font-medium text-amber-600"
1475
- }, gn = { class: "tv-datapoint-candidates ml-4 text-xs text-gray-600" }, pn = { class: "font-medium" }, mn = {
1476
- key: 0,
1477
- class: "tv-datapoint-reasoning ml-4 text-xs italic text-gray-500"
1478
- }, xn = {
1479
- key: 1,
1480
- class: "tv-datapoint-sources ml-4 text-xs text-gray-500"
1481
- }, hn = { class: "tv-datapoint-cited text-gray-400" }, yn = ["href"], bn = {
1482
- key: 1,
1483
- class: "tv-source-page-label"
1484
- }, wn = {
1485
- key: 2,
1486
- class: "ml-1 text-gray-400"
1487
- }, _n = { class: "tv-source-quotes ml-4" }, kn = {
1488
- key: 2,
1489
- class: "tv-datapoint-history ml-4 mt-1 text-xs text-gray-500"
1490
- }, $n = {
1491
- key: 0,
1492
- class: "tv-history-chosen-mark"
1493
- }, Cn = { class: "tv-history-entry-value" }, Sn = {
1494
- key: 1,
1495
- class: "ml-1"
1496
- }, Vn = {
1497
- key: 2,
1498
- class: "ml-1"
1499
- }, Nn = {
1500
- key: 3,
1501
- class: "ml-1"
1502
- }, qn = {
1503
- key: 4,
1504
- class: "ml-1 text-gray-400"
1505
- }, On = {
1506
- key: 2,
1507
- class: "tv-unanchored-group flex flex-col gap-1"
1508
- }, In = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, Dn = { class: "tv-datapoint-value" }, Tn = /* @__PURE__ */ Q({
1509
- __name: "ComparisonPage",
1510
- setup(e) {
1511
- const t = pe(), n = g(() => $e(t.data)), w = g(() => n.value.filter((S) => !S.unanchored)), b = g(() => n.value.filter((S) => S.unanchored));
1512
- function c(S) {
1513
- const d = ke(S).value;
1514
- return d == null ? "" : String(d);
1515
- }
1516
- function r(S) {
1517
- return S == null ? "" : String(S);
1518
- }
1519
- function l(S) {
1520
- var d, m, h;
1521
- return (h = (m = (d = S.meta) == null ? void 0 : d.candidates) == null ? void 0 : m.extracted) == null ? void 0 : h.confidence;
1522
- }
1523
- function _(S) {
1524
- var h;
1525
- const d = (h = S.meta) == null ? void 0 : h.candidates;
1526
- if (!d) return [];
1527
- const m = [];
1528
- return d.override && m.push({ source: "override", value: d.override.value }), d.extracted && m.push({ source: "extracted", value: d.extracted.value }), d.claim && m.push({ source: "claim", value: d.claim.value }), m;
1529
- }
1530
- function f(S) {
1531
- var d, m, h;
1532
- return ((h = (m = (d = S.meta) == null ? void 0 : d.candidates) == null ? void 0 : m.extracted) == null ? void 0 : h.history) ?? [];
1533
- }
1534
- function V(S) {
1535
- return S.created_at ? new Date(S.created_at).toLocaleString() : "";
1536
- }
1537
- function $(S) {
1538
- var d, m, h;
1539
- return oe((h = (m = (d = S.meta) == null ? void 0 : d.candidates) == null ? void 0 : m.extracted) == null ? void 0 : h.sources).pages;
1540
- }
1541
- function L(S) {
1542
- var d, m, h;
1543
- return Ce(oe((h = (m = (d = S.meta) == null ? void 0 : d.candidates) == null ? void 0 : m.extracted) == null ? void 0 : h.sources));
1544
- }
1545
- return (S, d) => (a(), s("div", on, [
1546
- d[1] || (d[1] = o("h2", { class: "tv-comparison-title text-lg font-semibold" }, "Verification comparison", -1)),
1547
- n.value.length === 0 ? (a(), s("p", rn, " No data points to compare. ")) : p("", !0),
1548
- w.value.length ? (a(), s("section", un, [
1549
- (a(!0), s(U, null, F(w.value, (m) => (a(), s("div", {
1550
- key: m.path,
1551
- class: "tv-datapoint border-t border-gray-100 pt-2"
1552
- }, [
1553
- o("div", dn, [
1554
- o("span", cn, i(m.path), 1),
1555
- o("span", vn, i(c(m.meta)), 1),
1556
- D(ye, {
1557
- confidence: l(m),
1558
- "show-label": ""
1559
- }, null, 8, ["confidence"]),
1560
- u(Fe)(m.meta) ? (a(), s("span", fn, "⚠ discrepancy")) : p("", !0)
1561
- ]),
1562
- o("ul", gn, [
1563
- (a(!0), s(U, null, F(_(m), (h) => (a(), s("li", {
1564
- key: h.source,
1565
- class: "tv-candidate"
1566
- }, [
1567
- o("span", pn, i(h.source) + ":", 1),
1568
- I(" " + i(r(h.value)), 1)
1569
- ]))), 128))
1570
- ]),
1571
- u(xe)(m.meta) ? (a(), s("p", mn, i(u(xe)(m.meta)), 1)) : p("", !0),
1572
- $(m).length ? (a(), s("ul", xn, [
1573
- o("li", hn, i(L(m)), 1),
1574
- (a(!0), s(U, null, F($(m), (h) => (a(), s("li", {
1575
- key: h.key,
1576
- class: "tv-source-page"
1577
- }, [
1578
- h.url ? (a(), s("a", {
1579
- key: 0,
1580
- href: h.url,
1581
- class: "tv-source-link text-blue-600 underline",
1582
- target: "_blank",
1583
- rel: "noopener"
1584
- }, i(h.label), 9, yn)) : (a(), s("span", bn, i(h.label), 1)),
1585
- h.documentName ? (a(), s("span", wn, "· " + i(h.documentName), 1)) : p("", !0),
1586
- o("ul", _n, [
1587
- (a(!0), s(U, null, F(h.quotes, (B, k) => (a(), s("li", {
1588
- key: k,
1589
- class: "tv-source-quote italic"
1590
- }, "“" + i(B) + "”", 1))), 128))
1591
- ])
1592
- ]))), 128))
1593
- ])) : p("", !0),
1594
- f(m).length ? (a(), s("ul", kn, [
1595
- (a(!0), s(U, null, F(f(m), (h, B) => (a(), s("li", {
1596
- key: h.id ?? B,
1597
- class: A(["tv-history-entry", h.is_chosen ? "tv-history-entry-chosen font-medium text-green-700" : ""])
1598
- }, [
1599
- h.is_chosen ? (a(), s("span", $n, "✔ chosen · ")) : p("", !0),
1600
- o("span", Cn, i(r(h.value)), 1),
1601
- h.state ? (a(), s("span", Sn, "[" + i(h.state) + "]", 1)) : p("", !0),
1602
- h.confidence != null ? (a(), s("span", Vn, "· " + i(h.confidence) + "/5", 1)) : p("", !0),
1603
- h.page != null ? (a(), s("span", Nn, "· p" + i(h.page), 1)) : p("", !0),
1604
- V(h) ? (a(), s("span", qn, "· " + i(V(h)), 1)) : p("", !0)
1605
- ], 2))), 128))
1606
- ])) : p("", !0)
1607
- ]))), 128))
1608
- ])) : p("", !0),
1609
- b.value.length ? (a(), s("section", On, [
1610
- d[0] || (d[0] = o("h3", { class: "tv-unanchored-title text-sm font-semibold text-gray-500" }, " Unanchored / not from source ", -1)),
1611
- (a(!0), s(U, null, F(b.value, (m) => (a(), s("div", {
1612
- key: m.path,
1613
- class: "tv-unanchored-datapoint flex items-center gap-2 text-sm"
1614
- }, [
1615
- o("span", In, i(m.path), 1),
1616
- o("span", Dn, i(r(m.value)), 1),
1617
- D(ye, { status: "unverifiable" })
1618
- ]))), 128))
1619
- ])) : p("", !0)
1620
- ]));
1621
- }
1622
- }), En = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, Ln = { class: "tv-progress-block" }, Pn = { class: "mb-1 flex items-baseline justify-between" }, An = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, zn = {
1493
+ }), rl = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, ul = { class: "tv-progress-block" }, dl = { class: "mb-1 flex items-baseline justify-between" }, cl = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, vl = {
1623
1494
  key: 0,
1624
1495
  class: "tv-attempts-recorded mt-1 text-[11px] text-gray-400"
1625
- }, Mn = /* @__PURE__ */ Q({
1496
+ }, yl = /* @__PURE__ */ J({
1626
1497
  __name: "VerificationChrome",
1627
1498
  setup(e) {
1628
- const t = pe(), { enabled: n, openComparison: w } = t, b = ct(), c = Ae(), r = j(!1), l = g(() => xt(t.data)), _ = g(
1629
- () => $e(t.data).reduce(
1630
- (S, d) => {
1631
- var m, h, B, k;
1632
- return S + (((k = (B = (h = (m = d.meta) == null ? void 0 : m.candidates) == null ? void 0 : h.extracted) == null ? void 0 : B.history) == null ? void 0 : k.length) ?? 0);
1499
+ const t = we(), { enabled: a } = t, b = Le(), y = O(!1), s = g(() => yt(t.data)), r = g(
1500
+ () => Ue(t.data).reduce(
1501
+ (_, m) => {
1502
+ var T, z, q, F, Y, U, w;
1503
+ return _ + (((q = (z = (T = m.meta) == null ? void 0 : T.candidates) == null ? void 0 : z.extracted) == null ? void 0 : q.history_count) ?? ((w = (U = (Y = (F = m.meta) == null ? void 0 : F.candidates) == null ? void 0 : Y.extracted) == null ? void 0 : U.history) == null ? void 0 : w.length) ?? 0);
1633
1504
  },
1634
1505
  0
1635
1506
  )
1636
- ), f = j(!1);
1507
+ ), n = O(!1);
1637
1508
  ae(
1638
- () => l.value.percent,
1639
- (S) => {
1640
- S === 100 && l.value.total > 0 && !f.value && (f.value = !0, c.success("All data points verified 🎯"));
1509
+ () => s.value.percent,
1510
+ (_) => {
1511
+ _ === 100 && s.value.total > 0 && !n.value && (n.value = !0, b.success("All data points verified 🎯"));
1641
1512
  }
1642
1513
  );
1643
- let V = 0;
1644
- function $() {
1645
- const S = document.querySelectorAll(".tv-needs-review");
1646
- if (!S.length) return;
1647
- V = V % S.length;
1648
- const d = S[V];
1649
- V++, d.scrollIntoView({ behavior: "smooth", block: "center" }), d.animate(
1514
+ let C = 0;
1515
+ function u() {
1516
+ const _ = document.querySelectorAll(".tv-needs-review");
1517
+ if (!_.length) return;
1518
+ C = C % _.length;
1519
+ const m = _[C];
1520
+ C++, m.scrollIntoView({ behavior: "smooth", block: "center" }), m.animate(
1650
1521
  [
1651
1522
  { boxShadow: "0 0 0 0 rgba(245, 158, 11, 0.8)" },
1652
1523
  { boxShadow: "0 0 0 12px rgba(245, 158, 11, 0)" }
@@ -1654,119 +1525,97 @@ const Tt = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm"
1654
1525
  { duration: 900, iterations: 2 }
1655
1526
  );
1656
1527
  }
1657
- function L() {
1658
- w(), r.value = !1;
1659
- }
1660
- return (S, d) => (a(), s(U, null, [
1661
- o("button", {
1528
+ return (_, m) => (l(), c(B, null, [
1529
+ i("button", {
1662
1530
  type: "button",
1663
- 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", u(W)]),
1531
+ 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", f(ee)]),
1664
1532
  title: "Verification",
1665
- onClick: d[0] || (d[0] = ve((m) => r.value = !r.value, ["stop"]))
1533
+ onClick: m[0] || (m[0] = ye((T) => y.value = !y.value, ["stop"]))
1666
1534
  }, [
1667
- D(u(lt), {
1668
- icon: u(st),
1535
+ I(f(nt), {
1536
+ icon: f(st),
1669
1537
  class: "h-5 w-5"
1670
1538
  }, null, 8, ["icon"]),
1671
- u(n) && l.value.needsReview > 0 ? (a(), E(u(ot), {
1539
+ f(a) && s.value.needsReview > 0 ? (l(), V(f(it), {
1672
1540
  key: 0,
1673
- value: l.value.needsReview,
1541
+ value: s.value.needsReview,
1674
1542
  variant: "warning",
1675
1543
  class: "tv-needs-review-badge absolute -right-1 -top-1"
1676
- }, null, 8, ["value"])) : p("", !0)
1544
+ }, null, 8, ["value"])) : h("", !0)
1677
1545
  ], 2),
1678
- r.value ? (a(), s("div", {
1546
+ y.value ? (l(), c("div", {
1679
1547
  key: 0,
1680
- 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", u(W)])
1548
+ 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", f(ee)])
1681
1549
  }, [
1682
- o("label", En, [
1683
- d[3] || (d[3] = o("span", null, "Verification overlay", -1)),
1684
- Xe(o("input", {
1685
- "onUpdate:modelValue": d[1] || (d[1] = (m) => Ie(n) ? n.value = m : null),
1550
+ i("label", rl, [
1551
+ m[2] || (m[2] = i("span", null, "Verification overlay", -1)),
1552
+ We(i("input", {
1553
+ "onUpdate:modelValue": m[1] || (m[1] = (T) => Xe(a) ? a.value = T : null),
1686
1554
  type: "checkbox",
1687
1555
  class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
1688
1556
  }, null, 512), [
1689
- [Ze, u(n)]
1557
+ [Ze, f(a)]
1690
1558
  ])
1691
1559
  ]),
1692
- u(n) && l.value.total > 0 ? (a(), s(U, { key: 0 }, [
1693
- o("div", Ln, [
1694
- o("div", Pn, [
1695
- d[4] || (d[4] = o("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
1696
- o("span", An, i(l.value.verified) + " / " + i(l.value.total), 1)
1560
+ f(a) && s.value.total > 0 ? (l(), c(B, { key: 0 }, [
1561
+ i("div", ul, [
1562
+ i("div", dl, [
1563
+ m[3] || (m[3] = i("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
1564
+ i("span", cl, v(s.value.verified) + " / " + v(s.value.total), 1)
1697
1565
  ]),
1698
- D(u(ze), {
1699
- value: l.value.verified,
1700
- max: l.value.total,
1566
+ I(f(Ae), {
1567
+ value: s.value.verified,
1568
+ max: s.value.total,
1701
1569
  size: "md",
1702
- variant: l.value.percent === 100 ? "success" : "info",
1703
- striped: l.value.percent < 100,
1704
- "animate-stripes": l.value.percent < 100,
1705
- glow: l.value.percent === 100,
1570
+ variant: s.value.percent === 100 ? "success" : "info",
1571
+ striped: s.value.percent < 100,
1572
+ "animate-stripes": s.value.percent < 100,
1573
+ glow: s.value.percent === 100,
1706
1574
  gradient: ""
1707
1575
  }, null, 8, ["value", "max", "variant", "striped", "animate-stripes", "glow"]),
1708
- _.value > 0 ? (a(), s("div", zn, i(_.value) + " extraction attempt" + i(_.value === 1 ? "" : "s") + " recorded ", 1)) : p("", !0)
1576
+ r.value > 0 ? (l(), c("div", vl, v(r.value) + " extraction attempt" + v(r.value === 1 ? "" : "s") + " recorded ", 1)) : h("", !0)
1709
1577
  ]),
1710
- l.value.needsReview > 0 ? (a(), s("button", {
1578
+ s.value.needsReview > 0 ? (l(), c("button", {
1711
1579
  key: 0,
1712
1580
  type: "button",
1713
- 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", u(W)]),
1714
- onClick: ve($, ["stop"])
1581
+ 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", f(ee)]),
1582
+ onClick: ye(u, ["stop"])
1715
1583
  }, [
1716
- o("span", null, i(l.value.needsReview) + " need" + i(l.value.needsReview === 1 ? "s" : "") + " review", 1),
1717
- d[5] || (d[5] = o("span", { "aria-hidden": "true" }, "→", -1))
1718
- ], 2)) : p("", !0)
1719
- ], 64)) : p("", !0),
1720
- o("button", {
1721
- type: "button",
1722
- 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", u(W)]),
1723
- onClick: ve(L, ["stop"])
1724
- }, " Open comparison page ", 2)
1725
- ], 2)) : p("", !0),
1726
- D(u(be), {
1727
- modelValue: u(b),
1728
- "onUpdate:modelValue": d[2] || (d[2] = (m) => Ie(b) ? b.value = m : null),
1729
- title: "Verification comparison",
1730
- width: 80,
1731
- "close-x": "",
1732
- class: A(u(W))
1733
- }, {
1734
- default: O(() => [
1735
- D(Tn)
1736
- ]),
1737
- _: 1
1738
- }, 8, ["modelValue", "class"]),
1739
- D(u(it), {
1740
- class: A(u(W))
1584
+ i("span", null, v(s.value.needsReview) + " need" + v(s.value.needsReview === 1 ? "s" : "") + " review", 1),
1585
+ m[4] || (m[4] = i("span", { "aria-hidden": "true" }, "→", -1))
1586
+ ], 2)) : h("", !0)
1587
+ ], 64)) : h("", !0)
1588
+ ], 2)) : h("", !0),
1589
+ I(f(ot), {
1590
+ class: A(f(ee))
1741
1591
  }, null, 8, ["class"])
1742
1592
  ], 64));
1743
1593
  }
1744
1594
  });
1745
1595
  export {
1746
- W as CHROME_CLASS,
1747
- Pe as CitationEvidence,
1748
- Le as CitationPage,
1749
- va as CitationPageList,
1750
- Tn as ComparisonPage,
1751
- ye as ConfidenceIcon,
1752
- Re as ENABLED_STORAGE_KEY,
1753
- Me as RESOLUTION_PRIORITY,
1596
+ ee as CHROME_CLASS,
1597
+ Te as CitationEvidence,
1598
+ De as CitationPage,
1599
+ ga as CitationPageList,
1600
+ kt as ConfidenceIcon,
1601
+ ze as ENABLED_STORAGE_KEY,
1602
+ je as RESOLUTION_PRIORITY,
1754
1603
  vt as STATUS_COLORS,
1755
- G as STATUS_LABELS,
1756
- Mn as VerificationChrome,
1757
- an as VerificationModal,
1758
- Bn as VerifiedField,
1604
+ K as STATUS_LABELS,
1605
+ yl as VerificationChrome,
1606
+ nl as VerificationModal,
1607
+ xl as VerifiedField,
1759
1608
  _e as bucketConfidence,
1760
- gt as candidatesDisagree,
1761
- oe as citationEvidence,
1762
- Ce as citationSummary,
1763
- xt as computeProgress,
1764
- _t as fetchDataPointAudit,
1765
- Fe as hasDiscrepancy,
1766
- Un as initVerification,
1767
- xe as reasoningOf,
1609
+ pt as candidatesDisagree,
1610
+ me as citationEvidence,
1611
+ Me as citationSummary,
1612
+ yt as computeProgress,
1613
+ $t as fetchDataPointDetail,
1614
+ gt as hasDiscrepancy,
1615
+ pl as initVerification,
1616
+ ml as reasoningOf,
1768
1617
  ft as resolveCandidates,
1769
- ke as resolveDataPoint,
1770
- pe as useVerification,
1771
- $e as walkDataPoints
1618
+ Re as resolveDataPoint,
1619
+ we as useVerification,
1620
+ Ue as walkDataPoints
1772
1621
  };