apitestcenter 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD-PARTY-NOTICES-UI.txt +1 -1
- package/dist/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/cli.mjs +506 -448
- package/dist/ui/404/index.html +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/__next.__PAGE__.txt +11 -11
- package/dist/ui/__next._full.txt +13 -13
- package/dist/ui/__next._tree.txt +2 -2
- package/dist/ui/_next/static/chunks/{2u2hx7jqhjo62.js → 0z965ndwtjbm_.js} +5 -5
- package/dist/ui/_next/static/chunks/11ttwsn_q1n9e.js +50 -0
- package/dist/ui/_next/static/chunks/1dblkl6d18f29.js +50 -0
- package/dist/ui/_next/static/chunks/1g6q7zaut7pts.js +50 -0
- package/dist/ui/_next/static/chunks/1mj3_49yxxkvu.js +3 -0
- package/dist/ui/_next/static/chunks/{40n7rab9memc2.js → 1t823xy7gguwx.js} +1 -1
- package/dist/ui/_next/static/chunks/2-fk7_1yukwm4.js +4 -0
- package/dist/ui/_next/static/chunks/22z3xj74zl8o3.js +1 -0
- package/dist/ui/_next/static/chunks/24xh2ng9tdid9.js +50 -0
- package/dist/ui/_next/static/chunks/2844deqm9c797.js +50 -0
- package/dist/ui/_next/static/chunks/2p2xxbfeii3so.css +3 -0
- package/dist/ui/_next/static/chunks/2t65s4y0z2a60.js +50 -0
- package/dist/ui/_next/static/chunks/37fbrlydrkdac.js +10 -0
- package/dist/ui/_next/static/chunks/3ddcv0i2wy657.js +2 -0
- package/dist/ui/_next/static/chunks/{3qrp203pdimxn.js → 3o926vjke_xbm.js} +84 -79
- package/dist/ui/_next/static/chunks/3oetlmylrxpce.js +123 -0
- package/dist/ui/_next/static/chunks/41xixugzzb47w.js +27 -0
- package/dist/ui/_next/static/chunks/{turbopack-2ryv3cb9r14p8.js → turbopack-2qka98q_-4ca1.js} +1 -1
- package/dist/ui/_not-found/__next._full.txt +12 -12
- package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +10 -10
- package/dist/ui/_not-found/__next._tree.txt +2 -2
- package/dist/ui/_not-found/index.html +1 -1
- package/dist/ui/_not-found/index.txt +12 -12
- package/dist/ui/compare/__next._full.txt +13 -13
- package/dist/ui/compare/__next._tree.txt +2 -2
- package/dist/ui/compare/__next.compare.__PAGE__.txt +11 -11
- package/dist/ui/compare/index.html +1 -1
- package/dist/ui/compare/index.txt +13 -13
- package/dist/ui/connections/__next._full.txt +21 -0
- package/dist/ui/connections/__next._tree.txt +4 -0
- package/dist/ui/connections/__next.connections.__PAGE__.txt +25 -0
- package/dist/ui/connections/index.html +2 -0
- package/dist/ui/connections/index.txt +21 -0
- package/dist/ui/history/__next._full.txt +14 -14
- package/dist/ui/history/__next._tree.txt +2 -2
- package/dist/ui/history/__next.history.__PAGE__.txt +12 -12
- package/dist/ui/history/index.html +1 -1
- package/dist/ui/history/index.txt +14 -14
- package/dist/ui/home/__next._full.txt +13 -13
- package/dist/ui/home/__next._tree.txt +2 -2
- package/dist/ui/home/__next.home.__PAGE__.txt +11 -11
- package/dist/ui/home/index.html +1 -1
- package/dist/ui/home/index.txt +13 -13
- package/dist/ui/index.html +1 -1
- package/dist/ui/index.txt +13 -13
- package/dist/ui/preview/__next._full.txt +14 -14
- package/dist/ui/preview/__next._tree.txt +2 -2
- package/dist/ui/preview/__next.preview.__PAGE__.txt +12 -12
- package/dist/ui/preview/index.html +1 -1
- package/dist/ui/preview/index.txt +14 -14
- package/dist/ui/suite/__next._full.txt +13 -13
- package/dist/ui/suite/__next._tree.txt +2 -2
- package/dist/ui/suite/__next.suite.__PAGE__.txt +11 -11
- package/dist/ui/suite/index.html +1 -1
- package/dist/ui/suite/index.txt +13 -13
- package/dist/ui/tests/__next._full.txt +12 -12
- package/dist/ui/tests/__next._tree.txt +2 -2
- package/dist/ui/tests/__next.tests.__PAGE__.txt +10 -10
- package/dist/ui/tests/index.html +1 -1
- package/dist/ui/tests/index.txt +12 -12
- package/package.json +1 -1
- package/dist/ui/_next/static/chunks/09i5zrliu0ihk.js +0 -2
- package/dist/ui/_next/static/chunks/0_0x8uij5q9uo.js +0 -1
- package/dist/ui/_next/static/chunks/0hcsfv99w40pd.js +0 -1
- package/dist/ui/_next/static/chunks/0hzm2s0wkhmzk.js +0 -9
- package/dist/ui/_next/static/chunks/0jepa0hc-rzkw.js +0 -27
- package/dist/ui/_next/static/chunks/13nvl7bxr0ra-.js +0 -1
- package/dist/ui/_next/static/chunks/1d3l7hra87g66.js +0 -1
- package/dist/ui/_next/static/chunks/2dn12byo9lp8w.js +0 -1
- package/dist/ui/_next/static/chunks/2nuly7x38k2--.js +0 -119
- package/dist/ui/_next/static/chunks/3een3k2hd15nf.css +0 -3
- package/dist/ui/_next/static/chunks/3hn-tmfmw2hkd.js +0 -59
- /package/dist/ui/_next/static/{xVTi1MWdof3rkYYR1nxdn → emu38N9csb28KU3jv4SH4}/_buildManifest.js +0 -0
- /package/dist/ui/_next/static/{xVTi1MWdof3rkYYR1nxdn → emu38N9csb28KU3jv4SH4}/_clientMiddlewareManifest.js +0 -0
- /package/dist/ui/_next/static/{xVTi1MWdof3rkYYR1nxdn → emu38N9csb28KU3jv4SH4}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49186,e=>{"use strict";var t=e.i(14368);e.i(24856);var s=e.i(99522);let
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49186,e=>{"use strict";var t=e.i(14368);e.i(24856);var s=e.i(99522);let r=(0,s.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var a=e.i(95486),n=e.i(27813),l=e.i(13163),i=e.i(3792),o=e.i(71189),d=e.i(50962);let c=(0,s.default)("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);var p=e.i(66478),m=e.i(87283),u=e.i(30099),x=e.i(36994),h=e.i(99181),f=e.i(60617),b=e.i(88491),g=e.i(75117),y=e.i(62350),v=e.i(36558),w=e.i(17219);function j(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("\n"," ")}let k=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
2
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
3
3
|
<fonts count="3">
|
|
4
4
|
<font><sz val="11"/><name val="Calibri"/></font>
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
<xf numFmtId="0" fontId="0" fillId="4" borderId="0" xfId="0" applyFill="1"/>
|
|
24
24
|
<xf numFmtId="0" fontId="0" fillId="5" borderId="0" xfId="0" applyFill="1"/>
|
|
25
25
|
</cellXfs>
|
|
26
|
-
</styleSheet>`;function N(){let e=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");return`compare-${e}.xlsx`}async function I(e,t,s){let
|
|
26
|
+
</styleSheet>`;function N(){let e=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");return`compare-${e}.xlsx`}async function I(e,t,s){let r=e.map(e=>e.report),a=e.map(e=>e.title),n=r.length>=2?(0,f.compareKpis)(r):[],l=(0,f.overlayBuckets)(r),i=(0,b.compareVerdictRows)(e,s),o=[[{v:"Metric",s:1},...a.map(e=>({v:e,s:1})),{v:"Best",s:1}],...n.map(e=>[{v:e.label},...e.values.map((t,s)=>{var r;return{v:"ms"===(r=e.unit)?`${Math.round(t)} ms`:"rps"===r?`${t.toFixed(1)} rps`:"pct"===r?`${(100*t).toFixed(2)}%`:String(Math.round(t)),s:3*(e.winner===s)}}),{v:(0,b.compareWinnerLabel)(e,a)}]),[{v:"Run mode"},{v:t},...a.slice(1).map(()=>({v:""})),{v:""}]],d=[{v:"Seconds into test",s:1}];a.forEach(e=>{d.push({v:`${e} — 95th pct (ms)`,s:1}),d.push({v:`${e} — req/s`,s:1}),d.push({v:`${e} — error rate`,s:1}),d.push({v:`${e} — VUs`,s:1})});let c=[{name:"Side by side",rows:o},{name:"Over time",rows:[d,...l.map(e=>{let t=[{v:e.elapsedS}];return e.p95.forEach((s,r)=>{t.push({v:s??""}),t.push({v:e.rps[r]??""}),t.push({v:e.failedRate[r]??""}),t.push({v:e.vus[r]??""})}),t})]},{name:"Result summary",rows:[[{v:"API",s:1},{v:"Result",s:1},{v:"What this means",s:1}],...i.map(e=>{var t;return[{v:e.title},{v:e.overall,s:"pass"===(t=e.overall)?3:"warn"===t?4:5*("fail"===t)},{v:e.headline,s:2}]})]},...e.map((e,t)=>{var s;return{name:(s=e.title,(s.replace(/[\\/?*[\]:]/g,"").slice(0,24)||`API ${t+1}`).slice(0,31)),rows:[[{v:"Key",s:1},{v:"Value",s:1},{v:"What this means",s:1}],...(0,v.summaryExportRows)(e.report).map(e=>[{v:e.key},{v:e.value},{v:e.description,s:2}])]}})].map((e,t)=>{var s;let r,a,n;return{id:t+1,relId:`rId${t+1}`,name:e.name,xml:(s=e.rows,a=Array.from({length:r=s[0]?.length??0},(e,t)=>{let a=function(e,t,s=10,r=48){let a=s;for(let s of e){let e=s[t]?.v;void 0!==e&&(a=Math.max(a,String(e).length+2))}return Math.min(r,a)}(s,t,0===t?14:12,t===r-1&&r>=3?72:42);return`<col min="${t+1}" max="${t+1}" width="${a}" customWidth="1"/>`}).join(""),n=s.map((e,t)=>`<row r="${t+1}" ht="${0===t?22:18}" customHeight="1">${e.map((e,s)=>{var r;let a,n;return r=t+1,a=`${function(e){let t=e+1,s="";for(;t>0;)s=String.fromCharCode(65+(t-1)%26)+s,t=Math.floor((t-1)/26);return s}(s)}${r}`,n=void 0!==e.s?` s="${e.s}"`:"","number"==typeof e.v&&Number.isFinite(e.v)?`<c r="${a}"${n}><v>${e.v}</v></c>`:`<c r="${a}"${n} t="inlineStr"><is><t xml:space="preserve">${j(e.v)}</t></is></c>`}).join("")}</row>`).join(""),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
27
27
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
28
28
|
<sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>
|
|
29
|
-
<cols>${
|
|
29
|
+
<cols>${a}</cols>
|
|
30
30
|
<sheetData>${n}</sheetData>
|
|
31
31
|
</worksheet>`)}}),p=c.map(e=>`<Override PartName="/xl/worksheets/sheet${e.id}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("\n "),m=c.map(e=>`<sheet name="${j(e.name)}" sheetId="${e.id}" r:id="${e.relId}"/>`).join("\n "),u=c.map(e=>`<Relationship Id="${e.relId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${e.id}.xml"/>`).join("\n "),x={"[Content_Types].xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
32
32
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
48
48
|
${u}
|
|
49
49
|
<Relationship Id="rId${c.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
50
|
-
</Relationships>`,"xl/styles.xml":k};for(let e of c)x[`xl/worksheets/sheet${e.id}.xml`]=e.xml;return new Blob([(0,w.zipStore)(x)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}async function S(e,t,s){let a=N().replace(/\.xlsx$/,""),r={[`${a}.xlsx`]:new Uint8Array(await (await I(e,t,s)).arrayBuffer()),[`${a}.json`]:(0,b.exportCompareJson)(e,t)};for(let t of e){if(!t.probe)continue;let e=t.title.replace(/[^\w.-]+/g,"-").slice(0,40)||t.id.slice(0,8);r[`${e}-probe.json`]=(0,b.exportProbeJson)(t.probe)}return{base:a,blob:(0,w.zipStore)(r)}}var C=e.i(15060),$=e.i(88153);function A({apis:e,mode:s,probes:a}){var n,l,i;let o,d,c,p,m,{slo:u}=(0,$.useSlo)(),x=N(),v=x.replace(/\.xlsx$/,""),j=Object.entries(a).filter(e=>!!e[1]),[k,F]=(0,h.useState)(!1),[R,E]=(0,h.useState)(null),[T,z]=(0,h.useState)(null);if(0===e.length)return null;let D=(n=e,l=s,i=u,o=n.map(e=>e.title),d=`Compare: ${o.join(" vs ")}`.slice(0,120),c=n.length>=2?(0,f.compareKpis)(n.map(e=>e.report)):[],p=[`APITestCenter compare (${l})`,"",...n.map(e=>`- ${e.title}: ${e.report.testName} [${e.report.status}]`),"",...c.map(e=>{let t=e.values.map((t,s)=>{var a,r;return`${o[s]}=${a=t,"ms"===(r=e.unit)?`${Math.round(a)}ms`:"rps"===r?`${a.toFixed(1)}/s`:"pct"===r?`${(100*a).toFixed(2)}%`:String(Math.round(a))}`}).join(", "),s=null==e.winner?"tie":o[e.winner]??"tie";return`${e.label}: ${t} (best: ${s})`})],i&&p.push("",`Performance targets: p95 ${i.p95Ms} ms, errors ${(100*i.errorRate).toFixed(1)}%`),p.push("","Attach the Excel or Zip export from APITestCenter."),{subject:d,body:m=p.join("\n"),mailto:`mailto:?subject=${encodeURIComponent(d)}&body=${encodeURIComponent(m)}`,gmail:`https://mail.google.com/mail/?view=cm&fs=1&tf=1&su=${encodeURIComponent(d)}&body=${encodeURIComponent(m)}`,outlook:`https://outlook.office.com/mail/deeplink/compose?subject=${encodeURIComponent(d)}&body=${encodeURIComponent(m)}`});async function O(){z(null),F(!1);try{let{base:t,blob:a}=await S(e,s,u),r={files:[new File([a],`${t}-export.zip`,{type:"application/zip"})],title:D.subject,text:D.body};if(navigator.canShare?.({files:r.files}))return void await navigator.share(r);E("mailto")}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;E("mailto"),z(e instanceof Error?e.message:"Share failed")}}return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"mr-1 flex items-center gap-1.5 text-xs text-mute",children:[(0,t.jsx)(g.Download,{size:14}),"Export"]}),(0,t.jsx)("button",{type:"button",disabled:e.length<2,className:"rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent disabled:opacity-40",onClick:()=>void I(e,s,u).then(e=>(0,C.downloadBlob)(x,e)),children:"Excel"}),(0,t.jsx)("button",{type:"button",className:"rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent",onClick:()=>(0,C.downloadText)(`${v}.json`,(0,b.exportCompareJson)(e,s),"application/json"),children:"JSON"}),(0,t.jsx)("button",{type:"button",disabled:0===j.length,className:"rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent disabled:opacity-40",onClick:()=>{let t={};for(let[s,a]of j){let r=e.find(e=>e.id===s),n=(r?.title??s).replace(/[^\w.-]+/g,"-").slice(0,40);t[`${n}-probe.json`]=(0,b.exportProbeJson)(a)}(0,C.downloadBlob)(`${v}-probes.zip`,(0,w.zipStore)(t))},children:"Response JSONs"}),(0,t.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent",onClick:()=>void S(e,s,u).then(({base:e,blob:t})=>(0,C.downloadBlob)(`${e}-export.zip`,t)),children:[(0,t.jsx)(g.Download,{size:12}),"Zip"]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>F(e=>!e),className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent",children:[(0,t.jsx)(y.Share2,{size:12}),"Share",(0,t.jsx)(r.ChevronDown,{size:12})]}),k?(0,t.jsxs)("div",{className:"absolute right-0 z-20 mt-1 w-56 rounded-md border border-line bg-panel p-1 shadow-lg",children:[(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>{F(!1),E("gmail")},children:"Gmail"}),(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>{F(!1),E("outlook")},children:"Outlook on the web"}),(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>{F(!1),E("mailto")},children:"Default mail app"}),(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>void O(),children:"System share"})]}):null]})]}),T?(0,t.jsx)("p",{className:"max-w-md text-xs text-mute",children:T}):null,R?(0,t.jsx)(P,{apis:e,mode:s,target:R,links:D,onClose:()=>E(null)}):null]})}function P({apis:e,mode:s,target:a,links:r,onClose:n}){let{slo:l}=(0,$.useSlo)(),i={gmail:"Gmail",outlook:"Outlook on the web",mailto:"default mail app"},o="gmail"===a?r.gmail:"outlook"===a?r.outlook:r.mailto;return(0,t.jsx)("div",{className:"fixed inset-0 z-50 grid place-items-center bg-canvas/70 p-4",role:"presentation",onClick:n,children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true",className:"w-full max-w-md rounded-lg border border-line bg-panel p-4 shadow-xl",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("h2",{className:"text-sm font-medium text-ink",children:["Share via ",i[a]]}),(0,t.jsx)("p",{className:"mt-2 text-xs leading-5 text-mute",children:"Download the compare package, then attach it in the compose window. Browsers cannot attach files for you."}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,t.jsx)("button",{type:"button",className:"rounded-md border border-line bg-panel-2 px-2.5 py-1.5 text-xs text-ink",onClick:()=>void I(e,s,l).then(e=>(0,C.downloadBlob)(N(),e)),children:"Download Excel"}),(0,t.jsx)("button",{type:"button",className:"rounded-md border border-line bg-panel-2 px-2.5 py-1.5 text-xs text-ink",onClick:()=>void S(e,s,l).then(({base:e,blob:t})=>(0,C.downloadBlob)(`${e}-export.zip`,t)),children:"Download Zip"}),(0,t.jsxs)("a",{href:o,target:"_blank",rel:"noreferrer",className:"rounded-md bg-accent px-2.5 py-1.5 text-xs font-medium text-canvas",onClick:n,children:["Open ",i[a]]}),(0,t.jsx)("button",{type:"button",className:"rounded-md px-2.5 py-1.5 text-xs text-mute",onClick:n,children:"Close"})]})]})})}var F=e.i(55658),R=e.i(53012),E=e.i(45404),T=e.i(29724),z=e.i(88231);function D({items:e,liveTabs:s,running:a,source:r,mode:l,slo:i,title:o,actions:d,status:c,exportBar:p}){let[m,u]=(0,h.useState)("all"),x=(0,h.useRef)(null),b=e.map((e,t)=>(0,f.compareSeriesLabel)(t,e.title)),g=a||!e.some(e=>e.tabId===m)?"all":m,y=e.filter(e=>!s.has(e.tabId)),v=!a&&y.length>=2?(0,F.compareFairness)(y.map(e=>e.report),y.map(t=>b[e.indexOf(t)])):null;return(0,t.jsxs)("div",{ref:x,className:"min-h-0 flex-1 overflow-y-auto",children:[(0,t.jsxs)("header",{className:"sticky top-0 z-10 border-b border-line bg-canvas/95 px-4 pt-3 backdrop-blur lg:px-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)("h2",{className:"text-base font-medium text-ink",children:o}),(0,t.jsx)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:d})]}),(0,t.jsx)("div",{role:"tablist","aria-label":"Comparison or one run",className:"-mb-px mt-3 flex gap-1 overflow-x-auto",children:[{id:"all",label:"Comparison",color:null},...e.map((e,t)=>({id:e.tabId,label:b[t],color:(0,z.seriesColor)(t)}))].map(e=>{let r=g===e.id,l=s.has(e.id);return(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":r,disabled:a&&"all"!==e.id,title:a&&"all"!==e.id?"Each run's own report opens when the compare has finished":e.label,onClick:()=>{u(e.id),x.current?.scrollTo({top:0})},className:`flex max-w-[18rem] shrink-0 items-center gap-2 rounded-t-md border border-b-0 px-3 py-2 text-sm disabled:opacity-50 ${r?"border-line bg-panel font-medium text-ink":"border-transparent text-mute hover:bg-panel-2 hover:text-ink"}`,children:[e.color?(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:e.color},"aria-hidden":!0}):null,(0,t.jsx)("span",{className:"truncate",children:e.label}),l?(0,t.jsx)(n.Loader2,{size:12,className:"shrink-0 animate-spin text-accent","aria-label":"running"}):null]},e.id)})})]}),(0,t.jsx)("div",{className:"space-y-4 px-4 py-4 lg:px-6",children:"all"===g?(0,t.jsxs)(t.Fragment,{children:[c,p,v?.unfair?(0,t.jsxs)("p",{role:"note",className:"flex items-start gap-2 rounded-md border border-warn/40 bg-warn/10 px-3 py-2 text-sm text-ink",children:[(0,t.jsx)(R.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-warn","aria-hidden":!0}),(0,t.jsxs)("span",{children:[v.unfair," Compare runs with the same load and length to say which API is faster."]})]}):null,(0,t.jsxs)("p",{className:"text-xs text-mute",children:["saved"===r?`Saved runs: ${e.map((e,t)=>{let s;return`${b[t]} ${Number.isNaN((s=new Date(e.report.startedAt)).getTime())?"":s.toLocaleString(void 0,{day:"numeric",month:"short",hour:"numeric",minute:"2-digit"})}`}).join(" · ")}.`:"parallel"===l?"Ran at the same time — the runs shared this computer's CPU and network, so treat the numbers as directional.":"Ran one after another with the same load.",v&&!v.unfair&&v.caveats.length?` Note: ${v.caveats.join("; ")}.`:""]}),e.length>=2?(0,t.jsx)(E.Dashboard,{scope:"compare",data:{reports:e.map(e=>e.report),titles:e.map((e,t)=>b[t]+(s.has(e.tabId)?" · live":"")),slo:i,live:a}}):(0,t.jsx)("p",{className:"rounded-lg border border-dashed border-line px-6 py-14 text-center text-sm text-mute",children:a?"The overlay appears when the first API is under way…":"The overlay needs at least two finished runs."})]}):(0,t.jsx)(T.ReportView,{report:e.find(e=>e.tabId===g).report,source:"engine"})})]})}var O=e.i(2385),q=e.i(19656);function L(e){let t=Math.max(0,Math.ceil(e/1e3)),s=Math.floor(t/60),a=t%60;return s>0?`${s}:${String(a).padStart(2,"0")}`:`${a}s`}function M(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let s=Math.floor(t/60),a=t%60;return a?`${s}m ${a}s`:`${s}m`}function U({mode:e,phase:s,liveRuns:a,startedAt:r,endedAt:n}){let[l,i]=(0,h.useState)(()=>Date.now()),o="running"===s||"probing"===s||"between"===s;return((0,h.useEffect)(()=>{if(!o)return;let e=setInterval(()=>i(Date.now()),250);return()=>clearInterval(e)},[o]),"idle"===s)?null:"probing"===s?(0,t.jsxs)("div",{className:"rounded-md border border-accent/30 bg-accent-dim px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs tracking-wide text-accent uppercase",children:"Checking APIs"}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:"Probing each API before load. This can take a few seconds."})]}):"between"===s?(0,t.jsxs)("div",{className:"rounded-md border border-accent/30 bg-accent-dim px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs tracking-wide text-accent uppercase",children:"Preparing next API"}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:"Processing the last run and starting the next one. Sequence compares take a moment between APIs."}),r?(0,t.jsxs)("p",{className:"mt-1 font-mono text-sm text-ink",children:["Elapsed ",M(l-Date.parse(r))]}):null]}):"done"===s&&r&&n?(0,t.jsxs)("div",{className:"rounded-md border border-line bg-panel-2 px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs tracking-wide text-mute uppercase",children:"Overall time taken"}),(0,t.jsx)("p",{className:"mt-0.5 font-mono text-lg text-ink",children:(0,q.formatDuration)(r,n)}),(0,t.jsxs)("p",{className:"mt-0.5 text-xs text-mute",children:["Wall clock for the whole compare (",e,"), including probes and gaps between runs."]})]}):"running"!==s||0===a.length?null:(0,t.jsxs)("div",{className:"space-y-2",children:[a.map(e=>{let s=(0,O.expectedLoadMs)(e.report),a=Math.max(0,l-Date.parse(e.report.startedAt)),r=Math.max(0,s-a),n="running"===e.status&&0===r;return(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-accent/30 bg-accent-dim px-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-xs tracking-wide text-accent uppercase",children:["queued"===e.status?"Starting":n?"Finishing":"Load running"," · ",e.title]}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:n?"Clock hit zero. k6 is letting in-flight requests finish.":`${L(a)} elapsed`})]}),(0,t.jsx)("div",{className:"font-mono text-2xl tabular text-ink",children:"queued"===e.status?"…":n?"—":L(r)})]},e.report.id)}),r?(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Compare elapsed ",M(l-Date.parse(r))]}):null]})}var B=e.i(22543),J=e.i(63343),V=e.i(44794),H=e.i(31753),K=e.i(60566),_=e.i(39170),W=e.i(28867),X=e.i(56396);e.i(42674);var G=e.i(5305);let Z="apitestcenter-compare-draft";function Q(){return globalThis.crypto?.randomUUID?.()??`tab-${Date.now()}-${Math.random().toString(16).slice(2)}`}function Y(e){return{...(0,G.defaultRequestDraft)(),id:Q(),title:e}}function ee(){let e=Y("API 1");return{tabs:[e,Y("API 2")],activeId:e.id,load:{...G.DEFAULT_LOAD}}}function et(e,t){let s=e&&"object"==typeof e?e:{},a="string"==typeof s.title&&s.title.trim()||"string"==typeof s.label&&s.label.trim()||t;return{...(0,G.requestFromUnknown)(e),id:"string"==typeof s.id&&s.id?s.id:Q(),title:a,collection:"string"==typeof s.collection&&s.collection?s.collection:void 0}}var es=e.i(21206),ea=e.i(20054),er=e.i(68228),en=e.i(65638),el=e.i(6278),ei=e.i(46679),eo=e.i(65238),ed=e.i(727),ec=e.i(59180),ep=e.i(2603);let em=new Set(["title"]);function eu({tabs:e,activeId:s,probes:a,liveByTab:r,reports:l,running:i,onSelect:d,onRename:c,onClose:p,onAdd:u}){let[x,f]=(0,h.useState)(null);return(0,t.jsxs)("div",{className:"flex items-end gap-1 overflow-x-auto border-b border-line bg-canvas px-2 pt-2",role:"tablist","aria-label":"APIs to compare",children:[e.map((o,u)=>{let h=o.id===s,b=a[o.id],g=!!r[o.id],y=l.some(e=>e.tabId===o.id);return(0,t.jsxs)("div",{className:`group flex max-w-[15rem] shrink-0 items-center gap-1.5 rounded-t-md border border-b-0 pr-1 pl-2.5 text-sm ${h?"-mb-px border-line bg-panel text-ink":"border-transparent text-mute hover:bg-panel-2 hover:text-ink"}`,children:[(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:(0,z.seriesColor)(u)},"aria-hidden":!0}),x===o.id?(0,t.jsx)("input",{autoFocus:!0,defaultValue:o.title,"aria-label":"API name",onBlur:e=>{c(o.id,e.target.value.trim()||`API ${u+1}`),f(null)},onKeyDown:e=>{"Enter"===e.key&&e.target.blur(),"Escape"===e.key&&f(null)},className:"w-32 bg-transparent py-2 outline-none"}):(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":h,title:"Double-click to rename",onClick:()=>d(o.id),onDoubleClick:()=>f(o.id),className:"flex min-w-0 items-center gap-1.5 py-2",children:[(0,t.jsx)("span",{className:"truncate",children:o.title||"Untitled"}),g?(0,t.jsx)(n.Loader2,{size:12,className:"shrink-0 animate-spin text-accent","aria-label":"running"}):b?(0,t.jsx)("span",{className:`shrink-0 font-mono text-xs ${(0,es.isSuccess)(b)?"text-ok":"text-bad"}`,children:b.status||"ERR"}):y?(0,t.jsx)("span",{className:"shrink-0 text-xs text-ok",children:"done"}):null]}),e.length>2?(0,t.jsx)("button",{type:"button","aria-label":`Close ${o.title}`,disabled:i,onClick:()=>p(o.id),className:"rounded p-0.5 text-mute opacity-0 group-hover:opacity-100 hover:bg-panel-2 hover:text-bad focus:opacity-100 disabled:opacity-0",children:(0,t.jsx)(m.X,{size:12})}):null]},o.id)}),(0,t.jsxs)("button",{type:"button",onClick:u,disabled:e.length>=6||i,title:e.length>=6?"Up to 6 APIs":"Add an API",className:"mb-1 ml-1 inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-xs text-mute hover:bg-panel-2 hover:text-ink disabled:opacity-40",children:[(0,t.jsx)(o.Plus,{size:14}),"Add API"]})]})}function ex({contract:e,blocked:s,skipped:a,busy:r,onProceed:n}){if(!e)return null;if("pass"===e.level)return(0,t.jsx)("p",{className:"rounded-md border border-ok/40 bg-ok/10 px-3 py-2 text-sm text-ok",children:"✓ Every API returned the same response structure."});let l=e.issues.filter(e=>!/Need at least two/.test(e.message));return(0,t.jsxs)("div",{role:s?"alert":void 0,className:"rounded-md border border-warn/40 bg-warn/10 px-3 py-2.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-warn",children:s?"Compare not started — responses differ.":a?"Structures differ (allowed for this compare).":"Responses differ."}),l.length?(0,t.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-sm text-ink",children:l.map((e,s)=>(0,t.jsx)("li",{children:e.message},s))}):null,s?(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",disabled:r,onClick:n,children:"Compare anyway"})}):null]})}function eh({entries:e,disabled:s,onPick:a}){let[n,l]=(0,h.useState)(!1),i=(0,h.useRef)(null);return(0,h.useEffect)(()=>{if(!n)return;let e=e=>!i.current?.contains(e.target)&&l(!1),t=e=>"Escape"===e.key&&l(!1);return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[n]),(0,t.jsxs)("div",{ref:i,className:"relative",children:[(0,t.jsxs)("button",{type:"button",disabled:s,"aria-haspopup":"listbox","aria-expanded":n,onClick:()=>l(e=>!e),className:"inline-flex items-center gap-1 rounded-md border border-line px-2 py-1 text-xs text-mute hover:text-ink disabled:opacity-40",children:["Past compares",(0,t.jsx)(r.ChevronDown,{size:12})]}),n?(0,t.jsx)("ul",{role:"listbox","aria-label":"Past compares",className:"absolute right-0 z-30 mt-1 max-h-80 w-80 overflow-auto rounded-md border border-line bg-panel p-1 shadow-xl",children:e.map(e=>(0,t.jsx)("li",{role:"option","aria-selected":!1,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{a(e),l(!1)},className:"flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",children:[(0,t.jsx)("span",{className:"min-w-0 truncate",children:e.name}),(0,t.jsxs)("span",{className:"shrink-0 text-mute",children:[e.titles.length," APIs"]})]})},e.id))}):null]})}function ef({children:e}){return(0,t.jsx)("div",{className:"flex flex-1 flex-col items-center justify-center rounded-lg border border-dashed border-line px-6 py-14 text-center text-sm text-mute",children:(0,t.jsx)("div",{className:"max-w-md",children:e})})}function eb(e,t){return function(e){let t=[];if(e.length<2)return{level:"fail",issues:[{level:"fail",message:"Need at least two APIs to compare"}]};for(let a of e){var s;a.probe.ok&&(s=a.probe.status)>=200&&s<300||t.push({level:"fail",message:`${a.label}: probe was ${a.probe.status||"ERR"}, not 2xx`}),a.probe.truncated&&t.push({level:"fail",message:`${a.label}: body was truncated, so the structure cannot be proven`})}let a=e.map(e=>({...e,structure:function(e){var t;let s,a=function(e,t){if(!e.trim())return"empty";if(t.toLowerCase().includes("json"))return"json";try{return JSON.parse(e),"json"}catch{return"text"}}(e.body,(s=Object.keys(t=e.headers).find(e=>"content-type"===e.toLowerCase()))?t[s]:"");if("empty"===a)return"empty";if("text"===a)return`text:${e.body}`;try{return`json:${JSON.stringify(function e(t){if(null===t)return"null";if(Array.isArray(t))return{type:"array",item:t.length>0?e(t[0]):"unknown"};if("object"==typeof t){let s={};for(let a of Object.keys(t).sort())s[a]=e(t[a]);return{type:"object",fields:s}}return typeof t}(JSON.parse(e.body)))}`}catch{return null}}(e.probe)}));if(a.some(e=>null==e.structure))t.push({level:"fail",message:"Could not parse one or more JSON bodies"});else{let e=a[0];if(e)for(let s of a.slice(1))s.structure!==e.structure&&t.push({level:"fail",message:`${s.label} response structure does not match ${e.label}`})}return{level:t.some(e=>"fail"===e.level)?"fail":t.some(e=>"warn"===e.level)?"warn":"pass",issues:t}}(e.map(e=>t[e.id]?{label:e.title||e.id,probe:t[e.id]}:null).filter(e=>!!e))}e.s(["ComparePage",0,function(){let e=(0,x.useSearchParams)(),s=(0,x.useRouter)(),r=(0,X.useToast)(),o=(0,_.useConfirm)(),f=(0,ea.useEngineHealth)(),b=(0,ep.useModKey)(),{slo:g}=(0,$.useSlo)(),{vars:y,activeEnv:v}=(0,el.useWorkspace)(),w=(0,h.useRef)(null),[j,k]=(0,h.useState)(ee),[N,I]=(0,h.useState)(!1),[S,C]=(0,h.useState)(!1),[P,F]=(0,h.useState)(null),[R,E]=(0,h.useState)({}),[T,z]=(0,h.useState)(null),[O,q]=(0,h.useState)(!1),[L,M]=(0,h.useState)("sequence"),[Q,eg]=(0,h.useState)(!1),[ey,ev]=(0,h.useState)(!1),[ew,ej]=(0,h.useState)(!1),[ek,eN]=(0,h.useState)(!1),[eI,eS]=(0,h.useState)({}),[eC,e$]=(0,h.useState)([]),[eA,eP]=(0,h.useState)(!1),[eF,eR]=(0,h.useState)(!1),{index:eE,refresh:eT}=(0,ec.useHistory)(),ez=eE?.compares??[],[eD,eO]=(0,h.useState)("idle"),[eq,eL]=(0,h.useState)(null),[eM,eU]=(0,h.useState)(null),[eB,eJ]=(0,h.useState)("response"),eV=(0,h.useRef)(!1),eH=(0,h.useRef)(new Set);(0,h.useEffect)(()=>{let t=function(){try{let e=sessionStorage.getItem(Z);if(!e)return null;let t=JSON.parse(e),s=[];if(Array.isArray(t.tabs)&&t.tabs.length>0)s=t.tabs.map((e,t)=>et(e,`API ${t+1}`)).slice(0,6);else{if(!t.a||!t.b)return null;s=[et(t.a,"API 1"),et(t.b,"API 2")]}let a="string"==typeof t.activeId&&s.some(e=>e.id===t.activeId)?t.activeId:s[0].id,r=(0,G.loadFromUnknown)(t.load??t);return{tabs:s,activeId:a,load:r}}catch{return null}}();t&&k(t);let s=e.get("compare"),a=(e.get("ids")??[e.get("a"),e.get("b")].filter(Boolean).join(",")).split(",").map(e=>e.trim()).filter(Boolean);s?ec.historyApi.compare(s).then(tt).catch(()=>r("That compare is no longer in History","error")):a.length>=2&&Promise.all(a.map(e=>ec.historyApi.run(e).catch(()=>null))).then(e=>{let t=e.filter(e=>!!e);if(t.length<2)return r("Need at least two of those runs to overlay","error");e$(t.map((e,t)=>({tabId:e.report.id,title:e.meta?.name||e.report.testName||`API ${t+1}`,report:e.report}))),eP(!0),eR(!0),eO("done"),eJ("results")}),I(!0)},[e]),(0,h.useEffect)(()=>{if(!N)return;let e=window.setTimeout(()=>(function(e){try{sessionStorage.setItem(Z,JSON.stringify(e))}catch{}})(j),250);return()=>window.clearTimeout(e)},[j,N]);let eK=j.tabs.find(e=>e.id===j.activeId)??j.tabs[0],e_=j.tabs.filter(G.isReady),eW=e_.length>=2,eX=(0,G.loadProblem)(j.load),eG=(0,h.useMemo)(()=>{let e=new Map(eC.map(e=>[e.tabId,e]));for(let[t,s]of Object.entries(eI)){if(e.has(t))continue;let a=j.tabs.find(e=>e.id===t);e.set(t,{tabId:t,title:a?.title??t,report:s.report})}let t=j.tabs.filter(t=>e.has(t.id)).map(t=>e.get(t.id));return t.length===e.size?t:[...e.values()]},[eC,eI,j.tabs]),eZ=eC.map(e=>({id:e.tabId,title:e.title,report:e.report,probe:R[e.tabId]??null})),eQ=Object.entries(eI).map(([e,t])=>({title:j.tabs.find(t=>t.id===e)?.title||e,status:t.status,report:t.report}));function eY(e,t){let s=j.tabs.find(t=>t.id===e);s&&Object.keys(t).some(e=>!em.has(e)&&t[e]!==s[e])&&R[e]&&(E(({[e]:t,...s})=>s),z(null),q(!1)),k(s=>({...s,tabs:s.tabs.map(s=>s.id===e?t:s)}))}async function e0(e){try{let t=await (0,eo.withFolders)(e,e.collection,y),s=(0,G.resolveDraft)(t.draft,t.vars,v?.name),a=(0,G.buildPayload)(s,(0,G.toLoadConfig)(j.load),(0,G.autoRunName)(s,e.title),(0,G.targetsFromSlo)(g));return await (0,ei.withRunFirst)(a,s,y,v?.name)}catch(t){throw Error(`${e.title||"API"}: ${t instanceof Error?t.message:"invalid request"}`)}}async function e1(){let e;if(!S&&!ew&&(0,G.isReady)(eK)){try{e=await e0(eK)}catch(e){F(e instanceof Error?e.message:"Invalid request");return}C(!0),F(null),eJ("response");try{let t=await (0,es.sendRequest)(e),s={...R,[eK.id]:t};E(s),z(eb(e_,s))}finally{C(!1)}}}async function e2(e,t){let s=Object.fromEntries(await Promise.all(e.map(async e=>[e.id,await (0,es.sendRequest)(t.get(e.id))])));return E(e=>({...e,...s})),s}async function e6(){let e;if(!S&&!ew&&eW){try{e=new Map(await Promise.all(e_.map(async e=>[e.id,await e0(e)])))}catch(e){F(e instanceof Error?e.message:"Invalid request");return}C(!0),F(null),q(!1);try{let t=await e2(e_,e),s=eb(e_,t);z(s),eJ("response"),r("pass"===s.level?"Every API answered with the same structure":"Checked — see the structure result","pass"===s.level?"success":"info")}finally{C(!1)}}}async function e5(e,t){let s=0;for(;;){let a=await (0,es.fetchRun)(t);if(a){if(s=0,eS(t=>({...t,[e.id]:a})),(0,es.isTerminalStatus)(a.status))return eH.current.delete(t),eV.current||e$(t=>[...t.filter(t=>t.tabId!==e.id),{tabId:e.id,title:e.title,report:a.report}]),eS(({[e.id]:t,...s})=>s),eV.current?null:a.report}else if(++s>=20)throw Error(`Lost contact with the engine while ${e.title} was running`);await new Promise(e=>window.setTimeout(e,500))}}async function e4(e,t){let s=await (0,es.startLoadRun)(t);return eH.current.add(s.id),eS(t=>({...t,[e.id]:s})),s}async function e3(e,t){let s=[];for(let a=0;a<e.length&&!eV.current;a++){let r=e[a];eO(a>0?"between":"running"),k(e=>({...e,activeId:r.id}));let n=await e4(r,t.get(r.id));eO("running");let l=await e5(r,n.id);if(!l)break;s.push({tabId:r.id,title:r.title,report:l})}return s}async function e8(e,t){eO("running");let s=await Promise.allSettled(e.map(e=>e4(e,t.get(e.id)))),a=s.find(e=>"rejected"===e.status);if(a)throw await e9(),a.reason instanceof Error?a.reason:Error("Failed to start load");return(await Promise.all(e.map(async(e,t)=>{let a=s[t].value,r=await e5(e,a.id);return r?{tabId:e.id,title:e.title,report:r}:null}))).filter(e=>!!e)}async function e7(e){let s;if(S||ew||!eW||!f.k6Ready)return;if(eX)return void F(eX);try{s=new Map(await Promise.all(e_.map(async e=>[e.id,await e0(e)])))}catch(e){F(e instanceof Error?e.message:"Invalid request");return}let a=e_.filter(e=>(0,es.needsLoadConfirm)(j.load.preset,s.get(e.id).load,s.get(e.id).request.url));if(a.length>0&&!await o({title:`Start a ${(0,J.profileSummary)(j.load)} load test against ${1===a.length?(0,es.hostOf)(s.get(a[0].id).request.url):`${a.length} hosts`}?`,body:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{className:"mb-2 list-disc pl-5 font-mono text-xs text-ink",children:a.map(e=>(0,t.jsx)("li",{children:(0,es.hostOf)(s.get(e.id).request.url)},e.id))}),"parallel"===L?"All APIs run at the same time":"APIs run one after another"," with"," ",(0,J.profileSummary)(j.load)," each. Only load-test systems you own or are allowed to test.",(0,t.jsxs)("span",{className:"mt-2 block",children:["Each simulated user sends its next request as soon as the last one returns, so a few dozen users can mean thousands of requests per second. Public sites and APIs behind a CDN or firewall usually answer that with ",(0,t.jsx)("span",{className:"text-ink",children:"429"})," or"," ",(0,t.jsx)("span",{className:"text-ink",children:"403"})," and may block this computer for a while — test a staging server, or use Requests per second mode with a modest rate."]})]}),confirmLabel:"Start compare",tone:"danger"}))return;let n=e||Q;eV.current=!1,eH.current.clear(),F(null),C(!0),ej(!0),eP(!1),eR(!1),e$([]),eS({}),ev(!1),eL(new Date().toISOString()),eU(null),eO("probing"),eJ("results");try{let e=await e2(e_,s),t=e_.filter(t=>!(0,es.isSuccess)(e[t.id]));if(t.length){F(`Every API needs a 2xx check before load. Not 2xx: ${t.map(t=>`${t.title} (${e[t.id]?.status||"error"})`).join(", ")}`),k(e=>({...e,activeId:t[0].id})),eJ("response"),eO("idle");return}let a=eb(e_,e);if(z(a),"fail"===a.level&&!n){q(!0),eJ("response"),eO("idle");return}q(!1),"fail"===a.level&&ev(!0);let l="parallel"===L?await e8(e_,s):await e3(e_,s);if(eU(new Date().toISOString()),l.length>=2&&!eV.current){try{await ec.historyApi.saveCompare({mode:L,ignoreStructure:n,apis:l.map(t=>({id:t.tabId,title:t.title,report:t.report,probe:e[t.tabId]??null}))}),r("Compare finished and saved to History","success"),(0,ed.notifyFinished)({title:"Compare finished",body:`${l.map(e=>e.title).join(" vs ")}
|
|
51
|
-
Saved to History.`,ok:!0})}catch(e){
|
|
50
|
+
</Relationships>`,"xl/styles.xml":k};for(let e of c)x[`xl/worksheets/sheet${e.id}.xml`]=e.xml;return new Blob([(0,w.zipStore)(x)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}async function S(e,t,s){let r=N().replace(/\.xlsx$/,""),a={[`${r}.xlsx`]:new Uint8Array(await (await I(e,t,s)).arrayBuffer()),[`${r}.json`]:(0,b.exportCompareJson)(e,t)};for(let t of e){if(!t.probe)continue;let e=t.title.replace(/[^\w.-]+/g,"-").slice(0,40)||t.id.slice(0,8);a[`${e}-probe.json`]=(0,b.exportProbeJson)(t.probe)}return{base:r,blob:(0,w.zipStore)(a)}}var C=e.i(15060),$=e.i(88153);function A({apis:e,mode:s,probes:r}){var n,l,i;let o,d,c,p,m,{slo:u}=(0,$.useSlo)(),x=N(),v=x.replace(/\.xlsx$/,""),j=Object.entries(r).filter(e=>!!e[1]),[k,F]=(0,h.useState)(!1),[R,E]=(0,h.useState)(null),[T,z]=(0,h.useState)(null);if(0===e.length)return null;let D=(n=e,l=s,i=u,o=n.map(e=>e.title),d=`Compare: ${o.join(" vs ")}`.slice(0,120),c=n.length>=2?(0,f.compareKpis)(n.map(e=>e.report)):[],p=[`APITestCenter compare (${l})`,"",...n.map(e=>`- ${e.title}: ${e.report.testName} [${e.report.status}]`),"",...c.map(e=>{let t=e.values.map((t,s)=>{var r,a;return`${o[s]}=${r=t,"ms"===(a=e.unit)?`${Math.round(r)}ms`:"rps"===a?`${r.toFixed(1)}/s`:"pct"===a?`${(100*r).toFixed(2)}%`:String(Math.round(r))}`}).join(", "),s=null==e.winner?"tie":o[e.winner]??"tie";return`${e.label}: ${t} (best: ${s})`})],i&&p.push("",`Performance targets: p95 ${i.p95Ms} ms, errors ${(100*i.errorRate).toFixed(1)}%`),p.push("","Attach the Excel or Zip export from APITestCenter."),{subject:d,body:m=p.join("\n"),mailto:`mailto:?subject=${encodeURIComponent(d)}&body=${encodeURIComponent(m)}`,gmail:`https://mail.google.com/mail/?view=cm&fs=1&tf=1&su=${encodeURIComponent(d)}&body=${encodeURIComponent(m)}`,outlook:`https://outlook.office.com/mail/deeplink/compose?subject=${encodeURIComponent(d)}&body=${encodeURIComponent(m)}`});async function O(){z(null),F(!1);try{let{base:t,blob:r}=await S(e,s,u),a={files:[new File([r],`${t}-export.zip`,{type:"application/zip"})],title:D.subject,text:D.body};if(navigator.canShare?.({files:a.files}))return void await navigator.share(a);E("mailto")}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;E("mailto"),z(e instanceof Error?e.message:"Share failed")}}return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"mr-1 flex items-center gap-1.5 text-xs text-mute",children:[(0,t.jsx)(g.Download,{size:14}),"Export"]}),(0,t.jsx)("button",{type:"button",disabled:e.length<2,className:"rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent disabled:opacity-40",onClick:()=>void I(e,s,u).then(e=>(0,C.downloadBlob)(x,e)),children:"Excel"}),(0,t.jsx)("button",{type:"button",className:"rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent",onClick:()=>(0,C.downloadText)(`${v}.json`,(0,b.exportCompareJson)(e,s),"application/json"),children:"JSON"}),(0,t.jsx)("button",{type:"button",disabled:0===j.length,className:"rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent disabled:opacity-40",onClick:()=>{let t={};for(let[s,r]of j){let a=e.find(e=>e.id===s),n=(a?.title??s).replace(/[^\w.-]+/g,"-").slice(0,40);t[`${n}-probe.json`]=(0,b.exportProbeJson)(r)}(0,C.downloadBlob)(`${v}-probes.zip`,(0,w.zipStore)(t))},children:"Response JSONs"}),(0,t.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent",onClick:()=>void S(e,s,u).then(({base:e,blob:t})=>(0,C.downloadBlob)(`${e}-export.zip`,t)),children:[(0,t.jsx)(g.Download,{size:12}),"Zip"]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>F(e=>!e),className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink hover:border-accent hover:text-accent",children:[(0,t.jsx)(y.Share2,{size:12}),"Share",(0,t.jsx)(a.ChevronDown,{size:12})]}),k?(0,t.jsxs)("div",{className:"absolute right-0 z-20 mt-1 w-56 rounded-md border border-line bg-panel p-1 shadow-lg",children:[(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>{F(!1),E("gmail")},children:"Gmail"}),(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>{F(!1),E("outlook")},children:"Outlook on the web"}),(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>{F(!1),E("mailto")},children:"Default mail app"}),(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",onClick:()=>void O(),children:"System share"})]}):null]})]}),T?(0,t.jsx)("p",{className:"max-w-md text-xs text-mute",children:T}):null,R?(0,t.jsx)(P,{apis:e,mode:s,target:R,links:D,onClose:()=>E(null)}):null]})}function P({apis:e,mode:s,target:r,links:a,onClose:n}){let{slo:l}=(0,$.useSlo)(),i={gmail:"Gmail",outlook:"Outlook on the web",mailto:"default mail app"},o="gmail"===r?a.gmail:"outlook"===r?a.outlook:a.mailto;return(0,t.jsx)("div",{className:"fixed inset-0 z-50 grid place-items-center bg-canvas/70 p-4",role:"presentation",onClick:n,children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true",className:"w-full max-w-md rounded-lg border border-line bg-panel p-4 shadow-xl",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("h2",{className:"text-sm font-medium text-ink",children:["Share via ",i[r]]}),(0,t.jsx)("p",{className:"mt-2 text-xs leading-5 text-mute",children:"Download the compare package, then attach it in the compose window. Browsers cannot attach files for you."}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,t.jsx)("button",{type:"button",className:"rounded-md border border-line bg-panel-2 px-2.5 py-1.5 text-xs text-ink",onClick:()=>void I(e,s,l).then(e=>(0,C.downloadBlob)(N(),e)),children:"Download Excel"}),(0,t.jsx)("button",{type:"button",className:"rounded-md border border-line bg-panel-2 px-2.5 py-1.5 text-xs text-ink",onClick:()=>void S(e,s,l).then(({base:e,blob:t})=>(0,C.downloadBlob)(`${e}-export.zip`,t)),children:"Download Zip"}),(0,t.jsxs)("a",{href:o,target:"_blank",rel:"noreferrer",className:"rounded-md bg-accent px-2.5 py-1.5 text-xs font-medium text-canvas",onClick:n,children:["Open ",i[r]]}),(0,t.jsx)("button",{type:"button",className:"rounded-md px-2.5 py-1.5 text-xs text-mute",onClick:n,children:"Close"})]})]})})}var F=e.i(55658),R=e.i(53012),E=e.i(45404),T=e.i(29724),z=e.i(88231);function D({items:e,liveTabs:s,running:r,source:a,mode:l,slo:i,title:o,actions:d,status:c,exportBar:p}){let[m,u]=(0,h.useState)("all"),x=(0,h.useRef)(null),b=e.map((e,t)=>(0,f.compareSeriesLabel)(t,e.title)),g=r||!e.some(e=>e.tabId===m)?"all":m,y=e.filter(e=>!s.has(e.tabId)),v=!r&&y.length>=2?(0,F.compareFairness)(y.map(e=>e.report),y.map(t=>b[e.indexOf(t)])):null;return(0,t.jsxs)("div",{ref:x,className:"min-h-0 flex-1 overflow-y-auto",children:[(0,t.jsxs)("header",{className:"sticky top-0 z-10 border-b border-line bg-canvas/95 px-4 pt-3 backdrop-blur lg:px-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)("h2",{className:"text-base font-medium text-ink",children:o}),(0,t.jsx)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:d})]}),(0,t.jsx)("div",{role:"tablist","aria-label":"Comparison or one run",className:"-mb-px mt-3 flex gap-1 overflow-x-auto",children:[{id:"all",label:"Comparison",color:null},...e.map((e,t)=>({id:e.tabId,label:b[t],color:(0,z.seriesColor)(t)}))].map(e=>{let a=g===e.id,l=s.has(e.id);return(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":a,disabled:r&&"all"!==e.id,title:r&&"all"!==e.id?"Each run's own report opens when the compare has finished":e.label,onClick:()=>{u(e.id),x.current?.scrollTo({top:0})},className:`flex max-w-[18rem] shrink-0 items-center gap-2 rounded-t-md border border-b-0 px-3 py-2 text-sm disabled:opacity-50 ${a?"border-line bg-panel font-medium text-ink":"border-transparent text-mute hover:bg-panel-2 hover:text-ink"}`,children:[e.color?(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:e.color},"aria-hidden":!0}):null,(0,t.jsx)("span",{className:"truncate",children:e.label}),l?(0,t.jsx)(n.Loader2,{size:12,className:"shrink-0 animate-spin text-accent","aria-label":"running"}):null]},e.id)})})]}),(0,t.jsx)("div",{className:"space-y-4 px-4 py-4 lg:px-6",children:"all"===g?(0,t.jsxs)(t.Fragment,{children:[c,p,v?.unfair?(0,t.jsxs)("p",{role:"note",className:"flex items-start gap-2 rounded-md border border-warn/40 bg-warn/10 px-3 py-2 text-sm text-ink",children:[(0,t.jsx)(R.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-warn","aria-hidden":!0}),(0,t.jsxs)("span",{children:[v.unfair," Compare runs with the same load and length to say which API is faster."]})]}):null,(0,t.jsxs)("p",{className:"text-xs text-mute",children:["saved"===a?`Saved runs: ${e.map((e,t)=>{let s;return`${b[t]} ${Number.isNaN((s=new Date(e.report.startedAt)).getTime())?"":s.toLocaleString(void 0,{day:"numeric",month:"short",hour:"numeric",minute:"2-digit"})}`}).join(" · ")}.`:"parallel"===l?"Ran at the same time — the runs shared this computer's CPU and network, so treat the numbers as directional.":"Ran one after another with the same load.",v&&!v.unfair&&v.caveats.length?` Note: ${v.caveats.join("; ")}.`:""]}),e.length>=2?(0,t.jsx)(E.Dashboard,{scope:"compare",data:{reports:e.map(e=>e.report),titles:e.map((e,t)=>b[t]+(s.has(e.tabId)?" · live":"")),slo:i,live:r}}):(0,t.jsx)("p",{className:"rounded-lg border border-dashed border-line px-6 py-14 text-center text-sm text-mute",children:r?"The overlay appears when the first API is under way…":"The overlay needs at least two finished runs."})]}):(0,t.jsx)(T.ReportView,{report:e.find(e=>e.tabId===g).report,source:"engine"})})]})}var O=e.i(2385),q=e.i(19656);function L(e){let t=Math.max(0,Math.ceil(e/1e3)),s=Math.floor(t/60),r=t%60;return s>0?`${s}:${String(r).padStart(2,"0")}`:`${r}s`}function M(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let s=Math.floor(t/60),r=t%60;return r?`${s}m ${r}s`:`${s}m`}function U({mode:e,phase:s,liveRuns:r,startedAt:a,endedAt:n}){let[l,i]=(0,h.useState)(()=>Date.now()),o="running"===s||"probing"===s||"between"===s;return((0,h.useEffect)(()=>{if(!o)return;let e=setInterval(()=>i(Date.now()),250);return()=>clearInterval(e)},[o]),"idle"===s)?null:"probing"===s?(0,t.jsxs)("div",{className:"rounded-md border border-accent/30 bg-accent-dim px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs tracking-wide text-accent uppercase",children:"Checking APIs"}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:"Probing each API before load. This can take a few seconds."})]}):"between"===s?(0,t.jsxs)("div",{className:"rounded-md border border-accent/30 bg-accent-dim px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs tracking-wide text-accent uppercase",children:"Preparing next API"}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:"Processing the last run and starting the next one. Sequence compares take a moment between APIs."}),a?(0,t.jsxs)("p",{className:"mt-1 font-mono text-sm text-ink",children:["Elapsed ",M(l-Date.parse(a))]}):null]}):"done"===s&&a&&n?(0,t.jsxs)("div",{className:"rounded-md border border-line bg-panel-2 px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs tracking-wide text-mute uppercase",children:"Overall time taken"}),(0,t.jsx)("p",{className:"mt-0.5 font-mono text-lg text-ink",children:(0,q.formatDuration)(a,n)}),(0,t.jsxs)("p",{className:"mt-0.5 text-xs text-mute",children:["Wall clock for the whole compare (",e,"), including probes and gaps between runs."]})]}):"running"!==s||0===r.length?null:(0,t.jsxs)("div",{className:"space-y-2",children:[r.map(e=>{let s=(0,O.expectedLoadMs)(e.report),r=Math.max(0,l-Date.parse(e.report.startedAt)),a=Math.max(0,s-r),n="running"===e.status&&0===a;return(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-accent/30 bg-accent-dim px-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-xs tracking-wide text-accent uppercase",children:["queued"===e.status?"Starting":n?"Finishing":"Load running"," · ",e.title]}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:n?"Clock hit zero. k6 is letting in-flight requests finish.":`${L(r)} elapsed`})]}),(0,t.jsx)("div",{className:"font-mono text-2xl tabular text-ink",children:"queued"===e.status?"…":n?"—":L(a)})]},e.report.id)}),a?(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Compare elapsed ",M(l-Date.parse(a))]}):null]})}var B=e.i(22543),J=e.i(63343),V=e.i(44794),H=e.i(31753),K=e.i(60566),_=e.i(39170),W=e.i(28867),X=e.i(56396);e.i(42674);var G=e.i(5305);let Z="apitestcenter-compare-draft";function Q(){return globalThis.crypto?.randomUUID?.()??`tab-${Date.now()}-${Math.random().toString(16).slice(2)}`}function Y(e){return{...(0,G.defaultRequestDraft)(),id:Q(),title:e}}function ee(){let e=Y("API 1");return{tabs:[e,Y("API 2")],activeId:e.id,load:{...G.DEFAULT_LOAD}}}function et(e,t){let s=e&&"object"==typeof e?e:{},r="string"==typeof s.title&&s.title.trim()||"string"==typeof s.label&&s.label.trim()||t;return{...(0,G.requestFromUnknown)(e),id:"string"==typeof s.id&&s.id?s.id:Q(),title:r,collection:"string"==typeof s.collection&&s.collection?s.collection:void 0}}var es=e.i(21206),er=e.i(20054),ea=e.i(68228),en=e.i(65638),el=e.i(6278),ei=e.i(46679),eo=e.i(65238),ed=e.i(727),ec=e.i(59180),ep=e.i(2603);let em=new Set(["title"]);function eu({tabs:e,activeId:s,probes:r,liveByTab:a,reports:l,running:i,onSelect:d,onRename:c,onClose:p,onAdd:u}){let[x,f]=(0,h.useState)(null);return(0,t.jsxs)("div",{className:"flex items-end gap-1 overflow-x-auto border-b border-line bg-canvas px-2 pt-2",role:"tablist","aria-label":"APIs to compare",children:[e.map((o,u)=>{let h=o.id===s,b=r[o.id],g=!!a[o.id],y=l.some(e=>e.tabId===o.id);return(0,t.jsxs)("div",{className:`group flex max-w-[15rem] shrink-0 items-center gap-1.5 rounded-t-md border border-b-0 pr-1 pl-2.5 text-sm ${h?"-mb-px border-line bg-panel text-ink":"border-transparent text-mute hover:bg-panel-2 hover:text-ink"}`,children:[(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:(0,z.seriesColor)(u)},"aria-hidden":!0}),x===o.id?(0,t.jsx)("input",{autoFocus:!0,defaultValue:o.title,"aria-label":"API name",onBlur:e=>{c(o.id,e.target.value.trim()||`API ${u+1}`),f(null)},onKeyDown:e=>{"Enter"===e.key&&e.target.blur(),"Escape"===e.key&&f(null)},className:"w-32 bg-transparent py-2 outline-none"}):(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":h,title:"Double-click to rename",onClick:()=>d(o.id),onDoubleClick:()=>f(o.id),className:"flex min-w-0 items-center gap-1.5 py-2",children:[(0,t.jsx)("span",{className:"truncate",children:o.title||"Untitled"}),g?(0,t.jsx)(n.Loader2,{size:12,className:"shrink-0 animate-spin text-accent","aria-label":"running"}):b?(0,t.jsx)("span",{className:`shrink-0 font-mono text-xs ${(0,es.isSuccess)(b)?"text-ok":"text-bad"}`,children:b.status||"ERR"}):y?(0,t.jsx)("span",{className:"shrink-0 text-xs text-ok",children:"done"}):null]}),e.length>2?(0,t.jsx)("button",{type:"button","aria-label":`Close ${o.title}`,disabled:i,onClick:()=>p(o.id),className:"rounded p-0.5 text-mute opacity-0 group-hover:opacity-100 hover:bg-panel-2 hover:text-bad focus:opacity-100 disabled:opacity-0",children:(0,t.jsx)(m.X,{size:12})}):null]},o.id)}),(0,t.jsxs)("button",{type:"button",onClick:u,disabled:e.length>=6||i,title:e.length>=6?"Up to 6 APIs":"Add an API",className:"mb-1 ml-1 inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-xs text-mute hover:bg-panel-2 hover:text-ink disabled:opacity-40",children:[(0,t.jsx)(o.Plus,{size:14}),"Add API"]})]})}function ex({contract:e,blocked:s,skipped:r,busy:a,onProceed:n}){if(!e)return null;if("pass"===e.level)return(0,t.jsx)("p",{className:"rounded-md border border-ok/40 bg-ok/10 px-3 py-2 text-sm text-ok",children:"✓ Every API returned the same response structure."});let l=e.issues.filter(e=>!/Need at least two/.test(e.message));return(0,t.jsxs)("div",{role:s?"alert":void 0,className:"rounded-md border border-warn/40 bg-warn/10 px-3 py-2.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-warn",children:s?"Compare not started — responses differ.":r?"Structures differ (allowed for this compare).":"Responses differ."}),l.length?(0,t.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-sm text-ink",children:l.map((e,s)=>(0,t.jsx)("li",{children:e.message},s))}):null,s?(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",disabled:a,onClick:n,children:"Compare anyway"})}):null]})}function eh({entries:e,disabled:s,onPick:r}){let[n,l]=(0,h.useState)(!1),i=(0,h.useRef)(null);return(0,h.useEffect)(()=>{if(!n)return;let e=e=>!i.current?.contains(e.target)&&l(!1),t=e=>"Escape"===e.key&&l(!1);return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[n]),(0,t.jsxs)("div",{ref:i,className:"relative",children:[(0,t.jsxs)("button",{type:"button",disabled:s,"aria-haspopup":"listbox","aria-expanded":n,onClick:()=>l(e=>!e),className:"inline-flex items-center gap-1 rounded-md border border-line px-2 py-1 text-xs text-mute hover:text-ink disabled:opacity-40",children:["Past compares",(0,t.jsx)(a.ChevronDown,{size:12})]}),n?(0,t.jsx)("ul",{role:"listbox","aria-label":"Past compares",className:"absolute right-0 z-30 mt-1 max-h-80 w-80 overflow-auto rounded-md border border-line bg-panel p-1 shadow-xl",children:e.map(e=>(0,t.jsx)("li",{role:"option","aria-selected":!1,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{r(e),l(!1)},className:"flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-xs text-ink hover:bg-panel-2",children:[(0,t.jsx)("span",{className:"min-w-0 truncate",children:e.name}),(0,t.jsxs)("span",{className:"shrink-0 text-mute",children:[e.titles.length," APIs"]})]})},e.id))}):null]})}function ef({children:e}){return(0,t.jsx)("div",{className:"flex flex-1 flex-col items-center justify-center rounded-lg border border-dashed border-line px-6 py-14 text-center text-sm text-mute",children:(0,t.jsx)("div",{className:"max-w-md",children:e})})}function eb(e,t){return function(e){let t=[];if(e.length<2)return{level:"fail",issues:[{level:"fail",message:"Need at least two APIs to compare"}]};for(let r of e){var s;r.probe.ok&&(s=r.probe.status)>=200&&s<300||t.push({level:"fail",message:`${r.label}: probe was ${r.probe.status||"ERR"}, not 2xx`}),r.probe.truncated&&t.push({level:"fail",message:`${r.label}: body was truncated, so the structure cannot be proven`})}let r=e.map(e=>({...e,structure:function(e){var t;let s,r=function(e,t){if(!e.trim())return"empty";if(t.toLowerCase().includes("json"))return"json";try{return JSON.parse(e),"json"}catch{return"text"}}(e.body,(s=Object.keys(t=e.headers).find(e=>"content-type"===e.toLowerCase()))?t[s]:"");if("empty"===r)return"empty";if("text"===r)return`text:${e.body}`;try{return`json:${JSON.stringify(function e(t){if(null===t)return"null";if(Array.isArray(t))return{type:"array",item:t.length>0?e(t[0]):"unknown"};if("object"==typeof t){let s={};for(let r of Object.keys(t).sort())s[r]=e(t[r]);return{type:"object",fields:s}}return typeof t}(JSON.parse(e.body)))}`}catch{return null}}(e.probe)}));if(r.some(e=>null==e.structure))t.push({level:"fail",message:"Could not parse one or more JSON bodies"});else{let e=r[0];if(e)for(let s of r.slice(1))s.structure!==e.structure&&t.push({level:"fail",message:`${s.label} response structure does not match ${e.label}`})}return{level:t.some(e=>"fail"===e.level)?"fail":t.some(e=>"warn"===e.level)?"warn":"pass",issues:t}}(e.map(e=>t[e.id]?{label:e.title||e.id,probe:t[e.id]}:null).filter(e=>!!e))}e.s(["ComparePage",0,function(){let e=(0,x.useSearchParams)(),s=(0,x.useRouter)(),a=(0,X.useToast)(),o=(0,_.useConfirm)(),f=(0,er.useEngineHealth)(),b=(0,ep.useModKey)(),{slo:g}=(0,$.useSlo)(),{vars:y,activeEnv:v}=(0,el.useWorkspace)(),w=(0,h.useRef)(null),[j,k]=(0,h.useState)(ee),[N,I]=(0,h.useState)(!1),[S,C]=(0,h.useState)(!1),[P,F]=(0,h.useState)(null),[R,E]=(0,h.useState)({}),[T,z]=(0,h.useState)(null),[O,q]=(0,h.useState)(!1),[L,M]=(0,h.useState)("sequence"),[Q,eg]=(0,h.useState)(!1),[ey,ev]=(0,h.useState)(!1),[ew,ej]=(0,h.useState)(!1),[ek,eN]=(0,h.useState)(!1),[eI,eS]=(0,h.useState)({}),[eC,e$]=(0,h.useState)([]),[eA,eP]=(0,h.useState)(!1),[eF,eR]=(0,h.useState)(!1),{index:eE,refresh:eT}=(0,ec.useHistory)(),ez=eE?.compares??[],[eD,eO]=(0,h.useState)("idle"),[eq,eL]=(0,h.useState)(null),[eM,eU]=(0,h.useState)(null),[eB,eJ]=(0,h.useState)("response"),eV=(0,h.useRef)(!1),eH=(0,h.useRef)(new Set);(0,h.useEffect)(()=>{let t=function(){try{let e=sessionStorage.getItem(Z);if(!e)return null;let t=JSON.parse(e),s=[];if(Array.isArray(t.tabs)&&t.tabs.length>0)s=t.tabs.map((e,t)=>et(e,`API ${t+1}`)).slice(0,6);else{if(!t.a||!t.b)return null;s=[et(t.a,"API 1"),et(t.b,"API 2")]}let r="string"==typeof t.activeId&&s.some(e=>e.id===t.activeId)?t.activeId:s[0].id,a=(0,G.loadFromUnknown)(t.load??t);return{tabs:s,activeId:r,load:a}}catch{return null}}();t&&k(t);let s=e.get("compare"),r=(e.get("ids")??[e.get("a"),e.get("b")].filter(Boolean).join(",")).split(",").map(e=>e.trim()).filter(Boolean);s?ec.historyApi.compare(s).then(tt).catch(()=>a("That compare is no longer in History","error")):r.length>=2&&Promise.all(r.map(e=>ec.historyApi.run(e).catch(()=>null))).then(e=>{let t=e.filter(e=>!!e);if(t.length<2)return a("Need at least two of those runs to overlay","error");e$(t.map((e,t)=>({tabId:e.report.id,title:e.meta?.name||e.report.testName||`API ${t+1}`,report:e.report}))),eP(!0),eR(!0),eO("done"),eJ("results")}),I(!0)},[e]),(0,h.useEffect)(()=>{if(!N)return;let e=window.setTimeout(()=>(function(e){try{sessionStorage.setItem(Z,JSON.stringify(e))}catch{}})(j),250);return()=>window.clearTimeout(e)},[j,N]);let eK=j.tabs.find(e=>e.id===j.activeId)??j.tabs[0],e_=j.tabs.filter(G.isReady),eW=e_.length>=2,eX=(0,G.loadProblem)(j.load),eG=(0,h.useMemo)(()=>{let e=new Map(eC.map(e=>[e.tabId,e]));for(let[t,s]of Object.entries(eI)){if(e.has(t))continue;let r=j.tabs.find(e=>e.id===t);e.set(t,{tabId:t,title:r?.title??t,report:s.report})}let t=j.tabs.filter(t=>e.has(t.id)).map(t=>e.get(t.id));return t.length===e.size?t:[...e.values()]},[eC,eI,j.tabs]),eZ=eC.map(e=>({id:e.tabId,title:e.title,report:e.report,probe:R[e.tabId]??null})),eQ=Object.entries(eI).map(([e,t])=>({title:j.tabs.find(t=>t.id===e)?.title||e,status:t.status,report:t.report}));function eY(e,t){let s=j.tabs.find(t=>t.id===e);s&&Object.keys(t).some(e=>!em.has(e)&&t[e]!==s[e])&&R[e]&&(E(({[e]:t,...s})=>s),z(null),q(!1)),k(s=>({...s,tabs:s.tabs.map(s=>s.id===e?t:s)}))}async function e0(e){try{let t=await (0,eo.withFolders)(e,e.collection,y),s=(0,G.resolveDraft)(t.draft,t.vars,v?.name),r=(0,G.buildPayload)(s,(0,G.toLoadConfig)(j.load),(0,G.autoRunName)(s,e.title),(0,G.targetsFromSlo)(g));return await (0,ei.withRunFirst)(r,s,y,v?.name)}catch(t){throw Error(`${e.title||"API"}: ${t instanceof Error?t.message:"invalid request"}`)}}async function e1(){let e;if(!S&&!ew&&(0,G.isReady)(eK)){try{e=await e0(eK)}catch(e){F(e instanceof Error?e.message:"Invalid request");return}C(!0),F(null),eJ("response");try{let t=await (0,es.sendRequest)(e),s={...R,[eK.id]:t};E(s),z(eb(e_,s))}finally{C(!1)}}}async function e2(e,t){let s=Object.fromEntries(await Promise.all(e.map(async e=>[e.id,await (0,es.sendRequest)(t.get(e.id))])));return E(e=>({...e,...s})),s}async function e6(){let e;if(!S&&!ew&&eW){try{e=new Map(await Promise.all(e_.map(async e=>[e.id,await e0(e)])))}catch(e){F(e instanceof Error?e.message:"Invalid request");return}C(!0),F(null),q(!1);try{let t=await e2(e_,e),s=eb(e_,t);z(s),eJ("response"),a("pass"===s.level?"Every API answered with the same structure":"Checked — see the structure result","pass"===s.level?"success":"info")}finally{C(!1)}}}async function e5(e,t){let s=0;for(;;){let r=await (0,es.fetchRun)(t);if(r){if(s=0,eS(t=>({...t,[e.id]:r})),(0,es.isTerminalStatus)(r.status))return eH.current.delete(t),eV.current||e$(t=>[...t.filter(t=>t.tabId!==e.id),{tabId:e.id,title:e.title,report:r.report}]),eS(({[e.id]:t,...s})=>s),eV.current?null:r.report}else if(++s>=20)throw Error(`Lost contact with the engine while ${e.title} was running`);await new Promise(e=>window.setTimeout(e,500))}}async function e4(e,t){let s=await (0,es.startLoadRun)(t);return eH.current.add(s.id),eS(t=>({...t,[e.id]:s})),s}async function e3(e,t){let s=[];for(let r=0;r<e.length&&!eV.current;r++){let a=e[r];eO(r>0?"between":"running"),k(e=>({...e,activeId:a.id}));let n=await e4(a,t.get(a.id));eO("running");let l=await e5(a,n.id);if(!l)break;s.push({tabId:a.id,title:a.title,report:l})}return s}async function e8(e,t){eO("running");let s=await Promise.allSettled(e.map(e=>e4(e,t.get(e.id)))),r=s.find(e=>"rejected"===e.status);if(r)throw await e9(),r.reason instanceof Error?r.reason:Error("Failed to start load");return(await Promise.all(e.map(async(e,t)=>{let r=s[t].value,a=await e5(e,r.id);return a?{tabId:e.id,title:e.title,report:a}:null}))).filter(e=>!!e)}async function e7(e){let s;if(S||ew||!eW||!f.k6Ready)return;if(eX)return void F(eX);try{s=new Map(await Promise.all(e_.map(async e=>[e.id,await e0(e)])))}catch(e){F(e instanceof Error?e.message:"Invalid request");return}let r=e_.filter(e=>(0,es.needsLoadConfirm)(j.load.preset,s.get(e.id).load,s.get(e.id).request.url));if(r.length>0&&!await o({title:`Start a ${(0,J.profileSummary)(j.load)} performance test against ${1===r.length?(0,es.hostOf)(s.get(r[0].id).request.url):`${r.length} hosts`}?`,body:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{className:"mb-2 list-disc pl-5 font-mono text-xs text-ink",children:r.map(e=>(0,t.jsx)("li",{children:(0,es.hostOf)(s.get(e.id).request.url)},e.id))}),"parallel"===L?"All APIs run at the same time":"APIs run one after another"," with"," ",(0,J.profileSummary)(j.load)," each. Only load-test systems you own or are allowed to test.",(0,t.jsxs)("span",{className:"mt-2 block",children:["Each simulated user sends its next request as soon as the last one returns, so a few dozen users can mean thousands of requests per second. Public sites and APIs behind a CDN or firewall usually answer that with ",(0,t.jsx)("span",{className:"text-ink",children:"429"})," or"," ",(0,t.jsx)("span",{className:"text-ink",children:"403"})," and may block this computer for a while — test a staging server, or use Requests per second mode with a modest rate."]})]}),confirmLabel:"Start compare",tone:"danger"}))return;let n=e||Q;eV.current=!1,eH.current.clear(),F(null),C(!0),ej(!0),eP(!1),eR(!1),e$([]),eS({}),ev(!1),eL(new Date().toISOString()),eU(null),eO("probing"),eJ("results");try{let e=await e2(e_,s),t=e_.filter(t=>!(0,es.isSuccess)(e[t.id]));if(t.length){F(`Every API needs a 2xx check before load. Not 2xx: ${t.map(t=>`${t.title} (${e[t.id]?.status||"error"})`).join(", ")}`),k(e=>({...e,activeId:t[0].id})),eJ("response"),eO("idle");return}let r=eb(e_,e);if(z(r),"fail"===r.level&&!n){q(!0),eJ("response"),eO("idle");return}q(!1),"fail"===r.level&&ev(!0);let l="parallel"===L?await e8(e_,s):await e3(e_,s);if(eU(new Date().toISOString()),l.length>=2&&!eV.current){try{await ec.historyApi.saveCompare({mode:L,ignoreStructure:n,apis:l.map(t=>({id:t.tabId,title:t.title,report:t.report,probe:e[t.tabId]??null}))}),a("Compare finished and saved to History","success"),(0,ed.notifyFinished)({title:"Compare finished",body:`${l.map(e=>e.title).join(" vs ")}
|
|
51
|
+
Saved to History.`,ok:!0})}catch(e){a(`Compare finished, but saving it failed: ${e instanceof Error?e.message:"unknown error"}`,"error")}eT()}else eV.current&&a("Compare stopped","info");eO(eV.current?"idle":"done")}catch(e){F(e instanceof Error?e.message:"Compare failed"),eO("idle")}finally{eH.current.size>0&&await e9(),C(!1),ej(!1),eN(!1),eS({})}}async function e9(){await Promise.all([...eH.current].map(e=>(0,es.stopLoadRun)(e)))}async function te(){eV.current=!0,eN(!0),await e9()}function tt(e){e$(e.apis.map(e=>({tabId:e.id,title:e.title,report:e.report})));let t={};for(let s of e.apis)s.probe&&(t[s.id]=s.probe);E(t),M(e.mode),eg(!!e.meta?.ignoreStructure),ev(!!e.meta?.ignoreStructure),eP(!0),eR(!1),q(!1),z(null),eO("done");let s=e.apis.map(e=>Date.parse(e.report.startedAt)).filter(Number.isFinite),r=e.apis.map(e=>Date.parse(e.report.endedAt)).filter(Number.isFinite);eL(s.length?new Date(Math.min(...s)).toISOString():e.exportedAt),eU(r.length?new Date(Math.max(...r)).toISOString():e.exportedAt),eJ("results")}async function ts(e){try{tt(await ec.historyApi.compare(e.id))}catch(e){a(e instanceof Error?e.message:"Could not open that compare","error")}}(0,ep.useShortcuts)({send:()=>void e1(),run:()=>void e7(!1),focusUrl:()=>w.current?.focus()});let tr=R[eK.id],ta=f.k6Ready?eW?eX??void 0:"Give at least two APIs a URL":f.k6Label,tn=ez.length>0?(0,t.jsx)(eh,{entries:ez,disabled:ew,onPick:e=>void ts(e)}):null;if("results"===eB){let e=eG.length||e_.length;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("h1",{className:"sr-only",children:"Compare APIs"}),(0,t.jsx)(D,{items:eG,liveTabs:new Set(Object.keys(eI)),running:ew,source:eF?"saved":"compare",mode:L,slo:g,title:eF?`Comparing ${e} saved runs`:eA?`Saved compare \xb7 ${e} APIs`:ew?`Comparing ${e} APIs…`:`Compare results \xb7 ${e} APIs`,actions:ew?(0,t.jsxs)("button",{type:"button",className:"btn btn-danger",disabled:ek,onClick:()=>void te(),children:[ek?(0,t.jsx)(n.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(p.Square,{size:16}),ek?"Stopping…":"Stop"]}):(0,t.jsxs)(t.Fragment,{children:[tn,eA?(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>{e$([]),E({}),eP(!1),eR(!1),eO("idle"),eJ("response"),s.replace("/compare")},title:"Close these results and set up a new compare",children:[(0,t.jsx)(m.X,{size:16}),"Close"]}):(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>eJ("response"),title:"Back to the APIs and the shared load",children:[(0,t.jsx)(l.Pencil,{size:16}),"Edit setup"]})]}),status:eF?null:(0,t.jsx)(U,{mode:L,phase:eD,liveRuns:eQ,startedAt:eq,endedAt:eM}),exportBar:eZ.length>0&&!ew?(0,t.jsx)(A,{apis:eZ,mode:L,probes:R}):null})]})}return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("h1",{className:"sr-only",children:"Compare APIs"}),(0,t.jsx)(eu,{tabs:j.tabs,activeId:eK.id,probes:R,liveByTab:eI,reports:eC,running:ew,onSelect:e=>k(t=>({...t,activeId:e})),onRename:(e,t)=>eY(e,{...j.tabs.find(t=>t.id===e),title:t}),onClose:function(e){j.tabs.length<=2||ew||(k(t=>{let s=t.tabs.findIndex(t=>t.id===e),r=t.tabs.filter(t=>t.id!==e),a=t.activeId===e?r[Math.max(0,s-1)]?.id??r[0].id:t.activeId;return{...t,tabs:r,activeId:a}}),E(({[e]:t,...s})=>s),e$(t=>t.filter(t=>t.tabId!==e)))},onAdd:function(){if(j.tabs.length>=6)return;let e=Y(`API ${j.tabs.length+1}`);k(t=>({...t,tabs:[...t.tabs,e],activeId:e.id})),window.setTimeout(()=>w.current?.focus(),0)}}),(0,t.jsxs)("header",{className:"border-b border-line bg-panel px-4 py-3 lg:px-6",children:[(0,t.jsx)(V.RequestBar,{ref:w,draft:eK,onChange:e=>eY(eK.id,{...eK,...e}),onImported:e=>a(e,"success"),actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-primary",disabled:S||ew||!(0,G.isReady)(eK),title:`Send this API once (${b}+Enter)`,onClick:()=>void e1(),children:[S&&!ew?(0,t.jsx)(n.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(d.Send,{size:16}),"Send"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",disabled:S||ew||!eW,title:"Send every API once and compare response structure",onClick:()=>void e6(),children:[(0,t.jsx)(c,{size:16}),"Send all"]}),ew?(0,t.jsxs)("button",{type:"button",className:"btn btn-danger",disabled:ek,onClick:()=>void te(),children:[ek?(0,t.jsx)(n.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(p.Square,{size:16}),ek?"Stopping…":"Stop"]}):(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",disabled:S||!!ta,title:ta??`Check every API, then run the shared load on each (${b}+Shift+Enter)`,onClick:()=>void e7(!1),children:[(0,t.jsx)(i.Play,{size:16}),"Compare load"]})]})}),(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)(ea.EnvironmentBar,{drafts:j.tabs,collections:j.tabs.map(e=>e.collection)}),(0,t.jsx)(en.RequestPicker,{onOpen:e=>{eY(eK.id,{...eK,...(0,G.requestFromUnknown)(e.request),id:eK.id,title:e.name,collection:e.collection||void 0}),a(`Loaded “${e.name}” into this tab`,"success")}}),P?(0,t.jsx)("p",{role:"alert",className:"text-xs text-bad",children:P}):null]})]}),(0,t.jsxs)("div",{className:"grid min-h-0 flex-1 overflow-y-auto lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] lg:overflow-hidden 2xl:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]",children:[(0,t.jsxs)("section",{"aria-label":"Request",className:"min-w-0 space-y-6 px-4 py-4 lg:overflow-y-auto lg:px-6",children:[(0,t.jsx)(H.RequestEditor,{id:"compare-request",draft:eK,collection:eK.collection,onChange:e=>eY(eK.id,{...eK,...e}),checkResults:R[eK.id]?.checks,lastBody:R[eK.id]?.body,setupResult:R[eK.id]?.setup}),(0,t.jsxs)("section",{className:"space-y-4 rounded-lg border border-line bg-panel p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h2",{className:"flex items-center gap-1.5 text-sm font-medium text-ink",children:["Compare setup",(0,t.jsx)(B.Hint,{text:"These settings apply to every API, so their timelines line up in the overlay."})]}),(0,t.jsxs)("p",{className:"mt-0.5 text-xs text-mute",children:["Applies to all ",j.tabs.length," APIs."]})]}),(0,t.jsx)(J.LoadEditor,{load:j.load,onChange:e=>k(t=>({...t,load:e}))}),(0,t.jsxs)("div",{className:"space-y-2 border-t border-line pt-4",children:[(0,t.jsx)("span",{className:"block text-xs text-mute",children:"Run mode"}),(0,t.jsx)(W.Segmented,{label:"Run mode",value:L,onChange:M,options:[{value:"sequence",label:"One after another"},{value:"parallel",label:"All at once"}]}),(0,t.jsx)("p",{className:"text-xs text-mute",children:"sequence"===L?"Fairest comparison: each API gets this computer's full CPU and network.":"Faster, but the runs share CPU and network, so treat the numbers as directional."}),(0,t.jsxs)("label",{className:"flex items-start gap-2 pt-1 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:Q,onChange:e=>eg(e.target.checked),className:"mt-1 accent-[var(--accent)]"}),(0,t.jsxs)("span",{children:["Allow different response structures",(0,t.jsx)("span",{className:"block text-xs text-mute",children:"By default every API must return the same JSON shape, so you compare like with like. Each still needs a 2xx."})]})]})]})]})]}),(0,t.jsxs)("section",{"aria-label":"Response",className:"@container flex min-h-[32rem] min-w-0 flex-col border-line bg-panel/40 px-4 py-4 lg:min-h-0 lg:overflow-y-auto lg:border-l lg:px-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line pb-2",children:[(0,t.jsxs)("h2",{className:"text-sm font-medium text-ink",children:["Response · ",eK.title||"API",tr?(0,t.jsx)("span",{className:`ml-2 font-mono text-xs ${(0,es.isSuccess)(tr)?"text-ok":"text-bad"}`,children:tr.status||"ERR"}):null]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[tn,eG.length>=2?(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>eJ("results"),children:["View results",(0,t.jsx)(r,{size:14})]}):null]})]}),(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col space-y-4 pt-4",children:[(0,t.jsx)(ex,{contract:T,blocked:O,skipped:ey,busy:S||ew,onProceed:()=>void e7(!0)}),tr?(0,t.jsx)(K.ResponseViewer,{result:tr}):(0,t.jsxs)(ef,{children:[(0,t.jsxs)("p",{children:["Give each tab a URL, choose the shared load, then press ",(0,t.jsx)("span",{className:"text-ink",children:"Compare load"}),". Each API is checked first; the results open full width, with a tab for each API."]}),(0,t.jsxs)("p",{className:"mt-2",children:[(0,t.jsx)("span",{className:"text-ink",children:"Send"})," checks this API once; ",(0,t.jsx)("span",{className:"text-ink",children:"Send all"})," checks every API and confirms they return the same structure. To compare finished runs, use ",(0,t.jsx)("span",{className:"text-ink",children:"Add to compare"})," on a report, or tick runs on"," ",(0,t.jsx)(u.default,{href:"/history",className:"text-accent hover:underline",children:"History"}),"."]})]})]})]})]})]})}],49186)}]);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,37837,e=>{"use strict";var t=e.i(14368),s=e.i(99181),r=e.i(68820),n=e.i(14865);e.s(["Popover",0,function({anchor:e,open:a,onClose:o,children:i,label:l,width:d=280,role:c="dialog"}){let p=(0,s.useRef)(null),[u,m]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{if(!a)return;let t=()=>{if(!e.current)return;let t=(0,n.pageRect)(e.current),s=(0,n.pageViewport)(),r=p.current?.offsetHeight??320,a=s.height-t.bottom-8,o=t.top-8,i=a<Math.min(r,240)&&o>a,l=Math.min(Math.max(8,t.right-d),s.width-d-8);m({top:i?Math.max(8,t.top-Math.min(r,o)-4):t.bottom+4,left:l,maxHeight:Math.max(160,(i?o:a)-4)})};t();let s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t)}},[a,e,d]),(0,s.useEffect)(()=>{if(!a)return;let t=t=>{let s=t.target;p.current?.contains(s)||e.current?.contains(s)||o()},s=t=>{"Escape"===t.key&&(t.stopPropagation(),o(),e.current?.focus())},r=e=>{p.current?.contains(e.target)||o()},n=t=>{e.current?.contains(t.target)&&(t.stopPropagation(),t.preventDefault(),o())};return document.addEventListener("pointerdown",t,!0),document.addEventListener("click",n,!0),document.addEventListener("keydown",s,!0),document.addEventListener("scroll",r,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("click",n,!0),document.removeEventListener("keydown",s,!0),document.removeEventListener("scroll",r,!0)}},[a,o,e]),(0,s.useEffect)(()=>{a&&window.setTimeout(()=>p.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,r.createPortal)((0,t.jsx)("div",{ref:p,role:c,"aria-label":l,style:{top:u?.top??-9999,left:u?.left??-9999,width:d,maxHeight:u?.maxHeight},className:"anim-pop fixed z-[70] overflow-auto rounded-lg border border-line bg-panel p-3 shadow-2xl",children:i}),document.body)}])},30617,e=>{"use strict";e.i(24856);var t=e.i(46306),s=e.i(36558),r=e.i(2385),n=e.i(17219);let a={base:0,header:1,desc:2,pass:3,warn:4,fail:5};function o(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("\n"," ")}function i(e,t,s){if("level"===e)return"pass"===t?a.pass:"warn"===t?a.warn:"fail"===t?a.fail:a.base;let r="number"==typeof t?t:Number(t);return"errors"===e?r>=s.errorFail?a.fail:r>=s.errorWarn?a.warn:a.pass:r>=s.p95FailMs?a.fail:r>=s.p95WarnMs?a.warn:a.pass}let l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
3
|
+
<fonts count="3">
|
|
4
|
+
<font><sz val="11"/><name val="Calibri"/></font>
|
|
5
|
+
<font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Calibri"/></font>
|
|
6
|
+
<font><sz val="10"/><color rgb="FF5C6778"/><name val="Calibri"/></font>
|
|
7
|
+
</fonts>
|
|
8
|
+
<fills count="6">
|
|
9
|
+
<fill><patternFill patternType="none"/></fill>
|
|
10
|
+
<fill><patternFill patternType="gray125"/></fill>
|
|
11
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FF0B8F7C"/></patternFill></fill>
|
|
12
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FFDCFCE7"/></patternFill></fill>
|
|
13
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FFFEF3C7"/></patternFill></fill>
|
|
14
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FFFECACA"/></patternFill></fill>
|
|
15
|
+
</fills>
|
|
16
|
+
<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
|
|
17
|
+
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
|
|
18
|
+
<cellXfs count="6">
|
|
19
|
+
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
|
|
20
|
+
<xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="center" vertical="center"/></xf>
|
|
21
|
+
<xf numFmtId="0" fontId="2" fillId="0" borderId="0" xfId="0" applyFont="1" applyAlignment="1"><alignment wrapText="1" vertical="center"/></xf>
|
|
22
|
+
<xf numFmtId="0" fontId="0" fillId="3" borderId="0" xfId="0" applyFill="1"/>
|
|
23
|
+
<xf numFmtId="0" fontId="0" fillId="4" borderId="0" xfId="0" applyFill="1"/>
|
|
24
|
+
<xf numFmtId="0" fontId="0" fillId="5" borderId="0" xfId="0" applyFill="1"/>
|
|
25
|
+
</cellXfs>
|
|
26
|
+
</styleSheet>`;async function d(e,n,o){let l=(0,r.buildVerdict)(e,{slo:n}),d=(0,r.verdictBars)(n),p=(0,t.normalizeChartLayout)(o,(0,t.hasThresholdTiles)(e));return c([{name:"Overview",rows:[[{v:"Key",s:a.header},{v:"Value",s:a.header},{v:"What this means",s:a.header}],...(0,s.summaryExportRows)(e).map(e=>{let t=a.base;return"failed_rate"===e.key&&(t=i("errors",e.value,d)),"latency_p95_ms"===e.key&&(t=i("latency",e.value,d)),(e.key.startsWith("status_5")||"status_0"===e.key)&&(t=Number(e.value)>0?a.fail:a.pass),e.key.startsWith("status_4")&&Number(e.value)>0&&(t=a.warn),e.key.startsWith("threshold:")&&(t="pass"===e.value?a.pass:a.fail),[{v:e.key},{v:e.value,s:t},{v:e.description,s:a.desc}]})]},{name:"Result summary",rows:[[{v:"Field",s:a.header},{v:"Level",s:a.header},{v:"What this means",s:a.header}],[{v:"overall"},{v:l.overall,s:i("level",l.overall,d)},{v:l.headline,s:a.desc}],...l.aspects.map(e=>[{v:e.title},{v:e.level,s:i("level",e.level,d)},{v:e.summary,s:a.desc}]),[{v:"disclaimer"},{v:""},{v:l.disclaimer,s:a.desc}],...p.map((e,s)=>[{v:`chart_${s+1}`},{v:`${e.w}x${e.h}`},{v:t.CHART_TILE_TITLES[e.id],s:a.desc}])]},{name:"Second by second",rows:[s.SERIES_COLUMNS.map(e=>({v:e.header,s:a.header})),...e.buckets.map(e=>(0,s.seriesExportRow)(e).map((e,t)=>{let r=s.SERIES_COLUMNS[t]?.key,n=a.base;return"p95_ms"===r&&(n=i("latency",e,d)),"failed_rate"===r&&(n=i("errors",e,d)),"http_5xx"===r&&Number(e)>0&&(n=a.fail),"http_0"===r&&Number(e)>0&&(n=a.fail),"http_4xx"===r&&Number(e)>0&&(n=a.warn),"http_2xx"===r&&Number(e)>0&&(n=a.pass),{v:e,s:n}}))]}])}function c(e){let t={"[Content_Types].xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
27
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
28
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
29
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
30
|
+
<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
|
|
31
|
+
<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
|
|
32
|
+
${e.map((e,t)=>` <Override PartName="/xl/worksheets/sheet${t+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("\n")}
|
|
33
|
+
</Types>`,"_rels/.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
34
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
35
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
|
|
36
|
+
</Relationships>`,"xl/workbook.xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
37
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
38
|
+
<sheets>
|
|
39
|
+
${e.map((e,t)=>` <sheet name="${o(e.name.replace(/[:\\/?*[\]]/g," ").trim().slice(0,31)||"Sheet")}" sheetId="${t+1}" r:id="rId${t+1}"/>`).join("\n")}
|
|
40
|
+
</sheets>
|
|
41
|
+
</workbook>`,"xl/_rels/workbook.xml.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
42
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
43
|
+
${e.map((e,t)=>` <Relationship Id="rId${t+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${t+1}.xml"/>`).join("\n")}
|
|
44
|
+
<Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
45
|
+
</Relationships>`,"xl/styles.xml":l};return e.forEach((e,s)=>{var r;let n,a,i;return t[`xl/worksheets/sheet${s+1}.xml`]=(r=e.rows,a=Array.from({length:n=r[0]?.length??0},(e,t)=>{let s=function(e,t,s=10,r=48){let n=s;for(let s of e){let e=s[t]?.v;void 0!==e&&(n=Math.max(n,String(e).length+2))}return Math.min(r,n)}(r,t,t===n-1&&n>=3?36:12,t===n-1&&n>=3?72:42);return`<col min="${t+1}" max="${t+1}" width="${s}" customWidth="1"/>`}).join(""),i=r.map((e,t)=>`<row r="${t+1}" ht="${0===t?22:18}" customHeight="1">${e.map((e,s)=>{var r;let n,a;return r=t+1,n=`${function(e){let t=e+1,s="";for(;t>0;)s=String.fromCharCode(65+(t-1)%26)+s,t=Math.floor((t-1)/26);return s}(s)}${r}`,a=void 0!==e.s?` s="${e.s}"`:"","number"==typeof e.v&&Number.isFinite(e.v)?`<c r="${n}"${a}><v>${e.v}</v></c>`:`<c r="${n}"${a} t="inlineStr"><is><t xml:space="preserve">${o(e.v)}</t></is></c>`}).join("")}</row>`).join(""),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
46
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
47
|
+
<sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>
|
|
48
|
+
<cols>${a}</cols>
|
|
49
|
+
<sheetData>${i}</sheetData>
|
|
50
|
+
</worksheet>`)}),new Blob([(0,n.zipStore)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"exportRunXlsx",0,d,"xlsxBook",0,c])},61230,17847,e=>{"use strict";e.s(["readableUrl",0,function(e){try{return decodeURI(e.replace(/\+/g,"%20")).replace(/%2C/gi,",").replace(/%24/g,"$").replace(/%27/g,"'").replace(/%3A/gi,":").replace(/%2F/gi,"/").replace(/%3D/gi,"=")}catch{return e}}],61230);var t=e.i(14368),s=e.i(99181),r=e.i(68820),n=e.i(14865);e.s(["ContextMenu",0,function({at:e,label:a,onClose:o,children:i}){let l=(0,s.useRef)(null),[d,c]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{let t=l.current;if(!t)return;let s=(0,n.pageViewport)();c({left:Math.max(8,Math.min(e.x,s.width-t.offsetWidth-8)),top:Math.max(8,Math.min(e.y,s.height-t.offsetHeight-8))}),t.querySelector('[role="menuitem"]:not(:disabled)')?.focus()},[e]),(0,s.useEffect)(()=>{let e=e=>{l.current?.contains(e.target)||o()},t=e=>{if("Escape"===e.key)e.stopPropagation(),o();else if("ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();let t=[...l.current?.querySelectorAll('[role="menuitem"]:not(:disabled)')??[]],s=t.indexOf(document.activeElement);t[(s+("ArrowDown"===e.key?1:-1)+t.length)%t.length]?.focus()}};return document.addEventListener("pointerdown",e,!0),document.addEventListener("scroll",e,!0),window.addEventListener("resize",o),window.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",o),window.removeEventListener("keydown",t,!0)}},[o]),"u"<typeof document)?null:(0,r.createPortal)((0,t.jsx)("div",{ref:l,role:"menu","aria-label":a,style:{left:d?.left??-9999,top:d?.top??-9999},className:"fixed z-[80] w-56 rounded-lg border border-line bg-panel p-1 shadow-2xl",children:i}),document.body)},"MenuItem",0,function({icon:e,label:s,hint:r,onSelect:n,danger:a=!1,disabled:o=!1}){return(0,t.jsxs)("button",{type:"button",role:"menuitem",disabled:o,onClick:n,className:`flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm disabled:opacity-40 ${a?"text-bad hover:bg-bad/10":"text-ink hover:bg-panel-2"}`,children:[(0,t.jsx)("span",{className:`flex w-4 shrink-0 justify-center ${a?"":"text-mute"}`,"aria-hidden":!0,children:e?(0,t.jsx)(e,{size:14}):null}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),r?(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-mute",children:r}):null]})},"MenuLabel",0,function({children:e}){return(0,t.jsx)("div",{className:"px-2.5 pt-1.5 pb-1 text-[11px] font-medium tracking-wide text-mute uppercase",children:e})},"MenuSeparator",0,function(){return(0,t.jsx)("div",{role:"separator",className:"my-1 h-px bg-line"})}],17847)},17219,e=>{"use strict";let t=new Uint32Array(256).map((e,t)=>{let s=t;for(let e=0;e<8;e++)s=1&s?0xedb88320^s>>>1:s>>>1;return s>>>0});function s(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function r(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function n(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),s=0;for(let r of e)t.set(r,s),s+=r.length;return t}e.s(["zipStore",0,function(e){let a=new TextEncoder,o=[],i=[],l=0;for(let[d,c]of Object.entries(e)){let e=a.encode(d),p="string"==typeof c?a.encode(c):c,u=function(e){let s=0xffffffff;for(let r of e)s=t[(s^r)&255]^s>>>8;return(0xffffffff^s)>>>0}(p),m=n([r(0x4034b50),s(20),s(0),s(0),s(0),s(0),r(u),r(p.length),r(p.length),s(e.length),s(0),e,p]),h=n([r(0x2014b50),s(20),s(20),s(0),s(0),s(0),s(0),r(u),r(p.length),r(p.length),s(e.length),s(0),s(0),s(0),s(0),r(0),r(l),e]);o.push(m),i.push(h),l+=m.length}let d=n(i),c=n([r(0x6054b50),s(0),s(0),s(Object.keys(e).length),s(Object.keys(e).length),r(d.length),r(l),s(0)]),p=n([...o,d,c]);return new Blob([p.buffer.slice(p.byteOffset,p.byteOffset+p.byteLength)],{type:"application/zip"})}])},95211,e=>{"use strict";let t=(0,e.i(99522).default)("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);e.s(["Columns3",0,t],95211)},81538,e=>{"use strict";let t=(0,e.i(99522).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["MoreHorizontal",0,t],81538)},13163,e=>{"use strict";let t=(0,e.i(99522).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],13163)},3792,e=>{"use strict";let t=(0,e.i(99522).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,t],3792)},95927,28950,e=>{"use strict";let t=(0,e.i(99522).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],95927);var s=e.i(99181);let r=new Map;e.s(["recall",0,function(e){return r.get(e)},"remember",0,function(e,t){r.set(e,t)},"useRemembered",0,function(e,t){let[n,a]=(0,s.useState)(()=>r.has(e)?r.get(e):"function"==typeof t?t():t);return(0,s.useEffect)(()=>{r.set(e,n)},[e,n]),[n,a]}],28950)},36558,e=>{"use strict";function t(e,s=2){if(!Number.isFinite(e))return 0;let r=10**s;return Math.round(e*r)/r}function s(e){return e>=100?Math.round(e):e>=10?t(e,1):t(e,2)}function r(e){return e>=10?Math.round(e):t(e,1)}function n(e,t=e=>e){return null==e?"":t(e)}e.s(["SERIES_COLUMNS",0,[{key:"elapsed_s",header:"Seconds into test",description:"Seconds from the start of the run."},{key:"ts",header:"Clock time",description:"Wall-clock time for this one-second sample."},{key:"vus",header:"Concurrent users",description:"Virtual users (VUs) active in this second."},{key:"rps",header:"Requests per second",description:"Completed requests in this second."},{key:"p50_ms",header:"Median latency (ms)",description:"Half of requests this second were faster than this."},{key:"p95_ms",header:"95th percentile (ms)",description:"95% of requests this second were faster than this."},{key:"p99_ms",header:"99th percentile (ms)",description:"The slow tail this second — 1 in 100 was slower."},{key:"failed_rate",header:"Error rate",description:"Share of requests that failed in this second (0–1)."},{key:"http_2xx",header:"Success (2xx)",description:"Successful HTTP responses this second."},{key:"http_4xx",header:"Client errors (4xx)",description:"Client / auth errors this second."},{key:"http_5xx",header:"Server errors (5xx)",description:"Server errors this second."},{key:"http_0",header:"Network failures",description:"No HTTP status (timeout / reset) this second."},{key:"bytes_in",header:"Bytes received",description:"Response bytes this second."},{key:"bytes_out",header:"Bytes sent",description:"Request bytes this second."},{key:"p90_ms",header:"90th percentile (ms)",description:"90% of requests this second were faster than this."},{key:"p999_ms",header:"99.9th percentile (ms)",description:"1 in 1,000 requests this second was slower than this."},{key:"max_ms",header:"Slowest (ms)",description:"Slowest request this second."},{key:"ttfb_ms",header:"Server time (ms)",description:"Average time to first byte this second — the server's own work."},{key:"connect_ms",header:"TCP connect (ms)",description:"Average TCP connect time this second (0 when connections are reused)."},{key:"tls_ms",header:"TLS handshake (ms)",description:"Average TLS handshake time this second."},{key:"checks_passed",header:"Checks passed",description:"Response checks that passed this second."},{key:"checks_failed",header:"Checks failed",description:"Response checks that failed this second."},{key:"dropped",header:"Dropped requests",description:"Rate mode: requests k6 could not start this second."}],"seriesExportRow",0,function(e){return[e.elapsedS,e.ts,t(e.vus,1),s(e.rps),r(e.p50Ms),r(e.p95Ms),r(e.p99Ms),t(e.failedRate,4),e.http2xx,e.http4xx,e.http5xx,e.http0,e.bytesIn,e.bytesOut,n(e.p90Ms,r),n(e.p999Ms,r),n(e.maxMs,r),n(e.ttfbMs,r),n(e.connectMs,r),n(e.tlsMs,r),n(e.checksPassed),n(e.checksFailed),n(e.dropped)]},"summaryExportRows",0,function(e){let{summary:n}=e,a=[{key:"run_id",value:e.id,description:"Id of this run in this browser tab."},{key:"test_name",value:e.testName,description:"Display name (method, path, time)."},{key:"status",value:e.status,description:"completed, failed, cancelled, or still running."},{key:"started_at",value:e.startedAt,description:"When the load test started (UTC)."},{key:"ended_at",value:e.endedAt,description:"When the load test finished (UTC)."},{key:"method",value:e.definition.method,description:"HTTP method that was repeated."},{key:"url",value:e.definition.url,description:"Target URL (secrets are not exported)."},{key:"auth_mode",value:e.definition.auth.mode,description:"Auth used: none, bearer, basic, or api_key. The secret is not exported."},{key:"executor",value:e.definition.load.executor,description:"Load pattern: constant-vus (steady) or ramping-vus (ramp / hold / down)."},{key:"requests",value:n.http.requests,description:"How many HTTP calls finished. Zero usually means the target never answered."},{key:"rps_avg",value:s(n.http.rps.avg),description:"Average requests per second completed by this generator."},{key:"rps_max",value:s(n.http.rps.max),description:"Peak requests per second in any one-second sample."},{key:"failed_count",value:n.http.failed.count,description:"Requests that failed (4xx, 5xx, timeout, or no status)."},{key:"failed_rate",value:t(n.http.failed.rate,4),description:"Failed / total. Default warning bar is 1% (0.01)."},{key:"latency_min_ms",value:r(n.latencyMs.min),description:"Fastest request (milliseconds)."},{key:"latency_mean_ms",value:r(n.latencyMs.mean),description:"Average response time. Slow outliers pull this up."},{key:"latency_p50_ms",value:r(n.latencyMs.median),description:"Median — half of requests were faster than this."},{key:"latency_p95_ms",value:r(n.latencyMs.p95),description:"95th percentile — 95% of requests were faster. Usual headline latency."},{key:"latency_p99_ms",value:r(n.latencyMs.p99),description:"99th percentile — the slow tail (1 in 100 was slower)."},{key:"latency_max_ms",value:r(n.latencyMs.max),description:"Slowest single request."},{key:"vus_max",value:n.vus.max,description:"Peak concurrent users (virtual users / VUs)."},{key:"vus_avg",value:t(n.vus.avg,1),description:"Average concurrent users over the run."},{key:"bytes_in",value:n.data.bytesIn,description:"Response bytes received by the generator."},{key:"bytes_out",value:n.data.bytesOut,description:"Request bytes sent by the generator."},{key:"phase_ttfb_avg_ms",value:r(n.phasesMs.ttfb.avg),description:"Time to first byte — waiting on the server after the connection is up."},{key:"phase_tls_avg_ms",value:r(n.phasesMs.tls.avg),description:"TLS handshake time. High values often mean a far or overloaded endpoint."}];for(let[e,t]of Object.entries(n.http.status)){let s="0"===e?"No HTTP status (timeout / network).":Number(e)>=500?"Server error.":Number(e)>=400?"Client / auth error.":"Success-class response.";a.push({key:`status_${e}`,value:t,description:`How many responses had status ${e}. ${s}`})}for(let e of n.thresholds)a.push({key:`threshold:${e.name}`,value:e.ok?"pass":"fail",description:"k6 threshold result for this run."});return a}])}]);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,92016,e=>{"use strict";var t=e.i(14368);e.i(24856);var s=e.i(2385),n=e.i(42447),r=e.i(67938),a=e.i(84355),i=e.i(20621),l=e.i(99522);let o=(0,l.default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);var c=e.i(30197),d=e.i(27813),p=e.i(81538),u=e.i(13163),m=e.i(71189),h=e.i(96659);let f=(0,l.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var x=e.i(30099),y=e.i(36994),v=e.i(99181),b=e.i(6980),g=e.i(839),k=e.i(39170),w=e.i(37837),j=e.i(17847),N=e.i(56396),F=e.i(67217),C=e.i(44505),_=e.i(20054),T=e.i(19656),I=e.i(59180),S=e.i(30635),M=e.i(88153);function $({project:e,onOpen:s,onRename:n,onRemove:r,onDelete:a}){let[i,l]=(0,v.useState)(!1),[d,m]=(0,v.useState)(!1),f=(0,v.useRef)(null);return(0,t.jsxs)("div",{className:`group relative flex h-full flex-col gap-3 rounded-xl border p-4 ${e.current?"border-accent/60 bg-accent-dim/40":"border-line bg-panel hover:border-mute"}`,children:[(0,t.jsxs)("button",{type:"button",onClick:s,className:"flex flex-col gap-3 text-left","aria-label":e.current?`Go to ${e.name} (in use)`:`Open ${e.name}`,children:[(0,t.jsxs)("span",{className:"flex items-center gap-3 pr-8",children:[(0,t.jsx)("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-sm font-bold text-[#10140a]",style:{background:(0,S.projectTile)(e.id)},"aria-hidden":!0,children:e.name.slice(0,1).toUpperCase()}),(0,t.jsxs)("span",{className:"min-w-0",children:[d?null:(0,t.jsx)("span",{className:"block truncate text-[15px] font-semibold text-ink",children:e.name}),(0,t.jsx)("span",{className:"block truncate font-mono text-[11px] text-mute",title:e.path,children:e.path})]})]}),(0,t.jsx)("span",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-mute",children:e.exists?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{children:[e.requests," request",1===e.requests?"":"s"]}),(0,t.jsxs)("span",{children:[e.environments," environment",1===e.environments?"":"s"]})]}):(0,t.jsx)("span",{className:"text-bad",children:"Folder not found"})}),(0,t.jsxs)("span",{className:"flex items-center gap-2 border-t border-line pt-3 text-xs",children:[e.current?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium text-accent",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-hidden":!0})," In use"]}):(0,t.jsx)("span",{className:"text-mute",children:function(e){if(!e)return"Not opened yet";let t=Math.round((Date.now()-Date.parse(e))/6e4);if(t<60)return t<2?"Opened just now":`Opened ${t} minutes ago`;let s=Math.round(t/60);if(s<24)return`Opened ${s} hour${1===s?"":"s"} ago`;let n=Math.round(s/24);return 1===n?"Opened yesterday":`Opened ${n} days ago`}(e.lastOpenedAt)}),e.git?(0,t.jsxs)("span",{className:"ml-auto inline-flex items-center gap-1 font-mono text-[11px] text-mute",children:[(0,t.jsx)(o,{size:11,"aria-hidden":!0})," ",e.git]}):null]})]}),d?(0,t.jsx)("input",{autoFocus:!0,defaultValue:e.name,"aria-label":`New name for ${e.name}`,className:"input absolute top-4 right-10 left-16 py-1 text-sm",onKeyDown:e=>{"Enter"===e.key&&(n?.(e.target.value),m(!1)),"Escape"===e.key&&m(!1)},onBlur:e=>{n?.(e.target.value),m(!1)}}):null,n||r||a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{ref:f,type:"button","aria-label":`Actions for ${e.name}`,"aria-haspopup":"menu","aria-expanded":i,onClick:()=>l(e=>!e),className:"absolute top-3 right-3 rounded p-1 text-mute opacity-0 group-hover:opacity-100 hover:text-ink focus:opacity-100",children:(0,t.jsx)(p.MoreHorizontal,{size:15})}),(0,t.jsx)(w.Popover,{anchor:f,open:i,onClose:()=>l(!1),label:`Actions for ${e.name}`,width:200,role:"menu",children:(0,t.jsxs)("div",{className:"-m-2",children:[n?(0,t.jsx)(j.MenuItem,{icon:u.Pencil,label:"Rename",onSelect:()=>(l(!1),m(!0))}):null,r?(0,t.jsx)(j.MenuItem,{icon:c.ListX,label:"Take off the list",onSelect:()=>(l(!1),r())}):null,a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.MenuSeparator,{}),(0,t.jsx)(j.MenuItem,{icon:h.Trash2,label:"Delete project…",danger:!0,onSelect:()=>(l(!1),a())})]}):null]})})]}):null]})}function E({href:e,onClick:s,icon:n,title:r,body:a}){let i=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-accent",children:n}),(0,t.jsx)("span",{className:"text-sm font-semibold text-ink",children:r}),(0,t.jsx)("span",{className:"text-xs text-mute",children:a})]}),l="flex h-full flex-col gap-1.5 rounded-xl border border-line bg-panel p-4 text-left hover:border-mute";return e?(0,t.jsx)(x.default,{href:e,className:l,children:i}):(0,t.jsx)("button",{type:"button",onClick:s,className:l,children:i})}e.s(["HomePage",0,function(){let e=(0,N.useToast)(),l=(0,k.useConfirm)(),{slo:o}=(0,M.useSlo)(),{dataDir:c}=(0,_.useEngineHealth)(),{projects:p,refresh:u,supported:h}=(0,S.useProjects)(),{index:w}=(0,I.useHistory)(),[j,A]=(0,v.useState)(!1),[R,P]=(0,v.useState)(""),[q,L]=(0,v.useState)(null),[O,z]=(0,v.useState)(null),D=(0,C.desktop)()?.projects,U=(0,y.useRouter)();async function H(t){return t.current?U.push("/"):D?t.exists?void(z(t.name),!await D.open(t.id).catch(()=>!1)&&(z(null),e(`Could not open “${t.name}”`,"error"))):e(`The folder for “${t.name}” isn't there any more: ${t.path}`,"error"):void 0}async function V(){if(!D||!R.trim())return;let t=await D.add({name:R.trim(),folder:q??void 0}).catch(()=>null);if(!t)return e("Could not make the project","error");A(!1),P(""),L(null),await u();let s=(await D.list()).find(e=>e.id===t.id);s&&await H(s)}async function B(){if(!D)return;let e=await D.chooseFolder("open");if(!e)return;let t=await D.add({folder:e});await u();let s=t?(await D.list()).find(e=>e.id===t.id):void 0;s&&await H(s)}async function W(e){!D||await l({title:`Take “${e.name}” off the list?`,body:`Its folder and files stay where they are (${e.path}). Open the folder again to bring it back.`,confirmLabel:"Take off the list"})&&(await D.remove(e.id),await u())}async function X(s){if(!D||!await l({title:`Delete the project “${s.name}”?`,body:(0,t.jsxs)(t.Fragment,{children:["Its requests, environments, history, versions and Trash go to the Recycle Bin, so you can still get them back from there. Anything else in"," ",(0,t.jsx)("span",{className:"font-mono text-ink",children:s.path})," is left alone.",s.current?" The app switches to My workspace first.":""]}),confirmLabel:"Delete project",tone:"danger"}))return;s.current&&z("My workspace");let n=await D.delete(s.id).catch(()=>({ok:!1,keptOthers:!1}));if(!n.ok)return z(null),e(`Could not delete “${s.name}”`,"error");e(n.keptOthers?`Deleted “${s.name}” — the folder's other files were kept`:`Deleted “${s.name}” — it's in the Recycle Bin`,"success"),await u()}async function K(e,t){D&&t.trim()&&t.trim()!==e.name&&(await D.rename(e.id,t.trim()),await u())}let G=(w?.runs??[]).slice().sort((e,t)=>t.startedAt.localeCompare(e.startedAt)).slice(0,6);return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[O?(0,t.jsx)("div",{role:"status",className:"fixed inset-0 z-[80] grid place-items-center bg-canvas/80 backdrop-blur-sm",children:(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-ink",children:[(0,t.jsx)(d.Loader2,{size:16,className:"animate-spin"})," Opening ",O,"…"]})}):null,(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-7xl flex-wrap gap-8 px-6 py-8 lg:px-10",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-[999_1_40rem] flex-col gap-8",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,t.jsxs)("div",{className:"min-w-60 flex-1",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight text-ink",children:"Projects"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-mute",children:"Each project is a folder on this computer — its requests, environments and history, as plain files you can keep in Git."})]}),h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>void B(),children:[(0,t.jsx)(i.FolderOpen,{size:15,"aria-hidden":!0})," Open folder…"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary",onClick:()=>A(!0),children:[(0,t.jsx)(m.Plus,{size:15,"aria-hidden":!0})," New project"]})]}):null]}),j?(0,t.jsxs)("form",{className:"flex flex-wrap items-end gap-3 rounded-xl border border-line bg-panel p-4",onSubmit:e=>{e.preventDefault(),V()},children:[(0,t.jsxs)("label",{className:"flex min-w-56 flex-1 flex-col gap-1 text-xs text-mute",children:["Name",(0,t.jsx)("input",{autoFocus:!0,value:R,onChange:e=>P(e.target.value),placeholder:"Payments API",className:"input","aria-label":"Project name"})]}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-[2] flex-col gap-1 text-xs text-mute",children:["Folder",(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate rounded-md border border-line bg-panel-2 px-2 py-1.5 font-mono text-xs text-ink",title:q??void 0,children:q??`Documents/APITestCenter Projects/${R.trim()||"…"}`}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:async()=>L(await D?.chooseFolder("new")??q),children:"Choose…"})]})]}),(0,t.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:!R.trim(),children:"Create and open"}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:()=>A(!1),children:"Cancel"})]}):null,(0,t.jsx)("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-4",children:(p??(c?[{id:"default",name:"This folder",path:c,lastOpenedAt:"",current:!0,exists:!0,requests:0,environments:0,git:null,builtIn:!0}]:[])).map(e=>(0,t.jsx)("li",{children:(0,t.jsx)($,{project:e,onOpen:()=>void H(e),onRename:e.builtIn?void 0:t=>void K(e,t),onRemove:e.builtIn||e.current?void 0:()=>void W(e),onDelete:e.builtIn||!h?void 0:()=>void X(e)})},e.id))}),h?null:(0,t.jsxs)("p",{className:"text-sm text-mute",children:["Several projects need the desktop app. On the command line, pick a folder with ",(0,t.jsx)("code",{className:"font-mono text-ink",children:"--data"}),": ",(0,t.jsx)("code",{className:"font-mono text-ink",children:"npx apitestcenter ui --data api-tests"}),"."]}),(0,t.jsxs)("section",{"aria-labelledby":"start-title",children:[(0,t.jsx)("h2",{id:"start-title",className:"mb-3 text-base font-semibold text-ink",children:"Start something"}),(0,t.jsxs)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-3",children:[(0,t.jsx)(E,{href:"/",icon:(0,t.jsx)(a.FlaskConical,{size:16,"aria-hidden":!0}),title:"Send a request",body:"Try the practice API built in"}),(0,t.jsx)(E,{onClick:()=>(0,F.openImport)(),icon:(0,t.jsx)(r.FileUp,{size:16,"aria-hidden":!0}),title:"Bring your requests",body:"Postman, Insomnia, Bruno, OpenAPI, .http, Hurl"}),(0,t.jsx)(E,{href:"/",icon:(0,t.jsx)(f,{size:16,"aria-hidden":!0}),title:"Performance test an endpoint",body:"k6 runs it here — nothing is uploaded"}),(0,t.jsx)(E,{onClick:g.openSettings,icon:(0,t.jsx)(n.Bot,{size:16,"aria-hidden":!0}),title:"Connect your AI assistant",body:"MCP for Claude, Cursor, VS Code"})]})]})]}),(0,t.jsxs)("aside",{"aria-labelledby":"recent-title",className:"flex min-w-0 flex-[1_1_18rem] flex-col gap-3",children:[(0,t.jsx)("h2",{id:"recent-title",className:"text-base font-semibold text-ink",children:"Recent performance tests"}),G.length?(0,t.jsx)("ul",{className:"overflow-hidden rounded-xl border border-line bg-panel",children:G.map((e,n)=>(0,t.jsx)("li",{className:n?"border-t border-line":"",children:(0,t.jsxs)(x.default,{href:"/history",className:"flex items-center gap-3 px-4 py-3 hover:bg-panel-2",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate text-sm text-ink",children:e.name}),(0,t.jsxs)("span",{className:"block truncate font-mono text-xs text-mute",children:["p95 ",(0,T.formatMs)(e.p95)," · ",new Date(e.startedAt).toLocaleDateString(void 0,{day:"numeric",month:"short"})]})]}),(0,t.jsx)(b.VerdictTag,{level:(0,s.buildVerdictFromInputs)(e.verdict,{slo:o}).overall})]})},e.id))}):(0,t.jsx)("p",{className:"rounded-xl border border-dashed border-line px-4 py-6 text-sm text-mute",children:"Performance tests in this project will show here."})]})]})]})}],92016)},37837,e=>{"use strict";var t=e.i(14368),s=e.i(99181),n=e.i(68820),r=e.i(14865);e.s(["Popover",0,function({anchor:e,open:a,onClose:i,children:l,label:o,width:c=280,role:d="dialog"}){let p=(0,s.useRef)(null),[u,m]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{if(!a)return;let t=()=>{if(!e.current)return;let t=(0,r.pageRect)(e.current),s=(0,r.pageViewport)(),n=p.current?.offsetHeight??320,a=s.height-t.bottom-8,i=t.top-8,l=a<Math.min(n,240)&&i>a,o=Math.min(Math.max(8,t.right-c),s.width-c-8);m({top:l?Math.max(8,t.top-Math.min(n,i)-4):t.bottom+4,left:o,maxHeight:Math.max(160,(l?i:a)-4)})};t();let s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t)}},[a,e,c]),(0,s.useEffect)(()=>{if(!a)return;let t=t=>{let s=t.target;p.current?.contains(s)||e.current?.contains(s)||i()},s=t=>{"Escape"===t.key&&(t.stopPropagation(),i(),e.current?.focus())},n=e=>{p.current?.contains(e.target)||i()},r=t=>{e.current?.contains(t.target)&&(t.stopPropagation(),t.preventDefault(),i())};return document.addEventListener("pointerdown",t,!0),document.addEventListener("click",r,!0),document.addEventListener("keydown",s,!0),document.addEventListener("scroll",n,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("click",r,!0),document.removeEventListener("keydown",s,!0),document.removeEventListener("scroll",n,!0)}},[a,i,e]),(0,s.useEffect)(()=>{a&&window.setTimeout(()=>p.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,n.createPortal)((0,t.jsx)("div",{ref:p,role:d,"aria-label":o,style:{top:u?.top??-9999,left:u?.left??-9999,width:c,maxHeight:u?.maxHeight},className:"anim-pop fixed z-[70] overflow-auto rounded-lg border border-line bg-panel p-3 shadow-2xl",children:l}),document.body)}])},30617,e=>{"use strict";e.i(24856);var t=e.i(46306),s=e.i(36558),n=e.i(2385),r=e.i(17219);let a={base:0,header:1,desc:2,pass:3,warn:4,fail:5};function i(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("\n"," ")}function l(e,t,s){if("level"===e)return"pass"===t?a.pass:"warn"===t?a.warn:"fail"===t?a.fail:a.base;let n="number"==typeof t?t:Number(t);return"errors"===e?n>=s.errorFail?a.fail:n>=s.errorWarn?a.warn:a.pass:n>=s.p95FailMs?a.fail:n>=s.p95WarnMs?a.warn:a.pass}let o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
3
|
+
<fonts count="3">
|
|
4
|
+
<font><sz val="11"/><name val="Calibri"/></font>
|
|
5
|
+
<font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Calibri"/></font>
|
|
6
|
+
<font><sz val="10"/><color rgb="FF5C6778"/><name val="Calibri"/></font>
|
|
7
|
+
</fonts>
|
|
8
|
+
<fills count="6">
|
|
9
|
+
<fill><patternFill patternType="none"/></fill>
|
|
10
|
+
<fill><patternFill patternType="gray125"/></fill>
|
|
11
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FF0B8F7C"/></patternFill></fill>
|
|
12
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FFDCFCE7"/></patternFill></fill>
|
|
13
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FFFEF3C7"/></patternFill></fill>
|
|
14
|
+
<fill><patternFill patternType="solid"><fgColor rgb="FFFECACA"/></patternFill></fill>
|
|
15
|
+
</fills>
|
|
16
|
+
<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
|
|
17
|
+
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
|
|
18
|
+
<cellXfs count="6">
|
|
19
|
+
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
|
|
20
|
+
<xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="center" vertical="center"/></xf>
|
|
21
|
+
<xf numFmtId="0" fontId="2" fillId="0" borderId="0" xfId="0" applyFont="1" applyAlignment="1"><alignment wrapText="1" vertical="center"/></xf>
|
|
22
|
+
<xf numFmtId="0" fontId="0" fillId="3" borderId="0" xfId="0" applyFill="1"/>
|
|
23
|
+
<xf numFmtId="0" fontId="0" fillId="4" borderId="0" xfId="0" applyFill="1"/>
|
|
24
|
+
<xf numFmtId="0" fontId="0" fillId="5" borderId="0" xfId="0" applyFill="1"/>
|
|
25
|
+
</cellXfs>
|
|
26
|
+
</styleSheet>`;async function c(e,r,i){let o=(0,n.buildVerdict)(e,{slo:r}),c=(0,n.verdictBars)(r),p=(0,t.normalizeChartLayout)(i,(0,t.hasThresholdTiles)(e));return d([{name:"Overview",rows:[[{v:"Key",s:a.header},{v:"Value",s:a.header},{v:"What this means",s:a.header}],...(0,s.summaryExportRows)(e).map(e=>{let t=a.base;return"failed_rate"===e.key&&(t=l("errors",e.value,c)),"latency_p95_ms"===e.key&&(t=l("latency",e.value,c)),(e.key.startsWith("status_5")||"status_0"===e.key)&&(t=Number(e.value)>0?a.fail:a.pass),e.key.startsWith("status_4")&&Number(e.value)>0&&(t=a.warn),e.key.startsWith("threshold:")&&(t="pass"===e.value?a.pass:a.fail),[{v:e.key},{v:e.value,s:t},{v:e.description,s:a.desc}]})]},{name:"Result summary",rows:[[{v:"Field",s:a.header},{v:"Level",s:a.header},{v:"What this means",s:a.header}],[{v:"overall"},{v:o.overall,s:l("level",o.overall,c)},{v:o.headline,s:a.desc}],...o.aspects.map(e=>[{v:e.title},{v:e.level,s:l("level",e.level,c)},{v:e.summary,s:a.desc}]),[{v:"disclaimer"},{v:""},{v:o.disclaimer,s:a.desc}],...p.map((e,s)=>[{v:`chart_${s+1}`},{v:`${e.w}x${e.h}`},{v:t.CHART_TILE_TITLES[e.id],s:a.desc}])]},{name:"Second by second",rows:[s.SERIES_COLUMNS.map(e=>({v:e.header,s:a.header})),...e.buckets.map(e=>(0,s.seriesExportRow)(e).map((e,t)=>{let n=s.SERIES_COLUMNS[t]?.key,r=a.base;return"p95_ms"===n&&(r=l("latency",e,c)),"failed_rate"===n&&(r=l("errors",e,c)),"http_5xx"===n&&Number(e)>0&&(r=a.fail),"http_0"===n&&Number(e)>0&&(r=a.fail),"http_4xx"===n&&Number(e)>0&&(r=a.warn),"http_2xx"===n&&Number(e)>0&&(r=a.pass),{v:e,s:r}}))]}])}function d(e){let t={"[Content_Types].xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
27
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
28
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
29
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
30
|
+
<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
|
|
31
|
+
<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
|
|
32
|
+
${e.map((e,t)=>` <Override PartName="/xl/worksheets/sheet${t+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("\n")}
|
|
33
|
+
</Types>`,"_rels/.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
34
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
35
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
|
|
36
|
+
</Relationships>`,"xl/workbook.xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
37
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
38
|
+
<sheets>
|
|
39
|
+
${e.map((e,t)=>` <sheet name="${i(e.name.replace(/[:\\/?*[\]]/g," ").trim().slice(0,31)||"Sheet")}" sheetId="${t+1}" r:id="rId${t+1}"/>`).join("\n")}
|
|
40
|
+
</sheets>
|
|
41
|
+
</workbook>`,"xl/_rels/workbook.xml.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
42
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
43
|
+
${e.map((e,t)=>` <Relationship Id="rId${t+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${t+1}.xml"/>`).join("\n")}
|
|
44
|
+
<Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
45
|
+
</Relationships>`,"xl/styles.xml":o};return e.forEach((e,s)=>{var n;let r,a,l;return t[`xl/worksheets/sheet${s+1}.xml`]=(n=e.rows,a=Array.from({length:r=n[0]?.length??0},(e,t)=>{let s=function(e,t,s=10,n=48){let r=s;for(let s of e){let e=s[t]?.v;void 0!==e&&(r=Math.max(r,String(e).length+2))}return Math.min(n,r)}(n,t,t===r-1&&r>=3?36:12,t===r-1&&r>=3?72:42);return`<col min="${t+1}" max="${t+1}" width="${s}" customWidth="1"/>`}).join(""),l=n.map((e,t)=>`<row r="${t+1}" ht="${0===t?22:18}" customHeight="1">${e.map((e,s)=>{var n;let r,a;return n=t+1,r=`${function(e){let t=e+1,s="";for(;t>0;)s=String.fromCharCode(65+(t-1)%26)+s,t=Math.floor((t-1)/26);return s}(s)}${n}`,a=void 0!==e.s?` s="${e.s}"`:"","number"==typeof e.v&&Number.isFinite(e.v)?`<c r="${r}"${a}><v>${e.v}</v></c>`:`<c r="${r}"${a} t="inlineStr"><is><t xml:space="preserve">${i(e.v)}</t></is></c>`}).join("")}</row>`).join(""),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
46
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
47
|
+
<sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>
|
|
48
|
+
<cols>${a}</cols>
|
|
49
|
+
<sheetData>${l}</sheetData>
|
|
50
|
+
</worksheet>`)}),new Blob([(0,r.zipStore)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"exportRunXlsx",0,c,"xlsxBook",0,d])},61230,17847,e=>{"use strict";e.s(["readableUrl",0,function(e){try{return decodeURI(e.replace(/\+/g,"%20")).replace(/%2C/gi,",").replace(/%24/g,"$").replace(/%27/g,"'").replace(/%3A/gi,":").replace(/%2F/gi,"/").replace(/%3D/gi,"=")}catch{return e}}],61230);var t=e.i(14368),s=e.i(99181),n=e.i(68820),r=e.i(14865);e.s(["ContextMenu",0,function({at:e,label:a,onClose:i,children:l}){let o=(0,s.useRef)(null),[c,d]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{let t=o.current;if(!t)return;let s=(0,r.pageViewport)();d({left:Math.max(8,Math.min(e.x,s.width-t.offsetWidth-8)),top:Math.max(8,Math.min(e.y,s.height-t.offsetHeight-8))}),t.querySelector('[role="menuitem"]:not(:disabled)')?.focus()},[e]),(0,s.useEffect)(()=>{let e=e=>{o.current?.contains(e.target)||i()},t=e=>{if("Escape"===e.key)e.stopPropagation(),i();else if("ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();let t=[...o.current?.querySelectorAll('[role="menuitem"]:not(:disabled)')??[]],s=t.indexOf(document.activeElement);t[(s+("ArrowDown"===e.key?1:-1)+t.length)%t.length]?.focus()}};return document.addEventListener("pointerdown",e,!0),document.addEventListener("scroll",e,!0),window.addEventListener("resize",i),window.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",i),window.removeEventListener("keydown",t,!0)}},[i]),"u"<typeof document)?null:(0,n.createPortal)((0,t.jsx)("div",{ref:o,role:"menu","aria-label":a,style:{left:c?.left??-9999,top:c?.top??-9999},className:"fixed z-[80] w-56 rounded-lg border border-line bg-panel p-1 shadow-2xl",children:l}),document.body)},"MenuItem",0,function({icon:e,label:s,hint:n,onSelect:r,danger:a=!1,disabled:i=!1}){return(0,t.jsxs)("button",{type:"button",role:"menuitem",disabled:i,onClick:r,className:`flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm disabled:opacity-40 ${a?"text-bad hover:bg-bad/10":"text-ink hover:bg-panel-2"}`,children:[(0,t.jsx)("span",{className:`flex w-4 shrink-0 justify-center ${a?"":"text-mute"}`,"aria-hidden":!0,children:e?(0,t.jsx)(e,{size:14}):null}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),n?(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-mute",children:n}):null]})},"MenuLabel",0,function({children:e}){return(0,t.jsx)("div",{className:"px-2.5 pt-1.5 pb-1 text-[11px] font-medium tracking-wide text-mute uppercase",children:e})},"MenuSeparator",0,function(){return(0,t.jsx)("div",{role:"separator",className:"my-1 h-px bg-line"})}],17847)},17219,e=>{"use strict";let t=new Uint32Array(256).map((e,t)=>{let s=t;for(let e=0;e<8;e++)s=1&s?0xedb88320^s>>>1:s>>>1;return s>>>0});function s(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function n(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function r(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),s=0;for(let n of e)t.set(n,s),s+=n.length;return t}e.s(["zipStore",0,function(e){let a=new TextEncoder,i=[],l=[],o=0;for(let[c,d]of Object.entries(e)){let e=a.encode(c),p="string"==typeof d?a.encode(d):d,u=function(e){let s=0xffffffff;for(let n of e)s=t[(s^n)&255]^s>>>8;return(0xffffffff^s)>>>0}(p),m=r([n(0x4034b50),s(20),s(0),s(0),s(0),s(0),n(u),n(p.length),n(p.length),s(e.length),s(0),e,p]),h=r([n(0x2014b50),s(20),s(20),s(0),s(0),s(0),s(0),n(u),n(p.length),n(p.length),s(e.length),s(0),s(0),s(0),s(0),n(0),n(o),e]);i.push(m),l.push(h),o+=m.length}let c=r(l),d=r([n(0x6054b50),s(0),s(0),s(Object.keys(e).length),s(Object.keys(e).length),n(c.length),n(o),s(0)]),p=r([...i,c,d]);return new Blob([p.buffer.slice(p.byteOffset,p.byteOffset+p.byteLength)],{type:"application/zip"})}])},13643,e=>{"use strict";let t=(0,e.i(99522).default)("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);e.s(["BellOff",0,t],13643)},95211,e=>{"use strict";let t=(0,e.i(99522).default)("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);e.s(["Columns3",0,t],95211)},81538,e=>{"use strict";let t=(0,e.i(99522).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["MoreHorizontal",0,t],81538)},13163,e=>{"use strict";let t=(0,e.i(99522).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],13163)},3792,e=>{"use strict";let t=(0,e.i(99522).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,t],3792)},95927,28950,e=>{"use strict";let t=(0,e.i(99522).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],95927);var s=e.i(99181);let n=new Map;e.s(["recall",0,function(e){return n.get(e)},"remember",0,function(e,t){n.set(e,t)},"useRemembered",0,function(e,t){let[r,a]=(0,s.useState)(()=>n.has(e)?n.get(e):"function"==typeof t?t():t);return(0,s.useEffect)(()=>{n.set(e,r)},[e,r]),[r,a]}],28950)},66478,14168,e=>{"use strict";let t=(0,e.i(99522).default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);async function s(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Engine error (${e.status})`);return t}e.s(["Square",0,t],66478);let n=(e,t,s)=>fetch(t,{method:e,headers:void 0===s?void 0:{"content-type":"application/json"},body:void 0===s?void 0:JSON.stringify(s)});e.s(["suiteApi",0,{plan:e=>fetch(`/engine/suites/plan?collection=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>s(e)),savePlan:(e,t)=>n("PUT","/engine/suites/plan",{collection:e,...t}).then(e=>s(e)),start:e=>n("POST","/engine/suites/runs",e).then(e=>s(e)),get:e=>fetch(`/engine/suites/runs/${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>s(e)),stop:e=>n("POST",`/engine/suites/runs/${encodeURIComponent(e)}/stop`).then(e=>s(e))},"suiteHref",0,function(e){return`/suite?c=${encodeURIComponent(e)}`}],14168)},36558,e=>{"use strict";function t(e,s=2){if(!Number.isFinite(e))return 0;let n=10**s;return Math.round(e*n)/n}function s(e){return e>=100?Math.round(e):e>=10?t(e,1):t(e,2)}function n(e){return e>=10?Math.round(e):t(e,1)}function r(e,t=e=>e){return null==e?"":t(e)}e.s(["SERIES_COLUMNS",0,[{key:"elapsed_s",header:"Seconds into test",description:"Seconds from the start of the run."},{key:"ts",header:"Clock time",description:"Wall-clock time for this one-second sample."},{key:"vus",header:"Concurrent users",description:"Virtual users (VUs) active in this second."},{key:"rps",header:"Requests per second",description:"Completed requests in this second."},{key:"p50_ms",header:"Median latency (ms)",description:"Half of requests this second were faster than this."},{key:"p95_ms",header:"95th percentile (ms)",description:"95% of requests this second were faster than this."},{key:"p99_ms",header:"99th percentile (ms)",description:"The slow tail this second — 1 in 100 was slower."},{key:"failed_rate",header:"Error rate",description:"Share of requests that failed in this second (0–1)."},{key:"http_2xx",header:"Success (2xx)",description:"Successful HTTP responses this second."},{key:"http_4xx",header:"Client errors (4xx)",description:"Client / auth errors this second."},{key:"http_5xx",header:"Server errors (5xx)",description:"Server errors this second."},{key:"http_0",header:"Network failures",description:"No HTTP status (timeout / reset) this second."},{key:"bytes_in",header:"Bytes received",description:"Response bytes this second."},{key:"bytes_out",header:"Bytes sent",description:"Request bytes this second."},{key:"p90_ms",header:"90th percentile (ms)",description:"90% of requests this second were faster than this."},{key:"p999_ms",header:"99.9th percentile (ms)",description:"1 in 1,000 requests this second was slower than this."},{key:"max_ms",header:"Slowest (ms)",description:"Slowest request this second."},{key:"ttfb_ms",header:"Server time (ms)",description:"Average time to first byte this second — the server's own work."},{key:"connect_ms",header:"TCP connect (ms)",description:"Average TCP connect time this second (0 when connections are reused)."},{key:"tls_ms",header:"TLS handshake (ms)",description:"Average TLS handshake time this second."},{key:"checks_passed",header:"Checks passed",description:"Response checks that passed this second."},{key:"checks_failed",header:"Checks failed",description:"Response checks that failed this second."},{key:"dropped",header:"Dropped requests",description:"Rate mode: requests k6 could not start this second."}],"seriesExportRow",0,function(e){return[e.elapsedS,e.ts,t(e.vus,1),s(e.rps),n(e.p50Ms),n(e.p95Ms),n(e.p99Ms),t(e.failedRate,4),e.http2xx,e.http4xx,e.http5xx,e.http0,e.bytesIn,e.bytesOut,r(e.p90Ms,n),r(e.p999Ms,n),r(e.maxMs,n),r(e.ttfbMs,n),r(e.connectMs,n),r(e.tlsMs,n),r(e.checksPassed),r(e.checksFailed),r(e.dropped)]},"summaryExportRows",0,function(e){let{summary:r}=e,a=[{key:"run_id",value:e.id,description:"Id of this run in this browser tab."},{key:"test_name",value:e.testName,description:"Display name (method, path, time)."},{key:"status",value:e.status,description:"completed, failed, cancelled, or still running."},{key:"started_at",value:e.startedAt,description:"When the load test started (UTC)."},{key:"ended_at",value:e.endedAt,description:"When the load test finished (UTC)."},{key:"method",value:e.definition.method,description:"HTTP method that was repeated."},{key:"url",value:e.definition.url,description:"Target URL (secrets are not exported)."},{key:"auth_mode",value:e.definition.auth.mode,description:"Auth used: none, bearer, basic, or api_key. The secret is not exported."},{key:"executor",value:e.definition.load.executor,description:"Load pattern: constant-vus (steady) or ramping-vus (ramp / hold / down)."},{key:"requests",value:r.http.requests,description:"How many HTTP calls finished. Zero usually means the target never answered."},{key:"rps_avg",value:s(r.http.rps.avg),description:"Average requests per second completed by this generator."},{key:"rps_max",value:s(r.http.rps.max),description:"Peak requests per second in any one-second sample."},{key:"failed_count",value:r.http.failed.count,description:"Requests that failed (4xx, 5xx, timeout, or no status)."},{key:"failed_rate",value:t(r.http.failed.rate,4),description:"Failed / total. Default warning bar is 1% (0.01)."},{key:"latency_min_ms",value:n(r.latencyMs.min),description:"Fastest request (milliseconds)."},{key:"latency_mean_ms",value:n(r.latencyMs.mean),description:"Average response time. Slow outliers pull this up."},{key:"latency_p50_ms",value:n(r.latencyMs.median),description:"Median — half of requests were faster than this."},{key:"latency_p95_ms",value:n(r.latencyMs.p95),description:"95th percentile — 95% of requests were faster. Usual headline latency."},{key:"latency_p99_ms",value:n(r.latencyMs.p99),description:"99th percentile — the slow tail (1 in 100 was slower)."},{key:"latency_max_ms",value:n(r.latencyMs.max),description:"Slowest single request."},{key:"vus_max",value:r.vus.max,description:"Peak concurrent users (virtual users / VUs)."},{key:"vus_avg",value:t(r.vus.avg,1),description:"Average concurrent users over the run."},{key:"bytes_in",value:r.data.bytesIn,description:"Response bytes received by the generator."},{key:"bytes_out",value:r.data.bytesOut,description:"Request bytes sent by the generator."},{key:"phase_ttfb_avg_ms",value:n(r.phasesMs.ttfb.avg),description:"Time to first byte — waiting on the server after the connection is up."},{key:"phase_tls_avg_ms",value:n(r.phasesMs.tls.avg),description:"TLS handshake time. High values often mean a far or overloaded endpoint."}];for(let[e,t]of Object.entries(r.http.status)){let s="0"===e?"No HTTP status (timeout / network).":Number(e)>=500?"Server error.":Number(e)>=400?"Client / auth error.":"Success-class response.";a.push({key:`status_${e}`,value:t,description:`How many responses had status ${e}. ${s}`})}for(let e of r.thresholds)a.push({key:`threshold:${e.name}`,value:e.ok?"pass":"fail",description:"k6 threshold result for this run."});return a}])}]);
|