locust-cloud 1.5.8__py3-none-any.whl → 1.5.9__py3-none-any.whl
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.
- locust_cloud/cloud.py +33 -21
- locust_cloud/timescale/queries.py +1 -1
- locust_cloud/webui/dist/assets/{index-EqSfuHMz.js → index-CgjytB1w.js} +1 -1
- locust_cloud/webui/dist/index.html +1 -1
- locust_cloud/webui/tsconfig.tsbuildinfo +1 -1
- {locust_cloud-1.5.8.dist-info → locust_cloud-1.5.9.dist-info}/METADATA +1 -1
- {locust_cloud-1.5.8.dist-info → locust_cloud-1.5.9.dist-info}/RECORD +9 -9
- {locust_cloud-1.5.8.dist-info → locust_cloud-1.5.9.dist-info}/WHEEL +0 -0
- {locust_cloud-1.5.8.dist-info → locust_cloud-1.5.9.dist-info}/entry_points.txt +0 -0
locust_cloud/cloud.py
CHANGED
@@ -64,22 +64,28 @@ parser = configargparse.ArgumentParser(
|
|
64
64
|
configargparse.DefaultConfigFileParser,
|
65
65
|
]
|
66
66
|
),
|
67
|
-
description="""Launches distributed Locust runs on locust.cloud infrastructure.
|
67
|
+
description="""Launches a distributed Locust runs on locust.cloud infrastructure.
|
68
68
|
|
69
|
-
Example: locust-cloud -f my_locustfile.py --
|
69
|
+
Example: locust-cloud -f my_locustfile.py --users 1000 ...""",
|
70
70
|
epilog="""Any parameters not listed here are forwarded to locust master unmodified, so go ahead and use things like --users, --host, --run-time, ...
|
71
71
|
Locust config can also be set using config file (~/.locust.conf, locust.conf, pyproject.toml, ~/.cloud.conf or cloud.conf).
|
72
72
|
Parameters specified on command line override env vars, which in turn override config files.""",
|
73
73
|
add_config_file_help=False,
|
74
74
|
add_env_var_help=False,
|
75
|
+
add_help=False,
|
76
|
+
)
|
77
|
+
parser.add_argument(
|
78
|
+
"-h",
|
79
|
+
"--help",
|
80
|
+
action="help",
|
81
|
+
help=configargparse.SUPPRESS,
|
75
82
|
)
|
76
|
-
|
77
83
|
parser.add_argument(
|
78
84
|
"-f",
|
79
85
|
"--locustfile",
|
80
86
|
metavar="<filename>",
|
81
87
|
default="locustfile.py",
|
82
|
-
help="The Python file
|
88
|
+
help="The Python file that contains your test. Defaults to 'locustfile.py'.",
|
83
89
|
env_var="LOCUST_LOCUSTFILE",
|
84
90
|
)
|
85
91
|
parser.add_argument(
|
@@ -90,29 +96,37 @@ parser.add_argument(
|
|
90
96
|
help="Number of users to launch. This is the same as the regular Locust argument, but also affects how many workers to launch.",
|
91
97
|
env_var="LOCUST_USERS",
|
92
98
|
)
|
93
|
-
parser.
|
99
|
+
advanced = parser.add_argument_group("advanced")
|
100
|
+
advanced.add_argument(
|
101
|
+
"--loglevel",
|
102
|
+
"-L",
|
103
|
+
type=str,
|
104
|
+
help="Set --loglevel DEBUG for extra info.",
|
105
|
+
default="INFO",
|
106
|
+
)
|
107
|
+
advanced.add_argument(
|
94
108
|
"--requirements",
|
95
109
|
type=str,
|
96
110
|
help="Optional requirements.txt file that contains your external libraries.",
|
97
111
|
)
|
98
|
-
|
112
|
+
advanced.add_argument(
|
99
113
|
"--region",
|
100
114
|
type=str,
|
101
115
|
default=os.environ.get("AWS_DEFAULT_REGION", DEFAULT_REGION_NAME),
|
102
116
|
help="Sets the AWS region to use for the deployed cluster, e.g. us-east-1. It defaults to use AWS_DEFAULT_REGION env var, like AWS tools.",
|
103
117
|
)
|
104
|
-
|
118
|
+
advanced.add_argument(
|
105
119
|
"--kube-cluster-name",
|
106
120
|
type=str,
|
107
121
|
default=DEFAULT_CLUSTER_NAME,
|
108
|
-
help=
|
122
|
+
help=configargparse.SUPPRESS,
|
109
123
|
env_var="KUBE_CLUSTER_NAME",
|
110
124
|
)
|
111
|
-
|
125
|
+
advanced.add_argument(
|
112
126
|
"--kube-namespace",
|
113
127
|
type=str,
|
114
128
|
default=DEFAULT_NAMESPACE,
|
115
|
-
help=
|
129
|
+
help=configargparse.SUPPRESS,
|
116
130
|
env_var="KUBE_NAMESPACE",
|
117
131
|
)
|
118
132
|
parser.add_argument(
|
@@ -138,26 +152,19 @@ parser.add_argument(
|
|
138
152
|
parser.add_argument(
|
139
153
|
"--username",
|
140
154
|
type=str,
|
141
|
-
help=
|
155
|
+
help=configargparse.SUPPRESS,
|
142
156
|
default=os.getenv("LOCUST_CLOUD_USERNAME", None), # backwards compatitibility for dmdb
|
143
157
|
)
|
144
158
|
parser.add_argument(
|
145
159
|
"--password",
|
146
160
|
type=str,
|
147
|
-
help=
|
161
|
+
help=configargparse.SUPPRESS,
|
148
162
|
default=os.getenv("LOCUST_CLOUD_PASSWORD", None), # backwards compatitibility for dmdb
|
149
163
|
)
|
150
|
-
parser.add_argument(
|
151
|
-
"--loglevel",
|
152
|
-
"-L",
|
153
|
-
type=str,
|
154
|
-
help="Log level",
|
155
|
-
default="INFO",
|
156
|
-
)
|
157
164
|
parser.add_argument(
|
158
165
|
"--workers",
|
159
166
|
type=int,
|
160
|
-
help=f"Number of workers to use for the deployment. Defaults to number of users divided by {USERS_PER_WORKER}",
|
167
|
+
help=f"Number of workers to use for the deployment. Defaults to number of users divided by {USERS_PER_WORKER}.",
|
161
168
|
default=None,
|
162
169
|
)
|
163
170
|
parser.add_argument(
|
@@ -230,6 +237,7 @@ def main() -> None:
|
|
230
237
|
return
|
231
238
|
|
232
239
|
logger.info(f"Uploading {options.locustfile}")
|
240
|
+
logger.debug(f"... to {s3_bucket}")
|
233
241
|
s3 = credential_manager.session.client("s3")
|
234
242
|
try:
|
235
243
|
s3.upload_file(options.locustfile, s3_bucket, os.path.basename(options.locustfile))
|
@@ -318,6 +326,9 @@ def main() -> None:
|
|
318
326
|
except CredentialError as ce:
|
319
327
|
logger.error(f"Credential error: {ce}")
|
320
328
|
sys.exit(1)
|
329
|
+
except KeyboardInterrupt:
|
330
|
+
logger.debug("Interrupted by user")
|
331
|
+
sys.exit(0)
|
321
332
|
|
322
333
|
log_group_name = f"/eks/{options.kube_cluster_name}-{options.kube_namespace}"
|
323
334
|
master_pod_name = next((pod for pod in deployed_pods if "master" in pod), None)
|
@@ -410,9 +421,10 @@ def delete(s3_bucket, credential_manager):
|
|
410
421
|
)
|
411
422
|
|
412
423
|
if response.status_code != 200:
|
413
|
-
logger.
|
424
|
+
logger.info(
|
414
425
|
f"Could not automatically tear down Locust Cloud: HTTP {response.status_code}/{response.reason} - Response: {response.text} - URL: {response.request.url}"
|
415
426
|
)
|
427
|
+
logger.debug(response.json()["message"])
|
416
428
|
except Exception as e:
|
417
429
|
logger.error(f"Could not automatically tear down Locust Cloud: {e.__class__.__name__}:{e}")
|
418
430
|
|
@@ -261,7 +261,7 @@ total_runtime = """
|
|
261
261
|
SELECT
|
262
262
|
SUM((end_time - id) * num_users) AS "totalVuh"
|
263
263
|
FROM testruns
|
264
|
-
WHERE id >= date_trunc('month', NOW())
|
264
|
+
WHERE id >= date_trunc('month', NOW()) AND NOT refund
|
265
265
|
"""
|
266
266
|
|
267
267
|
queries: dict["str", LiteralString] = {
|
@@ -267,7 +267,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
267
267
|
<span style="color:${f};">
|
268
268
|
${h}: ${zpt({chartValueFormatter:i,value:d})}
|
269
269
|
</span>
|
270
|
-
`,""):"No data",borderWidth:0},xAxis:{type:"time",startValue:(e.time||[""])[0],axisLabel:{formatter:Npt}},grid:{left:60,right:40},yAxis:Opt({splitAxis:a,yAxisLabels:o}),series:gbe({charts:e,lines:r,scatterplot:s}),color:n,toolbox:{right:10,feature:{dataZoom:{title:{zoom:"Zoom Select",back:"Zoom Reset"},yAxisIndex:!1},saveAsImage:{name:t.replace(/\s+/g,"_").toLowerCase()+"_"+new Date().getTime()/1e3,title:"Download as PNG",emphasis:{iconStyle:{textPosition:"left"}}}}}}),Fpt=(e,t)=>({symbol:"none",label:{formatter:r=>`Run #${r.dataIndex+1}`,padding:[0,0,8,0]},lineStyle:{color:t?XA.DARK.axisColor:XA.LIGHT.axisColor},data:(e.markers||[]).map(r=>({xAxis:r}))}),Vpt=e=>t=>{const{batch:r}=t;if(!r)return;const[{start:n,startValue:i,end:a}]=r,o=n>0&&a<=100||i>0;e.setOption({dataZoom:[{type:"slider",show:o}]})};function Rl({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s}){const[l,u]=B.useState(null),c=hs(({theme:{isDarkMode:h}})=>h),f=B.useRef(null);return B.useEffect(()=>{if(!f.current)return;const h=wJe(f.current);h.setOption(Bpt({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s})),h.on("datazoom",Vpt(h));const d=()=>h.resize();return window.addEventListener("resize",d),h.group="swarmCharts",CJe("swarmCharts"),u(h),()=>{TJe(h),window.removeEventListener("resize",d)}},[f]),B.useEffect(()=>{const h=r.every(({key:d})=>!!e[d]);l&&h&&l.setOption({series:r.map(({key:d,yAxisIndex:p,...v},g)=>({...v,data:e[d],...a?{yAxisIndex:p||g}:{},...g===0?{markLine:Fpt(e,c)}:{}}))})},[e,l,r,c]),B.useEffect(()=>{if(l){const{textColor:h,axisColor:d,backgroundColor:p,splitLine:v}=c?XA.DARK:XA.LIGHT;l.setOption({backgroundColor:p,textStyle:{color:h},title:{textStyle:{color:h}},legend:{icon:"circle",inactiveColor:h,textStyle:{color:h}},tooltip:{backgroundColor:p,textStyle:{color:h}},xAxis:{axisLine:{lineStyle:{color:d}}},yAxis:{axisLine:{lineStyle:{color:d}},splitLine:{lineStyle:{color:v}}}})}},[l,c]),B.useEffect(()=>{l&&l.setOption({series:gbe({charts:e,lines:r,scatterplot:s})})},[r]),H.jsx("div",{ref:f,style:{width:"100%",height:"300px"}})}const $pt=ru.percentilesToChart?ru.percentilesToChart.map(e=>({name:`${e*100}th percentile`,key:`responseTimePercentile${e}`})):[],Gpt=["#ff9f00","#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],Wpt=[{title:"Total Requests per Second",lines:[{name:"RPS",key:"currentRps"},{name:"Failures/s",key:"currentFailPerSec"}],colors:["#00ca5a","#ff6d6d"]},{title:"Response Times (ms)",lines:$pt,colors:Gpt},{title:"Number of Users",lines:[{name:"Number of Users",key:"userCount"}],colors:["#0099ff"]}];function Hpt({charts:e}){return H.jsx("div",{children:Wpt.map((t,r)=>H.jsx(Rl,{...t,charts:e},`swarm-chart-${r}`))})}const jpt=({ui:{charts:e}})=>({charts:e}),Upt=Oa(jpt)(Hpt);function Ypt(e){return(e*100).toFixed(1)+"%"}function TF({classRatio:e}){return H.jsx("ul",{children:Object.entries(e).map(([t,{ratio:r,tasks:n}])=>H.jsxs("li",{children:[`${Ypt(r)} ${t}`,n&&H.jsx(TF,{classRatio:n})]},`nested-ratio-${t}`))})}function Xpt({ratios:{perClass:e,total:t}}){return!e&&!t?null:H.jsxs("div",{children:[e&&H.jsxs(H.Fragment,{children:[H.jsx("h3",{children:"Ratio Per Class"}),H.jsx(TF,{classRatio:e})]}),t&&H.jsxs(H.Fragment,{children:[H.jsx("h3",{children:"Total Ratio"}),H.jsx(TF,{classRatio:t})]})]})}const qpt=({ui:{ratios:e}})=>({ratios:e}),Zpt=Oa(qpt)(Xpt),Kpt=[{key:"id",title:"Worker"},{key:"state",title:"State"},{key:"userCount",title:"# users"},{key:"cpuUsage",title:"CPU usage"},{key:"memoryUsage",title:"Memory usage",formatter:iWe}];function Qpt({workers:e=[]}){return H.jsx(bh,{defaultSortKey:"id",rows:e,structure:Kpt})}const Jpt=({ui:{workers:e}})=>({workers:e}),evt=Oa(Jpt)(Qpt),Os={stats:{component:OUe,key:"stats",title:"Statistics"},charts:{component:Upt,key:"charts",title:"Charts"},failures:{component:yUe,key:"failures",title:"Failures"},exceptions:{component:dUe,key:"exceptions",title:"Exceptions"},ratios:{component:Zpt,key:"ratios",title:"Current Ratio"},reports:{component:CUe,key:"reports",title:"Download Data"},logs:{component:bUe,key:jpe,title:"Logs"},workers:{component:evt,key:"workers",title:"Workers",shouldDisplayTab:e=>e.swarm.isDistributed}},ybe=[Os.stats,Os.charts,Os.failures,Os.exceptions,Os.ratios,Os.reports,Os.logs,Os.workers],tvt=e=>{const t=new URL(window.location.href);for(const[r,n]of Object.entries(e))t.searchParams.set(r,n);window.history.pushState(null,"",t)},rvt=()=>window.location.search?nWe(window.location.search):null,nvt={query:rvt()},mbe=Bo({name:"url",initialState:nvt,reducers:{setUrl:v1}}),ivt=mbe.actions,avt=mbe.reducer;function ovt({hasNotification:e,title:t}){return H.jsxs(Vt,{sx:{display:"flex",alignItems:"center"},children:[e&&H.jsx(BG,{color:"secondary"}),H.jsx("span",{children:t})]})}function svt({currentTabIndexFromQuery:e,notification:t,setNotification:r,setUrl:n,tabs:i}){const[a,o]=B.useState(e),s=(l,u)=>{const c=i[u].key;t[c]&&r({[c]:!1}),tvt({tab:c}),n({query:{tab:c}}),o(u)};return B.useEffect(()=>{o(e)},[e]),H.jsxs(Fv,{maxWidth:"xl",children:[H.jsx(Vt,{sx:{mb:2},children:H.jsx($Fe,{onChange:s,value:a,children:i.map(({key:l,title:u},c)=>H.jsx(G4e,{label:H.jsx(ovt,{hasNotification:t[l],title:u})},`tab-${c}`))})}),i.map(({component:l=uUe},u)=>a===u&&H.jsx(l,{},`tabpabel-${u}`))]})}const lvt=(e,{tabs:t,extendedTabs:r})=>{const{notification:n,swarm:{extendedTabs:i},url:{query:a}}=e,o=(t||[...ybe,...r||i||[]]).filter(({shouldDisplayTab:l})=>!l||l&&l(e)),s=a&&a.tab?o.findIndex(({key:l})=>l===a.tab):0;return{notification:n,tabs:o,currentTabIndexFromQuery:s>-1?s:0}},uvt={setNotification:Ype.setNotification,setUrl:ivt.setUrl},xbe=Oa(lvt,uvt)(svt),cvt=e=>q$({palette:{mode:e,primary:{main:"#15803d"},success:{main:"#00C853"}},components:{MuiCssBaseline:{styleOverrides:{":root":{"--footer-height":"40px"}}}}});function _be(){const e=hs(({theme:{isDarkMode:t}})=>t);return B.useMemo(()=>cvt(e?tu.DARK:tu.LIGHT),[e])}var Kte;const fvt={totalRps:0,failRatio:0,startTime:"",stats:[],errors:[],exceptions:[],charts:(Kte=ru.history)==null?void 0:Kte.reduce(vP,{}),ratios:{},userCount:0};var Qte;const hvt=(Qte=ru.percentilesToChart)==null?void 0:Qte.reduce((e,t)=>({...e,[`responseTimePercentile${t}`]:{value:null}}),{}),dvt=e=>vP(e,{...hvt,currentRps:{value:null},currentFailPerSec:{value:null},totalAvgResponseTime:{value:null},userCount:{value:null},time:""}),bbe=Bo({name:"ui",initialState:fvt,reducers:{setUi:v1,updateCharts:(e,{payload:t})=>({...e,charts:vP(e.charts,t)}),updateChartMarkers:(e,{payload:t})=>({...e,charts:{...dvt(e.charts),markers:e.charts.markers?[...e.charts.markers,t]:[(e.charts.time||[""])[0],t]}})}}),jb=bbe.actions,pvt=bbe.reducer;function Sbe(){const{data:e,refetch:t}=tHe(),r=ju(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;B.useEffect(()=>{e&&r({exceptions:e.exceptions})},[e]),yc(t,5e3,{shouldRunInterval:i})}const Jte=2e3;function wbe(){const e=ju(gP.setSwarm),t=ju(jb.setUi),r=ju(jb.updateCharts),n=ju(jb.updateChartMarkers),i=hs(({swarm:h})=>h),a=B.useRef(i.state),[o,s]=B.useState(!1),{data:l,refetch:u}=JWe(),c=i.state===ur.SPAWNING||i.state==ur.RUNNING,f=()=>{if(!l)return;const{currentResponseTimePercentiles:h,extendedStats:d,stats:p,errors:v,totalRps:g,totalFailPerSec:y,failRatio:m,workers:x,userCount:_,totalAvgResponseTime:S}=l,b=new Date().toISOString();o&&(s(!1),n(b));const w=Of(g,2),C=Of(y,2),T=Of(m*100),M={...Object.entries(h).reduce((I,[A,k])=>({...I,[A]:[b,k]}),{}),currentRps:[b,w],currentFailPerSec:[b,C],totalAvgResponseTime:[b,Of(S,2)],userCount:[b,_],time:b};t({extendedStats:d,stats:p,errors:v,totalRps:w,failRatio:T,workers:x,userCount:_}),r(M)};B.useEffect(()=>{l&&e({state:l.state})},[l&&l.state]),yc(f,Jte,{shouldRunInterval:!!l&&c}),yc(u,Jte,{shouldRunInterval:c}),B.useEffect(()=>{i.state===ur.RUNNING&&a.current===ur.STOPPED&&s(!0),a.current=i.state},[i.state,a])}function Cbe(){const{data:e,refetch:t}=eHe(),r=ju(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;B.useEffect(()=>{e&&r({ratios:e})},[e]),yc(t,5e3,{shouldRunInterval:i})}function vvt({swarmState:e,tabs:t,extendedTabs:r}){wbe(),Sbe(),Cbe(),Zpe();const n=_be();return H.jsxs(C6e,{theme:n,children:[H.jsx(_6e,{}),H.jsx(DHe,{children:e===ur.READY?H.jsx(NG,{}):H.jsx(xbe,{extendedTabs:r,tabs:t})})]})}const gvt=({swarm:{state:e}})=>({swarmState:e});Oa(gvt)(vvt);const yvt=bG({[XI.reducerPath]:XI.reducer,logViewer:NHe,notification:LHe,swarm:aHe,theme:JGe,ui:pvt,url:avt}),mvt=kGe({reducer:yvt,middleware:e=>e().concat(XI.middleware)});var MF={},ere=$6;MF.createRoot=ere.createRoot,MF.hydrateRoot=ere.hydrateRoot;function ti(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xvt=typeof Symbol=="function"&&Symbol.observable||"@@observable",tre=xvt,EN=()=>Math.random().toString(36).substring(7).split("").join("."),_vt={INIT:`@@redux/INIT${EN()}`,REPLACE:`@@redux/REPLACE${EN()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${EN()}`},qA=_vt;function a8(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Tbe(e,t,r){if(typeof e!="function")throw new Error(ti(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ti(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ti(1));return r(Tbe)(e,t)}let n=e,i=t,a=new Map,o=a,s=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((g,y)=>{o.set(y,g)}))}function c(){if(l)throw new Error(ti(3));return i}function f(g){if(typeof g!="function")throw new Error(ti(4));if(l)throw new Error(ti(5));let y=!0;u();const m=s++;return o.set(m,g),function(){if(y){if(l)throw new Error(ti(6));y=!1,u(),o.delete(m),a=null}}}function h(g){if(!a8(g))throw new Error(ti(7));if(typeof g.type>"u")throw new Error(ti(8));if(typeof g.type!="string")throw new Error(ti(17));if(l)throw new Error(ti(9));try{l=!0,i=n(i,g)}finally{l=!1}return(a=o).forEach(m=>{m()}),g}function d(g){if(typeof g!="function")throw new Error(ti(10));n=g,h({type:qA.REPLACE})}function p(){const g=f;return{subscribe(y){if(typeof y!="object"||y===null)throw new Error(ti(11));function m(){const _=y;_.next&&_.next(c())}return m(),{unsubscribe:g(m)}},[tre](){return this}}}return h({type:qA.INIT}),{dispatch:h,subscribe:f,getState:c,replaceReducer:d,[tre]:p}}function bvt(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:qA.INIT})>"u")throw new Error(ti(12));if(typeof r(void 0,{type:qA.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ti(13))})}function Mbe(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let i;try{bvt(r)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const u={};for(let c=0;c<n.length;c++){const f=n[c],h=r[f],d=o[f],p=h(d,s);if(typeof p>"u")throw s&&s.type,new Error(ti(14));u[f]=p,l=l||p!==d}return l=l||n.length!==Object.keys(o).length,l?u:o}}function ZA(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Svt(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ti(15))};const o={getState:i.getState,dispatch:(l,...u)=>a(l,...u)},s=e.map(l=>l(o));return a=ZA(...s)(i.dispatch),{...i,dispatch:a}}}function wvt(e){return a8(e)&&"type"in e&&typeof e.type=="string"}var Ibe=Symbol.for("immer-nothing"),rre=Symbol.for("immer-draftable"),oo=Symbol.for("immer-state");function Fs(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qm=Object.getPrototypeOf;function Mv(e){return!!e&&!!e[oo]}function Mc(e){var t;return e?Abe(e)||Array.isArray(e)||!!e[rre]||!!((t=e.constructor)!=null&&t[rre])||uL(e)||cL(e):!1}var Cvt=Object.prototype.constructor.toString();function Abe(e){if(!e||typeof e!="object")return!1;const t=qm(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===Cvt}function KA(e,t){lL(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function lL(e){const t=e[oo];return t?t.type_:Array.isArray(e)?1:uL(e)?2:cL(e)?3:0}function IF(e,t){return lL(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function kbe(e,t,r){const n=lL(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Tvt(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function uL(e){return e instanceof Map}function cL(e){return e instanceof Set}function rp(e){return e.copy_||e.base_}function AF(e,t){if(uL(e))return new Map(e);if(cL(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Abe(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[oo];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(qm(e),n)}else{const n=qm(e);if(n!==null&&r)return{...e};const i=Object.create(n);return Object.assign(i,e)}}function o8(e,t=!1){return fL(e)||Mv(e)||!Mc(e)||(lL(e)>1&&(e.set=e.add=e.clear=e.delete=Mvt),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>o8(n,!0))),e}function Mvt(){Fs(2)}function fL(e){return Object.isFrozen(e)}var Ivt={};function Iv(e){const t=Ivt[e];return t||Fs(0,e),t}var _w;function Dbe(){return _w}function Avt(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nre(e,t){t&&(Iv("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function kF(e){DF(e),e.drafts_.forEach(kvt),e.drafts_=null}function DF(e){e===_w&&(_w=e.parent_)}function ire(e){return _w=Avt(_w,e)}function kvt(e){const t=e[oo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function are(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[oo].modified_&&(kF(t),Fs(4)),Mc(e)&&(e=QA(t,e),t.parent_||JA(t,e)),t.patches_&&Iv("Patches").generateReplacementPatches_(r[oo].base_,e,t.patches_,t.inversePatches_)):e=QA(t,r,[]),kF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ibe?e:void 0}function QA(e,t,r){if(fL(t))return t;const n=t[oo];if(!n)return KA(t,(i,a)=>ore(e,n,t,i,a,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return JA(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const i=n.copy_;let a=i,o=!1;n.type_===3&&(a=new Set(i),i.clear(),o=!0),KA(a,(s,l)=>ore(e,n,i,s,l,r,o)),JA(e,i,!1),r&&e.patches_&&Iv("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function ore(e,t,r,n,i,a,o){if(Mv(i)){const s=a&&t&&t.type_!==3&&!IF(t.assigned_,n)?a.concat(n):void 0,l=QA(e,i,s);if(kbe(r,n,l),Mv(l))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(Mc(i)&&!fL(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;QA(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&JA(e,i)}}function JA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&o8(t,r)}function Dvt(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Dbe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=s8;r&&(i=[n],a=bw);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}var s8={get(e,t){if(t===oo)return e;const r=rp(e);if(!IF(r,t))return Pvt(e,r,t);const n=r[t];return e.finalized_||!Mc(n)?n:n===ON(e.base_,t)?(NN(e),e.copy_[t]=LF(n,e)):n},has(e,t){return t in rp(e)},ownKeys(e){return Reflect.ownKeys(rp(e))},set(e,t,r){const n=Pbe(rp(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=ON(rp(e),t),a=i==null?void 0:i[oo];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Tvt(r,i)&&(r!==void 0||IF(e.base_,t)))return!0;NN(e),PF(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return ON(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,NN(e),PF(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=rp(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Fs(11)},getPrototypeOf(e){return qm(e.base_)},setPrototypeOf(){Fs(12)}},bw={};KA(s8,(e,t)=>{bw[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});bw.deleteProperty=function(e,t){return bw.set.call(this,e,t,void 0)};bw.set=function(e,t,r){return s8.set.call(this,e[0],t,r,e[0])};function ON(e,t){const r=e[oo];return(r?rp(r):e)[t]}function Pvt(e,t,r){var i;const n=Pbe(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Pbe(e,t){if(!(t in e))return;let r=qm(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=qm(r)}}function PF(e){e.modified_||(e.modified_=!0,e.parent_&&PF(e.parent_))}function NN(e){e.copy_||(e.copy_=AF(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Lvt=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(l=a,...u){return o.produce(l,c=>r.call(this,c,...u))}}typeof r!="function"&&Fs(6),n!==void 0&&typeof n!="function"&&Fs(7);let i;if(Mc(t)){const a=ire(this),o=LF(t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?kF(a):DF(a)}return nre(a,n),are(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===Ibe&&(i=void 0),this.autoFreeze_&&o8(i,!0),n){const a=[],o=[];Iv("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else Fs(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...s)=>this.produceWithPatches(o,l=>t(l,...s));let n,i;return[this.produce(t,r,(o,s)=>{n=o,i=s}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Mc(e)||Fs(8),Mv(e)&&(e=Rvt(e));const t=ire(this),r=LF(e,void 0);return r[oo].isManual_=!0,DF(t),r}finishDraft(e,t){const r=e&&e[oo];(!r||!r.isManual_)&&Fs(9);const{scope_:n}=r;return nre(n,t),are(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=Iv("Patches").applyPatches_;return Mv(e)?n(e,t):this.produce(e,i=>n(i,t))}};function LF(e,t){const r=uL(e)?Iv("MapSet").proxyMap_(e,t):cL(e)?Iv("MapSet").proxySet_(e,t):Dvt(e,t);return(t?t.scope_:Dbe()).drafts_.push(r),r}function Rvt(e){return Mv(e)||Fs(10,e),Lbe(e)}function Lbe(e){if(!Mc(e)||fL(e))return e;const t=e[oo];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=AF(e,t.scope_.immer_.useStrictShallowCopy_)}else r=AF(e,!0);return KA(r,(n,i)=>{kbe(r,n,Lbe(i))}),t&&(t.finalized_=!1),r}var so=new Lvt,Rbe=so.produce;so.produceWithPatches.bind(so);so.setAutoFreeze.bind(so);so.setUseStrictShallowCopy.bind(so);so.applyPatches.bind(so);so.createDraft.bind(so);so.finishDraft.bind(so);function Ebe(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var Evt=Ebe(),Ovt=Ebe,Nvt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ZA:ZA.apply(null,arguments)};function sre(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Xs(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>wvt(n)&&n.type===e,r}var Obe=class Z_ extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Z_.prototype)}static get[Symbol.species](){return Z_}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Z_(...t[0].concat(this)):new Z_(...t.concat(this))}};function lre(e){return Mc(e)?Rbe(e,()=>{}):e}function ure(e,t,r){if(e.has(t)){let i=e.get(t);return r.update&&(i=r.update(i,t,e),e.set(t,i)),i}if(!r.insert)throw new Error(Xs(10));const n=r.insert(t,e);return e.set(t,n),n}function zvt(e){return typeof e=="boolean"}var Bvt=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Obe;return r&&(zvt(r)?o.push(Evt):o.push(Ovt(r.extraArgument))),o},Fvt="RTK_autoBatch",Nbe=e=>t=>{setTimeout(t,e)},Vvt=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Nbe(10),$vt=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?Vvt:e.type==="callback"?e.queueNotification:Nbe(e.timeout),u=()=>{o=!1,a&&(a=!1,s.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),h=n.subscribe(f);return s.add(c),()=>{h(),s.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[Fvt]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},Gvt=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Obe(e);return n&&i.push($vt(typeof n=="object"?n:void 0)),i};function Wvt(e){const t=Bvt(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof r=="function")s=r;else if(a8(r))s=Mbe(r);else throw new Error(Xs(1));let l;typeof n=="function"?l=n(t):l=t();let u=ZA;i&&(u=Nvt({trace:!1,...typeof i=="object"&&i}));const c=Svt(...l),f=Gvt(c);let h=typeof o=="function"?o(f):f();const d=u(...h);return Tbe(s,a,d)}function zbe(e){const t={},r=[];let n;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(Xs(28));if(s in t)throw new Error(Xs(29));return t[s]=o,i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Hvt(e){return typeof e=="function"}function jvt(e,t){let[r,n,i]=zbe(t),a;if(Hvt(e))a=()=>lre(e());else{const s=lre(e);a=()=>s}function o(s=a(),l){let u=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return u.filter(c=>!!c).length===0&&(u=[i]),u.reduce((c,f)=>{if(f)if(Mv(c)){const d=f(c,l);return d===void 0?c:d}else{if(Mc(c))return Rbe(c,h=>f(h,l));{const h=f(c,l);if(h===void 0){if(c===null)return c;throw new Error(Xs(9))}return h}}return c},s)}return o.getInitialState=a,o}var Uvt=Symbol.for("rtk-slice-createasyncthunk");function Yvt(e,t){return`${e}/${t}`}function Xvt({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Uvt];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(Xs(11));typeof process<"u";const s=(typeof i.reducers=="function"?i.reducers(Zvt()):i.reducers)||{},l=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(x,_){const S=typeof x=="string"?x:x.type;if(!S)throw new Error(Xs(12));if(S in u.sliceCaseReducersByType)throw new Error(Xs(13));return u.sliceCaseReducersByType[S]=_,c},addMatcher(x,_){return u.sliceMatchers.push({matcher:x,reducer:_}),c},exposeAction(x,_){return u.actionCreators[x]=_,c},exposeCaseReducer(x,_){return u.sliceCaseReducersByName[x]=_,c}};l.forEach(x=>{const _=s[x],S={reducerName:x,type:Yvt(a,x),createNotation:typeof i.reducers=="function"};Qvt(_)?egt(S,_,c,t):Kvt(S,_,c)});function f(){const[x={},_=[],S=void 0]=typeof i.extraReducers=="function"?zbe(i.extraReducers):[i.extraReducers],b={...x,...u.sliceCaseReducersByType};return jvt(i.initialState,w=>{for(let C in b)w.addCase(C,b[C]);for(let C of u.sliceMatchers)w.addMatcher(C.matcher,C.reducer);for(let C of _)w.addMatcher(C.matcher,C.reducer);S&&w.addDefaultCase(S)})}const h=x=>x,d=new Map;let p;function v(x,_){return p||(p=f()),p(x,_)}function g(){return p||(p=f()),p.getInitialState()}function y(x,_=!1){function S(w){let C=w[x];return typeof C>"u"&&_&&(C=g()),C}function b(w=h){const C=ure(d,_,{insert:()=>new WeakMap});return ure(C,w,{insert:()=>{const T={};for(const[M,I]of Object.entries(i.selectors??{}))T[M]=qvt(I,w,g,_);return T}})}return{reducerPath:x,getSelectors:b,get selectors(){return b(S)},selectSlice:S}}const m={name:a,reducer:v,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:g,...y(o),injectInto(x,{reducerPath:_,...S}={}){const b=_??o;return x.inject({reducerPath:b,reducer:v},S),{...m,...y(b,!0)}}};return m}}function qvt(e,t,r,n){function i(a,...o){let s=t(a);return typeof s>"u"&&n&&(s=r()),e(s,...o)}return i.unwrapped=e,i}var l8=Xvt();function Zvt(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Kvt({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!Jvt(n))throw new Error(Xs(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?sre(e,o):sre(e))}function Qvt(e){return e._reducerDefinitionType==="asyncThunk"}function Jvt(e){return e._reducerDefinitionType==="reducerWithPrepare"}function egt({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Xs(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:u,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),s&&n.addCase(f.pending,s),l&&n.addCase(f.rejected,l),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:o||XT,pending:s||XT,rejected:l||XT,settled:u||XT})}function XT(){}function Xs(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}function u8(e,{payload:t}){return{...e,...t}}const tgt={message:null},Bbe=l8({name:"snackbar",initialState:tgt,reducers:{setSnackbar:u8}}),z0=Bbe.actions,rgt=Bbe.reducer,ngt={resolution:5,testruns:{},currentTestrunIndex:0,testrunsForDisplay:[]},Fbe=l8({name:"toolbar",initialState:ngt,reducers:{setToolbar:u8}}),Vbe=Fbe.actions,igt=Fbe.reducer,cm={CLOUD:"CLOUD",CLASSIC:"CLASSIC"},agt={viewType:cm.CLOUD},$be=l8({name:"ui",initialState:agt,reducers:{setUi:u8}}),ogt=$be.actions,sgt=$be.reducer,Gbe=B.createContext(null),lgt=Mbe({snackbar:rgt,toolbar:igt,ui:sgt}),Wbe=Wvt({reducer:lgt,middleware:e=>e()}),vu=Kk,Mu=Pue(Gbe),ugt=()=>e=>Wbe.dispatch(e);function Ic(e,t){const r=ugt();return B.useCallback(n=>{r(e(n))},[e,r])}function cgt(){const e=vu(({swarm:r})=>r.state),t=Mu(({ui:r})=>r.viewType);return e===ur.READY?null:W.jsxs(Vt,{sx:{display:"flex",columnGap:2,marginY:"auto",height:"50px"},children:[e===ur.STOPPED?W.jsx($pe,{}):W.jsxs(W.Fragment,{children:[W.jsx(Fpe,{}),W.jsx(Wpe,{})]}),t==cm.CLASSIC&&W.jsx(Gpe,{})]})}function fgt(){return W.jsx(tde,{position:"static",children:W.jsx(Fv,{maxWidth:"xl",children:W.jsxs(Nde,{disableGutters:!0,sx:{display:"flex",justifyContent:"space-between",columnGap:2},children:[W.jsx(ai,{color:"inherit",href:"/",sx:{display:"flex",alignItems:"center"},underline:"none",children:W.jsx(ape,{})}),W.jsxs(Vt,{sx:{display:"flex",columnGap:6},children:[!window.templateArgs.isGraphViewer&&W.jsxs(W.Fragment,{children:[W.jsx(kpe,{}),W.jsx(cgt,{})]}),W.jsx(Cpe,{})]})]})})})}function hgt(){const e=Ic(ogt.setUi),{viewType:t}=Mu(({ui:n})=>n),r=t===cm.CLOUD?cm.CLASSIC:cm.CLOUD;return W.jsx(Fv,{maxWidth:"xl",sx:{position:"relative"},children:W.jsx(bu,{onClick:()=>e({viewType:r}),sx:{position:"absolute",mt:"4px",right:16,zIndex:1},children:r})})}function dgt({children:e}){const t=vu(({swarm:r})=>r.state);return W.jsxs(W.Fragment,{children:[W.jsx(fgt,{}),!window.templateArgs.isGraphViewer&&t!==ur.READY&&W.jsx(hgt,{}),W.jsx("main",{children:e})]})}function pgt(){const e=B.useCallback(()=>r({message:null}),[]),t=Mu(({snackbar:n})=>n.message),r=Ic(z0.setSnackbar);return W.jsx(b4e,{autoHideDuration:5e3,onClose:e,open:!!t,children:W.jsx(FI,{onClose:e,severity:"error",sx:{width:"100%"},variant:"filled",children:t})})}function vgt(){const{numUsers:e,workerCount:t}=vu(({swarm:s})=>s),[r,n]=B.useState(),[i,a]=B.useState(!1),o=B.useCallback(({target:s})=>{if(s&&s.name==="userCount"){const l=s.value;window.templateArgs.maxUserCount&&l>window.templateArgs.maxUserCount?(n({level:"error",message:"The number of users has exceeded the allowance for this account."}),a(!0)):l>t*500?(n({level:"warning",message:`Locust worker count is determined by the User count you specified at start up (${e}), and launching more users risks overloading workers, impacting your results. Re-run locust-cloud with your desired user count to avoid this.`}),a(!1)):(a(!1),n(void 0))}},[e,t]);return W.jsx(NG,{alert:r,isDisabled:i,onFormChange:o})}const Hbe="5",ggt=["1","2",Hbe,"10","30"],ygt=e=>{const t=new URL(window.location.href);for(const[r,n]of Object.entries(e))t.searchParams.set(r,n);window.history.pushState(null,"",t)};function c8({onSelectTestRun:e}){const t=Ic(Vbe.setToolbar),{testruns:r,testrunsForDisplay:n}=Mu(({toolbar:a})=>a),i=a=>{e&&e(a.target.value);const o=r[a.target.value];t({currentTestrun:o.runId,currentTestrunIndex:o.index}),ygt({testrun:a.target.value})};return W.jsxs(Vt,{sx:{display:"flex",columnGap:2,mb:1},children:[W.jsx(jS,{defaultValue:Hbe,label:"Resolution",name:"resolution",onChange:a=>t({resolution:Number(a.target.value)}),options:ggt,size:"small",sx:{width:"150px"}}),!!n.length&&W.jsx(jS,{label:"Test Run",name:"testrun",onChange:i,options:n,size:"small",sx:{width:"250px"}})]})}function Pn(e,t,r,n){fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(i=>i.json()).then(i=>r(i)).catch(i=>console.error(i))}const yy=(e,t)=>e.reduce((r,n)=>{const{name:i,time:a}=n,o=n[t]||"0",s=r.time||[];return s.push(a),r[i]?(r[i].push([a,o]),{...r,time:s}):{...r,[i]:[[a,o]],time:s}},{});function kf(e){return Of(Number(e[1]),2)}const e_={time:[]},mgt={time:[]},Vg={RPS:["#00ca5a","#0099ff","#ff6d6d"],PER_REQUEST:["#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],ERROR:["#ff8080","#ff4d4d","#ff1a1a","#e60000","#b30000","#800000"]},xgt=["Users","RPS"],_gt=[{name:"Users",key:"users",yAxisIndex:0},{name:"Requests per Second",key:"rps",yAxisIndex:1,areaStyle:{}},{name:"Errors per Second",key:"errorRate",yAxisIndex:1,areaStyle:{}}],bgt=e=>e?e[e.length-1][1]:"0";function jbe(){const{state:e}=vu(({swarm:R})=>R),{resolution:t,currentTestrunIndex:r,currentTestrun:n,testruns:i}=Mu(({toolbar:R})=>R);Ic(z0.setSnackbar);const[a,o]=B.useState(!0),[s,l]=B.useState(!1),[u,c]=B.useState(new Date().toISOString()),[f,h]=B.useState([]),[d,p]=B.useState(mgt),[v,g]=B.useState(e_),[y,m]=B.useState(e_),[x,_]=B.useState(e_),[S,b]=B.useState(e_),[w,C]=B.useState(e_),T=R=>Pn("/cloud-stats/request-names",R,F=>{(r!==0&&!F.length||r===0&&e!==ur.RUNNING&&!F.length)&&l(!0),h(F.map(({name:E})=>({name:`${E}`,key:E})))}),M=R=>Pn("/cloud-stats/rps",R,F=>p(F.reduce((E,{users:G,rps:j,errorRate:V,time:U})=>({users:[...E.users||[],[U,G||bgt(E.users)]],rps:[...E.rps||[],[U,j||"0"]],errorRate:[...E.errorRate||[],[U,V||"0"]],time:[...E.time||[],U]}),{}))),I=R=>Pn("/cloud-stats/rps-per-request",R,F=>g(yy(F,"throughput"))),A=R=>Pn("/cloud-stats/avg-response-times",R,F=>{m(yy(F,"responseTime")),a&&o(!1)}),k=R=>Pn("/cloud-stats/errors-per-request",R,F=>_(yy(F,"errorRate"))),D=R=>Pn("/cloud-stats/perc99-response-times",R,F=>b(yy(F,"perc99"))),P=R=>Pn("/cloud-stats/response-length",R,F=>C(yy(F,"responseLength"))),L=R=>{if(n){const F=new Date().toISOString(),E={start:n,end:R||u,resolution:t,testrun:n};T(E),I(E),A(E),k(E),D(E),P(E),M(E),c(F)}};yc(L,1e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING,immediate:!0}),B.useEffect(()=>{if(n){const{endTime:R}=i[new Date(n).toLocaleString()];L(R)}else L()},[n,t]),B.useEffect(()=>{e===ur.RUNNING&&o(!0)},[e]);const O=B.useCallback(()=>{o(!0),l(!1)},[]);return W.jsxs(W.Fragment,{children:[W.jsx(c8,{onSelectTestRun:O}),s&&W.jsx(FI,{severity:"error",children:"There was a problem loading some graphs for this testrun."}),W.jsxs(Vt,{sx:{position:"relative"},children:[a&&W.jsx(Vt,{sx:{position:"absolute",height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0.4)",zIndex:1,display:"flex",justifyContent:"center",paddingTop:4},children:W.jsx(Dze,{})}),W.jsx(Rl,{chartValueFormatter:kf,charts:d,colors:Vg.RPS,lines:_gt,splitAxis:!0,title:"Throughput / active users",yAxisLabels:xgt}),(!s||s&&!!f.length)&&W.jsxs(W.Fragment,{children:[W.jsx(Rl,{chartValueFormatter:R=>`${Of(Number(R[1]),2)}ms`,charts:y,colors:Vg.PER_REQUEST,lines:f,title:"Average Response Times"}),W.jsx(Rl,{chartValueFormatter:kf,charts:v,colors:Vg.PER_REQUEST,lines:f,title:"RPS per Request"}),W.jsx(Rl,{chartValueFormatter:kf,charts:x,colors:Vg.ERROR,lines:f,title:"Errors per Request"}),W.jsx(Rl,{chartValueFormatter:kf,charts:S,colors:Vg.PER_REQUEST,lines:f,title:"99th Percentile Response Times"}),W.jsx(Rl,{chartValueFormatter:kf,charts:w,colors:Vg.PER_REQUEST,lines:f,title:"Response Length"})]})]})]})}const cre=e=>e===1?"":"s";function Sgt(e){if(!e||!e.length||!e[0].totalVuh)return"Unknown";const[{totalVuh:t}]=e,[r,n]=t.includes("days")?t.split(", "):["0 days",t],i=parseInt(r)*24,[a,o]=n.split(":").map(Number),s=a+i;return[s&&`${s} hour${cre(s)}`,o&&`${o} minute${cre(o)}`].filter(Boolean).join(", ")}function Ube(){const[e,t]=B.useState(),r=vu(({swarm:n})=>n.state);return B.useEffect(()=>{Pn("/cloud-stats/total-runtime",{},n=>t(Sgt(n)))},[r]),W.jsxs(ll,{elevation:3,sx:{py:4,px:8,display:"flex",flexDirection:"column",alignItems:"center",rowGap:4},children:[window.templateArgs.username&&W.jsxs(Vt,{sx:{display:"flex",alignItems:"center",flexDirection:"column",rowGap:1},children:[W.jsx(Pt,{sx:{fontWeight:"bold"},children:"Current User"}),W.jsx(Pt,{children:window.templateArgs.username})]}),W.jsxs(Vt,{sx:{display:"flex",alignItems:"center",flexDirection:"column",rowGap:1},children:[W.jsx(Pt,{sx:{fontWeight:"bold"},children:"Customer Total Virtual User Time"}),e&&e]})]})}function Ybe(){const e=vu(({swarm:f})=>f.state),{currentTestrun:t}=Mu(({toolbar:f})=>f);Ic(z0.setSnackbar);const[r,n]=B.useState(new Date().toISOString()),[i,a]=B.useState({time:[]}),[o,s]=B.useState([]),l=f=>Pn("/cloud-stats/scatterplot",f,h=>a(yy(h,"responseTime"))),u=f=>Pn("/cloud-stats/request-names",f,h=>s(h.map(({name:d})=>({name:`${d}`,key:d})))),c=()=>{if(t){const f=new Date().toISOString(),h={start:t,end:r,testrun:t};u(h),l(h),n(f)}};return yc(()=>{c()},5e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING}),B.useEffect(()=>{c()},[t]),W.jsxs(W.Fragment,{children:[W.jsx(c8,{}),W.jsx(Rl,{chartValueFormatter:kf,charts:i,colors:["#8A2BE2","#0000FF","#00ca5a","#FFA500","#FFFF00","#EE82EE"],lines:o,scatterplot:!0,title:"Scatterplot"})]})}/*! *****************************************************************************
|
270
|
+
`,""):"No data",borderWidth:0},xAxis:{type:"time",startValue:(e.time||[""])[0],axisLabel:{formatter:Npt}},grid:{left:60,right:40},yAxis:Opt({splitAxis:a,yAxisLabels:o}),series:gbe({charts:e,lines:r,scatterplot:s}),color:n,toolbox:{right:10,feature:{dataZoom:{title:{zoom:"Zoom Select",back:"Zoom Reset"},yAxisIndex:!1},saveAsImage:{name:t.replace(/\s+/g,"_").toLowerCase()+"_"+new Date().getTime()/1e3,title:"Download as PNG",emphasis:{iconStyle:{textPosition:"left"}}}}}}),Fpt=(e,t)=>({symbol:"none",label:{formatter:r=>`Run #${r.dataIndex+1}`,padding:[0,0,8,0]},lineStyle:{color:t?XA.DARK.axisColor:XA.LIGHT.axisColor},data:(e.markers||[]).map(r=>({xAxis:r}))}),Vpt=e=>t=>{const{batch:r}=t;if(!r)return;const[{start:n,startValue:i,end:a}]=r,o=n>0&&a<=100||i>0;e.setOption({dataZoom:[{type:"slider",show:o}]})};function Rl({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s}){const[l,u]=B.useState(null),c=hs(({theme:{isDarkMode:h}})=>h),f=B.useRef(null);return B.useEffect(()=>{if(!f.current)return;const h=wJe(f.current);h.setOption(Bpt({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s})),h.on("datazoom",Vpt(h));const d=()=>h.resize();return window.addEventListener("resize",d),h.group="swarmCharts",CJe("swarmCharts"),u(h),()=>{TJe(h),window.removeEventListener("resize",d)}},[f]),B.useEffect(()=>{const h=r.every(({key:d})=>!!e[d]);l&&h&&l.setOption({series:r.map(({key:d,yAxisIndex:p,...v},g)=>({...v,data:e[d],...a?{yAxisIndex:p||g}:{},...g===0?{markLine:Fpt(e,c)}:{}}))})},[e,l,r,c]),B.useEffect(()=>{if(l){const{textColor:h,axisColor:d,backgroundColor:p,splitLine:v}=c?XA.DARK:XA.LIGHT;l.setOption({backgroundColor:p,textStyle:{color:h},title:{textStyle:{color:h}},legend:{icon:"circle",inactiveColor:h,textStyle:{color:h}},tooltip:{backgroundColor:p,textStyle:{color:h}},xAxis:{axisLine:{lineStyle:{color:d}}},yAxis:{axisLine:{lineStyle:{color:d}},splitLine:{lineStyle:{color:v}}}})}},[l,c]),B.useEffect(()=>{l&&l.setOption({series:gbe({charts:e,lines:r,scatterplot:s})})},[r]),H.jsx("div",{ref:f,style:{width:"100%",height:"300px"}})}const $pt=ru.percentilesToChart?ru.percentilesToChart.map(e=>({name:`${e*100}th percentile`,key:`responseTimePercentile${e}`})):[],Gpt=["#ff9f00","#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],Wpt=[{title:"Total Requests per Second",lines:[{name:"RPS",key:"currentRps"},{name:"Failures/s",key:"currentFailPerSec"}],colors:["#00ca5a","#ff6d6d"]},{title:"Response Times (ms)",lines:$pt,colors:Gpt},{title:"Number of Users",lines:[{name:"Number of Users",key:"userCount"}],colors:["#0099ff"]}];function Hpt({charts:e}){return H.jsx("div",{children:Wpt.map((t,r)=>H.jsx(Rl,{...t,charts:e},`swarm-chart-${r}`))})}const jpt=({ui:{charts:e}})=>({charts:e}),Upt=Oa(jpt)(Hpt);function Ypt(e){return(e*100).toFixed(1)+"%"}function TF({classRatio:e}){return H.jsx("ul",{children:Object.entries(e).map(([t,{ratio:r,tasks:n}])=>H.jsxs("li",{children:[`${Ypt(r)} ${t}`,n&&H.jsx(TF,{classRatio:n})]},`nested-ratio-${t}`))})}function Xpt({ratios:{perClass:e,total:t}}){return!e&&!t?null:H.jsxs("div",{children:[e&&H.jsxs(H.Fragment,{children:[H.jsx("h3",{children:"Ratio Per Class"}),H.jsx(TF,{classRatio:e})]}),t&&H.jsxs(H.Fragment,{children:[H.jsx("h3",{children:"Total Ratio"}),H.jsx(TF,{classRatio:t})]})]})}const qpt=({ui:{ratios:e}})=>({ratios:e}),Zpt=Oa(qpt)(Xpt),Kpt=[{key:"id",title:"Worker"},{key:"state",title:"State"},{key:"userCount",title:"# users"},{key:"cpuUsage",title:"CPU usage"},{key:"memoryUsage",title:"Memory usage",formatter:iWe}];function Qpt({workers:e=[]}){return H.jsx(bh,{defaultSortKey:"id",rows:e,structure:Kpt})}const Jpt=({ui:{workers:e}})=>({workers:e}),evt=Oa(Jpt)(Qpt),Os={stats:{component:OUe,key:"stats",title:"Statistics"},charts:{component:Upt,key:"charts",title:"Charts"},failures:{component:yUe,key:"failures",title:"Failures"},exceptions:{component:dUe,key:"exceptions",title:"Exceptions"},ratios:{component:Zpt,key:"ratios",title:"Current Ratio"},reports:{component:CUe,key:"reports",title:"Download Data"},logs:{component:bUe,key:jpe,title:"Logs"},workers:{component:evt,key:"workers",title:"Workers",shouldDisplayTab:e=>e.swarm.isDistributed}},ybe=[Os.stats,Os.charts,Os.failures,Os.exceptions,Os.ratios,Os.reports,Os.logs,Os.workers],tvt=e=>{const t=new URL(window.location.href);for(const[r,n]of Object.entries(e))t.searchParams.set(r,n);window.history.pushState(null,"",t)},rvt=()=>window.location.search?nWe(window.location.search):null,nvt={query:rvt()},mbe=Bo({name:"url",initialState:nvt,reducers:{setUrl:v1}}),ivt=mbe.actions,avt=mbe.reducer;function ovt({hasNotification:e,title:t}){return H.jsxs(Vt,{sx:{display:"flex",alignItems:"center"},children:[e&&H.jsx(BG,{color:"secondary"}),H.jsx("span",{children:t})]})}function svt({currentTabIndexFromQuery:e,notification:t,setNotification:r,setUrl:n,tabs:i}){const[a,o]=B.useState(e),s=(l,u)=>{const c=i[u].key;t[c]&&r({[c]:!1}),tvt({tab:c}),n({query:{tab:c}}),o(u)};return B.useEffect(()=>{o(e)},[e]),H.jsxs(Fv,{maxWidth:"xl",children:[H.jsx(Vt,{sx:{mb:2},children:H.jsx($Fe,{onChange:s,value:a,children:i.map(({key:l,title:u},c)=>H.jsx(G4e,{label:H.jsx(ovt,{hasNotification:t[l],title:u})},`tab-${c}`))})}),i.map(({component:l=uUe},u)=>a===u&&H.jsx(l,{},`tabpabel-${u}`))]})}const lvt=(e,{tabs:t,extendedTabs:r})=>{const{notification:n,swarm:{extendedTabs:i},url:{query:a}}=e,o=(t||[...ybe,...r||i||[]]).filter(({shouldDisplayTab:l})=>!l||l&&l(e)),s=a&&a.tab?o.findIndex(({key:l})=>l===a.tab):0;return{notification:n,tabs:o,currentTabIndexFromQuery:s>-1?s:0}},uvt={setNotification:Ype.setNotification,setUrl:ivt.setUrl},xbe=Oa(lvt,uvt)(svt),cvt=e=>q$({palette:{mode:e,primary:{main:"#15803d"},success:{main:"#00C853"}},components:{MuiCssBaseline:{styleOverrides:{":root":{"--footer-height":"40px"}}}}});function _be(){const e=hs(({theme:{isDarkMode:t}})=>t);return B.useMemo(()=>cvt(e?tu.DARK:tu.LIGHT),[e])}var Kte;const fvt={totalRps:0,failRatio:0,startTime:"",stats:[],errors:[],exceptions:[],charts:(Kte=ru.history)==null?void 0:Kte.reduce(vP,{}),ratios:{},userCount:0};var Qte;const hvt=(Qte=ru.percentilesToChart)==null?void 0:Qte.reduce((e,t)=>({...e,[`responseTimePercentile${t}`]:{value:null}}),{}),dvt=e=>vP(e,{...hvt,currentRps:{value:null},currentFailPerSec:{value:null},totalAvgResponseTime:{value:null},userCount:{value:null},time:""}),bbe=Bo({name:"ui",initialState:fvt,reducers:{setUi:v1,updateCharts:(e,{payload:t})=>({...e,charts:vP(e.charts,t)}),updateChartMarkers:(e,{payload:t})=>({...e,charts:{...dvt(e.charts),markers:e.charts.markers?[...e.charts.markers,t]:[(e.charts.time||[""])[0],t]}})}}),jb=bbe.actions,pvt=bbe.reducer;function Sbe(){const{data:e,refetch:t}=tHe(),r=ju(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;B.useEffect(()=>{e&&r({exceptions:e.exceptions})},[e]),yc(t,5e3,{shouldRunInterval:i})}const Jte=2e3;function wbe(){const e=ju(gP.setSwarm),t=ju(jb.setUi),r=ju(jb.updateCharts),n=ju(jb.updateChartMarkers),i=hs(({swarm:h})=>h),a=B.useRef(i.state),[o,s]=B.useState(!1),{data:l,refetch:u}=JWe(),c=i.state===ur.SPAWNING||i.state==ur.RUNNING,f=()=>{if(!l)return;const{currentResponseTimePercentiles:h,extendedStats:d,stats:p,errors:v,totalRps:g,totalFailPerSec:y,failRatio:m,workers:x,userCount:_,totalAvgResponseTime:S}=l,b=new Date().toISOString();o&&(s(!1),n(b));const w=Of(g,2),C=Of(y,2),T=Of(m*100),M={...Object.entries(h).reduce((I,[A,k])=>({...I,[A]:[b,k]}),{}),currentRps:[b,w],currentFailPerSec:[b,C],totalAvgResponseTime:[b,Of(S,2)],userCount:[b,_],time:b};t({extendedStats:d,stats:p,errors:v,totalRps:w,failRatio:T,workers:x,userCount:_}),r(M)};B.useEffect(()=>{l&&e({state:l.state})},[l&&l.state]),yc(f,Jte,{shouldRunInterval:!!l&&c}),yc(u,Jte,{shouldRunInterval:c}),B.useEffect(()=>{i.state===ur.RUNNING&&a.current===ur.STOPPED&&s(!0),a.current=i.state},[i.state,a])}function Cbe(){const{data:e,refetch:t}=eHe(),r=ju(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;B.useEffect(()=>{e&&r({ratios:e})},[e]),yc(t,5e3,{shouldRunInterval:i})}function vvt({swarmState:e,tabs:t,extendedTabs:r}){wbe(),Sbe(),Cbe(),Zpe();const n=_be();return H.jsxs(C6e,{theme:n,children:[H.jsx(_6e,{}),H.jsx(DHe,{children:e===ur.READY?H.jsx(NG,{}):H.jsx(xbe,{extendedTabs:r,tabs:t})})]})}const gvt=({swarm:{state:e}})=>({swarmState:e});Oa(gvt)(vvt);const yvt=bG({[XI.reducerPath]:XI.reducer,logViewer:NHe,notification:LHe,swarm:aHe,theme:JGe,ui:pvt,url:avt}),mvt=kGe({reducer:yvt,middleware:e=>e().concat(XI.middleware)});var MF={},ere=$6;MF.createRoot=ere.createRoot,MF.hydrateRoot=ere.hydrateRoot;function ti(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xvt=typeof Symbol=="function"&&Symbol.observable||"@@observable",tre=xvt,EN=()=>Math.random().toString(36).substring(7).split("").join("."),_vt={INIT:`@@redux/INIT${EN()}`,REPLACE:`@@redux/REPLACE${EN()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${EN()}`},qA=_vt;function a8(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Tbe(e,t,r){if(typeof e!="function")throw new Error(ti(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ti(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ti(1));return r(Tbe)(e,t)}let n=e,i=t,a=new Map,o=a,s=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((g,y)=>{o.set(y,g)}))}function c(){if(l)throw new Error(ti(3));return i}function f(g){if(typeof g!="function")throw new Error(ti(4));if(l)throw new Error(ti(5));let y=!0;u();const m=s++;return o.set(m,g),function(){if(y){if(l)throw new Error(ti(6));y=!1,u(),o.delete(m),a=null}}}function h(g){if(!a8(g))throw new Error(ti(7));if(typeof g.type>"u")throw new Error(ti(8));if(typeof g.type!="string")throw new Error(ti(17));if(l)throw new Error(ti(9));try{l=!0,i=n(i,g)}finally{l=!1}return(a=o).forEach(m=>{m()}),g}function d(g){if(typeof g!="function")throw new Error(ti(10));n=g,h({type:qA.REPLACE})}function p(){const g=f;return{subscribe(y){if(typeof y!="object"||y===null)throw new Error(ti(11));function m(){const _=y;_.next&&_.next(c())}return m(),{unsubscribe:g(m)}},[tre](){return this}}}return h({type:qA.INIT}),{dispatch:h,subscribe:f,getState:c,replaceReducer:d,[tre]:p}}function bvt(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:qA.INIT})>"u")throw new Error(ti(12));if(typeof r(void 0,{type:qA.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ti(13))})}function Mbe(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let i;try{bvt(r)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const u={};for(let c=0;c<n.length;c++){const f=n[c],h=r[f],d=o[f],p=h(d,s);if(typeof p>"u")throw s&&s.type,new Error(ti(14));u[f]=p,l=l||p!==d}return l=l||n.length!==Object.keys(o).length,l?u:o}}function ZA(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Svt(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ti(15))};const o={getState:i.getState,dispatch:(l,...u)=>a(l,...u)},s=e.map(l=>l(o));return a=ZA(...s)(i.dispatch),{...i,dispatch:a}}}function wvt(e){return a8(e)&&"type"in e&&typeof e.type=="string"}var Ibe=Symbol.for("immer-nothing"),rre=Symbol.for("immer-draftable"),oo=Symbol.for("immer-state");function Fs(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qm=Object.getPrototypeOf;function Mv(e){return!!e&&!!e[oo]}function Mc(e){var t;return e?Abe(e)||Array.isArray(e)||!!e[rre]||!!((t=e.constructor)!=null&&t[rre])||uL(e)||cL(e):!1}var Cvt=Object.prototype.constructor.toString();function Abe(e){if(!e||typeof e!="object")return!1;const t=qm(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===Cvt}function KA(e,t){lL(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function lL(e){const t=e[oo];return t?t.type_:Array.isArray(e)?1:uL(e)?2:cL(e)?3:0}function IF(e,t){return lL(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function kbe(e,t,r){const n=lL(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Tvt(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function uL(e){return e instanceof Map}function cL(e){return e instanceof Set}function rp(e){return e.copy_||e.base_}function AF(e,t){if(uL(e))return new Map(e);if(cL(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Abe(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[oo];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(qm(e),n)}else{const n=qm(e);if(n!==null&&r)return{...e};const i=Object.create(n);return Object.assign(i,e)}}function o8(e,t=!1){return fL(e)||Mv(e)||!Mc(e)||(lL(e)>1&&(e.set=e.add=e.clear=e.delete=Mvt),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>o8(n,!0))),e}function Mvt(){Fs(2)}function fL(e){return Object.isFrozen(e)}var Ivt={};function Iv(e){const t=Ivt[e];return t||Fs(0,e),t}var _w;function Dbe(){return _w}function Avt(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nre(e,t){t&&(Iv("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function kF(e){DF(e),e.drafts_.forEach(kvt),e.drafts_=null}function DF(e){e===_w&&(_w=e.parent_)}function ire(e){return _w=Avt(_w,e)}function kvt(e){const t=e[oo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function are(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[oo].modified_&&(kF(t),Fs(4)),Mc(e)&&(e=QA(t,e),t.parent_||JA(t,e)),t.patches_&&Iv("Patches").generateReplacementPatches_(r[oo].base_,e,t.patches_,t.inversePatches_)):e=QA(t,r,[]),kF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ibe?e:void 0}function QA(e,t,r){if(fL(t))return t;const n=t[oo];if(!n)return KA(t,(i,a)=>ore(e,n,t,i,a,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return JA(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const i=n.copy_;let a=i,o=!1;n.type_===3&&(a=new Set(i),i.clear(),o=!0),KA(a,(s,l)=>ore(e,n,i,s,l,r,o)),JA(e,i,!1),r&&e.patches_&&Iv("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function ore(e,t,r,n,i,a,o){if(Mv(i)){const s=a&&t&&t.type_!==3&&!IF(t.assigned_,n)?a.concat(n):void 0,l=QA(e,i,s);if(kbe(r,n,l),Mv(l))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(Mc(i)&&!fL(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;QA(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&JA(e,i)}}function JA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&o8(t,r)}function Dvt(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Dbe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=s8;r&&(i=[n],a=bw);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}var s8={get(e,t){if(t===oo)return e;const r=rp(e);if(!IF(r,t))return Pvt(e,r,t);const n=r[t];return e.finalized_||!Mc(n)?n:n===ON(e.base_,t)?(NN(e),e.copy_[t]=LF(n,e)):n},has(e,t){return t in rp(e)},ownKeys(e){return Reflect.ownKeys(rp(e))},set(e,t,r){const n=Pbe(rp(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=ON(rp(e),t),a=i==null?void 0:i[oo];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Tvt(r,i)&&(r!==void 0||IF(e.base_,t)))return!0;NN(e),PF(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return ON(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,NN(e),PF(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=rp(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Fs(11)},getPrototypeOf(e){return qm(e.base_)},setPrototypeOf(){Fs(12)}},bw={};KA(s8,(e,t)=>{bw[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});bw.deleteProperty=function(e,t){return bw.set.call(this,e,t,void 0)};bw.set=function(e,t,r){return s8.set.call(this,e[0],t,r,e[0])};function ON(e,t){const r=e[oo];return(r?rp(r):e)[t]}function Pvt(e,t,r){var i;const n=Pbe(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Pbe(e,t){if(!(t in e))return;let r=qm(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=qm(r)}}function PF(e){e.modified_||(e.modified_=!0,e.parent_&&PF(e.parent_))}function NN(e){e.copy_||(e.copy_=AF(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Lvt=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(l=a,...u){return o.produce(l,c=>r.call(this,c,...u))}}typeof r!="function"&&Fs(6),n!==void 0&&typeof n!="function"&&Fs(7);let i;if(Mc(t)){const a=ire(this),o=LF(t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?kF(a):DF(a)}return nre(a,n),are(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===Ibe&&(i=void 0),this.autoFreeze_&&o8(i,!0),n){const a=[],o=[];Iv("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else Fs(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...s)=>this.produceWithPatches(o,l=>t(l,...s));let n,i;return[this.produce(t,r,(o,s)=>{n=o,i=s}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Mc(e)||Fs(8),Mv(e)&&(e=Rvt(e));const t=ire(this),r=LF(e,void 0);return r[oo].isManual_=!0,DF(t),r}finishDraft(e,t){const r=e&&e[oo];(!r||!r.isManual_)&&Fs(9);const{scope_:n}=r;return nre(n,t),are(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=Iv("Patches").applyPatches_;return Mv(e)?n(e,t):this.produce(e,i=>n(i,t))}};function LF(e,t){const r=uL(e)?Iv("MapSet").proxyMap_(e,t):cL(e)?Iv("MapSet").proxySet_(e,t):Dvt(e,t);return(t?t.scope_:Dbe()).drafts_.push(r),r}function Rvt(e){return Mv(e)||Fs(10,e),Lbe(e)}function Lbe(e){if(!Mc(e)||fL(e))return e;const t=e[oo];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=AF(e,t.scope_.immer_.useStrictShallowCopy_)}else r=AF(e,!0);return KA(r,(n,i)=>{kbe(r,n,Lbe(i))}),t&&(t.finalized_=!1),r}var so=new Lvt,Rbe=so.produce;so.produceWithPatches.bind(so);so.setAutoFreeze.bind(so);so.setUseStrictShallowCopy.bind(so);so.applyPatches.bind(so);so.createDraft.bind(so);so.finishDraft.bind(so);function Ebe(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var Evt=Ebe(),Ovt=Ebe,Nvt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ZA:ZA.apply(null,arguments)};function sre(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Xs(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>wvt(n)&&n.type===e,r}var Obe=class Z_ extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Z_.prototype)}static get[Symbol.species](){return Z_}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Z_(...t[0].concat(this)):new Z_(...t.concat(this))}};function lre(e){return Mc(e)?Rbe(e,()=>{}):e}function ure(e,t,r){if(e.has(t)){let i=e.get(t);return r.update&&(i=r.update(i,t,e),e.set(t,i)),i}if(!r.insert)throw new Error(Xs(10));const n=r.insert(t,e);return e.set(t,n),n}function zvt(e){return typeof e=="boolean"}var Bvt=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Obe;return r&&(zvt(r)?o.push(Evt):o.push(Ovt(r.extraArgument))),o},Fvt="RTK_autoBatch",Nbe=e=>t=>{setTimeout(t,e)},Vvt=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Nbe(10),$vt=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?Vvt:e.type==="callback"?e.queueNotification:Nbe(e.timeout),u=()=>{o=!1,a&&(a=!1,s.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),h=n.subscribe(f);return s.add(c),()=>{h(),s.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[Fvt]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},Gvt=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Obe(e);return n&&i.push($vt(typeof n=="object"?n:void 0)),i};function Wvt(e){const t=Bvt(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof r=="function")s=r;else if(a8(r))s=Mbe(r);else throw new Error(Xs(1));let l;typeof n=="function"?l=n(t):l=t();let u=ZA;i&&(u=Nvt({trace:!1,...typeof i=="object"&&i}));const c=Svt(...l),f=Gvt(c);let h=typeof o=="function"?o(f):f();const d=u(...h);return Tbe(s,a,d)}function zbe(e){const t={},r=[];let n;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(Xs(28));if(s in t)throw new Error(Xs(29));return t[s]=o,i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Hvt(e){return typeof e=="function"}function jvt(e,t){let[r,n,i]=zbe(t),a;if(Hvt(e))a=()=>lre(e());else{const s=lre(e);a=()=>s}function o(s=a(),l){let u=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return u.filter(c=>!!c).length===0&&(u=[i]),u.reduce((c,f)=>{if(f)if(Mv(c)){const d=f(c,l);return d===void 0?c:d}else{if(Mc(c))return Rbe(c,h=>f(h,l));{const h=f(c,l);if(h===void 0){if(c===null)return c;throw new Error(Xs(9))}return h}}return c},s)}return o.getInitialState=a,o}var Uvt=Symbol.for("rtk-slice-createasyncthunk");function Yvt(e,t){return`${e}/${t}`}function Xvt({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Uvt];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(Xs(11));typeof process<"u";const s=(typeof i.reducers=="function"?i.reducers(Zvt()):i.reducers)||{},l=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(x,_){const S=typeof x=="string"?x:x.type;if(!S)throw new Error(Xs(12));if(S in u.sliceCaseReducersByType)throw new Error(Xs(13));return u.sliceCaseReducersByType[S]=_,c},addMatcher(x,_){return u.sliceMatchers.push({matcher:x,reducer:_}),c},exposeAction(x,_){return u.actionCreators[x]=_,c},exposeCaseReducer(x,_){return u.sliceCaseReducersByName[x]=_,c}};l.forEach(x=>{const _=s[x],S={reducerName:x,type:Yvt(a,x),createNotation:typeof i.reducers=="function"};Qvt(_)?egt(S,_,c,t):Kvt(S,_,c)});function f(){const[x={},_=[],S=void 0]=typeof i.extraReducers=="function"?zbe(i.extraReducers):[i.extraReducers],b={...x,...u.sliceCaseReducersByType};return jvt(i.initialState,w=>{for(let C in b)w.addCase(C,b[C]);for(let C of u.sliceMatchers)w.addMatcher(C.matcher,C.reducer);for(let C of _)w.addMatcher(C.matcher,C.reducer);S&&w.addDefaultCase(S)})}const h=x=>x,d=new Map;let p;function v(x,_){return p||(p=f()),p(x,_)}function g(){return p||(p=f()),p.getInitialState()}function y(x,_=!1){function S(w){let C=w[x];return typeof C>"u"&&_&&(C=g()),C}function b(w=h){const C=ure(d,_,{insert:()=>new WeakMap});return ure(C,w,{insert:()=>{const T={};for(const[M,I]of Object.entries(i.selectors??{}))T[M]=qvt(I,w,g,_);return T}})}return{reducerPath:x,getSelectors:b,get selectors(){return b(S)},selectSlice:S}}const m={name:a,reducer:v,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:g,...y(o),injectInto(x,{reducerPath:_,...S}={}){const b=_??o;return x.inject({reducerPath:b,reducer:v},S),{...m,...y(b,!0)}}};return m}}function qvt(e,t,r,n){function i(a,...o){let s=t(a);return typeof s>"u"&&n&&(s=r()),e(s,...o)}return i.unwrapped=e,i}var l8=Xvt();function Zvt(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Kvt({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!Jvt(n))throw new Error(Xs(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?sre(e,o):sre(e))}function Qvt(e){return e._reducerDefinitionType==="asyncThunk"}function Jvt(e){return e._reducerDefinitionType==="reducerWithPrepare"}function egt({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Xs(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:u,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),s&&n.addCase(f.pending,s),l&&n.addCase(f.rejected,l),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:o||XT,pending:s||XT,rejected:l||XT,settled:u||XT})}function XT(){}function Xs(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}function u8(e,{payload:t}){return{...e,...t}}const tgt={message:null},Bbe=l8({name:"snackbar",initialState:tgt,reducers:{setSnackbar:u8}}),z0=Bbe.actions,rgt=Bbe.reducer,ngt={resolution:5,testruns:{},currentTestrunIndex:0,testrunsForDisplay:[]},Fbe=l8({name:"toolbar",initialState:ngt,reducers:{setToolbar:u8}}),Vbe=Fbe.actions,igt=Fbe.reducer,cm={CLOUD:"CLOUD",CLASSIC:"CLASSIC"},agt={viewType:cm.CLOUD},$be=l8({name:"ui",initialState:agt,reducers:{setUi:u8}}),ogt=$be.actions,sgt=$be.reducer,Gbe=B.createContext(null),lgt=Mbe({snackbar:rgt,toolbar:igt,ui:sgt}),Wbe=Wvt({reducer:lgt,middleware:e=>e()}),vu=Kk,Mu=Pue(Gbe),ugt=()=>e=>Wbe.dispatch(e);function Ic(e,t){const r=ugt();return B.useCallback(n=>{r(e(n))},[e,r])}function cgt(){const e=vu(({swarm:r})=>r.state),t=Mu(({ui:r})=>r.viewType);return e===ur.READY?null:W.jsxs(Vt,{sx:{display:"flex",columnGap:2,marginY:"auto",height:"50px"},children:[e===ur.STOPPED?W.jsx($pe,{}):W.jsxs(W.Fragment,{children:[W.jsx(Fpe,{}),W.jsx(Wpe,{})]}),t==cm.CLASSIC&&W.jsx(Gpe,{})]})}function fgt(){return W.jsx(tde,{position:"static",children:W.jsx(Fv,{maxWidth:"xl",children:W.jsxs(Nde,{disableGutters:!0,sx:{display:"flex",justifyContent:"space-between",columnGap:2},children:[W.jsx(ai,{color:"inherit",href:"/",sx:{display:"flex",alignItems:"center"},underline:"none",children:W.jsx(ape,{})}),W.jsxs(Vt,{sx:{display:"flex",columnGap:6},children:[!window.templateArgs.isGraphViewer&&W.jsxs(W.Fragment,{children:[W.jsx(kpe,{}),W.jsx(cgt,{})]}),W.jsx(Cpe,{})]})]})})})}function hgt(){const e=Ic(ogt.setUi),{viewType:t}=Mu(({ui:n})=>n),r=t===cm.CLOUD?cm.CLASSIC:cm.CLOUD;return W.jsx(Fv,{maxWidth:"xl",sx:{position:"relative"},children:W.jsx(bu,{onClick:()=>e({viewType:r}),sx:{position:"absolute",mt:"4px",right:16,zIndex:1},children:r})})}function dgt({children:e}){const t=vu(({swarm:r})=>r.state);return W.jsxs(W.Fragment,{children:[W.jsx(fgt,{}),!window.templateArgs.isGraphViewer&&t!==ur.READY&&W.jsx(hgt,{}),W.jsx("main",{children:e})]})}function pgt(){const e=B.useCallback(()=>r({message:null}),[]),t=Mu(({snackbar:n})=>n.message),r=Ic(z0.setSnackbar);return W.jsx(b4e,{autoHideDuration:5e3,onClose:e,open:!!t,children:W.jsx(FI,{onClose:e,severity:"error",sx:{width:"100%"},variant:"filled",children:t})})}function vgt(){const{numUsers:e,workerCount:t}=vu(({swarm:s})=>s),[r,n]=B.useState(),[i,a]=B.useState(!1),o=B.useCallback(({target:s})=>{if(s&&s.name==="userCount"){const l=s.value;window.templateArgs.maxUserCount&&l>window.templateArgs.maxUserCount?(n({level:"error",message:"The number of users has exceeded the allowance for this account."}),a(!0)):l>t*500?(n({level:"warning",message:`Locust worker count is determined by the User count you specified at start up (${e}), and launching more users risks overloading workers, impacting your results. Re-run locust-cloud with your desired user count to avoid this.`}),a(!1)):(a(!1),n(void 0))}},[e,t]);return W.jsx(NG,{alert:r,isDisabled:i,onFormChange:o})}const Hbe="5",ggt=["1","2",Hbe,"10","30"],ygt=e=>{const t=new URL(window.location.href);for(const[r,n]of Object.entries(e))t.searchParams.set(r,n);window.history.pushState(null,"",t)};function c8({onSelectTestRun:e}){const t=Ic(Vbe.setToolbar),{testruns:r,testrunsForDisplay:n}=Mu(({toolbar:a})=>a),i=a=>{e&&e(a.target.value);const o=r[a.target.value];t({currentTestrun:o.runId,currentTestrunIndex:o.index}),ygt({testrun:a.target.value})};return W.jsxs(Vt,{sx:{display:"flex",columnGap:2,mb:1},children:[W.jsx(jS,{defaultValue:Hbe,label:"Resolution",name:"resolution",onChange:a=>t({resolution:Number(a.target.value)}),options:ggt,size:"small",sx:{width:"150px"}}),!!n.length&&W.jsx(jS,{label:"Test Run",name:"testrun",onChange:i,options:n,size:"small",sx:{width:"250px"}})]})}function Pn(e,t,r,n){fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(i=>i.json()).then(i=>r(i)).catch(i=>console.error(i))}const yy=(e,t)=>e.reduce((r,n)=>{const{name:i,time:a}=n,o=n[t]||"0",s=r.time||[];return s.push(a),r[i]?(r[i].push([a,o]),{...r,time:s}):{...r,[i]:[[a,o]],time:s}},{});function kf(e){return Of(Number(e[1]),2)}const e_={time:[]},mgt={time:[]},Vg={RPS:["#00ca5a","#0099ff","#ff6d6d"],PER_REQUEST:["#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],ERROR:["#ff8080","#ff4d4d","#ff1a1a","#e60000","#b30000","#800000"]},xgt=["Users","RPS"],_gt=[{name:"Users",key:"users",yAxisIndex:0},{name:"Requests per Second",key:"rps",yAxisIndex:1,areaStyle:{}},{name:"Errors per Second",key:"errorRate",yAxisIndex:1,areaStyle:{}}],bgt=e=>e?e[e.length-1][1]:"0";function jbe(){const{state:e}=vu(({swarm:R})=>R),{resolution:t,currentTestrunIndex:r,currentTestrun:n,testruns:i}=Mu(({toolbar:R})=>R);Ic(z0.setSnackbar);const[a,o]=B.useState(!0),[s,l]=B.useState(!1),[u,c]=B.useState(new Date().toISOString()),[f,h]=B.useState([]),[d,p]=B.useState(mgt),[v,g]=B.useState(e_),[y,m]=B.useState(e_),[x,_]=B.useState(e_),[S,b]=B.useState(e_),[w,C]=B.useState(e_),T=R=>Pn("/cloud-stats/request-names",R,F=>{(r!==0&&!F.length||r===0&&e!==ur.RUNNING&&!F.length)&&l(!0),h(F.map(({name:E})=>({name:`${E}`,key:E})))}),M=R=>Pn("/cloud-stats/rps",R,F=>p(F.reduce((E,{users:G,rps:j,errorRate:V,time:U})=>({users:[...E.users||[],[U,G||bgt(E.users)]],rps:[...E.rps||[],[U,j||"0"]],errorRate:[...E.errorRate||[],[U,V||"0"]],time:[...E.time||[],U]}),{}))),I=R=>Pn("/cloud-stats/rps-per-request",R,F=>g(yy(F,"throughput"))),A=R=>Pn("/cloud-stats/avg-response-times",R,F=>{m(yy(F,"responseTime")),a&&o(!1)}),k=R=>Pn("/cloud-stats/errors-per-request",R,F=>_(yy(F,"errorRate"))),D=R=>Pn("/cloud-stats/perc99-response-times",R,F=>b(yy(F,"perc99"))),P=R=>Pn("/cloud-stats/response-length",R,F=>C(yy(F,"responseLength"))),L=R=>{if(n){const F=new Date().toISOString(),E={start:n,end:R||u,resolution:t,testrun:n};T(E),I(E),A(E),k(E),D(E),P(E),M(E),c(F)}};yc(L,1e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING,immediate:!0}),B.useEffect(()=>{if(n){const{endTime:R}=i[new Date(n).toLocaleString()];L(R)}else L()},[n,t]),B.useEffect(()=>{e===ur.RUNNING&&o(!0)},[e]);const O=B.useCallback(()=>{o(!0),l(!1)},[]);return W.jsxs(W.Fragment,{children:[W.jsx(c8,{onSelectTestRun:O}),s&&W.jsx(FI,{severity:"error",children:"There was a problem loading some graphs for this testrun."}),W.jsxs(Vt,{sx:{position:"relative"},children:[a&&W.jsx(Vt,{sx:{position:"absolute",height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0.4)",zIndex:1,display:"flex",justifyContent:"center",paddingTop:4},children:W.jsx(Dze,{})}),W.jsx(Rl,{chartValueFormatter:kf,charts:d,colors:Vg.RPS,lines:_gt,splitAxis:!0,title:"Throughput / active users",yAxisLabels:xgt}),(!s||s&&!!f.length)&&W.jsxs(W.Fragment,{children:[W.jsx(Rl,{chartValueFormatter:R=>`${Of(Number(R[1]),2)}ms`,charts:y,colors:Vg.PER_REQUEST,lines:f,title:"Average Response Times"}),W.jsx(Rl,{chartValueFormatter:kf,charts:v,colors:Vg.PER_REQUEST,lines:f,title:"RPS per Request"}),W.jsx(Rl,{chartValueFormatter:kf,charts:x,colors:Vg.ERROR,lines:f,title:"Errors per Request"}),W.jsx(Rl,{chartValueFormatter:kf,charts:S,colors:Vg.PER_REQUEST,lines:f,title:"99th Percentile Response Times"}),W.jsx(Rl,{chartValueFormatter:kf,charts:w,colors:Vg.PER_REQUEST,lines:f,title:"Response Length"})]})]})]})}const cre=e=>e===1?"":"s";function Sgt(e){if(!e||!e.length||!e[0].totalVuh)return"Unknown";const[{totalVuh:t}]=e,[r,n]=t.includes("days")?t.split(", "):["0 days",t],i=parseInt(r)*24,[a,o]=n.split(":").map(Number),s=a+i;return[s&&`${s} hour${cre(s)}`,o&&`${o} minute${cre(o)}`].filter(Boolean).join(", ")}function Ube(){const[e,t]=B.useState(),r=vu(({swarm:n})=>n.state);return B.useEffect(()=>{Pn("/cloud-stats/total-runtime",{},n=>t(Sgt(n)))},[r]),W.jsxs(ll,{elevation:3,sx:{py:4,px:8,display:"flex",flexDirection:"column",alignItems:"center",rowGap:4},children:[window.templateArgs.username&&W.jsxs(Vt,{sx:{display:"flex",alignItems:"center",flexDirection:"column",rowGap:1},children:[W.jsx(Pt,{sx:{fontWeight:"bold"},children:"Current User"}),W.jsx(Pt,{children:window.templateArgs.username})]}),W.jsxs(Vt,{sx:{display:"flex",alignItems:"center",flexDirection:"column",rowGap:1},children:[W.jsx(Pt,{sx:{fontWeight:"bold"},children:"Current Month Virtual User Time"}),e&&e]})]})}function Ybe(){const e=vu(({swarm:f})=>f.state),{currentTestrun:t}=Mu(({toolbar:f})=>f);Ic(z0.setSnackbar);const[r,n]=B.useState(new Date().toISOString()),[i,a]=B.useState({time:[]}),[o,s]=B.useState([]),l=f=>Pn("/cloud-stats/scatterplot",f,h=>a(yy(h,"responseTime"))),u=f=>Pn("/cloud-stats/request-names",f,h=>s(h.map(({name:d})=>({name:`${d}`,key:d})))),c=()=>{if(t){const f=new Date().toISOString(),h={start:t,end:r,testrun:t};u(h),l(h),n(f)}};return yc(()=>{c()},5e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING}),B.useEffect(()=>{c()},[t]),W.jsxs(W.Fragment,{children:[W.jsx(c8,{}),W.jsx(Rl,{chartValueFormatter:kf,charts:i,colors:["#8A2BE2","#0000FF","#00ca5a","#FFA500","#FFFF00","#EE82EE"],lines:o,scatterplot:!0,title:"Scatterplot"})]})}/*! *****************************************************************************
|
271
271
|
Copyright (c) Microsoft Corporation.
|
272
272
|
|
273
273
|
Permission to use, copy, modify, and/or distribute this software for any
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<meta name="theme-color" content="#000000" />
|
9
9
|
|
10
10
|
<title>Locust Cloud</title>
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
11
|
+
<script type="module" crossorigin src="./assets/index-CgjytB1w.js"></script>
|
12
12
|
</head>
|
13
13
|
<body>
|
14
14
|
<div id="root"></div>
|