@testver/testver 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +3 -1
  2. package/bin/testver.js +1 -1
  3. package/dist/index.js +1943 -1190
  4. package/package.json +2 -1
  5. package/src/ui/static/assets/AIPanel-KQFq4c0Q.js +32 -0
  6. package/src/ui/static/assets/AIRecordPanel-CAs8fXyS.js +40 -0
  7. package/src/ui/static/assets/AIStreamUI-p_sMTEDQ.js +9 -0
  8. package/src/ui/static/assets/{AITestGenPage-Cg21-P1W.js → AITestGenPage-CHaHfmu4.js} +5 -5
  9. package/src/ui/static/assets/APITestingPage-BSGJY_hd.js +19 -0
  10. package/src/ui/static/assets/{AboutPage-yJLCr2_q.js → AboutPage-CDa24SCJ.js} +1 -1
  11. package/src/ui/static/assets/AdvancedPage-BqXP0FLg.js +3 -0
  12. package/src/ui/static/assets/{AnalyticsPage-gTPFsiLZ.js → AnalyticsPage-Lm8noJqC.js} +1 -1
  13. package/src/ui/static/assets/{AuditLogPage-DE45E_PV.js → AuditLogPage-BvldSIik.js} +1 -1
  14. package/src/ui/static/assets/ChangesSummary-Cu0_4Ucf.js +3 -0
  15. package/src/ui/static/assets/{CodeMapPage-DgU6ZYBO.js → CodeMapPage-uEjuo3fk.js} +3 -3
  16. package/src/ui/static/assets/{ConfirmDialog-DNU3qoAP.js → ConfirmDialog-DtotgVmI.js} +1 -1
  17. package/src/ui/static/assets/{CoveragePage-BpTjgcdV.js → CoveragePage-jNkQJA1P.js} +2 -2
  18. package/src/ui/static/assets/{CronBuilder-DsnX-vRr.js → CronBuilder-D2fERHt9.js} +1 -1
  19. package/src/ui/static/assets/Dashboard-BaIj_IdQ.js +1 -0
  20. package/src/ui/static/assets/{DefectsPage-BtMNbq6Z.js → DefectsPage-DH0njYFG.js} +3 -3
  21. package/src/ui/static/assets/{EmptyState-BH_aDO0P.js → EmptyState-utxlJ0fu.js} +1 -1
  22. package/src/ui/static/assets/{ExportButton-Ce_MxnM1.js → ExportButton-ouKqn9CU.js} +1 -1
  23. package/src/ui/static/assets/{FileViewer-iYL0lxyY.js → FileViewer-mU3JloJ6.js} +5 -5
  24. package/src/ui/static/assets/{GitPage-CQqV8JBC.js → GitPage-TrX-RqNC.js} +5 -5
  25. package/src/ui/static/assets/{ImportExportPage-DXk7Koaq.js → ImportExportPage-CIhK_raX.js} +1 -1
  26. package/src/ui/static/assets/{JiraPushDialog-CqftoLh8.js → JiraPushDialog-DgEZS-0u.js} +1 -1
  27. package/src/ui/static/assets/KpiTile-BHLE3HVj.js +1 -0
  28. package/src/ui/static/assets/{LiveExecutionView-BD0wE8sz.js → LiveExecutionView-CaIf7Jux.js} +1 -1
  29. package/src/ui/static/assets/{ManagePage-B8iG6Q0B.js → ManagePage-SvRQ6L19.js} +1 -1
  30. package/src/ui/static/assets/{MediaModal-DiSINwmh.js → MediaModal-DNM45Uz2.js} +1 -1
  31. package/src/ui/static/assets/{MobileRunPicker-BNs2lZFf.js → MobileRunPicker-DFKm6_nU.js} +1 -1
  32. package/src/ui/static/assets/{MobileRunTarget-D2Nqcj10.js → MobileRunTarget-DHDoDZ_F.js} +3 -3
  33. package/src/ui/static/assets/{ModuleExplorer-BmkoQrHb.js → ModuleExplorer-rni7JbsL.js} +1 -1
  34. package/src/ui/static/assets/{OutputPage-Dcsr7cmr.js → OutputPage-Cn2WCpJ6.js} +1 -1
  35. package/src/ui/static/assets/PipelinesPanel-D6zWcLtD.js +1 -0
  36. package/src/ui/static/assets/{ProfilePage-ByshrcwC.js → ProfilePage-BKNdkSnx.js} +1 -1
  37. package/src/ui/static/assets/{ProjectExplorer-B9B___ij.js → ProjectExplorer-5e7J8t-o.js} +1 -1
  38. package/src/ui/static/assets/{RemoteFileStrip-DbPnaZ-v.js → RemoteFileStrip-C1S2aclP.js} +1 -1
  39. package/src/ui/static/assets/ReportCard-D4EElEe9.js +2 -0
  40. package/src/ui/static/assets/ReportFullView-2w2ysKRg.js +1 -0
  41. package/src/ui/static/assets/ReportsPage-9Fx-IEwV.js +48 -0
  42. package/src/ui/static/assets/ResultsPage-DPkfGh-K.js +115 -0
  43. package/src/ui/static/assets/RunState-CRuS_bC2.js +1 -0
  44. package/src/ui/static/assets/{RunTargets-C7Vqd4TU.js → RunTargets-CPKBrefj.js} +1 -1
  45. package/src/ui/static/assets/{ScriptMappingPage-BrANeHv0.js → ScriptMappingPage-C3K_uyf0.js} +1 -1
  46. package/src/ui/static/assets/{SearchableDevicePicker-CFJ_DUAA.js → SearchableDevicePicker-DubIldKj.js} +1 -1
  47. package/src/ui/static/assets/{SettingsPage-BwOiebKG.js → SettingsPage-BuZrrlW2.js} +1 -1
  48. package/src/ui/static/assets/SharedReportView-ig5hECRk.js +1 -0
  49. package/src/ui/static/assets/{SourcesPage-C_QVQwiA.js → SourcesPage-BPkqRqkC.js} +1 -1
  50. package/src/ui/static/assets/TestExplorerPage-C_jl93GR.js +7 -0
  51. package/src/ui/static/assets/{TestManagementPage-Ch4PthuU.js → TestManagementPage-DJiWpCne.js} +1 -1
  52. package/src/ui/static/assets/TestPlansPage-G1lvK1C0.js +5 -0
  53. package/src/ui/static/assets/{TestverCreditsDetail-cSW0SpNx.js → TestverCreditsDetail-BKpt4oLW.js} +1 -1
  54. package/src/ui/static/assets/{TestverCreditsRing-CUsMGEe3.js → TestverCreditsRing-CEBSy3w3.js} +1 -1
  55. package/src/ui/static/assets/{UncommittedDiffViewer-B5HSURk8.js → UncommittedDiffViewer-FKvUZcRi.js} +2 -2
  56. package/src/ui/static/assets/{UserManagementPage-BjY3ftxf.js → UserManagementPage-gDGhaHE4.js} +3 -3
  57. package/src/ui/static/assets/{WorkflowsPage-BUu-LjZ8.js → WorkflowsPage-BACdnU-1.js} +17 -17
  58. package/src/ui/static/assets/{hiddenLlmProviders-setxgY_B.js → hiddenLlmProviders-DzwaR-b9.js} +1 -1
  59. package/src/ui/static/assets/index-D6sQYc_0.js +47 -0
  60. package/src/ui/static/assets/{index-DpQhqcHv.js → index-DLmlY2Ol.js} +1 -1
  61. package/src/ui/static/assets/index-aInN0yoR.css +1 -0
  62. package/src/ui/static/assets/reportMeta-3kxT7BIT.js +1 -0
  63. package/src/ui/static/assets/{useChartTheme-BFz2QcND.js → useChartTheme-CTIe6M63.js} +1 -1
  64. package/src/ui/static/assets/{useDebouncedValue-BsHptIvX.js → useDebouncedValue-C9odz7b2.js} +1 -1
  65. package/src/ui/static/assets/{useFeatureFlags-DqhngqgG.js → useFeatureFlags-DrhvBp0C.js} +1 -1
  66. package/src/ui/static/assets/{useJiraConnector-TM1Rfj1s.js → useJiraConnector-Dwj69Rfh.js} +1 -1
  67. package/src/ui/static/assets/useOwnership-C1CmzcvJ.js +1 -0
  68. package/src/ui/static/assets/useSuites-V0AxZYex.js +1 -0
  69. package/src/ui/static/assets/{useTabParam-ChbOedP1.js → useTabParam-CyYAP90W.js} +1 -1
  70. package/src/ui/static/assets/{useTestExplorer-HqvURJAc.js → useTestExplorer-CUqC18DV.js} +1 -1
  71. package/src/ui/static/assets/{useTestLifecycle-CL7-zz0Q.js → useTestLifecycle-C2S_vaX2.js} +1 -1
  72. package/src/ui/static/assets/{useTestManagement-ZTA1_VUm.js → useTestManagement-DW6AW2mt.js} +2 -2
  73. package/src/ui/static/assets/useTestResults-yjH1aUy-.js +1 -0
  74. package/src/ui/static/assets/{vendor-charts-DWFQlmCz.js → vendor-charts-By5uZ93z.js} +1 -1
  75. package/src/ui/static/assets/{vendor-flow-YGpC9U9I.js → vendor-flow-B61ZV-pm.js} +1 -1
  76. package/src/ui/static/assets/{vendor-icons-B0wLOBoh.js → vendor-icons-D_Dmmj8d.js} +277 -282
  77. package/src/ui/static/assets/vendor-query-DkZSMtfn.js +1 -0
  78. package/src/ui/static/assets/{vendor-quill-W-RoQfb6.js → vendor-quill-xJF2Jvjc.js} +1 -1
  79. package/src/ui/static/assets/{vendor-react-CTbHBddL.js → vendor-react-DOVfxdUy.js} +1 -1
  80. package/src/ui/static/index.html +5 -5
  81. package/src/ui/static/assets/AIPanel-D09Ni3a4.js +0 -32
  82. package/src/ui/static/assets/AIRecordPanel-DZtUZnRe.js +0 -40
  83. package/src/ui/static/assets/AIStreamUI-BsxKziYG.js +0 -9
  84. package/src/ui/static/assets/APITestingPage-Cdc8EZz2.js +0 -19
  85. package/src/ui/static/assets/AdvancedPage-DB-6sJ6s.js +0 -3
  86. package/src/ui/static/assets/ChangesSummary-C-7oi_sx.js +0 -2
  87. package/src/ui/static/assets/Dashboard-DRWbVyTb.js +0 -1
  88. package/src/ui/static/assets/DiffViewer-DPglzjPH.js +0 -2
  89. package/src/ui/static/assets/PipelinesPanel-CMMXCSda.js +0 -1
  90. package/src/ui/static/assets/ReportCard-BbNfk85h.js +0 -2
  91. package/src/ui/static/assets/ReportFullView-Cg1rggho.js +0 -1
  92. package/src/ui/static/assets/ReportsPage-CFv3OAhe.js +0 -48
  93. package/src/ui/static/assets/ResultsPage-B4LwZH-R.js +0 -115
  94. package/src/ui/static/assets/SharedReportView-BAbW1WOs.js +0 -1
  95. package/src/ui/static/assets/TestExplorerPage-BRRWtwde.js +0 -7
  96. package/src/ui/static/assets/TestPlansPage-Bno2vpGd.js +0 -5
  97. package/src/ui/static/assets/index-B0klHYbO.css +0 -1
  98. package/src/ui/static/assets/index-DtBWNlVD.js +0 -47
  99. package/src/ui/static/assets/useOwnership-eW6Egd7X.js +0 -1
  100. package/src/ui/static/assets/useSuites-CvtMGakZ.js +0 -1
  101. package/src/ui/static/assets/useTestResults-Bm-JyMhB.js +0 -1
  102. package/src/ui/static/assets/vendor-query-BrzmPFT3.js +0 -1
@@ -0,0 +1,48 @@
1
+ import{r as o,j as e,L as V,u as W,e as Ie}from"./vendor-react-DOVfxdUy.js";import{f as le}from"./formatDate-T65-Y6Mi.js";import{s as Le}from"./visibleInterval-BKsLfJZ3.js";import{b as Y,ae as X,iu as ze,bY as Pe,gP as De,gO as Fe,iv as _e,gN as Oe,iw as Be,ix as me,iy as Me,iz as ue,iA as Ue,iB as qe,iC as Ke}from"./index-D6sQYc_0.js";import{C as pe}from"./ConfirmDialog-DtotgVmI.js";import{t as L,i as J,S as ge,s as be,a as Qe}from"./reportMeta-3kxT7BIT.js";import{h as ye}from"./aiHandoff-vhtR29Fh.js";import{s as Ve}from"./KpiTile-BHLE3HVj.js";import{a0 as z,i as Z,S as U,v as He,c7 as Ge,c8 as We,bp as ee,R as te,a3 as F,dk as ae,a5 as Ye,y as fe,cu as Xe,bo as Je,b7 as je,b4 as Ze,ag as ie,X as et,a2 as tt}from"./vendor-icons-D_Dmmj8d.js";import"./vendor-query-DkZSMtfn.js";import"./CronBuilder-D2fERHt9.js";const oe="testver-reports-view",H={good:"text-emerald-700 dark:text-emerald-400",bad:"text-rose-700 dark:text-rose-400",warn:"text-amber-700 dark:text-amber-400",flat:"text-gray-600 dark:text-gray-400"},de={good:"#059669",bad:"#dc2626",warn:"#d97706",flat:"#94a3b8"},G="inline-flex h-8 items-center gap-1.5 rounded-lg border border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.04] px-3 text-[13px] font-medium text-gray-900 dark:text-gray-100 hover:bg-gray-50 dark:hover:bg-white/[0.08] transition-colors disabled:opacity-60",se="inline-flex h-8 w-8 items-center justify-center rounded-lg border border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.04] text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/[0.08] transition-colors disabled:opacity-60",Q="h-9 rounded-lg border border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.04] px-2.5 text-sm text-gray-900 dark:text-gray-100",M="flex flex-col gap-1 text-xs font-semibold text-gray-600 dark:text-gray-400";function ce({shared:t,reports:n,schedules:a,loading:l,reload:i,onNewReport:x,onBrowseTemplates:d}){var re;const c=Y(),g=X().hasRole("tester"),[N,C]=o.useState(""),[w,S]=o.useState("all"),[k,b]=o.useState("any"),[R,A]=o.useState("updated"),[y,v]=o.useState(()=>{try{return localStorage.getItem(oe)==="list"?"list":"grid"}catch{return"grid"}}),[m,f]=o.useState(null),[p,r]=o.useState(null),[h,$]=o.useState(null);o.useEffect(()=>{try{localStorage.setItem(oe,y)}catch{}},[y]);const _=o.useMemo(()=>{const s=new Map;for(const u of a)s.set(u.sourceReportId,[...s.get(u.sourceReportId)??[],u]);return s},[a]),Te=o.useMemo(()=>[...new Set(n.map(s=>s.templateId||""))].sort((s,u)=>L(s).localeCompare(L(u))),[n]),P=o.useMemo(()=>{const s=N.trim().toLowerCase(),u=n.filter(j=>{var T,ne;if(s&&!`${j.title} ${L(j.templateId)} ${((T=j.preview)==null?void 0:T.verdict)??""}`.toLowerCase().includes(s)||w!=="all"&&(j.templateId||"")!==w)return!1;if(k!=="any"){const Ee=J((ne=j.preview)==null?void 0:ne.generatedAt,j.templateId);if(k==="stale"!==Ee)return!1}return!0}),E=j=>{var T;return((T=j.preview)==null?void 0:T.generatedAt)||j.updatedAt||""};return u.sort((j,T)=>R==="name"?j.title.localeCompare(T.title):R==="data"?E(T).localeCompare(E(j)):(T.updatedAt||"").localeCompare(j.updatedAt||""))},[n,N,w,k,R]),O=t?[]:P.filter(s=>s.pinned),q=t?P:P.filter(s=>!s.pinned),Ae=!!N.trim()||w!=="all"||k!=="any",Ce=s=>g&&s.mine!==!1,B=async(s,u)=>{f(s);try{await u()}finally{f(null)}},D=s=>s instanceof Error?s.message:String(s),K={canChange:Ce,busy:m,schedulesOf:s=>_.get(s.id)??[],refresh:s=>B(`${s.id}:refresh`,async()=>{try{await Be(s.id),c.toast("success",`"${s.title}" refreshed with current data`),await i()}catch(u){c.toast("error",`Refresh failed: ${D(u)}`)}}),exportAs:(s,u)=>B(`${s.id}:${u}`,async()=>{try{await Oe(u,{reportId:s.id})}catch(E){c.toast("error",`Download failed: ${D(E)}`)}}),togglePin:s=>B(`${s.id}:pin`,async()=>{try{await _e(s.id,{pinned:!s.pinned}),await i()}catch(u){c.toast("error",`Pin failed: ${D(u)}`)}}),toggleShare:s=>B(`${s.id}:share`,async()=>{try{if(s.shareToken)await De(s.id),c.toast("success","Share link revoked");else{const{shareUrl:u}=await Fe(s.id),E=`${window.location.origin}${u}`;try{await navigator.clipboard.writeText(E)}catch{}c.toast("success",`Share link copied: ${E}`)}await i()}catch(u){c.toast("error",`Share failed: ${D(u)}`)}}),schedule:s=>$(s),remove:s=>r(s)},$e=async()=>{if(p)try{await ze(p.id),r(null),c.toast("success","Report deleted"),await i()}catch(s){c.toast("error",`Delete failed: ${D(s)}`)}};return l?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400 py-10 justify-center",children:[e.jsx(z,{size:14,className:"animate-spin"})," Loading reports…"]}):n.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.02] px-6 py-14 text-center",children:[e.jsx(Z,{size:30,className:"mx-auto mb-3 text-gray-400","aria-hidden":!0}),e.jsx("p",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:t?"No shared reports yet":"No saved reports yet"}),e.jsx("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400 max-w-lg mx-auto",children:t?"Reports anyone in this workspace shares with a public link appear here, for every role.":"Ask the AI Assistant for a report in Reporting mode, then save it with the bookmark button on the report — or start from a template."}),!t&&g&&e.jsxs("div",{className:"mt-5 flex justify-center gap-2 flex-wrap",children:[e.jsxs("button",{onClick:x,className:"inline-flex h-9 items-center gap-1.5 rounded-lg bg-brand-600 px-4 text-sm font-medium text-white hover:bg-brand-700",children:[e.jsx(U,{size:15})," New report with AI"]}),e.jsx("button",{onClick:d,className:"inline-flex h-9 items-center gap-1.5 rounded-lg border border-gray-300 dark:border-white/15 px-4 text-sm font-medium text-gray-900 dark:text-gray-100",children:"Browse templates"})]})]}):e.jsxs("div",{className:"flex flex-col gap-5","data-testid":"report-library",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-3","data-testid":"report-toolbar",children:[e.jsxs("label",{className:`${M} flex-[1_1_260px]`,children:["Search",e.jsxs("span",{className:"flex h-9 items-center gap-2 rounded-lg border border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.04] px-2.5",children:[e.jsx(He,{size:15,className:"text-gray-500","aria-hidden":!0}),e.jsx("input",{type:"search",value:N,onChange:s=>C(s.target.value),placeholder:"Search reports",className:"w-full bg-transparent text-sm font-normal text-gray-900 dark:text-gray-100 outline-none placeholder:text-gray-500"})]})]}),e.jsxs("label",{className:M,children:["Template",e.jsxs("select",{value:w,onChange:s=>S(s.target.value),className:Q,children:[e.jsx("option",{value:"all",children:"All templates"}),Te.map(s=>e.jsx("option",{value:s,children:L(s)},s||"custom"))]})]}),e.jsxs("label",{className:M,children:["Updated",e.jsxs("select",{value:k,onChange:s=>b(s.target.value),className:Q,children:[e.jsx("option",{value:"any",children:"Any time"}),e.jsx("option",{value:"fresh",children:"Up to date"}),e.jsx("option",{value:"stale",children:"Out of date"})]})]}),e.jsxs("label",{className:M,children:["Sort",e.jsxs("select",{value:R,onChange:s=>A(s.target.value),className:Q,children:[e.jsx("option",{value:"updated",children:"Recently changed"}),e.jsx("option",{value:"data",children:"Newest data"}),e.jsx("option",{value:"name",children:"Name"})]})]}),e.jsxs("div",{role:"group","aria-label":"View",className:"flex h-9 overflow-hidden rounded-lg border border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.04]",children:[e.jsx("button",{"aria-label":"Grid view","aria-pressed":y==="grid",onClick:()=>v("grid"),className:`flex w-9 items-center justify-center ${y==="grid"?"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-100":"text-gray-500"}`,children:e.jsx(Ge,{size:15})}),e.jsx("button",{"aria-label":"List view","aria-pressed":y==="list",onClick:()=>v("list"),className:`flex w-9 items-center justify-center ${y==="list"?"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-100":"text-gray-500"}`,children:e.jsx(We,{size:15})})]})]}),P.length===0&&e.jsxs("p",{className:"py-10 text-center text-sm text-gray-600 dark:text-gray-400",children:["No reports match",Ae?" these filters":"","."," ",e.jsx("button",{className:"font-medium text-blue-700 dark:text-blue-300 hover:underline",onClick:()=>{C(""),S("all"),b("any")},children:"Clear filters"})]}),y==="list"?P.length>0&&e.jsx(st,{reports:[...O,...q],actions:K}):e.jsxs(e.Fragment,{children:[O.length>0&&e.jsxs("section",{className:"flex flex-col gap-3","aria-label":"Pinned reports",children:[e.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-gray-600 dark:text-gray-400",children:"Pinned"}),e.jsx("div",{className:"grid gap-4 grid-cols-[repeat(auto-fill,minmax(min(100%,420px),1fr))]",children:O.map(s=>e.jsx(he,{report:s,actions:K,large:!0},s.id))})]}),q.length>0&&e.jsxs("section",{className:"flex flex-col gap-3","aria-label":t?"Shared reports":"All reports",children:[O.length>0&&e.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-gray-600 dark:text-gray-400",children:"All reports"}),e.jsx("div",{className:"grid gap-4 grid-cols-[repeat(auto-fill,minmax(min(100%,300px),1fr))]",children:q.map(s=>e.jsx(he,{report:s,actions:K},s.id))})]})]}),h&&e.jsx(ge,{reports:[h],editing:null,initialReportId:h.id,onClose:()=>$(null),onSaved:async()=>{$(null),await i()}}),e.jsx(pe,{open:!!p,title:"Delete report?",description:`"${p==null?void 0:p.title}" will be permanently deleted. Any active share link will stop working.`+(p&&(((re=_.get(p.id))==null?void 0:re.length)??0)>0?` ${_.get(p.id).length} scheduled email${_.get(p.id).length===1?"":"s"} for this report will also be removed.`:""),confirmLabel:"Delete",onConfirm:$e,onCancel:()=>r(null)})]})}function we({report:t}){var l,i;const n=((l=t.preview)==null?void 0:l.generatedAt)||t.updatedAt,a=J((i=t.preview)==null?void 0:i.generatedAt,t.templateId);return e.jsxs("span",{className:`inline-flex items-center gap-1.5 ${a?"font-medium text-amber-700 dark:text-amber-400":""}`,title:a?"Out of date — Refresh rebuilds it from current results":void 0,children:[e.jsx("span",{className:`h-[7px] w-[7px] rounded-full ${a?"bg-amber-500":"bg-emerald-500"}`,"aria-hidden":!0}),"Updated ",Qe(n),a?" · out of date":""]})}function xe({preview:t,height:n}){var x,d;const a=t!=null&&t.trend?Ve(t.trend,160,n,5):"";if(!a)return null;const l=(t==null?void 0:t.status)??((x=t==null?void 0:t.kpis[0])==null?void 0:x.status)??((d=t==null?void 0:t.kpis[0])==null?void 0:d.tone)??"good",i=de[l]??de.good;return e.jsxs("svg",{viewBox:`0 0 160 ${n}`,preserveAspectRatio:"none",className:"block w-full",style:{height:n},role:"img","aria-label":"Trend",children:[e.jsx("polygon",{points:`0,${n} ${a} 160,${n}`,fill:i,fillOpacity:.1}),e.jsx("polyline",{points:a,fill:"none",stroke:i,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round"})]})}function at({preview:t,size:n}){const a=(t==null?void 0:t.kpis)??[];return a.length===0?t!=null&&t.verdict?e.jsx("p",{className:"text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:t.verdict}):e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Open the report to see it."}):e.jsx("div",{className:"grid grid-cols-3 gap-3",children:a.map((l,i)=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-xs text-gray-600 dark:text-gray-400",title:l.title,children:l.title}),e.jsx("p",{className:`truncate font-bold tabular-nums text-gray-900 dark:text-gray-100 ${n==="lg"?"text-xl":"text-[17px]"} ${l.status?H[l.status]:""}`,title:l.value,children:l.value}),l.delta&&e.jsx("p",{className:`text-xs font-semibold ${H[l.tone]??""}`,children:l.delta})]},i))})}function he({report:t,actions:n,large:a=!1}){var c;const l=n.canChange(t),i=n.schedulesOf(t),x=J((c=t.preview)==null?void 0:c.generatedAt,t.templateId),d=n.busy===`${t.id}:refresh`;return e.jsxs("article",{className:"flex flex-col rounded-xl border border-gray-200 dark:border-white/10 bg-white dark:bg-white/[0.03]","data-testid":"report-card",children:[e.jsxs("div",{className:`flex flex-col gap-2 ${a?"px-5 pt-5":"px-4 pt-4"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"rounded-md bg-gray-100 dark:bg-white/10 px-2 py-0.5 text-xs font-semibold text-gray-700 dark:text-gray-300",children:L(t.templateId)}),t.pinned&&e.jsx(ee,{size:15,className:"text-amber-600","aria-label":"Pinned"})]}),e.jsx("h3",{className:`font-bold text-gray-900 dark:text-gray-100 ${a?"text-lg":"text-base"}`,children:e.jsx(V,{to:`/reports/view/${t.id}`,className:"hover:underline",children:t.title})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-gray-600 dark:text-gray-400",children:[e.jsx(we,{report:t}),i.map(g=>e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(F,{size:12,"aria-hidden":!0})," ",be(g)]},g.id))]})]}),e.jsxs("div",{className:`grid items-end gap-3 ${a?"grid-cols-[minmax(0,3fr)_minmax(0,1.2fr)] px-5 py-4":"grid-cols-1 px-4 pt-3.5 pb-1"}`,children:[e.jsx(at,{preview:t.preview,size:a?"lg":"md"}),a&&e.jsx(xe,{preview:t.preview,height:48})]}),!a&&e.jsx(xe,{preview:t.preview,height:40}),e.jsxs("div",{className:`mt-auto flex flex-wrap items-center gap-2 border-t border-gray-100 dark:border-white/[0.06] ${a?"px-5 py-3":"px-4 py-2.5"}`,children:[e.jsx(V,{to:`/reports/view/${t.id}`,className:`${G} ${a?"":"flex-1 justify-center"} !bg-brand-600 !text-white !border-brand-600 hover:!bg-brand-700`,children:"Open"}),l&&e.jsxs("button",{onClick:()=>n.refresh(t),disabled:d,className:`${G} ${x?"!border-amber-300 !bg-amber-50 !text-amber-800 dark:!bg-amber-500/15 dark:!text-amber-300 dark:!border-amber-400/30":""}`,title:"The AI rebuilds this report from current data (30 seconds to 2 minutes; uses AI credits)",children:[d?e.jsx(z,{size:14,className:"animate-spin"}):e.jsx(te,{size:14}),d?"Refreshing…":x?"Refresh now":"Refresh"]}),e.jsx(Ne,{report:t,actions:n,compact:!a}),l&&e.jsx(Se,{report:t,actions:n}),t.shareToken&&e.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-500/15 px-2 py-0.5 text-xs font-semibold text-emerald-700 dark:text-emerald-300","data-testid":"report-shared-by",children:[e.jsx(ae,{size:11,"aria-hidden":!0}),t.mine===!1?`Shared${t.sharedByName?` by ${t.sharedByName}`:""}`:`Shared link · ${t.shareViews??0} view${t.shareViews===1?"":"s"}`]})]})]})}function st({reports:t,actions:n}){return e.jsx("div",{className:"overflow-x-auto rounded-xl border border-gray-200 dark:border-white/10 bg-white dark:bg-white/[0.03]",children:e.jsxs("table",{className:"w-full min-w-[900px] border-collapse text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 dark:bg-white/[0.04] text-left text-xs font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-400",children:[e.jsx("th",{className:"px-4 py-2.5",children:"Report"}),e.jsx("th",{className:"px-4 py-2.5",children:"Headline"}),e.jsx("th",{className:"px-4 py-2.5",children:"Updated"}),e.jsx("th",{className:"px-4 py-2.5",children:"Schedule"}),e.jsx("th",{className:"px-4 py-2.5 text-right",children:"Actions"})]})}),e.jsx("tbody",{children:t.map(a=>{var x;const l=(x=a.preview)==null?void 0:x.kpis[0],i=n.schedulesOf(a);return e.jsxs("tr",{className:"border-t border-gray-100 dark:border-white/[0.06] align-middle","data-testid":"report-row",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[a.pinned&&e.jsx(ee,{size:13,className:"text-amber-600 flex-shrink-0","aria-label":"Pinned"}),e.jsx(V,{to:`/reports/view/${a.id}`,className:"font-semibold text-gray-900 dark:text-gray-100 hover:underline",children:a.title})]}),e.jsxs("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-400",children:[L(a.templateId),a.shareToken?" · shared":""]})]}),e.jsx("td",{className:"px-4 py-3",children:l?e.jsxs("span",{className:"tabular-nums",children:[e.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:[l.title," "]}),e.jsx("strong",{className:"text-gray-900 dark:text-gray-100",children:l.value}),l.delta&&e.jsx("span",{className:`ml-1.5 text-xs font-semibold ${H[l.tone]??""}`,children:l.delta})]}):e.jsx("span",{className:"text-gray-500",children:"—"})}),e.jsx("td",{className:"px-4 py-3 text-[13px] text-gray-600 dark:text-gray-400 whitespace-nowrap",children:e.jsx(we,{report:a})}),e.jsx("td",{className:"px-4 py-3 text-[13px] text-gray-600 dark:text-gray-400",children:i.length?i.map(be).join("; "):"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.canChange(a)&&e.jsx("button",{onClick:()=>n.refresh(a),disabled:n.busy===`${a.id}:refresh`,className:se,"aria-label":"Refresh data",title:"Refresh data",children:n.busy===`${a.id}:refresh`?e.jsx(z,{size:14,className:"animate-spin"}):e.jsx(te,{size:14})}),e.jsx(Ne,{report:a,actions:n,compact:!0}),n.canChange(a)&&e.jsx(Se,{report:a,actions:n})]})})]},a.id)})})]})})}function ke(){const[t,n]=o.useState(!1),a=o.useRef(null);return o.useEffect(()=>{if(!t)return;const l=x=>{a.current&&!a.current.contains(x.target)&&n(!1)},i=x=>{x.key==="Escape"&&n(!1)};return document.addEventListener("mousedown",l),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",i)}},[t]),{open:t,setOpen:n,ref:a}}const ve="absolute right-0 top-full mt-1 z-20 w-48 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-surface-1 shadow-lg py-1 text-sm",I="w-full flex items-center gap-2 px-3 py-1.5 text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/5";function Ne({report:t,actions:n,compact:a=!1}){const{open:l,setOpen:i,ref:x}=ke(),d=!!n.busy&&n.busy.startsWith(`${t.id}:`)&&/:(pdf|docx|xlsx)$/.test(n.busy),c=t.mine===!1&&t.shareToken?`/api/reports/share/${encodeURIComponent(t.shareToken)}/render.html`:Pe(`/api/reports/${encodeURIComponent(t.id)}/render.html`);return e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>i(g=>!g),className:a?se:G,"aria-label":"Download","aria-haspopup":"menu","aria-expanded":l,disabled:d,children:[d?e.jsx(z,{size:14,className:"animate-spin"}):e.jsx(Ye,{size:14}),!a&&e.jsxs(e.Fragment,{children:["Download ",e.jsx(fe,{size:13,"aria-hidden":!0})]})]}),l&&e.jsxs("div",{role:"menu",className:ve,children:[e.jsx("a",{role:"menuitem",href:c,target:"_blank",rel:"noopener noreferrer",onClick:()=>i(!1),className:I,children:"HTML page"}),[["pdf","PDF"],["docx","Word (.docx)"],["xlsx","Excel (.xlsx)"]].map(([g,N])=>e.jsx("button",{role:"menuitem",className:I,onClick:()=>{i(!1),n.exportAs(t,g)},children:N},g))]})]})}function Se({report:t,actions:n}){const{open:a,setOpen:l,ref:i}=ke(),x=W(),d=c=>()=>{l(!1),c()};return e.jsxs("div",{className:"relative",ref:i,children:[e.jsx("button",{onClick:()=>l(c=>!c),className:se,"aria-label":"More actions","aria-haspopup":"menu","aria-expanded":a,children:e.jsx(Xe,{size:15})}),a&&e.jsxs("div",{role:"menu",className:ve,children:[e.jsxs("button",{role:"menuitem",className:I,onClick:d(()=>x(`/reports/view/${t.id}`)),children:[e.jsx(Z,{size:14})," Open"]}),e.jsxs("button",{role:"menuitem",className:I,onClick:d(()=>void n.togglePin(t)),children:[t.pinned?e.jsx(Je,{size:14}):e.jsx(ee,{size:14})," ",t.pinned?"Unpin":"Pin to top"]}),e.jsxs("button",{role:"menuitem",className:I,onClick:d(()=>void n.toggleShare(t)),children:[e.jsx(ae,{size:14})," ",t.shareToken?"Revoke share link":"Copy a share link"]}),e.jsxs("button",{role:"menuitem",className:I,onClick:d(()=>n.schedule(t)),children:[e.jsx(F,{size:14})," Schedule email…"]}),e.jsxs("button",{role:"menuitem",className:`${I} !text-rose-700 dark:!text-rose-400`,onClick:d(()=>n.remove(t)),children:[e.jsx(je,{size:14})," Delete"]})]})]})}const rt=["my","shared","scheduled","templates"];function yt(){const t=W(),n=Y(),a=X().hasRole("tester"),[l,i]=Ie(),x=l.get("tab"),d=x&&rt.includes(x)?x:"my",c=m=>i(f=>{const p=new URLSearchParams(f);return m==="my"?p.delete("tab"):p.set("tab",m),p},{replace:!0}),[g,N]=o.useState([]),[C,w]=o.useState([]),[S,k]=o.useState([]),[b,R]=o.useState(!0),A=async()=>{try{const[m,f,p]=await Promise.all([me(),Me(),ue().catch(()=>({schedules:[],count:0}))]);N(m.reports),w(f.reports),k(p.schedules)}catch(m){n.toast("error",`Load failed: ${m instanceof Error?m.message:String(m)}`)}finally{R(!1)}};o.useEffect(()=>{A()},[d]);const y=()=>ye(t,{mode:"reporting"}),v=[{id:"my",label:"My reports",Icon:Z,count:b?null:g.length},{id:"shared",label:"Shared",Icon:ae,count:b?null:C.length},{id:"scheduled",label:"Scheduled",Icon:F,count:b?null:S.length},{id:"templates",label:"Templates",Icon:U,count:Re.length}];return e.jsxs("div",{className:"p-6 max-w-[1360px] mx-auto flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-[26px] font-bold tracking-tight text-gray-900 dark:text-gray-100",children:"Reports"}),e.jsxs("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400 max-w-3xl",children:["Dashboards built by the AI Assistant in Reporting mode. Refresh, share, schedule or download any of them."," ",e.jsx("strong",{className:"font-semibold text-gray-800 dark:text-gray-200",children:"Shared"})," lists every report with a public link in this workspace — anyone signed in can open it."]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{onClick:()=>c("scheduled"),className:"inline-flex h-9 items-center gap-1.5 rounded-lg border border-gray-300 dark:border-white/15 bg-white dark:bg-white/[0.04] px-3.5 text-sm font-medium text-gray-900 dark:text-gray-100 hover:bg-gray-50 dark:hover:bg-white/[0.08]",children:[e.jsx(F,{size:15})," Schedules"]}),a&&e.jsxs("button",{onClick:y,className:"inline-flex h-9 items-center gap-1.5 rounded-lg bg-brand-600 px-3.5 text-sm font-medium text-white hover:bg-brand-700",children:[e.jsx(U,{size:15})," New report with AI"]})]})]}),e.jsx("div",{role:"tablist",className:"flex gap-6 overflow-x-auto border-b border-gray-200 dark:border-white/10","data-testid":"report-tabs",children:v.map(m=>{const f=d===m.id;return e.jsxs("button",{role:"tab","aria-selected":f,onClick:()=>c(m.id),className:`flex h-10 flex-shrink-0 items-center gap-2 whitespace-nowrap border-b-2 px-0.5 text-sm transition-colors ${f?"border-gray-900 dark:border-gray-100 font-semibold text-gray-900 dark:text-gray-100":"border-transparent font-medium text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:[e.jsx(m.Icon,{size:15,"aria-hidden":!0,className:f?"":"opacity-80"}),m.label,m.count!=null&&e.jsx("span",{className:`min-w-[22px] rounded-full px-2 py-px text-center text-xs font-semibold tabular-nums ${f?"bg-brand-600 text-white dark:bg-white dark:text-gray-900":"bg-gray-200 text-gray-700 dark:bg-white/10 dark:text-gray-300"}`,children:m.count})]},m.id)})}),d==="my"&&e.jsx(ce,{shared:!1,reports:g,schedules:S,loading:b,reload:A,onNewReport:y,onBrowseTemplates:()=>c("templates")}),d==="shared"&&e.jsx(ce,{shared:!0,reports:C,schedules:S,loading:b,reload:A,onNewReport:y,onBrowseTemplates:()=>c("templates")}),d==="scheduled"&&e.jsx(nt,{}),d==="templates"&&e.jsx(lt,{})]})}function nt(){const t=Y(),n=X().hasRole("tester"),[a,l]=o.useState([]),[i,x]=o.useState([]),[d,c]=o.useState(!0),[g,N]=o.useState(!1),[C,w]=o.useState(null),[S,k]=o.useState(!1),[b,R]=o.useState(null),[A,y]=o.useState(null),v=async r=>{r!=null&&r.initial?c(!0):r!=null&&r.silent||N(!0);try{const[h,$]=await Promise.all([ue(),me()]);l(h.schedules),x($.reports)}catch(h){r!=null&&r.silent||t.toast("error",`Load failed: ${h instanceof Error?h.message:String(h)}`)}finally{c(!1),N(!1)}};o.useEffect(()=>{v({initial:!0})},[]),o.useEffect(()=>{if(!(S||b))return Le(()=>{v({silent:!0})},2e4)},[S,b]);const m=async r=>{try{await qe(r.id,{enabled:!r.enabled}),await v()}catch(h){t.toast("error",`Update failed: ${h instanceof Error?h.message:String(h)}`)}},f=async r=>{y(r.id);try{const h=await Ue(r.id);h.success?t.toast("success","Dispatch succeeded"):t.toast("error",`Dispatch failed: ${h.error||"unknown"}`),await v()}catch(h){t.toast("error",`Run failed: ${h instanceof Error?h.message:String(h)}`)}finally{y(null)}},p=async()=>{if(b)try{await Ke(b.id),t.toast("success","Schedule deleted"),R(null),await v()}catch(r){t.toast("error",`Delete failed: ${r instanceof Error?r.message:String(r)}`)}};return d?e.jsxs("div",{className:"py-10 text-center text-sm text-gray-500",children:[e.jsx(z,{size:14,className:"inline animate-spin mr-2"})," Loading…"]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[a.length," schedule",a.length===1?"":"s"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>v(),disabled:g,className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-xs text-gray-600 dark:text-gray-400 hover:bg-white/5 transition-colors disabled:opacity-60",title:"Refresh schedule list",children:[e.jsx(te,{size:12,className:g?"animate-spin":""}),g?"Refreshing…":"Refresh"]}),n&&e.jsxs("button",{onClick:()=>{w(null),k(!0)},disabled:i.length===0,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-brand-500/10 hover:bg-brand-500/20 text-brand-600 dark:text-brand-400 transition-colors disabled:opacity-50",title:i.length===0?"Save a report first in Reporting mode, then you can schedule it":"Create a new schedule",children:[e.jsx(Ze,{size:12})," New schedule"]})]})]}),a.length===0?e.jsxs("div",{className:"text-center py-14 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(F,{size:28,className:"mx-auto mb-3 opacity-40"}),"No schedules yet. Click ",e.jsx("strong",{children:"New schedule"})," to dispatch a saved report on a recurring basis."]}):e.jsx("div",{className:"rounded-xl border border-gray-200 dark:border-white/10 overflow-hidden bg-white dark:bg-white/[0.03]",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-white/[0.04]",children:e.jsxs("tr",{className:"text-left text-[10px] text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:[e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Title"}),e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Source"}),e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Schedule"}),e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Format"}),e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Recipients"}),e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Last run"}),e.jsx("th",{className:"px-3 py-2 font-semibold",children:"Status"}),e.jsx("th",{className:"px-3 py-2"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-white/[0.02]",children:a.map(r=>{const h=i.find($=>$.id===r.sourceReportId);return e.jsxs("tr",{className:"border-t border-gray-100 dark:border-white/5 bg-white dark:bg-transparent hover:bg-gray-50 dark:hover:bg-white/[0.04] transition-colors",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:r.title})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 truncate max-w-[160px]",children:h?h.title:e.jsx("span",{className:"text-rose-500",children:"Missing"})}),e.jsxs("td",{className:"px-3 py-2 text-xs text-gray-700 dark:text-gray-300",title:r.cron,children:[r.cronHuman&&r.cronHuman!==r.cron?r.cronHuman:e.jsx("span",{className:"font-mono",children:r.cron}),r.enabled&&r.nextRun&&e.jsxs("div",{className:"text-[10px] text-gray-500",children:["next ",le(r.nextRun)]})]}),e.jsx("td",{className:"px-3 py-2 text-xs uppercase text-gray-600 dark:text-gray-400",children:r.format}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 dark:text-gray-300 truncate max-w-[180px]",title:r.recipients.join(", "),children:r.recipients.length===1?r.recipients[0]:`${r.recipients.length} recipients`}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:r.lastRun?le(r.lastRun):"—"}),e.jsx("td",{className:"px-3 py-2 text-xs",children:r.enabled?r.lastStatus==="success"&&r.lastWarning?e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-600 dark:text-amber-400",title:r.lastWarning,children:[e.jsx(ie,{size:10})," Sent · stale data"]}):r.lastStatus==="success"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-600 dark:text-emerald-400",children:[e.jsx(ie,{size:10})," Success"]}):r.lastStatus==="error"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-rose-600 dark:text-rose-400",title:r.lastError,children:[e.jsx(et,{size:10})," Error"]}):e.jsx("span",{className:"text-gray-500",children:"—"}):e.jsx("span",{className:"text-gray-500",children:"paused"})}),e.jsx("td",{className:"px-3 py-2",children:n&&e.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[e.jsx("button",{onClick:()=>f(r),disabled:A===r.id,className:"p-1 rounded text-gray-500 hover:text-emerald-600 hover:bg-emerald-500/10 disabled:opacity-50",title:"Run now",children:A===r.id?e.jsx(z,{size:12,className:"animate-spin"}):e.jsx(tt,{size:12})}),e.jsx("button",{onClick:()=>m(r),className:"p-1 rounded text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-white/5",title:r.enabled?"Pause — stop sending until resumed":"Resume — send on schedule again",children:r.enabled?e.jsx("span",{className:"text-[10px] font-semibold px-1",children:"PAUSE"}):e.jsx("span",{className:"text-[10px] font-semibold px-1 text-emerald-500",children:"RESUME"})}),e.jsx("button",{onClick:()=>{w(r),k(!0)},className:"p-1 rounded text-gray-500 hover:text-brand-500 hover:bg-brand-500/10",title:"Edit",children:e.jsx("span",{className:"text-[10px] font-semibold px-1",children:"EDIT"})}),e.jsx("button",{onClick:()=>R(r),className:"p-1 rounded text-gray-500 hover:text-rose-500 hover:bg-rose-500/10",title:"Delete",children:e.jsx(je,{size:12})})]})})]},r.id)})})]})}),S&&e.jsx(ge,{reports:i,editing:C,onClose:()=>{k(!1),w(null)},onSaved:async()=>{k(!1),w(null),await v()}}),e.jsx(pe,{open:!!b,title:"Delete schedule?",description:`"${b==null?void 0:b.title}" will stop dispatching. This cannot be undone.`,confirmLabel:"Delete",onConfirm:p,onCancel:()=>R(null)})]})}const Re=[{id:"executive",label:"Executive Summary",description:"High-level KPIs + pass-rate trend + top failures — for managers.",prompt:`Build an EXECUTIVE QA dashboard for the current sprint using the \`generate_dashboard\` tool.
2
+
3
+ Layout (4 rows on a 12-column grid):
4
+ 1. Four KPI cards (span 3 each): Total Test Cases, Automation Coverage %, Latest Pass Rate %, Critical Failures (open).
5
+ 2. A doughnut chart (span 6) "Automation Status" — Automated vs Manual.
6
+ 3. A line chart (span 6) "Pass Rate Trend" over the last 7–10 runs.
7
+ 4. A table (span 12) "Top 5 Failing Tests" with columns: Test Name, Failure Count, Last Failure, Category.
8
+ 5. A markdown cell (span 12) with a 3–5 bullet executive summary covering sprint health, biggest risks, and recommended next steps.
9
+
10
+ Pull real numbers from Testver — query test cases, run history, coverage stats, and failure analysis. Title: "Executive QA Summary — <Sprint Name or Date>". Save the result (save_report with templateId "executive") so it appears under My Reports.`},{id:"qa_daily",label:"QA Daily Report",description:"Last 24h status, new failures, flaky tests — for QA standups.",prompt:`Build a QA DAILY dashboard for the last 24 hours using the \`generate_dashboard\` tool.
11
+
12
+ Layout:
13
+ 1. Four KPI cards (span 3 each): Runs in Last 24h, Tests Executed, Pass Rate %, New Failures (since yesterday).
14
+ 2. A stacked bar chart (span 6) "Pass / Fail / Skip per Run" for each run in the last 24h.
15
+ 3. A doughnut chart (span 6) "Failure Categories" from the latest run (bug / environment / flaky / test-issue / timeout).
16
+ 4. A table (span 12) "New Failures Today" with columns: Test Name, Error Signature, Run, First Seen.
17
+ 5. A markdown cell (span 12) summarizing what changed since yesterday in 2–4 bullets — newly broken tests, fixed regressions, anything notable.
18
+
19
+ Pull live data from Testver run history and failure analysis. Title: "QA Daily — <Today's Date>". Save the result (save_report with templateId "qa_daily").`},{id:"release",label:"Release Readiness",description:"Latest run vs baseline: regressions, new failures, duration delta.",prompt:`Build a RELEASE READINESS dashboard comparing the LATEST run to the configured BASELINE run using the \`generate_dashboard\` tool.
20
+
21
+ Layout:
22
+ 1. Four KPI cards (span 3 each): Total Tests in Latest Run, Pass Rate Δ vs Baseline (with up/down arrow), Duration Δ vs Baseline, Regressions Count.
23
+ 2. A stacked bar chart (span 6) "Pass / Fail / Skip by Priority" for the latest run.
24
+ 3. A horizontal bar chart (span 6) "Top 5 Regressions" — tests that passed in baseline but fail in latest, sorted by failure impact.
25
+ 4. A table (span 12) "New Failures vs Baseline" with columns: Test Name, Baseline Result, Latest Result, Error Signature.
26
+ 5. A markdown cell (span 12) with a Go / No-Go recommendation, 3–5 bullets summarizing release risk.
27
+
28
+ Use Testver baseline + comparison endpoints. Title: "Release Readiness — Run <latest run id> vs Baseline". Save the result (save_report with templateId "release").`},{id:"trend_analysis",label:"Trend Analysis",description:"Pass rate / coverage / flaky / anomalies deep-dive across the last 20 runs.",prompt:`Build a TREND ANALYSIS dashboard covering the last 20 runs using the \`generate_dashboard\` tool.
29
+
30
+ Layout:
31
+ 1. Four KPI cards (span 3 each): Avg Pass Rate % (20 runs), Flaky Tests Count, Avg Run Duration, Coverage % (requirement coverage).
32
+ 2. A line chart (span 6) "Pass Rate Trend — Last 20 Runs".
33
+ 3. A line chart (span 6) "Duration Trend — Last 20 Runs" (avg seconds per run).
34
+ 4. A horizontal bar chart (span 12) "Top 10 Flakiest Tests" — sorted by flip rate (pass↔fail toggles across the 20 runs).
35
+ 5. A table (span 12) "Slowest 10 Tests" with columns: Test Name, Avg Duration, Max Duration, Runs Counted.
36
+ 6. A markdown cell (span 12) calling out anomalies, regressions, and patterns — 4–6 bullets.
37
+
38
+ Pull from run history, flaky-test detection, and slowest-tests stats. Title: "Trend Analysis — Last 20 Runs". Save the result (save_report with templateId "trend_analysis").`},{id:"automation_inventory",label:"Automation Inventory",description:"Every automation script — passing, failing, never run, skipped — by folder, framework and owner.",prompt:`Build an AUTOMATION INVENTORY dashboard of the project's automation scripts using the \`generate_dashboard\` tool. Take the numbers from \`test_library\` action "summary" — it covers every script, including the ones that have never run.
39
+
40
+ Layout:
41
+ 1. Four KPI cards (span 3 each): Total Scripts, Passing on Last Run %, Never Run, Not Linked to a Test Case.
42
+ 2. A doughnut chart (span 6) "Scripts by Status" — passing / failing / never run / skipped in code.
43
+ 3. A horizontal bar chart (span 6) "Scripts by Folder" — the folders with the most scripts.
44
+ 4. A table (span 12) "Folders" with columns: Folder, Scripts, Failing, Never Run, Flaky.
45
+ 5. A bar chart (span 6) "Scripts by Framework", and a table (span 6) "Scripts by Owner" (Owner, Scripts, Failing) when owners are known — otherwise a bar chart "Scripts by Tag".
46
+ 6. A markdown cell (span 12) with 3–5 bullets: the biggest gaps (never-run and unlinked scripts), the folders with the most failures, and recommended next steps.
47
+
48
+ Title: "Automation Inventory — <Today's Date>". Save the result (save_report with templateId "automation_inventory").`},{id:"manual_vs_automated",label:"Manual vs Automated",description:"Quick breakdown of test cases by automation status.",prompt:'Generate a dashboard showing the breakdown of manual and automated test cases — totals, automation coverage percentage, and a list of currently-manual tests that could be prioritized for automation. Save the result (save_report with templateId "manual_vs_automated").'},{id:"coverage_by_requirement",label:"Coverage by Requirement",description:"Requirement coverage with orphan tests and uncovered requirements.",prompt:'Generate a dashboard showing requirement coverage — how many requirements have linked test cases, how many are uncovered, and which test cases are orphaned (no requirement linked). Save the result (save_report with templateId "coverage_by_requirement").'}];function lt(){const t=W(),n=a=>ye(t,{prompt:a,mode:"reporting"});return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:"Click a template to open the AI Assistant in Reporting mode with the prompt pre-filled. You can edit the prompt before submitting."}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Re.map(a=>e.jsxs("div",{className:"rounded-xl border border-gray-200 dark:border-white/10 bg-white dark:bg-white/[0.03] p-4",children:[e.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[e.jsx(U,{size:14,className:"text-brand-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a.label}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-relaxed",children:a.description})]})]}),e.jsxs("div",{className:"text-[11px] text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-white/[0.02] border border-gray-100 dark:border-white/5 rounded-md p-2 font-mono mb-3 italic",children:['"',a.prompt,'"']}),e.jsxs("button",{onClick:()=>n(a.prompt),className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-brand-500/10 hover:bg-brand-500/20 text-brand-600 dark:text-brand-400 transition-colors",children:["Run template ",e.jsx(fe,{size:11,className:"-rotate-90"})]})]},a.id))})]})}export{yt as ReportsPage};