apitestcenter 0.18.2 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/THIRD-PARTY-NOTICES-UI.txt +40 -10
  2. package/dist/THIRD-PARTY-NOTICES.txt +3 -3
  3. package/dist/cli.mjs +341 -335
  4. package/dist/ui/404/index.html +1 -1
  5. package/dist/ui/404.html +1 -1
  6. package/dist/ui/__next.__PAGE__.txt +17 -17
  7. package/dist/ui/__next._full.txt +18 -18
  8. package/dist/ui/__next._tree.txt +2 -2
  9. package/dist/ui/_next/static/chunks/0faedhifzwobh.js +31 -0
  10. package/dist/ui/_next/static/chunks/{0q8iq_7i4ohjr.js → 0glo5t3rr5ux5.js} +2 -2
  11. package/dist/ui/_next/static/chunks/0jksxb6220hcg.js +4 -0
  12. package/dist/ui/_next/static/chunks/0jq6xbzrkaewp.js +2 -0
  13. package/dist/ui/_next/static/chunks/1-9ymrwk2b425.js +1 -0
  14. package/dist/ui/_next/static/chunks/13ez75q2t6tkt.js +51 -0
  15. package/dist/ui/_next/static/chunks/{12whdxhkvkd-y.js → 1s068j2ev364j.js} +1 -1
  16. package/dist/ui/_next/static/chunks/{3wtqdtu331_vc.js → 2-ccpn24ve6pz.js} +3 -3
  17. package/dist/ui/_next/static/chunks/20hgurwocz54g.js +123 -0
  18. package/dist/ui/_next/static/chunks/26cw_brv1ud3e.js +27 -0
  19. package/dist/ui/_next/static/chunks/2at40-h3piqdk.js +50 -0
  20. package/dist/ui/_next/static/chunks/2d4j4s35zfogt.js +3 -0
  21. package/dist/ui/_next/static/chunks/2eitm7108zqkh.js +50 -0
  22. package/dist/ui/_next/static/chunks/{2c1b5jqwxl4ra.js → 2ihpgl_z3eude.js} +87 -86
  23. package/dist/ui/_next/static/chunks/2lr6d098vgexb.js +1 -0
  24. package/dist/ui/_next/static/chunks/2qci5ienr5rb9.css +3 -0
  25. package/dist/ui/_next/static/chunks/33purk5k-9o6l.js +1 -0
  26. package/dist/ui/_next/static/chunks/{0-zga2d528cxt.js → 3ixmudnloab4j.js} +3 -3
  27. package/dist/ui/_next/static/chunks/3ps_0myey2cxz.js +22 -0
  28. package/dist/ui/_next/static/chunks/3rshqqryni7gb.js +2 -0
  29. package/dist/ui/_next/static/chunks/45bkmnyf6ozrx.js +50 -0
  30. package/dist/ui/_not-found/__next._full.txt +13 -13
  31. package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +12 -12
  32. package/dist/ui/_not-found/__next._tree.txt +2 -2
  33. package/dist/ui/_not-found/index.html +1 -1
  34. package/dist/ui/_not-found/index.txt +13 -13
  35. package/dist/ui/compare/__next._full.txt +18 -18
  36. package/dist/ui/compare/__next._tree.txt +2 -2
  37. package/dist/ui/compare/__next.compare.__PAGE__.txt +17 -17
  38. package/dist/ui/compare/index.html +1 -1
  39. package/dist/ui/compare/index.txt +18 -18
  40. package/dist/ui/connections/__next._full.txt +16 -16
  41. package/dist/ui/connections/__next._tree.txt +2 -2
  42. package/dist/ui/connections/__next.connections.__PAGE__.txt +15 -15
  43. package/dist/ui/connections/index.html +2 -2
  44. package/dist/ui/connections/index.txt +16 -16
  45. package/dist/ui/history/__next._full.txt +19 -19
  46. package/dist/ui/history/__next._tree.txt +2 -2
  47. package/dist/ui/history/__next.history.__PAGE__.txt +18 -18
  48. package/dist/ui/history/index.html +1 -1
  49. package/dist/ui/history/index.txt +19 -19
  50. package/dist/ui/home/__next._full.txt +18 -18
  51. package/dist/ui/home/__next._tree.txt +2 -2
  52. package/dist/ui/home/__next.home.__PAGE__.txt +17 -17
  53. package/dist/ui/home/index.html +1 -1
  54. package/dist/ui/home/index.txt +18 -18
  55. package/dist/ui/index.html +1 -1
  56. package/dist/ui/index.txt +18 -18
  57. package/dist/ui/preview/__next._full.txt +17 -17
  58. package/dist/ui/preview/__next._tree.txt +2 -2
  59. package/dist/ui/preview/__next.preview.__PAGE__.txt +16 -16
  60. package/dist/ui/preview/index.html +1 -1
  61. package/dist/ui/preview/index.txt +17 -17
  62. package/dist/ui/suite/__next._full.txt +15 -15
  63. package/dist/ui/suite/__next._tree.txt +2 -2
  64. package/dist/ui/suite/__next.suite.__PAGE__.txt +14 -14
  65. package/dist/ui/suite/index.html +1 -1
  66. package/dist/ui/suite/index.txt +15 -15
  67. package/dist/ui/tests/__next._full.txt +13 -13
  68. package/dist/ui/tests/__next._tree.txt +2 -2
  69. package/dist/ui/tests/__next.tests.__PAGE__.txt +12 -12
  70. package/dist/ui/tests/index.html +1 -1
  71. package/dist/ui/tests/index.txt +13 -13
  72. package/package.json +1 -1
  73. package/dist/ui/_next/static/chunks/03ligbvtk7nsc.js +0 -123
  74. package/dist/ui/_next/static/chunks/03y58w9gmwqc-.js +0 -50
  75. package/dist/ui/_next/static/chunks/08rlo-0gnct9m.js +0 -50
  76. package/dist/ui/_next/static/chunks/0bgmfb8f3pd8e.js +0 -1
  77. package/dist/ui/_next/static/chunks/0g9k0swrer6i5.js +0 -1
  78. package/dist/ui/_next/static/chunks/1-t79a3q7gmjn.js +0 -31
  79. package/dist/ui/_next/static/chunks/14dtemzsvcfmn.js +0 -50
  80. package/dist/ui/_next/static/chunks/1mm60-ywpri7b.js +0 -2
  81. package/dist/ui/_next/static/chunks/20j4wusnbtqa2.js +0 -4
  82. package/dist/ui/_next/static/chunks/243c1-49gb3pr.js +0 -1
  83. package/dist/ui/_next/static/chunks/2sb9zma7ae-_f.js +0 -27
  84. package/dist/ui/_next/static/chunks/2sjog4to0fmbb.css +0 -3
  85. package/dist/ui/_next/static/chunks/2su0ql-zu4q0_.js +0 -3
  86. package/dist/ui/_next/static/chunks/3-rdixjnndtyk.js +0 -51
  87. package/dist/ui/_next/static/chunks/32_tmz8ibsdo3.js +0 -22
  88. package/dist/ui/_next/static/chunks/3wzu1zkfqdmn6.js +0 -2
  89. /package/dist/ui/_next/static/{8uBf4sRL82dkVbEC6zib9 → P0KsXFffpHNOo_vW1PSSr}/_buildManifest.js +0 -0
  90. /package/dist/ui/_next/static/{8uBf4sRL82dkVbEC6zib9 → P0KsXFffpHNOo_vW1PSSr}/_clientMiddlewareManifest.js +0 -0
  91. /package/dist/ui/_next/static/{8uBf4sRL82dkVbEC6zib9 → P0KsXFffpHNOo_vW1PSSr}/_ssgManifest.js +0 -0
@@ -0,0 +1,50 @@
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33622,e=>{var t=e.i(51487);e.i(24856);var s=e.i(48191);function r(e){return!!e&&"object"==typeof e&&"string"==typeof e.id&&"string"==typeof e.testName&&Array.isArray(e.buckets)&&"object"==typeof e.summary&&null!==e.summary}var n=e.i(45404),a=e.i(29724),o=e.i(88153),i=e.i(56396),l=e.i(59180),c=e.i(15275),d=e.i(2552),p=e.i(77306);e.s(["default",0,function(){let[e,m]=(0,p.useState)(null),[h,u]=(0,p.useState)(null),[f,x]=(0,p.useState)(null),[y,v]=(0,p.useState)(null),[b,g]=(0,p.useState)(!1),[k,w]=(0,p.useState)(!1),[_,F]=(0,p.useState)(null),[T,j]=(0,p.useState)(!1),N=(0,i.d)(),{refresh:S}=(0,l.K)();async function C(){j(!0);try{await l.c.import(_),await S(),w(!0),N("Saved to History","success")}catch(e){N(e instanceof Error?e.message:"Could not save to History","error")}finally{j(!1)}}let I=(0,p.useCallback)(async e=>{x(null),w(!1),m(null),u(null);let t=e.name.toLowerCase();if(t.endsWith(".html")||t.endsWith(".xlsx")||t.endsWith(".csv")||t.endsWith(".zip")){v(e.name),x("Preview needs the JSON export from the lab. HTML and Excel are for sharing, not for opening back here.");return}try{let t=await e.text(),n=JSON.parse(t),a=function(e){if(!e||"object"!=typeof e)throw Error("That file is not JSON we can open.");if("compare"===e.kind||Array.isArray(e.apis)&&e.apis.length>0){if(!(e&&"object"==typeof e&&"compare"===e.kind&&Array.isArray(e.apis)&&e.apis.length>=1&&e.apis.every(e=>e&&"object"==typeof e&&r(e.report))))throw Error("Not a valid APITestCenter compare export.");return{kind:"compare",doc:{...e,apis:e.apis.map(e=>({...e,report:(0,s.Q)(e.report)}))}}}if(r(e.report))return{kind:"report",report:(0,s.Q)(e.report)};if(r(e))return{kind:"report",report:(0,s.Q)(e)};throw Error("Not an APITestCenter report. Export JSON from the lab (not HTML or Excel).")}(n);F(n),v(e.name),"compare"===a.kind?u(a.doc):m(a.report)}catch(t){v(e.name),x(t instanceof Error?t.message:"Could not read that file.")}},[]);function M(e){e.preventDefault(),g(!0)}function A(e){e.preventDefault(),g(!1);let t=e.dataTransfer.files[0];t&&I(t)}let $=b?"border-accent bg-accent-dim":"border-line bg-panel",E=h?.apis.map(e=>e.title)??[],{slo:L}=(0,o.G)();return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col p-6 lg:p-8",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-xl font-medium text-ink",children:"Open a report"}),(0,t.jsx)("p",{className:"mt-1 max-w-xl text-sm text-mute",children:"Reopen a JSON report you exported earlier — a single run or a compare. Excel and HTML exports are for sharing and can't be reopened."})]}),e||h?(0,t.jsxs)("label",{onDragOver:M,onDragLeave:()=>g(!1),onDrop:A,className:`inline-flex cursor-pointer items-center gap-2 rounded-md border border-dashed px-3 py-2 text-xs ${$}`,children:[(0,t.jsx)(c.f,{size:14,className:"text-accent"}),"Replace JSON",(0,t.jsx)("input",{type:"file",accept:"application/json,.json",className:"sr-only",onChange:e=>{let t=e.target.files?.[0];t&&I(t),e.target.value=""}})]}):null]}),f?(0,t.jsx)("p",{className:"mt-4 text-sm text-bad",children:f}):null,h?(0,t.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("p",{className:"text-xs text-mute",children:[y," · compare · ",h.mode]}),(0,t.jsx)("button",{type:"button",disabled:k||T,onClick:()=>void C(),className:"rounded-md border border-line px-3 py-1.5 text-xs text-ink hover:border-accent disabled:opacity-40",children:k?"Saved to History":"Keep in History"})]}),(0,t.jsx)(n.f,{scope:"compare",data:{reports:h.apis.map(e=>e.report),titles:E,slo:L,live:!1}}),(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Open"," ",(0,t.jsx)(d.default,{href:"/compare",className:"text-accent hover:underline",children:"Compare"})," ","to re-run these APIs live."]})]}):e?(0,t.jsxs)("div",{className:"mt-6 space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsx)("p",{className:"text-xs text-mute",children:y}),(0,t.jsx)("button",{type:"button",disabled:k||T,onClick:()=>void C(),className:"rounded-md border border-line px-3 py-1.5 text-xs text-ink hover:border-accent disabled:opacity-40",children:k?"Saved to History":"Keep in History"})]}),k?(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Open it anytime on"," ",(0,t.jsx)(d.default,{href:"/history",className:"text-accent hover:underline",children:"History"}),"."]}):null,(0,t.jsx)("div",{className:"rounded-lg border border-line bg-panel p-4",children:(0,t.jsx)(a.f,{report:e,source:"file"})})]}):(0,t.jsxs)("label",{onDragOver:M,onDragLeave:()=>g(!1),onDrop:A,className:`mt-6 flex min-h-0 flex-1 cursor-pointer flex-col items-center justify-center rounded-lg border border-dashed px-8 py-16 text-center ${$}`,children:[(0,t.jsx)(c.f,{size:28,className:"text-accent"}),(0,t.jsx)("span",{className:"mt-4 text-base text-ink",children:"Drop a JSON report here, or click to choose"}),(0,t.jsx)("span",{className:"mt-2 max-w-md text-sm text-mute",children:"Single-run or compare JSON from Export. HTML, Excel, and zip are for sharing — they will not open here."}),(0,t.jsx)("span",{className:"mt-4 font-mono text-xs text-mute",children:"apitestcenter-*.json"}),(0,t.jsx)("input",{type:"file",accept:"application/json,.json",className:"sr-only",onChange:e=>{let t=e.target.files?.[0];t&&I(t),e.target.value=""}})]})]})}],33622)},37837,e=>{var t=e.i(51487),s=e.i(77306),r=e.i(30597),n=e.i(14865);e.s(["f",0,function({anchor:e,open:a,onClose:o,children:i,label:l,width:c=280,role:d="dialog"}){let p=(0,s.useRef)(null),[m,h]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{if(!a)return;let t=()=>{if(!e.current)return;let t=(0,n.C)(e.current),s=(0,n.v)(),r=p.current?.offsetHeight??320,a=s.height-t.bottom-8,o=t.top-8,i=a<Math.min(r,240)&&o>a,l=Math.min(Math.max(8,t.right-c),s.width-c-8);h({top:i?Math.max(8,t.top-Math.min(r,o)-4):t.bottom+4,left:l,maxHeight:Math.max(160,(i?o:a)-4)})};t();let s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t)}},[a,e,c]),(0,s.useEffect)(()=>{if(!a)return;let t=t=>{let s=t.target;p.current?.contains(s)||e.current?.contains(s)||o()},s=t=>{"Escape"===t.key&&(t.stopPropagation(),o(),e.current?.focus())},r=e=>{p.current?.contains(e.target)||o()},n=t=>{e.current?.contains(t.target)&&(t.stopPropagation(),t.preventDefault(),o())};return document.addEventListener("pointerdown",t,!0),document.addEventListener("click",n,!0),document.addEventListener("keydown",s,!0),document.addEventListener("scroll",r,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("click",n,!0),document.removeEventListener("keydown",s,!0),document.removeEventListener("scroll",r,!0)}},[a,o,e]),(0,s.useEffect)(()=>{a&&window.setTimeout(()=>p.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,r.createPortal)((0,t.jsx)("div",{ref:p,role:d,"aria-label":l,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)}])},30617,e=>{e.i(24856);var t=e.i(46306),s=e.i(36558),r=e.i(2385),n=e.i(17219);let a={base:0,header:1,desc:2,pass:3,warn:4,fail:5};function o(e){return String(e).replaceAll("&","&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 r="number"==typeof t?t:Number(t);return"errors"===e?r>=s.errorFail?a.fail:r>=s.errorWarn?a.warn:a.pass:r>=s.p95FailMs?a.fail:r>=s.p95WarnMs?a.warn:a.pass}let l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
3
+ <fonts count="3">
4
+ <font><sz val="11"/><name val="Calibri"/></font>
5
+ <font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Calibri"/></font>
6
+ <font><sz val="10"/><color rgb="FF5C6778"/><name val="Calibri"/></font>
7
+ </fonts>
8
+ <fills count="6">
9
+ <fill><patternFill patternType="none"/></fill>
10
+ <fill><patternFill patternType="gray125"/></fill>
11
+ <fill><patternFill patternType="solid"><fgColor rgb="FF0B8F7C"/></patternFill></fill>
12
+ <fill><patternFill patternType="solid"><fgColor rgb="FFDCFCE7"/></patternFill></fill>
13
+ <fill><patternFill patternType="solid"><fgColor rgb="FFFEF3C7"/></patternFill></fill>
14
+ <fill><patternFill patternType="solid"><fgColor rgb="FFFECACA"/></patternFill></fill>
15
+ </fills>
16
+ <borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
17
+ <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
18
+ <cellXfs count="6">
19
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
20
+ <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="center" vertical="center"/></xf>
21
+ <xf numFmtId="0" fontId="2" fillId="0" borderId="0" xfId="0" applyFont="1" applyAlignment="1"><alignment wrapText="1" vertical="center"/></xf>
22
+ <xf numFmtId="0" fontId="0" fillId="3" borderId="0" xfId="0" applyFill="1"/>
23
+ <xf numFmtId="0" fontId="0" fillId="4" borderId="0" xfId="0" applyFill="1"/>
24
+ <xf numFmtId="0" fontId="0" fillId="5" borderId="0" xfId="0" applyFill="1"/>
25
+ </cellXfs>
26
+ </styleSheet>`;async function c(e,n,o){let l=(0,r.s)(e,{slo:n}),c=(0,r.v)(n),p=(0,t.$)(o,(0,t.L)(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.E)(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:l.overall,s:i("level",l.overall,c)},{v:l.headline,s:a.desc}],...l.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:l.disclaimer,s:a.desc}],...p.map((e,s)=>[{v:`chart_${s+1}`},{v:`${e.w}x${e.h}`},{v:t.p[e.id],s:a.desc}])]},{name:"Second by second",rows:[s.V.map(e=>({v:e.header,s:a.header})),...e.buckets.map(e=>(0,s.u)(e).map((e,t)=>{let r=s.V[t]?.key,n=a.base;return"p95_ms"===r&&(n=i("latency",e,c)),"failed_rate"===r&&(n=i("errors",e,c)),"http_5xx"===r&&Number(e)>0&&(n=a.fail),"http_0"===r&&Number(e)>0&&(n=a.fail),"http_4xx"===r&&Number(e)>0&&(n=a.warn),"http_2xx"===r&&Number(e)>0&&(n=a.pass),{v:e,s:n}}))]}])}function 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="${o(e.name.replace(/[:\\/?*[\]]/g," ").trim().slice(0,31)||"Sheet")}" sheetId="${t+1}" r:id="rId${t+1}"/>`).join("\n")}
40
+ </sheets>
41
+ </workbook>`,"xl/_rels/workbook.xml.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
42
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
43
+ ${e.map((e,t)=>` <Relationship Id="rId${t+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${t+1}.xml"/>`).join("\n")}
44
+ <Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
45
+ </Relationships>`,"xl/styles.xml":l};return e.forEach((e,s)=>{var r;let n,a,i;return t[`xl/worksheets/sheet${s+1}.xml`]=(r=e.rows,a=Array.from({length:n=r[0]?.length??0},(e,t)=>{let s=function(e,t,s=10,r=48){let n=s;for(let s of e){let e=s[t]?.v;void 0!==e&&(n=Math.max(n,String(e).length+2))}return Math.min(r,n)}(r,t,t===n-1&&n>=3?36:12,t===n-1&&n>=3?72:42);return`<col min="${t+1}" max="${t+1}" width="${s}" customWidth="1"/>`}).join(""),i=r.map((e,t)=>`<row r="${t+1}" ht="${0===t?22:18}" customHeight="1">${e.map((e,s)=>{var r;let n,a;return r=t+1,n=`${function(e){let t=e+1,s="";for(;t>0;)s=String.fromCharCode(65+(t-1)%26)+s,t=Math.floor((t-1)/26);return s}(s)}${r}`,a=void 0!==e.s?` s="${e.s}"`:"","number"==typeof e.v&&Number.isFinite(e.v)?`<c r="${n}"${a}><v>${e.v}</v></c>`:`<c r="${n}"${a} t="inlineStr"><is><t xml:space="preserve">${o(e.v)}</t></is></c>`}).join("")}</row>`).join(""),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
46
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
47
+ <sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>
48
+ <cols>${a}</cols>
49
+ <sheetData>${i}</sheetData>
50
+ </worksheet>`)}),new Blob([(0,n.f)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"a",0,c,"F",0,d])},17219,e=>{let t=new Uint32Array(256).map((e,t)=>{let s=t;for(let e=0;e<8;e++)s=1&s?0xedb88320^s>>>1:s>>>1;return s>>>0});function s(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function r(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function n(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),s=0;for(let r of e)t.set(r,s),s+=r.length;return t}e.s(["f",0,function(e){let a=new TextEncoder,o=[],i=[],l=0;for(let[c,d]of Object.entries(e)){let e=a.encode(c),p="string"==typeof d?a.encode(d):d,m=function(e){let s=0xffffffff;for(let r of e)s=t[(s^r)&255]^s>>>8;return(0xffffffff^s)>>>0}(p),h=n([r(0x4034b50),s(20),s(0),s(0),s(0),s(0),r(m),r(p.length),r(p.length),s(e.length),s(0),e,p]),u=n([r(0x2014b50),s(20),s(20),s(0),s(0),s(0),s(0),r(m),r(p.length),r(p.length),s(e.length),s(0),s(0),s(0),s(0),r(0),r(l),e]);o.push(h),i.push(u),l+=h.length}let c=n(i),d=n([r(0x6054b50),s(0),s(0),s(Object.keys(e).length),s(Object.keys(e).length),r(c.length),r(l),s(0)]),p=n([...o,c,d]);return new Blob([p.buffer.slice(p.byteOffset,p.byteOffset+p.byteLength)],{type:"application/zip"})}])},32035,e=>{var t=e.i(56003);let s={name:"bell-off",size:24,node:[["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"}]]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],32035)},90632,e=>{var t=e.i(56003);let s={name:"columns-3",size:24,node:[["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"}]],aliases:["panels-left-right"]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],90632)},61318,e=>{var t=e.i(56003);let s={name:"ellipsis",size:24,node:[["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"}]],aliases:["more-horizontal"]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],61318)},36558,e=>{function t(e,s=2){if(!Number.isFinite(e))return 0;let r=10**s;return Math.round(e*r)/r}function s(e){return e>=100?Math.round(e):e>=10?t(e,1):t(e,2)}function r(e){return e>=10?Math.round(e):t(e,1)}function n(e,t=e=>e){return null==e?"":t(e)}e.s(["V",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."}],"u",0,function(e){return[e.elapsedS,e.ts,t(e.vus,1),s(e.rps),r(e.p50Ms),r(e.p95Ms),r(e.p99Ms),t(e.failedRate,4),e.http2xx,e.http4xx,e.http5xx,e.http0,e.bytesIn,e.bytesOut,n(e.p90Ms,r),n(e.p999Ms,r),n(e.maxMs,r),n(e.ttfbMs,r),n(e.connectMs,r),n(e.tlsMs,r),n(e.checksPassed),n(e.checksFailed),n(e.dropped)]},"E",0,function(e){let{summary:n}=e,a=[{key:"run_id",value:e.id,description:"Id of this run in this browser tab."},{key:"test_name",value:e.testName,description:"Display name (method, path, time)."},{key:"status",value:e.status,description:"completed, failed, cancelled, or still running."},{key:"started_at",value:e.startedAt,description:"When the load test started (UTC)."},{key:"ended_at",value:e.endedAt,description:"When the load test finished (UTC)."},{key:"method",value:e.definition.method,description:"HTTP method that was repeated."},{key:"url",value:e.definition.url,description:"Target URL (secrets are not exported)."},{key:"auth_mode",value:e.definition.auth.mode,description:"Auth used: none, bearer, basic, or api_key. The secret is not exported."},{key:"executor",value:e.definition.load.executor,description:"Load pattern: constant-vus (steady) or ramping-vus (ramp / hold / down)."},{key:"requests",value:n.http.requests,description:"How many HTTP calls finished. Zero usually means the target never answered."},{key:"rps_avg",value:s(n.http.rps.avg),description:"Average requests per second completed by this generator."},{key:"rps_max",value:s(n.http.rps.max),description:"Peak requests per second in any one-second sample."},{key:"failed_count",value:n.http.failed.count,description:"Requests that failed (4xx, 5xx, timeout, or no status)."},{key:"failed_rate",value:t(n.http.failed.rate,4),description:"Failed / total. Default warning bar is 1% (0.01)."},{key:"latency_min_ms",value:r(n.latencyMs.min),description:"Fastest request (milliseconds)."},{key:"latency_mean_ms",value:r(n.latencyMs.mean),description:"Average response time. Slow outliers pull this up."},{key:"latency_p50_ms",value:r(n.latencyMs.median),description:"Median — half of requests were faster than this."},{key:"latency_p95_ms",value:r(n.latencyMs.p95),description:"95th percentile — 95% of requests were faster. Usual headline latency."},{key:"latency_p99_ms",value:r(n.latencyMs.p99),description:"99th percentile — the slow tail (1 in 100 was slower)."},{key:"latency_max_ms",value:r(n.latencyMs.max),description:"Slowest single request."},{key:"vus_max",value:n.vus.max,description:"Peak concurrent users (virtual users / VUs)."},{key:"vus_avg",value:t(n.vus.avg,1),description:"Average concurrent users over the run."},{key:"bytes_in",value:n.data.bytesIn,description:"Response bytes received by the generator."},{key:"bytes_out",value:n.data.bytesOut,description:"Request bytes sent by the generator."},{key:"phase_ttfb_avg_ms",value:r(n.phasesMs.ttfb.avg),description:"Time to first byte — waiting on the server after the connection is up."},{key:"phase_tls_avg_ms",value:r(n.phasesMs.tls.avg),description:"TLS handshake time. High values often mean a far or overloaded endpoint."}];for(let[e,t]of Object.entries(n.http.status)){let s="0"===e?"No HTTP status (timeout / network).":Number(e)>=500?"Server error.":Number(e)>=400?"Client / auth error.":"Success-class response.";a.push({key:`status_${e}`,value:t,description:`How many responses had status ${e}. ${s}`})}for(let e of n.thresholds)a.push({key:`threshold:${e.name}`,value:e.ok?"pass":"fail",description:"k6 threshold result for this run."});return a}])}])})();
@@ -0,0 +1,3 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,87946,e=>{"use strict";var t=e.i(51487),s=e.i(32610),n=e.i(62766);e.i(24856);var a=e.i(84201);let l="services/rest/query/v1/suiteql",i=e=>e.trim().toUpperCase().replace(/-/g,"_");function r(e){let t=`${e}_name`;if(t.length<=30)return t;let s=0;for(let t of e)s=31*s+t.charCodeAt(0)>>>0;return`${e.slice(0,20)}_${(s%65535).toString(16).padStart(4,"0")}_name`}function o(e,t){let s=e.trim(),n=t?.type.split(":")[1]??"string";return/^null$/i.test(s)?"NULL":"boolean"===n?/^(true|t|yes|1)$/i.test(s)?"'T'":"'F'":("integer"===n||"number"===n||"reference"===n)&&/^-?\d+(\.\d+)?$/.test(s)?s:("date"===n||"datetime"===n)&&/^\d{4}-\d\d-\d\d$/.test(s)?`TO_DATE('${s}', 'YYYY-MM-DD')`:`'${e.replace(/'/g,"''")}'`}let c={eq:"=",ne:"<>",gt:">",ge:">=",lt:"<",le:"<="};function d(e,t){return e.filter(e=>e.field).map(e=>{let s=t.find(t=>t.name===e.field),n=!!(e.byName&&s?.ref),a=n?`BUILTIN.DF(${e.field})`:e.field;return"contains"===e.op?`${a} LIKE '%${e.value.replace(/'/g,"''")}%'`:"startswith"===e.op?`${a} LIKE '${e.value.replace(/'/g,"''")}%'`:"endswith"===e.op?`${a} LIKE '%${e.value.replace(/'/g,"''")}'`:/^null$/i.test(e.value.trim())&&("eq"===e.op||"ne"===e.op)?`${a} IS ${"ne"===e.op?"NOT ":""}NULL`:`${a} ${c[e.op]??"="} ${n?o(e.value):o(e.value,s)}`}).join(" AND ")}function u(e,t={}){let s=Math.min(t.top??1e3,1e3);return`${l}?limit=${s}&offset=${t.skip??0}&q=${encodeURIComponent(e)}`}function m(e){let t=e??{},s=Array.isArray(t.items)?t.items.map(e=>Object.fromEntries(Object.entries(e).filter(([e])=>"links"!==e))):[],n=Number(t.totalResults);return{rows:s,...Number.isFinite(n)&&void 0!==t.totalResults?{count:n}:{}}}var p=e.i(56003);let x={name:"building-complex",size:24,node:[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],aliases:["building-2"]};x.node;let h=(0,p.f)(x);var f=e.i(78e3);let b={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};b.node;let g=(0,p.f)(b);var y=e.i(49257),j=e.i(83668),v=e.i(97424),N=e.i(61318),w=e.i(80714),$=e.i(40970),k=e.i(2810),S=e.i(83500),C=e.i(86766),E=e.i(1326),L=e.i(53798),A=e.i(77306),O=e.i(78451);let T={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};T.node;let R=(0,p.f)(T);var U=e.i(75380);let I={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]};I.node;let D=(0,p.f)(I);var q=e.i(58068),F=e.i(62620),z=e.i(9219),M=e.i(41997),B=e.i(36e3),P=e.i(13318),_=e.i(70746),W=e.i(20054),K=e.i(6278),H=e.i(60889);function Z(e){let t=(0,O.I)();return{...t,auth:{...t.auth,authMode:"none",...e}}}let Q=[{id:"successfactors",label:"SAP SuccessFactors",note:"Its OData API — browse objects and fields",icon:h},{id:"salesforce",label:"Salesforce",note:"Sign in with OAuth, browse objects and fields, query with SOQL",icon:D},{id:"netsuite",label:"NetSuite",note:"Token-based sign-in or OAuth 2.0, browse record types, query with SuiteQL",icon:g},{id:"odata",label:"OData service",note:"SAP Gateway, Dynamics, any OData v2 or v4 API",icon:g},{id:"api",label:"REST API",note:"Any HTTP API: a base URL and its sign-in, reused by your requests",icon:q.f},{id:"practice",label:"Practice company",note:"A pretend OData company built into the app — try it now",icon:j.f},{id:"practice-salesforce",label:"Practice Salesforce org",note:"A pretend org built into the app: Accounts, Contacts, Users",icon:j.f},{id:"practice-netsuite",label:"Practice NetSuite account",note:"A pretend account built into the app: customers, employees, items",icon:j.f}],V=["Oracle EBS","PostgreSQL"];function Y(e,t){if(t){let e=Z({authMode:"oauth2"});return{...e,auth:{...e.auth,oauth:{...e.auth.oauth,grant:"client_credentials",tokenUrl:`${t.base}/services/rest/auth/oauth2/v1/token`,clientId:t.clientId,clientSecret:t.clientSecret,scope:"",clientAuth:"body"}}}}let s=Z({authMode:"oauth1"});return{...s,auth:{...s.auth,oauth1:{...s.auth.oauth1,signatureMethod:"HMAC-SHA256",realm:e?i(e):"",addTo:"header"}}}}let J=e=>{let t=/^https:\/\/([^.]+)\.suitetalk\.api\.netsuite\.com/i.exec(e.trim());return t?i(t[1]):""},G=e=>`${e.trim().replace(/\/+$/,"")}/services/oauth2/authorize`,X=e=>`${e.trim().replace(/\/+$/,"")}/services/oauth2/token`;function ee(e,t,s="",n=""){let a=Z({authMode:"oauth2"}),l={...a.auth.oauth,grant:t,authUrl:e?G(e):"",tokenUrl:e?X(e):"",clientId:s,clientSecret:n,scope:"",pkce:!0,clientAuth:"body"};return{...a,auth:{...a.auth,oauth:l}}}let et=["successfactors","salesforce","netsuite"];function es({editing:e,existing:s,onClose:n,onSaved:l}){let{demoApi:i}=(0,W.J)(),{vars:r}=(0,K.U)(),[o,c]=(0,A.useState)(e?"details":"type"),[d,u]=(0,A.useState)(()=>e?{kind:e.kind,name:e.name,variable:e.variable,variableEdited:!0,baseUrl:e.baseUrl,settings:e.settings}:{kind:"api",name:"",variable:"",variableEdited:!1,baseUrl:"",settings:Z({})}),[m,p]=(0,A.useState)("auth"),[x,h]=(0,A.useState)(!1),[f,b]=(0,A.useState)(!1),[g,y]=(0,A.useState)(null),[j,N]=(0,A.useState)(null),w=s.filter(t=>t.id!==e?.id).map(e=>e.variable),k=e=>{u(t=>{let s={...t,...e};if(void 0===e.name||s.variableEdited||(s.variable=(0,a.t)(s.name||en[s.kind],w)),void 0!==e.baseUrl&&"netsuite"===s.kind&&"oauth1"===s.settings.auth.authMode){let t=J(e.baseUrl);t&&(s.settings={...s.settings,auth:{...s.settings.auth,oauth1:{...s.settings.auth.oauth1,realm:t}}})}if(void 0!==e.baseUrl&&"salesforce"===s.kind&&"oauth2"===s.settings.auth.authMode){let n=s.settings.auth.oauth,a=t.baseUrl.trim()?G(t.baseUrl):"",l=t.baseUrl.trim()?X(t.baseUrl):"",i=e.baseUrl.trim(),r=n.authUrl&&n.authUrl!==a?n.authUrl:i?G(i):"",o=n.tokenUrl&&n.tokenUrl!==l?n.tokenUrl:i?X(i):"";s.settings={...s.settings,auth:{...s.settings.auth,oauth:{...n,authUrl:r,tokenUrl:o}}}}return s}),y(null)};(0,A.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopPropagation(),n())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[n]);let S=()=>({name:d.name.trim()||en[d.kind],kind:d.kind,variable:d.variable.trim(),baseUrl:d.baseUrl.trim(),settings:d.settings}),C=/^[A-Za-z_]\w{0,39}$/.test(d.variable.trim())&&!w.includes(d.variable.trim()),E=!!d.baseUrl.trim()&&C;async function L(){h(!0),N(null);try{y(await _.p.test({...S(),...e?{id:e.id}:{}},r))}catch(e){N(e instanceof Error?e.message:"Could not test")}finally{h(!1)}}let O=(0,H.d)();async function T(){let t=e=>et.includes(e.kind)&&!e.baseUrl.includes("/demo-api");if(!(!e&&t(d))||await O("connections.enterprise",s.filter(t).length+1)){b(!0),N(null);try{l(e?await _.p.update(e.id,S()):await _.p.create(S()))}catch(e){N(e instanceof Error?e.message:"Could not save"),b(!1)}}}let I="block space-y-1 text-sm",D="text-xs text-mute",q=e?`Edit ${e.name}`:"type"===o?"Add a connection":`Connect ${"successfactors"===d.kind?"SAP SuccessFactors":"salesforce"===d.kind?"Salesforce":"netsuite"===d.kind?"NetSuite":"odata"===d.kind?"an OData service":"a REST API"}`;return(0,t.jsx)("div",{className:"fixed inset-0 z-[66] flex items-center-safe justify-center overflow-y-auto bg-black/50 p-4 sm:p-10",role:"presentation",onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"add-connection-title",className:"w-full max-w-2xl rounded-xl border border-line bg-panel shadow-2xl",children:[(0,t.jsxs)("header",{className:"flex items-center gap-2 border-b border-line px-5 py-4",children:["details"!==o||e?(0,t.jsx)($.f,{size:16,className:"text-accent","aria-hidden":!0}):(0,t.jsx)("button",{type:"button","aria-label":"Back",onClick:()=>c("type"),className:"rounded p-1 text-mute hover:text-ink",children:(0,t.jsx)(R,{size:16})}),(0,t.jsx)("h2",{id:"add-connection-title",className:"flex-1 text-base font-medium text-ink",children:q}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Close",className:"rounded p-1 text-mute hover:text-ink",children:(0,t.jsx)(F.X,{size:16})})]}),"type"===o?(0,t.jsxs)("div",{className:"space-y-4 px-5 py-5",children:[(0,t.jsx)("p",{className:"text-sm text-mute",children:"Set a system up once — its address and sign-in — and every request that starts with its variable uses it. No sign-in to repeat per request."}),(0,t.jsx)("h3",{className:"text-xs font-medium text-mute",children:"Choose a connector"}),(0,t.jsx)("div",{className:"-mt-2 grid gap-2 sm:grid-cols-2",children:Q.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>(function(e){let t="practice"===e?"Practice company":"practice-salesforce"===e?"Practice org":"practice-netsuite"===e?"Practice account":en[e],s={kind:"practice"===e?"odata":"practice-salesforce"===e?"salesforce":"practice-netsuite"===e?"netsuite":e,name:t,variable:(0,a.t)(t,w),variableEdited:!1,baseUrl:"",settings:Z({})};if("salesforce"===e&&(s.settings=ee("","authorization_code")),"practice-salesforce"===e){let e=i?`${i}/salesforce`:"";Object.assign(s,{variable:(0,a.t)("practiceOrg",w),variableEdited:!0,baseUrl:e,settings:ee(e,"client_credentials","practice","demo")})}if("practice"===e&&Object.assign(s,{variable:(0,a.t)("practice",w),variableEdited:!0,baseUrl:i?`${i}/odata/v2`:"",settings:Z({authMode:"basic",username:"practice",password:"demo"})}),"successfactors"===e&&(s.settings=Z({authMode:"basic"})),"netsuite"===e&&(s.settings=Y("")),"practice-netsuite"===e){let e=i?`${i}/netsuite`:"";Object.assign(s,{variable:(0,a.t)("practiceAccount",w),variableEdited:!0,baseUrl:e,settings:Y("",{base:e,clientId:"practice",clientSecret:"demo"})})}u(s),y(null),c("details")})(e.id),className:"flex items-start gap-3 rounded-lg border border-line p-3 text-left hover:border-accent",children:[(0,t.jsx)(e.icon,{size:18,className:"mt-0.5 shrink-0 text-accent","aria-hidden":!0}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"block text-sm font-medium text-ink",children:e.label}),(0,t.jsx)("span",{className:"mt-0.5 block text-xs leading-snug text-mute",children:e.note})]})]},e.id))}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-mute",children:"Coming next"}),(0,t.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:V.map(e=>(0,t.jsx)("span",{className:"rounded-full border border-line px-2.5 py-0.5 text-xs text-mute",children:e},e))})]})]}):(0,t.jsxs)("div",{className:"space-y-4 px-5 py-5",children:[(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]",children:[(0,t.jsxs)("label",{className:I,children:[(0,t.jsx)("span",{className:"text-ink",children:"Name"}),(0,t.jsx)("input",{className:"input",value:d.name,onChange:e=>k({name:e.target.value}),placeholder:en[d.kind]})]}),(0,t.jsxs)("label",{className:I,children:[(0,t.jsx)("span",{className:"text-ink",children:"Variable"}),(0,t.jsxs)("span",{className:"flex items-center rounded-md border border-line bg-panel-2 font-mono text-[13px] focus-within:border-accent",children:[(0,t.jsx)("span",{className:"pl-2.5 text-mute",children:"{{"}),(0,t.jsx)("input",{"aria-label":"Variable",className:"min-w-0 flex-1 bg-transparent px-0.5 py-1.5 text-ink outline-none",value:d.variable,onChange:e=>k({variable:e.target.value,variableEdited:!0}),spellCheck:!1}),(0,t.jsx)("span",{className:"pr-2.5 text-mute",children:"}}"})]})]})]}),!C&&d.variable?(0,t.jsx)("p",{className:"-mt-2 text-xs text-bad",children:w.includes(d.variable.trim())?"Another connection uses this variable.":"Letters, digits and _, starting with a letter."}):null,"netsuite"===d.kind?(0,t.jsxs)("label",{className:I,children:[(0,t.jsx)("span",{className:"text-ink",children:"Account ID"}),(0,t.jsx)("input",{className:"input font-mono text-[13px]","aria-label":"Account ID",value:J(d.baseUrl),onChange:e=>{var t;return k({baseUrl:e.target.value.trim()?(t=e.target.value,`https://${t.trim().toLowerCase().replace(/_/g,"-")}.suitetalk.api.netsuite.com`):""})},placeholder:"1234567 or 1234567_SB1",spellCheck:!1}),(0,t.jsx)("span",{className:D,children:"Setup → Company → Company Information. A sandbox's ends in _SB1, _SB2… The base URL follows."})]}):null,(0,t.jsxs)("label",{className:I,children:[(0,t.jsx)("span",{className:"text-ink",children:"Base URL"}),(0,t.jsx)("input",{className:"input font-mono text-[13px]",value:d.baseUrl,onChange:e=>k({baseUrl:e.target.value}),placeholder:"api"===d.kind?"https://api.example.com/v1":"salesforce"===d.kind?"https://yourcompany.my.salesforce.com":"netsuite"===d.kind?"https://1234567.suitetalk.api.netsuite.com":"https://api.example.com/odata/v2",spellCheck:!1}),(0,t.jsxs)("span",{className:D,children:["successfactors"===d.kind?"Your data center's API server with /odata/v2 — from SAP's list of API servers, or your admin.":"salesforce"===d.kind?"Your org's address (My Domain) — a sandbox's ends in .sandbox.my.salesforce.com.":"netsuite"===d.kind?"The account's REST address — filled in from the account ID.":"odata"===d.kind?"The service root — the part before /$metadata.":"The part every address of this API starts with."," ","Requests write ",(0,t.jsx)("span",{className:"font-mono text-ink",children:`{{${d.variable||"name"}}}/…`}),"."]})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-line",children:[(0,t.jsx)(P.i,{id:"connection-settings",label:"Connection settings",value:m,onChange:p,className:"px-3",items:[{id:"auth",label:"Sign-in"},{id:"headers",label:"Headers",badge:d.settings.headers.filter(e=>e.key.trim()).length||void 0}]}),(0,t.jsx)("div",{...(0,P.q)("connection-settings",m),className:"p-3",children:"auth"===m?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(M.d,{value:d.settings.auth,onChange:e=>k({settings:{...d.settings,auth:{...d.settings.auth,...e}}}),noInherit:!0,inheritNote:null,defaults:r,secretNote:"Use {{name}} to take it from the environment, or type it — it's kept encrypted on this computer."}),"netsuite"===d.kind?(0,t.jsxs)("p",{className:D,children:[(0,t.jsx)("span",{className:"text-ink",children:"Token-based"})," (OAuth 1.0, HMAC-SHA256): in NetSuite, enable Token-Based Authentication and REST Web Services (Setup → Company → Enable Features → SuiteCloud), create an ",(0,t.jsx)("span",{className:"text-ink",children:"Integration"})," record (its consumer key and secret) and an ",(0,t.jsx)("span",{className:"text-ink",children:"Access Token"})," for a user and role (its token ID and secret). The realm is the account ID. Or pick ",(0,t.jsx)("span",{className:"text-ink",children:"OAuth 2.0"}),". The guide has every step."]}):null,"salesforce"===d.kind?(0,t.jsxs)("p",{className:D,children:["In Salesforce Setup, create an ",(0,t.jsx)("span",{className:"text-ink",children:"External Client App"})," with OAuth on: callback URL ",(0,t.jsx)("span",{className:"font-mono text-ink",children:d.settings.auth.oauth.redirectUri}),", scopes ",(0,t.jsx)("span",{className:"text-ink",children:"api"})," and"," ",(0,t.jsx)("span",{className:"text-ink",children:"refresh_token"}),", PKCE on. Paste its consumer key and secret above, leave Scope empty (Salesforce uses the app's scopes), then sign in. For a server-to-server login, pick the client credentials grant and set a run-as user in the app. The guide has every step."]}):null,"successfactors"===d.kind?(0,t.jsxs)("p",{className:D,children:["Basic: the user name is ",(0,t.jsx)("span",{className:"font-mono text-ink",children:"user@companyID"}),". For OAuth, pick ",(0,t.jsx)("span",{className:"text-ink",children:"OAuth 2.0 → SAML 2.0 bearer"}),", which signs in with the company ID and a private key."]}):null]}):(0,t.jsx)(B.f,{rows:d.settings.headers,onChange:e=>k({settings:{...d.settings,headers:e}}),keyPlaceholder:"Header",valuePlaceholder:"Value",noun:"header"})})]}),g?(0,t.jsxs)("div",{role:"status",className:`flex items-start gap-2 rounded-md border px-3 py-2 text-sm ${g.ok?"border-ok/40 bg-ok/10":"border-bad/40 bg-bad/10"}`,children:[g.ok?(0,t.jsx)(U.f,{size:16,className:"mt-0.5 shrink-0 text-ok","aria-hidden":!0}):(0,t.jsx)(z.f,{size:16,className:"mt-0.5 shrink-0 text-bad","aria-hidden":!0}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-ink",children:g.ok?g.version?`Connected — ${g.version}, ${g.entitySets} objects, ${g.ms} ms`:`Connected — the server answered ${g.status}, ${g.ms} ms`:g.error}),g.hint?(0,t.jsx)("p",{className:"mt-0.5 text-xs text-mute",children:g.hint}):null]})]}):null,j?(0,t.jsx)("p",{role:"alert",className:"text-sm text-bad",children:j}):null]}),"details"===o?(0,t.jsxs)("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:()=>void L(),disabled:!E||x,children:[x?(0,t.jsx)(v.f,{size:14,className:"animate-spin"}):null,"Test connection"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary py-1.5 text-sm",onClick:()=>void T(),disabled:!E||f,children:[f?(0,t.jsx)(v.f,{size:14,className:"animate-spin"}):null,!g||g.ok||e?"Save":"Save anyway"]})]}):null]})})}let en={successfactors:"SuccessFactors",salesforce:"Salesforce",netsuite:"NetSuite",odata:"OData service",api:"My API"},ea=/^Edm\.(Int16|Int32|Int64|Byte|SByte|Decimal|Double|Single)$/;function el(e,t,s){return e.filter(e=>e.field).map(e=>{let n=t.find(t=>t.name===e.field)?.type??"Edm.String";if("contains"===e.op||"startswith"===e.op||"endswith"===e.op){let t=`'${e.value.replace(/'/g,"''")}'`;return"contains"===e.op&&"2.0"===s?`substringof(${t},${e.field})`:`${e.op}(${e.field},${t})`}return`${e.field} ${e.op} ${function(e,t,s){let n=e.trim();if(/^null$/i.test(n))return"null";if(ea.test(t)&&/^-?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))return"2.0"===s&&"Edm.Int64"===t?`${n}L`:"2.0"===s&&"Edm.Decimal"===t?`${n}M`:n;if("Edm.Boolean"===t&&/^(true|false)$/i.test(n))return n.toLowerCase();if("Edm.Guid"===t)return"2.0"===s?`guid'${n}'`:n;if("Edm.DateTime"===t)return`datetime'${n.replace(/Z$/,"").replace(/^(\d{4}-\d\d-\d\d)$/,"$1T00:00:00")}'`;if("Edm.DateTimeOffset"===t){let e=/^\d{4}-\d\d-\d\d$/.test(n)?`${n}T00:00:00Z`:n;return"2.0"===s?`datetimeoffset'${e}'`:e}return"Edm.Date"===t&&"4.0"===s?n:`'${e.replace(/'/g,"''")}'`}(e.value,n,s)}`}).join(" and ")}function ei(e,t){let s=[],n=0,a=!1,l=0,i=e.toLowerCase();for(let r=0;r<e.length;r++){let o=e[r];"'"===o?a=!a:a||"("!==o?a||")"!==o?!a&&0===n&&i.startsWith(t,r)&&(s.push(e.slice(l,r)),l=r+t.length,r+=t.length-1):n--:n++}return s.push(e.slice(l)),s.map(e=>e.trim()).filter(Boolean)}let er=e=>{let t={};for(let[s,n]of Object.entries(e))!("__metadata"===s||s.startsWith("@odata.")||s.includes("@odata."))&&(n&&"object"==typeof n&&"__deferred"in n||(n&&"object"==typeof n&&Array.isArray(n.results)?t[s]=n.results.map(er):n&&"object"==typeof n&&!Array.isArray(n)?t[s]=er(n):t[s]=n));return t};function eo(e){if(!e||"object"!=typeof e)return{rows:[]};if("d"in e){let t=e.d;if(Array.isArray(t))return{rows:t.map(er)};let s=t??{};if(Array.isArray(s.results)){let e=Number(s.__count);return{rows:s.results.map(er),...Number.isFinite(e)&&void 0!==s.__count?{count:e}:{},..."string"==typeof s.__next?{next:s.__next}:{}}}return{rows:[er(s)]}}if(Array.isArray(e.value)){let t=Number(e["@odata.count"]);return{rows:e.value.map(er),...void 0!==e["@odata.count"]&&Number.isFinite(t)?{count:t}:{},..."string"==typeof e["@odata.nextLink"]?{next:e["@odata.nextLink"]}:{}}}return{rows:[er(e)]}}function ec(e){if(null==e)return"";if("string"==typeof e){let t=/^\/Date\((-?\d+)([+-]\d{4})?\)\/$/.exec(e);if(!t)return e;let s=new Date(Number(t[1])).toISOString();return s.endsWith("T00:00:00.000Z")?s.slice(0,10):s.replace(".000Z","Z")}return"object"==typeof e?JSON.stringify(e):String(e)}let ed={name:"arrow-down-a-z",size:24,node:[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],aliases:["arrow-down-az"]};ed.node;let eu=(0,p.f)(ed),em={name:"arrow-up-a-z",size:24,node:[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],aliases:["arrow-up-az"]};em.node;let ep=(0,p.f)(em);var ex=e.i(58372),eh=e.i(90632),ef=e.i(55919),eb=e.i(87953),eg=e.i(77497),ey=e.i(92368),ej=e.i(13817),ev=e.i(69578),eN=e.i(37837),ew=e.i(28867),e$=e.i(80707),ek=e.i(56396);let eS=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/%/g,"\\%").replace(/_/g,"\\_"),eC={eq:"=",ne:"!=",gt:">",ge:">=",lt:"<",le:"<="},eE=e=>e.replace(/\//g,".");function eL(e,t){return e.filter(e=>e.field).map(e=>{var s;let n,a,l=t.find(t=>t.name===e.field);return"contains"===e.op?`${eE(e.field)} LIKE '%${eS(e.value)}%'`:"startswith"===e.op?`${eE(e.field)} LIKE '${eS(e.value)}%'`:"endswith"===e.op?`${eE(e.field)} LIKE '%${eS(e.value)}'`:`${eE(e.field)} ${eC[e.op]??"="} ${s=e.value,n=s.trim(),a=l?.type.split(":")[1]??"string",/^null$/i.test(n)?"null":"boolean"===a&&/^(true|false)$/i.test(n)?n.toLowerCase():["int","long","double","currency","percent"].includes(a)&&/^-?\d+(\.\d+)?$/.test(n)||"date"===a&&/^\d{4}-\d\d-\d\d$/.test(n)?n:"datetime"===a&&/^\d{4}-\d\d-\d\d/.test(n)?/^\d{4}-\d\d-\d\d$/.test(n)?`${n}T00:00:00Z`:n:`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}`}).join(" AND ")}function eA(e,t,s={}){let n=t.entitySets.find(t=>t.name===e.entitySet),a=e.select?.length?e.select.map(eE):n?.properties.length?n.properties.map(e=>e.name):["Id"],l=e.filterText?.trim()||eL(e.filters??[],n?.properties??[]),i=[`SELECT ${s.countOnly?"COUNT()":a.join(", ")} FROM ${e.entitySet}`];return l&&i.push(`WHERE ${l}`),s.countOnly||(e.orderBy?.field&&i.push(`ORDER BY ${eE(e.orderBy.field)}${e.orderBy.desc?" DESC":" ASC"}`),void 0!==e.top&&i.push(`LIMIT ${e.top}`),e.skip&&i.push(`OFFSET ${e.skip}`)),i.join(" ")}function eO(e,t){return`services/data/${t.soql?.apiVersion??"v62.0"}/query?q=${encodeURIComponent(e)}`}let eT=e=>{let t={};for(let[s,n]of Object.entries(e))"attributes"!==s&&(n&&"object"==typeof n&&Array.isArray(n.records)?t[s]=n.records.map(eT):n&&"object"==typeof n&&!Array.isArray(n)?t[s]=eT(n):t[s]=n);return t};function eR(e){let t=e??{};return{rows:Array.isArray(t.records)?t.records.map(eT):[],..."string"==typeof t.nextRecordsUrl?{next:t.nextRecordsUrl}:{}}}function eU(e){return e.suiteql?{soql:!0,language:"SuiteQL",path:t=>{let s,n;return s=e.entitySets.find(e=>e.name===t.entitySet),n=t.filterText?.trim()||d(t.filters??[],s?.properties??[]),u(function(e,t=[]){let s=new Set(t.filter(t=>t.ref&&!e.noNames?.includes(t.name)).map(e=>e.name)),n=!!(e.names&&s.size),a=e.select?.length?e.select:n?t.map(e=>e.name):[],l=a.length?a.flatMap(e=>n&&s.has(e)?[e,`BUILTIN.DF(${e}) AS ${r(e)}`]:[e]).join(", "):"*",i=e.filterText?.trim()||"",o=[`SELECT ${l} FROM ${e.entitySet}`];return i&&o.push(`WHERE ${i}`),e.orderBy?.field&&o.push(`ORDER BY ${e.orderBy.field}${e.orderBy.desc?" DESC":" ASC"}`),o.join(" ")}({...t,filterText:n},s?.properties??[]),t)},pathForText:(e,t)=>{let s=Number(/[?&]limit=(\d+)/.exec(t)?.[1]);return u(e,Number.isFinite(s)?{top:s}:{})},pageSize:1e3,rows:m,filter:(e,t)=>d(e,t),parse:t=>(function(e,t){let s,n=e.trim(),a=/[?&]q=([^&]*)/.exec(n);if(a){let e=/[?&]limit=(\d+)/.exec(n);e&&(s=Number(e[1]));try{n=decodeURIComponent(a[1].replace(/\+/g," "))}catch{n=a[1]}}let l=/^SELECT\s+(.+?)\s+FROM\s+(\w+)(?:\s+WHERE\s+(.+?))?(?:\s+ORDER\s+BY\s+(\w+)(?:\s+(ASC|DESC))?)?\s*$/is.exec(n);if(!l)return null;let i=t.entitySets.find(e=>e.name.toLowerCase()===l[2].toLowerCase());if(!i)return null;let r={entitySet:i.name};if("*"!==l[1].trim()){let e=l[1].split(",").map(e=>e.trim()).filter(Boolean),t=e.filter(e=>!/^BUILTIN\.DF\(\w+\)(\s+AS\s+\w+)?$/i.test(e));t.length<e.length&&(r.names=!0);let s=i.properties.map(e=>e.name);r.names&&t.length===s.length&&s.every(e=>t.includes(e))||(r.select=t)}if(l[3]){let e=function(e){if(/\bOR\b|\(/i.test(e.replace(/'(?:[^']|'')*'/g,"''").replace(/BUILTIN\.DF\(\w+\)/gi,"df")))return null;let t=[];for(let s of e.split(/\s+AND\s+(?=(?:[^']*'[^']*')*[^']*$)/i)){let e,n=s.trim(),a=e=>e.replace(/''/g,"'"),l=String.raw`(?:BUILTIN\.DF\((\w+)\)|(\w+))`;if(e=RegExp(`^${l}\\s+LIKE\\s+'((?:[^']|'')*)'$`,"i").exec(n)){let s=e[3],n=s.startsWith("%"),l=s.endsWith("%");t.push({field:e[1]??e[2],op:n&&l?"contains":l?"startswith":n?"endswith":"eq",value:a(s.slice(+!!n,l?-1:void 0)),...e[1]?{byName:!0}:{}})}else if(e=RegExp(`^${l}\\s+IS\\s+(NOT\\s+)?NULL$`,"i").exec(n))t.push({field:e[1]??e[2],op:e[3]?"ne":"eq",value:"null",...e[1]?{byName:!0}:{}});else{if(!(e=RegExp(`^${l}\\s*(=|<>|!=|>=|<=|>|<)\\s*(.+)$`,"i").exec(n)))return null;let s={"=":"eq","<>":"ne","!=":"ne",">":"gt",">=":"ge","<":"lt","<=":"le"}[e[3]],i=e[4].trim(),r=/^'((?:[^']|'')*)'$/.exec(i),o=/^TO_DATE\('([^']*)'/i.exec(i);t.push({field:e[1]??e[2],op:s,value:r?"T"===r[1]?"true":"F"===r[1]?"false":a(r[1]):o?o[1]:i,...e[1]?{byName:!0}:{}})}}return t}(l[3]);e?r.filters=e:r.filterText=l[3]}return l[4]&&(r.orderBy={field:l[4],desc:l[5]?.toUpperCase()==="DESC"}),void 0!==s&&(r.top=s),r})(t,e),filterLabel:"WHERE"}:e.soql?{soql:!0,language:"SOQL",pathForText:t=>eO(t,e),path:t=>eO(eA(t,e),e),countPath:t=>eO(eA(t,e,{countOnly:!0}),e),rows:eR,filter:(e,t)=>eL(e,t),parse:t=>(function(e,t){let s=e.trim(),n=/[?&]q=([^&]*)/.exec(s);if(n)try{s=decodeURIComponent(n[1].replace(/\+/g," "))}catch{s=n[1]}let a=/^SELECT\s+(.+?)\s+FROM\s+(\w+)(?:\s+WHERE\s+(.+?))?(?:\s+ORDER\s+BY\s+([\w.]+)(?:\s+(ASC|DESC))?(?:\s+NULLS\s+(?:FIRST|LAST))?)?(?:\s+LIMIT\s+(\d+))?(?:\s+OFFSET\s+\d+)?\s*$/is.exec(s);if(!a)return null;let l=t.entitySets.find(e=>e.name.toLowerCase()===a[2].toLowerCase());if(!l)return null;let i={entitySet:l.name},r=a[1].split(",").map(e=>e.trim()).filter(Boolean);if(1===r.length&&/^COUNT\(\)$/i.test(r[0])||(i.select=r.map(e=>e.replace(/\./g,"/"))),a[3]){let e=function(e){if(/\bOR\b|\(/i.test(e.replace(/'(?:[^'\\]|\\.)*'/g,"''")))return null;let t=[];for(let s of e.split(/\s+AND\s+(?=(?:[^']*'[^']*')*[^']*$)/i)){let e,n=s.trim(),a=e=>e.replace(/\\(.)/g,"$1");if(e=/^([\w.]+)\s+LIKE\s+'((?:[^'\\]|\\.)*)'$/i.exec(n)){let s=e[2],n=s.startsWith("%"),l=s.endsWith("%")&&!s.endsWith("\\%"),i=a(s.slice(+!!n,l?-1:void 0));t.push({field:e[1].replace(/\./g,"/"),op:n&&l?"contains":l?"startswith":n?"endswith":"eq",value:i})}else{if(!(e=/^([\w.]+)\s*(=|!=|<>|>=|<=|>|<)\s*(.+)$/.exec(n)))return null;let s={"=":"eq","!=":"ne","<>":"ne",">":"gt",">=":"ge","<":"lt","<=":"le"}[e[2]],l=e[3].trim(),i=/^'((?:[^'\\]|\\.)*)'$/.exec(l);t.push({field:e[1].replace(/\./g,"/"),op:s,value:i?a(i[1]):l.replace(/T00:00:00(\.0+)?Z$/,"")})}}return t}(a[3]);e?i.filters=e:i.filterText=a[3]}return a[4]&&(i.orderBy={field:a[4].replace(/\./g,"/"),desc:a[5]?.toUpperCase()==="DESC"}),a[6]&&(i.top=Number(a[6])),i})(t,e),filterLabel:"WHERE"}:{soql:!1,language:null,path:t=>(function(e,t){let s=t.entitySets.find(t=>t.name===e.entitySet),n=[],a=(e.select??[]).filter(e=>!e.includes("/")),l=new Map;for(let t of e.expand??[])l.set(t,[]);for(let t of e.select??[]){let e=t.indexOf("/");e>0&&l.set(t.slice(0,e),[...l.get(t.slice(0,e))??[],t.slice(e+1)])}"2.0"===t.version?e.select?.length&&n.push(["$select",e.select.join(",")]):a.length&&n.push(["$select",a.join(",")]);let i=e.filterText?.trim()||el(e.filters??[],s?.properties??[],t.version);return i&&n.push(["$filter",i]),l.size&&n.push(["$expand",[...l].map(([e,s])=>"4.0"===t.version&&s.length?`${e}($select=${s.join(",")})`:e).join(",")]),e.orderBy?.field&&n.push(["$orderby",`${e.orderBy.field}${e.orderBy.desc?" desc":""}`]),void 0!==e.top&&n.push(["$top",String(e.top)]),e.skip&&n.push(["$skip",String(e.skip)]),e.count&&n.push("2.0"===t.version?["$inlinecount","allpages"]:["$count","true"]),"2.0"===t.version&&n.push(["$format","json"]),n.length?`${e.entitySet}?${n.map(([e,t])=>`${e}=${encodeURIComponent(t).replace(/%3D/g,"=").replace(/%3B/g,";").replace(/%2C/g,",").replace(/%2F/g,"/").replace(/%3A/g,":").replace(/%24/g,"$")}`).join("&")}`:e.entitySet})(t,e),rows:eo,filter:(t,s)=>el(t,s,e.version),parse:(t,s)=>(function(e,t,s=""){let n=e.trim(),a=s.replace(/\/+$/,"");a&&n.startsWith(a)&&(n=n.slice(a.length));let l=(n=n.replace(/^\{\{[^}]*\}\}/,"").replace(/^\/+/,"")).indexOf("?"),i=((l<0?n:n.slice(0,l)).split("/").filter(Boolean).pop()??"").replace(/\(.*\)$/,""),r=t.entitySets.find(e=>e.name===i)??t.entitySets.find(e=>e.name.toLowerCase()===i.toLowerCase());if(!r)return null;let o=new Map;for(let e of(l<0?"":n.slice(l+1)).split("&").filter(Boolean)){let t=e.indexOf("="),s=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}};o.set(s(t<0?e:e.slice(0,t)).toLowerCase(),s(t<0?"":e.slice(t+1)))}let c={entitySet:r.name},d=(o.get("$select")??"").split(",").map(e=>e.trim()).filter(Boolean),u=[];for(let e of ei(o.get("$expand")??"",",")){let t=/^([\w/]+)(?:\((.*)\))?$/.exec(e);if(!t)continue;u.push(t[1]);let s=/\$select=([^;)]*)/i.exec(t[2]??"")?.[1];if(s)for(let e of s.split(",").map(e=>e.trim()).filter(Boolean))d.push(`${t[1]}/${e}`)}d.length&&(c.select=d);let m=new Set(d.filter(e=>e.includes("/")).map(e=>e.slice(0,e.indexOf("/")))),p=u.filter(e=>!m.has(e));p.length&&(c.expand=p);let x=o.get("$filter")?.trim();if(x){let e=function(e){if(ei(e," or ").length>1)return null;let t=[];for(let s of ei(e," and ")){let e;if(e=/^substringof\(\s*'((?:[^']|'')*)'\s*,\s*([\w/]+)\s*\)$/i.exec(s))t.push({field:e[2],op:"contains",value:e[1].replace(/''/g,"'")});else if(e=/^(contains|startswith|endswith)\(\s*([\w/]+)\s*,\s*'((?:[^']|'')*)'\s*\)$/i.exec(s))t.push({field:e[2],op:e[1].toLowerCase(),value:e[3].replace(/''/g,"'")});else{if(!(e=/^([\w/]+)\s+(eq|ne|gt|ge|lt|le)\s+(.+)$/i.exec(s)))return null;let n=function(e){let t,s=e.trim();return(t=/^'((?:[^']|'')*)'$/.exec(s))?t[1].replace(/''/g,"'"):(t=/^(?:datetime|datetimeoffset|guid)'([^']*)'$/i.exec(s))?t[1].replace(/T00:00:00(\.0+)?Z?$/,""):(t=/^(-?\d+(?:\.\d+)?)[LMDdmf]?$/.exec(s))?t[1]:/^(true|false|null)$/i.test(s)?s.toLowerCase():/^\d{4}-\d\d-\d\d/.test(s)?s.replace(/T00:00:00(\.0+)?Z?$/,""):null}(e[3]);if(null===n)return null;t.push({field:e[1],op:e[2].toLowerCase(),value:n})}}return t}(x);e?c.filters=e:c.filterText=x}let h=o.get("$orderby")?.split(",")[0]?.trim().split(/\s+/);h?.[0]&&(c.orderBy={field:h[0],desc:h[1]?.toLowerCase()==="desc"});let f=Number(o.get("$top"));return o.has("$top")&&Number.isFinite(f)&&(c.top=f),c.count="allpages"===o.get("$inlinecount")||"true"===o.get("$count"),c})(t,e,s),filterLabel:"$filter"}}let eI=e=>e.type.includes(":")?e.type.split(":")[1]:e.type.replace(/^Edm\./,"");var eD=e.i(61230),eq=e.i(28950),eF=e.i(15060),ez=e.i(30617);function eM(e,t,s){sessionStorage.setItem(ev.n,JSON.stringify(eB(e,t))),s.push("/")}function eB(e,t){let s=e.baseUrl.replace(/\/+$/,""),n=t.startsWith(s)?t.slice(s.length).replace(/^\/+/,""):/^https?:\/\//i.test(t)?null:t.replace(/^\/+/,""),l="netsuite"===e.kind&&null!==n?function(e){let t=e.indexOf("?");if(t<0||!e.slice(0,t).endsWith("query/v1/suiteql"))return null;let s=new URLSearchParams(e.slice(t+1)),n=s.get("q");if(!n)return null;s.delete("q");let a=s.toString();return{path:a?`${e.slice(0,t)}?${a}`:e.slice(0,t),q:n}}(n):null;return l?{method:"POST",url:`{{${e.variable}}}/${l.path}`,headers:[{key:"Accept",value:"application/json"},{key:"Prefer",value:"transient"}],bodyMode:"json",bodyText:JSON.stringify({q:l.q},null,2),authMode:"inherit"}:{method:"GET",url:null===n?t:`{{${e.variable}}}/${(0,eD.f)(n)}`,headers:a.o.includes(e.kind)?[{key:"Accept",value:"application/json"}]:[],authMode:"inherit"}}function eP({connection:e,path:s,name:n}){let a=(0,ek.d)(),{index:l,refresh:i}=(0,K.U)(),[r,o]=(0,A.useState)(!1),[c,d]=(0,A.useState)(n),[u,m]=(0,A.useState)(""),[p,x]=(0,A.useState)(!1),h=(0,A.useRef)(null),f=(l?.folders??[]).map(e=>e.path);async function b(){if(!p&&c.trim()){x(!0);try{await K.v.create({name:c.trim(),collection:u,request:eB(e,s)}),await i(),o(!1),a(`Saved “${c.trim()}”${u?` in ${u}`:""} — find it in Saved requests on Test API`,"success")}catch(e){a(e instanceof Error?e.message:"Could not save","error")}finally{x(!1)}}}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:h,type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>(d(n),o(!0)),title:"Keep this query as a saved request — for collection runs, performance tests and CI",children:[(0,t.jsx)(ej.f,{size:13}),"Save as request"]}),(0,t.jsx)(eN.f,{anchor:h,open:r,onClose:()=>o(!1),label:"Save as request",width:340,children:(0,t.jsxs)("form",{className:"space-y-2.5 p-3",onSubmit:e=>{e.preventDefault(),b()},children:[(0,t.jsxs)("label",{className:"block space-y-1 text-xs text-mute",children:["Name",(0,t.jsx)("input",{autoFocus:!0,value:c,onChange:e=>d(e.target.value.slice(0,120)),"aria-label":"Request name",className:"input py-1.5 text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-mute",children:[(0,t.jsx)("span",{children:"Folder"}),(0,t.jsx)(e$.f,{label:"Folder",value:u,onChange:m,className:"w-full rounded-md border border-line bg-panel-2 px-2.5 py-1.5 text-sm text-ink",options:[{value:"",label:"No folder"},...f.map(e=>({value:e,label:e}))]})]}),(0,t.jsx)("p",{className:"text-xs text-mute",children:"Signed in by the connection — no secret is copied into the request."}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>o(!1),children:"Cancel"}),(0,t.jsxs)("button",{type:"submit",className:"btn btn-primary py-1 text-xs",disabled:p||!c.trim(),children:[p?(0,t.jsx)(v.f,{size:13,className:"animate-spin"}):null,"Save"]})]})]})})]})}function e_({connection:e,schema:s,set:n,initial:a,onOpenObject:l,onNeed:i,memoryKey:r}){let[o,c]=(0,eq.C)(`${r}:view`,"records"),[d,u]=(0,eq.C)(`${r}:visited`,()=>new Set(["records"])),[m,p]=(0,eq.C)(`${r}:path`,()=>eU(s).path({entitySet:n.name,top:50,count:!0})),x=(0,L.useRouter)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line px-4 pt-3 lg:px-6",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-medium text-ink",children:n.label??n.name}),(0,t.jsxs)("p",{className:"truncate font-mono text-xs text-mute",children:[n.name," · ",n.properties.length," fields",n.navigation.length?` \xb7 ${n.navigation.length} ${1===n.navigation.length?"link":"links"}`:""]})]}),(0,t.jsx)(eW,{connection:e,schema:s,onOpenObject:l}),(0,t.jsx)(eP,{connection:e,path:m,name:n.label??n.name}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>eM(e,m,x),title:"A GET with this query, signed in — to test, save or load-test",children:[(0,t.jsx)(y.f,{size:13}),"Open as request"]}),(0,t.jsx)(P.i,{id:"object-view",label:"Object",value:o,onChange:e=>{c(e),u(t=>t.has(e)?t:new Set([...t,e]))},className:"w-full",items:[{id:"records",label:"Records"},{id:"fields",label:"Fields",badge:n.properties.length},{id:"query",label:"Query"}]})]}),["records","fields","query"].map(c=>d.has(c)?(0,t.jsx)("div",{...(0,P.q)("object-view",c),className:o===c?"flex min-h-0 flex-1 flex-col":"hidden",children:"records"===c?(0,t.jsx)(e1,{connection:e,schema:s,set:n,initial:a,onPath:p,onNeed:i,memoryKey:`${r}:records`}):"fields"===c?(0,t.jsx)(te,{schema:s,set:n,onOpenObject:l,onNeed:i}):(0,t.jsx)(ts,{connection:e,schema:s,path:m,onPath:p,onOpenObject:l,memoryKey:`${r}:query`})},c):null)]})}function eW({connection:e,schema:s,onOpenObject:n}){let[a,l]=(0,A.useState)(!1),[i,r]=(0,A.useState)(""),[o,c]=(0,A.useState)(null),d=(0,A.useRef)(null);function u(){let t=eU(s).parse(i,e.baseUrl);if(!t)return c(s.suiteql?"That isn't SuiteQL for a record type of this account.":s.soql?"That isn't SOQL (or an address with ?q=SOQL) for an object of this org.":"That address doesn't name an object of this connection.");l(!1),r(""),c(null),n(t.entitySet,t)}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:d,type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>l(!0),title:"Fill the builder from an OData address",children:[(0,t.jsx)(ex.f,{size:13}),"Paste URL"]}),(0,t.jsx)(eN.f,{anchor:d,open:a,onClose:()=>l(!1),label:"Paste an OData URL",width:460,children:(0,t.jsxs)("form",{className:"space-y-2 p-3",onSubmit:e=>{e.preventDefault(),u()},children:[(0,t.jsxs)("label",{className:"block text-xs text-mute",children:[s.suiteql?"SuiteQL — from Postman, a SuiteQL tool or a colleague.":s.soql?"SOQL, or an address with ?q=SOQL — from Postman, the Developer Console or a colleague.":"An address of this service — from Postman, a browser or a colleague."," Its object, fields, conditions, links, order and rows fill the builder.",(0,t.jsx)("textarea",{autoFocus:!0,value:i,onChange:e=>(r(e.target.value),c(null)),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u())},rows:3,"aria-label":"OData URL",spellCheck:!1,placeholder:`${e.baseUrl}/Object?$select=…&$filter=…`,className:"input mt-1.5 font-mono text-xs"})]}),o?(0,t.jsx)("p",{className:"text-xs text-bad",children:o}):null,(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)("button",{type:"submit",className:"btn btn-primary py-1 text-xs",disabled:!i.trim(),children:"Fill the builder"})})]})})]})}let eK=[{id:"eq",label:"is"},{id:"ne",label:"is not"},{id:"contains",label:"contains"},{id:"startswith",label:"starts with"},{id:"endswith",label:"ends with"},{id:"gt",label:"more than"},{id:"ge",label:"at least"},{id:"lt",label:"less than"},{id:"le",label:"at most"}].map(e=>({value:e.id,label:e.label})),eH=["contains","startswith","endswith"],eZ="apitestcenter-field-order",eQ="atc:field-order";function eV(){let[e,t]=(0,A.useState)("az");return(0,A.useEffect)(()=>{let e=()=>{try{t("service"===localStorage.getItem(eZ)?"service":"az")}catch{}};return e(),window.addEventListener(eQ,e),()=>window.removeEventListener(eQ,e)},[]),[e,e=>{try{localStorage.setItem(eZ,e)}catch{}window.dispatchEvent(new Event(eQ))}]}function eY(e,t){return"service"===t?e:[...e].sort((e,t)=>Number(t.key)-Number(e.key)||(e.label??e.name).localeCompare(t.label??t.name,void 0,{sensitivity:"base",numeric:!0}))}function eJ(e,t){return"service"===t?e:[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base"}))}function eG({order:e,onChange:s}){return(0,t.jsx)("button",{type:"button",className:"shrink-0 text-xs text-mute hover:text-ink",onClick:()=>s("az"===e?"service":"az"),title:"az"===e?"Sorted A–Z (keys first) — show the service's own order":"In the service's own order — sort A–Z",children:"az"===e?"A–Z":"Service order"})}let eX=[{value:"10",label:"10 rows"},{value:"50",label:"50 rows"},{value:"100",label:"100 rows"},{value:"500",label:"500 rows"},{value:"1000",label:"1,000 rows"},{value:"all",label:"All, page by page"}];function e0(e,t){let s=t.indexOf("/");if(s<0)return e[t];let n=e[t.slice(0,s)],a=t.slice(s+1);return Array.isArray(n)?n.map(e=>e&&"object"==typeof e?e[a]:void 0):n&&"object"==typeof n?n[a]:void 0}function e1({connection:e,schema:s,set:n,initial:a,onPath:l,onNeed:i,memoryKey:o}){let c=eU(s),d=(0,ek.d)(),{vars:u}=(0,K.U)(),m=n.properties.map(e=>e.name),[p,x]=(0,eq.C)(`${o}:columns`,a?.select??[]),[h,f]=(0,eq.C)(`${o}:filters`,a?.filters??[]),[b,g]=(0,eq.C)(`${o}:filterText`,a?.filterText??null),[y,j]=(0,eq.C)(`${o}:order`,{field:a?.orderBy?.field??"",desc:!!a?.orderBy?.desc}),[N,w]=(0,eq.C)(`${o}:limit`,a?a.top??"all":50),[$,S]=(0,eq.C)(`${o}:withCount`,a?.count??!0),C=!!(s.suiteql&&n.properties.some(e=>e.ref)),[E,L]=(0,eq.C)(`${o}:names`,a?.names??!0),[O,T]=(0,eq.C)(`${o}:noNames`,[]),R=e=>C&&E&&!!n.properties.find(t=>t.name===e)?.ref&&!O.includes(e),[U,I]=(0,eq.C)(`${o}:rows`,[]),[D,q]=(0,eq.C)(`${o}:count`,void 0),[z,M]=(0,eq.C)(`${o}:next`,void 0),[B,P]=(0,eq.C)(`${o}:answer`,null),[W,Z]=(0,A.useState)(!1),[Q,V]=(0,eq.C)(`${o}:error`,null),[Y,J]=(0,eq.C)(`${o}:record`,null),G=a?.expand??[],X=e=>{let t=e.indexOf("/");if(t<0)return n.properties.find(t=>t.name===e);let a=n.navigation.find(s=>s.name===e.slice(0,t));return s.entitySets.find(e=>e.name===a?.target)?.properties.find(s=>s.name===e.slice(t+1))},ee=e=>{let t=X(e),s=e.indexOf("/");return s<0?t?.label:`${e.slice(0,s)} / ${t?.label??e.slice(s+1)}`},et=h.filter(e=>e.field&&(e.value||!1===eH.includes(e.op))),es=c.filter(et,n.properties),en=e=>({entitySet:n.name,select:p.length?p:void 0,expand:G.length?G:void 0,filters:et,filterText:b??void 0,orderBy:y.field?y:void 0,top:"all"===N?void 0:N,...e?{skip:e}:{},count:$,...C&&E?{names:!0,...O.length?{noNames:O}:{}}:{}});async function ea(){let t=n.properties.filter(e=>e.ref&&!O.includes(e.name)).map(e=>e.name),s=[];for(let a=0;a<t.length;a+=4)await Promise.all(t.slice(a,a+4).map(async t=>{let a=await _.p.get(e.id,c.pathForText(`SELECT BUILTIN.DF(${t}) AS name FROM ${n.name}`,"?limit=1"),u).catch(()=>null);(!a||a.error)&&s.push(t)}));return s}function el(e,t,s){let n="number"==typeof N?N:c.pageSize,a=void 0!==n&&e.rows.length===n&&(void 0===s||t+n<s);return e.next??(a?c.path(en(t+n)):void 0)}let[ei,er]=(0,A.useState)(null),eo=(0,A.useRef)(!1),ed=(0,H.d)();async function em(t,s){let a=U,l=s?z:void 0,i=(l||a.length>1e3)&&!await ed("connections.exportRows",Math.max(a.length,1001))?1e3:e4;eo.current=!1,er({read:a.length});try{let s,o,m,p,x;for(;l&&a.length<i&&!eo.current;){let t=await _.p.get(e.id,l,u);if(t.error)throw Error(t.error);let s=c.rows(t.body),n=a.length;a=[...a,...s.rows],l=s.rows.length?el(s,n,D):void 0,er({read:a.length})}let h=function(e){let t=[];for(let e of eg)t.push({name:e,label:ee(e)??e,of:t=>e0(t,e)}),R(e)&&t.push({name:r(e),label:`${ee(e)??e} (name)`,of:t=>t[r(e)]});return{names:t.map(e=>e.name),labels:t.map(e=>e.label),rows:e.map(e=>t.map(t=>{let s;return Array.isArray(s=t.of(e))?s.map(e=>ec(e)).join("; "):"number"==typeof s&&Number.isFinite(s)?s:ec(s)}))}}(a.slice(0,i)),f=n.label??n.name;(0,eF.h)((s=new Date,o=e=>String(e).padStart(2,"0"),m=f.replace(/[\\/:*?"<>|]+/g," ").replace(/\s+/g," ").trim().slice(0,60)||"export",`${m} ${s.getFullYear()}-${o(s.getMonth()+1)}-${o(s.getDate())} ${o(s.getHours())}${o(s.getMinutes())}.${t}`),"csv"===t?(p=e=>{let t=String(e);return/[",\r\n]/.test(t)||/^\s|\s$/.test(t)?`"${t.replace(/"/g,'""')}"`:t},x=[h.names,...h.rows].map(e=>e.map(p).join(",")),new Blob([`\uFEFF${x.join("\r\n")}\r
2
+ `],{type:"text/csv;charset=utf-8"})):(0,ez.F)([{name:f,rows:[h.labels.map(e=>({v:e,s:ez.S.header})),...h.rows.map(e=>e.map(e=>({v:e})))]}]));let b=eo.current?" — stopped before the end":l||a.length>i?` — the first ${i.toLocaleString()}; narrow it with conditions for the rest`:"";d(`Exported ${h.rows.length.toLocaleString()} ${1===h.rows.length?"record":"records"} as ${"csv"===t?"CSV":"Excel"}${b}`,"success")}catch(e){d(e instanceof Error?e.message:"Could not export","error")}finally{er(null)}}async function ex(t){Z(!0),V(null);let s=t??c.path(en());t||(l(s),J(null));try{let n=await _.p.get(e.id,s,u);if(!t&&n.error&&C&&E&&/builtin\.?df|builtin function/i.test(n.error)){let t=await ea();if(t.length){T(e=>[...new Set([...e,...t])]);let s=c.path({...en(),names:!0,noNames:[...new Set([...O,...t])]});l(s),n=await _.p.get(e.id,s,u)}}if(P(n),n.error){V([n.error,n.hint].filter(Boolean).join(" — ")),t||I([]);return}let a=c.rows(n.body),i=t?U.length:0;I(e=>t?[...e,...a.rows]:a.rows);let r=t?D:a.count;if(t||q(a.count),!t&&$&&c.countPath){let t=await _.p.get(e.id,c.countPath(en()),u).catch(()=>null),s=Number(t?.body?.totalSize);t&&!t.error&&Number.isFinite(s)&&q(r=s)}M(el(a,i,r))}catch(e){V(e instanceof Error?e.message:"Could not read the records")}finally{Z(!1)}}let eh=(0,A.useRef)(null!=(0,eq.q)(`${o}:answer`));(0,A.useEffect)(()=>{eh.current||ex()},[]);let[ef]=eV(),eb=eY(n.properties.filter(e=>e.filterable),ef),eg=p.length?p:m.filter(e=>U.some(t=>e in t)),ej=e=>({value:e.name,label:e.label??e.name,hint:e.label&&e.label!==e.name?e.name:void 0,text:`${e.name} ${e.label??""}`}),ev="rounded-md border border-line bg-panel-2 px-2.5 py-1 text-xs text-ink",eN="number"!=typeof N||eX.some(e=>e.value===String(N))?eX:[{value:String(N),label:`${N} rows`},...eX];return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"space-y-2 border-b border-line px-4 py-3 lg:px-6",children:[null===b?h.map((e,s)=>{var n;return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"w-12 text-xs text-mute",children:0===s?"Where":"and"}),(0,t.jsx)(e$.f,{label:`Condition ${s+1} field`,value:e.field,onChange:e=>f(t=>t.map((t,n)=>n===s?{...t,field:e,byName:!!X(e)?.ref||void 0}:t)),options:eb.map(ej),minWidth:320,className:`${ev} max-w-[22rem]`}),X(e.field)?.ref?(0,t.jsx)(e$.f,{label:`Condition ${s+1} compares`,value:e.byName?"name":"id",onChange:e=>f(t=>t.map((t,n)=>n===s?{...t,byName:"name"===e||void 0}:t)),options:[{value:"name",label:"its name"},{value:"id",label:"its ID"}],className:ev}):null,(0,t.jsx)(e$.f,{label:`Condition ${s+1} operator`,value:e.op,onChange:e=>f(t=>t.map((t,n)=>n===s?{...t,op:e}:t)),options:eK,className:ev}),(0,t.jsx)("input",{"aria-label":`Condition ${s+1} value`,value:e.value,onChange:e=>f(t=>t.map((t,n)=>n===s?{...t,value:e.target.value}:t)),onKeyDown:e=>"Enter"===e.key&&void ex(),placeholder:e.byName?"name, e.g. Acme":(n=X(e.field)?.type)?/Date/.test(n)?"2024-01-31":"Edm.Boolean"===n?"true or false":/Int|Decimal|Double|Single|Byte/.test(n)?"a number":"text":"",className:"input w-48 py-1 text-xs"}),(0,t.jsx)("button",{type:"button","aria-label":`Remove condition ${s+1}`,onClick:()=>f(e=>e.filter((e,t)=>t!==s)),className:"rounded p-1 text-mute hover:text-bad",children:(0,t.jsx)(F.X,{size:14})})]},s)}):(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-xs text-mute",children:["Filter as text (",c.filterLabel,")",(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>g(null),children:"Use conditions instead"})]}),(0,t.jsx)("textarea",{"aria-label":"Filter as text",value:b,onChange:e=>g(e.target.value),rows:2,spellCheck:!1,className:"input font-mono text-xs"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[null===b?(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>f(e=>[...e,{field:eb[0]?.name??"",op:"eq",value:"",...eb[0]?.ref?{byName:!0}:{}}]),disabled:!eb.length,children:[(0,t.jsx)(k.f,{size:13}),"Condition"]}):null,(0,t.jsx)(e8,{schema:s,set:n,value:p,onChange:x,onNeed:i}),(0,t.jsx)(e$.f,{label:"Sort by",value:y.field,onChange:e=>j(t=>({...t,field:e})),className:ev,minWidth:320,buttonContent:y.field?`Sort: ${ee(y.field)??y.field}`:"No sorting",options:[{value:"",label:"No sorting"},...eY(n.properties.filter(e=>e.sortable),ef).map(ej)]}),y.field?(0,t.jsx)("button",{type:"button",className:"rounded p-1 text-mute hover:text-ink","aria-label":y.desc?"Sorted Z to A — sort A to Z":"Sorted A to Z — sort Z to A",onClick:()=>j(e=>({...e,desc:!e.desc})),children:y.desc?(0,t.jsx)(ep,{size:15}):(0,t.jsx)(eu,{size:15})}):null,null===b?(0,t.jsx)("button",{type:"button",className:"text-xs text-mute hover:text-ink",onClick:()=>g(es),title:`See and edit the ${c.filterLabel} the conditions make — for or, brackets and functions`,children:"Filter as text"}):null,(0,t.jsxs)("span",{className:"ml-auto flex flex-wrap items-center gap-3",children:[(0,t.jsx)(e$.f,{label:"Rows",value:String(N),onChange:e=>w("all"===e?"all":Number(e)),options:eN,className:ev,minWidth:170}),C?(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-mute",title:"Lookups (a sales rep, a customer…) hold an internal ID. Ask NetSuite for the name of each record too — BUILTIN.DF — shown next to its ID. Turn off for faster, raw queries.",children:[(0,t.jsx)("input",{type:"checkbox",className:"accent-[var(--accent)]",checked:E,onChange:e=>L(e.target.checked)}),"Names for IDs"]}):null,(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-mute",title:"Ask for the total number of matching records too ($inlinecount in OData v2, $count in v4)",children:[(0,t.jsx)("input",{type:"checkbox",className:"accent-[var(--accent)]",checked:$,onChange:e=>S(e.target.checked)}),"Total count"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary py-1 text-xs",onClick:()=>void ex(),disabled:W,children:[W?(0,t.jsx)(v.f,{size:13,className:"animate-spin"}):(0,t.jsx)(ey.f,{size:13}),"Run"]})]})]})]}),Q?(0,t.jsx)("p",{role:"alert",className:"mx-4 mt-3 rounded-md border border-bad/40 bg-bad/10 px-3 py-2 text-sm text-ink lg:mx-6",children:Q}):null,(0,t.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,t.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-auto",children:U.length?(0,t.jsxs)("table",{className:"w-max min-w-full border-collapse text-[13px]",children:[(0,t.jsx)("thead",{className:"sticky top-0 z-10 bg-panel-2",children:(0,t.jsx)("tr",{children:eg.map(e=>(0,t.jsxs)("th",{scope:"col",className:"border-b border-line px-3 py-1.5 text-left align-bottom font-medium whitespace-nowrap text-ink",children:[ee(e)??e,ee(e)&&ee(e)!==e?(0,t.jsx)("span",{className:"block font-mono text-[11px] font-normal text-mute",children:e}):null]},e))})}),(0,t.jsx)("tbody",{children:U.map((e,s)=>(0,t.jsx)("tr",{onClick:()=>J(s),"aria-selected":Y===s,className:`cursor-pointer ${Y===s?"bg-accent-dim/60":"hover:bg-panel-2"}`,children:eg.map(s=>{let n=e0(e,s);if(Array.isArray(n))return(0,t.jsx)("td",{className:"border-b border-line px-3 py-1 text-xs",children:(0,t.jsx)("span",{className:"rounded bg-panel-2 px-1.5 py-0.5 text-mute",children:1===n.length?"1 item":`${n.length} items`})},s);let a=ec(n),l=R(s)?e[r(s)]:void 0;return null!=l&&""!==l&&""!==a?(0,t.jsxs)("td",{className:"max-w-[22rem] truncate border-b border-line px-3 py-1 text-xs text-ink",title:`${ec(l)} — ID ${a}`,children:[ec(l)," ",(0,t.jsxs)("span",{className:"font-mono text-mute",children:["· ",a]})]},s):(0,t.jsx)("td",{className:"max-w-[22rem] truncate border-b border-line px-3 py-1 font-mono text-xs text-ink",title:a.length>40?a:void 0,children:a},s)})},s))})]}):W||Q?null:(0,t.jsx)("p",{className:"px-6 py-8 text-sm text-mute",children:"No records match."})}),null!==Y&&U[Y]?(0,t.jsx)(e3,{row:U[Y],index:Y,onClose:()=>J(null)}):null]}),(0,t.jsxs)("footer",{className:"flex flex-wrap items-center gap-3 border-t border-line px-4 py-2 text-xs text-mute lg:px-6",children:[(0,t.jsxs)("span",{children:[U.length.toLocaleString()," ",void 0!==D?`of ${D.toLocaleString()} `:"",1===U.length?"record":"records",B?` \xb7 ${B.ms} ms`:""]}),z?(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-0.5 text-xs",onClick:()=>void ex(z),disabled:W,children:"Load more"}):null,U.length?(0,t.jsx)(e6,{loaded:U.length,total:z?D:U.length,more:!!z,busy:ei,onExport:(e,t)=>void em(e,t),onStop:()=>eo.current=!0}):null,B?(0,t.jsx)(e7,{url:B.url,className:"ml-auto"}):null]})]})}let e2="apitestcenter-record-panel-width";function e3({row:e,index:s,onClose:n}){let[a,l]=(0,A.useState)(420);return(0,A.useEffect)(()=>{try{let e=Number(localStorage.getItem(e2));e>=260&&l(e)}catch{}},[]),(0,t.jsxs)("aside",{"aria-label":`Record ${s+1}`,style:{width:a},className:"relative flex shrink-0 flex-col border-l border-line bg-panel",children:[(0,t.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Drag to resize the record",onPointerDown:function(e){e.preventDefault();let t=Number(document.documentElement.style.zoom)||1,s=e.clientX,n=a,i=e=>{l(n=Math.max(260,Math.min(window.innerWidth/t-360,a+(s-e.clientX)/t)))},r=()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",r);try{localStorage.setItem(e2,String(Math.round(n)))}catch{}};window.addEventListener("pointermove",i),window.addEventListener("pointerup",r)},className:"absolute inset-y-0 -left-1 z-10 w-2 cursor-col-resize hover:bg-accent/30"}),(0,t.jsxs)("header",{className:"flex items-center gap-2 border-b border-line px-3 py-2",children:[(0,t.jsxs)("h3",{className:"flex-1 text-sm font-medium text-ink",children:["Record ",s+1]}),(0,t.jsx)("button",{type:"button",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>void navigator.clipboard.writeText(JSON.stringify(e,null,2)),"aria-label":"Copy as JSON",title:"Copy as JSON",children:(0,t.jsx)(ef.f,{size:14})}),(0,t.jsx)("button",{type:"button",className:"rounded p-1 text-mute hover:text-ink",onClick:n,"aria-label":"Close the record",children:(0,t.jsx)(F.X,{size:14})})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto p-3 font-mono text-xs",children:(0,t.jsx)(e5,{value:e})})]})}function e5({value:e}){let s=Array.isArray(e)?e.map((e,t)=>[String(t+1),e]):Object.entries(e);return(0,t.jsx)("ul",{className:"space-y-0.5",children:s.map(([n,a])=>a&&"object"==typeof a?(0,t.jsx)("li",{children:(0,t.jsxs)("details",{open:Array.isArray(e)||s.length<8,children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-ink",children:[(0,t.jsx)("span",{className:"text-accent",children:n})," ",(0,t.jsx)("span",{className:"text-mute",children:Array.isArray(a)?`${a.length} ${1===a.length?"item":"items"}`:""})]}),(0,t.jsx)("div",{className:"ml-3 border-l border-line pl-2",children:(0,t.jsx)(e5,{value:a})})]})},n):(0,t.jsxs)("li",{className:"grid grid-cols-[minmax(0,40%)_minmax(0,1fr)] gap-3",children:[(0,t.jsx)("span",{className:"truncate text-mute",title:n,children:n}),(0,t.jsx)("span",{className:"min-w-0 break-words whitespace-pre-wrap text-ink",children:ec(a)})]},n))})}let e4=5e4;function e6({loaded:e,total:s,more:n,busy:a,onExport:l,onStop:i}){let[r,o]=(0,A.useState)(!1),[c,d]=(0,A.useState)(!1),u=(0,A.useRef)(null);if(a)return(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)(v.f,{size:13,className:"animate-spin text-accent","aria-hidden":!0}),(0,t.jsxs)("span",{role:"status",children:["Reading ",a.read.toLocaleString(),void 0!==s?` of ${Math.min(s,e4).toLocaleString()}`:"","…"]}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-0.5 text-xs",onClick:i,children:"Stop"})]});let m=e=>{o(!1),l(e,n&&c)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:u,type:"button",className:"btn btn-secondary py-0.5 text-xs",onClick:()=>o(!0),children:[(0,t.jsx)(eb.f,{size:12}),"Export"]}),(0,t.jsx)(eN.f,{anchor:u,open:r,onClose:()=>o(!1),label:"Export records",width:300,children:(0,t.jsxs)("div",{className:"space-y-2.5 p-3 text-sm",children:[n?(0,t.jsxs)("fieldset",{className:"space-y-1.5",children:[(0,t.jsx)("legend",{className:"mb-1 text-xs text-mute",children:"Which records"}),(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"radio",name:"export-which",checked:!c,onChange:()=>d(!1)}),"The ",e.toLocaleString()," loaded"]}),(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"radio",name:"export-which",checked:c,onChange:()=>d(!0)}),"All ",void 0!==s?`${s.toLocaleString()} `:"","matching",void 0!==s&&s>e4?(0,t.jsxs)("span",{className:"text-xs text-mute",children:["(the first ",e4.toLocaleString(),")"]}):null]})]}):(0,t.jsxs)("p",{className:"text-xs text-mute",children:[e.toLocaleString()," ",1===e?"record":"records",", with the columns shown."]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary flex-1 py-1 text-xs",onClick:()=>m("csv"),children:"CSV"}),(0,t.jsx)("button",{type:"button",className:"btn btn-primary flex-1 py-1 text-xs",onClick:()=>m("xlsx"),children:"Excel"})]})]})})]})}function e7({url:e,className:s=""}){let n=(0,ek.d)(),a=(0,eD.f)(e);return(0,t.jsxs)("span",{className:`flex min-w-0 items-center gap-2 ${s}`,children:[(0,t.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-mute",title:a,children:a}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary shrink-0 py-0.5 text-xs",onClick:()=>void navigator.clipboard.writeText(a).then(()=>n("Copied the URL","success"),()=>n("Could not copy","error")),children:[(0,t.jsx)(ef.f,{size:12}),"Copy URL"]})]})}function e8({schema:e,set:s,value:n,onChange:a,onNeed:l}){let[i,r]=(0,A.useState)(!1),[o,c]=(0,A.useState)(""),[d,u]=(0,A.useState)(!1),[m,p]=(0,A.useState)(new Set),[x,h]=(0,A.useState)("fields"),[b,g]=eV(),y=(0,A.useRef)(null),j=s.properties.map(e=>e.name),N=o.trim().toLowerCase(),w=(e,t)=>(!d||n.includes(t))&&(!N||t.toLowerCase().includes(N)||(e.label??"").toLowerCase().includes(N)),$=eY(s.properties,b).filter(e=>w(e,e.name)),k=eJ(s.navigation,b).map(t=>({link:t,target:e.entitySets.find(e=>e.name===t.target)})).map(({link:e,target:t})=>({link:e,target:t,fields:eY(t?.properties??[],b).filter(t=>w(t,`${e.name}/${t.name}`)||N&&e.name.toLowerCase().includes(N)&&(!d||n.includes(`${e.name}/${t.name}`)))})).filter(({link:e,fields:t})=>!N&&!d||t.length>0||!d&&e.name.toLowerCase().includes(N)),S=e=>{if(n.includes(e))return a(n.filter(t=>t!==e));a([...j.filter(t=>t===e||n.includes(t)),...n.filter(e=>e.includes("/")),...e.includes("/")?[e]:[]])},E=n.filter(e=>!e.includes("/")).length,L=n.length-E;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:y,type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>r(!0),"aria-label":n.length?`Columns, ${n.length} picked`:"Columns, all fields",children:[(0,t.jsx)(eh.f,{size:13}),n.length?`Columns ${n.length}`:"All fields"]}),(0,t.jsx)(eN.f,{anchor:y,open:i,onClose:()=>r(!1),label:"Columns",width:420,children:(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[s.navigation.length?(0,t.jsx)(ew.f,{label:"Show",value:x,onChange:h,options:[{value:"fields",label:`Fields ${j.length}${E?` \xb7 ${E} picked`:""}`},{value:"related",label:`Related ($expand) ${s.navigation.length}${L?` \xb7 ${L} picked`:""}`}]}):null,(0,t.jsxs)("label",{className:"relative block",children:[(0,t.jsx)("span",{className:"sr-only",children:"fields"===x?"Find a field":"Find a link or its field"}),(0,t.jsx)(C.f,{size:13,className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-mute","aria-hidden":!0}),(0,t.jsx)("input",{autoFocus:!0,value:o,onChange:e=>c(e.target.value),placeholder:"fields"===x?`Search ${j.length} fields`:`Search ${s.navigation.length} links and their fields`,className:"input py-1 pr-24 pl-7 text-xs"}),(0,t.jsx)("span",{className:"absolute top-1/2 right-2 -translate-y-1/2",children:(0,t.jsx)(eG,{order:b,onChange:g})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 px-1 text-xs",children:[(0,t.jsx)("span",{className:"text-mute",children:n.length?`${n.length} picked — only these are asked for`:"All fields — pick some to ask for only those"}),(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 gap-3",children:["fields"===x&&N&&$.some(e=>!n.includes(e.name))?(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>a([...j.filter(e=>n.includes(e)||$.some(t=>t.name===e)),...n.filter(e=>e.includes("/"))]),children:"Pick these"}):null,(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline disabled:text-mute disabled:no-underline",disabled:!n.length,onClick:()=>(a([]),u(!1)),children:"Clear"})]})]}),n.length?(0,t.jsxs)("label",{className:"flex items-center gap-1.5 px-1 text-xs text-mute",children:[(0,t.jsx)("input",{type:"checkbox",className:"accent-[var(--accent)]",checked:d,onChange:e=>u(e.target.checked)}),"Show picked only"]}):null,(0,t.jsx)("div",{className:"max-h-96 space-y-0.5 overflow-y-auto",children:"fields"===x?(0,t.jsxs)("ul",{"aria-label":"Fields",className:"space-y-0.5",children:[$.map(e=>(0,t.jsx)(e9,{p:e,checked:n.includes(e.name),onToggle:()=>S(e.name)},e.name)),$.length?null:(0,t.jsxs)("li",{className:"px-2 py-1 text-xs text-mute",children:["Nothing matches."," ",N&&k.length?(0,t.jsxs)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>h("related"),children:[k.length," in Related"]}):null]})]}):(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"px-2 pb-1 text-[11px] text-mute",children:"Open a link to pick fields of the object it leads to — they come as columns of their own."}),(0,t.jsxs)("ul",{"aria-label":"Related",className:"space-y-0.5",children:[k.map(({link:e,target:s,fields:a})=>{let i=m.has(e.name)||!!N||d,r=n.filter(t=>t.startsWith(`${e.name}/`)).length;return(0,t.jsxs)("li",{children:[(0,t.jsxs)("button",{type:"button","aria-expanded":i,disabled:!s,onClick:()=>{s?.described===!1&&l(s.name),p(t=>new Set(t.has(e.name)?[...t].filter(t=>t!==e.name):[...t,e.name]))},className:"flex w-full items-center gap-1.5 rounded px-2 py-1 text-left hover:bg-panel-2 disabled:opacity-50",title:s?void 0:"This link leads to an object the service doesn't list",children:[(0,t.jsx)(f.f,{size:13,className:`shrink-0 text-mute transition-transform ${i?"rotate-90":""}`,"aria-hidden":!0}),(0,t.jsx)("span",{className:"font-mono text-xs text-ink",children:e.name}),(0,t.jsxs)("span",{className:"min-w-0 truncate text-[11px] text-mute",children:["→ ",s?.label??e.target??"?"," (",e.many?"many":"one",")"]}),r?(0,t.jsx)("span",{className:"ml-auto shrink-0 rounded bg-accent-dim px-1.5 text-[10px] text-ink",children:r}):null]}),i&&s?.described===!1?(0,t.jsxs)("p",{className:"ml-6 flex items-center gap-1.5 py-1 text-[11px] text-mute",children:[(0,t.jsx)(v.f,{size:11,className:"animate-spin"})," Reading its fields…"]}):null,i&&s?(0,t.jsx)("ul",{"aria-label":`Fields of ${e.name}`,className:"ml-4 space-y-0.5 border-l border-line pl-1",children:a.map(s=>(0,t.jsx)(e9,{p:s,checked:n.includes(`${e.name}/${s.name}`),onToggle:()=>S(`${e.name}/${s.name}`)},s.name))}):null]},e.name)}),k.length?null:(0,t.jsx)("li",{className:"px-2 py-1 text-xs text-mute",children:"Nothing matches."})]}),(0,t.jsx)("p",{className:"px-2 pt-1.5 text-[11px] text-mute",children:"One level of links for now; deeper levels come later."})]})}),0===E&&n.length?(0,t.jsx)("p",{className:"px-1 text-[11px] text-mute",children:"Only linked fields picked: the service sends just those (and the keys it always sends)."}):null]})})]})}function e9({p:e,checked:s,onToggle:n}){return(0,t.jsx)("li",{children:(0,t.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded px-2 py-1 hover:bg-panel-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"mt-0.5 accent-[var(--accent)]",checked:s,onChange:n,"aria-label":e.label??e.name}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block text-sm break-words text-ink",children:e.label??e.name}),e.label&&e.label!==e.name?(0,t.jsx)("span",{className:"block font-mono text-[11px] break-all text-mute",children:e.name}):null]}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-mute",children:eI(e)})]})})}function te({schema:e,set:s,onOpenObject:n,onNeed:a}){let[l,i]=(0,A.useState)(""),[r,o]=(0,A.useState)(null),[c,d]=eV(),u=l.trim().toLowerCase(),m=eY(s.properties,c).filter(e=>!u||e.name.toLowerCase().includes(u)||(e.label??"").toLowerCase().includes(u)||e.type.toLowerCase().includes(u)),p=eJ(s.navigation,c).filter(e=>!u||e.name.toLowerCase().includes(u)||(e.target??"").toLowerCase().includes(u));return(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-3 lg:px-6",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-3",children:[(0,t.jsxs)("label",{className:"relative block w-full max-w-sm",children:[(0,t.jsx)("span",{className:"sr-only",children:"Find a field"}),(0,t.jsx)(C.f,{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:l,onChange:e=>i(e.target.value),placeholder:"Find a field or link",className:"input py-1 pl-8 text-sm"})]}),(0,t.jsx)(eG,{order:c,onChange:d})]}),(0,t.jsx)(tt,{fields:m}),p.length?(0,t.jsxs)("div",{className:"mt-5",children:[(0,t.jsx)("h3",{className:"text-xs font-medium text-mute",children:"Links to other objects ($expand) — open one to see its fields"}),(0,t.jsx)("ul",{className:"mt-1.5 space-y-0.5 text-[13px]",children:p.map(s=>{let l=e.entitySets.find(e=>e.name===s.target),i=r===s.name;return(0,t.jsxs)("li",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button","aria-expanded":i,disabled:!l,onClick:()=>{l?.described===!1&&a(l.name),o(i?null:s.name)},className:"flex min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left font-mono text-xs text-ink hover:bg-panel-2 disabled:opacity-60",children:[(0,t.jsx)(f.f,{size:13,className:`shrink-0 text-mute transition-transform ${i?"rotate-90":""}`,"aria-hidden":!0}),s.name," ",(0,t.jsxs)("span",{className:"text-mute",children:["→ ",s.target??"?"," (",s.many?"many":"one",")"]})]}),l?(0,t.jsxs)("button",{type:"button",className:"text-xs text-accent hover:underline",onClick:()=>n(l.name),children:["Open ",l.label??l.name]}):null]}),i&&l?(0,t.jsx)("div",{className:"mt-1 mb-2 ml-5 border-l border-line pl-3",children:(0,t.jsx)(tt,{fields:eY(l.properties,c)})}):null]},s.name)})})]}):null]})}function tt({fields:e}){return(0,t.jsxs)("table",{className:"w-full border-collapse text-[13px]",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-xs text-mute",children:[(0,t.jsx)("th",{scope:"col",className:"border-b border-line py-1.5 pr-3 font-medium",children:"Field"}),(0,t.jsx)("th",{scope:"col",className:"border-b border-line py-1.5 pr-3 font-medium",children:"Label"}),(0,t.jsx)("th",{scope:"col",className:"border-b border-line py-1.5 pr-3 font-medium",children:"Type"}),(0,t.jsx)("th",{scope:"col",className:"border-b border-line py-1.5 font-medium",children:"Notes"})]})}),(0,t.jsx)("tbody",{children:e.map(e=>(0,t.jsxs)("tr",{children:[(0,t.jsxs)("td",{className:"border-b border-line py-1.5 pr-3 font-mono text-xs text-ink",children:[e.key?(0,t.jsx)(eg.f,{size:11,className:"mr-1 inline align-[-1px] text-accent","aria-label":"Key"}):null,e.name]}),(0,t.jsx)("td",{className:"border-b border-line py-1.5 pr-3 text-ink",children:e.label??""}),(0,t.jsxs)("td",{className:"border-b border-line py-1.5 pr-3 font-mono text-xs text-mute",children:[eI(e),e.maxLength?`(${e.maxLength})`:""]}),(0,t.jsx)("td",{className:"border-b border-line py-1.5 text-xs text-mute",children:[e.key?"key":"",e.ref?"lookup — name with BUILTIN.DF":"",!e.nullable?"required":"",!e.filterable?"can't filter":"",!e.sortable?"can't sort":""].filter(Boolean).join(" · ")})]},e.name))})]})}function ts({connection:e,schema:s,path:n,onPath:a,onOpenObject:l,memoryKey:i}){var r,o;let{vars:c}=(0,K.U)(),[d,u]=(0,eq.C)(`${i}:answer`,null),[m,p]=(0,A.useState)(!1),[x,h]=(0,A.useState)(null);async function f(){p(!0),h(null);try{u(await _.p.get(e.id,n,c))}catch(e){h(e instanceof Error?e.message:"Could not run it")}finally{p(!1)}}let b=eU(s),g=n.trim()?b.parse(n,e.baseUrl):null,y=b.language?function(e){let t=/[?&]q=([^&]*)/.exec(e);if(!t)return"";try{return decodeURIComponent(t[1].replace(/\+/g," "))}catch{return t[1]}}(n):n,j=d?"string"==typeof d.body?d.body:JSON.stringify(d.body,null,2):"";return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 py-3 lg:px-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-mute",title:e.baseUrl,children:b.language??"GET …/"}),(0,t.jsx)("input",{"aria-label":"Query",value:y,onChange:e=>{let t;return t=e.target.value,a(b.pathForText?b.pathForText(t,n):t)},onKeyDown:e=>"Enter"===e.key&&void f(),className:"input min-w-0 flex-1 font-mono text-[13px]",spellCheck:!1}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary py-1.5 text-sm",onClick:()=>void f(),disabled:m||!n.trim(),children:[m?(0,t.jsx)(v.f,{size:14,className:"animate-spin"}):(0,t.jsx)(ey.f,{size:14}),"Run"]})]}),(0,t.jsxs)("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-mute",children:["SuiteQL"===b.language?(0,t.jsxs)("span",{children:["Any SuiteQL query: ",(0,t.jsx)("span",{className:"font-mono",children:"SELECT … FROM … WHERE … ORDER BY …"})," — rows come ","1,000"," a page at most."]}):"SOQL"===b.language?(0,t.jsxs)("span",{children:["Any SOQL query: ",(0,t.jsx)("span",{className:"font-mono",children:"SELECT … FROM … WHERE … ORDER BY … LIMIT …"}),", parent fields like ",(0,t.jsx)("span",{className:"font-mono",children:"Owner.Name"}),"."]}):(0,t.jsxs)("span",{children:["Any OData query under the service root: ",(0,t.jsx)("span",{className:"font-mono",children:"$select"}),", ",(0,t.jsx)("span",{className:"font-mono",children:"$filter"}),", ",(0,t.jsx)("span",{className:"font-mono",children:"$expand"}),", ",(0,t.jsx)("span",{className:"font-mono",children:"$orderby"}),", ",(0,t.jsx)("span",{className:"font-mono",children:"$top"}),"."]}),g?(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>l(g.entitySet,g),children:"Fill Records from this"}):null]}),n.trim()?(0,t.jsx)(e7,{url:/^https?:\/\//i.test(n.trim())?n.trim():(r=e.baseUrl,o=n.trim(),`${r.replace(/\/+$/,"")}/${o.replace(/^\/+/,"")}`)}):null,x?(0,t.jsx)("p",{role:"alert",className:"text-sm text-bad",children:x}):null,d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"text-xs",children:[(0,t.jsx)("span",{className:`font-mono ${d.status>=200&&d.status<300?"text-ok":"text-bad"}`,children:d.status||"ERR"}),(0,t.jsxs)("span",{className:"text-mute",children:[" · ",d.ms," ms"]}),d.error?(0,t.jsxs)("span",{className:"text-ink",children:[" · ",[d.error,d.hint].filter(Boolean).join(" — ")]}):null]}),(0,t.jsx)("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-line bg-panel-2 p-3 font-mono text-xs text-ink",children:j.length>3e5?`${j.slice(0,3e5)}
3
+ …`:j})]}):null]})}var tn=e.i(39170),ta=e.i(17847);function tl({onAdd:e}){return(0,t.jsxs)("div",{className:"flex flex-1 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)($.f,{size:22,strokeWidth:1.75,"aria-hidden":!0})}),(0,t.jsx)("h2",{className:"mt-4 text-base font-medium text-ink",children:"Connect a system"}),(0,t.jsxs)("p",{className:"mt-2 max-w-md text-sm text-mute",children:["Set a system up once — its address and sign-in — and every request that starts with its variable, like ","{{successFactors}}","/User, uses it. For SAP SuccessFactors and other OData services, browse objects, fields and records too."]}),(0,t.jsx)("div",{className:"mt-6 flex flex-wrap justify-center gap-2",children:(0,t.jsxs)("button",{type:"button",className:"btn btn-primary text-sm",onClick:e,children:[(0,t.jsx)(k.f,{size:14}),"Add connection"]})}),(0,t.jsxs)("p",{className:"mt-3 text-xs text-mute",children:["No system at hand? Pick ",(0,t.jsx)("span",{className:"text-ink",children:"Practice company"})," in Add connection."]})]})}function ti({connection:e}){let s=/\/demo-api\/(odata|salesforce|netsuite)(\/|$)/.test(e.baseUrl)?j.f:"successfactors"===e.kind?h:g;return(0,t.jsx)(s,{size:15,className:"shrink-0 text-accent","aria-hidden":!0})}function tr({connection:e,active:s,open:n,onToggle:l,onOpen:i,onEdit:r,onRefresh:o,onDelete:c,children:d}){let[u,m]=(0,A.useState)(!1),p=(0,A.useRef)(null),x=e.baseUrl;try{x=new URL(e.baseUrl).host}catch{}return(0,t.jsxs)("div",{className:"mb-1",children:[(0,t.jsxs)("div",{className:`group flex items-center gap-1 rounded-md pr-1 ${s?"bg-accent-dim":"hover:bg-panel-2"}`,children:[a.o.includes(e.kind)?(0,t.jsx)("button",{type:"button","aria-label":n?`Hide the objects of ${e.name}`:`Show the objects of ${e.name}`,"aria-expanded":n,onClick:l,className:"ml-1 rounded p-0.5 text-mute hover:text-ink",children:(0,t.jsx)(f.f,{size:14,className:`transition-transform ${n?"rotate-90":""}`})}):(0,t.jsx)("span",{className:"ml-1 w-[18px]"}),(0,t.jsxs)("button",{type:"button",onClick:i,"aria-current":s?"true":void 0,className:"flex min-w-0 flex-1 items-center gap-2 py-2 pr-2 pl-1 text-left",children:[(0,t.jsx)(ti,{connection:e}),(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 text-xs text-mute",children:[(0,t.jsx)("span",{className:"font-mono text-ink/80",children:`{{${e.variable}}}`})," · ",_.U[e.kind]," · ",x]})]})]}),(0,t.jsx)("button",{ref:p,type:"button","aria-label":`Actions for ${e.name}`,onClick:()=>m(!0),className:"rounded p-1 text-mute opacity-60 group-hover:opacity-100 hover:text-ink focus:opacity-100",children:(0,t.jsx)(N.f,{size:15})}),(0,t.jsxs)(eN.f,{anchor:p,open:u,onClose:()=>m(!1),label:`Actions for ${e.name}`,width:220,role:"menu",children:[(0,t.jsx)(ta.d,{icon:w.f,label:"Edit",onSelect:()=>(m(!1),r())}),a.o.includes(e.kind)?(0,t.jsx)(ta.d,{icon:S.f,label:"Read objects again",onSelect:()=>(m(!1),i(),o())}):null,(0,t.jsx)(ta.Z,{}),(0,t.jsx)(ta.d,{icon:E.f,label:"Delete",danger:!0,onSelect:()=>(m(!1),c())})]})]}),d]})}function to({sets:e,selected:s,onSelect:n}){let[a,l]=(0,A.useState)(""),i=(0,A.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.label??"").toLowerCase().includes(t)):e},[e,a]);return(0,t.jsxs)("div",{className:"ml-4 border-l border-line py-1 pl-2",children:[e.length>8?(0,t.jsxs)("label",{className:"relative mb-1 block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Find an object"}),(0,t.jsx)(C.f,{size:13,className:"pointer-events-none absolute top-1/2 left-2 -translate-y-1/2 text-mute","aria-hidden":!0}),(0,t.jsx)("input",{value:a,onChange:e=>l(e.target.value),placeholder:`Find among ${e.length} objects`,className:"input py-1 pl-7 text-xs"})]}):null,(0,t.jsxs)("ul",{"aria-label":"Objects",children:[i.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>n(e.name),"aria-current":s===e.name?"true":void 0,className:`flex w-full items-baseline gap-2 rounded px-2 py-1 text-left ${s===e.name?"bg-accent-dim text-ink":"text-ink hover:bg-panel-2"}`,children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:e.label&&e.label!==e.name?e.label:e.name}),e.label&&e.label!==e.name?(0,t.jsx)("span",{className:"max-w-[45%] shrink-0 truncate font-mono text-[11px] text-mute",children:e.name}):null]})},e.name)),i.length?null:(0,t.jsx)("li",{className:"px-2 py-1 text-xs text-mute",children:"Nothing matches."})]})]})}function tc({connection:e,schema:s}){let n=(0,L.useRouter)(),i=s?.schema.entitySets[0]?.name??"",r=a.o.includes(e.kind)?s?.schema.suiteql?u(`SELECT * FROM ${i||"customer"}`,{top:10}):s?.schema.soql?`services/data/${s.schema.soql.apiVersion}/query?q=${encodeURIComponent(`SELECT Id FROM ${i||"Account"} LIMIT 10`)}`:i:"",o=s?.schema.suiteql?`{{${e.variable}}}/${l} { "q": "SELECT * FROM ${i||"customer"}" }`:`{{${e.variable}}}/${"salesforce"===e.kind?decodeURIComponent(r):r}`;return(0,t.jsxs)("div",{className:"max-w-2xl space-y-5 px-6 py-8 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium text-ink",children:e.name}),(0,t.jsx)("p",{className:"mt-0.5 font-mono text-xs break-all text-mute",children:e.baseUrl})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-line p-4",children:[(0,t.jsx)("h3",{className:"font-medium text-ink",children:"Use it in any request"}),(0,t.jsxs)("p",{className:"mt-1 text-mute",children:["Start the address with ",(0,t.jsx)("span",{className:"font-mono text-ink",children:`{{${e.variable}}}`})," and leave ",(0,t.jsx)("span",{className:"text-ink",children:"Auth"})," on"," ",(0,t.jsx)("span",{className:"text-ink",children:"From folder or connection"})," (the default). The request is sent to ",e.baseUrl.replace(/^https?:\/\//,"")," with this connection's"," ","none"===e.settings.auth.authMode?"headers":"sign-in and headers"," — nothing to type again. Change the sign-in here once, and every such request follows."]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("code",{className:"rounded bg-panel-2 px-2 py-1 font-mono text-xs text-ink",children:["GET ",o]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:()=>eM(e,r,n),children:[(0,t.jsx)(y.f,{size:13}),"New request"]})]})]}),s?(0,t.jsxs)("p",{className:"text-mute",children:[s.schema.entitySets.length," objects, OData ",s.schema.version,". Pick one on the left to see its records and fields.",(0,t.jsxs)("span",{className:"mt-2 block text-xs",children:["Read ",new Date(s.fetchedAt).toLocaleString()," · ⋯ → Read objects again, after the system changes."]})]}):null]})}e.s(["ConnectionsPage",0,function(){let e=(0,n.K)("connections"),l=(0,ek.d)(),i=(0,tn.L)(),{vars:r}=(0,K.U)(),[o,c]=(0,A.useState)(null),[d,u]=(0,A.useState)(null),[m,p]=(0,eq.C)("connections:active",null),[x,h]=(0,eq.C)("connections:schema",null),[f,b]=(0,A.useState)(null),[g,y]=(0,A.useState)(!1),[j,N]=(0,eq.C)("connections:object",null),[w,$]=(0,eq.C)("connections:opened",{nonce:0}),S=(e,t)=>{N(e),$(e=>({query:t,nonce:e.nonce+1}))},[C,E]=(0,A.useState)(null),[L,O]=(0,eq.C)("connections:expanded",()=>new Set),T=(e,t)=>O(s=>{let n=new Set(s);return t??!n.has(e)?n.add(e):n.delete(e),n}),R=o?.find(e=>e.id===m)??null;async function U(e,t=!1){let s=o?.find(t=>t.id===e);if(!s||a.o.includes(s.kind)){y(!0),b(null);try{let s=await _.p.schema(e,r,t);h({id:e,...s}),t&&l(`Read again — ${s.schema.entitySets.length} objects`,"success")}catch(e){b(e instanceof Error?e.message:"Could not read what the service offers")}finally{y(!1)}}}(0,A.useEffect)(()=>{_.p.list().then(e=>{c(e),p(t=>t??e[0]?.id??null)}).catch(e=>u(e instanceof Error?e.message:"Can't reach the engine"))},[]);let I=(0,A.useRef)(m);async function D(e){if(await i({title:`Delete ${e.name}?`,body:"The connection and its saved password are removed from this project. Nothing changes in the system itself.",confirmLabel:"Delete",tone:"danger"}))try{await _.p.remove(e.id),c(t=>(t??[]).filter(t=>t.id!==e.id)),m===e.id&&p(null),l(`Deleted ${e.name}`,"success")}catch(e){l(e instanceof Error?e.message:"Could not delete","error")}}(0,A.useEffect)(()=>{I.current!==m&&(I.current=m,N(null)),b(null),m&&x?.id!==m&&(h(null),U(m))},[m,null===o]);let q=x?.id===m?x.schema.entitySets.find(e=>e.name===j):void 0,F=(0,A.useRef)(new Set);async function z(e){if(!(x?.schema.soql||x?.schema.suiteql)||F.current.has(`${x.id}/${e}`))return;let t=x.schema.entitySets.find(t=>t.name===e);if(!t||!1!==t.described)return;let s=`${x.id}/${e}`;F.current.add(s);try{let t=await _.p.describe(x.id,e,r);h(e=>e&&e.id===x.id?{...e,schema:{...e.schema,entitySets:e.schema.entitySets.map(e=>e.name===t.name?t:e)}}:e)}catch(t){l(t instanceof Error?t.message:`Could not read the fields of ${e}`,"error")}finally{F.current.delete(s)}}return(0,A.useEffect)(()=>{q?.described===!1&&z(q.name)},[q?.name,q?.described]),(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:"Connections"}),(0,t.jsx)("p",{className:"truncate text-xs text-mute",children:"Set a system up once — address and sign-in — and any request starting with its variable uses it. Browse OData systems' objects and records."})]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary py-1.5 text-sm",onClick:()=>E("new"),children:[(0,t.jsx)(k.f,{size:15}),"Add connection"]})]}),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.jsx)("p",{className:"mt-1",children:d})]}):null===o?(0,t.jsxs)("p",{className:"flex items-center gap-2 px-6 py-6 text-sm text-mute",children:[(0,t.jsx)(v.f,{size:14,className:"animate-spin"})," Loading…"]}):0===o.length?(0,t.jsx)(tl,{onAdd:()=>E("new")}):(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(16rem,20rem)_minmax(0,1fr)] lg:overflow-hidden",children:[(0,t.jsx)(s.f,{label:"Objects list width",...e.splitter}),(0,t.jsx)("nav",{"aria-label":"Connections and their objects",className:"flex min-h-0 flex-col border-line lg:border-r",children:(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:o.map(e=>(0,t.jsx)(tr,{connection:e,active:e.id===m,open:L.has(e.id),onToggle:()=>{p(e.id),T(e.id)},onOpen:()=>{e.id===m?T(e.id):(p(e.id),T(e.id,!0))},onEdit:()=>E(e),onRefresh:()=>void U(e.id,!0),onDelete:()=>void D(e),children:e.id===m&&L.has(e.id)?g&&!x?(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-3 text-xs text-mute",children:[(0,t.jsx)(v.f,{size:12,className:"animate-spin"})," Reading what it offers…"]}):f?(0,t.jsxs)("div",{role:"alert",className:"mx-2 my-2 rounded-md border border-bad/40 bg-bad/10 px-3 py-2 text-xs",children:[(0,t.jsx)("p",{className:"text-ink",children:f}),(0,t.jsx)("button",{type:"button",className:"mt-1.5 text-accent hover:underline",onClick:()=>void U(e.id,!0),children:"Try again"})]}):x?.id===e.id?(0,t.jsx)(to,{sets:x.schema.entitySets,selected:j,onSelect:e=>S(e)}):null:null},e.id))})}),(0,t.jsx)("section",{"aria-label":"Object",className:"flex min-h-0 min-w-0 flex-col",children:R&&q&&x?!1===q.described?(0,t.jsxs)("p",{className:"flex items-center gap-2 px-6 py-8 text-sm text-mute",children:[(0,t.jsx)(v.f,{size:14,className:"animate-spin"})," Reading the fields of ",q.label??q.name,"…"]}):(0,t.jsx)(e_,{memoryKey:`connections:${R.id}/${q.name}/${w.nonce}`,connection:R,schema:x.schema,set:q,initial:w.query,onOpenObject:S,onNeed:e=>void z(e)},`${R.id}/${q.name}/${w.nonce}`):R?(0,t.jsx)(tc,{connection:R,schema:x?.id===R.id?x:null}):null})]}),C?(0,t.jsx)(es,{editing:"new"===C?null:C,existing:o??[],onClose:()=>E(null),onSaved:e=>{c(t=>{let s=t??[];return s.some(t=>t.id===e.id)?s.map(t=>t.id===e.id?e:t):[...s,e]}),E(null),e.id===m?U(e.id,"new"!==C&&C.baseUrl!==e.baseUrl):p(e.id),"new"===C&&T(e.id,!0),l("new"===C?`Added ${e.name}`:`Saved ${e.name}`,"success")}}):null]})}],87946)}]);
@@ -0,0 +1,50 @@
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53356,e=>{var t=e.i(51487),s=e.i(32610),n=e.i(62766);e.i(24856);var r=e.i(2385),a=e.i(23986),l=e.i(56771),i=e.i(83668),o=e.i(49551),c=e.i(83035),d=e.i(59904),m=e.i(97424),u=e.i(86766),p=e.i(1326),h=e.i(62620),f=e.i(2552),x=e.i(53798),y=e.i(77306),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),$=e.i(88153);function T(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.F)(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.f,{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.E)(e.p95)]}),(0,t.jsxs)("span",{children:[(0,N.Z)(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.f,{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.f)(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.d)(),{refresh:i}=(0,S.K)(),[c,d]=(0,y.useState)(null),[u,h]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!e)return;let t=!1;return S.c.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.c.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.f,{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.f,{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.N,{runs:f,selectedId:e.id,onSelect:n}):null,u?(0,t.jsx)("p",{className:"text-sm text-bad",children:u}):c&&c.report.id===e.id?(0,t.jsx)(g.f,{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)(m.f,{size:14,className:"animate-spin"})," Opening…"]})]})}function z({summary:e,onDelete:s,onReveal:n}){let a=(0,j.d)(),{slo:l}=(0,$.G)(),{refresh:i}=(0,S.K)(),[d,u]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!e)return;let t=!1;return S.c.compare(e.id).then(e=>!t&&u(e)).catch(()=>void 0),()=>{t=!0}},[e?.id,e?.bytes]),!e)return null;async function h(t){try{await S.c.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.f,{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.f,{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.f,{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.f)(s)},"aria-hidden":!0}),(0,t.jsx)("span",{className:"truncate",children:e.title})]}),(0,t.jsx)(b.VerdictTag,{level:(0,r.s)(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.E)(e.report.summary.latencyMs.p95)]}),(0,t.jsxs)("span",{children:[(0,N.Z)(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)(m.f,{size:14,className:"animate-spin"})," Opening…"]})]})}function L({index:e,onChanged:s,onReveal:n}){let r=(0,w.L)(),l=(0,j.d)();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.f,{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.c.remove({invalid:e.invalid.map(({folder:e,file:t})=>({folder:e,file:t}))}),await s(),l("Unreadable files deleted","success"))},children:"Delete them"})]})]})}function D({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 R(){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.f,{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.f,{size:14}),"Test an API"]}),(0,t.jsxs)(f.default,{href:"/compare",className:"btn btn-secondary text-sm",children:[(0,t.jsx)(c.f,{size:14}),"Compare APIs"]})]})]})}e.s(["default",0,function(){let e=(0,n.K)("history",{min:280}),r=(0,x.useRouter)(),a=(0,j.d)(),l=(0,w.L)(),{slo:i}=(0,$.G)(),{index:d,loading:f,error:v,refresh:b}=(0,S.K)(),[g,C]=(0,y.useState)(""),[F,M]=(0,y.useState)("all"),[A,q]=(0,y.useState)(null),[U,O]=(0,y.useState)(new Set),[P,H]=(0,y.useState)(!1),V=d?.runs??[],W=d?.compares??[],B=(0,y.useMemo)(()=>{let e=g.trim().toLowerCase();return[..."compares"===F?[]:V.filter(e=>"baselines"!==F||e.baseline),..."runs"===F||"baselines"===F?[]:W].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(t))-Date.parse(T(e)))},[V,W,g,F]);(0,y.useEffect)(()=>{if(d&&!(A&&("run"===A.kind?V.some(e=>e.id===A.id):W.some(e=>e.id===A.id)))){let e=B[0];q(e?{kind:e.kind,id:e.id}:null)}},[d]);let K=[...U].filter(e=>e.startsWith("run:")).map(e=>e.slice(4)),J=[...U].filter(e=>e.startsWith("compare:")).map(e=>e.slice(8));async function X(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.c.remove({runs:e,compares:t});O(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.c.reveal(e)}catch(e){a(e instanceof Error?e.message:"Could not open the folder","error")}}let Z=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(T(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]}(B);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 ${W.length} ${1===W.length?"compare":"compares"} \xb7 ${(0,N.L)(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.f,{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.f,{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)(u.f,{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.f,{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"}]})]}),U.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:[U.size," selected"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary ml-auto py-1 text-xs",disabled:K.length<2||K.length>6||J.length>0,title:K.length<2?"Tick 2–6 performance tests to overlay them":"Overlay these runs on Compare",onClick:()=>r.push(`/compare?ids=${K.join(",")}`),children:[(0,t.jsx)(c.f,{size:13}),"Overlay"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1 text-xs",disabled:P,onClick:()=>void X(K,J),children:[(0,t.jsx)(p.f,{size:13}),"Delete"]}),(0,t.jsx)("button",{type:"button","aria-label":"Clear selection",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>O(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)(L,{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)(m.f,{size:14,className:"animate-spin"})," Reading your history folder…"]}):0===B.length?(0,t.jsx)(D,{filtered:!!g||"all"!==F,hasAny:V.length+W.length>0}):Z.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=A?.kind===e.kind&&A.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:U.has(s),onChange:()=>{let t;return t=`${e.kind}:${e.id}`,void O(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:()=>q({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:A?.kind==="run"?(0,t.jsx)(I,{summary:V.find(e=>e.id===A.id),related:V,onSelect:e=>q({kind:"run",id:e}),onDelete:e=>void X([e],[]),onReveal:e=>void Y({folder:"runs",id:e})},A.id):A?.kind==="compare"?(0,t.jsx)(z,{summary:W.find(e=>e.id===A.id),onDelete:e=>void X([],[e]),onReveal:e=>void Y({folder:"compares",id:e})},A.id):d?(0,t.jsx)(R,{}):null})]})]})}])},37837,e=>{var t=e.i(51487),s=e.i(77306),n=e.i(30597),r=e.i(14865);e.s(["f",0,function({anchor:e,open:a,onClose:l,children:i,label:o,width:c=280,role:d="dialog"}){let m=(0,s.useRef)(null),[u,p]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{if(!a)return;let t=()=>{if(!e.current)return;let t=(0,r.C)(e.current),s=(0,r.v)(),n=m.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;m.current?.contains(s)||e.current?.contains(s)||l()},s=t=>{"Escape"===t.key&&(t.stopPropagation(),l(),e.current?.focus())},n=e=>{m.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(()=>m.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,n.createPortal)((0,t.jsx)("div",{ref:m,role:d,"aria-label":o,style:{top:u?.top??-9999,left:u?.left??-9999,width:c,maxHeight:u?.maxHeight},className:"anim-pop fixed z-[70] overflow-auto rounded-lg border border-line bg-panel p-3 shadow-2xl",children:i}),document.body)}])},32610,e=>{var t=e.i(51487),s=e.i(77306);e.s(["f",0,function({orientation:e,label:n,value:r,onMove:a,onStep:l,onReset:i,onDragging:o,className:c="",style:d}){let[m,u]=(0,s.useState)(!1);(0,s.useEffect)(()=>o?.(m),[m,o]),(0,s.useEffect)(()=>{if(!m)return;let t=e=>a(e.clientX,e.clientY),s=()=>u(!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)}},[m,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(),u(!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 ${m?"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=>{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.s)(e,{slo:r}),c=(0,n.v)(r),m=(0,t.$)(l,(0,t.L)(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.E)(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}],...m.map((e,s)=>[{v:`chart_${s+1}`},{v:`${e.w}x${e.h}`},{v:t.p[e.id],s:a.desc}])]},{name:"Second by second",rows:[s.V.map(e=>({v:e.header,s:a.header})),...e.buckets.map(e=>(0,s.u)(e).map((e,t)=>{let n=s.V[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.f)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"a",0,c,"F",0,d])},62766,e=>{var t=e.i(77306);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(["K",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}`,[m,u]=(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&&u(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))));u(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!==m?{gridTemplateColumns:`${m}px minmax(0,1fr)`}:void 0,splitter:{orientation:"vertical",value:(m??p)/Math.max(1,x()?.width??1)*100,onMove:e=>{let t=x();t&&f(e-t.left)},onStep:(e,t)=>f((m??p)+16*e*(t?4:1)),onReset:()=>f(null),className:"absolute inset-y-0 -translate-x-1/2",style:{left:`${p}px`}}}},"f",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 m=(0,t.useCallback)(e=>{d(t=>{let n={...t,...e};try{localStorage.setItem(s,JSON.stringify(n))}catch{}return n})},[]),u=n(c.panel??(i?256:240),180,480),p=a?u: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&&m({panel:n(e-t.left,180,Math.min(480,.4*t.width))})},[m]),v=(0,t.useCallback)((t,s)=>{let r=x();r&&("below"===e?m({below:n((s-r.top)/r.height,.2,.8)}):m({beside:n((t-r.left-p)/Math.max(1,r.width-p),.2,.8)}))},[m,e,p]);return{wide:l,gridRef:o,gridStyle:f,panelWidth:l?u:void 0,panel:{value:u/480*100,onMove:e=>y(e),onStep:(e,t)=>m({panel:n(u+16*e*(t?4:1),180,480)}),onReset:()=>m({panel:null}),style:{left:`${p}px`}},split:{value:100*h,onMove:v,onStep:(t,s)=>m("below"===e?{below:n(h+.02*t*(s?5:1),.2,.8)}:{beside:n(h+.02*t*(s?5:1),.2,.8)}),onReset:()=>m("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=>{e.s(["f",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(51487),s=e.i(77306),n=e.i(30597),r=e.i(14865);e.s(["c",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.v)();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)},"d",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]})},"U",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})},"Z",0,function(){return(0,t.jsx)("div",{role:"separator",className:"my-1 h-px bg-line"})}],17847)},17219,e=>{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(["f",0,function(e){let a=new TextEncoder,l=[],i=[],o=0;for(let[c,d]of Object.entries(e)){let e=a.encode(c),m="string"==typeof d?a.encode(d):d,u=function(e){let s=0xffffffff;for(let n of e)s=t[(s^n)&255]^s>>>8;return(0xffffffff^s)>>>0}(m),p=r([n(0x4034b50),s(20),s(0),s(0),s(0),s(0),n(u),n(m.length),n(m.length),s(e.length),s(0),e,m]),h=r([n(0x2014b50),s(20),s(20),s(0),s(0),s(0),s(0),n(u),n(m.length),n(m.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)]),m=r([...l,c,d]);return new Blob([m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)],{type:"application/zip"})}])},32035,e=>{var t=e.i(56003);let s={name:"bell-off",size:24,node:[["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"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],32035)},90632,e=>{var t=e.i(56003);let s={name:"columns-3",size:24,node:[["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"}]],aliases:["panels-left-right"]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],90632)},61318,e=>{var t=e.i(56003);let s={name:"ellipsis",size:24,node:[["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"}]],aliases:["more-horizontal"]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],61318)},80714,e=>{var t=e.i(56003);let s={name:"pencil",size:24,node:[["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"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],80714)},92368,e=>{var t=e.i(56003);let s={name:"play",size:24,node:[["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"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],92368)},13817,e=>{var t=e.i(56003);let s={name:"save",size:24,node:[["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"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],13817)},47298,14168,e=>{var t=e.i(56003);let s={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};s.node;let n=(0,t.f)(s);async function r(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Engine error (${e.status})`);return t}e.s(["f",0,n],47298);let a=(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(["Y",0,{plan:e=>fetch(`/engine/suites/plan?collection=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>r(e)),savePlan:(e,t)=>a("PUT","/engine/suites/plan",{collection:e,...t}).then(e=>r(e)),start:e=>a("POST","/engine/suites/runs",e).then(e=>r(e)),get:e=>fetch(`/engine/suites/runs/${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>r(e)),stop:e=>a("POST",`/engine/suites/runs/${encodeURIComponent(e)}/stop`).then(e=>r(e))},"W",0,function(e){return`/suite?c=${encodeURIComponent(e)}`}],14168)},36558,e=>{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(["V",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."}],"u",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)]},"E",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}])}])})();