apitestcenter 0.16.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/THIRD-PARTY-NOTICES-UI.txt +1 -1
  2. package/dist/THIRD-PARTY-NOTICES.txt +1 -1
  3. package/dist/cli.mjs +398 -383
  4. package/dist/ui/404/index.html +1 -1
  5. package/dist/ui/404.html +1 -1
  6. package/dist/ui/__next.__PAGE__.txt +11 -11
  7. package/dist/ui/__next._full.txt +12 -12
  8. package/dist/ui/__next._tree.txt +2 -2
  9. package/dist/ui/_next/static/chunks/036rg3itpc5ge.js +50 -0
  10. package/dist/ui/_next/static/chunks/0e8f1i6w6dqos.js +50 -0
  11. package/dist/ui/_next/static/chunks/0hvubzjy33qo9.js +2 -0
  12. package/dist/ui/_next/static/chunks/0wrod6xlhsv0m.js +3 -0
  13. package/dist/ui/_next/static/chunks/{2-fk7_1yukwm4.js → 1519k06vxy4mr.js} +1 -1
  14. package/dist/ui/_next/static/chunks/{3oetlmylrxpce.js → 23_x0u07xh89v.js} +5 -5
  15. package/dist/ui/_next/static/chunks/29z9g1tvzqfn4.css +3 -0
  16. package/dist/ui/_next/static/chunks/2aifruy-vhchn.js +50 -0
  17. package/dist/ui/_next/static/chunks/{3o926vjke_xbm.js → 2b31vf5n6d6th.js} +199 -88
  18. package/dist/ui/_next/static/chunks/2wj5vjpg6np93.js +27 -0
  19. package/dist/ui/_next/static/chunks/33kvaxr7qvnue.js +50 -0
  20. package/dist/ui/_next/static/chunks/36wzwezwmtzq7.js +51 -0
  21. package/dist/ui/_next/static/chunks/3b26__7yusttj.js +1 -0
  22. package/dist/ui/_next/static/chunks/3n2xlaj16gyb-.js +2 -0
  23. package/dist/ui/_next/static/chunks/3vso5wrs90xx-.js +50 -0
  24. package/dist/ui/_not-found/__next._full.txt +11 -11
  25. package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +10 -10
  26. package/dist/ui/_not-found/__next._tree.txt +2 -2
  27. package/dist/ui/_not-found/index.html +1 -1
  28. package/dist/ui/_not-found/index.txt +11 -11
  29. package/dist/ui/compare/__next._full.txt +12 -12
  30. package/dist/ui/compare/__next._tree.txt +2 -2
  31. package/dist/ui/compare/__next.compare.__PAGE__.txt +11 -11
  32. package/dist/ui/compare/index.html +1 -1
  33. package/dist/ui/compare/index.txt +12 -12
  34. package/dist/ui/connections/__next._full.txt +12 -12
  35. package/dist/ui/connections/__next._tree.txt +2 -2
  36. package/dist/ui/connections/__next.connections.__PAGE__.txt +11 -11
  37. package/dist/ui/connections/index.html +2 -2
  38. package/dist/ui/connections/index.txt +12 -12
  39. package/dist/ui/history/__next._full.txt +13 -13
  40. package/dist/ui/history/__next._tree.txt +2 -2
  41. package/dist/ui/history/__next.history.__PAGE__.txt +12 -12
  42. package/dist/ui/history/index.html +1 -1
  43. package/dist/ui/history/index.txt +13 -13
  44. package/dist/ui/home/__next._full.txt +12 -12
  45. package/dist/ui/home/__next._tree.txt +2 -2
  46. package/dist/ui/home/__next.home.__PAGE__.txt +11 -11
  47. package/dist/ui/home/index.html +1 -1
  48. package/dist/ui/home/index.txt +12 -12
  49. package/dist/ui/index.html +1 -1
  50. package/dist/ui/index.txt +12 -12
  51. package/dist/ui/preview/__next._full.txt +13 -13
  52. package/dist/ui/preview/__next._tree.txt +2 -2
  53. package/dist/ui/preview/__next.preview.__PAGE__.txt +12 -12
  54. package/dist/ui/preview/index.html +1 -1
  55. package/dist/ui/preview/index.txt +13 -13
  56. package/dist/ui/suite/__next._full.txt +12 -12
  57. package/dist/ui/suite/__next._tree.txt +2 -2
  58. package/dist/ui/suite/__next.suite.__PAGE__.txt +11 -11
  59. package/dist/ui/suite/index.html +1 -1
  60. package/dist/ui/suite/index.txt +12 -12
  61. package/dist/ui/tests/__next._full.txt +11 -11
  62. package/dist/ui/tests/__next._tree.txt +2 -2
  63. package/dist/ui/tests/__next.tests.__PAGE__.txt +10 -10
  64. package/dist/ui/tests/index.html +1 -1
  65. package/dist/ui/tests/index.txt +11 -11
  66. package/package.json +1 -1
  67. package/dist/ui/_next/static/chunks/0z965ndwtjbm_.js +0 -51
  68. package/dist/ui/_next/static/chunks/11ttwsn_q1n9e.js +0 -50
  69. package/dist/ui/_next/static/chunks/1dblkl6d18f29.js +0 -50
  70. package/dist/ui/_next/static/chunks/1g6q7zaut7pts.js +0 -50
  71. package/dist/ui/_next/static/chunks/1mj3_49yxxkvu.js +0 -3
  72. package/dist/ui/_next/static/chunks/22z3xj74zl8o3.js +0 -1
  73. package/dist/ui/_next/static/chunks/24xh2ng9tdid9.js +0 -50
  74. package/dist/ui/_next/static/chunks/2844deqm9c797.js +0 -50
  75. package/dist/ui/_next/static/chunks/2p2xxbfeii3so.css +0 -3
  76. package/dist/ui/_next/static/chunks/37fbrlydrkdac.js +0 -10
  77. package/dist/ui/_next/static/chunks/3ddcv0i2wy657.js +0 -2
  78. package/dist/ui/_next/static/chunks/41xixugzzb47w.js +0 -27
  79. /package/dist/ui/_next/static/{emu38N9csb28KU3jv4SH4 → DG7f21AItcQXQY2TGN7rY}/_buildManifest.js +0 -0
  80. /package/dist/ui/_next/static/{emu38N9csb28KU3jv4SH4 → DG7f21AItcQXQY2TGN7rY}/_clientMiddlewareManifest.js +0 -0
  81. /package/dist/ui/_next/static/{emu38N9csb28KU3jv4SH4 → DG7f21AItcQXQY2TGN7rY}/_ssgManifest.js +0 -0
@@ -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 n=e.i(2385),s=e.i(42447),r=e.i(67938),a=e.i(84355),l=e.i(20621),i=e.i(99522);let o=(0,i.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),u=e.i(81538),p=e.i(13163),m=e.i(71189),h=e.i(96659);let f=(0,i.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),w=e.i(39170),k=e.i(37837),j=e.i(17847),N=e.i(56396),S=e.i(67217),C=e.i(44505),$=e.i(20054),M=e.i(19656),F=e.i(59180),I=e.i(30635),T=e.i(88153);function _({project:e,onOpen:n,onRename:s,onRemove:r,onDelete:a}){let[l,i]=(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:n,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,I.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 n=Math.round(t/60);if(n<24)return`Opened ${n} hour${1===n?"":"s"} ago`;let s=Math.round(n/24);return 1===s?"Opened yesterday":`Opened ${s} 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&&(s?.(e.target.value),m(!1)),"Escape"===e.key&&m(!1)},onBlur:e=>{s?.(e.target.value),m(!1)}}):null,s||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":l,onClick:()=>i(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)(u.MoreHorizontal,{size:15})}),(0,t.jsx)(k.Popover,{anchor:f,open:l,onClose:()=>i(!1),label:`Actions for ${e.name}`,width:200,role:"menu",children:(0,t.jsxs)("div",{className:"-m-2",children:[s?(0,t.jsx)(j.MenuItem,{icon:p.Pencil,label:"Rename",onSelect:()=>(i(!1),m(!0))}):null,r?(0,t.jsx)(j.MenuItem,{icon:c.ListX,label:"Take off the list",onSelect:()=>(i(!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:()=>(i(!1),a())})]}):null]})})]}):null]})}function E({href:e,onClick:n,icon:s,title:r,body:a}){let l=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-accent",children:s}),(0,t.jsx)("span",{className:"text-sm font-semibold text-ink",children:r}),(0,t.jsx)("span",{className:"text-xs text-mute",children:a})]}),i="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:i,children:l}):(0,t.jsx)("button",{type:"button",onClick:n,className:i,children:l})}e.s(["HomePage",0,function(){let e=(0,N.useToast)(),i=(0,w.useConfirm)(),{slo:o}=(0,T.useSlo)(),{dataDir:c}=(0,$.useEngineHealth)(),{projects:u,refresh:p,supported:h}=(0,I.useProjects)(),{index:k}=(0,F.useHistory)(),[j,R]=(0,v.useState)(!1),[A,L]=(0,v.useState)(""),[P,O]=(0,v.useState)(null),[z,q]=(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(q(t.name),!await D.open(t.id).catch(()=>!1)&&(q(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 B(){if(!D||!A.trim())return;let t=await D.add({name:A.trim(),folder:P??void 0}).catch(()=>null);if(!t)return e("Could not make the project","error");R(!1),L(""),O(null),await p();let n=(await D.list()).find(e=>e.id===t.id);n&&await H(n)}async function V(){if(!D)return;let e=await D.chooseFolder("open");if(!e)return;let t=await D.add({folder:e});await p();let n=t?(await D.list()).find(e=>e.id===t.id):void 0;n&&await H(n)}async function W(e){!D||await i({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 p())}async function X(n){if(!D||!await i({title:`Delete the project “${n.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:n.path})," is left alone.",n.current?" The app switches to My workspace first.":""]}),confirmLabel:"Delete project",tone:"danger"}))return;n.current&&q("My workspace");let s=await D.delete(n.id).catch(()=>({ok:!1,keptOthers:!1}));if(!s.ok)return q(null),e(`Could not delete “${n.name}”`,"error");e(s.keptOthers?`Deleted “${n.name}” — the folder's other files were kept`:`Deleted “${n.name}” — it's in the Recycle Bin`,"success"),await p()}async function K(e,t){D&&t.trim()&&t.trim()!==e.name&&(await D.rename(e.id,t.trim()),await p())}let J=(k?.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:[z?(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 ",z,"…"]})}):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 V(),children:[(0,t.jsx)(l.FolderOpen,{size:15,"aria-hidden":!0})," Open folder…"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary",onClick:()=>R(!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(),B()},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:A,onChange:e=>L(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:P??void 0,children:P??`Documents/APITestCenter Projects/${A.trim()||"…"}`}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:async()=>O(await D?.chooseFolder("new")??P),children:"Choose…"})]})]}),(0,t.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:!A.trim(),children:"Create and open"}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:()=>R(!1),children:"Cancel"})]}):null,(0,t.jsx)("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-4",children:(u??(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,S.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:()=>(0,g.openSettings)(),icon:(0,t.jsx)(s.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"}),J.length?(0,t.jsx)("ul",{className:"overflow-hidden rounded-xl border border-line bg-panel",children:J.map((e,s)=>(0,t.jsx)("li",{className:s?"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,M.formatMs)(e.p95)," · ",new Date(e.startedAt).toLocaleDateString(void 0,{day:"numeric",month:"short"})]})]}),(0,t.jsx)(b.VerdictTag,{level:(0,n.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),n=e.i(99181),s=e.i(68820),r=e.i(14865);e.s(["Popover",0,function({anchor:e,open:a,onClose:l,children:i,label:o,width:c=280,role:d="dialog"}){let u=(0,n.useRef)(null),[p,m]=(0,n.useState)(null);return((0,n.useLayoutEffect)(()=>{if(!a)return;let t=()=>{if(!e.current)return;let t=(0,r.pageRect)(e.current),n=(0,r.pageViewport)(),s=u.current?.offsetHeight??320,a=n.height-t.bottom-8,l=t.top-8,i=a<Math.min(s,240)&&l>a,o=Math.min(Math.max(8,t.right-c),n.width-c-8);m({top:i?Math.max(8,t.top-Math.min(s,l)-4):t.bottom+4,left:o,maxHeight:Math.max(160,(i?l:a)-4)})};t();let n=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",t)}},[a,e,c]),(0,n.useEffect)(()=>{if(!a)return;let t=t=>{let n=t.target;u.current?.contains(n)||e.current?.contains(n)||l()},n=t=>{"Escape"===t.key&&(t.stopPropagation(),l(),e.current?.focus())},s=e=>{u.current?.contains(e.target)||l()},r=t=>{e.current?.contains(t.target)&&(t.stopPropagation(),t.preventDefault(),l())};return document.addEventListener("pointerdown",t,!0),document.addEventListener("click",r,!0),document.addEventListener("keydown",n,!0),document.addEventListener("scroll",s,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("click",r,!0),document.removeEventListener("keydown",n,!0),document.removeEventListener("scroll",s,!0)}},[a,l,e]),(0,n.useEffect)(()=>{a&&window.setTimeout(()=>u.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,s.createPortal)((0,t.jsx)("div",{ref:u,role:d,"aria-label":o,style:{top:p?.top??-9999,left:p?.left??-9999,width:c,maxHeight:p?.maxHeight},className:"anim-pop fixed z-[70] overflow-auto rounded-lg border border-line bg-panel p-3 shadow-2xl",children:i}),document.body)}])},32610,e=>{"use strict";var t=e.i(14368),n=e.i(99181);e.s(["Splitter",0,function({orientation:e,label:s,value:r,onMove:a,onStep:l,onReset:i,onDragging:o,className:c="",style:d}){let[u,p]=(0,n.useState)(!1);(0,n.useEffect)(()=>o?.(u),[u,o]),(0,n.useEffect)(()=>{if(!u)return;let t=e=>a(e.clientX,e.clientY),n=()=>p(!1);return document.body.style.userSelect="none",document.body.style.cursor="vertical"===e?"col-resize":"row-resize",window.addEventListener("pointermove",t),window.addEventListener("pointerup",n),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n)}},[u,a,e]);let m="vertical"===e;return(0,t.jsx)("div",{role:"separator",tabIndex:0,"aria-orientation":e,"aria-label":s,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r),title:`${s} — drag, or double-click to reset`,onPointerDown:e=>{0===e.button&&(e.preventDefault(),p(!0))},onDoubleClick:i,style:{...d,outline:"none"},onKeyDown:e=>{let t=m?"ArrowLeft":"ArrowUp";e.key===t||e.key===(m?"ArrowRight":"ArrowDown")?(e.preventDefault(),l(e.key===t?-1:1,e.shiftKey)):("Enter"===e.key||"Home"===e.key)&&(e.preventDefault(),i())},className:`group z-20 hidden touch-none outline-none lg:block ${m?"w-2 cursor-col-resize":"h-2 cursor-row-resize"} ${c}`,children:(0,t.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute bg-accent opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-100 ${u?"opacity-100":""} ${m?"inset-y-0 left-1/2 w-0.5 -translate-x-1/2":"inset-x-0 top-1/2 h-0.5 -translate-y-1/2"}`})})}])},30617,e=>{"use strict";e.i(24856);var t=e.i(46306),n=e.i(36558),s=e.i(2385),r=e.i(17219);let a={base:0,header:1,desc:2,pass:3,warn:4,fail:5};function l(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("\n","&#10;")}function i(e,t,n){if("level"===e)return"pass"===t?a.pass:"warn"===t?a.warn:"fail"===t?a.fail:a.base;let s="number"==typeof t?t:Number(t);return"errors"===e?s>=n.errorFail?a.fail:s>=n.errorWarn?a.warn:a.pass:s>=n.p95FailMs?a.fail:s>=n.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,l){let o=(0,s.buildVerdict)(e,{slo:r}),c=(0,s.verdictBars)(r),u=(0,t.normalizeChartLayout)(l,(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,n.summaryExportRows)(e).map(e=>{let t=a.base;return"failed_rate"===e.key&&(t=i("errors",e.value,c)),"latency_p95_ms"===e.key&&(t=i("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:i("level",o.overall,c)},{v:o.headline,s:a.desc}],...o.aspects.map(e=>[{v:e.title},{v:e.level,s:i("level",e.level,c)},{v:e.summary,s:a.desc}]),[{v:"disclaimer"},{v:""},{v:o.disclaimer,s:a.desc}],...u.map((e,n)=>[{v:`chart_${n+1}`},{v:`${e.w}x${e.h}`},{v:t.CHART_TILE_TITLES[e.id],s:a.desc}])]},{name:"Second by second",rows:[n.SERIES_COLUMNS.map(e=>({v:e.header,s:a.header})),...e.buckets.map(e=>(0,n.seriesExportRow)(e).map((e,t)=>{let s=n.SERIES_COLUMNS[t]?.key,r=a.base;return"p95_ms"===s&&(r=i("latency",e,c)),"failed_rate"===s&&(r=i("errors",e,c)),"http_5xx"===s&&Number(e)>0&&(r=a.fail),"http_0"===s&&Number(e)>0&&(r=a.fail),"http_4xx"===s&&Number(e)>0&&(r=a.warn),"http_2xx"===s&&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="${l(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,n)=>{var s;let r,a,i;return t[`xl/worksheets/sheet${n+1}.xml`]=(s=e.rows,a=Array.from({length:r=s[0]?.length??0},(e,t)=>{let n=function(e,t,n=10,s=48){let r=n;for(let n of e){let e=n[t]?.v;void 0!==e&&(r=Math.max(r,String(e).length+2))}return Math.min(s,r)}(s,t,t===r-1&&r>=3?36:12,t===r-1&&r>=3?72:42);return`<col min="${t+1}" max="${t+1}" width="${n}" customWidth="1"/>`}).join(""),i=s.map((e,t)=>`<row r="${t+1}" ht="${0===t?22:18}" customHeight="1">${e.map((e,n)=>{var s;let r,a;return s=t+1,r=`${function(e){let t=e+1,n="";for(;t>0;)n=String.fromCharCode(65+(t-1)%26)+n,t=Math.floor((t-1)/26);return n}(n)}${s}`,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">${l(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,r.zipStore)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"exportRunXlsx",0,c,"xlsxBook",0,d])},62766,e=>{"use strict";var t=e.i(99181);let n="apitestcenter-pane-sizes",s=(e,t,n)=>Math.min(n,Math.max(t,e));function r(e){let[n,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let t=window.matchMedia(e),n=()=>s(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[e]),n}e.s(["useColumnSplit",0,function(e,{min:a=220,max:l=900,rest:i=360}={}){let o=r("(min-width: 1024px)"),c=(0,t.useRef)(null),d=`${n}:${e}`,[u,p]=(0,t.useState)(null),[m,h]=(0,t.useState)(0);(0,t.useEffect)(()=>{try{let e=Number(JSON.parse(localStorage.getItem(d)??"null"));Number.isFinite(e)&&e>0&&p(e)}catch{}},[d]),(0,t.useEffect)(()=>{let e=[...c.current?.children??[]].find(e=>"separator"!==e.getAttribute("role"));if(!e)return;let t=new ResizeObserver(()=>h(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[o]);let f=(0,t.useCallback)(e=>{let t=c.current?.getBoundingClientRect(),n=null===e?null:Math.round(s(e,a,Math.max(a,Math.min(l,(t?.width??l+i)-i))));p(n);try{null===n?localStorage.removeItem(d):localStorage.setItem(d,JSON.stringify(n))}catch{}},[l,a,i,d]),x=()=>c.current?.getBoundingClientRect();return{wide:o,gridRef:c,gridStyle:o&&null!==u?{gridTemplateColumns:`${u}px minmax(0,1fr)`}:void 0,splitter:{orientation:"vertical",value:(u??m)/Math.max(1,x()?.width??1)*100,onMove:e=>{let t=x();t&&f(e-t.left)},onStep:(e,t)=>f((u??m)+16*e*(t?4:1)),onReset:()=>f(null),className:"absolute inset-y-0 -translate-x-1/2",style:{left:`${m}px`}}}},"usePaneSizes",0,function(e,a){let l=r("(min-width: 1024px)"),i=r("(min-width: 1536px)"),o=(0,t.useRef)(null),[c,d]=(0,t.useState)({panel:null,beside:null,below:null});(0,t.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(n)??"null"),t=e=>"number"==typeof e&&Number.isFinite(e)?e:null;e&&d({panel:t(e.panel),beside:t(e.beside),below:t(e.below)})}catch{}},[]);let u=(0,t.useCallback)(e=>{d(t=>{let s={...t,...e};try{localStorage.setItem(n,JSON.stringify(s))}catch{}return s})},[]),p=s(c.panel??(i?256:240),180,480),m=a?p:0,h=s("below"===e?c.below??.5:c.beside??(i?5/12:.5),.2,.8),f=l?"below"===e?{gridTemplateColumns:`${m}px minmax(0,1fr)`,gridTemplateRows:`minmax(0,${h}fr) minmax(0,${1-h}fr)`}:{gridTemplateColumns:`${m}px minmax(0,${h}fr) minmax(0,${1-h}fr)`}:void 0,x=()=>o.current?.getBoundingClientRect(),y=(0,t.useCallback)(e=>{let t=x();t&&u({panel:s(e-t.left,180,Math.min(480,.4*t.width))})},[u]),v=(0,t.useCallback)((t,n)=>{let r=x();r&&("below"===e?u({below:s((n-r.top)/r.height,.2,.8)}):u({beside:s((t-r.left-m)/Math.max(1,r.width-m),.2,.8)}))},[u,e,m]);return{wide:l,gridRef:o,gridStyle:f,panelWidth:l?p:void 0,panel:{value:p/480*100,onMove:e=>y(e),onStep:(e,t)=>u({panel:s(p+16*e*(t?4:1),180,480)}),onReset:()=>u({panel:null}),style:{left:`${m}px`}},split:{value:100*h,onMove:v,onStep:(t,n)=>u("below"===e?{below:s(h+.02*t*(n?5:1),.2,.8)}:{beside:s(h+.02*t*(n?5:1),.2,.8)}),onReset:()=>u("below"===e?{below:null}:{beside:null}),style:"below"===e?{top:`${100*h}%`,left:`${m}px`,right:0}:{left:`calc(${m}px + (100% - ${m}px) * ${h})`,top:0,bottom:0}}}}])},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),n=e.i(99181),s=e.i(68820),r=e.i(14865);e.s(["ContextMenu",0,function({at:e,label:a,onClose:l,children:i}){let o=(0,n.useRef)(null),[c,d]=(0,n.useState)(null);return((0,n.useLayoutEffect)(()=>{let t=o.current;if(!t)return;let n=(0,r.pageViewport)();d({left:Math.max(8,Math.min(e.x,n.width-t.offsetWidth-8)),top:Math.max(8,Math.min(e.y,n.height-t.offsetHeight-8))}),t.querySelector('[role="menuitem"]:not(:disabled)')?.focus()},[e]),(0,n.useEffect)(()=>{let e=e=>{o.current?.contains(e.target)||l()},t=e=>{if("Escape"===e.key)e.stopPropagation(),l();else if("ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();let t=[...o.current?.querySelectorAll('[role="menuitem"]:not(:disabled)')??[]],n=t.indexOf(document.activeElement);t[(n+("ArrowDown"===e.key?1:-1)+t.length)%t.length]?.focus()}};return document.addEventListener("pointerdown",e,!0),document.addEventListener("scroll",e,!0),window.addEventListener("resize",l),window.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",l),window.removeEventListener("keydown",t,!0)}},[l]),"u"<typeof document)?null:(0,s.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:i}),document.body)},"MenuItem",0,function({icon:e,label:n,hint:s,onSelect:r,danger:a=!1,disabled:l=!1}){return(0,t.jsxs)("button",{type:"button",role:"menuitem",disabled:l,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:n}),s?(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-mute",children:s}):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 n=t;for(let e=0;e<8;e++)n=1&n?0xedb88320^n>>>1:n>>>1;return n>>>0});function n(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function s(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)),n=0;for(let s of e)t.set(s,n),n+=s.length;return t}e.s(["zipStore",0,function(e){let a=new TextEncoder,l=[],i=[],o=0;for(let[c,d]of Object.entries(e)){let e=a.encode(c),u="string"==typeof d?a.encode(d):d,p=function(e){let n=0xffffffff;for(let s of e)n=t[(n^s)&255]^n>>>8;return(0xffffffff^n)>>>0}(u),m=r([s(0x4034b50),n(20),n(0),n(0),n(0),n(0),s(p),s(u.length),s(u.length),n(e.length),n(0),e,u]),h=r([s(0x2014b50),n(20),n(20),n(0),n(0),n(0),n(0),s(p),s(u.length),s(u.length),n(e.length),n(0),n(0),n(0),n(0),s(0),s(o),e]);l.push(m),i.push(h),o+=m.length}let c=r(i),d=r([s(0x6054b50),n(0),n(0),n(Object.keys(e).length),n(Object.keys(e).length),s(c.length),s(o),n(0)]),u=r([...l,c,d]);return new Blob([u.buffer.slice(u.byteOffset,u.byteOffset+u.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,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)},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 n(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 s=(e,t,n)=>fetch(t,{method:e,headers:void 0===n?void 0:{"content-type":"application/json"},body:void 0===n?void 0:JSON.stringify(n)});e.s(["suiteApi",0,{plan:e=>fetch(`/engine/suites/plan?collection=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>n(e)),savePlan:(e,t)=>s("PUT","/engine/suites/plan",{collection:e,...t}).then(e=>n(e)),start:e=>s("POST","/engine/suites/runs",e).then(e=>n(e)),get:e=>fetch(`/engine/suites/runs/${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>n(e)),stop:e=>s("POST",`/engine/suites/runs/${encodeURIComponent(e)}/stop`).then(e=>n(e))},"suiteHref",0,function(e){return`/suite?c=${encodeURIComponent(e)}`}],14168)},36558,e=>{"use strict";function t(e,n=2){if(!Number.isFinite(e))return 0;let s=10**n;return Math.round(e*s)/s}function n(e){return e>=100?Math.round(e):e>=10?t(e,1):t(e,2)}function s(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),n(e.rps),s(e.p50Ms),s(e.p95Ms),s(e.p99Ms),t(e.failedRate,4),e.http2xx,e.http4xx,e.http5xx,e.http0,e.bytesIn,e.bytesOut,r(e.p90Ms,s),r(e.p999Ms,s),r(e.maxMs,s),r(e.ttfbMs,s),r(e.connectMs,s),r(e.tlsMs,s),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:n(r.http.rps.avg),description:"Average requests per second completed by this generator."},{key:"rps_max",value:n(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:s(r.latencyMs.min),description:"Fastest request (milliseconds)."},{key:"latency_mean_ms",value:s(r.latencyMs.mean),description:"Average response time. Slow outliers pull this up."},{key:"latency_p50_ms",value:s(r.latencyMs.median),description:"Median — half of requests were faster than this."},{key:"latency_p95_ms",value:s(r.latencyMs.p95),description:"95th percentile — 95% of requests were faster. Usual headline latency."},{key:"latency_p99_ms",value:s(r.latencyMs.p99),description:"99th percentile — the slow tail (1 in 100 was slower)."},{key:"latency_max_ms",value:s(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:s(r.phasesMs.ttfb.avg),description:"Time to first byte — waiting on the server after the connection is up."},{key:"phase_tls_avg_ms",value:s(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 n="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}. ${n}`})}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}])}]);
@@ -0,0 +1,50 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53356,e=>{"use strict";var t=e.i(14368),s=e.i(32610),n=e.i(62766);e.i(24856);var r=e.i(2385),a=e.i(53012),l=e.i(93250),i=e.i(84355),o=e.i(20621),c=e.i(67951),d=e.i(91694),u=e.i(27813),m=e.i(88293),p=e.i(96659),h=e.i(87283),f=e.i(30099),x=e.i(36994),y=e.i(99181),v=e.i(67754),b=e.i(6980),g=e.i(29724),w=e.i(39170),k=e.i(28867),j=e.i(56396),N=e.i(19656),S=e.i(59180),C=e.i(88231),T=e.i(88153);function $(e){return"run"===e.kind?e.startedAt:e.savedAt}function F(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function _({run:e,slo:s}){let n=(0,r.buildVerdictFromInputs)(e.verdict,{slo:s}).overall;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-sm text-ink",children:[e.baseline?(0,t.jsx)(l.Diamond,{size:11,className:"mr-1 inline fill-current align-[-1px] text-accent","aria-label":"Reference run"}):null,e.name]}),"failed"===e.status||"cancelled"===e.status?(0,t.jsx)("span",{className:"shrink-0 text-xs text-mute capitalize",children:e.status}):(0,t.jsx)(b.VerdictTag,{level:n})]}),(0,t.jsx)("div",{className:"mt-0.5 truncate font-mono text-xs text-mute",children:e.endpoint}),(0,t.jsxs)("div",{className:"mt-0.5 flex flex-wrap gap-x-3 font-mono text-xs text-mute",children:[(0,t.jsxs)("span",{children:["p95 ",(0,N.formatMs)(e.p95)]}),(0,t.jsxs)("span",{children:[(0,N.formatPercent)(e.errorRate)," err"]}),(0,t.jsx)("span",{children:F(e.startedAt)})]}),e.note?(0,t.jsx)("p",{className:"mt-1 line-clamp-1 text-xs text-ink",children:e.note}):null]})}function E({compare:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.GitCompareArrows,{size:13,className:"shrink-0 text-accent","aria-label":"Compare"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm text-ink",children:e.name})]}),(0,t.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-mute",children:[e.titles.map((e,s)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:(0,C.seriesColor)(s)},"aria-hidden":!0}),e]},s)),(0,t.jsx)("span",{className:"font-mono",children:F(e.savedAt)})]})]})}function M({name:e,note:s,onSave:n}){let[r,a]=(0,y.useState)(e),[l,i]=(0,y.useState)(s??"");return(0,y.useEffect)(()=>a(e),[e]),(0,y.useEffect)(()=>i(s??""),[s]),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Name"}),(0,t.jsx)("input",{value:r,onChange:e=>a(e.target.value),onBlur:()=>r.trim()!==e&&void n({name:r}),onKeyDown:e=>"Enter"===e.key&&e.target.blur(),className:"w-full rounded-md border border-transparent bg-transparent px-1 py-0.5 text-xl font-medium text-ink hover:border-line focus:border-accent focus:outline-none",title:"Click to rename"})]}),(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Note"}),(0,t.jsx)("textarea",{value:l,rows:l?2:1,onChange:e=>i(e.target.value),onBlur:()=>l.trim()!==(s??"")&&void n({note:l}),placeholder:"Add a note — what changed, which build, why you ran it…",className:"input resize-y text-sm"})]})]})}function I({summary:e,related:s,onSelect:n,onDelete:r,onReveal:a}){let l=(0,j.useToast)(),{refresh:i}=(0,S.useHistory)(),[c,d]=(0,y.useState)(null),[m,h]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!e)return;let t=!1;return S.historyApi.run(e.id).then(e=>!t&&d(e)).catch(e=>!t&&h(e instanceof Error?e.message:"Could not read the file")),()=>{t=!0}},[e?.id,e?.bytes]),!e)return null;let f=s.filter(t=>t.endpoint===e.endpoint);async function x(t){try{await S.historyApi.updateRun(e.id,t),await i()}catch(e){l(e instanceof Error?e.message:"Could not save","error")}}return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(M,{name:e.name,note:e.note,onSave:x}),(0,t.jsx)("p",{className:"mt-1 px-1 font-mono text-xs break-all text-mute",children:e.file})]}),(0,t.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>a(e.id),children:[(0,t.jsx)(o.FolderOpen,{size:13}),"Show file"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1.5 text-xs",onClick:()=>r(e.id),children:[(0,t.jsx)(p.Trash2,{size:13}),"Delete"]})]})]}),e.error?(0,t.jsx)("p",{role:"alert",className:"rounded-md border border-bad/40 bg-bad/10 px-3 py-2 font-mono text-xs text-bad",children:e.error}):null,f.length>=2?(0,t.jsx)(v.TrendPanel,{runs:f,selectedId:e.id,onSelect:n}):null,m?(0,t.jsx)("p",{className:"text-sm text-bad",children:m}):c&&c.report.id===e.id?(0,t.jsx)(g.ReportView,{report:c.report,source:"session",showTitle:!1}):(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-mute",children:[(0,t.jsx)(u.Loader2,{size:14,className:"animate-spin"})," Opening…"]})]})}function A({summary:e,onDelete:s,onReveal:n}){let a=(0,j.useToast)(),{slo:l}=(0,T.useSlo)(),{refresh:i}=(0,S.useHistory)(),[d,m]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!e)return;let t=!1;return S.historyApi.compare(e.id).then(e=>!t&&m(e)).catch(()=>void 0),()=>{t=!0}},[e?.id,e?.bytes]),!e)return null;async function h(t){try{await S.historyApi.updateCompare(e.id,t),await i()}catch(e){a(e instanceof Error?e.message:"Could not save","error")}}return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"px-1 text-xs tracking-wide text-accent uppercase",children:["Compare · ","parallel"===e.mode?"all at once":"one after another"]}),(0,t.jsx)(M,{name:e.name,note:e.note,onSave:h}),(0,t.jsx)("p",{className:"mt-1 px-1 font-mono text-xs break-all text-mute",children:e.file})]}),(0,t.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,t.jsxs)(f.default,{href:`/compare?compare=${e.id}`,className:"btn btn-primary py-1.5 text-xs",children:[(0,t.jsx)(c.GitCompareArrows,{size:13}),"Open overlay"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>n(e.id),children:[(0,t.jsx)(o.FolderOpen,{size:13}),"Show file"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1.5 text-xs",onClick:()=>s(e.id),children:[(0,t.jsx)(p.Trash2,{size:13}),"Delete"]})]})]}),d?(0,t.jsx)("ul",{className:"grid gap-2 @2xl:grid-cols-2",children:d.apis.map((e,s)=>(0,t.jsxs)("li",{className:"rounded-lg border border-line bg-panel p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-sm text-ink",children:[(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:(0,C.seriesColor)(s)},"aria-hidden":!0}),(0,t.jsx)("span",{className:"truncate",children:e.title})]}),(0,t.jsx)(b.VerdictTag,{level:(0,r.buildVerdict)(e.report,{slo:l}).overall})]}),(0,t.jsxs)("p",{className:"mt-1 truncate font-mono text-xs text-mute",children:[e.report.definition.method," ",e.report.definition.url]}),(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap gap-x-4 font-mono text-xs text-ink",children:[(0,t.jsxs)("span",{children:["p95 ",(0,N.formatMs)(e.report.summary.latencyMs.p95)]}),(0,t.jsxs)("span",{children:[(0,N.formatPercent)(e.report.summary.http.failed.rate)," err"]}),(0,t.jsxs)("span",{children:[e.report.summary.http.requests.toLocaleString()," req"]})]})]},e.id))}):(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-mute",children:[(0,t.jsx)(u.Loader2,{size:14,className:"animate-spin"})," Opening…"]})]})}function R({index:e,onChanged:s,onReveal:n}){let r=(0,w.useConfirm)(),l=(0,j.useToast)();return(0,t.jsxs)("details",{className:"mx-1 mb-3 rounded-md border border-warn/40 bg-warn/10 px-3 py-2 text-sm",children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-ink",children:[(0,t.jsx)(a.AlertTriangle,{size:13,className:"mr-1 inline align-[-2px] text-warn","aria-hidden":!0}),e.invalid.length," ",1===e.invalid.length?"file":"files"," in your history folder couldn't be read"]}),(0,t.jsx)("ul",{className:"mt-2 space-y-1",children:e.invalid.map(e=>(0,t.jsxs)("li",{className:"text-xs",children:[(0,t.jsxs)("span",{className:"font-mono text-ink",children:[e.folder,"/",e.file]}),(0,t.jsx)("span",{className:"block text-mute",children:e.reason})]},`${e.folder}/${e.file}`))}),(0,t.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:n,children:"Show folder"}),(0,t.jsx)("button",{type:"button",className:"btn btn-danger py-1 text-xs",onClick:async()=>{await r({title:"Delete the unreadable files?",body:"They are not valid APITestCenter records. If you edited one by hand, fix it instead and it will reappear.",confirmLabel:"Delete files",tone:"danger"})&&(await S.historyApi.remove({invalid:e.invalid.map(({folder:e,file:t})=>({folder:e,file:t}))}),await s(),l("Unreadable files deleted","success"))},children:"Delete them"})]})]})}function L({filtered:e,hasAny:s}){return(0,t.jsx)("p",{className:"px-3 py-6 text-sm text-mute",children:e&&s?"Nothing matches. Clear the search or filter.":"No saved records yet."})}function z(){return(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-6 py-16 text-center",children:[(0,t.jsx)("div",{className:"grid h-12 w-12 place-items-center rounded-full bg-accent-dim text-accent",children:(0,t.jsx)(d.History,{size:22,strokeWidth:1.75,"aria-hidden":!0})}),(0,t.jsx)("h2",{className:"mt-4 text-base font-medium text-ink",children:"Your history is empty"}),(0,t.jsx)("p",{className:"mt-2 max-w-sm text-sm text-mute",children:"Every performance test and compare is saved here automatically, as a JSON file on this computer. Nothing leaves your machine."}),(0,t.jsxs)("div",{className:"mt-6 flex flex-wrap justify-center gap-2",children:[(0,t.jsxs)(f.default,{href:"/",className:"btn btn-primary text-sm",children:[(0,t.jsx)(i.FlaskConical,{size:14}),"Test an API"]}),(0,t.jsxs)(f.default,{href:"/compare",className:"btn btn-secondary text-sm",children:[(0,t.jsx)(c.GitCompareArrows,{size:14}),"Compare APIs"]})]})]})}e.s(["default",0,function(){let e=(0,n.useColumnSplit)("history",{min:280}),r=(0,x.useRouter)(),a=(0,j.useToast)(),l=(0,w.useConfirm)(),{slo:i}=(0,T.useSlo)(),{index:d,loading:f,error:v,refresh:b}=(0,S.useHistory)(),[g,C]=(0,y.useState)(""),[F,M]=(0,y.useState)("all"),[D,O]=(0,y.useState)(null),[P,U]=(0,y.useState)(new Set),[q,H]=(0,y.useState)(!1),V=d?.runs??[],B=d?.compares??[],W=(0,y.useMemo)(()=>{let e=g.trim().toLowerCase();return[..."compares"===F?[]:V.filter(e=>"baselines"!==F||e.baseline),..."runs"===F||"baselines"===F?[]:B].filter(t=>!e||t.name.toLowerCase().includes(e)||(t.note??"").toLowerCase().includes(e)||("run"===t.kind?t.endpoint.toLowerCase().includes(e):t.titles.join(" ").toLowerCase().includes(e))).sort((e,t)=>Date.parse($(t))-Date.parse($(e)))},[V,B,g,F]);(0,y.useEffect)(()=>{if(d&&!(D&&("run"===D.kind?V.some(e=>e.id===D.id):B.some(e=>e.id===D.id)))){let e=W[0];O(e?{kind:e.kind,id:e.id}:null)}},[d]);let J=[...P].filter(e=>e.startsWith("run:")).map(e=>e.slice(4)),X=[...P].filter(e=>e.startsWith("compare:")).map(e=>e.slice(8));async function K(e,t){let s=e.length+t.length;if(await l({title:`Delete ${s} ${1===s?"record":"records"}?`,body:"The JSON files are removed from your history folder. This cannot be undone — export first if you want a copy.",confirmLabel:"Delete",tone:"danger"})){H(!0);try{let{removed:s}=await S.historyApi.remove({runs:e,compares:t});U(new Set),await b(),a(`Deleted ${s} ${1===s?"record":"records"}`,"success")}catch(e){a(e instanceof Error?e.message:"Delete failed","error")}finally{H(!1)}}}async function Y(e){try{await S.historyApi.reveal(e)}catch(e){a(e instanceof Error?e.message:"Could not open the folder","error")}}let G=function(e){let t=new Map,s=new Date,n=new Date(s.getTime()-864e5),r=(e,t)=>e.toDateString()===t.toDateString();for(let a of e){let e=new Date($(a)),l=r(e,s)?"Today":r(e,n)?"Yesterday":e.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:e.getFullYear()===s.getFullYear()?void 0:"numeric"}),i=t.get(l)??[];i.push(a),t.set(l,i)}return[...t]}(W);return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("header",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-line bg-panel px-4 py-3 lg:px-6",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h1",{className:"text-lg font-medium text-ink",children:"History"}),(0,t.jsx)("p",{className:"truncate text-xs text-mute",title:d?.dataDir,children:d?`${V.length} load ${1===V.length?"test":"tests"} \xb7 ${B.length} ${1===B.length?"compare":"compares"} \xb7 ${(0,N.formatBytes)(d.totalBytes)} on this computer`:f?"Loading…":"History is unavailable"})]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:()=>void Y(),disabled:!d,children:[(0,t.jsx)(o.FolderOpen,{size:15}),"Show folder"]})]}),v&&!d?(0,t.jsxs)("div",{role:"alert",className:"m-6 rounded-md border border-bad/40 bg-bad/10 px-4 py-3 text-sm text-ink",children:[(0,t.jsx)("p",{className:"font-medium text-bad",children:"Can't reach the engine"}),(0,t.jsxs)("p",{className:"mt-1",children:["History is stored by the local engine. Start it with pnpm dev, then come back. (",v,")"]})]}):null,(0,t.jsxs)("div",{ref:e.gridRef,style:e.gridStyle,className:"relative grid min-h-0 flex-1 overflow-y-auto lg:grid-cols-[minmax(20rem,26rem)_minmax(0,1fr)] lg:overflow-hidden",children:[(0,t.jsx)(s.Splitter,{label:"History list width",...e.splitter}),(0,t.jsxs)("section",{"aria-label":"Saved records",className:"flex min-h-0 flex-col border-line lg:border-r",children:[(0,t.jsxs)("div",{className:"space-y-2 border-b border-line px-4 py-3",children:[(0,t.jsxs)("label",{className:"relative block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Search history"}),(0,t.jsx)(m.Search,{size:14,className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-mute","aria-hidden":!0}),(0,t.jsx)("input",{value:g,onChange:e=>C(e.target.value),placeholder:"Search name, URL, or note",className:"input pl-8"})]}),(0,t.jsx)(k.Segmented,{label:"Show",value:F,onChange:M,options:[{value:"all",label:"All"},{value:"runs",label:"Performance tests"},{value:"compares",label:"Compares"},{value:"baselines",label:"Reference runs"}]})]}),P.size>0?(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line bg-accent-dim px-4 py-2 text-sm",children:[(0,t.jsxs)("span",{className:"text-ink",children:[P.size," selected"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary ml-auto py-1 text-xs",disabled:J.length<2||J.length>6||X.length>0,title:J.length<2?"Tick 2–6 performance tests to overlay them":"Overlay these runs on Compare",onClick:()=>r.push(`/compare?ids=${J.join(",")}`),children:[(0,t.jsx)(c.GitCompareArrows,{size:13}),"Overlay"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1 text-xs",disabled:q,onClick:()=>void K(J,X),children:[(0,t.jsx)(p.Trash2,{size:13}),"Delete"]}),(0,t.jsx)("button",{type:"button","aria-label":"Clear selection",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>U(new Set),children:(0,t.jsx)(h.X,{size:14})})]}):null,(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:[d?.invalid.length?(0,t.jsx)(R,{index:d,onChanged:b,onReveal:()=>void Y()}):null,f&&!d?(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-6 text-sm text-mute",children:[(0,t.jsx)(u.Loader2,{size:14,className:"animate-spin"})," Reading your history folder…"]}):0===W.length?(0,t.jsx)(L,{filtered:!!g||"all"!==F,hasAny:V.length+B.length>0}):G.map(([e,s])=>(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h2",{className:"px-2 py-1 text-xs font-medium text-mute",children:e}),(0,t.jsx)("ul",{className:"space-y-0.5",children:s.map(e=>{let s=`${e.kind}:${e.id}`,n=D?.kind===e.kind&&D.id===e.id;return(0,t.jsxs)("li",{className:`flex items-start gap-2 rounded-md px-2 py-2 ${n?"bg-accent-dim":"hover:bg-panel-2"}`,children:[(0,t.jsx)("input",{type:"checkbox",checked:P.has(s),onChange:()=>{let t;return t=`${e.kind}:${e.id}`,void U(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},"aria-label":`Select ${e.name}`,className:"mt-1 accent-[var(--accent)]"}),(0,t.jsx)("button",{type:"button",onClick:()=>O({kind:e.kind,id:e.id}),"aria-current":n?"true":void 0,className:"min-w-0 flex-1 text-left",children:"run"===e.kind?(0,t.jsx)(_,{run:e,slo:i}):(0,t.jsx)(E,{compare:e})})]},s)})})]},e))]})]}),(0,t.jsx)("section",{"aria-label":"Details",className:"@container min-h-0 min-w-0 overflow-y-auto px-4 py-4 lg:px-6",children:D?.kind==="run"?(0,t.jsx)(I,{summary:V.find(e=>e.id===D.id),related:V,onSelect:e=>O({kind:"run",id:e}),onDelete:e=>void K([e],[]),onReveal:e=>void Y({folder:"runs",id:e})},D.id):D?.kind==="compare"?(0,t.jsx)(A,{summary:B.find(e=>e.id===D.id),onDelete:e=>void K([],[e]),onReveal:e=>void Y({folder:"compares",id:e})},D.id):d?(0,t.jsx)(z,{}):null})]})]})}])},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:l,children:i,label:o,width:c=280,role:d="dialog"}){let u=(0,s.useRef)(null),[m,p]=(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=u.current?.offsetHeight??320,a=s.height-t.bottom-8,l=t.top-8,i=a<Math.min(n,240)&&l>a,o=Math.min(Math.max(8,t.right-c),s.width-c-8);p({top:i?Math.max(8,t.top-Math.min(n,l)-4):t.bottom+4,left:o,maxHeight:Math.max(160,(i?l: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;u.current?.contains(s)||e.current?.contains(s)||l()},s=t=>{"Escape"===t.key&&(t.stopPropagation(),l(),e.current?.focus())},n=e=>{u.current?.contains(e.target)||l()},r=t=>{e.current?.contains(t.target)&&(t.stopPropagation(),t.preventDefault(),l())};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,l,e]),(0,s.useEffect)(()=>{a&&window.setTimeout(()=>u.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,n.createPortal)((0,t.jsx)("div",{ref:u,role:d,"aria-label":o,style:{top:m?.top??-9999,left:m?.left??-9999,width:c,maxHeight:m?.maxHeight},className:"anim-pop fixed z-[70] overflow-auto rounded-lg border border-line bg-panel p-3 shadow-2xl",children:i}),document.body)}])},32610,e=>{"use strict";var t=e.i(14368),s=e.i(99181);e.s(["Splitter",0,function({orientation:e,label:n,value:r,onMove:a,onStep:l,onReset:i,onDragging:o,className:c="",style:d}){let[u,m]=(0,s.useState)(!1);(0,s.useEffect)(()=>o?.(u),[u,o]),(0,s.useEffect)(()=>{if(!u)return;let t=e=>a(e.clientX,e.clientY),s=()=>m(!1);return document.body.style.userSelect="none",document.body.style.cursor="vertical"===e?"col-resize":"row-resize",window.addEventListener("pointermove",t),window.addEventListener("pointerup",s),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",s)}},[u,a,e]);let p="vertical"===e;return(0,t.jsx)("div",{role:"separator",tabIndex:0,"aria-orientation":e,"aria-label":n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r),title:`${n} — drag, or double-click to reset`,onPointerDown:e=>{0===e.button&&(e.preventDefault(),m(!0))},onDoubleClick:i,style:{...d,outline:"none"},onKeyDown:e=>{let t=p?"ArrowLeft":"ArrowUp";e.key===t||e.key===(p?"ArrowRight":"ArrowDown")?(e.preventDefault(),l(e.key===t?-1:1,e.shiftKey)):("Enter"===e.key||"Home"===e.key)&&(e.preventDefault(),i())},className:`group z-20 hidden touch-none outline-none lg:block ${p?"w-2 cursor-col-resize":"h-2 cursor-row-resize"} ${c}`,children:(0,t.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute bg-accent opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-100 ${u?"opacity-100":""} ${p?"inset-y-0 left-1/2 w-0.5 -translate-x-1/2":"inset-x-0 top-1/2 h-0.5 -translate-y-1/2"}`})})}])},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 l(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("\n","&#10;")}function i(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,l){let o=(0,n.buildVerdict)(e,{slo:r}),c=(0,n.verdictBars)(r),u=(0,t.normalizeChartLayout)(l,(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=i("errors",e.value,c)),"latency_p95_ms"===e.key&&(t=i("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:i("level",o.overall,c)},{v:o.headline,s:a.desc}],...o.aspects.map(e=>[{v:e.title},{v:e.level,s:i("level",e.level,c)},{v:e.summary,s:a.desc}]),[{v:"disclaimer"},{v:""},{v:o.disclaimer,s:a.desc}],...u.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=i("latency",e,c)),"failed_rate"===n&&(r=i("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="${l(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,i;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(""),i=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">${l(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,r.zipStore)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"exportRunXlsx",0,c,"xlsxBook",0,d])},62766,e=>{"use strict";var t=e.i(99181);let s="apitestcenter-pane-sizes",n=(e,t,s)=>Math.min(s,Math.max(t,e));function r(e){let[s,n]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let t=window.matchMedia(e),s=()=>n(t.matches);return s(),t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e]),s}e.s(["useColumnSplit",0,function(e,{min:a=220,max:l=900,rest:i=360}={}){let o=r("(min-width: 1024px)"),c=(0,t.useRef)(null),d=`${s}:${e}`,[u,m]=(0,t.useState)(null),[p,h]=(0,t.useState)(0);(0,t.useEffect)(()=>{try{let e=Number(JSON.parse(localStorage.getItem(d)??"null"));Number.isFinite(e)&&e>0&&m(e)}catch{}},[d]),(0,t.useEffect)(()=>{let e=[...c.current?.children??[]].find(e=>"separator"!==e.getAttribute("role"));if(!e)return;let t=new ResizeObserver(()=>h(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[o]);let f=(0,t.useCallback)(e=>{let t=c.current?.getBoundingClientRect(),s=null===e?null:Math.round(n(e,a,Math.max(a,Math.min(l,(t?.width??l+i)-i))));m(s);try{null===s?localStorage.removeItem(d):localStorage.setItem(d,JSON.stringify(s))}catch{}},[l,a,i,d]),x=()=>c.current?.getBoundingClientRect();return{wide:o,gridRef:c,gridStyle:o&&null!==u?{gridTemplateColumns:`${u}px minmax(0,1fr)`}:void 0,splitter:{orientation:"vertical",value:(u??p)/Math.max(1,x()?.width??1)*100,onMove:e=>{let t=x();t&&f(e-t.left)},onStep:(e,t)=>f((u??p)+16*e*(t?4:1)),onReset:()=>f(null),className:"absolute inset-y-0 -translate-x-1/2",style:{left:`${p}px`}}}},"usePaneSizes",0,function(e,a){let l=r("(min-width: 1024px)"),i=r("(min-width: 1536px)"),o=(0,t.useRef)(null),[c,d]=(0,t.useState)({panel:null,beside:null,below:null});(0,t.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(s)??"null"),t=e=>"number"==typeof e&&Number.isFinite(e)?e:null;e&&d({panel:t(e.panel),beside:t(e.beside),below:t(e.below)})}catch{}},[]);let u=(0,t.useCallback)(e=>{d(t=>{let n={...t,...e};try{localStorage.setItem(s,JSON.stringify(n))}catch{}return n})},[]),m=n(c.panel??(i?256:240),180,480),p=a?m:0,h=n("below"===e?c.below??.5:c.beside??(i?5/12:.5),.2,.8),f=l?"below"===e?{gridTemplateColumns:`${p}px minmax(0,1fr)`,gridTemplateRows:`minmax(0,${h}fr) minmax(0,${1-h}fr)`}:{gridTemplateColumns:`${p}px minmax(0,${h}fr) minmax(0,${1-h}fr)`}:void 0,x=()=>o.current?.getBoundingClientRect(),y=(0,t.useCallback)(e=>{let t=x();t&&u({panel:n(e-t.left,180,Math.min(480,.4*t.width))})},[u]),v=(0,t.useCallback)((t,s)=>{let r=x();r&&("below"===e?u({below:n((s-r.top)/r.height,.2,.8)}):u({beside:n((t-r.left-p)/Math.max(1,r.width-p),.2,.8)}))},[u,e,p]);return{wide:l,gridRef:o,gridStyle:f,panelWidth:l?m:void 0,panel:{value:m/480*100,onMove:e=>y(e),onStep:(e,t)=>u({panel:n(m+16*e*(t?4:1),180,480)}),onReset:()=>u({panel:null}),style:{left:`${p}px`}},split:{value:100*h,onMove:v,onStep:(t,s)=>u("below"===e?{below:n(h+.02*t*(s?5:1),.2,.8)}:{beside:n(h+.02*t*(s?5:1),.2,.8)}),onReset:()=>u("below"===e?{below:null}:{beside:null}),style:"below"===e?{top:`${100*h}%`,left:`${p}px`,right:0}:{left:`calc(${p}px + (100% - ${p}px) * ${h})`,top:0,bottom:0}}}}])},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:l,children:i}){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)||l()},t=e=>{if("Escape"===e.key)e.stopPropagation(),l();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",l),window.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",l),window.removeEventListener("keydown",t,!0)}},[l]),"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:i}),document.body)},"MenuItem",0,function({icon:e,label:s,hint:n,onSelect:r,danger:a=!1,disabled:l=!1}){return(0,t.jsxs)("button",{type:"button",role:"menuitem",disabled:l,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,l=[],i=[],o=0;for(let[c,d]of Object.entries(e)){let e=a.encode(c),u="string"==typeof d?a.encode(d):d,m=function(e){let s=0xffffffff;for(let n of e)s=t[(s^n)&255]^s>>>8;return(0xffffffff^s)>>>0}(u),p=r([n(0x4034b50),s(20),s(0),s(0),s(0),s(0),n(m),n(u.length),n(u.length),s(e.length),s(0),e,u]),h=r([n(0x2014b50),s(20),s(20),s(0),s(0),s(0),s(0),n(m),n(u.length),n(u.length),s(e.length),s(0),s(0),s(0),s(0),n(0),n(o),e]);l.push(p),i.push(h),o+=p.length}let c=r(i),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)]),u=r([...l,c,d]);return new Blob([u.buffer.slice(u.byteOffset,u.byteOffset+u.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,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)},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}])}]);
@@ -0,0 +1,2 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,6980,e=>{"use strict";var t=e.i(14368);e.i(24856);var s=e.i(90870),n=e.i(2385),a=e.i(36163),r=e.i(78451),l=e.i(90139),i=e.i(95486),o=e.i(1245),c=e.i(33577),d=e.i(89932),u=e.i(85905),m=e.i(47677),h=e.i(20621),p=e.i(91694),x=e.i(30197),f=e.i(27813),b=e.i(99522);let y=(0,b.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),g=(0,b.default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);var v=e.i(3792),k=e.i(5769),w=e.i(71189);let j=(0,b.default)("rows-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);var N=e.i(95927),S=e.i(50962),E=e.i(66478);let C=(0,b.default)("square-x",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var R=e.i(10281),q=e.i(87283),$=e.i(99181),M=e.i(63343),O=e.i(44794),T=e.i(31753),P=e.i(29724),L=e.i(60566),A=e.i(39170),I=e.i(13318),U=e.i(68228),F=e.i(59100);let D=(0,b.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var z=e.i(80707),_=e.i(56396);e.i(42674);var V=e.i(5305),J=e.i(6278);let K="\0new";function H(e,t){if(!t.has("baseUrl"))return"baseUrl";let s="api";try{s=new URL(e).hostname.split(".")[0].replace(/[^A-Za-z0-9]/g,"")||"api"}catch{}let n=`${s}Url`;for(let e=2;t.has(n);e++)n=`${s}Url${e}`;return n}function B({draft:e,sent:s,onChange:n}){let{environments:a,activeEnv:r,vars:l}=(0,J.useWorkspace)(),[i,o]=(0,$.useState)(!1),c=function(e){try{let t=new URL(e);if(!/^https?:$/.test(t.protocol)||["localhost","127.0.0.1"].includes(t.hostname))return[];let s=t.origin,n=t.pathname.split("/").filter(Boolean);return n.length>=2?[s,`${s}/${n[0]}`]:[s]}catch{return[]}}(e.url),d=new Set(Object.values(l).map(e=>e.trim().replace(/\/+$/,"")));return!s||!c.length||c.some(e=>d.has(e))?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>o(!0),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-accent hover:underline",title:"Keep this server address in an environment",children:[(0,t.jsx)(D,{size:13,"aria-hidden":!0})," Save ",c[0].replace(/^https?:\/\//,"")," as a base URL"]}),i?(0,t.jsx)(W,{draft:e,addresses:c,environments:a,activeEnvId:r?.id??null,onChange:n,onClose:()=>o(!1)}):null]})}function W({draft:e,addresses:s,environments:n,activeEnvId:a,onChange:r,onClose:l}){let i=(0,_.useToast)(),{index:o,saveEnvironments:c,setActiveEnv:d,refresh:u}=(0,J.useWorkspace)(),[m,h]=(0,$.useState)(s[0]),[p,x]=(0,$.useState)(a??n[0]?.id??K),[f,b]=(0,$.useState)(()=>{try{return new URL(s[0]).hostname.split(".").slice(0,2).join(" ")}catch{return"My API"}}),y=n.find(e=>e.id===p)??null,g=(0,$.useMemo)(()=>new Set((y?.variables??[]).map(e=>e.key)),[y]),[v,k]=(0,$.useState)(()=>H(s[0],g)),[w,j]=(0,$.useState)(!0),[N,S]=(0,$.useState)(!1),E=(0,$.useRef)(null);(0,$.useEffect)(()=>E.current?.focus(),[]),(0,$.useEffect)(()=>k(H(m,g)),[m,g]);let C=(o?.requests??[]).filter(t=>t.url.startsWith(m)&&t.url!==e.url),R=y?.variables.find(e=>e.key===v),M=F.VARIABLE_NAME.test(v)&&(p!==K||f.trim());async function O(){if(M&&!N){S(!0);try{let t=p===K?globalThis.crypto?.randomUUID?.()??`env-${Date.now().toString(36)}`:p,s=structuredClone(n),a=s.find(e=>e.id===t);a||(a={id:t,name:f.trim(),variables:[]},s.push(a)),a.variables=[...a.variables.filter(e=>e.key!==v),{key:v,value:m,secret:!1}],await c(s),d(t),r((0,V.withUrl)(e,`{{${v}}}${e.url.slice(m.length)}`));let o=0,h=0;if(w){for(let e of C){let t=await J.workspaceApi.get(e.id).catch(()=>null);if(!t||t.secretsMissing?.length){h++;continue}let s=(0,V.requestFromUnknown)(t.request);s.url.startsWith(m)&&(await J.workspaceApi.update(e.id,{name:t.name,collection:t.collection,request:(0,V.withUrl)(s,`{{${v}}}${s.url.slice(m.length)}`)}),o++)}await u()}i(`Saved {{${v}}} in ${a.name}.${o?` ${o} other saved request${1===o?"":"s"} now use it.`:""}${h?` ${h} left as they were (a saved secret isn't available).`:""} Save this request to keep the change.`,"success"),l()}catch(e){i(e instanceof Error?e.message:"Could not save the base URL","error")}finally{S(!1)}}}return(0,t.jsx)("div",{className:"fixed inset-0 z-[75] flex items-center-safe justify-center overflow-y-auto bg-black/50 p-4 sm:p-16",role:"presentation",onMouseDown:e=>e.target===e.currentTarget&&!N&&l(),children:(0,t.jsxs)("form",{role:"dialog","aria-modal":"true","aria-labelledby":"save-base-title",onSubmit:e=>{e.preventDefault(),O()},onKeyDown:e=>"Escape"===e.key&&!N&&l(),className:"w-full max-w-lg space-y-4 rounded-xl border border-line bg-panel p-5 shadow-2xl",children:[(0,t.jsxs)("header",{className:"flex items-center gap-2",children:[(0,t.jsx)("h2",{id:"save-base-title",className:"text-base font-medium text-ink",children:"Save as a base URL"}),(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":"Close",className:"ml-auto rounded p-1 text-mute hover:text-ink",children:(0,t.jsx)(q.X,{size:16})})]}),(0,t.jsx)("p",{className:"text-sm text-mute",children:"Keep the server address in an environment, so you type only the path — and switch servers (UAT, Prod) by switching environments."}),(0,t.jsxs)("fieldset",{className:"space-y-1.5",children:[(0,t.jsx)("legend",{className:"mb-1 text-xs text-mute",children:"Address"}),s.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"radio",name:"address",checked:m===e,onChange:()=>h(e)}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e})]},e))]}),(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,t.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-mute",children:["Environment",(0,t.jsx)(z.Select,{label:"Environment",value:p,onChange:x,options:[...n.map(e=>({value:e.id,label:e.name,hint:`${e.variables.length} variables`})),{value:K,label:"New environment…"}],className:"rounded-md border border-line bg-panel-2 px-2 py-1.5 text-sm text-ink"})]}),(0,t.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-mute",children:["Variable name",(0,t.jsx)("input",{ref:E,value:v,onChange:e=>k(e.target.value.replace(/[^\w.-]/g,"")),className:"input py-1.5 font-mono text-sm"})]}),p===K?(0,t.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-mute sm:col-span-2",children:["New environment name",(0,t.jsx)("input",{value:f,onChange:e=>b(e.target.value),className:"input py-1.5 text-sm"})]}):null]}),R&&R.value!==m?(0,t.jsxs)("p",{className:"text-xs text-warn",children:[`{{${v}}}`," already exists in this environment (",R.value,") — it will be replaced."]}):null,(0,t.jsxs)("p",{className:"rounded-md bg-panel-2 px-3 py-2 font-mono text-xs text-ink break-all",children:[`{{${v}}}`,(0,t.jsx)("span",{className:"text-mute",children:e.url.slice(m.length)||"/"})]}),C.length?(0,t.jsxs)("label",{className:"flex items-start gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:w,onChange:e=>j(e.target.checked),className:"mt-1"}),(0,t.jsxs)("span",{children:["Also switch ",C.length," other saved request",1===C.length?"":"s"," that use this address",(0,t.jsxs)("span",{className:"block text-xs text-mute",children:[C.slice(0,3).map(e=>e.name).join(", "),C.length>3?` and ${C.length-3} more`:""]})]})]}):null,(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:l,disabled:N,children:"Cancel"}),(0,t.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:!M||N,children:"Save base URL"})]})]})})}var Q=e.i(65638),X=e.i(37837),Y=e.i(17847);function G(e,t){let s=(0,$.useRef)(!0);(0,$.useEffect)(()=>{if(s.current){s.current=!1;return}let t=e.current;!t||function(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}()||"function"!=typeof t.animate||t.animate([{opacity:.35,transform:"translateY(3px)"},{opacity:1,transform:"none"}],{duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)"})},[e,t])}var Z=e.i(97716);let ee=(e,t)=>"number"==typeof t?`${e}[${t}]`:/^[A-Za-z_$][\w$]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`;var et=e.i(96659),es=e.i(19656);function en({requestId:e,refreshKey:s,onOpen:n}){let a=(0,$.useRef)(null),[r,l]=(0,$.useState)(!1),[i,o]=(0,$.useState)([]),c=()=>void fetch(`/engine/responses/${e}`,{cache:"no-store"}).then(e=>e.ok?e.json():{answers:[]}).then(e=>o(e.answers)).catch(()=>void 0);return((0,$.useEffect)(c,[e,s]),i.length<2)?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:a,type:"button",onClick:()=>l(e=>!e),"aria-expanded":r,title:"Earlier answers of this request — open one, or see what changed",className:"inline-flex items-center gap-1 rounded-md border border-line px-2 py-0.5 text-xs text-mute hover:border-accent hover:text-ink",children:[(0,t.jsx)(p.History,{size:12,"aria-hidden":!0})," Earlier · ",i.length-1]}),(0,t.jsx)(X.Popover,{anchor:a,open:r,onClose:()=>l(!1),label:"Earlier answers",width:340,children:(0,t.jsxs)("div",{className:"max-h-80 overflow-auto p-1",children:[(0,t.jsxs)("p",{className:"px-2 py-1.5 text-xs text-mute",children:["The last ",i.length," answers of this request, newest first · ",(0,es.formatBytes)(i.reduce((e,t)=>e+t.size,0))," kept"]}),(0,t.jsx)("ul",{children:i.map((s,a)=>{let r;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:async()=>{let t=await fetch(`/engine/responses/${e}/${a}`,{cache:"no-store"});t.ok&&n(await t.json(),a),l(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-panel-2",children:[(0,t.jsx)("span",{className:`rounded border px-1.5 font-mono ${(0,L.statusTone)(s.status)}`,children:s.status||"ERR"}),(0,t.jsx)("span",{className:"text-ink",children:0===a?"Latest":(r=new Date(s.at),new Date().toDateString()===r.toDateString()?r.toLocaleTimeString():r.toLocaleString())}),(0,t.jsxs)("span",{className:"ml-auto font-mono text-mute",children:[Math.round(s.durationMs)," ms"]}),(0,t.jsx)("span",{className:"w-16 text-right font-mono text-mute",children:(0,es.formatBytes)(s.size)}),s.checks?(0,t.jsxs)("span",{className:s.passed===s.checks?"text-ok":"text-bad",children:[s.passed,"/",s.checks]}):null]})},s.at)})}),(0,t.jsxs)("button",{type:"button",onClick:async()=>{await fetch(`/engine/responses/${e}`,{method:"DELETE"}),l(!1),c()},className:"mt-1 flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-xs text-mute hover:bg-panel-2 hover:text-bad",children:[(0,t.jsx)(et.Trash2,{size:12,"aria-hidden":!0})," Forget these answers"]})]})})]})}function ea(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}let er=e=>{let t="string"==typeof e?JSON.stringify(e):JSON.stringify(e)??"undefined";return t.length>80?`${t.slice(0,79)}…`:t};function el({earlier:e,latest:s}){let n=(0,$.useMemo)(()=>(function(e,t,s=200){let n,a;try{n=JSON.parse(e),a=JSON.parse(t)}catch{return null}let r=[],l=(e,t,n,a)=>{if(r.length>=s)return;let i=null!==t&&"object"==typeof t;if(null!==e&&"object"==typeof e&&i&&Array.isArray(e)===Array.isArray(t)&&a<40){if(Array.isArray(e)&&Array.isArray(t)){for(let i=0;i<Math.max(e.length,t.length)&&(i>=e.length?r.push({path:ee(n,i),kind:"added",after:t[i]}):i>=t.length?r.push({path:ee(n,i),kind:"removed",before:e[i]}):l(e[i],t[i],ee(n,i),a+1),!(r.length>=s));i++);return}for(let i of new Set([...Object.keys(e),...Object.keys(t)]))if(i in t?i in e?l(e[i],t[i],ee(n,i),a+1):r.push({path:ee(n,i),kind:"added",after:t[i]}):r.push({path:ee(n,i),kind:"removed",before:e[i]}),r.length>=s)break;return}JSON.stringify(e)!==JSON.stringify(t)&&r.push({path:n,kind:"changed",before:e,after:t})};return l(n,a,"$",0),r})(e.body,s.body),[e.body,s.body]),a=(0,$.useMemo)(()=>(function(e,t,s=3e3){let n=e.split("\n"),a=t.split("\n"),r=n.length>s||a.length>s;n=n.slice(0,s),a=a.slice(0,s);let l=0;for(;l<n.length&&l<a.length&&n[l]===a[l];)l++;let i=n.length,o=a.length;for(;i>l&&o>l&&n[i-1]===a[o-1];)i--,o--;let c=n.slice(l,i),d=a.slice(l,o),u=n.slice(0,l).map(e=>({kind:"same",text:e}));if(c.length*d.length>4e6)u.push(...c.map(e=>({kind:"removed",text:e})),...d.map(e=>({kind:"added",text:e})));else{let e=d.length+1,t=new Uint32Array((c.length+1)*e);for(let s=c.length-1;s>=0;s--)for(let n=d.length-1;n>=0;n--)t[s*e+n]=c[s]===d[n]?t[(s+1)*e+n+1]+1:Math.max(t[(s+1)*e+n],t[s*e+n+1]);let s=0,n=0;for(;s<c.length&&n<d.length;)c[s]===d[n]?(u.push({kind:"same",text:c[s]}),s++,n++):t[(s+1)*e+n]>=t[s*e+n+1]?u.push({kind:"removed",text:c[s++]}):u.push({kind:"added",text:d[n++]});for(;s<c.length;)u.push({kind:"removed",text:c[s++]});for(;n<d.length;)u.push({kind:"added",text:d[n++]})}return u.push(...n.slice(i).map(e=>({kind:"same",text:e}))),{lines:u,cut:r}})(ea(e.body),ea(s.body)),[e.body,s.body]),r=a.lines.filter(e=>"same"!==e.kind).length;return(0,t.jsxs)("div",{className:"space-y-3 overflow-auto",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-mute",children:[(0,t.jsxs)("span",{children:["Status ",(0,t.jsx)("span",{className:"font-mono text-ink",children:e.status})," → ",(0,t.jsx)("span",{className:"font-mono text-ink",children:s.status}),e.status===s.status?" (same)":""]}),(0,t.jsxs)("span",{children:["Time ",(0,t.jsxs)("span",{className:"font-mono text-ink",children:[Math.round(e.durationMs)," ms"]})," → ",(0,t.jsxs)("span",{className:"font-mono text-ink",children:[Math.round(s.durationMs)," ms"]})]}),(0,t.jsx)("span",{children:r?`${r} line${1===r?"":"s"} differ`:"The body is the same"})]}),e.masked?(0,t.jsx)("p",{className:"text-xs text-mute",children:"Values that look like secrets were hidden when the earlier answer was kept, so they show as changed."}):null,n&&n.length?(0,t.jsxs)("section",{"aria-label":"Changed fields",children:[(0,t.jsxs)("h3",{className:"mb-1 text-xs font-medium text-mute",children:[n.length," field",1===n.length?"":"s"," changed",n.length>=200?" (the first 200)":""]}),(0,t.jsx)("ul",{className:"max-h-56 space-y-0.5 overflow-auto rounded-md border border-line bg-panel-2 p-2 font-mono text-xs",children:n.map((e,s)=>(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"text-ink",children:e.path})," ","changed"===e.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-bad line-through decoration-bad/60",children:er(e.before)})," → ",(0,t.jsx)("span",{className:"text-ok",children:er(e.after)})]}):"added"===e.kind?(0,t.jsxs)("span",{className:"text-ok",children:["added ",er(e.after)]}):(0,t.jsxs)("span",{className:"text-bad",children:["removed (was ",er(e.before),")"]})]},s))})]}):null,(0,t.jsxs)("section",{"aria-label":"Line by line",children:[(0,t.jsxs)("h3",{className:"mb-1 text-xs font-medium text-mute",children:["Line by line",a.cut?" (the first 3,000 lines)":""]}),(0,t.jsx)("pre",{className:"max-h-[28rem] overflow-auto rounded-md border border-line bg-panel-2 py-2 font-mono text-[12.5px] leading-5",children:a.lines.map((e,s)=>(0,t.jsxs)("div",{className:"added"===e.kind?"bg-ok/10 text-ok":"removed"===e.kind?"bg-bad/10 text-bad":"text-ink",children:[(0,t.jsx)("span",{className:"inline-block w-5 select-none text-center text-mute",children:"added"===e.kind?"+":"removed"===e.kind?"−":" "}),e.text]},s))})]})]})}var ei=e.i(21206),eo=e.i(20054);let ec="apitestcenter-lab-draft";var ed=e.i(59180),eu=e.i(88153),em=e.i(2603),eh=e.i(28950),ep=e.i(99822),ex=e.i(62766),ef=e.i(32610),eb=e.i(14865),ey=e.i(46679),eg=e.i(65238),ev=e.i(7149),ek=e.i(727),ew=e.i(45672),ej=e.i(69578),eN=e.i(17118),eS=e.i(40945),eE=e.i(27122);function eC({steps:e,startedAt:s,onCancel:n}){let[a,r]=(0,$.useState)(()=>Date.now()),[l]=(0,$.useState)(()=>new Map);for(let t of e)"start"!==t.state||l.has(t.id)||l.set(t.id,Date.now());(0,$.useEffect)(()=>{let e=window.setInterval(()=>r(Date.now()),100);return()=>window.clearInterval(e)},[]);let i=e=>e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`;return a-s<250?(0,t.jsx)("div",{className:"flex-1","aria-busy":"true"}):(0,t.jsxs)("div",{role:"status","aria-label":"Sending",className:"flex flex-1 flex-col items-center justify-center gap-5 py-10",children:[(0,t.jsxs)("ul",{className:"w-full max-w-md space-y-2",children:[e.map(e=>(0,t.jsxs)("li",{className:"flex items-center gap-2.5 text-sm",children:["done"===e.state?(0,t.jsx)(eN.CheckCircle2,{size:16,className:"shrink-0 text-ok","aria-label":"done"}):"failed"===e.state?(0,t.jsx)(eE.XCircle,{size:16,className:"shrink-0 text-bad","aria-label":"failed"}):(0,t.jsx)(f.Loader2,{size:16,className:"shrink-0 animate-spin text-accent","aria-label":"running"}),(0,t.jsx)("span",{className:`min-w-0 flex-1 truncate ${"start"===e.state?"text-ink":"text-mute"}`,children:e.label}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-mute",children:void 0!==e.ms?i(e.ms):i(a-(l.get(e.id)??a))})]},e.id)),e.every(e=>"start"!==e.state)?(0,t.jsxs)("li",{className:"flex items-center gap-2.5 text-sm text-mute",children:[(0,t.jsx)(eS.Circle,{size:16,className:"shrink-0","aria-hidden":!0}),(0,t.jsx)("span",{className:"flex-1",children:"Starting…"})]}):null]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:n,children:"Cancel"}),(0,t.jsxs)("span",{className:"font-mono text-xs text-mute",children:[i(a-s)," in all"]})]})]})}var eR=e.i(48181),eq=e.i(25120),e$=e.i(97942),eM=e.i(91549);let eO=(0,eq.projectKey)("apitestcenter-lab-saved"),eT="apitestcenter-requests-panel",eP="lab:answers",eL=(0,eq.projectKey)("apitestcenter-lab-tabs"),eA=()=>Math.random().toString(36).slice(2,10),eI=JSON.stringify((0,V.defaultRequestDraft)()),eU=()=>({key:eA(),draft:(0,V.defaultRequestDraft)(),saved:null,result:null,liveId:null,liveOpen:!1}),eF=e=>e.saved?.name??(e.draft.url.trim()?(0,V.autoRunName)(e.draft).replace(/ · \d.*$/,"").replace(/^[A-Z]+ /,""):"New request"),eD=e=>e.saved?JSON.stringify(e.draft)!==e.saved.snapshot:JSON.stringify(e.draft)!==eI,ez={GET:"text-ok",POST:"text-warn",PUT:"text-accent",PATCH:"text-accent",DELETE:"text-bad"},e_=(0,eq.projectKey)("apitestcenter-last-run");function eV(e){try{sessionStorage.setItem(e_,e)}catch{}}function eJ(){return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-accent opacity-60"}),(0,t.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-accent"})]}),"Load running"]})}function eK({title:e,lines:s,action:n}){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center rounded-lg border border-dashed border-line px-6 py-14 text-center",children:[(0,t.jsx)("h2",{className:"text-base font-medium text-ink",children:e}),(0,t.jsx)("div",{className:"mt-2 max-w-md space-y-1.5 text-sm text-mute",children:s.map((e,s)=>(0,t.jsx)("p",{children:e},s))}),n?(0,t.jsx)("div",{className:"mt-5",children:n}):null]})}function eH({runs:e,current:s,disabled:a,onPick:r}){let{slo:l}=(0,eu.useSlo)(),[o,c]=(0,$.useState)(!1),d=(0,$.useRef)(null),u=(0,$.useMemo)(()=>e.slice(0,30),[e]);return(0,$.useEffect)(()=>{if(!o)return;let e=e=>{d.current?.contains(e.target)||c(!1)},t=e=>"Escape"===e.key&&c(!1);return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[o]),(0,t.jsxs)("div",{ref:d,className:"relative",children:[(0,t.jsxs)("button",{type:"button",disabled:a,"aria-haspopup":"listbox","aria-expanded":o,onClick:()=>c(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:["Recent runs",u.length?(0,t.jsx)("span",{className:"rounded bg-panel-2 px-1 font-mono text-[10px] text-ink",children:u.length}):null,(0,t.jsx)(i.ChevronDown,{size:12})]}),o?(0,t.jsx)("ul",{role:"listbox","aria-label":"Recent runs",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:u.map(e=>{let a=(0,n.buildVerdictFromInputs)(e.verdict,{slo:l}).overall,i=s?.id===e.id;return(0,t.jsx)("li",{role:"option","aria-selected":i,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{r(e),c(!1)},className:`flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-xs ${i?"bg-accent-dim text-ink":"text-ink hover:bg-panel-2"}`,children:[(0,t.jsxs)("span",{className:"min-w-0 truncate",children:[e.baseline?(0,t.jsx)("span",{className:"mr-1 text-accent",title:"Baseline",children:"◆"}):null,e.name]}),(0,t.jsx)(eB,{level:a})]})},e.id)})}):null]})}function eB({level:e}){let s="pass"===e?"text-ok":"fail"===e?"text-bad":"text-warn";return(0,t.jsxs)("span",{className:`shrink-0 font-mono text-xs uppercase ${s}`,children:[(0,t.jsxs)("span",{"aria-hidden":!0,children:["pass"===e?"✓":"fail"===e?"✕":"!"," "]}),e]})}function eW(){let{slo:e,setSlo:s,ready:n}=(0,eu.useSlo)(),[a,r]=(0,$.useState)(!1),[l,i]=(0,$.useState)(500),[o,c]=(0,$.useState)(0),[d,u]=(0,$.useState)(1),[m,h]=(0,$.useState)(99),[p,x]=(0,$.useState)(!1),f=(0,$.useRef)(!1);function b(e){let t={on:a,p95:l,p99:o,errPct:d,checksPct:m,abort:p,...e};if(r(t.on),i(t.p95),c(t.p99),u(t.errPct),h(t.checksPct),x(t.abort),!t.on||!(t.p95>0)||t.errPct<0)return s(null);s({p95Ms:t.p95,errorRate:t.errPct/100,p99Ms:t.p99>0?t.p99:void 0,checksRate:Math.min(100,Math.max(0,t.checksPct))/100,abortOnFail:t.abort})}(0,$.useEffect)(()=>{n&&!f.current&&(f.current=!0,e&&(r(!0),i(e.p95Ms),c(e.p99Ms??0),u(Number((100*e.errorRate).toFixed(4))),h(null!=e.checksRate?Number((100*e.checksRate).toFixed(2)):99),x(!0===e.abortOnFail)))},[n,e]);let y=(e,s,n,a)=>(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"mb-1 block text-xs text-mute",children:e}),(0,t.jsx)("input",{type:"number",min:a.min,max:a.max,step:a.step,value:s,onChange:e=>b({[n]:Number(e.target.value)}),className:"input font-mono"}),a.hint?(0,t.jsx)("span",{className:"mt-1 block text-xs text-mute",children:a.hint}):null]});return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-mute",children:"Targets decide whether a performance test passes. They are sent to k6 as thresholds, drive the verdict and the report colours, and are remembered on this computer."}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:e=>b({on:e.target.checked}),className:"accent-[var(--accent)]"}),"Use my own performance targets"]}),a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[y("p95 must stay under (ms)",l,"p95",{min:1}),y("p99 must stay under (ms)",o,"p99",{min:0,hint:"0 = no p99 target"}),y("Error rate must stay under (%)",d,"errPct",{min:0,max:100,step:.1}),y("Checks must pass at least (%)",m,"checksPct",{min:0,max:100,step:.1,hint:"Only used when the request has checks"})]}),(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-line px-3 py-2.5 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:p,onChange:e=>b({abort:e.target.checked}),className:"mt-0.5 accent-[var(--accent)]"}),(0,t.jsxs)("span",{children:["Stop the test early if a target is clearly missed",(0,t.jsx)("span",{className:"block text-xs text-mute",children:"After a 10-second warm-up, k6 ends the run as soon as a target fails — saves time and stops hammering a struggling API."})]})]})]}):(0,t.jsx)("p",{className:"rounded-md bg-panel-2 px-3 py-2 text-sm text-mute",children:"Using built-in defaults: warn at p95 ≥ 500 ms or errors ≥ 1%, fail at p95 ≥ 2 s or errors ≥ 5%. No thresholds are sent to k6."})]})}function eQ({dirty:e,isSaved:s,title:n,onSave:a,onSaveAs:r,onHistory:l,onExport:o}){let[c,d]=(0,$.useState)(!1),x=(0,$.useRef)(null);return(0,t.jsxs)("div",{className:"inline-flex",children:[(0,t.jsxs)("button",{type:"button",onClick:a,disabled:s&&!e,title:n,className:"btn btn-secondary rounded-r-none border-r-0",children:[(0,t.jsx)(N.Save,{size:16,"aria-hidden":!0}),"Save",e?(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-label":"unsaved changes"}):null]}),(0,t.jsx)("button",{ref:x,type:"button",onClick:()=>d(e=>!e),"aria-label":"More ways to save","aria-haspopup":"menu","aria-expanded":c,className:"btn btn-secondary rounded-l-none px-2",children:(0,t.jsx)(i.ChevronDown,{size:14,"aria-hidden":!0})}),(0,t.jsx)(X.Popover,{anchor:x,open:c,onClose:()=>d(!1),label:"More ways to save",width:220,role:"menu",children:(0,t.jsxs)("div",{className:"-m-2",children:[(0,t.jsx)(Y.MenuItem,{icon:s?u.CopyPlus:h.FolderOpen,label:s?"Save as a new request…":"Save to a folder…",onSelect:()=>{d(!1),r()}}),l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Y.MenuSeparator,{}),(0,t.jsx)(Y.MenuItem,{icon:p.History,label:"Version history…",onSelect:()=>{d(!1),l()}})]}):null,o?(0,t.jsx)(Y.MenuItem,{icon:m.FileOutput,label:"Export…",onSelect:()=>{d(!1),o()}}):null]})})]})}e.s(["LabPage",0,function(){var e;let i=(0,_.useToast)(),m=(0,A.useConfirm)(),p=(0,eo.useEngineHealth)(),b=(0,em.useModKey)(),{slo:N}=(0,eu.useSlo)(),{vars:F,activeEnv:D,refresh:z,rememberValues:K}=(0,J.useWorkspace)(),[H,W]=(0,$.useState)(null),[X,ee]=(0,$.useState)(!1),[et,es]=(0,$.useState)(!0),ea=(0,$.useRef)(null),[er,eN]=(0,$.useState)(V.defaultRequestDraft),[eS,eE]=(0,$.useState)(V.defaultLoad),[eq,eB]=(0,$.useState)(!1),[eX,eY]=(0,$.useState)(null),[eG,eZ]=(0,$.useState)(null),[e0,e1]=(0,$.useState)(!1),[e2,e5]=(0,$.useState)(null),[e6,e9]=(0,$.useState)(!1),e3=(0,$.useRef)(null),e7=(0,$.useRef)(null);G(e3,H?.id),G(e7,eX);let[e4,e8]=(0,$.useState)(!1),[te,tt]=(0,$.useState)([]),[ts,tn]=(0,$.useState)(0),ta=(0,$.useRef)(null),[tr,tl]=(0,$.useState)(!1),[ti,to]=(0,$.useState)(!1),[tc,td]=(0,$.useState)(null),[tu,tm]=(0,$.useState)(null),{index:th,refresh:tp}=(0,ed.useHistory)(),tx=th?.runs??[],[tf,tb]=(0,$.useState)("response"),[ty,tg]=(0,$.useState)(!1),{layout:tv,setLayout:tk}=(0,eb.useViewPrefs)(),tw="below"===tv,tj=(0,ex.usePaneSizes)(tv,et),[tN,tS]=(0,$.useState)(!1),[tE,tC]=(0,$.useState)([]),[tR,tq]=(0,$.useState)("");(0,ep.useKeepAwake)(e0||tE.some(e=>e.key!==tR&&e.liveOpen),"a live connection is open");let t$=tu?.status==="running"||tu?.status==="queued",tM=(0,V.isReady)(er),tO=(0,V.loadProblem)(eS),tT=e4||tr;(0,$.useEffect)(()=>{let e=null;try{e=sessionStorage.getItem(e_)}catch{}e&&(0,ei.fetchRun)(e).then(async t=>{if(t)return tm(t);let s=await ed.historyApi.run(e).catch(()=>null);s&&tm({id:s.report.id,status:s.report.status,report:s.report})});let t=function(){try{let e=sessionStorage.getItem(ec);if(!e)return null;let t=JSON.parse(e);if(2===t.v)return{request:(0,V.requestFromUnknown)(t.request),load:(0,V.loadFromUnknown)(t.load)};return{request:(0,V.requestFromUnknown)(t),load:(0,V.loadFromUnknown)(t)}}catch{return null}}();t&&eE(t.load);let s=[],n="";try{let e=JSON.parse(localStorage.getItem(eL)??"null"),t=(0,eh.recall)(eP)??{};s=(e?.tabs??[]).map(e=>({key:e.key||eA(),draft:(0,V.requestFromUnknown)(e.draft),saved:e.saved??null,result:t[e.key]??null,liveId:null,liveOpen:!1})),n=e?.active??"",es("closed"!==localStorage.getItem(eT))}catch{}if(!s.length){let e=null;try{e=JSON.parse(sessionStorage.getItem(eO)??"null")}catch{}s=[{...eU(),draft:t?.request??(0,V.defaultRequestDraft)(),saved:e}]}let a=s.find(e=>e.key===n)??s[0];tC(s),tq(a.key),eN(a.draft),W(a.saved),eY(a.result),eB(!0)},[]),(0,$.useEffect)(()=>{if(!eq)return;let e={};for(let t of tE){let s=t.key===tR?eX:t.result;s&&(e[t.key]=s)}(0,eh.remember)(eP,e)},[eq,tE,tR,eX]),(0,$.useEffect)(()=>{if(!eq)return;let e=window.setTimeout(()=>{try{sessionStorage.setItem(ec,JSON.stringify({v:2,request:er,load:eS}))}catch{}try{let e=tE.map(e=>e.key===tR?{key:e.key,draft:er,saved:H}:{key:e.key,draft:e.draft,saved:e.saved});localStorage.setItem(eL,JSON.stringify({tabs:e,active:tR}))}catch{}},250);return()=>window.clearTimeout(e)},[er,eS,eq,tE,tR,H]),(0,$.useEffect)(()=>{if(!tu||!t$)return;let e=!1,t=window.setInterval(async()=>{let t=await (0,ei.fetchRun)(tu.id);if(t&&!e&&(tm(t),(0,ei.isTerminalStatus)(t.status))){tp();let e="completed"===t.status?"finished":t.status;i(`Performance test ${e}`,"failed"===t.status?"error":"success");let s=(0,n.buildVerdict)(t.report,{slo:N});(0,ek.notifyFinished)({title:`Performance test ${e}`,body:`${t.report.testName}
2
+ ${"completed"===t.status?s.headline:t.error??"See the report for details."}`,ok:"completed"===t.status&&"fail"!==s.overall})}},500);return()=>{e=!0,window.clearInterval(t)}},[tu?.id,t$]);let tP=!!H&&JSON.stringify(er)!==H.snapshot;function tL(e){W(e);try{e?sessionStorage.setItem(eO,JSON.stringify(e)):sessionStorage.removeItem(eO)}catch{}}function tA(e){es(e);try{localStorage.setItem(eT,e?"open":"closed")}catch{}}async function tI(e){try{let t={name:e?.name??H.name,collection:e?.collection??H.collection,request:er},s=H&&!e?await J.workspaceApi.update(H.id,t):await J.workspaceApi.create(t);tL({id:s.id,name:s.name,collection:s.collection,snapshot:JSON.stringify(er)}),ee(!1),await z(),i(`Saved “${s.name}”${s.collection?` in ${s.collection}`:""}`,"success")}catch(e){i(e instanceof Error?e.message:"Could not save the request","error")}}let tU=()=>({key:tR,draft:er,saved:H,result:eX,liveId:eG,liveOpen:e0});function tF(e){tq(e.key),eN(e.draft),tL(e.saved),eY(e.result),eZ(e.liveId),e1(e.liveOpen),e5(null),e9(!1),to(!1),td(null),ee(!1),tb("response")}function tD(e){if(e===tR)return;let t=tE.find(t=>t.key===e);t&&(tC(e=>e.map(e=>e.key===tR?tU():e)),tF(t))}function tz(e,t){let s=!H&&!eX&&!eG&&JSON.stringify(er)===eI,n={key:s?tR:eA(),draft:e,saved:t,result:null,liveId:null,liveOpen:!1};tC(e=>{if(s)return e.map(e=>e.key===tR?n:e);let t=e.map(e=>e.key===tR?tU():e),a=t.findIndex(e=>e.key===tR);return[...t.slice(0,a+1),n,...t.slice(a+1)]}),tF(n)}async function t_(e){let t=tE.map(e=>e.key===tR?tU():e),s=t.filter(t=>e.includes(t.key));if(!s.length)return;let n=s.filter(eD);if(n.length){let e=1===s.length;if(!await m({title:e?`Close “${eF(n[0])}” without saving?`:`Close ${s.length} tabs?`,body:e?"Its changes have not been saved.":1===n.length?`“${eF(n[0])}” has changes that are not saved.`:`${n.length} of them have changes that are not saved.`,confirmLabel:"Close",tone:"danger"}))return}for(let e of s)e.liveId&&Z.realtimeApi.close(e.liveId);let a=t.filter(t=>!e.includes(t.key));if(!e.includes(tR))return tC(a);let r=t.findIndex(e=>e.key===tR),l=t.slice(r+1).find(t=>!e.includes(t.key))??t.slice(0,r).reverse().find(t=>!e.includes(t.key))??eU();tC(a.length?a:[l]),tF(l)}let[tV,tJ]=(0,$.useState)(null),[tK,tH]=(0,$.useState)(!1);async function tB(){try{let e=await J.workspaceApi.index(),t=t=>e.requests.find(e=>"Practice"===e.collection&&e.name===t),s=t("Sign in")?.id??(await J.workspaceApi.create({name:"Sign in",collection:"Practice",request:{...(0,V.withUrl)({...(0,V.defaultRequestDraft)(),method:"POST"},"{{practiceApi}}/login"),bodyMode:"json",bodyText:'{\n "username": "you",\n "password": "demo"\n}',checks:[{type:"status",expect:"200"}]}})).id,n=t("My orders"),a=n?await J.workspaceApi.get(n.id):await J.workspaceApi.create({name:"My orders",collection:"Practice",request:{...(0,V.withUrl)((0,V.defaultRequestDraft)(),"{{practiceApi}}/orders"),authMode:"bearer",token:"{{token}}",checks:[{type:"status",expect:"200"}],before:{requestId:s,requestName:"Sign in",extract:[{name:"token",from:"json",path:"data.token"}]}}});await z(),tA(!0),await tW(a),i("Added Practice → Sign in and My orders. Press Send: it signs in first, then uses the token.","success")}catch(e){i(e instanceof Error?e.message:"Could not add the practice requests","error")}}function tW(e){if(H?.id===e.id)return;let t=tE.find(t=>t.key!==tR&&t.saved?.id===e.id);if(t)return tD(t.key);let s=(0,V.requestFromUnknown)(e.request);tz(s,{id:e.id,name:e.name,collection:e.collection,snapshot:JSON.stringify(s)})}(0,$.useEffect)(()=>{let e=()=>tH(!(0,ew.welcomeHidden)());return e(),window.addEventListener(ew.WELCOME_EVENT,e),()=>window.removeEventListener(ew.WELCOME_EVENT,e)},[]);let tQ=(0,$.useRef)(()=>{});tQ.current=e=>{let t=(0,V.requestFromUnknown)(e.request),s={id:e.id,name:e.name,collection:e.collection,snapshot:JSON.stringify(t)};H?.id===e.id?(eN(t),tL(s)):tC(n=>n.map(n=>n.saved?.id===e.id?{...n,draft:t,saved:s}:n))},(0,$.useEffect)(()=>{let e=e=>tQ.current(e.detail);return window.addEventListener(e$.REQUEST_REPLACED_EVENT,e),()=>window.removeEventListener(e$.REQUEST_REPLACED_EVENT,e)},[]),(0,$.useEffect)(()=>{let e=e=>{let t=e.detail;W(e=>e?.id===t.id?{...e,name:t.name,collection:t.collection}:e),tC(e=>e.map(e=>e.saved?.id===t.id?{...e,saved:{...e.saved,name:t.name,collection:t.collection}}:e))};return window.addEventListener(Q.REQUEST_MOVED_EVENT,e),()=>window.removeEventListener(Q.REQUEST_MOVED_EVENT,e)},[]);let tX=(0,$.useRef)(tW);tX.current=tW;let tY=(0,$.useRef)(tz);function tG(){tz((0,V.defaultRequestDraft)(),null),window.setTimeout(()=>ea.current?.focus(),0)}async function tZ(){try{td(null);let e=await (0,eg.withFolders)(er,H?.collection,F),t=(0,V.resolveDraft)(e.draft,e.vars,D?.name),s=/^wss?:\/\//i.test(t.url),n=s?(0,V.withUrl)(t,t.url.replace(/^ws/i,"http")):t,a=(0,V.buildPayload)(n,(0,V.toLoadConfig)(eS),(0,V.autoRunName)(n,H?.name),(0,V.targetsFromSlo)(N));return e.contract&&!s&&(a.contract=e.contract),s&&(a.request={...a.request,url:a.request.url.replace(/^http/i,"ws")}),await (0,ey.withRunFirst)(a,t,F,D?.name)}catch(e){return td(e instanceof Error?e.message:"Request is not valid"),null}}async function t0(){try{let e={...er,method:"POST",bodyMode:"graphql",graphqlQuery:s.INTROSPECTION_QUERY,graphqlVariables:"",graphqlOperation:"IntrospectionQuery",graphqlErrorsFail:!1,checks:[],saveValues:[],testData:null},t=await (0,eg.withFolders)(e,H?.collection,F),n=(0,V.resolveDraft)(t.draft,t.vars,D?.name),{request:a,auth:r,options:l,setup:i}=await (0,ey.withRunFirst)((0,V.buildPayload)(n,(0,V.toLoadConfig)(eS),"schema"),n,F,D?.name),o=await fetch("/engine/graphql/introspect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({request:a,auth:r,options:l,setup:i})}),c=await o.json();return o.ok?c:{status:0,body:"",error:c.error??`Engine error (${o.status})`}}catch(e){return{status:0,body:"",error:e instanceof Error?e.message:String(e)}}}tY.current=tz,(0,$.useEffect)(()=>{let e=()=>{let e=null;try{e=sessionStorage.getItem(ej.OPEN_REQUEST_KEY),sessionStorage.removeItem(ej.OPEN_REQUEST_KEY)}catch{}e&&J.workspaceApi.get(e).then(e=>tX.current(e)).catch(()=>i("That saved request is gone","error"));let t=null;try{t=sessionStorage.getItem(ej.OPEN_DRAFT_KEY),sessionStorage.removeItem(ej.OPEN_DRAFT_KEY)}catch{}if(t)try{let e=JSON.parse(t);tY.current((0,V.withUrl)((0,V.requestFromUnknown)(e),e.url??""),null)}catch{}};return eq&&e(),window.addEventListener(ej.OPEN_REQUEST_EVENT,e),()=>window.removeEventListener(ej.OPEN_REQUEST_EVENT,e)},[eq]);let[t1,t2]=(0,$.useState)(0);async function t5(){if(tT||!tM)return;let e=performance.now(),s=await tZ(),n=Math.round(performance.now()-e);if(!s)return;if(/^wss?:\/\//i.test(s.request.url)){if(eG&&e0)return void await Z.realtimeApi.close(eG);e8(!0),tb("response");try{eG&&Z.realtimeApi.close(eG);let{id:e}=await Z.realtimeApi.connect({request:s.request,auth:s.auth,options:s.options});eY(null),eZ(e),e1(!0)}catch(e){td(e instanceof Error?e.message:"Could not connect")}finally{e8(!1)}return}if("production"===(0,eR.envKind)(D)&&!(0,eR.isReadOnlyMethod)(s.request.method)&&!await m({title:`Send ${s.request.method} to ${D.name}?`,body:(0,t.jsxs)(t.Fragment,{children:["This request can change real data on ",(0,ei.hostOf)(s.request.url),"."]}),confirmLabel:`Send to ${D.name}`,tone:"danger"}))return;e8(!0),to(!1),tb("response");let a=new AbortController;ta.current=a,tn(Date.now()),tt([{id:"prepare",label:"Prepared: folders, connection, variables",state:"done",ms:n}]);try{eZ(null);let e=await (0,ei.sendRequest)(s,H?.id,{signal:a.signal,onStep:e=>tt(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e])});e5(null),e9(!1),eY(e);let t=(e.saved??[]).flatMap(e=>e.found&&void 0!==e.value?[{name:e.name,value:e.value}]:[]);K(t,H?.name??"the last Send")}finally{e8(!1),ta.current=null}}async function t6(e=!1){if(tT||t$||!tM||!p.k6Ready)return;if(tO)return void td(tO);let s=await tZ();if(s){if(to(!1),!e){tl(!0);try{let e=await (0,ei.sendRequest)(s);if(eY(e),!(0,ei.isSuccess)(e)){to(!0),tb("response");return}}finally{tl(!1)}}if("production"===(0,eR.envKind)(D)){if(!await m({title:`Performance test ${D.name}?`,body:(0,t.jsxs)(t.Fragment,{children:["A performance test sends many requests at once to ",(0,ei.hostOf)(s.request.url),". Real users of that system may notice."]}),confirmLabel:"Start performance test",tone:"danger"}))return}else if((0,ei.needsLoadConfirm)(eS.preset,s.load,s.request.url)&&!await m({title:`Start a ${(0,M.profileSummary)(eS)} performance test against ${(0,ei.hostOf)(s.request.url)}?`,body:(0,t.jsxs)(t.Fragment,{children:["This is a ",(0,t.jsx)("span",{className:"text-ink",children:eS.preset})," profile against a non-local host (",(0,M.profileSummary)(eS),"). 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 performance test",tone:"danger"}))return;try{let e=await (0,ei.startLoadRun)(s);eV(e.id),tm(e),tb("report")}catch(e){i(e instanceof Error?e.message:"Failed to start load","error")}}}async function t9(){if(!tu)return;let e=await (0,ei.stopLoadRun)(tu.id);e?tm(e):i("Could not reach the engine to stop the run","error")}(0,$.useEffect)(()=>{t1&&t5()},[t1]),(0,em.useShortcuts)({send:()=>void t5(),run:()=>void t6(),focusUrl:()=>ea.current?.focus(),save:()=>H?void tI():ee(!0),toggleSaved:()=>tA(!et)});let t3=/^wss?:\/\//i.test((0,r.substitute)(er.url,F).text),t7=t3?"Performance tests of WebSockets aren't available yet — Connect to try it":p.k6Ready?tM?tO??void 0:"Enter a URL first":p.k6Label,t4=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","data-tour":"send",onClick:()=>void t5(),disabled:tT||!tM,title:t3?e0?"Close the connection":`Open the WebSocket (${b}+Enter)`:`Send one request (${b}+Enter)`,className:t3&&e0?"btn btn-secondary":"btn btn-primary",children:[e4?(0,t.jsx)(f.Loader2,{size:16,className:"animate-spin"}):t3?e0?(0,t.jsx)(R.Unplug,{size:16}):(0,t.jsx)(k.Plug,{size:16}):(0,t.jsx)(S.Send,{size:16}),t3?e0?"Disconnect":"Connect":"Send"]}),t$?(0,t.jsxs)("button",{type:"button",onClick:()=>void t9(),disabled:tu?.stopping,className:"btn btn-danger",children:[tu?.stopping?(0,t.jsx)(f.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(E.Square,{size:16}),tu?.stopping?"Stopping…":"Stop"]}):(0,t.jsxs)("button",{type:"button","data-tour":"run",onClick:()=>void t6(),disabled:tT||!!t7,title:t7??`Check the request, then run the load profile (${b}+Shift+Enter)`,className:"btn btn-secondary",children:[tr?(0,t.jsx)(f.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(v.Play,{size:16}),tr?"Checking…":"Run performance test"]}),(0,t.jsx)(eQ,{dirty:H?tP:JSON.stringify(er)!==eI,isSaved:!!H,onHistory:H?()=>(0,e$.openVersions)(H.id):void 0,onExport:H?()=>(0,eM.openExport)({kind:"request",id:H.id,name:H.name,collection:H.collection}):void 0,title:`Save request (${b}+S)`,onSave:()=>H?void tI():ee(!0),onSaveAs:()=>ee(!0)})]}),t8=tE.map(e=>e.key===tR?tU():e);return(0,t.jsx)(ev.VariableScope,{collection:H?.collection,url:er.url,children:(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[t8.length?(0,t.jsxs)("div",{className:"flex shrink-0 items-stretch border-b border-line bg-canvas",children:[(0,t.jsx)("button",{type:"button",onClick:()=>tA(!et),"aria-label":et?`Hide saved requests (${b}+B)`:`Show saved requests (${b}+B)`,"aria-pressed":et,title:et?`Hide saved requests (${b}+B)`:`Show saved requests (${b}+B)`,className:`hidden shrink-0 items-center border-r border-line px-3 hover:bg-panel/60 hover:text-ink lg:flex ${et?"text-ink":"text-mute"}`,children:(0,t.jsx)(h.FolderOpen,{size:15,"aria-hidden":!0})}),(0,t.jsx)("div",{role:"tablist","aria-label":"Open requests",className:"flex min-w-0 items-stretch overflow-x-auto",children:t8.map(e=>{let s=e.key===tR,n=eF(e);return(0,t.jsxs)("div",{onContextMenu:t=>{t.preventDefault();let s=Number(document.documentElement.style.zoom)||1;tJ({key:e.key,x:t.clientX/s,y:t.clientY/s})},onMouseDown:t=>{1===t.button&&(t.preventDefault(),t_([e.key]))},className:`flex max-w-60 min-w-0 shrink-0 items-center border-r border-line ${s?"bg-panel shadow-[inset_0_2px_0_var(--accent)]":"hover:bg-panel/60"}`,children:[(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":s,onClick:()=>tD(e.key),onKeyDown:t=>{if("ContextMenu"===t.key||t.shiftKey&&"F10"===t.key){t.preventDefault();let s=(0,eb.pageRect)(t.currentTarget);tJ({key:e.key,x:s.left+8,y:s.bottom})}},title:e.saved?.collection?`${e.saved.collection} / ${n}`:n,className:"tab-btn flex min-w-0 items-center gap-2 py-2 pr-1 pl-3 text-sm",children:[(0,t.jsx)("span",{className:`font-mono text-[11px] font-semibold ${ez[e.draft.method]??"text-mute"}`,children:"DELETE"===e.draft.method?"DEL":e.draft.method}),(0,t.jsx)("span",{className:`truncate ${s?"text-ink":"text-mute"}`,children:n})]}),e.saved&&eD(e)?(0,t.jsx)("span",{title:"Not saved","aria-label":"not saved",className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent"}):null,(0,t.jsx)("button",{type:"button",onClick:()=>{t_([e.key])},"aria-label":`Close ${n}`,title:"Close (middle click)",className:"mx-1 shrink-0 rounded p-1 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(q.X,{size:13,"aria-hidden":!0})})]},e.key)})}),tV?(()=>{let e=t8.map(e=>e.key),s=e.indexOf(tV.key),n=t8[s];if(!n)return null;let a=e=>()=>{tJ(null),e()},r=t8.filter(e=>!eD(e)).map(e=>e.key);return(0,t.jsxs)(Y.ContextMenu,{at:tV,label:`Actions for ${eF(n)}`,onClose:()=>tJ(null),children:[(0,t.jsx)(Y.MenuItem,{icon:q.X,label:"Close",hint:"Middle click",onSelect:a(()=>void t_([tV.key]))}),(0,t.jsx)(Y.MenuItem,{icon:C,label:"Close others",disabled:e.length<2,onSelect:a(()=>void t_(e.filter(e=>e!==tV.key)))}),(0,t.jsx)(Y.MenuItem,{icon:l.ArrowRightToLine,label:"Close to the right",disabled:s===e.length-1,onSelect:a(()=>void t_(e.slice(s+1)))}),(0,t.jsx)(Y.MenuItem,{icon:o.CircleCheck,label:"Close unchanged",disabled:!r.length,onSelect:a(()=>void t_(r))}),(0,t.jsx)(Y.MenuItem,{icon:x.ListX,label:"Close all",onSelect:a(()=>void t_(e))}),(0,t.jsx)(Y.MenuSeparator,{}),(0,t.jsx)(Y.MenuItem,{icon:u.CopyPlus,label:"Duplicate",onSelect:a(()=>(function(e){let t=e===tR?tU():tE.find(t=>t.key===e);if(!t)return;let s={key:eA(),draft:structuredClone(t.draft),saved:null,result:null,liveId:null,liveOpen:!1};tC(t=>{let n=t.map(e=>e.key===tR?tU():e),a=n.findIndex(t=>t.key===e);return[...n.slice(0,a+1),s,...n.slice(a+1)]}),tF(s)})(tV.key))}),(0,t.jsx)(Y.MenuItem,{icon:d.Copy,label:"Copy URL",disabled:!n.draft.url.trim(),onSelect:a(()=>void navigator.clipboard.writeText(n.draft.url).then(()=>i("Copied the URL","success"),()=>i("Could not copy","error")))})]})})():null,(0,t.jsx)("button",{type:"button",onClick:()=>tG(),"aria-label":"New request tab",title:"New request",className:"shrink-0 px-3 text-mute hover:bg-panel/60 hover:text-ink",children:(0,t.jsx)(w.Plus,{size:15,"aria-hidden":!0})}),(0,t.jsx)("div",{className:"ml-auto flex shrink-0 items-center px-2",children:(0,t.jsx)(U.EnvironmentBar,{compact:!0,drafts:[er],collections:[H?.collection]})})]}):null,(0,t.jsxs)("header",{className:"border-b border-line bg-panel px-4 py-3 lg:px-6",children:[(0,t.jsx)("h1",{className:"sr-only",children:"Test an API"}),(0,t.jsx)(O.RequestBar,{ref:ea,draft:er,onChange:e=>{eN(e),td(null)},onImported:e=>i(e,"success"),actions:t4}),(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-mute empty:hidden",children:[(0,t.jsx)(B,{draft:er,sent:!!(eX&&eX.status>0),onChange:eN}),X?(0,t.jsx)(Q.SaveRequestForm,{initial:{name:H?.name??(0,V.autoRunName)(er).replace(/ · \d.*$/,""),collection:H?.collection??""},onSave:(e,t)=>void tI({name:e,collection:t}),onCancel:()=>ee(!1)}):null,tc?(0,t.jsx)("span",{className:"text-bad",role:"alert",children:tc}):null]})]}),(0,t.jsxs)("div",{ref:tj.gridRef,style:ty?void 0:tj.gridStyle,className:`relative grid min-h-0 flex-1 overflow-y-auto ${tN?"":"transition-[grid-template-columns] duration-200 ease-out"} motion-reduce:transition-none lg:overflow-hidden ${ty?"":tw?`lg:grid-rows-[minmax(0,1fr)_minmax(0,1fr)] ${et?"lg:grid-cols-[15rem_minmax(0,1fr)] 2xl:grid-cols-[16rem_minmax(0,1fr)]":"lg:grid-cols-[0rem_minmax(0,1fr)]"}`:et?"lg:grid-cols-[15rem_minmax(0,1fr)_minmax(0,1fr)] 2xl:grid-cols-[16rem_minmax(0,5fr)_minmax(0,7fr)]":"lg:grid-cols-[0rem_minmax(0,1fr)_minmax(0,1fr)] 2xl:grid-cols-[0rem_minmax(0,5fr)_minmax(0,7fr)]"}`,children:[ty?null:(0,t.jsx)("div",{inert:!et,"aria-hidden":!et||void 0,className:`min-h-0 min-w-0 overflow-hidden transition-opacity duration-200 motion-reduce:transition-none ${tw?"lg:row-span-2":""} ${et?"opacity-100":"opacity-0 max-lg:hidden"}`,children:(0,t.jsx)("div",{className:"flex h-full w-[15rem] flex-col 2xl:w-[16rem] [&>aside]:flex-1",style:tj.panelWidth?{width:tj.panelWidth}:void 0,children:(0,t.jsx)(Q.RequestsPanel,{activeId:H?.id??null,onOpen:e=>void tW(e),onNew:()=>void tG()})})}),!ty&&et?(0,t.jsx)(ef.Splitter,{orientation:"vertical",label:"Saved requests panel width",value:tj.panel.value,onMove:e=>tj.panel.onMove(e),onStep:tj.panel.onStep,onReset:tj.panel.onReset,onDragging:tS,className:"absolute inset-y-0 -translate-x-1/2",style:tj.panel.style}):null,ty?null:(0,t.jsx)(ef.Splitter,{orientation:tw?"horizontal":"vertical",label:tw?"Request and response heights":"Request and response widths",value:tj.split.value,onMove:tj.split.onMove,onStep:tj.split.onStep,onReset:tj.split.onReset,onDragging:tS,className:tw?"absolute -translate-y-1/2":"absolute -translate-x-1/2",style:tj.split.style}),ty?null:(0,t.jsx)("section",{ref:e3,"aria-label":"Request",className:"min-w-0 px-4 py-4 lg:overflow-y-auto lg:px-6",children:(0,t.jsx)(T.RequestEditor,{id:"lab-request",draft:er,onChange:eN,checkResults:eX?.checks,lastBody:eX?.body,lastResult:eX??void 0,setupResult:eX?.setup,savedResults:eX?.saved,currentId:H?.id,collection:H?.collection,introspect:t0,extraTabs:[{id:"load",label:"Performance",badge:eS.stages?.length?"stages":"rate"===eS.mode?`${eS.rps}/s`:`${eS.vus} users \xb7 ${eS.duration}`,content:(0,t.jsx)(M.LoadEditor,{load:eS,onChange:eE})},{id:"targets",label:"Goals",content:(0,t.jsx)(eW,{})}]})}),(0,t.jsxs)("section",{ref:e7,"aria-label":"Results",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:px-6 ${tw&&!ty?"lg:border-t":"lg:border-l"}`,children:[(0,t.jsx)(I.Tabs,{id:"lab-results",label:"Results",value:tf,onChange:tb,items:[{id:"response",label:"Response",badge:eX?eX.status||"ERR":void 0},{id:"report",label:t$?(0,t.jsx)(eJ,{}):"Performance report"}],trailing:(0,t.jsxs)(t.Fragment,{children:["report"===tf&&tx.length>0?(0,t.jsx)(eH,{runs:tx,current:tu,disabled:t$,onPick:async e=>{try{let t=await ed.historyApi.run(e.id);eV(e.id),tm({id:t.report.id,status:t.report.status,report:t.report})}catch(e){i(e instanceof Error?e.message:"Could not open that run","error")}}}):null,ty?null:(0,t.jsx)("button",{type:"button",onClick:()=>tk(tw?"beside":"below"),"aria-label":tw?"Show the response beside the request":"Show the response below the request",title:tw?"Response beside the request":"Response below the request",className:"hidden rounded p-1.5 text-mute hover:bg-panel-2 hover:text-ink lg:block",children:tw?(0,t.jsx)(c.Columns2,{size:14}):(0,t.jsx)(j,{size:14})}),(0,t.jsx)("button",{type:"button",onClick:()=>tg(e=>!e),"aria-label":ty?"Show the request editor":"Expand results to full width",title:ty?"Show the request editor":"Expand results",className:"hidden rounded p-1.5 text-mute hover:bg-panel-2 hover:text-ink lg:block",children:ty?(0,t.jsx)(g,{size:14}):(0,t.jsx)(y,{size:14})})]})}),(0,t.jsx)("div",{...(0,I.tabPanelProps)("lab-results",tf),className:"flex min-h-0 flex-1 flex-col pt-4",children:"response"===tf?(0,t.jsxs)(t.Fragment,{children:[ti&&eX?(0,t.jsxs)("div",{role:"alert",className:"mb-4 flex flex-wrap items-center gap-3 rounded-md border border-warn/40 bg-warn/10 px-3 py-2.5",children:[(0,t.jsxs)("p",{className:"min-w-0 flex-1 text-sm text-ink",children:[(0,t.jsx)("span",{className:"font-medium text-warn",children:"Performance test not started."})," The check returned"," ",eX.status||"an error",", not 2xx. Fix the request, or run anyway if this status is expected."]}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>void t6(!0),children:"Run anyway"})]}):null,e4&&te.length?(0,t.jsx)(eC,{steps:te,startedAt:ts,onCancel:()=>ta.current?.abort()}):eG&&!eX?(0,t.jsx)(Z.LiveView,{id:eG,onClosed:()=>e1(!1)}):eX&&e2?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-accent/40 bg-accent/10 px-3 py-2 text-xs",children:[(0,t.jsxs)("span",{className:"text-ink",children:[e6?"What changed since":"An earlier answer —"," ",new Date(e2.answer.at).toLocaleString()]}),(0,t.jsxs)("span",{className:"ml-auto flex gap-2",children:[(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>e9(e=>!e),children:e6?"Show that answer":"Compare with the latest"}),(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>e5(null),children:"Back to the latest"})]})]}),e6?(0,t.jsx)(el,{earlier:e2.answer,latest:eX}):(0,t.jsx)(L.ResponseViewer,{result:{ok:(e=e2.answer).status>=200&&e.status<400,status:e.status,statusText:String(e.status),headers:e.headers,body:e.body,truncated:e.truncated,durationMs:e.durationMs,url:e.url,...e.error?{error:e.error}:{},...e.checks?{checks:e.checks}:{}}})]}):eX?(0,t.jsx)(L.ResponseViewer,{result:eX,onWaitLonger:e=>{eN(t=>({...t,timeout:e})),t2(e=>e+1),i(`This request now waits up to ${e} — save it to keep that`,"success")},extra:H?.id?(0,t.jsx)(en,{requestId:H.id,refreshKey:eX,onOpen:(e,t)=>0===t?e5(null):(e5({answer:e,index:t}),e9(!1))}):null,onSaveExample:()=>{eN(e=>({...e,mock:(0,a.exampleFromResponse)(eX.status,eX.headers,eX.body)})),i(H?"Kept as the mock example — save the request to keep it":"Kept as the mock example — save the request to use it in the mock server","success")}}):tK?(0,t.jsx)(ew.WelcomeCard,{practiceReady:!!p.demoApi,onSimple:()=>void(tz({...(0,V.withUrl)((0,V.defaultRequestDraft)(),"{{practiceApi}}/products"),checks:[{type:"status",expect:"2xx"},{type:"json",path:"items[0].name",op:"exists",value:""}]},null),i("Practice request ready — press Send","success")),onSignIn:()=>void tB(),onHide:()=>(0,ew.setWelcomeHidden)(!0)}):(0,t.jsx)(eK,{title:"Send a request to see the response",lines:[(0,t.jsx)(t.Fragment,{children:"Paste a URL — or a whole curl command from your browser's DevTools — into the bar above."}),(0,t.jsxs)(t.Fragment,{children:["Press ",(0,t.jsx)("span",{className:"kbd",children:b}),"+",(0,t.jsx)("span",{className:"kbd",children:"Enter"})," to send it."]})]})]}):tu?(0,t.jsxs)(t.Fragment,{children:[tu.error?(0,t.jsx)("p",{role:"alert",className:"mb-3 rounded-md border border-bad/40 bg-bad/10 px-3 py-2 text-sm text-bad",children:tu.error}):null,(0,t.jsx)(P.ReportView,{report:tu.report,source:"session",live:t$,probe:eX})]}):(0,t.jsx)(eK,{title:"No performance test yet",lines:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-ink",children:"Run performance test"})," sends one check request first, then runs"," ",(0,t.jsx)("span",{className:"font-mono text-ink",children:(0,M.profileSummary)(eS)})," with k6."]}),(0,t.jsx)(t.Fragment,{children:"Change users, duration, and ramps in the Performance tab. Set pass/fail goals in Goals."})],action:(0,t.jsxs)("button",{type:"button",className:"btn btn-primary",disabled:tT||!!t7,title:t7,onClick:()=>void t6(),children:[(0,t.jsx)(v.Play,{size:16}),"Run performance test"]})})})]})]})]})})},"VerdictTag",0,eB],6980)},90139,1245,33577,85905,e=>{"use strict";var t=e.i(99522);let s=(0,t.default)("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);e.s(["ArrowRightToLine",0,s],90139);var n=e.i(95754);e.s(["CircleCheck",()=>n.default],1245);let a=(0,t.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);e.s(["Columns2",0,a],33577);let r=(0,t.default)("copy-plus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["CopyPlus",0,r],85905)},30197,e=>{"use strict";let t=(0,e.i(99522).default)("list-x",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);e.s(["ListX",0,t],30197)}]);