@sanity/ailf-studio 0.1.19 → 0.1.21

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.js +1443 -1883
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2827,17 +2827,154 @@ import { route } from "sanity/router";
2827
2827
  // src/components/Dashboard.tsx
2828
2828
  import {
2829
2829
  Container,
2830
- Flex as Flex29,
2831
- Select as Select3,
2832
- Stack as Stack27,
2830
+ Flex as Flex22,
2831
+ Stack as Stack24,
2833
2832
  Tab as Tab2,
2834
2833
  TabList as TabList2,
2835
2834
  TabPanel as TabPanel2,
2836
- Text as Text36
2835
+ Text as Text29
2837
2836
  } from "@sanity/ui";
2838
- import { useCallback as useCallback22, useEffect as useEffect11, useState as useState17 } from "react";
2839
- import { useClient as useClient14 } from "sanity";
2840
- import { useRouter as useRouter2 } from "sanity/router";
2837
+ import { useCallback as useCallback20 } from "react";
2838
+ import { useRouter as useRouter3 } from "sanity/router";
2839
+
2840
+ // src/components/ComparisonView.tsx
2841
+ import { Badge as Badge3, Box as Box7, Card as Card6, Flex as Flex7, Grid, Select, Stack as Stack8, Text as Text11 } from "@sanity/ui";
2842
+ import { useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
2843
+ import { useClient as useClient3 } from "sanity";
2844
+
2845
+ // src/glossary.ts
2846
+ var GLOSSARY = {
2847
+ // -- Overview stats -------------------------------------------------------
2848
+ overallScore: "A weighted average across all feature areas: Task Completion (50%), Code Correctness (25%), and Doc Coverage (25%).",
2849
+ docLift: "How much the docs help, compared to the model's training data alone. This is the score with docs minus the score without. Higher is better.",
2850
+ actualScore: "How well an AI agent scores when it has to find docs on its own through web search and page fetching. This is the real-world scenario. Only available in full mode.",
2851
+ retrievalGap: "The score lost because agents can't find or use all the relevant docs. Calculated as ceiling minus actual. Lower is better; zero means agents find everything.",
2852
+ infraEfficiency: "What percentage of the docs' potential quality actually reaches agents (actual \xF7 ceiling). 100% means agents find and use all relevant docs perfectly.",
2853
+ // -- Three-layer decomposition columns ------------------------------------
2854
+ floor: "Score without any documentation. This tells you what the model already knows from its training data.",
2855
+ ceiling: "Score with gold-standard docs injected directly into the prompt. This is the best the documentation can do.",
2856
+ actual: "Score when an AI agent finds docs on its own through web search and page fetching. This is the real-world experience.",
2857
+ retGap: "Quality lost to discoverability (ceiling minus actual). The gap between what the docs could deliver and what agents actually get.",
2858
+ efficiency: "What fraction of the docs' quality reaches agents in practice (actual \xF7 ceiling, shown as a percentage).",
2859
+ invertedRetGap: "\u26A0\uFE0F Inverted retrieval gap: agents that can't find the docs actually score higher, because the docs hurt performance. This usually means there's a doc quality problem.",
2860
+ // -- Per-area score columns -----------------------------------------------
2861
+ score: "Weighted score for this feature area: Task Completion \xD7 50% + Code Correctness \xD7 25% + Doc Coverage \xD7 25%.",
2862
+ taskCompletion: "Can the LLM implement the requested feature? Graded 0\u2013100.",
2863
+ codeCorrectness: "Is the generated code idiomatic, correct, and following best practices? Graded 0\u2013100.",
2864
+ docCoverage: "Did the docs provide the information needed to implement the feature? Graded 0\u2013100.",
2865
+ tests: "Number of test cases in this feature area.",
2866
+ // -- Comparison deltas ----------------------------------------------------
2867
+ overallDelta: "Change in overall score between the two runs. Positive means the experiment scored higher.",
2868
+ actualDelta: "Change in actual (agent-retrieved) score between runs. Positive means agents did better.",
2869
+ retGapDelta: "Change in retrieval gap between runs. Negative is good here: it means the gap shrank and agents found more relevant docs.",
2870
+ efficiencyDelta: "Change in infrastructure efficiency between runs. Positive means agents are capturing more of the docs' potential.",
2871
+ // -- Comparison table columns ---------------------------------------------
2872
+ baseline: "The reference run you're comparing against.",
2873
+ experiment: "The new run you're evaluating.",
2874
+ delta: "Difference between experiment and baseline. Positive means improvement, negative means regression.",
2875
+ change: "Whether the change is meaningful: improved, regressed, or unchanged (within the noise threshold).",
2876
+ // -- Grader judgments ------------------------------------------------------
2877
+ lowScoringJudgments: "The grading model's explanations for tests that scored below 70/100.",
2878
+ judgmentReason: "The grading model's natural language explanation of what went wrong.",
2879
+ // -- Recommendations / gap analysis ----------------------------------------
2880
+ recommendations: "Prioritized remediation plan from gap analysis. Each recommendation identifies a documentation problem, the affected feature area, and the estimated score lift from fixing it.",
2881
+ totalPotentialLift: "Aggregate potential score lift if all identified gaps were fixed. This is a conservative estimate \u2014 each gap targets the median of non-bottlenecked dimensions, not 100.",
2882
+ failureMode: "The type of documentation problem: missing-docs (functionality not covered), incorrect-docs (factual errors), outdated-docs (stale API/patterns), or poor-structure (hard to find/understand).",
2883
+ estimatedLift: "Estimated composite score improvement if this gap is fully fixed. Based on raising bottleneck dimensions to the median of non-bottlenecked dimensions.",
2884
+ confidence: "How confident the classifier is in this diagnosis. High = strong keyword + structural signal agreement. Medium = partial agreement. Low = weak signals only.",
2885
+ // -- Agent behavior --------------------------------------------------------
2886
+ agentBehaviorOverview: "How AI agents interacted with your documentation during evaluation: what they searched for, which pages they visited, and how much time they spent on network requests.",
2887
+ searchQueries: "The exact search queries agents used to find documentation. Helps you understand how agents discover your content and whether your docs appear for relevant queries.",
2888
+ docSlugsVisited: "Documentation page slugs that agents actually visited during evaluation. Compare against canonical docs to see if agents found the right pages.",
2889
+ externalDomains: "Non-Sanity domains that agents contacted during evaluation. High external domain counts may indicate agents couldn't find what they needed in your docs.",
2890
+ avgDocPagesVisited: "Average number of documentation pages visited per test. Higher counts can mean agents need to consult many pages (complex task) or can't find the right one quickly.",
2891
+ avgSearchesPerformed: "Average number of web searches performed per test. High search counts can indicate docs are hard to discover through search engines.",
2892
+ avgNetworkTimeMs: "Average time spent on network requests per test. Includes page fetches, search queries, and API calls.",
2893
+ totalRequests: "Total number of HTTP requests the agent made during the test, including searches, page visits, and API calls.",
2894
+ totalBytesDownloaded: "Total bytes downloaded by the agent. Large downloads may indicate the agent is fetching many pages or very large documents.",
2895
+ // -- Dimension deltas -----------------------------------------------------
2896
+ dimTaskCompletion: "Change in task completion between runs. Positive means implementations are more complete.",
2897
+ dimCodeCorrectness: "Change in code correctness between runs. Positive means better code quality.",
2898
+ dimDocCoverage: "Change in doc coverage between runs. Positive means the docs are providing more useful information."
2899
+ };
2900
+
2901
+ // src/lib/comparison.ts
2902
+ function scoreMap(summary) {
2903
+ return new Map(summary.scores.map((s) => [s.feature, s]));
2904
+ }
2905
+ function allAreas(baseline, experiment) {
2906
+ const set2 = /* @__PURE__ */ new Set([
2907
+ ...baseline.scores.map((s) => s.feature),
2908
+ ...experiment.scores.map((s) => s.feature)
2909
+ ]);
2910
+ return [...set2].sort();
2911
+ }
2912
+ function classify(delta) {
2913
+ if (delta >= NOISE_THRESHOLD) return "improved";
2914
+ if (delta <= -NOISE_THRESHOLD) return "regressed";
2915
+ return "unchanged";
2916
+ }
2917
+ function changeTone(change) {
2918
+ switch (change) {
2919
+ case "improved":
2920
+ return "positive";
2921
+ case "regressed":
2922
+ return "critical";
2923
+ case "unchanged":
2924
+ return "caution";
2925
+ }
2926
+ }
2927
+ function computeAreaDeltas(baseline, experiment) {
2928
+ const bMap = scoreMap(baseline);
2929
+ const eMap = scoreMap(experiment);
2930
+ return allAreas(baseline, experiment).map((area) => {
2931
+ const bScore = bMap.get(area)?.totalScore ?? 0;
2932
+ const eScore = eMap.get(area)?.totalScore ?? 0;
2933
+ const delta = eScore - bScore;
2934
+ return {
2935
+ area,
2936
+ baseline: bScore,
2937
+ experiment: eScore,
2938
+ delta,
2939
+ change: classify(delta)
2940
+ };
2941
+ });
2942
+ }
2943
+ function computeThreeLayerDeltas(baseline, experiment) {
2944
+ const bMap = scoreMap(baseline);
2945
+ const eMap = scoreMap(experiment);
2946
+ return allAreas(baseline, experiment).map((area) => {
2947
+ const bItem = bMap.get(area);
2948
+ const eItem = eMap.get(area);
2949
+ const ba = bItem?.actualScore ?? null;
2950
+ const ea = eItem?.actualScore ?? null;
2951
+ return {
2952
+ area,
2953
+ baseActual: ba,
2954
+ expActual: ea,
2955
+ actualDelta: ba != null && ea != null ? ea - ba : null,
2956
+ baseRetGap: bItem?.retrievalGap ?? null,
2957
+ expRetGap: eItem?.retrievalGap ?? null,
2958
+ retGapDelta: bItem?.retrievalGap != null && eItem?.retrievalGap != null ? eItem.retrievalGap - bItem.retrievalGap : null,
2959
+ baseEfficiency: bItem?.infrastructureEfficiency ?? null,
2960
+ expEfficiency: eItem?.infrastructureEfficiency ?? null
2961
+ };
2962
+ });
2963
+ }
2964
+ function computeDimensionDeltas(baseline, experiment) {
2965
+ const bMap = scoreMap(baseline);
2966
+ const eMap = scoreMap(experiment);
2967
+ return allAreas(baseline, experiment).map((area) => {
2968
+ const bItem = bMap.get(area);
2969
+ const eItem = eMap.get(area);
2970
+ return {
2971
+ area,
2972
+ taskDelta: (eItem?.taskCompletion ?? 0) - (bItem?.taskCompletion ?? 0),
2973
+ codeDelta: (eItem?.codeCorrectness ?? 0) - (bItem?.codeCorrectness ?? 0),
2974
+ docDelta: (eItem?.docCoverage ?? 0) - (bItem?.docCoverage ?? 0)
2975
+ };
2976
+ });
2977
+ }
2841
2978
 
2842
2979
  // src/queries.ts
2843
2980
  var REPORT_TYPE = "ailf.report";
@@ -3072,6 +3209,12 @@ var distinctModelsQuery = (
3072
3209
  array::unique(*[_type == "${REPORT_TYPE}"].provenance.models[].label)
3073
3210
  `
3074
3211
  );
3212
+ var distinctTriggersQuery = (
3213
+ /* groq */
3214
+ `
3215
+ array::unique(*[_type == "${REPORT_TYPE}"].provenance.trigger.type)
3216
+ `
3217
+ );
3075
3218
  function filterModeClause(param) {
3076
3219
  return `&& (${param} == null || provenance.mode == ${param})`;
3077
3220
  }
@@ -3079,192 +3222,53 @@ function filterSourceClause(param) {
3079
3222
  return `&& (${param} == null || provenance.source.name == ${param})`;
3080
3223
  }
3081
3224
 
3082
- // src/components/ComparisonView.tsx
3083
- import { Badge as Badge3, Box as Box7, Card as Card6, Flex as Flex7, Grid, Select, Stack as Stack8, Text as Text11 } from "@sanity/ui";
3084
- import { useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
3085
- import { useClient as useClient3 } from "sanity";
3225
+ // src/components/PageBlurb.tsx
3226
+ import { Card as Card5, Stack as Stack7, Text as Text8 } from "@sanity/ui";
3227
+ import { jsx as jsx9 } from "react/jsx-runtime";
3228
+ function PageBlurb({ text }) {
3229
+ return /* @__PURE__ */ jsx9(Card5, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx9(Stack7, { space: 2, children: /* @__PURE__ */ jsx9(Text8, { size: 2, children: text }) }) });
3230
+ }
3086
3231
 
3087
- // src/glossary.ts
3088
- var GLOSSARY = {
3089
- // -- Overview stats -------------------------------------------------------
3090
- overallScore: "A weighted average across all feature areas: Task Completion (50%), Code Correctness (25%), and Doc Coverage (25%).",
3091
- docLift: "How much the docs help, compared to the model's training data alone. This is the score with docs minus the score without. Higher is better.",
3092
- actualScore: "How well an AI agent scores when it has to find docs on its own through web search and page fetching. This is the real-world scenario. Only available in full mode.",
3093
- retrievalGap: "The score lost because agents can't find or use all the relevant docs. Calculated as ceiling minus actual. Lower is better; zero means agents find everything.",
3094
- infraEfficiency: "What percentage of the docs' potential quality actually reaches agents (actual \xF7 ceiling). 100% means agents find and use all relevant docs perfectly.",
3095
- // -- Three-layer decomposition columns ------------------------------------
3096
- floor: "Score without any documentation. This tells you what the model already knows from its training data.",
3097
- ceiling: "Score with gold-standard docs injected directly into the prompt. This is the best the documentation can do.",
3098
- actual: "Score when an AI agent finds docs on its own through web search and page fetching. This is the real-world experience.",
3099
- retGap: "Quality lost to discoverability (ceiling minus actual). The gap between what the docs could deliver and what agents actually get.",
3100
- efficiency: "What fraction of the docs' quality reaches agents in practice (actual \xF7 ceiling, shown as a percentage).",
3101
- invertedRetGap: "\u26A0\uFE0F Inverted retrieval gap: agents that can't find the docs actually score higher, because the docs hurt performance. This usually means there's a doc quality problem.",
3102
- // -- Per-area score columns -----------------------------------------------
3103
- score: "Weighted score for this feature area: Task Completion \xD7 50% + Code Correctness \xD7 25% + Doc Coverage \xD7 25%.",
3104
- taskCompletion: "Can the LLM implement the requested feature? Graded 0\u2013100.",
3105
- codeCorrectness: "Is the generated code idiomatic, correct, and following best practices? Graded 0\u2013100.",
3106
- docCoverage: "Did the docs provide the information needed to implement the feature? Graded 0\u2013100.",
3107
- tests: "Number of test cases in this feature area.",
3108
- // -- Comparison deltas ----------------------------------------------------
3109
- overallDelta: "Change in overall score between the two runs. Positive means the experiment scored higher.",
3110
- actualDelta: "Change in actual (agent-retrieved) score between runs. Positive means agents did better.",
3111
- retGapDelta: "Change in retrieval gap between runs. Negative is good here: it means the gap shrank and agents found more relevant docs.",
3112
- efficiencyDelta: "Change in infrastructure efficiency between runs. Positive means agents are capturing more of the docs' potential.",
3113
- // -- Comparison table columns ---------------------------------------------
3114
- baseline: "The reference run you're comparing against.",
3115
- experiment: "The new run you're evaluating.",
3116
- delta: "Difference between experiment and baseline. Positive means improvement, negative means regression.",
3117
- change: "Whether the change is meaningful: improved, regressed, or unchanged (within the noise threshold).",
3118
- // -- Grader judgments ------------------------------------------------------
3119
- lowScoringJudgments: "The grading model's explanations for tests that scored below 70/100.",
3120
- judgmentReason: "The grading model's natural language explanation of what went wrong.",
3121
- // -- Recommendations / gap analysis ----------------------------------------
3122
- recommendations: "Prioritized remediation plan from gap analysis. Each recommendation identifies a documentation problem, the affected feature area, and the estimated score lift from fixing it.",
3123
- totalPotentialLift: "Aggregate potential score lift if all identified gaps were fixed. This is a conservative estimate \u2014 each gap targets the median of non-bottlenecked dimensions, not 100.",
3124
- failureMode: "The type of documentation problem: missing-docs (functionality not covered), incorrect-docs (factual errors), outdated-docs (stale API/patterns), or poor-structure (hard to find/understand).",
3125
- estimatedLift: "Estimated composite score improvement if this gap is fully fixed. Based on raising bottleneck dimensions to the median of non-bottlenecked dimensions.",
3126
- confidence: "How confident the classifier is in this diagnosis. High = strong keyword + structural signal agreement. Medium = partial agreement. Low = weak signals only.",
3127
- // -- Agent behavior --------------------------------------------------------
3128
- agentBehaviorOverview: "How AI agents interacted with your documentation during evaluation: what they searched for, which pages they visited, and how much time they spent on network requests.",
3129
- searchQueries: "The exact search queries agents used to find documentation. Helps you understand how agents discover your content and whether your docs appear for relevant queries.",
3130
- docSlugsVisited: "Documentation page slugs that agents actually visited during evaluation. Compare against canonical docs to see if agents found the right pages.",
3131
- externalDomains: "Non-Sanity domains that agents contacted during evaluation. High external domain counts may indicate agents couldn't find what they needed in your docs.",
3132
- avgDocPagesVisited: "Average number of documentation pages visited per test. Higher counts can mean agents need to consult many pages (complex task) or can't find the right one quickly.",
3133
- avgSearchesPerformed: "Average number of web searches performed per test. High search counts can indicate docs are hard to discover through search engines.",
3134
- avgNetworkTimeMs: "Average time spent on network requests per test. Includes page fetches, search queries, and API calls.",
3135
- totalRequests: "Total number of HTTP requests the agent made during the test, including searches, page visits, and API calls.",
3136
- totalBytesDownloaded: "Total bytes downloaded by the agent. Large downloads may indicate the agent is fetching many pages or very large documents.",
3137
- // -- Dimension deltas -----------------------------------------------------
3138
- dimTaskCompletion: "Change in task completion between runs. Positive means implementations are more complete.",
3139
- dimCodeCorrectness: "Change in code correctness between runs. Positive means better code quality.",
3140
- dimDocCoverage: "Change in doc coverage between runs. Positive means the docs are providing more useful information."
3141
- };
3232
+ // src/components/primitives/ColumnHeader.tsx
3233
+ import { HelpCircleIcon as HelpCircleIcon3 } from "@sanity/icons";
3234
+ import { Box as Box5, Flex as Flex6, Text as Text9, Tooltip as Tooltip2 } from "@sanity/ui";
3235
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3236
+ function ColumnHeader({
3237
+ label,
3238
+ tooltip,
3239
+ borderBottom = false
3240
+ }) {
3241
+ const style = borderBottom ? {
3242
+ borderBottom: "1px solid var(--card-border-color)",
3243
+ paddingBottom: 6
3244
+ } : void 0;
3245
+ return /* @__PURE__ */ jsxs9(Flex6, { align: "center", gap: 1, style, children: [
3246
+ /* @__PURE__ */ jsx10(
3247
+ Text9,
3248
+ {
3249
+ muted: true,
3250
+ size: 2,
3251
+ style: { letterSpacing: "0.05em", textTransform: "uppercase" },
3252
+ weight: "semibold",
3253
+ children: label
3254
+ }
3255
+ ),
3256
+ tooltip && /* @__PURE__ */ jsx10(
3257
+ Tooltip2,
3258
+ {
3259
+ content: /* @__PURE__ */ jsx10(Box5, { padding: 2, children: /* @__PURE__ */ jsx10(Text9, { size: 2, children: tooltip }) }),
3260
+ portal: true,
3261
+ children: /* @__PURE__ */ jsx10(Text9, { muted: true, size: 1, children: /* @__PURE__ */ jsx10(HelpCircleIcon3, {}) })
3262
+ }
3263
+ )
3264
+ ] });
3265
+ }
3142
3266
 
3143
- // src/lib/comparison.ts
3144
- function scoreMap(summary) {
3145
- return new Map(summary.scores.map((s) => [s.feature, s]));
3146
- }
3147
- function allAreas(baseline, experiment) {
3148
- const set2 = /* @__PURE__ */ new Set([
3149
- ...baseline.scores.map((s) => s.feature),
3150
- ...experiment.scores.map((s) => s.feature)
3151
- ]);
3152
- return [...set2].sort();
3153
- }
3154
- function classify(delta) {
3155
- if (delta >= NOISE_THRESHOLD) return "improved";
3156
- if (delta <= -NOISE_THRESHOLD) return "regressed";
3157
- return "unchanged";
3158
- }
3159
- function changeTone(change) {
3160
- switch (change) {
3161
- case "improved":
3162
- return "positive";
3163
- case "regressed":
3164
- return "critical";
3165
- case "unchanged":
3166
- return "caution";
3167
- }
3168
- }
3169
- function computeAreaDeltas(baseline, experiment) {
3170
- const bMap = scoreMap(baseline);
3171
- const eMap = scoreMap(experiment);
3172
- return allAreas(baseline, experiment).map((area) => {
3173
- const bScore = bMap.get(area)?.totalScore ?? 0;
3174
- const eScore = eMap.get(area)?.totalScore ?? 0;
3175
- const delta = eScore - bScore;
3176
- return {
3177
- area,
3178
- baseline: bScore,
3179
- experiment: eScore,
3180
- delta,
3181
- change: classify(delta)
3182
- };
3183
- });
3184
- }
3185
- function computeThreeLayerDeltas(baseline, experiment) {
3186
- const bMap = scoreMap(baseline);
3187
- const eMap = scoreMap(experiment);
3188
- return allAreas(baseline, experiment).map((area) => {
3189
- const bItem = bMap.get(area);
3190
- const eItem = eMap.get(area);
3191
- const ba = bItem?.actualScore ?? null;
3192
- const ea = eItem?.actualScore ?? null;
3193
- return {
3194
- area,
3195
- baseActual: ba,
3196
- expActual: ea,
3197
- actualDelta: ba != null && ea != null ? ea - ba : null,
3198
- baseRetGap: bItem?.retrievalGap ?? null,
3199
- expRetGap: eItem?.retrievalGap ?? null,
3200
- retGapDelta: bItem?.retrievalGap != null && eItem?.retrievalGap != null ? eItem.retrievalGap - bItem.retrievalGap : null,
3201
- baseEfficiency: bItem?.infrastructureEfficiency ?? null,
3202
- expEfficiency: eItem?.infrastructureEfficiency ?? null
3203
- };
3204
- });
3205
- }
3206
- function computeDimensionDeltas(baseline, experiment) {
3207
- const bMap = scoreMap(baseline);
3208
- const eMap = scoreMap(experiment);
3209
- return allAreas(baseline, experiment).map((area) => {
3210
- const bItem = bMap.get(area);
3211
- const eItem = eMap.get(area);
3212
- return {
3213
- area,
3214
- taskDelta: (eItem?.taskCompletion ?? 0) - (bItem?.taskCompletion ?? 0),
3215
- codeDelta: (eItem?.codeCorrectness ?? 0) - (bItem?.codeCorrectness ?? 0),
3216
- docDelta: (eItem?.docCoverage ?? 0) - (bItem?.docCoverage ?? 0)
3217
- };
3218
- });
3219
- }
3220
-
3221
- // src/components/PageBlurb.tsx
3222
- import { Card as Card5, Stack as Stack7, Text as Text8 } from "@sanity/ui";
3223
- import { jsx as jsx9 } from "react/jsx-runtime";
3224
- function PageBlurb({ text }) {
3225
- return /* @__PURE__ */ jsx9(Card5, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx9(Stack7, { space: 2, children: /* @__PURE__ */ jsx9(Text8, { size: 2, children: text }) }) });
3226
- }
3227
-
3228
- // src/components/primitives/ColumnHeader.tsx
3229
- import { HelpCircleIcon as HelpCircleIcon3 } from "@sanity/icons";
3230
- import { Box as Box5, Flex as Flex6, Text as Text9, Tooltip as Tooltip2 } from "@sanity/ui";
3231
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3232
- function ColumnHeader({
3233
- label,
3234
- tooltip,
3235
- borderBottom = false
3236
- }) {
3237
- const style = borderBottom ? {
3238
- borderBottom: "1px solid var(--card-border-color)",
3239
- paddingBottom: 6
3240
- } : void 0;
3241
- return /* @__PURE__ */ jsxs9(Flex6, { align: "center", gap: 1, style, children: [
3242
- /* @__PURE__ */ jsx10(
3243
- Text9,
3244
- {
3245
- muted: true,
3246
- size: 2,
3247
- style: { letterSpacing: "0.05em", textTransform: "uppercase" },
3248
- weight: "semibold",
3249
- children: label
3250
- }
3251
- ),
3252
- tooltip && /* @__PURE__ */ jsx10(
3253
- Tooltip2,
3254
- {
3255
- content: /* @__PURE__ */ jsx10(Box5, { padding: 2, children: /* @__PURE__ */ jsx10(Text9, { size: 2, children: tooltip }) }),
3256
- portal: true,
3257
- children: /* @__PURE__ */ jsx10(Text9, { muted: true, size: 1, children: /* @__PURE__ */ jsx10(HelpCircleIcon3, {}) })
3258
- }
3259
- )
3260
- ] });
3261
- }
3262
-
3263
- // src/components/primitives/LoadingState.tsx
3264
- import { Box as Box6, Text as Text10 } from "@sanity/ui";
3265
- import { jsx as jsx11 } from "react/jsx-runtime";
3266
- function LoadingState({ message = "Loading\u2026" }) {
3267
- return /* @__PURE__ */ jsx11(Box6, { padding: 4, children: /* @__PURE__ */ jsx11(Text10, { muted: true, children: message }) });
3267
+ // src/components/primitives/LoadingState.tsx
3268
+ import { Box as Box6, Text as Text10 } from "@sanity/ui";
3269
+ import { jsx as jsx11 } from "react/jsx-runtime";
3270
+ function LoadingState({ message = "Loading\u2026" }) {
3271
+ return /* @__PURE__ */ jsx11(Box6, { padding: 4, children: /* @__PURE__ */ jsx11(Text10, { muted: true, children: message }) });
3268
3272
  }
3269
3273
 
3270
3274
  // src/components/ComparisonView.tsx
@@ -3500,351 +3504,308 @@ function formatOption(r) {
3500
3504
  }
3501
3505
 
3502
3506
  // src/components/LatestReports.tsx
3503
- import { SortIcon } from "@sanity/icons";
3504
- import {
3505
- Badge as Badge15,
3506
- Box as Box8,
3507
- Button,
3508
- Card as Card12,
3509
- Flex as Flex17,
3510
- Menu,
3511
- MenuButton,
3512
- MenuItem,
3513
- Stack as Stack13,
3514
- Text as Text21
3515
- } from "@sanity/ui";
3516
- import { useCallback as useCallback12, useEffect as useEffect7, useMemo as useMemo5, useState as useState7 } from "react";
3517
- import { useClient as useClient6 } from "sanity";
3518
-
3519
- // src/components/content-filters/DocumentFilter.tsx
3520
- import { SearchIcon as SearchIcon2 } from "@sanity/icons";
3521
- import { Autocomplete as Autocomplete2, Badge as Badge4, Card as Card7, Flex as Flex8, Stack as Stack9, Text as Text12 } from "@sanity/ui";
3522
- import { useCallback as useCallback7, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
3507
+ import { Button, Card as Card7, Flex as Flex10, Stack as Stack10, Text as Text14 } from "@sanity/ui";
3508
+ import { useCallback as useCallback10, useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
3523
3509
  import { useClient as useClient4 } from "sanity";
3510
+ import { useRouter } from "sanity/router";
3511
+
3512
+ // src/components/report-table/FilterBar.tsx
3513
+ import { Flex as Flex8, Text as Text12, TextInput } from "@sanity/ui";
3514
+ import { ResetIcon, SearchIcon as SearchIcon2, ThListIcon } from "@sanity/icons";
3515
+ import { useCallback as useCallback7 } from "react";
3524
3516
  import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3525
- var SEARCH_DEBOUNCE_MS = 300;
3526
- function DocumentFilter({
3527
- value,
3528
- onChange,
3529
- onPerspectiveHint
3517
+ var BAR_STYLE = {
3518
+ alignItems: "center",
3519
+ background: "var(--card-bg-color)",
3520
+ display: "flex",
3521
+ flexWrap: "wrap",
3522
+ gap: 8,
3523
+ padding: "8px 12px"
3524
+ };
3525
+ var PILL_GROUP_STYLE = {
3526
+ background: "var(--card-muted-bg-color)",
3527
+ borderRadius: 6,
3528
+ display: "inline-flex",
3529
+ gap: 0,
3530
+ padding: 2
3531
+ };
3532
+ var PILL_BASE = {
3533
+ border: "none",
3534
+ borderRadius: 4,
3535
+ cursor: "pointer",
3536
+ fontFamily: "inherit",
3537
+ fontSize: 13,
3538
+ fontWeight: 500,
3539
+ lineHeight: 1,
3540
+ padding: "6px 10px",
3541
+ transition: "all 0.1s ease",
3542
+ whiteSpace: "nowrap"
3543
+ };
3544
+ var PILL_ACTIVE = {
3545
+ ...PILL_BASE,
3546
+ background: "var(--card-bg-color)",
3547
+ boxShadow: "0 1px 2px rgba(0,0,0,0.2)",
3548
+ color: "var(--card-fg-color)"
3549
+ };
3550
+ var PILL_INACTIVE = {
3551
+ ...PILL_BASE,
3552
+ background: "transparent",
3553
+ color: "var(--card-muted-fg-color)"
3554
+ };
3555
+ function FilterBar({
3556
+ query,
3557
+ onQueryChange,
3558
+ mode,
3559
+ modes,
3560
+ onModeChange,
3561
+ source,
3562
+ sources,
3563
+ onSourceChange,
3564
+ trigger,
3565
+ triggers,
3566
+ onTriggerChange,
3567
+ onReset,
3568
+ filteredCount,
3569
+ totalCount
3530
3570
  }) {
3531
- const client = useClient4({ apiVersion: API_VERSION });
3532
- const [options, setOptions] = useState4([]);
3533
- const [loading, setLoading] = useState4(false);
3534
- const timer = useRef3(null);
3535
- useEffect4(() => {
3536
- return () => {
3537
- if (timer.current) clearTimeout(timer.current);
3538
- };
3539
- }, []);
3571
+ const hasActiveFilters = query.trim() !== "" || mode !== null || source !== null || trigger !== null;
3540
3572
  const handleQueryChange = useCallback7(
3541
- (query) => {
3542
- if (timer.current) clearTimeout(timer.current);
3543
- const trimmed = (query ?? "").trim();
3544
- if (trimmed.length < 2) {
3545
- setOptions([]);
3546
- setLoading(false);
3547
- return;
3548
- }
3549
- setLoading(true);
3550
- timer.current = setTimeout(() => {
3551
- client.fetch(articleSearchQuery, { query: trimmed }).then((data) => {
3552
- const result = (data ?? []).map((doc) => {
3553
- const { provenance, releaseId } = classifyDocId(doc._id);
3554
- const path = doc.section?.slug ? `${doc.section.slug}/${doc.slug}` : doc.slug;
3555
- return {
3556
- payload: {
3557
- path,
3558
- provenance,
3559
- releaseId,
3560
- slug: doc.slug,
3561
- title: doc.title
3562
- },
3563
- value: doc._id
3564
- };
3565
- });
3566
- const order = {
3567
- published: 0,
3568
- release: 1,
3569
- draft: 2
3570
- };
3571
- result.sort(
3572
- (a, b) => order[a.payload.provenance] - order[b.payload.provenance]
3573
- );
3574
- setOptions(result);
3575
- setLoading(false);
3576
- }).catch(() => {
3577
- setOptions([]);
3578
- setLoading(false);
3579
- });
3580
- }, SEARCH_DEBOUNCE_MS);
3573
+ (e) => {
3574
+ onQueryChange(e.currentTarget.value);
3581
3575
  },
3582
- [client]
3576
+ [onQueryChange]
3583
3577
  );
3584
- const handleSelect = useCallback7(
3585
- (selected) => {
3586
- const option = options.find((o) => o.value === selected);
3587
- const slug = option?.payload.slug ?? selected;
3588
- onChange(slug);
3589
- if (option?.payload.provenance === "release" && option.payload.releaseId && onPerspectiveHint) {
3590
- onPerspectiveHint(option.payload.releaseId);
3578
+ return /* @__PURE__ */ jsxs11("div", { style: BAR_STYLE, children: [
3579
+ /* @__PURE__ */ jsx13("div", { style: { maxWidth: 320, minWidth: 140, flex: "1 1 200px" }, children: /* @__PURE__ */ jsx13(
3580
+ TextInput,
3581
+ {
3582
+ fontSize: 2,
3583
+ icon: SearchIcon2,
3584
+ onChange: handleQueryChange,
3585
+ placeholder: "Search reports...",
3586
+ value: query
3591
3587
  }
3592
- },
3593
- [options, onChange, onPerspectiveHint]
3594
- );
3595
- const renderOption = useCallback7((option) => {
3596
- const { provenance, releaseId } = option.payload;
3597
- const badgeTone = provenance === "published" ? "positive" : provenance === "release" ? "primary" : "caution";
3598
- const badgeLabel = provenance === "published" ? "Published" : provenance === "release" ? releaseId ?? "Release" : "Draft";
3599
- return /* @__PURE__ */ jsx13(Card7, { as: "button", padding: 3, children: /* @__PURE__ */ jsxs11(Flex8, { align: "center", gap: 2, children: [
3600
- /* @__PURE__ */ jsxs11(Stack9, { flex: 1, space: 1, children: [
3601
- /* @__PURE__ */ jsx13(Text12, { size: 2, weight: "semibold", children: option.payload.title }),
3602
- /* @__PURE__ */ jsx13(Text12, { muted: true, size: 2, children: option.payload.path })
3603
- ] }),
3604
- /* @__PURE__ */ jsx13(Badge4, { fontSize: 1, tone: badgeTone, children: badgeLabel })
3605
- ] }) });
3606
- }, []);
3607
- const renderValue = useCallback7((_value, option) => {
3608
- if (option?.payload.title) {
3609
- return `${option.payload.title} (${option.payload.slug})`;
3610
- }
3611
- return _value;
3612
- }, []);
3613
- return /* @__PURE__ */ jsx13(
3614
- Autocomplete2,
3615
- {
3616
- filterOption: () => true,
3617
- icon: SearchIcon2,
3618
- id: "document-filter-input",
3619
- loading,
3620
- onChange: handleSelect,
3621
- onQueryChange: handleQueryChange,
3622
- options,
3623
- placeholder: "Search by title, slug, or ID\u2026",
3624
- renderOption,
3625
- renderValue,
3626
- value
3627
- }
3628
- );
3588
+ ) }),
3589
+ modes.length > 0 && /* @__PURE__ */ jsx13(
3590
+ PillGroup,
3591
+ {
3592
+ label: "Mode",
3593
+ onChange: onModeChange,
3594
+ options: modes,
3595
+ value: mode
3596
+ }
3597
+ ),
3598
+ sources.length > 0 && /* @__PURE__ */ jsx13(
3599
+ PillGroup,
3600
+ {
3601
+ label: "Source",
3602
+ onChange: onSourceChange,
3603
+ options: sources,
3604
+ value: source
3605
+ }
3606
+ ),
3607
+ triggers.length > 0 && /* @__PURE__ */ jsx13(
3608
+ PillGroup,
3609
+ {
3610
+ label: "Trigger",
3611
+ onChange: onTriggerChange,
3612
+ options: triggers,
3613
+ value: trigger
3614
+ }
3615
+ ),
3616
+ /* @__PURE__ */ jsx13("div", { style: { flex: "1 0 0px" } }),
3617
+ hasActiveFilters && /* @__PURE__ */ jsxs11(
3618
+ "button",
3619
+ {
3620
+ onClick: onReset,
3621
+ style: {
3622
+ ...PILL_BASE,
3623
+ alignItems: "center",
3624
+ background: "transparent",
3625
+ color: "var(--card-muted-fg-color)",
3626
+ display: "inline-flex",
3627
+ gap: 4
3628
+ },
3629
+ type: "button",
3630
+ children: [
3631
+ /* @__PURE__ */ jsx13(ResetIcon, { style: { fontSize: 14 } }),
3632
+ "Reset"
3633
+ ]
3634
+ }
3635
+ ),
3636
+ /* @__PURE__ */ jsxs11(Flex8, { align: "center", gap: 2, shrink: 0, children: [
3637
+ /* @__PURE__ */ jsx13(ThListIcon, { style: { opacity: 0.5 } }),
3638
+ /* @__PURE__ */ jsx13(Text12, { muted: true, size: 2, children: filteredCount === totalCount ? `${totalCount} of ${totalCount}` : `${filteredCount} of ${totalCount}` })
3639
+ ] })
3640
+ ] });
3629
3641
  }
3630
- function classifyDocId(id) {
3631
- if (id.startsWith("versions.")) {
3632
- const parts = id.split(".");
3633
- const releaseId = parts.length >= 3 ? parts[1] : null;
3634
- return { provenance: "release", releaseId };
3635
- }
3636
- if (id.startsWith("drafts.")) {
3637
- return { provenance: "draft", releaseId: null };
3638
- }
3639
- return { provenance: "published", releaseId: null };
3642
+ function PillGroup({
3643
+ label,
3644
+ options,
3645
+ value,
3646
+ onChange
3647
+ }) {
3648
+ return /* @__PURE__ */ jsxs11(Flex8, { align: "center", gap: 2, children: [
3649
+ /* @__PURE__ */ jsx13(
3650
+ Text12,
3651
+ {
3652
+ muted: true,
3653
+ size: 1,
3654
+ style: {
3655
+ letterSpacing: "0.05em",
3656
+ textTransform: "uppercase",
3657
+ whiteSpace: "nowrap"
3658
+ },
3659
+ weight: "semibold",
3660
+ children: label
3661
+ }
3662
+ ),
3663
+ /* @__PURE__ */ jsxs11("div", { style: PILL_GROUP_STYLE, children: [
3664
+ /* @__PURE__ */ jsx13(
3665
+ "button",
3666
+ {
3667
+ onClick: () => onChange(null),
3668
+ style: value === null ? PILL_ACTIVE : PILL_INACTIVE,
3669
+ type: "button",
3670
+ children: "All"
3671
+ }
3672
+ ),
3673
+ options.map((opt) => /* @__PURE__ */ jsx13(
3674
+ "button",
3675
+ {
3676
+ onClick: () => onChange(opt),
3677
+ style: value === opt ? PILL_ACTIVE : PILL_INACTIVE,
3678
+ type: "button",
3679
+ children: capitalize(opt)
3680
+ },
3681
+ opt
3682
+ ))
3683
+ ] })
3684
+ ] });
3685
+ }
3686
+ function capitalize(s) {
3687
+ return s.charAt(0).toUpperCase() + s.slice(1);
3640
3688
  }
3641
3689
 
3642
- // src/components/content-filters/PerspectiveFilter.tsx
3643
- import { SearchIcon as SearchIcon3 } from "@sanity/icons";
3644
- import { Autocomplete as Autocomplete3, Badge as Badge5, Card as Card8, Flex as Flex9, Stack as Stack10, Text as Text13 } from "@sanity/ui";
3645
- import { useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
3646
- import {
3647
- getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId3,
3648
- useActiveReleases as useActiveReleases3,
3649
- useArchivedReleases as useArchivedReleases3,
3650
- useClient as useClient5
3651
- } from "sanity";
3652
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3653
- function PerspectiveFilter({ value, onChange }) {
3654
- const client = useClient5({ apiVersion: API_VERSION });
3655
- const [reportPerspectives, setReportPerspectives] = useState5([]);
3656
- const { data: activeReleases } = useActiveReleases3();
3657
- const { data: archivedReleases } = useArchivedReleases3();
3658
- useEffect5(() => {
3659
- client.fetch(distinctPerspectivesQuery).then(
3660
- (data) => setReportPerspectives((data ?? []).filter(Boolean).sort())
3661
- ).catch(() => setReportPerspectives([]));
3662
- }, [client]);
3663
- const options = useMemo4(() => {
3664
- const releaseMap = /* @__PURE__ */ new Map();
3665
- for (const release of [
3666
- ...activeReleases ?? [],
3667
- ...archivedReleases ?? []
3668
- ]) {
3669
- const releaseId = getReleaseIdFromReleaseDocumentId3(release._id);
3670
- const title = release.metadata?.title ?? releaseId;
3671
- releaseMap.set(releaseId, title);
3672
- }
3673
- const allIds = /* @__PURE__ */ new Set([...reportPerspectives, ...releaseMap.keys()]);
3674
- const result = [...allIds].sort((a, b) => {
3675
- const aTitle = releaseMap.get(a);
3676
- const bTitle = releaseMap.get(b);
3677
- if (aTitle && !bTitle) return -1;
3678
- if (!aTitle && bTitle) return 1;
3679
- return (aTitle ?? a).localeCompare(bTitle ?? b);
3680
- }).map((id) => ({
3681
- payload: {
3682
- hasReport: reportPerspectives.includes(id),
3683
- title: releaseMap.get(id) ?? id
3684
- },
3685
- value: id
3686
- }));
3687
- return result;
3688
- }, [activeReleases, archivedReleases, reportPerspectives]);
3690
+ // src/components/report-table/OutlineBadge.tsx
3691
+ import { jsx as jsx14 } from "react/jsx-runtime";
3692
+ var TONE_PALETTE = {
3693
+ default: {
3694
+ border: "rgba(255, 255, 255, 0.2)",
3695
+ bg: "rgba(255, 255, 255, 0.06)",
3696
+ fg: "rgba(255, 255, 255, 0.6)"
3697
+ },
3698
+ primary: {
3699
+ border: "rgba(86, 154, 237, 0.4)",
3700
+ bg: "rgba(86, 154, 237, 0.08)",
3701
+ fg: "#569aed"
3702
+ },
3703
+ positive: {
3704
+ border: "rgba(46, 204, 113, 0.4)",
3705
+ bg: "rgba(46, 204, 113, 0.08)",
3706
+ fg: "#2ecc71"
3707
+ },
3708
+ caution: {
3709
+ border: "rgba(241, 196, 15, 0.4)",
3710
+ bg: "rgba(241, 196, 15, 0.08)",
3711
+ fg: "#f1c40f"
3712
+ },
3713
+ critical: {
3714
+ border: "rgba(231, 76, 60, 0.4)",
3715
+ bg: "rgba(231, 76, 60, 0.08)",
3716
+ fg: "#e74c3c"
3717
+ },
3718
+ cyan: {
3719
+ border: "rgba(52, 211, 211, 0.4)",
3720
+ bg: "rgba(52, 211, 211, 0.08)",
3721
+ fg: "#34d3d3"
3722
+ },
3723
+ purple: {
3724
+ border: "rgba(168, 130, 255, 0.4)",
3725
+ bg: "rgba(168, 130, 255, 0.08)",
3726
+ fg: "#a882ff"
3727
+ }
3728
+ };
3729
+ function OutlineBadge({
3730
+ children,
3731
+ tone = "default"
3732
+ }) {
3733
+ const colors = TONE_PALETTE[tone];
3689
3734
  return /* @__PURE__ */ jsx14(
3690
- Autocomplete3,
3735
+ "span",
3691
3736
  {
3692
- filterOption: (query, option) => {
3693
- const q = query.toLowerCase();
3694
- const opt = option;
3695
- return opt.value.toLowerCase().includes(q) || (opt.payload?.title ?? "").toLowerCase().includes(q);
3696
- },
3697
- icon: SearchIcon3,
3698
- id: "perspective-filter-input",
3699
- onChange,
3700
- options,
3701
- placeholder: "Search by title or ID\u2026",
3702
- renderOption: (option) => {
3703
- const opt = option;
3704
- return /* @__PURE__ */ jsx14(Card8, { as: "button", padding: 3, children: /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, children: [
3705
- /* @__PURE__ */ jsxs12(Stack10, { flex: 1, space: 1, children: [
3706
- /* @__PURE__ */ jsx14(Text13, { size: 2, weight: "semibold", children: opt.payload.title }),
3707
- opt.payload.title !== opt.value && /* @__PURE__ */ jsx14(Text13, { muted: true, size: 2, children: opt.value })
3708
- ] }),
3709
- opt.payload.hasReport && /* @__PURE__ */ jsx14(Badge5, { fontSize: 1, tone: "positive", children: "Has reports" })
3710
- ] }) });
3711
- },
3712
- renderValue: (v, option) => {
3713
- const opt = option;
3714
- if (opt?.payload?.title && opt.payload.title !== v) {
3715
- return `${opt.payload.title} (${v})`;
3716
- }
3717
- return v;
3737
+ style: {
3738
+ background: colors.bg,
3739
+ border: `1px solid ${colors.border}`,
3740
+ borderRadius: 4,
3741
+ color: colors.fg,
3742
+ display: "inline-block",
3743
+ fontSize: 12,
3744
+ fontWeight: 500,
3745
+ lineHeight: 1,
3746
+ padding: "3px 6px",
3747
+ whiteSpace: "nowrap"
3718
3748
  },
3719
- value
3749
+ children
3720
3750
  }
3721
3751
  );
3722
3752
  }
3723
3753
 
3724
- // src/components/report-card/ReportCard.tsx
3725
- import { Badge as Badge12, Card as Card9, Flex as Flex13, Text as Text17 } from "@sanity/ui";
3726
- import { useCallback as useCallback8 } from "react";
3754
+ // src/components/report-table/ReportTable.tsx
3755
+ import {
3756
+ Badge as Badge4,
3757
+ Code,
3758
+ Flex as Flex9,
3759
+ Inline,
3760
+ Stack as Stack9,
3761
+ Text as Text13
3762
+ } from "@sanity/ui";
3727
3763
 
3728
- // src/components/primitives/DeltaIndicator.tsx
3729
- import { Text as Text14 } from "@sanity/ui";
3730
- import { jsx as jsx15 } from "react/jsx-runtime";
3731
- function DeltaIndicator({ delta, size = 2 }) {
3732
- return /* @__PURE__ */ jsx15(
3733
- Text14,
3734
- {
3735
- size,
3736
- style: {
3737
- color: delta > 0 ? "var(--card-badge-positive-dot-color)" : delta < 0 ? "var(--card-badge-critical-dot-color)" : void 0
3738
- },
3739
- children: formatDelta(delta)
3764
+ // src/components/report-table/useContainerWidth.ts
3765
+ import { useCallback as useCallback8, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
3766
+ var FULL_MIN = 900;
3767
+ var COMPACT_MIN = 600;
3768
+ function getTier(width) {
3769
+ if (width >= FULL_MIN) return "full";
3770
+ if (width >= COMPACT_MIN) return "compact";
3771
+ return "narrow";
3772
+ }
3773
+ function useContainerWidth() {
3774
+ const [width, setWidth] = useState4(1200);
3775
+ const observerRef = useRef3(null);
3776
+ const elementRef = useRef3(null);
3777
+ const ref = useCallback8((node) => {
3778
+ if (observerRef.current) {
3779
+ observerRef.current.disconnect();
3780
+ observerRef.current = null;
3740
3781
  }
3741
- );
3782
+ elementRef.current = node;
3783
+ if (node) {
3784
+ setWidth(node.getBoundingClientRect().width);
3785
+ const observer = new ResizeObserver((entries) => {
3786
+ for (const entry of entries) {
3787
+ setWidth(entry.contentRect.width);
3788
+ }
3789
+ });
3790
+ observer.observe(node);
3791
+ observerRef.current = observer;
3792
+ }
3793
+ }, []);
3794
+ useEffect4(() => {
3795
+ return () => {
3796
+ if (observerRef.current) {
3797
+ observerRef.current.disconnect();
3798
+ }
3799
+ };
3800
+ }, []);
3801
+ return { ref, tier: getTier(width), width };
3742
3802
  }
3743
3803
 
3744
- // src/components/report-card/GitOrigin.tsx
3745
- import { Badge as Badge6, Flex as Flex10, Text as Text15 } from "@sanity/ui";
3746
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
3747
- function GitOrigin({ git }) {
3748
- const prUrl = git.prNumber ? `https://github.com/${git.repo}/pull/${git.prNumber}` : null;
3749
- return /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 2, children: [
3750
- /* @__PURE__ */ jsx16(
3751
- Text15,
3752
- {
3753
- muted: true,
3754
- size: 1,
3755
- style: { fontFamily: "monospace", whiteSpace: "nowrap" },
3756
- title: `${git.repo} @ ${git.sha.slice(0, 7)} (${git.branch})`,
3757
- children: git.repo
3758
- }
3759
- ),
3760
- prUrl && /* @__PURE__ */ jsx16(
3761
- "a",
3762
- {
3763
- href: prUrl,
3764
- onClick: stopPropagation,
3765
- rel: "noopener noreferrer",
3766
- style: { textDecoration: "none" },
3767
- target: "_blank",
3768
- children: /* @__PURE__ */ jsxs13(Badge6, { fontSize: 1, mode: "outline", tone: "primary", children: [
3769
- "#",
3770
- git.prNumber
3771
- ] })
3772
- }
3773
- )
3774
- ] });
3775
- }
3776
- function stopPropagation(e) {
3777
- e.stopPropagation();
3778
- }
3779
-
3780
- // src/components/report-card/ModeBadge.tsx
3781
- import { Badge as Badge7 } from "@sanity/ui";
3782
- import { jsx as jsx17 } from "react/jsx-runtime";
3783
- var modeTone = {
3784
- agentic: "positive",
3785
- baseline: "default",
3786
- full: "primary",
3787
- observed: "caution"
3788
- };
3789
- function ModeBadge({ mode }) {
3790
- const tone = modeTone[mode] ?? "default";
3791
- return /* @__PURE__ */ jsx17(Badge7, { fontSize: 1, tone, children: mode });
3792
- }
3793
-
3794
- // src/components/report-card/ReportMeta.tsx
3795
- import { Stack as Stack11, Text as Text16 } from "@sanity/ui";
3796
-
3797
- // src/components/report-card/AreaTags.tsx
3798
- import { Badge as Badge8, Flex as Flex11 } from "@sanity/ui";
3799
- import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
3800
- function AreaTags({ areas, targetDocuments }) {
3801
- const hasAreas = areas && areas.length > 0;
3802
- const hasDocs = targetDocuments && targetDocuments.length > 0;
3803
- if (!hasAreas && !hasDocs) return null;
3804
- return /* @__PURE__ */ jsxs14(Flex11, { gap: 1, paddingTop: 1, wrap: "wrap", children: [
3805
- hasAreas && areas.map((area) => /* @__PURE__ */ jsx18(
3806
- Badge8,
3807
- {
3808
- fontSize: 1,
3809
- mode: "outline",
3810
- tone: "default",
3811
- children: area
3812
- },
3813
- `area-${area}`
3814
- )),
3815
- hasDocs && targetDocuments.map((doc) => /* @__PURE__ */ jsx18(Badge8, { fontSize: 1, mode: "outline", tone: "primary", children: doc }, `doc-${doc}`))
3816
- ] });
3817
- }
3804
+ // src/components/report-table/ReportTable.tsx
3805
+ import { ClockIcon, TrendUpwardIcon } from "@sanity/icons";
3806
+ import { useCallback as useCallback9 } from "react";
3818
3807
 
3819
3808
  // src/components/report-card/types.ts
3820
- function fromReportListItem(item) {
3821
- return {
3822
- _id: item._id,
3823
- reportId: item.reportId,
3824
- completedAt: item.completedAt,
3825
- overall: item.overall,
3826
- mode: item.mode,
3827
- source: item.source,
3828
- tag: item.tag,
3829
- models: item.models,
3830
- areas: item.areas,
3831
- trigger: item.trigger,
3832
- targetDocuments: item.targetDocuments,
3833
- perspective: item.perspective,
3834
- durationMs: item.durationMs,
3835
- comparisonDelta: item.comparisonDelta,
3836
- regressed: item.regressed,
3837
- improved: item.improved,
3838
- scores: item.scores,
3839
- git: item.git,
3840
- docLift: item.docLift,
3841
- actualScore: item.actualScore,
3842
- retrievalGap: item.retrievalGap,
3843
- evaluationMode: item.evaluationMode,
3844
- promptfooUrl: item.promptfooUrl,
3845
- promptfooUrls: item.promptfooUrls
3846
- };
3847
- }
3848
3809
  function formatCardDate(iso) {
3849
3810
  return new Date(iso).toLocaleDateString("en-US", {
3850
3811
  day: "numeric",
@@ -3855,624 +3816,429 @@ function formatCardDate(iso) {
3855
3816
  });
3856
3817
  }
3857
3818
 
3858
- // src/components/report-card/ReportMeta.tsx
3859
- import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3860
- function ReportMeta({ data }) {
3861
- const segments = [];
3862
- if (data.models && data.models.length > 0) {
3863
- segments.push(data.models.join(", "));
3864
- }
3865
- if (data.perspective) {
3866
- segments.push(data.perspective);
3867
- }
3868
- if (data.durationMs && data.durationMs > 0) {
3869
- segments.push(formatDuration(data.durationMs));
3870
- }
3871
- return /* @__PURE__ */ jsxs15(Stack11, { flex: 1, space: 1, children: [
3872
- /* @__PURE__ */ jsx19(Text16, { size: 3, weight: "semibold", children: data.tag ?? formatCardDate(data.completedAt) }),
3873
- segments.length > 0 && /* @__PURE__ */ jsx19(Text16, { muted: true, size: 2, children: segments.join(" \xB7 ") }),
3874
- /* @__PURE__ */ jsx19(AreaTags, { areas: data.areas, targetDocuments: data.targetDocuments })
3875
- ] });
3876
- }
3877
-
3878
- // src/components/primitives/ScoreBadge.tsx
3879
- import { Badge as Badge9 } from "@sanity/ui";
3880
-
3881
- // src/lib/scoring.ts
3882
- var TONE_MAP = {
3883
- good: "positive",
3884
- warning: "caution",
3885
- "needs-work": "default",
3886
- critical: "critical"
3887
- };
3888
- function gradeTone(grade) {
3889
- return TONE_MAP[grade];
3890
- }
3891
- function scoreTone(score) {
3892
- return gradeTone(scoreGrade(Math.round(score)));
3893
- }
3894
- var HEX_MAP = {
3895
- good: "#2ecc71",
3896
- warning: "#f1c40f",
3897
- "needs-work": "#e67e22",
3898
- critical: "#e74c3c"
3899
- };
3900
- function gradeHex(grade) {
3901
- return HEX_MAP[grade];
3902
- }
3903
- function scoreHex(score) {
3904
- return gradeHex(scoreGrade(Math.round(score)));
3905
- }
3906
- function rowBackground(index) {
3907
- return index % 2 === 1 ? "var(--card-muted-bg-color)" : void 0;
3908
- }
3909
-
3910
- // src/components/primitives/ScoreBadge.tsx
3911
- import { jsx as jsx20 } from "react/jsx-runtime";
3912
- function ScoreBadge({ score, fontSize = 2 }) {
3913
- const rounded = Math.round(score);
3914
- return /* @__PURE__ */ jsx20(
3915
- Badge9,
3819
+ // src/components/report-table/ReportTable.tsx
3820
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
3821
+ function GitBranchIcon({ style }) {
3822
+ return /* @__PURE__ */ jsxs12(
3823
+ "svg",
3916
3824
  {
3917
- fontSize,
3918
- style: { minWidth: 48, textAlign: "center" },
3919
- tone: scoreTone(rounded),
3920
- children: rounded
3825
+ "aria-hidden": "true",
3826
+ fill: "none",
3827
+ height: 12,
3828
+ stroke: "currentColor",
3829
+ strokeLinecap: "round",
3830
+ strokeLinejoin: "round",
3831
+ strokeWidth: 2,
3832
+ style,
3833
+ viewBox: "0 0 24 24",
3834
+ width: 12,
3835
+ xmlns: "http://www.w3.org/2000/svg",
3836
+ children: [
3837
+ /* @__PURE__ */ jsx15("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
3838
+ /* @__PURE__ */ jsx15("circle", { cx: 18, cy: 6, r: 3 }),
3839
+ /* @__PURE__ */ jsx15("circle", { cx: 6, cy: 18, r: 3 })
3840
+ ]
3921
3841
  }
3922
3842
  );
3923
3843
  }
3924
-
3925
- // src/components/report-card/SourceBadge.tsx
3926
- import { Badge as Badge10 } from "@sanity/ui";
3927
- import { jsx as jsx21 } from "react/jsx-runtime";
3928
- var sourceTone = {
3929
- branch: "primary",
3930
- local: "default",
3931
- production: "caution"
3844
+ var SCORE_COLORS = {
3845
+ good: { bg: "rgba(46, 204, 113, 0.15)", fg: "#2ecc71" },
3846
+ warning: { bg: "rgba(241, 196, 15, 0.15)", fg: "#f1c40f" },
3847
+ "needs-work": { bg: "rgba(230, 126, 34, 0.15)", fg: "#e67e22" },
3848
+ critical: { bg: "rgba(231, 76, 60, 0.15)", fg: "#e74c3c" }
3932
3849
  };
3933
- function SourceBadge({ source }) {
3934
- const tone = sourceTone[source] ?? "default";
3935
- return /* @__PURE__ */ jsx21(Badge10, { fontSize: 1, mode: "outline", tone, children: source });
3936
- }
3937
-
3938
- // src/components/primitives/StatusBadges.tsx
3939
- import { Badge as Badge11, Flex as Flex12 } from "@sanity/ui";
3940
- import { jsxs as jsxs16 } from "react/jsx-runtime";
3941
- function StatusBadges({ regressed, improved }) {
3942
- const hasRegressed = regressed && regressed.length > 0;
3943
- const hasImproved = improved && improved.length > 0;
3944
- if (!hasRegressed && !hasImproved) return null;
3945
- return /* @__PURE__ */ jsxs16(Flex12, { gap: 1, children: [
3946
- hasRegressed && /* @__PURE__ */ jsxs16(Badge11, { fontSize: 1, tone: "critical", children: [
3947
- regressed.length,
3948
- " regressed"
3949
- ] }),
3950
- hasImproved && /* @__PURE__ */ jsxs16(Badge11, { fontSize: 1, tone: "positive", children: [
3951
- improved.length,
3952
- " improved"
3850
+ var GRID = {
3851
+ full: "72px 1fr 130px 100px 100px 100px",
3852
+ compact: "56px 1fr 110px",
3853
+ narrow: "48px 1fr"
3854
+ };
3855
+ var TABLE_HOVER_STYLES = `
3856
+ .ailf-row:hover { background: var(--card-muted-bg-color); }
3857
+ `;
3858
+ function ReportTable({
3859
+ reports,
3860
+ onSelectReport,
3861
+ sort,
3862
+ onSortChange
3863
+ }) {
3864
+ const { ref, tier } = useContainerWidth();
3865
+ return /* @__PURE__ */ jsxs12(Fragment4, { children: [
3866
+ /* @__PURE__ */ jsx15("style", { children: TABLE_HOVER_STYLES }),
3867
+ /* @__PURE__ */ jsxs12("div", { ref, children: [
3868
+ /* @__PURE__ */ jsxs12(
3869
+ "div",
3870
+ {
3871
+ style: {
3872
+ borderBottom: "1px solid var(--card-border-color)",
3873
+ display: "grid",
3874
+ gap: "0 16px",
3875
+ gridTemplateColumns: GRID[tier],
3876
+ padding: "12px 12px 8px"
3877
+ },
3878
+ children: [
3879
+ /* @__PURE__ */ jsx15("div", {}),
3880
+ /* @__PURE__ */ jsx15(
3881
+ ColHeader,
3882
+ {
3883
+ active: sort.field === "name",
3884
+ direction: sort.direction,
3885
+ label: "Report",
3886
+ onClick: () => onSortChange("name")
3887
+ }
3888
+ ),
3889
+ tier !== "narrow" && /* @__PURE__ */ jsx15(
3890
+ ColHeader,
3891
+ {
3892
+ active: sort.field === "score",
3893
+ direction: sort.direction,
3894
+ label: "Change",
3895
+ onClick: () => onSortChange("score")
3896
+ }
3897
+ ),
3898
+ tier === "full" && /* @__PURE__ */ jsxs12(Fragment4, { children: [
3899
+ /* @__PURE__ */ jsx15(ColHeader, { label: "Mode" }),
3900
+ /* @__PURE__ */ jsx15(ColHeader, { label: "Trigger" }),
3901
+ /* @__PURE__ */ jsx15(
3902
+ ColHeader,
3903
+ {
3904
+ active: sort.field === "date",
3905
+ direction: sort.direction,
3906
+ label: "Time",
3907
+ onClick: () => onSortChange("date"),
3908
+ align: "right"
3909
+ }
3910
+ )
3911
+ ] })
3912
+ ]
3913
+ }
3914
+ ),
3915
+ reports.map((report) => /* @__PURE__ */ jsx15(
3916
+ ReportRow,
3917
+ {
3918
+ onSelect: onSelectReport,
3919
+ report,
3920
+ tier
3921
+ },
3922
+ report._id
3923
+ ))
3953
3924
  ] })
3954
3925
  ] });
3955
3926
  }
3956
-
3957
- // src/components/report-card/ReportCard.tsx
3958
- import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
3959
- function ReportCard({ data, onSelectReport }) {
3960
- const handleClick = useCallback8(() => {
3961
- onSelectReport(data.reportId);
3962
- }, [data.reportId, onSelectReport]);
3963
- return /* @__PURE__ */ jsx22(
3964
- Card9,
3927
+ function ReportRow({
3928
+ report,
3929
+ onSelect,
3930
+ tier
3931
+ }) {
3932
+ const handleClick = useCallback9(() => {
3933
+ onSelect(report.reportId);
3934
+ }, [onSelect, report.reportId]);
3935
+ const rounded = Math.round(report.overall);
3936
+ const grade = scoreGrade(rounded);
3937
+ const colors = SCORE_COLORS[grade];
3938
+ const hasDelta = report.comparisonDelta != null && report.comparisonDelta !== 0;
3939
+ const delta = report.comparisonDelta ?? 0;
3940
+ const deltaUp = delta > 0;
3941
+ const regressedCount = report.regressed?.length ?? 0;
3942
+ const improvedCount = report.improved?.length ?? 0;
3943
+ const hasAreas = report.areas && report.areas.length > 0;
3944
+ const hasDocs = report.targetDocuments && report.targetDocuments.length > 0;
3945
+ const git = report.git;
3946
+ const isSmall = tier !== "full";
3947
+ const scoreSize = isSmall ? 40 : 48;
3948
+ const scoreWidth = isSmall ? 44 : 56;
3949
+ const scoreFontSize = isSmall ? 18 : 22;
3950
+ return /* @__PURE__ */ jsxs12(
3951
+ "div",
3965
3952
  {
3953
+ className: "ailf-row",
3966
3954
  onClick: handleClick,
3967
- padding: 3,
3968
- radius: 2,
3969
- shadow: 1,
3970
- style: { cursor: "pointer" },
3971
- children: /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 3, children: [
3972
- /* @__PURE__ */ jsx22(ScoreBadge, { score: data.overall }),
3973
- /* @__PURE__ */ jsx22(ReportMeta, { data }),
3974
- /* @__PURE__ */ jsxs17(Flex13, { align: "flex-end", direction: "column", gap: 2, shrink: 0, children: [
3975
- /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
3976
- /* @__PURE__ */ jsx22(ModeBadge, { mode: data.mode }),
3977
- /* @__PURE__ */ jsx22(SourceBadge, { source: data.source })
3955
+ style: {
3956
+ alignItems: "start",
3957
+ borderBottom: "1px solid var(--card-border-color)",
3958
+ cursor: "pointer",
3959
+ display: "grid",
3960
+ gap: "0 16px",
3961
+ gridTemplateColumns: GRID[tier],
3962
+ padding: isSmall ? "10px 8px" : "14px 12px"
3963
+ },
3964
+ children: [
3965
+ /* @__PURE__ */ jsx15(Flex9, { align: "center", justify: "center", style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx15(
3966
+ "div",
3967
+ {
3968
+ style: {
3969
+ alignItems: "center",
3970
+ background: colors.bg,
3971
+ border: `1px solid ${colors.fg}40`,
3972
+ borderRadius: isSmall ? 6 : 8,
3973
+ color: colors.fg,
3974
+ display: "flex",
3975
+ fontSize: scoreFontSize,
3976
+ fontWeight: 700,
3977
+ height: scoreSize,
3978
+ justifyContent: "center",
3979
+ lineHeight: 1,
3980
+ width: scoreWidth
3981
+ },
3982
+ children: rounded
3983
+ }
3984
+ ) }),
3985
+ /* @__PURE__ */ jsxs12(Stack9, { space: 2, children: [
3986
+ /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
3987
+ /* @__PURE__ */ jsx15(Text13, { size: isSmall ? 2 : 3, weight: "semibold", children: report.tag ?? formatCardDate(report.completedAt) }),
3988
+ git && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, children: [
3989
+ /* @__PURE__ */ jsxs12(Inline, { space: 1, children: [
3990
+ /* @__PURE__ */ jsx15(GitBranchIcon, { style: { opacity: 0.6 } }),
3991
+ /* @__PURE__ */ jsx15(Code, { size: isSmall ? 1 : 2, children: git.branch })
3992
+ ] }),
3993
+ git.prNumber && /* @__PURE__ */ jsxs12(Text13, { muted: true, size: isSmall ? 1 : 2, children: [
3994
+ "#",
3995
+ git.prNumber
3996
+ ] }),
3997
+ tier === "full" && /* @__PURE__ */ jsx15(Code, { size: 1, style: { opacity: 0.5 }, children: git.sha.slice(0, 7) })
3998
+ ] })
3978
3999
  ] }),
3979
- /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
3980
- data.comparisonDelta != null && /* @__PURE__ */ jsx22(DeltaIndicator, { delta: data.comparisonDelta }),
3981
- /* @__PURE__ */ jsx22(StatusBadges, { improved: data.improved, regressed: data.regressed }),
3982
- /* @__PURE__ */ jsx22(
3983
- Text17,
4000
+ /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
4001
+ report.source && /* @__PURE__ */ jsx15(
4002
+ Badge4,
3984
4003
  {
3985
- muted: true,
3986
- size: 1,
3987
- title: new Date(data.completedAt).toISOString(),
3988
- children: formatRelativeTime(data.completedAt)
4004
+ fontSize: isSmall ? 0 : 1,
4005
+ padding: 1,
4006
+ radius: 1,
4007
+ tone: SOURCE_TONE[report.source] ?? "default",
4008
+ children: report.source
3989
4009
  }
3990
4010
  ),
3991
- data.trigger && /* @__PURE__ */ jsx22(Badge12, { fontSize: 1, tone: "default", children: data.trigger })
4011
+ report.models?.map((model) => /* @__PURE__ */ jsx15(
4012
+ Badge4,
4013
+ {
4014
+ fontSize: isSmall ? 0 : 1,
4015
+ padding: 1,
4016
+ radius: 1,
4017
+ tone: "default",
4018
+ children: model
4019
+ },
4020
+ model
4021
+ )),
4022
+ report.perspective && /* @__PURE__ */ jsx15(OutlineBadge, { tone: "cyan", children: report.perspective }),
4023
+ report.durationMs != null && report.durationMs > 0 && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
4024
+ /* @__PURE__ */ jsx15(ClockIcon, { style: { fontSize: 13, opacity: 0.5 } }),
4025
+ /* @__PURE__ */ jsx15(Text13, { muted: true, size: isSmall ? 0 : 1, children: formatDuration(report.durationMs) })
4026
+ ] })
3992
4027
  ] }),
3993
- data.git && /* @__PURE__ */ jsx22(GitOrigin, { git: data.git })
3994
- ] })
3995
- ] })
3996
- }
3997
- );
3998
- }
3999
-
4000
- // src/components/search-bar/SearchBar.tsx
4001
- import { SearchIcon as SearchIcon4 } from "@sanity/icons";
4002
- import { Card as Card11, Flex as Flex16, Text as Text20 } from "@sanity/ui";
4003
- import {
4004
- useCallback as useCallback11,
4005
- useEffect as useEffect6,
4006
- useRef as useRef4,
4007
- useState as useState6
4008
- } from "react";
4009
-
4010
- // src/components/search-bar/types.ts
4011
- var DIMENSIONS = [
4012
- {
4013
- key: "model",
4014
- categoryLabel: "Models",
4015
- prefix: "model:",
4016
- tone: "primary",
4017
- multi: false
4018
- },
4019
- {
4020
- key: "area",
4021
- categoryLabel: "Areas",
4022
- prefix: "area:",
4023
- tone: "positive",
4024
- multi: true
4025
- },
4026
- {
4027
- key: "date",
4028
- categoryLabel: "Date range",
4029
- prefix: "date:",
4030
- tone: "caution",
4031
- multi: false
4032
- }
4033
- ];
4034
- var DATE_SUGGESTIONS = [
4035
- { label: "Today", value: "today" },
4036
- { label: "Yesterday", value: "yesterday" },
4037
- { label: "Last 7 days", value: "7d" },
4038
- { label: "Last 30 days", value: "30d" },
4039
- { label: "Last 90 days", value: "90d" }
4040
- ];
4041
- var nextTokenId = 0;
4042
- function createToken(dimension, value, label) {
4043
- return {
4044
- id: `token-${++nextTokenId}`,
4045
- dimension,
4046
- value,
4047
- label: label ?? value
4048
- };
4049
- }
4050
-
4051
- // src/components/search-bar/suggestions.ts
4052
- function computeSuggestions(input) {
4053
- const { query, activeTokens, models, areas } = input;
4054
- const trimmed = query.trim().toLowerCase();
4055
- const scopedDimension = detectScopedDimension(trimmed);
4056
- if (scopedDimension) {
4057
- const afterPrefix = trimmed.slice(scopedDimension.prefix.length).trim();
4058
- return getScopedSuggestions(
4059
- scopedDimension,
4060
- afterPrefix,
4061
- activeTokens,
4062
- models,
4063
- areas
4064
- );
4065
- }
4066
- if (trimmed.length === 0) {
4067
- return getDimensionHints(activeTokens);
4068
- }
4069
- return getUnscopedSuggestions(trimmed, activeTokens, models, areas);
4070
- }
4071
- function detectScopedDimension(query) {
4072
- return DIMENSIONS.find((d) => query.startsWith(d.prefix));
4073
- }
4074
- function getScopedSuggestions(dim, afterPrefix, activeTokens, models, areas) {
4075
- const values = getValuesForDimension(dim.key, models, areas);
4076
- const filtered = filterAndExclude(values, afterPrefix, dim, activeTokens);
4077
- return filtered.map((v) => ({
4078
- dimension: dim.key,
4079
- value: v.value,
4080
- label: v.label,
4081
- category: dim.categoryLabel
4082
- }));
4083
- }
4084
- function getUnscopedSuggestions(query, activeTokens, models, areas) {
4085
- const results = [];
4086
- for (const dim of DIMENSIONS) {
4087
- const values = getValuesForDimension(dim.key, models, areas);
4088
- const matching = filterAndExclude(values, query, dim, activeTokens);
4089
- for (const v of matching.slice(0, 3)) {
4090
- results.push({
4091
- dimension: dim.key,
4092
- value: v.value,
4093
- label: v.label,
4094
- category: dim.categoryLabel
4095
- });
4096
- }
4097
- }
4098
- for (const dim of DIMENSIONS) {
4099
- if (dim.prefix.startsWith(query) && query.length > 0 && query.length < dim.prefix.length) {
4100
- results.push({
4101
- dimension: dim.key,
4102
- value: dim.prefix,
4103
- label: `Type "${dim.prefix}" to filter by ${dim.categoryLabel.toLowerCase()}`,
4104
- category: "Filters"
4105
- });
4106
- }
4107
- }
4108
- return results;
4109
- }
4110
- function getDimensionHints(activeTokens) {
4111
- return DIMENSIONS.filter((dim) => {
4112
- if (!dim.multi && activeTokens.some((t) => t.dimension === dim.key)) {
4113
- return false;
4114
- }
4115
- return true;
4116
- }).map((dim) => ({
4117
- dimension: dim.key,
4118
- value: dim.prefix,
4119
- label: `${dim.prefix} \u2014 filter by ${dim.categoryLabel.toLowerCase()}`,
4120
- category: "Filters"
4121
- }));
4122
- }
4123
- function getValuesForDimension(key, models, areas) {
4124
- switch (key) {
4125
- case "model":
4126
- return models.map((m) => ({ label: m, value: m }));
4127
- case "area":
4128
- return areas.map((a) => ({ label: a, value: a }));
4129
- case "date":
4130
- return DATE_SUGGESTIONS;
4131
- }
4132
- }
4133
- function filterAndExclude(values, query, dim, activeTokens) {
4134
- const activeDimValues = new Set(
4135
- activeTokens.filter((t) => t.dimension === dim.key).map((t) => t.value)
4136
- );
4137
- return values.filter((v) => {
4138
- if (activeDimValues.has(v.value)) return false;
4139
- if (!dim.multi && activeDimValues.size > 0) return false;
4140
- if (!query) return true;
4141
- return v.label.toLowerCase().includes(query);
4142
- });
4143
- }
4144
-
4145
- // src/components/search-bar/FilterBadge.tsx
4146
- import { CloseIcon } from "@sanity/icons";
4147
- import { Badge as Badge13, Flex as Flex14, Text as Text18 } from "@sanity/ui";
4148
- import { useCallback as useCallback9 } from "react";
4149
- import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
4150
- function FilterBadge({ token, onRemove }) {
4151
- const dim = DIMENSIONS.find((d) => d.key === token.dimension);
4152
- const tone = dim?.tone ?? "default";
4153
- const handleRemove = useCallback9(
4154
- (e) => {
4155
- e.stopPropagation();
4156
- onRemove(token.id);
4157
- },
4158
- [onRemove, token.id]
4159
- );
4160
- return /* @__PURE__ */ jsx23(
4161
- Badge13,
4162
- {
4163
- fontSize: 1,
4164
- style: {
4165
- cursor: "default",
4166
- flexShrink: 0,
4167
- userSelect: "none"
4168
- },
4169
- tone,
4170
- children: /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 1, children: [
4171
- /* @__PURE__ */ jsxs18(Text18, { size: 1, children: [
4172
- token.dimension,
4173
- ":",
4174
- token.label
4028
+ (hasAreas || hasDocs) && /* @__PURE__ */ jsxs12(Flex9, { gap: 2, wrap: "wrap", children: [
4029
+ hasAreas && report.areas.map((area) => /* @__PURE__ */ jsx15(OutlineBadge, { tone: "purple", children: area }, `a-${area}`)),
4030
+ hasDocs && report.targetDocuments.map((doc) => /* @__PURE__ */ jsx15(OutlineBadge, { tone: "positive", children: doc }, `d-${doc}`))
4031
+ ] }),
4032
+ isSmall && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
4033
+ /* @__PURE__ */ jsx15(OutlineBadge, { tone: MODE_TONE[report.mode] ?? "default", children: report.mode }),
4034
+ report.trigger && /* @__PURE__ */ jsx15(OutlineBadge, { tone: TRIGGER_TONE[report.trigger] ?? "default", children: report.trigger }),
4035
+ /* @__PURE__ */ jsx15(
4036
+ Text13,
4037
+ {
4038
+ muted: true,
4039
+ size: 0,
4040
+ title: new Date(report.completedAt).toISOString(),
4041
+ children: formatRelativeTime(report.completedAt)
4042
+ }
4043
+ ),
4044
+ tier === "narrow" && hasDelta && /* @__PURE__ */ jsx15(DeltaInline, { delta, deltaUp }),
4045
+ tier === "narrow" && improvedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "positive", children: [
4046
+ improvedCount,
4047
+ " improved"
4048
+ ] }),
4049
+ tier === "narrow" && regressedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "critical", children: [
4050
+ regressedCount,
4051
+ " regressed"
4052
+ ] })
4053
+ ] })
4175
4054
  ] }),
4176
- /* @__PURE__ */ jsx23(
4177
- Text18,
4055
+ tier !== "narrow" && /* @__PURE__ */ jsxs12(
4056
+ Flex9,
4178
4057
  {
4179
- muted: true,
4180
- onClick: handleRemove,
4181
- size: 1,
4182
- style: { cursor: "pointer", lineHeight: 1 },
4183
- children: /* @__PURE__ */ jsx23(CloseIcon, {})
4058
+ align: "flex-start",
4059
+ direction: "column",
4060
+ gap: 2,
4061
+ style: { paddingTop: 2 },
4062
+ children: [
4063
+ hasDelta && /* @__PURE__ */ jsx15(DeltaInline, { delta, deltaUp }),
4064
+ improvedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "positive", children: [
4065
+ improvedCount,
4066
+ " improved"
4067
+ ] }),
4068
+ regressedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "critical", children: [
4069
+ regressedCount,
4070
+ " regressed"
4071
+ ] })
4072
+ ]
4184
4073
  }
4185
- )
4186
- ] })
4187
- }
4188
- );
4189
- }
4190
-
4191
- // src/components/search-bar/SuggestionList.tsx
4192
- import { Badge as Badge14, Card as Card10, Flex as Flex15, Stack as Stack12, Text as Text19 } from "@sanity/ui";
4193
- import { useCallback as useCallback10 } from "react";
4194
- import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
4195
- function SuggestionList({
4196
- suggestions,
4197
- activeIndex,
4198
- onSelect
4199
- }) {
4200
- if (suggestions.length === 0) return null;
4201
- const groups = groupByCategory(suggestions);
4202
- let globalIndex = -1;
4203
- return /* @__PURE__ */ jsx24(
4204
- Card10,
4205
- {
4206
- overflow: "auto",
4207
- radius: 2,
4208
- shadow: 2,
4209
- style: {
4210
- left: 0,
4211
- maxHeight: 300,
4212
- position: "absolute",
4213
- right: 0,
4214
- top: "100%",
4215
- zIndex: 100
4216
- },
4217
- children: /* @__PURE__ */ jsx24(Stack12, { padding: 1, space: 1, children: groups.map(([category, items]) => /* @__PURE__ */ jsxs19(Stack12, { space: 0, children: [
4218
- /* @__PURE__ */ jsx24(
4219
- Text19,
4074
+ ),
4075
+ tier === "full" && /* @__PURE__ */ jsx15("div", { style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx15(OutlineBadge, { tone: MODE_TONE[report.mode] ?? "default", children: report.mode }) }),
4076
+ tier === "full" && /* @__PURE__ */ jsx15("div", { style: { paddingTop: 2 }, children: report.trigger && /* @__PURE__ */ jsx15(OutlineBadge, { tone: TRIGGER_TONE[report.trigger] ?? "default", children: report.trigger }) }),
4077
+ tier === "full" && /* @__PURE__ */ jsx15("div", { style: { paddingTop: 2, textAlign: "right" }, children: /* @__PURE__ */ jsx15(
4078
+ Text13,
4220
4079
  {
4221
4080
  muted: true,
4222
- size: 1,
4223
- style: {
4224
- letterSpacing: "0.05em",
4225
- padding: "6px 8px 2px",
4226
- textTransform: "uppercase"
4227
- },
4228
- weight: "semibold",
4229
- children: category
4081
+ size: 2,
4082
+ title: new Date(report.completedAt).toISOString(),
4083
+ children: formatRelativeTime(report.completedAt)
4230
4084
  }
4231
- ),
4232
- items.map((suggestion) => {
4233
- globalIndex++;
4234
- const isActive = globalIndex === activeIndex;
4235
- return /* @__PURE__ */ jsx24(
4236
- SuggestionItem,
4237
- {
4238
- active: isActive,
4239
- onSelect,
4240
- suggestion
4241
- },
4242
- `${suggestion.dimension}-${suggestion.value}`
4243
- );
4244
- })
4245
- ] }, category)) })
4246
- }
4247
- );
4248
- }
4249
- function SuggestionItem({
4250
- active,
4251
- onSelect,
4252
- suggestion
4253
- }) {
4254
- const dim = DIMENSIONS.find((d) => d.key === suggestion.dimension);
4255
- const tone = dim?.tone ?? "default";
4256
- const isHint = suggestion.category === "Filters";
4257
- const handleClick = useCallback10(() => {
4258
- onSelect(suggestion);
4259
- }, [onSelect, suggestion]);
4260
- return /* @__PURE__ */ jsx24(
4261
- Card10,
4262
- {
4263
- onClick: handleClick,
4264
- padding: 2,
4265
- radius: 2,
4266
- style: { cursor: "pointer" },
4267
- tone: active ? "primary" : "default",
4268
- children: /* @__PURE__ */ jsxs19(Flex15, { align: "center", gap: 2, children: [
4269
- !isHint && /* @__PURE__ */ jsx24(Badge14, { fontSize: 1, tone, children: suggestion.dimension }),
4270
- /* @__PURE__ */ jsx24(Text19, { size: 2, children: suggestion.label })
4271
- ] })
4085
+ ) })
4086
+ ]
4272
4087
  }
4273
4088
  );
4274
4089
  }
4275
- function groupByCategory(suggestions) {
4276
- const map = /* @__PURE__ */ new Map();
4277
- for (const s of suggestions) {
4278
- if (!map.has(s.category)) map.set(s.category, []);
4279
- map.get(s.category).push(s);
4280
- }
4281
- return [...map.entries()];
4282
- }
4283
-
4284
- // src/components/search-bar/SearchBar.tsx
4285
- import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
4286
- function SearchBar({
4287
- tokens,
4288
- query,
4289
- models,
4290
- areas,
4291
- onQueryChange,
4292
- onTokenAdd,
4293
- onTokenRemove
4294
- }) {
4295
- const [focused, setFocused] = useState6(false);
4296
- const [activeIndex, setActiveIndex] = useState6(-1);
4297
- const inputRef = useRef4(null);
4298
- const blurTimerRef = useRef4(null);
4299
- useEffect6(() => {
4300
- return () => {
4301
- if (blurTimerRef.current) {
4302
- clearTimeout(blurTimerRef.current);
4303
- }
4304
- };
4305
- }, []);
4306
- const suggestions = focused ? computeSuggestions({ query, activeTokens: tokens, models, areas }) : [];
4307
- useEffect6(() => {
4308
- setActiveIndex(-1);
4309
- }, [query, tokens.length]);
4310
- const handleTokenRemove = useCallback11(
4311
- (id) => {
4312
- onTokenRemove(id);
4313
- requestAnimationFrame(() => {
4314
- inputRef.current?.focus();
4315
- });
4316
- },
4317
- [onTokenRemove]
4318
- );
4319
- const handleSuggestionSelect = useCallback11(
4320
- (suggestion) => {
4321
- if (suggestion.category === "Filters") {
4322
- onQueryChange(suggestion.value);
4323
- inputRef.current?.focus();
4324
- return;
4325
- }
4326
- const token = createToken(
4327
- suggestion.dimension,
4328
- suggestion.value,
4329
- suggestion.label
4330
- );
4331
- onTokenAdd(token);
4332
- onQueryChange("");
4333
- setActiveIndex(-1);
4334
- inputRef.current?.focus();
4335
- },
4336
- [onTokenAdd, onQueryChange]
4337
- );
4338
- const handleKeyDown = useCallback11(
4339
- (e) => {
4340
- if (e.key === "ArrowDown") {
4341
- e.preventDefault();
4342
- setActiveIndex((prev) => prev < suggestions.length - 1 ? prev + 1 : 0);
4343
- } else if (e.key === "ArrowUp") {
4344
- e.preventDefault();
4345
- setActiveIndex((prev) => prev > 0 ? prev - 1 : suggestions.length - 1);
4346
- } else if (e.key === "Enter" && activeIndex >= 0) {
4347
- e.preventDefault();
4348
- const selected = suggestions[activeIndex];
4349
- if (selected) handleSuggestionSelect(selected);
4350
- } else if (e.key === "Escape") {
4351
- setFocused(false);
4352
- inputRef.current?.blur();
4353
- } else if (e.key === "Backspace" && query === "" && tokens.length > 0) {
4354
- handleTokenRemove(tokens[tokens.length - 1].id);
4355
- }
4356
- },
4357
- [
4358
- activeIndex,
4359
- suggestions,
4360
- query,
4361
- tokens,
4362
- handleTokenRemove,
4363
- handleSuggestionSelect
4364
- ]
4365
- );
4366
- const handleInputChange = useCallback11(
4367
- (e) => {
4368
- const value = e.target.value;
4369
- onQueryChange(value);
4370
- },
4371
- [onQueryChange]
4372
- );
4373
- const handleBlur = useCallback11(() => {
4374
- blurTimerRef.current = setTimeout(() => {
4375
- blurTimerRef.current = null;
4376
- setFocused(false);
4377
- }, 200);
4378
- }, []);
4379
- const handleFocus = useCallback11(() => {
4380
- if (blurTimerRef.current) {
4381
- clearTimeout(blurTimerRef.current);
4382
- blurTimerRef.current = null;
4383
- }
4384
- setFocused(true);
4385
- }, []);
4386
- const handleBarClick = useCallback11(() => {
4387
- inputRef.current?.focus();
4388
- }, []);
4389
- return /* @__PURE__ */ jsxs20("div", { style: { position: "relative" }, children: [
4390
- /* @__PURE__ */ jsx25(
4391
- Card11,
4090
+ function DeltaInline({ delta, deltaUp }) {
4091
+ return /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
4092
+ /* @__PURE__ */ jsx15(
4093
+ TrendUpwardIcon,
4392
4094
  {
4393
- border: true,
4394
- onClick: handleBarClick,
4395
- padding: 2,
4396
- radius: 2,
4397
- style: { cursor: "text" },
4398
- children: /* @__PURE__ */ jsxs20(Flex16, { align: "center", gap: 1, wrap: "wrap", children: [
4399
- /* @__PURE__ */ jsx25(Text20, { muted: true, size: 2, style: { flexShrink: 0, padding: "0 4px" }, children: /* @__PURE__ */ jsx25(SearchIcon4, {}) }),
4400
- tokens.map((token) => /* @__PURE__ */ jsx25(
4401
- FilterBadge,
4402
- {
4403
- onRemove: handleTokenRemove,
4404
- token
4405
- },
4406
- token.id
4407
- )),
4408
- /* @__PURE__ */ jsx25(
4409
- "input",
4410
- {
4411
- onBlur: handleBlur,
4412
- onChange: handleInputChange,
4413
- onFocus: handleFocus,
4414
- onKeyDown: handleKeyDown,
4415
- placeholder: tokens.length > 0 ? "Add more filters or search..." : "Search reports: type model:, area:, date: to filter...",
4416
- ref: inputRef,
4417
- style: {
4418
- background: "transparent",
4419
- border: "none",
4420
- color: "inherit",
4421
- flex: 1,
4422
- font: "inherit",
4423
- fontSize: "0.8125rem",
4424
- minWidth: 180,
4425
- outline: "none",
4426
- padding: "4px 0"
4427
- },
4428
- type: "text",
4429
- value: query
4430
- }
4431
- )
4432
- ] })
4095
+ style: {
4096
+ color: deltaUp ? "var(--card-badge-positive-dot-color)" : "var(--card-badge-critical-dot-color)",
4097
+ fontSize: 15,
4098
+ transform: deltaUp ? void 0 : "scaleY(-1)"
4099
+ }
4433
4100
  }
4434
4101
  ),
4435
- focused && suggestions.length > 0 && /* @__PURE__ */ jsx25(
4436
- SuggestionList,
4102
+ /* @__PURE__ */ jsxs12(
4103
+ Text13,
4437
4104
  {
4438
- activeIndex,
4439
- onSelect: handleSuggestionSelect,
4440
- suggestions
4105
+ size: 2,
4106
+ style: {
4107
+ color: deltaUp ? "var(--card-badge-positive-dot-color)" : "var(--card-badge-critical-dot-color)",
4108
+ fontWeight: 600
4109
+ },
4110
+ children: [
4111
+ deltaUp ? "+" : "",
4112
+ Math.round(delta)
4113
+ ]
4114
+ }
4115
+ )
4116
+ ] });
4117
+ }
4118
+ var MODE_TONE = {
4119
+ agentic: "positive",
4120
+ baseline: "default",
4121
+ full: "primary",
4122
+ observed: "caution",
4123
+ debug: "purple"
4124
+ };
4125
+ var SOURCE_TONE = {
4126
+ branch: "primary",
4127
+ local: "default",
4128
+ production: "caution"
4129
+ };
4130
+ var TRIGGER_TONE = {
4131
+ ci: "cyan",
4132
+ "cross-repo": "purple",
4133
+ manual: "caution",
4134
+ schedule: "default",
4135
+ webhook: "positive"
4136
+ };
4137
+ function ColHeader({
4138
+ label,
4139
+ active,
4140
+ direction,
4141
+ onClick,
4142
+ align
4143
+ }) {
4144
+ const handleKeyDown = useCallback9(
4145
+ (e) => {
4146
+ if (onClick && (e.key === "Enter" || e.key === " ")) {
4147
+ e.preventDefault();
4148
+ onClick();
4441
4149
  }
4442
- )
4443
- ] });
4150
+ },
4151
+ [onClick]
4152
+ );
4153
+ const arrow = active ? direction === "asc" ? " \u2191" : " \u2193" : "";
4154
+ return /* @__PURE__ */ jsx15(
4155
+ "div",
4156
+ {
4157
+ onClick,
4158
+ onKeyDown: onClick ? handleKeyDown : void 0,
4159
+ role: onClick ? "button" : void 0,
4160
+ style: {
4161
+ cursor: onClick ? "pointer" : "default",
4162
+ textAlign: align,
4163
+ userSelect: "none"
4164
+ },
4165
+ tabIndex: onClick ? 0 : void 0,
4166
+ children: /* @__PURE__ */ jsxs12(
4167
+ Text13,
4168
+ {
4169
+ muted: true,
4170
+ size: 1,
4171
+ style: {
4172
+ letterSpacing: "0.08em",
4173
+ textTransform: "uppercase"
4174
+ },
4175
+ weight: "semibold",
4176
+ children: [
4177
+ label,
4178
+ arrow
4179
+ ]
4180
+ }
4181
+ )
4182
+ }
4183
+ );
4444
4184
  }
4445
4185
 
4446
4186
  // src/components/LatestReports.tsx
4447
- import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
4448
- var SORT_LABELS = {
4449
- date: "Date",
4450
- name: "Name",
4451
- score: "Score"
4452
- };
4187
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
4188
+ function readParam(params, key) {
4189
+ if (!params) return null;
4190
+ const pair = params.find(([k]) => k === key);
4191
+ return pair ? pair[1] : null;
4192
+ }
4193
+ function buildSearchParams(filters) {
4194
+ const params = [];
4195
+ if (filters.q) params.push(["q", filters.q]);
4196
+ if (filters.mode) params.push(["mode", filters.mode]);
4197
+ if (filters.source) params.push(["source", filters.source]);
4198
+ if (filters.trigger) params.push(["trigger", filters.trigger]);
4199
+ return params;
4200
+ }
4453
4201
  function LatestReports({
4454
- mode = null,
4455
4202
  onSelectReport,
4456
- pageSize = 20,
4457
- source = null
4203
+ pageSize = 20
4458
4204
  }) {
4459
- const client = useClient6({ apiVersion: API_VERSION });
4460
- const [initialLoading, setInitialLoading] = useState7(true);
4461
- const [loadingMore, setLoadingMore] = useState7(false);
4462
- const [reports, setReports] = useState7([]);
4463
- const [hasMore, setHasMore] = useState7(true);
4464
- const [searchQuery, setSearchQuery] = useState7("");
4465
- const [filterTokens, setFilterTokens] = useState7([]);
4466
- const [documentSlug, setDocumentSlug] = useState7("");
4467
- const [perspective, setPerspective] = useState7("");
4468
- const [sort, setSort] = useState7({
4205
+ const client = useClient4({ apiVersion: API_VERSION });
4206
+ const router = useRouter();
4207
+ const routerState = router.state;
4208
+ const urlParams = routerState._searchParams;
4209
+ const [searchQuery, setSearchQuery] = useState5(
4210
+ () => readParam(urlParams, "q") ?? ""
4211
+ );
4212
+ const [mode, setMode] = useState5(
4213
+ () => readParam(urlParams, "mode")
4214
+ );
4215
+ const [source, setSource] = useState5(
4216
+ () => readParam(urlParams, "source")
4217
+ );
4218
+ const [trigger, setTrigger] = useState5(
4219
+ () => readParam(urlParams, "trigger")
4220
+ );
4221
+ useEffect5(() => {
4222
+ const params = buildSearchParams({
4223
+ q: searchQuery,
4224
+ mode,
4225
+ source,
4226
+ trigger
4227
+ });
4228
+ router.navigate({ ...router.state, _searchParams: params });
4229
+ }, [searchQuery, mode, source, trigger]);
4230
+ const [initialLoading, setInitialLoading] = useState5(true);
4231
+ const [loadingMore, setLoadingMore] = useState5(false);
4232
+ const [reports, setReports] = useState5([]);
4233
+ const [hasMore, setHasMore] = useState5(true);
4234
+ const [modes, setModes] = useState5([]);
4235
+ const [sources, setSources] = useState5([]);
4236
+ const [triggers, setTriggers] = useState5([]);
4237
+ const [sort, setSort] = useState5({
4469
4238
  direction: "desc",
4470
4239
  field: "date"
4471
4240
  });
4472
- const [availableModels, setAvailableModels] = useState7([]);
4473
- const [availableAreas, setAvailableAreas] = useState7([]);
4474
- useEffect7(() => {
4475
- setInitialLoading(true);
4241
+ useEffect5(() => {
4476
4242
  setHasMore(true);
4477
4243
  client.fetch(latestReportsQuery, {
4478
4244
  limit: pageSize,
@@ -4489,7 +4255,7 @@ function LatestReports({
4489
4255
  setInitialLoading(false);
4490
4256
  });
4491
4257
  }, [client, pageSize, mode, source]);
4492
- const handleLoadMore = useCallback12(() => {
4258
+ const handleLoadMore = useCallback10(() => {
4493
4259
  if (loadingMore || !hasMore) return;
4494
4260
  setLoadingMore(true);
4495
4261
  const nextLimit = reports.length + pageSize;
@@ -4506,29 +4272,16 @@ function LatestReports({
4506
4272
  setLoadingMore(false);
4507
4273
  });
4508
4274
  }, [client, hasMore, loadingMore, mode, pageSize, reports.length, source]);
4509
- useEffect7(() => {
4510
- client.fetch(distinctModelsQuery).then((data) => setAvailableModels((data ?? []).sort())).catch(() => setAvailableModels([]));
4511
- client.fetch(distinctAreasQuery).then((data) => setAvailableAreas((data ?? []).sort())).catch(() => setAvailableAreas([]));
4275
+ useEffect5(() => {
4276
+ client.fetch(distinctModesQuery).then((data) => setModes((data ?? []).sort())).catch(() => setModes([]));
4277
+ client.fetch(distinctSourcesQuery).then((data) => setSources((data ?? []).sort())).catch(() => setSources([]));
4278
+ client.fetch(distinctTriggersQuery).then((data) => setTriggers((data ?? []).sort())).catch(() => setTriggers([]));
4512
4279
  }, [client]);
4513
- const activeFilters = useMemo5(() => {
4514
- const result = { models: [], areas: [], datePreset: null };
4515
- for (const token of filterTokens) {
4516
- switch (token.dimension) {
4517
- case "model":
4518
- result.models.push(token.value);
4519
- break;
4520
- case "area":
4521
- result.areas.push(token.value);
4522
- break;
4523
- case "date":
4524
- result.datePreset = token.value;
4525
- break;
4526
- }
4527
- }
4528
- return result;
4529
- }, [filterTokens]);
4530
- const filteredReports = useMemo5(() => {
4280
+ const filteredReports = useMemo4(() => {
4531
4281
  let result = reports;
4282
+ if (trigger) {
4283
+ result = result.filter((r) => r.trigger === trigger);
4284
+ }
4532
4285
  if (searchQuery.trim()) {
4533
4286
  const query = searchQuery.toLowerCase().trim();
4534
4287
  result = result.filter((r) => {
@@ -4538,48 +4291,19 @@ function LatestReports({
4538
4291
  r.source,
4539
4292
  r.trigger,
4540
4293
  ...r.models,
4541
- ...r.areas ?? [],
4542
- formatDate(r.completedAt)
4294
+ ...r.areas ?? []
4543
4295
  ].filter(Boolean).join(" ").toLowerCase();
4544
4296
  return searchable.includes(query);
4545
4297
  });
4546
4298
  }
4547
- if (activeFilters.datePreset) {
4548
- const threshold = getDateThreshold(activeFilters.datePreset);
4549
- if (threshold) {
4550
- const thresholdMs = threshold.getTime();
4551
- result = result.filter(
4552
- (r) => new Date(r.completedAt).getTime() >= thresholdMs
4553
- );
4554
- }
4555
- }
4556
- if (activeFilters.models.length > 0) {
4557
- result = result.filter(
4558
- (r) => activeFilters.models.some((m) => r.models.includes(m))
4559
- );
4560
- }
4561
- if (activeFilters.areas.length > 0) {
4562
- result = result.filter(
4563
- (r) => r.areas && activeFilters.areas.some((a) => r.areas.includes(a))
4564
- );
4565
- }
4566
- if (documentSlug.trim()) {
4567
- const slug = documentSlug.trim().toLowerCase();
4568
- result = result.filter(
4569
- (r) => r.targetDocuments && r.targetDocuments.some((d) => d.toLowerCase().includes(slug))
4570
- );
4571
- }
4572
- if (perspective.trim()) {
4573
- result = result.filter((r) => r.perspective === perspective.trim());
4574
- }
4575
4299
  const dir = sort.direction === "asc" ? 1 : -1;
4576
4300
  result = [...result].sort((a, b) => {
4577
4301
  switch (sort.field) {
4578
4302
  case "date":
4579
4303
  return dir * (new Date(a.completedAt).getTime() - new Date(b.completedAt).getTime());
4580
4304
  case "name": {
4581
- const nameA = (a.tag ?? formatDate(a.completedAt)).toLowerCase();
4582
- const nameB = (b.tag ?? formatDate(b.completedAt)).toLowerCase();
4305
+ const nameA = (a.tag ?? a.completedAt).toLowerCase();
4306
+ const nameB = (b.tag ?? b.completedAt).toLowerCase();
4583
4307
  return dir * nameA.localeCompare(nameB);
4584
4308
  }
4585
4309
  case "score":
@@ -4589,182 +4313,65 @@ function LatestReports({
4589
4313
  }
4590
4314
  });
4591
4315
  return result;
4592
- }, [reports, searchQuery, activeFilters, documentSlug, perspective, sort]);
4593
- const handleTokenAdd = useCallback12((token) => {
4594
- setFilterTokens((prev) => {
4595
- const dim = token.dimension;
4596
- const isMulti = dim === "area";
4597
- if (!isMulti) {
4598
- return [...prev.filter((t) => t.dimension !== dim), token];
4599
- }
4600
- return [...prev, token];
4601
- });
4602
- }, []);
4603
- const handleTokenRemove = useCallback12((id) => {
4604
- setFilterTokens((prev) => prev.filter((t) => t.id !== id));
4605
- }, []);
4606
- const toggleSortDirection = useCallback12(() => {
4607
- setSort((prev) => ({
4608
- ...prev,
4609
- direction: prev.direction === "asc" ? "desc" : "asc"
4610
- }));
4611
- }, []);
4612
- const handleSortFieldChange = useCallback12((field) => {
4316
+ }, [reports, searchQuery, trigger, sort]);
4317
+ const handleSortFieldChange = useCallback10((field) => {
4613
4318
  setSort(
4614
4319
  (prev) => prev.field === field ? { ...prev, direction: prev.direction === "asc" ? "desc" : "asc" } : { direction: "desc", field }
4615
4320
  );
4616
4321
  }, []);
4617
- const hasActiveFilters = searchQuery.trim() !== "" || filterTokens.length > 0 || documentSlug.trim() !== "" || perspective.trim() !== "";
4618
- const handleClearFilters = useCallback12(() => {
4322
+ const handleReset = useCallback10(() => {
4619
4323
  setSearchQuery("");
4620
- setFilterTokens([]);
4621
- setDocumentSlug("");
4622
- setPerspective("");
4324
+ setMode(null);
4325
+ setSource(null);
4326
+ setTrigger(null);
4623
4327
  }, []);
4624
4328
  if (initialLoading) {
4625
- return /* @__PURE__ */ jsx26(Card12, { padding: 4, children: /* @__PURE__ */ jsx26(Text21, { muted: true, children: "Loading reports\u2026" }) });
4329
+ return /* @__PURE__ */ jsx16(Card7, { padding: 4, children: /* @__PURE__ */ jsx16(Text14, { muted: true, children: "Loading reports\u2026" }) });
4626
4330
  }
4627
- if (reports.length === 0) {
4628
- return /* @__PURE__ */ jsx26(Card12, { padding: 4, children: /* @__PURE__ */ jsx26(Text21, { muted: true, children: "No reports found. Run the pipeline with --publish to create reports." }) });
4331
+ if (reports.length === 0 && !mode && !source) {
4332
+ return /* @__PURE__ */ jsx16(Card7, { padding: 4, children: /* @__PURE__ */ jsx16(Text14, { muted: true, children: "No reports found. Run the pipeline with --publish to create reports." }) });
4629
4333
  }
4630
- return /* @__PURE__ */ jsxs21(Stack13, { space: 3, children: [
4631
- /* @__PURE__ */ jsx26(Card12, { padding: 3, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs21(Stack13, { space: 3, children: [
4632
- /* @__PURE__ */ jsxs21(Stack13, { space: 1, children: [
4633
- /* @__PURE__ */ jsx26(Text21, { muted: true, size: 1, children: "Search & filter" }),
4634
- /* @__PURE__ */ jsx26(
4635
- SearchBar,
4636
- {
4637
- areas: availableAreas,
4638
- models: availableModels,
4639
- onQueryChange: setSearchQuery,
4640
- onTokenAdd: handleTokenAdd,
4641
- onTokenRemove: handleTokenRemove,
4642
- query: searchQuery,
4643
- tokens: filterTokens
4644
- }
4645
- )
4646
- ] }),
4647
- /* @__PURE__ */ jsxs21(Flex17, { gap: 2, children: [
4648
- /* @__PURE__ */ jsx26(Box8, { flex: 1, children: /* @__PURE__ */ jsxs21(Stack13, { space: 1, children: [
4649
- /* @__PURE__ */ jsx26(Text21, { muted: true, size: 1, children: "Document" }),
4650
- /* @__PURE__ */ jsx26(
4651
- DocumentFilter,
4652
- {
4653
- onChange: setDocumentSlug,
4654
- onPerspectiveHint: setPerspective,
4655
- value: documentSlug
4656
- }
4657
- )
4658
- ] }) }),
4659
- /* @__PURE__ */ jsx26(Box8, { flex: 1, children: /* @__PURE__ */ jsxs21(Stack13, { space: 1, children: [
4660
- /* @__PURE__ */ jsx26(Text21, { muted: true, size: 1, children: "Content release" }),
4661
- /* @__PURE__ */ jsx26(
4662
- PerspectiveFilter,
4663
- {
4664
- onChange: setPerspective,
4665
- value: perspective
4666
- }
4667
- )
4668
- ] }) })
4669
- ] }),
4670
- (documentSlug.trim() || perspective.trim()) && /* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 1, children: [
4671
- documentSlug.trim() && /* @__PURE__ */ jsxs21(Badge15, { fontSize: 1, tone: "primary", children: [
4672
- "Document: ",
4673
- documentSlug.trim()
4674
- ] }),
4675
- perspective.trim() && /* @__PURE__ */ jsxs21(Badge15, { fontSize: 1, tone: "primary", children: [
4676
- "Perspective: ",
4677
- perspective.trim()
4678
- ] })
4679
- ] })
4680
- ] }) }),
4681
- /* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 2, paddingX: 1, wrap: "wrap", children: [
4682
- /* @__PURE__ */ jsx26(Text21, { muted: true, size: 2, children: filteredReports.length === reports.length ? `${reports.length} reports` : `${filteredReports.length} of ${reports.length} reports` }),
4683
- hasActiveFilters && /* @__PURE__ */ jsx26(
4684
- Button,
4685
- {
4686
- fontSize: 1,
4687
- mode: "bleed",
4688
- onClick: handleClearFilters,
4689
- text: "Clear all filters",
4690
- tone: "critical"
4691
- }
4692
- ),
4693
- /* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 1, style: { marginLeft: "auto" }, children: [
4694
- /* @__PURE__ */ jsx26(
4695
- MenuButton,
4696
- {
4697
- button: /* @__PURE__ */ jsx26(
4698
- Button,
4699
- {
4700
- fontSize: 2,
4701
- icon: SortIcon,
4702
- mode: "bleed",
4703
- text: `Sort: ${SORT_LABELS[sort.field]}`
4704
- }
4705
- ),
4706
- id: "sort-menu",
4707
- menu: /* @__PURE__ */ jsxs21(Menu, { children: [
4708
- /* @__PURE__ */ jsx26(
4709
- MenuItem,
4710
- {
4711
- onClick: () => handleSortFieldChange("date"),
4712
- pressed: sort.field === "date",
4713
- text: "Date"
4714
- }
4715
- ),
4716
- /* @__PURE__ */ jsx26(
4717
- MenuItem,
4718
- {
4719
- onClick: () => handleSortFieldChange("score"),
4720
- pressed: sort.field === "score",
4721
- text: "Score"
4722
- }
4723
- ),
4724
- /* @__PURE__ */ jsx26(
4725
- MenuItem,
4726
- {
4727
- onClick: () => handleSortFieldChange("name"),
4728
- pressed: sort.field === "name",
4729
- text: "Name"
4730
- }
4731
- )
4732
- ] }),
4733
- popover: { portal: true }
4734
- }
4735
- ),
4736
- /* @__PURE__ */ jsx26(
4737
- Button,
4738
- {
4739
- fontSize: 2,
4740
- mode: "bleed",
4741
- onClick: toggleSortDirection,
4742
- text: sort.direction === "asc" ? "\u2191" : "\u2193",
4743
- title: sort.direction === "asc" ? "Ascending" : "Descending"
4744
- }
4745
- )
4746
- ] })
4747
- ] }),
4748
- filteredReports.length === 0 ? /* @__PURE__ */ jsx26(Card12, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs21(Stack13, { space: 3, children: [
4749
- /* @__PURE__ */ jsx26(Text21, { align: "center", muted: true, size: 3, children: "No reports match the current filters." }),
4750
- /* @__PURE__ */ jsx26(Flex17, { justify: "center", children: /* @__PURE__ */ jsx26(
4334
+ return /* @__PURE__ */ jsxs13(Stack10, { space: 0, children: [
4335
+ /* @__PURE__ */ jsx16(
4336
+ FilterBar,
4337
+ {
4338
+ filteredCount: filteredReports.length,
4339
+ mode,
4340
+ modes,
4341
+ onModeChange: setMode,
4342
+ onQueryChange: setSearchQuery,
4343
+ onReset: handleReset,
4344
+ onSourceChange: setSource,
4345
+ onTriggerChange: setTrigger,
4346
+ query: searchQuery,
4347
+ source,
4348
+ sources,
4349
+ totalCount: reports.length,
4350
+ trigger,
4351
+ triggers
4352
+ }
4353
+ ),
4354
+ filteredReports.length === 0 ? /* @__PURE__ */ jsx16(Card7, { padding: 4, radius: 2, children: /* @__PURE__ */ jsxs13(Stack10, { space: 3, children: [
4355
+ /* @__PURE__ */ jsx16(Text14, { align: "center", muted: true, size: 3, children: "No reports match the current filters." }),
4356
+ /* @__PURE__ */ jsx16(Flex10, { justify: "center", children: /* @__PURE__ */ jsx16(
4751
4357
  Button,
4752
4358
  {
4753
4359
  fontSize: 2,
4754
4360
  mode: "ghost",
4755
- onClick: handleClearFilters,
4756
- text: "Clear all filters"
4361
+ onClick: handleReset,
4362
+ text: "Clear filters"
4757
4363
  }
4758
4364
  ) })
4759
- ] }) }) : /* @__PURE__ */ jsx26(Stack13, { space: 2, children: filteredReports.map((report) => /* @__PURE__ */ jsx26(
4760
- ReportCard,
4365
+ ] }) }) : /* @__PURE__ */ jsx16(
4366
+ ReportTable,
4761
4367
  {
4762
- data: fromReportListItem(report),
4763
- onSelectReport
4764
- },
4765
- report._id
4766
- )) }),
4767
- hasMore && /* @__PURE__ */ jsx26(Flex17, { justify: "center", paddingY: 3, children: /* @__PURE__ */ jsx26(
4368
+ onSelectReport,
4369
+ onSortChange: handleSortFieldChange,
4370
+ reports: filteredReports,
4371
+ sort
4372
+ }
4373
+ ),
4374
+ hasMore && /* @__PURE__ */ jsx16(Flex10, { justify: "center", paddingY: 3, children: /* @__PURE__ */ jsx16(
4768
4375
  Button,
4769
4376
  {
4770
4377
  disabled: loadingMore,
@@ -4776,79 +4383,46 @@ function LatestReports({
4776
4383
  ) })
4777
4384
  ] });
4778
4385
  }
4779
- function formatDate(iso) {
4780
- return new Date(iso).toLocaleDateString("en-US", {
4781
- day: "numeric",
4782
- hour: "2-digit",
4783
- minute: "2-digit",
4784
- month: "short",
4785
- year: "numeric"
4786
- });
4787
- }
4788
- function getDateThreshold(preset) {
4789
- const now = /* @__PURE__ */ new Date();
4790
- switch (preset) {
4791
- case "7d":
4792
- return new Date(now.getTime() - 7 * 864e5);
4793
- case "30d":
4794
- return new Date(now.getTime() - 30 * 864e5);
4795
- case "90d":
4796
- return new Date(now.getTime() - 90 * 864e5);
4797
- case "today": {
4798
- const start = new Date(now);
4799
- start.setHours(0, 0, 0, 0);
4800
- return start;
4801
- }
4802
- case "yesterday": {
4803
- const start = new Date(now);
4804
- start.setDate(start.getDate() - 1);
4805
- start.setHours(0, 0, 0, 0);
4806
- return start;
4807
- }
4808
- default:
4809
- return null;
4810
- }
4811
- }
4812
4386
 
4813
4387
  // src/components/report-detail/ReportDetail.tsx
4814
4388
  import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
4815
4389
  import {
4816
- Box as Box15,
4390
+ Box as Box14,
4817
4391
  Button as Button5,
4818
- Stack as Stack25,
4392
+ Stack as Stack22,
4819
4393
  Tab,
4820
4394
  TabList,
4821
4395
  TabPanel,
4822
- Text as Text34,
4396
+ Text as Text27,
4823
4397
  Tooltip as Tooltip8
4824
4398
  } from "@sanity/ui";
4825
4399
  import {
4826
- useCallback as useCallback20,
4827
- useEffect as useEffect9,
4828
- useMemo as useMemo7,
4829
- useState as useState15
4400
+ useCallback as useCallback18,
4401
+ useEffect as useEffect7,
4402
+ useMemo as useMemo6,
4403
+ useState as useState13
4830
4404
  } from "react";
4831
- import { useClient as useClient12 } from "sanity";
4405
+ import { useClient as useClient10 } from "sanity";
4832
4406
 
4833
4407
  // src/components/report-detail/AgentActivitySection.tsx
4834
- import { useMemo as useMemo6, useState as useState8 } from "react";
4835
- import { HelpCircleIcon as HelpCircleIcon5, SearchIcon as SearchIcon5 } from "@sanity/icons";
4408
+ import { useMemo as useMemo5, useState as useState6 } from "react";
4409
+ import { HelpCircleIcon as HelpCircleIcon5, SearchIcon as SearchIcon3 } from "@sanity/icons";
4836
4410
  import {
4837
- Badge as Badge16,
4838
- Box as Box10,
4839
- Card as Card14,
4840
- Flex as Flex18,
4411
+ Badge as Badge5,
4412
+ Box as Box9,
4413
+ Card as Card9,
4414
+ Flex as Flex11,
4841
4415
  Grid as Grid2,
4842
- Stack as Stack15,
4843
- Text as Text23,
4844
- TextInput,
4416
+ Stack as Stack12,
4417
+ Text as Text16,
4418
+ TextInput as TextInput2,
4845
4419
  Tooltip as Tooltip4
4846
4420
  } from "@sanity/ui";
4847
4421
 
4848
4422
  // src/components/primitives/StatCard.tsx
4849
4423
  import { HelpCircleIcon as HelpCircleIcon4 } from "@sanity/icons";
4850
- import { Box as Box9, Card as Card13, Stack as Stack14, Text as Text22, Tooltip as Tooltip3 } from "@sanity/ui";
4851
- import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
4424
+ import { Box as Box8, Card as Card8, Stack as Stack11, Text as Text15, Tooltip as Tooltip3 } from "@sanity/ui";
4425
+ import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
4852
4426
  function StatCard({
4853
4427
  label,
4854
4428
  value,
@@ -4856,24 +4430,24 @@ function StatCard({
4856
4430
  suffix,
4857
4431
  tone = "default"
4858
4432
  }) {
4859
- return /* @__PURE__ */ jsx27(Card13, { padding: 3, radius: 2, shadow: 1, tone, children: /* @__PURE__ */ jsxs22(Stack14, { space: 2, children: [
4860
- /* @__PURE__ */ jsxs22(Text22, { muted: true, size: 2, children: [
4433
+ return /* @__PURE__ */ jsx17(Card8, { padding: 3, radius: 2, shadow: 1, tone, children: /* @__PURE__ */ jsxs14(Stack11, { space: 2, children: [
4434
+ /* @__PURE__ */ jsxs14(Text15, { muted: true, size: 2, children: [
4861
4435
  label,
4862
- tooltip && /* @__PURE__ */ jsxs22(Fragment4, { children: [
4436
+ tooltip && /* @__PURE__ */ jsxs14(Fragment5, { children: [
4863
4437
  " ",
4864
- /* @__PURE__ */ jsx27(
4438
+ /* @__PURE__ */ jsx17(
4865
4439
  Tooltip3,
4866
4440
  {
4867
- content: /* @__PURE__ */ jsx27(Box9, { padding: 2, children: /* @__PURE__ */ jsx27(Text22, { size: 2, children: tooltip }) }),
4441
+ content: /* @__PURE__ */ jsx17(Box8, { padding: 2, children: /* @__PURE__ */ jsx17(Text15, { size: 2, children: tooltip }) }),
4868
4442
  portal: true,
4869
- children: /* @__PURE__ */ jsx27("span", { style: { cursor: "help" }, children: /* @__PURE__ */ jsx27(HelpCircleIcon4, {}) })
4443
+ children: /* @__PURE__ */ jsx17("span", { style: { cursor: "help" }, children: /* @__PURE__ */ jsx17(HelpCircleIcon4, {}) })
4870
4444
  }
4871
4445
  )
4872
4446
  ] })
4873
4447
  ] }),
4874
- /* @__PURE__ */ jsxs22(Text22, { size: 4, weight: "bold", children: [
4448
+ /* @__PURE__ */ jsxs14(Text15, { size: 4, weight: "bold", children: [
4875
4449
  value,
4876
- suffix && /* @__PURE__ */ jsxs22("span", { style: { fontSize: "0.6em", fontWeight: 400 }, children: [
4450
+ suffix && /* @__PURE__ */ jsxs14("span", { style: { fontSize: "0.6em", fontWeight: 400 }, children: [
4877
4451
  " ",
4878
4452
  suffix
4879
4453
  ] })
@@ -4882,24 +4456,24 @@ function StatCard({
4882
4456
  }
4883
4457
 
4884
4458
  // src/components/report-detail/AgentActivitySection.tsx
4885
- import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
4459
+ import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
4886
4460
  function AgentActivitySection({
4887
4461
  agentBehavior,
4888
4462
  overall
4889
4463
  }) {
4890
- return /* @__PURE__ */ jsxs23(Stack15, { space: 5, children: [
4891
- overall && /* @__PURE__ */ jsx28(OverviewGrid, { overall }),
4892
- agentBehavior.map((ab) => /* @__PURE__ */ jsx28(FeatureActivityCard, { behavior: ab }, ab.feature))
4464
+ return /* @__PURE__ */ jsxs15(Stack12, { space: 5, children: [
4465
+ overall && /* @__PURE__ */ jsx18(OverviewGrid, { overall }),
4466
+ agentBehavior.map((ab) => /* @__PURE__ */ jsx18(FeatureActivityCard, { behavior: ab }, ab.feature))
4893
4467
  ] });
4894
4468
  }
4895
4469
  function OverviewGrid({ overall }) {
4896
- return /* @__PURE__ */ jsx28(Card14, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs23(Stack15, { space: 4, children: [
4897
- /* @__PURE__ */ jsxs23(Flex18, { align: "center", gap: 3, children: [
4898
- /* @__PURE__ */ jsx28(Text23, { size: 3, weight: "semibold", children: "Agent Activity Overview" }),
4899
- /* @__PURE__ */ jsx28(GlossaryTip, { text: GLOSSARY.agentBehaviorOverview })
4470
+ return /* @__PURE__ */ jsx18(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs15(Stack12, { space: 4, children: [
4471
+ /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, children: [
4472
+ /* @__PURE__ */ jsx18(Text16, { size: 3, weight: "semibold", children: "Agent Activity Overview" }),
4473
+ /* @__PURE__ */ jsx18(GlossaryTip, { text: GLOSSARY.agentBehaviorOverview })
4900
4474
  ] }),
4901
- /* @__PURE__ */ jsxs23(Grid2, { columns: [1, 2, 3], gap: 3, children: [
4902
- /* @__PURE__ */ jsx28(
4475
+ /* @__PURE__ */ jsxs15(Grid2, { columns: [1, 2, 3], gap: 3, children: [
4476
+ /* @__PURE__ */ jsx18(
4903
4477
  StatCard,
4904
4478
  {
4905
4479
  label: "Avg Pages Visited",
@@ -4907,7 +4481,7 @@ function OverviewGrid({ overall }) {
4907
4481
  value: overall.avgDocPagesVisited.toFixed(1)
4908
4482
  }
4909
4483
  ),
4910
- /* @__PURE__ */ jsx28(
4484
+ /* @__PURE__ */ jsx18(
4911
4485
  StatCard,
4912
4486
  {
4913
4487
  label: "Avg Searches",
@@ -4915,7 +4489,7 @@ function OverviewGrid({ overall }) {
4915
4489
  value: overall.avgSearchesPerformed.toFixed(1)
4916
4490
  }
4917
4491
  ),
4918
- /* @__PURE__ */ jsx28(
4492
+ /* @__PURE__ */ jsx18(
4919
4493
  StatCard,
4920
4494
  {
4921
4495
  label: "Avg Network Time",
@@ -4923,7 +4497,7 @@ function OverviewGrid({ overall }) {
4923
4497
  value: formatDuration(overall.avgNetworkTimeMs)
4924
4498
  }
4925
4499
  ),
4926
- /* @__PURE__ */ jsx28(
4500
+ /* @__PURE__ */ jsx18(
4927
4501
  StatCard,
4928
4502
  {
4929
4503
  label: "Unique Doc Slugs",
@@ -4931,7 +4505,7 @@ function OverviewGrid({ overall }) {
4931
4505
  value: String(overall.totalUniqueDocSlugs)
4932
4506
  }
4933
4507
  ),
4934
- /* @__PURE__ */ jsx28(
4508
+ /* @__PURE__ */ jsx18(
4935
4509
  StatCard,
4936
4510
  {
4937
4511
  label: "Unique Search Queries",
@@ -4939,7 +4513,7 @@ function OverviewGrid({ overall }) {
4939
4513
  value: String(overall.totalUniqueSearchQueries)
4940
4514
  }
4941
4515
  ),
4942
- /* @__PURE__ */ jsx28(
4516
+ /* @__PURE__ */ jsx18(
4943
4517
  StatCard,
4944
4518
  {
4945
4519
  label: "Tests with Data",
@@ -4952,31 +4526,31 @@ function OverviewGrid({ overall }) {
4952
4526
  function FeatureActivityCard({
4953
4527
  behavior
4954
4528
  }) {
4955
- return /* @__PURE__ */ jsx28(Card14, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs23(Stack15, { space: 4, children: [
4956
- /* @__PURE__ */ jsxs23(Flex18, { align: "center", gap: 3, wrap: "wrap", children: [
4957
- /* @__PURE__ */ jsx28(Text23, { size: 3, weight: "semibold", children: behavior.feature }),
4958
- /* @__PURE__ */ jsxs23(Badge16, { tone: "primary", children: [
4529
+ return /* @__PURE__ */ jsx18(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs15(Stack12, { space: 4, children: [
4530
+ /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
4531
+ /* @__PURE__ */ jsx18(Text16, { size: 3, weight: "semibold", children: behavior.feature }),
4532
+ /* @__PURE__ */ jsxs15(Badge5, { tone: "primary", children: [
4959
4533
  behavior.tasksWithBehaviorData,
4960
4534
  " test",
4961
4535
  behavior.tasksWithBehaviorData === 1 ? "" : "s"
4962
4536
  ] })
4963
4537
  ] }),
4964
- /* @__PURE__ */ jsxs23(Grid2, { columns: [1, 3], gap: 3, children: [
4965
- /* @__PURE__ */ jsx28(
4538
+ /* @__PURE__ */ jsxs15(Grid2, { columns: [1, 3], gap: 3, children: [
4539
+ /* @__PURE__ */ jsx18(
4966
4540
  MiniStat,
4967
4541
  {
4968
4542
  label: "Avg pages visited",
4969
4543
  value: behavior.avgDocPagesVisited.toFixed(1)
4970
4544
  }
4971
4545
  ),
4972
- /* @__PURE__ */ jsx28(
4546
+ /* @__PURE__ */ jsx18(
4973
4547
  MiniStat,
4974
4548
  {
4975
4549
  label: "Avg searches",
4976
4550
  value: behavior.avgSearchesPerformed.toFixed(1)
4977
4551
  }
4978
4552
  ),
4979
- /* @__PURE__ */ jsx28(
4553
+ /* @__PURE__ */ jsx18(
4980
4554
  MiniStat,
4981
4555
  {
4982
4556
  label: "Avg network time",
@@ -4984,8 +4558,8 @@ function FeatureActivityCard({
4984
4558
  }
4985
4559
  )
4986
4560
  ] }),
4987
- behavior.searchQueries.length > 0 && /* @__PURE__ */ jsx28(SearchQueryList, { queries: behavior.searchQueries }),
4988
- behavior.docSlugsVisited.length > 0 && /* @__PURE__ */ jsx28(
4561
+ behavior.searchQueries.length > 0 && /* @__PURE__ */ jsx18(SearchQueryList, { queries: behavior.searchQueries }),
4562
+ behavior.docSlugsVisited.length > 0 && /* @__PURE__ */ jsx18(
4989
4563
  BadgeList,
4990
4564
  {
4991
4565
  items: behavior.docSlugsVisited,
@@ -4994,7 +4568,7 @@ function FeatureActivityCard({
4994
4568
  tooltip: GLOSSARY.docSlugsVisited
4995
4569
  }
4996
4570
  ),
4997
- behavior.externalDomains.length > 0 && /* @__PURE__ */ jsx28(
4571
+ behavior.externalDomains.length > 0 && /* @__PURE__ */ jsx18(
4998
4572
  BadgeList,
4999
4573
  {
5000
4574
  items: behavior.externalDomains,
@@ -5006,40 +4580,40 @@ function FeatureActivityCard({
5006
4580
  ] }) });
5007
4581
  }
5008
4582
  function SearchQueryList({ queries }) {
5009
- const [filter, setFilter] = useState8("");
5010
- const filtered = useMemo6(() => {
4583
+ const [filter, setFilter] = useState6("");
4584
+ const filtered = useMemo5(() => {
5011
4585
  if (!filter) return queries;
5012
4586
  const lower = filter.toLowerCase();
5013
4587
  return queries.filter((q) => q.toLowerCase().includes(lower));
5014
4588
  }, [queries, filter]);
5015
- return /* @__PURE__ */ jsxs23(Stack15, { space: 3, children: [
5016
- /* @__PURE__ */ jsxs23(Flex18, { align: "center", gap: 3, wrap: "wrap", children: [
5017
- /* @__PURE__ */ jsx28(Text23, { size: 2, weight: "semibold", children: "Search Queries" }),
5018
- /* @__PURE__ */ jsx28(GlossaryTip, { text: GLOSSARY.searchQueries }),
5019
- /* @__PURE__ */ jsx28(Badge16, { tone: "default", children: queries.length })
4589
+ return /* @__PURE__ */ jsxs15(Stack12, { space: 3, children: [
4590
+ /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
4591
+ /* @__PURE__ */ jsx18(Text16, { size: 2, weight: "semibold", children: "Search Queries" }),
4592
+ /* @__PURE__ */ jsx18(GlossaryTip, { text: GLOSSARY.searchQueries }),
4593
+ /* @__PURE__ */ jsx18(Badge5, { tone: "default", children: queries.length })
5020
4594
  ] }),
5021
- queries.length > 5 && /* @__PURE__ */ jsx28(
5022
- TextInput,
4595
+ queries.length > 5 && /* @__PURE__ */ jsx18(
4596
+ TextInput2,
5023
4597
  {
5024
4598
  fontSize: 2,
5025
- icon: SearchIcon5,
4599
+ icon: SearchIcon3,
5026
4600
  onChange: (e) => setFilter(e.target.value),
5027
4601
  placeholder: "Filter queries\u2026",
5028
4602
  value: filter
5029
4603
  }
5030
4604
  ),
5031
- /* @__PURE__ */ jsx28(
5032
- Card14,
4605
+ /* @__PURE__ */ jsx18(
4606
+ Card9,
5033
4607
  {
5034
4608
  overflow: "auto",
5035
4609
  padding: 3,
5036
4610
  radius: 2,
5037
4611
  style: { maxHeight: 300 },
5038
4612
  tone: "transparent",
5039
- children: /* @__PURE__ */ jsxs23(Stack15, { space: 2, children: [
5040
- filtered.length === 0 && /* @__PURE__ */ jsx28(Text23, { muted: true, size: 2, children: "No matching queries" }),
5041
- filtered.map((query, i) => /* @__PURE__ */ jsx28(
5042
- Text23,
4613
+ children: /* @__PURE__ */ jsxs15(Stack12, { space: 2, children: [
4614
+ filtered.length === 0 && /* @__PURE__ */ jsx18(Text16, { muted: true, size: 2, children: "No matching queries" }),
4615
+ filtered.map((query, i) => /* @__PURE__ */ jsx18(
4616
+ Text16,
5043
4617
  {
5044
4618
  muted: true,
5045
4619
  size: 2,
@@ -5063,19 +4637,19 @@ function BadgeList({
5063
4637
  tone,
5064
4638
  tooltip
5065
4639
  }) {
5066
- return /* @__PURE__ */ jsxs23(Stack15, { space: 3, children: [
5067
- /* @__PURE__ */ jsxs23(Flex18, { align: "center", gap: 3, wrap: "wrap", children: [
5068
- /* @__PURE__ */ jsx28(Text23, { size: 2, weight: "semibold", children: label }),
5069
- tooltip && /* @__PURE__ */ jsx28(GlossaryTip, { text: tooltip }),
5070
- /* @__PURE__ */ jsx28(Badge16, { tone: "default", children: items.length })
4640
+ return /* @__PURE__ */ jsxs15(Stack12, { space: 3, children: [
4641
+ /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
4642
+ /* @__PURE__ */ jsx18(Text16, { size: 2, weight: "semibold", children: label }),
4643
+ tooltip && /* @__PURE__ */ jsx18(GlossaryTip, { text: tooltip }),
4644
+ /* @__PURE__ */ jsx18(Badge5, { tone: "default", children: items.length })
5071
4645
  ] }),
5072
- /* @__PURE__ */ jsx28(Flex18, { gap: 2, wrap: "wrap", children: items.map((item) => /* @__PURE__ */ jsx28(Badge16, { mode: "outline", tone, children: item }, item)) })
4646
+ /* @__PURE__ */ jsx18(Flex11, { gap: 2, wrap: "wrap", children: items.map((item) => /* @__PURE__ */ jsx18(Badge5, { mode: "outline", tone, children: item }, item)) })
5073
4647
  ] });
5074
4648
  }
5075
4649
  function MiniStat({ label, value }) {
5076
- return /* @__PURE__ */ jsxs23(Stack15, { space: 1, children: [
5077
- /* @__PURE__ */ jsx28(
5078
- Text23,
4650
+ return /* @__PURE__ */ jsxs15(Stack12, { space: 1, children: [
4651
+ /* @__PURE__ */ jsx18(
4652
+ Text16,
5079
4653
  {
5080
4654
  muted: true,
5081
4655
  size: 1,
@@ -5084,32 +4658,61 @@ function MiniStat({ label, value }) {
5084
4658
  children: label
5085
4659
  }
5086
4660
  ),
5087
- /* @__PURE__ */ jsx28(Text23, { size: 3, weight: "bold", children: value })
4661
+ /* @__PURE__ */ jsx18(Text16, { size: 3, weight: "bold", children: value })
5088
4662
  ] });
5089
4663
  }
5090
4664
  function GlossaryTip({ text }) {
5091
- return /* @__PURE__ */ jsx28(
4665
+ return /* @__PURE__ */ jsx18(
5092
4666
  Tooltip4,
5093
4667
  {
5094
- content: /* @__PURE__ */ jsx28(Box10, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx28(Text23, { size: 2, children: text }) }),
4668
+ content: /* @__PURE__ */ jsx18(Box9, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx18(Text16, { size: 2, children: text }) }),
5095
4669
  placement: "bottom",
5096
4670
  portal: true,
5097
- children: /* @__PURE__ */ jsx28(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx28(HelpCircleIcon5, {}) })
4671
+ children: /* @__PURE__ */ jsx18(Text16, { muted: true, size: 1, children: /* @__PURE__ */ jsx18(HelpCircleIcon5, {}) })
5098
4672
  }
5099
4673
  );
5100
4674
  }
5101
4675
 
5102
4676
  // src/components/report-detail/AreaScoreTable.tsx
5103
4677
  import React2 from "react";
5104
- import { Card as Card16, Stack as Stack16, Text as Text25 } from "@sanity/ui";
4678
+ import { Card as Card11, Stack as Stack13, Text as Text18 } from "@sanity/ui";
4679
+
4680
+ // src/lib/scoring.ts
4681
+ var TONE_MAP = {
4682
+ good: "positive",
4683
+ warning: "caution",
4684
+ "needs-work": "default",
4685
+ critical: "critical"
4686
+ };
4687
+ function gradeTone(grade) {
4688
+ return TONE_MAP[grade];
4689
+ }
4690
+ function scoreTone(score) {
4691
+ return gradeTone(scoreGrade(Math.round(score)));
4692
+ }
4693
+ var HEX_MAP = {
4694
+ good: "#2ecc71",
4695
+ warning: "#f1c40f",
4696
+ "needs-work": "#e67e22",
4697
+ critical: "#e74c3c"
4698
+ };
4699
+ function gradeHex(grade) {
4700
+ return HEX_MAP[grade];
4701
+ }
4702
+ function scoreHex(score) {
4703
+ return gradeHex(scoreGrade(Math.round(score)));
4704
+ }
4705
+ function rowBackground(index) {
4706
+ return index % 2 === 1 ? "var(--card-muted-bg-color)" : void 0;
4707
+ }
5105
4708
 
5106
4709
  // src/components/primitives/ScoreCell.tsx
5107
- import { Card as Card15, Text as Text24 } from "@sanity/ui";
5108
- import { jsx as jsx29 } from "react/jsx-runtime";
4710
+ import { Card as Card10, Text as Text17 } from "@sanity/ui";
4711
+ import { jsx as jsx19 } from "react/jsx-runtime";
5109
4712
  function ScoreCell({ score, size = 2 }) {
5110
4713
  const rounded = Math.round(score);
5111
- return /* @__PURE__ */ jsx29(
5112
- Card15,
4714
+ return /* @__PURE__ */ jsx19(
4715
+ Card10,
5113
4716
  {
5114
4717
  padding: 1,
5115
4718
  radius: 2,
@@ -5120,17 +4723,17 @@ function ScoreCell({ score, size = 2 }) {
5120
4723
  justifyContent: "center"
5121
4724
  },
5122
4725
  tone: scoreTone(rounded),
5123
- children: /* @__PURE__ */ jsx29(Text24, { align: "center", size, weight: "medium", children: rounded })
4726
+ children: /* @__PURE__ */ jsx19(Text17, { align: "center", size, weight: "medium", children: rounded })
5124
4727
  }
5125
4728
  );
5126
4729
  }
5127
4730
 
5128
4731
  // src/components/report-detail/AreaScoreTable.tsx
5129
- import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
4732
+ import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
5130
4733
  function AreaScoreTable({ scores }) {
5131
- return /* @__PURE__ */ jsx30(Card16, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs24(Stack16, { space: 4, children: [
5132
- /* @__PURE__ */ jsx30(Text25, { size: 3, weight: "semibold", children: "Per-Area Scores" }),
5133
- /* @__PURE__ */ jsxs24(
4734
+ return /* @__PURE__ */ jsx20(Card11, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs16(Stack13, { space: 4, children: [
4735
+ /* @__PURE__ */ jsx20(Text18, { size: 3, weight: "semibold", children: "Per-Area Scores" }),
4736
+ /* @__PURE__ */ jsxs16(
5134
4737
  "div",
5135
4738
  {
5136
4739
  style: {
@@ -5139,9 +4742,9 @@ function AreaScoreTable({ scores }) {
5139
4742
  gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr 1fr"
5140
4743
  },
5141
4744
  children: [
5142
- /* @__PURE__ */ jsx30(ColumnHeader, { borderBottom: true, label: "Area" }),
5143
- /* @__PURE__ */ jsx30(ColumnHeader, { borderBottom: true, label: "Score", tooltip: GLOSSARY.score }),
5144
- /* @__PURE__ */ jsx30(
4745
+ /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Area" }),
4746
+ /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Score", tooltip: GLOSSARY.score }),
4747
+ /* @__PURE__ */ jsx20(
5145
4748
  ColumnHeader,
5146
4749
  {
5147
4750
  borderBottom: true,
@@ -5149,7 +4752,7 @@ function AreaScoreTable({ scores }) {
5149
4752
  tooltip: GLOSSARY.taskCompletion
5150
4753
  }
5151
4754
  ),
5152
- /* @__PURE__ */ jsx30(
4755
+ /* @__PURE__ */ jsx20(
5153
4756
  ColumnHeader,
5154
4757
  {
5155
4758
  borderBottom: true,
@@ -5157,7 +4760,7 @@ function AreaScoreTable({ scores }) {
5157
4760
  tooltip: GLOSSARY.codeCorrectness
5158
4761
  }
5159
4762
  ),
5160
- /* @__PURE__ */ jsx30(
4763
+ /* @__PURE__ */ jsx20(
5161
4764
  ColumnHeader,
5162
4765
  {
5163
4766
  borderBottom: true,
@@ -5165,10 +4768,10 @@ function AreaScoreTable({ scores }) {
5165
4768
  tooltip: GLOSSARY.docCoverage
5166
4769
  }
5167
4770
  ),
5168
- /* @__PURE__ */ jsx30(ColumnHeader, { borderBottom: true, label: "Lift", tooltip: GLOSSARY.docLift }),
5169
- /* @__PURE__ */ jsx30(ColumnHeader, { borderBottom: true, label: "Tests", tooltip: GLOSSARY.tests }),
5170
- scores.map((score, i) => /* @__PURE__ */ jsxs24(React2.Fragment, { children: [
5171
- /* @__PURE__ */ jsx30(
4771
+ /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Lift", tooltip: GLOSSARY.docLift }),
4772
+ /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Tests", tooltip: GLOSSARY.tests }),
4773
+ scores.map((score, i) => /* @__PURE__ */ jsxs16(React2.Fragment, { children: [
4774
+ /* @__PURE__ */ jsx20(
5172
4775
  "div",
5173
4776
  {
5174
4777
  style: {
@@ -5176,10 +4779,10 @@ function AreaScoreTable({ scores }) {
5176
4779
  borderRadius: 4,
5177
4780
  padding: "8px 0 8px 4px"
5178
4781
  },
5179
- children: /* @__PURE__ */ jsx30(Text25, { size: 2, weight: "medium", children: score.feature })
4782
+ children: /* @__PURE__ */ jsx20(Text18, { size: 2, weight: "medium", children: score.feature })
5180
4783
  }
5181
4784
  ),
5182
- /* @__PURE__ */ jsx30(
4785
+ /* @__PURE__ */ jsx20(
5183
4786
  "div",
5184
4787
  {
5185
4788
  style: {
@@ -5187,10 +4790,10 @@ function AreaScoreTable({ scores }) {
5187
4790
  display: "flex",
5188
4791
  padding: "2px 0"
5189
4792
  },
5190
- children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.totalScore })
4793
+ children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.totalScore })
5191
4794
  }
5192
4795
  ),
5193
- /* @__PURE__ */ jsx30(
4796
+ /* @__PURE__ */ jsx20(
5194
4797
  "div",
5195
4798
  {
5196
4799
  style: {
@@ -5198,10 +4801,10 @@ function AreaScoreTable({ scores }) {
5198
4801
  display: "flex",
5199
4802
  padding: "2px 0"
5200
4803
  },
5201
- children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.taskCompletion })
4804
+ children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.taskCompletion })
5202
4805
  }
5203
4806
  ),
5204
- /* @__PURE__ */ jsx30(
4807
+ /* @__PURE__ */ jsx20(
5205
4808
  "div",
5206
4809
  {
5207
4810
  style: {
@@ -5209,10 +4812,10 @@ function AreaScoreTable({ scores }) {
5209
4812
  display: "flex",
5210
4813
  padding: "2px 0"
5211
4814
  },
5212
- children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.codeCorrectness })
4815
+ children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.codeCorrectness })
5213
4816
  }
5214
4817
  ),
5215
- /* @__PURE__ */ jsx30(
4818
+ /* @__PURE__ */ jsx20(
5216
4819
  "div",
5217
4820
  {
5218
4821
  style: {
@@ -5220,10 +4823,10 @@ function AreaScoreTable({ scores }) {
5220
4823
  display: "flex",
5221
4824
  padding: "2px 0"
5222
4825
  },
5223
- children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.docCoverage })
4826
+ children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.docCoverage })
5224
4827
  }
5225
4828
  ),
5226
- /* @__PURE__ */ jsx30(
4829
+ /* @__PURE__ */ jsx20(
5227
4830
  "div",
5228
4831
  {
5229
4832
  style: {
@@ -5231,10 +4834,10 @@ function AreaScoreTable({ scores }) {
5231
4834
  background: rowBackground(i),
5232
4835
  display: "flex"
5233
4836
  },
5234
- children: /* @__PURE__ */ jsx30(Text25, { size: 2, children: formatDelta(score.docLift) })
4837
+ children: /* @__PURE__ */ jsx20(Text18, { size: 2, children: formatDelta(score.docLift) })
5235
4838
  }
5236
4839
  ),
5237
- /* @__PURE__ */ jsx30(
4840
+ /* @__PURE__ */ jsx20(
5238
4841
  "div",
5239
4842
  {
5240
4843
  style: {
@@ -5242,7 +4845,7 @@ function AreaScoreTable({ scores }) {
5242
4845
  background: rowBackground(i),
5243
4846
  display: "flex"
5244
4847
  },
5245
- children: /* @__PURE__ */ jsx30(Text25, { muted: true, size: 2, children: score.testCount })
4848
+ children: /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: score.testCount })
5246
4849
  }
5247
4850
  )
5248
4851
  ] }, score.feature))
@@ -5253,13 +4856,13 @@ function AreaScoreTable({ scores }) {
5253
4856
  }
5254
4857
 
5255
4858
  // src/components/report-detail/ComparisonSummary.tsx
5256
- import { Badge as Badge17, Box as Box11, Card as Card17, Flex as Flex19, Grid as Grid3, Stack as Stack17, Text as Text26, Tooltip as Tooltip5 } from "@sanity/ui";
5257
- import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
4859
+ import { Badge as Badge6, Box as Box10, Card as Card12, Flex as Flex12, Grid as Grid3, Stack as Stack14, Text as Text19, Tooltip as Tooltip5 } from "@sanity/ui";
4860
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
5258
4861
  function ComparisonSummary({ comparison }) {
5259
- return /* @__PURE__ */ jsx31(Card17, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs25(Stack17, { space: 4, children: [
5260
- /* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 3, wrap: "wrap", children: [
5261
- /* @__PURE__ */ jsx31(Text26, { size: 3, weight: "semibold", children: "Comparison" }),
5262
- /* @__PURE__ */ jsx31(
4862
+ return /* @__PURE__ */ jsx21(Card12, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs17(Stack14, { space: 4, children: [
4863
+ /* @__PURE__ */ jsxs17(Flex12, { align: "center", gap: 3, wrap: "wrap", children: [
4864
+ /* @__PURE__ */ jsx21(Text19, { size: 3, weight: "semibold", children: "Comparison" }),
4865
+ /* @__PURE__ */ jsx21(
5263
4866
  DeltaCard,
5264
4867
  {
5265
4868
  delta: comparison.deltas.overall,
@@ -5267,7 +4870,7 @@ function ComparisonSummary({ comparison }) {
5267
4870
  tooltip: GLOSSARY.overallDelta
5268
4871
  }
5269
4872
  ),
5270
- comparison.deltas.actualDelta != null && /* @__PURE__ */ jsx31(
4873
+ comparison.deltas.actualDelta != null && /* @__PURE__ */ jsx21(
5271
4874
  DeltaCard,
5272
4875
  {
5273
4876
  delta: comparison.deltas.actualDelta,
@@ -5275,7 +4878,7 @@ function ComparisonSummary({ comparison }) {
5275
4878
  tooltip: GLOSSARY.actualDelta
5276
4879
  }
5277
4880
  ),
5278
- comparison.deltas.retrievalGapDelta != null && /* @__PURE__ */ jsx31(
4881
+ comparison.deltas.retrievalGapDelta != null && /* @__PURE__ */ jsx21(
5279
4882
  DeltaCard,
5280
4883
  {
5281
4884
  delta: comparison.deltas.retrievalGapDelta,
@@ -5285,8 +4888,8 @@ function ComparisonSummary({ comparison }) {
5285
4888
  }
5286
4889
  )
5287
4890
  ] }),
5288
- /* @__PURE__ */ jsxs25(Grid3, { columns: [1, 1, 3], gap: 3, children: [
5289
- comparison.improved.length > 0 && /* @__PURE__ */ jsx31(
4891
+ /* @__PURE__ */ jsxs17(Grid3, { columns: [1, 1, 3], gap: 3, children: [
4892
+ comparison.improved.length > 0 && /* @__PURE__ */ jsx21(
5290
4893
  AreaBadgeGroup,
5291
4894
  {
5292
4895
  areas: comparison.improved,
@@ -5294,7 +4897,7 @@ function ComparisonSummary({ comparison }) {
5294
4897
  tone: "positive"
5295
4898
  }
5296
4899
  ),
5297
- comparison.regressed.length > 0 && /* @__PURE__ */ jsx31(
4900
+ comparison.regressed.length > 0 && /* @__PURE__ */ jsx21(
5298
4901
  AreaBadgeGroup,
5299
4902
  {
5300
4903
  areas: comparison.regressed,
@@ -5302,7 +4905,7 @@ function ComparisonSummary({ comparison }) {
5302
4905
  tone: "critical"
5303
4906
  }
5304
4907
  ),
5305
- comparison.unchanged.length > 0 && /* @__PURE__ */ jsx31(
4908
+ comparison.unchanged.length > 0 && /* @__PURE__ */ jsx21(
5306
4909
  AreaBadgeGroup,
5307
4910
  {
5308
4911
  areas: comparison.unchanged,
@@ -5321,19 +4924,19 @@ function DeltaCard({
5321
4924
  }) {
5322
4925
  const isPositive = invertedPolarity ? delta < 0 : delta > 0;
5323
4926
  const isNegative = invertedPolarity ? delta > 0 : delta < 0;
5324
- return /* @__PURE__ */ jsx31(
4927
+ return /* @__PURE__ */ jsx21(
5325
4928
  Tooltip5,
5326
4929
  {
5327
- content: /* @__PURE__ */ jsx31(Box11, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx31(Text26, { size: 2, children: tooltip }) }),
4930
+ content: /* @__PURE__ */ jsx21(Box10, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx21(Text19, { size: 2, children: tooltip }) }),
5328
4931
  placement: "bottom",
5329
4932
  portal: true,
5330
- children: /* @__PURE__ */ jsx31(
5331
- Card17,
4933
+ children: /* @__PURE__ */ jsx21(
4934
+ Card12,
5332
4935
  {
5333
4936
  padding: 2,
5334
4937
  radius: 2,
5335
4938
  tone: isPositive ? "positive" : isNegative ? "critical" : "default",
5336
- children: /* @__PURE__ */ jsxs25(Text26, { size: 2, weight: "bold", children: [
4939
+ children: /* @__PURE__ */ jsxs17(Text19, { size: 2, weight: "bold", children: [
5337
4940
  formatDelta(delta),
5338
4941
  " ",
5339
4942
  label
@@ -5348,9 +4951,9 @@ function AreaBadgeGroup({
5348
4951
  label,
5349
4952
  tone
5350
4953
  }) {
5351
- return /* @__PURE__ */ jsxs25(Stack17, { space: 2, children: [
5352
- /* @__PURE__ */ jsx31(
5353
- Text26,
4954
+ return /* @__PURE__ */ jsxs17(Stack14, { space: 2, children: [
4955
+ /* @__PURE__ */ jsx21(
4956
+ Text19,
5354
4957
  {
5355
4958
  muted: true,
5356
4959
  size: 1,
@@ -5359,17 +4962,17 @@ function AreaBadgeGroup({
5359
4962
  children: label
5360
4963
  }
5361
4964
  ),
5362
- /* @__PURE__ */ jsx31(Flex19, { gap: 1, wrap: "wrap", children: areas.map((a) => /* @__PURE__ */ jsx31(Badge17, { tone, children: a }, a)) })
4965
+ /* @__PURE__ */ jsx21(Flex12, { gap: 1, wrap: "wrap", children: areas.map((a) => /* @__PURE__ */ jsx21(Badge6, { tone, children: a }, a)) })
5363
4966
  ] });
5364
4967
  }
5365
4968
 
5366
4969
  // src/components/report-detail/LineageCard.tsx
5367
4970
  import { LinkIcon as LinkIcon2 } from "@sanity/icons";
5368
- import { Badge as Badge18, Card as Card18, Flex as Flex20, Stack as Stack18, Text as Text27 } from "@sanity/ui";
5369
- import { useCallback as useCallback13, useEffect as useEffect8, useState as useState9 } from "react";
5370
- import { useClient as useClient7 } from "sanity";
5371
- import { useRouter } from "sanity/router";
5372
- import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
4971
+ import { Badge as Badge7, Card as Card13, Flex as Flex13, Stack as Stack15, Text as Text20 } from "@sanity/ui";
4972
+ import { useCallback as useCallback11, useEffect as useEffect6, useState as useState7 } from "react";
4973
+ import { useClient as useClient5 } from "sanity";
4974
+ import { useRouter as useRouter2 } from "sanity/router";
4975
+ import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
5373
4976
  var REPORT_TYPE2 = "ailf.report";
5374
4977
  var SPAWNED_REPORTS_QUERY = (
5375
4978
  /* groq */
@@ -5383,10 +4986,10 @@ var SPAWNED_REPORTS_QUERY = (
5383
4986
  );
5384
4987
  function LineageCard({ provenance, reportId }) {
5385
4988
  const { lineage } = provenance;
5386
- const router = useRouter();
5387
- const client = useClient7({ apiVersion: API_VERSION });
5388
- const [spawned, setSpawned] = useState9([]);
5389
- useEffect8(() => {
4989
+ const router = useRouter2();
4990
+ const client = useClient5({ apiVersion: API_VERSION });
4991
+ const [spawned, setSpawned] = useState7([]);
4992
+ useEffect6(() => {
5390
4993
  let cancelled = false;
5391
4994
  client.fetch(SPAWNED_REPORTS_QUERY, {
5392
4995
  reportId,
@@ -5401,12 +5004,12 @@ function LineageCard({ provenance, reportId }) {
5401
5004
  }, [client, reportId]);
5402
5005
  const hasLineage = lineage?.rerunOf || lineage?.comparedAgainst;
5403
5006
  if (!hasLineage && spawned.length === 0) return null;
5404
- return /* @__PURE__ */ jsx32(Card18, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs26(Stack18, { space: 4, children: [
5405
- /* @__PURE__ */ jsx32(Flex20, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs26(Text27, { size: 3, weight: "semibold", children: [
5406
- /* @__PURE__ */ jsx32(LinkIcon2, {}),
5007
+ return /* @__PURE__ */ jsx22(Card13, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs18(Stack15, { space: 4, children: [
5008
+ /* @__PURE__ */ jsx22(Flex13, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs18(Text20, { size: 3, weight: "semibold", children: [
5009
+ /* @__PURE__ */ jsx22(LinkIcon2, {}),
5407
5010
  " Lineage"
5408
5011
  ] }) }),
5409
- lineage?.rerunOf && /* @__PURE__ */ jsx32(
5012
+ lineage?.rerunOf && /* @__PURE__ */ jsx22(
5410
5013
  LineageLink,
5411
5014
  {
5412
5015
  label: "Re-run of",
@@ -5414,7 +5017,7 @@ function LineageCard({ provenance, reportId }) {
5414
5017
  router
5415
5018
  }
5416
5019
  ),
5417
- lineage?.comparedAgainst && /* @__PURE__ */ jsx32(
5020
+ lineage?.comparedAgainst && /* @__PURE__ */ jsx22(
5418
5021
  LineageLink,
5419
5022
  {
5420
5023
  label: "Compared against",
@@ -5422,9 +5025,9 @@ function LineageCard({ provenance, reportId }) {
5422
5025
  router
5423
5026
  }
5424
5027
  ),
5425
- spawned.length > 0 && /* @__PURE__ */ jsxs26(Stack18, { space: 2, children: [
5426
- /* @__PURE__ */ jsx32(Text27, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
5427
- spawned.map((s) => /* @__PURE__ */ jsx32(SpawnedReportRow, { report: s, router }, s.reportId))
5028
+ spawned.length > 0 && /* @__PURE__ */ jsxs18(Stack15, { space: 2, children: [
5029
+ /* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
5030
+ spawned.map((s) => /* @__PURE__ */ jsx22(SpawnedReportRow, { report: s, router }, s.reportId))
5428
5031
  ] })
5429
5032
  ] }) });
5430
5033
  }
@@ -5433,15 +5036,15 @@ function LineageLink({
5433
5036
  reportId,
5434
5037
  router
5435
5038
  }) {
5436
- const handleClick = useCallback13(() => {
5039
+ const handleClick = useCallback11(() => {
5437
5040
  router.navigate({ reportId });
5438
5041
  }, [reportId, router]);
5439
- return /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, children: [
5440
- /* @__PURE__ */ jsxs26(Text27, { muted: true, size: 2, weight: "semibold", children: [
5042
+ return /* @__PURE__ */ jsxs18(Flex13, { align: "center", gap: 2, children: [
5043
+ /* @__PURE__ */ jsxs18(Text20, { muted: true, size: 2, weight: "semibold", children: [
5441
5044
  label,
5442
5045
  ":"
5443
5046
  ] }),
5444
- /* @__PURE__ */ jsx32(Text27, { size: 2, children: /* @__PURE__ */ jsxs26(
5047
+ /* @__PURE__ */ jsx22(Text20, { size: 2, children: /* @__PURE__ */ jsxs18(
5445
5048
  "a",
5446
5049
  {
5447
5050
  href: "#",
@@ -5462,13 +5065,13 @@ function SpawnedReportRow({
5462
5065
  report,
5463
5066
  router
5464
5067
  }) {
5465
- const handleClick = useCallback13(() => {
5068
+ const handleClick = useCallback11(() => {
5466
5069
  router.navigate({ reportId: report.reportId });
5467
5070
  }, [report.reportId, router]);
5468
5071
  const dateLabel = formatShortDate(report.completedAt);
5469
5072
  const label = report.tag ?? dateLabel;
5470
- return /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, children: [
5471
- /* @__PURE__ */ jsx32(Text27, { size: 2, children: /* @__PURE__ */ jsx32(
5073
+ return /* @__PURE__ */ jsxs18(Flex13, { align: "center", gap: 2, children: [
5074
+ /* @__PURE__ */ jsx22(Text20, { size: 2, children: /* @__PURE__ */ jsx22(
5472
5075
  "a",
5473
5076
  {
5474
5077
  href: "#",
@@ -5480,8 +5083,8 @@ function SpawnedReportRow({
5480
5083
  children: label
5481
5084
  }
5482
5085
  ) }),
5483
- report.tag && /* @__PURE__ */ jsx32(Text27, { muted: true, size: 1, children: dateLabel }),
5484
- /* @__PURE__ */ jsx32(Badge18, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
5086
+ report.tag && /* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, children: dateLabel }),
5087
+ /* @__PURE__ */ jsx22(Badge7, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
5485
5088
  ] });
5486
5089
  }
5487
5090
  function formatShortDate(iso) {
@@ -5497,16 +5100,16 @@ function formatShortDate(iso) {
5497
5100
  }
5498
5101
 
5499
5102
  // src/components/report-detail/JudgmentList.tsx
5500
- import { useState as useState10 } from "react";
5103
+ import { useState as useState8 } from "react";
5501
5104
  import { HelpCircleIcon as HelpCircleIcon6 } from "@sanity/icons";
5502
- import { Badge as Badge19, Box as Box12, Card as Card19, Flex as Flex21, Stack as Stack19, Text as Text28, Tooltip as Tooltip6 } from "@sanity/ui";
5105
+ import { Badge as Badge8, Box as Box11, Card as Card14, Flex as Flex14, Stack as Stack16, Text as Text21, Tooltip as Tooltip6 } from "@sanity/ui";
5503
5106
 
5504
5107
  // src/components/primitives/InlineCode.tsx
5505
- import { Fragment as Fragment5, jsx as jsx33 } from "react/jsx-runtime";
5108
+ import { Fragment as Fragment6, jsx as jsx23 } from "react/jsx-runtime";
5506
5109
  function InlineCode({ text }) {
5507
5110
  const parts = text.split(/`([^`]+)`/);
5508
- return /* @__PURE__ */ jsx33(Fragment5, { children: parts.map(
5509
- (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx33(
5111
+ return /* @__PURE__ */ jsx23(Fragment6, { children: parts.map(
5112
+ (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx23(
5510
5113
  "code",
5511
5114
  {
5512
5115
  style: {
@@ -5518,12 +5121,12 @@ function InlineCode({ text }) {
5518
5121
  children: part
5519
5122
  },
5520
5123
  i
5521
- ) : /* @__PURE__ */ jsx33("span", { children: part }, i)
5124
+ ) : /* @__PURE__ */ jsx23("span", { children: part }, i)
5522
5125
  ) });
5523
5126
  }
5524
5127
 
5525
5128
  // src/components/report-detail/JudgmentList.tsx
5526
- import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
5129
+ import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
5527
5130
  function groupByArea(judgments) {
5528
5131
  const byArea = /* @__PURE__ */ new Map();
5529
5132
  for (const j of judgments) {
@@ -5538,56 +5141,56 @@ var DIMENSION_LABELS = DIMENSION_LABELS_KEBAB;
5538
5141
  function JudgmentList({ judgments }) {
5539
5142
  if (judgments.length === 0) return null;
5540
5143
  const grouped = groupByArea(judgments);
5541
- return /* @__PURE__ */ jsx34(Card19, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs27(Stack19, { space: 4, children: [
5542
- /* @__PURE__ */ jsxs27(Flex21, { align: "center", gap: 3, wrap: "wrap", children: [
5543
- /* @__PURE__ */ jsx34(Text28, { size: 3, weight: "semibold", children: "Low-Scoring Judgments" }),
5544
- /* @__PURE__ */ jsx34(
5144
+ return /* @__PURE__ */ jsx24(Card14, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs19(Stack16, { space: 4, children: [
5145
+ /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 3, wrap: "wrap", children: [
5146
+ /* @__PURE__ */ jsx24(Text21, { size: 3, weight: "semibold", children: "Low-Scoring Judgments" }),
5147
+ /* @__PURE__ */ jsx24(
5545
5148
  Tooltip6,
5546
5149
  {
5547
- content: /* @__PURE__ */ jsx34(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx34(Text28, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5150
+ content: /* @__PURE__ */ jsx24(Box11, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx24(Text21, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5548
5151
  placement: "bottom",
5549
5152
  portal: true,
5550
- children: /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, children: /* @__PURE__ */ jsx34(HelpCircleIcon6, {}) })
5153
+ children: /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: /* @__PURE__ */ jsx24(HelpCircleIcon6, {}) })
5551
5154
  }
5552
5155
  ),
5553
- /* @__PURE__ */ jsx34(Card19, { padding: 2, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs27(Text28, { size: 2, weight: "bold", children: [
5156
+ /* @__PURE__ */ jsx24(Card14, { padding: 2, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs19(Text21, { size: 2, weight: "bold", children: [
5554
5157
  judgments.length,
5555
5158
  " judgment",
5556
5159
  judgments.length === 1 ? "" : "s",
5557
5160
  " below 70"
5558
5161
  ] }) })
5559
5162
  ] }),
5560
- grouped.map(([area, areaJudgments]) => /* @__PURE__ */ jsx34(Card19, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs27(Stack19, { space: 3, children: [
5561
- /* @__PURE__ */ jsxs27(Text28, { size: 2, weight: "semibold", children: [
5163
+ grouped.map(([area, areaJudgments]) => /* @__PURE__ */ jsx24(Card14, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
5164
+ /* @__PURE__ */ jsxs19(Text21, { size: 2, weight: "semibold", children: [
5562
5165
  area,
5563
5166
  " ",
5564
- /* @__PURE__ */ jsxs27(Text28, { muted: true, size: 2, weight: "regular", as: "span", children: [
5167
+ /* @__PURE__ */ jsxs19(Text21, { muted: true, size: 2, weight: "regular", as: "span", children: [
5565
5168
  "(",
5566
5169
  areaJudgments.length,
5567
5170
  ")"
5568
5171
  ] })
5569
5172
  ] }),
5570
- areaJudgments.map((j, i) => /* @__PURE__ */ jsx34(JudgmentCard, { judgment: j }, `${area}-${i}`))
5173
+ areaJudgments.map((j, i) => /* @__PURE__ */ jsx24(JudgmentCard, { judgment: j }, `${area}-${i}`))
5571
5174
  ] }) }, area))
5572
5175
  ] }) });
5573
5176
  }
5574
5177
  function JudgmentCard({ judgment }) {
5575
- const [expanded, setExpanded] = useState10(false);
5178
+ const [expanded, setExpanded] = useState8(false);
5576
5179
  const dimLabel = DIMENSION_LABELS[judgment.dimension] ?? judgment.dimension;
5577
5180
  const sep = judgment.taskId.indexOf(" - ");
5578
5181
  const taskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
5579
- return /* @__PURE__ */ jsx34(
5580
- Card19,
5182
+ return /* @__PURE__ */ jsx24(
5183
+ Card14,
5581
5184
  {
5582
5185
  padding: 3,
5583
5186
  radius: 2,
5584
5187
  shadow: 1,
5585
5188
  style: { cursor: "pointer" },
5586
5189
  onClick: () => setExpanded(!expanded),
5587
- children: /* @__PURE__ */ jsxs27(Stack19, { space: 3, children: [
5588
- /* @__PURE__ */ jsxs27(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
5589
- /* @__PURE__ */ jsx34(Card19, { padding: 2, radius: 2, tone: scoreTone(judgment.score), children: /* @__PURE__ */ jsx34(
5590
- Text28,
5190
+ children: /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
5191
+ /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
5192
+ /* @__PURE__ */ jsx24(Card14, { padding: 2, radius: 2, tone: scoreTone(judgment.score), children: /* @__PURE__ */ jsx24(
5193
+ Text21,
5591
5194
  {
5592
5195
  align: "center",
5593
5196
  size: 2,
@@ -5596,24 +5199,24 @@ function JudgmentCard({ judgment }) {
5596
5199
  children: judgment.score
5597
5200
  }
5598
5201
  ) }),
5599
- /* @__PURE__ */ jsx34(Badge19, { tone: "default", children: dimLabel }),
5600
- /* @__PURE__ */ jsx34(Text28, { size: 2, weight: "medium", children: taskName }),
5601
- /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, children: judgment.modelId }),
5602
- /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, style: { marginLeft: "auto" }, children: expanded ? "\u25B2" : "\u25BC" })
5202
+ /* @__PURE__ */ jsx24(Badge8, { tone: "default", children: dimLabel }),
5203
+ /* @__PURE__ */ jsx24(Text21, { size: 2, weight: "medium", children: taskName }),
5204
+ /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: judgment.modelId }),
5205
+ /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, style: { marginLeft: "auto" }, children: expanded ? "\u25B2" : "\u25BC" })
5603
5206
  ] }),
5604
- expanded && /* @__PURE__ */ jsxs27(Stack19, { space: 3, children: [
5605
- /* @__PURE__ */ jsx34(Card19, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx34(
5606
- Text28,
5207
+ expanded && /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
5208
+ /* @__PURE__ */ jsx24(Card14, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx24(
5209
+ Text21,
5607
5210
  {
5608
5211
  muted: true,
5609
5212
  size: 2,
5610
5213
  style: { lineHeight: 1.6, whiteSpace: "pre-wrap" },
5611
- children: /* @__PURE__ */ jsx34(InlineCode, { text: judgment.reason })
5214
+ children: /* @__PURE__ */ jsx24(InlineCode, { text: judgment.reason })
5612
5215
  }
5613
5216
  ) }),
5614
- judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs27(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
5615
- /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, children: "Docs:" }),
5616
- judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx34(DocBadge, { doc }, doc.slug))
5217
+ judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
5218
+ /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: "Docs:" }),
5219
+ judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx24(DocBadge, { doc }, doc.slug))
5617
5220
  ] })
5618
5221
  ] })
5619
5222
  ] })
@@ -5629,17 +5232,17 @@ var editLinkStyle = {
5629
5232
  function DocBadge({
5630
5233
  doc
5631
5234
  }) {
5632
- const [hovered, setHovered] = useState10(false);
5235
+ const [hovered, setHovered] = useState8(false);
5633
5236
  const isLinked = Boolean(doc.documentId);
5634
5237
  const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
5635
- const badge = /* @__PURE__ */ jsx34(Badge19, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
5636
- return /* @__PURE__ */ jsx34(
5238
+ const badge = /* @__PURE__ */ jsx24(Badge8, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
5239
+ return /* @__PURE__ */ jsx24(
5637
5240
  Tooltip6,
5638
5241
  {
5639
- content: /* @__PURE__ */ jsx34(Box12, { padding: 2, children: /* @__PURE__ */ jsx34(Text28, { size: 2, children: tooltipLabel }) }),
5242
+ content: /* @__PURE__ */ jsx24(Box11, { padding: 2, children: /* @__PURE__ */ jsx24(Text21, { size: 2, children: tooltipLabel }) }),
5640
5243
  placement: "bottom",
5641
5244
  portal: true,
5642
- children: isLinked ? /* @__PURE__ */ jsx34(
5245
+ children: isLinked ? /* @__PURE__ */ jsx24(
5643
5246
  "a",
5644
5247
  {
5645
5248
  href: `/intent/edit/id=${doc.documentId}`,
@@ -5652,14 +5255,14 @@ function DocBadge({
5652
5255
  },
5653
5256
  children: badge
5654
5257
  }
5655
- ) : /* @__PURE__ */ jsx34("span", { children: badge })
5258
+ ) : /* @__PURE__ */ jsx24("span", { children: badge })
5656
5259
  }
5657
5260
  );
5658
5261
  }
5659
5262
 
5660
5263
  // src/components/report-detail/OverviewStats.tsx
5661
5264
  import { Grid as Grid4 } from "@sanity/ui";
5662
- import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
5265
+ import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
5663
5266
  function OverviewStats({
5664
5267
  overall,
5665
5268
  durationMs,
@@ -5667,8 +5270,8 @@ function OverviewStats({
5667
5270
  isFullMode
5668
5271
  }) {
5669
5272
  const overallTone = scoreTone(overall.avgScore);
5670
- return /* @__PURE__ */ jsxs28(Grid4, { columns: [1, 1, 2, isFullMode ? 4 : 4], gap: 3, children: [
5671
- /* @__PURE__ */ jsx35(
5273
+ return /* @__PURE__ */ jsxs20(Grid4, { columns: [1, 1, 2, isFullMode ? 4 : 4], gap: 3, children: [
5274
+ /* @__PURE__ */ jsx25(
5672
5275
  StatCard,
5673
5276
  {
5674
5277
  label: "Overall Score",
@@ -5677,7 +5280,7 @@ function OverviewStats({
5677
5280
  value: overall.avgScore.toFixed(1)
5678
5281
  }
5679
5282
  ),
5680
- /* @__PURE__ */ jsx35(
5283
+ /* @__PURE__ */ jsx25(
5681
5284
  StatCard,
5682
5285
  {
5683
5286
  label: "Doc Lift",
@@ -5686,7 +5289,7 @@ function OverviewStats({
5686
5289
  value: overall.avgDocLift.toFixed(1)
5687
5290
  }
5688
5291
  ),
5689
- isFullMode && overall.avgActualScore != null && /* @__PURE__ */ jsx35(
5292
+ isFullMode && overall.avgActualScore != null && /* @__PURE__ */ jsx25(
5690
5293
  StatCard,
5691
5294
  {
5692
5295
  label: "Actual Score",
@@ -5695,7 +5298,7 @@ function OverviewStats({
5695
5298
  value: overall.avgActualScore.toFixed(1)
5696
5299
  }
5697
5300
  ),
5698
- isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */ jsx35(
5301
+ isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */ jsx25(
5699
5302
  StatCard,
5700
5303
  {
5701
5304
  label: "Retrieval Gap",
@@ -5705,7 +5308,7 @@ function OverviewStats({
5705
5308
  value: overall.avgRetrievalGap.toFixed(1)
5706
5309
  }
5707
5310
  ),
5708
- isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */ jsx35(
5311
+ isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */ jsx25(
5709
5312
  StatCard,
5710
5313
  {
5711
5314
  label: "Infra Efficiency",
@@ -5713,8 +5316,8 @@ function OverviewStats({
5713
5316
  value: formatPercent(overall.avgInfrastructureEfficiency)
5714
5317
  }
5715
5318
  ),
5716
- /* @__PURE__ */ jsx35(StatCard, { label: "Duration", value: formatDuration(durationMs) }),
5717
- /* @__PURE__ */ jsx35(
5319
+ /* @__PURE__ */ jsx25(StatCard, { label: "Duration", value: formatDuration(durationMs) }),
5320
+ /* @__PURE__ */ jsx25(
5718
5321
  StatCard,
5719
5322
  {
5720
5323
  label: "Tests",
@@ -5726,31 +5329,31 @@ function OverviewStats({
5726
5329
  }
5727
5330
 
5728
5331
  // src/components/report-detail/ProvenanceCard.tsx
5729
- import { Card as Card20, Flex as Flex22, Grid as Grid5, Stack as Stack20, Text as Text29 } from "@sanity/ui";
5730
- import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
5332
+ import { Card as Card15, Flex as Flex15, Grid as Grid5, Stack as Stack17, Text as Text22 } from "@sanity/ui";
5333
+ import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
5731
5334
  var VIEWABLE_PROMPTFOO_MODES = /* @__PURE__ */ new Set(["agentic", "observed"]);
5732
5335
  function ProvenanceCard({ provenance }) {
5733
- return /* @__PURE__ */ jsx36(Card20, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs29(Stack20, { space: 4, children: [
5734
- /* @__PURE__ */ jsx36(Text29, { size: 3, weight: "semibold", children: "Provenance" }),
5735
- /* @__PURE__ */ jsxs29(Grid5, { columns: [1, 2, 3], gap: 4, children: [
5736
- /* @__PURE__ */ jsx36(Field, { label: "Mode", value: provenance.mode }),
5737
- /* @__PURE__ */ jsx36(Field, { label: "Source", value: provenance.source.name }),
5738
- /* @__PURE__ */ jsx36(
5336
+ return /* @__PURE__ */ jsx26(Card15, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs21(Stack17, { space: 4, children: [
5337
+ /* @__PURE__ */ jsx26(Text22, { size: 3, weight: "semibold", children: "Provenance" }),
5338
+ /* @__PURE__ */ jsxs21(Grid5, { columns: [1, 2, 3], gap: 4, children: [
5339
+ /* @__PURE__ */ jsx26(Field, { label: "Mode", value: provenance.mode }),
5340
+ /* @__PURE__ */ jsx26(Field, { label: "Source", value: provenance.source.name }),
5341
+ /* @__PURE__ */ jsx26(
5739
5342
  Field,
5740
5343
  {
5741
5344
  label: "Trigger",
5742
5345
  value: provenance.trigger.type + (provenance.trigger.workflow ? ` (${provenance.trigger.workflow})` : "")
5743
5346
  }
5744
5347
  ),
5745
- /* @__PURE__ */ jsx36(
5348
+ /* @__PURE__ */ jsx26(
5746
5349
  Field,
5747
5350
  {
5748
5351
  label: "Models",
5749
5352
  value: provenance.models.map((m) => m.label).join(", ")
5750
5353
  }
5751
5354
  ),
5752
- /* @__PURE__ */ jsx36(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5753
- provenance.contextHash && /* @__PURE__ */ jsx36(
5355
+ /* @__PURE__ */ jsx26(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5356
+ provenance.contextHash && /* @__PURE__ */ jsx26(
5754
5357
  Field,
5755
5358
  {
5756
5359
  label: "Context Hash",
@@ -5759,8 +5362,8 @@ function ProvenanceCard({ provenance }) {
5759
5362
  }
5760
5363
  )
5761
5364
  ] }),
5762
- provenance.git && /* @__PURE__ */ jsx36(GitInfo, { git: provenance.git }),
5763
- /* @__PURE__ */ jsx36(PromptfooLinks, { provenance })
5365
+ provenance.git && /* @__PURE__ */ jsx26(GitInfo, { git: provenance.git }),
5366
+ /* @__PURE__ */ jsx26(PromptfooLinks, { provenance })
5764
5367
  ] }) });
5765
5368
  }
5766
5369
  function Field({
@@ -5768,9 +5371,9 @@ function Field({
5768
5371
  mono,
5769
5372
  value
5770
5373
  }) {
5771
- return /* @__PURE__ */ jsxs29(Stack20, { space: 1, children: [
5772
- /* @__PURE__ */ jsx36(
5773
- Text29,
5374
+ return /* @__PURE__ */ jsxs21(Stack17, { space: 1, children: [
5375
+ /* @__PURE__ */ jsx26(
5376
+ Text22,
5774
5377
  {
5775
5378
  muted: true,
5776
5379
  size: 1,
@@ -5779,7 +5382,7 @@ function Field({
5779
5382
  children: label
5780
5383
  }
5781
5384
  ),
5782
- /* @__PURE__ */ jsx36(Text29, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5385
+ /* @__PURE__ */ jsx26(Text22, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5783
5386
  ] });
5784
5387
  }
5785
5388
  function GitInfo({ git }) {
@@ -5787,15 +5390,15 @@ function GitInfo({ git }) {
5787
5390
  const branchUrl = `${repoUrl}/tree/${git.branch}`;
5788
5391
  const commitUrl = `${repoUrl}/commit/${git.sha}`;
5789
5392
  const prUrl = git.prNumber ? `${repoUrl}/pull/${git.prNumber}` : null;
5790
- return /* @__PURE__ */ jsx36(Card20, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs29(Flex22, { align: "center", gap: 3, wrap: "wrap", children: [
5791
- /* @__PURE__ */ jsx36(Text29, { muted: true, size: 2, weight: "semibold", children: "Git" }),
5792
- /* @__PURE__ */ jsxs29(Text29, { size: 2, children: [
5793
- /* @__PURE__ */ jsx36("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5393
+ return /* @__PURE__ */ jsx26(Card15, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs21(Flex15, { align: "center", gap: 3, wrap: "wrap", children: [
5394
+ /* @__PURE__ */ jsx26(Text22, { muted: true, size: 2, weight: "semibold", children: "Git" }),
5395
+ /* @__PURE__ */ jsxs21(Text22, { size: 2, children: [
5396
+ /* @__PURE__ */ jsx26("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5794
5397
  " / ",
5795
- /* @__PURE__ */ jsx36("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5398
+ /* @__PURE__ */ jsx26("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5796
5399
  ] }),
5797
- /* @__PURE__ */ jsx36(Text29, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx36("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
5798
- prUrl && /* @__PURE__ */ jsx36(Text29, { size: 2, children: /* @__PURE__ */ jsxs29("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5400
+ /* @__PURE__ */ jsx26(Text22, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx26("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
5401
+ prUrl && /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsxs21("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5799
5402
  "PR #",
5800
5403
  git.prNumber,
5801
5404
  " \u2192"
@@ -5810,14 +5413,14 @@ function PromptfooLinks({
5810
5413
  (e) => VIEWABLE_PROMPTFOO_MODES.has(e.mode)
5811
5414
  );
5812
5415
  if (viewable.length === 0) return null;
5813
- return /* @__PURE__ */ jsx36(Flex22, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx36(Text29, { size: 2, children: /* @__PURE__ */ jsxs29("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5416
+ return /* @__PURE__ */ jsx26(Flex15, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsxs21("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5814
5417
  "View in Promptfoo (",
5815
5418
  entry.mode,
5816
5419
  ") \u2192"
5817
5420
  ] }) }, entry.mode)) });
5818
5421
  }
5819
5422
  if (provenance.promptfooUrl && VIEWABLE_PROMPTFOO_MODES.has(provenance.mode)) {
5820
- return /* @__PURE__ */ jsx36(Text29, { size: 2, children: /* @__PURE__ */ jsx36(
5423
+ return /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsx26(
5821
5424
  "a",
5822
5425
  {
5823
5426
  href: provenance.promptfooUrl,
@@ -5832,32 +5435,32 @@ function PromptfooLinks({
5832
5435
 
5833
5436
  // src/components/report-detail/RecommendationsSection.tsx
5834
5437
  import React4 from "react";
5835
- import { Badge as Badge20, Box as Box13, Card as Card21, Flex as Flex23, Stack as Stack21, Text as Text30, Tooltip as Tooltip7 } from "@sanity/ui";
5438
+ import { Badge as Badge9, Box as Box12, Card as Card16, Flex as Flex16, Stack as Stack18, Text as Text23, Tooltip as Tooltip7 } from "@sanity/ui";
5836
5439
  import { HelpCircleIcon as HelpCircleIcon7 } from "@sanity/icons";
5837
- import { jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
5440
+ import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
5838
5441
  function RecommendationsSection({
5839
5442
  recommendations
5840
5443
  }) {
5841
5444
  if (recommendations.gaps.length === 0) return null;
5842
- return /* @__PURE__ */ jsx37(Card21, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs30(Stack21, { space: 4, children: [
5843
- /* @__PURE__ */ jsxs30(Flex23, { align: "center", gap: 3, wrap: "wrap", children: [
5844
- /* @__PURE__ */ jsx37(Text30, { size: 3, weight: "semibold", children: "Recommendations" }),
5845
- /* @__PURE__ */ jsx37(
5445
+ return /* @__PURE__ */ jsx27(Card16, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs22(Stack18, { space: 4, children: [
5446
+ /* @__PURE__ */ jsxs22(Flex16, { align: "center", gap: 3, wrap: "wrap", children: [
5447
+ /* @__PURE__ */ jsx27(Text23, { size: 3, weight: "semibold", children: "Recommendations" }),
5448
+ /* @__PURE__ */ jsx27(
5846
5449
  Tooltip7,
5847
5450
  {
5848
- content: /* @__PURE__ */ jsx37(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx37(Text30, { size: 2, children: GLOSSARY.recommendations }) }),
5451
+ content: /* @__PURE__ */ jsx27(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx27(Text23, { size: 2, children: GLOSSARY.recommendations }) }),
5849
5452
  placement: "bottom",
5850
5453
  portal: true,
5851
- children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 1, children: /* @__PURE__ */ jsx37(HelpCircleIcon7, {}) })
5454
+ children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx27(HelpCircleIcon7, {}) })
5852
5455
  }
5853
5456
  ),
5854
- /* @__PURE__ */ jsx37(
5457
+ /* @__PURE__ */ jsx27(
5855
5458
  Tooltip7,
5856
5459
  {
5857
- content: /* @__PURE__ */ jsx37(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx37(Text30, { size: 2, children: GLOSSARY.totalPotentialLift }) }),
5460
+ content: /* @__PURE__ */ jsx27(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx27(Text23, { size: 2, children: GLOSSARY.totalPotentialLift }) }),
5858
5461
  placement: "bottom",
5859
5462
  portal: true,
5860
- children: /* @__PURE__ */ jsx37(Card21, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs30(Text30, { size: 2, weight: "bold", children: [
5463
+ children: /* @__PURE__ */ jsx27(Card16, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs22(Text23, { size: 2, weight: "bold", children: [
5861
5464
  "+",
5862
5465
  recommendations.totalPotentialLift.toFixed(1),
5863
5466
  " pts potential lift"
@@ -5865,7 +5468,7 @@ function RecommendationsSection({
5865
5468
  }
5866
5469
  )
5867
5470
  ] }),
5868
- /* @__PURE__ */ jsxs30(
5471
+ /* @__PURE__ */ jsxs22(
5869
5472
  "div",
5870
5473
  {
5871
5474
  style: {
@@ -5874,9 +5477,9 @@ function RecommendationsSection({
5874
5477
  gridTemplateColumns: "auto 2fr 2fr 1fr 1fr 1fr"
5875
5478
  },
5876
5479
  children: [
5877
- /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "#" }),
5878
- /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Area" }),
5879
- /* @__PURE__ */ jsx37(
5480
+ /* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "#" }),
5481
+ /* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "Area" }),
5482
+ /* @__PURE__ */ jsx27(
5880
5483
  ColumnHeader,
5881
5484
  {
5882
5485
  borderBottom: true,
@@ -5884,8 +5487,8 @@ function RecommendationsSection({
5884
5487
  tooltip: GLOSSARY.failureMode
5885
5488
  }
5886
5489
  ),
5887
- /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Action" }),
5888
- /* @__PURE__ */ jsx37(
5490
+ /* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "Action" }),
5491
+ /* @__PURE__ */ jsx27(
5889
5492
  ColumnHeader,
5890
5493
  {
5891
5494
  borderBottom: true,
@@ -5893,7 +5496,7 @@ function RecommendationsSection({
5893
5496
  tooltip: GLOSSARY.estimatedLift
5894
5497
  }
5895
5498
  ),
5896
- /* @__PURE__ */ jsx37(
5499
+ /* @__PURE__ */ jsx27(
5897
5500
  ColumnHeader,
5898
5501
  {
5899
5502
  borderBottom: true,
@@ -5901,7 +5504,7 @@ function RecommendationsSection({
5901
5504
  tooltip: GLOSSARY.confidence
5902
5505
  }
5903
5506
  ),
5904
- recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx37(RecommendationRow, { gap, index: i }, `gap-${i}`))
5507
+ recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx27(RecommendationRow, { gap, index: i }, `gap-${i}`))
5905
5508
  ]
5906
5509
  }
5907
5510
  )
@@ -5913,8 +5516,8 @@ function RecommendationRow({
5913
5516
  }) {
5914
5517
  const confIcon = gap.confidence === "high" ? "\u{1F7E2}" : gap.confidence === "medium" ? "\u{1F7E1}" : "\u{1F534}";
5915
5518
  const bg = rowBackground(index);
5916
- return /* @__PURE__ */ jsxs30(React4.Fragment, { children: [
5917
- /* @__PURE__ */ jsx37(
5519
+ return /* @__PURE__ */ jsxs22(React4.Fragment, { children: [
5520
+ /* @__PURE__ */ jsx27(
5918
5521
  "div",
5919
5522
  {
5920
5523
  style: {
@@ -5924,10 +5527,10 @@ function RecommendationRow({
5924
5527
  display: "flex",
5925
5528
  padding: "8px 4px"
5926
5529
  },
5927
- children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: index + 1 })
5530
+ children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 2, children: index + 1 })
5928
5531
  }
5929
5532
  ),
5930
- /* @__PURE__ */ jsx37(
5533
+ /* @__PURE__ */ jsx27(
5931
5534
  "div",
5932
5535
  {
5933
5536
  style: {
@@ -5936,10 +5539,10 @@ function RecommendationRow({
5936
5539
  display: "flex",
5937
5540
  padding: "8px 0"
5938
5541
  },
5939
- children: /* @__PURE__ */ jsx37(Text30, { size: 2, weight: "medium", children: gap.area })
5542
+ children: /* @__PURE__ */ jsx27(Text23, { size: 2, weight: "medium", children: gap.area })
5940
5543
  }
5941
5544
  ),
5942
- /* @__PURE__ */ jsx37(
5545
+ /* @__PURE__ */ jsx27(
5943
5546
  "div",
5944
5547
  {
5945
5548
  style: {
@@ -5948,8 +5551,8 @@ function RecommendationRow({
5948
5551
  display: "flex",
5949
5552
  padding: "8px 0"
5950
5553
  },
5951
- children: /* @__PURE__ */ jsx37(
5952
- Badge20,
5554
+ children: /* @__PURE__ */ jsx27(
5555
+ Badge9,
5953
5556
  {
5954
5557
  tone: gap.failureMode === "missing-docs" ? "critical" : gap.failureMode === "incorrect-docs" ? "critical" : gap.failureMode === "outdated-docs" ? "caution" : "default",
5955
5558
  children: gap.failureMode
@@ -5957,7 +5560,7 @@ function RecommendationRow({
5957
5560
  )
5958
5561
  }
5959
5562
  ),
5960
- /* @__PURE__ */ jsx37(
5563
+ /* @__PURE__ */ jsx27(
5961
5564
  "div",
5962
5565
  {
5963
5566
  style: {
@@ -5966,10 +5569,10 @@ function RecommendationRow({
5966
5569
  display: "flex",
5967
5570
  padding: "8px 0"
5968
5571
  },
5969
- children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: gap.remediation })
5572
+ children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 2, children: gap.remediation })
5970
5573
  }
5971
5574
  ),
5972
- /* @__PURE__ */ jsx37(
5575
+ /* @__PURE__ */ jsx27(
5973
5576
  "div",
5974
5577
  {
5975
5578
  style: {
@@ -5978,13 +5581,13 @@ function RecommendationRow({
5978
5581
  display: "flex",
5979
5582
  padding: "8px 0"
5980
5583
  },
5981
- children: /* @__PURE__ */ jsx37(Card21, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs30(Text30, { align: "center", size: 2, weight: "medium", children: [
5584
+ children: /* @__PURE__ */ jsx27(Card16, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs22(Text23, { align: "center", size: 2, weight: "medium", children: [
5982
5585
  "+",
5983
5586
  gap.estimatedLift.toFixed(1)
5984
5587
  ] }) })
5985
5588
  }
5986
5589
  ),
5987
- /* @__PURE__ */ jsx37(
5590
+ /* @__PURE__ */ jsx27(
5988
5591
  "div",
5989
5592
  {
5990
5593
  style: {
@@ -5993,7 +5596,7 @@ function RecommendationRow({
5993
5596
  display: "flex",
5994
5597
  padding: "8px 0"
5995
5598
  },
5996
- children: /* @__PURE__ */ jsxs30(Text30, { size: 2, children: [
5599
+ children: /* @__PURE__ */ jsxs22(Text23, { size: 2, children: [
5997
5600
  confIcon,
5998
5601
  " ",
5999
5602
  gap.confidence
@@ -6005,32 +5608,32 @@ function RecommendationRow({
6005
5608
 
6006
5609
  // src/components/report-detail/ReportHeader.tsx
6007
5610
  import { ArrowLeftIcon } from "@sanity/icons";
6008
- import { Badge as Badge21, Button as Button4, Flex as Flex26, Stack as Stack23, Text as Text32 } from "@sanity/ui";
5611
+ import { Badge as Badge10, Button as Button4, Flex as Flex19, Stack as Stack20, Text as Text25 } from "@sanity/ui";
6009
5612
 
6010
5613
  // src/components/report-detail/report-actions/ReportActions.tsx
6011
5614
  import { ChevronDownIcon, CopyIcon as CopyIcon2 } from "@sanity/icons";
6012
5615
  import {
6013
5616
  Button as Button3,
6014
- Flex as Flex25,
6015
- Menu as Menu2,
6016
- MenuButton as MenuButton2,
5617
+ Flex as Flex18,
5618
+ Menu,
5619
+ MenuButton,
6017
5620
  MenuDivider,
6018
5621
  useToast as useToast7
6019
5622
  } from "@sanity/ui";
6020
- import { useCallback as useCallback19, useState as useState14 } from "react";
6021
- import { useClient as useClient11 } from "sanity";
5623
+ import { useCallback as useCallback17, useState as useState12 } from "react";
5624
+ import { useClient as useClient9 } from "sanity";
6022
5625
 
6023
5626
  // src/components/report-detail/report-actions/CopyReportAction.tsx
6024
5627
  import { ClipboardIcon } from "@sanity/icons";
6025
- import { MenuItem as MenuItem2, useToast as useToast2 } from "@sanity/ui";
6026
- import { useCallback as useCallback14, useState as useState11 } from "react";
6027
- import { useClient as useClient8 } from "sanity";
6028
- import { jsx as jsx38 } from "react/jsx-runtime";
5628
+ import { MenuItem, useToast as useToast2 } from "@sanity/ui";
5629
+ import { useCallback as useCallback12, useState as useState9 } from "react";
5630
+ import { useClient as useClient6 } from "sanity";
5631
+ import { jsx as jsx28 } from "react/jsx-runtime";
6029
5632
  function CopyReportAction({ documentId }) {
6030
- const client = useClient8({ apiVersion: API_VERSION });
5633
+ const client = useClient6({ apiVersion: API_VERSION });
6031
5634
  const toast = useToast2();
6032
- const [copying, setCopying] = useState11(false);
6033
- const handleClick = useCallback14(async () => {
5635
+ const [copying, setCopying] = useState9(false);
5636
+ const handleClick = useCallback12(async () => {
6034
5637
  setCopying(true);
6035
5638
  try {
6036
5639
  const doc = await client.fetch(
@@ -6062,8 +5665,8 @@ function CopyReportAction({ documentId }) {
6062
5665
  setCopying(false);
6063
5666
  }
6064
5667
  }, [client, documentId, toast]);
6065
- return /* @__PURE__ */ jsx38(
6066
- MenuItem2,
5668
+ return /* @__PURE__ */ jsx28(
5669
+ MenuItem,
6067
5670
  {
6068
5671
  disabled: copying,
6069
5672
  icon: ClipboardIcon,
@@ -6075,12 +5678,12 @@ function CopyReportAction({ documentId }) {
6075
5678
 
6076
5679
  // src/components/report-detail/report-actions/CopyReportIdAction.tsx
6077
5680
  import { CopyIcon } from "@sanity/icons";
6078
- import { MenuItem as MenuItem3, useToast as useToast3 } from "@sanity/ui";
6079
- import { useCallback as useCallback15 } from "react";
6080
- import { jsx as jsx39 } from "react/jsx-runtime";
5681
+ import { MenuItem as MenuItem2, useToast as useToast3 } from "@sanity/ui";
5682
+ import { useCallback as useCallback13 } from "react";
5683
+ import { jsx as jsx29 } from "react/jsx-runtime";
6081
5684
  function CopyReportIdAction({ reportId }) {
6082
5685
  const toast = useToast3();
6083
- const handleClick = useCallback15(() => {
5686
+ const handleClick = useCallback13(() => {
6084
5687
  navigator.clipboard.writeText(reportId).then(
6085
5688
  () => {
6086
5689
  toast.push({
@@ -6098,19 +5701,19 @@ function CopyReportIdAction({ reportId }) {
6098
5701
  }
6099
5702
  );
6100
5703
  }, [reportId, toast]);
6101
- return /* @__PURE__ */ jsx39(MenuItem3, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
5704
+ return /* @__PURE__ */ jsx29(MenuItem2, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
6102
5705
  }
6103
5706
 
6104
5707
  // src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
6105
- import { SearchIcon as SearchIcon6 } from "@sanity/icons";
6106
- import { MenuItem as MenuItem4, useToast as useToast4 } from "@sanity/ui";
6107
- import { useCallback as useCallback16 } from "react";
6108
- import { jsx as jsx40 } from "react/jsx-runtime";
5708
+ import { SearchIcon as SearchIcon4 } from "@sanity/icons";
5709
+ import { MenuItem as MenuItem3, useToast as useToast4 } from "@sanity/ui";
5710
+ import { useCallback as useCallback14 } from "react";
5711
+ import { jsx as jsx30 } from "react/jsx-runtime";
6109
5712
  function CopyVisionQueryAction({
6110
5713
  reportId
6111
5714
  }) {
6112
5715
  const toast = useToast4();
6113
- const handleClick = useCallback16(() => {
5716
+ const handleClick = useCallback14(() => {
6114
5717
  const query = `*[_type == "ailf.report" && reportId == "${reportId}"][0]`;
6115
5718
  navigator.clipboard.writeText(query).then(
6116
5719
  () => {
@@ -6130,10 +5733,10 @@ function CopyVisionQueryAction({
6130
5733
  }
6131
5734
  );
6132
5735
  }, [reportId, toast]);
6133
- return /* @__PURE__ */ jsx40(
6134
- MenuItem4,
5736
+ return /* @__PURE__ */ jsx30(
5737
+ MenuItem3,
6135
5738
  {
6136
- icon: SearchIcon6,
5739
+ icon: SearchIcon4,
6137
5740
  onClick: handleClick,
6138
5741
  text: "Copy Vision query"
6139
5742
  }
@@ -6141,25 +5744,25 @@ function CopyVisionQueryAction({
6141
5744
  }
6142
5745
 
6143
5746
  // src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
6144
- import { Box as Box14, Button as Button2, Card as Card22, Dialog, Flex as Flex24, Stack as Stack22, Text as Text31 } from "@sanity/ui";
6145
- import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
5747
+ import { Box as Box13, Button as Button2, Card as Card17, Dialog, Flex as Flex17, Stack as Stack19, Text as Text24 } from "@sanity/ui";
5748
+ import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
6146
5749
  function DeleteConfirmDialog({
6147
5750
  isDeleting,
6148
5751
  onClose,
6149
5752
  onConfirm,
6150
5753
  reportId
6151
5754
  }) {
6152
- return /* @__PURE__ */ jsx41(
5755
+ return /* @__PURE__ */ jsx31(
6153
5756
  Dialog,
6154
5757
  {
6155
5758
  header: "Delete Report",
6156
5759
  id: "delete-report-dialog",
6157
5760
  onClose,
6158
5761
  width: 1,
6159
- children: /* @__PURE__ */ jsx41(Box14, { padding: 4, children: /* @__PURE__ */ jsxs31(Stack22, { space: 4, children: [
6160
- /* @__PURE__ */ jsx41(Text31, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
6161
- /* @__PURE__ */ jsx41(Card22, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx41(
6162
- Text31,
5762
+ children: /* @__PURE__ */ jsx31(Box13, { padding: 4, children: /* @__PURE__ */ jsxs23(Stack19, { space: 4, children: [
5763
+ /* @__PURE__ */ jsx31(Text24, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
5764
+ /* @__PURE__ */ jsx31(Card17, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx31(
5765
+ Text24,
6163
5766
  {
6164
5767
  muted: true,
6165
5768
  size: 1,
@@ -6167,8 +5770,8 @@ function DeleteConfirmDialog({
6167
5770
  children: reportId
6168
5771
  }
6169
5772
  ) }),
6170
- /* @__PURE__ */ jsxs31(Flex24, { gap: 2, justify: "flex-end", children: [
6171
- /* @__PURE__ */ jsx41(
5773
+ /* @__PURE__ */ jsxs23(Flex17, { gap: 2, justify: "flex-end", children: [
5774
+ /* @__PURE__ */ jsx31(
6172
5775
  Button2,
6173
5776
  {
6174
5777
  disabled: isDeleting,
@@ -6177,7 +5780,7 @@ function DeleteConfirmDialog({
6177
5780
  text: "Cancel"
6178
5781
  }
6179
5782
  ),
6180
- /* @__PURE__ */ jsx41(
5783
+ /* @__PURE__ */ jsx31(
6181
5784
  Button2,
6182
5785
  {
6183
5786
  disabled: isDeleting,
@@ -6194,13 +5797,13 @@ function DeleteConfirmDialog({
6194
5797
 
6195
5798
  // src/components/report-detail/report-actions/DeleteReportAction.tsx
6196
5799
  import { TrashIcon } from "@sanity/icons";
6197
- import { MenuItem as MenuItem5 } from "@sanity/ui";
6198
- import { jsx as jsx42 } from "react/jsx-runtime";
5800
+ import { MenuItem as MenuItem4 } from "@sanity/ui";
5801
+ import { jsx as jsx32 } from "react/jsx-runtime";
6199
5802
  function DeleteReportAction({
6200
5803
  onRequestDelete
6201
5804
  }) {
6202
- return /* @__PURE__ */ jsx42(
6203
- MenuItem5,
5805
+ return /* @__PURE__ */ jsx32(
5806
+ MenuItem4,
6204
5807
  {
6205
5808
  icon: TrashIcon,
6206
5809
  onClick: onRequestDelete,
@@ -6212,18 +5815,18 @@ function DeleteReportAction({
6212
5815
 
6213
5816
  // src/components/report-detail/report-actions/DownloadReportAction.tsx
6214
5817
  import { DownloadIcon } from "@sanity/icons";
6215
- import { MenuItem as MenuItem6, useToast as useToast5 } from "@sanity/ui";
6216
- import { useCallback as useCallback17, useState as useState12 } from "react";
6217
- import { useClient as useClient9 } from "sanity";
6218
- import { jsx as jsx43 } from "react/jsx-runtime";
5818
+ import { MenuItem as MenuItem5, useToast as useToast5 } from "@sanity/ui";
5819
+ import { useCallback as useCallback15, useState as useState10 } from "react";
5820
+ import { useClient as useClient7 } from "sanity";
5821
+ import { jsx as jsx33 } from "react/jsx-runtime";
6219
5822
  function DownloadReportAction({
6220
5823
  documentId,
6221
5824
  reportId
6222
5825
  }) {
6223
- const client = useClient9({ apiVersion: API_VERSION });
5826
+ const client = useClient7({ apiVersion: API_VERSION });
6224
5827
  const toast = useToast5();
6225
- const [downloading, setDownloading] = useState12(false);
6226
- const handleClick = useCallback17(async () => {
5828
+ const [downloading, setDownloading] = useState10(false);
5829
+ const handleClick = useCallback15(async () => {
6227
5830
  setDownloading(true);
6228
5831
  try {
6229
5832
  const doc = await client.fetch(
@@ -6263,8 +5866,8 @@ function DownloadReportAction({
6263
5866
  setDownloading(false);
6264
5867
  }
6265
5868
  }, [client, documentId, reportId, toast]);
6266
- return /* @__PURE__ */ jsx43(
6267
- MenuItem6,
5869
+ return /* @__PURE__ */ jsx33(
5870
+ MenuItem5,
6268
5871
  {
6269
5872
  disabled: downloading,
6270
5873
  icon: DownloadIcon,
@@ -6276,9 +5879,9 @@ function DownloadReportAction({
6276
5879
 
6277
5880
  // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6278
5881
  import { PlayIcon as PlayIcon2 } from "@sanity/icons";
6279
- import { MenuItem as MenuItem7, useToast as useToast6 } from "@sanity/ui";
6280
- import { useCallback as useCallback18, useState as useState13 } from "react";
6281
- import { useClient as useClient10, useCurrentUser as useCurrentUser2 } from "sanity";
5882
+ import { MenuItem as MenuItem6, useToast as useToast6 } from "@sanity/ui";
5883
+ import { useCallback as useCallback16, useState as useState11 } from "react";
5884
+ import { useClient as useClient8, useCurrentUser as useCurrentUser2 } from "sanity";
6282
5885
 
6283
5886
  // src/lib/eval-scope.ts
6284
5887
  function extractEvalScope(provenance) {
@@ -6293,7 +5896,7 @@ function extractEvalScope(provenance) {
6293
5896
  }
6294
5897
 
6295
5898
  // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6296
- import { jsx as jsx44 } from "react/jsx-runtime";
5899
+ import { jsx as jsx34 } from "react/jsx-runtime";
6297
5900
  var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
6298
5901
  function slugify2(s) {
6299
5902
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
@@ -6329,11 +5932,11 @@ function RerunEvaluationAction({
6329
5932
  provenance,
6330
5933
  reportId
6331
5934
  }) {
6332
- const client = useClient10({ apiVersion: API_VERSION });
5935
+ const client = useClient8({ apiVersion: API_VERSION });
6333
5936
  const currentUser = useCurrentUser2();
6334
5937
  const toast = useToast6();
6335
- const [requesting, setRequesting] = useState13(false);
6336
- const handleClick = useCallback18(async () => {
5938
+ const [requesting, setRequesting] = useState11(false);
5939
+ const handleClick = useCallback16(async () => {
6337
5940
  setRequesting(true);
6338
5941
  try {
6339
5942
  const scope = extractEvalScope(provenance);
@@ -6360,8 +5963,8 @@ function RerunEvaluationAction({
6360
5963
  setRequesting(false);
6361
5964
  }
6362
5965
  }, [client, currentUser?.id, provenance, reportId, toast]);
6363
- return /* @__PURE__ */ jsx44(
6364
- MenuItem7,
5966
+ return /* @__PURE__ */ jsx34(
5967
+ MenuItem6,
6365
5968
  {
6366
5969
  disabled: requesting,
6367
5970
  icon: PlayIcon2,
@@ -6372,16 +5975,16 @@ function RerunEvaluationAction({
6372
5975
  }
6373
5976
 
6374
5977
  // src/components/report-detail/report-actions/ReportActions.tsx
6375
- import { Fragment as Fragment6, jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
5978
+ import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
6376
5979
  function ReportActions({
6377
5980
  documentId,
6378
5981
  onDeleted,
6379
5982
  provenance,
6380
5983
  reportId
6381
5984
  }) {
6382
- const client = useClient11({ apiVersion: API_VERSION });
5985
+ const client = useClient9({ apiVersion: API_VERSION });
6383
5986
  const toast = useToast7();
6384
- const handleCopyId = useCallback19(() => {
5987
+ const handleCopyId = useCallback17(() => {
6385
5988
  navigator.clipboard.writeText(reportId).then(
6386
5989
  () => {
6387
5990
  toast.push({
@@ -6399,15 +6002,15 @@ function ReportActions({
6399
6002
  }
6400
6003
  );
6401
6004
  }, [reportId, toast]);
6402
- const [deleteDialogOpen, setDeleteDialogOpen] = useState14(false);
6403
- const [deleting, setDeleting] = useState14(false);
6404
- const handleRequestDelete = useCallback19(() => {
6005
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState12(false);
6006
+ const [deleting, setDeleting] = useState12(false);
6007
+ const handleRequestDelete = useCallback17(() => {
6405
6008
  setDeleteDialogOpen(true);
6406
6009
  }, []);
6407
- const handleDeleteClose = useCallback19(() => {
6010
+ const handleDeleteClose = useCallback17(() => {
6408
6011
  if (!deleting) setDeleteDialogOpen(false);
6409
6012
  }, [deleting]);
6410
- const handleDeleteConfirm = useCallback19(async () => {
6013
+ const handleDeleteConfirm = useCallback17(async () => {
6411
6014
  setDeleting(true);
6412
6015
  try {
6413
6016
  await client.delete(documentId);
@@ -6428,9 +6031,9 @@ function ReportActions({
6428
6031
  setDeleting(false);
6429
6032
  }
6430
6033
  }, [client, documentId, onDeleted, toast]);
6431
- return /* @__PURE__ */ jsxs32(Fragment6, { children: [
6432
- /* @__PURE__ */ jsxs32(Flex25, { children: [
6433
- /* @__PURE__ */ jsx45(
6034
+ return /* @__PURE__ */ jsxs24(Fragment7, { children: [
6035
+ /* @__PURE__ */ jsxs24(Flex18, { children: [
6036
+ /* @__PURE__ */ jsx35(
6434
6037
  Button3,
6435
6038
  {
6436
6039
  icon: CopyIcon2,
@@ -6444,10 +6047,10 @@ function ReportActions({
6444
6047
  text: "Copy Report ID"
6445
6048
  }
6446
6049
  ),
6447
- /* @__PURE__ */ jsx45(
6448
- MenuButton2,
6050
+ /* @__PURE__ */ jsx35(
6051
+ MenuButton,
6449
6052
  {
6450
- button: /* @__PURE__ */ jsx45(
6053
+ button: /* @__PURE__ */ jsx35(
6451
6054
  Button3,
6452
6055
  {
6453
6056
  icon: ChevronDownIcon,
@@ -6460,33 +6063,33 @@ function ReportActions({
6460
6063
  }
6461
6064
  ),
6462
6065
  id: "report-actions-menu",
6463
- menu: /* @__PURE__ */ jsxs32(Menu2, { children: [
6464
- /* @__PURE__ */ jsx45(CopyReportIdAction, { reportId }),
6465
- /* @__PURE__ */ jsx45(
6066
+ menu: /* @__PURE__ */ jsxs24(Menu, { children: [
6067
+ /* @__PURE__ */ jsx35(CopyReportIdAction, { reportId }),
6068
+ /* @__PURE__ */ jsx35(
6466
6069
  RerunEvaluationAction,
6467
6070
  {
6468
6071
  provenance,
6469
6072
  reportId
6470
6073
  }
6471
6074
  ),
6472
- /* @__PURE__ */ jsx45(MenuDivider, {}),
6473
- /* @__PURE__ */ jsx45(
6075
+ /* @__PURE__ */ jsx35(MenuDivider, {}),
6076
+ /* @__PURE__ */ jsx35(
6474
6077
  DownloadReportAction,
6475
6078
  {
6476
6079
  documentId,
6477
6080
  reportId
6478
6081
  }
6479
6082
  ),
6480
- /* @__PURE__ */ jsx45(CopyReportAction, { documentId }),
6481
- /* @__PURE__ */ jsx45(CopyVisionQueryAction, { reportId }),
6482
- /* @__PURE__ */ jsx45(MenuDivider, {}),
6483
- /* @__PURE__ */ jsx45(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6083
+ /* @__PURE__ */ jsx35(CopyReportAction, { documentId }),
6084
+ /* @__PURE__ */ jsx35(CopyVisionQueryAction, { reportId }),
6085
+ /* @__PURE__ */ jsx35(MenuDivider, {}),
6086
+ /* @__PURE__ */ jsx35(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6484
6087
  ] }),
6485
6088
  popover: { placement: "bottom-end", portal: true }
6486
6089
  }
6487
6090
  )
6488
6091
  ] }),
6489
- deleteDialogOpen && /* @__PURE__ */ jsx45(
6092
+ deleteDialogOpen && /* @__PURE__ */ jsx35(
6490
6093
  DeleteConfirmDialog,
6491
6094
  {
6492
6095
  isDeleting: deleting,
@@ -6499,7 +6102,7 @@ function ReportActions({
6499
6102
  }
6500
6103
 
6501
6104
  // src/components/report-detail/ReportHeader.tsx
6502
- import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
6105
+ import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
6503
6106
  function ReportHeader({
6504
6107
  completedAt,
6505
6108
  documentId,
@@ -6514,16 +6117,16 @@ function ReportHeader({
6514
6117
  const dateLabel = formatCardDate(completedAt);
6515
6118
  const title = tag ?? dateLabel;
6516
6119
  const hasTag = Boolean(tag);
6517
- return /* @__PURE__ */ jsxs33(Flex26, { align: "center", gap: 3, children: [
6518
- /* @__PURE__ */ jsx46(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
6519
- /* @__PURE__ */ jsxs33(Stack23, { flex: 1, space: 1, children: [
6520
- /* @__PURE__ */ jsx46(Text32, { size: 4, weight: "bold", children: title }),
6521
- hasTag && /* @__PURE__ */ jsx46(Text32, { muted: true, size: 2, children: dateLabel })
6120
+ return /* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 3, children: [
6121
+ /* @__PURE__ */ jsx36(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
6122
+ /* @__PURE__ */ jsxs25(Stack20, { flex: 1, space: 1, children: [
6123
+ /* @__PURE__ */ jsx36(Text25, { size: 4, weight: "bold", children: title }),
6124
+ hasTag && /* @__PURE__ */ jsx36(Text25, { muted: true, size: 2, children: dateLabel })
6522
6125
  ] }),
6523
- /* @__PURE__ */ jsxs33(Flex26, { align: "center", gap: 2, children: [
6524
- /* @__PURE__ */ jsx46(Badge21, { mode: "outline", tone: "default", children: sourceName }),
6525
- /* @__PURE__ */ jsx46(Badge21, { tone: "primary", children: mode }),
6526
- /* @__PURE__ */ jsx46(
6126
+ /* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 2, children: [
6127
+ /* @__PURE__ */ jsx36(Badge10, { mode: "outline", tone: "default", children: sourceName }),
6128
+ /* @__PURE__ */ jsx36(Badge10, { tone: "primary", children: mode }),
6129
+ /* @__PURE__ */ jsx36(
6527
6130
  ReportActions,
6528
6131
  {
6529
6132
  documentId,
@@ -6538,18 +6141,18 @@ function ReportHeader({
6538
6141
 
6539
6142
  // src/components/report-detail/ThreeLayerTable.tsx
6540
6143
  import React5 from "react";
6541
- import { Badge as Badge22, Card as Card23, Flex as Flex27, Stack as Stack24, Text as Text33 } from "@sanity/ui";
6542
- import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
6144
+ import { Badge as Badge11, Card as Card18, Flex as Flex20, Stack as Stack21, Text as Text26 } from "@sanity/ui";
6145
+ import { jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
6543
6146
  function ThreeLayerTable({ scores }) {
6544
6147
  const filtered = scores.filter((s) => s.actualScore != null);
6545
6148
  if (filtered.length === 0) return null;
6546
6149
  const hasInverted = filtered.some((s) => s.invertedRetrievalGap);
6547
- return /* @__PURE__ */ jsx47(Card23, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs34(Stack24, { space: 4, children: [
6548
- /* @__PURE__ */ jsxs34(Flex27, { align: "center", gap: 3, children: [
6549
- /* @__PURE__ */ jsx47(Text33, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
6550
- /* @__PURE__ */ jsx47(Badge22, { tone: "primary", children: "full mode" })
6150
+ return /* @__PURE__ */ jsx37(Card18, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs26(Stack21, { space: 4, children: [
6151
+ /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 3, children: [
6152
+ /* @__PURE__ */ jsx37(Text26, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
6153
+ /* @__PURE__ */ jsx37(Badge11, { tone: "primary", children: "full mode" })
6551
6154
  ] }),
6552
- /* @__PURE__ */ jsxs34(
6155
+ /* @__PURE__ */ jsxs26(
6553
6156
  "div",
6554
6157
  {
6555
6158
  style: {
@@ -6558,9 +6161,9 @@ function ThreeLayerTable({ scores }) {
6558
6161
  gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr"
6559
6162
  },
6560
6163
  children: [
6561
- /* @__PURE__ */ jsx47(ColumnHeader, { borderBottom: true, label: "Area" }),
6562
- /* @__PURE__ */ jsx47(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
6563
- /* @__PURE__ */ jsx47(
6164
+ /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Area" }),
6165
+ /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
6166
+ /* @__PURE__ */ jsx37(
6564
6167
  ColumnHeader,
6565
6168
  {
6566
6169
  borderBottom: true,
@@ -6568,8 +6171,8 @@ function ThreeLayerTable({ scores }) {
6568
6171
  tooltip: GLOSSARY.ceiling
6569
6172
  }
6570
6173
  ),
6571
- /* @__PURE__ */ jsx47(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
6572
- /* @__PURE__ */ jsx47(
6174
+ /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
6175
+ /* @__PURE__ */ jsx37(
6573
6176
  ColumnHeader,
6574
6177
  {
6575
6178
  borderBottom: true,
@@ -6577,7 +6180,7 @@ function ThreeLayerTable({ scores }) {
6577
6180
  tooltip: GLOSSARY.retGap
6578
6181
  }
6579
6182
  ),
6580
- /* @__PURE__ */ jsx47(
6183
+ /* @__PURE__ */ jsx37(
6581
6184
  ColumnHeader,
6582
6185
  {
6583
6186
  borderBottom: true,
@@ -6585,8 +6188,8 @@ function ThreeLayerTable({ scores }) {
6585
6188
  tooltip: GLOSSARY.efficiency
6586
6189
  }
6587
6190
  ),
6588
- filtered.map((score, i) => /* @__PURE__ */ jsxs34(React5.Fragment, { children: [
6589
- /* @__PURE__ */ jsx47(
6191
+ filtered.map((score, i) => /* @__PURE__ */ jsxs26(React5.Fragment, { children: [
6192
+ /* @__PURE__ */ jsx37(
6590
6193
  "div",
6591
6194
  {
6592
6195
  style: {
@@ -6594,10 +6197,10 @@ function ThreeLayerTable({ scores }) {
6594
6197
  borderRadius: 4,
6595
6198
  padding: "8px 0 8px 4px"
6596
6199
  },
6597
- children: /* @__PURE__ */ jsx47(Text33, { size: 2, weight: "medium", children: score.feature })
6200
+ children: /* @__PURE__ */ jsx37(Text26, { size: 2, weight: "medium", children: score.feature })
6598
6201
  }
6599
6202
  ),
6600
- /* @__PURE__ */ jsx47(
6203
+ /* @__PURE__ */ jsx37(
6601
6204
  "div",
6602
6205
  {
6603
6206
  style: {
@@ -6605,10 +6208,10 @@ function ThreeLayerTable({ scores }) {
6605
6208
  display: "flex",
6606
6209
  padding: "2px 0"
6607
6210
  },
6608
- children: /* @__PURE__ */ jsx47(ScoreCell, { score: score.floorScore ?? 0 })
6211
+ children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.floorScore ?? 0 })
6609
6212
  }
6610
6213
  ),
6611
- /* @__PURE__ */ jsx47(
6214
+ /* @__PURE__ */ jsx37(
6612
6215
  "div",
6613
6216
  {
6614
6217
  style: {
@@ -6616,10 +6219,10 @@ function ThreeLayerTable({ scores }) {
6616
6219
  display: "flex",
6617
6220
  padding: "2px 0"
6618
6221
  },
6619
- children: /* @__PURE__ */ jsx47(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
6222
+ children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
6620
6223
  }
6621
6224
  ),
6622
- /* @__PURE__ */ jsx47(
6225
+ /* @__PURE__ */ jsx37(
6623
6226
  "div",
6624
6227
  {
6625
6228
  style: {
@@ -6627,10 +6230,10 @@ function ThreeLayerTable({ scores }) {
6627
6230
  display: "flex",
6628
6231
  padding: "2px 0"
6629
6232
  },
6630
- children: /* @__PURE__ */ jsx47(ScoreCell, { score: score.actualScore ?? 0 })
6233
+ children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.actualScore ?? 0 })
6631
6234
  }
6632
6235
  ),
6633
- /* @__PURE__ */ jsx47(
6236
+ /* @__PURE__ */ jsx37(
6634
6237
  "div",
6635
6238
  {
6636
6239
  style: {
@@ -6639,10 +6242,10 @@ function ThreeLayerTable({ scores }) {
6639
6242
  display: "flex",
6640
6243
  padding: "6px 0"
6641
6244
  },
6642
- children: /* @__PURE__ */ jsx47(Text33, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
6245
+ children: /* @__PURE__ */ jsx37(Text26, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
6643
6246
  }
6644
6247
  ),
6645
- /* @__PURE__ */ jsx47(
6248
+ /* @__PURE__ */ jsx37(
6646
6249
  "div",
6647
6250
  {
6648
6251
  style: {
@@ -6651,7 +6254,7 @@ function ThreeLayerTable({ scores }) {
6651
6254
  display: "flex",
6652
6255
  padding: "6px 0"
6653
6256
  },
6654
- children: /* @__PURE__ */ jsxs34(Text33, { size: 2, children: [
6257
+ children: /* @__PURE__ */ jsxs26(Text26, { size: 2, children: [
6655
6258
  formatPercent(score.infrastructureEfficiency),
6656
6259
  score.invertedRetrievalGap && " \u26A0\uFE0F"
6657
6260
  ] })
@@ -6661,12 +6264,12 @@ function ThreeLayerTable({ scores }) {
6661
6264
  ]
6662
6265
  }
6663
6266
  ),
6664
- hasInverted && /* @__PURE__ */ jsx47(Text33, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
6267
+ hasInverted && /* @__PURE__ */ jsx37(Text26, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
6665
6268
  ] }) });
6666
6269
  }
6667
6270
 
6668
6271
  // src/components/report-detail/ReportDetail.tsx
6669
- import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
6272
+ import { jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
6670
6273
  var OVERVIEW_TAB = { id: "overview", label: "Overview" };
6671
6274
  var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
6672
6275
  var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
@@ -6680,10 +6283,10 @@ function ReportDetail({
6680
6283
  onTabChange,
6681
6284
  reportId
6682
6285
  }) {
6683
- const client = useClient12({ apiVersion: API_VERSION });
6684
- const [loading, setLoading] = useState15(true);
6685
- const [report, setReport] = useState15(null);
6686
- useEffect9(() => {
6286
+ const client = useClient10({ apiVersion: API_VERSION });
6287
+ const [loading, setLoading] = useState13(true);
6288
+ const [report, setReport] = useState13(null);
6289
+ useEffect7(() => {
6687
6290
  let cancelled = false;
6688
6291
  setLoading(true);
6689
6292
  client.fetch(reportDetailQuery, { reportId }).then((data) => {
@@ -6705,33 +6308,33 @@ function ReportDetail({
6705
6308
  const hasAgentActivity = Boolean(
6706
6309
  summary?.agentBehavior && summary.agentBehavior.length > 0
6707
6310
  );
6708
- const tabs = useMemo7(
6311
+ const tabs = useMemo6(
6709
6312
  () => [OVERVIEW_TAB, DIAGNOSTICS_TAB, ACTIVITY_TAB],
6710
6313
  []
6711
6314
  );
6712
- const disabledTabs = useMemo7(() => {
6315
+ const disabledTabs = useMemo6(() => {
6713
6316
  const set2 = /* @__PURE__ */ new Set();
6714
6317
  if (!hasDiagnostics) set2.add("diagnostics");
6715
6318
  if (!hasAgentActivity) set2.add("activity");
6716
6319
  return set2;
6717
6320
  }, [hasDiagnostics, hasAgentActivity]);
6718
- const currentTab = useMemo7(() => {
6321
+ const currentTab = useMemo6(() => {
6719
6322
  const parsed = parseTab(activeTab);
6720
6323
  if (disabledTabs.has(parsed)) return "overview";
6721
6324
  return tabs.some((t) => t.id === parsed) ? parsed : "overview";
6722
6325
  }, [activeTab, disabledTabs, tabs]);
6723
- const handleTabClick = useCallback20(
6326
+ const handleTabClick = useCallback18(
6724
6327
  (tabId) => {
6725
6328
  onTabChange(tabId === "overview" ? null : tabId);
6726
6329
  },
6727
6330
  [onTabChange]
6728
6331
  );
6729
6332
  if (loading) {
6730
- return /* @__PURE__ */ jsx48(LoadingState, { message: "Loading report\u2026" });
6333
+ return /* @__PURE__ */ jsx38(LoadingState, { message: "Loading report\u2026" });
6731
6334
  }
6732
6335
  if (!report || !summary) {
6733
- return /* @__PURE__ */ jsx48(Box15, { padding: 5, children: /* @__PURE__ */ jsxs35(Stack25, { space: 4, children: [
6734
- /* @__PURE__ */ jsx48(
6336
+ return /* @__PURE__ */ jsx38(Box14, { padding: 5, children: /* @__PURE__ */ jsxs27(Stack22, { space: 4, children: [
6337
+ /* @__PURE__ */ jsx38(
6735
6338
  Button5,
6736
6339
  {
6737
6340
  icon: ArrowLeftIcon2,
@@ -6740,14 +6343,14 @@ function ReportDetail({
6740
6343
  text: "Back"
6741
6344
  }
6742
6345
  ),
6743
- /* @__PURE__ */ jsx48(Text34, { align: "center", muted: true, size: 3, children: "Report not found" })
6346
+ /* @__PURE__ */ jsx38(Text27, { align: "center", muted: true, size: 3, children: "Report not found" })
6744
6347
  ] }) });
6745
6348
  }
6746
6349
  const { comparison, provenance } = report;
6747
6350
  const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
6748
6351
  const isFullMode = summary.evaluationMode === "full" || summary.scores.some((s) => s.actualScore != null);
6749
- return /* @__PURE__ */ jsx48(Box15, { padding: 4, children: /* @__PURE__ */ jsxs35(Stack25, { space: 5, children: [
6750
- /* @__PURE__ */ jsx48(
6352
+ return /* @__PURE__ */ jsx38(Box14, { padding: 4, children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
6353
+ /* @__PURE__ */ jsx38(
6751
6354
  ReportHeader,
6752
6355
  {
6753
6356
  completedAt: report.completedAt,
@@ -6761,10 +6364,10 @@ function ReportDetail({
6761
6364
  tag: report.tag
6762
6365
  }
6763
6366
  ),
6764
- /* @__PURE__ */ jsx48(TabList, { space: 1, children: tabs.map((tab) => {
6367
+ /* @__PURE__ */ jsx38(TabList, { space: 1, children: tabs.map((tab) => {
6765
6368
  const isDisabled = disabledTabs.has(tab.id);
6766
6369
  const tooltip = getDisabledTabTooltip(tab.id, summary);
6767
- const tabElement = /* @__PURE__ */ jsx48(
6370
+ const tabElement = /* @__PURE__ */ jsx38(
6768
6371
  Tab,
6769
6372
  {
6770
6373
  "aria-controls": `panel-${tab.id}`,
@@ -6775,25 +6378,25 @@ function ReportDetail({
6775
6378
  selected: currentTab === tab.id
6776
6379
  }
6777
6380
  );
6778
- return isDisabled && tooltip ? /* @__PURE__ */ jsx48(
6381
+ return isDisabled && tooltip ? /* @__PURE__ */ jsx38(
6779
6382
  Tooltip8,
6780
6383
  {
6781
- content: /* @__PURE__ */ jsx48(Box15, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
6384
+ content: /* @__PURE__ */ jsx38(Box14, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
6782
6385
  placement: "bottom",
6783
6386
  portal: true,
6784
- children: /* @__PURE__ */ jsx48("span", { style: { display: "inline-block" }, children: tabElement })
6387
+ children: /* @__PURE__ */ jsx38("span", { style: { display: "inline-block" }, children: tabElement })
6785
6388
  },
6786
6389
  tab.id
6787
- ) : /* @__PURE__ */ jsx48("span", { children: tabElement }, tab.id);
6390
+ ) : /* @__PURE__ */ jsx38("span", { children: tabElement }, tab.id);
6788
6391
  }) }),
6789
- currentTab === "overview" && /* @__PURE__ */ jsx48(
6392
+ currentTab === "overview" && /* @__PURE__ */ jsx38(
6790
6393
  TabPanel,
6791
6394
  {
6792
6395
  "aria-labelledby": "tab-overview",
6793
6396
  hidden: currentTab !== "overview",
6794
6397
  id: "panel-overview",
6795
- children: /* @__PURE__ */ jsxs35(Stack25, { space: 5, children: [
6796
- /* @__PURE__ */ jsx48(
6398
+ children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
6399
+ /* @__PURE__ */ jsx38(
6797
6400
  OverviewStats,
6798
6401
  {
6799
6402
  durationMs: report.durationMs,
@@ -6802,38 +6405,38 @@ function ReportDetail({
6802
6405
  totalTests
6803
6406
  }
6804
6407
  ),
6805
- isFullMode && /* @__PURE__ */ jsx48(ThreeLayerTable, { scores: summary.scores }),
6806
- /* @__PURE__ */ jsx48(AreaScoreTable, { scores: summary.scores }),
6807
- comparison && /* @__PURE__ */ jsx48(ComparisonSummary, { comparison }),
6808
- /* @__PURE__ */ jsx48(LineageCard, { provenance, reportId: report.reportId }),
6809
- /* @__PURE__ */ jsx48(ProvenanceCard, { provenance })
6408
+ isFullMode && /* @__PURE__ */ jsx38(ThreeLayerTable, { scores: summary.scores }),
6409
+ /* @__PURE__ */ jsx38(AreaScoreTable, { scores: summary.scores }),
6410
+ comparison && /* @__PURE__ */ jsx38(ComparisonSummary, { comparison }),
6411
+ /* @__PURE__ */ jsx38(LineageCard, { provenance, reportId: report.reportId }),
6412
+ /* @__PURE__ */ jsx38(ProvenanceCard, { provenance })
6810
6413
  ] })
6811
6414
  }
6812
6415
  ),
6813
- currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx48(
6416
+ currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx38(
6814
6417
  TabPanel,
6815
6418
  {
6816
6419
  "aria-labelledby": "tab-diagnostics",
6817
6420
  hidden: currentTab !== "diagnostics",
6818
6421
  id: "panel-diagnostics",
6819
- children: /* @__PURE__ */ jsxs35(Stack25, { space: 5, children: [
6820
- summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx48(
6422
+ children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
6423
+ summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx38(
6821
6424
  RecommendationsSection,
6822
6425
  {
6823
6426
  recommendations: summary.recommendations
6824
6427
  }
6825
6428
  ),
6826
- summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx48(JudgmentList, { judgments: summary.lowScoringJudgments })
6429
+ summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx38(JudgmentList, { judgments: summary.lowScoringJudgments })
6827
6430
  ] })
6828
6431
  }
6829
6432
  ),
6830
- currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx48(
6433
+ currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx38(
6831
6434
  TabPanel,
6832
6435
  {
6833
6436
  "aria-labelledby": "tab-activity",
6834
6437
  hidden: currentTab !== "activity",
6835
6438
  id: "panel-activity",
6836
- children: /* @__PURE__ */ jsx48(
6439
+ children: /* @__PURE__ */ jsx38(
6837
6440
  AgentActivitySection,
6838
6441
  {
6839
6442
  agentBehavior: summary.agentBehavior,
@@ -6855,27 +6458,27 @@ function getDisabledTabTooltip(tabId, summary) {
6855
6458
  if (!summary) return null;
6856
6459
  switch (tabId) {
6857
6460
  case "diagnostics":
6858
- return /* @__PURE__ */ jsx48(Text34, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
6461
+ return /* @__PURE__ */ jsx38(Text27, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
6859
6462
  case "activity":
6860
- return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs35(Text34, { muted: true, size: 2, children: [
6463
+ return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs27(Text27, { muted: true, size: 2, children: [
6861
6464
  "Not available for baseline-only evaluations. Run with",
6862
6465
  " ",
6863
- /* @__PURE__ */ jsx48("code", { style: inlineCodeStyle, children: "--mode full" }),
6466
+ /* @__PURE__ */ jsx38("code", { style: inlineCodeStyle, children: "--mode full" }),
6864
6467
  " or",
6865
6468
  " ",
6866
- /* @__PURE__ */ jsx48("code", { style: inlineCodeStyle, children: "--mode agentic" }),
6469
+ /* @__PURE__ */ jsx38("code", { style: inlineCodeStyle, children: "--mode agentic" }),
6867
6470
  " to capture agent browsing behavior."
6868
- ] }) : /* @__PURE__ */ jsx48(Text34, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
6471
+ ] }) : /* @__PURE__ */ jsx38(Text27, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
6869
6472
  default:
6870
6473
  return null;
6871
6474
  }
6872
6475
  }
6873
6476
 
6874
6477
  // src/components/ScoreTimeline.tsx
6875
- import { Card as Card24, Flex as Flex28, Select as Select2, Stack as Stack26, Text as Text35 } from "@sanity/ui";
6876
- import { useCallback as useCallback21, useEffect as useEffect10, useMemo as useMemo8, useState as useState16 } from "react";
6877
- import { useClient as useClient13 } from "sanity";
6878
- import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
6478
+ import { Card as Card19, Flex as Flex21, Select as Select2, Stack as Stack23, Text as Text28 } from "@sanity/ui";
6479
+ import { useCallback as useCallback19, useEffect as useEffect8, useMemo as useMemo7, useState as useState14 } from "react";
6480
+ import { useClient as useClient11 } from "sanity";
6481
+ import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
6879
6482
  var CHART_HEIGHT = 220;
6880
6483
  var CHART_WIDTH = 800;
6881
6484
  var PAD_BOTTOM = 30;
@@ -6897,7 +6500,7 @@ function daysAgo(n) {
6897
6500
  d.setDate(d.getDate() - n);
6898
6501
  return d.toISOString();
6899
6502
  }
6900
- function formatDate2(iso) {
6503
+ function formatDate(iso) {
6901
6504
  return new Date(iso).toLocaleDateString(void 0, {
6902
6505
  day: "numeric",
6903
6506
  month: "short"
@@ -6909,12 +6512,12 @@ function scoreForPoint(point, area) {
6909
6512
  return match?.totalScore ?? null;
6910
6513
  }
6911
6514
  function ScoreTimeline({ mode = null, source = null }) {
6912
- const client = useClient13({ apiVersion: API_VERSION });
6913
- const [dataPoints, setDataPoints] = useState16([]);
6914
- const [loading, setLoading] = useState16(true);
6915
- const [rangeDays, setRangeDays] = useState16(30);
6916
- const [selectedArea, setSelectedArea] = useState16(null);
6917
- const areaNames = useMemo8(() => {
6515
+ const client = useClient11({ apiVersion: API_VERSION });
6516
+ const [dataPoints, setDataPoints] = useState14([]);
6517
+ const [loading, setLoading] = useState14(true);
6518
+ const [rangeDays, setRangeDays] = useState14(30);
6519
+ const [selectedArea, setSelectedArea] = useState14(null);
6520
+ const areaNames = useMemo7(() => {
6918
6521
  const names = /* @__PURE__ */ new Set();
6919
6522
  for (const dp of dataPoints) {
6920
6523
  for (const s of dp.scores) {
@@ -6923,7 +6526,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6923
6526
  }
6924
6527
  return Array.from(names).sort();
6925
6528
  }, [dataPoints]);
6926
- const fetchData = useCallback21(async () => {
6529
+ const fetchData = useCallback19(async () => {
6927
6530
  setLoading(true);
6928
6531
  try {
6929
6532
  const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
@@ -6938,10 +6541,10 @@ function ScoreTimeline({ mode = null, source = null }) {
6938
6541
  setLoading(false);
6939
6542
  }
6940
6543
  }, [client, mode, rangeDays, source]);
6941
- useEffect10(() => {
6544
+ useEffect8(() => {
6942
6545
  void fetchData();
6943
6546
  }, [fetchData]);
6944
- const chartPoints = useMemo8(() => {
6547
+ const chartPoints = useMemo7(() => {
6945
6548
  const pts = [];
6946
6549
  const scored = dataPoints.map((dp) => ({
6947
6550
  date: dp.completedAt,
@@ -6955,18 +6558,18 @@ function ScoreTimeline({ mode = null, source = null }) {
6955
6558
  });
6956
6559
  return pts;
6957
6560
  }, [dataPoints, selectedArea]);
6958
- const avgScore = useMemo8(() => {
6561
+ const avgScore = useMemo7(() => {
6959
6562
  if (chartPoints.length === 0) return 0;
6960
6563
  return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
6961
6564
  }, [chartPoints]);
6962
- const handleRangeChange = useCallback21(
6565
+ const handleRangeChange = useCallback19(
6963
6566
  (e) => {
6964
6567
  const val = e.currentTarget.value;
6965
6568
  setRangeDays(val === "all" ? null : Number(val));
6966
6569
  },
6967
6570
  []
6968
6571
  );
6969
- const handleAreaChange = useCallback21(
6572
+ const handleAreaChange = useCallback19(
6970
6573
  (e) => {
6971
6574
  const val = e.currentTarget.value;
6972
6575
  setSelectedArea(val || null);
@@ -6974,22 +6577,22 @@ function ScoreTimeline({ mode = null, source = null }) {
6974
6577
  []
6975
6578
  );
6976
6579
  const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
6977
- return /* @__PURE__ */ jsxs36(Stack26, { space: 4, children: [
6978
- /* @__PURE__ */ jsxs36(Flex28, { gap: 3, children: [
6979
- /* @__PURE__ */ jsx49(
6580
+ return /* @__PURE__ */ jsxs28(Stack23, { space: 4, children: [
6581
+ /* @__PURE__ */ jsxs28(Flex21, { gap: 3, children: [
6582
+ /* @__PURE__ */ jsx39(
6980
6583
  Select2,
6981
6584
  {
6982
6585
  onChange: handleRangeChange,
6983
6586
  value: rangeDays?.toString() ?? "all",
6984
- children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx49("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
6587
+ children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx39("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
6985
6588
  }
6986
6589
  ),
6987
- /* @__PURE__ */ jsxs36(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
6988
- /* @__PURE__ */ jsx49("option", { value: "", children: "Overall" }),
6989
- areaNames.map((name) => /* @__PURE__ */ jsx49("option", { value: name, children: name }, name))
6590
+ /* @__PURE__ */ jsxs28(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
6591
+ /* @__PURE__ */ jsx39("option", { value: "", children: "Overall" }),
6592
+ areaNames.map((name) => /* @__PURE__ */ jsx39("option", { value: name, children: name }, name))
6990
6593
  ] })
6991
6594
  ] }),
6992
- /* @__PURE__ */ jsx49(Card24, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx49(Flex28, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx49(Text35, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx49(Flex28, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx49(Text35, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs36(
6595
+ /* @__PURE__ */ jsx39(Card19, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx39(Flex21, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx39(Text28, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx39(Flex21, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx39(Text28, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs28(
6993
6596
  "svg",
6994
6597
  {
6995
6598
  style: { display: "block", width: "100%" },
@@ -6997,8 +6600,8 @@ function ScoreTimeline({ mode = null, source = null }) {
6997
6600
  children: [
6998
6601
  Y_TICKS.map((tick) => {
6999
6602
  const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
7000
- return /* @__PURE__ */ jsxs36("g", { children: [
7001
- /* @__PURE__ */ jsx49(
6603
+ return /* @__PURE__ */ jsxs28("g", { children: [
6604
+ /* @__PURE__ */ jsx39(
7002
6605
  "line",
7003
6606
  {
7004
6607
  stroke: "#ccc",
@@ -7009,7 +6612,7 @@ function ScoreTimeline({ mode = null, source = null }) {
7009
6612
  y2: y
7010
6613
  }
7011
6614
  ),
7012
- /* @__PURE__ */ jsx49(
6615
+ /* @__PURE__ */ jsx39(
7013
6616
  "text",
7014
6617
  {
7015
6618
  dominantBaseline: "middle",
@@ -7029,7 +6632,7 @@ function ScoreTimeline({ mode = null, source = null }) {
7029
6632
  chartPoints.length - 1
7030
6633
  ].map((idx) => {
7031
6634
  const p = chartPoints[idx];
7032
- return /* @__PURE__ */ jsx49(
6635
+ return /* @__PURE__ */ jsx39(
7033
6636
  "text",
7034
6637
  {
7035
6638
  fill: "#999",
@@ -7037,11 +6640,11 @@ function ScoreTimeline({ mode = null, source = null }) {
7037
6640
  textAnchor: "middle",
7038
6641
  x: p.x,
7039
6642
  y: CHART_HEIGHT - 6,
7040
- children: formatDate2(p.date)
6643
+ children: formatDate(p.date)
7041
6644
  },
7042
6645
  idx
7043
6646
  );
7044
- }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx49(
6647
+ }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx39(
7045
6648
  "text",
7046
6649
  {
7047
6650
  fill: "#999",
@@ -7049,11 +6652,11 @@ function ScoreTimeline({ mode = null, source = null }) {
7049
6652
  textAnchor: "middle",
7050
6653
  x: p.x,
7051
6654
  y: CHART_HEIGHT - 6,
7052
- children: formatDate2(p.date)
6655
+ children: formatDate(p.date)
7053
6656
  },
7054
6657
  idx
7055
6658
  )),
7056
- /* @__PURE__ */ jsx49(
6659
+ /* @__PURE__ */ jsx39(
7057
6660
  "polyline",
7058
6661
  {
7059
6662
  fill: "none",
@@ -7063,7 +6666,7 @@ function ScoreTimeline({ mode = null, source = null }) {
7063
6666
  strokeWidth: 2.5
7064
6667
  }
7065
6668
  ),
7066
- chartPoints.map((p, idx) => /* @__PURE__ */ jsx49(
6669
+ chartPoints.map((p, idx) => /* @__PURE__ */ jsx39(
7067
6670
  "circle",
7068
6671
  {
7069
6672
  cx: p.x,
@@ -7072,8 +6675,8 @@ function ScoreTimeline({ mode = null, source = null }) {
7072
6675
  r: 4,
7073
6676
  stroke: "#fff",
7074
6677
  strokeWidth: 1.5,
7075
- children: /* @__PURE__ */ jsxs36("title", { children: [
7076
- formatDate2(p.date),
6678
+ children: /* @__PURE__ */ jsxs28("title", { children: [
6679
+ formatDate(p.date),
7077
6680
  ": ",
7078
6681
  Math.round(p.score)
7079
6682
  ] })
@@ -7083,7 +6686,7 @@ function ScoreTimeline({ mode = null, source = null }) {
7083
6686
  ]
7084
6687
  }
7085
6688
  ) }),
7086
- /* @__PURE__ */ jsxs36(Text35, { muted: true, size: 2, children: [
6689
+ /* @__PURE__ */ jsxs28(Text28, { muted: true, size: 2, children: [
7087
6690
  chartPoints.length,
7088
6691
  " data point",
7089
6692
  chartPoints.length !== 1 ? "s" : ""
@@ -7093,19 +6696,18 @@ function ScoreTimeline({ mode = null, source = null }) {
7093
6696
  var ScoreTimeline_default = ScoreTimeline;
7094
6697
 
7095
6698
  // src/components/Dashboard.tsx
7096
- import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
6699
+ import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
7097
6700
  var VIEW_PARAM_MAP = {
7098
6701
  compare: "compare",
7099
6702
  timeline: "timeline"
7100
6703
  };
7101
6704
  function Dashboard() {
7102
- const client = useClient14({ apiVersion: API_VERSION });
7103
- const router = useRouter2();
6705
+ const router = useRouter3();
7104
6706
  const routerState = router.state;
7105
6707
  const reportId = routerState.reportId ?? null;
7106
6708
  const isDetail = reportId !== null;
7107
6709
  const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
7108
- const navigateToTab = useCallback22(
6710
+ const navigateToTab = useCallback20(
7109
6711
  (tab) => {
7110
6712
  if (tab === "latest") {
7111
6713
  router.navigate({});
@@ -7115,13 +6717,13 @@ function Dashboard() {
7115
6717
  },
7116
6718
  [router]
7117
6719
  );
7118
- const handleSelectReport = useCallback22(
6720
+ const handleSelectReport = useCallback20(
7119
6721
  (id) => {
7120
6722
  router.navigate({ reportId: id });
7121
6723
  },
7122
6724
  [router]
7123
6725
  );
7124
- const handleTabChange = useCallback22(
6726
+ const handleTabChange = useCallback20(
7125
6727
  (tab) => {
7126
6728
  if (!routerState.reportId) return;
7127
6729
  if (tab) {
@@ -7132,52 +6734,16 @@ function Dashboard() {
7132
6734
  },
7133
6735
  [router, routerState.reportId]
7134
6736
  );
7135
- const handleBack = useCallback22(() => {
6737
+ const handleBack = useCallback20(() => {
7136
6738
  router.navigate({});
7137
6739
  }, [router]);
7138
- const [source, setSource] = useState17(null);
7139
- const [mode, setMode] = useState17(null);
7140
- const [sources, setSources] = useState17([]);
7141
- const [modes, setModes] = useState17([]);
7142
- useEffect11(() => {
7143
- client.fetch(distinctSourcesQuery).then((data) => setSources(data ?? [])).catch(() => setSources([]));
7144
- client.fetch(distinctModesQuery).then((data) => setModes(data ?? [])).catch(() => setModes([]));
7145
- }, [client]);
7146
- return /* @__PURE__ */ jsx50(Container, { width: 2, children: /* @__PURE__ */ jsxs37(Stack27, { padding: 4, space: 4, children: [
7147
- /* @__PURE__ */ jsxs37(Flex29, { align: "center", gap: 3, children: [
7148
- /* @__PURE__ */ jsxs37(Stack27, { flex: 1, space: 1, children: [
7149
- /* @__PURE__ */ jsx50(Text36, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
7150
- /* @__PURE__ */ jsx50(Text36, { muted: true, size: 2, children: "Evaluation reports and score trends" })
7151
- ] }),
7152
- !isDetail && /* @__PURE__ */ jsxs37(Flex29, { gap: 2, children: [
7153
- /* @__PURE__ */ jsxs37(
7154
- Select3,
7155
- {
7156
- fontSize: 2,
7157
- onChange: (e) => setSource(e.currentTarget.value || null),
7158
- value: source ?? "",
7159
- children: [
7160
- /* @__PURE__ */ jsx50("option", { value: "", children: "All sources" }),
7161
- sources.map((s) => /* @__PURE__ */ jsx50("option", { value: s, children: s }, s))
7162
- ]
7163
- }
7164
- ),
7165
- /* @__PURE__ */ jsxs37(
7166
- Select3,
7167
- {
7168
- fontSize: 2,
7169
- onChange: (e) => setMode(e.currentTarget.value || null),
7170
- value: mode ?? "",
7171
- children: [
7172
- /* @__PURE__ */ jsx50("option", { value: "", children: "All modes" }),
7173
- modes.map((m) => /* @__PURE__ */ jsx50("option", { value: m, children: m }, m))
7174
- ]
7175
- }
7176
- )
7177
- ] })
7178
- ] }),
7179
- !isDetail && /* @__PURE__ */ jsxs37(TabList2, { space: 1, children: [
7180
- /* @__PURE__ */ jsx50(
6740
+ return /* @__PURE__ */ jsx40(Container, { width: 4, children: /* @__PURE__ */ jsxs29(Stack24, { padding: 4, space: 4, children: [
6741
+ /* @__PURE__ */ jsx40(Flex22, { align: "center", gap: 3, children: /* @__PURE__ */ jsxs29(Stack24, { flex: 1, space: 1, children: [
6742
+ /* @__PURE__ */ jsx40(Text29, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
6743
+ /* @__PURE__ */ jsx40(Text29, { muted: true, size: 2, children: "Evaluation reports and score trends" })
6744
+ ] }) }),
6745
+ !isDetail && /* @__PURE__ */ jsxs29(TabList2, { space: 1, children: [
6746
+ /* @__PURE__ */ jsx40(
7181
6747
  Tab2,
7182
6748
  {
7183
6749
  "aria-controls": "latest-panel",
@@ -7187,7 +6753,7 @@ function Dashboard() {
7187
6753
  selected: activeTab === "latest"
7188
6754
  }
7189
6755
  ),
7190
- /* @__PURE__ */ jsx50(
6756
+ /* @__PURE__ */ jsx40(
7191
6757
  Tab2,
7192
6758
  {
7193
6759
  "aria-controls": "timeline-panel",
@@ -7197,7 +6763,7 @@ function Dashboard() {
7197
6763
  selected: activeTab === "timeline"
7198
6764
  }
7199
6765
  ),
7200
- /* @__PURE__ */ jsx50(
6766
+ /* @__PURE__ */ jsx40(
7201
6767
  Tab2,
7202
6768
  {
7203
6769
  "aria-controls": "compare-panel",
@@ -7208,17 +6774,10 @@ function Dashboard() {
7208
6774
  }
7209
6775
  )
7210
6776
  ] }),
7211
- !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx50(
7212
- LatestReports,
7213
- {
7214
- mode,
7215
- onSelectReport: handleSelectReport,
7216
- source
7217
- }
7218
- ) }),
7219
- !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx50(ScoreTimeline_default, { mode, source }) }),
7220
- !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx50(ComparisonView, {}) }),
7221
- isDetail && reportId && /* @__PURE__ */ jsx50(
6777
+ !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx40(LatestReports, { onSelectReport: handleSelectReport }) }),
6778
+ !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx40(ScoreTimeline_default, {}) }),
6779
+ !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx40(ComparisonView, {}) }),
6780
+ isDetail && reportId && /* @__PURE__ */ jsx40(
7222
6781
  ReportDetail,
7223
6782
  {
7224
6783
  activeTab: routerState.tab ?? null,
@@ -7248,10 +6807,10 @@ function ailfTool(options = {}) {
7248
6807
  // src/actions/RunEvaluationAction.tsx
7249
6808
  import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
7250
6809
  import { useToast as useToast8 } from "@sanity/ui";
7251
- import { useCallback as useCallback23, useEffect as useEffect12, useRef as useRef5, useState as useState18 } from "react";
6810
+ import { useCallback as useCallback21, useEffect as useEffect9, useRef as useRef4, useState as useState15 } from "react";
7252
6811
  import {
7253
- getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId4,
7254
- useClient as useClient15,
6812
+ getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId3,
6813
+ useClient as useClient12,
7255
6814
  useCurrentUser as useCurrentUser3,
7256
6815
  useDataset as useDataset2,
7257
6816
  useProjectId as useProjectId2
@@ -7274,15 +6833,15 @@ function createRunEvaluationAction(options = {}) {
7274
6833
  const { mode = "baseline" } = options;
7275
6834
  const RunEvaluationAction = (props) => {
7276
6835
  const { release } = props;
7277
- const client = useClient15({ apiVersion: API_VERSION2 });
6836
+ const client = useClient12({ apiVersion: API_VERSION2 });
7278
6837
  const dataset = useDataset2();
7279
6838
  const projectId = useProjectId2();
7280
6839
  const currentUser = useCurrentUser3();
7281
6840
  const toast = useToast8();
7282
- const [state, setState] = useState18({ status: "loading" });
7283
- const requestedAtRef = useRef5(null);
7284
- const perspectiveId = getReleaseIdFromReleaseDocumentId4(release._id);
7285
- useEffect12(() => {
6841
+ const [state, setState] = useState15({ status: "loading" });
6842
+ const requestedAtRef = useRef4(null);
6843
+ const perspectiveId = getReleaseIdFromReleaseDocumentId3(release._id);
6844
+ useEffect9(() => {
7286
6845
  let cancelled = false;
7287
6846
  client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
7288
6847
  if (cancelled) return;
@@ -7305,7 +6864,7 @@ function createRunEvaluationAction(options = {}) {
7305
6864
  cancelled = true;
7306
6865
  };
7307
6866
  }, [client, perspectiveId]);
7308
- useEffect12(() => {
6867
+ useEffect9(() => {
7309
6868
  if (state.status !== "requested" && state.status !== "polling") return;
7310
6869
  const { requestId, startedAt } = state;
7311
6870
  if (state.status === "requested") {
@@ -7355,7 +6914,7 @@ function createRunEvaluationAction(options = {}) {
7355
6914
  }, POLL_INTERVAL_MS2);
7356
6915
  return () => clearInterval(interval);
7357
6916
  }, [client, perspectiveId, state]);
7358
- useEffect12(() => {
6917
+ useEffect9(() => {
7359
6918
  if (state.status !== "error") return;
7360
6919
  const timer = setTimeout(() => {
7361
6920
  client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
@@ -7375,7 +6934,7 @@ function createRunEvaluationAction(options = {}) {
7375
6934
  }, 15e3);
7376
6935
  return () => clearTimeout(timer);
7377
6936
  }, [client, perspectiveId, state]);
7378
- const handleRequest = useCallback23(async () => {
6937
+ const handleRequest = useCallback21(async () => {
7379
6938
  const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
7380
6939
  const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
7381
6940
  const now = Date.now();
@@ -7526,6 +7085,7 @@ export {
7526
7085
  distinctPerspectivesQuery,
7527
7086
  distinctSourcesQuery,
7528
7087
  distinctTargetDocumentsQuery,
7088
+ distinctTriggersQuery,
7529
7089
  evalRequestSchema,
7530
7090
  featureAreaSchema,
7531
7091
  latestReportsQuery,